Documentation
¶
Overview ¶
Package rpc provides a minimal JSON-RPC client tailored to the Codex app-server. Notification subscriptions have a hard caller-selected capacity. A slow consumer is closed with NotificationOverflowError without blocking responses or other subscribers. The package intentionally implements only the subset needed for Codex. For general-purpose JSON-RPC support, consider using a dedicated library.
Index ¶
- Constants
- Variables
- func DefaultStderr() io.Writer
- func ReadLineLimited(reader *bufio.Reader, maxBytes int) (string, error)
- type Client
- func (c *Client) AccountLoginCancel(ctx context.Context, params protocol.CancelLoginAccountParams) (*protocol.CancelLoginAccountResponse, error)
- func (c *Client) AccountLoginStart(ctx context.Context, params protocol.LoginAccountParams) (*protocol.LoginAccountResponse, error)
- func (c *Client) AccountLogout(ctx context.Context) (*protocol.LogoutAccountResponse, error)
- func (c *Client) AccountRateLimitResetCreditConsume(ctx context.Context, params protocol.ConsumeAccountRateLimitResetCreditParams) (*protocol.ConsumeAccountRateLimitResetCreditResponse, error)
- func (c *Client) AccountRateLimitsRead(ctx context.Context) (*protocol.GetAccountRateLimitsResponse, error)
- func (c *Client) AccountRead(ctx context.Context, params protocol.GetAccountParams) (*protocol.GetAccountResponse, error)
- func (c *Client) AccountSendAddCreditsNudgeEmail(ctx context.Context, params protocol.SendAddCreditsNudgeEmailParams) (*protocol.SendAddCreditsNudgeEmailResponse, error)
- func (c *Client) AccountUsageRead(ctx context.Context) (*protocol.GetAccountTokenUsageResponse, error)
- func (c *Client) AccountWorkspaceMessagesRead(ctx context.Context) (*protocol.GetWorkspaceMessagesResponse, error)
- func (c *Client) AppInstalled(ctx context.Context, params protocol.AppsInstalledParams) (*protocol.AppsInstalledResponse, error)
- func (c *Client) AppList(ctx context.Context, params protocol.AppsListParams) (*protocol.AppsListResponse, error)
- func (c *Client) AppRead(ctx context.Context, params protocol.AppsReadParams) (*protocol.AppsReadResponse, error)
- func (c *Client) Call(ctx context.Context, method string, params any, result any) error
- func (c *Client) Close() error
- func (c *Client) CommandExec(ctx context.Context, params protocol.CommandExecParams) (*protocol.CommandExecResponse, error)
- func (c *Client) CommandExecResize(ctx context.Context, params protocol.CommandExecResizeParams) (*protocol.CommandExecResizeResponse, error)
- func (c *Client) CommandExecTerminate(ctx context.Context, params protocol.CommandExecTerminateParams) (*protocol.CommandExecTerminateResponse, error)
- func (c *Client) CommandExecWrite(ctx context.Context, params protocol.CommandExecWriteParams) (*protocol.CommandExecWriteResponse, error)
- func (c *Client) ConfigBatchWrite(ctx context.Context, params protocol.ConfigBatchWriteParams) (*protocol.ConfigWriteResponse, error)
- func (c *Client) ConfigMCPServerReload(ctx context.Context) (*protocol.MCPServerRefreshResponse, error)
- func (c *Client) ConfigMcpServerReload(ctx context.Context) (*protocol.MCPServerRefreshResponse, error)deprecated
- func (c *Client) ConfigRead(ctx context.Context, params protocol.ConfigReadParams) (*protocol.ConfigReadResponse, error)
- func (c *Client) ConfigRequirementsRead(ctx context.Context) (*protocol.ConfigRequirementsReadResponse, error)
- func (c *Client) ConfigValueWrite(ctx context.Context, params protocol.ConfigValueWriteParams) (*protocol.ConfigWriteResponse, error)
- func (c *Client) ExperimentalFeatureEnablementSet(ctx context.Context, params protocol.ExperimentalFeatureEnablementSetParams) (*protocol.ExperimentalFeatureEnablementSetResponse, error)
- func (c *Client) ExperimentalFeatureList(ctx context.Context, params protocol.ExperimentalFeatureListParams) (*protocol.ExperimentalFeatureListResponse, error)
- func (c *Client) ExternalAgentConfigDetect(ctx context.Context, params protocol.ExternalAgentConfigDetectParams) (*protocol.ExternalAgentConfigDetectResponse, error)
- func (c *Client) ExternalAgentConfigImport(ctx context.Context, params protocol.ExternalAgentConfigImportParams) (*protocol.ExternalAgentConfigImportResponse, error)
- func (c *Client) ExternalAgentConfigImportReadHistories(ctx context.Context) (*protocol.ExternalAgentConfigImportHistoriesReadResponse, error)
- func (c *Client) ExternalAgentConfigImportRecordHistory(ctx context.Context, ...) (*protocol.ExternalAgentConfigImportHistoryRecordResponse, error)
- func (c *Client) FeedbackUpload(ctx context.Context, params protocol.FeedbackUploadParams) (*protocol.FeedbackUploadResponse, error)
- func (c *Client) FsCopy(ctx context.Context, params protocol.FsCopyParams) (*protocol.FsCopyResponse, error)
- func (c *Client) FsCreateDirectory(ctx context.Context, params protocol.FsCreateDirectoryParams) (*protocol.FsCreateDirectoryResponse, error)
- func (c *Client) FsGetMetadata(ctx context.Context, params protocol.FsGetMetadataParams) (*protocol.FsGetMetadataResponse, error)
- func (c *Client) FsReadDirectory(ctx context.Context, params protocol.FsReadDirectoryParams) (*protocol.FsReadDirectoryResponse, error)
- func (c *Client) FsReadFile(ctx context.Context, params protocol.FsReadFileParams) (*protocol.FsReadFileResponse, error)
- func (c *Client) FsRemove(ctx context.Context, params protocol.FsRemoveParams) (*protocol.FsRemoveResponse, error)
- func (c *Client) FsUnwatch(ctx context.Context, params protocol.FsUnwatchParams) (*protocol.FsUnwatchResponse, error)
- func (c *Client) FsWatch(ctx context.Context, params protocol.FsWatchParams) (*protocol.FsWatchResponse, error)
- func (c *Client) FsWriteFile(ctx context.Context, params protocol.FsWriteFileParams) (*protocol.FsWriteFileResponse, error)
- func (c *Client) FuzzyFileSearch(ctx context.Context, params protocol.FuzzyFileSearchParams) (*protocol.FuzzyFileSearchResponse, error)
- func (c *Client) HooksList(ctx context.Context, params protocol.HooksListParams) (*protocol.HooksListResponse, error)
- func (c *Client) Initialize(ctx context.Context, params protocol.InitializeParams) (*protocol.InitializeResponse, error)
- func (c *Client) MCPServerOAuthLogin(ctx context.Context, params protocol.MCPServerOAuthLoginParams) (*protocol.MCPServerOAuthLoginResponse, error)
- func (c *Client) MCPServerResourceRead(ctx context.Context, params protocol.MCPResourceReadParams) (*protocol.MCPResourceReadResponse, error)
- func (c *Client) MCPServerStatusList(ctx context.Context, params protocol.ListMCPServerStatusParams) (*protocol.ListMCPServerStatusResponse, error)
- func (c *Client) MCPServerToolCall(ctx context.Context, params protocol.MCPServerToolCallParams) (*protocol.MCPServerToolCallResponse, error)
- func (c *Client) MarketplaceAdd(ctx context.Context, params protocol.MarketplaceAddParams) (*protocol.MarketplaceAddResponse, error)
- func (c *Client) MarketplaceRemove(ctx context.Context, params protocol.MarketplaceRemoveParams) (*protocol.MarketplaceRemoveResponse, error)
- func (c *Client) MarketplaceUpgrade(ctx context.Context, params protocol.MarketplaceUpgradeParams) (*protocol.MarketplaceUpgradeResponse, error)
- func (c *Client) McpServerOauthLogin(ctx context.Context, params protocol.MCPServerOAuthLoginParams) (*protocol.MCPServerOAuthLoginResponse, error)deprecated
- func (c *Client) McpServerResourceRead(ctx context.Context, params protocol.MCPResourceReadParams) (*protocol.MCPResourceReadResponse, error)deprecated
- func (c *Client) McpServerStatusList(ctx context.Context, params protocol.ListMCPServerStatusParams) (*protocol.ListMCPServerStatusResponse, error)deprecated
- func (c *Client) McpServerToolCall(ctx context.Context, params protocol.MCPServerToolCallParams) (*protocol.MCPServerToolCallResponse, error)deprecated
- func (c *Client) ModelList(ctx context.Context, params protocol.ModelListParams) (*protocol.ModelListResponse, error)
- func (c *Client) ModelProviderCapabilitiesRead(ctx context.Context, params protocol.ModelProviderCapabilitiesReadParams) (*protocol.ModelProviderCapabilitiesReadResponse, error)
- func (c *Client) Notify(ctx context.Context, method string, params any) error
- func (c *Client) PermissionProfileList(ctx context.Context, params protocol.PermissionProfileListParams) (*protocol.PermissionProfileListResponse, error)
- func (c *Client) PluginInstall(ctx context.Context, params protocol.PluginInstallParams) (*protocol.PluginInstallResponse, error)
- func (c *Client) PluginInstalled(ctx context.Context, params protocol.PluginInstalledParams) (*protocol.PluginInstalledResponse, error)
- func (c *Client) PluginList(ctx context.Context, params protocol.PluginListParams) (*protocol.PluginListResponse, error)
- func (c *Client) PluginRead(ctx context.Context, params protocol.PluginReadParams) (*protocol.PluginReadResponse, error)
- func (c *Client) PluginShareCheckout(ctx context.Context, params protocol.PluginShareCheckoutParams) (*protocol.PluginShareCheckoutResponse, error)
- func (c *Client) PluginShareDelete(ctx context.Context, params protocol.PluginShareDeleteParams) (*protocol.PluginShareDeleteResponse, error)
- func (c *Client) PluginShareList(ctx context.Context, params protocol.PluginShareListParams) (*protocol.PluginShareListResponse, error)
- func (c *Client) PluginShareSave(ctx context.Context, params protocol.PluginShareSaveParams) (*protocol.PluginShareSaveResponse, error)
- func (c *Client) PluginShareUpdateTargets(ctx context.Context, params protocol.PluginShareUpdateTargetsParams) (*protocol.PluginShareUpdateTargetsResponse, error)
- func (c *Client) PluginSkillRead(ctx context.Context, params protocol.PluginSkillReadParams) (*protocol.PluginSkillReadResponse, error)
- func (c *Client) PluginUninstall(ctx context.Context, params protocol.PluginUninstallParams) (*protocol.PluginUninstallResponse, error)
- func (c *Client) ReviewStart(ctx context.Context, params protocol.ReviewStartParams) (*protocol.ReviewStartResponse, error)
- func (c *Client) SetRequestHandler(handler ServerRequestHandler)
- func (c *Client) SkillsConfigWrite(ctx context.Context, params protocol.SkillsConfigWriteParams) (*protocol.SkillsConfigWriteResponse, error)
- func (c *Client) SkillsExtraRootsSet(ctx context.Context, params protocol.SkillsExtraRootsSetParams) (*protocol.SkillsExtraRootsSetResponse, error)
- func (c *Client) SkillsList(ctx context.Context, params protocol.SkillsListParams) (*protocol.SkillsListResponse, error)
- func (c *Client) SubscribeNotifications(buffer int) *NotificationIterator
- func (c *Client) ThreadApproveGuardianDeniedAction(ctx context.Context, params protocol.ThreadApproveGuardianDeniedActionParams) (*protocol.ThreadApproveGuardianDeniedActionResponse, error)
- func (c *Client) ThreadArchive(ctx context.Context, params protocol.ThreadArchiveParams) (*protocol.ThreadArchiveResponse, error)
- func (c *Client) ThreadCompactStart(ctx context.Context, params protocol.ThreadCompactStartParams) (*protocol.ThreadCompactStartResponse, error)
- func (c *Client) ThreadDelete(ctx context.Context, params protocol.ThreadDeleteParams) (*protocol.ThreadDeleteResponse, error)
- func (c *Client) ThreadFork(ctx context.Context, params protocol.ThreadForkParams) (*protocol.ThreadForkResponse, error)
- func (c *Client) ThreadGoalClear(ctx context.Context, params protocol.ThreadGoalClearParams) (*protocol.ThreadGoalClearResponse, error)
- func (c *Client) ThreadGoalGet(ctx context.Context, params protocol.ThreadGoalGetParams) (*protocol.ThreadGoalGetResponse, error)
- func (c *Client) ThreadGoalSet(ctx context.Context, params protocol.ThreadGoalSetParams) (*protocol.ThreadGoalSetResponse, error)
- func (c *Client) ThreadInjectItems(ctx context.Context, params protocol.ThreadInjectItemsParams) (*protocol.ThreadInjectItemsResponse, error)
- func (c *Client) ThreadList(ctx context.Context, params protocol.ThreadListParams) (*protocol.ThreadListResponse, error)
- func (c *Client) ThreadLoadedList(ctx context.Context, params protocol.ThreadLoadedListParams) (*protocol.ThreadLoadedListResponse, error)
- func (c *Client) ThreadMetadataUpdate(ctx context.Context, params protocol.ThreadMetadataUpdateParams) (*protocol.ThreadMetadataUpdateResponse, error)
- func (c *Client) ThreadNameSet(ctx context.Context, params protocol.ThreadSetNameParams) (*protocol.ThreadSetNameResponse, error)
- func (c *Client) ThreadRead(ctx context.Context, params protocol.ThreadReadParams) (*protocol.ThreadReadResponse, error)
- func (c *Client) ThreadResume(ctx context.Context, params protocol.ThreadResumeParams) (*protocol.ThreadResumeResponse, error)
- func (c *Client) ThreadRollback(ctx context.Context, params protocol.ThreadRollbackParams) (*protocol.ThreadRollbackResponse, error)
- func (c *Client) ThreadSectionCreate(ctx context.Context, params protocol.ThreadSectionCreateParams) (*protocol.ThreadSectionCreateResponse, error)
- func (c *Client) ThreadSectionDelete(ctx context.Context, params protocol.ThreadSectionDeleteParams) (*protocol.ThreadSectionDeleteResponse, error)
- func (c *Client) ThreadSectionList(ctx context.Context, params protocol.ThreadSectionListParams) (*protocol.ThreadSectionListResponse, error)
- func (c *Client) ThreadSectionMove(ctx context.Context, params protocol.ThreadSectionMoveParams) (*protocol.ThreadSectionMoveResponse, error)
- func (c *Client) ThreadSectionUpdate(ctx context.Context, params protocol.ThreadSectionUpdateParams) (*protocol.ThreadSectionUpdateResponse, error)
- func (c *Client) ThreadShellCommand(ctx context.Context, params protocol.ThreadShellCommandParams) (*protocol.ThreadShellCommandResponse, error)
- func (c *Client) ThreadStart(ctx context.Context, params protocol.ThreadStartParams) (*protocol.ThreadStartResponse, error)
- func (c *Client) ThreadUnarchive(ctx context.Context, params protocol.ThreadUnarchiveParams) (*protocol.ThreadUnarchiveResponse, error)
- func (c *Client) ThreadUnsubscribe(ctx context.Context, params protocol.ThreadUnsubscribeParams) (*protocol.ThreadUnsubscribeResponse, error)
- func (c *Client) TurnInterrupt(ctx context.Context, params protocol.TurnInterruptParams) (*protocol.TurnInterruptResponse, error)
- func (c *Client) TurnStart(ctx context.Context, params protocol.TurnStartParams) (*protocol.TurnStartResponse, error)
- func (c *Client) TurnSteer(ctx context.Context, params protocol.TurnSteerParams) (*protocol.TurnSteerResponse, error)
- func (c *Client) WindowsSandboxReadiness(ctx context.Context) (*protocol.WindowsSandboxReadinessResponse, error)
- func (c *Client) WindowsSandboxSetupStart(ctx context.Context, params protocol.WindowsSandboxSetupStartParams) (*protocol.WindowsSandboxSetupStartResponse, error)
- type ClientOptions
- type ClientRequestsdeprecated
- type ConnTransport
- type ContextTransport
- type JSONRPCError
- type JSONRPCErrorDetail
- type JSONRPCErrorErrordeprecated
- type JSONRPCNotification
- type JSONRPCRequest
- type JSONRPCResponse
- type MCPServerElicitationRequestHandler
- type Notification
- type NotificationIterator
- type NotificationOverflowError
- type RecordTransport
- type ReplayTransport
- type RequestID
- type RercordTransportdeprecated
- type ResponseError
- type ServerRequestHandlerdeprecated
- type ServerRequestHandlerError
- type ServerRequestMethodError
- type ServerRequestParamsError
- type StdioTransport
- type TranscriptDirection
- type TranscriptEntry
- type Transport
- type UnimplementedServerRequestHandler
- func (UnimplementedServerRequestHandler) AccountChatgptAuthTokensRefresh(context.Context, protocol.ChatgptAuthTokensRefreshParams) (*protocol.ChatgptAuthTokensRefreshResponse, error)
- func (UnimplementedServerRequestHandler) ApplyPatchApproval(context.Context, protocol.ApplyPatchApprovalParams) (*protocol.ApplyPatchApprovalResponse, error)
- func (UnimplementedServerRequestHandler) AttestationGenerate(context.Context, protocol.AttestationGenerateParams) (*protocol.AttestationGenerateResponse, error)
- func (UnimplementedServerRequestHandler) ExecCommandApproval(context.Context, protocol.ExecCommandApprovalParams) (*protocol.ExecCommandApprovalResponse, error)
- func (UnimplementedServerRequestHandler) ItemCommandExecutionRequestApproval(context.Context, protocol.CommandExecutionRequestApprovalParams) (*protocol.CommandExecutionRequestApprovalResponse, error)
- func (UnimplementedServerRequestHandler) ItemFileChangeRequestApproval(context.Context, protocol.FileChangeRequestApprovalParams) (*protocol.FileChangeRequestApprovalResponse, error)
- func (UnimplementedServerRequestHandler) ItemPermissionsRequestApproval(context.Context, protocol.PermissionsRequestApprovalParams) (*protocol.PermissionsRequestApprovalResponse, error)
- func (UnimplementedServerRequestHandler) ItemToolCall(context.Context, protocol.DynamicToolCallParams) (*protocol.DynamicToolCallResponse, error)
- func (UnimplementedServerRequestHandler) ItemToolRequestUserInput(context.Context, protocol.ToolRequestUserInputParams) (*protocol.ToolRequestUserInputResponse, error)
- func (UnimplementedServerRequestHandler) McpServerElicitationRequest(context.Context, protocol.MCPServerElicitationRequestParams) (*protocol.MCPServerElicitationRequestResponse, error)
Constants ¶
const ( // ServerRequestMethodNotFoundCode is the JSON-RPC code for an unknown method. ServerRequestMethodNotFoundCode int64 = -32601 // ServerRequestInvalidParamsCode is the JSON-RPC code for malformed parameters. ServerRequestInvalidParamsCode int64 = -32602 // ServerRequestInternalErrorCode is the JSON-RPC code for an internal failure. ServerRequestInternalErrorCode int64 = -32603 // ServerRequestHandlerErrorCode is used when an application handler fails. ServerRequestHandlerErrorCode int64 = -32000 // ServerRequestBusyCode is used when the bounded handler queue is full. ServerRequestBusyCode int64 = -32001 )
const DefaultMaxMessageBytes = 8 << 20
DefaultMaxMessageBytes is the maximum JSON payload accepted from a built-in line-oriented transport. The trailing newline is not counted.
Variables ¶
var ErrClientClosed = errors.New("rpc client closed")
ErrClientClosed identifies a client closed by its caller.
var ErrConnectionClosed = errors.New("rpc connection closed")
ErrConnectionClosed identifies a client whose connection closed without a more specific transport error.
var ErrMessageTooLarge = errors.New("rpc message exceeds size limit")
ErrMessageTooLarge identifies an inbound JSON-RPC line over the configured client or built-in transport limit.
var ErrNotificationOverflow = errors.New("notification subscription overflow")
ErrNotificationOverflow identifies a notification subscription that was closed because its configured capacity was exhausted.
var ErrNotificationSubscriptionClosed = errors.New("notification subscription closed")
ErrNotificationSubscriptionClosed identifies an iterator closed by its caller.
var ErrOutboundQueueFull = errors.New("rpc outbound write queue is full")
ErrOutboundQueueFull identifies a client whose bounded outbound write queue could not accept an asynchronous protocol reply.
var ErrServerRequestUnsupported = errors.New("server request is unsupported")
ErrServerRequestUnsupported is returned by default handler methods that an application has not overridden.
Functions ¶
func DefaultStderr ¶
DefaultStderr returns a safe default for spawned processes.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client manages JSON-RPC requests over a Transport.
func NewClient ¶
func NewClient(transport Transport, options ClientOptions) *Client
NewClient creates a JSON-RPC client over a Transport. It panics if transport is nil. Use NewClientChecked when the dependency is not statically known.
func NewClientChecked ¶ added in v0.147.0
func NewClientChecked(transport Transport, options ClientOptions) (*Client, error)
NewClientChecked creates a JSON-RPC client over a validated Transport.
func (*Client) AccountLoginCancel ¶
func (c *Client) AccountLoginCancel(ctx context.Context, params protocol.CancelLoginAccountParams) (*protocol.CancelLoginAccountResponse, error)
Client implements ClientRequests using JSON-RPC.
func (*Client) AccountLoginStart ¶
func (c *Client) AccountLoginStart(ctx context.Context, params protocol.LoginAccountParams) (*protocol.LoginAccountResponse, error)
func (*Client) AccountLogout ¶
func (*Client) AccountRateLimitResetCreditConsume ¶
func (c *Client) AccountRateLimitResetCreditConsume(ctx context.Context, params protocol.ConsumeAccountRateLimitResetCreditParams) (*protocol.ConsumeAccountRateLimitResetCreditResponse, error)
func (*Client) AccountRateLimitsRead ¶
func (*Client) AccountRead ¶
func (c *Client) AccountRead(ctx context.Context, params protocol.GetAccountParams) (*protocol.GetAccountResponse, error)
func (*Client) AccountSendAddCreditsNudgeEmail ¶
func (c *Client) AccountSendAddCreditsNudgeEmail(ctx context.Context, params protocol.SendAddCreditsNudgeEmailParams) (*protocol.SendAddCreditsNudgeEmailResponse, error)
func (*Client) AccountUsageRead ¶
func (*Client) AccountWorkspaceMessagesRead ¶
func (*Client) AppInstalled ¶ added in v0.147.0
func (c *Client) AppInstalled(ctx context.Context, params protocol.AppsInstalledParams) (*protocol.AppsInstalledResponse, error)
func (*Client) AppList ¶
func (c *Client) AppList(ctx context.Context, params protocol.AppsListParams) (*protocol.AppsListResponse, error)
func (*Client) AppRead ¶ added in v0.147.0
func (c *Client) AppRead(ctx context.Context, params protocol.AppsReadParams) (*protocol.AppsReadResponse, error)
func (*Client) CommandExec ¶
func (c *Client) CommandExec(ctx context.Context, params protocol.CommandExecParams) (*protocol.CommandExecResponse, error)
func (*Client) CommandExecResize ¶
func (c *Client) CommandExecResize(ctx context.Context, params protocol.CommandExecResizeParams) (*protocol.CommandExecResizeResponse, error)
func (*Client) CommandExecTerminate ¶
func (c *Client) CommandExecTerminate(ctx context.Context, params protocol.CommandExecTerminateParams) (*protocol.CommandExecTerminateResponse, error)
func (*Client) CommandExecWrite ¶
func (c *Client) CommandExecWrite(ctx context.Context, params protocol.CommandExecWriteParams) (*protocol.CommandExecWriteResponse, error)
func (*Client) ConfigBatchWrite ¶
func (c *Client) ConfigBatchWrite(ctx context.Context, params protocol.ConfigBatchWriteParams) (*protocol.ConfigWriteResponse, error)
func (*Client) ConfigMCPServerReload ¶ added in v0.147.0
func (*Client) ConfigMcpServerReload
deprecated
func (*Client) ConfigRead ¶
func (c *Client) ConfigRead(ctx context.Context, params protocol.ConfigReadParams) (*protocol.ConfigReadResponse, error)
func (*Client) ConfigRequirementsRead ¶
func (*Client) ConfigValueWrite ¶
func (c *Client) ConfigValueWrite(ctx context.Context, params protocol.ConfigValueWriteParams) (*protocol.ConfigWriteResponse, error)
func (*Client) ExperimentalFeatureEnablementSet ¶
func (c *Client) ExperimentalFeatureEnablementSet(ctx context.Context, params protocol.ExperimentalFeatureEnablementSetParams) (*protocol.ExperimentalFeatureEnablementSetResponse, error)
func (*Client) ExperimentalFeatureList ¶
func (c *Client) ExperimentalFeatureList(ctx context.Context, params protocol.ExperimentalFeatureListParams) (*protocol.ExperimentalFeatureListResponse, error)
func (*Client) ExternalAgentConfigDetect ¶
func (c *Client) ExternalAgentConfigDetect(ctx context.Context, params protocol.ExternalAgentConfigDetectParams) (*protocol.ExternalAgentConfigDetectResponse, error)
func (*Client) ExternalAgentConfigImport ¶
func (c *Client) ExternalAgentConfigImport(ctx context.Context, params protocol.ExternalAgentConfigImportParams) (*protocol.ExternalAgentConfigImportResponse, error)
func (*Client) ExternalAgentConfigImportReadHistories ¶
func (*Client) ExternalAgentConfigImportRecordHistory ¶ added in v0.147.0
func (c *Client) ExternalAgentConfigImportRecordHistory(ctx context.Context, params protocol.ExternalAgentConfigImportHistoryRecordParams) (*protocol.ExternalAgentConfigImportHistoryRecordResponse, error)
func (*Client) FeedbackUpload ¶
func (c *Client) FeedbackUpload(ctx context.Context, params protocol.FeedbackUploadParams) (*protocol.FeedbackUploadResponse, error)
func (*Client) FsCopy ¶
func (c *Client) FsCopy(ctx context.Context, params protocol.FsCopyParams) (*protocol.FsCopyResponse, error)
func (*Client) FsCreateDirectory ¶
func (c *Client) FsCreateDirectory(ctx context.Context, params protocol.FsCreateDirectoryParams) (*protocol.FsCreateDirectoryResponse, error)
func (*Client) FsGetMetadata ¶
func (c *Client) FsGetMetadata(ctx context.Context, params protocol.FsGetMetadataParams) (*protocol.FsGetMetadataResponse, error)
func (*Client) FsReadDirectory ¶
func (c *Client) FsReadDirectory(ctx context.Context, params protocol.FsReadDirectoryParams) (*protocol.FsReadDirectoryResponse, error)
func (*Client) FsReadFile ¶
func (c *Client) FsReadFile(ctx context.Context, params protocol.FsReadFileParams) (*protocol.FsReadFileResponse, error)
func (*Client) FsRemove ¶
func (c *Client) FsRemove(ctx context.Context, params protocol.FsRemoveParams) (*protocol.FsRemoveResponse, error)
func (*Client) FsUnwatch ¶
func (c *Client) FsUnwatch(ctx context.Context, params protocol.FsUnwatchParams) (*protocol.FsUnwatchResponse, error)
func (*Client) FsWatch ¶
func (c *Client) FsWatch(ctx context.Context, params protocol.FsWatchParams) (*protocol.FsWatchResponse, error)
func (*Client) FsWriteFile ¶
func (c *Client) FsWriteFile(ctx context.Context, params protocol.FsWriteFileParams) (*protocol.FsWriteFileResponse, error)
func (*Client) FuzzyFileSearch ¶
func (c *Client) FuzzyFileSearch(ctx context.Context, params protocol.FuzzyFileSearchParams) (*protocol.FuzzyFileSearchResponse, error)
func (*Client) HooksList ¶
func (c *Client) HooksList(ctx context.Context, params protocol.HooksListParams) (*protocol.HooksListResponse, error)
func (*Client) Initialize ¶
func (c *Client) Initialize(ctx context.Context, params protocol.InitializeParams) (*protocol.InitializeResponse, error)
func (*Client) MCPServerOAuthLogin ¶ added in v0.147.0
func (c *Client) MCPServerOAuthLogin(ctx context.Context, params protocol.MCPServerOAuthLoginParams) (*protocol.MCPServerOAuthLoginResponse, error)
func (*Client) MCPServerResourceRead ¶ added in v0.147.0
func (c *Client) MCPServerResourceRead(ctx context.Context, params protocol.MCPResourceReadParams) (*protocol.MCPResourceReadResponse, error)
func (*Client) MCPServerStatusList ¶ added in v0.147.0
func (c *Client) MCPServerStatusList(ctx context.Context, params protocol.ListMCPServerStatusParams) (*protocol.ListMCPServerStatusResponse, error)
func (*Client) MCPServerToolCall ¶ added in v0.147.0
func (c *Client) MCPServerToolCall(ctx context.Context, params protocol.MCPServerToolCallParams) (*protocol.MCPServerToolCallResponse, error)
func (*Client) MarketplaceAdd ¶
func (c *Client) MarketplaceAdd(ctx context.Context, params protocol.MarketplaceAddParams) (*protocol.MarketplaceAddResponse, error)
func (*Client) MarketplaceRemove ¶
func (c *Client) MarketplaceRemove(ctx context.Context, params protocol.MarketplaceRemoveParams) (*protocol.MarketplaceRemoveResponse, error)
func (*Client) MarketplaceUpgrade ¶
func (c *Client) MarketplaceUpgrade(ctx context.Context, params protocol.MarketplaceUpgradeParams) (*protocol.MarketplaceUpgradeResponse, error)
func (*Client) McpServerOauthLogin
deprecated
func (c *Client) McpServerOauthLogin(ctx context.Context, params protocol.MCPServerOAuthLoginParams) (*protocol.MCPServerOAuthLoginResponse, error)
McpServerOauthLogin is the former spelling of MCPServerOAuthLogin.
Deprecated: use MCPServerOAuthLogin.
func (*Client) McpServerResourceRead
deprecated
func (c *Client) McpServerResourceRead(ctx context.Context, params protocol.MCPResourceReadParams) (*protocol.MCPResourceReadResponse, error)
McpServerResourceRead is the former spelling of MCPServerResourceRead.
Deprecated: use MCPServerResourceRead.
func (*Client) McpServerStatusList
deprecated
func (c *Client) McpServerStatusList(ctx context.Context, params protocol.ListMCPServerStatusParams) (*protocol.ListMCPServerStatusResponse, error)
McpServerStatusList is the former spelling of MCPServerStatusList.
Deprecated: use MCPServerStatusList.
func (*Client) McpServerToolCall
deprecated
func (c *Client) McpServerToolCall(ctx context.Context, params protocol.MCPServerToolCallParams) (*protocol.MCPServerToolCallResponse, error)
McpServerToolCall is the former spelling of MCPServerToolCall.
Deprecated: use MCPServerToolCall.
func (*Client) ModelList ¶
func (c *Client) ModelList(ctx context.Context, params protocol.ModelListParams) (*protocol.ModelListResponse, error)
func (*Client) ModelProviderCapabilitiesRead ¶
func (c *Client) ModelProviderCapabilitiesRead(ctx context.Context, params protocol.ModelProviderCapabilitiesReadParams) (*protocol.ModelProviderCapabilitiesReadResponse, error)
func (*Client) PermissionProfileList ¶
func (c *Client) PermissionProfileList(ctx context.Context, params protocol.PermissionProfileListParams) (*protocol.PermissionProfileListResponse, error)
func (*Client) PluginInstall ¶
func (c *Client) PluginInstall(ctx context.Context, params protocol.PluginInstallParams) (*protocol.PluginInstallResponse, error)
func (*Client) PluginInstalled ¶
func (c *Client) PluginInstalled(ctx context.Context, params protocol.PluginInstalledParams) (*protocol.PluginInstalledResponse, error)
func (*Client) PluginList ¶
func (c *Client) PluginList(ctx context.Context, params protocol.PluginListParams) (*protocol.PluginListResponse, error)
func (*Client) PluginRead ¶
func (c *Client) PluginRead(ctx context.Context, params protocol.PluginReadParams) (*protocol.PluginReadResponse, error)
func (*Client) PluginShareCheckout ¶
func (c *Client) PluginShareCheckout(ctx context.Context, params protocol.PluginShareCheckoutParams) (*protocol.PluginShareCheckoutResponse, error)
func (*Client) PluginShareDelete ¶
func (c *Client) PluginShareDelete(ctx context.Context, params protocol.PluginShareDeleteParams) (*protocol.PluginShareDeleteResponse, error)
func (*Client) PluginShareList ¶
func (c *Client) PluginShareList(ctx context.Context, params protocol.PluginShareListParams) (*protocol.PluginShareListResponse, error)
func (*Client) PluginShareSave ¶
func (c *Client) PluginShareSave(ctx context.Context, params protocol.PluginShareSaveParams) (*protocol.PluginShareSaveResponse, error)
func (*Client) PluginShareUpdateTargets ¶
func (c *Client) PluginShareUpdateTargets(ctx context.Context, params protocol.PluginShareUpdateTargetsParams) (*protocol.PluginShareUpdateTargetsResponse, error)
func (*Client) PluginSkillRead ¶
func (c *Client) PluginSkillRead(ctx context.Context, params protocol.PluginSkillReadParams) (*protocol.PluginSkillReadResponse, error)
func (*Client) PluginUninstall ¶
func (c *Client) PluginUninstall(ctx context.Context, params protocol.PluginUninstallParams) (*protocol.PluginUninstallResponse, error)
func (*Client) ReviewStart ¶
func (c *Client) ReviewStart(ctx context.Context, params protocol.ReviewStartParams) (*protocol.ReviewStartResponse, error)
func (*Client) SetRequestHandler ¶
func (c *Client) SetRequestHandler(handler ServerRequestHandler)
SetRequestHandler replaces the server request handler.
func (*Client) SkillsConfigWrite ¶
func (c *Client) SkillsConfigWrite(ctx context.Context, params protocol.SkillsConfigWriteParams) (*protocol.SkillsConfigWriteResponse, error)
func (*Client) SkillsExtraRootsSet ¶
func (c *Client) SkillsExtraRootsSet(ctx context.Context, params protocol.SkillsExtraRootsSetParams) (*protocol.SkillsExtraRootsSetResponse, error)
func (*Client) SkillsList ¶
func (c *Client) SkillsList(ctx context.Context, params protocol.SkillsListParams) (*protocol.SkillsListResponse, error)
func (*Client) SubscribeNotifications ¶
func (c *Client) SubscribeNotifications(buffer int) *NotificationIterator
SubscribeNotifications creates an iterator over server notifications. Buffer is a hard pending-notification capacity. A non-positive value uses the default capacity of 64. If a consumer falls behind, only that iterator is closed and Next returns a NotificationOverflowError.
func (*Client) ThreadApproveGuardianDeniedAction ¶
func (c *Client) ThreadApproveGuardianDeniedAction(ctx context.Context, params protocol.ThreadApproveGuardianDeniedActionParams) (*protocol.ThreadApproveGuardianDeniedActionResponse, error)
func (*Client) ThreadArchive ¶
func (c *Client) ThreadArchive(ctx context.Context, params protocol.ThreadArchiveParams) (*protocol.ThreadArchiveResponse, error)
func (*Client) ThreadCompactStart ¶
func (c *Client) ThreadCompactStart(ctx context.Context, params protocol.ThreadCompactStartParams) (*protocol.ThreadCompactStartResponse, error)
func (*Client) ThreadDelete ¶
func (c *Client) ThreadDelete(ctx context.Context, params protocol.ThreadDeleteParams) (*protocol.ThreadDeleteResponse, error)
func (*Client) ThreadFork ¶
func (c *Client) ThreadFork(ctx context.Context, params protocol.ThreadForkParams) (*protocol.ThreadForkResponse, error)
func (*Client) ThreadGoalClear ¶
func (c *Client) ThreadGoalClear(ctx context.Context, params protocol.ThreadGoalClearParams) (*protocol.ThreadGoalClearResponse, error)
func (*Client) ThreadGoalGet ¶
func (c *Client) ThreadGoalGet(ctx context.Context, params protocol.ThreadGoalGetParams) (*protocol.ThreadGoalGetResponse, error)
func (*Client) ThreadGoalSet ¶
func (c *Client) ThreadGoalSet(ctx context.Context, params protocol.ThreadGoalSetParams) (*protocol.ThreadGoalSetResponse, error)
func (*Client) ThreadInjectItems ¶
func (c *Client) ThreadInjectItems(ctx context.Context, params protocol.ThreadInjectItemsParams) (*protocol.ThreadInjectItemsResponse, error)
func (*Client) ThreadList ¶
func (c *Client) ThreadList(ctx context.Context, params protocol.ThreadListParams) (*protocol.ThreadListResponse, error)
func (*Client) ThreadLoadedList ¶
func (c *Client) ThreadLoadedList(ctx context.Context, params protocol.ThreadLoadedListParams) (*protocol.ThreadLoadedListResponse, error)
func (*Client) ThreadMetadataUpdate ¶
func (c *Client) ThreadMetadataUpdate(ctx context.Context, params protocol.ThreadMetadataUpdateParams) (*protocol.ThreadMetadataUpdateResponse, error)
func (*Client) ThreadNameSet ¶
func (c *Client) ThreadNameSet(ctx context.Context, params protocol.ThreadSetNameParams) (*protocol.ThreadSetNameResponse, error)
func (*Client) ThreadRead ¶
func (c *Client) ThreadRead(ctx context.Context, params protocol.ThreadReadParams) (*protocol.ThreadReadResponse, error)
func (*Client) ThreadResume ¶
func (c *Client) ThreadResume(ctx context.Context, params protocol.ThreadResumeParams) (*protocol.ThreadResumeResponse, error)
func (*Client) ThreadRollback ¶
func (c *Client) ThreadRollback(ctx context.Context, params protocol.ThreadRollbackParams) (*protocol.ThreadRollbackResponse, error)
func (*Client) ThreadSectionCreate ¶ added in v0.147.0
func (c *Client) ThreadSectionCreate(ctx context.Context, params protocol.ThreadSectionCreateParams) (*protocol.ThreadSectionCreateResponse, error)
func (*Client) ThreadSectionDelete ¶ added in v0.147.0
func (c *Client) ThreadSectionDelete(ctx context.Context, params protocol.ThreadSectionDeleteParams) (*protocol.ThreadSectionDeleteResponse, error)
func (*Client) ThreadSectionList ¶ added in v0.147.0
func (c *Client) ThreadSectionList(ctx context.Context, params protocol.ThreadSectionListParams) (*protocol.ThreadSectionListResponse, error)
func (*Client) ThreadSectionMove ¶ added in v0.147.0
func (c *Client) ThreadSectionMove(ctx context.Context, params protocol.ThreadSectionMoveParams) (*protocol.ThreadSectionMoveResponse, error)
func (*Client) ThreadSectionUpdate ¶ added in v0.147.0
func (c *Client) ThreadSectionUpdate(ctx context.Context, params protocol.ThreadSectionUpdateParams) (*protocol.ThreadSectionUpdateResponse, error)
func (*Client) ThreadShellCommand ¶
func (c *Client) ThreadShellCommand(ctx context.Context, params protocol.ThreadShellCommandParams) (*protocol.ThreadShellCommandResponse, error)
func (*Client) ThreadStart ¶
func (c *Client) ThreadStart(ctx context.Context, params protocol.ThreadStartParams) (*protocol.ThreadStartResponse, error)
func (*Client) ThreadUnarchive ¶
func (c *Client) ThreadUnarchive(ctx context.Context, params protocol.ThreadUnarchiveParams) (*protocol.ThreadUnarchiveResponse, error)
func (*Client) ThreadUnsubscribe ¶
func (c *Client) ThreadUnsubscribe(ctx context.Context, params protocol.ThreadUnsubscribeParams) (*protocol.ThreadUnsubscribeResponse, error)
func (*Client) TurnInterrupt ¶
func (c *Client) TurnInterrupt(ctx context.Context, params protocol.TurnInterruptParams) (*protocol.TurnInterruptResponse, error)
func (*Client) TurnStart ¶
func (c *Client) TurnStart(ctx context.Context, params protocol.TurnStartParams) (*protocol.TurnStartResponse, error)
func (*Client) TurnSteer ¶
func (c *Client) TurnSteer(ctx context.Context, params protocol.TurnSteerParams) (*protocol.TurnSteerResponse, error)
func (*Client) WindowsSandboxReadiness ¶
func (*Client) WindowsSandboxSetupStart ¶
func (c *Client) WindowsSandboxSetupStart(ctx context.Context, params protocol.WindowsSandboxSetupStartParams) (*protocol.WindowsSandboxSetupStartResponse, error)
type ClientOptions ¶
type ClientOptions struct {
Logger *slog.Logger
// RequestHandler handles app-server initiated requests. A typed-nil handler
// is treated as nil.
RequestHandler ServerRequestHandler
// ServerRequestWorkers bounds concurrent app-server request handlers. Zero
// uses the default of four.
ServerRequestWorkers int
// ServerRequestQueueCapacity bounds queued app-server requests. Zero uses
// the default of 64. A full queue receives JSON-RPC code -32001.
ServerRequestQueueCapacity int
// MaxMessageBytes bounds each inbound JSON-RPC payload. Zero uses
// DefaultMaxMessageBytes. This client-side check covers custom transports;
// built-in transports always retain DefaultMaxMessageBytes as a safety
// ceiling, so a larger value does not raise their limit. Custom transports
// must bound allocation inside ReadLine before returning the payload.
MaxMessageBytes int
}
ClientOptions configures a low-level JSON-RPC client.
type ClientRequests
deprecated
type ClientRequests interface {
AccountLoginCancel(ctx context.Context, params protocol.CancelLoginAccountParams) (*protocol.CancelLoginAccountResponse, error)
AccountLoginStart(ctx context.Context, params protocol.LoginAccountParams) (*protocol.LoginAccountResponse, error)
AccountLogout(ctx context.Context) (*protocol.LogoutAccountResponse, error)
AccountRateLimitResetCreditConsume(ctx context.Context, params protocol.ConsumeAccountRateLimitResetCreditParams) (*protocol.ConsumeAccountRateLimitResetCreditResponse, error)
AccountRateLimitsRead(ctx context.Context) (*protocol.GetAccountRateLimitsResponse, error)
AccountRead(ctx context.Context, params protocol.GetAccountParams) (*protocol.GetAccountResponse, error)
AccountSendAddCreditsNudgeEmail(ctx context.Context, params protocol.SendAddCreditsNudgeEmailParams) (*protocol.SendAddCreditsNudgeEmailResponse, error)
AccountUsageRead(ctx context.Context) (*protocol.GetAccountTokenUsageResponse, error)
AccountWorkspaceMessagesRead(ctx context.Context) (*protocol.GetWorkspaceMessagesResponse, error)
AppInstalled(ctx context.Context, params protocol.AppsInstalledParams) (*protocol.AppsInstalledResponse, error)
AppList(ctx context.Context, params protocol.AppsListParams) (*protocol.AppsListResponse, error)
AppRead(ctx context.Context, params protocol.AppsReadParams) (*protocol.AppsReadResponse, error)
CommandExec(ctx context.Context, params protocol.CommandExecParams) (*protocol.CommandExecResponse, error)
CommandExecResize(ctx context.Context, params protocol.CommandExecResizeParams) (*protocol.CommandExecResizeResponse, error)
CommandExecTerminate(ctx context.Context, params protocol.CommandExecTerminateParams) (*protocol.CommandExecTerminateResponse, error)
CommandExecWrite(ctx context.Context, params protocol.CommandExecWriteParams) (*protocol.CommandExecWriteResponse, error)
ConfigBatchWrite(ctx context.Context, params protocol.ConfigBatchWriteParams) (*protocol.ConfigWriteResponse, error)
ConfigMCPServerReload(ctx context.Context) (*protocol.MCPServerRefreshResponse, error)
ConfigRead(ctx context.Context, params protocol.ConfigReadParams) (*protocol.ConfigReadResponse, error)
ConfigValueWrite(ctx context.Context, params protocol.ConfigValueWriteParams) (*protocol.ConfigWriteResponse, error)
ConfigRequirementsRead(ctx context.Context) (*protocol.ConfigRequirementsReadResponse, error)
ExperimentalFeatureEnablementSet(ctx context.Context, params protocol.ExperimentalFeatureEnablementSetParams) (*protocol.ExperimentalFeatureEnablementSetResponse, error)
ExperimentalFeatureList(ctx context.Context, params protocol.ExperimentalFeatureListParams) (*protocol.ExperimentalFeatureListResponse, error)
ExternalAgentConfigDetect(ctx context.Context, params protocol.ExternalAgentConfigDetectParams) (*protocol.ExternalAgentConfigDetectResponse, error)
ExternalAgentConfigImport(ctx context.Context, params protocol.ExternalAgentConfigImportParams) (*protocol.ExternalAgentConfigImportResponse, error)
ExternalAgentConfigImportReadHistories(ctx context.Context) (*protocol.ExternalAgentConfigImportHistoriesReadResponse, error)
ExternalAgentConfigImportRecordHistory(ctx context.Context, params protocol.ExternalAgentConfigImportHistoryRecordParams) (*protocol.ExternalAgentConfigImportHistoryRecordResponse, error)
FeedbackUpload(ctx context.Context, params protocol.FeedbackUploadParams) (*protocol.FeedbackUploadResponse, error)
FsCopy(ctx context.Context, params protocol.FsCopyParams) (*protocol.FsCopyResponse, error)
FsCreateDirectory(ctx context.Context, params protocol.FsCreateDirectoryParams) (*protocol.FsCreateDirectoryResponse, error)
FsGetMetadata(ctx context.Context, params protocol.FsGetMetadataParams) (*protocol.FsGetMetadataResponse, error)
FsReadDirectory(ctx context.Context, params protocol.FsReadDirectoryParams) (*protocol.FsReadDirectoryResponse, error)
FsReadFile(ctx context.Context, params protocol.FsReadFileParams) (*protocol.FsReadFileResponse, error)
FsRemove(ctx context.Context, params protocol.FsRemoveParams) (*protocol.FsRemoveResponse, error)
FsUnwatch(ctx context.Context, params protocol.FsUnwatchParams) (*protocol.FsUnwatchResponse, error)
FsWatch(ctx context.Context, params protocol.FsWatchParams) (*protocol.FsWatchResponse, error)
FsWriteFile(ctx context.Context, params protocol.FsWriteFileParams) (*protocol.FsWriteFileResponse, error)
FuzzyFileSearch(ctx context.Context, params protocol.FuzzyFileSearchParams) (*protocol.FuzzyFileSearchResponse, error)
HooksList(ctx context.Context, params protocol.HooksListParams) (*protocol.HooksListResponse, error)
Initialize(ctx context.Context, params protocol.InitializeParams) (*protocol.InitializeResponse, error)
MarketplaceAdd(ctx context.Context, params protocol.MarketplaceAddParams) (*protocol.MarketplaceAddResponse, error)
MarketplaceRemove(ctx context.Context, params protocol.MarketplaceRemoveParams) (*protocol.MarketplaceRemoveResponse, error)
MarketplaceUpgrade(ctx context.Context, params protocol.MarketplaceUpgradeParams) (*protocol.MarketplaceUpgradeResponse, error)
MCPServerOAuthLogin(ctx context.Context, params protocol.MCPServerOAuthLoginParams) (*protocol.MCPServerOAuthLoginResponse, error)
MCPServerResourceRead(ctx context.Context, params protocol.MCPResourceReadParams) (*protocol.MCPResourceReadResponse, error)
MCPServerToolCall(ctx context.Context, params protocol.MCPServerToolCallParams) (*protocol.MCPServerToolCallResponse, error)
MCPServerStatusList(ctx context.Context, params protocol.ListMCPServerStatusParams) (*protocol.ListMCPServerStatusResponse, error)
ModelList(ctx context.Context, params protocol.ModelListParams) (*protocol.ModelListResponse, error)
ModelProviderCapabilitiesRead(ctx context.Context, params protocol.ModelProviderCapabilitiesReadParams) (*protocol.ModelProviderCapabilitiesReadResponse, error)
PermissionProfileList(ctx context.Context, params protocol.PermissionProfileListParams) (*protocol.PermissionProfileListResponse, error)
PluginInstall(ctx context.Context, params protocol.PluginInstallParams) (*protocol.PluginInstallResponse, error)
PluginInstalled(ctx context.Context, params protocol.PluginInstalledParams) (*protocol.PluginInstalledResponse, error)
PluginList(ctx context.Context, params protocol.PluginListParams) (*protocol.PluginListResponse, error)
PluginRead(ctx context.Context, params protocol.PluginReadParams) (*protocol.PluginReadResponse, error)
PluginSkillRead(ctx context.Context, params protocol.PluginSkillReadParams) (*protocol.PluginSkillReadResponse, error)
PluginUninstall(ctx context.Context, params protocol.PluginUninstallParams) (*protocol.PluginUninstallResponse, error)
ReviewStart(ctx context.Context, params protocol.ReviewStartParams) (*protocol.ReviewStartResponse, error)
SkillsConfigWrite(ctx context.Context, params protocol.SkillsConfigWriteParams) (*protocol.SkillsConfigWriteResponse, error)
SkillsExtraRootsSet(ctx context.Context, params protocol.SkillsExtraRootsSetParams) (*protocol.SkillsExtraRootsSetResponse, error)
SkillsList(ctx context.Context, params protocol.SkillsListParams) (*protocol.SkillsListResponse, error)
ThreadApproveGuardianDeniedAction(ctx context.Context, params protocol.ThreadApproveGuardianDeniedActionParams) (*protocol.ThreadApproveGuardianDeniedActionResponse, error)
ThreadArchive(ctx context.Context, params protocol.ThreadArchiveParams) (*protocol.ThreadArchiveResponse, error)
ThreadCompactStart(ctx context.Context, params protocol.ThreadCompactStartParams) (*protocol.ThreadCompactStartResponse, error)
ThreadDelete(ctx context.Context, params protocol.ThreadDeleteParams) (*protocol.ThreadDeleteResponse, error)
ThreadFork(ctx context.Context, params protocol.ThreadForkParams) (*protocol.ThreadForkResponse, error)
ThreadGoalClear(ctx context.Context, params protocol.ThreadGoalClearParams) (*protocol.ThreadGoalClearResponse, error)
ThreadGoalGet(ctx context.Context, params protocol.ThreadGoalGetParams) (*protocol.ThreadGoalGetResponse, error)
ThreadGoalSet(ctx context.Context, params protocol.ThreadGoalSetParams) (*protocol.ThreadGoalSetResponse, error)
ThreadInjectItems(ctx context.Context, params protocol.ThreadInjectItemsParams) (*protocol.ThreadInjectItemsResponse, error)
ThreadList(ctx context.Context, params protocol.ThreadListParams) (*protocol.ThreadListResponse, error)
ThreadLoadedList(ctx context.Context, params protocol.ThreadLoadedListParams) (*protocol.ThreadLoadedListResponse, error)
ThreadMetadataUpdate(ctx context.Context, params protocol.ThreadMetadataUpdateParams) (*protocol.ThreadMetadataUpdateResponse, error)
ThreadNameSet(ctx context.Context, params protocol.ThreadSetNameParams) (*protocol.ThreadSetNameResponse, error)
ThreadRead(ctx context.Context, params protocol.ThreadReadParams) (*protocol.ThreadReadResponse, error)
ThreadResume(ctx context.Context, params protocol.ThreadResumeParams) (*protocol.ThreadResumeResponse, error)
ThreadRollback(ctx context.Context, params protocol.ThreadRollbackParams) (*protocol.ThreadRollbackResponse, error)
ThreadSectionMove(ctx context.Context, params protocol.ThreadSectionMoveParams) (*protocol.ThreadSectionMoveResponse, error)
ThreadShellCommand(ctx context.Context, params protocol.ThreadShellCommandParams) (*protocol.ThreadShellCommandResponse, error)
ThreadStart(ctx context.Context, params protocol.ThreadStartParams) (*protocol.ThreadStartResponse, error)
ThreadUnarchive(ctx context.Context, params protocol.ThreadUnarchiveParams) (*protocol.ThreadUnarchiveResponse, error)
ThreadUnsubscribe(ctx context.Context, params protocol.ThreadUnsubscribeParams) (*protocol.ThreadUnsubscribeResponse, error)
ThreadSectionCreate(ctx context.Context, params protocol.ThreadSectionCreateParams) (*protocol.ThreadSectionCreateResponse, error)
ThreadSectionDelete(ctx context.Context, params protocol.ThreadSectionDeleteParams) (*protocol.ThreadSectionDeleteResponse, error)
ThreadSectionList(ctx context.Context, params protocol.ThreadSectionListParams) (*protocol.ThreadSectionListResponse, error)
ThreadSectionUpdate(ctx context.Context, params protocol.ThreadSectionUpdateParams) (*protocol.ThreadSectionUpdateResponse, error)
TurnInterrupt(ctx context.Context, params protocol.TurnInterruptParams) (*protocol.TurnInterruptResponse, error)
TurnStart(ctx context.Context, params protocol.TurnStartParams) (*protocol.TurnStartResponse, error)
TurnSteer(ctx context.Context, params protocol.TurnSteerParams) (*protocol.TurnSteerResponse, error)
WindowsSandboxReadiness(ctx context.Context) (*protocol.WindowsSandboxReadinessResponse, error)
WindowsSandboxSetupStart(ctx context.Context, params protocol.WindowsSandboxSetupStartParams) (*protocol.WindowsSandboxSetupStartResponse, error)
}
ClientRequests exposes every generated JSON-RPC call supported by the app-server.
Deprecated: define a narrow interface containing only the methods your code consumes.
type ConnTransport ¶
type ConnTransport struct {
// contains filtered or unexported fields
}
ConnTransport wraps an io.ReadWriteCloser.
func NewConnTransport ¶
func NewConnTransport(conn io.ReadWriteCloser) *ConnTransport
NewConnTransport wraps the connection in a Transport. It panics if conn is nil. Use NewConnTransportChecked when the dependency is not statically known.
func NewConnTransportChecked ¶ added in v0.147.0
func NewConnTransportChecked(conn io.ReadWriteCloser) (*ConnTransport, error)
NewConnTransportChecked wraps the connection in a Transport.
func (*ConnTransport) ReadLine ¶
func (t *ConnTransport) ReadLine() (string, error)
ReadLine reads a line from the connection.
func (*ConnTransport) WriteLine ¶
func (t *ConnTransport) WriteLine(line string) error
WriteLine writes a line to the connection.
type ContextTransport ¶ added in v0.147.0
type ContextTransport interface {
Transport
WriteLineContext(ctx context.Context, line string) error
}
ContextTransport is an optional Transport capability for writes that can be interrupted when their request context ends. Client also bounds callers that use a legacy Transport, but the underlying legacy write can remain blocked until Transport.Close unblocks it.
type JSONRPCError ¶
type JSONRPCError struct {
ID RequestID `json:"id"`
Error JSONRPCErrorDetail `json:"error"`
}
JSONRPCError represents a JSON-RPC error response.
type JSONRPCErrorDetail ¶ added in v0.147.0
type JSONRPCErrorDetail struct {
Code int64 `json:"code"`
Message string `json:"message"`
Data json.RawMessage `json:"data,omitempty"`
}
JSONRPCErrorDetail describes the error payload.
type JSONRPCErrorError
deprecated
type JSONRPCErrorError = JSONRPCErrorDetail
JSONRPCErrorError is the former name of JSONRPCErrorDetail.
Deprecated: use JSONRPCErrorDetail.
type JSONRPCNotification ¶
type JSONRPCNotification struct {
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
JSONRPCNotification represents a JSON-RPC notification.
type JSONRPCRequest ¶
type JSONRPCRequest struct {
ID RequestID `json:"id"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
JSONRPCRequest represents a JSON-RPC request.
func BuildClientRequest ¶
func BuildClientRequest(method string, params any, id RequestID) (JSONRPCRequest, error)
BuildClientRequest builds a JSON-RPC request for a client method.
type JSONRPCResponse ¶
type JSONRPCResponse struct {
ID RequestID `json:"id"`
Result json.RawMessage `json:"result"`
}
JSONRPCResponse represents a JSON-RPC response.
type MCPServerElicitationRequestHandler ¶ added in v0.147.0
type MCPServerElicitationRequestHandler interface {
MCPServerElicitationRequest(ctx context.Context, params protocol.MCPServerElicitationRequestParams) (*protocol.MCPServerElicitationRequestResponse, error)
}
MCPServerElicitationRequestHandler handles mcpServer/elicitation/request using canonical Go initialisms.
type Notification ¶
type Notification struct {
Method string
Params any
Raw json.RawMessage
}
Notification represents a typed server notification.
func (Notification) UnmarshalParams ¶
func (n Notification) UnmarshalParams(v any) error
UnmarshalParams decodes the raw notification params into v.
type NotificationIterator ¶
type NotificationIterator struct {
// contains filtered or unexported fields
}
NotificationIterator iterates notifications from the server.
func (*NotificationIterator) Close ¶
func (it *NotificationIterator) Close()
Close unsubscribes the iterator.
func (*NotificationIterator) Next ¶
func (it *NotificationIterator) Next(ctx context.Context) (Notification, error)
Next returns the next notification or an error.
type NotificationOverflowError ¶ added in v0.145.0
type NotificationOverflowError struct {
Capacity int
}
NotificationOverflowError reports the hard capacity of an overflowing notification subscription.
func (*NotificationOverflowError) Error ¶ added in v0.145.0
func (e *NotificationOverflowError) Error() string
func (*NotificationOverflowError) Is ¶ added in v0.145.0
func (e *NotificationOverflowError) Is(target error) bool
Is allows errors.Is(err, ErrNotificationOverflow).
type RecordTransport ¶
type RecordTransport struct {
// contains filtered or unexported fields
}
RecordTransport records all JSON-RPC traffic to a transcript.
func NewRecordTransport ¶
func NewRecordTransport(transport Transport) *RecordTransport
NewRecordTransport wraps a transport and records traffic. It panics if transport is nil. Use NewRecordTransportChecked when the dependency is not statically known.
func NewRecordTransportChecked ¶ added in v0.147.0
func NewRecordTransportChecked(transport Transport) (*RecordTransport, error)
NewRecordTransportChecked wraps a validated transport and records traffic.
func NewRercordTransport
deprecated
func NewRercordTransport(transport Transport) *RecordTransport
NewRercordTransport wraps a transport and records traffic.
Deprecated: use NewRecordTransport.
func (*RecordTransport) Close ¶
func (t *RecordTransport) Close() error
Close closes the underlying transport.
func (*RecordTransport) ReadLine ¶
func (t *RecordTransport) ReadLine() (string, error)
ReadLine reads from the underlying transport and records the line.
func (*RecordTransport) Transcript ¶
func (t *RecordTransport) Transcript() []TranscriptEntry
Transcript returns a copy of the recorded transcript.
func (*RecordTransport) WriteLine ¶
func (t *RecordTransport) WriteLine(line string) error
WriteLine writes to the underlying transport and records the line.
type ReplayTransport ¶
type ReplayTransport struct {
// contains filtered or unexported fields
}
ReplayTransport replays a transcript of line-delimited JSON-RPC payloads. JSON writes are compared by value (after normalization) to tolerate key ordering differences.
func NewReplayTransport ¶
func NewReplayTransport(transcript []TranscriptEntry) *ReplayTransport
NewReplayTransport creates a ReplayTransport for a transcript. It panics if the transcript contains an unsupported direction.
func NewReplayTransportChecked ¶ added in v0.147.0
func NewReplayTransportChecked(transcript []TranscriptEntry) (*ReplayTransport, error)
NewReplayTransportChecked creates a ReplayTransport after validating every transcript entry.
func (*ReplayTransport) Close ¶
func (t *ReplayTransport) Close() error
Close stops the replay transport.
func (*ReplayTransport) ReadLine ¶
func (t *ReplayTransport) ReadLine() (string, error)
ReadLine returns the next recorded read line.
func (*ReplayTransport) WriteLine ¶
func (t *ReplayTransport) WriteLine(line string) error
WriteLine validates the next recorded write line.
type RequestID ¶
type RequestID struct {
// contains filtered or unexported fields
}
RequestID represents a JSON-RPC request id (string or integer).
func NewIntRequestID ¶
NewIntRequestID creates an integer request id.
func NewStringRequestID ¶
NewStringRequestID creates a string request id.
func (RequestID) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*RequestID) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type RercordTransport
deprecated
type RercordTransport = RecordTransport
RercordTransport is a misspelled alias for RecordTransport.
Deprecated: use RecordTransport.
type ResponseError ¶
type ResponseError struct {
ID RequestID
Detail JSONRPCErrorDetail
}
ResponseError wraps a JSON-RPC error as a Go error.
func (*ResponseError) Error ¶
func (err *ResponseError) Error() string
type ServerRequestHandler
deprecated
type ServerRequestHandler interface {
AccountChatgptAuthTokensRefresh(ctx context.Context, params protocol.ChatgptAuthTokensRefreshParams) (*protocol.ChatgptAuthTokensRefreshResponse, error)
ApplyPatchApproval(ctx context.Context, params protocol.ApplyPatchApprovalParams) (*protocol.ApplyPatchApprovalResponse, error)
AttestationGenerate(ctx context.Context, params protocol.AttestationGenerateParams) (*protocol.AttestationGenerateResponse, error)
ExecCommandApproval(ctx context.Context, params protocol.ExecCommandApprovalParams) (*protocol.ExecCommandApprovalResponse, error)
ItemCommandExecutionRequestApproval(ctx context.Context, params protocol.CommandExecutionRequestApprovalParams) (*protocol.CommandExecutionRequestApprovalResponse, error)
ItemFileChangeRequestApproval(ctx context.Context, params protocol.FileChangeRequestApprovalParams) (*protocol.FileChangeRequestApprovalResponse, error)
ItemPermissionsRequestApproval(ctx context.Context, params protocol.PermissionsRequestApprovalParams) (*protocol.PermissionsRequestApprovalResponse, error)
ItemToolCall(ctx context.Context, params protocol.DynamicToolCallParams) (*protocol.DynamicToolCallResponse, error)
ItemToolRequestUserInput(ctx context.Context, params protocol.ToolRequestUserInputParams) (*protocol.ToolRequestUserInputResponse, error)
McpServerElicitationRequest(ctx context.Context, params protocol.MCPServerElicitationRequestParams) (*protocol.MCPServerElicitationRequestResponse, error)
}
ServerRequestHandler handles requests initiated by the app-server. Embed UnimplementedServerRequestHandler so newly added methods do not break implementations. Canonical-initialism capability interfaces take precedence over legacy method spellings.
Deprecated: embed UnimplementedServerRequestHandler and override only required methods.
type ServerRequestHandlerError ¶ added in v0.147.0
ServerRequestHandlerError reports an error returned by an application handler.
func (*ServerRequestHandlerError) Error ¶ added in v0.147.0
func (e *ServerRequestHandlerError) Error() string
func (*ServerRequestHandlerError) Unwrap ¶ added in v0.147.0
func (e *ServerRequestHandlerError) Unwrap() error
type ServerRequestMethodError ¶ added in v0.147.0
type ServerRequestMethodError struct{ Method string }
ServerRequestMethodError reports an unsupported server-request method.
func (*ServerRequestMethodError) Error ¶ added in v0.147.0
func (e *ServerRequestMethodError) Error() string
type ServerRequestParamsError ¶ added in v0.147.0
ServerRequestParamsError reports parameters that could not be decoded.
func (*ServerRequestParamsError) Error ¶ added in v0.147.0
func (e *ServerRequestParamsError) Error() string
func (*ServerRequestParamsError) Unwrap ¶ added in v0.147.0
func (e *ServerRequestParamsError) Unwrap() error
type StdioTransport ¶
type StdioTransport struct {
// contains filtered or unexported fields
}
StdioTransport wraps a spawned process using stdin/stdout JSONL.
func SpawnStdio ¶
func SpawnStdio(ctx context.Context, binary string, args []string, stderr io.Writer) (*StdioTransport, error)
SpawnStdio starts a command and uses its stdin/stdout for JSON-RPC.
func (*StdioTransport) ReadLine ¶
func (t *StdioTransport) ReadLine() (string, error)
ReadLine reads a single line from stdout.
func (*StdioTransport) WriteLine ¶
func (t *StdioTransport) WriteLine(line string) error
WriteLine writes a single line to stdin.
type TranscriptDirection ¶
type TranscriptDirection string
TranscriptDirection describes the direction of a recorded line.
const ( TranscriptRead TranscriptDirection = "read" TranscriptWrite TranscriptDirection = "write" )
type TranscriptEntry ¶
type TranscriptEntry struct {
Direction TranscriptDirection `json:"direction"`
Line string `json:"line"`
}
TranscriptEntry stores a single JSON-RPC line and its direction.
type Transport ¶
Transport reads and writes JSON-RPC lines. ReadLine implementations must enforce a finite allocation limit and should return ErrMessageTooLarge when it is exceeded; implementations backed by bufio.Reader can use ReadLineLimited. Implementations should not block WriteLine indefinitely, and Close must unblock in-flight reads and writes so bounded SDK cleanup cannot leave transport goroutines running.
type UnimplementedServerRequestHandler ¶ added in v0.147.0
type UnimplementedServerRequestHandler struct{}
UnimplementedServerRequestHandler provides forward-compatible default methods.
func (UnimplementedServerRequestHandler) AccountChatgptAuthTokensRefresh ¶ added in v0.147.0
func (UnimplementedServerRequestHandler) AccountChatgptAuthTokensRefresh(context.Context, protocol.ChatgptAuthTokensRefreshParams) (*protocol.ChatgptAuthTokensRefreshResponse, error)
func (UnimplementedServerRequestHandler) ApplyPatchApproval ¶ added in v0.147.0
func (UnimplementedServerRequestHandler) ApplyPatchApproval(context.Context, protocol.ApplyPatchApprovalParams) (*protocol.ApplyPatchApprovalResponse, error)
func (UnimplementedServerRequestHandler) AttestationGenerate ¶ added in v0.147.0
func (UnimplementedServerRequestHandler) AttestationGenerate(context.Context, protocol.AttestationGenerateParams) (*protocol.AttestationGenerateResponse, error)
func (UnimplementedServerRequestHandler) ExecCommandApproval ¶ added in v0.147.0
func (UnimplementedServerRequestHandler) ExecCommandApproval(context.Context, protocol.ExecCommandApprovalParams) (*protocol.ExecCommandApprovalResponse, error)
func (UnimplementedServerRequestHandler) ItemCommandExecutionRequestApproval ¶ added in v0.147.0
func (UnimplementedServerRequestHandler) ItemCommandExecutionRequestApproval(context.Context, protocol.CommandExecutionRequestApprovalParams) (*protocol.CommandExecutionRequestApprovalResponse, error)
func (UnimplementedServerRequestHandler) ItemFileChangeRequestApproval ¶ added in v0.147.0
func (UnimplementedServerRequestHandler) ItemFileChangeRequestApproval(context.Context, protocol.FileChangeRequestApprovalParams) (*protocol.FileChangeRequestApprovalResponse, error)
func (UnimplementedServerRequestHandler) ItemPermissionsRequestApproval ¶ added in v0.147.0
func (UnimplementedServerRequestHandler) ItemPermissionsRequestApproval(context.Context, protocol.PermissionsRequestApprovalParams) (*protocol.PermissionsRequestApprovalResponse, error)
func (UnimplementedServerRequestHandler) ItemToolCall ¶ added in v0.147.0
func (UnimplementedServerRequestHandler) ItemToolCall(context.Context, protocol.DynamicToolCallParams) (*protocol.DynamicToolCallResponse, error)
func (UnimplementedServerRequestHandler) ItemToolRequestUserInput ¶ added in v0.147.0
func (UnimplementedServerRequestHandler) ItemToolRequestUserInput(context.Context, protocol.ToolRequestUserInputParams) (*protocol.ToolRequestUserInputResponse, error)
func (UnimplementedServerRequestHandler) McpServerElicitationRequest ¶ added in v0.147.0
func (UnimplementedServerRequestHandler) McpServerElicitationRequest(context.Context, protocol.MCPServerElicitationRequestParams) (*protocol.MCPServerElicitationRequestResponse, error)