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/daytona.js
CHANGED
|
@@ -1,440 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { u as errorMessage } from "../errors-DKiMrOKq.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/daytona.ts
|
|
7
|
-
/** Per-probe timeout for the readiness `true` command. */
|
|
8
|
-
const READINESS_PROBE_TIMEOUT_SECONDS = 5;
|
|
9
|
-
/** Pause between readiness probes while the sandbox is still warming up. */
|
|
10
|
-
const READINESS_BACKOFF_MS = 250;
|
|
11
|
-
/** Setup scripts commonly install dependencies, so give them a generous cap. */
|
|
12
|
-
const PREGAME_TIMEOUT_SECONDS = 1800;
|
|
13
|
-
function resolveDaytonaEnv(optionEnv, perSpawnEnv) {
|
|
14
|
-
const merged = {
|
|
15
|
-
...optionEnv,
|
|
16
|
-
...perSpawnEnv
|
|
17
|
-
};
|
|
18
|
-
return Object.keys(merged).length > 0 ? merged : void 0;
|
|
19
|
-
}
|
|
20
|
-
function normalizeDaytonaExecResult(response) {
|
|
21
|
-
return {
|
|
22
|
-
stdout: response.stdout ?? response.artifacts?.stdout ?? response.result ?? response.output ?? "",
|
|
23
|
-
stderr: response.stderr ?? "",
|
|
24
|
-
exitCode: typeof response.exitCode === "number" ? response.exitCode : 0
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function capExecResult(result) {
|
|
28
|
-
return {
|
|
29
|
-
...capBufferedExecOutput(result.stdout, result.stderr),
|
|
30
|
-
exitCode: result.exitCode
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function normalizeDaytonaExecError(error) {
|
|
34
|
-
const err = error;
|
|
35
|
-
if (typeof err.exitCode === "number") return {
|
|
36
|
-
stdout: typeof err.stdout === "string" ? err.stdout : typeof err.result === "string" ? err.result : typeof err.output === "string" ? err.output : "",
|
|
37
|
-
stderr: typeof err.stderr === "string" ? err.stderr : typeof err.message === "string" ? err.message : "",
|
|
38
|
-
exitCode: err.exitCode
|
|
39
|
-
};
|
|
40
|
-
return {
|
|
41
|
-
stdout: "",
|
|
42
|
-
stderr: error instanceof Error ? error.message : String(error),
|
|
43
|
-
exitCode: 124
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function toClientConfig(apiKey, apiUrl, target) {
|
|
47
|
-
const config = {};
|
|
48
|
-
if (apiKey !== void 0) config.apiKey = apiKey;
|
|
49
|
-
if (apiUrl !== void 0) config.apiUrl = apiUrl;
|
|
50
|
-
if (target !== void 0) config.target = target;
|
|
51
|
-
return Object.keys(config).length > 0 ? config : void 0;
|
|
52
|
-
}
|
|
53
|
-
function takeString(value) {
|
|
54
|
-
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
55
|
-
}
|
|
56
|
-
function resolveDaytonaCreateParams(sandboxConfig, options, envVars) {
|
|
57
|
-
const reserved = /* @__PURE__ */ new Set([
|
|
58
|
-
"provider",
|
|
59
|
-
"apiKey",
|
|
60
|
-
"apiUrl",
|
|
61
|
-
"target",
|
|
62
|
-
"sandboxId"
|
|
63
|
-
]);
|
|
64
|
-
const params = {};
|
|
65
|
-
for (const [key, value] of Object.entries(sandboxConfig)) if (!reserved.has(key) && value !== void 0) params[key] = value;
|
|
66
|
-
const language = takeString(sandboxConfig.language) ?? options.language;
|
|
67
|
-
const snapshot = takeString(sandboxConfig.snapshot) ?? options.snapshot;
|
|
68
|
-
const image = sandboxConfig.image ?? options.image;
|
|
69
|
-
const resources = sandboxConfig.resources ?? options.resources;
|
|
70
|
-
const configEnvVars = sandboxConfig.envVars;
|
|
71
|
-
const mergedEnvVars = resolveDaytonaEnv(envVars, configEnvVars);
|
|
72
|
-
if (language !== void 0) params.language = language;
|
|
73
|
-
if (snapshot !== void 0) params.snapshot = snapshot;
|
|
74
|
-
if (image !== void 0) params.image = image;
|
|
75
|
-
if (resources !== void 0) params.resources = resources;
|
|
76
|
-
if (mergedEnvVars !== void 0) params.envVars = mergedEnvVars;
|
|
77
|
-
return Object.keys(params).length > 0 ? params : void 0;
|
|
78
|
-
}
|
|
79
|
-
async function waitForDaytonaReady(sandbox, logger, opts) {
|
|
80
|
-
if (opts.timeoutSeconds <= 0) return;
|
|
81
|
-
const now = opts.now ?? Date.now;
|
|
82
|
-
const sleep = opts.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
83
|
-
const start = now();
|
|
84
|
-
const deadline = start + opts.timeoutSeconds * 1e3;
|
|
85
|
-
logger.info("waiting for Daytona sandbox to initialize", { sandboxId: sandbox.id });
|
|
86
|
-
while (true) try {
|
|
87
|
-
await sandbox.process.executeCommand("true", void 0, void 0, READINESS_PROBE_TIMEOUT_SECONDS);
|
|
88
|
-
logger.info("Daytona sandbox ready", {
|
|
89
|
-
sandboxId: sandbox.id,
|
|
90
|
-
elapsedMs: now() - start
|
|
91
|
-
});
|
|
92
|
-
return;
|
|
93
|
-
} catch {
|
|
94
|
-
if (now() >= deadline) {
|
|
95
|
-
await opts.cleanupOnTimeout?.().catch(() => {});
|
|
96
|
-
throw new Error(`Daytona sandbox ${sandbox.id} did not become ready within ${opts.timeoutSeconds}s`);
|
|
97
|
-
}
|
|
98
|
-
await sleep(READINESS_BACKOFF_MS);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
async function runDaytonaPregame(sandbox, logger, opts) {
|
|
102
|
-
const path = `/tmp/${opts.name}`;
|
|
103
|
-
logger.info("running Daytona pregame script", {
|
|
104
|
-
sandboxId: sandbox.id,
|
|
105
|
-
path
|
|
106
|
-
});
|
|
107
|
-
await sandbox.fs.uploadFile(Buffer.from(opts.content), path);
|
|
108
|
-
const quoted = JSON.stringify(path);
|
|
109
|
-
let result;
|
|
110
|
-
try {
|
|
111
|
-
result = normalizeDaytonaExecResult(await sandbox.process.executeCommand(`chmod +x ${quoted} && ${quoted}`, opts.cwd, opts.envVars, PREGAME_TIMEOUT_SECONDS));
|
|
112
|
-
} catch (err) {
|
|
113
|
-
result = normalizeDaytonaExecError(err);
|
|
114
|
-
}
|
|
115
|
-
if (result.exitCode !== 0) {
|
|
116
|
-
logger.error("Daytona pregame script failed", {
|
|
117
|
-
sandboxId: sandbox.id,
|
|
118
|
-
exitCode: result.exitCode,
|
|
119
|
-
stdout: result.stdout,
|
|
120
|
-
stderr: result.stderr
|
|
121
|
-
});
|
|
122
|
-
throw new Error(`Daytona pregame script ${opts.name} failed with exit code ${result.exitCode}`);
|
|
123
|
-
}
|
|
124
|
-
logger.info("Daytona pregame ready", {
|
|
125
|
-
sandboxId: sandbox.id,
|
|
126
|
-
stdout: result.stdout,
|
|
127
|
-
stderr: result.stderr
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
function createDaytonaProvider(options = {}) {
|
|
131
|
-
const live = /* @__PURE__ */ new Map();
|
|
132
|
-
const logger = options.logger ?? createLogger(consoleSink());
|
|
133
|
-
const readinessTimeoutSeconds = options.readinessTimeoutSeconds ?? 60;
|
|
134
|
-
async function loadSdk() {
|
|
135
|
-
try {
|
|
136
|
-
return (await import("@daytona/sdk")).Daytona;
|
|
137
|
-
} catch (err) {
|
|
138
|
-
const message = errorMessage(err);
|
|
139
|
-
const notInstalled = /cannot find (?:module|package)|module not found|failed to resolve/i.test(message);
|
|
140
|
-
throw new Error(notInstalled ? "@daytona/sdk is required for the Daytona sandbox provider. Install it with: bun add @daytona/sdk" : `@daytona/sdk is installed but failed to load: ${message}. If this mentions tslib, pin it with a root override: "overrides": { "tslib": "^2.8.1" } — see docs/RESTATE.md.`, { cause: err });
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function get(sandboxId) {
|
|
144
|
-
const entry = live.get(sandboxId);
|
|
145
|
-
if (!entry) throw new Error(`Daytona sandbox ${sandboxId} is not tracked by this provider`);
|
|
146
|
-
return entry;
|
|
147
|
-
}
|
|
148
|
-
async function deleteOwnedSandbox(sandbox) {
|
|
149
|
-
try {
|
|
150
|
-
await sandbox.delete();
|
|
151
|
-
} catch {}
|
|
152
|
-
}
|
|
153
|
-
async function stopOwnedSandbox(sandbox) {
|
|
154
|
-
if (!sandbox.stop) {
|
|
155
|
-
logger.error("cannot stop Daytona sandbox: this @daytona/sdk install exposes no stop() method; leaving it running", { sandboxId: sandbox.id });
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
try {
|
|
159
|
-
await sandbox.stop();
|
|
160
|
-
logger.info("stopped Daytona sandbox; reconnect later via the sandboxId option (CLI: --sandbox)", { sandboxId: sandbox.id });
|
|
161
|
-
} catch (err) {
|
|
162
|
-
logger.error("failed to stop Daytona sandbox; it will run until Daytona lifecycle policy stops it", {
|
|
163
|
-
sandboxId: sandbox.id,
|
|
164
|
-
error: err instanceof Error ? err.message : String(err)
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
async function archiveOwnedSandbox(sandbox) {
|
|
169
|
-
if (!sandbox.stop || !sandbox.archive) {
|
|
170
|
-
logger.error("cannot archive Daytona sandbox: this @daytona/sdk install exposes no stop() and archive() pair; leaving it running", { sandboxId: sandbox.id });
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
try {
|
|
174
|
-
await sandbox.stop();
|
|
175
|
-
await sandbox.archive();
|
|
176
|
-
logger.info("archived Daytona sandbox; reconnect later via the sandboxId option (CLI: --sandbox)", { sandboxId: sandbox.id });
|
|
177
|
-
} catch (err) {
|
|
178
|
-
logger.error("failed to archive Daytona sandbox; it will run until Daytona lifecycle policy stops it", {
|
|
179
|
-
sandboxId: sandbox.id,
|
|
180
|
-
error: err instanceof Error ? err.message : String(err)
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
async function startAttachedSandboxIfNeeded(sandbox) {
|
|
185
|
-
if (sandbox.state !== "stopped" && sandbox.state !== "archived") return;
|
|
186
|
-
if (!sandbox.start) {
|
|
187
|
-
logger.error("cannot start Daytona sandbox before attach readiness probe: this @daytona/sdk install exposes no start() method", {
|
|
188
|
-
sandboxId: sandbox.id,
|
|
189
|
-
state: sandbox.state
|
|
190
|
-
});
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
logger.info("starting Daytona sandbox before attach readiness probe", {
|
|
194
|
-
sandboxId: sandbox.id,
|
|
195
|
-
state: sandbox.state
|
|
196
|
-
});
|
|
197
|
-
await sandbox.start(readinessTimeoutSeconds > 0 ? readinessTimeoutSeconds : void 0);
|
|
198
|
-
}
|
|
199
|
-
return {
|
|
200
|
-
name: "daytona",
|
|
201
|
-
async spawn(config = {}) {
|
|
202
|
-
const Daytona = await loadSdk();
|
|
203
|
-
const sb = config.sandbox ?? {};
|
|
204
|
-
const apiKey = takeString(sb.apiKey) ?? options.apiKey;
|
|
205
|
-
const apiUrl = takeString(sb.apiUrl) ?? options.apiUrl;
|
|
206
|
-
const target = takeString(sb.target) ?? options.target;
|
|
207
|
-
const connectId = takeString(sb.sandboxId) ?? options.sandboxId;
|
|
208
|
-
const snapshot = takeString(sb.snapshot) ?? options.snapshot;
|
|
209
|
-
const envVars = resolveDaytonaEnv(options.env, config.env);
|
|
210
|
-
const daytona = new Daytona(toClientConfig(apiKey, apiUrl, target));
|
|
211
|
-
let attached = connectId !== void 0;
|
|
212
|
-
let sandbox = connectId !== void 0 ? await daytona.get(connectId) : await daytona.create(resolveDaytonaCreateParams(sb, options, envVars));
|
|
213
|
-
if (attached && snapshot !== void 0 && sandbox.snapshot !== snapshot) {
|
|
214
|
-
logger.info("recreating Daytona sandbox: snapshot changed", {
|
|
215
|
-
sandboxId: sandbox.id,
|
|
216
|
-
previousSnapshot: sandbox.snapshot,
|
|
217
|
-
newSnapshot: snapshot
|
|
218
|
-
});
|
|
219
|
-
await deleteOwnedSandbox(sandbox);
|
|
220
|
-
attached = false;
|
|
221
|
-
sandbox = await daytona.create(resolveDaytonaCreateParams(sb, options, envVars));
|
|
222
|
-
}
|
|
223
|
-
const owned = !attached || options.ownAttached === true;
|
|
224
|
-
if (attached) await startAttachedSandboxIfNeeded(sandbox);
|
|
225
|
-
live.set(sandbox.id, {
|
|
226
|
-
sandbox,
|
|
227
|
-
env: envVars,
|
|
228
|
-
owned
|
|
229
|
-
});
|
|
230
|
-
try {
|
|
231
|
-
await waitForDaytonaReady(sandbox, logger, {
|
|
232
|
-
timeoutSeconds: readinessTimeoutSeconds,
|
|
233
|
-
...!attached ? { cleanupOnTimeout: () => deleteOwnedSandbox(sandbox) } : {}
|
|
234
|
-
});
|
|
235
|
-
} catch (err) {
|
|
236
|
-
live.delete(sandbox.id);
|
|
237
|
-
throw err;
|
|
238
|
-
}
|
|
239
|
-
const requestedCwd = config.cwd ?? options.cwd;
|
|
240
|
-
let cwd;
|
|
241
|
-
if (requestedCwd) {
|
|
242
|
-
cwd = requestedCwd;
|
|
243
|
-
await sandbox.process.executeCommand(`mkdir -p ${JSON.stringify(cwd)}`).catch(() => {});
|
|
244
|
-
} else if (sandbox.getWorkDir) {
|
|
245
|
-
cwd = await sandbox.getWorkDir().catch(() => "");
|
|
246
|
-
if (!cwd) cwd = await sandbox.process.executeCommand("pwd").then((r) => normalizeDaytonaExecResult(r).stdout.trim()).catch(() => "") || "/home/daytona";
|
|
247
|
-
} else cwd = await sandbox.process.executeCommand("pwd").then((r) => normalizeDaytonaExecResult(r).stdout.trim()).catch(() => "") || "/home/daytona";
|
|
248
|
-
if (options.pregame) try {
|
|
249
|
-
await runDaytonaPregame(sandbox, logger, {
|
|
250
|
-
name: options.pregame.name,
|
|
251
|
-
content: options.pregame.content,
|
|
252
|
-
cwd,
|
|
253
|
-
envVars
|
|
254
|
-
});
|
|
255
|
-
} catch (err) {
|
|
256
|
-
if (!attached) await deleteOwnedSandbox(sandbox);
|
|
257
|
-
live.delete(sandbox.id);
|
|
258
|
-
throw err;
|
|
259
|
-
}
|
|
260
|
-
return {
|
|
261
|
-
id: sandbox.id,
|
|
262
|
-
cwd
|
|
263
|
-
};
|
|
264
|
-
},
|
|
265
|
-
async exec(sandboxId, command, opts) {
|
|
266
|
-
const { sandbox, env } = get(sandboxId);
|
|
267
|
-
const timeoutSeconds = opts?.timeout ?? 30;
|
|
268
|
-
try {
|
|
269
|
-
return capExecResult(normalizeDaytonaExecResult(await sandbox.process.executeCommand(command, opts?.cwd, resolveDaytonaEnv(env, opts?.env), timeoutSeconds > 0 ? timeoutSeconds : void 0)));
|
|
270
|
-
} catch (err) {
|
|
271
|
-
return capExecResult(normalizeDaytonaExecError(err));
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
/**
|
|
275
|
-
* Live bidirectional stream — see `ExecutionContext.execStream`.
|
|
276
|
-
*
|
|
277
|
-
* PTY-backed, and not by preference: Daytona's process + session API
|
|
278
|
-
* exposes no stdin at all (sessions are fire-and-forget with log
|
|
279
|
-
* streaming), so a pseudo-terminal is the only interactive channel the
|
|
280
|
-
* platform offers. That forces three mitigations, all in the launch
|
|
281
|
-
* wrapper below, because a PTY is a terminal and a protocol stream is
|
|
282
|
-
* not:
|
|
283
|
-
*
|
|
284
|
-
* 1. `stty -echo` — a terminal echoes everything written to stdin back
|
|
285
|
-
* onto stdout. Without this the caller reads its own requests back
|
|
286
|
-
* as if they were responses.
|
|
287
|
-
* 2. `stty raw` — canonical mode rewrites `\n`→`\r\n` and caps a line
|
|
288
|
-
* at ~4096 bytes. Protocol frames routinely exceed that and would
|
|
289
|
-
* be silently truncated mid-message.
|
|
290
|
-
* 3. `2><file>` — a PTY has ONE stream, so the child's stderr would
|
|
291
|
-
* otherwise interleave into the protocol data and corrupt framing.
|
|
292
|
-
* It is redirected to a file inside the sandbox and surfaced on the
|
|
293
|
-
* returned handle by polling that file through the exec API.
|
|
294
|
-
*
|
|
295
|
-
* The mitigations must run before the child's first byte — but the
|
|
296
|
-
* launch line ITSELF is typed into a canonical-mode terminal, so it is
|
|
297
|
-
* echoed once (a short non-JSON line the transport's tolerant framing
|
|
298
|
-
* discards) and subject to the ~4096-byte line cap. That is why the
|
|
299
|
-
* real command lives in an uploaded script and the typed line stays
|
|
300
|
-
* short and constant: a long command line would be truncated before
|
|
301
|
-
* `stty` ever ran. The script also restores `sh` compound-command
|
|
302
|
-
* semantics that a bare `exec <command>` would break.
|
|
303
|
-
*/
|
|
304
|
-
async execStream(sandboxId, command, opts) {
|
|
305
|
-
const { sandbox, env } = get(sandboxId);
|
|
306
|
-
if (!sandbox.process.createPty) throw new Error("Daytona SDK is too old: `process.createPty` is required for execStream (used to run stdio MCP servers inside the sandbox).");
|
|
307
|
-
opts?.signal?.throwIfAborted();
|
|
308
|
-
const token = Math.random().toString(36).slice(2, 10);
|
|
309
|
-
const stderrPath = `/tmp/.zidane-stream-${token}.err`;
|
|
310
|
-
const scriptPath = `/tmp/.zidane-stream-${token}.sh`;
|
|
311
|
-
await sandbox.fs.uploadFile(Buffer.from(`exec 2>${stderrPath}\n${command}\n`), scriptPath);
|
|
312
|
-
const warnBacklog = (which) => (bytes) => logger.warn("execStream consumer is not draining output", {
|
|
313
|
-
sandboxId,
|
|
314
|
-
stream: which,
|
|
315
|
-
bufferedBytes: bytes
|
|
316
|
-
});
|
|
317
|
-
const stdout = new StreamQueue(warnBacklog("stdout"));
|
|
318
|
-
const stderr = new StreamQueue(warnBacklog("stderr"));
|
|
319
|
-
const sentinel = `Z-${token}-READY`;
|
|
320
|
-
let gateOpen = false;
|
|
321
|
-
let gateBuffer = "";
|
|
322
|
-
let openGate = () => {};
|
|
323
|
-
const gateReady = new Promise((r) => {
|
|
324
|
-
openGate = r;
|
|
325
|
-
});
|
|
326
|
-
const pty = await sandbox.process.createPty({
|
|
327
|
-
id: `zidane-stream-${token}`,
|
|
328
|
-
...opts?.cwd ? { cwd: opts.cwd } : {},
|
|
329
|
-
envs: resolveDaytonaEnv(env, opts?.env) ?? {},
|
|
330
|
-
onData: (data) => {
|
|
331
|
-
if (gateOpen) {
|
|
332
|
-
stdout.push(data);
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
gateBuffer += Buffer.from(data).toString("utf8");
|
|
336
|
-
const at = gateBuffer.indexOf(sentinel);
|
|
337
|
-
if (at === -1) {
|
|
338
|
-
if (gateBuffer.length > 64 * 1024) gateBuffer = gateBuffer.slice(-1024);
|
|
339
|
-
return;
|
|
340
|
-
}
|
|
341
|
-
gateOpen = true;
|
|
342
|
-
openGate();
|
|
343
|
-
const rest = gateBuffer.slice(at + sentinel.length).replace(/^\r?\n/, "");
|
|
344
|
-
gateBuffer = "";
|
|
345
|
-
if (rest.length > 0) stdout.push(new TextEncoder().encode(rest));
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
await pty.waitForConnection();
|
|
349
|
-
await pty.sendInput(`stty raw -echo; printf 'Z-%s-READY\\n' ${token}; exec sh ${scriptPath}\n`);
|
|
350
|
-
let gateTimer;
|
|
351
|
-
await Promise.race([gateReady, new Promise((r) => {
|
|
352
|
-
gateTimer = setTimeout(r, 3e4);
|
|
353
|
-
})]);
|
|
354
|
-
clearTimeout(gateTimer);
|
|
355
|
-
if (!gateOpen) {
|
|
356
|
-
await (pty.kill?.() ?? Promise.resolve()).catch(() => {});
|
|
357
|
-
await pty.disconnect().catch(() => {});
|
|
358
|
-
await sandbox.process.executeCommand(`rm -f ${scriptPath} ${stderrPath}`).catch(() => {});
|
|
359
|
-
throw new Error(`Daytona execStream: PTY did not reach the ready sentinel within 30s (sandbox ${sandboxId}). The login shell may not have started.`);
|
|
360
|
-
}
|
|
361
|
-
let stderrOffset = 0;
|
|
362
|
-
let torndown = false;
|
|
363
|
-
const eofMark = `ZEOF-${token}:`;
|
|
364
|
-
const drainStderr = async () => {
|
|
365
|
-
try {
|
|
366
|
-
const res = normalizeDaytonaExecResult(await sandbox.process.executeCommand(`tail -c +${stderrOffset + 1} ${stderrPath} 2>/dev/null; printf '${eofMark}%s' "$(wc -c < ${stderrPath} 2>/dev/null || echo 0)"`));
|
|
367
|
-
const at = res.stdout.lastIndexOf(eofMark);
|
|
368
|
-
if (at === -1) return;
|
|
369
|
-
const content = res.stdout.slice(0, at);
|
|
370
|
-
const size = Number.parseInt(res.stdout.slice(at + eofMark.length).trim(), 10);
|
|
371
|
-
if (content.length > 0) stderr.push(new TextEncoder().encode(content));
|
|
372
|
-
if (Number.isFinite(size) && size > stderrOffset) stderrOffset = size;
|
|
373
|
-
} catch {}
|
|
374
|
-
};
|
|
375
|
-
const stderrTimer = setInterval(() => {
|
|
376
|
-
drainStderr();
|
|
377
|
-
}, 2e3);
|
|
378
|
-
stderrTimer.unref?.();
|
|
379
|
-
const teardown = async () => {
|
|
380
|
-
if (torndown) return;
|
|
381
|
-
torndown = true;
|
|
382
|
-
clearInterval(stderrTimer);
|
|
383
|
-
await drainStderr();
|
|
384
|
-
await sandbox.process.executeCommand(`rm -f ${scriptPath} ${stderrPath}`).catch(() => {});
|
|
385
|
-
stdout.close();
|
|
386
|
-
stderr.close();
|
|
387
|
-
};
|
|
388
|
-
const exited = pty.wait().then((result) => result?.exitCode ?? 0).catch(() => 137).finally(teardown);
|
|
389
|
-
const kill = async () => {
|
|
390
|
-
await (pty.kill?.() ?? Promise.resolve()).catch(() => {});
|
|
391
|
-
await pty.disconnect().catch(() => {});
|
|
392
|
-
await teardown();
|
|
393
|
-
};
|
|
394
|
-
if (opts?.signal) if (opts.signal.aborted) kill();
|
|
395
|
-
else {
|
|
396
|
-
const onAbort = () => {
|
|
397
|
-
kill();
|
|
398
|
-
};
|
|
399
|
-
const detach = () => opts.signal.removeEventListener("abort", onAbort);
|
|
400
|
-
opts.signal.addEventListener("abort", onAbort, { once: true });
|
|
401
|
-
exited.then(detach, detach);
|
|
402
|
-
}
|
|
403
|
-
return {
|
|
404
|
-
pid: pty.pid ?? -1,
|
|
405
|
-
stdout,
|
|
406
|
-
stderr,
|
|
407
|
-
write: async (data) => {
|
|
408
|
-
await pty.sendInput(data);
|
|
409
|
-
},
|
|
410
|
-
kill,
|
|
411
|
-
exited
|
|
412
|
-
};
|
|
413
|
-
},
|
|
414
|
-
async readFile(sandboxId, path) {
|
|
415
|
-
return (await get(sandboxId).sandbox.fs.downloadFile(path)).toString("utf8");
|
|
416
|
-
},
|
|
417
|
-
async writeFile(sandboxId, path, content, encoding = "utf-8") {
|
|
418
|
-
const data = typeof content === "string" ? Buffer.from(content, encoding) : content;
|
|
419
|
-
await get(sandboxId).sandbox.fs.uploadFile(data, path);
|
|
420
|
-
},
|
|
421
|
-
async listFiles(sandboxId, path) {
|
|
422
|
-
return (await get(sandboxId).sandbox.fs.listFiles(path)).map((e) => e.isDir ? `${e.name}/` : e.name);
|
|
423
|
-
},
|
|
424
|
-
async destroy(sandboxId) {
|
|
425
|
-
const entry = live.get(sandboxId);
|
|
426
|
-
if (!entry) return;
|
|
427
|
-
if (entry.owned) {
|
|
428
|
-
const action = options.onDestroy ?? "delete";
|
|
429
|
-
if (action === "stop" || action === "pause") await stopOwnedSandbox(entry.sandbox);
|
|
430
|
-
else if (action === "archive") await archiveOwnedSandbox(entry.sandbox);
|
|
431
|
-
else if (action === "delete" || action === "kill") await deleteOwnedSandbox(entry.sandbox);
|
|
432
|
-
}
|
|
433
|
-
live.delete(sandboxId);
|
|
434
|
-
}
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
//#endregion
|
|
438
|
-
export { createDaytonaProvider, normalizeDaytonaExecResult, resolveDaytonaCreateParams, resolveDaytonaEnv, runDaytonaPregame, waitForDaytonaReady };
|
|
439
|
-
|
|
440
|
-
//# sourceMappingURL=daytona.js.map
|
|
1
|
+
export { t as createDaytonaProvider, a as normalizeDaytonaExecResult, n as resolveDaytonaCreateParams, o as resolveDaytonaEnv, r as runDaytonaPregame, i as waitForDaytonaReady } from "../daytona-DG3omipZ.js";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as SpawnConfig, d as ContextMount, h as ExecutionContext } from "../isolation-D9L650W5.js";
|
|
2
2
|
import { Buffer } from "node:buffer";
|
|
3
|
-
|
|
4
|
-
//#region src/contexts/docker.d.ts
|
|
3
|
+
//#region src/contexts/docker-files.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* `readFile` transport cap: headroom above the whole-read tool ceiling
|
|
7
6
|
* (256MB in tools/whole-read-guard.ts) so tool policy — not the docker
|
|
@@ -10,9 +9,6 @@ import { Buffer } from "node:buffer";
|
|
|
10
9
|
* more than this into host memory.
|
|
11
10
|
*/
|
|
12
11
|
declare const READ_FILE_MAX_BUFFER: number;
|
|
13
|
-
declare function createDockerContext(config?: SpawnConfig): ExecutionContext;
|
|
14
|
-
/** Assemble dockerode `HostConfig.Binds` from the context's `mounts`. */
|
|
15
|
-
declare function buildBindSpecs(mounts: NonNullable<SpawnConfig['mounts']>): string[];
|
|
16
12
|
/**
|
|
17
13
|
* Pack a single file into an in-memory tar archive for `putArchive`, via
|
|
18
14
|
* `tar-stream` (the same battle-tested packer the dockerode ecosystem uses
|
|
@@ -21,5 +17,38 @@ declare function buildBindSpecs(mounts: NonNullable<SpawnConfig['mounts']>): str
|
|
|
21
17
|
*/
|
|
22
18
|
declare function packTarFile(name: string, data: Buffer): Promise<Buffer>;
|
|
23
19
|
//#endregion
|
|
24
|
-
|
|
20
|
+
//#region src/contexts/docker-spawn.d.ts
|
|
21
|
+
/** Assemble dockerode `HostConfig.Binds` from the context's `mounts`. */
|
|
22
|
+
declare function buildBindSpecs(mounts: NonNullable<SpawnConfig['mounts']>): string[];
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/contexts/docker.d.ts
|
|
25
|
+
declare function createDockerContext(config?: SpawnConfig): ExecutionContext;
|
|
26
|
+
/**
|
|
27
|
+
* Path-equal bind mounts that make a HOST working directory usable inside a
|
|
28
|
+
* container: the enclosing git worktree (or `cwd` itself outside git) at the
|
|
29
|
+
* same absolute path, plus the git common dir when it lives outside that
|
|
30
|
+
* tree (a linked worktree's `.git` file points there — without it, git fails
|
|
31
|
+
* in the container). Path-equal keeps host-side features (diffs, artifacts,
|
|
32
|
+
* `@`-paths) valid for the same absolute paths the agent sees.
|
|
33
|
+
*
|
|
34
|
+
* The git dir's `hooks/` and `config` (plus `config.worktree` when present or
|
|
35
|
+
* enabled) are overlaid read-only — created empty first if absent: host-side git
|
|
36
|
+
* (zidane's own diff/workspace calls included) would otherwise run hooks or
|
|
37
|
+
* `core.fsmonitor` / `core.hooksPath` planted from inside the container.
|
|
38
|
+
* Deliberate cost: git commands that WRITE config fail inside the container —
|
|
39
|
+
* `git push -u` / `--set-upstream`, `git branch --set-upstream-to`,
|
|
40
|
+
* `git remote add`, `git config …`. Commits, fetches and a plain
|
|
41
|
+
* `git push <remote> <branch>` work; environments that publish a branch must
|
|
42
|
+
* push without recording an upstream.
|
|
43
|
+
*
|
|
44
|
+
* Returns `[]` when `cwd` is not an existing host directory, so a
|
|
45
|
+
* container-only path (`--cwd /workspace`) keeps its historical meaning, and
|
|
46
|
+
* when the tree to mount is `/`, `$HOME`, or an ancestor of `$HOME` (too broad
|
|
47
|
+
* to hand a container read-write). A git root that is too broad falls back to
|
|
48
|
+
* `cwd` alone (no git dir), so a dotfiles repo at `$HOME` doesn't blank every
|
|
49
|
+
* project under it.
|
|
50
|
+
*/
|
|
51
|
+
declare function hostWorkspaceMounts(cwd: string): ContextMount[];
|
|
52
|
+
//#endregion
|
|
53
|
+
export { READ_FILE_MAX_BUFFER, buildBindSpecs, createDockerContext, hostWorkspaceMounts, packTarFile };
|
|
25
54
|
//# sourceMappingURL=docker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker.d.ts","names":[],"sources":["../../src/contexts/docker.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"docker.d.ts","names":[],"sources":["../../src/contexts/docker-files.ts","../../src/contexts/docker-spawn.ts","../../src/contexts/docker.ts"],"mappings":";;;;;;;;;;cAsBa;;;;;;;iBA6HS,YAAY,cAAc,MAAM,SAAS,QAAQ;;;;iBC3HvD,eAAe,QAAQ,YAAY;;;iBCSnC,oBAAoB,SAAS,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiH3C,oBAAoB,cAAc"}
|