@github/copilot
Advanced tools
| import type { SessionFsHandler, SessionFsStatResult, SessionFsReaddirWithTypesEntry } from "./generated/rpc.js"; | ||
| /** | ||
| * File metadata returned by {@link SessionFsProvider.stat}. | ||
| * Same shape as the generated {@link SessionFsStatResult} but without the | ||
| * `error` field, since providers signal errors by throwing. | ||
| */ | ||
| export type SessionFsFileInfo = Omit<SessionFsStatResult, "error">; | ||
| /** | ||
| * Interface for session filesystem providers. Implementors use idiomatic | ||
| * TypeScript patterns: throw on error, return values directly. Use | ||
| * {@link createSessionFsAdapter} to convert a provider into the | ||
| * {@link SessionFsHandler} expected by the SDK. | ||
| * | ||
| * Errors with a `code` property of `"ENOENT"` are mapped to the ENOENT | ||
| * error code; all others map to UNKNOWN. | ||
| */ | ||
| export interface SessionFsProvider { | ||
| /** Reads the full content of a file. Throw if the file does not exist. */ | ||
| readFile(path: string): Promise<string>; | ||
| /** Writes content to a file, creating parent directories if needed. */ | ||
| writeFile(path: string, content: string, mode?: number): Promise<void>; | ||
| /** Appends content to a file, creating parent directories if needed. */ | ||
| appendFile(path: string, content: string, mode?: number): Promise<void>; | ||
| /** Checks whether a path exists. */ | ||
| exists(path: string): Promise<boolean>; | ||
| /** Gets metadata about a file or directory. Throw if it does not exist. */ | ||
| stat(path: string): Promise<SessionFsFileInfo>; | ||
| /** Creates a directory. If recursive is true, creates parents as needed. */ | ||
| mkdir(path: string, recursive: boolean, mode?: number): Promise<void>; | ||
| /** Lists entry names in a directory. Throw if it does not exist. */ | ||
| readdir(path: string): Promise<string[]>; | ||
| /** Lists entries with type info. Throw if the directory does not exist. */ | ||
| readdirWithTypes(path: string): Promise<SessionFsReaddirWithTypesEntry[]>; | ||
| /** Removes a file or directory. If force is true, do not throw on ENOENT. */ | ||
| rm(path: string, recursive: boolean, force: boolean): Promise<void>; | ||
| /** Renames/moves a file or directory. */ | ||
| rename(src: string, dest: string): Promise<void>; | ||
| } | ||
| /** | ||
| * Wraps a {@link SessionFsProvider} into the {@link SessionFsHandler} | ||
| * interface expected by the SDK, converting thrown errors into | ||
| * {@link SessionFsError} results. | ||
| */ | ||
| export declare function createSessionFsAdapter(provider: SessionFsProvider): SessionFsHandler; |
@@ -38,2 +38,3 @@ import { createServerRpc } from "./generated/rpc.js"; | ||
| export declare class CopilotClient { | ||
| private cliStartTimeout; | ||
| private cliProcess; | ||
@@ -93,2 +94,3 @@ private connection; | ||
| private parseCliUrl; | ||
| private validateSessionFsConfig; | ||
| /** | ||
@@ -95,0 +97,0 @@ * Starts the CLI server and establishes a connection. |
@@ -21,2 +21,3 @@ # Agent Extension Authoring Guide | ||
| Modify the generated `extension.mjs` using `edit` or `create` tools. The file must: | ||
| - Be named `extension.mjs` (only `.mjs` is supported) | ||
@@ -52,2 +53,3 @@ - Use ES module syntax (`import`/`export`) | ||
| Discovery rules: | ||
| - The CLI scans `.github/extensions/` relative to the git root | ||
@@ -67,4 +69,4 @@ - It also scans the user's copilot config extensions directory | ||
| await joinSession({ | ||
| tools: [], // Optional — custom tools | ||
| hooks: {}, // Optional — lifecycle hooks | ||
| tools: [], // Optional — custom tools | ||
| hooks: {}, // Optional — lifecycle hooks | ||
| }); | ||
@@ -80,5 +82,6 @@ ``` | ||
| { | ||
| name: "tool_name", // Required. Must be globally unique across all extensions. | ||
| name: "tool_name", // Required. Must be globally unique across all extensions. | ||
| description: "What it does", // Required. Shown to the agent in tool descriptions. | ||
| parameters: { // Optional. JSON Schema for the arguments. | ||
| parameters: { | ||
| // Optional. JSON Schema for the arguments. | ||
| type: "object", | ||
@@ -103,6 +106,7 @@ properties: { | ||
| }, | ||
| ] | ||
| ]; | ||
| ``` | ||
| **Constraints:** | ||
| - Tool names must be unique across ALL loaded extensions. Collisions cause the second extension to fail to load. | ||
@@ -203,2 +207,3 @@ - Handler must return a string or `{ textResultForLlm: string, resultType?: string }`. | ||
| Send a message programmatically: | ||
| ```js | ||
@@ -215,2 +220,3 @@ await session.send({ prompt: "Analyze the test results." }); | ||
| Send and block until the agent finishes (resolves on `session.idle`): | ||
| ```js | ||
@@ -224,2 +230,3 @@ const response = await session.sendAndWait({ prompt: "What is 2+2?" }); | ||
| Log to the CLI timeline: | ||
| ```js | ||
@@ -235,2 +242,3 @@ await session.log("Extension ready"); | ||
| Subscribe to session events. Returns an unsubscribe function. | ||
| ```js | ||
@@ -244,12 +252,12 @@ const unsub = session.on("tool.execution_complete", (event) => { | ||
| | Event | Key Data Fields | | ||
| |-------|----------------| | ||
| | `assistant.message` | `content`, `messageId` | | ||
| | `tool.execution_start` | `toolCallId`, `toolName`, `arguments` | | ||
| | Event | Key Data Fields | | ||
| | ------------------------- | ------------------------------------------------------ | | ||
| | `assistant.message` | `content`, `messageId` | | ||
| | `tool.execution_start` | `toolCallId`, `toolName`, `arguments` | | ||
| | `tool.execution_complete` | `toolCallId`, `toolName`, `success`, `result`, `error` | | ||
| | `user.message` | `content`, `attachments`, `source` | | ||
| | `session.idle` | `backgroundTasks` | | ||
| | `session.error` | `errorType`, `message`, `stack` | | ||
| | `permission.requested` | `requestId`, `permissionRequest.kind` | | ||
| | `session.shutdown` | `shutdownType`, `totalPremiumRequests` | | ||
| | `user.message` | `content`, `attachments`, `source` | | ||
| | `session.idle` | `backgroundTasks` | | ||
| | `session.error` | `errorType`, `message`, `stack` | | ||
| | `permission.requested` | `requestId`, `permissionRequest.kind` | | ||
| | `session.shutdown` | `shutdownType`, `totalPremiumRequests` | | ||
@@ -256,0 +264,0 @@ ### session.workspacePath |
@@ -13,4 +13,8 @@ # Copilot CLI Extension Examples | ||
| const session = await joinSession({ | ||
| hooks: { /* ... */ }, | ||
| tools: [ /* ... */ ], | ||
| hooks: { | ||
| /* ... */ | ||
| }, | ||
| tools: [ | ||
| /* ... */ | ||
| ], | ||
| }); | ||
@@ -22,2 +26,3 @@ ``` | ||
| > **Platform notes (Windows vs macOS/Linux):** | ||
| > | ||
| > - Use `process.platform === "win32"` to detect Windows at runtime. | ||
@@ -76,3 +81,3 @@ > - Clipboard: `pbcopy` on macOS, `clip` on Windows. | ||
| }, | ||
| ] | ||
| ]; | ||
| ``` | ||
@@ -142,3 +147,3 @@ | ||
| return "done"; | ||
| } | ||
| }; | ||
| ``` | ||
@@ -154,10 +159,10 @@ | ||
| | Hook | Fires When | Can Modify | | ||
| |------|-----------|------------| | ||
| | `onUserPromptSubmitted` | User sends a message | The prompt text, add context | | ||
| | `onPreToolUse` | Before a tool executes | Tool args, permission decision, add context | | ||
| | `onPostToolUse` | After a tool executes | Tool result, add context | | ||
| | `onSessionStart` | Session starts or resumes | Add context, modify config | | ||
| | `onSessionEnd` | Session ends | Cleanup actions, summary | | ||
| | `onErrorOccurred` | An error occurs | Error handling strategy (retry/skip/abort) | | ||
| | Hook | Fires When | Can Modify | | ||
| | ----------------------- | ------------------------- | ------------------------------------------- | | ||
| | `onUserPromptSubmitted` | User sends a message | The prompt text, add context | | ||
| | `onPreToolUse` | Before a tool executes | Tool args, permission decision, add context | | ||
| | `onPostToolUse` | After a tool executes | Tool result, add context | | ||
| | `onSessionStart` | Session starts or resumes | Add context, modify config | | ||
| | `onSessionEnd` | Session ends | Cleanup actions, summary | | ||
| | `onErrorOccurred` | An error occurs | Error handling strategy (retry/skip/abort) | | ||
@@ -408,14 +413,14 @@ All hook inputs include `timestamp` (unix ms) and `cwd` (working directory). | ||
| | Event Type | Description | Key Data Fields | | ||
| |-----------|-------------|-----------------| | ||
| | `assistant.message` | Agent's final response | `content`, `messageId`, `toolRequests` | | ||
| | `assistant.streaming_delta` | Token-by-token streaming (ephemeral) | `totalResponseSizeBytes` | | ||
| | `tool.execution_start` | A tool is about to run | `toolCallId`, `toolName`, `arguments` | | ||
| | `tool.execution_complete` | A tool finished running | `toolCallId`, `toolName`, `success`, `result`, `error` | | ||
| | `user.message` | User sent a message | `content`, `attachments`, `source` | | ||
| | `session.idle` | Session finished processing a turn | `backgroundTasks` | | ||
| | `session.error` | An error occurred | `errorType`, `message`, `stack` | | ||
| | `permission.requested` | Agent needs permission (shell, file write, etc.) | `requestId`, `permissionRequest.kind` | | ||
| | `session.shutdown` | Session is ending | `shutdownType`, `totalPremiumRequests`, `codeChanges` | | ||
| | `assistant.turn_start` | Agent begins a new thinking/response cycle | `turnId` | | ||
| | Event Type | Description | Key Data Fields | | ||
| | --------------------------- | ------------------------------------------------ | ------------------------------------------------------ | | ||
| | `assistant.message` | Agent's final response | `content`, `messageId`, `toolRequests` | | ||
| | `assistant.streaming_delta` | Token-by-token streaming (ephemeral) | `totalResponseSizeBytes` | | ||
| | `tool.execution_start` | A tool is about to run | `toolCallId`, `toolName`, `arguments` | | ||
| | `tool.execution_complete` | A tool finished running | `toolCallId`, `toolName`, `success`, `result`, `error` | | ||
| | `user.message` | User sent a message | `content`, `attachments`, `source` | | ||
| | `session.idle` | Session finished processing a turn | `backgroundTasks` | | ||
| | `session.error` | An error occurred | `errorType`, `message`, `stack` | | ||
| | `permission.requested` | Agent needs permission (shell, file write, etc.) | `requestId`, `permissionRequest.kind` | | ||
| | `session.shutdown` | Session is ending | `shutdownType`, `totalPremiumRequests`, `codeChanges` | | ||
| | `assistant.turn_start` | Agent begins a new thinking/response cycle | `turnId` | | ||
@@ -444,4 +449,6 @@ ### Example: Detecting when the plan file is created or edited | ||
| session.on("tool.execution_start", (event) => { | ||
| if ((event.data.toolName === "edit" || event.data.toolName === "create") | ||
| && String(event.data.arguments?.path || "").endsWith("plan.md")) { | ||
| if ( | ||
| (event.data.toolName === "edit" || event.data.toolName === "create") && | ||
| String(event.data.arguments?.path || "").endsWith("plan.md") | ||
| ) { | ||
| agentEdits.add(event.data.toolCallId); | ||
@@ -549,5 +556,3 @@ recentAgentPaths.add(planPath); | ||
| prompt: "Review this file", | ||
| attachments: [ | ||
| { type: "file", path: "./src/index.ts" }, | ||
| ], | ||
| attachments: [{ type: "file", path: "./src/index.ts" }], | ||
| }); | ||
@@ -628,3 +633,3 @@ ``` | ||
| const cmd = String(input.toolArgs?.command || ""); | ||
| if (/rm\\s+-rf\\s+\\//i.test(cmd) || /Remove-Item\\s+.*-Recurse/i.test(cmd)) { | ||
| if (/rm\\s+-rf\\s+\\/ / i.test(cmd) || /Remove-Item\\s+.*-Recurse/i.test(cmd)) { | ||
| return { permissionDecision: "deny" }; | ||
@@ -677,2 +682,1 @@ } | ||
| ``` | ||
| import type { CopilotSession } from "./session.js"; | ||
| import type { PermissionHandler, ResumeSessionConfig } from "./types.js"; | ||
| import { type PermissionHandler, type ResumeSessionConfig } from "./types.js"; | ||
| export type JoinSessionConfig = Omit<ResumeSessionConfig, "onPermissionRequest"> & { | ||
@@ -4,0 +4,0 @@ onPermissionRequest?: PermissionHandler; |
+1415
-964
@@ -6,330 +6,271 @@ /** | ||
| import type { MessageConnection } from "vscode-jsonrpc/node.js"; | ||
| export interface PingResult { | ||
| /** | ||
| * 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 { | ||
| /** | ||
| * Echoed message (or default greeting) | ||
| * GitHub token for per-user quota lookup. When provided, resolves this token to determine the user's quota instead of using the global auth. | ||
| */ | ||
| message: string; | ||
| gitHubToken?: string; | ||
| } | ||
| export interface AccountGetQuotaResult { | ||
| /** | ||
| * Server timestamp in milliseconds | ||
| * Quota snapshots keyed by type (e.g., chat, completions, premium_interactions) | ||
| */ | ||
| timestamp: number; | ||
| quotaSnapshots: { | ||
| [k: string]: AccountQuotaSnapshot; | ||
| }; | ||
| } | ||
| export interface AccountQuotaSnapshot { | ||
| /** | ||
| * Server protocol version number | ||
| * Whether the user has an unlimited usage entitlement | ||
| */ | ||
| protocolVersion: number; | ||
| } | ||
| export interface PingParams { | ||
| isUnlimitedEntitlement: boolean; | ||
| /** | ||
| * Optional message to echo back | ||
| * Number of requests included in the entitlement | ||
| */ | ||
| message?: string; | ||
| } | ||
| export interface ModelsListResult { | ||
| entitlementRequests: number; | ||
| /** | ||
| * List of available models with full metadata | ||
| * Number of requests used so far this period | ||
| */ | ||
| models: { | ||
| /** | ||
| * Model identifier (e.g., "claude-sonnet-4.5") | ||
| */ | ||
| id: string; | ||
| /** | ||
| * Display name | ||
| */ | ||
| name: string; | ||
| /** | ||
| * Model capabilities and limits | ||
| */ | ||
| capabilities: { | ||
| /** | ||
| * Feature flags indicating what the model supports | ||
| */ | ||
| supports: { | ||
| /** | ||
| * 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 | ||
| */ | ||
| limits: { | ||
| /** | ||
| * 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; | ||
| }; | ||
| }; | ||
| /** | ||
| * Policy state (if applicable) | ||
| */ | ||
| policy?: { | ||
| /** | ||
| * Current policy state for this model | ||
| */ | ||
| state: string; | ||
| /** | ||
| * Usage terms or conditions for this model | ||
| */ | ||
| terms: string; | ||
| }; | ||
| /** | ||
| * Billing information | ||
| */ | ||
| billing?: { | ||
| /** | ||
| * Billing cost multiplier relative to the base rate | ||
| */ | ||
| multiplier: number; | ||
| }; | ||
| /** | ||
| * 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; | ||
| }[]; | ||
| } | ||
| export interface ToolsListResult { | ||
| usedRequests: number; | ||
| /** | ||
| * List of available built-in tools with metadata | ||
| * Whether usage is still permitted after quota exhaustion | ||
| */ | ||
| tools: { | ||
| /** | ||
| * 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 ToolsListParams { | ||
| usageAllowedWithExhaustedQuota: boolean; | ||
| /** | ||
| * Optional model ID — when provided, the returned tool list reflects model-specific overrides | ||
| * Percentage of entitlement remaining | ||
| */ | ||
| model?: string; | ||
| } | ||
| export interface AccountGetQuotaResult { | ||
| remainingPercentage: number; | ||
| /** | ||
| * Quota snapshots keyed by type (e.g., chat, completions, premium_interactions) | ||
| * Number of overage requests made this period | ||
| */ | ||
| quotaSnapshots: { | ||
| [k: string]: { | ||
| /** | ||
| * Number of requests included in the entitlement | ||
| */ | ||
| entitlementRequests: number; | ||
| /** | ||
| * Number of requests used so far this period | ||
| */ | ||
| usedRequests: number; | ||
| /** | ||
| * Percentage of entitlement remaining | ||
| */ | ||
| remainingPercentage: number; | ||
| /** | ||
| * Number of overage requests made this period | ||
| */ | ||
| overage: number; | ||
| /** | ||
| * Whether pay-per-request usage is allowed when quota is exhausted | ||
| */ | ||
| overageAllowedWithExhaustedQuota: boolean; | ||
| /** | ||
| * Date when the quota resets (ISO 8601) | ||
| */ | ||
| resetDate?: string; | ||
| }; | ||
| }; | ||
| overage: number; | ||
| /** | ||
| * Whether overage is allowed when quota is exhausted | ||
| */ | ||
| overageAllowedWithExhaustedQuota: boolean; | ||
| /** | ||
| * Date when the quota resets (ISO 8601 string) | ||
| */ | ||
| resetDate?: string; | ||
| } | ||
| export interface McpConfigListResult { | ||
| /** @experimental */ | ||
| export interface AgentGetCurrentResult { | ||
| /** | ||
| * All MCP servers from user config, keyed by name | ||
| * Currently selected custom agent, or null if using the default agent | ||
| */ | ||
| servers: { | ||
| /** | ||
| * MCP server configuration (local/stdio or remote/http) | ||
| */ | ||
| [k: string]: { | ||
| /** | ||
| * Tools to include. Defaults to all tools if not specified. | ||
| */ | ||
| tools?: string[]; | ||
| type?: "local" | "stdio"; | ||
| isDefaultServer?: boolean; | ||
| filterMapping?: { | ||
| [k: string]: "none" | "markdown" | "hidden_characters"; | ||
| } | ("none" | "markdown" | "hidden_characters"); | ||
| timeout?: number; | ||
| command: string; | ||
| args: string[]; | ||
| cwd?: string; | ||
| env?: { | ||
| [k: string]: string; | ||
| }; | ||
| } | { | ||
| /** | ||
| * Tools to include. Defaults to all tools if not specified. | ||
| */ | ||
| tools?: string[]; | ||
| type: "http" | "sse"; | ||
| isDefaultServer?: boolean; | ||
| filterMapping?: { | ||
| [k: string]: "none" | "markdown" | "hidden_characters"; | ||
| } | ("none" | "markdown" | "hidden_characters"); | ||
| timeout?: number; | ||
| url: string; | ||
| headers?: { | ||
| [k: string]: string; | ||
| }; | ||
| oauthClientId?: string; | ||
| oauthPublicClient?: boolean; | ||
| }; | ||
| }; | ||
| agent?: AgentInfo | null; | ||
| } | ||
| export interface McpConfigAddParams { | ||
| export interface AgentInfo { | ||
| /** | ||
| * Unique name for the MCP server | ||
| * Unique identifier of the custom agent | ||
| */ | ||
| name: string; | ||
| /** | ||
| * MCP server configuration (local/stdio or remote/http) | ||
| * Human-readable display name | ||
| */ | ||
| config: { | ||
| /** | ||
| * Tools to include. Defaults to all tools if not specified. | ||
| */ | ||
| tools?: string[]; | ||
| type?: "local" | "stdio"; | ||
| isDefaultServer?: boolean; | ||
| filterMapping?: { | ||
| [k: string]: "none" | "markdown" | "hidden_characters"; | ||
| } | ("none" | "markdown" | "hidden_characters"); | ||
| timeout?: number; | ||
| command: string; | ||
| args: string[]; | ||
| cwd?: string; | ||
| env?: { | ||
| [k: string]: string; | ||
| }; | ||
| } | { | ||
| /** | ||
| * Tools to include. Defaults to all tools if not specified. | ||
| */ | ||
| tools?: string[]; | ||
| type: "http" | "sse"; | ||
| isDefaultServer?: boolean; | ||
| filterMapping?: { | ||
| [k: string]: "none" | "markdown" | "hidden_characters"; | ||
| } | ("none" | "markdown" | "hidden_characters"); | ||
| timeout?: number; | ||
| url: string; | ||
| headers?: { | ||
| [k: string]: string; | ||
| }; | ||
| oauthClientId?: string; | ||
| oauthPublicClient?: boolean; | ||
| }; | ||
| } | ||
| export interface McpConfigUpdateParams { | ||
| displayName: string; | ||
| /** | ||
| * Name of the MCP server to update | ||
| * Description of the agent's purpose | ||
| */ | ||
| name: string; | ||
| description: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface AgentList { | ||
| /** | ||
| * MCP server configuration (local/stdio or remote/http) | ||
| * Available custom agents | ||
| */ | ||
| config: { | ||
| /** | ||
| * Tools to include. Defaults to all tools if not specified. | ||
| */ | ||
| tools?: string[]; | ||
| type?: "local" | "stdio"; | ||
| isDefaultServer?: boolean; | ||
| filterMapping?: { | ||
| [k: string]: "none" | "markdown" | "hidden_characters"; | ||
| } | ("none" | "markdown" | "hidden_characters"); | ||
| timeout?: number; | ||
| command: string; | ||
| args: string[]; | ||
| cwd?: string; | ||
| env?: { | ||
| [k: string]: string; | ||
| }; | ||
| } | { | ||
| /** | ||
| * Tools to include. Defaults to all tools if not specified. | ||
| */ | ||
| tools?: string[]; | ||
| type: "http" | "sse"; | ||
| isDefaultServer?: boolean; | ||
| filterMapping?: { | ||
| [k: string]: "none" | "markdown" | "hidden_characters"; | ||
| } | ("none" | "markdown" | "hidden_characters"); | ||
| timeout?: number; | ||
| url: string; | ||
| headers?: { | ||
| [k: string]: string; | ||
| }; | ||
| oauthClientId?: string; | ||
| oauthPublicClient?: boolean; | ||
| }; | ||
| agents: AgentInfo[]; | ||
| } | ||
| export interface McpConfigRemoveParams { | ||
| /** @experimental */ | ||
| export interface AgentReloadResult { | ||
| /** | ||
| * Name of the MCP server to remove | ||
| * Reloaded custom agents | ||
| */ | ||
| name: string; | ||
| agents: AgentInfo[]; | ||
| } | ||
| export interface SessionFsSetProviderResult { | ||
| /** @experimental */ | ||
| export interface AgentSelectRequest { | ||
| /** | ||
| * Whether the provider was set successfully | ||
| * Name of the custom agent to select | ||
| */ | ||
| success: boolean; | ||
| name: string; | ||
| } | ||
| export interface SessionFsSetProviderParams { | ||
| /** @experimental */ | ||
| export interface AgentSelectResult { | ||
| agent: AgentInfo; | ||
| } | ||
| export interface CommandsHandlePendingCommandRequest { | ||
| /** | ||
| * Initial working directory for sessions | ||
| * Request ID from the command invocation event | ||
| */ | ||
| initialCwd: string; | ||
| requestId: string; | ||
| /** | ||
| * Path within each session's SessionFs where the runtime stores files for that session | ||
| * Error message if the command handler failed | ||
| */ | ||
| sessionStatePath: string; | ||
| error?: string; | ||
| } | ||
| export interface CommandsHandlePendingCommandResult { | ||
| /** | ||
| * Path conventions used by this filesystem | ||
| * Whether the command was handled successfully | ||
| */ | ||
| conventions: "windows" | "posix"; | ||
| success: boolean; | ||
| } | ||
| export interface SessionModelGetCurrentResult { | ||
| export interface CurrentModel { | ||
| /** | ||
@@ -340,758 +281,796 @@ * Currently active model identifier | ||
| } | ||
| export interface SessionModelGetCurrentParams { | ||
| export interface DiscoveredMcpServer { | ||
| /** | ||
| * Target session identifier | ||
| * Server name (config key) | ||
| */ | ||
| sessionId: string; | ||
| } | ||
| export interface SessionModelSwitchToResult { | ||
| name: string; | ||
| type?: DiscoveredMcpServerType; | ||
| source: DiscoveredMcpServerSource; | ||
| /** | ||
| * Currently active model identifier after the switch | ||
| * Whether the server is enabled (not in the disabled list) | ||
| */ | ||
| modelId?: string; | ||
| enabled: boolean; | ||
| } | ||
| export interface SessionModelSwitchToParams { | ||
| export interface Extension { | ||
| /** | ||
| * Target session identifier | ||
| * Source-qualified ID (e.g., 'project:my-ext', 'user:auth-helper') | ||
| */ | ||
| sessionId: string; | ||
| id: string; | ||
| /** | ||
| * Model identifier to switch to | ||
| * Extension name (directory name) | ||
| */ | ||
| modelId: string; | ||
| name: string; | ||
| source: ExtensionSource; | ||
| status: ExtensionStatus; | ||
| /** | ||
| * Reasoning effort level to use for the model | ||
| * Process ID if the extension is running | ||
| */ | ||
| reasoningEffort?: string; | ||
| pid?: number; | ||
| } | ||
| export interface SessionModeGetResult { | ||
| /** @experimental */ | ||
| export interface ExtensionList { | ||
| /** | ||
| * The current agent mode. | ||
| * Discovered extensions and their current status | ||
| */ | ||
| mode: "interactive" | "plan" | "autopilot"; | ||
| extensions: Extension[]; | ||
| } | ||
| export interface SessionModeGetParams { | ||
| /** @experimental */ | ||
| export interface ExtensionsDisableRequest { | ||
| /** | ||
| * Target session identifier | ||
| * Source-qualified extension ID to disable | ||
| */ | ||
| sessionId: string; | ||
| id: string; | ||
| } | ||
| export interface SessionModeSetResult { | ||
| /** @experimental */ | ||
| export interface ExtensionsEnableRequest { | ||
| /** | ||
| * The agent mode after switching. | ||
| * Source-qualified extension ID to enable | ||
| */ | ||
| mode: "interactive" | "plan" | "autopilot"; | ||
| id: string; | ||
| } | ||
| export interface SessionModeSetParams { | ||
| /** @experimental */ | ||
| export interface FleetStartRequest { | ||
| /** | ||
| * Target session identifier | ||
| * Optional user prompt to combine with fleet instructions | ||
| */ | ||
| sessionId: string; | ||
| prompt?: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface FleetStartResult { | ||
| /** | ||
| * The mode to switch to. Valid values: "interactive", "plan", "autopilot". | ||
| * Whether fleet mode was successfully activated | ||
| */ | ||
| mode: "interactive" | "plan" | "autopilot"; | ||
| started: boolean; | ||
| } | ||
| export interface SessionPlanReadResult { | ||
| export interface HandleToolCallResult { | ||
| /** | ||
| * Whether the plan file exists in the workspace | ||
| * Whether the tool call result was handled successfully | ||
| */ | ||
| exists: boolean; | ||
| success: boolean; | ||
| } | ||
| /** | ||
| * Post-compaction context window usage breakdown | ||
| * | ||
| * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema | ||
| * via the `definition` "HistoryCompactContextWindow". | ||
| */ | ||
| export interface HistoryCompactContextWindow { | ||
| /** | ||
| * The content of the plan file, or null if it does not exist | ||
| * Maximum token count for the model's context window | ||
| */ | ||
| content: string | null; | ||
| tokenLimit: number; | ||
| /** | ||
| * Absolute file path of the plan file, or null if workspace is not enabled | ||
| * Current total tokens in the context window (system + conversation + tool definitions) | ||
| */ | ||
| path: string | null; | ||
| } | ||
| export interface SessionPlanReadParams { | ||
| currentTokens: number; | ||
| /** | ||
| * Target session identifier | ||
| * Current number of messages in the conversation | ||
| */ | ||
| sessionId: string; | ||
| 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; | ||
| } | ||
| export interface SessionPlanUpdateResult { | ||
| } | ||
| export interface SessionPlanUpdateParams { | ||
| /** @experimental */ | ||
| export interface HistoryCompactResult { | ||
| /** | ||
| * Target session identifier | ||
| * Whether compaction completed successfully | ||
| */ | ||
| sessionId: string; | ||
| success: boolean; | ||
| /** | ||
| * The new content for the plan file | ||
| * Number of tokens freed by compaction | ||
| */ | ||
| content: string; | ||
| tokensRemoved: number; | ||
| /** | ||
| * Number of messages removed during compaction | ||
| */ | ||
| messagesRemoved: number; | ||
| contextWindow?: HistoryCompactContextWindow; | ||
| } | ||
| export interface SessionPlanDeleteResult { | ||
| } | ||
| export interface SessionPlanDeleteParams { | ||
| /** @experimental */ | ||
| export interface HistoryTruncateRequest { | ||
| /** | ||
| * Target session identifier | ||
| * Event ID to truncate to. This event and all events after it are removed from the session. | ||
| */ | ||
| sessionId: string; | ||
| eventId: string; | ||
| } | ||
| export interface SessionWorkspaceListFilesResult { | ||
| /** @experimental */ | ||
| export interface HistoryTruncateResult { | ||
| /** | ||
| * Relative file paths in the workspace files directory | ||
| * Number of events that were removed | ||
| */ | ||
| files: string[]; | ||
| eventsRemoved: number; | ||
| } | ||
| export interface SessionWorkspaceListFilesParams { | ||
| export interface InstructionsGetSourcesResult { | ||
| /** | ||
| * Target session identifier | ||
| * Instruction sources for the session | ||
| */ | ||
| sessionId: string; | ||
| sources: InstructionsSources[]; | ||
| } | ||
| export interface SessionWorkspaceReadFileResult { | ||
| export interface InstructionsSources { | ||
| /** | ||
| * File content as a UTF-8 string | ||
| * 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; | ||
| } | ||
| export interface SessionWorkspaceReadFileParams { | ||
| type: InstructionsSourcesType; | ||
| location: InstructionsSourcesLocation; | ||
| /** | ||
| * Target session identifier | ||
| * Glob pattern from frontmatter — when set, this instruction applies only to matching files | ||
| */ | ||
| sessionId: string; | ||
| applyTo?: string; | ||
| /** | ||
| * Relative path within the workspace files directory | ||
| * Short description (body after frontmatter) for use in instruction tables | ||
| */ | ||
| path: string; | ||
| description?: string; | ||
| } | ||
| export interface SessionWorkspaceCreateFileResult { | ||
| } | ||
| export interface SessionWorkspaceCreateFileParams { | ||
| export interface LogRequest { | ||
| /** | ||
| * Target session identifier | ||
| * Human-readable message | ||
| */ | ||
| sessionId: string; | ||
| message: string; | ||
| level?: SessionLogLevel; | ||
| /** | ||
| * Relative path within the workspace files directory | ||
| * When true, the message is transient and not persisted to the session event log on disk | ||
| */ | ||
| path: string; | ||
| ephemeral?: boolean; | ||
| /** | ||
| * File content to write as a UTF-8 string | ||
| * Optional URL the user can open in their browser for more details | ||
| */ | ||
| content: string; | ||
| url?: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionFleetStartResult { | ||
| export interface LogResult { | ||
| /** | ||
| * Whether fleet mode was successfully activated | ||
| * The unique identifier of the emitted session event | ||
| */ | ||
| started: boolean; | ||
| eventId: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionFleetStartParams { | ||
| export interface McpConfigAddRequest { | ||
| /** | ||
| * Target session identifier | ||
| * Unique name for the MCP server | ||
| */ | ||
| sessionId: string; | ||
| name: string; | ||
| config: McpServerConfig; | ||
| } | ||
| export interface McpServerConfigLocal { | ||
| /** | ||
| * Optional user prompt to combine with fleet instructions | ||
| * Tools to include. Defaults to all tools if not specified. | ||
| */ | ||
| prompt?: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionAgentListResult { | ||
| tools?: string[]; | ||
| type?: McpServerConfigLocalType; | ||
| isDefaultServer?: boolean; | ||
| filterMapping?: FilterMapping; | ||
| /** | ||
| * Available custom agents | ||
| * Timeout in milliseconds for tool calls to this server. | ||
| */ | ||
| agents: { | ||
| /** | ||
| * Unique identifier of the custom agent | ||
| */ | ||
| name: string; | ||
| /** | ||
| * Human-readable display name | ||
| */ | ||
| displayName: string; | ||
| /** | ||
| * Description of the agent's purpose | ||
| */ | ||
| description: string; | ||
| }[]; | ||
| timeout?: number; | ||
| command: string; | ||
| args: string[]; | ||
| cwd?: string; | ||
| env?: { | ||
| [k: string]: string; | ||
| }; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionAgentListParams { | ||
| export interface McpServerConfigHttp { | ||
| /** | ||
| * Target session identifier | ||
| * Tools to include. Defaults to all tools if not specified. | ||
| */ | ||
| sessionId: string; | ||
| 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; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionAgentGetCurrentResult { | ||
| export interface McpConfigDisableRequest { | ||
| /** | ||
| * Currently selected custom agent, or null if using the default agent | ||
| * 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. | ||
| */ | ||
| agent: { | ||
| /** | ||
| * Unique identifier of the custom agent | ||
| */ | ||
| name: string; | ||
| /** | ||
| * Human-readable display name | ||
| */ | ||
| displayName: string; | ||
| /** | ||
| * Description of the agent's purpose | ||
| */ | ||
| description: string; | ||
| } | null; | ||
| names: string[]; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionAgentGetCurrentParams { | ||
| export interface McpConfigEnableRequest { | ||
| /** | ||
| * Target session identifier | ||
| * 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. | ||
| */ | ||
| sessionId: string; | ||
| names: string[]; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionAgentSelectResult { | ||
| export interface McpConfigList { | ||
| /** | ||
| * The newly selected custom agent | ||
| * All MCP servers from user config, keyed by name | ||
| */ | ||
| agent: { | ||
| /** | ||
| * Unique identifier of the custom agent | ||
| */ | ||
| name: string; | ||
| /** | ||
| * Human-readable display name | ||
| */ | ||
| displayName: string; | ||
| /** | ||
| * Description of the agent's purpose | ||
| */ | ||
| description: string; | ||
| servers: { | ||
| [k: string]: McpServerConfig; | ||
| }; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionAgentSelectParams { | ||
| export interface McpConfigRemoveRequest { | ||
| /** | ||
| * Target session identifier | ||
| * Name of the MCP server to remove | ||
| */ | ||
| sessionId: string; | ||
| name: string; | ||
| } | ||
| export interface McpConfigUpdateRequest { | ||
| /** | ||
| * Name of the custom agent to select | ||
| * Name of the MCP server to update | ||
| */ | ||
| name: string; | ||
| config: McpServerConfig; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionAgentDeselectResult { | ||
| export interface McpDisableRequest { | ||
| /** | ||
| * Name of the MCP server to disable | ||
| */ | ||
| serverName: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionAgentDeselectParams { | ||
| export interface McpDiscoverRequest { | ||
| /** | ||
| * Target session identifier | ||
| * Working directory used as context for discovery (e.g., plugin resolution) | ||
| */ | ||
| sessionId: string; | ||
| workingDirectory?: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionAgentReloadResult { | ||
| export interface McpDiscoverResult { | ||
| /** | ||
| * Reloaded custom agents | ||
| * MCP servers discovered from all sources | ||
| */ | ||
| agents: { | ||
| /** | ||
| * Unique identifier of the custom agent | ||
| */ | ||
| name: string; | ||
| /** | ||
| * Human-readable display name | ||
| */ | ||
| displayName: string; | ||
| /** | ||
| * Description of the agent's purpose | ||
| */ | ||
| description: string; | ||
| }[]; | ||
| servers: DiscoveredMcpServer[]; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionAgentReloadParams { | ||
| export interface McpEnableRequest { | ||
| /** | ||
| * Target session identifier | ||
| * Name of the MCP server to enable | ||
| */ | ||
| sessionId: string; | ||
| serverName: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionSkillsListResult { | ||
| export interface McpOauthLoginRequest { | ||
| /** | ||
| * Available skills | ||
| * Name of the remote MCP server to authenticate | ||
| */ | ||
| skills: { | ||
| /** | ||
| * 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; | ||
| }[]; | ||
| 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 SessionSkillsListParams { | ||
| export interface McpOauthLoginResult { | ||
| /** | ||
| * Target session identifier | ||
| * 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. | ||
| */ | ||
| sessionId: string; | ||
| authorizationUrl?: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionSkillsEnableResult { | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionSkillsEnableParams { | ||
| export interface McpServer { | ||
| /** | ||
| * Target session identifier | ||
| * Server name (config key) | ||
| */ | ||
| sessionId: string; | ||
| name: string; | ||
| status: McpServerStatus; | ||
| source?: McpServerSource; | ||
| /** | ||
| * Name of the skill to enable | ||
| * Error message if the server failed to connect | ||
| */ | ||
| name: string; | ||
| error?: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionSkillsDisableResult { | ||
| export interface McpServerList { | ||
| /** | ||
| * Configured MCP servers | ||
| */ | ||
| servers: McpServer[]; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionSkillsDisableParams { | ||
| export interface Model { | ||
| /** | ||
| * Target session identifier | ||
| * Model identifier (e.g., "claude-sonnet-4.5") | ||
| */ | ||
| sessionId: string; | ||
| id: string; | ||
| /** | ||
| * Name of the skill to disable | ||
| * 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; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionSkillsReloadResult { | ||
| /** | ||
| * Model capabilities and limits | ||
| * | ||
| * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema | ||
| * via the `definition` "ModelCapabilities". | ||
| */ | ||
| export interface ModelCapabilities { | ||
| supports?: ModelCapabilitiesSupports; | ||
| limits?: ModelCapabilitiesLimits; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionSkillsReloadParams { | ||
| /** | ||
| * Feature flags indicating what the model supports | ||
| * | ||
| * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema | ||
| * via the `definition` "ModelCapabilitiesSupports". | ||
| */ | ||
| export interface ModelCapabilitiesSupports { | ||
| /** | ||
| * Target session identifier | ||
| * Whether this model supports vision/image input | ||
| */ | ||
| sessionId: string; | ||
| vision?: boolean; | ||
| /** | ||
| * Whether this model supports reasoning effort configuration | ||
| */ | ||
| reasoningEffort?: boolean; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionMcpListResult { | ||
| /** | ||
| * Token limits for prompts, outputs, and context window | ||
| * | ||
| * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema | ||
| * via the `definition` "ModelCapabilitiesLimits". | ||
| */ | ||
| export interface ModelCapabilitiesLimits { | ||
| /** | ||
| * Configured MCP servers | ||
| * Maximum number of prompt/input tokens | ||
| */ | ||
| servers: { | ||
| /** | ||
| * Server name (config key) | ||
| */ | ||
| name: string; | ||
| /** | ||
| * Connection status: connected, failed, needs-auth, pending, disabled, or not_configured | ||
| */ | ||
| status: "connected" | "failed" | "needs-auth" | "pending" | "disabled" | "not_configured"; | ||
| /** | ||
| * Configuration source: user, workspace, plugin, or builtin | ||
| */ | ||
| source?: string; | ||
| /** | ||
| * Error message if the server failed to connect | ||
| */ | ||
| error?: string; | ||
| }[]; | ||
| 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; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionMcpListParams { | ||
| /** | ||
| * Vision-specific limits | ||
| * | ||
| * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema | ||
| * via the `definition` "ModelCapabilitiesLimitsVision". | ||
| */ | ||
| export interface ModelCapabilitiesLimitsVision { | ||
| /** | ||
| * Target session identifier | ||
| * MIME types the model accepts | ||
| */ | ||
| sessionId: string; | ||
| supported_media_types: string[]; | ||
| /** | ||
| * Maximum number of images per prompt | ||
| */ | ||
| max_prompt_images: number; | ||
| /** | ||
| * Maximum image size in bytes | ||
| */ | ||
| max_prompt_image_size: number; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionMcpEnableResult { | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionMcpEnableParams { | ||
| /** | ||
| * Policy state (if applicable) | ||
| * | ||
| * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema | ||
| * via the `definition` "ModelPolicy". | ||
| */ | ||
| export interface ModelPolicy { | ||
| /** | ||
| * Target session identifier | ||
| * Current policy state for this model | ||
| */ | ||
| sessionId: string; | ||
| state: string; | ||
| /** | ||
| * Name of the MCP server to enable | ||
| * Usage terms or conditions for this model | ||
| */ | ||
| serverName: string; | ||
| terms?: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionMcpDisableResult { | ||
| /** | ||
| * 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; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionMcpDisableParams { | ||
| /** | ||
| * 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; | ||
| /** | ||
| * Target session identifier | ||
| * Maximum total context window size in tokens | ||
| */ | ||
| sessionId: string; | ||
| max_context_window_tokens?: number; | ||
| vision?: ModelCapabilitiesOverrideLimitsVision; | ||
| } | ||
| export interface ModelCapabilitiesOverrideLimitsVision { | ||
| /** | ||
| * Name of the MCP server to disable | ||
| * MIME types the model accepts | ||
| */ | ||
| serverName: string; | ||
| supported_media_types?: string[]; | ||
| /** | ||
| * Maximum number of images per prompt | ||
| */ | ||
| max_prompt_images?: number; | ||
| /** | ||
| * Maximum image size in bytes | ||
| */ | ||
| max_prompt_image_size?: number; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionMcpReloadResult { | ||
| export interface ModelList { | ||
| /** | ||
| * List of available models with full metadata | ||
| */ | ||
| models: Model[]; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionMcpReloadParams { | ||
| export interface ModelsListRequest { | ||
| /** | ||
| * Target session identifier | ||
| * 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. | ||
| */ | ||
| sessionId: string; | ||
| gitHubToken?: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionPluginsListResult { | ||
| export interface ModelSwitchToRequest { | ||
| /** | ||
| * Installed plugins | ||
| * Model identifier to switch to | ||
| */ | ||
| plugins: { | ||
| /** | ||
| * Plugin name | ||
| */ | ||
| name: string; | ||
| /** | ||
| * Marketplace the plugin came from | ||
| */ | ||
| marketplace: string; | ||
| /** | ||
| * Installed version | ||
| */ | ||
| version?: string; | ||
| /** | ||
| * Whether the plugin is currently enabled | ||
| */ | ||
| enabled: boolean; | ||
| }[]; | ||
| modelId: string; | ||
| /** | ||
| * Reasoning effort level to use for the model | ||
| */ | ||
| reasoningEffort?: string; | ||
| modelCapabilities?: ModelCapabilitiesOverride; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionPluginsListParams { | ||
| export interface ModelSwitchToResult { | ||
| /** | ||
| * Target session identifier | ||
| * Currently active model identifier after the switch | ||
| */ | ||
| sessionId: string; | ||
| modelId?: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionExtensionsListResult { | ||
| export interface ModeSetRequest { | ||
| mode: SessionMode; | ||
| } | ||
| export interface NameGetResult { | ||
| /** | ||
| * Discovered extensions and their current status | ||
| * The session name, falling back to the auto-generated summary, or null if neither exists | ||
| */ | ||
| extensions: { | ||
| /** | ||
| * Source-qualified ID (e.g., 'project:my-ext', 'user:auth-helper') | ||
| */ | ||
| id: string; | ||
| /** | ||
| * Extension name (directory name) | ||
| */ | ||
| name: string; | ||
| /** | ||
| * Discovery source: project (.github/extensions/) or user (~/.copilot/extensions/) | ||
| */ | ||
| source: "project" | "user"; | ||
| /** | ||
| * Current status: running, disabled, failed, or starting | ||
| */ | ||
| status: "running" | "disabled" | "failed" | "starting"; | ||
| /** | ||
| * Process ID if the extension is running | ||
| */ | ||
| pid?: number; | ||
| }[]; | ||
| name: string | null; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionExtensionsListParams { | ||
| export interface NameSetRequest { | ||
| /** | ||
| * Target session identifier | ||
| * New session name (1–100 characters, trimmed of leading/trailing whitespace) | ||
| */ | ||
| sessionId: string; | ||
| name: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionExtensionsEnableResult { | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionExtensionsEnableParams { | ||
| export interface PermissionDecisionApproveOnce { | ||
| /** | ||
| * Target session identifier | ||
| * The permission request was approved for this one instance | ||
| */ | ||
| sessionId: string; | ||
| kind: "approve-once"; | ||
| } | ||
| export interface PermissionDecisionApproveForSession { | ||
| /** | ||
| * Source-qualified extension ID to enable | ||
| * Approved and remembered for the rest of the session | ||
| */ | ||
| id: string; | ||
| kind: "approve-for-session"; | ||
| approval: PermissionDecisionApproveForSessionApproval; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionExtensionsDisableResult { | ||
| export interface PermissionDecisionApproveForSessionApprovalCommands { | ||
| kind: "commands"; | ||
| commandIdentifiers: string[]; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionExtensionsDisableParams { | ||
| 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 { | ||
| /** | ||
| * Target session identifier | ||
| * Approved and persisted for this project location | ||
| */ | ||
| sessionId: string; | ||
| kind: "approve-for-location"; | ||
| approval: PermissionDecisionApproveForLocationApproval; | ||
| /** | ||
| * Source-qualified extension ID to disable | ||
| * The location key (git root or cwd) to persist the approval to | ||
| */ | ||
| id: string; | ||
| locationKey: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionExtensionsReloadResult { | ||
| export interface PermissionDecisionApproveForLocationApprovalCommands { | ||
| kind: "commands"; | ||
| commandIdentifiers: string[]; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionExtensionsReloadParams { | ||
| 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 { | ||
| /** | ||
| * Target session identifier | ||
| * Denied by the user during an interactive prompt | ||
| */ | ||
| sessionId: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionCompactionCompactResult { | ||
| kind: "reject"; | ||
| /** | ||
| * Whether compaction completed successfully | ||
| * Optional feedback from the user explaining the denial | ||
| */ | ||
| success: boolean; | ||
| feedback?: string; | ||
| } | ||
| export interface PermissionDecisionUserNotAvailable { | ||
| /** | ||
| * Number of tokens freed by compaction | ||
| * Denied because user confirmation was unavailable | ||
| */ | ||
| tokensRemoved: number; | ||
| kind: "user-not-available"; | ||
| } | ||
| export interface PermissionDecisionRequest { | ||
| /** | ||
| * Number of messages removed during compaction | ||
| * Request ID of the pending permission request | ||
| */ | ||
| messagesRemoved: number; | ||
| requestId: string; | ||
| result: PermissionDecision; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionCompactionCompactParams { | ||
| export interface PermissionRequestResult { | ||
| /** | ||
| * Target session identifier | ||
| * Whether the permission request was handled successfully | ||
| */ | ||
| sessionId: string; | ||
| success: boolean; | ||
| } | ||
| export interface SessionToolsHandlePendingToolCallResult { | ||
| export interface PermissionsResetSessionApprovalsRequest { | ||
| } | ||
| export interface PermissionsResetSessionApprovalsResult { | ||
| /** | ||
| * Whether the tool call result was handled successfully | ||
| * Whether the operation succeeded | ||
| */ | ||
| success: boolean; | ||
| } | ||
| export interface SessionToolsHandlePendingToolCallParams { | ||
| export interface PermissionsSetApproveAllRequest { | ||
| /** | ||
| * Target session identifier | ||
| * Whether to auto-approve all tool permission requests | ||
| */ | ||
| sessionId: string; | ||
| requestId: string; | ||
| result?: string | { | ||
| textResultForLlm: string; | ||
| resultType?: string; | ||
| error?: string; | ||
| toolTelemetry?: { | ||
| [k: string]: unknown; | ||
| }; | ||
| }; | ||
| error?: string; | ||
| enabled: boolean; | ||
| } | ||
| export interface SessionCommandsHandlePendingCommandResult { | ||
| export interface PermissionsSetApproveAllResult { | ||
| /** | ||
| * Whether the operation succeeded | ||
| */ | ||
| success: boolean; | ||
| } | ||
| export interface SessionCommandsHandlePendingCommandParams { | ||
| export interface PingRequest { | ||
| /** | ||
| * Target session identifier | ||
| * Optional message to echo back | ||
| */ | ||
| sessionId: string; | ||
| message?: string; | ||
| } | ||
| export interface PingResult { | ||
| /** | ||
| * Request ID from the command invocation event | ||
| * Echoed message (or default greeting) | ||
| */ | ||
| requestId: string; | ||
| message: string; | ||
| /** | ||
| * Error message if the command handler failed | ||
| * Server timestamp in milliseconds | ||
| */ | ||
| error?: string; | ||
| timestamp: number; | ||
| /** | ||
| * Server protocol version number | ||
| */ | ||
| protocolVersion: number; | ||
| } | ||
| export interface SessionUiElicitationResult { | ||
| export interface PlanReadResult { | ||
| /** | ||
| * The user's response: accept (submitted), decline (rejected), or cancel (dismissed) | ||
| * Whether the plan file exists in the workspace | ||
| */ | ||
| action: "accept" | "decline" | "cancel"; | ||
| exists: boolean; | ||
| /** | ||
| * The form values submitted by the user (present when action is 'accept') | ||
| * The content of the plan file, or null if it does not exist | ||
| */ | ||
| content?: { | ||
| [k: string]: string | number | boolean | string[]; | ||
| }; | ||
| content: string | null; | ||
| /** | ||
| * Absolute file path of the plan file, or null if workspace is not enabled | ||
| */ | ||
| path: string | null; | ||
| } | ||
| export interface SessionUiElicitationParams { | ||
| export interface PlanUpdateRequest { | ||
| /** | ||
| * Target session identifier | ||
| * The new content for the plan file | ||
| */ | ||
| sessionId: string; | ||
| content: string; | ||
| } | ||
| export interface Plugin { | ||
| /** | ||
| * Message describing what information is needed from the user | ||
| * Plugin name | ||
| */ | ||
| message: string; | ||
| name: string; | ||
| /** | ||
| * JSON Schema describing the form fields to present to the user | ||
| * Marketplace the plugin came from | ||
| */ | ||
| requestedSchema: { | ||
| /** | ||
| * Schema type indicator (always 'object') | ||
| */ | ||
| type: "object"; | ||
| /** | ||
| * Form field definitions, keyed by field name | ||
| */ | ||
| properties: { | ||
| [k: string]: { | ||
| type: "string"; | ||
| title?: string; | ||
| description?: string; | ||
| enum: string[]; | ||
| enumNames?: string[]; | ||
| default?: string; | ||
| } | { | ||
| type: "string"; | ||
| title?: string; | ||
| description?: string; | ||
| oneOf: { | ||
| const: string; | ||
| title: string; | ||
| }[]; | ||
| default?: string; | ||
| } | { | ||
| type: "array"; | ||
| title?: string; | ||
| description?: string; | ||
| minItems?: number; | ||
| maxItems?: number; | ||
| items: { | ||
| type: "string"; | ||
| enum: string[]; | ||
| }; | ||
| default?: string[]; | ||
| } | { | ||
| type: "array"; | ||
| title?: string; | ||
| description?: string; | ||
| minItems?: number; | ||
| maxItems?: number; | ||
| items: { | ||
| anyOf: { | ||
| const: string; | ||
| title: string; | ||
| }[]; | ||
| }; | ||
| default?: string[]; | ||
| } | { | ||
| type: "boolean"; | ||
| title?: string; | ||
| description?: string; | ||
| default?: boolean; | ||
| } | { | ||
| type: "string"; | ||
| title?: string; | ||
| description?: string; | ||
| minLength?: number; | ||
| maxLength?: number; | ||
| format?: "email" | "uri" | "date" | "date-time"; | ||
| default?: string; | ||
| } | { | ||
| type: "number" | "integer"; | ||
| title?: string; | ||
| description?: string; | ||
| minimum?: number; | ||
| maximum?: number; | ||
| default?: number; | ||
| }; | ||
| }; | ||
| /** | ||
| * List of required field names | ||
| */ | ||
| required?: string[]; | ||
| }; | ||
| marketplace: string; | ||
| /** | ||
| * Installed version | ||
| */ | ||
| version?: string; | ||
| /** | ||
| * Whether the plugin is currently enabled | ||
| */ | ||
| enabled: boolean; | ||
| } | ||
| export interface SessionUiHandlePendingElicitationResult { | ||
| /** @experimental */ | ||
| export interface PluginList { | ||
| /** | ||
| * Whether the response was accepted. False if the request was already resolved by another client. | ||
| * Installed plugins | ||
| */ | ||
| success: boolean; | ||
| plugins: Plugin[]; | ||
| } | ||
| export interface SessionUiHandlePendingElicitationParams { | ||
| export interface ServerSkill { | ||
| /** | ||
| * Target session identifier | ||
| * Unique identifier for the skill | ||
| */ | ||
| sessionId: string; | ||
| name: string; | ||
| /** | ||
| * The unique request ID from the elicitation.requested event | ||
| * Description of what the skill does | ||
| */ | ||
| requestId: string; | ||
| description: string; | ||
| /** | ||
| * The elicitation response (accept with form values, decline, or cancel) | ||
| * Source location type (e.g., project, personal-copilot, plugin, builtin) | ||
| */ | ||
| result: { | ||
| /** | ||
| * The user's response: accept (submitted), decline (rejected), or cancel (dismissed) | ||
| */ | ||
| action: "accept" | "decline" | "cancel"; | ||
| /** | ||
| * The form values submitted by the user (present when action is 'accept') | ||
| */ | ||
| content?: { | ||
| [k: string]: string | number | boolean | string[]; | ||
| }; | ||
| }; | ||
| } | ||
| export interface SessionPermissionsHandlePendingPermissionRequestResult { | ||
| source: string; | ||
| /** | ||
| * Whether the permission request was handled successfully | ||
| * Whether the skill can be invoked by the user as a slash command | ||
| */ | ||
| success: boolean; | ||
| 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 SessionPermissionsHandlePendingPermissionRequestParams { | ||
| export interface ServerSkillList { | ||
| /** | ||
| * Target session identifier | ||
| * All discovered skills across all sources | ||
| */ | ||
| sessionId: string; | ||
| requestId: string; | ||
| result: { | ||
| kind: "approved"; | ||
| } | { | ||
| kind: "denied-by-rules"; | ||
| rules: unknown[]; | ||
| } | { | ||
| kind: "denied-no-approval-rule-and-could-not-request-from-user"; | ||
| } | { | ||
| kind: "denied-interactively-by-user"; | ||
| feedback?: string; | ||
| } | { | ||
| kind: "denied-by-content-exclusion-policy"; | ||
| path: string; | ||
| message: string; | ||
| }; | ||
| skills: ServerSkill[]; | ||
| } | ||
| export interface SessionLogResult { | ||
| export interface SessionAuthStatus { | ||
| /** | ||
| * The unique identifier of the emitted session event | ||
| * Whether the session has resolved authentication | ||
| */ | ||
| eventId: string; | ||
| 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 SessionLogParams { | ||
| export interface SessionFsAppendFileRequest { | ||
| /** | ||
@@ -1102,26 +1081,45 @@ * Target session identifier | ||
| /** | ||
| * Human-readable message | ||
| * Path using SessionFs conventions | ||
| */ | ||
| message: string; | ||
| path: string; | ||
| /** | ||
| * Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". | ||
| * Content to append | ||
| */ | ||
| level?: "info" | "warning" | "error"; | ||
| content: string; | ||
| /** | ||
| * When true, the message is transient and not persisted to the session event log on disk | ||
| * Optional POSIX-style mode for newly created files | ||
| */ | ||
| ephemeral?: boolean; | ||
| mode?: number; | ||
| } | ||
| /** | ||
| * Describes a filesystem error. | ||
| * | ||
| * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema | ||
| * via the `definition` "SessionFsError". | ||
| */ | ||
| export interface SessionFsError { | ||
| code: SessionFsErrorCode; | ||
| /** | ||
| * Optional URL the user can open in their browser for more details | ||
| * Free-form detail about the error, for logging/diagnostics | ||
| */ | ||
| url?: string; | ||
| message?: string; | ||
| } | ||
| export interface SessionShellExecResult { | ||
| export interface SessionFsExistsRequest { | ||
| /** | ||
| * Unique identifier for tracking streamed output | ||
| * Target session identifier | ||
| */ | ||
| processId: string; | ||
| sessionId: string; | ||
| /** | ||
| * Path using SessionFs conventions | ||
| */ | ||
| path: string; | ||
| } | ||
| export interface SessionShellExecParams { | ||
| export interface SessionFsExistsResult { | ||
| /** | ||
| * Whether the path exists | ||
| */ | ||
| exists: boolean; | ||
| } | ||
| export interface SessionFsMkdirRequest { | ||
| /** | ||
| * Target session identifier | ||
@@ -1131,22 +1129,16 @@ */ | ||
| /** | ||
| * Shell command to execute | ||
| * Path using SessionFs conventions | ||
| */ | ||
| command: string; | ||
| path: string; | ||
| /** | ||
| * Working directory (defaults to session working directory) | ||
| * Create parent directories as needed | ||
| */ | ||
| cwd?: string; | ||
| recursive?: boolean; | ||
| /** | ||
| * Timeout in milliseconds (default: 30000) | ||
| * Optional POSIX-style mode for newly created directories | ||
| */ | ||
| timeout?: number; | ||
| mode?: number; | ||
| } | ||
| export interface SessionShellKillResult { | ||
| export interface SessionFsReaddirRequest { | ||
| /** | ||
| * Whether the signal was sent successfully | ||
| */ | ||
| killed: boolean; | ||
| } | ||
| export interface SessionShellKillParams { | ||
| /** | ||
| * Target session identifier | ||
@@ -1156,17 +1148,21 @@ */ | ||
| /** | ||
| * Process identifier returned by shell.exec | ||
| * Path using SessionFs conventions | ||
| */ | ||
| processId: string; | ||
| path: string; | ||
| } | ||
| export interface SessionFsReaddirResult { | ||
| /** | ||
| * Signal to send (default: SIGTERM) | ||
| * Entry names in the directory | ||
| */ | ||
| signal?: "SIGTERM" | "SIGKILL" | "SIGINT"; | ||
| entries: string[]; | ||
| error?: SessionFsError; | ||
| } | ||
| export interface SessionFsReadFileResult { | ||
| export interface SessionFsReaddirWithTypesEntry { | ||
| /** | ||
| * File content as UTF-8 string | ||
| * Entry name | ||
| */ | ||
| content: string; | ||
| name: string; | ||
| type: SessionFsReaddirWithTypesEntryType; | ||
| } | ||
| export interface SessionFsReadFileParams { | ||
| export interface SessionFsReaddirWithTypesRequest { | ||
| /** | ||
@@ -1181,4 +1177,11 @@ * Target session identifier | ||
| } | ||
| export interface SessionFsWriteFileParams { | ||
| export interface SessionFsReaddirWithTypesResult { | ||
| /** | ||
| * Directory entries with type information | ||
| */ | ||
| entries: SessionFsReaddirWithTypesEntry[]; | ||
| error?: SessionFsError; | ||
| } | ||
| export interface SessionFsReadFileRequest { | ||
| /** | ||
| * Target session identifier | ||
@@ -1191,12 +1194,25 @@ */ | ||
| path: string; | ||
| } | ||
| export interface SessionFsReadFileResult { | ||
| /** | ||
| * Content to write | ||
| * File content as UTF-8 string | ||
| */ | ||
| content: string; | ||
| error?: SessionFsError; | ||
| } | ||
| export interface SessionFsRenameRequest { | ||
| /** | ||
| * Optional POSIX-style mode for newly created files | ||
| * Target session identifier | ||
| */ | ||
| mode?: number; | ||
| sessionId: string; | ||
| /** | ||
| * Source path using SessionFs conventions | ||
| */ | ||
| src: string; | ||
| /** | ||
| * Destination path using SessionFs conventions | ||
| */ | ||
| dest: string; | ||
| } | ||
| export interface SessionFsAppendFileParams { | ||
| export interface SessionFsRmRequest { | ||
| /** | ||
@@ -1211,18 +1227,29 @@ * Target session identifier | ||
| /** | ||
| * Content to append | ||
| * Remove directories and their contents recursively | ||
| */ | ||
| content: string; | ||
| recursive?: boolean; | ||
| /** | ||
| * Optional POSIX-style mode for newly created files | ||
| * Ignore errors if the path does not exist | ||
| */ | ||
| mode?: number; | ||
| force?: boolean; | ||
| } | ||
| export interface SessionFsExistsResult { | ||
| export interface SessionFsSetProviderRequest { | ||
| /** | ||
| * Whether the path exists | ||
| * Initial working directory for sessions | ||
| */ | ||
| exists: boolean; | ||
| initialCwd: string; | ||
| /** | ||
| * Path within each session's SessionFs where the runtime stores files for that session | ||
| */ | ||
| sessionStatePath: string; | ||
| conventions: SessionFsSetProviderConventions; | ||
| } | ||
| export interface SessionFsExistsParams { | ||
| export interface SessionFsSetProviderResult { | ||
| /** | ||
| * Whether the provider was set successfully | ||
| */ | ||
| success: boolean; | ||
| } | ||
| export interface SessionFsStatRequest { | ||
| /** | ||
| * Target session identifier | ||
@@ -1257,4 +1284,5 @@ */ | ||
| birthtime: string; | ||
| error?: SessionFsError; | ||
| } | ||
| export interface SessionFsStatParams { | ||
| export interface SessionFsWriteFileRequest { | ||
| /** | ||
@@ -1268,210 +1296,633 @@ * Target session identifier | ||
| path: string; | ||
| /** | ||
| * Content to write | ||
| */ | ||
| content: string; | ||
| /** | ||
| * Optional POSIX-style mode for newly created files | ||
| */ | ||
| mode?: number; | ||
| } | ||
| export interface SessionFsMkdirParams { | ||
| /** @experimental */ | ||
| export interface SessionsForkRequest { | ||
| /** | ||
| * Target session identifier | ||
| * Source session ID to fork from | ||
| */ | ||
| sessionId: string; | ||
| /** | ||
| * Path using SessionFs conventions | ||
| * Optional event ID boundary. When provided, the fork includes only events before this ID (exclusive). When omitted, all events are included. | ||
| */ | ||
| path: string; | ||
| toEventId?: string; | ||
| } | ||
| /** @experimental */ | ||
| export interface SessionsForkResult { | ||
| /** | ||
| * Create parent directories as needed | ||
| * The new forked session's ID | ||
| */ | ||
| recursive?: boolean; | ||
| sessionId: string; | ||
| } | ||
| export interface ShellExecRequest { | ||
| /** | ||
| * Optional POSIX-style mode for newly created directories | ||
| * Shell command to execute | ||
| */ | ||
| mode?: number; | ||
| command: string; | ||
| /** | ||
| * Working directory (defaults to session working directory) | ||
| */ | ||
| cwd?: string; | ||
| /** | ||
| * Timeout in milliseconds (default: 30000) | ||
| */ | ||
| timeout?: number; | ||
| } | ||
| export interface SessionFsReaddirResult { | ||
| export interface ShellExecResult { | ||
| /** | ||
| * Entry names in the directory | ||
| * Unique identifier for tracking streamed output | ||
| */ | ||
| entries: string[]; | ||
| processId: string; | ||
| } | ||
| export interface SessionFsReaddirParams { | ||
| export interface ShellKillRequest { | ||
| /** | ||
| * Target session identifier | ||
| * Process identifier returned by shell.exec | ||
| */ | ||
| sessionId: string; | ||
| processId: string; | ||
| signal?: ShellKillSignal; | ||
| } | ||
| export interface ShellKillResult { | ||
| /** | ||
| * Path using SessionFs conventions | ||
| * Whether the signal was sent successfully | ||
| */ | ||
| path: string; | ||
| killed: boolean; | ||
| } | ||
| export interface SessionFsReaddirWithTypesResult { | ||
| export interface Skill { | ||
| /** | ||
| * Directory entries with type information | ||
| * Unique identifier for the skill | ||
| */ | ||
| entries: { | ||
| /** | ||
| * Entry name | ||
| */ | ||
| name: string; | ||
| /** | ||
| * Entry type | ||
| */ | ||
| type: "file" | "directory"; | ||
| }[]; | ||
| 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; | ||
| } | ||
| export interface SessionFsReaddirWithTypesParams { | ||
| /** @experimental */ | ||
| export interface SkillList { | ||
| /** | ||
| * Target session identifier | ||
| * Available skills | ||
| */ | ||
| sessionId: string; | ||
| skills: Skill[]; | ||
| } | ||
| export interface SkillsConfigSetDisabledSkillsRequest { | ||
| /** | ||
| * Path using SessionFs conventions | ||
| * List of skill names to disable | ||
| */ | ||
| path: string; | ||
| disabledSkills: string[]; | ||
| } | ||
| export interface SessionFsRmParams { | ||
| /** @experimental */ | ||
| export interface SkillsDisableRequest { | ||
| /** | ||
| * Target session identifier | ||
| * Name of the skill to disable | ||
| */ | ||
| sessionId: string; | ||
| name: string; | ||
| } | ||
| export interface SkillsDiscoverRequest { | ||
| /** | ||
| * Path using SessionFs conventions | ||
| * 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; | ||
| /** | ||
| * Remove directories and their contents recursively | ||
| * File content to write as a UTF-8 string | ||
| */ | ||
| recursive?: boolean; | ||
| content: string; | ||
| } | ||
| export interface WorkspacesGetWorkspaceResult { | ||
| /** | ||
| * Ignore errors if the path does not exist | ||
| * Current workspace metadata, or null if not available | ||
| */ | ||
| force?: boolean; | ||
| 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 SessionFsRenameParams { | ||
| export interface WorkspacesListFilesResult { | ||
| /** | ||
| * Target session identifier | ||
| * Relative file paths in the workspace files directory | ||
| */ | ||
| sessionId: string; | ||
| files: string[]; | ||
| } | ||
| export interface WorkspacesReadFileRequest { | ||
| /** | ||
| * Source path using SessionFs conventions | ||
| * Relative path within the workspace files directory | ||
| */ | ||
| src: string; | ||
| path: string; | ||
| } | ||
| export interface WorkspacesReadFileResult { | ||
| /** | ||
| * Destination path using SessionFs conventions | ||
| * File content as a UTF-8 string | ||
| */ | ||
| dest: string; | ||
| content: string; | ||
| } | ||
| /** Create typed server-scoped RPC methods (no session required). */ | ||
| export declare function createServerRpc(connection: MessageConnection): { | ||
| ping: (params: PingParams) => Promise<PingResult>; | ||
| ping: (params: PingRequest) => Promise<PingResult>; | ||
| models: { | ||
| list: () => Promise<ModelsListResult>; | ||
| list: (params?: ModelsListRequest) => Promise<ModelList>; | ||
| }; | ||
| tools: { | ||
| list: (params: ToolsListParams) => Promise<ToolsListResult>; | ||
| list: (params: ToolsListRequest) => Promise<ToolList>; | ||
| }; | ||
| account: { | ||
| getQuota: () => Promise<AccountGetQuotaResult>; | ||
| getQuota: (params?: AccountGetQuotaRequest) => Promise<AccountGetQuotaResult>; | ||
| }; | ||
| mcp: { | ||
| config: { | ||
| list: () => Promise<McpConfigListResult>; | ||
| add: (params: McpConfigAddParams) => Promise<void>; | ||
| update: (params: McpConfigUpdateParams) => Promise<void>; | ||
| remove: (params: McpConfigRemoveParams) => Promise<void>; | ||
| list: () => Promise<McpConfigList>; | ||
| add: (params: McpConfigAddRequest) => Promise<void>; | ||
| update: (params: McpConfigUpdateRequest) => Promise<void>; | ||
| remove: (params: McpConfigRemoveRequest) => Promise<void>; | ||
| enable: (params: McpConfigEnableRequest) => Promise<void>; | ||
| disable: (params: McpConfigDisableRequest) => Promise<void>; | ||
| }; | ||
| discover: (params: McpDiscoverRequest) => Promise<McpDiscoverResult>; | ||
| }; | ||
| skills: { | ||
| config: { | ||
| setDisabledSkills: (params: SkillsConfigSetDisabledSkillsRequest) => Promise<void>; | ||
| }; | ||
| discover: (params: SkillsDiscoverRequest) => Promise<ServerSkillList>; | ||
| }; | ||
| sessionFs: { | ||
| setProvider: (params: SessionFsSetProviderParams) => Promise<SessionFsSetProviderResult>; | ||
| setProvider: (params: SessionFsSetProviderRequest) => Promise<SessionFsSetProviderResult>; | ||
| }; | ||
| /** @experimental */ | ||
| sessions: { | ||
| fork: (params: SessionsForkRequest) => Promise<SessionsForkResult>; | ||
| }; | ||
| }; | ||
| /** Create typed session-scoped RPC methods. */ | ||
| export declare function createSessionRpc(connection: MessageConnection, sessionId: string): { | ||
| auth: { | ||
| getStatus: () => Promise<SessionAuthStatus>; | ||
| }; | ||
| model: { | ||
| getCurrent: () => Promise<SessionModelGetCurrentResult>; | ||
| switchTo: (params: Omit<SessionModelSwitchToParams, "sessionId">) => Promise<SessionModelSwitchToResult>; | ||
| getCurrent: () => Promise<CurrentModel>; | ||
| switchTo: (params: ModelSwitchToRequest) => Promise<ModelSwitchToResult>; | ||
| }; | ||
| mode: { | ||
| get: () => Promise<SessionModeGetResult>; | ||
| set: (params: Omit<SessionModeSetParams, "sessionId">) => Promise<SessionModeSetResult>; | ||
| get: () => Promise<SessionMode>; | ||
| set: (params: ModeSetRequest) => Promise<void>; | ||
| }; | ||
| name: { | ||
| get: () => Promise<NameGetResult>; | ||
| set: (params: NameSetRequest) => Promise<void>; | ||
| }; | ||
| plan: { | ||
| read: () => Promise<SessionPlanReadResult>; | ||
| update: (params: Omit<SessionPlanUpdateParams, "sessionId">) => Promise<SessionPlanUpdateResult>; | ||
| delete: () => Promise<SessionPlanDeleteResult>; | ||
| read: () => Promise<PlanReadResult>; | ||
| update: (params: PlanUpdateRequest) => Promise<void>; | ||
| delete: () => Promise<void>; | ||
| }; | ||
| workspace: { | ||
| listFiles: () => Promise<SessionWorkspaceListFilesResult>; | ||
| readFile: (params: Omit<SessionWorkspaceReadFileParams, "sessionId">) => Promise<SessionWorkspaceReadFileResult>; | ||
| createFile: (params: Omit<SessionWorkspaceCreateFileParams, "sessionId">) => Promise<SessionWorkspaceCreateFileResult>; | ||
| workspaces: { | ||
| getWorkspace: () => Promise<WorkspacesGetWorkspaceResult>; | ||
| listFiles: () => Promise<WorkspacesListFilesResult>; | ||
| readFile: (params: WorkspacesReadFileRequest) => Promise<WorkspacesReadFileResult>; | ||
| createFile: (params: WorkspacesCreateFileRequest) => Promise<void>; | ||
| }; | ||
| instructions: { | ||
| getSources: () => Promise<InstructionsGetSourcesResult>; | ||
| }; | ||
| /** @experimental */ | ||
| fleet: { | ||
| start: (params: Omit<SessionFleetStartParams, "sessionId">) => Promise<SessionFleetStartResult>; | ||
| start: (params: FleetStartRequest) => Promise<FleetStartResult>; | ||
| }; | ||
| /** @experimental */ | ||
| agent: { | ||
| list: () => Promise<SessionAgentListResult>; | ||
| getCurrent: () => Promise<SessionAgentGetCurrentResult>; | ||
| select: (params: Omit<SessionAgentSelectParams, "sessionId">) => Promise<SessionAgentSelectResult>; | ||
| deselect: () => Promise<SessionAgentDeselectResult>; | ||
| reload: () => Promise<SessionAgentReloadResult>; | ||
| list: () => Promise<AgentList>; | ||
| getCurrent: () => Promise<AgentGetCurrentResult>; | ||
| select: (params: AgentSelectRequest) => Promise<AgentSelectResult>; | ||
| deselect: () => Promise<void>; | ||
| reload: () => Promise<AgentReloadResult>; | ||
| }; | ||
| /** @experimental */ | ||
| skills: { | ||
| list: () => Promise<SessionSkillsListResult>; | ||
| enable: (params: Omit<SessionSkillsEnableParams, "sessionId">) => Promise<SessionSkillsEnableResult>; | ||
| disable: (params: Omit<SessionSkillsDisableParams, "sessionId">) => Promise<SessionSkillsDisableResult>; | ||
| reload: () => Promise<SessionSkillsReloadResult>; | ||
| list: () => Promise<SkillList>; | ||
| enable: (params: SkillsEnableRequest) => Promise<void>; | ||
| disable: (params: SkillsDisableRequest) => Promise<void>; | ||
| reload: () => Promise<void>; | ||
| }; | ||
| /** @experimental */ | ||
| mcp: { | ||
| list: () => Promise<SessionMcpListResult>; | ||
| enable: (params: Omit<SessionMcpEnableParams, "sessionId">) => Promise<SessionMcpEnableResult>; | ||
| disable: (params: Omit<SessionMcpDisableParams, "sessionId">) => Promise<SessionMcpDisableResult>; | ||
| reload: () => Promise<SessionMcpReloadResult>; | ||
| list: () => Promise<McpServerList>; | ||
| enable: (params: McpEnableRequest) => Promise<void>; | ||
| disable: (params: McpDisableRequest) => Promise<void>; | ||
| reload: () => Promise<void>; | ||
| /** @experimental */ | ||
| oauth: { | ||
| login: (params: McpOauthLoginRequest) => Promise<McpOauthLoginResult>; | ||
| }; | ||
| }; | ||
| /** @experimental */ | ||
| plugins: { | ||
| list: () => Promise<SessionPluginsListResult>; | ||
| list: () => Promise<PluginList>; | ||
| }; | ||
| /** @experimental */ | ||
| extensions: { | ||
| list: () => Promise<SessionExtensionsListResult>; | ||
| enable: (params: Omit<SessionExtensionsEnableParams, "sessionId">) => Promise<SessionExtensionsEnableResult>; | ||
| disable: (params: Omit<SessionExtensionsDisableParams, "sessionId">) => Promise<SessionExtensionsDisableResult>; | ||
| reload: () => Promise<SessionExtensionsReloadResult>; | ||
| list: () => Promise<ExtensionList>; | ||
| enable: (params: ExtensionsEnableRequest) => Promise<void>; | ||
| disable: (params: ExtensionsDisableRequest) => Promise<void>; | ||
| reload: () => Promise<void>; | ||
| }; | ||
| /** @experimental */ | ||
| compaction: { | ||
| compact: () => Promise<SessionCompactionCompactResult>; | ||
| }; | ||
| tools: { | ||
| handlePendingToolCall: (params: Omit<SessionToolsHandlePendingToolCallParams, "sessionId">) => Promise<SessionToolsHandlePendingToolCallResult>; | ||
| handlePendingToolCall: (params: ToolsHandlePendingToolCallRequest) => Promise<HandleToolCallResult>; | ||
| }; | ||
| commands: { | ||
| handlePendingCommand: (params: Omit<SessionCommandsHandlePendingCommandParams, "sessionId">) => Promise<SessionCommandsHandlePendingCommandResult>; | ||
| handlePendingCommand: (params: CommandsHandlePendingCommandRequest) => Promise<CommandsHandlePendingCommandResult>; | ||
| }; | ||
| ui: { | ||
| elicitation: (params: Omit<SessionUiElicitationParams, "sessionId">) => Promise<SessionUiElicitationResult>; | ||
| handlePendingElicitation: (params: Omit<SessionUiHandlePendingElicitationParams, "sessionId">) => Promise<SessionUiHandlePendingElicitationResult>; | ||
| elicitation: (params: UIElicitationRequest) => Promise<UIElicitationResponse>; | ||
| handlePendingElicitation: (params: UIHandlePendingElicitationRequest) => Promise<UIElicitationResult>; | ||
| }; | ||
| permissions: { | ||
| handlePendingPermissionRequest: (params: Omit<SessionPermissionsHandlePendingPermissionRequestParams, "sessionId">) => Promise<SessionPermissionsHandlePendingPermissionRequestResult>; | ||
| handlePendingPermissionRequest: (params: PermissionDecisionRequest) => Promise<PermissionRequestResult>; | ||
| setApproveAll: (params: PermissionsSetApproveAllRequest) => Promise<PermissionsSetApproveAllResult>; | ||
| resetSessionApprovals: () => Promise<PermissionsResetSessionApprovalsResult>; | ||
| }; | ||
| log: (params: Omit<SessionLogParams, "sessionId">) => Promise<SessionLogResult>; | ||
| log: (params: LogRequest) => Promise<LogResult>; | ||
| shell: { | ||
| exec: (params: Omit<SessionShellExecParams, "sessionId">) => Promise<SessionShellExecResult>; | ||
| kill: (params: Omit<SessionShellKillParams, "sessionId">) => Promise<SessionShellKillResult>; | ||
| exec: (params: ShellExecRequest) => Promise<ShellExecResult>; | ||
| kill: (params: ShellKillRequest) => Promise<ShellKillResult>; | ||
| }; | ||
| /** @experimental */ | ||
| history: { | ||
| compact: () => Promise<HistoryCompactResult>; | ||
| truncate: (params: HistoryTruncateRequest) => Promise<HistoryTruncateResult>; | ||
| }; | ||
| /** @experimental */ | ||
| usage: { | ||
| getMetrics: () => Promise<UsageGetMetricsResult>; | ||
| }; | ||
| }; | ||
| /** Handler for `sessionFs` client session API methods. */ | ||
| export interface SessionFsHandler { | ||
| readFile(params: SessionFsReadFileParams): Promise<SessionFsReadFileResult>; | ||
| writeFile(params: SessionFsWriteFileParams): Promise<void>; | ||
| appendFile(params: SessionFsAppendFileParams): Promise<void>; | ||
| exists(params: SessionFsExistsParams): Promise<SessionFsExistsResult>; | ||
| stat(params: SessionFsStatParams): Promise<SessionFsStatResult>; | ||
| mkdir(params: SessionFsMkdirParams): Promise<void>; | ||
| readdir(params: SessionFsReaddirParams): Promise<SessionFsReaddirResult>; | ||
| readdirWithTypes(params: SessionFsReaddirWithTypesParams): Promise<SessionFsReaddirWithTypesResult>; | ||
| rm(params: SessionFsRmParams): Promise<void>; | ||
| rename(params: SessionFsRenameParams): Promise<void>; | ||
| readFile(params: SessionFsReadFileRequest): Promise<SessionFsReadFileResult>; | ||
| writeFile(params: SessionFsWriteFileRequest): Promise<SessionFsError | undefined>; | ||
| appendFile(params: SessionFsAppendFileRequest): Promise<SessionFsError | undefined>; | ||
| exists(params: SessionFsExistsRequest): Promise<SessionFsExistsResult>; | ||
| stat(params: SessionFsStatRequest): Promise<SessionFsStatResult>; | ||
| mkdir(params: SessionFsMkdirRequest): Promise<SessionFsError | undefined>; | ||
| readdir(params: SessionFsReaddirRequest): Promise<SessionFsReaddirResult>; | ||
| readdirWithTypes(params: SessionFsReaddirWithTypesRequest): Promise<SessionFsReaddirWithTypesResult>; | ||
| rm(params: SessionFsRmRequest): Promise<SessionFsError | undefined>; | ||
| rename(params: SessionFsRenameRequest): Promise<SessionFsError | undefined>; | ||
| } | ||
@@ -1478,0 +1929,0 @@ /** All client session API handler groups. */ |
@@ -8,3 +8,3 @@ /** | ||
| export { CopilotSession, type AssistantMessageEvent } from "./session.js"; | ||
| export { defineTool, approveAll, SYSTEM_PROMPT_SECTIONS } from "./types.js"; | ||
| export type { CommandContext, CommandDefinition, CommandHandler, ConnectionState, CopilotClientOptions, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationRequest, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, InfiniteSessionConfig, InputOptions, MCPLocalServerConfig, MCPRemoteServerConfig, MCPServerConfig, MessageOptions, ModelBilling, ModelCapabilities, ModelInfo, ModelPolicy, PermissionHandler, PermissionRequest, PermissionRequestResult, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventType, SessionLifecycleHandler, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsHandler, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemPromptSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js"; | ||
| export { defineTool, approveAll, convertMcpCallToolResult, createSessionFsAdapter, SYSTEM_PROMPT_SECTIONS, } from "./types.js"; | ||
| export type { CommandContext, CommandDefinition, CommandHandler, ConnectionState, CopilotClientOptions, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, InfiniteSessionConfig, InputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, MessageOptions, ModelBilling, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventType, SessionLifecycleHandler, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemPromptSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js"; |
@@ -8,3 +8,3 @@ /** | ||
| import type { ClientSessionApiHandlers } from "./generated/rpc.js"; | ||
| import type { CommandHandler, ElicitationHandler, ElicitationRequest, MessageOptions, PermissionHandler, PermissionRequestResult, ReasoningEffort, SectionTransformFn, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionHooks, SessionUiApi, Tool, ToolHandler, TraceContextProvider, TypedSessionEventHandler, UserInputHandler, UserInputResponse } from "./types.js"; | ||
| import type { CommandHandler, ElicitationHandler, ElicitationContext, MessageOptions, PermissionHandler, PermissionRequestResult, ReasoningEffort, ModelCapabilitiesOverride, SectionTransformFn, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionHooks, SessionUiApi, Tool, ToolHandler, TraceContextProvider, TypedSessionEventHandler, UserInputHandler, UserInputResponse } from "./types.js"; | ||
| export declare const NO_RESULT_PERMISSION_V2_ERROR = "Permission handlers cannot return 'no-result' when connected to a protocol v2 server."; | ||
@@ -255,3 +255,3 @@ /** Assistant message event - the final response from the assistant. */ | ||
| */ | ||
| _handleElicitationRequest(request: ElicitationRequest, requestId: string): Promise<void>; | ||
| _handleElicitationRequest(context: ElicitationContext, requestId: string): Promise<void>; | ||
| /** | ||
@@ -437,2 +437,3 @@ * Sets the host capabilities for this session. | ||
| reasoningEffort?: ReasoningEffort; | ||
| modelCapabilities?: ModelCapabilitiesOverride; | ||
| }): Promise<void>; | ||
@@ -439,0 +440,0 @@ /** |
+145
-22
| /** | ||
| * Type definitions for the Copilot SDK | ||
| */ | ||
| import type { SessionFsHandler } from "./generated/rpc.js"; | ||
| import type { SessionFsProvider } from "./sessionFsProvider.js"; | ||
| import type { SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js"; | ||
| import type { CopilotSession } from "./session.js"; | ||
| export type SessionEvent = GeneratedSessionEvent; | ||
| export type { SessionFsHandler } from "./generated/rpc.js"; | ||
| export type { SessionFsProvider } from "./sessionFsProvider.js"; | ||
| export { createSessionFsAdapter } from "./sessionFsProvider.js"; | ||
| export type { SessionFsFileInfo } from "./sessionFsProvider.js"; | ||
| /** | ||
@@ -106,8 +108,8 @@ * Options for creating a CopilotClient | ||
| */ | ||
| githubToken?: string; | ||
| gitHubToken?: string; | ||
| /** | ||
| * Whether to use the logged-in user for authentication. | ||
| * When true, the CLI server will attempt to use stored OAuth tokens or gh CLI auth. | ||
| * When false, only explicit tokens (githubToken or environment variables) are used. | ||
| * @default true (but defaults to false when githubToken is provided) | ||
| * When false, only explicit tokens (gitHubToken or environment variables) are used. | ||
| * @default true (but defaults to false when gitHubToken is provided) | ||
| */ | ||
@@ -160,2 +162,11 @@ useLoggedInUser?: boolean; | ||
| sessionFs?: SessionFsConfig; | ||
| /** | ||
| * Server-wide idle timeout for sessions in seconds. | ||
| * Sessions without activity for this duration are automatically cleaned up. | ||
| * Set to 0 or omit to disable (sessions live indefinitely). | ||
| * This option is only used when the SDK spawns the CLI process; it is ignored | ||
| * when connecting to an external server via {@link cliUrl}. | ||
| * @default undefined (disabled) | ||
| */ | ||
| sessionIdleTimeoutSeconds?: number; | ||
| } | ||
@@ -181,2 +192,36 @@ /** | ||
| export type ToolResult = string | ToolResultObject; | ||
| /** | ||
| * Content block types within an MCP CallToolResult. | ||
| */ | ||
| type McpCallToolResultTextContent = { | ||
| type: "text"; | ||
| text: string; | ||
| }; | ||
| type McpCallToolResultImageContent = { | ||
| type: "image"; | ||
| data: string; | ||
| mimeType: string; | ||
| }; | ||
| type McpCallToolResultResourceContent = { | ||
| type: "resource"; | ||
| resource: { | ||
| uri: string; | ||
| mimeType?: string; | ||
| text?: string; | ||
| blob?: string; | ||
| }; | ||
| }; | ||
| type McpCallToolResultContent = McpCallToolResultTextContent | McpCallToolResultImageContent | McpCallToolResultResourceContent; | ||
| /** | ||
| * MCP-compatible CallToolResult type. Can be passed to | ||
| * {@link convertMcpCallToolResult} to produce a {@link ToolResultObject}. | ||
| */ | ||
| type McpCallToolResult = { | ||
| content: McpCallToolResultContent[]; | ||
| isError?: boolean; | ||
| }; | ||
| /** | ||
| * Converts an MCP CallToolResult into the SDK's ToolResultObject format. | ||
| */ | ||
| export declare function convertMcpCallToolResult(callResult: McpCallToolResult): ToolResultObject; | ||
| export interface ToolInvocation { | ||
@@ -370,6 +415,8 @@ sessionId: string; | ||
| /** | ||
| * Request payload passed to an elicitation handler callback. | ||
| * Extends ElicitationParams with optional metadata fields. | ||
| * Context for an elicitation handler invocation, combining the request data | ||
| * with session context. Mirrors the single-argument pattern of {@link CommandContext}. | ||
| */ | ||
| export interface ElicitationRequest { | ||
| export interface ElicitationContext { | ||
| /** Identifier of the session that triggered the elicitation request. */ | ||
| sessionId: string; | ||
| /** Message describing what information is needed from the user. */ | ||
@@ -390,5 +437,3 @@ message: string; | ||
| */ | ||
| export type ElicitationHandler = (request: ElicitationRequest, invocation: { | ||
| sessionId: string; | ||
| }) => Promise<ElicitationResult> | ElicitationResult; | ||
| export type ElicitationHandler = (context: ElicitationContext) => Promise<ElicitationResult> | ElicitationResult; | ||
| /** | ||
@@ -540,8 +585,7 @@ * Options for the `input()` convenience method. | ||
| export interface PermissionRequest { | ||
| kind: "shell" | "write" | "mcp" | "read" | "url" | "custom-tool"; | ||
| kind: "shell" | "write" | "mcp" | "read" | "url" | "custom-tool" | "memory" | "hook"; | ||
| toolCallId?: string; | ||
| [key: string]: unknown; | ||
| } | ||
| import type { SessionPermissionsHandlePendingPermissionRequestParams } from "./generated/rpc.js"; | ||
| export type PermissionRequestResult = SessionPermissionsHandlePendingPermissionRequestParams["result"] | { | ||
| import type { PermissionDecisionRequest } from "./generated/rpc.js"; | ||
| export type PermissionRequestResult = PermissionDecisionRequest["result"] | { | ||
| kind: "no-result"; | ||
@@ -553,2 +597,3 @@ }; | ||
| export declare const approveAll: PermissionHandler; | ||
| export declare const defaultJoinSessionPermissionHandler: PermissionHandler; | ||
| /** | ||
@@ -766,4 +811,4 @@ * Request for user input from the agent (enables ask_user tool) | ||
| /** | ||
| * Indicates "remote" or "local" server type. | ||
| * If not specified, defaults to "local". | ||
| * Indicates the server type: "stdio" for local/subprocess servers, "http"/"sse" for remote servers. | ||
| * If not specified, defaults to "stdio". | ||
| */ | ||
@@ -779,3 +824,3 @@ type?: string; | ||
| */ | ||
| export interface MCPLocalServerConfig extends MCPServerConfigBase { | ||
| export interface MCPStdioServerConfig extends MCPServerConfigBase { | ||
| type?: "local" | "stdio"; | ||
@@ -793,3 +838,3 @@ command: string; | ||
| */ | ||
| export interface MCPRemoteServerConfig extends MCPServerConfigBase { | ||
| export interface MCPHTTPServerConfig extends MCPServerConfigBase { | ||
| type: "http" | "sse"; | ||
@@ -808,3 +853,3 @@ /** | ||
| */ | ||
| export type MCPServerConfig = MCPLocalServerConfig | MCPRemoteServerConfig; | ||
| export type MCPServerConfig = MCPStdioServerConfig | MCPHTTPServerConfig; | ||
| /** | ||
@@ -844,4 +889,26 @@ * Configuration for a custom agent. | ||
| infer?: boolean; | ||
| /** | ||
| * List of skill names to preload into this agent's context. | ||
| * When set, the full content of each listed skill is eagerly injected into | ||
| * the agent's context at startup. Skills are resolved by name from the | ||
| * session's configured skill directories (`skillDirectories`). | ||
| * When omitted, no skills are injected (opt-in model). | ||
| */ | ||
| skills?: string[]; | ||
| } | ||
| /** | ||
| * Configuration for the default agent (the built-in agent that handles | ||
| * turns when no custom agent is selected). | ||
| * Use this to control tool visibility for the default agent independently of custom sub-agents. | ||
| */ | ||
| export interface DefaultAgentConfig { | ||
| /** | ||
| * List of tool names to exclude from the default agent. | ||
| * These tools remain available to custom sub-agents that reference them in their `tools` array. | ||
| * Use this to register tools that should only be accessed via delegation to sub-agents, | ||
| * keeping the default agent's context clean. | ||
| */ | ||
| excludedTools?: string[]; | ||
| } | ||
| /** | ||
| * Configuration for infinite sessions with automatic context compaction and workspace persistence. | ||
@@ -895,2 +962,4 @@ * When enabled, sessions automatically manage context window limits through background compaction | ||
| reasoningEffort?: ReasoningEffort; | ||
| /** Per-property overrides for model capabilities, deep-merged over runtime defaults. */ | ||
| modelCapabilities?: ModelCapabilitiesOverride; | ||
| /** | ||
@@ -902,2 +971,14 @@ * Override the default configuration directory location. | ||
| /** | ||
| * When true, automatically discovers MCP server configurations (e.g. `.mcp.json`, | ||
| * `.vscode/mcp.json`) and skill directories from the working directory and merges | ||
| * them with any explicitly provided `mcpServers` and `skillDirectories`, with | ||
| * explicit values taking precedence on name collision. | ||
| * | ||
| * Note: custom instruction files (`.github/copilot-instructions.md`, `AGENTS.md`, etc.) | ||
| * are always loaded from the working directory regardless of this setting. | ||
| * | ||
| * @default false | ||
| */ | ||
| enableConfigDiscovery?: boolean; | ||
| /** | ||
| * Tools exposed to the CLI server | ||
@@ -960,2 +1041,12 @@ */ | ||
| /** | ||
| * Include sub-agent streaming events in the event stream. When true, streaming | ||
| * delta events from sub-agents (e.g., `assistant.message_delta`, | ||
| * `assistant.reasoning_delta`, `assistant.streaming_delta` with `agentId` set) | ||
| * are forwarded to this connection. When false, only non-streaming sub-agent | ||
| * events and `subagent.*` lifecycle events are forwarded; streaming deltas from | ||
| * sub-agents are suppressed. | ||
| * @default true | ||
| */ | ||
| includeSubAgentStreamingEvents?: boolean; | ||
| /** | ||
| * MCP server configurations for the session. | ||
@@ -970,2 +1061,9 @@ * Keys are server names, values are server configurations. | ||
| /** | ||
| * Configuration for the default agent (the built-in agent that handles | ||
| * turns when no custom agent is selected). | ||
| * Use `excludedTools` to hide specific tools from the default agent while keeping | ||
| * them available to custom sub-agents. | ||
| */ | ||
| defaultAgent?: DefaultAgentConfig; | ||
| /** | ||
| * Name of the custom agent to activate when the session starts. | ||
@@ -991,2 +1089,13 @@ * Must match the `name` of one of the agents in `customAgents`. | ||
| /** | ||
| * GitHub token for per-session authentication. | ||
| * When provided, the runtime resolves this token into a full GitHub identity | ||
| * (login, Copilot plan, endpoints) and stores it on the session. This enables | ||
| * multitenancy — different sessions can have different GitHub identities. | ||
| * | ||
| * This is independent of the client-level `gitHubToken` in {@link CopilotClientOptions}, | ||
| * which authenticates the CLI process itself. The session-level token determines | ||
| * the identity used for content exclusion, model routing, and quota checks. | ||
| */ | ||
| gitHubToken?: string; | ||
| /** | ||
| * Optional event handler that is registered on the session before the | ||
@@ -1005,3 +1114,3 @@ * session.create RPC is issued. This guarantees that early events emitted | ||
| */ | ||
| createSessionFsHandler?: (session: CopilotSession) => SessionFsHandler; | ||
| createSessionFsHandler?: (session: CopilotSession) => SessionFsProvider; | ||
| } | ||
@@ -1011,3 +1120,3 @@ /** | ||
| */ | ||
| export type ResumeSessionConfig = Pick<SessionConfig, "clientName" | "model" | "tools" | "commands" | "systemMessage" | "availableTools" | "excludedTools" | "provider" | "streaming" | "reasoningEffort" | "onPermissionRequest" | "onUserInputRequest" | "onElicitationRequest" | "hooks" | "workingDirectory" | "configDir" | "mcpServers" | "customAgents" | "agent" | "skillDirectories" | "disabledSkills" | "infiniteSessions" | "onEvent" | "createSessionFsHandler"> & { | ||
| export type ResumeSessionConfig = Pick<SessionConfig, "clientName" | "model" | "tools" | "commands" | "systemMessage" | "availableTools" | "excludedTools" | "provider" | "modelCapabilities" | "streaming" | "includeSubAgentStreamingEvents" | "reasoningEffort" | "onPermissionRequest" | "onUserInputRequest" | "onElicitationRequest" | "hooks" | "workingDirectory" | "configDir" | "enableConfigDiscovery" | "mcpServers" | "customAgents" | "defaultAgent" | "agent" | "skillDirectories" | "disabledSkills" | "infiniteSessions" | "gitHubToken" | "onEvent" | "createSessionFsHandler"> & { | ||
| /** | ||
@@ -1055,2 +1164,6 @@ * When true, skips emitting the session.resume event. | ||
| }; | ||
| /** | ||
| * Custom HTTP headers to include in outbound provider requests. | ||
| */ | ||
| headers?: Record<string, string>; | ||
| } | ||
@@ -1103,2 +1216,6 @@ /** | ||
| mode?: "enqueue" | "immediate"; | ||
| /** | ||
| * Custom HTTP headers to include in outbound model requests for this turn. | ||
| */ | ||
| requestHeaders?: Record<string, string>; | ||
| } | ||
@@ -1226,2 +1343,8 @@ /** | ||
| } | ||
| /** Recursively makes all properties optional, preserving arrays as-is. */ | ||
| type DeepPartial<T> = T extends readonly (infer U)[] ? DeepPartial<U>[] : T extends object ? { | ||
| [K in keyof T]?: DeepPartial<T[K]>; | ||
| } : T; | ||
| /** Deep-partial override for model capabilities — every property at any depth is optional. */ | ||
| export type ModelCapabilitiesOverride = DeepPartial<ModelCapabilities>; | ||
| /** | ||
@@ -1228,0 +1351,0 @@ * Model policy state |
+10
-11
@@ -7,6 +7,6 @@ #!/usr/bin/env node | ||
| import ue from"node:module";import{spawn as le}from"node:child_process";import{chmodSync as W,copyFileSync as $,mkdirSync as ge,readFileSync as me,realpathSync as he,rmSync as j,statSync as ve,writeFileSync as B,writeSync as we}from"node:fs";import{homedir as Oe}from"node:os";import{basename as R,dirname as Ie,join as d,resolve as _,sep as y}from"node:path";import{createInterface as Se}from"node:readline";import*as X from"node:sea";import{fileURLToPath as Y,pathToFileURL as E}from"node:url";var ee=new Set;function A(e,n){let s=Object.create(null);if(e)for(let[i,r]of Object.entries(e))s[i]=r;let o=n??ee;return new Proxy(process.env,{get(i,r){if(typeof r=="string"){if(Object.hasOwn(s,r))return s[r];if(!o.has(r))return process.env[r]}},set(i,r,c){return s[r]=c,!0},has(i,r){return typeof r!="string"?!1:Object.hasOwn(s,r)?s[r]!==void 0:o.has(r)?!1:r in process.env},ownKeys(i){let r=new Set(Object.keys(process.env));for(let c of o)r.delete(c);for(let c of Object.keys(s))s[c]!==void 0?r.add(c):r.delete(c);return[...r]},getOwnPropertyDescriptor(i,r){if(typeof r!="string")return;let c;if(Object.hasOwn(s,r))c=s[r];else{if(o.has(r))return;c=process.env[r]}if(c!==void 0)return{value:c,writable:!0,enumerable:!0,configurable:!0}},deleteProperty(i,r){return s[r]=void 0,!0}})}var re=new Set(["--server","--headless","--acp"]);function te(e){return e==="--prompt"||e.startsWith("--prompt=")||e==="-p"||e.startsWith("-p")&&e.length>2}function ne(e){return e.some(n=>re.has(n)||te(n))}function L(e){return ne(e)}import{readdir as se,access as oe,constants as ie}from"node:fs/promises";import{join as l,basename as C}from"node:path";import{homedir as I}from"node:os";var U=process.env.XDG_CACHE_HOME||l(I(),".cache");function N(){if(process.argv.includes("--no-auto-update")||process.argv.includes("--prefer-version"))return!1;let e=process.env.COPILOT_AUTO_UPDATE;return!(e&&e.toLowerCase()==="false")}function H(){let e=process.argv.indexOf("--prefer-version");if(!(e===-1||e+1>=process.argv.length))return process.argv[e+1]}function ce(){if(process.platform==="darwin")return l(I(),"Library","Caches","copilot");if(process.platform==="win32"){let e=process.env.LOCALAPPDATA||l(I(),".cache");return l(e,"copilot")}return l(U,"copilot")}function M(){let e=[];return process.env.COPILOT_CACHE_HOME&&e.push(l(process.env.COPILOT_CACHE_HOME,"pkg")),e.push(l(ce(),"pkg")),e.push(l(U,"copilot","pkg")),process.env.COPILOT_HOME&&e.push(l(process.env.COPILOT_HOME,"pkg")),e.push(l(I(),".copilot","pkg")),[...new Set(e)]}function D(e){let n=e.match(/^(\d+)\.(\d+)\.(\d+)/);if(n)return[Number(n[1]),Number(n[2]),Number(n[3])]}function ae(e,n){let s=D(e),o=D(n);if(!s&&!o)return 0;if(!s)return-1;if(!o)return 1;for(let c=0;c<3;c++)if(s[c]!==o[c])return s[c]-o[c];let i=e.includes("-"),r=n.includes("-");return i!==r?i?-1:1:e.localeCompare(n)}async function F(e,...n){let s=[];for(let o of n){let i;try{i=await se(o)}catch{continue}for(let r of i){let c=l(o,r);try{await oe(l(c,e),ie.R_OK),s.push(c)}catch{continue}}}return s.sort((o,i)=>{let r=ae(C(i),C(o));return r!==0?r:o.localeCompare(i)}),s}function k(e){return typeof e=="object"&&e!==null&&e.type==="restart-state"&&typeof e.sessionId=="string"&&Array.isArray(e.argv)&&e.argv.every(n=>typeof n=="string")&&typeof e.cwd=="string"}import{createRequire as pe}from"node:module";import{fileURLToPath as de}from"node:url";var w;function G(){if(process.platform!=="win32")return;if(w!==void 0)return w??void 0;let e=pe(import.meta.url),n=[new URL(`./prebuilds/win32-${process.arch}/win32.node`,import.meta.url),new URL(`../native/win32/prebuilds/win32-${process.arch}/win32.node`,import.meta.url)];for(let s of n){let o=de(s);try{return w=e(o),w}catch(i){if(i.code!=="MODULE_NOT_FOUND")throw i}}w=null}try{ue.enableCompileCache?.()}catch{}function V(){if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}if(process.stdout.isTTY)try{we(1,"\x1B[<u\x1B[?1049h\x1B[?1049l\x1B[?1006l\x1B[?1003l\x1B[?1002l\x1B[?2004l\x1B[?1004l\x1B[?25h\x1B[?2026l"+(process.env.TERM!=="dumb"?"\x1B[23;2t":""))}catch{}}var z=Ie(Y(import.meta.url)),J=X.isSea();process.report.reportOnFatalError=!0;process.report.excludeEnv=!0;if(process.platform==="win32")try{let e=G();if(!e)throw new Error("Win32 native addon is unavailable");e.enableCrashReporting(),e.installExceptionFilter()}catch{}var S=process.argv.find(e=>R(e).startsWith("conpty_console_list_agent")),K=process.argv.find(e=>R(e)==="extension_bootstrap.mjs"),Q=K?_(K):void 0,q=Q?.startsWith(_(z,"preloads")+y)?Q:void 0;if(S){let e=S.endsWith(".js")?S:S+".js";await import(E(e).href)}else if(q)await import(E(q).href);else if(process.env.COPILOT_SHUTDOWN_FLUSH){try{let{url:e,headers:n,body:s}=JSON.parse(process.env.COPILOT_SHUTDOWN_FLUSH);await fetch(e,{method:"POST",headers:n,body:s,signal:AbortSignal.timeout(3e4)})}catch{}process.exit(0)}else if(process.env.COPILOT_RUN_APP==="1"||L(process.argv.slice(2))){let e=d(z,"app.js"),n=H();if(J&&(N()||n)){let s=M().map(i=>d(i,"universal")),o=await F("app.js",...s);if(n){let i=o.find(r=>R(r)===n);i?e=d(i,"app.js"):process.stderr.write(`Warning: preferred version ${n} not found in package cache, using built-in version | ||
| `)}else o.length>0&&(e=d(o[0],"app.js"))}await import(E(e).href)}else{let n=function(){let t=process.env.COPILOT_HOME||d(process.env.HOME||process.env.USERPROFILE||"",".copilot");return d(t,"crash-context",`${e}.json`)},s=function(){try{let t=me(n(),"utf-8");return JSON.parse(t)}catch{return}},o=function(){try{j(n(),{force:!0})}catch{}},i=function(t,f){return new Promise(g=>{let u=Se({input:process.stdin,output:process.stdout}),p=t.toString(16).toUpperCase();if(process.stdout.write(` | ||
| *** Copilot exited unexpectedly (exit code ${t} = 0x${p}) *** | ||
| `),f){let m=f.length>200?f.slice(0,200)+"\u2026":f;process.stdout.write(`Error: ${m} | ||
| import ue from"node:module";import{spawn as ge}from"node:child_process";import{chmodSync as W,copyFileSync as k,mkdirSync as me,readFileSync as B,realpathSync as he,rmSync as y,statSync as ve,writeFileSync as J,writeSync as Oe}from"node:fs";import{basename as x,dirname as Se,join as p,resolve as X,sep as R}from"node:path";import{createInterface as Pe}from"node:readline";import*as z from"node:sea";import{fileURLToPath as Z,pathToFileURL as _}from"node:url";var te=new Set;function U(e,o){let n=Object.create(null);if(e)for(let[i,r]of Object.entries(e))n[i]=r;let c=o??te;return new Proxy(process.env,{get(i,r){if(typeof r=="string"){if(Object.hasOwn(n,r))return n[r];if(!c.has(r))return process.env[r]}},set(i,r,s){return n[r]=s,!0},has(i,r){return typeof r!="string"?!1:Object.hasOwn(n,r)?n[r]!==void 0:c.has(r)?!1:r in process.env},ownKeys(i){let r=new Set(Object.keys(process.env));for(let s of c)r.delete(s);for(let s of Object.keys(n))n[s]!==void 0?r.add(s):r.delete(s);return[...r]},getOwnPropertyDescriptor(i,r){if(typeof r!="string")return;let s;if(Object.hasOwn(n,r))s=n[r];else{if(c.has(r))return;s=process.env[r]}if(s!==void 0)return{value:s,writable:!0,enumerable:!0,configurable:!0}},deleteProperty(i,r){return n[r]=void 0,!0}})}var ne=new Set(["--server","--headless","--acp"]);function se(e){return e==="--prompt"||e.startsWith("--prompt=")||e==="-p"||e.startsWith("-p")&&e.length>2}function oe(e){return e.some(o=>ne.has(o)||se(o))}function H(e){return oe(e)}import{readdir as ie,access as ce,constants as ae}from"node:fs/promises";import{join as f,basename as N}from"node:path";import{homedir as P}from"node:os";var F=process.env.XDG_CACHE_HOME||f(P(),".cache");function D(){if(process.argv.includes("--no-auto-update")||process.argv.includes("--prefer-version"))return!1;let e=process.env.COPILOT_AUTO_UPDATE;return!(e&&e.toLowerCase()==="false")}function M(){let e=process.argv.indexOf("--prefer-version");if(!(e===-1||e+1>=process.argv.length))return process.argv[e+1]}function pe(){if(process.platform==="darwin")return f(P(),"Library","Caches","copilot");if(process.platform==="win32"){let e=process.env.LOCALAPPDATA||f(P(),".cache");return f(e,"copilot")}return f(F,"copilot")}function G(){let e=[];return process.env.COPILOT_CACHE_HOME&&e.push(f(process.env.COPILOT_CACHE_HOME,"pkg")),e.push(f(pe(),"pkg")),e.push(f(F,"copilot","pkg")),process.env.COPILOT_HOME&&e.push(f(process.env.COPILOT_HOME,"pkg")),e.push(f(P(),".copilot","pkg")),[...new Set(e)]}function C(e){let o=e.match(/^(\d+)\.(\d+)\.(\d+)/);if(o)return[Number(o[1]),Number(o[2]),Number(o[3])]}function de(e,o){let n=C(e),c=C(o);if(!n&&!c)return 0;if(!n)return-1;if(!c)return 1;for(let s=0;s<3;s++)if(n[s]!==c[s])return n[s]-c[s];let i=e.includes("-"),r=o.includes("-");return i!==r?i?-1:1:e.localeCompare(o)}async function $(e,...o){let n=[];for(let c of o){let i;try{i=await ie(c)}catch{continue}for(let r of i){let s=f(c,r);try{await ce(f(s,e),ae.R_OK),n.push(s)}catch{continue}}}return n.sort((c,i)=>{let r=de(N(i),N(c));return r!==0?r:c.localeCompare(i)}),n}import{createRequire as fe}from"node:module";import{fileURLToPath as le}from"node:url";var O;function j(){if(process.platform!=="win32")return;if(O!==void 0)return O??void 0;let e=fe(import.meta.url),o=[new URL(`./prebuilds/win32-${process.arch}/win32.node`,import.meta.url),new URL(`../native/win32/prebuilds/win32-${process.arch}/win32.node`,import.meta.url)];for(let n of o){let c=le(n);try{return O=e(c),O}catch(i){if(i.code!=="MODULE_NOT_FOUND")throw i}}O=null}try{ue.enableCompileCache?.()}catch{}var be=75;function K(){if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}if(process.stdout.isTTY)try{Oe(1,"\x1B[<u\x1B[?1049h\x1B[?1049l\x1B[?1006l\x1B[?1003l\x1B[?1002l\x1B[?2004l\x1B[?1004l\x1B[?25h\x1B[?2026l"+(process.env.TERM!=="dumb"?"\x1B[23;2t":""))}catch{}}var ee=Se(Z(import.meta.url)),V=z.isSea();process.report.reportOnFatalError=!0;process.report.excludeEnv=!0;if(process.platform==="win32")try{let e=j();if(!e)throw new Error("Win32 native addon is unavailable");e.enableCrashReporting(),e.installExceptionFilter()}catch{}var b=process.argv.find(e=>x(e).startsWith("conpty_console_list_agent")),Q=process.argv.find(e=>x(e)==="extension_bootstrap.mjs"),Y=Q?X(Q):void 0,q=Y?.startsWith(X(ee,"preloads")+R)?Y:void 0;if(b){let e=b.endsWith(".js")?b:b+".js";await import(_(e).href)}else if(q)await import(_(q).href);else if(process.env.COPILOT_SHUTDOWN_FLUSH){try{let{url:e,headers:o,body:n}=JSON.parse(process.env.COPILOT_SHUTDOWN_FLUSH);await fetch(e,{method:"POST",headers:o,body:n,signal:AbortSignal.timeout(3e4)})}catch{}process.exit(0)}else if(process.env.COPILOT_RUN_APP==="1"||H(process.argv.slice(2))){let e=p(ee,"app.js"),o=M();if(V&&(D()||o)){let n=G().map(i=>p(i,"universal")),c=await $("app.js",...n);if(o){let i=c.find(r=>x(r)===o);i?e=p(i,"app.js"):process.stderr.write(`Warning: preferred version ${o} not found in package cache, using built-in version | ||
| `)}else c.length>0&&(e=p(c[0],"app.js"))}await import(_(e).href)}else{let o=function(){let t=process.env.COPILOT_HOME||p(process.env.HOME||process.env.USERPROFILE||"",".copilot");return p(t,"restart",`${e}.json`)},n=function(){let t=o();try{let a=B(t,"utf-8");return y(t,{force:!0}),JSON.parse(a)}catch{return}},c=function(){try{y(o(),{force:!0})}catch{}},i=function(){let t=process.env.COPILOT_HOME||p(process.env.HOME||process.env.USERPROFILE||"",".copilot");return p(t,"crash-context",`${e}.json`)},r=function(){try{let t=B(i(),"utf-8");return JSON.parse(t)}catch{return}},s=function(){try{y(i(),{force:!0})}catch{}},A=function(t,a){return new Promise(g=>{let l=Pe({input:process.stdin,output:process.stdout}),d=t.toString(16).toUpperCase();if(process.stdout.write(` | ||
| *** Copilot exited unexpectedly (exit code ${t} = 0x${d}) *** | ||
| `),a){let m=a.length>200?a.slice(0,200)+"\u2026":a;process.stdout.write(`Error: ${m} | ||
| `)}process.stdout.write(` | ||
@@ -17,6 +17,5 @@ A crash report can be saved locally. | ||
| `),u.question("Save crash report? [y/N] ",m=>{u.close(),g(m.trim().toLowerCase()==="y")})})},r=function(t,f){try{let g=he(t);return g.startsWith(f+y)?ve(g).isFile():!1}catch{return!1}},O=function(t,f){let g=J?t:[...process.execArgv,Y(import.meta.url),...t],u=le(process.execPath,g,{stdio:["inherit","inherit","inherit","ipc"],cwd:f,env:A({COPILOT_RUN_APP:"1",COPILOT_LOADER_PID:e})});process.env.COPILOT_LOADER_DEBUG&&process.stderr.write(`[loader] spawned app child: pid=${u.pid} (loader pid=${e}) | ||
| `);let p;u.on("message",a=>{k(a)&&(p={sessionId:a.sessionId,argv:a.argv,cwd:a.cwd})});let m=a=>{try{u.kill(a)}catch{}},h=()=>m("SIGINT"),P=()=>m("SIGTERM"),T=()=>m("SIGHUP"),b=()=>m("SIGQUIT");process.on("SIGINT",h),process.on("SIGTERM",P),process.on("SIGHUP",T),process.on("SIGQUIT",b),u.on("error",a=>{process.off("SIGINT",h),process.off("SIGTERM",P),process.off("SIGHUP",T),process.off("SIGQUIT",b),process.stderr.write(`Failed to start: ${a.message} | ||
| `),process.exit(1)}),u.on("close",(a,x)=>{if(process.off("SIGINT",h),process.off("SIGTERM",P),process.off("SIGHUP",T),process.off("SIGQUIT",b),a===75){if(p){let v=[...p.argv,"--resume",p.sessionId];O(v,p.cwd||f)}else process.stderr.write(`Warning: session state was not preserved during restart | ||
| `),O(t,f);return}if(x)o(),V(),process.kill(process.pid,x);else if(a!==0){V();let v=s();v&&process.stdin.isTTY?i(a??1,v.lastError).then(async Z=>{Z&&await c(v,a??1),o(),process.exit(a??1)}).catch(()=>{o(),process.exit(a??1)}):(o(),process.exit(a??1))}else o(),process.exit(0)})};Pe=n,Te=s,be=o,Ee=i,ye=r,Re=O;let e=String(process.pid);try{let t=_(process.env.COPILOT_HOME||d(Oe(),".copilot"));j(d(t,"restart"),{recursive:!0,force:!0})}catch{}async function c(t,f){try{let g=new Date().toISOString().replace(/[:.]/g,"-"),u=process.env.COPILOT_HOME||d(process.env.HOME||process.env.USERPROFILE||"",".copilot"),p=d(u,"crash-reports",`crash-${t.sessionId}-${g}`);ge(p,{recursive:!0,mode:448}),B(d(p,"crash-context.json"),JSON.stringify(t,null,2),{mode:384});let m=["# Crash Report","",`**Exit code**: ${f}`,t.errorType?`**Error type**: ${t.errorType}`:"",t.lastError?`**Error**: ${t.lastError}`:"",`**Timestamp**: ${new Date().toISOString()}`,`**Session ID**: ${t.sessionId}`,`**Working directory**: ${t.cwd}`,t.stackTrace?` | ||
| `),l.question("Save crash report? [y/N] ",m=>{l.close(),g(m.trim().toLowerCase()==="y")})})},I=function(t,a){try{let g=he(t);return g.startsWith(a+R)?ve(g).isFile():!1}catch{return!1}},S=function(t,a){let g=V?t:[...process.execArgv,Z(import.meta.url),...t],l=ge(process.execPath,g,{stdio:"inherit",cwd:a,env:U({COPILOT_RUN_APP:"1",COPILOT_LOADER_PID:e})});process.env.COPILOT_LOADER_DEBUG&&process.stderr.write(`[loader] spawned app child: pid=${l.pid} (loader pid=${e}) | ||
| `);let d=u=>{try{l.kill(u)}catch{}},m=()=>d("SIGINT"),h=()=>d("SIGTERM"),T=()=>d("SIGHUP"),w=()=>d("SIGQUIT");process.on("SIGINT",m),process.on("SIGTERM",h),process.on("SIGHUP",T),process.on("SIGQUIT",w),l.on("error",u=>{process.off("SIGINT",m),process.off("SIGTERM",h),process.off("SIGHUP",T),process.off("SIGQUIT",w),c(),process.stderr.write(`Failed to start: ${u.message} | ||
| `),process.exit(1)}),l.on("exit",(u,L)=>{if(process.off("SIGINT",m),process.off("SIGTERM",h),process.off("SIGHUP",T),process.off("SIGQUIT",w),u===be){let v=n();if(v){let E=[...v.argv,"--resume",v.sessionId];S(E,v.cwd||a)}else S(t,a);return}if(c(),L)s(),K(),process.kill(process.pid,L);else if(u!==0){K();let v=r();v&&process.stdin.isTTY?A(u??1,v.lastError).then(async E=>{E&&await re(v,u??1),s(),process.exit(u??1)}).catch(()=>{s(),process.exit(u??1)}):(s(),process.exit(u??1))}else s(),process.exit(0)})};Ie=o,Te=n,we=c,Ee=i,ye=r,_e=s,Re=A,xe=I,Ae=S;let e=String(process.pid);async function re(t,a){try{let g=new Date().toISOString().replace(/[:.]/g,"-"),l=process.env.COPILOT_HOME||p(process.env.HOME||process.env.USERPROFILE||"",".copilot"),d=p(l,"crash-reports",`crash-${t.sessionId}-${g}`);me(d,{recursive:!0,mode:448}),J(p(d,"crash-context.json"),JSON.stringify(t,null,2),{mode:384});let m=["# Crash Report","",`**Exit code**: ${a}`,t.errorType?`**Error type**: ${t.errorType}`:"",t.lastError?`**Error**: ${t.lastError}`:"",`**Timestamp**: ${new Date().toISOString()}`,`**Session ID**: ${t.sessionId}`,`**Working directory**: ${t.cwd}`,t.stackTrace?` | ||
| ## Stack Trace | ||
@@ -27,5 +26,5 @@ | ||
| \`\`\``:"",""].filter(Boolean).join(` | ||
| `);if(B(d(p,"feedback.md"),m,{mode:384}),t.sessionFilePath&&r(t.sessionFilePath,u))try{let h=d(p,"events.jsonl");$(t.sessionFilePath,h),W(h,384)}catch{}if(t.logFilePath&&r(t.logFilePath,u))try{let h=d(p,"process.log");$(t.logFilePath,h),W(h,384)}catch{}process.stdout.write(` | ||
| Crash report saved to: ${p}${y} | ||
| `);if(J(p(d,"feedback.md"),m,{mode:384}),t.sessionFilePath&&I(t.sessionFilePath,l))try{let h=p(d,"events.jsonl");k(t.sessionFilePath,h),W(h,384)}catch{}if(t.logFilePath&&I(t.logFilePath,l))try{let h=p(d,"process.log");k(t.logFilePath,h),W(h,384)}catch{}process.stdout.write(` | ||
| Crash report saved to: ${d}${R} | ||
| `)}catch(g){process.stderr.write(`Failed to create crash report: ${String(g)} | ||
| `)}}O(process.argv.slice(2),process.cwd())}var Pe,Te,be,Ee,ye,Re; | ||
| `)}}S(process.argv.slice(2),process.cwd())}var Ie,Te,we,Ee,ye,_e,Re,xe,Ae; |
+8
-8
| { | ||
| "name": "@github/copilot", | ||
| "description": "GitHub Copilot CLI brings the power of Copilot coding agent directly to your terminal.", | ||
| "version": "1.0.38", | ||
| "version": "1.0.39-0", | ||
| "license": "SEE LICENSE IN LICENSE.md", | ||
@@ -65,12 +65,12 @@ "type": "module", | ||
| "buildMetadata": { | ||
| "gitCommit": "531a7dc" | ||
| "gitCommit": "9a956bd" | ||
| }, | ||
| "optionalDependencies": { | ||
| "@github/copilot-linux-x64": "1.0.38", | ||
| "@github/copilot-linux-arm64": "1.0.38", | ||
| "@github/copilot-darwin-x64": "1.0.38", | ||
| "@github/copilot-darwin-arm64": "1.0.38", | ||
| "@github/copilot-win32-x64": "1.0.38", | ||
| "@github/copilot-win32-arm64": "1.0.38" | ||
| "@github/copilot-linux-x64": "1.0.39-0", | ||
| "@github/copilot-linux-arm64": "1.0.39-0", | ||
| "@github/copilot-darwin-x64": "1.0.39-0", | ||
| "@github/copilot-darwin-arm64": "1.0.39-0", | ||
| "@github/copilot-win32-x64": "1.0.39-0", | ||
| "@github/copilot-win32-arm64": "1.0.39-0" | ||
| } | ||
| } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 20 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 20 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
130013892
0.16%159
0.63%115422
3.68%6
20%93
12.05%