zidane 5.12.7 → 5.12.8
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 +7 -1
- package/dist/chat.d.ts +1 -1
- package/dist/contexts/e2b.d.ts +19 -0
- package/dist/contexts/e2b.d.ts.map +1 -1
- package/dist/contexts/e2b.js +26 -3
- package/dist/contexts/e2b.js.map +1 -1
- package/dist/{transcript-anchors-JbFJuSDh.d.ts → transcript-anchors-DDjscta9.d.ts} +2 -1
- package/dist/transcript-anchors-DDjscta9.d.ts.map +1 -0
- package/dist/tui.d.ts +1 -1
- package/docs/EXECUTION_CONTEXT.md +47 -5
- package/package.json +2 -2
- package/dist/transcript-anchors-JbFJuSDh.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -682,7 +682,7 @@ createSandboxContext(myProvider) // implement SandboxProvider
|
|
|
682
682
|
|
|
683
683
|
A ready-made `SandboxProvider` backed by [E2B](https://e2b.dev) ships behind its
|
|
684
684
|
own subpath, so the `e2b` SDK only enters your bundle when you opt in
|
|
685
|
-
(`bun add e2b`).
|
|
685
|
+
(`bun add e2b`, peer `e2b@^2`).
|
|
686
686
|
|
|
687
687
|
```ts
|
|
688
688
|
import { createSandboxContext } from 'zidane'
|
|
@@ -694,6 +694,8 @@ const execution = createSandboxContext(createE2BProvider({
|
|
|
694
694
|
apiKey: process.env.E2B_API_KEY,
|
|
695
695
|
domain: 'e2b.my-company.internal', // omit for E2B's hosted API
|
|
696
696
|
template: 'base',
|
|
697
|
+
// onDestroy: 'kill' (default) | 'pause' | 'leave'
|
|
698
|
+
// 'pause' preserves state; reconnect later with sandboxId: '<id>'
|
|
697
699
|
}))
|
|
698
700
|
```
|
|
699
701
|
|
|
@@ -702,6 +704,10 @@ From the CLI, `--context e2b` wires the same provider (reads `E2B_API_KEY` /
|
|
|
702
704
|
|
|
703
705
|
```bash
|
|
704
706
|
bun start --prompt "..." --context e2b --cwd /home/user/project
|
|
707
|
+
|
|
708
|
+
# Pause the sandbox at the end of the run so you can reconnect to it later:
|
|
709
|
+
bun start --prompt "..." --context e2b --sandbox-on-destroy pause
|
|
710
|
+
# Next session: bun start --prompt "..." --context e2b --sandbox <id>
|
|
705
711
|
```
|
|
706
712
|
|
|
707
713
|
## State Management
|
package/dist/chat.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { F as Session, N as SkillsConfig, cr as ContextBreakdownOptions, dn as McpToolSchema, dr as ContextExactCounts, fr as ContextItem, gr as buildContextBreakdown, hr as ContextUsageSplit, k as SkillConfig, kn as SessionTurn, ln as McpServerConfig, lr as ContextCategory, mr as ContextSnapshot, mt as Provider, pr as ContextMcpGroup, r as AgentHooks, sr as ContextBreakdown, ur as ContextCategoryId } from "./agent-CZswyE11.js";
|
|
2
2
|
import { K as McpCredentialEntry, q as McpCredentialStore, t as Preset } from "./index-Dojm6Hzn.js";
|
|
3
3
|
import { _ as SourcedScanPath } from "./index-Dkd2nVBs.js";
|
|
4
|
-
import { $ as useInteractionsQueue, $t as parseBindingSpec, A as InteractionsProvider, At as marginTopFor, B as QuestionPayload, Bt as KEYBINDING_DEF_BY_ACTION, C as ASK_USER_TOOL, Ct as TuiState, D as InteractionRequest, Dt as lastContextSizeFromTurns, E as CreateInteractionToolsOptions, Et as eventsFromTurns, F as PlanRequest, Ft as toolCallPreview, G as TextQuestion, Gt as KeyBindings, H as QuestionResponse, Ht as KeyAction, I as PlanResponse, It as toolResultText, J as isInteractionTool, Jt as formatBindingForDisplay, K as buildResumedToolResultsTurn, Kt as ParsedBinding, L as PlanStep, Lt as updateToolEventOutcomes, M as PendingInteractionEntry, Mt as stripSpawnTokensLine, N as PlanDecision, Nt as sumRunCosts, O as InteractionResponse, Ot as listSessionMeta, P as PlanPayload, Pt as titleFromTurns, Q as useInteractionsActions, Qt as mergeKeybindings, R as Question, Rt as DEFAULT_KEYBINDINGS, S as splitMarkdownCodeBlocks, St as StateStoreApi, T as ConfirmQuestion, Tt as deriveSessionTitle, U as QuestionType, Ut as KeyBindingDef, V as QuestionRequest, Vt as KEYBINDING_KEY_COL_WIDTH, W as SelectQuestion, Wt as KeyBindingSection, X as pendingInteractionsFromTurns, Xt as keybindingsPath, Y as makeRequestInteraction, Yt as groupBindings, Z as serializeInteractionResponse, Zt as matchesBinding, _ as SessionExportTarget, _n as PLAN_AGENT, _t as ResolveStorageDirsOptions, a as ChipColorMap, an as Hint, at as DiscoveryResult, b as writeSessionExport, bn as singleAgentRegistry, bt as StorageSlot, c as SyntaxTokenStyle, cn as truncateTrailing, ct as discoverProjectMcps, d as ThemeSelect, dn as AgentRegistry, dt as ChatOptions, en as readKeybindings, et as EnabledAllowlistKey, f as ThemeSurfaces, fn as BUILD_AGENT, ft as ProviderRegistry, g as SessionExportFormat, gn as DEFAULT_PERSIST_EXCLUDE_TOOLS, gt as resolveStoragePaths, h as SessionExportAnchor, hn as DEFAULT_BUDGET_EXCLUDE_TOOLS, ht as resolveConfig, i as ChipColor, in as EMPTY_HINTS, it as DiscoveryError, j as PRESENT_PLAN_TOOL, jt as saveState, k as InteractionsActions, kt as loadState, l as Theme, ln as AgentAccent, lt as parseMcpsFile, m as resolveTheme, mn as DEFAULT_AGENT_ID, mt as ResolvedPaths, n as computeTurnAnchors, nn as CompletionState, nt as useEnabledToggleSet, o as DEFAULT_THEME, on as clipHintsToWidth, ot as buildMcpServers, p as resolveChipColor, pn as BUILTIN_AGENTS, pt as ResolvedConfig, q as createInteractionTools, qt as ensureKeybindingsFile, r as BUILTIN_THEMES, rn as useCompletion, rt as DiscoveredMcp, s as SyntaxStyles, sn as hintsLength, st as defaultMcpsConfigPaths, t as TranscriptItem, tn as stripJsonComments, tt as EnabledToggleSet, u as ThemeColors, un as AgentProfile, ut as AutoUpdateConfig, v as renderSession, vn as accentColor, vt as StorageDirs, w as AnswerValue, wt as createStateStore, x as MarkdownSegment, xt as resolveStorageDirs, y as resolveSessionExportTarget, yn as resolveAgentId, yt as StorageMode, z as QuestionChoice, zt as KEYBINDING_DEFS } from "./transcript-anchors-
|
|
4
|
+
import { $ as useInteractionsQueue, $t as parseBindingSpec, A as InteractionsProvider, At as marginTopFor, B as QuestionPayload, Bt as KEYBINDING_DEF_BY_ACTION, C as ASK_USER_TOOL, Ct as TuiState, D as InteractionRequest, Dt as lastContextSizeFromTurns, E as CreateInteractionToolsOptions, Et as eventsFromTurns, F as PlanRequest, Ft as toolCallPreview, G as TextQuestion, Gt as KeyBindings, H as QuestionResponse, Ht as KeyAction, I as PlanResponse, It as toolResultText, J as isInteractionTool, Jt as formatBindingForDisplay, K as buildResumedToolResultsTurn, Kt as ParsedBinding, L as PlanStep, Lt as updateToolEventOutcomes, M as PendingInteractionEntry, Mt as stripSpawnTokensLine, N as PlanDecision, Nt as sumRunCosts, O as InteractionResponse, Ot as listSessionMeta, P as PlanPayload, Pt as titleFromTurns, Q as useInteractionsActions, Qt as mergeKeybindings, R as Question, Rt as DEFAULT_KEYBINDINGS, S as splitMarkdownCodeBlocks, St as StateStoreApi, T as ConfirmQuestion, Tt as deriveSessionTitle, U as QuestionType, Ut as KeyBindingDef, V as QuestionRequest, Vt as KEYBINDING_KEY_COL_WIDTH, W as SelectQuestion, Wt as KeyBindingSection, X as pendingInteractionsFromTurns, Xt as keybindingsPath, Y as makeRequestInteraction, Yt as groupBindings, Z as serializeInteractionResponse, Zt as matchesBinding, _ as SessionExportTarget, _n as PLAN_AGENT, _t as ResolveStorageDirsOptions, a as ChipColorMap, an as Hint, at as DiscoveryResult, b as writeSessionExport, bn as singleAgentRegistry, bt as StorageSlot, c as SyntaxTokenStyle, cn as truncateTrailing, ct as discoverProjectMcps, d as ThemeSelect, dn as AgentRegistry, dt as ChatOptions, en as readKeybindings, et as EnabledAllowlistKey, f as ThemeSurfaces, fn as BUILD_AGENT, ft as ProviderRegistry, g as SessionExportFormat, gn as DEFAULT_PERSIST_EXCLUDE_TOOLS, gt as resolveStoragePaths, h as SessionExportAnchor, hn as DEFAULT_BUDGET_EXCLUDE_TOOLS, ht as resolveConfig, i as ChipColor, in as EMPTY_HINTS, it as DiscoveryError, j as PRESENT_PLAN_TOOL, jt as saveState, k as InteractionsActions, kt as loadState, l as Theme, ln as AgentAccent, lt as parseMcpsFile, m as resolveTheme, mn as DEFAULT_AGENT_ID, mt as ResolvedPaths, n as computeTurnAnchors, nn as CompletionState, nt as useEnabledToggleSet, o as DEFAULT_THEME, on as clipHintsToWidth, ot as buildMcpServers, p as resolveChipColor, pn as BUILTIN_AGENTS, pt as ResolvedConfig, q as createInteractionTools, qt as ensureKeybindingsFile, r as BUILTIN_THEMES, rn as useCompletion, rt as DiscoveredMcp, s as SyntaxStyles, sn as hintsLength, st as defaultMcpsConfigPaths, t as TranscriptItem, tn as stripJsonComments, tt as EnabledToggleSet, u as ThemeColors, un as AgentProfile, ut as AutoUpdateConfig, v as renderSession, vn as accentColor, vt as StorageDirs, w as AnswerValue, wt as createStateStore, x as MarkdownSegment, xt as resolveStorageDirs, y as resolveSessionExportTarget, yn as resolveAgentId, yt as StorageMode, z as QuestionChoice, zt as KEYBINDING_DEFS } from "./transcript-anchors-DDjscta9.js";
|
|
5
5
|
import { $ as anthropicDescriptor, A as SessionMeta, B as collectReferences, C as EditHunk, D as Owner, E as EditPayload, F as CompletionContext, G as ProviderKey, H as mergeReferences, I as CompletionItem, J as CustomField, K as detectAuth, L as CompletionProvider, M as StreamEvent, N as ToolCallDisplay, O as Picked, P as ActiveTrigger, Q as ProviderDescriptor, R as CompletionReference, S as EditDiffDisplay, T as EditOutcomeKind, U as AuthMethod, V as findActiveTrigger, W as ProviderAuth, X as ModelOption, Y as ModelInfo, Z as OUTPUT_RESERVE_TOKENS, _ as isEditErrorResult, a as formatToolCall, at as getModelInfo, b as selectableTurnIds, c as splitPromptSegments, ct as modelSupportsReasoning, d as RequestApproval, dt as openrouterDescriptor, et as cerebrasDescriptor, f as SafeModeActions, ft as piIdOf, h as useSafeModeQueue, i as displayNameFor, it as getContextWindow, j as Settings, k as Screen, l as ApprovalDecision, lt as modelsForDescriptor, m as useSafeModeActions, n as ToolDisplayMeta, nt as effectiveContextWindow, o as PromptSegment, ot as localDescriptor, p as SafeModeProvider, pt as restoreModelOptions, q as BUILTIN_PROVIDERS, r as ToolFormatLine, rt as enabledModelOptions, s as PromptSegmentRef, st as modelOptionsFor, t as TOOL_DISPLAY, tt as credKeyOf, u as ApprovalRequest, ut as openaiDescriptor, v as isTurnHighlighted, w as EditOutcome, x as turnSelectionOwnership, y as isVisible, z as applyInsert } from "./tool-formatters-CGCa6rih.js";
|
|
6
6
|
import { $ as uniqueFilesFromReferences, A as buildUnifiedDiff, B as buildEditOutcomesAnnotation, C as EditSummary, D as PreviewResult, E as InlineSegment, F as previewEditPayload, G as rewriteMultiEditHeader, H as mergeApprovalAndBodyOutcomes, I as splitLines, J as SKILLS_TRIGGER, K as stripEditOutcomesAnnotation, L as summarizeEditPayload, M as computeLineDiff, N as extractEditPayload, O as applyEditPayload, P as filetypeFromPath, Q as createFilesCompletionProvider, R as tokenize, S as EditHunkSummary, T as InlineDiff, U as parseEditOutcomesFromResult, V as maskToOutcomeKinds, W as resolveApprovalForPayload, X as uniqueSkillNamesFromReferences, Y as createSkillsCompletionProvider, Z as FILES_TRIGGER, _ as formatTaskSummary, a as finalizeStreamingMarkdown, b as DiffLine, c as CatalogEntry, d as indexOfEntry, et as FileEntry, f as ageString, g as formatTaskStatus, h as formatDuration, i as turnAsText, it as buildLinearRamp, j as computeInlineDiff, k as buildContextualDiff, l as buildModelCatalog, m as fmtTokens, n as deleteTurnSafely, nt as listProjectFiles, o as finalizeStreamingMarkdownForOwner, p as compactPath, q as summarizeOutcomes, r as truncateTurnsAt, rt as blendHsl, s as turnContextSize, t as countNeighbors, tt as ListProjectFilesOptions, u as filterModelCatalog, v as previewLine, w as HunkResolution, x as DiffOp, y as shortId, z as ResolvedApproval } from "./turn-operations-BHTcPYj6.js";
|
|
7
7
|
import { Hookable } from "hookable";
|
package/dist/contexts/e2b.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ interface E2BSandbox {
|
|
|
25
25
|
list: (path: string) => Promise<E2BEntry[]>;
|
|
26
26
|
};
|
|
27
27
|
kill: () => Promise<unknown>;
|
|
28
|
+
pause?: () => Promise<boolean>;
|
|
29
|
+
betaPause?: () => Promise<boolean>;
|
|
28
30
|
}
|
|
29
31
|
interface E2BProviderOptions {
|
|
30
32
|
/** E2B API key. Falls back to the `E2B_API_KEY` env var when omitted. */
|
|
@@ -92,6 +94,23 @@ interface E2BProviderOptions {
|
|
|
92
94
|
name: string;
|
|
93
95
|
content: string;
|
|
94
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* What to do with an owned sandbox when `destroy` is called:
|
|
99
|
+
*
|
|
100
|
+
* - `'kill'` (default) — call `sandbox.kill()`. The sandbox is deleted and
|
|
101
|
+
* its state is gone.
|
|
102
|
+
* - `'pause'` — call `sandbox.pause()` (falling back to the older
|
|
103
|
+
* `betaPause()` on `e2b` 2.0–2.26). The sandbox's filesystem and process
|
|
104
|
+
* state are preserved; reconnect later with the `sandboxId` option (E2B's
|
|
105
|
+
* `Sandbox.connect` auto-resumes a paused sandbox).
|
|
106
|
+
* - `'leave'` — drop the local handle without making any API call. The
|
|
107
|
+
* sandbox keeps running until E2B's own timeout fires.
|
|
108
|
+
*
|
|
109
|
+
* Has no effect on sandboxes the provider only connected to (the `sandboxId`
|
|
110
|
+
* option) — those are always left untouched on destroy since the caller owns
|
|
111
|
+
* their lifecycle.
|
|
112
|
+
*/
|
|
113
|
+
onDestroy?: 'kill' | 'pause' | 'leave';
|
|
95
114
|
}
|
|
96
115
|
/**
|
|
97
116
|
* Upload a setup ("pregame") script into a ready sandbox and execute it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e2b.d.ts","names":[],"sources":["../../src/contexts/e2b.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"e2b.d.ts","names":[],"sources":["../../src/contexts/e2b.ts"],"mappings":";;;;UAoDU,gBAAA;EACR,MAA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AA,EACT,MAAA,EAAQ,MAAA,EACR,IAAA,EAAM,mBAAA,GACL,OAAA;;;;;;;;iBAmCa,kBAAA,CACd,gBAAA,sBACA,cAAA,sBACA,GAAA,GAAK,MAAM;;;;;;;iBAWG,aAAA,CACd,SAAA,EAAW,MAAA,8BACX,WAAA,EAAa,MAAA,+BACZ,MAAA;;;;;;;;iBAgBa,iBAAA,CAAkB,OAAA,GAAS,kBAAA,GAA0B,eAAe"}
|
package/dist/contexts/e2b.js
CHANGED
|
@@ -145,6 +145,27 @@ function createE2BProvider(options = {}) {
|
|
|
145
145
|
if (!entry) throw new Error(`E2B sandbox ${sandboxId} is not tracked by this provider`);
|
|
146
146
|
return entry;
|
|
147
147
|
}
|
|
148
|
+
async function killOwnedSandbox(sandbox) {
|
|
149
|
+
try {
|
|
150
|
+
await sandbox.kill();
|
|
151
|
+
} catch {}
|
|
152
|
+
}
|
|
153
|
+
async function pauseOwnedSandbox(sandbox) {
|
|
154
|
+
try {
|
|
155
|
+
if (sandbox.pause) await sandbox.pause();
|
|
156
|
+
else if (sandbox.betaPause) await sandbox.betaPause();
|
|
157
|
+
else {
|
|
158
|
+
logger.error("cannot pause E2B sandbox: this e2b SDK exposes neither pause() nor betaPause() (expected e2b@^2); leaving it to time out", { sandboxId: sandbox.sandboxId });
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
logger.info("paused E2B sandbox; reconnect later via the sandboxId option (CLI: --sandbox)", { sandboxId: sandbox.sandboxId });
|
|
162
|
+
} catch (err) {
|
|
163
|
+
logger.error("failed to pause E2B sandbox; it will run until its timeout", {
|
|
164
|
+
sandboxId: sandbox.sandboxId,
|
|
165
|
+
error: err instanceof Error ? err.message : String(err)
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
148
169
|
return {
|
|
149
170
|
name: "e2b",
|
|
150
171
|
async spawn(config) {
|
|
@@ -248,9 +269,11 @@ function createE2BProvider(options = {}) {
|
|
|
248
269
|
async destroy(sandboxId) {
|
|
249
270
|
const entry = live.get(sandboxId);
|
|
250
271
|
if (!entry) return;
|
|
251
|
-
if (entry.owned)
|
|
252
|
-
|
|
253
|
-
|
|
272
|
+
if (entry.owned) {
|
|
273
|
+
const action = options.onDestroy ?? "kill";
|
|
274
|
+
if (action === "pause") await pauseOwnedSandbox(entry.sandbox);
|
|
275
|
+
else if (action === "kill") await killOwnedSandbox(entry.sandbox);
|
|
276
|
+
}
|
|
254
277
|
live.delete(sandboxId);
|
|
255
278
|
}
|
|
256
279
|
};
|
package/dist/contexts/e2b.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e2b.js","names":[],"sources":["../../src/contexts/e2b.ts"],"sourcesContent":["/**\n * E2B sandbox provider.\n *\n * Implements {@link SandboxProvider} on top of E2B's firecracker-backed\n * micro-VMs. Pair it with {@link createSandboxContext} to run an agent's\n * shell + filesystem tools inside an ephemeral E2B sandbox:\n *\n * ```ts\n * import { createSandboxContext } from 'zidane/contexts'\n * import { createE2BProvider } from 'zidane/contexts/e2b'\n *\n * const execution = createSandboxContext(createE2BProvider())\n * ```\n *\n * ## Pointing at your own E2B\n *\n * The two knobs that select *which* E2B you talk to are `apiKey` and\n * `domain`. Self-hosted / on-prem E2B clusters expose a custom domain; pass\n * it here (or via the `E2B_DOMAIN` env var) and the SDK routes every call to\n * your cluster instead of E2B's hosted API. Precedence, highest first:\n *\n * 1. Per-spawn `SpawnConfig.sandbox` fields (`apiKey`, `domain`, `template`)\n * 2. {@link E2BProviderOptions} passed to this factory\n * 3. `E2B_API_KEY` / `E2B_DOMAIN` env vars (read by the SDK itself), and\n * `E2B_TEMPLATE` (read by this provider — the SDK does not read it)\n *\n * The default `base` template does not exist on self-hosted clusters, so\n * picking the right template matters: an invalid template still returns a\n * sandbox id from the control plane, but its envd never boots and every\n * `exec`/file op then hangs until it times out. Set `E2B_TEMPLATE` (or pass\n * `template`) to a template that actually exists on your cluster.\n *\n * Requires `e2b` as an optional peer dependency:\n * `bun add e2b`.\n */\n\nimport type { Logger } from '../logger'\nimport type { SandboxProvider } from './sandbox'\nimport type { ExecResult, SpawnConfig } from './types'\nimport { consoleSink, createLogger } from '../logger'\n\n// ---------------------------------------------------------------------------\n// Minimal structural views of the `e2b` SDK surface we touch. Declared locally\n// (rather than imported) so the package typechecks without the optional peer\n// dependency installed — mirroring how `docker.ts` keeps `dockerode` at arm's\n// length. The real SDK satisfies these shapes. Every member used here\n// (`Sandbox.create`/`connect`/`kill`/`sandboxId`, `commands.run` with\n// `cwd`/`envs`/`timeoutMs`, `files.read`/`write`/`list`) exists as of\n// `e2b@1.0.0`, which is why the peer dependency floor is `>=1.0.0`.\n// ---------------------------------------------------------------------------\n\ninterface E2BCommandResult {\n stdout: string\n stderr: string\n exitCode: number\n}\n\ninterface E2BEntry {\n name: string\n}\n\ninterface E2BSandbox {\n sandboxId: string\n commands: {\n run: (cmd: string, opts?: { cwd?: string, envs?: Record<string, string>, timeoutMs?: number }) => Promise<E2BCommandResult>\n }\n files: {\n read: (path: string) => Promise<string>\n write: (path: string, data: string) => Promise<unknown>\n list: (path: string) => Promise<E2BEntry[]>\n }\n kill: () => Promise<unknown>\n}\n\ninterface E2BCreateOptions {\n apiKey?: string\n domain?: string\n timeoutMs?: number\n envs?: Record<string, string>\n metadata?: Record<string, string>\n}\n\ninterface E2BConnectOptions {\n apiKey?: string\n domain?: string\n timeoutMs?: number\n}\n\ninterface E2BSandboxStatic {\n create: (templateOrOpts?: string | E2BCreateOptions, opts?: E2BCreateOptions) => Promise<E2BSandbox>\n connect: (sandboxId: string, opts?: E2BConnectOptions) => Promise<E2BSandbox>\n}\n\n// ---------------------------------------------------------------------------\n// Provider options\n// ---------------------------------------------------------------------------\n\nexport interface E2BProviderOptions {\n /** E2B API key. Falls back to the `E2B_API_KEY` env var when omitted. */\n apiKey?: string\n /**\n * E2B API domain. Set this to point at a self-hosted / on-prem cluster\n * (e.g. `e2b.my-company.internal`). Falls back to the `E2B_DOMAIN` env var,\n * then to E2B's hosted default.\n */\n domain?: string\n /**\n * Sandbox template id / name to launch. Falls back to the `E2B_TEMPLATE`\n * env var, then to E2B's hosted `base` template. Note that `base` does not\n * exist on self-hosted clusters — supply a template that does.\n */\n template?: string\n /**\n * Connect to a pre-existing sandbox by id instead of creating a fresh one\n * (E2B's `Sandbox.connect`). When set, `template` is ignored — you're\n * attaching to a sandbox that already exists. The provider treats such a\n * sandbox as externally owned: it is NOT killed on `destroy`, nor torn down\n * if the readiness probe / pregame fails, since the caller manages its\n * lifecycle. Per-spawn `SpawnConfig.sandbox.sandboxId` overrides this.\n */\n sandboxId?: string\n /**\n * Default working directory, applied when a spawn doesn't set its own\n * `SpawnConfig.cwd`. Created on spawn. Defaults to E2B's `/home/user`.\n */\n cwd?: string\n /**\n * Sandbox lifetime in seconds before E2B auto-kills it. Defaults to the\n * SDK default (300s). Per-spawn `SpawnConfig.limits.timeout` overrides this.\n */\n timeoutSeconds?: number\n /**\n * Environment variables baked into every sandbox at create time (passed to\n * E2B's `Sandbox.create({ envs })`), so every command run in the sandbox\n * sees them. Per-spawn `SpawnConfig.env` is merged over these.\n */\n env?: Record<string, string>\n /**\n * Logger for provider-level lifecycle lines (notably the readiness wait).\n * Defaults to a {@link consoleSink}-backed logger so the messages reach\n * stderr without the caller wiring one up.\n */\n logger?: Logger\n /**\n * Total deadline, in seconds, for the post-create readiness probe (see\n * {@link waitForE2BReady}). A freshly-created sandbox can return its id\n * before `envd` accepts commands; `spawn` blocks until a trivial probe\n * succeeds so the first real command never absorbs the cold start. Defaults\n * to `60`. Set to `0` to disable the gate.\n */\n readinessTimeoutSeconds?: number\n /**\n * A setup script to upload and run once the sandbox is ready, before any\n * prompting begins (see {@link runE2BPregame}). `name` is the basename used\n * for the uploaded file; `content` is the script body. The script is run\n * directly so its shebang selects the interpreter. A non-zero exit aborts\n * `spawn` (and tears the sandbox down) — a broken setup must not silently\n * hand back a half-provisioned sandbox.\n */\n pregame?: { name: string, content: string }\n}\n\n/** Per-probe timeout for the readiness `true` command. */\nconst READINESS_PROBE_TIMEOUT_MS = 5000\n/** Pause between readiness probes while the sandbox is still warming up. */\nconst READINESS_BACKOFF_MS = 250\n/**\n * Command timeout for the pregame setup script. E2B's `commands.run` defaults\n * to 60s and offers no true \"unlimited\" — a `timeoutMs` of 0 is a 0ms deadline\n * (instant timeout), not \"off\". Setup scripts (`apt`/`pip` installs, builds)\n * routinely exceed 60s, so we pass a deliberately generous 30-minute ceiling.\n * The sandbox's own lifetime independently bounds anything longer.\n */\nconst PREGAME_TIMEOUT_MS = 30 * 60 * 1000\n\n/**\n * Upload a setup (\"pregame\") script into a ready sandbox and execute it.\n *\n * Writes the script to `/tmp/<name>`, then `chmod +x`'s and runs it directly\n * (so a `#!/bin/bash` / `#!/usr/bin/env python3` shebang chooses the\n * interpreter) in `cwd` with `envs` applied — the same env the sandbox was\n * created with, so the script sees the run's `--env` / `--pass-env`. A\n * generous {@link PREGAME_TIMEOUT_MS} ceiling is used so long `apt`/`pip`\n * installs aren't killed by E2B's 60s command default. A non-zero exit\n * (whether E2B returns it or raises on it) throws, so the caller can tear the\n * sandbox down rather than prompt against a broken environment.\n */\nexport async function runE2BPregame(\n sandbox: E2BSandbox,\n logger: Logger,\n opts: { name: string, content: string, cwd?: string, envs?: Record<string, string> },\n): Promise<void> {\n const path = `/tmp/${opts.name}`\n logger.info('running E2B pregame script', { sandboxId: sandbox.sandboxId, path })\n await sandbox.files.write(path, opts.content)\n\n const quoted = JSON.stringify(path)\n let result: E2BCommandResult\n try {\n result = await sandbox.commands.run(`chmod +x ${quoted} && ${quoted}`, {\n cwd: opts.cwd,\n envs: opts.envs,\n timeoutMs: PREGAME_TIMEOUT_MS,\n })\n }\n catch (err: any) {\n // E2B raises CommandExitError (carrying the captured streams) on a\n // non-zero exit. Surface its output, then fail the spawn.\n const exitCode = typeof err?.exitCode === 'number' ? err.exitCode : 124\n logger.error('E2B pregame script failed', { sandboxId: sandbox.sandboxId, exitCode, stdout: err?.stdout ?? '', stderr: err?.stderr ?? err?.message ?? '' })\n throw new Error(`E2B pregame script ${opts.name} failed with exit code ${exitCode}`)\n }\n\n if (result.exitCode !== 0) {\n logger.error('E2B pregame script failed', { sandboxId: sandbox.sandboxId, exitCode: result.exitCode, stdout: result.stdout, stderr: result.stderr })\n throw new Error(`E2B pregame script ${opts.name} failed with exit code ${result.exitCode}`)\n }\n\n logger.info('E2B pregame ready', { sandboxId: sandbox.sandboxId, stdout: result.stdout, stderr: result.stderr })\n}\n\nexport interface E2BReadinessOptions {\n /** Total deadline in seconds. `<= 0` disables the probe entirely. */\n timeoutSeconds: number\n /**\n * Whether to kill the sandbox if it never becomes ready. Defaults to `true`\n * (we created it, so a dead sandbox is ours to clean up). Pass `false` when\n * attaching to an externally-owned sandbox — failing the probe shouldn't tear\n * down a sandbox the caller is managing.\n */\n killOnTimeout?: boolean\n /** Clock source — injectable so tests can drive the deadline deterministically. */\n now?: () => number\n /** Sleep between probes — injectable so tests can advance the clock without waiting. */\n sleep?: (ms: number) => Promise<void>\n}\n\n/**\n * Block until an E2B sandbox is ready to run commands, or throw if it never\n * becomes ready within the deadline.\n *\n * The E2B control plane can hand back a sandbox id before the sandbox's `envd`\n * is accepting commands; the first real command then absorbs that cold start\n * and may time out. This polls a trivial `true` command on a short backoff,\n * logging a `waiting…` line up front and a `ready` line (with `elapsedMs`) on\n * success. On deadline exhaustion it best-effort kills the sandbox and throws.\n *\n * `now`/`sleep` are injectable purely for deterministic tests; in production\n * they default to `Date.now` and a real timer.\n */\nexport async function waitForE2BReady(\n sandbox: E2BSandbox,\n logger: Logger,\n opts: E2BReadinessOptions,\n): Promise<void> {\n if (opts.timeoutSeconds <= 0)\n return\n\n const now = opts.now ?? Date.now\n const sleep = opts.sleep ?? (ms => new Promise<void>(resolve => setTimeout(resolve, ms)))\n const start = now()\n const deadline = start + opts.timeoutSeconds * 1000\n\n logger.info('waiting for E2B sandbox to initialize', { sandboxId: sandbox.sandboxId })\n\n while (true) {\n try {\n await sandbox.commands.run('true', { timeoutMs: READINESS_PROBE_TIMEOUT_MS })\n logger.info('E2B sandbox ready', { sandboxId: sandbox.sandboxId, elapsedMs: now() - start })\n return\n }\n catch {\n if (now() >= deadline) {\n if (opts.killOnTimeout !== false)\n await sandbox.kill().catch(() => {})\n throw new Error(`E2B sandbox ${sandbox.sandboxId} did not become ready within ${opts.timeoutSeconds}s`)\n }\n await sleep(READINESS_BACKOFF_MS)\n }\n }\n}\n\n/**\n * Resolve the effective E2B template, highest precedence first: the per-spawn\n * `SpawnConfig.sandbox.template`, then the factory `template` option, then the\n * `E2B_TEMPLATE` env var. Returns `undefined` (→ SDK's `base` default) when\n * none is set. The E2B SDK reads `E2B_API_KEY`/`E2B_DOMAIN` from the env but\n * NOT `E2B_TEMPLATE`, so this provider has to honor it itself.\n */\nexport function resolveE2BTemplate(\n perSpawnTemplate: string | undefined,\n optionTemplate: string | undefined,\n env: Record<string, string | undefined> = process.env,\n): string | undefined {\n return perSpawnTemplate || optionTemplate || env.E2B_TEMPLATE || undefined\n}\n\n/**\n * Merge the factory-level {@link E2BProviderOptions.env} with the per-spawn\n * `SpawnConfig.env`, per-spawn winning on key conflicts. Returns `undefined`\n * when the merge is empty so callers can skip setting `envs` on the create\n * options entirely (rather than handing the SDK an empty object).\n */\nexport function resolveE2BEnv(\n optionEnv: Record<string, string> | undefined,\n perSpawnEnv: Record<string, string> | undefined,\n): Record<string, string> | undefined {\n const merged = { ...optionEnv, ...perSpawnEnv }\n return Object.keys(merged).length > 0 ? merged : undefined\n}\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\n/**\n * Build a {@link SandboxProvider} backed by E2B.\n *\n * The provider owns a registry of live {@link E2BSandbox} instances keyed by\n * sandbox id, so the per-call `exec`/`readFile`/… hooks reuse the same warm\n * connection rather than reconnecting each time.\n */\nexport function createE2BProvider(options: E2BProviderOptions = {}): SandboxProvider {\n // Track the live sandbox, the env it was created with, and whether WE own it.\n // We re-send that env on every `commands.run` rather than relying on\n // `Sandbox.create`'s `envs` alone — a warm / pre-provisioned sandbox handed\n // back by the control plane may never have run our create-time env injection.\n // `owned` is false for sandboxes we attached to via `Sandbox.connect`: those\n // are never killed on teardown/failure because the caller manages them.\n const live = new Map<string, { sandbox: E2BSandbox, env?: Record<string, string>, owned: boolean }>()\n\n // Resolve the readiness logger once: caller-supplied, else a console-backed\n // default so the \"waiting for sandbox\" line still reaches stderr.\n const logger = options.logger ?? createLogger(consoleSink())\n const readinessTimeoutSeconds = options.readinessTimeoutSeconds ?? 60\n\n async function loadSdk(): Promise<E2BSandboxStatic> {\n try {\n const mod = await import('e2b') as { Sandbox: E2BSandboxStatic }\n return mod.Sandbox\n }\n catch {\n throw new Error('e2b is required for the E2B sandbox provider. Install it with: bun add e2b')\n }\n }\n\n function get(sandboxId: string): { sandbox: E2BSandbox, env?: Record<string, string>, owned: boolean } {\n const entry = live.get(sandboxId)\n if (!entry)\n throw new Error(`E2B sandbox ${sandboxId} is not tracked by this provider`)\n return entry\n }\n\n return {\n name: 'e2b',\n\n async spawn(config: SpawnConfig): Promise<{ id: string, cwd: string }> {\n const Sandbox = await loadSdk()\n const sb: Record<string, unknown> = config.sandbox ?? {}\n\n // Per-spawn overrides win over factory options win over SDK env defaults.\n const apiKey = (sb.apiKey as string | undefined) ?? options.apiKey\n const domain = (sb.domain as string | undefined) ?? options.domain\n const template = resolveE2BTemplate(sb.template as string | undefined, options.template)\n const timeoutSeconds = config.limits?.timeout ?? options.timeoutSeconds\n const connectId = (sb.sandboxId as string | undefined) ?? options.sandboxId\n\n const envs = resolveE2BEnv(options.env, config.env)\n\n // Attach to an existing sandbox when a sandbox id was supplied; otherwise\n // create a fresh one. A connected sandbox is externally owned (`owned`\n // false) so we never kill it on failure or teardown. The create-time\n // `envs`/`template` don't apply to an attach — env is still re-sent on\n // every command, so a connected sandbox isn't left without it.\n let sandbox: E2BSandbox\n const owned = connectId === undefined\n if (connectId !== undefined) {\n const connectOpts: E2BConnectOptions = {}\n if (apiKey !== undefined)\n connectOpts.apiKey = apiKey\n if (domain !== undefined)\n connectOpts.domain = domain\n if (timeoutSeconds !== undefined)\n connectOpts.timeoutMs = timeoutSeconds * 1000\n sandbox = await Sandbox.connect(connectId, connectOpts)\n }\n else {\n const createOpts: E2BCreateOptions = {}\n if (apiKey !== undefined)\n createOpts.apiKey = apiKey\n if (domain !== undefined)\n createOpts.domain = domain\n if (envs)\n createOpts.envs = envs\n if (timeoutSeconds !== undefined)\n createOpts.timeoutMs = timeoutSeconds * 1000\n sandbox = template !== undefined\n ? await Sandbox.create(template, createOpts)\n : await Sandbox.create(createOpts)\n }\n\n live.set(sandbox.sandboxId, { sandbox, env: envs, owned })\n\n // Wait for envd to actually accept commands before handing back the\n // handle — otherwise the cwd mkdir below (and the agent's first turn)\n // races the sandbox's cold start. On failure a sandbox we created is\n // already killed; a connected one is left alone (`killOnTimeout`). Either\n // way, stop tracking it and propagate.\n try {\n await waitForE2BReady(sandbox, logger, { timeoutSeconds: readinessTimeoutSeconds, killOnTimeout: owned })\n }\n catch (err) {\n live.delete(sandbox.sandboxId)\n throw err\n }\n\n // Resolve the working directory. An explicit cwd (per-spawn, else the\n // provider default) is the caller's responsibility — create it up front\n // so relative ops have somewhere to land. With no explicit cwd, DON'T\n // assume E2B's hosted `/home/user`: self-hosted templates may run as a\n // different user whose home lives elsewhere and which we lack permission\n // to create under `/home`. Handing envd a non-existent cwd makes it fail\n // process spawn with ENOENT (\"No such file or directory\"), breaking the\n // pregame script and the agent's first shell turn alike. Instead, ask the\n // sandbox where a login shell actually lands (a cwd-less `pwd`, which\n // can't itself hit the ENOENT) and use that.\n const requestedCwd = config.cwd ?? options.cwd\n let cwd: string\n if (requestedCwd) {\n cwd = requestedCwd\n // Best-effort: the cwd usually already exists (or is creatable), and a\n // genuine failure surfaces as ENOENT on the very next command anyway.\n await sandbox.commands.run(`mkdir -p ${JSON.stringify(cwd)}`).catch(() => {})\n }\n else {\n const discovered = await sandbox.commands.run('pwd')\n .then(r => r.stdout.trim())\n .catch(() => '')\n cwd = discovered || '/home/user'\n }\n\n // Pre-provision the environment before any prompting: upload + run the\n // setup script in the now-ready sandbox. A failure tears the sandbox\n // down (mirroring the readiness gate) rather than handing back a\n // half-provisioned environment.\n if (options.pregame) {\n try {\n await runE2BPregame(sandbox, logger, { name: options.pregame.name, content: options.pregame.content, cwd, envs })\n }\n catch (err) {\n // Only tear down a sandbox we created; a connected one is the\n // caller's to manage even when our setup script fails.\n if (owned)\n await sandbox.kill().catch(() => {})\n live.delete(sandbox.sandboxId)\n throw err\n }\n }\n\n return { id: sandbox.sandboxId, cwd }\n },\n\n async exec(sandboxId, command, opts): Promise<ExecResult> {\n const { sandbox, env } = get(sandboxId)\n // Match the process/docker contexts: `timeout` is in seconds, default 30.\n const timeoutMs = (opts?.timeout ?? 30) * 1000\n try {\n const result = await sandbox.commands.run(command, {\n cwd: opts?.cwd,\n // Re-send the sandbox's configured env on every command (warm\n // sandboxes may lack the create-time injection), with the per-call\n // env layered on top.\n envs: resolveE2BEnv(env, opts?.env),\n timeoutMs: timeoutMs > 0 ? timeoutMs : undefined,\n })\n return { stdout: result.stdout, stderr: result.stderr, exitCode: result.exitCode }\n }\n catch (err: any) {\n // E2B throws on non-zero exit (CommandExitError carries the captured\n // streams) and on timeout. Normalize both into an ExecResult so the\n // shell tool sees a clean exit code rather than a thrown error.\n if (typeof err?.exitCode === 'number') {\n return {\n stdout: err.stdout ?? '',\n stderr: err.stderr ?? err.message ?? '',\n exitCode: err.exitCode,\n }\n }\n return { stdout: '', stderr: err?.message ?? String(err), exitCode: 124 }\n }\n },\n\n async readFile(sandboxId, path): Promise<string> {\n return get(sandboxId).sandbox.files.read(path)\n },\n\n async writeFile(sandboxId, path, content): Promise<void> {\n await get(sandboxId).sandbox.files.write(path, content)\n },\n\n async listFiles(sandboxId, path): Promise<string[]> {\n const entries = await get(sandboxId).sandbox.files.list(path)\n return entries.map(e => e.name)\n },\n\n async destroy(sandboxId): Promise<void> {\n const entry = live.get(sandboxId)\n if (!entry)\n return\n // Never kill a sandbox we only connected to — the caller owns its\n // lifecycle. Just drop our handle to it.\n if (entry.owned) {\n try {\n await entry.sandbox.kill()\n }\n catch {\n // Sandbox may already be gone (timed out, killed out-of-band).\n }\n }\n live.delete(sandboxId)\n },\n }\n}\n"],"mappings":";;;AAmKA,MAAM,6BAA6B;;AAEnC,MAAM,uBAAuB;;;;;;;;AAQ7B,MAAM,qBAAqB,OAAU;;;;;;;;;;;;;AAcrC,eAAsB,cACpB,SACA,QACA,MACe;CACf,MAAM,OAAO,QAAQ,KAAK;CAC1B,OAAO,KAAK,8BAA8B;EAAE,WAAW,QAAQ;EAAW;CAAK,CAAC;CAChF,MAAM,QAAQ,MAAM,MAAM,MAAM,KAAK,OAAO;CAE5C,MAAM,SAAS,KAAK,UAAU,IAAI;CAClC,IAAI;CACJ,IAAI;EACF,SAAS,MAAM,QAAQ,SAAS,IAAI,YAAY,OAAO,MAAM,UAAU;GACrE,KAAK,KAAK;GACV,MAAM,KAAK;GACX,WAAW;EACb,CAAC;CACH,SACO,KAAU;EAGf,MAAM,WAAW,OAAO,KAAK,aAAa,WAAW,IAAI,WAAW;EACpE,OAAO,MAAM,6BAA6B;GAAE,WAAW,QAAQ;GAAW;GAAU,QAAQ,KAAK,UAAU;GAAI,QAAQ,KAAK,UAAU,KAAK,WAAW;EAAG,CAAC;EAC1J,MAAM,IAAI,MAAM,sBAAsB,KAAK,KAAK,yBAAyB,UAAU;CACrF;CAEA,IAAI,OAAO,aAAa,GAAG;EACzB,OAAO,MAAM,6BAA6B;GAAE,WAAW,QAAQ;GAAW,UAAU,OAAO;GAAU,QAAQ,OAAO;GAAQ,QAAQ,OAAO;EAAO,CAAC;EACnJ,MAAM,IAAI,MAAM,sBAAsB,KAAK,KAAK,yBAAyB,OAAO,UAAU;CAC5F;CAEA,OAAO,KAAK,qBAAqB;EAAE,WAAW,QAAQ;EAAW,QAAQ,OAAO;EAAQ,QAAQ,OAAO;CAAO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WAAW;KACrC,UAAU,IAAI;IAChB;IAEF,OAAO;KAAE,QAAQ;KAAI,QAAQ,KAAK,WAAW,OAAO,GAAG;KAAG,UAAU;IAAI;GAC1E;EACF;EAEA,MAAM,SAAS,WAAW,MAAuB;GAC/C,OAAO,IAAI,SAAS,EAAE,QAAQ,MAAM,KAAK,IAAI;EAC/C;EAEA,MAAM,UAAU,WAAW,MAAM,SAAwB;GACvD,MAAM,IAAI,SAAS,EAAE,QAAQ,MAAM,MAAM,MAAM,OAAO;EACxD;EAEA,MAAM,UAAU,WAAW,MAAyB;GAElD,QAAO,MADe,IAAI,SAAS,EAAE,QAAQ,MAAM,KAAK,IAAI,GAC7C,KAAI,MAAK,EAAE,IAAI;EAChC;EAEA,MAAM,QAAQ,WAA0B;GACtC,MAAM,QAAQ,KAAK,IAAI,SAAS;GAChC,IAAI,CAAC,OACH;GAGF,IAAI,MAAM,OACR,IAAI;IACF,MAAM,MAAM,QAAQ,KAAK;GAC3B,QACM,CAEN;GAEF,KAAK,OAAO,SAAS;EACvB;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"e2b.js","names":[],"sources":["../../src/contexts/e2b.ts"],"sourcesContent":["/**\n * E2B sandbox provider.\n *\n * Implements {@link SandboxProvider} on top of E2B's firecracker-backed\n * micro-VMs. Pair it with {@link createSandboxContext} to run an agent's\n * shell + filesystem tools inside an ephemeral E2B sandbox:\n *\n * ```ts\n * import { createSandboxContext } from 'zidane/contexts'\n * import { createE2BProvider } from 'zidane/contexts/e2b'\n *\n * const execution = createSandboxContext(createE2BProvider())\n * ```\n *\n * ## Pointing at your own E2B\n *\n * The two knobs that select *which* E2B you talk to are `apiKey` and\n * `domain`. Self-hosted / on-prem E2B clusters expose a custom domain; pass\n * it here (or via the `E2B_DOMAIN` env var) and the SDK routes every call to\n * your cluster instead of E2B's hosted API. Precedence, highest first:\n *\n * 1. Per-spawn `SpawnConfig.sandbox` fields (`apiKey`, `domain`, `template`)\n * 2. {@link E2BProviderOptions} passed to this factory\n * 3. `E2B_API_KEY` / `E2B_DOMAIN` env vars (read by the SDK itself), and\n * `E2B_TEMPLATE` (read by this provider — the SDK does not read it)\n *\n * The default `base` template does not exist on self-hosted clusters, so\n * picking the right template matters: an invalid template still returns a\n * sandbox id from the control plane, but its envd never boots and every\n * `exec`/file op then hangs until it times out. Set `E2B_TEMPLATE` (or pass\n * `template`) to a template that actually exists on your cluster.\n *\n * Requires `e2b@^2` as an optional peer dependency:\n * `bun add e2b`.\n */\n\nimport type { Logger } from '../logger'\nimport type { SandboxProvider } from './sandbox'\nimport type { ExecResult, SpawnConfig } from './types'\nimport { consoleSink, createLogger } from '../logger'\n\n// ---------------------------------------------------------------------------\n// Minimal structural views of the `e2b` SDK surface we touch. Declared locally\n// (rather than imported) so the package typechecks without the optional peer\n// dependency installed — mirroring how `docker.ts` keeps `dockerode` at arm's\n// length. The real SDK satisfies these shapes. The peer dependency floor is\n// `e2b@^2`: every member used here exists across 2.x, but the pause surface\n// shifted within it — `betaPause()` from 2.0.0, the stable `pause()` from\n// 2.27.1 — so `onDestroy: 'pause'` prefers `pause()` and falls back to\n// `betaPause()` (both optional below, resolved at runtime in `destroy`).\n// ---------------------------------------------------------------------------\n\ninterface E2BCommandResult {\n stdout: string\n stderr: string\n exitCode: number\n}\n\ninterface E2BEntry {\n name: string\n}\n\ninterface E2BSandbox {\n sandboxId: string\n commands: {\n run: (cmd: string, opts?: { cwd?: string, envs?: Record<string, string>, timeoutMs?: number }) => Promise<E2BCommandResult>\n }\n files: {\n read: (path: string) => Promise<string>\n write: (path: string, data: string) => Promise<unknown>\n list: (path: string) => Promise<E2BEntry[]>\n }\n kill: () => Promise<unknown>\n // The pause surface shifted within 2.x: `betaPause` from 2.0.0, the stable\n // `pause` from 2.27.1. Both are optional so `destroy` can prefer `pause`,\n // fall back to `betaPause`, and stay defensive if a mismatched install\n // exposes neither. Both resolve to whether the sandbox was newly paused.\n pause?: () => Promise<boolean>\n betaPause?: () => Promise<boolean>\n}\n\ninterface E2BCreateOptions {\n apiKey?: string\n domain?: string\n timeoutMs?: number\n envs?: Record<string, string>\n metadata?: Record<string, string>\n}\n\ninterface E2BConnectOptions {\n apiKey?: string\n domain?: string\n timeoutMs?: number\n}\n\ninterface E2BSandboxStatic {\n create: (templateOrOpts?: string | E2BCreateOptions, opts?: E2BCreateOptions) => Promise<E2BSandbox>\n connect: (sandboxId: string, opts?: E2BConnectOptions) => Promise<E2BSandbox>\n}\n\n// ---------------------------------------------------------------------------\n// Provider options\n// ---------------------------------------------------------------------------\n\nexport interface E2BProviderOptions {\n /** E2B API key. Falls back to the `E2B_API_KEY` env var when omitted. */\n apiKey?: string\n /**\n * E2B API domain. Set this to point at a self-hosted / on-prem cluster\n * (e.g. `e2b.my-company.internal`). Falls back to the `E2B_DOMAIN` env var,\n * then to E2B's hosted default.\n */\n domain?: string\n /**\n * Sandbox template id / name to launch. Falls back to the `E2B_TEMPLATE`\n * env var, then to E2B's hosted `base` template. Note that `base` does not\n * exist on self-hosted clusters — supply a template that does.\n */\n template?: string\n /**\n * Connect to a pre-existing sandbox by id instead of creating a fresh one\n * (E2B's `Sandbox.connect`). When set, `template` is ignored — you're\n * attaching to a sandbox that already exists. The provider treats such a\n * sandbox as externally owned: it is NOT killed on `destroy`, nor torn down\n * if the readiness probe / pregame fails, since the caller manages its\n * lifecycle. Per-spawn `SpawnConfig.sandbox.sandboxId` overrides this.\n */\n sandboxId?: string\n /**\n * Default working directory, applied when a spawn doesn't set its own\n * `SpawnConfig.cwd`. Created on spawn. Defaults to E2B's `/home/user`.\n */\n cwd?: string\n /**\n * Sandbox lifetime in seconds before E2B auto-kills it. Defaults to the\n * SDK default (300s). Per-spawn `SpawnConfig.limits.timeout` overrides this.\n */\n timeoutSeconds?: number\n /**\n * Environment variables baked into every sandbox at create time (passed to\n * E2B's `Sandbox.create({ envs })`), so every command run in the sandbox\n * sees them. Per-spawn `SpawnConfig.env` is merged over these.\n */\n env?: Record<string, string>\n /**\n * Logger for provider-level lifecycle lines (notably the readiness wait).\n * Defaults to a {@link consoleSink}-backed logger so the messages reach\n * stderr without the caller wiring one up.\n */\n logger?: Logger\n /**\n * Total deadline, in seconds, for the post-create readiness probe (see\n * {@link waitForE2BReady}). A freshly-created sandbox can return its id\n * before `envd` accepts commands; `spawn` blocks until a trivial probe\n * succeeds so the first real command never absorbs the cold start. Defaults\n * to `60`. Set to `0` to disable the gate.\n */\n readinessTimeoutSeconds?: number\n /**\n * A setup script to upload and run once the sandbox is ready, before any\n * prompting begins (see {@link runE2BPregame}). `name` is the basename used\n * for the uploaded file; `content` is the script body. The script is run\n * directly so its shebang selects the interpreter. A non-zero exit aborts\n * `spawn` (and tears the sandbox down) — a broken setup must not silently\n * hand back a half-provisioned sandbox.\n */\n pregame?: { name: string, content: string }\n /**\n * What to do with an owned sandbox when `destroy` is called:\n *\n * - `'kill'` (default) — call `sandbox.kill()`. The sandbox is deleted and\n * its state is gone.\n * - `'pause'` — call `sandbox.pause()` (falling back to the older\n * `betaPause()` on `e2b` 2.0–2.26). The sandbox's filesystem and process\n * state are preserved; reconnect later with the `sandboxId` option (E2B's\n * `Sandbox.connect` auto-resumes a paused sandbox).\n * - `'leave'` — drop the local handle without making any API call. The\n * sandbox keeps running until E2B's own timeout fires.\n *\n * Has no effect on sandboxes the provider only connected to (the `sandboxId`\n * option) — those are always left untouched on destroy since the caller owns\n * their lifecycle.\n */\n onDestroy?: 'kill' | 'pause' | 'leave'\n}\n\n/** Per-probe timeout for the readiness `true` command. */\nconst READINESS_PROBE_TIMEOUT_MS = 5000\n/** Pause between readiness probes while the sandbox is still warming up. */\nconst READINESS_BACKOFF_MS = 250\n/**\n * Command timeout for the pregame setup script. E2B's `commands.run` defaults\n * to 60s and offers no true \"unlimited\" — a `timeoutMs` of 0 is a 0ms deadline\n * (instant timeout), not \"off\". Setup scripts (`apt`/`pip` installs, builds)\n * routinely exceed 60s, so we pass a deliberately generous 30-minute ceiling.\n * The sandbox's own lifetime independently bounds anything longer.\n */\nconst PREGAME_TIMEOUT_MS = 30 * 60 * 1000\n\n/**\n * Upload a setup (\"pregame\") script into a ready sandbox and execute it.\n *\n * Writes the script to `/tmp/<name>`, then `chmod +x`'s and runs it directly\n * (so a `#!/bin/bash` / `#!/usr/bin/env python3` shebang chooses the\n * interpreter) in `cwd` with `envs` applied — the same env the sandbox was\n * created with, so the script sees the run's `--env` / `--pass-env`. A\n * generous {@link PREGAME_TIMEOUT_MS} ceiling is used so long `apt`/`pip`\n * installs aren't killed by E2B's 60s command default. A non-zero exit\n * (whether E2B returns it or raises on it) throws, so the caller can tear the\n * sandbox down rather than prompt against a broken environment.\n */\nexport async function runE2BPregame(\n sandbox: E2BSandbox,\n logger: Logger,\n opts: { name: string, content: string, cwd?: string, envs?: Record<string, string> },\n): Promise<void> {\n const path = `/tmp/${opts.name}`\n logger.info('running E2B pregame script', { sandboxId: sandbox.sandboxId, path })\n await sandbox.files.write(path, opts.content)\n\n const quoted = JSON.stringify(path)\n let result: E2BCommandResult\n try {\n result = await sandbox.commands.run(`chmod +x ${quoted} && ${quoted}`, {\n cwd: opts.cwd,\n envs: opts.envs,\n timeoutMs: PREGAME_TIMEOUT_MS,\n })\n }\n catch (err: any) {\n // E2B raises CommandExitError (carrying the captured streams) on a\n // non-zero exit. Surface its output, then fail the spawn.\n const exitCode = typeof err?.exitCode === 'number' ? err.exitCode : 124\n logger.error('E2B pregame script failed', { sandboxId: sandbox.sandboxId, exitCode, stdout: err?.stdout ?? '', stderr: err?.stderr ?? err?.message ?? '' })\n throw new Error(`E2B pregame script ${opts.name} failed with exit code ${exitCode}`)\n }\n\n if (result.exitCode !== 0) {\n logger.error('E2B pregame script failed', { sandboxId: sandbox.sandboxId, exitCode: result.exitCode, stdout: result.stdout, stderr: result.stderr })\n throw new Error(`E2B pregame script ${opts.name} failed with exit code ${result.exitCode}`)\n }\n\n logger.info('E2B pregame ready', { sandboxId: sandbox.sandboxId, stdout: result.stdout, stderr: result.stderr })\n}\n\nexport interface E2BReadinessOptions {\n /** Total deadline in seconds. `<= 0` disables the probe entirely. */\n timeoutSeconds: number\n /**\n * Whether to kill the sandbox if it never becomes ready. Defaults to `true`\n * (we created it, so a dead sandbox is ours to clean up). Pass `false` when\n * attaching to an externally-owned sandbox — failing the probe shouldn't tear\n * down a sandbox the caller is managing.\n */\n killOnTimeout?: boolean\n /** Clock source — injectable so tests can drive the deadline deterministically. */\n now?: () => number\n /** Sleep between probes — injectable so tests can advance the clock without waiting. */\n sleep?: (ms: number) => Promise<void>\n}\n\n/**\n * Block until an E2B sandbox is ready to run commands, or throw if it never\n * becomes ready within the deadline.\n *\n * The E2B control plane can hand back a sandbox id before the sandbox's `envd`\n * is accepting commands; the first real command then absorbs that cold start\n * and may time out. This polls a trivial `true` command on a short backoff,\n * logging a `waiting…` line up front and a `ready` line (with `elapsedMs`) on\n * success. On deadline exhaustion it best-effort kills the sandbox and throws.\n *\n * `now`/`sleep` are injectable purely for deterministic tests; in production\n * they default to `Date.now` and a real timer.\n */\nexport async function waitForE2BReady(\n sandbox: E2BSandbox,\n logger: Logger,\n opts: E2BReadinessOptions,\n): Promise<void> {\n if (opts.timeoutSeconds <= 0)\n return\n\n const now = opts.now ?? Date.now\n const sleep = opts.sleep ?? (ms => new Promise<void>(resolve => setTimeout(resolve, ms)))\n const start = now()\n const deadline = start + opts.timeoutSeconds * 1000\n\n logger.info('waiting for E2B sandbox to initialize', { sandboxId: sandbox.sandboxId })\n\n while (true) {\n try {\n await sandbox.commands.run('true', { timeoutMs: READINESS_PROBE_TIMEOUT_MS })\n logger.info('E2B sandbox ready', { sandboxId: sandbox.sandboxId, elapsedMs: now() - start })\n return\n }\n catch {\n if (now() >= deadline) {\n if (opts.killOnTimeout !== false)\n await sandbox.kill().catch(() => {})\n throw new Error(`E2B sandbox ${sandbox.sandboxId} did not become ready within ${opts.timeoutSeconds}s`)\n }\n await sleep(READINESS_BACKOFF_MS)\n }\n }\n}\n\n/**\n * Resolve the effective E2B template, highest precedence first: the per-spawn\n * `SpawnConfig.sandbox.template`, then the factory `template` option, then the\n * `E2B_TEMPLATE` env var. Returns `undefined` (→ SDK's `base` default) when\n * none is set. The E2B SDK reads `E2B_API_KEY`/`E2B_DOMAIN` from the env but\n * NOT `E2B_TEMPLATE`, so this provider has to honor it itself.\n */\nexport function resolveE2BTemplate(\n perSpawnTemplate: string | undefined,\n optionTemplate: string | undefined,\n env: Record<string, string | undefined> = process.env,\n): string | undefined {\n return perSpawnTemplate || optionTemplate || env.E2B_TEMPLATE || undefined\n}\n\n/**\n * Merge the factory-level {@link E2BProviderOptions.env} with the per-spawn\n * `SpawnConfig.env`, per-spawn winning on key conflicts. Returns `undefined`\n * when the merge is empty so callers can skip setting `envs` on the create\n * options entirely (rather than handing the SDK an empty object).\n */\nexport function resolveE2BEnv(\n optionEnv: Record<string, string> | undefined,\n perSpawnEnv: Record<string, string> | undefined,\n): Record<string, string> | undefined {\n const merged = { ...optionEnv, ...perSpawnEnv }\n return Object.keys(merged).length > 0 ? merged : undefined\n}\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\n/**\n * Build a {@link SandboxProvider} backed by E2B.\n *\n * The provider owns a registry of live {@link E2BSandbox} instances keyed by\n * sandbox id, so the per-call `exec`/`readFile`/… hooks reuse the same warm\n * connection rather than reconnecting each time.\n */\nexport function createE2BProvider(options: E2BProviderOptions = {}): SandboxProvider {\n // Track the live sandbox, the env it was created with, and whether WE own it.\n // We re-send that env on every `commands.run` rather than relying on\n // `Sandbox.create`'s `envs` alone — a warm / pre-provisioned sandbox handed\n // back by the control plane may never have run our create-time env injection.\n // `owned` is false for sandboxes we attached to via `Sandbox.connect`: those\n // are never killed on teardown/failure because the caller manages them.\n const live = new Map<string, { sandbox: E2BSandbox, env?: Record<string, string>, owned: boolean }>()\n\n // Resolve the readiness logger once: caller-supplied, else a console-backed\n // default so the \"waiting for sandbox\" line still reaches stderr.\n const logger = options.logger ?? createLogger(consoleSink())\n const readinessTimeoutSeconds = options.readinessTimeoutSeconds ?? 60\n\n async function loadSdk(): Promise<E2BSandboxStatic> {\n try {\n const mod = await import('e2b') as { Sandbox: E2BSandboxStatic }\n return mod.Sandbox\n }\n catch {\n throw new Error('e2b is required for the E2B sandbox provider. Install it with: bun add e2b')\n }\n }\n\n function get(sandboxId: string): { sandbox: E2BSandbox, env?: Record<string, string>, owned: boolean } {\n const entry = live.get(sandboxId)\n if (!entry)\n throw new Error(`E2B sandbox ${sandboxId} is not tracked by this provider`)\n return entry\n }\n\n // Best-effort kill of an owned sandbox. Failures are swallowed: the sandbox\n // may already be gone (timed out, or killed out-of-band).\n async function killOwnedSandbox(sandbox: E2BSandbox): Promise<void> {\n try {\n await sandbox.kill()\n }\n catch {\n // Already gone — nothing to clean up.\n }\n }\n\n // Pause an owned sandbox so its filesystem/process state survives for a later\n // reconnect. Prefers the stable `pause()` (e2b@2.27.1+), falling back to the\n // deprecated `betaPause()` (e2b@2.0.0+) across the rest of the supported 2.x\n // range. If a mismatched install exposes neither, surface it loudly rather\n // than let a bare `catch` swallow the \"not a function\" error — which would\n // leave the caller believing state was preserved while the sandbox is really\n // about to time out. A genuine pause failure is logged the same way; we\n // deliberately do NOT fall back to kill, since that would destroy the very\n // state the caller asked to keep.\n async function pauseOwnedSandbox(sandbox: E2BSandbox): Promise<void> {\n try {\n if (sandbox.pause) {\n await sandbox.pause()\n }\n else if (sandbox.betaPause) {\n await sandbox.betaPause()\n }\n else {\n logger.error('cannot pause E2B sandbox: this e2b SDK exposes neither pause() nor betaPause() (expected e2b@^2); leaving it to time out', { sandboxId: sandbox.sandboxId })\n return\n }\n logger.info('paused E2B sandbox; reconnect later via the sandboxId option (CLI: --sandbox)', { sandboxId: sandbox.sandboxId })\n }\n catch (err) {\n logger.error('failed to pause E2B sandbox; it will run until its timeout', { sandboxId: sandbox.sandboxId, error: err instanceof Error ? err.message : String(err) })\n }\n }\n\n return {\n name: 'e2b',\n\n async spawn(config: SpawnConfig): Promise<{ id: string, cwd: string }> {\n const Sandbox = await loadSdk()\n const sb: Record<string, unknown> = config.sandbox ?? {}\n\n // Per-spawn overrides win over factory options win over SDK env defaults.\n const apiKey = (sb.apiKey as string | undefined) ?? options.apiKey\n const domain = (sb.domain as string | undefined) ?? options.domain\n const template = resolveE2BTemplate(sb.template as string | undefined, options.template)\n const timeoutSeconds = config.limits?.timeout ?? options.timeoutSeconds\n const connectId = (sb.sandboxId as string | undefined) ?? options.sandboxId\n\n const envs = resolveE2BEnv(options.env, config.env)\n\n // Attach to an existing sandbox when a sandbox id was supplied; otherwise\n // create a fresh one. A connected sandbox is externally owned (`owned`\n // false) so we never kill it on failure or teardown. The create-time\n // `envs`/`template` don't apply to an attach — env is still re-sent on\n // every command, so a connected sandbox isn't left without it.\n let sandbox: E2BSandbox\n const owned = connectId === undefined\n if (connectId !== undefined) {\n const connectOpts: E2BConnectOptions = {}\n if (apiKey !== undefined)\n connectOpts.apiKey = apiKey\n if (domain !== undefined)\n connectOpts.domain = domain\n if (timeoutSeconds !== undefined)\n connectOpts.timeoutMs = timeoutSeconds * 1000\n sandbox = await Sandbox.connect(connectId, connectOpts)\n }\n else {\n const createOpts: E2BCreateOptions = {}\n if (apiKey !== undefined)\n createOpts.apiKey = apiKey\n if (domain !== undefined)\n createOpts.domain = domain\n if (envs)\n createOpts.envs = envs\n if (timeoutSeconds !== undefined)\n createOpts.timeoutMs = timeoutSeconds * 1000\n sandbox = template !== undefined\n ? await Sandbox.create(template, createOpts)\n : await Sandbox.create(createOpts)\n }\n\n live.set(sandbox.sandboxId, { sandbox, env: envs, owned })\n\n // Wait for envd to actually accept commands before handing back the\n // handle — otherwise the cwd mkdir below (and the agent's first turn)\n // races the sandbox's cold start. On failure a sandbox we created is\n // already killed; a connected one is left alone (`killOnTimeout`). Either\n // way, stop tracking it and propagate.\n try {\n await waitForE2BReady(sandbox, logger, { timeoutSeconds: readinessTimeoutSeconds, killOnTimeout: owned })\n }\n catch (err) {\n live.delete(sandbox.sandboxId)\n throw err\n }\n\n // Resolve the working directory. An explicit cwd (per-spawn, else the\n // provider default) is the caller's responsibility — create it up front\n // so relative ops have somewhere to land. With no explicit cwd, DON'T\n // assume E2B's hosted `/home/user`: self-hosted templates may run as a\n // different user whose home lives elsewhere and which we lack permission\n // to create under `/home`. Handing envd a non-existent cwd makes it fail\n // process spawn with ENOENT (\"No such file or directory\"), breaking the\n // pregame script and the agent's first shell turn alike. Instead, ask the\n // sandbox where a login shell actually lands (a cwd-less `pwd`, which\n // can't itself hit the ENOENT) and use that.\n const requestedCwd = config.cwd ?? options.cwd\n let cwd: string\n if (requestedCwd) {\n cwd = requestedCwd\n // Best-effort: the cwd usually already exists (or is creatable), and a\n // genuine failure surfaces as ENOENT on the very next command anyway.\n await sandbox.commands.run(`mkdir -p ${JSON.stringify(cwd)}`).catch(() => {})\n }\n else {\n const discovered = await sandbox.commands.run('pwd')\n .then(r => r.stdout.trim())\n .catch(() => '')\n cwd = discovered || '/home/user'\n }\n\n // Pre-provision the environment before any prompting: upload + run the\n // setup script in the now-ready sandbox. A failure tears the sandbox\n // down (mirroring the readiness gate) rather than handing back a\n // half-provisioned environment.\n if (options.pregame) {\n try {\n await runE2BPregame(sandbox, logger, { name: options.pregame.name, content: options.pregame.content, cwd, envs })\n }\n catch (err) {\n // Only tear down a sandbox we created; a connected one is the\n // caller's to manage even when our setup script fails.\n if (owned)\n await sandbox.kill().catch(() => {})\n live.delete(sandbox.sandboxId)\n throw err\n }\n }\n\n return { id: sandbox.sandboxId, cwd }\n },\n\n async exec(sandboxId, command, opts): Promise<ExecResult> {\n const { sandbox, env } = get(sandboxId)\n // Match the process/docker contexts: `timeout` is in seconds, default 30.\n const timeoutMs = (opts?.timeout ?? 30) * 1000\n try {\n const result = await sandbox.commands.run(command, {\n cwd: opts?.cwd,\n // Re-send the sandbox's configured env on every command (warm\n // sandboxes may lack the create-time injection), with the per-call\n // env layered on top.\n envs: resolveE2BEnv(env, opts?.env),\n timeoutMs: timeoutMs > 0 ? timeoutMs : undefined,\n })\n return { stdout: result.stdout, stderr: result.stderr, exitCode: result.exitCode }\n }\n catch (err: any) {\n // E2B throws on non-zero exit (CommandExitError carries the captured\n // streams) and on timeout. Normalize both into an ExecResult so the\n // shell tool sees a clean exit code rather than a thrown error.\n if (typeof err?.exitCode === 'number') {\n return {\n stdout: err.stdout ?? '',\n stderr: err.stderr ?? err.message ?? '',\n exitCode: err.exitCode,\n }\n }\n return { stdout: '', stderr: err?.message ?? String(err), exitCode: 124 }\n }\n },\n\n async readFile(sandboxId, path): Promise<string> {\n return get(sandboxId).sandbox.files.read(path)\n },\n\n async writeFile(sandboxId, path, content): Promise<void> {\n await get(sandboxId).sandbox.files.write(path, content)\n },\n\n async listFiles(sandboxId, path): Promise<string[]> {\n const entries = await get(sandboxId).sandbox.files.list(path)\n return entries.map(e => e.name)\n },\n\n async destroy(sandboxId): Promise<void> {\n const entry = live.get(sandboxId)\n if (!entry)\n return\n // Never kill/pause a sandbox we only connected to — the caller owns its\n // lifecycle. Just drop our handle to it.\n if (entry.owned) {\n const action = options.onDestroy ?? 'kill'\n if (action === 'pause')\n await pauseOwnedSandbox(entry.sandbox)\n else if (action === 'kill')\n await killOwnedSandbox(entry.sandbox)\n // 'leave' makes no API call — the sandbox runs until E2B's own timeout.\n }\n live.delete(sandboxId)\n },\n }\n}\n"],"mappings":";;;AA2LA,MAAM,6BAA6B;;AAEnC,MAAM,uBAAuB;;;;;;;;AAQ7B,MAAM,qBAAqB,OAAU;;;;;;;;;;;;;AAcrC,eAAsB,cACpB,SACA,QACA,MACe;CACf,MAAM,OAAO,QAAQ,KAAK;CAC1B,OAAO,KAAK,8BAA8B;EAAE,WAAW,QAAQ;EAAW;CAAK,CAAC;CAChF,MAAM,QAAQ,MAAM,MAAM,MAAM,KAAK,OAAO;CAE5C,MAAM,SAAS,KAAK,UAAU,IAAI;CAClC,IAAI;CACJ,IAAI;EACF,SAAS,MAAM,QAAQ,SAAS,IAAI,YAAY,OAAO,MAAM,UAAU;GACrE,KAAK,KAAK;G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MAAuB;GAC/C,OAAO,IAAI,SAAS,EAAE,QAAQ,MAAM,KAAK,IAAI;EAC/C;EAEA,MAAM,UAAU,WAAW,MAAM,SAAwB;GACvD,MAAM,IAAI,SAAS,EAAE,QAAQ,MAAM,MAAM,MAAM,OAAO;EACxD;EAEA,MAAM,UAAU,WAAW,MAAyB;GAElD,QAAO,MADe,IAAI,SAAS,EAAE,QAAQ,MAAM,KAAK,IAAI,GAC7C,KAAI,MAAK,EAAE,IAAI;EAChC;EAEA,MAAM,QAAQ,WAA0B;GACtC,MAAM,QAAQ,KAAK,IAAI,SAAS;GAChC,IAAI,CAAC,OACH;GAGF,IAAI,MAAM,OAAO;IACf,MAAM,SAAS,QAAQ,aAAa;IACpC,IAAI,WAAW,SACb,MAAM,kBAAkB,MAAM,OAAO;SAClC,IAAI,WAAW,QAClB,MAAM,iBAAiB,MAAM,OAAO;GAExC;GACA,KAAK,OAAO,SAAS;EACvB;CACF;AACF"}
|
|
@@ -271,6 +271,7 @@ interface StartLocalOptions {
|
|
|
271
271
|
content: string;
|
|
272
272
|
};
|
|
273
273
|
sandboxId?: string;
|
|
274
|
+
sandboxOnDestroy?: 'kill' | 'pause' | 'leave';
|
|
274
275
|
mcp?: McpServerConfig[];
|
|
275
276
|
sessionDb?: string;
|
|
276
277
|
sessionId?: string;
|
|
@@ -1804,4 +1805,4 @@ declare function computeTurnAnchors(items: readonly TranscriptItem[]): {
|
|
|
1804
1805
|
};
|
|
1805
1806
|
//#endregion
|
|
1806
1807
|
export { useInteractionsQueue as $, parseBindingSpec as $t, InteractionsProvider as A, marginTopFor as At, QuestionPayload as B, KEYBINDING_DEF_BY_ACTION as Bt, ASK_USER_TOOL as C, TuiState as Ct, InteractionRequest as D, lastContextSizeFromTurns as Dt, CreateInteractionToolsOptions as E, eventsFromTurns as Et, PlanRequest as F, toolCallPreview as Ft, TextQuestion as G, KeyBindings as Gt, QuestionResponse as H, KeyAction as Ht, PlanResponse as I, toolResultText as It, isInteractionTool as J, formatBindingForDisplay as Jt, buildResumedToolResultsTurn as K, ParsedBinding as Kt, PlanStep as L, updateToolEventOutcomes as Lt, PendingInteractionEntry as M, stripSpawnTokensLine as Mt, PlanDecision as N, sumRunCosts as Nt, InteractionResponse as O, listSessionMeta as Ot, PlanPayload as P, titleFromTurns as Pt, useInteractionsActions as Q, mergeKeybindings as Qt, Question as R, DEFAULT_KEYBINDINGS as Rt, splitMarkdownCodeBlocks as S, StateStoreApi as St, ConfirmQuestion as T, deriveSessionTitle as Tt, QuestionType as U, KeyBindingDef as Ut, QuestionRequest as V, KEYBINDING_KEY_COL_WIDTH as Vt, SelectQuestion as W, KeyBindingSection as Wt, pendingInteractionsFromTurns as X, keybindingsPath as Xt, makeRequestInteraction as Y, groupBindings as Yt, serializeInteractionResponse as Z, matchesBinding as Zt, SessionExportTarget as _, PLAN_AGENT as _n, ResolveStorageDirsOptions as _t, ChipColorMap as a, Hint as an, DiscoveryResult as at, writeSessionExport as b, singleAgentRegistry as bn, StorageSlot as bt, SyntaxTokenStyle as c, truncateTrailing as cn, discoverProjectMcps as ct, ThemeSelect as d, AgentRegistry as dn, ChatOptions as dt, readKeybindings as en, EnabledAllowlistKey as et, ThemeSurfaces as f, BUILD_AGENT as fn, ProviderRegistry as ft, SessionExportFormat as g, DEFAULT_PERSIST_EXCLUDE_TOOLS as gn, resolveStoragePaths as gt, SessionExportAnchor as h, DEFAULT_BUDGET_EXCLUDE_TOOLS as hn, resolveConfig as ht, ChipColor as i, EMPTY_HINTS as in, DiscoveryError as it, PRESENT_PLAN_TOOL as j, saveState as jt, InteractionsActions as k, loadState as kt, Theme as l, AgentAccent as ln, parseMcpsFile as lt, resolveTheme as m, DEFAULT_AGENT_ID as mn, ResolvedPaths as mt, computeTurnAnchors as n, CompletionState as nn, useEnabledToggleSet as nt, DEFAULT_THEME as o, clipHintsToWidth as on, buildMcpServers as ot, resolveChipColor as p, BUILTIN_AGENTS as pn, ResolvedConfig as pt, createInteractionTools as q, ensureKeybindingsFile as qt, BUILTIN_THEMES as r, useCompletion as rn, DiscoveredMcp as rt, SyntaxStyles as s, hintsLength as sn, defaultMcpsConfigPaths as st, TranscriptItem as t, stripJsonComments as tn, EnabledToggleSet as tt, ThemeColors as u, AgentProfile as un, AutoUpdateConfig as ut, renderSession as v, accentColor as vn, StorageDirs as vt, AnswerValue as w, createStateStore as wt, MarkdownSegment as x, resolveStorageDirs as xt, resolveSessionExportTarget as y, resolveAgentId as yn, StorageMode as yt, QuestionChoice as z, KEYBINDING_DEFS as zt };
|
|
1807
|
-
//# sourceMappingURL=transcript-anchors-
|
|
1808
|
+
//# sourceMappingURL=transcript-anchors-DDjscta9.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript-anchors-DDjscta9.d.ts","names":[],"sources":["../src/chat/agents.ts","../src/chat/hints.ts","../src/chat/completion.ts","../src/start/shared-options.ts","../src/chat/keybindings.ts","../src/chat/store.ts","../src/chat/xdg.ts","../src/chat/config.ts","../src/chat/mcps-discovery.ts","../src/chat/enabled-toggle-set.ts","../src/chat/interactions.tsx","../src/chat/markdown-segments.ts","../src/chat/session-export.ts","../src/chat/theme.ts","../src/chat/transcript-anchors.ts"],"mappings":";;;;;;;;;;;KA4BY,WAAA;;;AAW2D;AAYvE;;;;iBAdgB,WAAA,CACd,MAAA,EAAQ,WAAW,cACnB,KAAA;EAAS,KAAA;EAAe,MAAA;EAAgB,IAAA;EAAc,KAAA;AAAA;AAAA,UAYvC,YAAA;EAeK;EAbpB,EAAA;EAgBU;EAdV,KAAA;;EAEA,WAAA;EAYmC;;;;;;EALnC,MAAA,EAAQ,MAAA;EAKsD;EAH9D,MAAA,GAAS,WAAW;AAAA;AAAA,KAGV,aAAA,GAAgB,QAAA,CAAS,MAAA,SAAe,YAAA;;;AAwCnD;AAoBD;;;;AAIC;AA+GD;;;;AA8BC;AAQD;;;;AAWC;AAOD;;cA3Ma,6BAAA;;AA8MZ;AAGD;;;;AAA6B;AAQ7B;;;;;;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evel, dn as McpToolSchema, k as SkillConfig, kn as SessionTurn } from "./agent-CZswyE11.js";
|
|
2
|
-
import { At as marginTopFor, D as InteractionRequest, Gt as KeyBindings, O as InteractionResponse, S as splitMarkdownCodeBlocks, an as Hint, cn as truncateTrailing, dn as AgentRegistry, dt as ChatOptions, et as EnabledAllowlistKey, g as SessionExportFormat, it as DiscoveryError, l as Theme, n as computeTurnAnchors, nn as CompletionState, on as clipHintsToWidth, pt as ResolvedConfig, rt as DiscoveredMcp, sn as hintsLength, t as TranscriptItem, u as ThemeColors, vn as accentColor, x as MarkdownSegment } from "./transcript-anchors-
|
|
2
|
+
import { At as marginTopFor, D as InteractionRequest, Gt as KeyBindings, O as InteractionResponse, S as splitMarkdownCodeBlocks, an as Hint, cn as truncateTrailing, dn as AgentRegistry, dt as ChatOptions, et as EnabledAllowlistKey, g as SessionExportFormat, it as DiscoveryError, l as Theme, n as computeTurnAnchors, nn as CompletionState, on as clipHintsToWidth, pt as ResolvedConfig, rt as DiscoveredMcp, sn as hintsLength, t as TranscriptItem, u as ThemeColors, vn as accentColor, x as MarkdownSegment } from "./transcript-anchors-DDjscta9.js";
|
|
3
3
|
import { A as SessionMeta, G as ProviderKey, L as CompletionProvider, M as StreamEvent, R as CompletionReference, W as ProviderAuth, X as ModelOption, Y as ModelInfo, _ as isEditErrorResult, a as formatToolCall, b as selectableTurnIds, c as splitPromptSegments, i as displayNameFor, j as Settings, l as ApprovalDecision, n as ToolDisplayMeta, o as PromptSegment, r as ToolFormatLine, s as PromptSegmentRef, t as TOOL_DISPLAY, u as ApprovalRequest, v as isTurnHighlighted, x as turnSelectionOwnership, y as isVisible } from "./tool-formatters-CGCa6rih.js";
|
|
4
4
|
import { Buffer } from "node:buffer";
|
|
5
5
|
import { ReactNode } from "react";
|
|
@@ -37,6 +37,7 @@ context-specific flags.
|
|
|
37
37
|
| `--image <name>` | — | ✓ | — | Docker image to run. |
|
|
38
38
|
| `--pregame <file>` | warns | warns | ✓ | Setup script to run before prompting. |
|
|
39
39
|
| `--sandbox <id>` | warns | warns | ✓ | Attach to an existing E2B sandbox. |
|
|
40
|
+
| `--sandbox-on-destroy kill\|pause\|leave` | warns | warns | ✓ | What to do with an owned sandbox when the run ends (default `kill`). |
|
|
40
41
|
|
|
41
42
|
"warns" means the flag is accepted but ignored with a warning when it doesn't
|
|
42
43
|
apply to the selected context.
|
|
@@ -126,10 +127,40 @@ bun start --prompt "add a feature" --context e2b --sandbox sbx-abc123def456
|
|
|
126
127
|
|
|
127
128
|
The ownership difference matters:
|
|
128
129
|
|
|
129
|
-
- **Sandboxes Zidane creates** are owned by the run
|
|
130
|
-
|
|
131
|
-
- **Sandboxes you connect to** with `--sandbox` are never killed
|
|
132
|
-
on failure. You manage their lifecycle yourself.
|
|
130
|
+
- **Sandboxes Zidane creates** are owned by the run. By default they're killed on
|
|
131
|
+
exit; use `--sandbox-on-destroy` to change that (see below).
|
|
132
|
+
- **Sandboxes you connect to** with `--sandbox` are never killed or paused by
|
|
133
|
+
Zidane, even on failure. You manage their lifecycle yourself.
|
|
134
|
+
|
|
135
|
+
### Controlling what happens to a sandbox when the run ends
|
|
136
|
+
|
|
137
|
+
By default Zidane destroys the sandbox it created when the run finishes. Use
|
|
138
|
+
`--sandbox-on-destroy` to change this behaviour:
|
|
139
|
+
|
|
140
|
+
| Value | Effect |
|
|
141
|
+
|-------|--------|
|
|
142
|
+
| `kill` (default) | Destroy the sandbox immediately. |
|
|
143
|
+
| `pause` | Pause the sandbox — E2B preserves its filesystem and process state. Reconnect in a later run with `--sandbox <id>`. |
|
|
144
|
+
| `leave` | Drop Zidane's handle without any API call. The sandbox keeps running until E2B's own timeout fires. |
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Pause the sandbox so you can reconnect to the same filesystem next time.
|
|
148
|
+
bun start --prompt "scaffold the project" --context e2b --sandbox-on-destroy pause
|
|
149
|
+
# → prints the sandbox id; pass it to the next run with --sandbox
|
|
150
|
+
|
|
151
|
+
# Leave it running for inspection after the agent finishes.
|
|
152
|
+
bun run headless "..." --context e2b --sandbox-on-destroy leave
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`--sandbox-on-destroy` is ignored (with a warning) for `process` and `docker`
|
|
156
|
+
contexts, and has no effect on sandboxes you connected to with `--sandbox` —
|
|
157
|
+
those are always left untouched.
|
|
158
|
+
|
|
159
|
+
The `e2b` context requires the E2B SDK at `e2b@^2`. `pause` calls `pause()`,
|
|
160
|
+
falling back to the older `betaPause()` on 2.0–2.26. If a mismatched install
|
|
161
|
+
exposes neither, the pause is skipped with an error log and the sandbox is left
|
|
162
|
+
to run until its own timeout — it is never killed, so state is not silently
|
|
163
|
+
destroyed.
|
|
133
164
|
|
|
134
165
|
### What happens on spawn
|
|
135
166
|
|
|
@@ -237,12 +268,23 @@ const proc = createProcessContext({ cwd: '/tmp/work', env: { CI: '1' } })
|
|
|
237
268
|
// docker
|
|
238
269
|
const docker = createDockerContext({ image: 'python:3.12', cwd: '/app' })
|
|
239
270
|
|
|
240
|
-
// e2b
|
|
271
|
+
// e2b — destroy on exit (default)
|
|
241
272
|
const e2b = createSandboxContext(createE2BProvider({
|
|
242
273
|
cwd: '/home/user/project',
|
|
243
274
|
env: { NODE_ENV: 'development' },
|
|
244
275
|
pregame: { name: 'setup.sh', content: '#!/bin/bash\nnpm install\n' },
|
|
245
276
|
}))
|
|
277
|
+
|
|
278
|
+
// e2b — pause on exit so the sandbox can be reconnected later
|
|
279
|
+
const e2bPause = createSandboxContext(createE2BProvider({
|
|
280
|
+
cwd: '/home/user/project',
|
|
281
|
+
onDestroy: 'pause',
|
|
282
|
+
}))
|
|
283
|
+
|
|
284
|
+
// e2b — reconnect to a previously paused sandbox
|
|
285
|
+
const e2bResume = createSandboxContext(createE2BProvider({
|
|
286
|
+
sandboxId: 'sbx-abc123def456', // Sandbox.connect auto-resumes a paused sandbox
|
|
287
|
+
}))
|
|
246
288
|
```
|
|
247
289
|
|
|
248
290
|
The Docker factory accepts the full advanced `SpawnConfig` (mounts, ports, user,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zidane",
|
|
3
|
-
"version": "5.12.
|
|
3
|
+
"version": "5.12.8",
|
|
4
4
|
"description": "an agent that goes straight to the goal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
"@opentui/react": "^0.2.15",
|
|
187
187
|
"@restatedev/restate-sdk": "^1.11.0",
|
|
188
188
|
"dockerode": "^5.0.0",
|
|
189
|
-
"e2b": "
|
|
189
|
+
"e2b": "^2.0.0",
|
|
190
190
|
"react": "^19.0.0",
|
|
191
191
|
"zod": ">=4.0.0"
|
|
192
192
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transcript-anchors-JbFJuSDh.d.ts","names":[],"sources":["../src/chat/agents.ts","../src/chat/hints.ts","../src/chat/completion.ts","../src/start/shared-options.ts","../src/chat/keybindings.ts","../src/chat/store.ts","../src/chat/xdg.ts","../src/chat/config.ts","../src/chat/mcps-discovery.ts","../src/chat/enabled-toggle-set.ts","../src/chat/interactions.tsx","../src/chat/markdown-segments.ts","../src/chat/session-export.ts","../src/chat/theme.ts","../src/chat/transcript-anchors.ts"],"mappings":";;;;;;;;;;;KA4BY,WAAA;;;AAW2D;AAYvE;;;;iBAdgB,WAAA,CACd,MAAA,EAAQ,WAAW,cACnB,KAAA;EAAS,KAAA;EAAe,MAAA;EAAgB,IAAA;EAAc,KAAA;AAAA;AAAA,UAYvC,YAAA;EAeK;EAbpB,EAAA;EAgBU;EAdV,KAAA;;EAEA,WAAA;EAYmC;;;;;;EALnC,MAAA,EAAQ,MAAA;EAKsD;EAH9D,MAAA,GAAS,WAAW;AAAA;AAAA,KAGV,aAAA,GAAgB,QAAA,CAAS,MAAA,SAAe,YAAA;;;AAwCnD;AAoBD;;;;AAIC;AA+GD;;;;AA8BC;AAQD;;;;AAWC;AAOD;;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