Skip to main content

Module bash

Module bash 

Source
Expand description

Product bash execution impls.

Ports .references/pi/packages/coding-agent/src/core/agent-session.ts executeBash, recordBashResult, abortBash, isBashRunning, hasPendingBashMessages, and _flushPendingBashMessages.

Behaviour preserved from the TypeScript contract:

  • execute_bash prepends settings.shellCommandPrefix (when set), runs through the configured BashOperations, streams output chunks through on_chunk, and records a BashExecutionMessage entry on the session.
  • exclude_from_context: true (!! prefix) records the entry with the flag set so crate::core::messages drops it from LLM context.
  • While the agent is streaming, recorded bash messages are queued and flushed on agent_end so tool_use / tool_result ordering is preserved.
  • abort_bash cancels the in-flight token; the next call can start a new command.

Lock order: never hold AgentSessionInner across .await. The session manager async mutex is acquired for append-only persistence.

Structs§

BashResult
Result of a product bash execution (TypeScript BashResult).
ExecuteBashOptions
Options accepted by AgentSession::execute_bash.

Enums§

BashExecError
Errors produced by AgentSession::execute_bash.