/** * AUTO-GENERATED FILE - DO NOT EDIT * Generated from: api.schema.json */ import type { MessageConnection } from "vscode-jsonrpc/node.js"; /** * Authentication type * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "AuthInfoType". */ export type AuthInfoType = "hmac" | "env" | "user" | "gh-cli" | "api-key" | "token" | "copilot-api-token"; /** * Server transport type: stdio, http, sse, or memory (local configs are normalized to stdio) * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "DiscoveredMcpServerType". */ export type DiscoveredMcpServerType = "stdio" | "http" | "sse" | "memory"; /** * Configuration source * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "DiscoveredMcpServerSource". */ export type DiscoveredMcpServerSource = "user" | "workspace" | "plugin" | "builtin"; /** * Discovery source: project (.github/extensions/) or user (~/.copilot/extensions/) * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "ExtensionSource". */ export type ExtensionSource = "project" | "user"; /** * Current status: running, disabled, failed, or starting * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "ExtensionStatus". */ export type ExtensionStatus = "running" | "disabled" | "failed" | "starting"; export type FilterMapping = | { [k: string]: FilterMappingValue; } | FilterMappingString; export type FilterMappingValue = "none" | "markdown" | "hidden_characters"; export type FilterMappingString = "none" | "markdown" | "hidden_characters"; /** * Category of instruction source — used for merge logic * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "InstructionsSourcesType". */ export type InstructionsSourcesType = "home" | "repo" | "model" | "vscode" | "nested-agents" | "child-instructions"; /** * Where this source lives — used for UI grouping * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "InstructionsSourcesLocation". */ export type InstructionsSourcesLocation = "user" | "repository" | "working-directory"; /** * Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionLogLevel". */ export type SessionLogLevel = "info" | "warning" | "error"; /** * MCP server configuration (local/stdio or remote/http) * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "McpServerConfig". */ export type McpServerConfig = McpServerConfigLocal | McpServerConfigHttp; export type McpServerConfigLocalType = "local" | "stdio"; /** * Remote transport type. Defaults to "http" when omitted. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "McpServerConfigHttpType". */ export type McpServerConfigHttpType = "http" | "sse"; /** * Connection status: connected, failed, needs-auth, pending, disabled, or not_configured * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "McpServerStatus". */ export type McpServerStatus = "connected" | "failed" | "needs-auth" | "pending" | "disabled" | "not_configured"; /** * Configuration source: user, workspace, plugin, or builtin * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "McpServerSource". */ export type McpServerSource = "user" | "workspace" | "plugin" | "builtin"; /** * The agent mode. Valid values: "interactive", "plan", "autopilot". * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionMode". */ export type SessionMode = "interactive" | "plan" | "autopilot"; export type PermissionDecision = | PermissionDecisionApproveOnce | PermissionDecisionApproveForSession | PermissionDecisionApproveForLocation | PermissionDecisionReject | PermissionDecisionUserNotAvailable; /** * The approval to add as a session-scoped rule * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "PermissionDecisionApproveForSessionApproval". */ export type PermissionDecisionApproveForSessionApproval = | PermissionDecisionApproveForSessionApprovalCommands | PermissionDecisionApproveForSessionApprovalRead | PermissionDecisionApproveForSessionApprovalWrite | PermissionDecisionApproveForSessionApprovalMcp | PermissionDecisionApproveForSessionApprovalMcpSampling | PermissionDecisionApproveForSessionApprovalMemory | PermissionDecisionApproveForSessionApprovalCustomTool; /** * The approval to persist for this location * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "PermissionDecisionApproveForLocationApproval". */ export type PermissionDecisionApproveForLocationApproval = | PermissionDecisionApproveForLocationApprovalCommands | PermissionDecisionApproveForLocationApprovalRead | PermissionDecisionApproveForLocationApprovalWrite | PermissionDecisionApproveForLocationApprovalMcp | PermissionDecisionApproveForLocationApprovalMcpSampling | PermissionDecisionApproveForLocationApprovalMemory | PermissionDecisionApproveForLocationApprovalCustomTool; /** * Error classification * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsErrorCode". */ export type SessionFsErrorCode = "ENOENT" | "UNKNOWN"; /** * Entry type * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsReaddirWithTypesEntryType". */ export type SessionFsReaddirWithTypesEntryType = "file" | "directory"; /** * Path conventions used by this filesystem * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsSetProviderConventions". */ export type SessionFsSetProviderConventions = "windows" | "posix"; /** * Signal to send (default: SIGTERM) * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "ShellKillSignal". */ export type ShellKillSignal = "SIGTERM" | "SIGKILL" | "SIGINT"; /** * Tool call result (string or expanded result object) * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "ToolsHandlePendingToolCall". */ export type ToolsHandlePendingToolCall = string | ToolCallResult; export type UIElicitationFieldValue = string | number | boolean | string[]; export type UIElicitationSchemaProperty = | UIElicitationStringEnumField | UIElicitationStringOneOfField | UIElicitationArrayEnumField | UIElicitationArrayAnyOfField | UIElicitationSchemaPropertyBoolean | UIElicitationSchemaPropertyString | UIElicitationSchemaPropertyNumber; export type UIElicitationSchemaPropertyStringFormat = "email" | "uri" | "date" | "date-time"; export type UIElicitationSchemaPropertyNumberType = "number" | "integer"; /** * The user's response: accept (submitted), decline (rejected), or cancel (dismissed) * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "UIElicitationResponseAction". */ export type UIElicitationResponseAction = "accept" | "decline" | "cancel"; export interface AccountGetQuotaRequest { /** * GitHub token for per-user quota lookup. When provided, resolves this token to determine the user's quota instead of using the global auth. */ gitHubToken?: string; } export interface AccountGetQuotaResult { /** * Quota snapshots keyed by type (e.g., chat, completions, premium_interactions) */ quotaSnapshots: { [k: string]: AccountQuotaSnapshot; }; } export interface AccountQuotaSnapshot { /** * Whether the user has an unlimited usage entitlement */ isUnlimitedEntitlement: boolean; /** * Number of requests included in the entitlement */ entitlementRequests: number; /** * Number of requests used so far this period */ usedRequests: number; /** * Whether usage is still permitted after quota exhaustion */ usageAllowedWithExhaustedQuota: boolean; /** * Percentage of entitlement remaining */ remainingPercentage: number; /** * Number of overage requests made this period */ overage: number; /** * Whether overage is allowed when quota is exhausted */ overageAllowedWithExhaustedQuota: boolean; /** * Date when the quota resets (ISO 8601 string) */ resetDate?: string; } /** @experimental */ export interface AgentGetCurrentResult { /** * Currently selected custom agent, or null if using the default agent */ agent?: AgentInfo | null; } export interface AgentInfo { /** * Unique identifier of the custom agent */ name: string; /** * Human-readable display name */ displayName: string; /** * Description of the agent's purpose */ description: string; } /** @experimental */ export interface AgentList { /** * Available custom agents */ agents: AgentInfo[]; } /** @experimental */ export interface AgentReloadResult { /** * Reloaded custom agents */ agents: AgentInfo[]; } /** @experimental */ export interface AgentSelectRequest { /** * Name of the custom agent to select */ name: string; } /** @experimental */ export interface AgentSelectResult { agent: AgentInfo; } export interface CommandsHandlePendingCommandRequest { /** * Request ID from the command invocation event */ requestId: string; /** * Error message if the command handler failed */ error?: string; } export interface CommandsHandlePendingCommandResult { /** * Whether the command was handled successfully */ success: boolean; } export interface CurrentModel { /** * Currently active model identifier */ modelId?: string; } export interface DiscoveredMcpServer { /** * Server name (config key) */ name: string; type?: DiscoveredMcpServerType; source: DiscoveredMcpServerSource; /** * Whether the server is enabled (not in the disabled list) */ enabled: boolean; } export interface Extension { /** * Source-qualified ID (e.g., 'project:my-ext', 'user:auth-helper') */ id: string; /** * Extension name (directory name) */ name: string; source: ExtensionSource; status: ExtensionStatus; /** * Process ID if the extension is running */ pid?: number; } /** @experimental */ export interface ExtensionList { /** * Discovered extensions and their current status */ extensions: Extension[]; } /** @experimental */ export interface ExtensionsDisableRequest { /** * Source-qualified extension ID to disable */ id: string; } /** @experimental */ export interface ExtensionsEnableRequest { /** * Source-qualified extension ID to enable */ id: string; } /** @experimental */ export interface FleetStartRequest { /** * Optional user prompt to combine with fleet instructions */ prompt?: string; } /** @experimental */ export interface FleetStartResult { /** * Whether fleet mode was successfully activated */ started: boolean; } export interface HandleToolCallResult { /** * Whether the tool call result was handled successfully */ success: boolean; } /** * Post-compaction context window usage breakdown * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "HistoryCompactContextWindow". */ export interface HistoryCompactContextWindow { /** * Maximum token count for the model's context window */ tokenLimit: number; /** * Current total tokens in the context window (system + conversation + tool definitions) */ currentTokens: number; /** * Current number of messages in the conversation */ messagesLength: number; /** * Token count from system message(s) */ systemTokens?: number; /** * Token count from non-system messages (user, assistant, tool) */ conversationTokens?: number; /** * Token count from tool definitions */ toolDefinitionsTokens?: number; } /** @experimental */ export interface HistoryCompactResult { /** * Whether compaction completed successfully */ success: boolean; /** * Number of tokens freed by compaction */ tokensRemoved: number; /** * Number of messages removed during compaction */ messagesRemoved: number; contextWindow?: HistoryCompactContextWindow; } /** @experimental */ export interface HistoryTruncateRequest { /** * Event ID to truncate to. This event and all events after it are removed from the session. */ eventId: string; } /** @experimental */ export interface HistoryTruncateResult { /** * Number of events that were removed */ eventsRemoved: number; } export interface InstructionsGetSourcesResult { /** * Instruction sources for the session */ sources: InstructionsSources[]; } export interface InstructionsSources { /** * Unique identifier for this source (used for toggling) */ id: string; /** * Human-readable label */ label: string; /** * File path relative to repo or absolute for home */ sourcePath: string; /** * Raw content of the instruction file */ content: string; type: InstructionsSourcesType; location: InstructionsSourcesLocation; /** * Glob pattern from frontmatter — when set, this instruction applies only to matching files */ applyTo?: string; /** * Short description (body after frontmatter) for use in instruction tables */ description?: string; } export interface LogRequest { /** * Human-readable message */ message: string; level?: SessionLogLevel; /** * When true, the message is transient and not persisted to the session event log on disk */ ephemeral?: boolean; /** * Optional URL the user can open in their browser for more details */ url?: string; } export interface LogResult { /** * The unique identifier of the emitted session event */ eventId: string; } export interface McpConfigAddRequest { /** * Unique name for the MCP server */ name: string; config: McpServerConfig; } export interface McpServerConfigLocal { /** * Tools to include. Defaults to all tools if not specified. */ tools?: string[]; type?: McpServerConfigLocalType; isDefaultServer?: boolean; filterMapping?: FilterMapping; /** * Timeout in milliseconds for tool calls to this server. */ timeout?: number; command: string; args: string[]; cwd?: string; env?: { [k: string]: string; }; } export interface McpServerConfigHttp { /** * Tools to include. Defaults to all tools if not specified. */ tools?: string[]; type?: McpServerConfigHttpType; isDefaultServer?: boolean; filterMapping?: FilterMapping; /** * Timeout in milliseconds for tool calls to this server. */ timeout?: number; url: string; headers?: { [k: string]: string; }; oauthClientId?: string; oauthPublicClient?: boolean; } export interface McpConfigDisableRequest { /** * Names of MCP servers to disable. Each server is added to the persisted disabled list so new sessions skip it. Already-disabled names are ignored. Active sessions keep their current connections until they end. */ names: string[]; } export interface McpConfigEnableRequest { /** * Names of MCP servers to enable. Each server is removed from the persisted disabled list so new sessions spawn it. Unknown or already-enabled names are ignored. */ names: string[]; } export interface McpConfigList { /** * All MCP servers from user config, keyed by name */ servers: { [k: string]: McpServerConfig; }; } export interface McpConfigRemoveRequest { /** * Name of the MCP server to remove */ name: string; } export interface McpConfigUpdateRequest { /** * Name of the MCP server to update */ name: string; config: McpServerConfig; } /** @experimental */ export interface McpDisableRequest { /** * Name of the MCP server to disable */ serverName: string; } export interface McpDiscoverRequest { /** * Working directory used as context for discovery (e.g., plugin resolution) */ workingDirectory?: string; } export interface McpDiscoverResult { /** * MCP servers discovered from all sources */ servers: DiscoveredMcpServer[]; } /** @experimental */ export interface McpEnableRequest { /** * Name of the MCP server to enable */ serverName: string; } /** @experimental */ export interface McpOauthLoginRequest { /** * Name of the remote MCP server to authenticate */ serverName: string; /** * When true, clears any cached OAuth token for the server and runs a full new authorization. Use when the user explicitly wants to switch accounts or believes their session is stuck. */ forceReauth?: boolean; /** * Optional override for the OAuth client display name shown on the consent screen. Applies to newly registered dynamic clients only — existing registrations keep the name they were created with. When omitted, the runtime applies a neutral fallback; callers driving interactive auth should pass their own surface-specific label so the consent screen matches the product the user sees. */ clientName?: string; /** * Optional override for the body text shown on the OAuth loopback callback success page. When omitted, the runtime applies a neutral fallback; callers driving interactive auth should pass surface-specific copy telling the user where to return. */ callbackSuccessMessage?: string; } /** @experimental */ export interface McpOauthLoginResult { /** * URL the caller should open in a browser to complete OAuth. Omitted when cached tokens were still valid and no browser interaction was needed — the server is already reconnected in that case. When present, the runtime starts the callback listener before returning and continues the flow in the background; completion is signaled via session.mcp_server_status_changed. */ authorizationUrl?: string; } export interface McpServer { /** * Server name (config key) */ name: string; status: McpServerStatus; source?: McpServerSource; /** * Error message if the server failed to connect */ error?: string; } /** @experimental */ export interface McpServerList { /** * Configured MCP servers */ servers: McpServer[]; } export interface Model { /** * Model identifier (e.g., "claude-sonnet-4.5") */ id: string; /** * Display name */ name: string; capabilities: ModelCapabilities; policy?: ModelPolicy; billing?: ModelBilling; /** * Supported reasoning effort levels (only present if model supports reasoning effort) */ supportedReasoningEfforts?: string[]; /** * Default reasoning effort level (only present if model supports reasoning effort) */ defaultReasoningEffort?: string; } /** * Model capabilities and limits * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "ModelCapabilities". */ export interface ModelCapabilities { supports?: ModelCapabilitiesSupports; limits?: ModelCapabilitiesLimits; } /** * Feature flags indicating what the model supports * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "ModelCapabilitiesSupports". */ export interface ModelCapabilitiesSupports { /** * Whether this model supports vision/image input */ vision?: boolean; /** * Whether this model supports reasoning effort configuration */ reasoningEffort?: boolean; } /** * Token limits for prompts, outputs, and context window * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "ModelCapabilitiesLimits". */ export interface ModelCapabilitiesLimits { /** * Maximum number of prompt/input tokens */ max_prompt_tokens?: number; /** * Maximum number of output/completion tokens */ max_output_tokens?: number; /** * Maximum total context window size in tokens */ max_context_window_tokens?: number; vision?: ModelCapabilitiesLimitsVision; } /** * Vision-specific limits * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "ModelCapabilitiesLimitsVision". */ export interface ModelCapabilitiesLimitsVision { /** * MIME types the model accepts */ supported_media_types: string[]; /** * Maximum number of images per prompt */ max_prompt_images: number; /** * Maximum image size in bytes */ max_prompt_image_size: number; } /** * Policy state (if applicable) * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "ModelPolicy". */ export interface ModelPolicy { /** * Current policy state for this model */ state: string; /** * Usage terms or conditions for this model */ terms?: string; } /** * Billing information * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "ModelBilling". */ export interface ModelBilling { /** * Billing cost multiplier relative to the base rate */ multiplier: number; } /** * Override individual model capabilities resolved by the runtime * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "ModelCapabilitiesOverride". */ export interface ModelCapabilitiesOverride { supports?: ModelCapabilitiesOverrideSupports; limits?: ModelCapabilitiesOverrideLimits; } /** * Feature flags indicating what the model supports * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "ModelCapabilitiesOverrideSupports". */ export interface ModelCapabilitiesOverrideSupports { vision?: boolean; reasoningEffort?: boolean; } /** * Token limits for prompts, outputs, and context window * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "ModelCapabilitiesOverrideLimits". */ export interface ModelCapabilitiesOverrideLimits { max_prompt_tokens?: number; max_output_tokens?: number; /** * Maximum total context window size in tokens */ max_context_window_tokens?: number; vision?: ModelCapabilitiesOverrideLimitsVision; } export interface ModelCapabilitiesOverrideLimitsVision { /** * MIME types the model accepts */ supported_media_types?: string[]; /** * Maximum number of images per prompt */ max_prompt_images?: number; /** * Maximum image size in bytes */ max_prompt_image_size?: number; } export interface ModelList { /** * List of available models with full metadata */ models: Model[]; } export interface ModelsListRequest { /** * GitHub token for per-user model listing. When provided, resolves this token to determine the user's Copilot plan and available models instead of using the global auth. */ gitHubToken?: string; } export interface ModelSwitchToRequest { /** * Model identifier to switch to */ modelId: string; /** * Reasoning effort level to use for the model */ reasoningEffort?: string; modelCapabilities?: ModelCapabilitiesOverride; } export interface ModelSwitchToResult { /** * Currently active model identifier after the switch */ modelId?: string; } export interface ModeSetRequest { mode: SessionMode; } export interface NameGetResult { /** * The session name, falling back to the auto-generated summary, or null if neither exists */ name: string | null; } export interface NameSetRequest { /** * New session name (1–100 characters, trimmed of leading/trailing whitespace) */ name: string; } export interface PermissionDecisionApproveOnce { /** * The permission request was approved for this one instance */ kind: "approve-once"; } export interface PermissionDecisionApproveForSession { /** * Approved and remembered for the rest of the session */ kind: "approve-for-session"; approval: PermissionDecisionApproveForSessionApproval; } export interface PermissionDecisionApproveForSessionApprovalCommands { kind: "commands"; commandIdentifiers: string[]; } export interface PermissionDecisionApproveForSessionApprovalRead { kind: "read"; } export interface PermissionDecisionApproveForSessionApprovalWrite { kind: "write"; } export interface PermissionDecisionApproveForSessionApprovalMcp { kind: "mcp"; serverName: string; toolName: string | null; } export interface PermissionDecisionApproveForSessionApprovalMcpSampling { kind: "mcp-sampling"; serverName: string; } export interface PermissionDecisionApproveForSessionApprovalMemory { kind: "memory"; } export interface PermissionDecisionApproveForSessionApprovalCustomTool { kind: "custom-tool"; toolName: string; } export interface PermissionDecisionApproveForLocation { /** * Approved and persisted for this project location */ kind: "approve-for-location"; approval: PermissionDecisionApproveForLocationApproval; /** * The location key (git root or cwd) to persist the approval to */ locationKey: string; } export interface PermissionDecisionApproveForLocationApprovalCommands { kind: "commands"; commandIdentifiers: string[]; } export interface PermissionDecisionApproveForLocationApprovalRead { kind: "read"; } export interface PermissionDecisionApproveForLocationApprovalWrite { kind: "write"; } export interface PermissionDecisionApproveForLocationApprovalMcp { kind: "mcp"; serverName: string; toolName: string | null; } export interface PermissionDecisionApproveForLocationApprovalMcpSampling { kind: "mcp-sampling"; serverName: string; } export interface PermissionDecisionApproveForLocationApprovalMemory { kind: "memory"; } export interface PermissionDecisionApproveForLocationApprovalCustomTool { kind: "custom-tool"; toolName: string; } export interface PermissionDecisionReject { /** * Denied by the user during an interactive prompt */ kind: "reject"; /** * Optional feedback from the user explaining the denial */ feedback?: string; } export interface PermissionDecisionUserNotAvailable { /** * Denied because user confirmation was unavailable */ kind: "user-not-available"; } export interface PermissionDecisionRequest { /** * Request ID of the pending permission request */ requestId: string; result: PermissionDecision; } export interface PermissionRequestResult { /** * Whether the permission request was handled successfully */ success: boolean; } export interface PermissionsResetSessionApprovalsRequest {} export interface PermissionsResetSessionApprovalsResult { /** * Whether the operation succeeded */ success: boolean; } export interface PermissionsSetApproveAllRequest { /** * Whether to auto-approve all tool permission requests */ enabled: boolean; } export interface PermissionsSetApproveAllResult { /** * Whether the operation succeeded */ success: boolean; } export interface PingRequest { /** * Optional message to echo back */ message?: string; } export interface PingResult { /** * Echoed message (or default greeting) */ message: string; /** * Server timestamp in milliseconds */ timestamp: number; /** * Server protocol version number */ protocolVersion: number; } export interface PlanReadResult { /** * Whether the plan file exists in the workspace */ exists: boolean; /** * The content of the plan file, or null if it does not exist */ content: string | null; /** * Absolute file path of the plan file, or null if workspace is not enabled */ path: string | null; } export interface PlanUpdateRequest { /** * The new content for the plan file */ content: string; } export interface Plugin { /** * Plugin name */ name: string; /** * Marketplace the plugin came from */ marketplace: string; /** * Installed version */ version?: string; /** * Whether the plugin is currently enabled */ enabled: boolean; } /** @experimental */ export interface PluginList { /** * Installed plugins */ plugins: Plugin[]; } export interface ServerSkill { /** * Unique identifier for the skill */ name: string; /** * Description of what the skill does */ description: string; /** * Source location type (e.g., project, personal-copilot, plugin, builtin) */ source: string; /** * Whether the skill can be invoked by the user as a slash command */ userInvocable: boolean; /** * Whether the skill is currently enabled (based on global config) */ enabled: boolean; /** * Absolute path to the skill file */ path?: string; /** * The project path this skill belongs to (only for project/inherited skills) */ projectPath?: string; } export interface ServerSkillList { /** * All discovered skills across all sources */ skills: ServerSkill[]; } export interface SessionAuthStatus { /** * Whether the session has resolved authentication */ isAuthenticated: boolean; authType?: AuthInfoType; /** * Authentication host URL */ host?: string; /** * Authenticated login/username, if available */ login?: string; /** * Human-readable authentication status description */ statusMessage?: string; /** * Copilot plan tier (e.g., individual_pro, business) */ copilotPlan?: string; } export interface SessionFsAppendFileRequest { /** * Target session identifier */ sessionId: string; /** * Path using SessionFs conventions */ path: string; /** * Content to append */ content: string; /** * Optional POSIX-style mode for newly created files */ mode?: number; } /** * Describes a filesystem error. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsError". */ export interface SessionFsError { code: SessionFsErrorCode; /** * Free-form detail about the error, for logging/diagnostics */ message?: string; } export interface SessionFsExistsRequest { /** * Target session identifier */ sessionId: string; /** * Path using SessionFs conventions */ path: string; } export interface SessionFsExistsResult { /** * Whether the path exists */ exists: boolean; } export interface SessionFsMkdirRequest { /** * Target session identifier */ sessionId: string; /** * Path using SessionFs conventions */ path: string; /** * Create parent directories as needed */ recursive?: boolean; /** * Optional POSIX-style mode for newly created directories */ mode?: number; } export interface SessionFsReaddirRequest { /** * Target session identifier */ sessionId: string; /** * Path using SessionFs conventions */ path: string; } export interface SessionFsReaddirResult { /** * Entry names in the directory */ entries: string[]; error?: SessionFsError; } export interface SessionFsReaddirWithTypesEntry { /** * Entry name */ name: string; type: SessionFsReaddirWithTypesEntryType; } export interface SessionFsReaddirWithTypesRequest { /** * Target session identifier */ sessionId: string; /** * Path using SessionFs conventions */ path: string; } export interface SessionFsReaddirWithTypesResult { /** * Directory entries with type information */ entries: SessionFsReaddirWithTypesEntry[]; error?: SessionFsError; } export interface SessionFsReadFileRequest { /** * Target session identifier */ sessionId: string; /** * Path using SessionFs conventions */ path: string; } export interface SessionFsReadFileResult { /** * File content as UTF-8 string */ content: string; error?: SessionFsError; } export interface SessionFsRenameRequest { /** * Target session identifier */ sessionId: string; /** * Source path using SessionFs conventions */ src: string; /** * Destination path using SessionFs conventions */ dest: string; } export interface SessionFsRmRequest { /** * Target session identifier */ sessionId: string; /** * Path using SessionFs conventions */ path: string; /** * Remove directories and their contents recursively */ recursive?: boolean; /** * Ignore errors if the path does not exist */ force?: boolean; } export interface SessionFsSetProviderRequest { /** * Initial working directory for sessions */ initialCwd: string; /** * Path within each session's SessionFs where the runtime stores files for that session */ sessionStatePath: string; conventions: SessionFsSetProviderConventions; } export interface SessionFsSetProviderResult { /** * Whether the provider was set successfully */ success: boolean; } export interface SessionFsStatRequest { /** * Target session identifier */ sessionId: string; /** * Path using SessionFs conventions */ path: string; } export interface SessionFsStatResult { /** * Whether the path is a file */ isFile: boolean; /** * Whether the path is a directory */ isDirectory: boolean; /** * File size in bytes */ size: number; /** * ISO 8601 timestamp of last modification */ mtime: string; /** * ISO 8601 timestamp of creation */ birthtime: string; error?: SessionFsError; } export interface SessionFsWriteFileRequest { /** * Target session identifier */ sessionId: string; /** * Path using SessionFs conventions */ path: string; /** * Content to write */ content: string; /** * Optional POSIX-style mode for newly created files */ mode?: number; } /** @experimental */ export interface SessionsForkRequest { /** * Source session ID to fork from */ sessionId: string; /** * Optional event ID boundary. When provided, the fork includes only events before this ID (exclusive). When omitted, all events are included. */ toEventId?: string; } /** @experimental */ export interface SessionsForkResult { /** * The new forked session's ID */ sessionId: string; } export interface ShellExecRequest { /** * Shell command to execute */ command: string; /** * Working directory (defaults to session working directory) */ cwd?: string; /** * Timeout in milliseconds (default: 30000) */ timeout?: number; } export interface ShellExecResult { /** * Unique identifier for tracking streamed output */ processId: string; } export interface ShellKillRequest { /** * Process identifier returned by shell.exec */ processId: string; signal?: ShellKillSignal; } export interface ShellKillResult { /** * Whether the signal was sent successfully */ killed: boolean; } export interface Skill { /** * Unique identifier for the skill */ name: string; /** * Description of what the skill does */ description: string; /** * Source location type (e.g., project, personal, plugin) */ source: string; /** * Whether the skill can be invoked by the user as a slash command */ userInvocable: boolean; /** * Whether the skill is currently enabled */ enabled: boolean; /** * Absolute path to the skill file */ path?: string; } /** @experimental */ export interface SkillList { /** * Available skills */ skills: Skill[]; } export interface SkillsConfigSetDisabledSkillsRequest { /** * List of skill names to disable */ disabledSkills: string[]; } /** @experimental */ export interface SkillsDisableRequest { /** * Name of the skill to disable */ name: string; } export interface SkillsDiscoverRequest { /** * Optional list of project directory paths to scan for project-scoped skills */ projectPaths?: string[]; /** * Optional list of additional skill directory paths to include */ skillDirectories?: string[]; } /** @experimental */ export interface SkillsEnableRequest { /** * Name of the skill to enable */ name: string; } export interface Tool { /** * Tool identifier (e.g., "bash", "grep", "str_replace_editor") */ name: string; /** * Optional namespaced name for declarative filtering (e.g., "playwright/navigate" for MCP tools) */ namespacedName?: string; /** * Description of what the tool does */ description: string; /** * JSON Schema for the tool's input parameters */ parameters?: { [k: string]: unknown; }; /** * Optional instructions for how to use this tool effectively */ instructions?: string; } export interface ToolCallResult { /** * Text result to send back to the LLM */ textResultForLlm: string; /** * Type of the tool result */ resultType?: string; /** * Error message if the tool call failed */ error?: string; /** * Telemetry data from tool execution */ toolTelemetry?: { [k: string]: unknown; }; } export interface ToolList { /** * List of available built-in tools with metadata */ tools: Tool[]; } export interface ToolsHandlePendingToolCallRequest { /** * Request ID of the pending tool call */ requestId: string; result?: ToolsHandlePendingToolCall; /** * Error message if the tool call failed */ error?: string; } export interface ToolsListRequest { /** * Optional model ID — when provided, the returned tool list reflects model-specific overrides */ model?: string; } export interface UIElicitationArrayAnyOfField { type: "array"; title?: string; description?: string; minItems?: number; maxItems?: number; items: UIElicitationArrayAnyOfFieldItems; default?: string[]; } export interface UIElicitationArrayAnyOfFieldItems { anyOf: UIElicitationArrayAnyOfFieldItemsAnyOf[]; } export interface UIElicitationArrayAnyOfFieldItemsAnyOf { const: string; title: string; } export interface UIElicitationArrayEnumField { type: "array"; title?: string; description?: string; minItems?: number; maxItems?: number; items: UIElicitationArrayEnumFieldItems; default?: string[]; } export interface UIElicitationArrayEnumFieldItems { type: "string"; enum: string[]; } export interface UIElicitationRequest { /** * Message describing what information is needed from the user */ message: string; requestedSchema: UIElicitationSchema; } /** * JSON Schema describing the form fields to present to the user * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "UIElicitationSchema". */ export interface UIElicitationSchema { /** * Schema type indicator (always 'object') */ type: "object"; /** * Form field definitions, keyed by field name */ properties: { [k: string]: UIElicitationSchemaProperty; }; /** * List of required field names */ required?: string[]; } export interface UIElicitationStringEnumField { type: "string"; title?: string; description?: string; enum: string[]; enumNames?: string[]; default?: string; } export interface UIElicitationStringOneOfField { type: "string"; title?: string; description?: string; oneOf: UIElicitationStringOneOfFieldOneOf[]; default?: string; } export interface UIElicitationStringOneOfFieldOneOf { const: string; title: string; } export interface UIElicitationSchemaPropertyBoolean { type: "boolean"; title?: string; description?: string; default?: boolean; } export interface UIElicitationSchemaPropertyString { type: "string"; title?: string; description?: string; minLength?: number; maxLength?: number; format?: UIElicitationSchemaPropertyStringFormat; default?: string; } export interface UIElicitationSchemaPropertyNumber { type: UIElicitationSchemaPropertyNumberType; title?: string; description?: string; minimum?: number; maximum?: number; default?: number; } /** * The elicitation response (accept with form values, decline, or cancel) * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "UIElicitationResponse". */ export interface UIElicitationResponse { action: UIElicitationResponseAction; content?: UIElicitationResponseContent; } /** * The form values submitted by the user (present when action is 'accept') * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "UIElicitationResponseContent". */ export interface UIElicitationResponseContent { [k: string]: UIElicitationFieldValue; } export interface UIElicitationResult { /** * Whether the response was accepted. False if the request was already resolved by another client. */ success: boolean; } export interface UIHandlePendingElicitationRequest { /** * The unique request ID from the elicitation.requested event */ requestId: string; result: UIElicitationResponse; } /** @experimental */ export interface UsageGetMetricsResult { /** * Total user-initiated premium request cost across all models (may be fractional due to multipliers) */ totalPremiumRequestCost: number; /** * Raw count of user-initiated API requests */ totalUserRequests: number; /** * Total time spent in model API calls (milliseconds) */ totalApiDurationMs: number; /** * Session start timestamp (epoch milliseconds) */ sessionStartTime: number; codeChanges: UsageMetricsCodeChanges; /** * Per-model token and request metrics, keyed by model identifier */ modelMetrics: { [k: string]: UsageMetricsModelMetric; }; /** * Currently active model identifier */ currentModel?: string; /** * Input tokens from the most recent main-agent API call */ lastCallInputTokens: number; /** * Output tokens from the most recent main-agent API call */ lastCallOutputTokens: number; } /** * Aggregated code change metrics * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "UsageMetricsCodeChanges". */ export interface UsageMetricsCodeChanges { /** * Total lines of code added */ linesAdded: number; /** * Total lines of code removed */ linesRemoved: number; /** * Number of distinct files modified */ filesModifiedCount: number; } export interface UsageMetricsModelMetric { requests: UsageMetricsModelMetricRequests; usage: UsageMetricsModelMetricUsage; } /** * Request count and cost metrics for this model * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "UsageMetricsModelMetricRequests". */ export interface UsageMetricsModelMetricRequests { /** * Number of API requests made with this model */ count: number; /** * User-initiated premium request cost (with multiplier applied) */ cost: number; } /** * Token usage metrics for this model * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "UsageMetricsModelMetricUsage". */ export interface UsageMetricsModelMetricUsage { /** * Total input tokens consumed */ inputTokens: number; /** * Total output tokens produced */ outputTokens: number; /** * Total tokens read from prompt cache */ cacheReadTokens: number; /** * Total tokens written to prompt cache */ cacheWriteTokens: number; /** * Total output tokens used for reasoning */ reasoningTokens?: number; } export interface WorkspacesCreateFileRequest { /** * Relative path within the workspace files directory */ path: string; /** * File content to write as a UTF-8 string */ content: string; } export interface WorkspacesGetWorkspaceResult { /** * Current workspace metadata, or null if not available */ workspace: { id: string; cwd?: string; git_root?: string; repository?: string; host_type?: "github" | "ado"; branch?: string; summary?: string; name?: string; summary_count?: number; created_at?: string; updated_at?: string; remote_steerable?: boolean; mc_task_id?: string; mc_session_id?: string; mc_last_event_id?: string; session_sync_level?: "local" | "user" | "repo_and_user"; chronicle_sync_dismissed?: boolean; } | null; } export interface WorkspacesListFilesResult { /** * Relative file paths in the workspace files directory */ files: string[]; } export interface WorkspacesReadFileRequest { /** * Relative path within the workspace files directory */ path: string; } export interface WorkspacesReadFileResult { /** * File content as a UTF-8 string */ content: string; } /** Create typed server-scoped RPC methods (no session required). */ export function createServerRpc(connection: MessageConnection) { return { ping: async (params: PingRequest): Promise => connection.sendRequest("ping", params), models: { list: async (params?: ModelsListRequest): Promise => connection.sendRequest("models.list", params), }, tools: { list: async (params: ToolsListRequest): Promise => connection.sendRequest("tools.list", params), }, account: { getQuota: async (params?: AccountGetQuotaRequest): Promise => connection.sendRequest("account.getQuota", params), }, mcp: { config: { list: async (): Promise => connection.sendRequest("mcp.config.list", {}), add: async (params: McpConfigAddRequest): Promise => connection.sendRequest("mcp.config.add", params), update: async (params: McpConfigUpdateRequest): Promise => connection.sendRequest("mcp.config.update", params), remove: async (params: McpConfigRemoveRequest): Promise => connection.sendRequest("mcp.config.remove", params), enable: async (params: McpConfigEnableRequest): Promise => connection.sendRequest("mcp.config.enable", params), disable: async (params: McpConfigDisableRequest): Promise => connection.sendRequest("mcp.config.disable", params), }, discover: async (params: McpDiscoverRequest): Promise => connection.sendRequest("mcp.discover", params), }, skills: { config: { setDisabledSkills: async (params: SkillsConfigSetDisabledSkillsRequest): Promise => connection.sendRequest("skills.config.setDisabledSkills", params), }, discover: async (params: SkillsDiscoverRequest): Promise => connection.sendRequest("skills.discover", params), }, sessionFs: { setProvider: async (params: SessionFsSetProviderRequest): Promise => connection.sendRequest("sessionFs.setProvider", params), }, /** @experimental */ sessions: { fork: async (params: SessionsForkRequest): Promise => connection.sendRequest("sessions.fork", params), }, }; } /** Create typed session-scoped RPC methods. */ export function createSessionRpc(connection: MessageConnection, sessionId: string) { return { auth: { getStatus: async (): Promise => connection.sendRequest("session.auth.getStatus", { sessionId }), }, model: { getCurrent: async (): Promise => connection.sendRequest("session.model.getCurrent", { sessionId }), switchTo: async (params: ModelSwitchToRequest): Promise => connection.sendRequest("session.model.switchTo", { sessionId, ...params }), }, mode: { get: async (): Promise => connection.sendRequest("session.mode.get", { sessionId }), set: async (params: ModeSetRequest): Promise => connection.sendRequest("session.mode.set", { sessionId, ...params }), }, name: { get: async (): Promise => connection.sendRequest("session.name.get", { sessionId }), set: async (params: NameSetRequest): Promise => connection.sendRequest("session.name.set", { sessionId, ...params }), }, plan: { read: async (): Promise => connection.sendRequest("session.plan.read", { sessionId }), update: async (params: PlanUpdateRequest): Promise => connection.sendRequest("session.plan.update", { sessionId, ...params }), delete: async (): Promise => connection.sendRequest("session.plan.delete", { sessionId }), }, workspaces: { getWorkspace: async (): Promise => connection.sendRequest("session.workspaces.getWorkspace", { sessionId }), listFiles: async (): Promise => connection.sendRequest("session.workspaces.listFiles", { sessionId }), readFile: async (params: WorkspacesReadFileRequest): Promise => connection.sendRequest("session.workspaces.readFile", { sessionId, ...params }), createFile: async (params: WorkspacesCreateFileRequest): Promise => connection.sendRequest("session.workspaces.createFile", { sessionId, ...params }), }, instructions: { getSources: async (): Promise => connection.sendRequest("session.instructions.getSources", { sessionId }), }, /** @experimental */ fleet: { start: async (params: FleetStartRequest): Promise => connection.sendRequest("session.fleet.start", { sessionId, ...params }), }, /** @experimental */ agent: { list: async (): Promise => connection.sendRequest("session.agent.list", { sessionId }), getCurrent: async (): Promise => connection.sendRequest("session.agent.getCurrent", { sessionId }), select: async (params: AgentSelectRequest): Promise => connection.sendRequest("session.agent.select", { sessionId, ...params }), deselect: async (): Promise => connection.sendRequest("session.agent.deselect", { sessionId }), reload: async (): Promise => connection.sendRequest("session.agent.reload", { sessionId }), }, /** @experimental */ skills: { list: async (): Promise => connection.sendRequest("session.skills.list", { sessionId }), enable: async (params: SkillsEnableRequest): Promise => connection.sendRequest("session.skills.enable", { sessionId, ...params }), disable: async (params: SkillsDisableRequest): Promise => connection.sendRequest("session.skills.disable", { sessionId, ...params }), reload: async (): Promise => connection.sendRequest("session.skills.reload", { sessionId }), }, /** @experimental */ mcp: { list: async (): Promise => connection.sendRequest("session.mcp.list", { sessionId }), enable: async (params: McpEnableRequest): Promise => connection.sendRequest("session.mcp.enable", { sessionId, ...params }), disable: async (params: McpDisableRequest): Promise => connection.sendRequest("session.mcp.disable", { sessionId, ...params }), reload: async (): Promise => connection.sendRequest("session.mcp.reload", { sessionId }), /** @experimental */ oauth: { login: async (params: McpOauthLoginRequest): Promise => connection.sendRequest("session.mcp.oauth.login", { sessionId, ...params }), }, }, /** @experimental */ plugins: { list: async (): Promise => connection.sendRequest("session.plugins.list", { sessionId }), }, /** @experimental */ extensions: { list: async (): Promise => connection.sendRequest("session.extensions.list", { sessionId }), enable: async (params: ExtensionsEnableRequest): Promise => connection.sendRequest("session.extensions.enable", { sessionId, ...params }), disable: async (params: ExtensionsDisableRequest): Promise => connection.sendRequest("session.extensions.disable", { sessionId, ...params }), reload: async (): Promise => connection.sendRequest("session.extensions.reload", { sessionId }), }, tools: { handlePendingToolCall: async (params: ToolsHandlePendingToolCallRequest): Promise => connection.sendRequest("session.tools.handlePendingToolCall", { sessionId, ...params }), }, commands: { handlePendingCommand: async (params: CommandsHandlePendingCommandRequest): Promise => connection.sendRequest("session.commands.handlePendingCommand", { sessionId, ...params }), }, ui: { elicitation: async (params: UIElicitationRequest): Promise => connection.sendRequest("session.ui.elicitation", { sessionId, ...params }), handlePendingElicitation: async (params: UIHandlePendingElicitationRequest): Promise => connection.sendRequest("session.ui.handlePendingElicitation", { sessionId, ...params }), }, permissions: { handlePendingPermissionRequest: async (params: PermissionDecisionRequest): Promise => connection.sendRequest("session.permissions.handlePendingPermissionRequest", { sessionId, ...params }), setApproveAll: async (params: PermissionsSetApproveAllRequest): Promise => connection.sendRequest("session.permissions.setApproveAll", { sessionId, ...params }), resetSessionApprovals: async (): Promise => connection.sendRequest("session.permissions.resetSessionApprovals", { sessionId }), }, log: async (params: LogRequest): Promise => connection.sendRequest("session.log", { sessionId, ...params }), shell: { exec: async (params: ShellExecRequest): Promise => connection.sendRequest("session.shell.exec", { sessionId, ...params }), kill: async (params: ShellKillRequest): Promise => connection.sendRequest("session.shell.kill", { sessionId, ...params }), }, /** @experimental */ history: { compact: async (): Promise => connection.sendRequest("session.history.compact", { sessionId }), truncate: async (params: HistoryTruncateRequest): Promise => connection.sendRequest("session.history.truncate", { sessionId, ...params }), }, /** @experimental */ usage: { getMetrics: async (): Promise => connection.sendRequest("session.usage.getMetrics", { sessionId }), }, }; } /** Handler for `sessionFs` client session API methods. */ export interface SessionFsHandler { readFile(params: SessionFsReadFileRequest): Promise; writeFile(params: SessionFsWriteFileRequest): Promise; appendFile(params: SessionFsAppendFileRequest): Promise; exists(params: SessionFsExistsRequest): Promise; stat(params: SessionFsStatRequest): Promise; mkdir(params: SessionFsMkdirRequest): Promise; readdir(params: SessionFsReaddirRequest): Promise; readdirWithTypes(params: SessionFsReaddirWithTypesRequest): Promise; rm(params: SessionFsRmRequest): Promise; rename(params: SessionFsRenameRequest): Promise; } /** All client session API handler groups. */ export interface ClientSessionApiHandlers { sessionFs?: SessionFsHandler; } /** * Register client session API handlers on a JSON-RPC connection. * The server calls these methods to delegate work to the client. * Each incoming call includes a `sessionId` in the params; the registration * function uses `getHandlers` to resolve the session's handlers. */ export function registerClientSessionApiHandlers( connection: MessageConnection, getHandlers: (sessionId: string) => ClientSessionApiHandlers, ): void { connection.onRequest("sessionFs.readFile", async (params: SessionFsReadFileRequest) => { const handler = getHandlers(params.sessionId).sessionFs; if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`); return handler.readFile(params); }); connection.onRequest("sessionFs.writeFile", async (params: SessionFsWriteFileRequest) => { const handler = getHandlers(params.sessionId).sessionFs; if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`); return handler.writeFile(params); }); connection.onRequest("sessionFs.appendFile", async (params: SessionFsAppendFileRequest) => { const handler = getHandlers(params.sessionId).sessionFs; if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`); return handler.appendFile(params); }); connection.onRequest("sessionFs.exists", async (params: SessionFsExistsRequest) => { const handler = getHandlers(params.sessionId).sessionFs; if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`); return handler.exists(params); }); connection.onRequest("sessionFs.stat", async (params: SessionFsStatRequest) => { const handler = getHandlers(params.sessionId).sessionFs; if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`); return handler.stat(params); }); connection.onRequest("sessionFs.mkdir", async (params: SessionFsMkdirRequest) => { const handler = getHandlers(params.sessionId).sessionFs; if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`); return handler.mkdir(params); }); connection.onRequest("sessionFs.readdir", async (params: SessionFsReaddirRequest) => { const handler = getHandlers(params.sessionId).sessionFs; if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`); return handler.readdir(params); }); connection.onRequest("sessionFs.readdirWithTypes", async (params: SessionFsReaddirWithTypesRequest) => { const handler = getHandlers(params.sessionId).sessionFs; if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`); return handler.readdirWithTypes(params); }); connection.onRequest("sessionFs.rm", async (params: SessionFsRmRequest) => { const handler = getHandlers(params.sessionId).sessionFs; if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`); return handler.rm(params); }); connection.onRequest("sessionFs.rename", async (params: SessionFsRenameRequest) => { const handler = getHandlers(params.sessionId).sessionFs; if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`); return handler.rename(params); }); }