@github/copilot-language-server 1.528.0 → 1.530.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/dist/main.js +880 -880
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/client.js +276 -53
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/copilotRequestHandler.js +9 -0
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/extension.js +21 -6
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/factory.js +123 -0
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/ffiRuntimeHost.js +285 -0
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/generated/rpc.js +587 -46
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/index.js +11 -2
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/session.js +643 -14
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/sessionFsProvider.js +43 -0
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/types.js +30 -3
- package/dist/node_modules/@github/copilot-sdk/package.json +3 -2
- package/dist/node_modules/vscode-jsonrpc/lib/common/connection.js +5 -3
- package/dist/node_modules/vscode-jsonrpc/package.json +1 -1
- package/package.json +14 -14
|
@@ -47,7 +47,13 @@ function createServerRpc(connection) {
|
|
|
47
47
|
*
|
|
48
48
|
* @returns List of Copilot models available to the resolved user, including capabilities and billing metadata.
|
|
49
49
|
*/
|
|
50
|
-
list: async (params) => connection.sendRequest("models.list", params)
|
|
50
|
+
list: async (params) => connection.sendRequest("models.list", params),
|
|
51
|
+
/**
|
|
52
|
+
* Returns the running runtime's complete catalog of well-known built-in model IDs without authentication or network access.
|
|
53
|
+
*
|
|
54
|
+
* @returns The running runtime's complete catalog of well-known built-in model IDs, including supported models and additional IDs with built-in metadata.
|
|
55
|
+
*/
|
|
56
|
+
getBuiltInCatalog: async () => connection.sendRequest("models.getBuiltInCatalog", {})
|
|
51
57
|
},
|
|
52
58
|
/** @experimental */
|
|
53
59
|
tools: {
|
|
@@ -165,6 +171,27 @@ function createServerRpc(connection) {
|
|
|
165
171
|
discover: async (params) => connection.sendRequest("mcp.discover", params)
|
|
166
172
|
},
|
|
167
173
|
/** @experimental */
|
|
174
|
+
extensions: {
|
|
175
|
+
/**
|
|
176
|
+
* Discovers user and enabled installed-plugin extensions from persisted Copilot home state, including enablement preferences. Launch-scoped additional plugins are not included.
|
|
177
|
+
*
|
|
178
|
+
* @returns Extensions discovered from persisted Copilot home state and their effective loading mode. Launch-scoped additional plugins are not included.
|
|
179
|
+
*/
|
|
180
|
+
discover: async () => connection.sendRequest("extensions.discover", {}),
|
|
181
|
+
/**
|
|
182
|
+
* Persistently enables extension IDs for future sessions. Active sessions are unchanged; use session.extensions.enable to update them.
|
|
183
|
+
*
|
|
184
|
+
* @param params Source-qualified extension identifiers to persistently enable for future sessions.
|
|
185
|
+
*/
|
|
186
|
+
enable: async (params) => connection.sendRequest("extensions.enable", params),
|
|
187
|
+
/**
|
|
188
|
+
* Persistently disables extension IDs for future sessions. Active sessions are unchanged; use session.extensions.disable to update them.
|
|
189
|
+
*
|
|
190
|
+
* @param params Source-qualified extension identifiers to persistently disable for future sessions.
|
|
191
|
+
*/
|
|
192
|
+
disable: async (params) => connection.sendRequest("extensions.disable", params)
|
|
193
|
+
},
|
|
194
|
+
/** @experimental */
|
|
168
195
|
plugins: {
|
|
169
196
|
/**
|
|
170
197
|
* Lists plugins installed in user/global state.
|
|
@@ -223,7 +250,7 @@ function createServerRpc(connection) {
|
|
|
223
250
|
/**
|
|
224
251
|
* Registers a new marketplace from a source (owner/repo, URL, or local path).
|
|
225
252
|
*
|
|
226
|
-
* @param params Marketplace source
|
|
253
|
+
* @param params Marketplace source and optional working directory for relative-path resolution.
|
|
227
254
|
*
|
|
228
255
|
* @returns Result of registering a new marketplace.
|
|
229
256
|
*/
|
|
@@ -321,6 +348,15 @@ function createServerRpc(connection) {
|
|
|
321
348
|
getDiscoveryPaths: async (params) => connection.sendRequest("instructions.getDiscoveryPaths", params)
|
|
322
349
|
},
|
|
323
350
|
/** @experimental */
|
|
351
|
+
commands: {
|
|
352
|
+
/**
|
|
353
|
+
* Lists the well-known built-in slash commands that work as the first message in a new session (e.g. /plan, /env), without requiring an active session. Commands that depend on session state, authentication, or a synced session are omitted.
|
|
354
|
+
*
|
|
355
|
+
* @returns Slash commands available in the session, after applying any include/exclude filters.
|
|
356
|
+
*/
|
|
357
|
+
list: async () => connection.sendRequest("commands.list", {})
|
|
358
|
+
},
|
|
359
|
+
/** @experimental */
|
|
324
360
|
user: {
|
|
325
361
|
/** @experimental */
|
|
326
362
|
settings: {
|
|
@@ -588,7 +624,7 @@ function createInternalServerRpc(connection) {
|
|
|
588
624
|
/**
|
|
589
625
|
* 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.
|
|
590
626
|
*
|
|
591
|
-
* @param params
|
|
627
|
+
* @param params Parameters for the `server.connect` handshake: an optional connection token and optional connection-level opt-ins (e.g. GitHub telemetry forwarding).
|
|
592
628
|
*
|
|
593
629
|
* @returns Handshake result reporting the server's protocol version and package version on success.
|
|
594
630
|
*
|
|
@@ -597,6 +633,22 @@ function createInternalServerRpc(connection) {
|
|
|
597
633
|
connect: async (params) => connection.sendRequest("connect", params),
|
|
598
634
|
/** @experimental */
|
|
599
635
|
sessions: {
|
|
636
|
+
/**
|
|
637
|
+
* Reads lightweight persisted metadata for one local session without opening it.
|
|
638
|
+
*
|
|
639
|
+
* @param params Session ID whose persisted metadata should be read.
|
|
640
|
+
*
|
|
641
|
+
* @returns Persisted local session metadata when the session exists.
|
|
642
|
+
*/
|
|
643
|
+
getMetadata: async (params) => connection.sendRequest("sessions.getMetadata", params),
|
|
644
|
+
/**
|
|
645
|
+
* Lists recent local session IDs that contain user-visible history, omitting housekeeping-only sessions.
|
|
646
|
+
*
|
|
647
|
+
* @param params Limit for non-empty local session IDs.
|
|
648
|
+
*
|
|
649
|
+
* @returns Recent local session IDs that contain user-visible history.
|
|
650
|
+
*/
|
|
651
|
+
listNonEmptySessionIds: async (params) => connection.sendRequest("sessions.listNonEmptySessionIds", params),
|
|
600
652
|
/**
|
|
601
653
|
* 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.
|
|
602
654
|
*
|
|
@@ -613,6 +665,12 @@ function createInternalServerRpc(connection) {
|
|
|
613
665
|
* @returns The session's persisted remote-steerable flag, or omitted when no value has been persisted.
|
|
614
666
|
*/
|
|
615
667
|
getPersistedRemoteSteerable: async (params) => connection.sendRequest("sessions.getPersistedRemoteSteerable", params),
|
|
668
|
+
/**
|
|
669
|
+
* Deletes one local session from disk after running the same lifecycle hooks as the session manager.
|
|
670
|
+
*
|
|
671
|
+
* @param params Session ID to delete from disk.
|
|
672
|
+
*/
|
|
673
|
+
delete: async (params) => connection.sendRequest("sessions.delete", params),
|
|
616
674
|
/**
|
|
617
675
|
* 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.
|
|
618
676
|
*
|
|
@@ -656,6 +714,16 @@ function createSessionRpc(connection, sessionId) {
|
|
|
656
714
|
* @experimental
|
|
657
715
|
*/
|
|
658
716
|
send: async (params) => connection.sendRequest("session.send", { sessionId, ...params }),
|
|
717
|
+
/**
|
|
718
|
+
* Sends zero or more user messages to the session in a single turn and returns their message IDs. All provided messages are appended to the conversation in order, then exactly one agent turn runs over the resulting history. When the list is empty, one turn runs over the existing history with no new user message. Remote-backed (Mission Control) sessions do not support this method and will return an error.
|
|
719
|
+
*
|
|
720
|
+
* @param params Parameters for sending zero or more user messages to the session in a single turn. Remote-backed (Mission Control) sessions do not support this method and will return an error.
|
|
721
|
+
*
|
|
722
|
+
* @returns Result of sending zero or more user messages
|
|
723
|
+
*
|
|
724
|
+
* @experimental
|
|
725
|
+
*/
|
|
726
|
+
sendMessages: async (params) => connection.sendRequest("session.sendMessages", { sessionId, ...params }),
|
|
659
727
|
/**
|
|
660
728
|
* Aborts the current agent turn.
|
|
661
729
|
*
|
|
@@ -666,6 +734,24 @@ function createSessionRpc(connection, sessionId) {
|
|
|
666
734
|
* @experimental
|
|
667
735
|
*/
|
|
668
736
|
abort: async (params) => connection.sendRequest("session.abort", { sessionId, ...params }),
|
|
737
|
+
/**
|
|
738
|
+
* Interrupts the current main agent turn while leaving running background work (subagents, sidekicks, and promoted attached shells) alive. No-op when the main loop is not processing.
|
|
739
|
+
*
|
|
740
|
+
* @param params Parameters for interrupting the main agent turn.
|
|
741
|
+
*
|
|
742
|
+
* @returns Result of interrupting the main agent turn.
|
|
743
|
+
*
|
|
744
|
+
* @experimental
|
|
745
|
+
*/
|
|
746
|
+
interruptMainTurn: async (params) => connection.sendRequest("session.interruptMainTurn", { sessionId, ...params }),
|
|
747
|
+
/**
|
|
748
|
+
* Cancels every running background agent (task-registry subagents plus sidekick agents) without interrupting the main agent loop. Promoted attached shells are left running.
|
|
749
|
+
*
|
|
750
|
+
* @returns The number of running background agents (task-registry agents) that were cancelled.
|
|
751
|
+
*
|
|
752
|
+
* @experimental
|
|
753
|
+
*/
|
|
754
|
+
cancelAllBackgroundAgents: async () => connection.sendRequest("session.cancelAllBackgroundAgents", { sessionId }),
|
|
669
755
|
/**
|
|
670
756
|
* Shuts down the session and persists its final state. Awaits any deferred sessionEnd hooks before resolving so user-supplied hook scripts complete before the runtime tears down.
|
|
671
757
|
*
|
|
@@ -692,6 +778,17 @@ function createSessionRpc(connection, sessionId) {
|
|
|
692
778
|
setCredentials: async (params) => connection.sendRequest("session.gitHubAuth.setCredentials", { sessionId, ...params })
|
|
693
779
|
},
|
|
694
780
|
/** @experimental */
|
|
781
|
+
debug: {
|
|
782
|
+
/**
|
|
783
|
+
* Collects a redacted session debug log bundle into a local archive or staging directory. The runtime includes session-owned logs by default and accepts caller-provided diagnostic entries so host applications can add their own files without changing this API shape.
|
|
784
|
+
*
|
|
785
|
+
* @param params Options for collecting a redacted session debug bundle.
|
|
786
|
+
*
|
|
787
|
+
* @returns Result of collecting a redacted debug bundle.
|
|
788
|
+
*/
|
|
789
|
+
collectLogs: async (params) => connection.sendRequest("session.debug.collectLogs", { sessionId, ...params })
|
|
790
|
+
},
|
|
791
|
+
/** @experimental */
|
|
695
792
|
canvas: {
|
|
696
793
|
/**
|
|
697
794
|
* Lists canvases declared for the session.
|
|
@@ -732,6 +829,98 @@ function createSessionRpc(connection, sessionId) {
|
|
|
732
829
|
}
|
|
733
830
|
},
|
|
734
831
|
/** @experimental */
|
|
832
|
+
factory: {
|
|
833
|
+
/**
|
|
834
|
+
* Runs a registered factory by name at the top level.
|
|
835
|
+
*
|
|
836
|
+
* @param params Parameters for invoking a registered factory.
|
|
837
|
+
*
|
|
838
|
+
* @returns Complete current or terminal factory run envelope.
|
|
839
|
+
*/
|
|
840
|
+
run: async (params) => connection.sendRequest("session.factory.run", { sessionId, ...params }),
|
|
841
|
+
/**
|
|
842
|
+
* Resumes a factory run using its persisted name, arguments, journal, and accounting.
|
|
843
|
+
*
|
|
844
|
+
* @param params Parameters for resuming a factory run from its persisted identity.
|
|
845
|
+
*
|
|
846
|
+
* @returns Resolved persisted factory identity and resumed run envelope.
|
|
847
|
+
*/
|
|
848
|
+
resume: async (params) => connection.sendRequest("session.factory.resume", { sessionId, ...params }),
|
|
849
|
+
/**
|
|
850
|
+
* Gets the current or settled envelope for a factory run.
|
|
851
|
+
*
|
|
852
|
+
* @param params Parameters for retrieving a factory run.
|
|
853
|
+
*
|
|
854
|
+
* @returns Complete current or terminal factory run envelope.
|
|
855
|
+
*/
|
|
856
|
+
getRun: async (params) => connection.sendRequest("session.factory.getRun", { sessionId, ...params }),
|
|
857
|
+
/**
|
|
858
|
+
* Lists durable factory runs for this session in creation order.
|
|
859
|
+
*
|
|
860
|
+
* @returns Factory runs in durable creation order.
|
|
861
|
+
*/
|
|
862
|
+
listRuns: async () => connection.sendRequest("session.factory.listRuns", { sessionId }),
|
|
863
|
+
/**
|
|
864
|
+
* Gets durable and live observability detail for one factory run.
|
|
865
|
+
*
|
|
866
|
+
* @param params Parameters for retrieving a factory run.
|
|
867
|
+
*
|
|
868
|
+
* @returns Full factory run observability detail.
|
|
869
|
+
*/
|
|
870
|
+
getRunDetail: async (params) => connection.sendRequest("session.factory.getRunDetail", { sessionId, ...params }),
|
|
871
|
+
/**
|
|
872
|
+
* Pages durable progress for one factory run.
|
|
873
|
+
*
|
|
874
|
+
* @param params Parameters for paging factory progress.
|
|
875
|
+
*
|
|
876
|
+
* @returns A bidirectional page of factory progress.
|
|
877
|
+
*/
|
|
878
|
+
getRunProgress: async (params) => connection.sendRequest("session.factory.getRunProgress", { sessionId, ...params }),
|
|
879
|
+
/**
|
|
880
|
+
* Requests cancellation of a factory run and returns its run envelope.
|
|
881
|
+
*
|
|
882
|
+
* @param params Parameters for cancelling a factory run.
|
|
883
|
+
*
|
|
884
|
+
* @returns Complete current or terminal factory run envelope.
|
|
885
|
+
*/
|
|
886
|
+
cancel: async (params) => connection.sendRequest("session.factory.cancel", { sessionId, ...params }),
|
|
887
|
+
/**
|
|
888
|
+
* Records a batch of ordered factory progress lines.
|
|
889
|
+
*
|
|
890
|
+
* @param params Parameters for recording factory progress.
|
|
891
|
+
*
|
|
892
|
+
* @returns Acknowledgement that a factory request was accepted.
|
|
893
|
+
*/
|
|
894
|
+
log: async (params) => connection.sendRequest("session.factory.log", { sessionId, ...params }),
|
|
895
|
+
/**
|
|
896
|
+
* Runs one factory-scoped subagent and returns its result.
|
|
897
|
+
*
|
|
898
|
+
* @param params Parameters for one factory-scoped subagent call.
|
|
899
|
+
*
|
|
900
|
+
* @returns Result of one factory-scoped subagent call.
|
|
901
|
+
*/
|
|
902
|
+
agent: async (params) => connection.sendRequest("session.factory.agent", { sessionId, ...params }),
|
|
903
|
+
/** @experimental */
|
|
904
|
+
journal: {
|
|
905
|
+
/**
|
|
906
|
+
* Reads a memoized factory journal entry.
|
|
907
|
+
*
|
|
908
|
+
* @param params Parameters for reading a factory journal entry.
|
|
909
|
+
*
|
|
910
|
+
* @returns Result of reading a factory journal entry.
|
|
911
|
+
*/
|
|
912
|
+
get: async (params) => connection.sendRequest("session.factory.journal.get", { sessionId, ...params }),
|
|
913
|
+
/**
|
|
914
|
+
* Stores a memoized factory journal entry.
|
|
915
|
+
*
|
|
916
|
+
* @param params Parameters for storing a factory journal entry.
|
|
917
|
+
*
|
|
918
|
+
* @returns Acknowledgement that a factory request was accepted.
|
|
919
|
+
*/
|
|
920
|
+
put: async (params) => connection.sendRequest("session.factory.journal.put", { sessionId, ...params })
|
|
921
|
+
}
|
|
922
|
+
},
|
|
923
|
+
/** @experimental */
|
|
735
924
|
model: {
|
|
736
925
|
/**
|
|
737
926
|
* Gets the currently selected model for the session.
|
|
@@ -841,6 +1030,22 @@ function createSessionRpc(connection, sessionId) {
|
|
|
841
1030
|
* @returns Current workspace metadata for the session, including its absolute filesystem path when available.
|
|
842
1031
|
*/
|
|
843
1032
|
getWorkspace: async () => connection.sendRequest("session.workspaces.getWorkspace", { sessionId }),
|
|
1033
|
+
/**
|
|
1034
|
+
* Updates workspace metadata for a local session and returns the refreshed workspace.
|
|
1035
|
+
*
|
|
1036
|
+
* @param params Workspace metadata fields to update.
|
|
1037
|
+
*
|
|
1038
|
+
* @returns Current workspace metadata for the session, including its absolute filesystem path when available.
|
|
1039
|
+
*/
|
|
1040
|
+
updateMetadata: async (params) => connection.sendRequest("session.workspaces.updateMetadata", { sessionId, ...params }),
|
|
1041
|
+
/**
|
|
1042
|
+
* Ensures a local session workspace exists and returns it.
|
|
1043
|
+
*
|
|
1044
|
+
* @param params Optional session context used when creating a local workspace.
|
|
1045
|
+
*
|
|
1046
|
+
* @returns Current workspace metadata for the session, including its absolute filesystem path when available.
|
|
1047
|
+
*/
|
|
1048
|
+
ensure: async (params) => connection.sendRequest("session.workspaces.ensure", { sessionId, ...params }),
|
|
844
1049
|
/**
|
|
845
1050
|
* Lists files stored in the session workspace files directory.
|
|
846
1051
|
*
|
|
@@ -875,6 +1080,48 @@ function createSessionRpc(connection, sessionId) {
|
|
|
875
1080
|
* @returns Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing.
|
|
876
1081
|
*/
|
|
877
1082
|
readCheckpoint: async (params) => connection.sendRequest("session.workspaces.readCheckpoint", { sessionId, ...params }),
|
|
1083
|
+
/**
|
|
1084
|
+
* Adds a compaction summary checkpoint to the local session workspace.
|
|
1085
|
+
*
|
|
1086
|
+
* @param params Compaction summary checkpoint to persist.
|
|
1087
|
+
*
|
|
1088
|
+
* @returns Persisted summary metadata and refreshed workspace metadata.
|
|
1089
|
+
*/
|
|
1090
|
+
addSummary: async (params) => connection.sendRequest("session.workspaces.addSummary", { sessionId, ...params }),
|
|
1091
|
+
/**
|
|
1092
|
+
* Truncates local workspace compaction summaries after a rollback.
|
|
1093
|
+
*
|
|
1094
|
+
* @param params Rollback point for local workspace summaries.
|
|
1095
|
+
*
|
|
1096
|
+
* @returns Current workspace metadata for the session, including its absolute filesystem path when available.
|
|
1097
|
+
*/
|
|
1098
|
+
truncateSummaries: async (params) => connection.sendRequest("session.workspaces.truncateSummaries", { sessionId, ...params }),
|
|
1099
|
+
/**
|
|
1100
|
+
* Reads the autopilot objective state file from the local session workspace.
|
|
1101
|
+
*
|
|
1102
|
+
* @returns Autopilot objective file content, or null when missing.
|
|
1103
|
+
*/
|
|
1104
|
+
readAutopilotObjective: async () => connection.sendRequest("session.workspaces.readAutopilotObjective", { sessionId }),
|
|
1105
|
+
/**
|
|
1106
|
+
* Writes the autopilot objective state file in the local session workspace.
|
|
1107
|
+
*
|
|
1108
|
+
* @param params Autopilot objective file content to persist.
|
|
1109
|
+
*
|
|
1110
|
+
* @returns Result of writing the autopilot objective file.
|
|
1111
|
+
*/
|
|
1112
|
+
writeAutopilotObjective: async (params) => connection.sendRequest("session.workspaces.writeAutopilotObjective", { sessionId, ...params }),
|
|
1113
|
+
/**
|
|
1114
|
+
* Deletes the autopilot objective state file from the local session workspace.
|
|
1115
|
+
*
|
|
1116
|
+
* @returns Result of deleting the autopilot objective file.
|
|
1117
|
+
*/
|
|
1118
|
+
deleteAutopilotObjective: async () => connection.sendRequest("session.workspaces.deleteAutopilotObjective", { sessionId }),
|
|
1119
|
+
/**
|
|
1120
|
+
* Checks whether the local session workspace has an autopilot objective state file.
|
|
1121
|
+
*
|
|
1122
|
+
* @returns Whether the autopilot objective file exists.
|
|
1123
|
+
*/
|
|
1124
|
+
autopilotObjectiveExists: async () => connection.sendRequest("session.workspaces.autopilotObjectiveExists", { sessionId }),
|
|
878
1125
|
/**
|
|
879
1126
|
* Saves pasted content as a UTF-8 file in the session workspace.
|
|
880
1127
|
*
|
|
@@ -884,7 +1131,7 @@ function createSessionRpc(connection, sessionId) {
|
|
|
884
1131
|
*/
|
|
885
1132
|
saveLargePaste: async (params) => connection.sendRequest("session.workspaces.saveLargePaste", { sessionId, ...params }),
|
|
886
1133
|
/**
|
|
887
|
-
* Computes a diff for the session workspace.
|
|
1134
|
+
* Computes a diff for the session workspace. Never rejects for a busy session: a `session`-mode diff that cannot read the session's file-change captures falls back to an unstaged git diff with `isFallback: true` and reports why in `unavailableReason`.
|
|
888
1135
|
*
|
|
889
1136
|
* @param params Parameters for computing a workspace diff.
|
|
890
1137
|
*
|
|
@@ -932,11 +1179,19 @@ function createSessionRpc(connection, sessionId) {
|
|
|
932
1179
|
/** @experimental */
|
|
933
1180
|
agent: {
|
|
934
1181
|
/**
|
|
935
|
-
* Lists
|
|
1182
|
+
* Lists agents available to the session. Defaults to custom agents only; pass includeBuiltInAgents to include the effective built-in agents.
|
|
936
1183
|
*
|
|
937
|
-
* @
|
|
1184
|
+
* @param params Controls whether built-in agents and authored prompt text are included.
|
|
1185
|
+
*
|
|
1186
|
+
* @returns Agents available to the session.
|
|
938
1187
|
*/
|
|
939
|
-
list: async () => connection.sendRequest("session.agent.list", { sessionId }),
|
|
1188
|
+
list: async (params) => connection.sendRequest("session.agent.list", { sessionId, ...params }),
|
|
1189
|
+
/**
|
|
1190
|
+
* Sets an in-memory authored prompt override for an available agent. For built-in agents, this replaces only the static base prompt while preserving runtime-owned dynamic prompt composition and behavior. The special `general-purpose` agent is not overrideable. Overrides are not persisted; resumed and forked sessions start without them, so the host must re-apply them.
|
|
1191
|
+
*
|
|
1192
|
+
* @param params An in-memory authored prompt override for an available agent.
|
|
1193
|
+
*/
|
|
1194
|
+
setPrompt: async (params) => connection.sendRequest("session.agent.setPrompt", { sessionId, ...params }),
|
|
940
1195
|
/**
|
|
941
1196
|
* Gets the currently selected custom agent for the session.
|
|
942
1197
|
*
|
|
@@ -1089,7 +1344,7 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1089
1344
|
*/
|
|
1090
1345
|
list: async () => connection.sendRequest("session.mcp.list", { sessionId }),
|
|
1091
1346
|
/**
|
|
1092
|
-
* Lists the tools exposed by a connected MCP server on this session's host.
|
|
1347
|
+
* Lists the tools exposed by a connected MCP server on this session's host. This performs a live `tools/list` request. Tool UI metadata is returned independently of whether MCP Apps rendering is enabled for the session.
|
|
1093
1348
|
*
|
|
1094
1349
|
* @param params Server name whose tool list should be returned.
|
|
1095
1350
|
*
|
|
@@ -1142,6 +1397,18 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1142
1397
|
* @returns Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove).
|
|
1143
1398
|
*/
|
|
1144
1399
|
removeGitHub: async () => connection.sendRequest("session.mcp.removeGitHub", { sessionId }),
|
|
1400
|
+
/**
|
|
1401
|
+
* Starts an individual MCP server on the live session. Omit `config` for a config-free start-by-name of an already-configured server (reuses the server's already-registered configuration); supply `config` to start from a caller-supplied configuration. Session-scoped and ephemeral: the server is added to this session's running set only and is reaped when the session ends. Does NOT modify persistent user configuration (`mcp.config.*`), so it does not affect future sessions. The server surfaces through `session.mcp.list` and the `session.mcp_servers_loaded` / `session.mcp_server_status_changed` events like any other server.
|
|
1402
|
+
*
|
|
1403
|
+
* @param params Server name and optional configuration for an individual MCP server start. Omit `config` for a config-free start-by-name of an already-configured server.
|
|
1404
|
+
*/
|
|
1405
|
+
startServer: async (params) => connection.sendRequest("session.mcp.startServer", { sessionId, ...params }),
|
|
1406
|
+
/**
|
|
1407
|
+
* Restarts an individual MCP server on the live session (stops then starts). Omit `config` for a config-free restart-by-name of an already-configured server; supply `config` to restart with a replacement configuration. Session-scoped and ephemeral: does NOT modify persistent user configuration (`mcp.config.*`).
|
|
1408
|
+
*
|
|
1409
|
+
* @param params Server name and optional replacement configuration for an individual MCP server restart. Omit `config` for a config-free restart-by-name of an already-configured server.
|
|
1410
|
+
*/
|
|
1411
|
+
restartServer: async (params) => connection.sendRequest("session.mcp.restartServer", { sessionId, ...params }),
|
|
1145
1412
|
/**
|
|
1146
1413
|
* Stops an individual MCP server on the session's host.
|
|
1147
1414
|
*
|
|
@@ -1166,6 +1433,12 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1166
1433
|
* @returns Indicates whether the pending MCP OAuth response was accepted.
|
|
1167
1434
|
*/
|
|
1168
1435
|
handlePendingRequest: async (params) => connection.sendRequest("session.mcp.oauth.handlePendingRequest", { sessionId, ...params }),
|
|
1436
|
+
/**
|
|
1437
|
+
* Notifies the session that MCP OAuth authentication succeeded and updated credentials were persisted, so cached tool definitions can be refreshed.
|
|
1438
|
+
*
|
|
1439
|
+
* @param params Identifies the MCP server whose persisted OAuth credentials were updated.
|
|
1440
|
+
*/
|
|
1441
|
+
authenticationStateChanged: async (params) => connection.sendRequest("session.mcp.oauth.authenticationStateChanged", { sessionId, ...params }),
|
|
1169
1442
|
/**
|
|
1170
1443
|
* Starts OAuth authentication for a remote MCP server.
|
|
1171
1444
|
*
|
|
@@ -1173,7 +1446,15 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1173
1446
|
*
|
|
1174
1447
|
* @returns OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server.
|
|
1175
1448
|
*/
|
|
1176
|
-
login: async (params) => connection.sendRequest("session.mcp.oauth.login", { sessionId, ...params })
|
|
1449
|
+
login: async (params) => connection.sendRequest("session.mcp.oauth.login", { sessionId, ...params }),
|
|
1450
|
+
/**
|
|
1451
|
+
* Responds to a pending MCP OAuth authorization request by its request id.
|
|
1452
|
+
*
|
|
1453
|
+
* @param params Pending MCP OAuth request id to respond to.
|
|
1454
|
+
*
|
|
1455
|
+
* @returns Indicates whether the pending MCP OAuth response was accepted.
|
|
1456
|
+
*/
|
|
1457
|
+
respond: async (params) => connection.sendRequest("session.mcp.oauth.respond", { sessionId, ...params })
|
|
1177
1458
|
},
|
|
1178
1459
|
/** @experimental */
|
|
1179
1460
|
headers: {
|
|
@@ -1232,6 +1513,33 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1232
1513
|
* @returns Diagnostic snapshot of MCP Apps wiring for the named server.
|
|
1233
1514
|
*/
|
|
1234
1515
|
diagnose: async (params) => connection.sendRequest("session.mcp.apps.diagnose", { sessionId, ...params })
|
|
1516
|
+
},
|
|
1517
|
+
/** @experimental */
|
|
1518
|
+
resources: {
|
|
1519
|
+
/**
|
|
1520
|
+
* Fetch an MCP resource from a connected server by URI (proxies MCP `resources/read`).
|
|
1521
|
+
*
|
|
1522
|
+
* @param params MCP server and resource URI to fetch.
|
|
1523
|
+
*
|
|
1524
|
+
* @returns Resource contents returned by the MCP server.
|
|
1525
|
+
*/
|
|
1526
|
+
read: async (params) => connection.sendRequest("session.mcp.resources.read", { sessionId, ...params }),
|
|
1527
|
+
/**
|
|
1528
|
+
* Enumerate one page of resources a connected MCP server exposes (proxies MCP `resources/list`). Pass `cursor` to continue from a prior result's `nextCursor`.
|
|
1529
|
+
*
|
|
1530
|
+
* @param params MCP server whose resources to enumerate.
|
|
1531
|
+
*
|
|
1532
|
+
* @returns One page of resources advertised by the named MCP server.
|
|
1533
|
+
*/
|
|
1534
|
+
list: async (params) => connection.sendRequest("session.mcp.resources.list", { sessionId, ...params }),
|
|
1535
|
+
/**
|
|
1536
|
+
* Enumerate one page of resource templates a connected MCP server exposes (proxies MCP `resources/templates/list`). Pass `cursor` to continue from a prior result's `nextCursor`.
|
|
1537
|
+
*
|
|
1538
|
+
* @param params MCP server whose resource templates to enumerate.
|
|
1539
|
+
*
|
|
1540
|
+
* @returns One page of resource templates advertised by the named MCP server.
|
|
1541
|
+
*/
|
|
1542
|
+
listTemplates: async (params) => connection.sendRequest("session.mcp.resources.listTemplates", { sessionId, ...params })
|
|
1235
1543
|
}
|
|
1236
1544
|
},
|
|
1237
1545
|
/** @experimental */
|
|
@@ -1530,17 +1838,17 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1530
1838
|
*/
|
|
1531
1839
|
setApproveAll: async (params) => connection.sendRequest("session.permissions.setApproveAll", { sessionId, ...params }),
|
|
1532
1840
|
/**
|
|
1533
|
-
*
|
|
1841
|
+
* Sets the allow-all permission mode for the session. Used by attach-mode clients (e.g. LocalRpcSession's `/allow-all` forwarder) to flip the target session's permission state. The `on` mode swaps in unrestricted path and URL managers and emits `session.permissions_changed` on transition; the `auto` mode keeps normal prompt paths active while attaching LLM safety recommendations. The result returns the authoritative post-mutation state so callers can update their local mirrors without racing the `session.permissions_changed` notification on the same wire.
|
|
1534
1842
|
*
|
|
1535
|
-
* @param params
|
|
1843
|
+
* @param params Allow-all mode to apply for the session.
|
|
1536
1844
|
*
|
|
1537
1845
|
* @returns Indicates whether the operation succeeded and reports the post-mutation state.
|
|
1538
1846
|
*/
|
|
1539
1847
|
setAllowAll: async (params) => connection.sendRequest("session.permissions.setAllowAll", { sessionId, ...params }),
|
|
1540
1848
|
/**
|
|
1541
|
-
* Returns
|
|
1849
|
+
* Returns the current allow-all permission mode for the session.
|
|
1542
1850
|
*
|
|
1543
|
-
* @returns Current
|
|
1851
|
+
* @returns Current allow-all permission mode.
|
|
1544
1852
|
*/
|
|
1545
1853
|
getAllowAll: async () => connection.sendRequest("session.permissions.getAllowAll", { sessionId }),
|
|
1546
1854
|
/**
|
|
@@ -1562,9 +1870,11 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1562
1870
|
/**
|
|
1563
1871
|
* Clears session-scoped tool permission approvals.
|
|
1564
1872
|
*
|
|
1873
|
+
* @param params Clears session-scoped tool permission approvals, and optionally the location-scoped ones.
|
|
1874
|
+
*
|
|
1565
1875
|
* @returns Indicates whether the operation succeeded.
|
|
1566
1876
|
*/
|
|
1567
|
-
resetSessionApprovals: async () => connection.sendRequest("session.permissions.resetSessionApprovals", { sessionId }),
|
|
1877
|
+
resetSessionApprovals: async (params) => connection.sendRequest("session.permissions.resetSessionApprovals", { sessionId, ...params }),
|
|
1568
1878
|
/**
|
|
1569
1879
|
* Notifies the runtime that a permission prompt UI has been shown to the user.
|
|
1570
1880
|
*
|
|
@@ -1725,19 +2035,19 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1725
2035
|
*/
|
|
1726
2036
|
getContextHeaviestMessages: async (params) => connection.sendRequest("session.metadata.getContextHeaviestMessages", { sessionId, ...params }),
|
|
1727
2037
|
/**
|
|
1728
|
-
* Records a working-directory/git context change and emits a `session.context_changed` event.
|
|
2038
|
+
* Records a working-directory/git context change and emits a `session.context_changed` event. For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event): a local session's working directory is authoritative and is moved via `metadata.setWorkingDirectory` (or an SDK `session.resume` that supplies a `workingDirectory`), not by this method.
|
|
1729
2039
|
*
|
|
1730
2040
|
* @param params Updated working-directory/git context to record on the session.
|
|
1731
2041
|
*
|
|
1732
|
-
* @returns Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode).
|
|
2042
|
+
* @returns Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event); move a local session's working directory via `metadata.setWorkingDirectory` instead.
|
|
1733
2043
|
*/
|
|
1734
2044
|
recordContextChange: async (params) => connection.sendRequest("session.metadata.recordContextChange", { sessionId, ...params }),
|
|
1735
2045
|
/**
|
|
1736
|
-
* Updates the session's
|
|
2046
|
+
* Updates the session's working directory. For local sessions the target is validated first (an absolute path that exists on disk) and the permission primary directory is re-based; a rejected validation fails the call before any session state changes.
|
|
1737
2047
|
*
|
|
1738
|
-
* @param params Absolute path to set as the session's new working directory.
|
|
2048
|
+
* @param params Absolute path to set as the session's new working directory. For local sessions the path must be absolute and exist on disk: it is validated before any session state changes, and a failing validation rejects the call with nothing mutated, persisted, or emitted. Remote sessions record the path as-is.
|
|
1739
2049
|
*
|
|
1740
|
-
* @returns Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for
|
|
2050
|
+
* @returns Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for any related side-effects (file index, etc.); it does NOT change the process working directory (a session's cwd is per-session, not process-global). For local sessions the runtime validates the target first (an absolute path that exists on disk) and re-bases the permission primary directory; a rejected validation fails the call before anything is mutated, persisted, or emitted. Location-scoped permission rules are then re-keyed to the new directory (best-effort). Remote sessions only record the path.
|
|
1741
2051
|
*/
|
|
1742
2052
|
setWorkingDirectory: async (params) => connection.sendRequest("session.metadata.setWorkingDirectory", { sessionId, ...params }),
|
|
1743
2053
|
/**
|
|
@@ -1750,9 +2060,20 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1750
2060
|
recomputeContextTokens: async (params) => connection.sendRequest("session.metadata.recomputeContextTokens", { sessionId, ...params })
|
|
1751
2061
|
},
|
|
1752
2062
|
/** @experimental */
|
|
2063
|
+
contentExclusion: {
|
|
2064
|
+
/**
|
|
2065
|
+
* Checks local file system absolute paths within the session working directory against its content-exclusion policy. Results preserve input order. Unsupported paths/filesystems and unavailable policy evaluation return available false, and callers must treat every requested path as excluded.
|
|
2066
|
+
*
|
|
2067
|
+
* @param params Local file system absolute paths within the session working directory to check against its content-exclusion policy.
|
|
2068
|
+
*
|
|
2069
|
+
* @returns Batch content-exclusion result. Callers must fail closed when policy evaluation is unavailable.
|
|
2070
|
+
*/
|
|
2071
|
+
checkPaths: async (params) => connection.sendRequest("session.contentExclusion.checkPaths", { sessionId, ...params })
|
|
2072
|
+
},
|
|
2073
|
+
/** @experimental */
|
|
1753
2074
|
shell: {
|
|
1754
2075
|
/**
|
|
1755
|
-
* Starts a shell command and streams output through session notifications.
|
|
2076
|
+
* Starts a shell command and streams output through session notifications. The command runs as the leader of its own process group (POSIX) or in a dedicated job object (Windows), so a forced termination — via "shell.kill", the request timeout, or session disposal — signals that whole group/job rather than only the direct child. Two gaps are worth planning for: a command that exits on its own does not trigger that teardown, and on POSIX a descendant that moves itself into a new session or process group (for example via "setsid") leaves the signalled group, so either can leave a background process running.
|
|
1756
2077
|
*
|
|
1757
2078
|
* @param params Shell command to run, with optional working directory and timeout in milliseconds.
|
|
1758
2079
|
*
|
|
@@ -1760,7 +2081,7 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1760
2081
|
*/
|
|
1761
2082
|
exec: async (params) => connection.sendRequest("session.shell.exec", { sessionId, ...params }),
|
|
1762
2083
|
/**
|
|
1763
|
-
* Sends a signal to a shell process previously started via "shell.exec".
|
|
2084
|
+
* Sends a signal to a shell process previously started via "shell.exec". The signal targets the command's whole process group (POSIX) or job object (Windows), so descendants still in that group are signalled too, not just the direct child. On POSIX a descendant that moved itself into a new session or process group (for example via "setsid") is no longer in the signalled group and survives.
|
|
1764
2085
|
*
|
|
1765
2086
|
* @param params Identifier of a process previously returned by "shell.exec" and the signal to send.
|
|
1766
2087
|
*
|
|
@@ -1802,6 +2123,28 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1802
2123
|
* @returns Number of events that were removed by the truncation.
|
|
1803
2124
|
*/
|
|
1804
2125
|
truncate: async (params) => connection.sendRequest("session.history.truncate", { sessionId, ...params }),
|
|
2126
|
+
/**
|
|
2127
|
+
* Lists the user turns that the session can rewind to. Never rejects for a busy session: rewind reads need the session's file-change captures to be settled, so a session that still holds active work answers with `unavailableReason: "session-busy"` and no points, which the caller can retry.
|
|
2128
|
+
*
|
|
2129
|
+
* @returns Rewind points and file-change-tracking availability for the session.
|
|
2130
|
+
*/
|
|
2131
|
+
listRewindPoints: async () => connection.sendRequest("session.history.listRewindPoints", { sessionId }),
|
|
2132
|
+
/**
|
|
2133
|
+
* Previews the files that a conversation-and-files rewind would restore.
|
|
2134
|
+
*
|
|
2135
|
+
* @param params Event boundary to preview for conversation-and-files rewind.
|
|
2136
|
+
*
|
|
2137
|
+
* @returns Files and aggregate changes for a prospective rewind.
|
|
2138
|
+
*/
|
|
2139
|
+
previewRewind: async (params) => connection.sendRequest("session.history.previewRewind", { sessionId, ...params }),
|
|
2140
|
+
/**
|
|
2141
|
+
* Rewinds the session conversation, optionally restoring files changed by the discarded turns. Not crash-atomic: file restore and conversation truncation are separate stores, applied in that order, so a process crash between them can leave the workspace rewound while the conversation still contains the discarded turns. There is no recovery journal; re-running the same rewind is the recovery path for a crash before truncation lands, since file restore is idempotent (already-restored files are reported as skipped) and truncation is re-derived from the still-retained boundary event. After truncation lands that boundary no longer exists, so the same request is rejected; the only stage that can still be outstanding is snapshot pruning, whose failure leaves orphan snapshots the capture store tolerates. The reverse inconsistency cannot occur, because truncation is never applied before file restore succeeds.
|
|
2142
|
+
*
|
|
2143
|
+
* @param params Boundary and mode for rewinding session history.
|
|
2144
|
+
*
|
|
2145
|
+
* @returns Structured outcome of a rewind request.
|
|
2146
|
+
*/
|
|
2147
|
+
rewind: async (params) => connection.sendRequest("session.history.rewind", { sessionId, ...params }),
|
|
1805
2148
|
/**
|
|
1806
2149
|
* Cancels any in-progress background compaction on a local session.
|
|
1807
2150
|
*
|
|
@@ -1819,7 +2162,15 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1819
2162
|
*
|
|
1820
2163
|
* @returns Markdown summary of the conversation context (empty when not available).
|
|
1821
2164
|
*/
|
|
1822
|
-
summarizeForHandoff: async () => connection.sendRequest("session.history.summarizeForHandoff", { sessionId })
|
|
2165
|
+
summarizeForHandoff: async () => connection.sendRequest("session.history.summarizeForHandoff", { sessionId }),
|
|
2166
|
+
/**
|
|
2167
|
+
* Clears the session's conversation history, keeping only system and developer messages, and seeds the fresh context window with a first user message. Must be called from inside a tool handler: the clear has to drop the results of the tool calls its wipe orphans, and it rejects when no tool call is in flight.
|
|
2168
|
+
*
|
|
2169
|
+
* @param params Parameters for clearing the conversation and seeding the window that replaces it.
|
|
2170
|
+
*
|
|
2171
|
+
* @returns What a successful clear removed. A clear that could not be applied rejects instead of reporting a count.
|
|
2172
|
+
*/
|
|
2173
|
+
clearContext: async (params) => connection.sendRequest("session.history.clearContext", { sessionId, ...params })
|
|
1823
2174
|
},
|
|
1824
2175
|
/** @experimental */
|
|
1825
2176
|
queue: {
|
|
@@ -1829,6 +2180,60 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1829
2180
|
* @returns Snapshot of the session's pending queued items and immediate-steering messages.
|
|
1830
2181
|
*/
|
|
1831
2182
|
pendingItems: async () => connection.sendRequest("session.queue.pendingItems", { sessionId }),
|
|
2183
|
+
/**
|
|
2184
|
+
* Moves an addressable queued item to a public visible position.
|
|
2185
|
+
*
|
|
2186
|
+
* @param params Parameters for moving a queued item by stable id.
|
|
2187
|
+
*
|
|
2188
|
+
* @returns Result of moving a queued item.
|
|
2189
|
+
*/
|
|
2190
|
+
moveItem: async (params) => connection.sendRequest("session.queue.moveItem", { sessionId, ...params }),
|
|
2191
|
+
/**
|
|
2192
|
+
* Inserts a new queued message at a public visible position.
|
|
2193
|
+
*
|
|
2194
|
+
* @param params Parameters for inserting a queued message at a public visible position.
|
|
2195
|
+
*
|
|
2196
|
+
* @returns Result of inserting a queued message.
|
|
2197
|
+
*/
|
|
2198
|
+
insertAt: async (params) => connection.sendRequest("session.queue.insertAt", { sessionId, ...params }),
|
|
2199
|
+
/**
|
|
2200
|
+
* Removes an addressable queued item by its stable id.
|
|
2201
|
+
*
|
|
2202
|
+
* @param params Parameters for removing a queued item by stable id.
|
|
2203
|
+
*
|
|
2204
|
+
* @returns Result of removing a queued item.
|
|
2205
|
+
*/
|
|
2206
|
+
removeAt: async (params) => connection.sendRequest("session.queue.removeAt", { sessionId, ...params }),
|
|
2207
|
+
/**
|
|
2208
|
+
* Updates the text of an addressable single-message queue item.
|
|
2209
|
+
*
|
|
2210
|
+
* @param params Parameters for editing a single queued message.
|
|
2211
|
+
*
|
|
2212
|
+
* @returns Result of editing a queued message.
|
|
2213
|
+
*/
|
|
2214
|
+
updateText: async (params) => connection.sendRequest("session.queue.updateText", { sessionId, ...params }),
|
|
2215
|
+
/**
|
|
2216
|
+
* Duplicates an addressable queued item immediately after its source.
|
|
2217
|
+
*
|
|
2218
|
+
* @param params Parameters for duplicating a queued item.
|
|
2219
|
+
*
|
|
2220
|
+
* @returns Result of duplicating a queued item.
|
|
2221
|
+
*/
|
|
2222
|
+
duplicateAt: async (params) => connection.sendRequest("session.queue.duplicateAt", { sessionId, ...params }),
|
|
2223
|
+
/**
|
|
2224
|
+
* Acquires or releases the queued-lane drain pause.
|
|
2225
|
+
*
|
|
2226
|
+
* @param params Parameters for acquiring or releasing the queued-lane drain pause. Acquisition is exclusive and non-idempotent: `paused: true` against an already-paused session fails with `queue_already_paused`. The pause is never released automatically — it is not tied to the caller's lifetime, so a client that exits without sending `paused: false` leaves the lane frozen. Release is unowned: `paused: false` clears the pause for any caller, including one that never acquired it.
|
|
2227
|
+
*/
|
|
2228
|
+
setDrainPaused: async (params) => connection.sendRequest("session.queue.setDrainPaused", { sessionId, ...params }),
|
|
2229
|
+
/**
|
|
2230
|
+
* Moves an addressable queued message into the live turn's steering lane.
|
|
2231
|
+
*
|
|
2232
|
+
* @param params Parameters for steering a queued message into a live turn.
|
|
2233
|
+
*
|
|
2234
|
+
* @returns Result of trying to steer a queued message into a live turn.
|
|
2235
|
+
*/
|
|
2236
|
+
sendNow: async (params) => connection.sendRequest("session.queue.sendNow", { sessionId, ...params }),
|
|
1832
2237
|
/**
|
|
1833
2238
|
* Removes the most recently queued user-facing item (LIFO).
|
|
1834
2239
|
*
|
|
@@ -1843,7 +2248,7 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1843
2248
|
/** @experimental */
|
|
1844
2249
|
eventLog: {
|
|
1845
2250
|
/**
|
|
1846
|
-
* Reads a batch of session events from a cursor, optionally waiting for new events.
|
|
2251
|
+
* Reads a batch of session events from a cursor, optionally waiting for new events. Supports tail-first reads via `direction: backward`.
|
|
1847
2252
|
*
|
|
1848
2253
|
* @param params Cursor, batch size, and optional long-poll/filter parameters for reading session events.
|
|
1849
2254
|
*
|
|
@@ -1883,6 +2288,17 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1883
2288
|
getMetrics: async () => connection.sendRequest("session.usage.getMetrics", { sessionId })
|
|
1884
2289
|
},
|
|
1885
2290
|
/** @experimental */
|
|
2291
|
+
limitPrediction: {
|
|
2292
|
+
/**
|
|
2293
|
+
* Predicts an AI-credit session limit for the session's resolved model. Returns an unavailable result instead of falling back when the current model is unresolved auto.
|
|
2294
|
+
*
|
|
2295
|
+
* @param params Parameters for predicting an AI-credit session limit. Omitting `modelId` uses the session's currently selected model.
|
|
2296
|
+
*
|
|
2297
|
+
* @returns Prediction result. Available results include prediction details; unavailable results include an explicit reason.
|
|
2298
|
+
*/
|
|
2299
|
+
predict: async (params) => connection.sendRequest("session.limitPrediction.predict", { sessionId, ...params })
|
|
2300
|
+
},
|
|
2301
|
+
/** @experimental */
|
|
1886
2302
|
remote: {
|
|
1887
2303
|
/**
|
|
1888
2304
|
* Enables remote session export or steering.
|
|
@@ -1943,6 +2359,14 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1943
2359
|
}
|
|
1944
2360
|
function createInternalSessionRpc(connection, sessionId) {
|
|
1945
2361
|
return {
|
|
2362
|
+
/**
|
|
2363
|
+
* Queues or sends an internal system notification to the session according to its passive policy.
|
|
2364
|
+
*
|
|
2365
|
+
* @param params Internal request for sending a system notification.
|
|
2366
|
+
*
|
|
2367
|
+
* @experimental
|
|
2368
|
+
*/
|
|
2369
|
+
sendSystemNotification: async (params) => connection.sendRequest("session.sendSystemNotification", { sessionId, ...params }),
|
|
1946
2370
|
/** @experimental */
|
|
1947
2371
|
mcp: {
|
|
1948
2372
|
/**
|
|
@@ -1962,40 +2386,142 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
1962
2386
|
*/
|
|
1963
2387
|
configureGitHub: async (params) => connection.sendRequest("session.mcp.configureGitHub", { sessionId, ...params }),
|
|
1964
2388
|
/**
|
|
1965
|
-
*
|
|
2389
|
+
* 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.
|
|
1966
2390
|
*
|
|
1967
|
-
* @param params
|
|
2391
|
+
* @param params Registration parameters for an external MCP client.
|
|
1968
2392
|
*/
|
|
1969
|
-
|
|
2393
|
+
registerExternalClient: async (params) => connection.sendRequest("session.mcp.registerExternalClient", { sessionId, ...params }),
|
|
1970
2394
|
/**
|
|
1971
|
-
*
|
|
2395
|
+
* 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.
|
|
1972
2396
|
*
|
|
1973
|
-
* @param params Server name
|
|
2397
|
+
* @param params Server name identifying the external client to remove.
|
|
1974
2398
|
*/
|
|
1975
|
-
|
|
2399
|
+
unregisterExternalClient: async (params) => connection.sendRequest("session.mcp.unregisterExternalClient", { sessionId, ...params })
|
|
2400
|
+
},
|
|
2401
|
+
/** @experimental */
|
|
2402
|
+
settings: {
|
|
1976
2403
|
/**
|
|
1977
|
-
*
|
|
2404
|
+
* Returns a redacted snapshot of session runtime settings, with secrets and raw feature flags excluded. Internal: the runtime settings shape is a runtime-internal surface and is deliberately kept out of the public SDK, because consumers should not depend on the runtime's internal settings layout. It remains callable in-process and is expected to be reworked as the runtime internals are consolidated.
|
|
1978
2405
|
*
|
|
1979
|
-
* @
|
|
2406
|
+
* @returns Redacted, serializable view of session runtime settings for SDK boundary consumers. Secrets and raw feature flags are intentionally excluded.
|
|
1980
2407
|
*/
|
|
1981
|
-
|
|
2408
|
+
snapshot: async () => connection.sendRequest("session.settings.snapshot", { sessionId }),
|
|
1982
2409
|
/**
|
|
1983
|
-
*
|
|
2410
|
+
* Evaluates a named Rust-owned settings predicate without exposing raw feature flags. Internal: the raw feature-flag names and composition are runtime-internal, so this predicate-evaluation helper is kept out of the public SDK surface and is callable in-process only.
|
|
1984
2411
|
*
|
|
1985
|
-
* @param params
|
|
2412
|
+
* @param params Named Rust-owned settings predicate to evaluate for this session.
|
|
2413
|
+
*
|
|
2414
|
+
* @returns Result of evaluating a Rust-owned settings predicate.
|
|
1986
2415
|
*/
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
2416
|
+
evaluatePredicate: async (params) => connection.sendRequest("session.settings.evaluatePredicate", { sessionId, ...params })
|
|
2417
|
+
},
|
|
2418
|
+
/** @experimental */
|
|
2419
|
+
queue: {
|
|
2420
|
+
/**
|
|
2421
|
+
* Returns the internal native queue snapshot for in-process session orchestration.
|
|
2422
|
+
*
|
|
2423
|
+
* @returns Internal snapshot of native queue state for local session orchestration.
|
|
2424
|
+
*/
|
|
2425
|
+
snapshot: async () => connection.sendRequest("session.queue.snapshot", { sessionId }),
|
|
2426
|
+
/**
|
|
2427
|
+
* Reports whether the local session has native queued work pending.
|
|
2428
|
+
*
|
|
2429
|
+
* @returns Whether the native queue has pending work.
|
|
2430
|
+
*/
|
|
2431
|
+
hasPending: async () => connection.sendRequest("session.queue.hasPending", { sessionId }),
|
|
2432
|
+
/**
|
|
2433
|
+
* Begins a native deferred-idle drain when background work has quiesced.
|
|
2434
|
+
*
|
|
2435
|
+
* @param params Inputs for starting a deferred-idle drain.
|
|
2436
|
+
*
|
|
2437
|
+
* @returns Whether a deferred-idle drain should run.
|
|
2438
|
+
*/
|
|
2439
|
+
beginDeferredIdleDrain: async (params) => connection.sendRequest("session.queue.beginDeferredIdleDrain", { sessionId, ...params }),
|
|
2440
|
+
/**
|
|
2441
|
+
* Finishes a native deferred-idle drain and reports whether to drain queue work or emit idle.
|
|
2442
|
+
*
|
|
2443
|
+
* @param params Inputs for completing a deferred-idle drain.
|
|
2444
|
+
*
|
|
2445
|
+
* @returns Action selected by the native deferred-idle drain.
|
|
2446
|
+
*/
|
|
2447
|
+
finishDeferredIdleDrain: async (params) => connection.sendRequest("session.queue.finishDeferredIdleDrain", { sessionId, ...params }),
|
|
2448
|
+
/**
|
|
2449
|
+
* Marks session.idle as deferred by native background work state.
|
|
2450
|
+
*
|
|
2451
|
+
* @param params Inputs for marking session.idle deferred in native state.
|
|
2452
|
+
*/
|
|
2453
|
+
deferSessionIdle: async (params) => connection.sendRequest("session.queue.deferSessionIdle", { sessionId, ...params }),
|
|
2454
|
+
/**
|
|
2455
|
+
* Consumes queued native system notifications matching an internal filter.
|
|
2456
|
+
*
|
|
2457
|
+
* @param params Internal filter for consuming queued system notifications.
|
|
2458
|
+
*
|
|
2459
|
+
* @returns Indicates whether a user-facing pending item was removed.
|
|
2460
|
+
*/
|
|
2461
|
+
consumeSystemNotifications: async (params) => connection.sendRequest("session.queue.consumeSystemNotifications", { sessionId, ...params }),
|
|
2462
|
+
/**
|
|
2463
|
+
* Enqueues the internal resume-pending wake item when orphan handling needs a follow-up turn.
|
|
2464
|
+
*
|
|
2465
|
+
* @returns Result of enqueueing the resume-pending wake item.
|
|
2466
|
+
*/
|
|
2467
|
+
enqueueResumePending: async () => connection.sendRequest("session.queue.enqueueResumePending", { sessionId }),
|
|
2468
|
+
/**
|
|
2469
|
+
* Drains the native local-session work queue for in-process session orchestration.
|
|
2470
|
+
*/
|
|
2471
|
+
process: async () => connection.sendRequest("session.queue.process", { sessionId })
|
|
2472
|
+
},
|
|
2473
|
+
/** @experimental */
|
|
2474
|
+
schedule: {
|
|
2475
|
+
/**
|
|
2476
|
+
* Hydrates the native schedule registry from persisted session events.
|
|
2477
|
+
*/
|
|
2478
|
+
hydrate: async () => connection.sendRequest("session.schedule.hydrate", { sessionId }),
|
|
2479
|
+
/**
|
|
2480
|
+
* Reports whether the session has an active self-paced scheduled prompt.
|
|
2481
|
+
*
|
|
2482
|
+
* @returns Whether the session currently has an active self-paced schedule.
|
|
2483
|
+
*/
|
|
2484
|
+
hasSelfPaced: async () => connection.sendRequest("session.schedule.hasSelfPaced", { sessionId }),
|
|
2485
|
+
/**
|
|
2486
|
+
* Registers a relative-interval scheduled prompt.
|
|
2487
|
+
*
|
|
2488
|
+
* @param params Register a relative-interval scheduled prompt.
|
|
2489
|
+
*
|
|
2490
|
+
* @returns Result of registering or re-arming a scheduled prompt.
|
|
2491
|
+
*/
|
|
2492
|
+
add: async (params) => connection.sendRequest("session.schedule.add", { sessionId, ...params }),
|
|
2493
|
+
/**
|
|
2494
|
+
* Registers a recurring cron scheduled prompt.
|
|
2495
|
+
*
|
|
2496
|
+
* @param params Register a cron scheduled prompt.
|
|
2497
|
+
*
|
|
2498
|
+
* @returns Result of registering or re-arming a scheduled prompt.
|
|
2499
|
+
*/
|
|
2500
|
+
addCron: async (params) => connection.sendRequest("session.schedule.addCron", { sessionId, ...params }),
|
|
2501
|
+
/**
|
|
2502
|
+
* Registers an absolute-time scheduled prompt.
|
|
2503
|
+
*
|
|
2504
|
+
* @param params Register an absolute-time scheduled prompt.
|
|
2505
|
+
*
|
|
2506
|
+
* @returns Result of registering or re-arming a scheduled prompt.
|
|
2507
|
+
*/
|
|
2508
|
+
addAt: async (params) => connection.sendRequest("session.schedule.addAt", { sessionId, ...params }),
|
|
2509
|
+
/**
|
|
2510
|
+
* Registers a self-paced scheduled prompt.
|
|
2511
|
+
*
|
|
2512
|
+
* @param params Register a self-paced scheduled prompt.
|
|
2513
|
+
*
|
|
2514
|
+
* @returns Result of registering or re-arming a scheduled prompt.
|
|
2515
|
+
*/
|
|
2516
|
+
addSelfPaced: async (params) => connection.sendRequest("session.schedule.addSelfPaced", { sessionId, ...params }),
|
|
2517
|
+
/**
|
|
2518
|
+
* Re-arms an active self-paced scheduled prompt.
|
|
2519
|
+
*
|
|
2520
|
+
* @param params Re-arm a self-paced scheduled prompt.
|
|
2521
|
+
*
|
|
2522
|
+
* @returns Result of registering or re-arming a scheduled prompt.
|
|
2523
|
+
*/
|
|
2524
|
+
rearmSelfPaced: async (params) => connection.sendRequest("session.schedule.rearmSelfPaced", { sessionId, ...params })
|
|
1999
2525
|
}
|
|
2000
2526
|
};
|
|
2001
2527
|
}
|
|
@@ -2005,6 +2531,16 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
|
2005
2531
|
if (!handler) throw new Error(`No providerToken handler registered for session: ${params.sessionId}`);
|
|
2006
2532
|
return handler.getToken(params);
|
|
2007
2533
|
});
|
|
2534
|
+
connection.onRequest("factory.execute", async (params) => {
|
|
2535
|
+
const handler = getHandlers(params.sessionId).factory;
|
|
2536
|
+
if (!handler) throw new Error(`No factory handler registered for session: ${params.sessionId}`);
|
|
2537
|
+
return handler.execute(params);
|
|
2538
|
+
});
|
|
2539
|
+
connection.onRequest("factory.abort", async (params) => {
|
|
2540
|
+
const handler = getHandlers(params.sessionId).factory;
|
|
2541
|
+
if (!handler) throw new Error(`No factory handler registered for session: ${params.sessionId}`);
|
|
2542
|
+
return handler.abort(params);
|
|
2543
|
+
});
|
|
2008
2544
|
connection.onRequest("sessionFs.readFile", async (params) => {
|
|
2009
2545
|
const handler = getHandlers(params.sessionId).sessionFs;
|
|
2010
2546
|
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
|
@@ -2060,6 +2596,11 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
|
2060
2596
|
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
|
2061
2597
|
return handler.sqliteQuery(params);
|
|
2062
2598
|
});
|
|
2599
|
+
connection.onRequest("sessionFs.sqliteTransaction", async (params) => {
|
|
2600
|
+
const handler = getHandlers(params.sessionId).sessionFs;
|
|
2601
|
+
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
|
2602
|
+
return handler.sqliteTransaction(params);
|
|
2603
|
+
});
|
|
2063
2604
|
connection.onRequest("sessionFs.sqliteExists", async (params) => {
|
|
2064
2605
|
const handler = getHandlers(params.sessionId).sessionFs;
|
|
2065
2606
|
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|