@github/copilot-sdk 1.0.3 → 1.0.4

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.
@@ -36,7 +36,35 @@ function createServerRpc(connection) {
36
36
  *
37
37
  * @returns Quota usage snapshots for the resolved user, keyed by quota type.
38
38
  */
39
- getQuota: async (params) => connection.sendRequest("account.getQuota", params)
39
+ getQuota: async (params) => connection.sendRequest("account.getQuota", params),
40
+ /**
41
+ * Gets the currently active authentication credentials from the global auth manager.
42
+ *
43
+ * @returns Current authentication state
44
+ */
45
+ getCurrentAuth: async () => connection.sendRequest("account.getCurrentAuth", {}),
46
+ /**
47
+ * Gets all authenticated users available for account switching.
48
+ *
49
+ * @returns List of all authenticated users
50
+ */
51
+ getAllUsers: async () => connection.sendRequest("account.getAllUsers", {}),
52
+ /**
53
+ * Stores authentication credentials after successful login (e.g., device code flow).
54
+ *
55
+ * @param params Credentials to store after successful authentication
56
+ *
57
+ * @returns Result of a successful login; throws on failure
58
+ */
59
+ login: async (params) => connection.sendRequest("account.login", params),
60
+ /**
61
+ * Removes user authentication from keychain and persisted state.
62
+ *
63
+ * @param params User to log out
64
+ *
65
+ * @returns Logout result indicating if more users remain
66
+ */
67
+ logout: async (params) => connection.sendRequest("account.logout", params)
40
68
  },
