pyacp

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultStdioBufferLimitBytes = 50 * 1024 * 1024

Default per line limit of the stdio reader, 50 MB for multimodal frames

View Source
const ProtocolVersion = 1

Protocol version the library speaks

Variables

View Source
var AgentMethods = map[string]string{
	"authenticate":              "authenticate",
	"initialize":                "initialize",
	"session_cancel":            "session/cancel",
	"session_close":             "session/close",
	"session_fork":              "session/fork",
	"session_list":              "session/list",
	"session_load":              "session/load",
	"session_new":               "session/new",
	"session_prompt":            "session/prompt",
	"session_resume":            "session/resume",
	"session_set_config_option": "session/set_config_option",
	"session_set_mode":          "session/set_mode",
	"session_set_model":         "session/set_model",
}

Wire names of the methods an agent serves

View Source
var ClientMethods = map[string]string{
	"fs_read_text_file":          "fs/read_text_file",
	"fs_write_text_file":         "fs/write_text_file",
	"session_request_permission": "session/request_permission",
	"session_update":             "session/update",
	"terminal_create":            "terminal/create",
	"terminal_kill":              "terminal/kill",
	"terminal_output":            "terminal/output",
	"terminal_release":           "terminal/release",
	"terminal_wait_for_exit":     "terminal/wait_for_exit",
}

Wire names of the methods a client serves

View Source
var ErrConnectionClosed = errors.New("Connection closed")

ConnectionError rejecting outgoing requests when the connection closes

View Source
var ResultDump = DumpOptions{ByAlias: true, ExcludeNone: true, ExcludeUnset: true}

Options the connection uses for a model returned as a request result

View Source
var SerializeParams = DumpOptions{ByAlias: true, ExcludeNone: true, ExcludeDefaults: true}

Options of serialize_params, by alias excluding None and defaults

Functions

func AfterResponse

func AfterResponse(ctx context.Context, fn func())

Runs fn on its own goroutine once the response of the request is written, at once outside one

func Dump

func Dump(v any, o DumpOptions) any

Python model_dump of a schema model as ordered JSON values, other values converted recursively

func IsModel

func IsModel(v any) bool

Reports whether v is a schema model value or pointer to one

func IsNil

func IsNil(v any) bool

Reports whether v is nil or a typed nil pointer, slice, map or interface

func NormalizeResult

func NormalizeResult(payload any) any

Empty object for nil, serialized params for a model, the payload otherwise

func Ptr

func Ptr[T any](v T) *T

Pointer to a copy of v for optional schema fields

func RunAgent

func RunAgent(agent any, input io.Writer, output io.Reader, useUnstableProtocol bool, limit int) error

Serves agent over the streams, stdin and stdout when both are nil, until the client disconnects

func StdioStreams

func StdioStreams() (io.Reader, io.Writer)

Reader of stdin and writer of stdout for a stdio connection

func Validate

func Validate[T any](input any) (*T, error)

Model_validate of decoded JSON into a new schema model of type T

func WithResponseScope

func WithResponseScope(ctx context.Context) (context.Context, func())

Request scope of ctx whose after response callbacks run when the returned flush is called

Types

type AgentCapabilities

type AgentCapabilities struct {
	Meta                *pyjson.Object       `acp:"_meta,py=field_meta"`
	LoadSession         *bool                `acp:"loadSession,py=load_session,def=false"`
	MCPCapabilities     *McpCapabilities     `acp:"mcpCapabilities,py=mcp_capabilities,def=model"`
	PromptCapabilities  *PromptCapabilities  `acp:"promptCapabilities,py=prompt_capabilities,def=model"`
	SessionCapabilities *SessionCapabilities `acp:"sessionCapabilities,py=session_capabilities,def=model"`
}

type AgentMessageChunk

type AgentMessageChunk struct {
	Meta      *pyjson.Object `acp:"_meta,py=field_meta"`
	Content   ContentBlock   `` /* 137-byte string literal not displayed */
	MessageID *string        `acp:"messageId,py=message_id"`
	// contains filtered or unexported fields
}

func UpdateAgentMessage

func UpdateAgentMessage(content ContentBlock) *AgentMessageChunk

Agent message chunk update

func UpdateAgentMessageText

func UpdateAgentMessageText(text string) *AgentMessageChunk

Agent message chunk update of plain text

type AgentPlanUpdate

type AgentPlanUpdate struct {
	Meta    *pyjson.Object `acp:"_meta,py=field_meta"`
	Entries []PlanEntry    `acp:"entries,py=entries,req"`
	// contains filtered or unexported fields
}

func UpdatePlan

func UpdatePlan(entries []PlanEntry) *AgentPlanUpdate

Plan update of the given entries

type AgentSideConnection

type AgentSideConnection struct {
	// contains filtered or unexported fields
}

Agent side of an ACP connection, the client facing calls an agent makes

func NewAgentSideConnection

func NewAgentSideConnection(agent any, writer io.Writer, reader io.Reader, listening, useUnstableProtocol bool, limit int) *AgentSideConnection

Connection serving agent over the given streams, calling its connect hook when present

func (*AgentSideConnection) Close

func (c *AgentSideConnection) Close() error

Closes the underlying connection

func (*AgentSideConnection) Conn

func (c *AgentSideConnection) Conn() *Connection

Underlying JSON-RPC connection

func (*AgentSideConnection) CreateTerminal

Creates a client terminal running command

func (*AgentSideConnection) ExtMethod

func (c *AgentSideConnection) ExtMethod(ctx context.Context, method string, params *pyjson.Object) (any, error)

Sends an underscore prefixed extension request

func (*AgentSideConnection) ExtNotification

func (c *AgentSideConnection) ExtNotification(ctx context.Context, method string, params *pyjson.Object) error

Sends an underscore prefixed extension notification

func (*AgentSideConnection) KillTerminal

func (c *AgentSideConnection) KillTerminal(ctx context.Context, sessionID, terminalID string, meta *pyjson.Object) (*KillTerminalResponse, error)

Kills a client terminal

func (*AgentSideConnection) Listen

func (c *AgentSideConnection) Listen() error

Receives frames until the client closes its side

func (*AgentSideConnection) ReadTextFile

func (c *AgentSideConnection) ReadTextFile(ctx context.Context, path, sessionID string, limit, line *int, meta *pyjson.Object) (*ReadTextFileResponse, error)

Reads a text file through the client

func (*AgentSideConnection) ReleaseTerminal

func (c *AgentSideConnection) ReleaseTerminal(ctx context.Context, sessionID, terminalID string, meta *pyjson.Object) (*ReleaseTerminalResponse, error)

Releases a client terminal

