Documentation
¶
Overview ¶
Package acp is the Agent Client Protocol built into the server.
JSON-RPC lives here because ACP is JSON-RPC. Another protocol does not import this package. The program on the other end of the connection is the caller's. This package asks that program for permission, a selection, and file credentials. It does not implement that program.
Index ¶
- Constants
- func ElicitationResultToSelectionPayload(raw json.RawMessage, opts []tacklr.UserChoice) (action string, resolution []byte, err error)
- func ErrorBody(id json.RawMessage, err error) map[string]any
- func ErrorCode(err error) int
- func InitializeResult(agent tacklr.AgentOptions, clientProtocolVersion int, methods []ACPAuthMethod, ...) map[string]any
- func New(wire server.ProtocolWireStore) server.Protocol
- func NewWithAuth(wire server.ProtocolWireStore, methods []ACPAuthMethod, logout bool) server.Protocol
- func PermissionToACPParams(sessionID, toolCallID string, perm tacklr.ToolPermissionInterrupt) map[string]any
- func RequestPermissionResultToPayload(raw json.RawMessage) (resolution []byte, cancelled bool, err error)
- func SelectionToElicitationParams(sessionID, toolCallID, question string, opts []tacklr.UserChoice) map[string]any
- type ACPAuthMethod
- type ClientCapabilities
- type ElicitationResult
- type InterruptEventEnvelope
- type RequestPermissionResult
Constants ¶
const ( CodeInvalidRequest = -32600 CodeMethodNotFound = -32601 CodeInternal = -32603 CodeApplication = -32000 CodeCancelled = -32800 )
JSON-RPC 2.0 error codes. Cancelled follows the ACP / LSP convention.
Variables ¶
This section is empty.
Functions ¶
func ElicitationResultToSelectionPayload ¶
func ElicitationResultToSelectionPayload(raw json.RawMessage, opts []tacklr.UserChoice) (action string, resolution []byte, err error)
ElicitationResultToSelectionPayload maps an accept response to the harness interrupt resolution payload. Returns action and optional selection JSON.
func ErrorBody ¶
func ErrorBody(id json.RawMessage, err error) map[string]any
ErrorBody is one JSON-RPC error envelope.
func InitializeResult ¶
func InitializeResult(agent tacklr.AgentOptions, clientProtocolVersion int, methods []ACPAuthMethod, logout bool) map[string]any
Prompt baseline (no capability bits): Text + ResourceLink are always accepted. Optional: image (model-gated), audio (off), embeddedContext (Resource text/blob).
func New ¶
func New(wire server.ProtocolWireStore) server.Protocol
New returns the native ACP server.Protocol. Nil wire uses an in-memory store.
func NewWithAuth ¶
func NewWithAuth(wire server.ProtocolWireStore, methods []ACPAuthMethod, logout bool) server.Protocol
NewWithAuth configures the ACP v1 presentation for a generic host security service. It does not implement credential verification itself. It does not change methods.
func PermissionToACPParams ¶
func PermissionToACPParams(sessionID, toolCallID string, perm tacklr.ToolPermissionInterrupt) map[string]any
PermissionToACPParams builds session/request_permission params.
func RequestPermissionResultToPayload ¶
func RequestPermissionResultToPayload(raw json.RawMessage) (resolution []byte, cancelled bool, err error)
RequestPermissionResultToPayload maps a client permission response to the harness resolution payload. cancelled yields a non-nil err suitable for ending the turn.
func SelectionToElicitationParams ¶
func SelectionToElicitationParams(sessionID, toolCallID, question string, opts []tacklr.UserChoice) map[string]any
SelectionToElicitationParams builds form-mode elicitation/create params from a user-selection interrupt. ask_user_choice already requires ≥2 titled options.
Types ¶
type ACPAuthMethod ¶
ACPAuthMethod presents one host security scheme through the ACP v1 agent authentication flow. Scheme is the protocol-neutral Authenticator identifier.
type ClientCapabilities ¶
ClientCapabilities captures client features from initialize.
func ParseClientCapabilities ¶
func ParseClientCapabilities(params json.RawMessage) ClientCapabilities
ParseClientCapabilities extracts elicitation mode support and Tacklr VFS token refresh from initialize params.
type ElicitationResult ¶
type ElicitationResult struct {
Action string `json:"action"`
Content map[string]any `json:"content"`
}
ElicitationResult is the Client response to elicitation/create.
type InterruptEventEnvelope ¶
type InterruptEventEnvelope struct {
InterruptId string `json:"interruptId"`
Type string `json:"type"`
Data json.RawMessage `json:"data"`
}
InterruptEventEnvelope is the harness session.EventInterrupt Data shape.
type RequestPermissionResult ¶
type RequestPermissionResult struct {
Outcome struct {
Outcome string `json:"outcome"`
OptionID string `json:"optionId,omitempty"`
} `json:"outcome"`
}
RequestPermissionResult is the Client response to session/request_permission.