diff --git a/Makefile b/Makefile index 8630640..22a8524 100644 --- a/Makefile +++ b/Makefile @@ -11,10 +11,10 @@ version: README.md schema/meta.json schema/schema.json echo $(ACP_VERSION) > $@ schema/meta.json: schema/version - curl -o $@ --fail -L https://raw.githubusercontent.com/agentclientprotocol/agent-client-protocol/refs/tags/v$(ACP_VERSION)/schema/meta.json + curl -o $@ --fail -L https://github.com/agentclientprotocol/agent-client-protocol/releases/download/v$(ACP_VERSION)/meta.json schema/schema.json: schema/version - curl -o $@ --fail -L https://raw.githubusercontent.com/agentclientprotocol/agent-client-protocol/refs/tags/v$(ACP_VERSION)/schema/schema.json + curl -o $@ --fail -L https://github.com/agentclientprotocol/agent-client-protocol/releases/download/v$(ACP_VERSION)/schema.json README.md: schema/version @command -v $(MDSH) >/dev/null || { echo "mdsh not found; run 'nix develop' or install it." 1>&2; exit 1; } diff --git a/README.md b/README.md index 6e95a14..2662d91 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Learn more about the protocol itself at . ```bash -go get github.com/coder/acp-go-sdk@v0.4.5 +go get github.com/coder/acp-go-sdk@v0.4.9 ``` ## Get Started diff --git a/cmd/generate/internal/emit/types.go b/cmd/generate/internal/emit/types.go index 05230e2..0cd600b 100644 --- a/cmd/generate/internal/emit/types.go +++ b/cmd/generate/internal/emit/types.go @@ -237,6 +237,9 @@ func WriteTypesJen(outDir string, schema *load.Schema, meta *load.Meta) error { case ir.BindAgentExperimental: target = &agentExperimentalMethods } + if desc := methodDescription(schema, mi); desc != "" { + *target = append(*target, Comment(util.SanitizeComment(desc))) + } if mi.Notif != "" { name := ir.DispatchMethodNameForNotification(k, mi.Notif) *target = append(*target, Id(name).Params(Id("ctx").Qual("context", "Context"), Id("params").Id(mi.Notif)).Error()) @@ -276,6 +279,9 @@ func WriteTypesJen(outDir string, schema *load.Schema, meta *load.Meta) error { case ir.BindClientTerminal: target = &clientTerminal } + if desc := methodDescription(schema, mi); desc != "" { + *target = append(*target, Comment(util.SanitizeComment(desc))) + } if mi.Notif != "" { name := ir.DispatchMethodNameForNotification(k, mi.Notif) *target = append(*target, Id(name).Params(Id("ctx").Qual("context", "Context"), Id("params").Id(mi.Notif)).Error()) @@ -359,6 +365,23 @@ func emitValidateJen(f *File, name string, def *load.Definition) { } } +func methodDescription(schema *load.Schema, mi *ir.MethodInfo) string { + if mi == nil || mi.DocsIgnored { + return "" + } + // Prefer notification descriptions when present, otherwise fall back to request/response types. + ordered := []string{mi.Notif, mi.Req, mi.Resp} + for _, name := range ordered { + if name == "" { + continue + } + if def := schema.Defs[name]; def != nil && def.Description != "" { + return def.Description + } + } + return "" +} + // Type mapping helpers (unchanged behavior vs original) func primitiveJenType(t string) Code { switch t { @@ -523,13 +546,14 @@ func jenTypeForOptional(d *load.Definition) Code { // (title: UnstructuredCommandInput) with a required 'hint' field. func emitUnion(f *File, name string, defs []*load.Definition, exactlyOne bool) { type variantInfo struct { - fieldName string - typeName string - required []string - isObject bool - discValue string - constPairs [][2]string - isNull bool + fieldName string + typeName string + required []string + isObject bool + discValue string + constPairs [][2]string + isNull bool + description string } variants := []variantInfo{} discKey := "" @@ -630,11 +654,23 @@ func emitUnion(f *File, name string, defs []*load.Definition, exactlyOne bool) { f.Type().Id(tname).Struct(st...) f.Line() } - variants = append(variants, variantInfo{fieldName: fieldName, typeName: tname, required: v.Required, isObject: isObj, discValue: dv, constPairs: consts, isNull: isNull}) + variants = append(variants, variantInfo{ + fieldName: fieldName, + typeName: tname, + required: v.Required, + isObject: isObj, + discValue: dv, + constPairs: consts, + isNull: isNull, + description: v.Description, + }) } // wrapper st := []Code{} for _, vi := range variants { + if vi.description != "" { + st = append(st, Comment(util.SanitizeComment(vi.description))) + } st = append(st, Id(vi.fieldName).Op("*").Id(vi.typeName).Tag(map[string]string{"json": "-"})) } f.Type().Id(name).Struct(st...) diff --git a/schema/schema.json b/schema/schema.json index 96b1378..7db21b6 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -35,9 +35,11 @@ "anyOf": [ { "$ref": "#/$defs/SessionNotification", + "description": "Handles session update notifications from the agent.\n\nThis is a notification endpoint (no response expected) that receives\nreal-time updates about session progress, including message chunks,\ntool calls, and execution plans.\n\nNote: Clients SHOULD continue accepting tool call updates even after\nsending a `session/cancel` notification, as the agent may send final\nupdates before responding with the cancelled stop reason.\n\nSee protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output)", "title": "SessionNotification" }, { + "description": "Handles extension notifications from the agent.\n\nAllows the Agent to send an arbitrary notification that is not part of the ACP spec.\nExtension notifications provide a way to send one-way messages for custom functionality\nwhile maintaining protocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", "title": "ExtNotification" } ], @@ -48,37 +50,46 @@ "anyOf": [ { "$ref": "#/$defs/WriteTextFileRequest", + "description": "Writes content to a text file in the client's file system.\n\nOnly available if the client advertises the `fs.writeTextFile` capability.\nAllows the agent to create or modify files within the client's environment.\n\nSee protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client)", "title": "WriteTextFileRequest" }, { "$ref": "#/$defs/ReadTextFileRequest", + "description": "Reads content from a text file in the client's file system.\n\nOnly available if the client advertises the `fs.readTextFile` capability.\nAllows the agent to access file contents within the client's environment.\n\nSee protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client)", "title": "ReadTextFileRequest" }, { "$ref": "#/$defs/RequestPermissionRequest", + "description": "Requests permission from the user for a tool call operation.\n\nCalled by the agent when it needs user authorization before executing\na potentially sensitive operation. The client should present the options\nto the user and return their decision.\n\nIf the client cancels the prompt turn via `session/cancel`, it MUST\nrespond to this request with `RequestPermissionOutcome::Cancelled`.\n\nSee protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission)", "title": "RequestPermissionRequest" }, { "$ref": "#/$defs/CreateTerminalRequest", + "description": "Executes a command in a new terminal\n\nOnly available if the `terminal` Client capability is set to `true`.\n\nReturns a `TerminalId` that can be used with other terminal methods\nto get the current output, wait for exit, and kill the command.\n\nThe `TerminalId` can also be used to embed the terminal in a tool call\nby using the `ToolCallContent::Terminal` variant.\n\nThe Agent is responsible for releasing the terminal by using the `terminal/release`\nmethod.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)", "title": "CreateTerminalRequest" }, { "$ref": "#/$defs/TerminalOutputRequest", + "description": "Gets the terminal output and exit status\n\nReturns the current content in the terminal without waiting for the command to exit.\nIf the command has already exited, the exit status is included.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)", "title": "TerminalOutputRequest" }, { "$ref": "#/$defs/ReleaseTerminalRequest", + "description": "Releases a terminal\n\nThe command is killed if it hasn't exited yet. Use `terminal/wait_for_exit`\nto wait for the command to exit before releasing the terminal.\n\nAfter release, the `TerminalId` can no longer be used with other `terminal/*` methods,\nbut tool calls that already contain it, continue to display its output.\n\nThe `terminal/kill` method can be used to terminate the command without releasing\nthe terminal, allowing the Agent to call `terminal/output` and other methods.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)", "title": "ReleaseTerminalRequest" }, { "$ref": "#/$defs/WaitForTerminalExitRequest", + "description": "Waits for the terminal command to exit and return its exit status\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)", "title": "WaitForTerminalExitRequest" }, { "$ref": "#/$defs/KillTerminalCommandRequest", + "description": "Kills the terminal command without releasing the terminal\n\nWhile `terminal/release` will also kill the command, this method will keep\nthe `TerminalId` valid so it can be used with other methods.\n\nThis method can be helpful when implementing command timeouts which terminate\nthe command as soon as elapsed, and then get the final output so it can be sent\nto the model.\n\nNote: `terminal/release` when `TerminalId` is no longer needed.\n\nSee protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals)", "title": "KillTerminalCommandRequest" }, { + "description": "Handles extension method requests from the agent.\n\nAllows the Agent to send an arbitrary request that is not part of the ACP spec.\nExtension methods provide a way to add custom functionality while maintaining\nprotocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", "title": "ExtMethodRequest" } ], @@ -330,9 +341,11 @@ "anyOf": [ { "$ref": "#/$defs/CancelNotification", + "description": "Cancels ongoing operations for a session.\n\nThis is a notification sent by the client to cancel an ongoing prompt turn.\n\nUpon receiving this notification, the Agent SHOULD:\n- Stop all language model requests as soon as possible\n- Abort all tool call invocations in progress\n- Send any pending `session/update` notifications\n- Respond to the original `session/prompt` request with `StopReason::Cancelled`\n\nSee protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)", "title": "CancelNotification" }, { + "description": "Handles extension notifications from the client.\n\nExtension notifications provide a way to send one-way messages for custom functionality\nwhile maintaining protocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", "title": "ExtNotification" } ], @@ -343,33 +356,41 @@ "anyOf": [ { "$ref": "#/$defs/InitializeRequest", + "description": "Establishes the connection with a client and negotiates protocol capabilities.\n\nThis method is called once at the beginning of the connection to:\n- Negotiate the protocol version to use\n- Exchange capability information between client and agent\n- Determine available authentication methods\n\nThe agent should respond with its supported protocol version and capabilities.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)", "title": "InitializeRequest" }, { "$ref": "#/$defs/AuthenticateRequest", + "description": "Authenticates the client using the specified authentication method.\n\nCalled when the agent requires authentication before allowing session creation.\nThe client provides the authentication method ID that was advertised during initialization.\n\nAfter successful authentication, the client can proceed to create sessions with\n`new_session` without receiving an `auth_required` error.\n\nSee protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)", "title": "AuthenticateRequest" }, { "$ref": "#/$defs/NewSessionRequest", + "description": "Creates a new conversation session with the agent.\n\nSessions represent independent conversation contexts with their own history and state.\n\nThe agent should:\n- Create a new session context\n- Connect to any specified MCP servers\n- Return a unique session ID for future requests\n\nMay return an `auth_required` error if the agent requires authentication.\n\nSee protocol docs: [Session Setup](https://agentclientprotocol.com/protocol/session-setup)", "title": "NewSessionRequest" }, { "$ref": "#/$defs/LoadSessionRequest", + "description": "Loads an existing session to resume a previous conversation.\n\nThis method is only available if the agent advertises the `loadSession` capability.\n\nThe agent should:\n- Restore the session context and conversation history\n- Connect to the specified MCP servers\n- Stream the entire conversation history back to the client via notifications\n\nSee protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions)", "title": "LoadSessionRequest" }, { "$ref": "#/$defs/SetSessionModeRequest", + "description": "Sets the current mode for a session.\n\nAllows switching between different agent modes (e.g., \"ask\", \"architect\", \"code\")\nthat affect system prompts, tool availability, and permission behaviors.\n\nThe mode must be one of the modes advertised in `availableModes` during session\ncreation or loading. Agents may also change modes autonomously and notify the\nclient via `current_mode_update` notifications.\n\nThis method can be called at any time during a session, whether the Agent is\nidle or actively generating a response.\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)", "title": "SetSessionModeRequest" }, { "$ref": "#/$defs/PromptRequest", + "description": "Processes a user prompt within a session.\n\nThis method handles the whole lifecycle of a prompt:\n- Receives user messages with optional context (files, images, etc.)\n- Processes the prompt using language models\n- Reports language model content and tool calls to the Clients\n- Requests permission to run tools\n- Executes any requested tool calls\n- Returns when the turn is complete with a stop reason\n\nSee protocol docs: [Prompt Turn](https://agentclientprotocol.com/protocol/prompt-turn)", "title": "PromptRequest" }, { "$ref": "#/$defs/SetSessionModelRequest", + "description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nSelect a model for a given session.", "title": "SetSessionModelRequest" }, { + "description": "Handles extension method requests from the client.\n\nExtension methods provide a way to add custom functionality while maintaining\nprotocol compatibility.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)", "title": "ExtMethodRequest" } ], diff --git a/schema/version b/schema/version index 0bfccb0..76914dd 100644 --- a/schema/version +++ b/schema/version @@ -1 +1 @@ -0.4.5 +0.4.9 diff --git a/types_gen.go b/types_gen.go index 6e91ba7..7c3eb7a 100644 --- a/types_gen.go +++ b/types_gen.go @@ -68,6 +68,7 @@ func (v *AgentCapabilities) UnmarshalJSON(b []byte) error { // All possible notifications that an agent can send to a client. This enum is used internally for routing RPC notifications. You typically won't need to use this directly - use the notification methods on the ['Client'] trait instead. Notifications do not expect a response. type AgentNotification struct { + // Handles session update notifications from the agent. This is a notification endpoint (no response expected) that receives real-time updates about session progress, including message chunks, tool calls, and execution plans. Note: Clients SHOULD continue accepting tool call updates even after sending a 'session/cancel' notification, as the agent may send final updates before responding with the cancelled stop reason. See protocol docs: [Agent Reports Output](https://agentclientprotocol.com/protocol/prompt-turn#3-agent-reports-output) SessionNotification *SessionNotification `json:"-"` } @@ -102,13 +103,21 @@ func (u AgentNotification) MarshalJSON() ([]byte, error) { // All possible requests that an agent can send to a client. This enum is used internally for routing RPC requests. You typically won't need to use this directly - instead, use the methods on the ['Client'] trait. This enum encompasses all method calls from agent to client. type AgentRequest struct { - WriteTextFileRequest *WriteTextFileRequest `json:"-"` - ReadTextFileRequest *ReadTextFileRequest `json:"-"` - RequestPermissionRequest *RequestPermissionRequest `json:"-"` - CreateTerminalRequest *CreateTerminalRequest `json:"-"` - TerminalOutputRequest *TerminalOutputRequest `json:"-"` - ReleaseTerminalRequest *ReleaseTerminalRequest `json:"-"` + // Writes content to a text file in the client's file system. Only available if the client advertises the 'fs.writeTextFile' capability. Allows the agent to create or modify files within the client's environment. See protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client) + WriteTextFileRequest *WriteTextFileRequest `json:"-"` + // Reads content from a text file in the client's file system. Only available if the client advertises the 'fs.readTextFile' capability. Allows the agent to access file contents within the client's environment. See protocol docs: [Client](https://agentclientprotocol.com/protocol/overview#client) + ReadTextFileRequest *ReadTextFileRequest `json:"-"` + // Requests permission from the user for a tool call operation. Called by the agent when it needs user authorization before executing a potentially sensitive operation. The client should present the options to the user and return their decision. If the client cancels the prompt turn via 'session/cancel', it MUST respond to this request with 'RequestPermissionOutcome::Cancelled'. See protocol docs: [Requesting Permission](https://agentclientprotocol.com/protocol/tool-calls#requesting-permission) + RequestPermissionRequest *RequestPermissionRequest `json:"-"` + // Executes a command in a new terminal Only available if the 'terminal' Client capability is set to 'true'. Returns a 'TerminalId' that can be used with other terminal methods to get the current output, wait for exit, and kill the command. The 'TerminalId' can also be used to embed the terminal in a tool call by using the 'ToolCallContent::Terminal' variant. The Agent is responsible for releasing the terminal by using the 'terminal/release' method. See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals) + CreateTerminalRequest *CreateTerminalRequest `json:"-"` + // Gets the terminal output and exit status Returns the current content in the terminal without waiting for the command to exit. If the command has already exited, the exit status is included. See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals) + TerminalOutputRequest *TerminalOutputRequest `json:"-"` + // Releases a terminal The command is killed if it hasn't exited yet. Use 'terminal/wait_for_exit' to wait for the command to exit before releasing the terminal. After release, the 'TerminalId' can no longer be used with other 'terminal/*' methods, but tool calls that already contain it, continue to display its output. The 'terminal/kill' method can be used to terminate the command without releasing the terminal, allowing the Agent to call 'terminal/output' and other methods. See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals) + ReleaseTerminalRequest *ReleaseTerminalRequest `json:"-"` + // Waits for the terminal command to exit and return its exit status See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals) WaitForTerminalExitRequest *WaitForTerminalExitRequest `json:"-"` + // Kills the terminal command without releasing the terminal While 'terminal/release' will also kill the command, this method will keep the 'TerminalId' valid so it can be used with other methods. This method can be helpful when implementing command timeouts which terminate the command as soon as elapsed, and then get the final output so it can be sent to the model. Note: 'terminal/release' when 'TerminalId' is no longer needed. See protocol docs: [Terminals](https://agentclientprotocol.com/protocol/terminals) KillTerminalCommandRequest *KillTerminalCommandRequest `json:"-"` } @@ -490,6 +499,7 @@ type UnstructuredCommandInput struct { } type AvailableCommandInput struct { + // All text that was typed after the command name is provided as input. UnstructuredCommandInput *UnstructuredCommandInput `json:"-"` } @@ -606,6 +616,7 @@ func (v *ClientCapabilities) UnmarshalJSON(b []byte) error { // All possible notifications that a client can send to an agent. This enum is used internally for routing RPC notifications. You typically won't need to use this directly - use the notification methods on the ['Agent'] trait instead. Notifications do not expect a response. type ClientNotification struct { + // Cancels ongoing operations for a session. This is a notification sent by the client to cancel an ongoing prompt turn. Upon receiving this notification, the Agent SHOULD: - Stop all language model requests as soon as possible - Abort all tool call invocations in progress - Send any pending 'session/update' notifications - Respond to the original 'session/prompt' request with 'StopReason::Cancelled' See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation) CancelNotification *CancelNotification `json:"-"` } @@ -640,12 +651,19 @@ func (u ClientNotification) MarshalJSON() ([]byte, error) { // All possible requests that a client can send to an agent. This enum is used internally for routing RPC requests. You typically won't need to use this directly - instead, use the methods on the ['Agent'] trait. This enum encompasses all method calls from client to agent. type ClientRequest struct { - InitializeRequest *InitializeRequest `json:"-"` - AuthenticateRequest *AuthenticateRequest `json:"-"` - NewSessionRequest *NewSessionRequest `json:"-"` - LoadSessionRequest *LoadSessionRequest `json:"-"` - SetSessionModeRequest *SetSessionModeRequest `json:"-"` - PromptRequest *PromptRequest `json:"-"` + // Establishes the connection with a client and negotiates protocol capabilities. This method is called once at the beginning of the connection to: - Negotiate the protocol version to use - Exchange capability information between client and agent - Determine available authentication methods The agent should respond with its supported protocol version and capabilities. See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization) + InitializeRequest *InitializeRequest `json:"-"` + // Authenticates the client using the specified authentication method. Called when the agent requires authentication before allowing session creation. The client provides the authentication method ID that was advertised during initialization. After successful authentication, the client can proceed to create sessions with 'new_session' without receiving an 'auth_required' error. See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization) + AuthenticateRequest *AuthenticateRequest `json:"-"` + // Creates a new conversation session with the agent. Sessions represent independent conversation contexts with their own history and state. The agent should: - Create a new session context - Connect to any specified MCP servers - Return a unique session ID for future requests May return an 'auth_required' error if the agent requires authentication. See protocol docs: [Session Setup](https://agentclientprotocol.com/protocol/session-setup) + NewSessionRequest *NewSessionRequest `json:"-"` + // Loads an existing session to resume a previous conversation. This method is only available if the agent advertises the 'loadSession' capability. The agent should: - Restore the session context and conversation history - Connect to the specified MCP servers - Stream the entire conversation history back to the client via notifications See protocol docs: [Loading Sessions](https://agentclientprotocol.com/protocol/session-setup#loading-sessions) + LoadSessionRequest *LoadSessionRequest `json:"-"` + // Sets the current mode for a session. Allows switching between different agent modes (e.g., "ask", "architect", "code") that affect system prompts, tool availability, and permission behaviors. The mode must be one of the modes advertised in 'availableModes' during session creation or loading. Agents may also change modes autonomously and notify the client via 'current_mode_update' notifications. This method can be called at any time during a session, whether the Agent is idle or actively generating a response. See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) + SetSessionModeRequest *SetSessionModeRequest `json:"-"` + // Processes a user prompt within a session. This method handles the whole lifecycle of a prompt: - Receives user messages with optional context (files, images, etc.) - Processes the prompt using language models - Reports language model content and tool calls to the Clients - Requests permission to run tools - Executes any requested tool calls - Returns when the turn is complete with a stop reason See protocol docs: [Prompt Turn](https://agentclientprotocol.com/protocol/prompt-turn) + PromptRequest *PromptRequest `json:"-"` + // **UNSTABLE** This capability is not part of the spec yet, and may be removed or changed at any point. Select a model for a given session. SetSessionModelRequest *SetSessionModelRequest `json:"-"` } @@ -1008,11 +1026,16 @@ type ContentBlockResource struct { } type ContentBlock struct { - Text *ContentBlockText `json:"-"` - Image *ContentBlockImage `json:"-"` - Audio *ContentBlockAudio `json:"-"` + // Plain text content All agents MUST support text content blocks in prompts. + 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:"-"` - Resource *ContentBlockResource `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 (u *ContentBlock) UnmarshalJSON(b []byte) error { @@ -1768,9 +1791,12 @@ type Stdio struct { } type McpServer struct { - Http *McpServerHttp `json:"-"` - Sse *McpServerSse `json:"-"` - Stdio *Stdio `json:"-"` + // HTTP transport configuration Only available when the Agent capabilities indicate 'mcp_capabilities.http' is 'true'. + Http *McpServerHttp `json:"-"` + // SSE transport configuration Only available when the Agent capabilities indicate 'mcp_capabilities.sse' is 'true'. + Sse *McpServerSse `json:"-"` + // Stdio transport configuration All Agents MUST support this transport. + Stdio *Stdio `json:"-"` } func (u *McpServer) UnmarshalJSON(b []byte) error { @@ -2210,8 +2236,10 @@ type RequestPermissionOutcomeSelected struct { } 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/prompt-turn#cancellation) Cancelled *RequestPermissionOutcomeCancelled `json:"-"` - Selected *RequestPermissionOutcomeSelected `json:"-"` + // The user selected one of the provided options. + Selected *RequestPermissionOutcomeSelected `json:"-"` } func (u *RequestPermissionOutcome) UnmarshalJSON(b []byte) error { @@ -2518,14 +2546,22 @@ type SessionUpdateCurrentModeUpdate struct { } type SessionUpdate struct { - UserMessageChunk *SessionUpdateUserMessageChunk `json:"-"` - AgentMessageChunk *SessionUpdateAgentMessageChunk `json:"-"` - AgentThoughtChunk *SessionUpdateAgentThoughtChunk `json:"-"` - ToolCall *SessionUpdateToolCall `json:"-"` - ToolCallUpdate *SessionUpdateToolCallUpdate `json:"-"` - Plan *SessionUpdatePlan `json:"-"` + // 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 *SessionUpdateToolCallUpdate `json:"-"` + // The agent's execution plan for complex tasks. See protocol docs: [Agent Plan](https://agentclientprotocol.com/protocol/agent-plan) + Plan *SessionUpdatePlan `json:"-"` + // Available commands are ready or have changed AvailableCommandsUpdate *SessionUpdateAvailableCommandsUpdate `json:"-"` - CurrentModeUpdate *SessionUpdateCurrentModeUpdate `json:"-"` + // The current mode of the session has changed See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes) + CurrentModeUpdate *SessionUpdateCurrentModeUpdate `json:"-"` } func (u *SessionUpdate) UnmarshalJSON(b []byte) error { @@ -3097,8 +3133,11 @@ type ToolCallContentTerminal struct { } type ToolCallContent struct { - Content *ToolCallContentContent `json:"-"` - Diff *ToolCallContentDiff `json:"-"` + // 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/terminal) Terminal *ToolCallContentTerminal `json:"-"` } @@ -3402,32 +3441,49 @@ func (v *WriteTextFileResponse) Validate() error { } type Agent interface { + // Request parameters for the authenticate method. Specifies which authentication method to use. Authenticate(ctx context.Context, params AuthenticateRequest) (AuthenticateResponse, error) + // Request parameters for the initialize method. Sent by the client to establish connection and negotiate capabilities. See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/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/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/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/prompt-turn#1-user-message) Prompt(ctx context.Context, params PromptRequest) (PromptResponse, error) + // Request parameters for setting a session mode. SetSessionMode(ctx context.Context, params SetSessionModeRequest) (SetSessionModeResponse, error) } // AgentLoader defines optional support for loading sessions. Implement and advertise the capability to enable 'session/load'. 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/session-setup#loading-sessions) LoadSession(ctx context.Context, params LoadSessionRequest) (LoadSessionResponse, error) } // AgentExperimental defines unstable methods that are not part of the official spec. These may change or be removed without notice. type AgentExperimental interface { + // **UNSTABLE** This capability is not part of the spec yet, and may be removed or changed at any point. Request parameters for setting a session model. SetSessionModel(ctx context.Context, params SetSessionModelRequest) (SetSessionModelResponse, error) } type Client 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) + // 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) + // 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/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/prompt-turn#3-agent-reports-output) SessionUpdate(ctx context.Context, params SessionNotification) error + // Request to create a new terminal and execute a command. CreateTerminal(ctx context.Context, params CreateTerminalRequest) (CreateTerminalResponse, error) + // Request to kill a terminal command without releasing the terminal. KillTerminalCommand(ctx context.Context, params KillTerminalCommandRequest) (KillTerminalCommandResponse, 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) } diff --git a/version b/version index 0bfccb0..76914dd 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.4.5 +0.4.9