func (*AgentSideConnection) RequestPermission

func (c *AgentSideConnection) RequestPermission(ctx context.Context, options []PermissionOption, sessionID string, toolCall *ToolCallUpdate, meta *pyjson.Object) (*RequestPermissionResponse, error)

Asks the client to pick one of the permission options for a tool call

func (*AgentSideConnection) SessionUpdate

func (c *AgentSideConnection) SessionUpdate(ctx context.Context, sessionID string, update SessionUpdate, meta *pyjson.Object) error

Sends a session/update notification

func (*AgentSideConnection) TerminalOutput

func (c *AgentSideConnection) TerminalOutput(ctx context.Context, sessionID, terminalID string, meta *pyjson.Object) (*TerminalOutputResponse, error)

Current output of a client terminal

func (*AgentSideConnection) WaitForTerminalExit

func (c *AgentSideConnection) WaitForTerminalExit(ctx context.Context, sessionID, terminalID string, meta *pyjson.Object) (*WaitForTerminalExitResponse, error)

Waits for a client terminal to exit

func (*AgentSideConnection) WriteTextFile

func (c *AgentSideConnection) WriteTextFile(ctx context.Context, content, path, sessionID string, meta *pyjson.Object) (*WriteTextFileResponse, error)

Writes a text file through the client

type AgentThoughtChunk

type AgentThoughtChunk struct {
	Meta      *pyjson.Object `acp:"_meta,py=field_meta"`
	Content   ContentBlock   `` /* 137-byte string literal not displayed */
	MessageID *string        `acp:"messageId,py=message_id"`
	// contains filtered or unexported fields
}

func UpdateAgentThought

func UpdateAgentThought(content ContentBlock) *AgentThoughtChunk

Agent thought chunk update

func UpdateAgentThoughtText

func UpdateAgentThoughtText(text string) *AgentThoughtChunk

Agent thought chunk update of plain text

type AllowedOutcome

type AllowedOutcome struct {
	Meta     *pyjson.Object `acp:"_meta,py=field_meta"`
	OptionID string         `acp:"optionId,py=option_id,req"`
	// contains filtered or unexported fields
}

type Annotations

type Annotations struct {
	Meta         *pyjson.Object `acp:"_meta,py=field_meta"`
	Audience     []string       `acp:"audience,py=audience,enum=assistant|user,enumtype"`
	LastModified *string        `acp:"lastModified,py=last_modified"`
	Priority     *float64       `acp:"priority,py=priority"`
}

type AudioContentBlock

type AudioContentBlock struct {
	Meta        *pyjson.Object `acp:"_meta,py=field_meta"`
	Annotations *Annotations   `acp:"annotations,py=annotations"`
	Data        string         `acp:"data,py=data,req"`
	MimeType    string         `acp:"mimeType,py=mime_type,req"`
	// contains filtered or unexported fields
}

type AuthCapabilities

type AuthCapabilities struct {
	Meta     *pyjson.Object `acp:"_meta,py=field_meta"`
	Terminal *bool          `acp:"terminal,py=terminal,def=false"`
}

type AuthEnvVar

type AuthEnvVar struct {
	Meta     *pyjson.Object `acp:"_meta,py=field_meta"`
	Label    *string        `acp:"label,py=label"`
	Name     string         `acp:"name,py=name,req"`
	Optional *bool          `acp:"optional,py=optional,def=false"`
	Secret   *bool          `acp:"secret,py=secret,def=true"`
}

type AuthMethod

type AuthMethod interface {
	// contains filtered or unexported methods
}

type AuthMethodAgent

type AuthMethodAgent struct {
	Meta        *pyjson.Object `acp:"_meta,py=field_meta"`
	Description *string        `acp:"description,py=description"`
	ID          string         `acp:"id,py=id,req"`
	Name        string         `acp:"name,py=name,req"`
}

type AuthenticateRequest

type AuthenticateRequest struct {
	Meta     *pyjson.Object `acp:"_meta,py=field_meta"`
	MethodID string         `acp:"methodId,py=method_id,req"`
}

type AuthenticateResponse

type AuthenticateResponse struct {
	Meta *pyjson.Object `acp:"_meta,py=field_meta"`
}

type Authenticator

type Authenticator interface {
	Authenticate(ctx context.Context, req *AuthenticateRequest) (*AuthenticateResponse, error)
}

Agent method answering authenticate

type AvailableCommand

type AvailableCommand struct {
	Meta        *pyjson.Object            `acp:"_meta,py=field_meta"`
	Description string                    `acp:"description,py=description,req"`
	Input       *UnstructuredCommandInput `acp:"input,py=input"`
	Name        string                    `acp:"name,py=name,req"`
}

type AvailableCommandsUpdate

type AvailableCommandsUpdate struct {
	Meta              *pyjson.Object     `acp:"_meta,py=field_meta"`
	AvailableCommands []AvailableCommand `acp:"availableCommands,py=available_commands,req"`
	// contains filtered or unexported fields
}

type BlobResourceContents

type BlobResourceContents struct {
	Meta     *pyjson.Object `acp:"_meta,py=field_meta"`
	Blob     string         `acp:"blob,py=blob,req"`
	MimeType *string        `acp:"mimeType,py=mime_type"`
	URI      string         `acp:"uri,py=uri,req"`
}

type CancelNotification

type CancelNotification struct {
	Meta      *pyjson.Object `acp:"_meta,py=field_meta"`
	SessionID string         `acp:"sessionId,py=session_id,req"`
}

type Canceller

type Canceller interface {
	Cancel(ctx context.Context, req *CancelNotification) error
}

Agent method receiving session/cancel

type ClientCapabilities

type ClientCapabilities struct {
	Meta     *pyjson.Object          `acp:"_meta,py=field_meta"`
	Auth     *AuthCapabilities       `acp:"auth,py=auth,def=dict"`
	Fs       *FileSystemCapabilities `acp:"fs,py=fs,def=model"`
	Terminal *bool                   `acp:"terminal,py=terminal,def=false"`
}

type CloseSessionRequest

type CloseSessionRequest struct {
	Meta      *pyjson.Object `acp:"_meta,py=field_meta"`
	SessionID string         `acp:"sessionId,py=session_id,req"`
}

type CloseSessionResponse

type CloseSessionResponse struct {
	Meta *pyjson.Object `acp:"_meta,py=field_meta"`
}

type ConfigOptionSetter

type ConfigOptionSetter interface {
	SetConfigOption(ctx context.Context, req *SetConfigOptionParams) (*SetSessionConfigOptionResponse, error)
}

Agent method answering session/set_config_option

type ConfigOptionUpdate

