Documentation
¶
Overview ¶
Package acp implements a preview Agent Client Protocol (ACP) version 1 companion. It speaks ACP over stdio and turns each prompt into an ordinary AMQ message. It never opens a socket, never executes tools, and never advertises ACP version 2.
Index ¶
Constants ¶
const ( EnvRoot = "AM_ROOT" EnvMe = "AM_ME" EnvTo = "AMQ_ACP_TO" EnvBaseRoot = "AM_BASE_ROOT" EnvSession = "AM_SESSION" EnvRootID = "AM_ROOT_ID" EnvBaseRootID = "AM_BASE_ROOT_ID" )
Environment variables that select the routing context. The pin variables are the same ones amq itself honors. This companion authenticates them and refuses on a mismatch instead of restating the CLI's routing policy.
const ( EgressConfirmed = "confirmed" EgressUncertain = "uncertain" DeliveryDuplicate = "already_queued" )
const DeliveryStateQueued = "queued_to_inbox"
DeliveryStateQueued is the honest post-delivery state. The message sits in the recipient's inbox/new; consumption is a separate, unproven event.
const PromptSubject = "ACP prompt"
PromptSubject labels prompts arriving over the ACP companion so an operator reading a mailbox can tell where the message came from.
const ProtocolVersion = 1
ProtocolVersion is the only ACP version this companion speaks. It is never negotiated upward: a client asking for a newer version still receives 1 and decides for itself whether to disconnect.
const StopReasonEndTurn = "end_turn"
StopReasonEndTurn ends a prompt turn once the message is queued. The turn is genuinely over because this companion runs no model and requests no tools.
Variables ¶
This section is empty.
Functions ¶
func PrepareWorkerEnv ¶ added in v0.68.0
func PrepareWorkerEnv() error
PrepareWorkerEnv enforces the Buzz remote-task policy on this process, then strips every BUZZ_* variable so secrets cannot leak into later work.
agents must be 1 and inbound must be owner-only. The gate waits for the harness to hold a Buzz NIP-PL kind:30350 lease with a quota-1 deployment-identity profile (block/buzz#5667); this companion does not treat an env string as one.
Types ¶
type Config ¶
Config is the resolved routing context for one amq-acp process.
func LoadConfig ¶
LoadConfig resolves the routing context from the environment. An absent root, an unusable handle, or a session pin that cannot be authenticated all refuse; there is no fallback to a guessed root.
type ContextError ¶
type ContextError struct {
Message string
}
ContextError marks a fail-closed routing refusal so the caller can report the repository's context-mismatch exit code.
func (*ContextError) Error ¶
func (e *ContextError) Error() string
type Delivery ¶
type Delivery struct {
MessageID string
To string
Thread string
EventID string
State string
Committed bool
Drained bool
Started bool
Completed bool
Egress string
Duplicate bool
}
Delivery is the durable outcome of one prompt turn. The message is queued in the recipient's inbox; nothing here proves the recipient consumed it.
func DeliverPrompt ¶
DeliverPrompt writes the prompt text into the destination inbox using the ordinary Maildir tmp -> new delivery, so amq list and amq drain observe it exactly like any other message. Recipient and root always come from Config; prompt text, including a Buzz [Context] section, is never treated as authentication or a routing override.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a single-connection ACP v1 agent. Requests are handled one at a time in arrival order, so the session table needs no locking.