41
69
  secrets: {
42
70
  /**
@@ -1076,7 +1104,7 @@ function createSessionRpc(connection, sessionId) {
1076
1104
  /**
1077
1105
  * Starts OAuth authentication for a remote MCP server.
1078
1106
  *
1079
- * @param params Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, and the callback success-page copy.
1107
+ * @param params Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, callback success-page copy, and static OAuth client selection.
1080
1108
  *
1081
1109
  * @returns OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server.
1082
1110
  */
@@ -1154,7 +1182,15 @@ function createSessionRpc(connection, sessionId) {
1154
1182
  *
1155
1183
  * @returns A snapshot of the provider endpoint the session is currently configured to talk to.
1156
1184
  */
1157
- getEndpoint: async (params) => connection.sendRequest("session.provider.getEndpoint", { sessionId, ...params })
1185
+ getEndpoint: async (params) => connection.sendRequest("session.provider.getEndpoint", { sessionId, ...params }),
1186
+ /**
1187
+ * Adds BYOK providers and/or models to the session's registry at runtime, extending the additive registry built from the session's `providers`/`models` options. Both fields are optional, so a call may add providers only, models only, or both. Within a single call providers are registered before models, so a model may reference a provider added in the same call; across calls a model may reference any provider already registered (from session creation or a prior add). A model whose referenced provider is not registered by the end of the call is rejected. Newly added models become selectable via `model.list` / `model.switchTo` and are inherited by sub-agents spawned afterwards.
1188
+ *
1189
+ * @param params BYOK providers and/or models to add to the session's registry at runtime. Both fields are optional; provide providers, models, or both.
1190
+ *
1191
+ * @returns The selectable model entries synthesized for the models added by this call.
1192
+ */
1193
+ add: async (params) => connection.sendRequest("session.provider.add", { sessionId, ...params })
1158
1194
  },
1159
1195
  /** @experimental */
1160
1196
  options: {
@@ -1849,6 +1885,11 @@ function createInternalSessionRpc(connection, sessionId) {
1849
1885
  };
1850
1886
  }
1851
1887
  function registerClientSessionApiHandlers(connection, getHandlers) {
1888
+ connection.onRequest("providerToken.getToken", async (params) => {
1889
+ const handler = getHandlers(params.sessionId).providerToken;
1890
+ if (!handler) throw new Error(`No providerToken handler registered for session: ${params.sessionId}`);
1891
+ return handler.getToken(params);
1892
+ });
1852
1893
  connection.onRequest("sessionFs.readFile", async (params) => {
1853
1894
  const handler = getHandlers(params.sessionId).sessionFs;
1854
1895
  if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
@@ -1925,10 +1966,23 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
1925
1966
  return handler.invoke(params);
1926
1967
  });
1927
1968
  }
1969
+ function registerClientGlobalApiHandlers(connection, handlers) {
1970
+ connection.onRequest("llmInference.httpRequestStart", async (params) => {
1971
+ const handler = handlers.llmInference;
1972
+ if (!handler) throw new Error("No llmInference client-global handler registered");
1973
+ return handler.httpRequestStart(params);
1974
+ });
1975
+ connection.onRequest("llmInference.httpRequestChunk", async (params) => {
1976
+ const handler = handlers.llmInference;
1977
+ if (!handler) throw new Error("No llmInference client-global handler registered");
1978
+ return handler.httpRequestChunk(params);
1979
+ });
1980
+ }
1928
1981
  export {
1929
1982
  createInternalServerRpc,
1930
1983
  createInternalSessionRpc,
1931
1984
  createServerRpc,
1932
1985
  createSessionRpc,
1986
+ registerClientGlobalApiHandlers,
1933
1987
  registerClientSessionApiHandlers
1934
1988
  };
@@ -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 | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | ContextChangedEvent | UsageInfoEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | 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 | CustomNotificationEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
8
+ export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | ScheduleRearmedEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | ContextChangedEvent | UsageInfoEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | 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 | CustomNotificationEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | CanvasUnavailableEvent | CanvasRecordedEvent | CanvasRemovedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
9
9
  /**
10
10
  * Hosting platform type of the repository (github or ado)
11
11
  */
@@ -467,14 +467,6 @@ export type ExtensionsLoadedExtensionStatus =
467
467
  | "failed"
468
468
  /** The extension process is starting. */
469
469
  | "starting";
470
- /**
471
- * Runtime-controlled routing state for the instance. "ready" when the provider connection is live; "stale" when the provider has gone away and the instance is awaiting rebinding.
472
- */
473
- export type CanvasOpenedAvailability =
474
- /** Provider connection is live; actions can be invoked. */
475
- "ready"
476
- /** Provider has gone away; the instance is awaiting rebinding. */
477
- | "stale";
478
470
  /**
479
471
  * Session event "session.start". Session initialization metadata including context and configuration
480
472
  */
@@ -917,6 +909,10 @@ export interface ScheduleCreatedData {
917
909
  * Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`)
918
910
  */
919
911
  recurring?: boolean;
912
+ /**
913
+ * True for a self-paced (`dynamic`) schedule: no fixed cadence; the model arms each next run via the `manage_schedule` `wakeup` action. `nextRunAt` is model-controlled rather than auto-computed.
914
+ */
915
+ selfPaced?: boolean;
920
916
  /**
921
917
  * IANA timezone the `cron` expression is evaluated in
922
918
  */
@@ -961,6 +957,49 @@ export interface ScheduleCancelledData {
961
957
  */
962
958
  id: number;
963
959
  }
960
+ /**
961
+ * Session event "session.schedule_rearmed". Self-paced schedule re-armed for its next run
962
+ */
963
+ export interface ScheduleRearmedEvent {
964
+ /**
965
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
966
+ */
967
+ agentId?: string;
968
+ data: ScheduleRearmedData;
969
+ /**
970
+ * When true, the event is transient and not persisted to the session event log on disk
971
+ */
972
+ ephemeral?: boolean;
973
+ /**
974
+ * Unique event identifier (UUID v4), generated when the event is emitted
975
+ */
976
+ id: string;
977
+ /**
978
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
979
+ */
980
+ parentId: string | null;
981
+ /**
982
+ * ISO 8601 timestamp when the event was created
983
+ */
984
+ timestamp: string;
985
+ /**
986
+ * Type discriminator. Always "session.schedule_rearmed".
987
+ */
988
+ type: "session.schedule_rearmed";
989
+ }
990
+ /**
991
+ * Self-paced schedule re-armed for its next run
992
+ */
993
+ export interface ScheduleRearmedData {
994
+ /**
995
+ * Id of the self-paced schedule that was re-armed
996
+ */
997
+ id: number;
998
+ /**
999
+ * Absolute time (epoch milliseconds) the model armed the next run to fire
1000
+ */
1001
+ nextRunAt: number;
1002
+ }
964
1003
  /**
965
1004
  * Session event "session.autopilot_objective_changed". Autopilot objective state file operation details indicating what changed
966
1005
  */
@@ -1942,6 +1981,10 @@ export interface CompactionCompleteData {
1942
1981
  * Copilot service request ID (x-copilot-service-request-id header) for the compaction LLM call
1943
1982
  */
1944
1983
  serviceRequestId?: string;
1984
+ /**
1985
+ * For failed compaction only: the HTTP status code of the compaction LLM call failure, when it carried one. Absent for successful compaction and for failures without an HTTP status (e.g. an empty model response or a transport error).
1986
+ */
1987
+ statusCode?: number;
1945
1988
  /**
1946
1989
  * Whether compaction completed successfully
1947
1990
  */
@@ -2154,6 +2197,10 @@ export interface AttachmentFile {
2154
2197
  * Absolute file path
2155
2198
  */
2156
2199
  path: string;
2200
+ /**
2201
+ * Frozen rendered line this attachment contributed to the <tagged_files> prompt block (e.g. "* /path (123 lines)"). Captured at send time so resumed history reproduces the exact text the model saw, independent of later filesystem changes. Present only for attachments routed to <tagged_files> (mutually exclusive with assetId, which marks bytes sent natively).
2202
+ */
2203
+ taggedFilesEntry?: string;
2157
2204
  /**
2158
2205
  * Attachment type discriminator
2159
2206
  */
@@ -2184,6 +2231,10 @@ export interface AttachmentDirectory {
2184
2231
  * Absolute directory path
2185
2232
  */
2186
2233
  path: string;
2234
+ /**
2235
+ * Frozen rendered line this attachment contributed to the <tagged_files> prompt block (e.g. "* /path (12 items)"). Captured at send time so resumed history reproduces the exact text the model saw, independent of later filesystem changes.
2236
+ */
2237
+ taggedFilesEntry?: string;
2187
2238
  /**
2188
2239
  * Attachment type discriminator
2189
2240
  */
@@ -3198,6 +3249,7 @@ export interface ModelCallFailureData {
3198
3249
  * GitHub request tracing ID (x-github-request-id header) for server-side log correlation
3199
3250
  */
3200
3251
  providerCallId?: string;
3252
+ requestFingerprint?: ModelCallFailureRequestFingerprint;
3201
3253
  /**
3202
3254
  * Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
3203
3255
  */
@@ -3208,6 +3260,39 @@ export interface ModelCallFailureData {
3208
3260
  */
3209
3261
  statusCode?: number;
3210
3262
  }
3263
+ /**
3264
+ * Content-free structural summary of the failing request for diagnosing malformed 4xx calls
3265
+ */
3266
+ export interface ModelCallFailureRequestFingerprint {
3267
+ /**
3268
+ * Total number of image content parts
3269
+ */
3270
+ imagePartCount: number;
3271
+ /**
3272
+ * Image parts whose media type cannot be determined (rejected by strict providers)
3273
+ */
3274
+ imagePartsMissingMediaType: number;
3275
+ /**
3276
+ * Role of the final message in the request
3277
+ */
3278
+ lastMessageRole?: string;
3279
+ /**
3280
+ * Total number of messages in the request
3281
+ */
3282
+ messageCount: number;
3283
+ /**
3284
+ * Tool calls whose name is missing or empty (rejected by strict providers)
3285
+ */
3286
+ namelessToolCallCount: number;
3287
+ /**
3288
+ * Total number of tool calls across assistant messages
3289
+ */
3290
+ toolCallCount: number;
3291
+ /**
3292
+ * Number of "tool" result messages in the request
3293
+ */
3294
+ toolResultMessageCount: number;
3295
+ }
3211
3296
  /**
3212
3297
  * Session event "abort". Turn abort information including the reason for termination
3213
3298
  */
@@ -4870,6 +4955,14 @@ export interface PermissionRequestShell {
4870
4955
  * URLs that may be accessed by the command
4871
4956
  */
4872
4957
  possibleUrls: PermissionRequestShellPossibleUrl[];
4958
+ /**
4959
+ * True when the model has requested to run this command outside the sandbox (it set requestSandboxBypass: true and the host opted in via sandbox.allowBypass). This is a request, not a grant: the command runs unsandboxed only if the user approves this permission request. Hosts should highlight the elevated risk in the approval UI.
4960
+ */
4961
+ requestSandboxBypass?: boolean;
4962
+ /**
4963
+ * Model-provided justification for the sandbox-bypass request. Only meaningful when requestSandboxBypass is true.
4964
+ */
4965
+ requestSandboxBypassReason?: string;
4873
4966
  /**
4874
4967
  * Tool call ID that triggered this permission request
4875
4968
  */
@@ -6854,6 +6947,10 @@ export interface SkillsLoadedData {
6854
6947
  * Schema for the `SkillsLoadedSkill` type.
6855
6948
  */
6856
6949
  export interface SkillsLoadedSkill {
6950
+ /**
6951
+ * Optional freeform hint describing the skill's expected arguments, from the `argument-hint` frontmatter field
6952
+ */
6953
+ argumentHint?: string;
6857
6954
  /**
6858
6955
  * Description of what the skill does
6859
6956
  */
@@ -7124,6 +7221,7 @@ export interface ExtensionsLoadedExtension {
7124
7221
  /**
7125
7222
  * Session event "session.canvas.opened".
7126
7223
  */
7224
+ /** @experimental */
7127
7225
  export interface CanvasOpenedEvent {
7128
7226
  /**
7129
7227
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -7154,8 +7252,8 @@ export interface CanvasOpenedEvent {
7154
7252
  /**
7155
7253
  * Schema for the `CanvasOpenedData` type.
7156
7254
  */
7255
+ /** @experimental */
7157
7256
  export interface CanvasOpenedData {
7158
- availability: CanvasOpenedAvailability;
7159
7257
  /**
7160
7258
  * Provider-local canvas identifier
7161
7259
  */
@@ -7178,10 +7276,6 @@ export interface CanvasOpenedData {
7178
7276
  * Stable caller-supplied canvas instance identifier
7179
7277
  */
7180
7278
  instanceId: string;
7181
- /**
7182
- * Whether this notification represents an idempotent reopen
7183
- */
7184
- reopen: boolean;
7185
7279
  /**
7186
7280
  * Provider-supplied status text
7187
7281
  */
@@ -7198,6 +7292,7 @@ export interface CanvasOpenedData {
7198
7292
  /**
7199
7293
  * Session event "session.canvas.registry_changed".
7200
7294
  */
7295
+ /** @experimental */
7201
7296
  export interface CanvasRegistryChangedEvent {
7202
7297
  /**
7203
7298
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -7228,6 +7323,7 @@ export interface CanvasRegistryChangedEvent {
7228
7323
  /**
7229
7324
  * Schema for the `CanvasRegistryChangedData` type.
7230
7325
  */
7326
+ /** @experimental */
7231
7327
  export interface CanvasRegistryChangedData {
7232
7328
  /**
7233
7329
  * Canvas declarations currently available
@@ -7237,6 +7333,7 @@ export interface CanvasRegistryChangedData {
7237
7333
  /**
7238
7334
  * Schema for the `CanvasRegistryChangedCanvas` type.
7239
7335
  */
7336
+ /** @experimental */
7240
7337
  export interface CanvasRegistryChangedCanvas {
7241
7338
  /**
7242
7339
  * Actions the agent or host may invoke
@@ -7272,6 +7369,7 @@ export interface CanvasRegistryChangedCanvas {
7272
7369
  /**
7273
7370
  * Schema for the `CanvasRegistryChangedCanvasAction` type.
7274
7371
  */
7372
+ /** @experimental */
7275
7373
  export interface CanvasRegistryChangedCanvasAction {
7276
7374
  /**
7277
7375
  * Action description
@@ -7291,6 +7389,7 @@ export interface CanvasRegistryChangedCanvasAction {
7291
7389
  /**
7292
7390
  * Session event "session.canvas.closed".
7293
7391
  */
7392
+ /** @experimental */
7294
7393
  export interface CanvasClosedEvent {
7295
7394
  /**
7296
7395
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -7321,6 +7420,7 @@ export interface CanvasClosedEvent {
7321
7420
  /**
7322
7421
  * Schema for the `CanvasClosedData` type.
7323
7422
  */
7423
+ /** @experimental */
7324
7424
  export interface CanvasClosedData {
7325
7425
  /**
7326
7426
  * Provider-local canvas identifier
@@ -7335,6 +7435,163 @@ export interface CanvasClosedData {
7335
7435
  */
7336
7436
  instanceId: string;
7337
7437
  }
7438
+ /**
7439
+ * Session event "session.canvas.unavailable". Transient signal that an open canvas instance's provider has dropped (for example the extension is reloading mid-session). The host should keep the panel mounted and surface a reconnecting affordance rather than tearing it down; a subsequent `session.canvas.opened` for the same instanceId clears the affordance once the provider reconnects with a fresh url. Ephemeral and never persisted, so it is never replayed on cold resume.
7440
+ */
7441
+ /** @experimental */
7442
+ export interface CanvasUnavailableEvent {
7443
+ /**
7444
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
7445
+ */
7446
+ agentId?: string;
7447
+ data: CanvasUnavailableData;
7448
+ /**
7449
+ * Always true for events that are transient and not persisted to the session event log on disk.
7450
+ */
7451
+ ephemeral: true;
7452
+ /**
7453
+ * Unique event identifier (UUID v4), generated when the event is emitted
7454
+ */
7455
+ id: string;
7456
+ /**
7457
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
7458
+ */
7459
+ parentId: string | null;
7460
+ /**
7461
+ * ISO 8601 timestamp when the event was created
7462
+ */
7463
+ timestamp: string;
7464
+ /**
7465
+ * Type discriminator. Always "session.canvas.unavailable".
7466
+ */
7467
+ type: "session.canvas.unavailable";
7468
+ }
7469
+ /**
7470
+ * Transient signal that an open canvas instance's provider has dropped (for example the extension is reloading mid-session). The host should keep the panel mounted and surface a reconnecting affordance rather than tearing it down; a subsequent `session.canvas.opened` for the same instanceId clears the affordance once the provider reconnects with a fresh url. Ephemeral and never persisted, so it is never replayed on cold resume.
7471
+ */
7472
+ /** @experimental */
7473
+ export interface CanvasUnavailableData {
7474
+ /**
7475
+ * Provider-local canvas identifier
7476
+ */
7477
+ canvasId: string;
7478
+ /**
7479
+ * Owning provider identifier
7480
+ */
7481
+ extensionId: string;
7482
+ /**
7483
+ * Stable caller-supplied identifier of the canvas instance whose provider became unavailable
7484
+ */
7485
+ instanceId: string;
7486
+ }
7487
+ /**
7488
+ * Session event "session.canvas.recorded". Durable record that a canvas instance is open, used to restore open canvases on cold session resume. Intentionally omits the transient url and availability.
7489
+ */
7490
+ /** @experimental */
7491
+ export interface CanvasRecordedEvent {
7492
+ /**
7493
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
7494
+ */
7495
+ agentId?: string;
7496
+ data: CanvasRecordedData;
7497
+ /**
7498
+ * When true, the event is transient and not persisted to the session event log on disk
7499
+ */
7500
+ ephemeral?: boolean;
7501
+ /**
7502
+ * Unique event identifier (UUID v4), generated when the event is emitted
7503
+ */
7504
+ id: string;
7505
+ /**
7506
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
7507
+ */
7508
+ parentId: string | null;
7509
+ /**
7510
+ * ISO 8601 timestamp when the event was created
7511
+ */
7512
+ timestamp: string;
7513
+ /**
7514
+ * Type discriminator. Always "session.canvas.recorded".
7515
+ */
7516
+ type: "session.canvas.recorded";
7517
+ }
7518
+ /**
7519
+ * Durable record that a canvas instance is open, used to restore open canvases on cold session resume. Intentionally omits the transient url and availability.
7520
+ */
7521
+ /** @experimental */
7522
+ export interface CanvasRecordedData {
7523
+ /**
7524
+ * Provider-local canvas identifier
7525
+ */
7526
+ canvasId: string;
7527
+ /**
7528
+ * Owning provider identifier
7529
+ */
7530
+ extensionId: string;
7531
+ /**
7532
+ * Input supplied when the instance was opened
7533
+ */
7534
+ input?: {
7535
+ [k: string]: unknown | undefined;
7536
+ };
7537
+ /**
7538
+ * Stable caller-supplied canvas instance identifier
7539
+ */
7540
+ instanceId: string;
7541
+ /**
7542
+ * Rendered title
7543
+ */
7544
+ title?: string;
7545
+ }
7546
+ /**
7547
+ * Session event "session.canvas.removed". Durable record that a canvas instance was closed, superseding a prior instance_recorded during resume replay.
7548
+ */
7549
+ /** @experimental */
7550
+ export interface CanvasRemovedEvent {
7551
+ /**
7552
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
7553
+ */
7554
+ agentId?: string;
7555
+ data: CanvasRemovedData;
7556
+ /**
7557
+ * When true, the event is transient and not persisted to the session event log on disk
7558
+ */
7559
+ ephemeral?: boolean;
7560
+ /**
7561
+ * Unique event identifier (UUID v4), generated when the event is emitted
7562
+ */
7563
+ id: string;
7564
+ /**
7565
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
7566
+ */
7567
+ parentId: string | null;
7568
+ /**
7569
+ * ISO 8601 timestamp when the event was created
7570
+ */
7571
+ timestamp: string;
7572
+ /**
7573
+ * Type discriminator. Always "session.canvas.removed".
7574
+ */
7575
+ type: "session.canvas.removed";
7576
+ }
7577
+ /**
7578
+ * Durable record that a canvas instance was closed, superseding a prior instance_recorded during resume replay.
7579
+ */
7580
+ /** @experimental */
7581
+ export interface CanvasRemovedData {
7582
+ /**
7583
+ * Provider-local canvas identifier
7584
+ */
7585
+ canvasId: string;
7586
+ /**
7587
+ * Owning provider identifier
7588
+ */
7589
+ extensionId: string;
7590
+ /**
7591
+ * Stable caller-supplied identifier of the canvas instance that was closed
7592
+ */
7593
+ instanceId: string;
7594
+ }
7338
7595
  /**
7339
7596
  * Session event "session.extensions.attachments_pushed".
7340
7597
  */
package/dist/index.d.ts CHANGED
@@ -8,6 +8,6 @@ export { RuntimeConnection } from "./types.js";
8
8
  export { BuiltInTools, ToolSet } from "./toolSet.js";
9
9
  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
- export { defineTool, approveAll, convertMcpCallToolResult, createSessionFsAdapter, SYSTEM_MESSAGE_SECTIONS, } from "./types.js";
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, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, MessageOptions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, NamedProviderConfig, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, ProviderModelConfig, 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, 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, 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, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, GetBearerToken, 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/index.js CHANGED
@@ -12,6 +12,10 @@ import {
12
12
  approveAll,
13
13
  convertMcpCallToolResult,
14
14
  createSessionFsAdapter,
15
+ CopilotRequestHandler,
16
+ CopilotWebSocketHandler,
17
+ CopilotWebSocketCloseStatus,
18
+ CopilotWebSocketForwarder,
15
19
  SYSTEM_MESSAGE_SECTIONS
16
20
  } from "./types.js";
17
21
  export {
@@ -19,7 +23,11 @@ export {
19
23
  Canvas,
20
24
  CanvasError,
21
25
  CopilotClient,
26
+ CopilotRequestHandler,
22
27
  CopilotSession,
28
+ CopilotWebSocketCloseStatus,
29
+ CopilotWebSocketForwarder,
30
+ CopilotWebSocketHandler,
23
31
  RuntimeConnection,
24
32
  SYSTEM_MESSAGE_SECTIONS,
25
33
  ToolSet,
package/dist/session.d.ts CHANGED
@@ -38,6 +38,7 @@ export declare class CopilotSession {
38
38
  private typedEventHandlers;
39
39
  private toolHandlers;
40
40
  private canvases;
41
+ private bearerTokenProviders;
41
42
  private commandHandlers;
42
43
  private permissionHandler?;
43
44
  private userInputHandler?;
@@ -50,6 +51,7 @@ export declare class CopilotSession {
50
51
  private traceContextProvider?;
51
52
  private _capabilities;
52
53
  private openCanvasInstances;
54
+ private disconnected;
53
55
  /**
54
56
  * Typed session-scoped RPC methods.
55
57
  */