@mcpview/compose 0.14.0 → 0.15.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/CHANGELOG.md +110 -1
- package/README.md +116 -24
- package/esm/src/code-mode/engine.d.ts +59 -0
- package/esm/src/code-mode/engine.d.ts.map +1 -0
- package/esm/src/code-mode/engine.js +189 -0
- package/esm/src/code-mode/guest-worker.d.ts +2 -5
- package/esm/src/code-mode/guest-worker.d.ts.map +1 -1
- package/esm/src/code-mode/guest-worker.js +4 -75
- package/esm/src/code-mode/sandbox-api.d.ts +37 -0
- package/esm/src/code-mode/sandbox-api.d.ts.map +1 -0
- package/esm/src/code-mode/sandbox-api.js +36 -0
- package/esm/src/code-mode/sandbox-core.d.ts +99 -21
- package/esm/src/code-mode/sandbox-core.d.ts.map +1 -1
- package/esm/src/code-mode/sandbox-core.js +926 -221
- package/esm/src/code-mode/sandbox-worker.d.ts +37 -0
- package/esm/src/code-mode/sandbox-worker.d.ts.map +1 -0
- package/esm/src/code-mode/sandbox-worker.js +140 -0
- package/esm/src/code-mode/sandbox.d.ts +142 -29
- package/esm/src/code-mode/sandbox.d.ts.map +1 -1
- package/esm/src/code-mode/sandbox.js +402 -68
- package/esm/src/code-mode/surface.d.ts +148 -0
- package/esm/src/code-mode/surface.d.ts.map +1 -0
- package/esm/src/code-mode/surface.js +204 -0
- package/esm/src/code-mode/tool.js +1 -1
- package/esm/src/code-mode/worker-host.d.ts +51 -11
- package/esm/src/code-mode/worker-host.d.ts.map +1 -1
- package/esm/src/code-mode/worker-host.js +114 -48
- package/esm/src/code-mode/worker-protocol.d.ts +45 -8
- package/esm/src/code-mode/worker-protocol.d.ts.map +1 -1
- package/esm/src/code-mode/worker-protocol.js +4 -2
- package/esm/src/version.d.ts +1 -1
- package/esm/src/version.js +1 -1
- package/package.json +9 -1
- package/script/src/code-mode/engine.d.ts +59 -0
- package/script/src/code-mode/engine.d.ts.map +1 -0
- package/script/src/code-mode/engine.js +198 -0
- package/script/src/code-mode/guest-worker.d.ts +2 -5
- package/script/src/code-mode/guest-worker.d.ts.map +1 -1
- package/script/src/code-mode/guest-worker.js +4 -98
- package/script/src/code-mode/sandbox-api.d.ts +37 -0
- package/script/src/code-mode/sandbox-api.d.ts.map +1 -0
- package/script/src/code-mode/sandbox-api.js +50 -0
- package/script/src/code-mode/sandbox-core.d.ts +99 -21
- package/script/src/code-mode/sandbox-core.d.ts.map +1 -1
- package/script/src/code-mode/sandbox-core.js +931 -221
- package/script/src/code-mode/sandbox-worker.d.ts +37 -0
- package/script/src/code-mode/sandbox-worker.d.ts.map +1 -0
- package/script/src/code-mode/sandbox-worker.js +166 -0
- package/script/src/code-mode/sandbox.d.ts +142 -29
- package/script/src/code-mode/sandbox.d.ts.map +1 -1
- package/script/src/code-mode/sandbox.js +432 -73
- package/script/src/code-mode/surface.d.ts +148 -0
- package/script/src/code-mode/surface.d.ts.map +1 -0
- package/script/src/code-mode/surface.js +211 -0
- package/script/src/code-mode/tool.js +1 -1
- package/script/src/code-mode/worker-host.d.ts +51 -11
- package/script/src/code-mode/worker-host.d.ts.map +1 -1
- package/script/src/code-mode/worker-host.js +115 -47
- package/script/src/code-mode/worker-protocol.d.ts +45 -8
- package/script/src/code-mode/worker-protocol.d.ts.map +1 -1
- package/script/src/code-mode/worker-protocol.js +4 -2
- package/script/src/version.d.ts +1 -1
- package/script/src/version.js +1 -1
|
@@ -25,12 +25,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.workerIsolationUnavailable = workerIsolationUnavailable;
|
|
27
27
|
exports.nodeWorkerPermission = nodeWorkerPermission;
|
|
28
|
+
exports.guestModulePermission = guestModulePermission;
|
|
28
29
|
exports.nodeWorkerExecArgv = nodeWorkerExecArgv;
|
|
29
30
|
exports.nodeWorkerNodeOptions = nodeWorkerNodeOptions;
|
|
30
31
|
exports.parseNodeOptions = parseNodeOptions;
|
|
31
32
|
exports.nodeWorkerEnv = nodeWorkerEnv;
|
|
32
33
|
exports.encodeReply = encodeReply;
|
|
33
34
|
exports.workerSpawnFailure = workerSpawnFailure;
|
|
35
|
+
exports.workerNotStarted = workerNotStarted;
|
|
34
36
|
exports.runInWorker = runInWorker;
|
|
35
37
|
/**
|
|
36
38
|
* Host side of worker isolation: one short-lived worker per program, so a
|
|
@@ -60,7 +62,7 @@ function workerRuntime(scope = dntShim.dntGlobalThis) {
|
|
|
60
62
|
* Why worker isolation cannot run here, or undefined when it can. `scope` is the
|
|
61
63
|
* global object to inspect.
|
|
62
64
|
*/
|
|
63
|
-
function workerIsolationUnavailable(scope = dntShim.dntGlobalThis) {
|
|
65
|
+
function workerIsolationUnavailable(scope = dntShim.dntGlobalThis, worker = guestUrl()) {
|
|
64
66
|
if (typeof SharedArrayBuffer !== "function")
|
|
65
67
|
return "SharedArrayBuffer is not available";
|
|
66
68
|
const runtime = workerRuntime(scope);
|
|
@@ -72,7 +74,7 @@ function workerIsolationUnavailable(scope = dntShim.dntGlobalThis) {
|
|
|
72
74
|
if (runtime === "node") {
|
|
73
75
|
return nodeWorkerPermission(scope.process);
|
|
74
76
|
}
|
|
75
|
-
return denoWorkerPermission();
|
|
77
|
+
return denoWorkerPermission(worker);
|
|
76
78
|
}
|
|
77
79
|
/**
|
|
78
80
|
* Why Node's enforced permission model forbids workers, or undefined. Audit mode
|
|
@@ -95,21 +97,29 @@ function nodeWorkerPermission(process) {
|
|
|
95
97
|
return undefined;
|
|
96
98
|
}
|
|
97
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* The permission Deno needs to load the guest module, or undefined for schemes it does
|
|
102
|
+
* not gate. An import query must name the port: a bare `jsr.io` asks about every port
|
|
103
|
+
* and reads "prompt", although Deno grants `jsr.io:443` by default.
|
|
104
|
+
*/
|
|
105
|
+
function guestModulePermission(url) {
|
|
106
|
+
if (url.protocol === "file:")
|
|
107
|
+
return { name: "read", path: url };
|
|
108
|
+
if (url.protocol !== "https:" && url.protocol !== "http:")
|
|
109
|
+
return undefined;
|
|
110
|
+
const port = url.port || (url.protocol === "https:" ? "443" : "80");
|
|
111
|
+
return { name: "import", host: `${url.hostname}:${port}` };
|
|
112
|
+
}
|
|
98
113
|
/**
|
|
99
114
|
* A Deno worker inherits the host's permissions and must be able to load its module.
|
|
100
|
-
* Only the module itself is checked:
|
|
115
|
+
* Only the module itself is checked: the modules it imports are not.
|
|
101
116
|
*/
|
|
102
|
-
function denoWorkerPermission() {
|
|
117
|
+
function denoWorkerPermission(url) {
|
|
103
118
|
const deno = dntShim.dntGlobalThis.Deno;
|
|
104
119
|
const query = deno?.permissions?.querySync;
|
|
105
120
|
if (!query)
|
|
106
121
|
return undefined;
|
|
107
|
-
const
|
|
108
|
-
const descriptor = url.protocol === "file:"
|
|
109
|
-
? { name: "read", path: url }
|
|
110
|
-
: url.protocol === "https:" || url.protocol === "http:"
|
|
111
|
-
? { name: "import", host: url.host }
|
|
112
|
-
: undefined;
|
|
122
|
+
const descriptor = guestModulePermission(url);
|
|
113
123
|
if (!descriptor)
|
|
114
124
|
return undefined;
|
|
115
125
|
try {
|
|
@@ -214,26 +224,31 @@ function guestUrl() {
|
|
|
214
224
|
function importNodeBuiltin(name) {
|
|
215
225
|
return Promise.resolve(`${`node:${name}`}`).then(s => __importStar(require(s)));
|
|
216
226
|
}
|
|
217
|
-
async function spawn(onMessage,
|
|
227
|
+
async function spawn(onMessage,
|
|
228
|
+
/** `ended` is true when the worker's module ran to its end and the thread exited by itself. */
|
|
229
|
+
onFailure, url) {
|
|
218
230
|
if (workerRuntime() === "node") {
|
|
219
231
|
const { Worker } = await importNodeBuiltin("worker_threads");
|
|
220
232
|
const process = dntShim.dntGlobalThis.process;
|
|
221
|
-
const worker = new Worker(
|
|
233
|
+
const worker = new Worker(url, {
|
|
222
234
|
execArgv: nodeWorkerExecArgv(process?.execArgv ?? []),
|
|
223
235
|
env: nodeWorkerEnv(process?.env ?? {}),
|
|
224
236
|
});
|
|
237
|
+
// A thread with nothing left to do exits with code 0: under Node that is
|
|
238
|
+
// how a module that never served the sandbox ends. Deno keeps it alive.
|
|
239
|
+
const onExit = (code) => onFailure(code === 0);
|
|
225
240
|
worker.on("message", onMessage);
|
|
226
|
-
worker.on("error", onFailure);
|
|
227
|
-
worker.on("exit",
|
|
241
|
+
worker.on("error", () => onFailure());
|
|
242
|
+
worker.on("exit", onExit);
|
|
228
243
|
return {
|
|
229
244
|
post: (message) => worker.postMessage(message),
|
|
230
245
|
terminate: () => {
|
|
231
|
-
worker.off("exit",
|
|
246
|
+
worker.off("exit", onExit);
|
|
232
247
|
void worker.terminate();
|
|
233
248
|
},
|
|
234
249
|
};
|
|
235
250
|
}
|
|
236
|
-
const worker = new Worker(
|
|
251
|
+
const worker = new Worker(url, { type: "module" });
|
|
237
252
|
worker.onmessage = (event) => onMessage(event.data);
|
|
238
253
|
worker.onerror = (event) => {
|
|
239
254
|
event.preventDefault();
|
|
@@ -247,27 +262,18 @@ async function spawn(onMessage, onFailure) {
|
|
|
247
262
|
* posted, so an oversized result never crosses the worker boundary (no parse and
|
|
248
263
|
* no structured clone). The guest decodes the text.
|
|
249
264
|
*/
|
|
250
|
-
function encodeReply(id, operation, value, valueLength
|
|
251
|
-
|
|
265
|
+
function encodeReply(id, operation, value, valueLength, namespace,
|
|
266
|
+
/** True when the host completed the call and its effect cannot be undone. */
|
|
267
|
+
irreversible = false) {
|
|
268
|
+
const done = irreversible ? { irreversible: true } : {};
|
|
252
269
|
try {
|
|
253
|
-
//
|
|
254
|
-
json =
|
|
255
|
-
|
|
256
|
-
catch {
|
|
257
|
-
json = undefined;
|
|
258
|
-
}
|
|
259
|
-
if (json === undefined) {
|
|
260
|
-
return {
|
|
261
|
-
type: "reply",
|
|
262
|
-
id,
|
|
263
|
-
ok: false,
|
|
264
|
-
error: new errors_js_1.CodeModeError("OPERATION_FAILED", `api.${operation} returned a value that is not JSON`, "Return plain JSON from the host operation").toJSON(),
|
|
265
|
-
};
|
|
270
|
+
// The same rule as the inline path: one function decides what crosses.
|
|
271
|
+
const json = (0, sandbox_core_js_1.encodeHostValue)(namespace, operation, value, valueLength);
|
|
272
|
+
return { type: "reply", id, ok: true, json, ...done };
|
|
266
273
|
}
|
|
267
|
-
|
|
268
|
-
return { type: "reply", id, ok: false, error:
|
|
274
|
+
catch (error) {
|
|
275
|
+
return { type: "reply", id, ok: false, error: error.toJSON(), ...done };
|
|
269
276
|
}
|
|
270
|
-
return { type: "reply", id, ok: true, json };
|
|
271
277
|
}
|
|
272
278
|
/** The error for a worker that could not be created at all. */
|
|
273
279
|
function workerSpawnFailure(error) {
|
|
@@ -277,17 +283,30 @@ function workerSpawnFailure(error) {
|
|
|
277
283
|
}
|
|
278
284
|
return sandboxFailed();
|
|
279
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* The error for a worker that loaded but never reported: it stayed silent for
|
|
288
|
+
* the wall time of the program (`wallMs`), or its module ran to its end and
|
|
289
|
+
* the thread exited. No program ran, so this is no time limit of the program.
|
|
290
|
+
*/
|
|
291
|
+
function workerNotStarted(wallMs) {
|
|
292
|
+
return new errors_js_1.CodeModeError("SANDBOX_FAILED", wallMs === undefined
|
|
293
|
+
? "The Code Mode worker ended without serving the sandbox"
|
|
294
|
+
: `The Code Mode worker did not start within ${wallMs} ms`, 'Check that the worker module loads and that its entry calls serveSandboxWorker, or configure isolation: "inline"', { context: { worker: "not-started", ...(wallMs !== undefined && { ms: wallMs }) } });
|
|
295
|
+
}
|
|
280
296
|
function sandboxFailed() {
|
|
281
297
|
return new errors_js_1.CodeModeError("SANDBOX_FAILED", "The Code Mode worker stopped unexpectedly", 'Run the program again. If the worker module cannot be loaded (a bundle without it, or a missing read or import permission), grant access to it or configure isolation: "inline"');
|
|
282
298
|
}
|
|
283
299
|
/**
|
|
284
|
-
* Run one program in a fresh worker and settle once with
|
|
300
|
+
* Run one program in a fresh worker and settle once: with the JSON text of
|
|
301
|
+
* what the program returned (undefined when it returned nothing), or with a
|
|
285
302
|
* {@link CodeModeError}. The worker is always terminated afterwards.
|
|
286
303
|
*
|
|
287
304
|
* @example
|
|
288
305
|
* ```ts
|
|
289
|
-
* const
|
|
290
|
-
* code: "return 1 + 1;",
|
|
306
|
+
* const json = await runInWorker({
|
|
307
|
+
* code: "return 1 + 1;",
|
|
308
|
+
* surface: { namespace: "api", operations: {}, budgets: {} },
|
|
309
|
+
* limits: SANDBOX_RESOURCE_LIMITS,
|
|
291
310
|
* call: () => Promise.reject(new Error("unused")), signal: new AbortController().signal,
|
|
292
311
|
* });
|
|
293
312
|
* ```
|
|
@@ -297,6 +316,8 @@ function runInWorker(input) {
|
|
|
297
316
|
return new Promise((resolve, reject) => {
|
|
298
317
|
let port;
|
|
299
318
|
let settled = false;
|
|
319
|
+
/** True once the worker reported: there is a guest that may need time to stop. */
|
|
320
|
+
let ready = false;
|
|
300
321
|
let grace;
|
|
301
322
|
const finish = (outcome) => {
|
|
302
323
|
if (settled)
|
|
@@ -308,6 +329,11 @@ function runInWorker(input) {
|
|
|
308
329
|
port?.terminate();
|
|
309
330
|
};
|
|
310
331
|
function stop() {
|
|
332
|
+
if (!ready) {
|
|
333
|
+
// No guest to wait for: the worker never reported.
|
|
334
|
+
finish(() => reject(input.signal.reason));
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
311
337
|
Atomics.store(cancel, 0, 1);
|
|
312
338
|
// A guest blocked in a host call is released by that call's own abort;
|
|
313
339
|
// one stuck in a native operation gets a grace period, then is dropped.
|
|
@@ -336,14 +362,46 @@ function runInWorker(input) {
|
|
|
336
362
|
}
|
|
337
363
|
switch (message.type) {
|
|
338
364
|
case "ready":
|
|
365
|
+
// A worker reports once: a second report starts nothing.
|
|
366
|
+
if (ready)
|
|
367
|
+
return;
|
|
368
|
+
ready = true;
|
|
369
|
+
input.started?.();
|
|
339
370
|
send({
|
|
340
371
|
type: "run",
|
|
341
372
|
code: input.code,
|
|
342
|
-
|
|
373
|
+
surface: input.surface,
|
|
343
374
|
limits: input.limits,
|
|
375
|
+
referenceKey: input.referenceKey,
|
|
376
|
+
asksAboutUnsent: input.unsent !== undefined,
|
|
344
377
|
cancel: cancel.buffer,
|
|
345
378
|
});
|
|
346
379
|
return;
|
|
380
|
+
case "unsent": {
|
|
381
|
+
// The guest asks only when the host said it decides.
|
|
382
|
+
const decide = input.unsent;
|
|
383
|
+
if (!decide) {
|
|
384
|
+
finish(() => reject(sandboxFailed()));
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
decide(message.calls).then(() => {
|
|
388
|
+
if (!settled)
|
|
389
|
+
send({ type: "unsent-reply", ok: true });
|
|
390
|
+
}, (error) => {
|
|
391
|
+
if (settled)
|
|
392
|
+
return;
|
|
393
|
+
if (error instanceof errors_js_1.CodeModeError) {
|
|
394
|
+
send({
|
|
395
|
+
type: "unsent-reply",
|
|
396
|
+
ok: false,
|
|
397
|
+
error: errors_js_1.CodeModeError.prototype.toJSON.call(error),
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
else
|
|
401
|
+
finish(() => reject(sandboxFailed()));
|
|
402
|
+
});
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
347
405
|
case "call": {
|
|
348
406
|
const { id } = message;
|
|
349
407
|
// Building a reply runs host-controlled code (a provider error's own
|
|
@@ -358,25 +416,35 @@ function runInWorker(input) {
|
|
|
358
416
|
finish(() => reject(sandboxFailed()));
|
|
359
417
|
}
|
|
360
418
|
};
|
|
361
|
-
input.call(message.operation, message.args).then((value) => reply(() => encodeReply(id, message.operation, value, input.limits.valueLength)), (error) => reply(() =>
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
419
|
+
input.call(message.operation, message.args, id).then((value) => reply(() => encodeReply(id, message.operation, value, input.limits.valueLength, input.surface.namespace, input.mustDeliver?.(id) === true)), (error) => reply(() => {
|
|
420
|
+
// The worker rebuilds the carrier from the call it is waiting on.
|
|
421
|
+
if (error instanceof sandbox_core_js_1.HostErrorCarrier) {
|
|
422
|
+
return { type: "reply", id, ok: false, host: error.shown };
|
|
423
|
+
}
|
|
424
|
+
const failure = error instanceof errors_js_1.CodeModeError
|
|
425
|
+
? error
|
|
426
|
+
: (0, sandbox_core_js_1.operationFailed)(input.surface.namespace, message.operation);
|
|
427
|
+
return {
|
|
428
|
+
type: "reply",
|
|
429
|
+
id,
|
|
430
|
+
ok: false,
|
|
431
|
+
// The base serializer reads plain fields: a subclass cannot override it.
|
|
432
|
+
error: errors_js_1.CodeModeError.prototype.toJSON.call(failure),
|
|
433
|
+
};
|
|
434
|
+
}));
|
|
368
435
|
return;
|
|
369
436
|
}
|
|
370
437
|
case "done":
|
|
371
438
|
// A guest can finish during the stop grace period: an abort still wins.
|
|
372
|
-
finish(() => input.signal.aborted ? reject(input.signal.reason) : resolve(message.
|
|
439
|
+
finish(() => input.signal.aborted ? reject(input.signal.reason) : resolve(message.json));
|
|
373
440
|
return;
|
|
374
441
|
case "fail":
|
|
375
442
|
finish(() => reject((0, errors_js_1.codeModeErrorFromFields)(message.error) ?? sandboxFailed()));
|
|
376
443
|
return;
|
|
377
444
|
}
|
|
378
445
|
};
|
|
379
|
-
|
|
446
|
+
const onFailure = (ended = false) => finish(() => reject(ended && !ready ? workerNotStarted() : sandboxFailed()));
|
|
447
|
+
spawn(onMessage, onFailure, input.worker ?? guestUrl()).then((spawned) => {
|
|
380
448
|
if (settled) {
|
|
381
449
|
spawned.terminate();
|
|
382
450
|
return;
|
|
@@ -1,30 +1,59 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Messages between the host and the Code Mode guest worker.
|
|
3
|
-
*
|
|
2
|
+
* Messages between the host and the Code Mode guest worker. Every value of a
|
|
3
|
+
* program crosses as JSON text, never as a tree of objects: copying a tree
|
|
4
|
+
* between threads has a nesting limit of its own, which the other isolation
|
|
5
|
+
* does not have. One SharedArrayBuffer crosses too: the cancel flag.
|
|
4
6
|
*
|
|
5
7
|
* @module code-mode/worker-protocol
|
|
6
8
|
*/
|
|
7
9
|
import type { CodeModeErrorFields } from "./errors.js";
|
|
8
|
-
import type {
|
|
10
|
+
import type { EncodedSurface, HostErrorShown, SandboxResourceLimits, UnsentCall } from "./sandbox-core.js";
|
|
9
11
|
/** Host to worker. */
|
|
10
12
|
export type HostMessage = {
|
|
11
13
|
readonly type: "run";
|
|
12
14
|
readonly code: string;
|
|
13
|
-
|
|
14
|
-
readonly
|
|
15
|
+
/** Plain data: a name, the JSON text of each constant and the table of operations. */
|
|
16
|
+
readonly surface: EncodedSurface;
|
|
17
|
+
readonly limits: SandboxResourceLimits;
|
|
18
|
+
/** The key of the record that stands for an earlier result, when the surface uses references. */
|
|
19
|
+
readonly referenceKey?: string;
|
|
20
|
+
/** True when the host decides about unsent calls: the guest then asks before it completes. */
|
|
21
|
+
readonly asksAboutUnsent: boolean;
|
|
15
22
|
/** Int32Array flag: 1 asks the guest to stop at its next interrupt check. */
|
|
16
23
|
readonly cancel: SharedArrayBuffer;
|
|
24
|
+
} | {
|
|
25
|
+
/** The host lets the program's value stand although calls were not sent. */
|
|
26
|
+
readonly type: "unsent-reply";
|
|
27
|
+
readonly ok: true;
|
|
28
|
+
} | {
|
|
29
|
+
/** The host refuses: the run fails with this error. */
|
|
30
|
+
readonly type: "unsent-reply";
|
|
31
|
+
readonly ok: false;
|
|
32
|
+
readonly error: CodeModeErrorFields;
|
|
17
33
|
} | {
|
|
18
34
|
readonly type: "reply";
|
|
19
35
|
readonly id: number;
|
|
20
36
|
readonly ok: true;
|
|
21
37
|
/** The JSON text of the result, already within `limits.valueLength`. */
|
|
22
38
|
readonly json: string;
|
|
39
|
+
/** The host completed this call and its effect cannot be undone. */
|
|
40
|
+
readonly irreversible?: true;
|
|
23
41
|
} | {
|
|
24
42
|
readonly type: "reply";
|
|
25
43
|
readonly id: number;
|
|
26
44
|
readonly ok: false;
|
|
27
45
|
readonly error: CodeModeErrorFields;
|
|
46
|
+
/**
|
|
47
|
+
* The host completed this call, its effect cannot be undone, and this error
|
|
48
|
+
* is about its result, which could not be sent.
|
|
49
|
+
*/
|
|
50
|
+
readonly irreversible?: true;
|
|
51
|
+
} | {
|
|
52
|
+
readonly type: "reply";
|
|
53
|
+
readonly id: number;
|
|
54
|
+
readonly ok: false;
|
|
55
|
+
/** The host rejected with its own error: what the program is shown. */
|
|
56
|
+
readonly host: HostErrorShown;
|
|
28
57
|
};
|
|
29
58
|
/** Worker to host. */
|
|
30
59
|
export type GuestMessage = {
|
|
@@ -33,10 +62,18 @@ export type GuestMessage = {
|
|
|
33
62
|
readonly type: "call";
|
|
34
63
|
readonly id: number;
|
|
35
64
|
readonly operation: string;
|
|
36
|
-
|
|
37
|
-
|
|
65
|
+
/** The JSON text of the list of arguments. */
|
|
66
|
+
readonly args: string;
|
|
67
|
+
}
|
|
68
|
+
/** The program finished normally with calls it did not wait for: the host decides. */
|
|
69
|
+
| {
|
|
70
|
+
readonly type: "unsent";
|
|
71
|
+
readonly calls: UnsentCall[];
|
|
72
|
+
}
|
|
73
|
+
/** `json` is the JSON text of what the program returned; absent when it returned nothing. */
|
|
74
|
+
| {
|
|
38
75
|
readonly type: "done";
|
|
39
|
-
readonly
|
|
76
|
+
readonly json?: string;
|
|
40
77
|
} | {
|
|
41
78
|
readonly type: "fail";
|
|
42
79
|
readonly error: CodeModeErrorFields;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-protocol.d.ts","sourceRoot":"","sources":["../../../src/src/code-mode/worker-protocol.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"worker-protocol.d.ts","sourceRoot":"","sources":["../../../src/src/code-mode/worker-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAE3B,sBAAsB;AACtB,MAAM,MAAM,WAAW,GACnB;IACA,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,iGAAiG;IACjG,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,8FAA8F;IAC9F,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;CACpC,GACC;IACA,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;CACnB,GACC;IACA,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;CACrC,GACC;IACA,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC;CAC9B,GACC;IACA,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC;CAC9B,GACC;IACA,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;CAC/B,CAAC;AAEJ,sBAAsB;AACtB,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IACA,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AACD,sFAAsF;GACpF;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,CAAA;CAAE;AAC3D,6FAA6F;GAC3F;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAA;CAAE,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Messages between the host and the Code Mode guest worker.
|
|
4
|
-
*
|
|
3
|
+
* Messages between the host and the Code Mode guest worker. Every value of a
|
|
4
|
+
* program crosses as JSON text, never as a tree of objects: copying a tree
|
|
5
|
+
* between threads has a nesting limit of its own, which the other isolation
|
|
6
|
+
* does not have. One SharedArrayBuffer crosses too: the cancel flag.
|
|
5
7
|
*
|
|
6
8
|
* @module code-mode/worker-protocol
|
|
7
9
|
*/
|
package/script/src/version.d.ts
CHANGED
package/script/src/version.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.MCP_APPS_PROTOCOL_VERSION = exports.COMPOSE_VERSION = void 0;
|
|
22
22
|
/** @mcpview/compose package version. */
|
|
23
|
-
exports.COMPOSE_VERSION = "0.
|
|
23
|
+
exports.COMPOSE_VERSION = "0.15.0";
|
|
24
24
|
/**
|
|
25
25
|
* MCP Apps protocol version targeted by compose.
|
|
26
26
|
*
|