@github/copilot-sdk 1.0.7-preview.0 → 1.0.7-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Union of all session event variants emitted by the Copilot CLI runtime.
7
7
  */
8
- export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | ScheduleRearmedEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | SessionLimitsChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | UsageCheckpointEvent | ContextChangedEvent | UsageInfoEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantToolCallDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantIdleEvent | AssistantUsageEvent | ModelCallFailureEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | BinaryAssetEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | McpHeadersRefreshRequiredEvent | McpHeadersRefreshCompletedEvent | CustomNotificationEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | SessionLimitsExhaustedRequestedEvent | SessionLimitsExhaustedCompletedEvent | AutoModeResolvedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | CanvasUnavailableEvent | CanvasRecordedEvent | CanvasRemovedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
8
+ export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | ScheduleRearmedEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | SessionLimitsChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | UsageCheckpointEvent | ContextChangedEvent | UsageInfoEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantToolCallDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantIdleEvent | AssistantUsageEvent | ModelCallFailureEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | BinaryAssetEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | McpHeadersRefreshRequiredEvent | McpHeadersRefreshCompletedEvent | CustomNotificationEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | SessionLimitsExhaustedRequestedEvent | SessionLimitsExhaustedCompletedEvent | AutoModeResolvedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | McpToolsListChangedEvent | McpResourcesListChangedEvent | McpPromptsListChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | CanvasUnavailableEvent | CanvasRecordedEvent | CanvasRemovedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
9
9
  /**
10
10
  * Hosting platform type of the repository (github or ado)
11
11
  */
@@ -8114,6 +8114,105 @@ export interface McpServerStatusChangedData {
8114
8114
  serverName: string;
8115
8115
  status: McpServerStatus;
8116
8116
  }
8117
+ /**
8118
+ * Session event "mcp.tools.list_changed". Payload of MCP `list_changed` notification events, emitted when an MCP server announces at runtime that one of its advertised lists changed.
8119
+ */
8120
+ export interface McpToolsListChangedEvent {
8121
+ /**
8122
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
8123
+ */
8124
+ agentId?: string;
8125
+ data: McpListChangedData;
8126
+ /**
8127
+ * Always true for events that are transient and not persisted to the session event log on disk.
8128
+ */
8129
+ ephemeral: true;
8130
+ /**
8131
+ * Unique event identifier (UUID v4), generated when the event is emitted
8132
+ */
8133
+ id: string;
8134
+ /**
8135
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
8136
+ */
8137
+ parentId: string | null;
8138
+ /**
8139
+ * ISO 8601 timestamp when the event was created
8140
+ */
8141
+ timestamp: string;
8142
+ /**
8143
+ * Type discriminator. Always "mcp.tools.list_changed".
8144
+ */
8145
+ type: "mcp.tools.list_changed";
8146
+ }
8147
+ /**
8148
+ * Payload of MCP `list_changed` notification events, emitted when an MCP server announces at runtime that one of its advertised lists changed.
8149
+ */
8150
+ export interface McpListChangedData {
8151
+ /**
8152
+ * Name of the MCP server whose list changed
8153
+ */
8154
+ serverName: string;
8155
+ }
8156
+ /**
8157
+ * Session event "mcp.resources.list_changed". Payload of MCP `list_changed` notification events, emitted when an MCP server announces at runtime that one of its advertised lists changed.
8158
+ */
8159
+ export interface McpResourcesListChangedEvent {
8160
+ /**
8161
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
8162
+ */
8163
+ agentId?: string;
8164
+ data: McpListChangedData;
8165
+ /**
8166
+ * Always true for events that are transient and not persisted to the session event log on disk.
8167
+ */
8168
+ ephemeral: true;
8169
+ /**
8170
+ * Unique event identifier (UUID v4), generated when the event is emitted
8171
+ */
8172
+ id: string;
8173
+ /**
8174
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
8175
+ */
8176
+ parentId: string | null;
8177
+ /**
8178
+ * ISO 8601 timestamp when the event was created
8179
+ */
8180
+ timestamp: string;
8181
+ /**
8182
+ * Type discriminator. Always "mcp.resources.list_changed".
8183
+ */
8184
+ type: "mcp.resources.list_changed";
8185
+ }
8186
+ /**
8187
+ * Session event "mcp.prompts.list_changed". Payload of MCP `list_changed` notification events, emitted when an MCP server announces at runtime that one of its advertised lists changed.
8188
+ */
8189
+ export interface McpPromptsListChangedEvent {
8190
+ /**
8191
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
8192
+ */
8193
+ agentId?: string;
8194
+ data: McpListChangedData;
8195
+ /**
8196
+ * Always true for events that are transient and not persisted to the session event log on disk.
8197
+ */
8198
+ ephemeral: true;
8199
+ /**
8200
+ * Unique event identifier (UUID v4), generated when the event is emitted
8201
+ */
8202
+ id: string;
8203
+ /**
8204
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
8205
+ */
8206
+ parentId: string | null;
8207
+ /**
8208
+ * ISO 8601 timestamp when the event was created
8209
+ */
8210
+ timestamp: string;
8211
+ /**
8212
+ * Type discriminator. Always "mcp.prompts.list_changed".
8213
+ */
8214
+ type: "mcp.prompts.list_changed";
8215
+ }
8117
8216
  /**
8118
8217
  * Session event "session.extensions_loaded". Payload of `session.extensions_loaded` listing discovered extensions and their statuses.
8119
8218
  */
