Documentation
¶
Overview ¶
Package acp provides a Go SDK for building Agent Client Protocol (ACP) agents and clients.
Connect an agent to ACP clients, or add ACP agent support to an editor, terminal, or application. This community SDK is maintained by Caelis Labs and can be used independently of Caelis or any particular agent framework.
Getting started ¶
Implement Agent to serve initialization, session creation, prompts, and cancellation. Implement Client to receive streamed session updates and handle permission requests. Optional filesystem, terminal, and other capabilities have separate interfaces; advertise only those you implement.
The transport/stdio package binds an agent to process stdin/stdout or starts an agent executable for a client. It drains child stderr and provides context-controlled shutdown with owned process-tree cleanup. Runnable agent and client examples are linked from the README.
Compatibility and validation ¶
The stable root implements ACP wire protocol v1. Wire types and typed dispatch are generated from the pinned official schema identified by SchemaTag and SchemaCommit. Go module versions, schema versions, and the negotiated wire protocol version are separate identities.
A four-direction interoperability matrix checks Go clients and agents against pinned official TypeScript and Rust SDK peers. The release process also checks reproducible generation, race/static analysis, fuzzing, fresh consumer builds, and native Windows stdio behavior.
Connection supplies bounded, concurrent bidirectional JSON-RPC 2.0 over newline-delimited JSON, ordered notifications, cancellation, and lossless batch frames. PreparedRequest supports separate dispatch and response contexts, conservative submission-state reporting, and response observation.
Applications retain ownership of model execution, persistence, and permission policy. Draft ACP v2 lives separately in experimental/v2 and is not covered by the stable v1 API or its official SDK interoperability matrix.
Index ¶
- Constants
- Variables
- func AfterResponse(ctx context.Context, callback func(context.Context) error) error
- func InboundParamsFromContext(ctx context.Context) (json.RawMessage, bool)
- func Ptr[T any](v T) *T
- func RequestMayHaveBeenSubmitted(err error) bool
- func SendRequest[T any](c *Connection, ctx context.Context, method string, params any) (T, error)
- func SendRequestWithResponseHook[T any](c *Connection, ctx context.Context, method string, params any, ...) (T, error)
- type Agent
- type AgentAuthCapabilities
- type AgentAuthenticator
- type AgentCapabilities
- type AgentError
- type AgentLoader
- type AgentLogout
- type AgentNotification
- type AgentRequest
- type AgentResponse
- type AgentResult
- type AgentSessionCloser
- type AgentSessionConfig
- type AgentSessionDeleter
- type AgentSessionLister
- type AgentSessionMode
- type AgentSessionResumer
- type AgentSideConnection
- func AgentSideConnectionFromContext(ctx context.Context) (*AgentSideConnection, bool)
- func NewAgentSideConnection(agent Agent, peerInput io.Writer, peerOutput io.Reader) *AgentSideConnection
- func NewAgentSideConnectionWithOptions(agent Agent, peerInput io.Writer, peerOutput io.Reader, opts ConnectionOptions) (*AgentSideConnection, error)
- func (c *AgentSideConnection) CallExtension(ctx context.Context, method string, params any) (json.RawMessage, error)
- func (c *AgentSideConnection) Close() error
- func (c *AgentSideConnection) CompleteElicitation(ctx context.Context, params CompleteElicitationNotification) error
- func (c *AgentSideConnection) CreateElicitation(ctx context.Context, params CreateElicitationRequest) (CreateElicitationResponse, error)
- func (c *AgentSideConnection) CreateTerminal(ctx context.Context, params CreateTerminalRequest) (CreateTerminalResponse, error)
- func (c *AgentSideConnection) Done() <-chan struct{}
- func (c *AgentSideConnection) Err() error
- func (c *AgentSideConnection) KillTerminal(ctx context.Context, params KillTerminalRequest) (KillTerminalResponse, error)
- func (c *AgentSideConnection) NotifyExtension(ctx context.Context, method string, params any) error
- func (c *AgentSideConnection) ReadTextFile(ctx context.Context, params ReadTextFileRequest) (ReadTextFileResponse, error)
- func (c *AgentSideConnection) ReleaseTerminal(ctx context.Context, params ReleaseTerminalRequest) (ReleaseTerminalResponse, error)
- func (c *AgentSideConnection) RequestPermission(ctx context.Context, params RequestPermissionRequest) (RequestPermissionResponse, error)
- func (c *AgentSideConnection) SessionUpdate(ctx context.Context, params SessionNotification) error
- func (c *AgentSideConnection) SessionUpdateRaw(ctx context.Context, params json.RawMessage) error
- func (c *AgentSideConnection) SetLogger(l *slog.Logger)
- func (c *AgentSideConnection) TerminalOutput(ctx context.Context, params TerminalOutputRequest) (TerminalOutputResponse, error)
- func (c *AgentSideConnection) Wait(ctx context.Context) error
- func (c *AgentSideConnection) WaitForTerminalExit(ctx context.Context, params WaitForTerminalExitRequest) (WaitForTerminalExitResponse, error)
- func (c *AgentSideConnection) WriteTextFile(ctx context.Context, params WriteTextFileRequest) (WriteTextFileResponse, error)
- type Annotations
- type AudioContent
- type AuthCapabilities
- type AuthMethod
- type AuthMethodAgent
- type AuthMethodId
- type AuthMethodTerminal
- type AuthMethodTerminalInline
- type AuthenticateRequest
- type AuthenticateResponse
- type AvailableCommand
- type AvailableCommandInput
- type AvailableCommandsUpdate
- type BlobResourceContents
- type BooleanConfigOptionCapabilities
- type BooleanPropertySchema
- type CancelNotification
- type CancelRequestNotification
- type Client
- type ClientCapabilities
- type ClientElicitation
- type ClientElicitationCompletion
- type ClientError
- type ClientFileReader
- type ClientFileWriter
- type ClientNotification
- type ClientRequest
- type ClientResponse
- type ClientResult
- type ClientSessionCapabilities
- type ClientSideConnection
- func ClientSideConnectionFromContext(ctx context.Context) (*ClientSideConnection, bool)
- func NewClientSideConnection(client Client, peerInput io.Writer, peerOutput io.Reader) *ClientSideConnection
- func NewClientSideConnectionWithOptions(client Client, peerInput io.Writer, peerOutput io.Reader, ...) (*ClientSideConnection, error)
- func (c *ClientSideConnection) Authenticate(ctx context.Context, params AuthenticateRequest) (AuthenticateResponse, error)
- func (c *ClientSideConnection) CallExtension(ctx context.Context, method string, params any) (json.RawMessage, error)
- func (c *ClientSideConnection) Cancel(ctx context.Context, params CancelNotification) error
- func (c *ClientSideConnection) Close() error
- func (c *ClientSideConnection) CloseSession(ctx context.Context, params CloseSessionRequest) (CloseSessionResponse, error)
- func (c *ClientSideConnection) DeleteSession(ctx context.Context, params DeleteSessionRequest) (DeleteSessionResponse, error)
- func (c *ClientSideConnection) Done() <-chan struct{}
- func (c *ClientSideConnection) Err() error
- func (c *ClientSideConnection) Initialize(ctx context.Context, params InitializeRequest) (InitializeResponse, error)
- func (c *ClientSideConnection) ListSessions(ctx context.Context, params ListSessionsRequest) (ListSessionsResponse, error)
- func (c *ClientSideConnection) LoadSession(ctx context.Context, params LoadSessionRequest) (LoadSessionResponse, error)
- func (c *ClientSideConnection) Logout(ctx context.Context, params LogoutRequest) (LogoutResponse, error)
- func (c *ClientSideConnection) NewSession(ctx context.Context, params NewSessionRequest) (NewSessionResponse, error)
- func (c *ClientSideConnection) NewSessionWithResponseHook(ctx context.Context, params NewSessionRequest, ...) (NewSessionResponse, error)
- func (c *ClientSideConnection) NotifyExtension(ctx context.Context, method string, params any) error
- func (c *ClientSideConnection) Prompt(ctx context.Context, params PromptRequest) (PromptResponse, error)
- func (c *ClientSideConnection) ResumeSession(ctx context.Context, params ResumeSessionRequest) (ResumeSessionResponse, error)
- func (c *ClientSideConnection) SetLogger(l *slog.Logger)
- func (c *ClientSideConnection) SetSessionConfigOption(ctx context.Context, params SetSessionConfigOptionRequest) (SetSessionConfigOptionResponse, error)
- func (c *ClientSideConnection) SetSessionMode(ctx context.Context, params SetSessionModeRequest) (SetSessionModeResponse, error)
- func (c *ClientSideConnection) Wait(ctx context.Context) error
- type ClientTerminal
- type CloseSessionRequest
- type CloseSessionResponse
- type CompactionCapabilities
- type CompactionId
- type CompactionStatus
- type CompactionSummaryChunk
- type CompactionUpdate
- func (v *CompactionUpdate) ClearError()
- func (v *CompactionUpdate) ClearMeta()
- func (v *CompactionUpdate) ClearSummary()
- func (v CompactionUpdate) ErrorState() NullableFieldState
- func (v CompactionUpdate) MarshalJSON() ([]byte, error)
- func (v CompactionUpdate) MetaState() NullableFieldState
- func (v *CompactionUpdate) SetError(value string)
- func (v *CompactionUpdate) SetMeta(value map[string]json.RawMessage)
- func (v *CompactionUpdate) SetSummary(value []ContentBlock)
- func (v CompactionUpdate) SummaryState() NullableFieldState
- func (v *CompactionUpdate) UnmarshalJSON(b []byte) error
- func (v *CompactionUpdate) UnsetError()
- func (v *CompactionUpdate) UnsetMeta()
- func (v *CompactionUpdate) UnsetSummary()
- type CompleteElicitationNotification
- type ConfigOptionUpdate
- type Connection
- func NewConnection(handler MethodHandler, peerInput io.Writer, peerOutput io.Reader) *Connection
- func NewConnectionWithOptions(handler MethodHandler, peerInput io.Writer, peerOutput io.Reader, ...) (*Connection, error)
- func NewUnstartedConnection(handler MethodHandler, peerInput io.Writer, peerOutput io.Reader, ...) (*Connection, error)
- func (c *Connection) Close() error
- func (c *Connection) Done() <-chan struct{}
- func (c *Connection) Err() error
- func (c *Connection) SendNotification(ctx context.Context, method string, params any) error
- func (c *Connection) SendRequestNoResult(ctx context.Context, method string, params any) error
- func (c *Connection) SendTransportFrame(ctx context.Context, frame TransportFrame) error
- func (c *Connection) SetLogger(logger *slog.Logger)
- func (c *Connection) Start()
- func (c *Connection) Wait(ctx context.Context) error
- type ConnectionOptions
- type Content
- type ContentBlock
- type ContentBlockAudio
- type ContentBlockImage
- type ContentBlockResource
- type ContentBlockResourceLink
- type ContentBlockText
- type ContentChunk
- type Cost
- type CreateElicitationAccept
- type CreateElicitationCancel
- type CreateElicitationDecline
- type CreateElicitationForm
- type CreateElicitationOther
- type CreateElicitationRequest
- type CreateElicitationResponse
- type CreateElicitationResponseOther
- type CreateElicitationUrl
- type CreateTerminalRequest
- type CreateTerminalResponse
- type CurrentModeUpdate
- type DeleteSessionRequest
- type DeleteSessionResponse
- type Diff
- type DispatchOptions
- type ElicitationAcceptAction
- type ElicitationCapabilities
- type ElicitationContentValue
- type ElicitationContentValueBoolean
- type ElicitationContentValueInteger
- type ElicitationContentValueNumber
- type ElicitationContentValueString
- type ElicitationContentValueStringArray
- type ElicitationFormCapabilities
- type ElicitationFormMode
- type ElicitationFormModeRequest
- type ElicitationFormModeSession
- type ElicitationId
- type ElicitationPropertySchema
- type ElicitationPropertySchemaArray
- type ElicitationPropertySchemaBoolean
- type ElicitationPropertySchemaInteger
- type ElicitationPropertySchemaNumber
- type ElicitationPropertySchemaOther
- type ElicitationPropertySchemaString
- type ElicitationRequestScope
- type ElicitationSchema
- type ElicitationSchemaType
- type ElicitationSessionScope
- type ElicitationUrlCapabilities
- type ElicitationUrlMode
- type ElicitationUrlModeRequest
- type ElicitationUrlModeSession
- type EmbeddedResource
- type EmbeddedResourceResource
- type EnumOption
- type EnvVariable
- type Error
- type ErrorCode
- type ErrorCodeAuthenticationRequired
- type ErrorCodeInternalError
- type ErrorCodeInvalidParams
- type ErrorCodeInvalidRequest
- type ErrorCodeMethodNotFound
- type ErrorCodeOther
- type ErrorCodeParseError
- type ErrorCodeRequestCancelled
- type ErrorCodeResourceNotFound
- type ExtNotification
- type ExtRequest
- type ExtResponse
- type ExtensionMethodHandler
- type FileSystemCapabilities
- type FrameKind
- type HttpHeader
- type ImageContent
- type Implementation
- type InboundInfo
- type InboundKind
- type InitializeRequest
- type InitializeResponse
- type IntegerPropertySchema
- type KillTerminalRequest
- type KillTerminalResponse
- type ListSessionsRequest
- type ListSessionsResponse
- type LoadSessionRequest
- type LoadSessionResponse
- type LogoutCapabilities
- type LogoutRequest
- type LogoutResponse
- type McpCapabilities
- type McpServer
- type McpServerHttp
- type McpServerHttpInline
- type McpServerSse
- type McpServerSseInline
- type McpServerStdio
- type MessageId
- type MethodHandler
- type MultiSelectItems
- type MultiSelectItemsOther
- type MultiSelectItemsString
- type MultiSelectPropertySchema
- type NewSessionRequest
- type NewSessionResponse
- type Notice
- type NoticeCapabilities
- type NoticeSeverity
- type NullableFieldState
- type NumberPropertySchema
- type PermissionOption
- type PermissionOptionId
- type PermissionOptionKind
- type Plan
- type PlanEntry
- type PlanEntryPriority
- type PlanEntryStatus
- type PreparedRequest
- func PrepareAgentRequest[T any](c *AgentSideConnection, method string, params any) (*PreparedRequest[T], error)
- func PrepareClientRequest[T any](c *ClientSideConnection, method string, params any) (*PreparedRequest[T], error)
- func PrepareRequest[T any](c *Connection, method string, params any) (*PreparedRequest[T], error)
- func (r *PreparedRequest[T]) Abandon() RequestSubmissionState
- func (r *PreparedRequest[T]) CancelRequest(ctx context.Context) error
- func (r *PreparedRequest[T]) Dispatch(ctx context.Context, opts DispatchOptions) error
- func (r *PreparedRequest[T]) ObserveResponse(observer ResponseObserver) error
- func (r *PreparedRequest[T]) Wait(ctx context.Context) (T, error)
- type PromptCapabilities
- type PromptRequest
- type PromptResponse
- type ProtocolVersion
- type RPCResponse
- type ReadTextFileRequest
- type ReadTextFileResponse
- type ReleaseTerminalRequest
- type ReleaseTerminalResponse
- type RequestError
- func NewAuthRequired(data any) *RequestError
- func NewInternalError(data any) *RequestError
- func NewInvalidParams(data any) *RequestError
- func NewInvalidRequest(data any) *RequestError
- func NewMethodNotFound(method string) *RequestError
- func NewParseError(data any) *RequestError
- func NewRequestCancelled(data any) *RequestError
- func NewServerOverloaded(data any) *RequestError
- type RequestId
- type RequestIdNull
- type RequestIdNumber
- type RequestIdStr
- type RequestLifecycleError
- type RequestPermissionOutcome
- type RequestPermissionOutcomeCancelled
- type RequestPermissionOutcomeSelected
- type RequestPermissionRequest
- type RequestPermissionResponse
- type RequestSubmissionState
- type ResourceLink
- type ResponseDecodeError
- type ResponseObserver
- type ResumeSessionRequest
- type ResumeSessionResponse
- type Role
- type SelectedPermissionOutcome
- type SessionAdditionalDirectoriesCapabilities
- type SessionAvailableCommandsUpdate
- type SessionCapabilities
- type SessionCloseCapabilities
- type SessionCompactionUpdate
- func (v *SessionCompactionUpdate) ClearError()
- func (v *SessionCompactionUpdate) ClearMeta()
- func (v *SessionCompactionUpdate) ClearSummary()
- func (v SessionCompactionUpdate) ErrorState() NullableFieldState
- func (v SessionCompactionUpdate) MarshalJSON() ([]byte, error)
- func (v SessionCompactionUpdate) MetaState() NullableFieldState
- func (v *SessionCompactionUpdate) SetError(value string)
- func (v *SessionCompactionUpdate) SetMeta(value map[string]json.RawMessage)
- func (v *SessionCompactionUpdate) SetSummary(value []ContentBlock)
- func (v SessionCompactionUpdate) SummaryState() NullableFieldState
- func (v *SessionCompactionUpdate) UnmarshalJSON(b []byte) error
- func (v *SessionCompactionUpdate) UnsetError()
- func (v *SessionCompactionUpdate) UnsetMeta()
- func (v *SessionCompactionUpdate) UnsetSummary()
- type SessionConfigBoolean
- type SessionConfigGroupId
- type SessionConfigId
- type SessionConfigOption
- type SessionConfigOptionBoolean
- type SessionConfigOptionCategory
- type SessionConfigOptionSelect
- type SessionConfigOptionUpdate
- type SessionConfigOptionsCapabilities
- type SessionConfigSelect
- type SessionConfigSelectGroup
- type SessionConfigSelectOption
- type SessionConfigSelectOptions
- type SessionConfigSelectOptionsGrouped
- type SessionConfigSelectOptionsUngrouped
- type SessionConfigValueId
- type SessionCurrentModeUpdate
- type SessionDeleteCapabilities
- type SessionId
- type SessionInfo
- type SessionInfoUpdate
- func (v *SessionInfoUpdate) ClearTitle()
- func (v *SessionInfoUpdate) ClearUpdatedAt()
- func (v SessionInfoUpdate) MarshalJSON() ([]byte, error)
- func (v *SessionInfoUpdate) SetTitle(value string)
- func (v *SessionInfoUpdate) SetUpdatedAt(value string)
- func (v SessionInfoUpdate) TitleState() NullableFieldState
- func (v *SessionInfoUpdate) UnmarshalJSON(b []byte) error
- func (v *SessionInfoUpdate) UnsetTitle()
- func (v *SessionInfoUpdate) UnsetUpdatedAt()
- func (v SessionInfoUpdate) UpdatedAtState() NullableFieldState
- type SessionListCapabilities
- type SessionMode
- type SessionModeId
- type SessionModeState
- type SessionNotification
- type SessionResumeCapabilities
- type SessionSessionInfoUpdate
- func (v *SessionSessionInfoUpdate) ClearTitle()
- func (v *SessionSessionInfoUpdate) ClearUpdatedAt()
- func (v SessionSessionInfoUpdate) MarshalJSON() ([]byte, error)
- func (v *SessionSessionInfoUpdate) SetTitle(value string)
- func (v *SessionSessionInfoUpdate) SetUpdatedAt(value string)
- func (v SessionSessionInfoUpdate) TitleState() NullableFieldState
- func (v *SessionSessionInfoUpdate) UnmarshalJSON(b []byte) error
- func (v *SessionSessionInfoUpdate) UnsetTitle()
- func (v *SessionSessionInfoUpdate) UnsetUpdatedAt()
- func (v SessionSessionInfoUpdate) UpdatedAtState() NullableFieldState
- type SessionToolCallUpdate
- type SessionUpdate
- func StartEditToolCall(id ToolCallId, title string, path string, content any, ...) SessionUpdate
- func StartReadToolCall(id ToolCallId, title string, path string, opts ...ToolCallStartOpt) SessionUpdate
- func StartToolCall(id ToolCallId, title string, opts ...ToolCallStartOpt) SessionUpdate
- func UpdateAgentMessage(content ContentBlock) SessionUpdate
- func UpdateAgentMessageText(text string) SessionUpdate
- func UpdateAgentThought(content ContentBlock) SessionUpdate
- func UpdateAgentThoughtText(text string) SessionUpdate
- func UpdatePlan(entries ...PlanEntry) SessionUpdate
- func UpdateToolCall(id ToolCallId, opts ...ToolCallUpdateOpt) SessionUpdate
- func UpdateUserMessage(content ContentBlock) SessionUpdate
- func UpdateUserMessageText(text string) SessionUpdate
- type SessionUpdateAgentMessageChunk
- type SessionUpdateAgentThoughtChunk
- type SessionUpdateCompactionSummaryChunk
- type SessionUpdateNotice
- type SessionUpdatePlan
- type SessionUpdateToolCall
- type SessionUpdateUserMessageChunk
- type SessionUsageUpdate
- type SetSessionConfigOptionBoolean
- type SetSessionConfigOptionRequest
- type SetSessionConfigOptionResponse
- type SetSessionConfigOptionValueId
- type SetSessionModeRequest
- type SetSessionModeResponse
- type StopReason
- type StringFormat
- type StringMultiSelectItems
- type StringPropertySchema
- type Terminal
- type TerminalExitStatus
- type TerminalId
- type TerminalOutputRequest
- type TerminalOutputResponse
- type TextContent
- type TextResourceContents
- type TitledMultiSelectItems
- type ToolCall
- type ToolCallContent
- type ToolCallContentContent
- type ToolCallContentDiff
- type ToolCallContentTerminal
- type ToolCallId
- type ToolCallLocation
- type ToolCallStartOpt
- func WithStartContent(c []ToolCallContent) ToolCallStartOpt
- func WithStartKind(k ToolKind) ToolCallStartOpt
- func WithStartLocations(l []ToolCallLocation) ToolCallStartOpt
- func WithStartName(name string) ToolCallStartOpt
- func WithStartRawInput(v any) ToolCallStartOpt
- func WithStartRawOutput(v any) ToolCallStartOpt
- func WithStartStatus(s ToolCallStatus) ToolCallStartOpt
- type ToolCallStatus
- type ToolCallUpdate
- type ToolCallUpdateOpt
- func WithUpdateContent(c []ToolCallContent) ToolCallUpdateOpt
- func WithUpdateKind(k ToolKind) ToolCallUpdateOpt
- func WithUpdateLocations(l []ToolCallLocation) ToolCallUpdateOpt
- func WithUpdateName(name string) ToolCallUpdateOpt
- func WithUpdateRawInput(v any) ToolCallUpdateOpt
- func WithUpdateRawOutput(v any) ToolCallUpdateOpt
- func WithUpdateStatus(s ToolCallStatus) ToolCallUpdateOpt
- func WithUpdateTitle(t string) ToolCallUpdateOpt
- type ToolKind
- type TransportError
- type TransportFrame
- type TransportOperation
- type UnstructuredCommandInput
- type UsageUpdate
- type WaitForTerminalExitRequest
- type WaitForTerminalExitResponse
- type WriteTextFileRequest
- type WriteTextFileResponse
Constants ¶
const ( AgentMethodAuthenticate = "authenticate" AgentMethodInitialize = "initialize" AgentMethodLogout = "logout" AgentMethodSessionCancel = "session/cancel" AgentMethodSessionClose = "session/close" AgentMethodSessionDelete = "session/delete" AgentMethodSessionList = "session/list" AgentMethodSessionLoad = "session/load" AgentMethodSessionNew = "session/new" AgentMethodSessionPrompt = "session/prompt" AgentMethodSessionResume = "session/resume" AgentMethodSessionSetConfigOption = "session/set_config_option" AgentMethodSessionSetMode = "session/set_mode" )
Agent method names
const ( ClientMethodElicitationComplete = "elicitation/complete" ClientMethodElicitationCreate = "elicitation/create" ClientMethodFsReadTextFile = "fs/read_text_file" ClientMethodFsWriteTextFile = "fs/write_text_file" ClientMethodSessionRequestPermission = "session/request_permission" ClientMethodSessionUpdate = "session/update" ClientMethodTerminalCreate = "terminal/create" ClientMethodTerminalKill = "terminal/kill" ClientMethodTerminalOutput = "terminal/output" ClientMethodTerminalRelease = "terminal/release" ClientMethodTerminalWaitForExit = "terminal/wait_for_exit" )
Client method names
const ( // WireProtocolVersion is the stable ACP wire protocol major implemented by // the root package. WireProtocolVersion = 1 // SchemaArtifactVersion is the exact official JSON Schema release used to // generate the stable root package. SchemaArtifactVersion = "1.27.0" // SchemaTag and SchemaCommit identify the immutable upstream source. SchemaTag = "schema-v1.27.0" SchemaCommit = "97fcb0f5b88567dd91d585ea6885761365a6aa7b" )
const ProtocolVersionNumber = 1
ProtocolVersionNumber is the ACP protocol version supported by this SDK.
Variables ¶
var ( ErrConnectionClosed = errors.New("acp: connection closed") ErrPeerClosed = errors.New("acp: peer closed connection") ErrFrameTooLarge = errors.New("acp: frame exceeds configured limit") ErrPendingRequestsExceeded = errors.New("acp: pending request limit exceeded") ErrRequestQueueFull = errors.New("acp: inbound request queue full") ErrNotificationQueueFull = errors.New("acp: inbound notification queue full") ErrAfterResponseQueueFull = errors.New("acp: batch after-response callback limit exceeded") ErrAfterResponseRegistered = errors.New("acp: after-response callback already registered") )
var ( ErrRequestAlreadyDispatched = errors.New("acp: prepared request was already dispatched") ErrRequestNotDispatched = errors.New("acp: prepared request was not dispatched") ErrRequestAbandoned = errors.New("acp: prepared request was abandoned") ErrResponseObserverRequired = errors.New("acp: response observer is required") ErrResponseObserverRegistered = errors.New("acp: response observer is already registered") )
var ErrTransportFailure = errors.New("acp: transport failure")
ErrTransportFailure classifies failures while reading from or writing to the connection transport. Use errors.As with *TransportError to inspect the operation and underlying cause.
Functions ¶
func AfterResponse ¶ added in v1.1.0
AfterResponse registers callback to run after the successful response for the current inbound request has been written. At most one callback may be registered per request. It runs synchronously with a connection-lifetime context after the request context has been canceled. Batch callbacks run on a dedicated connection worker after the entire response array is written. At most MaxPendingRequests batch callbacks may be reserved at once; registration returns ErrAfterResponseQueueFull when that limit is reached.
func InboundParamsFromContext ¶ added in v1.1.0
func InboundParamsFromContext(ctx context.Context) (json.RawMessage, bool)
InboundParamsFromContext returns the lossless JSON-RPC params for the current inbound handler invocation. The returned bytes are a defensive copy and may be retained or modified by the caller. A nil RawMessage with a true boolean means the inbound message omitted params.
func RequestMayHaveBeenSubmitted ¶ added in v1.1.0
RequestMayHaveBeenSubmitted conservatively reports whether err can be treated as a proven pre-write failure. Unknown errors return true.
func SendRequest ¶
SendRequest sends a JSON-RPC request and decodes its typed result.
func SendRequestWithResponseHook ¶ added in v1.1.0
func SendRequestWithResponseHook[T any](c *Connection, ctx context.Context, method string, params any, hook func(context.Context, T) error) (T, error)
SendRequestWithResponseHook sends a JSON-RPC request and invokes hook after its successful response has been decoded and all earlier notifications have completed. Notifications received after the response are not dispatched until hook returns, and its error is returned to the caller. Ordered response deliveries are bounded by MaxPendingRequests. The hook must not wait for work that depends on a later notification from c.
Types ¶
type Agent ¶
type Agent interface {
// Request parameters for the initialize method.
//
// Sent by the client to establish connection and negotiate capabilities.
//
// See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/v1/initialization)
Initialize(ctx context.Context, params InitializeRequest) (InitializeResponse, error)
// Notification to cancel ongoing operations for a session.
//
// See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v1/prompt-turn#cancellation)
Cancel(ctx context.Context, params CancelNotification) error
// Request parameters for creating a new session.
//
// See protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/v1/session-setup#creating-a-session)
NewSession(ctx context.Context, params NewSessionRequest) (NewSessionResponse, error)
// Request parameters for sending a user prompt to the agent.
//
// Contains the user's message and any additional context.
//
// See protocol docs: [User Message](https://agentclientprotocol.com/protocol/v1/prompt-turn#1-user-message)
Prompt(ctx context.Context, params PromptRequest) (PromptResponse, error)
}
type AgentAuthCapabilities ¶
type AgentAuthCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Whether the agent supports the logout method.
//
// Optional. Omitted or 'null' both mean the agent does not advertise support.
// Supplying '{}' means the agent supports the logout method.
Logout *LogoutCapabilities `json:"logout,omitempty"`
}
Authentication-related capabilities supported by the agent.
type AgentAuthenticator ¶
type AgentAuthenticator interface {
// Request parameters for the authenticate method.
//
// Specifies which authentication method to use.
Authenticate(ctx context.Context, params AuthenticateRequest) (AuthenticateResponse, error)
}
AgentAuthenticator defines optional authentication support. Implement it only when Initialize advertises authentication methods.
type AgentCapabilities ¶
type AgentCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Authentication-related capabilities supported by the agent.
//
// Defaults to {} if unset.
Auth AgentAuthCapabilities `json:"auth,omitempty"`
// Whether the agent supports 'session/load'.
//
// Defaults to false if unset.
LoadSession bool `json:"loadSession,omitempty"`
// MCP capabilities supported by the agent.
//
// Defaults to {"http":false,"sse":false} if unset.
McpCapabilities McpCapabilities `json:"mcpCapabilities,omitempty"`
// Prompt capabilities supported by the agent.
//
// Defaults to {"audio":false,"embeddedContext":false,"image":false} if unset.
PromptCapabilities PromptCapabilities `json:"promptCapabilities,omitempty"`
// Session lifecycle and prompt capabilities advertised by the agent.
//
// Defaults to {} if unset.
SessionCapabilities SessionCapabilities `json:"sessionCapabilities,omitempty"`
}
Capabilities supported by the agent.
Advertised during initialization to inform the client about available features and content types.
See protocol docs: [Agent Capabilities](https://agentclientprotocol.com/protocol/v1/initialization#agent-capabilities)
func (AgentCapabilities) MarshalJSON ¶
func (v AgentCapabilities) MarshalJSON() ([]byte, error)
func (*AgentCapabilities) UnmarshalJSON ¶
func (v *AgentCapabilities) UnmarshalJSON(b []byte) error
type AgentError ¶
type AgentError struct {
// Method-specific error data.
Error Error `json:"error"`
// The id of the request this response answers.
Id RequestId `json:"id"`
}
A failed JSON-RPC response.
type AgentLoader ¶
type AgentLoader interface {
// Request parameters for loading an existing session.
//
// Only available if the Agent supports the 'loadSession' capability.
//
// See protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/v1/session-setup#loading-sessions)
LoadSession(ctx context.Context, params LoadSessionRequest) (LoadSessionResponse, error)
}
AgentLoader defines optional support for loading sessions. Implement and advertise the capability to enable 'session/load'.
type AgentLogout ¶
type AgentLogout interface {
// Request parameters for the logout method.
//
// Terminates the current authenticated session.
Logout(ctx context.Context, params LogoutRequest) (LogoutResponse, error)
}
AgentLogout defines optional logout support. Implement and advertise auth.logout to enable it.
type AgentNotification ¶
type AgentNotification struct {
// The notification method name.
Method string `json:"method"`
// Method-specific notification parameters.
Params any `json:"params,omitempty"`
}
A JSON-RPC notification object.
func (*AgentNotification) UnmarshalJSON ¶
func (v *AgentNotification) UnmarshalJSON(b []byte) error
func (*AgentNotification) Validate ¶
func (v *AgentNotification) Validate() error
type AgentRequest ¶
type AgentRequest struct {
// The request id used to correlate the matching response.
Id RequestId `json:"id"`
// The method name to invoke.
Method string `json:"method"`
// Method-specific request parameters.
Params any `json:"params,omitempty"`
}
A JSON-RPC request object.
func (*AgentRequest) UnmarshalJSON ¶
func (v *AgentRequest) UnmarshalJSON(b []byte) error
func (*AgentRequest) Validate ¶
func (v *AgentRequest) Validate() error
type AgentResponse ¶
type AgentResponse struct {
// A successful JSON-RPC response.
Result *AgentResult `json:"-"`
// A failed JSON-RPC response.
Error *AgentError `json:"-"`
}
func (AgentResponse) MarshalJSON ¶
func (u AgentResponse) MarshalJSON() ([]byte, error)
func (*AgentResponse) UnmarshalJSON ¶
func (u *AgentResponse) UnmarshalJSON(b []byte) error
func (*AgentResponse) Validate ¶
func (u *AgentResponse) Validate() error
type AgentResult ¶
type AgentResult struct {
// The id of the request this response answers.
Id RequestId `json:"id"`
// Method-specific response data.
Result any `json:"result"`
}
A JSON-RPC response object. A successful JSON-RPC response.
type AgentSessionCloser ¶
type AgentSessionCloser interface {
// Request parameters for closing an active session.
//
// If supported, the agent **must** cancel any ongoing work related to the session
// (treat it as if 'session/cancel' was called) and then free up any resources
// associated with the session.
//
// Only available if the Agent supports the 'sessionCapabilities.close' capability.
CloseSession(ctx context.Context, params CloseSessionRequest) (CloseSessionResponse, error)
}
AgentSessionCloser defines optional session close support.
type AgentSessionConfig ¶
type AgentSessionConfig interface {
// Request parameters for setting a session configuration option.
SetSessionConfigOption(ctx context.Context, params SetSessionConfigOptionRequest) (SetSessionConfigOptionResponse, error)
}
AgentSessionConfig defines optional session configuration support.
type AgentSessionDeleter ¶
type AgentSessionDeleter interface {
// Request parameters for deleting an existing session from 'session/list'.
//
// Only available if the Agent supports the 'sessionCapabilities.delete' capability.
DeleteSession(ctx context.Context, params DeleteSessionRequest) (DeleteSessionResponse, error)
}
AgentSessionDeleter defines optional session delete support.
type AgentSessionLister ¶
type AgentSessionLister interface {
// Request parameters for listing existing sessions.
//
// Only available if the Agent supports the 'sessionCapabilities.list' capability.
ListSessions(ctx context.Context, params ListSessionsRequest) (ListSessionsResponse, error)
}
AgentSessionLister defines optional session list support.
type AgentSessionMode ¶
type AgentSessionMode interface {
// Request parameters for setting a session mode.
SetSessionMode(ctx context.Context, params SetSessionModeRequest) (SetSessionModeResponse, error)
}
AgentSessionMode defines optional session mode support.
type AgentSessionResumer ¶
type AgentSessionResumer interface {
// Request parameters for resuming an existing session.
//
// Resumes an existing session without returning previous messages (unlike 'session/load').
// This is useful for agents that can resume sessions but don't implement full session loading.
//
// Only available if the Agent supports the 'sessionCapabilities.resume' capability.
ResumeSession(ctx context.Context, params ResumeSessionRequest) (ResumeSessionResponse, error)
}
AgentSessionResumer defines optional session resume support.
type AgentSideConnection ¶
type AgentSideConnection struct {
// contains filtered or unexported fields
}
AgentSideConnection represents the agent's view of a connection to a client.
func AgentSideConnectionFromContext ¶ added in v1.1.0
func AgentSideConnectionFromContext(ctx context.Context) (*AgentSideConnection, bool)
AgentSideConnectionFromContext returns the current agent-side connection while an Agent or agent-side extension handler is running.
func NewAgentSideConnection ¶
func NewAgentSideConnection(agent Agent, peerInput io.Writer, peerOutput io.Reader) *AgentSideConnection
NewAgentSideConnection creates a new agent-side connection bound to the provided Agent implementation.
func NewAgentSideConnectionWithOptions ¶
func NewAgentSideConnectionWithOptions(agent Agent, peerInput io.Writer, peerOutput io.Reader, opts ConnectionOptions) (*AgentSideConnection, error)
NewAgentSideConnectionWithOptions creates a bounded agent-side connection. Agent callbacks cannot begin until the returned peer object is fully initialized and safe for reverse calls. Stream ownership transfers only on successful construction.
func (*AgentSideConnection) CallExtension ¶
func (c *AgentSideConnection) CallExtension(ctx context.Context, method string, params any) (json.RawMessage, error)
CallExtension sends an ACP extension-method request (method names starting with "_") from an agent to its client.
func (*AgentSideConnection) Close ¶
func (c *AgentSideConnection) Close() error
Close idempotently closes the connection.
func (*AgentSideConnection) CompleteElicitation ¶
func (c *AgentSideConnection) CompleteElicitation(ctx context.Context, params CompleteElicitationNotification) error
func (*AgentSideConnection) CreateElicitation ¶
func (c *AgentSideConnection) CreateElicitation(ctx context.Context, params CreateElicitationRequest) (CreateElicitationResponse, error)
func (*AgentSideConnection) CreateTerminal ¶
func (c *AgentSideConnection) CreateTerminal(ctx context.Context, params CreateTerminalRequest) (CreateTerminalResponse, error)
func (*AgentSideConnection) Done ¶
func (c *AgentSideConnection) Done() <-chan struct{}
Done exposes a channel that closes when the peer disconnects.
func (*AgentSideConnection) Err ¶
func (c *AgentSideConnection) Err() error
Err reports the connection shutdown cause.
func (*AgentSideConnection) KillTerminal ¶
func (c *AgentSideConnection) KillTerminal(ctx context.Context, params KillTerminalRequest) (KillTerminalResponse, error)
func (*AgentSideConnection) NotifyExtension ¶
NotifyExtension sends an ACP extension-method notification (method names starting with "_") from an agent to its client.
func (*AgentSideConnection) ReadTextFile ¶
func (c *AgentSideConnection) ReadTextFile(ctx context.Context, params ReadTextFileRequest) (ReadTextFileResponse, error)
func (*AgentSideConnection) ReleaseTerminal ¶
func (c *AgentSideConnection) ReleaseTerminal(ctx context.Context, params ReleaseTerminalRequest) (ReleaseTerminalResponse, error)
func (*AgentSideConnection) RequestPermission ¶
func (c *AgentSideConnection) RequestPermission(ctx context.Context, params RequestPermissionRequest) (RequestPermissionResponse, error)
func (*AgentSideConnection) SessionUpdate ¶
func (c *AgentSideConnection) SessionUpdate(ctx context.Context, params SessionNotification) error
func (*AgentSideConnection) SessionUpdateRaw ¶ added in v1.1.0
func (c *AgentSideConnection) SessionUpdateRaw(ctx context.Context, params json.RawMessage) error
SessionUpdateRaw sends a session/update notification without decoding the update union. It is intended for transparent forwarding and compatibility across schema revisions. The caller remains responsible for the ACP semantics of the opaque update payload.
The outer SessionNotification envelope is still checked, and the method is always fixed to session/update. The original params are sent through the connection's normal bounded write and notification-ordering path.
func (*AgentSideConnection) SetLogger ¶
func (c *AgentSideConnection) SetLogger(l *slog.Logger)
SetLogger directs connection diagnostics to the provided logger.
func (*AgentSideConnection) TerminalOutput ¶
func (c *AgentSideConnection) TerminalOutput(ctx context.Context, params TerminalOutputRequest) (TerminalOutputResponse, error)
func (*AgentSideConnection) Wait ¶
func (c *AgentSideConnection) Wait(ctx context.Context) error
Wait waits for all connection-owned goroutines to terminate.
func (*AgentSideConnection) WaitForTerminalExit ¶
func (c *AgentSideConnection) WaitForTerminalExit(ctx context.Context, params WaitForTerminalExitRequest) (WaitForTerminalExitResponse, error)
func (*AgentSideConnection) WriteTextFile ¶
func (c *AgentSideConnection) WriteTextFile(ctx context.Context, params WriteTextFileRequest) (WriteTextFileResponse, error)
type Annotations ¶
type Annotations struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Intended recipients for this content, such as the user or assistant.
Audience []Role `json:"audience,omitempty"`
// Timestamp indicating when the underlying resource was last modified.
LastModified *string `json:"lastModified,omitempty"`
// Relative importance of this content when clients choose what to surface.
Priority *float64 `json:"priority,omitempty"`
}
Optional annotations for the client. The client can use annotations to inform how objects are used or displayed
type AudioContent ¶
type AudioContent struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional annotations that help clients decide how to display or route this content.
Annotations *Annotations `json:"annotations,omitempty"`
// Base64-encoded media payload.
Data string `json:"data"`
// MIME type describing the encoded media payload.
MimeType string `json:"mimeType"`
}
Audio provided to or from an LLM.
func (*AudioContent) UnmarshalJSON ¶
func (v *AudioContent) UnmarshalJSON(b []byte) error
type AuthCapabilities ¶
type AuthCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Whether the client supports 'terminal' authentication methods.
//
// The client should set this to 'true' only when it can reproduce the
// configured agent invocation in an interactive terminal. When 'true', the
// agent may include 'terminal' entries in its authentication methods.
//
// Defaults to false if unset.
Terminal bool `json:"terminal,omitempty"`
}
Authentication capabilities supported by the client.
Advertised during initialization to inform the agent which authentication method types the client can handle. This governs opt-in types that require additional client-side support.
func (AuthCapabilities) MarshalJSON ¶
func (v AuthCapabilities) MarshalJSON() ([]byte, error)
func (*AuthCapabilities) UnmarshalJSON ¶
func (v *AuthCapabilities) UnmarshalJSON(b []byte) error
type AuthMethod ¶
type AuthMethod struct {
// Client runs the configured agent program as a separate interactive
// process, without passing this method to 'authenticate'.
Terminal *AuthMethodTerminalInline `json:"-"`
// Agent handles authentication itself through 'authenticate'.
//
// This is the default when no 'type' is specified.
Agent *AuthMethodAgent `json:"-"`
}
func (AuthMethod) MarshalJSON ¶
func (u AuthMethod) MarshalJSON() ([]byte, error)
func (*AuthMethod) UnmarshalJSON ¶
func (u *AuthMethod) UnmarshalJSON(b []byte) error
func (*AuthMethod) Validate ¶
func (u *AuthMethod) Validate() error
type AuthMethodAgent ¶
type AuthMethodAgent struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional description providing more details about this authentication method.
Description *string `json:"description,omitempty"`
// Unique identifier for this authentication method.
Id AuthMethodId `json:"id"`
// Human-readable name of the authentication method.
Name string `json:"name"`
}
Agent handles authentication itself through 'authenticate'.
This is the default authentication method type.
func (*AuthMethodAgent) UnmarshalJSON ¶
func (v *AuthMethodAgent) UnmarshalJSON(b []byte) error
type AuthMethodId ¶
type AuthMethodId string
Typed identifier used for auth method values on the wire.
type AuthMethodTerminal ¶
type AuthMethodTerminal struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Additional arguments to append to the configured agent invocation for terminal auth.
Args []string `json:"args,omitempty"`
// Optional description providing more details about this authentication method.
Description *string `json:"description,omitempty"`
// Additional environment variables to set on the configured agent invocation for terminal auth.
// These values override same-named variables in the base launch configuration.
Env map[string]any `json:"env,omitempty"`
// Unique identifier for this authentication method.
Id AuthMethodId `json:"id"`
// Human-readable name of the authentication method.
Name string `json:"name"`
}
Terminal-based authentication method.
The client runs the configured agent program as a separate interactive process for the user to authenticate via a TUI. Agents MUST advertise this method only when the client enabled its terminal authentication capability. A zero exit status signals success; any other termination signals failure. The client MUST NOT pass this method to 'authenticate'.
func (*AuthMethodTerminal) UnmarshalJSON ¶
func (v *AuthMethodTerminal) UnmarshalJSON(b []byte) error
type AuthMethodTerminalInline ¶
type AuthMethodTerminalInline struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Additional arguments to append to the configured agent invocation for terminal auth.
Args []string `json:"args,omitempty"`
// Optional description providing more details about this authentication method.
Description *string `json:"description,omitempty"`
// Additional environment variables to set on the configured agent invocation for terminal auth.
// These values override same-named variables in the base launch configuration.
Env map[string]any `json:"env,omitempty"`
// Unique identifier for this authentication method.
Id AuthMethodId `json:"id"`
// Human-readable name of the authentication method.
Name string `json:"name"`
Type string `json:"type"`
}
Describes an available authentication method.
The 'type' field acts as the discriminator in the serialized JSON form. When no 'type' is present, the method is treated as 'agent'. Client runs the configured agent program as a separate interactive process, without passing this method to 'authenticate'.
func (*AuthMethodTerminalInline) UnmarshalJSON ¶ added in v1.5.0
func (v *AuthMethodTerminalInline) UnmarshalJSON(b []byte) error
type AuthenticateRequest ¶
type AuthenticateRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The ID of the authentication method to use.
// Must be one of the methods advertised in the initialize response.
MethodId AuthMethodId `json:"methodId"`
}
Request parameters for the authenticate method.
Specifies which authentication method to use.
func (*AuthenticateRequest) UnmarshalJSON ¶
func (v *AuthenticateRequest) UnmarshalJSON(b []byte) error
func (*AuthenticateRequest) Validate ¶
func (v *AuthenticateRequest) Validate() error
type AuthenticateResponse ¶
type AuthenticateResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Response to the 'authenticate' method.
func (*AuthenticateResponse) Validate ¶
func (v *AuthenticateResponse) Validate() error
type AvailableCommand ¶
type AvailableCommand struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Human-readable description of what the command does.
Description string `json:"description"`
// Input for the command if required
Input *AvailableCommandInput `json:"input,omitempty"`
// Command name (e.g., 'create_plan', 'research_codebase').
Name string `json:"name"`
}
Information about a command.
func (*AvailableCommand) UnmarshalJSON ¶
func (v *AvailableCommand) UnmarshalJSON(b []byte) error
type AvailableCommandInput ¶
type AvailableCommandInput struct {
// All text that was typed after the command name is provided as input.
Unstructured *UnstructuredCommandInput `json:"-"`
}
The input specification for a command.
func (AvailableCommandInput) MarshalJSON ¶
func (u AvailableCommandInput) MarshalJSON() ([]byte, error)
func (*AvailableCommandInput) UnmarshalJSON ¶
func (u *AvailableCommandInput) UnmarshalJSON(b []byte) error
func (*AvailableCommandInput) Validate ¶
func (u *AvailableCommandInput) Validate() error
type AvailableCommandsUpdate ¶
type AvailableCommandsUpdate struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Commands the agent can execute
AvailableCommands []AvailableCommand `json:"availableCommands"`
}
Available commands are ready or have changed
func (*AvailableCommandsUpdate) UnmarshalJSON ¶
func (v *AvailableCommandsUpdate) UnmarshalJSON(b []byte) error
type BlobResourceContents ¶
type BlobResourceContents struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Base64-encoded bytes for a binary resource payload.
Blob string `json:"blob"`
// MIME type describing the encoded media payload.
MimeType *string `json:"mimeType,omitempty"`
// URI associated with this resource or media payload.
Uri string `json:"uri"`
}
Binary resource contents.
func (*BlobResourceContents) UnmarshalJSON ¶
func (v *BlobResourceContents) UnmarshalJSON(b []byte) error
type BooleanConfigOptionCapabilities ¶
type BooleanConfigOptionCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Capabilities for boolean session configuration options.
Supplying '{}' means the client supports boolean session configuration options.
type BooleanPropertySchema ¶
type BooleanPropertySchema struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Default value.
//
// Optional. Omitted and 'null' are equivalent and mean no default value is provided.
Default *bool `json:"default,omitempty"`
// Human-readable description.
//
// Optional. Omitted and 'null' are equivalent and mean no description is provided.
Description *string `json:"description,omitempty"`
// Optional title for the property.
//
// Optional. Omitted and 'null' are equivalent and mean no title is provided.
Title *string `json:"title,omitempty"`
}
Schema for boolean properties in an elicitation form.
type CancelNotification ¶
type CancelNotification struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The ID of the session to cancel operations for.
SessionId SessionId `json:"sessionId"`
}
Notification to cancel ongoing operations for a session.
See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v1/prompt-turn#cancellation)
func (*CancelNotification) UnmarshalJSON ¶
func (v *CancelNotification) UnmarshalJSON(b []byte) error
func (*CancelNotification) Validate ¶
func (v *CancelNotification) Validate() error
type CancelRequestNotification ¶
type CancelRequestNotification struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The ID of the request to cancel.
RequestId RequestId `json:"requestId"`
}
Notification to cancel an ongoing request.
See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v1/cancellation)
func (*CancelRequestNotification) UnmarshalJSON ¶
func (v *CancelRequestNotification) UnmarshalJSON(b []byte) error
func (*CancelRequestNotification) Validate ¶
func (v *CancelRequestNotification) Validate() error
type Client ¶
type Client interface {
// Request for user permission to execute a tool call.
//
// Sent when the agent needs authorization before performing a sensitive operation.
//
// See protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/v1/tool-calls#requesting-permission)
RequestPermission(ctx context.Context, params RequestPermissionRequest) (RequestPermissionResponse, error)
// Notification containing a session update from the agent.
//
// Used to stream real-time progress and results during prompt processing.
//
// See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/v1/prompt-turn#3-agent-reports-output)
SessionUpdate(ctx context.Context, params SessionNotification) error
}
type ClientCapabilities ¶
type ClientCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Authentication capabilities supported by the client.
// Determines which authentication method types the agent may include
// in its 'InitializeResponse'.
//
// Defaults to {"terminal":false} if unset.
Auth AuthCapabilities `json:"auth,omitempty"`
// Elicitation capabilities supported by the client.
// Determines which elicitation modes the agent may use.
//
// Optional. Omitted or 'null' both mean the client does not advertise
// elicitation support.
Elicitation *ElicitationCapabilities `json:"elicitation,omitempty"`
// File system capabilities supported by the client.
// Determines which file operations the agent can request.
//
// Defaults to {"readTextFile":false,"writeTextFile":false} if unset.
Fs FileSystemCapabilities `json:"fs,omitempty"`
// Session-related capabilities supported by the client.
//
// Optional. Omitted or 'null' both mean the client does not advertise any
// session-related extensions.
Session *ClientSessionCapabilities `json:"session,omitempty"`
// Whether the Client support all 'terminal/*' methods.
//
// Defaults to false if unset.
Terminal bool `json:"terminal,omitempty"`
}
Capabilities supported by the client.
Advertised during initialization to inform the agent about available features and methods.
See protocol docs: [Client Capabilities](https://agentclientprotocol.com/protocol/v1/initialization#client-capabilities)
func (ClientCapabilities) MarshalJSON ¶
func (v ClientCapabilities) MarshalJSON() ([]byte, error)
func (*ClientCapabilities) UnmarshalJSON ¶
func (v *ClientCapabilities) UnmarshalJSON(b []byte) error
type ClientElicitation ¶
type ClientElicitation interface {
// Request from the agent to elicit structured user input.
//
// The agent sends this to the client to request information from the user,
// either via a form or by directing them to a URL.
// Elicitations are tied to a session (optionally a tool call) or a request.
CreateElicitation(ctx context.Context, params CreateElicitationRequest) (CreateElicitationResponse, error)
}
ClientElicitation defines optional structured elicitation support.
type ClientElicitationCompletion ¶
type ClientElicitationCompletion interface {
// Notification sent by the agent when a URL-based elicitation is complete.
CompleteElicitation(ctx context.Context, params CompleteElicitationNotification) error
}
ClientElicitationCompletion defines optional URL elicitation completion notifications.
type ClientError ¶
type ClientError struct {
// Method-specific error data.
Error Error `json:"error"`
// The id of the request this response answers.
Id RequestId `json:"id"`
}
A failed JSON-RPC response.
type ClientFileReader ¶
type ClientFileReader interface {
// Request to read content from a text file.
//
// Only available if the client supports the 'fs.readTextFile' capability.
ReadTextFile(ctx context.Context, params ReadTextFileRequest) (ReadTextFileResponse, error)
}
ClientFileReader defines optional text-file read support.
type ClientFileWriter ¶
type ClientFileWriter interface {
// Request to write content to a text file.
//
// Only available if the client supports the 'fs.writeTextFile' capability.
WriteTextFile(ctx context.Context, params WriteTextFileRequest) (WriteTextFileResponse, error)
}
ClientFileWriter defines optional text-file write support.
type ClientNotification ¶
type ClientNotification struct {
// The notification method name.
Method string `json:"method"`
// Method-specific notification parameters.
Params any `json:"params,omitempty"`
}
A JSON-RPC notification object.
func (*ClientNotification) UnmarshalJSON ¶
func (v *ClientNotification) UnmarshalJSON(b []byte) error
func (*ClientNotification) Validate ¶
func (v *ClientNotification) Validate() error
type ClientRequest ¶
type ClientRequest struct {
// The request id used to correlate the matching response.
Id RequestId `json:"id"`
// The method name to invoke.
Method string `json:"method"`
// Method-specific request parameters.
Params any `json:"params,omitempty"`
}
A JSON-RPC request object.
func (*ClientRequest) UnmarshalJSON ¶
func (v *ClientRequest) UnmarshalJSON(b []byte) error
func (*ClientRequest) Validate ¶
func (v *ClientRequest) Validate() error
type ClientResponse ¶
type ClientResponse struct {
// A successful JSON-RPC response.
Result *ClientResult `json:"-"`
// A failed JSON-RPC response.
Error *ClientError `json:"-"`
}
func (ClientResponse) MarshalJSON ¶
func (u ClientResponse) MarshalJSON() ([]byte, error)
func (*ClientResponse) UnmarshalJSON ¶
func (u *ClientResponse) UnmarshalJSON(b []byte) error
func (*ClientResponse) Validate ¶
func (u *ClientResponse) Validate() error
type ClientResult ¶
type ClientResult struct {
// The id of the request this response answers.
Id RequestId `json:"id"`
// Method-specific response data.
Result any `json:"result"`
}
A JSON-RPC response object. A successful JSON-RPC response.
type ClientSessionCapabilities ¶
type ClientSessionCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Support for ID-addressed context compaction updates. Omitted or 'null'
// means unsupported; '{}' advertises the complete compaction contract.
Compaction *CompactionCapabilities `json:"compaction,omitempty"`
// Config option capabilities supported by the client.
//
// Omitted or 'null' both mean the client does not advertise support for any
// config option extensions.
ConfigOptions *SessionConfigOptionsCapabilities `json:"configOptions,omitempty"`
// Support for live user-facing 'notice' session updates.
//
// Optional. Omitted or 'null' both mean the client does not advertise support.
// Supplying '{}' means the client can present notices to the user.
Notices *NoticeCapabilities `json:"notices,omitempty"`
}
Session-related capabilities supported by the client.
func (*ClientSessionCapabilities) UnmarshalJSON ¶ added in v1.5.0
func (v *ClientSessionCapabilities) UnmarshalJSON(b []byte) error
type ClientSideConnection ¶
type ClientSideConnection struct {
// contains filtered or unexported fields
}
ClientSideConnection provides the client's view of the connection and implements Agent calls.
func ClientSideConnectionFromContext ¶ added in v1.1.0
func ClientSideConnectionFromContext(ctx context.Context) (*ClientSideConnection, bool)
ClientSideConnectionFromContext returns the current client-side connection while a Client or client-side extension handler is running.
func NewClientSideConnection ¶
func NewClientSideConnection(client Client, peerInput io.Writer, peerOutput io.Reader) *ClientSideConnection
NewClientSideConnection creates a new client-side connection bound to the provided Client implementation.
func NewClientSideConnectionWithOptions ¶
func NewClientSideConnectionWithOptions(client Client, peerInput io.Writer, peerOutput io.Reader, opts ConnectionOptions) (*ClientSideConnection, error)
NewClientSideConnectionWithOptions creates a bounded client-side connection. Client callbacks cannot begin until the returned peer object is fully initialized and safe for reverse calls. Stream ownership transfers only on successful construction.
func (*ClientSideConnection) Authenticate ¶
func (c *ClientSideConnection) Authenticate(ctx context.Context, params AuthenticateRequest) (AuthenticateResponse, error)
func (*ClientSideConnection) CallExtension ¶
func (c *ClientSideConnection) CallExtension(ctx context.Context, method string, params any) (json.RawMessage, error)
CallExtension sends an ACP extension-method request (method names starting with "_") from a client to its agent.
func (*ClientSideConnection) Cancel ¶
func (c *ClientSideConnection) Cancel(ctx context.Context, params CancelNotification) error
func (*ClientSideConnection) Close ¶
func (c *ClientSideConnection) Close() error
Close idempotently closes the connection.
func (*ClientSideConnection) CloseSession ¶
func (c *ClientSideConnection) CloseSession(ctx context.Context, params CloseSessionRequest) (CloseSessionResponse, error)
func (*ClientSideConnection) DeleteSession ¶
func (c *ClientSideConnection) DeleteSession(ctx context.Context, params DeleteSessionRequest) (DeleteSessionResponse, error)
func (*ClientSideConnection) Done ¶
func (c *ClientSideConnection) Done() <-chan struct{}
Done exposes a channel that closes when the peer disconnects.
func (*ClientSideConnection) Err ¶
func (c *ClientSideConnection) Err() error
Err reports the connection shutdown cause.
func (*ClientSideConnection) Initialize ¶
func (c *ClientSideConnection) Initialize(ctx context.Context, params InitializeRequest) (InitializeResponse, error)
func (*ClientSideConnection) ListSessions ¶
func (c *ClientSideConnection) ListSessions(ctx context.Context, params ListSessionsRequest) (ListSessionsResponse, error)
func (*ClientSideConnection) LoadSession ¶
func (c *ClientSideConnection) LoadSession(ctx context.Context, params LoadSessionRequest) (LoadSessionResponse, error)
func (*ClientSideConnection) Logout ¶
func (c *ClientSideConnection) Logout(ctx context.Context, params LogoutRequest) (LogoutResponse, error)
func (*ClientSideConnection) NewSession ¶
func (c *ClientSideConnection) NewSession(ctx context.Context, params NewSessionRequest) (NewSessionResponse, error)
func (*ClientSideConnection) NewSessionWithResponseHook ¶ added in v1.1.0
func (c *ClientSideConnection) NewSessionWithResponseHook( ctx context.Context, params NewSessionRequest, hook func(context.Context, NewSessionResponse) error, ) (NewSessionResponse, error)
NewSessionWithResponseHook creates a session and invokes hook after the response is decoded but before any later session/update notification is dispatched. Use the hook to install session-scoped routing derived from the returned session ID.
func (*ClientSideConnection) NotifyExtension ¶
func (c *ClientSideConnection) NotifyExtension(ctx context.Context, method string, params any) error
NotifyExtension sends an ACP extension-method notification (method names starting with "_") from a client to its agent.
func (*ClientSideConnection) Prompt ¶
func (c *ClientSideConnection) Prompt(ctx context.Context, params PromptRequest) (PromptResponse, error)
func (*ClientSideConnection) ResumeSession ¶
func (c *ClientSideConnection) ResumeSession(ctx context.Context, params ResumeSessionRequest) (ResumeSessionResponse, error)
func (*ClientSideConnection) SetLogger ¶
func (c *ClientSideConnection) SetLogger(l *slog.Logger)
SetLogger directs connection diagnostics to the provided logger.
func (*ClientSideConnection) SetSessionConfigOption ¶
func (c *ClientSideConnection) SetSessionConfigOption(ctx context.Context, params SetSessionConfigOptionRequest) (SetSessionConfigOptionResponse, error)
func (*ClientSideConnection) SetSessionMode ¶
func (c *ClientSideConnection) SetSessionMode(ctx context.Context, params SetSessionModeRequest) (SetSessionModeResponse, error)
type ClientTerminal ¶
type ClientTerminal interface {
// Request to create a new terminal and execute a command.
CreateTerminal(ctx context.Context, params CreateTerminalRequest) (CreateTerminalResponse, error)
// Request to kill a terminal without releasing it.
KillTerminal(ctx context.Context, params KillTerminalRequest) (KillTerminalResponse, error)
// Request to get the current output and status of a terminal.
TerminalOutput(ctx context.Context, params TerminalOutputRequest) (TerminalOutputResponse, error)
// Request to release a terminal and free its resources.
ReleaseTerminal(ctx context.Context, params ReleaseTerminalRequest) (ReleaseTerminalResponse, error)
// Request to wait for a terminal command to exit.
WaitForTerminalExit(ctx context.Context, params WaitForTerminalExitRequest) (WaitForTerminalExitResponse, error)
}
ClientTerminal defines optional terminal support. Implement and advertise terminal to enable terminal methods.
type CloseSessionRequest ¶
type CloseSessionRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The ID of the session to close.
SessionId SessionId `json:"sessionId"`
}
Request parameters for closing an active session.
If supported, the agent **must** cancel any ongoing work related to the session (treat it as if 'session/cancel' was called) and then free up any resources associated with the session.
Only available if the Agent supports the 'sessionCapabilities.close' capability.
func (*CloseSessionRequest) UnmarshalJSON ¶
func (v *CloseSessionRequest) UnmarshalJSON(b []byte) error
func (*CloseSessionRequest) Validate ¶
func (v *CloseSessionRequest) Validate() error
type CloseSessionResponse ¶
type CloseSessionResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Response from closing a session.
func (*CloseSessionResponse) Validate ¶
func (v *CloseSessionResponse) Validate() error
type CompactionCapabilities ¶ added in v1.5.0
type CompactionCapabilities struct{}
Client support for ID-addressed context compaction updates.
type CompactionId ¶ added in v1.5.0
type CompactionId string
Unique identifier for a context compaction within a session.
type CompactionStatus ¶ added in v1.5.0
type CompactionStatus string
Lifecycle state of a context compaction.
const ( CompactionStatusInProgress CompactionStatus = "in_progress" CompactionStatusCompleted CompactionStatus = "completed" CompactionStatusFailed CompactionStatus = "failed" CompactionStatusCancelled CompactionStatus = "cancelled" )
type CompactionSummaryChunk ¶ added in v1.5.0
type CompactionSummaryChunk struct {
// Metadata scoped to this chunk. Omission and 'null' both mean absent.
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// ID of the compaction whose summary receives this content.
CompactionId CompactionId `json:"compactionId"`
// One content block to append.
Content ContentBlock `json:"content"`
}
A content block appended to a compaction's summary. A first-seen ID creates an in-progress compaction. Chunks append in receive order. Agents MUST only send this update when the Client advertised the 'session.compaction' Client capability.
func (*CompactionSummaryChunk) UnmarshalJSON ¶ added in v1.5.0
func (v *CompactionSummaryChunk) UnmarshalJSON(b []byte) error
type CompactionUpdate ¶ added in v1.5.0
type CompactionUpdate struct {
// Extensible metadata patch for this compaction.
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The Agent-owned ID of this compaction, unique within the session.
CompactionId CompactionId `json:"compactionId"`
// Human-readable error details for the compaction.
Error *string `json:"error,omitempty"`
// Current lifecycle status.
Status CompactionStatus `json:"status"`
// Complete replacement user-displayable summary content for the compaction.
Summary []ContentBlock `json:"summary,omitempty"`
// contains filtered or unexported fields
}
A context compaction upsert. The first notification fixes the compaction's timeline position. Later updates with the same ID patch that entity in place. Agents MUST only send this update when the Client advertised the 'session.compaction' Client capability.
'summary', 'error', and '_meta' have patch semantics: omission leaves the stored value unchanged, 'null' clears it, and a concrete value replaces it. 'summary: []' also clears the summary.
func (*CompactionUpdate) ClearError ¶ added in v1.5.0
func (v *CompactionUpdate) ClearError()
func (*CompactionUpdate) ClearMeta ¶ added in v1.5.0
func (v *CompactionUpdate) ClearMeta()
func (*CompactionUpdate) ClearSummary ¶ added in v1.5.0
func (v *CompactionUpdate) ClearSummary()
func (CompactionUpdate) ErrorState ¶ added in v1.5.0
func (v CompactionUpdate) ErrorState() NullableFieldState
func (CompactionUpdate) MarshalJSON ¶ added in v1.5.0
func (v CompactionUpdate) MarshalJSON() ([]byte, error)
func (CompactionUpdate) MetaState ¶ added in v1.5.0
func (v CompactionUpdate) MetaState() NullableFieldState
func (*CompactionUpdate) SetError ¶ added in v1.5.0
func (v *CompactionUpdate) SetError(value string)
func (*CompactionUpdate) SetMeta ¶ added in v1.5.0
func (v *CompactionUpdate) SetMeta(value map[string]json.RawMessage)
func (*CompactionUpdate) SetSummary ¶ added in v1.5.0
func (v *CompactionUpdate) SetSummary(value []ContentBlock)
func (CompactionUpdate) SummaryState ¶ added in v1.5.0
func (v CompactionUpdate) SummaryState() NullableFieldState
func (*CompactionUpdate) UnmarshalJSON ¶ added in v1.5.0
func (v *CompactionUpdate) UnmarshalJSON(b []byte) error
func (*CompactionUpdate) UnsetError ¶ added in v1.5.0
func (v *CompactionUpdate) UnsetError()
func (*CompactionUpdate) UnsetMeta ¶ added in v1.5.0
func (v *CompactionUpdate) UnsetMeta()
func (*CompactionUpdate) UnsetSummary ¶ added in v1.5.0
func (v *CompactionUpdate) UnsetSummary()
type CompleteElicitationNotification ¶
type CompleteElicitationNotification struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The ID of the elicitation that completed.
ElicitationId ElicitationId `json:"elicitationId"`
}
Notification sent by the agent when a URL-based elicitation is complete.
func (*CompleteElicitationNotification) UnmarshalJSON ¶
func (v *CompleteElicitationNotification) UnmarshalJSON(b []byte) error
func (*CompleteElicitationNotification) Validate ¶
func (v *CompleteElicitationNotification) Validate() error
type ConfigOptionUpdate ¶
type ConfigOptionUpdate struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The full set of configuration options and their current values.
ConfigOptions []SessionConfigOption `json:"configOptions"`
}
Session configuration options have been updated.
func (*ConfigOptionUpdate) UnmarshalJSON ¶
func (v *ConfigOptionUpdate) UnmarshalJSON(b []byte) error
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection is a bounded, bidirectional JSON-RPC 2.0 connection over newline-delimited JSON.
func NewConnection ¶
func NewConnection(handler MethodHandler, peerInput io.Writer, peerOutput io.Reader) *Connection
NewConnection creates a connection with bounded production defaults.
func NewConnectionWithOptions ¶
func NewConnectionWithOptions(handler MethodHandler, peerInput io.Writer, peerOutput io.Reader, opts ConnectionOptions) (*Connection, error)
NewConnectionWithOptions creates a connection with explicit resource limits. After successful construction, the connection owns peerInput and peerOutput and closes them when the connection shuts down if they implement io.Closer. A failed construction does not take ownership of either stream.
func NewUnstartedConnection ¶ added in v1.2.0
func NewUnstartedConnection(handler MethodHandler, peerInput io.Writer, peerOutput io.Reader, opts ConnectionOptions) (*Connection, error)
NewUnstartedConnection constructs a bounded connection without starting I/O workers. Call Start after reverse-call receivers are assigned. Experimental versioned surfaces use this to avoid a first-frame race.
func (*Connection) Close ¶
func (c *Connection) Close() error
Close idempotently terminates the connection and closes owned streams.
func (*Connection) Done ¶
func (c *Connection) Done() <-chan struct{}
Done is closed when the connection begins shutting down.
func (*Connection) Err ¶
func (c *Connection) Err() error
Err reports the immutable connection shutdown cause, or nil while active.
func (*Connection) SendNotification ¶
SendNotification sends a JSON-RPC notification.
func (*Connection) SendRequestNoResult ¶
SendRequestNoResult sends a request whose successful response has no result.
func (*Connection) SendTransportFrame ¶ added in v1.2.0
func (c *Connection) SendTransportFrame(ctx context.Context, frame TransportFrame) error
SendTransportFrame writes one complete JSON-RPC transport value. Relays use this to preserve batch boundaries instead of flattening entries.
func (*Connection) SetLogger ¶
func (c *Connection) SetLogger(logger *slog.Logger)
SetLogger installs a logger used for non-payload diagnostics.
func (*Connection) Start ¶ added in v1.2.0
func (c *Connection) Start()
Start launches connection-owned I/O workers. It must be called exactly once after NewUnstartedConnection.
type ConnectionOptions ¶
type ConnectionOptions struct {
MaxFrameSize int
MaxPendingRequests int
MaxHandlerConcurrency int
MaxQueuedRequests int
MaxQueuedNotifications int
// MaxNotificationBytes bounds queued and currently executing notification payloads.
MaxNotificationBytes int
MaxQueuedWrites int
// AcceptNotification is an optional method-only admission predicate. False
// discards an unsupported notification before it occupies queue capacity or
// an ordering watermark. It runs on the reader and must not block, panic, or
// call this connection. Requests, responses and $/cancel_request bypass it.
AcceptNotification func(method string) bool
Logger *slog.Logger
}
ConnectionOptions bounds every connection-owned queue and source of concurrency. Zero values select the documented defaults.
func DefaultConnectionOptions ¶
func DefaultConnectionOptions() ConnectionOptions
DefaultConnectionOptions returns the production defaults used by NewConnection.
type Content ¶
type Content struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The actual content block.
Content ContentBlock `json:"content"`
}
Standard content block (text, images, resources).
func (*Content) UnmarshalJSON ¶
type ContentBlock ¶
type ContentBlock struct {
// Text content. May be plain text or formatted with Markdown.
//
// All agents MUST support text content blocks in prompts.
// Clients SHOULD render this text as Markdown.
Text *ContentBlockText `json:"-"`
// Images for visual context or analysis.
//
// Requires the 'image' prompt capability when included in prompts.
Image *ContentBlockImage `json:"-"`
// Audio data for transcription or analysis.
//
// Requires the 'audio' prompt capability when included in prompts.
Audio *ContentBlockAudio `json:"-"`
// References to resources that the agent can access.
//
// All agents MUST support resource links in prompts.
ResourceLink *ContentBlockResourceLink `json:"-"`
// Complete resource contents embedded directly in the message.
//
// Preferred for including context as it avoids extra round-trips.
//
// Requires the 'embeddedContext' prompt capability when included in prompts.
Resource *ContentBlockResource `json:"-"`
}
func AudioBlock ¶
func AudioBlock(data string, mimeType string) ContentBlock
AudioBlock constructs an inline audio content block with base64-encoded data.
func ImageBlock ¶
func ImageBlock(data string, mimeType string) ContentBlock
ImageBlock constructs an inline image content block with base64-encoded data.
func ResourceBlock ¶
func ResourceBlock(res EmbeddedResourceResource) ContentBlock
ResourceBlock wraps an embedded resource as a content block.
func ResourceLinkBlock ¶
func ResourceLinkBlock(name string, uri string) ContentBlock
ResourceLinkBlock constructs a resource_link content block with a name and URI.
func TextBlock ¶
func TextBlock(text string) ContentBlock
TextBlock constructs a text content block.
func (ContentBlock) MarshalJSON ¶
func (u ContentBlock) MarshalJSON() ([]byte, error)
func (*ContentBlock) UnmarshalJSON ¶
func (u *ContentBlock) UnmarshalJSON(b []byte) error
func (*ContentBlock) Validate ¶
func (u *ContentBlock) Validate() error
type ContentBlockAudio ¶
type ContentBlockAudio struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional annotations that help clients decide how to display or route this content.
Annotations *Annotations `json:"annotations,omitempty"`
// Base64-encoded media payload.
Data string `json:"data"`
// MIME type describing the encoded media payload.
MimeType string `json:"mimeType"`
Type string `json:"type"`
}
Audio data for transcription or analysis.
Requires the 'audio' prompt capability when included in prompts.
type ContentBlockImage ¶
type ContentBlockImage struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional annotations that help clients decide how to display or route this content.
Annotations *Annotations `json:"annotations,omitempty"`
// Base64-encoded media payload.
Data string `json:"data"`
// MIME type describing the encoded media payload.
MimeType string `json:"mimeType"`
Type string `json:"type"`
// URI associated with this resource or media payload.
Uri *string `json:"uri,omitempty"`
}
Images for visual context or analysis.
Requires the 'image' prompt capability when included in prompts.
type ContentBlockResource ¶
type ContentBlockResource struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional annotations that help clients decide how to display or route this content.
Annotations *Annotations `json:"annotations,omitempty"`
// Embedded resource payload, either text or binary data.
Resource EmbeddedResourceResource `json:"resource"`
Type string `json:"type"`
}
Complete resource contents embedded directly in the message.
Preferred for including context as it avoids extra round-trips.
Requires the 'embeddedContext' prompt capability when included in prompts.
type ContentBlockResourceLink ¶
type ContentBlockResourceLink struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional annotations that help clients decide how to display or route this content.
Annotations *Annotations `json:"annotations,omitempty"`
// Optional human-readable details shown with this protocol object.
Description *string `json:"description,omitempty"`
// MIME type describing the encoded media payload.
MimeType *string `json:"mimeType,omitempty"`
// Human-readable name shown for this protocol object.
Name string `json:"name"`
// Optional size of the linked resource in bytes, if known.
Size *int64 `json:"size,omitempty"`
// Optional display title for end-user UI.
Title *string `json:"title,omitempty"`
Type string `json:"type"`
// URI associated with this resource or media payload.
Uri string `json:"uri"`
}
References to resources that the agent can access.
All agents MUST support resource links in prompts.
type ContentBlockText ¶
type ContentBlockText struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional annotations that help clients decide how to display or route this content.
Annotations *Annotations `json:"annotations,omitempty"`
// Text payload carried by this content block.
Text string `json:"text"`
Type string `json:"type"`
}
Content blocks represent displayable information in the Agent Client Protocol.
They provide a structured way to handle various types of user-facing content—whether it's text from language models, images for analysis, or embedded resources for context.
Content blocks appear in: - User prompts sent via 'session/prompt' - Language model output streamed through 'session/update' notifications - Progress updates and results from tool calls
This structure is compatible with the Model Context Protocol (MCP), enabling agents to seamlessly forward content from MCP tool outputs without transformation.
See protocol docs: Content(https://agentclientprotocol.com/protocol/v1/content) Text content. May be plain text or formatted with Markdown.
All agents MUST support text content blocks in prompts. Clients SHOULD render this text as Markdown.
type ContentChunk ¶
type ContentChunk struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// A single item of content
Content ContentBlock `json:"content"`
// A unique identifier for the message this chunk belongs to.
//
// All chunks belonging to the same message share the same 'messageId'.
// A change in 'messageId' indicates a new message has started.
MessageId *MessageId `json:"messageId,omitempty"`
}
A streamed item of content
func (*ContentChunk) UnmarshalJSON ¶
func (v *ContentChunk) UnmarshalJSON(b []byte) error
type Cost ¶
type Cost struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Total cumulative cost for session.
Amount float64 `json:"amount"`
// ISO 4217 currency code (e.g., "USD", "EUR").
Currency string `json:"currency"`
}
Cost information for a session.
func (*Cost) UnmarshalJSON ¶
type CreateElicitationAccept ¶
type CreateElicitationAccept struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
Action string `json:"action"`
// The user-provided content, if any, as an object matching the requested schema.
Content map[string]any `json:"content,omitempty"`
}
Response from the client to an elicitation request. The user accepted and provided content.
type CreateElicitationCancel ¶
type CreateElicitationCancel struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
Action string `json:"action"`
}
The elicitation was cancelled.
type CreateElicitationDecline ¶
type CreateElicitationDecline struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
Action string `json:"action"`
}
The user declined the elicitation.
type CreateElicitationForm ¶
type CreateElicitationForm struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// A human-readable message describing what input is needed.
Message string `json:"message"`
Mode string `json:"mode"`
// The request this elicitation is tied to.
RequestId *RequestId `json:"requestId,omitempty"`
// A JSON Schema describing the form fields to present to the user.
RequestedSchema ElicitationSchema `json:"requestedSchema"`
// The session this elicitation is tied to.
SessionId *SessionId `json:"sessionId,omitempty"`
// Optional tool call within the session.
//
// Optional. Omitted and 'null' are equivalent and mean the elicitation is scoped to the
// session without a specific tool call.
ToolCallId *ToolCallId `json:"toolCallId,omitempty"`
}
Request from the agent to elicit structured user input.
The agent sends this to the client to request information from the user, either via a form or by directing them to a URL. Elicitations are tied to a session (optionally a tool call) or a request. Form-based elicitation where the client renders a form from the provided schema.
type CreateElicitationOther ¶
type CreateElicitationOther = json.RawMessage
Custom or future elicitation mode.
Values beginning with '_' are reserved for implementation-specific extensions. Unknown values that do not begin with '_' are reserved for future ACP variants.
Clients that do not understand this mode should preserve the raw payload when storing, replaying, proxying, or forwarding elicitation requests. They MUST NOT render it as a known elicitation mode.
type CreateElicitationRequest ¶
type CreateElicitationRequest struct {
// Form-based elicitation where the client renders a form from the provided schema.
Form *CreateElicitationForm `json:"-"`
// URL-based elicitation where the client directs the user to a URL.
Url *CreateElicitationUrl `json:"-"`
// Custom or future elicitation mode.
//
// Values beginning with '_' are reserved for implementation-specific
// extensions. Unknown values that do not begin with '_' are reserved for
// future ACP variants.
//
// Clients that do not understand this mode should preserve the raw payload
// when storing, replaying, proxying, or forwarding elicitation requests.
// They MUST NOT render it as a known elicitation mode.
Other *CreateElicitationOther `json:"-"`
}
func (CreateElicitationRequest) MarshalJSON ¶
func (u CreateElicitationRequest) MarshalJSON() ([]byte, error)
func (*CreateElicitationRequest) UnmarshalJSON ¶
func (u *CreateElicitationRequest) UnmarshalJSON(b []byte) error
func (*CreateElicitationRequest) Validate ¶
func (u *CreateElicitationRequest) Validate() error
type CreateElicitationResponse ¶
type CreateElicitationResponse struct {
// The user accepted and provided content.
Accept *CreateElicitationAccept `json:"-"`
// The user declined the elicitation.
Decline *CreateElicitationDecline `json:"-"`
// The elicitation was cancelled.
Cancel *CreateElicitationCancel `json:"-"`
// Custom or future elicitation action.
//
// Values beginning with '_' are reserved for implementation-specific
// extensions. Unknown values that do not begin with '_' are reserved for
// future ACP variants.
//
// Agents that do not understand this action should preserve the raw
// payload when storing, replaying, proxying, or forwarding elicitation
// responses. They MUST NOT treat it as a known elicitation action.
Other *CreateElicitationResponseOther `json:"-"`
}
func (CreateElicitationResponse) MarshalJSON ¶
func (u CreateElicitationResponse) MarshalJSON() ([]byte, error)
func (*CreateElicitationResponse) UnmarshalJSON ¶
func (u *CreateElicitationResponse) UnmarshalJSON(b []byte) error
func (*CreateElicitationResponse) Validate ¶
func (u *CreateElicitationResponse) Validate() error
type CreateElicitationResponseOther ¶
type CreateElicitationResponseOther = json.RawMessage
Custom or future elicitation action.
Values beginning with '_' are reserved for implementation-specific extensions. Unknown values that do not begin with '_' are reserved for future ACP variants.
Agents that do not understand this action should preserve the raw payload when storing, replaying, proxying, or forwarding elicitation responses. They MUST NOT treat it as a known elicitation action.
type CreateElicitationUrl ¶
type CreateElicitationUrl struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The unique identifier for this elicitation.
ElicitationId ElicitationId `json:"elicitationId"`
// A human-readable message describing what input is needed.
Message string `json:"message"`
Mode string `json:"mode"`
// The request this elicitation is tied to.
RequestId *RequestId `json:"requestId,omitempty"`
// The session this elicitation is tied to.
SessionId *SessionId `json:"sessionId,omitempty"`
// Optional tool call within the session.
//
// Optional. Omitted and 'null' are equivalent and mean the elicitation is scoped to the
// session without a specific tool call.
ToolCallId *ToolCallId `json:"toolCallId,omitempty"`
// The URL to direct the user to.
Url string `json:"url"`
}
URL-based elicitation where the client directs the user to a URL.
type CreateTerminalRequest ¶
type CreateTerminalRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Array of command arguments.
Args []string `json:"args,omitempty"`
// The command to execute.
Command string `json:"command"`
// Working directory for the command. Must be an absolute path.
Cwd *string `json:"cwd,omitempty"`
// Environment variables for the command.
Env []EnvVariable `json:"env,omitempty"`
// Maximum number of output bytes to retain.
//
// When the limit is exceeded, the Client truncates from the beginning of the output
// to stay within the limit.
//
// The Client MUST ensure truncation happens at a character boundary to maintain valid
// string output, even if this means the retained output is slightly less than the
// specified limit.
OutputByteLimit *uint64 `json:"outputByteLimit,omitempty"`
// The session ID for this request.
SessionId SessionId `json:"sessionId"`
}
Request to create a new terminal and execute a command.
func (*CreateTerminalRequest) UnmarshalJSON ¶
func (v *CreateTerminalRequest) UnmarshalJSON(b []byte) error
func (*CreateTerminalRequest) Validate ¶
func (v *CreateTerminalRequest) Validate() error
type CreateTerminalResponse ¶
type CreateTerminalResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The unique identifier for the created terminal.
TerminalId TerminalId `json:"terminalId"`
}
Response containing the ID of the created terminal.
func (*CreateTerminalResponse) UnmarshalJSON ¶
func (v *CreateTerminalResponse) UnmarshalJSON(b []byte) error
func (*CreateTerminalResponse) Validate ¶
func (v *CreateTerminalResponse) Validate() error
type CurrentModeUpdate ¶
type CurrentModeUpdate struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The ID of the current mode
CurrentModeId SessionModeId `json:"currentModeId"`
}
The current mode of the session has changed
See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/v1/session-modes)
func (*CurrentModeUpdate) UnmarshalJSON ¶
func (v *CurrentModeUpdate) UnmarshalJSON(b []byte) error
type DeleteSessionRequest ¶
type DeleteSessionRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The ID of the session to delete.
SessionId SessionId `json:"sessionId"`
}
Request parameters for deleting an existing session from 'session/list'.
Only available if the Agent supports the 'sessionCapabilities.delete' capability.
func (*DeleteSessionRequest) UnmarshalJSON ¶
func (v *DeleteSessionRequest) UnmarshalJSON(b []byte) error
func (*DeleteSessionRequest) Validate ¶
func (v *DeleteSessionRequest) Validate() error
type DeleteSessionResponse ¶
type DeleteSessionResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Response from deleting a session.
func (*DeleteSessionResponse) Validate ¶
func (v *DeleteSessionResponse) Validate() error
type Diff ¶
type Diff struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The new content after modification.
NewText string `json:"newText"`
// The original content (omitted or 'null' for new files).
OldText *string `json:"oldText,omitempty"`
// The absolute file path being modified.
Path string `json:"path"`
}
A diff representing file modifications.
Shows changes to files in a format suitable for display in the client UI.
See protocol docs: Content(https://agentclientprotocol.com/protocol/v1/tool-calls#content)
func (*Diff) UnmarshalJSON ¶
type DispatchOptions ¶ added in v1.1.0
type DispatchOptions struct {
// Abort is called at most once when dispatch fails or its context is
// cancelled after the writer has been invoked. It must revoke the exact
// transport used by this request so a blocked Write can return. Abort is
// never called for a proven pre-write failure.
Abort func(cause error) error
}
DispatchOptions controls transport revocation for a prepared dispatch.
type ElicitationAcceptAction ¶
type ElicitationAcceptAction struct {
// The user-provided content, if any, as an object matching the requested schema.
Content map[string]any `json:"content,omitempty"`
}
The user accepted the elicitation and provided content.
type ElicitationCapabilities ¶
type ElicitationCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Whether the client supports form-based elicitation.
//
// Optional. Omitted and 'null' are equivalent and mean form support is not advertised.
// Supplying '{}' explicitly advertises form support.
Form *ElicitationFormCapabilities `json:"form,omitempty"`
// Whether the client supports URL-based elicitation.
//
// Optional. Omitted or 'null' both mean the client does not advertise support.
// Supplying '{}' means the client supports URL-based elicitation.
Url *ElicitationUrlCapabilities `json:"url,omitempty"`
}
Elicitation capabilities supported by the client.
type ElicitationContentValue ¶
type ElicitationContentValue struct {
// String value accepted in elicitation response content.
String *ElicitationContentValueString `json:"-"`
// Integer value accepted in elicitation response content.
Integer *ElicitationContentValueInteger `json:"-"`
// Number value accepted in elicitation response content.
Number *ElicitationContentValueNumber `json:"-"`
// Boolean value accepted in elicitation response content.
Boolean *ElicitationContentValueBoolean `json:"-"`
// String array value accepted in elicitation response content.
StringArray *ElicitationContentValueStringArray `json:"-"`
}
func (ElicitationContentValue) MarshalJSON ¶
func (u ElicitationContentValue) MarshalJSON() ([]byte, error)
func (*ElicitationContentValue) UnmarshalJSON ¶
func (u *ElicitationContentValue) UnmarshalJSON(b []byte) error
func (*ElicitationContentValue) Validate ¶
func (u *ElicitationContentValue) Validate() error
type ElicitationContentValueBoolean ¶
type ElicitationContentValueBoolean bool
Boolean value accepted in elicitation response content.
type ElicitationContentValueInteger ¶
type ElicitationContentValueInteger int64
Integer value accepted in elicitation response content.
type ElicitationContentValueNumber ¶
type ElicitationContentValueNumber float64
Number value accepted in elicitation response content.
type ElicitationContentValueString ¶
type ElicitationContentValueString string
Allowed wire representations for 'ElicitationContentValue'. String value accepted in elicitation response content.
type ElicitationContentValueStringArray ¶
type ElicitationContentValueStringArray []string
String array value accepted in elicitation response content.
type ElicitationFormCapabilities ¶
type ElicitationFormCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Form-based elicitation capabilities.
Supplying '{}' means the client supports form-based elicitation.
type ElicitationFormMode ¶
type ElicitationFormMode struct {
// Tied to a session, optionally to a specific tool call within that session.
Session *ElicitationFormModeSession `json:"-"`
// Tied to a specific JSON-RPC request outside of a session
// (e.g., during auth/configuration phases before any session is started).
Request *ElicitationFormModeRequest `json:"-"`
}
func (ElicitationFormMode) MarshalJSON ¶
func (u ElicitationFormMode) MarshalJSON() ([]byte, error)
func (*ElicitationFormMode) UnmarshalJSON ¶
func (u *ElicitationFormMode) UnmarshalJSON(b []byte) error
func (*ElicitationFormMode) Validate ¶
func (u *ElicitationFormMode) Validate() error
type ElicitationFormModeRequest ¶
type ElicitationFormModeRequest struct {
// The request this elicitation is tied to.
RequestId RequestId `json:"requestId"`
// A JSON Schema describing the form fields to present to the user.
RequestedSchema ElicitationSchema `json:"requestedSchema"`
}
Tied to a specific JSON-RPC request outside of a session (e.g., during auth/configuration phases before any session is started).
type ElicitationFormModeSession ¶
type ElicitationFormModeSession struct {
// A JSON Schema describing the form fields to present to the user.
RequestedSchema ElicitationSchema `json:"requestedSchema"`
// The session this elicitation is tied to.
SessionId SessionId `json:"sessionId"`
// Optional tool call within the session.
//
// Optional. Omitted and 'null' are equivalent and mean the elicitation is scoped to the
// session without a specific tool call.
ToolCallId *ToolCallId `json:"toolCallId,omitempty"`
}
Form-based elicitation mode where the client renders a form from the provided schema. Tied to a session, optionally to a specific tool call within that session.
type ElicitationPropertySchema ¶
type ElicitationPropertySchema struct {
// String property (or single-select enum when 'enum'/'oneOf' is set).
String *ElicitationPropertySchemaString `json:"-"`
// Number (floating-point) property.
Number *ElicitationPropertySchemaNumber `json:"-"`
// Integer property.
Integer *ElicitationPropertySchemaInteger `json:"-"`
// Boolean property.
Boolean *ElicitationPropertySchemaBoolean `json:"-"`
// Multi-select array property.
Array *ElicitationPropertySchemaArray `json:"-"`
// Custom or future elicitation property schema.
//
// Values beginning with '_' are reserved for implementation-specific
// extensions. Unknown values that do not begin with '_' are reserved for
// future ACP variants.
//
// Clients that do not understand this property schema type should preserve
// the raw schema when storing, replaying, proxying, or forwarding
// elicitation requests. They MUST NOT render it as a known input control.
Other *ElicitationPropertySchemaOther `json:"-"`
}
func (ElicitationPropertySchema) MarshalJSON ¶
func (u ElicitationPropertySchema) MarshalJSON() ([]byte, error)
func (*ElicitationPropertySchema) UnmarshalJSON ¶
func (u *ElicitationPropertySchema) UnmarshalJSON(b []byte) error
func (*ElicitationPropertySchema) Validate ¶
func (u *ElicitationPropertySchema) Validate() error
type ElicitationPropertySchemaArray ¶
type ElicitationPropertySchemaArray struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Default selected values.
//
// Optional. Omitted and 'null' are equivalent and mean no default selections are provided.
Default []string `json:"default,omitempty"`
// Human-readable description.
//
// Optional. Omitted and 'null' are equivalent and mean no description is provided.
Description *string `json:"description,omitempty"`
// The items definition describing allowed values.
Items MultiSelectItems `json:"items"`
// Maximum number of items to select.
//
// Optional. Omitted and 'null' are equivalent and mean there is no maximum selection count.
MaxItems *uint64 `json:"maxItems,omitempty"`
// Minimum number of items to select.
//
// Optional. Omitted and 'null' are equivalent and mean there is no minimum selection count.
MinItems *uint64 `json:"minItems,omitempty"`
// Optional title for the property.
//
// Optional. Omitted and 'null' are equivalent and mean no title is provided.
Title *string `json:"title,omitempty"`
Type string `json:"type"`
}
Multi-select array property.
type ElicitationPropertySchemaBoolean ¶
type ElicitationPropertySchemaBoolean struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Default value.
//
// Optional. Omitted and 'null' are equivalent and mean no default value is provided.
Default *bool `json:"default,omitempty"`
// Human-readable description.
//
// Optional. Omitted and 'null' are equivalent and mean no description is provided.
Description *string `json:"description,omitempty"`
// Optional title for the property.
//
// Optional. Omitted and 'null' are equivalent and mean no title is provided.
Title *string `json:"title,omitempty"`
Type string `json:"type"`
}
Boolean property.
type ElicitationPropertySchemaInteger ¶
type ElicitationPropertySchemaInteger struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Default value.
//
// Optional. Omitted and 'null' are equivalent and mean no default value is provided.
Default *int64 `json:"default,omitempty"`
// Human-readable description.
//
// Optional. Omitted and 'null' are equivalent and mean no description is provided.
Description *string `json:"description,omitempty"`
// Maximum value (inclusive).
//
// Optional. Omitted and 'null' are equivalent and mean there is no inclusive upper bound.
Maximum *int64 `json:"maximum,omitempty"`
// Minimum value (inclusive).
//
// Optional. Omitted and 'null' are equivalent and mean there is no inclusive lower bound.
Minimum *int64 `json:"minimum,omitempty"`
// Optional title for the property.
//
// Optional. Omitted and 'null' are equivalent and mean no title is provided.
Title *string `json:"title,omitempty"`
Type string `json:"type"`
}
Integer property.
type ElicitationPropertySchemaNumber ¶
type ElicitationPropertySchemaNumber struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Default value.
//
// Optional. Omitted and 'null' are equivalent and mean no default value is provided.
Default *float64 `json:"default,omitempty"`
// Human-readable description.
//
// Optional. Omitted and 'null' are equivalent and mean no description is provided.
Description *string `json:"description,omitempty"`
// Maximum value (inclusive).
//
// Optional. Omitted and 'null' are equivalent and mean there is no inclusive upper bound.
Maximum *float64 `json:"maximum,omitempty"`
// Minimum value (inclusive).
//
// Optional. Omitted and 'null' are equivalent and mean there is no inclusive lower bound.
Minimum *float64 `json:"minimum,omitempty"`
// Optional title for the property.
//
// Optional. Omitted and 'null' are equivalent and mean no title is provided.
Title *string `json:"title,omitempty"`
Type string `json:"type"`
}
Number (floating-point) property.
type ElicitationPropertySchemaOther ¶
type ElicitationPropertySchemaOther = json.RawMessage
Custom or future elicitation property schema.
Values beginning with '_' are reserved for implementation-specific extensions. Unknown values that do not begin with '_' are reserved for future ACP variants.
Clients that do not understand this property schema type should preserve the raw schema when storing, replaying, proxying, or forwarding elicitation requests. They MUST NOT render it as a known input control.
type ElicitationPropertySchemaString ¶
type ElicitationPropertySchemaString struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Default value.
//
// Optional. Omitted and 'null' are equivalent and mean no default value is provided.
Default *string `json:"default,omitempty"`
// Human-readable description.
//
// Optional. Omitted and 'null' are equivalent and mean no description is provided.
Description *string `json:"description,omitempty"`
// Enum values for untitled single-select enums.
// Optional. Omitted and 'null' are equivalent and mean no untitled single-select choices are
// declared by 'enum'.
Enum []string `json:"enum,omitempty"`
// String format.
//
// Optional. Omitted and 'null' are equivalent and mean there is no format constraint.
Format *StringFormat `json:"format,omitempty"`
// Maximum string length.
//
// Optional. Omitted and 'null' are equivalent and mean there is no maximum length constraint.
MaxLength *uint32 `json:"maxLength,omitempty"`
// Minimum string length.
//
// Optional. Omitted and 'null' are equivalent and mean there is no minimum length constraint.
MinLength *uint32 `json:"minLength,omitempty"`
// Titled enum options for titled single-select enums.
// Optional. Omitted and 'null' are equivalent and mean no titled single-select choices are
// declared by 'oneOf'.
OneOf []EnumOption `json:"oneOf,omitempty"`
// Pattern the string must match.
//
// Optional. Omitted and 'null' are equivalent and mean there is no pattern constraint.
Pattern *string `json:"pattern,omitempty"`
// Optional title for the property.
//
// Optional. Omitted and 'null' are equivalent and mean no title is provided.
Title *string `json:"title,omitempty"`
Type string `json:"type"`
}
Property schema for elicitation form fields.
Each variant corresponds to a JSON Schema '"type"' value. Single-select enums use 'type: "string"' with 'enum' or 'oneOf' set. Multi-select enums use 'type: "array"'. String property (or single-select enum when 'enum'/'oneOf' is set).
type ElicitationRequestScope ¶
type ElicitationRequestScope struct {
// The request this elicitation is tied to.
RequestId RequestId `json:"requestId"`
}
Request-scoped elicitation, tied to a specific JSON-RPC request outside of a session (e.g., during auth/configuration phases before any session is started).
func (*ElicitationRequestScope) UnmarshalJSON ¶
func (v *ElicitationRequestScope) UnmarshalJSON(b []byte) error
type ElicitationSchema ¶
type ElicitationSchema struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional description of what this schema represents.
//
// Optional. Omitted and 'null' are equivalent and mean no schema description is provided.
Description *string `json:"description,omitempty"`
// Property definitions (must be primitive types).
//
// Defaults to {} if unset.
Properties map[string]any `json:"properties"`
// List of required property names.
//
// Optional. Omitted and 'null' are equivalent and mean no property names are required.
Required []string `json:"required,omitempty"`
// Optional title for the schema.
//
// Optional. Omitted and 'null' are equivalent and mean no title is provided.
Title *string `json:"title,omitempty"`
// Type discriminator. Always '"object"'.
//
// Defaults to "object" if unset.
Type ElicitationSchemaType `json:"type,omitempty"`
}
Type-safe elicitation schema for requesting structured user input.
This represents a JSON Schema object with primitive-typed properties, as required by the elicitation specification.
func (ElicitationSchema) MarshalJSON ¶
func (v ElicitationSchema) MarshalJSON() ([]byte, error)
func (*ElicitationSchema) UnmarshalJSON ¶
func (v *ElicitationSchema) UnmarshalJSON(b []byte) error
type ElicitationSchemaType ¶
type ElicitationSchemaType string
Type discriminator for elicitation schemas.
const (
ElicitationSchemaTypeObject ElicitationSchemaType = "object"
)
type ElicitationSessionScope ¶
type ElicitationSessionScope struct {
// The session this elicitation is tied to.
SessionId SessionId `json:"sessionId"`
// Optional tool call within the session.
//
// Optional. Omitted and 'null' are equivalent and mean the elicitation is scoped to the
// session without a specific tool call.
ToolCallId *ToolCallId `json:"toolCallId,omitempty"`
}
Session-scoped elicitation, optionally tied to a specific tool call.
When 'toolCallId' is set, the elicitation is tied to a specific tool call. This is useful when an agent receives an elicitation from an MCP server during a tool call and needs to redirect it to the user.
func (*ElicitationSessionScope) UnmarshalJSON ¶
func (v *ElicitationSessionScope) UnmarshalJSON(b []byte) error
type ElicitationUrlCapabilities ¶
type ElicitationUrlCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
URL-based elicitation capabilities.
Supplying '{}' means the client supports URL-based elicitation.
type ElicitationUrlMode ¶
type ElicitationUrlMode struct {
// Tied to a session, optionally to a specific tool call within that session.
Session *ElicitationUrlModeSession `json:"-"`
// Tied to a specific JSON-RPC request outside of a session
// (e.g., during auth/configuration phases before any session is started).
Request *ElicitationUrlModeRequest `json:"-"`
}
func (ElicitationUrlMode) MarshalJSON ¶
func (u ElicitationUrlMode) MarshalJSON() ([]byte, error)
func (*ElicitationUrlMode) UnmarshalJSON ¶
func (u *ElicitationUrlMode) UnmarshalJSON(b []byte) error
func (*ElicitationUrlMode) Validate ¶
func (u *ElicitationUrlMode) Validate() error
type ElicitationUrlModeRequest ¶
type ElicitationUrlModeRequest struct {
// The unique identifier for this elicitation.
ElicitationId ElicitationId `json:"elicitationId"`
// The request this elicitation is tied to.
RequestId RequestId `json:"requestId"`
// The URL to direct the user to.
Url string `json:"url"`
}
Tied to a specific JSON-RPC request outside of a session (e.g., during auth/configuration phases before any session is started).
type ElicitationUrlModeSession ¶
type ElicitationUrlModeSession struct {
// The unique identifier for this elicitation.
ElicitationId ElicitationId `json:"elicitationId"`
// The session this elicitation is tied to.
SessionId SessionId `json:"sessionId"`
// Optional tool call within the session.
//
// Optional. Omitted and 'null' are equivalent and mean the elicitation is scoped to the
// session without a specific tool call.
ToolCallId *ToolCallId `json:"toolCallId,omitempty"`
// The URL to direct the user to.
Url string `json:"url"`
}
URL-based elicitation mode where the client directs the user to a URL. Tied to a session, optionally to a specific tool call within that session.
type EmbeddedResource ¶
type EmbeddedResource struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional annotations that help clients decide how to display or route this content.
Annotations *Annotations `json:"annotations,omitempty"`
// Embedded resource payload, either text or binary data.
Resource EmbeddedResourceResource `json:"resource"`
}
The contents of a resource, embedded into a prompt or tool call result.
func (*EmbeddedResource) UnmarshalJSON ¶
func (v *EmbeddedResource) UnmarshalJSON(b []byte) error
type EmbeddedResourceResource ¶
type EmbeddedResourceResource struct {
// Text resource contents embedded directly in the message.
TextResourceContents *TextResourceContents `json:"-"`
// Binary resource contents embedded directly in the message.
BlobResourceContents *BlobResourceContents `json:"-"`
}
Resource content that can be embedded in a message.
func (EmbeddedResourceResource) MarshalJSON ¶
func (u EmbeddedResourceResource) MarshalJSON() ([]byte, error)
func (*EmbeddedResourceResource) UnmarshalJSON ¶
func (u *EmbeddedResourceResource) UnmarshalJSON(b []byte) error
func (*EmbeddedResourceResource) Validate ¶
func (u *EmbeddedResourceResource) Validate() error
type EnumOption ¶
type EnumOption struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The constant value for this option.
Const string `json:"const"`
// Human-readable description.
//
// Optional. Omitted and 'null' are equivalent and mean no description is provided.
Description *string `json:"description,omitempty"`
// Human-readable title for this option.
Title string `json:"title"`
}
A titled enum option with a const value, human-readable title, and optional description.
func (*EnumOption) UnmarshalJSON ¶
func (v *EnumOption) UnmarshalJSON(b []byte) error
type EnvVariable ¶
type EnvVariable struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The name of the environment variable.
Name string `json:"name"`
// The value to set for the environment variable.
Value string `json:"value"`
}
An environment variable to set when launching an MCP server.
func (*EnvVariable) UnmarshalJSON ¶
func (v *EnvVariable) UnmarshalJSON(b []byte) error
type Error ¶
type Error struct {
// A number indicating the error type that occurred.
// This must be an integer as defined in the JSON-RPC specification.
Code ErrorCode `json:"code"`
// Optional primitive or structured value that contains additional information about the error.
// This may include debugging information or context-specific details.
Data any `json:"data,omitempty"`
// A string providing a short description of the error.
// The message should be limited to a concise single sentence.
Message string `json:"message"`
}
JSON-RPC error object.
Represents an error that occurred during method execution, following the JSON-RPC 2.0 error object specification with optional additional data.
See protocol docs: [JSON-RPC Error Object](https://www.jsonrpc.org/specification#error_object)
func (*Error) UnmarshalJSON ¶
type ErrorCode ¶
type ErrorCode struct {
// **Parse error**: Invalid JSON was received by the server.
// An error occurred on the server while parsing the JSON text.
ParseError *ErrorCodeParseError `json:"-"`
// **Invalid request**: The JSON sent is not a valid Request object.
InvalidRequest *ErrorCodeInvalidRequest `json:"-"`
// **Method not found**: The method does not exist or is not available.
MethodNotFound *ErrorCodeMethodNotFound `json:"-"`
// **Invalid params**: Invalid method parameter(s).
InvalidParams *ErrorCodeInvalidParams `json:"-"`
// **Internal error**: Internal JSON-RPC error.
InternalError *ErrorCodeInternalError `json:"-"`
// **Request cancelled**: Execution of the method was aborted either due to a cancellation request from the caller or
// because of resource constraints or shutdown.
RequestCancelled *ErrorCodeRequestCancelled `json:"-"`
// **Authentication required**: Authentication is required before this operation can be performed.
AuthenticationRequired *ErrorCodeAuthenticationRequired `json:"-"`
// **Resource not found**: A given resource, such as a session or file, was not found.
ResourceNotFound *ErrorCodeResourceNotFound `json:"-"`
// Other undefined error code.
Other *ErrorCodeOther `json:"-"`
}
func (ErrorCode) MarshalJSON ¶
func (*ErrorCode) UnmarshalJSON ¶
type ErrorCodeAuthenticationRequired ¶
type ErrorCodeAuthenticationRequired int32
**Authentication required**: Authentication is required before this operation can be performed.
type ErrorCodeInternalError ¶
type ErrorCodeInternalError int32
**Internal error**: Internal JSON-RPC error.
type ErrorCodeInvalidParams ¶
type ErrorCodeInvalidParams int32
**Invalid params**: Invalid method parameter(s).
type ErrorCodeInvalidRequest ¶
type ErrorCodeInvalidRequest int32
**Invalid request**: The JSON sent is not a valid Request object.
type ErrorCodeMethodNotFound ¶
type ErrorCodeMethodNotFound int32
**Method not found**: The method does not exist or is not available.
type ErrorCodeParseError ¶
type ErrorCodeParseError int32
Predefined error codes for common JSON-RPC and ACP-specific errors.
Standard errors use the JSON-RPC 2.0 codes. ACP-specific errors use the JSON-RPC server-error range (-32000 to -32099), and request cancellation uses -32800 from the range LSP reserves (-32899 to -32800). **Parse error**: Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text.
type ErrorCodeRequestCancelled ¶
type ErrorCodeRequestCancelled int32
**Request cancelled**: Execution of the method was aborted either due to a cancellation request from the caller or because of resource constraints or shutdown.
type ErrorCodeResourceNotFound ¶
type ErrorCodeResourceNotFound int32
**Resource not found**: A given resource, such as a session or file, was not found.
type ExtNotification ¶
type ExtNotification any
Allows either side to send an arbitrary notification that is not part of the ACP spec. Extension notifications provide a way to send one-way messages for custom functionality while maintaining protocol compatibility.
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility) ExtNotification is a union or complex schema; represented generically.
type ExtRequest ¶
type ExtRequest any
Allows for sending an arbitrary request that is not part of the ACP spec. Extension methods provide a way to add custom functionality while maintaining protocol compatibility.
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility) ExtRequest is a union or complex schema; represented generically.
type ExtResponse ¶
type ExtResponse any
Allows for sending an arbitrary response to an extension request that is not part of the ACP spec. Extension methods provide a way to add custom functionality while maintaining protocol compatibility.
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility) ExtResponse is a union or complex schema; represented generically.
type ExtensionMethodHandler ¶
type ExtensionMethodHandler interface {
HandleExtensionMethod(ctx context.Context, method string, params json.RawMessage) (any, error)
}
ExtensionMethodHandler can be implemented by either an Agent or a Client.
ACP extension methods are JSON-RPC methods whose names begin with "_". They provide a stable namespace for custom functionality that is not part of the core ACP spec.
If the method is unrecognized, implementations should return NewMethodNotFound(method).
See: https://agentclientprotocol.com/protocol/extensibility#extension-methods
type FileSystemCapabilities ¶
type FileSystemCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Whether the Client supports 'fs/read_text_file' requests.
//
// Defaults to false if unset.
ReadTextFile bool `json:"readTextFile,omitempty"`
// Whether the Client supports 'fs/write_text_file' requests.
//
// Defaults to false if unset.
WriteTextFile bool `json:"writeTextFile,omitempty"`
}
File system capabilities that a client may support.
See protocol docs: [FileSystem](https://agentclientprotocol.com/protocol/v1/initialization#filesystem)
func (FileSystemCapabilities) MarshalJSON ¶
func (v FileSystemCapabilities) MarshalJSON() ([]byte, error)
func (*FileSystemCapabilities) UnmarshalJSON ¶
func (v *FileSystemCapabilities) UnmarshalJSON(b []byte) error
type FrameKind ¶ added in v1.2.0
type FrameKind uint8
FrameKind classifies one JSON-RPC transport value.
type HttpHeader ¶
type HttpHeader struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The name of the HTTP header.
Name string `json:"name"`
// The value to set for the HTTP header.
Value string `json:"value"`
}
An HTTP header to set when making requests to the MCP server.
func (*HttpHeader) UnmarshalJSON ¶
func (v *HttpHeader) UnmarshalJSON(b []byte) error
type ImageContent ¶
type ImageContent struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional annotations that help clients decide how to display or route this content.
Annotations *Annotations `json:"annotations,omitempty"`
// Base64-encoded media payload.
Data string `json:"data"`
// MIME type describing the encoded media payload.
MimeType string `json:"mimeType"`
// URI associated with this resource or media payload.
Uri *string `json:"uri,omitempty"`
}
An image provided to or from an LLM.
func (*ImageContent) UnmarshalJSON ¶
func (v *ImageContent) UnmarshalJSON(b []byte) error
type Implementation ¶
type Implementation struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Intended for programmatic or logical use, but can be used as a display
// name fallback if title isn’t present.
Name string `json:"name"`
// Intended for UI and end-user contexts — optimized to be human-readable
// and easily understood.
//
// If not provided, the name should be used for display.
Title *string `json:"title,omitempty"`
// Version of the implementation. Can be displayed to the user or used
// for debugging or metrics purposes. (e.g. "1.0.0").
Version string `json:"version"`
}
Metadata about the implementation of the client or agent. Describes the name and version of an ACP implementation, with an optional title for UI representation.
func (*Implementation) UnmarshalJSON ¶
func (v *Implementation) UnmarshalJSON(b []byte) error
type InboundInfo ¶ added in v1.1.0
type InboundInfo struct {
Kind InboundKind
RequestID json.RawMessage
}
InboundInfo describes the JSON-RPC message currently being handled. RequestID is present only for requests and preserves the original JSON representation, including string, number, and explicit null IDs.
func InboundInfoFromContext ¶ added in v1.1.0
func InboundInfoFromContext(ctx context.Context) (InboundInfo, bool)
InboundInfoFromContext returns metadata for the current inbound handler invocation. The returned request ID is a copy and may be retained or modified by the caller.
type InboundKind ¶ added in v1.1.0
type InboundKind uint8
InboundKind identifies whether the current handler invocation came from a JSON-RPC request or notification.
const ( // InboundRequest requires the connection to send a JSON-RPC response. InboundRequest InboundKind = iota + 1 // InboundNotification does not have a JSON-RPC response. InboundNotification )
type InitializeRequest ¶
type InitializeRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Capabilities supported by the client.
//
// Defaults to {"auth":{"terminal":false},"fs":{"readTextFile":false,"writeTextFile":false},"terminal":false} if unset.
ClientCapabilities ClientCapabilities `json:"clientCapabilities,omitempty"`
// Information about the Client name and version sent to the Agent.
//
// Note: in future versions of the protocol, this will be required.
ClientInfo *Implementation `json:"clientInfo,omitempty"`
// The latest protocol version supported by the client.
ProtocolVersion ProtocolVersion `json:"protocolVersion"`
}
Request parameters for the initialize method.
Sent by the client to establish connection and negotiate capabilities.
See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/v1/initialization)
func (InitializeRequest) MarshalJSON ¶
func (v InitializeRequest) MarshalJSON() ([]byte, error)
func (*InitializeRequest) UnmarshalJSON ¶
func (v *InitializeRequest) UnmarshalJSON(b []byte) error
func (*InitializeRequest) Validate ¶
func (v *InitializeRequest) Validate() error
type InitializeResponse ¶
type InitializeResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Capabilities supported by the agent.
//
// Defaults to {"auth":{},"loadSession":false,"mcpCapabilities":{"http":false,"sse":false},"promptCapabilities":{"audio":false,"embeddedContext":false,"image":false},"sessionCapabilities":{}} if unset.
AgentCapabilities AgentCapabilities `json:"agentCapabilities,omitempty"`
// Information about the Agent name and version sent to the Client.
//
// Note: in future versions of the protocol, this will be required.
AgentInfo *Implementation `json:"agentInfo,omitempty"`
// Authentication methods supported by the agent.
//
// Defaults to [] if unset.
AuthMethods []AuthMethod `json:"authMethods"`
// The protocol version the client specified if supported by the agent,
// or the latest protocol version supported by the agent.
//
// The client should disconnect, if it doesn't support this version.
ProtocolVersion ProtocolVersion `json:"protocolVersion"`
}
Response to the 'initialize' method.
Contains the negotiated protocol version and agent capabilities.
See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/v1/initialization)
func (InitializeResponse) MarshalJSON ¶
func (v InitializeResponse) MarshalJSON() ([]byte, error)
func (*InitializeResponse) UnmarshalJSON ¶
func (v *InitializeResponse) UnmarshalJSON(b []byte) error
func (*InitializeResponse) Validate ¶
func (v *InitializeResponse) Validate() error
type IntegerPropertySchema ¶
type IntegerPropertySchema struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Default value.
//
// Optional. Omitted and 'null' are equivalent and mean no default value is provided.
Default *int64 `json:"default,omitempty"`
// Human-readable description.
//
// Optional. Omitted and 'null' are equivalent and mean no description is provided.
Description *string `json:"description,omitempty"`
// Maximum value (inclusive).
//
// Optional. Omitted and 'null' are equivalent and mean there is no inclusive upper bound.
Maximum *int64 `json:"maximum,omitempty"`
// Minimum value (inclusive).
//
// Optional. Omitted and 'null' are equivalent and mean there is no inclusive lower bound.
Minimum *int64 `json:"minimum,omitempty"`
// Optional title for the property.
//
// Optional. Omitted and 'null' are equivalent and mean no title is provided.
Title *string `json:"title,omitempty"`
}
Schema for integer properties in an elicitation form.
type KillTerminalRequest ¶
type KillTerminalRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The session ID for this request.
SessionId SessionId `json:"sessionId"`
// The ID of the terminal to kill.
TerminalId TerminalId `json:"terminalId"`
}
Request to kill a terminal without releasing it.
func (*KillTerminalRequest) UnmarshalJSON ¶
func (v *KillTerminalRequest) UnmarshalJSON(b []byte) error
func (*KillTerminalRequest) Validate ¶
func (v *KillTerminalRequest) Validate() error
type KillTerminalResponse ¶
type KillTerminalResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Response to 'terminal/kill' method
func (*KillTerminalResponse) Validate ¶
func (v *KillTerminalResponse) Validate() error
type ListSessionsRequest ¶
type ListSessionsRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Opaque cursor token from a previous response's nextCursor field for cursor-based pagination
Cursor *string `json:"cursor,omitempty"`
// Filter sessions by working directory. Must be an absolute path.
Cwd *string `json:"cwd,omitempty"`
}
Request parameters for listing existing sessions.
Only available if the Agent supports the 'sessionCapabilities.list' capability.
func (*ListSessionsRequest) Validate ¶
func (v *ListSessionsRequest) Validate() error
type ListSessionsResponse ¶
type ListSessionsResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Opaque cursor token. If present, pass this in the next request's cursor parameter
// to fetch the next page. If absent, there are no more results.
NextCursor *string `json:"nextCursor,omitempty"`
// Array of session information objects
Sessions []SessionInfo `json:"sessions"`
}
Response from listing sessions.
func (*ListSessionsResponse) UnmarshalJSON ¶
func (v *ListSessionsResponse) UnmarshalJSON(b []byte) error
func (*ListSessionsResponse) Validate ¶
func (v *ListSessionsResponse) Validate() error
type LoadSessionRequest ¶
type LoadSessionRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Additional workspace roots to activate for this session. Each path must be absolute.
//
// When omitted or empty, no additional roots are activated. When non-empty,
// this is the complete resulting additional-root list for the loaded
// session. It may differ from any previously used or reported list as long as
// the request 'cwd' matches the session's 'cwd'.
AdditionalDirectories []string `json:"additionalDirectories,omitempty"`
// The working directory for this session. Must be an absolute path.
Cwd string `json:"cwd"`
// List of MCP servers to connect to for this session.
McpServers []McpServer `json:"mcpServers"`
// The ID of the session to load.
SessionId SessionId `json:"sessionId"`
}
Request parameters for loading an existing session.
Only available if the Agent supports the 'loadSession' capability.
See protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/v1/session-setup#loading-sessions)
func (*LoadSessionRequest) UnmarshalJSON ¶
func (v *LoadSessionRequest) UnmarshalJSON(b []byte) error
func (*LoadSessionRequest) Validate ¶
func (v *LoadSessionRequest) Validate() error
type LoadSessionResponse ¶
type LoadSessionResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Initial session configuration options if supported by the Agent.
ConfigOptions []SessionConfigOption `json:"configOptions,omitempty"`
// Initial mode state if supported by the Agent
//
// See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/v1/session-modes)
Modes *SessionModeState `json:"modes,omitempty"`
}
Response from loading an existing session.
func (*LoadSessionResponse) Validate ¶
func (v *LoadSessionResponse) Validate() error
type LogoutCapabilities ¶
type LogoutCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Logout capabilities supported by the agent.
Supplying '{}' means the agent supports the logout method.
type LogoutRequest ¶
type LogoutRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Request parameters for the logout method.
Terminates the current authenticated session.
func (*LogoutRequest) Validate ¶
func (v *LogoutRequest) Validate() error
type LogoutResponse ¶
type LogoutResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Response to the 'logout' method.
func (*LogoutResponse) Validate ¶
func (v *LogoutResponse) Validate() error
type McpCapabilities ¶
type McpCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Agent supports 'http' MCP servers.
//
// Defaults to false if unset.
Http bool `json:"http,omitempty"`
// Agent supports 'sse' MCP servers.
//
// Defaults to false if unset.
Sse bool `json:"sse,omitempty"`
}
MCP capabilities supported by the agent
func (McpCapabilities) MarshalJSON ¶
func (v McpCapabilities) MarshalJSON() ([]byte, error)
func (*McpCapabilities) UnmarshalJSON ¶
func (v *McpCapabilities) UnmarshalJSON(b []byte) error
type McpServer ¶
type McpServer struct {
// HTTP transport configuration
//
// Only available when the Agent capabilities indicate 'mcp_capabilities.http' is 'true'.
Http *McpServerHttpInline `json:"-"`
// SSE transport configuration
//
// Only available when the Agent capabilities indicate 'mcp_capabilities.sse' is 'true'.
Sse *McpServerSseInline `json:"-"`
// Stdio transport configuration
//
// All Agents MUST support this transport.
Stdio *McpServerStdio `json:"-"`
}
func (McpServer) MarshalJSON ¶
func (*McpServer) UnmarshalJSON ¶
type McpServerHttp ¶
type McpServerHttp struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// HTTP headers to set when making requests to the MCP server.
Headers []HttpHeader `json:"headers"`
// Human-readable name identifying this MCP server.
Name string `json:"name"`
// URL to the MCP server.
Url string `json:"url"`
}
HTTP transport configuration for MCP.
func (*McpServerHttp) UnmarshalJSON ¶
func (v *McpServerHttp) UnmarshalJSON(b []byte) error
type McpServerHttpInline ¶
type McpServerHttpInline struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// HTTP headers to set when making requests to the MCP server.
Headers []HttpHeader `json:"headers"`
// Human-readable name identifying this MCP server.
Name string `json:"name"`
Type string `json:"type"`
// URL to the MCP server.
Url string `json:"url"`
}
Configuration for connecting to an MCP (Model Context Protocol) server.
MCP servers provide tools and context that the agent can use when processing prompts.
See protocol docs: [MCP Servers](https://agentclientprotocol.com/protocol/v1/session-setup#mcp-servers) HTTP transport configuration
Only available when the Agent capabilities indicate 'mcp_capabilities.http' is 'true'.
func (*McpServerHttpInline) UnmarshalJSON ¶ added in v1.5.0
func (v *McpServerHttpInline) UnmarshalJSON(b []byte) error
type McpServerSse ¶
type McpServerSse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// HTTP headers to set when making requests to the MCP server.
Headers []HttpHeader `json:"headers"`
// Human-readable name identifying this MCP server.
Name string `json:"name"`
// URL to the MCP server.
Url string `json:"url"`
}
SSE transport configuration for MCP.
func (*McpServerSse) UnmarshalJSON ¶
func (v *McpServerSse) UnmarshalJSON(b []byte) error
type McpServerSseInline ¶
type McpServerSseInline struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// HTTP headers to set when making requests to the MCP server.
Headers []HttpHeader `json:"headers"`
// Human-readable name identifying this MCP server.
Name string `json:"name"`
Type string `json:"type"`
// URL to the MCP server.
Url string `json:"url"`
}
SSE transport configuration
Only available when the Agent capabilities indicate 'mcp_capabilities.sse' is 'true'.
func (*McpServerSseInline) UnmarshalJSON ¶ added in v1.5.0
func (v *McpServerSseInline) UnmarshalJSON(b []byte) error
type McpServerStdio ¶
type McpServerStdio struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Command-line arguments to pass to the MCP server.
Args []string `json:"args"`
// Absolute path to the MCP server executable.
Command string `json:"command"`
// Environment variables to set when launching the MCP server.
Env []EnvVariable `json:"env"`
// Human-readable name identifying this MCP server.
Name string `json:"name"`
}
Stdio transport configuration for MCP.
func (*McpServerStdio) UnmarshalJSON ¶
func (v *McpServerStdio) UnmarshalJSON(b []byte) error
type MethodHandler ¶
type MethodHandler func(ctx context.Context, method string, params json.RawMessage) (any, *RequestError)
MethodHandler dispatches one inbound ACP request or notification.
type MultiSelectItems ¶
type MultiSelectItems struct {
// Multi-select string items with plain string values.
String *MultiSelectItemsString `json:"-"`
// Custom or future typed multi-select items.
Other *MultiSelectItemsOther `json:"-"`
// Titled multi-select items with human-readable labels.
//
// As in MCP, titled items omit 'type' and are identified by 'anyOf'.
Titled *TitledMultiSelectItems `json:"-"`
}
func (MultiSelectItems) MarshalJSON ¶
func (u MultiSelectItems) MarshalJSON() ([]byte, error)
func (*MultiSelectItems) UnmarshalJSON ¶
func (u *MultiSelectItems) UnmarshalJSON(b []byte) error
func (*MultiSelectItems) Validate ¶
func (u *MultiSelectItems) Validate() error
type MultiSelectItemsOther ¶
type MultiSelectItemsOther = json.RawMessage
Custom or future typed multi-select items.
type MultiSelectItemsString ¶
type MultiSelectItemsString struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Allowed enum values.
Enum []string `json:"enum"`
Type string `json:"type"`
}
Items for a multi-select (array) property schema. Multi-select string items with plain string values.
type MultiSelectPropertySchema ¶
type MultiSelectPropertySchema struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Default selected values.
//
// Optional. Omitted and 'null' are equivalent and mean no default selections are provided.
Default []string `json:"default,omitempty"`
// Human-readable description.
//
// Optional. Omitted and 'null' are equivalent and mean no description is provided.
Description *string `json:"description,omitempty"`
// The items definition describing allowed values.
Items MultiSelectItems `json:"items"`
// Maximum number of items to select.
//
// Optional. Omitted and 'null' are equivalent and mean there is no maximum selection count.
MaxItems *uint64 `json:"maxItems,omitempty"`
// Minimum number of items to select.
//
// Optional. Omitted and 'null' are equivalent and mean there is no minimum selection count.
MinItems *uint64 `json:"minItems,omitempty"`
// Optional title for the property.
//
// Optional. Omitted and 'null' are equivalent and mean no title is provided.
Title *string `json:"title,omitempty"`
}
Schema for multi-select (array) properties in an elicitation form.
func (*MultiSelectPropertySchema) UnmarshalJSON ¶
func (v *MultiSelectPropertySchema) UnmarshalJSON(b []byte) error
type NewSessionRequest ¶
type NewSessionRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Additional workspace roots for this session. Each path must be absolute.
//
// These expand the session's filesystem scope without changing 'cwd', which
// remains the base for relative paths. When omitted or empty, no
// additional roots are activated for the new session.
AdditionalDirectories []string `json:"additionalDirectories,omitempty"`
// The working directory for this session. Must be an absolute path.
Cwd string `json:"cwd"`
// List of MCP (Model Context Protocol) servers the agent should connect to.
McpServers []McpServer `json:"mcpServers"`
}
Request parameters for creating a new session.
See protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/v1/session-setup#creating-a-session)
func (*NewSessionRequest) UnmarshalJSON ¶
func (v *NewSessionRequest) UnmarshalJSON(b []byte) error
func (*NewSessionRequest) Validate ¶
func (v *NewSessionRequest) Validate() error
type NewSessionResponse ¶
type NewSessionResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Initial session configuration options if supported by the Agent.
ConfigOptions []SessionConfigOption `json:"configOptions,omitempty"`
// Initial mode state if supported by the Agent
//
// See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/v1/session-modes)
Modes *SessionModeState `json:"modes,omitempty"`
// Unique identifier for the created session.
//
// Used in all subsequent requests for this conversation.
SessionId SessionId `json:"sessionId"`
}
Response from creating a new session.
See protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol/v1/session-setup#creating-a-session)
func (*NewSessionResponse) UnmarshalJSON ¶
func (v *NewSessionResponse) UnmarshalJSON(b []byte) error
func (*NewSessionResponse) Validate ¶
func (v *NewSessionResponse) Validate() error
type Notice ¶ added in v1.5.0
type Notice struct {
// Metadata scoped to this notice.
//
// Omitted and 'null' are equivalent and mean no metadata was supplied.
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional plain-text detail or guidance.
//
// Omitted and 'null' are equivalent and mean no description was supplied.
Description *string `json:"description,omitempty"`
// Presentation severity hint.
Severity NoticeSeverity `json:"severity"`
// Required non-empty plain-text title that can stand alone.
Title string `json:"title"`
}
Fire-and-forget information for the user.
Notices are live events rather than session history. Agents must not rely on a notice being received, displayed, or seen by the user. Agents MUST only send notices when the Client advertised the 'session.notices' Client capability. Otherwise, Agents may use an agent message when the information should still be surfaced to the user.
See RFD: [Session Notices](https://agentclientprotocol.com/rfds/session-notices)
func (*Notice) UnmarshalJSON ¶ added in v1.5.0
type NoticeCapabilities ¶ added in v1.5.0
type NoticeCapabilities struct{}
Client support for presenting live notices to the user.
type NoticeSeverity ¶ added in v1.5.0
type NoticeSeverity string
Severity hint for a session notice.
const ( NoticeSeverityInfo NoticeSeverity = "info" NoticeSeverityWarning NoticeSeverity = "warning" NoticeSeverityError NoticeSeverity = "error" )
type NullableFieldState ¶ added in v1.1.0
type NullableFieldState uint8
NullableFieldState reports whether an optional nullable ACP field was absent, explicitly null, or carried a value on the wire.
const ( NullableFieldAbsent NullableFieldState = iota NullableFieldNull NullableFieldValue )
func (NullableFieldState) String ¶ added in v1.1.0
func (s NullableFieldState) String() string
type NumberPropertySchema ¶
type NumberPropertySchema struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Default value.
//
// Optional. Omitted and 'null' are equivalent and mean no default value is provided.
Default *float64 `json:"default,omitempty"`
// Human-readable description.
//
// Optional. Omitted and 'null' are equivalent and mean no description is provided.
Description *string `json:"description,omitempty"`
// Maximum value (inclusive).
//
// Optional. Omitted and 'null' are equivalent and mean there is no inclusive upper bound.
Maximum *float64 `json:"maximum,omitempty"`
// Minimum value (inclusive).
//
// Optional. Omitted and 'null' are equivalent and mean there is no inclusive lower bound.
Minimum *float64 `json:"minimum,omitempty"`
// Optional title for the property.
//
// Optional. Omitted and 'null' are equivalent and mean no title is provided.
Title *string `json:"title,omitempty"`
}
Schema for number (floating-point) properties in an elicitation form.
type PermissionOption ¶
type PermissionOption struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Hint about the nature of this permission option.
Kind PermissionOptionKind `json:"kind"`
// Human-readable label to display to the user.
Name string `json:"name"`
// Unique identifier for this permission option.
OptionId PermissionOptionId `json:"optionId"`
}
An option presented to the user when requesting permission.
func (*PermissionOption) UnmarshalJSON ¶
func (v *PermissionOption) UnmarshalJSON(b []byte) error
type PermissionOptionKind ¶
type PermissionOptionKind string
The type of permission option being presented to the user.
Helps clients choose appropriate icons and UI treatment.
const ( PermissionOptionKindAllowOnce PermissionOptionKind = "allow_once" PermissionOptionKindAllowAlways PermissionOptionKind = "allow_always" PermissionOptionKindRejectOnce PermissionOptionKind = "reject_once" PermissionOptionKindRejectAlways PermissionOptionKind = "reject_always" )
type Plan ¶
type Plan struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The list of tasks to be accomplished.
//
// When updating a plan, the agent must send a complete list of all entries
// with their current status. The client replaces the entire plan with each update.
Entries []PlanEntry `json:"entries"`
}
An execution plan for accomplishing complex tasks.
Plans consist of multiple entries representing individual tasks or goals. Agents report plans to clients to provide visibility into their execution strategy. Plans can evolve during execution as the agent discovers new requirements or completes tasks.
See protocol docs: [Agent Plan](https://agentclientprotocol.com/protocol/v1/agent-plan)
func (*Plan) UnmarshalJSON ¶
type PlanEntry ¶
type PlanEntry struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Human-readable description of what this task aims to accomplish.
Content string `json:"content"`
// The relative importance of this task.
// Used to indicate which tasks are most critical to the overall goal.
Priority PlanEntryPriority `json:"priority"`
// Current execution status of this task.
Status PlanEntryStatus `json:"status"`
}
A single entry in the execution plan.
Represents a task or goal that the assistant intends to accomplish as part of fulfilling the user's request. See protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/v1/agent-plan#plan-entries)
func (*PlanEntry) UnmarshalJSON ¶
type PlanEntryPriority ¶
type PlanEntryPriority string
Priority levels for plan entries.
Used to indicate the relative importance or urgency of different tasks in the execution plan. See protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/v1/agent-plan#plan-entries)
const ( PlanEntryPriorityHigh PlanEntryPriority = "high" PlanEntryPriorityMedium PlanEntryPriority = "medium" PlanEntryPriorityLow PlanEntryPriority = "low" )
type PlanEntryStatus ¶
type PlanEntryStatus string
Status of a plan entry in the execution flow.
Tracks the lifecycle of each task from planning through completion. See protocol docs: [Plan Entries](https://agentclientprotocol.com/protocol/v1/agent-plan#plan-entries)
const ( PlanEntryStatusPending PlanEntryStatus = "pending" PlanEntryStatusInProgress PlanEntryStatus = "in_progress" PlanEntryStatusCompleted PlanEntryStatus = "completed" )
type PreparedRequest ¶ added in v1.1.0
type PreparedRequest[T any] struct { // contains filtered or unexported fields }
PreparedRequest owns one encoded, bounded pending request. Callers must eventually call Wait or Abandon. Dispatch and Wait accept independent contexts so response ownership can move to a longer-lived producer.
func PrepareAgentRequest ¶ added in v1.1.0
func PrepareAgentRequest[T any](c *AgentSideConnection, method string, params any) (*PreparedRequest[T], error)
PrepareAgentRequest prepares a reverse request on a typed agent-side connection.
func PrepareClientRequest ¶ added in v1.1.0
func PrepareClientRequest[T any](c *ClientSideConnection, method string, params any) (*PreparedRequest[T], error)
PrepareClientRequest prepares a request on a typed client-side connection.
func PrepareRequest ¶ added in v1.1.0
func PrepareRequest[T any](c *Connection, method string, params any) (*PreparedRequest[T], error)
PrepareRequest encodes and registers a bounded pending request without entering the writer queue or touching the transport.
func (*PreparedRequest[T]) Abandon ¶ added in v1.1.0
func (r *PreparedRequest[T]) Abandon() RequestSubmissionState
Abandon idempotently releases local response ownership. It never sends a cancellation notification and never changes a possibly submitted request into a safe-to-retry request.
func (*PreparedRequest[T]) CancelRequest ¶ added in v1.1.0
func (r *PreparedRequest[T]) CancelRequest(ctx context.Context) error
CancelRequest sends one best-effort ACP $/cancel_request notification after a successful Dispatch. It does not abandon the local waiter or abort the transport, and the peer must still complete the original request.
func (*PreparedRequest[T]) Dispatch ¶ added in v1.1.0
func (r *PreparedRequest[T]) Dispatch(ctx context.Context, opts DispatchOptions) error
Dispatch writes the prepared request once. A nil return proves that the full frame was accepted by the local writer, not that the peer executed it.
func (*PreparedRequest[T]) ObserveResponse ¶ added in v1.1.0
func (r *PreparedRequest[T]) ObserveResponse(observer ResponseObserver) error
ObserveResponse installs the request's sole decode-independent response observer. It must be called before Dispatch.
func (*PreparedRequest[T]) Wait ¶ added in v1.1.0
func (r *PreparedRequest[T]) Wait(ctx context.Context) (T, error)
Wait waits for the response with a context independent of Dispatch. A Wait that ends before a response arrives does not cancel or abandon the request; the caller may Wait again or explicitly call CancelRequest or Abandon.
type PromptCapabilities ¶
type PromptCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Agent supports 'audio' content blocks.
//
// Defaults to false if unset.
Audio bool `json:"audio,omitempty"`
// Agent supports embedded context in 'session/prompt' requests.
//
// When enabled, the Client is allowed to include 'resource' content blocks
// in prompt requests for pieces of context that are referenced in the message.
//
// Defaults to false if unset.
EmbeddedContext bool `json:"embeddedContext,omitempty"`
// Agent supports 'image' content blocks.
//
// Defaults to false if unset.
Image bool `json:"image,omitempty"`
}
Prompt capabilities supported by the agent in 'session/prompt' requests.
Baseline agent functionality requires support for 'text' and 'resource_link' content blocks in prompt requests.
Other variants must be explicitly opted in to. Capabilities for different types of content in prompt requests.
Indicates which content types beyond the baseline (text and resource links) the agent can process.
See protocol docs: [Prompt Capabilities](https://agentclientprotocol.com/protocol/v1/initialization#prompt-capabilities)
func (PromptCapabilities) MarshalJSON ¶
func (v PromptCapabilities) MarshalJSON() ([]byte, error)
func (*PromptCapabilities) UnmarshalJSON ¶
func (v *PromptCapabilities) UnmarshalJSON(b []byte) error
type PromptRequest ¶
type PromptRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The blocks of content that compose the user's message.
//
// As a baseline, the Agent MUST support 'text' and 'resource_link' content blocks,
// while other variants are optionally enabled via 'PromptCapabilities'.
//
// The Client MUST adapt its interface according to 'PromptCapabilities'.
//
// The client MAY include referenced pieces of context as either
// 'resource' or 'resource_link' content blocks.
//
// When available, 'resource' is preferred
// as it avoids extra round-trips and allows the message to include
// pieces of context from sources the agent may not have access to.
Prompt []ContentBlock `json:"prompt"`
// The ID of the session to send this user message to
SessionId SessionId `json:"sessionId"`
}
Request parameters for sending a user prompt to the agent.
Contains the user's message and any additional context.
See protocol docs: [User Message](https://agentclientprotocol.com/protocol/v1/prompt-turn#1-user-message)
func (*PromptRequest) UnmarshalJSON ¶
func (v *PromptRequest) UnmarshalJSON(b []byte) error
func (*PromptRequest) Validate ¶
func (v *PromptRequest) Validate() error
type PromptResponse ¶
type PromptResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Indicates why the agent stopped processing the turn.
StopReason StopReason `json:"stopReason"`
}
Response from processing a user prompt.
See protocol docs: [Check for Completion](https://agentclientprotocol.com/protocol/v1/prompt-turn#4-check-for-completion)
func (*PromptResponse) UnmarshalJSON ¶
func (v *PromptResponse) UnmarshalJSON(b []byte) error
func (*PromptResponse) Validate ¶
func (v *PromptResponse) Validate() error
type ProtocolVersion ¶
type ProtocolVersion uint16
Protocol version identifier.
This version is only bumped for breaking changes. Non-breaking changes should be introduced via capabilities.
type RPCResponse ¶ added in v1.1.0
type RPCResponse struct {
RequestID json.RawMessage
Result json.RawMessage
Error *RequestError
}
RPCResponse is a decode-independent JSON-RPC response envelope. Result and RequestID preserve their JSON representation; Error exposes code, message, and data through the existing RequestError type.
type ReadTextFileRequest ¶
type ReadTextFileRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Maximum number of lines to read.
Limit *uint32 `json:"limit,omitempty"`
// Line number to start reading from (1-based).
Line *uint32 `json:"line,omitempty"`
// Absolute path to the file to read.
Path string `json:"path"`
// The session ID for this request.
SessionId SessionId `json:"sessionId"`
}
Request to read content from a text file.
Only available if the client supports the 'fs.readTextFile' capability.
func (*ReadTextFileRequest) UnmarshalJSON ¶
func (v *ReadTextFileRequest) UnmarshalJSON(b []byte) error
func (*ReadTextFileRequest) Validate ¶
func (v *ReadTextFileRequest) Validate() error
type ReadTextFileResponse ¶
type ReadTextFileResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Content payload returned by this response.
Content string `json:"content"`
}
Response containing the contents of a text file.
func (*ReadTextFileResponse) UnmarshalJSON ¶
func (v *ReadTextFileResponse) UnmarshalJSON(b []byte) error
func (*ReadTextFileResponse) Validate ¶
func (v *ReadTextFileResponse) Validate() error
type ReleaseTerminalRequest ¶
type ReleaseTerminalRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The session ID for this request.
SessionId SessionId `json:"sessionId"`
// The ID of the terminal to release.
TerminalId TerminalId `json:"terminalId"`
}
Request to release a terminal and free its resources.
func (*ReleaseTerminalRequest) UnmarshalJSON ¶
func (v *ReleaseTerminalRequest) UnmarshalJSON(b []byte) error
func (*ReleaseTerminalRequest) Validate ¶
func (v *ReleaseTerminalRequest) Validate() error
type ReleaseTerminalResponse ¶
type ReleaseTerminalResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Response to terminal/release method
func (*ReleaseTerminalResponse) Validate ¶
func (v *ReleaseTerminalResponse) Validate() error
type RequestError ¶
type RequestError struct {
Code int `json:"code"`
Message string `json:"message"`
Data any `json:"data,omitempty"`
}
RequestError represents a JSON-RPC error response.
func NewAuthRequired ¶
func NewAuthRequired(data any) *RequestError
func NewInternalError ¶
func NewInternalError(data any) *RequestError
func NewInvalidParams ¶
func NewInvalidParams(data any) *RequestError
func NewInvalidRequest ¶
func NewInvalidRequest(data any) *RequestError
func NewMethodNotFound ¶
func NewMethodNotFound(method string) *RequestError
func NewParseError ¶
func NewParseError(data any) *RequestError
func NewRequestCancelled ¶
func NewRequestCancelled(data any) *RequestError
func NewServerOverloaded ¶
func NewServerOverloaded(data any) *RequestError
NewServerOverloaded reports bounded connection admission failure.
func (*RequestError) Error ¶
func (e *RequestError) Error() string
type RequestId ¶
type RequestId struct {
// The JSON-RPC 'null' request id.
Null *RequestIdNull `json:"-"`
// A numeric JSON-RPC request id.
Number *RequestIdNumber `json:"-"`
// A string JSON-RPC request id.
Str *RequestIdStr `json:"-"`
}
func (RequestId) MarshalJSON ¶
func (*RequestId) UnmarshalJSON ¶
type RequestIdNull ¶
type RequestIdNull struct{}
JSON RPC Request Id
An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null \[1\] and Numbers SHOULD NOT contain fractional parts \[2\]
The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.
\[1\] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.
\[2\] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions.
type RequestLifecycleError ¶ added in v1.1.0
type RequestLifecycleError struct {
// contains filtered or unexported fields
}
RequestLifecycleError preserves the operation, transport submission state, and underlying error for a prepared request operation.
func (*RequestLifecycleError) Error ¶ added in v1.1.0
func (e *RequestLifecycleError) Error() string
func (*RequestLifecycleError) Operation ¶ added in v1.1.0
func (e *RequestLifecycleError) Operation() string
Operation returns the lifecycle operation that failed.
func (*RequestLifecycleError) SubmissionState ¶ added in v1.1.0
func (e *RequestLifecycleError) SubmissionState() RequestSubmissionState
SubmissionState returns the immutable submission classification associated with the failure.
func (*RequestLifecycleError) Unwrap ¶ added in v1.1.0
func (e *RequestLifecycleError) Unwrap() error
type RequestPermissionOutcome ¶
type RequestPermissionOutcome struct {
// The prompt turn was cancelled before the user responded.
//
// When a client sends a 'session/cancel' notification to cancel an ongoing
// prompt turn, it MUST respond to all pending 'session/request_permission'
// requests with this 'cancelled' outcome.
//
// See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v1/prompt-turn#cancellation)
Cancelled *RequestPermissionOutcomeCancelled `json:"-"`
// The user selected one of the provided options.
Selected *RequestPermissionOutcomeSelected `json:"-"`
}
func NewRequestPermissionOutcomeCancelled ¶
func NewRequestPermissionOutcomeCancelled() RequestPermissionOutcome
NewRequestPermissionOutcomeCancelled constructs a RequestPermissionOutcome using the 'cancelled' variant.
func NewRequestPermissionOutcomeSelected ¶
func NewRequestPermissionOutcomeSelected(optionId PermissionOptionId) RequestPermissionOutcome
NewRequestPermissionOutcomeSelected constructs a RequestPermissionOutcome using the 'selected' variant.
func (RequestPermissionOutcome) MarshalJSON ¶
func (u RequestPermissionOutcome) MarshalJSON() ([]byte, error)
func (*RequestPermissionOutcome) UnmarshalJSON ¶
func (u *RequestPermissionOutcome) UnmarshalJSON(b []byte) error
func (*RequestPermissionOutcome) Validate ¶
func (u *RequestPermissionOutcome) Validate() error
type RequestPermissionOutcomeCancelled ¶
type RequestPermissionOutcomeCancelled struct {
Outcome string `json:"outcome"`
}
The outcome of a permission request. The prompt turn was cancelled before the user responded.
When a client sends a 'session/cancel' notification to cancel an ongoing prompt turn, it MUST respond to all pending 'session/request_permission' requests with this 'cancelled' outcome.
See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/v1/prompt-turn#cancellation)
type RequestPermissionOutcomeSelected ¶
type RequestPermissionOutcomeSelected struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The ID of the option the user selected.
OptionId PermissionOptionId `json:"optionId"`
Outcome string `json:"outcome"`
}
The user selected one of the provided options.
type RequestPermissionRequest ¶
type RequestPermissionRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Available permission options for the user to choose from.
Options []PermissionOption `json:"options"`
// The session ID for this request.
SessionId SessionId `json:"sessionId"`
// Details about the tool call requiring permission.
ToolCall ToolCallUpdate `json:"toolCall"`
}
Request for user permission to execute a tool call.
Sent when the agent needs authorization before performing a sensitive operation.
See protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/v1/tool-calls#requesting-permission)
func (*RequestPermissionRequest) UnmarshalJSON ¶
func (v *RequestPermissionRequest) UnmarshalJSON(b []byte) error
func (*RequestPermissionRequest) Validate ¶
func (v *RequestPermissionRequest) Validate() error
type RequestPermissionResponse ¶
type RequestPermissionResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The user's decision on the permission request.
Outcome RequestPermissionOutcome `json:"outcome"`
}
Response to a permission request.
func (*RequestPermissionResponse) UnmarshalJSON ¶
func (v *RequestPermissionResponse) UnmarshalJSON(b []byte) error
func (*RequestPermissionResponse) Validate ¶
func (v *RequestPermissionResponse) Validate() error
type RequestSubmissionState ¶ added in v1.1.0
type RequestSubmissionState uint8
RequestSubmissionState is the strongest transport-level statement the SDK can make about an outbound request. It does not describe application commit or prove that the peer executed the request.
const ( // RequestSubmissionNotStarted proves that the transport writer was never // invoked and can no longer be invoked for this request. RequestSubmissionNotStarted RequestSubmissionState = iota // RequestSubmissionPossible means the transport writer was invoked. This // remains true for zero-byte, partial, failed, or blocked writes. RequestSubmissionPossible // RequestSubmissionPending means the writer has not been observed starting, // but the prepared request is still live or racing with Dispatch. It is not // safe to infer that the request cannot subsequently be submitted. RequestSubmissionPending )
func RequestSubmissionStateOf ¶ added in v1.1.0
func RequestSubmissionStateOf(err error) (state RequestSubmissionState, ok bool)
RequestSubmissionStateOf extracts an SDK submission classification through ordinary error wrapping. ok is false for errors not produced by the prepared request lifecycle; callers must not treat an unclassified error as safe to retry.
func (RequestSubmissionState) String ¶ added in v1.1.0
func (s RequestSubmissionState) String() string
type ResourceLink ¶
type ResourceLink struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional annotations that help clients decide how to display or route this content.
Annotations *Annotations `json:"annotations,omitempty"`
// Optional human-readable details shown with this protocol object.
Description *string `json:"description,omitempty"`
// MIME type describing the encoded media payload.
MimeType *string `json:"mimeType,omitempty"`
// Human-readable name shown for this protocol object.
Name string `json:"name"`
// Optional size of the linked resource in bytes, if known.
Size *int64 `json:"size,omitempty"`
// Optional display title for end-user UI.
Title *string `json:"title,omitempty"`
// URI associated with this resource or media payload.
Uri string `json:"uri"`
}
A resource that the server is capable of reading, included in a prompt or tool call result.
func (*ResourceLink) UnmarshalJSON ¶
func (v *ResourceLink) UnmarshalJSON(b []byte) error
type ResponseDecodeError ¶ added in v1.1.0
type ResponseDecodeError struct {
Err error
}
ResponseDecodeError reports that a successful JSON-RPC response arrived but its result could not be decoded into the requested Go type. The request must not be automatically retried.
func (*ResponseDecodeError) Error ¶ added in v1.1.0
func (e *ResponseDecodeError) Error() string
func (*ResponseDecodeError) Unwrap ¶ added in v1.1.0
func (e *ResponseDecodeError) Unwrap() error
type ResponseObserver ¶ added in v1.1.0
type ResponseObserver func(context.Context, RPCResponse) error
ResponseObserver runs once after all earlier notifications complete and before typed decoding or Wait completion. It must not wait for work that depends on a later notification from the same connection.
type ResumeSessionRequest ¶
type ResumeSessionRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Additional workspace roots to activate for this session. Each path must be absolute.
//
// When omitted or empty, no additional roots are activated. When non-empty,
// this is the complete resulting additional-root list for the resumed
// session. It may differ from any previously used or reported list as long as
// the request 'cwd' matches the session's 'cwd'.
AdditionalDirectories []string `json:"additionalDirectories,omitempty"`
// The working directory for this session. Must be an absolute path.
Cwd string `json:"cwd"`
// List of MCP servers to connect to for this session.
McpServers []McpServer `json:"mcpServers,omitempty"`
// The ID of the session to resume.
SessionId SessionId `json:"sessionId"`
}
Request parameters for resuming an existing session.
Resumes an existing session without returning previous messages (unlike 'session/load'). This is useful for agents that can resume sessions but don't implement full session loading.
Only available if the Agent supports the 'sessionCapabilities.resume' capability.
func (*ResumeSessionRequest) UnmarshalJSON ¶
func (v *ResumeSessionRequest) UnmarshalJSON(b []byte) error
func (*ResumeSessionRequest) Validate ¶
func (v *ResumeSessionRequest) Validate() error
type ResumeSessionResponse ¶
type ResumeSessionResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Initial session configuration options if supported by the Agent.
ConfigOptions []SessionConfigOption `json:"configOptions,omitempty"`
// Initial mode state if supported by the Agent
//
// See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/v1/session-modes)
Modes *SessionModeState `json:"modes,omitempty"`
}
Response from resuming an existing session.
func (*ResumeSessionResponse) Validate ¶
func (v *ResumeSessionResponse) Validate() error
type SelectedPermissionOutcome ¶
type SelectedPermissionOutcome struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The ID of the option the user selected.
OptionId PermissionOptionId `json:"optionId"`
}
The user selected one of the provided options.
func (*SelectedPermissionOutcome) UnmarshalJSON ¶
func (v *SelectedPermissionOutcome) UnmarshalJSON(b []byte) error
type SessionAdditionalDirectoriesCapabilities ¶
type SessionAdditionalDirectoriesCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Capabilities for additional session directories support.
Supplying '{}' means the agent supports the 'additionalDirectories' field on supported session lifecycle requests. Agents that also support 'session/list' may return 'SessionInfo.additionalDirectories' to report the complete ordered additional-root list associated with a listed session.
type SessionAvailableCommandsUpdate ¶
type SessionAvailableCommandsUpdate struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Commands the agent can execute
AvailableCommands []AvailableCommand `json:"availableCommands"`
SessionUpdate string `json:"sessionUpdate"`
}
Available commands are ready or have changed
type SessionCapabilities ¶
type SessionCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Whether the agent supports 'additionalDirectories' on supported session lifecycle requests.
//
// Optional. Omitted or 'null' both mean the agent does not advertise support.
// Supplying '{}' means the agent supports 'additionalDirectories' on
// supported session lifecycle requests.
//
// Agents that also support 'session/list' may return
// 'SessionInfo.additionalDirectories' to report the complete ordered
// additional-root list associated with a listed session.
AdditionalDirectories *SessionAdditionalDirectoriesCapabilities `json:"additionalDirectories,omitempty"`
// Whether the agent supports 'session/close'.
//
// Optional. Omitted or 'null' both mean the agent does not advertise support.
// Supplying '{}' means the agent supports closing sessions.
Close *SessionCloseCapabilities `json:"close,omitempty"`
// Whether the agent supports 'session/delete'.
//
// Optional. Omitted or 'null' both mean the agent does not advertise support.
// Supplying '{}' means the agent supports deleting sessions from 'session/list'.
Delete *SessionDeleteCapabilities `json:"delete,omitempty"`
// Whether the agent supports 'session/list'.
//
// Optional. Omitted or 'null' both mean the agent does not advertise support.
// Supplying '{}' means the agent supports listing sessions.
List *SessionListCapabilities `json:"list,omitempty"`
// Whether the agent supports 'session/resume'.
//
// Optional. Omitted or 'null' both mean the agent does not advertise support.
// Supplying '{}' means the agent supports resuming sessions.
Resume *SessionResumeCapabilities `json:"resume,omitempty"`
}
Session capabilities supported by the agent.
As a baseline, all Agents **MUST** support 'session/new', 'session/prompt', 'session/cancel', and 'session/update'.
Optionally, they **MAY** support other session methods and notifications by specifying additional capabilities.
Note: 'session/load' is still handled by the top-level 'loadSession' capability. This will be unified in future versions of the protocol.
See protocol docs: [Session Capabilities](https://agentclientprotocol.com/protocol/v1/initialization#session-capabilities)
type SessionCloseCapabilities ¶
type SessionCloseCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Capabilities for the 'session/close' method.
Supplying '{}' means the agent supports closing sessions.
type SessionCompactionUpdate ¶ added in v1.5.0
type SessionCompactionUpdate struct {
// Extensible metadata patch for this compaction.
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The Agent-owned ID of this compaction, unique within the session.
CompactionId CompactionId `json:"compactionId"`
// Human-readable error details for the compaction.
Error *string `json:"error,omitempty"`
SessionUpdate string `json:"sessionUpdate"`
// Current lifecycle status.
Status CompactionStatus `json:"status"`
// Complete replacement user-displayable summary content for the compaction.
Summary []ContentBlock `json:"summary,omitempty"`
// contains filtered or unexported fields
}
A context compaction has been created or updated.
Agents MUST only send this update when the Client advertised the 'session.compaction' Client capability.
func (*SessionCompactionUpdate) ClearError ¶ added in v1.5.0
func (v *SessionCompactionUpdate) ClearError()
func (*SessionCompactionUpdate) ClearMeta ¶ added in v1.5.0
func (v *SessionCompactionUpdate) ClearMeta()
func (*SessionCompactionUpdate) ClearSummary ¶ added in v1.5.0
func (v *SessionCompactionUpdate) ClearSummary()
func (SessionCompactionUpdate) ErrorState ¶ added in v1.5.0
func (v SessionCompactionUpdate) ErrorState() NullableFieldState
func (SessionCompactionUpdate) MarshalJSON ¶ added in v1.5.0
func (v SessionCompactionUpdate) MarshalJSON() ([]byte, error)
func (SessionCompactionUpdate) MetaState ¶ added in v1.5.0
func (v SessionCompactionUpdate) MetaState() NullableFieldState
func (*SessionCompactionUpdate) SetError ¶ added in v1.5.0
func (v *SessionCompactionUpdate) SetError(value string)
func (*SessionCompactionUpdate) SetMeta ¶ added in v1.5.0
func (v *SessionCompactionUpdate) SetMeta(value map[string]json.RawMessage)
func (*SessionCompactionUpdate) SetSummary ¶ added in v1.5.0
func (v *SessionCompactionUpdate) SetSummary(value []ContentBlock)
func (SessionCompactionUpdate) SummaryState ¶ added in v1.5.0
func (v SessionCompactionUpdate) SummaryState() NullableFieldState
func (*SessionCompactionUpdate) UnmarshalJSON ¶ added in v1.5.0
func (v *SessionCompactionUpdate) UnmarshalJSON(b []byte) error
func (*SessionCompactionUpdate) UnsetError ¶ added in v1.5.0
func (v *SessionCompactionUpdate) UnsetError()
func (*SessionCompactionUpdate) UnsetMeta ¶ added in v1.5.0
func (v *SessionCompactionUpdate) UnsetMeta()
func (*SessionCompactionUpdate) UnsetSummary ¶ added in v1.5.0
func (v *SessionCompactionUpdate) UnsetSummary()
type SessionConfigBoolean ¶
type SessionConfigBoolean struct {
// The current value of the boolean option.
CurrentValue bool `json:"currentValue"`
}
A boolean on/off toggle session configuration option payload.
func (*SessionConfigBoolean) UnmarshalJSON ¶
func (v *SessionConfigBoolean) UnmarshalJSON(b []byte) error
type SessionConfigGroupId ¶
type SessionConfigGroupId string
Unique identifier for a session configuration option value group.
type SessionConfigId ¶
type SessionConfigId string
Unique identifier for a session configuration option.
type SessionConfigOption ¶
type SessionConfigOption struct {
// Single-value selector (dropdown).
Select *SessionConfigOptionSelect `json:"-"`
// Boolean on/off toggle.
Boolean *SessionConfigOptionBoolean `json:"-"`
}
func NewSessionConfigOptionBoolean ¶
func NewSessionConfigOptionBoolean(currentValue bool) SessionConfigOption
NewSessionConfigOptionBoolean constructs a SessionConfigOption using the 'boolean' variant.
func NewSessionConfigOptionSelect ¶
func NewSessionConfigOptionSelect(currentValue SessionConfigValueId, options SessionConfigSelectOptions) SessionConfigOption
NewSessionConfigOptionSelect constructs a SessionConfigOption using the 'select' variant.
func (SessionConfigOption) MarshalJSON ¶
func (u SessionConfigOption) MarshalJSON() ([]byte, error)
func (*SessionConfigOption) UnmarshalJSON ¶
func (u *SessionConfigOption) UnmarshalJSON(b []byte) error
func (*SessionConfigOption) Validate ¶
func (u *SessionConfigOption) Validate() error
type SessionConfigOptionBoolean ¶
type SessionConfigOptionBoolean struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional semantic category for this option (UX only).
Category *SessionConfigOptionCategory `json:"category,omitempty"`
// The current value of the boolean option.
CurrentValue bool `json:"currentValue"`
// Optional description for the Client to display to the user.
Description *string `json:"description,omitempty"`
// Unique identifier for the configuration option.
Id SessionConfigId `json:"id"`
// Human-readable label for the option.
Name string `json:"name"`
Type string `json:"type"`
}
Boolean on/off toggle.
type SessionConfigOptionCategory ¶
type SessionConfigOptionCategory string
Semantic category for a session configuration option.
This is intended to help Clients distinguish broadly common selectors (e.g. model selector vs session mode selector vs thought/reasoning level) for UX purposes (keyboard shortcuts, icons, placement). It MUST NOT be required for correctness. Clients MUST handle missing or unknown categories gracefully.
Category names beginning with '_' are free for custom use, like other ACP extension methods. Category names that do not begin with '_' are reserved for the ACP spec.
const ( SessionConfigOptionCategoryMode SessionConfigOptionCategory = "mode" SessionConfigOptionCategoryModel SessionConfigOptionCategory = "model" SessionConfigOptionCategoryModelConfig SessionConfigOptionCategory = "model_config" SessionConfigOptionCategoryThoughtLevel SessionConfigOptionCategory = "thought_level" )
type SessionConfigOptionSelect ¶
type SessionConfigOptionSelect struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional semantic category for this option (UX only).
Category *SessionConfigOptionCategory `json:"category,omitempty"`
// The currently selected value.
CurrentValue SessionConfigValueId `json:"currentValue"`
// Optional description for the Client to display to the user.
Description *string `json:"description,omitempty"`
// Unique identifier for the configuration option.
Id SessionConfigId `json:"id"`
// Human-readable label for the option.
Name string `json:"name"`
// The set of selectable options.
Options SessionConfigSelectOptions `json:"options"`
Type string `json:"type"`
}
A session configuration option selector and its current state. Single-value selector (dropdown).
type SessionConfigOptionUpdate ¶
type SessionConfigOptionUpdate struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The full set of configuration options and their current values.
ConfigOptions []SessionConfigOption `json:"configOptions"`
SessionUpdate string `json:"sessionUpdate"`
}
Session configuration options have been updated.
type SessionConfigOptionsCapabilities ¶
type SessionConfigOptionsCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Whether the client supports boolean session configuration options.
//
// Optional. Omitted or 'null' both mean the client does not advertise support.
// Supplying '{}' means agents may include 'type: "boolean"' entries in
// 'configOptions', and the client may send 'session/set_config_option'
// requests with 'type: "boolean"' and a boolean 'value'.
Boolean *BooleanConfigOptionCapabilities `json:"boolean,omitempty"`
}
Session configuration option capabilities supported by the client.
type SessionConfigSelect ¶
type SessionConfigSelect struct {
// The currently selected value.
CurrentValue SessionConfigValueId `json:"currentValue"`
// The set of selectable options.
Options SessionConfigSelectOptions `json:"options"`
}
A single-value selector (dropdown) session configuration option payload.
func (*SessionConfigSelect) UnmarshalJSON ¶
func (v *SessionConfigSelect) UnmarshalJSON(b []byte) error
type SessionConfigSelectGroup ¶
type SessionConfigSelectGroup struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Unique identifier for this group.
Group SessionConfigGroupId `json:"group"`
// Human-readable label for this group.
Name string `json:"name"`
// The set of option values in this group.
Options []SessionConfigSelectOption `json:"options"`
}
A group of possible values for a session configuration option.
func (*SessionConfigSelectGroup) UnmarshalJSON ¶
func (v *SessionConfigSelectGroup) UnmarshalJSON(b []byte) error
type SessionConfigSelectOption ¶
type SessionConfigSelectOption struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional description for this option value.
Description *string `json:"description,omitempty"`
// Human-readable label for this option value.
Name string `json:"name"`
// Unique identifier for this option value.
Value SessionConfigValueId `json:"value"`
}
A possible value for a session configuration option.
func (*SessionConfigSelectOption) UnmarshalJSON ¶
func (v *SessionConfigSelectOption) UnmarshalJSON(b []byte) error
type SessionConfigSelectOptions ¶
type SessionConfigSelectOptions struct {
// A flat list of options with no grouping.
Ungrouped *SessionConfigSelectOptionsUngrouped `json:"-"`
// A list of options grouped under headers.
Grouped *SessionConfigSelectOptionsGrouped `json:"-"`
}
func (SessionConfigSelectOptions) MarshalJSON ¶
func (u SessionConfigSelectOptions) MarshalJSON() ([]byte, error)
func (*SessionConfigSelectOptions) UnmarshalJSON ¶
func (u *SessionConfigSelectOptions) UnmarshalJSON(b []byte) error
func (*SessionConfigSelectOptions) Validate ¶
func (u *SessionConfigSelectOptions) Validate() error
type SessionConfigSelectOptionsGrouped ¶
type SessionConfigSelectOptionsGrouped []SessionConfigSelectGroup
A list of options grouped under headers.
type SessionConfigSelectOptionsUngrouped ¶
type SessionConfigSelectOptionsUngrouped []SessionConfigSelectOption
Possible values for a session configuration option. A flat list of options with no grouping.
type SessionConfigValueId ¶
type SessionConfigValueId string
Unique identifier for a session configuration option value.
type SessionCurrentModeUpdate ¶
type SessionCurrentModeUpdate struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The ID of the current mode
CurrentModeId SessionModeId `json:"currentModeId"`
SessionUpdate string `json:"sessionUpdate"`
}
The current mode of the session has changed
See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/v1/session-modes)
type SessionDeleteCapabilities ¶
type SessionDeleteCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Capabilities for the 'session/delete' method.
Supplying '{}' means the agent supports deleting sessions from 'session/list'.
type SessionId ¶
type SessionId string
A unique identifier for a conversation session between a client and agent.
Sessions maintain their own context, conversation history, and state, allowing multiple independent interactions with the same agent.
See protocol docs: [Session ID](https://agentclientprotocol.com/protocol/v1/session-setup#session-id)
type SessionInfo ¶
type SessionInfo struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Additional workspace roots reported for this session. Each path must be absolute.
//
// When present, this is the complete ordered additional-root list reported
// by the Agent. Omitted and empty values are equivalent: the response
// reports no additional roots.
AdditionalDirectories []string `json:"additionalDirectories,omitempty"`
// The working directory for this session. Must be an absolute path.
Cwd string `json:"cwd"`
// Unique identifier for the session
SessionId SessionId `json:"sessionId"`
// Human-readable title for the session
Title *string `json:"title,omitempty"`
// ISO 8601 timestamp of last activity
UpdatedAt *string `json:"updatedAt,omitempty"`
}
Information about a session returned by session/list
func (*SessionInfo) UnmarshalJSON ¶
func (v *SessionInfo) UnmarshalJSON(b []byte) error
type SessionInfoUpdate ¶
type SessionInfoUpdate struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Human-readable title for the session. Set to null to clear.
Title *string `json:"title,omitempty"`
// ISO 8601 timestamp of last activity. Set to null to clear.
UpdatedAt *string `json:"updatedAt,omitempty"`
// contains filtered or unexported fields
}
Update to session metadata. All fields are optional to support partial updates.
Agents send this notification to update session information like title or custom metadata. This allows clients to display dynamic session names and track session state changes.
func (*SessionInfoUpdate) ClearTitle ¶ added in v1.1.0
func (v *SessionInfoUpdate) ClearTitle()
func (*SessionInfoUpdate) ClearUpdatedAt ¶ added in v1.1.0
func (v *SessionInfoUpdate) ClearUpdatedAt()
func (SessionInfoUpdate) MarshalJSON ¶ added in v1.1.0
func (v SessionInfoUpdate) MarshalJSON() ([]byte, error)
func (*SessionInfoUpdate) SetTitle ¶ added in v1.1.0
func (v *SessionInfoUpdate) SetTitle(value string)
func (*SessionInfoUpdate) SetUpdatedAt ¶ added in v1.1.0
func (v *SessionInfoUpdate) SetUpdatedAt(value string)
func (SessionInfoUpdate) TitleState ¶ added in v1.1.0
func (v SessionInfoUpdate) TitleState() NullableFieldState
func (*SessionInfoUpdate) UnmarshalJSON ¶ added in v1.1.0
func (v *SessionInfoUpdate) UnmarshalJSON(b []byte) error
func (*SessionInfoUpdate) UnsetTitle ¶ added in v1.1.0
func (v *SessionInfoUpdate) UnsetTitle()
func (*SessionInfoUpdate) UnsetUpdatedAt ¶ added in v1.1.0
func (v *SessionInfoUpdate) UnsetUpdatedAt()
func (SessionInfoUpdate) UpdatedAtState ¶ added in v1.1.0
func (v SessionInfoUpdate) UpdatedAtState() NullableFieldState
type SessionListCapabilities ¶
type SessionListCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Capabilities for the 'session/list' method.
Supplying '{}' means the agent supports listing sessions.
type SessionMode ¶
type SessionMode struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional human-readable details shown with this protocol object.
Description *string `json:"description,omitempty"`
// Stable identifier used to refer to this protocol object in later messages.
Id SessionModeId `json:"id"`
// Human-readable name shown for this protocol object.
Name string `json:"name"`
}
A mode the agent can operate in.
See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/v1/session-modes)
func (*SessionMode) UnmarshalJSON ¶
func (v *SessionMode) UnmarshalJSON(b []byte) error
type SessionModeState ¶
type SessionModeState struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The set of modes that the Agent can operate in
AvailableModes []SessionMode `json:"availableModes"`
// The current mode the Agent is in.
CurrentModeId SessionModeId `json:"currentModeId"`
}
The set of modes and the one currently active.
func (*SessionModeState) UnmarshalJSON ¶
func (v *SessionModeState) UnmarshalJSON(b []byte) error
type SessionNotification ¶
type SessionNotification struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The ID of the session this update pertains to.
SessionId SessionId `json:"sessionId"`
// The actual update content.
Update SessionUpdate `json:"update"`
}
Notification containing a session update from the agent.
Used to stream real-time progress and results during prompt processing.
See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/v1/prompt-turn#3-agent-reports-output)
func (*SessionNotification) UnmarshalJSON ¶
func (v *SessionNotification) UnmarshalJSON(b []byte) error
func (*SessionNotification) Validate ¶
func (v *SessionNotification) Validate() error
type SessionResumeCapabilities ¶
type SessionResumeCapabilities struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Capabilities for the 'session/resume' method.
Supplying '{}' means the agent supports resuming sessions.
type SessionSessionInfoUpdate ¶
type SessionSessionInfoUpdate struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
SessionUpdate string `json:"sessionUpdate"`
// Human-readable title for the session. Set to null to clear.
Title *string `json:"title,omitempty"`
// ISO 8601 timestamp of last activity. Set to null to clear.
UpdatedAt *string `json:"updatedAt,omitempty"`
// contains filtered or unexported fields
}
Session metadata has been updated (title, timestamps, custom metadata)
func (*SessionSessionInfoUpdate) ClearTitle ¶ added in v1.1.0
func (v *SessionSessionInfoUpdate) ClearTitle()
func (*SessionSessionInfoUpdate) ClearUpdatedAt ¶ added in v1.1.0
func (v *SessionSessionInfoUpdate) ClearUpdatedAt()
func (SessionSessionInfoUpdate) MarshalJSON ¶ added in v1.1.0
func (v SessionSessionInfoUpdate) MarshalJSON() ([]byte, error)
func (*SessionSessionInfoUpdate) SetTitle ¶ added in v1.1.0
func (v *SessionSessionInfoUpdate) SetTitle(value string)
func (*SessionSessionInfoUpdate) SetUpdatedAt ¶ added in v1.1.0
func (v *SessionSessionInfoUpdate) SetUpdatedAt(value string)
func (SessionSessionInfoUpdate) TitleState ¶ added in v1.1.0
func (v SessionSessionInfoUpdate) TitleState() NullableFieldState
func (*SessionSessionInfoUpdate) UnmarshalJSON ¶ added in v1.1.0
func (v *SessionSessionInfoUpdate) UnmarshalJSON(b []byte) error
func (*SessionSessionInfoUpdate) UnsetTitle ¶ added in v1.1.0
func (v *SessionSessionInfoUpdate) UnsetTitle()
func (*SessionSessionInfoUpdate) UnsetUpdatedAt ¶ added in v1.1.0
func (v *SessionSessionInfoUpdate) UnsetUpdatedAt()
func (SessionSessionInfoUpdate) UpdatedAtState ¶ added in v1.1.0
func (v SessionSessionInfoUpdate) UpdatedAtState() NullableFieldState
type SessionToolCallUpdate ¶
type SessionToolCallUpdate struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Replace the content collection.
Content []ToolCallContent `json:"content,omitempty"`
// Update the tool kind.
Kind *ToolKind `json:"kind,omitempty"`
// Replace the locations collection.
Locations []ToolCallLocation `json:"locations,omitempty"`
// Update the programmatic name of the tool being invoked.
//
// This field is optional. Omitting it or sending 'null' both mean that
// the existing name is left unchanged.
Name *string `json:"name,omitempty"`
// Update the raw input.
RawInput any `json:"rawInput,omitempty"`
// Update the raw output.
RawOutput any `json:"rawOutput,omitempty"`
SessionUpdate string `json:"sessionUpdate"`
// Update the execution status.
Status *ToolCallStatus `json:"status,omitempty"`
// Update the human-readable title.
Title *string `json:"title,omitempty"`
// The ID of the tool call being updated.
ToolCallId ToolCallId `json:"toolCallId"`
}
Update on the status or results of a tool call.
type SessionUpdate ¶
type SessionUpdate struct {
// A chunk of the user's message being streamed.
UserMessageChunk *SessionUpdateUserMessageChunk `json:"-"`
// A chunk of the agent's response being streamed.
AgentMessageChunk *SessionUpdateAgentMessageChunk `json:"-"`
// A chunk of the agent's internal reasoning being streamed.
AgentThoughtChunk *SessionUpdateAgentThoughtChunk `json:"-"`
// Notification that a new tool call has been initiated.
ToolCall *SessionUpdateToolCall `json:"-"`
// Update on the status or results of a tool call.
ToolCallUpdate *SessionToolCallUpdate `json:"-"`
// The agent's execution plan for complex tasks.
// See protocol docs: [Agent Plan](https://agentclientprotocol.com/protocol/v1/agent-plan)
Plan *SessionUpdatePlan `json:"-"`
// Available commands are ready or have changed
AvailableCommandsUpdate *SessionAvailableCommandsUpdate `json:"-"`
// The current mode of the session has changed
//
// See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/v1/session-modes)
CurrentModeUpdate *SessionCurrentModeUpdate `json:"-"`
// Session configuration options have been updated.
ConfigOptionUpdate *SessionConfigOptionUpdate `json:"-"`
// Session metadata has been updated (title, timestamps, custom metadata)
SessionInfoUpdate *SessionSessionInfoUpdate `json:"-"`
// Context window and cost update for the session.
UsageUpdate *SessionUsageUpdate `json:"-"`
// Information for the user that is not part of session history.
//
// Agents MUST only send this update when the Client advertised
// the 'session.notices' Client capability.
Notice *SessionUpdateNotice `json:"-"`
// A context compaction has been created or updated.
//
// Agents MUST only send this update when the Client advertised
// the 'session.compaction' Client capability.
CompactionUpdate *SessionCompactionUpdate `json:"-"`
// A content block appended to a context compaction's retained summary.
//
// Agents MUST only send this update when the Client advertised
// the 'session.compaction' Client capability.
CompactionSummaryChunk *SessionUpdateCompactionSummaryChunk `json:"-"`
}
func StartEditToolCall ¶
func StartEditToolCall(id ToolCallId, title string, path string, content any, opts ...ToolCallStartOpt) SessionUpdate
StartEditToolCall constructs a 'tool_call' update for editing content: kind=edit, status=pending, locations=[{path}], rawInput={path, content}.
func StartReadToolCall ¶
func StartReadToolCall(id ToolCallId, title string, path string, opts ...ToolCallStartOpt) SessionUpdate
StartReadToolCall constructs a 'tool_call' update for reading a file: kind=read, status=pending, locations=[{path}], rawInput={path}.
func StartToolCall ¶
func StartToolCall(id ToolCallId, title string, opts ...ToolCallStartOpt) SessionUpdate
StartToolCall constructs a tool_call update with required fields and applies optional modifiers.
func UpdateAgentMessage ¶
func UpdateAgentMessage(content ContentBlock) SessionUpdate
UpdateAgentMessage constructs an agent_message_chunk update with the given content.
func UpdateAgentMessageText ¶
func UpdateAgentMessageText(text string) SessionUpdate
UpdateAgentMessageText constructs an agent_message_chunk update from text.
func UpdateAgentThought ¶
func UpdateAgentThought(content ContentBlock) SessionUpdate
UpdateAgentThought constructs an agent_thought_chunk update with the given content.
func UpdateAgentThoughtText ¶
func UpdateAgentThoughtText(text string) SessionUpdate
UpdateAgentThoughtText constructs an agent_thought_chunk update from text.
func UpdatePlan ¶
func UpdatePlan(entries ...PlanEntry) SessionUpdate
UpdatePlan constructs a plan update with the provided entries.
func UpdateToolCall ¶
func UpdateToolCall(id ToolCallId, opts ...ToolCallUpdateOpt) SessionUpdate
UpdateToolCall constructs a tool_call_update with the given ID and applies optional modifiers.
func UpdateUserMessage ¶
func UpdateUserMessage(content ContentBlock) SessionUpdate
UpdateUserMessage constructs a user_message_chunk update with the given content.
func UpdateUserMessageText ¶
func UpdateUserMessageText(text string) SessionUpdate
UpdateUserMessageText constructs a user_message_chunk update from text.
func (SessionUpdate) MarshalJSON ¶
func (u SessionUpdate) MarshalJSON() ([]byte, error)
func (*SessionUpdate) UnmarshalJSON ¶
func (u *SessionUpdate) UnmarshalJSON(b []byte) error
func (*SessionUpdate) Validate ¶
func (u *SessionUpdate) Validate() error
type SessionUpdateAgentMessageChunk ¶
type SessionUpdateAgentMessageChunk struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// A single item of content
Content ContentBlock `json:"content"`
// A unique identifier for the message this chunk belongs to.
//
// All chunks belonging to the same message share the same 'messageId'.
// A change in 'messageId' indicates a new message has started.
MessageId *MessageId `json:"messageId,omitempty"`
SessionUpdate string `json:"sessionUpdate"`
}
A chunk of the agent's response being streamed.
type SessionUpdateAgentThoughtChunk ¶
type SessionUpdateAgentThoughtChunk struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// A single item of content
Content ContentBlock `json:"content"`
// A unique identifier for the message this chunk belongs to.
//
// All chunks belonging to the same message share the same 'messageId'.
// A change in 'messageId' indicates a new message has started.
MessageId *MessageId `json:"messageId,omitempty"`
SessionUpdate string `json:"sessionUpdate"`
}
A chunk of the agent's internal reasoning being streamed.
type SessionUpdateCompactionSummaryChunk ¶ added in v1.5.0
type SessionUpdateCompactionSummaryChunk struct {
// Metadata scoped to this chunk. Omission and 'null' both mean absent.
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// ID of the compaction whose summary receives this content.
CompactionId CompactionId `json:"compactionId"`
// One content block to append.
Content ContentBlock `json:"content"`
SessionUpdate string `json:"sessionUpdate"`
}
A content block appended to a context compaction's retained summary.
Agents MUST only send this update when the Client advertised the 'session.compaction' Client capability.
func (*SessionUpdateCompactionSummaryChunk) UnmarshalJSON ¶ added in v1.5.0
func (v *SessionUpdateCompactionSummaryChunk) UnmarshalJSON(b []byte) error
type SessionUpdateNotice ¶ added in v1.5.0
type SessionUpdateNotice struct {
// Metadata scoped to this notice.
//
// Omitted and 'null' are equivalent and mean no metadata was supplied.
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional plain-text detail or guidance.
//
// Omitted and 'null' are equivalent and mean no description was supplied.
Description *string `json:"description,omitempty"`
SessionUpdate string `json:"sessionUpdate"`
// Presentation severity hint.
Severity NoticeSeverity `json:"severity"`
// Required non-empty plain-text title that can stand alone.
Title string `json:"title"`
}
Information for the user that is not part of session history.
Agents MUST only send this update when the Client advertised the 'session.notices' Client capability.
func (*SessionUpdateNotice) UnmarshalJSON ¶ added in v1.5.0
func (v *SessionUpdateNotice) UnmarshalJSON(b []byte) error
type SessionUpdatePlan ¶
type SessionUpdatePlan struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The list of tasks to be accomplished.
//
// When updating a plan, the agent must send a complete list of all entries
// with their current status. The client replaces the entire plan with each update.
Entries []PlanEntry `json:"entries"`
SessionUpdate string `json:"sessionUpdate"`
}
The agent's execution plan for complex tasks. See protocol docs: [Agent Plan](https://agentclientprotocol.com/protocol/v1/agent-plan)
type SessionUpdateToolCall ¶
type SessionUpdateToolCall struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Content produced by the tool call.
Content []ToolCallContent `json:"content,omitempty"`
// The category of tool being invoked.
// Helps clients choose appropriate icons and UI treatment.
Kind ToolKind `json:"kind,omitempty"`
// File locations affected by this tool call.
// Enables "follow-along" features in clients.
Locations []ToolCallLocation `json:"locations,omitempty"`
// Programmatic name of the tool being invoked.
//
// This field is optional. Omitting it or sending 'null' both mean that no
// tool name is available.
Name *string `json:"name,omitempty"`
// Raw input parameters sent to the tool.
RawInput any `json:"rawInput,omitempty"`
// Raw output returned by the tool.
RawOutput any `json:"rawOutput,omitempty"`
SessionUpdate string `json:"sessionUpdate"`
// Current execution status of the tool call.
Status ToolCallStatus `json:"status,omitempty"`
// Human-readable title describing what the tool is doing.
Title string `json:"title"`
// Unique identifier for this tool call within the session.
ToolCallId ToolCallId `json:"toolCallId"`
}
Notification that a new tool call has been initiated.
type SessionUpdateUserMessageChunk ¶
type SessionUpdateUserMessageChunk struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// A single item of content
Content ContentBlock `json:"content"`
// A unique identifier for the message this chunk belongs to.
//
// All chunks belonging to the same message share the same 'messageId'.
// A change in 'messageId' indicates a new message has started.
MessageId *MessageId `json:"messageId,omitempty"`
SessionUpdate string `json:"sessionUpdate"`
}
Different types of updates that can be sent during session processing.
These updates provide real-time feedback about the agent's progress.
See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/v1/prompt-turn#3-agent-reports-output) A chunk of the user's message being streamed.
type SessionUsageUpdate ¶
type SessionUsageUpdate struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Cumulative session cost (optional).
Cost *Cost `json:"cost,omitempty"`
SessionUpdate string `json:"sessionUpdate"`
// Total context window size in tokens.
Size uint64 `json:"size"`
// Tokens currently in context.
Used uint64 `json:"used"`
}
Context window and cost update for the session.
type SetSessionConfigOptionBoolean ¶
type SetSessionConfigOptionBoolean struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The ID of the configuration option to set.
ConfigId SessionConfigId `json:"configId"`
// The ID of the session to set the configuration option for.
SessionId SessionId `json:"sessionId"`
Type string `json:"type"`
// The boolean value.
Value bool `json:"value"`
}
Request parameters for setting a session configuration option. A boolean value ('type: "boolean"').
type SetSessionConfigOptionRequest ¶
type SetSessionConfigOptionRequest struct {
// A boolean value ('type: "boolean"').
Boolean *SetSessionConfigOptionBoolean `json:"-"`
// A 'SessionConfigValueId' string value.
//
// This is the default when 'type' is absent on the wire. Unknown 'type'
// values with string payloads also gracefully deserialize into this
// variant.
ValueId *SetSessionConfigOptionValueId `json:"-"`
}
func (SetSessionConfigOptionRequest) MarshalJSON ¶
func (u SetSessionConfigOptionRequest) MarshalJSON() ([]byte, error)
func (*SetSessionConfigOptionRequest) UnmarshalJSON ¶
func (u *SetSessionConfigOptionRequest) UnmarshalJSON(b []byte) error
func (*SetSessionConfigOptionRequest) Validate ¶
func (u *SetSessionConfigOptionRequest) Validate() error
type SetSessionConfigOptionResponse ¶
type SetSessionConfigOptionResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The full set of configuration options and their current values.
ConfigOptions []SessionConfigOption `json:"configOptions"`
}
Response to 'session/set_config_option' method.
func (*SetSessionConfigOptionResponse) UnmarshalJSON ¶
func (v *SetSessionConfigOptionResponse) UnmarshalJSON(b []byte) error
func (*SetSessionConfigOptionResponse) Validate ¶
func (v *SetSessionConfigOptionResponse) Validate() error
type SetSessionConfigOptionValueId ¶
type SetSessionConfigOptionValueId struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The ID of the configuration option to set.
ConfigId SessionConfigId `json:"configId"`
// The ID of the session to set the configuration option for.
SessionId SessionId `json:"sessionId"`
// The value ID.
Value SessionConfigValueId `json:"value"`
}
A 'SessionConfigValueId' string value.
This is the default when 'type' is absent on the wire. Unknown 'type' values with string payloads also gracefully deserialize into this variant.
type SetSessionModeRequest ¶
type SetSessionModeRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The ID of the mode to set.
ModeId SessionModeId `json:"modeId"`
// The ID of the session to set the mode for.
SessionId SessionId `json:"sessionId"`
}
Request parameters for setting a session mode.
func (*SetSessionModeRequest) UnmarshalJSON ¶
func (v *SetSessionModeRequest) UnmarshalJSON(b []byte) error
func (*SetSessionModeRequest) Validate ¶
func (v *SetSessionModeRequest) Validate() error
type SetSessionModeResponse ¶
type SetSessionModeResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Response to 'session/set_mode' method.
func (*SetSessionModeResponse) Validate ¶
func (v *SetSessionModeResponse) Validate() error
type StopReason ¶
type StopReason string
Reasons why an agent stops processing a prompt turn.
See protocol docs: [Stop Reasons](https://agentclientprotocol.com/protocol/v1/prompt-turn#stop-reasons)
const ( StopReasonEndTurn StopReason = "end_turn" StopReasonMaxTokens StopReason = "max_tokens" StopReasonMaxTurnRequests StopReason = "max_turn_requests" StopReasonRefusal StopReason = "refusal" StopReasonCancelled StopReason = "cancelled" )
type StringFormat ¶
type StringFormat string
String format types for string properties in elicitation schemas.
const ( StringFormatEmail StringFormat = "email" StringFormatUri StringFormat = "uri" StringFormatDate StringFormat = "date" StringFormatDateTime StringFormat = "date-time" )
type StringMultiSelectItems ¶
type StringMultiSelectItems struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Allowed enum values.
Enum []string `json:"enum"`
}
String item schema for multi-select enum properties.
func (*StringMultiSelectItems) UnmarshalJSON ¶
func (v *StringMultiSelectItems) UnmarshalJSON(b []byte) error
type StringPropertySchema ¶
type StringPropertySchema struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Default value.
//
// Optional. Omitted and 'null' are equivalent and mean no default value is provided.
Default *string `json:"default,omitempty"`
// Human-readable description.
//
// Optional. Omitted and 'null' are equivalent and mean no description is provided.
Description *string `json:"description,omitempty"`
// Enum values for untitled single-select enums.
// Optional. Omitted and 'null' are equivalent and mean no untitled single-select choices are
// declared by 'enum'.
Enum []string `json:"enum,omitempty"`
// String format.
//
// Optional. Omitted and 'null' are equivalent and mean there is no format constraint.
Format *StringFormat `json:"format,omitempty"`
// Maximum string length.
//
// Optional. Omitted and 'null' are equivalent and mean there is no maximum length constraint.
MaxLength *uint32 `json:"maxLength,omitempty"`
// Minimum string length.
//
// Optional. Omitted and 'null' are equivalent and mean there is no minimum length constraint.
MinLength *uint32 `json:"minLength,omitempty"`
// Titled enum options for titled single-select enums.
// Optional. Omitted and 'null' are equivalent and mean no titled single-select choices are
// declared by 'oneOf'.
OneOf []EnumOption `json:"oneOf,omitempty"`
// Pattern the string must match.
//
// Optional. Omitted and 'null' are equivalent and mean there is no pattern constraint.
Pattern *string `json:"pattern,omitempty"`
// Optional title for the property.
//
// Optional. Omitted and 'null' are equivalent and mean no title is provided.
Title *string `json:"title,omitempty"`
}
Schema for string properties in an elicitation form.
When 'enum' or 'oneOf' is set, this represents a single-select enum with '"type": "string"'.
type Terminal ¶
type Terminal struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Identifier of the terminal instance to embed in the content stream.
TerminalId TerminalId `json:"terminalId"`
}
Embed a terminal created with 'terminal/create' by its id.
The terminal must be added before calling 'terminal/release'.
See protocol docs: Terminal(https://agentclientprotocol.com/protocol/v1/terminals)
func (*Terminal) UnmarshalJSON ¶
type TerminalExitStatus ¶
type TerminalExitStatus struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The process exit code (may be null if terminated by signal).
ExitCode *uint32 `json:"exitCode,omitempty"`
// The signal that terminated the process (may be null if exited normally).
Signal *string `json:"signal,omitempty"`
}
Exit status of a terminal command.
type TerminalOutputRequest ¶
type TerminalOutputRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The session ID for this request.
SessionId SessionId `json:"sessionId"`
// The ID of the terminal to get output from.
TerminalId TerminalId `json:"terminalId"`
}
Request to get the current output and status of a terminal.
func (*TerminalOutputRequest) UnmarshalJSON ¶
func (v *TerminalOutputRequest) UnmarshalJSON(b []byte) error
func (*TerminalOutputRequest) Validate ¶
func (v *TerminalOutputRequest) Validate() error
type TerminalOutputResponse ¶
type TerminalOutputResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Exit status if the command has completed.
ExitStatus *TerminalExitStatus `json:"exitStatus,omitempty"`
// The terminal output captured so far.
Output string `json:"output"`
// Whether the output was truncated due to byte limits.
Truncated bool `json:"truncated"`
}
Response containing the terminal output and exit status.
func (*TerminalOutputResponse) UnmarshalJSON ¶
func (v *TerminalOutputResponse) UnmarshalJSON(b []byte) error
func (*TerminalOutputResponse) Validate ¶
func (v *TerminalOutputResponse) Validate() error
type TextContent ¶
type TextContent struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional annotations that help clients decide how to display or route this content.
Annotations *Annotations `json:"annotations,omitempty"`
// Text payload carried by this content block.
Text string `json:"text"`
}
Text provided to or from an LLM.
func (*TextContent) UnmarshalJSON ¶
func (v *TextContent) UnmarshalJSON(b []byte) error
type TextResourceContents ¶
type TextResourceContents struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// MIME type describing the encoded media payload.
MimeType *string `json:"mimeType,omitempty"`
// Text payload carried by this content block.
Text string `json:"text"`
// URI associated with this resource or media payload.
Uri string `json:"uri"`
}
Text-based resource contents.
func (*TextResourceContents) UnmarshalJSON ¶
func (v *TextResourceContents) UnmarshalJSON(b []byte) error
type TitledMultiSelectItems ¶
type TitledMultiSelectItems struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// Optional. Omitted and 'null' are equivalent and mean no metadata.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Titled enum options.
AnyOf []EnumOption `json:"anyOf"`
}
Items definition for titled multi-select enum properties.
func (*TitledMultiSelectItems) UnmarshalJSON ¶
func (v *TitledMultiSelectItems) UnmarshalJSON(b []byte) error
type ToolCall ¶
type ToolCall struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Content produced by the tool call.
Content []ToolCallContent `json:"content,omitempty"`
// The category of tool being invoked.
// Helps clients choose appropriate icons and UI treatment.
Kind ToolKind `json:"kind,omitempty"`
// File locations affected by this tool call.
// Enables "follow-along" features in clients.
Locations []ToolCallLocation `json:"locations,omitempty"`
// Programmatic name of the tool being invoked.
//
// This field is optional. Omitting it or sending 'null' both mean that no
// tool name is available.
Name *string `json:"name,omitempty"`
// Raw input parameters sent to the tool.
RawInput any `json:"rawInput,omitempty"`
// Raw output returned by the tool.
RawOutput any `json:"rawOutput,omitempty"`
// Current execution status of the tool call.
Status ToolCallStatus `json:"status,omitempty"`
// Human-readable title describing what the tool is doing.
Title string `json:"title"`
// Unique identifier for this tool call within the session.
ToolCallId ToolCallId `json:"toolCallId"`
}
Represents a tool call that the language model has requested.
Tool calls are actions that the agent executes on behalf of the language model, such as reading files, executing code, or fetching data from external sources.
See protocol docs: [Tool Calls](https://agentclientprotocol.com/protocol/v1/tool-calls)
func (*ToolCall) UnmarshalJSON ¶
type ToolCallContent ¶
type ToolCallContent struct {
// Standard content block (text, images, resources).
Content *ToolCallContentContent `json:"-"`
// File modification shown as a diff.
Diff *ToolCallContentDiff `json:"-"`
// Embed a terminal created with 'terminal/create' by its id.
//
// The terminal must be added before calling 'terminal/release'.
//
// See protocol docs: [Terminal](https://agentclientprotocol.com/protocol/v1/terminals)
Terminal *ToolCallContentTerminal `json:"-"`
}
func ToolContent ¶
func ToolContent(block ContentBlock) ToolCallContent
ToolContent wraps a content block as tool-call content.
func ToolDiffContent ¶
func ToolDiffContent(path string, newText string, oldText ...string) ToolCallContent
ToolDiffContent constructs a diff tool-call content. If oldText is omitted, the field is left empty.
func ToolTerminalRef ¶
func ToolTerminalRef(terminalID string) ToolCallContent
ToolTerminalRef constructs a terminal reference tool-call content.
func (ToolCallContent) MarshalJSON ¶
func (u ToolCallContent) MarshalJSON() ([]byte, error)
func (*ToolCallContent) UnmarshalJSON ¶
func (u *ToolCallContent) UnmarshalJSON(b []byte) error
func (*ToolCallContent) Validate ¶
func (u *ToolCallContent) Validate() error
type ToolCallContentContent ¶
type ToolCallContentContent struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The actual content block.
Content ContentBlock `json:"content"`
Type string `json:"type"`
}
Content produced by a tool call.
Tool calls can produce different types of content including standard content blocks (text, images) or file diffs.
See protocol docs: Content(https://agentclientprotocol.com/protocol/v1/tool-calls#content) Standard content block (text, images, resources).
type ToolCallContentDiff ¶
type ToolCallContentDiff struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The new content after modification.
NewText string `json:"newText"`
// The original content (omitted or 'null' for new files).
OldText *string `json:"oldText,omitempty"`
// The absolute file path being modified.
Path string `json:"path"`
Type string `json:"type"`
}
File modification shown as a diff.
type ToolCallContentTerminal ¶
type ToolCallContentTerminal struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Identifier of the terminal instance to embed in the content stream.
TerminalId TerminalId `json:"terminalId"`
Type string `json:"type"`
}
Embed a terminal created with 'terminal/create' by its id.
The terminal must be added before calling 'terminal/release'.
See protocol docs: Terminal(https://agentclientprotocol.com/protocol/v1/terminals)
type ToolCallLocation ¶
type ToolCallLocation struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Optional 1-based line number within the file.
Line *uint32 `json:"line,omitempty"`
// The absolute file path being accessed or modified.
Path string `json:"path"`
}
A file location being accessed or modified by a tool.
Enables clients to implement "follow-along" features that track which files the agent is working with in real-time.
See protocol docs: [Following the Agent](https://agentclientprotocol.com/protocol/v1/tool-calls#following-the-agent)
func (*ToolCallLocation) UnmarshalJSON ¶
func (v *ToolCallLocation) UnmarshalJSON(b []byte) error
type ToolCallStartOpt ¶
type ToolCallStartOpt func(tc *SessionUpdateToolCall)
func WithStartContent ¶
func WithStartContent(c []ToolCallContent) ToolCallStartOpt
WithStartContent sets the initial content for a tool_call start update.
func WithStartKind ¶
func WithStartKind(k ToolKind) ToolCallStartOpt
WithStartKind sets the kind for a tool_call start update.
func WithStartLocations ¶
func WithStartLocations(l []ToolCallLocation) ToolCallStartOpt
WithStartLocations sets file locations and, if a single path is provided and rawInput is empty, mirrors it as rawInput.path.
func WithStartName ¶ added in v1.4.0
func WithStartName(name string) ToolCallStartOpt
WithStartName sets the programmatic tool name for a tool_call start update.
func WithStartRawInput ¶
func WithStartRawInput(v any) ToolCallStartOpt
WithStartRawInput sets rawInput for a tool_call start update.
func WithStartRawOutput ¶
func WithStartRawOutput(v any) ToolCallStartOpt
WithStartRawOutput sets rawOutput for a tool_call start update.
func WithStartStatus ¶
func WithStartStatus(s ToolCallStatus) ToolCallStartOpt
WithStartStatus sets the status for a tool_call start update.
type ToolCallStatus ¶
type ToolCallStatus string
Execution status of a tool call.
Tool calls progress through different statuses during their lifecycle.
See protocol docs: [Status](https://agentclientprotocol.com/protocol/v1/tool-calls#status)
const ( ToolCallStatusPending ToolCallStatus = "pending" ToolCallStatusInProgress ToolCallStatus = "in_progress" ToolCallStatusCompleted ToolCallStatus = "completed" ToolCallStatusFailed ToolCallStatus = "failed" )
type ToolCallUpdate ¶
type ToolCallUpdate struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Replace the content collection.
Content []ToolCallContent `json:"content,omitempty"`
// Update the tool kind.
Kind *ToolKind `json:"kind,omitempty"`
// Replace the locations collection.
Locations []ToolCallLocation `json:"locations,omitempty"`
// Update the programmatic name of the tool being invoked.
//
// This field is optional. Omitting it or sending 'null' both mean that
// the existing name is left unchanged.
Name *string `json:"name,omitempty"`
// Update the raw input.
RawInput any `json:"rawInput,omitempty"`
// Update the raw output.
RawOutput any `json:"rawOutput,omitempty"`
// Update the execution status.
Status *ToolCallStatus `json:"status,omitempty"`
// Update the human-readable title.
Title *string `json:"title,omitempty"`
// The ID of the tool call being updated.
ToolCallId ToolCallId `json:"toolCallId"`
}
An update to an existing tool call.
Used to report progress and results as tools execute. All fields except the tool call ID are optional - only changed fields need to be included.
See protocol docs: [Updating](https://agentclientprotocol.com/protocol/v1/tool-calls#updating)
func (*ToolCallUpdate) UnmarshalJSON ¶
func (v *ToolCallUpdate) UnmarshalJSON(b []byte) error
func (*ToolCallUpdate) Validate ¶
func (v *ToolCallUpdate) Validate() error
type ToolCallUpdateOpt ¶
type ToolCallUpdateOpt func(tu *SessionToolCallUpdate)
func WithUpdateContent ¶
func WithUpdateContent(c []ToolCallContent) ToolCallUpdateOpt
WithUpdateContent replaces the content collection for a tool_call_update.
func WithUpdateKind ¶
func WithUpdateKind(k ToolKind) ToolCallUpdateOpt
WithUpdateKind sets the kind for a tool_call_update.
func WithUpdateLocations ¶
func WithUpdateLocations(l []ToolCallLocation) ToolCallUpdateOpt
WithUpdateLocations replaces the locations collection for a tool_call_update.
func WithUpdateName ¶ added in v1.4.0
func WithUpdateName(name string) ToolCallUpdateOpt
WithUpdateName sets the programmatic tool name for a tool_call_update.
func WithUpdateRawInput ¶
func WithUpdateRawInput(v any) ToolCallUpdateOpt
WithUpdateRawInput sets rawInput for a tool_call_update.
func WithUpdateRawOutput ¶
func WithUpdateRawOutput(v any) ToolCallUpdateOpt
WithUpdateRawOutput sets rawOutput for a tool_call_update.
func WithUpdateStatus ¶
func WithUpdateStatus(s ToolCallStatus) ToolCallUpdateOpt
WithUpdateStatus sets the status for a tool_call_update.
func WithUpdateTitle ¶
func WithUpdateTitle(t string) ToolCallUpdateOpt
WithUpdateTitle sets the title for a tool_call_update.
type ToolKind ¶
type ToolKind string
Categories of tools that can be invoked.
Tool kinds help clients choose appropriate icons and optimize how they display tool execution progress.
See protocol docs: [Creating](https://agentclientprotocol.com/protocol/v1/tool-calls#creating)
const ( ToolKindRead ToolKind = "read" ToolKindEdit ToolKind = "edit" ToolKindDelete ToolKind = "delete" ToolKindMove ToolKind = "move" ToolKindSearch ToolKind = "search" ToolKindExecute ToolKind = "execute" ToolKindThink ToolKind = "think" ToolKindFetch ToolKind = "fetch" ToolKindSwitchMode ToolKind = "switch_mode" ToolKindOther ToolKind = "other" )
type TransportError ¶ added in v1.1.0
type TransportError struct {
Op TransportOperation
Cause error
}
TransportError reports a connection transport failure without discarding the underlying error. Prepared requests may wrap this error with an independent RequestSubmissionState classification.
func (*TransportError) Error ¶ added in v1.1.0
func (e *TransportError) Error() string
func (*TransportError) Is ¶ added in v1.1.0
func (e *TransportError) Is(target error) bool
func (*TransportError) Unwrap ¶ added in v1.1.0
func (e *TransportError) Unwrap() error
type TransportFrame ¶ added in v1.2.0
type TransportFrame struct {
Raw json.RawMessage
Kind FrameKind
// contains filtered or unexported fields
}
TransportFrame is one NDJSON transport value. A frame preserves the boundary between a single JSON-RPC message and a batch. Relays must forward the complete frame; flattening a batch into independent objects changes JSON-RPC semantics.
func ParseTransportFrame ¶ added in v1.2.0
func ParseTransportFrame(raw []byte) TransportFrame
ParseTransportFrame classifies one JSON value. raw is copied; the caller may reuse the input buffer.
func (TransportFrame) Encode ¶ added in v1.2.0
func (f TransportFrame) Encode() ([]byte, error)
Encode returns the frame as one NDJSON line, preserving Raw exactly.
func (TransportFrame) EntryCount ¶ added in v1.2.0
func (f TransportFrame) EntryCount() int
EntryCount returns 1 for a single object, the number of batch entries, or 0 for a malformed frame.
func (TransportFrame) ProtocolError ¶ added in v1.2.0
func (f TransportFrame) ProtocolError() *RequestError
ProtocolError returns the JSON-RPC error associated with a malformed frame.
type TransportOperation ¶ added in v1.1.0
type TransportOperation string
TransportOperation identifies the transport operation that failed.
const ( TransportOperationRead TransportOperation = "read" TransportOperationWrite TransportOperation = "write" )
type UnstructuredCommandInput ¶
type UnstructuredCommandInput struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// A hint to display when the input hasn't been provided yet
Hint string `json:"hint"`
}
All text that was typed after the command name is provided as input.
func (*UnstructuredCommandInput) UnmarshalJSON ¶
func (v *UnstructuredCommandInput) UnmarshalJSON(b []byte) error
type UsageUpdate ¶
type UsageUpdate struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// Cumulative session cost (optional).
Cost *Cost `json:"cost,omitempty"`
// Total context window size in tokens.
Size uint64 `json:"size"`
// Tokens currently in context.
Used uint64 `json:"used"`
}
Context window and cost update for a session.
func (*UsageUpdate) UnmarshalJSON ¶
func (v *UsageUpdate) UnmarshalJSON(b []byte) error
type WaitForTerminalExitRequest ¶
type WaitForTerminalExitRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The session ID for this request.
SessionId SessionId `json:"sessionId"`
// The ID of the terminal to wait for.
TerminalId TerminalId `json:"terminalId"`
}
Request to wait for a terminal command to exit.
func (*WaitForTerminalExitRequest) UnmarshalJSON ¶
func (v *WaitForTerminalExitRequest) UnmarshalJSON(b []byte) error
func (*WaitForTerminalExitRequest) Validate ¶
func (v *WaitForTerminalExitRequest) Validate() error
type WaitForTerminalExitResponse ¶
type WaitForTerminalExitResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The process exit code (may be null if terminated by signal).
ExitCode *uint32 `json:"exitCode,omitempty"`
// The signal that terminated the process (may be null if exited normally).
Signal *string `json:"signal,omitempty"`
}
Response containing the exit status of a terminal command.
func (*WaitForTerminalExitResponse) Validate ¶
func (v *WaitForTerminalExitResponse) Validate() error
type WriteTextFileRequest ¶
type WriteTextFileRequest struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
// The text content to write to the file.
Content string `json:"content"`
// Absolute path to the file to write.
Path string `json:"path"`
// The session ID for this request.
SessionId SessionId `json:"sessionId"`
}
Request to write content to a text file.
Only available if the client supports the 'fs.writeTextFile' capability.
func (*WriteTextFileRequest) UnmarshalJSON ¶
func (v *WriteTextFileRequest) UnmarshalJSON(b []byte) error
func (*WriteTextFileRequest) Validate ¶
func (v *WriteTextFileRequest) Validate() error
type WriteTextFileResponse ¶
type WriteTextFileResponse struct {
// The _meta property is reserved by ACP to allow clients and agents to attach additional
// metadata to their interactions. Implementations MUST NOT make assumptions about values at
// these keys.
//
// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v1/extensibility)
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}
Response to 'fs/write_text_file'
func (*WriteTextFileResponse) Validate ¶
func (v *WriteTextFileResponse) Validate() error
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
schemaverify
command
Command schemaverify verifies vendored ACP schema release assets against schema/lock.json.
|
Command schemaverify verifies vendored ACP schema release assets against schema/lock.json. |
|
upstreamdrift
command
Command upstreamdrift verifies committed official ACP pins and optionally reports newer GitHub tags and releases.
|
Command upstreamdrift verifies committed official ACP pins and optionally reports newer GitHub tags and releases. |
|
example
|
|
|
client
command
Command client runs one prompt against an ACP agent executable over stdio.
|
Command client runs one prompt against an ACP agent executable over stdio. |
|
minimal-agent
command
|
|
|
experimental
|
|
|
v2
Package v2 is an experimental draft ACP protocol v2 surface.
|
Package v2 is an experimental draft ACP protocol v2 surface. |
|
internal
|
|
|
interoptest/goagent
command
|
|
|
transport
|
|
|
stdio
Package stdio provides the stable ACP newline-delimited JSON transport.
|
Package stdio provides the stable ACP newline-delimited JSON transport. |