@workerdeck/core 0.13.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/README.md +74 -6
- package/build/index.d.mts +147 -18
- package/build/index.mjs +179 -36
- package/build/index.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -88,26 +88,64 @@ supports — no CLI process, no config directory. `createEngineSession()` assemb
|
|
|
88
88
|
the capability-scoped tool set, and the executor that runs tool calls.
|
|
89
89
|
|
|
90
90
|
```ts
|
|
91
|
+
import variant from '@jitl/quickjs-ng-wasmfile-release-asyncify'
|
|
92
|
+
import { loadEngine } from '@workerdeck/sandbox'
|
|
91
93
|
import { createEngineSession, QuickJsExecutor } from '@workerdeck/core'
|
|
92
94
|
|
|
95
|
+
// Server-side, the WASM guest is loaded once for the process and shared by every
|
|
96
|
+
// session. The variant package is a peer dependency you install yourself — core
|
|
97
|
+
// does not pick one for you, because the browser build and the server build are
|
|
98
|
+
// different artifacts and only you know which side this is.
|
|
99
|
+
const executor = new QuickJsExecutor({ engine: await loadEngine(variant), defaultTimeoutMs: 15_000 })
|
|
100
|
+
|
|
93
101
|
const runner = createEngineSession({
|
|
94
102
|
config: { ...createSessionRequest, languageModel: anthropic('claude-sonnet-5') },
|
|
95
|
-
selectExecutor: () =>
|
|
103
|
+
selectExecutor: () => executor,
|
|
96
104
|
capabilities: { webFetch: {} }, // backends, not grants
|
|
105
|
+
seedVfs: { '/README.md': 'scratch space' },
|
|
97
106
|
})
|
|
98
107
|
```
|
|
99
108
|
|
|
100
|
-
|
|
109
|
+
Three seams matter here:
|
|
101
110
|
|
|
102
111
|
- **Capabilities are grants, wired separately from backends.** `createToolContext` builds the tool
|
|
103
112
|
set from what a profile grants (`fs_*`, `eval_script`, `web_search`, `download`, `web_fetch`,
|
|
104
113
|
`deliver_file`) over what the host actually wired. There is no shell and no host filesystem: the
|
|
105
114
|
files a session sees are an in-memory scratch VFS. Every tool is typed `sandboxed` or
|
|
106
115
|
`authoritative`, and only sandboxed calls may leave the server.
|
|
107
|
-
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
116
|
+
- **Your own tools go in at a stated trust level.** `tools: { name: { tool, trust } }` is the seam
|
|
117
|
+
for anything that is neither a built-in capability nor MCP. `authoritative` means it runs here
|
|
118
|
+
with this process's authority and must declare `execute`; `sandboxed` means it rides the executor
|
|
119
|
+
seam and must *not*. Both contradictions are refused at assembly rather than at runtime, because
|
|
120
|
+
a sandboxed tool that quietly ran in-process would defeat the only thing sandboxing it was for.
|
|
121
|
+
- **`ToolExecutor` decides where code runs**, and that is a real architectural choice — see below.
|
|
122
|
+
|
|
123
|
+
### Which executor?
|
|
124
|
+
|
|
125
|
+
| | `QuickJsExecutor` (in-process) | `BrowserBridgeExecutor` (the tab) | `DeferredExecutor` |
|
|
126
|
+
|---|---|---|---|
|
|
127
|
+
| Runs where | this Node process, WASM guest | the attached client | wherever you send it |
|
|
128
|
+
| Needs a client attached | no | **yes** | no |
|
|
129
|
+
| Data locality | data must reach the server | client-held data never leaves the tab | n/a |
|
|
130
|
+
| Trust | you own both sides | results are **untrusted input** — the sandboxed party answers | depends |
|
|
131
|
+
| Latency | in-process | a WS round trip | unbounded (the session parks) |
|
|
132
|
+
|
|
133
|
+
The question to ask is **where the data the loop reasons over already lives**:
|
|
134
|
+
|
|
135
|
+
- In your database or on your disk → in-process. Pushing execution into the tab buys nothing and
|
|
136
|
+
hands an executor to the party you are sandboxing against.
|
|
137
|
+
- In the user's browser — a document they are editing, a file they dropped, something you would
|
|
138
|
+
rather not receive at all → the bridge. This is the case it exists for.
|
|
139
|
+
- Somewhere that answers in minutes or hours (a queue, a human, a build) → deferred, and let the
|
|
140
|
+
session park.
|
|
141
|
+
|
|
142
|
+
Two constraints that decide it for you regardless: an **unattended job** has no attached client, so
|
|
143
|
+
the bridge is not available to it; and a bridged result is by definition produced by the sandboxed
|
|
144
|
+
party, so nothing authoritative may ever be routed there.
|
|
145
|
+
|
|
146
|
+
An executor is chosen per *call*, not per session (`selectExecutor` runs at assembly, but a routing
|
|
147
|
+
executor may keep `eval_script` in-process and defer a long-running tool), which is what lets one
|
|
148
|
+
session mix all three.
|
|
111
149
|
|
|
112
150
|
## Work that outlives the runner
|
|
113
151
|
|
|
@@ -127,6 +165,36 @@ selectExecutor: () => new DeferredExecutor({
|
|
|
127
165
|
for you — a `SessionStore` plus `POST /executions/:id/result` — but the mechanism is here, and works
|
|
128
166
|
with no server at all.
|
|
129
167
|
|
|
168
|
+
## Rules you cannot infer from the types
|
|
169
|
+
|
|
170
|
+
Things the compiler will not tell you, each of which has cost someone real time:
|
|
171
|
+
|
|
172
|
+
- **A declared MCP server that never connected is refused, not degraded.** If a profile's
|
|
173
|
+
`session.mcpServers` names a server and it isn't there, `createEngineSession` throws. The old
|
|
174
|
+
behaviour — start anyway, minus those tools — produced a session that reported perfectly healthy
|
|
175
|
+
while the agent apologised its way through every request that needed it. Pass
|
|
176
|
+
`connectMcpTools(servers, { required: true })` to fail at connect time instead, and hand the
|
|
177
|
+
resulting connection over as `mcp` (not just `mcp.tools`) so the check is exact.
|
|
178
|
+
- **A stateless MCP server must answer `GET` with 405.** The client opens the SSE stream with a
|
|
179
|
+
`GET` before it sends anything. Mounted under a framework's default 404, the whole connect fails
|
|
180
|
+
with an error that names neither the method nor the route.
|
|
181
|
+
- **Never seed the VFS by hand on a restore.** Use `seedVfs`, which is ignored when
|
|
182
|
+
`config.restore` is set. Building `config.vfs` yourself still works and still wins — and then
|
|
183
|
+
overwriting the files the parked turn wrote is yours to avoid.
|
|
184
|
+
- **Forward the host's `id`.** `createEngineSession({ id })` is how a session comes back as
|
|
185
|
+
*itself* across a gateway restart. Dropping it strands every client's route and unread mark, and
|
|
186
|
+
the rebuild is refused.
|
|
187
|
+
- **`onClose` runs on park as well as close.** Parking releases the same resources; a disposer that
|
|
188
|
+
assumes the session is over will close an MCP connection the woken session still needs to rebuild.
|
|
189
|
+
- **Authoritative tools are never bridged.** `withMcpTools` marks everything authoritative by
|
|
190
|
+
construction. If you want a host tool the tab may run, declare it `sandboxed` in `tools` — and
|
|
191
|
+
then treat its results as untrusted input, because the tab produced them.
|
|
192
|
+
- **Never make a tool's operation depend on a field being absent.** "Create when `id` is missing,
|
|
193
|
+
overwrite when it is present" is the shape that breaks: models send `""` — and, observed live,
|
|
194
|
+
`" "` — rather than omitting, and some providers mark every property required so the model
|
|
195
|
+
*cannot* omit. `z.string().min(1).optional()` does not save it (a space has length 1). Split it
|
|
196
|
+
into two tools with required arguments, and trim-and-blank-check optional strings inside `run`.
|
|
197
|
+
|
|
130
198
|
## Also exported
|
|
131
199
|
|
|
132
200
|
`InputQueue` (the push-based `AsyncIterable` bridging `sendMessage()` into the SDK's streaming
|
package/build/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { McpServerStatus, Options, Query, SDKMessage, SDKUserMessage, SessionMessage } from "@anthropic-ai/claude-agent-sdk";
|
|
2
2
|
import { ApiMessage, CreateSessionRequest, EngineCapabilities, McpServerConfigWire, McpServerStatusInfo, MessageAttachment, ModelOption, PermissionMode, PermissionRequest, ProfileEngine, ProfileInfo, SdkSessionSummary, SessionEvent, SessionEventBody, SessionInfo, SessionStatus, ToolCallRequestFrame, ToolExecutionBackend, ToolExecutionOutput } from "@workerdeck/protocol";
|
|
3
|
-
import { LanguageModel, ModelMessage, Tool, ToolSet } from "ai";
|
|
3
|
+
import { LanguageModel, LanguageModel as LanguageModel$1, ModelMessage, Tool, Tool as Tool$1, ToolSet, ToolSet as ToolSet$1 } from "ai";
|
|
4
4
|
import { SandboxEngine, SandboxVfs } from "@workerdeck/sandbox";
|
|
5
5
|
import { Readable, Writable } from "node:stream";
|
|
6
6
|
|
|
@@ -298,11 +298,11 @@ type AiSdkRunnerConfig = Omit<CreateSessionRequest, 'cwd'> & {
|
|
|
298
298
|
cwd?: string;
|
|
299
299
|
/** AI SDK language model instance (or gateway model id string). Provider
|
|
300
300
|
* resolution from profiles happens host-side; core takes the resolved model. */
|
|
301
|
-
languageModel: LanguageModel;
|
|
301
|
+
languageModel: LanguageModel$1;
|
|
302
302
|
/** Tools available to the loop. Tools WITHOUT `execute` halt the loop when
|
|
303
303
|
* called; their calls surface via `pendingToolCalls` and are answered with
|
|
304
304
|
* `resolveToolCall()`, which re-enters the loop by message-state replay. */
|
|
305
|
-
tools?: ToolSet; /** System prompt (AI SDK v7 `instructions`). */
|
|
305
|
+
tools?: ToolSet$1; /** System prompt (AI SDK v7 `instructions`). */
|
|
306
306
|
instructions?: string; /** Max loop steps per turn. Default 20. */
|
|
307
307
|
maxSteps?: number;
|
|
308
308
|
/**
|
|
@@ -320,7 +320,19 @@ type AiSdkRunnerConfig = Omit<CreateSessionRequest, 'cwd'> & {
|
|
|
320
320
|
memoryLimitBytes?: number;
|
|
321
321
|
}; /** Which backend the executor represents, for `execution_dispatched` events. */
|
|
322
322
|
executionBackend?: ToolExecutionBackend; /** Swap models mid-session (`set_model`). Unset = setModel() is rejected. */
|
|
323
|
-
resolveModel?: (modelId: string | undefined) => LanguageModel;
|
|
323
|
+
resolveModel?: (modelId: string | undefined) => LanguageModel$1;
|
|
324
|
+
/**
|
|
325
|
+
* Live MCP status for this session, when the host wired MCP at all. Unlike
|
|
326
|
+
* the CLI engines — which ask their binary — this engine's MCP is entirely
|
|
327
|
+
* host-assembled, so the host is the only party that can answer. Unset means
|
|
328
|
+
* "no MCP here", which reads as an empty list rather than an error: a session
|
|
329
|
+
* with no servers is a fact, not a missing feature.
|
|
330
|
+
*
|
|
331
|
+
* Named apart from the inherited `mcpServers` request field on purpose —
|
|
332
|
+
* that one is the *wire configuration* a client asked for, this one is what
|
|
333
|
+
* the host actually connected.
|
|
334
|
+
*/
|
|
335
|
+
reportMcpServers?: () => Promise<McpServerStatusInfo[] | undefined>;
|
|
324
336
|
/** Called once when the session closes — release per-session resources the
|
|
325
337
|
* host attached (an MCP connection, a watcher). Errors are swallowed. Also
|
|
326
338
|
* runs when the session parks: parking releases the same resources. */
|
|
@@ -451,6 +463,15 @@ declare class AiSdkRunner implements Runner {
|
|
|
451
463
|
* deferred executor). Idempotent by executionId.
|
|
452
464
|
*/
|
|
453
465
|
settleExecution(executionId: string, result: ToolExecutionResult): boolean;
|
|
466
|
+
/**
|
|
467
|
+
* This session's MCP servers, as the host assembled them.
|
|
468
|
+
*
|
|
469
|
+
* Always answers — an empty list when no MCP was wired — because the
|
|
470
|
+
* alternative (undefined, which the server turns into a 501) says "this
|
|
471
|
+
* engine cannot tell you", and this engine can: the host that built the
|
|
472
|
+
* session is the only party who knows, and it has been asked.
|
|
473
|
+
*/
|
|
474
|
+
mcpServers(): Promise<McpServerStatusInfo[] | undefined>;
|
|
454
475
|
/** Host-facing rename: writes `meta.title`, which `#title()` prefers. Clearing
|
|
455
476
|
* it (undefined) restores the derived title. The engine is never told. */
|
|
456
477
|
setTitle(title: string | undefined): void;
|
|
@@ -755,7 +776,7 @@ type ToolDefinition = {
|
|
|
755
776
|
trust: ToolTrust;
|
|
756
777
|
/** The AI SDK tool. Sandboxed tools are declared WITHOUT `execute` so the loop
|
|
757
778
|
* hands them to the ToolExecutor seam rather than running them inline. */
|
|
758
|
-
tool: Tool;
|
|
779
|
+
tool: Tool$1;
|
|
759
780
|
};
|
|
760
781
|
type ToolContextOptions = {
|
|
761
782
|
/** Executor for sandboxed tools. Selected per call by the host (browser bridge
|
|
@@ -795,7 +816,7 @@ type ToolContextOptions = {
|
|
|
795
816
|
/** Everything a session's tools need, plus the tool set to hand the runner. */
|
|
796
817
|
type ToolContext = {
|
|
797
818
|
vfs: SandboxVfs;
|
|
798
|
-
tools: ToolSet;
|
|
819
|
+
tools: ToolSet$1;
|
|
799
820
|
definitions: ToolDefinition[]; /** Names the loop must not execute inline (they go through the executor). */
|
|
800
821
|
sandboxedToolNames: string[];
|
|
801
822
|
};
|
|
@@ -811,7 +832,36 @@ type ToolContext = {
|
|
|
811
832
|
declare function createToolContext(options: ToolContextOptions): ToolContext;
|
|
812
833
|
/** Add host-side MCP tools to a context. They are ALWAYS authoritative: they run
|
|
813
834
|
* server-side with server credentials, and must never be handed to a browser. */
|
|
814
|
-
declare function withMcpTools(context: ToolContext, mcpTools: ToolSet): ToolContext;
|
|
835
|
+
declare function withMcpTools(context: ToolContext, mcpTools: ToolSet$1): ToolContext;
|
|
836
|
+
/** A tool the host supplies, with the trust level it is to run at. */
|
|
837
|
+
type HostToolDefinition = {
|
|
838
|
+
tool: Tool$1;
|
|
839
|
+
/**
|
|
840
|
+
* Where this tool may run. `authoritative` tools execute inline in the
|
|
841
|
+
* gateway and MUST declare `execute`; `sandboxed` ones must NOT, because the
|
|
842
|
+
* loop hands them to the {@link ToolExecutor} seam instead — which is what
|
|
843
|
+
* makes them bridgeable to an untrusted tab.
|
|
844
|
+
*/
|
|
845
|
+
trust: ToolTrust;
|
|
846
|
+
};
|
|
847
|
+
/**
|
|
848
|
+
* Add host-supplied tools to a context at an explicit trust level.
|
|
849
|
+
*
|
|
850
|
+
* The trust level is the whole point of the seam: {@link withMcpTools} can only
|
|
851
|
+
* produce authoritative tools, so a host tool that *should* be sandboxed — and
|
|
852
|
+
* therefore executable in the browser tab that asked for it — had no way to be
|
|
853
|
+
* expressed at all. Here the host says which it is, and the contradictions are
|
|
854
|
+
* refused rather than silently resolved:
|
|
855
|
+
*
|
|
856
|
+
* - a `sandboxed` tool carrying `execute` would run inline in this process with
|
|
857
|
+
* the gateway's ambient authority, which is exactly what sandboxing it was
|
|
858
|
+
* meant to prevent;
|
|
859
|
+
* - an `authoritative` tool *without* `execute` would park the turn on a call no
|
|
860
|
+
* executor claims, and the session would simply stop.
|
|
861
|
+
*/
|
|
862
|
+
declare function withHostTools(context: ToolContext, hostTools: Record<string, HostToolDefinition>, /** What to call these in error messages ('MCP tool', 'host tool'). */
|
|
863
|
+
|
|
864
|
+
kind?: string): ToolContext;
|
|
815
865
|
//#endregion
|
|
816
866
|
//#region src/engine.d.ts
|
|
817
867
|
type EngineSessionOptions = {
|
|
@@ -822,7 +872,7 @@ type EngineSessionOptions = {
|
|
|
822
872
|
* this so core never imports a provider SDK and never reads credentials —
|
|
823
873
|
* they come from the operator's environment, exactly like the Claude chain.
|
|
824
874
|
*/
|
|
825
|
-
resolveModel: (profile: ProfileInfo | undefined, config: AiSdkRunnerConfig) => LanguageModel;
|
|
875
|
+
resolveModel: (profile: ProfileInfo | undefined, config: AiSdkRunnerConfig) => LanguageModel$1;
|
|
826
876
|
/**
|
|
827
877
|
* Executor for sandboxed tools. Return the browser bridge when a client is
|
|
828
878
|
* attached and the server sandbox otherwise; the seam makes them
|
|
@@ -849,10 +899,38 @@ type EngineSessionOptions = {
|
|
|
849
899
|
* Default true — set false to withhold it. */
|
|
850
900
|
deliverFiles?: boolean;
|
|
851
901
|
};
|
|
902
|
+
/**
|
|
903
|
+
* A live MCP connection from {@link connectMcpTools} — the preferred way to
|
|
904
|
+
* hand MCP to a session, and the only one that can fail loudly.
|
|
905
|
+
*
|
|
906
|
+
* With this set, the session knows *which servers connected*, so two things
|
|
907
|
+
* that were previously silent become impossible: a profile naming a server
|
|
908
|
+
* that never connected refuses to build (see {@link mcpTools} for what that
|
|
909
|
+
* used to look like), and `runner.mcpServers()` answers `GET
|
|
910
|
+
* /sessions/:id/mcp` with the real per-server status instead of 501.
|
|
911
|
+
*/
|
|
912
|
+
mcp?: McpConnection;
|
|
852
913
|
/** Authoritative tools that run server-side with server credentials (MCP).
|
|
853
914
|
* Never bridged to a client. Namespaced `<server>__<tool>` by
|
|
854
|
-
* {@link connectMcpTools}, which is how a profile grants servers by name.
|
|
855
|
-
|
|
915
|
+
* {@link connectMcpTools}, which is how a profile grants servers by name.
|
|
916
|
+
*
|
|
917
|
+
* The bare tool set, for a host assembling one itself. Prefer {@link mcp}:
|
|
918
|
+
* a tool set alone cannot distinguish "this server connected and exposes no
|
|
919
|
+
* tools" from "this server never connected", so the check here has to be the
|
|
920
|
+
* cruder one — a declared server contributing no tools is refused. */
|
|
921
|
+
mcpTools?: ToolSet$1;
|
|
922
|
+
/**
|
|
923
|
+
* Extra host tools, each at an explicit trust level (see
|
|
924
|
+
* {@link withHostTools}). This is the seam for a tool that is neither one of
|
|
925
|
+
* the built-in capabilities nor MCP — including a **sandboxed** one, which
|
|
926
|
+
* `mcpTools` cannot express because everything in it is authoritative by
|
|
927
|
+
* construction.
|
|
928
|
+
*
|
|
929
|
+
* A sandboxed tool here rides the same {@link ToolExecutor} seam
|
|
930
|
+
* `eval_script` does, so it executes wherever `selectExecutor` points — an
|
|
931
|
+
* in-process QuickJS guest, or the browser tab that asked the question.
|
|
932
|
+
*/
|
|
933
|
+
tools?: Record<string, HostToolDefinition>;
|
|
856
934
|
/** Extra instructions prepended to the session's system prompt. Overridden by
|
|
857
935
|
* the profile's `session.instructions` when it declares one. */
|
|
858
936
|
instructions?: string;
|
|
@@ -860,6 +938,26 @@ type EngineSessionOptions = {
|
|
|
860
938
|
timeoutMs?: number;
|
|
861
939
|
memoryLimitBytes?: number;
|
|
862
940
|
};
|
|
941
|
+
/**
|
|
942
|
+
* Initial scratch-filesystem contents for a **new** session, and the safe way
|
|
943
|
+
* to seed one: it is ignored outright when `config.restore` is set, because a
|
|
944
|
+
* rehydrated session brings back the files its parked turn already wrote and
|
|
945
|
+
* seeding over them destroys exactly the work that was preserved.
|
|
946
|
+
*
|
|
947
|
+
* (Hand-building `config.vfs` still works and still wins — but then the
|
|
948
|
+
* `restore ? undefined : createVfs(...)` dance is yours to get right.)
|
|
949
|
+
*/
|
|
950
|
+
seedVfs?: Record<string, string>;
|
|
951
|
+
/**
|
|
952
|
+
* Build the session under this id rather than minting one.
|
|
953
|
+
*
|
|
954
|
+
* Forward the server's `EngineRunnerContext.id` here, always: it is set when
|
|
955
|
+
* the gateway is rehydrating a session across a restart, and a runner that
|
|
956
|
+
* ignores it comes back as a *different* session — the rebuild is refused,
|
|
957
|
+
* and every client's route and unread watermark is stranded. Ignored when
|
|
958
|
+
* `config.restore` is present, which carries its own id.
|
|
959
|
+
*/
|
|
960
|
+
id?: string;
|
|
863
961
|
};
|
|
864
962
|
/**
|
|
865
963
|
* Assemble a model-agnostic session: provider model, capability-scoped tools,
|
|
@@ -875,7 +973,14 @@ type EngineSessionOptions = {
|
|
|
875
973
|
*/
|
|
876
974
|
declare function createEngineSession(options: EngineSessionOptions): AiSdkRunner;
|
|
877
975
|
type McpConnection = {
|
|
878
|
-
tools: ToolSet;
|
|
976
|
+
tools: ToolSet$1;
|
|
977
|
+
/**
|
|
978
|
+
* One entry per configured server, connected or not — the truth a session was
|
|
979
|
+
* assembled against. Handed to {@link createEngineSession} as `mcp`, it is
|
|
980
|
+
* what `GET /sessions/:id/mcp` answers with and what makes a half-connected
|
|
981
|
+
* session refuse to build rather than run degraded.
|
|
982
|
+
*/
|
|
983
|
+
servers: McpServerStatusInfo[];
|
|
879
984
|
close: () => Promise<void>;
|
|
880
985
|
};
|
|
881
986
|
/**
|
|
@@ -884,14 +989,29 @@ type McpConnection = {
|
|
|
884
989
|
* Server-side only, with server credentials: these tools are authoritative and
|
|
885
990
|
* must never be bridged to a browser. `@ai-sdk/mcp` is imported lazily and is an
|
|
886
991
|
* optional dependency — an operator who wires no MCP servers never needs it.
|
|
992
|
+
*
|
|
993
|
+
* **A stateless MCP server must answer `GET` with 405.** The client opens the
|
|
994
|
+
* SSE stream with a `GET` before it sends anything, and a POST-only server
|
|
995
|
+
* mounted under a framework's default 404 makes the whole connect fail with an
|
|
996
|
+
* error that names neither the method nor the route. This is the single most
|
|
997
|
+
* common way an otherwise-correct MCP mount fails.
|
|
887
998
|
*/
|
|
888
|
-
declare function connectMcpTools(servers: Record<string, McpServerConfigWire>,
|
|
889
|
-
/** `onError` may fire more than once for a single server: transport-level
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
options?: {
|
|
999
|
+
declare function connectMcpTools(servers: Record<string, McpServerConfigWire>, options?: {
|
|
1000
|
+
/** `onError` may fire more than once for a single server: transport-level
|
|
1001
|
+
* failures surface through the client's own uncaught-error channel as well as
|
|
1002
|
+
* the connect failure. Treat it as a report, not a count. */
|
|
894
1003
|
onError?: (name: string, error: unknown) => void;
|
|
1004
|
+
/**
|
|
1005
|
+
* Reject if any server fails to connect, after closing the ones that did.
|
|
1006
|
+
*
|
|
1007
|
+
* Off by default, which is right for an operator's fleet — one unreachable
|
|
1008
|
+
* server should not take a whole gateway's sessions down. Turn it **on**
|
|
1009
|
+
* when the servers are the app's own: an embedder who mounts one wiki server
|
|
1010
|
+
* and gets a session without it has a session that cannot do its job, and
|
|
1011
|
+
* finding that out at connect time beats finding it out from a transcript
|
|
1012
|
+
* where the agent apologises.
|
|
1013
|
+
*/
|
|
1014
|
+
required?: boolean;
|
|
895
1015
|
}): Promise<McpConnection>;
|
|
896
1016
|
//#endregion
|
|
897
1017
|
//#region src/input-queue.d.ts
|
|
@@ -969,6 +1089,15 @@ type EngineRunnerRequest = {
|
|
|
969
1089
|
/** Rebuild a parked session instead of starting fresh. Engines that cannot
|
|
970
1090
|
* rehydrate throw. */
|
|
971
1091
|
restore?: RunnerSnapshot;
|
|
1092
|
+
/**
|
|
1093
|
+
* Adopt this session id instead of minting one. For rehydrating a session
|
|
1094
|
+
* across a gateway restart: the transcript comes back from the *engine's* own
|
|
1095
|
+
* store via `config.resume`, but every client keys its watermarks, unread
|
|
1096
|
+
* counts and routes on the WorkerDeck id, so that id has to survive too
|
|
1097
|
+
* (`SessionInfo.id` is documented as stable across resumes). A `restore`
|
|
1098
|
+
* carries its own id in the snapshot and does not need this.
|
|
1099
|
+
*/
|
|
1100
|
+
id?: string;
|
|
972
1101
|
};
|
|
973
1102
|
/**
|
|
974
1103
|
* One engine, as the server consumes it: its capability record, its shipped
|
|
@@ -1463,5 +1592,5 @@ declare class JsonRpcStdioConnection {
|
|
|
1463
1592
|
*/
|
|
1464
1593
|
declare const providerAdapter: EngineAdapter;
|
|
1465
1594
|
//#endregion
|
|
1466
|
-
export { AiSdkRunner, type AiSdkRunnerConfig, type AiSdkSessionState, type AppServerConnectFn, type AppServerConnectOptions, type AppServerConnection, type AppServerHistoryTurn, type AppServerItem, type AppServerThreadListResponse, type AppServerThreadSummary, type AppServerTokenUsage, type AppServerTurn, type AppServerUserInput, type AttachmentInput, type AttachmentKind, type BridgeAnswer, BrowserBridgeExecutor, type BrowserBridgeExecutorOptions, CLAUDE_CATALOG, CODEX_CATALOG, type ClaudeAuthProbe, type ClaudeAuthStatus, CodexRunner, type CodexRunnerConfig, type DeferredDispatch, DeferredExecutor, type DeferredExecutorOptions, type EngineAdapter, type EngineAvailability, type EngineRunnerRequest, type EngineSessionOptions, type HistoryFn, type HostFetch, InputQueue, JsonRpcError, JsonRpcStdioConnection, type McpConnection, type ModelCatalog, type ParkedExecution, type PendingEntry, type PendingKind, type PendingOutcome, PendingRequestRegistry, type PendingToolCall, type PermissionDecision, type QueryFn, QuickJsExecutor, type QuickJsExecutorOptions, type RegisterOptions, type Runner, type RunnerSnapshot, SUPPORTED_ATTACHMENT_TYPES, type SessionEventListener, SessionRunner, type SessionRunnerConfig, type SettledBy, type ToolCallOutput, type ToolContext, type ToolContextOptions, type ToolDefinition, type ToolExecutionCall, type ToolExecutionDispatch, type ToolExecutionResult, type ToolExecutor, type ToolTrust, type WebFetchDigest, type WebFetchFn, type WebFetchOptions, type WebFetchResult, attachmentContentBlocks, attachmentKind, attachmentRef, checkClaudeAuth, claudeAdapter, codexAdapter, connectAppServer, connectMcpTools, createEngineSession, createToolContext, createWebFetch, getEngineAdapter, htmlToMarkdown, isHostAllowed, isPrivateAddress, listCodexSessions, mcpStatusInfo, modelOptionsFromSdk, normalizeMediaType, normalizeSdkMessage, providerAdapter, resolveBundledClaudeExecutable, resolveBundledCodexExecutable, toApiMessage, toExecutionResult, withMcpTools };
|
|
1595
|
+
export { AiSdkRunner, type AiSdkRunnerConfig, type AiSdkSessionState, type AppServerConnectFn, type AppServerConnectOptions, type AppServerConnection, type AppServerHistoryTurn, type AppServerItem, type AppServerThreadListResponse, type AppServerThreadSummary, type AppServerTokenUsage, type AppServerTurn, type AppServerUserInput, type AttachmentInput, type AttachmentKind, type BridgeAnswer, BrowserBridgeExecutor, type BrowserBridgeExecutorOptions, CLAUDE_CATALOG, CODEX_CATALOG, type ClaudeAuthProbe, type ClaudeAuthStatus, CodexRunner, type CodexRunnerConfig, type DeferredDispatch, DeferredExecutor, type DeferredExecutorOptions, type EngineAdapter, type EngineAvailability, type EngineRunnerRequest, type EngineSessionOptions, type HistoryFn, type HostFetch, type HostToolDefinition, InputQueue, JsonRpcError, JsonRpcStdioConnection, type LanguageModel, type McpConnection, type ModelCatalog, type ParkedExecution, type PendingEntry, type PendingKind, type PendingOutcome, PendingRequestRegistry, type PendingToolCall, type PermissionDecision, type QueryFn, QuickJsExecutor, type QuickJsExecutorOptions, type RegisterOptions, type Runner, type RunnerSnapshot, SUPPORTED_ATTACHMENT_TYPES, type SessionEventListener, SessionRunner, type SessionRunnerConfig, type SettledBy, type Tool, type ToolCallOutput, type ToolContext, type ToolContextOptions, type ToolDefinition, type ToolExecutionCall, type ToolExecutionDispatch, type ToolExecutionResult, type ToolExecutor, type ToolSet, type ToolTrust, type WebFetchDigest, type WebFetchFn, type WebFetchOptions, type WebFetchResult, attachmentContentBlocks, attachmentKind, attachmentRef, checkClaudeAuth, claudeAdapter, codexAdapter, connectAppServer, connectMcpTools, createEngineSession, createToolContext, createWebFetch, getEngineAdapter, htmlToMarkdown, isHostAllowed, isPrivateAddress, listCodexSessions, mcpStatusInfo, modelOptionsFromSdk, normalizeMediaType, normalizeSdkMessage, providerAdapter, resolveBundledClaudeExecutable, resolveBundledCodexExecutable, toApiMessage, toExecutionResult, withHostTools, withMcpTools };
|
|
1467
1596
|
//# sourceMappingURL=index.d.mts.map
|