@captain-app/openclaw 2026.2.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/CHANGELOG.md +1528 -0
- package/LICENSE +21 -0
- package/README-header.png +0 -0
- package/README.md +539 -0
- package/assets/avatar-placeholder.svg +19 -0
- package/assets/chrome-extension/README.md +22 -0
- package/assets/chrome-extension/background.js +438 -0
- package/assets/chrome-extension/icons/icon128.png +0 -0
- package/assets/chrome-extension/icons/icon16.png +0 -0
- package/assets/chrome-extension/icons/icon32.png +0 -0
- package/assets/chrome-extension/icons/icon48.png +0 -0
- package/assets/chrome-extension/manifest.json +25 -0
- package/assets/chrome-extension/options.html +196 -0
- package/assets/chrome-extension/options.js +59 -0
- package/assets/dmg-background-small.png +0 -0
- package/assets/dmg-background.png +0 -0
- package/dist/accounts-ClnuDahN.js +250 -0
- package/dist/accounts-DzBgAM3C.js +251 -0
- package/dist/acp-cli-BEDDkzXH.js +926 -0
- package/dist/acp-cli-CwV4mdnW.js +923 -0
- package/dist/agent-CArjbSeE.js +695 -0
- package/dist/agent-CB7x5HLT.js +695 -0
- package/dist/agent-scope-BbT4OG2N.js +545 -0
- package/dist/agent-scope-C_O6Vpl0.js +545 -0
- package/dist/agent-scope-Csu2B6AM.js +606 -0
- package/dist/archive-CWrnG1CH.js +85 -0
- package/dist/archive-ccN9aDgq.js +85 -0
- package/dist/audit-DXPkQ275.js +1686 -0
- package/dist/audit-eH7nwgsM.js +1686 -0
- package/dist/auth-health-Bj7Gjbv0.js +149 -0
- package/dist/auth-health-CjjJhHey.js +149 -0
- package/dist/auth-nnRYiqpH.js +192 -0
- package/dist/auth-profiles-DVLfuixr.js +2954 -0
- package/dist/auth-y1BLPUhX.js +192 -0
- package/dist/boolean-Wzu0-e0P.js +30 -0
- package/dist/brew-Cqi8b49_.js +46 -0
- package/dist/brew-DyBGNK8A.js +46 -0
- package/dist/build-info.json +5 -0
- package/dist/call-B7EveN4V.js +252 -0
- package/dist/call-vuUQIjOj.js +252 -0
- package/dist/canvas-host/a2ui/.bundle.hash +1 -0
- package/dist/canvas-host/a2ui/a2ui.bundle.js +17780 -0
- package/dist/canvas-host/a2ui/index.html +307 -0
- package/dist/channel-options-CJfmOkol.js +32 -0
- package/dist/channel-options-lFguMTz1.js +62 -0
- package/dist/channel-selection-BmND9mWj.js +51 -0
- package/dist/channel-selection-cGhL9G0c.js +51 -0
- package/dist/channel-summary-B4G513Eb.js +1154 -0
- package/dist/channel-summary-MCwBCa5y.js +1154 -0
- package/dist/channels-cli-C2Of1mZG.js +1411 -0
- package/dist/channels-cli-DFynrP1H.js +1413 -0
- package/dist/channels-status-issues-YohTjZ-I.js +18 -0
- package/dist/channels-status-issues-ZcR1U-m5.js +18 -0
- package/dist/chrome-B3IuUad-.js +1953 -0
- package/dist/chrome-BZ9K48w9.js +1973 -0
- package/dist/clack-prompter-B9yLhyOm.js +92 -0
- package/dist/clack-prompter-BybM9xdL.js +92 -0
- package/dist/cli/daemon-cli.js +2 -0
- package/dist/cli-BJZdJwug.js +89 -0
- package/dist/cli-BQSoKu3d.js +86 -0
- package/dist/cli-utils-CO4jEMn0.js +43 -0
- package/dist/cli-utils-gtE-0a0D.js +43 -0
- package/dist/client-DPqNOpK3.js +1609 -0
- package/dist/client-DySXIFCA.js +1609 -0
- package/dist/command-format-CFzL448l.js +52 -0
- package/dist/command-format-DELazozB.js +52 -0
- package/dist/command-format-ayFsmwwz.js +38 -0
- package/dist/command-options-CsjxK4cZ.js +33 -0
- package/dist/commands-BRe9VTyU.js +229 -0
- package/dist/completion-cli-DlkjK0iC.js +390 -0
- package/dist/completion-cli-E6Pt41AL.js +387 -0
- package/dist/config-BtSTwPcH.js +4882 -0
- package/dist/config-DfMIMT-f.js +4881 -0
- package/dist/config-_d7_WcRv.js +5623 -0
- package/dist/config-guard-wSnm-U8a.js +5628 -0
- package/dist/configure-CPHAFKlg.js +895 -0
- package/dist/configure-DK1XgXYx.js +894 -0
- package/dist/constants-CNTiY-ZN.js +65 -0
- package/dist/constants-hpmbslG7.js +65 -0
- package/dist/control-service-CqX5g_ko.js +61 -0
- package/dist/control-service-o6xe3hEb.js +61 -0
- package/dist/control-ui/apple-touch-icon.png +0 -0
- package/dist/control-ui/assets/index-RwcW4Xl0.css +1 -0
- package/dist/control-ui/assets/index-ryaCcbyp.js +4584 -0
- package/dist/control-ui/assets/index-ryaCcbyp.js.map +1 -0
- package/dist/control-ui/favicon-32.png +0 -0
- package/dist/control-ui/favicon.ico +0 -0
- package/dist/control-ui/favicon.svg +22 -0
- package/dist/control-ui/index.html +17 -0
- package/dist/cron-cli-BoSaDgvH.js +453 -0
- package/dist/cron-cli-qVandvsD.js +456 -0
- package/dist/daemon-cli-C4gGWa15.js +760 -0
- package/dist/daemon-cli-DV_X0Krf.js +761 -0
- package/dist/daemon-runtime-D5hbSrdO.js +460 -0
- package/dist/daemon-runtime-DXUfrXBC.js +460 -0
- package/dist/deliver-BxK5nI2P.js +2587 -0
- package/dist/deliver-Dwzg9LUd.js +2557 -0
- package/dist/deliver-qpYZp20m.js +2587 -0
- package/dist/deps-CUXtMV9d.js +27 -0
- package/dist/deps-WBvZpFV_.js +27 -0
- package/dist/devices-cli-B2s18Qrh.js +207 -0
- package/dist/devices-cli-D1UEtMUJ.js +204 -0
- package/dist/directory-cli-BXQbrkfM.js +247 -0
- package/dist/directory-cli-CqA7tRbq.js +244 -0
- package/dist/dispatcher-Dyv7T-1r.js +160 -0
- package/dist/dns-cli-CWxKD22D.js +198 -0
- package/dist/dns-cli-CzKr_Fxj.js +201 -0
- package/dist/docs-cli-BNyxUbWr.js +159 -0
- package/dist/docs-cli-DYpTbo3i.js +161 -0
- package/dist/doctor-C8fDYZLq.js +2583 -0
- package/dist/doctor-hYcqp7c0.js +2585 -0
- package/dist/entry.js +1326 -0
- package/dist/env-l7QVNj6j.js +32 -0
- package/dist/errors-CMCg46fK.js +1952 -0
- package/dist/exec-B8JKbXKW.js +246 -0
- package/dist/exec-BMnoMcZW.js +1099 -0
- package/dist/exec-HEWTMJ7j.js +246 -0
- package/dist/exec-approvals-DtrnHx6M.js +1026 -0
- package/dist/exec-approvals-Y42bE8ud.js +1026 -0
- package/dist/exec-approvals-cli-CIedYxP3.js +385 -0
- package/dist/exec-approvals-cli-xpbxnj4O.js +388 -0
- package/dist/extensionAPI.js +66572 -0
- package/dist/format-Dzy9uRLE.js +34 -0
- package/dist/format-sj0fELBK.js +34 -0
- package/dist/gateway-cli-5A-KNLEC.js +16635 -0
- package/dist/gateway-cli-B8kS4chb.js +16637 -0
- package/dist/gateway-rpc-15n38Ize.js +28 -0
- package/dist/gateway-rpc-TMVRgGfj.js +28 -0
- package/dist/github-copilot-auth-DVZj4Zgh.js +1104 -0
- package/dist/github-copilot-auth-DeGYyLY9.js +1104 -0
- package/dist/github-copilot-token-B3SA95yo.js +103 -0
- package/dist/github-copilot-token-C8XFYz0i.js +103 -0
- package/dist/github-copilot-token-CnxakiSC.js +103 -0
- package/dist/gmail-setup-utils-CWPC386a.js +428 -0
- package/dist/gmail-setup-utils-eJVB5Ewp.js +428 -0
- package/dist/health-format-B0tMTk3C.js +1189 -0
- package/dist/health-format-DaURVaUn.js +1188 -0
- package/dist/help-format-CEsRHU2f.js +17 -0
- package/dist/help-format-GuCWws6r.js +17 -0
- package/dist/helpers-BEJ-phFf.js +25 -0
- package/dist/helpers-BtbBZVKZ.js +10 -0
- package/dist/helpers-C12w9zxf.js +10 -0
- package/dist/helpers-CzjGJZmJ.js +25 -0
- package/dist/hooks/bundled/boot-md/HOOK.md +19 -0
- package/dist/hooks/bundled/command-logger/HOOK.md +122 -0
- package/dist/hooks/bundled/session-memory/HOOK.md +109 -0
- package/dist/hooks/bundled/soul-evil/HOOK.md +71 -0
- package/dist/hooks-cli-BZCMAnW2.js +1058 -0
- package/dist/hooks-cli-D0CEFg3P.js +1061 -0
- package/dist/hooks-status-Bn7_O8PM.js +443 -0
- package/dist/hooks-status-BrWVfIn0.js +443 -0
- package/dist/image-BS022pvv.js +1421 -0
- package/dist/image-BzJtY34J.js +629 -0
- package/dist/image-CBqmIbQQ.js +629 -0
- package/dist/index.js +5809 -0
- package/dist/installs-BP4K5L33.js +388 -0
- package/dist/installs-DOpTt7VZ.js +388 -0
- package/dist/is-main-B4o72sqg.js +25 -0
- package/dist/is-main-PYGa3tDA.js +25 -0
- package/dist/links-B4nk2iDf.js +15 -0
- package/dist/links-DwjRqxgR.js +15 -0
- package/dist/loader-Cn4EV_pf.js +63690 -0
- package/dist/logging-CS3tbYDj.js +15 -0
- package/dist/logging-CY-Q5cwf.js +1 -0
- package/dist/logging-DhiLkhLw.js +15 -0
- package/dist/logging-pqyrk15z.js +1 -0
- package/dist/login-qr-CD164Aw1.js +478 -0
- package/dist/login-qr-D7Zdgji2.js +478 -0
- package/dist/login-qr-YgILJ4VC.js +475 -0
- package/dist/logs-cli-BdS0Uv0I.js +227 -0
- package/dist/logs-cli-CqSN1GzB.js +230 -0
- package/dist/manager-CfGY5zND.js +2870 -0
- package/dist/manager-CjuBqFRL.js +2870 -0
- package/dist/manager-CoBEAQKm.js +2872 -0
- package/dist/manifest-registry-Bwjq9Iev.js +668 -0
- package/dist/manifest-registry-D2Yntqcb.js +668 -0
- package/dist/message-channel-Cjsiqxok.js +105 -0
- package/dist/message-channel-D6v_oPAg.js +105 -0
- package/dist/model-selection-Cv5Ox_tY.js +2956 -0
- package/dist/model-selection-Dr-5U5-l.js +2708 -0
- package/dist/models-cli-B39ckynD.js +2541 -0
- package/dist/models-cli-DoiYsBYw.js +2544 -0
- package/dist/net-CFCxaipF.js +137 -0
- package/dist/net-DKJPqXuW.js +137 -0
- package/dist/node-cli-C_FYF-RA.js +1456 -0
- package/dist/node-cli-DWPoNsQS.js +1459 -0
- package/dist/node-service-DcJREOww.js +67 -0
- package/dist/node-service-DuZ9Us9h.js +67 -0
- package/dist/nodes-cli-Elo6tlen.js +1210 -0
- package/dist/nodes-cli-zqryRUWB.js +1207 -0
- package/dist/nodes-screen-C4aCrxie.js +157 -0
- package/dist/nodes-screen-D4PSynkR.js +157 -0
- package/dist/note-CQhSvgQv.js +73 -0
- package/dist/note-_C44YfAQ.js +73 -0
- package/dist/onboard-channels-CHBDi-ZA.js +670 -0
- package/dist/onboard-channels-DOEKyxaL.js +670 -0
- package/dist/onboard-skills-BUTXREDZ.js +3327 -0
- package/dist/onboard-skills-CSLYZmZA.js +3327 -0
- package/dist/onboarding-CgKb8b39.js +3232 -0
- package/dist/openclaw-root-9ILYSmJ9.js +84 -0
- package/dist/openclaw-root-Cvotktkd.js +84 -0
- package/dist/pairing-cli-B4UGR2at.js +114 -0
- package/dist/pairing-cli-BWDDl8cf.js +117 -0
- package/dist/pairing-labels-ClZ-fTWT.js +9 -0
- package/dist/pairing-labels-Ds7BPOkj.js +9 -0
- package/dist/pairing-store-DDLNuzmx.js +391 -0
- package/dist/pairing-store-DRn08lZD.js +391 -0
- package/dist/parse-87ybtYW1.js +23 -0
- package/dist/parse-OCFfznr3.js +23 -0
- package/dist/parse-log-line-C9aL5PUL.js +44 -0
- package/dist/parse-log-line-DxRaGzQb.js +44 -0
- package/dist/parse-timeout-CFqNj7No.js +16 -0
- package/dist/parse-timeout-DV8NQQWk.js +16 -0
- package/dist/path-env-C7kiJUgG.js +77 -0
- package/dist/path-env-DEj4CiFN.js +77 -0
- package/dist/paths-B-q1nXdY.js +43 -0
- package/dist/paths-B1kfl4h5.js +164 -0
- package/dist/paths-B4kigINg.js +40 -0
- package/dist/paths-CHGbP1-A.js +43 -0
- package/dist/paths-scjhy7N2.js +180 -0
- package/dist/pi-embedded-helpers-C19wUpMB.js +8451 -0
- package/dist/pi-embedded-helpers-CT5VuLCb.js +1293 -0
- package/dist/pi-embedded-helpers-Dl8e5Rf8.js +1293 -0
- package/dist/pi-model-discovery-B6CsmK6Y.js +20 -0
- package/dist/pi-model-discovery-DsRqYJLy.js +20 -0
- package/dist/pi-model-discovery-EhM2JAQo.js +20 -0
- package/dist/pi-tools.policy-BvkSDFDN.js +229 -0
- package/dist/plugin-auto-enable-Bd_StZzz.js +461 -0
- package/dist/plugin-auto-enable-DBhXb_0x.js +461 -0
- package/dist/plugin-sdk/agent-scope-DdwUKIOe.js +606 -0
- package/dist/plugin-sdk/chrome-G8apFa5p.js +1953 -0
- package/dist/plugin-sdk/command-format-qUVxzqYm.js +52 -0
- package/dist/plugin-sdk/config-Cm1M7tgH.js +5623 -0
- package/dist/plugin-sdk/deliver-Cl8uowiO.js +2557 -0
- package/dist/plugin-sdk/exec-Cm9b2r9Q.js +1107 -0
- package/dist/plugin-sdk/github-copilot-token-BHNcM4_B.js +103 -0
- package/dist/plugin-sdk/image-7PgoS2VD.js +1421 -0
- package/dist/plugin-sdk/index.d.ts +8908 -0
- package/dist/plugin-sdk/index.js +70888 -0
- package/dist/plugin-sdk/login-qr-qTALvWi2.js +475 -0
- package/dist/plugin-sdk/manager-Cs3EQZCb.js +2870 -0
- package/dist/plugin-sdk/model-selection-BgC1E1a7.js +2708 -0
- package/dist/plugin-sdk/paths-BYpoyRv5.js +164 -0
- package/dist/plugin-sdk/paths-DNQE-bvr.js +40 -0
- package/dist/plugin-sdk/pi-embedded-helpers-5jNqW_dE.js +8755 -0
- package/dist/plugin-sdk/pi-model-discovery-BUGEht9A.js +20 -0
- package/dist/plugin-sdk/pw-ai-COTtei4a.js +1649 -0
- package/dist/plugin-sdk/qmd-manager-ClSwiAJl.js +615 -0
- package/dist/plugin-sdk/redact-2AzjOfk2.js +94 -0
- package/dist/plugin-sdk/rolldown-runtime-Cbj13DAv.js +20 -0
- package/dist/plugin-sdk/sqlite-gCW7MlLs.js +215 -0
- package/dist/plugin-sdk/transcript-events-DGF257vD.js +17 -0
- package/dist/plugins-C3Bm-HQV.js +494 -0
- package/dist/plugins-QJjTXliB.js +495 -0
- package/dist/plugins-cli-DTci0JQb.js +443 -0
- package/dist/plugins-cli-wJsN1HHK.js +440 -0
- package/dist/ports-CiW9dmMq.js +96 -0
- package/dist/program-BWpTHh1I.js +188 -0
- package/dist/progress-Bcjniu7m.js +133 -0
- package/dist/progress-CvaSPjS9.js +133 -0
- package/dist/prompt-style-CFsleyxV.js +9 -0
- package/dist/prompt-style-DYJdrXyV.js +9 -0
- package/dist/prompts-Bt9fwsg2.js +10 -0
- package/dist/prompts-CudpZgTI.js +10 -0
- package/dist/pw-ai-08F3GD-3.js +1649 -0
- package/dist/pw-ai-ZmHxHQnx.js +1651 -0
- package/dist/pw-ai-tNPuRNn3.js +1649 -0
- package/dist/qmd-manager-2r-4n3sP.js +617 -0
- package/dist/qmd-manager-CF52nuBg.js +615 -0
- package/dist/qmd-manager-HEm5H2mk.js +616 -0
- package/dist/redact-BICFkpn7.js +97 -0
- package/dist/redact-BIMJ3ntQ.js +94 -0
- package/dist/redact-KzWHRS5J.js +97 -0
- package/dist/register.subclis-D2K25c84.js +348 -0
- package/dist/register.subclis-Dd8LbOLi.js +342 -0
- package/dist/reply-5UNWRwMn.js +63693 -0
- package/dist/restart-sentinel-Cr0vUxB8.js +65 -0
- package/dist/restart-sentinel-DUemCjgU.js +65 -0
- package/dist/rolldown-runtime-Cbj13DAv.js +20 -0
- package/dist/routes-C6UpTPas.js +2410 -0
- package/dist/routes-ClNyEvlm.js +2410 -0
- package/dist/rpc-D0mf7DIw.js +95 -0
- package/dist/rpc-DYdOrgd9.js +95 -0
- package/dist/run-main-CojI7gWx.js +194 -0
- package/dist/runtime-guard-68M_evhb.js +60 -0
- package/dist/runtime-guard-DkjmhnBD.js +60 -0
- package/dist/sandbox-Ca81z3Tw.js +2924 -0
- package/dist/sandbox-cli-D75GApgp.js +459 -0
- package/dist/sandbox-cli-E4SJsC1C.js +462 -0
- package/dist/sandbox-knontqD9.js +2925 -0
- package/dist/security-cli-BLihvXO-.js +503 -0
- package/dist/security-cli-IGQCsK4g.js +506 -0
- package/dist/server-context-B9GX5GOI.js +740 -0
- package/dist/server-context-BFH7HB_M.js +740 -0
- package/dist/server-node-events-CTdHBiEA.js +218 -0
- package/dist/server-node-events-DAV14qPr.js +215 -0
- package/dist/service-BZNBq9hq.js +680 -0
- package/dist/service-C-BLXx9U.js +680 -0
- package/dist/service-audit-BfJv4NqZ.js +542 -0
- package/dist/service-audit-Bw3M2OEI.js +542 -0
- package/dist/shared-5SH-45AX.js +74 -0
- package/dist/shared-BxRm5uLU.js +74 -0
- package/dist/shared-C80Rmxsd.js +150 -0
- package/dist/shared-fGK6_D2v.js +150 -0
- package/dist/skills-Bhp0l6UK.js +693 -0
- package/dist/skills-Tky2kCMO.js +694 -0
- package/dist/skills-cli-6rCClAE4.js +287 -0
- package/dist/skills-cli-C4nLCrLw.js +290 -0
- package/dist/skills-status-CENcKr3I.js +187 -0
- package/dist/skills-status-DX1eUYvk.js +187 -0
- package/dist/sqlite-CmdZSZRx.js +197 -0
- package/dist/sqlite-Dnmf3LS7.js +215 -0
- package/dist/sqlite-QDf0yuU0.js +215 -0
- package/dist/status-BSfGAp2D.js +27 -0
- package/dist/status-Bp_2NMjt.js +27 -0
- package/dist/status-C0ANDr0T.js +3140 -0
- package/dist/status-CCHBIZnm.js +21 -0
- package/dist/status-Vuqbw2Bb.js +21 -0
- package/dist/status.update-BZW5r8Su.js +79 -0
- package/dist/status.update-BnD93_O8.js +79 -0
- package/dist/subsystem-CAq3uyo7.js +834 -0
- package/dist/system-cli-Bb9zmCO1.js +83 -0
- package/dist/system-cli-TIIQ04ls.js +80 -0
- package/dist/systemd-0Qa_nGqe.js +438 -0
- package/dist/systemd-Czb0Xsm7.js +438 -0
- package/dist/systemd-hints-CWoEOQRb.js +19 -0
- package/dist/systemd-hints-Cv3RN_mZ.js +19 -0
- package/dist/systemd-linger-CsdvcIoS.js +75 -0
- package/dist/systemd-linger-DKUFHcLn.js +75 -0
- package/dist/table-DNPESyNj.js +279 -0
- package/dist/table-DS4-gmkV.js +279 -0
- package/dist/tailnet-Bg_vE5qi.js +42 -0
- package/dist/tailnet-CrNWlQRJ.js +42 -0
- package/dist/tailscale-CBv58toW.js +252 -0
- package/dist/tailscale-DCnMs7_q.js +225 -0
- package/dist/tool-display-BEACy9rK.js +795 -0
- package/dist/tool-display-NYQnSpdo.js +795 -0
- package/dist/transcript-events-CsB1Saa6.js +17 -0
- package/dist/transcript-events-DDYvbmRV.js +17 -0
- package/dist/transcript-events-JLH5W4He.js +17 -0
- package/dist/tui--NY0rnjr.js +2542 -0
- package/dist/tui-DqJfGtvM.js +2543 -0
- package/dist/tui-cli-BuHNY6wF.js +54 -0
- package/dist/tui-cli-LMFV982e.js +57 -0
- package/dist/update-CRpHtCgz.js +317 -0
- package/dist/update-D3qruxhj.js +317 -0
- package/dist/update-cli-CFF-pslM.js +948 -0
- package/dist/update-cli-cn9pEMX7.js +951 -0
- package/dist/update-runner-CxGU142L.js +1221 -0
- package/dist/update-runner-DNobz_ft.js +1221 -0
- package/dist/utils-CKSrBNwq.js +192 -0
- package/dist/utils-DX85MiPR.js +188 -0
- package/dist/webhooks-cli-BGtt2HAR.js +312 -0
- package/dist/webhooks-cli-DHLZrEO_.js +309 -0
- package/dist/widearea-dns-BpG7ATO8.js +127 -0
- package/dist/widearea-dns-D4wkCJly.js +127 -0
- package/dist/ws-3zr8WUwL.js +13 -0
- package/dist/ws-log-BXcT2xQk.js +267 -0
- package/dist/ws-log-DbDIUsgz.js +267 -0
- package/dist/ws-lzrgabja.js +13 -0
- package/dist/wsl-D2O2qOrl.js +160 -0
- package/docs/.i18n/README.md +31 -0
- package/docs/.i18n/glossary.zh-CN.json +190 -0
- package/docs/.i18n/zh-CN.tm.jsonl +1329 -0
- package/docs/CNAME +1 -0
- package/docs/_config.yml +53 -0
- package/docs/_layouts/default.html +145 -0
- package/docs/assets/markdown.css +179 -0
- package/docs/assets/openclaw-logo-text-dark.png +0 -0
- package/docs/assets/openclaw-logo-text.png +0 -0
- package/docs/assets/pixel-lobster.svg +60 -0
- package/docs/assets/showcase/agents-ui.jpg +0 -0
- package/docs/assets/showcase/bambu-cli.png +0 -0
- package/docs/assets/showcase/codexmonitor.png +0 -0
- package/docs/assets/showcase/gohome-grafana.png +0 -0
- package/docs/assets/showcase/ios-testflight.jpg +0 -0
- package/docs/assets/showcase/oura-health.png +0 -0
- package/docs/assets/showcase/padel-cli.svg +11 -0
- package/docs/assets/showcase/padel-screenshot.jpg +0 -0
- package/docs/assets/showcase/papla-tts.jpg +0 -0
- package/docs/assets/showcase/pr-review-telegram.jpg +0 -0
- package/docs/assets/showcase/roborock-screenshot.jpg +0 -0
- package/docs/assets/showcase/roborock-status.svg +13 -0
- package/docs/assets/showcase/roof-camera-sky.jpg +0 -0
- package/docs/assets/showcase/snag.png +0 -0
- package/docs/assets/showcase/tesco-shop.jpg +0 -0
- package/docs/assets/showcase/wienerlinien.png +0 -0
- package/docs/assets/showcase/wine-cellar-skill.jpg +0 -0
- package/docs/assets/showcase/winix-air-purifier.jpg +0 -0
- package/docs/assets/showcase/xuezh-pronunciation.jpeg +0 -0
- package/docs/assets/terminal.css +473 -0
- package/docs/assets/theme.js +55 -0
- package/docs/automation/auth-monitoring.md +44 -0
- package/docs/automation/cron-jobs.md +468 -0
- package/docs/automation/cron-vs-heartbeat.md +282 -0
- package/docs/automation/gmail-pubsub.md +256 -0
- package/docs/automation/poll.md +69 -0
- package/docs/automation/webhook.md +163 -0
- package/docs/bedrock.md +176 -0
- package/docs/brave-search.md +41 -0
- package/docs/broadcast-groups.md +442 -0
- package/docs/channels/bluebubbles.md +338 -0
- package/docs/channels/discord.md +475 -0
- package/docs/channels/feishu.md +507 -0
- package/docs/channels/googlechat.md +250 -0
- package/docs/channels/grammy.md +31 -0
- package/docs/channels/imessage.md +299 -0
- package/docs/channels/index.md +46 -0
- package/docs/channels/line.md +186 -0
- package/docs/channels/location.md +56 -0
- package/docs/channels/matrix.md +233 -0
- package/docs/channels/mattermost.md +138 -0
- package/docs/channels/msteams.md +768 -0
- package/docs/channels/nextcloud-talk.md +136 -0
- package/docs/channels/nostr.md +233 -0
- package/docs/channels/signal.md +202 -0
- package/docs/channels/slack.md +548 -0
- package/docs/channels/telegram.md +750 -0
- package/docs/channels/tlon.md +132 -0
- package/docs/channels/troubleshooting.md +29 -0
- package/docs/channels/twitch.md +379 -0
- package/docs/channels/whatsapp.md +404 -0
- package/docs/channels/zalo.md +189 -0
- package/docs/channels/zalouser.md +140 -0
- package/docs/cli/acp.md +170 -0
- package/docs/cli/agent.md +24 -0
- package/docs/cli/agents.md +75 -0
- package/docs/cli/approvals.md +50 -0
- package/docs/cli/browser.md +107 -0
- package/docs/cli/channels.md +79 -0
- package/docs/cli/config.md +50 -0
- package/docs/cli/configure.md +33 -0
- package/docs/cli/cron.md +42 -0
- package/docs/cli/dashboard.md +16 -0
- package/docs/cli/devices.md +67 -0
- package/docs/cli/directory.md +63 -0
- package/docs/cli/dns.md +23 -0
- package/docs/cli/docs.md +15 -0
- package/docs/cli/doctor.md +41 -0
- package/docs/cli/gateway.md +199 -0
- package/docs/cli/health.md +21 -0
- package/docs/cli/hooks.md +304 -0
- package/docs/cli/index.md +1029 -0
- package/docs/cli/logs.md +24 -0
- package/docs/cli/memory.md +45 -0
- package/docs/cli/message.md +239 -0
- package/docs/cli/models.md +79 -0
- package/docs/cli/node.md +112 -0
- package/docs/cli/nodes.md +73 -0
- package/docs/cli/onboard.md +29 -0
- package/docs/cli/pairing.md +21 -0
- package/docs/cli/plugins.md +62 -0
- package/docs/cli/reset.md +17 -0
- package/docs/cli/sandbox.md +152 -0
- package/docs/cli/security.md +26 -0
- package/docs/cli/sessions.md +16 -0
- package/docs/cli/setup.md +29 -0
- package/docs/cli/skills.md +26 -0
- package/docs/cli/status.md +26 -0
- package/docs/cli/system.md +60 -0
- package/docs/cli/tui.md +23 -0
- package/docs/cli/uninstall.md +17 -0
- package/docs/cli/update.md +98 -0
- package/docs/cli/voicecall.md +34 -0
- package/docs/cli/webhooks.md +25 -0
- package/docs/concepts/agent-loop.md +146 -0
- package/docs/concepts/agent-workspace.md +233 -0
- package/docs/concepts/agent.md +123 -0
- package/docs/concepts/architecture.md +129 -0
- package/docs/concepts/channel-routing.md +114 -0
- package/docs/concepts/compaction.md +61 -0
- package/docs/concepts/context.md +161 -0
- package/docs/concepts/group-messages.md +84 -0
- package/docs/concepts/groups.md +373 -0
- package/docs/concepts/markdown-formatting.md +130 -0
- package/docs/concepts/memory.md +546 -0
- package/docs/concepts/messages.md +154 -0
- package/docs/concepts/model-failover.md +149 -0
- package/docs/concepts/model-providers.md +316 -0
- package/docs/concepts/models.md +208 -0
- package/docs/concepts/multi-agent.md +376 -0
- package/docs/concepts/oauth.md +145 -0
- package/docs/concepts/presence.md +102 -0
- package/docs/concepts/queue.md +89 -0
- package/docs/concepts/retry.md +69 -0
- package/docs/concepts/session-pruning.md +122 -0
- package/docs/concepts/session-tool.md +193 -0
- package/docs/concepts/session.md +188 -0
- package/docs/concepts/sessions.md +10 -0
- package/docs/concepts/streaming.md +135 -0
- package/docs/concepts/system-prompt.md +115 -0
- package/docs/concepts/timezone.md +91 -0
- package/docs/concepts/typebox.md +289 -0
- package/docs/concepts/typing-indicators.md +68 -0
- package/docs/concepts/usage-tracking.md +35 -0
- package/docs/date-time.md +128 -0
- package/docs/debug/node-issue.md +83 -0
- package/docs/debugging.md +162 -0
- package/docs/diagnostics/flags.md +91 -0
- package/docs/docs.json +1587 -0
- package/docs/environment.md +81 -0
- package/docs/experiments/onboarding-config-protocol.md +40 -0
- package/docs/experiments/plans/cron-add-hardening.md +63 -0
- package/docs/experiments/plans/group-policy-hardening.md +40 -0
- package/docs/experiments/plans/openresponses-gateway.md +123 -0
- package/docs/experiments/proposals/model-config.md +36 -0
- package/docs/experiments/research/memory.md +228 -0
- package/docs/gateway/authentication.md +145 -0
- package/docs/gateway/background-process.md +93 -0
- package/docs/gateway/bonjour.md +167 -0
- package/docs/gateway/bridge-protocol.md +89 -0
- package/docs/gateway/cli-backends.md +223 -0
- package/docs/gateway/configuration-examples.md +606 -0
- package/docs/gateway/configuration.md +3393 -0
- package/docs/gateway/discovery.md +116 -0
- package/docs/gateway/doctor.md +282 -0
- package/docs/gateway/gateway-lock.md +34 -0
- package/docs/gateway/health.md +35 -0
- package/docs/gateway/heartbeat.md +302 -0
- package/docs/gateway/index.md +328 -0
- package/docs/gateway/local-models.md +150 -0
- package/docs/gateway/logging.md +113 -0
- package/docs/gateway/multiple-gateways.md +112 -0
- package/docs/gateway/openai-http-api.md +118 -0
- package/docs/gateway/openresponses-http-api.md +317 -0
- package/docs/gateway/pairing.md +99 -0
- package/docs/gateway/protocol.md +221 -0
- package/docs/gateway/remote-gateway-readme.md +157 -0
- package/docs/gateway/remote.md +127 -0
- package/docs/gateway/sandbox-vs-tool-policy-vs-elevated.md +128 -0
- package/docs/gateway/sandboxing.md +193 -0
- package/docs/gateway/security/formal-verification.md +164 -0
- package/docs/gateway/security/index.md +825 -0
- package/docs/gateway/tailscale.md +127 -0
- package/docs/gateway/tools-invoke-http-api.md +85 -0
- package/docs/gateway/troubleshooting.md +767 -0
- package/docs/help/faq.md +2830 -0
- package/docs/help/index.md +21 -0
- package/docs/help/troubleshooting.md +98 -0
- package/docs/hooks/soul-evil.md +69 -0
- package/docs/hooks.md +913 -0
- package/docs/images/feishu-step2-create-app.png +0 -0
- package/docs/images/feishu-step3-credentials.png +0 -0
- package/docs/images/feishu-step4-permissions.png +0 -0
- package/docs/images/feishu-step5-bot-capability.png +0 -0
- package/docs/images/feishu-step6-event-subscription.png +0 -0
- package/docs/images/groups-flow.svg +52 -0
- package/docs/images/mobile-ui-screenshot.png +0 -0
- package/docs/index.md +258 -0
- package/docs/install/ansible.md +208 -0
- package/docs/install/bun.md +59 -0
- package/docs/install/development-channels.md +75 -0
- package/docs/install/docker.md +567 -0
- package/docs/install/index.md +185 -0
- package/docs/install/installer.md +123 -0
- package/docs/install/migrating.md +192 -0
- package/docs/install/nix.md +96 -0
- package/docs/install/node.md +78 -0
- package/docs/install/uninstall.md +128 -0
- package/docs/install/updating.md +228 -0
- package/docs/logging.md +350 -0
- package/docs/multi-agent-sandbox-tools.md +395 -0
- package/docs/network.md +54 -0
- package/docs/nodes/audio.md +114 -0
- package/docs/nodes/camera.md +156 -0
- package/docs/nodes/images.md +72 -0
- package/docs/nodes/index.md +341 -0
- package/docs/nodes/location-command.md +113 -0
- package/docs/nodes/media-understanding.md +379 -0
- package/docs/nodes/talk.md +90 -0
- package/docs/nodes/voicewake.md +65 -0
- package/docs/northflank.mdx +53 -0
- package/docs/perplexity.md +80 -0
- package/docs/pi-dev.md +70 -0
- package/docs/pi.md +612 -0
- package/docs/platforms/android.md +148 -0
- package/docs/platforms/digitalocean.md +262 -0
- package/docs/platforms/exe-dev.md +125 -0
- package/docs/platforms/fly.md +486 -0
- package/docs/platforms/gcp.md +503 -0
- package/docs/platforms/hetzner.md +330 -0
- package/docs/platforms/index.md +53 -0
- package/docs/platforms/ios.md +107 -0
- package/docs/platforms/linux.md +94 -0
- package/docs/platforms/mac/bundled-gateway.md +73 -0
- package/docs/platforms/mac/canvas.md +125 -0
- package/docs/platforms/mac/child-process.md +69 -0
- package/docs/platforms/mac/dev-setup.md +102 -0
- package/docs/platforms/mac/health.md +34 -0
- package/docs/platforms/mac/icon.md +31 -0
- package/docs/platforms/mac/logging.md +57 -0
- package/docs/platforms/mac/menu-bar.md +81 -0
- package/docs/platforms/mac/peekaboo.md +65 -0
- package/docs/platforms/mac/permissions.md +44 -0
- package/docs/platforms/mac/release.md +85 -0
- package/docs/platforms/mac/remote.md +83 -0
- package/docs/platforms/mac/signing.md +47 -0
- package/docs/platforms/mac/skills.md +33 -0
- package/docs/platforms/mac/voice-overlay.md +60 -0
- package/docs/platforms/mac/voicewake.md +67 -0
- package/docs/platforms/mac/webchat.md +41 -0
- package/docs/platforms/mac/xpc.md +61 -0
- package/docs/platforms/macos-vm.md +281 -0
- package/docs/platforms/macos.md +203 -0
- package/docs/platforms/oracle.md +303 -0
- package/docs/platforms/raspberry-pi.md +358 -0
- package/docs/platforms/windows.md +159 -0
- package/docs/plugin.md +664 -0
- package/docs/plugins/agent-tools.md +99 -0
- package/docs/plugins/manifest.md +71 -0
- package/docs/plugins/voice-call.md +284 -0
- package/docs/plugins/zalouser.md +81 -0
- package/docs/prose.md +134 -0
- package/docs/providers/anthropic.md +152 -0
- package/docs/providers/claude-max-api-proxy.md +148 -0
- package/docs/providers/cloudflare-ai-gateway.md +71 -0
- package/docs/providers/deepgram.md +93 -0
- package/docs/providers/github-copilot.md +72 -0
- package/docs/providers/glm.md +33 -0
- package/docs/providers/index.md +63 -0
- package/docs/providers/minimax.md +208 -0
- package/docs/providers/models.md +51 -0
- package/docs/providers/moonshot.md +142 -0
- package/docs/providers/ollama.md +223 -0
- package/docs/providers/openai.md +62 -0
- package/docs/providers/opencode.md +36 -0
- package/docs/providers/openrouter.md +37 -0
- package/docs/providers/qwen.md +53 -0
- package/docs/providers/synthetic.md +99 -0
- package/docs/providers/venice.md +267 -0
- package/docs/providers/vercel-ai-gateway.md +50 -0
- package/docs/providers/xiaomi.md +64 -0
- package/docs/providers/zai.md +36 -0
- package/docs/railway.mdx +99 -0
- package/docs/refactor/clawnet.md +417 -0
- package/docs/refactor/exec-host.md +316 -0
- package/docs/refactor/outbound-session-mirroring.md +85 -0
- package/docs/refactor/plugin-sdk.md +214 -0
- package/docs/refactor/strict-config.md +93 -0
- package/docs/reference/AGENTS.default.md +124 -0
- package/docs/reference/RELEASING.md +120 -0
- package/docs/reference/api-usage-costs.md +137 -0
- package/docs/reference/device-models.md +47 -0
- package/docs/reference/rpc.md +43 -0
- package/docs/reference/session-management-compaction.md +285 -0
- package/docs/reference/templates/AGENTS.dev.md +83 -0
- package/docs/reference/templates/AGENTS.md +218 -0
- package/docs/reference/templates/BOOT.md +10 -0
- package/docs/reference/templates/BOOTSTRAP.md +61 -0
- package/docs/reference/templates/HEARTBEAT.md +11 -0
- package/docs/reference/templates/IDENTITY.dev.md +47 -0
- package/docs/reference/templates/IDENTITY.md +27 -0
- package/docs/reference/templates/SOUL.dev.md +76 -0
- package/docs/reference/templates/SOUL.md +42 -0
- package/docs/reference/templates/TOOLS.dev.md +24 -0
- package/docs/reference/templates/TOOLS.md +46 -0
- package/docs/reference/templates/USER.dev.md +18 -0
- package/docs/reference/templates/USER.md +22 -0
- package/docs/reference/test.md +50 -0
- package/docs/reference/transcript-hygiene.md +129 -0
- package/docs/render.mdx +165 -0
- package/docs/scripts.md +28 -0
- package/docs/security/formal-verification.md +164 -0
- package/docs/start/getting-started.md +208 -0
- package/docs/start/hubs.md +185 -0
- package/docs/start/lore.md +219 -0
- package/docs/start/onboarding.md +110 -0
- package/docs/start/openclaw.md +241 -0
- package/docs/start/pairing.md +86 -0
- package/docs/start/setup.md +149 -0
- package/docs/start/showcase.md +416 -0
- package/docs/start/wizard.md +349 -0
- package/docs/testing.md +368 -0
- package/docs/token-use.md +112 -0
- package/docs/tools/agent-send.md +53 -0
- package/docs/tools/apply-patch.md +50 -0
- package/docs/tools/browser-linux-troubleshooting.md +139 -0
- package/docs/tools/browser-login.md +68 -0
- package/docs/tools/browser.md +576 -0
- package/docs/tools/chrome-extension.md +178 -0
- package/docs/tools/clawhub.md +257 -0
- package/docs/tools/creating-skills.md +54 -0
- package/docs/tools/elevated.md +57 -0
- package/docs/tools/exec-approvals.md +246 -0
- package/docs/tools/exec.md +179 -0
- package/docs/tools/firecrawl.md +61 -0
- package/docs/tools/index.md +509 -0
- package/docs/tools/llm-task.md +115 -0
- package/docs/tools/lobster.md +342 -0
- package/docs/tools/reactions.md +22 -0
- package/docs/tools/skills-config.md +76 -0
- package/docs/tools/skills.md +300 -0
- package/docs/tools/slash-commands.md +198 -0
- package/docs/tools/subagents.md +151 -0
- package/docs/tools/thinking.md +73 -0
- package/docs/tools/web.md +261 -0
- package/docs/tts.md +396 -0
- package/docs/tui.md +159 -0
- package/docs/vps.md +43 -0
- package/docs/web/control-ui.md +221 -0
- package/docs/web/dashboard.md +46 -0
- package/docs/web/index.md +116 -0
- package/docs/web/webchat.md +49 -0
- package/docs/whatsapp-openclaw-ai-zh.jpg +0 -0
- package/docs/whatsapp-openclaw.jpg +0 -0
- package/docs/zh-CN/AGENTS.md +59 -0
- package/docs/zh-CN/automation/auth-monitoring.md +47 -0
- package/docs/zh-CN/automation/cron-jobs.md +424 -0
- package/docs/zh-CN/automation/cron-vs-heartbeat.md +286 -0
- package/docs/zh-CN/automation/gmail-pubsub.md +249 -0
- package/docs/zh-CN/automation/poll.md +76 -0
- package/docs/zh-CN/automation/webhook.md +163 -0
- package/docs/zh-CN/bedrock.md +170 -0
- package/docs/zh-CN/brave-search.md +48 -0
- package/docs/zh-CN/broadcast-groups.md +449 -0
- package/docs/zh-CN/channels/bluebubbles.md +271 -0
- package/docs/zh-CN/channels/discord.md +468 -0
- package/docs/zh-CN/channels/feishu.md +513 -0
- package/docs/zh-CN/channels/googlechat.md +257 -0
- package/docs/zh-CN/channels/grammy.md +38 -0
- package/docs/zh-CN/channels/imessage.md +302 -0
- package/docs/zh-CN/channels/index.md +53 -0
- package/docs/zh-CN/channels/line.md +180 -0
- package/docs/zh-CN/channels/location.md +63 -0
- package/docs/zh-CN/channels/matrix.md +221 -0
- package/docs/zh-CN/channels/mattermost.md +144 -0
- package/docs/zh-CN/channels/msteams.md +775 -0
- package/docs/zh-CN/channels/nextcloud-talk.md +142 -0
- package/docs/zh-CN/channels/nostr.md +240 -0
- package/docs/zh-CN/channels/signal.md +209 -0
- package/docs/zh-CN/channels/slack.md +531 -0
- package/docs/zh-CN/channels/telegram.md +751 -0
- package/docs/zh-CN/channels/tlon.md +136 -0
- package/docs/zh-CN/channels/troubleshooting.md +36 -0
- package/docs/zh-CN/channels/twitch.md +385 -0
- package/docs/zh-CN/channels/whatsapp.md +411 -0
- package/docs/zh-CN/channels/zalo.md +196 -0
- package/docs/zh-CN/channels/zalouser.md +147 -0
- package/docs/zh-CN/cli/acp.md +173 -0
- package/docs/zh-CN/cli/agent.md +30 -0
- package/docs/zh-CN/cli/agents.md +82 -0
- package/docs/zh-CN/cli/approvals.md +57 -0
- package/docs/zh-CN/cli/browser.md +114 -0
- package/docs/zh-CN/cli/channels.md +86 -0
- package/docs/zh-CN/cli/config.md +57 -0
- package/docs/zh-CN/cli/configure.md +38 -0
- package/docs/zh-CN/cli/cron.md +43 -0
- package/docs/zh-CN/cli/dashboard.md +23 -0
- package/docs/zh-CN/cli/devices.md +74 -0
- package/docs/zh-CN/cli/directory.md +70 -0
- package/docs/zh-CN/cli/dns.md +30 -0
- package/docs/zh-CN/cli/docs.md +22 -0
- package/docs/zh-CN/cli/doctor.md +48 -0
- package/docs/zh-CN/cli/gateway.md +206 -0
- package/docs/zh-CN/cli/health.md +28 -0
- package/docs/zh-CN/cli/hooks.md +311 -0
- package/docs/zh-CN/cli/index.md +1032 -0
- package/docs/zh-CN/cli/logs.md +31 -0
- package/docs/zh-CN/cli/memory.md +52 -0
- package/docs/zh-CN/cli/message.md +246 -0
- package/docs/zh-CN/cli/models.md +85 -0
- package/docs/zh-CN/cli/node.md +115 -0
- package/docs/zh-CN/cli/nodes.md +80 -0
- package/docs/zh-CN/cli/onboard.md +36 -0
- package/docs/zh-CN/cli/pairing.md +28 -0
- package/docs/zh-CN/cli/plugins.md +66 -0
- package/docs/zh-CN/cli/reset.md +24 -0
- package/docs/zh-CN/cli/sandbox.md +158 -0
- package/docs/zh-CN/cli/security.md +33 -0
- package/docs/zh-CN/cli/sessions.md +23 -0
- package/docs/zh-CN/cli/setup.md +36 -0
- package/docs/zh-CN/cli/skills.md +33 -0
- package/docs/zh-CN/cli/status.md +33 -0
- package/docs/zh-CN/cli/system.md +63 -0
- package/docs/zh-CN/cli/tui.md +30 -0
- package/docs/zh-CN/cli/uninstall.md +24 -0
- package/docs/zh-CN/cli/update.md +101 -0
- package/docs/zh-CN/cli/voicecall.md +41 -0
- package/docs/zh-CN/cli/webhooks.md +32 -0
- package/docs/zh-CN/concepts/agent-loop.md +146 -0
- package/docs/zh-CN/concepts/agent-workspace.md +219 -0
- package/docs/zh-CN/concepts/agent.md +115 -0
- package/docs/zh-CN/concepts/architecture.md +123 -0
- package/docs/zh-CN/concepts/channel-routing.md +117 -0
- package/docs/zh-CN/concepts/compaction.md +67 -0
- package/docs/zh-CN/concepts/context.md +168 -0
- package/docs/zh-CN/concepts/group-messages.md +91 -0
- package/docs/zh-CN/concepts/groups.md +379 -0
- package/docs/zh-CN/concepts/markdown-formatting.md +117 -0
- package/docs/zh-CN/concepts/memory.md +412 -0
- package/docs/zh-CN/concepts/messages.md +141 -0
- package/docs/zh-CN/concepts/model-failover.md +145 -0
- package/docs/zh-CN/concepts/model-providers.md +320 -0
- package/docs/zh-CN/concepts/models.md +196 -0
- package/docs/zh-CN/concepts/multi-agent.md +372 -0
- package/docs/zh-CN/concepts/oauth.md +151 -0
- package/docs/zh-CN/concepts/presence.md +99 -0
- package/docs/zh-CN/concepts/queue.md +94 -0
- package/docs/zh-CN/concepts/retry.md +76 -0
- package/docs/zh-CN/concepts/session-pruning.md +129 -0
- package/docs/zh-CN/concepts/session-tool.md +200 -0
- package/docs/zh-CN/concepts/session.md +166 -0
- package/docs/zh-CN/concepts/sessions.md +17 -0
- package/docs/zh-CN/concepts/streaming.md +133 -0
- package/docs/zh-CN/concepts/system-prompt.md +101 -0
- package/docs/zh-CN/concepts/timezone.md +96 -0
- package/docs/zh-CN/concepts/typebox.md +284 -0
- package/docs/zh-CN/concepts/typing-indicators.md +74 -0
- package/docs/zh-CN/concepts/usage-tracking.md +42 -0
- package/docs/zh-CN/date-time.md +129 -0
- package/docs/zh-CN/debug/node-issue.md +90 -0
- package/docs/zh-CN/debugging.md +160 -0
- package/docs/zh-CN/diagnostics/flags.md +98 -0
- package/docs/zh-CN/environment.md +88 -0
- package/docs/zh-CN/experiments/onboarding-config-protocol.md +47 -0
- package/docs/zh-CN/experiments/plans/cron-add-hardening.md +70 -0
- package/docs/zh-CN/experiments/plans/group-policy-hardening.md +45 -0
- package/docs/zh-CN/experiments/plans/openresponses-gateway.md +121 -0
- package/docs/zh-CN/experiments/proposals/model-config.md +42 -0
- package/docs/zh-CN/experiments/research/memory.md +235 -0
- package/docs/zh-CN/gateway/authentication.md +142 -0
- package/docs/zh-CN/gateway/background-process.md +100 -0
- package/docs/zh-CN/gateway/bonjour.md +174 -0
- package/docs/zh-CN/gateway/bridge-protocol.md +86 -0
- package/docs/zh-CN/gateway/cli-backends.md +213 -0
- package/docs/zh-CN/gateway/configuration-examples.md +587 -0
- package/docs/zh-CN/gateway/configuration.md +3332 -0
- package/docs/zh-CN/gateway/discovery.md +123 -0
- package/docs/zh-CN/gateway/doctor.md +238 -0
- package/docs/zh-CN/gateway/gateway-lock.md +41 -0
- package/docs/zh-CN/gateway/health.md +42 -0
- package/docs/zh-CN/gateway/heartbeat.md +274 -0
- package/docs/zh-CN/gateway/index.md +335 -0
- package/docs/zh-CN/gateway/local-models.md +157 -0
- package/docs/zh-CN/gateway/logging.md +114 -0
- package/docs/zh-CN/gateway/multiple-gateways.md +119 -0
- package/docs/zh-CN/gateway/openai-http-api.md +125 -0
- package/docs/zh-CN/gateway/openresponses-http-api.md +317 -0
- package/docs/zh-CN/gateway/pairing.md +99 -0
- package/docs/zh-CN/gateway/protocol.md +220 -0
- package/docs/zh-CN/gateway/remote-gateway-readme.md +164 -0
- package/docs/zh-CN/gateway/remote.md +133 -0
- package/docs/zh-CN/gateway/sandbox-vs-tool-policy-vs-elevated.md +135 -0
- package/docs/zh-CN/gateway/sandboxing.md +188 -0
- package/docs/zh-CN/gateway/security/formal-verification.md +169 -0
- package/docs/zh-CN/gateway/security/index.md +777 -0
- package/docs/zh-CN/gateway/tailscale.md +124 -0
- package/docs/zh-CN/gateway/tools-invoke-http-api.md +92 -0
- package/docs/zh-CN/gateway/troubleshooting.md +771 -0
- package/docs/zh-CN/help/faq.md +2628 -0
- package/docs/zh-CN/help/index.md +28 -0
- package/docs/zh-CN/help/troubleshooting.md +104 -0
- package/docs/zh-CN/hooks/soul-evil.md +72 -0
- package/docs/zh-CN/hooks.md +919 -0
- package/docs/zh-CN/index.md +264 -0
- package/docs/zh-CN/install/ansible.md +215 -0
- package/docs/zh-CN/install/bun.md +65 -0
- package/docs/zh-CN/install/development-channels.md +81 -0
- package/docs/zh-CN/install/docker.md +532 -0
- package/docs/zh-CN/install/index.md +193 -0
- package/docs/zh-CN/install/installer.md +128 -0
- package/docs/zh-CN/install/migrating.md +199 -0
- package/docs/zh-CN/install/nix.md +99 -0
- package/docs/zh-CN/install/node.md +85 -0
- package/docs/zh-CN/install/uninstall.md +135 -0
- package/docs/zh-CN/install/updating.md +233 -0
- package/docs/zh-CN/logging.md +329 -0
- package/docs/zh-CN/multi-agent-sandbox-tools.md +401 -0
- package/docs/zh-CN/network.md +59 -0
- package/docs/zh-CN/nodes/audio.md +120 -0
- package/docs/zh-CN/nodes/camera.md +162 -0
- package/docs/zh-CN/nodes/images.md +79 -0
- package/docs/zh-CN/nodes/index.md +348 -0
- package/docs/zh-CN/nodes/location-command.md +120 -0
- package/docs/zh-CN/nodes/media-understanding.md +380 -0
- package/docs/zh-CN/nodes/talk.md +97 -0
- package/docs/zh-CN/nodes/voicewake.md +72 -0
- package/docs/zh-CN/northflank.mdx +60 -0
- package/docs/zh-CN/perplexity.md +84 -0
- package/docs/zh-CN/pi-dev.md +77 -0
- package/docs/zh-CN/pi.md +619 -0
- package/docs/zh-CN/platforms/android.md +155 -0
- package/docs/zh-CN/platforms/digitalocean.md +269 -0
- package/docs/zh-CN/platforms/exe-dev.md +127 -0
- package/docs/zh-CN/platforms/fly.md +490 -0
- package/docs/zh-CN/platforms/gcp.md +510 -0
- package/docs/zh-CN/platforms/hetzner.md +337 -0
- package/docs/zh-CN/platforms/index.md +60 -0
- package/docs/zh-CN/platforms/ios.md +114 -0
- package/docs/zh-CN/platforms/linux.md +101 -0
- package/docs/zh-CN/platforms/mac/bundled-gateway.md +75 -0
- package/docs/zh-CN/platforms/mac/canvas.md +128 -0
- package/docs/zh-CN/platforms/mac/child-process.md +73 -0
- package/docs/zh-CN/platforms/mac/dev-setup.md +109 -0
- package/docs/zh-CN/platforms/mac/health.md +41 -0
- package/docs/zh-CN/platforms/mac/icon.md +38 -0
- package/docs/zh-CN/platforms/mac/logging.md +64 -0
- package/docs/zh-CN/platforms/mac/menu-bar.md +88 -0
- package/docs/zh-CN/platforms/mac/peekaboo.md +62 -0
- package/docs/zh-CN/platforms/mac/permissions.md +46 -0
- package/docs/zh-CN/platforms/mac/release.md +92 -0
- package/docs/zh-CN/platforms/mac/remote.md +90 -0
- package/docs/zh-CN/platforms/mac/signing.md +54 -0
- package/docs/zh-CN/platforms/mac/skills.md +40 -0
- package/docs/zh-CN/platforms/mac/voice-overlay.md +67 -0
- package/docs/zh-CN/platforms/mac/voicewake.md +74 -0
- package/docs/zh-CN/platforms/mac/webchat.md +43 -0
- package/docs/zh-CN/platforms/mac/xpc.md +68 -0
- package/docs/zh-CN/platforms/macos-vm.md +288 -0
- package/docs/zh-CN/platforms/macos.md +193 -0
- package/docs/zh-CN/platforms/oracle.md +310 -0
- package/docs/zh-CN/platforms/raspberry-pi.md +365 -0
- package/docs/zh-CN/platforms/windows.md +156 -0
- package/docs/zh-CN/plugin.md +639 -0
- package/docs/zh-CN/plugins/agent-tools.md +99 -0
- package/docs/zh-CN/plugins/manifest.md +68 -0
- package/docs/zh-CN/plugins/voice-call.md +250 -0
- package/docs/zh-CN/plugins/zalouser.md +88 -0
- package/docs/zh-CN/prose.md +141 -0
- package/docs/zh-CN/providers/anthropic.md +159 -0
- package/docs/zh-CN/providers/claude-max-api-proxy.md +155 -0
- package/docs/zh-CN/providers/deepgram.md +97 -0
- package/docs/zh-CN/providers/github-copilot.md +67 -0
- package/docs/zh-CN/providers/glm.md +39 -0
- package/docs/zh-CN/providers/index.md +68 -0
- package/docs/zh-CN/providers/minimax.md +206 -0
- package/docs/zh-CN/providers/models.md +55 -0
- package/docs/zh-CN/providers/moonshot.md +145 -0
- package/docs/zh-CN/providers/ollama.md +230 -0
- package/docs/zh-CN/providers/openai.md +68 -0
- package/docs/zh-CN/providers/opencode.md +41 -0
- package/docs/zh-CN/providers/openrouter.md +43 -0
- package/docs/zh-CN/providers/qwen.md +55 -0
- package/docs/zh-CN/providers/synthetic.md +102 -0
- package/docs/zh-CN/providers/venice.md +274 -0
- package/docs/zh-CN/providers/vercel-ai-gateway.md +57 -0
- package/docs/zh-CN/providers/xiaomi.md +68 -0
- package/docs/zh-CN/providers/zai.md +41 -0
- package/docs/zh-CN/railway.mdx +106 -0
- package/docs/zh-CN/refactor/clawnet.md +424 -0
- package/docs/zh-CN/refactor/exec-host.md +323 -0
- package/docs/zh-CN/refactor/outbound-session-mirroring.md +92 -0
- package/docs/zh-CN/refactor/plugin-sdk.md +221 -0
- package/docs/zh-CN/refactor/strict-config.md +100 -0
- package/docs/zh-CN/reference/AGENTS.default.md +131 -0
- package/docs/zh-CN/reference/RELEASING.md +123 -0
- package/docs/zh-CN/reference/api-usage-costs.md +136 -0
- package/docs/zh-CN/reference/device-models.md +54 -0
- package/docs/zh-CN/reference/rpc.md +48 -0
- package/docs/zh-CN/reference/session-management-compaction.md +287 -0
- package/docs/zh-CN/reference/templates/AGENTS.dev.md +89 -0
- package/docs/zh-CN/reference/templates/AGENTS.md +225 -0
- package/docs/zh-CN/reference/templates/BOOT.md +17 -0
- package/docs/zh-CN/reference/templates/BOOTSTRAP.md +68 -0
- package/docs/zh-CN/reference/templates/HEARTBEAT.md +18 -0
- package/docs/zh-CN/reference/templates/IDENTITY.dev.md +54 -0
- package/docs/zh-CN/reference/templates/IDENTITY.md +35 -0
- package/docs/zh-CN/reference/templates/SOUL.dev.md +83 -0
- package/docs/zh-CN/reference/templates/SOUL.md +49 -0
- package/docs/zh-CN/reference/templates/TOOLS.dev.md +31 -0
- package/docs/zh-CN/reference/templates/TOOLS.md +53 -0
- package/docs/zh-CN/reference/templates/USER.dev.md +25 -0
- package/docs/zh-CN/reference/templates/USER.md +30 -0
- package/docs/zh-CN/reference/test.md +57 -0
- package/docs/zh-CN/reference/transcript-hygiene.md +109 -0
- package/docs/zh-CN/render.mdx +169 -0
- package/docs/zh-CN/scripts.md +35 -0
- package/docs/zh-CN/security/formal-verification.md +171 -0
- package/docs/zh-CN/start/getting-started.md +206 -0
- package/docs/zh-CN/start/hubs.md +191 -0
- package/docs/zh-CN/start/lore.md +226 -0
- package/docs/zh-CN/start/onboarding.md +105 -0
- package/docs/zh-CN/start/openclaw.md +248 -0
- package/docs/zh-CN/start/pairing.md +89 -0
- package/docs/zh-CN/start/setup.md +153 -0
- package/docs/zh-CN/start/showcase.md +423 -0
- package/docs/zh-CN/start/wizard.md +331 -0
- package/docs/zh-CN/testing.md +375 -0
- package/docs/zh-CN/token-use.md +119 -0
- package/docs/zh-CN/tools/agent-send.md +59 -0
- package/docs/zh-CN/tools/apply-patch.md +57 -0
- package/docs/zh-CN/tools/browser-linux-troubleshooting.md +144 -0
- package/docs/zh-CN/tools/browser-login.md +75 -0
- package/docs/zh-CN/tools/browser.md +553 -0
- package/docs/zh-CN/tools/chrome-extension.md +183 -0
- package/docs/zh-CN/tools/clawhub.md +209 -0
- package/docs/zh-CN/tools/creating-skills.md +61 -0
- package/docs/zh-CN/tools/elevated.md +64 -0
- package/docs/zh-CN/tools/exec-approvals.md +234 -0
- package/docs/zh-CN/tools/exec.md +169 -0
- package/docs/zh-CN/tools/firecrawl.md +68 -0
- package/docs/zh-CN/tools/index.md +515 -0
- package/docs/zh-CN/tools/llm-task.md +117 -0
- package/docs/zh-CN/tools/lobster.md +349 -0
- package/docs/zh-CN/tools/reactions.md +29 -0
- package/docs/zh-CN/tools/skills-config.md +78 -0
- package/docs/zh-CN/tools/skills.md +279 -0
- package/docs/zh-CN/tools/slash-commands.md +205 -0
- package/docs/zh-CN/tools/subagents.md +156 -0
- package/docs/zh-CN/tools/thinking.md +80 -0
- package/docs/zh-CN/tools/web.md +257 -0
- package/docs/zh-CN/tts.md +375 -0
- package/docs/zh-CN/tui.md +166 -0
- package/docs/zh-CN/vps.md +47 -0
- package/docs/zh-CN/web/control-ui.md +191 -0
- package/docs/zh-CN/web/dashboard.md +53 -0
- package/docs/zh-CN/web/index.md +118 -0
- package/docs/zh-CN/web/webchat.md +56 -0
- package/extensions/bluebubbles/README.md +45 -0
- package/extensions/bluebubbles/index.ts +19 -0
- package/extensions/bluebubbles/node_modules/.bin/openclaw +21 -0
- package/extensions/bluebubbles/openclaw.plugin.json +9 -0
- package/extensions/bluebubbles/package.json +36 -0
- package/extensions/bluebubbles/src/accounts.ts +88 -0
- package/extensions/bluebubbles/src/actions.test.ts +650 -0
- package/extensions/bluebubbles/src/actions.ts +438 -0
- package/extensions/bluebubbles/src/attachments.test.ts +345 -0
- package/extensions/bluebubbles/src/attachments.ts +300 -0
- package/extensions/bluebubbles/src/channel.ts +414 -0
- package/extensions/bluebubbles/src/chat.test.ts +461 -0
- package/extensions/bluebubbles/src/chat.ts +378 -0
- package/extensions/bluebubbles/src/config-schema.ts +51 -0
- package/extensions/bluebubbles/src/media-send.ts +174 -0
- package/extensions/bluebubbles/src/monitor.test.ts +2342 -0
- package/extensions/bluebubbles/src/monitor.ts +2490 -0
- package/extensions/bluebubbles/src/onboarding.ts +352 -0
- package/extensions/bluebubbles/src/probe.ts +135 -0
- package/extensions/bluebubbles/src/reactions.test.ts +392 -0
- package/extensions/bluebubbles/src/reactions.ts +188 -0
- package/extensions/bluebubbles/src/runtime.ts +14 -0
- package/extensions/bluebubbles/src/send.test.ts +808 -0
- package/extensions/bluebubbles/src/send.ts +467 -0
- package/extensions/bluebubbles/src/targets.test.ts +183 -0
- package/extensions/bluebubbles/src/targets.ts +422 -0
- package/extensions/bluebubbles/src/types.ts +127 -0
- package/extensions/copilot-proxy/README.md +24 -0
- package/extensions/copilot-proxy/index.ts +148 -0
- package/extensions/copilot-proxy/node_modules/.bin/openclaw +21 -0
- package/extensions/copilot-proxy/openclaw.plugin.json +9 -0
- package/extensions/copilot-proxy/package.json +14 -0
- package/extensions/diagnostics-otel/index.ts +15 -0
- package/extensions/diagnostics-otel/node_modules/.bin/openclaw +21 -0
- package/extensions/diagnostics-otel/openclaw.plugin.json +8 -0
- package/extensions/diagnostics-otel/package.json +27 -0
- package/extensions/diagnostics-otel/src/service.test.ts +226 -0
- package/extensions/diagnostics-otel/src/service.ts +635 -0
- package/extensions/discord/index.ts +17 -0
- package/extensions/discord/node_modules/.bin/openclaw +21 -0
- package/extensions/discord/openclaw.plugin.json +9 -0
- package/extensions/discord/package.json +14 -0
- package/extensions/discord/src/channel.ts +422 -0
- package/extensions/discord/src/runtime.ts +14 -0
- package/extensions/feishu/README.md +47 -0
- package/extensions/feishu/index.ts +15 -0
- package/extensions/feishu/node_modules/.bin/openclaw +21 -0
- package/extensions/feishu/openclaw.plugin.json +9 -0
- package/extensions/feishu/package.json +33 -0
- package/extensions/feishu/src/channel.ts +276 -0
- package/extensions/feishu/src/config-schema.ts +46 -0
- package/extensions/feishu/src/onboarding.ts +278 -0
- package/extensions/google-antigravity-auth/README.md +24 -0
- package/extensions/google-antigravity-auth/index.ts +461 -0
- package/extensions/google-antigravity-auth/node_modules/.bin/openclaw +21 -0
- package/extensions/google-antigravity-auth/openclaw.plugin.json +9 -0
- package/extensions/google-antigravity-auth/package.json +14 -0
- package/extensions/google-gemini-cli-auth/README.md +35 -0
- package/extensions/google-gemini-cli-auth/index.ts +88 -0
- package/extensions/google-gemini-cli-auth/node_modules/.bin/openclaw +21 -0
- package/extensions/google-gemini-cli-auth/oauth.test.ts +240 -0
- package/extensions/google-gemini-cli-auth/oauth.ts +662 -0
- package/extensions/google-gemini-cli-auth/openclaw.plugin.json +9 -0
- package/extensions/google-gemini-cli-auth/package.json +14 -0
- package/extensions/googlechat/index.ts +19 -0
- package/extensions/googlechat/node_modules/.bin/openclaw +21 -0
- package/extensions/googlechat/openclaw.plugin.json +9 -0
- package/extensions/googlechat/package.json +39 -0
- package/extensions/googlechat/src/accounts.ts +147 -0
- package/extensions/googlechat/src/actions.ts +181 -0
- package/extensions/googlechat/src/api.test.ts +61 -0
- package/extensions/googlechat/src/api.ts +282 -0
- package/extensions/googlechat/src/auth.ts +123 -0
- package/extensions/googlechat/src/channel.ts +583 -0
- package/extensions/googlechat/src/monitor.test.ts +22 -0
- package/extensions/googlechat/src/monitor.ts +949 -0
- package/extensions/googlechat/src/onboarding.ts +269 -0
- package/extensions/googlechat/src/runtime.ts +14 -0
- package/extensions/googlechat/src/targets.test.ts +32 -0
- package/extensions/googlechat/src/targets.ts +65 -0
- package/extensions/googlechat/src/types.config.ts +3 -0
- package/extensions/googlechat/src/types.ts +73 -0
- package/extensions/imessage/index.ts +17 -0
- package/extensions/imessage/node_modules/.bin/openclaw +21 -0
- package/extensions/imessage/openclaw.plugin.json +9 -0
- package/extensions/imessage/package.json +14 -0
- package/extensions/imessage/src/channel.ts +294 -0
- package/extensions/imessage/src/runtime.ts +14 -0
- package/extensions/line/index.ts +19 -0
- package/extensions/line/node_modules/.bin/openclaw +21 -0
- package/extensions/line/openclaw.plugin.json +9 -0
- package/extensions/line/package.json +29 -0
- package/extensions/line/src/card-command.ts +344 -0
- package/extensions/line/src/channel.logout.test.ts +99 -0
- package/extensions/line/src/channel.sendPayload.test.ts +306 -0
- package/extensions/line/src/channel.ts +780 -0
- package/extensions/line/src/runtime.ts +14 -0
- package/extensions/llm-task/README.md +97 -0
- package/extensions/llm-task/index.ts +6 -0
- package/extensions/llm-task/node_modules/.bin/openclaw +21 -0
- package/extensions/llm-task/openclaw.plugin.json +21 -0
- package/extensions/llm-task/package.json +14 -0
- package/extensions/llm-task/src/llm-task-tool.test.ts +138 -0
- package/extensions/llm-task/src/llm-task-tool.ts +245 -0
- package/extensions/lobster/README.md +75 -0
- package/extensions/lobster/SKILL.md +97 -0
- package/extensions/lobster/index.ts +14 -0
- package/extensions/lobster/node_modules/.bin/openclaw +21 -0
- package/extensions/lobster/openclaw.plugin.json +10 -0
- package/extensions/lobster/package.json +14 -0
- package/extensions/lobster/src/lobster-tool.test.ts +247 -0
- package/extensions/lobster/src/lobster-tool.ts +328 -0
- package/extensions/matrix/CHANGELOG.md +87 -0
- package/extensions/matrix/index.ts +17 -0
- package/extensions/matrix/node_modules/.bin/markdown-it +21 -0
- package/extensions/matrix/node_modules/.bin/openclaw +21 -0
- package/extensions/matrix/openclaw.plugin.json +9 -0
- package/extensions/matrix/package.json +36 -0
- package/extensions/matrix/src/actions.ts +195 -0
- package/extensions/matrix/src/channel.directory.test.ts +64 -0
- package/extensions/matrix/src/channel.ts +439 -0
- package/extensions/matrix/src/config-schema.ts +62 -0
- package/extensions/matrix/src/directory-live.ts +188 -0
- package/extensions/matrix/src/group-mentions.ts +66 -0
- package/extensions/matrix/src/matrix/accounts.test.ts +82 -0
- package/extensions/matrix/src/matrix/accounts.ts +65 -0
- package/extensions/matrix/src/matrix/actions/client.ts +57 -0
- package/extensions/matrix/src/matrix/actions/messages.ts +128 -0
- package/extensions/matrix/src/matrix/actions/pins.ts +76 -0
- package/extensions/matrix/src/matrix/actions/reactions.ts +96 -0
- package/extensions/matrix/src/matrix/actions/room.ts +85 -0
- package/extensions/matrix/src/matrix/actions/summary.ts +75 -0
- package/extensions/matrix/src/matrix/actions/types.ts +84 -0
- package/extensions/matrix/src/matrix/actions.ts +15 -0
- package/extensions/matrix/src/matrix/active-client.ts +11 -0
- package/extensions/matrix/src/matrix/client/config.ts +160 -0
- package/extensions/matrix/src/matrix/client/create-client.ts +123 -0
- package/extensions/matrix/src/matrix/client/logging.ts +36 -0
- package/extensions/matrix/src/matrix/client/runtime.ts +4 -0
- package/extensions/matrix/src/matrix/client/shared.ts +170 -0
- package/extensions/matrix/src/matrix/client/storage.ts +131 -0
- package/extensions/matrix/src/matrix/client/types.ts +34 -0
- package/extensions/matrix/src/matrix/client.test.ts +56 -0
- package/extensions/matrix/src/matrix/client.ts +5 -0
- package/extensions/matrix/src/matrix/credentials.ts +105 -0
- package/extensions/matrix/src/matrix/deps.ts +60 -0
- package/extensions/matrix/src/matrix/format.test.ts +33 -0
- package/extensions/matrix/src/matrix/format.ts +22 -0
- package/extensions/matrix/src/matrix/index.ts +11 -0
- package/extensions/matrix/src/matrix/monitor/allowlist.test.ts +45 -0
- package/extensions/matrix/src/matrix/monitor/allowlist.ts +103 -0
- package/extensions/matrix/src/matrix/monitor/auto-join.ts +71 -0
- package/extensions/matrix/src/matrix/monitor/direct.ts +104 -0
- package/extensions/matrix/src/matrix/monitor/events.ts +101 -0
- package/extensions/matrix/src/matrix/monitor/handler.ts +661 -0
- package/extensions/matrix/src/matrix/monitor/index.ts +338 -0
- package/extensions/matrix/src/matrix/monitor/location.ts +100 -0
- package/extensions/matrix/src/matrix/monitor/media.test.ts +102 -0
- package/extensions/matrix/src/matrix/monitor/media.ts +113 -0
- package/extensions/matrix/src/matrix/monitor/mentions.ts +31 -0
- package/extensions/matrix/src/matrix/monitor/replies.ts +97 -0
- package/extensions/matrix/src/matrix/monitor/room-info.ts +55 -0
- package/extensions/matrix/src/matrix/monitor/rooms.test.ts +39 -0
- package/extensions/matrix/src/matrix/monitor/rooms.ts +47 -0
- package/extensions/matrix/src/matrix/monitor/threads.ts +68 -0
- package/extensions/matrix/src/matrix/monitor/types.ts +39 -0
- package/extensions/matrix/src/matrix/poll-types.test.ts +21 -0
- package/extensions/matrix/src/matrix/poll-types.ts +166 -0
- package/extensions/matrix/src/matrix/probe.ts +70 -0
- package/extensions/matrix/src/matrix/send/client.ts +66 -0
- package/extensions/matrix/src/matrix/send/formatting.ts +89 -0
- package/extensions/matrix/src/matrix/send/media.ts +229 -0
- package/extensions/matrix/src/matrix/send/targets.test.ts +98 -0
- package/extensions/matrix/src/matrix/send/targets.ts +136 -0
- package/extensions/matrix/src/matrix/send/types.ts +109 -0
- package/extensions/matrix/src/matrix/send.test.ts +171 -0
- package/extensions/matrix/src/matrix/send.ts +260 -0
- package/extensions/matrix/src/onboarding.ts +449 -0
- package/extensions/matrix/src/outbound.ts +52 -0
- package/extensions/matrix/src/resolve-targets.test.ts +48 -0
- package/extensions/matrix/src/resolve-targets.ts +135 -0
- package/extensions/matrix/src/runtime.ts +14 -0
- package/extensions/matrix/src/tool-actions.ts +164 -0
- package/extensions/matrix/src/types.ts +95 -0
- package/extensions/mattermost/index.ts +17 -0
- package/extensions/mattermost/node_modules/.bin/openclaw +21 -0
- package/extensions/mattermost/openclaw.plugin.json +9 -0
- package/extensions/mattermost/package.json +28 -0
- package/extensions/mattermost/src/channel.test.ts +48 -0
- package/extensions/mattermost/src/channel.ts +337 -0
- package/extensions/mattermost/src/config-schema.ts +55 -0
- package/extensions/mattermost/src/group-mentions.ts +15 -0
- package/extensions/mattermost/src/mattermost/accounts.ts +128 -0
- package/extensions/mattermost/src/mattermost/client.ts +220 -0
- package/extensions/mattermost/src/mattermost/index.ts +9 -0
- package/extensions/mattermost/src/mattermost/monitor-helpers.ts +166 -0
- package/extensions/mattermost/src/mattermost/monitor.ts +987 -0
- package/extensions/mattermost/src/mattermost/probe.ts +74 -0
- package/extensions/mattermost/src/mattermost/send.ts +231 -0
- package/extensions/mattermost/src/normalize.ts +46 -0
- package/extensions/mattermost/src/onboarding-helpers.ts +44 -0
- package/extensions/mattermost/src/onboarding.ts +186 -0
- package/extensions/mattermost/src/runtime.ts +14 -0
- package/extensions/mattermost/src/types.ts +50 -0
- package/extensions/memory-core/index.ts +38 -0
- package/extensions/memory-core/node_modules/.bin/openclaw +21 -0
- package/extensions/memory-core/openclaw.plugin.json +9 -0
- package/extensions/memory-core/package.json +17 -0
- package/extensions/memory-lancedb/config.ts +139 -0
- package/extensions/memory-lancedb/index.test.ts +295 -0
- package/extensions/memory-lancedb/index.ts +608 -0
- package/extensions/memory-lancedb/node_modules/.bin/openai +21 -0
- package/extensions/memory-lancedb/node_modules/.bin/openclaw +21 -0
- package/extensions/memory-lancedb/openclaw.plugin.json +60 -0
- package/extensions/memory-lancedb/package.json +19 -0
- package/extensions/minimax-portal-auth/README.md +33 -0
- package/extensions/minimax-portal-auth/index.ts +155 -0
- package/extensions/minimax-portal-auth/node_modules/.bin/openclaw +21 -0
- package/extensions/minimax-portal-auth/oauth.ts +247 -0
- package/extensions/minimax-portal-auth/openclaw.plugin.json +9 -0
- package/extensions/minimax-portal-auth/package.json +14 -0
- package/extensions/msteams/CHANGELOG.md +83 -0
- package/extensions/msteams/index.ts +17 -0
- package/extensions/msteams/node_modules/.bin/openclaw +21 -0
- package/extensions/msteams/openclaw.plugin.json +9 -0
- package/extensions/msteams/package.json +39 -0
- package/extensions/msteams/src/attachments/download.ts +283 -0
- package/extensions/msteams/src/attachments/graph.ts +353 -0
- package/extensions/msteams/src/attachments/html.ts +90 -0
- package/extensions/msteams/src/attachments/payload.ts +22 -0
- package/extensions/msteams/src/attachments/shared.ts +291 -0
- package/extensions/msteams/src/attachments/types.ts +37 -0
- package/extensions/msteams/src/attachments.test.ts +459 -0
- package/extensions/msteams/src/attachments.ts +18 -0
- package/extensions/msteams/src/channel.directory.test.ts +48 -0
- package/extensions/msteams/src/channel.ts +459 -0
- package/extensions/msteams/src/conversation-store-fs.test.ts +88 -0
- package/extensions/msteams/src/conversation-store-fs.ts +165 -0
- package/extensions/msteams/src/conversation-store-memory.ts +47 -0
- package/extensions/msteams/src/conversation-store.ts +41 -0
- package/extensions/msteams/src/directory-live.ts +205 -0
- package/extensions/msteams/src/errors.test.ts +45 -0
- package/extensions/msteams/src/errors.ts +190 -0
- package/extensions/msteams/src/file-consent-helpers.test.ts +243 -0
- package/extensions/msteams/src/file-consent-helpers.ts +73 -0
- package/extensions/msteams/src/file-consent.ts +126 -0
- package/extensions/msteams/src/graph-chat.ts +53 -0
- package/extensions/msteams/src/graph-upload.ts +453 -0
- package/extensions/msteams/src/inbound.test.ts +66 -0
- package/extensions/msteams/src/inbound.ts +48 -0
- package/extensions/msteams/src/index.ts +4 -0
- package/extensions/msteams/src/media-helpers.test.ts +189 -0
- package/extensions/msteams/src/media-helpers.ts +86 -0
- package/extensions/msteams/src/messenger.test.ts +248 -0
- package/extensions/msteams/src/messenger.ts +495 -0
- package/extensions/msteams/src/monitor-handler/inbound-media.ts +128 -0
- package/extensions/msteams/src/monitor-handler/message-handler.ts +640 -0
- package/extensions/msteams/src/monitor-handler.ts +162 -0
- package/extensions/msteams/src/monitor-types.ts +5 -0
- package/extensions/msteams/src/monitor.ts +295 -0
- package/extensions/msteams/src/onboarding.ts +431 -0
- package/extensions/msteams/src/outbound.ts +46 -0
- package/extensions/msteams/src/pending-uploads.ts +89 -0
- package/extensions/msteams/src/policy.test.ts +209 -0
- package/extensions/msteams/src/policy.ts +273 -0
- package/extensions/msteams/src/polls-store-memory.ts +32 -0
- package/extensions/msteams/src/polls-store.test.ts +38 -0
- package/extensions/msteams/src/polls.test.ts +72 -0
- package/extensions/msteams/src/polls.ts +315 -0
- package/extensions/msteams/src/probe.test.ts +58 -0
- package/extensions/msteams/src/probe.ts +107 -0
- package/extensions/msteams/src/reply-dispatcher.ts +130 -0
- package/extensions/msteams/src/resolve-allowlist.ts +297 -0
- package/extensions/msteams/src/runtime.ts +14 -0
- package/extensions/msteams/src/sdk-types.ts +19 -0
- package/extensions/msteams/src/sdk.ts +33 -0
- package/extensions/msteams/src/send-context.ts +164 -0
- package/extensions/msteams/src/send.ts +519 -0
- package/extensions/msteams/src/sent-message-cache.test.ts +15 -0
- package/extensions/msteams/src/sent-message-cache.ts +47 -0
- package/extensions/msteams/src/storage.ts +25 -0
- package/extensions/msteams/src/store-fs.ts +83 -0
- package/extensions/msteams/src/token.ts +19 -0
- package/extensions/nextcloud-talk/index.ts +17 -0
- package/extensions/nextcloud-talk/node_modules/.bin/openclaw +21 -0
- package/extensions/nextcloud-talk/openclaw.plugin.json +9 -0
- package/extensions/nextcloud-talk/package.json +33 -0
- package/extensions/nextcloud-talk/src/accounts.ts +174 -0
- package/extensions/nextcloud-talk/src/channel.ts +409 -0
- package/extensions/nextcloud-talk/src/config-schema.ts +78 -0
- package/extensions/nextcloud-talk/src/format.ts +79 -0
- package/extensions/nextcloud-talk/src/inbound.ts +317 -0
- package/extensions/nextcloud-talk/src/monitor.ts +246 -0
- package/extensions/nextcloud-talk/src/normalize.ts +39 -0
- package/extensions/nextcloud-talk/src/onboarding.ts +343 -0
- package/extensions/nextcloud-talk/src/policy.test.ts +33 -0
- package/extensions/nextcloud-talk/src/policy.ts +180 -0
- package/extensions/nextcloud-talk/src/room-info.ts +125 -0
- package/extensions/nextcloud-talk/src/runtime.ts +14 -0
- package/extensions/nextcloud-talk/src/send.ts +210 -0
- package/extensions/nextcloud-talk/src/signature.ts +72 -0
- package/extensions/nextcloud-talk/src/types.ts +179 -0
- package/extensions/nostr/CHANGELOG.md +74 -0
- package/extensions/nostr/README.md +136 -0
- package/extensions/nostr/index.ts +68 -0
- package/extensions/nostr/node_modules/.bin/openclaw +21 -0
- package/extensions/nostr/openclaw.plugin.json +9 -0
- package/extensions/nostr/package.json +34 -0
- package/extensions/nostr/src/channel.test.ts +151 -0
- package/extensions/nostr/src/channel.ts +353 -0
- package/extensions/nostr/src/config-schema.ts +90 -0
- package/extensions/nostr/src/metrics.ts +478 -0
- package/extensions/nostr/src/nostr-bus.fuzz.test.ts +533 -0
- package/extensions/nostr/src/nostr-bus.integration.test.ts +448 -0
- package/extensions/nostr/src/nostr-bus.test.ts +199 -0
- package/extensions/nostr/src/nostr-bus.ts +715 -0
- package/extensions/nostr/src/nostr-profile-http.test.ts +378 -0
- package/extensions/nostr/src/nostr-profile-http.ts +519 -0
- package/extensions/nostr/src/nostr-profile-import.test.ts +119 -0
- package/extensions/nostr/src/nostr-profile-import.ts +262 -0
- package/extensions/nostr/src/nostr-profile.fuzz.test.ts +477 -0
- package/extensions/nostr/src/nostr-profile.test.ts +410 -0
- package/extensions/nostr/src/nostr-profile.ts +277 -0
- package/extensions/nostr/src/nostr-state-store.test.ts +131 -0
- package/extensions/nostr/src/nostr-state-store.ts +226 -0
- package/extensions/nostr/src/runtime.ts +14 -0
- package/extensions/nostr/src/seen-tracker.ts +303 -0
- package/extensions/nostr/src/types.test.ts +157 -0
- package/extensions/nostr/src/types.ts +101 -0
- package/extensions/nostr/test/setup.ts +5 -0
- package/extensions/open-prose/README.md +25 -0
- package/extensions/open-prose/index.ts +5 -0
- package/extensions/open-prose/node_modules/.bin/openclaw +21 -0
- package/extensions/open-prose/openclaw.plugin.json +11 -0
- package/extensions/open-prose/package.json +14 -0
- package/extensions/open-prose/skills/prose/LICENSE +21 -0
- package/extensions/open-prose/skills/prose/SKILL.md +323 -0
- package/extensions/open-prose/skills/prose/alt-borges.md +141 -0
- package/extensions/open-prose/skills/prose/alts/arabian-nights.md +358 -0
- package/extensions/open-prose/skills/prose/alts/borges.md +360 -0
- package/extensions/open-prose/skills/prose/alts/folk.md +322 -0
- package/extensions/open-prose/skills/prose/alts/homer.md +346 -0
- package/extensions/open-prose/skills/prose/alts/kafka.md +373 -0
- package/extensions/open-prose/skills/prose/compiler.md +2971 -0
- package/extensions/open-prose/skills/prose/examples/01-hello-world.prose +4 -0
- package/extensions/open-prose/skills/prose/examples/02-research-and-summarize.prose +6 -0
- package/extensions/open-prose/skills/prose/examples/03-code-review.prose +17 -0
- package/extensions/open-prose/skills/prose/examples/04-write-and-refine.prose +14 -0
- package/extensions/open-prose/skills/prose/examples/05-debug-issue.prose +20 -0
- package/extensions/open-prose/skills/prose/examples/06-explain-codebase.prose +17 -0
- package/extensions/open-prose/skills/prose/examples/07-refactor.prose +20 -0
- package/extensions/open-prose/skills/prose/examples/08-blog-post.prose +20 -0
- package/extensions/open-prose/skills/prose/examples/09-research-with-agents.prose +25 -0
- package/extensions/open-prose/skills/prose/examples/10-code-review-agents.prose +32 -0
- package/extensions/open-prose/skills/prose/examples/11-skills-and-imports.prose +27 -0
- package/extensions/open-prose/skills/prose/examples/12-secure-agent-permissions.prose +43 -0
- package/extensions/open-prose/skills/prose/examples/13-variables-and-context.prose +51 -0
- package/extensions/open-prose/skills/prose/examples/14-composition-blocks.prose +48 -0
- package/extensions/open-prose/skills/prose/examples/15-inline-sequences.prose +23 -0
- package/extensions/open-prose/skills/prose/examples/16-parallel-reviews.prose +19 -0
- package/extensions/open-prose/skills/prose/examples/17-parallel-research.prose +19 -0
- package/extensions/open-prose/skills/prose/examples/18-mixed-parallel-sequential.prose +36 -0
- package/extensions/open-prose/skills/prose/examples/19-advanced-parallel.prose +71 -0
- package/extensions/open-prose/skills/prose/examples/20-fixed-loops.prose +20 -0
- package/extensions/open-prose/skills/prose/examples/21-pipeline-operations.prose +35 -0
- package/extensions/open-prose/skills/prose/examples/22-error-handling.prose +51 -0
- package/extensions/open-prose/skills/prose/examples/23-retry-with-backoff.prose +63 -0
- package/extensions/open-prose/skills/prose/examples/24-choice-blocks.prose +86 -0
- package/extensions/open-prose/skills/prose/examples/25-conditionals.prose +114 -0
- package/extensions/open-prose/skills/prose/examples/26-parameterized-blocks.prose +100 -0
- package/extensions/open-prose/skills/prose/examples/27-string-interpolation.prose +105 -0
- package/extensions/open-prose/skills/prose/examples/28-automated-pr-review.prose +37 -0
- package/extensions/open-prose/skills/prose/examples/28-gas-town.prose +1572 -0
- package/extensions/open-prose/skills/prose/examples/29-captains-chair.prose +218 -0
- package/extensions/open-prose/skills/prose/examples/30-captains-chair-simple.prose +42 -0
- package/extensions/open-prose/skills/prose/examples/31-captains-chair-with-memory.prose +145 -0
- package/extensions/open-prose/skills/prose/examples/33-pr-review-autofix.prose +168 -0
- package/extensions/open-prose/skills/prose/examples/34-content-pipeline.prose +204 -0
- package/extensions/open-prose/skills/prose/examples/35-feature-factory.prose +296 -0
- package/extensions/open-prose/skills/prose/examples/36-bug-hunter.prose +237 -0
- package/extensions/open-prose/skills/prose/examples/37-the-forge.prose +1474 -0
- package/extensions/open-prose/skills/prose/examples/38-skill-scan.prose +455 -0
- package/extensions/open-prose/skills/prose/examples/39-architect-by-simulation.prose +277 -0
- package/extensions/open-prose/skills/prose/examples/40-rlm-self-refine.prose +32 -0
- package/extensions/open-prose/skills/prose/examples/41-rlm-divide-conquer.prose +38 -0
- package/extensions/open-prose/skills/prose/examples/42-rlm-filter-recurse.prose +46 -0
- package/extensions/open-prose/skills/prose/examples/43-rlm-pairwise.prose +50 -0
- package/extensions/open-prose/skills/prose/examples/44-run-endpoint-ux-test.prose +261 -0
- package/extensions/open-prose/skills/prose/examples/45-plugin-release.prose +159 -0
- package/extensions/open-prose/skills/prose/examples/45-run-endpoint-ux-test-with-remediation.prose +637 -0
- package/extensions/open-prose/skills/prose/examples/46-run-endpoint-ux-test-fast.prose +148 -0
- package/extensions/open-prose/skills/prose/examples/46-workflow-crystallizer.prose +225 -0
- package/extensions/open-prose/skills/prose/examples/47-language-self-improvement.prose +356 -0
- package/extensions/open-prose/skills/prose/examples/48-habit-miner.prose +445 -0
- package/extensions/open-prose/skills/prose/examples/49-prose-run-retrospective.prose +210 -0
- package/extensions/open-prose/skills/prose/examples/README.md +391 -0
- package/extensions/open-prose/skills/prose/examples/roadmap/README.md +22 -0
- package/extensions/open-prose/skills/prose/examples/roadmap/iterative-refinement.prose +20 -0
- package/extensions/open-prose/skills/prose/examples/roadmap/parallel-review.prose +18 -0
- package/extensions/open-prose/skills/prose/examples/roadmap/simple-pipeline.prose +17 -0
- package/extensions/open-prose/skills/prose/examples/roadmap/syntax/open-prose-syntax.prose +223 -0
- package/extensions/open-prose/skills/prose/guidance/antipatterns.md +951 -0
- package/extensions/open-prose/skills/prose/guidance/patterns.md +700 -0
- package/extensions/open-prose/skills/prose/guidance/system-prompt.md +180 -0
- package/extensions/open-prose/skills/prose/help.md +144 -0
- package/extensions/open-prose/skills/prose/lib/README.md +108 -0
- package/extensions/open-prose/skills/prose/lib/calibrator.prose +215 -0
- package/extensions/open-prose/skills/prose/lib/cost-analyzer.prose +174 -0
- package/extensions/open-prose/skills/prose/lib/error-forensics.prose +250 -0
- package/extensions/open-prose/skills/prose/lib/inspector.prose +196 -0
- package/extensions/open-prose/skills/prose/lib/profiler.prose +460 -0
- package/extensions/open-prose/skills/prose/lib/program-improver.prose +275 -0
- package/extensions/open-prose/skills/prose/lib/project-memory.prose +118 -0
- package/extensions/open-prose/skills/prose/lib/user-memory.prose +93 -0
- package/extensions/open-prose/skills/prose/lib/vm-improver.prose +243 -0
- package/extensions/open-prose/skills/prose/primitives/session.md +593 -0
- package/extensions/open-prose/skills/prose/prose.md +1237 -0
- package/extensions/open-prose/skills/prose/state/filesystem.md +498 -0
- package/extensions/open-prose/skills/prose/state/in-context.md +384 -0
- package/extensions/open-prose/skills/prose/state/postgres.md +880 -0
- package/extensions/open-prose/skills/prose/state/sqlite.md +574 -0
- package/extensions/qwen-portal-auth/README.md +24 -0
- package/extensions/qwen-portal-auth/index.ts +130 -0
- package/extensions/qwen-portal-auth/oauth.ts +190 -0
- package/extensions/qwen-portal-auth/openclaw.plugin.json +9 -0
- package/extensions/signal/index.ts +17 -0
- package/extensions/signal/node_modules/.bin/openclaw +21 -0
- package/extensions/signal/openclaw.plugin.json +9 -0
- package/extensions/signal/package.json +14 -0
- package/extensions/signal/src/channel.ts +315 -0
- package/extensions/signal/src/runtime.ts +14 -0
- package/extensions/slack/index.ts +17 -0
- package/extensions/slack/node_modules/.bin/openclaw +21 -0
- package/extensions/slack/openclaw.plugin.json +9 -0
- package/extensions/slack/package.json +14 -0
- package/extensions/slack/src/channel.ts +604 -0
- package/extensions/slack/src/runtime.ts +14 -0
- package/extensions/telegram/index.ts +17 -0
- package/extensions/telegram/node_modules/.bin/openclaw +21 -0
- package/extensions/telegram/openclaw.plugin.json +9 -0
- package/extensions/telegram/package.json +14 -0
- package/extensions/telegram/src/channel.ts +482 -0
- package/extensions/telegram/src/runtime.ts +14 -0
- package/extensions/tlon/README.md +5 -0
- package/extensions/tlon/index.ts +17 -0
- package/extensions/tlon/node_modules/.bin/openclaw +21 -0
- package/extensions/tlon/openclaw.plugin.json +9 -0
- package/extensions/tlon/package.json +33 -0
- package/extensions/tlon/src/channel.ts +392 -0
- package/extensions/tlon/src/config-schema.test.ts +31 -0
- package/extensions/tlon/src/config-schema.ts +43 -0
- package/extensions/tlon/src/monitor/discovery.ts +76 -0
- package/extensions/tlon/src/monitor/history.ts +90 -0
- package/extensions/tlon/src/monitor/index.ts +553 -0
- package/extensions/tlon/src/monitor/processed-messages.test.ts +23 -0
- package/extensions/tlon/src/monitor/processed-messages.ts +46 -0
- package/extensions/tlon/src/monitor/utils.ts +105 -0
- package/extensions/tlon/src/onboarding.ts +214 -0
- package/extensions/tlon/src/runtime.ts +14 -0
- package/extensions/tlon/src/targets.ts +89 -0
- package/extensions/tlon/src/types.ts +92 -0
- package/extensions/tlon/src/urbit/auth.ts +18 -0
- package/extensions/tlon/src/urbit/http-api.ts +38 -0
- package/extensions/tlon/src/urbit/send.test.ts +38 -0
- package/extensions/tlon/src/urbit/send.ts +131 -0
- package/extensions/tlon/src/urbit/sse-client.test.ts +40 -0
- package/extensions/tlon/src/urbit/sse-client.ts +395 -0
- package/extensions/twitch/CHANGELOG.md +45 -0
- package/extensions/twitch/README.md +89 -0
- package/extensions/twitch/index.ts +20 -0
- package/extensions/twitch/node_modules/.bin/openclaw +21 -0
- package/extensions/twitch/openclaw.plugin.json +9 -0
- package/extensions/twitch/package.json +20 -0
- package/extensions/twitch/src/access-control.test.ts +489 -0
- package/extensions/twitch/src/access-control.ts +166 -0
- package/extensions/twitch/src/actions.ts +173 -0
- package/extensions/twitch/src/client-manager-registry.ts +115 -0
- package/extensions/twitch/src/config-schema.ts +82 -0
- package/extensions/twitch/src/config.test.ts +87 -0
- package/extensions/twitch/src/config.ts +116 -0
- package/extensions/twitch/src/monitor.ts +261 -0
- package/extensions/twitch/src/onboarding.test.ts +311 -0
- package/extensions/twitch/src/onboarding.ts +417 -0
- package/extensions/twitch/src/outbound.test.ts +373 -0
- package/extensions/twitch/src/outbound.ts +184 -0
- package/extensions/twitch/src/plugin.test.ts +39 -0
- package/extensions/twitch/src/plugin.ts +274 -0
- package/extensions/twitch/src/probe.test.ts +195 -0
- package/extensions/twitch/src/probe.ts +120 -0
- package/extensions/twitch/src/resolver.ts +137 -0
- package/extensions/twitch/src/runtime.ts +14 -0
- package/extensions/twitch/src/send.test.ts +289 -0
- package/extensions/twitch/src/send.ts +136 -0
- package/extensions/twitch/src/status.test.ts +270 -0
- package/extensions/twitch/src/status.ts +178 -0
- package/extensions/twitch/src/token.test.ts +171 -0
- package/extensions/twitch/src/token.ts +91 -0
- package/extensions/twitch/src/twitch-client.test.ts +589 -0
- package/extensions/twitch/src/twitch-client.ts +277 -0
- package/extensions/twitch/src/types.ts +141 -0
- package/extensions/twitch/src/utils/markdown.ts +98 -0
- package/extensions/twitch/src/utils/twitch.ts +78 -0
- package/extensions/twitch/test/setup.ts +7 -0
- package/extensions/voice-call/CHANGELOG.md +109 -0
- package/extensions/voice-call/README.md +139 -0
- package/extensions/voice-call/index.ts +493 -0
- package/extensions/voice-call/node_modules/.bin/openclaw +21 -0
- package/extensions/voice-call/openclaw.plugin.json +559 -0
- package/extensions/voice-call/package.json +19 -0
- package/extensions/voice-call/src/allowlist.ts +19 -0
- package/extensions/voice-call/src/cli.ts +279 -0
- package/extensions/voice-call/src/config.test.ts +234 -0
- package/extensions/voice-call/src/config.ts +523 -0
- package/extensions/voice-call/src/core-bridge.ts +159 -0
- package/extensions/voice-call/src/manager/context.ts +21 -0
- package/extensions/voice-call/src/manager/events.ts +188 -0
- package/extensions/voice-call/src/manager/lookup.ts +35 -0
- package/extensions/voice-call/src/manager/outbound.ts +275 -0
- package/extensions/voice-call/src/manager/state.ts +48 -0
- package/extensions/voice-call/src/manager/store.ts +91 -0
- package/extensions/voice-call/src/manager/timers.ts +89 -0
- package/extensions/voice-call/src/manager/twiml.ts +9 -0
- package/extensions/voice-call/src/manager.test.ts +194 -0
- package/extensions/voice-call/src/manager.ts +887 -0
- package/extensions/voice-call/src/media-stream.test.ts +96 -0
- package/extensions/voice-call/src/media-stream.ts +411 -0
- package/extensions/voice-call/src/providers/base.ts +67 -0
- package/extensions/voice-call/src/providers/index.ts +10 -0
- package/extensions/voice-call/src/providers/mock.ts +165 -0
- package/extensions/voice-call/src/providers/plivo.test.ts +27 -0
- package/extensions/voice-call/src/providers/plivo.ts +515 -0
- package/extensions/voice-call/src/providers/stt-openai-realtime.ts +311 -0
- package/extensions/voice-call/src/providers/telnyx.ts +371 -0
- package/extensions/voice-call/src/providers/tts-openai.ts +259 -0
- package/extensions/voice-call/src/providers/twilio/api.ts +42 -0
- package/extensions/voice-call/src/providers/twilio/webhook.ts +32 -0
- package/extensions/voice-call/src/providers/twilio.test.ts +60 -0
- package/extensions/voice-call/src/providers/twilio.ts +626 -0
- package/extensions/voice-call/src/response-generator.ts +158 -0
- package/extensions/voice-call/src/runtime.ts +212 -0
- package/extensions/voice-call/src/telephony-audio.ts +90 -0
- package/extensions/voice-call/src/telephony-tts.ts +104 -0
- package/extensions/voice-call/src/tunnel.ts +314 -0
- package/extensions/voice-call/src/types.ts +272 -0
- package/extensions/voice-call/src/utils.ts +14 -0
- package/extensions/voice-call/src/voice-mapping.ts +67 -0
- package/extensions/voice-call/src/webhook-security.test.ts +377 -0
- package/extensions/voice-call/src/webhook-security.ts +689 -0
- package/extensions/voice-call/src/webhook.ts +491 -0
- package/extensions/whatsapp/index.ts +17 -0
- package/extensions/whatsapp/node_modules/.bin/openclaw +21 -0
- package/extensions/whatsapp/openclaw.plugin.json +9 -0
- package/extensions/whatsapp/package.json +14 -0
- package/extensions/whatsapp/src/channel.ts +508 -0
- package/extensions/whatsapp/src/runtime.ts +14 -0
- package/extensions/zalo/CHANGELOG.md +89 -0
- package/extensions/zalo/README.md +50 -0
- package/extensions/zalo/index.ts +19 -0
- package/extensions/zalo/node_modules/.bin/openclaw +21 -0
- package/extensions/zalo/openclaw.plugin.json +9 -0
- package/extensions/zalo/package.json +36 -0
- package/extensions/zalo/src/accounts.ts +80 -0
- package/extensions/zalo/src/actions.ts +67 -0
- package/extensions/zalo/src/api.ts +208 -0
- package/extensions/zalo/src/channel.directory.test.ts +43 -0
- package/extensions/zalo/src/channel.ts +414 -0
- package/extensions/zalo/src/config-schema.ts +24 -0
- package/extensions/zalo/src/monitor.ts +753 -0
- package/extensions/zalo/src/monitor.webhook.test.ts +73 -0
- package/extensions/zalo/src/onboarding.ts +401 -0
- package/extensions/zalo/src/probe.ts +46 -0
- package/extensions/zalo/src/proxy.ts +21 -0
- package/extensions/zalo/src/runtime.ts +14 -0
- package/extensions/zalo/src/send.ts +124 -0
- package/extensions/zalo/src/status-issues.ts +53 -0
- package/extensions/zalo/src/token.ts +63 -0
- package/extensions/zalo/src/types.ts +42 -0
- package/extensions/zalouser/CHANGELOG.md +61 -0
- package/extensions/zalouser/README.md +225 -0
- package/extensions/zalouser/index.ts +31 -0
- package/extensions/zalouser/node_modules/.bin/openclaw +21 -0
- package/extensions/zalouser/openclaw.plugin.json +9 -0
- package/extensions/zalouser/package.json +36 -0
- package/extensions/zalouser/src/accounts.ts +135 -0
- package/extensions/zalouser/src/channel.test.ts +18 -0
- package/extensions/zalouser/src/channel.ts +686 -0
- package/extensions/zalouser/src/config-schema.ts +27 -0
- package/extensions/zalouser/src/monitor.ts +590 -0
- package/extensions/zalouser/src/onboarding.ts +504 -0
- package/extensions/zalouser/src/probe.ts +28 -0
- package/extensions/zalouser/src/runtime.ts +14 -0
- package/extensions/zalouser/src/send.ts +160 -0
- package/extensions/zalouser/src/status-issues.test.ts +57 -0
- package/extensions/zalouser/src/status-issues.ts +89 -0
- package/extensions/zalouser/src/tool.ts +164 -0
- package/extensions/zalouser/src/types.ts +108 -0
- package/extensions/zalouser/src/zca.ts +202 -0
- package/openclaw.mjs +14 -0
- package/package.json +245 -0
- package/skills/1password/SKILL.md +70 -0
- package/skills/1password/references/cli-examples.md +29 -0
- package/skills/1password/references/get-started.md +17 -0
- package/skills/apple-notes/SKILL.md +77 -0
- package/skills/apple-reminders/SKILL.md +96 -0
- package/skills/bear-notes/SKILL.md +107 -0
- package/skills/bird/SKILL.md +224 -0
- package/skills/blogwatcher/SKILL.md +69 -0
- package/skills/blucli/SKILL.md +47 -0
- package/skills/bluebubbles/SKILL.md +131 -0
- package/skills/camsnap/SKILL.md +45 -0
- package/skills/canvas/SKILL.md +198 -0
- package/skills/clawhub/SKILL.md +77 -0
- package/skills/coding-agent/SKILL.md +284 -0
- package/skills/discord/SKILL.md +578 -0
- package/skills/eightctl/SKILL.md +50 -0
- package/skills/food-order/SKILL.md +48 -0
- package/skills/gemini/SKILL.md +43 -0
- package/skills/ghostly-projects/SKILL.md +160 -0
- package/skills/gifgrep/SKILL.md +79 -0
- package/skills/github/SKILL.md +77 -0
- package/skills/gog/SKILL.md +116 -0
- package/skills/goplaces/SKILL.md +52 -0
- package/skills/healthcheck/SKILL.md +245 -0
- package/skills/himalaya/SKILL.md +257 -0
- package/skills/himalaya/references/configuration.md +184 -0
- package/skills/himalaya/references/message-composition.md +199 -0
- package/skills/imsg/SKILL.md +74 -0
- package/skills/linear/SKILL.md +111 -0
- package/skills/linear/linear.sh +204 -0
- package/skills/local-places/SERVER_README.md +101 -0
- package/skills/local-places/SKILL.md +102 -0
- package/skills/local-places/pyproject.toml +21 -0
- package/skills/local-places/src/local_places/__init__.py +2 -0
- package/skills/local-places/src/local_places/google_places.py +314 -0
- package/skills/local-places/src/local_places/main.py +65 -0
- package/skills/local-places/src/local_places/schemas.py +107 -0
- package/skills/mcporter/SKILL.md +61 -0
- package/skills/model-usage/SKILL.md +69 -0
- package/skills/model-usage/references/codexbar-cli.md +33 -0
- package/skills/model-usage/scripts/model_usage.py +310 -0
- package/skills/nano-banana-pro/SKILL.md +58 -0
- package/skills/nano-banana-pro/scripts/generate_image.py +184 -0
- package/skills/nano-pdf/SKILL.md +38 -0
- package/skills/notion/SKILL.md +172 -0
- package/skills/obsidian/SKILL.md +81 -0
- package/skills/openai-image-gen/SKILL.md +89 -0
- package/skills/openai-image-gen/scripts/gen.py +240 -0
- package/skills/openai-whisper/SKILL.md +38 -0
- package/skills/openai-whisper-api/SKILL.md +52 -0
- package/skills/openai-whisper-api/scripts/transcribe.sh +85 -0
- package/skills/openhue/SKILL.md +51 -0
- package/skills/oracle/SKILL.md +125 -0
- package/skills/ordercli/SKILL.md +78 -0
- package/skills/peekaboo/SKILL.md +190 -0
- package/skills/sag/SKILL.md +87 -0
- package/skills/session-logs/SKILL.md +115 -0
- package/skills/sherpa-onnx-tts/SKILL.md +103 -0
- package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +178 -0
- package/skills/skill-creator/SKILL.md +370 -0
- package/skills/skill-creator/license.txt +202 -0
- package/skills/skill-creator/scripts/init_skill.py +378 -0
- package/skills/skill-creator/scripts/package_skill.py +111 -0
- package/skills/skill-creator/scripts/quick_validate.py +101 -0
- package/skills/slack/SKILL.md +144 -0
- package/skills/songsee/SKILL.md +49 -0
- package/skills/sonoscli/SKILL.md +46 -0
- package/skills/spotify-player/SKILL.md +64 -0
- package/skills/summarize/SKILL.md +87 -0
- package/skills/things-mac/SKILL.md +86 -0
- package/skills/tmux/SKILL.md +135 -0
- package/skills/tmux/scripts/find-sessions.sh +112 -0
- package/skills/tmux/scripts/wait-for-text.sh +83 -0
- package/skills/trello/SKILL.md +95 -0
- package/skills/video-frames/SKILL.md +46 -0
- package/skills/video-frames/scripts/frame.sh +81 -0
- package/skills/voice-call/SKILL.md +45 -0
- package/skills/wacli/SKILL.md +72 -0
- package/skills/weather/SKILL.md +54 -0
|
@@ -0,0 +1,2544 @@
|
|
|
1
|
+
import "./pi-embedded-helpers-Dl8e5Rf8.js";
|
|
2
|
+
import { L as describeFailoverError, Q as loadProviderUsageSummary, _r as loadModelCatalog, et as formatUsageWindowSummary, gt as openUrl, l as runEmbeddedPiAgent, tt as resolveUsageProviderId } from "./reply-5UNWRwMn.js";
|
|
3
|
+
import { t as CONFIG_PATH } from "./paths-scjhy7N2.js";
|
|
4
|
+
import { a as resolveAgentModelPrimary, c as resolveDefaultAgentId, i as resolveAgentModelFallbacksOverride, r as resolveAgentDir, s as resolveAgentWorkspaceDir, w as resolveDefaultAgentWorkspaceDir } from "./agent-scope-BbT4OG2N.js";
|
|
5
|
+
import { I as colorize, L as isRich$1, R as theme, c as defaultRuntime } from "./subsystem-CAq3uyo7.js";
|
|
6
|
+
import { _ as shortenHomePath } from "./utils-CKSrBNwq.js";
|
|
7
|
+
import "./exec-HEWTMJ7j.js";
|
|
8
|
+
import { A as getCustomProviderApiKey, I as getShellEnvAppliedKeys, K as resolveAuthProfileOrder, M as resolveApiKeyForProvider, N as resolveAwsSdkEnvVarName, P as resolveEnvApiKey, V as shouldEnableShellEnvFallback, X as resolveProfileUnusableUntilForDisplay, _t as DEFAULT_MODEL, a as modelKey, at as setAuthProfileOrder, dt as resolveAuthStorePathForDisplay, f as resolveModelRefFromString, ft as resolveOpenClawAgentDir, l as resolveConfiguredModelRef, n as buildModelAliasIndex, o as normalizeProviderId, ot as upsertAuthProfile, pt as resolveAuthProfileDisplayLabel, rt as listProfilesForProvider, s as parseModelRef, st as ensureAuthProfileStore, u as resolveDefaultModelForAgent, vt as DEFAULT_PROVIDER } from "./model-selection-Cv5Ox_tY.js";
|
|
9
|
+
import "./github-copilot-token-CnxakiSC.js";
|
|
10
|
+
import { t as formatCliCommand } from "./command-format-DELazozB.js";
|
|
11
|
+
import "./boolean-Wzu0-e0P.js";
|
|
12
|
+
import "./env-l7QVNj6j.js";
|
|
13
|
+
import { h as parseDurationMs, i as loadConfig, o as readConfigFileSnapshot } from "./config-BtSTwPcH.js";
|
|
14
|
+
import "./manifest-registry-D2Yntqcb.js";
|
|
15
|
+
import "./plugins-QJjTXliB.js";
|
|
16
|
+
import "./sandbox-knontqD9.js";
|
|
17
|
+
import { _ as ensureOpenClawModelsJson } from "./image-CBqmIbQQ.js";
|
|
18
|
+
import { n as discoverModels, t as discoverAuthStorage } from "./pi-model-discovery-B6CsmK6Y.js";
|
|
19
|
+
import "./chrome-BZ9K48w9.js";
|
|
20
|
+
import "./skills-Tky2kCMO.js";
|
|
21
|
+
import "./routes-ClNyEvlm.js";
|
|
22
|
+
import "./server-context-B9GX5GOI.js";
|
|
23
|
+
import "./message-channel-D6v_oPAg.js";
|
|
24
|
+
import "./logging-CY-Q5cwf.js";
|
|
25
|
+
import "./accounts-DzBgAM3C.js";
|
|
26
|
+
import { a as resolveSessionTranscriptsDirForAgent, r as resolveSessionTranscriptPath } from "./paths-B-q1nXdY.js";
|
|
27
|
+
import "./redact-KzWHRS5J.js";
|
|
28
|
+
import "./tool-display-BEACy9rK.js";
|
|
29
|
+
import "./deliver-qpYZp20m.js";
|
|
30
|
+
import "./dispatcher-Dyv7T-1r.js";
|
|
31
|
+
import "./manager-CoBEAQKm.js";
|
|
32
|
+
import "./sqlite-QDf0yuU0.js";
|
|
33
|
+
import "./channel-summary-MCwBCa5y.js";
|
|
34
|
+
import "./client-DySXIFCA.js";
|
|
35
|
+
import "./call-B7EveN4V.js";
|
|
36
|
+
import "./login-qr-CD164Aw1.js";
|
|
37
|
+
import "./pairing-store-DDLNuzmx.js";
|
|
38
|
+
import { t as formatDocsLink } from "./links-DwjRqxgR.js";
|
|
39
|
+
import { n as resolveOptionFromCommand, r as runCommandWithRuntime } from "./cli-utils-gtE-0a0D.js";
|
|
40
|
+
import { r as withProgressTotals } from "./progress-CvaSPjS9.js";
|
|
41
|
+
import "./pi-tools.policy-BvkSDFDN.js";
|
|
42
|
+
import { n as stylePromptMessage, r as stylePromptTitle, t as stylePromptHint } from "./prompt-style-DYJdrXyV.js";
|
|
43
|
+
import "./pairing-labels-ClZ-fTWT.js";
|
|
44
|
+
import "./control-service-CqX5g_ko.js";
|
|
45
|
+
import "./restart-sentinel-DUemCjgU.js";
|
|
46
|
+
import "./channel-selection-BmND9mWj.js";
|
|
47
|
+
import { n as logConfigUpdated } from "./logging-DhiLkhLw.js";
|
|
48
|
+
import "./note-CQhSvgQv.js";
|
|
49
|
+
import { t as createClackPrompter } from "./clack-prompter-BybM9xdL.js";
|
|
50
|
+
import { a as normalizeAlias, at as validateAnthropicSetupToken, c as updateConfig, d as resolvePluginProviders, i as formatTokenK, l as createVpsAwareOAuthHandlers, n as ensureFlagCompatibility, o as resolveKnownAgentId, r as formatMs, s as resolveModelTarget, t as githubCopilotLoginCommand, u as isRemoteEnvironment, v as applyAuthProfileConfig } from "./github-copilot-auth-DVZj4Zgh.js";
|
|
51
|
+
import { t as renderTable } from "./table-DS4-gmkV.js";
|
|
52
|
+
import { i as redactSecrets } from "./format-Dzy9uRLE.js";
|
|
53
|
+
import { n as buildAuthHealthSummary, r as formatRemainingShort, t as DEFAULT_OAUTH_WARN_MS } from "./auth-health-Bj7Gjbv0.js";
|
|
54
|
+
import path from "node:path";
|
|
55
|
+
import fs from "node:fs/promises";
|
|
56
|
+
import crypto from "node:crypto";
|
|
57
|
+
import { complete, getEnvApiKey, getModel } from "@mariozechner/pi-ai";
|
|
58
|
+
import { Type } from "@sinclair/typebox";
|
|
59
|
+
import { cancel, confirm, isCancel, multiselect, select, text } from "@clack/prompts";
|
|
60
|
+
|
|
61
|
+
//#region src/commands/models/aliases.ts
|
|
62
|
+
async function modelsAliasesListCommand(opts, runtime) {
|
|
63
|
+
ensureFlagCompatibility(opts);
|
|
64
|
+
const models = loadConfig().agents?.defaults?.models ?? {};
|
|
65
|
+
const aliases = Object.entries(models).reduce((acc, [modelKey, entry]) => {
|
|
66
|
+
const alias = entry?.alias?.trim();
|
|
67
|
+
if (alias) acc[alias] = modelKey;
|
|
68
|
+
return acc;
|
|
69
|
+
}, {});
|
|
70
|
+
if (opts.json) {
|
|
71
|
+
runtime.log(JSON.stringify({ aliases }, null, 2));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (opts.plain) {
|
|
75
|
+
for (const [alias, target] of Object.entries(aliases)) runtime.log(`${alias} ${target}`);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
runtime.log(`Aliases (${Object.keys(aliases).length}):`);
|
|
79
|
+
if (Object.keys(aliases).length === 0) {
|
|
80
|
+
runtime.log("- none");
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
for (const [alias, target] of Object.entries(aliases)) runtime.log(`- ${alias} -> ${target}`);
|
|
84
|
+
}
|
|
85
|
+
async function modelsAliasesAddCommand(aliasRaw, modelRaw, runtime) {
|
|
86
|
+
const alias = normalizeAlias(aliasRaw);
|
|
87
|
+
const resolved = resolveModelTarget({
|
|
88
|
+
raw: modelRaw,
|
|
89
|
+
cfg: loadConfig()
|
|
90
|
+
});
|
|
91
|
+
await updateConfig((cfg) => {
|
|
92
|
+
const modelKey = `${resolved.provider}/${resolved.model}`;
|
|
93
|
+
const nextModels = { ...cfg.agents?.defaults?.models };
|
|
94
|
+
for (const [key, entry] of Object.entries(nextModels)) {
|
|
95
|
+
const existing = entry?.alias?.trim();
|
|
96
|
+
if (existing && existing === alias && key !== modelKey) throw new Error(`Alias ${alias} already points to ${key}.`);
|
|
97
|
+
}
|
|
98
|
+
nextModels[modelKey] = {
|
|
99
|
+
...nextModels[modelKey] ?? {},
|
|
100
|
+
alias
|
|
101
|
+
};
|
|
102
|
+
return {
|
|
103
|
+
...cfg,
|
|
104
|
+
agents: {
|
|
105
|
+
...cfg.agents,
|
|
106
|
+
defaults: {
|
|
107
|
+
...cfg.agents?.defaults,
|
|
108
|
+
models: nextModels
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
logConfigUpdated(runtime);
|
|
114
|
+
runtime.log(`Alias ${alias} -> ${resolved.provider}/${resolved.model}`);
|
|
115
|
+
}
|
|
116
|
+
async function modelsAliasesRemoveCommand(aliasRaw, runtime) {
|
|
117
|
+
const alias = normalizeAlias(aliasRaw);
|
|
118
|
+
const updated = await updateConfig((cfg) => {
|
|
119
|
+
const nextModels = { ...cfg.agents?.defaults?.models };
|
|
120
|
+
let found = false;
|
|
121
|
+
for (const [key, entry] of Object.entries(nextModels)) if (entry?.alias?.trim() === alias) {
|
|
122
|
+
nextModels[key] = {
|
|
123
|
+
...entry,
|
|
124
|
+
alias: void 0
|
|
125
|
+
};
|
|
126
|
+
found = true;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
if (!found) throw new Error(`Alias not found: ${alias}`);
|
|
130
|
+
return {
|
|
131
|
+
...cfg,
|
|
132
|
+
agents: {
|
|
133
|
+
...cfg.agents,
|
|
134
|
+
defaults: {
|
|
135
|
+
...cfg.agents?.defaults,
|
|
136
|
+
models: nextModels
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
logConfigUpdated(runtime);
|
|
142
|
+
if (!updated.agents?.defaults?.models || Object.values(updated.agents.defaults.models).every((entry) => !entry?.alias?.trim())) runtime.log("No aliases configured.");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/commands/models/auth.ts
|
|
147
|
+
const confirm$1 = (params) => confirm({
|
|
148
|
+
...params,
|
|
149
|
+
message: stylePromptMessage(params.message)
|
|
150
|
+
});
|
|
151
|
+
const text$1 = (params) => text({
|
|
152
|
+
...params,
|
|
153
|
+
message: stylePromptMessage(params.message)
|
|
154
|
+
});
|
|
155
|
+
const select$1 = (params) => select({
|
|
156
|
+
...params,
|
|
157
|
+
message: stylePromptMessage(params.message),
|
|
158
|
+
options: params.options.map((opt) => opt.hint === void 0 ? opt : {
|
|
159
|
+
...opt,
|
|
160
|
+
hint: stylePromptHint(opt.hint)
|
|
161
|
+
})
|
|
162
|
+
});
|
|
163
|
+
function resolveTokenProvider(raw) {
|
|
164
|
+
const trimmed = raw?.trim();
|
|
165
|
+
if (!trimmed) return null;
|
|
166
|
+
if (normalizeProviderId(trimmed) === "anthropic") return "anthropic";
|
|
167
|
+
return "custom";
|
|
168
|
+
}
|
|
169
|
+
function resolveDefaultTokenProfileId(provider) {
|
|
170
|
+
return `${normalizeProviderId(provider)}:manual`;
|
|
171
|
+
}
|
|
172
|
+
async function modelsAuthSetupTokenCommand(opts, runtime) {
|
|
173
|
+
const provider = resolveTokenProvider(opts.provider ?? "anthropic");
|
|
174
|
+
if (provider !== "anthropic") throw new Error("Only --provider anthropic is supported for setup-token.");
|
|
175
|
+
if (!process.stdin.isTTY) throw new Error("setup-token requires an interactive TTY.");
|
|
176
|
+
if (!opts.yes) {
|
|
177
|
+
if (!await confirm$1({
|
|
178
|
+
message: "Have you run `claude setup-token` and copied the token?",
|
|
179
|
+
initialValue: true
|
|
180
|
+
})) return;
|
|
181
|
+
}
|
|
182
|
+
const tokenInput = await text$1({
|
|
183
|
+
message: "Paste Anthropic setup-token",
|
|
184
|
+
validate: (value) => validateAnthropicSetupToken(String(value ?? ""))
|
|
185
|
+
});
|
|
186
|
+
const token = String(tokenInput).trim();
|
|
187
|
+
const profileId = resolveDefaultTokenProfileId(provider);
|
|
188
|
+
upsertAuthProfile({
|
|
189
|
+
profileId,
|
|
190
|
+
credential: {
|
|
191
|
+
type: "token",
|
|
192
|
+
provider,
|
|
193
|
+
token
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
await updateConfig((cfg) => applyAuthProfileConfig(cfg, {
|
|
197
|
+
profileId,
|
|
198
|
+
provider,
|
|
199
|
+
mode: "token"
|
|
200
|
+
}));
|
|
201
|
+
logConfigUpdated(runtime);
|
|
202
|
+
runtime.log(`Auth profile: ${profileId} (${provider}/token)`);
|
|
203
|
+
}
|
|
204
|
+
async function modelsAuthPasteTokenCommand(opts, runtime) {
|
|
205
|
+
const rawProvider = opts.provider?.trim();
|
|
206
|
+
if (!rawProvider) throw new Error("Missing --provider.");
|
|
207
|
+
const provider = normalizeProviderId(rawProvider);
|
|
208
|
+
const profileId = opts.profileId?.trim() || resolveDefaultTokenProfileId(provider);
|
|
209
|
+
const tokenInput = await text$1({
|
|
210
|
+
message: `Paste token for ${provider}`,
|
|
211
|
+
validate: (value) => value?.trim() ? void 0 : "Required"
|
|
212
|
+
});
|
|
213
|
+
const token = String(tokenInput).trim();
|
|
214
|
+
const expires = opts.expiresIn?.trim() && opts.expiresIn.trim().length > 0 ? Date.now() + parseDurationMs(String(opts.expiresIn).trim(), { defaultUnit: "d" }) : void 0;
|
|
215
|
+
upsertAuthProfile({
|
|
216
|
+
profileId,
|
|
217
|
+
credential: {
|
|
218
|
+
type: "token",
|
|
219
|
+
provider,
|
|
220
|
+
token,
|
|
221
|
+
...expires ? { expires } : {}
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
await updateConfig((cfg) => applyAuthProfileConfig(cfg, {
|
|
225
|
+
profileId,
|
|
226
|
+
provider,
|
|
227
|
+
mode: "token"
|
|
228
|
+
}));
|
|
229
|
+
logConfigUpdated(runtime);
|
|
230
|
+
runtime.log(`Auth profile: ${profileId} (${provider}/token)`);
|
|
231
|
+
}
|
|
232
|
+
async function modelsAuthAddCommand(_opts, runtime) {
|
|
233
|
+
const provider = await select$1({
|
|
234
|
+
message: "Token provider",
|
|
235
|
+
options: [{
|
|
236
|
+
value: "anthropic",
|
|
237
|
+
label: "anthropic"
|
|
238
|
+
}, {
|
|
239
|
+
value: "custom",
|
|
240
|
+
label: "custom (type provider id)"
|
|
241
|
+
}]
|
|
242
|
+
});
|
|
243
|
+
const providerId = provider === "custom" ? normalizeProviderId(String(await text$1({
|
|
244
|
+
message: "Provider id",
|
|
245
|
+
validate: (value) => value?.trim() ? void 0 : "Required"
|
|
246
|
+
}))) : provider;
|
|
247
|
+
if (await select$1({
|
|
248
|
+
message: "Token method",
|
|
249
|
+
options: [...providerId === "anthropic" ? [{
|
|
250
|
+
value: "setup-token",
|
|
251
|
+
label: "setup-token (claude)",
|
|
252
|
+
hint: "Paste a setup-token from `claude setup-token`"
|
|
253
|
+
}] : [], {
|
|
254
|
+
value: "paste",
|
|
255
|
+
label: "paste token"
|
|
256
|
+
}]
|
|
257
|
+
}) === "setup-token") {
|
|
258
|
+
await modelsAuthSetupTokenCommand({ provider: providerId }, runtime);
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
const profileIdDefault = resolveDefaultTokenProfileId(providerId);
|
|
262
|
+
await modelsAuthPasteTokenCommand({
|
|
263
|
+
provider: providerId,
|
|
264
|
+
profileId: String(await text$1({
|
|
265
|
+
message: "Profile id",
|
|
266
|
+
initialValue: profileIdDefault,
|
|
267
|
+
validate: (value) => value?.trim() ? void 0 : "Required"
|
|
268
|
+
})).trim(),
|
|
269
|
+
expiresIn: await confirm$1({
|
|
270
|
+
message: "Does this token expire?",
|
|
271
|
+
initialValue: false
|
|
272
|
+
}) ? String(await text$1({
|
|
273
|
+
message: "Expires in (duration)",
|
|
274
|
+
initialValue: "365d",
|
|
275
|
+
validate: (value) => {
|
|
276
|
+
try {
|
|
277
|
+
parseDurationMs(String(value ?? ""), { defaultUnit: "d" });
|
|
278
|
+
return;
|
|
279
|
+
} catch {
|
|
280
|
+
return "Invalid duration (e.g. 365d, 12h, 30m)";
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
})).trim() : void 0
|
|
284
|
+
}, runtime);
|
|
285
|
+
}
|
|
286
|
+
function resolveProviderMatch(providers, rawProvider) {
|
|
287
|
+
const raw = rawProvider?.trim();
|
|
288
|
+
if (!raw) return null;
|
|
289
|
+
const normalized = normalizeProviderId(raw);
|
|
290
|
+
return providers.find((provider) => normalizeProviderId(provider.id) === normalized) ?? providers.find((provider) => provider.aliases?.some((alias) => normalizeProviderId(alias) === normalized) ?? false) ?? null;
|
|
291
|
+
}
|
|
292
|
+
function pickAuthMethod(provider, rawMethod) {
|
|
293
|
+
const raw = rawMethod?.trim();
|
|
294
|
+
if (!raw) return null;
|
|
295
|
+
const normalized = raw.toLowerCase();
|
|
296
|
+
return provider.auth.find((method) => method.id.toLowerCase() === normalized) ?? provider.auth.find((method) => method.label.toLowerCase() === normalized) ?? null;
|
|
297
|
+
}
|
|
298
|
+
function isPlainRecord(value) {
|
|
299
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
300
|
+
}
|
|
301
|
+
function mergeConfigPatch(base, patch) {
|
|
302
|
+
if (!isPlainRecord(base) || !isPlainRecord(patch)) return patch;
|
|
303
|
+
const next = { ...base };
|
|
304
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
305
|
+
const existing = next[key];
|
|
306
|
+
if (isPlainRecord(existing) && isPlainRecord(value)) next[key] = mergeConfigPatch(existing, value);
|
|
307
|
+
else next[key] = value;
|
|
308
|
+
}
|
|
309
|
+
return next;
|
|
310
|
+
}
|
|
311
|
+
function applyDefaultModel(cfg, model) {
|
|
312
|
+
const models = { ...cfg.agents?.defaults?.models };
|
|
313
|
+
models[model] = models[model] ?? {};
|
|
314
|
+
const existingModel = cfg.agents?.defaults?.model;
|
|
315
|
+
return {
|
|
316
|
+
...cfg,
|
|
317
|
+
agents: {
|
|
318
|
+
...cfg.agents,
|
|
319
|
+
defaults: {
|
|
320
|
+
...cfg.agents?.defaults,
|
|
321
|
+
models,
|
|
322
|
+
model: {
|
|
323
|
+
...existingModel && typeof existingModel === "object" && "fallbacks" in existingModel ? { fallbacks: existingModel.fallbacks } : void 0,
|
|
324
|
+
primary: model
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
function credentialMode(credential) {
|
|
331
|
+
if (credential.type === "api_key") return "api_key";
|
|
332
|
+
if (credential.type === "token") return "token";
|
|
333
|
+
return "oauth";
|
|
334
|
+
}
|
|
335
|
+
async function modelsAuthLoginCommand(opts, runtime) {
|
|
336
|
+
if (!process.stdin.isTTY) throw new Error("models auth login requires an interactive TTY.");
|
|
337
|
+
const snapshot = await readConfigFileSnapshot();
|
|
338
|
+
if (!snapshot.valid) {
|
|
339
|
+
const issues = snapshot.issues.map((issue) => `- ${issue.path}: ${issue.message}`).join("\n");
|
|
340
|
+
throw new Error(`Invalid config at ${snapshot.path}\n${issues}`);
|
|
341
|
+
}
|
|
342
|
+
const config = snapshot.config;
|
|
343
|
+
const defaultAgentId = resolveDefaultAgentId(config);
|
|
344
|
+
const agentDir = resolveAgentDir(config, defaultAgentId);
|
|
345
|
+
const workspaceDir = resolveAgentWorkspaceDir(config, defaultAgentId) ?? resolveDefaultAgentWorkspaceDir();
|
|
346
|
+
const providers = resolvePluginProviders({
|
|
347
|
+
config,
|
|
348
|
+
workspaceDir
|
|
349
|
+
});
|
|
350
|
+
if (providers.length === 0) throw new Error(`No provider plugins found. Install one via \`${formatCliCommand("openclaw plugins install")}\`.`);
|
|
351
|
+
const prompter = createClackPrompter();
|
|
352
|
+
const selectedProvider = resolveProviderMatch(providers, opts.provider) ?? await prompter.select({
|
|
353
|
+
message: "Select a provider",
|
|
354
|
+
options: providers.map((provider) => ({
|
|
355
|
+
value: provider.id,
|
|
356
|
+
label: provider.label,
|
|
357
|
+
hint: provider.docsPath ? `Docs: ${provider.docsPath}` : void 0
|
|
358
|
+
}))
|
|
359
|
+
}).then((id) => resolveProviderMatch(providers, String(id)));
|
|
360
|
+
if (!selectedProvider) throw new Error("Unknown provider. Use --provider <id> to pick a provider plugin.");
|
|
361
|
+
const chosenMethod = pickAuthMethod(selectedProvider, opts.method) ?? (selectedProvider.auth.length === 1 ? selectedProvider.auth[0] : await prompter.select({
|
|
362
|
+
message: `Auth method for ${selectedProvider.label}`,
|
|
363
|
+
options: selectedProvider.auth.map((method) => ({
|
|
364
|
+
value: method.id,
|
|
365
|
+
label: method.label,
|
|
366
|
+
hint: method.hint
|
|
367
|
+
}))
|
|
368
|
+
}).then((id) => selectedProvider.auth.find((method) => method.id === String(id))));
|
|
369
|
+
if (!chosenMethod) throw new Error("Unknown auth method. Use --method <id> to select one.");
|
|
370
|
+
const isRemote = isRemoteEnvironment();
|
|
371
|
+
const result = await chosenMethod.run({
|
|
372
|
+
config,
|
|
373
|
+
agentDir,
|
|
374
|
+
workspaceDir,
|
|
375
|
+
prompter,
|
|
376
|
+
runtime,
|
|
377
|
+
isRemote,
|
|
378
|
+
openUrl: async (url) => {
|
|
379
|
+
await openUrl(url);
|
|
380
|
+
},
|
|
381
|
+
oauth: { createVpsAwareHandlers: (params) => createVpsAwareOAuthHandlers(params) }
|
|
382
|
+
});
|
|
383
|
+
for (const profile of result.profiles) upsertAuthProfile({
|
|
384
|
+
profileId: profile.profileId,
|
|
385
|
+
credential: profile.credential,
|
|
386
|
+
agentDir
|
|
387
|
+
});
|
|
388
|
+
await updateConfig((cfg) => {
|
|
389
|
+
let next = cfg;
|
|
390
|
+
if (result.configPatch) next = mergeConfigPatch(next, result.configPatch);
|
|
391
|
+
for (const profile of result.profiles) next = applyAuthProfileConfig(next, {
|
|
392
|
+
profileId: profile.profileId,
|
|
393
|
+
provider: profile.credential.provider,
|
|
394
|
+
mode: credentialMode(profile.credential)
|
|
395
|
+
});
|
|
396
|
+
if (opts.setDefault && result.defaultModel) next = applyDefaultModel(next, result.defaultModel);
|
|
397
|
+
return next;
|
|
398
|
+
});
|
|
399
|
+
logConfigUpdated(runtime);
|
|
400
|
+
for (const profile of result.profiles) runtime.log(`Auth profile: ${profile.profileId} (${profile.credential.provider}/${credentialMode(profile.credential)})`);
|
|
401
|
+
if (result.defaultModel) runtime.log(opts.setDefault ? `Default model set to ${result.defaultModel}` : `Default model available: ${result.defaultModel} (use --set-default to apply)`);
|
|
402
|
+
if (result.notes && result.notes.length > 0) await prompter.note(result.notes.join("\n"), "Provider notes");
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
//#endregion
|
|
406
|
+
//#region src/commands/models/auth-order.ts
|
|
407
|
+
function resolveTargetAgent(cfg, raw) {
|
|
408
|
+
const agentId = resolveKnownAgentId({
|
|
409
|
+
cfg,
|
|
410
|
+
rawAgentId: raw
|
|
411
|
+
}) ?? resolveDefaultAgentId(cfg);
|
|
412
|
+
return {
|
|
413
|
+
agentId,
|
|
414
|
+
agentDir: resolveAgentDir(cfg, agentId)
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
function describeOrder(store, provider) {
|
|
418
|
+
const providerKey = normalizeProviderId(provider);
|
|
419
|
+
const order = store.order?.[providerKey];
|
|
420
|
+
return Array.isArray(order) ? order : [];
|
|
421
|
+
}
|
|
422
|
+
async function modelsAuthOrderGetCommand(opts, runtime) {
|
|
423
|
+
const rawProvider = opts.provider?.trim();
|
|
424
|
+
if (!rawProvider) throw new Error("Missing --provider.");
|
|
425
|
+
const provider = normalizeProviderId(rawProvider);
|
|
426
|
+
const { agentId, agentDir } = resolveTargetAgent(loadConfig(), opts.agent);
|
|
427
|
+
const order = describeOrder(ensureAuthProfileStore(agentDir, { allowKeychainPrompt: false }), provider);
|
|
428
|
+
if (opts.json) {
|
|
429
|
+
runtime.log(JSON.stringify({
|
|
430
|
+
agentId,
|
|
431
|
+
agentDir,
|
|
432
|
+
provider,
|
|
433
|
+
authStorePath: shortenHomePath(`${agentDir}/auth-profiles.json`),
|
|
434
|
+
order: order.length > 0 ? order : null
|
|
435
|
+
}, null, 2));
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
runtime.log(`Agent: ${agentId}`);
|
|
439
|
+
runtime.log(`Provider: ${provider}`);
|
|
440
|
+
runtime.log(`Auth file: ${shortenHomePath(`${agentDir}/auth-profiles.json`)}`);
|
|
441
|
+
runtime.log(order.length > 0 ? `Order override: ${order.join(", ")}` : "Order override: (none)");
|
|
442
|
+
}
|
|
443
|
+
async function modelsAuthOrderClearCommand(opts, runtime) {
|
|
444
|
+
const rawProvider = opts.provider?.trim();
|
|
445
|
+
if (!rawProvider) throw new Error("Missing --provider.");
|
|
446
|
+
const provider = normalizeProviderId(rawProvider);
|
|
447
|
+
const { agentId, agentDir } = resolveTargetAgent(loadConfig(), opts.agent);
|
|
448
|
+
if (!await setAuthProfileOrder({
|
|
449
|
+
agentDir,
|
|
450
|
+
provider,
|
|
451
|
+
order: null
|
|
452
|
+
})) throw new Error("Failed to update auth-profiles.json (lock busy?).");
|
|
453
|
+
runtime.log(`Agent: ${agentId}`);
|
|
454
|
+
runtime.log(`Provider: ${provider}`);
|
|
455
|
+
runtime.log("Cleared per-agent order override.");
|
|
456
|
+
}
|
|
457
|
+
async function modelsAuthOrderSetCommand(opts, runtime) {
|
|
458
|
+
const rawProvider = opts.provider?.trim();
|
|
459
|
+
if (!rawProvider) throw new Error("Missing --provider.");
|
|
460
|
+
const provider = normalizeProviderId(rawProvider);
|
|
461
|
+
const { agentId, agentDir } = resolveTargetAgent(loadConfig(), opts.agent);
|
|
462
|
+
const store = ensureAuthProfileStore(agentDir, { allowKeychainPrompt: false });
|
|
463
|
+
const providerKey = normalizeProviderId(provider);
|
|
464
|
+
const requested = (opts.order ?? []).map((entry) => String(entry).trim()).filter(Boolean);
|
|
465
|
+
if (requested.length === 0) throw new Error("Missing profile ids. Provide one or more profile ids.");
|
|
466
|
+
for (const profileId of requested) {
|
|
467
|
+
const cred = store.profiles[profileId];
|
|
468
|
+
if (!cred) throw new Error(`Auth profile "${profileId}" not found in ${agentDir}.`);
|
|
469
|
+
if (normalizeProviderId(cred.provider) !== providerKey) throw new Error(`Auth profile "${profileId}" is for ${cred.provider}, not ${provider}.`);
|
|
470
|
+
}
|
|
471
|
+
const updated = await setAuthProfileOrder({
|
|
472
|
+
agentDir,
|
|
473
|
+
provider,
|
|
474
|
+
order: requested
|
|
475
|
+
});
|
|
476
|
+
if (!updated) throw new Error("Failed to update auth-profiles.json (lock busy?).");
|
|
477
|
+
runtime.log(`Agent: ${agentId}`);
|
|
478
|
+
runtime.log(`Provider: ${provider}`);
|
|
479
|
+
runtime.log(`Order override: ${describeOrder(updated, provider).join(", ")}`);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/commands/models/fallbacks.ts
|
|
484
|
+
async function modelsFallbacksListCommand(opts, runtime) {
|
|
485
|
+
ensureFlagCompatibility(opts);
|
|
486
|
+
const fallbacks = loadConfig().agents?.defaults?.model?.fallbacks ?? [];
|
|
487
|
+
if (opts.json) {
|
|
488
|
+
runtime.log(JSON.stringify({ fallbacks }, null, 2));
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
if (opts.plain) {
|
|
492
|
+
for (const entry of fallbacks) runtime.log(entry);
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
runtime.log(`Fallbacks (${fallbacks.length}):`);
|
|
496
|
+
if (fallbacks.length === 0) {
|
|
497
|
+
runtime.log("- none");
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
for (const entry of fallbacks) runtime.log(`- ${entry}`);
|
|
501
|
+
}
|
|
502
|
+
async function modelsFallbacksAddCommand(modelRaw, runtime) {
|
|
503
|
+
const updated = await updateConfig((cfg) => {
|
|
504
|
+
const resolved = resolveModelTarget({
|
|
505
|
+
raw: modelRaw,
|
|
506
|
+
cfg
|
|
507
|
+
});
|
|
508
|
+
const targetKey = modelKey(resolved.provider, resolved.model);
|
|
509
|
+
const nextModels = { ...cfg.agents?.defaults?.models };
|
|
510
|
+
if (!nextModels[targetKey]) nextModels[targetKey] = {};
|
|
511
|
+
const aliasIndex = buildModelAliasIndex({
|
|
512
|
+
cfg,
|
|
513
|
+
defaultProvider: DEFAULT_PROVIDER
|
|
514
|
+
});
|
|
515
|
+
const existing = cfg.agents?.defaults?.model?.fallbacks ?? [];
|
|
516
|
+
if (existing.map((entry) => resolveModelRefFromString({
|
|
517
|
+
raw: String(entry ?? ""),
|
|
518
|
+
defaultProvider: DEFAULT_PROVIDER,
|
|
519
|
+
aliasIndex
|
|
520
|
+
})).filter((entry) => Boolean(entry)).map((entry) => modelKey(entry.ref.provider, entry.ref.model)).includes(targetKey)) return cfg;
|
|
521
|
+
const existingModel = cfg.agents?.defaults?.model;
|
|
522
|
+
return {
|
|
523
|
+
...cfg,
|
|
524
|
+
agents: {
|
|
525
|
+
...cfg.agents,
|
|
526
|
+
defaults: {
|
|
527
|
+
...cfg.agents?.defaults,
|
|
528
|
+
model: {
|
|
529
|
+
...existingModel?.primary ? { primary: existingModel.primary } : void 0,
|
|
530
|
+
fallbacks: [...existing, targetKey]
|
|
531
|
+
},
|
|
532
|
+
models: nextModels
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
});
|
|
537
|
+
logConfigUpdated(runtime);
|
|
538
|
+
runtime.log(`Fallbacks: ${(updated.agents?.defaults?.model?.fallbacks ?? []).join(", ")}`);
|
|
539
|
+
}
|
|
540
|
+
async function modelsFallbacksRemoveCommand(modelRaw, runtime) {
|
|
541
|
+
const updated = await updateConfig((cfg) => {
|
|
542
|
+
const resolved = resolveModelTarget({
|
|
543
|
+
raw: modelRaw,
|
|
544
|
+
cfg
|
|
545
|
+
});
|
|
546
|
+
const targetKey = modelKey(resolved.provider, resolved.model);
|
|
547
|
+
const aliasIndex = buildModelAliasIndex({
|
|
548
|
+
cfg,
|
|
549
|
+
defaultProvider: DEFAULT_PROVIDER
|
|
550
|
+
});
|
|
551
|
+
const existing = cfg.agents?.defaults?.model?.fallbacks ?? [];
|
|
552
|
+
const filtered = existing.filter((entry) => {
|
|
553
|
+
const resolvedEntry = resolveModelRefFromString({
|
|
554
|
+
raw: String(entry ?? ""),
|
|
555
|
+
defaultProvider: DEFAULT_PROVIDER,
|
|
556
|
+
aliasIndex
|
|
557
|
+
});
|
|
558
|
+
if (!resolvedEntry) return true;
|
|
559
|
+
return modelKey(resolvedEntry.ref.provider, resolvedEntry.ref.model) !== targetKey;
|
|
560
|
+
});
|
|
561
|
+
if (filtered.length === existing.length) throw new Error(`Fallback not found: ${targetKey}`);
|
|
562
|
+
const existingModel = cfg.agents?.defaults?.model;
|
|
563
|
+
return {
|
|
564
|
+
...cfg,
|
|
565
|
+
agents: {
|
|
566
|
+
...cfg.agents,
|
|
567
|
+
defaults: {
|
|
568
|
+
...cfg.agents?.defaults,
|
|
569
|
+
model: {
|
|
570
|
+
...existingModel?.primary ? { primary: existingModel.primary } : void 0,
|
|
571
|
+
fallbacks: filtered
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
});
|
|
577
|
+
logConfigUpdated(runtime);
|
|
578
|
+
runtime.log(`Fallbacks: ${(updated.agents?.defaults?.model?.fallbacks ?? []).join(", ")}`);
|
|
579
|
+
}
|
|
580
|
+
async function modelsFallbacksClearCommand(runtime) {
|
|
581
|
+
await updateConfig((cfg) => {
|
|
582
|
+
const existingModel = cfg.agents?.defaults?.model;
|
|
583
|
+
return {
|
|
584
|
+
...cfg,
|
|
585
|
+
agents: {
|
|
586
|
+
...cfg.agents,
|
|
587
|
+
defaults: {
|
|
588
|
+
...cfg.agents?.defaults,
|
|
589
|
+
model: {
|
|
590
|
+
...existingModel?.primary ? { primary: existingModel.primary } : void 0,
|
|
591
|
+
fallbacks: []
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
});
|
|
597
|
+
logConfigUpdated(runtime);
|
|
598
|
+
runtime.log("Fallback list cleared.");
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region src/commands/models/image-fallbacks.ts
|
|
603
|
+
async function modelsImageFallbacksListCommand(opts, runtime) {
|
|
604
|
+
ensureFlagCompatibility(opts);
|
|
605
|
+
const fallbacks = loadConfig().agents?.defaults?.imageModel?.fallbacks ?? [];
|
|
606
|
+
if (opts.json) {
|
|
607
|
+
runtime.log(JSON.stringify({ fallbacks }, null, 2));
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
if (opts.plain) {
|
|
611
|
+
for (const entry of fallbacks) runtime.log(entry);
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
runtime.log(`Image fallbacks (${fallbacks.length}):`);
|
|
615
|
+
if (fallbacks.length === 0) {
|
|
616
|
+
runtime.log("- none");
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
for (const entry of fallbacks) runtime.log(`- ${entry}`);
|
|
620
|
+
}
|
|
621
|
+
async function modelsImageFallbacksAddCommand(modelRaw, runtime) {
|
|
622
|
+
const updated = await updateConfig((cfg) => {
|
|
623
|
+
const resolved = resolveModelTarget({
|
|
624
|
+
raw: modelRaw,
|
|
625
|
+
cfg
|
|
626
|
+
});
|
|
627
|
+
const targetKey = modelKey(resolved.provider, resolved.model);
|
|
628
|
+
const nextModels = { ...cfg.agents?.defaults?.models };
|
|
629
|
+
if (!nextModels[targetKey]) nextModels[targetKey] = {};
|
|
630
|
+
const aliasIndex = buildModelAliasIndex({
|
|
631
|
+
cfg,
|
|
632
|
+
defaultProvider: DEFAULT_PROVIDER
|
|
633
|
+
});
|
|
634
|
+
const existing = cfg.agents?.defaults?.imageModel?.fallbacks ?? [];
|
|
635
|
+
if (existing.map((entry) => resolveModelRefFromString({
|
|
636
|
+
raw: String(entry ?? ""),
|
|
637
|
+
defaultProvider: DEFAULT_PROVIDER,
|
|
638
|
+
aliasIndex
|
|
639
|
+
})).filter((entry) => Boolean(entry)).map((entry) => modelKey(entry.ref.provider, entry.ref.model)).includes(targetKey)) return cfg;
|
|
640
|
+
const existingModel = cfg.agents?.defaults?.imageModel;
|
|
641
|
+
return {
|
|
642
|
+
...cfg,
|
|
643
|
+
agents: {
|
|
644
|
+
...cfg.agents,
|
|
645
|
+
defaults: {
|
|
646
|
+
...cfg.agents?.defaults,
|
|
647
|
+
imageModel: {
|
|
648
|
+
...existingModel?.primary ? { primary: existingModel.primary } : void 0,
|
|
649
|
+
fallbacks: [...existing, targetKey]
|
|
650
|
+
},
|
|
651
|
+
models: nextModels
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
});
|
|
656
|
+
logConfigUpdated(runtime);
|
|
657
|
+
runtime.log(`Image fallbacks: ${(updated.agents?.defaults?.imageModel?.fallbacks ?? []).join(", ")}`);
|
|
658
|
+
}
|
|
659
|
+
async function modelsImageFallbacksRemoveCommand(modelRaw, runtime) {
|
|
660
|
+
const updated = await updateConfig((cfg) => {
|
|
661
|
+
const resolved = resolveModelTarget({
|
|
662
|
+
raw: modelRaw,
|
|
663
|
+
cfg
|
|
664
|
+
});
|
|
665
|
+
const targetKey = modelKey(resolved.provider, resolved.model);
|
|
666
|
+
const aliasIndex = buildModelAliasIndex({
|
|
667
|
+
cfg,
|
|
668
|
+
defaultProvider: DEFAULT_PROVIDER
|
|
669
|
+
});
|
|
670
|
+
const existing = cfg.agents?.defaults?.imageModel?.fallbacks ?? [];
|
|
671
|
+
const filtered = existing.filter((entry) => {
|
|
672
|
+
const resolvedEntry = resolveModelRefFromString({
|
|
673
|
+
raw: String(entry ?? ""),
|
|
674
|
+
defaultProvider: DEFAULT_PROVIDER,
|
|
675
|
+
aliasIndex
|
|
676
|
+
});
|
|
677
|
+
if (!resolvedEntry) return true;
|
|
678
|
+
return modelKey(resolvedEntry.ref.provider, resolvedEntry.ref.model) !== targetKey;
|
|
679
|
+
});
|
|
680
|
+
if (filtered.length === existing.length) throw new Error(`Image fallback not found: ${targetKey}`);
|
|
681
|
+
const existingModel = cfg.agents?.defaults?.imageModel;
|
|
682
|
+
return {
|
|
683
|
+
...cfg,
|
|
684
|
+
agents: {
|
|
685
|
+
...cfg.agents,
|
|
686
|
+
defaults: {
|
|
687
|
+
...cfg.agents?.defaults,
|
|
688
|
+
imageModel: {
|
|
689
|
+
...existingModel?.primary ? { primary: existingModel.primary } : void 0,
|
|
690
|
+
fallbacks: filtered
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
});
|
|
696
|
+
logConfigUpdated(runtime);
|
|
697
|
+
runtime.log(`Image fallbacks: ${(updated.agents?.defaults?.imageModel?.fallbacks ?? []).join(", ")}`);
|
|
698
|
+
}
|
|
699
|
+
async function modelsImageFallbacksClearCommand(runtime) {
|
|
700
|
+
await updateConfig((cfg) => {
|
|
701
|
+
const existingModel = cfg.agents?.defaults?.imageModel;
|
|
702
|
+
return {
|
|
703
|
+
...cfg,
|
|
704
|
+
agents: {
|
|
705
|
+
...cfg.agents,
|
|
706
|
+
defaults: {
|
|
707
|
+
...cfg.agents?.defaults,
|
|
708
|
+
imageModel: {
|
|
709
|
+
...existingModel?.primary ? { primary: existingModel.primary } : void 0,
|
|
710
|
+
fallbacks: []
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
});
|
|
716
|
+
logConfigUpdated(runtime);
|
|
717
|
+
runtime.log("Image fallback list cleared.");
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
//#endregion
|
|
721
|
+
//#region src/commands/models/list.configured.ts
|
|
722
|
+
function resolveConfiguredEntries(cfg) {
|
|
723
|
+
const resolvedDefault = resolveConfiguredModelRef({
|
|
724
|
+
cfg,
|
|
725
|
+
defaultProvider: DEFAULT_PROVIDER,
|
|
726
|
+
defaultModel: DEFAULT_MODEL
|
|
727
|
+
});
|
|
728
|
+
const aliasIndex = buildModelAliasIndex({
|
|
729
|
+
cfg,
|
|
730
|
+
defaultProvider: DEFAULT_PROVIDER
|
|
731
|
+
});
|
|
732
|
+
const order = [];
|
|
733
|
+
const tagsByKey = /* @__PURE__ */ new Map();
|
|
734
|
+
const aliasesByKey = /* @__PURE__ */ new Map();
|
|
735
|
+
for (const [key, aliases] of aliasIndex.byKey.entries()) aliasesByKey.set(key, aliases);
|
|
736
|
+
const addEntry = (ref, tag) => {
|
|
737
|
+
const key = modelKey(ref.provider, ref.model);
|
|
738
|
+
if (!tagsByKey.has(key)) {
|
|
739
|
+
tagsByKey.set(key, /* @__PURE__ */ new Set());
|
|
740
|
+
order.push(key);
|
|
741
|
+
}
|
|
742
|
+
tagsByKey.get(key)?.add(tag);
|
|
743
|
+
};
|
|
744
|
+
addEntry(resolvedDefault, "default");
|
|
745
|
+
const modelConfig = cfg.agents?.defaults?.model;
|
|
746
|
+
const imageModelConfig = cfg.agents?.defaults?.imageModel;
|
|
747
|
+
const modelFallbacks = typeof modelConfig === "object" ? modelConfig?.fallbacks ?? [] : [];
|
|
748
|
+
const imageFallbacks = typeof imageModelConfig === "object" ? imageModelConfig?.fallbacks ?? [] : [];
|
|
749
|
+
const imagePrimary = imageModelConfig?.primary?.trim() ?? "";
|
|
750
|
+
modelFallbacks.forEach((raw, idx) => {
|
|
751
|
+
const resolved = resolveModelRefFromString({
|
|
752
|
+
raw: String(raw ?? ""),
|
|
753
|
+
defaultProvider: DEFAULT_PROVIDER,
|
|
754
|
+
aliasIndex
|
|
755
|
+
});
|
|
756
|
+
if (!resolved) return;
|
|
757
|
+
addEntry(resolved.ref, `fallback#${idx + 1}`);
|
|
758
|
+
});
|
|
759
|
+
if (imagePrimary) {
|
|
760
|
+
const resolved = resolveModelRefFromString({
|
|
761
|
+
raw: imagePrimary,
|
|
762
|
+
defaultProvider: DEFAULT_PROVIDER,
|
|
763
|
+
aliasIndex
|
|
764
|
+
});
|
|
765
|
+
if (resolved) addEntry(resolved.ref, "image");
|
|
766
|
+
}
|
|
767
|
+
imageFallbacks.forEach((raw, idx) => {
|
|
768
|
+
const resolved = resolveModelRefFromString({
|
|
769
|
+
raw: String(raw ?? ""),
|
|
770
|
+
defaultProvider: DEFAULT_PROVIDER,
|
|
771
|
+
aliasIndex
|
|
772
|
+
});
|
|
773
|
+
if (!resolved) return;
|
|
774
|
+
addEntry(resolved.ref, `img-fallback#${idx + 1}`);
|
|
775
|
+
});
|
|
776
|
+
for (const key of Object.keys(cfg.agents?.defaults?.models ?? {})) {
|
|
777
|
+
const parsed = parseModelRef(String(key ?? ""), DEFAULT_PROVIDER);
|
|
778
|
+
if (!parsed) continue;
|
|
779
|
+
addEntry(parsed, "configured");
|
|
780
|
+
}
|
|
781
|
+
return { entries: order.map((key) => {
|
|
782
|
+
const slash = key.indexOf("/");
|
|
783
|
+
return {
|
|
784
|
+
key,
|
|
785
|
+
ref: {
|
|
786
|
+
provider: slash === -1 ? key : key.slice(0, slash),
|
|
787
|
+
model: slash === -1 ? "" : key.slice(slash + 1)
|
|
788
|
+
},
|
|
789
|
+
tags: tagsByKey.get(key) ?? /* @__PURE__ */ new Set(),
|
|
790
|
+
aliases: aliasesByKey.get(key) ?? []
|
|
791
|
+
};
|
|
792
|
+
}) };
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
//#endregion
|
|
796
|
+
//#region src/commands/models/list.registry.ts
|
|
797
|
+
const isLocalBaseUrl = (baseUrl) => {
|
|
798
|
+
try {
|
|
799
|
+
const host = new URL(baseUrl).hostname.toLowerCase();
|
|
800
|
+
return host === "localhost" || host === "127.0.0.1" || host === "0.0.0.0" || host === "::1" || host.endsWith(".local");
|
|
801
|
+
} catch {
|
|
802
|
+
return false;
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
const hasAuthForProvider = (provider, cfg, authStore) => {
|
|
806
|
+
if (listProfilesForProvider(authStore, provider).length > 0) return true;
|
|
807
|
+
if (provider === "amazon-bedrock" && resolveAwsSdkEnvVarName()) return true;
|
|
808
|
+
if (resolveEnvApiKey(provider)) return true;
|
|
809
|
+
if (getCustomProviderApiKey(cfg, provider)) return true;
|
|
810
|
+
return false;
|
|
811
|
+
};
|
|
812
|
+
async function loadModelRegistry(cfg) {
|
|
813
|
+
await ensureOpenClawModelsJson(cfg);
|
|
814
|
+
const agentDir = resolveOpenClawAgentDir();
|
|
815
|
+
const registry = discoverModels(discoverAuthStorage(agentDir), agentDir);
|
|
816
|
+
const models = registry.getAll();
|
|
817
|
+
const availableModels = registry.getAvailable();
|
|
818
|
+
return {
|
|
819
|
+
registry,
|
|
820
|
+
models,
|
|
821
|
+
availableKeys: new Set(availableModels.map((model) => modelKey(model.provider, model.id)))
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
function toModelRow(params) {
|
|
825
|
+
const { model, key, tags, aliases = [], availableKeys, cfg, authStore } = params;
|
|
826
|
+
if (!model) return {
|
|
827
|
+
key,
|
|
828
|
+
name: key,
|
|
829
|
+
input: "-",
|
|
830
|
+
contextWindow: null,
|
|
831
|
+
local: null,
|
|
832
|
+
available: null,
|
|
833
|
+
tags: [...tags, "missing"],
|
|
834
|
+
missing: true
|
|
835
|
+
};
|
|
836
|
+
const input = model.input.join("+") || "text";
|
|
837
|
+
const local = isLocalBaseUrl(model.baseUrl);
|
|
838
|
+
const available = cfg && authStore ? hasAuthForProvider(model.provider, cfg, authStore) : availableKeys?.has(modelKey(model.provider, model.id)) ?? false;
|
|
839
|
+
const aliasTags = aliases.length > 0 ? [`alias:${aliases.join(",")}`] : [];
|
|
840
|
+
const mergedTags = new Set(tags);
|
|
841
|
+
if (aliasTags.length > 0) {
|
|
842
|
+
for (const tag of mergedTags) if (tag === "alias" || tag.startsWith("alias:")) mergedTags.delete(tag);
|
|
843
|
+
for (const tag of aliasTags) mergedTags.add(tag);
|
|
844
|
+
}
|
|
845
|
+
return {
|
|
846
|
+
key,
|
|
847
|
+
name: model.name || model.id,
|
|
848
|
+
input,
|
|
849
|
+
contextWindow: model.contextWindow ?? null,
|
|
850
|
+
local,
|
|
851
|
+
available,
|
|
852
|
+
tags: Array.from(mergedTags),
|
|
853
|
+
missing: false
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
//#endregion
|
|
858
|
+
//#region src/commands/models/list.format.ts
|
|
859
|
+
const isRich = (opts) => Boolean(isRich$1() && !opts?.json && !opts?.plain);
|
|
860
|
+
const pad$1 = (value, size) => value.padEnd(size);
|
|
861
|
+
const formatTag = (tag, rich) => {
|
|
862
|
+
if (!rich) return tag;
|
|
863
|
+
if (tag === "default") return theme.success(tag);
|
|
864
|
+
if (tag === "image") return theme.accentBright(tag);
|
|
865
|
+
if (tag === "configured") return theme.accent(tag);
|
|
866
|
+
if (tag === "missing") return theme.error(tag);
|
|
867
|
+
if (tag.startsWith("fallback#")) return theme.warn(tag);
|
|
868
|
+
if (tag.startsWith("img-fallback#")) return theme.warn(tag);
|
|
869
|
+
if (tag.startsWith("alias:")) return theme.accentDim(tag);
|
|
870
|
+
return theme.muted(tag);
|
|
871
|
+
};
|
|
872
|
+
const truncate$1 = (value, max) => {
|
|
873
|
+
if (value.length <= max) return value;
|
|
874
|
+
if (max <= 3) return value.slice(0, max);
|
|
875
|
+
return `${value.slice(0, max - 3)}...`;
|
|
876
|
+
};
|
|
877
|
+
const maskApiKey = (value) => {
|
|
878
|
+
const trimmed = value.trim();
|
|
879
|
+
if (!trimmed) return "missing";
|
|
880
|
+
if (trimmed.length <= 16) return trimmed;
|
|
881
|
+
return `${trimmed.slice(0, 8)}...${trimmed.slice(-8)}`;
|
|
882
|
+
};
|
|
883
|
+
|
|
884
|
+
//#endregion
|
|
885
|
+
//#region src/commands/models/list.table.ts
|
|
886
|
+
const MODEL_PAD$1 = 42;
|
|
887
|
+
const INPUT_PAD = 10;
|
|
888
|
+
const CTX_PAD$1 = 8;
|
|
889
|
+
const LOCAL_PAD = 5;
|
|
890
|
+
const AUTH_PAD = 5;
|
|
891
|
+
function printModelTable(rows, runtime, opts = {}) {
|
|
892
|
+
if (opts.json) {
|
|
893
|
+
runtime.log(JSON.stringify({
|
|
894
|
+
count: rows.length,
|
|
895
|
+
models: rows
|
|
896
|
+
}, null, 2));
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
if (opts.plain) {
|
|
900
|
+
for (const row of rows) runtime.log(row.key);
|
|
901
|
+
return;
|
|
902
|
+
}
|
|
903
|
+
const rich = isRich(opts);
|
|
904
|
+
const header = [
|
|
905
|
+
pad$1("Model", MODEL_PAD$1),
|
|
906
|
+
pad$1("Input", INPUT_PAD),
|
|
907
|
+
pad$1("Ctx", CTX_PAD$1),
|
|
908
|
+
pad$1("Local", LOCAL_PAD),
|
|
909
|
+
pad$1("Auth", AUTH_PAD),
|
|
910
|
+
"Tags"
|
|
911
|
+
].join(" ");
|
|
912
|
+
runtime.log(rich ? theme.heading(header) : header);
|
|
913
|
+
for (const row of rows) {
|
|
914
|
+
const keyLabel = pad$1(truncate$1(row.key, MODEL_PAD$1), MODEL_PAD$1);
|
|
915
|
+
const inputLabel = pad$1(row.input || "-", INPUT_PAD);
|
|
916
|
+
const ctxLabel = pad$1(formatTokenK(row.contextWindow), CTX_PAD$1);
|
|
917
|
+
const localLabel = pad$1(row.local === null ? "-" : row.local ? "yes" : "no", LOCAL_PAD);
|
|
918
|
+
const authLabel = pad$1(row.available === null ? "-" : row.available ? "yes" : "no", AUTH_PAD);
|
|
919
|
+
const tagsLabel = row.tags.length > 0 ? rich ? row.tags.map((tag) => formatTag(tag, rich)).join(",") : row.tags.join(",") : "";
|
|
920
|
+
const coloredInput = colorize(rich, row.input.includes("image") ? theme.accentBright : theme.info, inputLabel);
|
|
921
|
+
const coloredLocal = colorize(rich, row.local === null ? theme.muted : row.local ? theme.success : theme.muted, localLabel);
|
|
922
|
+
const coloredAuth = colorize(rich, row.available === null ? theme.muted : row.available ? theme.success : theme.error, authLabel);
|
|
923
|
+
const line = [
|
|
924
|
+
rich ? theme.accent(keyLabel) : keyLabel,
|
|
925
|
+
coloredInput,
|
|
926
|
+
ctxLabel,
|
|
927
|
+
coloredLocal,
|
|
928
|
+
coloredAuth,
|
|
929
|
+
tagsLabel
|
|
930
|
+
].join(" ");
|
|
931
|
+
runtime.log(line);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
//#endregion
|
|
936
|
+
//#region src/commands/models/list.list-command.ts
|
|
937
|
+
async function modelsListCommand(opts, runtime) {
|
|
938
|
+
ensureFlagCompatibility(opts);
|
|
939
|
+
const cfg = loadConfig();
|
|
940
|
+
const authStore = ensureAuthProfileStore();
|
|
941
|
+
const providerFilter = (() => {
|
|
942
|
+
const raw = opts.provider?.trim();
|
|
943
|
+
if (!raw) return;
|
|
944
|
+
return parseModelRef(`${raw}/_`, DEFAULT_PROVIDER)?.provider ?? raw.toLowerCase();
|
|
945
|
+
})();
|
|
946
|
+
let models = [];
|
|
947
|
+
let availableKeys;
|
|
948
|
+
try {
|
|
949
|
+
const loaded = await loadModelRegistry(cfg);
|
|
950
|
+
models = loaded.models;
|
|
951
|
+
availableKeys = loaded.availableKeys;
|
|
952
|
+
} catch (err) {
|
|
953
|
+
runtime.error(`Model registry unavailable: ${String(err)}`);
|
|
954
|
+
}
|
|
955
|
+
const modelByKey = new Map(models.map((model) => [modelKey(model.provider, model.id), model]));
|
|
956
|
+
const { entries } = resolveConfiguredEntries(cfg);
|
|
957
|
+
const configuredByKey = new Map(entries.map((entry) => [entry.key, entry]));
|
|
958
|
+
const rows = [];
|
|
959
|
+
const isLocalBaseUrl = (baseUrl) => {
|
|
960
|
+
try {
|
|
961
|
+
const host = new URL(baseUrl).hostname.toLowerCase();
|
|
962
|
+
return host === "localhost" || host === "127.0.0.1" || host === "0.0.0.0" || host === "::1" || host.endsWith(".local");
|
|
963
|
+
} catch {
|
|
964
|
+
return false;
|
|
965
|
+
}
|
|
966
|
+
};
|
|
967
|
+
if (opts.all) {
|
|
968
|
+
const sorted = [...models].toSorted((a, b) => {
|
|
969
|
+
const p = a.provider.localeCompare(b.provider);
|
|
970
|
+
if (p !== 0) return p;
|
|
971
|
+
return a.id.localeCompare(b.id);
|
|
972
|
+
});
|
|
973
|
+
for (const model of sorted) {
|
|
974
|
+
if (providerFilter && model.provider.toLowerCase() !== providerFilter) continue;
|
|
975
|
+
if (opts.local && !isLocalBaseUrl(model.baseUrl)) continue;
|
|
976
|
+
const key = modelKey(model.provider, model.id);
|
|
977
|
+
const configured = configuredByKey.get(key);
|
|
978
|
+
rows.push(toModelRow({
|
|
979
|
+
model,
|
|
980
|
+
key,
|
|
981
|
+
tags: configured ? Array.from(configured.tags) : [],
|
|
982
|
+
aliases: configured?.aliases ?? [],
|
|
983
|
+
availableKeys,
|
|
984
|
+
cfg,
|
|
985
|
+
authStore
|
|
986
|
+
}));
|
|
987
|
+
}
|
|
988
|
+
} else for (const entry of entries) {
|
|
989
|
+
if (providerFilter && entry.ref.provider.toLowerCase() !== providerFilter) continue;
|
|
990
|
+
const model = modelByKey.get(entry.key);
|
|
991
|
+
if (opts.local && model && !isLocalBaseUrl(model.baseUrl)) continue;
|
|
992
|
+
if (opts.local && !model) continue;
|
|
993
|
+
rows.push(toModelRow({
|
|
994
|
+
model,
|
|
995
|
+
key: entry.key,
|
|
996
|
+
tags: Array.from(entry.tags),
|
|
997
|
+
aliases: entry.aliases,
|
|
998
|
+
availableKeys,
|
|
999
|
+
cfg,
|
|
1000
|
+
authStore
|
|
1001
|
+
}));
|
|
1002
|
+
}
|
|
1003
|
+
if (rows.length === 0) {
|
|
1004
|
+
runtime.log("No models found.");
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
printModelTable(rows, runtime, opts);
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
//#endregion
|
|
1011
|
+
//#region src/commands/models/list.auth-overview.ts
|
|
1012
|
+
function resolveProviderAuthOverview(params) {
|
|
1013
|
+
const { provider, cfg, store } = params;
|
|
1014
|
+
const now = Date.now();
|
|
1015
|
+
const profiles = listProfilesForProvider(store, provider);
|
|
1016
|
+
const withUnusableSuffix = (base, profileId) => {
|
|
1017
|
+
const unusableUntil = resolveProfileUnusableUntilForDisplay(store, profileId);
|
|
1018
|
+
if (!unusableUntil || now >= unusableUntil) return base;
|
|
1019
|
+
const stats = store.usageStats?.[profileId];
|
|
1020
|
+
return `${base} [${typeof stats?.disabledUntil === "number" && now < stats.disabledUntil ? `disabled${stats.disabledReason ? `:${stats.disabledReason}` : ""}` : "cooldown"} ${formatRemainingShort(unusableUntil - now)}]`;
|
|
1021
|
+
};
|
|
1022
|
+
const labels = profiles.map((profileId) => {
|
|
1023
|
+
const profile = store.profiles[profileId];
|
|
1024
|
+
if (!profile) return `${profileId}=missing`;
|
|
1025
|
+
if (profile.type === "api_key") return withUnusableSuffix(`${profileId}=${maskApiKey(profile.key ?? "")}`, profileId);
|
|
1026
|
+
if (profile.type === "token") return withUnusableSuffix(`${profileId}=token:${maskApiKey(profile.token)}`, profileId);
|
|
1027
|
+
const display = resolveAuthProfileDisplayLabel({
|
|
1028
|
+
cfg,
|
|
1029
|
+
store,
|
|
1030
|
+
profileId
|
|
1031
|
+
});
|
|
1032
|
+
const suffix = display === profileId ? "" : display.startsWith(profileId) ? display.slice(profileId.length).trim() : `(${display})`;
|
|
1033
|
+
return withUnusableSuffix(`${profileId}=OAuth${suffix ? ` ${suffix}` : ""}`, profileId);
|
|
1034
|
+
});
|
|
1035
|
+
const oauthCount = profiles.filter((id) => store.profiles[id]?.type === "oauth").length;
|
|
1036
|
+
const tokenCount = profiles.filter((id) => store.profiles[id]?.type === "token").length;
|
|
1037
|
+
const apiKeyCount = profiles.filter((id) => store.profiles[id]?.type === "api_key").length;
|
|
1038
|
+
const envKey = resolveEnvApiKey(provider);
|
|
1039
|
+
const customKey = getCustomProviderApiKey(cfg, provider);
|
|
1040
|
+
return {
|
|
1041
|
+
provider,
|
|
1042
|
+
effective: (() => {
|
|
1043
|
+
if (profiles.length > 0) return {
|
|
1044
|
+
kind: "profiles",
|
|
1045
|
+
detail: shortenHomePath(resolveAuthStorePathForDisplay())
|
|
1046
|
+
};
|
|
1047
|
+
if (envKey) return {
|
|
1048
|
+
kind: "env",
|
|
1049
|
+
detail: envKey.source.includes("OAUTH_TOKEN") || envKey.source.toLowerCase().includes("oauth") ? "OAuth (env)" : maskApiKey(envKey.apiKey)
|
|
1050
|
+
};
|
|
1051
|
+
if (customKey) return {
|
|
1052
|
+
kind: "models.json",
|
|
1053
|
+
detail: maskApiKey(customKey)
|
|
1054
|
+
};
|
|
1055
|
+
return {
|
|
1056
|
+
kind: "missing",
|
|
1057
|
+
detail: "missing"
|
|
1058
|
+
};
|
|
1059
|
+
})(),
|
|
1060
|
+
profiles: {
|
|
1061
|
+
count: profiles.length,
|
|
1062
|
+
oauth: oauthCount,
|
|
1063
|
+
token: tokenCount,
|
|
1064
|
+
apiKey: apiKeyCount,
|
|
1065
|
+
labels
|
|
1066
|
+
},
|
|
1067
|
+
...envKey ? { env: {
|
|
1068
|
+
value: envKey.source.includes("OAUTH_TOKEN") || envKey.source.toLowerCase().includes("oauth") ? "OAuth (env)" : maskApiKey(envKey.apiKey),
|
|
1069
|
+
source: envKey.source
|
|
1070
|
+
} } : {},
|
|
1071
|
+
...customKey ? { modelsJson: {
|
|
1072
|
+
value: maskApiKey(customKey),
|
|
1073
|
+
source: `models.json: ${shortenHomePath(params.modelsPath)}`
|
|
1074
|
+
} } : {}
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
//#endregion
|
|
1079
|
+
//#region src/commands/models/list.probe.ts
|
|
1080
|
+
const PROBE_PROMPT = "Reply with OK. Do not use tools.";
|
|
1081
|
+
const toStatus = (reason) => {
|
|
1082
|
+
if (!reason) return "unknown";
|
|
1083
|
+
if (reason === "auth") return "auth";
|
|
1084
|
+
if (reason === "rate_limit") return "rate_limit";
|
|
1085
|
+
if (reason === "billing") return "billing";
|
|
1086
|
+
if (reason === "timeout") return "timeout";
|
|
1087
|
+
if (reason === "format") return "format";
|
|
1088
|
+
return "unknown";
|
|
1089
|
+
};
|
|
1090
|
+
function buildCandidateMap(modelCandidates) {
|
|
1091
|
+
const map = /* @__PURE__ */ new Map();
|
|
1092
|
+
for (const raw of modelCandidates) {
|
|
1093
|
+
const parsed = parseModelRef(String(raw ?? ""), DEFAULT_PROVIDER);
|
|
1094
|
+
if (!parsed) continue;
|
|
1095
|
+
const list = map.get(parsed.provider) ?? [];
|
|
1096
|
+
if (!list.includes(parsed.model)) list.push(parsed.model);
|
|
1097
|
+
map.set(parsed.provider, list);
|
|
1098
|
+
}
|
|
1099
|
+
return map;
|
|
1100
|
+
}
|
|
1101
|
+
function selectProbeModel(params) {
|
|
1102
|
+
const { provider, candidates, catalog } = params;
|
|
1103
|
+
const direct = candidates.get(provider);
|
|
1104
|
+
if (direct && direct.length > 0) return {
|
|
1105
|
+
provider,
|
|
1106
|
+
model: direct[0]
|
|
1107
|
+
};
|
|
1108
|
+
const fromCatalog = catalog.find((entry) => entry.provider === provider);
|
|
1109
|
+
if (fromCatalog) return {
|
|
1110
|
+
provider: fromCatalog.provider,
|
|
1111
|
+
model: fromCatalog.id
|
|
1112
|
+
};
|
|
1113
|
+
return null;
|
|
1114
|
+
}
|
|
1115
|
+
function buildProbeTargets(params) {
|
|
1116
|
+
const { cfg, providers, modelCandidates, options } = params;
|
|
1117
|
+
const store = ensureAuthProfileStore();
|
|
1118
|
+
const providerFilter = options.provider?.trim();
|
|
1119
|
+
const providerFilterKey = providerFilter ? normalizeProviderId(providerFilter) : null;
|
|
1120
|
+
const profileFilter = new Set((options.profileIds ?? []).map((id) => id.trim()).filter(Boolean));
|
|
1121
|
+
return loadModelCatalog({ config: cfg }).then((catalog) => {
|
|
1122
|
+
const candidates = buildCandidateMap(modelCandidates);
|
|
1123
|
+
const targets = [];
|
|
1124
|
+
const results = [];
|
|
1125
|
+
for (const provider of providers) {
|
|
1126
|
+
const providerKey = normalizeProviderId(provider);
|
|
1127
|
+
if (providerFilterKey && providerKey !== providerFilterKey) continue;
|
|
1128
|
+
const model = selectProbeModel({
|
|
1129
|
+
provider: providerKey,
|
|
1130
|
+
candidates,
|
|
1131
|
+
catalog
|
|
1132
|
+
});
|
|
1133
|
+
const profileIds = listProfilesForProvider(store, providerKey);
|
|
1134
|
+
const explicitOrder = (() => {
|
|
1135
|
+
const order = store.order;
|
|
1136
|
+
if (order) {
|
|
1137
|
+
for (const [key, value] of Object.entries(order)) if (normalizeProviderId(key) === providerKey) return value;
|
|
1138
|
+
}
|
|
1139
|
+
const cfgOrder = cfg?.auth?.order;
|
|
1140
|
+
if (cfgOrder) {
|
|
1141
|
+
for (const [key, value] of Object.entries(cfgOrder)) if (normalizeProviderId(key) === providerKey) return value;
|
|
1142
|
+
}
|
|
1143
|
+
})();
|
|
1144
|
+
const allowedProfiles = explicitOrder && explicitOrder.length > 0 ? new Set(resolveAuthProfileOrder({
|
|
1145
|
+
cfg,
|
|
1146
|
+
store,
|
|
1147
|
+
provider: providerKey
|
|
1148
|
+
})) : null;
|
|
1149
|
+
const filteredProfiles = profileFilter.size ? profileIds.filter((id) => profileFilter.has(id)) : profileIds;
|
|
1150
|
+
if (filteredProfiles.length > 0) {
|
|
1151
|
+
for (const profileId of filteredProfiles) {
|
|
1152
|
+
const mode = store.profiles[profileId]?.type;
|
|
1153
|
+
const label = resolveAuthProfileDisplayLabel({
|
|
1154
|
+
cfg,
|
|
1155
|
+
store,
|
|
1156
|
+
profileId
|
|
1157
|
+
});
|
|
1158
|
+
if (explicitOrder && !explicitOrder.includes(profileId)) {
|
|
1159
|
+
results.push({
|
|
1160
|
+
provider: providerKey,
|
|
1161
|
+
model: model ? `${model.provider}/${model.model}` : void 0,
|
|
1162
|
+
profileId,
|
|
1163
|
+
label,
|
|
1164
|
+
source: "profile",
|
|
1165
|
+
mode,
|
|
1166
|
+
status: "unknown",
|
|
1167
|
+
error: "Excluded by auth.order for this provider."
|
|
1168
|
+
});
|
|
1169
|
+
continue;
|
|
1170
|
+
}
|
|
1171
|
+
if (allowedProfiles && !allowedProfiles.has(profileId)) {
|
|
1172
|
+
results.push({
|
|
1173
|
+
provider: providerKey,
|
|
1174
|
+
model: model ? `${model.provider}/${model.model}` : void 0,
|
|
1175
|
+
profileId,
|
|
1176
|
+
label,
|
|
1177
|
+
source: "profile",
|
|
1178
|
+
mode,
|
|
1179
|
+
status: "unknown",
|
|
1180
|
+
error: "Auth profile credentials are missing or expired."
|
|
1181
|
+
});
|
|
1182
|
+
continue;
|
|
1183
|
+
}
|
|
1184
|
+
if (!model) {
|
|
1185
|
+
results.push({
|
|
1186
|
+
provider: providerKey,
|
|
1187
|
+
model: void 0,
|
|
1188
|
+
profileId,
|
|
1189
|
+
label,
|
|
1190
|
+
source: "profile",
|
|
1191
|
+
mode,
|
|
1192
|
+
status: "no_model",
|
|
1193
|
+
error: "No model available for probe"
|
|
1194
|
+
});
|
|
1195
|
+
continue;
|
|
1196
|
+
}
|
|
1197
|
+
targets.push({
|
|
1198
|
+
provider: providerKey,
|
|
1199
|
+
model,
|
|
1200
|
+
profileId,
|
|
1201
|
+
label,
|
|
1202
|
+
source: "profile",
|
|
1203
|
+
mode
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1206
|
+
continue;
|
|
1207
|
+
}
|
|
1208
|
+
if (profileFilter.size > 0) continue;
|
|
1209
|
+
const envKey = resolveEnvApiKey(providerKey);
|
|
1210
|
+
const customKey = getCustomProviderApiKey(cfg, providerKey);
|
|
1211
|
+
if (!envKey && !customKey) continue;
|
|
1212
|
+
const label = envKey ? "env" : "models.json";
|
|
1213
|
+
const source = envKey ? "env" : "models.json";
|
|
1214
|
+
const mode = envKey?.source.includes("OAUTH_TOKEN") ? "oauth" : "api_key";
|
|
1215
|
+
if (!model) {
|
|
1216
|
+
results.push({
|
|
1217
|
+
provider: providerKey,
|
|
1218
|
+
model: void 0,
|
|
1219
|
+
label,
|
|
1220
|
+
source,
|
|
1221
|
+
mode,
|
|
1222
|
+
status: "no_model",
|
|
1223
|
+
error: "No model available for probe"
|
|
1224
|
+
});
|
|
1225
|
+
continue;
|
|
1226
|
+
}
|
|
1227
|
+
targets.push({
|
|
1228
|
+
provider: providerKey,
|
|
1229
|
+
model,
|
|
1230
|
+
label,
|
|
1231
|
+
source,
|
|
1232
|
+
mode
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
return {
|
|
1236
|
+
targets,
|
|
1237
|
+
results
|
|
1238
|
+
};
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
async function probeTarget(params) {
|
|
1242
|
+
const { cfg, agentId, agentDir, workspaceDir, sessionDir, target, timeoutMs, maxTokens } = params;
|
|
1243
|
+
if (!target.model) return {
|
|
1244
|
+
provider: target.provider,
|
|
1245
|
+
model: void 0,
|
|
1246
|
+
profileId: target.profileId,
|
|
1247
|
+
label: target.label,
|
|
1248
|
+
source: target.source,
|
|
1249
|
+
mode: target.mode,
|
|
1250
|
+
status: "no_model",
|
|
1251
|
+
error: "No model available for probe"
|
|
1252
|
+
};
|
|
1253
|
+
const sessionId = `probe-${target.provider}-${crypto.randomUUID()}`;
|
|
1254
|
+
const sessionFile = resolveSessionTranscriptPath(sessionId, agentId);
|
|
1255
|
+
await fs.mkdir(sessionDir, { recursive: true });
|
|
1256
|
+
const start = Date.now();
|
|
1257
|
+
try {
|
|
1258
|
+
await runEmbeddedPiAgent({
|
|
1259
|
+
sessionId,
|
|
1260
|
+
sessionFile,
|
|
1261
|
+
workspaceDir,
|
|
1262
|
+
agentDir,
|
|
1263
|
+
config: cfg,
|
|
1264
|
+
prompt: PROBE_PROMPT,
|
|
1265
|
+
provider: target.model.provider,
|
|
1266
|
+
model: target.model.model,
|
|
1267
|
+
authProfileId: target.profileId,
|
|
1268
|
+
authProfileIdSource: target.profileId ? "user" : void 0,
|
|
1269
|
+
timeoutMs,
|
|
1270
|
+
runId: `probe-${crypto.randomUUID()}`,
|
|
1271
|
+
lane: `auth-probe:${target.provider}:${target.profileId ?? target.source}`,
|
|
1272
|
+
thinkLevel: "off",
|
|
1273
|
+
reasoningLevel: "off",
|
|
1274
|
+
verboseLevel: "off",
|
|
1275
|
+
streamParams: { maxTokens }
|
|
1276
|
+
});
|
|
1277
|
+
return {
|
|
1278
|
+
provider: target.provider,
|
|
1279
|
+
model: `${target.model.provider}/${target.model.model}`,
|
|
1280
|
+
profileId: target.profileId,
|
|
1281
|
+
label: target.label,
|
|
1282
|
+
source: target.source,
|
|
1283
|
+
mode: target.mode,
|
|
1284
|
+
status: "ok",
|
|
1285
|
+
latencyMs: Date.now() - start
|
|
1286
|
+
};
|
|
1287
|
+
} catch (err) {
|
|
1288
|
+
const described = describeFailoverError(err);
|
|
1289
|
+
return {
|
|
1290
|
+
provider: target.provider,
|
|
1291
|
+
model: `${target.model.provider}/${target.model.model}`,
|
|
1292
|
+
profileId: target.profileId,
|
|
1293
|
+
label: target.label,
|
|
1294
|
+
source: target.source,
|
|
1295
|
+
mode: target.mode,
|
|
1296
|
+
status: toStatus(described.reason),
|
|
1297
|
+
error: redactSecrets(described.message),
|
|
1298
|
+
latencyMs: Date.now() - start
|
|
1299
|
+
};
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
async function runTargetsWithConcurrency(params) {
|
|
1303
|
+
const { cfg, targets, timeoutMs, maxTokens, onProgress } = params;
|
|
1304
|
+
const concurrency = Math.max(1, Math.min(targets.length || 1, params.concurrency));
|
|
1305
|
+
const agentId = resolveDefaultAgentId(cfg);
|
|
1306
|
+
const agentDir = resolveOpenClawAgentDir();
|
|
1307
|
+
const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId) ?? resolveDefaultAgentWorkspaceDir();
|
|
1308
|
+
const sessionDir = resolveSessionTranscriptsDirForAgent(agentId);
|
|
1309
|
+
await fs.mkdir(workspaceDir, { recursive: true });
|
|
1310
|
+
let completed = 0;
|
|
1311
|
+
const results = Array.from({ length: targets.length });
|
|
1312
|
+
let cursor = 0;
|
|
1313
|
+
const worker = async () => {
|
|
1314
|
+
while (true) {
|
|
1315
|
+
const index = cursor;
|
|
1316
|
+
cursor += 1;
|
|
1317
|
+
if (index >= targets.length) return;
|
|
1318
|
+
const target = targets[index];
|
|
1319
|
+
onProgress?.({
|
|
1320
|
+
completed,
|
|
1321
|
+
total: targets.length,
|
|
1322
|
+
label: `Probing ${target.provider}${target.profileId ? ` (${target.label})` : ""}`
|
|
1323
|
+
});
|
|
1324
|
+
results[index] = await probeTarget({
|
|
1325
|
+
cfg,
|
|
1326
|
+
agentId,
|
|
1327
|
+
agentDir,
|
|
1328
|
+
workspaceDir,
|
|
1329
|
+
sessionDir,
|
|
1330
|
+
target,
|
|
1331
|
+
timeoutMs,
|
|
1332
|
+
maxTokens
|
|
1333
|
+
});
|
|
1334
|
+
completed += 1;
|
|
1335
|
+
onProgress?.({
|
|
1336
|
+
completed,
|
|
1337
|
+
total: targets.length
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1341
|
+
await Promise.all(Array.from({ length: concurrency }, () => worker()));
|
|
1342
|
+
return results.filter((entry) => Boolean(entry));
|
|
1343
|
+
}
|
|
1344
|
+
async function runAuthProbes(params) {
|
|
1345
|
+
const startedAt = Date.now();
|
|
1346
|
+
const plan = await buildProbeTargets({
|
|
1347
|
+
cfg: params.cfg,
|
|
1348
|
+
providers: params.providers,
|
|
1349
|
+
modelCandidates: params.modelCandidates,
|
|
1350
|
+
options: params.options
|
|
1351
|
+
});
|
|
1352
|
+
const totalTargets = plan.targets.length;
|
|
1353
|
+
params.onProgress?.({
|
|
1354
|
+
completed: 0,
|
|
1355
|
+
total: totalTargets
|
|
1356
|
+
});
|
|
1357
|
+
const results = totalTargets ? await runTargetsWithConcurrency({
|
|
1358
|
+
cfg: params.cfg,
|
|
1359
|
+
targets: plan.targets,
|
|
1360
|
+
timeoutMs: params.options.timeoutMs,
|
|
1361
|
+
maxTokens: params.options.maxTokens,
|
|
1362
|
+
concurrency: params.options.concurrency,
|
|
1363
|
+
onProgress: params.onProgress
|
|
1364
|
+
}) : [];
|
|
1365
|
+
const finishedAt = Date.now();
|
|
1366
|
+
return {
|
|
1367
|
+
startedAt,
|
|
1368
|
+
finishedAt,
|
|
1369
|
+
durationMs: finishedAt - startedAt,
|
|
1370
|
+
totalTargets,
|
|
1371
|
+
options: params.options,
|
|
1372
|
+
results: [...plan.results, ...results]
|
|
1373
|
+
};
|
|
1374
|
+
}
|
|
1375
|
+
function formatProbeLatency(latencyMs) {
|
|
1376
|
+
if (!latencyMs && latencyMs !== 0) return "-";
|
|
1377
|
+
return formatMs(latencyMs);
|
|
1378
|
+
}
|
|
1379
|
+
function sortProbeResults(results) {
|
|
1380
|
+
return results.slice().toSorted((a, b) => {
|
|
1381
|
+
const provider = a.provider.localeCompare(b.provider);
|
|
1382
|
+
if (provider !== 0) return provider;
|
|
1383
|
+
const aLabel = a.label || a.profileId || "";
|
|
1384
|
+
const bLabel = b.label || b.profileId || "";
|
|
1385
|
+
return aLabel.localeCompare(bLabel);
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
function describeProbeSummary(summary) {
|
|
1389
|
+
if (summary.totalTargets === 0) return "No probe targets.";
|
|
1390
|
+
return `Probed ${summary.totalTargets} target${summary.totalTargets === 1 ? "" : "s"} in ${formatMs(summary.durationMs)}`;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
//#endregion
|
|
1394
|
+
//#region src/commands/models/list.status-command.ts
|
|
1395
|
+
async function modelsStatusCommand(opts, runtime) {
|
|
1396
|
+
ensureFlagCompatibility(opts);
|
|
1397
|
+
if (opts.plain && opts.probe) throw new Error("--probe cannot be used with --plain output.");
|
|
1398
|
+
const cfg = loadConfig();
|
|
1399
|
+
const agentId = resolveKnownAgentId({
|
|
1400
|
+
cfg,
|
|
1401
|
+
rawAgentId: opts.agent
|
|
1402
|
+
});
|
|
1403
|
+
const agentDir = agentId ? resolveAgentDir(cfg, agentId) : resolveOpenClawAgentDir();
|
|
1404
|
+
const agentModelPrimary = agentId ? resolveAgentModelPrimary(cfg, agentId) : void 0;
|
|
1405
|
+
const agentFallbacksOverride = agentId ? resolveAgentModelFallbacksOverride(cfg, agentId) : void 0;
|
|
1406
|
+
const resolved = agentId ? resolveDefaultModelForAgent({
|
|
1407
|
+
cfg,
|
|
1408
|
+
agentId
|
|
1409
|
+
}) : resolveConfiguredModelRef({
|
|
1410
|
+
cfg,
|
|
1411
|
+
defaultProvider: DEFAULT_PROVIDER,
|
|
1412
|
+
defaultModel: DEFAULT_MODEL
|
|
1413
|
+
});
|
|
1414
|
+
const modelConfig = cfg.agents?.defaults?.model;
|
|
1415
|
+
const imageConfig = cfg.agents?.defaults?.imageModel;
|
|
1416
|
+
const rawDefaultsModel = typeof modelConfig === "string" ? modelConfig.trim() : modelConfig?.primary?.trim() ?? "";
|
|
1417
|
+
const rawModel = agentModelPrimary ?? rawDefaultsModel;
|
|
1418
|
+
const resolvedLabel = `${resolved.provider}/${resolved.model}`;
|
|
1419
|
+
const defaultLabel = rawModel || resolvedLabel;
|
|
1420
|
+
const defaultsFallbacks = typeof modelConfig === "object" ? modelConfig?.fallbacks ?? [] : [];
|
|
1421
|
+
const fallbacks = agentFallbacksOverride ?? defaultsFallbacks;
|
|
1422
|
+
const imageModel = typeof imageConfig === "string" ? imageConfig.trim() : imageConfig?.primary?.trim() ?? "";
|
|
1423
|
+
const imageFallbacks = typeof imageConfig === "object" ? imageConfig?.fallbacks ?? [] : [];
|
|
1424
|
+
const aliases = Object.entries(cfg.agents?.defaults?.models ?? {}).reduce((acc, [key, entry]) => {
|
|
1425
|
+
const alias = entry?.alias?.trim();
|
|
1426
|
+
if (alias) acc[alias] = key;
|
|
1427
|
+
return acc;
|
|
1428
|
+
}, {});
|
|
1429
|
+
const allowed = Object.keys(cfg.agents?.defaults?.models ?? {});
|
|
1430
|
+
const store = ensureAuthProfileStore(agentDir);
|
|
1431
|
+
const modelsPath = path.join(agentDir, "models.json");
|
|
1432
|
+
const providersFromStore = new Set(Object.values(store.profiles).map((profile) => profile.provider).filter((p) => Boolean(p)));
|
|
1433
|
+
const providersFromConfig = new Set(Object.keys(cfg.models?.providers ?? {}).map((p) => p.trim()).filter(Boolean));
|
|
1434
|
+
const providersFromModels = /* @__PURE__ */ new Set();
|
|
1435
|
+
const providersInUse = /* @__PURE__ */ new Set();
|
|
1436
|
+
for (const raw of [
|
|
1437
|
+
defaultLabel,
|
|
1438
|
+
...fallbacks,
|
|
1439
|
+
imageModel,
|
|
1440
|
+
...imageFallbacks,
|
|
1441
|
+
...allowed
|
|
1442
|
+
]) {
|
|
1443
|
+
const parsed = parseModelRef(String(raw ?? ""), DEFAULT_PROVIDER);
|
|
1444
|
+
if (parsed?.provider) providersFromModels.add(parsed.provider);
|
|
1445
|
+
}
|
|
1446
|
+
for (const raw of [
|
|
1447
|
+
defaultLabel,
|
|
1448
|
+
...fallbacks,
|
|
1449
|
+
imageModel,
|
|
1450
|
+
...imageFallbacks
|
|
1451
|
+
]) {
|
|
1452
|
+
const parsed = parseModelRef(String(raw ?? ""), DEFAULT_PROVIDER);
|
|
1453
|
+
if (parsed?.provider) providersInUse.add(parsed.provider);
|
|
1454
|
+
}
|
|
1455
|
+
const providersFromEnv = /* @__PURE__ */ new Set();
|
|
1456
|
+
for (const provider of [
|
|
1457
|
+
"anthropic",
|
|
1458
|
+
"github-copilot",
|
|
1459
|
+
"google-vertex",
|
|
1460
|
+
"openai",
|
|
1461
|
+
"google",
|
|
1462
|
+
"groq",
|
|
1463
|
+
"cerebras",
|
|
1464
|
+
"xai",
|
|
1465
|
+
"openrouter",
|
|
1466
|
+
"zai",
|
|
1467
|
+
"mistral",
|
|
1468
|
+
"synthetic"
|
|
1469
|
+
]) if (resolveEnvApiKey(provider)) providersFromEnv.add(provider);
|
|
1470
|
+
const providers = Array.from(new Set([
|
|
1471
|
+
...providersFromStore,
|
|
1472
|
+
...providersFromConfig,
|
|
1473
|
+
...providersFromModels,
|
|
1474
|
+
...providersFromEnv
|
|
1475
|
+
])).map((p) => p.trim()).filter(Boolean).toSorted((a, b) => a.localeCompare(b));
|
|
1476
|
+
const applied = getShellEnvAppliedKeys();
|
|
1477
|
+
const shellFallbackEnabled = shouldEnableShellEnvFallback(process.env) || cfg.env?.shellEnv?.enabled === true;
|
|
1478
|
+
const providerAuth = providers.map((provider) => resolveProviderAuthOverview({
|
|
1479
|
+
provider,
|
|
1480
|
+
cfg,
|
|
1481
|
+
store,
|
|
1482
|
+
modelsPath
|
|
1483
|
+
})).filter((entry) => {
|
|
1484
|
+
return entry.profiles.count > 0 || Boolean(entry.env) || Boolean(entry.modelsJson);
|
|
1485
|
+
});
|
|
1486
|
+
const providerAuthMap = new Map(providerAuth.map((entry) => [entry.provider, entry]));
|
|
1487
|
+
const missingProvidersInUse = Array.from(providersInUse).filter((provider) => !providerAuthMap.has(provider)).toSorted((a, b) => a.localeCompare(b));
|
|
1488
|
+
const probeProfileIds = (() => {
|
|
1489
|
+
if (!opts.probeProfile) return [];
|
|
1490
|
+
return (Array.isArray(opts.probeProfile) ? opts.probeProfile : [opts.probeProfile]).flatMap((value) => String(value ?? "").split(",")).map((value) => value.trim()).filter(Boolean);
|
|
1491
|
+
})();
|
|
1492
|
+
const probeTimeoutMs = opts.probeTimeout ? Number(opts.probeTimeout) : 8e3;
|
|
1493
|
+
if (!Number.isFinite(probeTimeoutMs) || probeTimeoutMs <= 0) throw new Error("--probe-timeout must be a positive number (ms).");
|
|
1494
|
+
const probeConcurrency = opts.probeConcurrency ? Number(opts.probeConcurrency) : 2;
|
|
1495
|
+
if (!Number.isFinite(probeConcurrency) || probeConcurrency <= 0) throw new Error("--probe-concurrency must be > 0.");
|
|
1496
|
+
const probeMaxTokens = opts.probeMaxTokens ? Number(opts.probeMaxTokens) : 8;
|
|
1497
|
+
if (!Number.isFinite(probeMaxTokens) || probeMaxTokens <= 0) throw new Error("--probe-max-tokens must be > 0.");
|
|
1498
|
+
const aliasIndex = buildModelAliasIndex({
|
|
1499
|
+
cfg,
|
|
1500
|
+
defaultProvider: DEFAULT_PROVIDER
|
|
1501
|
+
});
|
|
1502
|
+
const modelCandidates = [
|
|
1503
|
+
rawModel || resolvedLabel,
|
|
1504
|
+
...fallbacks,
|
|
1505
|
+
imageModel,
|
|
1506
|
+
...imageFallbacks,
|
|
1507
|
+
...allowed
|
|
1508
|
+
].filter(Boolean).map((raw) => resolveModelRefFromString({
|
|
1509
|
+
raw: String(raw ?? ""),
|
|
1510
|
+
defaultProvider: DEFAULT_PROVIDER,
|
|
1511
|
+
aliasIndex
|
|
1512
|
+
})?.ref).filter((ref) => Boolean(ref)).map((ref) => `${ref.provider}/${ref.model}`);
|
|
1513
|
+
let probeSummary;
|
|
1514
|
+
if (opts.probe) probeSummary = await withProgressTotals({
|
|
1515
|
+
label: "Probing auth profiles…",
|
|
1516
|
+
total: 1
|
|
1517
|
+
}, async (update) => {
|
|
1518
|
+
return await runAuthProbes({
|
|
1519
|
+
cfg,
|
|
1520
|
+
providers,
|
|
1521
|
+
modelCandidates,
|
|
1522
|
+
options: {
|
|
1523
|
+
provider: opts.probeProvider,
|
|
1524
|
+
profileIds: probeProfileIds,
|
|
1525
|
+
timeoutMs: probeTimeoutMs,
|
|
1526
|
+
concurrency: probeConcurrency,
|
|
1527
|
+
maxTokens: probeMaxTokens
|
|
1528
|
+
},
|
|
1529
|
+
onProgress: update
|
|
1530
|
+
});
|
|
1531
|
+
});
|
|
1532
|
+
const providersWithOauth = providerAuth.filter((entry) => entry.profiles.oauth > 0 || entry.profiles.token > 0 || entry.env?.value === "OAuth (env)").map((entry) => {
|
|
1533
|
+
const count = entry.profiles.oauth + entry.profiles.token + (entry.env?.value === "OAuth (env)" ? 1 : 0);
|
|
1534
|
+
return `${entry.provider} (${count})`;
|
|
1535
|
+
});
|
|
1536
|
+
const authHealth = buildAuthHealthSummary({
|
|
1537
|
+
store,
|
|
1538
|
+
cfg,
|
|
1539
|
+
warnAfterMs: DEFAULT_OAUTH_WARN_MS,
|
|
1540
|
+
providers
|
|
1541
|
+
});
|
|
1542
|
+
const oauthProfiles = authHealth.profiles.filter((profile) => profile.type === "oauth" || profile.type === "token");
|
|
1543
|
+
const unusableProfiles = (() => {
|
|
1544
|
+
const now = Date.now();
|
|
1545
|
+
const out = [];
|
|
1546
|
+
for (const profileId of Object.keys(store.usageStats ?? {})) {
|
|
1547
|
+
const unusableUntil = resolveProfileUnusableUntilForDisplay(store, profileId);
|
|
1548
|
+
if (!unusableUntil || now >= unusableUntil) continue;
|
|
1549
|
+
const stats = store.usageStats?.[profileId];
|
|
1550
|
+
const kind = typeof stats?.disabledUntil === "number" && now < stats.disabledUntil ? "disabled" : "cooldown";
|
|
1551
|
+
out.push({
|
|
1552
|
+
profileId,
|
|
1553
|
+
provider: store.profiles[profileId]?.provider,
|
|
1554
|
+
kind,
|
|
1555
|
+
reason: stats?.disabledReason,
|
|
1556
|
+
until: unusableUntil,
|
|
1557
|
+
remainingMs: unusableUntil - now
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1560
|
+
return out.toSorted((a, b) => a.remainingMs - b.remainingMs);
|
|
1561
|
+
})();
|
|
1562
|
+
const checkStatus = (() => {
|
|
1563
|
+
const hasExpiredOrMissing = oauthProfiles.some((profile) => ["expired", "missing"].includes(profile.status)) || missingProvidersInUse.length > 0;
|
|
1564
|
+
const hasExpiring = oauthProfiles.some((profile) => profile.status === "expiring");
|
|
1565
|
+
if (hasExpiredOrMissing) return 1;
|
|
1566
|
+
if (hasExpiring) return 2;
|
|
1567
|
+
return 0;
|
|
1568
|
+
})();
|
|
1569
|
+
if (opts.json) {
|
|
1570
|
+
runtime.log(JSON.stringify({
|
|
1571
|
+
configPath: CONFIG_PATH,
|
|
1572
|
+
...agentId ? { agentId } : {},
|
|
1573
|
+
agentDir,
|
|
1574
|
+
defaultModel: defaultLabel,
|
|
1575
|
+
resolvedDefault: resolvedLabel,
|
|
1576
|
+
fallbacks,
|
|
1577
|
+
imageModel: imageModel || null,
|
|
1578
|
+
imageFallbacks,
|
|
1579
|
+
...agentId ? { modelConfig: {
|
|
1580
|
+
defaultSource: agentModelPrimary ? "agent" : "defaults",
|
|
1581
|
+
fallbacksSource: agentFallbacksOverride !== void 0 ? "agent" : "defaults"
|
|
1582
|
+
} } : {},
|
|
1583
|
+
aliases,
|
|
1584
|
+
allowed,
|
|
1585
|
+
auth: {
|
|
1586
|
+
storePath: resolveAuthStorePathForDisplay(agentDir),
|
|
1587
|
+
shellEnvFallback: {
|
|
1588
|
+
enabled: shellFallbackEnabled,
|
|
1589
|
+
appliedKeys: applied
|
|
1590
|
+
},
|
|
1591
|
+
providersWithOAuth: providersWithOauth,
|
|
1592
|
+
missingProvidersInUse,
|
|
1593
|
+
providers: providerAuth,
|
|
1594
|
+
unusableProfiles,
|
|
1595
|
+
oauth: {
|
|
1596
|
+
warnAfterMs: authHealth.warnAfterMs,
|
|
1597
|
+
profiles: authHealth.profiles,
|
|
1598
|
+
providers: authHealth.providers
|
|
1599
|
+
},
|
|
1600
|
+
probes: probeSummary
|
|
1601
|
+
}
|
|
1602
|
+
}, null, 2));
|
|
1603
|
+
if (opts.check) runtime.exit(checkStatus);
|
|
1604
|
+
return;
|
|
1605
|
+
}
|
|
1606
|
+
if (opts.plain) {
|
|
1607
|
+
runtime.log(resolvedLabel);
|
|
1608
|
+
if (opts.check) runtime.exit(checkStatus);
|
|
1609
|
+
return;
|
|
1610
|
+
}
|
|
1611
|
+
const rich = isRich(opts);
|
|
1612
|
+
const label = (value) => colorize(rich, theme.accent, value.padEnd(14));
|
|
1613
|
+
const labelWithSource = (value, source) => label(source ? `${value} (${source})` : value);
|
|
1614
|
+
const displayDefault = rawModel && rawModel !== resolvedLabel ? `${resolvedLabel} (from ${rawModel})` : resolvedLabel;
|
|
1615
|
+
runtime.log(`${label("Config")}${colorize(rich, theme.muted, ":")} ${colorize(rich, theme.info, shortenHomePath(CONFIG_PATH))}`);
|
|
1616
|
+
runtime.log(`${label("Agent dir")}${colorize(rich, theme.muted, ":")} ${colorize(rich, theme.info, shortenHomePath(agentDir))}`);
|
|
1617
|
+
runtime.log(`${labelWithSource("Default", agentId ? agentModelPrimary ? "agent" : "defaults" : void 0)}${colorize(rich, theme.muted, ":")} ${colorize(rich, theme.success, displayDefault)}`);
|
|
1618
|
+
runtime.log(`${labelWithSource(`Fallbacks (${fallbacks.length || 0})`, agentId ? agentFallbacksOverride !== void 0 ? "agent" : "defaults" : void 0)}${colorize(rich, theme.muted, ":")} ${colorize(rich, fallbacks.length ? theme.warn : theme.muted, fallbacks.length ? fallbacks.join(", ") : "-")}`);
|
|
1619
|
+
runtime.log(`${labelWithSource("Image model", agentId ? "defaults" : void 0)}${colorize(rich, theme.muted, ":")} ${colorize(rich, imageModel ? theme.accentBright : theme.muted, imageModel || "-")}`);
|
|
1620
|
+
runtime.log(`${labelWithSource(`Image fallbacks (${imageFallbacks.length || 0})`, agentId ? "defaults" : void 0)}${colorize(rich, theme.muted, ":")} ${colorize(rich, imageFallbacks.length ? theme.accentBright : theme.muted, imageFallbacks.length ? imageFallbacks.join(", ") : "-")}`);
|
|
1621
|
+
runtime.log(`${label(`Aliases (${Object.keys(aliases).length || 0})`)}${colorize(rich, theme.muted, ":")} ${colorize(rich, Object.keys(aliases).length ? theme.accent : theme.muted, Object.keys(aliases).length ? Object.entries(aliases).map(([alias, target]) => rich ? `${theme.accentDim(alias)} ${theme.muted("->")} ${theme.info(target)}` : `${alias} -> ${target}`).join(", ") : "-")}`);
|
|
1622
|
+
runtime.log(`${label(`Configured models (${allowed.length || 0})`)}${colorize(rich, theme.muted, ":")} ${colorize(rich, allowed.length ? theme.info : theme.muted, allowed.length ? allowed.join(", ") : "all")}`);
|
|
1623
|
+
runtime.log("");
|
|
1624
|
+
runtime.log(colorize(rich, theme.heading, "Auth overview"));
|
|
1625
|
+
runtime.log(`${label("Auth store")}${colorize(rich, theme.muted, ":")} ${colorize(rich, theme.info, shortenHomePath(resolveAuthStorePathForDisplay(agentDir)))}`);
|
|
1626
|
+
runtime.log(`${label("Shell env")}${colorize(rich, theme.muted, ":")} ${colorize(rich, shellFallbackEnabled ? theme.success : theme.muted, shellFallbackEnabled ? "on" : "off")}${applied.length ? colorize(rich, theme.muted, ` (applied: ${applied.join(", ")})`) : ""}`);
|
|
1627
|
+
runtime.log(`${label(`Providers w/ OAuth/tokens (${providersWithOauth.length || 0})`)}${colorize(rich, theme.muted, ":")} ${colorize(rich, providersWithOauth.length ? theme.info : theme.muted, providersWithOauth.length ? providersWithOauth.join(", ") : "-")}`);
|
|
1628
|
+
const formatKey = (key) => colorize(rich, theme.warn, key);
|
|
1629
|
+
const formatKeyValue = (key, value) => `${formatKey(key)}=${colorize(rich, theme.info, value)}`;
|
|
1630
|
+
const formatSeparator = () => colorize(rich, theme.muted, " | ");
|
|
1631
|
+
for (const entry of providerAuth) {
|
|
1632
|
+
const separator = formatSeparator();
|
|
1633
|
+
const bits = [];
|
|
1634
|
+
bits.push(formatKeyValue("effective", `${colorize(rich, theme.accentBright, entry.effective.kind)}:${colorize(rich, theme.muted, entry.effective.detail)}`));
|
|
1635
|
+
if (entry.profiles.count > 0) {
|
|
1636
|
+
bits.push(formatKeyValue("profiles", `${entry.profiles.count} (oauth=${entry.profiles.oauth}, token=${entry.profiles.token}, api_key=${entry.profiles.apiKey})`));
|
|
1637
|
+
if (entry.profiles.labels.length > 0) bits.push(colorize(rich, theme.info, entry.profiles.labels.join(", ")));
|
|
1638
|
+
}
|
|
1639
|
+
if (entry.env) bits.push(formatKeyValue("env", `${entry.env.value}${separator}${formatKeyValue("source", entry.env.source)}`));
|
|
1640
|
+
if (entry.modelsJson) bits.push(formatKeyValue("models.json", `${entry.modelsJson.value}${separator}${formatKeyValue("source", entry.modelsJson.source)}`));
|
|
1641
|
+
runtime.log(`- ${theme.heading(entry.provider)} ${bits.join(separator)}`);
|
|
1642
|
+
}
|
|
1643
|
+
if (missingProvidersInUse.length > 0) {
|
|
1644
|
+
runtime.log("");
|
|
1645
|
+
runtime.log(colorize(rich, theme.heading, "Missing auth"));
|
|
1646
|
+
for (const provider of missingProvidersInUse) {
|
|
1647
|
+
const hint = provider === "anthropic" ? `Run \`claude setup-token\`, then \`${formatCliCommand("openclaw models auth setup-token")}\` or \`${formatCliCommand("openclaw configure")}\`.` : `Run \`${formatCliCommand("openclaw configure")}\` or set an API key env var.`;
|
|
1648
|
+
runtime.log(`- ${theme.heading(provider)} ${hint}`);
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
runtime.log("");
|
|
1652
|
+
runtime.log(colorize(rich, theme.heading, "OAuth/token status"));
|
|
1653
|
+
if (oauthProfiles.length === 0) runtime.log(colorize(rich, theme.muted, "- none"));
|
|
1654
|
+
else {
|
|
1655
|
+
const usageByProvider = /* @__PURE__ */ new Map();
|
|
1656
|
+
const usageProviders = Array.from(new Set(oauthProfiles.map((profile) => resolveUsageProviderId(profile.provider)).filter((provider) => Boolean(provider))));
|
|
1657
|
+
if (usageProviders.length > 0) try {
|
|
1658
|
+
const usageSummary = await loadProviderUsageSummary({
|
|
1659
|
+
providers: usageProviders,
|
|
1660
|
+
agentDir,
|
|
1661
|
+
timeoutMs: 3500
|
|
1662
|
+
});
|
|
1663
|
+
for (const snapshot of usageSummary.providers) {
|
|
1664
|
+
const formatted = formatUsageWindowSummary(snapshot, {
|
|
1665
|
+
now: Date.now(),
|
|
1666
|
+
maxWindows: 2,
|
|
1667
|
+
includeResets: true
|
|
1668
|
+
});
|
|
1669
|
+
if (formatted) usageByProvider.set(snapshot.provider, formatted);
|
|
1670
|
+
}
|
|
1671
|
+
} catch {}
|
|
1672
|
+
const formatStatus = (status) => {
|
|
1673
|
+
if (status === "ok") return colorize(rich, theme.success, "ok");
|
|
1674
|
+
if (status === "static") return colorize(rich, theme.muted, "static");
|
|
1675
|
+
if (status === "expiring") return colorize(rich, theme.warn, "expiring");
|
|
1676
|
+
if (status === "missing") return colorize(rich, theme.warn, "unknown");
|
|
1677
|
+
return colorize(rich, theme.error, "expired");
|
|
1678
|
+
};
|
|
1679
|
+
const profilesByProvider = /* @__PURE__ */ new Map();
|
|
1680
|
+
for (const profile of oauthProfiles) {
|
|
1681
|
+
const current = profilesByProvider.get(profile.provider);
|
|
1682
|
+
if (current) current.push(profile);
|
|
1683
|
+
else profilesByProvider.set(profile.provider, [profile]);
|
|
1684
|
+
}
|
|
1685
|
+
for (const [provider, profiles] of profilesByProvider) {
|
|
1686
|
+
const usageKey = resolveUsageProviderId(provider);
|
|
1687
|
+
const usage = usageKey ? usageByProvider.get(usageKey) : void 0;
|
|
1688
|
+
const usageSuffix = usage ? colorize(rich, theme.muted, ` usage: ${usage}`) : "";
|
|
1689
|
+
runtime.log(`- ${colorize(rich, theme.heading, provider)}${usageSuffix}`);
|
|
1690
|
+
for (const profile of profiles) {
|
|
1691
|
+
const labelText = profile.label || profile.profileId;
|
|
1692
|
+
const label = colorize(rich, theme.accent, labelText);
|
|
1693
|
+
const status = formatStatus(profile.status);
|
|
1694
|
+
const expiry = profile.status === "static" ? "" : profile.expiresAt ? ` expires in ${formatRemainingShort(profile.remainingMs)}` : " expires unknown";
|
|
1695
|
+
runtime.log(` - ${label} ${status}${expiry}`);
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
if (probeSummary) {
|
|
1700
|
+
runtime.log("");
|
|
1701
|
+
runtime.log(colorize(rich, theme.heading, "Auth probes"));
|
|
1702
|
+
if (probeSummary.results.length === 0) runtime.log(colorize(rich, theme.muted, "- none"));
|
|
1703
|
+
else {
|
|
1704
|
+
const tableWidth = Math.max(60, (process.stdout.columns ?? 120) - 1);
|
|
1705
|
+
const sorted = sortProbeResults(probeSummary.results);
|
|
1706
|
+
const statusColor = (status) => {
|
|
1707
|
+
if (status === "ok") return theme.success;
|
|
1708
|
+
if (status === "rate_limit") return theme.warn;
|
|
1709
|
+
if (status === "timeout" || status === "billing") return theme.warn;
|
|
1710
|
+
if (status === "auth" || status === "format") return theme.error;
|
|
1711
|
+
if (status === "no_model") return theme.muted;
|
|
1712
|
+
return theme.muted;
|
|
1713
|
+
};
|
|
1714
|
+
const rows = sorted.map((result) => {
|
|
1715
|
+
const status = colorize(rich, statusColor(result.status), result.status);
|
|
1716
|
+
const latency = formatProbeLatency(result.latencyMs);
|
|
1717
|
+
const modelLabel = result.model ?? `${result.provider}/-`;
|
|
1718
|
+
const modeLabel = result.mode ? ` ${colorize(rich, theme.muted, `(${result.mode})`)}` : "";
|
|
1719
|
+
const profile = `${colorize(rich, theme.accent, result.label)}${modeLabel}`;
|
|
1720
|
+
const detail = result.error?.trim();
|
|
1721
|
+
const detailLabel = detail ? `\n${colorize(rich, theme.muted, `↳ ${detail}`)}` : "";
|
|
1722
|
+
const statusLabel = `${status}${colorize(rich, theme.muted, ` · ${latency}`)}${detailLabel}`;
|
|
1723
|
+
return {
|
|
1724
|
+
Model: colorize(rich, theme.heading, modelLabel),
|
|
1725
|
+
Profile: profile,
|
|
1726
|
+
Status: statusLabel
|
|
1727
|
+
};
|
|
1728
|
+
});
|
|
1729
|
+
runtime.log(renderTable({
|
|
1730
|
+
width: tableWidth,
|
|
1731
|
+
columns: [
|
|
1732
|
+
{
|
|
1733
|
+
key: "Model",
|
|
1734
|
+
header: "Model",
|
|
1735
|
+
minWidth: 18
|
|
1736
|
+
},
|
|
1737
|
+
{
|
|
1738
|
+
key: "Profile",
|
|
1739
|
+
header: "Profile",
|
|
1740
|
+
minWidth: 24
|
|
1741
|
+
},
|
|
1742
|
+
{
|
|
1743
|
+
key: "Status",
|
|
1744
|
+
header: "Status",
|
|
1745
|
+
minWidth: 12
|
|
1746
|
+
}
|
|
1747
|
+
],
|
|
1748
|
+
rows
|
|
1749
|
+
}).trimEnd());
|
|
1750
|
+
runtime.log(colorize(rich, theme.muted, describeProbeSummary(probeSummary)));
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
if (opts.check) runtime.exit(checkStatus);
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
//#endregion
|
|
1757
|
+
//#region src/agents/model-scan.ts
|
|
1758
|
+
const OPENROUTER_MODELS_URL = "https://openrouter.ai/api/v1/models";
|
|
1759
|
+
const DEFAULT_TIMEOUT_MS = 12e3;
|
|
1760
|
+
const DEFAULT_CONCURRENCY = 3;
|
|
1761
|
+
const BASE_IMAGE_PNG = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+X3mIAAAAASUVORK5CYII=";
|
|
1762
|
+
const TOOL_PING = {
|
|
1763
|
+
name: "ping",
|
|
1764
|
+
description: "Return OK.",
|
|
1765
|
+
parameters: Type.Object({})
|
|
1766
|
+
};
|
|
1767
|
+
function normalizeCreatedAtMs(value) {
|
|
1768
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return null;
|
|
1769
|
+
if (value <= 0) return null;
|
|
1770
|
+
if (value > 0xe8d4a51000) return Math.round(value);
|
|
1771
|
+
return Math.round(value * 1e3);
|
|
1772
|
+
}
|
|
1773
|
+
function inferParamBFromIdOrName(text) {
|
|
1774
|
+
const matches = text.toLowerCase().matchAll(/(?:^|[^a-z0-9])[a-z]?(\d+(?:\.\d+)?)b(?:[^a-z0-9]|$)/g);
|
|
1775
|
+
let best = null;
|
|
1776
|
+
for (const match of matches) {
|
|
1777
|
+
const numRaw = match[1];
|
|
1778
|
+
if (!numRaw) continue;
|
|
1779
|
+
const value = Number(numRaw);
|
|
1780
|
+
if (!Number.isFinite(value) || value <= 0) continue;
|
|
1781
|
+
if (best === null || value > best) best = value;
|
|
1782
|
+
}
|
|
1783
|
+
return best;
|
|
1784
|
+
}
|
|
1785
|
+
function parseModality(modality) {
|
|
1786
|
+
if (!modality) return ["text"];
|
|
1787
|
+
return modality.toLowerCase().split(/[^a-z]+/).filter(Boolean).includes("image") ? ["text", "image"] : ["text"];
|
|
1788
|
+
}
|
|
1789
|
+
function parseNumberString(value) {
|
|
1790
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
1791
|
+
if (typeof value !== "string") return null;
|
|
1792
|
+
const trimmed = value.trim();
|
|
1793
|
+
if (!trimmed) return null;
|
|
1794
|
+
const num = Number(trimmed);
|
|
1795
|
+
if (!Number.isFinite(num)) return null;
|
|
1796
|
+
return num;
|
|
1797
|
+
}
|
|
1798
|
+
function parseOpenRouterPricing(value) {
|
|
1799
|
+
if (!value || typeof value !== "object") return null;
|
|
1800
|
+
const obj = value;
|
|
1801
|
+
const prompt = parseNumberString(obj.prompt);
|
|
1802
|
+
const completion = parseNumberString(obj.completion);
|
|
1803
|
+
const request = parseNumberString(obj.request) ?? 0;
|
|
1804
|
+
const image = parseNumberString(obj.image) ?? 0;
|
|
1805
|
+
const webSearch = parseNumberString(obj.web_search) ?? 0;
|
|
1806
|
+
const internalReasoning = parseNumberString(obj.internal_reasoning) ?? 0;
|
|
1807
|
+
if (prompt === null || completion === null) return null;
|
|
1808
|
+
return {
|
|
1809
|
+
prompt,
|
|
1810
|
+
completion,
|
|
1811
|
+
request,
|
|
1812
|
+
image,
|
|
1813
|
+
webSearch,
|
|
1814
|
+
internalReasoning
|
|
1815
|
+
};
|
|
1816
|
+
}
|
|
1817
|
+
function isFreeOpenRouterModel(entry) {
|
|
1818
|
+
if (entry.id.endsWith(":free")) return true;
|
|
1819
|
+
if (!entry.pricing) return false;
|
|
1820
|
+
return entry.pricing.prompt === 0 && entry.pricing.completion === 0;
|
|
1821
|
+
}
|
|
1822
|
+
async function withTimeout(timeoutMs, fn) {
|
|
1823
|
+
const controller = new AbortController();
|
|
1824
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
1825
|
+
try {
|
|
1826
|
+
return await fn(controller.signal);
|
|
1827
|
+
} finally {
|
|
1828
|
+
clearTimeout(timer);
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
async function fetchOpenRouterModels(fetchImpl) {
|
|
1832
|
+
const res = await fetchImpl(OPENROUTER_MODELS_URL, { headers: { Accept: "application/json" } });
|
|
1833
|
+
if (!res.ok) throw new Error(`OpenRouter /models failed: HTTP ${res.status}`);
|
|
1834
|
+
const payload = await res.json();
|
|
1835
|
+
return (Array.isArray(payload.data) ? payload.data : []).map((entry) => {
|
|
1836
|
+
if (!entry || typeof entry !== "object") return null;
|
|
1837
|
+
const obj = entry;
|
|
1838
|
+
const id = typeof obj.id === "string" ? obj.id.trim() : "";
|
|
1839
|
+
if (!id) return null;
|
|
1840
|
+
const name = typeof obj.name === "string" && obj.name.trim() ? obj.name.trim() : id;
|
|
1841
|
+
const contextLength = typeof obj.context_length === "number" && Number.isFinite(obj.context_length) ? obj.context_length : null;
|
|
1842
|
+
const maxCompletionTokens = typeof obj.max_completion_tokens === "number" && Number.isFinite(obj.max_completion_tokens) ? obj.max_completion_tokens : typeof obj.max_output_tokens === "number" && Number.isFinite(obj.max_output_tokens) ? obj.max_output_tokens : null;
|
|
1843
|
+
const supportedParameters = Array.isArray(obj.supported_parameters) ? obj.supported_parameters.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean) : [];
|
|
1844
|
+
return {
|
|
1845
|
+
id,
|
|
1846
|
+
name,
|
|
1847
|
+
contextLength,
|
|
1848
|
+
maxCompletionTokens,
|
|
1849
|
+
supportedParameters,
|
|
1850
|
+
supportedParametersCount: supportedParameters.length,
|
|
1851
|
+
supportsToolsMeta: supportedParameters.includes("tools"),
|
|
1852
|
+
modality: typeof obj.modality === "string" && obj.modality.trim() ? obj.modality.trim() : null,
|
|
1853
|
+
inferredParamB: inferParamBFromIdOrName(`${id} ${name}`),
|
|
1854
|
+
createdAtMs: normalizeCreatedAtMs(obj.created_at),
|
|
1855
|
+
pricing: parseOpenRouterPricing(obj.pricing)
|
|
1856
|
+
};
|
|
1857
|
+
}).filter((entry) => Boolean(entry));
|
|
1858
|
+
}
|
|
1859
|
+
async function probeTool(model, apiKey, timeoutMs) {
|
|
1860
|
+
const context = {
|
|
1861
|
+
messages: [{
|
|
1862
|
+
role: "user",
|
|
1863
|
+
content: "Call the ping tool with {} and nothing else.",
|
|
1864
|
+
timestamp: Date.now()
|
|
1865
|
+
}],
|
|
1866
|
+
tools: [TOOL_PING]
|
|
1867
|
+
};
|
|
1868
|
+
const startedAt = Date.now();
|
|
1869
|
+
try {
|
|
1870
|
+
if (!(await withTimeout(timeoutMs, (signal) => complete(model, context, {
|
|
1871
|
+
apiKey,
|
|
1872
|
+
maxTokens: 32,
|
|
1873
|
+
temperature: 0,
|
|
1874
|
+
toolChoice: "required",
|
|
1875
|
+
signal
|
|
1876
|
+
}))).content.some((block) => block.type === "toolCall")) return {
|
|
1877
|
+
ok: false,
|
|
1878
|
+
latencyMs: Date.now() - startedAt,
|
|
1879
|
+
error: "No tool call returned"
|
|
1880
|
+
};
|
|
1881
|
+
return {
|
|
1882
|
+
ok: true,
|
|
1883
|
+
latencyMs: Date.now() - startedAt
|
|
1884
|
+
};
|
|
1885
|
+
} catch (err) {
|
|
1886
|
+
return {
|
|
1887
|
+
ok: false,
|
|
1888
|
+
latencyMs: Date.now() - startedAt,
|
|
1889
|
+
error: err instanceof Error ? err.message : String(err)
|
|
1890
|
+
};
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
async function probeImage(model, apiKey, timeoutMs) {
|
|
1894
|
+
const context = { messages: [{
|
|
1895
|
+
role: "user",
|
|
1896
|
+
content: [{
|
|
1897
|
+
type: "text",
|
|
1898
|
+
text: "Reply with OK."
|
|
1899
|
+
}, {
|
|
1900
|
+
type: "image",
|
|
1901
|
+
data: BASE_IMAGE_PNG,
|
|
1902
|
+
mimeType: "image/png"
|
|
1903
|
+
}],
|
|
1904
|
+
timestamp: Date.now()
|
|
1905
|
+
}] };
|
|
1906
|
+
const startedAt = Date.now();
|
|
1907
|
+
try {
|
|
1908
|
+
await withTimeout(timeoutMs, (signal) => complete(model, context, {
|
|
1909
|
+
apiKey,
|
|
1910
|
+
maxTokens: 16,
|
|
1911
|
+
temperature: 0,
|
|
1912
|
+
signal
|
|
1913
|
+
}));
|
|
1914
|
+
return {
|
|
1915
|
+
ok: true,
|
|
1916
|
+
latencyMs: Date.now() - startedAt
|
|
1917
|
+
};
|
|
1918
|
+
} catch (err) {
|
|
1919
|
+
return {
|
|
1920
|
+
ok: false,
|
|
1921
|
+
latencyMs: Date.now() - startedAt,
|
|
1922
|
+
error: err instanceof Error ? err.message : String(err)
|
|
1923
|
+
};
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
function ensureImageInput(model) {
|
|
1927
|
+
if (model.input.includes("image")) return model;
|
|
1928
|
+
return {
|
|
1929
|
+
...model,
|
|
1930
|
+
input: Array.from(new Set([...model.input, "image"]))
|
|
1931
|
+
};
|
|
1932
|
+
}
|
|
1933
|
+
async function mapWithConcurrency(items, concurrency, fn, opts) {
|
|
1934
|
+
const limit = Math.max(1, Math.floor(concurrency));
|
|
1935
|
+
const results = Array.from({ length: items.length }, () => void 0);
|
|
1936
|
+
let nextIndex = 0;
|
|
1937
|
+
let completed = 0;
|
|
1938
|
+
const worker = async () => {
|
|
1939
|
+
while (true) {
|
|
1940
|
+
const current = nextIndex;
|
|
1941
|
+
nextIndex += 1;
|
|
1942
|
+
if (current >= items.length) return;
|
|
1943
|
+
results[current] = await fn(items[current], current);
|
|
1944
|
+
completed += 1;
|
|
1945
|
+
opts?.onProgress?.(completed, items.length);
|
|
1946
|
+
}
|
|
1947
|
+
};
|
|
1948
|
+
if (items.length === 0) {
|
|
1949
|
+
opts?.onProgress?.(0, 0);
|
|
1950
|
+
return results;
|
|
1951
|
+
}
|
|
1952
|
+
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()));
|
|
1953
|
+
return results;
|
|
1954
|
+
}
|
|
1955
|
+
async function scanOpenRouterModels(options = {}) {
|
|
1956
|
+
const fetchImpl = options.fetchImpl ?? fetch;
|
|
1957
|
+
const probe = options.probe ?? true;
|
|
1958
|
+
const apiKey = options.apiKey?.trim() || getEnvApiKey("openrouter") || "";
|
|
1959
|
+
if (probe && !apiKey) throw new Error("Missing OpenRouter API key. Set OPENROUTER_API_KEY to run models scan.");
|
|
1960
|
+
const timeoutMs = Math.max(1, Math.floor(options.timeoutMs ?? DEFAULT_TIMEOUT_MS));
|
|
1961
|
+
const concurrency = Math.max(1, Math.floor(options.concurrency ?? DEFAULT_CONCURRENCY));
|
|
1962
|
+
const minParamB = Math.max(0, Math.floor(options.minParamB ?? 0));
|
|
1963
|
+
const maxAgeDays = Math.max(0, Math.floor(options.maxAgeDays ?? 0));
|
|
1964
|
+
const providerFilter = options.providerFilter?.trim().toLowerCase() ?? "";
|
|
1965
|
+
const catalog = await fetchOpenRouterModels(fetchImpl);
|
|
1966
|
+
const now = Date.now();
|
|
1967
|
+
const filtered = catalog.filter((entry) => {
|
|
1968
|
+
if (!isFreeOpenRouterModel(entry)) return false;
|
|
1969
|
+
if (providerFilter) {
|
|
1970
|
+
if ((entry.id.split("/")[0]?.toLowerCase() ?? "") !== providerFilter) return false;
|
|
1971
|
+
}
|
|
1972
|
+
if (minParamB > 0) {
|
|
1973
|
+
if ((entry.inferredParamB ?? 0) < minParamB) return false;
|
|
1974
|
+
}
|
|
1975
|
+
if (maxAgeDays > 0 && entry.createdAtMs) {
|
|
1976
|
+
if ((now - entry.createdAtMs) / (1440 * 60 * 1e3) > maxAgeDays) return false;
|
|
1977
|
+
}
|
|
1978
|
+
return true;
|
|
1979
|
+
});
|
|
1980
|
+
const baseModel = getModel("openrouter", "openrouter/auto");
|
|
1981
|
+
options.onProgress?.({
|
|
1982
|
+
phase: "probe",
|
|
1983
|
+
completed: 0,
|
|
1984
|
+
total: filtered.length
|
|
1985
|
+
});
|
|
1986
|
+
return mapWithConcurrency(filtered, concurrency, async (entry) => {
|
|
1987
|
+
const isFree = isFreeOpenRouterModel(entry);
|
|
1988
|
+
if (!probe) return {
|
|
1989
|
+
id: entry.id,
|
|
1990
|
+
name: entry.name,
|
|
1991
|
+
provider: "openrouter",
|
|
1992
|
+
modelRef: `openrouter/${entry.id}`,
|
|
1993
|
+
contextLength: entry.contextLength,
|
|
1994
|
+
maxCompletionTokens: entry.maxCompletionTokens,
|
|
1995
|
+
supportedParametersCount: entry.supportedParametersCount,
|
|
1996
|
+
supportsToolsMeta: entry.supportsToolsMeta,
|
|
1997
|
+
modality: entry.modality,
|
|
1998
|
+
inferredParamB: entry.inferredParamB,
|
|
1999
|
+
createdAtMs: entry.createdAtMs,
|
|
2000
|
+
pricing: entry.pricing,
|
|
2001
|
+
isFree,
|
|
2002
|
+
tool: {
|
|
2003
|
+
ok: false,
|
|
2004
|
+
latencyMs: null,
|
|
2005
|
+
skipped: true
|
|
2006
|
+
},
|
|
2007
|
+
image: {
|
|
2008
|
+
ok: false,
|
|
2009
|
+
latencyMs: null,
|
|
2010
|
+
skipped: true
|
|
2011
|
+
}
|
|
2012
|
+
};
|
|
2013
|
+
const model = {
|
|
2014
|
+
...baseModel,
|
|
2015
|
+
id: entry.id,
|
|
2016
|
+
name: entry.name || entry.id,
|
|
2017
|
+
contextWindow: entry.contextLength ?? baseModel.contextWindow,
|
|
2018
|
+
maxTokens: entry.maxCompletionTokens ?? baseModel.maxTokens,
|
|
2019
|
+
input: parseModality(entry.modality),
|
|
2020
|
+
reasoning: baseModel.reasoning
|
|
2021
|
+
};
|
|
2022
|
+
const toolResult = await probeTool(model, apiKey, timeoutMs);
|
|
2023
|
+
const imageResult = model.input.includes("image") ? await probeImage(ensureImageInput(model), apiKey, timeoutMs) : {
|
|
2024
|
+
ok: false,
|
|
2025
|
+
latencyMs: null,
|
|
2026
|
+
skipped: true
|
|
2027
|
+
};
|
|
2028
|
+
return {
|
|
2029
|
+
id: entry.id,
|
|
2030
|
+
name: entry.name,
|
|
2031
|
+
provider: "openrouter",
|
|
2032
|
+
modelRef: `openrouter/${entry.id}`,
|
|
2033
|
+
contextLength: entry.contextLength,
|
|
2034
|
+
maxCompletionTokens: entry.maxCompletionTokens,
|
|
2035
|
+
supportedParametersCount: entry.supportedParametersCount,
|
|
2036
|
+
supportsToolsMeta: entry.supportsToolsMeta,
|
|
2037
|
+
modality: entry.modality,
|
|
2038
|
+
inferredParamB: entry.inferredParamB,
|
|
2039
|
+
createdAtMs: entry.createdAtMs,
|
|
2040
|
+
pricing: entry.pricing,
|
|
2041
|
+
isFree,
|
|
2042
|
+
tool: toolResult,
|
|
2043
|
+
image: imageResult
|
|
2044
|
+
};
|
|
2045
|
+
}, { onProgress: (completed, total) => options.onProgress?.({
|
|
2046
|
+
phase: "probe",
|
|
2047
|
+
completed,
|
|
2048
|
+
total
|
|
2049
|
+
}) });
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
//#endregion
|
|
2053
|
+
//#region src/commands/models/scan.ts
|
|
2054
|
+
const MODEL_PAD = 42;
|
|
2055
|
+
const CTX_PAD = 8;
|
|
2056
|
+
const multiselect$1 = (params) => multiselect({
|
|
2057
|
+
...params,
|
|
2058
|
+
message: stylePromptMessage(params.message),
|
|
2059
|
+
options: params.options.map((opt) => opt.hint === void 0 ? opt : {
|
|
2060
|
+
...opt,
|
|
2061
|
+
hint: stylePromptHint(opt.hint)
|
|
2062
|
+
})
|
|
2063
|
+
});
|
|
2064
|
+
const pad = (value, size) => value.padEnd(size);
|
|
2065
|
+
const truncate = (value, max) => {
|
|
2066
|
+
if (value.length <= max) return value;
|
|
2067
|
+
if (max <= 3) return value.slice(0, max);
|
|
2068
|
+
return `${value.slice(0, max - 3)}...`;
|
|
2069
|
+
};
|
|
2070
|
+
function sortScanResults(results) {
|
|
2071
|
+
return results.slice().toSorted((a, b) => {
|
|
2072
|
+
const aImage = a.image.ok ? 1 : 0;
|
|
2073
|
+
const bImage = b.image.ok ? 1 : 0;
|
|
2074
|
+
if (aImage !== bImage) return bImage - aImage;
|
|
2075
|
+
const aToolLatency = a.tool.latencyMs ?? Number.POSITIVE_INFINITY;
|
|
2076
|
+
const bToolLatency = b.tool.latencyMs ?? Number.POSITIVE_INFINITY;
|
|
2077
|
+
if (aToolLatency !== bToolLatency) return aToolLatency - bToolLatency;
|
|
2078
|
+
const aCtx = a.contextLength ?? 0;
|
|
2079
|
+
const bCtx = b.contextLength ?? 0;
|
|
2080
|
+
if (aCtx !== bCtx) return bCtx - aCtx;
|
|
2081
|
+
const aParams = a.inferredParamB ?? 0;
|
|
2082
|
+
const bParams = b.inferredParamB ?? 0;
|
|
2083
|
+
if (aParams !== bParams) return bParams - aParams;
|
|
2084
|
+
return a.modelRef.localeCompare(b.modelRef);
|
|
2085
|
+
});
|
|
2086
|
+
}
|
|
2087
|
+
function sortImageResults(results) {
|
|
2088
|
+
return results.slice().toSorted((a, b) => {
|
|
2089
|
+
const aLatency = a.image.latencyMs ?? Number.POSITIVE_INFINITY;
|
|
2090
|
+
const bLatency = b.image.latencyMs ?? Number.POSITIVE_INFINITY;
|
|
2091
|
+
if (aLatency !== bLatency) return aLatency - bLatency;
|
|
2092
|
+
const aCtx = a.contextLength ?? 0;
|
|
2093
|
+
const bCtx = b.contextLength ?? 0;
|
|
2094
|
+
if (aCtx !== bCtx) return bCtx - aCtx;
|
|
2095
|
+
const aParams = a.inferredParamB ?? 0;
|
|
2096
|
+
const bParams = b.inferredParamB ?? 0;
|
|
2097
|
+
if (aParams !== bParams) return bParams - aParams;
|
|
2098
|
+
return a.modelRef.localeCompare(b.modelRef);
|
|
2099
|
+
});
|
|
2100
|
+
}
|
|
2101
|
+
function buildScanHint(result) {
|
|
2102
|
+
return [
|
|
2103
|
+
result.tool.ok ? `tool ${formatMs(result.tool.latencyMs)}` : "tool fail",
|
|
2104
|
+
result.image.skipped ? "img skip" : result.image.ok ? `img ${formatMs(result.image.latencyMs)}` : "img fail",
|
|
2105
|
+
result.contextLength ? `ctx ${formatTokenK(result.contextLength)}` : "ctx ?",
|
|
2106
|
+
result.inferredParamB ? `${result.inferredParamB}b` : null
|
|
2107
|
+
].filter(Boolean).join(" | ");
|
|
2108
|
+
}
|
|
2109
|
+
function printScanSummary(results, runtime) {
|
|
2110
|
+
const toolOk = results.filter((r) => r.tool.ok);
|
|
2111
|
+
const imageOk = results.filter((r) => r.image.ok);
|
|
2112
|
+
const toolImageOk = results.filter((r) => r.tool.ok && r.image.ok);
|
|
2113
|
+
const imageOnly = imageOk.filter((r) => !r.tool.ok);
|
|
2114
|
+
runtime.log(`Scan results: tested ${results.length}, tool ok ${toolOk.length}, image ok ${imageOk.length}, tool+image ok ${toolImageOk.length}, image only ${imageOnly.length}`);
|
|
2115
|
+
}
|
|
2116
|
+
function printScanTable(results, runtime) {
|
|
2117
|
+
const header = [
|
|
2118
|
+
pad("Model", MODEL_PAD),
|
|
2119
|
+
pad("Tool", 10),
|
|
2120
|
+
pad("Image", 10),
|
|
2121
|
+
pad("Ctx", CTX_PAD),
|
|
2122
|
+
pad("Params", 8),
|
|
2123
|
+
"Notes"
|
|
2124
|
+
].join(" ");
|
|
2125
|
+
runtime.log(header);
|
|
2126
|
+
for (const entry of results) {
|
|
2127
|
+
const modelLabel = pad(truncate(entry.modelRef, MODEL_PAD), MODEL_PAD);
|
|
2128
|
+
const toolLabel = pad(entry.tool.ok ? formatMs(entry.tool.latencyMs) : "fail", 10);
|
|
2129
|
+
const imageLabel = pad(entry.image.ok ? formatMs(entry.image.latencyMs) : entry.image.skipped ? "skip" : "fail", 10);
|
|
2130
|
+
const ctxLabel = pad(formatTokenK(entry.contextLength), CTX_PAD);
|
|
2131
|
+
const paramsLabel = pad(entry.inferredParamB ? `${entry.inferredParamB}b` : "-", 8);
|
|
2132
|
+
const notes = entry.modality ? `modality:${entry.modality}` : "";
|
|
2133
|
+
runtime.log([
|
|
2134
|
+
modelLabel,
|
|
2135
|
+
toolLabel,
|
|
2136
|
+
imageLabel,
|
|
2137
|
+
ctxLabel,
|
|
2138
|
+
paramsLabel,
|
|
2139
|
+
notes
|
|
2140
|
+
].join(" "));
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
async function modelsScanCommand(opts, runtime) {
|
|
2144
|
+
const minParams = opts.minParams ? Number(opts.minParams) : void 0;
|
|
2145
|
+
if (minParams !== void 0 && (!Number.isFinite(minParams) || minParams < 0)) throw new Error("--min-params must be >= 0");
|
|
2146
|
+
const maxAgeDays = opts.maxAgeDays ? Number(opts.maxAgeDays) : void 0;
|
|
2147
|
+
if (maxAgeDays !== void 0 && (!Number.isFinite(maxAgeDays) || maxAgeDays < 0)) throw new Error("--max-age-days must be >= 0");
|
|
2148
|
+
const maxCandidates = opts.maxCandidates ? Number(opts.maxCandidates) : 6;
|
|
2149
|
+
if (!Number.isFinite(maxCandidates) || maxCandidates <= 0) throw new Error("--max-candidates must be > 0");
|
|
2150
|
+
const timeout = opts.timeout ? Number(opts.timeout) : void 0;
|
|
2151
|
+
if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout <= 0)) throw new Error("--timeout must be > 0");
|
|
2152
|
+
const concurrency = opts.concurrency ? Number(opts.concurrency) : void 0;
|
|
2153
|
+
if (concurrency !== void 0 && (!Number.isFinite(concurrency) || concurrency <= 0)) throw new Error("--concurrency must be > 0");
|
|
2154
|
+
const cfg = loadConfig();
|
|
2155
|
+
const probe = opts.probe ?? true;
|
|
2156
|
+
let storedKey;
|
|
2157
|
+
if (probe) try {
|
|
2158
|
+
storedKey = (await resolveApiKeyForProvider({
|
|
2159
|
+
provider: "openrouter",
|
|
2160
|
+
cfg
|
|
2161
|
+
})).apiKey;
|
|
2162
|
+
} catch {
|
|
2163
|
+
storedKey = void 0;
|
|
2164
|
+
}
|
|
2165
|
+
const results = await withProgressTotals({
|
|
2166
|
+
label: "Scanning OpenRouter models...",
|
|
2167
|
+
indeterminate: false,
|
|
2168
|
+
enabled: opts.json !== true
|
|
2169
|
+
}, async (update) => await scanOpenRouterModels({
|
|
2170
|
+
apiKey: storedKey ?? void 0,
|
|
2171
|
+
minParamB: minParams,
|
|
2172
|
+
maxAgeDays,
|
|
2173
|
+
providerFilter: opts.provider,
|
|
2174
|
+
timeoutMs: timeout,
|
|
2175
|
+
concurrency,
|
|
2176
|
+
probe,
|
|
2177
|
+
onProgress: ({ phase, completed, total }) => {
|
|
2178
|
+
if (phase !== "probe") return;
|
|
2179
|
+
update({
|
|
2180
|
+
completed,
|
|
2181
|
+
total,
|
|
2182
|
+
label: `${probe ? "Probing models" : "Scanning models"} (${completed}/${total})`
|
|
2183
|
+
});
|
|
2184
|
+
}
|
|
2185
|
+
}));
|
|
2186
|
+
if (!probe) {
|
|
2187
|
+
if (!opts.json) {
|
|
2188
|
+
runtime.log(`Found ${results.length} OpenRouter free models (metadata only; pass --probe to test tools/images).`);
|
|
2189
|
+
printScanTable(sortScanResults(results), runtime);
|
|
2190
|
+
} else runtime.log(JSON.stringify(results, null, 2));
|
|
2191
|
+
return;
|
|
2192
|
+
}
|
|
2193
|
+
const toolOk = results.filter((entry) => entry.tool.ok);
|
|
2194
|
+
if (toolOk.length === 0) throw new Error("No tool-capable OpenRouter free models found.");
|
|
2195
|
+
const sorted = sortScanResults(results);
|
|
2196
|
+
const toolSorted = sortScanResults(toolOk);
|
|
2197
|
+
const imageSorted = sortImageResults(results.filter((entry) => entry.image.ok));
|
|
2198
|
+
const imagePreferred = toolSorted.filter((entry) => entry.image.ok);
|
|
2199
|
+
const preselected = (imagePreferred.length > 0 ? imagePreferred : toolSorted).slice(0, Math.floor(maxCandidates)).map((entry) => entry.modelRef);
|
|
2200
|
+
const imagePreselected = imageSorted.slice(0, Math.floor(maxCandidates)).map((entry) => entry.modelRef);
|
|
2201
|
+
if (!opts.json) {
|
|
2202
|
+
printScanSummary(results, runtime);
|
|
2203
|
+
printScanTable(sorted, runtime);
|
|
2204
|
+
}
|
|
2205
|
+
const noInput = opts.input === false;
|
|
2206
|
+
const canPrompt = process.stdin.isTTY && !opts.yes && !noInput && !opts.json;
|
|
2207
|
+
let selected = preselected;
|
|
2208
|
+
let selectedImages = imagePreselected;
|
|
2209
|
+
if (canPrompt) {
|
|
2210
|
+
const selection = await multiselect$1({
|
|
2211
|
+
message: "Select fallback models (ordered)",
|
|
2212
|
+
options: toolSorted.map((entry) => ({
|
|
2213
|
+
value: entry.modelRef,
|
|
2214
|
+
label: entry.modelRef,
|
|
2215
|
+
hint: buildScanHint(entry)
|
|
2216
|
+
})),
|
|
2217
|
+
initialValues: preselected
|
|
2218
|
+
});
|
|
2219
|
+
if (isCancel(selection)) {
|
|
2220
|
+
cancel(stylePromptTitle("Model scan cancelled.") ?? "Model scan cancelled.");
|
|
2221
|
+
runtime.exit(0);
|
|
2222
|
+
}
|
|
2223
|
+
selected = selection;
|
|
2224
|
+
if (imageSorted.length > 0) {
|
|
2225
|
+
const imageSelection = await multiselect$1({
|
|
2226
|
+
message: "Select image fallback models (ordered)",
|
|
2227
|
+
options: imageSorted.map((entry) => ({
|
|
2228
|
+
value: entry.modelRef,
|
|
2229
|
+
label: entry.modelRef,
|
|
2230
|
+
hint: buildScanHint(entry)
|
|
2231
|
+
})),
|
|
2232
|
+
initialValues: imagePreselected
|
|
2233
|
+
});
|
|
2234
|
+
if (isCancel(imageSelection)) {
|
|
2235
|
+
cancel(stylePromptTitle("Model scan cancelled.") ?? "Model scan cancelled.");
|
|
2236
|
+
runtime.exit(0);
|
|
2237
|
+
}
|
|
2238
|
+
selectedImages = imageSelection;
|
|
2239
|
+
}
|
|
2240
|
+
} else if (!process.stdin.isTTY && !opts.yes && !noInput && !opts.json) throw new Error("Non-interactive scan: pass --yes to apply defaults.");
|
|
2241
|
+
if (selected.length === 0) throw new Error("No models selected for fallbacks.");
|
|
2242
|
+
if (opts.setImage && selectedImages.length === 0) throw new Error("No image-capable models selected for image model.");
|
|
2243
|
+
await updateConfig((cfg) => {
|
|
2244
|
+
const nextModels = { ...cfg.agents?.defaults?.models };
|
|
2245
|
+
for (const entry of selected) if (!nextModels[entry]) nextModels[entry] = {};
|
|
2246
|
+
for (const entry of selectedImages) if (!nextModels[entry]) nextModels[entry] = {};
|
|
2247
|
+
const existingImageModel = cfg.agents?.defaults?.imageModel;
|
|
2248
|
+
const nextImageModel = selectedImages.length > 0 ? {
|
|
2249
|
+
...existingImageModel?.primary ? { primary: existingImageModel.primary } : void 0,
|
|
2250
|
+
fallbacks: selectedImages,
|
|
2251
|
+
...opts.setImage ? { primary: selectedImages[0] } : {}
|
|
2252
|
+
} : cfg.agents?.defaults?.imageModel;
|
|
2253
|
+
const existingModel = cfg.agents?.defaults?.model;
|
|
2254
|
+
const defaults = {
|
|
2255
|
+
...cfg.agents?.defaults,
|
|
2256
|
+
model: {
|
|
2257
|
+
...existingModel?.primary ? { primary: existingModel.primary } : void 0,
|
|
2258
|
+
fallbacks: selected,
|
|
2259
|
+
...opts.setDefault ? { primary: selected[0] } : {}
|
|
2260
|
+
},
|
|
2261
|
+
...nextImageModel ? { imageModel: nextImageModel } : {},
|
|
2262
|
+
models: nextModels
|
|
2263
|
+
};
|
|
2264
|
+
return {
|
|
2265
|
+
...cfg,
|
|
2266
|
+
agents: {
|
|
2267
|
+
...cfg.agents,
|
|
2268
|
+
defaults
|
|
2269
|
+
}
|
|
2270
|
+
};
|
|
2271
|
+
});
|
|
2272
|
+
if (opts.json) {
|
|
2273
|
+
runtime.log(JSON.stringify({
|
|
2274
|
+
selected,
|
|
2275
|
+
selectedImages,
|
|
2276
|
+
setDefault: Boolean(opts.setDefault),
|
|
2277
|
+
setImage: Boolean(opts.setImage),
|
|
2278
|
+
results,
|
|
2279
|
+
warnings: []
|
|
2280
|
+
}, null, 2));
|
|
2281
|
+
return;
|
|
2282
|
+
}
|
|
2283
|
+
logConfigUpdated(runtime);
|
|
2284
|
+
runtime.log(`Fallbacks: ${selected.join(", ")}`);
|
|
2285
|
+
if (selectedImages.length > 0) runtime.log(`Image fallbacks: ${selectedImages.join(", ")}`);
|
|
2286
|
+
if (opts.setDefault) runtime.log(`Default model: ${selected[0]}`);
|
|
2287
|
+
if (opts.setImage && selectedImages.length > 0) runtime.log(`Image model: ${selectedImages[0]}`);
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
//#endregion
|
|
2291
|
+
//#region src/commands/models/set.ts
|
|
2292
|
+
async function modelsSetCommand(modelRaw, runtime) {
|
|
2293
|
+
const updated = await updateConfig((cfg) => {
|
|
2294
|
+
const resolved = resolveModelTarget({
|
|
2295
|
+
raw: modelRaw,
|
|
2296
|
+
cfg
|
|
2297
|
+
});
|
|
2298
|
+
const key = `${resolved.provider}/${resolved.model}`;
|
|
2299
|
+
const nextModels = { ...cfg.agents?.defaults?.models };
|
|
2300
|
+
if (!nextModels[key]) nextModels[key] = {};
|
|
2301
|
+
const existingModel = cfg.agents?.defaults?.model;
|
|
2302
|
+
return {
|
|
2303
|
+
...cfg,
|
|
2304
|
+
agents: {
|
|
2305
|
+
...cfg.agents,
|
|
2306
|
+
defaults: {
|
|
2307
|
+
...cfg.agents?.defaults,
|
|
2308
|
+
model: {
|
|
2309
|
+
...existingModel?.fallbacks ? { fallbacks: existingModel.fallbacks } : void 0,
|
|
2310
|
+
primary: key
|
|
2311
|
+
},
|
|
2312
|
+
models: nextModels
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
};
|
|
2316
|
+
});
|
|
2317
|
+
logConfigUpdated(runtime);
|
|
2318
|
+
runtime.log(`Default model: ${updated.agents?.defaults?.model?.primary ?? modelRaw}`);
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
//#endregion
|
|
2322
|
+
//#region src/commands/models/set-image.ts
|
|
2323
|
+
async function modelsSetImageCommand(modelRaw, runtime) {
|
|
2324
|
+
const updated = await updateConfig((cfg) => {
|
|
2325
|
+
const resolved = resolveModelTarget({
|
|
2326
|
+
raw: modelRaw,
|
|
2327
|
+
cfg
|
|
2328
|
+
});
|
|
2329
|
+
const key = `${resolved.provider}/${resolved.model}`;
|
|
2330
|
+
const nextModels = { ...cfg.agents?.defaults?.models };
|
|
2331
|
+
if (!nextModels[key]) nextModels[key] = {};
|
|
2332
|
+
const existingModel = cfg.agents?.defaults?.imageModel;
|
|
2333
|
+
return {
|
|
2334
|
+
...cfg,
|
|
2335
|
+
agents: {
|
|
2336
|
+
...cfg.agents,
|
|
2337
|
+
defaults: {
|
|
2338
|
+
...cfg.agents?.defaults,
|
|
2339
|
+
imageModel: {
|
|
2340
|
+
...existingModel?.fallbacks ? { fallbacks: existingModel.fallbacks } : void 0,
|
|
2341
|
+
primary: key
|
|
2342
|
+
},
|
|
2343
|
+
models: nextModels
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
};
|
|
2347
|
+
});
|
|
2348
|
+
logConfigUpdated(runtime);
|
|
2349
|
+
runtime.log(`Image model: ${updated.agents?.defaults?.imageModel?.primary ?? modelRaw}`);
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
//#endregion
|
|
2353
|
+
//#region src/cli/models-cli.ts
|
|
2354
|
+
function runModelsCommand(action) {
|
|
2355
|
+
return runCommandWithRuntime(defaultRuntime, action);
|
|
2356
|
+
}
|
|
2357
|
+
function registerModelsCli(program) {
|
|
2358
|
+
const models = program.command("models").description("Model discovery, scanning, and configuration").option("--status-json", "Output JSON (alias for `models status --json`)", false).option("--status-plain", "Plain output (alias for `models status --plain`)", false).option("--agent <id>", "Agent id to inspect (overrides OPENCLAW_AGENT_DIR/PI_CODING_AGENT_DIR)").addHelpText("after", () => `\n${theme.muted("Docs:")} ${formatDocsLink("/cli/models", "docs.openclaw.ai/cli/models")}\n`);
|
|
2359
|
+
models.command("list").description("List models (configured by default)").option("--all", "Show full model catalog", false).option("--local", "Filter to local models", false).option("--provider <name>", "Filter by provider").option("--json", "Output JSON", false).option("--plain", "Plain line output", false).action(async (opts) => {
|
|
2360
|
+
await runModelsCommand(async () => {
|
|
2361
|
+
await modelsListCommand(opts, defaultRuntime);
|
|
2362
|
+
});
|
|
2363
|
+
});
|
|
2364
|
+
models.command("status").description("Show configured model state").option("--json", "Output JSON", false).option("--plain", "Plain output", false).option("--check", "Exit non-zero if auth is expiring/expired (1=expired/missing, 2=expiring)", false).option("--probe", "Probe configured provider auth (live)", false).option("--probe-provider <name>", "Only probe a single provider").option("--probe-profile <id>", "Only probe specific auth profile ids (repeat or comma-separated)", (value, previous) => {
|
|
2365
|
+
const next = Array.isArray(previous) ? previous : previous ? [previous] : [];
|
|
2366
|
+
next.push(value);
|
|
2367
|
+
return next;
|
|
2368
|
+
}).option("--probe-timeout <ms>", "Per-probe timeout in ms").option("--probe-concurrency <n>", "Concurrent probes").option("--probe-max-tokens <n>", "Probe max tokens (best-effort)").option("--agent <id>", "Agent id to inspect (overrides OPENCLAW_AGENT_DIR/PI_CODING_AGENT_DIR)").action(async (opts, command) => {
|
|
2369
|
+
const agent = resolveOptionFromCommand(command, "agent") ?? opts.agent;
|
|
2370
|
+
await runModelsCommand(async () => {
|
|
2371
|
+
await modelsStatusCommand({
|
|
2372
|
+
json: Boolean(opts.json),
|
|
2373
|
+
plain: Boolean(opts.plain),
|
|
2374
|
+
check: Boolean(opts.check),
|
|
2375
|
+
probe: Boolean(opts.probe),
|
|
2376
|
+
probeProvider: opts.probeProvider,
|
|
2377
|
+
probeProfile: opts.probeProfile,
|
|
2378
|
+
probeTimeout: opts.probeTimeout,
|
|
2379
|
+
probeConcurrency: opts.probeConcurrency,
|
|
2380
|
+
probeMaxTokens: opts.probeMaxTokens,
|
|
2381
|
+
agent
|
|
2382
|
+
}, defaultRuntime);
|
|
2383
|
+
});
|
|
2384
|
+
});
|
|
2385
|
+
models.command("set").description("Set the default model").argument("<model>", "Model id or alias").action(async (model) => {
|
|
2386
|
+
await runModelsCommand(async () => {
|
|
2387
|
+
await modelsSetCommand(model, defaultRuntime);
|
|
2388
|
+
});
|
|
2389
|
+
});
|
|
2390
|
+
models.command("set-image").description("Set the image model").argument("<model>", "Model id or alias").action(async (model) => {
|
|
2391
|
+
await runModelsCommand(async () => {
|
|
2392
|
+
await modelsSetImageCommand(model, defaultRuntime);
|
|
2393
|
+
});
|
|
2394
|
+
});
|
|
2395
|
+
const aliases = models.command("aliases").description("Manage model aliases");
|
|
2396
|
+
aliases.command("list").description("List model aliases").option("--json", "Output JSON", false).option("--plain", "Plain output", false).action(async (opts) => {
|
|
2397
|
+
await runModelsCommand(async () => {
|
|
2398
|
+
await modelsAliasesListCommand(opts, defaultRuntime);
|
|
2399
|
+
});
|
|
2400
|
+
});
|
|
2401
|
+
aliases.command("add").description("Add or update a model alias").argument("<alias>", "Alias name").argument("<model>", "Model id or alias").action(async (alias, model) => {
|
|
2402
|
+
await runModelsCommand(async () => {
|
|
2403
|
+
await modelsAliasesAddCommand(alias, model, defaultRuntime);
|
|
2404
|
+
});
|
|
2405
|
+
});
|
|
2406
|
+
aliases.command("remove").description("Remove a model alias").argument("<alias>", "Alias name").action(async (alias) => {
|
|
2407
|
+
await runModelsCommand(async () => {
|
|
2408
|
+
await modelsAliasesRemoveCommand(alias, defaultRuntime);
|
|
2409
|
+
});
|
|
2410
|
+
});
|
|
2411
|
+
const fallbacks = models.command("fallbacks").description("Manage model fallback list");
|
|
2412
|
+
fallbacks.command("list").description("List fallback models").option("--json", "Output JSON", false).option("--plain", "Plain output", false).action(async (opts) => {
|
|
2413
|
+
await runModelsCommand(async () => {
|
|
2414
|
+
await modelsFallbacksListCommand(opts, defaultRuntime);
|
|
2415
|
+
});
|
|
2416
|
+
});
|
|
2417
|
+
fallbacks.command("add").description("Add a fallback model").argument("<model>", "Model id or alias").action(async (model) => {
|
|
2418
|
+
await runModelsCommand(async () => {
|
|
2419
|
+
await modelsFallbacksAddCommand(model, defaultRuntime);
|
|
2420
|
+
});
|
|
2421
|
+
});
|
|
2422
|
+
fallbacks.command("remove").description("Remove a fallback model").argument("<model>", "Model id or alias").action(async (model) => {
|
|
2423
|
+
await runModelsCommand(async () => {
|
|
2424
|
+
await modelsFallbacksRemoveCommand(model, defaultRuntime);
|
|
2425
|
+
});
|
|
2426
|
+
});
|
|
2427
|
+
fallbacks.command("clear").description("Clear all fallback models").action(async () => {
|
|
2428
|
+
await runModelsCommand(async () => {
|
|
2429
|
+
await modelsFallbacksClearCommand(defaultRuntime);
|
|
2430
|
+
});
|
|
2431
|
+
});
|
|
2432
|
+
const imageFallbacks = models.command("image-fallbacks").description("Manage image model fallback list");
|
|
2433
|
+
imageFallbacks.command("list").description("List image fallback models").option("--json", "Output JSON", false).option("--plain", "Plain output", false).action(async (opts) => {
|
|
2434
|
+
await runModelsCommand(async () => {
|
|
2435
|
+
await modelsImageFallbacksListCommand(opts, defaultRuntime);
|
|
2436
|
+
});
|
|
2437
|
+
});
|
|
2438
|
+
imageFallbacks.command("add").description("Add an image fallback model").argument("<model>", "Model id or alias").action(async (model) => {
|
|
2439
|
+
await runModelsCommand(async () => {
|
|
2440
|
+
await modelsImageFallbacksAddCommand(model, defaultRuntime);
|
|
2441
|
+
});
|
|
2442
|
+
});
|
|
2443
|
+
imageFallbacks.command("remove").description("Remove an image fallback model").argument("<model>", "Model id or alias").action(async (model) => {
|
|
2444
|
+
await runModelsCommand(async () => {
|
|
2445
|
+
await modelsImageFallbacksRemoveCommand(model, defaultRuntime);
|
|
2446
|
+
});
|
|
2447
|
+
});
|
|
2448
|
+
imageFallbacks.command("clear").description("Clear all image fallback models").action(async () => {
|
|
2449
|
+
await runModelsCommand(async () => {
|
|
2450
|
+
await modelsImageFallbacksClearCommand(defaultRuntime);
|
|
2451
|
+
});
|
|
2452
|
+
});
|
|
2453
|
+
models.command("scan").description("Scan OpenRouter free models for tools + images").option("--min-params <b>", "Minimum parameter size (billions)").option("--max-age-days <days>", "Skip models older than N days").option("--provider <name>", "Filter by provider prefix").option("--max-candidates <n>", "Max fallback candidates", "6").option("--timeout <ms>", "Per-probe timeout in ms").option("--concurrency <n>", "Probe concurrency").option("--no-probe", "Skip live probes; list free candidates only").option("--yes", "Accept defaults without prompting", false).option("--no-input", "Disable prompts (use defaults)").option("--set-default", "Set agents.defaults.model to the first selection", false).option("--set-image", "Set agents.defaults.imageModel to the first image selection", false).option("--json", "Output JSON", false).action(async (opts) => {
|
|
2454
|
+
await runModelsCommand(async () => {
|
|
2455
|
+
await modelsScanCommand(opts, defaultRuntime);
|
|
2456
|
+
});
|
|
2457
|
+
});
|
|
2458
|
+
models.action(async (opts) => {
|
|
2459
|
+
await runModelsCommand(async () => {
|
|
2460
|
+
await modelsStatusCommand({
|
|
2461
|
+
json: Boolean(opts?.statusJson),
|
|
2462
|
+
plain: Boolean(opts?.statusPlain),
|
|
2463
|
+
agent: opts?.agent
|
|
2464
|
+
}, defaultRuntime);
|
|
2465
|
+
});
|
|
2466
|
+
});
|
|
2467
|
+
const auth = models.command("auth").description("Manage model auth profiles");
|
|
2468
|
+
auth.option("--agent <id>", "Agent id for auth order get/set/clear");
|
|
2469
|
+
auth.action(() => {
|
|
2470
|
+
auth.help();
|
|
2471
|
+
});
|
|
2472
|
+
auth.command("add").description("Interactive auth helper (setup-token or paste token)").action(async () => {
|
|
2473
|
+
await runModelsCommand(async () => {
|
|
2474
|
+
await modelsAuthAddCommand({}, defaultRuntime);
|
|
2475
|
+
});
|
|
2476
|
+
});
|
|
2477
|
+
auth.command("login").description("Run a provider plugin auth flow (OAuth/API key)").option("--provider <id>", "Provider id registered by a plugin").option("--method <id>", "Provider auth method id").option("--set-default", "Apply the provider's default model recommendation", false).action(async (opts) => {
|
|
2478
|
+
await runModelsCommand(async () => {
|
|
2479
|
+
await modelsAuthLoginCommand({
|
|
2480
|
+
provider: opts.provider,
|
|
2481
|
+
method: opts.method,
|
|
2482
|
+
setDefault: Boolean(opts.setDefault)
|
|
2483
|
+
}, defaultRuntime);
|
|
2484
|
+
});
|
|
2485
|
+
});
|
|
2486
|
+
auth.command("setup-token").description("Run a provider CLI to create/sync a token (TTY required)").option("--provider <name>", "Provider id (default: anthropic)").option("--yes", "Skip confirmation", false).action(async (opts) => {
|
|
2487
|
+
await runModelsCommand(async () => {
|
|
2488
|
+
await modelsAuthSetupTokenCommand({
|
|
2489
|
+
provider: opts.provider,
|
|
2490
|
+
yes: Boolean(opts.yes)
|
|
2491
|
+
}, defaultRuntime);
|
|
2492
|
+
});
|
|
2493
|
+
});
|
|
2494
|
+
auth.command("paste-token").description("Paste a token into auth-profiles.json and update config").requiredOption("--provider <name>", "Provider id (e.g. anthropic)").option("--profile-id <id>", "Auth profile id (default: <provider>:manual)").option("--expires-in <duration>", "Optional expiry duration (e.g. 365d, 12h). Stored as absolute expiresAt.").action(async (opts) => {
|
|
2495
|
+
await runModelsCommand(async () => {
|
|
2496
|
+
await modelsAuthPasteTokenCommand({
|
|
2497
|
+
provider: opts.provider,
|
|
2498
|
+
profileId: opts.profileId,
|
|
2499
|
+
expiresIn: opts.expiresIn
|
|
2500
|
+
}, defaultRuntime);
|
|
2501
|
+
});
|
|
2502
|
+
});
|
|
2503
|
+
auth.command("login-github-copilot").description("Login to GitHub Copilot via GitHub device flow (TTY required)").option("--profile-id <id>", "Auth profile id (default: github-copilot:github)").option("--yes", "Overwrite existing profile without prompting", false).action(async (opts) => {
|
|
2504
|
+
await runModelsCommand(async () => {
|
|
2505
|
+
await githubCopilotLoginCommand({
|
|
2506
|
+
profileId: opts.profileId,
|
|
2507
|
+
yes: Boolean(opts.yes)
|
|
2508
|
+
}, defaultRuntime);
|
|
2509
|
+
});
|
|
2510
|
+
});
|
|
2511
|
+
const order = auth.command("order").description("Manage per-agent auth profile order overrides");
|
|
2512
|
+
order.command("get").description("Show per-agent auth order override (from auth-profiles.json)").requiredOption("--provider <name>", "Provider id (e.g. anthropic)").option("--agent <id>", "Agent id (default: configured default agent)").option("--json", "Output JSON", false).action(async (opts, command) => {
|
|
2513
|
+
const agent = resolveOptionFromCommand(command, "agent") ?? opts.agent;
|
|
2514
|
+
await runModelsCommand(async () => {
|
|
2515
|
+
await modelsAuthOrderGetCommand({
|
|
2516
|
+
provider: opts.provider,
|
|
2517
|
+
agent,
|
|
2518
|
+
json: Boolean(opts.json)
|
|
2519
|
+
}, defaultRuntime);
|
|
2520
|
+
});
|
|
2521
|
+
});
|
|
2522
|
+
order.command("set").description("Set per-agent auth order override (locks rotation to this list)").requiredOption("--provider <name>", "Provider id (e.g. anthropic)").option("--agent <id>", "Agent id (default: configured default agent)").argument("<profileIds...>", "Auth profile ids (e.g. anthropic:default)").action(async (profileIds, opts, command) => {
|
|
2523
|
+
const agent = resolveOptionFromCommand(command, "agent") ?? opts.agent;
|
|
2524
|
+
await runModelsCommand(async () => {
|
|
2525
|
+
await modelsAuthOrderSetCommand({
|
|
2526
|
+
provider: opts.provider,
|
|
2527
|
+
agent,
|
|
2528
|
+
order: profileIds
|
|
2529
|
+
}, defaultRuntime);
|
|
2530
|
+
});
|
|
2531
|
+
});
|
|
2532
|
+
order.command("clear").description("Clear per-agent auth order override (fall back to config/round-robin)").requiredOption("--provider <name>", "Provider id (e.g. anthropic)").option("--agent <id>", "Agent id (default: configured default agent)").action(async (opts, command) => {
|
|
2533
|
+
const agent = resolveOptionFromCommand(command, "agent") ?? opts.agent;
|
|
2534
|
+
await runModelsCommand(async () => {
|
|
2535
|
+
await modelsAuthOrderClearCommand({
|
|
2536
|
+
provider: opts.provider,
|
|
2537
|
+
agent
|
|
2538
|
+
}, defaultRuntime);
|
|
2539
|
+
});
|
|
2540
|
+
});
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
//#endregion
|
|
2544
|
+
export { registerModelsCli };
|