@microsoft/copilot-sdk 1.0.29-unstable.42916223485.gfff36db → 2.0.0-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -62
- package/dist/canvas.d.ts +4 -0
- package/dist/canvas.js +1 -0
- package/dist/cjs/canvas.js +1 -0
- package/dist/cjs/cliVersion.js +1 -1
- package/dist/cjs/client.js +294 -107
- package/dist/cjs/copilotRequestHandler.js +24 -1
- package/dist/cjs/extension.js +4 -1
- package/dist/cjs/generated/rpc.js +295 -16
- package/dist/cjs/index.js +12 -2
- package/dist/cjs/localModelJson.js +103 -0
- package/dist/cjs/providerConfiguration.js +39 -0
- package/dist/cjs/rpcCancellation.js +49 -0
- package/dist/cjs/session.js +155 -10
- package/dist/cjs/taskAnalyticsJson.js +47 -0
- package/dist/cjs/types.js +14 -3
- package/dist/cjs/workflow.js +145 -1
- package/dist/cliVersion.d.ts +1 -1
- package/dist/cliVersion.js +1 -1
- package/dist/client.d.ts +33 -14
- package/dist/client.js +294 -107
- package/dist/copilotRequestHandler.js +24 -1
- package/dist/extension.d.ts +12 -2
- package/dist/extension.js +4 -1
- package/dist/generated/lifecycle-diagnostics.d.ts +48 -40
- package/dist/generated/rpc.d.ts +3668 -500
- package/dist/generated/rpc.js +295 -16
- package/dist/generated/session-events.d.ts +358 -115
- package/dist/index.d.ts +9 -5
- package/dist/index.js +14 -2
- package/dist/localModelJson.d.ts +1 -0
- package/dist/localModelJson.js +69 -0
- package/dist/providerConfiguration.d.ts +3 -0
- package/dist/providerConfiguration.js +15 -0
- package/dist/rpcCancellation.d.ts +3 -0
- package/dist/rpcCancellation.js +25 -0
- package/dist/session.d.ts +64 -5
- package/dist/session.js +156 -10
- package/dist/taskAnalyticsJson.d.ts +8 -0
- package/dist/taskAnalyticsJson.js +12 -0
- package/dist/types.d.ts +223 -43
- package/dist/types.js +13 -3
- package/dist/workflow.d.ts +60 -14
- package/dist/workflow.js +143 -1
- package/docs/agent-author.md +11 -11
- package/docs/extensions.md +41 -2
- package/docs/workflows.md +52 -17
- package/package.json +16 -15
|
@@ -247,11 +247,25 @@ class CopilotRequestHandler {
|
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
|
+
const MAX_FINISHED_REQUEST_IDS = 256;
|
|
250
251
|
function createCopilotRequestAdapter(handler, getServerRpc) {
|
|
251
252
|
const pending = /* @__PURE__ */ new Map();
|
|
253
|
+
const finished = /* @__PURE__ */ new Set();
|
|
254
|
+
function rememberFinished(requestId) {
|
|
255
|
+
if (finished.has(requestId)) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
finished.add(requestId);
|
|
259
|
+
if (finished.size > MAX_FINISHED_REQUEST_IDS) {
|
|
260
|
+
finished.delete(finished.values().next().value);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
252
263
|
function getOrCreate(requestId) {
|
|
253
264
|
let exchange = pending.get(requestId);
|
|
254
265
|
if (!exchange) {
|
|
266
|
+
if (finished.has(requestId)) {
|
|
267
|
+
return void 0;
|
|
268
|
+
}
|
|
255
269
|
exchange = new CopilotRequestExchange(requestId, getServerRpc);
|
|
256
270
|
pending.set(requestId, exchange);
|
|
257
271
|
}
|
|
@@ -278,17 +292,26 @@ function createCopilotRequestAdapter(handler, getServerRpc) {
|
|
|
278
292
|
if (pending.get(exchange.requestId) === exchange) {
|
|
279
293
|
pending.delete(exchange.requestId);
|
|
280
294
|
}
|
|
295
|
+
rememberFinished(exchange.requestId);
|
|
281
296
|
}
|
|
282
297
|
}
|
|
283
298
|
return {
|
|
284
299
|
async httpRequestStart(params) {
|
|
285
300
|
const exchange = getOrCreate(params.requestId);
|
|
301
|
+
if (!exchange) {
|
|
302
|
+
throw new Error(
|
|
303
|
+
`llmInference.httpRequestStart for request "${params.requestId}", which already finished`
|
|
304
|
+
);
|
|
305
|
+
}
|
|
286
306
|
exchange.setContext(params);
|
|
287
307
|
void run(exchange);
|
|
288
308
|
return {};
|
|
289
309
|
},
|
|
290
310
|
async httpRequestChunk(params) {
|
|
291
|
-
|
|
311
|
+
const exchange = getOrCreate(params.requestId);
|
|
312
|
+
if (exchange) {
|
|
313
|
+
routeChunk(exchange, params);
|
|
314
|
+
}
|
|
292
315
|
return {};
|
|
293
316
|
},
|
|
294
317
|
cancelPending() {
|
package/dist/cjs/extension.js
CHANGED
|
@@ -53,7 +53,7 @@ async function joinSession(config = {}) {
|
|
|
53
53
|
void _stripped;
|
|
54
54
|
void _strippedSkillProvider;
|
|
55
55
|
void _strippedImageGeneration;
|
|
56
|
-
|
|
56
|
+
const session = await client.resumeSessionForExtension(
|
|
57
57
|
sessionId,
|
|
58
58
|
{
|
|
59
59
|
...rest,
|
|
@@ -63,6 +63,9 @@ async function joinSession(config = {}) {
|
|
|
63
63
|
{ workflows },
|
|
64
64
|
requestedEnvironmentVariables?.length ? { requestedEnvironmentVariables } : void 0
|
|
65
65
|
);
|
|
66
|
+
return Object.defineProperty(session, "fetch", {
|
|
67
|
+
get: () => client.rpc.fetch
|
|
68
|
+
});
|
|
66
69
|
}
|
|
67
70
|
// Annotate the CommonJS export names for ESM import in node:
|
|
68
71
|
0 && (module.exports = {
|
|
@@ -26,9 +26,126 @@ __export(rpc_exports, {
|
|
|
26
26
|
registerClientSessionApiHandlers: () => registerClientSessionApiHandlers
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(rpc_exports);
|
|
29
|
+
var import_rpcCancellation = require("../rpcCancellation.js");
|
|
29
30
|
var import_jsonrpcTypes = require("../jsonrpcTypes.js");
|
|
30
31
|
function createServerRpc(connection) {
|
|
31
32
|
return {
|
|
33
|
+
/** @experimental */
|
|
34
|
+
providers: {
|
|
35
|
+
/** @experimental */
|
|
36
|
+
config: {
|
|
37
|
+
/**
|
|
38
|
+
* Reads the server's saved provider settings and credential availability without returning secrets or activating models.
|
|
39
|
+
*
|
|
40
|
+
* @returns Saved configuration. Reading does not activate, select, or load a model.
|
|
41
|
+
*/
|
|
42
|
+
read: async () => connection.sendRequest("providers.config.read", {}),
|
|
43
|
+
/**
|
|
44
|
+
* Updates shared connection settings for a saved provider while preserving its credentials and other sensitive fields. This durable operation does not change any live session.
|
|
45
|
+
*
|
|
46
|
+
* @param params Request to replace shared settings for one saved provider.
|
|
47
|
+
*
|
|
48
|
+
* @returns Result of updating shared saved provider settings.
|
|
49
|
+
*/
|
|
50
|
+
updateProvider: async (params) => connection.sendRequest("providers.config.updateProvider", params),
|
|
51
|
+
/**
|
|
52
|
+
* Updates one saved provider model without changing its sibling models. This durable operation does not change any live session.
|
|
53
|
+
*
|
|
54
|
+
* @param params Request to replace one saved provider-local model definition.
|
|
55
|
+
*
|
|
56
|
+
* @returns Result of updating one saved provider model.
|
|
57
|
+
*/
|
|
58
|
+
updateModel: async (params) => connection.sendRequest("providers.config.updateModel", params),
|
|
59
|
+
/**
|
|
60
|
+
* Removes one model from the server's saved provider configuration and removes its provider only when no saved models remain. This durable operation does not change any live session.
|
|
61
|
+
*
|
|
62
|
+
* @param params Request to remove one saved provider-local model definition.
|
|
63
|
+
*
|
|
64
|
+
* @returns Result of removing one saved provider model.
|
|
65
|
+
*/
|
|
66
|
+
removeModel: async (params) => connection.sendRequest("providers.config.removeModel", params),
|
|
67
|
+
/**
|
|
68
|
+
* Adds a model to the server's saved provider configuration. This durable operation does not change any live session.
|
|
69
|
+
*
|
|
70
|
+
* @param params Request to add a model to the server-owned saved provider configuration.
|
|
71
|
+
*
|
|
72
|
+
* @returns Result of adding a model to the saved provider configuration.
|
|
73
|
+
*/
|
|
74
|
+
addModel: async (params) => connection.sendRequest("providers.config.addModel", params)
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
/** @experimental */
|
|
78
|
+
localModels: {
|
|
79
|
+
/**
|
|
80
|
+
* Configures this SDK connection's local model manager. Runtime admission, credentials, jobs, files, progress, and cancellation remain connection-owned. A source session supplies live registration and selection without extending its lifetime.
|
|
81
|
+
*
|
|
82
|
+
* @param params Host preferences for its connection-owned manager, not authorization claims.
|
|
83
|
+
*
|
|
84
|
+
* @returns Snapshot and transient notifications for one connection-owned manager.
|
|
85
|
+
*/
|
|
86
|
+
configure: async (params) => connection.sendRequest("localModels.configure", params),
|
|
87
|
+
/**
|
|
88
|
+
* Reads this connection's local model state without scanning files or contacting a registry. Does not expose another connection's jobs.
|
|
89
|
+
*
|
|
90
|
+
* @returns Snapshot and transient notifications for one connection-owned manager.
|
|
91
|
+
*/
|
|
92
|
+
inspect: async () => connection.sendRequest("localModels.inspect", {}),
|
|
93
|
+
/**
|
|
94
|
+
* Waits for a newer local model revision and returns current state plus unacknowledged host notifications. Only this SDK connection's manager is visible. Connection closure cancels the wait.
|
|
95
|
+
*
|
|
96
|
+
* @param params Acknowledged position in this connection's manager updates.
|
|
97
|
+
*
|
|
98
|
+
* @returns Snapshot and transient notifications for one connection-owned manager.
|
|
99
|
+
* @param signal Cancels this wait without closing the connection.
|
|
100
|
+
*/
|
|
101
|
+
watch: async (params, signal) => (0, import_rpcCancellation.sendCancellableRequest)(connection, "localModels.watch", params, signal),
|
|
102
|
+
/**
|
|
103
|
+
* Scans this connection's model files and schedules a catalog refresh under its current preferences and runtime admission.
|
|
104
|
+
*
|
|
105
|
+
* @param params Catalog refresh intent.
|
|
106
|
+
*/
|
|
107
|
+
refresh: async (params) => connection.sendRequest("localModels.refresh", params),
|
|
108
|
+
/**
|
|
109
|
+
* Loads the local model catalog under the background policy without repeating a completed successful fetch for unchanged access.
|
|
110
|
+
*/
|
|
111
|
+
prefetch: async () => connection.sendRequest("localModels.prefetch", {}),
|
|
112
|
+
/**
|
|
113
|
+
* Resolves current artifact access and resource requirements without changing the caller's descriptor or starting a download.
|
|
114
|
+
*
|
|
115
|
+
* @param params A model returned by this connection's catalog.
|
|
116
|
+
*
|
|
117
|
+
* @returns Runtime catalog entry, including installation and inference metadata.
|
|
118
|
+
*/
|
|
119
|
+
prepare: async (params) => connection.sendRequest("localModels.prepare", params),
|
|
120
|
+
/**
|
|
121
|
+
* Downloads, updates, or repairs a model through runtime-owned acquisition, registration, activation, and compensation. The connection-owned job can finish its saved registration after its source session closes. The call completes with that job.
|
|
122
|
+
*
|
|
123
|
+
* @param params Setup intent for one catalog model.
|
|
124
|
+
*/
|
|
125
|
+
setup: async (params) => connection.sendRequest("localModels.setup", params),
|
|
126
|
+
/**
|
|
127
|
+
* Removes a managed model's live and saved registration and local files under the connection-owned family lease. Preserves files if registration cleanup cannot safely finish.
|
|
128
|
+
*
|
|
129
|
+
* @param params A model returned by this connection's catalog.
|
|
130
|
+
*/
|
|
131
|
+
deleteModel: async (params) => connection.sendRequest("localModels.deleteModel", params),
|
|
132
|
+
/**
|
|
133
|
+
* Requests cancellation of this connection's setup job for the given catalog identifier. An identifier never grants access to another connection's jobs.
|
|
134
|
+
*
|
|
135
|
+
* @param params Identifier of a job or notice owned by this connection.
|
|
136
|
+
*/
|
|
137
|
+
cancel: async (params) => connection.sendRequest("localModels.cancel", params),
|
|
138
|
+
/**
|
|
139
|
+
* Cancels this connection's active setup jobs and waits for their cleanup. Removal jobs finish instead of stopping halfway through registration cleanup.
|
|
140
|
+
*/
|
|
141
|
+
cancelAll: async () => connection.sendRequest("localModels.cancelAll", {}),
|
|
142
|
+
/**
|
|
143
|
+
* Dismisses one notice from this connection's local model state.
|
|
144
|
+
*
|
|
145
|
+
* @param params Identifier of a job or notice owned by this connection.
|
|
146
|
+
*/
|
|
147
|
+
dismissNotice: async (params) => connection.sendRequest("localModels.dismissNotice", params)
|
|
148
|
+
},
|
|
32
149
|
/** @experimental */
|
|
33
150
|
sandbox: {
|
|
34
151
|
/** @experimental */
|
|
@@ -290,18 +407,21 @@ function createServerRpc(connection) {
|
|
|
290
407
|
listTokenPriceUnits: async (params) => connection.sendRequest("models.listTokenPriceUnits", params)
|
|
291
408
|
},
|
|
292
409
|
/** @experimental */
|
|
293
|
-
|
|
410
|
+
azureMl: {
|
|
294
411
|
/**
|
|
295
|
-
*
|
|
412
|
+
* Updates one managed model's persisted registration under its connection-owned Azure ML family lease. Captures prior rows for compensation, preserves unrelated configuration, and remains available after the originating chat session closes. Does not change a live session registry or selection.
|
|
296
413
|
*
|
|
297
|
-
* @param params
|
|
414
|
+
* @param params Managed Azure ML registration changes under a connection-owned family lease.
|
|
298
415
|
*
|
|
299
|
-
* @returns
|
|
416
|
+
* @returns Observable outcome of a scoped registration change.
|
|
300
417
|
*/
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
418
|
+
registration: async (params) => connection.sendRequest("azureMl.registration", params),
|
|
419
|
+
/**
|
|
420
|
+
* Reads local graphics memory off the caller thread for on-device model eligibility. Does not start a model server, resolve credentials, or contact a model registry.
|
|
421
|
+
*
|
|
422
|
+
* @returns Measured graphics capability; missing memory means the adapter is unknown.
|
|
423
|
+
*/
|
|
424
|
+
hardware: async () => connection.sendRequest("azureMl.hardware", {}),
|
|
305
425
|
/**
|
|
306
426
|
* Lists eligible Azure ML local models and redacted warnings before a chat session exists.
|
|
307
427
|
*
|
|
@@ -376,6 +496,17 @@ function createServerRpc(connection) {
|
|
|
376
496
|
discard: async (params) => connection.sendRequest("azureMl.discard", params)
|
|
377
497
|
},
|
|
378
498
|
/** @experimental */
|
|
499
|
+
decisions: {
|
|
500
|
+
/**
|
|
501
|
+
* Asks a decision model yes/no, pick-one, or rating questions about shared context and returns normalized probabilities. Sessionless, so a host can classify or route a request before any session exists. Requires the `DECISIONS_API` feature flag. A failed request is a JSON-RPC error whose `data` is a `DecisionErrorData`.
|
|
502
|
+
*
|
|
503
|
+
* @param params One request to a decision model: shared context plus the questions to answer about it.
|
|
504
|
+
*
|
|
505
|
+
* @returns The decision model's answers.
|
|
506
|
+
*/
|
|
507
|
+
ask: async (params) => connection.sendRequest("decisions.ask", params)
|
|
508
|
+
},
|
|
509
|
+
/** @experimental */
|
|
379
510
|
contentExclusion: {
|
|
380
511
|
/**
|
|
381
512
|
* Validates candidate content-exclusion policies and returns them normalized, without starting a session. This runs the same parser the runtime's own policy enforcement uses, so a host cannot accept a policy set the runtime would later reject, nor reject one it would have honored. Call it when policies arrive from outside the runtime — a command-line flag, a configuration file, a host's own settings — and must be checked before a session exists to apply them to. A malformed document fails with a message prefixed `Invalid JSON: `; a well-formed document that violates the policy schema fails with the offending field paths.
|
|
@@ -723,7 +854,23 @@ function createServerRpc(connection) {
|
|
|
723
854
|
*
|
|
724
855
|
* @returns Canonical locations where skills can be created so the runtime will recognize them.
|
|
725
856
|
*/
|
|
726
|
-
getDiscoveryPaths: async (params) => connection.sendRequest("skills.getDiscoveryPaths", params)
|
|
857
|
+
getDiscoveryPaths: async (params) => connection.sendRequest("skills.getDiscoveryPaths", params),
|
|
858
|
+
/**
|
|
859
|
+
* Installs a user-selected HTTPS or local skill file into personal or project storage, or registers a local discovery directory. This direct-source operation preserves source installation behavior; it does not accept or replace verified catalog plans, request catalog confirmation, or change skill enablement. The caller persists the returned discovery directories.
|
|
860
|
+
*
|
|
861
|
+
* @param params Installs a user-selected skill source without catalog plan semantics.
|
|
862
|
+
*
|
|
863
|
+
* @returns Result of direct source installation. Catalog consent and defaults remain separate.
|
|
864
|
+
*/
|
|
865
|
+
installSource: async (params) => connection.sendRequest("skills.installSource", params),
|
|
866
|
+
/**
|
|
867
|
+
* Removes a directly installed local skill or unregisters a discovery directory without deleting its contents. Directory removal needs no skill inventory. Other targets return needs-inventory without mutation when inventory is absent. This operation preserves direct-source ownership rules and does not replace receipt-backed verified uninstall plans or their consent. The caller persists returned discovery directories and manages disabled settings.
|
|
868
|
+
*
|
|
869
|
+
* @param params Removes a user-selected source without changing verified catalog removal.
|
|
870
|
+
*
|
|
871
|
+
* @returns Direct removal or a request for the inventory needed to resolve a file.
|
|
872
|
+
*/
|
|
873
|
+
removeSource: async (params) => connection.sendRequest("skills.removeSource", params)
|
|
727
874
|
},
|
|
728
875
|
/** @experimental */
|
|
729
876
|
plugins: {
|
|
@@ -969,9 +1116,42 @@ function createServerRpc(connection) {
|
|
|
969
1116
|
httpResponseChunk: async (params) => connection.sendRequest("llmInference.httpResponseChunk", params)
|
|
970
1117
|
},
|
|
971
1118
|
/** @experimental */
|
|
1119
|
+
fetch: {
|
|
1120
|
+
/**
|
|
1121
|
+
* Allocates a connection-owned HTTP request handle without network work. SDK clients and extensions can use this API without CLI admission. Cancel abandoned handles; disconnect disposes all handles.
|
|
1122
|
+
*
|
|
1123
|
+
* @returns The connection-owned HTTP request handle allocated by fetch.create.
|
|
1124
|
+
*/
|
|
1125
|
+
create: async () => connection.sendRequest("fetch.create", {}),
|
|
1126
|
+
/**
|
|
1127
|
+
* Sends a connection-owned handle once, with a required responseMode. Available to all SDK clients and extensions. Stream returns headers immediately; fetch.read returns body chunks over JSON-RPC, or fetch.cancel closes the body without reading it. Text consumes the complete body as WHATWG UTF-8 text with a default decoded limit of 1048576 bytes. File writes directly to a required destinationPath on the runtime host, with atomic no-overwrite creation; incomplete files are removed on failure or cancellation, and completed files belong to the caller and survive disconnect. Stream and file have no default body limit. Explicit bodyLimitBytes, including zero, fails without truncation. HTTP error statuses remain responses. Cancel can interrupt header waits and body consumption. Optional credential contexts resolve fresh credentials; omission adds no service authentication. Revocation applies through redirects under the original authority. Credential failures use -32004; transport failures preserve -32603 and FetchTransportErrorData; filesystem failures use -32603 and FetchFileErrorData. No shared circuit breaker is selected. Retries remain caller-owned.
|
|
1128
|
+
*
|
|
1129
|
+
* @param params An HTTP request through the shared network transport.
|
|
1130
|
+
*
|
|
1131
|
+
* @returns HTTP response metadata and the selected body representation. HTTP error statuses remain successful transport outcomes.
|
|
1132
|
+
*/
|
|
1133
|
+
send: async (params) => connection.sendRequest("fetch.send", params),
|
|
1134
|
+
/**
|
|
1135
|
+
* Reads one connection-owned response byte range or EOF. Response chunks cross JSON-RPC as base64; prefer fetch.send with file mode for large bodies. Call only after fetch.send returns in stream mode, with at most one read outstanding. The runtime reads the next chunk on demand. EOF, failure, cancellation, and disconnect dispose the handle. Active credential failures use JSON-RPC code -32004 and CredentialContextErrorData in error.data. Body transport failures preserve code -32603 and the legacy message, with FetchTransportErrorData containing unchanged engine classifications. Already disposed handles remain closed-handle errors, never credential_unavailable.
|
|
1136
|
+
*
|
|
1137
|
+
* @param params A fetch handle owned by the SDK connection that created it.
|
|
1138
|
+
*
|
|
1139
|
+
* @returns A response byte range, or EOF. EOF and transport failures dispose the handle.
|
|
1140
|
+
*/
|
|
1141
|
+
read: async (params) => connection.sendRequest("fetch.read", params),
|
|
1142
|
+
/**
|
|
1143
|
+
* Disposes an owned handle and cancels any pending send or read. Safe before send and after disposal. Unknown and foreign handles are unchanged. Closes an unread stream without draining its body. Incomplete files are removed after pending file I/O settles; completed caller-owned files remain.
|
|
1144
|
+
*
|
|
1145
|
+
* @param params A fetch handle owned by the SDK connection that created it.
|
|
1146
|
+
*
|
|
1147
|
+
* @returns Result of disposing a fetch handle.
|
|
1148
|
+
*/
|
|
1149
|
+
cancel: async (params) => connection.sendRequest("fetch.cancel", params)
|
|
1150
|
+
},
|
|
1151
|
+
/** @experimental */
|
|
972
1152
|
network: {
|
|
973
1153
|
/**
|
|
974
|
-
* Registers the calling SDK client's network callbacks, replacing any previous registration. With `resolveProxy`, the client decides the proxies for every request the runtime would otherwise route by ambient proxy settings (proxy environment variables, `NO_PROXY` and operating-system settings), or leaves a request to that routing; requests with an explicitly configured proxy and loopback targets never consult it. With `authenticateNegotiate`, the client supplies the Kerberos tokens for Negotiate proxy challenges instead of native credential lookup. The callbacks serve requests made for the client's sessions and, with `runtime` scope, the runtime's shared traffic, which includes background requests and remote MCP server connections; only one connection may hold `runtime` scope. The registration ends when the connection closes.
|
|
1154
|
+
* Registers the calling SDK client's network callbacks, replacing any previous registration. With `resolveProxy`, the client decides the proxies for every request the runtime would otherwise route by ambient proxy settings (proxy environment variables, `NO_PROXY` and operating-system settings), or leaves a request to that routing; requests with an explicitly configured proxy and loopback targets never consult it. With `authenticateNegotiate`, the client supplies the Kerberos tokens for Negotiate proxy challenges instead of native credential lookup. With `authenticateBasic`, the client supplies the credentials for Basic proxy challenges; the runtime prefers Negotiate when a proxy offers both. The callbacks serve requests made for the client's sessions and, with `runtime` scope, the runtime's shared traffic, which includes background requests and remote MCP server connections; only one connection may hold `runtime` scope. The registration ends when the connection closes.
|
|
975
1155
|
*
|
|
976
1156
|
* @param params Registers the calling SDK connection's network callbacks, replacing any previous registration.
|
|
977
1157
|
*/
|
|
@@ -1051,6 +1231,14 @@ function createServerRpc(connection) {
|
|
|
1051
1231
|
* @returns Most-relevant session ID for the supplied context, or omitted when no sessions exist.
|
|
1052
1232
|
*/
|
|
1053
1233
|
getLastForContext: async (params) => connection.sendRequest("sessions.getLastForContext", params),
|
|
1234
|
+
/**
|
|
1235
|
+
* Checks whether a local session's persisted event-log path exists, including an empty log, without opening the session or scanning the session catalog. Hosts use this to prefer an exact local session over a remote task or a UUID-prefix lookup. Metadata-only sessions without a log return false.
|
|
1236
|
+
*
|
|
1237
|
+
* @param params Local session whose persisted event-log presence to check without opening or scanning it.
|
|
1238
|
+
*
|
|
1239
|
+
* @returns Whether the local session has a persisted event-log path, including an empty log.
|
|
1240
|
+
*/
|
|
1241
|
+
hasEvents: async (params) => connection.sendRequest("sessions.hasEvents", params),
|
|
1054
1242
|
/**
|
|
1055
1243
|
* Returns the on-disk byte size of each session's workspace directory.
|
|
1056
1244
|
*
|
|
@@ -1177,6 +1365,17 @@ function createServerRpc(connection) {
|
|
|
1177
1365
|
getRemoteControlStatus: async () => connection.sendRequest("sessions.getRemoteControlStatus", {})
|
|
1178
1366
|
},
|
|
1179
1367
|
/** @experimental */
|
|
1368
|
+
shell: {
|
|
1369
|
+
/**
|
|
1370
|
+
* Filters the supplied host environment with the runtime's mandatory interactive-shell credential and telemetry exclusions, adds Git hardening, and removes any extra names the host supplies. An IDE terminal host or an in-process CLI uses this before launching an inherited terminal. The result derives only from the caller's supplied environment, never the runtime process environment.
|
|
1371
|
+
*
|
|
1372
|
+
* @param params Caller-owned environment to filter under the runtime's interactive-shell credential policy.
|
|
1373
|
+
*
|
|
1374
|
+
* @returns Filtered caller environment with the runtime's Git hardening applied; never includes the runtime process environment.
|
|
1375
|
+
*/
|
|
1376
|
+
buildInteractiveEnvironment: async (params) => connection.sendRequest("shell.buildInteractiveEnvironment", params)
|
|
1377
|
+
},
|
|
1378
|
+
/** @experimental */
|
|
1180
1379
|
agentRegistry: {
|
|
1181
1380
|
/**
|
|
1182
1381
|
* Spawns a managed-server child with the supplied configuration and returns a discriminated-union result. The caller (typically the CLI controller) is responsible for attaching to the spawned child and sending any follow-up prompt. When the controller-local spawn gate is closed the server returns JSON-RPC MethodNotFound.
|
|
@@ -1228,6 +1427,19 @@ function createServerRpc(connection) {
|
|
|
1228
1427
|
* @returns Runtime-owned configuration inventory and configuration diagnostics.
|
|
1229
1428
|
*/
|
|
1230
1429
|
list: async (params) => connection.sendRequest("lsp.list", params)
|
|
1430
|
+
},
|
|
1431
|
+
/** @experimental */
|
|
1432
|
+
taskAnalytics: {
|
|
1433
|
+
/**
|
|
1434
|
+
* Classifies a recorded Copilot or ATIF trajectory using the runtime's production analytics pipeline. No conversation session is required or created, archived tools are never executed, and classification telemetry is not emitted. Calling this method explicitly requests model processing of retained trajectory content through the connection's GitHub CAPI credentials, independently of background telemetry consent; BYOK endpoints are not used. Callers must authorize that processing and validate archive provenance. Content is not automatically redacted or sanitized for prompt injection. Model-derived results can be manipulated by trajectory content and must not be used as authorization or security decisions.
|
|
1435
|
+
*
|
|
1436
|
+
* @param params Retrospectively classify a recorded Copilot or ATIF trajectory without a conversation session. Explicitly requests model processing through the connection's GitHub CAPI credentials, independently of background telemetry consent, not through BYOK endpoints. Callers must be authorized to send the supplied content for analysis. Does not execute archived tools, append conversation history, or emit classification telemetry.
|
|
1437
|
+
*
|
|
1438
|
+
* @param options.signal Aborting stops the wait and sends `$/cancelRequest` so the server stops the work.
|
|
1439
|
+
*
|
|
1440
|
+
* @returns Categorical retrospective measurements of the supplied trajectory, not verification that its claims are true. Model-derived classifications can be inaccurate or manipulated by adversarial content. Treat them as untrusted measurements; independently validate results used for consequential decisions and never use them as authorization or security decisions.
|
|
1441
|
+
*/
|
|
1442
|
+
classifyTrajectory: async (params, options) => (0, import_rpcCancellation.sendCancellableRequest)(connection, "taskAnalytics.classifyTrajectory", params, options?.signal, true)
|
|
1231
1443
|
}
|
|
1232
1444
|
};
|
|
1233
1445
|
}
|
|
@@ -1530,7 +1742,7 @@ function createInternalServerRpc(connection) {
|
|
|
1530
1742
|
*/
|
|
1531
1743
|
applyTopKey: async (params) => connection.sendRequest("user.settings.applyTopKey", params),
|
|
1532
1744
|
/**
|
|
1533
|
-
* Writes or removes one raw user setting under the settings transaction and file locks. Preserves unrelated keys and legacy spellings, and records explicit mutations so startup cleanup cannot delete the user's choice. Unlike applyTopKey, this operation does not validate or canonicalize settings. Invalid or unreadable files are replaced by default, matching the existing raw writer; set refuseOnReadFailure=true to reject instead. Deletion requires delete=true; otherwise value must be present.
|
|
1745
|
+
* Writes or removes one raw user setting under the settings transaction and file locks. Preserves unrelated keys and legacy spellings, and records explicit mutations so startup cleanup cannot delete the user's choice. Unlike applyTopKey, this operation does not validate or canonicalize settings. Invalid or unreadable files are replaced by default, matching the existing raw writer; set refuseOnReadFailure=true to reject instead. Set refuseOnUnrecoverableReadFailure=true to refuse content no JSONC recovery pass can read as an object, while retaining lenient recovery unless refuseOnReadFailure is also true. Deletion requires delete=true; otherwise value must be present.
|
|
1534
1746
|
*
|
|
1535
1747
|
* @param params A raw top-level setting edit with explicit read-failure behavior.
|
|
1536
1748
|
*/
|
|
@@ -1806,6 +2018,17 @@ function createInternalServerRpc(connection) {
|
|
|
1806
2018
|
*/
|
|
1807
2019
|
connect: async (params) => connection.sendRequest("connect", params),
|
|
1808
2020
|
/** @experimental */
|
|
2021
|
+
providersSource: {
|
|
2022
|
+
/**
|
|
2023
|
+
* Forwards a saved-model addition over the original authenticated local attachment to its owning server. Requires private CLI-host admission and fails if that attachment is no longer active; never saves to the controller as a fallback.
|
|
2024
|
+
*
|
|
2025
|
+
* @param params Saves through the exact authenticated local attachment that discovered a model.
|
|
2026
|
+
*
|
|
2027
|
+
* @returns Result of adding a model to the saved provider configuration.
|
|
2028
|
+
*/
|
|
2029
|
+
addModel: async (params) => connection.sendRequest("providersSource.addModel", params)
|
|
2030
|
+
},
|
|
2031
|
+
/** @experimental */
|
|
1809
2032
|
tools: {
|
|
1810
2033
|
/** @experimental */
|
|
1811
2034
|
largeOutput: {
|
|
@@ -2515,7 +2738,15 @@ function createSessionRpc(connection, sessionId) {
|
|
|
2515
2738
|
*
|
|
2516
2739
|
* @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.
|
|
2517
2740
|
*/
|
|
2518
|
-
prepareConfiguration: async (params) => connection.sendRequest("session.providers.models.prepareConfiguration", { ...params, sessionId })
|
|
2741
|
+
prepareConfiguration: async (params) => connection.sendRequest("session.providers.models.prepareConfiguration", { ...params, sessionId }),
|
|
2742
|
+
/**
|
|
2743
|
+
* Reads current cached provider-model availability under the session's allowed-model policy. Does not fetch a catalog or change registration, selection, or configuration.
|
|
2744
|
+
*
|
|
2745
|
+
* @param params Reads current cached availability without fetching a remote model catalog.
|
|
2746
|
+
*
|
|
2747
|
+
* @returns Action-boundary availability of a registered provider model.
|
|
2748
|
+
*/
|
|
2749
|
+
diagnose: async (params) => connection.sendRequest("session.providers.models.diagnose", { "selectionId": params["selectionId"], "providerId": params["providerId"], sessionId })
|
|
2519
2750
|
}
|
|
2520
2751
|
},
|
|
2521
2752
|
/**
|
|
@@ -2877,6 +3108,14 @@ function createSessionRpc(connection, sessionId) {
|
|
|
2877
3108
|
* @returns Immediate acknowledgement and Auto preference snapshot after a switch request. This result never implies that a pending preference committed.
|
|
2878
3109
|
*/
|
|
2879
3110
|
switchAutoTier: async (params) => connection.sendRequest("session.model.switchAutoTier", { ...params, sessionId }),
|
|
3111
|
+
/**
|
|
3112
|
+
* Requests a Copilot Fusion tier without changing the session's selected model, naming the tier as the CLI's `--fusion-tier` does. The runtime resolves the tier to the Auto routing preference it stands for and then behaves exactly like `switchAutoTier`: the latest unclaimed request wins, and the runtime commits it only after a later prompt using the `auto` model mints a usable model and token pair.
|
|
3113
|
+
*
|
|
3114
|
+
* @param params A Copilot Fusion tier request for the session, named as the CLI's `--fusion-tier` names it. The runtime resolves the tier to the Auto routing preference it stands for and requests that preference exactly as `switchAutoTier` does. This updates Auto configuration only; it does not change the selected model to `auto`.
|
|
3115
|
+
*
|
|
3116
|
+
* @returns Immediate acknowledgement and Auto preference snapshot after a switch request. This result never implies that a pending preference committed.
|
|
3117
|
+
*/
|
|
3118
|
+
switchFusionTier: async (params) => connection.sendRequest("session.model.switchFusionTier", { ...params, sessionId }),
|
|
2880
3119
|
/**
|
|
2881
3120
|
* Replaces or clears the host-supplied model allowlist for a running session.
|
|
2882
3121
|
*
|
|
@@ -3418,6 +3657,23 @@ function createSessionRpc(connection, sessionId) {
|
|
|
3418
3657
|
},
|
|
3419
3658
|
/** @experimental */
|
|
3420
3659
|
mcp: {
|
|
3660
|
+
/** @experimental */
|
|
3661
|
+
ide: {
|
|
3662
|
+
/**
|
|
3663
|
+
* Returns the session-owned live IDE state, retained identity, and latest observed selection. It does not scan for IDEs or start a connection.
|
|
3664
|
+
*
|
|
3665
|
+
* @returns Live IDE state. This state never restores a connection from session history.
|
|
3666
|
+
*/
|
|
3667
|
+
state: async () => connection.sendRequest("session.mcp.ide.state", { sessionId })
|
|
3668
|
+
},
|
|
3669
|
+
/**
|
|
3670
|
+
* Calls a session MCP tool with the existing server admission and tool permission checks. IDE calls require local host authority, including programmatic tools not exposed to the model. Returns null only when the IDE is disconnected. IDE open_diff waits for user action; other IDE calls use a 60-second timeout.
|
|
3671
|
+
*
|
|
3672
|
+
* @param params Invokes a tool on a session MCP server through the server's permission policy.
|
|
3673
|
+
*
|
|
3674
|
+
* @returns A standard MCP tool result, or null when the IDE is disconnected.
|
|
3675
|
+
*/
|
|
3676
|
+
callTool: async (params) => connection.sendRequest("session.mcp.callTool", { ...params, sessionId }),
|
|
3421
3677
|
/**
|
|
3422
3678
|
* Lists materialized MCP servers and their connection status. Cache misses may start and wait for MCP servers.
|
|
3423
3679
|
*
|
|
@@ -3491,7 +3747,7 @@ function createSessionRpc(connection, sessionId) {
|
|
|
3491
3747
|
*/
|
|
3492
3748
|
removeGitHub: async () => connection.sendRequest("session.mcp.removeGitHub", { sessionId }),
|
|
3493
3749
|
/**
|
|
3494
|
-
* 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.
|
|
3750
|
+
* 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. A local configuration connects the existing IDE endpoint under serverName `ide`. Runtime host admission controls the CLI policy exemption; request fields cannot grant it.
|
|
3495
3751
|
*
|
|
3496
3752
|
* @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.
|
|
3497
3753
|
*/
|
|
@@ -3503,9 +3759,9 @@ function createSessionRpc(connection, sessionId) {
|
|
|
3503
3759
|
*/
|
|
3504
3760
|
restartServer: async (params) => connection.sendRequest("session.mcp.restartServer", { ...params, sessionId }),
|
|
3505
3761
|
/**
|
|
3506
|
-
* Stops
|
|
3762
|
+
* Stops one MCP server on the session's host. Omit transport for a generic stop by name. Set transport to local-http with serverName ide for endpoint-only cleanup. This cancels pending IDE initialization and removes the local IDE session, retained tools, identity, and selection. It preserves any ordinary server named ide.
|
|
3507
3763
|
*
|
|
3508
|
-
* @param params Server name for an individual MCP server stop.
|
|
3764
|
+
* @param params Server name and optional transport selector for an individual MCP server stop. Omit transport to stop the server by name.
|
|
3509
3765
|
*/
|
|
3510
3766
|
stopServer: async (params) => connection.sendRequest("session.mcp.stopServer", { ...params, sessionId }),
|
|
3511
3767
|
/**
|
|
@@ -3516,6 +3772,12 @@ function createSessionRpc(connection, sessionId) {
|
|
|
3516
3772
|
* @returns Whether the named MCP server is running.
|
|
3517
3773
|
*/
|
|
3518
3774
|
isServerRunning: async (params) => connection.sendRequest("session.mcp.isServerRunning", { ...params, sessionId }),
|
|
3775
|
+
/**
|
|
3776
|
+
* Reports how many context tokens each MCP server's tool definitions cost, per server and per tool, for the session's current tool set. Costs are counted with the session's selected model, or with the runtime's default context model when no model has been selected.
|
|
3777
|
+
*
|
|
3778
|
+
* @returns Per-server MCP tool definition token costs.
|
|
3779
|
+
*/
|
|
3780
|
+
getToolTokenBreakdown: async () => connection.sendRequest("session.mcp.getToolTokenBreakdown", { sessionId }),
|
|
3519
3781
|
/** @experimental */
|
|
3520
3782
|
oauth: {
|
|
3521
3783
|
/**
|
|
@@ -3931,6 +4193,18 @@ function createSessionRpc(connection, sessionId) {
|
|
|
3931
4193
|
* @returns The selectable model entries synthesized for the models added by this call.
|
|
3932
4194
|
*/
|
|
3933
4195
|
add: async (params) => connection.sendRequest("session.provider.add", { ...params, sessionId }),
|
|
4196
|
+
/**
|
|
4197
|
+
* Updates one provider's connection settings in this session's BYOK registry while preserving its saved credential and sibling models.
|
|
4198
|
+
*
|
|
4199
|
+
* @param params Request to update one provider's connection settings in a single session.
|
|
4200
|
+
*/
|
|
4201
|
+
updateProvider: async (params) => connection.sendRequest("session.provider.updateProvider", { ...params, sessionId }),
|
|
4202
|
+
/**
|
|
4203
|
+
* Updates one model in this session's BYOK registry without replacing sibling models or unrelated provider registrations.
|
|
4204
|
+
*
|
|
4205
|
+
* @param params Request to update one provider-local model in a single session.
|
|
4206
|
+
*/
|
|
4207
|
+
updateModel: async (params) => connection.sendRequest("session.provider.updateModel", { ...params, sessionId }),
|
|
3934
4208
|
/**
|
|
3935
4209
|
* Atomically updates the session's BYOK provider and model registry by applying the supplied snapshot, replacing existing entries, updating models, or removing entries absent from the snapshot.
|
|
3936
4210
|
*
|
|
@@ -5247,7 +5521,7 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
5247
5521
|
/** @experimental */
|
|
5248
5522
|
ui: {
|
|
5249
5523
|
/**
|
|
5250
|
-
* Resolves a pending elicitation request after direct interaction in the trusted in-process client or authenticated owning host. Only
|
|
5524
|
+
* Resolves a pending elicitation request after direct interaction in the trusted in-process client or authenticated owning host. Only a response to the built-in ask_user tool becomes trusted human evidence; a decline or dismissal records the person's refusal, which grants nothing.
|
|
5251
5525
|
*
|
|
5252
5526
|
* @param params Pending elicitation request ID and the user's response (accept/decline/cancel + form values).
|
|
5253
5527
|
*
|
|
@@ -5557,6 +5831,11 @@ function registerClientGlobalApiHandlers(connection, handlers) {
|
|
|
5557
5831
|
if (!handler) throw new Error("No network client-global handler registered");
|
|
5558
5832
|
return handler.authenticateNegotiate(params);
|
|
5559
5833
|
});
|
|
5834
|
+
connection.onRequest("network.authenticateBasic", async (params) => {
|
|
5835
|
+
const handler = handlers.network;
|
|
5836
|
+
if (!handler) throw new Error("No network client-global handler registered");
|
|
5837
|
+
return handler.authenticateBasic(params);
|
|
5838
|
+
});
|
|
5560
5839
|
connection.onRequest("llmInference.httpRequestStart", async (params) => {
|
|
5561
5840
|
const handler = handlers.llmInference;
|
|
5562
5841
|
if (!handler) throw new Error("No llmInference client-global handler registered");
|
package/dist/cjs/index.js
CHANGED
|
@@ -35,20 +35,26 @@ __export(index_exports, {
|
|
|
35
35
|
SessionFsSqliteTransactionFailure: () => import_types2.SessionFsSqliteTransactionFailure,
|
|
36
36
|
SessionFsWriteFailure: () => import_types2.SessionFsWriteFailure,
|
|
37
37
|
ToolSet: () => import_toolSet.ToolSet,
|
|
38
|
+
WORKFLOW_AGENT_OPTION_KEYS: () => import_workflow.WORKFLOW_AGENT_OPTION_KEYS,
|
|
38
39
|
WorkflowResumeError: () => import_workflow.WorkflowResumeError,
|
|
39
40
|
approveAll: () => import_types2.approveAll,
|
|
40
41
|
convertMcpCallToolResult: () => import_types2.convertMcpCallToolResult,
|
|
41
42
|
createAttributedPermissionResult: () => import_types2.createAttributedPermissionResult,
|
|
43
|
+
createAttributedResult: () => import_types2.createAttributedResult,
|
|
42
44
|
createCanvas: () => import_canvas.createCanvas,
|
|
43
45
|
createSessionFsAdapter: () => import_types2.createSessionFsAdapter,
|
|
44
46
|
decisionErrorData: () => import_decisions.decisionErrorData,
|
|
45
47
|
decisionErrorKind: () => import_decisions.decisionErrorKind,
|
|
46
48
|
defineTool: () => import_types2.defineTool,
|
|
47
49
|
defineWorkflow: () => import_workflow.defineWorkflow,
|
|
48
|
-
isWorkflowRunTerminal: () => import_workflow.isWorkflowRunTerminal
|
|
50
|
+
isWorkflowRunTerminal: () => import_workflow.isWorkflowRunTerminal,
|
|
51
|
+
parseTrajectoryJson: () => import_taskAnalyticsJson.parseTrajectoryJson,
|
|
52
|
+
toSavedProviderConfiguration: () => import_providerConfiguration.toSavedProviderConfiguration
|
|
49
53
|
});
|
|
50
54
|
module.exports = __toCommonJS(index_exports);
|
|
51
55
|
var import_client = require("./client.js");
|
|
56
|
+
var import_taskAnalyticsJson = require("./taskAnalyticsJson.js");
|
|
57
|
+
var import_providerConfiguration = require("./providerConfiguration.js");
|
|
52
58
|
var import_decisions = require("./decisions.js");
|
|
53
59
|
var import_host = require("./host.js");
|
|
54
60
|
var import_types = require("./types.js");
|
|
@@ -76,15 +82,19 @@ var import_types2 = require("./types.js");
|
|
|
76
82
|
SessionFsSqliteTransactionFailure,
|
|
77
83
|
SessionFsWriteFailure,
|
|
78
84
|
ToolSet,
|
|
85
|
+
WORKFLOW_AGENT_OPTION_KEYS,
|
|
79
86
|
WorkflowResumeError,
|
|
80
87
|
approveAll,
|
|
81
88
|
convertMcpCallToolResult,
|
|
82
89
|
createAttributedPermissionResult,
|
|
90
|
+
createAttributedResult,
|
|
83
91
|
createCanvas,
|
|
84
92
|
createSessionFsAdapter,
|
|
85
93
|
decisionErrorData,
|
|
86
94
|
decisionErrorKind,
|
|
87
95
|
defineTool,
|
|
88
96
|
defineWorkflow,
|
|
89
|
-
isWorkflowRunTerminal
|
|
97
|
+
isWorkflowRunTerminal,
|
|
98
|
+
parseTrajectoryJson,
|
|
99
|
+
toSavedProviderConfiguration
|
|
90
100
|
});
|