type ConfigOptionUpdate struct {
	Meta          *pyjson.Object        `acp:"_meta,py=field_meta"`
	ConfigOptions []SessionConfigOption `acp:"configOptions,py=config_options,req,union=SessionConfigOptionSelect|SessionConfigOptionBoolean"`
	// contains filtered or unexported fields
}

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

Minimal JSON-RPC 2.0 connection over newline delimited JSON frames

func NewConnection

func NewConnection(handler MethodHandler, writer io.Writer, reader io.Reader, listening bool, limit int) *Connection

Connection reading frames from reader and writing to writer, receiving in the background when listening

func (*Connection) AddObserver

func (c *Connection) AddObserver(observer StreamObserver)

Registers a callback that receives every raw JSON-RPC message

func (*Connection) Close

func (c *Connection) Close() error

Stops receiving, waits for in flight handlers and rejects pending outgoing requests

func (*Connection) MainLoop

func (c *Connection) MainLoop() error

Receives frames until end of input, logging and returning a failure of the loop

func (*Connection) SendNotification

func (c *Connection) SendNotification(ctx context.Context, method string, params any) error

Sends a notification frame

func (*Connection) SendRequest

func (c *Connection) SendRequest(ctx context.Context, method string, params any) (any, error)

Sends a request and waits for its result or error response

type Connector

type Connector interface {
	OnConnect(conn *AgentSideConnection)
}

Agent hook receiving the connection it is served on

type ContentBlock

type ContentBlock interface {
	// contains filtered or unexported methods
}

type ContentToolCallContent

type ContentToolCallContent struct {
	Meta    *pyjson.Object `acp:"_meta,py=field_meta"`
	Content ContentBlock   `` /* 137-byte string literal not displayed */
	// contains filtered or unexported fields
}

func ToolContent

func ToolContent(block ContentBlock) *ContentToolCallContent

Tool call content wrapping a content block

type Cost

type Cost struct {
	Amount   float64 `acp:"amount,py=amount,req"`
	Currency string  `acp:"currency,py=currency,req"`
}

type CreateTerminalRequest

type CreateTerminalRequest struct {
	Meta            *pyjson.Object `acp:"_meta,py=field_meta"`
	Args            []string       `acp:"args,py=args"`
	Command         string         `acp:"command,py=command,req"`
	Cwd             *string        `acp:"cwd,py=cwd"`
	Env             []EnvVariable  `acp:"env,py=env"`
	OutputByteLimit *int           `acp:"outputByteLimit,py=output_byte_limit"`
	SessionID       string         `acp:"sessionId,py=session_id,req"`
}

type CreateTerminalResponse

type CreateTerminalResponse struct {
	Meta       *pyjson.Object `acp:"_meta,py=field_meta"`
	TerminalID string         `acp:"terminalId,py=terminal_id,req"`
}

type CurrentModeUpdate

type CurrentModeUpdate struct {
	Meta          *pyjson.Object `acp:"_meta,py=field_meta"`
	CurrentModeID string         `acp:"currentModeId,py=current_mode_id,req"`
	// contains filtered or unexported fields
}

type DeniedOutcome

type DeniedOutcome struct {
	// contains filtered or unexported fields
}

type DumpOptions

type DumpOptions struct {
	ByAlias         bool
	ExcludeNone     bool
	ExcludeUnset    bool
	ExcludeDefaults bool
}

Flags of pydantic model_dump

type EmbeddedResourceContentBlock

type EmbeddedResourceContentBlock struct {
	Meta        *pyjson.Object   `acp:"_meta,py=field_meta"`
	Annotations *Annotations     `acp:"annotations,py=annotations"`
	Resource    ResourceContents `acp:"resource,py=resource,req,union=TextResourceContents|BlobResourceContents"`
	// contains filtered or unexported fields
}

type EnvVarAuthMethod

type EnvVarAuthMethod struct {
	Meta        *pyjson.Object `acp:"_meta,py=field_meta"`
	Description *string        `acp:"description,py=description"`
	ID          string         `acp:"id,py=id,req"`
	Link        *string        `acp:"link,py=link"`
	Name        string         `acp:"name,py=name,req"`
	Vars        []AuthEnvVar   `acp:"vars,py=vars,req"`
	// contains filtered or unexported fields
}

type EnvVariable

type EnvVariable struct {
	Meta  *pyjson.Object `acp:"_meta,py=field_meta"`
	Name  string         `acp:"name,py=name,req"`
	Value string         `acp:"value,py=value,req"`
}

type ExtMethoder

type ExtMethoder interface {
	ExtMethod(ctx context.Context, name string, params *pyjson.Object) (any, error)
}

Agent method answering underscore extension requests

type ExtNotifier

type ExtNotifier interface {
	ExtNotification(ctx context.Context, name string, params *pyjson.Object) error
}

Agent method receiving underscore extension notifications

type ExtensionHandler

type ExtensionHandler func(ctx context.Context, name string, payload *pyjson.Object) (any, error)

Handler of extension methods whose name lost its leading underscore

type FileEditToolCallContent

type FileEditToolCallContent struct {
	Meta    *pyjson.Object `acp:"_meta,py=field_meta"`
	NewText string         `acp:"newText,py=new_text,req"`
	OldText *string        `acp:"oldText,py=old_text"`
	Path    string         `acp:"path,py=path,req"`
	// contains filtered or unexported fields
}

func ToolDiffContent

func ToolDiffContent(path, newText string, oldText *string) *FileEditToolCallContent

Diff tool call content, old text omitted when nil

type FileSystemCapabilities

type FileSystemCapabilities struct {
	Meta          *pyjson.Object `acp:"_meta,py=field_meta"`
	ReadTextFile  *bool          `acp:"readTextFile,py=read_text_file,def=false"`
	WriteTextFile *bool          `acp:"writeTextFile,py=write_text_file,def=false"`
}

type ForkSessionRequest

type ForkSessionRequest struct {
	Meta       *pyjson.Object `acp:"_meta,py=field_meta"`
	Cwd        string         `acp:"cwd,py=cwd,req"`
	MCPServers []McpServer    `acp:"mcpServers,py=mcp_servers,union=HttpMcpServer|SseMcpServer|McpServerStdio"`
	SessionID  string         `acp:"sessionId,py=session_id,req"`
}

type ForkSessionResponse

type ForkSessionResponse struct {
	Meta          *pyjson.Object        `acp:"_meta,py=field_meta"`
	ConfigOptions []SessionConfigOption `acp:"configOptions,py=config_options,union=SessionConfigOptionSelect|SessionConfigOptionBoolean"`
	Models        *SessionModelState    `acp:"models,py=models"`
	Modes         *SessionModeState     `acp:"modes,py=modes"`
	SessionID     string                `acp:"sessionId,py=session_id,req"`
}

