@github/copilot-sdk 1.0.13-preview.4 → 1.0.13

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.
@@ -11,6 +11,17 @@ function createServerRpc(connection) {
11
11
  */
12
12
  ping: async (params) => connection.sendRequest("ping", params),
13
13
  /** @experimental */
14
+ hooks: {
15
+ /**
16
+ * Discovers hook actions enabled under server-side discovery settings from user, repository, plugin, and managed-policy sources.
17
+ *
18
+ * @param params Optional project paths and host-exclusion behavior for server-scoped hook discovery.
19
+ *
20
+ * @returns Server-discovered hook actions and partial-load diagnostics from user, repository, plugin, and managed-policy sources. Concrete sessions may include additional session-specific hook sources.
21
+ */
22
+ discover: async (params) => connection.sendRequest("hooks.discover", params)
23
+ },
24
+ /** @experimental */
14
25
  models: {
15
26
  /**
16
27
  * Lists Copilot models available to the authenticated user.
@@ -399,7 +410,11 @@ function createServerRpc(connection) {
399
410
  *
400
411
  * @returns Validated device-managed settings discovered before a session exists.
401
412
  */
402
- 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", {})
403
418
  },
404
419
  /** @experimental */
405
420
  runtime: {
@@ -478,6 +493,14 @@ function createServerRpc(connection) {
478
493
  * @returns Sessions matching the filter, ordered most-recently-modified first.
479
494
  */
480
495
  list: async (params) => connection.sendRequest("sessions.list", params),
496
+ /**
497
+ * 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.
498
+ *
499
+ * @param params Pagination options for reading an inactive or active local session's persisted event journal.
500
+ *
501
+ * @returns Batch of session events returned by a read, with cursor and continuation metadata.
502
+ */
503
+ readPersistedEvents: async (params) => connection.sendRequest("sessions.readPersistedEvents", params),
481
504
  /**
482
505
  * Finds the local session bound to a GitHub task ID, if any.
483
506
  *
@@ -955,9 +978,9 @@ function createSessionRpc(connection, sessionId) {
955
978
  /** @experimental */
956
979
  model: {
957
980
  /**
958
- * Gets the currently selected model for the session.
981
+ * Gets the session's authoritative model snapshot, including the committed Auto preference and any newer unclaimed Auto preference waiting for a future user turn.
959
982
  *
960
- * @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.
983
+ * @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.
961
984
  */
962
985
  getCurrent: async () => connection.sendRequest("session.model.getCurrent", { sessionId }),
963
986
  /**
@@ -968,6 +991,14 @@ function createSessionRpc(connection, sessionId) {
968
991
  * @returns The model identifier active on the session after the switch.
969
992
  */
970
993
  switchTo: async (params) => connection.sendRequest("session.model.switchTo", { sessionId, ...params }),
994
+ /**
995
+ * 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`.
996
+ *
997
+ * @param params An Auto preference request for the session. This updates Auto configuration only; it does not change the selected model to `auto`.
998
+ *
999
+ * @returns Immediate acknowledgement and Auto preference snapshot after a switch request. This result never implies that a pending preference committed.
1000
+ */
1001
+ switchAutoTier: async (params) => connection.sendRequest("session.model.switchAutoTier", { sessionId, ...params }),
971
1002
  /**
972
1003
  * Updates the session's reasoning effort without changing the selected model.
973
1004
  *
@@ -1174,6 +1205,15 @@ function createSessionRpc(connection, sessionId) {
1174
1205
  diff: async (params) => connection.sendRequest("session.workspaces.diff", { sessionId, ...params })
1175
1206
  },
1176
1207
  /** @experimental */
1208
+ autopilotObjective: {
1209
+ /**
1210
+ * Reads the current canonical autopilot objective state for this session.
1211
+ *
1212
+ * @returns Canonical runtime state for the session's current autopilot objective.
1213
+ */
1214
+ getState: async () => connection.sendRequest("session.autopilotObjective.getState", { sessionId })
1215
+ },
1216
+ /** @experimental */
1177
1217
  completions: {
1178
1218
  /**
1179
1219
  * 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).
@@ -1267,6 +1307,22 @@ function createSessionRpc(connection, sessionId) {
1267
1307
  * @returns Background tasks currently tracked by the session.
1268
1308
  */
1269
1309
  list: async () => connection.sendRequest("session.tasks.list", { sessionId }),
1310
+ /**
1311
+ * Registers a client-owned task, or reclaims an orphaned task belonging to the same extension principal.
1312
+ *
1313
+ * @param params Registers or reclaims a client-owned task.
1314
+ *
1315
+ * @returns Result of registering or reclaiming a client-owned task.
1316
+ */
1317
+ register: async (params) => connection.sendRequest("session.tasks.register", { sessionId, ...params }),
1318
+ /**
1319
+ * Publishes generic progress or a terminal outcome for a client-owned task.
1320
+ *
1321
+ * @param params Updates a client-owned task.
1322
+ *
1323
+ * @returns Result of publishing a client-owned task update.
1324
+ */
1325
+ update: async (params) => connection.sendRequest("session.tasks.update", { sessionId, ...params }),
1270
1326
  /**
1271
1327
  * Refreshes metadata for any detached background shells the runtime knows about.
1272
1328
  *
@@ -2735,6 +2791,11 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
2735
2791
  if (!handler) throw new Error(`No factory handler registered for session: ${params.sessionId}`);
2736
2792
  return handler.abort(params);
2737
2793
  });
2794
+ connection.onRequest("tasks.cancel", async (params) => {
2795
+ const handler = getHandlers(params.sessionId).tasks;
2796
+ if (!handler) throw new Error(`No tasks handler registered for session: ${params.sessionId}`);
2797
+ return handler.cancel(params);
2798
+ });
2738
2799
  connection.onRequest("sessionFs.readFile", async (params) => {
2739
2800
  const handler = getHandlers(params.sessionId).sessionFs;
2740
2801
  if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);