@github/copilot-sdk 1.0.7-preview.0 → 1.0.7-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client.js +162 -36
- package/dist/cjs/copilotRequestHandler.js +9 -0
- package/dist/cjs/ffiRuntimeHost.js +282 -0
- package/dist/cjs/generated/rpc.js +32 -3
- package/dist/cjs/types.js +12 -0
- package/dist/client.d.ts +49 -0
- package/dist/client.js +152 -36
- package/dist/copilotRequestHandler.d.ts +3 -0
- package/dist/copilotRequestHandler.js +9 -0
- package/dist/ffiRuntimeHost.d.ts +40 -0
- package/dist/ffiRuntimeHost.js +248 -0
- package/dist/generated/rpc.d.ts +325 -9
- package/dist/generated/rpc.js +32 -3
- package/dist/generated/session-events.d.ts +100 -1
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +53 -1
- package/dist/types.js +12 -0
- package/package.json +3 -2
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import koffi from "koffi";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { PassThrough, Writable } from "node:stream";
|
|
5
|
+
const SYMBOL_PREFIX = "copilot_runtime_";
|
|
6
|
+
const KEEP_ALIVE_INTERVAL_MS = 1 << 30;
|
|
7
|
+
let loadedLibraryPath;
|
|
8
|
+
let loadedLibrary;
|
|
9
|
+
function loadLibrary(libraryPath) {
|
|
10
|
+
if (loadedLibrary) {
|
|
11
|
+
if (loadedLibraryPath !== libraryPath) {
|
|
12
|
+
throw new Error(
|
|
13
|
+
`An in-process FFI runtime library is already loaded from '${loadedLibraryPath}'; loading a different library from '${libraryPath}' in the same process is not supported.`
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
return loadedLibrary;
|
|
17
|
+
}
|
|
18
|
+
const lib = koffi.load(libraryPath);
|
|
19
|
+
const outboundCallbackType = koffi.pointer(
|
|
20
|
+
koffi.proto(
|
|
21
|
+
`void ${SYMBOL_PREFIX}outbound(void *userData, uint8 *bytesPtr, size_t bytesLen)`
|
|
22
|
+
)
|
|
23
|
+
);
|
|
24
|
+
loadedLibrary = {
|
|
25
|
+
hostStart: lib.func(`${SYMBOL_PREFIX}host_start`, "uint32", [
|
|
26
|
+
"uint8*",
|
|
27
|
+
"size_t",
|
|
28
|
+
"uint8*",
|
|
29
|
+
"size_t"
|
|
30
|
+
]),
|
|
31
|
+
hostShutdown: lib.func(`${SYMBOL_PREFIX}host_shutdown`, "bool", ["uint32"]),
|
|
32
|
+
connectionOpen: lib.func(`${SYMBOL_PREFIX}connection_open`, "uint32", [
|
|
33
|
+
"uint32",
|
|
34
|
+
outboundCallbackType,
|
|
35
|
+
"void*",
|
|
36
|
+
"uint8*",
|
|
37
|
+
"size_t",
|
|
38
|
+
"uint8*",
|
|
39
|
+
"size_t",
|
|
40
|
+
"uint8*",
|
|
41
|
+
"size_t"
|
|
42
|
+
]),
|
|
43
|
+
connectionWrite: lib.func(`${SYMBOL_PREFIX}connection_write`, "bool", [
|
|
44
|
+
"uint32",
|
|
45
|
+
"uint8*",
|
|
46
|
+
"size_t"
|
|
47
|
+
]),
|
|
48
|
+
connectionClose: lib.func(`${SYMBOL_PREFIX}connection_close`, "bool", ["uint32"]),
|
|
49
|
+
outboundCallbackType
|
|
50
|
+
};
|
|
51
|
+
loadedLibraryPath = libraryPath;
|
|
52
|
+
return loadedLibrary;
|
|
53
|
+
}
|
|
54
|
+
function buildArgvJson(cliEntrypoint) {
|
|
55
|
+
const argv = cliEntrypoint.toLowerCase().endsWith(".js") ? ["node", cliEntrypoint, "--embedded-host", "--no-auto-update"] : [cliEntrypoint, "--embedded-host", "--no-auto-update"];
|
|
56
|
+
return Buffer.from(JSON.stringify(argv), "utf8");
|
|
57
|
+
}
|
|
58
|
+
function buildEnvJson(environment) {
|
|
59
|
+
if (!environment) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const obj = {};
|
|
63
|
+
for (const [key, value] of Object.entries(environment)) {
|
|
64
|
+
if (value !== void 0) {
|
|
65
|
+
obj[key] = value;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (Object.keys(obj).length === 0) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
return Buffer.from(JSON.stringify(obj), "utf8");
|
|
72
|
+
}
|
|
73
|
+
class FfiRuntimeHost {
|
|
74
|
+
constructor(libraryPath, cliEntrypoint, environment) {
|
|
75
|
+
this.libraryPath = libraryPath;
|
|
76
|
+
this.cliEntrypoint = cliEntrypoint;
|
|
77
|
+
this.environment = environment;
|
|
78
|
+
this.lib = loadLibrary(libraryPath);
|
|
79
|
+
this.receiveStream = new PassThrough();
|
|
80
|
+
this.sendStream = new Writable({
|
|
81
|
+
// connection_write enqueues the frame into the runtime's inbound channel and
|
|
82
|
+
// returns immediately, so a synchronous FFI call is sufficient here.
|
|
83
|
+
write: (chunk, _encoding, callback) => {
|
|
84
|
+
try {
|
|
85
|
+
this.writeFrame(chunk);
|
|
86
|
+
callback();
|
|
87
|
+
} catch (error) {
|
|
88
|
+
callback(error);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
libraryPath;
|
|
94
|
+
cliEntrypoint;
|
|
95
|
+
environment;
|
|
96
|
+
lib;
|
|
97
|
+
serverId = 0;
|
|
98
|
+
connectionId = 0;
|
|
99
|
+
disposed = false;
|
|
100
|
+
outboundCallback;
|
|
101
|
+
keepAliveTimer;
|
|
102
|
+
/** The stream JSON-RPC reads server→client frames from. */
|
|
103
|
+
receiveStream;
|
|
104
|
+
/** The stream JSON-RPC writes client→server frames to. */
|
|
105
|
+
sendStream;
|
|
106
|
+
/**
|
|
107
|
+
* Resolves the cdylib next to the given CLI entrypoint and prepares the FFI host.
|
|
108
|
+
* The cdylib is resolved as `prebuilds/<prebuildsFolder>/runtime.node` relative to
|
|
109
|
+
* the entrypoint directory (the napi-rs `<node-platform>-<arch>` layout, e.g.
|
|
110
|
+
* `linux-x64`). Throws if it cannot be found.
|
|
111
|
+
*/
|
|
112
|
+
static create(cliEntrypoint, prebuildsFolder, environment) {
|
|
113
|
+
const fullEntrypoint = resolve(cliEntrypoint);
|
|
114
|
+
const distDir = dirname(fullEntrypoint);
|
|
115
|
+
const libraryPath = join(distDir, "prebuilds", prebuildsFolder, "runtime.node");
|
|
116
|
+
if (!existsSync(libraryPath)) {
|
|
117
|
+
throw new Error(`FFI runtime library not found. Looked for '${libraryPath}'.`);
|
|
118
|
+
}
|
|
119
|
+
return new FfiRuntimeHost(libraryPath, fullEntrypoint, environment);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Starts the in-process runtime: spawns the CLI worker via the native host,
|
|
123
|
+
* waits for readiness, and opens the FFI JSON-RPC connection.
|
|
124
|
+
*/
|
|
125
|
+
async start() {
|
|
126
|
+
const argvJson = buildArgvJson(this.cliEntrypoint);
|
|
127
|
+
const envJson = buildEnvJson(this.environment);
|
|
128
|
+
this.serverId = await new Promise((resolvePromise, rejectPromise) => {
|
|
129
|
+
this.lib.hostStart.async(
|
|
130
|
+
argvJson,
|
|
131
|
+
argvJson.length,
|
|
132
|
+
envJson,
|
|
133
|
+
envJson ? envJson.length : 0,
|
|
134
|
+
(error, result) => {
|
|
135
|
+
if (error) {
|
|
136
|
+
rejectPromise(error);
|
|
137
|
+
} else {
|
|
138
|
+
resolvePromise(result);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
});
|
|
143
|
+
if (!this.serverId) {
|
|
144
|
+
throw new Error(
|
|
145
|
+
`copilot_runtime_host_start failed (library '${this.libraryPath}', entrypoint '${this.cliEntrypoint}').`
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
this.outboundCallback = koffi.register(
|
|
149
|
+
(_userData, bytesPtr, bytesLen) => this.feedInbound(bytesPtr, bytesLen),
|
|
150
|
+
this.lib.outboundCallbackType
|
|
151
|
+
);
|
|
152
|
+
this.connectionId = this.lib.connectionOpen(
|
|
153
|
+
this.serverId,
|
|
154
|
+
this.outboundCallback,
|
|
155
|
+
null,
|
|
156
|
+
null,
|
|
157
|
+
0,
|
|
158
|
+
null,
|
|
159
|
+
0,
|
|
160
|
+
null,
|
|
161
|
+
0
|
|
162
|
+
);
|
|
163
|
+
if (!this.connectionId) {
|
|
164
|
+
this.unregisterCallback();
|
|
165
|
+
this.lib.hostShutdown(this.serverId);
|
|
166
|
+
this.serverId = 0;
|
|
167
|
+
throw new Error("copilot_runtime_connection_open failed.");
|
|
168
|
+
}
|
|
169
|
+
this.keepAliveTimer = setInterval(() => {
|
|
170
|
+
}, KEEP_ALIVE_INTERVAL_MS);
|
|
171
|
+
}
|
|
172
|
+
writeFrame(frame) {
|
|
173
|
+
if (this.disposed || !this.connectionId) {
|
|
174
|
+
throw new Error("The in-process runtime connection is closed.");
|
|
175
|
+
}
|
|
176
|
+
const ok = this.lib.connectionWrite(this.connectionId, frame, frame.length);
|
|
177
|
+
if (!ok) {
|
|
178
|
+
throw new Error("Failed to write a frame to the in-process runtime connection.");
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Native outbound (server→client) callback. koffi delivers it on the JS event loop
|
|
183
|
+
* via a threadsafe function, so the frame is decoded and written straight to
|
|
184
|
+
* {@link receiveStream}. The native pointer is only valid for this call, so the
|
|
185
|
+
* bytes are copied out before returning.
|
|
186
|
+
*/
|
|
187
|
+
feedInbound(bytesPtr, bytesLen) {
|
|
188
|
+
try {
|
|
189
|
+
if (this.disposed || this.receiveStream.writableEnded) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const length = Number(bytesLen);
|
|
193
|
+
if (!bytesPtr || length <= 0) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const bytes = koffi.decode(
|
|
197
|
+
bytesPtr,
|
|
198
|
+
koffi.array("uint8", length, "Typed")
|
|
199
|
+
);
|
|
200
|
+
this.receiveStream.write(Buffer.from(bytes));
|
|
201
|
+
} catch (error) {
|
|
202
|
+
console.error(
|
|
203
|
+
`In-process FFI inbound callback failed: ${error instanceof Error ? error.stack ?? error.message : String(error)}`
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
unregisterCallback() {
|
|
208
|
+
if (this.outboundCallback === void 0) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const callback = this.outboundCallback;
|
|
212
|
+
this.outboundCallback = void 0;
|
|
213
|
+
try {
|
|
214
|
+
koffi.unregister(callback);
|
|
215
|
+
} catch {
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/** Closes the FFI connection, shuts down the native host, and releases resources. */
|
|
219
|
+
dispose() {
|
|
220
|
+
if (this.disposed) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
this.disposed = true;
|
|
224
|
+
if (this.keepAliveTimer !== void 0) {
|
|
225
|
+
clearInterval(this.keepAliveTimer);
|
|
226
|
+
this.keepAliveTimer = void 0;
|
|
227
|
+
}
|
|
228
|
+
try {
|
|
229
|
+
if (this.connectionId) {
|
|
230
|
+
this.lib.connectionClose(this.connectionId);
|
|
231
|
+
this.connectionId = 0;
|
|
232
|
+
}
|
|
233
|
+
} catch {
|
|
234
|
+
}
|
|
235
|
+
try {
|
|
236
|
+
if (this.serverId) {
|
|
237
|
+
this.lib.hostShutdown(this.serverId);
|
|
238
|
+
this.serverId = 0;
|
|
239
|
+
}
|
|
240
|
+
} catch {
|
|
241
|
+
}
|
|
242
|
+
this.receiveStream.end();
|
|
243
|
+
this.unregisterCallback();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
export {
|
|
247
|
+
FfiRuntimeHost
|
|
248
|
+
};
|
package/dist/generated/rpc.d.ts
CHANGED
|
@@ -5791,24 +5791,27 @@ export interface McpAppsListToolsResult {
|
|
|
5791
5791
|
}[];
|
|
5792
5792
|
}
|
|
5793
5793
|
/**
|
|
5794
|
-
*
|
|
5794
|
+
* @deprecated
|
|
5795
|
+
* Deprecated/obsolete MCP Apps alias for `McpResourcesReadRequest`; use `session.mcp.resources.read` instead.
|
|
5795
5796
|
*
|
|
5796
5797
|
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
5797
5798
|
* via the `definition` "McpAppsReadResourceRequest".
|
|
5798
5799
|
*/
|
|
5799
5800
|
/** @experimental */
|
|
5801
|
+
/** @deprecated */
|
|
5800
5802
|
export interface McpAppsReadResourceRequest {
|
|
5801
5803
|
/**
|
|
5802
5804
|
* Name of the MCP server hosting the resource
|
|
5803
5805
|
*/
|
|
5804
5806
|
serverName: string;
|
|
5805
5807
|
/**
|
|
5806
|
-
* Resource URI
|
|
5808
|
+
* Resource URI
|
|
5807
5809
|
*/
|
|
5808
5810
|
uri: string;
|
|
5809
5811
|
}
|
|
5810
5812
|
/**
|
|
5811
|
-
*
|
|
5813
|
+
* @deprecated
|
|
5814
|
+
* Deprecated/obsolete MCP Apps alias for `McpResourcesReadResult`; use `session.mcp.resources.read` instead.
|
|
5812
5815
|
*
|
|
5813
5816
|
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
5814
5817
|
* via the `definition` "McpAppsReadResourceResult".
|
|
@@ -5821,7 +5824,8 @@ export interface McpAppsReadResourceResult {
|
|
|
5821
5824
|
contents: McpAppsResourceContent[];
|
|
5822
5825
|
}
|
|
5823
5826
|
/**
|
|
5824
|
-
*
|
|
5827
|
+
* @deprecated
|
|
5828
|
+
* Deprecated/obsolete MCP Apps alias for `McpResourceContent`; use `session.mcp.resources.read` instead.
|
|
5825
5829
|
*
|
|
5826
5830
|
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
5827
5831
|
* via the `definition` "McpAppsResourceContent".
|
|
@@ -5829,7 +5833,7 @@ export interface McpAppsReadResourceResult {
|
|
|
5829
5833
|
/** @experimental */
|
|
5830
5834
|
export interface McpAppsResourceContent {
|
|
5831
5835
|
/**
|
|
5832
|
-
* The resource URI
|
|
5836
|
+
* The resource URI
|
|
5833
5837
|
*/
|
|
5834
5838
|
uri: string;
|
|
5835
5839
|
/**
|
|
@@ -5845,7 +5849,7 @@ export interface McpAppsResourceContent {
|
|
|
5845
5849
|
*/
|
|
5846
5850
|
blob?: string;
|
|
5847
5851
|
/**
|
|
5848
|
-
* Resource-level metadata
|
|
5852
|
+
* Resource-level metadata
|
|
5849
5853
|
*/
|
|
5850
5854
|
_meta?: {
|
|
5851
5855
|
[k: string]: unknown | undefined;
|
|
@@ -6491,6 +6495,289 @@ export interface McpRemoveGitHubResult {
|
|
|
6491
6495
|
*/
|
|
6492
6496
|
removed: boolean;
|
|
6493
6497
|
}
|
|
6498
|
+
/**
|
|
6499
|
+
* An MCP resource descriptor (spec `Resource`): URI, name, and optional title, description, MIME type, size, icons, annotations, and metadata. Server-provided fields outside the standard descriptor shape are exposed under `additionalProperties`.
|
|
6500
|
+
*
|
|
6501
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
6502
|
+
* via the `definition` "McpResource".
|
|
6503
|
+
*/
|
|
6504
|
+
/** @experimental */
|
|
6505
|
+
export interface McpResource {
|
|
6506
|
+
/**
|
|
6507
|
+
* The resource URI (e.g. ui://... or file:///...)
|
|
6508
|
+
*/
|
|
6509
|
+
uri: string;
|
|
6510
|
+
/**
|
|
6511
|
+
* The programmatic name of the resource
|
|
6512
|
+
*/
|
|
6513
|
+
name: string;
|
|
6514
|
+
/**
|
|
6515
|
+
* Optional human-readable display title
|
|
6516
|
+
*/
|
|
6517
|
+
title?: string;
|
|
6518
|
+
/**
|
|
6519
|
+
* Optional description of what this resource represents
|
|
6520
|
+
*/
|
|
6521
|
+
description?: string;
|
|
6522
|
+
/**
|
|
6523
|
+
* MIME type of the resource, if known
|
|
6524
|
+
*/
|
|
6525
|
+
mimeType?: string;
|
|
6526
|
+
/**
|
|
6527
|
+
* Resource size in bytes, when known
|
|
6528
|
+
*/
|
|
6529
|
+
size?: number;
|
|
6530
|
+
/**
|
|
6531
|
+
* Icons associated with this resource
|
|
6532
|
+
*/
|
|
6533
|
+
icons?: McpResourceIcon[];
|
|
6534
|
+
annotations?: McpResourceAnnotations;
|
|
6535
|
+
/**
|
|
6536
|
+
* Resource-level metadata
|
|
6537
|
+
*/
|
|
6538
|
+
_meta?: {
|
|
6539
|
+
[k: string]: unknown | undefined;
|
|
6540
|
+
};
|
|
6541
|
+
/**
|
|
6542
|
+
* Server-provided non-standard descriptor fields preserved from the MCP response
|
|
6543
|
+
*/
|
|
6544
|
+
additionalProperties?: {
|
|
6545
|
+
[k: string]: unknown | undefined;
|
|
6546
|
+
};
|
|
6547
|
+
}
|
|
6548
|
+
/**
|
|
6549
|
+
* A resource icon descriptor plus preserved non-standard icon fields.
|
|
6550
|
+
*
|
|
6551
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
6552
|
+
* via the `definition` "McpResourceIcon".
|
|
6553
|
+
*/
|
|
6554
|
+
/** @experimental */
|
|
6555
|
+
export interface McpResourceIcon {
|
|
6556
|
+
/**
|
|
6557
|
+
* Icon URI
|
|
6558
|
+
*/
|
|
6559
|
+
src: string;
|
|
6560
|
+
/**
|
|
6561
|
+
* Icon MIME type, when known
|
|
6562
|
+
*/
|
|
6563
|
+
mimeType?: string;
|
|
6564
|
+
/**
|
|
6565
|
+
* Icon sizes hint
|
|
6566
|
+
*/
|
|
6567
|
+
sizes?: string;
|
|
6568
|
+
/**
|
|
6569
|
+
* Theme hint for this icon
|
|
6570
|
+
*/
|
|
6571
|
+
theme?: string;
|
|
6572
|
+
/**
|
|
6573
|
+
* Server-provided non-standard icon fields preserved from the MCP response
|
|
6574
|
+
*/
|
|
6575
|
+
additionalProperties?: {
|
|
6576
|
+
[k: string]: unknown | undefined;
|
|
6577
|
+
};
|
|
6578
|
+
}
|
|
6579
|
+
/**
|
|
6580
|
+
* Standard MCP resource annotations plus preserved non-standard annotation fields.
|
|
6581
|
+
*
|
|
6582
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
6583
|
+
* via the `definition` "McpResourceAnnotations".
|
|
6584
|
+
*/
|
|
6585
|
+
/** @experimental */
|
|
6586
|
+
export interface McpResourceAnnotations {
|
|
6587
|
+
/**
|
|
6588
|
+
* Intended audience roles for this resource
|
|
6589
|
+
*/
|
|
6590
|
+
audience?: string[];
|
|
6591
|
+
/**
|
|
6592
|
+
* Priority hint for model/client use
|
|
6593
|
+
*/
|
|
6594
|
+
priority?: number;
|
|
6595
|
+
/**
|
|
6596
|
+
* Last-modified timestamp hint
|
|
6597
|
+
*/
|
|
6598
|
+
lastModified?: string;
|
|
6599
|
+
/**
|
|
6600
|
+
* Server-provided non-standard annotation fields preserved from the MCP response
|
|
6601
|
+
*/
|
|
6602
|
+
additionalProperties?: {
|
|
6603
|
+
[k: string]: unknown | undefined;
|
|
6604
|
+
};
|
|
6605
|
+
}
|
|
6606
|
+
/**
|
|
6607
|
+
* MCP resource content with URI, optional MIME type, text or base64 blob, and resource metadata.
|
|
6608
|
+
*
|
|
6609
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
6610
|
+
* via the `definition` "McpResourceContent".
|
|
6611
|
+
*/
|
|
6612
|
+
/** @experimental */
|
|
6613
|
+
export interface McpResourceContent {
|
|
6614
|
+
/**
|
|
6615
|
+
* The resource URI
|
|
6616
|
+
*/
|
|
6617
|
+
uri: string;
|
|
6618
|
+
/**
|
|
6619
|
+
* MIME type of the content
|
|
6620
|
+
*/
|
|
6621
|
+
mimeType?: string;
|
|
6622
|
+
/**
|
|
6623
|
+
* Text content (e.g. HTML)
|
|
6624
|
+
*/
|
|
6625
|
+
text?: string;
|
|
6626
|
+
/**
|
|
6627
|
+
* Base64-encoded binary content
|
|
6628
|
+
*/
|
|
6629
|
+
blob?: string;
|
|
6630
|
+
/**
|
|
6631
|
+
* Resource-level metadata (CSP, permissions, etc.)
|
|
6632
|
+
*/
|
|
6633
|
+
_meta?: {
|
|
6634
|
+
[k: string]: unknown | undefined;
|
|
6635
|
+
};
|
|
6636
|
+
}
|
|
6637
|
+
/**
|
|
6638
|
+
* MCP server whose resources to enumerate.
|
|
6639
|
+
*
|
|
6640
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
6641
|
+
* via the `definition` "McpResourcesListRequest".
|
|
6642
|
+
*/
|
|
6643
|
+
/** @experimental */
|
|
6644
|
+
export interface McpResourcesListRequest {
|
|
6645
|
+
/**
|
|
6646
|
+
* Name of the MCP server whose resources to enumerate
|
|
6647
|
+
*/
|
|
6648
|
+
serverName: string;
|
|
6649
|
+
/**
|
|
6650
|
+
* Opaque MCP pagination cursor from a prior `nextCursor` value
|
|
6651
|
+
*/
|
|
6652
|
+
cursor?: string;
|
|
6653
|
+
}
|
|
6654
|
+
/**
|
|
6655
|
+
* One page of resources advertised by the named MCP server.
|
|
6656
|
+
*
|
|
6657
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
6658
|
+
* via the `definition` "McpResourcesListResult".
|
|
6659
|
+
*/
|
|
6660
|
+
/** @experimental */
|
|
6661
|
+
export interface McpResourcesListResult {
|
|
6662
|
+
/**
|
|
6663
|
+
* Resources advertised by the server (proxied MCP `resources/list`)
|
|
6664
|
+
*/
|
|
6665
|
+
resources: McpResource[];
|
|
6666
|
+
/**
|
|
6667
|
+
* Opaque cursor for the next page, if the server has more resources
|
|
6668
|
+
*/
|
|
6669
|
+
nextCursor?: string;
|
|
6670
|
+
}
|
|
6671
|
+
/**
|
|
6672
|
+
* MCP server whose resource templates to enumerate.
|
|
6673
|
+
*
|
|
6674
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
6675
|
+
* via the `definition` "McpResourcesListTemplatesRequest".
|
|
6676
|
+
*/
|
|
6677
|
+
/** @experimental */
|
|
6678
|
+
export interface McpResourcesListTemplatesRequest {
|
|
6679
|
+
/**
|
|
6680
|
+
* Name of the MCP server whose resource templates to enumerate
|
|
6681
|
+
*/
|
|
6682
|
+
serverName: string;
|
|
6683
|
+
/**
|
|
6684
|
+
* Opaque MCP pagination cursor from a prior `nextCursor` value
|
|
6685
|
+
*/
|
|
6686
|
+
cursor?: string;
|
|
6687
|
+
}
|
|
6688
|
+
/**
|
|
6689
|
+
* One page of resource templates advertised by the named MCP server.
|
|
6690
|
+
*
|
|
6691
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
6692
|
+
* via the `definition` "McpResourcesListTemplatesResult".
|
|
6693
|
+
*/
|
|
6694
|
+
/** @experimental */
|
|
6695
|
+
export interface McpResourcesListTemplatesResult {
|
|
6696
|
+
/**
|
|
6697
|
+
* Resource templates advertised by the server (proxied MCP `resources/templates/list`)
|
|
6698
|
+
*/
|
|
6699
|
+
resourceTemplates: McpResourceTemplate[];
|
|
6700
|
+
/**
|
|
6701
|
+
* Opaque cursor for the next page, if the server has more resource templates
|
|
6702
|
+
*/
|
|
6703
|
+
nextCursor?: string;
|
|
6704
|
+
}
|
|
6705
|
+
/**
|
|
6706
|
+
* An MCP resource template descriptor (spec `ResourceTemplate`): an RFC 6570 URI template, name, and optional title, description, MIME type, icons, annotations, and metadata. Server-provided fields outside the standard descriptor shape are exposed under `additionalProperties`.
|
|
6707
|
+
*
|
|
6708
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
6709
|
+
* via the `definition` "McpResourceTemplate".
|
|
6710
|
+
*/
|
|
6711
|
+
/** @experimental */
|
|
6712
|
+
export interface McpResourceTemplate {
|
|
6713
|
+
/**
|
|
6714
|
+
* An RFC 6570 URI template for constructing resource URIs
|
|
6715
|
+
*/
|
|
6716
|
+
uriTemplate: string;
|
|
6717
|
+
/**
|
|
6718
|
+
* The programmatic name of the resource template
|
|
6719
|
+
*/
|
|
6720
|
+
name: string;
|
|
6721
|
+
/**
|
|
6722
|
+
* Optional human-readable display title
|
|
6723
|
+
*/
|
|
6724
|
+
title?: string;
|
|
6725
|
+
/**
|
|
6726
|
+
* Optional description of what this template is for
|
|
6727
|
+
*/
|
|
6728
|
+
description?: string;
|
|
6729
|
+
/**
|
|
6730
|
+
* MIME type for resources matching this template, if uniform
|
|
6731
|
+
*/
|
|
6732
|
+
mimeType?: string;
|
|
6733
|
+
/**
|
|
6734
|
+
* Icons associated with resources matching this template
|
|
6735
|
+
*/
|
|
6736
|
+
icons?: McpResourceIcon[];
|
|
6737
|
+
annotations?: McpResourceAnnotations;
|
|
6738
|
+
/**
|
|
6739
|
+
* Resource-template-level metadata
|
|
6740
|
+
*/
|
|
6741
|
+
_meta?: {
|
|
6742
|
+
[k: string]: unknown | undefined;
|
|
6743
|
+
};
|
|
6744
|
+
/**
|
|
6745
|
+
* Server-provided non-standard descriptor fields preserved from the MCP response
|
|
6746
|
+
*/
|
|
6747
|
+
additionalProperties?: {
|
|
6748
|
+
[k: string]: unknown | undefined;
|
|
6749
|
+
};
|
|
6750
|
+
}
|
|
6751
|
+
/**
|
|
6752
|
+
* MCP server and resource URI to fetch.
|
|
6753
|
+
*
|
|
6754
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
6755
|
+
* via the `definition` "McpResourcesReadRequest".
|
|
6756
|
+
*/
|
|
6757
|
+
/** @experimental */
|
|
6758
|
+
export interface McpResourcesReadRequest {
|
|
6759
|
+
/**
|
|
6760
|
+
* Name of the MCP server hosting the resource
|
|
6761
|
+
*/
|
|
6762
|
+
serverName: string;
|
|
6763
|
+
/**
|
|
6764
|
+
* Resource URI
|
|
6765
|
+
*/
|
|
6766
|
+
uri: string;
|
|
6767
|
+
}
|
|
6768
|
+
/**
|
|
6769
|
+
* Resource contents returned by the MCP server.
|
|
6770
|
+
*
|
|
6771
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
6772
|
+
* via the `definition` "McpResourcesReadResult".
|
|
6773
|
+
*/
|
|
6774
|
+
/** @experimental */
|
|
6775
|
+
export interface McpResourcesReadResult {
|
|
6776
|
+
/**
|
|
6777
|
+
* Resource contents returned by the server
|
|
6778
|
+
*/
|
|
6779
|
+
contents: McpResourceContent[];
|
|
6780
|
+
}
|
|
6494
6781
|
/**
|
|
6495
6782
|
* Server name and optional replacement configuration for an individual MCP server restart. Omit `config` for a config-free restart-by-name of an already-configured server.
|
|
6496
6783
|
*
|
|
@@ -16100,11 +16387,13 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
|
|
|
16100
16387
|
/** @experimental */
|
|
16101
16388
|
apps: {
|
|
16102
16389
|
/**
|
|
16103
|
-
*
|
|
16390
|
+
* Deprecated/obsolete alias for `session.mcp.resources.read`; retained for backwards compatibility with earlier MCP Apps host integrations.
|
|
16104
16391
|
*
|
|
16105
|
-
* @param params MCP
|
|
16392
|
+
* @param params Deprecated/obsolete MCP Apps alias for `McpResourcesReadRequest`; use `session.mcp.resources.read` instead.
|
|
16106
16393
|
*
|
|
16107
|
-
* @returns
|
|
16394
|
+
* @returns Deprecated/obsolete MCP Apps alias for `McpResourcesReadResult`; use `session.mcp.resources.read` instead.
|
|
16395
|
+
*
|
|
16396
|
+
* @deprecated
|
|
16108
16397
|
*/
|
|
16109
16398
|
readResource: (params: McpAppsReadResourceRequest) => Promise<McpAppsReadResourceResult>;
|
|
16110
16399
|
/**
|
|
@@ -16144,6 +16433,33 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
|
|
|
16144
16433
|
*/
|
|
16145
16434
|
diagnose: (params: McpAppsDiagnoseRequest) => Promise<McpAppsDiagnoseResult>;
|
|
16146
16435
|
};
|
|
16436
|
+
/** @experimental */
|
|
16437
|
+
resources: {
|
|
16438
|
+
/**
|
|
16439
|
+
* Fetch an MCP resource from a connected server by URI (proxies MCP `resources/read`).
|
|
16440
|
+
*
|
|
16441
|
+
* @param params MCP server and resource URI to fetch.
|
|
16442
|
+
*
|
|
16443
|
+
* @returns Resource contents returned by the MCP server.
|
|
16444
|
+
*/
|
|
16445
|
+
read: (params: McpResourcesReadRequest) => Promise<McpResourcesReadResult>;
|
|
16446
|
+
/**
|
|
16447
|
+
* Enumerate one page of resources a connected MCP server exposes (proxies MCP `resources/list`). Pass `cursor` to continue from a prior result's `nextCursor`.
|
|
16448
|
+
*
|
|
16449
|
+
* @param params MCP server whose resources to enumerate.
|
|
16450
|
+
*
|
|
16451
|
+
* @returns One page of resources advertised by the named MCP server.
|
|
16452
|
+
*/
|
|
16453
|
+
list: (params: McpResourcesListRequest) => Promise<McpResourcesListResult>;
|
|
16454
|
+
/**
|
|
16455
|
+
* Enumerate one page of resource templates a connected MCP server exposes (proxies MCP `resources/templates/list`). Pass `cursor` to continue from a prior result's `nextCursor`.
|
|
16456
|
+
*
|
|
16457
|
+
* @param params MCP server whose resource templates to enumerate.
|
|
16458
|
+
*
|
|
16459
|
+
* @returns One page of resource templates advertised by the named MCP server.
|
|
16460
|
+
*/
|
|
16461
|
+
listTemplates: (params: McpResourcesListTemplatesRequest) => Promise<McpResourcesListTemplatesResult>;
|
|
16462
|
+
};
|
|
16147
16463
|
};
|
|
16148
16464
|
/** @experimental */
|
|
16149
16465
|
plugins: {
|
package/dist/generated/rpc.js
CHANGED
|
@@ -1203,11 +1203,13 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1203
1203
|
/** @experimental */
|
|
1204
1204
|
apps: {
|
|
1205
1205
|
/**
|
|
1206
|
-
*
|
|
1206
|
+
* Deprecated/obsolete alias for `session.mcp.resources.read`; retained for backwards compatibility with earlier MCP Apps host integrations.
|
|
1207
1207
|
*
|
|
1208
|
-
* @param params MCP
|
|
1208
|
+
* @param params Deprecated/obsolete MCP Apps alias for `McpResourcesReadRequest`; use `session.mcp.resources.read` instead.
|
|
1209
1209
|
*
|
|
1210
|
-
* @returns
|
|
1210
|
+
* @returns Deprecated/obsolete MCP Apps alias for `McpResourcesReadResult`; use `session.mcp.resources.read` instead.
|
|
1211
|
+
*
|
|
1212
|
+
* @deprecated
|
|
1211
1213
|
*/
|
|
1212
1214
|
readResource: async (params) => connection.sendRequest("session.mcp.apps.readResource", { sessionId, ...params }),
|
|
1213
1215
|
/**
|
|
@@ -1246,6 +1248,33 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1246
1248
|
* @returns Diagnostic snapshot of MCP Apps wiring for the named server.
|
|
1247
1249
|
*/
|
|
1248
1250
|
diagnose: async (params) => connection.sendRequest("session.mcp.apps.diagnose", { sessionId, ...params })
|
|
1251
|
+
},
|
|
1252
|
+
/** @experimental */
|
|
1253
|
+
resources: {
|
|
1254
|
+
/**
|
|
1255
|
+
* Fetch an MCP resource from a connected server by URI (proxies MCP `resources/read`).
|
|
1256
|
+
*
|
|
1257
|
+
* @param params MCP server and resource URI to fetch.
|
|
1258
|
+
*
|
|
1259
|
+
* @returns Resource contents returned by the MCP server.
|
|
1260
|
+
*/
|
|
1261
|
+
read: async (params) => connection.sendRequest("session.mcp.resources.read", { sessionId, ...params }),
|
|
1262
|
+
/**
|
|
1263
|
+
* Enumerate one page of resources a connected MCP server exposes (proxies MCP `resources/list`). Pass `cursor` to continue from a prior result's `nextCursor`.
|
|
1264
|
+
*
|
|
1265
|
+
* @param params MCP server whose resources to enumerate.
|
|
1266
|
+
*
|
|
1267
|
+
* @returns One page of resources advertised by the named MCP server.
|
|
1268
|
+
*/
|
|
1269
|
+
list: async (params) => connection.sendRequest("session.mcp.resources.list", { sessionId, ...params }),
|
|
1270
|
+
/**
|
|
1271
|
+
* Enumerate one page of resource templates a connected MCP server exposes (proxies MCP `resources/templates/list`). Pass `cursor` to continue from a prior result's `nextCursor`.
|
|
1272
|
+
*
|
|
1273
|
+
* @param params MCP server whose resource templates to enumerate.
|
|
1274
|
+
*
|
|
1275
|
+
* @returns One page of resource templates advertised by the named MCP server.
|
|
1276
|
+
*/
|
|
1277
|
+
listTemplates: async (params) => connection.sendRequest("session.mcp.resources.listTemplates", { sessionId, ...params })
|
|
1249
1278
|
}
|
|
1250
1279
|
},
|
|
1251
1280
|
/** @experimental */
|