@github/copilot-sdk 1.0.5-preview.1 → 1.0.6-preview.0

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.
@@ -280,7 +280,8 @@ class CopilotClient {
280
280
  /** Connection-level session filesystem config, set via constructor option. */
281
281
  sessionFsConfig = null;
282
282
  requestHandler = null;
283
- llmInferenceHandlers = {};
283
+ onGitHubTelemetry;
284
+ clientGlobalHandlers = {};
284
285
  /**
285
286
  * Typed server-scoped RPC methods.
286
287
  * @throws Error if the client is not connected
@@ -381,7 +382,8 @@ class CopilotClient {
381
382
  this.onGetTraceContext = options.onGetTraceContext;
382
383
  this.sessionFsConfig = options.sessionFs ?? null;
383
384
  this.requestHandler = options.requestHandler ?? null;
384
- this.setupLlmInference();
385
+ this.onGitHubTelemetry = options.onGitHubTelemetry;
386
+ this.setupClientGlobalHandlers();
385
387
  const effectiveEnv = options.env ?? process.env;
386
388
  this.resolvedEnv = effectiveEnv;
387
389
  this.resolvedCliPath = conn.kind === "stdio" || conn.kind === "tcp" ? conn.path ?? effectiveEnv.COPILOT_CLI_PATH ?? getBundledCliPath() : void 0;
@@ -461,19 +463,29 @@ class CopilotClient {
461
463
  }
462
464
  session.clientSessionApis.sessionFs = (0, import_sessionFsProvider.createSessionFsAdapter)(provider);
463
465
  }
464
- setupLlmInference() {
465
- if (!this.requestHandler) {
466
- return;
467
- }
468
- this.llmInferenceHandlers = {
469
- llmInference: (0, import_copilotRequestHandler.createCopilotRequestAdapter)(this.requestHandler, () => {
466
+ setupClientGlobalHandlers() {
467
+ const handlers = {};
468
+ if (this.requestHandler) {
469
+ handlers.llmInference = (0, import_copilotRequestHandler.createCopilotRequestAdapter)(this.requestHandler, () => {
470
470
  if (!this.connection) {
471
471
  return void 0;
472
472
  }
473
473
  this._rpc ??= (0, import_rpc.createServerRpc)(this.connection);
474
474
  return this._rpc;
475
- })
476
- };
475
+ });
476
+ }
477
+ if (this.onGitHubTelemetry) {
478
+ const onGitHubTelemetry = this.onGitHubTelemetry;
479
+ handlers.gitHubTelemetry = {
480
+ event: async (notification) => {
481
+ try {
482
+ await onGitHubTelemetry(notification);
483
+ } catch {
484
+ }
485
+ }
486
+ };
487
+ }
488
+ this.clientGlobalHandlers = handlers;
477
489
  }
478
490
  /**
479
491
  * Starts the CLI server and establishes a connection.
@@ -997,11 +1009,14 @@ class CopilotClient {
997
1009
  availableTools: toolFilterOptions.availableTools,
998
1010
  excludedTools: toolFilterOptions.excludedTools,
999
1011
  toolFilterPrecedence: toolFilterOptions.toolFilterPrecedence,
1012
+ excludedBuiltinAgents: config.excludedBuiltinAgents,
1000
1013
  provider: bearerWireProvider,
1001
1014
  capi: config.capi,
1002
1015
  providers: bearerWireProviders,
1003
1016
  models: config.models,
1004
1017
  enableSessionTelemetry: config.enableSessionTelemetry,
1018
+ enableCitations: config.enableCitations,
1019
+ sessionLimits: config.sessionLimits,
1005
1020
  modelCapabilities: config.modelCapabilities,
1006
1021
  largeOutput: toWireLargeOutput(config.largeOutput),
1007
1022
  requestPermission: !!config.onPermissionRequest,
@@ -1014,6 +1029,7 @@ class CopilotClient {
1014
1029
  workingDirectory: config.workingDirectory,
1015
1030
  streaming: config.streaming,
1016
1031
  includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
1032
+ ...this.onGitHubTelemetry != null ? { enableGitHubTelemetryForwarding: true } : {},
1017
1033
  mcpServers: toWireMcpServers(config.mcpServers),
1018
1034
  mcpOAuthTokenStorage: config.mcpOAuthTokenStorage,
1019
1035
  envValueMode: "direct",
@@ -1150,12 +1166,6 @@ class CopilotClient {
1150
1166
  }
1151
1167
  this.sessions.set(sessionId, session);
1152
1168
  this.setupSessionFs(session, config);
1153
- if (config.onMcpAuthRequest) {
1154
- await this.connection.sendRequest("session.eventLog.registerInterest", {
1155
- sessionId,
1156
- eventType: "mcp.oauth_required"
1157
- });
1158
- }
1159
1169
  const toolFilterOptions = this.resolveToolFilterOptions(config);
1160
1170
  try {
1161
1171
  const response = await this.connection.sendRequest("session.resume", {
@@ -1171,6 +1181,9 @@ class CopilotClient {
1171
1181
  excludedTools: toolFilterOptions.excludedTools,
1172
1182
  toolFilterPrecedence: toolFilterOptions.toolFilterPrecedence,
1173
1183
  enableSessionTelemetry: config.enableSessionTelemetry,
1184
+ excludedBuiltinAgents: config.excludedBuiltinAgents,
1185
+ enableCitations: config.enableCitations,
1186
+ sessionLimits: config.sessionLimits,
1174
1187
  tools: config.tools?.map((tool) => ({
1175
1188
  name: tool.name,
1176
1189
  description: tool.description,
@@ -1214,6 +1227,7 @@ class CopilotClient {
1214
1227
  enableSkills: config.enableSkills,
1215
1228
  streaming: config.streaming,
1216
1229
  includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
1230
+ ...this.onGitHubTelemetry != null ? { enableGitHubTelemetryForwarding: true } : {},
1217
1231
  mcpServers: toWireMcpServers(config.mcpServers),
1218
1232
  mcpOAuthTokenStorage: config.mcpOAuthTokenStorage,
1219
1233
  envValueMode: "direct",
@@ -1237,6 +1251,12 @@ class CopilotClient {
1237
1251
  session["_workspacePath"] = workspacePath;
1238
1252
  session.setCapabilities(capabilities);
1239
1253
  session.setOpenCanvases(openCanvases ?? []);
1254
+ if (config.onMcpAuthRequest) {
1255
+ await this.connection.sendRequest("session.eventLog.registerInterest", {
1256
+ sessionId,
1257
+ eventType: "mcp.oauth_required"
1258
+ });
1259
+ }
1240
1260
  await this.updateSessionOptionsForMode(session, config);
1241
1261
  } catch (e) {
1242
1262
  this.sessions.delete(sessionId);
@@ -1873,7 +1893,7 @@ stderr: ${stderrOutput}`
1873
1893
  if (!session) throw new Error(`No session found for sessionId: ${sessionId}`);
1874
1894
  return session.clientSessionApis;
1875
1895
  });
1876
- (0, import_rpc.registerClientGlobalApiHandlers)(this.connection, this.llmInferenceHandlers);
1896
+ (0, import_rpc.registerClientGlobalApiHandlers)(this.connection, this.clientGlobalHandlers);
1877
1897
  this.connection.onClose(() => {
1878
1898
  this.state = "disconnected";
1879
1899
  });
@@ -901,6 +901,23 @@ function createSessionRpc(connection, sessionId) {
901
901
  diff: async (params) => connection.sendRequest("session.workspaces.diff", { sessionId, ...params })
902
902
  },
903
903
  /** @experimental */
904
+ completions: {
905
+ /**
906
+ * Gets the characters that should trigger host-driven completions for the session. Empty disables host-driven completions (e.g. local sessions, or a relay host that does not advertise them).
907
+ *
908
+ * @returns Characters that, when typed in the composer, should trigger a `completions.request`. Empty when the session has no host-driven completions (e.g. local sessions, or a relay host that does not advertise `completionTriggerCharacters`).
909
+ */
910
+ getTriggerCharacters: async () => connection.sendRequest("session.completions.getTriggerCharacters", { sessionId }),
911
+ /**
912
+ * Requests host-driven completion items for the current composer input. Returns an empty list when the host has no items or does not support completions.
913
+ *
914
+ * @param params Request host-driven completions for the current composer input.
915
+ *
916
+ * @returns Host-driven completion items for the current composer input. Empty when the host returns no items or does not support completions.
917
+ */
918
+ request: async (params) => connection.sendRequest("session.completions.request", { sessionId, ...params })
919
+ },
920
+ /** @experimental */
904
921
  instructions: {
905
922
  /**
906
923
  * Gets instruction sources loaded for the session.
@@ -1457,6 +1474,14 @@ function createSessionRpc(connection, sessionId) {
1457
1474
  * @returns Indicates whether the pending UI request was resolved by this call.
1458
1475
  */
1459
1476
  handlePendingAutoModeSwitch: async (params) => connection.sendRequest("session.ui.handlePendingAutoModeSwitch", { sessionId, ...params }),
1477
+ /**
1478
+ * Resolves a pending `session_limits_exhausted.requested` event with the user's selected limit action.
1479
+ *
1480
+ * @param params Request ID of a pending `session_limits_exhausted.requested` event and the user's selected limit action.
1481
+ *
1482
+ * @returns Indicates whether the pending UI request was resolved by this call.
1483
+ */
1484
+ handlePendingSessionLimitsExhausted: async (params) => connection.sendRequest("session.ui.handlePendingSessionLimitsExhausted", { sessionId, ...params }),
1460
1485
  /**
1461
1486
  * Resolves a pending `exit_plan_mode.requested` event with the user's response.
1462
1487
  *
@@ -2061,6 +2086,11 @@ function registerClientGlobalApiHandlers(connection, handlers) {
2061
2086
  if (!handler) throw new Error("No llmInference client-global handler registered");
2062
2087
  return handler.httpRequestChunk(params);
2063
2088
  });
2089
+ connection.onNotification("gitHubTelemetry.event", async (params) => {
2090
+ const handler = handlers.gitHubTelemetry;
2091
+ if (!handler) return;
2092
+ await handler.event(params);
2093
+ });
2064
2094
  }
2065
2095
  // Annotate the CommonJS export names for ESM import in node:
2066
2096
  0 && (module.exports = {
package/dist/client.d.ts CHANGED
@@ -36,7 +36,8 @@ export declare class CopilotClient {
36
36
  /** Connection-level session filesystem config, set via constructor option. */
37
37
  private sessionFsConfig;
38
38
  private requestHandler;
39
- private llmInferenceHandlers;
39
+ private onGitHubTelemetry?;
40
+ private clientGlobalHandlers;
40
41
  /**
41
42
  * Typed server-scoped RPC methods.
42
43
  * @throws Error if the client is not connected
@@ -80,7 +81,7 @@ export declare class CopilotClient {
80
81
  private parseCliUrl;
81
82
  private validateSessionFsConfig;
82
83
  private setupSessionFs;
83
- private setupLlmInference;
84
+ private setupClientGlobalHandlers;
84
85
  /**
85
86
  * Starts the CLI server and establishes a connection.
86
87
  *
package/dist/client.js CHANGED
@@ -267,7 +267,8 @@ class CopilotClient {
267
267
  /** Connection-level session filesystem config, set via constructor option. */
268
268
  sessionFsConfig = null;
269
269
  requestHandler = null;
270
- llmInferenceHandlers = {};
270
+ onGitHubTelemetry;
271
+ clientGlobalHandlers = {};
271
272
  /**
272
273
  * Typed server-scoped RPC methods.
273
274
  * @throws Error if the client is not connected
@@ -368,7 +369,8 @@ class CopilotClient {
368
369
  this.onGetTraceContext = options.onGetTraceContext;
369
370
  this.sessionFsConfig = options.sessionFs ?? null;
370
371
  this.requestHandler = options.requestHandler ?? null;
371
- this.setupLlmInference();
372
+ this.onGitHubTelemetry = options.onGitHubTelemetry;
373
+ this.setupClientGlobalHandlers();
372
374
  const effectiveEnv = options.env ?? process.env;
373
375
  this.resolvedEnv = effectiveEnv;
374
376
  this.resolvedCliPath = conn.kind === "stdio" || conn.kind === "tcp" ? conn.path ?? effectiveEnv.COPILOT_CLI_PATH ?? getBundledCliPath() : void 0;
@@ -448,19 +450,29 @@ class CopilotClient {
448
450
  }
449
451
  session.clientSessionApis.sessionFs = createSessionFsAdapter(provider);
450
452
  }
451
- setupLlmInference() {
452
- if (!this.requestHandler) {
453
- return;
454
- }
455
- this.llmInferenceHandlers = {
456
- llmInference: createCopilotRequestAdapter(this.requestHandler, () => {
453
+ setupClientGlobalHandlers() {
454
+ const handlers = {};
455
+ if (this.requestHandler) {
456
+ handlers.llmInference = createCopilotRequestAdapter(this.requestHandler, () => {
457
457
  if (!this.connection) {
458
458
  return void 0;
459
459
  }
460
460
  this._rpc ??= createServerRpc(this.connection);
461
461
  return this._rpc;
462
- })
463
- };
462
+ });
463
+ }
464
+ if (this.onGitHubTelemetry) {
465
+ const onGitHubTelemetry = this.onGitHubTelemetry;
466
+ handlers.gitHubTelemetry = {
467
+ event: async (notification) => {
468
+ try {
469
+ await onGitHubTelemetry(notification);
470
+ } catch {
471
+ }
472
+ }
473
+ };
474
+ }
475
+ this.clientGlobalHandlers = handlers;
464
476
  }
465
477
  /**
466
478
  * Starts the CLI server and establishes a connection.
@@ -984,11 +996,14 @@ class CopilotClient {
984
996
  availableTools: toolFilterOptions.availableTools,
985
997
  excludedTools: toolFilterOptions.excludedTools,
986
998
  toolFilterPrecedence: toolFilterOptions.toolFilterPrecedence,
999
+ excludedBuiltinAgents: config.excludedBuiltinAgents,
987
1000
  provider: bearerWireProvider,
988
1001
  capi: config.capi,
989
1002
  providers: bearerWireProviders,
990
1003
  models: config.models,
991
1004
  enableSessionTelemetry: config.enableSessionTelemetry,
1005
+ enableCitations: config.enableCitations,
1006
+ sessionLimits: config.sessionLimits,
992
1007
  modelCapabilities: config.modelCapabilities,
993
1008
  largeOutput: toWireLargeOutput(config.largeOutput),
994
1009
  requestPermission: !!config.onPermissionRequest,
@@ -1001,6 +1016,7 @@ class CopilotClient {
1001
1016
  workingDirectory: config.workingDirectory,
1002
1017
  streaming: config.streaming,
1003
1018
  includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
1019
+ ...this.onGitHubTelemetry != null ? { enableGitHubTelemetryForwarding: true } : {},
1004
1020
  mcpServers: toWireMcpServers(config.mcpServers),
1005
1021
  mcpOAuthTokenStorage: config.mcpOAuthTokenStorage,
1006
1022
  envValueMode: "direct",
@@ -1137,12 +1153,6 @@ class CopilotClient {
1137
1153
  }
1138
1154
  this.sessions.set(sessionId, session);
1139
1155
  this.setupSessionFs(session, config);
1140
- if (config.onMcpAuthRequest) {
1141
- await this.connection.sendRequest("session.eventLog.registerInterest", {
1142
- sessionId,
1143
- eventType: "mcp.oauth_required"
1144
- });
1145
- }
1146
1156
  const toolFilterOptions = this.resolveToolFilterOptions(config);
1147
1157
  try {
1148
1158
  const response = await this.connection.sendRequest("session.resume", {
@@ -1158,6 +1168,9 @@ class CopilotClient {
1158
1168
  excludedTools: toolFilterOptions.excludedTools,
1159
1169
  toolFilterPrecedence: toolFilterOptions.toolFilterPrecedence,
1160
1170
  enableSessionTelemetry: config.enableSessionTelemetry,
1171
+ excludedBuiltinAgents: config.excludedBuiltinAgents,
1172
+ enableCitations: config.enableCitations,
1173
+ sessionLimits: config.sessionLimits,
1161
1174
  tools: config.tools?.map((tool) => ({
1162
1175
  name: tool.name,
1163
1176
  description: tool.description,
@@ -1201,6 +1214,7 @@ class CopilotClient {
1201
1214
  enableSkills: config.enableSkills,
1202
1215
  streaming: config.streaming,
1203
1216
  includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
1217
+ ...this.onGitHubTelemetry != null ? { enableGitHubTelemetryForwarding: true } : {},
1204
1218
  mcpServers: toWireMcpServers(config.mcpServers),
1205
1219
  mcpOAuthTokenStorage: config.mcpOAuthTokenStorage,
1206
1220
  envValueMode: "direct",
@@ -1224,6 +1238,12 @@ class CopilotClient {
1224
1238
  session["_workspacePath"] = workspacePath;
1225
1239
  session.setCapabilities(capabilities);
1226
1240
  session.setOpenCanvases(openCanvases ?? []);
1241
+ if (config.onMcpAuthRequest) {
1242
+ await this.connection.sendRequest("session.eventLog.registerInterest", {
1243
+ sessionId,
1244
+ eventType: "mcp.oauth_required"
1245
+ });
1246
+ }
1227
1247
  await this.updateSessionOptionsForMode(session, config);
1228
1248
  } catch (e) {
1229
1249
  this.sessions.delete(sessionId);
@@ -1860,7 +1880,7 @@ stderr: ${stderrOutput}`
1860
1880
  if (!session) throw new Error(`No session found for sessionId: ${sessionId}`);
1861
1881
  return session.clientSessionApis;
1862
1882
  });
1863
- registerClientGlobalApiHandlers(this.connection, this.llmInferenceHandlers);
1883
+ registerClientGlobalApiHandlers(this.connection, this.clientGlobalHandlers);
1864
1884
  this.connection.onClose(() => {
1865
1885
  this.state = "disconnected";
1866
1886
  });
@@ -3,7 +3,7 @@
3
3
  * Generated from: api.schema.json
4
4
  */
5
5
  import type { MessageConnection } from "vscode-jsonrpc/node.js";
6
- import type { AbortReason, Attachment, ContextTier, EmbeddedBlobResourceContents, EmbeddedTextResourceContents, McpServerSource, McpServerStatus, PermissionPromptRequest, PermissionRule, ReasoningSummary, ResponseLimitsConfig, SessionEvent, SessionMode, ShutdownType, SkillSource, UserToolSessionApproval } from "./session-events.js";
6
+ import type { AbortReason, Attachment, ContextTier, EmbeddedBlobResourceContents, EmbeddedTextResourceContents, McpServerSource, McpServerStatus, PermissionPromptRequest, PermissionRule, ReasoningSummary, SessionEvent, SessionLimitsConfig, SessionMode, ShutdownType, SkillSource, UserToolSessionApproval } from "./session-events.js";
7
7
  /**
8
8
  * Initial authentication info for the session.
9
9
  *
@@ -12,6 +12,20 @@ import type { AbortReason, Attachment, ContextTier, EmbeddedBlobResourceContents
12
12
  */
13
13
  /** @experimental */
14
14
  export type AuthInfo = HMACAuthInfo | EnvAuthInfo | TokenAuthInfo | CopilotApiTokenAuthInfo | UserAuthInfo | GhCliAuthInfo | ApiKeyAuthInfo;
15
+ /**
16
+ * Resolved Anthropic adaptive-thinking capability for a model.
17
+ *
18
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
19
+ * via the `definition` "AdaptiveThinkingSupport".
20
+ */
21
+ /** @experimental */
22
+ export type AdaptiveThinkingSupport =
23
+ /** The model does not accept thinking.type='adaptive' */
24
+ "unsupported"
25
+ /** The model accepts adaptive thinking but also accepts thinking.type='enabled' */
26
+ | "optional"
27
+ /** The model only accepts adaptive thinking and rejects thinking.type='enabled' with HTTP 400 (e.g. opus-4.7/4.8) */
28
+ | "required";
15
29
  /**
16
30
  * Which tier this directory belongs to
17
31
  *
@@ -1720,6 +1734,22 @@ export type UIExitPlanModeAction =
1720
1734
  | "autopilot"
1721
1735
  /** Exit plan mode and continue in autopilot mode with parallel subagent execution. */
1722
1736
  | "autopilot_fleet";
1737
+ /**
1738
+ * User action selected for an exhausted session limit.
1739
+ *
1740
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
1741
+ * via the `definition` "UISessionLimitsExhaustedResponseAction".
1742
+ */
1743
+ /** @experimental */
1744
+ export type UISessionLimitsExhaustedResponseAction =
1745
+ /** Increase the current max by an exact AI Credits amount. */
1746
+ "add"
1747
+ /** Set a new absolute max AI Credits value. */
1748
+ | "set"
1749
+ /** Remove the current session limit. */
1750
+ | "unset"
1751
+ /** Leave the limit unchanged and cancel the blocked model request. */
1752
+ | "cancel";
1723
1753
  /**
1724
1754
  * Type of change represented by this file diff.
1725
1755
  *
@@ -1871,6 +1901,7 @@ export interface CopilotUserResponse {
1871
1901
  quota_snapshots?: CopilotUserResponseQuotaSnapshots;
1872
1902
  restricted_telemetry?: boolean;
1873
1903
  is_staff?: boolean;
1904
+ te?: boolean;
1874
1905
  token_based_billing?: boolean;
1875
1906
  can_upgrade_plan?: boolean;
1876
1907
  quota_reset_date_utc?: string;
@@ -3252,6 +3283,78 @@ export interface CommandsRespondToQueuedCommandResult {
3252
3283
  */
3253
3284
  success: boolean;
3254
3285
  }
3286
+ /**
3287
+ * Characters that, when typed in the composer, should trigger a `completions.request`. Empty when the session has no host-driven completions (e.g. local sessions, or a relay host that does not advertise `completionTriggerCharacters`).
3288
+ *
3289
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
3290
+ * via the `definition` "CompletionsGetTriggerCharactersResult".
3291
+ */
3292
+ /** @experimental */
3293
+ export interface CompletionsGetTriggerCharactersResult {
3294
+ /**
3295
+ * Trigger characters advertised by the host (e.g. `["@", "#"]`). Empty disables host-driven completions for the session.
3296
+ */
3297
+ triggerCharacters: string[];
3298
+ }
3299
+ /**
3300
+ * Request host-driven completions for the current composer input.
3301
+ *
3302
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
3303
+ * via the `definition` "CompletionsRequestRequest".
3304
+ */
3305
+ /** @experimental */
3306
+ export interface CompletionsRequestRequest {
3307
+ /**
3308
+ * The full composed composer input.
3309
+ */
3310
+ text: string;
3311
+ /**
3312
+ * Cursor offset within `text`, in UTF-16 code units.
3313
+ */
3314
+ offset: number;
3315
+ }
3316
+ /**
3317
+ * Host-driven completion items for the current composer input. Empty when the host returns no items or does not support completions.
3318
+ *
3319
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
3320
+ * via the `definition` "CompletionsRequestResult".
3321
+ */
3322
+ /** @experimental */
3323
+ export interface CompletionsRequestResult {
3324
+ /**
3325
+ * Completion items in host-ranked order.
3326
+ */
3327
+ items: SessionCompletionItem[];
3328
+ }
3329
+ /**
3330
+ * A single host-driven completion. Accepting an item replaces `[rangeStart, rangeEnd)` (UTF-16 code units) in the composer with `insertText`; when the range is absent, the active token around the cursor is replaced.
3331
+ *
3332
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
3333
+ * via the `definition` "SessionCompletionItem".
3334
+ */
3335
+ /** @experimental */
3336
+ export interface SessionCompletionItem {
3337
+ /**
3338
+ * Text spliced into the composer when the item is accepted.
3339
+ */
3340
+ insertText: string;
3341
+ /**
3342
+ * Start of the replacement range in `text`, in UTF-16 code units.
3343
+ */
3344
+ rangeStart?: number;
3345
+ /**
3346
+ * End (exclusive) of the replacement range in `text`, in UTF-16 code units.
3347
+ */
3348
+ rangeEnd?: number;
3349
+ /**
3350
+ * Primary display label for the picker row. Falls back to `insertText` when absent.
3351
+ */
3352
+ label?: string;
3353
+ /**
3354
+ * Render-kind hint for the picker row (e.g. `"document"`, `"directory"`), derived from the host's display kind.
3355
+ */
3356
+ kind?: string;
3357
+ }
3255
3358
  /**
3256
3359
  * Metadata for a connected remote session.
3257
3360
  *
@@ -3955,6 +4058,125 @@ export interface FolderTrustCheckResult {
3955
4058
  */
3956
4059
  trusted: boolean;
3957
4060
  }