type HttpHeader

type HttpHeader struct {
	Meta  *pyjson.Object `acp:"_meta,py=field_meta"`
	Name  string         `acp:"name,py=name,req"`
	Value string         `acp:"value,py=value,req"`
}

type HttpMcpServer

type HttpMcpServer struct {
	Meta    *pyjson.Object `acp:"_meta,py=field_meta"`
	Headers []HttpHeader   `acp:"headers,py=headers,req"`
	Name    string         `acp:"name,py=name,req"`
	URL     string         `acp:"url,py=url,req"`
	// contains filtered or unexported fields
}

type ImageContentBlock

type ImageContentBlock struct {
	Meta        *pyjson.Object `acp:"_meta,py=field_meta"`
	Annotations *Annotations   `acp:"annotations,py=annotations"`
	Data        string         `acp:"data,py=data,req"`
	MimeType    string         `acp:"mimeType,py=mime_type,req"`
	URI         *string        `acp:"uri,py=uri"`
	// contains filtered or unexported fields
}

type Implementation

type Implementation struct {
	Meta    *pyjson.Object `acp:"_meta,py=field_meta"`
	Name    string         `acp:"name,py=name,req"`
	Title   *string        `acp:"title,py=title"`
	Version string         `acp:"version,py=version,req"`
}

type InitializeRequest

type InitializeRequest struct {
	Meta               *pyjson.Object      `acp:"_meta,py=field_meta"`
	ClientCapabilities *ClientCapabilities `acp:"clientCapabilities,py=client_capabilities,def=model"`
	ClientInfo         *Implementation     `acp:"clientInfo,py=client_info"`
	ProtocolVersion    int                 `acp:"protocolVersion,py=protocol_version,req"`
}

type InitializeResponse

type InitializeResponse struct {
	Meta              *pyjson.Object     `acp:"_meta,py=field_meta"`
	AgentCapabilities *AgentCapabilities `acp:"agentCapabilities,py=agent_capabilities,def=model"`
	AgentInfo         *Implementation    `acp:"agentInfo,py=agent_info"`
	AuthMethods       []AuthMethod       `acp:"authMethods,py=auth_methods,def=[],union=EnvVarAuthMethod|TerminalAuthMethod|AuthMethodAgent"`
	ProtocolVersion   int                `acp:"protocolVersion,py=protocol_version,req"`
}

type Initializer

type Initializer interface {
	Initialize(ctx context.Context, req *InitializeRequest) (*InitializeResponse, error)
}

Agent method answering initialize

type KillTerminalRequest

type KillTerminalRequest struct {
	Meta       *pyjson.Object `acp:"_meta,py=field_meta"`
	SessionID  string         `acp:"sessionId,py=session_id,req"`
	TerminalID string         `acp:"terminalId,py=terminal_id,req"`
}

type KillTerminalResponse

type KillTerminalResponse struct {
	Meta *pyjson.Object `acp:"_meta,py=field_meta"`
}

type ListSessionsRequest

type ListSessionsRequest struct {
	Meta   *pyjson.Object `acp:"_meta,py=field_meta"`
	Cursor *string        `acp:"cursor,py=cursor"`
	Cwd    *string        `acp:"cwd,py=cwd"`
}

type ListSessionsResponse

type ListSessionsResponse struct {
	Meta       *pyjson.Object `acp:"_meta,py=field_meta"`
	NextCursor *string        `acp:"nextCursor,py=next_cursor"`
	Sessions   []SessionInfo  `acp:"sessions,py=sessions,req"`
}

type LoadSessionRequest

type LoadSessionRequest struct {
	Meta       *pyjson.Object `acp:"_meta,py=field_meta"`
	Cwd        string         `acp:"cwd,py=cwd,req"`
	MCPServers []McpServer    `acp:"mcpServers,py=mcp_servers,req,union=HttpMcpServer|SseMcpServer|McpServerStdio"`
	SessionID  string         `acp:"sessionId,py=session_id,req"`
}

type LoadSessionResponse

type LoadSessionResponse struct {
	Meta          *pyjson.Object        `acp:"_meta,py=field_meta"`
	ConfigOptions []SessionConfigOption `acp:"configOptions,py=config_options,union=SessionConfigOptionSelect|SessionConfigOptionBoolean"`
	Models        *SessionModelState    `acp:"models,py=models"`
	Modes         *SessionModeState     `acp:"modes,py=modes"`
}

type McpCapabilities

type McpCapabilities struct {
	Meta *pyjson.Object `acp:"_meta,py=field_meta"`
	HTTP *bool          `acp:"http,py=http,def=false"`
	Sse  *bool          `acp:"sse,py=sse,def=false"`
}

type McpServer

type McpServer interface {
	// contains filtered or unexported methods
}

type McpServerStdio

type McpServerStdio struct {
	Meta    *pyjson.Object `acp:"_meta,py=field_meta"`
	Args    []string       `acp:"args,py=args,req"`
	Command string         `acp:"command,py=command,req"`
	Env     []EnvVariable  `acp:"env,py=env,req"`
	Name    string         `acp:"name,py=name,req"`
}

type MessageRouter

type MessageRouter struct {
	// contains filtered or unexported fields
}

Method name router for requests, notifications and underscore extensions

func BuildAgentRouter

func BuildAgentRouter(agent any, useUnstableProtocol bool) *MessageRouter

Router of every agent method, routes absent from the agent answering method not found

func NewMessageRouter

func NewMessageRouter(useUnstableProtocol bool) *MessageRouter

Empty router, unstable routes refused unless enabled

func (*MessageRouter) AddRoute

func (m *MessageRouter) AddRoute(r *Route)

Registers a route under its method and kind

func (*MessageRouter) Call

func (m *MessageRouter) Call(ctx context.Context, method string, params any, isNotification bool) (any, error)

Dispatches one incoming message to its route or extension handler

func (*MessageRouter) HandleExtensionNotification

func (m *MessageRouter) HandleExtensionNotification(h ExtensionHandler)

Sets the handler of underscore prefixed notifications

func (*MessageRouter) HandleExtensionRequest

func (m *MessageRouter) HandleExtensionRequest(h ExtensionHandler)

Sets the handler of underscore prefixed requests

func (*MessageRouter) RouteNotification

func (m *MessageRouter) RouteNotification(method string, fn RouteFunc, unstable bool) *Route

Registers a notification route

func (*MessageRouter) RouteRequest

func (m *MessageRouter) RouteRequest(method string, fn RouteFunc, adapt func(any) any, unstable bool) *Route

