@noxsoft/anima 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1260 -28
- package/dist/accounts-Bth3PpPD.js +260 -0
- package/dist/accounts-D8CPKNkN.js +259 -0
- package/dist/acp-cli-ByK6lS6c.js +1081 -0
- package/dist/acp-cli-CaQCjIw4.js +1084 -0
- package/dist/agent-BgIkqd3F.js +725 -0
- package/dist/agent-N5BDcge4.js +725 -0
- package/dist/agent-events-COH7NDW2.js +182 -0
- package/dist/agent-scope-CPphqq-U.js +452 -0
- package/dist/agent-scope-DZgptr9J.js +452 -0
- package/dist/agent-scope-cj2QCT6R.js +112 -0
- package/dist/agents-NEudYMdg.js +774 -0
- package/dist/agents.config-Bujs-NIy.js +182 -0
- package/dist/agents.config-jp7OLssr.js +182 -0
- package/dist/argv-BMZMiW7v.js +73 -0
- package/dist/audit-C-UJhfdv.js +2401 -0
- package/dist/audit-CeCO7SK5.js +2401 -0
- package/dist/auth-BNZsOHGF.js +648 -0
- package/dist/auth-DMPZWzEa.js +639 -0
- package/dist/auth-choice-5VnaGMD-.js +2681 -0
- package/dist/auth-choice-DA2k4vs8.js +2681 -0
- package/dist/auth-health-B7FqA26_.js +149 -0
- package/dist/auth-health-VO_MPqVX.js +149 -0
- package/dist/auth-profiles-BDrNYX_n.js +1564 -0
- package/dist/auth-profiles-CxSHydjn.js +2689 -0
- package/dist/banner-BtDZPRzi.js +294 -0
- package/dist/browser-cli-8yQMpxb8.js +1679 -0
- package/dist/browser-cli-Czg3JtDH.js +1676 -0
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +16 -16
- package/dist/bundled/bootstrap-extra-files/handler.js +4 -4
- package/dist/bundled/command-logger/handler.js +1 -1
- package/dist/bundled/session-memory/handler.js +5 -5
- package/dist/call-BIzCaKZb.js +282 -0
- package/dist/call-BYDpTVCZ.js +282 -0
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/catalog-CqKiUgu6.js +185 -0
- package/dist/catalog-DMfEg-oK.js +185 -0
- package/dist/channel-options-BrtCtyrT.js +32 -0
- package/dist/channel-options-CO21Gl8p.js +33 -0
- package/dist/channel-selection-Bbm1lq3P.js +51 -0
- package/dist/channel-selection-CqcX7Ocw.js +51 -0
- package/dist/channel-web-DrsT6OAE.js +2162 -0
- package/dist/channels-cli-Juyh1S6n.js +1304 -0
- package/dist/channels-cli-zNvi1m5c.js +1306 -0
- package/dist/channels-status-issues-CqzqshW4.js +18 -0
- package/dist/channels-status-issues-DdJdO866.js +18 -0
- package/dist/chrome-C4dOMO8z.js +1601 -0
- package/dist/chrome-DdcDzAtH.js +1629 -0
- package/dist/chrome-U3DRzjJD.js +1601 -0
- package/dist/chunk-D2nLsrEW.js +348 -0
- package/dist/clack-prompter-BI3RDW5w.js +92 -0
- package/dist/clack-prompter-Dwr1m_IZ.js +92 -0
- package/dist/cli/daemon-cli.js +1 -1
- package/dist/cli-C3cpDaz8.js +99 -0
- package/dist/cli-CjWUGdGC.js +101 -0
- package/dist/cli-session-BVjY_XrW.js +5463 -0
- package/dist/cli-session-gtuYN2Iq.js +5408 -0
- package/dist/client-Dswwze5_.js +1692 -0
- package/dist/client-LRKFjo4A.js +1692 -0
- package/dist/clipboard-BZKS9O1u.js +31 -0
- package/dist/clipboard-DES8b1AM.js +31 -0
- package/dist/command-format-CP1YTNCl.js +52 -0
- package/dist/command-format-CVL4K5cj.js +52 -0
- package/dist/command-format-G6N2zghg.js +38 -0
- package/dist/command-registry-BBvNvysr.js +248 -0
- package/dist/commands-AZ3n8Y2c.js +726 -0
- package/dist/commands-BMnD_QRY.js +726 -0
- package/dist/commands-registry-cFqZ6Ib4.js +766 -0
- package/dist/commands-registry-q13H7ng5.js +766 -0
- package/dist/common-CX5458fH.js +287 -0
- package/dist/common-DJbnT8ws.js +287 -0
- package/dist/completion-cli-BADRBcIl.js +432 -0
- package/dist/completion-cli-DMQgiObF.js +431 -0
- package/dist/config-CU-Axg8P.js +5704 -0
- package/dist/config-DaqbUdkI.js +5705 -0
- package/dist/config-cli-BPlbwiuA.js +244 -0
- package/dist/config-cli-DXgZJkPU.js +247 -0
- package/dist/config-guard-Ba49JNds.js +76 -0
- package/dist/config-guard-Cu0qMKZJ.js +93 -0
- package/dist/config-kVVm5EYV.js +6523 -0
- package/dist/config-sync-CzLnLTXt.js +91 -0
- package/dist/config-sync-DuydxPWx.js +91 -0
- package/dist/configure-CHgacLyi.js +960 -0
- package/dist/configure-DfHXDa1L.js +959 -0
- package/dist/context-DzgXOckU.js +60 -0
- package/dist/control-service-8_wKHwBa.js +72 -0
- package/dist/control-service-BtL1Jto_.js +72 -0
- package/dist/cron-cli-BCzSR2c0.js +448 -0
- package/dist/cron-cli-CCWNkykU.js +451 -0
- package/dist/daemon-cli-Bjkbu9Vy.js +565 -0
- package/dist/daemon-cli-CmlHcC1J.js +566 -0
- package/dist/daemon-cli.js +16 -16
- package/dist/daemon-runtime-C0tz7VAC.js +460 -0
- package/dist/daemon-runtime-rUTqCVwJ.js +460 -0
- package/dist/deliver-BBggsviM.js +1097 -0
- package/dist/deliver-CePITOl8.js +1162 -0
- package/dist/deliver-DFnVaetP.js +1097 -0
- package/dist/delivery-queue-BJQK3oh5.js +220 -0
- package/dist/deps-CeEKhrp7.js +42 -0
- package/dist/devices-cli-DQrDMrZH.js +198 -0
- package/dist/devices-cli-Oe-A1Dv0.js +195 -0
- package/dist/diagnostics-DxMFrBLO.js +35 -0
- package/dist/diagnostics-m79ZlMmZ.js +35 -0
- package/dist/directory-cli-BL6h8cGF.js +246 -0
- package/dist/directory-cli-Cjgmi_sj.js +243 -0
- package/dist/dispatcher-DAFbQM-c.js +100 -0
- package/dist/dispatcher-DNd40gUn.js +100 -0
- package/dist/dist-CqDI82ei.js +929 -0
- package/dist/dist-DnHRxR5U.js +929 -0
- package/dist/dns-cli-CFtV3BXK.js +200 -0
- package/dist/dns-cli-NyIHvQ5S.js +197 -0
- package/dist/dock-BdXLb5oY.js +753 -0
- package/dist/dock-jYICmNcI.js +753 -0
- package/dist/docs-cli-CrOaIK_H.js +161 -0
- package/dist/docs-cli-D_cmJDSr.js +159 -0
- package/dist/doctor-BpGxKrBl.js +1815 -0
- package/dist/doctor-D12wNQPU.js +1813 -0
- package/dist/doctor-completion-DeOfofek.js +92 -0
- package/dist/doctor-completion-DwjqdEcK.js +92 -0
- package/dist/doctor-config-flow-BI3mpkbd.js +1232 -0
- package/dist/doctor-config-flow-wMHheFkC.js +1232 -0
- package/dist/engine-BCtL-AMw.js +563 -0
- package/dist/engine-Bk_UT413.js +563 -0
- package/dist/entry.js +5 -5
- package/dist/env-v6411I8h.js +32 -0
- package/dist/exec-B7sUS164.js +1167 -0
- package/dist/exec-approvals-CroGJRUg.js +1221 -0
- package/dist/exec-approvals-cli-BTxF_RsH.js +371 -0
- package/dist/exec-approvals-cli-n1gyGwH2.js +368 -0
- package/dist/exec-mhSykkaa.js +255 -0
- package/dist/extensionAPI.js +3 -3
- package/dist/frontmatter-BmHq0vRD.js +204 -0
- package/dist/gateway-cli-DDBadlrS.js +19971 -0
- package/dist/gateway-cli-IZNkOMBe.js +19972 -0
- package/dist/gateway-rpc-Dtx8HN-n.js +28 -0
- package/dist/gateway-rpc-L2PVSqGj.js +28 -0
- package/dist/github-copilot-auth-DKyqDaGU.js +1418 -0
- package/dist/github-copilot-auth-DXpOMSd3.js +1418 -0
- package/dist/gmail-setup-utils-BKNczIJ9.js +428 -0
- package/dist/gmail-setup-utils-co0ppccC.js +428 -0
- package/dist/health-Bm8ZTvC3.js +1253 -0
- package/dist/health-DUf1gt4E.js +1258 -0
- package/dist/health-format-BksT6F68.js +208 -0
- package/dist/health-format-uzh1xYLD.js +208 -0
- package/dist/heartbeat-visibility-1TJb1Zao.js +98 -0
- package/dist/heartbeat-visibility-CwodtdcX.js +98 -0
- package/dist/help-format-C6cv_aZp.js +17 -0
- package/dist/helpers-N-uSFKOn.js +10 -0
- package/dist/hooks-cli-1POsXqOl.js +993 -0
- package/dist/hooks-cli-BGjILbze.js +991 -0
- package/dist/hooks-status-DE07n5RC.js +356 -0
- package/dist/hooks-status-Du-d1jde.js +356 -0
- package/dist/image-ops-B_AYV3tp.js +541 -0
- package/dist/image-ops-Bp0C6Mvr.js +541 -0
- package/dist/index.js +82 -82
- package/dist/init-9A0s7bWG.js +122 -0
- package/dist/init-DoyCHJDC.js +122 -0
- package/dist/installs-D1C9wHAq.js +383 -0
- package/dist/installs-Dh4dHayM.js +383 -0
- package/dist/ipv4-DCItfaJo.js +1964 -0
- package/dist/ipv4-DSOUVx0i.js +1964 -0
- package/dist/lanes-BvSnHq2h.js +232 -0
- package/dist/lifecycle-core-BY4WIf9g.js +388 -0
- package/dist/lifecycle-core-TQKyXO-6.js +387 -0
- package/dist/links-CNu_8RZl.js +15 -0
- package/dist/links-D2tt2ouh.js +15 -0
- package/dist/llm-slug-generator.js +4 -4
- package/dist/logging-BIeRw0WR.js +15 -0
- package/dist/logging-C7lb3Vjc.js +15 -0
- package/dist/login-DXWKewA2.js +59 -0
- package/dist/login-Fhh4uWmf.js +61 -0
- package/dist/login-pPs3UO38.js +61 -0
- package/dist/login-qr-CevLD8cV.js +326 -0
- package/dist/login-qr-GF2JMIy-.js +323 -0
- package/dist/login-qr-ZYYKD6Yt.js +321 -0
- package/dist/logs-cli-CzXbX8HZ.js +242 -0
- package/dist/logs-cli-D9ngH9PF.js +245 -0
- package/dist/manager-BD5rA3w0.js +3244 -0
- package/dist/manager-BDPgBQSH.js +3246 -0
- package/dist/manager-DRWMWM--.js +3244 -0
- package/dist/manifest-registry-DbvPaBXY.js +748 -0
- package/dist/manifest-registry-kHX_MFa1.js +748 -0
- package/dist/markdown-tables-CqwihY2m.js +347 -0
- package/dist/markdown-tables-DJV7eAJZ.js +348 -0
- package/dist/media-lUqN-0O9.js +1342 -0
- package/dist/memory-cli-BLXSpgnN.js +868 -0
- package/dist/memory-cli-BcGVkkRJ.js +869 -0
- package/dist/message-channel-D_jIO87f.js +110 -0
- package/dist/migrate-BpVOar4L.js +157 -0
- package/dist/migrate-CkgGDkWy.js +157 -0
- package/dist/model-selection-Cqt6aJ0G.js +2691 -0
- package/dist/models-CExsNQPH.js +2510 -0
- package/dist/models-cli-Ba3Jmwev.js +2739 -0
- package/dist/models-cli-iDAlsbL2.js +258 -0
- package/dist/net-0A_zcaQD.js +218 -0
- package/dist/node-cli-ATmwCXIk.js +1319 -0
- package/dist/node-cli-DYFR_V25.js +1322 -0
- package/dist/node-service-CN4LqR1A.js +67 -0
- package/dist/node-service-CWt3MdSC.js +67 -0
- package/dist/nodes-cli-BeVmhTz3.js +1197 -0
- package/dist/nodes-cli-QeJIfa18.js +1200 -0
- package/dist/nodes-screen-DHyWAlla.js +234 -0
- package/dist/nodes-screen-qs3jRBPk.js +234 -0
- package/dist/note-CSlg2BnB.js +73 -0
- package/dist/note-Ctvglhp1.js +73 -0
- package/dist/npm-registry-spec-DQd4M22q.js +351 -0
- package/dist/npm-registry-spec-PxisIMts.js +351 -0
- package/dist/onboard-DeruD10m.js +1166 -0
- package/dist/onboard-SAcu5N6N.js +1165 -0
- package/dist/onboard-channels-C4iSfFXR.js +672 -0
- package/dist/onboard-channels-oVTVgoyg.js +672 -0
- package/dist/onboard-helpers-B8roRwLP.js +365 -0
- package/dist/onboard-helpers-Dgh26hgP.js +365 -0
- package/dist/onboarding-Bi-ac8we.js +911 -0
- package/dist/onboarding-C2gjB2u8.js +910 -0
- package/dist/orchestrator-DlbAYMQP.js +357 -0
- package/dist/orchestrator-DlwVRVDA.js +357 -0
- package/dist/outbound-CkKgc6iR.js +2062 -0
- package/dist/outbound-Vfm5yDh3.js +214 -0
- package/dist/outbound-bs_VK51X.js +214 -0
- package/dist/outbound-send-deps-DDjiMfEL.js +55 -0
- package/dist/pairing-cli-CJYeuEik.js +118 -0
- package/dist/pairing-cli-mqopHI8s.js +121 -0
- package/dist/pairing-store-BsXzUDPv.js +388 -0
- package/dist/pairing-store-DoNj00-X.js +388 -0
- package/dist/path-env-C_xpiG8l.js +89 -0
- package/dist/path-env-DSSMHu5A.js +89 -0
- package/dist/paths-B1vRVCad.js +126 -0
- package/dist/paths-BMuHNFxg.js +238 -0
- package/dist/paths-BXQQzXGQ.js +129 -0
- package/dist/paths-Buw_geoe.js +54 -0
- package/dist/paths-DA9WYabg.js +222 -0
- package/dist/paths-DfQGx0_k.js +129 -0
- package/dist/pi-auth-json-DOPW3e4X.js +78 -0
- package/dist/pi-auth-json-MruLmI_X.js +82 -0
- package/dist/pi-auth-json-lae_wwwo.js +80 -0
- package/dist/pi-model-discovery-7q0GxMrp.js +3 -0
- package/dist/pi-tools.policy-Csmla32P.js +200 -0
- package/dist/pi-tools.policy-xYdDLEv9.js +200 -0
- package/dist/plugin-auto-enable-CViVVWgg.js +282 -0
- package/dist/plugin-auto-enable-CjZ238UI.js +282 -0
- package/dist/plugin-registry-B4Aw2hzq.js +32 -0
- package/dist/plugin-registry-DW81arxW.js +32 -0
- package/dist/plugin-sdk/cli/cli-name.d.ts +1 -1
- package/dist/plugin-sdk/config/paths.d.ts +2 -2
- package/dist/plugin-sdk/index.js +7 -7
- package/dist/plugins-DhcGAPDB.js +38 -0
- package/dist/plugins-DtghNRtM.js +168 -0
- package/dist/plugins-cli-4vWTmOAb.js +736 -0
- package/dist/plugins-cli-CdTMbP0X.js +734 -0
- package/dist/polls-D6eCdatA.js +1343 -0
- package/dist/ports-BtZx-JKD.js +96 -0
- package/dist/ports-C8bKN8s0.js +96 -0
- package/dist/ports-DHiKnPRX.js +344 -0
- package/dist/ports-vd93M_Pt.js +317 -0
- package/dist/program-CX3aUVeb.js +176 -0
- package/dist/program-context-BPos0ivo.js +496 -0
- package/dist/progress-oiAjiiNi.js +133 -0
- package/dist/prompt-style-Cm4wOtKm.js +9 -0
- package/dist/pw-ai-4QbK5YFe.js +1865 -0
- package/dist/pw-ai-BWz3Cxt7.js +1868 -0
- package/dist/pw-ai-C83HBue2.js +1867 -0
- package/dist/qmd-manager-BcMeZiGD.js +938 -0
- package/dist/qmd-manager-CPypGJ0P.js +935 -0
- package/dist/qmd-manager-CRrSkfia.js +937 -0
- package/dist/register.agent-DDY8KJhn.js +265 -0
- package/dist/register.agent-DKawm-9d.js +1003 -0
- package/dist/register.anima-CEWUo29k.js +193 -0
- package/dist/register.anima-DBWz2rk_.js +193 -0
- package/dist/register.configure-BX67qV8k.js +103 -0
- package/dist/register.configure-CWsySuiq.js +101 -0
- package/dist/register.maintenance-0k-ZNhDg.js +543 -0
- package/dist/register.maintenance-BIwx1fzX.js +543 -0
- package/dist/register.message-CXPsoakA.js +657 -0
- package/dist/register.message-DA3jvfgI.js +660 -0
- package/dist/register.onboard-C4HG7Hqv.js +170 -0
- package/dist/register.onboard-GOpdif-j.js +170 -0
- package/dist/register.setup-B17vZT7C.js +175 -0
- package/dist/register.setup-GJyUDCqh.js +175 -0
- package/dist/register.status-health-sessions-D5876dGx.js +313 -0
- package/dist/register.status-health-sessions-lOewVIZR.js +142 -0
- package/dist/register.subclis-Dwnujj5C.js +255 -0
- package/dist/reply-CR5T_oQJ.js +32212 -0
- package/dist/reply-prefix-BcrS4Umd.js +100 -0
- package/dist/reply-prefix-Btb5o2NH.js +100 -0
- package/dist/reply-r089HuRA.js +32212 -0
- package/dist/routes-B4czFzIb.js +1820 -0
- package/dist/routes-ucJWAk5O.js +1820 -0
- package/dist/rpc-BnKxnQ0v.js +70 -0
- package/dist/rpc-DgE-xnyx.js +70 -0
- package/dist/run-main-B74kv84C.js +371 -0
- package/dist/runtime-guard-CKFdts2L.js +60 -0
- package/dist/sandbox-CJTS3er6.js +858 -0
- package/dist/sandbox-DBSiVHt_.js +859 -0
- package/dist/sandbox-cli-CrkjyU5M.js +461 -0
- package/dist/sandbox-cli-D1r5y6Sz.js +458 -0
- package/dist/security-cli-BZUdnkhn.js +462 -0
- package/dist/security-cli-DS09ebvA.js +465 -0
- package/dist/server-context-C0xZbYhg.js +824 -0
- package/dist/server-context-DVh2z7om.js +824 -0
- package/dist/server-node-events-bu9lpkMH.js +233 -0
- package/dist/server-node-events-i1Rrww31.js +231 -0
- package/dist/service-CJJwLEor.js +642 -0
- package/dist/service-DxLxBhaU.js +642 -0
- package/dist/service-audit-DB4Y3Ekp.js +488 -0
- package/dist/service-audit-M8y4TXVb.js +488 -0
- package/dist/session-CGxOLFs2.js +179 -0
- package/dist/session-DTTbdKb0.js +181 -0
- package/dist/session-cost-usage-FcdJl9c3.js +600 -0
- package/dist/session-cost-usage-qdfsGU2a.js +600 -0
- package/dist/session-yOhWcsD2.js +181 -0
- package/dist/sessions-B-Cu7JZq.js +1296 -0
- package/dist/sessions-BgLN4KFr.js +180 -0
- package/dist/sessions-CnRjwdVr.js +1296 -0
- package/dist/sessions-wRKla1Qh.js +2038 -0
- package/dist/shared-DS3UaJSP.js +66 -0
- package/dist/shared-DxNHzky3.js +77 -0
- package/dist/shared-Qpt4hUDi.js +66 -0
- package/dist/shared-kzrojZ1B.js +77 -0
- package/dist/skill-scanner-DLJji5Ye.js +263 -0
- package/dist/skills-BWFIEp4j.js +807 -0
- package/dist/skills-DV4zKdCx.js +808 -0
- package/dist/skills-cli-BY53ILm2.js +289 -0
- package/dist/skills-cli-CO3gxl8A.js +286 -0
- package/dist/skills-status-DX5pcqY3.js +166 -0
- package/dist/skills-status-zhcKzGkp.js +166 -0
- package/dist/sqlite-B6MojU1I.js +321 -0
- package/dist/sqlite-CuprTGR7.js +453 -0
- package/dist/sqlite-dzD-jMjs.js +368 -0
- package/dist/start-Cu3aLoSf.js +297 -0
- package/dist/start-Dz7tMAl8.js +296 -0
- package/dist/status-CaSxhxfV.js +2132 -0
- package/dist/status-D2C0JCX3.js +2137 -0
- package/dist/status-DlFMsQzh.js +27 -0
- package/dist/status-G0CITnKR.js +27 -0
- package/dist/status.update-CHjhVxJY.js +79 -0
- package/dist/status.update-DVFelehi.js +79 -0
- package/dist/subagent-registry-3Xb4el-8.js +14 -0
- package/dist/subagent-registry-CdSjz14I.js +2760 -0
- package/dist/subagent-registry-DNDhbHWi.js +2759 -0
- package/dist/subsystem-DfKstnEK.js +860 -0
- package/dist/system-cli-B5mt0FWa.js +82 -0
- package/dist/system-cli-Dg3UQ3Zz.js +79 -0
- package/dist/systemd-B43AvOGx.js +452 -0
- package/dist/systemd-RpPE0XGg.js +452 -0
- package/dist/systemd-hints-DMJT-Bbc.js +36 -0
- package/dist/systemd-hints-vRInKcz9.js +36 -0
- package/dist/systemd-linger-Dzyxqsod.js +75 -0
- package/dist/systemd-linger-EujbmI5A.js +75 -0
- package/dist/table-DhXHfRX2.js +279 -0
- package/dist/table-bWCLW-3P.js +279 -0
- package/dist/timeout-Ddn-5kAO.js +232 -0
- package/dist/tokens-3psI_Qk2.js +14 -0
- package/dist/tokens-BaM53PEx.js +14 -0
- package/dist/trash-Bmxs1Rnm.js +23 -0
- package/dist/trash-C39a6hKA.js +23 -0
- package/dist/tui-BHgBWhHE.js +3894 -0
- package/dist/tui-cli-B9Sq5-cC.js +50 -0
- package/dist/tui-cli-Dw7v4JoJ.js +47 -0
- package/dist/tui-mUwDwqvd.js +3894 -0
- package/dist/update-DF0GHG0j.js +317 -0
- package/dist/update-DoZLVjva.js +317 -0
- package/dist/update-check-Bt1dVPVN.js +400 -0
- package/dist/update-check-D5qAKes7.js +400 -0
- package/dist/update-cli-BNu2Oi7H.js +1105 -0
- package/dist/update-cli-D36AmALA.js +1105 -0
- package/dist/update-runner-CNQQaTwA.js +894 -0
- package/dist/update-runner-CvxZmbu-.js +894 -0
- package/dist/usage-BGCwNnjk.js +4516 -0
- package/dist/utils-DZ8pnOD5.js +243 -0
- package/dist/web-B5QG839O.js +46842 -0
- package/dist/web-Cmnvk9v0.js +2203 -0
- package/dist/web-Cv2KnTnL.js +63 -0
- package/dist/webhooks-cli-B6y89Pj_.js +319 -0
- package/dist/webhooks-cli-BDzHON4w.js +316 -0
- package/dist/whatsapp-actions-C_5MwVxM.js +45 -0
- package/dist/whatsapp-actions-hgYA12To.js +53 -0
- package/dist/whatsapp-actions-zTiVOoOV.js +49 -0
- package/dist/widearea-dns-BeIdnISJ.js +127 -0
- package/dist/widearea-dns-CF1gxpJ-.js +127 -0
- package/dist/workspace-DLna1IxR.js +649 -0
- package/dist/ws-log-Q4wO1Ztb.js +267 -0
- package/dist/ws-log-xF0kxDzp.js +267 -0
- package/package.json +1 -2
- package/dist/accounts-Cc5E4IDO.js +0 -260
- package/dist/accounts-CcVrwKqv.js +0 -259
- package/dist/acp-cli-DvphOKuh.js +0 -1081
- package/dist/acp-cli-p28pQ65a.js +0 -1084
- package/dist/agent-Cj7uDJaZ.js +0 -725
- package/dist/agent-Cuj9-2sT.js +0 -725
- package/dist/agent-events-BEBQsyE5.js +0 -182
- package/dist/agent-scope-BVf4aSwY.js +0 -112
- package/dist/agent-scope-OZi7lb8S.js +0 -452
- package/dist/agent-scope-V1bi9OYL.js +0 -452
- package/dist/agents-BUWqn_Ui.js +0 -774
- package/dist/agents.config-Dvo2ULxs.js +0 -182
- package/dist/agents.config-d6H0_3oj.js +0 -182
- package/dist/argv-DqUHKf0o.js +0 -73
- package/dist/audit-C6okOOSh.js +0 -2401
- package/dist/audit-VWjIdwC7.js +0 -2401
- package/dist/auth-91o2YM96.js +0 -648
- package/dist/auth-choice-CAmACV13.js +0 -2681
- package/dist/auth-choice-p3SeHPj2.js +0 -2681
- package/dist/auth-health-B_jXrWe6.js +0 -149
- package/dist/auth-health-DCicUKYR.js +0 -149
- package/dist/auth-lZ26wsbN.js +0 -639
- package/dist/auth-profiles-CCDD56dU.js +0 -1564
- package/dist/auth-profiles-DxI8L7bs.js +0 -2689
- package/dist/banner-Cohn04J6.js +0 -294
- package/dist/browser-cli-DANzjztE.js +0 -1676
- package/dist/browser-cli-WjsVH741.js +0 -1679
- package/dist/call-BAHvlu2G.js +0 -282
- package/dist/call-Ct7EGP_L.js +0 -282
- package/dist/catalog-BAayBt1L.js +0 -185
- package/dist/catalog-BNsf97BM.js +0 -185
- package/dist/channel-options-Dx9nPlX8.js +0 -33
- package/dist/channel-options-ZdvXrTGs.js +0 -32
- package/dist/channel-selection-CujyiWGM.js +0 -51
- package/dist/channel-selection-DfGpCyh2.js +0 -51
- package/dist/channel-web-CC0hkgkR.js +0 -2162
- package/dist/channels-cli-D7lNBpIb.js +0 -1304
- package/dist/channels-cli-DUPG8WDv.js +0 -1306
- package/dist/channels-status-issues-DBc1pU_R.js +0 -18
- package/dist/channels-status-issues-DjO9MHIG.js +0 -18
- package/dist/chrome-Bi6iZ5sG.js +0 -1601
- package/dist/chrome-DNSv7Cpy.js +0 -1629
- package/dist/chrome-DScZx4Lk.js +0 -1601
- package/dist/chunk-mxPVo000.js +0 -348
- package/dist/clack-prompter-B0kl7shw.js +0 -92
- package/dist/clack-prompter-B1YxZdRy.js +0 -92
- package/dist/cli-CfHUkOD0.js +0 -101
- package/dist/cli-ClMrIh6l.js +0 -99
- package/dist/cli-session-BkPTd9Pk.js +0 -5463
- package/dist/cli-session-Dd8DKb5a.js +0 -5408
- package/dist/client-C1avc0vD.js +0 -1692
- package/dist/client-CC94YZrT.js +0 -1692
- package/dist/clipboard-B2fBy8tG.js +0 -31
- package/dist/clipboard-BbGnZskJ.js +0 -31
- package/dist/command-format-Clp46jkj.js +0 -38
- package/dist/command-format-DELazozB.js +0 -52
- package/dist/command-format-SkzzRqR1.js +0 -52
- package/dist/command-registry-DZ4hkmA0.js +0 -248
- package/dist/commands-DtYZJSPn.js +0 -568
- package/dist/commands-Dujk1JmY.js +0 -568
- package/dist/commands-registry-Bd0xbvwG.js +0 -766
- package/dist/commands-registry-DYfRSVF3.js +0 -766
- package/dist/common-D6bu0zHC.js +0 -287
- package/dist/common-zW9Y2P1B.js +0 -287
- package/dist/completion-cli-tSe7Pmqm.js +0 -431
- package/dist/completion-cli-vn4IScs5.js +0 -432
- package/dist/config-C8rUDJXY.js +0 -5704
- package/dist/config-CLZ_XGVw.js +0 -6523
- package/dist/config-SY8M0kM_.js +0 -5705
- package/dist/config-cli-1V7D2Wsw.js +0 -247
- package/dist/config-cli-CjWEC81L.js +0 -244
- package/dist/config-guard-BW2gpKj_.js +0 -93
- package/dist/config-guard-BvxuzHpo.js +0 -76
- package/dist/config-sync-CoIIbEOe.js +0 -91
- package/dist/config-sync-DvAttep0.js +0 -91
- package/dist/configure-Bf0oupCE.js +0 -959
- package/dist/configure-DRM-7zFf.js +0 -960
- package/dist/context-D5iEFzv9.js +0 -60
- package/dist/control-service-C8m8F9pr.js +0 -72
- package/dist/control-service-DKotCWCg.js +0 -72
- package/dist/cron-cli-DB_FLYHD.js +0 -448
- package/dist/cron-cli-bxm5lrrO.js +0 -451
- package/dist/daemon-cli-1LsOnICv.js +0 -566
- package/dist/daemon-cli-CC2NrJ7a.js +0 -565
- package/dist/daemon-runtime-BXZhtBL9.js +0 -460
- package/dist/daemon-runtime-DW4USC7r.js +0 -460
- package/dist/deliver-B4HuPwJA.js +0 -1162
- package/dist/deliver-LiY5oL52.js +0 -1097
- package/dist/deliver-xrmk7xjh.js +0 -1097
- package/dist/delivery-queue-TnQykYsg.js +0 -220
- package/dist/deps-CMMOiOsF.js +0 -42
- package/dist/devices-cli-Be5he2SA.js +0 -195
- package/dist/devices-cli-z6ecoFe9.js +0 -198
- package/dist/diagnostics-Dj75aEHN.js +0 -35
- package/dist/diagnostics-DlIw6fqD.js +0 -35
- package/dist/directory-cli-CEy-0nxj.js +0 -243
- package/dist/directory-cli-DpzKcigr.js +0 -246
- package/dist/dispatcher-10Shiuz3.js +0 -100
- package/dist/dispatcher-3Jae6AiW.js +0 -100
- package/dist/dns-cli-Bat1pkc-.js +0 -200
- package/dist/dns-cli-NohNyEo0.js +0 -197
- package/dist/dock-DbxBBv30.js +0 -753
- package/dist/dock-cPBY4qGl.js +0 -753
- package/dist/docs-cli-BWp6p-Tq.js +0 -161
- package/dist/docs-cli-x22FnZfL.js +0 -159
- package/dist/doctor-BrT5m_on.js +0 -1815
- package/dist/doctor-Pp2HVnjM.js +0 -1813
- package/dist/doctor-completion-DNTimX9o.js +0 -92
- package/dist/doctor-completion-ylN9QAJ6.js +0 -92
- package/dist/doctor-config-flow-D1w3700T.js +0 -1232
- package/dist/doctor-config-flow-Dq50iE1R.js +0 -1232
- package/dist/engine-B9avUJL5.js +0 -563
- package/dist/engine-BiUQ25D4.js +0 -563
- package/dist/env-0lJfCPsw.js +0 -32
- package/dist/exec-BenD3A5l.js +0 -1167
- package/dist/exec-Bv3pyjeM.js +0 -255
- package/dist/exec-approvals-CdLmKX2R.js +0 -1221
- package/dist/exec-approvals-cli-DXfV6G8H.js +0 -368
- package/dist/exec-approvals-cli-J2cZs10o.js +0 -371
- package/dist/frontmatter-YijVi0FQ.js +0 -204
- package/dist/gateway-cli-DOAbA0pc.js +0 -19972
- package/dist/gateway-cli-QpWtBhQy.js +0 -19971
- package/dist/gateway-rpc-DJKBil9s.js +0 -28
- package/dist/gateway-rpc-DVterpLP.js +0 -28
- package/dist/github-copilot-auth-4IUFp669.js +0 -1418
- package/dist/github-copilot-auth-C9E0IROs.js +0 -1418
- package/dist/gmail-setup-utils-BPo_LkKI.js +0 -428
- package/dist/gmail-setup-utils-D3Yqgor7.js +0 -428
- package/dist/health-BeZnqp6m.js +0 -1258
- package/dist/health-Cn2OoVWZ.js +0 -1253
- package/dist/health-format-CdP99j3Y.js +0 -208
- package/dist/health-format-JEChH08S.js +0 -208
- package/dist/heartbeat-visibility-BL3WAchI.js +0 -98
- package/dist/heartbeat-visibility-CQ9QimI7.js +0 -98
- package/dist/help-format-Dl4bsrLI.js +0 -17
- package/dist/helpers-ZKNRexvX.js +0 -10
- package/dist/hooks-cli-D99hXt7K.js +0 -991
- package/dist/hooks-cli-DMB8RiEO.js +0 -993
- package/dist/hooks-status-B-e96dZj.js +0 -356
- package/dist/hooks-status-C_9sE0ox.js +0 -356
- package/dist/image-ops-Dlt3T7th.js +0 -541
- package/dist/image-ops-omlvdfah.js +0 -541
- package/dist/init-Bm04RagW.js +0 -122
- package/dist/init-CaJBf4p1.js +0 -122
- package/dist/installs-C2iMRBVz.js +0 -383
- package/dist/installs-D-cPGdCw.js +0 -383
- package/dist/ipv4-Bf7NS3QU.js +0 -1964
- package/dist/ipv4-wWNs8IH_.js +0 -1964
- package/dist/lanes-CNxj3tit.js +0 -232
- package/dist/lifecycle-core-B_7XRcvF.js +0 -388
- package/dist/lifecycle-core-By83PVAK.js +0 -387
- package/dist/links-BfjHVTB_.js +0 -15
- package/dist/links-DPGe0OHw.js +0 -15
- package/dist/logging-DB6BQmhi.js +0 -15
- package/dist/logging-mcb66J0p.js +0 -15
- package/dist/login-BDCg6D0N.js +0 -61
- package/dist/login-BDfnbjnZ.js +0 -59
- package/dist/login-BqH1itcg.js +0 -61
- package/dist/login-qr-CyOw3R4r.js +0 -321
- package/dist/login-qr-D8ECtb72.js +0 -323
- package/dist/login-qr-RnR7e4Bw.js +0 -326
- package/dist/logs-cli--j89L74J.js +0 -245
- package/dist/logs-cli-DpEMg_Gq.js +0 -242
- package/dist/manager-B4OyvcxT.js +0 -3244
- package/dist/manager-Cqc1CeH7.js +0 -3246
- package/dist/manager-DUyQPFvj.js +0 -3244
- package/dist/manifest-registry-CW1zCyRF.js +0 -748
- package/dist/manifest-registry-D4lM2RdV.js +0 -748
- package/dist/markdown-tables-BT1X6jqH.js +0 -347
- package/dist/markdown-tables-DHgOK2vI.js +0 -348
- package/dist/media-THyainiE.js +0 -1342
- package/dist/memory-cli-BKocCWXM.js +0 -868
- package/dist/memory-cli-Jmma-xI_.js +0 -869
- package/dist/message-channel-dSTVVCyX.js +0 -110
- package/dist/migrate-BR6iAIjO.js +0 -157
- package/dist/migrate-D0EcMs0f.js +0 -157
- package/dist/model-selection-YcSr9CgC.js +0 -2691
- package/dist/models-1vUQBVfw.js +0 -2510
- package/dist/models-cli-BK3BwUhL.js +0 -2739
- package/dist/models-cli-DECrM8oA.js +0 -258
- package/dist/net-B5lXhYLV.js +0 -218
- package/dist/node-cli-cLHUNpPD.js +0 -1319
- package/dist/node-cli-fO7Y132S.js +0 -1322
- package/dist/node-service-BFxHJsno.js +0 -67
- package/dist/node-service-DUnan4uK.js +0 -67
- package/dist/nodes-cli-BCq35E6N.js +0 -1200
- package/dist/nodes-cli-vD7MwAKP.js +0 -1197
- package/dist/nodes-screen-1YiLkqr5.js +0 -234
- package/dist/nodes-screen-DZeD8hE5.js +0 -234
- package/dist/note-Bi8Wb8DV.js +0 -73
- package/dist/note-uiuPxhyX.js +0 -73
- package/dist/npm-registry-spec-B-XIShkB.js +0 -351
- package/dist/npm-registry-spec-za3itb5Y.js +0 -351
- package/dist/onboard-Ds6w_sWo.js +0 -1165
- package/dist/onboard-SAVx3bp4.js +0 -1166
- package/dist/onboard-channels-Cg_EkBa4.js +0 -672
- package/dist/onboard-channels-D7NbA55V.js +0 -672
- package/dist/onboard-helpers-DO_hgZb9.js +0 -365
- package/dist/onboard-helpers-_XgJgeqh.js +0 -365
- package/dist/onboarding-3hLmDd0r.js +0 -911
- package/dist/onboarding-B4LKLsbU.js +0 -910
- package/dist/orchestrator-BKzmyBWy.js +0 -357
- package/dist/orchestrator-BN3QCz2s.js +0 -357
- package/dist/outbound-BgA9hNlP.js +0 -2062
- package/dist/outbound-CjdvVhUI.js +0 -214
- package/dist/outbound-DOGe6qb2.js +0 -214
- package/dist/outbound-send-deps-Du5aBpd7.js +0 -55
- package/dist/pairing-cli-2vnyg_Nd.js +0 -118
- package/dist/pairing-cli-BH1KQtNV.js +0 -121
- package/dist/pairing-store-DJz_9Gv0.js +0 -388
- package/dist/pairing-store-DmOzxcuk.js +0 -388
- package/dist/path-env-Bu6k0jDQ.js +0 -89
- package/dist/path-env-C0zQSjw8.js +0 -89
- package/dist/paths-BTc4nk-6.js +0 -126
- package/dist/paths-BgUi2Z2G.js +0 -54
- package/dist/paths-C6VCWKo3.js +0 -238
- package/dist/paths-CCxa0o9c.js +0 -222
- package/dist/paths-CxRf2rBG.js +0 -129
- package/dist/paths-hcX1Gqg5.js +0 -129
- package/dist/pi-auth-json-B68R7q7_.js +0 -82
- package/dist/pi-auth-json-CR0jXAgq.js +0 -78
- package/dist/pi-auth-json-ZYzi3nxs.js +0 -80
- package/dist/pi-model-discovery-Cxs4pvC2.js +0 -3
- package/dist/pi-tools.policy-D81U5xy0.js +0 -200
- package/dist/pi-tools.policy-DSHkkb5b.js +0 -200
- package/dist/plugin-auto-enable-CxF4bpDN.js +0 -282
- package/dist/plugin-auto-enable-jNaAeyEh.js +0 -282
- package/dist/plugin-registry-C7XWotZG.js +0 -32
- package/dist/plugin-registry-DcUCbGax.js +0 -32
- package/dist/plugins-B362e77G.js +0 -168
- package/dist/plugins-CmSUIUNi.js +0 -38
- package/dist/plugins-cli-BsCEnoQ7.js +0 -734
- package/dist/plugins-cli-QSIsMUG7.js +0 -736
- package/dist/polls-CItfB1H8.js +0 -1343
- package/dist/ports-BVLMN1Sr.js +0 -96
- package/dist/ports-CqLSlU6Z.js +0 -317
- package/dist/ports-D94CwCrv.js +0 -344
- package/dist/ports-D_NHthOz.js +0 -96
- package/dist/program-DkJHjI0R.js +0 -176
- package/dist/program-context-DnyGM2SC.js +0 -496
- package/dist/progress-Bek_GyWS.js +0 -133
- package/dist/prompt-style-lu0clOOE.js +0 -9
- package/dist/pw-ai-BLVMuSLv.js +0 -1867
- package/dist/pw-ai-DZJWEF_f.js +0 -1865
- package/dist/pw-ai-dzf-ptcn.js +0 -1868
- package/dist/qmd-manager-Cur_Ekn0.js +0 -937
- package/dist/qmd-manager-DNAUuwjK.js +0 -938
- package/dist/qmd-manager-DepEoASu.js +0 -935
- package/dist/register.agent-CSWvzOkR.js +0 -265
- package/dist/register.agent-UeH2NXmH.js +0 -1003
- package/dist/register.anima-DOdee0dh.js +0 -193
- package/dist/register.anima-HHDWsz6r.js +0 -193
- package/dist/register.configure-CSJFxdz9.js +0 -103
- package/dist/register.configure-D84Fvcz4.js +0 -101
- package/dist/register.maintenance-B3pvNbZb.js +0 -543
- package/dist/register.maintenance-BKVOwkw6.js +0 -543
- package/dist/register.message-BAO6CPl2.js +0 -657
- package/dist/register.message-OXoOKE_6.js +0 -660
- package/dist/register.onboard-BK_ixVmD.js +0 -170
- package/dist/register.onboard-cfCaPx6j.js +0 -170
- package/dist/register.setup-BGfDnzph.js +0 -175
- package/dist/register.setup-Y-Q74M-0.js +0 -175
- package/dist/register.status-health-sessions-CT14eitH.js +0 -142
- package/dist/register.status-health-sessions-TfZMzAUn.js +0 -313
- package/dist/register.subclis-BZwdlNHC.js +0 -255
- package/dist/reply-mlsExaZm.js +0 -32212
- package/dist/reply-prefix-B0CfR4bM.js +0 -100
- package/dist/reply-prefix-w4a39ybC.js +0 -100
- package/dist/reply-qalRISe_.js +0 -32212
- package/dist/routes-CENsHJyg.js +0 -1820
- package/dist/routes-DO0HqW2e.js +0 -1820
- package/dist/rpc-C0pjNhBi.js +0 -70
- package/dist/rpc-DZ44PIXE.js +0 -70
- package/dist/run-main-BMpKw8Mp.js +0 -371
- package/dist/runtime-guard-BSUFiAQV.js +0 -60
- package/dist/sandbox-BIGfMYEI.js +0 -858
- package/dist/sandbox-DxP3IpUP.js +0 -859
- package/dist/sandbox-cli-DtLGH8sL.js +0 -461
- package/dist/sandbox-cli-_Tg7lfJ_.js +0 -458
- package/dist/security-cli-BRwgbedo.js +0 -462
- package/dist/security-cli-D3bSuyZt.js +0 -465
- package/dist/server-context-49XFFxFg.js +0 -824
- package/dist/server-context-LrlgrZzS.js +0 -824
- package/dist/server-node-events-Dm52i7NW.js +0 -231
- package/dist/server-node-events-QX523UyF.js +0 -233
- package/dist/service-BNVpYcQe.js +0 -642
- package/dist/service-D56aMXUB.js +0 -642
- package/dist/service-audit-D0X_XAB2.js +0 -488
- package/dist/service-audit-qmf6XMmP.js +0 -488
- package/dist/session-CrQQLLhx.js +0 -179
- package/dist/session-LocsOOWJ.js +0 -181
- package/dist/session-Vlce2BAT.js +0 -181
- package/dist/session-cost-usage-BwiTZuKl.js +0 -600
- package/dist/session-cost-usage-DT9YNXTJ.js +0 -600
- package/dist/sessions-BfV53TbG.js +0 -1296
- package/dist/sessions-BimpX_km.js +0 -180
- package/dist/sessions-DcXpzig0.js +0 -1296
- package/dist/sessions-Wd18dukK.js +0 -2038
- package/dist/shared-Bsr69u_7.js +0 -77
- package/dist/shared-Cgly1vPb.js +0 -66
- package/dist/shared-JOo05hST.js +0 -66
- package/dist/shared-f7dvQsi7.js +0 -77
- package/dist/skill-scanner-CkaVLABv.js +0 -263
- package/dist/skills-B-G7UHOa.js +0 -808
- package/dist/skills-B5LQx4lT.js +0 -807
- package/dist/skills-cli-DUGe2ZWW.js +0 -286
- package/dist/skills-cli-DtOk0bvK.js +0 -289
- package/dist/skills-status-Clq9ZnYu.js +0 -166
- package/dist/skills-status-JQluhU-P.js +0 -166
- package/dist/sqlite-BukcjdJa.js +0 -321
- package/dist/sqlite-CGcOZZ0C.js +0 -368
- package/dist/sqlite-Ck6f9KWc.js +0 -453
- package/dist/start--xmSFepB.js +0 -372
- package/dist/start-BdlZbqrr.js +0 -371
- package/dist/status-BgoeFm6g.js +0 -2137
- package/dist/status-BjjDrUq7.js +0 -27
- package/dist/status-Ct0DgOZ-.js +0 -2132
- package/dist/status-RA_uNmK0.js +0 -27
- package/dist/status.update-BjOH3GlS.js +0 -79
- package/dist/status.update-DLU1qBf0.js +0 -79
- package/dist/subagent-registry-9RLdKxES.js +0 -2760
- package/dist/subagent-registry-Byuex3zp.js +0 -2759
- package/dist/subagent-registry-DOBunBYS.js +0 -14
- package/dist/subsystem-Dowf8fSU.js +0 -860
- package/dist/system-cli-C5oBpzni.js +0 -79
- package/dist/system-cli-DXNKD_Id.js +0 -82
- package/dist/systemd-BSrHDyeU.js +0 -452
- package/dist/systemd-By5xdSB4.js +0 -452
- package/dist/systemd-hints-BtjL_5Rh.js +0 -36
- package/dist/systemd-hints-sJmr6cjb.js +0 -36
- package/dist/systemd-linger-CTmV2Gci.js +0 -75
- package/dist/systemd-linger-CmyqQkeC.js +0 -75
- package/dist/table-BL0lJzsm.js +0 -279
- package/dist/table-DoiRPsn0.js +0 -279
- package/dist/timeout-CswI_K-U.js +0 -232
- package/dist/tokens-C-X7wDKj.js +0 -14
- package/dist/tokens-DkvqA72p.js +0 -14
- package/dist/trash-BJLK1vMn.js +0 -23
- package/dist/trash-_x5UZ94k.js +0 -23
- package/dist/tui-BHjxDFZC.js +0 -3894
- package/dist/tui-CgOocwN8.js +0 -3894
- package/dist/tui-cli-5ANH8dE5.js +0 -47
- package/dist/tui-cli-BQ4P-JW_.js +0 -50
- package/dist/update-LFgxHHPd.js +0 -317
- package/dist/update-TxptCqk7.js +0 -317
- package/dist/update-check-CWc7YXmc.js +0 -400
- package/dist/update-check-IhlWaui6.js +0 -400
- package/dist/update-cli-PtXU62w7.js +0 -1105
- package/dist/update-cli-Va0EtETG.js +0 -1105
- package/dist/update-runner-BLeKFkiB.js +0 -894
- package/dist/update-runner-Iuzpc-_y.js +0 -894
- package/dist/usage-ApGvBLVg.js +0 -4516
- package/dist/utils-Bsw__U-F.js +0 -243
- package/dist/web-B6_Ky60G.js +0 -63
- package/dist/web-EZLQEWXY.js +0 -46842
- package/dist/web-pec8YJUX.js +0 -2203
- package/dist/webhooks-cli-BYQKTHTp.js +0 -319
- package/dist/webhooks-cli-C2_xtsUQ.js +0 -316
- package/dist/whatsapp-actions-C72VCq8f.js +0 -49
- package/dist/whatsapp-actions-Ck9Uv0Nw.js +0 -45
- package/dist/whatsapp-actions-D0reTj2k.js +0 -53
- package/dist/widearea-dns-B6ocX23x.js +0 -127
- package/dist/widearea-dns-NsEUNYwz.js +0 -127
- package/dist/workspace-Dcfoy5JJ.js +0 -649
- package/dist/ws-log-N8R5MvGE.js +0 -267
- package/dist/ws-log-gwFxPxj5.js +0 -267
- /package/dist/{auto-update-CUeF99gI.js → auto-update-CpF0fycd.js} +0 -0
- /package/dist/{auto-update-cgkp9ZTJ.js → auto-update-DNWdO7uF.js} +0 -0
- /package/dist/{brew-CVZkr0GU.js → brew-nqf_MiE4.js} +0 -0
- /package/dist/{budget-DxYQSekw.js → budget-CPedI-qW.js} +0 -0
- /package/dist/{budget-BWBp8Res.js → budget-CRpvqDRX.js} +0 -0
- /package/dist/{cli-utils-DtAxdCte.js → cli-utils-C1YHVD4o.js} +0 -0
- /package/dist/{command-options-CSbuuqHr.js → command-options-BbponVnw.js} +0 -0
- /package/dist/{command-options-Cp1tf96a.js → command-options-s0gnvXnS.js} +0 -0
- /package/dist/{constants-O8yBqCBv.js → constants-Dhb6zSIV.js} +0 -0
- /package/dist/{dangerous-tools-5ObDWy1N.js → dangerous-tools-DGTtJ_JR.js} +0 -0
- /package/dist/{dangerous-tools-Jwr7jqNw.js → dangerous-tools-DxrfTOfT.js} +0 -0
- /package/dist/{delivery-queue-B6IHz4Ry.js → delivery-queue-Bxm0nzw7.js} +0 -0
- /package/dist/{display-BDOsXu8F.js → display-Jy3UdGzA.js} +0 -0
- /package/dist/{errors-CHow2wtt.js → errors-CKaCqKga.js} +0 -0
- /package/dist/{exec-BizYYQgP.js → exec-DDmuVVNq.js} +0 -0
- /package/dist/{format-Mq6iU0_5.js → format-ByEjgyTF.js} +0 -0
- /package/dist/{format-duration-DhWzz_5b.js → format-duration-Aaj5tjJd.js} +0 -0
- /package/dist/{format-relative-C6kUHuOj.js → format-relative-79_Y1n2Y.js} +0 -0
- /package/dist/{help-format-DUBI91Ti.js → help-format-BMKzarov.js} +0 -0
- /package/dist/{helpers-eJFa4K6r.js → helpers-DpEB9Mh0.js} +0 -0
- /package/dist/{helpers-DLgbkcEn.js → helpers-FMld9sBT.js} +0 -0
- /package/dist/{input-provenance-DJBdpeKk.js → input-provenance-Cy_KnBlP.js} +0 -0
- /package/dist/{is-main-Dt9DTcH1.js → is-main-yjaVwMtJ.js} +0 -0
- /package/dist/{loader-l2OBdJ8x.js → loader-Br7Vr0zn.js} +0 -0
- /package/dist/{loader-BoYxRfcW.js → loader-CkmOrXcC.js} +0 -0
- /package/dist/{logging-BdnOSVPD.js → logging-CY-Q5cwf.js} +0 -0
- /package/dist/{message-channel-w4F2b2F6.js → message-channel-dua8OOGJ.js} +0 -0
- /package/dist/{mime-B1ZoR53M.js → mime-CBg4KybI.js} +0 -0
- /package/dist/{model-param-b-DPwyNGn8.js → model-param-b-DW9f0NN8.js} +0 -0
- /package/dist/{node-match-8XZnaid6.js → node-match-BV8bTBd4.js} +0 -0
- /package/dist/{normalize-GDK8JTNW.js → normalize-_lmlBOW9.js} +0 -0
- /package/dist/{openclaw-root-C85WMnVV.js → openclaw-root-JPvmPTf7.js} +0 -0
- /package/dist/{outbound-send-deps-ANnAhImn.js → outbound-send-deps-BfUvuWGa.js} +0 -0
- /package/dist/{parse-6-2MDhdT.js → parse-CZRwKocn.js} +0 -0
- /package/dist/{parse-log-line-Bqh1SSzC.js → parse-log-line-CvrZEK6A.js} +0 -0
- /package/dist/{parse-log-line-DUZCjXbl.js → parse-log-line-mLdat0AH.js} +0 -0
- /package/dist/{parse-port-BKB9Exlg.js → parse-port-BSOOdo7I.js} +0 -0
- /package/dist/{parse-port-DrfvwwiL.js → parse-port-Y0NK62x1.js} +0 -0
- /package/dist/{parse-timeout-Di_tcEmi.js → parse-timeout-DVPQ3n9j.js} +0 -0
- /package/dist/{paths-DcVEkYX5.js → paths-DHjlJ6cn.js} +0 -0
- /package/dist/{pi-model-discovery-DsRqYJLy.js → pi-model-discovery-DzEIEgHL.js} +0 -0
- /package/dist/{plugins-CDJw924T.js → plugins-D6PBOdkn.js} +0 -0
- /package/dist/{program-context-Bvn8046-.js → program-context-Q1hkT73c.js} +0 -0
- /package/dist/{progress-CbZ2D53A.js → progress-C9Ha1NJh.js} +0 -0
- /package/dist/{prompt-style-DKy6qQxR.js → prompt-style-DQi8j03a.js} +0 -0
- /package/dist/{prompts-BI__va99.js → prompts-BEHxUC3w.js} +0 -0
- /package/dist/{prompts-_dDWkCAz.js → prompts-CSOhuiqe.js} +0 -0
- /package/dist/{queue-D_u34pbL.js → queue-BJGo7kAB.js} +0 -0
- /package/dist/{queue-PG591iID.js → queue-DYgUbdoq.js} +0 -0
- /package/dist/{redact-ClVwO7Nn.js → redact-CyKvdFrg.js} +0 -0
- /package/dist/{registry-Bs_DJK9E.js → registry-C5MAYD4V.js} +0 -0
- /package/dist/{registry-D_zlP1U-.js → registry-CRrXXVs0.js} +0 -0
- /package/dist/{requirements-BzZxj2Wu.js → requirements-CGkxTCu4.js} +0 -0
- /package/dist/{requirements-DIW1svgA.js → requirements-CIDaOcbO.js} +0 -0
- /package/dist/{runtime-guard-DeOXA_86.js → runtime-guard-nL3Lp8T-.js} +0 -0
- /package/dist/{secret-equal-Dghy3xsA.js → secret-equal-DJpmLXlG.js} +0 -0
- /package/dist/{send-BhAfdGII.js → send-CTcxgDDU.js} +0 -0
- /package/dist/{send-ga9udK1_.js → send-DPezUR3-.js} +0 -0
- /package/dist/{send-C2t9xpXI.js → send-DZQTaG7-.js} +0 -0
- /package/dist/{send-DigO-i9j.js → send-VDff2gra.js} +0 -0
- /package/dist/{send-Dz2BDHll.js → send-bgQNV8d1.js} +0 -0
- /package/dist/{session-key-BGiG_JcT.js → session-key-CQT-NR6w.js} +0 -0
- /package/dist/{shell-argv-CAq1mLa2.js → shell-argv-n9IueeJQ.js} +0 -0
- /package/dist/{skill-scanner-Coo4QoCd.js → skill-scanner-o6NgVMD9.js} +0 -0
- /package/dist/{status-CMnlcBVc.js → status-C53kTIXF.js} +0 -0
- /package/dist/{status-tDZPwewW.js → status-CZDDA_Sy.js} +0 -0
- /package/dist/{system-run-command-X9lDJIy0.js → system-run-command-BCjUffN9.js} +0 -0
- /package/dist/{system-run-command-DGk7dwQP.js → system-run-command-CqAqKL9K.js} +0 -0
- /package/dist/{tailnet-CuiNECdL.js → tailnet-Ciwjv243.js} +0 -0
- /package/dist/{templates-CeYJjVzw.js → templates-37RKpACb.js} +0 -0
- /package/dist/{templates-I3Z0xplD.js → templates-DPalk30o.js} +0 -0
- /package/dist/{thinking-BXEswx1X.js → thinking-2hxwmvTl.js} +0 -0
- /package/dist/{transcript-events-C1hdue6u.js → transcript-events-Bp7fGnwv.js} +0 -0
- /package/dist/{transcript-tools-DuyYOkUq.js → transcript-tools-D4Lbxlka.js} +0 -0
- /package/dist/{usage-format-BAirWUSO.js → usage-format-6Uar63S0.js} +0 -0
- /package/dist/{utils-C9sj30YY.js → utils-DT8uXjFS.js} +0 -0
- /package/dist/{wsl-CqyuRvtM.js → wsl-CrPvx2kZ.js} +0 -0
- /package/dist/{wsl-ymJYvc9Q.js → wsl-UvJ5dHah.js} +0 -0
|
@@ -0,0 +1,1815 @@
|
|
|
1
|
+
import { d as resolveIsNixMode, g as resolveStateDir, m as resolveOAuthDir, t as CONFIG_PATH, u as resolveGatewayPort, y as resolveRequiredHomeDir } from "./paths-BMuHNFxg.js";
|
|
2
|
+
import { U as getResolvedLoggerSettings, u as defaultRuntime } from "./subsystem-DfKstnEK.js";
|
|
3
|
+
import { C as shortenHomePath, b as resolveUserPath, w as sleep } from "./utils-DZ8pnOD5.js";
|
|
4
|
+
import { Q as loadAnimaPlugins } from "./reply-CR5T_oQJ.js";
|
|
5
|
+
import { n as runExec, t as runCommandWithTimeout } from "./exec-mhSykkaa.js";
|
|
6
|
+
import { t as resolveAnimaPackageRoot } from "./openclaw-root-0yHXtO35.js";
|
|
7
|
+
import { c as resolveDefaultAgentId, d as DEFAULT_AGENTS_FILENAME, r as resolveAgentDir, s as resolveAgentWorkspaceDir } from "./agent-scope-CPphqq-U.js";
|
|
8
|
+
import { At as DEFAULT_PROVIDER, Dt as CODEX_CLI_PROFILE_ID, Et as CLAUDE_CLI_PROFILE_ID, I as resolveApiKeyForProvider, f as resolveConfiguredModelRef, gt as updateAuthProfileStoreWithLock, i as getModelRefStatus, it as resolveApiKeyForProfile, kt as DEFAULT_MODEL, lt as repairOAuthProfileIdMismatch, m as resolveHooksGmailModel, mt as ensureAuthProfileStore, rt as resolveProfileUnusableUntilForDisplay } from "./model-selection-Cqt6aJ0G.js";
|
|
9
|
+
import { t as formatCliCommand } from "./command-format-CVL4K5cj.js";
|
|
10
|
+
import { t as isTruthyEnvValue } from "./env-v6411I8h.js";
|
|
11
|
+
import { l as writeConfigFile, o as readConfigFileSnapshot } from "./config-DaqbUdkI.js";
|
|
12
|
+
import { i as loadSessionStore, k as resolveMainSessionKey } from "./sessions-B-Cu7JZq.js";
|
|
13
|
+
import { en as loadModelCatalog } from "./cli-session-BVjY_XrW.js";
|
|
14
|
+
import { C as DEFAULT_SANDBOX_IMAGE, S as DEFAULT_SANDBOX_COMMON_IMAGE, l as resolveSandboxScope, x as DEFAULT_SANDBOX_BROWSER_IMAGE } from "./sandbox-DBSiVHt_.js";
|
|
15
|
+
import { i as resolveGatewayAuth } from "./auth-BNZsOHGF.js";
|
|
16
|
+
import { l as resolveGatewayBindHost, r as isLoopbackHost } from "./ws-COSqlEPx.js";
|
|
17
|
+
import { a as inspectPortUsage, s as formatPortDiagnostics } from "./ports-DHiKnPRX.js";
|
|
18
|
+
import { n as listChannelPlugins } from "./plugins-DhcGAPDB.js";
|
|
19
|
+
import { c as resolveStorePath, n as resolveSessionFilePath, s as resolveSessionTranscriptsDirForAgent } from "./paths-BXQQzXGQ.js";
|
|
20
|
+
import { i as readChannelAllowFromStore } from "./pairing-store-BsXzUDPv.js";
|
|
21
|
+
import { n as callGateway, t as buildGatewayConnectionDetails } from "./call-BYDpTVCZ.js";
|
|
22
|
+
import { n as resolveMemorySearchConfig } from "./manager-BDPgBQSH.js";
|
|
23
|
+
import { d as resolveGatewaySystemdServiceName, f as resolveGatewayWindowsTaskName, l as resolveGatewayLaunchAgentLabel, m as resolveNodeLaunchAgentLabel } from "./constants-BwBn5CGe.js";
|
|
24
|
+
import { t as buildWorkspaceSkillStatus } from "./skills-status-DX5pcqY3.js";
|
|
25
|
+
import { n as stylePromptMessage, r as stylePromptTitle, t as stylePromptHint } from "./prompt-style-Cm4wOtKm.js";
|
|
26
|
+
import { t as note$1 } from "./note-CSlg2BnB.js";
|
|
27
|
+
import { t as resolveChannelDefaultAccountId } from "./helpers-DpEB9Mh0.js";
|
|
28
|
+
import { t as collectChannelStatusIssues } from "./channels-status-issues-DdJdO866.js";
|
|
29
|
+
import { a as gatewayInstallErrorHint, d as renderSystemNodeWarning, i as buildGatewayInstallPlan, n as GATEWAY_DAEMON_RUNTIME_OPTIONS, p as resolveSystemNodeInfo, t as DEFAULT_GATEWAY_DAEMON_RUNTIME } from "./daemon-runtime-C0tz7VAC.js";
|
|
30
|
+
import { f as printWizardHeader, m as randomToken, n as applyWizardMetadata, s as guardCancel } from "./onboard-helpers-Dgh26hgP.js";
|
|
31
|
+
import { n as isWSLEnv, t as isWSL } from "./wsl-UvJ5dHah.js";
|
|
32
|
+
import { r as isSystemdUserServiceAvailable } from "./systemd-B43AvOGx.js";
|
|
33
|
+
import { a as launchAgentPlistExists, i as isLaunchAgentLoaded, o as repairLaunchAgentBootstrap, r as isLaunchAgentListed, s as resolveGatewayLogPaths, t as resolveGatewayService } from "./service-DxLxBhaU.js";
|
|
34
|
+
import { n as renderSystemdUnavailableHints, r as formatRuntimeStatus, t as isSystemdUnavailableDetail } from "./systemd-hints-DMJT-Bbc.js";
|
|
35
|
+
import { t as readLastGatewayErrorLine } from "./diagnostics-m79ZlMmZ.js";
|
|
36
|
+
import { a as renderGatewayServiceCleanupHints, i as findExtraGatewayServices, n as auditGatewayServiceConfig, r as needsNodeRuntimeMigration, t as SERVICE_AUDIT_CODES } from "./service-audit-M8y4TXVb.js";
|
|
37
|
+
import { r as healthCommand } from "./health-Bm8ZTvC3.js";
|
|
38
|
+
import { i as resolveControlUiDistIndexPathForRoot, r as resolveControlUiDistIndexHealth, t as formatHealthCheckFailure } from "./health-format-BksT6F68.js";
|
|
39
|
+
import { n as logConfigUpdated } from "./logging-BIeRw0WR.js";
|
|
40
|
+
import { n as doctorShellCompletion } from "./doctor-completion-DwjqdEcK.js";
|
|
41
|
+
import { t as runGatewayUpdate } from "./update-runner-CvxZmbu-.js";
|
|
42
|
+
import { n as buildAuthHealthSummary, r as formatRemainingShort, t as DEFAULT_OAUTH_WARN_MS } from "./auth-health-VO_MPqVX.js";
|
|
43
|
+
import { n as detectLegacyStateMigrations, r as runLegacyStateMigrations, t as loadAndMaybeMigrateDoctorConfig } from "./doctor-config-flow-wMHheFkC.js";
|
|
44
|
+
import { t as ensureSystemdUserLingerInteractive } from "./systemd-linger-Dzyxqsod.js";
|
|
45
|
+
import fs from "node:fs";
|
|
46
|
+
import os from "node:os";
|
|
47
|
+
import path from "node:path";
|
|
48
|
+
import fs$1 from "node:fs/promises";
|
|
49
|
+
import { execFile } from "node:child_process";
|
|
50
|
+
import { promisify } from "node:util";
|
|
51
|
+
import { confirm, intro, outro, select } from "@clack/prompts";
|
|
52
|
+
|
|
53
|
+
//#region src/commands/doctor-auth.ts
|
|
54
|
+
async function maybeRepairAnthropicOAuthProfileId(cfg, prompter) {
|
|
55
|
+
const repair = repairOAuthProfileIdMismatch({
|
|
56
|
+
cfg,
|
|
57
|
+
store: ensureAuthProfileStore(),
|
|
58
|
+
provider: "anthropic",
|
|
59
|
+
legacyProfileId: "anthropic:default"
|
|
60
|
+
});
|
|
61
|
+
if (!repair.migrated || repair.changes.length === 0) return cfg;
|
|
62
|
+
note$1(repair.changes.map((c) => `- ${c}`).join("\n"), "Auth profiles");
|
|
63
|
+
if (!await prompter.confirm({
|
|
64
|
+
message: "Update Anthropic OAuth profile id in config now?",
|
|
65
|
+
initialValue: true
|
|
66
|
+
})) return cfg;
|
|
67
|
+
return repair.config;
|
|
68
|
+
}
|
|
69
|
+
function pruneAuthOrder(order, profileIds) {
|
|
70
|
+
if (!order) return {
|
|
71
|
+
next: order,
|
|
72
|
+
changed: false
|
|
73
|
+
};
|
|
74
|
+
let changed = false;
|
|
75
|
+
const next = {};
|
|
76
|
+
for (const [provider, list] of Object.entries(order)) {
|
|
77
|
+
const filtered = list.filter((id) => !profileIds.has(id));
|
|
78
|
+
if (filtered.length !== list.length) changed = true;
|
|
79
|
+
if (filtered.length > 0) next[provider] = filtered;
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
next: Object.keys(next).length > 0 ? next : void 0,
|
|
83
|
+
changed
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function pruneAuthProfiles(cfg, profileIds) {
|
|
87
|
+
const profiles = cfg.auth?.profiles;
|
|
88
|
+
const order = cfg.auth?.order;
|
|
89
|
+
const nextProfiles = profiles ? { ...profiles } : void 0;
|
|
90
|
+
let changed = false;
|
|
91
|
+
if (nextProfiles) {
|
|
92
|
+
for (const id of profileIds) if (id in nextProfiles) {
|
|
93
|
+
delete nextProfiles[id];
|
|
94
|
+
changed = true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const prunedOrder = pruneAuthOrder(order, profileIds);
|
|
98
|
+
if (prunedOrder.changed) changed = true;
|
|
99
|
+
if (!changed) return {
|
|
100
|
+
next: cfg,
|
|
101
|
+
changed: false
|
|
102
|
+
};
|
|
103
|
+
const nextAuth = nextProfiles || prunedOrder.next ? {
|
|
104
|
+
...cfg.auth,
|
|
105
|
+
profiles: nextProfiles && Object.keys(nextProfiles).length > 0 ? nextProfiles : void 0,
|
|
106
|
+
order: prunedOrder.next
|
|
107
|
+
} : void 0;
|
|
108
|
+
return {
|
|
109
|
+
next: {
|
|
110
|
+
...cfg,
|
|
111
|
+
auth: nextAuth
|
|
112
|
+
},
|
|
113
|
+
changed: true
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
async function maybeRemoveDeprecatedCliAuthProfiles(cfg, prompter) {
|
|
117
|
+
const store = ensureAuthProfileStore(void 0, { allowKeychainPrompt: false });
|
|
118
|
+
const deprecated = /* @__PURE__ */ new Set();
|
|
119
|
+
if (store.profiles[CLAUDE_CLI_PROFILE_ID] || cfg.auth?.profiles?.[CLAUDE_CLI_PROFILE_ID]) deprecated.add(CLAUDE_CLI_PROFILE_ID);
|
|
120
|
+
if (store.profiles[CODEX_CLI_PROFILE_ID] || cfg.auth?.profiles?.[CODEX_CLI_PROFILE_ID]) deprecated.add(CODEX_CLI_PROFILE_ID);
|
|
121
|
+
if (deprecated.size === 0) return cfg;
|
|
122
|
+
const lines = ["Deprecated external CLI auth profiles detected (no longer supported):"];
|
|
123
|
+
if (deprecated.has(CLAUDE_CLI_PROFILE_ID)) lines.push(`- ${CLAUDE_CLI_PROFILE_ID} (Anthropic): use setup-token → ${formatCliCommand("anima models auth setup-token")}`);
|
|
124
|
+
if (deprecated.has(CODEX_CLI_PROFILE_ID)) lines.push(`- ${CODEX_CLI_PROFILE_ID} (OpenAI Codex): use OAuth → ${formatCliCommand("anima models auth login --provider openai-codex")}`);
|
|
125
|
+
note$1(lines.join("\n"), "Auth profiles");
|
|
126
|
+
if (!await prompter.confirmRepair({
|
|
127
|
+
message: "Remove deprecated CLI auth profiles now?",
|
|
128
|
+
initialValue: true
|
|
129
|
+
})) return cfg;
|
|
130
|
+
await updateAuthProfileStoreWithLock({ updater: (nextStore) => {
|
|
131
|
+
let mutated = false;
|
|
132
|
+
for (const id of deprecated) {
|
|
133
|
+
if (nextStore.profiles[id]) {
|
|
134
|
+
delete nextStore.profiles[id];
|
|
135
|
+
mutated = true;
|
|
136
|
+
}
|
|
137
|
+
if (nextStore.usageStats?.[id]) {
|
|
138
|
+
delete nextStore.usageStats[id];
|
|
139
|
+
mutated = true;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (nextStore.order) for (const [provider, list] of Object.entries(nextStore.order)) {
|
|
143
|
+
const filtered = list.filter((id) => !deprecated.has(id));
|
|
144
|
+
if (filtered.length !== list.length) {
|
|
145
|
+
mutated = true;
|
|
146
|
+
if (filtered.length > 0) nextStore.order[provider] = filtered;
|
|
147
|
+
else delete nextStore.order[provider];
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (nextStore.lastGood) {
|
|
151
|
+
for (const [provider, profileId] of Object.entries(nextStore.lastGood)) if (deprecated.has(profileId)) {
|
|
152
|
+
delete nextStore.lastGood[provider];
|
|
153
|
+
mutated = true;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return mutated;
|
|
157
|
+
} });
|
|
158
|
+
const pruned = pruneAuthProfiles(cfg, deprecated);
|
|
159
|
+
if (pruned.changed) note$1(Array.from(deprecated.values()).map((id) => `- removed ${id} from config`).join("\n"), "Doctor changes");
|
|
160
|
+
return pruned.next;
|
|
161
|
+
}
|
|
162
|
+
function formatAuthIssueHint(issue) {
|
|
163
|
+
if (issue.provider === "anthropic" && issue.profileId === CLAUDE_CLI_PROFILE_ID) return `Deprecated profile. Use ${formatCliCommand("anima models auth setup-token")} or ${formatCliCommand("anima configure")}.`;
|
|
164
|
+
if (issue.provider === "openai-codex" && issue.profileId === CODEX_CLI_PROFILE_ID) return `Deprecated profile. Use ${formatCliCommand("anima models auth login --provider openai-codex")} or ${formatCliCommand("anima configure")}.`;
|
|
165
|
+
return `Re-auth via \`${formatCliCommand("anima configure")}\` or \`${formatCliCommand("anima onboard")}\`.`;
|
|
166
|
+
}
|
|
167
|
+
function formatAuthIssueLine(issue) {
|
|
168
|
+
const remaining = issue.remainingMs !== void 0 ? ` (${formatRemainingShort(issue.remainingMs)})` : "";
|
|
169
|
+
const hint = formatAuthIssueHint(issue);
|
|
170
|
+
return `- ${issue.profileId}: ${issue.status}${remaining}${hint ? ` — ${hint}` : ""}`;
|
|
171
|
+
}
|
|
172
|
+
async function noteAuthProfileHealth(params) {
|
|
173
|
+
const store = ensureAuthProfileStore(void 0, { allowKeychainPrompt: params.allowKeychainPrompt });
|
|
174
|
+
const unusable = (() => {
|
|
175
|
+
const now = Date.now();
|
|
176
|
+
const out = [];
|
|
177
|
+
for (const profileId of Object.keys(store.usageStats ?? {})) {
|
|
178
|
+
const until = resolveProfileUnusableUntilForDisplay(store, profileId);
|
|
179
|
+
if (!until || now >= until) continue;
|
|
180
|
+
const stats = store.usageStats?.[profileId];
|
|
181
|
+
const remaining = formatRemainingShort(until - now);
|
|
182
|
+
const kind = typeof stats?.disabledUntil === "number" && now < stats.disabledUntil ? `disabled${stats.disabledReason ? `:${stats.disabledReason}` : ""}` : "cooldown";
|
|
183
|
+
const hint = kind.startsWith("disabled:billing") ? "Top up credits (provider billing) or switch provider." : "Wait for cooldown or switch provider.";
|
|
184
|
+
out.push(`- ${profileId}: ${kind} (${remaining})${hint ? ` — ${hint}` : ""}`);
|
|
185
|
+
}
|
|
186
|
+
return out;
|
|
187
|
+
})();
|
|
188
|
+
if (unusable.length > 0) note$1(unusable.join("\n"), "Auth profile cooldowns");
|
|
189
|
+
let summary = buildAuthHealthSummary({
|
|
190
|
+
store,
|
|
191
|
+
cfg: params.cfg,
|
|
192
|
+
warnAfterMs: DEFAULT_OAUTH_WARN_MS
|
|
193
|
+
});
|
|
194
|
+
const findIssues = () => summary.profiles.filter((profile) => (profile.type === "oauth" || profile.type === "token") && (profile.status === "expired" || profile.status === "expiring" || profile.status === "missing"));
|
|
195
|
+
let issues = findIssues();
|
|
196
|
+
if (issues.length === 0) return;
|
|
197
|
+
if (await params.prompter.confirmRepair({
|
|
198
|
+
message: "Refresh expiring OAuth tokens now? (static tokens need re-auth)",
|
|
199
|
+
initialValue: true
|
|
200
|
+
})) {
|
|
201
|
+
const refreshTargets = issues.filter((issue) => issue.type === "oauth" && [
|
|
202
|
+
"expired",
|
|
203
|
+
"expiring",
|
|
204
|
+
"missing"
|
|
205
|
+
].includes(issue.status));
|
|
206
|
+
const errors = [];
|
|
207
|
+
for (const profile of refreshTargets) try {
|
|
208
|
+
await resolveApiKeyForProfile({
|
|
209
|
+
cfg: params.cfg,
|
|
210
|
+
store,
|
|
211
|
+
profileId: profile.profileId
|
|
212
|
+
});
|
|
213
|
+
} catch (err) {
|
|
214
|
+
errors.push(`- ${profile.profileId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
215
|
+
}
|
|
216
|
+
if (errors.length > 0) note$1(errors.join("\n"), "OAuth refresh errors");
|
|
217
|
+
summary = buildAuthHealthSummary({
|
|
218
|
+
store: ensureAuthProfileStore(void 0, { allowKeychainPrompt: false }),
|
|
219
|
+
cfg: params.cfg,
|
|
220
|
+
warnAfterMs: DEFAULT_OAUTH_WARN_MS
|
|
221
|
+
});
|
|
222
|
+
issues = findIssues();
|
|
223
|
+
}
|
|
224
|
+
if (issues.length > 0) note$1(issues.map((issue) => formatAuthIssueLine({
|
|
225
|
+
profileId: issue.profileId,
|
|
226
|
+
provider: issue.provider,
|
|
227
|
+
status: issue.status,
|
|
228
|
+
remainingMs: issue.remainingMs
|
|
229
|
+
})).join("\n"), "Model auth");
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/commands/doctor-format.ts
|
|
234
|
+
function formatGatewayRuntimeSummary(runtime) {
|
|
235
|
+
return formatRuntimeStatus(runtime);
|
|
236
|
+
}
|
|
237
|
+
function buildGatewayRuntimeHints(runtime, options = {}) {
|
|
238
|
+
const hints = [];
|
|
239
|
+
if (!runtime) return hints;
|
|
240
|
+
const platform = options.platform ?? process.platform;
|
|
241
|
+
const env = options.env ?? process.env;
|
|
242
|
+
const fileLog = (() => {
|
|
243
|
+
try {
|
|
244
|
+
return getResolvedLoggerSettings().file;
|
|
245
|
+
} catch {
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
})();
|
|
249
|
+
if (platform === "linux" && isSystemdUnavailableDetail(runtime.detail)) {
|
|
250
|
+
hints.push(...renderSystemdUnavailableHints({ wsl: isWSLEnv() }));
|
|
251
|
+
if (fileLog) hints.push(`File logs: ${fileLog}`);
|
|
252
|
+
return hints;
|
|
253
|
+
}
|
|
254
|
+
if (runtime.cachedLabel && platform === "darwin") {
|
|
255
|
+
const label = resolveGatewayLaunchAgentLabel(env.ANIMA_PROFILE);
|
|
256
|
+
hints.push(`LaunchAgent label cached but plist missing. Clear with: launchctl bootout gui/$UID/${label}`);
|
|
257
|
+
hints.push(`Then reinstall: ${formatCliCommand("anima gateway install", env)}`);
|
|
258
|
+
}
|
|
259
|
+
if (runtime.missingUnit) {
|
|
260
|
+
hints.push(`Service not installed. Run: ${formatCliCommand("anima gateway install", env)}`);
|
|
261
|
+
if (fileLog) hints.push(`File logs: ${fileLog}`);
|
|
262
|
+
return hints;
|
|
263
|
+
}
|
|
264
|
+
if (runtime.status === "stopped") {
|
|
265
|
+
hints.push("Service is loaded but not running (likely exited immediately).");
|
|
266
|
+
if (fileLog) hints.push(`File logs: ${fileLog}`);
|
|
267
|
+
if (platform === "darwin") {
|
|
268
|
+
const logs = resolveGatewayLogPaths(env);
|
|
269
|
+
hints.push(`Launchd stdout (if installed): ${logs.stdoutPath}`);
|
|
270
|
+
hints.push(`Launchd stderr (if installed): ${logs.stderrPath}`);
|
|
271
|
+
} else if (platform === "linux") {
|
|
272
|
+
const unit = resolveGatewaySystemdServiceName(env.ANIMA_PROFILE);
|
|
273
|
+
hints.push(`Logs: journalctl --user -u ${unit}.service -n 200 --no-pager`);
|
|
274
|
+
} else if (platform === "win32") {
|
|
275
|
+
const task = resolveGatewayWindowsTaskName(env.ANIMA_PROFILE);
|
|
276
|
+
hints.push(`Logs: schtasks /Query /TN "${task}" /V /FO LIST`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return hints;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region src/commands/doctor-gateway-daemon-flow.ts
|
|
284
|
+
async function maybeRepairLaunchAgentBootstrap(params) {
|
|
285
|
+
if (process.platform !== "darwin") return false;
|
|
286
|
+
if (!await isLaunchAgentListed({ env: params.env })) return false;
|
|
287
|
+
if (await isLaunchAgentLoaded({ env: params.env })) return false;
|
|
288
|
+
if (!await launchAgentPlistExists(params.env)) return false;
|
|
289
|
+
note$1("LaunchAgent is listed but not loaded in launchd.", `${params.title} LaunchAgent`);
|
|
290
|
+
if (!await params.prompter.confirmSkipInNonInteractive({
|
|
291
|
+
message: `Repair ${params.title} LaunchAgent bootstrap now?`,
|
|
292
|
+
initialValue: true
|
|
293
|
+
})) return false;
|
|
294
|
+
params.runtime.log(`Bootstrapping ${params.title} LaunchAgent...`);
|
|
295
|
+
const repair = await repairLaunchAgentBootstrap({ env: params.env });
|
|
296
|
+
if (!repair.ok) {
|
|
297
|
+
params.runtime.error(`${params.title} LaunchAgent bootstrap failed: ${repair.detail ?? "unknown error"}`);
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
if (!await isLaunchAgentLoaded({ env: params.env })) {
|
|
301
|
+
params.runtime.error(`${params.title} LaunchAgent still not loaded after repair.`);
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
note$1(`${params.title} LaunchAgent repaired.`, `${params.title} LaunchAgent`);
|
|
305
|
+
return true;
|
|
306
|
+
}
|
|
307
|
+
async function maybeRepairGatewayDaemon(params) {
|
|
308
|
+
if (params.healthOk) return;
|
|
309
|
+
const service = resolveGatewayService();
|
|
310
|
+
let loaded = false;
|
|
311
|
+
try {
|
|
312
|
+
loaded = await service.isLoaded({ env: process.env });
|
|
313
|
+
} catch {
|
|
314
|
+
loaded = false;
|
|
315
|
+
}
|
|
316
|
+
let serviceRuntime;
|
|
317
|
+
if (loaded) serviceRuntime = await service.readRuntime(process.env).catch(() => void 0);
|
|
318
|
+
if (process.platform === "darwin" && params.cfg.gateway?.mode !== "remote") {
|
|
319
|
+
const gatewayRepaired = await maybeRepairLaunchAgentBootstrap({
|
|
320
|
+
env: process.env,
|
|
321
|
+
title: "Gateway",
|
|
322
|
+
runtime: params.runtime,
|
|
323
|
+
prompter: params.prompter
|
|
324
|
+
});
|
|
325
|
+
await maybeRepairLaunchAgentBootstrap({
|
|
326
|
+
env: {
|
|
327
|
+
...process.env,
|
|
328
|
+
ANIMA_LAUNCHD_LABEL: resolveNodeLaunchAgentLabel()
|
|
329
|
+
},
|
|
330
|
+
title: "Node",
|
|
331
|
+
runtime: params.runtime,
|
|
332
|
+
prompter: params.prompter
|
|
333
|
+
});
|
|
334
|
+
if (gatewayRepaired) {
|
|
335
|
+
loaded = await service.isLoaded({ env: process.env });
|
|
336
|
+
if (loaded) serviceRuntime = await service.readRuntime(process.env).catch(() => void 0);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
if (params.cfg.gateway?.mode !== "remote") {
|
|
340
|
+
const diagnostics = await inspectPortUsage(resolveGatewayPort(params.cfg, process.env));
|
|
341
|
+
if (diagnostics.status === "busy") note$1(formatPortDiagnostics(diagnostics).join("\n"), "Gateway port");
|
|
342
|
+
else if (loaded && serviceRuntime?.status === "running") {
|
|
343
|
+
const lastError = await readLastGatewayErrorLine(process.env);
|
|
344
|
+
if (lastError) note$1(`Last gateway error: ${lastError}`, "Gateway");
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
if (!loaded) {
|
|
348
|
+
if (process.platform === "linux") {
|
|
349
|
+
if (!await isSystemdUserServiceAvailable().catch(() => false)) {
|
|
350
|
+
note$1(renderSystemdUnavailableHints({ wsl: await isWSL() }).join("\n"), "Gateway");
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
note$1("Gateway service not installed.", "Gateway");
|
|
355
|
+
if (params.cfg.gateway?.mode !== "remote") {
|
|
356
|
+
if (await params.prompter.confirmSkipInNonInteractive({
|
|
357
|
+
message: "Install gateway service now?",
|
|
358
|
+
initialValue: true
|
|
359
|
+
})) {
|
|
360
|
+
const daemonRuntime = await params.prompter.select({
|
|
361
|
+
message: "Gateway service runtime",
|
|
362
|
+
options: GATEWAY_DAEMON_RUNTIME_OPTIONS,
|
|
363
|
+
initialValue: DEFAULT_GATEWAY_DAEMON_RUNTIME
|
|
364
|
+
}, DEFAULT_GATEWAY_DAEMON_RUNTIME);
|
|
365
|
+
const port = resolveGatewayPort(params.cfg, process.env);
|
|
366
|
+
const { programArguments, workingDirectory, environment } = await buildGatewayInstallPlan({
|
|
367
|
+
env: process.env,
|
|
368
|
+
port,
|
|
369
|
+
token: params.cfg.gateway?.auth?.token ?? process.env.ANIMA_GATEWAY_TOKEN,
|
|
370
|
+
runtime: daemonRuntime,
|
|
371
|
+
warn: (message, title) => note$1(message, title),
|
|
372
|
+
config: params.cfg
|
|
373
|
+
});
|
|
374
|
+
try {
|
|
375
|
+
await service.install({
|
|
376
|
+
env: process.env,
|
|
377
|
+
stdout: process.stdout,
|
|
378
|
+
programArguments,
|
|
379
|
+
workingDirectory,
|
|
380
|
+
environment
|
|
381
|
+
});
|
|
382
|
+
} catch (err) {
|
|
383
|
+
note$1(`Gateway service install failed: ${String(err)}`, "Gateway");
|
|
384
|
+
note$1(gatewayInstallErrorHint(), "Gateway");
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
const summary = formatGatewayRuntimeSummary(serviceRuntime);
|
|
391
|
+
const hints = buildGatewayRuntimeHints(serviceRuntime, {
|
|
392
|
+
platform: process.platform,
|
|
393
|
+
env: process.env
|
|
394
|
+
});
|
|
395
|
+
if (summary || hints.length > 0) {
|
|
396
|
+
const lines = [];
|
|
397
|
+
if (summary) lines.push(`Runtime: ${summary}`);
|
|
398
|
+
lines.push(...hints);
|
|
399
|
+
note$1(lines.join("\n"), "Gateway");
|
|
400
|
+
}
|
|
401
|
+
if (serviceRuntime?.status !== "running") {
|
|
402
|
+
if (await params.prompter.confirmSkipInNonInteractive({
|
|
403
|
+
message: "Start gateway service now?",
|
|
404
|
+
initialValue: true
|
|
405
|
+
})) {
|
|
406
|
+
await service.restart({
|
|
407
|
+
env: process.env,
|
|
408
|
+
stdout: process.stdout
|
|
409
|
+
});
|
|
410
|
+
await sleep(1500);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if (process.platform === "darwin") {
|
|
414
|
+
const label = resolveGatewayLaunchAgentLabel(process.env.ANIMA_PROFILE);
|
|
415
|
+
note$1(`LaunchAgent loaded; stopping requires "${formatCliCommand("anima gateway stop")}" or launchctl bootout gui/$UID/${label}.`, "Gateway");
|
|
416
|
+
}
|
|
417
|
+
if (serviceRuntime?.status === "running") {
|
|
418
|
+
if (await params.prompter.confirmSkipInNonInteractive({
|
|
419
|
+
message: "Restart gateway service now?",
|
|
420
|
+
initialValue: true
|
|
421
|
+
})) {
|
|
422
|
+
await service.restart({
|
|
423
|
+
env: process.env,
|
|
424
|
+
stdout: process.stdout
|
|
425
|
+
});
|
|
426
|
+
await sleep(1500);
|
|
427
|
+
try {
|
|
428
|
+
await healthCommand({
|
|
429
|
+
json: false,
|
|
430
|
+
timeoutMs: 1e4
|
|
431
|
+
}, params.runtime);
|
|
432
|
+
} catch (err) {
|
|
433
|
+
if (String(err).includes("gateway closed")) {
|
|
434
|
+
note$1("Gateway not running.", "Gateway");
|
|
435
|
+
note$1(params.gatewayDetailsMessage, "Gateway connection");
|
|
436
|
+
} else params.runtime.error(formatHealthCheckFailure(err));
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
//#endregion
|
|
443
|
+
//#region src/commands/doctor-gateway-health.ts
|
|
444
|
+
async function checkGatewayHealth(params) {
|
|
445
|
+
const gatewayDetails = buildGatewayConnectionDetails({ config: params.cfg });
|
|
446
|
+
const timeoutMs = typeof params.timeoutMs === "number" && params.timeoutMs > 0 ? params.timeoutMs : 1e4;
|
|
447
|
+
let healthOk = false;
|
|
448
|
+
try {
|
|
449
|
+
await healthCommand({
|
|
450
|
+
json: false,
|
|
451
|
+
timeoutMs,
|
|
452
|
+
config: params.cfg
|
|
453
|
+
}, params.runtime);
|
|
454
|
+
healthOk = true;
|
|
455
|
+
} catch (err) {
|
|
456
|
+
if (String(err).includes("gateway closed")) {
|
|
457
|
+
note$1("Gateway not running.", "Gateway");
|
|
458
|
+
note$1(gatewayDetails.message, "Gateway connection");
|
|
459
|
+
} else params.runtime.error(formatHealthCheckFailure(err));
|
|
460
|
+
}
|
|
461
|
+
if (healthOk) try {
|
|
462
|
+
const issues = collectChannelStatusIssues(await callGateway({
|
|
463
|
+
method: "channels.status",
|
|
464
|
+
params: {
|
|
465
|
+
probe: true,
|
|
466
|
+
timeoutMs: 5e3
|
|
467
|
+
},
|
|
468
|
+
timeoutMs: 6e3
|
|
469
|
+
}));
|
|
470
|
+
if (issues.length > 0) note$1(issues.map((issue) => `- ${issue.channel} ${issue.accountId}: ${issue.message}${issue.fix ? ` (${issue.fix})` : ""}`).join("\n"), "Channel warnings");
|
|
471
|
+
} catch {}
|
|
472
|
+
return { healthOk };
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region src/commands/doctor-gateway-services.ts
|
|
477
|
+
const execFileAsync$1 = promisify(execFile);
|
|
478
|
+
function detectGatewayRuntime(programArguments) {
|
|
479
|
+
const first = programArguments?.[0];
|
|
480
|
+
if (first) {
|
|
481
|
+
const base = path.basename(first).toLowerCase();
|
|
482
|
+
if (base === "bun" || base === "bun.exe") return "bun";
|
|
483
|
+
if (base === "node" || base === "node.exe") return "node";
|
|
484
|
+
}
|
|
485
|
+
return DEFAULT_GATEWAY_DAEMON_RUNTIME;
|
|
486
|
+
}
|
|
487
|
+
function findGatewayEntrypoint(programArguments) {
|
|
488
|
+
if (!programArguments || programArguments.length === 0) return null;
|
|
489
|
+
const gatewayIndex = programArguments.indexOf("gateway");
|
|
490
|
+
if (gatewayIndex <= 0) return null;
|
|
491
|
+
return programArguments[gatewayIndex - 1] ?? null;
|
|
492
|
+
}
|
|
493
|
+
function normalizeExecutablePath(value) {
|
|
494
|
+
return path.resolve(value);
|
|
495
|
+
}
|
|
496
|
+
function extractDetailPath(detail, prefix) {
|
|
497
|
+
if (!detail.startsWith(prefix)) return null;
|
|
498
|
+
const value = detail.slice(prefix.length).trim();
|
|
499
|
+
return value.length > 0 ? value : null;
|
|
500
|
+
}
|
|
501
|
+
async function cleanupLegacyLaunchdService(params) {
|
|
502
|
+
await execFileAsync$1("launchctl", [
|
|
503
|
+
"bootout",
|
|
504
|
+
typeof process.getuid === "function" ? `gui/${process.getuid()}` : "gui/501",
|
|
505
|
+
params.plistPath
|
|
506
|
+
]).catch(() => void 0);
|
|
507
|
+
await execFileAsync$1("launchctl", ["unload", params.plistPath]).catch(() => void 0);
|
|
508
|
+
const trashDir = path.join(os.homedir(), ".Trash");
|
|
509
|
+
try {
|
|
510
|
+
await fs$1.mkdir(trashDir, { recursive: true });
|
|
511
|
+
} catch {}
|
|
512
|
+
try {
|
|
513
|
+
await fs$1.access(params.plistPath);
|
|
514
|
+
} catch {
|
|
515
|
+
return null;
|
|
516
|
+
}
|
|
517
|
+
const dest = path.join(trashDir, `${params.label}-${Date.now()}.plist`);
|
|
518
|
+
try {
|
|
519
|
+
await fs$1.rename(params.plistPath, dest);
|
|
520
|
+
return dest;
|
|
521
|
+
} catch {
|
|
522
|
+
return null;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
async function maybeRepairGatewayServiceConfig(cfg, mode, runtime, prompter) {
|
|
526
|
+
if (resolveIsNixMode(process.env)) {
|
|
527
|
+
note$1("Nix mode detected; skip service updates.", "Gateway");
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
if (mode === "remote") {
|
|
531
|
+
note$1("Gateway mode is remote; skipped local service audit.", "Gateway");
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
const service = resolveGatewayService();
|
|
535
|
+
let command = null;
|
|
536
|
+
try {
|
|
537
|
+
command = await service.readCommand(process.env);
|
|
538
|
+
} catch {
|
|
539
|
+
command = null;
|
|
540
|
+
}
|
|
541
|
+
if (!command) return;
|
|
542
|
+
const audit = await auditGatewayServiceConfig({
|
|
543
|
+
env: process.env,
|
|
544
|
+
command
|
|
545
|
+
});
|
|
546
|
+
const needsNodeRuntime = needsNodeRuntimeMigration(audit.issues);
|
|
547
|
+
const systemNodeInfo = needsNodeRuntime ? await resolveSystemNodeInfo({ env: process.env }) : null;
|
|
548
|
+
const systemNodePath = systemNodeInfo?.supported ? systemNodeInfo.path : null;
|
|
549
|
+
if (needsNodeRuntime && !systemNodePath) {
|
|
550
|
+
const warning = renderSystemNodeWarning(systemNodeInfo);
|
|
551
|
+
if (warning) note$1(warning, "Gateway runtime");
|
|
552
|
+
note$1("System Node 22+ not found. Install via Homebrew/apt/choco and rerun doctor to migrate off Bun/version managers.", "Gateway runtime");
|
|
553
|
+
}
|
|
554
|
+
const port = resolveGatewayPort(cfg, process.env);
|
|
555
|
+
const runtimeChoice = detectGatewayRuntime(command.programArguments);
|
|
556
|
+
const { programArguments, workingDirectory, environment } = await buildGatewayInstallPlan({
|
|
557
|
+
env: process.env,
|
|
558
|
+
port,
|
|
559
|
+
token: cfg.gateway?.auth?.token ?? process.env.ANIMA_GATEWAY_TOKEN,
|
|
560
|
+
runtime: needsNodeRuntime && systemNodePath ? "node" : runtimeChoice,
|
|
561
|
+
nodePath: systemNodePath ?? void 0,
|
|
562
|
+
warn: (message, title) => note$1(message, title),
|
|
563
|
+
config: cfg
|
|
564
|
+
});
|
|
565
|
+
const expectedEntrypoint = findGatewayEntrypoint(programArguments);
|
|
566
|
+
const currentEntrypoint = findGatewayEntrypoint(command.programArguments);
|
|
567
|
+
if (expectedEntrypoint && currentEntrypoint && normalizeExecutablePath(expectedEntrypoint) !== normalizeExecutablePath(currentEntrypoint)) audit.issues.push({
|
|
568
|
+
code: SERVICE_AUDIT_CODES.gatewayEntrypointMismatch,
|
|
569
|
+
message: "Gateway service entrypoint does not match the current install.",
|
|
570
|
+
detail: `${currentEntrypoint} -> ${expectedEntrypoint}`,
|
|
571
|
+
level: "recommended"
|
|
572
|
+
});
|
|
573
|
+
if (audit.issues.length === 0) return;
|
|
574
|
+
note$1(audit.issues.map((issue) => issue.detail ? `- ${issue.message} (${issue.detail})` : `- ${issue.message}`).join("\n"), "Gateway service config");
|
|
575
|
+
const needsAggressive = audit.issues.filter((issue) => issue.level === "aggressive").length > 0;
|
|
576
|
+
if (needsAggressive && !prompter.shouldForce) note$1("Custom or unexpected service edits detected. Rerun with --force to overwrite.", "Gateway service config");
|
|
577
|
+
if (!(needsAggressive ? await prompter.confirmAggressive({
|
|
578
|
+
message: "Overwrite gateway service config with current defaults now?",
|
|
579
|
+
initialValue: Boolean(prompter.shouldForce)
|
|
580
|
+
}) : await prompter.confirmRepair({
|
|
581
|
+
message: "Update gateway service config to the recommended defaults now?",
|
|
582
|
+
initialValue: true
|
|
583
|
+
}))) return;
|
|
584
|
+
try {
|
|
585
|
+
await service.install({
|
|
586
|
+
env: process.env,
|
|
587
|
+
stdout: process.stdout,
|
|
588
|
+
programArguments,
|
|
589
|
+
workingDirectory,
|
|
590
|
+
environment
|
|
591
|
+
});
|
|
592
|
+
} catch (err) {
|
|
593
|
+
runtime.error(`Gateway service update failed: ${String(err)}`);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
async function maybeScanExtraGatewayServices(options, runtime, prompter) {
|
|
597
|
+
const extraServices = await findExtraGatewayServices(process.env, { deep: options.deep });
|
|
598
|
+
if (extraServices.length === 0) return;
|
|
599
|
+
note$1(extraServices.map((svc) => `- ${svc.label} (${svc.scope}, ${svc.detail})`).join("\n"), "Other gateway-like services detected");
|
|
600
|
+
const legacyServices = extraServices.filter((svc) => svc.legacy === true);
|
|
601
|
+
if (legacyServices.length > 0) {
|
|
602
|
+
if (await prompter.confirmSkipInNonInteractive({
|
|
603
|
+
message: "Remove legacy gateway services (anima/anima) now?",
|
|
604
|
+
initialValue: true
|
|
605
|
+
})) {
|
|
606
|
+
const removed = [];
|
|
607
|
+
const failed = [];
|
|
608
|
+
for (const svc of legacyServices) {
|
|
609
|
+
if (svc.platform !== "darwin") {
|
|
610
|
+
failed.push(`${svc.label} (${svc.platform})`);
|
|
611
|
+
continue;
|
|
612
|
+
}
|
|
613
|
+
if (svc.scope !== "user") {
|
|
614
|
+
failed.push(`${svc.label} (${svc.scope})`);
|
|
615
|
+
continue;
|
|
616
|
+
}
|
|
617
|
+
const plistPath = extractDetailPath(svc.detail, "plist:");
|
|
618
|
+
if (!plistPath) {
|
|
619
|
+
failed.push(`${svc.label} (missing plist path)`);
|
|
620
|
+
continue;
|
|
621
|
+
}
|
|
622
|
+
const dest = await cleanupLegacyLaunchdService({
|
|
623
|
+
label: svc.label,
|
|
624
|
+
plistPath
|
|
625
|
+
});
|
|
626
|
+
removed.push(dest ? `${svc.label} -> ${dest}` : svc.label);
|
|
627
|
+
}
|
|
628
|
+
if (removed.length > 0) note$1(removed.map((line) => `- ${line}`).join("\n"), "Legacy gateway removed");
|
|
629
|
+
if (failed.length > 0) note$1(failed.map((line) => `- ${line}`).join("\n"), "Legacy gateway cleanup skipped");
|
|
630
|
+
if (removed.length > 0) runtime.log("Legacy gateway services removed. Installing Anima gateway next.");
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
const cleanupHints = renderGatewayServiceCleanupHints();
|
|
634
|
+
if (cleanupHints.length > 0) note$1(cleanupHints.map((hint) => `- ${hint}`).join("\n"), "Cleanup hints");
|
|
635
|
+
note$1([
|
|
636
|
+
"Recommendation: run a single gateway per machine for most setups.",
|
|
637
|
+
"One gateway supports multiple agents.",
|
|
638
|
+
"If you need multiple gateways (e.g., a rescue bot on the same host), isolate ports + config/state (see docs: /gateway#multiple-gateways-same-host)."
|
|
639
|
+
].join("\n"), "Gateway recommendation");
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
//#endregion
|
|
643
|
+
//#region src/commands/doctor-install.ts
|
|
644
|
+
function noteSourceInstallIssues(root) {
|
|
645
|
+
if (!root) return;
|
|
646
|
+
const workspaceMarker = path.join(root, "pnpm-workspace.yaml");
|
|
647
|
+
if (!fs.existsSync(workspaceMarker)) return;
|
|
648
|
+
const warnings = [];
|
|
649
|
+
const nodeModules = path.join(root, "node_modules");
|
|
650
|
+
const pnpmStore = path.join(nodeModules, ".pnpm");
|
|
651
|
+
const tsxBin = path.join(nodeModules, ".bin", "tsx");
|
|
652
|
+
const srcEntry = path.join(root, "src", "entry.ts");
|
|
653
|
+
if (fs.existsSync(nodeModules) && !fs.existsSync(pnpmStore)) warnings.push("- node_modules was not installed by pnpm (missing node_modules/.pnpm). Run: pnpm install");
|
|
654
|
+
if (fs.existsSync(path.join(root, "package-lock.json"))) warnings.push("- package-lock.json present in a pnpm workspace. If you ran npm install, remove it and reinstall with pnpm.");
|
|
655
|
+
if (fs.existsSync(srcEntry) && !fs.existsSync(tsxBin)) warnings.push("- tsx binary is missing for source runs. Run: pnpm install");
|
|
656
|
+
if (warnings.length > 0) note$1(warnings.join("\n"), "Install");
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
//#endregion
|
|
660
|
+
//#region src/commands/doctor-memory-search.ts
|
|
661
|
+
/**
|
|
662
|
+
* Check whether memory search has a usable embedding provider.
|
|
663
|
+
* Runs as part of `anima doctor` — config-only, no network calls.
|
|
664
|
+
*/
|
|
665
|
+
async function noteMemorySearchHealth(cfg) {
|
|
666
|
+
const agentId = resolveDefaultAgentId(cfg);
|
|
667
|
+
const agentDir = resolveAgentDir(cfg, agentId);
|
|
668
|
+
const resolved = resolveMemorySearchConfig(cfg, agentId);
|
|
669
|
+
const hasRemoteApiKey = Boolean(resolved?.remote?.apiKey?.trim());
|
|
670
|
+
if (!resolved) {
|
|
671
|
+
note$1("Memory search is explicitly disabled (enabled: false).", "Memory search");
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
if (resolved.provider !== "auto") {
|
|
675
|
+
if (resolved.provider === "local") {
|
|
676
|
+
if (hasLocalEmbeddings(resolved.local)) return;
|
|
677
|
+
note$1([
|
|
678
|
+
"Memory search provider is set to \"local\" but no local model file was found.",
|
|
679
|
+
"",
|
|
680
|
+
"Fix (pick one):",
|
|
681
|
+
`- Install node-llama-cpp and set a local model path in config`,
|
|
682
|
+
`- Switch to a remote provider: ${formatCliCommand("anima config set agents.defaults.memorySearch.provider openai")}`,
|
|
683
|
+
"",
|
|
684
|
+
`Verify: ${formatCliCommand("anima memory status --deep")}`
|
|
685
|
+
].join("\n"), "Memory search");
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
if (hasRemoteApiKey || await hasApiKeyForProvider(resolved.provider, cfg, agentDir)) return;
|
|
689
|
+
const envVar = providerEnvVar(resolved.provider);
|
|
690
|
+
note$1([
|
|
691
|
+
`Memory search provider is set to "${resolved.provider}" but no API key was found.`,
|
|
692
|
+
`Semantic recall will not work without a valid API key.`,
|
|
693
|
+
"",
|
|
694
|
+
"Fix (pick one):",
|
|
695
|
+
`- Set ${envVar} in your environment`,
|
|
696
|
+
`- Add credentials: ${formatCliCommand(`anima auth add --provider ${resolved.provider}`)}`,
|
|
697
|
+
`- To disable: ${formatCliCommand("anima config set agents.defaults.memorySearch.enabled false")}`,
|
|
698
|
+
"",
|
|
699
|
+
`Verify: ${formatCliCommand("anima memory status --deep")}`
|
|
700
|
+
].join("\n"), "Memory search");
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
if (hasLocalEmbeddings(resolved.local)) return;
|
|
704
|
+
for (const provider of [
|
|
705
|
+
"openai",
|
|
706
|
+
"gemini",
|
|
707
|
+
"voyage"
|
|
708
|
+
]) if (hasRemoteApiKey || await hasApiKeyForProvider(provider, cfg, agentDir)) return;
|
|
709
|
+
note$1([
|
|
710
|
+
"Memory search is enabled but no embedding provider is configured.",
|
|
711
|
+
"Semantic recall will not work without an embedding provider.",
|
|
712
|
+
"",
|
|
713
|
+
"Fix (pick one):",
|
|
714
|
+
"- Set OPENAI_API_KEY or GEMINI_API_KEY in your environment",
|
|
715
|
+
`- Add credentials: ${formatCliCommand("anima auth add --provider openai")}`,
|
|
716
|
+
`- For local embeddings: configure agents.defaults.memorySearch.provider and local model path`,
|
|
717
|
+
`- To disable: ${formatCliCommand("anima config set agents.defaults.memorySearch.enabled false")}`,
|
|
718
|
+
"",
|
|
719
|
+
`Verify: ${formatCliCommand("anima memory status --deep")}`
|
|
720
|
+
].join("\n"), "Memory search");
|
|
721
|
+
}
|
|
722
|
+
function hasLocalEmbeddings(local) {
|
|
723
|
+
const modelPath = local.modelPath?.trim();
|
|
724
|
+
if (!modelPath) return false;
|
|
725
|
+
if (/^(hf:|https?:)/i.test(modelPath)) return true;
|
|
726
|
+
const resolved = resolveUserPath(modelPath);
|
|
727
|
+
try {
|
|
728
|
+
return fs.statSync(resolved).isFile();
|
|
729
|
+
} catch {
|
|
730
|
+
return false;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
async function hasApiKeyForProvider(provider, cfg, agentDir) {
|
|
734
|
+
const authProvider = provider === "gemini" ? "google" : provider;
|
|
735
|
+
try {
|
|
736
|
+
await resolveApiKeyForProvider({
|
|
737
|
+
provider: authProvider,
|
|
738
|
+
cfg,
|
|
739
|
+
agentDir
|
|
740
|
+
});
|
|
741
|
+
return true;
|
|
742
|
+
} catch {
|
|
743
|
+
return false;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
function providerEnvVar(provider) {
|
|
747
|
+
switch (provider) {
|
|
748
|
+
case "openai": return "OPENAI_API_KEY";
|
|
749
|
+
case "gemini": return "GEMINI_API_KEY";
|
|
750
|
+
case "voyage": return "VOYAGE_API_KEY";
|
|
751
|
+
default: return `${provider.toUpperCase()}_API_KEY`;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
//#endregion
|
|
756
|
+
//#region src/commands/doctor-platform-notes.ts
|
|
757
|
+
const execFileAsync = promisify(execFile);
|
|
758
|
+
function resolveHomeDir() {
|
|
759
|
+
return process.env.HOME ?? os.homedir();
|
|
760
|
+
}
|
|
761
|
+
async function noteMacLaunchAgentOverrides() {
|
|
762
|
+
if (process.platform !== "darwin") return;
|
|
763
|
+
const home = resolveHomeDir();
|
|
764
|
+
const markerPath = [path.join(home, ".anima", "disable-launchagent")].find((candidate) => fs.existsSync(candidate));
|
|
765
|
+
if (!markerPath) return;
|
|
766
|
+
const displayMarkerPath = shortenHomePath(markerPath);
|
|
767
|
+
note$1([
|
|
768
|
+
`- LaunchAgent writes are disabled via ${displayMarkerPath}.`,
|
|
769
|
+
"- To restore default behavior:",
|
|
770
|
+
` rm ${displayMarkerPath}`
|
|
771
|
+
].filter((line) => Boolean(line)).join("\n"), "Gateway (macOS)");
|
|
772
|
+
}
|
|
773
|
+
async function launchctlGetenv(name) {
|
|
774
|
+
try {
|
|
775
|
+
const result = await execFileAsync("/bin/launchctl", ["getenv", name], { encoding: "utf8" });
|
|
776
|
+
const value = String(result.stdout ?? "").trim();
|
|
777
|
+
return value.length > 0 ? value : void 0;
|
|
778
|
+
} catch {
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
function hasConfigGatewayCreds(cfg) {
|
|
783
|
+
const localToken = typeof cfg.gateway?.auth?.token === "string" ? cfg.gateway?.auth?.token.trim() : "";
|
|
784
|
+
const localPassword = typeof cfg.gateway?.auth?.password === "string" ? cfg.gateway?.auth?.password.trim() : "";
|
|
785
|
+
const remoteToken = typeof cfg.gateway?.remote?.token === "string" ? cfg.gateway?.remote?.token.trim() : "";
|
|
786
|
+
const remotePassword = typeof cfg.gateway?.remote?.password === "string" ? cfg.gateway?.remote?.password.trim() : "";
|
|
787
|
+
return Boolean(localToken || localPassword || remoteToken || remotePassword);
|
|
788
|
+
}
|
|
789
|
+
async function noteMacLaunchctlGatewayEnvOverrides(cfg, deps) {
|
|
790
|
+
if ((deps?.platform ?? process.platform) !== "darwin") return;
|
|
791
|
+
if (!hasConfigGatewayCreds(cfg)) return;
|
|
792
|
+
const getenv = deps?.getenv ?? launchctlGetenv;
|
|
793
|
+
const deprecatedLaunchctlEntries = [["ANIMA_GATEWAY_TOKEN", await getenv("ANIMA_GATEWAY_TOKEN")], ["ANIMA_GATEWAY_PASSWORD", await getenv("ANIMA_GATEWAY_PASSWORD")]].filter((entry) => Boolean(entry[1]?.trim()));
|
|
794
|
+
if (deprecatedLaunchctlEntries.length > 0) {
|
|
795
|
+
const lines = ["- Deprecated launchctl environment variables detected (ignored).", ...deprecatedLaunchctlEntries.map(([key]) => `- \`${key}\` is set; use \`ANIMA_${key.slice(key.indexOf("_") + 1)}\` instead.`)];
|
|
796
|
+
(deps?.noteFn ?? note$1)(lines.join("\n"), "Gateway (macOS)");
|
|
797
|
+
}
|
|
798
|
+
const tokenEntries = [["ANIMA_GATEWAY_TOKEN", await getenv("ANIMA_GATEWAY_TOKEN")]];
|
|
799
|
+
const passwordEntries = [["ANIMA_GATEWAY_PASSWORD", await getenv("ANIMA_GATEWAY_PASSWORD")]];
|
|
800
|
+
const tokenEntry = tokenEntries.find(([, value]) => value?.trim());
|
|
801
|
+
const passwordEntry = passwordEntries.find(([, value]) => value?.trim());
|
|
802
|
+
const envToken = tokenEntry?.[1]?.trim() ?? "";
|
|
803
|
+
const envPassword = passwordEntry?.[1]?.trim() ?? "";
|
|
804
|
+
const envTokenKey = tokenEntry?.[0];
|
|
805
|
+
const envPasswordKey = passwordEntry?.[0];
|
|
806
|
+
if (!envToken && !envPassword) return;
|
|
807
|
+
const lines = [
|
|
808
|
+
"- launchctl environment overrides detected (can cause confusing unauthorized errors).",
|
|
809
|
+
envToken && envTokenKey ? `- \`${envTokenKey}\` is set; it overrides config tokens.` : void 0,
|
|
810
|
+
envPassword ? `- \`${envPasswordKey ?? "ANIMA_GATEWAY_PASSWORD"}\` is set; it overrides config passwords.` : void 0,
|
|
811
|
+
"- Clear overrides and restart the app/gateway:",
|
|
812
|
+
envTokenKey ? ` launchctl unsetenv ${envTokenKey}` : void 0,
|
|
813
|
+
envPasswordKey ? ` launchctl unsetenv ${envPasswordKey}` : void 0
|
|
814
|
+
].filter((line) => Boolean(line));
|
|
815
|
+
(deps?.noteFn ?? note$1)(lines.join("\n"), "Gateway (macOS)");
|
|
816
|
+
}
|
|
817
|
+
function noteDeprecatedLegacyEnvVars(env = process.env, deps) {
|
|
818
|
+
const entries = Object.entries(env).filter(([key, value]) => key.startsWith("ANIMA_") && value?.trim()).map(([key]) => key);
|
|
819
|
+
if (entries.length === 0) return;
|
|
820
|
+
const lines = [
|
|
821
|
+
"- Deprecated legacy environment variables detected (ignored).",
|
|
822
|
+
"- Use ANIMA_* equivalents instead:",
|
|
823
|
+
...entries.map((key) => {
|
|
824
|
+
return ` ${key} -> ANIMA_${key.slice(key.indexOf("_") + 1)}`;
|
|
825
|
+
})
|
|
826
|
+
];
|
|
827
|
+
(deps?.noteFn ?? note$1)(lines.join("\n"), "Environment");
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
//#endregion
|
|
831
|
+
//#region src/commands/doctor-prompter.ts
|
|
832
|
+
function createDoctorPrompter(params) {
|
|
833
|
+
const yes = params.options.yes === true;
|
|
834
|
+
const requestedNonInteractive = params.options.nonInteractive === true;
|
|
835
|
+
const shouldRepair = params.options.repair === true || yes;
|
|
836
|
+
const shouldForce = params.options.force === true;
|
|
837
|
+
const isTty = Boolean(process.stdin.isTTY);
|
|
838
|
+
const nonInteractive = requestedNonInteractive || !isTty && !yes;
|
|
839
|
+
const canPrompt = isTty && !yes && !nonInteractive;
|
|
840
|
+
const confirmDefault = async (p) => {
|
|
841
|
+
if (nonInteractive) return false;
|
|
842
|
+
if (shouldRepair) return true;
|
|
843
|
+
if (!canPrompt) return Boolean(p.initialValue ?? false);
|
|
844
|
+
return guardCancel(await confirm({
|
|
845
|
+
...p,
|
|
846
|
+
message: stylePromptMessage(p.message)
|
|
847
|
+
}), params.runtime);
|
|
848
|
+
};
|
|
849
|
+
return {
|
|
850
|
+
confirm: confirmDefault,
|
|
851
|
+
confirmRepair: async (p) => {
|
|
852
|
+
if (nonInteractive) return false;
|
|
853
|
+
return confirmDefault(p);
|
|
854
|
+
},
|
|
855
|
+
confirmAggressive: async (p) => {
|
|
856
|
+
if (nonInteractive) return false;
|
|
857
|
+
if (shouldRepair && shouldForce) return true;
|
|
858
|
+
if (shouldRepair && !shouldForce) return false;
|
|
859
|
+
if (!canPrompt) return Boolean(p.initialValue ?? false);
|
|
860
|
+
return guardCancel(await confirm({
|
|
861
|
+
...p,
|
|
862
|
+
message: stylePromptMessage(p.message)
|
|
863
|
+
}), params.runtime);
|
|
864
|
+
},
|
|
865
|
+
confirmSkipInNonInteractive: async (p) => {
|
|
866
|
+
if (nonInteractive) return false;
|
|
867
|
+
if (shouldRepair) return true;
|
|
868
|
+
return confirmDefault(p);
|
|
869
|
+
},
|
|
870
|
+
select: async (p, fallback) => {
|
|
871
|
+
if (!canPrompt || shouldRepair) return fallback;
|
|
872
|
+
return guardCancel(await select({
|
|
873
|
+
...p,
|
|
874
|
+
message: stylePromptMessage(p.message),
|
|
875
|
+
options: p.options.map((opt) => opt.hint === void 0 ? opt : {
|
|
876
|
+
...opt,
|
|
877
|
+
hint: stylePromptHint(opt.hint)
|
|
878
|
+
})
|
|
879
|
+
}), params.runtime);
|
|
880
|
+
},
|
|
881
|
+
shouldRepair,
|
|
882
|
+
shouldForce
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
//#endregion
|
|
887
|
+
//#region src/commands/doctor-sandbox.ts
|
|
888
|
+
function resolveSandboxScript(scriptRel) {
|
|
889
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
890
|
+
candidates.add(process.cwd());
|
|
891
|
+
const argv1 = process.argv[1];
|
|
892
|
+
if (argv1) {
|
|
893
|
+
const normalized = path.resolve(argv1);
|
|
894
|
+
candidates.add(path.resolve(path.dirname(normalized), ".."));
|
|
895
|
+
candidates.add(path.resolve(path.dirname(normalized)));
|
|
896
|
+
}
|
|
897
|
+
for (const root of candidates) {
|
|
898
|
+
const scriptPath = path.join(root, scriptRel);
|
|
899
|
+
if (fs.existsSync(scriptPath)) return {
|
|
900
|
+
scriptPath,
|
|
901
|
+
cwd: root
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
return null;
|
|
905
|
+
}
|
|
906
|
+
async function runSandboxScript(scriptRel, runtime) {
|
|
907
|
+
const script = resolveSandboxScript(scriptRel);
|
|
908
|
+
if (!script) {
|
|
909
|
+
note$1(`Unable to locate ${scriptRel}. Run it from the repo root.`, "Sandbox");
|
|
910
|
+
return false;
|
|
911
|
+
}
|
|
912
|
+
runtime.log(`Running ${scriptRel}...`);
|
|
913
|
+
const result = await runCommandWithTimeout(["bash", script.scriptPath], {
|
|
914
|
+
timeoutMs: 1200 * 1e3,
|
|
915
|
+
cwd: script.cwd
|
|
916
|
+
});
|
|
917
|
+
if (result.code !== 0) {
|
|
918
|
+
runtime.error(`Failed running ${scriptRel}: ${result.stderr.trim() || result.stdout.trim() || "unknown error"}`);
|
|
919
|
+
return false;
|
|
920
|
+
}
|
|
921
|
+
runtime.log(`Completed ${scriptRel}.`);
|
|
922
|
+
return true;
|
|
923
|
+
}
|
|
924
|
+
async function isDockerAvailable() {
|
|
925
|
+
try {
|
|
926
|
+
await runExec("docker", [
|
|
927
|
+
"version",
|
|
928
|
+
"--format",
|
|
929
|
+
"{{.Server.Version}}"
|
|
930
|
+
], { timeoutMs: 5e3 });
|
|
931
|
+
return true;
|
|
932
|
+
} catch {
|
|
933
|
+
return false;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
async function dockerImageExists(image) {
|
|
937
|
+
try {
|
|
938
|
+
await runExec("docker", [
|
|
939
|
+
"image",
|
|
940
|
+
"inspect",
|
|
941
|
+
image
|
|
942
|
+
], { timeoutMs: 5e3 });
|
|
943
|
+
return true;
|
|
944
|
+
} catch (error) {
|
|
945
|
+
const stderr = error?.stderr || error?.message || "";
|
|
946
|
+
if (String(stderr).includes("No such image")) return false;
|
|
947
|
+
throw error;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
function resolveSandboxDockerImage(cfg) {
|
|
951
|
+
const image = cfg.agents?.defaults?.sandbox?.docker?.image?.trim();
|
|
952
|
+
return image ? image : DEFAULT_SANDBOX_IMAGE;
|
|
953
|
+
}
|
|
954
|
+
function resolveSandboxBrowserImage(cfg) {
|
|
955
|
+
const image = cfg.agents?.defaults?.sandbox?.browser?.image?.trim();
|
|
956
|
+
return image ? image : DEFAULT_SANDBOX_BROWSER_IMAGE;
|
|
957
|
+
}
|
|
958
|
+
function updateSandboxDockerImage(cfg, image) {
|
|
959
|
+
return {
|
|
960
|
+
...cfg,
|
|
961
|
+
agents: {
|
|
962
|
+
...cfg.agents,
|
|
963
|
+
defaults: {
|
|
964
|
+
...cfg.agents?.defaults,
|
|
965
|
+
sandbox: {
|
|
966
|
+
...cfg.agents?.defaults?.sandbox,
|
|
967
|
+
docker: {
|
|
968
|
+
...cfg.agents?.defaults?.sandbox?.docker,
|
|
969
|
+
image
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
function updateSandboxBrowserImage(cfg, image) {
|
|
977
|
+
return {
|
|
978
|
+
...cfg,
|
|
979
|
+
agents: {
|
|
980
|
+
...cfg.agents,
|
|
981
|
+
defaults: {
|
|
982
|
+
...cfg.agents?.defaults,
|
|
983
|
+
sandbox: {
|
|
984
|
+
...cfg.agents?.defaults?.sandbox,
|
|
985
|
+
browser: {
|
|
986
|
+
...cfg.agents?.defaults?.sandbox?.browser,
|
|
987
|
+
image
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
async function handleMissingSandboxImage(params, runtime, prompter) {
|
|
995
|
+
if (await dockerImageExists(params.image)) return;
|
|
996
|
+
const buildHint = params.buildScript ? `Build it with ${params.buildScript}.` : "Build or pull it first.";
|
|
997
|
+
note$1(`Sandbox ${params.kind} image missing: ${params.image}. ${buildHint}`, "Sandbox");
|
|
998
|
+
let built = false;
|
|
999
|
+
if (params.buildScript) {
|
|
1000
|
+
if (await prompter.confirmSkipInNonInteractive({
|
|
1001
|
+
message: `Build ${params.kind} sandbox image now?`,
|
|
1002
|
+
initialValue: true
|
|
1003
|
+
})) built = await runSandboxScript(params.buildScript, runtime);
|
|
1004
|
+
}
|
|
1005
|
+
if (built) return;
|
|
1006
|
+
}
|
|
1007
|
+
async function maybeRepairSandboxImages(cfg, runtime, prompter) {
|
|
1008
|
+
const sandbox = cfg.agents?.defaults?.sandbox;
|
|
1009
|
+
const mode = sandbox?.mode ?? "off";
|
|
1010
|
+
if (!sandbox || mode === "off") return cfg;
|
|
1011
|
+
if (!await isDockerAvailable()) {
|
|
1012
|
+
note$1("Docker not available; skipping sandbox image checks.", "Sandbox");
|
|
1013
|
+
return cfg;
|
|
1014
|
+
}
|
|
1015
|
+
let next = cfg;
|
|
1016
|
+
const changes = [];
|
|
1017
|
+
const dockerImage = resolveSandboxDockerImage(cfg);
|
|
1018
|
+
await handleMissingSandboxImage({
|
|
1019
|
+
kind: "base",
|
|
1020
|
+
image: dockerImage,
|
|
1021
|
+
buildScript: dockerImage === DEFAULT_SANDBOX_COMMON_IMAGE ? "scripts/sandbox-common-setup.sh" : dockerImage === DEFAULT_SANDBOX_IMAGE ? "scripts/sandbox-setup.sh" : void 0,
|
|
1022
|
+
updateConfig: (image) => {
|
|
1023
|
+
next = updateSandboxDockerImage(next, image);
|
|
1024
|
+
changes.push(`Updated agents.defaults.sandbox.docker.image → ${image}`);
|
|
1025
|
+
}
|
|
1026
|
+
}, runtime, prompter);
|
|
1027
|
+
if (sandbox.browser?.enabled) await handleMissingSandboxImage({
|
|
1028
|
+
kind: "browser",
|
|
1029
|
+
image: resolveSandboxBrowserImage(cfg),
|
|
1030
|
+
buildScript: "scripts/sandbox-browser-setup.sh",
|
|
1031
|
+
updateConfig: (image) => {
|
|
1032
|
+
next = updateSandboxBrowserImage(next, image);
|
|
1033
|
+
changes.push(`Updated agents.defaults.sandbox.browser.image → ${image}`);
|
|
1034
|
+
}
|
|
1035
|
+
}, runtime, prompter);
|
|
1036
|
+
if (changes.length > 0) note$1(changes.join("\n"), "Doctor changes");
|
|
1037
|
+
return next;
|
|
1038
|
+
}
|
|
1039
|
+
function noteSandboxScopeWarnings(cfg) {
|
|
1040
|
+
const globalSandbox = cfg.agents?.defaults?.sandbox;
|
|
1041
|
+
const agents = Array.isArray(cfg.agents?.list) ? cfg.agents.list : [];
|
|
1042
|
+
const warnings = [];
|
|
1043
|
+
for (const agent of agents) {
|
|
1044
|
+
const agentId = agent.id;
|
|
1045
|
+
const agentSandbox = agent.sandbox;
|
|
1046
|
+
if (!agentSandbox) continue;
|
|
1047
|
+
if (resolveSandboxScope({
|
|
1048
|
+
scope: agentSandbox.scope ?? globalSandbox?.scope,
|
|
1049
|
+
perSession: agentSandbox.perSession ?? globalSandbox?.perSession
|
|
1050
|
+
}) !== "shared") continue;
|
|
1051
|
+
const overrides = [];
|
|
1052
|
+
if (agentSandbox.docker && Object.keys(agentSandbox.docker).length > 0) overrides.push("docker");
|
|
1053
|
+
if (agentSandbox.browser && Object.keys(agentSandbox.browser).length > 0) overrides.push("browser");
|
|
1054
|
+
if (agentSandbox.prune && Object.keys(agentSandbox.prune).length > 0) overrides.push("prune");
|
|
1055
|
+
if (overrides.length === 0) continue;
|
|
1056
|
+
warnings.push([`- agents.list (id "${agentId}") sandbox ${overrides.join("/")} overrides ignored.`, ` scope resolves to "shared".`].join("\n"));
|
|
1057
|
+
}
|
|
1058
|
+
if (warnings.length > 0) note$1(warnings.join("\n"), "Sandbox");
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
//#endregion
|
|
1062
|
+
//#region src/commands/doctor-security.ts
|
|
1063
|
+
async function noteSecurityWarnings(cfg) {
|
|
1064
|
+
const warnings = [];
|
|
1065
|
+
const auditHint = `- Run: ${formatCliCommand("anima security audit --deep")}`;
|
|
1066
|
+
const gatewayBind = cfg.gateway?.bind ?? "loopback";
|
|
1067
|
+
const customBindHost = cfg.gateway?.customBindHost?.trim();
|
|
1068
|
+
const bindMode = [
|
|
1069
|
+
"auto",
|
|
1070
|
+
"lan",
|
|
1071
|
+
"loopback",
|
|
1072
|
+
"custom",
|
|
1073
|
+
"tailnet"
|
|
1074
|
+
].includes(gatewayBind) ? gatewayBind : void 0;
|
|
1075
|
+
const resolvedBindHost = bindMode ? await resolveGatewayBindHost(bindMode, customBindHost) : "0.0.0.0";
|
|
1076
|
+
const isExposed = !isLoopbackHost(resolvedBindHost);
|
|
1077
|
+
const resolvedAuth = resolveGatewayAuth({
|
|
1078
|
+
authConfig: cfg.gateway?.auth,
|
|
1079
|
+
env: process.env,
|
|
1080
|
+
tailscaleMode: cfg.gateway?.tailscale?.mode ?? "off"
|
|
1081
|
+
});
|
|
1082
|
+
const authToken = resolvedAuth.token?.trim() ?? "";
|
|
1083
|
+
const authPassword = resolvedAuth.password?.trim() ?? "";
|
|
1084
|
+
const hasToken = authToken.length > 0;
|
|
1085
|
+
const hasPassword = authPassword.length > 0;
|
|
1086
|
+
const hasSharedSecret = resolvedAuth.mode === "token" && hasToken || resolvedAuth.mode === "password" && hasPassword;
|
|
1087
|
+
const bindDescriptor = `"${gatewayBind}" (${resolvedBindHost})`;
|
|
1088
|
+
if (isExposed) if (!hasSharedSecret) {
|
|
1089
|
+
const authFixLines = resolvedAuth.mode === "password" ? [` Fix: ${formatCliCommand("anima configure")} to set a password`, ` Or switch to token: ${formatCliCommand("anima config set gateway.auth.mode token")}`] : [` Fix: ${formatCliCommand("anima doctor --fix")} to generate a token`, ` Or set token directly: ${formatCliCommand("anima config set gateway.auth.mode token")}`];
|
|
1090
|
+
warnings.push(`- CRITICAL: Gateway bound to ${bindDescriptor} without authentication.`, ` Anyone on your network (or internet if port-forwarded) can fully control your agent.`, ` Fix: ${formatCliCommand("anima config set gateway.bind loopback")}`, ...authFixLines);
|
|
1091
|
+
} else warnings.push(`- WARNING: Gateway bound to ${bindDescriptor} (network-accessible).`, ` Ensure your auth credentials are strong and not exposed.`);
|
|
1092
|
+
const warnDmPolicy = async (params) => {
|
|
1093
|
+
const dmPolicy = params.dmPolicy;
|
|
1094
|
+
const policyPath = params.policyPath ?? `${params.allowFromPath}policy`;
|
|
1095
|
+
const configAllowFrom = (params.allowFrom ?? []).map((v) => String(v).trim());
|
|
1096
|
+
const hasWildcard = configAllowFrom.includes("*");
|
|
1097
|
+
const storeAllowFrom = await readChannelAllowFromStore(params.provider).catch(() => []);
|
|
1098
|
+
const normalizedCfg = configAllowFrom.filter((v) => v !== "*").map((v) => params.normalizeEntry ? params.normalizeEntry(v) : v).map((v) => v.trim()).filter(Boolean);
|
|
1099
|
+
const normalizedStore = storeAllowFrom.map((v) => params.normalizeEntry ? params.normalizeEntry(v) : v).map((v) => v.trim()).filter(Boolean);
|
|
1100
|
+
const allowCount = Array.from(new Set([...normalizedCfg, ...normalizedStore])).length;
|
|
1101
|
+
const dmScope = cfg.session?.dmScope ?? "main";
|
|
1102
|
+
const isMultiUserDm = hasWildcard || allowCount > 1;
|
|
1103
|
+
if (dmPolicy === "open") {
|
|
1104
|
+
const allowFromPath = `${params.allowFromPath}allowFrom`;
|
|
1105
|
+
warnings.push(`- ${params.label} DMs: OPEN (${policyPath}="open"). Anyone can DM it.`);
|
|
1106
|
+
if (!hasWildcard) warnings.push(`- ${params.label} DMs: config invalid — "open" requires ${allowFromPath} to include "*".`);
|
|
1107
|
+
}
|
|
1108
|
+
if (dmPolicy === "disabled") {
|
|
1109
|
+
warnings.push(`- ${params.label} DMs: disabled (${policyPath}="disabled").`);
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
if (dmPolicy !== "open" && allowCount === 0) {
|
|
1113
|
+
warnings.push(`- ${params.label} DMs: locked (${policyPath}="${dmPolicy}") with no allowlist; unknown senders will be blocked / get a pairing code.`);
|
|
1114
|
+
warnings.push(` ${params.approveHint}`);
|
|
1115
|
+
}
|
|
1116
|
+
if (dmScope === "main" && isMultiUserDm) warnings.push(`- ${params.label} DMs: multiple senders share the main session; run: ` + formatCliCommand("anima config set session.dmScope \"per-channel-peer\"") + " (or \"per-account-channel-peer\" for multi-account channels) to isolate sessions.");
|
|
1117
|
+
};
|
|
1118
|
+
for (const plugin of listChannelPlugins()) {
|
|
1119
|
+
if (!plugin.security) continue;
|
|
1120
|
+
const defaultAccountId = resolveChannelDefaultAccountId({
|
|
1121
|
+
plugin,
|
|
1122
|
+
cfg,
|
|
1123
|
+
accountIds: plugin.config.listAccountIds(cfg)
|
|
1124
|
+
});
|
|
1125
|
+
const account = plugin.config.resolveAccount(cfg, defaultAccountId);
|
|
1126
|
+
if (!(plugin.config.isEnabled ? plugin.config.isEnabled(account, cfg) : true)) continue;
|
|
1127
|
+
if (!(plugin.config.isConfigured ? await plugin.config.isConfigured(account, cfg) : true)) continue;
|
|
1128
|
+
const dmPolicy = plugin.security.resolveDmPolicy?.({
|
|
1129
|
+
cfg,
|
|
1130
|
+
accountId: defaultAccountId,
|
|
1131
|
+
account
|
|
1132
|
+
});
|
|
1133
|
+
if (dmPolicy) await warnDmPolicy({
|
|
1134
|
+
label: plugin.meta.label ?? plugin.id,
|
|
1135
|
+
provider: plugin.id,
|
|
1136
|
+
dmPolicy: dmPolicy.policy,
|
|
1137
|
+
allowFrom: dmPolicy.allowFrom,
|
|
1138
|
+
policyPath: dmPolicy.policyPath,
|
|
1139
|
+
allowFromPath: dmPolicy.allowFromPath,
|
|
1140
|
+
approveHint: dmPolicy.approveHint,
|
|
1141
|
+
normalizeEntry: dmPolicy.normalizeEntry
|
|
1142
|
+
});
|
|
1143
|
+
if (plugin.security.collectWarnings) {
|
|
1144
|
+
const extra = await plugin.security.collectWarnings({
|
|
1145
|
+
cfg,
|
|
1146
|
+
accountId: defaultAccountId,
|
|
1147
|
+
account
|
|
1148
|
+
});
|
|
1149
|
+
if (extra?.length) warnings.push(...extra);
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
const lines = warnings.length > 0 ? warnings : ["- No channel security warnings detected."];
|
|
1153
|
+
lines.push(auditHint);
|
|
1154
|
+
note$1(lines.join("\n"), "Security");
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
//#endregion
|
|
1158
|
+
//#region src/commands/doctor-state-integrity.ts
|
|
1159
|
+
function existsDir(dir) {
|
|
1160
|
+
try {
|
|
1161
|
+
return fs.existsSync(dir) && fs.statSync(dir).isDirectory();
|
|
1162
|
+
} catch {
|
|
1163
|
+
return false;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
function existsFile(filePath) {
|
|
1167
|
+
try {
|
|
1168
|
+
return fs.existsSync(filePath) && fs.statSync(filePath).isFile();
|
|
1169
|
+
} catch {
|
|
1170
|
+
return false;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
function canWriteDir(dir) {
|
|
1174
|
+
try {
|
|
1175
|
+
fs.accessSync(dir, fs.constants.W_OK);
|
|
1176
|
+
return true;
|
|
1177
|
+
} catch {
|
|
1178
|
+
return false;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
function ensureDir(dir) {
|
|
1182
|
+
try {
|
|
1183
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
1184
|
+
return { ok: true };
|
|
1185
|
+
} catch (err) {
|
|
1186
|
+
return {
|
|
1187
|
+
ok: false,
|
|
1188
|
+
error: String(err)
|
|
1189
|
+
};
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
function dirPermissionHint(dir) {
|
|
1193
|
+
const uid = typeof process.getuid === "function" ? process.getuid() : null;
|
|
1194
|
+
const gid = typeof process.getgid === "function" ? process.getgid() : null;
|
|
1195
|
+
try {
|
|
1196
|
+
const stat = fs.statSync(dir);
|
|
1197
|
+
if (uid !== null && stat.uid !== uid) return `Owner mismatch (uid ${stat.uid}). Run: sudo chown -R $USER "${dir}"`;
|
|
1198
|
+
if (gid !== null && stat.gid !== gid) return `Group mismatch (gid ${stat.gid}). If access fails, run: sudo chown -R $USER "${dir}"`;
|
|
1199
|
+
} catch {
|
|
1200
|
+
return null;
|
|
1201
|
+
}
|
|
1202
|
+
return null;
|
|
1203
|
+
}
|
|
1204
|
+
function addUserRwx(mode) {
|
|
1205
|
+
return mode & 511 | 448;
|
|
1206
|
+
}
|
|
1207
|
+
function countJsonlLines(filePath) {
|
|
1208
|
+
try {
|
|
1209
|
+
const raw = fs.readFileSync(filePath, "utf-8");
|
|
1210
|
+
if (!raw) return 0;
|
|
1211
|
+
let count = 0;
|
|
1212
|
+
for (let i = 0; i < raw.length; i += 1) if (raw[i] === "\n") count += 1;
|
|
1213
|
+
if (!raw.endsWith("\n")) count += 1;
|
|
1214
|
+
return count;
|
|
1215
|
+
} catch {
|
|
1216
|
+
return 0;
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
function findOtherStateDirs(stateDir) {
|
|
1220
|
+
const resolvedState = path.resolve(stateDir);
|
|
1221
|
+
const roots = process.platform === "darwin" ? ["/Users"] : process.platform === "linux" ? ["/home"] : [];
|
|
1222
|
+
const found = [];
|
|
1223
|
+
for (const root of roots) {
|
|
1224
|
+
let entries = [];
|
|
1225
|
+
try {
|
|
1226
|
+
entries = fs.readdirSync(root, { withFileTypes: true });
|
|
1227
|
+
} catch {
|
|
1228
|
+
continue;
|
|
1229
|
+
}
|
|
1230
|
+
for (const entry of entries) {
|
|
1231
|
+
if (!entry.isDirectory()) continue;
|
|
1232
|
+
if (entry.name.startsWith(".")) continue;
|
|
1233
|
+
const candidates = [".anima"].map((dir) => path.resolve(root, entry.name, dir));
|
|
1234
|
+
for (const candidate of candidates) {
|
|
1235
|
+
if (candidate === resolvedState) continue;
|
|
1236
|
+
if (existsDir(candidate)) found.push(candidate);
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
return found;
|
|
1241
|
+
}
|
|
1242
|
+
async function noteStateIntegrity(cfg, prompter, configPath) {
|
|
1243
|
+
const warnings = [];
|
|
1244
|
+
const changes = [];
|
|
1245
|
+
const env = process.env;
|
|
1246
|
+
const homedir = () => resolveRequiredHomeDir(env, os.homedir);
|
|
1247
|
+
const stateDir = resolveStateDir(env, homedir);
|
|
1248
|
+
const defaultStateDir = path.join(homedir(), ".anima");
|
|
1249
|
+
const oauthDir = resolveOAuthDir(env, stateDir);
|
|
1250
|
+
const agentId = resolveDefaultAgentId(cfg);
|
|
1251
|
+
const sessionsDir = resolveSessionTranscriptsDirForAgent(agentId, env, homedir);
|
|
1252
|
+
const storePath = resolveStorePath(cfg.session?.store, { agentId });
|
|
1253
|
+
const storeDir = path.dirname(storePath);
|
|
1254
|
+
const displayStateDir = shortenHomePath(stateDir);
|
|
1255
|
+
const displayOauthDir = shortenHomePath(oauthDir);
|
|
1256
|
+
const displaySessionsDir = shortenHomePath(sessionsDir);
|
|
1257
|
+
const displayStoreDir = shortenHomePath(storeDir);
|
|
1258
|
+
const displayConfigPath = configPath ? shortenHomePath(configPath) : void 0;
|
|
1259
|
+
let stateDirExists = existsDir(stateDir);
|
|
1260
|
+
if (!stateDirExists) {
|
|
1261
|
+
warnings.push(`- CRITICAL: state directory missing (${displayStateDir}). Sessions, credentials, logs, and config are stored there.`);
|
|
1262
|
+
if (cfg.gateway?.mode === "remote") warnings.push("- Gateway is in remote mode; run doctor on the remote host where the gateway runs.");
|
|
1263
|
+
if (await prompter.confirmSkipInNonInteractive({
|
|
1264
|
+
message: `Create ${displayStateDir} now?`,
|
|
1265
|
+
initialValue: false
|
|
1266
|
+
})) {
|
|
1267
|
+
const created = ensureDir(stateDir);
|
|
1268
|
+
if (created.ok) {
|
|
1269
|
+
changes.push(`- Created ${displayStateDir}`);
|
|
1270
|
+
stateDirExists = true;
|
|
1271
|
+
} else warnings.push(`- Failed to create ${displayStateDir}: ${created.error}`);
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
if (stateDirExists && !canWriteDir(stateDir)) {
|
|
1275
|
+
warnings.push(`- State directory not writable (${displayStateDir}).`);
|
|
1276
|
+
const hint = dirPermissionHint(stateDir);
|
|
1277
|
+
if (hint) warnings.push(` ${hint}`);
|
|
1278
|
+
if (await prompter.confirmSkipInNonInteractive({
|
|
1279
|
+
message: `Repair permissions on ${displayStateDir}?`,
|
|
1280
|
+
initialValue: true
|
|
1281
|
+
})) try {
|
|
1282
|
+
const target = addUserRwx(fs.statSync(stateDir).mode);
|
|
1283
|
+
fs.chmodSync(stateDir, target);
|
|
1284
|
+
changes.push(`- Repaired permissions on ${displayStateDir}`);
|
|
1285
|
+
} catch (err) {
|
|
1286
|
+
warnings.push(`- Failed to repair ${displayStateDir}: ${String(err)}`);
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
if (stateDirExists && process.platform !== "win32") try {
|
|
1290
|
+
if ((fs.statSync(stateDir).mode & 63) !== 0) {
|
|
1291
|
+
warnings.push(`- State directory permissions are too open (${displayStateDir}). Recommend chmod 700.`);
|
|
1292
|
+
if (await prompter.confirmSkipInNonInteractive({
|
|
1293
|
+
message: `Tighten permissions on ${displayStateDir} to 700?`,
|
|
1294
|
+
initialValue: true
|
|
1295
|
+
})) {
|
|
1296
|
+
fs.chmodSync(stateDir, 448);
|
|
1297
|
+
changes.push(`- Tightened permissions on ${displayStateDir} to 700`);
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
} catch (err) {
|
|
1301
|
+
warnings.push(`- Failed to read ${displayStateDir} permissions: ${String(err)}`);
|
|
1302
|
+
}
|
|
1303
|
+
if (configPath && existsFile(configPath) && process.platform !== "win32") try {
|
|
1304
|
+
if ((fs.statSync(configPath).mode & 63) !== 0) {
|
|
1305
|
+
warnings.push(`- Config file is group/world readable (${displayConfigPath ?? configPath}). Recommend chmod 600.`);
|
|
1306
|
+
if (await prompter.confirmSkipInNonInteractive({
|
|
1307
|
+
message: `Tighten permissions on ${displayConfigPath ?? configPath} to 600?`,
|
|
1308
|
+
initialValue: true
|
|
1309
|
+
})) {
|
|
1310
|
+
fs.chmodSync(configPath, 384);
|
|
1311
|
+
changes.push(`- Tightened permissions on ${displayConfigPath ?? configPath} to 600`);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
} catch (err) {
|
|
1315
|
+
warnings.push(`- Failed to read config permissions (${displayConfigPath ?? configPath}): ${String(err)}`);
|
|
1316
|
+
}
|
|
1317
|
+
if (stateDirExists) {
|
|
1318
|
+
const dirCandidates = /* @__PURE__ */ new Map();
|
|
1319
|
+
dirCandidates.set(sessionsDir, "Sessions dir");
|
|
1320
|
+
dirCandidates.set(storeDir, "Session store dir");
|
|
1321
|
+
dirCandidates.set(oauthDir, "OAuth dir");
|
|
1322
|
+
const displayDirFor = (dir) => {
|
|
1323
|
+
if (dir === sessionsDir) return displaySessionsDir;
|
|
1324
|
+
if (dir === storeDir) return displayStoreDir;
|
|
1325
|
+
if (dir === oauthDir) return displayOauthDir;
|
|
1326
|
+
return shortenHomePath(dir);
|
|
1327
|
+
};
|
|
1328
|
+
for (const [dir, label] of dirCandidates) {
|
|
1329
|
+
const displayDir = displayDirFor(dir);
|
|
1330
|
+
if (!existsDir(dir)) {
|
|
1331
|
+
warnings.push(`- CRITICAL: ${label} missing (${displayDir}).`);
|
|
1332
|
+
if (await prompter.confirmSkipInNonInteractive({
|
|
1333
|
+
message: `Create ${label} at ${displayDir}?`,
|
|
1334
|
+
initialValue: true
|
|
1335
|
+
})) {
|
|
1336
|
+
const created = ensureDir(dir);
|
|
1337
|
+
if (created.ok) changes.push(`- Created ${label}: ${displayDir}`);
|
|
1338
|
+
else warnings.push(`- Failed to create ${displayDir}: ${created.error}`);
|
|
1339
|
+
}
|
|
1340
|
+
continue;
|
|
1341
|
+
}
|
|
1342
|
+
if (!canWriteDir(dir)) {
|
|
1343
|
+
warnings.push(`- ${label} not writable (${displayDir}).`);
|
|
1344
|
+
const hint = dirPermissionHint(dir);
|
|
1345
|
+
if (hint) warnings.push(` ${hint}`);
|
|
1346
|
+
if (await prompter.confirmSkipInNonInteractive({
|
|
1347
|
+
message: `Repair permissions on ${label}?`,
|
|
1348
|
+
initialValue: true
|
|
1349
|
+
})) try {
|
|
1350
|
+
const target = addUserRwx(fs.statSync(dir).mode);
|
|
1351
|
+
fs.chmodSync(dir, target);
|
|
1352
|
+
changes.push(`- Repaired permissions on ${label}: ${displayDir}`);
|
|
1353
|
+
} catch (err) {
|
|
1354
|
+
warnings.push(`- Failed to repair ${displayDir}: ${String(err)}`);
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
const extraStateDirs = /* @__PURE__ */ new Set();
|
|
1360
|
+
if (path.resolve(stateDir) !== path.resolve(defaultStateDir)) {
|
|
1361
|
+
if (existsDir(defaultStateDir)) extraStateDirs.add(defaultStateDir);
|
|
1362
|
+
}
|
|
1363
|
+
for (const other of findOtherStateDirs(stateDir)) extraStateDirs.add(other);
|
|
1364
|
+
if (extraStateDirs.size > 0) warnings.push([
|
|
1365
|
+
"- Multiple state directories detected. This can split session history.",
|
|
1366
|
+
...Array.from(extraStateDirs).map((dir) => ` - ${shortenHomePath(dir)}`),
|
|
1367
|
+
` Active state dir: ${displayStateDir}`
|
|
1368
|
+
].join("\n"));
|
|
1369
|
+
const store = loadSessionStore(storePath);
|
|
1370
|
+
const entries = Object.entries(store).filter(([, entry]) => entry && typeof entry === "object");
|
|
1371
|
+
if (entries.length > 0) {
|
|
1372
|
+
const recent = entries.slice().toSorted((a, b) => {
|
|
1373
|
+
const aUpdated = typeof a[1].updatedAt === "number" ? a[1].updatedAt : 0;
|
|
1374
|
+
return (typeof b[1].updatedAt === "number" ? b[1].updatedAt : 0) - aUpdated;
|
|
1375
|
+
}).slice(0, 5);
|
|
1376
|
+
const missing = recent.filter(([, entry]) => {
|
|
1377
|
+
const sessionId = entry.sessionId;
|
|
1378
|
+
if (!sessionId) return false;
|
|
1379
|
+
return !existsFile(resolveSessionFilePath(sessionId, entry, { agentId }));
|
|
1380
|
+
});
|
|
1381
|
+
if (missing.length > 0) warnings.push(`- ${missing.length}/${recent.length} recent sessions are missing transcripts. Check for deleted session files or split state dirs.`);
|
|
1382
|
+
const mainEntry = store[resolveMainSessionKey(cfg)];
|
|
1383
|
+
if (mainEntry?.sessionId) {
|
|
1384
|
+
const transcriptPath = resolveSessionFilePath(mainEntry.sessionId, mainEntry, { agentId });
|
|
1385
|
+
if (!existsFile(transcriptPath)) warnings.push(`- Main session transcript missing (${shortenHomePath(transcriptPath)}). History will appear to reset.`);
|
|
1386
|
+
else {
|
|
1387
|
+
const lineCount = countJsonlLines(transcriptPath);
|
|
1388
|
+
if (lineCount <= 1) warnings.push(`- Main session transcript has only ${lineCount} line. Session history may not be appending.`);
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
if (warnings.length > 0) note$1(warnings.join("\n"), "State integrity");
|
|
1393
|
+
if (changes.length > 0) note$1(changes.join("\n"), "Doctor changes");
|
|
1394
|
+
}
|
|
1395
|
+
function noteWorkspaceBackupTip(workspaceDir) {
|
|
1396
|
+
if (!existsDir(workspaceDir)) return;
|
|
1397
|
+
const gitMarker = path.join(workspaceDir, ".git");
|
|
1398
|
+
if (fs.existsSync(gitMarker)) return;
|
|
1399
|
+
note$1([
|
|
1400
|
+
"- Tip: back up the workspace in a private git repo (GitHub or GitLab).",
|
|
1401
|
+
"- Keep ~/.anima out of git; it contains credentials and session history.",
|
|
1402
|
+
"- Details: /concepts/agent-workspace#git-backup-recommended"
|
|
1403
|
+
].join("\n"), "Workspace");
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
//#endregion
|
|
1407
|
+
//#region src/commands/doctor-ui.ts
|
|
1408
|
+
async function maybeRepairUiProtocolFreshness(_runtime, prompter) {
|
|
1409
|
+
const root = await resolveAnimaPackageRoot({
|
|
1410
|
+
moduleUrl: import.meta.url,
|
|
1411
|
+
argv1: process.argv[1],
|
|
1412
|
+
cwd: process.cwd()
|
|
1413
|
+
});
|
|
1414
|
+
if (!root) return;
|
|
1415
|
+
const schemaPath = path.join(root, "src/gateway/protocol/schema.ts");
|
|
1416
|
+
const uiIndexPath = (await resolveControlUiDistIndexHealth({
|
|
1417
|
+
root,
|
|
1418
|
+
argv1: process.argv[1]
|
|
1419
|
+
})).indexPath ?? resolveControlUiDistIndexPathForRoot(root);
|
|
1420
|
+
try {
|
|
1421
|
+
const [schemaStats, uiStats] = await Promise.all([fs$1.stat(schemaPath).catch(() => null), fs$1.stat(uiIndexPath).catch(() => null)]);
|
|
1422
|
+
if (schemaStats && !uiStats) {
|
|
1423
|
+
note$1(["- Control UI assets are missing.", "- Run: pnpm ui:build"].join("\n"), "UI");
|
|
1424
|
+
const uiSourcesPath = path.join(root, "ui/package.json");
|
|
1425
|
+
if (!await fs$1.stat(uiSourcesPath).catch(() => null)) {
|
|
1426
|
+
note$1("Skipping UI build: ui/ sources not present.", "UI");
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1429
|
+
if (await prompter.confirmRepair({
|
|
1430
|
+
message: "Build Control UI assets now?",
|
|
1431
|
+
initialValue: true
|
|
1432
|
+
})) {
|
|
1433
|
+
note$1("Building Control UI assets... (this may take a moment)", "UI");
|
|
1434
|
+
const uiScriptPath = path.join(root, "scripts/ui.js");
|
|
1435
|
+
const buildResult = await runCommandWithTimeout([
|
|
1436
|
+
process.execPath,
|
|
1437
|
+
uiScriptPath,
|
|
1438
|
+
"build"
|
|
1439
|
+
], {
|
|
1440
|
+
cwd: root,
|
|
1441
|
+
timeoutMs: 12e4,
|
|
1442
|
+
env: {
|
|
1443
|
+
...process.env,
|
|
1444
|
+
FORCE_COLOR: "1"
|
|
1445
|
+
}
|
|
1446
|
+
});
|
|
1447
|
+
if (buildResult.code === 0) note$1("UI build complete.", "UI");
|
|
1448
|
+
else note$1([`UI build failed (exit ${buildResult.code ?? "unknown"}).`, buildResult.stderr.trim() ? buildResult.stderr.trim() : null].filter(Boolean).join("\n"), "UI");
|
|
1449
|
+
}
|
|
1450
|
+
return;
|
|
1451
|
+
}
|
|
1452
|
+
if (!schemaStats || !uiStats) return;
|
|
1453
|
+
if (schemaStats.mtime > uiStats.mtime) {
|
|
1454
|
+
const gitLog = await runCommandWithTimeout([
|
|
1455
|
+
"git",
|
|
1456
|
+
"-C",
|
|
1457
|
+
root,
|
|
1458
|
+
"log",
|
|
1459
|
+
`--since=${uiStats.mtime.toISOString()}`,
|
|
1460
|
+
"--format=%h %s",
|
|
1461
|
+
"src/gateway/protocol/schema.ts"
|
|
1462
|
+
], { timeoutMs: 5e3 }).catch(() => null);
|
|
1463
|
+
if (gitLog && gitLog.code === 0 && gitLog.stdout.trim()) {
|
|
1464
|
+
note$1(`UI assets are older than the protocol schema.\nFunctional changes since last build:\n${gitLog.stdout.trim().split("\n").map((l) => `- ${l}`).join("\n")}`, "UI Freshness");
|
|
1465
|
+
if (await prompter.confirmAggressive({
|
|
1466
|
+
message: "Rebuild UI now? (Detected protocol mismatch requiring update)",
|
|
1467
|
+
initialValue: true
|
|
1468
|
+
})) {
|
|
1469
|
+
const uiSourcesPath = path.join(root, "ui/package.json");
|
|
1470
|
+
if (!await fs$1.stat(uiSourcesPath).catch(() => null)) {
|
|
1471
|
+
note$1("Skipping UI rebuild: ui/ sources not present.", "UI");
|
|
1472
|
+
return;
|
|
1473
|
+
}
|
|
1474
|
+
note$1("Rebuilding stale UI assets... (this may take a moment)", "UI");
|
|
1475
|
+
const uiScriptPath = path.join(root, "scripts/ui.js");
|
|
1476
|
+
const buildResult = await runCommandWithTimeout([
|
|
1477
|
+
process.execPath,
|
|
1478
|
+
uiScriptPath,
|
|
1479
|
+
"build"
|
|
1480
|
+
], {
|
|
1481
|
+
cwd: root,
|
|
1482
|
+
timeoutMs: 12e4,
|
|
1483
|
+
env: {
|
|
1484
|
+
...process.env,
|
|
1485
|
+
FORCE_COLOR: "1"
|
|
1486
|
+
}
|
|
1487
|
+
});
|
|
1488
|
+
if (buildResult.code === 0) note$1("UI rebuild complete.", "UI");
|
|
1489
|
+
else note$1([`UI rebuild failed (exit ${buildResult.code ?? "unknown"}).`, buildResult.stderr.trim() ? buildResult.stderr.trim() : null].filter(Boolean).join("\n"), "UI");
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
} catch {}
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
//#endregion
|
|
1497
|
+
//#region src/commands/doctor-update.ts
|
|
1498
|
+
async function detectAnimaGitCheckout(root) {
|
|
1499
|
+
const res = await runCommandWithTimeout([
|
|
1500
|
+
"git",
|
|
1501
|
+
"-C",
|
|
1502
|
+
root,
|
|
1503
|
+
"rev-parse",
|
|
1504
|
+
"--show-toplevel"
|
|
1505
|
+
], { timeoutMs: 5e3 }).catch(() => null);
|
|
1506
|
+
if (!res) return "unknown";
|
|
1507
|
+
if (res.code !== 0) {
|
|
1508
|
+
if (res.stderr.toLowerCase().includes("not a git repository")) return "not-git";
|
|
1509
|
+
return "unknown";
|
|
1510
|
+
}
|
|
1511
|
+
return res.stdout.trim() === root ? "git" : "not-git";
|
|
1512
|
+
}
|
|
1513
|
+
async function maybeOfferUpdateBeforeDoctor(params) {
|
|
1514
|
+
if (!(!isTruthyEnvValue(process.env.ANIMA_UPDATE_IN_PROGRESS) && params.options.nonInteractive !== true && params.options.yes !== true && params.options.repair !== true && Boolean(process.stdin.isTTY)) || !params.root) return { updated: false };
|
|
1515
|
+
const git = await detectAnimaGitCheckout(params.root);
|
|
1516
|
+
if (git === "git") {
|
|
1517
|
+
if (!await params.confirm({
|
|
1518
|
+
message: "Update Anima from git before running doctor?",
|
|
1519
|
+
initialValue: true
|
|
1520
|
+
})) return { updated: false };
|
|
1521
|
+
note$1("Running update (fetch/rebase/build/ui:build/doctor)…", "Update");
|
|
1522
|
+
const result = await runGatewayUpdate({
|
|
1523
|
+
cwd: params.root,
|
|
1524
|
+
argv1: process.argv[1]
|
|
1525
|
+
});
|
|
1526
|
+
note$1([
|
|
1527
|
+
`Status: ${result.status}`,
|
|
1528
|
+
`Mode: ${result.mode}`,
|
|
1529
|
+
result.root ? `Root: ${result.root}` : null,
|
|
1530
|
+
result.reason ? `Reason: ${result.reason}` : null
|
|
1531
|
+
].filter(Boolean).join("\n"), "Update result");
|
|
1532
|
+
if (result.status === "ok") {
|
|
1533
|
+
params.outro("Update completed (doctor already ran as part of the update).");
|
|
1534
|
+
return {
|
|
1535
|
+
updated: true,
|
|
1536
|
+
handled: true
|
|
1537
|
+
};
|
|
1538
|
+
}
|
|
1539
|
+
return {
|
|
1540
|
+
updated: true,
|
|
1541
|
+
handled: false
|
|
1542
|
+
};
|
|
1543
|
+
}
|
|
1544
|
+
if (git === "not-git") note$1(["This install is not a git checkout.", `Run \`${formatCliCommand("anima update")}\` to update via your package manager (npm/pnpm), then rerun doctor.`].join("\n"), "Update");
|
|
1545
|
+
return { updated: false };
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
//#endregion
|
|
1549
|
+
//#region src/commands/doctor-workspace.ts
|
|
1550
|
+
const MEMORY_SYSTEM_PROMPT = [
|
|
1551
|
+
"Memory system not found in workspace.",
|
|
1552
|
+
"Paste this into your agent:",
|
|
1553
|
+
"",
|
|
1554
|
+
"Install the memory system by applying:",
|
|
1555
|
+
"https://github.com/anima/anima/commit/9ffea23f31ca1df5183b25668f8f814bee0fb34e",
|
|
1556
|
+
"https://github.com/anima/anima/commit/7d1fee70e76f2f634f1b41fca927ee663914183a"
|
|
1557
|
+
].join("\n");
|
|
1558
|
+
async function shouldSuggestMemorySystem(workspaceDir) {
|
|
1559
|
+
const memoryPaths = [path.join(workspaceDir, "MEMORY.md"), path.join(workspaceDir, "memory.md")];
|
|
1560
|
+
for (const memoryPath of memoryPaths) try {
|
|
1561
|
+
await fs.promises.access(memoryPath);
|
|
1562
|
+
return false;
|
|
1563
|
+
} catch {}
|
|
1564
|
+
const agentsPath = path.join(workspaceDir, DEFAULT_AGENTS_FILENAME);
|
|
1565
|
+
try {
|
|
1566
|
+
const content = await fs.promises.readFile(agentsPath, "utf-8");
|
|
1567
|
+
if (/memory\.md/i.test(content)) return false;
|
|
1568
|
+
} catch {}
|
|
1569
|
+
return true;
|
|
1570
|
+
}
|
|
1571
|
+
function detectLegacyWorkspaceDirs(params) {
|
|
1572
|
+
return {
|
|
1573
|
+
activeWorkspace: path.resolve(params.workspaceDir),
|
|
1574
|
+
legacyDirs: []
|
|
1575
|
+
};
|
|
1576
|
+
}
|
|
1577
|
+
function formatLegacyWorkspaceWarning(detection) {
|
|
1578
|
+
return [
|
|
1579
|
+
"Extra workspace directories detected (may contain old agent files):",
|
|
1580
|
+
...detection.legacyDirs.map((dir) => `- ${shortenHomePath(dir)}`),
|
|
1581
|
+
`Active workspace: ${shortenHomePath(detection.activeWorkspace)}`,
|
|
1582
|
+
"If unused, archive or move to Trash."
|
|
1583
|
+
].join("\n");
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
//#endregion
|
|
1587
|
+
//#region src/commands/doctor-workspace-status.ts
|
|
1588
|
+
function noteWorkspaceStatus(cfg) {
|
|
1589
|
+
const workspaceDir = resolveAgentWorkspaceDir(cfg, resolveDefaultAgentId(cfg));
|
|
1590
|
+
const legacyWorkspace = detectLegacyWorkspaceDirs({ workspaceDir });
|
|
1591
|
+
if (legacyWorkspace.legacyDirs.length > 0) note$1(formatLegacyWorkspaceWarning(legacyWorkspace), "Extra workspace");
|
|
1592
|
+
const skillsReport = buildWorkspaceSkillStatus(workspaceDir, { config: cfg });
|
|
1593
|
+
note$1([
|
|
1594
|
+
`Eligible: ${skillsReport.skills.filter((s) => s.eligible).length}`,
|
|
1595
|
+
`Missing requirements: ${skillsReport.skills.filter((s) => !s.eligible && !s.disabled && !s.blockedByAllowlist).length}`,
|
|
1596
|
+
`Blocked by allowlist: ${skillsReport.skills.filter((s) => s.blockedByAllowlist).length}`
|
|
1597
|
+
].join("\n"), "Skills status");
|
|
1598
|
+
const pluginRegistry = loadAnimaPlugins({
|
|
1599
|
+
config: cfg,
|
|
1600
|
+
workspaceDir,
|
|
1601
|
+
logger: {
|
|
1602
|
+
info: () => {},
|
|
1603
|
+
warn: () => {},
|
|
1604
|
+
error: () => {},
|
|
1605
|
+
debug: () => {}
|
|
1606
|
+
}
|
|
1607
|
+
});
|
|
1608
|
+
if (pluginRegistry.plugins.length > 0) {
|
|
1609
|
+
const loaded = pluginRegistry.plugins.filter((p) => p.status === "loaded");
|
|
1610
|
+
const disabled = pluginRegistry.plugins.filter((p) => p.status === "disabled");
|
|
1611
|
+
const errored = pluginRegistry.plugins.filter((p) => p.status === "error");
|
|
1612
|
+
note$1([
|
|
1613
|
+
`Loaded: ${loaded.length}`,
|
|
1614
|
+
`Disabled: ${disabled.length}`,
|
|
1615
|
+
`Errors: ${errored.length}`,
|
|
1616
|
+
errored.length > 0 ? `- ${errored.slice(0, 10).map((p) => p.id).join("\n- ")}${errored.length > 10 ? "\n- ..." : ""}` : null
|
|
1617
|
+
].filter((line) => Boolean(line)).join("\n"), "Plugins");
|
|
1618
|
+
}
|
|
1619
|
+
if (pluginRegistry.diagnostics.length > 0) note$1(pluginRegistry.diagnostics.map((diag) => {
|
|
1620
|
+
const prefix = diag.level.toUpperCase();
|
|
1621
|
+
const plugin = diag.pluginId ? ` ${diag.pluginId}` : "";
|
|
1622
|
+
const source = diag.source ? ` (${diag.source})` : "";
|
|
1623
|
+
return `- ${prefix}${plugin}: ${diag.message}${source}`;
|
|
1624
|
+
}).join("\n"), "Plugin diagnostics");
|
|
1625
|
+
return { workspaceDir };
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
//#endregion
|
|
1629
|
+
//#region src/commands/doctor.ts
|
|
1630
|
+
const intro$1 = (message) => intro(stylePromptTitle(message) ?? message);
|
|
1631
|
+
const outro$1 = (message) => outro(stylePromptTitle(message) ?? message);
|
|
1632
|
+
function resolveMode(cfg) {
|
|
1633
|
+
return cfg.gateway?.mode === "remote" ? "remote" : "local";
|
|
1634
|
+
}
|
|
1635
|
+
async function doctorCommand(runtime = defaultRuntime, options = {}) {
|
|
1636
|
+
const prompter = createDoctorPrompter({
|
|
1637
|
+
runtime,
|
|
1638
|
+
options
|
|
1639
|
+
});
|
|
1640
|
+
printWizardHeader(runtime);
|
|
1641
|
+
intro$1("Anima doctor");
|
|
1642
|
+
const root = await resolveAnimaPackageRoot({
|
|
1643
|
+
moduleUrl: import.meta.url,
|
|
1644
|
+
argv1: process.argv[1],
|
|
1645
|
+
cwd: process.cwd()
|
|
1646
|
+
});
|
|
1647
|
+
if ((await maybeOfferUpdateBeforeDoctor({
|
|
1648
|
+
runtime,
|
|
1649
|
+
options,
|
|
1650
|
+
root,
|
|
1651
|
+
confirm: (p) => prompter.confirm(p),
|
|
1652
|
+
outro: outro$1
|
|
1653
|
+
})).handled) return;
|
|
1654
|
+
await maybeRepairUiProtocolFreshness(runtime, prompter);
|
|
1655
|
+
noteSourceInstallIssues(root);
|
|
1656
|
+
noteDeprecatedLegacyEnvVars();
|
|
1657
|
+
const configResult = await loadAndMaybeMigrateDoctorConfig({
|
|
1658
|
+
options,
|
|
1659
|
+
confirm: (p) => prompter.confirm(p)
|
|
1660
|
+
});
|
|
1661
|
+
let cfg = configResult.cfg;
|
|
1662
|
+
const configPath = configResult.path ?? CONFIG_PATH;
|
|
1663
|
+
if (!cfg.gateway?.mode) {
|
|
1664
|
+
const lines = [
|
|
1665
|
+
"gateway.mode is unset; gateway start will be blocked.",
|
|
1666
|
+
`Fix: run ${formatCliCommand("anima configure")} and set Gateway mode (local/remote).`,
|
|
1667
|
+
`Or set directly: ${formatCliCommand("anima config set gateway.mode local")}`
|
|
1668
|
+
];
|
|
1669
|
+
if (!fs.existsSync(configPath)) lines.push(`Missing config: run ${formatCliCommand("anima setup")} first.`);
|
|
1670
|
+
note$1(lines.join("\n"), "Gateway");
|
|
1671
|
+
}
|
|
1672
|
+
cfg = await maybeRepairAnthropicOAuthProfileId(cfg, prompter);
|
|
1673
|
+
cfg = await maybeRemoveDeprecatedCliAuthProfiles(cfg, prompter);
|
|
1674
|
+
await noteAuthProfileHealth({
|
|
1675
|
+
cfg,
|
|
1676
|
+
prompter,
|
|
1677
|
+
allowKeychainPrompt: options.nonInteractive !== true && Boolean(process.stdin.isTTY)
|
|
1678
|
+
});
|
|
1679
|
+
const gatewayDetails = buildGatewayConnectionDetails({ config: cfg });
|
|
1680
|
+
if (gatewayDetails.remoteFallbackNote) note$1(gatewayDetails.remoteFallbackNote, "Gateway");
|
|
1681
|
+
if (resolveMode(cfg) === "local") {
|
|
1682
|
+
const auth = resolveGatewayAuth({
|
|
1683
|
+
authConfig: cfg.gateway?.auth,
|
|
1684
|
+
tailscaleMode: cfg.gateway?.tailscale?.mode ?? "off"
|
|
1685
|
+
});
|
|
1686
|
+
if (auth.mode !== "password" && (auth.mode !== "token" || !auth.token)) {
|
|
1687
|
+
note$1("Gateway auth is off or missing a token. Token auth is now the recommended default (including loopback).", "Gateway auth");
|
|
1688
|
+
if (options.generateGatewayToken === true ? true : options.nonInteractive === true ? false : await prompter.confirmRepair({
|
|
1689
|
+
message: "Generate and configure a gateway token now?",
|
|
1690
|
+
initialValue: true
|
|
1691
|
+
})) {
|
|
1692
|
+
const nextToken = randomToken();
|
|
1693
|
+
cfg = {
|
|
1694
|
+
...cfg,
|
|
1695
|
+
gateway: {
|
|
1696
|
+
...cfg.gateway,
|
|
1697
|
+
auth: {
|
|
1698
|
+
...cfg.gateway?.auth,
|
|
1699
|
+
mode: "token",
|
|
1700
|
+
token: nextToken
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
};
|
|
1704
|
+
note$1("Gateway token configured.", "Gateway auth");
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
const legacyState = await detectLegacyStateMigrations({ cfg });
|
|
1709
|
+
if (legacyState.preview.length > 0) {
|
|
1710
|
+
note$1(legacyState.preview.join("\n"), "Legacy state detected");
|
|
1711
|
+
if (options.nonInteractive === true ? true : await prompter.confirm({
|
|
1712
|
+
message: "Migrate legacy state (sessions/agent/WhatsApp auth) now?",
|
|
1713
|
+
initialValue: true
|
|
1714
|
+
})) {
|
|
1715
|
+
const migrated = await runLegacyStateMigrations({ detected: legacyState });
|
|
1716
|
+
if (migrated.changes.length > 0) note$1(migrated.changes.join("\n"), "Doctor changes");
|
|
1717
|
+
if (migrated.warnings.length > 0) note$1(migrated.warnings.join("\n"), "Doctor warnings");
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
await noteStateIntegrity(cfg, prompter, configResult.path ?? CONFIG_PATH);
|
|
1721
|
+
cfg = await maybeRepairSandboxImages(cfg, runtime, prompter);
|
|
1722
|
+
noteSandboxScopeWarnings(cfg);
|
|
1723
|
+
await maybeScanExtraGatewayServices(options, runtime, prompter);
|
|
1724
|
+
await maybeRepairGatewayServiceConfig(cfg, resolveMode(cfg), runtime, prompter);
|
|
1725
|
+
await noteMacLaunchAgentOverrides();
|
|
1726
|
+
await noteMacLaunchctlGatewayEnvOverrides(cfg);
|
|
1727
|
+
await noteSecurityWarnings(cfg);
|
|
1728
|
+
if (cfg.hooks?.gmail?.model?.trim()) {
|
|
1729
|
+
const hooksModelRef = resolveHooksGmailModel({
|
|
1730
|
+
cfg,
|
|
1731
|
+
defaultProvider: DEFAULT_PROVIDER
|
|
1732
|
+
});
|
|
1733
|
+
if (!hooksModelRef) note$1(`- hooks.gmail.model "${cfg.hooks.gmail.model}" could not be resolved`, "Hooks");
|
|
1734
|
+
else {
|
|
1735
|
+
const { provider: defaultProvider, model: defaultModel } = resolveConfiguredModelRef({
|
|
1736
|
+
cfg,
|
|
1737
|
+
defaultProvider: DEFAULT_PROVIDER,
|
|
1738
|
+
defaultModel: DEFAULT_MODEL
|
|
1739
|
+
});
|
|
1740
|
+
const catalog = await loadModelCatalog({ config: cfg });
|
|
1741
|
+
const status = getModelRefStatus({
|
|
1742
|
+
cfg,
|
|
1743
|
+
catalog,
|
|
1744
|
+
ref: hooksModelRef,
|
|
1745
|
+
defaultProvider,
|
|
1746
|
+
defaultModel
|
|
1747
|
+
});
|
|
1748
|
+
const warnings = [];
|
|
1749
|
+
if (!status.allowed) warnings.push(`- hooks.gmail.model "${status.key}" not in agents.defaults.models allowlist (will use primary instead)`);
|
|
1750
|
+
if (!status.inCatalog) warnings.push(`- hooks.gmail.model "${status.key}" not in the model catalog (may fail at runtime)`);
|
|
1751
|
+
if (warnings.length > 0) note$1(warnings.join("\n"), "Hooks");
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
if (options.nonInteractive !== true && process.platform === "linux" && resolveMode(cfg) === "local") {
|
|
1755
|
+
const service = resolveGatewayService();
|
|
1756
|
+
let loaded = false;
|
|
1757
|
+
try {
|
|
1758
|
+
loaded = await service.isLoaded({ env: process.env });
|
|
1759
|
+
} catch {
|
|
1760
|
+
loaded = false;
|
|
1761
|
+
}
|
|
1762
|
+
if (loaded) await ensureSystemdUserLingerInteractive({
|
|
1763
|
+
runtime,
|
|
1764
|
+
prompter: {
|
|
1765
|
+
confirm: async (p) => prompter.confirm(p),
|
|
1766
|
+
note: note$1
|
|
1767
|
+
},
|
|
1768
|
+
reason: "Gateway runs as a systemd user service. Without lingering, systemd stops the user session on logout/idle and kills the Gateway.",
|
|
1769
|
+
requireConfirm: true
|
|
1770
|
+
});
|
|
1771
|
+
}
|
|
1772
|
+
noteWorkspaceStatus(cfg);
|
|
1773
|
+
await noteMemorySearchHealth(cfg);
|
|
1774
|
+
await doctorShellCompletion(runtime, prompter, { nonInteractive: options.nonInteractive });
|
|
1775
|
+
const { healthOk } = await checkGatewayHealth({
|
|
1776
|
+
runtime,
|
|
1777
|
+
cfg,
|
|
1778
|
+
timeoutMs: options.nonInteractive === true ? 3e3 : 1e4
|
|
1779
|
+
});
|
|
1780
|
+
await maybeRepairGatewayDaemon({
|
|
1781
|
+
cfg,
|
|
1782
|
+
runtime,
|
|
1783
|
+
prompter,
|
|
1784
|
+
options,
|
|
1785
|
+
gatewayDetailsMessage: gatewayDetails.message,
|
|
1786
|
+
healthOk
|
|
1787
|
+
});
|
|
1788
|
+
if (prompter.shouldRepair || configResult.shouldWriteConfig) {
|
|
1789
|
+
cfg = applyWizardMetadata(cfg, {
|
|
1790
|
+
command: "doctor",
|
|
1791
|
+
mode: resolveMode(cfg)
|
|
1792
|
+
});
|
|
1793
|
+
await writeConfigFile(cfg);
|
|
1794
|
+
logConfigUpdated(runtime);
|
|
1795
|
+
const backupPath = `${CONFIG_PATH}.bak`;
|
|
1796
|
+
if (fs.existsSync(backupPath)) runtime.log(`Backup: ${shortenHomePath(backupPath)}`);
|
|
1797
|
+
} else runtime.log(`Run "${formatCliCommand("anima doctor --fix")}" to apply changes.`);
|
|
1798
|
+
if (options.workspaceSuggestions !== false) {
|
|
1799
|
+
const workspaceDir = resolveAgentWorkspaceDir(cfg, resolveDefaultAgentId(cfg));
|
|
1800
|
+
noteWorkspaceBackupTip(workspaceDir);
|
|
1801
|
+
if (await shouldSuggestMemorySystem(workspaceDir)) note$1(MEMORY_SYSTEM_PROMPT, "Workspace");
|
|
1802
|
+
}
|
|
1803
|
+
const finalSnapshot = await readConfigFileSnapshot();
|
|
1804
|
+
if (finalSnapshot.exists && !finalSnapshot.valid) {
|
|
1805
|
+
runtime.error("Invalid config:");
|
|
1806
|
+
for (const issue of finalSnapshot.issues) {
|
|
1807
|
+
const path = issue.path || "<root>";
|
|
1808
|
+
runtime.error(`- ${path}: ${issue.message}`);
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
outro$1("Doctor complete.");
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
//#endregion
|
|
1815
|
+
export { doctorCommand as t };
|