@github/copilot-sdk 1.0.0-beta.1 → 1.0.0-beta.3

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.
package/README.md CHANGED
@@ -38,7 +38,7 @@ const session = await client.createSession({
38
38
  onPermissionRequest: approveAll,
39
39
  });
40
40
 
41
- // Wait for response using typed event handlers
41
+ // Wait for the response using typed event handlers
42
42
  const done = new Promise<void>((resolve) => {
43
43
  session.on("assistant.message", (event) => {
44
44
  console.log(event.data.content);
@@ -36,6 +36,11 @@ var import_sessionFsProvider = require("./sessionFsProvider.js");
36
36
  var import_telemetry = require("./telemetry.js");
37
37
  var import_types = require("./types.js");
38
38
  const import_meta = {};
39
+ function toWireProviderConfig(provider) {
40
+ const { maxInputTokens, ...rest } = provider;
41
+ if (maxInputTokens === void 0) return rest;
42
+ return { ...rest, maxPromptTokens: maxInputTokens };
43
+ }
39
44
  const MIN_PROTOCOL_VERSION = 2;
40
45
  function isZodSchema(value) {
41
46
  return value != null && typeof value === "object" && "toJSONSchema" in value && typeof value.toJSONSchema === "function";
@@ -230,7 +235,8 @@ class CopilotClient {
230
235
  useLoggedInUser: options.useLoggedInUser ?? (options.gitHubToken ? false : true),
231
236
  telemetry: options.telemetry,
232
237
  copilotHome: options.copilotHome,
233
- sessionIdleTimeoutSeconds: options.sessionIdleTimeoutSeconds ?? 0
238
+ sessionIdleTimeoutSeconds: options.sessionIdleTimeoutSeconds ?? 0,
239
+ remote: options.remote ?? false
234
240
  };
235
241
  }
236
242
  /**
@@ -524,6 +530,12 @@ class CopilotClient {
524
530
  if (config.onElicitationRequest) {
525
531
  session.registerElicitationHandler(config.onElicitationRequest);
526
532
  }
533
+ if (config.onExitPlanMode) {
534
+ session.registerExitPlanModeHandler(config.onExitPlanMode);
535
+ }
536
+ if (config.onAutoModeSwitch) {
537
+ session.registerAutoModeSwitchHandler(config.onAutoModeSwitch);
538
+ }
527
539
  if (config.hooks) {
528
540
  session.registerHooks(config.hooks);
529
541
  }
@@ -569,11 +581,14 @@ class CopilotClient {
569
581
  systemMessage: wireSystemMessage,
570
582
  availableTools: config.availableTools,
571
583
  excludedTools: config.excludedTools,
572
- provider: config.provider,
584
+ provider: config.provider ? toWireProviderConfig(config.provider) : void 0,
585
+ enableSessionTelemetry: config.enableSessionTelemetry,
573
586
  modelCapabilities: config.modelCapabilities,
574
587
  requestPermission: true,
575
588
  requestUserInput: !!config.onUserInputRequest,
576
589
  requestElicitation: !!config.onElicitationRequest,
590
+ requestExitPlanMode: !!config.onExitPlanMode,
591
+ requestAutoModeSwitch: !!config.onAutoModeSwitch,
577
592
  hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
578
593
  workingDirectory: config.workingDirectory,
579
594
  streaming: config.streaming,
@@ -652,6 +667,12 @@ class CopilotClient {
652
667
  if (config.onElicitationRequest) {
653
668
  session.registerElicitationHandler(config.onElicitationRequest);
654
669
  }
670
+ if (config.onExitPlanMode) {
671
+ session.registerExitPlanModeHandler(config.onExitPlanMode);
672
+ }
673
+ if (config.onAutoModeSwitch) {
674
+ session.registerAutoModeSwitchHandler(config.onAutoModeSwitch);
675
+ }
655
676
  if (config.hooks) {
656
677
  session.registerHooks(config.hooks);
657
678
  }
@@ -686,6 +707,7 @@ class CopilotClient {
686
707
  systemMessage: wireSystemMessage,
687
708
  availableTools: config.availableTools,
688
709
  excludedTools: config.excludedTools,
710
+ enableSessionTelemetry: config.enableSessionTelemetry,
689
711
  tools: config.tools?.map((tool) => ({
690
712
  name: tool.name,
691
713
  description: tool.description,
@@ -697,11 +719,13 @@ class CopilotClient {
697
719
  name: cmd.name,
698
720
  description: cmd.description
699
721
  })),
700
- provider: config.provider,
722
+ provider: config.provider ? toWireProviderConfig(config.provider) : void 0,
701
723
  modelCapabilities: config.modelCapabilities,
702
724
  requestPermission: config.onPermissionRequest !== import_types.defaultJoinSessionPermissionHandler,
703
725
  requestUserInput: !!config.onUserInputRequest,
704
726
  requestElicitation: !!config.onElicitationRequest,
727
+ requestExitPlanMode: !!config.onExitPlanMode,
728
+ requestAutoModeSwitch: !!config.onAutoModeSwitch,
705
729
  hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
706
730
  workingDirectory: config.workingDirectory,
707
731
  configDir: config.configDir,
@@ -857,7 +881,7 @@ class CopilotClient {
857
881
  );
858
882
  serverVersion = result.protocolVersion;
859
883
  } catch (err) {
860
- if (err instanceof import_node.ResponseError && err.code === import_node.ErrorCodes.MethodNotFound) {
884
+ if (err instanceof import_node.ResponseError && (err.code === import_node.ErrorCodes.MethodNotFound || err.message === "Unhandled method connect")) {
861
885
  serverVersion = (await raceAgainstExit(this.ping())).protocolVersion;
862
886
  } else {
863
887
  throw err;
@@ -1092,6 +1116,9 @@ class CopilotClient {
1092
1116
  this.options.sessionIdleTimeoutSeconds.toString()
1093
1117
  );
1094
1118
  }
1119
+ if (this.options.remote) {
1120
+ args.push("--remote");
1121
+ }
1095
1122
  const envWithoutNodeDebug = { ...this.options.env };
1096
1123
  delete envWithoutNodeDebug.NODE_DEBUG;
1097
1124
  if (this.options.gitHubToken) {
@@ -1323,6 +1350,14 @@ stderr: ${stderrOutput}`
1323
1350
  "userInput.request",
1324
1351
  async (params) => await this.handleUserInputRequest(params)
1325
1352
  );
1353
+ this.connection.onRequest(
1354
+ "exitPlanMode.request",
1355
+ async (params) => await this.handleExitPlanModeRequest(params)
1356
+ );
1357
+ this.connection.onRequest(
1358
+ "autoModeSwitch.request",
1359
+ async (params) => await this.handleAutoModeSwitchRequest(params)
1360
+ );
1326
1361
  this.connection.onRequest(
1327
1362
  "hooks.invoke",
1328
1363
  async (params) => await this.handleHooksInvoke(params)
@@ -1389,6 +1424,35 @@ stderr: ${stderrOutput}`
1389
1424
  });
1390
1425
  return result;
1391
1426
  }
1427
+ async handleExitPlanModeRequest(params) {
1428
+ if (!params || typeof params.sessionId !== "string" || typeof params.summary !== "string" || !Array.isArray(params.actions) || typeof params.recommendedAction !== "string") {
1429
+ throw new Error("Invalid exit plan mode request payload");
1430
+ }
1431
+ const session = this.sessions.get(params.sessionId);
1432
+ if (!session) {
1433
+ throw new Error(`Session not found: ${params.sessionId}`);
1434
+ }
1435
+ return await session._handleExitPlanModeRequest({
1436
+ summary: params.summary,
1437
+ planContent: params.planContent,
1438
+ actions: params.actions,
1439
+ recommendedAction: params.recommendedAction
1440
+ });
1441
+ }
1442
+ async handleAutoModeSwitchRequest(params) {
1443
+ if (!params || typeof params.sessionId !== "string") {
1444
+ throw new Error("Invalid auto mode switch request payload");
1445
+ }
1446
+ const session = this.sessions.get(params.sessionId);
1447
+ if (!session) {
1448
+ throw new Error(`Session not found: ${params.sessionId}`);
1449
+ }
1450
+ const response = await session._handleAutoModeSwitchRequest({
1451
+ errorCode: params.errorCode,
1452
+ retryAfterSeconds: params.retryAfterSeconds
1453
+ });
1454
+ return { response };
1455
+ }
1392
1456
  async handleHooksInvoke(params) {
1393
1457
  if (!params || typeof params.sessionId !== "string" || typeof params.hookType !== "string") {
1394
1458
  throw new Error("Invalid hooks invoke payload");
@@ -176,6 +176,11 @@ function createSessionRpc(connection, sessionId) {
176
176
  /** @experimental */
177
177
  usage: {
178
178
  getMetrics: async () => connection.sendRequest("session.usage.getMetrics", { sessionId })
179
+ },
180
+ /** @experimental */
181
+ remote: {
182
+ enable: async () => connection.sendRequest("session.remote.enable", { sessionId }),
183
+ disable: async () => connection.sendRequest("session.remote.disable", { sessionId })
179
184
  }
180
185
  };
181
186
  }
@@ -49,6 +49,8 @@ class CopilotSession {
49
49
  permissionHandler;
50
50
  userInputHandler;
51
51
  elicitationHandler;
52
+ exitPlanModeHandler;
53
+ autoModeSwitchHandler;
52
54
  hooks;
53
55
  transformCallbacks;
54
56
  _rpc = null;
@@ -444,6 +446,24 @@ class CopilotSession {
444
446
  registerElicitationHandler(handler) {
445
447
  this.elicitationHandler = handler;
446
448
  }
449
+ /**
450
+ * Registers the exit-plan-mode handler for this session.
451
+ *
452
+ * @param handler - The handler to invoke when the server dispatches an exit-plan-mode request
453
+ * @internal This method is typically called internally when creating/resuming a session.
454
+ */
455
+ registerExitPlanModeHandler(handler) {
456
+ this.exitPlanModeHandler = handler;
457
+ }
458
+ /**
459
+ * Registers the auto-mode-switch handler for this session.
460
+ *
461
+ * @param handler - The handler to invoke when the server dispatches an auto-mode-switch request
462
+ * @internal This method is typically called internally when creating/resuming a session.
463
+ */
464
+ registerAutoModeSwitchHandler(handler) {
465
+ this.autoModeSwitchHandler = handler;
466
+ }
447
467
  /**
448
468
  * Handles an elicitation.requested broadcast event.
449
469
  * Invokes the registered handler and responds via handlePendingElicitation RPC.
@@ -469,6 +489,26 @@ class CopilotSession {
469
489
  }
470
490
  }
471
491
  }
492
+ /**
493
+ * Handles an exitPlanMode.request callback from the runtime.
494
+ * @internal
495
+ */
496
+ async _handleExitPlanModeRequest(request) {
497
+ if (!this.exitPlanModeHandler) {
498
+ return { approved: true };
499
+ }
500
+ return await this.exitPlanModeHandler(request, { sessionId: this.sessionId });
501
+ }
502
+ /**
503
+ * Handles an autoModeSwitch.request callback from the runtime.
504
+ * @internal
505
+ */
506
+ async _handleAutoModeSwitchRequest(request) {
507
+ if (!this.autoModeSwitchHandler) {
508
+ return "no";
509
+ }
510
+ return await this.autoModeSwitchHandler(request, { sessionId: this.sessionId });
511
+ }
472
512
  /**
473
513
  * Sets the host capabilities for this session.
474
514
  *
@@ -749,6 +789,10 @@ class CopilotSession {
749
789
  this.typedEventHandlers.clear();
750
790
  this.toolHandlers.clear();
751
791
  this.permissionHandler = void 0;
792
+ this.userInputHandler = void 0;
793
+ this.elicitationHandler = void 0;
794
+ this.exitPlanModeHandler = void 0;
795
+ this.autoModeSwitchHandler = void 0;
752
796
  }
753
797
  /**
754
798
  * @deprecated Use {@link disconnect} instead. This method will be removed in a future release.
package/dist/cjs/types.js CHANGED
@@ -51,9 +51,10 @@ function convertMcpCallToolResult(callResult) {
51
51
  textParts.push(block.resource.text);
52
52
  }
53
53
  if (block.resource?.blob) {
54
+ const mimeType = block.resource.mimeType;
54
55
  binaryResults.push({
55
56
  data: block.resource.blob,
56
- mimeType: block.resource.mimeType ?? "application/octet-stream",
57
+ mimeType: typeof mimeType === "string" && mimeType ? mimeType : "application/octet-stream",
57
58
  type: "resource",
58
59
  description: block.resource.uri
59
60
  });
package/dist/client.d.ts CHANGED
@@ -455,6 +455,8 @@ export declare class CopilotClient {
455
455
  private handleSessionEventNotification;
456
456
  private handleSessionLifecycleNotification;
457
457
  private handleUserInputRequest;
458
+ private handleExitPlanModeRequest;
459
+ private handleAutoModeSwitchRequest;
458
460
  private handleHooksInvoke;
459
461
  private handleSystemMessageTransform;
460
462
  /**
package/dist/client.js CHANGED
@@ -22,6 +22,11 @@ import { CopilotSession, NO_RESULT_PERMISSION_V2_ERROR } from "./session.js";
22
22
  import { createSessionFsAdapter } from "./sessionFsProvider.js";
23
23
  import { getTraceContext } from "./telemetry.js";
24
24
  import { defaultJoinSessionPermissionHandler } from "./types.js";
25
+ function toWireProviderConfig(provider) {
26
+ const { maxInputTokens, ...rest } = provider;
27
+ if (maxInputTokens === void 0) return rest;
28
+ return { ...rest, maxPromptTokens: maxInputTokens };
29
+ }
25
30
  const MIN_PROTOCOL_VERSION = 2;
26
31
  function isZodSchema(value) {
27
32
  return value != null && typeof value === "object" && "toJSONSchema" in value && typeof value.toJSONSchema === "function";
@@ -216,7 +221,8 @@ class CopilotClient {
216
221
  useLoggedInUser: options.useLoggedInUser ?? (options.gitHubToken ? false : true),
217
222
  telemetry: options.telemetry,
218
223
  copilotHome: options.copilotHome,
219
- sessionIdleTimeoutSeconds: options.sessionIdleTimeoutSeconds ?? 0
224
+ sessionIdleTimeoutSeconds: options.sessionIdleTimeoutSeconds ?? 0,
225
+ remote: options.remote ?? false
220
226
  };
221
227
  }
222
228
  /**
@@ -510,6 +516,12 @@ class CopilotClient {
510
516
  if (config.onElicitationRequest) {
511
517
  session.registerElicitationHandler(config.onElicitationRequest);
512
518
  }
519
+ if (config.onExitPlanMode) {
520
+ session.registerExitPlanModeHandler(config.onExitPlanMode);
521
+ }
522
+ if (config.onAutoModeSwitch) {
523
+ session.registerAutoModeSwitchHandler(config.onAutoModeSwitch);
524
+ }
513
525
  if (config.hooks) {
514
526
  session.registerHooks(config.hooks);
515
527
  }
@@ -555,11 +567,14 @@ class CopilotClient {
555
567
  systemMessage: wireSystemMessage,
556
568
  availableTools: config.availableTools,
557
569
  excludedTools: config.excludedTools,
558
- provider: config.provider,
570
+ provider: config.provider ? toWireProviderConfig(config.provider) : void 0,
571
+ enableSessionTelemetry: config.enableSessionTelemetry,
559
572
  modelCapabilities: config.modelCapabilities,
560
573
  requestPermission: true,
561
574
  requestUserInput: !!config.onUserInputRequest,
562
575
  requestElicitation: !!config.onElicitationRequest,
576
+ requestExitPlanMode: !!config.onExitPlanMode,
577
+ requestAutoModeSwitch: !!config.onAutoModeSwitch,
563
578
  hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
564
579
  workingDirectory: config.workingDirectory,
565
580
  streaming: config.streaming,
@@ -638,6 +653,12 @@ class CopilotClient {
638
653
  if (config.onElicitationRequest) {
639
654
  session.registerElicitationHandler(config.onElicitationRequest);
640
655
  }
656
+ if (config.onExitPlanMode) {
657
+ session.registerExitPlanModeHandler(config.onExitPlanMode);
658
+ }
659
+ if (config.onAutoModeSwitch) {
660
+ session.registerAutoModeSwitchHandler(config.onAutoModeSwitch);
661
+ }
641
662
  if (config.hooks) {
642
663
  session.registerHooks(config.hooks);
643
664
  }
@@ -672,6 +693,7 @@ class CopilotClient {
672
693
  systemMessage: wireSystemMessage,
673
694
  availableTools: config.availableTools,
674
695
  excludedTools: config.excludedTools,
696
+ enableSessionTelemetry: config.enableSessionTelemetry,
675
697
  tools: config.tools?.map((tool) => ({
676
698
  name: tool.name,
677
699
  description: tool.description,
@@ -683,11 +705,13 @@ class CopilotClient {
683
705
  name: cmd.name,
684
706
  description: cmd.description
685
707
  })),
686
- provider: config.provider,
708
+ provider: config.provider ? toWireProviderConfig(config.provider) : void 0,
687
709
  modelCapabilities: config.modelCapabilities,
688
710
  requestPermission: config.onPermissionRequest !== defaultJoinSessionPermissionHandler,
689
711
  requestUserInput: !!config.onUserInputRequest,
690
712
  requestElicitation: !!config.onElicitationRequest,
713
+ requestExitPlanMode: !!config.onExitPlanMode,
714
+ requestAutoModeSwitch: !!config.onAutoModeSwitch,
691
715
  hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
692
716
  workingDirectory: config.workingDirectory,
693
717
  configDir: config.configDir,
@@ -843,7 +867,7 @@ class CopilotClient {
843
867
  );
844
868
  serverVersion = result.protocolVersion;
845
869
  } catch (err) {
846
- if (err instanceof ResponseError && err.code === ErrorCodes.MethodNotFound) {
870
+ if (err instanceof ResponseError && (err.code === ErrorCodes.MethodNotFound || err.message === "Unhandled method connect")) {
847
871
  serverVersion = (await raceAgainstExit(this.ping())).protocolVersion;
848
872
  } else {
849
873
  throw err;
@@ -1078,6 +1102,9 @@ class CopilotClient {
1078
1102
  this.options.sessionIdleTimeoutSeconds.toString()
1079
1103
  );
1080
1104
  }
1105
+ if (this.options.remote) {
1106
+ args.push("--remote");
1107
+ }
1081
1108
  const envWithoutNodeDebug = { ...this.options.env };
1082
1109
  delete envWithoutNodeDebug.NODE_DEBUG;
1083
1110
  if (this.options.gitHubToken) {
@@ -1309,6 +1336,14 @@ stderr: ${stderrOutput}`
1309
1336
  "userInput.request",
1310
1337
  async (params) => await this.handleUserInputRequest(params)
1311
1338
  );
1339
+ this.connection.onRequest(
1340
+ "exitPlanMode.request",
1341
+ async (params) => await this.handleExitPlanModeRequest(params)
1342
+ );
1343
+ this.connection.onRequest(
1344
+ "autoModeSwitch.request",
1345
+ async (params) => await this.handleAutoModeSwitchRequest(params)
1346
+ );
1312
1347
  this.connection.onRequest(
1313
1348
  "hooks.invoke",
1314
1349
  async (params) => await this.handleHooksInvoke(params)
@@ -1375,6 +1410,35 @@ stderr: ${stderrOutput}`
1375
1410
  });
1376
1411
  return result;
1377
1412
  }
1413
+ async handleExitPlanModeRequest(params) {
1414
+ if (!params || typeof params.sessionId !== "string" || typeof params.summary !== "string" || !Array.isArray(params.actions) || typeof params.recommendedAction !== "string") {
1415
+ throw new Error("Invalid exit plan mode request payload");
1416
+ }
1417
+ const session = this.sessions.get(params.sessionId);
1418
+ if (!session) {
1419
+ throw new Error(`Session not found: ${params.sessionId}`);
1420
+ }
1421
+ return await session._handleExitPlanModeRequest({
1422
+ summary: params.summary,
1423
+ planContent: params.planContent,
1424
+ actions: params.actions,
1425
+ recommendedAction: params.recommendedAction
1426
+ });
1427
+ }
1428
+ async handleAutoModeSwitchRequest(params) {
1429
+ if (!params || typeof params.sessionId !== "string") {
1430
+ throw new Error("Invalid auto mode switch request payload");
1431
+ }
1432
+ const session = this.sessions.get(params.sessionId);
1433
+ if (!session) {
1434
+ throw new Error(`Session not found: ${params.sessionId}`);
1435
+ }
1436
+ const response = await session._handleAutoModeSwitchRequest({
1437
+ errorCode: params.errorCode,
1438
+ retryAfterSeconds: params.retryAfterSeconds
1439
+ });
1440
+ return { response };
1441
+ }
1378
1442
  async handleHooksInvoke(params) {
1379
1443
  if (!params || typeof params.sessionId !== "string" || typeof params.hookType !== "string") {
1380
1444
  throw new Error("Invalid hooks invoke payload");
@@ -1338,6 +1338,17 @@ export interface PluginList {
1338
1338
  */
1339
1339
  plugins: Plugin[];
1340
1340
  }
1341
+ /** @experimental */
1342
+ export interface RemoteEnableResult {
1343
+ /**
1344
+ * Mission Control frontend URL for this session
1345
+ */
1346
+ url?: string;
1347
+ /**
1348
+ * Whether remote steering is enabled
1349
+ */
1350
+ remoteSteerable: boolean;
1351
+ }
1341
1352
  export interface ServerSkill {
1342
1353
  /**
1343
1354
  * Unique identifier for the skill
@@ -2436,6 +2447,11 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
2436
2447
  usage: {
2437
2448
  getMetrics: () => Promise<UsageGetMetricsResult>;
2438
2449
  };
2450
+ /** @experimental */
2451
+ remote: {
2452
+ enable: () => Promise<RemoteEnableResult>;
2453
+ disable: () => Promise<void>;
2454
+ };
2439
2455
  };
2440
2456
  /** Handler for `sessionFs` client session API methods. */
2441
2457
  export interface SessionFsHandler {
@@ -150,6 +150,11 @@ function createSessionRpc(connection, sessionId) {
150
150
  /** @experimental */
151
151
  usage: {
152
152
  getMetrics: async () => connection.sendRequest("session.usage.getMetrics", { sessionId })
153
+ },
154
+ /** @experimental */
155
+ remote: {
156
+ enable: async () => connection.sendRequest("session.remote.enable", { sessionId }),
157
+ disable: async () => connection.sendRequest("session.remote.disable", { sessionId })
153
158
  }
154
159
  };
155
160
  }
@@ -2,7 +2,7 @@
2
2
  * AUTO-GENERATED FILE - DO NOT EDIT
3
3
  * Generated from: session-events.schema.json
4
4
  */
5
- export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | PlanChangedEvent | 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 | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | ExtensionsLoadedEvent;
5
+ export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | PlanChangedEvent | 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 | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | ExtensionsLoadedEvent;
6
6
  /**
7
7
  * Hosting platform type of the repository (github or ado)
8
8
  */
@@ -43,6 +43,10 @@ export type AssistantMessageToolRequestType = "function" | "custom";
43
43
  * Where the failed model call originated
44
44
  */
45
45
  export type ModelCallFailureSource = "top_level" | "subagent" | "mcp_sampling";
46
+ /**
47
+ * Finite reason code describing why the current turn was aborted
48
+ */
49
+ export type AbortReason = "user_initiated" | "remote_command" | "user_abort";
46
50
  /**
47
51
  * A content block within a tool result, which may be text, terminal output, image, audio, or a resource
48
52
  */
@@ -444,6 +448,80 @@ export interface TitleChangedData {
444
448
  */
445
449
  title: string;
446
450
  }
451
+ export interface ScheduleCreatedEvent {
452
+ /**
453
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
454
+ */
455
+ agentId?: string;
456
+ data: ScheduleCreatedData;
457
+ /**
458
+ * When true, the event is transient and not persisted to the session event log on disk
459
+ */
460
+ ephemeral?: boolean;
461
+ /**
462
+ * Unique event identifier (UUID v4), generated when the event is emitted
463
+ */
464
+ id: string;
465
+ /**
466
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
467
+ */
468
+ parentId: string | null;
469
+ /**
470
+ * ISO 8601 timestamp when the event was created
471
+ */
472
+ timestamp: string;
473
+ type: "session.schedule_created";
474
+ }
475
+ /**
476
+ * Scheduled prompt registered via /every
477
+ */
478
+ export interface ScheduleCreatedData {
479
+ /**
480
+ * Sequential id assigned to the scheduled prompt within the session
481
+ */
482
+ id: number;
483
+ /**
484
+ * Interval between ticks in milliseconds
485
+ */
486
+ intervalMs: number;
487
+ /**
488
+ * Prompt text that gets enqueued on every tick
489
+ */
490
+ prompt: string;
491
+ }
492
+ export interface ScheduleCancelledEvent {
493
+ /**
494
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
495
+ */
496
+ agentId?: string;
497
+ data: ScheduleCancelledData;
498
+ /**
499
+ * When true, the event is transient and not persisted to the session event log on disk
500
+ */
501
+ ephemeral?: boolean;
502
+ /**
503
+ * Unique event identifier (UUID v4), generated when the event is emitted
504
+ */
505
+ id: string;
506
+ /**
507
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
508
+ */
509
+ parentId: string | null;
510
+ /**
511
+ * ISO 8601 timestamp when the event was created
512
+ */
513
+ timestamp: string;
514
+ type: "session.schedule_cancelled";
515
+ }
516
+ /**
517
+ * Scheduled prompt cancelled from the schedule manager dialog
518
+ */
519
+ export interface ScheduleCancelledData {
520
+ /**
521
+ * Id of the scheduled prompt that was cancelled
522
+ */
523
+ id: number;
524
+ }
447
525
  export interface InfoEvent {
448
526
  /**
449
527
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -1812,6 +1890,10 @@ export interface AssistantMessageToolRequest {
1812
1890
  * Name of the MCP server hosting this tool, when the tool is an MCP tool
1813
1891
  */
1814
1892
  mcpServerName?: string;
1893
+ /**
1894
+ * Original tool name on the MCP server, when the tool is an MCP tool
1895
+ */
1896
+ mcpToolName?: string;
1815
1897
  /**
1816
1898
  * Name of the tool being invoked
1817
1899
  */
@@ -2177,10 +2259,7 @@ export interface AbortEvent {
2177
2259
  * Turn abort information including the reason for termination
2178
2260
  */
2179
2261
  export interface AbortData {
2180
- /**
2181
- * Reason the current turn was aborted (e.g., "user initiated")
2182
- */
2183
- reason: string;
2262
+ reason: AbortReason;
2184
2263
  }
2185
2264
  export interface ToolUserRequestedEvent {
2186
2265
  /**
@@ -2707,6 +2786,10 @@ export interface SubagentStartedData {
2707
2786
  * Internal name of the sub-agent
2708
2787
  */
2709
2788
  agentName: string;
2789
+ /**
2790
+ * Model the sub-agent will run with, when known at start. Surfaced in the timeline for auto-selected sub-agents (e.g. rubber-duck).
2791
+ */
2792
+ model?: string;
2710
2793
  /**
2711
2794
  * Tool call ID of the parent tool invocation that spawned this sub-agent
2712
2795
  */
@@ -4849,9 +4932,9 @@ export interface CustomAgentsUpdatedAgent {
4849
4932
  */
4850
4933
  source: string;
4851
4934
  /**
4852
- * List of tool names available to this agent
4935
+ * List of tool names available to this agent, or null when all tools are available
4853
4936
  */
4854
- tools: string[];
4937
+ tools: string[] | null;
4855
4938
  /**
4856
4939
  * Whether the agent can be selected by the user
4857
4940
  */
package/dist/index.d.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  export { CopilotClient } from "./client.js";
7
7
  export { CopilotSession, type AssistantMessageEvent } from "./session.js";
8
8
  export { defineTool, approveAll, convertMcpCallToolResult, createSessionFsAdapter, SYSTEM_PROMPT_SECTIONS, } from "./types.js";
9
- export type { CommandContext, CommandDefinition, CommandHandler, ConnectionState, CopilotClientOptions, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, InfiniteSessionConfig, InputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, MessageOptions, ModelBilling, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventType, SessionLifecycleHandler, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemPromptSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
9
+ export type { CommandContext, CommandDefinition, CommandHandler, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, ConnectionState, CopilotClientOptions, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, InfiniteSessionConfig, InputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, MessageOptions, ModelBilling, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventType, SessionLifecycleHandler, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemPromptSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolResultObject, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
package/dist/session.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  import type { MessageConnection } from "vscode-jsonrpc/node.js";
6
6
  import { createSessionRpc } from "./generated/rpc.js";
7
7
  import type { ClientSessionApiHandlers } from "./generated/rpc.js";
8
- import type { CommandHandler, ElicitationHandler, ElicitationContext, MessageOptions, PermissionHandler, PermissionRequestResult, ReasoningEffort, ModelCapabilitiesOverride, SectionTransformFn, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionHooks, SessionUiApi, Tool, ToolHandler, TraceContextProvider, TypedSessionEventHandler, UserInputHandler, UserInputResponse } from "./types.js";
8
+ import type { CommandHandler, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, ElicitationHandler, ElicitationContext, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, MessageOptions, PermissionHandler, PermissionRequestResult, ReasoningEffort, ModelCapabilitiesOverride, SectionTransformFn, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionHooks, SessionUiApi, Tool, ToolHandler, TraceContextProvider, TypedSessionEventHandler, UserInputHandler, UserInputResponse } from "./types.js";
9
9
  export declare const NO_RESULT_PERMISSION_V2_ERROR = "Permission handlers cannot return 'no-result' when connected to a protocol v2 server.";
10
10
  /** Assistant message event - the final response from the assistant. */
11
11
  export type AssistantMessageEvent = Extract<SessionEvent, {
@@ -47,6 +47,8 @@ export declare class CopilotSession {
47
47
  private permissionHandler?;
48
48
  private userInputHandler?;
49
49
  private elicitationHandler?;
50
+ private exitPlanModeHandler?;
51
+ private autoModeSwitchHandler?;
50
52
  private hooks?;
51
53
  private transformCallbacks?;
52
54
  private _rpc;
@@ -246,12 +248,36 @@ export declare class CopilotSession {
246
248
  * @internal This method is typically called internally when creating/resuming a session.
247
249
  */
248
250
  registerElicitationHandler(handler?: ElicitationHandler): void;
251
+ /**
252
+ * Registers the exit-plan-mode handler for this session.
253
+ *
254
+ * @param handler - The handler to invoke when the server dispatches an exit-plan-mode request
255
+ * @internal This method is typically called internally when creating/resuming a session.
256
+ */
257
+ registerExitPlanModeHandler(handler?: ExitPlanModeHandler): void;
258
+ /**
259
+ * Registers the auto-mode-switch handler for this session.
260
+ *
261
+ * @param handler - The handler to invoke when the server dispatches an auto-mode-switch request
262
+ * @internal This method is typically called internally when creating/resuming a session.
263
+ */
264
+ registerAutoModeSwitchHandler(handler?: AutoModeSwitchHandler): void;
249
265
  /**
250
266
  * Handles an elicitation.requested broadcast event.
251
267
  * Invokes the registered handler and responds via handlePendingElicitation RPC.
252
268
  * @internal
253
269
  */
254
270
  _handleElicitationRequest(context: ElicitationContext, requestId: string): Promise<void>;
271
+ /**
272
+ * Handles an exitPlanMode.request callback from the runtime.
273
+ * @internal
274
+ */
275
+ _handleExitPlanModeRequest(request: ExitPlanModeRequest): Promise<ExitPlanModeResult>;
276
+ /**
277
+ * Handles an autoModeSwitch.request callback from the runtime.
278
+ * @internal
279
+ */
280
+ _handleAutoModeSwitchRequest(request: AutoModeSwitchRequest): Promise<AutoModeSwitchResponse>;
255
281
  /**
256
282
  * Sets the host capabilities for this session.
257
283
  *
package/dist/session.js CHANGED
@@ -25,6 +25,8 @@ class CopilotSession {
25
25
  permissionHandler;
26
26
  userInputHandler;
27
27
  elicitationHandler;
28
+ exitPlanModeHandler;
29
+ autoModeSwitchHandler;
28
30
  hooks;
29
31
  transformCallbacks;
30
32
  _rpc = null;
@@ -420,6 +422,24 @@ class CopilotSession {
420
422
  registerElicitationHandler(handler) {
421
423
  this.elicitationHandler = handler;
422
424
  }
425
+ /**
426
+ * Registers the exit-plan-mode handler for this session.
427
+ *
428
+ * @param handler - The handler to invoke when the server dispatches an exit-plan-mode request
429
+ * @internal This method is typically called internally when creating/resuming a session.
430
+ */
431
+ registerExitPlanModeHandler(handler) {
432
+ this.exitPlanModeHandler = handler;
433
+ }
434
+ /**
435
+ * Registers the auto-mode-switch handler for this session.
436
+ *
437
+ * @param handler - The handler to invoke when the server dispatches an auto-mode-switch request
438
+ * @internal This method is typically called internally when creating/resuming a session.
439
+ */
440
+ registerAutoModeSwitchHandler(handler) {
441
+ this.autoModeSwitchHandler = handler;
442
+ }
423
443
  /**
424
444
  * Handles an elicitation.requested broadcast event.
425
445
  * Invokes the registered handler and responds via handlePendingElicitation RPC.
@@ -445,6 +465,26 @@ class CopilotSession {
445
465
  }
446
466
  }
447
467
  }
468
+ /**
469
+ * Handles an exitPlanMode.request callback from the runtime.
470
+ * @internal
471
+ */
472
+ async _handleExitPlanModeRequest(request) {
473
+ if (!this.exitPlanModeHandler) {
474
+ return { approved: true };
475
+ }
476
+ return await this.exitPlanModeHandler(request, { sessionId: this.sessionId });
477
+ }
478
+ /**
479
+ * Handles an autoModeSwitch.request callback from the runtime.
480
+ * @internal
481
+ */
482
+ async _handleAutoModeSwitchRequest(request) {
483
+ if (!this.autoModeSwitchHandler) {
484
+ return "no";
485
+ }
486
+ return await this.autoModeSwitchHandler(request, { sessionId: this.sessionId });
487
+ }
448
488
  /**
449
489
  * Sets the host capabilities for this session.
450
490
  *
@@ -725,6 +765,10 @@ class CopilotSession {
725
765
  this.typedEventHandlers.clear();
726
766
  this.toolHandlers.clear();
727
767
  this.permissionHandler = void 0;
768
+ this.userInputHandler = void 0;
769
+ this.elicitationHandler = void 0;
770
+ this.exitPlanModeHandler = void 0;
771
+ this.autoModeSwitchHandler = void 0;
728
772
  }
729
773
  /**
730
774
  * @deprecated Use {@link disconnect} instead. This method will be removed in a future release.
@@ -6,7 +6,7 @@ import type { SessionFsHandler, SessionFsStatResult, SessionFsReaddirWithTypesEn
6
6
  */
7
7
  export type SessionFsFileInfo = Omit<SessionFsStatResult, "error">;
8
8
  /**
9
- * Interface for session filesystem providers. Implementors use idiomatic
9
+ * Interface for session filesystem providers. Implementers use idiomatic
10
10
  * TypeScript patterns: throw on error, return values directly. Use
11
11
  * {@link createSessionFsAdapter} to convert a provider into the
12
12
  * {@link SessionFsHandler} expected by the SDK.
package/dist/types.d.ts CHANGED
@@ -182,6 +182,15 @@ export interface CopilotClientOptions {
182
182
  * `useStdio: true` (stdio is pre-authenticated by transport).
183
183
  */
184
184
  tcpConnectionToken?: string;
185
+ /**
186
+ * Enable remote session support (Mission Control integration).
187
+ * When true, sessions in a GitHub repository working directory are
188
+ * accessible from GitHub web and mobile.
189
+ * This option is only used when the SDK spawns the CLI process; it is ignored
190
+ * when connecting to an external server via {@link cliUrl}.
191
+ * @default false
192
+ */
193
+ remote?: boolean;
185
194
  }
186
195
  /**
187
196
  * Configuration for creating a session
@@ -641,6 +650,55 @@ export interface UserInputResponse {
641
650
  export type UserInputHandler = (request: UserInputRequest, invocation: {
642
651
  sessionId: string;
643
652
  }) => Promise<UserInputResponse> | UserInputResponse;
653
+ /**
654
+ * Request to exit plan mode and continue with a selected action.
655
+ */
656
+ export interface ExitPlanModeRequest {
657
+ /** Summary of the plan or proposed next step. */
658
+ summary: string;
659
+ /** Full plan content, when available. */
660
+ planContent?: string;
661
+ /** Available actions the user can select. */
662
+ actions: string[];
663
+ /** The action recommended by the runtime. */
664
+ recommendedAction: string;
665
+ }
666
+ /**
667
+ * Response to an exit-plan-mode request.
668
+ */
669
+ export interface ExitPlanModeResult {
670
+ /** Whether the user approved exiting plan mode. */
671
+ approved: boolean;
672
+ /** Selected action, if the user chose one. */
673
+ selectedAction?: string;
674
+ /** Optional feedback provided by the user. */
675
+ feedback?: string;
676
+ }
677
+ /**
678
+ * Handler for exit-plan-mode requests from the agent.
679
+ */
680
+ export type ExitPlanModeHandler = (request: ExitPlanModeRequest, invocation: {
681
+ sessionId: string;
682
+ }) => Promise<ExitPlanModeResult> | ExitPlanModeResult;
683
+ /**
684
+ * Request to switch to auto mode after an eligible rate limit.
685
+ */
686
+ export interface AutoModeSwitchRequest {
687
+ /** The rate-limit error code that triggered the request. */
688
+ errorCode?: string;
689
+ /** Seconds until the rate limit resets, when known. */
690
+ retryAfterSeconds?: number;
691
+ }
692
+ /**
693
+ * Response to an auto-mode-switch request.
694
+ */
695
+ export type AutoModeSwitchResponse = "yes" | "yes_always" | "no";
696
+ /**
697
+ * Handler for auto-mode-switch requests from the agent.
698
+ */
699
+ export type AutoModeSwitchHandler = (request: AutoModeSwitchRequest, invocation: {
700
+ sessionId: string;
701
+ }) => Promise<AutoModeSwitchResponse> | AutoModeSwitchResponse;
644
702
  /**
645
703
  * Base interface for all hook inputs
646
704
  */
@@ -1011,6 +1069,15 @@ export interface SessionConfig {
1011
1069
  * When specified, uses the provided API endpoint instead of the Copilot API.
1012
1070
  */
1013
1071
  provider?: ProviderConfig;
1072
+ /**
1073
+ * Enables or disables internal session telemetry for this session.
1074
+ * When `false`, disables session telemetry. When omitted (the default) or `true`,
1075
+ * telemetry is enabled for GitHub-authenticated sessions.
1076
+ * When a custom {@link provider} (BYOK) is configured, session telemetry is always
1077
+ * disabled regardless of this setting.
1078
+ * This is independent of the OpenTelemetry configuration in {@link CopilotClientOptions.telemetry}.
1079
+ */
1080
+ enableSessionTelemetry?: boolean;
1014
1081
  /**
1015
1082
  * Handler for permission requests from the server.
1016
1083
  * When provided, the server will call this handler to request permission for operations.
@@ -1027,6 +1094,16 @@ export interface SessionConfig {
1027
1094
  * Also enables the `elicitation` capability on the session.
1028
1095
  */
1029
1096
  onElicitationRequest?: ElicitationHandler;
1097
+ /**
1098
+ * Handler for exit-plan-mode requests from the agent.
1099
+ * When provided, enables `exitPlanMode.request` callbacks.
1100
+ */
1101
+ onExitPlanMode?: ExitPlanModeHandler;
1102
+ /**
1103
+ * Handler for auto-mode-switch requests from the agent.
1104
+ * When provided, enables `autoModeSwitch.request` callbacks.
1105
+ */
1106
+ onAutoModeSwitch?: AutoModeSwitchHandler;
1030
1107
  /**
1031
1108
  * Hook handlers for intercepting session lifecycle events.
1032
1109
  * When provided, enables hooks callback allowing custom logic at various points.
@@ -1118,7 +1195,7 @@ export interface SessionConfig {
1118
1195
  /**
1119
1196
  * Configuration for resuming a session
1120
1197
  */
1121
- export type ResumeSessionConfig = Pick<SessionConfig, "clientName" | "model" | "tools" | "commands" | "systemMessage" | "availableTools" | "excludedTools" | "provider" | "modelCapabilities" | "streaming" | "includeSubAgentStreamingEvents" | "reasoningEffort" | "onPermissionRequest" | "onUserInputRequest" | "onElicitationRequest" | "hooks" | "workingDirectory" | "configDir" | "enableConfigDiscovery" | "mcpServers" | "customAgents" | "defaultAgent" | "agent" | "skillDirectories" | "instructionDirectories" | "disabledSkills" | "infiniteSessions" | "gitHubToken" | "onEvent" | "createSessionFsHandler"> & {
1198
+ export type ResumeSessionConfig = Pick<SessionConfig, "clientName" | "model" | "tools" | "commands" | "systemMessage" | "availableTools" | "excludedTools" | "provider" | "enableSessionTelemetry" | "modelCapabilities" | "streaming" | "includeSubAgentStreamingEvents" | "reasoningEffort" | "onPermissionRequest" | "onUserInputRequest" | "onElicitationRequest" | "onExitPlanMode" | "onAutoModeSwitch" | "hooks" | "workingDirectory" | "configDir" | "enableConfigDiscovery" | "mcpServers" | "customAgents" | "defaultAgent" | "agent" | "skillDirectories" | "instructionDirectories" | "disabledSkills" | "infiniteSessions" | "gitHubToken" | "onEvent" | "createSessionFsHandler"> & {
1122
1199
  /**
1123
1200
  * When true, skips emitting the session.resume event.
1124
1201
  * Useful for reconnecting to a session without triggering resume-related side effects.
@@ -1177,6 +1254,32 @@ export interface ProviderConfig {
1177
1254
  * Custom HTTP headers to include in outbound provider requests.
1178
1255
  */
1179
1256
  headers?: Record<string, string>;
1257
+ /**
1258
+ * Well-known model name used by the runtime to look up agent configuration
1259
+ * (tools, prompts, reasoning behavior) and default token limits. Also used
1260
+ * as the wire model when {@link wireModel} is not set.
1261
+ * Falls back to {@link SessionConfig.model}.
1262
+ */
1263
+ modelId?: string;
1264
+ /**
1265
+ * Model name sent to the provider API for inference. Use this when the
1266
+ * provider's model name (e.g. an Azure deployment name or a custom
1267
+ * fine-tune name) differs from {@link modelId}.
1268
+ * Falls back to {@link modelId}, then {@link SessionConfig.model}.
1269
+ */
1270
+ wireModel?: string;
1271
+ /**
1272
+ * Overrides the resolved model's default max prompt tokens. The runtime
1273
+ * triggers conversation compaction before sending a request when the
1274
+ * prompt (system message, history, tool definitions, user message) would
1275
+ * exceed this limit.
1276
+ */
1277
+ maxInputTokens?: number;
1278
+ /**
1279
+ * Overrides the resolved model's default max output tokens. When hit, the
1280
+ * model stops generating and returns a truncated response.
1281
+ */
1282
+ maxOutputTokens?: number;
1180
1283
  }
1181
1284
  /**
1182
1285
  * Options for sending a message to a session
package/dist/types.js CHANGED
@@ -23,9 +23,10 @@ function convertMcpCallToolResult(callResult) {
23
23
  textParts.push(block.resource.text);
24
24
  }
25
25
  if (block.resource?.blob) {
26
+ const mimeType = block.resource.mimeType;
26
27
  binaryResults.push({
27
28
  data: block.resource.blob,
28
- mimeType: block.resource.mimeType ?? "application/octet-stream",
29
+ mimeType: typeof mimeType === "string" && mimeType ? mimeType : "application/octet-stream",
29
30
  type: "resource",
30
31
  description: block.resource.uri
31
32
  });
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.0-beta.1",
7
+ "version": "1.0.0-beta.3",
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.41-0",
59
+ "@github/copilot": "^1.0.44-2",
60
60
  "vscode-jsonrpc": "^8.2.1",
61
61
  "zod": "^4.3.6"
62
62
  },