Registers a request route, unstable routes warning when the protocol flag is off

type MethodHandler

type MethodHandler func(ctx context.Context, method string, params any, isNotification bool) (any, error)

Handler the connection calls for every incoming request or notification

type ModelInfo

type ModelInfo struct {
	Meta        *pyjson.Object `acp:"_meta,py=field_meta"`
	Description *string        `acp:"description,py=description"`
	ModelID     string         `acp:"modelId,py=model_id,req"`
	Name        string         `acp:"name,py=name,req"`
}

type NewSessionRequest

type NewSessionRequest struct {
	Meta       *pyjson.Object `acp:"_meta,py=field_meta"`
	Cwd        string         `acp:"cwd,py=cwd,req"`
	MCPServers []McpServer    `acp:"mcpServers,py=mcp_servers,req,union=HttpMcpServer|SseMcpServer|McpServerStdio"`
}

type NewSessionResponse

type NewSessionResponse struct {
	Meta          *pyjson.Object        `acp:"_meta,py=field_meta"`
	ConfigOptions []SessionConfigOption `acp:"configOptions,py=config_options,union=SessionConfigOptionSelect|SessionConfigOptionBoolean"`
	Models        *SessionModelState    `acp:"models,py=models"`
	Modes         *SessionModeState     `acp:"modes,py=modes"`
	SessionID     string                `acp:"sessionId,py=session_id,req"`
}

type PermissionOption

type PermissionOption struct {
	Meta     *pyjson.Object `acp:"_meta,py=field_meta"`
	Kind     string         `acp:"kind,py=kind,req,enum=allow_once|allow_always|reject_once|reject_always"`
	Name     string         `acp:"name,py=name,req"`
	OptionID string         `acp:"optionId,py=option_id,req"`
}

type PermissionOutcome

type PermissionOutcome interface {
	// contains filtered or unexported methods
}

type PlanEntry

type PlanEntry struct {
	Meta     *pyjson.Object `acp:"_meta,py=field_meta"`
	Content  string         `acp:"content,py=content,req"`
	Priority string         `acp:"priority,py=priority,req,enum=high|medium|low"`
	Status   string         `acp:"status,py=status,req,enum=pending|in_progress|completed"`
}

func NewPlanEntry

func NewPlanEntry(content, priority, status string) PlanEntry

Plan entry with content, priority and status

type PromptCapabilities

type PromptCapabilities struct {
	Meta            *pyjson.Object `acp:"_meta,py=field_meta"`
	Audio           *bool          `acp:"audio,py=audio,def=false"`
	EmbeddedContext *bool          `acp:"embeddedContext,py=embedded_context,def=false"`
	Image           *bool          `acp:"image,py=image,def=false"`
}

type PromptRequest

type PromptRequest struct {
	Meta      *pyjson.Object `acp:"_meta,py=field_meta"`
	MessageID *string        `acp:"messageId,py=message_id"`
	Prompt    []ContentBlock `` /* 135-byte string literal not displayed */
	SessionID string         `acp:"sessionId,py=session_id,req"`
}

type PromptResponse

type PromptResponse struct {
	Meta          *pyjson.Object `acp:"_meta,py=field_meta"`
	StopReason    string         `acp:"stopReason,py=stop_reason,req,enum=end_turn|max_tokens|max_turn_requests|refusal|cancelled"`
	Usage         *Usage         `acp:"usage,py=usage"`
	UserMessageID *string        `acp:"userMessageId,py=user_message_id"`
}

type Prompter

type Prompter interface {
	Prompt(ctx context.Context, req *PromptRequest) (*PromptResponse, error)
}

Agent method answering session/prompt

type ReadTextFileRequest

type ReadTextFileRequest struct {
	Meta      *pyjson.Object `acp:"_meta,py=field_meta"`
	Limit     *int           `acp:"limit,py=limit"`
	Line      *int           `acp:"line,py=line"`
	Path      string         `acp:"path,py=path,req"`
	SessionID string         `acp:"sessionId,py=session_id,req"`
}

type ReadTextFileResponse

type ReadTextFileResponse struct {
	Meta    *pyjson.Object `acp:"_meta,py=field_meta"`
	Content string         `acp:"content,py=content,req"`
}

type ReleaseTerminalRequest

type ReleaseTerminalRequest struct {
	Meta       *pyjson.Object `acp:"_meta,py=field_meta"`
	SessionID  string         `acp:"sessionId,py=session_id,req"`
	TerminalID string         `acp:"terminalId,py=terminal_id,req"`
}

type ReleaseTerminalResponse

type ReleaseTerminalResponse struct {
	Meta *pyjson.Object `acp:"_meta,py=field_meta"`
}

type RequestError

type RequestError struct {
	Code    int
	Message string
	Data    any
}

JSON-RPC error raised by a handler or received for an outgoing request

func InternalError

func InternalError(data any) *RequestError

Code -32603 Internal error

func InvalidParams

func InvalidParams(data *pyjson.Object) *RequestError

Code -32602 Invalid params

func MethodNotFound

func MethodNotFound(method string) *RequestError

Code -32601 Method not found carrying the method name

func NewRequestError

func NewRequestError(code int, message string, data any) *RequestError

Error with the given code, message and data

func (*RequestError) Error

func (e *RequestError) Error() string

Message text, the str form of the Python exception

func (*RequestError) ToErrorObj

func (e *RequestError) ToErrorObj() *pyjson.Object

Error object with code, message and data in wire order

type RequestPermissionRequest

type RequestPermissionRequest struct {
	Meta      *pyjson.Object     `acp:"_meta,py=field_meta"`
	Options   []PermissionOption `acp:"options,py=options,req"`
	SessionID string             `acp:"sessionId,py=session_id,req"`
	ToolCall  ToolCallUpdate     `acp:"toolCall,py=tool_call,req"`
}

type RequestPermissionResponse

type RequestPermissionResponse struct {
	Meta    *pyjson.Object    `acp:"_meta,py=field_meta"`
	Outcome PermissionOutcome `acp:"outcome,py=outcome,req,union=DeniedOutcome|AllowedOutcome"`
}

type ResourceContentBlock

type ResourceContentBlock struct {
	Meta        *pyjson.Object `acp:"_meta,py=field_meta"`
	Annotations *Annotations   `acp:"annotations,py=annotations"`
	Description *string        `acp:"description,py=description"`
	MimeType    *string        `acp:"mimeType,py=mime_type"`
	Name        string         `acp:"name,py=name,req"`
	Size        *int           `acp:"size,py=size"`
	Title       *string        `acp:"title,py=title"`
	URI         string         `acp:"uri,py=uri,req"`
	// contains filtered or unexported fields
}