4061
+ /**
4062
+ * Client environment metadata describing the process that produced a telemetry event.
4063
+ *
4064
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4065
+ * via the `definition` "GitHubTelemetryClientInfo".
4066
+ */
4067
+ /** @experimental */
4068
+ export interface GitHubTelemetryClientInfo {
4069
+ /**
4070
+ * Copilot CLI version string.
4071
+ */
4072
+ cli_version: string;
4073
+ /**
4074
+ * Operating system platform (e.g. darwin, linux, win32).
4075
+ */
4076
+ os_platform: string;
4077
+ /**
4078
+ * Operating system version string.
4079
+ */
4080
+ os_version: string;
4081
+ /**
4082
+ * Operating system architecture (e.g. arm64, x64).
4083
+ */
4084
+ os_arch: string;
4085
+ /**
4086
+ * Node.js runtime version string.
4087
+ */
4088
+ node_version: string;
4089
+ /**
4090
+ * Copilot subscription plan, when known.
4091
+ */
4092
+ copilot_plan?: string;
4093
+ /**
4094
+ * Type of client.
4095
+ */
4096
+ client_type?: string;
4097
+ /**
4098
+ * Name of the client application.
4099
+ */
4100
+ client_name?: string;
4101
+ /**
4102
+ * Whether the user is a GitHub/Microsoft staff member.
4103
+ */
4104
+ is_staff?: boolean;
4105
+ /**
4106
+ * Stable machine identifier for the device.
4107
+ */
4108
+ dev_device_id?: string;
4109
+ }
4110
+ /**
4111
+ * A single telemetry event in the runtime's native GitHub-shaped telemetry format, forwarded verbatim to opted-in hosts. The `restricted` flag on the enclosing GitHubTelemetryNotification distinguishes standard from restricted events; the payload shape is identical for both.
4112
+ *
4113
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4114
+ * via the `definition` "GitHubTelemetryEvent".
4115
+ */
4116
+ /** @experimental */
4117
+ export interface GitHubTelemetryEvent {
4118
+ /**
4119
+ * Event type/kind (e.g. get_completion_with_tools_turn, tool_call_executed).
4120
+ */
4121
+ kind: string;
4122
+ /**
4123
+ * Timestamp when the event was created (ISO 8601 format).
4124
+ */
4125
+ created_at?: string;
4126
+ /**
4127
+ * Reference to the model call that produced this event.
4128
+ */
4129
+ model_call_id?: string;
4130
+ /**
4131
+ * String-valued properties as a map from key to value.
4132
+ */
4133
+ properties: {
4134
+ [k: string]: string | undefined;
4135
+ };
4136
+ /**
4137
+ * Numeric metrics as a map from key to value.
4138
+ */
4139
+ metrics: {
4140
+ [k: string]: number | undefined;
4141
+ };
4142
+ /**
4143
+ * Experiment assignment context.
4144
+ */
4145
+ exp_assignment_context?: string;
4146
+ /**
4147
+ * Feature flags enabled for this session, as a map from flag to value.
4148
+ */
4149
+ features?: {
4150
+ [k: string]: string | undefined;
4151
+ };
4152
+ /**
4153
+ * Session identifier the event belongs to.
4154
+ */
4155
+ session_id?: string;
4156
+ /**
4157
+ * Copilot tracking ID for user-level attribution.
4158
+ */
4159
+ copilot_tracking_id?: string;
4160
+ client?: GitHubTelemetryClientInfo;
4161
+ }
4162
+ /**
4163
+ * Payload for a `gitHubTelemetry.event` notification: a single GitHub telemetry event the runtime forwards to a host connection that opted into telemetry forwarding for the session.
4164
+ *
4165
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4166
+ * via the `definition` "GitHubTelemetryNotification".
4167
+ */
4168
+ /** @experimental */
4169
+ export interface GitHubTelemetryNotification {
4170
+ /**
4171
+ * Session the telemetry event belongs to.
4172
+ */
4173
+ sessionId: string;
4174
+ /**
4175
+ * Whether this is a restricted telemetry event (cli.restricted_telemetry). Hosts must route restricted events to first-party Microsoft stores only.
4176
+ */
4177
+ restricted: boolean;
4178
+ event: GitHubTelemetryEvent;
4179
+ }
3958
4180
  /**
3959
4181
  * Pending external tool call request ID, with the tool result or an error describing why it failed.
3960
4182
  *
@@ -6089,6 +6311,7 @@ export interface ModelCapabilitiesSupports {
6089
6311
  * Whether this model supports reasoning effort configuration
6090
6312
  */
