@agents-js/acp
v0.4.0
Published
Low-level ACP client — spawns an agent process, communicates over stdio/NDJSON, and manages the ACP protocol lifecycle.
Maintainers
Readme
@agents-js/acp
Low-level ACP client — spawns an agent process, communicates over stdio/NDJSON, and manages the ACP protocol lifecycle.
Installation
bun add @agents-js/acpAPI
Classes
ACPClientController— Low-level ACP client controller managing the full agent lifecycle. This is the Provider for ACP communication. It owns the connection state machine, sends protocol messages over a stdio/NDJSON ...CwdResolutionErrorResilientACPProcess
Functions
buildSpawnEnv— Build the env map for the spawned child. WheninheritedEnvKeysis supplied, parent env is filtered to those keys (everything else is dropped before overrides are layered on); otherwise the full `...createErrorAwareReadable— Wrap a ReadableStreamDefaultReader in an error-aware ReadableStream that propagates child-process spawn/exit errors instead of silently closing. Attacheserrorandcloseevent handlers to the c...extractPromptText— Extract the concatenated textual representation of an ACPPromptRequest. Local-process agent adapters (pi-acp, droid-acp, trial-agent, ...) all need to flatten the structuredpromptarray into ...extractRequestErrorDetails— Extract the most useful human-readable string from a JSON-RPC error'sdatafield. Priority: 1.data.details(string) 2.data.message(string) 3. JSON-stringifieddata(non-empty, non-{}o...formatRequestError— Format an error into a single human-readable string that includes botherror.messageAND anydata.details/data.messagecontext from a JSON-RPCRequestError. Falls back toerror.message...resolveSessionCwdrunAcpWrapperBinary— Run an in-repo wrapper ACP binary. Returns once--help/--versionexit paths fire; otherwise resolves immediately after theAgentSideConnectionis wired up — the connection keeps the process a...spawnACPAgent— Spawn an ACP agent as a subprocess and create an ndJSON stream for communication.
Interfaces
ACPClientControllerOptionsACPClientState— State machine for the ACP client controller. Transitions follow this lifecycle: ``` idle -> initializing -> ready -> starting_session -> session_ready | ^ v | prompting --+ | v cancelling -> sessio...ACPHostAdapters— Host platform callbacks injected into the ACP client controller at construction time. This is the primary Adapter interface in the Ports & Adapters architecture. The controller delegates all ho...ACPProcessACPProcessOptionsAcpWrapperBinarySpecErrorAwareStreamOptionsErrorSignal— Handle for signalling errors into an error-aware readable stream. Attach child-process event handlers that callsignal()on failure.LogSinkResilientACPProcessOptions
Types
ACPControllerEventACPWorkspaceRootPolicyExhaustionCallbackSessionNotificationSessionUpdateStream
Constants
consoleLogSink
Exports
CLIENT_METHODSClientSideConnectionndJsonStreamPROTOCOL_VERSIONRequestErrortype AcpWrapperBinarySpectype LogSink
Dependencies
@agentclientprotocol/sdk@agents-js/policy
License
MIT
