@github/copilot-language-server 1.552.0 → 1.553.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.
Files changed (74) hide show
  1. package/README.md +94 -1
  2. package/dist/main.js +1021 -1011
  3. package/dist/node_modules/@github/copilot-sdk/dist/cjs/cliVersion.js +1 -1
  4. package/dist/node_modules/@github/copilot-sdk/dist/cjs/client.js +499 -36
  5. package/dist/node_modules/@github/copilot-sdk/dist/cjs/copilotRequestHandler.js +156 -20
  6. package/dist/node_modules/@github/copilot-sdk/dist/cjs/extension.js +11 -9
  7. package/dist/node_modules/@github/copilot-sdk/dist/cjs/ffiRuntimeHost.js +14 -3
  8. package/dist/node_modules/@github/copilot-sdk/dist/cjs/generated/rpc.js +1305 -304
  9. package/dist/node_modules/@github/copilot-sdk/dist/cjs/host.js +67 -0
  10. package/dist/node_modules/@github/copilot-sdk/dist/cjs/index.js +12 -7
  11. package/dist/node_modules/@github/copilot-sdk/dist/cjs/installationConfirmation.js +98 -0
  12. package/dist/node_modules/@github/copilot-sdk/dist/cjs/runtimeArtifacts.js +1 -0
  13. package/dist/node_modules/@github/copilot-sdk/dist/cjs/schema.js +40 -0
  14. package/dist/node_modules/@github/copilot-sdk/dist/cjs/session.js +474 -151
  15. package/dist/node_modules/@github/copilot-sdk/dist/cjs/sessionFsProvider.js +57 -0
  16. package/dist/node_modules/@github/copilot-sdk/dist/cjs/types.js +5 -2
  17. package/dist/node_modules/@github/copilot-sdk/dist/cjs/{factory.js → workflow.js} +33 -33
  18. package/dist/node_modules/@github/copilot-sdk/package.json +27 -16
  19. package/dist/node_modules/zod/locales/package.json +1 -2
  20. package/dist/node_modules/zod/mini/package.json +1 -2
  21. package/dist/node_modules/zod/package.json +1 -1
  22. package/dist/node_modules/zod/v3/package.json +1 -2
  23. package/dist/node_modules/zod/v4/classic/errors.js +2 -2
  24. package/dist/node_modules/zod/v4/classic/from-json-schema.cjs +16 -31
  25. package/dist/node_modules/zod/v4/classic/from-json-schema.js +16 -31
  26. package/dist/node_modules/zod/v4/classic/package.json +1 -2
  27. package/dist/node_modules/zod/v4/classic/schemas.cjs +119 -358
  28. package/dist/node_modules/zod/v4/classic/schemas.js +118 -356
  29. package/dist/node_modules/zod/v4/core/api.cjs +2 -7
  30. package/dist/node_modules/zod/v4/core/api.js +2 -7
  31. package/dist/node_modules/zod/v4/core/core.cjs +1 -3
  32. package/dist/node_modules/zod/v4/core/core.js +2 -4
  33. package/dist/node_modules/zod/v4/core/errors.cjs +23 -26
  34. package/dist/node_modules/zod/v4/core/errors.js +23 -26
  35. package/dist/node_modules/zod/v4/core/json-schema-processors.cjs +20 -16
  36. package/dist/node_modules/zod/v4/core/json-schema-processors.js +20 -16
  37. package/dist/node_modules/zod/v4/core/package.json +1 -2
  38. package/dist/node_modules/zod/v4/core/parse.cjs +7 -7
  39. package/dist/node_modules/zod/v4/core/parse.js +7 -7
  40. package/dist/node_modules/zod/v4/core/regexes.cjs +3 -9
  41. package/dist/node_modules/zod/v4/core/regexes.js +1 -7
  42. package/dist/node_modules/zod/v4/core/schemas.cjs +65 -211
  43. package/dist/node_modules/zod/v4/core/schemas.js +64 -210
  44. package/dist/node_modules/zod/v4/core/to-json-schema.cjs +1 -12
  45. package/dist/node_modules/zod/v4/core/to-json-schema.js +1 -12
  46. package/dist/node_modules/zod/v4/core/util.cjs +30 -54
  47. package/dist/node_modules/zod/v4/core/util.js +32 -55
  48. package/dist/node_modules/zod/v4/core/versions.cjs +2 -2
  49. package/dist/node_modules/zod/v4/core/versions.js +2 -2
  50. package/dist/node_modules/zod/v4/locales/en.cjs +0 -4
  51. package/dist/node_modules/zod/v4/locales/en.js +0 -4
  52. package/dist/node_modules/zod/v4/locales/fr.cjs +7 -24
  53. package/dist/node_modules/zod/v4/locales/fr.js +7 -24
  54. package/dist/node_modules/zod/v4/locales/index.cjs +1 -8
  55. package/dist/node_modules/zod/v4/locales/index.js +0 -3
  56. package/dist/node_modules/zod/v4/locales/it.cjs +1 -1
  57. package/dist/node_modules/zod/v4/locales/it.js +1 -1
  58. package/dist/node_modules/zod/v4/locales/ka.cjs +8 -8
  59. package/dist/node_modules/zod/v4/locales/ka.js +8 -8
  60. package/dist/node_modules/zod/v4/locales/package.json +1 -2
  61. package/dist/node_modules/zod/v4/locales/uz.cjs +0 -1
  62. package/dist/node_modules/zod/v4/locales/uz.js +0 -1
  63. package/dist/node_modules/zod/v4/mini/package.json +1 -2
  64. package/dist/node_modules/zod/v4/mini/schemas.cjs +4 -41
  65. package/dist/node_modules/zod/v4/mini/schemas.js +4 -40
  66. package/dist/node_modules/zod/v4/package.json +1 -2
  67. package/dist/node_modules/zod/v4-mini/package.json +1 -2
  68. package/package.json +20 -20
  69. package/dist/node_modules/zod/v4/locales/el.cjs +0 -136
  70. package/dist/node_modules/zod/v4/locales/el.js +0 -109
  71. package/dist/node_modules/zod/v4/locales/hr.cjs +0 -149
  72. package/dist/node_modules/zod/v4/locales/hr.js +0 -122
  73. package/dist/node_modules/zod/v4/locales/ro.cjs +0 -146
  74. package/dist/node_modules/zod/v4/locales/ro.js +0 -119
