copilot_sdk_web library

Copilot SDK — web-safe exports.

Exports the WebSocket transport which works in browsers. For desktop/server with stdio/TCP, use copilot_sdk_io.dart.

Classes

AbortEvent
Indicates the agent session was aborted, with a human-readable reason.
AccountQuota
Account quota information.
AgentInfo
Information about an agent.
AssistantIntentEvent
AssistantMessageDeltaEvent
AssistantMessageEvent
AssistantReasoningDeltaEvent
AssistantReasoningEvent
AssistantReply
Represents a complete assistant reply.
AssistantStreamingDeltaEvent
AssistantTurnEndEvent
AssistantTurnStartEvent
AssistantUsageEvent
Attachment
Attachment for a message (sealed hierarchy).
AzureProviderOptions
Azure-specific provider options.
BaseHookInput
Base fields present on all hook inputs from the CLI.
CompactionResult
Result of a compaction operation.
CopilotClient
Client for communicating with the Copilot CLI server.
CopilotClientOptions
Options for creating a CopilotClient.
CopilotSession
A Copilot agent session.
CustomAgentConfig
Custom agent configuration.
DirectoryAttachment
Directory attachment.
ErrorOccurredInput
Input for the errorOccurred hook.
ErrorOccurredOutput
Output for the errorOccurred hook.
FileAttachment
File attachment.
ForegroundSessionInfo
Foreground session info.
GetAuthStatusResponse
Response from auth.getStatus.
GetStatusResponse
Response from status.get.
HookEndEvent
HookInvocation
Context for hook invocations.
HookStartEvent
InfiniteSessionConfig
Infinite session configuration with compaction thresholds.
JsonRpcTransport
Abstract interface for JSON-RPC transports.
McpLocalServerConfig
Local/stdio MCP server configuration.
McpRemoteServerConfig
Remote HTTP or SSE MCP server configuration.
McpServerConfig
MCP server configuration (sealed hierarchy).
MessageOptions
ModelBilling
Model billing information.
ModelCapabilities
Model capabilities and limits.
ModelInfo
Information about an available model.
ModelPolicy
Model policy state.
PendingMessagesModifiedEvent
PermissionInvocation
Context for a permission invocation.
PermissionRequest
Permission request from the CLI.
PermissionResult
Permission result to send back.
PlanReadResult
Result of reading a session plan.
PostToolUseInput
Input for the postToolUse hook.
PostToolUseOutput
Output for the postToolUse hook.
PreToolUseInput
Input for the preToolUse hook.
PreToolUseOutput
Output for the preToolUse hook.
ProviderConfig
BYOK (Bring Your Own Key) provider configuration.
QuotaSnapshot
Quota snapshot for a specific quota type.
ResumeSessionConfig
Configuration for resuming an existing session.
SelectionAttachment
Selection (code range) attachment.
SelectionPosition
Line/character position within a file.
SelectionRange
Line/column range for a selection attachment.
SessionCompactionCompleteEvent
SessionCompactionStartEvent
SessionConfig
Configuration for creating a new session.
SessionContext
Working directory context for a session.
SessionContextChangedEvent
SessionEndInput
Input for the sessionEnd hook.
SessionEndOutput
Output for the sessionEnd hook.
SessionErrorEvent
SessionEvent
Base class for all session events.
SessionHandoffEvent
SessionHooks
Lifecycle hooks for Copilot sessions.
SessionIdleEvent
SessionInfoEvent
SessionLifecycleEvent
A session lifecycle event emitted by the CLI.
SessionListFilter
Filter options for listing sessions.
SessionMetadata
Metadata about a session.
SessionModeChangedEvent
SessionModelChangeEvent
SessionPlanChangedEvent
SessionResumeEvent
SessionShutdownEvent
SessionSnapshotRewindEvent
SessionStartEvent
SessionStartInput
Input for the sessionStart hook.
SessionStartOutput
Output for the sessionStart hook.
SessionTaskCompleteEvent
SessionTitleChangedEvent
SessionTruncationEvent
SessionUsageInfoEvent
SessionWarningEvent
SessionWorkspaceFileChangedEvent
SkillInvokedEvent
SubagentCompletedEvent
SubagentFailedEvent
SubagentSelectedEvent
SubagentStartedEvent
SystemMessageAppend
Append mode: SDK-managed system message with optional appended content.
SystemMessageConfig
System message configuration.
SystemMessageEvent
SystemMessageReplace
Replace mode: Fully custom system message.
Tool
Tool definition for registering custom tools with Copilot sessions.
ToolBinaryResult
Binary data result from a tool (images, files, etc.).
ToolExecutionCompleteEvent
ToolExecutionPartialResultEvent
ToolExecutionProgressEvent
ToolExecutionStartEvent
ToolInfo
Tool info from tools.list.
ToolInvocation
Context provided to tool handlers during invocation.
ToolResult
Result returned from a tool handler.
ToolResultFailure
A failed tool result.
ToolResultObject
A full tool result object with all fields.
ToolResultSuccess
A successful tool result.
ToolUserRequestedEvent
UnknownEvent
Catch-all for unknown or future event types.
UserInputInvocation
Context for a user input invocation.
UserInputRequest
User input request from the CLI.
UserInputResponse
User input response.
UserMessageEvent
UserPromptSubmittedInput
Input for the userPromptSubmitted hook.
UserPromptSubmittedOutput
Output for the userPromptSubmitted hook.
VisionLimits
Vision-specific model limits.
WebSocketTransport
Transport that communicates via WebSocket.

Enums

AgentMode
Agent operating mode.
ConnectionState
Connection state of the Copilot client.
LogLevel
Log levels for the CLI server.
MessageDeliveryMode
Options for sending a message. Message delivery mode for session.send.
ReasoningEffort
Reasoning effort level.
SessionLifecycleEventType
Session lifecycle event type.
ToolResultType
Result type for tool execution.

Constants

approveAll → const Future<PermissionResult> Function(PermissionRequest request, PermissionInvocation invocation)
Alias matching the upstream SDK name approveAll.
sdkProtocolVersion → const int
The expected protocol version for the Copilot CLI.

Functions

approveAllPermissions(PermissionRequest request, PermissionInvocation invocation) Future<PermissionResult>
Convenience function to approve all permissions.
defineTool(String name, {String? description, Map<String, dynamic>? parameters, required ToolHandler handler}) Tool
Convenience factory matching the upstream SDK defineTool helper.
normalizeToolResult(dynamic result) ToolResult
Normalizes any tool handler return value to a ToolResult.

Typedefs

HookHandler<TInput, TOutput> = Future<TOutput?> Function(TInput input, HookInvocation invocation)
Hook handler function type.
PermissionHandler = Future<PermissionResult> Function(PermissionRequest request, PermissionInvocation invocation)
Handler for permission requests.
ToolHandler = Future<ToolResult> Function(dynamic args, ToolInvocation invocation)
Handler function type for tool invocations.
UserInputHandler = Future<UserInputResponse> Function(UserInputRequest request, UserInputInvocation invocation)
Handler for user input requests.

Exceptions / Errors

JsonRpcError
Error received in a JSON-RPC error response.