@github/copilot-sdk 1.0.23 → 1.0.24-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -387,9 +387,9 @@ Create a new conversation session.
387
387
  - `systemMessage?: SystemMessageConfig` - System message customization (see below)
388
388
  - `infiniteSessions?: InfiniteSessionConfig` - Configure automatic context compaction (see below)
389
389
  - `workingDirectory?: string` - Working directory for the session (default: runtime process cwd).
390
+ - `trustWorkingDirectory?: "session" | "user"` - Grant trust to the canonical working directory during session creation. `"session"` trusts it only for this session; `"user"` persists trust for later sessions. Omit to leave trust unchanged. Not available on resume.
390
391
  - `refreshCustomInstructions?: boolean` - Invalidates the process-wide custom-instruction discovery cache before creating this session, so instruction-file edits made in the same runtime are read again. Defaults to `false` (cache reuse). Other sessions in this runtime may observe updated instructions on later turns or discovery. This does not watch files or enable disabled instruction loading. Available on `SessionConfig`, not `ResumeSessionConfig`.
391
392
  - `enableSessionStore?: boolean` - Enables the cross-session store for search and retrieval across sessions. When unset in `"copilot-cli"` mode, the runtime default applies (enabled). In `"empty"` mode, defaults to disabled.
392
- - `enableGitHubCacheStore?: boolean` - Requests the read-only GitHub cache store (`github-cache-store` capability) on create or resume. The runtime registers the `github_sql` tool only when its `GITHUB_CACHE_STORE` feature flag is also on. Defaults to disabled in every mode.
393
393
  - `gitHubTokenProvider?: GitHubTokenProvider` - Acquires rotating, session-scoped GitHub tokens. Token results require a positive `expiresIn` value in seconds remaining when the callback completes; production tokens typically last eight hours. Cannot be combined with `gitHubToken`.
