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