@mcpview/compose 0.13.1 → 0.14.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 +109 -0
- package/README.md +52 -0
- package/esm/src/code-mode/chain.d.ts +24 -1
- package/esm/src/code-mode/chain.d.ts.map +1 -1
- package/esm/src/code-mode/chain.js +219 -86
- package/esm/src/code-mode/errors.d.ts +80 -0
- package/esm/src/code-mode/errors.d.ts.map +1 -0
- package/esm/src/code-mode/errors.js +140 -0
- package/esm/src/code-mode/guest-worker.d.ts +11 -0
- package/esm/src/code-mode/guest-worker.d.ts.map +1 -0
- package/esm/src/code-mode/guest-worker.js +80 -0
- package/esm/src/code-mode/mod.d.ts +3 -1
- package/esm/src/code-mode/mod.d.ts.map +1 -1
- package/esm/src/code-mode/mod.js +2 -0
- package/esm/src/code-mode/sandbox-core.d.ts +61 -0
- package/esm/src/code-mode/sandbox-core.d.ts.map +1 -0
- package/esm/src/code-mode/sandbox-core.js +424 -0
- package/esm/src/code-mode/sandbox.d.ts +68 -7
- package/esm/src/code-mode/sandbox.d.ts.map +1 -1
- package/esm/src/code-mode/sandbox.js +180 -120
- package/esm/src/code-mode/tool.d.ts.map +1 -1
- package/esm/src/code-mode/tool.js +2 -0
- package/esm/src/code-mode/worker-host.d.ts +70 -0
- package/esm/src/code-mode/worker-host.d.ts.map +1 -0
- package/esm/src/code-mode/worker-host.js +355 -0
- package/esm/src/code-mode/worker-protocol.d.ts +44 -0
- package/esm/src/code-mode/worker-protocol.d.ts.map +1 -0
- package/esm/src/code-mode/worker-protocol.js +7 -0
- package/esm/src/host/renderer/css/panel-controls.d.ts.map +1 -1
- package/esm/src/host/renderer/css/panel-controls.js +5 -1
- package/esm/src/host/renderer/js/card-height.d.ts +11 -1
- package/esm/src/host/renderer/js/card-height.d.ts.map +1 -1
- package/esm/src/host/renderer/js/card-height.js +57 -10
- package/esm/src/host/renderer/js/event-bus.d.ts +11 -0
- package/esm/src/host/renderer/js/event-bus.d.ts.map +1 -1
- package/esm/src/host/renderer/js/event-bus.js +49 -8
- package/esm/src/host/renderer/js/intrinsic-layout.d.ts +26 -0
- package/esm/src/host/renderer/js/intrinsic-layout.d.ts.map +1 -0
- package/esm/src/host/renderer/js/intrinsic-layout.js +44 -0
- package/esm/src/host/renderer/panel-resizing.d.ts.map +1 -1
- package/esm/src/host/renderer/panel-resizing.js +8 -0
- package/esm/src/version.d.ts +1 -1
- package/esm/src/version.js +1 -1
- package/package.json +1 -1
- package/script/src/code-mode/chain.d.ts +24 -1
- package/script/src/code-mode/chain.d.ts.map +1 -1
- package/script/src/code-mode/chain.js +218 -85
- package/script/src/code-mode/errors.d.ts +80 -0
- package/script/src/code-mode/errors.d.ts.map +1 -0
- package/script/src/code-mode/errors.js +148 -0
- package/script/src/code-mode/guest-worker.d.ts +11 -0
- package/script/src/code-mode/guest-worker.d.ts.map +1 -0
- package/script/src/code-mode/guest-worker.js +105 -0
- package/script/src/code-mode/mod.d.ts +3 -1
- package/script/src/code-mode/mod.d.ts.map +1 -1
- package/script/src/code-mode/mod.js +9 -1
- package/script/src/code-mode/sandbox-core.d.ts +61 -0
- package/script/src/code-mode/sandbox-core.d.ts.map +1 -0
- package/script/src/code-mode/sandbox-core.js +430 -0
- package/script/src/code-mode/sandbox.d.ts +68 -7
- package/script/src/code-mode/sandbox.d.ts.map +1 -1
- package/script/src/code-mode/sandbox.js +188 -122
- package/script/src/code-mode/tool.d.ts.map +1 -1
- package/script/src/code-mode/tool.js +2 -0
- package/script/src/code-mode/worker-host.d.ts +70 -0
- package/script/src/code-mode/worker-host.d.ts.map +1 -0
- package/script/src/code-mode/worker-host.js +389 -0
- package/script/src/code-mode/worker-protocol.d.ts +44 -0
- package/script/src/code-mode/worker-protocol.d.ts.map +1 -0
- package/script/src/code-mode/worker-protocol.js +8 -0
- package/script/src/host/renderer/css/panel-controls.d.ts.map +1 -1
- package/script/src/host/renderer/css/panel-controls.js +5 -1
- package/script/src/host/renderer/js/card-height.d.ts +11 -1
- package/script/src/host/renderer/js/card-height.d.ts.map +1 -1
- package/script/src/host/renderer/js/card-height.js +57 -10
- package/script/src/host/renderer/js/event-bus.d.ts +11 -0
- package/script/src/host/renderer/js/event-bus.d.ts.map +1 -1
- package/script/src/host/renderer/js/event-bus.js +50 -8
- package/script/src/host/renderer/js/intrinsic-layout.d.ts +26 -0
- package/script/src/host/renderer/js/intrinsic-layout.d.ts.map +1 -0
- package/script/src/host/renderer/js/intrinsic-layout.js +48 -0
- package/script/src/host/renderer/panel-resizing.d.ts.map +1 -1
- package/script/src/host/renderer/panel-resizing.js +8 -0
- package/script/src/version.d.ts +1 -1
- package/script/src/version.js +1 -1
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host side of worker isolation: one short-lived worker per program, so a
|
|
3
|
+
* CPU-bound guest cannot block the server's event loop.
|
|
4
|
+
*
|
|
5
|
+
* Stopping relies on a SharedArrayBuffer flag read by the QuickJS interrupt
|
|
6
|
+
* handler. `terminate()` is only a backstop: under Deno it does not stop a
|
|
7
|
+
* thread that is still spinning.
|
|
8
|
+
*
|
|
9
|
+
* @module code-mode/worker-host
|
|
10
|
+
*/
|
|
11
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
12
|
+
import { CodeModeError, codeModeErrorFromFields } from "./errors.js";
|
|
13
|
+
import { receiptTooLarge } from "./sandbox-core.js";
|
|
14
|
+
/** Time a stopped guest has to report before the host gives up on it. */
|
|
15
|
+
const STOP_GRACE_MS = 250;
|
|
16
|
+
function workerRuntime(scope = dntShim.dntGlobalThis) {
|
|
17
|
+
const { Deno: deno, process, Worker } = scope;
|
|
18
|
+
if (typeof deno?.version?.deno === "string") {
|
|
19
|
+
return typeof Worker === "function" ? "deno" : undefined;
|
|
20
|
+
}
|
|
21
|
+
if (typeof process?.versions?.node === "string")
|
|
22
|
+
return "node";
|
|
23
|
+
return typeof Worker === "function" ? "browser" : undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Why worker isolation cannot run here, or undefined when it can. `scope` is the
|
|
27
|
+
* global object to inspect.
|
|
28
|
+
*/
|
|
29
|
+
export function workerIsolationUnavailable(scope = dntShim.dntGlobalThis) {
|
|
30
|
+
if (typeof SharedArrayBuffer !== "function")
|
|
31
|
+
return "SharedArrayBuffer is not available";
|
|
32
|
+
const runtime = workerRuntime(scope);
|
|
33
|
+
if (!runtime)
|
|
34
|
+
return "Workers are not available in this runtime";
|
|
35
|
+
// The guest entry connects through Deno's Web Worker port or node:worker_threads.
|
|
36
|
+
if (runtime === "browser")
|
|
37
|
+
return "Browser workers are not supported by the Code Mode guest";
|
|
38
|
+
if (runtime === "node") {
|
|
39
|
+
return nodeWorkerPermission(scope.process);
|
|
40
|
+
}
|
|
41
|
+
return denoWorkerPermission();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Why Node's enforced permission model forbids workers, or undefined. Audit mode
|
|
45
|
+
* (`--permission-audit`) reports a missing grant but still creates the worker, so it
|
|
46
|
+
* does not count.
|
|
47
|
+
*/
|
|
48
|
+
export function nodeWorkerPermission(process) {
|
|
49
|
+
const has = process?.permission?.has;
|
|
50
|
+
if (typeof has !== "function")
|
|
51
|
+
return undefined;
|
|
52
|
+
const audit = [...(process?.execArgv ?? []), process?.env?.NODE_OPTIONS ?? ""].some((option) => option.includes("--permission-audit"));
|
|
53
|
+
if (audit)
|
|
54
|
+
return undefined;
|
|
55
|
+
try {
|
|
56
|
+
return has.call(process?.permission, "worker") === false
|
|
57
|
+
? "Node's permission model does not allow worker threads (--allow-worker)"
|
|
58
|
+
: undefined;
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A Deno worker inherits the host's permissions and must be able to load its module.
|
|
66
|
+
* Only the module itself is checked: its siblings and the QuickJS WASM file are not.
|
|
67
|
+
*/
|
|
68
|
+
function denoWorkerPermission() {
|
|
69
|
+
const deno = dntShim.dntGlobalThis.Deno;
|
|
70
|
+
const query = deno?.permissions?.querySync;
|
|
71
|
+
if (!query)
|
|
72
|
+
return undefined;
|
|
73
|
+
const url = guestUrl();
|
|
74
|
+
const descriptor = url.protocol === "file:"
|
|
75
|
+
? { name: "read", path: url }
|
|
76
|
+
: url.protocol === "https:" || url.protocol === "http:"
|
|
77
|
+
? { name: "import", host: url.host }
|
|
78
|
+
: undefined;
|
|
79
|
+
if (!descriptor)
|
|
80
|
+
return undefined;
|
|
81
|
+
try {
|
|
82
|
+
const { state } = query.call(deno.permissions, descriptor);
|
|
83
|
+
return state === "granted"
|
|
84
|
+
? undefined
|
|
85
|
+
: `Deno has no ${descriptor.name} permission for the worker module ${url.href}`;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// Older runtimes may not know the descriptor; the worker reports its own failure.
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Node options a file worker may repeat. Node rejects process-wide options such
|
|
94
|
+
* as `--max-old-space-size` in a worker's `execArgv` (`ERR_WORKER_INVALID_EXEC_ARGV`),
|
|
95
|
+
* and entry-point options such as `--input-type` or `-e` break it. Inheriting
|
|
96
|
+
* the parent's list is no better: it carries the same flags. So only these
|
|
97
|
+
* resolution and diagnostics options are forwarded.
|
|
98
|
+
*/
|
|
99
|
+
const WORKER_FLAGS_WITH_VALUE = new Set(["--conditions", "-C"]);
|
|
100
|
+
const WORKER_SWITCHES = new Set(["--enable-source-maps"]);
|
|
101
|
+
/** The part of the host's Node options that a Code Mode worker can start with. */
|
|
102
|
+
export function nodeWorkerExecArgv(execArgv) {
|
|
103
|
+
const kept = [];
|
|
104
|
+
for (let index = 0; index < execArgv.length; index++) {
|
|
105
|
+
const arg = execArgv[index];
|
|
106
|
+
const name = arg.split("=", 1)[0];
|
|
107
|
+
if (WORKER_SWITCHES.has(arg))
|
|
108
|
+
kept.push(arg);
|
|
109
|
+
else if (WORKER_FLAGS_WITH_VALUE.has(name)) {
|
|
110
|
+
kept.push(arg);
|
|
111
|
+
if (!arg.includes("=") && index + 1 < execArgv.length)
|
|
112
|
+
kept.push(execArgv[++index]);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return kept;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The host's `NODE_OPTIONS` reduced to what a Code Mode worker can start with. A
|
|
119
|
+
* worker inherits the environment by default, so `--input-type` or
|
|
120
|
+
* `--max-old-space-size` there would break it just like in `execArgv`.
|
|
121
|
+
*/
|
|
122
|
+
export function nodeWorkerNodeOptions(options) {
|
|
123
|
+
return nodeWorkerExecArgv(parseNodeOptions(options ?? "")).map(quoteNodeOption).join(" ");
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Split `NODE_OPTIONS` the way Node does: whitespace separates options, double
|
|
127
|
+
* quotes group (and are dropped), and inside quotes a backslash escapes the next
|
|
128
|
+
* character.
|
|
129
|
+
*/
|
|
130
|
+
export function parseNodeOptions(options) {
|
|
131
|
+
const tokens = [];
|
|
132
|
+
let current = "";
|
|
133
|
+
let started = false;
|
|
134
|
+
let quoted = false;
|
|
135
|
+
for (let index = 0; index < options.length; index++) {
|
|
136
|
+
const char = options[index];
|
|
137
|
+
if (quoted && char === "\\" && index + 1 < options.length) {
|
|
138
|
+
current += options[++index];
|
|
139
|
+
}
|
|
140
|
+
else if (char === '"') {
|
|
141
|
+
quoted = !quoted;
|
|
142
|
+
started = true;
|
|
143
|
+
}
|
|
144
|
+
else if (!quoted && /\s/.test(char)) {
|
|
145
|
+
if (started)
|
|
146
|
+
tokens.push(current);
|
|
147
|
+
current = "";
|
|
148
|
+
started = false;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
current += char;
|
|
152
|
+
started = true;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (started)
|
|
156
|
+
tokens.push(current);
|
|
157
|
+
return tokens.filter(Boolean);
|
|
158
|
+
}
|
|
159
|
+
/** One option in `NODE_OPTIONS` syntax: quoted when it holds whitespace, a quote or a backslash. */
|
|
160
|
+
function quoteNodeOption(option) {
|
|
161
|
+
return /[\s"\\]/.test(option) ? `"${option.replace(/["\\]/g, "\\$&")}"` : option;
|
|
162
|
+
}
|
|
163
|
+
/** The host's environment with `NODE_OPTIONS` reduced for a worker. */
|
|
164
|
+
export function nodeWorkerEnv(env) {
|
|
165
|
+
const { NODE_OPTIONS: options, ...rest } = env;
|
|
166
|
+
const kept = nodeWorkerNodeOptions(options);
|
|
167
|
+
return kept ? { ...rest, NODE_OPTIONS: kept } : rest;
|
|
168
|
+
}
|
|
169
|
+
function guestUrl() {
|
|
170
|
+
// dnt keeps this URL as written, so derive the extension from this module:
|
|
171
|
+
// `.ts` from source or JSR, `.js` from the npm build.
|
|
172
|
+
const extension = import.meta.url.endsWith(".ts") ? ".ts" : ".js";
|
|
173
|
+
return new URL(`./guest-worker${extension}`, import.meta.url);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Load a Node builtin. The specifier is built at run time so that a bundler
|
|
177
|
+
* targeting the browser or another runtime does not resolve it: `inline`
|
|
178
|
+
* isolation must stay usable there.
|
|
179
|
+
*/
|
|
180
|
+
function importNodeBuiltin(name) {
|
|
181
|
+
return import(`node:${name}`);
|
|
182
|
+
}
|
|
183
|
+
async function spawn(onMessage, onFailure) {
|
|
184
|
+
if (workerRuntime() === "node") {
|
|
185
|
+
const { Worker } = await importNodeBuiltin("worker_threads");
|
|
186
|
+
const process = dntShim.dntGlobalThis.process;
|
|
187
|
+
const worker = new Worker(guestUrl(), {
|
|
188
|
+
execArgv: nodeWorkerExecArgv(process?.execArgv ?? []),
|
|
189
|
+
env: nodeWorkerEnv(process?.env ?? {}),
|
|
190
|
+
});
|
|
191
|
+
worker.on("message", onMessage);
|
|
192
|
+
worker.on("error", onFailure);
|
|
193
|
+
worker.on("exit", onFailure);
|
|
194
|
+
return {
|
|
195
|
+
post: (message) => worker.postMessage(message),
|
|
196
|
+
terminate: () => {
|
|
197
|
+
worker.off("exit", onFailure);
|
|
198
|
+
void worker.terminate();
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
const worker = new Worker(guestUrl(), { type: "module" });
|
|
203
|
+
worker.onmessage = (event) => onMessage(event.data);
|
|
204
|
+
worker.onerror = (event) => {
|
|
205
|
+
event.preventDefault();
|
|
206
|
+
onFailure();
|
|
207
|
+
};
|
|
208
|
+
worker.onmessageerror = () => onFailure();
|
|
209
|
+
return { post: (message) => worker.postMessage(message), terminate: () => worker.terminate() };
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* The reply for one host operation. The JSON text is bounded here, before it is
|
|
213
|
+
* posted, so an oversized result never crosses the worker boundary (no parse and
|
|
214
|
+
* no structured clone). The guest decodes the text.
|
|
215
|
+
*/
|
|
216
|
+
export function encodeReply(id, operation, value, valueLength) {
|
|
217
|
+
let json;
|
|
218
|
+
try {
|
|
219
|
+
// Like the inline path, drop what JSON drops (functions, undefined).
|
|
220
|
+
json = JSON.stringify(value ?? null);
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
json = undefined;
|
|
224
|
+
}
|
|
225
|
+
if (json === undefined) {
|
|
226
|
+
return {
|
|
227
|
+
type: "reply",
|
|
228
|
+
id,
|
|
229
|
+
ok: false,
|
|
230
|
+
error: new CodeModeError("OPERATION_FAILED", `api.${operation} returned a value that is not JSON`, "Return plain JSON from the host operation").toJSON(),
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
if (json.length > valueLength) {
|
|
234
|
+
return { type: "reply", id, ok: false, error: receiptTooLarge(valueLength).toJSON() };
|
|
235
|
+
}
|
|
236
|
+
return { type: "reply", id, ok: true, json };
|
|
237
|
+
}
|
|
238
|
+
/** The error for a worker that could not be created at all. */
|
|
239
|
+
export function workerSpawnFailure(error) {
|
|
240
|
+
if (error?.code === "ERR_ACCESS_DENIED") {
|
|
241
|
+
// Node refused the Worker constructor under its permission model.
|
|
242
|
+
return new CodeModeError("SANDBOX_UNAVAILABLE", "Worker isolation is unavailable: Node's permission model does not allow worker threads", 'Start Node with --allow-worker, or configure isolation: "inline"', { context: { isolation: "worker" } });
|
|
243
|
+
}
|
|
244
|
+
return sandboxFailed();
|
|
245
|
+
}
|
|
246
|
+
function sandboxFailed() {
|
|
247
|
+
return new 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"');
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Run one program in a fresh worker and settle once with its value or a
|
|
251
|
+
* {@link CodeModeError}. The worker is always terminated afterwards.
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```ts
|
|
255
|
+
* const value = await runInWorker({
|
|
256
|
+
* code: "return 1 + 1;", params: {}, limits: CODE_MODE_LIMITS,
|
|
257
|
+
* call: () => Promise.reject(new Error("unused")), signal: new AbortController().signal,
|
|
258
|
+
* });
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
export function runInWorker(input) {
|
|
262
|
+
const cancel = new Int32Array(new SharedArrayBuffer(4));
|
|
263
|
+
return new Promise((resolve, reject) => {
|
|
264
|
+
let port;
|
|
265
|
+
let settled = false;
|
|
266
|
+
let grace;
|
|
267
|
+
const finish = (outcome) => {
|
|
268
|
+
if (settled)
|
|
269
|
+
return;
|
|
270
|
+
settled = true;
|
|
271
|
+
clearTimeout(grace);
|
|
272
|
+
input.signal.removeEventListener("abort", stop);
|
|
273
|
+
outcome();
|
|
274
|
+
port?.terminate();
|
|
275
|
+
};
|
|
276
|
+
function stop() {
|
|
277
|
+
Atomics.store(cancel, 0, 1);
|
|
278
|
+
// A guest blocked in a host call is released by that call's own abort;
|
|
279
|
+
// one stuck in a native operation gets a grace period, then is dropped.
|
|
280
|
+
grace = setTimeout(() => finish(() => reject(new CodeModeError("INTERRUPTED", "The program did not stop in time and was abandoned", "Run it again if the result is still needed"))), STOP_GRACE_MS);
|
|
281
|
+
}
|
|
282
|
+
if (input.signal.aborted) {
|
|
283
|
+
reject(input.signal.reason);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
input.signal.addEventListener("abort", stop, { once: true });
|
|
287
|
+
const early = [];
|
|
288
|
+
const send = (message) => {
|
|
289
|
+
try {
|
|
290
|
+
port?.post(message);
|
|
291
|
+
}
|
|
292
|
+
catch {
|
|
293
|
+
finish(() => reject(sandboxFailed()));
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
const onMessage = (message) => {
|
|
297
|
+
if (settled)
|
|
298
|
+
return;
|
|
299
|
+
if (!port) {
|
|
300
|
+
early.push(message);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
switch (message.type) {
|
|
304
|
+
case "ready":
|
|
305
|
+
send({
|
|
306
|
+
type: "run",
|
|
307
|
+
code: input.code,
|
|
308
|
+
params: input.params,
|
|
309
|
+
limits: input.limits,
|
|
310
|
+
cancel: cancel.buffer,
|
|
311
|
+
});
|
|
312
|
+
return;
|
|
313
|
+
case "call": {
|
|
314
|
+
const { id } = message;
|
|
315
|
+
// Building a reply runs host-controlled code (a provider error's own
|
|
316
|
+
// methods): any failure settles the run instead of escaping as a rejection.
|
|
317
|
+
const reply = (build) => {
|
|
318
|
+
if (settled)
|
|
319
|
+
return;
|
|
320
|
+
try {
|
|
321
|
+
send(build());
|
|
322
|
+
}
|
|
323
|
+
catch {
|
|
324
|
+
finish(() => reject(sandboxFailed()));
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
input.call(message.operation, message.args).then((value) => reply(() => encodeReply(id, message.operation, value, input.limits.valueLength)), (error) => reply(() => ({
|
|
328
|
+
type: "reply",
|
|
329
|
+
id,
|
|
330
|
+
ok: false,
|
|
331
|
+
// The base serializer reads plain fields: a subclass cannot override it.
|
|
332
|
+
error: CodeModeError.prototype.toJSON.call(error instanceof CodeModeError ? error : new CodeModeError("OPERATION_FAILED", `api.${message.operation} failed`, "Check the arguments, then retry once")),
|
|
333
|
+
})));
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
case "done":
|
|
337
|
+
// A guest can finish during the stop grace period: an abort still wins.
|
|
338
|
+
finish(() => input.signal.aborted ? reject(input.signal.reason) : resolve(message.value));
|
|
339
|
+
return;
|
|
340
|
+
case "fail":
|
|
341
|
+
finish(() => reject(codeModeErrorFromFields(message.error) ?? sandboxFailed()));
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
spawn(onMessage, () => finish(() => reject(sandboxFailed()))).then((spawned) => {
|
|
346
|
+
if (settled) {
|
|
347
|
+
spawned.terminate();
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
port = spawned;
|
|
351
|
+
for (const message of early.splice(0))
|
|
352
|
+
onMessage(message);
|
|
353
|
+
}, (error) => finish(() => reject(workerSpawnFailure(error))));
|
|
354
|
+
});
|
|
355
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Messages between the host and the Code Mode guest worker. Only JSON values
|
|
3
|
+
* and one SharedArrayBuffer (the cancel flag) cross the boundary.
|
|
4
|
+
*
|
|
5
|
+
* @module code-mode/worker-protocol
|
|
6
|
+
*/
|
|
7
|
+
import type { CodeModeErrorFields } from "./errors.js";
|
|
8
|
+
import type { SandboxLimits } from "./sandbox-core.js";
|
|
9
|
+
/** Host to worker. */
|
|
10
|
+
export type HostMessage = {
|
|
11
|
+
readonly type: "run";
|
|
12
|
+
readonly code: string;
|
|
13
|
+
readonly params: Record<string, unknown>;
|
|
14
|
+
readonly limits: SandboxLimits;
|
|
15
|
+
/** Int32Array flag: 1 asks the guest to stop at its next interrupt check. */
|
|
16
|
+
readonly cancel: SharedArrayBuffer;
|
|
17
|
+
} | {
|
|
18
|
+
readonly type: "reply";
|
|
19
|
+
readonly id: number;
|
|
20
|
+
readonly ok: true;
|
|
21
|
+
/** The JSON text of the result, already within `limits.valueLength`. */
|
|
22
|
+
readonly json: string;
|
|
23
|
+
} | {
|
|
24
|
+
readonly type: "reply";
|
|
25
|
+
readonly id: number;
|
|
26
|
+
readonly ok: false;
|
|
27
|
+
readonly error: CodeModeErrorFields;
|
|
28
|
+
};
|
|
29
|
+
/** Worker to host. */
|
|
30
|
+
export type GuestMessage = {
|
|
31
|
+
readonly type: "ready";
|
|
32
|
+
} | {
|
|
33
|
+
readonly type: "call";
|
|
34
|
+
readonly id: number;
|
|
35
|
+
readonly operation: string;
|
|
36
|
+
readonly args: unknown[];
|
|
37
|
+
} | {
|
|
38
|
+
readonly type: "done";
|
|
39
|
+
readonly value: unknown;
|
|
40
|
+
} | {
|
|
41
|
+
readonly type: "fail";
|
|
42
|
+
readonly error: CodeModeErrorFields;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=worker-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-protocol.d.ts","sourceRoot":"","sources":["../../../src/src/code-mode/worker-protocol.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,sBAAsB;AACtB,MAAM,MAAM,WAAW,GACnB;IACA,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;CACpC,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;CACvB,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;CACrC,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,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;CAC1B,GACC;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAA;CAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panel-controls.d.ts","sourceRoot":"","sources":["../../../../../src/src/host/renderer/css/panel-controls.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"panel-controls.d.ts","sourceRoot":"","sources":["../../../../../src/src/host/renderer/css/panel-controls.ts"],"names":[],"mappings":"AAEA,qEAAqE;AACrE,wBAAgB,mBAAmB,IAAI,MAAM,CA0F5C"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VIEWER_FALLBACK_HEIGHT } from "../js/intrinsic-layout.js";
|
|
1
2
|
/** Shared styles for the controls around mounted Compose viewers. */
|
|
2
3
|
export function getPanelControlsCss() {
|
|
3
4
|
return `
|
|
@@ -17,7 +18,10 @@ export function getPanelControlsCss() {
|
|
|
17
18
|
grid-auto-rows: auto;
|
|
18
19
|
}
|
|
19
20
|
#container[data-compose-intrinsic] > .compose-viewer {
|
|
20
|
-
height: var(
|
|
21
|
+
height: var(
|
|
22
|
+
--compose-native-height,
|
|
23
|
+
var(--compose-template-height, ${VIEWER_FALLBACK_HEIGHT}px)
|
|
24
|
+
);
|
|
21
25
|
}
|
|
22
26
|
.compose-viewer > iframe {
|
|
23
27
|
display: block; width: 100%; height: 100%; border: 0;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Connect the generated dashboard to its enclosing MCP Apps host as an App.
|
|
3
|
+
*
|
|
4
|
+
* Viewer reports size the board at once, even while the handshake is pending,
|
|
5
|
+
* and a plain iframe that never replies keeps working. A host that explicitly
|
|
6
|
+
* refuses `ui/initialize` (an error reply or another protocol version) is
|
|
7
|
+
* logged as `{ code: "CARD_HANDSHAKE_FAILED", expected, received }`; the board
|
|
8
|
+
* then fills its frame again (`data-compose-card-refused`) and ignores later
|
|
9
|
+
* viewer reports for sizing. ChatGPT's `notifyIntrinsicHeight` keeps the card
|
|
10
|
+
* sized regardless.
|
|
11
|
+
*/
|
|
2
12
|
export declare function generateCardHeightScript(): string;
|
|
3
13
|
//# sourceMappingURL=card-height.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card-height.d.ts","sourceRoot":"","sources":["../../../../../src/src/host/renderer/js/card-height.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"card-height.d.ts","sourceRoot":"","sources":["../../../../../src/src/host/renderer/js/card-height.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CA2FjD"}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { COMPOSE_VERSION, MCP_APPS_PROTOCOL_VERSION } from "../../../version.js";
|
|
2
|
-
|
|
2
|
+
import { generateIntrinsicLayoutFunction } from "./intrinsic-layout.js";
|
|
3
|
+
/**
|
|
4
|
+
* Connect the generated dashboard to its enclosing MCP Apps host as an App.
|
|
5
|
+
*
|
|
6
|
+
* Viewer reports size the board at once, even while the handshake is pending,
|
|
7
|
+
* and a plain iframe that never replies keeps working. A host that explicitly
|
|
8
|
+
* refuses `ui/initialize` (an error reply or another protocol version) is
|
|
9
|
+
* logged as `{ code: "CARD_HANDSHAKE_FAILED", expected, received }`; the board
|
|
10
|
+
* then fills its frame again (`data-compose-card-refused`) and ignores later
|
|
11
|
+
* viewer reports for sizing. ChatGPT's `notifyIntrinsicHeight` keeps the card
|
|
12
|
+
* sized regardless.
|
|
13
|
+
*/
|
|
3
14
|
export function generateCardHeightScript() {
|
|
4
15
|
return `
|
|
5
16
|
(() => {
|
|
@@ -7,7 +18,7 @@ export function generateCardHeightScript() {
|
|
|
7
18
|
if (!host || host === window) return;
|
|
8
19
|
const board = document.querySelector('#container[data-compose-board]');
|
|
9
20
|
if (!board) return;
|
|
10
|
-
|
|
21
|
+
${generateIntrinsicLayoutFunction()}
|
|
11
22
|
|
|
12
23
|
const initializeId = 'compose-card-initialize';
|
|
13
24
|
const protocolVersion = '${MCP_APPS_PROTOCOL_VERSION}';
|
|
@@ -16,26 +27,62 @@ export function generateCardHeightScript() {
|
|
|
16
27
|
const send = (message) => host.postMessage(
|
|
17
28
|
{ jsonrpc: '2.0', ...message }, hostOrigin && hostOrigin !== 'null' ? hostOrigin : '*'
|
|
18
29
|
);
|
|
30
|
+
function heightChannel() {
|
|
31
|
+
if (hostOrigin !== undefined) {
|
|
32
|
+
return (height) => send({ method: 'ui/notifications/size-changed', params: { height } });
|
|
33
|
+
}
|
|
34
|
+
if (typeof window.openai?.notifyIntrinsicHeight === 'function') {
|
|
35
|
+
return (height) => window.openai.notifyIntrinsicHeight(height);
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
19
39
|
function reportHeight() {
|
|
40
|
+
const notify = heightChannel();
|
|
41
|
+
if (!notify) return;
|
|
42
|
+
if (board.hasAttribute('data-compose-card-refused')) {
|
|
43
|
+
// ChatGPT's bridge arrived after the refusal: it sizes the card.
|
|
44
|
+
board.removeAttribute('data-compose-card-refused');
|
|
45
|
+
observer.observe(board, { box: 'border-box' });
|
|
46
|
+
}
|
|
47
|
+
enterIntrinsicLayout(board);
|
|
20
48
|
// The viewport still has the previous height while a row disappears.
|
|
21
49
|
// The grid's border box includes the skeleton, row gaps and padding.
|
|
22
50
|
const height = Math.ceil(board.getBoundingClientRect().height);
|
|
23
51
|
if (!Number.isFinite(height) || height < 0 || height === lastHeight) return;
|
|
24
|
-
|
|
25
|
-
send({ method: 'ui/notifications/size-changed', params: { height } });
|
|
26
|
-
} else if (typeof window.openai?.notifyIntrinsicHeight === 'function') {
|
|
27
|
-
window.openai.notifyIntrinsicHeight(height);
|
|
28
|
-
} else {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
52
|
+
notify(height);
|
|
31
53
|
lastHeight = height;
|
|
32
54
|
}
|
|
33
55
|
const observer = new ResizeObserver(reportHeight);
|
|
56
|
+
// An explicit refusal hands the board back to its frame, unless
|
|
57
|
+
// ChatGPT's height bridge still sizes the card.
|
|
58
|
+
function refuseCard() {
|
|
59
|
+
if (heightChannel()) return;
|
|
60
|
+
observer.disconnect();
|
|
61
|
+
window.removeEventListener('message', onHostMessage);
|
|
62
|
+
board.setAttribute('data-compose-card-refused', '');
|
|
63
|
+
board.removeAttribute('data-compose-intrinsic');
|
|
64
|
+
for (const viewer of Array.from(board.children ?? [])) {
|
|
65
|
+
viewer.style?.removeProperty?.('--compose-native-height');
|
|
66
|
+
viewer.style?.removeProperty?.('--compose-template-height');
|
|
67
|
+
}
|
|
68
|
+
board.dispatchEvent(new Event('compose-layout-intrinsic'));
|
|
69
|
+
}
|
|
34
70
|
function onHostMessage(event) {
|
|
35
71
|
const msg = event.data;
|
|
36
72
|
if (event.source !== host || msg?.jsonrpc !== '2.0') return;
|
|
37
73
|
if (hostOrigin === undefined) {
|
|
38
|
-
if (msg.id !== initializeId
|
|
74
|
+
if (msg.id !== initializeId) return;
|
|
75
|
+
const received = msg.result?.protocolVersion;
|
|
76
|
+
if (received !== protocolVersion) {
|
|
77
|
+
console.warn('[mcp-compose] Card height handshake failed', {
|
|
78
|
+
code: 'CARD_HANDSHAKE_FAILED',
|
|
79
|
+
expected: protocolVersion,
|
|
80
|
+
received: typeof received === 'string' ? received : null,
|
|
81
|
+
...(msg.error ? { error: msg.error } : {})
|
|
82
|
+
});
|
|
83
|
+
refuseCard();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
39
86
|
hostOrigin = event.origin;
|
|
40
87
|
send({ method: 'ui/notifications/initialized' });
|
|
41
88
|
lastHeight = undefined;
|
|
@@ -12,6 +12,17 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import type { CompositeUiDescriptor } from "../../../core/types/descriptor.js";
|
|
14
14
|
import type { ResolvedRendererSlotOptions } from "../options.js";
|
|
15
|
+
/**
|
|
16
|
+
* Tallest height, in CSS pixels, a viewer can claim with
|
|
17
|
+
* `ui/notifications/size-changed`. Taller content scrolls inside the viewer's
|
|
18
|
+
* iframe. Advertised to each viewer as `containerDimensions.maxHeight`.
|
|
19
|
+
*
|
|
20
|
+
* The cap also bounds a viewer whose content follows its own iframe
|
|
21
|
+
* (`min-height: 100vh` plus padding): it stops growing here. Compose does not
|
|
22
|
+
* guess such loops from equal increments, which a list gaining rows produces
|
|
23
|
+
* too.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MAX_VIEWER_HEIGHT = 2400;
|
|
15
26
|
/**
|
|
16
27
|
* Generate the event bus JavaScript for a composite UI.
|
|
17
28
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-bus.d.ts","sourceRoot":"","sources":["../../../../../src/src/host/renderer/js/event-bus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAG/E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"event-bus.d.ts","sourceRoot":"","sources":["../../../../../src/src/host/renderer/js/event-bus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAG/E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAOjE;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,OAAQ,CAAC;AAEvC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,qBAAqB,EACjC,KAAK,GAAE,WAAW,CAAC,MAAM,EAAE,2BAA2B,CAAa,GAClE,MAAM,CAolBR"}
|
|
@@ -13,6 +13,18 @@
|
|
|
13
13
|
import { COMPOSE_EVENT_METHOD } from "../../../sdk/compose-events.js";
|
|
14
14
|
import { COMPOSE_VERSION, MCP_APPS_PROTOCOL_VERSION } from "../../../version.js";
|
|
15
15
|
import { CASYS_COMPONENT_CATALOG_CAPABILITY_KEY, CASYS_SURFACE_CONTEXT_KEY, } from "../../components-contract.js";
|
|
16
|
+
import { generateIntrinsicLayoutFunction } from "./intrinsic-layout.js";
|
|
17
|
+
/**
|
|
18
|
+
* Tallest height, in CSS pixels, a viewer can claim with
|
|
19
|
+
* `ui/notifications/size-changed`. Taller content scrolls inside the viewer's
|
|
20
|
+
* iframe. Advertised to each viewer as `containerDimensions.maxHeight`.
|
|
21
|
+
*
|
|
22
|
+
* The cap also bounds a viewer whose content follows its own iframe
|
|
23
|
+
* (`min-height: 100vh` plus padding): it stops growing here. Compose does not
|
|
24
|
+
* guess such loops from equal increments, which a list gaining rows produces
|
|
25
|
+
* too.
|
|
26
|
+
*/
|
|
27
|
+
export const MAX_VIEWER_HEIGHT = 2_400;
|
|
16
28
|
/**
|
|
17
29
|
* Generate the event bus JavaScript for a composite UI.
|
|
18
30
|
*
|
|
@@ -68,6 +80,31 @@ export function generateEventBusScript(descriptor, slots = new Map()) {
|
|
|
68
80
|
const lastHostContexts = new Map();
|
|
69
81
|
const COMPONENT_CAPABILITY = '${CASYS_COMPONENT_CATALOG_CAPABILITY_KEY}';
|
|
70
82
|
const SURFACE_CONTEXT = '${CASYS_SURFACE_CONTEXT_KEY}';
|
|
83
|
+
const MAX_VIEWER_HEIGHT = ${MAX_VIEWER_HEIGHT};
|
|
84
|
+
// Viewers already warned about the cap.
|
|
85
|
+
const cappedViewers = new Set();
|
|
86
|
+
${generateIntrinsicLayoutFunction()}
|
|
87
|
+
|
|
88
|
+
// Viewer reports apply at once, as for any embed. Only an enclosing host
|
|
89
|
+
// that explicitly refused ui/initialize marks the board as refused: it
|
|
90
|
+
// fills its frame again and later reports no longer size it.
|
|
91
|
+
function handleViewerReport(slot, reported) {
|
|
92
|
+
const panel = iframes.get(slot)?.closest?.('.compose-viewer');
|
|
93
|
+
if (!panel) return;
|
|
94
|
+
const board = panel.parentElement;
|
|
95
|
+
if (board?.hasAttribute?.('data-compose-card-refused')) return;
|
|
96
|
+
const wanted = Math.ceil(reported);
|
|
97
|
+
if (wanted > MAX_VIEWER_HEIGHT && !cappedViewers.has(slot)) {
|
|
98
|
+
cappedViewers.add(slot);
|
|
99
|
+
console.warn('[mcp-compose] Viewer height capped', {
|
|
100
|
+
code: 'VIEWER_HEIGHT_CAPPED', slot, reported: wanted, max: MAX_VIEWER_HEIGHT
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
enterIntrinsicLayout(board);
|
|
104
|
+
panel.style.setProperty(
|
|
105
|
+
'--compose-native-height', Math.min(MAX_VIEWER_HEIGHT, wanted) + 'px'
|
|
106
|
+
);
|
|
107
|
+
}
|
|
71
108
|
|
|
72
109
|
// Build slot -> iframe map + reverse lookup. The fallback lookup matters
|
|
73
110
|
// when the iframe's WindowProxy becomes available after this script runs.
|
|
@@ -164,7 +201,7 @@ export function generateEventBusScript(descriptor, slots = new Map()) {
|
|
|
164
201
|
const panel = iframe.closest?.('.compose-viewer');
|
|
165
202
|
// A fixed height in the handshake makes responsive Apps stretch to the
|
|
166
203
|
// track before they can report the height of their own content.
|
|
167
|
-
if (panel) return { width };
|
|
204
|
+
if (panel) return { width, maxHeight: MAX_VIEWER_HEIGHT };
|
|
168
205
|
return { width, height };
|
|
169
206
|
}
|
|
170
207
|
|
|
@@ -496,6 +533,10 @@ export function generateEventBusScript(descriptor, slots = new Map()) {
|
|
|
496
533
|
];
|
|
497
534
|
const catalog = validComponentCatalog(advertisedCatalog);
|
|
498
535
|
if (catalog) componentCatalogs.set(sourceSlot, catalog);
|
|
536
|
+
// A reloaded viewer starts a new document: forget its height history,
|
|
537
|
+
// including the height the previous document reported. The captured
|
|
538
|
+
// template height stays as the fallback.
|
|
539
|
+
cappedViewers.delete(sourceSlot);
|
|
499
540
|
const hostContext = hostContextForSlot(sourceSlot);
|
|
500
541
|
lastHostContexts.set(sourceSlot, JSON.stringify(hostContext));
|
|
501
542
|
respond(event.source, message.id, {
|
|
@@ -540,13 +581,13 @@ export function generateEventBusScript(descriptor, slots = new Map()) {
|
|
|
540
581
|
}
|
|
541
582
|
|
|
542
583
|
if (message.method === 'ui/notifications/size-changed') {
|
|
543
|
-
const
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
panel
|
|
548
|
-
|
|
549
|
-
|
|
584
|
+
const reported = message.params?.height;
|
|
585
|
+
// Width belongs to the board. Only the child can measure its own document.
|
|
586
|
+
const panel = iframes.get(sourceSlot)?.closest?.('.compose-viewer');
|
|
587
|
+
if (
|
|
588
|
+
panel && initializationResponded.has(sourceSlot) &&
|
|
589
|
+
Number.isFinite(reported) && reported > 0
|
|
590
|
+
) handleViewerReport(sourceSlot, reported);
|
|
550
591
|
ackIfRequested(event.source, message, targetOrigin);
|
|
551
592
|
return;
|
|
552
593
|
}
|