package/dist/index.d.ts CHANGED
@@ -10,4 +10,4 @@ export { CopilotSession, type AssistantMessageEvent } from "./session.js";
10
10
  export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasDeclaration, type CanvasHostContext, type CanvasHostContextCapabilities, type CanvasJsonSchema, type CanvasOptions, } from "./canvas.js";
11
11
  export { defineTool, approveAll, convertMcpCallToolResult, createSessionFsAdapter, CopilotRequestHandler, CopilotWebSocketHandler, CopilotWebSocketCloseStatus, CopilotWebSocketForwarder, SYSTEM_MESSAGE_SECTIONS, } from "./types.js";
12
12
  export type * from "./generated/session-events.js";
13
- export type { CommandContext, CommandDefinition, CommandHandler, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, CopilotClientMode, CopilotClientOptions, StdioRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, BearerTokenProvider, MessageOptions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, CapiSessionOptions, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, NamedProviderConfig, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, ProviderModelConfig, ProviderTokenArgs, RemoteSessionMode, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, CopilotRequestContext, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolTelemetry, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
13
+ export type { CommandContext, CommandDefinition, CommandHandler, CanvasProviderIdentity, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, CopilotClientMode, CopilotClientOptions, StdioRuntimeConnection, InProcessRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, BearerTokenProvider, MessageOptions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, CapiSessionOptions, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, NamedProviderConfig, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, ProviderModelConfig, ProviderTokenArgs, RemoteSessionMode, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, CopilotRequestContext, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolTelemetry, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
package/dist/types.d.ts CHANGED
@@ -63,7 +63,7 @@ export interface TelemetryConfig {
63
63
  * Configures how a {@link CopilotClient} connects to the Copilot runtime.
64
64
  * Construct via the factory functions on {@link RuntimeConnection}.
65
65
  */
66
- export type RuntimeConnection = StdioRuntimeConnection | TcpRuntimeConnection | UriRuntimeConnection;
66
+ export type RuntimeConnection = StdioRuntimeConnection | InProcessRuntimeConnection | TcpRuntimeConnection | UriRuntimeConnection;
67
67
  /**
68
68
  * Spawns a runtime child process and communicates over its stdin/stdout.
69
69
  * This is the default if no {@link CopilotClientOptions.connection} is set.
@@ -75,6 +75,25 @@ export interface StdioRuntimeConnection {
75
75
  /** Extra command-line arguments to pass to the runtime process. */
76
76
  readonly args?: readonly string[];
77
77
  }
78
+ /**
79
+ * Hosts the runtime in-process by loading the native runtime library and speaking
80
+ * JSON-RPC over its C ABI (FFI), instead of spawning a runtime child process. The
81
+ * native host spawns the CLI worker itself. Construct via
82
+ * {@link RuntimeConnection.forInProcess}.
83
+ *
84
+ * @experimental The in-process (FFI) transport is experimental and its behavior may
85
+ * change. Per-client options that are lowered to environment variables — including
86
+ * {@link CopilotClientOptions.env}, {@link CopilotClientOptions.telemetry},
87
+ * {@link CopilotClientOptions.gitHubToken}, and
88
+ * {@link CopilotClientOptions.baseDirectory} — are **not** honored with this
89
+ * transport, because the native runtime loads into the shared host process and its
90
+ * worker inherits that process's ambient environment. To configure the in-process
91
+ * runtime, set the corresponding environment variables on the host process before
92
+ * constructing the client. See https://github.com/github/copilot-sdk/issues/1934.
93
+ */
94
+ export interface InProcessRuntimeConnection {
95
+ readonly kind: "inprocess";
96
+ }
78
97
  /**
79
98
  * Spawns a runtime child process that listens on a TCP socket and connects to it.
80
99
  */
@@ -136,6 +155,16 @@ export declare const RuntimeConnection: {
136
155
  readonly forUri: (url: string, opts?: {
137
156
  connectionToken?: string;
138
157
  }) => UriRuntimeConnection;
158
+ /**
159
+ * Host the runtime in-process over the native runtime library's C ABI (FFI).
160
+ *
161
+ * @experimental Per-client options lowered to environment variables (`env`,
162
+ * `telemetry`, `gitHubToken`, `baseDirectory`) are **not** honored in-process;
163
+ * the worker inherits the host process's ambient environment. Set the
164
+ * corresponding environment variables on the host process instead. See
165
+ * https://github.com/github/copilot-sdk/issues/1934.
166
+ */
167
+ readonly forInProcess: () => InProcessRuntimeConnection;
139
168
  };
140
169
  /**
141
170
  * Controls SDK defaults for ambient features.
@@ -1363,6 +1392,22 @@ export interface ExtensionInfo {
1363
1392
  /** Stable provider name within the source namespace. */
1364
1393
  name: string;
1365
1394
  }
1395
+ /**
1396
+ * Stable identity for a host/SDK connection that supplies built-in canvases.
1397
+ *
1398
+ * When set on session create or resume, the runtime uses {@link id} verbatim
1399
+ * as the agent-facing canvas extension id, so canvases declared on a control
1400
+ * connection survive stdio reconnect and CLI process restart instead of being
1401
+ * re-keyed to a per-connection id. The id is opaque to the runtime; a
1402
+ * per-window-stable value such as `app:builtin:<windowId>` is recommended. An
1403
+ * id beginning with `connection:` is reserved and ignored by the runtime.
1404
+ */
1405
+ export interface CanvasProviderIdentity {
1406
+ /** Opaque, stable provider id used verbatim as the canvas extension id. */
1407
+ id: string;
1408
+ /** Optional display name surfaced as the canvas extension name. */
1409
+ name?: string;
1410
+ }
1366
1411
  /**
1367
1412
  * Provider-scoped options for the Copilot API (CAPI).
1368
1413
  *
@@ -1490,6 +1535,13 @@ export interface SessionConfigBase {
1490
1535
  * id instead of a reconnect-specific connection id.
1491
1536
  */
1492
1537
  extensionInfo?: ExtensionInfo;
1538
+ /**
1539
+ * Stable identity for a host/SDK connection that supplies built-in
1540
+ * canvases. When set, the runtime uses `id` verbatim as the agent-facing
1541
+ * canvas extension id, so canvases declared on a control connection survive
1542
+ * reconnect and CLI restart. Honored on session create and resume.
1543
+ */
1544
+ canvasProvider?: CanvasProviderIdentity;
1493
1545
  /**
1494
1546
  * Slash commands registered for this session.
1495
1547
  * When the CLI has a TUI, each command appears as `/name` for the user to invoke.
package/dist/types.js CHANGED
@@ -31,6 +31,18 @@ const RuntimeConnection = {
31
31
  */
32
32
  forUri(url, opts = {}) {
33
33
  return { kind: "uri", url, connectionToken: opts.connectionToken };
34
+ },
35
+ /**
36
+ * Host the runtime in-process over the native runtime library's C ABI (FFI).
37
+ *
38
+ * @experimental Per-client options lowered to environment variables (`env`,
39
+ * `telemetry`, `gitHubToken`, `baseDirectory`) are **not** honored in-process;
40
+ * the worker inherits the host process's ambient environment. Set the
41
+ * corresponding environment variables on the host process instead. See
42
+ * https://github.com/github/copilot-sdk/issues/1934.
43
+ */
44
+ forInProcess() {
45
+ return { kind: "inprocess" };
34
46
  }
35
47
  };
36
48
  function convertMcpCallToolResult(callResult) {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/github/copilot-sdk.git"
6
6
  },
7
- "version": "1.0.7-preview.0",
7
+ "version": "1.0.7-preview.1",
8
8
  "description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC",
9
9
  "main": "./dist/cjs/index.js",
10
10
  "types": "./dist/index.d.ts",
@@ -56,7 +56,8 @@
56
56
  "author": "GitHub",
57
57
  "license": "MIT",
58
58
  "dependencies": {
59
- "@github/copilot": "^1.0.70-0",
59
+ "@github/copilot": "^1.0.70",
60
+ "koffi": "^3.1.0",
60
61
  "vscode-jsonrpc": "^8.2.1",
61
62
  "zod": "^4.3.6"
62
63
  },