@github/copilot-sdk 1.0.0 → 1.0.2-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -5
- package/dist/canvas.js +1 -0
- package/dist/cjs/canvas.js +1 -0
- package/dist/cjs/client.js +107 -11
- package/dist/cjs/generated/rpc.js +401 -29
- package/dist/cjs/session.js +19 -2
- package/dist/client.d.ts +4 -2
- package/dist/client.js +107 -11
- package/dist/generated/rpc.d.ts +3763 -805
- package/dist/generated/rpc.js +400 -29
- package/dist/generated/session-events.d.ts +399 -20
- package/dist/index.d.ts +1 -1
- package/dist/session.d.ts +4 -2
- package/dist/session.js +19 -2
- package/dist/types.d.ts +29 -2
- package/package.json +4 -4
package/dist/generated/rpc.js
CHANGED
|
@@ -100,6 +100,96 @@ function createServerRpc(connection) {
|
|
|
100
100
|
*/
|
|
101
101
|
discover: async (params) => connection.sendRequest("mcp.discover", params)
|
|
102
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
|
+
},
|
|
103
193
|
skills: {
|
|
104
194
|
config: {
|
|
105
195
|
/**
|
|
@@ -116,7 +206,55 @@ function createServerRpc(connection) {
|
|
|
116
206
|
*
|
|
117
207
|
* @returns Skills discovered across global and project sources.
|
|
118
208
|
*/
|
|
119
|
-
discover: async (params) => connection.sendRequest("skills.discover", params)
|
|
209
|
+
discover: async (params) => connection.sendRequest("skills.discover", params),
|
|
210
|
+
/**
|
|
211
|
+
* 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.
|
|
212
|
+
*
|
|
213
|
+
* @param params Optional project paths to enumerate.
|
|
214
|
+
*
|
|
215
|
+
* @returns Canonical locations where skills can be created so the runtime will recognize them.
|
|
216
|
+
*
|
|
217
|
+
* @experimental
|
|
218
|
+
*/
|
|
219
|
+
getDiscoveryPaths: async (params) => connection.sendRequest("skills.getDiscoveryPaths", params)
|
|
220
|
+
},
|
|
221
|
+
/** @experimental */
|
|
222
|
+
agents: {
|
|
223
|
+
/**
|
|
224
|
+
* Discovers custom agents across user, project, plugin, and remote sources.
|
|
225
|
+
*
|
|
226
|
+
* @param params Optional project paths to include in agent discovery.
|
|
227
|
+
*
|
|
228
|
+
* @returns Agents discovered across user, project, plugin, and remote sources.
|
|
229
|
+
*/
|
|
230
|
+
discover: async (params) => connection.sendRequest("agents.discover", params),
|
|
231
|
+
/**
|
|
232
|
+
* Returns the canonical directories where a client may create custom agents that the runtime will recognize, including ones that do not exist yet. Project directories become active once created.
|
|
233
|
+
*
|
|
234
|
+
* @param params Optional project paths to include when enumerating agent discovery directories.
|
|
235
|
+
*
|
|
236
|
+
* @returns Canonical locations where custom agents can be created so the runtime will recognize them.
|
|
237
|
+
*/
|
|
238
|
+
getDiscoveryPaths: async (params) => connection.sendRequest("agents.getDiscoveryPaths", params)
|
|
239
|
+
},
|
|
240
|
+
/** @experimental */
|
|
241
|
+
instructions: {
|
|
242
|
+
/**
|
|
243
|
+
* Discovers instruction sources across user, repository, and plugin sources.
|
|
244
|
+
*
|
|
245
|
+
* @param params Optional project paths to include in instruction discovery.
|
|
246
|
+
*
|
|
247
|
+
* @returns Instruction sources discovered across user, repository, and plugin sources.
|
|
248
|
+
*/
|
|
249
|
+
discover: async (params) => connection.sendRequest("instructions.discover", params),
|
|
250
|
+
/**
|
|
251
|
+
* Returns the canonical files and directories where a client may create custom instructions that the runtime will recognize, including ones that do not exist yet. Repository targets become active once created.
|
|
252
|
+
*
|
|
253
|
+
* @param params Optional project paths to include when enumerating instruction discovery targets.
|
|
254
|
+
*
|
|
255
|
+
* @returns Canonical files and directories where custom instructions can be created so the runtime will recognize them.
|
|
256
|
+
*/
|
|
257
|
+
getDiscoveryPaths: async (params) => connection.sendRequest("instructions.getDiscoveryPaths", params)
|
|
120
258
|
},
|
|
121
259
|
user: {
|
|
122
260
|
settings: {
|
|
@@ -144,6 +282,14 @@ function createServerRpc(connection) {
|
|
|
144
282
|
},
|
|
145
283
|
/** @experimental */
|
|
146
284
|
sessions: {
|
|
285
|
+
/**
|
|
286
|
+
* Creates or resumes a local session and returns the opened session ID.
|
|
287
|
+
*
|
|
288
|
+
* @param params Open a session by creating, resuming, attaching, connecting to a remote, or handing off.
|
|
289
|
+
*
|
|
290
|
+
* @returns Result of opening a session.
|
|
291
|
+
*/
|
|
292
|
+
open: async (params) => connection.sendRequest("sessions.open", params),
|
|
147
293
|
/**
|
|
148
294
|
* Creates a new session by forking persisted history from an existing session.
|
|
149
295
|
*
|
|
@@ -161,11 +307,11 @@ function createServerRpc(connection) {
|
|
|
161
307
|
*/
|
|
162
308
|
connect: async (params) => connection.sendRequest("sessions.connect", params),
|
|
163
309
|
/**
|
|
164
|
-
* Lists
|
|
310
|
+
* 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.).
|
|
165
311
|
*
|
|
166
|
-
* @param params Optional metadata-load limit and
|
|
312
|
+
* @param params Optional source filter, metadata-load limit, and context filter applied to the returned sessions.
|
|
167
313
|
*
|
|
168
|
-
* @returns
|
|
314
|
+
* @returns Sessions matching the filter, ordered most-recently-modified first.
|
|
169
315
|
*/
|
|
170
316
|
list: async (params) => connection.sendRequest("sessions.list", params),
|
|
171
317
|
/**
|
|
@@ -192,14 +338,6 @@ function createServerRpc(connection) {
|
|
|
192
338
|
* @returns Most-relevant session ID for the supplied context, or omitted when no sessions exist.
|
|
193
339
|
*/
|
|
194
340
|
getLastForContext: async (params) => connection.sendRequest("sessions.getLastForContext", params),
|
|
195
|
-
/**
|
|
196
|
-
* Computes the absolute path to a session's persisted events.jsonl file.
|
|
197
|
-
*
|
|
198
|
-
* @param params Session ID whose event-log file path to compute.
|
|
199
|
-
*
|
|
200
|
-
* @returns Absolute path to the session's events.jsonl file on disk.
|
|
201
|
-
*/
|
|
202
|
-
getEventFilePath: async (params) => connection.sendRequest("sessions.getEventFilePath", params),
|
|
203
341
|
/**
|
|
204
342
|
* Returns the on-disk byte size of each session's workspace directory.
|
|
205
343
|
*
|
|
@@ -214,14 +352,6 @@ function createServerRpc(connection) {
|
|
|
214
352
|
* @returns Session IDs from the input set that are currently in use by another process.
|
|
215
353
|
*/
|
|
216
354
|
checkInUse: async (params) => connection.sendRequest("sessions.checkInUse", params),
|
|
217
|
-
/**
|
|
218
|
-
* Returns a session's persisted remote-steerable flag, if any has been recorded.
|
|
219
|
-
*
|
|
220
|
-
* @param params Session ID to look up the persisted remote-steerable flag for.
|
|
221
|
-
*
|
|
222
|
-
* @returns The session's persisted remote-steerable flag, or omitted when no value has been persisted.
|
|
223
|
-
*/
|
|
224
|
-
getPersistedRemoteSteerable: async (params) => connection.sendRequest("sessions.getPersistedRemoteSteerable", params),
|
|
225
355
|
/**
|
|
226
356
|
* Closes a session: emits shutdown, flushes pending events, releases the in-use lock, and disposes the active session.
|
|
227
357
|
*
|
|
@@ -293,7 +423,45 @@ function createServerRpc(connection) {
|
|
|
293
423
|
*
|
|
294
424
|
* @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.
|
|
295
425
|
*/
|
|
296
|
-
setAdditionalPlugins: async (params) => connection.sendRequest("sessions.setAdditionalPlugins", params)
|
|
426
|
+
setAdditionalPlugins: async (params) => connection.sendRequest("sessions.setAdditionalPlugins", params),
|
|
427
|
+
/**
|
|
428
|
+
* 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.
|
|
429
|
+
*
|
|
430
|
+
* @param params Parameters for attaching the remote-control singleton to a session.
|
|
431
|
+
*
|
|
432
|
+
* @returns Wrapper for the singleton's current status.
|
|
433
|
+
*/
|
|
434
|
+
startRemoteControl: async (params) => connection.sendRequest("sessions.startRemoteControl", params),
|
|
435
|
+
/**
|
|
436
|
+
* 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.
|
|
437
|
+
*
|
|
438
|
+
* @param params Parameters for atomically rebinding the remote-control singleton.
|
|
439
|
+
*
|
|
440
|
+
* @returns Outcome of a transferRemoteControl call.
|
|
441
|
+
*/
|
|
442
|
+
transferRemoteControl: async (params) => connection.sendRequest("sessions.transferRemoteControl", params),
|
|
443
|
+
/**
|
|
444
|
+
* 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.
|
|
445
|
+
*
|
|
446
|
+
* @param params Patch for the singleton's steering state.
|
|
447
|
+
*
|
|
448
|
+
* @returns Wrapper for the singleton's current status.
|
|
449
|
+
*/
|
|
450
|
+
setRemoteControlSteering: async (params) => connection.sendRequest("sessions.setRemoteControlSteering", params),
|
|
451
|
+
/**
|
|
452
|
+
* 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).
|
|
453
|
+
*
|
|
454
|
+
* @param params Parameters for stopping the remote-control singleton.
|
|
455
|
+
*
|
|
456
|
+
* @returns Outcome of a stopRemoteControl call.
|
|
457
|
+
*/
|
|
458
|
+
stopRemoteControl: async (params) => connection.sendRequest("sessions.stopRemoteControl", params),
|
|
459
|
+
/**
|
|
460
|
+
* Returns the current state of the remote-control singleton, including the attached session id and frontend URL when active.
|
|
461
|
+
*
|
|
462
|
+
* @returns Wrapper for the singleton's current status.
|
|
463
|
+
*/
|
|
464
|
+
getRemoteControlStatus: async () => connection.sendRequest("sessions.getRemoteControlStatus", {})
|
|
297
465
|
},
|
|
298
466
|
/** @experimental */
|
|
299
467
|
agentRegistry: {
|
|
@@ -311,13 +479,62 @@ function createServerRpc(connection) {
|
|
|
311
479
|
function createInternalServerRpc(connection) {
|
|
312
480
|
return {
|
|
313
481
|
/**
|
|
314
|
-
* Performs the SDK server connection handshake and validates the optional connection token.
|
|
482
|
+
* 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.
|
|
315
483
|
*
|
|
316
484
|
* @param params Optional connection token presented by the SDK client during the handshake.
|
|
317
485
|
*
|
|
318
486
|
* @returns Handshake result reporting the server's protocol version and package version on success.
|
|
319
487
|
*/
|
|
320
|
-
connect: async (params) => connection.sendRequest("connect", params)
|
|
488
|
+
connect: async (params) => connection.sendRequest("connect", params),
|
|
489
|
+
/** @experimental */
|
|
490
|
+
sessions: {
|
|
491
|
+
/**
|
|
492
|
+
* 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.
|
|
493
|
+
*
|
|
494
|
+
* @param params Session ID whose event-log file path to compute.
|
|
495
|
+
*
|
|
496
|
+
* @returns Absolute path to the session's events.jsonl file on disk.
|
|
497
|
+
*/
|
|
498
|
+
getEventFilePath: async (params) => connection.sendRequest("sessions.getEventFilePath", params),
|
|
499
|
+
/**
|
|
500
|
+
* 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.
|
|
501
|
+
*
|
|
502
|
+
* @param params Session ID to look up the persisted remote-steerable flag for.
|
|
503
|
+
*
|
|
504
|
+
* @returns The session's persisted remote-steerable flag, or omitted when no value has been persisted.
|
|
505
|
+
*/
|
|
506
|
+
getPersistedRemoteSteerable: async (params) => connection.sendRequest("sessions.getPersistedRemoteSteerable", params),
|
|
507
|
+
/**
|
|
508
|
+
* 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.
|
|
509
|
+
*
|
|
510
|
+
* @param params Session ID whose board entry count should be returned.
|
|
511
|
+
*
|
|
512
|
+
* @returns Dynamic-context board entry count, when available.
|
|
513
|
+
*/
|
|
514
|
+
getBoardEntryCount: async (params) => connection.sendRequest("sessions.getBoardEntryCount", params),
|
|
515
|
+
/**
|
|
516
|
+
* 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.
|
|
517
|
+
*
|
|
518
|
+
* @param params Cursor and optional long-poll wait for polling runtime-spawned sessions.
|
|
519
|
+
*
|
|
520
|
+
* @returns Batch of spawn events plus a cursor for follow-up polls.
|
|
521
|
+
*/
|
|
522
|
+
pollSpawnedSessions: async (params) => connection.sendRequest("sessions.pollSpawnedSessions", params),
|
|
523
|
+
/**
|
|
524
|
+
* 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.
|
|
525
|
+
*
|
|
526
|
+
* @param params Params to attach an extension loader's tools to a session.
|
|
527
|
+
*
|
|
528
|
+
* @returns Handle for releasing the extension tool registration.
|
|
529
|
+
*/
|
|
530
|
+
registerExtensionToolsOnSession: async (params) => connection.sendRequest("sessions.registerExtensionToolsOnSession", params),
|
|
531
|
+
/**
|
|
532
|
+
* 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.
|
|
533
|
+
*
|
|
534
|
+
* @param params Params to attach or detach an in-process ExtensionController delegate.
|
|
535
|
+
*/
|
|
536
|
+
configureSessionExtensions: async (params) => connection.sendRequest("sessions.configureSessionExtensions", params)
|
|
537
|
+
}
|
|
321
538
|
};
|
|
322
539
|
}
|
|
323
540
|
function createSessionRpc(connection, sessionId) {
|
|
@@ -501,7 +718,19 @@ function createSessionRpc(connection, sessionId) {
|
|
|
501
718
|
/**
|
|
502
719
|
* Deletes the session plan file from the workspace.
|
|
503
720
|
*/
|
|
504
|
-
delete: async () => connection.sendRequest("session.plan.delete", { sessionId })
|
|
721
|
+
delete: async () => connection.sendRequest("session.plan.delete", { sessionId }),
|
|
722
|
+
/**
|
|
723
|
+
* Reads todo rows from the session SQL database for plan rendering.
|
|
724
|
+
*
|
|
725
|
+
* @returns Todo rows read from the session SQL database. Empty when no session database is available.
|
|
726
|
+
*/
|
|
727
|
+
readSqlTodos: async () => connection.sendRequest("session.plan.readSqlTodos", { sessionId }),
|
|
728
|
+
/**
|
|
729
|
+
* Reads todo rows AND dependency edges from the session SQL database for structured progress UI. Same defensive behavior as readSqlTodos — returns empty arrays when the database, tables, or columns aren't available. Clients should call this on session start and after every `session.todos_changed` event to refresh structured-UI rendering.
|
|
730
|
+
*
|
|
731
|
+
* @returns Todo rows + dependency edges read from the session SQL database.
|
|
732
|
+
*/
|
|
733
|
+
readSqlTodosWithDependencies: async () => connection.sendRequest("session.plan.readSqlTodosWithDependencies", { sessionId })
|
|
505
734
|
},
|
|
506
735
|
/** @experimental */
|
|
507
736
|
workspaces: {
|
|
@@ -736,11 +965,19 @@ function createSessionRpc(connection, sessionId) {
|
|
|
736
965
|
/** @experimental */
|
|
737
966
|
mcp: {
|
|
738
967
|
/**
|
|
739
|
-
* Lists MCP servers configured for the session
|
|
968
|
+
* 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.
|
|
740
969
|
*
|
|
741
|
-
* @returns MCP servers configured for the session, with their connection status.
|
|
970
|
+
* @returns MCP servers configured for the session, with their connection status and host-level state.
|
|
742
971
|
*/
|
|
743
972
|
list: async () => connection.sendRequest("session.mcp.list", { sessionId }),
|
|
973
|
+
/**
|
|
974
|
+
* Lists the tools exposed by a connected MCP server on this session's host.
|
|
975
|
+
*
|
|
976
|
+
* @param params Server name whose tool list should be returned.
|
|
977
|
+
*
|
|
978
|
+
* @returns Tools exposed by the connected MCP server. Throws when the server is not connected.
|
|
979
|
+
*/
|
|
980
|
+
listTools: async (params) => connection.sendRequest("session.mcp.listTools", { sessionId, ...params }),
|
|
744
981
|
/**
|
|
745
982
|
* Enables an MCP server for the session.
|
|
746
983
|
*
|
|
@@ -787,6 +1024,20 @@ function createSessionRpc(connection, sessionId) {
|
|
|
787
1024
|
* @returns Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove).
|
|
788
1025
|
*/
|
|
789
1026
|
removeGitHub: async () => connection.sendRequest("session.mcp.removeGitHub", { sessionId }),
|
|
1027
|
+
/**
|
|
1028
|
+
* Stops an individual MCP server on the session's host.
|
|
1029
|
+
*
|
|
1030
|
+
* @param params Server name for an individual MCP server stop.
|
|
1031
|
+
*/
|
|
1032
|
+
stopServer: async (params) => connection.sendRequest("session.mcp.stopServer", { sessionId, ...params }),
|
|
1033
|
+
/**
|
|
1034
|
+
* Checks whether a named MCP server is currently running on the session's host.
|
|
1035
|
+
*
|
|
1036
|
+
* @param params Server name to check running status for.
|
|
1037
|
+
*
|
|
1038
|
+
* @returns Whether the named MCP server is running.
|
|
1039
|
+
*/
|
|
1040
|
+
isServerRunning: async (params) => connection.sendRequest("session.mcp.isServerRunning", { sessionId, ...params }),
|
|
790
1041
|
/** @experimental */
|
|
791
1042
|
oauth: {
|
|
792
1043
|
/**
|
|
@@ -853,7 +1104,24 @@ function createSessionRpc(connection, sessionId) {
|
|
|
853
1104
|
*
|
|
854
1105
|
* @returns Plugins installed for the session, with their enabled state and version metadata.
|
|
855
1106
|
*/
|
|
856
|
-
list: async () => connection.sendRequest("session.plugins.list", { sessionId })
|
|
1107
|
+
list: async () => connection.sendRequest("session.plugins.list", { sessionId }),
|
|
1108
|
+
/**
|
|
1109
|
+
* 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.
|
|
1110
|
+
*
|
|
1111
|
+
* @param params Optional flags controlling which side effects the reload performs.
|
|
1112
|
+
*/
|
|
1113
|
+
reload: async (params) => connection.sendRequest("session.plugins.reload", { sessionId, ...params })
|
|
1114
|
+
},
|
|
1115
|
+
/** @experimental */
|
|
1116
|
+
provider: {
|
|
1117
|
+
/**
|
|
1118
|
+
* Returns the provider endpoint and credentials the session is currently configured to talk to, so the caller can make inference calls directly against the same backend the session uses.
|
|
1119
|
+
*
|
|
1120
|
+
* @param params Optional model identifier to scope the endpoint snapshot to.
|
|
1121
|
+
*
|
|
1122
|
+
* @returns A snapshot of the provider endpoint the session is currently configured to talk to.
|
|
1123
|
+
*/
|
|
1124
|
+
getEndpoint: async (params) => connection.sendRequest("session.provider.getEndpoint", { sessionId, ...params })
|
|
857
1125
|
},
|
|
858
1126
|
/** @experimental */
|
|
859
1127
|
options: {
|
|
@@ -927,7 +1195,15 @@ function createSessionRpc(connection, sessionId) {
|
|
|
927
1195
|
*
|
|
928
1196
|
* @returns Current lightweight tool metadata snapshot for the session.
|
|
929
1197
|
*/
|
|
930
|
-
getCurrentMetadata: async () => connection.sendRequest("session.tools.getCurrentMetadata", { sessionId })
|
|
1198
|
+
getCurrentMetadata: async () => connection.sendRequest("session.tools.getCurrentMetadata", { sessionId }),
|
|
1199
|
+
/**
|
|
1200
|
+
* Updates the current session's live subagent settings after user settings change. The persisted user settings remain the source of truth for future sessions.
|
|
1201
|
+
*
|
|
1202
|
+
* @param params Subagent settings to apply to the current session
|
|
1203
|
+
*
|
|
1204
|
+
* @returns Empty result after applying subagent settings
|
|
1205
|
+
*/
|
|
1206
|
+
updateSubagentSettings: async (params) => connection.sendRequest("session.tools.updateSubagentSettings", { sessionId, ...params })
|
|
931
1207
|
},
|
|
932
1208
|
/** @experimental */
|
|
933
1209
|
commands: {
|
|
@@ -982,6 +1258,12 @@ function createSessionRpc(connection, sessionId) {
|
|
|
982
1258
|
},
|
|
983
1259
|
/** @experimental */
|
|
984
1260
|
telemetry: {
|
|
1261
|
+
/**
|
|
1262
|
+
* Gets the telemetry engagement ID currently associated with the session, when available.
|
|
1263
|
+
*
|
|
1264
|
+
* @returns Telemetry engagement ID for the session, when available.
|
|
1265
|
+
*/
|
|
1266
|
+
getEngagementId: async () => connection.sendRequest("session.telemetry.getEngagementId", { sessionId }),
|
|
985
1267
|
/**
|
|
986
1268
|
* Sets feature override key/value pairs to attach to subsequent telemetry events for the session.
|
|
987
1269
|
*
|
|
@@ -991,6 +1273,14 @@ function createSessionRpc(connection, sessionId) {
|
|
|
991
1273
|
},
|
|
992
1274
|
/** @experimental */
|
|
993
1275
|
ui: {
|
|
1276
|
+
/**
|
|
1277
|
+
* Runs a transient no-tools model query against the current conversation context.
|
|
1278
|
+
*
|
|
1279
|
+
* @param params Transient question to answer without adding it to conversation history.
|
|
1280
|
+
*
|
|
1281
|
+
* @returns Transient answer generated from current conversation context.
|
|
1282
|
+
*/
|
|
1283
|
+
ephemeralQuery: async (params) => connection.sendRequest("session.ui.ephemeralQuery", { sessionId, ...params }),
|
|
994
1284
|
/**
|
|
995
1285
|
* Requests structured input from a UI-capable client.
|
|
996
1286
|
*
|
|
@@ -1253,6 +1543,12 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1253
1543
|
* @returns Indicates whether the local session is currently processing a turn or background continuation.
|
|
1254
1544
|
*/
|
|
1255
1545
|
isProcessing: async () => connection.sendRequest("session.metadata.isProcessing", { sessionId }),
|
|
1546
|
+
/**
|
|
1547
|
+
* Returns a snapshot of activity flags for the session.
|
|
1548
|
+
*
|
|
1549
|
+
* @returns Current activity flags for the session.
|
|
1550
|
+
*/
|
|
1551
|
+
activity: async () => connection.sendRequest("session.metadata.activity", { sessionId }),
|
|
1256
1552
|
/**
|
|
1257
1553
|
* Returns the token breakdown for the session's current context window for a given model.
|
|
1258
1554
|
*
|
|
@@ -1303,7 +1599,23 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1303
1599
|
*
|
|
1304
1600
|
* @returns Indicates whether the signal was delivered; false if the process was unknown or already exited.
|
|
1305
1601
|
*/
|
|
1306
|
-
kill: async (params) => connection.sendRequest("session.shell.kill", { sessionId, ...params })
|
|
1602
|
+
kill: async (params) => connection.sendRequest("session.shell.kill", { sessionId, ...params }),
|
|
1603
|
+
/**
|
|
1604
|
+
* Executes a user-requested shell command through the session runtime.
|
|
1605
|
+
*
|
|
1606
|
+
* @param params User-requested shell command and cancellation handle.
|
|
1607
|
+
*
|
|
1608
|
+
* @returns Result of a user-requested shell command.
|
|
1609
|
+
*/
|
|
1610
|
+
executeUserRequested: async (params) => connection.sendRequest("session.shell.executeUserRequested", { sessionId, ...params }),
|
|
1611
|
+
/**
|
|
1612
|
+
* Cancels a user-requested shell command by request ID.
|
|
1613
|
+
*
|
|
1614
|
+
* @param params User-requested shell execution cancellation handle.
|
|
1615
|
+
*
|
|
1616
|
+
* @returns Cancellation result for a user-requested shell command.
|
|
1617
|
+
*/
|
|
1618
|
+
cancelUserRequested: async (params) => connection.sendRequest("session.shell.cancelUserRequested", { sessionId, ...params })
|
|
1307
1619
|
},
|
|
1308
1620
|
/** @experimental */
|
|
1309
1621
|
history: {
|
|
@@ -1445,6 +1757,64 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1445
1757
|
}
|
|
1446
1758
|
};
|
|
1447
1759
|
}
|
|
1760
|
+
function createInternalSessionRpc(connection, sessionId) {
|
|
1761
|
+
return {
|
|
1762
|
+
/** @experimental */
|
|
1763
|
+
mcp: {
|
|
1764
|
+
/**
|
|
1765
|
+
* Reloads MCP server connections for the session with an explicit host-provided configuration.
|
|
1766
|
+
*
|
|
1767
|
+
* @param params Opaque MCP reload configuration.
|
|
1768
|
+
*
|
|
1769
|
+
* @returns MCP server startup filtering result.
|
|
1770
|
+
*/
|
|
1771
|
+
reloadWithConfig: async (params) => connection.sendRequest("session.mcp.reloadWithConfig", { sessionId, ...params }),
|
|
1772
|
+
/**
|
|
1773
|
+
* Configures the built-in GitHub MCP server for the session's current auth context.
|
|
1774
|
+
*
|
|
1775
|
+
* @param params Opaque auth info used to configure GitHub MCP.
|
|
1776
|
+
*
|
|
1777
|
+
* @returns Result of configuring GitHub MCP.
|
|
1778
|
+
*/
|
|
1779
|
+
configureGitHub: async (params) => connection.sendRequest("session.mcp.configureGitHub", { sessionId, ...params }),
|
|
1780
|
+
/**
|
|
1781
|
+
* Starts an individual MCP server on the session's host.
|
|
1782
|
+
*
|
|
1783
|
+
* @param params Server name and opaque configuration for an individual MCP server start.
|
|
1784
|
+
*/
|
|
1785
|
+
startServer: async (params) => connection.sendRequest("session.mcp.startServer", { sessionId, ...params }),
|
|
1786
|
+
/**
|
|
1787
|
+
* Restarts an individual MCP server on the session's host (stops then starts).
|
|
1788
|
+
*
|
|
1789
|
+
* @param params Server name and opaque configuration for an individual MCP server restart.
|
|
1790
|
+
*/
|
|
1791
|
+
restartServer: async (params) => connection.sendRequest("session.mcp.restartServer", { sessionId, ...params }),
|
|
1792
|
+
/**
|
|
1793
|
+
* 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.
|
|
1794
|
+
*
|
|
1795
|
+
* @param params Registration parameters for an external MCP client.
|
|
1796
|
+
*/
|
|
1797
|
+
registerExternalClient: async (params) => connection.sendRequest("session.mcp.registerExternalClient", { sessionId, ...params }),
|
|
1798
|
+
/**
|
|
1799
|
+
* 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.
|
|
1800
|
+
*
|
|
1801
|
+
* @param params Server name identifying the external client to remove.
|
|
1802
|
+
*/
|
|
1803
|
+
unregisterExternalClient: async (params) => connection.sendRequest("session.mcp.unregisterExternalClient", { sessionId, ...params }),
|
|
1804
|
+
/** @experimental */
|
|
1805
|
+
oauth: {
|
|
1806
|
+
/**
|
|
1807
|
+
* 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.
|
|
1808
|
+
*
|
|
1809
|
+
* @param params MCP OAuth request id and optional provider response.
|
|
1810
|
+
*
|
|
1811
|
+
* @returns Empty result after recording the MCP OAuth response.
|
|
1812
|
+
*/
|
|
1813
|
+
respond: async (params) => connection.sendRequest("session.mcp.oauth.respond", { sessionId, ...params })
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1448
1818
|
function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
1449
1819
|
connection.onRequest("sessionFs.readFile", async (params) => {
|
|
1450
1820
|
const handler = getHandlers(params.sessionId).sessionFs;
|
|
@@ -1524,6 +1894,7 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
|
1524
1894
|
}
|
|
1525
1895
|
export {
|
|
1526
1896
|
createInternalServerRpc,
|
|
1897
|
+
createInternalSessionRpc,
|
|
1527
1898
|
createServerRpc,
|
|
1528
1899
|
createSessionRpc,
|
|
1529
1900
|
registerClientSessionApiHandlers
|