Documentation
¶
Overview ¶
Package acp adapts a foreign agent that speaks the Agent Client Protocol to the neutral driver contracts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildRestoredWith ¶
func BuildRestoredWith(cfg Config) foreign.RestoredBuilder
BuildRestoredWith adapts ACP resume construction to the legacy Harness restored builder. It withholds all scoped capabilities by invoking the additive builder with zero Services.
func BuildRestoredWithServices ¶
func BuildRestoredWithServices(cfg Config) foreign.ServicesRestoredBuilder
BuildRestoredWithServices adapts ACP resume construction to the additive Harness restored builder. The journal's AgentSessionID is authoritative for ACP session/load; ForeignSID remains the backend's recovered routing identity. An empty AgentSessionID preserves legacy session/new behavior.
func BuildWith ¶
BuildWith adapts an ACP configuration to the legacy Harness foreign-loop builder. It withholds all scoped capabilities by invoking the additive builder with zero Services.
func BuildWithServices ¶
func BuildWithServices(cfg Config) foreign.ServicesBuilder
BuildWithServices adapts an ACP configuration to the additive Harness services-aware builder. Each invocation creates one ACP driver and one backend Loop. The returned identity is the agent-assigned ACP session id, which the backend binds on the first live turn through a synthetic KindInit event.
Types ¶
type Config ¶
type Config struct {
// Harness selects the adapter contract.
Harness Harness
// Executable is the clean absolute path to the ACP adapter binary.
Executable string
// Env is the complete child environment supplied by the caller.
Env []string
// Credential selects whether the child uses the product gateway or its
// own harness login state.
Credential loop.CredentialMode
// Binding is borrowed caller-owned proxy data. The driver never starts or
// closes anything represented by this value. It is required for
// gateway-backed children and must be zero for native-auth children.
Binding launch.ProxyBinding
// ModelAlias is the primary harness-facing model alias.
ModelAlias string
// Effort is the neutral native reasoning-effort selector. Native explicit
// effort requires ModelAlias; an empty or "none" value leaves effort
// selection to the selected model. When both ModelAlias and Effort are
// empty, the harness owns model and effort selection. Gateway launches do
// not use this field and reject non-empty values.
Effort string
// SmallModelAlias is required by Claude Code and forbidden by Codex.
SmallModelAlias string
// Posture is the neutral access posture for the child.
Posture driver.Posture
// AgentSessionID resumes an existing agent-side session when non-empty.
AgentSessionID string
// WorkspaceRoot is the absolute session working directory.
WorkspaceRoot string
// McpServers is the complete MCP server list supplied to ACP session/new
// and session/load. New snapshots this value before retaining it so nested
// caller-owned slices and metadata cannot be mutated after construction.
McpServers []protocol.McpServer
}
Config is the caller-owned configuration for an ACP driver.
type ConfigError ¶
ConfigError reports invalid caller-supplied ACP configuration.
func (*ConfigError) Error ¶
func (e *ConfigError) Error() string
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver owns one launch.Dial result and one ACP session for its entire lifetime. Turns will use this session in later driver work; construction never creates a per-turn client or process.
func New ¶
New validates cfg, launches one ACP client/process, creates or loads one session, and applies the harness-specific model and posture before returning. Any failure after dialing closes the owned launch result before returning.
func (*Driver) AgentSessionID ¶
AgentSessionID returns the ACP session id assigned by session/new or used for session/load. It remains stable for the driver's lifetime.
func (*Driver) Close ¶
Close cancels active turns, releases the owned ACP connection/process exactly once, and rejects new turns thereafter. The shared proxy binding is only data passed to launch.Dial and is never touched here.
func (*Driver) Spawn ¶
Spawn starts one prompt on the session created by New. The caller context owns stream forwarding and cancellation; the driver's context owns the protocol operation and is canceled only when the driver closes.
func (*Driver) Steer ¶
func (d *Driver) Steer(ctx context.Context, request driver.SteerRequest) (driver.SteerResult, error)
Steer queues one active-turn injection through the turn arbiter. The arbiter owns provider translation and the dispatcher owns the single in-flight ACP request; this method only waits for the one result paired with its observation.