6091
6313
  reasoningEffort?: boolean;
6314
+ adaptive_thinking?: AdaptiveThinkingSupport;
6092
6315
  }
6093
6316
  /**
6094
6317
  * Token limits for prompts, outputs, and context window
@@ -6275,6 +6498,7 @@ export interface ModelCapabilitiesOverrideSupports {
6275
6498
  * Whether this model supports reasoning effort configuration
6276
6499
  */
6277
6500
  reasoningEffort?: boolean;
6501
+ adaptive_thinking?: AdaptiveThinkingSupport;
6278
6502
  }
6279
6503
  /**
6280
6504
  * Token limits for prompts, outputs, and context window
@@ -9063,7 +9287,7 @@ export interface QueueRemoveMostRecentResult {
9063
9287
  /** @experimental */
9064
9288
  export interface RegisterEventInterestParams {
9065
9289
  /**
9066
- * The event type the consumer wants the runtime to treat as 'observed' for behavior-switching gating. Some runtime code paths inspect whether any consumer is interested in a specific event type and choose a different implementation accordingly (e.g. `mcp.oauth_required`: when interest is registered the runtime delegates the full interactive OAuth flow to the consumer; when no interest is registered the runtime installs a browserless fallback that silently reuses cached tokens). SDK clients that long-poll events do NOT automatically appear as listeners to these gating checks — they must explicitly call `registerInterest` for each event type they want the runtime to count as having a consumer. Multiple registrations for the same event type from the same or different consumers are tracked independently and must each be released. See: `mcp.oauth_required`, `sampling.requested`, `auto_mode_switch.requested`, `user_input.requested`, `elicitation.requested`, `command.queued`, `exit_plan_mode.requested`.
9290
+ * The event type the consumer wants the runtime to treat as 'observed' for behavior-switching gating. Some runtime code paths inspect whether any consumer is interested in a specific event type and choose a different implementation accordingly (e.g. `mcp.oauth_required`: when interest is registered the runtime delegates the full interactive OAuth flow to the consumer; when no interest is registered the runtime installs a browserless fallback that silently reuses cached tokens). SDK clients that long-poll events do NOT automatically appear as listeners to these gating checks — they must explicitly call `registerInterest` for each event type they want the runtime to count as having a consumer. Multiple registrations for the same event type from the same or different consumers are tracked independently and must each be released. See: `mcp.oauth_required`, `sampling.requested`, `auto_mode_switch.requested`, `session_limits_exhausted.requested`, `user_input.requested`, `elicitation.requested`, `command.queued`, `exit_plan_mode.requested`.
9067
9291
  */
9068
9292
  eventType: string;
9069
9293
  }