type ResourceContents

type ResourceContents interface {
	// contains filtered or unexported methods
}

type ResumeSessionRequest

type ResumeSessionRequest struct {
	Meta       *pyjson.Object `acp:"_meta,py=field_meta"`
	Cwd        string         `acp:"cwd,py=cwd,req"`
	MCPServers []McpServer    `acp:"mcpServers,py=mcp_servers,union=HttpMcpServer|SseMcpServer|McpServerStdio"`
	SessionID  string         `acp:"sessionId,py=session_id,req"`
}

type ResumeSessionResponse

type ResumeSessionResponse struct {
	Meta          *pyjson.Object        `acp:"_meta,py=field_meta"`
	ConfigOptions []SessionConfigOption `acp:"configOptions,py=config_options,union=SessionConfigOptionSelect|SessionConfigOptionBoolean"`
	Models        *SessionModelState    `acp:"models,py=models"`
	Modes         *SessionModeState     `acp:"modes,py=modes"`
}

type Route

type Route struct {
	Method        string
	Func          RouteFunc
	Kind          string
	Optional      bool
	DefaultResult any
	AdaptResult   func(any) any
	WarnUnstable  bool
}

One request or notification route of a message router

func (*Route) Handle

func (r *Route) Handle(ctx context.Context, params any) (any, error)

Result of the route, method not found when the handler is absent or unstable and disabled

type RouteFunc

type RouteFunc func(ctx context.Context, params any) (any, error)

Handler of one routed method receiving the raw params

type SessionCapabilities

type SessionCapabilities struct {
	Meta   *pyjson.Object             `acp:"_meta,py=field_meta"`
	Close  *SessionCloseCapabilities  `acp:"close,py=close"`
	Fork   *SessionForkCapabilities   `acp:"fork,py=fork"`
	List   *SessionListCapabilities   `acp:"list,py=list"`
	Resume *SessionResumeCapabilities `acp:"resume,py=resume"`
}

type SessionCloseCapabilities

type SessionCloseCapabilities struct {
	Meta *pyjson.Object `acp:"_meta,py=field_meta"`
}

type SessionCloser

type SessionCloser interface {
	CloseSession(ctx context.Context, req *CloseSessionRequest) (*CloseSessionResponse, error)
}

Agent method answering session/close

type SessionConfigOption

type SessionConfigOption interface {
	// contains filtered or unexported methods
}

type SessionConfigOptionBoolean

type SessionConfigOptionBoolean struct {
	CurrentValue bool           `acp:"currentValue,py=current_value,req"`
	Meta         *pyjson.Object `acp:"_meta,py=field_meta"`
	Category     *string        `acp:"category,py=category"`
	Description  *string        `acp:"description,py=description"`
	ID           string         `acp:"id,py=id,req"`
	Name         string         `acp:"name,py=name,req"`
	// contains filtered or unexported fields
}

type SessionConfigOptionSelect

type SessionConfigOptionSelect struct {
	CurrentValue string         `acp:"currentValue,py=current_value,req"`
	Options      any            `acp:"options,py=options,req,union=list:SessionConfigSelectOption|list:SessionConfigSelectGroup"`
	Meta         *pyjson.Object `acp:"_meta,py=field_meta"`
	Category     *string        `acp:"category,py=category"`
	Description  *string        `acp:"description,py=description"`
	ID           string         `acp:"id,py=id,req"`
	Name         string         `acp:"name,py=name,req"`
	// contains filtered or unexported fields
}

type SessionConfigSelectGroup

type SessionConfigSelectGroup struct {
	Meta    *pyjson.Object              `acp:"_meta,py=field_meta"`
	Group   string                      `acp:"group,py=group,req"`
	Name    string                      `acp:"name,py=name,req"`
	Options []SessionConfigSelectOption `acp:"options,py=options,req"`
}

type SessionConfigSelectOption

type SessionConfigSelectOption struct {
	Meta        *pyjson.Object `acp:"_meta,py=field_meta"`
	Description *string        `acp:"description,py=description"`
	Name        string         `acp:"name,py=name,req"`
	Value       string         `acp:"value,py=value,req"`
}

type SessionCreator

type SessionCreator interface {
	NewSession(ctx context.Context, req *NewSessionRequest) (*NewSessionResponse, error)
}

Agent method answering session/new

type SessionForkCapabilities

type SessionForkCapabilities struct {
	Meta *pyjson.Object `acp:"_meta,py=field_meta"`
}

type SessionForker

type SessionForker interface {
	ForkSession(ctx context.Context, req *ForkSessionRequest) (*ForkSessionResponse, error)
}

Agent method answering session/fork

type SessionInfo

type SessionInfo struct {
	Meta      *pyjson.Object `acp:"_meta,py=field_meta"`
	Cwd       string         `acp:"cwd,py=cwd,req"`
	SessionID string         `acp:"sessionId,py=session_id,req"`
	Title     *string        `acp:"title,py=title"`
	UpdatedAt *string        `acp:"updatedAt,py=updated_at"`
}

type SessionInfoUpdate

type SessionInfoUpdate struct {
	Meta      *pyjson.Object `acp:"_meta,py=field_meta"`
	Title     *string        `acp:"title,py=title"`
	UpdatedAt *string        `acp:"updatedAt,py=updated_at"`
	// contains filtered or unexported fields
}

type SessionListCapabilities

type SessionListCapabilities struct {
	Meta *pyjson.Object `acp:"_meta,py=field_meta"`
}

type SessionLister

type SessionLister interface {
	ListSessions(ctx context.Context, req *ListSessionsRequest) (*ListSessionsResponse, error)
}

Agent method answering session/list

type SessionLoader

type SessionLoader interface {
	LoadSession(ctx context.Context, req *LoadSessionRequest) (*LoadSessionResponse, error)
}

Agent method answering session/load

type SessionMode

type SessionMode struct {
	Meta        *pyjson.Object `acp:"_meta,py=field_meta"`
	Description *string        `acp:"description,py=description"`
	ID          string         `acp:"id,py=id,req"`
	Name        string         `acp:"name,py=name,req"`
}

type SessionModeSetter

type SessionModeSetter interface {
	SetSessionMode(ctx context.Context, req *SetSessionModeRequest) (*SetSessionModeResponse, error)
}

Agent method answering session/set_mode

type SessionModeState

type SessionModeState struct {
	Meta           *pyjson.Object `acp:"_meta,py=field_meta"`
	AvailableModes []SessionMode  `acp:"availableModes,py=available_modes,req"`
	CurrentModeID  string         `acp:"currentModeId,py=current_mode_id,req"`
}

