@github/copilot-sdk 1.0.17-preview.1 → 1.0.17-preview.10
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 +108 -0
- package/dist/canvas.d.ts +6 -1
- package/dist/cjs/cliVersion.js +1 -1
- package/dist/cjs/client.js +69 -4
- package/dist/cjs/extension.js +2 -0
- package/dist/cjs/generated/rpc.js +326 -25
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/runtimeArtifacts.js +1 -0
- package/dist/cjs/session.js +151 -2
- package/dist/cjs/sessionFsProvider.js +57 -0
- package/dist/cjs/types.js +5 -2
- package/dist/cliVersion.d.ts +1 -1
- package/dist/cliVersion.js +1 -1
- package/dist/client.d.ts +1 -0
- package/dist/client.js +69 -4
- package/dist/extension.d.ts +1 -1
- package/dist/extension.js +2 -0
- package/dist/generated/rpc.d.ts +1948 -673
- package/dist/generated/rpc.js +326 -25
- package/dist/generated/session-events.d.ts +282 -11
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -0
- package/dist/runtimeArtifacts.js +1 -0
- package/dist/session.d.ts +52 -1
- package/dist/session.js +151 -2
- package/dist/sessionFsProvider.d.ts +9 -1
- package/dist/sessionFsProvider.js +56 -0
- package/dist/types.d.ts +159 -2
- package/dist/types.js +4 -2
- package/docs/agent-author.md +29 -2
- package/package.json +13 -12
|
@@ -127,7 +127,48 @@ function createServerRpc(connection) {
|
|
|
127
127
|
*
|
|
128
128
|
* @returns Whether the host running this runtime can run the command sandbox. The runtime checks `supported` once per process. A capability answer can change while the process runs, for example after the user installs a missing package.
|
|
129
129
|
*/
|
|
130
|
-
getHostSupport: async () => connection.sendRequest("sandbox.getHostSupport", {})
|
|
130
|
+
getHostSupport: async () => connection.sendRequest("sandbox.getHostSupport", {}),
|
|
131
|
+
/** @experimental */
|
|
132
|
+
proxyCa: {
|
|
133
|
+
/**
|
|
134
|
+
* Reports whether the persistent certificate authority of the sandbox credential proxy exists, whether OS trust includes it, and whether it must be rotated. Changes nothing.
|
|
135
|
+
*
|
|
136
|
+
* @param params Identifies the credential hosts that the persistent certificate authority of the sandbox credential proxy must cover. The runtime always adds the hosts from the saved user settings.
|
|
137
|
+
*
|
|
138
|
+
* @returns Status of the persistent certificate authority of the sandbox credential proxy.
|
|
139
|
+
*/
|
|
140
|
+
getStatus: async (params) => connection.sendRequest("sandbox.proxyCa.getStatus", params),
|
|
141
|
+
/**
|
|
142
|
+
* Creates the persistent certificate authority of the sandbox credential proxy if none is stored, without changing OS trust, and returns the path of its public certificate. Keeps an existing certificate authority, even one that must be rotated. Fails where OS trust is unsupported. Trust it with sandbox.proxyCa.trust: the CLI trusts only the hosts in the saved user settings, so it refuses a certificate authority that also covers hosts from sandboxConfig.
|
|
143
|
+
*
|
|
144
|
+
* @param params Identifies the credential hosts that the persistent certificate authority of the sandbox credential proxy must cover. The runtime always adds the hosts from the saved user settings.
|
|
145
|
+
*
|
|
146
|
+
* @returns Result of creating the persistent certificate authority of the sandbox credential proxy.
|
|
147
|
+
*/
|
|
148
|
+
create: async (params) => connection.sendRequest("sandbox.proxyCa.create", params),
|
|
149
|
+
/**
|
|
150
|
+
* Replaces the persistent certificate authority of the sandbox credential proxy with a new one for the current credential hosts. If OS trust included the old one, removes it and trusts the new one, which can show an OS authentication prompt. Running sandboxed tools keep the old certificate authority until they restart.
|
|
151
|
+
*
|
|
152
|
+
* @param params Identifies the credential hosts that the persistent certificate authority of the sandbox credential proxy must cover. The runtime always adds the hosts from the saved user settings.
|
|
153
|
+
*
|
|
154
|
+
* @returns Status of the persistent certificate authority of the sandbox credential proxy.
|
|
155
|
+
*/
|
|
156
|
+
rotate: async (params) => connection.sendRequest("sandbox.proxyCa.rotate", params),
|
|
157
|
+
/**
|
|
158
|
+
* Adds the persistent certificate authority of the sandbox credential proxy to OS trust, so sandboxed clients that read only OS trust accept the proxy. Call create first. Refuses a certificate authority that is not constrained to the current credential hosts. Can show an OS authentication prompt.
|
|
159
|
+
*
|
|
160
|
+
* @param params Identifies the credential hosts that the persistent certificate authority of the sandbox credential proxy must cover. The runtime always adds the hosts from the saved user settings.
|
|
161
|
+
*
|
|
162
|
+
* @returns Status of the persistent certificate authority of the sandbox credential proxy.
|
|
163
|
+
*/
|
|
164
|
+
trust: async (params) => connection.sendRequest("sandbox.proxyCa.trust", params),
|
|
165
|
+
/**
|
|
166
|
+
* Removes the persistent certificate authority of the sandbox credential proxy from OS trust. Keeps the stored certificate authority. Can show an OS authentication prompt. Sandboxed clients that read only OS trust then reject the proxy; clients that read the per-process certificate bundle continue to work.
|
|
167
|
+
*
|
|
168
|
+
* @returns Status of the persistent certificate authority of the sandbox credential proxy.
|
|
169
|
+
*/
|
|
170
|
+
remove: async () => connection.sendRequest("sandbox.proxyCa.remove", {})
|
|
171
|
+
}
|
|
131
172
|
},
|
|
132
173
|
/** @experimental */
|
|
133
174
|
tools: {
|
|
@@ -625,21 +666,15 @@ function createServerRpc(connection) {
|
|
|
625
666
|
/** @experimental */
|
|
626
667
|
settings: {
|
|
627
668
|
/**
|
|
628
|
-
*
|
|
629
|
-
*/
|
|
630
|
-
reload: async () => connection.sendRequest("user.settings.reload", {}),
|
|
631
|
-
/**
|
|
632
|
-
* Lists every known user setting (settings.json overlaid with the legacy config.json, config.json wins), each with its effective value, its default, and whether it is at the default — so settings the user has never set still appear with their default value. Does not include repository- or enterprise-managed overrides that the runtime layers on top at session time.
|
|
669
|
+
* Lists every known user setting from settings.json, each with its effective value, its default, and whether it is at the default — so settings the user has never set still appear with their default value. Does not include repository- or enterprise-managed overrides that the runtime layers on top at session time.
|
|
633
670
|
*
|
|
634
|
-
* @returns Per-key metadata for every known user setting
|
|
671
|
+
* @returns Per-key metadata for every known user setting in settings.json, including settings left at their default. Excludes repository- and enterprise-managed overrides.
|
|
635
672
|
*/
|
|
636
673
|
get: async () => connection.sendRequest("user.settings.get", {}),
|
|
637
674
|
/**
|
|
638
|
-
* Writes one or more user settings to settings.json, replacing each provided top-level key. A key whose value is null is removed.
|
|
675
|
+
* Writes one or more user settings to settings.json, replacing each provided top-level key. A key whose value is null is removed.
|
|
639
676
|
*
|
|
640
677
|
* @param params Partial user settings to write to settings.json. Each top-level key is written individually, replacing the existing value; a key whose value is null is removed.
|
|
641
|
-
*
|
|
642
|
-
* @returns Outcome of writing user settings.
|
|
643
678
|
*/
|
|
644
679
|
set: async (params) => connection.sendRequest("user.settings.set", params)
|
|
645
680
|
}
|
|
@@ -939,6 +974,37 @@ function createServerRpc(connection) {
|
|
|
939
974
|
* @returns Outcome of an agentRegistry.spawn call.
|
|
940
975
|
*/
|
|
941
976
|
spawn: async (params) => connection.sendRequest("agentRegistry.spawn", params)
|
|
977
|
+
},
|
|
978
|
+
/** @experimental */
|
|
979
|
+
connectors: {
|
|
980
|
+
/**
|
|
981
|
+
* Returns feature availability.
|
|
982
|
+
*
|
|
983
|
+
* @returns Feature availability.
|
|
984
|
+
*/
|
|
985
|
+
getCapabilities: async () => connection.sendRequest("connectors.getCapabilities", {}),
|
|
986
|
+
/**
|
|
987
|
+
* Returns eligible accounts.
|
|
988
|
+
*
|
|
989
|
+
* @returns Eligible accounts.
|
|
990
|
+
*/
|
|
991
|
+
getAccounts: async () => connection.sendRequest("connectors.getAccounts", {}),
|
|
992
|
+
/**
|
|
993
|
+
* Lists entries for the selected account.
|
|
994
|
+
*
|
|
995
|
+
* @param params Selected account.
|
|
996
|
+
*
|
|
997
|
+
* @returns Entries for the selected account.
|
|
998
|
+
*/
|
|
999
|
+
list: async (params) => connection.sendRequest("connectors.list", params),
|
|
1000
|
+
/**
|
|
1001
|
+
* Refreshes entries for the selected account.
|
|
1002
|
+
*
|
|
1003
|
+
* @param params Selected account.
|
|
1004
|
+
*
|
|
1005
|
+
* @returns Entries for the selected account.
|
|
1006
|
+
*/
|
|
1007
|
+
refresh: async (params) => connection.sendRequest("connectors.refresh", params)
|
|
942
1008
|
}
|
|
943
1009
|
};
|
|
944
1010
|
}
|
|
@@ -994,6 +1060,133 @@ function createInternalServerRpc(connection) {
|
|
|
994
1060
|
*/
|
|
995
1061
|
connect: async (params) => connection.sendRequest("connect", params),
|
|
996
1062
|
/** @experimental */
|
|
1063
|
+
agents: {
|
|
1064
|
+
/**
|
|
1065
|
+
* Lists the agents this runtime ships, by name. A consumer separating shipped agents from ones the user or a plugin authored should compare against these names rather than against `AgentInfo.source`: an authored agent may carry the `builtin` source while not being one of these, and the runtime treats the two as separate questions. `disableableNames` is the subset a user may turn off, which a client needs to decide whether to offer a toggle. `yamlBasedNames` is the subset backed by a shipped YAML definition, which a client needs before asking the runtime to load one.
|
|
1066
|
+
*
|
|
1067
|
+
* @returns The agents this runtime ships, named so a consumer can tell them apart from authored ones.
|
|
1068
|
+
*/
|
|
1069
|
+
getBuiltins: async () => connection.sendRequest("agents.getBuiltins", {}),
|
|
1070
|
+
/**
|
|
1071
|
+
* Lists the shipped agents a client should offer right now, filtered by the feature flags it passes. `getBuiltins` names every agent the runtime knows about; some of those are gated, so a client rendering a picker wants this narrower list together with the description to show beside each name.
|
|
1072
|
+
*
|
|
1073
|
+
* @param params The feature flags to evaluate shipped agents against.
|
|
1074
|
+
*
|
|
1075
|
+
* @returns The shipped agents available under the requested flags.
|
|
1076
|
+
*/
|
|
1077
|
+
getAvailableBuiltins: async (params) => connection.sendRequest("agents.getAvailableBuiltins", params),
|
|
1078
|
+
/**
|
|
1079
|
+
* Loads one shipped agent's YAML definition, for a client that needs what the agent declares rather than only its name. `getBuiltins` reports which names have a definition to load: a name outside its `yamlBasedNames` is special-cased in code and has none. The definition crosses as its own JSON rather than as contract-typed fields, because the runtime parses it with the agent schema's tolerant shape and re-typing it here would drop the keys that shape accepts and this one does not. The projected `__nativeCustomAgent` view the runtime derives is included, so a caller reading the declared model and a caller rendering the agent see the same definition.
|
|
1080
|
+
*
|
|
1081
|
+
* @param params The shipped agent whose definition to load.
|
|
1082
|
+
*
|
|
1083
|
+
* @returns One shipped agent's definition.
|
|
1084
|
+
*/
|
|
1085
|
+
getBuiltinDefinition: async (params) => connection.sendRequest("agents.getBuiltinDefinition", params),
|
|
1086
|
+
/**
|
|
1087
|
+
* Projects one shipped agent the way a picker lists it, reading only the metadata at the head of the definition file and stopping before the prompt body. `getBuiltinDefinition` answers the whole definition instead, so a client listing every shipped agent should prefer this one: the cost of a listing grows with the number of agents, and the prompt body is the part a listing never shows. The two also differ in shape. This returns the projected custom agent on its own, whereas `getBuiltinDefinition` returns the authored definition with that projection nested under `__nativeCustomAgent`.
|
|
1088
|
+
*
|
|
1089
|
+
* @param params The shipped agent whose listing entry to load.
|
|
1090
|
+
*
|
|
1091
|
+
* @returns One shipped agent, projected for a listing.
|
|
1092
|
+
*/
|
|
1093
|
+
getBuiltinListingDefinition: async (params) => connection.sendRequest("agents.getBuiltinListingDefinition", params),
|
|
1094
|
+
/**
|
|
1095
|
+
* Resolves the model a custom agent asks for against the models actually available, and answers both the model to switch to and the warning a user should see when the agent's preference cannot be met. A custom agent may name several acceptable models in preference order, so the decision is a match rather than a lookup, and an agent whose preference is unavailable is a normal outcome that produces a warning rather than an error. A host must call this rather than pick the first available name itself, because the preference order and the wording of the warning are what keep one installation's agent selection the same as another's.
|
|
1096
|
+
*
|
|
1097
|
+
* @param params The models a custom agent asks for, and the models actually available.
|
|
1098
|
+
*
|
|
1099
|
+
* @returns The model to switch to, and the warning to show when the agent's preference could not be met.
|
|
1100
|
+
*/
|
|
1101
|
+
customAgentInitialModelDecision: async (params) => connection.sendRequest("agents.customAgentInitialModelDecision", params)
|
|
1102
|
+
},
|
|
1103
|
+
/** @experimental */
|
|
1104
|
+
globalState: {
|
|
1105
|
+
/**
|
|
1106
|
+
* Reads the host's machine-wide state: which plugins are installed and the one-off flags and timestamps that record what the user has already been shown or migrated. This is the state that outlives a single session and a single workspace, so a host reads it to decide whether to run a first-launch step, offer an onboarding prompt, or skip one it has already completed. The stored credentials are deliberately not part of this result; a caller that needs an authenticated identity asks the account methods for it instead. Reading is non-destructive and every field is optional, because a fresh install has recorded nothing yet.
|
|
1107
|
+
*
|
|
1108
|
+
* @returns The host's machine-wide state. Every field is optional because a fresh install has recorded nothing yet, so a reader must treat an absent field as `not yet`, never as a negative answer. Stored credentials are deliberately absent from this shape.
|
|
1109
|
+
*/
|
|
1110
|
+
load: async () => connection.sendRequest("globalState.load", {}),
|
|
1111
|
+
/**
|
|
1112
|
+
* Reads the host's machine-wide state exactly as `globalState.load` does, but from a caller-supplied configuration directory instead of the one the server resolved for itself. Use this when a consumer scopes a session to its own Copilot home — the SDK's per-session `configDir` override — so the state read matches the directory that session actually uses. An absent or empty `configDir` resolves the server's own home, making this identical to `globalState.load`. The stored credentials are omitted here for the same reason they are omitted from `globalState.load`: a caller that needs an authenticated identity asks the account methods instead, so pointing this at another directory cannot be used to read the credentials kept in it.
|
|
1113
|
+
*
|
|
1114
|
+
* @param params Selects the configuration directory whose machine-wide state to read.
|
|
1115
|
+
*
|
|
1116
|
+
* @returns The host's machine-wide state. Every field is optional because a fresh install has recorded nothing yet, so a reader must treat an absent field as `not yet`, never as a negative answer. Stored credentials are deliberately absent from this shape.
|
|
1117
|
+
*/
|
|
1118
|
+
loadForConfigDir: async (params) => connection.sendRequest("globalState.loadForConfigDir", params),
|
|
1119
|
+
/**
|
|
1120
|
+
* Records one top-level key in the host's machine-wide state, the counterpart to `globalState.load`. A host calls this to remember that it has shown an onboarding step, asked a one-off question, or completed a migration, so the next run can skip it. Only the named key is replaced and the rest of the document is preserved, which lets two writers record different flags without overwriting each other; passing no value removes the key instead. Only the keys a host records itself are writable: `appInstallNudgeResponded`, `appTipShown`, `askedSetupTerminals`, `autoFeedbackLastPromptedAt`, `firstLaunchAt`, `recentModelIds`, `sandboxCredentialProxyCaDeclined` and `sandboxOnboardingShown`. Every other key is refused, including `installedPlugins`, the stored credentials, `trustedFolders`, the staff flags and the signed-in accounts. Plugin enablement must use the plugin APIs, which apply repository and managed-policy checks.
|
|
1121
|
+
*
|
|
1122
|
+
* @param params A single top-level key to record in the host's machine-wide state. The write replaces only that key and leaves the rest of the document untouched, so two writers recording different one-off flags do not overwrite each other. The stored credential keys cannot be written through this method.
|
|
1123
|
+
*/
|
|
1124
|
+
writeKey: async (params) => connection.sendRequest("globalState.writeKey", params)
|
|
1125
|
+
},
|
|
1126
|
+
/** @experimental */
|
|
1127
|
+
gitHubRepository: {
|
|
1128
|
+
/**
|
|
1129
|
+
* Resolves the GitHub repository that owns a working-tree path by reading the selected git remote configured for it, preferring `origin`. Returns a null `repository` when the path is inside a git working tree but that selected remote does not resolve to a GitHub host. Fails when the path is not inside a git working tree at all, so a caller can tell 'not a repository' apart from 'a repository with no GitHub remote'.
|
|
1130
|
+
*
|
|
1131
|
+
* @param params Working-tree path whose owning GitHub repository should be resolved.
|
|
1132
|
+
*
|
|
1133
|
+
* @returns The GitHub repository that owns the requested path, when the selected remote (`origin`, else the first) is on a GitHub host.
|
|
1134
|
+
*/
|
|
1135
|
+
atPath: async (params) => connection.sendRequest("gitHubRepository.atPath", params)
|
|
1136
|
+
},
|
|
1137
|
+
/** @experimental */
|
|
1138
|
+
gitHubOwners: {
|
|
1139
|
+
/**
|
|
1140
|
+
* Registers a cancellable owner listing and returns its request id. Separate from `gitHubOwners.list` so the id exists before the listing starts: a caller that abandons the listing the moment it begins would otherwise have nothing to name in `gitHubOwners.cancel`. The id serves one listing only. Long-abandoned unused ids can be released by later allocations.
|
|
1141
|
+
*
|
|
1142
|
+
* @returns A freshly registered request id. Registering it before the listing starts is what lets a cancel that races the request still find the owner listing slot. The id serves one listing only. Long-abandoned unused ids can be released by later allocations.
|
|
1143
|
+
*/
|
|
1144
|
+
nextRequestId: async () => connection.sendRequest("gitHubOwners.nextRequestId", {}),
|
|
1145
|
+
/**
|
|
1146
|
+
* Lists the logins the authenticated user may act as — their own account first, then the organizations they belong to — by asking the GitHub API under the supplied credential. No credential travels in the request: `authInfo` selects one the runtime already holds, and the runtime resolves the token and the GitHub host from it. A failure the caller should render arrives as `message`; one it should raise arrives as `throwError`.
|
|
1147
|
+
*
|
|
1148
|
+
* @param params Credential to list owners under, and the request id that makes the listing cancellable.
|
|
1149
|
+
*
|
|
1150
|
+
* @returns Outcome of an owner listing. Exactly one of `owners` and `message` is present, except that `throwError` reports a failure the caller is expected to raise rather than render.
|
|
1151
|
+
*/
|
|
1152
|
+
list: async (params) => connection.sendRequest("gitHubOwners.list", params),
|
|
1153
|
+
/**
|
|
1154
|
+
* Abandons an owner listing started with the given request id. Answers `canceled: true` while a listing with that id is running. Answers `canceled: false` when the id was never registered, was registered but not used, was released after being abandoned, or its listing has ended. Canceling an unused id releases it, and a later `list` with that id is refused. The cancel acts only on owner listings and never reaches another request of the host.
|
|
1155
|
+
*
|
|
1156
|
+
* @param params The owner listing to abandon.
|
|
1157
|
+
*
|
|
1158
|
+
* @returns Whether the id named a running owner listing.
|
|
1159
|
+
*/
|
|
1160
|
+
cancel: async (params) => connection.sendRequest("gitHubOwners.cancel", params)
|
|
1161
|
+
},
|
|
1162
|
+
/** @experimental */
|
|
1163
|
+
git: {
|
|
1164
|
+
/**
|
|
1165
|
+
* Reads the remote that the branch checked out in a working tree tracks, as `branch.<name>.remote` configures it. Reports `origin` rather than failing whenever there is no tracking configuration to read — on a detached HEAD, on a branch with no upstream, or when git itself fails — because a caller asking which remote to talk to needs an answer it can act on, not an error. Marked internal because it exists to carry a CLI call site off the napi boundary onto the SDK contract; it is migration plumbing, not a surface consumers are meant to depend on.
|
|
1166
|
+
*
|
|
1167
|
+
* @param params Working-tree path a git query applies to.
|
|
1168
|
+
*
|
|
1169
|
+
* @returns The remote the checked-out branch tracks.
|
|
1170
|
+
*/
|
|
1171
|
+
currentBranchRemote: async (params) => connection.sendRequest("git.currentBranchRemote", params),
|
|
1172
|
+
/**
|
|
1173
|
+
* Collects the repository context of a working directory in one call: working tree root, repository identifier and host, current branch, and the HEAD and base commits. Every repository field is omitted when the path is not inside a git working tree, and the requested path is echoed back as `cwd`. The answer is the same `SessionWorkingDirectoryContext` that `session.metadata.recordContextChange` accepts, so a caller polling for a context change can forward the result unchanged. Marked internal because it exists to carry a CLI call site off the napi boundary onto the SDK contract; it is migration plumbing, not a surface consumers are meant to depend on. It can become public once an SDK consumer needs to derive session context from a directory itself.
|
|
1174
|
+
*
|
|
1175
|
+
* @param params Working-tree path a git query applies to.
|
|
1176
|
+
*
|
|
1177
|
+
* @returns Updated working directory and git context. Emitted as the new payload of `session.context_changed`.
|
|
1178
|
+
*/
|
|
1179
|
+
workingDirectoryContext: async (params) => connection.sendRequest("git.workingDirectoryContext", params),
|
|
1180
|
+
/**
|
|
1181
|
+
* Lists the GitHub repositories a working tree's remotes point at, one entry per distinct repository, so a caller can resolve a base and head repository without parsing remote URLs itself. When several remotes name the same repository, only the first is listed, and the entry keeps that remote name. Remotes pointing at no GitHub host are left out, so an empty list means the tree reaches GitHub through no remote. Failing to read the remotes is reported as an error rather than as an empty list, because the two mean different things to a caller. Marked internal because it exists to carry a CLI call site off the napi boundary onto the SDK contract; it is migration plumbing, not a surface consumers are meant to depend on.
|
|
1182
|
+
*
|
|
1183
|
+
* @param params Git working tree whose GitHub remotes should be listed.
|
|
1184
|
+
*
|
|
1185
|
+
* @returns The GitHub repositories a working tree's remotes point at.
|
|
1186
|
+
*/
|
|
1187
|
+
reposFromRemotes: async (params) => connection.sendRequest("git.reposFromRemotes", params)
|
|
1188
|
+
},
|
|
1189
|
+
/** @experimental */
|
|
997
1190
|
sessions: {
|
|
998
1191
|
/**
|
|
999
1192
|
* Reads lightweight persisted metadata for one local session without opening it.
|
|
@@ -1033,6 +1226,30 @@ function createInternalServerRpc(connection) {
|
|
|
1033
1226
|
* @param params Session ID to delete from disk.
|
|
1034
1227
|
*/
|
|
1035
1228
|
delete: async (params) => connection.sendRequest("sessions.delete", params),
|
|
1229
|
+
/**
|
|
1230
|
+
* Creates the workspace record for a session that has not been opened yet. A host that hands a session off to another application — writing the record and then launching that application against the session ID — needs the record on disk before any session exists to carry it, which the session-scoped workspace methods cannot do. Replaces any existing record and resets the checkpoint index. When writing to the local filesystem, a stored `fork_count` survives on disk. Returns the record it built, so a surviving stored `fork_count` can differ from the answer.
|
|
1231
|
+
*
|
|
1232
|
+
* @param params Identity, state location and starting context for a workspace record.
|
|
1233
|
+
*
|
|
1234
|
+
* @returns The workspace record that was written.
|
|
1235
|
+
*/
|
|
1236
|
+
createWorkspace: async (params) => connection.sendRequest("sessions.createWorkspace", params),
|
|
1237
|
+
/**
|
|
1238
|
+
* Reads a session's workspace record straight from disk, without opening the session. Resuming by session ID has to know where the session lives before it can connect, so the lookup cannot come from the session-scoped workspace methods, which resolve their location from a live session's context. Returns no record when the file is absent.
|
|
1239
|
+
*
|
|
1240
|
+
* @param params Where the session's state lives, as a root directory and the session ID under it.
|
|
1241
|
+
*
|
|
1242
|
+
* @returns The workspace record on disk, omitted when the session has none.
|
|
1243
|
+
*/
|
|
1244
|
+
loadWorkspace: async (params) => connection.sendRequest("sessions.loadWorkspace", params),
|
|
1245
|
+
/**
|
|
1246
|
+
* Merges fields into a session's workspace record on disk, creating the record when it is absent. The counterpart to `sessions.loadWorkspace`, for the same before-the-session-exists case. It preserves stored workspace-schema fields the request does not supply, does not preserve stored keys outside the workspace schema, and never replaces a stored `fork_count`.
|
|
1247
|
+
*
|
|
1248
|
+
* @param params Where the session's state lives, plus workspace-schema fields to merge into its workspace record. Stored keys outside the schema are not preserved, and a stored `fork_count` is never replaced.
|
|
1249
|
+
*
|
|
1250
|
+
* @returns The merge completed. The record carries the supplied workspace-schema fields, but a stored `fork_count` stays.
|
|
1251
|
+
*/
|
|
1252
|
+
updateWorkspaceFields: async (params) => connection.sendRequest("sessions.updateWorkspaceFields", params),
|
|
1036
1253
|
/**
|
|
1037
1254
|
* 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.
|
|
1038
1255
|
*
|
|
@@ -1047,22 +1264,55 @@ function createInternalServerRpc(connection) {
|
|
|
1047
1264
|
* @param params Params to attach or detach an in-process ExtensionController delegate.
|
|
1048
1265
|
*/
|
|
1049
1266
|
configureSessionExtensions: async (params) => connection.sendRequest("sessions.configureSessionExtensions", params)
|
|
1050
|
-
},
|
|
1051
|
-
/** @experimental */
|
|
1052
|
-
accounts: {
|
|
1053
|
-
/**
|
|
1054
|
-
* Acquire a Microsoft Entra access token through the runtime's OneAuth broker. Account-scoped because it uses the same native broker as the account stack: a trusted host application mints a scoped Entra token for its own use, most notably to authenticate to a remote MCP server whose authorization server is Entra ID (in place of the generic browser-OAuth flow).
|
|
1055
|
-
*
|
|
1056
|
-
* @param params OneAuth token request supplied by a trusted host application.
|
|
1057
|
-
*
|
|
1058
|
-
* @returns Result of a OneAuth token acquisition.
|
|
1059
|
-
*/
|
|
1060
|
-
acquireEntraToken: async (params) => connection.sendRequest("accounts.acquireEntraToken", params)
|
|
1061
1267
|
}
|
|
1062
1268
|
};
|
|
1063
1269
|
}
|
|
1064
1270
|
function createSessionRpc(connection, sessionId) {
|
|
1065
1271
|
return {
|
|
1272
|
+
/** @experimental */
|
|
1273
|
+
providers: {
|
|
1274
|
+
/**
|
|
1275
|
+
* Returns adapter definitions and supported operations in this session's effective provider catalog, without running discovery. Does not list provider instances or select inference models.
|
|
1276
|
+
*
|
|
1277
|
+
* @returns Normalized model-provider adapter definitions available to the session, not discovered instances.
|
|
1278
|
+
*/
|
|
1279
|
+
getCatalog: async () => connection.sendRequest("session.providers.getCatalog", { sessionId }),
|
|
1280
|
+
/**
|
|
1281
|
+
* Discovers reachable instances using an adapter from this session's effective provider catalog and provider-specific discovery input.
|
|
1282
|
+
*
|
|
1283
|
+
* @param params Provider discovery parameters.
|
|
1284
|
+
*
|
|
1285
|
+
* @returns Provider instances found by a discovery operation.
|
|
1286
|
+
*/
|
|
1287
|
+
discover: async (params) => connection.sendRequest("session.providers.discover", { ...params, sessionId }),
|
|
1288
|
+
/**
|
|
1289
|
+
* Gets current health and version information for a discovered model-provider instance.
|
|
1290
|
+
*
|
|
1291
|
+
* @param params Provider status request parameters.
|
|
1292
|
+
*
|
|
1293
|
+
* @returns Current health information for a provider instance.
|
|
1294
|
+
*/
|
|
1295
|
+
getStatus: async (params) => connection.sendRequest("session.providers.getStatus", { ...params, sessionId }),
|
|
1296
|
+
/** @experimental */
|
|
1297
|
+
models: {
|
|
1298
|
+
/**
|
|
1299
|
+
* Lists models installed or otherwise available from a discovered model-provider instance.
|
|
1300
|
+
*
|
|
1301
|
+
* @param params Provider model inventory request parameters.
|
|
1302
|
+
*
|
|
1303
|
+
* @returns Models offered for agent conversations by one provider instance. Adapters exclude known-incompatible models, but retain candidates with unknown capabilities. Listing does not guarantee compatibility.
|
|
1304
|
+
*/
|
|
1305
|
+
list: async (params) => connection.sendRequest("session.providers.models.list", { ...params, sessionId }),
|
|
1306
|
+
/**
|
|
1307
|
+
* Translates a discovered model into the provider and model configuration needed to use it, and reports whether each is already registered in this session. Prepares only: it registers nothing, writes nothing, and performs no provider requests.
|
|
1308
|
+
*
|
|
1309
|
+
* @param params A discovered instance and one of its models to translate into provider configuration. Pass back the instance and model as returned by `session.providers.discover` and `session.providers.models.list`.
|
|
1310
|
+
*
|
|
1311
|
+
* @returns Provider configuration prepared from a discovered model. Preparing a plan changes nothing: it neither registers the model with the session nor writes durable configuration. To apply it, pass `provider` and `model` to `session.provider.add`, omitting whichever the dispositions report as already configured.
|
|
1312
|
+
*/
|
|
1313
|
+
prepareConfiguration: async (params) => connection.sendRequest("session.providers.models.prepareConfiguration", { ...params, sessionId })
|
|
1314
|
+
}
|
|
1315
|
+
},
|
|
1066
1316
|
/**
|
|
1067
1317
|
* Suspends the session while preserving persisted state for later resume.
|
|
1068
1318
|
*
|
|
@@ -1670,16 +1920,18 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1670
1920
|
*/
|
|
1671
1921
|
getSources: async () => connection.sendRequest("session.instructions.getSources", { sessionId }),
|
|
1672
1922
|
/**
|
|
1673
|
-
*
|
|
1923
|
+
* For local sessions, invalidates instruction discovery and the model-facing prompt, then returns freshly discovered sources. The updated prompt takes effect on the next turn. Remote sessions must reload on their agent host instead.
|
|
1924
|
+
*
|
|
1925
|
+
* @returns Instruction sources loaded for the session, in merge order.
|
|
1674
1926
|
*/
|
|
1675
1927
|
reload: async () => connection.sendRequest("session.instructions.reload", { sessionId })
|
|
1676
1928
|
},
|
|
1677
1929
|
/** @experimental */
|
|
1678
1930
|
customizations: {
|
|
1679
1931
|
/**
|
|
1680
|
-
*
|
|
1932
|
+
* For local sessions, reconciles repository context and discovered instructions, plugins, skills, agents, hooks, MCP servers, and extensions after files appear or change under the working directory. Independent component failures are returned in outcomes and errors; a rejected call can have partially applied earlier steps. Remote sessions must reload on their agent host instead. The model-facing context is rebuilt on the next turn.
|
|
1681
1933
|
*
|
|
1682
|
-
* @returns
|
|
1934
|
+
* @returns Results of reloading discovered session customizations. Inspect outcomes for reloaded, skipped, or failed subsystems; a rejection may follow partial mutation. Changes to the model-facing prompt and tools apply on the next turn.
|
|
1683
1935
|
*/
|
|
1684
1936
|
reload: async () => connection.sendRequest("session.customizations.reload", { sessionId })
|
|
1685
1937
|
},
|
|
@@ -1872,11 +2124,17 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1872
2124
|
/** @experimental */
|
|
1873
2125
|
mcp: {
|
|
1874
2126
|
/**
|
|
1875
|
-
* Lists MCP servers
|
|
2127
|
+
* Lists materialized MCP servers and their connection status. Cache misses may start and wait for MCP servers.
|
|
1876
2128
|
*
|
|
1877
2129
|
* @returns MCP servers configured for the session, with their connection status and host-level state.
|
|
1878
2130
|
*/
|
|
1879
2131
|
list: async () => connection.sendRequest("session.mcp.list", { sessionId }),
|
|
2132
|
+
/**
|
|
2133
|
+
* Lists effective MCP configuration without starting, restarting, authenticating, or waiting for servers. An optional live observation is from an already materialized matching server; this is not a readiness guarantee.
|
|
2134
|
+
*
|
|
2135
|
+
* @returns Effective MCP configuration with optional live observations from matching already materialized servers.
|
|
2136
|
+
*/
|
|
2137
|
+
listConfigured: async () => connection.sendRequest("session.mcp.listConfigured", { sessionId }),
|
|
1880
2138
|
/**
|
|
1881
2139
|
* 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.
|
|
1882
2140
|
*
|
|
@@ -3325,6 +3583,12 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
3325
3583
|
},
|
|
3326
3584
|
/** @experimental */
|
|
3327
3585
|
mcp: {
|
|
3586
|
+
/**
|
|
3587
|
+
* Records the IDE the host is connected to, so the agent's system prompt can name it and its workspace folder. Null or an omitted `ide` clears the recorded value, which is how a host reports that it is disconnected; there is no separate clear method. Both `ideName` and `workspaceFolder` are required together, because half a state cannot be attributed to a project.
|
|
3588
|
+
*
|
|
3589
|
+
* @param params Records which IDE the host is connected to, or clears it.
|
|
3590
|
+
*/
|
|
3591
|
+
setConnectedIdeInfo: async (params) => connection.sendRequest("session.mcp.setConnectedIdeInfo", { ...params, sessionId }),
|
|
3328
3592
|
/**
|
|
3329
3593
|
* Reloads MCP server connections for the session with an explicit host-provided configuration.
|
|
3330
3594
|
*
|
|
@@ -3383,6 +3647,33 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
3383
3647
|
finalizeInvocationEffect: async (params) => connection.sendRequest("session.commands.finalizeInvocationEffect", { ...params, sessionId })
|
|
3384
3648
|
},
|
|
3385
3649
|
/** @experimental */
|
|
3650
|
+
ui: {
|
|
3651
|
+
/**
|
|
3652
|
+
* Resolves a pending elicitation request after direct interaction in the trusted in-process client. Only an accepted response to the built-in ask_user tool can become trusted human evidence.
|
|
3653
|
+
*
|
|
3654
|
+
* @param params Pending elicitation request ID and the user's response (accept/decline/cancel + form values).
|
|
3655
|
+
*
|
|
3656
|
+
* @returns Indicates whether the elicitation response was accepted; false if it was already resolved by another client.
|
|
3657
|
+
*/
|
|
3658
|
+
handleHumanAskUser: async (params) => connection.sendRequest("session.ui.handleHumanAskUser", { ...params, sessionId }),
|
|
3659
|
+
/**
|
|
3660
|
+
* Resolves a pending `user_input.requested` event after direct interaction in the trusted in-process client.
|
|
3661
|
+
*
|
|
3662
|
+
* @param params Request ID of a pending `user_input.requested` event and the user's response.
|
|
3663
|
+
*
|
|
3664
|
+
* @returns Indicates whether the pending UI request was resolved by this call.
|
|
3665
|
+
*/
|
|
3666
|
+
handleHumanUserInput: async (params) => connection.sendRequest("session.ui.handleHumanUserInput", { ...params, sessionId }),
|
|
3667
|
+
/**
|
|
3668
|
+
* Resolves a pending `exit_plan_mode.requested` event after direct interaction in the trusted in-process client.
|
|
3669
|
+
*
|
|
3670
|
+
* @param params Request ID of a pending `exit_plan_mode.requested` event and the user's response.
|
|
3671
|
+
*
|
|
3672
|
+
* @returns Indicates whether the pending UI request was resolved by this call.
|
|
3673
|
+
*/
|
|
3674
|
+
handleHumanExitPlanMode: async (params) => connection.sendRequest("session.ui.handleHumanExitPlanMode", { ...params, sessionId })
|
|
3675
|
+
},
|
|
3676
|
+
/** @experimental */
|
|
3386
3677
|
settings: {
|
|
3387
3678
|
/**
|
|
3388
3679
|
* 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.
|
|
@@ -3535,11 +3826,21 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
|
3535
3826
|
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
|
3536
3827
|
return handler.readFile(params);
|
|
3537
3828
|
});
|
|
3829
|
+
connection.onRequest("sessionFs.readFileBytes", async (params) => {
|
|
3830
|
+
const handler = getHandlers(params.sessionId).sessionFs;
|
|
3831
|
+
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
|
3832
|
+
return handler.readFileBytes(params);
|
|
3833
|
+
});
|
|
3538
3834
|
connection.onRequest("sessionFs.writeFile", async (params) => {
|
|
3539
3835
|
const handler = getHandlers(params.sessionId).sessionFs;
|
|
3540
3836
|
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
|
3541
3837
|
return handler.writeFile(params);
|
|
3542
3838
|
});
|
|
3839
|
+
connection.onRequest("sessionFs.writeFileBytes", async (params) => {
|
|
3840
|
+
const handler = getHandlers(params.sessionId).sessionFs;
|
|
3841
|
+
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
|
3842
|
+
return handler.writeFileBytes(params);
|
|
3843
|
+
});
|
|
3543
3844
|
connection.onRequest("sessionFs.appendFile", async (params) => {
|
|
3544
3845
|
const handler = getHandlers(params.sessionId).sessionFs;
|
|
3545
3846
|
if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
|
package/dist/cjs/index.js
CHANGED
|
@@ -32,6 +32,7 @@ __export(index_exports, {
|
|
|
32
32
|
RuntimeConnection: () => import_types.RuntimeConnection,
|
|
33
33
|
SYSTEM_MESSAGE_SECTIONS: () => import_types2.SYSTEM_MESSAGE_SECTIONS,
|
|
34
34
|
SessionFsSqliteTransactionFailure: () => import_types2.SessionFsSqliteTransactionFailure,
|
|
35
|
+
SessionFsWriteFailure: () => import_types2.SessionFsWriteFailure,
|
|
35
36
|
ToolSet: () => import_toolSet.ToolSet,
|
|
36
37
|
WorkflowResumeError: () => import_workflow.WorkflowResumeError,
|
|
37
38
|
approveAll: () => import_types2.approveAll,
|
|
@@ -68,6 +69,7 @@ var import_types2 = require("./types.js");
|
|
|
68
69
|
RuntimeConnection,
|
|
69
70
|
SYSTEM_MESSAGE_SECTIONS,
|
|
70
71
|
SessionFsSqliteTransactionFailure,
|
|
72
|
+
SessionFsWriteFailure,
|
|
71
73
|
ToolSet,
|
|
72
74
|
WorkflowResumeError,
|
|
73
75
|
approveAll,
|