@@ -28,6 +28,68 @@ __export(rpc_exports, {
28
28
  module.exports = __toCommonJS(rpc_exports);
29
29
  function createServerRpc(connection) {
30
30
  return {
31
+ /** @experimental */
32
+ environments: {
33
+ /**
34
+ * Lists GitHub Mission Control environments visible to the authenticated identity. Does not require a running host and excludes host relay credentials.
35
+ *
36
+ * @param params Optional discovery filters supported by GitHub Mission Control.
37
+ *
38
+ * @returns Environments visible to the authenticated caller and matching the supplied filters.
39
+ */
40
+ list: async (params) => connection.sendRequest("environments.list", params),
41
+ /**
42
+ * Gets safe discovery information for a GitHub Mission Control environment without requiring a running host.
43
+ *
44
+ * @param params Identify a Mission Control environment to retrieve.
45
+ *
46
+ * @returns Safe discovery information for the requested environment.
47
+ */
48
+ get: async (params) => connection.sendRequest("environments.get", params),
49
+ /**
50
+ * Deletes a user-managed GitHub Mission Control environment. GitHub-managed environments cannot be deleted. Does not stop a running host, which may register again.
51
+ *
52
+ * @param params Identify a user-managed Mission Control environment to delete.
53
+ *
54
+ * @returns Acknowledgement that the requested environment was deleted.
55
+ */
56
+ delete: async (params) => connection.sendRequest("environments.delete", params)
57
+ },
58
+ /** @experimental */
59
+ host: {
60
+ /**
61
+ * Publishes an attached resident session for this listener's lifetime without copying it.
62
+ *
63
+ * @param params Publishes a resident session attached to the listener's owning connection.
64
+ *
65
+ * @returns The existing runtime identity and its resource on the listener.
66
+ */
67
+ publishSession: async (params) => connection.sendRequest("host.publishSession", params),
68
+ /**
69
+ * Reads the complete advertised live and dormant session catalog of an existing host owned by this connection. Does not start hosting, subscribe to sessions, or guarantee resumability.
70
+ *
71
+ * @param params Reads a running host's catalog or the runtime's saved default catalog.
72
+ *
73
+ * @returns The complete live and dormant advertised catalog, without subscribing to sessions.
74
+ */
75
+ listSessions: async (params) => connection.sendRequest("host.listSessions", params),
76
+ /**
77
+ * Starts a connection-owned AHP host with explicit localServer and/or githubEnvironment transports as a supervised SDK participant.
78
+ *
79
+ * @param params Starts a supervised AHP host with at least one explicitly selected transport.
80
+ *
81
+ * @returns Listener readiness, returned only after binding and the supervised participant's SDK handshake.
82
+ */
83
+ start: async (params) => connection.sendRequest("host.start", params),
84
+ /**
85
+ * Stops a listener owned by this SDK connection and joins its cleanup without deleting sessions.
86
+ *
87
+ * @param params Stops a connection-owned listener and joins its teardown.
88
+ *
89
+ * @returns Empty acknowledgement for a completed host lifecycle operation.
90
+ */
91
+ dispose: async (params) => connection.sendRequest("host.dispose", params)
92
+ },
31
93
  /**
32
94
  * Checks server responsiveness and returns protocol information.
33
95
  *
@@ -67,6 +129,56 @@ function createServerRpc(connection) {
67
129
  getBuiltInCatalog: async () => connection.sendRequest("models.getBuiltInCatalog", {})
68
130
  },
69
131
  /** @experimental */
132
+ sandbox: {
133
+ /**
134
+ * Reports whether the host running this runtime can run the command sandbox, without starting a session or spawning a sandboxed command.
135
+ *
136
+ * @returns Whether the host running this runtime can run the command sandbox. The runtime checks `supported` once per process. A capability answer can change while the process runs, for example after the user installs a missing package.
137
+ */
138
+ getHostSupport: async () => connection.sendRequest("sandbox.getHostSupport", {}),
139
+ /** @experimental */
140
+ proxyCa: {
141
+ /**
142
+ * Reports whether the persistent certificate authority of the sandbox credential proxy exists, whether OS trust includes it, and whether it must be rotated. Changes nothing.
143
+ *
144
+ * @param params Identifies the credential hosts that the persistent certificate authority of the sandbox credential proxy must cover. The runtime always adds the hosts from the saved user settings.
145
+ *
146
+ * @returns Status of the persistent certificate authority of the sandbox credential proxy.
147
+ */
148
+ getStatus: async (params) => connection.sendRequest("sandbox.proxyCa.getStatus", params),
149
+ /**
150
+ * Creates the persistent certificate authority of the sandbox credential proxy if none is stored, without changing OS trust, and returns the path of its public certificate. Keeps an existing certificate authority, even one that must be rotated. Fails where OS trust is unsupported. Trust it with sandbox.proxyCa.trust: the CLI trusts only the hosts in the saved user settings, so it refuses a certificate authority that also covers hosts from sandboxConfig.
151
+ *
152
+ * @param params Identifies the credential hosts that the persistent certificate authority of the sandbox credential proxy must cover. The runtime always adds the hosts from the saved user settings.
153
+ *
154
+ * @returns Result of creating the persistent certificate authority of the sandbox credential proxy.
155
+ */
156
+ create: async (params) => connection.sendRequest("sandbox.proxyCa.create", params),
157
+ /**
158
+ * Replaces the persistent certificate authority of the sandbox credential proxy with a new one for the current credential hosts. If OS trust included the old one, removes it and trusts the new one, which can show an OS authentication prompt. Running sandboxed tools keep the old certificate authority until they restart.
159
+ *
160
+ * @param params Identifies the credential hosts that the persistent certificate authority of the sandbox credential proxy must cover. The runtime always adds the hosts from the saved user settings.
161
+ *
162
+ * @returns Status of the persistent certificate authority of the sandbox credential proxy.
163
+ */
164
+ rotate: async (params) => connection.sendRequest("sandbox.proxyCa.rotate", params),
165
+ /**
166
+ * Adds the persistent certificate authority of the sandbox credential proxy to OS trust, so sandboxed clients that read only OS trust accept the proxy. Call create first. Refuses a certificate authority that is not constrained to the current credential hosts. Can show an OS authentication prompt.
167
+ *
168
+ * @param params Identifies the credential hosts that the persistent certificate authority of the sandbox credential proxy must cover. The runtime always adds the hosts from the saved user settings.
169
+ *
170
+ * @returns Status of the persistent certificate authority of the sandbox credential proxy.
171
+ */
172
+ trust: async (params) => connection.sendRequest("sandbox.proxyCa.trust", params),
173
+ /**
174
+ * Removes the persistent certificate authority of the sandbox credential proxy from OS trust. Keeps the stored certificate authority. Can show an OS authentication prompt. Sandboxed clients that read only OS trust then reject the proxy; clients that read the per-process certificate bundle continue to work.
175
+ *
176
+ * @returns Status of the persistent certificate authority of the sandbox credential proxy.
177
+ */
178
+ remove: async () => connection.sendRequest("sandbox.proxyCa.remove", {})
179
+ }
180
+ },
181
+ /** @experimental */
70
182
  tools: {
71
183
  /**
72
184
  * Lists built-in tools available for a model.
@@ -187,7 +299,74 @@ function createServerRpc(connection) {
187
299
  *
188
300
  * @returns Outcome of an mcp.planInstall call: either a normalised plan, or one typed refusal. Nothing is written in either case.
189
301
  */
190
- planInstall: async (params) => connection.sendRequest("mcp.planInstall", params)
302
+ planInstall: async (params) => connection.sendRequest("mcp.planInstall", params),
303
+ /**
304
+ * Consumes a bound catalogue plan and retains one exact fully resolved personal remote MCP operation requiring no supplied values or configured secrets. Returns its runtime operation ID and original expiry before any confirmation, activation, writer initialisation or installation effect. Register the original connection, operation and selected-session binding before calling applyInstall. Missing lower owned admission is unavailable, never a raw-config fallback.
305
+ *
306
+ * @param params Side-effect-free preparation of one original bound remote MCP choice.
307
+ *
308
+ * @returns Management result with contract receipt, or a typed request/negotiation refusal.
309
+ */
310
+ prepareInstall: async (params) => connection.sendRequest("mcp.prepareInstall", params),
311
+ /**
312
+ * Consumes a retained prepared MCP operation once, revalidates its original authority, requests explicit human consent through installations.confirm on the original connection, then revalidates source and applies the sealed transaction. An uncertain result requires original-operation inspection or recovery, never replay.
313
+ *
314
+ * @param params Applies exactly one previously prepared operation on its original connection.
315
+ *
316
+ * @returns An installation result together with the exact honoured contract, or a negotiation refusal.
317
+ */
318
+ applyInstall: async (params) => connection.sendRequest("mcp.applyInstall", params),
319
+ /**
320
+ * Prepares a read-only removal plan for an exact owned receipt under the selected existing session. Returns the original operation ID before confirmation; neither planning nor abandonment changes configuration or shared OAuth credentials.
321
+ *
322
+ * @param params Read-only preparation of one owned removal under fresh selected-session authority.
323
+ *
324
+ * @returns Management result with contract receipt, or a typed request/negotiation refusal.
325
+ */
326
+ planUninstall: async (params) => connection.sendRequest("mcp.planUninstall", params),
327
+ /**
328
+ * Consumes the original owned-removal plan once and requests fresh exact human confirmation on its original connection. Drift is refused; unrelated manual configuration and shared OAuth credentials are preserved.
329
+ *
330
+ * @param params One-use application of the exact retained removal plan.
331
+ *
332
+ * @returns An installation result together with the exact honoured contract, or a negotiation refusal.
333
+ */
334
+ applyUninstall: async (params) => connection.sendRequest("mcp.applyUninstall", params),
335
+ /** @experimental */
336
+ installations: {
337
+ /**
338
+ * Reads receipt-owned MCP inventory for the selected account and host without activating servers or reconstructing missing ownership. Configuration ownership does not prove session-specific usability.
339
+ *
340
+ * @param params New-work inventory or recovery request under an explicitly selected existing session.
341
+ *
342
+ * @returns Management result with contract receipt, or a typed request/negotiation refusal.
343
+ */
344
+ list: async (params) => connection.sendRequest("mcp.installations.list", params),
345
+ /**
346
+ * Reconciles already-confirmed durable MCP transactions, then inspects owned inventory. Does not replay apply or reconstruct deleted ownership metadata; unresolved or unsafe evidence remains an explicit refusal.
347
+ *
348
+ * @param params New-work inventory or recovery request under an explicitly selected existing session.
349
+ *
350
+ * @returns Management result with contract receipt, or a typed request/negotiation refusal.
351
+ */
352
+ recover: async (params) => connection.sendRequest("mcp.installations.recover", params),
353
+ /**
354
+ * Inspects a known operation only on its original connection. Remains available after account or selected-session loss; does not acquire new authority or rebind an operation.
355
+ *
356
+ * @param params Existing-operation control. A new session selector is deliberately not accepted.
357
+ *
358
+ * @returns Management result with contract receipt, or a typed request/negotiation refusal.
359
+ */
360
+ status: async (params) => connection.sendRequest("mcp.installations.status", params),
361
+ /**
362
+ * Requests cancellation of a known operation on its original connection, including before apply or confirmation. Already-started effects retain their transaction lease and report an honest terminal or recovery outcome.
363
+ *
364
+ * @param params Existing-operation control. A new session selector is deliberately not accepted.
365
+ *
366
+ * @returns Management result with contract receipt, or a typed request/negotiation refusal.
367
+ */
368
+ cancel: async (params) => connection.sendRequest("mcp.installations.cancel", params)
369
+ }
191
370
  },
192
371
  /** @experimental */
193
372
  extensions: {
@@ -210,6 +389,115 @@ function createServerRpc(connection) {
210
389
  */
211
390
  disable: async (params) => connection.sendRequest("extensions.disable", params)
212
391
  },
392
+ /** @experimental */
393
+ skills: {
394
+ /**
395
+ * Plans installation of a verified Agent Finder Skill candidate without writing files. The returned review is safe to present to a user and installing always leaves the Skill disabled until separately enabled.
396
+ *
397
+ * @param params Side-effect-free planning of one verified Agent Finder Skill candidate.
398
+ *
399
+ * @returns Skill installation management result with the honoured contract, or a typed refusal.
400
+ */
401
+ planInstall: async (params) => connection.sendRequest("skills.planInstall", params),
402
+ /**
403
+ * Consumes one verified Skill installation plan, requests explicit human consent through installations.confirm on the original connection, then revalidates and installs the Skill disabled.
404
+ *
405
+ * @param params Applies exactly one retained verified Skill installation plan.
406
+ *
407
+ * @returns Skill installation result with the honoured contract, or a typed request/negotiation refusal.
408
+ */
409
+ applyInstall: async (params) => connection.sendRequest("skills.applyInstall", params),
410
+ /** @experimental */
411
+ installations: {
412
+ /**
413
+ * Lists owned verified Agent Finder Skill installations for the selected existing session. Listing is never gated by the Skill-install feature flag.
414
+ *
415
+ * @param params Inventory request under an explicitly selected existing session.
416
+ *
417
+ * @returns Skill installation management result with the honoured contract, or a typed refusal.
418
+ */
419
+ list: async (params) => connection.sendRequest("skills.installations.list", params),
420
+ /**
421
+ * Reconciles interrupted owned Skill installation work for the selected existing session, then inspects owned inventory. Recovery is never gated by the Skill-install feature flag.
422
+ *
423
+ * @param params Inventory request under an explicitly selected existing session.
424
+ *
425
+ * @returns Skill installation management result with the honoured contract, or a typed refusal.
426
+ */
427
+ recover: async (params) => connection.sendRequest("skills.installations.recover", params),
428
+ /**
429
+ * Inspects a known Skill installation operation on its original runtime connection. Status is never gated by the Skill-install feature flag.
430
+ *
431
+ * @param params Existing-operation control. A new session selector is deliberately not accepted.
432
+ *
433
+ * @returns Skill installation management result with the honoured contract, or a typed refusal.
434
+ */
435
+ status: async (params) => connection.sendRequest("skills.installations.status", params),
436
+ /**
437
+ * Requests cancellation of a known Skill installation operation before commit. Already-started durable work requires recovery instead of silent replay.
438
+ *
439
+ * @param params Existing-operation control. A new session selector is deliberately not accepted.
440
+ *
441
+ * @returns Skill installation management result with the honoured contract, or a typed refusal.
442
+ */
443
+ cancel: async (params) => connection.sendRequest("skills.installations.cancel", params),
444
+ /**
445
+ * Atomically persists enablement for one owned Agent Finder Skill and reconciles the selected bound session. Enablement is installation-scoped by receipt identity and is never gated by the Skill-install feature flag.
446
+ *
447
+ * @param params Persisted enablement update for one owned Skill installation.
448
+ *
449
+ * @returns Skill installation management result with the honoured contract, or a typed refusal.
450
+ */
451
+ setEnabled: async (params) => connection.sendRequest("skills.installations.setEnabled", params)
452
+ },
453
+ /**
454
+ * Prepares a read-only removal plan for an owned verified Agent Finder Skill installation. Uninstall planning is never gated by the Skill-install feature flag.
455
+ *
456
+ * @param params Read-only preparation of one owned Skill removal under fresh selected-session authority.
457
+ *
458
+ * @returns Skill installation management result with the honoured contract, or a typed refusal.
459
+ */
460
+ planUninstall: async (params) => connection.sendRequest("skills.planUninstall", params),
461
+ /**
462
+ * Consumes an owned Skill removal plan, requests explicit human consent through installations.confirm, refuses drift, and removes the exact owned files through quarantine.
463
+ *
464
+ * @param params One-use application of the exact retained Skill removal plan.
465
+ *
466
+ * @returns Skill installation result with the honoured contract, or a typed request/negotiation refusal.
467
+ */
468
+ applyUninstall: async (params) => connection.sendRequest("skills.applyUninstall", params),
469
+ /** @experimental */
470
+ config: {
471
+ /**
472
+ * Replaces the global list of disabled skills.
473
+ *
474
+ * @param params Skill names to mark as disabled in global configuration, replacing any previous list.
475
+ */
476
+ setDisabledSkills: async (params) => connection.sendRequest("skills.config.setDisabledSkills", params),
477
+ /**
478
+ * Atomically adds or removes one skill from the disabled list.
479
+ *
480
+ * @param params Adds or removes a single skill from the global disabled list, leaving every other entry untouched.
481
+ */
482
+ setSkillDisabled: async (params) => connection.sendRequest("skills.config.setSkillDisabled", params)
483
+ },
484
+ /**
485
+ * Discovers skills across global and project sources.
486
+ *
487
+ * @param params Optional project paths and additional skill directories to include in discovery.
488
+ *
489
+ * @returns Skills discovered across global and project sources.
490
+ */
491
+ discover: async (params) => connection.sendRequest("skills.discover", params),
492
+ /**
493
+ * Returns the canonical directories where a client may create skills that the runtime will recognize, including ones that do not exist yet. Project directories become active once created.
494
+ *
495
+ * @param params Optional project paths to enumerate.
496
+ *
497
+ * @returns Canonical locations where skills can be created so the runtime will recognize them.
498
+ */
499
+ getDiscoveryPaths: async (params) => connection.sendRequest("skills.getDiscoveryPaths", params)
500
+ },
213
501
  /**
214
502
  * Registers the calling SDK client as the per-entrypoint extension launch provider. Call before creating any sessions. When omitted, the runtime uses its built-in extension launcher.
215
503
  *
@@ -225,7 +513,15 @@ function createServerRpc(connection) {
225
513
  *
226
514
  * @returns Outcome of a catalog.search call: either bounded inert candidates, or one typed refusal. Never a partial success.
227
515
  */
228
- search: async (params) => connection.sendRequest("catalog.search", params)
516
+ search: async (params) => connection.sendRequest("catalog.search", params),
517
+ /**
518
+ * Terminates one retained catalog selection group. A selected outcome returns the native host a fresh single-use candidate handle plus the original searchId for a later explicit mcp.planInstall call; non-selected outcomes release the group without producing a planning input. Candidate state, cards, URLs, credentials and private identifiers remain inside the runtime. The model-facing catalog_select tool projects the result separately and never exposes the candidate handle or searchId.
519
+ *
520
+ * @param params Terminates one retained catalog selection group through an opaque reference previously returned by the model-safe search projection.
521
+ *
522
+ * @returns Typed outcome of catalog.select. Only the selected host result carries a fresh candidate handle; the model-facing projection removes both that handle and searchId.
523
+ */
524
+ select: async (params) => connection.sendRequest("catalog.select", params)
229
525
  },
230
526
  /** @experimental */
231
527
  plugins: {
@@ -327,40 +623,6 @@ function createServerRpc(connection) {
327
623
  }
328
624
  },
329
625
  /** @experimental */
330
- skills: {
331
- /** @experimental */
332
- config: {
333
- /**
334
- * Replaces the global list of disabled skills.
335
- *
336
- * @param params Skill names to mark as disabled in global configuration, replacing any previous list.
337
- */
338
- setDisabledSkills: async (params) => connection.sendRequest("skills.config.setDisabledSkills", params),
339
- /**
340
- * Atomically adds or removes one skill from the disabled list.
341
- *
342
- * @param params Adds or removes a single skill from the global disabled list, leaving every other entry untouched.
343
- */
344
- setSkillDisabled: async (params) => connection.sendRequest("skills.config.setSkillDisabled", params)
345
- },
346
- /**
347
- * Discovers skills across global and project sources.
348
- *
349
- * @param params Optional project paths and additional skill directories to include in discovery.
350
- *
351
- * @returns Skills discovered across global and project sources.
352
- */
353
- discover: async (params) => connection.sendRequest("skills.discover", params),
354
- /**
355
- * Returns the canonical directories where a client may create skills that the runtime will recognize, including ones that do not exist yet. Project directories become active once created.
356
- *
357
- * @param params Optional project paths to enumerate.
358
- *
359
- * @returns Canonical locations where skills can be created so the runtime will recognize them.
360
- */
361
- getDiscoveryPaths: async (params) => connection.sendRequest("skills.getDiscoveryPaths", params)
362
- },
363
- /** @experimental */
364
626
  agents: {
365
627
  /**
366
628
  * Discovers custom agents across user, project, plugin, and remote sources.
@@ -412,21 +674,15 @@ function createServerRpc(connection) {
412
674
  /** @experimental */
413
675
  settings: {
414
676
  /**
415
- * Drops this runtime process's in-memory user settings cache so the next settings read observes disk.
416
- */
417
- reload: async () => connection.sendRequest("user.settings.reload", {}),
418
- /**
419
- * Lists every known user setting (settings.json overlaid with the legacy config.json, config.json wins), each with its effective value, its default, and whether it is at the default — so settings the user has never set still appear with their default value. Does not include repository- or enterprise-managed overrides that the runtime layers on top at session time.
677
+ * Lists every known user setting from settings.json, each with its effective value, its default, and whether it is at the default — so settings the user has never set still appear with their default value. Does not include repository- or enterprise-managed overrides that the runtime layers on top at session time.
420
678
  *
421
- * @returns Per-key metadata for every known user setting (settings.json overlaid with the legacy config.json, config.json wins), including settings left at their default. Excludes repository- and enterprise-managed overrides.
679
+ * @returns Per-key metadata for every known user setting in settings.json, including settings left at their default. Excludes repository- and enterprise-managed overrides.
422
680
  */
423
681
  get: async () => connection.sendRequest("user.settings.get", {}),
424
682
  /**
425
- * Writes one or more user settings to settings.json, replacing each provided top-level key. A key whose value is null is removed. Returns the keys whose new value is shadowed by a legacy config.json entry (config.json wins on read), which the runtime leaves in place — such writes do not take effect until the legacy value is removed.
683
+ * Writes one or more user settings to settings.json, replacing each provided top-level key. A key whose value is null is removed.
426
684
  *
427
685
  * @param params Partial user settings to write to settings.json. Each top-level key is written individually, replacing the existing value; a key whose value is null is removed.
428
- *
429
- * @returns Outcome of writing user settings.
430
686
  */
431
687
  set: async (params) => connection.sendRequest("user.settings.set", params)
432
688
  }
@@ -434,15 +690,45 @@ function createServerRpc(connection) {
434
690
  /** @experimental */
435
691
  managedSettings: {
436
692
  /**
437
- * Discovers device-managed settings from production MDM and managed-file sources, validates them against the runtime-owned managed-settings schema, and returns the canonical JSON without requiring a session.
693
+ * Discovers device-managed settings from production MDM and managed-file sources, validates them against the runtime-owned managed-settings schema, and returns the canonical JSON without requiring a session. `managedSettings.resolve` returns the same device settings together with the account's server policy.
438
694
  *
439
695
  * @returns Validated device-managed settings discovered before a session exists.
440
696
  */
441
697
  read: async () => connection.sendRequest("managedSettings.read", {}),
442
698
  /**
443
- * 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.
699
+ * 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 call `managedSettings.resolve` or 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.
700
+ */
701
+ clearCache: async () => connection.sendRequest("managedSettings.clearCache", {}),
702
+ /**
703
+ * Resolves the effective enterprise managed settings without a session, from the device channel and, when an account is available, the account's server policy through the same per-account cache sessions use. A cached server policy less than an hour old is used without a fetch; otherwise the policy is fetched, and when the fetch fails a cached policy up to 24 hours old is used instead, unless `forceRemoteSettingsRefresh` requires a live fetch. With no account requested or signed in, it reports device policy only; signing out removes the account's cached policy. It can fetch server policy over the network when the cache is stale, so call it off latency-critical paths such as startup rather than before listing models. The policy helper is not run. `layers` lists each channel's document before merging, and `values` and `meta` carry typed effective values and their lock state for the keys typed so far.
704
+ *
705
+ * @param params Optional opaque account selection or GitHub token whose managed settings are resolved.
706
+ *
707
+ * @returns Effective enterprise managed settings for an account, resolved without a session.
708
+ */
709
+ resolve: async (params) => connection.sendRequest("managedSettings.resolve", params),
710
+ /**
711
+ * Returns the managed-settings authoring JSON schema with descriptive `x-composition` annotations aligned with the shared settings-engine vocabulary. These annotations are not a complete runtime composition contract: model, effortLevel, and contextTier remain coupled. Use `managedSettings.compose` for the runtime's effective result. Performs no I/O.
712
+ *
713
+ * @returns The authoring JSON schema for managed settings recognized by this runtime.
714
+ */
715
+ schema: async () => connection.sendRequest("managedSettings.schema", {}),
716
+ /**
717
+ * Validates a candidate managed-settings document the way the runtime validates delivered policy, without applying it. Reports errors that would reject the document, warnings for content the runtime ignores, and the canonical document it would apply. Document text nested more than 64 levels deep is rejected. Performs no I/O.
718
+ *
719
+ * @param params A candidate managed-settings document to validate without applying it.
720
+ *
721
+ * @returns Result of validating a managed-settings document.
444
722
  */
445
- clearCache: async () => connection.sendRequest("managedSettings.clearCache", {})
723
+ validate: async (params) => connection.sendRequest("managedSettings.validate", params),
724
+ /**
725
+ * Merges candidate managed-settings documents for the device, server, and policy-helper channels into the effective settings the runtime would enforce on this host, using the same precedence and composition rules as live resolution, without applying them. Like live resolution, a server's advisory sandbox force-enable is declined on a host that cannot run the sandbox. Does not fetch policy or read policy files, but may perform blocking OS or subprocess probes for sandbox support. Preview documents are limited to 1 MiB and 64 levels of nesting.
726
+ *
727
+ * @param params Candidate managed-settings documents to merge without applying them.
728
+ *
729
+ * @returns The effective managed settings the runtime would enforce for the given documents, in the same shape `managedSettings.resolve` returns.
730
+ */
731
+ compose: async (params) => connection.sendRequest("managedSettings.compose", params)
446
732
  },
447
733
  /** @experimental */
448
734
  runtime: {
@@ -456,7 +742,7 @@ function createServerRpc(connection) {
456
742
  /**
457
743
  * Registers an SDK client as the session filesystem provider.
458
744
  *
459
- * @param params Initial working directory, session-state path layout, and path conventions used to register the calling SDK client as the session filesystem provider.
745
+ * @param params Initial working directory, session-state path layout, and path conventions used to register the calling SDK client as the session filesystem provider. A registered provider is authoritative for path interpretation and filesystem facts used by workspace permission validation. Paths are interpreted lexically; home-relative paths (`~` and `~/...`) and Windows drive-relative paths such as `C:foo` are unsupported. Until provider-side canonicalization is supported, providers must not expose symlinks inside allowed roots that escape those roots.
460
746
  *
461
747
  * @returns Indicates whether the calling client was registered as the session filesystem provider.
462
748
  */
@@ -696,11 +982,81 @@ function createServerRpc(connection) {
696
982
  * @returns Outcome of an agentRegistry.spawn call.
697
983
  */
698
984
  spawn: async (params) => connection.sendRequest("agentRegistry.spawn", params)
985
+ },
986
+ /** @experimental */
987
+ connectors: {
988
+ /**
989
+ * Returns feature availability.
990
+ *
991
+ * @returns Feature availability.
992
+ */
993
+ getCapabilities: async () => connection.sendRequest("connectors.getCapabilities", {}),
994
+ /**
995
+ * Returns eligible accounts.
996
+ *
997
+ * @returns Eligible accounts.
998
+ */
999
+ getAccounts: async () => connection.sendRequest("connectors.getAccounts", {}),
1000
+ /**
1001
+ * Lists entries for the selected account.
1002
+ *
1003
+ * @param params Selected account.
1004
+ *
1005
+ * @returns Entries for the selected account.
1006
+ */
1007
+ list: async (params) => connection.sendRequest("connectors.list", params),
1008
+ /**
1009
+ * Refreshes entries for the selected account.
1010
+ *
1011
+ * @param params Selected account.
1012
+ *
1013
+ * @returns Entries for the selected account.
1014
+ */
1015
+ refresh: async (params) => connection.sendRequest("connectors.refresh", params)
699
1016
  }
700
1017
  };
701
1018
  }
702
1019
  function createInternalServerRpc(connection) {
703
1020
  return {
1021
+ /** @experimental */
1022
+ host: {
1023
+ /**
1024
+ * Requests app-owned materialization over the owning SDK participant.
1025
+ *
1026
+ * @param params One application-owned session handoff, requested by the supervised hosting participant.
1027
+ *
1028
+ * @returns The resident session the application has materialized on its own connection.
1029
+ */
1030
+ createSession: async (params) => connection.sendRequest("host.createSession", params),
1031
+ /**
1032
+ * Releases app ownership retention after AHP detaches.
1033
+ *
1034
+ * @param params Ends one participation, not the application's session lifetime.
1035
+ *
1036
+ * @returns Empty acknowledgement for a completed host lifecycle operation.
1037
+ */
1038
+ releaseSession: async (params) => connection.sendRequest("host.releaseSession", params),
1039
+ /**
1040
+ * Resolves current authenticated credentials and remote-control policy only for the runtime-owned Mission Control hosting participant.
1041
+ *
1042
+ * @returns Private credentials delivered only to a runtime-owned Mission Control hosting participant.
1043
+ */
1044
+ getEnvironmentCredentials: async () => connection.sendRequest("host.getEnvironmentCredentials", {}),
1045
+ /**
1046
+ * Returns listener settings only to the supervised hosting participant over its SDK connection.
1047
+ *
1048
+ * @returns Normalized listener settings delivered only to the supervised hosting participant.
1049
+ */
1050
+ getConfiguration: async () => connection.sendRequest("host.getConfiguration", {}),
1051
+ /**
1052
+ * Reports a supervised hosting participant's bound AHP endpoint after its SDK handshake.
1053
+ *
1054
+ * @param params Readiness reported by the supervised hosting participant on its own SDK connection.
1055
+ *
1056
+ * @returns Empty acknowledgement for a completed host lifecycle operation.
1057
+ */
1058
+ ready: async (params) => connection.sendRequest("host.ready", params)
1059
+ },
704
1060
  /**
705
1061
  * Performs the SDK server connection handshake and validates the optional connection token. Marked internal because this is JSON-RPC transport plumbing invoked automatically by an SDK client's own `connect()` wrapper, not a user-facing method. Stays internal as long as the SDK client owns the handshake; would only become public if the SDK ever exposed the raw schema surface to consumers without a connection wrapper.
706
1062
  *
@@ -712,6 +1068,133 @@ function createInternalServerRpc(connection) {
712
1068
  */
713
1069
  connect: async (params) => connection.sendRequest("connect", params),
714
1070
  /** @experimental */
1071
+ agents: {
1072
+ /**
1073
+ * Lists the agents this runtime ships, by name. A consumer separating shipped agents from ones the user or a plugin authored should compare against these names rather than against `AgentInfo.source`: an authored agent may carry the `builtin` source while not being one of these, and the runtime treats the two as separate questions. `disableableNames` is the subset a user may turn off, which a client needs to decide whether to offer a toggle. `yamlBasedNames` is the subset backed by a shipped YAML definition, which a client needs before asking the runtime to load one.
1074
+ *
1075
+ * @returns The agents this runtime ships, named so a consumer can tell them apart from authored ones.
1076
+ */
1077
+ getBuiltins: async () => connection.sendRequest("agents.getBuiltins", {}),
1078
+ /**
1079
+ * Lists the shipped agents a client should offer right now, filtered by the feature flags it passes. `getBuiltins` names every agent the runtime knows about; some of those are gated, so a client rendering a picker wants this narrower list together with the description to show beside each name.
1080
+ *
1081
+ * @param params The feature flags to evaluate shipped agents against.
1082
+ *
1083
+ * @returns The shipped agents available under the requested flags.
1084
+ */
1085
+ getAvailableBuiltins: async (params) => connection.sendRequest("agents.getAvailableBuiltins", params),
1086
+ /**
1087
+ * Loads one shipped agent's YAML definition, for a client that needs what the agent declares rather than only its name. `getBuiltins` reports which names have a definition to load: a name outside its `yamlBasedNames` is special-cased in code and has none. The definition crosses as its own JSON rather than as contract-typed fields, because the runtime parses it with the agent schema's tolerant shape and re-typing it here would drop the keys that shape accepts and this one does not. The projected `__nativeCustomAgent` view the runtime derives is included, so a caller reading the declared model and a caller rendering the agent see the same definition.
1088
+ *
1089
+ * @param params The shipped agent whose definition to load.
1090
+ *
1091
+ * @returns One shipped agent's definition.
1092
+ */
1093
+ getBuiltinDefinition: async (params) => connection.sendRequest("agents.getBuiltinDefinition", params),
1094
+ /**
1095
+ * Projects one shipped agent the way a picker lists it, reading only the metadata at the head of the definition file and stopping before the prompt body. `getBuiltinDefinition` answers the whole definition instead, so a client listing every shipped agent should prefer this one: the cost of a listing grows with the number of agents, and the prompt body is the part a listing never shows. The two also differ in shape. This returns the projected custom agent on its own, whereas `getBuiltinDefinition` returns the authored definition with that projection nested under `__nativeCustomAgent`.
1096
+ *
1097
+ * @param params The shipped agent whose listing entry to load.
1098
+ *
1099
+ * @returns One shipped agent, projected for a listing.
1100
+ */
1101
+ getBuiltinListingDefinition: async (params) => connection.sendRequest("agents.getBuiltinListingDefinition", params),
1102
+ /**
1103
+ * Resolves the model a custom agent asks for against the models actually available, and answers both the model to switch to and the warning a user should see when the agent's preference cannot be met. A custom agent may name several acceptable models in preference order, so the decision is a match rather than a lookup, and an agent whose preference is unavailable is a normal outcome that produces a warning rather than an error. A host must call this rather than pick the first available name itself, because the preference order and the wording of the warning are what keep one installation's agent selection the same as another's.
1104
+ *
1105
+ * @param params The models a custom agent asks for, and the models actually available.
1106
+ *
1107
+ * @returns The model to switch to, and the warning to show when the agent's preference could not be met.
1108
+ */
1109
+ customAgentInitialModelDecision: async (params) => connection.sendRequest("agents.customAgentInitialModelDecision", params)
1110
+ },
1111
+ /** @experimental */
1112
+ globalState: {
1113
+ /**
1114
+ * Reads the host's machine-wide state: which plugins are installed and the one-off flags and timestamps that record what the user has already been shown or migrated. This is the state that outlives a single session and a single workspace, so a host reads it to decide whether to run a first-launch step, offer an onboarding prompt, or skip one it has already completed. The stored credentials are deliberately not part of this result; a caller that needs an authenticated identity asks the account methods for it instead. Reading is non-destructive and every field is optional, because a fresh install has recorded nothing yet.
1115
+ *
1116
+ * @returns The host's machine-wide state. Every field is optional because a fresh install has recorded nothing yet, so a reader must treat an absent field as `not yet`, never as a negative answer. Stored credentials are deliberately absent from this shape.
1117
+ */
1118
+ load: async () => connection.sendRequest("globalState.load", {}),
1119
+ /**
1120
+ * Reads the host's machine-wide state exactly as `globalState.load` does, but from a caller-supplied configuration directory instead of the one the server resolved for itself. Use this when a consumer scopes a session to its own Copilot home — the SDK's per-session `configDir` override — so the state read matches the directory that session actually uses. An absent or empty `configDir` resolves the server's own home, making this identical to `globalState.load`. The stored credentials are omitted here for the same reason they are omitted from `globalState.load`: a caller that needs an authenticated identity asks the account methods instead, so pointing this at another directory cannot be used to read the credentials kept in it.
1121
+ *
1122
+ * @param params Selects the configuration directory whose machine-wide state to read.
1123
+ *
1124
+ * @returns The host's machine-wide state. Every field is optional because a fresh install has recorded nothing yet, so a reader must treat an absent field as `not yet`, never as a negative answer. Stored credentials are deliberately absent from this shape.
1125
+ */
1126
+ loadForConfigDir: async (params) => connection.sendRequest("globalState.loadForConfigDir", params),
1127
+ /**
1128
+ * Records one top-level key in the host's machine-wide state, the counterpart to `globalState.load`. A host calls this to remember that it has shown an onboarding step, asked a one-off question, or completed a migration, so the next run can skip it. Only the named key is replaced and the rest of the document is preserved, which lets two writers record different flags without overwriting each other; passing no value removes the key instead. Only the keys a host records itself are writable: `appInstallNudgeResponded`, `appTipShown`, `askedSetupTerminals`, `autoFeedbackLastPromptedAt`, `firstLaunchAt`, `recentModelIds`, `sandboxCredentialProxyCaDeclined` and `sandboxOnboardingShown`. Every other key is refused, including `installedPlugins`, the stored credentials, `trustedFolders`, the staff flags and the signed-in accounts. Plugin enablement must use the plugin APIs, which apply repository and managed-policy checks.
1129
+ *
1130
+ * @param params A single top-level key to record in the host's machine-wide state. The write replaces only that key and leaves the rest of the document untouched, so two writers recording different one-off flags do not overwrite each other. The stored credential keys cannot be written through this method.
1131
+ */
1132
+ writeKey: async (params) => connection.sendRequest("globalState.writeKey", params)
1133
+ },
1134
+ /** @experimental */
1135
+ gitHubRepository: {
1136
+ /**
1137
+ * Resolves the GitHub repository that owns a working-tree path by reading the selected git remote configured for it, preferring `origin`. Returns a null `repository` when the path is inside a git working tree but that selected remote does not resolve to a GitHub host. Fails when the path is not inside a git working tree at all, so a caller can tell 'not a repository' apart from 'a repository with no GitHub remote'.
1138
+ *
1139
+ * @param params Working-tree path whose owning GitHub repository should be resolved.
1140
+ *
1141
+ * @returns The GitHub repository that owns the requested path, when the selected remote (`origin`, else the first) is on a GitHub host.
1142
+ */
1143
+ atPath: async (params) => connection.sendRequest("gitHubRepository.atPath", params)
1144
+ },
1145
+ /** @experimental */
1146
+ gitHubOwners: {
1147
+ /**
1148
+ * Registers a cancellable owner listing and returns its request id. Separate from `gitHubOwners.list` so the id exists before the listing starts: a caller that abandons the listing the moment it begins would otherwise have nothing to name in `gitHubOwners.cancel`. The id serves one listing only. Long-abandoned unused ids can be released by later allocations.
1149
+ *
1150
+ * @returns A freshly registered request id. Registering it before the listing starts is what lets a cancel that races the request still find the owner listing slot. The id serves one listing only. Long-abandoned unused ids can be released by later allocations.
1151
+ */
1152
+ nextRequestId: async () => connection.sendRequest("gitHubOwners.nextRequestId", {}),
1153
+ /**
1154
+ * Lists the logins the authenticated user may act as — their own account first, then the organizations they belong to — by asking the GitHub API under the supplied credential. No credential travels in the request: `authInfo` selects one the runtime already holds, and the runtime resolves the token and the GitHub host from it. A failure the caller should render arrives as `message`; one it should raise arrives as `throwError`.
1155
+ *
1156
+ * @param params Credential to list owners under, and the request id that makes the listing cancellable.
1157
+ *
1158
+ * @returns Outcome of an owner listing. Exactly one of `owners` and `message` is present, except that `throwError` reports a failure the caller is expected to raise rather than render.
1159
+ */
1160
+ list: async (params) => connection.sendRequest("gitHubOwners.list", params),
1161
+ /**
1162
+ * Abandons an owner listing started with the given request id. Answers `canceled: true` while a listing with that id is running. Answers `canceled: false` when the id was never registered, was registered but not used, was released after being abandoned, or its listing has ended. Canceling an unused id releases it, and a later `list` with that id is refused. The cancel acts only on owner listings and never reaches another request of the host.
1163
+ *
1164
+ * @param params The owner listing to abandon.
1165
+ *
1166
+ * @returns Whether the id named a running owner listing.
1167
+ */
1168
+ cancel: async (params) => connection.sendRequest("gitHubOwners.cancel", params)
1169
+ },
1170
+ /** @experimental */
1171
+ git: {
1172
+ /**
1173
+ * Reads the remote that the branch checked out in a working tree tracks, as `branch.<name>.remote` configures it. Reports `origin` rather than failing whenever there is no tracking configuration to read — on a detached HEAD, on a branch with no upstream, or when git itself fails — because a caller asking which remote to talk to needs an answer it can act on, not an error. Marked internal because it exists to carry a CLI call site off the napi boundary onto the SDK contract; it is migration plumbing, not a surface consumers are meant to depend on.
1174
+ *
1175
+ * @param params Working-tree path a git query applies to.
1176
+ *
1177
+ * @returns The remote the checked-out branch tracks.
1178
+ */
1179
+ currentBranchRemote: async (params) => connection.sendRequest("git.currentBranchRemote", params),
1180
+ /**
1181
+ * Collects the repository context of a working directory in one call: working tree root, repository identifier and host, current branch, and the HEAD and base commits. Every repository field is omitted when the path is not inside a git working tree, and the requested path is echoed back as `cwd`. The answer is the same `SessionWorkingDirectoryContext` that `session.metadata.recordContextChange` accepts, so a caller polling for a context change can forward the result unchanged. Marked internal because it exists to carry a CLI call site off the napi boundary onto the SDK contract; it is migration plumbing, not a surface consumers are meant to depend on. It can become public once an SDK consumer needs to derive session context from a directory itself.
1182
+ *
1183
+ * @param params Working-tree path a git query applies to.
1184
+ *
1185
+ * @returns Updated working directory and git context. Emitted as the new payload of `session.context_changed`.
1186
+ */
1187
+ workingDirectoryContext: async (params) => connection.sendRequest("git.workingDirectoryContext", params),
1188
+ /**
1189
+ * Lists the GitHub repositories a working tree's remotes point at, one entry per distinct repository, so a caller can resolve a base and head repository without parsing remote URLs itself. When several remotes name the same repository, only the first is listed, and the entry keeps that remote name. Remotes pointing at no GitHub host are left out, so an empty list means the tree reaches GitHub through no remote. Failing to read the remotes is reported as an error rather than as an empty list, because the two mean different things to a caller. Marked internal because it exists to carry a CLI call site off the napi boundary onto the SDK contract; it is migration plumbing, not a surface consumers are meant to depend on.
1190
+ *
1191
+ * @param params Git working tree whose GitHub remotes should be listed.
1192
+ *
1193
+ * @returns The GitHub repositories a working tree's remotes point at.
1194
+ */
1195
+ reposFromRemotes: async (params) => connection.sendRequest("git.reposFromRemotes", params)
1196
+ },
1197
+ /** @experimental */
715
1198
  sessions: {
716
1199
  /**
717
1200
  * Reads lightweight persisted metadata for one local session without opening it.
@@ -751,6 +1234,30 @@ function createInternalServerRpc(connection) {
751
1234
  * @param params Session ID to delete from disk.
752
1235
  */
753
1236
  delete: async (params) => connection.sendRequest("sessions.delete", params),
1237
+ /**
1238
+ * Creates the workspace record for a session that has not been opened yet. A host that hands a session off to another application — writing the record and then launching that application against the session ID — needs the record on disk before any session exists to carry it, which the session-scoped workspace methods cannot do. Replaces any existing record and resets the checkpoint index. When writing to the local filesystem, a stored `fork_count` survives on disk. Returns the record it built, so a surviving stored `fork_count` can differ from the answer.
1239
+ *
1240
+ * @param params Identity, state location and starting context for a workspace record.
1241
+ *
1242
+ * @returns The workspace record that was written.
1243
+ */
1244
+ createWorkspace: async (params) => connection.sendRequest("sessions.createWorkspace", params),
1245
+ /**
1246
+ * Reads a session's workspace record straight from disk, without opening the session. Resuming by session ID has to know where the session lives before it can connect, so the lookup cannot come from the session-scoped workspace methods, which resolve their location from a live session's context. Returns no record when the file is absent.
1247
+ *
1248
+ * @param params Where the session's state lives, as a root directory and the session ID under it.
1249
+ *
1250
+ * @returns The workspace record on disk, omitted when the session has none.
1251
+ */
1252
+ loadWorkspace: async (params) => connection.sendRequest("sessions.loadWorkspace", params),
1253
+ /**
1254
+ * Merges fields into a session's workspace record on disk, creating the record when it is absent. The counterpart to `sessions.loadWorkspace`, for the same before-the-session-exists case. It preserves stored workspace-schema fields the request does not supply, does not preserve stored keys outside the workspace schema, and never replaces a stored `fork_count`.
1255
+ *
1256
+ * @param params Where the session's state lives, plus workspace-schema fields to merge into its workspace record. Stored keys outside the schema are not preserved, and a stored `fork_count` is never replaced.
1257
+ *
1258
+ * @returns The merge completed. The record carries the supplied workspace-schema fields, but a stored `fork_count` stays.
1259
+ */
1260
+ updateWorkspaceFields: async (params) => connection.sendRequest("sessions.updateWorkspaceFields", params),
754
1261
  /**
755
1262
  * Gets the dynamic-context board entry count associated with a session, when available. Internal: this exists solely so CLI telemetry events (`rem_spawn_gate`, `rem_consolidation_complete`) can pair START / END board counts around the detached rem-agent spawn. "Dynamic context board" is a runtime-internal concept that is not part of the public SDK contract; the long-term plan is to relocate the telemetry emission into the runtime so this method can be deleted entirely.
756
1263
  *
@@ -770,6 +1277,50 @@ function createInternalServerRpc(connection) {
770
1277
  }
771
1278
  function createSessionRpc(connection, sessionId) {
772
1279
  return {
1280
+ /** @experimental */
1281
+ providers: {
1282
+ /**
1283
+ * Returns adapter definitions and supported operations in this session's effective provider catalog, without running discovery. Does not list provider instances or select inference models.
1284
+ *
1285
+ * @returns Normalized model-provider adapter definitions available to the session, not discovered instances.
1286
+ */
1287
+ getCatalog: async () => connection.sendRequest("session.providers.getCatalog", { sessionId }),
1288
+ /**
1289
+ * Discovers reachable instances using an adapter from this session's effective provider catalog and provider-specific discovery input.
1290
+ *
1291
+ * @param params Provider discovery parameters.
1292
+ *
1293
+ * @returns Provider instances found by a discovery operation.
1294
+ */
1295
+ discover: async (params) => connection.sendRequest("session.providers.discover", { ...params, sessionId }),
1296
+ /**
1297
+ * Gets current health and version information for a discovered model-provider instance.
1298
+ *
1299
+ * @param params Provider status request parameters.
1300
+ *
1301
+ * @returns Current health information for a provider instance.
1302
+ */
1303
+ getStatus: async (params) => connection.sendRequest("session.providers.getStatus", { ...params, sessionId }),
1304
+ /** @experimental */
1305
+ models: {
1306
+ /**
1307
+ * Lists models installed or otherwise available from a discovered model-provider instance.
1308
+ *
1309
+ * @param params Provider model inventory request parameters.
1310
+ *
1311
+ * @returns Models offered for agent conversations by one provider instance. Adapters exclude known-incompatible models, but retain candidates with unknown capabilities. Listing does not guarantee compatibility.
1312
+ */
1313
+ list: async (params) => connection.sendRequest("session.providers.models.list", { ...params, sessionId }),
1314
+ /**
1315
+ * Translates a discovered model into the provider and model configuration needed to use it, and reports whether each is already registered in this session. Prepares only: it registers nothing, writes nothing, and performs no provider requests.
1316
+ *
1317
+ * @param params A discovered instance and one of its models to translate into provider configuration. Pass back the instance and model as returned by `session.providers.discover` and `session.providers.models.list`.
1318
+ *
1319
+ * @returns Provider configuration prepared from a discovered model. Preparing a plan changes nothing: it neither registers the model with the session nor writes durable configuration. To apply it, pass `provider` and `model` to `session.provider.add`, omitting whichever the dispositions report as already configured.
1320
+ */
1321
+ prepareConfiguration: async (params) => connection.sendRequest("session.providers.models.prepareConfiguration", { ...params, sessionId })
1322
+ }
1323
+ },
773
1324
  /**
774
1325
  * Suspends the session while preserving persisted state for later resume.
775
1326
  *
@@ -785,7 +1336,7 @@ function createSessionRpc(connection, sessionId) {
785
1336
  *
786
1337
  * @experimental
787
1338
  */
788
- send: async (params) => connection.sendRequest("session.send", { sessionId, ...params }),
1339
+ send: async (params) => connection.sendRequest("session.send", { ...params, sessionId }),
789
1340
  /**
790
1341
  * Sends zero or more user messages to the session in a single turn and returns their message IDs. All provided messages are appended to the conversation in order, then exactly one agent turn runs over the resulting history. When the list is empty, one turn runs over the existing history with no new user message. Remote-backed (Mission Control) sessions do not support this method and will return an error.
791
1342
  *
@@ -795,7 +1346,7 @@ function createSessionRpc(connection, sessionId) {
795
1346
  *
796
1347
  * @experimental
797
1348
  */
798
- sendMessages: async (params) => connection.sendRequest("session.sendMessages", { sessionId, ...params }),
1349
+ sendMessages: async (params) => connection.sendRequest("session.sendMessages", { ...params, sessionId }),
799
1350
  /** @experimental */
800
1351
  sandbox: {
801
1352
  /**
@@ -811,7 +1362,15 @@ function createSessionRpc(connection, sessionId) {
811
1362
  *
812
1363
  * @returns Result of attempting to disable sandboxing for the current session.
813
1364
  */
814
- disableForSession: async (params) => connection.sendRequest("session.sandbox.disableForSession", { sessionId, ...params })
1365
+ disableForSession: async (params) => connection.sendRequest("session.sandbox.disableForSession", { ...params, sessionId }),
1366
+ /**
1367
+ * Adds the path offered by a pending sandbox escalation permission request's sandboxPathGrant to the session's sandbox policy and approves the request, so the blocked operation re-runs inside the sandbox rather than outside it. The request is rejected unless the exact request is still pending, carries a sandboxPathGrant, and the grant still takes effect under the current managed policy. Does not persist the path; hosts that store sandbox settings save it themselves.
1368
+ *
1369
+ * @param params Request to accept the sandbox path grant offered on an active sandbox escalation permission prompt.
1370
+ *
1371
+ * @returns Result of accepting a sandbox path grant.
1372
+ */
1373
+ grantPathForRequest: async (params) => connection.sendRequest("session.sandbox.grantPathForRequest", { ...params, sessionId })
815
1374
  },
816
1375
  /**
817
1376
  * Aborts the current agent turn.
@@ -822,7 +1381,7 @@ function createSessionRpc(connection, sessionId) {
822
1381
  *
823
1382
  * @experimental
824
1383
  */
825
- abort: async (params) => connection.sendRequest("session.abort", { sessionId, ...params }),
1384
+ abort: async (params) => connection.sendRequest("session.abort", { ...params, sessionId }),
826
1385
  /**
827
1386
  * Interrupts the current main agent turn while leaving running background work (subagents, sidekicks, and promoted attached shells) alive. No-op when the main loop is not processing.
828
1387
  *
@@ -832,7 +1391,7 @@ function createSessionRpc(connection, sessionId) {
832
1391
  *
833
1392
  * @experimental
834
1393
  */
835
- interruptMainTurn: async (params) => connection.sendRequest("session.interruptMainTurn", { sessionId, ...params }),
1394
+ interruptMainTurn: async (params) => connection.sendRequest("session.interruptMainTurn", { ...params, sessionId }),
836
1395
  /**
837
1396
  * Cancels every running background agent (task-registry subagents plus sidekick agents) without interrupting the main agent loop. Promoted attached shells are left running.
838
1397
  *
@@ -848,7 +1407,7 @@ function createSessionRpc(connection, sessionId) {
848
1407
  *
849
1408
  * @experimental
850
1409
  */
851
- shutdown: async (params) => connection.sendRequest("session.shutdown", { sessionId, ...params }),
1410
+ shutdown: async (params) => connection.sendRequest("session.shutdown", { ...params, sessionId }),
852
1411
  /** @experimental */
853
1412
  gitHubAuth: {
854
1413
  /**
@@ -864,7 +1423,59 @@ function createSessionRpc(connection, sessionId) {
864
1423
  *
865
1424
  * @returns Indicates whether the credential update succeeded.
866
1425
  */
867
- setCredentials: async (params) => connection.sendRequest("session.gitHubAuth.setCredentials", { sessionId, ...params })
1426
+ setCredentials: async (params) => connection.sendRequest("session.gitHubAuth.setCredentials", { ...params, sessionId })
1427
+ },
1428
+ /** @experimental */
1429
+ accounts: {
1430
+ /**
1431
+ * Enumerate a typed accounts collection: the signed-in accounts, or the providers offered for interactive login.
1432
+ *
1433
+ * @param params Enumerate request carrying the typed collection query.
1434
+ *
1435
+ * @returns The enumerated collection, keyed by the same selector as the query.
1436
+ */
1437
+ enumerate: async (params) => connection.sendRequest("session.accounts.enumerate", { ...params, sessionId }),
1438
+ /**
1439
+ * Read one typed accounts datum: the active account, a neutral status summary, or the last authentication errors.
1440
+ *
1441
+ * @param params Read request carrying the typed datum query.
1442
+ *
1443
+ * @returns The read result, keyed by the same selector as the query.
1444
+ */
1445
+ get: async (params) => connection.sendRequest("session.accounts.get", { ...params, sessionId }),
1446
+ /**
1447
+ * Apply one non-interactive accounts mutation: switch the active account, log an account out, or set credentials from a token.
1448
+ *
1449
+ * @param params Mutation request carrying the typed write command.
1450
+ *
1451
+ * @returns Result of a non-interactive accounts mutation.
1452
+ */
1453
+ set: async (params) => connection.sendRequest("session.accounts.set", { ...params, sessionId }),
1454
+ /** @experimental */
1455
+ login: {
1456
+ /**
1457
+ * Begin an interactive login flow for a provider kind (dispatch is kind-only) and return its opaque flow id and first step.
1458
+ *
1459
+ * @param params Begin an interactive login flow for a provider kind. Dispatch is kind-only.
1460
+ *
1461
+ * @returns A started login flow: its opaque id and first step.
1462
+ */
1463
+ begin: async (params) => connection.sendRequest("session.accounts.login.begin", { ...params, sessionId }),
1464
+ /**
1465
+ * Advance an in-flight login flow, optionally fulfilling an input-required step, and return the next step.
1466
+ *
1467
+ * @param params Advance an in-flight login flow, optionally fulfilling an input-required step.
1468
+ *
1469
+ * @returns One step in an interactive login flow. The consumer acts on the step and calls advance to proceed. Browser-open is encoded as two distinct steps by design: `open-url` is CONSUMER-driven (the provider surfaces the authorize URL and the consumer opens it — github.com/GHEC web), while `needs-interaction` is PROVIDER-driven (the provider opens the browser or broker UI itself and does not surface a URL — Entra).
1470
+ */
1471
+ advance: async (params) => connection.sendRequest("session.accounts.login.advance", { ...params, sessionId }),
1472
+ /**
1473
+ * Cancel an in-flight login flow and release its resources.
1474
+ *
1475
+ * @param params Cancel an in-flight login flow.
1476
+ */
1477
+ cancel: async (params) => connection.sendRequest("session.accounts.login.cancel", { ...params, sessionId })
1478
+ }
868
1479
  },
869
1480
  /** @experimental */
870
1481
  debug: {
@@ -875,7 +1486,7 @@ function createSessionRpc(connection, sessionId) {
875
1486
  *
876
1487
  * @returns Result of collecting a session debug bundle.
877
1488
  */
878
- collectLogs: async (params) => connection.sendRequest("session.debug.collectLogs", { sessionId, ...params })
1489
+ collectLogs: async (params) => connection.sendRequest("session.debug.collectLogs", { ...params, sessionId })
879
1490
  },
880
1491
  /** @experimental */
881
1492
  canvas: {
@@ -898,13 +1509,13 @@ function createSessionRpc(connection, sessionId) {
898
1509
  *
899
1510
  * @returns Open canvas instance snapshot.
900
1511
  */
901
- open: async (params) => connection.sendRequest("session.canvas.open", { sessionId, ...params }),
1512
+ open: async (params) => connection.sendRequest("session.canvas.open", { ...params, sessionId }),
902
1513
  /**
903
1514
  * Closes an open canvas instance.
904
1515
  *
905
1516
  * @param params Canvas close parameters.
906
1517
  */
907
- close: async (params) => connection.sendRequest("session.canvas.close", { sessionId, ...params }),
1518
+ close: async (params) => connection.sendRequest("session.canvas.close", { ...params, sessionId }),
908
1519
  /** @experimental */
909
1520
  action: {
910
1521
  /**
@@ -914,109 +1525,109 @@ function createSessionRpc(connection, sessionId) {
914
1525
  *
915
1526
  * @returns Canvas action invocation result.
916
1527
  */
917
- invoke: async (params) => connection.sendRequest("session.canvas.action.invoke", { sessionId, ...params })
1528
+ invoke: async (params) => connection.sendRequest("session.canvas.action.invoke", { ...params, sessionId })
918
1529
  }
919
1530
  },
920
1531
  /** @experimental */
921
- factory: {
1532
+ workflow: {
922
1533
  /**
923
- * Runs a registered factory by name at the top level.
1534
+ * Runs a registered dynamic workflow by name at the top level.
924
1535
  *
925
- * @param params Parameters for invoking a registered factory.
1536
+ * @param params Parameters for invoking a registered workflow.
926
1537
  *
927
- * @returns Complete current or terminal factory run envelope.
1538
+ * @returns Complete current or terminal workflow run envelope.
928
1539
  */
929
- run: async (params) => connection.sendRequest("session.factory.run", { sessionId, ...params }),
1540
+ run: async (params) => connection.sendRequest("session.workflow.run", { ...params, sessionId }),
930
1541
  /**
931
- * Resumes a factory run using its persisted name, arguments, journal, and accounting.
1542
+ * Resumes a dynamic workflow run using its persisted name, arguments, journal, and accounting.
932
1543
  *
933
- * @param params Parameters for resuming a factory run from its persisted identity.
1544
+ * @param params Parameters for resuming a workflow run from its persisted identity.
934
1545
  *
935
- * @returns Resolved persisted factory identity and resumed run envelope.
1546
+ * @returns Resolved persisted workflow identity and resumed run envelope.
936
1547
  */
937
- resume: async (params) => connection.sendRequest("session.factory.resume", { sessionId, ...params }),
1548
+ resume: async (params) => connection.sendRequest("session.workflow.resume", { ...params, sessionId }),
938
1549
  /**
939
- * Gets the current or settled envelope for a factory run.
1550
+ * Gets the current or settled envelope for a dynamic workflow run.
940
1551
  *
941
- * @param params Parameters for retrieving a factory run.
1552
+ * @param params Parameters for retrieving a workflow run.
942
1553
  *
943
- * @returns Complete current or terminal factory run envelope.
1554
+ * @returns Complete current or terminal workflow run envelope.
944
1555
  */
945
- getRun: async (params) => connection.sendRequest("session.factory.getRun", { sessionId, ...params }),
1556
+ getRun: async (params) => connection.sendRequest("session.workflow.getRun", { ...params, sessionId }),
946
1557
  /**
947
- * Lists durable factory runs for this session in creation order.
1558
+ * Lists durable dynamic workflow runs for this session in creation order.
948
1559
  *
949
- * @param params Parameters for paging factory runs.
1560
+ * @param params Parameters for paging workflow runs.
950
1561
  *
951
- * @returns A page of factory runs in durable creation order.
1562
+ * @returns A page of workflow runs in durable creation order.
952
1563
  */
953
- listRuns: async (params) => connection.sendRequest("session.factory.listRuns", { sessionId, ...params }),
1564
+ listRuns: async (params) => connection.sendRequest("session.workflow.listRuns", { ...params, sessionId }),
954
1565
  /**
955
- * Gets durable and live observability detail for one factory run.
1566
+ * Gets durable and live observability detail for one dynamic workflow run.
956
1567
  *
957
- * @param params Parameters for retrieving a factory run.
1568
+ * @param params Parameters for retrieving a workflow run.
958
1569
  *
959
- * @returns Full factory run observability detail.
1570
+ * @returns Full workflow run observability detail.
960
1571
  */
961
- getRunDetail: async (params) => connection.sendRequest("session.factory.getRunDetail", { sessionId, ...params }),
1572
+ getRunDetail: async (params) => connection.sendRequest("session.workflow.getRunDetail", { ...params, sessionId }),
962
1573
  /**
963
- * Pages durable progress for one factory run.
1574
+ * Pages durable progress for one dynamic workflow run.
964
1575
  *
965
- * @param params Parameters for paging factory progress.
1576
+ * @param params Parameters for paging workflow progress.
966
1577
  *
967
- * @returns A bidirectional page of factory progress.
1578
+ * @returns A bidirectional page of workflow progress.
968
1579
  */
969
- getRunProgress: async (params) => connection.sendRequest("session.factory.getRunProgress", { sessionId, ...params }),
1580
+ getRunProgress: async (params) => connection.sendRequest("session.workflow.getRunProgress", { ...params, sessionId }),
970
1581
  /**
971
- * Requests cancellation of a factory run and returns its run envelope.
1582
+ * Requests cancellation of a dynamic workflow run and returns its run envelope.
972
1583
  *
973
- * @param params Parameters for cancelling a factory run.
1584
+ * @param params Parameters for cancelling a workflow run.
974
1585
  *
975
- * @returns Complete current or terminal factory run envelope.
1586
+ * @returns Complete current or terminal workflow run envelope.
976
1587
  */
977
- cancel: async (params) => connection.sendRequest("session.factory.cancel", { sessionId, ...params }),
1588
+ cancel: async (params) => connection.sendRequest("session.workflow.cancel", { ...params, sessionId }),
978
1589
  /**
979
- * Pauses a running factory and returns its settled run envelope.
1590
+ * Pauses a running dynamic workflow and returns its settled run envelope.
980
1591
  *
981
- * @param params Parameters for pausing a running factory.
1592
+ * @param params Parameters for pausing a running workflow.
982
1593
  *
983
- * @returns Complete current or terminal factory run envelope.
1594
+ * @returns Complete current or terminal workflow run envelope.
984
1595
  */
985
- pause: async (params) => connection.sendRequest("session.factory.pause", { sessionId, ...params }),
1596
+ pause: async (params) => connection.sendRequest("session.workflow.pause", { ...params, sessionId }),
986
1597
  /**
987
- * Records a batch of ordered factory progress lines.
1598
+ * Records a batch of ordered dynamic workflow progress lines.
988
1599
  *
989
- * @param params Parameters for recording factory progress.
1600
+ * @param params Parameters for recording workflow progress.
990
1601
  *
991
- * @returns Acknowledgement that a factory request was accepted.
1602
+ * @returns Acknowledgement that a workflow request was accepted.
992
1603
  */
993
- log: async (params) => connection.sendRequest("session.factory.log", { sessionId, ...params }),
1604
+ log: async (params) => connection.sendRequest("session.workflow.log", { ...params, sessionId }),
994
1605
  /**
995
- * Runs one factory-scoped subagent and returns its result.
1606
+ * Runs one dynamic-workflow-scoped subagent and returns its result.
996
1607
  *
997
- * @param params Parameters for one factory-scoped subagent call.
1608
+ * @param params Parameters for one workflow-scoped subagent call.
998
1609
  *
999
- * @returns Result of one factory-scoped subagent call.
1610
+ * @returns Result of one workflow-scoped subagent call.
1000
1611
  */
1001
- agent: async (params) => connection.sendRequest("session.factory.agent", { sessionId, ...params }),
1612
+ agent: async (params) => connection.sendRequest("session.workflow.agent", { ...params, sessionId }),
1002
1613
  /** @experimental */
1003
1614
  journal: {
1004
1615
  /**
1005
- * Reads a memoized factory journal entry.
1616
+ * Reads a memoized dynamic workflow journal entry.
1006
1617
  *
1007
- * @param params Parameters for reading a factory journal entry.
1618
+ * @param params Parameters for reading a workflow journal entry.
1008
1619
  *
1009
- * @returns Result of reading a factory journal entry.
1620
+ * @returns Result of reading a workflow journal entry.
1010
1621
  */
1011
- get: async (params) => connection.sendRequest("session.factory.journal.get", { sessionId, ...params }),
1622
+ get: async (params) => connection.sendRequest("session.workflow.journal.get", { ...params, sessionId }),
1012
1623
  /**
1013
- * Stores a memoized factory journal entry.
1624
+ * Stores a memoized dynamic workflow journal entry.
1014
1625
  *
1015
- * @param params Parameters for storing a factory journal entry.
1626
+ * @param params Parameters for storing a workflow journal entry.
1016
1627
  *
1017
- * @returns Acknowledgement that a factory request was accepted.
1628
+ * @returns Acknowledgement that a workflow request was accepted.
1018
1629
  */
1019
- put: async (params) => connection.sendRequest("session.factory.journal.put", { sessionId, ...params })
1630
+ put: async (params) => connection.sendRequest("session.workflow.journal.put", { ...params, sessionId })
1020
1631
  }
1021
1632
  },
1022
1633
  /** @experimental */
@@ -1034,7 +1645,7 @@ function createSessionRpc(connection, sessionId) {
1034
1645
  *
1035
1646
  * @returns The model identifier active on the session after the switch.
1036
1647
  */
1037
- switchTo: async (params) => connection.sendRequest("session.model.switchTo", { sessionId, ...params }),
1648
+ switchTo: async (params) => connection.sendRequest("session.model.switchTo", { ...params, sessionId }),
1038
1649
  /**
1039
1650
  * 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`.
1040
1651
  *
@@ -1042,7 +1653,7 @@ function createSessionRpc(connection, sessionId) {
1042
1653
  *
1043
1654
  * @returns Immediate acknowledgement and Auto preference snapshot after a switch request. This result never implies that a pending preference committed.
1044
1655
  */
1045
- switchAutoTier: async (params) => connection.sendRequest("session.model.switchAutoTier", { sessionId, ...params }),
1656
+ switchAutoTier: async (params) => connection.sendRequest("session.model.switchAutoTier", { ...params, sessionId }),
1046
1657
  /**
1047
1658
  * Replaces or clears the host-supplied model allowlist for a running session.
1048
1659
  *
@@ -1050,7 +1661,7 @@ function createSessionRpc(connection, sessionId) {
1050
1661
  *
1051
1662
  * @returns The applied host allowlist and effective session model policy after intersection.
1052
1663
  */
1053
- setAllowedModels: async (params) => connection.sendRequest("session.model.setAllowedModels", { sessionId, ...params }),
1664
+ setAllowedModels: async (params) => connection.sendRequest("session.model.setAllowedModels", { ...params, sessionId }),
1054
1665
  /**
1055
1666
  * Updates the session's reasoning effort without changing the selected model.
1056
1667
  *
@@ -1058,7 +1669,7 @@ function createSessionRpc(connection, sessionId) {
1058
1669
  *
1059
1670
  * @returns Update the session's reasoning effort without changing the selected model. Use `switchTo` instead when you also need to change the model. The runtime stores the effort on the session and applies it to subsequent turns.
1060
1671
  */
1061
- setReasoningEffort: async (params) => connection.sendRequest("session.model.setReasoningEffort", { sessionId, ...params }),
1672
+ setReasoningEffort: async (params) => connection.sendRequest("session.model.setReasoningEffort", { ...params, sessionId }),
1062
1673
  /**
1063
1674
  * Lists models available to this session using its own auth and integration context. Connected hosts (CLI TUI, GitHub App) should call this through the session client so remote sessions return the remote CLI's available models rather than the caller's.
1064
1675
  *
@@ -1066,7 +1677,7 @@ function createSessionRpc(connection, sessionId) {
1066
1677
  *
1067
1678
  * @returns The list of models available to this session.
1068
1679
  */
1069
- list: async (params) => connection.sendRequest("session.model.list", { sessionId, ...params })
1680
+ list: async (params) => connection.sendRequest("session.model.list", { ...params, sessionId })
1070
1681
  },
1071
1682
  /** @experimental */
1072
1683
  mode: {
@@ -1083,7 +1694,7 @@ function createSessionRpc(connection, sessionId) {
1083
1694
  *
1084
1695
  * @returns Outcome of a session mode change, including any model switch it triggered and follow-up the host must perform.
1085
1696
  */
1086
- set: async (params) => connection.sendRequest("session.mode.set", { sessionId, ...params })
1697
+ set: async (params) => connection.sendRequest("session.mode.set", { ...params, sessionId })
1087
1698
  },
1088
1699
  /** @experimental */
1089
1700
  name: {
@@ -1098,7 +1709,7 @@ function createSessionRpc(connection, sessionId) {
1098
1709
  *
1099
1710
  * @param params New friendly name to apply to the session.
1100
1711
  */
1101
- set: async (params) => connection.sendRequest("session.name.set", { sessionId, ...params }),
1712
+ set: async (params) => connection.sendRequest("session.name.set", { ...params, sessionId }),
1102
1713
  /**
1103
1714
  * Persists an auto-generated session summary as the session's name when no user-set name exists.
1104
1715
  *
@@ -1106,7 +1717,7 @@ function createSessionRpc(connection, sessionId) {
1106
1717
  *
1107
1718
  * @returns Indicates whether the auto-generated summary was applied as the session's name.
1108
1719
  */
1109
- setAuto: async (params) => connection.sendRequest("session.name.setAuto", { sessionId, ...params })
1720
+ setAuto: async (params) => connection.sendRequest("session.name.setAuto", { ...params, sessionId })
1110
1721
  },
1111
1722
  /** @experimental */
1112
1723
  plan: {
@@ -1121,7 +1732,7 @@ function createSessionRpc(connection, sessionId) {
1121
1732
  *
1122
1733
  * @param params Replacement contents to write to the session plan file.
1123
1734
  */
1124
- update: async (params) => connection.sendRequest("session.plan.update", { sessionId, ...params }),
1735
+ update: async (params) => connection.sendRequest("session.plan.update", { ...params, sessionId }),
1125
1736
  /**
1126
1737
  * Deletes the session plan file from the workspace.
1127
1738
  */
@@ -1154,7 +1765,7 @@ function createSessionRpc(connection, sessionId) {
1154
1765
  *
1155
1766
  * @returns Current workspace metadata for the session, including its absolute filesystem path when available.
1156
1767
  */
1157
- updateMetadata: async (params) => connection.sendRequest("session.workspaces.updateMetadata", { sessionId, ...params }),
1768
+ updateMetadata: async (params) => connection.sendRequest("session.workspaces.updateMetadata", { ...params, sessionId }),
1158
1769
  /**
1159
1770
  * Ensures a local session workspace exists and returns it.
1160
1771
  *
@@ -1162,7 +1773,7 @@ function createSessionRpc(connection, sessionId) {
1162
1773
  *
1163
1774
  * @returns Current workspace metadata for the session, including its absolute filesystem path when available.
1164
1775
  */
1165
- ensure: async (params) => connection.sendRequest("session.workspaces.ensure", { sessionId, ...params }),
1776
+ ensure: async (params) => connection.sendRequest("session.workspaces.ensure", { ...params, sessionId }),
1166
1777
  /**
1167
1778
  * Lists files stored in the session workspace files directory.
1168
1779
  *
@@ -1176,13 +1787,13 @@ function createSessionRpc(connection, sessionId) {
1176
1787
  *
1177
1788
  * @returns Contents of the requested workspace file as a UTF-8 string.
1178
1789
  */
1179
- readFile: async (params) => connection.sendRequest("session.workspaces.readFile", { sessionId, ...params }),
1790
+ readFile: async (params) => connection.sendRequest("session.workspaces.readFile", { ...params, sessionId }),
1180
1791
  /**
1181
1792
  * Creates or overwrites a file in the session workspace files directory.
1182
1793
  *
1183
1794
  * @param params Relative path and UTF-8 content for the workspace file to create or overwrite.
1184
1795
  */
1185
- createFile: async (params) => connection.sendRequest("session.workspaces.createFile", { sessionId, ...params }),
1796
+ createFile: async (params) => connection.sendRequest("session.workspaces.createFile", { ...params, sessionId }),
1186
1797
  /**
1187
1798
  * Returns metadata for a file or directory in the session workspace files directory.
1188
1799
  *
@@ -1190,25 +1801,25 @@ function createSessionRpc(connection, sessionId) {
1190
1801
  *
1191
1802
  * @returns Filesystem metadata for a path in the session workspace files directory.
1192
1803
  */
1193
- statFile: async (params) => connection.sendRequest("session.workspaces.statFile", { sessionId, ...params }),
1804
+ statFile: async (params) => connection.sendRequest("session.workspaces.statFile", { ...params, sessionId }),
1194
1805
  /**
1195
1806
  * Creates a directory in the session workspace files directory.
1196
1807
  *
1197
1808
  * @param params Directory to create within the session workspace files directory.
1198
1809
  */
1199
- createDirectory: async (params) => connection.sendRequest("session.workspaces.createDirectory", { sessionId, ...params }),
1810
+ createDirectory: async (params) => connection.sendRequest("session.workspaces.createDirectory", { ...params, sessionId }),
1200
1811
  /**
1201
1812
  * Removes a file or directory from the session workspace files directory.
1202
1813
  *
1203
1814
  * @param params File or directory to remove from the session workspace files directory.
1204
1815
  */
1205
- removePath: async (params) => connection.sendRequest("session.workspaces.removePath", { sessionId, ...params }),
1816
+ removePath: async (params) => connection.sendRequest("session.workspaces.removePath", { ...params, sessionId }),
1206
1817
  /**
1207
1818
  * Renames a file or directory within the session workspace files directory.
1208
1819
  *
1209
1820
  * @param params Source and destination paths for a rename within the session workspace files directory.
1210
1821
  */
1211
- renamePath: async (params) => connection.sendRequest("session.workspaces.renamePath", { sessionId, ...params }),
1822
+ renamePath: async (params) => connection.sendRequest("session.workspaces.renamePath", { ...params, sessionId }),
1212
1823
  /**
1213
1824
  * Lists workspace checkpoints in chronological order.
1214
1825
  *
@@ -1222,7 +1833,7 @@ function createSessionRpc(connection, sessionId) {
1222
1833
  *
1223
1834
  * @returns Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing.
1224
1835
  */
1225
- readCheckpoint: async (params) => connection.sendRequest("session.workspaces.readCheckpoint", { sessionId, ...params }),
1836
+ readCheckpoint: async (params) => connection.sendRequest("session.workspaces.readCheckpoint", { ...params, sessionId }),
1226
1837
  /**
1227
1838
  * Adds a compaction summary checkpoint to the local session workspace.
1228
1839
  *
@@ -1230,7 +1841,7 @@ function createSessionRpc(connection, sessionId) {
1230
1841
  *
1231
1842
  * @returns Persisted summary metadata and refreshed workspace metadata.
1232
1843
  */
1233
- addSummary: async (params) => connection.sendRequest("session.workspaces.addSummary", { sessionId, ...params }),
1844
+ addSummary: async (params) => connection.sendRequest("session.workspaces.addSummary", { ...params, sessionId }),
1234
1845
  /**
1235
1846
  * Truncates local workspace compaction summaries after a rollback.
1236
1847
  *
@@ -1238,7 +1849,7 @@ function createSessionRpc(connection, sessionId) {
1238
1849
  *
1239
1850
  * @returns Current workspace metadata for the session, including its absolute filesystem path when available.
1240
1851
  */
1241
- truncateSummaries: async (params) => connection.sendRequest("session.workspaces.truncateSummaries", { sessionId, ...params }),
1852
+ truncateSummaries: async (params) => connection.sendRequest("session.workspaces.truncateSummaries", { ...params, sessionId }),
1242
1853
  /**
1243
1854
  * Reads the autopilot objective state file from the local session workspace.
1244
1855
  *
@@ -1252,7 +1863,7 @@ function createSessionRpc(connection, sessionId) {
1252
1863
  *
1253
1864
  * @returns Result of writing the autopilot objective file.
1254
1865
  */
1255
- writeAutopilotObjective: async (params) => connection.sendRequest("session.workspaces.writeAutopilotObjective", { sessionId, ...params }),
1866
+ writeAutopilotObjective: async (params) => connection.sendRequest("session.workspaces.writeAutopilotObjective", { ...params, sessionId }),
1256
1867
  /**
1257
1868
  * Deletes the autopilot objective state file from the local session workspace.
1258
1869
  *
@@ -1272,7 +1883,7 @@ function createSessionRpc(connection, sessionId) {
1272
1883
  *
1273
1884
  * @returns Descriptor for the saved paste file, or null when the workspace is unavailable.
1274
1885
  */
1275
- saveLargePaste: async (params) => connection.sendRequest("session.workspaces.saveLargePaste", { sessionId, ...params }),
1886
+ saveLargePaste: async (params) => connection.sendRequest("session.workspaces.saveLargePaste", { ...params, sessionId }),
1276
1887
  /**
1277
1888
  * Computes a diff for the session workspace. Never rejects for a busy session: a `session`-mode diff that cannot read the session's file-change captures falls back to an unstaged git diff with `isFallback: true` and reports why in `unavailableReason`.
1278
1889
  *
@@ -1280,7 +1891,7 @@ function createSessionRpc(connection, sessionId) {
1280
1891
  *
1281
1892
  * @returns Workspace diff result for the requested mode.
1282
1893
  */
1283
- diff: async (params) => connection.sendRequest("session.workspaces.diff", { sessionId, ...params })
1894
+ diff: async (params) => connection.sendRequest("session.workspaces.diff", { ...params, sessionId })
1284
1895
  },
1285
1896
  /** @experimental */
1286
1897
  autopilotObjective: {
@@ -1306,7 +1917,7 @@ function createSessionRpc(connection, sessionId) {
1306
1917
  *
1307
1918
  * @returns Host-driven completion items for the current composer input. Empty when the host returns no items or does not support completions.
1308
1919
  */
1309
- request: async (params) => connection.sendRequest("session.completions.request", { sessionId, ...params })
1920
+ request: async (params) => connection.sendRequest("session.completions.request", { ...params, sessionId })
1310
1921
  },
1311
1922
  /** @experimental */
1312
1923
  instructions: {
@@ -1315,7 +1926,22 @@ function createSessionRpc(connection, sessionId) {
1315
1926
  *
1316
1927
  * @returns Instruction sources loaded for the session, in merge order.
1317
1928
  */
1318
- getSources: async () => connection.sendRequest("session.instructions.getSources", { sessionId })
1929
+ getSources: async () => connection.sendRequest("session.instructions.getSources", { sessionId }),
1930
+ /**
1931
+ * For local sessions, invalidates instruction discovery and the model-facing prompt, then returns freshly discovered sources. The updated prompt takes effect on the next turn. Remote sessions must reload on their agent host instead.
1932
+ *
1933
+ * @returns Instruction sources loaded for the session, in merge order.
1934
+ */
1935
+ reload: async () => connection.sendRequest("session.instructions.reload", { sessionId })
1936
+ },
1937
+ /** @experimental */
1938
+ customizations: {
1939
+ /**
1940
+ * For local sessions, reconciles repository context and discovered instructions, plugins, skills, agents, hooks, MCP servers, and extensions after files appear or change under the working directory. Independent component failures are returned in outcomes and errors; a rejected call can have partially applied earlier steps. Remote sessions must reload on their agent host instead. The model-facing context is rebuilt on the next turn.
1941
+ *
1942
+ * @returns Results of reloading discovered session customizations. Inspect outcomes for reloaded, skipped, or failed subsystems; a rejection may follow partial mutation. Changes to the model-facing prompt and tools apply on the next turn.
1943
+ */
1944
+ reload: async () => connection.sendRequest("session.customizations.reload", { sessionId })
1319
1945
  },
1320
1946
  /** @experimental */
1321
1947
  fleet: {
@@ -1326,7 +1952,7 @@ function createSessionRpc(connection, sessionId) {
1326
1952
  *
1327
1953
  * @returns Indicates whether fleet mode was successfully activated.
1328
1954
  */
1329
- start: async (params) => connection.sendRequest("session.fleet.start", { sessionId, ...params })
1955
+ start: async (params) => connection.sendRequest("session.fleet.start", { ...params, sessionId })
1330
1956
  },
1331
1957
  /** @experimental */
1332
1958
  agent: {
@@ -1337,13 +1963,13 @@ function createSessionRpc(connection, sessionId) {
1337
1963
  *
1338
1964
  * @returns Agents available to the session.
1339
1965
  */
1340
- list: async (params) => connection.sendRequest("session.agent.list", { sessionId, ...params }),
1966
+ list: async (params) => connection.sendRequest("session.agent.list", { ...params, sessionId }),
1341
1967
  /**
1342
1968
  * Sets an in-memory authored prompt override for an available agent. For built-in agents, this replaces only the static base prompt while preserving runtime-owned dynamic prompt composition and behavior. The special `general-purpose` agent is not overrideable. Overrides are not persisted; resumed and forked sessions start without them, so the host must re-apply them.
1343
1969
  *
1344
1970
  * @param params An in-memory authored prompt override for an available agent.
1345
1971
  */
1346
- setPrompt: async (params) => connection.sendRequest("session.agent.setPrompt", { sessionId, ...params }),
1972
+ setPrompt: async (params) => connection.sendRequest("session.agent.setPrompt", { ...params, sessionId }),
1347
1973
  /**
1348
1974
  * Gets the currently selected custom agent for the session.
1349
1975
  *
@@ -1357,7 +1983,7 @@ function createSessionRpc(connection, sessionId) {
1357
1983
  *
1358
1984
  * @returns The newly selected custom agent.
1359
1985
  */
1360
- select: async (params) => connection.sendRequest("session.agent.select", { sessionId, ...params }),
1986
+ select: async (params) => connection.sendRequest("session.agent.select", { ...params, sessionId }),
1361
1987
  /**
1362
1988
  * Clears the selected custom agent and returns the session to the default agent.
1363
1989
  */
@@ -1378,7 +2004,7 @@ function createSessionRpc(connection, sessionId) {
1378
2004
  *
1379
2005
  * @returns Identifier assigned to the newly started background agent task.
1380
2006
  */
1381
- startAgent: async (params) => connection.sendRequest("session.tasks.startAgent", { sessionId, ...params }),
2007
+ startAgent: async (params) => connection.sendRequest("session.tasks.startAgent", { ...params, sessionId }),
1382
2008
  /**
1383
2009
  * Lists background tasks tracked by the session.
1384
2010
  *
@@ -1392,7 +2018,7 @@ function createSessionRpc(connection, sessionId) {
1392
2018
  *
1393
2019
  * @returns Result of registering or reclaiming a client-owned task.
1394
2020
  */
1395
- register: async (params) => connection.sendRequest("session.tasks.register", { sessionId, ...params }),
2021
+ register: async (params) => connection.sendRequest("session.tasks.register", { ...params, sessionId }),
1396
2022
  /**
1397
2023
  * Publishes generic progress or a terminal outcome for a client-owned task.
1398
2024
  *
@@ -1400,7 +2026,7 @@ function createSessionRpc(connection, sessionId) {
1400
2026
  *
1401
2027
  * @returns Result of publishing a client-owned task update.
1402
2028
  */
1403
- update: async (params) => connection.sendRequest("session.tasks.update", { sessionId, ...params }),
2029
+ update: async (params) => connection.sendRequest("session.tasks.update", { ...params, sessionId }),
1404
2030
  /**
1405
2031
  * Refreshes metadata for any detached background shells the runtime knows about.
1406
2032
  *
@@ -1420,7 +2046,7 @@ function createSessionRpc(connection, sessionId) {
1420
2046
  *
1421
2047
  * @returns Progress information for the task, or null when no task with that ID is tracked.
1422
2048
  */
1423
- getProgress: async (params) => connection.sendRequest("session.tasks.getProgress", { sessionId, ...params }),
2049
+ getProgress: async (params) => connection.sendRequest("session.tasks.getProgress", { ...params, sessionId }),
1424
2050
  /**
1425
2051
  * Returns the first sync-waiting task that can currently be promoted to background mode.
1426
2052
  *
@@ -1434,7 +2060,7 @@ function createSessionRpc(connection, sessionId) {
1434
2060
  *
1435
2061
  * @returns Indicates whether the task was successfully promoted to background mode.
1436
2062
  */
1437
- promoteToBackground: async (params) => connection.sendRequest("session.tasks.promoteToBackground", { sessionId, ...params }),
2063
+ promoteToBackground: async (params) => connection.sendRequest("session.tasks.promoteToBackground", { ...params, sessionId }),
1438
2064
  /**
1439
2065
  * Atomically promotes the first promotable sync-waiting task to background mode and returns it.
1440
2066
  *
@@ -1448,7 +2074,7 @@ function createSessionRpc(connection, sessionId) {
1448
2074
  *
1449
2075
  * @returns Indicates whether the background task was successfully cancelled.
1450
2076
  */
1451
- cancel: async (params) => connection.sendRequest("session.tasks.cancel", { sessionId, ...params }),
2077
+ cancel: async (params) => connection.sendRequest("session.tasks.cancel", { ...params, sessionId }),
1452
2078
  /**
1453
2079
  * Removes a completed or cancelled background task from tracking.
1454
2080
  *
@@ -1456,7 +2082,7 @@ function createSessionRpc(connection, sessionId) {
1456
2082
  *
1457
2083
  * @returns Indicates whether the task was removed. False when the task does not exist or is still running/idle.
1458
2084
  */
1459
- remove: async (params) => connection.sendRequest("session.tasks.remove", { sessionId, ...params }),
2085
+ remove: async (params) => connection.sendRequest("session.tasks.remove", { ...params, sessionId }),
1460
2086
  /**
1461
2087
  * Sends a message to a background agent task.
1462
2088
  *
@@ -1464,7 +2090,7 @@ function createSessionRpc(connection, sessionId) {
1464
2090
  *
1465
2091
  * @returns Indicates whether the message was delivered, with an error message when delivery failed.
1466
2092
  */
1467
- sendMessage: async (params) => connection.sendRequest("session.tasks.sendMessage", { sessionId, ...params })
2093
+ sendMessage: async (params) => connection.sendRequest("session.tasks.sendMessage", { ...params, sessionId })
1468
2094
  },
1469
2095
  /** @experimental */
1470
2096
  skills: {
@@ -1485,13 +2111,13 @@ function createSessionRpc(connection, sessionId) {
1485
2111
  *
1486
2112
  * @param params Name of the skill to enable for the session.
1487
2113
  */
1488
- enable: async (params) => connection.sendRequest("session.skills.enable", { sessionId, ...params }),
2114
+ enable: async (params) => connection.sendRequest("session.skills.enable", { ...params, sessionId }),
1489
2115
  /**
1490
2116
  * Disables a skill for the session.
1491
2117
  *
1492
2118
  * @param params Name of the skill to disable for the session.
1493
2119
  */
1494
- disable: async (params) => connection.sendRequest("session.skills.disable", { sessionId, ...params }),
2120
+ disable: async (params) => connection.sendRequest("session.skills.disable", { ...params, sessionId }),
1495
2121
  /**
1496
2122
  * Reloads skill definitions for the session.
1497
2123
  *
@@ -1506,11 +2132,17 @@ function createSessionRpc(connection, sessionId) {
1506
2132
  /** @experimental */
1507
2133
  mcp: {
1508
2134
  /**
1509
- * Lists MCP servers configured for the session, their connection status, and host-level state. The host-level state (disabled/filtered servers, failed/needs-auth/pending connections, mcp3p policy, full config) is empty/zero when no MCP host has been initialized for the session.
2135
+ * Lists materialized MCP servers and their connection status. Cache misses may start and wait for MCP servers.
1510
2136
  *
1511
2137
  * @returns MCP servers configured for the session, with their connection status and host-level state.
1512
2138
  */
1513
2139
  list: async () => connection.sendRequest("session.mcp.list", { sessionId }),
2140
+ /**
2141
+ * Lists effective MCP configuration without starting, restarting, authenticating, or waiting for servers. An optional live observation is from an already materialized matching server; this is not a readiness guarantee.
2142
+ *
2143
+ * @returns Effective MCP configuration with optional live observations from matching already materialized servers.
2144
+ */
2145
+ listConfigured: async () => connection.sendRequest("session.mcp.listConfigured", { sessionId }),
1514
2146
  /**
1515
2147
  * Lists the tools exposed by a connected MCP server on this session's host. This performs a live `tools/list` request. Tool UI metadata is returned independently of whether MCP Apps rendering is enabled for the session.
1516
2148
  *
@@ -1518,19 +2150,19 @@ function createSessionRpc(connection, sessionId) {
1518
2150
  *
1519
2151
  * @returns Tools exposed by the connected MCP server. Throws when the server is not connected.
1520
2152
  */
1521
- listTools: async (params) => connection.sendRequest("session.mcp.listTools", { sessionId, ...params }),
2153
+ listTools: async (params) => connection.sendRequest("session.mcp.listTools", { ...params, sessionId }),
1522
2154
  /**
1523
2155
  * Enables an MCP server for the session.
1524
2156
  *
1525
2157
  * @param params Name of the MCP server to enable for the session.
1526
2158
  */
1527
- enable: async (params) => connection.sendRequest("session.mcp.enable", { sessionId, ...params }),
2159
+ enable: async (params) => connection.sendRequest("session.mcp.enable", { ...params, sessionId }),
1528
2160
  /**
1529
2161
  * Disables an MCP server for the session.
1530
2162
  *
1531
2163
  * @param params Name of the MCP server to disable for the session.
1532
2164
  */
1533
- disable: async (params) => connection.sendRequest("session.mcp.disable", { sessionId, ...params }),
2165
+ disable: async (params) => connection.sendRequest("session.mcp.disable", { ...params, sessionId }),
1534
2166
  /**
1535
2167
  * Reloads MCP server connections for the session.
1536
2168
  */
@@ -1548,7 +2180,7 @@ function createSessionRpc(connection, sessionId) {
1548
2180
  *
1549
2181
  * @returns Outcome of an MCP sampling execution: success result, failure error, or cancellation.
1550
2182
  */
1551
- executeSampling: async (params) => connection.sendRequest("session.mcp.executeSampling", { sessionId, ...params }),
2183
+ executeSampling: async (params) => connection.sendRequest("session.mcp.executeSampling", { ...params, sessionId }),
1552
2184
  /**
1553
2185
  * Cancels an in-flight MCP sampling execution by request ID.
1554
2186
  *
@@ -1556,7 +2188,7 @@ function createSessionRpc(connection, sessionId) {
1556
2188
  *
1557
2189
  * @returns Indicates whether an in-flight sampling execution with the given requestId was found and cancelled.
1558
2190
  */
1559
- cancelSamplingExecution: async (params) => connection.sendRequest("session.mcp.cancelSamplingExecution", { sessionId, ...params }),
2191
+ cancelSamplingExecution: async (params) => connection.sendRequest("session.mcp.cancelSamplingExecution", { ...params, sessionId }),
1560
2192
  /**
1561
2193
  * Sets how environment-variable values supplied to MCP servers are resolved (direct or indirect).
1562
2194
  *
@@ -1564,7 +2196,7 @@ function createSessionRpc(connection, sessionId) {
1564
2196
  *
1565
2197
  * @returns Env-value mode recorded on the session after the update.
1566
2198
  */
1567
- setEnvValueMode: async (params) => connection.sendRequest("session.mcp.setEnvValueMode", { sessionId, ...params }),
2199
+ setEnvValueMode: async (params) => connection.sendRequest("session.mcp.setEnvValueMode", { ...params, sessionId }),
1568
2200
  /**
1569
2201
  * Removes the auto-managed `github` MCP server when present.
1570
2202
  *
@@ -1576,19 +2208,19 @@ function createSessionRpc(connection, sessionId) {
1576
2208
  *
1577
2209
  * @param params Server name and optional configuration for an individual MCP server start. Omit `config` for a config-free start-by-name of an already-configured server.
1578
2210
  */
1579
- startServer: async (params) => connection.sendRequest("session.mcp.startServer", { sessionId, ...params }),
2211
+ startServer: async (params) => connection.sendRequest("session.mcp.startServer", { ...params, sessionId }),
1580
2212
  /**
1581
2213
  * Restarts an individual MCP server on the live session (stops then starts). Omit `config` for a config-free restart-by-name of an already-configured server; supply `config` to restart with a replacement configuration. Session-scoped and ephemeral: does NOT modify persistent user configuration (`mcp.config.*`).
1582
2214
  *
1583
2215
  * @param params Server name and optional replacement configuration for an individual MCP server restart. Omit `config` for a config-free restart-by-name of an already-configured server.
1584
2216
  */
1585
- restartServer: async (params) => connection.sendRequest("session.mcp.restartServer", { sessionId, ...params }),
2217
+ restartServer: async (params) => connection.sendRequest("session.mcp.restartServer", { ...params, sessionId }),
1586
2218
  /**
1587
2219
  * Stops an individual MCP server on the session's host.
1588
2220
  *
1589
2221
  * @param params Server name for an individual MCP server stop.
1590
2222
  */
1591
- stopServer: async (params) => connection.sendRequest("session.mcp.stopServer", { sessionId, ...params }),
2223
+ stopServer: async (params) => connection.sendRequest("session.mcp.stopServer", { ...params, sessionId }),
1592
2224
  /**
1593
2225
  * Checks whether a named MCP server is currently running on the session's host.
1594
2226
  *
@@ -1596,7 +2228,7 @@ function createSessionRpc(connection, sessionId) {
1596
2228
  *
1597
2229
  * @returns Whether the named MCP server is running.
1598
2230
  */
1599
- isServerRunning: async (params) => connection.sendRequest("session.mcp.isServerRunning", { sessionId, ...params }),
2231
+ isServerRunning: async (params) => connection.sendRequest("session.mcp.isServerRunning", { ...params, sessionId }),
1600
2232
  /** @experimental */
1601
2233
  oauth: {
1602
2234
  /**
@@ -1606,21 +2238,35 @@ function createSessionRpc(connection, sessionId) {
1606
2238
  *
1607
2239
  * @returns Indicates whether the pending MCP OAuth response was accepted.
1608
2240
  */
1609
- handlePendingRequest: async (params) => connection.sendRequest("session.mcp.oauth.handlePendingRequest", { sessionId, ...params }),
2241
+ handlePendingRequest: async (params) => connection.sendRequest("session.mcp.oauth.handlePendingRequest", { ...params, sessionId }),
1610
2242
  /**
1611
2243
  * Notifies the session that MCP OAuth authentication succeeded and updated credentials were persisted, so cached tool definitions can be refreshed.
1612
2244
  *
1613
2245
  * @param params Identifies the MCP server whose persisted OAuth credentials were updated.
1614
2246
  */
1615
- authenticationStateChanged: async (params) => connection.sendRequest("session.mcp.oauth.authenticationStateChanged", { sessionId, ...params }),
2247
+ authenticationStateChanged: async (params) => connection.sendRequest("session.mcp.oauth.authenticationStateChanged", { ...params, sessionId }),
2248
+ /**
2249
+ * Prepares an inert, expiring owned OAuth login bound to the original session requester and exact installation. Does not activate, connect, read credentials or open a browser.
2250
+ *
2251
+ * @param params Effect-free preparation bound to the existing local session, requester and installation, with frozen options.
2252
+ *
2253
+ * @returns An inert runtime-issued login handle. Preparation alone performs no activation or OAuth work.
2254
+ */
2255
+ prepareLogin: async (params) => connection.sendRequest("session.mcp.oauth.prepareLogin", { ...params, sessionId }),
1616
2256
  /**
1617
- * Starts OAuth authentication for a remote MCP server.
2257
+ * Starts OAuth authentication for a remote MCP server. Owned servers require the original one-use prepareLogin handle and exact installation ID; manual servers retain the existing direct login behaviour.
1618
2258
  *
1619
- * @param params Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, callback success-page copy, and static OAuth client selection.
2259
+ * @param params Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, callback handling, and static OAuth client selection.
1620
2260
  *
1621
2261
  * @returns OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server.
1622
2262
  */
1623
- login: async (params) => connection.sendRequest("session.mcp.oauth.login", { sessionId, ...params }),
2263
+ login: async (params) => connection.sendRequest("session.mcp.oauth.login", { ...params, sessionId }),
2264
+ /**
2265
+ * Completes a runtime-managed MCP OAuth login after the authorization server redirects to a host-managed callback URL.
2266
+ *
2267
+ * @param params Host-delivered callback for a runtime-managed MCP OAuth login.
2268
+ */
2269
+ complete: async (params) => connection.sendRequest("session.mcp.oauth.complete", { ...params, sessionId }),
1624
2270
  /**
1625
2271
  * Passively probes a configured remote MCP server to classify whether OAuth is required or a cached/override token is accepted. Does not start OAuth, emit pending OAuth requests, or mutate MCP connection state.
1626
2272
  *
@@ -1628,7 +2274,15 @@ function createSessionRpc(connection, sessionId) {
1628
2274
  *
1629
2275
  * @returns Passive MCP OAuth probe result. `authenticated` means the server accepted the probe request while an OAuth-origin access token was attached; it does not prove the server required or independently validated that token. The probe does not make a second unauthenticated request. Failed is an expected probe-domain outcome; JSON-RPC errors are reserved for API-call failures.
1630
2276
  */
1631
- probe: async (params) => connection.sendRequest("session.mcp.oauth.probe", { sessionId, ...params }),
2277
+ probe: async (params) => connection.sendRequest("session.mcp.oauth.probe", { ...params, sessionId }),
2278
+ /**
2279
+ * Cancels the exact owned OAuth login issued to this original session requester, without clearing shared credentials.
2280
+ *
2281
+ * @param params Targets only the original prepared/applying owned login on this exact session requester.
2282
+ *
2283
+ * @returns Honest terminal cancellation result; persistence or recovery failures remain RPC errors.
2284
+ */
2285
+ cancelLogin: async (params) => connection.sendRequest("session.mcp.oauth.cancelLogin", { ...params, sessionId }),
1632
2286
  /**
1633
2287
  * Responds to a pending MCP OAuth authorization request by its request id.
1634
2288
  *
@@ -1636,7 +2290,7 @@ function createSessionRpc(connection, sessionId) {
1636
2290
  *
1637
2291
  * @returns Indicates whether the pending MCP OAuth response was accepted.
1638
2292
  */
1639
- respond: async (params) => connection.sendRequest("session.mcp.oauth.respond", { sessionId, ...params })
2293
+ respond: async (params) => connection.sendRequest("session.mcp.oauth.respond", { ...params, sessionId })
1640
2294
  },
1641
2295
  /** @experimental */
1642
2296
  headers: {
@@ -1647,7 +2301,7 @@ function createSessionRpc(connection, sessionId) {
1647
2301
  *
1648
2302
  * @returns Indicates whether the pending MCP headers refresh response was accepted.
1649
2303
  */
1650
- handlePendingHeadersRefreshRequest: async (params) => connection.sendRequest("session.mcp.headers.handlePendingHeadersRefreshRequest", { sessionId, ...params })
2304
+ handlePendingHeadersRefreshRequest: async (params) => connection.sendRequest("session.mcp.headers.handlePendingHeadersRefreshRequest", { ...params, sessionId })
1651
2305
  },
1652
2306
  /** @experimental */
1653
2307
  apps: {
@@ -1658,7 +2312,7 @@ function createSessionRpc(connection, sessionId) {
1658
2312
  *
1659
2313
  * @returns Resource contents returned by the MCP server.
1660
2314
  */
1661
- readResource: async (params) => connection.sendRequest("session.mcp.apps.readResource", { sessionId, ...params }),
2315
+ readResource: async (params) => connection.sendRequest("session.mcp.apps.readResource", { ...params, sessionId }),
1662
2316
  /**
1663
2317
  * List tools that an MCP App view is allowed to call (SEP-1865 visibility filter). Returns tools whose `_meta.ui.visibility` is unset (default `["model","app"]`) or includes `"app"`.
1664
2318
  *
@@ -1666,7 +2320,7 @@ function createSessionRpc(connection, sessionId) {
1666
2320
  *
1667
2321
  * @returns App-callable tools from the named MCP server.
1668
2322
  */
1669
- listTools: async (params) => connection.sendRequest("session.mcp.apps.listTools", { sessionId, ...params }),
2323
+ listTools: async (params) => connection.sendRequest("session.mcp.apps.listTools", { ...params, sessionId }),
1670
2324
  /**
1671
2325
  * Call an MCP tool from an MCP App view (SEP-1865). Enforces the visibility check that prevents an app iframe from invoking model-only tools. Returns the standard MCP `CallToolResult`.
1672
2326
  *
@@ -1674,13 +2328,13 @@ function createSessionRpc(connection, sessionId) {
1674
2328
  *
1675
2329
  * @returns Standard MCP CallToolResult
1676
2330
  */
1677
- callTool: async (params) => connection.sendRequest("session.mcp.apps.callTool", { sessionId, ...params }),
2331
+ callTool: async (params) => connection.sendRequest("session.mcp.apps.callTool", { ...params, sessionId }),
1678
2332
  /**
1679
2333
  * Replace the host context returned to MCP App guests on `ui/initialize`. Hosts use this to advertise theme, locale, or other metadata to the guest UI.
1680
2334
  *
1681
2335
  * @param params Host context to advertise to MCP App guests.
1682
2336
  */
1683
- setHostContext: async (params) => connection.sendRequest("session.mcp.apps.setHostContext", { sessionId, ...params }),
2337
+ setHostContext: async (params) => connection.sendRequest("session.mcp.apps.setHostContext", { ...params, sessionId }),
1684
2338
  /**
1685
2339
  * Read the current host context advertised to MCP App guests.
1686
2340
  *
@@ -1694,7 +2348,7 @@ function createSessionRpc(connection, sessionId) {
1694
2348
  *
1695
2349
  * @returns Diagnostic snapshot of MCP Apps wiring for the named server.
1696
2350
  */
1697
- diagnose: async (params) => connection.sendRequest("session.mcp.apps.diagnose", { sessionId, ...params })
2351
+ diagnose: async (params) => connection.sendRequest("session.mcp.apps.diagnose", { ...params, sessionId })
1698
2352
  },
1699
2353
  /** @experimental */
1700
2354
  resources: {
@@ -1705,7 +2359,7 @@ function createSessionRpc(connection, sessionId) {
1705
2359
  *
1706
2360
  * @returns Resource contents returned by the MCP server.
1707
2361
  */
1708
- read: async (params) => connection.sendRequest("session.mcp.resources.read", { sessionId, ...params }),
2362
+ read: async (params) => connection.sendRequest("session.mcp.resources.read", { ...params, sessionId }),
1709
2363
  /**
1710
2364
  * Enumerate one page of resources a connected MCP server exposes (proxies MCP `resources/list`). Pass `cursor` to continue from a prior result's `nextCursor`.
1711
2365
  *
@@ -1713,7 +2367,7 @@ function createSessionRpc(connection, sessionId) {
1713
2367
  *
1714
2368
  * @returns One page of resources advertised by the named MCP server.
1715
2369
  */
1716
- list: async (params) => connection.sendRequest("session.mcp.resources.list", { sessionId, ...params }),
2370
+ list: async (params) => connection.sendRequest("session.mcp.resources.list", { ...params, sessionId }),
1717
2371
  /**
1718
2372
  * Enumerate one page of resource templates a connected MCP server exposes (proxies MCP `resources/templates/list`). Pass `cursor` to continue from a prior result's `nextCursor`.
1719
2373
  *
@@ -1721,23 +2375,222 @@ function createSessionRpc(connection, sessionId) {
1721
2375
  *
1722
2376
  * @returns One page of resource templates advertised by the named MCP server.
1723
2377
  */
1724
- listTemplates: async (params) => connection.sendRequest("session.mcp.resources.listTemplates", { sessionId, ...params })
2378
+ listTemplates: async (params) => connection.sendRequest("session.mcp.resources.listTemplates", { ...params, sessionId })
2379
+ },
2380
+ /** @experimental */
2381
+ prompts: {
2382
+ /**
2383
+ * Enumerate one page of prompts a connected MCP server exposes (proxies MCP `prompts/list`). Pass `cursor` to continue from a prior result's `nextCursor`.
2384
+ *
2385
+ * @param params MCP server whose prompts to enumerate.
2386
+ *
2387
+ * @returns One page of prompts advertised by the named MCP server.
2388
+ */
2389
+ list: async (params) => connection.sendRequest("session.mcp.prompts.list", { ...params, sessionId }),
2390
+ /**
2391
+ * Get a prompt's messages from a connected MCP server (proxies MCP `prompts/get`). Content is preserved as opaque JSON. Does not send messages to the model, execute tools, or fetch referenced resources.
2392
+ *
2393
+ * @param params MCP server, prompt name, and optional string-valued arguments.
2394
+ *
2395
+ * @returns Prompt messages returned by the MCP server without sending them to the model.
2396
+ */
2397
+ get: async (params) => connection.sendRequest("session.mcp.prompts.get", { ...params, sessionId })
1725
2398
  }
1726
2399
  },
1727
2400
  /** @experimental */
2401
+ diagnostics: {
2402
+ /**
2403
+ * Patches configured session diagnostic sources without restarting their producers. Setting a source level to off clears its retained diagnostics and invalidates cursors selecting that source.
2404
+ *
2405
+ * @param params Patch session diagnostic thresholds for explicitly supplied sources.
2406
+ *
2407
+ * @returns Per-source session diagnostics configuration.
2408
+ */
2409
+ configure: async (params) => connection.sendRequest("session.diagnostics.configure", { ...params, sessionId }),
2410
+ /**
2411
+ * Reads a bounded batch of retained session diagnostics for the selected sources. Records are never consumed and each reader advances independently through its opaque cursor.
2412
+ *
2413
+ * @param params Cursor-based request for session diagnostics. The default limit is 100 (maximum 500); the default waitMs is zero (maximum 30000).
2414
+ *
2415
+ * @returns One cursor-addressed page of retained session diagnostics.
2416
+ */
2417
+ read: async (params) => connection.sendRequest("session.diagnostics.read", { ...params, sessionId })
2418
+ },
2419
+ /** @experimental */
2420
+ connectors: {
2421
+ /**
2422
+ * Returns feature availability and bounded polling limits for the EXPERIMENTAL session connector API. This method never performs a Connector service request.
2423
+ *
2424
+ * @returns Feature detection and hard polling limits for the EXPERIMENTAL session connector API.
2425
+ */
2426
+ getCapabilities: async () => connection.sendRequest("session.connectors.getCapabilities", { sessionId }),
2427
+ /**
2428
+ * Returns the session account selection, or null.
2429
+ *
2430
+ * @returns Session account selection, or null.
2431
+ */
2432
+ getAccount: async () => connection.sendRequest("session.connectors.getAccount", { sessionId }),
2433
+ /**
2434
+ * Returns authoritative session Connector state from current availability, pinned account selection, cached catalog, and live MCP projection without performing a Connector service request.
2435
+ *
2436
+ * @returns Authoritative session connector state. Account IDs are opaque routing identifiers and credentials are never included.
2437
+ */
2438
+ getStatus: async () => connection.sendRequest("session.connectors.getStatus", { sessionId }),
2439
+ /**
2440
+ * Returns the cached Connector catalog for the pinned opaque account selection, fetching it only when this session has no cached catalog.
2441
+ *
2442
+ * @param params Pins a Connector operation to one host-owned GitHub account through its opaque selection ID. Provider tokens are never accepted.
2443
+ *
2444
+ * @returns Validated Connector catalog snapshot cached by the session.
2445
+ */
2446
+ list: async (params) => connection.sendRequest("session.connectors.list", { ...params, sessionId }),
2447
+ /**
2448
+ * Refreshes and validates the Connector catalog for the pinned opaque account selection.
2449
+ *
2450
+ * @param params Pins a Connector operation to one host-owned GitHub account through its opaque selection ID. Provider tokens are never accepted.
2451
+ *
2452
+ * @returns Validated Connector catalog snapshot cached by the session.
2453
+ */
2454
+ refresh: async (params) => connection.sendRequest("session.connectors.refresh", { ...params, sessionId }),
2455
+ /**
2456
+ * Initiates an idempotent Connector connection request without opening a browser. Returns connected when the service is immediately authoritative, consent_required with a validated URL, or pending with an opaque continuation ID.
2457
+ *
2458
+ * @param params Selects one Connector and the pinned host-owned account used for its service and MCP authorization.
2459
+ *
2460
+ * @returns Typed result of initiating or continuing a Connector connection.
2461
+ */
2462
+ connect: async (params) => connection.sendRequest("session.connectors.connect", { ...params, sessionId }),
2463
+ /**
2464
+ * Re-initiates an idempotent Connector connection request without browser or UI effects, with the same typed outcomes as connect.
2465
+ *
2466
+ * @param params Selects one Connector and the pinned host-owned account used for its service and MCP authorization.
2467
+ *
2468
+ * @returns Typed result of initiating or continuing a Connector connection.
2469
+ */
2470
+ reconnect: async (params) => connection.sendRequest("session.connectors.reconnect", { ...params, sessionId }),
2471
+ /**
2472
+ * Continues a pending Connector connection with caller-supplied attempt, interval, and deadline bounds. The runtime never opens the returned consent URL.
2473
+ *
2474
+ * @param params Explicitly bounded continuation of a pending Connector connection.
2475
+ *
2476
+ * @returns Typed result of initiating or continuing a Connector connection.
2477
+ */
2478
+ continueConnection: async (params) => connection.sendRequest("session.connectors.continueConnection", { ...params, sessionId }),
2479
+ /**
2480
+ * Disconnects one Connector for the pinned opaque account selection, refreshes the authoritative catalog, and removes its session-owned MCP projection.
2481
+ *
2482
+ * @param params Selects one Connector and the pinned host-owned account used for its service and MCP authorization.
2483
+ *
2484
+ * @returns Authoritative result after disconnect and MCP reconciliation.
2485
+ */
2486
+ disconnect: async (params) => connection.sendRequest("session.connectors.disconnect", { ...params, sessionId }),
2487
+ /**
2488
+ * Reconciles the authoritative cached or freshly requested Connector catalog into the session Connector MCP projection and returns live status.
2489
+ *
2490
+ * @param params Requests authoritative Connector-to-MCP reconciliation for the pinned account.
2491
+ *
2492
+ * @returns Authoritative session connector state. Account IDs are opaque routing identifiers and credentials are never included.
2493
+ */
2494
+ reconcile: async (params) => connection.sendRequest("session.connectors.reconcile", { ...params, sessionId })
2495
+ },
2496
+ /** @experimental */
2497
+ managedSettings: {
2498
+ /**
2499
+ * Waits for the live session's in-flight managed-settings application, then returns the retained effective snapshot used by runtime enforcement and by `session.managed_settings_resolved`. It does not perform another account, device, or server resolution, and rejects when resolution has not produced a snapshot.
2500
+ *
2501
+ * @returns Effective enterprise managed settings and contributing channels. Session events report applied policy; sessionless resolve reports an account/device snapshot, and compose reports a non-applying preview of candidate documents. Device values take precedence over server values, then the policy helper, per ordinary key, while permissions compose restrictively. Session-local SDK-client policy is included only in session results. Marked experimental while the managed-settings surface stabilizes.
2502
+ */
2503
+ get: async () => connection.sendRequest("session.managedSettings.get", { sessionId })
2504
+ },
2505
+ /** @experimental */
1728
2506
  plugins: {
1729
2507
  /**
1730
- * Lists plugins installed for the session.
2508
+ * Lists globally installed, live, built-in, and enterprise-managed desired plugins using the live session's authoritative account, working directory, and retained managed policy.
1731
2509
  *
1732
2510
  * @returns Plugins installed for the session, with their enabled state and version metadata.
1733
2511
  */
1734
2512
  list: async () => connection.sendRequest("session.plugins.list", { sessionId }),
2513
+ /**
2514
+ * Installs a plugin using the live session's authoritative account, working directory, and retained managed policy.
2515
+ *
2516
+ * @param params Plugin source resolved relative to the session's authoritative working directory.
2517
+ *
2518
+ * @returns Result of installing a plugin.
2519
+ */
2520
+ install: async (params) => connection.sendRequest("session.plugins.install", { ...params, sessionId }),
2521
+ /**
2522
+ * Uninstalls a plugin when permitted by the live session's retained managed policy.
2523
+ *
2524
+ * @param params Name (or spec) of the plugin to uninstall.
2525
+ */
2526
+ uninstall: async (params) => connection.sendRequest("session.plugins.uninstall", { ...params, sessionId }),
2527
+ /**
2528
+ * Updates an installed plugin using the live session's authoritative account, working directory, and retained managed policy.
2529
+ *
2530
+ * @param params Name (or spec) of the plugin to update.
2531
+ *
2532
+ * @returns Result of updating a single plugin.
2533
+ */
2534
+ update: async (params) => connection.sendRequest("session.plugins.update", { ...params, sessionId }),
2535
+ /**
2536
+ * Enables installed plugins when permitted by the live session's retained managed policy.
2537
+ *
2538
+ * @param params Plugin names (or specs) to enable in the session's authoritative working directory.
2539
+ */
2540
+ enable: async (params) => connection.sendRequest("session.plugins.enable", { ...params, sessionId }),
2541
+ /**
2542
+ * Disables installed plugins when permitted by the live session's retained managed policy.
2543
+ *
2544
+ * @param params Plugin names (or specs) to disable in the session's authoritative working directory.
2545
+ */
2546
+ disable: async (params) => connection.sendRequest("session.plugins.disable", { ...params, sessionId }),
2547
+ /** @experimental */
2548
+ marketplaces: {
2549
+ /**
2550
+ * Lists registered and enterprise-managed desired marketplaces using the live session's retained policy.
2551
+ *
2552
+ * @returns All registered marketplaces, including built-in defaults.
2553
+ */
2554
+ list: async () => connection.sendRequest("session.plugins.marketplaces.list", { sessionId }),
2555
+ /**
2556
+ * Adds a marketplace when permitted by the live session's retained managed policy.
2557
+ *
2558
+ * @param params Marketplace source and optional working directory for relative-path resolution.
2559
+ *
2560
+ * @returns Result of registering a new marketplace.
2561
+ */
2562
+ add: async (params) => connection.sendRequest("session.plugins.marketplaces.add", { ...params, sessionId }),
2563
+ /**
2564
+ * Removes a marketplace when permitted by the live session's retained managed policy.
2565
+ *
2566
+ * @param params Name of the marketplace to remove and an optional force flag.
2567
+ *
2568
+ * @returns Outcome of the remove attempt, including dependent-plugin info when applicable.
2569
+ */
2570
+ remove: async (params) => connection.sendRequest("session.plugins.marketplaces.remove", { ...params, sessionId }),
2571
+ /**
2572
+ * Browses a marketplace resolved through the live session's working directory and retained managed policy.
2573
+ *
2574
+ * @param params Name of the marketplace whose plugin catalog to fetch.
2575
+ *
2576
+ * @returns Plugins advertised by the marketplace.
2577
+ */
2578
+ browse: async (params) => connection.sendRequest("session.plugins.marketplaces.browse", { ...params, sessionId }),
2579
+ /**
2580
+ * Refreshes marketplaces resolved through the live session's working directory and retained managed policy.
2581
+ *
2582
+ * @param params Optional marketplace name; omit to refresh all.
2583
+ *
2584
+ * @returns Result of refreshing one or more marketplace catalogs.
2585
+ */
2586
+ refresh: async (params) => connection.sendRequest("session.plugins.marketplaces.refresh", { ...params, sessionId })
2587
+ },
1735
2588
  /**
1736
2589
  * Reloads the session's plugin set, refreshing MCP servers, custom agents, hooks, and skills cache so SDK-driven changes via `server.plugins.*` take effect immediately.
1737
2590
  *
1738
2591
  * @param params Optional flags controlling which side effects the reload performs.
1739
2592
  */
1740
- reload: async (params) => connection.sendRequest("session.plugins.reload", { sessionId, ...params })
2593
+ reload: async (params) => connection.sendRequest("session.plugins.reload", { ...params, sessionId })
1741
2594
  },
1742
2595
  /** @experimental */
1743
2596
  provider: {
@@ -1748,7 +2601,7 @@ function createSessionRpc(connection, sessionId) {
1748
2601
  *
1749
2602
  * @returns A snapshot of the provider endpoint the session is currently configured to talk to.
1750
2603
  */
1751
- getEndpoint: async (params) => connection.sendRequest("session.provider.getEndpoint", { sessionId, ...params }),
2604
+ getEndpoint: async (params) => connection.sendRequest("session.provider.getEndpoint", { ...params, sessionId }),
1752
2605
  /**
1753
2606
  * Adds BYOK providers and/or models to the session's registry at runtime, extending the additive registry built from the session's `providers`/`models` options. Both fields are optional, so a call may add providers only, models only, or both. Within a single call providers are registered before models, so a model may reference a provider added in the same call; across calls a model may reference any provider already registered (from session creation or a prior add). A model whose referenced provider is not registered by the end of the call is rejected. Newly added models become selectable via `model.list` / `model.switchTo` and are inherited by sub-agents spawned afterwards.
1754
2607
  *
@@ -1756,7 +2609,23 @@ function createSessionRpc(connection, sessionId) {
1756
2609
  *
1757
2610
  * @returns The selectable model entries synthesized for the models added by this call.
1758
2611
  */
1759
- add: async (params) => connection.sendRequest("session.provider.add", { sessionId, ...params })
2612
+ add: async (params) => connection.sendRequest("session.provider.add", { ...params, sessionId }),
2613
+ /**
2614
+ * Atomically updates the session's BYOK provider and model registry by applying the supplied snapshot, replacing existing entries, updating models, or removing entries absent from the snapshot.
2615
+ *
2616
+ * @param params Authoritative BYOK provider and model registry snapshot to apply atomically to the session.
2617
+ *
2618
+ * @returns The selectable model entries and selection ids synthesized for the synchronized BYOK models.
2619
+ */
2620
+ sync: async (params) => connection.sendRequest("session.provider.sync", { ...params, sessionId }),
2621
+ /**
2622
+ * Withdraws named host-managed models from the session's BYOK registry, leaving every other entry untouched. The scoped counterpart to `provider.sync`: a snapshot can only describe entries the caller knows about, so using it to remove one model silently withdraws rows registered by another source, such as a plugin calling `provider.add` at runtime. Naming what to remove leaves unrelated entries alone. Selection ids that are not registered are ignored, so withdrawal is idempotent. A provider is removed only when one of the withdrawn models was the last entry referencing it; a provider that simply has no models, which is the normal state while its rows are supplied by catalog discovery, is left in place.
2623
+ *
2624
+ * @param params Host-managed model selection ids to withdraw from the session's BYOK registry.
2625
+ *
2626
+ * @returns What the withdrawal actually removed from the registry.
2627
+ */
2628
+ withdraw: async (params) => connection.sendRequest("session.provider.withdraw", { ...params, sessionId })
1760
2629
  },
1761
2630
  /** @experimental */
1762
2631
  options: {
@@ -1767,7 +2636,7 @@ function createSessionRpc(connection, sessionId) {
1767
2636
  *
1768
2637
  * @returns Indicates whether the session options patch was applied successfully.
1769
2638
  */
1770
- update: async (params) => connection.sendRequest("session.options.update", { sessionId, ...params })
2639
+ update: async (params) => connection.sendRequest("session.options.update", { ...params, sessionId })
1771
2640
  },
1772
2641
  /** @experimental */
1773
2642
  lsp: {
@@ -1776,7 +2645,7 @@ function createSessionRpc(connection, sessionId) {
1776
2645
  *
1777
2646
  * @param params Parameters for (re)loading the merged LSP configuration set.
1778
2647
  */
1779
- initialize: async (params) => connection.sendRequest("session.lsp.initialize", { sessionId, ...params })
2648
+ initialize: async (params) => connection.sendRequest("session.lsp.initialize", { ...params, sessionId })
1780
2649
  },
1781
2650
  /** @experimental */
1782
2651
  extensions: {
@@ -1787,27 +2656,33 @@ function createSessionRpc(connection, sessionId) {
1787
2656
  */
1788
2657
  list: async () => connection.sendRequest("session.extensions.list", { sessionId }),
1789
2658
  /**
1790
- * Enables an extension for the session.
2659
+ * Enables an extension for the session and persists the preference when the session has a settings store. Hosts synchronizing effective membership should use extensions.reconcile instead.
1791
2660
  *
1792
2661
  * @param params Source-qualified extension identifier to enable for the session.
1793
2662
  */
1794
- enable: async (params) => connection.sendRequest("session.extensions.enable", { sessionId, ...params }),
2663
+ enable: async (params) => connection.sendRequest("session.extensions.enable", { ...params, sessionId }),
1795
2664
  /**
1796
- * Disables an extension for the session.
2665
+ * Disables an extension for the session and persists the preference when the session has a settings store. Hosts synchronizing effective membership should use extensions.reconcile instead.
1797
2666
  *
1798
2667
  * @param params Source-qualified extension identifier to disable for the session.
1799
2668
  */
1800
- disable: async (params) => connection.sendRequest("session.extensions.disable", { sessionId, ...params }),
2669
+ disable: async (params) => connection.sendRequest("session.extensions.disable", { ...params, sessionId }),
1801
2670
  /**
1802
2671
  * Reloads extension definitions and processes for the session.
1803
2672
  */
1804
2673
  reload: async () => connection.sendRequest("session.extensions.reload", { sessionId }),
2674
+ /**
2675
+ * Host-only reconciliation of authoritative session-effective extension membership and enablement. Refreshes runtime-owned discovery and preferences without persisting settings, installing plugins, or restarting unchanged activations. Returns ExtensionList only after required starts and process/contribution cleanup settle. Takes no caller inventory or overrides. Missing controllers, unready/incomplete discovery, unavailable workspaces, superseded inputs, and lifecycle failures are errors, not empty membership. Independently proven revocations may be applied before an error; retry converges without restarting healthy activations. Error data contains lifecycleChangesApplied and code: extension_reconciliation_host_required, extension_reconciliation_unavailable, extension_reconciliation_not_ready, extension_reconciliation_discovery_failed, extension_reconciliation_workspace_unavailable, extension_reconciliation_superseded, or extension_reconciliation_lifecycle_failed. Mark host reconciliation state applied only on success. On older runtimes, method-not-found must not fall back to global discovery and persistent extension disables.
2676
+ *
2677
+ * @returns Extensions discovered for the session, with their current status.
2678
+ */
2679
+ reconcile: async () => connection.sendRequest("session.extensions.reconcile", { sessionId }),
1805
2680
  /**
1806
2681
  * Push attachments into the next user-message turn from an extension. The host should surface them as composer pills and forward them via the next session.send call. Callable only by extension-owned connections.
1807
2682
  *
1808
2683
  * @param params Parameters for session.extensions.sendAttachmentsToMessage.
1809
2684
  */
1810
- sendAttachmentsToMessage: async (params) => connection.sendRequest("session.extensions.sendAttachmentsToMessage", { sessionId, ...params })
2685
+ sendAttachmentsToMessage: async (params) => connection.sendRequest("session.extensions.sendAttachmentsToMessage", { ...params, sessionId })
1811
2686
  },
1812
2687
  /** @experimental */
1813
2688
  tools: {
@@ -1818,7 +2693,7 @@ function createSessionRpc(connection, sessionId) {
1818
2693
  *
1819
2694
  * @returns Canonical result returned by a session tool.
1820
2695
  */
1821
- execute: async (params) => connection.sendRequest("session.tools.execute", { sessionId, ...params }),
2696
+ execute: async (params) => connection.sendRequest("session.tools.execute", { ...params, sessionId }),
1822
2697
  /**
1823
2698
  * Returns the Rust-owned built-in tool descriptors used to construct the session's offered tool set.
1824
2699
  *
@@ -1826,7 +2701,7 @@ function createSessionRpc(connection, sessionId) {
1826
2701
  *
1827
2702
  * @returns Rust-owned built-in tool descriptors for the session.
1828
2703
  */
1829
- getBuiltinDescriptors: async (params) => connection.sendRequest("session.tools.getBuiltinDescriptors", { sessionId, ...params }),
2704
+ getBuiltinDescriptors: async (params) => connection.sendRequest("session.tools.getBuiltinDescriptors", { ...params, sessionId }),
1830
2705
  /**
1831
2706
  * Projects a completed task_complete tool call into its label-safe session event payload.
1832
2707
  *
@@ -1834,7 +2709,7 @@ function createSessionRpc(connection, sessionId) {
1834
2709
  *
1835
2710
  * @returns Task completion notification with summary from the agent
1836
2711
  */
1837
- taskCompleteEventData: async (params) => connection.sendRequest("session.tools.taskCompleteEventData", { sessionId, ...params }),
2712
+ taskCompleteEventData: async (params) => connection.sendRequest("session.tools.taskCompleteEventData", { ...params, sessionId }),
1838
2713
  /**
1839
2714
  * Provides the result for a pending external tool call.
1840
2715
  *
@@ -1842,7 +2717,13 @@ function createSessionRpc(connection, sessionId) {
1842
2717
  *
1843
2718
  * @returns Indicates whether the external tool call result was handled successfully.
1844
2719
  */
1845
- handlePendingToolCall: async (params) => connection.sendRequest("session.tools.handlePendingToolCall", { sessionId, ...params }),
2720
+ handlePendingToolCall: async (params) => connection.sendRequest("session.tools.handlePendingToolCall", { ...params, sessionId }),
2721
+ /**
2722
+ * Lists the external tool calls of the session and its sub-agents that are still waiting for session.tools.handlePendingToolCall.
2723
+ *
2724
+ * @returns External tool calls still waiting for a result.
2725
+ */
2726
+ listPendingRequests: async () => connection.sendRequest("session.tools.listPendingRequests", { sessionId }),
1846
2727
  /**
1847
2728
  * Resolves, builds, and validates the runtime tool list for the session.
1848
2729
  *
@@ -1862,7 +2743,7 @@ function createSessionRpc(connection, sessionId) {
1862
2743
  *
1863
2744
  * @returns Empty result after replacing the calling connection's externally implemented tools.
1864
2745
  */
1865
- set: async (params) => connection.sendRequest("session.tools.set", { sessionId, ...params }),
2746
+ set: async (params) => connection.sendRequest("session.tools.set", { ...params, sessionId }),
1866
2747
  /**
1867
2748
  * 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.
1868
2749
  *
@@ -1870,7 +2751,7 @@ function createSessionRpc(connection, sessionId) {
1870
2751
  *
1871
2752
  * @returns Empty result after applying subagent settings
1872
2753
  */
1873
- updateSubagentSettings: async (params) => connection.sendRequest("session.tools.updateSubagentSettings", { sessionId, ...params })
2754
+ updateSubagentSettings: async (params) => connection.sendRequest("session.tools.updateSubagentSettings", { ...params, sessionId })
1874
2755
  },
1875
2756
  /** @experimental */
1876
2757
  commands: {
@@ -1881,7 +2762,7 @@ function createSessionRpc(connection, sessionId) {
1881
2762
  *
1882
2763
  * @returns Slash commands available in the session, after applying any include/exclude filters.
1883
2764
  */
1884
- list: async (params) => connection.sendRequest("session.commands.list", { sessionId, ...params }),
2765
+ list: async (params) => connection.sendRequest("session.commands.list", { ...params, sessionId }),
1885
2766
  /**
1886
2767
  * Invokes a slash command in the session.
1887
2768
  *
@@ -1889,7 +2770,7 @@ function createSessionRpc(connection, sessionId) {
1889
2770
  *
1890
2771
  * @returns Result of invoking the slash command (text output, prompt to send to the agent, completion, or subcommand selection).
1891
2772
  */
1892
- invoke: async (params) => connection.sendRequest("session.commands.invoke", { sessionId, ...params }),
2773
+ invoke: async (params) => connection.sendRequest("session.commands.invoke", { ...params, sessionId }),
1893
2774
  /**
1894
2775
  * Reports completion of a pending client-handled slash command.
1895
2776
  *
@@ -1897,7 +2778,7 @@ function createSessionRpc(connection, sessionId) {
1897
2778
  *
1898
2779
  * @returns Indicates whether the pending client-handled command was completed successfully.
1899
2780
  */
1900
- handlePendingCommand: async (params) => connection.sendRequest("session.commands.handlePendingCommand", { sessionId, ...params }),
2781
+ handlePendingCommand: async (params) => connection.sendRequest("session.commands.handlePendingCommand", { ...params, sessionId }),
1901
2782
  /**
1902
2783
  * Executes a slash command synchronously and returns any error.
1903
2784
  *
@@ -1905,7 +2786,7 @@ function createSessionRpc(connection, sessionId) {
1905
2786
  *
1906
2787
  * @returns Error message produced while executing the command, if any.
1907
2788
  */
1908
- execute: async (params) => connection.sendRequest("session.commands.execute", { sessionId, ...params }),
2789
+ execute: async (params) => connection.sendRequest("session.commands.execute", { ...params, sessionId }),
1909
2790
  /**
1910
2791
  * Enqueues a slash command for FIFO processing on the local session.
1911
2792
  *
@@ -1913,7 +2794,7 @@ function createSessionRpc(connection, sessionId) {
1913
2794
  *
1914
2795
  * @returns Indicates whether the command was accepted into the local execution queue.
1915
2796
  */
1916
- enqueue: async (params) => connection.sendRequest("session.commands.enqueue", { sessionId, ...params }),
2797
+ enqueue: async (params) => connection.sendRequest("session.commands.enqueue", { ...params, sessionId }),
1917
2798
  /**
1918
2799
  * Reports whether the host actually executed a queued command and whether to continue processing.
1919
2800
  *
@@ -1921,7 +2802,7 @@ function createSessionRpc(connection, sessionId) {
1921
2802
  *
1922
2803
  * @returns Indicates whether the queued-command response was matched to a pending request.
1923
2804
  */
1924
- respondToQueuedCommand: async (params) => connection.sendRequest("session.commands.respondToQueuedCommand", { sessionId, ...params })
2805
+ respondToQueuedCommand: async (params) => connection.sendRequest("session.commands.respondToQueuedCommand", { ...params, sessionId })
1925
2806
  },
1926
2807
  /** @experimental */
1927
2808
  telemetry: {
@@ -1936,7 +2817,7 @@ function createSessionRpc(connection, sessionId) {
1936
2817
  *
1937
2818
  * @param params Feature override key/value pairs to attach to subsequent telemetry events from this session.
1938
2819
  */
1939
- setFeatureOverrides: async (params) => connection.sendRequest("session.telemetry.setFeatureOverrides", { sessionId, ...params })
2820
+ setFeatureOverrides: async (params) => connection.sendRequest("session.telemetry.setFeatureOverrides", { ...params, sessionId })
1940
2821
  },
1941
2822
  /** @experimental */
1942
2823
  ui: {
@@ -1947,7 +2828,7 @@ function createSessionRpc(connection, sessionId) {
1947
2828
  *
1948
2829
  * @returns Completed transient query. Ordered chunks and the terminal outcome are also delivered through `ui.ephemeral_query` session events while it runs.
1949
2830
  */
1950
- ephemeralQuery: async (params) => connection.sendRequest("session.ui.ephemeralQuery", { sessionId, ...params }),
2831
+ ephemeralQuery: async (params) => connection.sendRequest("session.ui.ephemeralQuery", { ...params, sessionId }),
1951
2832
  /**
1952
2833
  * Requests structured input from a UI-capable client.
1953
2834
  *
@@ -1955,7 +2836,7 @@ function createSessionRpc(connection, sessionId) {
1955
2836
  *
1956
2837
  * @returns The elicitation response (accept with form values, decline, or cancel)
1957
2838
  */
1958
- elicitation: async (params) => connection.sendRequest("session.ui.elicitation", { sessionId, ...params }),
2839
+ elicitation: async (params) => connection.sendRequest("session.ui.elicitation", { ...params, sessionId }),
1959
2840
  /**
1960
2841
  * Provides the user response for a pending elicitation request.
1961
2842
  *
@@ -1963,7 +2844,7 @@ function createSessionRpc(connection, sessionId) {
1963
2844
  *
1964
2845
  * @returns Indicates whether the elicitation response was accepted; false if it was already resolved by another client.
1965
2846
  */
1966
- handlePendingElicitation: async (params) => connection.sendRequest("session.ui.handlePendingElicitation", { sessionId, ...params }),
2847
+ handlePendingElicitation: async (params) => connection.sendRequest("session.ui.handlePendingElicitation", { ...params, sessionId }),
1967
2848
  /**
1968
2849
  * Resolves a pending `user_input.requested` event with the user's response.
1969
2850
  *
@@ -1971,7 +2852,7 @@ function createSessionRpc(connection, sessionId) {
1971
2852
  *
1972
2853
  * @returns Indicates whether the pending UI request was resolved by this call.
1973
2854
  */
1974
- handlePendingUserInput: async (params) => connection.sendRequest("session.ui.handlePendingUserInput", { sessionId, ...params }),
2855
+ handlePendingUserInput: async (params) => connection.sendRequest("session.ui.handlePendingUserInput", { ...params, sessionId }),
1975
2856
  /**
1976
2857
  * Resolves a pending `sampling.requested` event with a sampling result, or rejects it.
1977
2858
  *
@@ -1979,7 +2860,7 @@ function createSessionRpc(connection, sessionId) {
1979
2860
  *
1980
2861
  * @returns Indicates whether the pending UI request was resolved by this call.
1981
2862
  */
1982
- handlePendingSampling: async (params) => connection.sendRequest("session.ui.handlePendingSampling", { sessionId, ...params }),
2863
+ handlePendingSampling: async (params) => connection.sendRequest("session.ui.handlePendingSampling", { ...params, sessionId }),
1983
2864
  /**
1984
2865
  * Resolves a pending `auto_mode_switch.requested` event with the user's accept/decline decision.
1985
2866
  *
@@ -1987,7 +2868,7 @@ function createSessionRpc(connection, sessionId) {
1987
2868
  *
1988
2869
  * @returns Indicates whether the pending UI request was resolved by this call.
1989
2870
  */
1990
- handlePendingAutoModeSwitch: async (params) => connection.sendRequest("session.ui.handlePendingAutoModeSwitch", { sessionId, ...params }),
2871
+ handlePendingAutoModeSwitch: async (params) => connection.sendRequest("session.ui.handlePendingAutoModeSwitch", { ...params, sessionId }),
1991
2872
  /**
1992
2873
  * Resolves a pending `session_limits_exhausted.requested` event with the user's selected limit action.
1993
2874
  *
@@ -1995,7 +2876,7 @@ function createSessionRpc(connection, sessionId) {
1995
2876
  *
1996
2877
  * @returns Indicates whether the pending UI request was resolved by this call.
1997
2878
  */
1998
- handlePendingSessionLimitsExhausted: async (params) => connection.sendRequest("session.ui.handlePendingSessionLimitsExhausted", { sessionId, ...params }),
2879
+ handlePendingSessionLimitsExhausted: async (params) => connection.sendRequest("session.ui.handlePendingSessionLimitsExhausted", { ...params, sessionId }),
1999
2880
  /**
2000
2881
  * Resolves a pending `exit_plan_mode.requested` event with the user's response.
2001
2882
  *
@@ -2003,7 +2884,7 @@ function createSessionRpc(connection, sessionId) {
2003
2884
  *
2004
2885
  * @returns Indicates whether the pending UI request was resolved by this call.
2005
2886
  */
2006
- handlePendingExitPlanMode: async (params) => connection.sendRequest("session.ui.handlePendingExitPlanMode", { sessionId, ...params }),
2887
+ handlePendingExitPlanMode: async (params) => connection.sendRequest("session.ui.handlePendingExitPlanMode", { ...params, sessionId }),
2007
2888
  /**
2008
2889
  * Registers an in-process handler for auto-mode-switch requests so the server bridge skips dispatch.
2009
2890
  *
@@ -2017,7 +2898,7 @@ function createSessionRpc(connection, sessionId) {
2017
2898
  *
2018
2899
  * @returns Indicates whether the handle was active and the registration count was decremented.
2019
2900
  */
2020
- unregisterDirectAutoModeSwitchHandler: async (params) => connection.sendRequest("session.ui.unregisterDirectAutoModeSwitchHandler", { sessionId, ...params })
2901
+ unregisterDirectAutoModeSwitchHandler: async (params) => connection.sendRequest("session.ui.unregisterDirectAutoModeSwitchHandler", { ...params, sessionId })
2021
2902
  },
2022
2903
  /** @experimental */
2023
2904
  permissions: {
@@ -2028,7 +2909,7 @@ function createSessionRpc(connection, sessionId) {
2028
2909
  *
2029
2910
  * @returns Indicates whether the operation succeeded.
2030
2911
  */
2031
- configure: async (params) => connection.sendRequest("session.permissions.configure", { sessionId, ...params }),
2912
+ configure: async (params) => connection.sendRequest("session.permissions.configure", { ...params, sessionId }),
2032
2913
  /**
2033
2914
  * Provides a decision for a pending tool permission request.
2034
2915
  *
@@ -2036,7 +2917,7 @@ function createSessionRpc(connection, sessionId) {
2036
2917
  *
2037
2918
  * @returns Indicates whether the permission decision was applied; false when the request was already resolved.
2038
2919
  */
2039
- handlePendingPermissionRequest: async (params) => connection.sendRequest("session.permissions.handlePendingPermissionRequest", { sessionId, ...params }),
2920
+ handlePendingPermissionRequest: async (params) => connection.sendRequest("session.permissions.handlePendingPermissionRequest", { ...params, sessionId }),
2040
2921
  /**
2041
2922
  * Reconstructs the set of pending tool permission requests from the session's event history.
2042
2923
  *
@@ -2050,7 +2931,7 @@ function createSessionRpc(connection, sessionId) {
2050
2931
  *
2051
2932
  * @returns Indicates whether the operation succeeded.
2052
2933
  */
2053
- setApproveAll: async (params) => connection.sendRequest("session.permissions.setApproveAll", { sessionId, ...params }),
2934
+ setApproveAll: async (params) => connection.sendRequest("session.permissions.setApproveAll", { ...params, sessionId }),
2054
2935
  /**
2055
2936
  * Sets the permission mode for the session. `manual` follows the normal approval flow, `assisted` attaches LLM safety recommendations, and `allow-all` automatically approves permission requests. The result returns the authoritative post-mutation mode so callers can update local state without racing the `session.permissions_changed` notification.
2056
2937
  *
@@ -2058,7 +2939,7 @@ function createSessionRpc(connection, sessionId) {
2058
2939
  *
2059
2940
  * @returns Indicates whether the requested permission mode was applied and reports the authoritative post-mutation mode.
2060
2941
  */
2061
- setMode: async (params) => connection.sendRequest("session.permissions.setMode", { sessionId, ...params }),
2942
+ setMode: async (params) => connection.sendRequest("session.permissions.setMode", { ...params, sessionId }),
2062
2943
  /**
2063
2944
  * Returns the current permission mode for the session.
2064
2945
  *
@@ -2072,7 +2953,7 @@ function createSessionRpc(connection, sessionId) {
2072
2953
  *
2073
2954
  * @returns Indicates whether the operation succeeded.
2074
2955
  */
2075
- modifyRules: async (params) => connection.sendRequest("session.permissions.modifyRules", { sessionId, ...params }),
2956
+ modifyRules: async (params) => connection.sendRequest("session.permissions.modifyRules", { ...params, sessionId }),
2076
2957
  /**
2077
2958
  * Sets whether the client wants permission prompts bridged into session events.
2078
2959
  *
@@ -2080,15 +2961,15 @@ function createSessionRpc(connection, sessionId) {
2080
2961
  *
2081
2962
  * @returns Indicates whether the operation succeeded.
2082
2963
  */
2083
- setRequired: async (params) => connection.sendRequest("session.permissions.setRequired", { sessionId, ...params }),
2964
+ setRequired: async (params) => connection.sendRequest("session.permissions.setRequired", { ...params, sessionId }),
2084
2965
  /**
2085
- * Clears session-scoped tool permission approvals.
2966
+ * Clears session-scoped tool approvals and, for full resets, exact session-approved paths.
2086
2967
  *
2087
- * @param params Clears session-scoped tool permission approvals, and optionally the location-scoped ones.
2968
+ * @param params Clears session-scoped tool approvals and optionally clears location-scoped approvals and exact session-approved paths.
2088
2969
  *
2089
2970
  * @returns Indicates whether the operation succeeded.
2090
2971
  */
2091
- resetSessionApprovals: async (params) => connection.sendRequest("session.permissions.resetSessionApprovals", { sessionId, ...params }),
2972
+ resetSessionApprovals: async (params) => connection.sendRequest("session.permissions.resetSessionApprovals", { ...params, sessionId }),
2092
2973
  /**
2093
2974
  * Notifies the runtime that a permission prompt UI has been shown to the user.
2094
2975
  *
@@ -2096,13 +2977,13 @@ function createSessionRpc(connection, sessionId) {
2096
2977
  *
2097
2978
  * @returns Indicates whether the operation succeeded.
2098
2979
  */
2099
- notifyPromptShown: async (params) => connection.sendRequest("session.permissions.notifyPromptShown", { sessionId, ...params }),
2980
+ notifyPromptShown: async (params) => connection.sendRequest("session.permissions.notifyPromptShown", { ...params, sessionId }),
2100
2981
  /** @experimental */
2101
2982
  paths: {
2102
2983
  /**
2103
- * Returns the session's allowed directories and primary working directory.
2984
+ * Returns the session's recursive directory grants, exact session-approved paths, and primary working directory.
2104
2985
  *
2105
- * @returns Snapshot of the session's allow-listed directories and primary working directory.
2986
+ * @returns Snapshot of the session's recursive directory grants, exact session-approved paths, and primary working directory.
2106
2987
  */
2107
2988
  list: async () => connection.sendRequest("session.permissions.paths.list", { sessionId }),
2108
2989
  /**
@@ -2112,7 +2993,7 @@ function createSessionRpc(connection, sessionId) {
2112
2993
  *
2113
2994
  * @returns Indicates whether the operation succeeded.
2114
2995
  */
2115
- add: async (params) => connection.sendRequest("session.permissions.paths.add", { sessionId, ...params }),
2996
+ add: async (params) => connection.sendRequest("session.permissions.paths.add", { ...params, sessionId }),
2116
2997
  /**
2117
2998
  * Updates the session's primary working directory used by the permission policy.
2118
2999
  *
@@ -2120,7 +3001,7 @@ function createSessionRpc(connection, sessionId) {
2120
3001
  *
2121
3002
  * @returns Indicates whether the operation succeeded.
2122
3003
  */
2123
- updatePrimary: async (params) => connection.sendRequest("session.permissions.paths.updatePrimary", { sessionId, ...params }),
3004
+ updatePrimary: async (params) => connection.sendRequest("session.permissions.paths.updatePrimary", { ...params, sessionId }),
2124
3005
  /**
2125
3006
  * Reports whether a path falls within any of the session's allowed directories.
2126
3007
  *
@@ -2128,7 +3009,7 @@ function createSessionRpc(connection, sessionId) {
2128
3009
  *
2129
3010
  * @returns Indicates whether the supplied path is within the session's allowed directories.
2130
3011
  */
2131
- isPathWithinAllowedDirectories: async (params) => connection.sendRequest("session.permissions.paths.isPathWithinAllowedDirectories", { sessionId, ...params }),
3012
+ isPathWithinAllowedDirectories: async (params) => connection.sendRequest("session.permissions.paths.isPathWithinAllowedDirectories", { ...params, sessionId }),
2132
3013
  /**
2133
3014
  * Reports whether a path falls within the session's workspace (primary) directory.
2134
3015
  *
@@ -2136,7 +3017,7 @@ function createSessionRpc(connection, sessionId) {
2136
3017
  *
2137
3018
  * @returns Indicates whether the supplied path is within the session's workspace directory.
2138
3019
  */
2139
- isPathWithinWorkspace: async (params) => connection.sendRequest("session.permissions.paths.isPathWithinWorkspace", { sessionId, ...params })
3020
+ isPathWithinWorkspace: async (params) => connection.sendRequest("session.permissions.paths.isPathWithinWorkspace", { ...params, sessionId })
2140
3021
  },
2141
3022
  /** @experimental */
2142
3023
  locations: {
@@ -2147,7 +3028,7 @@ function createSessionRpc(connection, sessionId) {
2147
3028
  *
2148
3029
  * @returns Resolved location-permissions key and type.
2149
3030
  */
2150
- resolve: async (params) => connection.sendRequest("session.permissions.locations.resolve", { sessionId, ...params }),
3031
+ resolve: async (params) => connection.sendRequest("session.permissions.locations.resolve", { ...params, sessionId }),
2151
3032
  /**
2152
3033
  * Applies persisted location-scoped tool approvals and allowed directories for a working directory to this session's permission service.
2153
3034
  *
@@ -2155,7 +3036,7 @@ function createSessionRpc(connection, sessionId) {
2155
3036
  *
2156
3037
  * @returns Summary of persisted location permissions applied to the session.
2157
3038
  */
2158
- apply: async (params) => connection.sendRequest("session.permissions.locations.apply", { sessionId, ...params }),
3039
+ apply: async (params) => connection.sendRequest("session.permissions.locations.apply", { ...params, sessionId }),
2159
3040
  /**
2160
3041
  * Persists a tool approval for a permission location and applies its rules to this session's live permission service.
2161
3042
  *
@@ -2163,7 +3044,7 @@ function createSessionRpc(connection, sessionId) {
2163
3044
  *
2164
3045
  * @returns Indicates whether the operation succeeded.
2165
3046
  */
2166
- addToolApproval: async (params) => connection.sendRequest("session.permissions.locations.addToolApproval", { sessionId, ...params })
3047
+ addToolApproval: async (params) => connection.sendRequest("session.permissions.locations.addToolApproval", { ...params, sessionId })
2167
3048
  },
2168
3049
  /** @experimental */
2169
3050
  folderTrust: {
@@ -2174,7 +3055,7 @@ function createSessionRpc(connection, sessionId) {
2174
3055
  *
2175
3056
  * @returns Folder trust check result.
2176
3057
  */
2177
- isTrusted: async (params) => connection.sendRequest("session.permissions.folderTrust.isTrusted", { sessionId, ...params }),
3058
+ isTrusted: async (params) => connection.sendRequest("session.permissions.folderTrust.isTrusted", { ...params, sessionId }),
2178
3059
  /**
2179
3060
  * Adds a folder to the user's trusted folders list.
2180
3061
  *
@@ -2182,7 +3063,7 @@ function createSessionRpc(connection, sessionId) {
2182
3063
  *
2183
3064
  * @returns Indicates whether the operation succeeded.
2184
3065
  */
2185
- addTrusted: async (params) => connection.sendRequest("session.permissions.folderTrust.addTrusted", { sessionId, ...params })
3066
+ addTrusted: async (params) => connection.sendRequest("session.permissions.folderTrust.addTrusted", { ...params, sessionId })
2186
3067
  },
2187
3068
  /** @experimental */
2188
3069
  urls: {
@@ -2193,7 +3074,7 @@ function createSessionRpc(connection, sessionId) {
2193
3074
  *
2194
3075
  * @returns Indicates whether the operation succeeded.
2195
3076
  */
2196
- setUnrestrictedMode: async (params) => connection.sendRequest("session.permissions.urls.setUnrestrictedMode", { sessionId, ...params })
3077
+ setUnrestrictedMode: async (params) => connection.sendRequest("session.permissions.urls.setUnrestrictedMode", { ...params, sessionId })
2197
3078
  }
2198
3079
  },
2199
3080
  /**
@@ -2205,7 +3086,7 @@ function createSessionRpc(connection, sessionId) {
2205
3086
  *
2206
3087
  * @experimental
2207
3088
  */
2208
- log: async (params) => connection.sendRequest("session.log", { sessionId, ...params }),
3089
+ log: async (params) => connection.sendRequest("session.log", { ...params, sessionId }),
2209
3090
  /** @experimental */
2210
3091
  metadata: {
2211
3092
  /**
@@ -2227,7 +3108,7 @@ function createSessionRpc(connection, sessionId) {
2227
3108
  *
2228
3109
  * @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.
2229
3110
  */
2230
- updateClientMetadata: async (params) => connection.sendRequest("session.metadata.updateClientMetadata", { sessionId, ...params }),
3111
+ updateClientMetadata: async (params) => connection.sendRequest("session.metadata.updateClientMetadata", { ...params, sessionId }),
2231
3112
  /**
2232
3113
  * Reports whether the local session is currently processing user/agent messages.
2233
3114
  *
@@ -2247,7 +3128,7 @@ function createSessionRpc(connection, sessionId) {
2247
3128
  *
2248
3129
  * @returns Token breakdown for the session's current context window, or null if uninitialized.
2249
3130
  */
2250
- contextInfo: async (params) => connection.sendRequest("session.metadata.contextInfo", { sessionId, ...params }),
3131
+ contextInfo: async (params) => connection.sendRequest("session.metadata.contextInfo", { ...params, sessionId }),
2251
3132
  /**
2252
3133
  * Returns the experimental per-source attribution breakdown of the session's current context window as a flat list of entries (skills, subagents, MCP servers, built-in tools, plugin rollups, system/tool-definition costs, with nesting via parentId), plus the successful compaction count. The heaviest individual messages are available separately via `metadata.getContextHeaviestMessages`. Returns null until the session has initialized its system prompt and tool metadata.
2253
3134
  *
@@ -2261,7 +3142,7 @@ function createSessionRpc(connection, sessionId) {
2261
3142
  *
2262
3143
  * @returns The heaviest individual messages in the session's context window, most-expensive first.
2263
3144
  */
2264
- getContextHeaviestMessages: async (params) => connection.sendRequest("session.metadata.getContextHeaviestMessages", { sessionId, ...params }),
3145
+ getContextHeaviestMessages: async (params) => connection.sendRequest("session.metadata.getContextHeaviestMessages", { ...params, sessionId }),
2265
3146
  /**
2266
3147
  * Records a working-directory/git context change and emits a `session.context_changed` event. For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event): a local session's working directory is authoritative and is moved via `metadata.setWorkingDirectory` (or an SDK `session.resume` that supplies a `workingDirectory`), not by this method.
2267
3148
  *
@@ -2269,7 +3150,7 @@ function createSessionRpc(connection, sessionId) {
2269
3150
  *
2270
3151
  * @returns Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event); move a local session's working directory via `metadata.setWorkingDirectory` instead.
2271
3152
  */
2272
- recordContextChange: async (params) => connection.sendRequest("session.metadata.recordContextChange", { sessionId, ...params }),
3153
+ recordContextChange: async (params) => connection.sendRequest("session.metadata.recordContextChange", { ...params, sessionId }),
2273
3154
  /**
2274
3155
  * Updates the session's working directory. For local sessions the target is validated first (an absolute path that exists on disk) and the permission primary directory is re-based; a rejected validation fails the call before any session state changes.
2275
3156
  *
@@ -2277,7 +3158,7 @@ function createSessionRpc(connection, sessionId) {
2277
3158
  *
2278
3159
  * @returns Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for any related side-effects (file index, etc.); it does NOT change the process working directory (a session's cwd is per-session, not process-global). For local sessions the runtime validates the target first (an absolute path that exists on disk) and re-bases the permission primary directory; a rejected validation fails the call before anything is mutated, persisted, or emitted. Location-scoped permission rules are then re-keyed to the new directory (best-effort). Remote sessions only record the path.
2279
3160
  */
2280
- setWorkingDirectory: async (params) => connection.sendRequest("session.metadata.setWorkingDirectory", { sessionId, ...params }),
3161
+ setWorkingDirectory: async (params) => connection.sendRequest("session.metadata.setWorkingDirectory", { ...params, sessionId }),
2281
3162
  /**
2282
3163
  * Re-tokenizes the session's existing messages against a model and returns aggregate token totals.
2283
3164
  *
@@ -2285,7 +3166,7 @@ function createSessionRpc(connection, sessionId) {
2285
3166
  *
2286
3167
  * @returns Re-tokenize the session's existing messages against `modelId` and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session.
2287
3168
  */
2288
- recomputeContextTokens: async (params) => connection.sendRequest("session.metadata.recomputeContextTokens", { sessionId, ...params })
3169
+ recomputeContextTokens: async (params) => connection.sendRequest("session.metadata.recomputeContextTokens", { ...params, sessionId })
2289
3170
  },
2290
3171
  /** @experimental */
2291
3172
  contentExclusion: {
@@ -2296,18 +3177,18 @@ function createSessionRpc(connection, sessionId) {
2296
3177
  *
2297
3178
  * @returns Batch content-exclusion result. Callers must fail closed when policy evaluation is unavailable.
2298
3179
  */
2299
- checkPaths: async (params) => connection.sendRequest("session.contentExclusion.checkPaths", { sessionId, ...params })
3180
+ checkPaths: async (params) => connection.sendRequest("session.contentExclusion.checkPaths", { ...params, sessionId })
2300
3181
  },
2301
3182
  /** @experimental */
2302
3183
  shell: {
2303
3184
  /**
2304
- * Starts a shell command and streams output through session notifications. The command runs as the leader of its own process group (POSIX) or in a dedicated job object (Windows), so a forced termination — via "shell.kill", the request timeout, or session disposal — signals that whole group/job rather than only the direct child. Two gaps are worth planning for: a command that exits on its own does not trigger that teardown, and on POSIX a descendant that moves itself into a new session or process group (for example via "setsid") leaves the signalled group, so either can leave a background process running.
3185
+ * Starts a shell command, returning an RPC error if it cannot be spawned. The command runs as the leader of its own process group (POSIX) or in a dedicated job object (Windows), so a forced termination — via "shell.kill", the request timeout, or session disposal — signals that whole group/job rather than only the direct child. Two gaps are worth planning for: a command that exits on its own does not trigger that teardown, and on POSIX a descendant that moves itself into a new session or process group (for example via "setsid") leaves the signalled group, so either can leave a background process running.
2305
3186
  *
2306
- * @param params Shell command to run, with optional working directory and timeout in milliseconds.
3187
+ * @param params Shell command to run, with optional working directory and timeout in milliseconds. Spawn failures return an RPC error.
2307
3188
  *
2308
- * @returns Identifier of the spawned process, used to correlate streamed output and exit notifications.
3189
+ * @returns Identifier of the spawned shell process, usable with shell.kill while the process is running.
2309
3190
  */
2310
- exec: async (params) => connection.sendRequest("session.shell.exec", { sessionId, ...params }),
3191
+ exec: async (params) => connection.sendRequest("session.shell.exec", { ...params, sessionId }),
2311
3192
  /**
2312
3193
  * Sends a signal to a shell process previously started via "shell.exec". The signal targets the command's whole process group (POSIX) or job object (Windows), so descendants still in that group are signalled too, not just the direct child. On POSIX a descendant that moved itself into a new session or process group (for example via "setsid") is no longer in the signalled group and survives.
2313
3194
  *
@@ -2315,7 +3196,7 @@ function createSessionRpc(connection, sessionId) {
2315
3196
  *
2316
3197
  * @returns Indicates whether the signal was delivered; false if the process was unknown or already exited.
2317
3198
  */
2318
- kill: async (params) => connection.sendRequest("session.shell.kill", { sessionId, ...params }),
3199
+ kill: async (params) => connection.sendRequest("session.shell.kill", { ...params, sessionId }),
2319
3200
  /**
2320
3201
  * Executes a user-requested shell command through the session runtime.
2321
3202
  *
@@ -2323,7 +3204,7 @@ function createSessionRpc(connection, sessionId) {
2323
3204
  *
2324
3205
  * @returns Result of a user-requested shell command.
2325
3206
  */
2326
- executeUserRequested: async (params) => connection.sendRequest("session.shell.executeUserRequested", { sessionId, ...params }),
3207
+ executeUserRequested: async (params) => connection.sendRequest("session.shell.executeUserRequested", { ...params, sessionId }),
2327
3208
  /**
2328
3209
  * Cancels a user-requested shell command by request ID.
2329
3210
  *
@@ -2331,7 +3212,7 @@ function createSessionRpc(connection, sessionId) {
2331
3212
  *
2332
3213
  * @returns Cancellation result for a user-requested shell command.
2333
3214
  */
2334
- cancelUserRequested: async (params) => connection.sendRequest("session.shell.cancelUserRequested", { sessionId, ...params })
3215
+ cancelUserRequested: async (params) => connection.sendRequest("session.shell.cancelUserRequested", { ...params, sessionId })
2335
3216
  },
2336
3217
  /** @experimental */
2337
3218
  history: {
@@ -2342,7 +3223,7 @@ function createSessionRpc(connection, sessionId) {
2342
3223
  *
2343
3224
  * @returns Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown.
2344
3225
  */
2345
- compact: async (params) => connection.sendRequest("session.history.compact", { sessionId, ...params }),
3226
+ compact: async (params) => connection.sendRequest("session.history.compact", { ...params, sessionId }),
2346
3227
  /**
2347
3228
  * Truncates persisted session history to a specific event.
2348
3229
  *
@@ -2350,7 +3231,7 @@ function createSessionRpc(connection, sessionId) {
2350
3231
  *
2351
3232
  * @returns Number of events that were removed by the truncation.
2352
3233
  */
2353
- truncate: async (params) => connection.sendRequest("session.history.truncate", { sessionId, ...params }),
3234
+ truncate: async (params) => connection.sendRequest("session.history.truncate", { ...params, sessionId }),
2354
3235
  /**
2355
3236
  * Lists the user turns that the session can rewind to. Never rejects for a busy session: rewind reads need the session's file-change captures to be settled, so a session that still holds active work answers with `unavailableReason: "session-busy"` and no points, which the caller can retry.
2356
3237
  *
@@ -2364,7 +3245,7 @@ function createSessionRpc(connection, sessionId) {
2364
3245
  *
2365
3246
  * @returns Files and aggregate changes for a prospective rewind.
2366
3247
  */
2367
- previewRewind: async (params) => connection.sendRequest("session.history.previewRewind", { sessionId, ...params }),
3248
+ previewRewind: async (params) => connection.sendRequest("session.history.previewRewind", { ...params, sessionId }),
2368
3249
  /**
2369
3250
  * Rewinds the session conversation, optionally restoring files changed by the discarded turns. Not crash-atomic: file restore and conversation truncation are separate stores, applied in that order, so a process crash between them can leave the workspace rewound while the conversation still contains the discarded turns. There is no recovery journal; re-running the same rewind is the recovery path for a crash before truncation lands, since file restore is idempotent (already-restored files are reported as skipped) and truncation is re-derived from the still-retained boundary event. After truncation lands that boundary no longer exists, so the same request is rejected; the only stage that can still be outstanding is snapshot pruning, whose failure leaves orphan snapshots the capture store tolerates. The reverse inconsistency cannot occur, because truncation is never applied before file restore succeeds.
2370
3251
  *
@@ -2372,7 +3253,7 @@ function createSessionRpc(connection, sessionId) {
2372
3253
  *
2373
3254
  * @returns Structured outcome of a rewind request.
2374
3255
  */
2375
- rewind: async (params) => connection.sendRequest("session.history.rewind", { sessionId, ...params }),
3256
+ rewind: async (params) => connection.sendRequest("session.history.rewind", { ...params, sessionId }),
2376
3257
  /**
2377
3258
  * Cancels any in-progress background compaction on a local session.
2378
3259
  *
@@ -2398,7 +3279,7 @@ function createSessionRpc(connection, sessionId) {
2398
3279
  *
2399
3280
  * @returns What a successful clear removed. A clear that could not be applied rejects instead of reporting a count.
2400
3281
  */
2401
- clearContext: async (params) => connection.sendRequest("session.history.clearContext", { sessionId, ...params })
3282
+ clearContext: async (params) => connection.sendRequest("session.history.clearContext", { ...params, sessionId })
2402
3283
  },
2403
3284
  /** @experimental */
2404
3285
  queue: {
@@ -2415,7 +3296,7 @@ function createSessionRpc(connection, sessionId) {
2415
3296
  *
2416
3297
  * @returns Result of moving a queued item.
2417
3298
  */
2418
- moveItem: async (params) => connection.sendRequest("session.queue.moveItem", { sessionId, ...params }),
3299
+ moveItem: async (params) => connection.sendRequest("session.queue.moveItem", { ...params, sessionId }),
2419
3300
  /**
2420
3301
  * Inserts a new queued message at a public visible position.
2421
3302
  *
@@ -2423,7 +3304,7 @@ function createSessionRpc(connection, sessionId) {
2423
3304
  *
2424
3305
  * @returns Result of inserting a queued message.
2425
3306
  */
2426
- insertAt: async (params) => connection.sendRequest("session.queue.insertAt", { sessionId, ...params }),
3307
+ insertAt: async (params) => connection.sendRequest("session.queue.insertAt", { ...params, sessionId }),
2427
3308
  /**
2428
3309
  * Removes an addressable queued item by its stable id.
2429
3310
  *
@@ -2431,7 +3312,7 @@ function createSessionRpc(connection, sessionId) {
2431
3312
  *
2432
3313
  * @returns Result of removing a queued item.
2433
3314
  */
2434
- removeAt: async (params) => connection.sendRequest("session.queue.removeAt", { sessionId, ...params }),
3315
+ removeAt: async (params) => connection.sendRequest("session.queue.removeAt", { ...params, sessionId }),
2435
3316
  /**
2436
3317
  * Updates the text of an addressable single-message queue item.
2437
3318
  *
@@ -2439,7 +3320,23 @@ function createSessionRpc(connection, sessionId) {
2439
3320
  *
2440
3321
  * @returns Result of editing a queued message.
2441
3322
  */
2442
- updateText: async (params) => connection.sendRequest("session.queue.updateText", { sessionId, ...params }),
3323
+ updateText: async (params) => connection.sendRequest("session.queue.updateText", { ...params, sessionId }),
3324
+ /**
3325
+ * Atomically withdraws an unchanged user message of a local session: from the queued or steering lane while unconsumed, or from the running turn it started while the model has not answered it and nothing the user sent after it is pending. Withdrawing from the running turn interrupts that turn and removes its events from history. A client retaining the original draft may restore it only when removed is true.
3326
+ *
3327
+ * @param params Conditional withdrawal of a single user message, from its queue or from the running turn it started.
3328
+ *
3329
+ * @returns Result of withdrawing a user message.
3330
+ */
3331
+ withdrawMessage: async (params) => connection.sendRequest("session.queue.withdrawMessage", { ...params, sessionId }),
3332
+ /**
3333
+ * Atomically appends text and attachments to an unchanged, unconsumed local steering message. Returns updated=false if delivery or withdrawal already claimed the message.
3334
+ *
3335
+ * @param params Append to one pending steering message without changing its identity or delivery position.
3336
+ *
3337
+ * @returns Result of editing a queued message.
3338
+ */
3339
+ appendSteering: async (params) => connection.sendRequest("session.queue.appendSteering", { ...params, sessionId }),
2443
3340
  /**
2444
3341
  * Duplicates an addressable queued item immediately after its source.
2445
3342
  *
@@ -2447,13 +3344,13 @@ function createSessionRpc(connection, sessionId) {
2447
3344
  *
2448
3345
  * @returns Result of duplicating a queued item.
2449
3346
  */
2450
- duplicateAt: async (params) => connection.sendRequest("session.queue.duplicateAt", { sessionId, ...params }),
3347
+ duplicateAt: async (params) => connection.sendRequest("session.queue.duplicateAt", { ...params, sessionId }),
2451
3348
  /**
2452
3349
  * Acquires or releases the queued-lane drain pause.
2453
3350
  *
2454
3351
  * @param params Parameters for acquiring or releasing the queued-lane drain pause. Acquisition is exclusive and non-idempotent: `paused: true` against an already-paused session fails with `queue_already_paused`. The pause is never released automatically — it is not tied to the caller's lifetime, so a client that exits without sending `paused: false` leaves the lane frozen. Release is unowned: `paused: false` clears the pause for any caller, including one that never acquired it.
2455
3352
  */
2456
- setDrainPaused: async (params) => connection.sendRequest("session.queue.setDrainPaused", { sessionId, ...params }),
3353
+ setDrainPaused: async (params) => connection.sendRequest("session.queue.setDrainPaused", { ...params, sessionId }),
2457
3354
  /**
2458
3355
  * Moves an addressable queued message into the live turn's steering lane.
2459
3356
  *
@@ -2461,7 +3358,7 @@ function createSessionRpc(connection, sessionId) {
2461
3358
  *
2462
3359
  * @returns Result of trying to steer a queued message into a live turn.
2463
3360
  */
2464
- sendNow: async (params) => connection.sendRequest("session.queue.sendNow", { sessionId, ...params }),
3361
+ sendNow: async (params) => connection.sendRequest("session.queue.sendNow", { ...params, sessionId }),
2465
3362
  /**
2466
3363
  * Removes the most recently queued user-facing item (LIFO).
2467
3364
  *
@@ -2482,7 +3379,7 @@ function createSessionRpc(connection, sessionId) {
2482
3379
  *
2483
3380
  * @returns Batch of session events returned by a read, with cursor and continuation metadata.
2484
3381
  */
2485
- read: async (params) => connection.sendRequest("session.eventLog.read", { sessionId, ...params }),
3382
+ read: async (params) => connection.sendRequest("session.eventLog.read", { ...params, sessionId }),
2486
3383
  /**
2487
3384
  * Returns a snapshot of the current tail cursor without consuming events.
2488
3385
  *
@@ -2496,7 +3393,7 @@ function createSessionRpc(connection, sessionId) {
2496
3393
  *
2497
3394
  * @returns Opaque handle representing an event-type interest registration.
2498
3395
  */
2499
- registerInterest: async (params) => connection.sendRequest("session.eventLog.registerInterest", { sessionId, ...params }),
3396
+ registerInterest: async (params) => connection.sendRequest("session.eventLog.registerInterest", { ...params, sessionId }),
2500
3397
  /**
2501
3398
  * Releases a consumer's previously-registered interest in an event type.
2502
3399
  *
@@ -2504,7 +3401,7 @@ function createSessionRpc(connection, sessionId) {
2504
3401
  *
2505
3402
  * @returns Indicates whether the operation succeeded.
2506
3403
  */
2507
- releaseInterest: async (params) => connection.sendRequest("session.eventLog.releaseInterest", { sessionId, ...params })
3404
+ releaseInterest: async (params) => connection.sendRequest("session.eventLog.releaseInterest", { ...params, sessionId })
2508
3405
  },
2509
3406
  /** @experimental */
2510
3407
  usage: {
@@ -2516,6 +3413,27 @@ function createSessionRpc(connection, sessionId) {
2516
3413
  getMetrics: async () => connection.sendRequest("session.usage.getMetrics", { sessionId })
2517
3414
  },
2518
3415
  /** @experimental */
3416
+ quota: {
3417
+ /**
3418
+ * Gets the session's current quota and account projection without making a network request.
3419
+ *
3420
+ * @returns The incumbent session-owned quota and account projection.
3421
+ */
3422
+ get: async () => connection.sendRequest("session.quota.get", { sessionId }),
3423
+ /**
3424
+ * Refreshes the session's provider model catalog bypassing its cache, folds quota snapshots into session state, and returns the updated projection. Failures leave the last known quota intact.
3425
+ *
3426
+ * @returns The incumbent session-owned quota and account projection.
3427
+ */
3428
+ refresh: async () => connection.sendRequest("session.quota.refresh", { sessionId }),
3429
+ /**
3430
+ * Returns and clears the session's pending quota warnings. Reading or refreshing quota does not drain warnings.
3431
+ *
3432
+ * @returns Pending warnings returned and cleared by session.quota.takeWarnings.
3433
+ */
3434
+ takeWarnings: async () => connection.sendRequest("session.quota.takeWarnings", { sessionId })
3435
+ },
3436
+ /** @experimental */
2519
3437
  limitPrediction: {
2520
3438
  /**
2521
3439
  * Predicts an AI-credit session limit for the session's resolved model. Returns an unavailable result instead of falling back when the current model is unresolved auto.
@@ -2524,7 +3442,7 @@ function createSessionRpc(connection, sessionId) {
2524
3442
  *
2525
3443
  * @returns Prediction result. Available results include prediction details; unavailable results include an explicit reason.
2526
3444
  */
2527
- predict: async (params) => connection.sendRequest("session.limitPrediction.predict", { sessionId, ...params })
3445
+ predict: async (params) => connection.sendRequest("session.limitPrediction.predict", { ...params, sessionId })
2528
3446
  },
2529
3447
  /** @experimental */
2530
3448
  remote: {
@@ -2535,7 +3453,7 @@ function createSessionRpc(connection, sessionId) {
2535
3453
  *
2536
3454
  * @returns GitHub URL for the session and a flag indicating whether remote steering is enabled.
2537
3455
  */
2538
- enable: async (params) => connection.sendRequest("session.remote.enable", { sessionId, ...params }),
3456
+ enable: async (params) => connection.sendRequest("session.remote.enable", { ...params, sessionId }),
2539
3457
  /**
2540
3458
  * Disables remote session export and steering.
2541
3459
  */
@@ -2547,7 +3465,7 @@ function createSessionRpc(connection, sessionId) {
2547
3465
  *
2548
3466
  * @returns Persist a steerability change as a `session.remote_steerable_changed` event. Used by the host (CLI / SDK consumer) when it has just finished enabling or disabling steering on a remote exporter that the runtime does not directly own.
2549
3467
  */
2550
- notifySteerableChanged: async (params) => connection.sendRequest("session.remote.notifySteerableChanged", { sessionId, ...params })
3468
+ notifySteerableChanged: async (params) => connection.sendRequest("session.remote.notifySteerableChanged", { ...params, sessionId })
2551
3469
  },
2552
3470
  /** @experimental */
2553
3471
  visibility: {
@@ -2564,7 +3482,7 @@ function createSessionRpc(connection, sessionId) {
2564
3482
  *
2565
3483
  * @returns Effective sharing status and shareable GitHub URL after updating session visibility.
2566
3484
  */
2567
- set: async (params) => connection.sendRequest("session.visibility.set", { sessionId, ...params })
3485
+ set: async (params) => connection.sendRequest("session.visibility.set", { ...params, sessionId })
2568
3486
  },
2569
3487
  /** @experimental */
2570
3488
  schedule: {
@@ -2581,7 +3499,7 @@ function createSessionRpc(connection, sessionId) {
2581
3499
  *
2582
3500
  * @returns Remove a scheduled prompt by id. The result entry is omitted if the id was unknown.
2583
3501
  */
2584
- stop: async (params) => connection.sendRequest("session.schedule.stop", { sessionId, ...params })
3502
+ stop: async (params) => connection.sendRequest("session.schedule.stop", { ...params, sessionId })
2585
3503
  }
2586
3504
  };
2587
3505
  }
@@ -2594,7 +3512,7 @@ function createInternalSessionRpc(connection, sessionId) {
2594
3512
  *
2595
3513
  * @experimental
2596
3514
  */
2597
- sendSystemNotification: async (params) => connection.sendRequest("session.sendSystemNotification", { sessionId, ...params }),
3515
+ sendSystemNotification: async (params) => connection.sendRequest("session.sendSystemNotification", { ...params, sessionId }),
2598
3516
  /** @experimental */
2599
3517
  gitHubAuth: {
2600
3518
  /**
@@ -2622,13 +3540,13 @@ function createInternalSessionRpc(connection, sessionId) {
2622
3540
  *
2623
3541
  * @returns Authentication credentials accepted only at native protocol ingress. Runtime outputs use credential-free `AuthIdentity` metadata.
2624
3542
  */
2625
- login: async (params) => connection.sendRequest("session.gitHubAuth.login", { sessionId, ...params }),
3543
+ login: async (params) => connection.sendRequest("session.gitHubAuth.login", { ...params, sessionId }),
2626
3544
  /**
2627
3545
  * Switches the session to another available authentication.
2628
3546
  *
2629
3547
  * @param params Parameters for switching the session's active authentication.
2630
3548
  */
2631
- switchToAuth: async (params) => connection.sendRequest("session.gitHubAuth.switchToAuth", { sessionId, ...params }),
3549
+ switchToAuth: async (params) => connection.sendRequest("session.gitHubAuth.switchToAuth", { ...params, sessionId }),
2632
3550
  /**
2633
3551
  * Logs out the session's current GitHub authentication.
2634
3552
  *
@@ -2642,7 +3560,7 @@ function createInternalSessionRpc(connection, sessionId) {
2642
3560
  *
2643
3561
  * @returns Whether the requested authentication was logged out.
2644
3562
  */
2645
- logoutUser: async (params) => connection.sendRequest("session.gitHubAuth.logoutUser", { sessionId, ...params }),
3563
+ logoutUser: async (params) => connection.sendRequest("session.gitHubAuth.logoutUser", { ...params, sessionId }),
2646
3564
  /**
2647
3565
  * Gets validation errors from the most recent authentication attempt.
2648
3566
  *
@@ -2659,39 +3577,39 @@ function createInternalSessionRpc(connection, sessionId) {
2659
3577
  *
2660
3578
  * @param params Internal canvas provider registration parameters.
2661
3579
  */
2662
- register: async (params) => connection.sendRequest("session.canvas.provider.register", { sessionId, ...params }),
3580
+ register: async (params) => connection.sendRequest("session.canvas.provider.register", { ...params, sessionId }),
2663
3581
  /**
2664
3582
  * Unregisters an internal canvas provider connection.
2665
3583
  *
2666
3584
  * @param params Internal canvas provider unregistration parameters.
2667
3585
  */
2668
- unregister: async (params) => connection.sendRequest("session.canvas.provider.unregister", { sessionId, ...params })
3586
+ unregister: async (params) => connection.sendRequest("session.canvas.provider.unregister", { ...params, sessionId })
2669
3587
  }
2670
3588
  },
2671
3589
  /** @experimental */
2672
- factory: {
3590
+ workflow: {
2673
3591
  /**
2674
- * Internal tool-originated factory invocation.
3592
+ * Internal tool-originated dynamic workflow invocation.
2675
3593
  *
2676
- * @param params Internal parameters for invoking a registered factory from a tool.
3594
+ * @param params Internal parameters for invoking a registered workflow from a tool.
2677
3595
  *
2678
- * @returns Complete current or terminal factory run envelope.
3596
+ * @returns Complete current or terminal workflow run envelope.
2679
3597
  */
2680
- runFromTool: async (params) => connection.sendRequest("session.factory.runFromTool", { sessionId, ...params }),
3598
+ runFromTool: async (params) => connection.sendRequest("session.workflow.runFromTool", { ...params, sessionId }),
2681
3599
  /**
2682
- * Internal tool-originated factory resume.
3600
+ * Internal tool-originated dynamic workflow resume.
2683
3601
  *
2684
- * @param params Internal parameters for resuming a factory run from a tool.
3602
+ * @param params Internal parameters for resuming a workflow run from a tool.
2685
3603
  *
2686
- * @returns Resolved persisted factory identity and resumed run envelope.
3604
+ * @returns Resolved persisted workflow identity and resumed run envelope.
2687
3605
  */
2688
- resumeFromTool: async (params) => connection.sendRequest("session.factory.resumeFromTool", { sessionId, ...params }),
3606
+ resumeFromTool: async (params) => connection.sendRequest("session.workflow.resumeFromTool", { ...params, sessionId }),
2689
3607
  /**
2690
- * Atomically pauses an owned factory attempt at a durable checkpoint.
3608
+ * Atomically pauses an owned dynamic workflow attempt at a durable checkpoint.
2691
3609
  *
2692
3610
  * @param params Parameters for an owned durable pause checkpoint.
2693
3611
  */
2694
- pauseAtCheckpoint: async (params) => connection.sendRequest("session.factory.pauseAtCheckpoint", { sessionId, ...params })
3612
+ pauseAtCheckpoint: async (params) => connection.sendRequest("session.workflow.pauseAtCheckpoint", { ...params, sessionId })
2695
3613
  },
2696
3614
  /** @experimental */
2697
3615
  model: {
@@ -2702,10 +3620,20 @@ function createInternalSessionRpc(connection, sessionId) {
2702
3620
  *
2703
3621
  * @returns The model identifier active on the session after the switch.
2704
3622
  */
2705
- applyStartupOverlay: async (params) => connection.sendRequest("session.model.applyStartupOverlay", { sessionId, ...params })
3623
+ applyStartupOverlay: async (params) => connection.sendRequest("session.model.applyStartupOverlay", { ...params, sessionId }),
3624
+ /**
3625
+ * Clears an unchanged startup model/provider seed before default-model resolution. Never clears a resumed or user-selected model.
3626
+ */
3627
+ clearStartupSeed: async (params) => connection.sendRequest("session.model.clearStartupSeed", { ...params, sessionId })
2706
3628
  },
2707
3629
  /** @experimental */
2708
3630
  mcp: {
3631
+ /**
3632
+ * Records the IDE the host is connected to, so the agent's system prompt can name it and its workspace folder. Null or an omitted `ide` clears the recorded value, which is how a host reports that it is disconnected; there is no separate clear method. Both `ideName` and `workspaceFolder` are required together, because half a state cannot be attributed to a project.
3633
+ *
3634
+ * @param params Records which IDE the host is connected to, or clears it.
3635
+ */
3636
+ setConnectedIdeInfo: async (params) => connection.sendRequest("session.mcp.setConnectedIdeInfo", { ...params, sessionId }),
2709
3637
  /**
2710
3638
  * Reloads MCP server connections for the session with an explicit host-provided configuration.
2711
3639
  *
@@ -2713,7 +3641,7 @@ function createInternalSessionRpc(connection, sessionId) {
2713
3641
  *
2714
3642
  * @returns MCP server startup filtering result.
2715
3643
  */
2716
- reloadWithConfig: async (params) => connection.sendRequest("session.mcp.reloadWithConfig", { sessionId, ...params }),
3644
+ reloadWithConfig: async (params) => connection.sendRequest("session.mcp.reloadWithConfig", { ...params, sessionId }),
2717
3645
  /**
2718
3646
  * Configures the built-in GitHub MCP server for the session's current auth context.
2719
3647
  *
@@ -2721,19 +3649,36 @@ function createInternalSessionRpc(connection, sessionId) {
2721
3649
  *
2722
3650
  * @returns Result of configuring GitHub MCP.
2723
3651
  */
2724
- configureGitHub: async (params) => connection.sendRequest("session.mcp.configureGitHub", { sessionId, ...params }),
3652
+ configureGitHub: async (params) => connection.sendRequest("session.mcp.configureGitHub", { ...params, sessionId }),
2725
3653
  /**
2726
3654
  * Registers a pre-connected external MCP client (e.g. IDE) on the session's host. The caller retains lifecycle ownership of the client and transport. Marked internal because the `client` and `transport` arguments are in-process MCP SDK instances that cannot be serialized across the JSON-RPC boundary; once the CLI moves on top of the SDK, external clients will be expressed as transport configs the runtime can construct itself.
2727
3655
  *
2728
3656
  * @param params Registration parameters for an external MCP client.
2729
3657
  */
2730
- registerExternalClient: async (params) => connection.sendRequest("session.mcp.registerExternalClient", { sessionId, ...params }),
3658
+ registerExternalClient: async (params) => connection.sendRequest("session.mcp.registerExternalClient", { ...params, sessionId }),
2731
3659
  /**
2732
3660
  * Unregisters a previously registered external MCP client by server name. Marked internal as the paired companion of `registerExternalClient`: only in-process callers that registered a client this way can meaningfully unregister it. Disappears alongside `registerExternalClient`: once external clients are described to the runtime as config rather than handed in as instances, lifecycle (including deregistration) is owned entirely by the runtime.
2733
3661
  *
2734
3662
  * @param params Server name identifying the external client to remove.
2735
3663
  */
2736
- unregisterExternalClient: async (params) => connection.sendRequest("session.mcp.unregisterExternalClient", { sessionId, ...params })
3664
+ unregisterExternalClient: async (params) => connection.sendRequest("session.mcp.unregisterExternalClient", { ...params, sessionId })
3665
+ },
3666
+ /** @experimental */
3667
+ connectors: {
3668
+ /**
3669
+ * Reconciles the authoritative Connector catalog into the session MCP projection during startup with a bounded deadline and fail-closed cleanup.
3670
+ *
3671
+ * @param params Pins a Connector operation to one host-owned GitHub account through its opaque selection ID. Provider tokens are never accepted.
3672
+ *
3673
+ * @returns Authoritative session connector state. Account IDs are opaque routing identifiers and credentials are never included.
3674
+ */
3675
+ reconcileForStartup: async (params) => connection.sendRequest("session.connectors.reconcileForStartup", { ...params, sessionId }),
3676
+ /**
3677
+ * Removes the runtime-owned Connector MCP projection without changing service-side connections.
3678
+ *
3679
+ * @returns Authoritative session connector state. Account IDs are opaque routing identifiers and credentials are never included.
3680
+ */
3681
+ withdrawProjection: async () => connection.sendRequest("session.connectors.withdrawProjection", { sessionId })
2737
3682
  },
2738
3683
  /** @experimental */
2739
3684
  commands: {
@@ -2744,7 +3689,34 @@ function createInternalSessionRpc(connection, sessionId) {
2744
3689
  *
2745
3690
  * @returns Whether finalizing the invocation effect succeeded, and the failure reason when it did not.
2746
3691
  */
2747
- finalizeInvocationEffect: async (params) => connection.sendRequest("session.commands.finalizeInvocationEffect", { sessionId, ...params })
3692
+ finalizeInvocationEffect: async (params) => connection.sendRequest("session.commands.finalizeInvocationEffect", { ...params, sessionId })
3693
+ },
3694
+ /** @experimental */
3695
+ ui: {
3696
+ /**
3697
+ * Resolves a pending elicitation request after direct interaction in the trusted in-process client. Only an accepted response to the built-in ask_user tool can become trusted human evidence.
3698
+ *
3699
+ * @param params Pending elicitation request ID and the user's response (accept/decline/cancel + form values).
3700
+ *
3701
+ * @returns Indicates whether the elicitation response was accepted; false if it was already resolved by another client.
3702
+ */
3703
+ handleHumanAskUser: async (params) => connection.sendRequest("session.ui.handleHumanAskUser", { ...params, sessionId }),
3704
+ /**
3705
+ * Resolves a pending `user_input.requested` event after direct interaction in the trusted in-process client.
3706
+ *
3707
+ * @param params Request ID of a pending `user_input.requested` event and the user's response.
3708
+ *
3709
+ * @returns Indicates whether the pending UI request was resolved by this call.
3710
+ */
3711
+ handleHumanUserInput: async (params) => connection.sendRequest("session.ui.handleHumanUserInput", { ...params, sessionId }),
3712
+ /**
3713
+ * Resolves a pending `exit_plan_mode.requested` event after direct interaction in the trusted in-process client.
3714
+ *
3715
+ * @param params Request ID of a pending `exit_plan_mode.requested` event and the user's response.
3716
+ *
3717
+ * @returns Indicates whether the pending UI request was resolved by this call.
3718
+ */
3719
+ handleHumanExitPlanMode: async (params) => connection.sendRequest("session.ui.handleHumanExitPlanMode", { ...params, sessionId })
2748
3720
  },
2749
3721
  /** @experimental */
2750
3722
  settings: {
@@ -2761,7 +3733,7 @@ function createInternalSessionRpc(connection, sessionId) {
2761
3733
  *
2762
3734
  * @returns Result of evaluating a Rust-owned settings predicate.
2763
3735
  */
2764
- evaluatePredicate: async (params) => connection.sendRequest("session.settings.evaluatePredicate", { sessionId, ...params })
3736
+ evaluatePredicate: async (params) => connection.sendRequest("session.settings.evaluatePredicate", { ...params, sessionId })
2765
3737
  },
2766
3738
  /** @experimental */
2767
3739
  queue: {
@@ -2784,7 +3756,7 @@ function createInternalSessionRpc(connection, sessionId) {
2784
3756
  *
2785
3757
  * @returns Whether a deferred-idle drain should run.
2786
3758
  */
2787
- beginDeferredIdleDrain: async (params) => connection.sendRequest("session.queue.beginDeferredIdleDrain", { sessionId, ...params }),
3759
+ beginDeferredIdleDrain: async (params) => connection.sendRequest("session.queue.beginDeferredIdleDrain", { ...params, sessionId }),
2788
3760
  /**
2789
3761
  * Finishes a native deferred-idle drain and reports whether to drain queue work or emit idle.
2790
3762
  *
@@ -2792,13 +3764,13 @@ function createInternalSessionRpc(connection, sessionId) {
2792
3764
  *
2793
3765
  * @returns Action selected by the native deferred-idle drain.
2794
3766
  */
2795
- finishDeferredIdleDrain: async (params) => connection.sendRequest("session.queue.finishDeferredIdleDrain", { sessionId, ...params }),
3767
+ finishDeferredIdleDrain: async (params) => connection.sendRequest("session.queue.finishDeferredIdleDrain", { ...params, sessionId }),
2796
3768
  /**
2797
3769
  * Marks session.idle as deferred by native background work state.
2798
3770
  *
2799
3771
  * @param params Inputs for marking session.idle deferred in native state.
2800
3772
  */
2801
- deferSessionIdle: async (params) => connection.sendRequest("session.queue.deferSessionIdle", { sessionId, ...params }),
3773
+ deferSessionIdle: async (params) => connection.sendRequest("session.queue.deferSessionIdle", { ...params, sessionId }),
2802
3774
  /**
2803
3775
  * Consumes queued native system notifications matching an internal filter.
2804
3776
  *
@@ -2806,7 +3778,7 @@ function createInternalSessionRpc(connection, sessionId) {
2806
3778
  *
2807
3779
  * @returns Indicates whether a user-facing pending item was removed.
2808
3780
  */
2809
- consumeSystemNotifications: async (params) => connection.sendRequest("session.queue.consumeSystemNotifications", { sessionId, ...params }),
3781
+ consumeSystemNotifications: async (params) => connection.sendRequest("session.queue.consumeSystemNotifications", { ...params, sessionId }),
2810
3782
  /**
2811
3783
  * Enqueues the internal resume-pending wake item when orphan handling needs a follow-up turn.
2812
3784
  *
@@ -2819,6 +3791,15 @@ function createInternalSessionRpc(connection, sessionId) {
2819
3791
  process: async () => connection.sendRequest("session.queue.process", { sessionId })
2820
3792
  },
2821
3793
  /** @experimental */
3794
+ usage: {
3795
+ /**
3796
+ * Internal host-only replacement of absolute code-change totals reported by a relay host.
3797
+ *
3798
+ * @param params Internal absolute code-change totals reported by the owning host.
3799
+ */
3800
+ setCodeChanges: async (params) => connection.sendRequest("session.usage.setCodeChanges", { ...params, sessionId })
3801
+ },
3802
+ /** @experimental */
2822
3803
  schedule: {
2823
3804
  /**
2824
3805
  * Hydrates the native schedule registry from persisted session events.
@@ -2837,7 +3818,7 @@ function createInternalSessionRpc(connection, sessionId) {
2837
3818
  *
2838
3819
  * @returns Result of registering or re-arming a scheduled prompt.
2839
3820
  */
2840
- add: async (params) => connection.sendRequest("session.schedule.add", { sessionId, ...params }),
3821
+ add: async (params) => connection.sendRequest("session.schedule.add", { ...params, sessionId }),
2841
3822
  /**
2842
3823
  * Registers a recurring cron scheduled prompt.
2843
3824
  *
@@ -2845,7 +3826,7 @@ function createInternalSessionRpc(connection, sessionId) {
2845
3826
  *
2846
3827
  * @returns Result of registering or re-arming a scheduled prompt.
2847
3828
  */
2848
- addCron: async (params) => connection.sendRequest("session.schedule.addCron", { sessionId, ...params }),
3829
+ addCron: async (params) => connection.sendRequest("session.schedule.addCron", { ...params, sessionId }),
2849
3830
  /**
2850
3831
  * Registers an absolute-time scheduled prompt.
2851
3832
  *
@@ -2853,7 +3834,7 @@ function createInternalSessionRpc(connection, sessionId) {
2853
3834
  *
2854
3835
  * @returns Result of registering or re-arming a scheduled prompt.
2855
3836
  */
2856
- addAt: async (params) => connection.sendRequest("session.schedule.addAt", { sessionId, ...params }),
3837
+ addAt: async (params) => connection.sendRequest("session.schedule.addAt", { ...params, sessionId }),
2857
3838
  /**
2858
3839
  * Registers a self-paced scheduled prompt.
2859
3840
  *
@@ -2861,7 +3842,7 @@ function createInternalSessionRpc(connection, sessionId) {
2861
3842
  *
2862
3843
  * @returns Result of registering or re-arming a scheduled prompt.
2863
3844
  */
2864
- addSelfPaced: async (params) => connection.sendRequest("session.schedule.addSelfPaced", { sessionId, ...params }),
3845
+ addSelfPaced: async (params) => connection.sendRequest("session.schedule.addSelfPaced", { ...params, sessionId }),
2865
3846
  /**
2866
3847
  * Re-arms an active self-paced scheduled prompt.
2867
3848
  *
@@ -2869,7 +3850,7 @@ function createInternalSessionRpc(connection, sessionId) {
2869
3850
  *
2870
3851
  * @returns Result of registering or re-arming a scheduled prompt.
2871
3852
  */
2872
- rearmSelfPaced: async (params) => connection.sendRequest("session.schedule.rearmSelfPaced", { sessionId, ...params })
3853
+ rearmSelfPaced: async (params) => connection.sendRequest("session.schedule.rearmSelfPaced", { ...params, sessionId })
2873
3854
  }
2874
3855
  };
2875
3856
  }
@@ -2879,14 +3860,14 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
2879
3860
  if (!handler) throw new Error(`No providerToken handler registered for session: ${params.sessionId}`);
2880
3861
  return handler.getToken(params);
2881
3862
  });
2882
- connection.onRequest("factory.execute", async (params) => {
2883
- const handler = getHandlers(params.sessionId).factory;
2884
- if (!handler) throw new Error(`No factory handler registered for session: ${params.sessionId}`);
3863
+ connection.onRequest("workflow.execute", async (params) => {
3864
+ const handler = getHandlers(params.sessionId).workflow;
3865
+ if (!handler) throw new Error(`No workflow handler registered for session: ${params.sessionId}`);
2885
3866
  return handler.execute(params);
2886
3867
  });
2887
- connection.onRequest("factory.abort", async (params) => {
2888
- const handler = getHandlers(params.sessionId).factory;
2889
- if (!handler) throw new Error(`No factory handler registered for session: ${params.sessionId}`);
3868
+ connection.onRequest("workflow.abort", async (params) => {
3869
+ const handler = getHandlers(params.sessionId).workflow;
3870
+ if (!handler) throw new Error(`No workflow handler registered for session: ${params.sessionId}`);
2890
3871
  return handler.abort(params);
2891
3872
  });
2892
3873
  connection.onRequest("tasks.cancel", async (params) => {
@@ -2899,11 +3880,21 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
2899
3880
  if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
2900
3881
  return handler.readFile(params);
2901
3882
  });
3883
+ connection.onRequest("sessionFs.readFileBytes", async (params) => {
3884
+ const handler = getHandlers(params.sessionId).sessionFs;
3885
+ if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
3886
+ return handler.readFileBytes(params);
3887
+ });
2902
3888
  connection.onRequest("sessionFs.writeFile", async (params) => {
2903
3889
  const handler = getHandlers(params.sessionId).sessionFs;
2904
3890
  if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
2905
3891
  return handler.writeFile(params);
2906
3892
  });
3893
+ connection.onRequest("sessionFs.writeFileBytes", async (params) => {
3894
+ const handler = getHandlers(params.sessionId).sessionFs;
3895
+ if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
3896
+ return handler.writeFileBytes(params);
3897
+ });
2907
3898
  connection.onRequest("sessionFs.appendFile", async (params) => {
2908
3899
  const handler = getHandlers(params.sessionId).sessionFs;
2909
3900
  if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
@@ -2976,6 +3967,11 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
2976
3967
  });
2977
3968
  }
2978
3969
  function registerClientGlobalApiHandlers(connection, handlers) {
3970
+ connection.onNotification("host.exited", async (params) => {
3971
+ const handler = handlers.host;
3972
+ if (!handler) return;
3973
+ await handler.exited(params);
3974
+ });
2979
3975
  connection.onRequest("extensionLaunchProvider.resolve", async (params) => {
2980
3976
  const handler = handlers.extensionLaunchProvider;
2981
3977
  if (!handler) throw new Error("No extensionLaunchProvider client-global handler registered");
@@ -3001,6 +3997,11 @@ function registerClientGlobalApiHandlers(connection, handlers) {
3001
3997
  if (!handler) throw new Error("No gitHubToken client-global handler registered");
3002
3998
  return handler.getToken(params);
3003
3999
  });
4000
+ connection.onRequest("installations.confirm", async (params) => {
4001
+ const handler = handlers.installations;
4002
+ if (!handler) throw new Error("No installations client-global handler registered");
4003
+ return handler.confirm(params);
4004
+ });
3004
4005
  }
3005
4006
  // Annotate the CommonJS export names for ESM import in node:
3006
4007
  0 && (module.exports = {