type SessionModelSetter

type SessionModelSetter interface {
	SetSessionModel(ctx context.Context, req *SetSessionModelRequest) (*SetSessionModelResponse, error)
}

Agent method answering session/set_model

type SessionModelState

type SessionModelState struct {
	Meta            *pyjson.Object `acp:"_meta,py=field_meta"`
	AvailableModels []ModelInfo    `acp:"availableModels,py=available_models,req"`
	CurrentModelID  string         `acp:"currentModelId,py=current_model_id,req"`
}

type SessionNotification

type SessionNotification struct {
	Meta      *pyjson.Object `acp:"_meta,py=field_meta"`
	SessionID string         `acp:"sessionId,py=session_id,req"`
	Update    SessionUpdate  `` /* 223-byte string literal not displayed */
}

type SessionResumeCapabilities

type SessionResumeCapabilities struct {
	Meta *pyjson.Object `acp:"_meta,py=field_meta"`
}

type SessionResumer

type SessionResumer interface {
	ResumeSession(ctx context.Context, req *ResumeSessionRequest) (*ResumeSessionResponse, error)
}

Agent method answering session/resume

type SessionUpdate

type SessionUpdate interface {
	// contains filtered or unexported methods
}

type SetConfigOptionParams

type SetConfigOptionParams struct {
	Meta      *pyjson.Object
	ConfigID  string
	SessionID string
	Value     any
}

Shared fields of the boolean and select set config option requests

type SetSessionConfigOptionBooleanRequest

type SetSessionConfigOptionBooleanRequest struct {
	Meta      *pyjson.Object `acp:"_meta,py=field_meta"`
	ConfigID  string         `acp:"configId,py=config_id,req"`
	SessionID string         `acp:"sessionId,py=session_id,req"`

	Value bool `acp:"value,py=value,req"`
	// contains filtered or unexported fields
}

type SetSessionConfigOptionResponse

type SetSessionConfigOptionResponse struct {
	Meta          *pyjson.Object        `acp:"_meta,py=field_meta"`
	ConfigOptions []SessionConfigOption `acp:"configOptions,py=config_options,req,union=SessionConfigOptionSelect|SessionConfigOptionBoolean"`
}

type SetSessionConfigOptionSelectRequest

type SetSessionConfigOptionSelectRequest struct {
	Meta      *pyjson.Object `acp:"_meta,py=field_meta"`
	ConfigID  string         `acp:"configId,py=config_id,req"`
	SessionID string         `acp:"sessionId,py=session_id,req"`
	Value     string         `acp:"value,py=value,req"`
}

type SetSessionModeRequest

type SetSessionModeRequest struct {
	Meta      *pyjson.Object `acp:"_meta,py=field_meta"`
	ModeID    string         `acp:"modeId,py=mode_id,req"`
	SessionID string         `acp:"sessionId,py=session_id,req"`
}

type SetSessionModeResponse

type SetSessionModeResponse struct {
	Meta *pyjson.Object `acp:"_meta,py=field_meta"`
}

type SetSessionModelRequest

type SetSessionModelRequest struct {
	Meta      *pyjson.Object `acp:"_meta,py=field_meta"`
	ModelID   string         `acp:"modelId,py=model_id,req"`
	SessionID string         `acp:"sessionId,py=session_id,req"`
}

type SetSessionModelResponse

type SetSessionModelResponse struct {
	Meta *pyjson.Object `acp:"_meta,py=field_meta"`
}

type SseMcpServer

type SseMcpServer struct {
	Meta    *pyjson.Object `acp:"_meta,py=field_meta"`
	Headers []HttpHeader   `acp:"headers,py=headers,req"`
	Name    string         `acp:"name,py=name,req"`
	URL     string         `acp:"url,py=url,req"`
	// contains filtered or unexported fields
}

type StreamDirection

type StreamDirection string

Direction of a raw JSON-RPC message seen by a stream observer

const (
	StreamIncoming StreamDirection = "incoming"
	StreamOutgoing StreamDirection = "outgoing"
)

type StreamEvent

type StreamEvent struct {
	Direction StreamDirection
	Message   any
}

One raw JSON-RPC message with its direction, a deep copy of the frame

type StreamObserver

type StreamObserver func(event StreamEvent)

Callback receiving every raw JSON-RPC message of a connection

type TerminalAuthMethod

type TerminalAuthMethod struct {
	Meta        *pyjson.Object `acp:"_meta,py=field_meta"`
	Args        []string       `acp:"args,py=args"`
	Description *string        `acp:"description,py=description"`
	Env         *pyjson.Object `acp:"env,py=env"`
	ID          string         `acp:"id,py=id,req"`
	Name        string         `acp:"name,py=name,req"`
	// contains filtered or unexported fields
}

type TerminalExitStatus

type TerminalExitStatus struct {
	Meta     *pyjson.Object `acp:"_meta,py=field_meta"`
	ExitCode *int           `acp:"exitCode,py=exit_code"`
	Signal   *string        `acp:"signal,py=signal"`
}

type TerminalOutputRequest

type TerminalOutputRequest struct {
	Meta       *pyjson.Object `acp:"_meta,py=field_meta"`
	SessionID  string         `acp:"sessionId,py=session_id,req"`
	TerminalID string         `acp:"terminalId,py=terminal_id,req"`
}

type TerminalOutputResponse

type TerminalOutputResponse struct {
	Meta       *pyjson.Object      `acp:"_meta,py=field_meta"`
	ExitStatus *TerminalExitStatus `acp:"exitStatus,py=exit_status"`
	Output     string              `acp:"output,py=output,req"`
	Truncated  bool                `acp:"truncated,py=truncated,req"`
}

type TerminalToolCallContent

type TerminalToolCallContent struct {
	Meta       *pyjson.Object `acp:"_meta,py=field_meta"`
	TerminalID string         `acp:"terminalId,py=terminal_id,req"`
	// contains filtered or unexported fields
}

type TextContentBlock

type TextContentBlock struct {
	Meta        *pyjson.Object `acp:"_meta,py=field_meta"`
	Annotations *Annotations   `acp:"annotations,py=annotations"`
	Text        string         `acp:"text,py=text,req"`
	// contains filtered or unexported fields
}

func TextBlock

func TextBlock(text string) *TextContentBlock

Text content block

type TextResourceContents

type TextResourceContents struct {
	Meta     *pyjson.Object `acp:"_meta,py=field_meta"`
	MimeType *string        `acp:"mimeType,py=mime_type"`
	Text     string         `acp:"text,py=text,req"`
	URI      string         `acp:"uri,py=uri,req"`
}

type ToolCallContent

