@mcpview/compose 0.13.1 → 0.14.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/CHANGELOG.md +118 -0
- package/README.md +53 -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 +182 -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 +82 -0
- package/esm/src/code-mode/worker-host.d.ts.map +1 -0
- package/esm/src/code-mode/worker-host.js +364 -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 +190 -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 +82 -0
- package/script/src/code-mode/worker-host.d.ts.map +1 -0
- package/script/src/code-mode/worker-host.js +399 -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
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,124 @@ documented in this file.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.14.1] - 2026-11-29
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Under Deno, the default `isolation: "worker"` no longer fails with `SANDBOX_UNAVAILABLE` when
|
|
13
|
+
Compose is loaded from JSR without an unrestricted import grant. The check now asks for
|
|
14
|
+
`jsr.io:443`, which Deno grants by default, instead of every port of `jsr.io`. The recovery text
|
|
15
|
+
for a missing Deno permission now proposes granting it.
|
|
16
|
+
|
|
17
|
+
## [0.14.0] - 2026-11-29
|
|
18
|
+
|
|
19
|
+
**Breaking** (0.x minor): Code Mode now runs programs in a worker by default (runtimes without
|
|
20
|
+
workers must pass `isolation: "inline"` or fail with `SANDBOX_UNAVAILABLE`); failures are coded
|
|
21
|
+
`CodeModeError`s instead of prose messages; and api calls are lazy, dispatched in the order the
|
|
22
|
+
program awaits them, with never-started calls failing as `UNAWAITED_OPERATION`. See the **Changed**
|
|
23
|
+
section below for the migration notes.
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- Code Mode programs run in a short-lived worker by default, so a CPU-bound program no longer blocks
|
|
28
|
+
the server's event loop for up to 2 s. A shared flag stops the guest within milliseconds on abort
|
|
29
|
+
or timeout. `createSnippetChain` and `runProgram` accept `isolation: "worker" | "inline"`.
|
|
30
|
+
Runtimes or bundles without workers must pass `"inline"` explicitly; otherwise configuration fails
|
|
31
|
+
with `SANDBOX_UNAVAILABLE`. Under Deno the worker inherits the host's permissions and needs read
|
|
32
|
+
access to the whole `code-mode` directory (or import access from JSR) and to the QuickJS WASM file
|
|
33
|
+
of `quickjs-emscripten`. Configuration only checks the worker module, so a missing grant for the
|
|
34
|
+
other files shows up at the first run as `SANDBOX_FAILED`. The npm package ships the worker as an
|
|
35
|
+
internal file; it is not a public export. Node options such as `--max-old-space-size` and
|
|
36
|
+
`--input-type` no longer reach the worker, whether they come from `execArgv` or `NODE_OPTIONS`.
|
|
37
|
+
Browsers cannot run the worker guest: configuring `"worker"` there fails with
|
|
38
|
+
`SANDBOX_UNAVAILABLE`, so use `"inline"`.
|
|
39
|
+
- Code Mode failures are `CodeModeError`s with a stable `code`, `recovery` and `context`, rendered
|
|
40
|
+
as `[execute] CODE: detail. Recovery: hint.` instead of prose such as `JavaScript failed.` or
|
|
41
|
+
`Chain execution failed.`. Inside a program, a failed api call throws an `Error` that carries the
|
|
42
|
+
same fields, so `e.code` works in a `catch`. Once a provider call was dispatched, errors carry
|
|
43
|
+
`effects: "possible"` and keep hiding guest, provider and transport text.
|
|
44
|
+
- **Breaking:** api calls are dispatched in the order the program awaits them, not in declaration
|
|
45
|
+
order. A saved chain that assigns `const write = api.runSnippet(...)`, awaits a read, then awaits
|
|
46
|
+
`write` now runs the read first and can return stale data. Migration: await calls in the order
|
|
47
|
+
they must run, and re-save any chain that depended on declaration order.
|
|
48
|
+
- An api call reaches the host once the program starts it (awaits it or attaches a handler). A call
|
|
49
|
+
that was started is committed, like an in-flight promise: it runs before the program completes,
|
|
50
|
+
even when `Promise.race` or a failed `Promise.all` moved on or the program returned without
|
|
51
|
+
waiting. A call that was never started no longer runs in the background; the program fails with
|
|
52
|
+
`UNAWAITED_OPERATION` and nothing was sent for it. Arguments are copied when the call is made.
|
|
53
|
+
- `panel` and `sync` no longer consume the provider budget: a program can make 16 provider calls and
|
|
54
|
+
48 board operations, so a board is no longer capped at 8 panels. `CODE_MODE_LIMITS` exports the
|
|
55
|
+
defaults, and `limits` overrides them.
|
|
56
|
+
|
|
57
|
+
### Added
|
|
58
|
+
|
|
59
|
+
- `CodeModeError`, `CODE_MODE_ERROR_CODES`, `formatCodeModeError`, `isCodeModeError`,
|
|
60
|
+
`CODE_MODE_LIMITS`, `assertSandboxIsolation` and the `SnippetChainOptions` type from
|
|
61
|
+
`@mcpview/compose/code-mode`.
|
|
62
|
+
- ADR 0006 records how Compose runs agent-written Code Mode programs.
|
|
63
|
+
|
|
64
|
+
### Fixed
|
|
65
|
+
|
|
66
|
+
- Cap the height a viewer can claim with `ui/notifications/size-changed` at 2400 px, advertised as
|
|
67
|
+
`containerDimensions.maxHeight`. A report such as `1e12` no longer stretches the board, and a
|
|
68
|
+
viewer whose content follows its own frame (`min-height: 100vh` plus padding) stops growing there.
|
|
69
|
+
`VIEWER_HEIGHT_CAPPED` is logged once per viewer.
|
|
70
|
+
- Keep the template height of a viewer that never reports its height once the board sizes its rows
|
|
71
|
+
from content, instead of dropping it to 200 px.
|
|
72
|
+
- Apply viewer heights at once, as before, even while an embedded board's MCP Apps handshake is
|
|
73
|
+
pending, so plain iframe embeds keep resizing their viewers. Only an enclosing host that
|
|
74
|
+
explicitly refuses `ui/initialize` (an error reply or another protocol version) makes the board
|
|
75
|
+
fill its frame again, drop its native heights and ignore later viewer reports for sizing. The
|
|
76
|
+
refusal is logged as `CARD_HANDSHAKE_FAILED` with the expected and received protocol versions.
|
|
77
|
+
Committed panel placements are recomputed when the board changes layout mode. If ChatGPT's height
|
|
78
|
+
bridge appears after a refusal, the board is sized through it again.
|
|
79
|
+
- A host error whose serializer throws no longer causes an unhandled rejection in the host: replies
|
|
80
|
+
are built from the error's base fields and any failure settles the run with `SANDBOX_FAILED`.
|
|
81
|
+
- An unexpected worker exit aborts in-flight provider calls (their signal), and still reports
|
|
82
|
+
`SANDBOX_FAILED`.
|
|
83
|
+
- Quoted values in `NODE_OPTIONS` (for example `--conditions="custom condition"`) are parsed and
|
|
84
|
+
forwarded to the worker with Node's quoting rules.
|
|
85
|
+
- `PROVIDER_UNAVAILABLE` after a dispatch tells the guest to check whether the operation took effect
|
|
86
|
+
before retrying.
|
|
87
|
+
- A never-started call is reported as `UNAWAITED_OPERATION` before an invalid return value.
|
|
88
|
+
- A parameter rejected before the store write is reported as such, not as an uncertain
|
|
89
|
+
`SAVE_FAILED`.
|
|
90
|
+
- README: before provider dispatch, `execute` preserves the caller's original abort reason.
|
|
91
|
+
- Code Mode never starts a provider call after the wall deadline, even when a slow `names` lookup
|
|
92
|
+
held the event loop; inline startup of QuickJS is cancellable; calls started by a `toJSON` that
|
|
93
|
+
then fails are still run before `RESULT_INVALID`; a guest error property read that crosses the CPU
|
|
94
|
+
limit reports `TIME_LIMIT`; a store's own `AbortError` is `CATALOG_ERROR` and a caller's abort
|
|
95
|
+
reason is kept when a catalog lookup fails meanwhile.
|
|
96
|
+
- A provider error with code `UNAVAILABLE` is reported as such instead of a generic execution error.
|
|
97
|
+
- `listSnippets` counts as a provider dispatch: guest text is redacted and errors carry
|
|
98
|
+
`effects: "possible"` after a catalogue read, as after `runSnippet`.
|
|
99
|
+
- The wall deadline is checked right before a provider call starts, so work queued behind a busy
|
|
100
|
+
event loop no longer begins after the deadline.
|
|
101
|
+
- A host result that decodes past the VM's memory reports `RESOURCE_LIMIT` instead of
|
|
102
|
+
`OPERATION_FAILED`. The host also rejects a result over `valueLength` before posting it to the
|
|
103
|
+
worker.
|
|
104
|
+
- A save whose acknowledgement is lost reports `SAVE_FAILED` (check `listSaved` before retrying)
|
|
105
|
+
even when the program called no provider. A caller's own abort reason is preserved before any
|
|
106
|
+
provider call.
|
|
107
|
+
- `memoryBytes` and `stackBytes` above 2 GiB - 1 are rejected instead of wrapping at the WASM
|
|
108
|
+
boundary. Values too small for the VM to start (under 64 KiB of memory or 16 KiB of stack) are
|
|
109
|
+
rejected at configuration instead of failing every run with `SANDBOX_FAILED`.
|
|
110
|
+
- A stack or memory overflow while serializing a program's result or an api argument (a recursive
|
|
111
|
+
`toJSON`) reports `RESOURCE_LIMIT` instead of `RESULT_INVALID` or `ARGUMENT_INVALID`.
|
|
112
|
+
- A call started by a result's `toJSON` runs before the program completes, and a call it declared
|
|
113
|
+
without starting reports `UNAWAITED_OPERATION`, like any other call.
|
|
114
|
+
- A browser-targeted bundle that selects `isolation: "inline"` no longer fails to resolve
|
|
115
|
+
`node:worker_threads`: the Node worker adapter loads it at run time.
|
|
116
|
+
- Under Node's permission model without `--allow-worker`, worker isolation fails with
|
|
117
|
+
`SANDBOX_UNAVAILABLE` (at configuration, or when the worker constructor is refused) instead of
|
|
118
|
+
`SANDBOX_FAILED`. Audit mode is not treated as a denial.
|
|
119
|
+
- A catalog write that the store confirmed after the caller aborted is reported as interrupted (the
|
|
120
|
+
message says the chain was saved and to call `listSaved`); the name stays counted. A store that
|
|
121
|
+
fails with a `DOMException` while writing reports `SAVE_FAILED`, not the raw exception.
|
|
122
|
+
- Documented: a caller abort rejects with a `DOMException` (`AbortError` or `TimeoutError`), not a
|
|
123
|
+
`CodeModeError`, so it carries no `effects` field. The 128 KiB value limit counts UTF-16 code
|
|
124
|
+
units of the JSON text, not UTF-8 bytes.
|
|
125
|
+
|
|
8
126
|
## [0.13.1] - 2026-11-27
|
|
9
127
|
|
|
10
128
|
### Added
|
package/README.md
CHANGED
|
@@ -119,6 +119,56 @@ per call. The host derives this scope from the authenticated user and integratio
|
|
|
119
119
|
the program and its parameter types. `replay` runs it with fresh inputs and the caller's current
|
|
120
120
|
provider permissions.
|
|
121
121
|
|
|
122
|
+
Each program runs in QuickJS with no host bindings. By default it runs in a short-lived worker, so a
|
|
123
|
+
CPU-bound program cannot block the server: `createSnippetChain(providers, catalog, { isolation })`
|
|
124
|
+
accepts `"worker"` (default) or `"inline"`. Use `"inline"` explicitly in runtimes or bundles that
|
|
125
|
+
cannot start the worker module. An unavailable isolation fails at configuration with
|
|
126
|
+
`SANDBOX_UNAVAILABLE`, never by falling back silently. Under Deno the worker inherits the host's
|
|
127
|
+
permissions: grant read access to the `code-mode` directory of the package and to the QuickJS WASM
|
|
128
|
+
file shipped with `quickjs-emscripten`. Loaded from JSR, the package directory needs import access
|
|
129
|
+
to `jsr.io:443` instead, which Deno grants by default. Configuration only checks the worker module
|
|
130
|
+
itself; a missing grant for the other files fails the first run with `SANDBOX_FAILED`, so run one
|
|
131
|
+
program at startup to verify the setup. `CODE_MODE_LIMITS` gives the defaults: 2 s of guest CPU
|
|
132
|
+
(host calls excluded), 30 s of wall time, 12 MiB of memory, 16 provider calls (`listSnippets`,
|
|
133
|
+
`runSnippet`) and 48 board operations (`panel`, `sync`) per program. Pass `limits` to override some
|
|
134
|
+
of them (`memoryBytes` must be at least 64 KiB and `stackBytes` at least 16 KiB, or configuration
|
|
135
|
+
throws a `RangeError`). `valueLength` counts UTF-16 code units of the JSON text, not UTF-8 bytes.
|
|
136
|
+
Under Node's permission model, workers need `--allow-worker`; without it configuration fails with
|
|
137
|
+
`SANDBOX_UNAVAILABLE` (audit mode does not count). Browsers have no worker guest: a browser-targeted
|
|
138
|
+
bundle must use `isolation: "inline"` (the default `"worker"` fails at configuration with
|
|
139
|
+
`SANDBOX_UNAVAILABLE`); the Node worker adapter is loaded at run time, so bundlers do not resolve
|
|
140
|
+
`node:worker_threads`. `NODE_OPTIONS` that a worker cannot start with (such as `--input-type`) are
|
|
141
|
+
not passed to it either.
|
|
142
|
+
|
|
143
|
+
**Breaking change: calls dispatch in the order they are awaited.** A call reaches the provider when
|
|
144
|
+
the program starts it, not where it is written. A program that stores
|
|
145
|
+
`const write =
|
|
146
|
+
api.runSnippet(...)`, awaits a read and only then awaits `write` now sends the read
|
|
147
|
+
first; before, the provider received the write first. Await calls in the order they must run,
|
|
148
|
+
including in saved chains: edit any saved chain that relied on declaration order and save it again.
|
|
149
|
+
|
|
150
|
+
Every api call is lazy: it reaches the host once the program starts it (awaits it or attaches a
|
|
151
|
+
handler). A started call is committed like an in-flight promise and runs before the program
|
|
152
|
+
completes, even if `Promise.race` moved on. A call the program never started never runs and the
|
|
153
|
+
program fails with `UNAWAITED_OPERATION`; that check applies when the program returns, so a program
|
|
154
|
+
that throws or stalls reports `GUEST_ERROR` or `GUEST_STALLED` instead. A provider call never starts
|
|
155
|
+
after the wall limit has passed, and an exhausted CPU or wall limit wins over a guest error.
|
|
156
|
+
Failures are `CodeModeError`s whose message reads `[execute] CODE: detail. Recovery: hint.`, so a
|
|
157
|
+
host that forwards `error.message` keeps the code. Inside the program, a failed api call throws an
|
|
158
|
+
`Error` with `code`, `recovery` and `context`. Once a provider call was dispatched, errors carry
|
|
159
|
+
`effects: "possible"` and never repeat guest, provider or transport text. A program's result is
|
|
160
|
+
serialized once at the end, and calls its `toJSON` starts are run before the program completes.
|
|
161
|
+
|
|
162
|
+
A caller abort is not a `CodeModeError`: once a provider was dispatched or a save confirmed,
|
|
163
|
+
`execute` rejects with a `DOMException` (`AbortError`, or `TimeoutError` for a timeout) so a host
|
|
164
|
+
can tell a cancelled task from a failed one. Before any provider dispatch, `execute` preserves the
|
|
165
|
+
caller's original abort reason, whatever its type (for example `new Error("stop")`), so detect a
|
|
166
|
+
cancellation through your own `AbortSignal`, not through `DOMException` alone. A `DOMException` has
|
|
167
|
+
no `effects` field: after a provider call was dispatched, or after a chain was saved, its message
|
|
168
|
+
reads `[execute] INTERRUPTED: ... Recovery: ...` and says to check the effects or call `listSaved`.
|
|
169
|
+
A save the store confirmed after the caller aborted is still saved. A failure of the catalog write
|
|
170
|
+
itself is `SAVE_FAILED`, whatever exception the store threw.
|
|
171
|
+
|
|
122
172
|
In the board's MCP Apps tool-result handler, call `composeSnippetBoard(result, { layout: "split" })`
|
|
123
173
|
from `@mcpview/compose/code-mode/board`. Each selected receipt has its own component ID, including
|
|
124
174
|
two instances of the same viewer. The board renders each child from `child.context.panel.result`.
|
|
@@ -638,6 +688,9 @@ acknowledgement; notifications without an `id` receive no response. This follows
|
|
|
638
688
|
| `NO_UI_METADATA` | Tool result has no UI metadata |
|
|
639
689
|
| `EMPTY_RESOURCES` | No resources provided to composer |
|
|
640
690
|
|
|
691
|
+
**Code Mode errors (`CodeModeErrorCode`):** see `CODE_MODE_ERROR_CODES` in
|
|
692
|
+
`@mcpview/compose/code-mode`. Messages read `[execute] CODE: detail. Recovery: hint.`
|
|
693
|
+
|
|
641
694
|
**Runtime errors (`RuntimeErrorCode`):**
|
|
642
695
|
|
|
643
696
|
| Code | Description |
|
|
@@ -2,6 +2,7 @@ import type { CallToolResult } from "@modelcontextprotocol/client";
|
|
|
2
2
|
import type { SnippetCatalog } from "@mcpview/server/snippets";
|
|
3
3
|
import type { ViewComponentEventPorts } from "../core/types/components.js";
|
|
4
4
|
import { type SnippetChainContext, type SnippetProvider } from "./providers.js";
|
|
5
|
+
import { type SandboxIsolation, type SandboxLimits } from "./sandbox.js";
|
|
5
6
|
/** Selected native result, available only to the MCP App in result metadata. */
|
|
6
7
|
export interface SnippetPanelReceipt {
|
|
7
8
|
id: string;
|
|
@@ -11,12 +12,34 @@ export interface SnippetPanelReceipt {
|
|
|
11
12
|
result: CallToolResult;
|
|
12
13
|
events?: ViewComponentEventPorts;
|
|
13
14
|
}
|
|
15
|
+
/** Options of {@link createSnippetChain}. */
|
|
16
|
+
export interface SnippetChainOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Where programs run. Defaults to `"worker"`, which keeps the host
|
|
19
|
+
* responsive. Use `"inline"` explicitly in runtimes or bundles without
|
|
20
|
+
* workers. An unavailable isolation fails here with `SANDBOX_UNAVAILABLE`.
|
|
21
|
+
*/
|
|
22
|
+
readonly isolation?: SandboxIsolation;
|
|
23
|
+
/** Override some limits of each program (see `CODE_MODE_LIMITS`). */
|
|
24
|
+
readonly limits?: Partial<SandboxLimits>;
|
|
25
|
+
}
|
|
14
26
|
/** Execute input from the MCP tool using trusted context supplied separately by the host. */
|
|
15
27
|
export type SnippetChainExecutor = (input: Record<string, unknown>, context?: SnippetChainContext) => Promise<CallToolResult>;
|
|
16
28
|
/**
|
|
17
29
|
* Run JavaScript against host-configured snippet providers. Selected results stay
|
|
18
30
|
* out of guest memory except for their declared JSON value. Supplying a catalog
|
|
19
31
|
* enables named chains for calls with a trusted scope.
|
|
32
|
+
*
|
|
33
|
+
* Failures are {@link CodeModeError}s whose message reads
|
|
34
|
+
* `[execute] CODE: detail. Recovery: hint.`; a caller abort rejects with a
|
|
35
|
+
* DOMException. Once an upstream snippet call was dispatched, errors carry
|
|
36
|
+
* `effects: "possible"` and never repeat guest, provider or transport text.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const execute = createSnippetChain(providers, catalog, { isolation: "worker" });
|
|
41
|
+
* const result = await execute({ code: "return 1;" }, { scope: "user-1" });
|
|
42
|
+
* ```
|
|
20
43
|
*/
|
|
21
|
-
export declare function createSnippetChain(providers: ReadonlyMap<string, SnippetProvider>, catalog?: SnippetCatalog): SnippetChainExecutor;
|
|
44
|
+
export declare function createSnippetChain(providers: ReadonlyMap<string, SnippetProvider>, catalog?: SnippetCatalog, options?: SnippetChainOptions): SnippetChainExecutor;
|
|
22
45
|
//# sourceMappingURL=chain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../src/src/code-mode/chain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,0BAA0B,CAAC;AAClF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAU3E,OAAO,EAAiB,KAAK,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../src/src/code-mode/chain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,0BAA0B,CAAC;AAClF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAU3E,OAAO,EAAiB,KAAK,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE/F,OAAO,EAKL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,cAAc,CAAC;AAGtB,gFAAgF;AAChF,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,CAAC,EAAE,uBAAuB,CAAC;CAClC;AAED,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IACtC,qEAAqE;IACrE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAC1C;AAuKD,6FAA6F;AAC7F,MAAM,MAAM,oBAAoB,GAAG,CACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,CAAC,EAAE,mBAAmB,KAC1B,OAAO,CAAC,cAAc,CAAC,CAAC;AAE7B;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,EAC/C,OAAO,CAAC,EAAE,cAAc,EACxB,OAAO,GAAE,mBAAwB,GAChC,oBAAoB,CAwYtB"}
|