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 @@
|
|
|
1
|
+
{"version":3,"file":"cred-keys-GpBg71cP.js","names":[],"sources":["../src/chat/cred-keys.ts"],"sourcesContent":["/**\n * Credential-file key arithmetic, split from `./credentials` so the rules can\n * be enforced where credentials themselves must not be pulled in.\n *\n * `./credentials` reaches the provider registry (and through it the pi-ai\n * factories) for `credKeyOf`; the extension loader — an edge entrypoint that\n * validates descriptor keys at registration time — must stay clear of that\n * graph. This module is string arithmetic with no imports.\n */\n\n/**\n * Separator between a provider's canonical key and a slot qualifier. Every\n * non-canonical slot (`#alt`, `#account:N`) starts with it, so the character is\n * reserved in descriptor credential keys outright.\n */\nexport const CRED_KEY_SLOT_SEPARATOR = '#'\n\n/**\n * Reserved suffix marking a provider's SECOND credential slot.\n *\n * Not usable as (or as the tail of) a descriptor's credential key: `foo#alt`\n * holds `foo`'s alternate credential, so a provider claiming that name would\n * share storage with it.\n */\nexport const ALTERNATE_CRED_KEY_SUFFIX = '#alt'\n\n/**\n * Reserved infix marking one of a provider's ADDITIONAL OAuth accounts:\n * `foo#account:1`, `foo#account:2`, …\n */\nexport const ACCOUNT_CRED_KEY_INFIX = '#account:'\n\n/**\n * File key holding a provider's second credential, when it has one of each kind.\n *\n * The canonical key always holds the credential the user prefers; this sibling\n * holds the other. That one invariant is what makes preference selection free:\n * every existing reader (`applyApiKeyEnv`, the harness provider factories)\n * already resolves the canonical key, so \"switch priority\" is just moving two\n * objects between two keys — no precedence flag to interpret, no resolution\n * order to keep in sync across layers.\n *\n * A sibling key rather than a nested field because the canonical entry gets\n * REPLACED wholesale on token refresh; anything nested inside it would be\n * dropped by the next rotation. And older zidane versions look credentials up\n * by `credKeyOf`, so a suffixed key is simply invisible to them — they read the\n * preferred credential and behave exactly as before, which is why this needs no\n * migration or schema version.\n */\nexport function alternateCredKey(fileKey: string): string {\n return `${fileKey}${ALTERNATE_CRED_KEY_SUFFIX}`\n}\n\n/**\n * File key holding one of a provider's non-active OAuth accounts.\n *\n * Same sibling-key reasoning as {@link alternateCredKey}: the canonical key is\n * the active one, so a provider with three OAuth grants stores the active one\n * canonically and the other two under `#account:N`. `#alt` stays dedicated to\n * the other-kind (API key) alternate so files written by builds that predate\n * multi-account keep meaning the same thing.\n */\nexport function accountCredKey(fileKey: string, n: number): string {\n return `${fileKey}${ACCOUNT_CRED_KEY_INFIX}${n}`\n}\n\n/** True when `key` is one of `fileKey`'s `#account:N` slots. */\nexport function isAccountCredKey(fileKey: string, key: string): boolean {\n const prefix = `${fileKey}${ACCOUNT_CRED_KEY_INFIX}`\n return key.startsWith(prefix) && /^\\d+$/.test(key.slice(prefix.length))\n}\n\n/**\n * Smallest `#account:N` key of `fileKey` not present in `existing`.\n *\n * Deterministic rather than random so a file hand-edited or written by two\n * processes in sequence stays readable; the write lock keeps it collision-free.\n */\nexport function nextAccountCredKey(fileKey: string, existing: Iterable<string>): string {\n const taken = new Set(existing)\n for (let n = 1; ; n++) {\n const key = accountCredKey(fileKey, n)\n if (!taken.has(key))\n return key\n }\n}\n\n/**\n * Name shown for an OAuth account that was never given one.\n *\n * Also what a first OAuth login is stored under, so a second account has\n * something to be told apart from. Pre-multi-account files hold unnamed\n * grants; {@link oauthAccountLabel} makes them read the same.\n */\nexport const DEFAULT_OAUTH_ACCOUNT_LABEL = 'Default'\n\n/** Trimmed user-given account name, or {@link DEFAULT_OAUTH_ACCOUNT_LABEL}. */\nexport function oauthAccountLabel(credential: { label?: unknown }): string {\n const label = typeof credential.label === 'string' ? credential.label.trim() : ''\n return label || DEFAULT_OAUTH_ACCOUNT_LABEL\n}\n\n/**\n * True when a key claims a reserved slot namespace.\n *\n * Built-in keys are plain identifiers (`anthropic`, `openai-codex`), but\n * `ProviderDescriptor.key` / `credentialFileKey` are open strings — so the\n * reservation is checked, not assumed.\n */\nexport function isReservedCredKey(fileKey: string): boolean {\n return fileKey.includes(CRED_KEY_SLOT_SEPARATOR)\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,0BAA0B;;;;;;;;AASvC,MAAa,4BAA4B;;;;;AAMzC,MAAa,yBAAyB;;;;;;;;;;;;;;;;;;AAmBtC,SAAgB,iBAAiB,SAAyB;CACxD,OAAO,GAAG,UAAU;AACtB;;;;;;;;;;AAWA,SAAgB,eAAe,SAAiB,GAAmB;CACjE,OAAO,GAAG,UAAU,yBAAyB;AAC/C;;AAGA,SAAgB,iBAAiB,SAAiB,KAAsB;CACtE,MAAM,SAAS,GAAG,UAAU;CAC5B,OAAO,IAAI,WAAW,MAAM,KAAK,QAAQ,KAAK,IAAI,MAAM,OAAO,MAAM,CAAC;AACxE;;;;;;;AAQA,SAAgB,mBAAmB,SAAiB,UAAoC;CACtF,MAAM,QAAQ,IAAI,IAAI,QAAQ;CAC9B,KAAK,IAAI,IAAI,IAAK,KAAK;EACrB,MAAM,MAAM,eAAe,SAAS,CAAC;EACrC,IAAI,CAAC,MAAM,IAAI,GAAG,GAChB,OAAO;CACX;AACF;;;;;;;;AASA,MAAa,8BAA8B;;AAG3C,SAAgB,kBAAkB,YAAyC;CAEzE,QADc,OAAO,WAAW,UAAU,WAAW,WAAW,MAAM,KAAK,IAAI,OAAA;AAEjF;;;;;;;;AASA,SAAgB,kBAAkB,SAA0B;CAC1D,OAAO,QAAQ,SAAA,GAAgC;AACjD"}
|
|
@@ -1,129 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
5
|
-
import { c as withCredentialsLock, h as registerOAuthProvider, m as refreshOpenAICodexToken, p as refreshAnthropicToken } from "./oauth-
|
|
1
|
+
import { n as writeFileAtomic } from "./atomic-write-Ijgf2Mhc.js";
|
|
2
|
+
import { A as lookupModel, O as listModelOverlay, j as mergeCatalogEntry, k as listModels } from "./openai-compat-CFrpH7uq.js";
|
|
3
|
+
import { c as isReservedCredKey, l as nextAccountCredKey, n as ALTERNATE_CRED_KEY_SUFFIX, o as alternateCredKey, s as isAccountCredKey, t as ACCOUNT_CRED_KEY_INFIX } from "./cred-keys-GpBg71cP.js";
|
|
4
|
+
import { a as FAST_MODE_OPTIONS, i as ANTHROPIC_EXTRA_MODELS, t as anthropic } from "./anthropic-CD00LhUP.js";
|
|
5
|
+
import { c as withCredentialsLock, h as registerOAuthProvider, m as refreshOpenAICodexToken, p as refreshAnthropicToken } from "./oauth-Px_pBB9W.js";
|
|
6
6
|
import { arcee } from "./providers/arcee.js";
|
|
7
7
|
import { baseten } from "./providers/baseten.js";
|
|
8
8
|
import { cerebras } from "./providers/cerebras.js";
|
|
9
9
|
import { t as generatePkce } from "./pkce-t8BcPyEi.js";
|
|
10
|
-
import { n as createCursorOAuthProvider } from "./cursor-
|
|
11
|
-
import { n as zai, r as mistral } from "./providers-
|
|
10
|
+
import { n as createCursorOAuthProvider } from "./cursor-CdjaQTBW.js";
|
|
11
|
+
import { n as zai, r as mistral } from "./providers-XUR7F4Hi.js";
|
|
12
12
|
import { local } from "./providers/local.js";
|
|
13
13
|
import { openai } from "./providers/openai.js";
|
|
14
14
|
import { openrouter } from "./providers/openrouter.js";
|
|
15
|
-
import { n as createXaiOAuthProvider } from "./xai-
|
|
15
|
+
import { c as startCallbackServer, n as createXaiOAuthProvider, o as honorsRemoteCallback, s as listensForCallback } from "./xai-CvJTeLrI.js";
|
|
16
16
|
import { xai } from "./providers/xai.js";
|
|
17
|
-
import { dirname, resolve } from "node:path";
|
|
18
17
|
import { Buffer } from "node:buffer";
|
|
19
18
|
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
19
|
+
import { dirname, resolve } from "node:path";
|
|
20
20
|
import { homedir } from "node:os";
|
|
21
21
|
import { randomBytes } from "node:crypto";
|
|
22
|
-
import { createServer } from "node:http";
|
|
23
22
|
import { getBuiltinModel, getBuiltinModels } from "@earendil-works/pi-ai/providers/all";
|
|
24
|
-
//#region src/chat/oauth-page/server.ts
|
|
25
|
-
const CALLBACK_HOST = process.env.PI_OAUTH_CALLBACK_HOST || "127.0.0.1";
|
|
26
|
-
function buildRequestHandler(opts, pending) {
|
|
27
|
-
return (req, res) => {
|
|
28
|
-
try {
|
|
29
|
-
const url = new URL(req.url || "", "http://localhost");
|
|
30
|
-
if (url.pathname !== opts.path) {
|
|
31
|
-
respondError(res, 404, opts, "Callback route not found.");
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const error = url.searchParams.get("error");
|
|
35
|
-
if (error) {
|
|
36
|
-
respondError(res, 400, opts, `${opts.providerName} authentication did not complete.`, `Error: ${error}`);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const code = url.searchParams.get("code");
|
|
40
|
-
const state = url.searchParams.get("state");
|
|
41
|
-
if (!code || !state) {
|
|
42
|
-
respondError(res, 400, opts, "Missing code or state parameter.");
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
if (state !== opts.expectedState) {
|
|
46
|
-
respondError(res, 400, opts, "State mismatch.");
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
50
|
-
res.end(opts.renderPage({
|
|
51
|
-
kind: "success",
|
|
52
|
-
provider: opts.providerName,
|
|
53
|
-
message: opts.successMessage
|
|
54
|
-
}));
|
|
55
|
-
pending.settle({
|
|
56
|
-
code,
|
|
57
|
-
state
|
|
58
|
-
});
|
|
59
|
-
} catch {
|
|
60
|
-
respondError(res, 500, opts, "Internal error while processing the callback.");
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function respondError(res, status, opts, message, details) {
|
|
65
|
-
res.writeHead(status, { "Content-Type": "text/html; charset=utf-8" });
|
|
66
|
-
res.end(opts.renderPage({
|
|
67
|
-
kind: "error",
|
|
68
|
-
provider: opts.providerName,
|
|
69
|
-
message,
|
|
70
|
-
details
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
73
|
-
function buildStubHandle(redirectUri, server) {
|
|
74
|
-
return {
|
|
75
|
-
redirectUri,
|
|
76
|
-
waitForCode: async () => null,
|
|
77
|
-
cancelWait: () => {},
|
|
78
|
-
close: () => {
|
|
79
|
-
try {
|
|
80
|
-
server?.close();
|
|
81
|
-
} catch {}
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Start the loopback HTTP callback server. The returned handle is the
|
|
87
|
-
* caller's contract — they `await waitForCode()`, race it against manual
|
|
88
|
-
* paste, then `close()` in a `finally`.
|
|
89
|
-
*/
|
|
90
|
-
async function startCallbackServer(opts) {
|
|
91
|
-
const onListenError = opts.onListenError ?? "reject";
|
|
92
|
-
const redirectUri = `http://localhost:${opts.port}${opts.path}`;
|
|
93
|
-
return new Promise((resolve, reject) => {
|
|
94
|
-
let settled = false;
|
|
95
|
-
const pending = { settle: () => {} };
|
|
96
|
-
const waitPromise = new Promise((resolveWait) => {
|
|
97
|
-
pending.settle = (value) => {
|
|
98
|
-
if (settled) return;
|
|
99
|
-
settled = true;
|
|
100
|
-
resolveWait(value);
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
const server = createServer(buildRequestHandler(opts, pending));
|
|
104
|
-
server.on("error", (err) => {
|
|
105
|
-
if (onListenError === "resolveWithStub") {
|
|
106
|
-
pending.settle(null);
|
|
107
|
-
resolve(buildStubHandle(redirectUri, server));
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
reject(err);
|
|
111
|
-
});
|
|
112
|
-
server.listen(opts.port, CALLBACK_HOST, () => {
|
|
113
|
-
resolve({
|
|
114
|
-
redirectUri,
|
|
115
|
-
waitForCode: () => waitPromise,
|
|
116
|
-
cancelWait: () => pending.settle(null),
|
|
117
|
-
close: () => {
|
|
118
|
-
try {
|
|
119
|
-
server.close();
|
|
120
|
-
} catch {}
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
//#endregion
|
|
127
23
|
//#region src/chat/oauth-page/anthropic.ts
|
|
128
24
|
const CLIENT_ID$1 = atob("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl");
|
|
129
25
|
const AUTHORIZE_URL$1 = "https://claude.ai/oauth/authorize";
|
|
@@ -194,7 +90,7 @@ async function exchangeAuthorizationCode$1(code, state, verifier, redirectUri) {
|
|
|
194
90
|
return {
|
|
195
91
|
refresh: tokenData.refresh_token,
|
|
196
92
|
access: tokenData.access_token,
|
|
197
|
-
expires: Date.now() + tokenData.expires_in * 1e3 -
|
|
93
|
+
expires: Date.now() + tokenData.expires_in * 1e3 - 3e5
|
|
198
94
|
};
|
|
199
95
|
}
|
|
200
96
|
async function loginAnthropicWithCustomPage(options) {
|
|
@@ -206,7 +102,8 @@ async function loginAnthropicWithCustomPage(options) {
|
|
|
206
102
|
providerName: PROVIDER_NAME$1,
|
|
207
103
|
renderPage: options.renderPage,
|
|
208
104
|
successMessage: "Anthropic authentication completed. You can close this window.",
|
|
209
|
-
onListenError: "reject"
|
|
105
|
+
onListenError: "reject",
|
|
106
|
+
...options.listen === false ? { listen: false } : {}
|
|
210
107
|
});
|
|
211
108
|
let code;
|
|
212
109
|
let state;
|
|
@@ -286,7 +183,7 @@ async function loginAnthropicWithCustomPage(options) {
|
|
|
286
183
|
* onto `ProviderDescriptor.oauthProvider` to override.
|
|
287
184
|
*/
|
|
288
185
|
function createAnthropicOAuthProviderWithCustomPage(renderPage) {
|
|
289
|
-
return {
|
|
186
|
+
return honorsRemoteCallback({
|
|
290
187
|
id: "anthropic",
|
|
291
188
|
name: "Anthropic (Claude Pro/Max)",
|
|
292
189
|
usesCallbackServer: true,
|
|
@@ -296,7 +193,8 @@ function createAnthropicOAuthProviderWithCustomPage(renderPage) {
|
|
|
296
193
|
onAuth: callbacks.onAuth,
|
|
297
194
|
onPrompt: callbacks.onPrompt,
|
|
298
195
|
onProgress: callbacks.onProgress,
|
|
299
|
-
onManualCodeInput: callbacks.onManualCodeInput
|
|
196
|
+
onManualCodeInput: callbacks.onManualCodeInput,
|
|
197
|
+
listen: listensForCallback(callbacks)
|
|
300
198
|
});
|
|
301
199
|
},
|
|
302
200
|
async refreshToken(credentials) {
|
|
@@ -305,7 +203,7 @@ function createAnthropicOAuthProviderWithCustomPage(renderPage) {
|
|
|
305
203
|
getApiKey(credentials) {
|
|
306
204
|
return credentials.access;
|
|
307
205
|
}
|
|
308
|
-
};
|
|
206
|
+
});
|
|
309
207
|
}
|
|
310
208
|
//#endregion
|
|
311
209
|
//#region src/chat/oauth-page/openai-codex.ts
|
|
@@ -403,7 +301,8 @@ async function loginOpenAICodexWithCustomPage(options) {
|
|
|
403
301
|
providerName: PROVIDER_NAME,
|
|
404
302
|
renderPage: options.renderPage,
|
|
405
303
|
successMessage: "OpenAI authentication completed. You can close this window.",
|
|
406
|
-
onListenError: "resolveWithStub"
|
|
304
|
+
onListenError: "resolveWithStub",
|
|
305
|
+
...options.listen === false ? { listen: false } : {}
|
|
407
306
|
});
|
|
408
307
|
const authUrl = new URL(AUTHORIZE_URL);
|
|
409
308
|
authUrl.searchParams.set("response_type", "code");
|
|
@@ -478,7 +377,7 @@ async function loginOpenAICodexWithCustomPage(options) {
|
|
|
478
377
|
* `openaiCodexOAuthProvider` except for the callback page HTML.
|
|
479
378
|
*/
|
|
480
379
|
function createOpenAICodexOAuthProviderWithCustomPage(renderPage) {
|
|
481
|
-
return {
|
|
380
|
+
return honorsRemoteCallback({
|
|
482
381
|
id: "openai-codex",
|
|
483
382
|
name: "ChatGPT Plus/Pro (Codex Subscription)",
|
|
484
383
|
usesCallbackServer: true,
|
|
@@ -488,7 +387,8 @@ function createOpenAICodexOAuthProviderWithCustomPage(renderPage) {
|
|
|
488
387
|
onAuth: callbacks.onAuth,
|
|
489
388
|
onPrompt: callbacks.onPrompt,
|
|
490
389
|
onProgress: callbacks.onProgress,
|
|
491
|
-
onManualCodeInput: callbacks.onManualCodeInput
|
|
390
|
+
onManualCodeInput: callbacks.onManualCodeInput,
|
|
391
|
+
listen: listensForCallback(callbacks)
|
|
492
392
|
});
|
|
493
393
|
},
|
|
494
394
|
async refreshToken(credentials) {
|
|
@@ -497,7 +397,7 @@ function createOpenAICodexOAuthProviderWithCustomPage(renderPage) {
|
|
|
497
397
|
getApiKey(credentials) {
|
|
498
398
|
return credentials.access;
|
|
499
399
|
}
|
|
500
|
-
};
|
|
400
|
+
});
|
|
501
401
|
}
|
|
502
402
|
//#endregion
|
|
503
403
|
//#region src/chat/oauth-page/render.ts
|
|
@@ -1094,7 +994,7 @@ const localDescriptor = {
|
|
|
1094
994
|
label: "Context window (tokens)",
|
|
1095
995
|
envVar: "LOCAL_LLM_CONTEXT_WINDOW",
|
|
1096
996
|
placeholder: "e.g. 32768 · or per-model: llama3.1:8b=32768, qwen2.5-coder=128k, 64k",
|
|
1097
|
-
hint: "Context length
|
|
997
|
+
hint: "Context length for your local models. Local runtimes don't report it, so set it here to enable the context indicator and auto-compaction. Use a single value (32768, 128k) for all models, or a comma-separated map of `model=window` with an optional bare value as the fallback. Press"
|
|
1098
998
|
}
|
|
1099
999
|
],
|
|
1100
1000
|
contextWindowEnvVar: "LOCAL_LLM_CONTEXT_WINDOW"
|
|
@@ -1532,6 +1432,35 @@ function mutateCredentials(dataDir, fn) {
|
|
|
1532
1432
|
});
|
|
1533
1433
|
}
|
|
1534
1434
|
/**
|
|
1435
|
+
* Read one entry by its file key, whatever owns it. For stores that keep a
|
|
1436
|
+
* secret beside the provider slots under their own namespace (the host
|
|
1437
|
+
* registry: `hosts:<id>`).
|
|
1438
|
+
*/
|
|
1439
|
+
function readCredentialEntry(dataDir, key) {
|
|
1440
|
+
return readCredentials(dataDir)[key];
|
|
1441
|
+
}
|
|
1442
|
+
/**
|
|
1443
|
+
* Write (or, `undefined`, delete) one entry by its file key, under the same
|
|
1444
|
+
* lock, mode and atomic write as every credential write. Refuses provider
|
|
1445
|
+
* slot keys (`#`): those go through the provider writers above.
|
|
1446
|
+
*/
|
|
1447
|
+
function writeCredentialEntry(dataDir, key, cred) {
|
|
1448
|
+
if (isReservedCredKey(key)) throw new Error(`"${key}" is a provider credential slot.`);
|
|
1449
|
+
mutateCredentials(dataDir, (all) => {
|
|
1450
|
+
if (cred === void 0) {
|
|
1451
|
+
if (!(key in all)) return {
|
|
1452
|
+
result: void 0,
|
|
1453
|
+
write: false
|
|
1454
|
+
};
|
|
1455
|
+
delete all[key];
|
|
1456
|
+
} else all[key] = cred;
|
|
1457
|
+
return {
|
|
1458
|
+
result: void 0,
|
|
1459
|
+
write: true
|
|
1460
|
+
};
|
|
1461
|
+
});
|
|
1462
|
+
}
|
|
1463
|
+
/**
|
|
1535
1464
|
* Move an OAuth grant out of `#alt` into an account slot.
|
|
1536
1465
|
*
|
|
1537
1466
|
* Before multi-account, `#alt` held whichever kind was not active — so a file
|
|
@@ -1767,7 +1696,7 @@ function applyApiKeyEnv(dataDir, registry, opts = {}) {
|
|
|
1767
1696
|
continue;
|
|
1768
1697
|
}
|
|
1769
1698
|
if (cred?.kind === "oauth" && cred.access) {
|
|
1770
|
-
if (ambient !== void 0 && process.env.ZIDANE_DEBUG) log(`[zidane/chat] applyApiKeyEnv: clearing ambient \`${envKey}\` because credentials.json has stored OAuth for ${descriptor.key}
|
|
1699
|
+
if (ambient !== void 0 && process.env.ZIDANE_DEBUG) log(`[zidane/chat] applyApiKeyEnv: clearing ambient \`${envKey}\` because credentials.json has stored OAuth for ${descriptor.key} and needs the file to refresh it.\n`);
|
|
1771
1700
|
delete process.env[envKey];
|
|
1772
1701
|
continue;
|
|
1773
1702
|
}
|
|
@@ -1838,86 +1767,6 @@ function isOAuthLegacy(value) {
|
|
|
1838
1767
|
return typeof value === "object" && value !== null && "access" in value && typeof value.access === "string";
|
|
1839
1768
|
}
|
|
1840
1769
|
//#endregion
|
|
1841
|
-
|
|
1842
|
-
/**
|
|
1843
|
-
* Detect available auth for every registered provider.
|
|
1844
|
-
*
|
|
1845
|
-
* A method appears in `methods` for every layer that has a credential:
|
|
1846
|
-
*
|
|
1847
|
-
* - `kind: 'apikey'` from `credentials.json` (injected into env at TUI launch)
|
|
1848
|
-
* - explicit env var (descriptor's `envKey`)
|
|
1849
|
-
* - `kind: 'oauth'` from `credentials.json` (or legacy `cwd/.credentials.json`),
|
|
1850
|
-
* one per stored account
|
|
1851
|
-
*
|
|
1852
|
-
* The preferred credential lives in the canonical file key and is flagged
|
|
1853
|
-
* {@link AuthMethod.active}; the others sit in sibling slots and are reported
|
|
1854
|
-
* too, keyed by {@link AuthMethod.key}, so the UI can offer to promote or
|
|
1855
|
-
* remove them. Order within `methods` is presentational — active first — not a
|
|
1856
|
-
* resolution order, because the active flag answers that directly.
|
|
1857
|
-
*
|
|
1858
|
-
* Pure read — never refreshes or rewrites the credentials file.
|
|
1859
|
-
*/
|
|
1860
|
-
function detectAuth(dataDir, registry, env = process.env) {
|
|
1861
|
-
const creds = readCredentials(dataDir);
|
|
1862
|
-
return Object.values(registry).map((descriptor) => {
|
|
1863
|
-
const methods = [];
|
|
1864
|
-
const stored = storedCredentialsOf(creds, credKeyOf(descriptor));
|
|
1865
|
-
const fileEntry = stored.find((s) => s.active)?.credential;
|
|
1866
|
-
const describeStored = (key, entry, active) => {
|
|
1867
|
-
if (entry.kind === "apikey" && entry.value) return {
|
|
1868
|
-
source: "apikey",
|
|
1869
|
-
detail: "credentials.json",
|
|
1870
|
-
active,
|
|
1871
|
-
key
|
|
1872
|
-
};
|
|
1873
|
-
if (entry.kind === "oauth" && entry.access) {
|
|
1874
|
-
const label = oauthAccountLabel(entry);
|
|
1875
|
-
return {
|
|
1876
|
-
source: "oauth",
|
|
1877
|
-
detail: `${label} · ${typeof entry.expires === "number" ? `expires ${new Date(entry.expires).toLocaleString()}` : "credentials.json"}`,
|
|
1878
|
-
active,
|
|
1879
|
-
key,
|
|
1880
|
-
label
|
|
1881
|
-
};
|
|
1882
|
-
}
|
|
1883
|
-
};
|
|
1884
|
-
for (const slot of stored) {
|
|
1885
|
-
const method = describeStored(slot.key, slot.credential, slot.active);
|
|
1886
|
-
if (method) methods.push(method);
|
|
1887
|
-
}
|
|
1888
|
-
if (fileEntry?.kind === "apikey" && !fileEntry.value && descriptor.customFields && descriptor.customFields.length > 0) {
|
|
1889
|
-
const stored = fileEntry.customFields ?? {};
|
|
1890
|
-
if (descriptor.customFields.filter((f) => f.required).every((f) => typeof stored[f.key] === "string" && stored[f.key].length > 0)) methods.push({
|
|
1891
|
-
source: "apikey",
|
|
1892
|
-
detail: "credentials.json (configured)",
|
|
1893
|
-
active: true
|
|
1894
|
-
});
|
|
1895
|
-
}
|
|
1896
|
-
if (descriptor.customFields && descriptor.customFields.length > 0) {
|
|
1897
|
-
const required = descriptor.customFields.filter((f) => f.required);
|
|
1898
|
-
if (required.length > 0 && required.every((f) => typeof env[f.envVar] === "string" && env[f.envVar].length > 0)) methods.push({
|
|
1899
|
-
source: "env",
|
|
1900
|
-
detail: required.map((f) => f.envVar).join(", "),
|
|
1901
|
-
active: false
|
|
1902
|
-
});
|
|
1903
|
-
}
|
|
1904
|
-
if (descriptor.envKey && env[descriptor.envKey]) methods.push({
|
|
1905
|
-
source: "env",
|
|
1906
|
-
detail: descriptor.envKey,
|
|
1907
|
-
active: false
|
|
1908
|
-
});
|
|
1909
|
-
const unique = [];
|
|
1910
|
-
for (const method of methods) if (!unique.some((seen) => method.source === "oauth" ? seen.key !== void 0 && seen.key === method.key : seen.source === method.source)) unique.push(method);
|
|
1911
|
-
return {
|
|
1912
|
-
key: descriptor.key,
|
|
1913
|
-
label: descriptor.label,
|
|
1914
|
-
available: unique.length > 0,
|
|
1915
|
-
methods: unique,
|
|
1916
|
-
...descriptor.envKey ? { envKey: descriptor.envKey } : {}
|
|
1917
|
-
};
|
|
1918
|
-
});
|
|
1919
|
-
}
|
|
1920
|
-
//#endregion
|
|
1921
|
-
export { renderDefaultCallbackPage as A, modelOptionsFor as C, openrouterDescriptor as D, openaiDescriptor as E, piIdOf as O, localDescriptor as S, modelsForDescriptor as T, cerebrasDescriptor as _, readProviderCredential as a, getContextWindow as b, removeProviderCredential as c, setPreferredCredential as d, setProviderCredential as f, anthropicDescriptor as g, BUILTIN_PROVIDERS as h, readCredentials as i, restoreModelOptions as k, removeStoredCredential as l, writeCredentials as m, applyApiKeyEnv as n, readProviderCredentialPair as o, storedCredentialsOf as p, credentialsPath as r, readProviderCredentials as s, detectAuth as t, setCredentialLabel as u, credKeyOf as v, modelSupportsReasoning as w, getModelInfo as x, enabledModelOptions as y };
|
|
1770
|
+
export { restoreModelOptions as A, localDescriptor as C, openaiDescriptor as D, modelsForDescriptor as E, openrouterDescriptor as O, getModelInfo as S, modelSupportsReasoning as T, anthropicDescriptor as _, readProviderCredential as a, enabledModelOptions as b, removeProviderCredential as c, setPreferredCredential as d, setProviderCredential as f, BUILTIN_PROVIDERS as g, writeCredentials as h, readCredentials as i, renderDefaultCallbackPage as j, piIdOf as k, removeStoredCredential as l, writeCredentialEntry as m, credentialsPath as n, readProviderCredentialPair as o, storedCredentialsOf as p, readCredentialEntry as r, readProviderCredentials as s, applyApiKeyEnv as t, setCredentialLabel as u, cerebrasDescriptor as v, modelOptionsFor as w, getContextWindow as x, credKeyOf as y };
|
|
1922
1771
|
|
|
1923
|
-
//# sourceMappingURL=
|
|
1772
|
+
//# sourceMappingURL=credentials-JttEuRON.js.map
|