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
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
2
|
+
import { basename, dirname, resolve } from "node:path";
|
|
3
|
+
//#region src/chat/project-root.ts
|
|
4
|
+
/**
|
|
5
|
+
* Git location — two different questions with two different answers once
|
|
6
|
+
* linked worktrees exist:
|
|
7
|
+
*
|
|
8
|
+
* - **Checkout root** ({@link findGitRoot}): the working tree `cwd` sits
|
|
9
|
+
* in — where its files are. Discovery reads here (`AGENTS.md`, skills,
|
|
10
|
+
* MCP configs, file completion): a worktree on another branch has its
|
|
11
|
+
* own copies, and those are the ones the agent works against.
|
|
12
|
+
* - **Project root** ({@link findProjectRoot} / {@link projectRootOf}):
|
|
13
|
+
* which project a session BELONGS to — the main checkout, for a linked
|
|
14
|
+
* worktree. Identity keys here: `SessionData.projectRoot`, session
|
|
15
|
+
* lists and grouping, the safelist, artifact scope, the project DB.
|
|
16
|
+
* Every worktree of a repo is one project.
|
|
17
|
+
*
|
|
18
|
+
* For a plain checkout the two are the same directory.
|
|
19
|
+
*
|
|
20
|
+
* Why parent-walk + file reads over `git rev-parse`:
|
|
21
|
+
*
|
|
22
|
+
* - Zero dependencies (no shell-out, no git binary requirement,
|
|
23
|
+
* works even when `git` is missing from `PATH`).
|
|
24
|
+
* - Pure-sync, deterministic, easy to test against tmp dirs.
|
|
25
|
+
* - Equally fast in practice — most lookups are a single `existsSync`.
|
|
26
|
+
*
|
|
27
|
+
* Recognizes `.git` as either:
|
|
28
|
+
*
|
|
29
|
+
* - A directory (standard repo layout).
|
|
30
|
+
* - A file containing `gitdir: …` (worktrees + submodules).
|
|
31
|
+
*
|
|
32
|
+
* Bare repos (no working tree) are intentionally NOT detected here —
|
|
33
|
+
* the TUI's data dir contract is "project working tree", and a bare
|
|
34
|
+
* repo has no working files to scope sessions against.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Walk parents of `cwd` looking for a `.git` entry. Returns the
|
|
38
|
+
* absolute path of the directory containing `.git` — the CHECKOUT root
|
|
39
|
+
* (a linked worktree's own dir, not its main checkout) — or `null` when
|
|
40
|
+
* no git repo is found above `cwd`.
|
|
41
|
+
*
|
|
42
|
+
* Stops at the filesystem root (`/`) — no infinite loop on `dirname`'s
|
|
43
|
+
* idempotent root case (`dirname('/')` returns `/`).
|
|
44
|
+
*/
|
|
45
|
+
function findGitRoot(cwd = process.cwd()) {
|
|
46
|
+
let dir = resolve(cwd);
|
|
47
|
+
for (let depth = 0; depth < 64; depth++) {
|
|
48
|
+
if (hasGitMarker(dir)) return dir;
|
|
49
|
+
const parent = dirname(dir);
|
|
50
|
+
if (parent === dir) return null;
|
|
51
|
+
dir = parent;
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The main checkout a LINKED WORKTREE belongs to, or `null` when
|
|
57
|
+
* `checkoutRoot` is not one. Does not walk: `checkoutRoot` must be a
|
|
58
|
+
* checkout root (what {@link findGitRoot} returns).
|
|
59
|
+
*
|
|
60
|
+
* A linked worktree's `.git` is a file (`gitdir: <main>/.git/worktrees/<name>`)
|
|
61
|
+
* and that gitdir holds a `commondir` file pointing back at the shared
|
|
62
|
+
* `<main>/.git`. Everything else resolves to `null` and stays its own
|
|
63
|
+
* project:
|
|
64
|
+
*
|
|
65
|
+
* - a regular checkout (`.git` is a directory);
|
|
66
|
+
* - a submodule (its gitdir has no `commondir` — a submodule IS a
|
|
67
|
+
* separate repo);
|
|
68
|
+
* - a worktree of a bare repo or of a `--separate-git-dir` repo (the
|
|
69
|
+
* common dir isn't a `.git` inside a working tree, so there is no main
|
|
70
|
+
* checkout to belong to);
|
|
71
|
+
* - anything unreadable or malformed.
|
|
72
|
+
*/
|
|
73
|
+
function mainCheckoutRoot(checkoutRoot) {
|
|
74
|
+
const root = resolve(checkoutRoot);
|
|
75
|
+
const gitdir = readGitdirPointer(resolve(root, ".git"), root);
|
|
76
|
+
if (!gitdir) return null;
|
|
77
|
+
const commondir = readTrimmed(resolve(gitdir, "commondir"));
|
|
78
|
+
if (!commondir) return null;
|
|
79
|
+
const commonDir = resolve(gitdir, commondir);
|
|
80
|
+
if (basename(commonDir) !== ".git" || !isDirectory(commonDir)) return null;
|
|
81
|
+
const main = dirname(commonDir);
|
|
82
|
+
return main === root ? null : main;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The project `cwd` belongs to: the main checkout for a linked worktree,
|
|
86
|
+
* the checkout root otherwise, `null` outside git. See the module header
|
|
87
|
+
* for when to use this vs {@link findGitRoot}.
|
|
88
|
+
*/
|
|
89
|
+
function findProjectRoot(cwd = process.cwd()) {
|
|
90
|
+
const checkout = findGitRoot(cwd);
|
|
91
|
+
return checkout ? mainCheckoutRoot(checkout) ?? checkout : null;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* {@link findProjectRoot} with the historical fallback: outside git, a
|
|
95
|
+
* directory is its own project. The value to stamp as
|
|
96
|
+
* `SessionData.projectRoot` and to key per-project state on.
|
|
97
|
+
*/
|
|
98
|
+
function projectRootOf(cwd) {
|
|
99
|
+
return findProjectRoot(cwd) ?? cwd;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* For persisted project roots that predate worktree-aware identity: the
|
|
103
|
+
* `{ from, to }` pairs where a stored root is a linked worktree's checkout
|
|
104
|
+
* root and should be its main checkout's. Only exact linked-worktree roots
|
|
105
|
+
* remap — a plain directory that later ended up inside some repo keeps its
|
|
106
|
+
* own identity (no parent walk here). Stores apply the pairs as a bulk
|
|
107
|
+
* column update at open; idempotent, so a row reverted by a stale
|
|
108
|
+
* full-document save converges on the next open.
|
|
109
|
+
*/
|
|
110
|
+
function planWorktreeProjectRootRemaps(roots) {
|
|
111
|
+
const remaps = [];
|
|
112
|
+
for (const from of new Set(roots)) {
|
|
113
|
+
if (!from) continue;
|
|
114
|
+
const to = mainCheckoutRoot(from);
|
|
115
|
+
if (to) remaps.push({
|
|
116
|
+
from,
|
|
117
|
+
to
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return remaps;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* `.git` exists as a directory (standard repo) OR as a file containing
|
|
124
|
+
* a `gitdir:` pointer (worktree / submodule). Tolerant on stat failures
|
|
125
|
+
* — a permission error on a parent directory shouldn't crash the walk.
|
|
126
|
+
*/
|
|
127
|
+
function hasGitMarker(dir) {
|
|
128
|
+
const candidate = resolve(dir, ".git");
|
|
129
|
+
try {
|
|
130
|
+
if (!existsSync(candidate)) return false;
|
|
131
|
+
const stat = statSync(candidate);
|
|
132
|
+
return stat.isDirectory() || stat.isFile();
|
|
133
|
+
} catch {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/** Absolute gitdir from a `.git` FILE (`gitdir: <path>`, relative to `root`), else `null`. */
|
|
138
|
+
function readGitdirPointer(dotGit, root) {
|
|
139
|
+
try {
|
|
140
|
+
if (!statSync(dotGit).isFile()) return null;
|
|
141
|
+
} catch {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
const text = readTrimmed(dotGit);
|
|
145
|
+
if (!text?.startsWith("gitdir:")) return null;
|
|
146
|
+
const pointer = text.slice(7).split("\n", 1)[0].trim();
|
|
147
|
+
return pointer ? resolve(root, pointer) : null;
|
|
148
|
+
}
|
|
149
|
+
function readTrimmed(path) {
|
|
150
|
+
try {
|
|
151
|
+
const text = readFileSync(path, "utf8").trim();
|
|
152
|
+
return text.length > 0 ? text : null;
|
|
153
|
+
} catch {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function isDirectory(path) {
|
|
158
|
+
try {
|
|
159
|
+
return statSync(path).isDirectory();
|
|
160
|
+
} catch {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
export { projectRootOf as a, planWorktreeProjectRootRemaps as i, findProjectRoot as n, mainCheckoutRoot as r, findGitRoot as t };
|
|
166
|
+
|
|
167
|
+
//# sourceMappingURL=project-root-B8zADr4o.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-root-B8zADr4o.js","names":[],"sources":["../src/chat/project-root.ts"],"sourcesContent":["/**\n * Git location — two different questions with two different answers once\n * linked worktrees exist:\n *\n * - **Checkout root** ({@link findGitRoot}): the working tree `cwd` sits\n * in — where its files are. Discovery reads here (`AGENTS.md`, skills,\n * MCP configs, file completion): a worktree on another branch has its\n * own copies, and those are the ones the agent works against.\n * - **Project root** ({@link findProjectRoot} / {@link projectRootOf}):\n * which project a session BELONGS to — the main checkout, for a linked\n * worktree. Identity keys here: `SessionData.projectRoot`, session\n * lists and grouping, the safelist, artifact scope, the project DB.\n * Every worktree of a repo is one project.\n *\n * For a plain checkout the two are the same directory.\n *\n * Why parent-walk + file reads over `git rev-parse`:\n *\n * - Zero dependencies (no shell-out, no git binary requirement,\n * works even when `git` is missing from `PATH`).\n * - Pure-sync, deterministic, easy to test against tmp dirs.\n * - Equally fast in practice — most lookups are a single `existsSync`.\n *\n * Recognizes `.git` as either:\n *\n * - A directory (standard repo layout).\n * - A file containing `gitdir: …` (worktrees + submodules).\n *\n * Bare repos (no working tree) are intentionally NOT detected here —\n * the TUI's data dir contract is \"project working tree\", and a bare\n * repo has no working files to scope sessions against.\n */\n\nimport { existsSync, readFileSync, statSync } from 'node:fs'\nimport { basename, dirname, resolve } from 'node:path'\n\n/**\n * Walk parents of `cwd` looking for a `.git` entry. Returns the\n * absolute path of the directory containing `.git` — the CHECKOUT root\n * (a linked worktree's own dir, not its main checkout) — or `null` when\n * no git repo is found above `cwd`.\n *\n * Stops at the filesystem root (`/`) — no infinite loop on `dirname`'s\n * idempotent root case (`dirname('/')` returns `/`).\n */\nexport function findGitRoot(cwd: string = process.cwd()): string | null {\n let dir = resolve(cwd)\n // Guard against pathological inputs (junction loops, mount cycles)\n // by bounding the walk. 64 levels is well past anything sane and\n // avoids a pathological infinite loop on misconfigured volumes.\n for (let depth = 0; depth < 64; depth++) {\n if (hasGitMarker(dir))\n return dir\n const parent = dirname(dir)\n if (parent === dir)\n return null // reached filesystem root\n dir = parent\n }\n return null\n}\n\n/**\n * The main checkout a LINKED WORKTREE belongs to, or `null` when\n * `checkoutRoot` is not one. Does not walk: `checkoutRoot` must be a\n * checkout root (what {@link findGitRoot} returns).\n *\n * A linked worktree's `.git` is a file (`gitdir: <main>/.git/worktrees/<name>`)\n * and that gitdir holds a `commondir` file pointing back at the shared\n * `<main>/.git`. Everything else resolves to `null` and stays its own\n * project:\n *\n * - a regular checkout (`.git` is a directory);\n * - a submodule (its gitdir has no `commondir` — a submodule IS a\n * separate repo);\n * - a worktree of a bare repo or of a `--separate-git-dir` repo (the\n * common dir isn't a `.git` inside a working tree, so there is no main\n * checkout to belong to);\n * - anything unreadable or malformed.\n */\nexport function mainCheckoutRoot(checkoutRoot: string): string | null {\n const root = resolve(checkoutRoot)\n const gitdir = readGitdirPointer(resolve(root, '.git'), root)\n if (!gitdir)\n return null\n const commondirFile = resolve(gitdir, 'commondir')\n const commondir = readTrimmed(commondirFile)\n if (!commondir)\n return null\n const commonDir = resolve(gitdir, commondir)\n if (basename(commonDir) !== '.git' || !isDirectory(commonDir))\n return null\n const main = dirname(commonDir)\n return main === root ? null : main\n}\n\n/**\n * The project `cwd` belongs to: the main checkout for a linked worktree,\n * the checkout root otherwise, `null` outside git. See the module header\n * for when to use this vs {@link findGitRoot}.\n */\nexport function findProjectRoot(cwd: string = process.cwd()): string | null {\n const checkout = findGitRoot(cwd)\n return checkout ? (mainCheckoutRoot(checkout) ?? checkout) : null\n}\n\n/**\n * {@link findProjectRoot} with the historical fallback: outside git, a\n * directory is its own project. The value to stamp as\n * `SessionData.projectRoot` and to key per-project state on.\n */\nexport function projectRootOf(cwd: string): string {\n return findProjectRoot(cwd) ?? cwd\n}\n\n/**\n * For persisted project roots that predate worktree-aware identity: the\n * `{ from, to }` pairs where a stored root is a linked worktree's checkout\n * root and should be its main checkout's. Only exact linked-worktree roots\n * remap — a plain directory that later ended up inside some repo keeps its\n * own identity (no parent walk here). Stores apply the pairs as a bulk\n * column update at open; idempotent, so a row reverted by a stale\n * full-document save converges on the next open.\n */\nexport function planWorktreeProjectRootRemaps(roots: Iterable<string>): Array<{ from: string, to: string }> {\n const remaps: Array<{ from: string, to: string }> = []\n for (const from of new Set(roots)) {\n if (!from)\n continue\n const to = mainCheckoutRoot(from)\n if (to)\n remaps.push({ from, to })\n }\n return remaps\n}\n\n/**\n * `.git` exists as a directory (standard repo) OR as a file containing\n * a `gitdir:` pointer (worktree / submodule). Tolerant on stat failures\n * — a permission error on a parent directory shouldn't crash the walk.\n */\nfunction hasGitMarker(dir: string): boolean {\n const candidate = resolve(dir, '.git')\n try {\n if (!existsSync(candidate))\n return false\n const stat = statSync(candidate)\n return stat.isDirectory() || stat.isFile()\n }\n catch {\n return false\n }\n}\n\n/** Absolute gitdir from a `.git` FILE (`gitdir: <path>`, relative to `root`), else `null`. */\nfunction readGitdirPointer(dotGit: string, root: string): string | null {\n try {\n if (!statSync(dotGit).isFile())\n return null\n }\n catch {\n return null\n }\n const text = readTrimmed(dotGit)\n if (!text?.startsWith('gitdir:'))\n return null\n const pointer = text.slice('gitdir:'.length).split('\\n', 1)[0]!.trim()\n return pointer ? resolve(root, pointer) : null\n}\n\nfunction readTrimmed(path: string): string | null {\n try {\n const text = readFileSync(path, 'utf8').trim()\n return text.length > 0 ? text : null\n }\n catch {\n return null\n }\n}\n\nfunction isDirectory(path: string): boolean {\n try {\n return statSync(path).isDirectory()\n }\n catch {\n return false\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,YAAY,MAAc,QAAQ,IAAI,GAAkB;CACtE,IAAI,MAAM,QAAQ,GAAG;CAIrB,KAAK,IAAI,QAAQ,GAAG,QAAQ,IAAI,SAAS;EACvC,IAAI,aAAa,GAAG,GAClB,OAAO;EACT,MAAM,SAAS,QAAQ,GAAG;EAC1B,IAAI,WAAW,KACb,OAAO;EACT,MAAM;CACR;CACA,OAAO;AACT;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,iBAAiB,cAAqC;CACpE,MAAM,OAAO,QAAQ,YAAY;CACjC,MAAM,SAAS,kBAAkB,QAAQ,MAAM,MAAM,GAAG,IAAI;CAC5D,IAAI,CAAC,QACH,OAAO;CAET,MAAM,YAAY,YADI,QAAQ,QAAQ,WACI,CAAC;CAC3C,IAAI,CAAC,WACH,OAAO;CACT,MAAM,YAAY,QAAQ,QAAQ,SAAS;CAC3C,IAAI,SAAS,SAAS,MAAM,UAAU,CAAC,YAAY,SAAS,GAC1D,OAAO;CACT,MAAM,OAAO,QAAQ,SAAS;CAC9B,OAAO,SAAS,OAAO,OAAO;AAChC;;;;;;AAOA,SAAgB,gBAAgB,MAAc,QAAQ,IAAI,GAAkB;CAC1E,MAAM,WAAW,YAAY,GAAG;CAChC,OAAO,WAAY,iBAAiB,QAAQ,KAAK,WAAY;AAC/D;;;;;;AAOA,SAAgB,cAAc,KAAqB;CACjD,OAAO,gBAAgB,GAAG,KAAK;AACjC;;;;;;;;;;AAWA,SAAgB,8BAA8B,OAA8D;CAC1G,MAAM,SAA8C,CAAC;CACrD,KAAK,MAAM,QAAQ,IAAI,IAAI,KAAK,GAAG;EACjC,IAAI,CAAC,MACH;EACF,MAAM,KAAK,iBAAiB,IAAI;EAChC,IAAI,IACF,OAAO,KAAK;GAAE;GAAM;EAAG,CAAC;CAC5B;CACA,OAAO;AACT;;;;;;AAOA,SAAS,aAAa,KAAsB;CAC1C,MAAM,YAAY,QAAQ,KAAK,MAAM;CACrC,IAAI;EACF,IAAI,CAAC,WAAW,SAAS,GACvB,OAAO;EACT,MAAM,OAAO,SAAS,SAAS;EAC/B,OAAO,KAAK,YAAY,KAAK,KAAK,OAAO;CAC3C,QACM;EACJ,OAAO;CACT;AACF;;AAGA,SAAS,kBAAkB,QAAgB,MAA6B;CACtE,IAAI;EACF,IAAI,CAAC,SAAS,MAAM,CAAC,CAAC,OAAO,GAC3B,OAAO;CACX,QACM;EACJ,OAAO;CACT;CACA,MAAM,OAAO,YAAY,MAAM;CAC/B,IAAI,CAAC,MAAM,WAAW,SAAS,GAC7B,OAAO;CACT,MAAM,UAAU,KAAK,MAAM,CAAgB,CAAC,CAAC,MAAM,MAAM,CAAC,CAAC,CAAC,EAAE,CAAE,KAAK;CACrE,OAAO,UAAU,QAAQ,MAAM,OAAO,IAAI;AAC5C;AAEA,SAAS,YAAY,MAA6B;CAChD,IAAI;EACF,MAAM,OAAO,aAAa,MAAM,MAAM,CAAC,CAAC,KAAK;EAC7C,OAAO,KAAK,SAAS,IAAI,OAAO;CAClC,QACM;EACJ,OAAO;CACT;AACF;AAEA,SAAS,YAAY,MAAuB;CAC1C,IAAI;EACF,OAAO,SAAS,IAAI,CAAC,CAAC,YAAY;CACpC,QACM;EACJ,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { t as findGitRoot } from "./project-root-B8zADr4o.js";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
//#region src/chat/project-user-paths.ts
|
|
5
|
+
/**
|
|
6
|
+
* Shared search-path builder for project + user config discovery.
|
|
7
|
+
*
|
|
8
|
+
* Both Skills (`skills/<name>/SKILL.md`) and MCP servers (`mcps.json`)
|
|
9
|
+
* follow the same first-found-wins order:
|
|
10
|
+
*
|
|
11
|
+
* 1. `{project-root}/.agents/<sub>` — project, agnostic convention
|
|
12
|
+
* 2. `{project-root}/.{prefix}/<sub>` — project, zidane (`.zidane` default)
|
|
13
|
+
* 3. `~/.agents/<sub>` — user, agnostic
|
|
14
|
+
* 4. `~/.{prefix}/<sub>` — user, zidane
|
|
15
|
+
*
|
|
16
|
+
* `{project-root}` is the git root walked up from `cwd` when present,
|
|
17
|
+
* else `cwd` itself. This pairs with the project-scoped session
|
|
18
|
+
* storage (`resolveStoragePaths`) so all three project-aware surfaces
|
|
19
|
+
* — sessions, mcps, skills — anchor at the same `.{prefix}/`.
|
|
20
|
+
*
|
|
21
|
+
* Centralizing the pattern keeps the four paths in one place — a third
|
|
22
|
+
* discovery surface (hooks, rules, …) gets the same convention for free
|
|
23
|
+
* and stays in lock-step on a prefix bump.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Resolve the four search paths for a given subdirectory (`skills`,
|
|
27
|
+
* `mcps.json`, …). Returns absolute paths regardless of whether they
|
|
28
|
+
* exist — the caller chooses to `existsSync`-filter or feed straight
|
|
29
|
+
* into a tolerant discovery routine.
|
|
30
|
+
*/
|
|
31
|
+
function projectUserPaths(opts) {
|
|
32
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
33
|
+
const home = opts.home ?? homedir();
|
|
34
|
+
const projectRoot = findGitRoot(cwd) ?? cwd;
|
|
35
|
+
const prefix = (opts.prefix ?? ".zidane").replace(/^\./, "");
|
|
36
|
+
return [
|
|
37
|
+
{
|
|
38
|
+
path: resolve(projectRoot, `.agents/${opts.subPath}`),
|
|
39
|
+
source: "project"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
path: resolve(projectRoot, `.${prefix}/${opts.subPath}`),
|
|
43
|
+
source: "project"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
path: resolve(home, `.agents/${opts.subPath}`),
|
|
47
|
+
source: "user"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
path: resolve(home, `.${prefix}/${opts.subPath}`),
|
|
51
|
+
source: "user"
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { projectUserPaths as t };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=project-user-paths-BSgtrRxl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-user-paths-BSgtrRxl.js","names":[],"sources":["../src/chat/project-user-paths.ts"],"sourcesContent":["/**\n * Shared search-path builder for project + user config discovery.\n *\n * Both Skills (`skills/<name>/SKILL.md`) and MCP servers (`mcps.json`)\n * follow the same first-found-wins order:\n *\n * 1. `{project-root}/.agents/<sub>` — project, agnostic convention\n * 2. `{project-root}/.{prefix}/<sub>` — project, zidane (`.zidane` default)\n * 3. `~/.agents/<sub>` — user, agnostic\n * 4. `~/.{prefix}/<sub>` — user, zidane\n *\n * `{project-root}` is the git root walked up from `cwd` when present,\n * else `cwd` itself. This pairs with the project-scoped session\n * storage (`resolveStoragePaths`) so all three project-aware surfaces\n * — sessions, mcps, skills — anchor at the same `.{prefix}/`.\n *\n * Centralizing the pattern keeps the four paths in one place — a third\n * discovery surface (hooks, rules, …) gets the same convention for free\n * and stays in lock-step on a prefix bump.\n */\n\nimport { homedir } from 'node:os'\nimport { resolve } from 'node:path'\nimport { findGitRoot } from './project-root'\n\n/** A discovered path tagged with whether it lives in the project or the user dir. */\nexport interface ProjectUserPath {\n path: string\n source: 'project' | 'user'\n}\n\n/**\n * Resolve the four search paths for a given subdirectory (`skills`,\n * `mcps.json`, …). Returns absolute paths regardless of whether they\n * exist — the caller chooses to `existsSync`-filter or feed straight\n * into a tolerant discovery routine.\n */\nexport function projectUserPaths(opts: {\n /** Subdirectory or filename relative to each search root. E.g. `'skills'`, `'mcps.json'`. */\n subPath: string\n /** Discovery cwd. Default: `process.cwd()`. */\n cwd?: string\n /** User home directory. Default: `os.homedir()`. */\n home?: string\n /** Storage prefix. Leading dot tolerated. Default: `'.zidane'`. */\n prefix?: string\n}): ProjectUserPath[] {\n const cwd = opts.cwd ?? process.cwd()\n const home = opts.home ?? homedir()\n // Anchor the project search at the git root when one exists — so a\n // subdir invocation (e.g. `cd repo/packages/foo`) still finds the\n // repo-level `.zidane/mcps.json`. Falls back to `cwd` outside git.\n const projectRoot = findGitRoot(cwd) ?? cwd\n // `prefix` arrives as `.zidane` in `ResolvedConfig`; trim the leading dot\n // for the symmetric `.agents` / `.zidane` convention.\n const prefix = (opts.prefix ?? '.zidane').replace(/^\\./, '')\n return [\n { path: resolve(projectRoot, `.agents/${opts.subPath}`), source: 'project' },\n { path: resolve(projectRoot, `.${prefix}/${opts.subPath}`), source: 'project' },\n { path: resolve(home, `.agents/${opts.subPath}`), source: 'user' },\n { path: resolve(home, `.${prefix}/${opts.subPath}`), source: 'user' },\n ]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,iBAAiB,MASX;CACpB,MAAM,MAAM,KAAK,OAAO,QAAQ,IAAI;CACpC,MAAM,OAAO,KAAK,QAAQ,QAAQ;CAIlC,MAAM,cAAc,YAAY,GAAG,KAAK;CAGxC,MAAM,UAAU,KAAK,UAAU,UAAA,CAAW,QAAQ,OAAO,EAAE;CAC3D,OAAO;EACL;GAAE,MAAM,QAAQ,aAAa,WAAW,KAAK,SAAS;GAAG,QAAQ;EAAU;EAC3E;GAAE,MAAM,QAAQ,aAAa,IAAI,OAAO,GAAG,KAAK,SAAS;GAAG,QAAQ;EAAU;EAC9E;GAAE,MAAM,QAAQ,MAAM,WAAW,KAAK,SAAS;GAAG,QAAQ;EAAO;EACjE;GAAE,MAAM,QAAQ,MAAM,IAAI,OAAO,GAAG,KAAK,SAAS;GAAG,QAAQ;EAAO;CACtE;AACF"}
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
* against them is a precise edit.
|
|
29
29
|
*/
|
|
30
30
|
declare const toolPrompts: {
|
|
31
|
-
readonly read_file: "Read a file by path. Text files return lines [offset..offset+limit). Default offset=1, limit=2000. Each line is prefixed with its 1-indexed line number followed by a tab (e.g. `42\\tconst foo = bar`); the prefix is metadata, not part of the file. Mirrors Claude Code's `cat -n`-style compact output for token efficiency. A trailing footer explains how to read the rest when truncated. Images (png/jpg/gif/webp) and PDFs return structured attachments for capable models; other binary files return a short marker rather than mojibake.";
|
|
32
|
-
readonly write_file: "Write `content` to `path`, creating any missing parent directories. Overwrites existing files in full; prefer `edit` / `multi_edit` for surgical changes when you only want to alter part of a file. Returns one of: `Created <path> (N bytes)` (file did not exist), `Updated <path> (N bytes)` (content differed), or `No change needed: <path> already at target state (N bytes)`, so the model can detect no-ops without a separate `read_file`.";
|
|
33
|
-
readonly edit: "Replace exact `old_string` with `new_string` in a file. Fails if `old_string` is not unique unless `replace_all: true`. Prefer over `write_file` for surgical changes: preserves the rest of the file. Tolerates `read_file` line-number prefixes (`<N>\\t…`, `<N>|…`, or `<N>→…`) in `old_string` / `new_string`; they are stripped before matching/writing, so you can paste a numbered chunk verbatim.";
|
|
34
|
-
readonly multi_edit: "Apply a sequential list of edits to a file. Each edit operates on the result of the previous APPLIED edit. Prefer this over multiple `edit` calls when several non-overlapping changes are needed in the same file. Edits run best-effort: a per-step failure (`old_string` not found, ambiguous match without `replace_all`, identical strings) is reported in the result but does NOT block the remaining steps. The file is written iff at least one step applied. The result lists per-hunk outcomes (`applied` / `failed`) so the model can re-issue just the failures without resending the whole batch. Each step tolerates `read_file` line-number prefixes (`<N>\\t…`, `<N>|…`, or `<N>→…`) in `old_string` / `new_string`.";
|
|
31
|
+
readonly read_file: "Read a file by path. Text files return lines [offset..offset+limit). Default offset=1, limit=2000; a negative offset reads from the end (`-50` = last 50 lines). Pass `paths` to read several files, or several ranges of one file, in one call. Each line is prefixed with its 1-indexed line number followed by a tab (e.g. `42\\tconst foo = bar`); the prefix is metadata, not part of the file. Mirrors Claude Code's `cat -n`-style compact output for token efficiency. A trailing footer explains how to read the rest when truncated. Images (png/jpg/gif/webp) and PDFs return structured attachments for capable models; other binary files return a short marker rather than mojibake.";
|
|
32
|
+
readonly write_file: "Write `content` to `path`, creating any missing parent directories. Overwrites existing files in full; prefer `edit` / `multi_edit` for surgical changes when you only want to alter part of a file. Returns one of: `Created <path> (N bytes)` (file did not exist), `Updated <path> (N bytes)` (content differed), or `No change needed: <path> already at target state (N bytes)`, so the model can detect no-ops without a separate `read_file`. Several `edit` / `multi_edit` / `write_file` calls and a verifying `shell` call (tests, typecheck) in one message run in order, in a single round-trip.";
|
|
33
|
+
readonly edit: "Replace exact `old_string` with `new_string` in a file. Fails if `old_string` is not unique unless `replace_all: true`. Prefer over `write_file` for surgical changes: preserves the rest of the file. Tolerates `read_file` line-number prefixes (`<N>\\t…`, `<N>|…`, or `<N>→…`) in `old_string` / `new_string`; they are stripped before matching/writing, so you can paste a numbered chunk verbatim. Several `edit` / `multi_edit` / `write_file` calls and a verifying `shell` call (tests, typecheck) in one message run in order, in a single round-trip.";
|
|
34
|
+
readonly multi_edit: "Apply a sequential list of edits to a file. Each edit operates on the result of the previous APPLIED edit. Prefer this over multiple `edit` calls when several non-overlapping changes are needed in the same file. Edits run best-effort: a per-step failure (`old_string` not found, ambiguous match without `replace_all`, identical strings) is reported in the result but does NOT block the remaining steps. The file is written iff at least one step applied. The result lists per-hunk outcomes (`applied` / `failed`) so the model can re-issue just the failures without resending the whole batch. Each step tolerates `read_file` line-number prefixes (`<N>\\t…`, `<N>|…`, or `<N>→…`) in `old_string` / `new_string`. Several `edit` / `multi_edit` / `write_file` calls and a verifying `shell` call (tests, typecheck) in one message run in order, in a single round-trip.";
|
|
35
35
|
readonly glob: "Match files by glob pattern (supports **, *, ?). Relative to the execution context cwd; patterns may reach outside the workspace (e.g. \"../shared/**/*.ts\"). By default each row is `<path>\\t<size-bytes>\\t<mtime-iso>`; set `metadata: false` for a plain newline-separated list of paths. Always sorted.";
|
|
36
|
-
readonly grep: "Search file contents by regex. Returns matching paths (default), match content, or per-file counts. Backed by ripgrep when available, with a portable shell-listing + regex fallback when `rg` is absent.";
|
|
36
|
+
readonly grep: "Search file contents by regex. Returns matching paths (default), match content, or per-file counts. One call covers several patterns (`patterns`), several roots (`paths`), context lines, literal (`fixed_strings`) or whole-word (`-w`) matching, and dropping noise lines (`exclude`); `head_limit` caps output. Backed by ripgrep when available, with a portable shell-listing + regex fallback when `rg` is absent.";
|
|
37
37
|
readonly list_files: "List the immediate entries (files and subdirectories) at literal directory `path`. Returns a newline-separated list; subdirectories carry a trailing `/`; or `(empty directory)` when the directory exists but is empty. Non-recursive: use `glob` for pattern matching across nested directories.";
|
|
38
38
|
readonly fetch_url: "Fetch a public URL and return its body as plain text. HTML is reduced to text (scripts, styles, tags stripped; entities decoded). If a `web_search` tool is also available, use it first when you do not already know the exact URL. Only http(s) URLs are accepted; loopback, link-local, private, and cloud-metadata addresses are refused. Output is capped (default 200 KiB).";
|
|
39
39
|
readonly shell_kill: string;
|
|
@@ -43,7 +43,8 @@ declare const toolPrompts: {
|
|
|
43
43
|
readonly model_search: string;
|
|
44
44
|
readonly skills_use: string;
|
|
45
45
|
readonly skills_read: string;
|
|
46
|
-
readonly skills_run_script: string;
|
|
46
|
+
readonly skills_run_script: string;
|
|
47
|
+
/** Default for `createInteractionTool` when the host passes no `description`. */
|
|
47
48
|
readonly interaction: "Request structured input from the user or external system.";
|
|
48
49
|
/**
|
|
49
50
|
* `shell` is assembled per run by `createShellTool`: `core` always; the
|
|
@@ -53,11 +54,12 @@ declare const toolPrompts: {
|
|
|
53
54
|
*/
|
|
54
55
|
readonly shell: {
|
|
55
56
|
readonly core: string;
|
|
56
|
-
readonly preferDedicated: "When a dedicated tool fits, prefer it over shell:";
|
|
57
|
+
readonly preferDedicated: "When a dedicated tool fits, prefer it over shell:";
|
|
58
|
+
/** One `- <label>: use \`<tool>\` (not <instead>)` line per registered sibling. */
|
|
57
59
|
readonly swapHints: readonly [{
|
|
58
60
|
readonly canonical: "read_file";
|
|
59
61
|
readonly label: "Read files";
|
|
60
|
-
readonly instead: "cat/head/tail";
|
|
62
|
+
readonly instead: "cat/head/tail/sed -n";
|
|
61
63
|
}, {
|
|
62
64
|
readonly canonical: "glob";
|
|
63
65
|
readonly label: "File search";
|
|
@@ -73,7 +75,7 @@ declare const toolPrompts: {
|
|
|
73
75
|
}, {
|
|
74
76
|
readonly canonical: "edit";
|
|
75
77
|
readonly label: "Edit files";
|
|
76
|
-
readonly instead: "sed/awk";
|
|
78
|
+
readonly instead: "sed/awk/python scripts";
|
|
77
79
|
}, {
|
|
78
80
|
readonly canonical: "write_file";
|
|
79
81
|
readonly label: "Write files";
|
|
@@ -99,7 +101,8 @@ declare const toolPrompts: {
|
|
|
99
101
|
readonly core: string;
|
|
100
102
|
readonly callable: "Returned tools become callable for the rest of this run.";
|
|
101
103
|
readonly callableVia: (dispatcher: string) => string;
|
|
102
|
-
};
|
|
104
|
+
};
|
|
105
|
+
/** `call_tool` names the discovery tool (`tool_search` or the host's wire name). */
|
|
103
106
|
readonly call_tool: (discovery: string) => string;
|
|
104
107
|
/**
|
|
105
108
|
* `web_search`: `core` + `recency(monthYear)`, resolved on each spec read so
|
|
@@ -113,4 +116,4 @@ declare const toolPrompts: {
|
|
|
113
116
|
type ToolPrompts = typeof toolPrompts;
|
|
114
117
|
//#endregion
|
|
115
118
|
export { toolPrompts as n, ToolPrompts as t };
|
|
116
|
-
//# sourceMappingURL=prompts-
|
|
119
|
+
//# sourceMappingURL=prompts-DYcvqShf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts-DYcvqShf.d.ts","names":[],"sources":["../src/tools/prompts.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA6Ba;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAwHiB,cAAA;;;WAKL,YAAA;;;;;;;aAeA,UAAA;;;KAOb,qBAAqB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/codemode/runtime/protocol.ts
|
|
2
|
+
function isWorkerToHostMessage(value) {
|
|
3
|
+
if (typeof value !== "object" || value === null) return false;
|
|
4
|
+
const type = value.type;
|
|
5
|
+
return type === "call" || type === "output" || type === "done" || type === "crash";
|
|
6
|
+
}
|
|
7
|
+
function isHostToWorkerMessage(value) {
|
|
8
|
+
return typeof value === "object" && value !== null && value.type === "result";
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { isWorkerToHostMessage as n, isHostToWorkerMessage as t };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=protocol-DnhqqSmE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol-DnhqqSmE.js","names":[],"sources":["../src/codemode/runtime/protocol.ts"],"sourcesContent":["import type { CodemodeDeterminism, CodemodeOutputItem } from '../types'\nimport type { CodemodeWasmModule } from '../wasm'\n\n/**\n * Messages between the host (main thread) and the worker. Tool arguments,\n * results, and values cross as JSON strings: the worker passes them into and\n * out of the QuickJS VM as strings and never builds structured values itself.\n */\n\nexport interface WorkerData {\n code: string\n /** `jsName` is the identifier the script uses; `description` is listed in `ALL_TOOLS`. */\n tools: { name: string, jsName: string, description: string }[]\n globals: { name: string, spread: boolean }[]\n /** Compiled `quickjs-wasi` module. Structured clone shares the compiled code with the worker. */\n wasm: CodemodeWasmModule\n memoryLimitBytes: number | undefined\n /** Snapshot for `load()`: key to JSON text. */\n store: Record<string, string>\n /**\n * One Int32 the host sets to non-zero before terminating the worker. The VM's interrupt handler\n * polls it, because Bun's `worker.terminate()` cannot stop a thread that is spinning in wasm.\n */\n interrupt: SharedArrayBuffer\n determinism: CodemodeDeterminism | undefined\n}\n\n/** JSON-encoded `{ name?, message, stack? }` of an error thrown by the script. */\nexport type ScriptErrorJson = string\n\nexport type WorkerToHostMessage\n /** `id` is the issue sequence number of the call (see `CodemodeToolContext.seq`). */\n = | { type: 'call', id: number, target: 'tool' | 'global', name: string, args: string | undefined }\n | { type: 'output', item: CodemodeOutputItem }\n /** `writes` is a JSON array of `[key, json]` for `store()` and `[key]` for deletions. */\n | { type: 'done', ok: true, value: string | undefined, writes: string }\n | { type: 'done', ok: false, error: ScriptErrorJson }\n /** The VM failed outside the script's control, for example a wasm trap. */\n | { type: 'crash', message: string }\n\n/** `payload` is the JSON result when `ok`, otherwise the error message. */\nexport interface HostToWorkerMessage { type: 'result', id: number, ok: boolean, payload: string | undefined }\n\nexport function isWorkerToHostMessage(value: unknown): value is WorkerToHostMessage {\n if (typeof value !== 'object' || value === null)\n return false\n const type = (value as { type?: unknown }).type\n return type === 'call' || type === 'output' || type === 'done' || type === 'crash'\n}\n\nexport function isHostToWorkerMessage(value: unknown): value is HostToWorkerMessage {\n return typeof value === 'object' && value !== null && (value as { type?: unknown }).type === 'result'\n}\n"],"mappings":";AA2CA,SAAgB,sBAAsB,OAA8C;CAClF,IAAI,OAAO,UAAU,YAAY,UAAU,MACzC,OAAO;CACT,MAAM,OAAQ,MAA6B;CAC3C,OAAO,SAAS,UAAU,SAAS,YAAY,SAAS,UAAU,SAAS;AAC7E;AAEA,SAAgB,sBAAsB,OAA8C;CAClF,OAAO,OAAO,UAAU,YAAY,UAAU,QAAS,MAA6B,SAAS;AAC/F"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { AnthropicBedrockConfig, AnthropicContextManagement, AnthropicParams, AnthropicThinkingPlan, EXTENDED_CACHE_TTL_BETA, THINKING_BINDING_SETTING_ENV, ThinkingBindingBehavior, anthropic, applyAnthropicCacheBreakpoints, buildAnthropicClientOptions, cacheWriteTtlMultiplier, classifyAnthropicError, credentialIdentity, defaultAnthropicMaxTokens, planAnthropicThinking, resolveAnthropicAuthShape, resolveAnthropicBetas, resolveAnthropicMaxOutput, resolveThinkingBinding };
|
|
1
|
+
import { $v as ThinkingBindingBehavior, Cv as resolveAnthropicAuthShape, Dv as AnthropicBedrockConfig, Ev as applyAnthropicCacheBreakpoints, Ov as AnthropicContextManagement, Qv as THINKING_BINDING_SETTING_ENV, Sv as credentialIdentity, Tv as EXTENDED_CACHE_TTL_BETA, Zv as AnthropicThinkingPlan, _v as cacheWriteTtlMultiplier, bv as classifyAnthropicError, ey as planAnthropicThinking, gv as anthropic, kv as AnthropicParams, ty as resolveThinkingBinding, vv as defaultAnthropicMaxTokens, wv as resolveAnthropicBetas, xv as buildAnthropicClientOptions, yv as resolveAnthropicMaxOutput } from "../index-BGe1fQT7.js";
|
|
2
|
+
export { type AnthropicBedrockConfig, type AnthropicContextManagement, type AnthropicParams, type AnthropicThinkingPlan, EXTENDED_CACHE_TTL_BETA, THINKING_BINDING_SETTING_ENV, type ThinkingBindingBehavior, anthropic, applyAnthropicCacheBreakpoints, buildAnthropicClientOptions, cacheWriteTtlMultiplier, classifyAnthropicError, credentialIdentity, defaultAnthropicMaxTokens, planAnthropicThinking, resolveAnthropicAuthShape, resolveAnthropicBetas, resolveAnthropicMaxOutput, resolveThinkingBinding };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { EXTENDED_CACHE_TTL_BETA, THINKING_BINDING_SETTING_ENV, anthropic, applyAnthropicCacheBreakpoints, buildAnthropicClientOptions, cacheWriteTtlMultiplier, classifyAnthropicError, credentialIdentity, defaultAnthropicMaxTokens, planAnthropicThinking, resolveAnthropicAuthShape, resolveAnthropicBetas, resolveAnthropicMaxOutput, resolveThinkingBinding };
|
|
1
|
+
export { d as EXTENDED_CACHE_TTL_BETA, c as THINKING_BINDING_SETTING_ENV, t as anthropic, f as applyAnthropicCacheBreakpoints, m as buildAnthropicClientOptions, r as cacheWriteTtlMultiplier, p as classifyAnthropicError, h as credentialIdentity, o as defaultAnthropicMaxTokens, l as planAnthropicThinking, g as resolveAnthropicAuthShape, _ as resolveAnthropicBetas, s as resolveAnthropicMaxOutput, u as resolveThinkingBinding } from "../anthropic-CD00LhUP.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hv as arcee, mv as ArceeParams } from "../index-BGe1fQT7.js";
|
|
2
2
|
export { ArceeParams, arcee };
|
package/dist/providers/arcee.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dv as BasetenParams, fv as baseten, pv as planBasetenReasoning } from "../index-BGe1fQT7.js";
|
|
2
2
|
export { BasetenParams, baseten, planBasetenReasoning };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { lv as CerebrasParams, uv as cerebras } from "../index-BGe1fQT7.js";
|
|
2
2
|
export { CerebrasParams, cerebras };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as openaiCompat } from "../openai-compat-CFrpH7uq.js";
|
|
2
2
|
//#region src/providers/cerebras.ts
|
|
3
3
|
const BASE_URL = "https://api.cerebras.ai/v1";
|
|
4
4
|
function getApiKey(params) {
|
|
@@ -13,9 +13,10 @@ function getApiKey(params) {
|
|
|
13
13
|
* (base URL, default model).
|
|
14
14
|
*/
|
|
15
15
|
function cerebras(params) {
|
|
16
|
+
const apiKey = getApiKey(params);
|
|
16
17
|
return openaiCompat({
|
|
17
18
|
name: "cerebras",
|
|
18
|
-
apiKey
|
|
19
|
+
apiKey,
|
|
19
20
|
baseURL: BASE_URL,
|
|
20
21
|
defaultModel: params?.defaultModel || "gpt-oss-120b",
|
|
21
22
|
capabilities: params?.capabilities ?? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cerebras.js","names":[],"sources":["../../src/providers/cerebras.ts"],"sourcesContent":["import type { Provider, ProviderCapabilities } from '.'\nimport { openaiCompat } from './openai-compat'\n\nconst BASE_URL = 'https://api.cerebras.ai/v1'\n\nexport interface CerebrasParams {\n apiKey?: string\n defaultModel?: string\n /**\n * Provider capability flags. Cerebras currently serves text-only OSS models\n * (GLM, Llama-family, Qwen-family) — default: `{ vision: false, imageInToolResult: false }`.\n * Override when routing to a vision-capable deployment.\n */\n capabilities?: ProviderCapabilities\n /**\n * Extra HTTP headers sent on every request. Forwarded to the underlying\n * {@link openaiCompat} client — use for routing/attribution headers a proxy\n * in front of `baseURL` consumes.\n */\n extraHeaders?: Record<string, string>\n}\n\nfunction getApiKey(params?: CerebrasParams): string {\n // Resolution order is intentionally aligned with `anthropic` + `openai` —\n // explicit params > env var > fail. Host code that composes providers from\n // config (e.g. a YAML-driven CLI) relies on `params.apiKey` winning in all\n // providers, not just some.\n if (typeof params?.apiKey === 'string' && params.apiKey.length > 0)\n return params.apiKey\n\n if (process.env.CEREBRAS_API_KEY)\n return process.env.CEREBRAS_API_KEY\n\n throw new Error('No Cerebras API key found. Pass `apiKey` or set CEREBRAS_API_KEY in your environment.')\n}\n\n/**\n * Cerebras provider.\n *\n * Thin wrapper around {@link openaiCompat} with Cerebras-specific defaults\n * (base URL, default model).\n */\nexport function cerebras(params?: CerebrasParams): Provider {\n const apiKey = getApiKey(params)\n return openaiCompat({\n name: 'cerebras',\n apiKey,\n baseURL: BASE_URL,\n defaultModel: params?.defaultModel || 'gpt-oss-120b',\n capabilities: params?.capabilities ?? { vision: false, imageInToolResult: false },\n extraHeaders: params?.extraHeaders,\n })\n}\n"],"mappings":";;AAGA,MAAM,WAAW;AAmBjB,SAAS,UAAU,QAAiC;CAKlD,IAAI,OAAO,QAAQ,WAAW,YAAY,OAAO,OAAO,SAAS,GAC/D,OAAO,OAAO;CAEhB,IAAI,QAAQ,IAAI,kBACd,OAAO,QAAQ,IAAI;CAErB,MAAM,IAAI,MAAM,uFAAuF;AACzG;;;;;;;AAQA,SAAgB,SAAS,QAAmC;
|
|
1
|
+
{"version":3,"file":"cerebras.js","names":[],"sources":["../../src/providers/cerebras.ts"],"sourcesContent":["import type { Provider, ProviderCapabilities } from '.'\nimport { openaiCompat } from './openai-compat'\n\nconst BASE_URL = 'https://api.cerebras.ai/v1'\n\nexport interface CerebrasParams {\n apiKey?: string\n defaultModel?: string\n /**\n * Provider capability flags. Cerebras currently serves text-only OSS models\n * (GLM, Llama-family, Qwen-family) — default: `{ vision: false, imageInToolResult: false }`.\n * Override when routing to a vision-capable deployment.\n */\n capabilities?: ProviderCapabilities\n /**\n * Extra HTTP headers sent on every request. Forwarded to the underlying\n * {@link openaiCompat} client — use for routing/attribution headers a proxy\n * in front of `baseURL` consumes.\n */\n extraHeaders?: Record<string, string>\n}\n\nfunction getApiKey(params?: CerebrasParams): string {\n // Resolution order is intentionally aligned with `anthropic` + `openai` —\n // explicit params > env var > fail. Host code that composes providers from\n // config (e.g. a YAML-driven CLI) relies on `params.apiKey` winning in all\n // providers, not just some.\n if (typeof params?.apiKey === 'string' && params.apiKey.length > 0)\n return params.apiKey\n\n if (process.env.CEREBRAS_API_KEY)\n return process.env.CEREBRAS_API_KEY\n\n throw new Error('No Cerebras API key found. Pass `apiKey` or set CEREBRAS_API_KEY in your environment.')\n}\n\n/**\n * Cerebras provider.\n *\n * Thin wrapper around {@link openaiCompat} with Cerebras-specific defaults\n * (base URL, default model).\n */\nexport function cerebras(params?: CerebrasParams): Provider {\n const apiKey = getApiKey(params)\n return openaiCompat({\n name: 'cerebras',\n apiKey,\n baseURL: BASE_URL,\n defaultModel: params?.defaultModel || 'gpt-oss-120b',\n capabilities: params?.capabilities ?? { vision: false, imageInToolResult: false },\n extraHeaders: params?.extraHeaders,\n })\n}\n"],"mappings":";;AAGA,MAAM,WAAW;AAmBjB,SAAS,UAAU,QAAiC;CAKlD,IAAI,OAAO,QAAQ,WAAW,YAAY,OAAO,OAAO,SAAS,GAC/D,OAAO,OAAO;CAEhB,IAAI,QAAQ,IAAI,kBACd,OAAO,QAAQ,IAAI;CAErB,MAAM,IAAI,MAAM,uFAAuF;AACzG;;;;;;;AAQA,SAAgB,SAAS,QAAmC;CAC1D,MAAM,SAAS,UAAU,MAAM;CAC/B,OAAO,aAAa;EAClB,MAAM;EACN;EACA,SAAS;EACT,cAAc,QAAQ,gBAAgB;EACtC,cAAc,QAAQ,gBAAgB;GAAE,QAAQ;GAAO,mBAAmB;EAAM;EAChF,cAAc,QAAQ;CACxB,CAAC;AACH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { av as LocalParams, ov as local } from "../index-BGe1fQT7.js";
|
|
2
2
|
export { LocalParams, local };
|
package/dist/providers/local.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as openaiCompat } from "../openai-compat-CFrpH7uq.js";
|
|
2
2
|
//#region src/providers/local.ts
|
|
3
3
|
function getBaseURL(params) {
|
|
4
4
|
if (typeof params?.baseURL === "string" && params.baseURL.length > 0) return params.baseURL;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A_ as ASSISTANT_TOOL_CALLS_TAG, B_ as buildAssistantContent, F_ as OpenAICompatParams, G_ as openaiCompat, H_ as formatTools, I_ as TOOL_RESULTS_TAG, J_ as userMessage, K_ as toOAIMessages, L_ as applyOAICacheBreakpoints, M_ as OAITool, N_ as OpenAICompatAuthHeader, P_ as OpenAICompatHttpError, R_ as applyOAIToolCacheBreakpoint, U_ as mapOAIFinishReason, V_ as classifyOpenAICompatError, W_ as openAICompatPromptMessage, X_ as consumeSSE, Y_ as OpenAICompatStreamError, j_ as OAIMessage, q_ as toolResultsMessage, z_ as assistantMessage } from "../index-BGe1fQT7.js";
|
|
2
2
|
export { ASSISTANT_TOOL_CALLS_TAG, OAIMessage, OAITool, OpenAICompatAuthHeader, OpenAICompatHttpError, OpenAICompatParams, OpenAICompatStreamError, TOOL_RESULTS_TAG, applyOAICacheBreakpoints, applyOAIToolCacheBreakpoint, assistantMessage, buildAssistantContent, classifyOpenAICompatError, consumeSSE, formatTools, mapOAIFinishReason, openAICompatPromptMessage, openaiCompat, toOAIMessages, toolResultsMessage, userMessage };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { ASSISTANT_TOOL_CALLS_TAG, OpenAICompatHttpError, OpenAICompatStreamError, TOOL_RESULTS_TAG, applyOAICacheBreakpoints, applyOAIToolCacheBreakpoint, assistantMessage, buildAssistantContent, classifyOpenAICompatError, consumeSSE, formatTools, mapOAIFinishReason, openAICompatPromptMessage, openaiCompat, toOAIMessages, toolResultsMessage, userMessage };
|
|
1
|
+
export { t as ASSISTANT_TOOL_CALLS_TAG, n as OpenAICompatHttpError, x as OpenAICompatStreamError, r as TOOL_RESULTS_TAG, i as applyOAICacheBreakpoints, a as applyOAIToolCacheBreakpoint, o as assistantMessage, s as buildAssistantContent, c as classifyOpenAICompatError, S as consumeSSE, l as formatTools, u as mapOAIFinishReason, d as openAICompatPromptMessage, f as openaiCompat, p as toOAIMessages, m as toolResultsMessage, h as userMessage } from "../openai-compat-CFrpH7uq.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $
|
|
1
|
+
import { $_ as mapCodexStopReason, Q_ as classifyOpenAIError, Z_ as OpenAIParams, ev as openai, tv as toPiMessages } from "../index-BGe1fQT7.js";
|
|
2
2
|
export { OpenAIParams, classifyOpenAIError, mapCodexStopReason, openai, toPiMessages };
|
package/dist/providers/openai.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as mergeCatalogEntry, F as unsupportedMediaError, T as aliasCatalogProviders, _ as userMessage, b as sanitizeToolSpecs, g as toolResultsMessage, k as lookupModel$1, s as assistantMessage, v as createToolNameBoundary, w as fillEstimatedCost } from "../openai-compat-Dy56weK8.js";
|
|
2
|
-
import { a as documentBlockMarker, r as assertResolvedMediaBlock } from "../types-CWgENVLY.js";
|
|
3
1
|
import { f as isRetryableHttpStatus, h as matchesToolPairingError, l as classifyErrorPrelude, m as matchesContextExceeded } from "../errors-DKiMrOKq.js";
|
|
2
|
+
import { a as documentBlockMarker, r as assertResolvedMediaBlock } from "../types-Cu0ZGDu9.js";
|
|
3
|
+
import { A as lookupModel$1, E as aliasCatalogProviders, I as unsupportedMediaError, T as fillEstimatedCost, g as createToolNameBoundary, h as userMessage, j as mergeCatalogEntry, m as toolResultsMessage, o as assistantMessage, v as sanitizeToolSpecs } from "../openai-compat-CFrpH7uq.js";
|
|
4
4
|
import { renderSystemForWire } from "../prompt.js";
|
|
5
|
-
import {
|
|
6
|
-
import { r as extractRuntimeCredentials, s as resolveOAuthApiKey } from "../oauth-
|
|
5
|
+
import { m as SYNTHETIC_TOOL_RESULT_PLACEHOLDER, s as reasoningWireAction } from "../messages-BqiwcD2Q.js";
|
|
6
|
+
import { r as extractRuntimeCredentials, s as resolveOAuthApiKey } from "../oauth-Px_pBB9W.js";
|
|
7
7
|
import { normalizeContext } from "@earendil-works/pi-ai";
|
|
8
8
|
import { stream } from "@earendil-works/pi-ai/api/openai-codex-responses";
|
|
9
9
|
import { stream as stream$1 } from "@earendil-works/pi-ai/api/openai-responses";
|
|
@@ -393,12 +393,14 @@ function toResponsesTools(tools) {
|
|
|
393
393
|
}
|
|
394
394
|
function applyPayloadOverrides(payload, options, toWireToolName = (name) => name) {
|
|
395
395
|
const body = payload;
|
|
396
|
-
if (options.toolChoice)
|
|
397
|
-
type
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
396
|
+
if (options.toolChoice) {
|
|
397
|
+
if (options.toolChoice.type === "tool" && options.toolChoice.name) body.tool_choice = {
|
|
398
|
+
type: "function",
|
|
399
|
+
name: toWireToolName(options.toolChoice.name)
|
|
400
|
+
};
|
|
401
|
+
else if (options.toolChoice.type === "required") body.tool_choice = "required";
|
|
402
|
+
else body.tool_choice = "auto";
|
|
403
|
+
}
|
|
402
404
|
return body;
|
|
403
405
|
}
|
|
404
406
|
function openai(params) {
|
|
@@ -485,14 +487,15 @@ function openai(params) {
|
|
|
485
487
|
const model = resolveModel(modelId, usePlatformApi ? PLATFORM_PROVIDER_ID : PROVIDER_ID, options.modelCatalog);
|
|
486
488
|
const tools = options.tools;
|
|
487
489
|
const nameBoundary = createToolNameBoundary(options.messages, tools.map((tool) => tool.name));
|
|
488
|
-
const
|
|
490
|
+
const rawContext = {
|
|
489
491
|
systemPrompt: renderSystemForWire(options.system),
|
|
490
492
|
messages: toPiMessages(nameBoundary.messages, modelId),
|
|
491
493
|
tools: tools.map((tool) => ({
|
|
492
494
|
...tool,
|
|
493
495
|
name: nameBoundary.toWire(tool.name)
|
|
494
496
|
}))
|
|
495
|
-
}
|
|
497
|
+
};
|
|
498
|
+
const context = normalizeContext(rawContext);
|
|
496
499
|
const supportsMaxEffort = modelId.startsWith("gpt-5.6");
|
|
497
500
|
const reasoningLevel = options.thinking && options.thinking !== "off" && options.thinking !== "adaptive" ? options.thinking === "max" && !supportsMaxEffort ? "xhigh" : options.thinking : void 0;
|
|
498
501
|
const makeStream = (reasoningSummary) => {
|