Documentation
¶
Overview ¶
Package acp speaks the Agent Client Protocol, which editors and agents talk to each other in: JSON-RPC 2.0 messages, one to a line, over a stream both ends read and write. It holds the connection, the messages of the protocol and the names of its methods, for an agent that serves an editor and for a client that drives an agent alike
Index ¶
- Constants
- Variables
- func RequestID(ctx context.Context) json.RawMessage
- type AgentCapabilities
- type Annotations
- type AuthEnvVar
- type AuthMethod
- type AuthenticateRequest
- type AvailableCommand
- type AvailableCommands
- type ClientCapabilities
- type CommandInput
- type ConfigChoice
- type ConfigGroup
- type ConfigOptions
- type Conn
- func (c *Conn) Call(ctx context.Context, method string, params, result any) error
- func (c *Conn) Close() error
- func (c *Conn) Done() <-chan struct{}
- func (c *Conn) Limit(longest int) *Conn
- func (c *Conn) Notify(method string, params any) error
- func (c *Conn) Serve(ctx context.Context) error
- func (c *Conn) Settle(ctx context.Context) error
- type ContentBlock
- type Cost
- type CreateTerminalRequest
- type CreateTerminalResponse
- type CurrentMode
- type Diff
- type ElicitationCapability
- type ElicitationRequest
- type ElicitationResponse
- type EmbeddedResource
- type Error
- type FileSystemCapabilities
- type Handler
- type Implementation
- type InitializeRequest
- type InitializeResponse
- type ListSessionsRequest
- type ListSessionsResponse
- type MCPCapabilities
- type MCPServer
- type MediaContent
- type MessageChunk
- type Meta
- type ModelInfo
- type Named
- type PermissionOption
- type PermissionOutcome
- type Plan
- type PlanEntry
- type PromptCapabilities
- type PromptRequest
- type PromptResponse
- type ReadTextFileRequest
- type ReadTextFileResponse
- type RequestPermissionRequest
- type RequestPermissionResponse
- type ResourceContents
- type ResourceLink
- type SessionCapabilities
- type SessionConfigOption
- type SessionInfo
- type SessionInfoUpdate
- type SessionMode
- type SessionModeState
- type SessionModelState
- type SessionNamed
- type SessionNotification
- type SessionRequest
- type SessionState
- type SessionUpdate
- type SetSessionConfigOptionRequest
- type SetSessionConfigOptionResponse
- type SetSessionModeRequest
- type SetSessionModelRequest
- type TerminalExitStatus
- type TerminalOutputResponse
- type TerminalRef
- type TerminalRequest
- type TextContent
- type Then
- type TooLong
- type ToolCall
- type ToolCallContent
- type ToolCallLocation
- type ToolCallUpdate
- type Usage
- type UsageUpdate
- type WriteTextFileRequest
Constants ¶
const ( MethodInitialize = "initialize" MethodAuthenticate = "authenticate" MethodSessionNew = "session/new" MethodSessionLoad = "session/load" MethodSessionList = "session/list" MethodSessionClose = "session/close" MethodSessionFork = "session/fork" MethodSessionResume = "session/resume" MethodSessionPrompt = "session/prompt" MethodSessionCancel = "session/cancel" MethodSessionSetMode = "session/set_mode" MethodSessionSetModel = "session/set_model" MethodSessionSetConfigOption = "session/set_config_option" )
Methods an agent answers
const ( MethodSessionUpdate = "session/update" MethodSessionRequestPermission = "session/request_permission" MethodElicitationCreate = "elicitation/create" MethodFSReadTextFile = "fs/read_text_file" MethodFSWriteTextFile = "fs/write_text_file" MethodTerminalCreate = "terminal/create" MethodTerminalOutput = "terminal/output" MethodTerminalRelease = "terminal/release" MethodTerminalWaitForExit = "terminal/wait_for_exit" MethodTerminalKill = "terminal/kill" )
Methods a client answers
const ( StopEndTurn = "end_turn" StopMaxTokens = "max_tokens" StopMaxTurnRequests = "max_turn_requests" StopRefusal = "refusal" StopCancelled = "cancelled" )
Why a prompt stopped being answered
const ( ToolPending = "pending" ToolInProgress = "in_progress" ToolCompleted = "completed" ToolFailed = "failed" )
How a call of a tool stands
const ( KindRead = "read" KindEdit = "edit" KindDelete = "delete" KindMove = "move" KindSearch = "search" KindExecute = "execute" KindThink = "think" KindFetch = "fetch" KindSwitchMode = "switch_mode" KindOther = "other" )
What kind of work a call of a tool is, which decides how an editor shows it
const ( AllowOnce = "allow_once" AllowAlways = "allow_always" RejectOnce = "reject_once" RejectAlways = "reject_always" )
What an answer to a request for permission does
const ( PlanPending = "pending" PlanInProgress = "in_progress" PlanCompleted = "completed" PriorityHigh = "high" PriorityMedium = "medium" PriorityLow = "low" )
How a step of a plan stands, and how much it matters
const ( CodeParseError = -32700 CodeInvalidRequest = -32600 CodeMethodNotFound = -32601 CodeInvalidParams = -32602 CodeInternalError = -32603 CodeAuthRequired = -32000 CodeResourceNotFound = -32002 CodeRequestCancelled = -32800 )
Codes of the failures a request is answered with: those of JSON-RPC, and the protocol's own
const (
DefaultLineLimit = 50 << 20
)
Longest line a connection reads unless it is told another, which leaves room for the pictures a prompt may carry, and how long the requests being answered are given to finish once the other end wrote its last
const MethodCancelRequest = "$/cancel_request"
Notification either end sends to say it no longer waits for the answer to a request it made
const ProtocolVersion = 1
Version of the protocol the package speaks
Variables ¶
var ErrClosed = errors.New("The connection to the other end closed.")
The stream ended or was closed while an answer was waited for
Functions ¶
Types ¶
type AgentCapabilities ¶
type AgentCapabilities struct {
Meta Meta `json:"_meta,omitempty"`
LoadSession bool `json:"loadSession,omitempty"`
PromptCapabilities *PromptCapabilities `json:"promptCapabilities,omitempty"`
MCPCapabilities *MCPCapabilities `json:"mcpCapabilities,omitempty"`
SessionCapabilities *SessionCapabilities `json:"sessionCapabilities,omitempty"`
}
What an agent can do: load a session it kept, what a prompt may carry, the kinds of MCP server it connects to, and what it does with sessions beside answering them
type Annotations ¶
type Annotations struct {
Meta Meta `json:"_meta,omitempty"`
Audience []string `json:"audience,omitempty"`
LastModified string `json:"lastModified,omitempty"`
Priority *float64 `json:"priority,omitempty"`
}
Who a block of content is for, and how much it matters
type AuthEnvVar ¶
type AuthEnvVar struct {
Meta Meta `json:"_meta,omitempty"`
Name string `json:"name"`
Label string `json:"label,omitempty"`
Optional bool `json:"optional,omitempty"`
Secret bool `json:"secret,omitempty"`
}
A variable a way of signing in asks the person for
type AuthMethod ¶
type AuthMethod struct {
Meta Meta `json:"_meta,omitempty"`
Type string `json:"type,omitempty"`
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Link string `json:"link,omitempty"`
Vars []AuthEnvVar `json:"vars,omitempty"`
Args []string `json:"args,omitempty"`
Env map[string]string `json:"env,omitempty"`
}
A way of signing in an agent offers. One with no type is the agent's own to run; env_var asks the client to set variables, and terminal has the client run the agent in a terminal with the arguments and variables given
type AuthenticateRequest ¶
type AvailableCommand ¶
type AvailableCommand struct {
Meta Meta `json:"_meta,omitempty"`
Name string `json:"name"`
Description string `json:"description"`
Input *CommandInput `json:"input,omitempty"`
}
type AvailableCommands ¶
type AvailableCommands struct {
Meta Meta `json:"_meta,omitempty"`
AvailableCommands []AvailableCommand `json:"availableCommands"`
}
type ClientCapabilities ¶
type ClientCapabilities struct {
Meta Meta `json:"_meta,omitempty"`
FS *FileSystemCapabilities `json:"fs,omitempty"`
Terminal bool `json:"terminal,omitempty"`
Elicitation *ElicitationCapability `json:"elicitation,omitempty"`
}
What a client does for the agent: reading and writing files as the editor holds them, running commands in its terminals, and asking its person questions in a form
type CommandInput ¶
What a command takes after its name, as a hint shown where it is typed
type ConfigChoice ¶
type ConfigChoice struct {
Meta Meta `json:"_meta,omitempty"`
Value string `json:"value"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
}
One choice of an option of a session
type ConfigGroup ¶
type ConfigGroup struct {
Meta Meta `json:"_meta,omitempty"`
Group string `json:"group"`
Name string `json:"name"`
Options []ConfigChoice `json:"options"`
}
Choices of an option under a heading of their own
type ConfigOptions ¶
type ConfigOptions struct {
Meta Meta `json:"_meta,omitempty"`
ConfigOptions []SessionConfigOption `json:"configOptions"`
}
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
One end of a conversation in the protocol over a stream: it answers what the other end asks through its handler, and asks the other end in turn
func NewConn ¶
A connection that reads the other end from the reader and writes to it through the writer, answering through the handler. Nothing is read until it is served
func (*Conn) Call ¶
Asks the other end and waits for its answer, which is read into result unless that is nil. A failure the other end answers with is an *Error. The request is given up once the context is done, which the other end is told
func (*Conn) Close ¶
Ends the connection: what is being answered is stopped, and whatever waits for an answer fails. The stream is the caller's to close
func (*Conn) Done ¶
func (c *Conn) Done() <-chan struct{}
Closed once the connection was served to its end, with everything it was answering over
func (*Conn) Serve ¶
Reads the other end until its stream ends, the context is done or the connection is closed, answering what it asks. It returns nil for a stream that ended, and what went wrong otherwise. Every request still waiting for its answer fails once it returns
func (*Conn) Settle ¶
Waits until every notification that had arrived by now was handed over. An answer is read as soon as it arrives, ahead of the notifications that came before it and still wait their turn, so whoever acts on an answer by what the other end told before it settles first. It returns early with the failure of a context that is done, and at once for a connection that ended. Never called from a handler of notifications, which would wait for itself
type ContentBlock ¶
type ContentBlock struct {
Text *TextContent
Image *MediaContent
Audio *MediaContent
Link *ResourceLink
Resource *EmbeddedResource
// The kind of a block that is none of the above, and the block as it came
Other string
Raw json.RawMessage
}
One block of content: text, a picture, a sound, a link to a resource or a resource itself. One of them is set; a block of a kind this package does not know keeps its kind and what it held
func (ContentBlock) MarshalJSON ¶
func (b ContentBlock) MarshalJSON() ([]byte, error)
func (*ContentBlock) UnmarshalJSON ¶
func (b *ContentBlock) UnmarshalJSON(data []byte) error
type CreateTerminalRequest ¶
type CreateTerminalRequest struct {
Meta Meta `json:"_meta,omitempty"`
SessionID string `json:"sessionId"`
Command string `json:"command"`
Args []string `json:"args,omitempty"`
Cwd string `json:"cwd,omitempty"`
Env []Named `json:"env,omitempty"`
OutputByteLimit *int `json:"outputByteLimit,omitempty"`
}
type CreateTerminalResponse ¶
type CurrentMode ¶
type Diff ¶
type Diff struct {
Meta Meta `json:"_meta,omitempty"`
Path string `json:"path"`
OldText *string `json:"oldText,omitempty"`
NewText string `json:"newText"`
}
A change to a file as a call of a tool makes it: the text it had, none for a new file, and the text it gets
type ElicitationCapability ¶
type ElicitationCapability struct {
Form map[string]any `json:"form,omitempty"`
URL map[string]any `json:"url,omitempty"`
}
The ways a client asks its person something for the agent, each present when the client has it
type ElicitationRequest ¶
type ElicitationRequest struct {
Meta Meta `json:"_meta,omitempty"`
SessionID string `json:"sessionId"`
Mode string `json:"mode"`
Message string `json:"message"`
RequestedSchema map[string]any `json:"requestedSchema,omitempty"`
}
Asks the person of a client something in a form whose fields a schema describes
type ElicitationResponse ¶
type ElicitationResponse struct {
Meta Meta `json:"_meta,omitempty"`
Action string `json:"action"`
Content map[string]any `json:"content,omitempty"`
}
What the person did with a form: accept with what they filled in, decline, or cancel
type EmbeddedResource ¶
type EmbeddedResource struct {
Meta Meta `json:"_meta,omitempty"`
Annotations *Annotations `json:"annotations,omitempty"`
Resource ResourceContents `json:"resource"`
}
A resource handed over whole
type Error ¶
type Error struct {
Code int `json:"code"`
Message string `json:"message"`
Data any `json:"data,omitempty"`
}
A failure a request is answered with
func AuthRequired ¶
The agent takes no requests of sessions until the client authenticated
func InternalError ¶
The request failed on this end, for the reason given
func InvalidParams ¶
What a request was sent with can't be what the method takes, for the reason given
type FileSystemCapabilities ¶
type Handler ¶
type Handler interface {
// Answers a request with what is sent back, an empty object for nothing, or with the failure it is refused with. The context ends
// once the connection does, or once the other end says it no longer waits for the answer
Request(ctx context.Context, method string, params json.RawMessage) (any, error)
// Takes a notification. Notifications are handed over one at a time, in the order they arrived
Notification(ctx context.Context, method string, params json.RawMessage)
}
What answers the other end of a connection
type Implementation ¶
type Implementation struct {
Meta Meta `json:"_meta,omitempty"`
Name string `json:"name"`
Title string `json:"title,omitempty"`
Version string `json:"version"`
}
A program that speaks the protocol, as it names itself
type InitializeRequest ¶
type InitializeRequest struct {
Meta Meta `json:"_meta,omitempty"`
ProtocolVersion int `json:"protocolVersion"`
ClientCapabilities *ClientCapabilities `json:"clientCapabilities,omitempty"`
ClientInfo *Implementation `json:"clientInfo,omitempty"`
}
The first request of a client: the version of the protocol it speaks and what it can do for the agent
type InitializeResponse ¶
type InitializeResponse struct {
Meta Meta `json:"_meta,omitempty"`
ProtocolVersion int `json:"protocolVersion"`
AgentCapabilities *AgentCapabilities `json:"agentCapabilities,omitempty"`
AgentInfo *Implementation `json:"agentInfo,omitempty"`
AuthMethods []AuthMethod `json:"authMethods"`
}
type ListSessionsRequest ¶
type ListSessionsResponse ¶
type ListSessionsResponse struct {
Meta Meta `json:"_meta,omitempty"`
Sessions []SessionInfo `json:"sessions"`
NextCursor string `json:"nextCursor,omitempty"`
}
type MCPCapabilities ¶
type MCPServer ¶
type MCPServer struct {
Meta Meta `json:"_meta,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name"`
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
Env []Named `json:"env,omitempty"`
URL string `json:"url,omitempty"`
Headers []Named `json:"headers,omitempty"`
}
An MCP server a client hands a session: one started as a program when it has no type, or one reached over HTTP or SSE
type MediaContent ¶
type MediaContent struct {
Meta Meta `json:"_meta,omitempty"`
Annotations *Annotations `json:"annotations,omitempty"`
Data string `json:"data"`
MimeType string `json:"mimeType"`
URI string `json:"uri,omitempty"`
}
A picture or a sound, its bytes in base64
type MessageChunk ¶
type MessageChunk struct {
Meta Meta `json:"_meta,omitempty"`
Content ContentBlock `json:"content"`
MessageID string `json:"messageId,omitempty"`
}
A part of a message of the person, of the agent, or of what it thought
type Named ¶
type Named struct {
Meta Meta `json:"_meta,omitempty"`
Name string `json:"name"`
Value string `json:"value"`
}
A variable or a header by its name
type PermissionOption ¶
type PermissionOption struct {
Meta Meta `json:"_meta,omitempty"`
OptionID string `json:"optionId"`
Name string `json:"name"`
Kind string `json:"kind"`
}
One answer a person may give a request for permission
type PermissionOutcome ¶
type PermissionOutcome struct {
// The option picked, empty when the prompt was stopped
OptionID string
Cancelled bool
}
What a person answered a request for permission with: the option they picked, or nothing, the prompt having been stopped
func (PermissionOutcome) MarshalJSON ¶
func (o PermissionOutcome) MarshalJSON() ([]byte, error)
func (*PermissionOutcome) UnmarshalJSON ¶
func (o *PermissionOutcome) UnmarshalJSON(data []byte) error
type PromptCapabilities ¶
type PromptRequest ¶
type PromptRequest struct {
Meta Meta `json:"_meta,omitempty"`
SessionID string `json:"sessionId"`
MessageID string `json:"messageId,omitempty"`
Prompt []ContentBlock `json:"prompt"`
}
type PromptResponse ¶
type ReadTextFileRequest ¶
type ReadTextFileResponse ¶
type RequestPermissionRequest ¶
type RequestPermissionRequest struct {
Meta Meta `json:"_meta,omitempty"`
SessionID string `json:"sessionId"`
ToolCall ToolCallUpdate `json:"toolCall"`
Options []PermissionOption `json:"options"`
}
type RequestPermissionResponse ¶
type RequestPermissionResponse struct {
Meta Meta `json:"_meta,omitempty"`
Outcome PermissionOutcome `json:"outcome"`
}
type ResourceContents ¶
type ResourceContents struct {
Meta Meta `json:"_meta,omitempty"`
URI string `json:"uri"`
MimeType string `json:"mimeType,omitempty"`
Text *string `json:"text,omitempty"`
Blob *string `json:"blob,omitempty"`
}
What a resource holds: text, or bytes in base64
type ResourceLink ¶
type ResourceLink struct {
Meta Meta `json:"_meta,omitempty"`
Annotations *Annotations `json:"annotations,omitempty"`
URI string `json:"uri"`
Name string `json:"name"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
MimeType string `json:"mimeType,omitempty"`
Size *int `json:"size,omitempty"`
}
A resource by where it is, which the agent reads itself when it can
type SessionCapabilities ¶
type SessionCapabilities struct {
Meta Meta `json:"_meta,omitempty"`
List *struct{} `json:"list,omitempty"`
Fork *struct{} `json:"fork,omitempty"`
Resume *struct{} `json:"resume,omitempty"`
Close *struct{} `json:"close,omitempty"`
}
What an agent does with sessions beside answering them, each present when the agent does it
type SessionConfigOption ¶
type SessionConfigOption struct {
Meta Meta
ID string
Name string
Description string
// What the option is of, such as mode, model or thought_level, which an editor may show in a place of its own
Category string
// A switch when true, whose value On is; else a choice, whose value Value is, among Choices or, when any, Groups
Boolean bool
On bool
Value string
Choices []ConfigChoice
Groups []ConfigGroup
}
Something a person sets on a session: one of several choices, plain or under headings, or a switch
func (SessionConfigOption) MarshalJSON ¶
func (o SessionConfigOption) MarshalJSON() ([]byte, error)
func (*SessionConfigOption) UnmarshalJSON ¶
func (o *SessionConfigOption) UnmarshalJSON(data []byte) error
type SessionInfo ¶
type SessionInfoUpdate ¶
type SessionMode ¶
type SessionMode struct {
Meta Meta `json:"_meta,omitempty"`
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
}
A way a session works that the person picks, such as asking before each edit
type SessionModeState ¶
type SessionModeState struct {
Meta Meta `json:"_meta,omitempty"`
CurrentModeID string `json:"currentModeId"`
AvailableModes []SessionMode `json:"availableModes"`
}
type SessionModelState ¶
type SessionNamed ¶
A request that names a session and nothing else, such as closing it or stopping its reply
type SessionNotification ¶
type SessionNotification struct {
Meta Meta `json:"_meta,omitempty"`
SessionID string `json:"sessionId"`
Update SessionUpdate `json:"update"`
}
Tells a client what a session did
type SessionRequest ¶
type SessionRequest struct {
Meta Meta `json:"_meta,omitempty"`
SessionID string `json:"sessionId,omitempty"`
Cwd string `json:"cwd"`
MCPServers []MCPServer `json:"mcpServers"`
}
A request about a session in a folder: a new one, or the one named loaded, resumed or forked there
type SessionState ¶
type SessionState struct {
Meta Meta `json:"_meta,omitempty"`
SessionID string `json:"sessionId,omitempty"`
Modes *SessionModeState `json:"modes,omitempty"`
Models *SessionModelState `json:"models,omitempty"`
ConfigOptions []SessionConfigOption `json:"configOptions,omitempty"`
}
What an agent says of a session it made, loaded, resumed or forked: the id of one it made, and what the person can set on it
type SessionUpdate ¶
type SessionUpdate struct {
UserMessage *MessageChunk
AgentMessage *MessageChunk
AgentThought *MessageChunk
ToolCall *ToolCall
ToolCallUpdate *ToolCallUpdate
Plan *Plan
Commands *AvailableCommands
Mode *CurrentMode
Config *ConfigOptions
Info *SessionInfoUpdate
Usage *UsageUpdate
// The kind of an update that is none of the above, and the update as it came
Other string
Raw json.RawMessage
}
One thing a session did that its client is told: a part of a message, a call of a tool or what changed of one, a plan, the commands, the mode, the options, the title, or how full the window is. One of them is set; an update of a kind this package does not know keeps its kind and what it held
func (SessionUpdate) MarshalJSON ¶
func (u SessionUpdate) MarshalJSON() ([]byte, error)
func (*SessionUpdate) UnmarshalJSON ¶
func (u *SessionUpdate) UnmarshalJSON(data []byte) error
type SetSessionConfigOptionRequest ¶
type SetSessionConfigOptionRequest struct {
Meta Meta `json:"_meta,omitempty"`
Type string `json:"type,omitempty"`
SessionID string `json:"sessionId"`
ConfigID string `json:"configId"`
Value any `json:"value"`
}
Sets one option of a session: a choice by its value, or a switch on or off
type SetSessionConfigOptionResponse ¶
type SetSessionConfigOptionResponse struct {
Meta Meta `json:"_meta,omitempty"`
ConfigOptions []SessionConfigOption `json:"configOptions"`
}
type SetSessionModeRequest ¶
type SetSessionModelRequest ¶
type TerminalExitStatus ¶
type TerminalExitStatus struct {
Meta Meta `json:"_meta,omitempty"`
ExitCode *int `json:"exitCode,omitempty"`
Signal *string `json:"signal,omitempty"`
}
How the command of a terminal ended
type TerminalOutputResponse ¶
type TerminalOutputResponse struct {
Meta Meta `json:"_meta,omitempty"`
Output string `json:"output"`
Truncated bool `json:"truncated"`
ExitStatus *TerminalExitStatus `json:"exitStatus,omitempty"`
}
type TerminalRef ¶
type TerminalRef struct {
Meta Meta `json:"_meta,omitempty"`
TerminalID string `json:"terminalId"`
}
A terminal of the client a call of a tool runs in
type TerminalRequest ¶
type TerminalRequest struct {
Meta Meta `json:"_meta,omitempty"`
SessionID string `json:"sessionId"`
TerminalID string `json:"terminalId"`
}
A request about a terminal of the client a session started: its output, its end, killing its command or letting it go
type TextContent ¶
type TextContent struct {
Meta Meta `json:"_meta,omitempty"`
Annotations *Annotations `json:"annotations,omitempty"`
Text string `json:"text"`
}
type Then ¶
type Then struct {
Result any
After func()
}
An answer with something to do once it was written, such as telling the other end what it could not be told before it knew the answer
type ToolCall ¶
type ToolCall struct {
Meta Meta `json:"_meta,omitempty"`
ToolCallID string `json:"toolCallId"`
Title string `json:"title"`
Kind string `json:"kind,omitempty"`
Status string `json:"status,omitempty"`
Content []ToolCallContent `json:"content,omitempty"`
Locations []ToolCallLocation `json:"locations,omitempty"`
RawInput any `json:"rawInput,omitempty"`
RawOutput any `json:"rawOutput,omitempty"`
}
A call of a tool as it starts
type ToolCallContent ¶
type ToolCallContent struct {
Content *ContentBlock
Diff *Diff
Terminal *TerminalRef
}
What a call of a tool shows: content, a change to a file, or a terminal of the client. One of them is set
func (ToolCallContent) MarshalJSON ¶
func (c ToolCallContent) MarshalJSON() ([]byte, error)
func (*ToolCallContent) UnmarshalJSON ¶
func (c *ToolCallContent) UnmarshalJSON(data []byte) error
type ToolCallLocation ¶
type ToolCallLocation struct {
Meta Meta `json:"_meta,omitempty"`
Path string `json:"path"`
Line *int `json:"line,omitempty"`
}
A file a call of a tool is about, with the line where it is at one
type ToolCallUpdate ¶
type ToolCallUpdate struct {
Meta Meta `json:"_meta,omitempty"`
ToolCallID string `json:"toolCallId"`
Title *string `json:"title,omitempty"`
Kind string `json:"kind,omitempty"`
Status string `json:"status,omitempty"`
Content []ToolCallContent `json:"content,omitempty"`
Locations []ToolCallLocation `json:"locations,omitempty"`
RawInput any `json:"rawInput,omitempty"`
RawOutput any `json:"rawOutput,omitempty"`
}
What changed of a call of a tool since it started: only what is set here changes
type Usage ¶
type Usage struct {
InputTokens int `json:"inputTokens"`
OutputTokens int `json:"outputTokens"`
TotalTokens int `json:"totalTokens"`
CachedReadTokens *int `json:"cachedReadTokens,omitempty"`
CachedWriteTokens *int `json:"cachedWriteTokens,omitempty"`
ThoughtTokens *int `json:"thoughtTokens,omitempty"`
}
How many tokens a reply took