@github/copilot-sdk 1.0.0 → 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 +1 -1
- package/dist/cjs/generated/rpc.js +348 -27
- package/dist/cjs/session.js +16 -2
- package/dist/generated/rpc.d.ts +3148 -808
- package/dist/generated/rpc.js +347 -27
- package/dist/generated/session-events.d.ts +86 -7
- package/dist/session.d.ts +4 -2
- package/dist/session.js +16 -2
- package/package.json +3 -3
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
|
/**
|
|
@@ -118,6 +208,28 @@ function createServerRpc(connection) {
|
|
|
118
208
|
*/
|
|
119
209
|
discover: async (params) => connection.sendRequest("skills.discover", params)
|
|
120
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
|
+
},
|
|
121
233
|
user: {
|
|
122
234
|
settings: {
|
|
123
235
|
/**
|
|
@@ -144,6 +256,14 @@ function createServerRpc(connection) {
|
|
|
144
256
|
},
|
|
145
257
|
/** @experimental */
|
|
146
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),
|
|
147
267
|
/**
|
|
148
268
|
* Creates a new session by forking persisted history from an existing session.
|
|
149
269
|
*
|
|
@@ -161,11 +281,11 @@ function createServerRpc(connection) {
|
|
|
161
281
|
*/
|
|
162
282
|
connect: async (params) => connection.sendRequest("sessions.connect", params),
|
|
163
283
|
/**
|
|
164
|
-
* 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.).
|
|
165
285
|
*
|
|
166
|
-
* @param params Optional metadata-load limit and
|
|
286
|
+
* @param params Optional source filter, metadata-load limit, and context filter applied to the returned sessions.
|
|
167
287
|
*
|
|
168
|
-
* @returns
|
|
288
|
+
* @returns Sessions matching the filter, ordered most-recently-modified first.
|
|
169
289
|
*/
|
|
170
290
|
list: async (params) => connection.sendRequest("sessions.list", params),
|
|
171
291
|
/**
|
|
@@ -192,14 +312,6 @@ function createServerRpc(connection) {
|
|
|
192
312
|
* @returns Most-relevant session ID for the supplied context, or omitted when no sessions exist.
|
|
193
313
|
*/
|
|
194
314
|
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
315
|
/**
|
|
204
316
|
* Returns the on-disk byte size of each session's workspace directory.
|
|
205
317
|
*
|
|
@@ -214,14 +326,6 @@ function createServerRpc(connection) {
|
|
|
214
326
|
* @returns Session IDs from the input set that are currently in use by another process.
|
|
215
327
|
*/
|
|
216
328
|
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
329
|
/**
|
|
226
330
|
* Closes a session: emits shutdown, flushes pending events, releases the in-use lock, and disposes the active session.
|
|
227
331
|
*
|
|
@@ -293,7 +397,45 @@ function createServerRpc(connection) {
|
|
|
293
397
|
*
|
|
294
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.
|
|
295
399
|
*/
|
|
296
|
-
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", {})
|
|
297
439
|
},
|
|
298
440
|
/** @experimental */
|
|
299
441
|
agentRegistry: {
|
|
@@ -311,13 +453,62 @@ function createServerRpc(connection) {
|
|
|
311
453
|
function createInternalServerRpc(connection) {
|
|
312
454
|
return {
|
|
313
455
|
/**
|
|
314
|
-
* 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.
|
|
315
457
|
*
|
|
316
458
|
* @param params Optional connection token presented by the SDK client during the handshake.
|
|
317
459
|
*
|
|
318
460
|
* @returns Handshake result reporting the server's protocol version and package version on success.
|
|
319
461
|
*/
|
|
320
|
-
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
|
+
}
|
|
321
512
|
};
|
|
322
513
|
}
|
|
323
514
|
function createSessionRpc(connection, sessionId) {
|
|
@@ -501,7 +692,13 @@ function createSessionRpc(connection, sessionId) {
|
|
|
501
692
|
/**
|
|
502
693
|
* Deletes the session plan file from the workspace.
|
|
503
694
|
*/
|
|
504
|
-
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 })
|
|
505
702
|
},
|
|
506
703
|
/** @experimental */
|
|
507
704
|
workspaces: {
|
|
@@ -736,11 +933,19 @@ function createSessionRpc(connection, sessionId) {
|
|
|
736
933
|
/** @experimental */
|
|
737
934
|
mcp: {
|
|
738
935
|
/**
|
|
739
|
-
* 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.
|
|
740
937
|
*
|
|
741
|
-
* @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.
|
|
742
939
|
*/
|
|
743
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 }),
|
|
744
949
|
/**
|
|
745
950
|
* Enables an MCP server for the session.
|
|
746
951
|
*
|
|
@@ -787,6 +992,20 @@ function createSessionRpc(connection, sessionId) {
|
|
|
787
992
|
* @returns Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove).
|
|
788
993
|
*/
|
|
789
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 }),
|
|
790
1009
|
/** @experimental */
|
|
791
1010
|
oauth: {
|
|
792
1011
|
/**
|
|
@@ -853,7 +1072,13 @@ function createSessionRpc(connection, sessionId) {
|
|
|
853
1072
|
*
|
|
854
1073
|
* @returns Plugins installed for the session, with their enabled state and version metadata.
|
|
855
1074
|
*/
|
|
856
|
-
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 })
|
|
857
1082
|
},
|
|
858
1083
|
/** @experimental */
|
|
859
1084
|
options: {
|
|
@@ -982,6 +1207,12 @@ function createSessionRpc(connection, sessionId) {
|
|
|
982
1207
|
},
|
|
983
1208
|
/** @experimental */
|
|
984
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 }),
|
|
985
1216
|
/**
|
|
986
1217
|
* Sets feature override key/value pairs to attach to subsequent telemetry events for the session.
|
|
987
1218
|
*
|
|
@@ -991,6 +1222,14 @@ function createSessionRpc(connection, sessionId) {
|
|
|
991
1222
|
},
|
|
992
1223
|
/** @experimental */
|
|
993
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 }),
|
|
994
1233
|
/**
|
|
995
1234
|
* Requests structured input from a UI-capable client.
|
|
996
1235
|
*
|
|
@@ -1253,6 +1492,12 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1253
1492
|
* @returns Indicates whether the local session is currently processing a turn or background continuation.
|
|
1254
1493
|
*/
|
|
1255
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 }),
|
|
1256
1501
|
/**
|
|
1257
1502
|
* Returns the token breakdown for the session's current context window for a given model.
|
|
1258
1503
|
*
|
|
@@ -1303,7 +1548,23 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1303
1548
|
*
|
|
1304
1549
|
* @returns Indicates whether the signal was delivered; false if the process was unknown or already exited.
|
|
1305
1550
|
*/
|
|
1306
|
-
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 })
|
|
1307
1568
|
},
|
|
1308
1569
|
/** @experimental */
|
|
1309
1570
|
history: {
|
|
@@ -1445,6 +1706,64 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1445
1706
|
}
|
|
1446
1707
|
};
|
|
1447
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
|
+
}
|
|
1448
1767
|
function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
1449
1768
|
connection.onRequest("sessionFs.readFile", async (params) => {
|
|
1450
1769
|
const handler = getHandlers(params.sessionId).sessionFs;
|
|
@@ -1524,6 +1843,7 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
|
1524
1843
|
}
|
|
1525
1844
|
export {
|
|
1526
1845
|
createInternalServerRpc,
|
|
1846
|
+
createInternalSessionRpc,
|
|
1527
1847
|
createServerRpc,
|
|
1528
1848
|
createSessionRpc,
|
|
1529
1849
|
registerClientSessionApiHandlers
|