@github/copilot-sdk 1.0.2 → 1.0.3
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/cjs/client.js +27 -7
- package/dist/cjs/generated/rpc.js +34 -1
- package/dist/client.js +27 -7
- package/dist/generated/rpc.d.ts +328 -17
- package/dist/generated/rpc.js +34 -1
- package/dist/generated/session-events.d.ts +284 -29
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +134 -1
- package/package.json +2 -2
package/dist/cjs/client.js
CHANGED
|
@@ -170,22 +170,38 @@ function getNodeExecPath() {
|
|
|
170
170
|
}
|
|
171
171
|
return process.execPath;
|
|
172
172
|
}
|
|
173
|
+
function getCliPlatformPackageNames() {
|
|
174
|
+
const arch = process.arch;
|
|
175
|
+
const variants = process.platform === "linux" ? ["linux", "linuxmusl"] : [process.platform];
|
|
176
|
+
return variants.map((variant) => `@github/copilot-${variant}-${arch}`);
|
|
177
|
+
}
|
|
173
178
|
function getBundledCliPath() {
|
|
179
|
+
const packageNames = getCliPlatformPackageNames();
|
|
174
180
|
if (typeof import_meta.resolve === "function") {
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
181
|
+
for (const packageName of packageNames) {
|
|
182
|
+
try {
|
|
183
|
+
const sdkUrl = import_meta.resolve(`${packageName}/sdk`);
|
|
184
|
+
const sdkPath = (0, import_node_url.fileURLToPath)(sdkUrl);
|
|
185
|
+
return (0, import_node_path.join)((0, import_node_path.dirname)((0, import_node_path.dirname)(sdkPath)), "index.js");
|
|
186
|
+
} catch {
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
throw new Error(
|
|
190
|
+
`Could not resolve a @github/copilot platform package (tried ${packageNames.join(", ")}). Ensure @github/copilot is installed, or pass cliPath/cliUrl to CopilotClient.`
|
|
191
|
+
);
|
|
178
192
|
}
|
|
179
193
|
const req = (0, import_node_module.createRequire)(__filename);
|
|
180
194
|
const searchPaths = req.resolve.paths("@github/copilot") ?? [];
|
|
181
195
|
for (const base of searchPaths) {
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
196
|
+
for (const packageName of packageNames) {
|
|
197
|
+
const candidate = (0, import_node_path.join)(base, ...packageName.split("/"), "index.js");
|
|
198
|
+
if ((0, import_node_fs.existsSync)(candidate)) {
|
|
199
|
+
return candidate;
|
|
200
|
+
}
|
|
185
201
|
}
|
|
186
202
|
}
|
|
187
203
|
throw new Error(
|
|
188
|
-
`Could not find @github/copilot package. Searched ${searchPaths.length} paths. Ensure
|
|
204
|
+
`Could not find a @github/copilot platform package (tried ${packageNames.join(", ")}). Searched ${searchPaths.length} paths. Ensure @github/copilot is installed, or pass cliPath/cliUrl to CopilotClient.`
|
|
189
205
|
);
|
|
190
206
|
}
|
|
191
207
|
class CopilotClient {
|
|
@@ -895,6 +911,8 @@ class CopilotClient {
|
|
|
895
911
|
excludedTools: toolFilterOptions.excludedTools,
|
|
896
912
|
toolFilterPrecedence: toolFilterOptions.toolFilterPrecedence,
|
|
897
913
|
provider: config.provider,
|
|
914
|
+
providers: config.providers,
|
|
915
|
+
models: config.models,
|
|
898
916
|
enableSessionTelemetry: config.enableSessionTelemetry,
|
|
899
917
|
modelCapabilities: config.modelCapabilities,
|
|
900
918
|
largeOutput: toWireLargeOutput(config.largeOutput),
|
|
@@ -1061,6 +1079,8 @@ class CopilotClient {
|
|
|
1061
1079
|
description: cmd.description
|
|
1062
1080
|
})),
|
|
1063
1081
|
provider: config.provider,
|
|
1082
|
+
providers: config.providers,
|
|
1083
|
+
models: config.models,
|
|
1064
1084
|
modelCapabilities: config.modelCapabilities,
|
|
1065
1085
|
largeOutput: toWireLargeOutput(config.largeOutput),
|
|
1066
1086
|
requestPermission: config.onPermissionRequest !== import_types.defaultJoinSessionPermissionHandler,
|
|
@@ -308,6 +308,31 @@ function createServerRpc(connection) {
|
|
|
308
308
|
setProvider: async (params) => connection.sendRequest("sessionFs.setProvider", params)
|
|
309
309
|
},
|
|
310
310
|
/** @experimental */
|
|
311
|
+
llmInference: {
|
|
312
|
+
/**
|
|
313
|
+
* Registers an SDK client as the LLM inference callback provider.
|
|
314
|
+
*
|
|
315
|
+
* @returns Indicates whether the calling client was registered as the LLM inference provider.
|
|
316
|
+
*/
|
|
317
|
+
setProvider: async () => connection.sendRequest("llmInference.setProvider", {}),
|
|
318
|
+
/**
|
|
319
|
+
* Delivers the response head (status + headers) for an in-flight request, correlated by the requestId the runtime supplied in httpRequestStart. Must be called exactly once per request before any httpResponseChunk frames.
|
|
320
|
+
*
|
|
321
|
+
* @param params Response head.
|
|
322
|
+
*
|
|
323
|
+
* @returns Whether the start frame was accepted.
|
|
324
|
+
*/
|
|
325
|
+
httpResponseStart: async (params) => connection.sendRequest("llmInference.httpResponseStart", params),
|
|
326
|
+
/**
|
|
327
|
+
* Delivers a body byte range (or a terminal transport error) for an in-flight response, correlated by requestId. Set `end` true on the last chunk. When `error` is set the response terminates with a transport-level failure and the runtime raises an APIConnectionError.
|
|
328
|
+
*
|
|
329
|
+
* @param params A response body chunk or terminal error.
|
|
330
|
+
*
|
|
331
|
+
* @returns Whether the chunk was accepted.
|
|
332
|
+
*/
|
|
333
|
+
httpResponseChunk: async (params) => connection.sendRequest("llmInference.httpResponseChunk", params)
|
|
334
|
+
},
|
|
335
|
+
/** @experimental */
|
|
311
336
|
sessions: {
|
|
312
337
|
/**
|
|
313
338
|
* Creates or resumes a local session and returns the opened session ID.
|
|
@@ -1067,6 +1092,14 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1067
1092
|
isServerRunning: async (params) => connection.sendRequest("session.mcp.isServerRunning", { sessionId, ...params }),
|
|
1068
1093
|
/** @experimental */
|
|
1069
1094
|
oauth: {
|
|
1095
|
+
/**
|
|
1096
|
+
* Resolves a pending MCP OAuth request with a host-provided token or cancellation. The pending request is emitted as mcp.oauth_required with the data necessary to authorize the request.
|
|
1097
|
+
*
|
|
1098
|
+
* @param params Pending MCP OAuth request ID and host-provided token or cancellation response.
|
|
1099
|
+
*
|
|
1100
|
+
* @returns Indicates whether the pending MCP OAuth response was accepted.
|
|
1101
|
+
*/
|
|
1102
|
+
handlePendingRequest: async (params) => connection.sendRequest("session.mcp.oauth.handlePendingRequest", { sessionId, ...params }),
|
|
1070
1103
|
/**
|
|
1071
1104
|
* Starts OAuth authentication for a remote MCP server.
|
|
1072
1105
|
*
|
|
@@ -1831,7 +1864,7 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
1831
1864
|
/** @experimental */
|
|
1832
1865
|
oauth: {
|
|
1833
1866
|
/**
|
|
1834
|
-
* Responds to a pending MCP OAuth provider
|
|
1867
|
+
* Responds to a pending MCP OAuth request with an in-process provider. This internal CLI-only API accepts a live OAuthClientProvider instance and cannot be used over the SDK JSON-RPC boundary. Use session.mcp.oauth.handlePendingRequest instead for the public SDK-safe response path.
|
|
1835
1868
|
*
|
|
1836
1869
|
* @param params MCP OAuth request id and optional provider response.
|
|
1837
1870
|
*
|
package/dist/client.js
CHANGED
|
@@ -156,22 +156,38 @@ function getNodeExecPath() {
|
|
|
156
156
|
}
|
|
157
157
|
return process.execPath;
|
|
158
158
|
}
|
|
159
|
+
function getCliPlatformPackageNames() {
|
|
160
|
+
const arch = process.arch;
|
|
161
|
+
const variants = process.platform === "linux" ? ["linux", "linuxmusl"] : [process.platform];
|
|
162
|
+
return variants.map((variant) => `@github/copilot-${variant}-${arch}`);
|
|
163
|
+
}
|
|
159
164
|
function getBundledCliPath() {
|
|
165
|
+
const packageNames = getCliPlatformPackageNames();
|
|
160
166
|
if (typeof import.meta.resolve === "function") {
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
167
|
+
for (const packageName of packageNames) {
|
|
168
|
+
try {
|
|
169
|
+
const sdkUrl = import.meta.resolve(`${packageName}/sdk`);
|
|
170
|
+
const sdkPath = fileURLToPath(sdkUrl);
|
|
171
|
+
return join(dirname(dirname(sdkPath)), "index.js");
|
|
172
|
+
} catch {
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
throw new Error(
|
|
176
|
+
`Could not resolve a @github/copilot platform package (tried ${packageNames.join(", ")}). Ensure @github/copilot is installed, or pass cliPath/cliUrl to CopilotClient.`
|
|
177
|
+
);
|
|
164
178
|
}
|
|
165
179
|
const req = createRequire(__filename);
|
|
166
180
|
const searchPaths = req.resolve.paths("@github/copilot") ?? [];
|
|
167
181
|
for (const base of searchPaths) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
182
|
+
for (const packageName of packageNames) {
|
|
183
|
+
const candidate = join(base, ...packageName.split("/"), "index.js");
|
|
184
|
+
if (existsSync(candidate)) {
|
|
185
|
+
return candidate;
|
|
186
|
+
}
|
|
171
187
|
}
|
|
172
188
|
}
|
|
173
189
|
throw new Error(
|
|
174
|
-
`Could not find @github/copilot package. Searched ${searchPaths.length} paths. Ensure
|
|
190
|
+
`Could not find a @github/copilot platform package (tried ${packageNames.join(", ")}). Searched ${searchPaths.length} paths. Ensure @github/copilot is installed, or pass cliPath/cliUrl to CopilotClient.`
|
|
175
191
|
);
|
|
176
192
|
}
|
|
177
193
|
class CopilotClient {
|
|
@@ -881,6 +897,8 @@ class CopilotClient {
|
|
|
881
897
|
excludedTools: toolFilterOptions.excludedTools,
|
|
882
898
|
toolFilterPrecedence: toolFilterOptions.toolFilterPrecedence,
|
|
883
899
|
provider: config.provider,
|
|
900
|
+
providers: config.providers,
|
|
901
|
+
models: config.models,
|
|
884
902
|
enableSessionTelemetry: config.enableSessionTelemetry,
|
|
885
903
|
modelCapabilities: config.modelCapabilities,
|
|
886
904
|
largeOutput: toWireLargeOutput(config.largeOutput),
|
|
@@ -1047,6 +1065,8 @@ class CopilotClient {
|
|
|
1047
1065
|
description: cmd.description
|
|
1048
1066
|
})),
|
|
1049
1067
|
provider: config.provider,
|
|
1068
|
+
providers: config.providers,
|
|
1069
|
+
models: config.models,
|
|
1050
1070
|
modelCapabilities: config.modelCapabilities,
|
|
1051
1071
|
largeOutput: toWireLargeOutput(config.largeOutput),
|
|
1052
1072
|
requestPermission: config.onPermissionRequest !== defaultJoinSessionPermissionHandler,
|
package/dist/generated/rpc.d.ts
CHANGED
|
@@ -473,6 +473,17 @@ export type InstructionSourceLocation =
|
|
|
473
473
|
| "working-directory"
|
|
474
474
|
/** Instructions live in plugin-provided configuration. */
|
|
475
475
|
| "plugin";
|
|
476
|
+
/**
|
|
477
|
+
* Transport the runtime would otherwise use for this request. `http` (the default when absent) covers plain HTTP and SSE responses; `websocket` indicates a full-duplex message channel where each body chunk maps to one WebSocket message and the `binary` flag distinguishes text from binary frames. The SDK consumer uses this to decide whether to service the request with an HTTP client or a WebSocket client. It is the one piece of request metadata the consumer cannot reliably infer from the URL or headers alone.
|
|
478
|
+
*
|
|
479
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
480
|
+
* via the `definition` "LlmInferenceHttpRequestStartTransport".
|
|
481
|
+
*/
|
|
482
|
+
export type LlmInferenceHttpRequestStartTransport =
|
|
483
|
+
/** Plain HTTP or SSE response. Each body chunk is an opaque byte range; the response is a status line, headers, and a (possibly streamed) body. */
|
|
484
|
+
"http"
|
|
485
|
+
/** Full-duplex WebSocket channel. Each body chunk maps to exactly one WebSocket message and the `binary` flag distinguishes text from binary frames; request and response chunks flow concurrently. */
|
|
486
|
+
| "websocket";
|
|
476
487
|
/**
|
|
477
488
|
* Repository host type
|
|
478
489
|
*
|
|
@@ -654,6 +665,34 @@ export type McpServerConfigHttpOauthGrantType =
|
|
|
654
665
|
"authorization_code"
|
|
655
666
|
/** Headless client credentials flow using the configured OAuth client. */
|
|
656
667
|
| "client_credentials";
|
|
668
|
+
/**
|
|
669
|
+
* Host response to the pending OAuth request.
|
|
670
|
+
*
|
|
671
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
672
|
+
* via the `definition` "McpOauthPendingRequestResponse".
|
|
673
|
+
*/
|
|
674
|
+
/** @experimental */
|
|
675
|
+
export type McpOauthPendingRequestResponse = {
|
|
676
|
+
/**
|
|
677
|
+
* Access token acquired by the SDK host
|
|
678
|
+
*/
|
|
679
|
+
accessToken: string;
|
|
680
|
+
/**
|
|
681
|
+
* OAuth token type. Defaults to Bearer when omitted.
|
|
682
|
+
*/
|
|
683
|
+
tokenType?: string;
|
|
684
|
+
/**
|
|
685
|
+
* Refresh token supplied by the host, if available.
|
|
686
|
+
*/
|
|
687
|
+
refreshToken?: string;
|
|
688
|
+
/**
|
|
689
|
+
* Token lifetime in seconds, if known.
|
|
690
|
+
*/
|
|
691
|
+
expiresIn?: number;
|
|
692
|
+
kind: "token";
|
|
693
|
+
} | {
|
|
694
|
+
kind: "cancelled";
|
|
695
|
+
};
|
|
657
696
|
/**
|
|
658
697
|
* Outcome of the sampling inference. 'success' produced a response; 'failure' encountered an error (including agent-side rejection by content filter or criteria); 'cancelled' the caller cancelled this execution via cancelSamplingExecution.
|
|
659
698
|
*
|
|
@@ -3450,7 +3489,6 @@ export interface ExternalToolTextResultForLlm {
|
|
|
3450
3489
|
* Structured content blocks from the tool
|
|
3451
3490
|
*/
|
|
3452
3491
|
contents?: ExternalToolTextResultForLlmContent[];
|
|
3453
|
-
[k: string]: unknown | undefined;
|
|
3454
3492
|
}
|
|
3455
3493
|
/**
|
|
3456
3494
|
* Binary result returned by a tool for the model
|
|
@@ -4105,6 +4143,194 @@ export interface InstructionSource {
|
|
|
4105
4143
|
*/
|
|
4106
4144
|
projectPath?: string;
|
|
4107
4145
|
}
|
|
4146
|
+
/**
|
|
4147
|
+
* HTTP headers as a map from lowercased header name to a list of values. Multi-valued headers (e.g. Set-Cookie) preserve all values.
|
|
4148
|
+
*
|
|
4149
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
4150
|
+
* via the `definition` "LlmInferenceHeaders".
|
|
4151
|
+
*/
|
|
4152
|
+
/** @experimental */
|
|
4153
|
+
export interface LlmInferenceHeaders {
|
|
4154
|
+
[k: string]: string[] | undefined;
|
|
4155
|
+
}
|
|
4156
|
+
/**
|
|
4157
|
+
* A request body chunk or cancellation signal.
|
|
4158
|
+
*
|
|
4159
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
4160
|
+
* via the `definition` "LlmInferenceHttpRequestChunkRequest".
|
|
4161
|
+
*/
|
|
4162
|
+
export interface LlmInferenceHttpRequestChunkRequest {
|
|
4163
|
+
/**
|
|
4164
|
+
* Matches the requestId from the originating httpRequestStart frame.
|
|
4165
|
+
*/
|
|
4166
|
+
requestId: string;
|
|
4167
|
+
/**
|
|
4168
|
+
* Body byte range. UTF-8 text when `binary` is absent or false; base64-encoded bytes when `binary` is true. May be empty.
|
|
4169
|
+
*/
|
|
4170
|
+
data: string;
|
|
4171
|
+
/**
|
|
4172
|
+
* When true, `data` is base64-encoded bytes. When absent or false, `data` is UTF-8 text.
|
|
4173
|
+
*/
|
|
4174
|
+
binary?: boolean;
|
|
4175
|
+
/**
|
|
4176
|
+
* When true, this is the final body chunk for the request. The SDK may rely on having received an end-marked chunk before treating the request body as complete.
|
|
4177
|
+
*/
|
|
4178
|
+
end?: boolean;
|
|
4179
|
+
/**
|
|
4180
|
+
* When true, the runtime is cancelling the in-flight request (e.g. upstream consumer aborted). `data` is ignored. Implies end-of-request.
|
|
4181
|
+
*/
|
|
4182
|
+
cancel?: boolean;
|
|
4183
|
+
/**
|
|
4184
|
+
* Optional human-readable reason for the cancellation, propagated for logging.
|
|
4185
|
+
*/
|
|
4186
|
+
cancelReason?: string;
|
|
4187
|
+
}
|
|
4188
|
+
/**
|
|
4189
|
+
* Acknowledgement. The SDK is free to ignore the ack and treat chunk delivery as fire-and-forget.
|
|
4190
|
+
*
|
|
4191
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
4192
|
+
* via the `definition` "LlmInferenceHttpRequestChunkResult".
|
|
4193
|
+
*/
|
|
4194
|
+
export interface LlmInferenceHttpRequestChunkResult {
|
|
4195
|
+
}
|
|
4196
|
+
/**
|
|
4197
|
+
* The head of an outbound model-layer HTTP request.
|
|
4198
|
+
*
|
|
4199
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
4200
|
+
* via the `definition` "LlmInferenceHttpRequestStartRequest".
|
|
4201
|
+
*/
|
|
4202
|
+
export interface LlmInferenceHttpRequestStartRequest {
|
|
4203
|
+
/**
|
|
4204
|
+
* Opaque runtime-minted id, unique per in-flight request. The SDK uses this to correlate httpRequestChunk frames and to address its httpResponseStart / httpResponseChunk replies back to the runtime.
|
|
4205
|
+
*/
|
|
4206
|
+
requestId: string;
|
|
4207
|
+
/**
|
|
4208
|
+
* Id of the runtime session that triggered this request, when one is in scope. Absent for requests issued outside any session (e.g. startup model-catalog or capability resolution). This is a payload field — not a dispatch key — because the client-global API is registered process-wide rather than per session.
|
|
4209
|
+
*/
|
|
4210
|
+
sessionId?: string;
|
|
4211
|
+
/**
|
|
4212
|
+
* HTTP method, e.g. GET, POST.
|
|
4213
|
+
*/
|
|
4214
|
+
method: string;
|
|
4215
|
+
/**
|
|
4216
|
+
* Absolute request URL.
|
|
4217
|
+
*/
|
|
4218
|
+
url: string;
|
|
4219
|
+
headers: LlmInferenceHeaders;
|
|
4220
|
+
transport?: LlmInferenceHttpRequestStartTransport;
|
|
4221
|
+
}
|
|
4222
|
+
/**
|
|
4223
|
+
* Acknowledgement. Returning successfully simply means the SDK accepted the start frame; it does not imply the request will succeed.
|
|
4224
|
+
*
|
|
4225
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
4226
|
+
* via the `definition` "LlmInferenceHttpRequestStartResult".
|
|
4227
|
+
*/
|
|
4228
|
+
export interface LlmInferenceHttpRequestStartResult {
|
|
4229
|
+
}
|
|
4230
|
+
/**
|
|
4231
|
+
* Set to terminate the response with a transport-level failure. Implies end-of-stream; any further chunks for this requestId are ignored.
|
|
4232
|
+
*
|
|
4233
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
4234
|
+
* via the `definition` "LlmInferenceHttpResponseChunkError".
|
|
4235
|
+
*/
|
|
4236
|
+
/** @experimental */
|
|
4237
|
+
export interface LlmInferenceHttpResponseChunkError {
|
|
4238
|
+
/**
|
|
4239
|
+
* Human-readable failure description.
|
|
4240
|
+
*/
|
|
4241
|
+
message: string;
|
|
4242
|
+
/**
|
|
4243
|
+
* Optional machine-readable error code.
|
|
4244
|
+
*/
|
|
4245
|
+
code?: string;
|
|
4246
|
+
}
|
|
4247
|
+
/**
|
|
4248
|
+
* A response body chunk or terminal error.
|
|
4249
|
+
*
|
|
4250
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
4251
|
+
* via the `definition` "LlmInferenceHttpResponseChunkRequest".
|
|
4252
|
+
*/
|
|
4253
|
+
/** @experimental */
|
|
4254
|
+
export interface LlmInferenceHttpResponseChunkRequest {
|
|
4255
|
+
/**
|
|
4256
|
+
* Matches the requestId from the originating httpRequestStart frame.
|
|
4257
|
+
*/
|
|
4258
|
+
requestId: string;
|
|
4259
|
+
/**
|
|
4260
|
+
* Body byte range. UTF-8 text when `binary` is absent or false; base64-encoded bytes when `binary` is true. May be empty (e.g. when the response body is empty: send a single chunk with empty data and end=true).
|
|
4261
|
+
*/
|
|
4262
|
+
data: string;
|
|
4263
|
+
/**
|
|
4264
|
+
* When true, `data` is base64-encoded bytes. When absent or false, `data` is UTF-8 text.
|
|
4265
|
+
*/
|
|
4266
|
+
binary?: boolean;
|
|
4267
|
+
/**
|
|
4268
|
+
* When true, this is the final body chunk for the response. The runtime treats the response body as complete after receiving an end-marked chunk.
|
|
4269
|
+
*/
|
|
4270
|
+
end?: boolean;
|
|
4271
|
+
error?: LlmInferenceHttpResponseChunkError;
|
|
4272
|
+
}
|
|
4273
|
+
/**
|
|
4274
|
+
* Whether the chunk was accepted.
|
|
4275
|
+
*
|
|
4276
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
4277
|
+
* via the `definition` "LlmInferenceHttpResponseChunkResult".
|
|
4278
|
+
*/
|
|
4279
|
+
/** @experimental */
|
|
4280
|
+
export interface LlmInferenceHttpResponseChunkResult {
|
|
4281
|
+
/**
|
|
4282
|
+
* True when the chunk was matched to a pending request; false when unknown.
|
|
4283
|
+
*/
|
|
4284
|
+
accepted: boolean;
|
|
4285
|
+
}
|
|
4286
|
+
/**
|
|
4287
|
+
* Response head.
|
|
4288
|
+
*
|
|
4289
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
4290
|
+
* via the `definition` "LlmInferenceHttpResponseStartRequest".
|
|
4291
|
+
*/
|
|
4292
|
+
/** @experimental */
|
|
4293
|
+
export interface LlmInferenceHttpResponseStartRequest {
|
|
4294
|
+
/**
|
|
4295
|
+
* Matches the requestId from the originating httpRequestStart frame.
|
|
4296
|
+
*/
|
|
4297
|
+
requestId: string;
|
|
4298
|
+
/**
|
|
4299
|
+
* HTTP status code.
|
|
4300
|
+
*/
|
|
4301
|
+
status: number;
|
|
4302
|
+
/**
|
|
4303
|
+
* Optional HTTP status reason phrase.
|
|
4304
|
+
*/
|
|
4305
|
+
statusText?: string;
|
|
4306
|
+
headers: LlmInferenceHeaders;
|
|
4307
|
+
}
|
|
4308
|
+
/**
|
|
4309
|
+
* Whether the start frame was accepted.
|
|
4310
|
+
*
|
|
4311
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
4312
|
+
* via the `definition` "LlmInferenceHttpResponseStartResult".
|
|
4313
|
+
*/
|
|
4314
|
+
/** @experimental */
|
|
4315
|
+
export interface LlmInferenceHttpResponseStartResult {
|
|
4316
|
+
/**
|
|
4317
|
+
* True when the response start was matched to a pending request; false when unknown.
|
|
4318
|
+
*/
|
|
4319
|
+
accepted: boolean;
|
|
4320
|
+
}
|
|
4321
|
+
/**
|
|
4322
|
+
* Indicates whether the calling client was registered as the LLM inference provider.
|
|
4323
|
+
*
|
|
4324
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
4325
|
+
* via the `definition` "LlmInferenceSetProviderResult".
|
|
4326
|
+
*/
|
|
4327
|
+
/** @experimental */
|
|
4328
|
+
export interface LlmInferenceSetProviderResult {
|
|
4329
|
+
/**
|
|
4330
|
+
* Whether the provider was set successfully
|
|
4331
|
+
*/
|
|
4332
|
+
success: boolean;
|
|
4333
|
+
}
|
|
4108
4334
|
/**
|
|
4109
4335
|
* Schema for the `LocalSessionMetadataValue` type.
|
|
4110
4336
|
*
|
|
@@ -4746,7 +4972,6 @@ export interface McpServerAuthConfigRedirectPort {
|
|
|
4746
4972
|
* Fixed port for the OAuth redirect callback server.
|
|
4747
4973
|
*/
|
|
4748
4974
|
redirectPort?: number;
|
|
4749
|
-
[k: string]: unknown | undefined;
|
|
4750
4975
|
}
|
|
4751
4976
|
/**
|
|
4752
4977
|
* Remote MCP server configuration accessed over HTTP or SSE.
|
|
@@ -4937,7 +5162,9 @@ export interface McpExecuteSamplingParams {
|
|
|
4937
5162
|
/**
|
|
4938
5163
|
* The original MCP JSON-RPC request ID (string or number). Used by the runtime to correlate the inference with the originating MCP request for telemetry; this is distinct from `requestId` (which is the schema-level cancellation handle).
|
|
4939
5164
|
*/
|
|
4940
|
-
mcpRequestId:
|
|
5165
|
+
mcpRequestId: {
|
|
5166
|
+
[k: string]: unknown | undefined;
|
|
5167
|
+
};
|
|
4941
5168
|
request: McpExecuteSamplingRequest;
|
|
4942
5169
|
}
|
|
4943
5170
|
/**
|
|
@@ -5125,6 +5352,33 @@ export interface McpTools {
|
|
|
5125
5352
|
*/
|
|
5126
5353
|
description?: string;
|
|
5127
5354
|
}
|
|
5355
|
+
/**
|
|
5356
|
+
* Pending MCP OAuth request ID and host-provided token or cancellation response.
|
|
5357
|
+
*
|
|
5358
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
5359
|
+
* via the `definition` "McpOauthHandlePendingRequest".
|
|
5360
|
+
*/
|
|
5361
|
+
/** @experimental */
|
|
5362
|
+
export interface McpOauthHandlePendingRequest {
|
|
5363
|
+
/**
|
|
5364
|
+
* OAuth request identifier from the mcp.oauth_required event
|
|
5365
|
+
*/
|
|
5366
|
+
requestId: string;
|
|
5367
|
+
result: McpOauthPendingRequestResponse;
|
|
5368
|
+
}
|
|
5369
|
+
/**
|
|
5370
|
+
* Indicates whether the pending MCP OAuth response was accepted.
|
|
5371
|
+
*
|
|
5372
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
5373
|
+
* via the `definition` "McpOauthHandlePendingResult".
|
|
5374
|
+
*/
|
|
5375
|
+
/** @experimental */
|
|
5376
|
+
export interface McpOauthHandlePendingResult {
|
|
5377
|
+
/**
|
|
5378
|
+
* Whether the response was accepted. False if the request was unknown, timed out, or already resolved.
|
|
5379
|
+
*/
|
|
5380
|
+
success: boolean;
|
|
5381
|
+
}
|
|
5128
5382
|
/**
|
|
5129
5383
|
* Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, and the callback success-page copy.
|
|
5130
5384
|
*
|
|
@@ -5646,17 +5900,29 @@ export interface ModelBillingTokenPrices {
|
|
|
5646
5900
|
*/
|
|
5647
5901
|
outputPrice?: number;
|
|
5648
5902
|
/**
|
|
5649
|
-
* AI Credits cost per billing batch of cached tokens
|
|
5903
|
+
* Deprecated: use cacheReadPrice. AI Credits cost per billing batch of cached tokens
|
|
5650
5904
|
*/
|
|
5651
5905
|
cachePrice?: number;
|
|
5906
|
+
/**
|
|
5907
|
+
* AI Credits cost per billing batch of cached (read) tokens
|
|
5908
|
+
*/
|
|
5909
|
+
cacheReadPrice?: number;
|
|
5910
|
+
/**
|
|
5911
|
+
* AI Credits cost per billing batch of cache-write (cache creation) tokens.
|
|
5912
|
+
*/
|
|
5913
|
+
cacheWritePrice?: number;
|
|
5652
5914
|
/**
|
|
5653
5915
|
* Number of tokens per standard billing batch
|
|
5654
5916
|
*/
|
|
5655
5917
|
batchSize?: number;
|
|
5656
5918
|
/**
|
|
5657
|
-
* Prompt token budget
|
|
5919
|
+
* Deprecated: use maxPromptTokens. Prompt token budget for the default tier. The total context window is this value plus the model's max_output_tokens.
|
|
5658
5920
|
*/
|
|
5659
5921
|
contextMax?: number;
|
|
5922
|
+
/**
|
|
5923
|
+
* Prompt token budget for the default tier. The total context window is this value plus the model's max_output_tokens.
|
|
5924
|
+
*/
|
|
5925
|
+
maxPromptTokens?: number;
|
|
5660
5926
|
longContext?: ModelBillingTokenPricesLongContext;
|
|
5661
5927
|
}
|
|
5662
5928
|
/**
|
|
@@ -5675,13 +5941,25 @@ export interface ModelBillingTokenPricesLongContext {
|
|
|
5675
5941
|
*/
|
|
5676
5942
|
outputPrice?: number;
|
|
5677
5943
|
/**
|
|
5678
|
-
* AI Credits cost per billing batch of cached tokens
|
|
5944
|
+
* Deprecated: use cacheReadPrice. AI Credits cost per billing batch of cached tokens
|
|
5679
5945
|
*/
|
|
5680
5946
|
cachePrice?: number;
|
|
5681
5947
|
/**
|
|
5682
|
-
*
|
|
5948
|
+
* AI Credits cost per billing batch of cached (read) tokens
|
|
5949
|
+
*/
|
|
5950
|
+
cacheReadPrice?: number;
|
|
5951
|
+
/**
|
|
5952
|
+
* AI Credits cost per billing batch of cache-write (cache creation) tokens.
|
|
5953
|
+
*/
|
|
5954
|
+
cacheWritePrice?: number;
|
|
5955
|
+
/**
|
|
5956
|
+
* Deprecated: use maxPromptTokens. Prompt token budget for the long context tier. The total context window is this value plus the model's max_output_tokens.
|
|
5683
5957
|
*/
|
|
5684
5958
|
contextMax?: number;
|
|
5959
|
+
/**
|
|
5960
|
+
* Prompt token budget for the long context tier. The total context window is this value plus the model's max_output_tokens.
|
|
5961
|
+
*/
|
|
5962
|
+
maxPromptTokens?: number;
|
|
5685
5963
|
}
|
|
5686
5964
|
/**
|
|
5687
5965
|
* Optional capability overrides (vision, tool_calls, reasoning, etc.).
|
|
@@ -5962,9 +6240,8 @@ export interface NameSetRequest {
|
|
|
5962
6240
|
/** @experimental */
|
|
5963
6241
|
export interface OptionsUpdateAdditionalContentExclusionPolicy {
|
|
5964
6242
|
rules: OptionsUpdateAdditionalContentExclusionPolicyRule[];
|
|
5965
|
-
last_updated_at:
|
|
6243
|
+
last_updated_at: unknown;
|
|
5966
6244
|
scope: OptionsUpdateAdditionalContentExclusionPolicyScope;
|
|
5967
|
-
[k: string]: unknown | undefined;
|
|
5968
6245
|
}
|
|
5969
6246
|
/**
|
|
5970
6247
|
* Schema for the `OptionsUpdateAdditionalContentExclusionPolicyRule` type.
|
|
@@ -5978,7 +6255,6 @@ export interface OptionsUpdateAdditionalContentExclusionPolicyRule {
|
|
|
5978
6255
|
ifAnyMatch?: string[];
|
|
5979
6256
|
ifNoneMatch?: string[];
|
|
5980
6257
|
source: OptionsUpdateAdditionalContentExclusionPolicyRuleSource;
|
|
5981
|
-
[k: string]: unknown | undefined;
|
|
5982
6258
|
}
|
|
5983
6259
|
/**
|
|
5984
6260
|
* Schema for the `OptionsUpdateAdditionalContentExclusionPolicyRuleSource` type.
|
|
@@ -6974,9 +7250,8 @@ export interface PermissionRulesSet {
|
|
|
6974
7250
|
/** @experimental */
|
|
6975
7251
|
export interface PermissionsConfigureAdditionalContentExclusionPolicy {
|
|
6976
7252
|
rules: PermissionsConfigureAdditionalContentExclusionPolicyRule[];
|
|
6977
|
-
last_updated_at:
|
|
7253
|
+
last_updated_at: unknown;
|
|
6978
7254
|
scope: PermissionsConfigureAdditionalContentExclusionPolicyScope;
|
|
6979
|
-
[k: string]: unknown | undefined;
|
|
6980
7255
|
}
|
|
6981
7256
|
/**
|
|
6982
7257
|
* Schema for the `PermissionsConfigureAdditionalContentExclusionPolicyRule` type.
|
|
@@ -6990,7 +7265,6 @@ export interface PermissionsConfigureAdditionalContentExclusionPolicyRule {
|
|
|
6990
7265
|
ifAnyMatch?: string[];
|
|
6991
7266
|
ifNoneMatch?: string[];
|
|
6992
7267
|
source: PermissionsConfigureAdditionalContentExclusionPolicyRuleSource;
|
|
6993
|
-
[k: string]: unknown | undefined;
|
|
6994
7268
|
}
|
|
6995
7269
|
/**
|
|
6996
7270
|
* Schema for the `PermissionsConfigureAdditionalContentExclusionPolicyRuleSource` type.
|
|
@@ -9273,7 +9547,7 @@ export interface SessionFsSqliteQueryRequest {
|
|
|
9273
9547
|
* Optional named bind parameters
|
|
9274
9548
|
*/
|
|
9275
9549
|
params?: {
|
|
9276
|
-
[k: string]:
|
|
9550
|
+
[k: string]: unknown | undefined;
|
|
9277
9551
|
};
|
|
9278
9552
|
}
|
|
9279
9553
|
/**
|
|
@@ -9741,6 +10015,12 @@ export interface SessionOpenOptions {
|
|
|
9741
10015
|
* Whether model responses stream as delta events.
|
|
9742
10016
|
*/
|
|
9743
10017
|
enableStreaming?: boolean;
|
|
10018
|
+
/**
|
|
10019
|
+
* Experimental: enable native model citations (Anthropic models today), normalized onto the `assistant.message` event. Off by default; may change or be removed while the citations surface is experimental.
|
|
10020
|
+
*
|
|
10021
|
+
* @experimental
|
|
10022
|
+
*/
|
|
10023
|
+
enableCitations?: boolean;
|
|
9744
10024
|
/**
|
|
9745
10025
|
* Override URL for the Copilot API endpoint.
|
|
9746
10026
|
*/
|
|
@@ -9799,9 +10079,8 @@ export interface SessionOpenOptions {
|
|
|
9799
10079
|
/** @experimental */
|
|
9800
10080
|
export interface SessionOpenOptionsAdditionalContentExclusionPolicy {
|
|
9801
10081
|
rules: SessionOpenOptionsAdditionalContentExclusionPolicyRule[];
|
|
9802
|
-
last_updated_at:
|
|
10082
|
+
last_updated_at: unknown;
|
|
9803
10083
|
scope: SessionOpenOptionsAdditionalContentExclusionPolicyScope;
|
|
9804
|
-
[k: string]: unknown | undefined;
|
|
9805
10084
|
}
|
|
9806
10085
|
/**
|
|
9807
10086
|
* Schema for the `SessionOpenOptionsAdditionalContentExclusionPolicyRule` type.
|
|
@@ -9815,7 +10094,6 @@ export interface SessionOpenOptionsAdditionalContentExclusionPolicyRule {
|
|
|
9815
10094
|
ifAnyMatch?: string[];
|
|
9816
10095
|
ifNoneMatch?: string[];
|
|
9817
10096
|
source: SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource;
|
|
9818
|
-
[k: string]: unknown | undefined;
|
|
9819
10097
|
}
|
|
9820
10098
|
/**
|
|
9821
10099
|
* Schema for the `SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource` type.
|
|
@@ -13079,6 +13357,31 @@ export declare function createServerRpc(connection: MessageConnection): {
|
|
|
13079
13357
|
setProvider: (params: SessionFsSetProviderRequest) => Promise<SessionFsSetProviderResult>;
|
|
13080
13358
|
};
|
|
13081
13359
|
/** @experimental */
|
|
13360
|
+
llmInference: {
|
|
13361
|
+
/**
|
|
13362
|
+
* Registers an SDK client as the LLM inference callback provider.
|
|
13363
|
+
*
|
|
13364
|
+
* @returns Indicates whether the calling client was registered as the LLM inference provider.
|
|
13365
|
+
*/
|
|
13366
|
+
setProvider: () => Promise<LlmInferenceSetProviderResult>;
|
|
13367
|
+
/**
|
|
13368
|
+
* Delivers the response head (status + headers) for an in-flight request, correlated by the requestId the runtime supplied in httpRequestStart. Must be called exactly once per request before any httpResponseChunk frames.
|
|
13369
|
+
*
|
|
13370
|
+
* @param params Response head.
|
|
13371
|
+
*
|
|
13372
|
+
* @returns Whether the start frame was accepted.
|
|
13373
|
+
*/
|
|
13374
|
+
httpResponseStart: (params: LlmInferenceHttpResponseStartRequest) => Promise<LlmInferenceHttpResponseStartResult>;
|
|
13375
|
+
/**
|
|
13376
|
+
* Delivers a body byte range (or a terminal transport error) for an in-flight response, correlated by requestId. Set `end` true on the last chunk. When `error` is set the response terminates with a transport-level failure and the runtime raises an APIConnectionError.
|
|
13377
|
+
*
|
|
13378
|
+
* @param params A response body chunk or terminal error.
|
|
13379
|
+
*
|
|
13380
|
+
* @returns Whether the chunk was accepted.
|
|
13381
|
+
*/
|
|
13382
|
+
httpResponseChunk: (params: LlmInferenceHttpResponseChunkRequest) => Promise<LlmInferenceHttpResponseChunkResult>;
|
|
13383
|
+
};
|
|
13384
|
+
/** @experimental */
|
|
13082
13385
|
sessions: {
|
|
13083
13386
|
/**
|
|
13084
13387
|
* Creates or resumes a local session and returns the opened session ID.
|
|
@@ -13776,6 +14079,14 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
|
|
|
13776
14079
|
isServerRunning: (params: McpIsServerRunningRequest) => Promise<McpIsServerRunningResult>;
|
|
13777
14080
|
/** @experimental */
|
|
13778
14081
|
oauth: {
|
|
14082
|
+
/**
|
|
14083
|
+
* Resolves a pending MCP OAuth request with a host-provided token or cancellation. The pending request is emitted as mcp.oauth_required with the data necessary to authorize the request.
|
|
14084
|
+
*
|
|
14085
|
+
* @param params Pending MCP OAuth request ID and host-provided token or cancellation response.
|
|
14086
|
+
*
|
|
14087
|
+
* @returns Indicates whether the pending MCP OAuth response was accepted.
|
|
14088
|
+
*/
|
|
14089
|
+
handlePendingRequest: (params: McpOauthHandlePendingRequest) => Promise<McpOauthHandlePendingResult>;
|
|
13779
14090
|
/**
|
|
13780
14091
|
* Starts OAuth authentication for a remote MCP server.
|
|
13781
14092
|
*
|