394
394
  - `provider?: ProviderConfig` - Custom API provider configuration (BYOK - Bring Your Own Key). See [Custom Providers](#custom-providers) section.
395
395
  - `onPermissionRequest?: PermissionHandler` - Optional handler called before each tool execution to approve or deny it. When omitted, permission requests are emitted as events and left pending for manual resolution. `approveAll` approves requests when managed settings are disabled and throws when `enableManagedSettings` is true. Custom handlers can inspect `managedApprovalRequired` for human-facing confirmation logic. See [Permission Handling](#permission-handling) section.
@@ -22,7 +22,7 @@ __export(cliVersion_exports, {
22
22
  COPILOT_CLI_VERSION: () => COPILOT_CLI_VERSION
23
23
  });
24
24
  module.exports = __toCommonJS(cliVersion_exports);
25
- const COPILOT_CLI_VERSION = "1.0.100";
25
+ const COPILOT_CLI_VERSION = "1.0.101-1";
26
26
  const COPILOT_CLI_USE_NPM_PACKAGE = false;
27
27
  // Annotate the CommonJS export names for ESM import in node:
28
28
  0 && (module.exports = {
@@ -780,11 +780,19 @@ class CopilotClient {
780
780
  const sessionId = session.sessionId;
781
781
  let lastError = null;
782
782
  for (let attempt = 1; attempt <= 3; attempt++) {
783
+ if (this.connectionClosed) {
784
+ lastError = null;
785
+ break;
786
+ }
783
787
  try {
784
788
  await session.disconnect();
785
789
  lastError = null;
786
790
  break;
787
791
  } catch (error) {
792
+ if (this.connectionClosed) {
793
+ lastError = null;
794
+ break;
795
+ }
788
796
  lastError = error instanceof Error ? error : new Error(String(error));
789
797
  if (attempt < 3) {
790
798
  const delay = 100 * Math.pow(2, attempt - 1);
@@ -970,8 +978,10 @@ class CopilotClient {
970
978
  * - Clears all sessions immediately without destroying them
971
979
  * - Force closes the connection
972
980
  * - Sends SIGKILL to the CLI process (if spawned by this client)
981
+ * - Waits for the spawned CLI process to exit
973
982
  *
974
983
  * @returns A promise that resolves when the force stop is complete
984
+ * @throws If the spawned CLI process cannot be terminated
975
985
  *
976
986
  * @example
977
987
  * ```typescript
@@ -1018,13 +1028,6 @@ class CopilotClient {
1018
1028
  }
1019
1029
  this.socket = null;
1020
1030
  }
1021
- if (this.cliProcess && !this.isExternalServer) {
1022
- try {
1023
- this.cliProcess.kill("SIGKILL");
1024
- } catch {
1025
- }
1026
- this.cliProcess = null;
1027
- }
1028
1031
  if (this.ffiHost) {
1029
1032
  const host = this.ffiHost;
1030
1033
  this.ffiHost = null;
@@ -1041,6 +1044,20 @@ class CopilotClient {
1041
1044
  this.runtimePort = null;
1042
1045
  this.stderrBuffer = "";
1043
1046
  this.processExitPromise = null;
1047
+ if (this.cliProcess && !this.isExternalServer) {
1048
+ const child = this.cliProcess;
1049
+ if (child.exitCode == null && child.signalCode == null) {
1050
+ child.kill("SIGKILL");
1051
+ if (!await waitForChildExit(child, RUNTIME_SHUTDOWN_TIMEOUT_MS)) {
1052
+ throw new Error(
1053
+ `Timed out waiting for CLI process to exit after SIGKILL: ${RUNTIME_SHUTDOWN_TIMEOUT_MS}ms`
1054
+ );
1055
+ }
1056
+ }
1057
+ if (this.cliProcess === child) {
1058
+ this.cliProcess = null;
1059
+ }
1060
+ }
1044
1061
  }
1045
1062
  /**
1046
1063
  * Creates a new conversation session with the Copilot CLI.
@@ -1313,7 +1330,8 @@ class CopilotClient {
1313
1330
  skipPermission: tool.skipPermission,
1314
1331
  defer: tool.defer,
1315
1332
  metadata: tool.metadata,
1316
- isTerminal: tool.isTerminal
1333
+ isTerminal: tool.isTerminal,
1334
+ namespace: tool.namespace
1317
1335
  })),
1318
1336
  toolSearch: config.toolSearch,
1319
1337
  imageGeneration: config.imageGeneration,
@@ -1352,6 +1370,7 @@ class CopilotClient {
1352
1370
  requestAutoModeSwitch: !!config.onAutoModeSwitchRequest,
1353
1371
  hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
1354
1372
  workingDirectory: config.workingDirectory,
1373
+ trustWorkingDirectory: config.trustWorkingDirectory,
1355
1374
  additionalDirectories: config.additionalDirectories,
1356
1375
  streaming: config.streaming,
1357
1376
  includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
@@ -1375,7 +1394,6 @@ class CopilotClient {
1375
1394
  enableFileHooks: config.enableFileHooks,
1376
1395
  enableHostGitOperations: config.enableHostGitOperations,
1377
1396
  enableSessionStore: config.enableSessionStore,
1378
- enableGitHubCacheStore: config.enableGitHubCacheStore,
1379
1397
  enableSkills: config.enableSkills,
1380
1398
  skillDirectories: config.skillDirectories,
1381
1399
  ...config.skillProvider ? { hasSkillProvider: true } : {},
@@ -1385,6 +1403,7 @@ class CopilotClient {
1385
1403
  instructionDirectories: config.instructionDirectories,
1386
1404
  disabledSkills: config.disabledSkills,
1387
1405
  disabledMcpServers: config.disabledMcpServers,
1406
+ sandboxConfig: config.sandboxConfig,
1388
1407
  infiniteSessions: config.infiniteSessions,
1389
1408
  memory: config.memory,
1390
1409
  gitHubToken: config.gitHubToken,
@@ -1594,7 +1613,8 @@ class CopilotClient {
1594
1613
  skipPermission: tool.skipPermission,
1595
1614
  defer: tool.defer,
1596
1615
  metadata: tool.metadata,
1597
- isTerminal: tool.isTerminal
1616
+ isTerminal: tool.isTerminal,
1617
+ namespace: tool.namespace
1598
1618
  })),
1599
1619
  toolSearch: config.toolSearch,
1600
1620
  imageGeneration: config.imageGeneration,
@@ -1635,7 +1655,6 @@ class CopilotClient {
1635
1655
  enableFileHooks: config.enableFileHooks,
1636
1656
  enableHostGitOperations: config.enableHostGitOperations,
1637
1657
  enableSessionStore: config.enableSessionStore,
1638
- enableGitHubCacheStore: config.enableGitHubCacheStore,
1639
1658
  enableSkills: config.enableSkills,
1640
1659
  streaming: config.streaming,
1641
1660
  includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
@@ -1657,6 +1676,7 @@ class CopilotClient {
1657
1676
  instructionDirectories: config.instructionDirectories,
1658
1677
  disabledSkills: config.disabledSkills,
1659
1678
  disabledMcpServers: config.disabledMcpServers,
1679
+ sandboxConfig: config.sandboxConfig,
1660
1680
  infiniteSessions: config.infiniteSessions,
1661
1681
  memory: config.memory,
1662
1682
  disableResume: config.suppressResumeEvent,
@@ -2436,7 +2456,13 @@ stderr: ${stderrOutput}`
2436
2456
  this.cliStartTimeout = setTimeout(() => {
2437
2457
  if (!resolved) {
2438
2458
  resolved = true;
2439
- reject(new Error("Timeout waiting for CLI server to start"));
2459
+ reject(
2460
+ new Error(
2461
+ `Timeout waiting for CLI server to start
2462
+ stdout: ${stdout.trim().slice(-8192) || "(empty)"}
2463
+ stderr: ${this.stderrBuffer.trim().slice(-8192) || "(empty)"}`
2464
+ )
2465
+ );
2440
2466
  }
2441
2467
  }, 3e4);
2442
2468
  });
@@ -2571,6 +2597,9 @@ stderr: ${stderrOutput}`
2571
2597
  stderr: ${stderrOutput}` : ""}`
2572
2598
  );
2573
2599
  this.logDebug(`stdin pipe error: ${reason}`);
2600
+ if (this.messageWriter) {
2601
+ this.messageWriter.suppressWriteErrors = true;
2602
+ }
2574
2603
  try {
2575
2604
  this.connection?.dispose();
2576
2605
  } catch {
@@ -47,7 +47,8 @@ function toToolDefinition(tool) {
47
47
  skipPermission: tool.skipPermission,
48
48
  defer: tool.defer,
49
49
  metadata: tool.metadata,
50
- isTerminal: tool.isTerminal
50
+ isTerminal: tool.isTerminal,
51
+ namespace: tool.namespace
51
52
  };
52
53
  }
53
54
  const workflowExecutionStore = new import_node_async_hooks.AsyncLocalStorage();
@@ -1,2 +1,2 @@
1
- export declare const COPILOT_CLI_VERSION = "1.0.100";
1
+ export declare const COPILOT_CLI_VERSION = "1.0.101-1";
2
2
  export declare const COPILOT_CLI_USE_NPM_PACKAGE = false;
@@ -1,4 +1,4 @@
1
- const COPILOT_CLI_VERSION = "1.0.100";
1
+ const COPILOT_CLI_VERSION = "1.0.101-1";
2
2
  const COPILOT_CLI_USE_NPM_PACKAGE = false;
3
3
  export {
4
4
  COPILOT_CLI_USE_NPM_PACKAGE,
package/dist/client.d.ts CHANGED
@@ -179,8 +179,10 @@ export declare class CopilotClient {
179
179
  * - Clears all sessions immediately without destroying them
180
180
  * - Force closes the connection
181
181
  * - Sends SIGKILL to the CLI process (if spawned by this client)
182
+ * - Waits for the spawned CLI process to exit
182
183
  *
183
184
  * @returns A promise that resolves when the force stop is complete
185
+ * @throws If the spawned CLI process cannot be terminated
184
186
  *
185
187
  * @example
186
188
  * ```typescript
package/dist/client.js CHANGED
@@ -760,11 +760,19 @@ class CopilotClient {
760
760
  const sessionId = session.sessionId;
761
761
  let lastError = null;
762
762
  for (let attempt = 1; attempt <= 3; attempt++) {
763
+ if (this.connectionClosed) {
764
+ lastError = null;
765
+ break;
766
+ }
763
767
  try {
764
768
  await session.disconnect();
765
769
  lastError = null;
766
770
  break;
767
771
  } catch (error) {
772
+ if (this.connectionClosed) {
773
+ lastError = null;
774
+ break;
775
+ }
768
776
  lastError = error instanceof Error ? error : new Error(String(error));
769
777
  if (attempt < 3) {
770
778
  const delay = 100 * Math.pow(2, attempt - 1);
@@ -950,8 +958,10 @@ class CopilotClient {
950
958
  * - Clears all sessions immediately without destroying them
951
959
  * - Force closes the connection
952
960
  * - Sends SIGKILL to the CLI process (if spawned by this client)
961
+ * - Waits for the spawned CLI process to exit
953
962
  *
954
963
  * @returns A promise that resolves when the force stop is complete
964
+ * @throws If the spawned CLI process cannot be terminated
955
965
  *
956
966
  * @example
957
967
  * ```typescript
@@ -998,13 +1008,6 @@ class CopilotClient {
998
1008
  }
999
1009
  this.socket = null;
1000
1010
  }
1001
- if (this.cliProcess && !this.isExternalServer) {
1002
- try {
1003
- this.cliProcess.kill("SIGKILL");
1004
- } catch {
1005
- }
1006
- this.cliProcess = null;
1007
- }
1008
1011
  if (this.ffiHost) {
1009
1012
  const host = this.ffiHost;
1010
1013
  this.ffiHost = null;
@@ -1021,6 +1024,20 @@ class CopilotClient {
1021
1024
  this.runtimePort = null;
1022
1025
  this.stderrBuffer = "";
1023
1026
  this.processExitPromise = null;
1027
+ if (this.cliProcess && !this.isExternalServer) {
1028
+ const child = this.cliProcess;
1029
+ if (child.exitCode == null && child.signalCode == null) {
1030
+ child.kill("SIGKILL");
1031
+ if (!await waitForChildExit(child, RUNTIME_SHUTDOWN_TIMEOUT_MS)) {
1032
+ throw new Error(
1033
+ `Timed out waiting for CLI process to exit after SIGKILL: ${RUNTIME_SHUTDOWN_TIMEOUT_MS}ms`
1034
+ );
1035
+ }
1036
+ }
1037
+ if (this.cliProcess === child) {
1038
+ this.cliProcess = null;
1039
+ }
1040
+ }
1024
1041
  }
1025
1042
  /**
1026
1043
  * Creates a new conversation session with the Copilot CLI.
@@ -1293,7 +1310,8 @@ class CopilotClient {
1293
1310
  skipPermission: tool.skipPermission,
1294
1311
  defer: tool.defer,
1295
1312
  metadata: tool.metadata,
1296
- isTerminal: tool.isTerminal
1313
+ isTerminal: tool.isTerminal,
1314
+ namespace: tool.namespace
1297
1315
  })),
1298
1316
  toolSearch: config.toolSearch,
1299
1317
  imageGeneration: config.imageGeneration,
@@ -1332,6 +1350,7 @@ class CopilotClient {
1332
1350
  requestAutoModeSwitch: !!config.onAutoModeSwitchRequest,
1333
1351
  hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
1334
1352
  workingDirectory: config.workingDirectory,
1353
+ trustWorkingDirectory: config.trustWorkingDirectory,
1335
1354
  additionalDirectories: config.additionalDirectories,
1336
1355
  streaming: config.streaming,
1337
1356
  includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
@@ -1355,7 +1374,6 @@ class CopilotClient {
1355
1374
  enableFileHooks: config.enableFileHooks,
1356
1375
  enableHostGitOperations: config.enableHostGitOperations,
1357
1376
  enableSessionStore: config.enableSessionStore,
1358
- enableGitHubCacheStore: config.enableGitHubCacheStore,
1359
1377
  enableSkills: config.enableSkills,
1360
1378
  skillDirectories: config.skillDirectories,
1361
1379
  ...config.skillProvider ? { hasSkillProvider: true } : {},
@@ -1365,6 +1383,7 @@ class CopilotClient {
1365
1383
  instructionDirectories: config.instructionDirectories,
1366
1384
  disabledSkills: config.disabledSkills,
1367
1385
  disabledMcpServers: config.disabledMcpServers,
1386
+ sandboxConfig: config.sandboxConfig,
1368
1387
  infiniteSessions: config.infiniteSessions,
1369
1388
  memory: config.memory,
1370
1389
  gitHubToken: config.gitHubToken,
@@ -1574,7 +1593,8 @@ class CopilotClient {
1574
1593
  skipPermission: tool.skipPermission,
1575
1594
  defer: tool.defer,
1576
1595
  metadata: tool.metadata,
1577
- isTerminal: tool.isTerminal
1596
+ isTerminal: tool.isTerminal,
1597
+ namespace: tool.namespace
1578
1598
  })),
1579
1599
  toolSearch: config.toolSearch,
1580
1600
  imageGeneration: config.imageGeneration,
@@ -1615,7 +1635,6 @@ class CopilotClient {
1615
1635
  enableFileHooks: config.enableFileHooks,
1616
1636
  enableHostGitOperations: config.enableHostGitOperations,
1617
1637
  enableSessionStore: config.enableSessionStore,
1618
- enableGitHubCacheStore: config.enableGitHubCacheStore,
1619
1638
  enableSkills: config.enableSkills,
1620
1639
  streaming: config.streaming,
1621
1640
  includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
@@ -1637,6 +1656,7 @@ class CopilotClient {
1637
1656
  instructionDirectories: config.instructionDirectories,
1638
1657
  disabledSkills: config.disabledSkills,
1639
1658
  disabledMcpServers: config.disabledMcpServers,
1659
+ sandboxConfig: config.sandboxConfig,
1640
1660
  infiniteSessions: config.infiniteSessions,
1641
1661
  memory: config.memory,
1642
1662
  disableResume: config.suppressResumeEvent,
@@ -2416,7 +2436,13 @@ stderr: ${stderrOutput}`
2416
2436
  this.cliStartTimeout = setTimeout(() => {
2417
2437
  if (!resolved) {
2418
2438
  resolved = true;
2419
- reject(new Error("Timeout waiting for CLI server to start"));
2439
+ reject(
2440
+ new Error(
2441
+ `Timeout waiting for CLI server to start
2442
+ stdout: ${stdout.trim().slice(-8192) || "(empty)"}
2443
+ stderr: ${this.stderrBuffer.trim().slice(-8192) || "(empty)"}`
2444
+ )
2445
+ );
2420
2446
  }
2421
2447
  }, 3e4);
2422
2448
  });
@@ -2551,6 +2577,9 @@ stderr: ${stderrOutput}`
2551
2577
  stderr: ${stderrOutput}` : ""}`
2552
2578
  );
2553
2579
  this.logDebug(`stdin pipe error: ${reason}`);
2580
+ if (this.messageWriter) {
2581
+ this.messageWriter.suppressWriteErrors = true;
2582
+ }
2554
2583
  try {
2555
2584
  this.connection?.dispose();
2556
2585
  } catch {
@@ -2994,18 +2994,18 @@ export type SessionLogLevel =
2994
2994
  /** Error message describing a failure. */
2995
2995
  | "error";
2996
2996
  /**
2997
- * Administrator-configured Ensemble preference, independent of execution support.
2997
+ * Administrator-configured Fusion preference, independent of execution support.
2998
2998
  *
2999
2999
  * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
3000
- * via the `definition` "ManagedEnsembleTier".
3000
+ * via the `definition` "ManagedFusionTier".
3001
3001
  */
3002
3002
  /** @experimental */
3003
- export type ManagedEnsembleTier =
3004
- /** Balance efficiency and intelligence. */
3005
- "balance"
3006
- /** Prefer higher intelligence. */
3003
+ export type ManagedFusionTier =
3004
+ /** Use Auto Balance to balance capability, speed, and cost. */
3005
+ "standard"
3006
+ /** Use HydraFusion, falling back to Auto Intelligence when unavailable. */
3007
3007
  | "high"
3008
- /** Prefer maximum intelligence. */
3008
+ /** Use HydraFusion Max to prioritize quality. */
3009
3009
  | "max"
3010
3010
  /** Leave tier selection unmanaged without falling back to legacy Auto policy. */
3011
3011
  | "unmanaged";
@@ -5011,8 +5011,6 @@ export type SessionCapability =
5011
5011
  | "elicitation"
5012
5012
  /** Cross-session history tools and session-store SQL prompt/tool metadata. */
5013
5013
  | "session-store"
5014
- /** Read-only GitHub cache SQL tool (github_sql). */
5015
- | "github-cache-store"
5016
5014
  /** MCP Apps UI passthrough. */
5017
5015
  | "mcp-apps"
5018
5016
  /** Host-provided canvas rendering support. */
@@ -8246,6 +8244,49 @@ export interface AutopilotObjectiveState {
8246
8244
  creditCountNanoAiu: string;
8247
8245
  creditLimit?: AutopilotObjectiveCreditLimit;
8248
8246
  }
8247
+ /**
8248
+ * Billing information for a server-advertised routing preference.
8249
+ *
8250
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
8251
+ * via the `definition` "AutoTierBilling".
8252
+ */
8253
+ /** @experimental */
8254
+ export interface AutoTierBilling {
8255
+ promo?: AutoTierBillingPromo;
8256
+ }
8257
+ /**
8258
+ * Server-driven promotion for an Auto routing preference. It can be announced before it starts.
8259
+ *
8260
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
8261
+ * via the `definition` "AutoTierBillingPromo".
8262
+ */
8263
+ /** @experimental */
8264
+ export interface AutoTierBillingPromo {
8265
+ /**
8266
+ * Stable identifier for the promotion campaign.
8267
+ */
8268
+ id?: string;
8269
+ /**
8270
+ * Percentage discount (0-100) while the promotion is active. Absent or 0 means the promotion is an announcement only: do not present a discount.
8271
+ */
8272
+ discountPercent?: number;
8273
+ /**
8274
+ * UTC ISO 8601 timestamp marking when the promotion starts. The service can announce a promotion before it starts, so do not present the discount as active before this time. Absent means it has already started.
8275
+ */
8276
+ startsAt?: string;
8277
+ /**
8278
+ * UTC ISO 8601 timestamp marking when the promotion ends. Absent means open-ended. The runtime omits promotions that have already ended.
8279
+ */
8280
+ endsAt?: string;
8281
+ /**
8282
+ * Human-readable promotion message. Does not include the start or end timestamps.
8283
+ */
8284
+ message?: string;
8285
+ /**
8286
+ * Whether the service asked hosts to give this promotion a prominent surface, such as a banner. Absent means the service expressed no preference, so hosts should apply their own default rather than read it as `false`.
8287
+ */
8288
+ showBanner?: boolean;
8289
+ }
8249
8290
  /**
8250
8291
  * A server-advertised routing preference. Identifiers and execution types are extensible.
8251
8292
  *
@@ -8267,10 +8308,15 @@ export interface AutoTierDescriptor {
8267
8308
  */
8268
8309
  description: string;
8269
8310
  /**
8270
- * Execution kind; this client supports `auto` preferences on the Auto model.
8311
+ * Execution kind; supported preferences use `auto` or the runtime's `fusion` modes.
8271
8312
  */
8272
8313
  type: string;
8314
+ /**
8315
+ * Runtime-owned managed Fusion tier represented by this execution descriptor, if any.
8316
+ */
8317
+ fusionTier?: string;
8273
8318
  status: AutoTierStatus;
8319
+ billing?: AutoTierBilling;
8274
8320
  }
8275
8321
  /**
8276
8322
  * Availability of a server-advertised routing preference.
@@ -8284,6 +8330,10 @@ export interface AutoTierStatus {
8284
8330
  * Whether the provider permits selecting this preference.
8285
8331
  */
8286
8332
  enabled: boolean;
8333
+ /**
8334
+ * Whether hosts should list this preference in a picker. Absent means visible. A hidden preference can still be requested explicitly through the SDK.
8335
+ */
8336
+ pickerVisible?: boolean;
8287
8337
  /**
8288
8338
  * Extensible machine-readable unavailability reason.
8289
8339
  */
@@ -15726,7 +15776,7 @@ export interface ManagedSettingsValues {
15726
15776
  */
15727
15777
  model?: string;
15728
15778
  autoTier?: AutoTier;
15729
- ensembleTier?: ManagedEnsembleTier;
15779
+ fusionTier?: ManagedFusionTier;
15730
15780
  /**
15731
15781
  * Managed reasoning-effort default for the managed concrete model. The runtime clamps it to an entitled effort when model availability is known.
15732
15782
  */
@@ -15743,7 +15793,7 @@ export interface ManagedSettingsValues {
15743
15793
  export interface ManagedSettingsMeta {
15744
15794
  model?: ManagedSettingMeta;
15745
15795
  autoTier?: ManagedSettingMeta;
15746
- ensembleTier?: ManagedSettingMeta;
15796
+ fusionTier?: ManagedSettingMeta;
15747
15797
  effortLevel?: ManagedSettingMeta;
15748
15798
  contextTier?: ManagedSettingMeta;
15749
15799
  }
@@ -19732,7 +19782,7 @@ export interface ModelSwitchToRequest {
19732
19782
  */
19733
19783
  compactionDecision?: string;
19734
19784
  /**
19735
- * When true, evaluate context-window compaction policy before applying the switch.
19785
+ * When true, evaluate context-window compaction policy before applying the switch, including effort-only and unchanged selections while idle. An effort-only change applies immediately without compaction when a turn is active, including when the turn starts during preflight; an explicit `compactionDecision: "cancel"` still cancels the change. Other switches retain preflight and may be deferred until the active turn ends.
19736
19786
  */
19737
19787
  runCompactionPreflight?: boolean;
19738
19788
  /**
@@ -20768,6 +20818,10 @@ export interface PermissionDecisionContext {
20768
20818
  source: PermissionDecisionSource;
20769
20819
  surface: PermissionDecisionSurface;
20770
20820
  responseCapability?: PermissionResponseCapability;
20821
+ /**
20822
+ * Optional user-authored explanation of this decision, independent of approval scope. Collected only in restricted telemetry for accepted human responses to Assisted Permissions prompts. Never persisted in session history, sent to the agent or judge, or used to create approval rules. Existing rejection feedback is separate.
20823
+ */
20824
+ userFeedback?: string;
20771
20825
  }
20772
20826
  /**
20773
20827
  * Pending permission request ID and the decision to apply (approve/reject and scope).
@@ -21300,6 +21354,10 @@ export interface PermissionsConfigureParams {
21300
21354
  * If specified, replaces the host-supplied GitHub Content Exclusion policies on the session (combined with natively-discovered policies when evaluating tool/file access). Omit to leave the current policies unchanged.
21301
21355
  */
21302
21356
  additionalContentExclusionPolicies?: PermissionsConfigureAdditionalContentExclusionPolicy[];
21357
+ /**
21358
+ * User-authored instructions appended verbatim to the assisted-approval judge's system prompt. Applies to subsequent judge requests in this local session without changing permission mode, pre-judge gates, or the coding agent's prompt. Omit to leave unchanged; an empty or whitespace-only string clears the instructions. Hosts must reapply their configuration after resuming a session. Remote sessions are not supported.
21359
+ */
21360
+ assistedApprovalInstructions?: string;
21303
21361
  }
21304
21362
  /**
21305
21363
  * If specified, replaces the session's URL-permission policy. The runtime constructs a fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged.
@@ -22233,6 +22291,24 @@ export interface ProtocolExternalToolDefinition {
22233
22291
  metadata?: {
22234
22292
  [k: string]: JsonValue | undefined;
22235
22293
  };
22294
+ namespace?: ProtocolExternalToolNamespace;
22295
+ }
22296
+ /**
22297
+ * Namespace that groups related caller-implemented tools for model tool discovery.
22298
+ *
22299
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
22300
+ * via the `definition` "ProtocolExternalToolNamespace".
22301
+ */
22302
+ /** @experimental */
22303
+ export interface ProtocolExternalToolNamespace {
22304
+ /**
22305
+ * Namespace name: 1-64 ASCII letters, digits, underscores, or hyphens.
22306
+ */
22307
+ name: string;
22308
+ /**
22309
+ * Optional model-visible explanation of the tools in this namespace.
22310
+ */
22311
+ description?: string;
22236
22312
  }
22237
22313
  /**
22238
22314
  * Opt into native CAPI image generation.
@@ -22246,6 +22322,16 @@ export interface ProtocolImageGenerationOptions {
22246
22322
  * Disabled by default for SDK sessions. CAPI model access and permissions still apply.
22247
22323
  */
22248
22324
  enabled?: boolean;
22325
+ /**
22326
+ * Experimental. Request a visible "Made with AI" label on generated and edited images.
22327
+ * This option may change or be removed in a future release.
22328
+ * Overrides the user's imageGenerationWatermark preference for this session;
22329
+ * otherwise that preference applies, defaulting to false. Re-supply after a
22330
+ * cold resume. Does not enable image generation or enforce enterprise policy.
22331
+ *
22332
+ * @experimental
22333
+ */
22334
+ watermark?: boolean;
22249
22335
  }
22250
22336
  /**
22251
22337
  * BYOK providers and/or models to add to the session's registry at runtime. Both fields are optional; provide providers, models, or both.
@@ -22296,6 +22382,10 @@ export interface ProviderConfig {
22296
22382
  * API key. Optional for local providers like Ollama.
22297
22383
  */
22298
22384
  apiKey?: string;
22385
+ /**
22386
+ * Command run by the runtime before each provider request to obtain a fresh API key. Credential-command failures fail the turn without sending a model request. Bearer authentication takes precedence.
22387
+ */
22388
+ apiKeyCommand?: string;
22299
22389
  /**
22300
22390
  * Bearer token for authentication. Sets the Authorization header directly. Takes precedence over apiKey when both are set.
22301
22391
  */
@@ -499,7 +499,7 @@ export type CompactionTrigger =
499
499
  | "manual"
500
500
  /** Emergency compaction triggered by high process memory usage. */
501
501
  | "memory_pressure"
502
- /** Compaction requested while switching to a model with a smaller context window. */
502
+ /** Compaction requested while switching to a model with a smaller context window, including a HydraFusion turn's routed root model. */
503
503
  | "model_switch";
504
504
  /**
505
505
  * Category of structured task blocker
@@ -3942,7 +3942,7 @@ export interface CompactionStartData {
3942
3942
  */
3943
3943
  model?: string;
3944
3944
  /**
3945
- * Destination model for a model-switch compaction when it differs from the compacting model
3945
+ * Destination model for a model-switch compaction when it differs from the compacting model; for a HydraFusion turn, the routed root model
3946
3946
  */
3947
3947
  switchTargetModel?: string;
3948
3948
  /**
@@ -4084,7 +4084,7 @@ export interface CompactionCompleteData {
4084
4084
  */
4085
4085
  summaryContent?: string;
4086
4086
  /**
4087
- * Destination model for a model-switch compaction when it differs from the compacting model
4087
+ * Destination model for a model-switch compaction when it differs from the compacting model; for a HydraFusion turn, the routed root model
4088
4088
  */
4089
4089
  switchTargetModel?: string;
4090
4090
  /**
@@ -4766,6 +4766,12 @@ export interface FusionCompletedEvent {
4766
4766
  */
4767
4767
  /** @experimental */
4768
4768
  export interface FusionCompletedData {
4769
+ /**
4770
+ * True when the committed first pass ended with background work outstanding, so that work's completion notifications continue the conversation; absent otherwise.
4771
+ *
4772
+ * @experimental
4773
+ */
4774
+ awaitingBackgroundWork?: boolean;
4769
4775
  /**
4770
4776
  * Total cached input tokens reported across all phases.
4771
4777
  */
@@ -5679,6 +5685,12 @@ export interface FusionPhaseCompletedData {
5679
5685
  * Elapsed execution time for the phase in milliseconds.
5680
5686
  */
5681
5687
  durationMs: number;
5688
+ /**
5689
+ * True when a first pass (Cascade primary or Critique draft) ended with background work outstanding, whether or not the turn then committed it without review; absent otherwise.
5690
+ *
5691
+ * @experimental
5692
+ */
5693
+ endedWithBackgroundWork?: boolean;
5682
5694
  /**
5683
5695
  * Identifier of the HydraFusion turn containing the phase.
5684
5696
  */
@@ -6946,7 +6958,7 @@ export interface ModelCallFailureData {
6946
6958
  */
6947
6959
  durationMs?: number;
6948
6960
  /**
6949
- * For HTTP 400 failures only: the `code` from the CAPI error envelope (e.g. 'model_max_prompt_tokens_exceeded') identifying which deterministic validation failure occurred. Raw server-controlled string, emitted only through restricted telemetry. Absent for bodyless or non-400 failures.
6961
+ * The `code` from the CAPI error envelope of an HTTP failure of any status (e.g. 'model_max_prompt_tokens_exceeded' on a 400, 'model_overloaded' on a 5xx) identifying which upstream failure occurred. Raw server-controlled string, emitted only through restricted telemetry. Absent when the response carried no error envelope.
6950
6962
  */
6951
6963
  errorCode?: string;
6952
6964
  /**
@@ -6954,7 +6966,7 @@ export interface ModelCallFailureData {
6954
6966
  */
6955
6967
  errorMessage?: string;
6956
6968
  /**
6957
- * For HTTP 400 failures only: the `type` from the CAPI error envelope (e.g. 'websocket_error'), a coarser companion to errorCode for envelopes that carry no code. Raw server-controlled string, emitted only through restricted telemetry. Absent for bodyless or non-400 failures.
6969
+ * The `type` from the CAPI error envelope of an HTTP failure of any status (e.g. 'websocket_error'), a coarser companion to errorCode for envelopes that carry no code. Raw server-controlled string, emitted only through restricted telemetry. Absent when the response carried no error envelope.
6958
6970
  */
6959
6971
  errorType?: string;
6960
6972
  failureKind?: ModelCallFailureKind;
@@ -7069,6 +7081,10 @@ export interface ModelCallFailureData {
7069
7081
  * Content-free structural summary of the failing request for diagnosing malformed 4xx calls
7070
7082
  */
7071
7083
  export interface ModelCallFailureRequestFingerprint {
7084
+ /**
7085
+ * Free-form custom tool calls in the request history before request shaping, counted apart from named function calls (rejected by strict providers)
7086
+ */
7087
+ customToolCallCount?: number;
7072
7088
  /**
7073
7089
  * Summed byte length of opaque or encrypted reasoning payloads
7074
7090
  */
@@ -7097,6 +7113,10 @@ export interface ModelCallFailureRequestFingerprint {
7097
7113
  * Tool calls whose name is missing or empty (rejected by strict providers)
7098
7114
  */
7099
7115
  namelessToolCallCount: number;
7116
+ /**
7117
+ * Tool calls in the request history before request shaping that no later tool result message answers
7118
+ */
7119
+ orphanToolCallCount?: number;
7100
7120
  /**
7101
7121
  * Number of messages carrying opaque or encrypted reasoning
7102
7122
  */
@@ -7109,6 +7129,10 @@ export interface ModelCallFailureRequestFingerprint {
7109
7129
  * Number of "tool" result messages in the request
7110
7130
  */
7111
7131
  toolResultMessageCount: number;
7132
+ /**
7133
+ * Tool result messages in the request history before request shaping that answer no earlier unanswered tool call
7134
+ */
7135
+ unmatchedToolResultCount?: number;
7112
7136
  }
7113
7137
  /**
7114
7138
  * Session event "model.call_finished". Final lifecycle outcome for one logical model dispatch. A logical dispatch may include internal reconnect or fallback work, so event count is not provider HTTP-request count.
@@ -9741,6 +9765,10 @@ export interface PermissionRequestMemory {
9741
9765
  /** @experimental */
9742
9766
  export interface PermissionAssistedApproval {
9743
9767
  evaluation?: PermissionApprovalEvaluation;
9768
+ /**
9769
+ * Runtime-generated correlation ID for the original judge invocation. Cached recommendations retain it. Absent when review was skipped or the event predates correlation support; never part of the judge prompt.
9770
+ */
9771
+ evaluationId?: string;
9744
9772
  failureReason?: AssistedApprovalJudgeFailureReason;
9745
9773
  /**
9746
9774
  * Model id that produced the recommendation, when the judge was consulted and reported one. Absent for `excluded` (the judge was not consulted) and for failures that occurred before a model was selected.
@@ -9798,6 +9826,8 @@ export interface PermissionApprovalEvaluation {
9798
9826
  | "authorization-history-incomplete"
9799
9827
  /** Managed policy required a human decision. */
9800
9828
  | "managed-approval-required"
9829
+ /** An extension capability grant required explicit user consent. */
9830
+ | "extension-permission-access"
9801
9831
  /** The request asked to bypass sandbox restrictions. */
9802
9832
  | "sandbox-bypass"
9803
9833
  /** An action field exceeded the judge input limit. */
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * JSON-RPC based SDK for programmatic control of GitHub Copilot CLI
5
5
  */
6
6
  export { CopilotClient } from "./client.js";
7
- export type { HostLocalServerOptions, HostGitHubEnvironmentOptions, ModelGetReasoningSummariesRequest, ModelGetReasoningSummariesResult, } from "./generated/rpc.js";
7
+ export type { HostLocalServerOptions, HostGitHubEnvironmentOptions, ModelGetReasoningSummariesRequest, ModelGetReasoningSummariesResult, SandboxConfig, } from "./generated/rpc.js";
8
8
  export { AhpHost, type AhpHostExit, type AhpHostOptions, type AhpSessionCreateRequest, type AhpSessionResumeRequest, } from "./host.js";
9
9
  export { DisableBypassPermissionsModes, RuntimeConnection } from "./types.js";
10
10
  export { BuiltInTools, ToolSet } from "./toolSet.js";
@@ -13,5 +13,5 @@ export { defineWorkflow, WorkflowResumeError, isWorkflowRunTerminal } from "./wo
13
13
  export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasDeclaration, type CanvasHostContext, type CanvasHostContextCapabilities, type CanvasJsonSchema, type CanvasOptions, } from "./canvas.js";
14
14
  export { defineTool, approveAll, createAttributedPermissionResult, convertMcpCallToolResult, createSessionFsAdapter, CopilotRequestHandler, CopilotWebSocketHandler, CopilotWebSocketCloseStatus, CopilotWebSocketForwarder, SessionFsSqliteTransactionFailure, SessionFsWriteFailure, SYSTEM_MESSAGE_SECTIONS, } from "./types.js";
15
15
  export type * from "./generated/session-events.js";
16
- export type { AskUserVariant, CommandContext, CommandDefinition, CommandHandler, CanvasProviderIdentity, CloudSessionOptions, CloudSessionRepository, AuthIdentityMetadata, AuthInfoType, ConnectorAccountRequest, ConnectorAvailability, ConnectorCapabilities, ConnectorCatalogEntry, ConnectorCatalogResult, ConnectorCatalogStatus, ConnectorConnectRequest, ConnectorConnectResult, ConnectorContinueRequest, ConnectorDisconnectResult, ConnectorMcpStatus, ConnectorReconcileRequest, ConnectorRuntimeStatus, ConnectorSessionAccount, ConnectorSessionAccountResult, ConnectorStatus, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, AgentStopHandler, AgentStopHookInput, AgentStopHookOutput, SubagentStartHandler, SubagentStartHookInput, SubagentStartHookOutput, SubagentStopHandler, SubagentStopHookInput, SubagentStopHookOutput, UserPromptTransformedHandler, UserPromptTransformedHookInput, UserPromptTransformedHookOutput, CopilotClientInfo, CopilotClientMode, CopilotClientOptions, InstallationConfirmationHandler, InstallationConfirmationRequest, InstallationConfirmationResponse, InstallationDecision, InstallationReview, McpInstallationReview, CopilotExpAssignmentResponse, StdioRuntimeConnection, InProcessRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, ChildProcessRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExpConfigEntry, ExpFlagValue, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionLaunchProfile, ExtensionLaunchProvider, ExtensionLaunchProviderResolveRequest, ExtensionLaunchProviderResolveResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, GitHubMcpToolConfig, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, GitHubTokenAcquireReason, GitHubTokenAcquireResult, GitHubTokenProvider, GitHubTokenProviderArgs, GitHubTokenProviderResult, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, BearerTokenProvider, ExtensionContextAttachment, MessageOptions, ResponseSchema, MessageSource, ManagedSettings, ManagedSettingsPermissions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, AutoTier, CapiSessionOptions, CurrentModel, ModelSwitchAutoTierResult, ModelSwitchAutoTierStatus, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, NamedProviderConfig, PermissionHandler, PermissionRequest, PermissionRequestedData, PermissionRequestedEvent, PermissionRequestResult, AttributedPermissionResult, PermissionDecisionContext, PermissionDecisionOutcome, PermissionDecisionSource, PermissionDecisionSurface, PermissionResponseCapability, ProviderConfig, ProviderConfigModelProvider, ProviderModelConfig, ProviderTokenArgs, RemoteSessionMode, SandboxConfigSource, ResumeSessionConfig, TranscriptRecovery, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionHooks, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, SessionFsSqliteStatement, SessionFsSqliteTransactionErrorClass, SkillProvider, SkillProviderCallOptions, SkillProviderDescriptor, CopilotRequestContext, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, CurrentToolMetadata, ToolTelemetry, ToolResultObject, ToolSearchConfig, ImageGenerationConfig, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
16
+ export type { AskUserVariant, CommandContext, CommandDefinition, CommandHandler, CanvasProviderIdentity, CloudSessionOptions, CloudSessionRepository, AuthIdentityMetadata, AuthInfoType, ConnectorAccountRequest, ConnectorAvailability, ConnectorCapabilities, ConnectorCatalogEntry, ConnectorCatalogResult, ConnectorCatalogStatus, ConnectorConnectRequest, ConnectorConnectResult, ConnectorContinueRequest, ConnectorDisconnectResult, ConnectorMcpStatus, ConnectorReconcileRequest, ConnectorRuntimeStatus, ConnectorSessionAccount, ConnectorSessionAccountResult, ConnectorStatus, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, AgentStopHandler, AgentStopHookInput, AgentStopHookOutput, SubagentStartHandler, SubagentStartHookInput, SubagentStartHookOutput, SubagentStopHandler, SubagentStopHookInput, SubagentStopHookOutput, UserPromptTransformedHandler, UserPromptTransformedHookInput, UserPromptTransformedHookOutput, CopilotClientInfo, CopilotClientMode, CopilotClientOptions, InstallationConfirmationHandler, InstallationConfirmationRequest, InstallationConfirmationResponse, InstallationDecision, InstallationReview, McpInstallationReview, CopilotExpAssignmentResponse, StdioRuntimeConnection, InProcessRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, ChildProcessRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExpConfigEntry, ExpFlagValue, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionLaunchProfile, ExtensionLaunchProvider, ExtensionLaunchProviderResolveRequest, ExtensionLaunchProviderResolveResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, GitHubMcpToolConfig, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, GitHubTokenAcquireReason, GitHubTokenAcquireResult, GitHubTokenProvider, GitHubTokenProviderArgs, GitHubTokenProviderResult, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, BearerTokenProvider, ExtensionContextAttachment, MessageOptions, ResponseSchema, MessageSource, ManagedSettings, ManagedSettingsPermissions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, AutoTier, CapiSessionOptions, CurrentModel, ModelSwitchAutoTierResult, ModelSwitchAutoTierStatus, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, NamedProviderConfig, PermissionHandler, PermissionRequest, PermissionRequestedData, PermissionRequestedEvent, PermissionRequestResult, AttributedPermissionResult, PermissionDecisionContext, PermissionDecisionOutcome, PermissionDecisionSource, PermissionDecisionSurface, PermissionResponseCapability, ProviderConfig, ProviderConfigModelProvider, ProviderModelConfig, ProviderTokenArgs, RemoteSessionMode, SandboxConfigSource, ResumeSessionConfig, TranscriptRecovery, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, WorkingDirectoryTrust, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionHooks, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, SessionFsSqliteStatement, SessionFsSqliteTransactionErrorClass, SkillProvider, SkillProviderCallOptions, SkillProviderDescriptor, CopilotRequestContext, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, ToolNamespace, CurrentToolMetadata, ToolTelemetry, ToolResultObject, ToolSearchConfig, ImageGenerationConfig, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
17
17
  export type { JsonValue, WorkflowRunOptions, WorkflowResumeOptions, WorkflowLimitOverrides, WorkflowResumeErrorCode, SessionWorkflowApi, WorkflowAgentOptions, WorkflowContext, WorkflowDefinition, WorkflowHandle, WorkflowJsonSchema, WorkflowLimits, WorkflowMeta, WorkflowPipelineStage, WorkflowStepOptions, WorkflowRunResult, WorkflowRunStatus, WorkflowRunSummary, WorkflowListRunsOptions, WorkflowRunsPage, WorkflowRunDetail, WorkflowProgressPage, WorkflowProgressLine, WorkflowPhaseObservation, WorkflowPhaseStatus, WorkflowAgentSummary, } from "./workflow.js";
package/dist/session.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createSessionRpc } from "./generated/rpc.js";
2
2
  import type { ModelSwitchAutoTierResult } from "./generated/rpc.js";
3
3
  import type { OpenCanvasInstance } from "./generated/rpc.js";
4
- import type { MessageOptions, ResponseSchema, ContextTier, ReasoningEffort, ReasoningSummary, AutoTier, ModelCapabilitiesOverride, SessionCapabilities, SessionEvent, SessionEventHandler, SessionEventType, SessionUiApi, Tool, TranscriptRecovery, TypedSessionEventHandler } from "./types.js";
4
+ import type { MessageOptions, ResponseSchema, ContextTier, ReasoningEffort, ReasoningSummary, AutoTier, ModelCapabilitiesOverride, SessionCapabilities, SessionConfig, SessionEvent, SessionEventHandler, SessionEventType, SessionUiApi, TranscriptRecovery, TypedSessionEventHandler } from "./types.js";
5
5
  import { type SessionWorkflowApi } from "./workflow.js";
6
6
  /** Assistant message event - the final response from the assistant. */
7
7
  export type AssistantMessageEvent = Extract<SessionEvent, {
@@ -417,7 +417,7 @@ export declare class CopilotSession {
417
417
  * ]);
418
418
  * ```
419
419
  */
420
- setTools(tools: Tool[]): Promise<void>;
420
+ setTools(tools: NonNullable<SessionConfig["tools"]>): Promise<void>;
421
421
  /**
422
422
  * Log a message to the session timeline.
423
423
  * The message appears in the session event stream and is visible to SDK consumers
package/dist/session.js CHANGED
@@ -29,7 +29,8 @@ function toToolDefinition(tool) {
29
29
  skipPermission: tool.skipPermission,
30
30
  defer: tool.defer,
31
31
  metadata: tool.metadata,
32
- isTerminal: tool.isTerminal
32
+ isTerminal: tool.isTerminal,
33
+ namespace: tool.namespace
33
34
  };
34
35
  }
35
36
  const workflowExecutionStore = new AsyncLocalStorage();
package/dist/types.d.ts CHANGED
@@ -6,14 +6,14 @@ import type { SessionFsProvider } from "./sessionFsProvider.js";
6
6
  import type { CopilotRequestHandler } from "./copilotRequestHandler.js";
7
7
  import type { InstallationConfirmationHandler } from "./installationConfirmation.js";
8
8
  export type { InstallationConfirmationHandler } from "./installationConfirmation.js";
9
- import type { AttachmentExtensionContext as GeneratedExtensionContextAttachment, AutoTier, PermissionRequest as GeneratedPermissionRequest, PermissionRequestedData as GeneratedPermissionRequestedData, PermissionRequestedEvent as GeneratedPermissionRequestedEvent, ReasoningSummary, SessionLimitsConfig, SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
9
+ import type { AgentModelPolicy, AttachmentExtensionContext as GeneratedExtensionContextAttachment, AutoTier, PermissionRequest as GeneratedPermissionRequest, PermissionRequestedData as GeneratedPermissionRequestedData, PermissionRequestedEvent as GeneratedPermissionRequestedEvent, ReasoningSummary, SessionLimitsConfig, SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
10
10
  import type { CopilotSession } from "./session.js";
11
11
  import type { JsonValue } from "./workflow.js";
12
- import type { ExtensionLaunchProviderHandler as GeneratedExtensionLaunchProvider, GitHubTokenAcquireRequest, GitHubTokenAcquireResult, GitHubTelemetryNotification, ModelBillingTokenPrices, DiagnosticsConfiguration, OpenCanvasInstance, RemoteSessionMode, CurrentToolMetadata } from "./generated/rpc.js";
12
+ import type { ExtensionLaunchProviderHandler as GeneratedExtensionLaunchProvider, GitHubTokenAcquireRequest, GitHubTokenAcquireResult, GitHubTelemetryNotification, ModelBillingTokenPrices, DiagnosticsConfiguration, OpenCanvasInstance, ProtocolExternalToolNamespace, RemoteSessionMode, CurrentToolMetadata, SandboxConfig } from "./generated/rpc.js";
13
13
  import type { ToolSet } from "./toolSet.js";
14
14
  export type { RemoteSessionMode } from "./generated/rpc.js";
15
15
  export type { CurrentToolMetadata } from "./generated/rpc.js";
16
- export type { SandboxConfigSource } from "./generated/rpc.js";
16
+ export type { SandboxConfig, SandboxConfigSource } from "./generated/rpc.js";
17
17
  export type { AuthIdentityMetadata, AuthInfoType, ConnectorAccountRequest, ConnectorAvailability, ConnectorCapabilities, ConnectorCatalogEntry, ConnectorCatalogResult, ConnectorCatalogStatus, ConnectorConnectRequest, ConnectorConnectResult, ConnectorContinueRequest, ConnectorDisconnectResult, ConnectorMcpStatus, ConnectorReconcileRequest, ConnectorRuntimeStatus, ConnectorSessionAccount, ConnectorSessionAccountResult, ConnectorStatus, ExtensionLaunchProfile, ExtensionLaunchProviderResolveRequest, ExtensionLaunchProviderResolveResult, GitHubTokenAcquireReason, GitHubTokenAcquireResult, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, InstallationConfirmationRequest, InstallationConfirmationResponse, InstallationDecision, InstallationReview, McpInstallationReview, } from "./generated/rpc.js";
18
18
  /**
19
19
  * Arguments passed to a session's {@link GitHubTokenProvider}.
@@ -608,7 +608,29 @@ export interface Tool<TArgs = unknown> {
608
608
  * continue from.
609
609
  */
610
610
  isTerminal?: boolean;
611
+ /**
612
+ * Groups this tool with related tools for model tool discovery.
613
+ *
614
+ * On models and providers that support native tool namespaces, deferred
615
+ * tools sharing a namespace are presented to the model as one group with
616
+ * this name and description, like the tools of an MCP server. Elsewhere,
617
+ * and for tools that are always loaded, the tool stays a flat function.
618
+ * The tool keeps its own name, so calls still reach this tool's handler
619
+ * by name.
620
+ *
621
+ * @experimental
622
+ */
623
+ namespace?: ToolNamespace;
611
624
  }
625
+ /**
626
+ * A namespace that groups related {@link Tool}s for model tool discovery.
627
+ * Tools sharing a name share a namespace. An invalid namespace is reported as a
628
+ * session warning and the tool is presented without it; a missing description
629
+ * defaults to a generic description of the namespace.
630
+ *
631
+ * @experimental
632
+ */
633
+ export type ToolNamespace = ProtocolExternalToolNamespace;
612
634
  /**
613
635
  * Helper to define a tool with Zod schema and get type inference for the handler.
614
636
  * Without this helper, TypeScript cannot infer handler argument types from Zod schemas.
@@ -622,6 +644,7 @@ export declare function defineTool<T = unknown>(name: string, config: {
622
644
  defer?: "auto" | "never";
623
645
  metadata?: Record<string, unknown>;
624
646
  isTerminal?: boolean;
647
+ namespace?: ToolNamespace;
625
648
  }): Tool<T>;
626
649
  /**
627
650
  * Non-persisted opt-in to image generation.
@@ -636,6 +659,13 @@ export interface ImageGenerationConfig {
636
659
  * apply. BYOK image generation is not supported.
637
660
  */
638
661
  enabled?: boolean;
662
+ /**
663
+ * Request a visible "Made with AI" label on generated and edited images.
664
+ * Overrides the user's imageGenerationWatermark preference, which defaults
665
+ * to false. Re-supply after cold resume. Does not enable image generation
666
+ * or enforce enterprise policy.
667
+ */
668
+ watermark?: boolean;
639
669
  }
640
670
  /**
641
671
  * SDK-supplied override for the runtime's built-in tool-search behavior.
@@ -1645,9 +1675,15 @@ export interface CustomAgentConfig {
1645
1675
  /**
1646
1676
  * Model identifier for this agent (e.g. "claude-haiku-4.5").
1647
1677
  * When set, the runtime will attempt to use this model for the agent,
1648
- * falling back to the parent session model if unavailable.
1678
+ * falling back to the parent session model if unavailable unless
1679
+ * `modelPolicy` is `"required"`.
1649
1680
  */
1650
1681
  model?: string;
1682
+ /**
1683
+ * Whether the authored model is a preference or a requirement for this agent.
1684
+ * Defaults to `"preferred"` when omitted.
1685
+ */
1686
+ modelPolicy?: AgentModelPolicy;
1651
1687
  /**
1652
1688
  * Reasoning effort level for this agent's model.
1653
1689
  * When omitted, the runtime resolves the effort from model configuration,
@@ -1735,6 +1771,10 @@ export type ReasoningEffort = "low" | "medium" | "high" | "xhigh" | "max";
1735
1771
  * long-context tier when the selected model supports it.
1736
1772
  */
1737
1773
  export type ContextTier = "default" | "long_context";
1774
+ /**
1775
+ * Scope of a working-directory trust grant made during session creation.
1776
+ */
1777
+ export type WorkingDirectoryTrust = "session" | "user";
1738
1778
  /** Parsed parameters from an MCP server's WWW-Authenticate response. */
1739
1779
  export interface McpAuthWwwAuthenticateParams {
1740
1780
  /** Parsed resource_metadata URL used for protected-resource metadata discovery, if present. */
@@ -2521,6 +2561,14 @@ export interface SessionConfigBase {
2521
2561
  * this on a resident resume cannot stop servers that are already running.
2522
2562
  */
2523
2563
  disabledMcpServers?: string[];
2564
+ /**
2565
+ * Sandbox configuration applied before MCP servers or session tools start.
2566
+ * Uses the same direct-host semantics and managed-policy validation as
2567
+ * `session.rpc.options.update({ sandboxConfig })`. A policy conflict fails
2568
+ * create or resume; an identical later update does not restart MCP servers.
2569
+ * Re-supply on cold resume. Requires runtime-version support.
2570
+ */
2571
+ sandboxConfig?: SandboxConfig;
2524
2572
  /**
2525
2573
  * Infinite session configuration for persistent workspaces and automatic compaction.
2526
2574
  * When enabled (default), sessions automatically manage context limits and persist state.
@@ -2636,13 +2684,6 @@ export interface SessionConfigBase {
2636
2684
  * read from the shared session store.
2637
2685
  */
2638
2686
  enableSessionStore?: boolean;
2639
- /**
2640
- * When true, requests the read-only GitHub cache store for this session
2641
- * (the `github-cache-store` capability). The runtime registers the
2642
- * `github_sql` tool only when its `GITHUB_CACHE_STORE` feature flag is
2643
- * also on. Defaults to disabled.
2644
- */
2645
- enableGitHubCacheStore?: boolean;
2646
2687
  /**
2647
2688
  * When true, enables skill loading (including builtin skills and discovered
2648
2689
  * skill directories). When false, no skills are loaded regardless of
@@ -2693,6 +2734,12 @@ export interface SessionConfig extends SessionConfigBase {
2693
2734
  * Local sessions only: cloud creation rejects it.
2694
2735
  */
2695
2736
  name?: string;
2737
+ /**
2738
+ * Grants trust to the canonical working directory during session creation.
2739
+ * "session" applies only to this session; "user" persists the grant for later
2740
+ * sessions. Omit to leave directory trust unchanged. Not available on resume.
2741
+ */
2742
+ trustWorkingDirectory?: WorkingDirectoryTrust;
2696
2743
  /**
2697
2744
  * Invalidates the process-wide custom-instruction discovery cache before
2698
2745
  * creating this session. Use when instruction files changed in the same runtime.
@@ -2831,6 +2878,12 @@ export interface ProviderConfig {
2831
2878
  * API key. Optional for local providers like Ollama.
2832
2879
  */
2833
2880
  apiKey?: string;
2881
+ /**
2882
+ * Command run by the runtime before each provider request to obtain a fresh API key.
2883
+ * Command failures fail the turn before sending a model request.
2884
+ * Bearer authentication takes precedence; use {@link apiKey} for a static key.
2885
+ */
2886
+ apiKeyCommand?: string;
2834
2887
  /**
2835
2888
  * Bearer token for authentication. Sets the Authorization header directly.
2836
2889
  * Use this for services requiring bearer token auth instead of API key.
@@ -2842,10 +2895,10 @@ export interface ProviderConfig {
2842
2895
  * When set, the SDK keeps this function client-side (it is never serialized)
2843
2896
  * and the runtime calls back into this client to acquire a token before each
2844
2897
  * outbound request. The runtime does no caching of its own, so the callback
2845
- * owns token caching and refresh. When set alongside {@link apiKey} /
2846
- * {@link bearerToken}, this callback takes precedence: the runtime applies
2847
- * the token it returns as the `Authorization: Bearer` header for each
2848
- * request and does not send the static credential.
2898
+ * owns token caching and refresh. When set alongside {@link apiKey},
2899
+ * {@link apiKeyCommand}, or {@link bearerToken}, this callback takes precedence:
2900
+ * the runtime applies its token as the `Authorization: Bearer` header for each
2901
+ * request, without sending the static credential or running the command.
2849
2902
  *
2850
2903
  * @experimental
2851
2904
  */
package/docs/workflows.md CHANGED
@@ -102,7 +102,13 @@ if (!finding) return { finding: null };
102
102
 
103
103
  Cancellation and hard runtime failures — a reached limit, a durable-state failure — reject instead, aborting the run. When filtering results, prefer `v => v !== null` over `Boolean`, which also discards a valid `false`, `0`, or `""`.
104
104
 
105
- **`schema` is a structural subset of JSON Schema, not a validator.** Honored: `type`, `required`, `enum`, `const`, recursive `properties`/`items`, and `anyOf`/`oneOf`/`allOf` — where `oneOf` is treated as `anyOf`, meaning at least one branch matches rather than exactly one. Ignored and *not* enforced: `additionalProperties`, `pattern`, `minLength`/`maxLength`, `format`, numeric ranges, and boolean schemas. Do not rely on an ignored keyword to constrain a result. A schema call retries once on a parse or match failure, so it may spawn twice, and both spawns count toward `maxTotalSubagents`.
105
+ **`schema` is a structural subset of JSON Schema, not a validator.** Honored: `type`, `required`, `enum`, `const`, recursive `properties`/`items`, and `anyOf`/`oneOf`/`allOf` — where `oneOf` is treated as `anyOf`, meaning at least one branch matches rather than exactly one. Ignored and *not* enforced: `additionalProperties`, `pattern`, `minLength`/`maxLength`, `format`, numeric ranges, and boolean schemas. Do not rely on an ignored keyword to constrain a result.
106
+
107
+ The runtime always parses and validates the returned JSON against that workflow subset. On a parse or match failure, it sends up to two correction turns to the same subagent; it does not spawn replacement subagents or repeat the original task.
108
+
109
+ Eligible local first-party model routes also use provider-native structured output to strengthen generation. Native selection fails closed: the selected CAPI model must explicitly report structured-output support, the wire route must support native formats, and the schema must fit a conservative provider subset. That subset requires an object root, typed nodes, non-empty object properties, every property listed in `required`, `additionalProperties: false` on every object, object-shaped array items, and bounded depth, property count, enum size, and serialized size. It accepts nested `anyOf`, descriptions, and enums, but rejects root `anyOf`, references, boolean schemas, `allOf`, `oneOf`, `const`, and other unsupported keywords.
110
+
111
+ AHP subagents, HydraFusion-selected children, BYOK providers, models without the capability, unknown routes, and schemas outside the native subset keep prompt-based JSON coercion. They retain the same parsing, validation, and same-agent correction behavior, so workflow authors use one `ctx.agent(..., { schema })` API regardless of the selected path.
106
112
 
107
113
  ### Choosing between pipeline and parallel
108
114
 
package/package.json CHANGED
@@ -5,8 +5,8 @@
5
5
  "url": "https://github.com/github/copilot-agent-runtime.git",
6
6
  "directory": "src/sdk/nodejs"
7
7
  },
8
- "version": "1.0.23",
9
- "copilotCliVersion": "1.0.100",
8
+ "version": "1.0.24-preview.1",
9
+ "copilotCliVersion": "1.0.101-1",
10
10
  "description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC",
11
11
  "main": "./dist/cjs/index.js",
12
12
  "types": "./dist/index.d.ts",
@@ -87,15 +87,17 @@
87
87
  "glob": "^13.0.1",
88
88
  "json-schema": "^0.4.0",
89
89
  "json-schema-to-typescript": "^15.0.4",
90
+ "jsonc-parser": "^3.3.1",
90
91
  "prettier": "file:../../../third_party/build-tools/prettier-3.8.1",
91
92
  "rimraf": "^6.1.2",
92
93
  "semver": "^7.7.3",
93
94
  "tar": "^7.5.22",
94
- "tsx": "file:../../../third_party/build-tools/tsx-4.22.4",
95
+ "tsx": "file:../../../third_party/build-tools/tsx-4.23.13",
95
96
  "typescript": "^5.0.0",
96
97
  "vite": "file:../../../third_party/build-tools/vite-8.3.4",
97
98
  "vitest": "^4.1.11",
98
- "ws": "^8.21.0"
99
+ "ws": "^8.21.0",
100
+ "yaml": "^2.8.3"
99
101
  },
100
102
  "overrides": {
101
103
  "file-entry-cache": "$file-entry-cache",
@@ -112,18 +114,18 @@
112
114
  "README.md"
113
115
  ],
114
116
  "copilotRuntime": {
115
- "sourceSha": "7d20899fc4c8b13a405aa621066e75a9e78e04cd",
116
- "version": "1.0.100",
117
+ "sourceSha": "01c5befcd0b26b1b4b0a7fce219cf441b8ae2ae1",
118
+ "version": "1.0.101-1",
117
119
  "visibility": "public"
118
120
  },
119
121
  "optionalDependencies": {
120
- "@github/copilot-sdk-darwin-arm64": "1.0.23",
121
- "@github/copilot-sdk-darwin-x64": "1.0.23",
122
- "@github/copilot-sdk-linux-arm64": "1.0.23",
123
- "@github/copilot-sdk-linux-x64": "1.0.23",
124
- "@github/copilot-sdk-linuxmusl-arm64": "1.0.23",
125
- "@github/copilot-sdk-linuxmusl-x64": "1.0.23",
126
- "@github/copilot-sdk-win32-arm64": "1.0.23",
127
- "@github/copilot-sdk-win32-x64": "1.0.23"
122
+ "@github/copilot-sdk-darwin-arm64": "1.0.24-preview.1",
123
+ "@github/copilot-sdk-darwin-x64": "1.0.24-preview.1",
124
+ "@github/copilot-sdk-linux-arm64": "1.0.24-preview.1",
125
+ "@github/copilot-sdk-linux-x64": "1.0.24-preview.1",
126
+ "@github/copilot-sdk-linuxmusl-arm64": "1.0.24-preview.1",
127
+ "@github/copilot-sdk-linuxmusl-x64": "1.0.24-preview.1",
128
+ "@github/copilot-sdk-win32-arm64": "1.0.24-preview.1",
129
+ "@github/copilot-sdk-win32-x64": "1.0.24-preview.1"
128
130
  }
129
131
  }