@github/copilot-sdk 1.0.13-preview.6 → 1.0.14-preview.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -238,13 +238,13 @@ function createServerRpc(connection) {
238
238
  /**
239
239
  * Enables installed plugins for new sessions.
240
240
  *
241
- * @param params Plugin names (or specs) to enable.
241
+ * @param params Plugin names (or specs) to enable, plus the optional working directory the repository-controlled guard is evaluated against.
242
242
  */
243
243
  enable: async (params) => connection.sendRequest("plugins.enable", params),
244
244
  /**
245
245
  * Disables installed plugins for new sessions.
246
246
  *
247
- * @param params Plugin names (or specs) to disable.
247
+ * @param params Plugin names (or specs) to disable, plus the optional working directory the repository-controlled guard is evaluated against.
248
248
  */
249
249
  disable: async (params) => connection.sendRequest("plugins.disable", params),
250
250
  /** @experimental */
@@ -410,7 +410,11 @@ function createServerRpc(connection) {
410
410
  *
411
411
  * @returns Validated device-managed settings discovered before a session exists.
412
412
  */
413
- read: async () => connection.sendRequest("managedSettings.read", {})
413
+ read: async () => connection.sendRequest("managedSettings.read", {}),
414
+ /**
415
+ * Force-refreshes enterprise managed settings for every account: wipes the persistent server-policy cache (the whole `<cacheHome>/managed-settings` directory) and drops this runtime process's in-memory retained server policy. It does not itself fetch policy — the effect is that the next time a session resolves managed settings for an account, that resolution re-fetches the account's org policy from the network instead of serving a cached response. Note that `managedSettings.read` returns only device/MDM settings and never triggers the account server-policy fetch, so a host implementing "sync account policy" should start a fresh session resolution rather than treat a subsequent `managedSettings.read` as the refreshed org policy. Mirrors the invalidation a sign-out performs, broadened from the one signing-out account to all of them; device/MDM layers describe the machine, not the account, and are left untouched. Rejects if the on-disk cache cannot be removed.
416
+ */
417
+ clearCache: async () => connection.sendRequest("managedSettings.clearCache", {})
414
418
  },
415
419
  /** @experimental */
416
420
  runtime: {
@@ -490,7 +494,15 @@ function createServerRpc(connection) {
490
494
  */
491
495
  list: async (params) => connection.sendRequest("sessions.list", params),
492
496
  /**
493
- * Reads a page of durable events directly from a local session's persisted journal without creating, resuming, or activating the session. The initial backward read uses a bounded tail scan for fast first paint; cursor continuations preserve the session event-log paging semantics. Persisted events may omit payloads that are reconstructed only for an active session.
497
+ * Reads client-owned metadata for multiple persisted local sessions without opening them. Results preserve request order and report missing, corrupt, unsupported, or temporarily unavailable sessions independently.
498
+ *
499
+ * @param params Bounded batch request for client-owned metadata from persisted local sessions.
500
+ *
501
+ * @returns Ordered client metadata outcomes for the requested local sessions.
502
+ */
503
+ getClientMetadata: async (params) => connection.sendRequest("sessions.getClientMetadata", params),
504
+ /**
505
+ * Reads a page of durable events directly from a local session's persisted journal without creating, resuming, or activating the session. The first read pins the currently opened journal generation and its byte-length boundary; opaque cursor continuations remain on that generation across runtime-owned compaction, truncation, and rewrite operations, which replace the live path atomically, and events appended after the boundary are excluded. For cold hydration, await the first successful page before activation and establish lossless live-event buffering before resume; merge subsequent live events by ID, preserving persisted order and letting live payloads win. Continuations are process-local, single-use capabilities bound to the originating session and storage context and must be paged sequentially; concurrent or repeated use of the same cursor expires that duplicate read rather than reading the generation twice. A complete snapshot has cursorStatus 'ok' and hasMore false. Snapshots expire after five idle minutes, with at most eight retained per process and idle-only eviction under pressure; completion and cancelled-worker exit release their handles. No transcript copy is created, but retained handles may keep replaced files' disk blocks alive until release. Pages have a soft 1 MiB serialized event-array budget including resolved binary assets; one oversized event is returned alone to guarantee progress. Working memory also includes a record/lookahead and asset resolution; resolving the first binary reference may scan the full pinned generation to build a bounded offset index. If the snapshot expires, is evicted, is cancelled before a continuation is established, or becomes unreadable after an observable unsupported in-place shortening, the continuation returns cursorStatus 'expired' with an empty terminal page and never falls back to a different generation. A missing or initially unreadable journal is an RPC error. Persisted history excludes ephemeral events and may omit payloads that are reconstructed only for an active session; use the active session event stream for post-resume live events.
494
506
  *
495
507
  * @param params Pagination options for reading an inactive or active local session's persisted event journal.
496
508
  *
@@ -771,7 +783,15 @@ function createSessionRpc(connection, sessionId) {
771
783
  *
772
784
  * @returns Managed sandbox enforcement state for a session.
773
785
  */
774
- getEnforcementStatus: async () => connection.sendRequest("session.sandbox.getEnforcementStatus", { sessionId })
786
+ getEnforcementStatus: async () => connection.sendRequest("session.sandbox.getEnforcementStatus", { sessionId }),
787
+ /**
788
+ * Disables sandboxing for the remainder of the current session and approves the referenced pending sandbox-bypass permission request. The request is rejected unless the exact request is still pending and the effective sandbox policy permits bypass.
789
+ *
790
+ * @param params Request to disable sandboxing for the current session while resolving an active sandbox-bypass permission prompt.
791
+ *
792
+ * @returns Result of attempting to disable sandboxing for the current session.
793
+ */
794
+ disableForSession: async (params) => connection.sendRequest("session.sandbox.disableForSession", { sessionId, ...params })
775
795
  },
776
796
  /**
777
797
  * Aborts the current agent turn.
@@ -935,6 +955,14 @@ function createSessionRpc(connection, sessionId) {
935
955
  * @returns Complete current or terminal factory run envelope.
936
956
  */
937
957
  cancel: async (params) => connection.sendRequest("session.factory.cancel", { sessionId, ...params }),
958
+ /**
959
+ * Pauses a running factory and returns its settled run envelope.
960
+ *
961
+ * @param params Parameters for pausing a running factory.
962
+ *
963
+ * @returns Complete current or terminal factory run envelope.
964
+ */
965
+ pause: async (params) => connection.sendRequest("session.factory.pause", { sessionId, ...params }),
938
966
  /**
939
967
  * Records a batch of ordered factory progress lines.
940
968
  *
@@ -974,9 +1002,9 @@ function createSessionRpc(connection, sessionId) {
974
1002
  /** @experimental */
975
1003
  model: {
976
1004
  /**
977
- * Gets the currently selected model for the session.
1005
+ * Gets the session's authoritative model snapshot, including the committed Auto preference and any newer unclaimed Auto preference waiting for a future user turn.
978
1006
  *
979
- * @returns The currently selected model, reasoning effort, and context tier for the session. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume.
1007
+ * @returns The session's authoritative model snapshot. Auto preference fields are configuration for the virtual `auto` model and do not change the selected model identifier. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume.
980
1008
  */
981
1009
  getCurrent: async () => connection.sendRequest("session.model.getCurrent", { sessionId }),
982
1010
  /**
@@ -987,6 +1015,22 @@ function createSessionRpc(connection, sessionId) {
987
1015
  * @returns The model identifier active on the session after the switch.
988
1016
  */
989
1017
  switchTo: async (params) => connection.sendRequest("session.model.switchTo", { sessionId, ...params }),
1018
+ /**
1019
+ * Requests an Auto preference change without changing the session's selected model. The latest unclaimed request wins; the runtime commits it only after a later prompt using the `auto` model mints a usable model and token pair. A `pending` response confirms that the request was accepted, not that it committed. Observe eventual success through `session.model_change`, failure through the ephemeral `session.auto_tier_switch_failed` event, or current unclaimed state through `session.model.getCurrent`.
1020
+ *
1021
+ * @param params An Auto preference request for the session. This updates Auto configuration only; it does not change the selected model to `auto`.
1022
+ *
1023
+ * @returns Immediate acknowledgement and Auto preference snapshot after a switch request. This result never implies that a pending preference committed.
1024
+ */
1025
+ switchAutoTier: async (params) => connection.sendRequest("session.model.switchAutoTier", { sessionId, ...params }),
1026
+ /**
1027
+ * Replaces or clears the host-supplied model allowlist for a running session.
1028
+ *
1029
+ * @param params Host-supplied exact model selection IDs to allow for this running session. CAPI IDs are intersected with repository `.github/allowed_models.txt` policy; provider-qualified IDs remain exempt from repository-only policy but are restricted by this host list. Omit or pass null to clear the host restriction; an explicit empty or disjoint list is rejected. Validation and pre-selection fallback failures preserve the previous restriction. Failures after a fallback selection commits retain the new restriction and selected model; callers should inspect current session state after such an error.
1030
+ *
1031
+ * @returns The applied host allowlist and effective session model policy after intersection.
1032
+ */
1033
+ setAllowedModels: async (params) => connection.sendRequest("session.model.setAllowedModels", { sessionId, ...params }),
990
1034
  /**
991
1035
  * Updates the session's reasoning effort without changing the selected model.
992
1036
  *
@@ -1193,6 +1237,15 @@ function createSessionRpc(connection, sessionId) {
1193
1237
  diff: async (params) => connection.sendRequest("session.workspaces.diff", { sessionId, ...params })
1194
1238
  },
1195
1239
  /** @experimental */
1240
+ autopilotObjective: {
1241
+ /**
1242
+ * Reads the current canonical autopilot objective state for this session.
1243
+ *
1244
+ * @returns Canonical runtime state for the session's current autopilot objective.
1245
+ */
1246
+ getState: async () => connection.sendRequest("session.autopilotObjective.getState", { sessionId })
1247
+ },
1248
+ /** @experimental */
1196
1249
  completions: {
1197
1250
  /**
1198
1251
  * Gets the characters that should trigger host-driven completions for the session. Empty disables host-driven completions (e.g. local sessions, or a relay host that does not advertise them).
@@ -1223,7 +1276,7 @@ function createSessionRpc(connection, sessionId) {
1223
1276
  /**
1224
1277
  * Starts fleet mode by submitting the fleet orchestration prompt to the session.
1225
1278
  *
1226
- * @param params Optional user prompt to combine with the fleet orchestration instructions.
1279
+ * @param params Parameters for starting fleet orchestration: an optional user prompt combined with the fleet instructions, plus the send options forwarded to the resulting turn.
1227
1280
  *
1228
1281
  * @returns Indicates whether fleet mode was successfully activated.
1229
1282
  */
@@ -1286,6 +1339,22 @@ function createSessionRpc(connection, sessionId) {
1286
1339
  * @returns Background tasks currently tracked by the session.
1287
1340
  */
1288
1341
  list: async () => connection.sendRequest("session.tasks.list", { sessionId }),
1342
+ /**
1343
+ * Registers a client-owned task, or reclaims an orphaned task belonging to the same extension principal.
1344
+ *
1345
+ * @param params Registers or reclaims a client-owned task.
1346
+ *
1347
+ * @returns Result of registering or reclaiming a client-owned task.
1348
+ */
1349
+ register: async (params) => connection.sendRequest("session.tasks.register", { sessionId, ...params }),
1350
+ /**
1351
+ * Publishes generic progress or a terminal outcome for a client-owned task.
1352
+ *
1353
+ * @param params Updates a client-owned task.
1354
+ *
1355
+ * @returns Result of publishing a client-owned task update.
1356
+ */
1357
+ update: async (params) => connection.sendRequest("session.tasks.update", { sessionId, ...params }),
1289
1358
  /**
1290
1359
  * Refreshes metadata for any detached background shells the runtime knows about.
1291
1360
  *
@@ -1749,7 +1818,7 @@ function createSessionRpc(connection, sessionId) {
1749
1818
  */
1750
1819
  set: async (params) => connection.sendRequest("session.tools.set", { sessionId, ...params }),
1751
1820
  /**
1752
- * Updates the current session's live subagent settings after user settings change. The persisted user settings remain the source of truth for future sessions.
1821
+ * Sets the current session's live subagent settings override, which takes precedence over persisted user settings until cleared. Persisted user settings remain the source of truth for future sessions.
1753
1822
  *
1754
1823
  * @param params Subagent settings to apply to the current session
1755
1824
  *
@@ -2099,6 +2168,20 @@ function createSessionRpc(connection, sessionId) {
2099
2168
  * @returns Point-in-time snapshot of slow-changing session identifier and state fields
2100
2169
  */
2101
2170
  snapshot: async () => connection.sendRequest("session.metadata.snapshot", { sessionId }),
2171
+ /**
2172
+ * Returns the client-owned string metadata persisted with this local session. The metadata is not included in model context, events, telemetry, snapshots, or remote exports.
2173
+ *
2174
+ * @returns Client-owned, case-sensitive string metadata persisted with a local session. Clients should namespace keys by owner. Keys must be non-empty and at most 256 UTF-8 bytes; keys under `copilot/` and `github/` are reserved. Values may contain at most 16 KiB of UTF-8 data. A bag may contain at most 128 entries and its serialized sidecar may contain at most 64 KiB. The runtime stores but never interprets these values.
2175
+ */
2176
+ getClientMetadata: async () => connection.sendRequest("session.metadata.getClientMetadata", { sessionId }),
2177
+ /**
2178
+ * Atomically patches the client-owned string metadata persisted with this local session and returns the committed bag.
2179
+ *
2180
+ * @param params Atomic patch for client-owned session metadata. Operations apply in clear, remove, then set order. The resulting bag must satisfy the ClientMetadata entry and serialized-size limits. Local storage coordinates concurrent runtime processes; custom SessionFs providers must serialize writers that access the same session from multiple processes.
2181
+ *
2182
+ * @returns Client-owned, case-sensitive string metadata persisted with a local session. Clients should namespace keys by owner. Keys must be non-empty and at most 256 UTF-8 bytes; keys under `copilot/` and `github/` are reserved. Values may contain at most 16 KiB of UTF-8 data. A bag may contain at most 128 entries and its serialized sidecar may contain at most 64 KiB. The runtime stores but never interprets these values.
2183
+ */
2184
+ updateClientMetadata: async (params) => connection.sendRequest("session.metadata.updateClientMetadata", { sessionId, ...params }),
2102
2185
  /**
2103
2186
  * Reports whether the local session is currently processing user/agent messages.
2104
2187
  *
@@ -2556,7 +2639,13 @@ function createInternalSessionRpc(connection, sessionId) {
2556
2639
  *
2557
2640
  * @returns Resolved persisted factory identity and resumed run envelope.
2558
2641
  */
2559
- resumeFromTool: async (params) => connection.sendRequest("session.factory.resumeFromTool", { sessionId, ...params })
2642
+ resumeFromTool: async (params) => connection.sendRequest("session.factory.resumeFromTool", { sessionId, ...params }),
2643
+ /**
2644
+ * Atomically pauses an owned factory attempt at a durable checkpoint.
2645
+ *
2646
+ * @param params Parameters for an owned durable pause checkpoint.
2647
+ */
2648
+ pauseAtCheckpoint: async (params) => connection.sendRequest("session.factory.pauseAtCheckpoint", { sessionId, ...params })
2560
2649
  },
2561
2650
  /** @experimental */
2562
2651
  model: {
@@ -2754,6 +2843,11 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
2754
2843
  if (!handler) throw new Error(`No factory handler registered for session: ${params.sessionId}`);
2755
2844
  return handler.abort(params);
2756
2845
  });
2846
+ connection.onRequest("tasks.cancel", async (params) => {
2847
+ const handler = getHandlers(params.sessionId).tasks;
2848
+ if (!handler) throw new Error(`No tasks handler registered for session: ${params.sessionId}`);
2849
+ return handler.cancel(params);
2850
+ });
2757
2851
  connection.onRequest("sessionFs.readFile", async (params) => {
2758
2852
  const handler = getHandlers(params.sessionId).sessionFs;
2759
2853
  if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);