zidane 5.10.13 → 5.11.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 +26 -0
- package/dist/{agent-BHkvYIH9.d.ts → agent-B7ilLoh8.d.ts} +63 -4
- package/dist/agent-B7ilLoh8.d.ts.map +1 -0
- package/dist/chat/pure.d.ts +3 -3
- package/dist/chat.d.ts +6 -6
- package/dist/chat.js +2 -2
- package/dist/contexts/docker.d.ts +1 -1
- package/dist/contexts/docker.d.ts.map +1 -1
- package/dist/contexts/docker.js +53 -14
- package/dist/contexts/docker.js.map +1 -1
- package/dist/contexts/e2b.d.ts +168 -0
- package/dist/contexts/e2b.d.ts.map +1 -0
- package/dist/contexts/e2b.js +261 -0
- package/dist/contexts/e2b.js.map +1 -0
- package/dist/{contexts-BJVgG0LY.js → contexts-DglWSzmR.js} +59 -9
- package/dist/contexts-DglWSzmR.js.map +1 -0
- package/dist/contexts.d.ts +3 -3
- package/dist/contexts.js +1 -1
- package/dist/eval.d.ts +1 -1
- package/dist/eval.js +4 -4
- package/dist/{headless-CPaunZsU.js → headless-CYHU4ZB-.js} +6 -6
- package/dist/{headless-CPaunZsU.js.map → headless-CYHU4ZB-.js.map} +1 -1
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +1 -1
- package/dist/{index-C4aT2kO_.d.ts → index-C-zEbeFI.d.ts} +13 -101
- package/dist/index-C-zEbeFI.d.ts.map +1 -0
- package/dist/{index-C_t8tW_X.d.ts → index-CrMb8jCE.d.ts} +2 -2
- package/dist/{index-C_t8tW_X.d.ts.map → index-CrMb8jCE.d.ts.map} +1 -1
- package/dist/{index-BIo67xLV.d.ts → index-CsRdmSh6.d.ts} +10 -3
- package/dist/index-CsRdmSh6.d.ts.map +1 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/{interpolate-Dy7Lunvg.js → interpolate-CTfr0GdR.js} +19 -1
- package/dist/{interpolate-Dy7Lunvg.js.map → interpolate-CTfr0GdR.js.map} +1 -1
- package/dist/logger-Bd4Wn9Hc.d.ts +102 -0
- package/dist/logger-Bd4Wn9Hc.d.ts.map +1 -0
- package/dist/logger-Ktm-lj1s.js +300 -0
- package/dist/logger-Ktm-lj1s.js.map +1 -0
- package/dist/{login-0jP1pnSJ.js → login-DVLJzf-S.js} +4 -301
- package/dist/login-DVLJzf-S.js.map +1 -0
- package/dist/{mcp-tevNihk_.js → mcp-DPneQbw2.js} +21 -8
- package/dist/mcp-DPneQbw2.js.map +1 -0
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{messages-C_1AmSpk.js → messages-DJ7xdoUg.js} +5 -1
- package/dist/messages-DJ7xdoUg.js.map +1 -0
- package/dist/output/stream-json.d.ts +2 -2
- package/dist/output/stream-json.js +1 -1
- package/dist/output/terminal.d.ts +2 -2
- package/dist/output/terminal.js +1 -0
- package/dist/output/terminal.js.map +1 -1
- package/dist/{presets-Cm2BPJaU.js → presets-Q0yUDRA6.js} +2 -2
- package/dist/{presets-Cm2BPJaU.js.map → presets-Q0yUDRA6.js.map} +1 -1
- package/dist/presets.d.ts +2 -2
- package/dist/presets.js +1 -1
- package/dist/{providers-BGBB18zz.js → providers-BPdi7cUU.js} +73 -11
- package/dist/providers-BPdi7cUU.js.map +1 -0
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +2 -2
- package/dist/restate.d.ts +2 -2
- package/dist/restate.js +4 -1
- package/dist/restate.js.map +1 -1
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/session/sqlite.d.ts.map +1 -1
- package/dist/session/sqlite.js +36 -4
- package/dist/session/sqlite.js.map +1 -1
- package/dist/{session-CtAWwwkn.js → session-D4GckETs.js} +69 -21
- package/dist/session-D4GckETs.js.map +1 -0
- package/dist/session.d.ts +2 -2
- package/dist/session.js +3 -3
- package/dist/shell-quote-BmnhZmdM.js +33 -0
- package/dist/shell-quote-BmnhZmdM.js.map +1 -0
- package/dist/skills.d.ts +3 -3
- package/dist/skills.js +1 -1
- package/dist/skills.js.map +1 -1
- package/dist/{tool-formatters-D_fX6FGl.d.ts → tool-formatters-DXO8rGut.d.ts} +2 -2
- package/dist/{tool-formatters-D_fX6FGl.d.ts.map → tool-formatters-DXO8rGut.d.ts.map} +1 -1
- package/dist/tools/fetch-url.d.ts +1 -1
- package/dist/tools/web-search.d.ts +1 -1
- package/dist/{tools-NxnEmzYg.js → tools-DqNkGwfd.js} +80 -73
- package/dist/tools-DqNkGwfd.js.map +1 -0
- package/dist/tools.d.ts +2 -2
- package/dist/tools.js +1 -1
- package/dist/{transcript-anchors-B_c7gWot.js → transcript-anchors-C3tVPR5n.js} +8 -8
- package/dist/{transcript-anchors-B_c7gWot.js.map → transcript-anchors-C3tVPR5n.js.map} +1 -1
- package/dist/{transcript-anchors-DA6XawEU.d.ts → transcript-anchors-p-ZsBSEF.d.ts} +10 -4
- package/dist/transcript-anchors-p-ZsBSEF.d.ts.map +1 -0
- package/dist/tui.d.ts +3 -3
- package/dist/tui.js +151 -41
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-CCl7rpbT.d.ts → turn-operations-DD1D5VFx.d.ts} +3 -3
- package/dist/{turn-operations-CCl7rpbT.d.ts.map → turn-operations-DD1D5VFx.d.ts.map} +1 -1
- package/dist/{types-BibzMDjX.d.ts → types-B39tBba1.d.ts} +69 -2
- package/dist/types-B39tBba1.d.ts.map +1 -0
- package/dist/types.d.ts +5 -5
- package/docs/EXECUTION_CONTEXT.md +257 -0
- package/docs/RUN_IN_BACKGROUND.md +8 -0
- package/package.json +57 -24
- package/dist/agent-BHkvYIH9.d.ts.map +0 -1
- package/dist/contexts-BJVgG0LY.js.map +0 -1
- package/dist/index-BIo67xLV.d.ts.map +0 -1
- package/dist/index-C4aT2kO_.d.ts.map +0 -1
- package/dist/login-0jP1pnSJ.js.map +0 -1
- package/dist/mcp-tevNihk_.js.map +0 -1
- package/dist/messages-C_1AmSpk.js.map +0 -1
- package/dist/providers-BGBB18zz.js.map +0 -1
- package/dist/session-CtAWwwkn.js.map +0 -1
- package/dist/tools-NxnEmzYg.js.map +0 -1
- package/dist/transcript-anchors-DA6XawEU.d.ts.map +0 -1
- package/dist/types-BibzMDjX.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { D as Owner, E as EditPayload, G as ProviderKey, L as CompletionProvider, M as StreamEvent, R as CompletionReference, W as ProviderAuth, Y as ModelInfo, l as ApprovalDecision, w as EditOutcome } from "./tool-formatters-
|
|
1
|
+
import { An as ToolResultContent, Cn as SessionTurn, Fn as TurnUsage, k as SkillConfig } from "./agent-B7ilLoh8.js";
|
|
2
|
+
import { D as Owner, E as EditPayload, G as ProviderKey, L as CompletionProvider, M as StreamEvent, R as CompletionReference, W as ProviderAuth, Y as ModelInfo, l as ApprovalDecision, w as EditOutcome } from "./tool-formatters-DXO8rGut.js";
|
|
3
3
|
|
|
4
4
|
//#region src/chat/color-gradient.d.ts
|
|
5
5
|
/**
|
|
@@ -660,4 +660,4 @@ declare function countNeighbors(turnIds: readonly string[], turnId: string): {
|
|
|
660
660
|
} | null;
|
|
661
661
|
//#endregion
|
|
662
662
|
export { uniqueFilesFromReferences as $, buildUnifiedDiff as A, buildEditOutcomesAnnotation as B, EditSummary as C, PreviewResult as D, InlineSegment as E, previewEditPayload as F, rewriteMultiEditHeader as G, mergeApprovalAndBodyOutcomes as H, splitLines as I, SKILLS_TRIGGER as J, stripEditOutcomesAnnotation as K, summarizeEditPayload as L, computeLineDiff as M, extractEditPayload as N, applyEditPayload as O, filetypeFromPath as P, createFilesCompletionProvider as Q, tokenize as R, EditHunkSummary as S, InlineDiff as T, parseEditOutcomesFromResult as U, maskToOutcomeKinds as V, resolveApprovalForPayload as W, uniqueSkillNamesFromReferences as X, createSkillsCompletionProvider as Y, FILES_TRIGGER as Z, formatTaskSummary as _, finalizeStreamingMarkdown as a, DiffLine as b, CatalogEntry as c, indexOfEntry as d, FileEntry as et, ageString as f, formatTaskStatus as g, formatDuration as h, turnAsText as i, buildLinearRamp as it, computeInlineDiff as j, buildContextualDiff as k, buildModelCatalog as l, fmtTokens as m, deleteTurnSafely as n, listProjectFiles as nt, finalizeStreamingMarkdownForOwner as o, compactPath as p, summarizeOutcomes as q, truncateTurnsAt as r, blendHsl as rt, turnContextSize as s, countNeighbors as t, ListProjectFilesOptions as tt, filterModelCatalog as u, previewLine as v, HunkResolution as w, DiffOp as x, shortId as y, ResolvedApproval as z };
|
|
663
|
-
//# sourceMappingURL=turn-operations-
|
|
663
|
+
//# sourceMappingURL=turn-operations-DD1D5VFx.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turn-operations-
|
|
1
|
+
{"version":3,"file":"turn-operations-DD1D5VFx.d.ts","names":[],"sources":["../src/chat/color-gradient.ts","../src/chat/files-discovery.ts","../src/chat/completion-files.ts","../src/chat/completion-skills.ts","../src/chat/edit-approval.ts","../src/tools/edit-utils.ts","../src/chat/edit-diff.ts","../src/chat/format.ts","../src/chat/model-catalog.ts","../src/chat/streaming-pure.ts","../src/chat/turn-operations.ts"],"mappings":";;;;;;;;iBAmFgB,QAAA,CAAS,IAAA,UAAc,EAAA,UAAY,CAAA;AAAnD;;;;;AAAA,iBAuBgB,eAAA,CAAgB,IAAA,UAAc,EAAA,UAAY,CAAA;;;;;;;;AAvB1D;;;;;;;;AAA4D;AAAA,UC9D3C,SAAA;EDqFc;ECnF7B,IAAA;EDmF6B;ECjF7B,IAAA;EDiF4C;EC/E5C,MAAA;AAAA;AD+EiE;AAAA,UClClD,uBAAA;;EAEf,GAAA;EArDe;EAuDf,QAAA;;EAEA,MAAA,GAAS,WAAW;AAAA;;;;AAnDd;AA6CR;;;;;iBAkBsB,gBAAA,CAAiB,IAAA,GAAM,uBAAA,GAA+B,OAAA,CAAQ,SAAA;;;;cCrEvE,aAAA;AFqFb;;;;;;;;AAAmE;;;;ACrFnE;;;ADqFA,iBE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;;APAM;AA6CR;;;;;iBO7BgB,iBAAA,CAAkB,IAAA;EAChC,SAAA,WAAoB,YAAA;EACpB,SAAA,GAAY,GAAA,EAAK,WAAA,cAAyB,SAAA,IPiCtB;EO/BpB,OAAA;IAAY,WAAA,EAAa,WAAA;IAAa,OAAA;EAAA;AAAA,IACpC,YAAA;;;;;;;;;;AP0CyF;iBOD7E,kBAAA,CACd,OAAA,WAAkB,YAAA,IAClB,KAAA,WACC,YAAY;;;ANvEf;;;iBMoFgB,YAAA,CACd,OAAA,WAAkB,YAAA,IAClB,MAAA;EAAU,WAAA,EAAa,WAAW;EAAE,OAAA;AAAA;;;;iBCvFtB,yBAAA,CAA0B,MAAA,EAAQ,WAAA,KAAgB,WAAW;AT+DjB;AAAA,iBSlD5C,iCAAA,CAAkC,MAAA,EAAQ,WAAA,IAAe,KAAA,EAAO,KAAA,GAAQ,WAAA;;;;;;;;ATyErB;;;;ACrFnE;iBQwCgB,eAAA,CAAgB,KAA4B,EAArB,SAAS;;;AT6ChD;;;;;;;;AAAmE;;;;ACrFnE;;;;;ADqFA,iBUzEgB,eAAA,CAAgB,KAAA,WAAgB,WAAA,IAAe,MAAA,WAAiB,WAAW;;;ATNnF;AA6CR;;;;;;;;;AAMsB;AAYtB;;;;iBShCgB,gBAAA,CAAiB,KAAA,WAAgB,WAAA,IAAe,MAAA,WAAiB,WAAW;;;;;;;;;iBAwD5E,UAAA,CAAW,IAAiB,EAAX,WAAW;;;;AR7F5C;;iBQ4HgB,cAAA,CACd,OAAA,qBACA,MAAA;EACG,MAAA;EAAgB,KAAA;AAAA"}
|
|
@@ -60,8 +60,31 @@ interface ExecResult {
|
|
|
60
60
|
interface SpawnConfig {
|
|
61
61
|
/** Working directory (created if it doesn't exist) */
|
|
62
62
|
cwd?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Optional workspace-containment root for the file methods (`readFile`,
|
|
65
|
+
* `writeFile`, `listFiles`) of the process context.
|
|
66
|
+
*
|
|
67
|
+
* When set, a resolved path that escapes this root (via absolute path,
|
|
68
|
+
* `..`, or a symlink pointing outside) is rejected before any I/O. Default
|
|
69
|
+
* unset = no containment (back-compat; the agent can read/write anywhere
|
|
70
|
+
* the host process can). Set this for untrusted workloads to confine file
|
|
71
|
+
* tools to a directory. Shell commands are not covered — use a sandbox /
|
|
72
|
+
* docker context for full isolation.
|
|
73
|
+
*/
|
|
74
|
+
workspaceRoot?: string;
|
|
63
75
|
/** Environment variables */
|
|
64
76
|
env?: Record<string, string>;
|
|
77
|
+
/**
|
|
78
|
+
* Whether spawned shells inherit the parent `process.env` (process context).
|
|
79
|
+
*
|
|
80
|
+
* Default `true` (preserves existing behavior — children see the parent
|
|
81
|
+
* environment including anything Bun auto-loaded from `.env`). Set `false`
|
|
82
|
+
* for untrusted workloads so secrets in the parent environment aren't
|
|
83
|
+
* readable by tool commands; only `env` / per-call env plus a minimal base
|
|
84
|
+
* (`PATH`, `HOME`, `SHELL`, `LANG`, `LC_ALL`, `USER`, `TERM`, `TMPDIR`) are
|
|
85
|
+
* passed through.
|
|
86
|
+
*/
|
|
87
|
+
inheritEnv?: boolean;
|
|
65
88
|
/** Docker image (only for 'docker' context) */
|
|
66
89
|
image?: string;
|
|
67
90
|
/** Docker container name prefix (only for 'docker' context) */
|
|
@@ -78,6 +101,12 @@ interface SpawnConfig {
|
|
|
78
101
|
sandbox?: {
|
|
79
102
|
provider: string;
|
|
80
103
|
apiKey?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Attach to a pre-existing sandbox by id rather than creating one
|
|
106
|
+
* (provider-specific; E2B maps it to `Sandbox.connect`). The provider
|
|
107
|
+
* leaves a connected sandbox running on teardown.
|
|
108
|
+
*/
|
|
109
|
+
sandboxId?: string;
|
|
81
110
|
[key: string]: unknown;
|
|
82
111
|
};
|
|
83
112
|
/**
|
|
@@ -128,6 +157,44 @@ interface SpawnConfig {
|
|
|
128
157
|
* a label they own: `docker ps -aq --filter label=my-app=true`.
|
|
129
158
|
*/
|
|
130
159
|
labels?: Record<string, string>;
|
|
160
|
+
/**
|
|
161
|
+
* Container hardening options (docker context only).
|
|
162
|
+
*
|
|
163
|
+
* All fields are opt-in and OFF by default to preserve existing behavior
|
|
164
|
+
* (containers run with the image's default user/capabilities). Enable them
|
|
165
|
+
* for untrusted workloads. `dropAllCapabilities` and a non-root `user`
|
|
166
|
+
* (see {@link SpawnConfig.user}) can break images that expect root or
|
|
167
|
+
* specific capabilities, so they are not applied unless requested.
|
|
168
|
+
*/
|
|
169
|
+
hardening?: ContextHardening;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Opt-in container hardening for the docker context. Every field defaults to
|
|
173
|
+
* "unset" so an omitted `hardening` (or omitted field) reproduces the prior,
|
|
174
|
+
* unrestricted behavior — this keeps the option purely additive.
|
|
175
|
+
*/
|
|
176
|
+
interface ContextHardening {
|
|
177
|
+
/**
|
|
178
|
+
* Drop all Linux capabilities (`CapDrop: ['ALL']`). Strong isolation, but
|
|
179
|
+
* breaks images needing capabilities (e.g. binding low ports, `ping`).
|
|
180
|
+
* Default: `false`.
|
|
181
|
+
*/
|
|
182
|
+
dropAllCapabilities?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Set `no-new-privileges` so processes can't gain privileges via setuid
|
|
185
|
+
* binaries. Low blast radius; safe for most workloads. Default: `false`.
|
|
186
|
+
*/
|
|
187
|
+
noNewPrivileges?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Mount the container root filesystem read-only. Pair with writable mounts
|
|
190
|
+
* for scratch space. Default: `false`.
|
|
191
|
+
*/
|
|
192
|
+
readonlyRootfs?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Max number of processes (`PidsLimit`) — caps fork-bombs. Default: unset
|
|
195
|
+
* (no limit). A few hundred is usually plenty for an agent sandbox.
|
|
196
|
+
*/
|
|
197
|
+
pidsLimit?: number;
|
|
131
198
|
}
|
|
132
199
|
interface ContextMount {
|
|
133
200
|
/** Absolute host path to mount. */
|
|
@@ -420,5 +487,5 @@ interface TaskStallInfo {
|
|
|
420
487
|
bytesWritten: number;
|
|
421
488
|
}
|
|
422
489
|
//#endregion
|
|
423
|
-
export {
|
|
424
|
-
//# sourceMappingURL=types-
|
|
490
|
+
export { ContextType as a, ExecutionContext as c, TaskEntry as d, TaskExitInfo as f, resolveDetachedTasksCapability as h, ContextMount as i, ExecutionHandle as l, TaskStallInfo as m, ContextCapabilities as n, DetachedTasksCapability as o, TaskHandle as p, ContextHardening as r, ExecResult as s, BackgroundTaskStatus as t, SpawnConfig as u };
|
|
491
|
+
//# sourceMappingURL=types-B39tBba1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-B39tBba1.d.ts","names":[],"sources":["../src/contexts/types.ts"],"mappings":";;AA4BA;;;;AAAmC;AAEnC;;;;;;;;;;;AAeyC;AAOzC;;;;;KAxBY,uBAAA;AAAA,UAEK,mBAAA;EAsBiF;EApBhG,KAAA;EA8Be;EA5Bf,UAAA;;EAEA,OAAA;EA2BA;EAzBA,GAAA;EA0BM;;;AAEH;AAOL;;EA5BE,aAAA,GAAgB,uBAAuB;AAAA;;;;;iBAOzB,8BAAA,CAA+B,OAAA,EAAS,gBAAA,GAAmB,uBAAuB;AA+BlG;AAAA,UArBiB,eAAA;EACf,EAAA;EACA,IAAA,EAAM,WAAW;EAoDR;EAlDT,GAAA;AAAA;AAAA,UAOe,UAAA;EACf,MAAA;EACA,MAAA;EACA,QAAA;AAAA;AAAA,UAOe,WAAA;EAgBT;EAdN,GAAA;EA2BA;;;;;;;;;;;EAfA,aAAA;EAuCG;EArCH,GAAA,GAAM,MAAA;EA0DN;;;;;;;;;;EA/CA,UAAA;EAuF4B;EArF5B,KAAA;EA6Fe;EA3Ff,IAAA;;EAEA,MAAA,GAAS,YAAA;EA+FT;EA7FA,MAAA;IAuGA,yBArGE,MAAA,WA0GO;IAxGP,GAAA,WA2Ga;IAzGb,OAAA;EAAA;EAyGyB;EAtG3B,OAAA;IACE,QAAA;I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AA,GAAS,MAAA,CAAO,OAAA;EAChB,UAAA;;EAEA,UAAA;;EAEA,OAAA;AAAA;;;;;;UAQe,SAAA;EACf,MAAA;EACA,GAAA;EACA,OAAA;EACA,GAAA;EACA,SAAA;;;;;;EAMA,OAAA;EACA,UAAA;EACA,MAAA,EAAQ,oBAAA;EACR,QAAA;EACA,MAAA,GAAS,MAAA,CAAO,OAAO;;EAEvB,YAAA;AAAA;;;;;;;UASe,aAAA;EACf,MAAA;EACA,OAAA;EACA,UAAA;;EAEA,YAAA;;EAEA,YAAA;AAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $t as
|
|
2
|
-
import { a as
|
|
3
|
-
import { t as SandboxProvider } from "./index-
|
|
4
|
-
import { C as ModelUsage, T as statsByModel,
|
|
5
|
-
export { type Agent, AgentAbortedError, type AgentBehavior, AgentBudgetExceededError, type AgentClock, AgentContextExceededError, type AgentHooks, type AgentOptions, AgentProviderError, type AgentRunOptions, type AgentStats, AgentToolNotAllowedError, type AnthropicParams, type BackgroundTaskStatus, CONTEXT_EXCEEDED_MESSAGE_PATTERNS, type CerebrasParams, type ChildAgent, type ChildRunStats, type ClassifiedError, type ClassifiedErrorKind, type ContextCapabilities, type ContextType, type CreateSessionOptions, DEFAULT_AGENT_CLOCK, type DetachedTasksCapability, type ExecResult, type ExecutionContext, type ExecutionHandle, type InteractionToolOptions, type McpConnection, type McpServerConfig, type McpToolHookContext, type ModelUsage, type OAuthRefreshHookContext, type OpenAIParams, type OpenRouterParams, type Preset, type PromptDocumentPart, type PromptImagePart, type PromptPart, type PromptTextPart, type Provider, type ProviderCapabilities, type ReadStateEntry, type ReadStateMap, type RemoteStoreOptions, type RepeatGuardConfig, type RepeatGuardToolMatcher, type RetryConfig, type RunHookMap, type SandboxProvider, type Session, type SessionContentBlock, type SessionData, type SessionEndStatus, type SessionHookContext, type SessionMessage, type SessionRun, type SessionStore, type SessionTurn, type SkillConfig, type SkillResource, type SkillsConfig, type SpawnConfig, type SpawnHookContext, type SpawnToolOptions, type SpawnToolState, type StreamCallbacks, type StreamHookContext, type StreamOptions, type TaskEntry, type TaskExitInfo, type TaskHandle, type TaskStallInfo, type ThinkingLevel, type ToolCall, type ToolContext, type ToolDef, type ToolHookContext, type ToolMap, type ToolOutcome, type ToolResult, type ToolResultContent, type ToolResultDocumentContent, type ToolResultImageContent, type ToolResultTextContent, type ToolSpec, type TurnFinishReason, type TurnResult, type TurnUsage, type ValidationResult, flattenTurns, matchesContextExceeded, statsByModel, toolOutputBudgetByteLength, toolOutputByteLength, toolResultToText };
|
|
1
|
+
import { $t as AgentClock, An as ToolResultContent, Bn as AgentBudgetExceededError, C as ReadStateMap, Cn as SessionTurn, En as ThinkingLevel, F as Session, Fn as TurnUsage, Gn as CONTEXT_EXCEEDED_MESSAGE_PATTERNS, H as RemoteStoreOptions, Hn as AgentProviderError, Ht as CerebrasParams, I as SessionData, In as toolOutputBudgetByteLength, It as OpenAIParams, Kn as ClassifiedError, L as SessionRun, Ln as toolOutputByteLength, Mn as ToolResultImageContent, N as SkillsConfig, Nn as ToolResultTextContent, On as ToolHookContext, Ot as OpenRouterParams, P as CreateSessionOptions, Pn as TurnFinishReason, Qt as AgentBehavior, R as SessionStore, Rn as toolResultToText, S as ReadStateEntry, Sn as SessionMessage, St as TurnResult, Tn as StreamHookContext, Un as AgentToolNotAllowedError, Vn as AgentContextExceededError, Yn as matchesContextExceeded, Yt as AnthropicParams, _n as RetryConfig, _t as StreamOptions, b as ToolDef, bn as SessionEndStatus, bt as ToolResult, cn as McpToolHookContext, dn as PromptDocumentPart, en as AgentRunOptions, fn as PromptImagePart, gn as RepeatGuardToolMatcher, gt as StreamCallbacks, hn as RepeatGuardConfig, ht as ProviderCapabilities, i as AgentOptions, in as DEFAULT_AGENT_CLOCK, j as SkillResource, jn as ToolResultDocumentContent, k as SkillConfig, kn as ToolOutcome, mn as PromptTextPart, mt as Provider, n as AgentHookMap, nn as ChildRunStats, p as McpConnection, pn as PromptPart, qn as ClassifiedErrorKind, r as AgentHooks, sn as McpServerConfig, t as Agent, tn as AgentStats, un as OAuthRefreshHookContext, vn as RunHookMap, wn as SpawnHookContext, x as ToolMap, xn as SessionHookContext, xt as ToolSpec, y as ToolContext, yn as SessionContentBlock, yt as ToolCall, zn as AgentAbortedError } from "./agent-B7ilLoh8.js";
|
|
2
|
+
import { a as ContextType, c as ExecutionContext, d as TaskEntry, f as TaskExitInfo, l as ExecutionHandle, m as TaskStallInfo, n as ContextCapabilities, o as DetachedTasksCapability, p as TaskHandle, r as ContextHardening, s as ExecResult, t as BackgroundTaskStatus, u as SpawnConfig } from "./types-B39tBba1.js";
|
|
3
|
+
import { t as SandboxProvider } from "./index-CrMb8jCE.js";
|
|
4
|
+
import { C as ModelUsage, T as statsByModel, Xn as ValidationResult, br as InteractionToolOptions, nr as SpawnToolOptions, rr as SpawnToolState, t as Preset, tr as ChildAgent, w as flattenTurns } from "./index-C-zEbeFI.js";
|
|
5
|
+
export { type Agent, AgentAbortedError, type AgentBehavior, AgentBudgetExceededError, type AgentClock, AgentContextExceededError, type AgentHookMap, type AgentHooks, type AgentOptions, AgentProviderError, type AgentRunOptions, type AgentStats, AgentToolNotAllowedError, type AnthropicParams, type BackgroundTaskStatus, CONTEXT_EXCEEDED_MESSAGE_PATTERNS, type CerebrasParams, type ChildAgent, type ChildRunStats, type ClassifiedError, type ClassifiedErrorKind, type ContextCapabilities, type ContextHardening, type ContextType, type CreateSessionOptions, DEFAULT_AGENT_CLOCK, type DetachedTasksCapability, type ExecResult, type ExecutionContext, type ExecutionHandle, type InteractionToolOptions, type McpConnection, type McpServerConfig, type McpToolHookContext, type ModelUsage, type OAuthRefreshHookContext, type OpenAIParams, type OpenRouterParams, type Preset, type PromptDocumentPart, type PromptImagePart, type PromptPart, type PromptTextPart, type Provider, type ProviderCapabilities, type ReadStateEntry, type ReadStateMap, type RemoteStoreOptions, type RepeatGuardConfig, type RepeatGuardToolMatcher, type RetryConfig, type RunHookMap, type SandboxProvider, type Session, type SessionContentBlock, type SessionData, type SessionEndStatus, type SessionHookContext, type SessionMessage, type SessionRun, type SessionStore, type SessionTurn, type SkillConfig, type SkillResource, type SkillsConfig, type SpawnConfig, type SpawnHookContext, type SpawnToolOptions, type SpawnToolState, type StreamCallbacks, type StreamHookContext, type StreamOptions, type TaskEntry, type TaskExitInfo, type TaskHandle, type TaskStallInfo, type ThinkingLevel, type ToolCall, type ToolContext, type ToolDef, type ToolHookContext, type ToolMap, type ToolOutcome, type ToolResult, type ToolResultContent, type ToolResultDocumentContent, type ToolResultImageContent, type ToolResultTextContent, type ToolSpec, type TurnFinishReason, type TurnResult, type TurnUsage, type ValidationResult, flattenTurns, matchesContextExceeded, statsByModel, toolOutputBudgetByteLength, toolOutputByteLength, toolResultToText };
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# Execution Contexts
|
|
2
|
+
|
|
3
|
+
Zidane runs the agent's shell commands and file operations inside an **execution
|
|
4
|
+
context**. You pick one with `--context`:
|
|
5
|
+
|
|
6
|
+
| Context | Isolation | Use it when |
|
|
7
|
+
|---------|-----------|-------------|
|
|
8
|
+
| `process` (default) | None — runs on the host | You trust the prompt and want the fastest path with full host access. |
|
|
9
|
+
| `docker` | Container | You want a disposable, isolated environment on your own machine. |
|
|
10
|
+
| `e2b` | Remote micro-VM sandbox | You want isolation off-box, on E2B's hosted cloud or a self-hosted cluster. |
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
bun start --prompt "build a TODO API" # process (default)
|
|
14
|
+
bun start --prompt "build a TODO API" --context docker # docker
|
|
15
|
+
bun start --prompt "build a TODO API" --context e2b # e2b
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The same flags work for the non-interactive CLI:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
bun run headless "build a TODO API" --context e2b
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Every context implements the same interface (spawn → exec / read / write / list
|
|
25
|
+
files → destroy), so the agent behaves identically regardless of which one you
|
|
26
|
+
choose. What changes is *where* the work runs, *how it's isolated*, and a few
|
|
27
|
+
context-specific flags.
|
|
28
|
+
|
|
29
|
+
## Flags at a glance
|
|
30
|
+
|
|
31
|
+
| Flag | `process` | `docker` | `e2b` | Meaning |
|
|
32
|
+
|------|:---------:|:--------:|:-----:|---------|
|
|
33
|
+
| `--context <name>` | ✓ | ✓ | ✓ | Select the context (`process` \| `docker` \| `e2b`). |
|
|
34
|
+
| `--cwd <dir>` | ✓ | ✓ | ✓ | Working directory for the agent's commands. |
|
|
35
|
+
| `--env KEY=VALUE` | ✓ | ✓ | ✓ | Set an environment variable (repeatable). |
|
|
36
|
+
| `--pass-env VARNAME` | ✓ | ✓ | ✓ | Forward a host env var into the context by name (repeatable). |
|
|
37
|
+
| `--image <name>` | — | ✓ | — | Docker image to run. |
|
|
38
|
+
| `--pregame <file>` | warns | warns | ✓ | Setup script to run before prompting. |
|
|
39
|
+
| `--sandbox <id>` | warns | warns | ✓ | Attach to an existing E2B sandbox. |
|
|
40
|
+
|
|
41
|
+
"warns" means the flag is accepted but ignored with a warning when it doesn't
|
|
42
|
+
apply to the selected context.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## The `e2b` context
|
|
47
|
+
|
|
48
|
+
E2B gives the agent a fresh, isolated micro-VM in the cloud (or on a self-hosted
|
|
49
|
+
E2B cluster). The sandbox is created when the run starts and destroyed when it
|
|
50
|
+
ends.
|
|
51
|
+
|
|
52
|
+
### Prerequisites
|
|
53
|
+
|
|
54
|
+
Install the E2B SDK — it's an optional dependency that the provider imports
|
|
55
|
+
lazily:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
bun add e2b
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Configure which E2B you talk to via environment variables:
|
|
62
|
+
|
|
63
|
+
| Variable | Required | Purpose |
|
|
64
|
+
|----------|:--------:|---------|
|
|
65
|
+
| `E2B_API_KEY` | yes | Authenticates with E2B. |
|
|
66
|
+
| `E2B_DOMAIN` | no | Point at a self-hosted / on-prem cluster instead of E2B's hosted API. |
|
|
67
|
+
| `E2B_TEMPLATE` | no | Sandbox template to launch (defaults to `base`). |
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
export E2B_API_KEY=e2b_xxxxxxxxxxxxxxxx
|
|
71
|
+
bun start --prompt "run the test suite" --context e2b
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
> **Self-hosted clusters:** the default `base` template does **not** exist on
|
|
75
|
+
> self-hosted clusters. Set `E2B_TEMPLATE` to a template that actually exists
|
|
76
|
+
> there. An invalid template still returns a sandbox id, but the sandbox never
|
|
77
|
+
> finishes booting and every command then hangs until it times out.
|
|
78
|
+
|
|
79
|
+
### Choosing a working directory
|
|
80
|
+
|
|
81
|
+
By default the provider discovers the sandbox's home directory by running `pwd`
|
|
82
|
+
inside it (rather than assuming `/home/user`, which doesn't exist on every
|
|
83
|
+
template). To pin a specific directory, pass `--cwd`; the provider creates it
|
|
84
|
+
with `mkdir -p` before the agent runs:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
bun start --prompt "..." --context e2b --cwd /home/user/project
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Running a setup script before the agent starts
|
|
91
|
+
|
|
92
|
+
Use `--pregame` to provision the sandbox — install packages, clone a repo, seed
|
|
93
|
+
data — *before* the agent's first turn:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
bun start --prompt "fix the failing tests" --context e2b --pregame setup.sh
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Write the script with a shebang; its interpreter selects how it runs:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
#!/bin/bash
|
|
103
|
+
set -e
|
|
104
|
+
apt-get update && apt-get install -y ripgrep
|
|
105
|
+
pip install -r requirements.txt
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Pregame behavior:
|
|
109
|
+
|
|
110
|
+
- **E2B only** — ignored (with a warning) for `process` and `docker`.
|
|
111
|
+
- The script is uploaded to `/tmp/<filename>` and executed in the resolved
|
|
112
|
+
`--cwd` with your configured environment.
|
|
113
|
+
- It gets a generous **30-minute** timeout, so long `apt`/`pip` installs aren't
|
|
114
|
+
killed mid-run.
|
|
115
|
+
- A **non-zero exit aborts the whole run** — if setup fails, the sandbox is torn
|
|
116
|
+
down and the agent never starts.
|
|
117
|
+
|
|
118
|
+
### Connecting to an existing sandbox
|
|
119
|
+
|
|
120
|
+
Pass `--sandbox <id>` to attach to a sandbox you already created instead of
|
|
121
|
+
spinning up a fresh one:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
bun start --prompt "add a feature" --context e2b --sandbox sbx-abc123def456
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The ownership difference matters:
|
|
128
|
+
|
|
129
|
+
- **Sandboxes Zidane creates** are owned by the run — they're killed on exit, and
|
|
130
|
+
also killed if the readiness probe or pregame setup fails.
|
|
131
|
+
- **Sandboxes you connect to** with `--sandbox` are never killed by Zidane, even
|
|
132
|
+
on failure. You manage their lifecycle yourself.
|
|
133
|
+
|
|
134
|
+
### What happens on spawn
|
|
135
|
+
|
|
136
|
+
1. Create the sandbox (`Sandbox.create`) — or connect to it (`Sandbox.connect`)
|
|
137
|
+
if `--sandbox` was given.
|
|
138
|
+
2. **Readiness probe:** poll a trivial command until the sandbox responds (up to
|
|
139
|
+
60s). You'll see `waiting for E2B sandbox to initialize` followed by
|
|
140
|
+
`E2B sandbox ready` on stderr. On timeout, an owned sandbox is killed.
|
|
141
|
+
3. Resolve the working directory (`mkdir -p` your `--cwd`, or discover via `pwd`).
|
|
142
|
+
4. Run the pregame script, if any.
|
|
143
|
+
5. Hand control to the agent.
|
|
144
|
+
|
|
145
|
+
Your configured environment (`--env` / `--pass-env`) is re-sent on **every**
|
|
146
|
+
command, so a warm or pre-provisioned sandbox never loses it.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## The `docker` context
|
|
151
|
+
|
|
152
|
+
Docker runs the agent inside a container on your own machine — isolated, but
|
|
153
|
+
local and offline-friendly.
|
|
154
|
+
|
|
155
|
+
### Prerequisites
|
|
156
|
+
|
|
157
|
+
- A running Docker daemon.
|
|
158
|
+
- The `dockerode` library (an optional dependency, imported lazily):
|
|
159
|
+
```bash
|
|
160
|
+
bun add dockerode
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Basic usage
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
bun start --prompt "build the project" --context docker
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
This launches the default image (`oven/bun:latest`) with the working directory
|
|
170
|
+
defaulting to `/workspace`.
|
|
171
|
+
|
|
172
|
+
### Choosing an image
|
|
173
|
+
|
|
174
|
+
Use `--image` to run any Docker image. It's pulled automatically if it isn't
|
|
175
|
+
already present locally:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
bun start --prompt "run pytest" --context docker --image python:3.12
|
|
179
|
+
bun start --prompt "build with Node" --context docker --image node:22 --cwd /app
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Environment variables
|
|
183
|
+
|
|
184
|
+
`--env` and `--pass-env` work the same as the other contexts:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
bun start --prompt "..." --context docker \
|
|
188
|
+
--env NODE_ENV=production \
|
|
189
|
+
--pass-env HOME
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Lifecycle
|
|
193
|
+
|
|
194
|
+
The container runs `sleep infinity` and stays alive for the duration of the run;
|
|
195
|
+
each agent command is executed inside it. When the run ends, the container is
|
|
196
|
+
stopped and removed.
|
|
197
|
+
|
|
198
|
+
> Advanced container options — bind mounts, port mappings, a specific run user,
|
|
199
|
+
> a custom network, resource limits — are available through the programmatic
|
|
200
|
+
> `SpawnConfig` API (`createDockerContext`), not through `bun start` flags. The
|
|
201
|
+
> CLI exposes `--image`, `--cwd`, `--env`, and `--pass-env`.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## The `process` context (default)
|
|
206
|
+
|
|
207
|
+
The default context runs commands directly on the host via child processes — no
|
|
208
|
+
container, no VM, no isolation. It's the fastest path and gives the agent full
|
|
209
|
+
access to your filesystem and network. Use it when you trust the prompt.
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
bun start --prompt "summarize the README" # uses process
|
|
213
|
+
bun run headless "fix the lint errors" --cwd /tmp/project
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Applicable flags: `--cwd` (defaults to the current directory), `--env`, and
|
|
217
|
+
`--pass-env`. The `--image`, `--pregame`, and `--sandbox` flags don't apply.
|
|
218
|
+
|
|
219
|
+
Because there's no isolation, the agent's commands can read and modify anything
|
|
220
|
+
your own shell can. Prefer `docker` or `e2b` when you don't fully trust what the
|
|
221
|
+
agent might run.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Programmatic use
|
|
226
|
+
|
|
227
|
+
The CLI flags map onto context factories you can call directly:
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
import { createProcessContext, createSandboxContext } from 'zidane/contexts'
|
|
231
|
+
import { createDockerContext } from 'zidane/contexts/docker'
|
|
232
|
+
import { createE2BProvider } from 'zidane/contexts/e2b'
|
|
233
|
+
|
|
234
|
+
// process
|
|
235
|
+
const proc = createProcessContext({ cwd: '/tmp/work', env: { CI: '1' } })
|
|
236
|
+
|
|
237
|
+
// docker
|
|
238
|
+
const docker = createDockerContext({ image: 'python:3.12', cwd: '/app' })
|
|
239
|
+
|
|
240
|
+
// e2b
|
|
241
|
+
const e2b = createSandboxContext(createE2BProvider({
|
|
242
|
+
cwd: '/home/user/project',
|
|
243
|
+
env: { NODE_ENV: 'development' },
|
|
244
|
+
pregame: { name: 'setup.sh', content: '#!/bin/bash\nnpm install\n' },
|
|
245
|
+
}))
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
The Docker factory accepts the full advanced `SpawnConfig` (mounts, ports, user,
|
|
249
|
+
network, labels, resource limits) that the CLI doesn't surface.
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## See also
|
|
254
|
+
|
|
255
|
+
- [HEADLESS.md](HEADLESS.md) — the non-interactive CLI contract.
|
|
256
|
+
- [ARCHITECTURE.md](ARCHITECTURE.md) — agent lifecycle, context teardown
|
|
257
|
+
ordering, and background-task semantics.
|
|
@@ -230,6 +230,14 @@ The single biggest UX win over polling. When a background task exits, the framew
|
|
|
230
230
|
- **Drain at run start**: `agent.run()`'s loop checks the queue early (before building the first turn's wire messages) and prepends `<task-notification>` blocks to the leading user-turn content.
|
|
231
231
|
- **Latch via `task.notified`**: when the model already read the task's output file OR killed it via `shell_kill`, the latch flips and the notification is suppressed. Prevents the "task exited, model already killed it, framework still pushes a notification" double-signal that Claude Code's bug stream documents.
|
|
232
232
|
|
|
233
|
+
### Auto-wake (host-driven delivery)
|
|
234
|
+
|
|
235
|
+
The drain above is **passive** — it fires at the start of the next `run()`, which in interactive use means "whenever the user happens to type". Without help from the host, a task that exits while the agent is idle would never reach the model at all (the model ended its turn on the promise that "the notification IS the wake-up"). Two pieces close that gap:
|
|
236
|
+
|
|
237
|
+
- **`agent.hasPendingTaskNotifications`** (framework): `true` while at least one un-suppressed exit is queued. The host's wake signal.
|
|
238
|
+
- **Prompt-less wake runs** (framework): `agent.run({ prompt: '' })` is legal when notifications are pending, even though the session's trailing turn is a completed assistant message — the run-start drain seeds a user turn carrying ONLY the `<task-notification>` block(s). With nothing pending, the usual `cannot resume without prompt` guard still applies.
|
|
239
|
+
- **TUI wiring** (host): the `background:exit` hook triggers a drain-only run when the agent is idle; the post-run follow-up drain (`drainFollowUps` in `app.tsx`) re-checks after every run so exits that landed *mid-run* are delivered as soon as the run ends. Wake runs skip the user-prompt echo (the live exit banner already painted) and are suppressed after an esc/abort until the user's next prompt — a run silently restarting itself after the user said "stop" would override their intent.
|
|
240
|
+
|
|
233
241
|
### Wire format
|
|
234
242
|
|
|
235
243
|
A `<task-notification>` block prepended to the next user-turn content:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zidane",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.11.0",
|
|
4
4
|
"description": "an agent that goes straight to the goal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -17,92 +17,120 @@
|
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
|
-
"import": "./dist/index.js"
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"default": "./dist/index.js"
|
|
21
22
|
},
|
|
22
23
|
"./types": {
|
|
23
24
|
"types": "./dist/types.d.ts",
|
|
24
|
-
"import": "./dist/types.js"
|
|
25
|
+
"import": "./dist/types.js",
|
|
26
|
+
"default": "./dist/types.js"
|
|
25
27
|
},
|
|
26
28
|
"./output": {
|
|
27
29
|
"types": "./dist/output.d.ts",
|
|
28
|
-
"import": "./dist/output.js"
|
|
30
|
+
"import": "./dist/output.js",
|
|
31
|
+
"default": "./dist/output.js"
|
|
29
32
|
},
|
|
30
33
|
"./output/terminal": {
|
|
31
34
|
"types": "./dist/output/terminal.d.ts",
|
|
32
|
-
"import": "./dist/output/terminal.js"
|
|
35
|
+
"import": "./dist/output/terminal.js",
|
|
36
|
+
"default": "./dist/output/terminal.js"
|
|
33
37
|
},
|
|
34
38
|
"./output/stream-json": {
|
|
35
39
|
"types": "./dist/output/stream-json.d.ts",
|
|
36
|
-
"import": "./dist/output/stream-json.js"
|
|
40
|
+
"import": "./dist/output/stream-json.js",
|
|
41
|
+
"default": "./dist/output/stream-json.js"
|
|
37
42
|
},
|
|
38
43
|
"./providers": {
|
|
39
44
|
"types": "./dist/providers.d.ts",
|
|
40
|
-
"import": "./dist/providers.js"
|
|
45
|
+
"import": "./dist/providers.js",
|
|
46
|
+
"default": "./dist/providers.js"
|
|
41
47
|
},
|
|
42
48
|
"./tools": {
|
|
43
49
|
"types": "./dist/tools.d.ts",
|
|
44
|
-
"import": "./dist/tools.js"
|
|
50
|
+
"import": "./dist/tools.js",
|
|
51
|
+
"default": "./dist/tools.js"
|
|
45
52
|
},
|
|
46
53
|
"./tools/web-search": {
|
|
47
54
|
"types": "./dist/tools/web-search.d.ts",
|
|
48
|
-
"import": "./dist/tools/web-search.js"
|
|
55
|
+
"import": "./dist/tools/web-search.js",
|
|
56
|
+
"default": "./dist/tools/web-search.js"
|
|
49
57
|
},
|
|
50
58
|
"./tools/fetch-url": {
|
|
51
59
|
"types": "./dist/tools/fetch-url.d.ts",
|
|
52
|
-
"import": "./dist/tools/fetch-url.js"
|
|
60
|
+
"import": "./dist/tools/fetch-url.js",
|
|
61
|
+
"default": "./dist/tools/fetch-url.js"
|
|
53
62
|
},
|
|
54
63
|
"./presets": {
|
|
55
64
|
"types": "./dist/presets.d.ts",
|
|
56
|
-
"import": "./dist/presets.js"
|
|
65
|
+
"import": "./dist/presets.js",
|
|
66
|
+
"default": "./dist/presets.js"
|
|
57
67
|
},
|
|
58
68
|
"./contexts": {
|
|
59
69
|
"types": "./dist/contexts.d.ts",
|
|
60
|
-
"import": "./dist/contexts.js"
|
|
70
|
+
"import": "./dist/contexts.js",
|
|
71
|
+
"default": "./dist/contexts.js"
|
|
61
72
|
},
|
|
62
73
|
"./contexts/docker": {
|
|
63
74
|
"types": "./dist/contexts/docker.d.ts",
|
|
64
|
-
"import": "./dist/contexts/docker.js"
|
|
75
|
+
"import": "./dist/contexts/docker.js",
|
|
76
|
+
"default": "./dist/contexts/docker.js"
|
|
77
|
+
},
|
|
78
|
+
"./contexts/e2b": {
|
|
79
|
+
"types": "./dist/contexts/e2b.d.ts",
|
|
80
|
+
"import": "./dist/contexts/e2b.js",
|
|
81
|
+
"default": "./dist/contexts/e2b.js"
|
|
65
82
|
},
|
|
66
83
|
"./mcp": {
|
|
67
84
|
"types": "./dist/mcp.d.ts",
|
|
68
|
-
"import": "./dist/mcp.js"
|
|
85
|
+
"import": "./dist/mcp.js",
|
|
86
|
+
"default": "./dist/mcp.js"
|
|
69
87
|
},
|
|
70
88
|
"./session": {
|
|
71
89
|
"types": "./dist/session.d.ts",
|
|
72
|
-
"import": "./dist/session.js"
|
|
90
|
+
"import": "./dist/session.js",
|
|
91
|
+
"default": "./dist/session.js"
|
|
73
92
|
},
|
|
74
93
|
"./session/sqlite": {
|
|
75
94
|
"types": "./dist/session/sqlite.d.ts",
|
|
76
|
-
"import": "./dist/session/sqlite.js"
|
|
95
|
+
"import": "./dist/session/sqlite.js",
|
|
96
|
+
"default": "./dist/session/sqlite.js"
|
|
77
97
|
},
|
|
78
98
|
"./skills": {
|
|
79
99
|
"types": "./dist/skills.d.ts",
|
|
80
|
-
"import": "./dist/skills.js"
|
|
100
|
+
"import": "./dist/skills.js",
|
|
101
|
+
"default": "./dist/skills.js"
|
|
81
102
|
},
|
|
82
103
|
"./restate": {
|
|
83
104
|
"types": "./dist/restate.d.ts",
|
|
84
|
-
"import": "./dist/restate.js"
|
|
105
|
+
"import": "./dist/restate.js",
|
|
106
|
+
"default": "./dist/restate.js"
|
|
85
107
|
},
|
|
86
108
|
"./chat": {
|
|
87
109
|
"types": "./dist/chat.d.ts",
|
|
88
|
-
"import": "./dist/chat.js"
|
|
110
|
+
"import": "./dist/chat.js",
|
|
111
|
+
"default": "./dist/chat.js"
|
|
89
112
|
},
|
|
90
113
|
"./chat/pure": {
|
|
91
114
|
"types": "./dist/chat/pure.d.ts",
|
|
92
|
-
"import": "./dist/chat/pure.js"
|
|
115
|
+
"import": "./dist/chat/pure.js",
|
|
116
|
+
"default": "./dist/chat/pure.js"
|
|
93
117
|
},
|
|
94
118
|
"./tui": {
|
|
95
119
|
"types": "./dist/tui.d.ts",
|
|
96
|
-
"import": "./dist/tui.js"
|
|
120
|
+
"import": "./dist/tui.js",
|
|
121
|
+
"default": "./dist/tui.js"
|
|
97
122
|
},
|
|
98
123
|
"./headless": {
|
|
99
124
|
"types": "./dist/headless.d.ts",
|
|
100
|
-
"import": "./dist/headless.js"
|
|
125
|
+
"import": "./dist/headless.js",
|
|
126
|
+
"default": "./dist/headless.js"
|
|
101
127
|
},
|
|
102
128
|
"./eval": {
|
|
103
129
|
"types": "./dist/eval.d.ts",
|
|
104
|
-
"import": "./dist/eval.js"
|
|
105
|
-
|
|
130
|
+
"import": "./dist/eval.js",
|
|
131
|
+
"default": "./dist/eval.js"
|
|
132
|
+
},
|
|
133
|
+
"./package.json": "./package.json"
|
|
106
134
|
},
|
|
107
135
|
"main": "./dist/index.js",
|
|
108
136
|
"types": "./dist/index.d.ts",
|
|
@@ -157,6 +185,7 @@
|
|
|
157
185
|
"@opentui/react": "^0.2.15",
|
|
158
186
|
"@restatedev/restate-sdk": "^1.11.0",
|
|
159
187
|
"dockerode": "^5.0.0",
|
|
188
|
+
"e2b": ">=1.0.0",
|
|
160
189
|
"react": "^19.0.0",
|
|
161
190
|
"zod": ">=4.0.0"
|
|
162
191
|
},
|
|
@@ -179,6 +208,9 @@
|
|
|
179
208
|
"dockerode": {
|
|
180
209
|
"optional": true
|
|
181
210
|
},
|
|
211
|
+
"e2b": {
|
|
212
|
+
"optional": true
|
|
213
|
+
},
|
|
182
214
|
"react": {
|
|
183
215
|
"optional": true
|
|
184
216
|
},
|
|
@@ -201,6 +233,7 @@
|
|
|
201
233
|
"@types/react": "^19.2.0",
|
|
202
234
|
"bumpp": "^11.0.1",
|
|
203
235
|
"dockerode": "^5.0.0",
|
|
236
|
+
"e2b": "^2.27.1",
|
|
204
237
|
"eslint": "^10.2.1",
|
|
205
238
|
"jiti": "^2.6.1",
|
|
206
239
|
"react": "^19.2.0",
|