Expand description
AcpController: manages agent CLIs that speak the Agent Client Protocol (ACP).
ACP is a JSON-RPC 2.0 protocol over stdin/stdout — the “LSP for AI agents.” Instead of custom per-provider output parsing, ACP provides a standardized protocol for session management, prompting, and streaming events.
Lifecycle:
- Spawn the ACP agent process (e.g.,
gemini --acp,openclaw acp) - Send
initializerequest, receive capabilities - Send
initializednotification - Create a session via
session/create - For each user turn: send
session/prompt, streamsession/updatenotifications - On close: send
shutdown+exit
I/O model (similar to PersistentSubprocessController):
- stdin_writer: sends JSON-RPC requests/notifications to agent
- stdout_reader: reads JSON-RPC responses/notifications, persists + broadcasts
- process_waiter: monitors process lifecycle
See: https://github.com/agentclientprotocol/agent-client-protocol
Modules§
- spawn_
steps - The steps of
AcpController::spawn_process, one function each, in the order they ran: launch the child, drain its stderr, mark it running, start the stdin writer, the stdout reader and the process waiter, then sendinitialize. Moved out ofspawn_processwithout a change in behaviour.
Structs§
- AcpController
- AcpController manages an ACP-speaking agent process.
Constants§
- ACP_
OUTPUT_ SUBJECT - MPS file subject name for ACP output.
- BLOCK_
CONTROLLER_ ACP - TURN_
RUNNING - What
submit_inputsays to a slash command that arrives while a turn is running: a harness takes/compactonly between turns, and queued behind other text it would no longer be a command. The caller waits for the turn’s end.