Skip to content

BashSession

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/agent-core/src/tools/bash-session.ts

A persistent shell session that maintains cwd, env vars, and venv activation across commands. Spawns a single bash process and sends commands via stdin, reading output until a unique delimiter marker signals completion.

Methods

MethodSignatureReturns
startstart()Promise<void>
executeexecute(command: string, options: { timeout?: number })Promise<BashResult>
getCwdgetCwd()string
isDisposedisDisposed()boolean
isRunningisRunning()boolean
disposedispose()void

Where it refuses work

  • BashSession stops the work with Error when this.disposed — “BashSession has been disposed”.
  • BashSession stops the work with Error when this.disposed || !this.process?.stdin || !this.process?.stdout — “BashSession is not running. Call start() first or session was disposed.”.
  • BashSession stops the work with an early return when this.process.
  • BashSession stops the work with an early return when settled.
  • BashSession stops the work with an early return when this.disposed.
  • BashSession stops the work with an early return when process.env.SHELL.

When something fails

  • BashSession handles failure in 2 places: it discards it silently in all 2.

Was this page helpful?

Download as PDF