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/docker.js
CHANGED
|
@@ -1,456 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { a as outputExceededMessage, n as appendCapped, t as DEFAULT_MAX_OUTPUT_BUFFER } from "../output-cap-C9zukcCj.js";
|
|
3
|
-
import { t as alwaysQuote } from "../shell-quote-BmnhZmdM.js";
|
|
4
|
-
import { posix } from "node:path";
|
|
5
|
-
import { Buffer } from "node:buffer";
|
|
6
|
-
//#region src/contexts/docker.ts
|
|
7
|
-
/**
|
|
8
|
-
* `readFile` transport cap: headroom above the whole-read tool ceiling
|
|
9
|
-
* (256MB in tools/whole-read-guard.ts) so tool policy — not the docker
|
|
10
|
-
* transport — decides read limits, keeping refusal behavior consistent
|
|
11
|
-
* across contexts. Still bounded: a probe-failure path can't buffer
|
|
12
|
-
* more than this into host memory.
|
|
13
|
-
*/
|
|
14
|
-
const READ_FILE_MAX_BUFFER = 512 * 1024 * 1024;
|
|
15
|
-
/**
|
|
16
|
-
* dockerode surfaces HTTP errors with a `statusCode`. 304 = container
|
|
17
|
-
* already stopped, 404 = already gone — both are fine during teardown.
|
|
18
|
-
*/
|
|
19
|
-
function isGoneOrAlreadyStopped(err) {
|
|
20
|
-
const code = err?.statusCode;
|
|
21
|
-
return code === 304 || code === 404;
|
|
22
|
-
}
|
|
23
|
-
function createDockerContext(config) {
|
|
24
|
-
let counter = 0;
|
|
25
|
-
const containers = /* @__PURE__ */ new Map();
|
|
26
|
-
const defaultImage = config?.image ?? "oven/bun:latest";
|
|
27
|
-
const defaultCwd = config?.cwd ?? "/workspace";
|
|
28
|
-
const defaultEnv = config?.env;
|
|
29
|
-
const defaultLimits = config?.limits;
|
|
30
|
-
const defaultMounts = config?.mounts ?? [];
|
|
31
|
-
const defaultName = config?.name;
|
|
32
|
-
async function getDockerode() {
|
|
33
|
-
try {
|
|
34
|
-
const Dockerode = (await import("dockerode")).default;
|
|
35
|
-
return new Dockerode();
|
|
36
|
-
} catch {
|
|
37
|
-
throw new Error("dockerode is required for Docker execution context. Install it with: bun add dockerode");
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* The exec transport with an explicit output cap. The public `exec`
|
|
42
|
-
* uses the shared 10MB default; `readFile` passes headroom above the
|
|
43
|
-
* whole-read tool ceiling so docker's EFFECTIVE read limit matches
|
|
44
|
-
* every other context (the fileSize probe refuses oversized files
|
|
45
|
-
* before this ever runs — the transport cap is the safety net for
|
|
46
|
-
* probe-failure paths, not the primary bound).
|
|
47
|
-
*/
|
|
48
|
-
async function execCapped(handle, command, options, maxBuffer) {
|
|
49
|
-
const ref = containers.get(handle.id);
|
|
50
|
-
if (!ref) throw new Error(`Container ${handle.id} not found`);
|
|
51
|
-
const execCwd = options?.cwd ?? handle.cwd;
|
|
52
|
-
const env = options?.env ? Object.entries(options.env).map(([k, v]) => `${k}=${v}`) : [];
|
|
53
|
-
const timeout = options?.timeout ?? defaultLimits?.timeout ?? 30;
|
|
54
|
-
const exec = await ref.container.exec({
|
|
55
|
-
Cmd: [
|
|
56
|
-
"timeout",
|
|
57
|
-
String(timeout),
|
|
58
|
-
"sh",
|
|
59
|
-
"-c",
|
|
60
|
-
command
|
|
61
|
-
],
|
|
62
|
-
WorkingDir: execCwd,
|
|
63
|
-
Env: env,
|
|
64
|
-
AttachStdout: true,
|
|
65
|
-
AttachStderr: true
|
|
66
|
-
});
|
|
67
|
-
const stream = await exec.start({ Detach: false });
|
|
68
|
-
return new Promise((resolve) => {
|
|
69
|
-
const stdoutSlot = {
|
|
70
|
-
text: "",
|
|
71
|
-
bytes: 0
|
|
72
|
-
};
|
|
73
|
-
const stderrSlot = {
|
|
74
|
-
text: "",
|
|
75
|
-
bytes: 0
|
|
76
|
-
};
|
|
77
|
-
let resolved = false;
|
|
78
|
-
const overflow = () => {
|
|
79
|
-
if (resolved) return;
|
|
80
|
-
resolved = true;
|
|
81
|
-
try {
|
|
82
|
-
stream.destroy?.();
|
|
83
|
-
} catch {}
|
|
84
|
-
resolve({
|
|
85
|
-
stdout: stdoutSlot.text,
|
|
86
|
-
stderr: `${stderrSlot.text ? `${stderrSlot.text}\n` : ""}${outputExceededMessage(maxBuffer, "stream detached (server-side timeout reaps the process)")}`,
|
|
87
|
-
exitCode: 143
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
const cappedWrite = (slot) => (chunk) => {
|
|
91
|
-
if (appendCapped(slot, typeof chunk === "string" ? Buffer.from(chunk, "utf-8") : chunk, maxBuffer) !== "ok") overflow();
|
|
92
|
-
return true;
|
|
93
|
-
};
|
|
94
|
-
const stdoutSink = {
|
|
95
|
-
write: cappedWrite(stdoutSlot),
|
|
96
|
-
end() {},
|
|
97
|
-
on() {},
|
|
98
|
-
once() {},
|
|
99
|
-
emit() {
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
const stderrSink = {
|
|
104
|
-
write: cappedWrite(stderrSlot),
|
|
105
|
-
end() {},
|
|
106
|
-
on() {},
|
|
107
|
-
once() {},
|
|
108
|
-
emit() {
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
try {
|
|
113
|
-
ref.docker.modem.demuxStream(stream, stdoutSink, stderrSink);
|
|
114
|
-
} catch {
|
|
115
|
-
stream.on("data", (chunk) => {
|
|
116
|
-
cappedWrite(stdoutSlot)(chunk);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
const timer = setTimeout(() => {
|
|
120
|
-
if (resolved) return;
|
|
121
|
-
resolved = true;
|
|
122
|
-
try {
|
|
123
|
-
stream.destroy?.();
|
|
124
|
-
} catch {}
|
|
125
|
-
resolve({
|
|
126
|
-
stdout: stdoutSlot.text,
|
|
127
|
-
stderr: stderrSlot.text ? `${stderrSlot.text}\n[timeout]` : "[timeout]",
|
|
128
|
-
exitCode: 124
|
|
129
|
-
});
|
|
130
|
-
}, timeout * 1e3 + 1e3);
|
|
131
|
-
stream.on("end", async () => {
|
|
132
|
-
if (resolved) return;
|
|
133
|
-
resolved = true;
|
|
134
|
-
clearTimeout(timer);
|
|
135
|
-
let exitCode;
|
|
136
|
-
let inspectNote = "";
|
|
137
|
-
try {
|
|
138
|
-
const inspect = await exec.inspect();
|
|
139
|
-
if (inspect.ExitCode == null) {
|
|
140
|
-
exitCode = -1;
|
|
141
|
-
inspectNote = "[exit code unavailable: exec still marked running by daemon]";
|
|
142
|
-
} else exitCode = inspect.ExitCode;
|
|
143
|
-
} catch (err) {
|
|
144
|
-
exitCode = -1;
|
|
145
|
-
inspectNote = `[exit code unavailable: exec inspect failed: ${err?.message ?? String(err)}]`;
|
|
146
|
-
}
|
|
147
|
-
resolve({
|
|
148
|
-
stdout: stdoutSlot.text,
|
|
149
|
-
stderr: inspectNote ? stderrSlot.text ? `${stderrSlot.text}\n${inspectNote}` : inspectNote : stderrSlot.text,
|
|
150
|
-
exitCode
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
stream.on("error", (err) => {
|
|
154
|
-
if (resolved) return;
|
|
155
|
-
resolved = true;
|
|
156
|
-
clearTimeout(timer);
|
|
157
|
-
resolve({
|
|
158
|
-
stdout: stdoutSlot.text,
|
|
159
|
-
stderr: stderrSlot.text ? `${stderrSlot.text}\n${err.message}` : err.message,
|
|
160
|
-
exitCode: 1
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
const ctx = {
|
|
166
|
-
type: "docker",
|
|
167
|
-
capabilities: {
|
|
168
|
-
shell: true,
|
|
169
|
-
filesystem: true,
|
|
170
|
-
glob: true,
|
|
171
|
-
network: true,
|
|
172
|
-
gpu: false,
|
|
173
|
-
stream: true
|
|
174
|
-
},
|
|
175
|
-
async spawn(overrides) {
|
|
176
|
-
const docker = await getDockerode();
|
|
177
|
-
const id = `docker-${++counter}`;
|
|
178
|
-
const image = overrides?.image ?? defaultImage;
|
|
179
|
-
const cwd = overrides?.cwd ?? defaultCwd;
|
|
180
|
-
const mounts = [...defaultMounts, ...overrides?.mounts ?? []];
|
|
181
|
-
const name = overrides?.name ?? defaultName;
|
|
182
|
-
try {
|
|
183
|
-
await docker.getImage(image).inspect();
|
|
184
|
-
} catch {
|
|
185
|
-
await new Promise((resolve, reject) => {
|
|
186
|
-
docker.pull(image, (err, stream) => {
|
|
187
|
-
if (err) return reject(err);
|
|
188
|
-
docker.modem.followProgress(stream, (err2) => {
|
|
189
|
-
err2 ? reject(err2) : resolve();
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
const limits = {
|
|
195
|
-
...defaultLimits,
|
|
196
|
-
...overrides?.limits
|
|
197
|
-
};
|
|
198
|
-
const hostConfig = {};
|
|
199
|
-
if (limits?.memory) hostConfig.Memory = limits.memory * 1024 * 1024;
|
|
200
|
-
if (limits?.cpu) hostConfig.NanoCpus = Number.parseFloat(limits.cpu) * 1e9;
|
|
201
|
-
const hardening = {
|
|
202
|
-
...config?.hardening,
|
|
203
|
-
...overrides?.hardening
|
|
204
|
-
};
|
|
205
|
-
if (hardening.dropAllCapabilities) hostConfig.CapDrop = ["ALL"];
|
|
206
|
-
if (hardening.noNewPrivileges) hostConfig.SecurityOpt = ["no-new-privileges"];
|
|
207
|
-
if (hardening.readonlyRootfs) hostConfig.ReadonlyRootfs = true;
|
|
208
|
-
if (hardening.pidsLimit != null) hostConfig.PidsLimit = hardening.pidsLimit;
|
|
209
|
-
const env = {
|
|
210
|
-
...defaultEnv,
|
|
211
|
-
...overrides?.env
|
|
212
|
-
};
|
|
213
|
-
const bindSpecs = buildBindSpecs(mounts);
|
|
214
|
-
if (bindSpecs.length > 0) hostConfig.Binds = bindSpecs;
|
|
215
|
-
const portSpec = overrides?.ports ?? config?.ports;
|
|
216
|
-
const exposedPorts = {};
|
|
217
|
-
const portBindings = {};
|
|
218
|
-
if (portSpec?.length) {
|
|
219
|
-
for (const p of portSpec) {
|
|
220
|
-
const key = `${p.container}/${p.proto ?? "tcp"}`;
|
|
221
|
-
exposedPorts[key] = {};
|
|
222
|
-
portBindings[key] = [{ HostPort: p.host == null ? "" : String(p.host) }];
|
|
223
|
-
}
|
|
224
|
-
hostConfig.PortBindings = portBindings;
|
|
225
|
-
}
|
|
226
|
-
const user = overrides?.user ?? config?.user;
|
|
227
|
-
const network = overrides?.network ?? config?.network;
|
|
228
|
-
if (network) hostConfig.NetworkMode = network;
|
|
229
|
-
const labels = {
|
|
230
|
-
...config?.labels,
|
|
231
|
-
...overrides?.labels
|
|
232
|
-
};
|
|
233
|
-
const container = await docker.createContainer({
|
|
234
|
-
...name ? { name: `${name}-${counter}-${Math.random().toString(36).slice(2, 8)}` } : {},
|
|
235
|
-
Image: image,
|
|
236
|
-
Cmd: ["sleep", "infinity"],
|
|
237
|
-
WorkingDir: cwd,
|
|
238
|
-
Env: Object.entries(env).map(([k, v]) => `${k}=${v}`),
|
|
239
|
-
HostConfig: hostConfig,
|
|
240
|
-
...Object.keys(exposedPorts).length ? { ExposedPorts: exposedPorts } : {},
|
|
241
|
-
...user ? { User: user } : {},
|
|
242
|
-
...Object.keys(labels).length ? { Labels: labels } : {}
|
|
243
|
-
});
|
|
244
|
-
try {
|
|
245
|
-
await container.start();
|
|
246
|
-
} catch (err) {
|
|
247
|
-
await container.remove({ force: true }).catch(() => {});
|
|
248
|
-
throw err;
|
|
249
|
-
}
|
|
250
|
-
const handle = {
|
|
251
|
-
id,
|
|
252
|
-
type: "docker",
|
|
253
|
-
cwd
|
|
254
|
-
};
|
|
255
|
-
containers.set(id, {
|
|
256
|
-
handle,
|
|
257
|
-
container,
|
|
258
|
-
docker
|
|
259
|
-
});
|
|
260
|
-
return handle;
|
|
261
|
-
},
|
|
262
|
-
async exec(handle, command, options) {
|
|
263
|
-
return execCapped(handle, command, options, DEFAULT_MAX_OUTPUT_BUFFER);
|
|
264
|
-
},
|
|
265
|
-
/**
|
|
266
|
-
* Live bidirectional stream to a process in the container — see
|
|
267
|
-
* `ExecutionContext.execStream` for the seam contract.
|
|
268
|
-
*
|
|
269
|
-
* Spawns the `docker exec -i` CLI (see the runtime note in the body for
|
|
270
|
-
* why dockerode's hijack API is off the table), which adds a requirement
|
|
271
|
-
* the rest of this context doesn't have: the docker CLI must be on
|
|
272
|
-
* PATH — everything else here talks straight to the daemon socket.
|
|
273
|
-
* Deliberately NOT wrapped in coreutils `timeout` the way `execCapped`
|
|
274
|
-
* is — this seam's whole purpose is processes that outlive a single
|
|
275
|
-
* request.
|
|
276
|
-
*/
|
|
277
|
-
async execStream(handle, command, options) {
|
|
278
|
-
const ref = containers.get(handle.id);
|
|
279
|
-
if (!ref) throw new Error(`Container ${handle.id} not found`);
|
|
280
|
-
options?.signal?.throwIfAborted();
|
|
281
|
-
const spawnChild = (await import("node:child_process")).spawn;
|
|
282
|
-
const { randomBytes } = await import("node:crypto");
|
|
283
|
-
const pidFile = `/tmp/.zidane-stream-${randomBytes(6).toString("hex")}.pid`;
|
|
284
|
-
const envPrefix = Object.entries(options?.env ?? {}).map(([k, v]) => `${k}=${alwaysQuote(v)} `).join("");
|
|
285
|
-
const quotedLeader = alwaysQuote(`echo $$ > ${pidFile}; exec ${envPrefix ? `env ${envPrefix}` : ""}sh -c ${alwaysQuote(command)}`);
|
|
286
|
-
const inner = `if setsid -w true 2>/dev/null; then exec setsid -w sh -c ${quotedLeader}; else exec sh -c ${quotedLeader}; fi`;
|
|
287
|
-
const child = spawnChild("docker", [
|
|
288
|
-
"exec",
|
|
289
|
-
"-i",
|
|
290
|
-
"-w",
|
|
291
|
-
options?.cwd ?? handle.cwd,
|
|
292
|
-
ref.container.id,
|
|
293
|
-
"sh",
|
|
294
|
-
"-c",
|
|
295
|
-
inner
|
|
296
|
-
], { stdio: [
|
|
297
|
-
"pipe",
|
|
298
|
-
"pipe",
|
|
299
|
-
"pipe"
|
|
300
|
-
] });
|
|
301
|
-
let spawnError = null;
|
|
302
|
-
child.on("error", (err) => {
|
|
303
|
-
spawnError = err;
|
|
304
|
-
});
|
|
305
|
-
const exited = new Promise((resolveExit) => {
|
|
306
|
-
child.once("close", (code, signalName) => {
|
|
307
|
-
resolveExit(code ?? (signalName === "SIGTERM" ? 143 : signalName ? 128 : 1));
|
|
308
|
-
});
|
|
309
|
-
});
|
|
310
|
-
let pid = -1;
|
|
311
|
-
for (let attempt = 0; attempt < 20 && pid <= 0; attempt++) {
|
|
312
|
-
const probe = await execCapped(handle, `cat ${pidFile} 2>/dev/null || true`, void 0, 4096).catch(() => null);
|
|
313
|
-
const parsed = Number.parseInt(probe?.stdout.trim() ?? "", 10);
|
|
314
|
-
if (Number.isFinite(parsed) && parsed > 0) {
|
|
315
|
-
pid = parsed;
|
|
316
|
-
break;
|
|
317
|
-
}
|
|
318
|
-
if (child.exitCode !== null) break;
|
|
319
|
-
await new Promise((r) => setTimeout(r, 50));
|
|
320
|
-
}
|
|
321
|
-
const kill = async () => {
|
|
322
|
-
if (pid > 0) await execCapped(handle, `kill -TERM -${pid} 2>/dev/null || kill -TERM ${pid} 2>/dev/null || true`, void 0, 4096).catch(() => {});
|
|
323
|
-
await execCapped(handle, `rm -f ${pidFile}`, void 0, 4096).catch(() => {});
|
|
324
|
-
if (child.exitCode === null && child.signalCode === null) child.kill("SIGTERM");
|
|
325
|
-
};
|
|
326
|
-
if (options?.signal) if (options.signal.aborted) kill();
|
|
327
|
-
else {
|
|
328
|
-
const onAbort = () => {
|
|
329
|
-
kill();
|
|
330
|
-
};
|
|
331
|
-
const detach = () => options.signal.removeEventListener("abort", onAbort);
|
|
332
|
-
options.signal.addEventListener("abort", onAbort, { once: true });
|
|
333
|
-
exited.then(detach, detach);
|
|
334
|
-
}
|
|
335
|
-
return {
|
|
336
|
-
pid,
|
|
337
|
-
stdout: child.stdout,
|
|
338
|
-
stderr: child.stderr,
|
|
339
|
-
write: async (data) => {
|
|
340
|
-
if (spawnError) throw spawnError;
|
|
341
|
-
const stdin = child.stdin;
|
|
342
|
-
if (!stdin || stdin.destroyed) throw new Error(`execStream: stdin is closed (container ${handle.id})`);
|
|
343
|
-
await new Promise((resolveWrite, rejectWrite) => {
|
|
344
|
-
stdin.write(data, (err) => err ? rejectWrite(err) : resolveWrite());
|
|
345
|
-
});
|
|
346
|
-
},
|
|
347
|
-
kill,
|
|
348
|
-
exited
|
|
349
|
-
};
|
|
350
|
-
},
|
|
351
|
-
async fileSize(handle, path) {
|
|
352
|
-
return fileSizeViaExec((command) => execCapped(handle, command, void 0, DEFAULT_MAX_OUTPUT_BUFFER), path);
|
|
353
|
-
},
|
|
354
|
-
async readFile(handle, path) {
|
|
355
|
-
const result = await execCapped(handle, `cat ${alwaysQuote(path)}`, void 0, READ_FILE_MAX_BUFFER);
|
|
356
|
-
if (result.exitCode !== 0) throw new Error(`Failed to read file: ${result.stderr}`);
|
|
357
|
-
return result.stdout;
|
|
358
|
-
},
|
|
359
|
-
async writeFile(handle, path, content, encoding = "utf-8") {
|
|
360
|
-
const bytes = typeof content === "string" ? Buffer.from(content, encoding) : content;
|
|
361
|
-
const ref = containers.get(handle.id);
|
|
362
|
-
if (!ref) throw new Error(`Container ${handle.id} not found`);
|
|
363
|
-
const dest = posix.isAbsolute(path) ? path : posix.join(handle.cwd, path);
|
|
364
|
-
const dir = posix.dirname(dest);
|
|
365
|
-
const name = posix.basename(dest);
|
|
366
|
-
if (!name || name === "." || name === ".." || path.endsWith("/")) throw new Error(`Failed to write file: invalid path ${path}`);
|
|
367
|
-
const mkdir = await ctx.exec(handle, `mkdir -p ${alwaysQuote(dir)}`);
|
|
368
|
-
if (mkdir.exitCode !== 0) throw new Error(`Failed to write file: ${mkdir.stderr}`);
|
|
369
|
-
const stagedName = `.zidane-write-${Math.random().toString(36).slice(2, 10)}.tmp`;
|
|
370
|
-
const staged = posix.join(dir, stagedName);
|
|
371
|
-
try {
|
|
372
|
-
await ref.container.putArchive(await packTarFile(stagedName, bytes), { path: dir });
|
|
373
|
-
} catch (err) {
|
|
374
|
-
throw new Error(`Failed to write file: ${err instanceof Error ? err.message : String(err)}`);
|
|
375
|
-
}
|
|
376
|
-
const write = await ctx.exec(handle, `cat ${alwaysQuote(staged)} > ${alwaysQuote(dest)}; rc=$?; rm -f ${alwaysQuote(staged)}; exit $rc`);
|
|
377
|
-
if (write.exitCode !== 0) {
|
|
378
|
-
await ctx.exec(handle, `rm -f ${alwaysQuote(staged)}`).catch(() => {});
|
|
379
|
-
throw new Error(`Failed to write file: ${write.stderr}`);
|
|
380
|
-
}
|
|
381
|
-
},
|
|
382
|
-
async listFiles(handle, path, options) {
|
|
383
|
-
if (options?.glob) return globFilesViaShell(path, (command) => ctx.exec(handle, command), options?.limit ?? 1e3);
|
|
384
|
-
const result = await ctx.exec(handle, `ls -1p ${alwaysQuote(path)}`);
|
|
385
|
-
if (result.exitCode !== 0) throw new Error(result.stderr.trim() || `ls failed with exit ${result.exitCode}`);
|
|
386
|
-
return result.stdout.trim().split("\n").filter(Boolean);
|
|
387
|
-
},
|
|
388
|
-
async getMappedPort(handle, containerPort) {
|
|
389
|
-
const ref = containers.get(handle.id);
|
|
390
|
-
if (!ref) return null;
|
|
391
|
-
const bindings = (await ref.container.inspect())?.NetworkSettings?.Ports ?? {};
|
|
392
|
-
for (const proto of ["tcp", "udp"]) {
|
|
393
|
-
const list = bindings[`${containerPort}/${proto}`];
|
|
394
|
-
if (Array.isArray(list) && list.length > 0 && list[0]?.HostPort) return Number.parseInt(list[0].HostPort, 10);
|
|
395
|
-
}
|
|
396
|
-
return null;
|
|
397
|
-
},
|
|
398
|
-
async destroy(handle) {
|
|
399
|
-
const ref = containers.get(handle.id);
|
|
400
|
-
if (!ref) return;
|
|
401
|
-
try {
|
|
402
|
-
try {
|
|
403
|
-
await ref.container.stop({ t: 5 });
|
|
404
|
-
} catch {}
|
|
405
|
-
try {
|
|
406
|
-
await ref.container.remove({ force: true });
|
|
407
|
-
} catch (err) {
|
|
408
|
-
if (!isGoneOrAlreadyStopped(err)) throw err;
|
|
409
|
-
}
|
|
410
|
-
} finally {
|
|
411
|
-
containers.delete(handle.id);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
return ctx;
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Format one {@link ContextMount} as a dockerode `HostConfig.Binds` entry.
|
|
419
|
-
* Supports read-only (`:ro`) and SELinux shared-label (`:z`) options; the two
|
|
420
|
-
* are mutually exclusive (a read-only mount can't also be a shared rw mount).
|
|
421
|
-
*/
|
|
422
|
-
function formatBindMount(mount) {
|
|
423
|
-
if (!mount.source) throw new Error("Docker mount source is required");
|
|
424
|
-
if (!mount.target || !mount.target.startsWith("/")) throw new Error(`Docker mount target must be an absolute path: ${mount.target}`);
|
|
425
|
-
if (mount.readonly && mount.shared) throw new Error(`Docker mount cannot be both readonly and shared: ${mount.target}`);
|
|
426
|
-
const opts = mount.readonly ? ":ro" : mount.shared ? ":z" : "";
|
|
427
|
-
return `${mount.source}:${mount.target}${opts}`;
|
|
428
|
-
}
|
|
429
|
-
/** Assemble dockerode `HostConfig.Binds` from the context's `mounts`. */
|
|
430
|
-
function buildBindSpecs(mounts) {
|
|
431
|
-
return mounts.map(formatBindMount);
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Pack a single file into an in-memory tar archive for `putArchive`, via
|
|
435
|
-
* `tar-stream` (the same battle-tested packer the dockerode ecosystem uses
|
|
436
|
-
* for build contexts). Optional peer dependency, loaded lazily like
|
|
437
|
-
* dockerode itself so the module graph stays lean for non-docker users.
|
|
438
|
-
*/
|
|
439
|
-
async function packTarFile(name, data) {
|
|
440
|
-
let pack;
|
|
441
|
-
try {
|
|
442
|
-
pack = (await import("tar-stream")).pack;
|
|
443
|
-
} catch {
|
|
444
|
-
throw new Error("tar-stream is required for Docker writeFile. Install it with: bun add tar-stream");
|
|
445
|
-
}
|
|
446
|
-
const tar = pack();
|
|
447
|
-
tar.entry({ name }, data);
|
|
448
|
-
tar.finalize();
|
|
449
|
-
const chunks = [];
|
|
450
|
-
for await (const chunk of tar) chunks.push(chunk);
|
|
451
|
-
return Buffer.concat(chunks);
|
|
452
|
-
}
|
|
453
|
-
//#endregion
|
|
454
|
-
export { READ_FILE_MAX_BUFFER, buildBindSpecs, createDockerContext, packTarFile };
|
|
455
|
-
|
|
456
|
-
//# sourceMappingURL=docker.js.map
|
|
1
|
+
export { i as READ_FILE_MAX_BUFFER, r as buildBindSpecs, t as createDockerContext, n as hostWorkspaceMounts, a as packTarFile } from "../docker-BZhMMJUp.js";
|
package/dist/contexts/e2b.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as SandboxProvider } from "../sandbox-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { tp as Logger } from "../index-BGe1fQT7.js";
|
|
2
|
+
import { t as SandboxProvider } from "../sandbox-C5dR5DwQ.js";
|
|
3
|
+
//#region src/contexts/e2b-sdk.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Structural `e2b` SDK views + env merge shared by the E2B provider modules.
|
|
6
|
+
* Internal module.
|
|
7
|
+
*/
|
|
5
8
|
/**
|
|
6
9
|
* Options that flip `commands.run` into background mode. Split out so the
|
|
7
10
|
* overload above can discriminate on it: `background: true` changes the
|
|
@@ -40,14 +43,43 @@ interface E2BCommandHandle {
|
|
|
40
43
|
pid: number;
|
|
41
44
|
wait: () => Promise<E2BCommandResult>;
|
|
42
45
|
}
|
|
46
|
+
/** The SDK's PTY `CommandHandle`, as far as terminals use it. */
|
|
47
|
+
interface E2BPtyHandle {
|
|
48
|
+
pid: number;
|
|
49
|
+
wait: () => Promise<{
|
|
50
|
+
exitCode?: number;
|
|
51
|
+
}>;
|
|
52
|
+
disconnect: () => Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
interface E2BPtyOutput {
|
|
55
|
+
onData: (data: Uint8Array) => void;
|
|
56
|
+
timeoutMs?: number;
|
|
57
|
+
}
|
|
43
58
|
interface E2BSandbox {
|
|
44
59
|
sandboxId: string;
|
|
60
|
+
/** Interactive terminals (`sandbox.pty`); used only by `openTerminal`. */
|
|
61
|
+
pty?: {
|
|
62
|
+
create: (opts: E2BPtyOutput & {
|
|
63
|
+
cols: number;
|
|
64
|
+
rows: number;
|
|
65
|
+
cwd?: string;
|
|
66
|
+
envs?: Record<string, string>;
|
|
67
|
+
}) => Promise<E2BPtyHandle>;
|
|
68
|
+
connect: (pid: number, opts?: E2BPtyOutput) => Promise<E2BPtyHandle>;
|
|
69
|
+
sendInput: (pid: number, data: Uint8Array) => Promise<void>;
|
|
70
|
+
resize: (pid: number, size: {
|
|
71
|
+
cols: number;
|
|
72
|
+
rows: number;
|
|
73
|
+
}) => Promise<void>;
|
|
74
|
+
kill: (pid: number) => Promise<boolean>;
|
|
75
|
+
};
|
|
45
76
|
commands: {
|
|
46
77
|
run: ((cmd: string, opts?: {
|
|
47
78
|
cwd?: string;
|
|
48
79
|
envs?: Record<string, string>;
|
|
49
80
|
timeoutMs?: number;
|
|
50
|
-
}) => Promise<E2BCommandResult>) & ((cmd: string, opts: E2BBackgroundOptions) => Promise<E2BCommandHandle>);
|
|
81
|
+
}) => Promise<E2BCommandResult>) & ((cmd: string, opts: E2BBackgroundOptions) => Promise<E2BCommandHandle>);
|
|
82
|
+
/** Present from the SDK's Commands module; used only by `execStream`. */
|
|
51
83
|
sendStdin?: (pid: number, data: string | Uint8Array) => Promise<void>;
|
|
52
84
|
kill?: (pid: number) => Promise<boolean>;
|
|
53
85
|
};
|
|
@@ -66,6 +98,23 @@ interface E2BSandbox {
|
|
|
66
98
|
kill: () => Promise<unknown>;
|
|
67
99
|
pause?: () => Promise<boolean>;
|
|
68
100
|
betaPause?: () => Promise<boolean>;
|
|
101
|
+
/** Extend (or shorten) the sandbox's timeout from now — used by `keepAliveSeconds`. */
|
|
102
|
+
setTimeout?: (timeoutMs: number) => Promise<void>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Merge the factory-level {@link E2BProviderOptions.env} with the per-spawn
|
|
106
|
+
* `SpawnConfig.env`, per-spawn winning on key conflicts. Returns `undefined`
|
|
107
|
+
* when the merge is empty so callers can skip setting `envs` on the create
|
|
108
|
+
* options entirely (rather than handing the SDK an empty object).
|
|
109
|
+
*/
|
|
110
|
+
declare function resolveE2BEnv(optionEnv: Record<string, string> | undefined, perSpawnEnv: Record<string, string> | undefined): Record<string, string> | undefined;
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/contexts/e2b.d.ts
|
|
113
|
+
/** What E2B does when a sandbox's timeout elapses (e2b SDK `SandboxLifecycle`). */
|
|
114
|
+
interface E2BLifecycle {
|
|
115
|
+
onTimeout: 'pause' | 'kill';
|
|
116
|
+
/** Resume a paused sandbox on the next connect / request (needs `onTimeout: 'pause'`). */
|
|
117
|
+
autoResume?: boolean;
|
|
69
118
|
}
|
|
70
119
|
interface E2BProviderOptions {
|
|
71
120
|
/** E2B API key. Falls back to the `E2B_API_KEY` env var when omitted. */
|
|
@@ -150,6 +199,19 @@ interface E2BProviderOptions {
|
|
|
150
199
|
* their lifecycle.
|
|
151
200
|
*/
|
|
152
201
|
onDestroy?: 'kill' | 'pause' | 'leave';
|
|
202
|
+
/**
|
|
203
|
+
* What happens when a created sandbox's timeout elapses. `{ onTimeout:
|
|
204
|
+
* 'pause', autoResume: true }` makes a timeout a pause instead of a kill —
|
|
205
|
+
* what long-lived sessions want. Default: E2B's (kill).
|
|
206
|
+
*/
|
|
207
|
+
lifecycle?: E2BLifecycle;
|
|
208
|
+
/**
|
|
209
|
+
* Keep the sandbox alive while it's used: at most once a minute, any
|
|
210
|
+
* command or file call pushes its timeout out to this many seconds from
|
|
211
|
+
* now (`sandbox.setTimeout`). An idle sandbox still times out. Off when
|
|
212
|
+
* unset.
|
|
213
|
+
*/
|
|
214
|
+
keepAliveSeconds?: number;
|
|
153
215
|
}
|
|
154
216
|
/**
|
|
155
217
|
* Upload a setup ("pregame") script into a ready sandbox and execute it.
|
|
@@ -206,13 +268,6 @@ declare function waitForE2BReady(sandbox: E2BSandbox, logger: Logger, opts: E2BR
|
|
|
206
268
|
* NOT `E2B_TEMPLATE`, so this provider has to honor it itself.
|
|
207
269
|
*/
|
|
208
270
|
declare function resolveE2BTemplate(perSpawnTemplate: string | undefined, optionTemplate: string | undefined, env?: Record<string, string | undefined>): string | undefined;
|
|
209
|
-
/**
|
|
210
|
-
* Merge the factory-level {@link E2BProviderOptions.env} with the per-spawn
|
|
211
|
-
* `SpawnConfig.env`, per-spawn winning on key conflicts. Returns `undefined`
|
|
212
|
-
* when the merge is empty so callers can skip setting `envs` on the create
|
|
213
|
-
* options entirely (rather than handing the SDK an empty object).
|
|
214
|
-
*/
|
|
215
|
-
declare function resolveE2BEnv(optionEnv: Record<string, string> | undefined, perSpawnEnv: Record<string, string> | undefined): Record<string, string> | undefined;
|
|
216
271
|
/**
|
|
217
272
|
* Build a {@link SandboxProvider} backed by E2B.
|
|
218
273
|
*
|
|
@@ -222,5 +277,5 @@ declare function resolveE2BEnv(optionEnv: Record<string, string> | undefined, pe
|
|
|
222
277
|
*/
|
|
223
278
|
declare function createE2BProvider(options?: E2BProviderOptions): SandboxProvider;
|
|
224
279
|
//#endregion
|
|
225
|
-
export { E2BProviderOptions, E2BReadinessOptions, createE2BProvider, resolveE2BEnv, resolveE2BTemplate, runE2BPregame, waitForE2BReady };
|
|
280
|
+
export { E2BLifecycle, E2BProviderOptions, E2BReadinessOptions, createE2BProvider, resolveE2BEnv, resolveE2BTemplate, runE2BPregame, waitForE2BReady };
|
|
226
281
|
//# sourceMappingURL=e2b.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e2b.d.ts","names":[],"sources":["../../src/contexts/e2b.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"e2b.d.ts","names":[],"sources":["../../src/contexts/e2b-sdk.ts","../../src/contexts/e2b.ts"],"mappings":";;;;;;;;;;;;;;;;;;UA2BiB;EACf;EACA;EACA;EACA;EACA,OAAO;EACP,YAAY;EACZ,YAAY;;UAYG;EACf;EACA;EACA;;UAGe;EACf;;EAEA;;;;;;UAOe;EACf;EACA,YAAY,QAAQ;;;UAIL;EACf;EACA,YAAY;IAAU;;EACtB,kBAAkB;;UAGH;EACf,SAAS,MAAM;EACf;;UAGe;EACf;;EAEA;IACE,SAAS,MAAM;MAAiB;MAAc;MAAc;MAAc,OAAO;UAA6B,QAAQ;IACtH,UAAU,aAAa,OAAO,iBAAiB,QAAQ;IACvD,YAAY,aAAa,MAAM,eAAe;IAC9C,SAAS,aAAa;MAAQ;MAAc;UAAmB;IAC/D,OAAO,gBAAgB;;EAEzB;IACE,OAAO,aAAa;MAAS;MAAc,OAAO;MAAwB;UAAyB,QAAQ,uBACrG,aAAa,MAAM,yBAAyB,QAAQ;;IAE1D,aAAa,aAAa,eAAe,eAAe;IACxD,QAAQ,gBAAgB;;EAE1B;IACE,OAAO,iBAAiB;;;;;;;;IAQxB,QAAQ,cAAc,eAAe,eAAe;IACpD,OAAO,iBAAiB,QAAQ;;EAElC,YAAY;EAKZ,cAAc;EACd,kBAAkB;;EAElB,cAAc,sBAAsB;;;;;;;;iBAStB,cACd,WAAW,oCACX,aAAa,qCACZ;;;;UC/Ec;EACf;;EAEA;;UA2Be;;EAEf;;;;;;EAMA;;;;;;EAMA;;;;;;;;;EASA;;;;;EAKA;;;;;EAKA;;;;;;EAMA,MAAM;;;;;;EAMN,SAAS;;;;;;;;EAQT;;;;;;;;;EASA;IAAY;IAAc;;;;;;;;;;;;;;;;;;EAiB1B;;;;;;EAMA,YAAY;;;;;;;EAOZ;;;;;;;;;;;;;;iBA+BoB,cACpB,SAAS,YACT,QAAQ,QACR;EAAQ;EAAc;EAAiB;EAAc,OAAO;IAC3D;UA8Bc;;EAEf;;;;;;;EAOA;;EAEA;;EAEA,SAAS,eAAe;;;;;;;;;;;;;;;iBAgBJ,gBACpB,SAAS,YACT,QAAQ,QACR,MAAM,sBACL;;;;;;;;iBAmCa,mBACd,sCACA,oCACA,MAAK;;;;;;;;iBAgBS,kBAAkB,UAAS,qBAA0B"}
|