type ToolCallContent interface {
	// contains filtered or unexported methods
}

type ToolCallFields

type ToolCallFields struct {
	Title     *string
	Kind      *string
	Status    *string
	Content   []ToolCallContent
	Locations []ToolCallLocation
	RawInput  any
	RawOutput any
}

Optional fields of a tool call start or progress update

type ToolCallLocation

type ToolCallLocation struct {
	Meta *pyjson.Object `acp:"_meta,py=field_meta"`
	Line *int           `acp:"line,py=line"`
	Path string         `acp:"path,py=path,req"`
}

type ToolCallProgress

type ToolCallProgress struct {
	Meta       *pyjson.Object     `acp:"_meta,py=field_meta"`
	Content    []ToolCallContent  `acp:"content,py=content,union=ContentToolCallContent|FileEditToolCallContent|TerminalToolCallContent"`
	Kind       *string            `acp:"kind,py=kind,enum=read|edit|delete|move|search|execute|think|fetch|switch_mode|other"`
	Locations  []ToolCallLocation `acp:"locations,py=locations"`
	RawInput   any                `acp:"rawInput,py=raw_input"`
	RawOutput  any                `acp:"rawOutput,py=raw_output"`
	Status     *string            `acp:"status,py=status,enum=pending|in_progress|completed|failed"`
	Title      *string            `acp:"title,py=title"`
	ToolCallID string             `acp:"toolCallId,py=tool_call_id,req"`
	// contains filtered or unexported fields
}

func UpdateToolCall

func UpdateToolCall(toolCallID string, f ToolCallFields) *ToolCallProgress

Tool call progress update

type ToolCallStart

type ToolCallStart struct {
	Meta       *pyjson.Object     `acp:"_meta,py=field_meta"`
	Content    []ToolCallContent  `acp:"content,py=content,union=ContentToolCallContent|FileEditToolCallContent|TerminalToolCallContent"`
	Kind       *string            `acp:"kind,py=kind,enum=read|edit|delete|move|search|execute|think|fetch|switch_mode|other"`
	Locations  []ToolCallLocation `acp:"locations,py=locations"`
	RawInput   any                `acp:"rawInput,py=raw_input"`
	RawOutput  any                `acp:"rawOutput,py=raw_output"`
	Status     *string            `acp:"status,py=status,enum=pending|in_progress|completed|failed"`
	Title      string             `acp:"title,py=title,req"`
	ToolCallID string             `acp:"toolCallId,py=tool_call_id,req"`
	// contains filtered or unexported fields
}

func StartToolCall

func StartToolCall(toolCallID, title string, f ToolCallFields) *ToolCallStart

Tool call start update

type ToolCallUpdate

type ToolCallUpdate struct {
	Meta       *pyjson.Object     `acp:"_meta,py=field_meta"`
	Content    []ToolCallContent  `acp:"content,py=content,union=ContentToolCallContent|FileEditToolCallContent|TerminalToolCallContent"`
	Kind       *string            `acp:"kind,py=kind,enum=read|edit|delete|move|search|execute|think|fetch|switch_mode|other"`
	Locations  []ToolCallLocation `acp:"locations,py=locations"`
	RawInput   any                `acp:"rawInput,py=raw_input"`
	RawOutput  any                `acp:"rawOutput,py=raw_output"`
	Status     *string            `acp:"status,py=status,enum=pending|in_progress|completed|failed"`
	Title      *string            `acp:"title,py=title"`
	ToolCallID string             `acp:"toolCallId,py=tool_call_id,req"`
}

type UnstructuredCommandInput

type UnstructuredCommandInput struct {
	Meta *pyjson.Object `acp:"_meta,py=field_meta"`
	Hint string         `acp:"hint,py=hint,req"`
}

type Usage

type Usage struct {
	CachedReadTokens  *int `acp:"cachedReadTokens,py=cached_read_tokens"`
	CachedWriteTokens *int `acp:"cachedWriteTokens,py=cached_write_tokens"`
	InputTokens       int  `acp:"inputTokens,py=input_tokens,req"`
	OutputTokens      int  `acp:"outputTokens,py=output_tokens,req"`
	ThoughtTokens     *int `acp:"thoughtTokens,py=thought_tokens"`
	TotalTokens       int  `acp:"totalTokens,py=total_tokens,req"`
}

type UsageUpdate

type UsageUpdate struct {
	Meta *pyjson.Object `acp:"_meta,py=field_meta"`
	Cost *Cost          `acp:"cost,py=cost"`
	Size int            `acp:"size,py=size,req"`
	Used int            `acp:"used,py=used,req"`
	// contains filtered or unexported fields
}

type UserMessageChunk

type UserMessageChunk struct {
	Meta      *pyjson.Object `acp:"_meta,py=field_meta"`
	Content   ContentBlock   `` /* 137-byte string literal not displayed */
	MessageID *string        `acp:"messageId,py=message_id"`
	// contains filtered or unexported fields
}

func UpdateUserMessage

func UpdateUserMessage(content ContentBlock) *UserMessageChunk

User message chunk update

func UpdateUserMessageText

func UpdateUserMessageText(text string) *UserMessageChunk

User message chunk update of plain text

type ValidationError

type ValidationError struct {
	Title string
	Errs  []*pyjson.Object
}

Pydantic ValidationError carrying the errors() list of a failed model_validate

func (*ValidationError) Error

func (e *ValidationError) Error() string

Pydantic str form listing each error with its location, message and input

func (*ValidationError) Errors

func (e *ValidationError) Errors() []any

The errors() list as JSON values

type WaitForTerminalExitRequest

type WaitForTerminalExitRequest struct {
	Meta       *pyjson.Object `acp:"_meta,py=field_meta"`
	SessionID  string         `acp:"sessionId,py=session_id,req"`
	TerminalID string         `acp:"terminalId,py=terminal_id,req"`
}

type WaitForTerminalExitResponse

type WaitForTerminalExitResponse struct {
	Meta     *pyjson.Object `acp:"_meta,py=field_meta"`
	ExitCode *int           `acp:"exitCode,py=exit_code"`
	Signal   *string        `acp:"signal,py=signal"`
}

type WriteTextFileRequest

type WriteTextFileRequest struct {
	Meta      *pyjson.Object `acp:"_meta,py=field_meta"`
	Content   string         `acp:"content,py=content,req"`
	Path      string         `acp:"path,py=path,req"`
	SessionID string         `acp:"sessionId,py=session_id,req"`
}

type WriteTextFileResponse

type WriteTextFileResponse struct {
	Meta *pyjson.Object `acp:"_meta,py=field_meta"`
}

Jump to

Keyboard shortcuts

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