@@ -10506,9 +10730,9 @@ export interface SessionMetadataSnapshot {
10506
10730
  */
10507
10731
  selectedModel?: string;
10508
10732
  /**
10509
- * Current response limits for the session, or null when no limits are active
10733
+ * Current session limits, or null when no limits are active
10510
10734
  */
10511
- responseLimits: ResponseLimitsConfig | null;
10735
+ sessionLimits: SessionLimitsConfig | null;
10512
10736
  /**
10513
10737
  * Public-facing workspace metadata for this session, or null if the session has no associated workspace. Excludes runtime-internal fields (GitHub IDs, summary count, internal flags).
10514
10738
  */
@@ -10632,6 +10856,10 @@ export interface SessionOpenOptions {
10632
10856
  * Denylist of tool names.
10633
10857
  */
10634
10858
  excludedTools?: string[];
10859
+ /**
10860
+ * Built-in subagent names to exclude from this session. Excluded built-ins are hidden from agent discovery and cannot be dispatched unless a custom agent with the same name is available.
10861
+ */
10862
+ excludedBuiltinAgents?: string[];
10635
10863
  /**
10636
10864
  * Whether shell-script safety heuristics are enabled.
10637
10865
  */
@@ -10721,7 +10949,7 @@ export interface SessionOpenOptions {
10721
10949
  */
10722
10950
  maxInlineBinaryBytes?: number;
10723
10951
  modelCapabilitiesOverrides?: ModelCapabilitiesOverride;
10724
- responseLimits?: ResponseLimitsConfig;
10952
+ sessionLimits?: SessionLimitsConfig;
10725
10953
  /**
10726
10954
  * Runtime context discriminator for agent filtering.
10727
10955
  */
@@ -11580,6 +11808,10 @@ export interface SessionUpdateOptionsParams {
11580
11808
  * Denylist of tool names for this session.
11581
11809
  */
11582
11810
  excludedTools?: string[];
11811
+ /**
11812
+ * Built-in subagent names to exclude from this session. Excluded built-ins are hidden from agent discovery and cannot be dispatched unless a custom agent with the same name is available.
11813
+ */
11814
+ excludedBuiltinAgents?: string[];
11583
11815
  toolFilterPrecedence?: OptionsUpdateToolFilterPrecedence;
11584
11816
  /**
11585
11817
  * Whether shell-script safety heuristics are enabled.
@@ -11719,9 +11951,9 @@ export interface SessionUpdateOptionsParams {
11719
11951
  enableSkills?: boolean;
11720
11952
  contextTier?: OptionsUpdateContextTier;
11721
11953
  /**
11722
- * Optional response limits. Pass null to clear the response limits.
11954
+ * Optional session limits. Pass null to clear the session limits.
11723
11955
  */
11724
- responseLimits?: ResponseLimitsConfig | null;
11956
+ sessionLimits?: SessionLimitsConfig | null;
11725
11957
  }
11726
11958
  /**
11727
11959
  * Indicates whether the session options patch was applied successfully.
@@ -13212,6 +13444,38 @@ export interface UIHandlePendingSamplingRequest {
13212
13444
  export interface UIHandlePendingSamplingResponse {
13213
13445
  [k: string]: unknown | undefined;
13214
13446
  }
13447
+ /**
13448
+ * Request ID of a pending `session_limits_exhausted.requested` event and the user's selected limit action.
13449
+ *
13450
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
13451
+ * via the `definition` "UIHandlePendingSessionLimitsExhaustedRequest".
13452
+ */
13453
+ /** @experimental */
13454
+ export interface UIHandlePendingSessionLimitsExhaustedRequest {
13455
+ /**
13456
+ * The unique request ID from the session_limits_exhausted.requested event
13457
+ */
13458
+ requestId: string;
13459
+ response: UISessionLimitsExhaustedResponse;
13460
+ }
13461
+ /**
13462
+ * The user's selected action for an exhausted session limit.
13463
+ *
13464
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
13465
+ * via the `definition` "UISessionLimitsExhaustedResponse".
13466
+ */
13467
+ /** @experimental */
13468
+ export interface UISessionLimitsExhaustedResponse {
13469
+ action: UISessionLimitsExhaustedResponseAction;
13470
+ /**
13471
+ * AI Credits to add to the current max when action is 'add'.
13472
+ */
13473
+ additionalAiCredits?: number;
13474
+ /**
13475
+ * New absolute max AI Credits when action is 'set'.
13476
+ */
13477
+ maxAiCredits?: number;
13478
+ }
13215
13479
  /**
13216
13480
  * Request ID of a pending `user_input.requested` event and the user's response.
13217
13481
  *
@@ -14697,6 +14961,23 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
14697
14961
  diff: (params: WorkspacesDiffRequest) => Promise<WorkspaceDiffResult>;
14698
14962
  };
14699
14963
  /** @experimental */
14964
+ completions: {
14965
+ /**
14966
+ * Gets the characters that should trigger host-driven completions for the session. Empty disables host-driven completions (e.g. local sessions, or a relay host that does not advertise them).
14967
+ *
14968
+ * @returns Characters that, when typed in the composer, should trigger a `completions.request`. Empty when the session has no host-driven completions (e.g. local sessions, or a relay host that does not advertise `completionTriggerCharacters`).
14969
+ */
14970
+ getTriggerCharacters: () => Promise<CompletionsGetTriggerCharactersResult>;
14971
+ /**
14972
+ * Requests host-driven completion items for the current composer input. Returns an empty list when the host has no items or does not support completions.
14973
+ *
14974
+ * @param params Request host-driven completions for the current composer input.
14975
+ *
14976
+ * @returns Host-driven completion items for the current composer input. Empty when the host returns no items or does not support completions.
14977
+ */
14978
+ request: (params: CompletionsRequestRequest) => Promise<CompletionsRequestResult>;
14979
+ };
14980
+ /** @experimental */
14700
14981
  instructions: {
14701
14982
  /**
14702
14983
  * Gets instruction sources loaded for the session.
@@ -15253,6 +15534,14 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
15253
15534
  * @returns Indicates whether the pending UI request was resolved by this call.
15254
15535
  */
15255
15536
  handlePendingAutoModeSwitch: (params: UIHandlePendingAutoModeSwitchRequest) => Promise<UIHandlePendingResult>;
15537
+ /**
15538
+ * Resolves a pending `session_limits_exhausted.requested` event with the user's selected limit action.
15539
+ *
15540
+ * @param params Request ID of a pending `session_limits_exhausted.requested` event and the user's selected limit action.
15541
+ *
15542
+ * @returns Indicates whether the pending UI request was resolved by this call.
15543
+ */
15544
+ handlePendingSessionLimitsExhausted: (params: UIHandlePendingSessionLimitsExhaustedRequest) => Promise<UIHandlePendingResult>;
15256
15545
  /**
15257
15546
  * Resolves a pending `exit_plan_mode.requested` event with the user's response.
15258
15547
  *
@@ -15876,9 +16165,20 @@ export interface LlmInferenceHandler {
15876
16165
  */
15877
16166
  httpRequestChunk(params: LlmInferenceHttpRequestChunkRequest): Promise<LlmInferenceHttpRequestChunkResult>;
15878
16167
  }
16168
+ /** Handler for `gitHubTelemetry` client global API methods. */
16169
+ /** @experimental */
16170
+ export interface GitHubTelemetryHandler {
16171
+ /**
16172
+ * Forwards a single GitHub telemetry event to a host connection that opted into telemetry forwarding for the session.
16173
+ *
16174
+ * @param params Payload for a `gitHubTelemetry.event` notification: a single GitHub telemetry event the runtime forwards to a host connection that opted into telemetry forwarding for the session.
16175
+ */
16176
+ event(params: GitHubTelemetryNotification): Promise<void>;
16177
+ }
15879
16178
  /** All client global API handler groups. */
15880
16179
  export interface ClientGlobalApiHandlers {
15881
16180
  llmInference?: LlmInferenceHandler;
16181
+ gitHubTelemetry?: GitHubTelemetryHandler;
15882
16182
  }
15883
16183
  /**
15884
16184
  * Register client global API handlers on a JSON-RPC connection.
@@ -873,6 +873,23 @@ function createSessionRpc(connection, sessionId) {
873
873
  diff: async (params) => connection.sendRequest("session.workspaces.diff", { sessionId, ...params })
874
874
  },
875
875
  /** @experimental */
876
+ completions: {
877
+ /**
878
+ * Gets the characters that should trigger host-driven completions for the session. Empty disables host-driven completions (e.g. local sessions, or a relay host that does not advertise them).
879
+ *
880
+ * @returns Characters that, when typed in the composer, should trigger a `completions.request`. Empty when the session has no host-driven completions (e.g. local sessions, or a relay host that does not advertise `completionTriggerCharacters`).
881
+ */
882
+ getTriggerCharacters: async () => connection.sendRequest("session.completions.getTriggerCharacters", { sessionId }),
883
+ /**
884
+ * Requests host-driven completion items for the current composer input. Returns an empty list when the host has no items or does not support completions.
885
+ *
886
+ * @param params Request host-driven completions for the current composer input.
887
+ *
888
+ * @returns Host-driven completion items for the current composer input. Empty when the host returns no items or does not support completions.
889
+ */
890
+ request: async (params) => connection.sendRequest("session.completions.request", { sessionId, ...params })
891
+ },
892
+ /** @experimental */
876
893
  instructions: {
877
894
  /**
878
895
  * Gets instruction sources loaded for the session.
@@ -1429,6 +1446,14 @@ function createSessionRpc(connection, sessionId) {
1429
1446
  * @returns Indicates whether the pending UI request was resolved by this call.
1430
1447
  */
1431
1448
  handlePendingAutoModeSwitch: async (params) => connection.sendRequest("session.ui.handlePendingAutoModeSwitch", { sessionId, ...params }),
1449
+ /**
1450
+ * Resolves a pending `session_limits_exhausted.requested` event with the user's selected limit action.
1451
+ *
1452
+ * @param params Request ID of a pending `session_limits_exhausted.requested` event and the user's selected limit action.
1453
+ *
1454
+ * @returns Indicates whether the pending UI request was resolved by this call.
1455
+ */
1456
+ handlePendingSessionLimitsExhausted: async (params) => connection.sendRequest("session.ui.handlePendingSessionLimitsExhausted", { sessionId, ...params }),
1432
1457
  /**
1433
1458
  * Resolves a pending `exit_plan_mode.requested` event with the user's response.
1434
1459
  *
@@ -2033,6 +2058,11 @@ function registerClientGlobalApiHandlers(connection, handlers) {
2033
2058
  if (!handler) throw new Error("No llmInference client-global handler registered");
2034
2059
  return handler.httpRequestChunk(params);
2035
2060
  });
2061
+ connection.onNotification("gitHubTelemetry.event", async (params) => {
2062
+ const handler = handlers.gitHubTelemetry;
2063
+ if (!handler) return;
2064
+ await handler.event(params);
2065
+ });
2036
2066
  }
2037
2067
  export {
2038
2068
  createInternalServerRpc,
@@ -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 | ResponseLimitsChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | ContextChangedEvent | UsageInfoEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | 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 | 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 | 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 | 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
  */
@@ -415,6 +415,18 @@ export type AutoModeSwitchResponse =
415
415
  | "yes_always"
416
416
  /** Do not switch models. */
417
417
  | "no";
418
+ /**
419
+ * User action selected for an exhausted session limit.
420
+ */
421
+ export type SessionLimitsExhaustedResponseAction =
422
+ /** Increase the current max by an exact AI Credits amount. */
423
+ "add"
424
+ /** Set a new absolute max AI Credits value. */
425
+ | "set"
426
+ /** Remove the current session limit. */
427
+ | "unset"
428
+ /** Leave the limit unchanged and cancel the blocked model request. */
429
+ | "cancel";
418
430
  /**
419
431
  * Exit plan mode action
420
432
  */
@@ -573,7 +585,6 @@ export interface StartData {
573
585
  * Whether this session supports remote steering via GitHub
574
586
  */
575
587
  remoteSteerable?: boolean;
576
- responseLimits?: ResponseLimitsConfig;
577
588
  /**
578
589
  * Model selected at session creation time, if any
579
590
  */
@@ -582,6 +593,7 @@ export interface StartData {
582
593
  * Unique identifier for the session
583
594
  */
584
595
  sessionId: string;
596
+ sessionLimits?: SessionLimitsConfig;
585
597
  /**
586
598
  * ISO 8601 timestamp when the session was created
587
599
  */
@@ -626,11 +638,11 @@ export interface WorkingDirectoryContext {
626
638
  repositoryHost?: string;
627
639
  }
628
640
  /**
629
- * Optional response limits.
641
+ * Optional session limits.
630
642
  */
631
- export interface ResponseLimitsConfig {
643
+ export interface SessionLimitsConfig {
632
644
  /**
633
- * Maximum AI Credits allowed while responding to one top-level user message.
645
+ * Maximum AI Credits allowed across the session's current accounting window.
634
646
  */
635
647
  maxAiCredits?: number;
636
648
  }
@@ -698,10 +710,6 @@ export interface ResumeData {
698
710
  * Whether this session supports remote steering via GitHub
699
711
  */
700
712
  remoteSteerable?: boolean;
701
- /**
702
- * Response limits currently configured at resume time; null when no limits are active
703
- */
704
- responseLimits?: ResponseLimitsConfig | null;
705
713
  /**
706
714
  * ISO 8601 timestamp when the session was resumed
707
715
  */
@@ -710,6 +718,10 @@ export interface ResumeData {
710
718
  * Model currently selected at resume time
711
719
  */
712
720
  selectedModel?: string;
721
+ /**
722
+ * Session limits currently configured at resume time; null when no limits are active
723
+ */
724
+ sessionLimits?: SessionLimitsConfig | null;
713
725
  /**
714
726
  * True when this resume attached to a session that the runtime already had running in-memory (for example, an extension joining a session another client was actively driving). False (or omitted) for cold resumes — the runtime had to reconstitute the session from its persisted event log.
715
727
  */
@@ -1294,14 +1306,14 @@ export interface ModeChangedData {
1294
1306
  previousMode: SessionMode;
1295
1307
  }
1296
1308
  /**
1297
- * Session event "session.response_limits_changed". Response limits update details. Null clears the limits.
1309
+ * Session event "session.session_limits_changed". Session limits update details. Null clears the limits.
1298
1310
  */
1299
- export interface ResponseLimitsChangedEvent {
1311
+ export interface SessionLimitsChangedEvent {
1300
1312
  /**
1301
1313
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
1302
1314
  */
1303
1315
  agentId?: string;
1304
- data: ResponseLimitsChangedData;
1316
+ data: SessionLimitsChangedData;
1305
1317
  /**
1306
1318
  * When true, the event is transient and not persisted to the session event log on disk
1307
1319
  */
@@ -1319,18 +1331,18 @@ export interface ResponseLimitsChangedEvent {
1319
1331
  */
1320
1332
  timestamp: string;
1321
1333
  /**
1322
- * Type discriminator. Always "session.response_limits_changed".
1334
+ * Type discriminator. Always "session.session_limits_changed".
1323
1335
  */
1324
- type: "session.response_limits_changed";
1336
+ type: "session.session_limits_changed";
1325
1337
  }
1326
1338
  /**
1327
- * Response limits update details. Null clears the limits.
1339
+ * Session limits update details. Null clears the limits.
1328
1340
  */
1329
- export interface ResponseLimitsChangedData {
1341
+ export interface SessionLimitsChangedData {
1330
1342
  /**
1331
- * Current response limits for the session, or null when no limits are active
1343
+ * Current session limits, or null when no limits are active
1332
1344
  */
1333
- responseLimits: ResponseLimitsConfig | null;
1345
+ sessionLimits: SessionLimitsConfig | null;
1334
1346
  }
1335
1347
  /**
1336
1348
  * Session event "session.permissions_changed". Permissions change details carrying the aggregate allow-all boolean transition.
@@ -1857,6 +1869,45 @@ export interface ShutdownTokenDetail {
1857
1869
  */
1858
1870
  tokenCount: number;
1859
1871
  }
1872
+ /**
1873
+ * Session event "session.usage_checkpoint". Durable session usage checkpoint for reconstructing aggregate accounting on resume
1874
+ */
1875
+ export interface UsageCheckpointEvent {
1876
+ /**
1877
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
1878
+ */
1879
+ agentId?: string;
1880
+ data: UsageCheckpointData;
1881
+ /**
1882
+ * When true, the event is transient and not persisted to the session event log on disk
1883
+ */
1884
+ ephemeral?: boolean;
1885
+ /**
1886
+ * Unique event identifier (UUID v4), generated when the event is emitted
1887
+ */
1888
+ id: string;
1889
+ /**
1890
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
1891
+ */
1892
+ parentId: string | null;
1893
+ /**
1894
+ * ISO 8601 timestamp when the event was created
1895
+ */
1896
+ timestamp: string;
1897
+ /**
1898
+ * Type discriminator. Always "session.usage_checkpoint".
1899
+ */
1900
+ type: "session.usage_checkpoint";
1901
+ }
1902
+ /**
1903
+ * Durable session usage checkpoint for reconstructing aggregate accounting on resume
1904
+ */
1905
+ export interface UsageCheckpointData {
1906
+ /**
1907
+ * Session-wide accumulated nano-AI units cost at checkpoint time
1908
+ */
1909
+ totalNanoAiu: number;
1910
+ }
1860
1911
  /**
1861
1912
  * Session event "session.context_changed". Updated working directory and git context after the change
1862
1913
  */
@@ -3034,6 +3085,10 @@ export interface AssistantMessageData {
3034
3085
  * Readable reasoning text from the model's extended thinking
3035
3086
  */
3036
3087
  reasoningText?: string;
3088
+ /**
3089
+ * OpenAI-compatible wire field the provider used for reasoning (e.g. reasoning_content/reasoning). Populated only when non-canonical, so the dialect round-trips across turns.
3090
+ */
3091
+ reasoningWireField?: string;
3037
3092
  /**
3038
3093
  * GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
3039
3094
  */
@@ -5447,6 +5502,14 @@ export interface PermissionRequestRead {
5447
5502
  * Path of the file or directory being read
5448
5503
  */
5449
5504
  path: string;
5505
+ /**
5506
+ * True when the model has requested to run this search outside the sandbox (it set requestSandboxBypass: true and the host opted in via sandbox.allowBypass). This is a request, not a grant: the search runs unsandboxed only if the user approves this permission request. Hosts should highlight the elevated risk in the approval UI.
5507
+ */
5508
+ requestSandboxBypass?: boolean;
5509
+ /**
5510
+ * Model-provided justification for the sandbox-bypass request. Only meaningful when requestSandboxBypass is true.
5511
+ */
5512
+ requestSandboxBypassReason?: string;
5450
5513
  /**
5451
5514
  * Tool call ID that triggered this permission request
5452
5515
  */
@@ -7118,6 +7181,107 @@ export interface AutoModeSwitchCompletedData {
7118
7181
  requestId: string;
7119
7182
  response: AutoModeSwitchResponse;
7120
7183
  }
7184
+ /**
7185
+ * Session event "session_limits_exhausted.requested". Session limit exhaustion notification requiring user action.
7186
+ */
7187
+ export interface SessionLimitsExhaustedRequestedEvent {
7188
+ /**
7189
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
7190
+ */
7191
+ agentId?: string;
7192
+ data: SessionLimitsExhaustedRequestedData;
7193
+ /**
7194
+ * Always true for events that are transient and not persisted to the session event log on disk.
7195
+ */
7196
+ ephemeral: true;
7197
+ /**
7198
+ * Unique event identifier (UUID v4), generated when the event is emitted
7199
+ */
7200
+ id: string;
7201
+ /**
7202
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
7203
+ */
7204
+ parentId: string | null;
7205
+ /**
7206
+ * ISO 8601 timestamp when the event was created
7207
+ */
7208
+ timestamp: string;
7209
+ /**
7210
+ * Type discriminator. Always "session_limits_exhausted.requested".
7211
+ */
7212
+ type: "session_limits_exhausted.requested";
7213
+ }
7214
+ /**
7215
+ * Session limit exhaustion notification requiring user action.
7216
+ */
7217
+ export interface SessionLimitsExhaustedRequestedData {
7218
+ /**
7219
+ * Configured max AI Credits for the current accounting window.
7220
+ */
7221
+ maxAiCredits: number;
7222
+ /**
7223
+ * Unique identifier for this request; used to respond via session.ui.handlePendingSessionLimitsExhausted().
7224
+ */
7225
+ requestId: string;
7226
+ /**
7227
+ * AI Credits already consumed in the current accounting window.
7228
+ */
7229
+ usedAiCredits: number;
7230
+ }
7231
+ /**
7232
+ * Session event "session_limits_exhausted.completed". Session limit exhaustion prompt completion notification.
7233
+ */
7234
+ export interface SessionLimitsExhaustedCompletedEvent {
7235
+ /**
7236
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
7237
+ */
7238
+ agentId?: string;
7239
+ data: SessionLimitsExhaustedCompletedData;
7240
+ /**
7241
+ * Always true for events that are transient and not persisted to the session event log on disk.
7242
+ */
7243
+ ephemeral: true;
7244
+ /**
7245
+ * Unique event identifier (UUID v4), generated when the event is emitted
7246
+ */
7247
+ id: string;
7248
+ /**
7249
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
7250
+ */
7251
+ parentId: string | null;
7252
+ /**
7253
+ * ISO 8601 timestamp when the event was created
7254
+ */
7255
+ timestamp: string;
7256
+ /**
7257
+ * Type discriminator. Always "session_limits_exhausted.completed".
7258
+ */
7259
+ type: "session_limits_exhausted.completed";
7260
+ }
7261
+ /**
7262
+ * Session limit exhaustion prompt completion notification.
7263
+ */
7264
+ export interface SessionLimitsExhaustedCompletedData {
7265
+ /**
7266
+ * Request ID of the resolved request; clients should dismiss any UI for this request.
7267
+ */
7268
+ requestId: string;
7269
+ response: SessionLimitsExhaustedResponse;
7270
+ }
7271
+ /**
7272
+ * The user's selected action for an exhausted session limit.
7273
+ */
7274
+ export interface SessionLimitsExhaustedResponse {
7275
+ action: SessionLimitsExhaustedResponseAction;
7276
+ /**
7277
+ * AI Credits to add to the current max when action is 'add'.
7278
+ */
7279
+ additionalAiCredits?: number;
7280
+ /**
7281
+ * New absolute max AI Credits when action is 'set'.
7282
+ */
7283
+ maxAiCredits?: number;
7284
+ }
7121
7285
  /**
7122
7286
  * Session event "commands.changed". SDK command registration change notification
7123
7287
  */
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, 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, 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";
package/dist/types.d.ts CHANGED
@@ -4,11 +4,12 @@
4
4
  import type { Canvas } from "./canvas.js";
5
5
  import type { SessionFsProvider } from "./sessionFsProvider.js";
6
6
  import type { CopilotRequestHandler } from "./copilotRequestHandler.js";
7
- import type { ReasoningSummary, SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
7
+ import type { ReasoningSummary, SessionLimitsConfig, SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
8
8
  import type { CopilotSession } from "./session.js";
9
- import type { ModelBillingTokenPrices, OpenCanvasInstance, RemoteSessionMode } from "./generated/rpc.js";
9
+ import type { GitHubTelemetryNotification, ModelBillingTokenPrices, OpenCanvasInstance, RemoteSessionMode } from "./generated/rpc.js";
10
10
  import type { ToolSet } from "./toolSet.js";
11
11
  export type { RemoteSessionMode } from "./generated/rpc.js";
12
+ export type { GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, } from "./generated/rpc.js";
12
13
  export type { ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, } from "./generated/rpc.js";
13
14
  export type SessionEvent = GeneratedSessionEvent;
14
15
  export type { ReasoningSummary } from "./generated/session-events.js";
@@ -270,6 +271,17 @@ export interface CopilotClientOptions {
270
271
  * @experimental
271
272
  */
272
273
  requestHandler?: CopilotRequestHandler;
274
+ /**
275
+ * Experimental. Receives GitHub telemetry events the runtime forwards to
276
+ * this connection. When set, the client opts each session it creates or
277
+ * resumes into telemetry forwarding and dispatches each
278
+ * `gitHubTelemetry.event` notification to this connection-global handler;
279
+ * each {@link GitHubTelemetryNotification} carries its originating
280
+ * `sessionId`.
281
+ *
282
+ * @experimental
283
+ */
284
+ onGitHubTelemetry?: (notification: GitHubTelemetryNotification) => void | Promise<void>;
273
285
  /**
274
286
  * Server-wide idle timeout for sessions in seconds.
275
287
  * Sessions without activity for this duration are automatically cleaned up.
@@ -1510,6 +1522,12 @@ export interface SessionConfigBase {
1510
1522
  * is disabled even if it also matches `availableTools`.
1511
1523
  */
1512
1524
  excludedTools?: string[] | ToolSet;
1525
+ /**
1526
+ * Names of built-in agents to exclude from the session. Excluded built-in
1527
+ * agents are hidden from discovery and cannot be selected or invoked unless
1528
+ * a custom agent with the same name is configured.
1529
+ */
1530
+ excludedBuiltinAgents?: string[];
1513
1531
  /**
1514
1532
  * Custom provider configuration (BYOK - Bring Your Own Key).
1515
1533
  * When specified, uses the provided API endpoint instead of the Copilot API.
@@ -1554,6 +1572,18 @@ export interface SessionConfigBase {
1554
1572
  * This is independent of the OpenTelemetry configuration in {@link CopilotClientOptions.telemetry}.
1555
1573
  */
1556
1574
  enableSessionTelemetry?: boolean;
1575
+ /**
1576
+ * Enables native model citations for supported providers.
1577
+ *
1578
+ * @experimental
1579
+ */
1580
+ enableCitations?: boolean;
1581
+ /**
1582
+ * Limits applied to this session's current accounting window.
1583
+ *
1584
+ * @experimental
1585
+ */
1586
+ sessionLimits?: SessionLimitsConfig;
1557
1587
  /**
1558
1588
  * When true, the runtime skips loading custom-instruction sources
1559
1589
  * (e.g. `.github/copilot-instructions.md`, `AGENTS.md`, `CLAUDE.md`).
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.5-preview.1",
7
+ "version": "1.0.6-preview.0",
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,7 @@
56
56
  "author": "GitHub",
57
57
  "license": "MIT",
58
58
  "dependencies": {
59
- "@github/copilot": "^1.0.66-2",
59
+ "@github/copilot": "^1.0.67",
60
60
  "vscode-jsonrpc": "^8.2.1",
61
61
  "zod": "^4.3.6"
62
62
  },