zidane 7.2.5 → 8.0.4
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/LICENSE +21 -0
- package/README.md +34 -6
- package/dist/{acp-D-tVyUjw.js → acp-DQDhi2dj.js} +230 -77
- package/dist/acp-DQDhi2dj.js.map +1 -0
- package/dist/acp-cli.d.ts +1 -1
- package/dist/acp-cli.js +9 -66
- package/dist/acp-cli.js.map +1 -1
- package/dist/acp.d.ts +10 -590
- package/dist/acp.d.ts.map +1 -1
- package/dist/acp.js +3 -3
- package/dist/{agent-D0zZnGbt.js → agent-DSLNmBp0.js} +14401 -13214
- package/dist/agent-DSLNmBp0.js.map +1 -0
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +3 -2
- package/dist/aliasing-lVFbm81n.js +217 -0
- package/dist/aliasing-lVFbm81n.js.map +1 -0
- package/dist/{anthropic-C2aole0G.js → anthropic-CD00LhUP.js} +1442 -1264
- package/dist/anthropic-CD00LhUP.js.map +1 -0
- package/dist/artifacts-CV2hUKnL.js.map +1 -1
- package/dist/{atomic-write-B7zr1ddF.js → atomic-write-Ijgf2Mhc.js} +13 -3
- package/dist/atomic-write-Ijgf2Mhc.js.map +1 -0
- package/dist/call-tool-dHlbGOIY.js +70 -0
- package/dist/call-tool-dHlbGOIY.js.map +1 -0
- package/dist/chat/pure.d.ts +372 -6
- package/dist/chat/pure.d.ts.map +1 -1
- package/dist/chat/pure.js +35 -244
- package/dist/chat/pure.js.map +1 -1
- package/dist/{approvals-DKaJZYlm.js → chat-JPJJ8uu5.js} +15879 -14631
- package/dist/chat-JPJJ8uu5.js.map +1 -0
- package/dist/chat.d.ts +4 -6
- package/dist/chat.js +23 -12
- package/dist/cli-shared-C-YCaglL.js +159 -0
- package/dist/cli-shared-C-YCaglL.js.map +1 -0
- package/dist/client-core-BQSyDALT.d.ts +2115 -0
- package/dist/client-core-BQSyDALT.d.ts.map +1 -0
- package/dist/codemode-worker.d.ts +1 -0
- package/dist/codemode-worker.js +155 -0
- package/dist/codemode-worker.js.map +1 -0
- package/dist/codemode.d.ts +352 -0
- package/dist/codemode.d.ts.map +1 -0
- package/dist/codemode.js +5 -0
- package/dist/connection-Dr-Js4yZ.d.ts +28 -0
- package/dist/connection-Dr-Js4yZ.d.ts.map +1 -0
- package/dist/connection-loop-gdh22LTI.js +112 -0
- package/dist/connection-loop-gdh22LTI.js.map +1 -0
- package/dist/context-segments-BHKlagL6.js +1016 -0
- package/dist/context-segments-BHKlagL6.js.map +1 -0
- package/dist/{context-transport-T_6AYIvy.js → context-transport-DSMTUsK1.js} +3 -3
- package/dist/{context-transport-T_6AYIvy.js.map → context-transport-DSMTUsK1.js.map} +1 -1
- package/dist/contexts/daytona.d.ts +19 -8
- package/dist/contexts/daytona.d.ts.map +1 -1
- package/dist/contexts/daytona.js +1 -440
- package/dist/contexts/docker.d.ts +36 -7
- package/dist/contexts/docker.d.ts.map +1 -1
- package/dist/contexts/docker.js +1 -456
- package/dist/contexts/e2b.d.ts +68 -13
- package/dist/contexts/e2b.d.ts.map +1 -1
- package/dist/contexts/e2b.js +1 -382
- package/dist/contexts/sandbox.d.ts +1 -1
- package/dist/contexts/sandbox.js +5 -0
- package/dist/contexts/sandbox.js.map +1 -1
- package/dist/{contexts-CRE9pw07.js → contexts-d7UolYot.js} +1059 -524
- package/dist/contexts-d7UolYot.js.map +1 -0
- package/dist/contexts.d.ts +3 -3
- package/dist/contexts.js +1 -1
- package/dist/cred-keys-GpBg71cP.js +105 -0
- package/dist/cred-keys-GpBg71cP.js.map +1 -0
- package/dist/{auth-BG2rVKSt.js → credentials-JttEuRON.js} +55 -206
- package/dist/credentials-JttEuRON.js.map +1 -0
- package/dist/{cursor-iojRXHF9.js → cursor-CdjaQTBW.js} +3 -3
- package/dist/{cursor-iojRXHF9.js.map → cursor-CdjaQTBW.js.map} +1 -1
- package/dist/daemon-cli.d.ts +1 -1
- package/dist/daemon-cli.js +3 -2
- package/dist/daemon-cli.js.map +1 -1
- package/dist/daytona-DG3omipZ.js +513 -0
- package/dist/daytona-DG3omipZ.js.map +1 -0
- package/dist/defaults-Cx3zvDOV.js +23 -0
- package/dist/defaults-Cx3zvDOV.js.map +1 -0
- package/dist/dispatcher-BMlu2BmZ.js +4941 -0
- package/dist/dispatcher-BMlu2BmZ.js.map +1 -0
- package/dist/docker-BZhMMJUp.js +727 -0
- package/dist/docker-BZhMMJUp.js.map +1 -0
- package/dist/e2b-CEVOdRib.js +480 -0
- package/dist/e2b-CEVOdRib.js.map +1 -0
- package/dist/edit-utils-EGosADZq.js +234 -0
- package/dist/edit-utils-EGosADZq.js.map +1 -0
- package/dist/environment-8wsKE2Ln.js +214 -0
- package/dist/environment-8wsKE2Ln.js.map +1 -0
- package/dist/eval-BNcvle_J.js +1595 -0
- package/dist/eval-BNcvle_J.js.map +1 -0
- package/dist/eval.d.ts +2 -2
- package/dist/eval.js +1 -1489
- package/dist/executor-Cx5-8yqi.js +621 -0
- package/dist/executor-Cx5-8yqi.js.map +1 -0
- package/dist/extension-authoring-DyGGmq9V.js +385 -0
- package/dist/extension-authoring-DyGGmq9V.js.map +1 -0
- package/dist/extensions.d.ts +2 -2
- package/dist/extensions.js +3 -3
- package/dist/{fetch-url-DX75gpL0.js → fetch-url-Ct2TjDWt.js} +4 -4
- package/dist/{fetch-url-DX75gpL0.js.map → fetch-url-Ct2TjDWt.js.map} +1 -1
- package/dist/{format-BF745pLL.js → format-C2NQEVUH.js} +39 -2
- package/dist/format-C2NQEVUH.js.map +1 -0
- package/dist/format-bytes-C7tfc3Zm.js +55 -0
- package/dist/format-bytes-C7tfc3Zm.js.map +1 -0
- package/dist/headless-C_rNUuYC.js +960 -0
- package/dist/headless-C_rNUuYC.js.map +1 -0
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +1 -413
- package/dist/{history-search-C4bk1Wz_.js → history-search-CcYzF8-0.js} +7 -3
- package/dist/history-search-CcYzF8-0.js.map +1 -0
- package/dist/history-search-worker.d.ts +1 -1
- package/dist/history-search-worker.js +1 -1
- package/dist/host-D7NrI03V.js +378 -0
- package/dist/host-D7NrI03V.js.map +1 -0
- package/dist/host-signals-BcP5QKUD.js +118 -0
- package/dist/host-signals-BcP5QKUD.js.map +1 -0
- package/dist/identity-CwfO8K-t.js +26 -0
- package/dist/identity-CwfO8K-t.js.map +1 -0
- package/dist/{index-BgN1T3lk.d.ts → index-BGe1fQT7.d.ts} +10987 -9320
- package/dist/index-BGe1fQT7.d.ts.map +1 -0
- package/dist/index-BVQsIKGn.d.ts +448 -0
- package/dist/index-BVQsIKGn.d.ts.map +1 -0
- package/dist/{index-C6NEd5y_.d.ts → index-CHABJd-L.d.ts} +3386 -502
- package/dist/index-CHABJd-L.d.ts.map +1 -0
- package/dist/{index-C37_ppWv.d.ts → index-D6a7qXpg.d.ts} +2 -3
- package/dist/index-D6a7qXpg.d.ts.map +1 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +27 -23
- package/dist/{completion-core-BRo86R_L.js → inline-ghost-BVRQeGoL.js} +50 -2
- package/dist/inline-ghost-BVRQeGoL.js.map +1 -0
- package/dist/ipc/remote.d.ts +313 -0
- package/dist/ipc/remote.d.ts.map +1 -0
- package/dist/ipc/remote.js +4 -0
- package/dist/ipc.d.ts +6 -964
- package/dist/ipc.js +403 -4
- package/dist/ipc.js.map +1 -0
- package/dist/{isolation-Kfoof0MM.d.ts → isolation-D9L650W5.d.ts} +100 -15
- package/dist/isolation-D9L650W5.d.ts.map +1 -0
- package/dist/json-rpc--HXQti1E.js +350 -0
- package/dist/json-rpc--HXQti1E.js.map +1 -0
- package/dist/links-j8rED1sR.js +603 -0
- package/dist/links-j8rED1sR.js.map +1 -0
- package/dist/local-terminal-D8QThwo_.js +252 -0
- package/dist/local-terminal-D8QThwo_.js.map +1 -0
- package/dist/{logger--C1VQjwJ.js → logger-Gtqlayx8.js} +199 -173
- package/dist/logger-Gtqlayx8.js.map +1 -0
- package/dist/logs-view-CWG8aUAG.js.map +1 -1
- package/dist/{mcp-CgNd-f3F.js → mcp-_wecH9Qe.js} +608 -562
- package/dist/mcp-_wecH9Qe.js.map +1 -0
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +2 -2
- package/dist/media-sniff-UKijEaiQ.js.map +1 -1
- package/dist/{messages-2jcOA_5R.js → messages-BqiwcD2Q.js} +1017 -1014
- package/dist/messages-BqiwcD2Q.js.map +1 -0
- package/dist/{oauth-DxHO17JE.js → oauth-Px_pBB9W.js} +5 -5
- package/dist/{oauth-DxHO17JE.js.map → oauth-Px_pBB9W.js.map} +1 -1
- package/dist/{openai-compat-Dy56weK8.js → openai-compat-CFrpH7uq.js} +432 -589
- package/dist/openai-compat-CFrpH7uq.js.map +1 -0
- package/dist/orchestration-BCGmB8Ps.js +511 -0
- package/dist/orchestration-BCGmB8Ps.js.map +1 -0
- package/dist/output/stream-json.d.ts +1 -2
- package/dist/output/stream-json.d.ts.map +1 -1
- package/dist/output/stream-json.js +1 -1
- package/dist/output/terminal.d.ts +1 -2
- package/dist/output/terminal.d.ts.map +1 -1
- package/dist/output/terminal.js +13 -7
- package/dist/output/terminal.js.map +1 -1
- package/dist/{plugins-gbI7SBA6.js → plugins-DS7mahzZ.js} +20 -101
- package/dist/plugins-DS7mahzZ.js.map +1 -0
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +1 -2
- package/dist/prelude-Cxo4t74B.js +517 -0
- package/dist/prelude-Cxo4t74B.js.map +1 -0
- package/dist/presets.d.ts +1 -1
- package/dist/presets.js +1 -2
- package/dist/project-root-B8zADr4o.js +167 -0
- package/dist/project-root-B8zADr4o.js.map +1 -0
- package/dist/project-user-paths-BSgtrRxl.js +58 -0
- package/dist/project-user-paths-BSgtrRxl.js.map +1 -0
- package/dist/{prompts-Pqc3JdW_.d.ts → prompts-DYcvqShf.d.ts} +14 -11
- package/dist/prompts-DYcvqShf.d.ts.map +1 -0
- package/dist/protocol-DnhqqSmE.js +13 -0
- package/dist/protocol-DnhqqSmE.js.map +1 -0
- package/dist/providers/anthropic.d.ts +2 -2
- package/dist/providers/anthropic.js +1 -2
- package/dist/providers/arcee.d.ts +1 -1
- package/dist/providers/arcee.js +1 -1
- package/dist/providers/baseten.d.ts +1 -1
- package/dist/providers/baseten.js +1 -1
- package/dist/providers/cerebras.d.ts +1 -1
- package/dist/providers/cerebras.js +3 -2
- package/dist/providers/cerebras.js.map +1 -1
- package/dist/providers/local.d.ts +1 -1
- package/dist/providers/local.js +1 -1
- package/dist/providers/openai-compat.d.ts +1 -1
- package/dist/providers/openai-compat.js +1 -2
- package/dist/providers/openai.d.ts +1 -1
- package/dist/providers/openai.js +15 -12
- package/dist/providers/openai.js.map +1 -1
- package/dist/providers/openrouter.d.ts +1 -1
- package/dist/providers/openrouter.js +3 -2
- package/dist/providers/openrouter.js.map +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/xai.js +3 -3
- package/dist/{providers-BVhnFyiY.js → providers-XUR7F4Hi.js} +4 -4
- package/dist/{providers-BVhnFyiY.js.map → providers-XUR7F4Hi.js.map} +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +4 -4
- package/dist/registry-D6ShBWJU.js +5234 -0
- package/dist/registry-D6ShBWJU.js.map +1 -0
- package/dist/remote-hosts-BtA_9ZGp.js +97 -0
- package/dist/remote-hosts-BtA_9ZGp.js.map +1 -0
- package/dist/restate.d.ts +2 -3
- package/dist/restate.d.ts.map +1 -1
- package/dist/restate.js +631 -572
- package/dist/restate.js.map +1 -1
- package/dist/run-summary-CklLiZ4y.js +288 -0
- package/dist/run-summary-CklLiZ4y.js.map +1 -0
- package/dist/{sandbox-BH0WQkXn.d.ts → sandbox-C5dR5DwQ.d.ts} +6 -3
- package/dist/sandbox-C5dR5DwQ.d.ts.map +1 -0
- package/dist/session/sqlite.d.ts +1 -2
- package/dist/session/sqlite.d.ts.map +1 -1
- package/dist/session/sqlite.js +1 -616
- package/dist/session-factory-BUGY5P40.js +1576 -0
- package/dist/session-factory-BUGY5P40.js.map +1 -0
- package/dist/{session-BqRP1hS7.js → session-xh9JXu6i.js} +94 -52
- package/dist/session-xh9JXu6i.js.map +1 -0
- package/dist/session.d.ts +1 -1
- package/dist/session.js +2 -2
- package/dist/settings-keys-Ckf29NeM.js +677 -0
- package/dist/settings-keys-Ckf29NeM.js.map +1 -0
- package/dist/shell-path-Dqaoow2J.js +412 -0
- package/dist/shell-path-Dqaoow2J.js.map +1 -0
- package/dist/{skills-BC3dodWp.js → skills-DKqZJm4X.js} +430 -470
- package/dist/skills-DKqZJm4X.js.map +1 -0
- package/dist/skills.d.ts +2 -2
- package/dist/skills.js +1 -2
- package/dist/source-mPExaUm8.js +381 -0
- package/dist/source-mPExaUm8.js.map +1 -0
- package/dist/sqlite-DV1DQzN2.js +698 -0
- package/dist/sqlite-DV1DQzN2.js.map +1 -0
- package/dist/{src-CkNQKFKr.js → src-BRMYRJib.js} +903 -1121
- package/dist/src-BRMYRJib.js.map +1 -0
- package/dist/{stdio-DPpBDPx5.js → stdio-C6YyoW3I.js} +4 -4
- package/dist/{stdio-DPpBDPx5.js.map → stdio-C6YyoW3I.js.map} +1 -1
- package/dist/{stdio-loader-Bbx19dMZ.js → stdio-loader-C830Vg-Z.js} +4 -4
- package/dist/{stdio-loader-Bbx19dMZ.js.map → stdio-loader-C830Vg-Z.js.map} +1 -1
- package/dist/system-prompt-MNVHatSD.d.ts.map +1 -1
- package/dist/timeout-DEaqslLO.d.ts.map +1 -1
- package/dist/todo-edits-Dn251YUP.js +1790 -0
- package/dist/todo-edits-Dn251YUP.js.map +1 -0
- package/dist/{turn-operations-DrbJlpq9.js → tool-formatters-IQFDrdrs.js} +1456 -2120
- package/dist/tool-formatters-IQFDrdrs.js.map +1 -0
- package/dist/tool-state-Dku6YqAB.js +989 -0
- package/dist/tool-state-Dku6YqAB.js.map +1 -0
- package/dist/tools/fetch-url.d.ts +1 -2
- package/dist/tools/fetch-url.d.ts.map +1 -1
- package/dist/tools/fetch-url.js +1 -2
- package/dist/tools/prompts.d.ts +1 -1
- package/dist/tools/prompts.js +7 -7
- package/dist/tools/prompts.js.map +1 -1
- package/dist/tools/web-search.d.ts +1 -2
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +2 -2
- package/dist/tools/web-search.js.map +1 -1
- package/dist/tools-_DnT3AGM.js +578 -0
- package/dist/tools-_DnT3AGM.js.map +1 -0
- package/dist/tools.d.ts +3 -3
- package/dist/tools.js +4 -2
- package/dist/tui.d.ts +534 -517
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +34933 -27243
- package/dist/tui.js.map +1 -1
- package/dist/turn-operations-B8sokwi5.js +333 -0
- package/dist/turn-operations-B8sokwi5.js.map +1 -0
- package/dist/turn-operations-DQX5ZZni.d.ts +3089 -0
- package/dist/turn-operations-DQX5ZZni.d.ts.map +1 -0
- package/dist/types-C7ZFOztE.d.ts +132 -0
- package/dist/types-C7ZFOztE.d.ts.map +1 -0
- package/dist/types-CH5XpIHw.js +114 -0
- package/dist/types-CH5XpIHw.js.map +1 -0
- package/dist/{types-CWgENVLY.js → types-Cu0ZGDu9.js} +10 -6
- package/dist/types-Cu0ZGDu9.js.map +1 -0
- package/dist/types-IqegbJEE.d.ts +624 -0
- package/dist/types-IqegbJEE.d.ts.map +1 -0
- package/dist/types.d.ts +4 -4
- package/dist/types.js +1 -1
- package/dist/url-D8HCl65b.js +1259 -0
- package/dist/url-D8HCl65b.js.map +1 -0
- package/dist/wasm-BVT-j5cl.js +33 -0
- package/dist/wasm-BVT-j5cl.js.map +1 -0
- package/dist/workspace-exec-stream-SV2R9d5S.js +355 -0
- package/dist/workspace-exec-stream-SV2R9d5S.js.map +1 -0
- package/dist/ws-CIHMvlSh.js +952 -0
- package/dist/ws-CIHMvlSh.js.map +1 -0
- package/dist/ws-client-N7NxzvQp.js +230 -0
- package/dist/ws-client-N7NxzvQp.js.map +1 -0
- package/dist/{xai-CazjStOK.js → xai-CvJTeLrI.js} +165 -5
- package/dist/xai-CvJTeLrI.js.map +1 -0
- package/dist/xdg-zweed0-t.js +117 -0
- package/dist/xdg-zweed0-t.js.map +1 -0
- package/docs/ACP.md +52 -0
- package/docs/ARCHITECTURE.md +103 -6
- package/docs/ARTIFACTS.md +8 -4
- package/docs/CHAT.md +165 -14
- package/docs/EXECUTION_CONTEXT.md +8 -0
- package/docs/EXTENSIONS.md +123 -2
- package/docs/HEADLESS.md +2 -0
- package/docs/IPC.md +775 -64
- package/docs/MACHINES.md +456 -0
- package/docs/PANELS.md +3 -0
- package/docs/README.md +4 -0
- package/docs/RESTATE.md +3 -2
- package/docs/RUN_IN_BACKGROUND.md +10 -2
- package/docs/SERVER.md +1085 -0
- package/docs/SKILL.md +6 -1
- package/docs/TERMINAL.md +75 -0
- package/docs/TUI.md +65 -14
- package/package.json +58 -26
- package/scripts/eval.ts +4 -0
- package/dist/acp-D-tVyUjw.js.map +0 -1
- package/dist/agent-D0zZnGbt.js.map +0 -1
- package/dist/anthropic-C2aole0G.js.map +0 -1
- package/dist/approvals-DKaJZYlm.js.map +0 -1
- package/dist/atomic-write-B7zr1ddF.js.map +0 -1
- package/dist/auth-BG2rVKSt.js.map +0 -1
- package/dist/completion-core-BRo86R_L.js.map +0 -1
- package/dist/contexts/daytona.js.map +0 -1
- package/dist/contexts/docker.js.map +0 -1
- package/dist/contexts/e2b.js.map +0 -1
- package/dist/contexts-CRE9pw07.js.map +0 -1
- package/dist/eval.js.map +0 -1
- package/dist/format-BF745pLL.js.map +0 -1
- package/dist/glob-DluQFSw1.js +0 -270
- package/dist/glob-DluQFSw1.js.map +0 -1
- package/dist/headless.js.map +0 -1
- package/dist/history-search-C4bk1Wz_.js.map +0 -1
- package/dist/index-BgN1T3lk.d.ts.map +0 -1
- package/dist/index-C37_ppWv.d.ts.map +0 -1
- package/dist/index-C6NEd5y_.d.ts.map +0 -1
- package/dist/ipc-BKVIIOqH.js +0 -331
- package/dist/ipc-BKVIIOqH.js.map +0 -1
- package/dist/ipc.d.ts.map +0 -1
- package/dist/isolation-Kfoof0MM.d.ts.map +0 -1
- package/dist/json-rpc-rSWMUh9b.js +0 -192
- package/dist/json-rpc-rSWMUh9b.js.map +0 -1
- package/dist/logger--C1VQjwJ.js.map +0 -1
- package/dist/mcp-CgNd-f3F.js.map +0 -1
- package/dist/messages-2jcOA_5R.js.map +0 -1
- package/dist/openai-compat-Dy56weK8.js.map +0 -1
- package/dist/output-cap-C9zukcCj.js +0 -100
- package/dist/output-cap-C9zukcCj.js.map +0 -1
- package/dist/panels-B6gRk4bf.js +0 -789
- package/dist/panels-B6gRk4bf.js.map +0 -1
- package/dist/plugins-gbI7SBA6.js.map +0 -1
- package/dist/prompts-Pqc3JdW_.d.ts.map +0 -1
- package/dist/run-summary-BU_NgwUT.js +0 -269
- package/dist/run-summary-BU_NgwUT.js.map +0 -1
- package/dist/sandbox-BH0WQkXn.d.ts.map +0 -1
- package/dist/session/sqlite.js.map +0 -1
- package/dist/session-BqRP1hS7.js.map +0 -1
- package/dist/shell-path-DfdXrGg9.js +0 -1549
- package/dist/shell-path-DfdXrGg9.js.map +0 -1
- package/dist/skills-BC3dodWp.js.map +0 -1
- package/dist/src-CkNQKFKr.js.map +0 -1
- package/dist/todo-edits-UOwgxGKu.js +0 -528
- package/dist/todo-edits-UOwgxGKu.js.map +0 -1
- package/dist/tool-formatters-DoRLnfuD.d.ts +0 -759
- package/dist/tool-formatters-DoRLnfuD.d.ts.map +0 -1
- package/dist/transcript-anchors-BeudMbXx.d.ts +0 -1762
- package/dist/transcript-anchors-BeudMbXx.d.ts.map +0 -1
- package/dist/turn-operations-C8bMBDl_.d.ts +0 -1258
- package/dist/turn-operations-C8bMBDl_.d.ts.map +0 -1
- package/dist/turn-operations-DrbJlpq9.js.map +0 -1
- package/dist/types-CWgENVLY.js.map +0 -1
- package/dist/xai-CazjStOK.js.map +0 -1
package/dist/contexts/e2b.js
CHANGED
|
@@ -1,382 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { t as alwaysQuote } from "../shell-quote-BmnhZmdM.js";
|
|
3
|
-
import { r as createLogger, t as consoleSink } from "../logger--C1VQjwJ.js";
|
|
4
|
-
import { t as StreamQueue } from "../stream-queue-Cd9OJxl7.js";
|
|
5
|
-
import { Buffer } from "node:buffer";
|
|
6
|
-
//#region src/contexts/e2b.ts
|
|
7
|
-
/**
|
|
8
|
-
* "Effectively unlimited" command timeout for `execStream`. 2^31-1 ms
|
|
9
|
-
* (~24.8 days — far beyond any sandbox lifetime) because both edges are
|
|
10
|
-
* cliffs: `0` is treated by `@connectrpc/connect`'s deadline signal as
|
|
11
|
-
* already expired (instant DeadlineExceeded), and anything above 2^31-1
|
|
12
|
-
* overflows `setTimeout` and fires immediately.
|
|
13
|
-
*/
|
|
14
|
-
const E2B_STREAM_TIMEOUT_MS = 2 ** 31 - 1;
|
|
15
|
-
/** Per-probe timeout for the readiness `true` command. */
|
|
16
|
-
const READINESS_PROBE_TIMEOUT_MS = 5e3;
|
|
17
|
-
/** Pause between readiness probes while the sandbox is still warming up. */
|
|
18
|
-
const READINESS_BACKOFF_MS = 250;
|
|
19
|
-
/**
|
|
20
|
-
* Command timeout for the pregame setup script. E2B's `commands.run` defaults
|
|
21
|
-
* to 60s and offers no true "unlimited" — a `timeoutMs` of 0 is a 0ms deadline
|
|
22
|
-
* (instant timeout), not "off". Setup scripts (`apt`/`pip` installs, builds)
|
|
23
|
-
* routinely exceed 60s, so we pass a deliberately generous 30-minute ceiling.
|
|
24
|
-
* The sandbox's own lifetime independently bounds anything longer.
|
|
25
|
-
*/
|
|
26
|
-
const PREGAME_TIMEOUT_MS = 1800 * 1e3;
|
|
27
|
-
/**
|
|
28
|
-
* Upload a setup ("pregame") script into a ready sandbox and execute it.
|
|
29
|
-
*
|
|
30
|
-
* Writes the script to `/tmp/<name>`, then `chmod +x`'s and runs it directly
|
|
31
|
-
* (so a `#!/bin/bash` / `#!/usr/bin/env python3` shebang chooses the
|
|
32
|
-
* interpreter) in `cwd` with `envs` applied — the same env the sandbox was
|
|
33
|
-
* created with, so the script sees the run's `--env` / `--pass-env`. A
|
|
34
|
-
* generous {@link PREGAME_TIMEOUT_MS} ceiling is used so long `apt`/`pip`
|
|
35
|
-
* installs aren't killed by E2B's 60s command default. A non-zero exit
|
|
36
|
-
* (whether E2B returns it or raises on it) throws, so the caller can tear the
|
|
37
|
-
* sandbox down rather than prompt against a broken environment.
|
|
38
|
-
*/
|
|
39
|
-
async function runE2BPregame(sandbox, logger, opts) {
|
|
40
|
-
const path = `/tmp/${opts.name}`;
|
|
41
|
-
logger.info("running E2B pregame script", {
|
|
42
|
-
sandboxId: sandbox.sandboxId,
|
|
43
|
-
path
|
|
44
|
-
});
|
|
45
|
-
await sandbox.files.write(path, opts.content);
|
|
46
|
-
const quoted = JSON.stringify(path);
|
|
47
|
-
let result;
|
|
48
|
-
try {
|
|
49
|
-
result = await sandbox.commands.run(`chmod +x ${quoted} && ${quoted}`, {
|
|
50
|
-
cwd: opts.cwd,
|
|
51
|
-
envs: opts.envs,
|
|
52
|
-
timeoutMs: PREGAME_TIMEOUT_MS
|
|
53
|
-
});
|
|
54
|
-
} catch (err) {
|
|
55
|
-
const exitCode = typeof err?.exitCode === "number" ? err.exitCode : 124;
|
|
56
|
-
logger.error("E2B pregame script failed", {
|
|
57
|
-
sandboxId: sandbox.sandboxId,
|
|
58
|
-
exitCode,
|
|
59
|
-
stdout: err?.stdout ?? "",
|
|
60
|
-
stderr: err?.stderr ?? err?.message ?? ""
|
|
61
|
-
});
|
|
62
|
-
throw new Error(`E2B pregame script ${opts.name} failed with exit code ${exitCode}`);
|
|
63
|
-
}
|
|
64
|
-
if (result.exitCode !== 0) {
|
|
65
|
-
logger.error("E2B pregame script failed", {
|
|
66
|
-
sandboxId: sandbox.sandboxId,
|
|
67
|
-
exitCode: result.exitCode,
|
|
68
|
-
stdout: result.stdout,
|
|
69
|
-
stderr: result.stderr
|
|
70
|
-
});
|
|
71
|
-
throw new Error(`E2B pregame script ${opts.name} failed with exit code ${result.exitCode}`);
|
|
72
|
-
}
|
|
73
|
-
logger.info("E2B pregame ready", {
|
|
74
|
-
sandboxId: sandbox.sandboxId,
|
|
75
|
-
stdout: result.stdout,
|
|
76
|
-
stderr: result.stderr
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Block until an E2B sandbox is ready to run commands, or throw if it never
|
|
81
|
-
* becomes ready within the deadline.
|
|
82
|
-
*
|
|
83
|
-
* The E2B control plane can hand back a sandbox id before the sandbox's `envd`
|
|
84
|
-
* is accepting commands; the first real command then absorbs that cold start
|
|
85
|
-
* and may time out. This polls a trivial `true` command on a short backoff,
|
|
86
|
-
* logging a `waiting…` line up front and a `ready` line (with `elapsedMs`) on
|
|
87
|
-
* success. On deadline exhaustion it best-effort kills the sandbox and throws.
|
|
88
|
-
*
|
|
89
|
-
* `now`/`sleep` are injectable purely for deterministic tests; in production
|
|
90
|
-
* they default to `Date.now` and a real timer.
|
|
91
|
-
*/
|
|
92
|
-
async function waitForE2BReady(sandbox, logger, opts) {
|
|
93
|
-
if (opts.timeoutSeconds <= 0) return;
|
|
94
|
-
const now = opts.now ?? Date.now;
|
|
95
|
-
const sleep = opts.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
96
|
-
const start = now();
|
|
97
|
-
const deadline = start + opts.timeoutSeconds * 1e3;
|
|
98
|
-
logger.info("waiting for E2B sandbox to initialize", { sandboxId: sandbox.sandboxId });
|
|
99
|
-
while (true) try {
|
|
100
|
-
await sandbox.commands.run("true", { timeoutMs: READINESS_PROBE_TIMEOUT_MS });
|
|
101
|
-
logger.info("E2B sandbox ready", {
|
|
102
|
-
sandboxId: sandbox.sandboxId,
|
|
103
|
-
elapsedMs: now() - start
|
|
104
|
-
});
|
|
105
|
-
return;
|
|
106
|
-
} catch {
|
|
107
|
-
if (now() >= deadline) {
|
|
108
|
-
if (opts.killOnTimeout !== false) await sandbox.kill().catch(() => {});
|
|
109
|
-
throw new Error(`E2B sandbox ${sandbox.sandboxId} did not become ready within ${opts.timeoutSeconds}s`);
|
|
110
|
-
}
|
|
111
|
-
await sleep(READINESS_BACKOFF_MS);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Resolve the effective E2B template, highest precedence first: the per-spawn
|
|
116
|
-
* `SpawnConfig.sandbox.template`, then the factory `template` option, then the
|
|
117
|
-
* `E2B_TEMPLATE` env var. Returns `undefined` (→ SDK's `base` default) when
|
|
118
|
-
* none is set. The E2B SDK reads `E2B_API_KEY`/`E2B_DOMAIN` from the env but
|
|
119
|
-
* NOT `E2B_TEMPLATE`, so this provider has to honor it itself.
|
|
120
|
-
*/
|
|
121
|
-
function resolveE2BTemplate(perSpawnTemplate, optionTemplate, env = process.env) {
|
|
122
|
-
return perSpawnTemplate || optionTemplate || env.E2B_TEMPLATE || void 0;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Merge the factory-level {@link E2BProviderOptions.env} with the per-spawn
|
|
126
|
-
* `SpawnConfig.env`, per-spawn winning on key conflicts. Returns `undefined`
|
|
127
|
-
* when the merge is empty so callers can skip setting `envs` on the create
|
|
128
|
-
* options entirely (rather than handing the SDK an empty object).
|
|
129
|
-
*/
|
|
130
|
-
function resolveE2BEnv(optionEnv, perSpawnEnv) {
|
|
131
|
-
const merged = {
|
|
132
|
-
...optionEnv,
|
|
133
|
-
...perSpawnEnv
|
|
134
|
-
};
|
|
135
|
-
return Object.keys(merged).length > 0 ? merged : void 0;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Build a {@link SandboxProvider} backed by E2B.
|
|
139
|
-
*
|
|
140
|
-
* The provider owns a registry of live {@link E2BSandbox} instances keyed by
|
|
141
|
-
* sandbox id, so the per-call `exec`/`readFile`/… hooks reuse the same warm
|
|
142
|
-
* connection rather than reconnecting each time.
|
|
143
|
-
*/
|
|
144
|
-
function createE2BProvider(options = {}) {
|
|
145
|
-
const live = /* @__PURE__ */ new Map();
|
|
146
|
-
const logger = options.logger ?? createLogger(consoleSink());
|
|
147
|
-
const readinessTimeoutSeconds = options.readinessTimeoutSeconds ?? 60;
|
|
148
|
-
async function loadSdk() {
|
|
149
|
-
try {
|
|
150
|
-
return (await import("e2b")).Sandbox;
|
|
151
|
-
} catch {
|
|
152
|
-
throw new Error("e2b is required for the E2B sandbox provider. Install it with: bun add e2b");
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
function get(sandboxId) {
|
|
156
|
-
const entry = live.get(sandboxId);
|
|
157
|
-
if (!entry) throw new Error(`E2B sandbox ${sandboxId} is not tracked by this provider`);
|
|
158
|
-
return entry;
|
|
159
|
-
}
|
|
160
|
-
async function killOwnedSandbox(sandbox) {
|
|
161
|
-
try {
|
|
162
|
-
await sandbox.kill();
|
|
163
|
-
} catch {}
|
|
164
|
-
}
|
|
165
|
-
async function pauseOwnedSandbox(sandbox) {
|
|
166
|
-
try {
|
|
167
|
-
if (sandbox.pause) await sandbox.pause();
|
|
168
|
-
else if (sandbox.betaPause) await sandbox.betaPause();
|
|
169
|
-
else {
|
|
170
|
-
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 });
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
logger.info("paused E2B sandbox; reconnect later via the sandboxId option (CLI: --sandbox)", { sandboxId: sandbox.sandboxId });
|
|
174
|
-
} catch (err) {
|
|
175
|
-
logger.error("failed to pause E2B sandbox; it will run until its timeout", {
|
|
176
|
-
sandboxId: sandbox.sandboxId,
|
|
177
|
-
error: err instanceof Error ? err.message : String(err)
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return {
|
|
182
|
-
name: "e2b",
|
|
183
|
-
async spawn(config) {
|
|
184
|
-
const Sandbox = await loadSdk();
|
|
185
|
-
const sb = config.sandbox ?? {};
|
|
186
|
-
const apiKey = sb.apiKey ?? options.apiKey;
|
|
187
|
-
const domain = sb.domain ?? options.domain;
|
|
188
|
-
const template = resolveE2BTemplate(sb.template, options.template);
|
|
189
|
-
const timeoutSeconds = config.limits?.timeout ?? options.timeoutSeconds;
|
|
190
|
-
const connectId = sb.sandboxId ?? options.sandboxId;
|
|
191
|
-
const envs = resolveE2BEnv(options.env, config.env);
|
|
192
|
-
let sandbox;
|
|
193
|
-
const owned = connectId === void 0;
|
|
194
|
-
if (connectId !== void 0) {
|
|
195
|
-
const connectOpts = {};
|
|
196
|
-
if (apiKey !== void 0) connectOpts.apiKey = apiKey;
|
|
197
|
-
if (domain !== void 0) connectOpts.domain = domain;
|
|
198
|
-
if (timeoutSeconds !== void 0) connectOpts.timeoutMs = timeoutSeconds * 1e3;
|
|
199
|
-
sandbox = await Sandbox.connect(connectId, connectOpts);
|
|
200
|
-
} else {
|
|
201
|
-
const createOpts = {};
|
|
202
|
-
if (apiKey !== void 0) createOpts.apiKey = apiKey;
|
|
203
|
-
if (domain !== void 0) createOpts.domain = domain;
|
|
204
|
-
if (envs) createOpts.envs = envs;
|
|
205
|
-
if (timeoutSeconds !== void 0) createOpts.timeoutMs = timeoutSeconds * 1e3;
|
|
206
|
-
sandbox = template !== void 0 ? await Sandbox.create(template, createOpts) : await Sandbox.create(createOpts);
|
|
207
|
-
}
|
|
208
|
-
live.set(sandbox.sandboxId, {
|
|
209
|
-
sandbox,
|
|
210
|
-
env: envs,
|
|
211
|
-
owned
|
|
212
|
-
});
|
|
213
|
-
try {
|
|
214
|
-
await waitForE2BReady(sandbox, logger, {
|
|
215
|
-
timeoutSeconds: readinessTimeoutSeconds,
|
|
216
|
-
killOnTimeout: owned
|
|
217
|
-
});
|
|
218
|
-
} catch (err) {
|
|
219
|
-
live.delete(sandbox.sandboxId);
|
|
220
|
-
throw err;
|
|
221
|
-
}
|
|
222
|
-
const requestedCwd = config.cwd ?? options.cwd;
|
|
223
|
-
let cwd;
|
|
224
|
-
if (requestedCwd) {
|
|
225
|
-
cwd = requestedCwd;
|
|
226
|
-
await sandbox.commands.run(`mkdir -p ${JSON.stringify(cwd)}`).catch(() => {});
|
|
227
|
-
} else cwd = await sandbox.commands.run("pwd").then((r) => r.stdout.trim()).catch(() => "") || "/home/user";
|
|
228
|
-
if (options.pregame) try {
|
|
229
|
-
await runE2BPregame(sandbox, logger, {
|
|
230
|
-
name: options.pregame.name,
|
|
231
|
-
content: options.pregame.content,
|
|
232
|
-
cwd,
|
|
233
|
-
envs
|
|
234
|
-
});
|
|
235
|
-
} catch (err) {
|
|
236
|
-
if (owned) await sandbox.kill().catch(() => {});
|
|
237
|
-
live.delete(sandbox.sandboxId);
|
|
238
|
-
throw err;
|
|
239
|
-
}
|
|
240
|
-
return {
|
|
241
|
-
id: sandbox.sandboxId,
|
|
242
|
-
cwd
|
|
243
|
-
};
|
|
244
|
-
},
|
|
245
|
-
/**
|
|
246
|
-
* Live bidirectional stream — see `ExecutionContext.execStream`.
|
|
247
|
-
*
|
|
248
|
-
* Backed by E2B's pipe-based command API rather than `sandbox.pty`.
|
|
249
|
-
* Both can carry stdin, but a PTY would force us to defeat terminal
|
|
250
|
-
* semantics we never wanted (input echo, `\n`→`\r\n` rewriting, the
|
|
251
|
-
* ~4096-byte canonical line cap, and stdout/stderr merged into one
|
|
252
|
-
* stream). Pipes give split streams and byte-faithful framing for free.
|
|
253
|
-
*
|
|
254
|
-
* KNOWN RESIDUAL: `onStdout` / `onStderr` deliver `string`, already
|
|
255
|
-
* decoded by the SDK. A chunk boundary that splits a multibyte
|
|
256
|
-
* codepoint is therefore corrupted before it reaches us — we re-encode
|
|
257
|
-
* to bytes to satisfy the seam, but cannot recover what the decoder
|
|
258
|
-
* dropped. Newline framing and ASCII structure are unaffected, so
|
|
259
|
-
* JSON-RPC still parses; the damage would be confined to non-ASCII
|
|
260
|
-
* inside string values. If that ever bites, `sandbox.pty.create`
|
|
261
|
-
* hands back raw `Uint8Array` and the Daytona PTY path in
|
|
262
|
-
* `./daytona.ts` is the template for adopting it here.
|
|
263
|
-
*/
|
|
264
|
-
async execStream(sandboxId, command, opts) {
|
|
265
|
-
const { sandbox, env } = get(sandboxId);
|
|
266
|
-
opts?.signal?.throwIfAborted();
|
|
267
|
-
const warnBacklog = (which) => (bytes) => logger.warn("execStream consumer is not draining output", {
|
|
268
|
-
sandboxId,
|
|
269
|
-
stream: which,
|
|
270
|
-
bufferedBytes: bytes
|
|
271
|
-
});
|
|
272
|
-
const stdout = new StreamQueue(warnBacklog("stdout"));
|
|
273
|
-
const stderr = new StreamQueue(warnBacklog("stderr"));
|
|
274
|
-
const pidFile = `/tmp/.zidane-stream-${Math.random().toString(36).slice(2, 10)}.pid`;
|
|
275
|
-
const leader = `echo \$\$ > ${pidFile}; exec sh -c ${alwaysQuote(command)}`;
|
|
276
|
-
const wrapped = `if setsid -w true 2>/dev/null; then exec setsid -w sh -c ${alwaysQuote(leader)}; else exec sh -c ${alwaysQuote(leader)}; fi`;
|
|
277
|
-
const handle = await sandbox.commands.run(wrapped, {
|
|
278
|
-
background: true,
|
|
279
|
-
stdin: true,
|
|
280
|
-
timeoutMs: E2B_STREAM_TIMEOUT_MS,
|
|
281
|
-
...opts?.cwd ? { cwd: opts.cwd } : {},
|
|
282
|
-
envs: resolveE2BEnv(env, opts?.env),
|
|
283
|
-
onStdout: (data) => stdout.push(new TextEncoder().encode(data)),
|
|
284
|
-
onStderr: (data) => stderr.push(new TextEncoder().encode(data))
|
|
285
|
-
});
|
|
286
|
-
const pid = handle.pid;
|
|
287
|
-
const exited = handle.wait().then((result) => result?.exitCode ?? 0).catch((err) => typeof err?.exitCode === "number" ? err.exitCode : 137).finally(() => {
|
|
288
|
-
stdout.close();
|
|
289
|
-
stderr.close();
|
|
290
|
-
});
|
|
291
|
-
let commandExited = false;
|
|
292
|
-
exited.then(() => {
|
|
293
|
-
commandExited = true;
|
|
294
|
-
});
|
|
295
|
-
const readLeaderPid = async () => {
|
|
296
|
-
for (let attempt = 0; attempt < 20; attempt++) {
|
|
297
|
-
const probe = await sandbox.commands.run(`cat ${pidFile} 2>/dev/null || true`).catch(() => null);
|
|
298
|
-
const parsed = Number.parseInt(probe?.stdout?.trim() ?? "", 10);
|
|
299
|
-
if (Number.isFinite(parsed) && parsed > 0) return parsed;
|
|
300
|
-
if (commandExited) break;
|
|
301
|
-
await new Promise((r) => setTimeout(r, 50));
|
|
302
|
-
}
|
|
303
|
-
return -1;
|
|
304
|
-
};
|
|
305
|
-
const leaderPid = await readLeaderPid();
|
|
306
|
-
const kill = async () => {
|
|
307
|
-
if (leaderPid > 0) await sandbox.commands.run(`kill -TERM -${leaderPid} 2>/dev/null || kill -TERM ${leaderPid} 2>/dev/null || true`).catch(() => {});
|
|
308
|
-
await sandbox.commands.run(`rm -f ${pidFile}`).catch(() => {});
|
|
309
|
-
await sandbox.commands.kill?.(pid).catch(() => {});
|
|
310
|
-
};
|
|
311
|
-
if (opts?.signal) if (opts.signal.aborted) kill();
|
|
312
|
-
else {
|
|
313
|
-
const onAbort = () => {
|
|
314
|
-
kill();
|
|
315
|
-
};
|
|
316
|
-
const detach = () => opts.signal.removeEventListener("abort", onAbort);
|
|
317
|
-
opts.signal.addEventListener("abort", onAbort, { once: true });
|
|
318
|
-
exited.then(detach, detach);
|
|
319
|
-
}
|
|
320
|
-
return {
|
|
321
|
-
pid,
|
|
322
|
-
stdout,
|
|
323
|
-
stderr,
|
|
324
|
-
write: async (data) => {
|
|
325
|
-
if (!sandbox.commands.sendStdin) throw new Error("E2B SDK is too old: `commands.sendStdin` is required for execStream");
|
|
326
|
-
await sandbox.commands.sendStdin(pid, data);
|
|
327
|
-
},
|
|
328
|
-
kill,
|
|
329
|
-
exited
|
|
330
|
-
};
|
|
331
|
-
},
|
|
332
|
-
async exec(sandboxId, command, opts) {
|
|
333
|
-
const { sandbox, env } = get(sandboxId);
|
|
334
|
-
const timeoutMs = (opts?.timeout ?? 30) * 1e3;
|
|
335
|
-
try {
|
|
336
|
-
const result = await sandbox.commands.run(command, {
|
|
337
|
-
cwd: opts?.cwd,
|
|
338
|
-
envs: resolveE2BEnv(env, opts?.env),
|
|
339
|
-
timeoutMs: timeoutMs > 0 ? timeoutMs : void 0
|
|
340
|
-
});
|
|
341
|
-
return {
|
|
342
|
-
...capBufferedExecOutput(result.stdout, result.stderr),
|
|
343
|
-
exitCode: result.exitCode
|
|
344
|
-
};
|
|
345
|
-
} catch (err) {
|
|
346
|
-
if (typeof err?.exitCode === "number") return {
|
|
347
|
-
...capBufferedExecOutput(err.stdout ?? "", err.stderr ?? err.message ?? ""),
|
|
348
|
-
exitCode: err.exitCode
|
|
349
|
-
};
|
|
350
|
-
return {
|
|
351
|
-
stdout: "",
|
|
352
|
-
stderr: err?.message ?? String(err),
|
|
353
|
-
exitCode: 124
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
},
|
|
357
|
-
async readFile(sandboxId, path) {
|
|
358
|
-
return get(sandboxId).sandbox.files.read(path);
|
|
359
|
-
},
|
|
360
|
-
async writeFile(sandboxId, path, content, encoding = "utf-8") {
|
|
361
|
-
const data = typeof content === "string" ? encoding === "utf-8" || encoding === "utf8" ? content : Buffer.from(content, encoding) : content;
|
|
362
|
-
await get(sandboxId).sandbox.files.write(path, data);
|
|
363
|
-
},
|
|
364
|
-
async listFiles(sandboxId, path) {
|
|
365
|
-
return (await get(sandboxId).sandbox.files.list(path)).map((e) => e.type === "dir" ? `${e.name}/` : e.name);
|
|
366
|
-
},
|
|
367
|
-
async destroy(sandboxId) {
|
|
368
|
-
const entry = live.get(sandboxId);
|
|
369
|
-
if (!entry) return;
|
|
370
|
-
if (entry.owned) {
|
|
371
|
-
const action = options.onDestroy ?? "kill";
|
|
372
|
-
if (action === "pause") await pauseOwnedSandbox(entry.sandbox);
|
|
373
|
-
else if (action === "kill") await killOwnedSandbox(entry.sandbox);
|
|
374
|
-
}
|
|
375
|
-
live.delete(sandboxId);
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
//#endregion
|
|
380
|
-
export { createE2BProvider, resolveE2BEnv, resolveE2BTemplate, runE2BPregame, waitForE2BReady };
|
|
381
|
-
|
|
382
|
-
//# sourceMappingURL=e2b.js.map
|
|
1
|
+
export { t as createE2BProvider, a as resolveE2BEnv, n as resolveE2BTemplate, r as runE2BPregame, i as waitForE2BReady } from "../e2b-CEVOdRib.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createSandboxContext, t as SandboxProvider } from "../sandbox-
|
|
1
|
+
import { n as createSandboxContext, t as SandboxProvider } from "../sandbox-C5dR5DwQ.js";
|
|
2
2
|
export { SandboxProvider, createSandboxContext };
|
package/dist/contexts/sandbox.js
CHANGED
|
@@ -31,6 +31,11 @@ function createSandboxContext(provider) {
|
|
|
31
31
|
return provider.exec(getSandboxId(handle), command, options);
|
|
32
32
|
},
|
|
33
33
|
...provider.execStream ? { execStream: async (handle, command, options) => provider.execStream(getSandboxId(handle), command, options) } : {},
|
|
34
|
+
...provider.openTerminal ? { openTerminal: async (handle, options) => provider.openTerminal(getSandboxId(handle), {
|
|
35
|
+
...options,
|
|
36
|
+
cwd: options.cwd ?? handle.cwd
|
|
37
|
+
}) } : {},
|
|
38
|
+
...provider.reconnectTerminal ? { reconnectTerminal: async (handle, id, options) => provider.reconnectTerminal(getSandboxId(handle), id, options) } : {},
|
|
34
39
|
async readFile(handle, path) {
|
|
35
40
|
return provider.readFile(getSandboxId(handle), path);
|
|
36
41
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.js","names":[],"sources":["../../src/contexts/sandbox.ts"],"sourcesContent":["/**\n * Remote sandbox execution context.\n *\n * Offloads execution to a remote sandbox API (e.g. Rivet, E2B).\n * Specific providers implement the SandboxProvider interface.\n */\n\nimport type { Buffer } from 'node:buffer'\nimport type { ContextCapabilities, ExecResult, ExecutionContext, ExecutionHandle, ListFilesOptions, SpawnConfig, StreamHandle } from './types'\nimport { fileSizeViaExec } from './exec-file-size'\nimport { globFilesViaShell } from './glob-shell'\n\n// ---------------------------------------------------------------------------\n// Sandbox provider interface\n// ---------------------------------------------------------------------------\n\nexport interface SandboxProvider {\n name: string\n spawn: (config: SpawnConfig) => Promise<{ id: string, cwd: string }>\n exec: (sandboxId: string, command: string, options?: { cwd?: string, env?: Record<string, string>, timeout?: number }) => Promise<ExecResult>\n readFile: (sandboxId: string, path: string) => Promise<string>\n writeFile: (sandboxId: string, path: string, content: string | Buffer, encoding?: BufferEncoding) => Promise<void>\n listFiles: (sandboxId: string, path: string, options?: ListFilesOptions) => Promise<string[]>\n destroy: (sandboxId: string) => Promise<void>\n /**\n * Optional live bidirectional stream — see {@link ExecutionContext.execStream}\n * for the implementor contract. Providers whose backing API has no stdin\n * channel omit it; `createSandboxContext` then leaves `execStream` off the\n * context entirely so `capabilities.stream` stays false and callers get a\n * clear \"unsupported\" error instead of a silent host spawn.\n */\n execStream?: (\n sandboxId: string,\n command: string,\n options?: { cwd?: string, env?: Record<string, string>, signal?: AbortSignal },\n ) => Promise<StreamHandle>\n}\n\n// ---------------------------------------------------------------------------\n// Sandbox execution context\n// ---------------------------------------------------------------------------\n\nexport function createSandboxContext(provider: SandboxProvider): ExecutionContext {\n const sandboxes = new Map<string, string>()\n const destroyed = new Set<string>()\n\n // The handle id IS the sandbox id (set in `spawn` below), so the map is an\n // identity record of sandboxes this context instance spawned. A handle this\n // instance never spawned falls back to `handle.id` — the re-attach path for\n // durable hosts that journal the handle and hand it back via\n // `AgentOptions.handle` on a replay where `spawn` never re-ran. An\n // EXPLICITLY-destroyed handle still throws (a use-after-free guard, distinct\n // from never-spawned).\n function getSandboxId(handle: ExecutionHandle): string {\n if (destroyed.has(handle.id))\n throw new Error(`Sandbox ${handle.id} not found`)\n return sandboxes.get(handle.id) ?? handle.id\n }\n\n return {\n type: 'sandbox',\n\n capabilities: {\n shell: true,\n filesystem: true,\n glob: true,\n network: true,\n gpu: false,\n stream: provider.execStream !== undefined,\n } satisfies ContextCapabilities,\n\n async spawn(config?: SpawnConfig): Promise<ExecutionHandle> {\n const result = await provider.spawn(config ?? {})\n const handle: ExecutionHandle = { id: result.id, type: 'sandbox', cwd: result.cwd }\n sandboxes.set(handle.id, result.id)\n return handle\n },\n\n async exec(handle: ExecutionHandle, command: string, options?): Promise<ExecResult> {\n return provider.exec(getSandboxId(handle), command, options)\n },\n\n // Conditionally present: `capabilities.stream` is derived from the\n // provider, so the method must disappear too when the provider has no\n // stdin channel. A stub that always throws would make the two disagree.\n ...(provider.execStream\n ? {\n execStream: async (\n handle: ExecutionHandle,\n command: string,\n options?: { cwd?: string, env?: Record<string, string>, signal?: AbortSignal },\n ): Promise<StreamHandle> => provider.execStream!(getSandboxId(handle), command, options),\n }\n : {}),\n\n async readFile(handle: ExecutionHandle, path: string): Promise<string> {\n return provider.readFile(getSandboxId(handle), path)\n },\n\n async fileSize(handle: ExecutionHandle, path: string): Promise<number | null> {\n // Shared exec-probed capability (see exec-file-size.ts). Probe\n // through the sandbox's shell rather than the provider's file API:\n // `readFile` buffers the WHOLE file into host memory, so the\n // whole-read guard needs the size BEFORE any transfer happens. One\n // exec round-trip per whole-read tool call (read_file / edit) — the\n // price of not ballooning the host on a multi-GB sandbox file.\n return fileSizeViaExec(command => provider.exec(getSandboxId(handle), command), path)\n },\n\n async writeFile(handle: ExecutionHandle, path: string, content: string | Buffer, encoding?: BufferEncoding): Promise<void> {\n return provider.writeFile(getSandboxId(handle), path, content, encoding)\n },\n\n async listFiles(handle: ExecutionHandle, path: string, options?: ListFilesOptions): Promise<string[]> {\n const sandboxId = getSandboxId(handle)\n if (options?.glob) {\n return globFilesViaShell(\n path,\n command => provider.exec(sandboxId, command, { cwd: handle.cwd }),\n options?.limit ?? 1000,\n )\n }\n return provider.listFiles(sandboxId, path, options)\n },\n\n async destroy(handle: ExecutionHandle): Promise<void> {\n const id = sandboxes.get(handle.id)\n if (!id)\n return\n await provider.destroy(id)\n sandboxes.delete(handle.id)\n // Mark as torn down so a later op on this exact handle fails loudly\n // (use-after-free) instead of silently re-attaching by id.\n destroyed.add(handle.id)\n },\n }\n}\n"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"sandbox.js","names":[],"sources":["../../src/contexts/sandbox.ts"],"sourcesContent":["/**\n * Remote sandbox execution context.\n *\n * Offloads execution to a remote sandbox API (e.g. Rivet, E2B).\n * Specific providers implement the SandboxProvider interface.\n */\n\nimport type { Buffer } from 'node:buffer'\nimport type { ContextCapabilities, ExecResult, ExecutionContext, ExecutionHandle, ListFilesOptions, SpawnConfig, StreamHandle, TerminalOptions, TerminalProcess } from './types'\nimport { fileSizeViaExec } from './exec-file-size'\nimport { globFilesViaShell } from './glob-shell'\n\n// ---------------------------------------------------------------------------\n// Sandbox provider interface\n// ---------------------------------------------------------------------------\n\nexport interface SandboxProvider {\n name: string\n spawn: (config: SpawnConfig) => Promise<{ id: string, cwd: string }>\n exec: (sandboxId: string, command: string, options?: { cwd?: string, env?: Record<string, string>, timeout?: number }) => Promise<ExecResult>\n readFile: (sandboxId: string, path: string) => Promise<string>\n writeFile: (sandboxId: string, path: string, content: string | Buffer, encoding?: BufferEncoding) => Promise<void>\n listFiles: (sandboxId: string, path: string, options?: ListFilesOptions) => Promise<string[]>\n destroy: (sandboxId: string) => Promise<void>\n /**\n * Optional live bidirectional stream — see {@link ExecutionContext.execStream}\n * for the implementor contract. Providers whose backing API has no stdin\n * channel omit it; `createSandboxContext` then leaves `execStream` off the\n * context entirely so `capabilities.stream` stays false and callers get a\n * clear \"unsupported\" error instead of a silent host spawn.\n */\n execStream?: (\n sandboxId: string,\n command: string,\n options?: { cwd?: string, env?: Record<string, string>, signal?: AbortSignal },\n ) => Promise<StreamHandle>\n /** Optional interactive terminal — see {@link ExecutionContext.openTerminal}. */\n openTerminal?: (sandboxId: string, options: TerminalOptions) => Promise<TerminalProcess>\n /** Re-attach to a terminal by id — see {@link ExecutionContext.reconnectTerminal}. */\n reconnectTerminal?: (sandboxId: string, id: string, options: TerminalOptions) => Promise<TerminalProcess | null>\n}\n\n// ---------------------------------------------------------------------------\n// Sandbox execution context\n// ---------------------------------------------------------------------------\n\nexport function createSandboxContext(provider: SandboxProvider): ExecutionContext {\n const sandboxes = new Map<string, string>()\n const destroyed = new Set<string>()\n\n // The handle id IS the sandbox id (set in `spawn` below), so the map is an\n // identity record of sandboxes this context instance spawned. A handle this\n // instance never spawned falls back to `handle.id` — the re-attach path for\n // durable hosts that journal the handle and hand it back via\n // `AgentOptions.handle` on a replay where `spawn` never re-ran. An\n // EXPLICITLY-destroyed handle still throws (a use-after-free guard, distinct\n // from never-spawned).\n function getSandboxId(handle: ExecutionHandle): string {\n if (destroyed.has(handle.id))\n throw new Error(`Sandbox ${handle.id} not found`)\n return sandboxes.get(handle.id) ?? handle.id\n }\n\n return {\n type: 'sandbox',\n\n capabilities: {\n shell: true,\n filesystem: true,\n glob: true,\n network: true,\n gpu: false,\n stream: provider.execStream !== undefined,\n } satisfies ContextCapabilities,\n\n async spawn(config?: SpawnConfig): Promise<ExecutionHandle> {\n const result = await provider.spawn(config ?? {})\n const handle: ExecutionHandle = { id: result.id, type: 'sandbox', cwd: result.cwd }\n sandboxes.set(handle.id, result.id)\n return handle\n },\n\n async exec(handle: ExecutionHandle, command: string, options?): Promise<ExecResult> {\n return provider.exec(getSandboxId(handle), command, options)\n },\n\n // Conditionally present: `capabilities.stream` is derived from the\n // provider, so the method must disappear too when the provider has no\n // stdin channel. A stub that always throws would make the two disagree.\n ...(provider.execStream\n ? {\n execStream: async (\n handle: ExecutionHandle,\n command: string,\n options?: { cwd?: string, env?: Record<string, string>, signal?: AbortSignal },\n ): Promise<StreamHandle> => provider.execStream!(getSandboxId(handle), command, options),\n }\n : {}),\n\n ...(provider.openTerminal\n ? {\n openTerminal: async (handle: ExecutionHandle, options: TerminalOptions): Promise<TerminalProcess> =>\n provider.openTerminal!(getSandboxId(handle), { ...options, cwd: options.cwd ?? handle.cwd }),\n }\n : {}),\n ...(provider.reconnectTerminal\n ? {\n reconnectTerminal: async (handle: ExecutionHandle, id: string, options: TerminalOptions): Promise<TerminalProcess | null> =>\n provider.reconnectTerminal!(getSandboxId(handle), id, options),\n }\n : {}),\n\n async readFile(handle: ExecutionHandle, path: string): Promise<string> {\n return provider.readFile(getSandboxId(handle), path)\n },\n\n async fileSize(handle: ExecutionHandle, path: string): Promise<number | null> {\n // Shared exec-probed capability (see exec-file-size.ts). Probe\n // through the sandbox's shell rather than the provider's file API:\n // `readFile` buffers the WHOLE file into host memory, so the\n // whole-read guard needs the size BEFORE any transfer happens. One\n // exec round-trip per whole-read tool call (read_file / edit) — the\n // price of not ballooning the host on a multi-GB sandbox file.\n return fileSizeViaExec(command => provider.exec(getSandboxId(handle), command), path)\n },\n\n async writeFile(handle: ExecutionHandle, path: string, content: string | Buffer, encoding?: BufferEncoding): Promise<void> {\n return provider.writeFile(getSandboxId(handle), path, content, encoding)\n },\n\n async listFiles(handle: ExecutionHandle, path: string, options?: ListFilesOptions): Promise<string[]> {\n const sandboxId = getSandboxId(handle)\n if (options?.glob) {\n return globFilesViaShell(\n path,\n command => provider.exec(sandboxId, command, { cwd: handle.cwd }),\n options?.limit ?? 1000,\n )\n }\n return provider.listFiles(sandboxId, path, options)\n },\n\n async destroy(handle: ExecutionHandle): Promise<void> {\n const id = sandboxes.get(handle.id)\n if (!id)\n return\n await provider.destroy(id)\n sandboxes.delete(handle.id)\n // Mark as torn down so a later op on this exact handle fails loudly\n // (use-after-free) instead of silently re-attaching by id.\n destroyed.add(handle.id)\n },\n }\n}\n"],"mappings":";;AA8CA,SAAgB,qBAAqB,UAA6C;CAChF,MAAM,4BAAY,IAAI,IAAoB;CAC1C,MAAM,4BAAY,IAAI,IAAY;CASlC,SAAS,aAAa,QAAiC;EACrD,IAAI,UAAU,IAAI,OAAO,EAAE,GACzB,MAAM,IAAI,MAAM,WAAW,OAAO,GAAG,WAAW;EAClD,OAAO,UAAU,IAAI,OAAO,EAAE,KAAK,OAAO;CAC5C;CAEA,OAAO;EACL,MAAM;EAEN,cAAc;GACZ,OAAO;GACP,YAAY;GACZ,MAAM;GACN,SAAS;GACT,KAAK;GACL,QAAQ,SAAS,eAAe,KAAA;EAClC;EAEA,MAAM,MAAM,QAAgD;GAC1D,MAAM,SAAS,MAAM,SAAS,MAAM,UAAU,CAAC,CAAC;GAChD,MAAM,SAA0B;IAAE,IAAI,OAAO;IAAI,MAAM;IAAW,KAAK,OAAO;GAAI;GAClF,UAAU,IAAI,OAAO,IAAI,OAAO,EAAE;GAClC,OAAO;EACT;EAEA,MAAM,KAAK,QAAyB,SAAiB,SAA+B;GAClF,OAAO,SAAS,KAAK,aAAa,MAAM,GAAG,SAAS,OAAO;EAC7D;EAKA,GAAI,SAAS,aACT,EACE,YAAY,OACV,QACA,SACA,YAC0B,SAAS,WAAY,aAAa,MAAM,GAAG,SAAS,OAAO,EACzF,IACA,CAAC;EAEL,GAAI,SAAS,eACT,EACE,cAAc,OAAO,QAAyB,YAC5C,SAAS,aAAc,aAAa,MAAM,GAAG;GAAE,GAAG;GAAS,KAAK,QAAQ,OAAO,OAAO;EAAI,CAAC,EAC/F,IACA,CAAC;EACL,GAAI,SAAS,oBACT,EACE,mBAAmB,OAAO,QAAyB,IAAY,YAC7D,SAAS,kBAAmB,aAAa,MAAM,GAAG,IAAI,OAAO,EACjE,IACA,CAAC;EAEL,MAAM,SAAS,QAAyB,MAA+B;GACrE,OAAO,SAAS,SAAS,aAAa,MAAM,GAAG,IAAI;EACrD;EAEA,MAAM,SAAS,QAAyB,MAAsC;GAO5E,OAAO,iBAAgB,YAAW,SAAS,KAAK,aAAa,MAAM,GAAG,OAAO,GAAG,IAAI;EACtF;EAEA,MAAM,UAAU,QAAyB,MAAc,SAA0B,UAA0C;GACzH,OAAO,SAAS,UAAU,aAAa,MAAM,GAAG,MAAM,SAAS,QAAQ;EACzE;EAEA,MAAM,UAAU,QAAyB,MAAc,SAA+C;GACpG,MAAM,YAAY,aAAa,MAAM;GACrC,IAAI,SAAS,MACX,OAAO,kBACL,OACA,YAAW,SAAS,KAAK,WAAW,SAAS,EAAE,KAAK,OAAO,IAAI,CAAC,GAChE,SAAS,SAAS,GACpB;GAEF,OAAO,SAAS,UAAU,WAAW,MAAM,OAAO;EACpD;EAEA,MAAM,QAAQ,QAAwC;GACpD,MAAM,KAAK,UAAU,IAAI,OAAO,EAAE;GAClC,IAAI,CAAC,IACH;GACF,MAAM,SAAS,QAAQ,EAAE;GACzB,UAAU,OAAO,OAAO,EAAE;GAG1B,UAAU,IAAI,OAAO,EAAE;EACzB;CACF;AACF"}
|