acp

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

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

View Source
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 ErrorCode

func ErrorCode(err error) int

ErrorCode maps err to a JSON-RPC 2.0 code.

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

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

type ACPAuthMethod struct {
	ID          string
	Name        string
	Description string
	Scheme      string
}

ACPAuthMethod presents one host security scheme through the ACP v1 agent authentication flow. Scheme is the protocol-neutral Authenticator identifier.

type ClientCapabilities

type ClientCapabilities struct {
	ElicitationForm bool
	ElicitationURL  bool
	VFSTokenRefresh bool
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL