Documentation
¶
Overview ¶
Package fakeacp is a scripted ACP v1 agent for tests. A test binary re-executes itself with EnvVar=1 and calls Main from TestMain; the agent then speaks ACP over stdio, logs every request it receives to $LogEnv (one JSON object per line), and scripts each turn from the prompt's first text block:
slow:<ms> sleep, tracking concurrent turns (logged as {"method":"_active","n":N})
block wait for session/cancel, then stop with "cancelled"
permission ask session/request_permission and echo the outcome
subagent a Task tool call and a child update tagged with claude-agent-acp's parentToolUseId
subagent-permission a subagent's tool call, then a permission request for it on the parent session
native-subagent claude-agent-acp's native subagent session: subagent_spawned, the child's own updates and a
permission request on the child's session ID, then subagent_state_update
opencode-subagent an OpenCode task: the child session is named only on the $OpenCodeEnv event stream and
streams (and asks for permission) once the client opens it with session/resume
replay:<path> send each session update in a JSON array file, as captured from a real adapter, on the prompted
session, or on another as {"sessionId": ..., "update": ...}
unknown an unknown content block and an unknown session update kind
authfail fail the turn with -32000 "Authentication required"
mode:<id> switch the session's mode itself (current_mode_update), like leaving plan mode
anything echo it back as "echo:<text>"
Like a Claude model without Auto support, the "smart" model answers the auto mode with acceptEdits.
Index ¶
Constants ¶
const ( // EnvVar makes a re-executed test binary run the fake agent. EnvVar = "DEVBOX_FAKE_ACP" // LogEnv is the request log path. LogEnv = "FAKE_ACP_LOG" )
const OpenCodeChild = "ses_child"
OpenCodeChild is the child session the opencode-subagent scenario's task spawns.
const OpenCodeEnv = "FAKE_OPENCODE_ADDR"
OpenCodeEnv is the address the fake serves an OpenCode-style /global/event stream on; the stream requires basic auth as opencode:$OPENCODE_SERVER_PASSWORD.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.