@github/copilot-sdk 1.0.0-beta.9 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -9
- package/dist/canvas.d.ts +26 -3
- package/dist/cjs/client.js +118 -40
- package/dist/cjs/extension.js +3 -1
- package/dist/cjs/generated/rpc.js +405 -43
- package/dist/cjs/session.js +46 -5
- package/dist/client.js +118 -40
- package/dist/extension.d.ts +1 -1
- package/dist/extension.js +3 -1
- package/dist/generated/rpc.d.ts +3268 -712
- package/dist/generated/rpc.js +404 -43
- package/dist/generated/session-events.d.ts +199 -28
- package/dist/index.d.ts +2 -2
- package/dist/session.d.ts +11 -5
- package/dist/session.js +46 -5
- package/dist/types.d.ts +172 -2
- package/docs/examples.md +7 -4
- package/package.json +4 -4
package/dist/generated/rpc.js
CHANGED
|
@@ -85,7 +85,11 @@ function createServerRpc(connection) {
|
|
|
85
85
|
*
|
|
86
86
|
* @param params MCP server names to disable for new sessions.
|
|
87
87
|
*/
|
|
88
|
-
disable: async (params) => connection.sendRequest("mcp.config.disable", params)
|
|
88
|
+
disable: async (params) => connection.sendRequest("mcp.config.disable", params),
|
|
89
|
+
/**
|
|
90
|
+
* Drops this runtime process's in-memory MCP server-definition cache so the next MCP config read observes disk.
|
|
91
|
+
*/
|
|
92
|
+
reload: async () => connection.sendRequest("mcp.config.reload", {})
|
|
89
93
|
},
|
|
90
94
|
/**
|
|
91
95
|
* Discovers MCP servers from user, workspace, plugin, and builtin sources.
|
|
@@ -96,6 +100,96 @@ function createServerRpc(connection) {
|
|
|
96
100
|
*/
|
|
97
101
|
discover: async (params) => connection.sendRequest("mcp.discover", params)
|
|
98
102
|
},
|
|
103
|
+
/** @experimental */
|
|
104
|
+
plugins: {
|
|
105
|
+
/**
|
|
106
|
+
* Lists plugins installed in user/global state.
|
|
107
|
+
*
|
|
108
|
+
* @returns Plugins installed in user/global state.
|
|
109
|
+
*/
|
|
110
|
+
list: async () => connection.sendRequest("plugins.list", {}),
|
|
111
|
+
/**
|
|
112
|
+
* Installs a plugin from a marketplace, GitHub repo, URL, or local path.
|
|
113
|
+
*
|
|
114
|
+
* @param params Plugin source and optional working directory for relative-path resolution.
|
|
115
|
+
*
|
|
116
|
+
* @returns Result of installing a plugin.
|
|
117
|
+
*/
|
|
118
|
+
install: async (params) => connection.sendRequest("plugins.install", params),
|
|
119
|
+
/**
|
|
120
|
+
* Uninstalls an installed plugin.
|
|
121
|
+
*
|
|
122
|
+
* @param params Name (or spec) of the plugin to uninstall.
|
|
123
|
+
*/
|
|
124
|
+
uninstall: async (params) => connection.sendRequest("plugins.uninstall", params),
|
|
125
|
+
/**
|
|
126
|
+
* Updates an installed plugin to its latest published version.
|
|
127
|
+
*
|
|
128
|
+
* @param params Name (or spec) of the plugin to update.
|
|
129
|
+
*
|
|
130
|
+
* @returns Result of updating a single plugin.
|
|
131
|
+
*/
|
|
132
|
+
update: async (params) => connection.sendRequest("plugins.update", params),
|
|
133
|
+
/**
|
|
134
|
+
* Updates every installed plugin to its latest published version.
|
|
135
|
+
*
|
|
136
|
+
* @returns Result of updating all installed plugins.
|
|
137
|
+
*/
|
|
138
|
+
updateAll: async () => connection.sendRequest("plugins.updateAll", {}),
|
|
139
|
+
/**
|
|
140
|
+
* Enables installed plugins for new sessions.
|
|
141
|
+
*
|
|
142
|
+
* @param params Plugin names (or specs) to enable.
|
|
143
|
+
*/
|
|
144
|
+
enable: async (params) => connection.sendRequest("plugins.enable", params),
|
|
145
|
+
/**
|
|
146
|
+
* Disables installed plugins for new sessions.
|
|
147
|
+
*
|
|
148
|
+
* @param params Plugin names (or specs) to disable.
|
|
149
|
+
*/
|
|
150
|
+
disable: async (params) => connection.sendRequest("plugins.disable", params),
|
|
151
|
+
/** @experimental */
|
|
152
|
+
marketplaces: {
|
|
153
|
+
/**
|
|
154
|
+
* Lists all registered marketplaces (defaults + user-added).
|
|
155
|
+
*
|
|
156
|
+
* @returns All registered marketplaces, including built-in defaults.
|
|
157
|
+
*/
|
|
158
|
+
list: async () => connection.sendRequest("plugins.marketplaces.list", {}),
|
|
159
|
+
/**
|
|
160
|
+
* Registers a new marketplace from a source (owner/repo, URL, or local path).
|
|
161
|
+
*
|
|
162
|
+
* @param params Marketplace source to register.
|
|
163
|
+
*
|
|
164
|
+
* @returns Result of registering a new marketplace.
|
|
165
|
+
*/
|
|
166
|
+
add: async (params) => connection.sendRequest("plugins.marketplaces.add", params),
|
|
167
|
+
/**
|
|
168
|
+
* Removes a previously-registered marketplace. When the marketplace has dependent plugins and `force` is not set, the marketplace is left intact and the result lists the dependents so the caller can decide whether to retry with `force=true`.
|
|
169
|
+
*
|
|
170
|
+
* @param params Name of the marketplace to remove and an optional force flag.
|
|
171
|
+
*
|
|
172
|
+
* @returns Outcome of the remove attempt, including dependent-plugin info when applicable.
|
|
173
|
+
*/
|
|
174
|
+
remove: async (params) => connection.sendRequest("plugins.marketplaces.remove", params),
|
|
175
|
+
/**
|
|
176
|
+
* Lists plugins advertised by a registered marketplace.
|
|
177
|
+
*
|
|
178
|
+
* @param params Name of the marketplace whose plugin catalog to fetch.
|
|
179
|
+
*
|
|
180
|
+
* @returns Plugins advertised by the marketplace.
|
|
181
|
+
*/
|
|
182
|
+
browse: async (params) => connection.sendRequest("plugins.marketplaces.browse", params),
|
|
183
|
+
/**
|
|
184
|
+
* Re-fetches one or all registered marketplace catalogs.
|
|
185
|
+
*
|
|
186
|
+
* @param params Optional marketplace name; omit to refresh all.
|
|
187
|
+
*
|
|
188
|
+
* @returns Result of refreshing one or more marketplace catalogs.
|
|
189
|
+
*/
|
|
190
|
+
refresh: async (params) => connection.sendRequest("plugins.marketplaces.refresh", params)
|
|
191
|
+
}
|
|
192
|
+
},
|
|
99
193
|
skills: {
|
|
100
194
|
config: {
|
|
101
195
|
/**
|
|
@@ -114,6 +208,42 @@ function createServerRpc(connection) {
|
|
|
114
208
|
*/
|
|
115
209
|
discover: async (params) => connection.sendRequest("skills.discover", params)
|
|
116
210
|
},
|
|
211
|
+
/** @experimental */
|
|
212
|
+
agents: {
|
|
213
|
+
/**
|
|
214
|
+
* Discovers custom agents across user, project, plugin, and remote sources.
|
|
215
|
+
*
|
|
216
|
+
* @param params Optional project paths to include in agent discovery.
|
|
217
|
+
*
|
|
218
|
+
* @returns Agents discovered across user, project, plugin, and remote sources.
|
|
219
|
+
*/
|
|
220
|
+
discover: async (params) => connection.sendRequest("agents.discover", params)
|
|
221
|
+
},
|
|
222
|
+
/** @experimental */
|
|
223
|
+
instructions: {
|
|
224
|
+
/**
|
|
225
|
+
* Discovers instruction sources across user, repository, and plugin sources.
|
|
226
|
+
*
|
|
227
|
+
* @param params Optional project paths to include in instruction discovery.
|
|
228
|
+
*
|
|
229
|
+
* @returns Instruction sources discovered across user, repository, and plugin sources.
|
|
230
|
+
*/
|
|
231
|
+
discover: async (params) => connection.sendRequest("instructions.discover", params)
|
|
232
|
+
},
|
|
233
|
+
user: {
|
|
234
|
+
settings: {
|
|
235
|
+
/**
|
|
236
|
+
* Drops this runtime process's in-memory user settings cache so the next settings read observes disk.
|
|
237
|
+
*/
|
|
238
|
+
reload: async () => connection.sendRequest("user.settings.reload", {})
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
runtime: {
|
|
242
|
+
/**
|
|
243
|
+
* Gracefully shuts down an SDK-owned runtime. The response is sent only after cleanup completes; callers may then terminate the owned runtime process.
|
|
244
|
+
*/
|
|
245
|
+
shutdown: async () => connection.sendRequest("runtime.shutdown", {})
|
|
246
|
+
},
|
|
117
247
|
sessionFs: {
|
|
118
248
|
/**
|
|
119
249
|
* Registers an SDK client as the session filesystem provider.
|
|
@@ -126,6 +256,14 @@ function createServerRpc(connection) {
|
|
|
126
256
|
},
|
|
127
257
|
/** @experimental */
|
|
128
258
|
sessions: {
|
|
259
|
+
/**
|
|
260
|
+
* Creates or resumes a local session and returns the opened session ID.
|
|
261
|
+
*
|
|
262
|
+
* @param params Open a session by creating, resuming, attaching, connecting to a remote, or handing off.
|
|
263
|
+
*
|
|
264
|
+
* @returns Result of opening a session.
|
|
265
|
+
*/
|
|
266
|
+
open: async (params) => connection.sendRequest("sessions.open", params),
|
|
129
267
|
/**
|
|
130
268
|
* Creates a new session by forking persisted history from an existing session.
|
|
131
269
|
*
|
|
@@ -143,11 +281,11 @@ function createServerRpc(connection) {
|
|
|
143
281
|
*/
|
|
144
282
|
connect: async (params) => connection.sendRequest("sessions.connect", params),
|
|
145
283
|
/**
|
|
146
|
-
* Lists
|
|
284
|
+
* Lists sessions, optionally filtered by source and working-directory context. Returned entries are discriminated by `isRemote`: local entries carry only the lightweight `LocalSessionMetadataValue` shape; remote entries carry the full `RemoteSessionMetadataValue` shape (repository, PR number, taskType, etc.).
|
|
147
285
|
*
|
|
148
|
-
* @param params Optional metadata-load limit and
|
|
286
|
+
* @param params Optional source filter, metadata-load limit, and context filter applied to the returned sessions.
|
|
149
287
|
*
|
|
150
|
-
* @returns
|
|
288
|
+
* @returns Sessions matching the filter, ordered most-recently-modified first.
|
|
151
289
|
*/
|
|
152
290
|
list: async (params) => connection.sendRequest("sessions.list", params),
|
|
153
291
|
/**
|
|
@@ -174,14 +312,6 @@ function createServerRpc(connection) {
|
|
|
174
312
|
* @returns Most-relevant session ID for the supplied context, or omitted when no sessions exist.
|
|
175
313
|
*/
|
|
176
314
|
getLastForContext: async (params) => connection.sendRequest("sessions.getLastForContext", params),
|
|
177
|
-
/**
|
|
178
|
-
* Computes the absolute path to a session's persisted events.jsonl file.
|
|
179
|
-
*
|
|
180
|
-
* @param params Session ID whose event-log file path to compute.
|
|
181
|
-
*
|
|
182
|
-
* @returns Absolute path to the session's events.jsonl file on disk.
|
|
183
|
-
*/
|
|
184
|
-
getEventFilePath: async (params) => connection.sendRequest("sessions.getEventFilePath", params),
|
|
185
315
|
/**
|
|
186
316
|
* Returns the on-disk byte size of each session's workspace directory.
|
|
187
317
|
*
|
|
@@ -196,14 +326,6 @@ function createServerRpc(connection) {
|
|
|
196
326
|
* @returns Session IDs from the input set that are currently in use by another process.
|
|
197
327
|
*/
|
|
198
328
|
checkInUse: async (params) => connection.sendRequest("sessions.checkInUse", params),
|
|
199
|
-
/**
|
|
200
|
-
* Returns a session's persisted remote-steerable flag, if any has been recorded.
|
|
201
|
-
*
|
|
202
|
-
* @param params Session ID to look up the persisted remote-steerable flag for.
|
|
203
|
-
*
|
|
204
|
-
* @returns The session's persisted remote-steerable flag, or omitted when no value has been persisted.
|
|
205
|
-
*/
|
|
206
|
-
getPersistedRemoteSteerable: async (params) => connection.sendRequest("sessions.getPersistedRemoteSteerable", params),
|
|
207
329
|
/**
|
|
208
330
|
* Closes a session: emits shutdown, flushes pending events, releases the in-use lock, and disposes the active session.
|
|
209
331
|
*
|
|
@@ -275,7 +397,45 @@ function createServerRpc(connection) {
|
|
|
275
397
|
*
|
|
276
398
|
* @returns Replace the manager-wide additional plugins. New session creations and subsequent hook reloads see the new set; already-running sessions keep their existing hook installation until the next reload.
|
|
277
399
|
*/
|
|
278
|
-
setAdditionalPlugins: async (params) => connection.sendRequest("sessions.setAdditionalPlugins", params)
|
|
400
|
+
setAdditionalPlugins: async (params) => connection.sendRequest("sessions.setAdditionalPlugins", params),
|
|
401
|
+
/**
|
|
402
|
+
* Attaches the runtime-managed remote-control singleton to a session, awaiting initial setup. If remote control is already attached to a different session, the singleton is transferred (preserving the underlying Mission Control connection). Returns the final status.
|
|
403
|
+
*
|
|
404
|
+
* @param params Parameters for attaching the remote-control singleton to a session.
|
|
405
|
+
*
|
|
406
|
+
* @returns Wrapper for the singleton's current status.
|
|
407
|
+
*/
|
|
408
|
+
startRemoteControl: async (params) => connection.sendRequest("sessions.startRemoteControl", params),
|
|
409
|
+
/**
|
|
410
|
+
* Atomically rebinds the remote-control singleton to a different session, preserving the underlying Mission Control connection. When `expectedFromSessionId` is provided and does not match the singleton's current `attachedSessionId`, the transfer is rejected with `transferred: false` and the current status is returned unchanged.
|
|
411
|
+
*
|
|
412
|
+
* @param params Parameters for atomically rebinding the remote-control singleton.
|
|
413
|
+
*
|
|
414
|
+
* @returns Outcome of a transferRemoteControl call.
|
|
415
|
+
*/
|
|
416
|
+
transferRemoteControl: async (params) => connection.sendRequest("sessions.transferRemoteControl", params),
|
|
417
|
+
/**
|
|
418
|
+
* Patches the steering state of the active remote-control singleton. When remote control is off, this is a no-op and the off status is returned. Today only `enabled: true` is actionable on the underlying exporter; passing `false` is reserved for future use.
|
|
419
|
+
*
|
|
420
|
+
* @param params Patch for the singleton's steering state.
|
|
421
|
+
*
|
|
422
|
+
* @returns Wrapper for the singleton's current status.
|
|
423
|
+
*/
|
|
424
|
+
setRemoteControlSteering: async (params) => connection.sendRequest("sessions.setRemoteControlSteering", params),
|
|
425
|
+
/**
|
|
426
|
+
* Stops the remote-control singleton. When `expectedSessionId` is provided and does not match the singleton's current `attachedSessionId`, the stop is rejected with `stopped: false` and the current status is returned unchanged (unless `force` is set, in which case the singleton is unconditionally torn down).
|
|
427
|
+
*
|
|
428
|
+
* @param params Parameters for stopping the remote-control singleton.
|
|
429
|
+
*
|
|
430
|
+
* @returns Outcome of a stopRemoteControl call.
|
|
431
|
+
*/
|
|
432
|
+
stopRemoteControl: async (params) => connection.sendRequest("sessions.stopRemoteControl", params),
|
|
433
|
+
/**
|
|
434
|
+
* Returns the current state of the remote-control singleton, including the attached session id and frontend URL when active.
|
|
435
|
+
*
|
|
436
|
+
* @returns Wrapper for the singleton's current status.
|
|
437
|
+
*/
|
|
438
|
+
getRemoteControlStatus: async () => connection.sendRequest("sessions.getRemoteControlStatus", {})
|
|
279
439
|
},
|
|
280
440
|
/** @experimental */
|
|
281
441
|
agentRegistry: {
|
|
@@ -293,13 +453,62 @@ function createServerRpc(connection) {
|
|
|
293
453
|
function createInternalServerRpc(connection) {
|
|
294
454
|
return {
|
|
295
455
|
/**
|
|
296
|
-
* Performs the SDK server connection handshake and validates the optional connection token.
|
|
456
|
+
* 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.
|
|
297
457
|
*
|
|
298
458
|
* @param params Optional connection token presented by the SDK client during the handshake.
|
|
299
459
|
*
|
|
300
460
|
* @returns Handshake result reporting the server's protocol version and package version on success.
|
|
301
461
|
*/
|
|
302
|
-
connect: async (params) => connection.sendRequest("connect", params)
|
|
462
|
+
connect: async (params) => connection.sendRequest("connect", params),
|
|
463
|
+
/** @experimental */
|
|
464
|
+
sessions: {
|
|
465
|
+
/**
|
|
466
|
+
* Computes the absolute path to a session's persisted events.jsonl file. Internal: filesystem paths are only meaningful in-process (CLI and runtime share a filesystem). Currently used by the CLI's contribution-graph feature to read historical events directly. Remote SDK consumers must not depend on this; a proper event-query API would replace it if the contribution graph ever needed to work over the wire.
|
|
467
|
+
*
|
|
468
|
+
* @param params Session ID whose event-log file path to compute.
|
|
469
|
+
*
|
|
470
|
+
* @returns Absolute path to the session's events.jsonl file on disk.
|
|
471
|
+
*/
|
|
472
|
+
getEventFilePath: async (params) => connection.sendRequest("sessions.getEventFilePath", params),
|
|
473
|
+
/**
|
|
474
|
+
* Returns a session's persisted remote-steerable flag, if any has been recorded. Internal: this is CLI-specific book-keeping used by `--continue` / `--resume` to inherit the prior session's remote-steerable preference. SDK consumers that want similar behavior should manage their own persistence around start/stop calls rather than relying on this runtime-side flag.
|
|
475
|
+
*
|
|
476
|
+
* @param params Session ID to look up the persisted remote-steerable flag for.
|
|
477
|
+
*
|
|
478
|
+
* @returns The session's persisted remote-steerable flag, or omitted when no value has been persisted.
|
|
479
|
+
*/
|
|
480
|
+
getPersistedRemoteSteerable: async (params) => connection.sendRequest("sessions.getPersistedRemoteSteerable", params),
|
|
481
|
+
/**
|
|
482
|
+
* 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.
|
|
483
|
+
*
|
|
484
|
+
* @param params Session ID whose board entry count should be returned.
|
|
485
|
+
*
|
|
486
|
+
* @returns Dynamic-context board entry count, when available.
|
|
487
|
+
*/
|
|
488
|
+
getBoardEntryCount: async (params) => connection.sendRequest("sessions.getBoardEntryCount", params),
|
|
489
|
+
/**
|
|
490
|
+
* Cursor-based long-poll for sessions spawned by the runtime (e.g. in response to a Mission Control `start_session` command). The cursor is an opaque token; pass it back to receive only spawn events that occurred AFTER the cursor was issued. Omit the cursor on the first call to receive any events buffered since the runtime started. Internal: this is a CLI background-daemon plumbing primitive. SDK consumers that need to react to runtime-spawned sessions should subscribe to a higher-level event stream rather than driving a long-poll loop.
|
|
491
|
+
*
|
|
492
|
+
* @param params Cursor and optional long-poll wait for polling runtime-spawned sessions.
|
|
493
|
+
*
|
|
494
|
+
* @returns Batch of spawn events plus a cursor for follow-up polls.
|
|
495
|
+
*/
|
|
496
|
+
pollSpawnedSessions: async (params) => connection.sendRequest("sessions.pollSpawnedSessions", params),
|
|
497
|
+
/**
|
|
498
|
+
* Registers extension-provided tools on the given session, gated by an optional `enabled` callback. Returns an opaque unsubscribe function the caller must invoke to deregister the tools when the extension is torn down. Marked internal because `loader`, `enabled`, and the returned `unsubscribe` are in-process handles that cannot cross the JSON-RPC boundary. Disappears once extension discovery / launch / tool registration are owned by the runtime: SDK consumers will pass pure config (search paths, disabled ids) via `SessionOptions` and the runtime will resolve, launch, register, and tear down extensions itself.
|
|
499
|
+
*
|
|
500
|
+
* @param params Params to attach an extension loader's tools to a session.
|
|
501
|
+
*
|
|
502
|
+
* @returns Handle for releasing the extension tool registration.
|
|
503
|
+
*/
|
|
504
|
+
registerExtensionToolsOnSession: async (params) => connection.sendRequest("sessions.registerExtensionToolsOnSession", params),
|
|
505
|
+
/**
|
|
506
|
+
* Attaches (or detaches) an in-process ExtensionController delegate for the given session, used by shared-API surfaces that need to query or modify the session's extension state. Pass `controller: undefined` to detach. Marked internal because the controller is an in-process object that cannot cross the JSON-RPC boundary. Disappears alongside `registerExtensionToolsOnSession`: once the runtime owns extension management, the public surface exposes list/enable/disable/reload as dedicated RPCs served by the runtime.
|
|
507
|
+
*
|
|
508
|
+
* @param params Params to attach or detach an in-process ExtensionController delegate.
|
|
509
|
+
*/
|
|
510
|
+
configureSessionExtensions: async (params) => connection.sendRequest("sessions.configureSessionExtensions", params)
|
|
511
|
+
}
|
|
303
512
|
};
|
|
304
513
|
}
|
|
305
514
|
function createSessionRpc(connection, sessionId) {
|
|
@@ -383,27 +592,30 @@ function createSessionRpc(connection, sessionId) {
|
|
|
383
592
|
* @param params Canvas close parameters.
|
|
384
593
|
*/
|
|
385
594
|
close: async (params) => connection.sendRequest("session.canvas.close", { sessionId, ...params }),
|
|
386
|
-
/**
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
595
|
+
/** @experimental */
|
|
596
|
+
action: {
|
|
597
|
+
/**
|
|
598
|
+
* Invokes an action on an open canvas instance.
|
|
599
|
+
*
|
|
600
|
+
* @param params Canvas action invocation parameters.
|
|
601
|
+
*
|
|
602
|
+
* @returns Canvas action invocation result.
|
|
603
|
+
*/
|
|
604
|
+
invoke: async (params) => connection.sendRequest("session.canvas.action.invoke", { sessionId, ...params })
|
|
605
|
+
}
|
|
394
606
|
},
|
|
395
607
|
/** @experimental */
|
|
396
608
|
model: {
|
|
397
609
|
/**
|
|
398
610
|
* Gets the currently selected model for the session.
|
|
399
611
|
*
|
|
400
|
-
* @returns The currently selected model
|
|
612
|
+
* @returns The currently selected model, reasoning effort, and context tier for the session. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume.
|
|
401
613
|
*/
|
|
402
614
|
getCurrent: async () => connection.sendRequest("session.model.getCurrent", { sessionId }),
|
|
403
615
|
/**
|
|
404
616
|
* Switches the session to a model and optional reasoning configuration.
|
|
405
617
|
*
|
|
406
|
-
* @param params Target model identifier and optional reasoning effort, summary, and
|
|
618
|
+
* @param params Target model identifier and optional reasoning effort, summary, capability overrides, and context tier.
|
|
407
619
|
*
|
|
408
620
|
* @returns The model identifier active on the session after the switch.
|
|
409
621
|
*/
|
|
@@ -415,7 +627,15 @@ function createSessionRpc(connection, sessionId) {
|
|
|
415
627
|
*
|
|
416
628
|
* @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.
|
|
417
629
|
*/
|
|
418
|
-
setReasoningEffort: async (params) => connection.sendRequest("session.model.setReasoningEffort", { sessionId, ...params })
|
|
630
|
+
setReasoningEffort: async (params) => connection.sendRequest("session.model.setReasoningEffort", { sessionId, ...params }),
|
|
631
|
+
/**
|
|
632
|
+
* 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.
|
|
633
|
+
*
|
|
634
|
+
* @param params Optional listing options.
|
|
635
|
+
*
|
|
636
|
+
* @returns The list of models available to this session.
|
|
637
|
+
*/
|
|
638
|
+
list: async (params) => connection.sendRequest("session.model.list", { sessionId, ...params })
|
|
419
639
|
},
|
|
420
640
|
/** @experimental */
|
|
421
641
|
mode: {
|
|
@@ -472,7 +692,13 @@ function createSessionRpc(connection, sessionId) {
|
|
|
472
692
|
/**
|
|
473
693
|
* Deletes the session plan file from the workspace.
|
|
474
694
|
*/
|
|
475
|
-
delete: async () => connection.sendRequest("session.plan.delete", { sessionId })
|
|
695
|
+
delete: async () => connection.sendRequest("session.plan.delete", { sessionId }),
|
|
696
|
+
/**
|
|
697
|
+
* Reads todo rows from the session SQL database for plan rendering.
|
|
698
|
+
*
|
|
699
|
+
* @returns Todo rows read from the session SQL database. Empty when no session database is available.
|
|
700
|
+
*/
|
|
701
|
+
readSqlTodos: async () => connection.sendRequest("session.plan.readSqlTodos", { sessionId })
|
|
476
702
|
},
|
|
477
703
|
/** @experimental */
|
|
478
704
|
workspaces: {
|
|
@@ -707,11 +933,19 @@ function createSessionRpc(connection, sessionId) {
|
|
|
707
933
|
/** @experimental */
|
|
708
934
|
mcp: {
|
|
709
935
|
/**
|
|
710
|
-
* Lists MCP servers configured for the session
|
|
936
|
+
* 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.
|
|
711
937
|
*
|
|
712
|
-
* @returns MCP servers configured for the session, with their connection status.
|
|
938
|
+
* @returns MCP servers configured for the session, with their connection status and host-level state.
|
|
713
939
|
*/
|
|
714
940
|
list: async () => connection.sendRequest("session.mcp.list", { sessionId }),
|
|
941
|
+
/**
|
|
942
|
+
* Lists the tools exposed by a connected MCP server on this session's host.
|
|
943
|
+
*
|
|
944
|
+
* @param params Server name whose tool list should be returned.
|
|
945
|
+
*
|
|
946
|
+
* @returns Tools exposed by the connected MCP server. Throws when the server is not connected.
|
|
947
|
+
*/
|
|
948
|
+
listTools: async (params) => connection.sendRequest("session.mcp.listTools", { sessionId, ...params }),
|
|
715
949
|
/**
|
|
716
950
|
* Enables an MCP server for the session.
|
|
717
951
|
*
|
|
@@ -758,6 +992,20 @@ function createSessionRpc(connection, sessionId) {
|
|
|
758
992
|
* @returns Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove).
|
|
759
993
|
*/
|
|
760
994
|
removeGitHub: async () => connection.sendRequest("session.mcp.removeGitHub", { sessionId }),
|
|
995
|
+
/**
|
|
996
|
+
* Stops an individual MCP server on the session's host.
|
|
997
|
+
*
|
|
998
|
+
* @param params Server name for an individual MCP server stop.
|
|
999
|
+
*/
|
|
1000
|
+
stopServer: async (params) => connection.sendRequest("session.mcp.stopServer", { sessionId, ...params }),
|
|
1001
|
+
/**
|
|
1002
|
+
* Checks whether a named MCP server is currently running on the session's host.
|
|
1003
|
+
*
|
|
1004
|
+
* @param params Server name to check running status for.
|
|
1005
|
+
*
|
|
1006
|
+
* @returns Whether the named MCP server is running.
|
|
1007
|
+
*/
|
|
1008
|
+
isServerRunning: async (params) => connection.sendRequest("session.mcp.isServerRunning", { sessionId, ...params }),
|
|
761
1009
|
/** @experimental */
|
|
762
1010
|
oauth: {
|
|
763
1011
|
/**
|
|
@@ -824,7 +1072,13 @@ function createSessionRpc(connection, sessionId) {
|
|
|
824
1072
|
*
|
|
825
1073
|
* @returns Plugins installed for the session, with their enabled state and version metadata.
|
|
826
1074
|
*/
|
|
827
|
-
list: async () => connection.sendRequest("session.plugins.list", { sessionId })
|
|
1075
|
+
list: async () => connection.sendRequest("session.plugins.list", { sessionId }),
|
|
1076
|
+
/**
|
|
1077
|
+
* 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.
|
|
1078
|
+
*
|
|
1079
|
+
* @param params Optional flags controlling which side effects the reload performs.
|
|
1080
|
+
*/
|
|
1081
|
+
reload: async (params) => connection.sendRequest("session.plugins.reload", { sessionId, ...params })
|
|
828
1082
|
},
|
|
829
1083
|
/** @experimental */
|
|
830
1084
|
options: {
|
|
@@ -869,7 +1123,13 @@ function createSessionRpc(connection, sessionId) {
|
|
|
869
1123
|
/**
|
|
870
1124
|
* Reloads extension definitions and processes for the session.
|
|
871
1125
|
*/
|
|
872
|
-
reload: async () => connection.sendRequest("session.extensions.reload", { sessionId })
|
|
1126
|
+
reload: async () => connection.sendRequest("session.extensions.reload", { sessionId }),
|
|
1127
|
+
/**
|
|
1128
|
+
* 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.
|
|
1129
|
+
*
|
|
1130
|
+
* @param params Parameters for session.extensions.sendAttachmentsToMessage.
|
|
1131
|
+
*/
|
|
1132
|
+
sendAttachmentsToMessage: async (params) => connection.sendRequest("session.extensions.sendAttachmentsToMessage", { sessionId, ...params })
|
|
873
1133
|
},
|
|
874
1134
|
/** @experimental */
|
|
875
1135
|
tools: {
|
|
@@ -886,7 +1146,13 @@ function createSessionRpc(connection, sessionId) {
|
|
|
886
1146
|
*
|
|
887
1147
|
* @returns Resolve, build, and validate the runtime tool list for this session. Subagent sessions and consumer flows that need an initialized tool set before `send` invoke this. Default base-class implementation is a no-op for sessions that don't support tool validation.
|
|
888
1148
|
*/
|
|
889
|
-
initializeAndValidate: async () => connection.sendRequest("session.tools.initializeAndValidate", { sessionId })
|
|
1149
|
+
initializeAndValidate: async () => connection.sendRequest("session.tools.initializeAndValidate", { sessionId }),
|
|
1150
|
+
/**
|
|
1151
|
+
* Returns lightweight metadata for the session's currently initialized tools.
|
|
1152
|
+
*
|
|
1153
|
+
* @returns Current lightweight tool metadata snapshot for the session.
|
|
1154
|
+
*/
|
|
1155
|
+
getCurrentMetadata: async () => connection.sendRequest("session.tools.getCurrentMetadata", { sessionId })
|
|
890
1156
|
},
|
|
891
1157
|
/** @experimental */
|
|
892
1158
|
commands: {
|
|
@@ -941,6 +1207,12 @@ function createSessionRpc(connection, sessionId) {
|
|
|
941
1207
|
},
|
|
942
1208
|
/** @experimental */
|
|
943
1209
|
telemetry: {
|
|
1210
|
+
/**
|
|
1211
|
+
* Gets the telemetry engagement ID currently associated with the session, when available.
|
|
1212
|
+
*
|
|
1213
|
+
* @returns Telemetry engagement ID for the session, when available.
|
|
1214
|
+
*/
|
|
1215
|
+
getEngagementId: async () => connection.sendRequest("session.telemetry.getEngagementId", { sessionId }),
|
|
944
1216
|
/**
|
|
945
1217
|
* Sets feature override key/value pairs to attach to subsequent telemetry events for the session.
|
|
946
1218
|
*
|
|
@@ -950,6 +1222,14 @@ function createSessionRpc(connection, sessionId) {
|
|
|
950
1222
|
},
|
|
951
1223
|
/** @experimental */
|
|
952
1224
|
ui: {
|
|
1225
|
+
/**
|
|
1226
|
+
* Runs a transient no-tools model query against the current conversation context.
|
|
1227
|
+
*
|
|
1228
|
+
* @param params Transient question to answer without adding it to conversation history.
|
|
1229
|
+
*
|
|
1230
|
+
* @returns Transient answer generated from current conversation context.
|
|
1231
|
+
*/
|
|
1232
|
+
ephemeralQuery: async (params) => connection.sendRequest("session.ui.ephemeralQuery", { sessionId, ...params }),
|
|
953
1233
|
/**
|
|
954
1234
|
* Requests structured input from a UI-capable client.
|
|
955
1235
|
*
|
|
@@ -1212,6 +1492,12 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1212
1492
|
* @returns Indicates whether the local session is currently processing a turn or background continuation.
|
|
1213
1493
|
*/
|
|
1214
1494
|
isProcessing: async () => connection.sendRequest("session.metadata.isProcessing", { sessionId }),
|
|
1495
|
+
/**
|
|
1496
|
+
* Returns a snapshot of activity flags for the session.
|
|
1497
|
+
*
|
|
1498
|
+
* @returns Current activity flags for the session.
|
|
1499
|
+
*/
|
|
1500
|
+
activity: async () => connection.sendRequest("session.metadata.activity", { sessionId }),
|
|
1215
1501
|
/**
|
|
1216
1502
|
* Returns the token breakdown for the session's current context window for a given model.
|
|
1217
1503
|
*
|
|
@@ -1262,7 +1548,23 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1262
1548
|
*
|
|
1263
1549
|
* @returns Indicates whether the signal was delivered; false if the process was unknown or already exited.
|
|
1264
1550
|
*/
|
|
1265
|
-
kill: async (params) => connection.sendRequest("session.shell.kill", { sessionId, ...params })
|
|
1551
|
+
kill: async (params) => connection.sendRequest("session.shell.kill", { sessionId, ...params }),
|
|
1552
|
+
/**
|
|
1553
|
+
* Executes a user-requested shell command through the session runtime.
|
|
1554
|
+
*
|
|
1555
|
+
* @param params User-requested shell command and cancellation handle.
|
|
1556
|
+
*
|
|
1557
|
+
* @returns Result of a user-requested shell command.
|
|
1558
|
+
*/
|
|
1559
|
+
executeUserRequested: async (params) => connection.sendRequest("session.shell.executeUserRequested", { sessionId, ...params }),
|
|
1560
|
+
/**
|
|
1561
|
+
* Cancels a user-requested shell command by request ID.
|
|
1562
|
+
*
|
|
1563
|
+
* @param params User-requested shell execution cancellation handle.
|
|
1564
|
+
*
|
|
1565
|
+
* @returns Cancellation result for a user-requested shell command.
|
|
1566
|
+
*/
|
|
1567
|
+
cancelUserRequested: async (params) => connection.sendRequest("session.shell.cancelUserRequested", { sessionId, ...params })
|
|
1266
1568
|
},
|
|
1267
1569
|
/** @experimental */
|
|
1268
1570
|
history: {
|
|
@@ -1404,6 +1706,64 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1404
1706
|
}
|
|
1405
1707
|
};
|
|
1406
1708
|
}
|
|
1709
|
+
function createInternalSessionRpc(connection, sessionId) {
|
|
1710
|
+
return {
|
|
1711
|
+
/** @experimental */
|
|
1712
|
+
mcp: {
|
|
1713
|
+
/**
|
|
1714
|
+
* Reloads MCP server connections for the session with an explicit host-provided configuration.
|
|
1715
|
+
*
|
|
1716
|
+
* @param params Opaque MCP reload configuration.
|
|
1717
|
+
*
|
|
1718
|
+
* @returns MCP server startup filtering result.
|
|
1719
|
+
*/
|
|
1720
|
+
reloadWithConfig: async (params) => connection.sendRequest("session.mcp.reloadWithConfig", { sessionId, ...params }),
|
|
1721
|
+
/**
|
|
1722
|
+
* Configures the built-in GitHub MCP server for the session's current auth context.
|
|
1723
|
+
*
|
|
1724
|
+
* @param params Opaque auth info used to configure GitHub MCP.
|
|
1725
|
+
*
|
|
1726
|
+
* @returns Result of configuring GitHub MCP.
|
|
1727
|
+
*/
|
|
1728
|
+
configureGitHub: async (params) => connection.sendRequest("session.mcp.configureGitHub", { sessionId, ...params }),
|
|
1729
|
+
/**
|
|
1730
|
+
* Starts an individual MCP server on the session's host.
|
|
1731
|
+
*
|
|
1732
|
+
* @param params Server name and opaque configuration for an individual MCP server start.
|
|
1733
|
+
*/
|
|
1734
|
+
startServer: async (params) => connection.sendRequest("session.mcp.startServer", { sessionId, ...params }),
|
|
1735
|
+
/**
|
|
1736
|
+
* Restarts an individual MCP server on the session's host (stops then starts).
|
|
1737
|
+
*
|
|
1738
|
+
* @param params Server name and opaque configuration for an individual MCP server restart.
|
|
1739
|
+
*/
|
|
1740
|
+
restartServer: async (params) => connection.sendRequest("session.mcp.restartServer", { sessionId, ...params }),
|
|
1741
|
+
/**
|
|
1742
|
+
* 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.
|
|
1743
|
+
*
|
|
1744
|
+
* @param params Registration parameters for an external MCP client.
|
|
1745
|
+
*/
|
|
1746
|
+
registerExternalClient: async (params) => connection.sendRequest("session.mcp.registerExternalClient", { sessionId, ...params }),
|
|
1747
|
+
/**
|
|
1748
|
+
* 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.
|
|
1749
|
+
*
|
|
1750
|
+
* @param params Server name identifying the external client to remove.
|
|
1751
|
+
*/
|
|
1752
|
+
unregisterExternalClient: async (params) => connection.sendRequest("session.mcp.unregisterExternalClient", { sessionId, ...params }),
|
|
1753
|
+
/** @experimental */
|
|
1754
|
+
oauth: {
|
|
1755
|
+
/**
|
|
1756
|
+
* Responds to a pending MCP OAuth provider request. Marked internal because the `provider` argument is an in-process OAuthClientProvider instance that cannot be carried over the wire; the public OAuth surface will route the response through a wire-clean handshake once the CLI moves on top of the SDK.
|
|
1757
|
+
*
|
|
1758
|
+
* @param params MCP OAuth request id and optional provider response.
|
|
1759
|
+
*
|
|
1760
|
+
* @returns Empty result after recording the MCP OAuth response.
|
|
1761
|
+
*/
|
|
1762
|
+
respond: async (params) => connection.sendRequest("session.mcp.oauth.respond", { sessionId, ...params })
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1407
1767
|
function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
1408
1768
|
connection.onRequest("sessionFs.readFile", async (params) => {
|
|
1409
1769
|
const handler = getHandlers(params.sessionId).sessionFs;
|
|
@@ -1475,14 +1835,15 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
|
1475
1835
|
if (!handler) throw new Error(`No canvas handler registered for session: ${params.sessionId}`);
|
|
1476
1836
|
return handler.close(params);
|
|
1477
1837
|
});
|
|
1478
|
-
connection.onRequest("canvas.
|
|
1838
|
+
connection.onRequest("canvas.action.invoke", async (params) => {
|
|
1479
1839
|
const handler = getHandlers(params.sessionId).canvas;
|
|
1480
1840
|
if (!handler) throw new Error(`No canvas handler registered for session: ${params.sessionId}`);
|
|
1481
|
-
return handler.
|
|
1841
|
+
return handler.invoke(params);
|
|
1482
1842
|
});
|
|
1483
1843
|
}
|
|
1484
1844
|
export {
|
|
1485
1845
|
createInternalServerRpc,
|
|
1846
|
+
createInternalSessionRpc,
|
|
1486
1847
|
createServerRpc,
|
|
1487
1848
|
createSessionRpc,
|
|
1488
1849
|
registerClientSessionApiHandlers
|