@spacebar_ai/moldclaw-core 2026.3.43 → 2026.3.45

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 (1131) hide show
  1. package/dist/accounts-5qY-dKca.d.ts +103 -0
  2. package/dist/accounts-CxV5zzzp.js +114 -0
  3. package/dist/acp-cli-2JoKJ0xt.js +2093 -0
  4. package/dist/actions.runtime-BJPd9nat.js +119 -0
  5. package/dist/actions.runtime-DVs4a2cB.js +133 -0
  6. package/dist/agent-scope-lZlwP1At.js +208 -0
  7. package/dist/agents-CmT3Jwvj.js +222 -0
  8. package/dist/agents-D7Pebhph.js +853 -0
  9. package/dist/agents.config-CX9CPNfP.js +17 -0
  10. package/dist/agents.config-DF9Zwn9n.js +121 -0
  11. package/dist/allow-list-B3f4EqAM.js +81 -0
  12. package/dist/allowlist-_YpK0-4h.js +142 -0
  13. package/dist/api-B44giplI.js +117 -0
  14. package/dist/audit-C3InXm7H.js +787 -0
  15. package/dist/audit-ChWS6RiF.js +54 -0
  16. package/dist/audit-channel.collect.runtime-DZzrS6v2.js +605 -0
  17. package/dist/audit-channel.runtime-B2XTOsSF.js +121 -0
  18. package/dist/audit-extra.async-C2G0mqmk.js +813 -0
  19. package/dist/audit-membership-runtime-DOv5-eHo.js +162 -0
  20. package/dist/audit.deep.runtime-DyL9O_sU.js +25 -0
  21. package/dist/audit.nondeep.runtime-C6jFgJfH.js +832 -0
  22. package/dist/audit.runtime-Cvh2wmWM.js +118 -0
  23. package/dist/auth-Ch3Rchm4.js +101 -0
  24. package/dist/auth-choice-Beq0dWPS.js +268 -0
  25. package/dist/auth-choice-DZYg94gS.js +122 -0
  26. package/dist/auth-choice-TVG_8lJj.js +507 -0
  27. package/dist/auth-choice-options-B_qxsjdj.js +123 -0
  28. package/dist/auth-choice-prompt-BayzDobT.js +115 -0
  29. package/dist/auth-choice-prompt-_UES859x.js +36 -0
  30. package/dist/auth-choice.apply-helpers-BhbNIV8X.js +66 -0
  31. package/dist/auth-choice.plugin-providers.runtime-CVC4Jzhp.js +119 -0
  32. package/dist/auth-profiles-C-Ul-Qkn.js +128139 -0
  33. package/dist/auth-profiles.runtime-Clyka_jV.js +116 -0
  34. package/dist/banner-CojBHPWr.js +342 -0
  35. package/dist/bluebubbles-BnLsj2Fy.d.ts +6 -0
  36. package/dist/bluebubbles-irYTGbfn.js +64 -0
  37. package/dist/bot-DdyrB2z9.d.ts +478 -0
  38. package/dist/brave-w4Fo8WZ3.js +24 -0
  39. package/dist/browser-cli-DWFs3P_i.js +1494 -0
  40. package/dist/build-info.json +3 -3
  41. package/dist/bundled/boot-md/handler.d.ts +1 -1
  42. package/dist/bundled/boot-md/handler.js +35 -35
  43. package/dist/bundled/bootstrap-extra-files/handler.d.ts +1 -1
  44. package/dist/bundled/bootstrap-extra-files/handler.js +1 -1
  45. package/dist/bundled/command-logger/handler.d.ts +1 -1
  46. package/dist/bundled/session-memory/handler.d.ts +1 -1
  47. package/dist/bundled/session-memory/handler.js +36 -36
  48. package/dist/call-Do7wTSr7.js +39 -0
  49. package/dist/call-gdDAt07d.js +640 -0
  50. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  51. package/dist/channel-34O87pvK.js +949 -0
  52. package/dist/channel-B3Xo_4d8.js +1598 -0
  53. package/dist/channel-BEqDvL49.js +397 -0
  54. package/dist/channel-BLOk9WRE.js +214 -0
  55. package/dist/channel-BY5H2cdy.js +803 -0
  56. package/dist/channel-BeOtzXIH.js +4681 -0
  57. package/dist/channel-Bt8x_5Kj.js +306 -0
  58. package/dist/channel-C3E8XWLF.js +1321 -0
  59. package/dist/channel-C6ngVfGr.js +943 -0
  60. package/dist/channel-CVDBca2b.js +226 -0
  61. package/dist/channel-Cctli72q.js +562 -0
  62. package/dist/channel-DEAbU9Dj2.js +316 -0
  63. package/dist/channel-DIULkrBN.js +575 -0
  64. package/dist/channel-DXb4gsSd.js +619 -0
  65. package/dist/channel-Dap9LY-9.js +352 -0
  66. package/dist/channel-DcJdUnab.js +538 -0
  67. package/dist/channel-ZYCQj3hP.js +207 -0
  68. package/dist/channel-account-context-Baszl3_B.js +103 -0
  69. package/dist/channel-hlzhFHDl.js +497 -0
  70. package/dist/channel-options-PwBzYYtq.js +50 -0
  71. package/dist/channel-plugin-ids-TZIY4hFs.js +26 -0
  72. package/dist/channel-summary-CCEAV13o.js +111 -0
  73. package/dist/channel-tY2Hg5ac.js +542 -0
  74. package/dist/channel-vMWcWq1U.js +920 -0
  75. package/dist/channel.runtime-8qWgkCxX.js +404 -0
  76. package/dist/channel.runtime-C4jtgrbI.js +179 -0
  77. package/dist/channel.runtime-CJ4ug6Mp.js +127 -0
  78. package/dist/channel.runtime-ChKRJAZ8.js +4011 -0
  79. package/dist/channel.runtime-Cj54LYU-.js +418 -0
  80. package/dist/channel.runtime-KH06-bu1.js +870 -0
  81. package/dist/channel.runtime-_GYnBh2X.js +199 -0
  82. package/dist/channel.runtime-go7Pzt6N.js +241 -0
  83. package/dist/channel.runtime-iypIZ0EU.js +171 -0
  84. package/dist/channel.runtime-mukTWpon.js +182 -0
  85. package/dist/channel.runtime-oNtF1sc3.js +218 -0
  86. package/dist/channel.setup-BZfok6kX.js +11 -0
  87. package/dist/channel.setup-CbXfZ2dq.js +9 -0
  88. package/dist/channel.setup-CfyM55np.js +8 -0
  89. package/dist/channel.setup-CoG-gJ6n.js +9 -0
  90. package/dist/channel.setup-Cp4PH_rc.js +57 -0
  91. package/dist/channel.setup-V2w9Jk9j.js +6 -0
  92. package/dist/channel.setup-t7F5WZE7.js +8 -0
  93. package/dist/channels/plugins/actions/discord.d.ts +2 -2
  94. package/dist/channels/plugins/actions/discord.js +35 -35
  95. package/dist/channels/plugins/actions/signal.d.ts +1 -1
  96. package/dist/channels/plugins/actions/signal.js +35 -35
  97. package/dist/channels/plugins/actions/telegram.d.ts +2 -2
  98. package/dist/channels/plugins/actions/telegram.js +35 -35
  99. package/dist/channels/plugins/agent-tools/whatsapp-login.d.ts +3 -3
  100. package/dist/channels/plugins/agent-tools/whatsapp-login.js +35 -35
  101. package/dist/channels-H5ThmyG8.js +1118 -0
  102. package/dist/channels-cQ-6NFCQ.js +404 -0
  103. package/dist/channels-cli-TmchKLFS.js +291 -0
  104. package/dist/channels-status-issues-DXnkXEeJ.js +16 -0
  105. package/dist/clawbot-cli-Cpbxu8dD.js +118 -0
  106. package/dist/cleanup-utils-D0L17RsX.js +96 -0
  107. package/dist/cli/daemon-cli.js +1 -1
  108. package/dist/cli--2bGSKdX.js +154 -0
  109. package/dist/command-registry-BaVPDmwn.js +242 -0
  110. package/dist/command-registry-DhLyeSbO.js +14 -0
  111. package/dist/command-secret-gateway-C5D_-jb0.js +111 -0
  112. package/dist/compact.runtime-C9a0kRAg.js +116 -0
  113. package/dist/completion-cli-Bg95upyk.js +17 -0
  114. package/dist/completion-cli-CrPdlnCH.js +445 -0
  115. package/dist/config-BbvDRSYp.js +31 -0
  116. package/dist/config-CwBv71QC.js +44 -0
  117. package/dist/config-cli-jsZsYhAl.js +678 -0
  118. package/dist/config-guard-DTaXXqly.js +118 -0
  119. package/dist/config-validation-Q6U1sP84.js +262 -0
  120. package/dist/config-value-DT3-5958.js +132 -0
  121. package/dist/configure-BJfMiVej.js +1100 -0
  122. package/dist/configure-Cist3Iza.js +243 -0
  123. package/dist/control-ui-assets-C1YDYi82.js +232 -0
  124. package/dist/control-ui-shared-Dm5Dh0Lo.js +29 -0
  125. package/dist/core-BwKq3krw.js +150 -0
  126. package/dist/core-hjBwfDsW.d.ts +87 -0
  127. package/dist/cron-cli-Bktbk7iP.js +639 -0
  128. package/dist/daemon-cli-BXyH8DBL.js +339 -0
  129. package/dist/daemon-install-mxcGYsRJ.js +180 -0
  130. package/dist/deliver-BPYUKaSp.js +111 -0
  131. package/dist/deliver-runtime-CwnLQZTN.js +111 -0
  132. package/dist/device-id-cli-XvwZbIyC.js +52 -0
  133. package/dist/device-identity-IG5DngWM.js +365 -0
  134. package/dist/devices-cli-DIsxj4xp.js +342 -0
  135. package/dist/diagnostic-DTPopFvh.js +310 -0
  136. package/dist/directory-cli-D253m0er.js +311 -0
  137. package/dist/directory-config-helpers-DpFcAbmo.d.ts +38 -0
  138. package/dist/directory.static-BXv9MXqm.js +44 -0
  139. package/dist/discord-DwFf1qp7.js +114 -0
  140. package/dist/discovery-DzRM1wzK.js +48 -0
  141. package/dist/dm-policy-shared-DKoGdUpY.d.ts +95 -0
  142. package/dist/dns-cli-BJiz6CLK.js +217 -0
  143. package/dist/docs-cli-Dq2Yi5qO.js +174 -0
  144. package/dist/doctor-completion-BPl6HiiZ.js +90 -0
  145. package/dist/doctor-config-flow-BHR1Ayyh.js +2437 -0
  146. package/dist/doctor-config-flow-PXVtrfkE.js +112 -0
  147. package/dist/enable-Cyagpq3b.js +24 -0
  148. package/dist/entry.js +4 -4
  149. package/dist/exec-approvals-cli-kLAev6bP.js +421 -0
  150. package/dist/extensions/acpx/index.d.ts +1 -1
  151. package/dist/extensions/amazon-bedrock/index.d.ts +1 -1
  152. package/dist/extensions/amazon-bedrock/index.js +4 -4
  153. package/dist/extensions/anthropic/index.d.ts +1 -1
  154. package/dist/extensions/anthropic/index.js +35 -35
  155. package/dist/extensions/bluebubbles/index.d.ts +1 -1
  156. package/dist/extensions/bluebubbles/index.js +39 -39
  157. package/dist/extensions/bluebubbles/setup-entry.d.ts +2 -2
  158. package/dist/extensions/bluebubbles/setup-entry.js +39 -39
  159. package/dist/extensions/brave/index.d.ts +1 -1
  160. package/dist/extensions/brave/index.js +5 -5
  161. package/dist/extensions/byteplus/index.d.ts +1 -1
  162. package/dist/extensions/byteplus/index.js +35 -35
  163. package/dist/extensions/cloudflare-ai-gateway/index.d.ts +1 -1
  164. package/dist/extensions/cloudflare-ai-gateway/index.js +36 -36
  165. package/dist/extensions/copilot-proxy/index.d.ts +1 -1
  166. package/dist/extensions/copilot-proxy/index.js +4 -4
  167. package/dist/extensions/device-pair/index.d.ts +1 -1
  168. package/dist/extensions/device-pair/index.js +4 -4
  169. package/dist/extensions/diagnostics-otel/index.d.ts +1 -1
  170. package/dist/extensions/diagnostics-otel/index.js +4 -4
  171. package/dist/extensions/diffs/index.d.ts +1 -1
  172. package/dist/extensions/discord/index.d.ts +1 -1
  173. package/dist/extensions/discord/index.js +40 -40
  174. package/dist/extensions/discord/setup-entry.d.ts +1 -1
  175. package/dist/extensions/discord/setup-entry.js +38 -38
  176. package/dist/extensions/elevenlabs/index.d.ts +1 -1
  177. package/dist/extensions/elevenlabs/index.js +35 -35
  178. package/dist/extensions/feishu/index.d.ts +2 -2
  179. package/dist/extensions/feishu/index.js +40 -40
  180. package/dist/extensions/feishu/setup-entry.d.ts +2 -2
  181. package/dist/extensions/feishu/setup-entry.js +37 -37
  182. package/dist/extensions/firecrawl/index.d.ts +1 -1
  183. package/dist/extensions/firecrawl/index.js +35 -35
  184. package/dist/extensions/github-copilot/index.d.ts +1 -1
  185. package/dist/extensions/github-copilot/index.js +35 -35
  186. package/dist/extensions/google/index.d.ts +1 -1
  187. package/dist/extensions/google/index.js +35 -35
  188. package/dist/extensions/googlechat/index.d.ts +1 -1
  189. package/dist/extensions/googlechat/index.js +38 -38
  190. package/dist/extensions/googlechat/setup-entry.d.ts +1 -1
  191. package/dist/extensions/googlechat/setup-entry.js +38 -38
  192. package/dist/extensions/huggingface/index.d.ts +1 -1
  193. package/dist/extensions/huggingface/index.js +35 -35
  194. package/dist/extensions/imessage/index.d.ts +1 -1
  195. package/dist/extensions/imessage/index.js +39 -39
  196. package/dist/extensions/imessage/setup-entry.d.ts +1 -1
  197. package/dist/extensions/imessage/setup-entry.js +39 -39
  198. package/dist/extensions/irc/index.d.ts +1 -1
  199. package/dist/extensions/irc/index.js +38 -38
  200. package/dist/extensions/irc/setup-entry.d.ts +2 -2
  201. package/dist/extensions/irc/setup-entry.js +38 -38
  202. package/dist/extensions/kakao-talkchannel/index.d.ts +1 -1
  203. package/dist/extensions/kakao-talkchannel/index.js +4 -4
  204. package/dist/extensions/kilocode/index.d.ts +1 -1
  205. package/dist/extensions/kilocode/index.js +35 -35
  206. package/dist/extensions/kimi-coding/index.d.ts +1 -1
  207. package/dist/extensions/kimi-coding/index.js +35 -35
  208. package/dist/extensions/line/index.d.ts +1 -1
  209. package/dist/extensions/line/index.js +37 -37
  210. package/dist/extensions/line/setup-entry.d.ts +1 -1
  211. package/dist/extensions/line/setup-entry.js +37 -37
  212. package/dist/extensions/llm-task/index.d.ts +1 -1
  213. package/dist/extensions/llm-task/index.js +35 -35
  214. package/dist/extensions/lobster/index.d.ts +1 -1
  215. package/dist/extensions/lobster/index.js +4 -4
  216. package/dist/extensions/matrix/index.d.ts +1 -1
  217. package/dist/extensions/matrix/index.js +40 -40
  218. package/dist/extensions/matrix/setup-entry.d.ts +2 -2
  219. package/dist/extensions/matrix/setup-entry.js +40 -40
  220. package/dist/extensions/mattermost/index.d.ts +1 -1
  221. package/dist/extensions/mattermost/index.js +37 -37
  222. package/dist/extensions/mattermost/setup-entry.d.ts +2 -2
  223. package/dist/extensions/mattermost/setup-entry.js +37 -37
  224. package/dist/extensions/memory-core/index.d.ts +1 -1
  225. package/dist/extensions/memory-core/index.js +4 -4
  226. package/dist/extensions/memory-lancedb/index.d.ts +1 -1
  227. package/dist/extensions/memory-lancedb/index.js +4 -4
  228. package/dist/extensions/microsoft/index.d.ts +1 -1
  229. package/dist/extensions/microsoft/index.js +35 -35
  230. package/dist/extensions/minimax/index.d.ts +1 -1
  231. package/dist/extensions/minimax/index.js +35 -35
  232. package/dist/extensions/mistral/index.d.ts +1 -1
  233. package/dist/extensions/mistral/index.js +35 -35
  234. package/dist/extensions/modelstudio/index.d.ts +1 -1
  235. package/dist/extensions/modelstudio/index.js +35 -35
  236. package/dist/extensions/moonshot/index.d.ts +1 -1
  237. package/dist/extensions/moonshot/index.js +35 -35
  238. package/dist/extensions/msteams/index.d.ts +1 -1
  239. package/dist/extensions/msteams/index.js +40 -40
  240. package/dist/extensions/msteams/setup-entry.d.ts +1 -1
  241. package/dist/extensions/msteams/setup-entry.js +40 -40
  242. package/dist/extensions/nextcloud-talk/index.d.ts +1 -1
  243. package/dist/extensions/nextcloud-talk/index.js +37 -37
  244. package/dist/extensions/nextcloud-talk/setup-entry.d.ts +2 -2
  245. package/dist/extensions/nextcloud-talk/setup-entry.js +37 -37
  246. package/dist/extensions/nostr/index.d.ts +1 -1
  247. package/dist/extensions/nostr/index.js +37 -37
  248. package/dist/extensions/nostr/setup-entry.d.ts +1 -1
  249. package/dist/extensions/nostr/setup-entry.js +37 -37
  250. package/dist/extensions/nvidia/index.d.ts +1 -1
  251. package/dist/extensions/nvidia/index.js +4 -4
  252. package/dist/extensions/ollama/index.d.ts +1 -1
  253. package/dist/extensions/ollama/index.js +7 -7
  254. package/dist/extensions/open-prose/index.d.ts +1 -1
  255. package/dist/extensions/open-prose/index.js +4 -4
  256. package/dist/extensions/openai/index.d.ts +1 -1
  257. package/dist/extensions/openai/index.js +35 -35
  258. package/dist/extensions/opencode/index.d.ts +1 -1
  259. package/dist/extensions/opencode/index.js +35 -35
  260. package/dist/extensions/opencode-go/index.d.ts +1 -1
  261. package/dist/extensions/opencode-go/index.js +35 -35
  262. package/dist/extensions/openrouter/index.d.ts +1 -1
  263. package/dist/extensions/openrouter/index.js +35 -35
  264. package/dist/extensions/openshell/index.d.ts +1 -1
  265. package/dist/extensions/openshell/index.js +35 -35
  266. package/dist/extensions/perplexity/index.d.ts +1 -1
  267. package/dist/extensions/perplexity/index.js +5 -5
  268. package/dist/extensions/phone-control/index.d.ts +1 -1
  269. package/dist/extensions/phone-control/index.js +4 -4
  270. package/dist/extensions/qianfan/index.d.ts +1 -1
  271. package/dist/extensions/qianfan/index.js +35 -35
  272. package/dist/extensions/qwen-portal-auth/index.d.ts +1 -1
  273. package/dist/extensions/qwen-portal-auth/index.js +35 -35
  274. package/dist/extensions/sglang/index.d.ts +1 -1
  275. package/dist/extensions/sglang/index.js +35 -35
  276. package/dist/extensions/signal/index.d.ts +1 -1
  277. package/dist/extensions/signal/index.js +38 -38
  278. package/dist/extensions/signal/setup-entry.d.ts +1 -1
  279. package/dist/extensions/signal/setup-entry.js +38 -38
  280. package/dist/extensions/slack/index.d.ts +1 -1
  281. package/dist/extensions/slack/index.js +39 -39
  282. package/dist/extensions/slack/setup-entry.d.ts +1 -1
  283. package/dist/extensions/slack/setup-entry.js +38 -38
  284. package/dist/extensions/synology-chat/index.d.ts +1 -1
  285. package/dist/extensions/synology-chat/index.js +37 -37
  286. package/dist/extensions/synology-chat/setup-entry.d.ts +1 -1
  287. package/dist/extensions/synology-chat/setup-entry.js +37 -37
  288. package/dist/extensions/synthetic/index.d.ts +1 -1
  289. package/dist/extensions/synthetic/index.js +35 -35
  290. package/dist/extensions/talk-voice/index.d.ts +1 -1
  291. package/dist/extensions/talk-voice/index.js +35 -35
  292. package/dist/extensions/telegram/index.d.ts +1 -1
  293. package/dist/extensions/telegram/index.js +38 -38
  294. package/dist/extensions/telegram/setup-entry.d.ts +1 -1
  295. package/dist/extensions/telegram/setup-entry.js +37 -37
  296. package/dist/extensions/thread-ownership/index.d.ts +1 -1
  297. package/dist/extensions/thread-ownership/index.js +4 -4
  298. package/dist/extensions/tlon/index.d.ts +1 -1
  299. package/dist/extensions/tlon/index.js +37 -37
  300. package/dist/extensions/tlon/setup-entry.d.ts +1 -1
  301. package/dist/extensions/tlon/setup-entry.js +37 -37
  302. package/dist/extensions/together/index.d.ts +1 -1
  303. package/dist/extensions/together/index.js +35 -35
  304. package/dist/extensions/twitch/index.d.ts +2 -2
  305. package/dist/extensions/twitch/index.js +37 -37
  306. package/dist/extensions/venice/index.d.ts +1 -1
  307. package/dist/extensions/venice/index.js +35 -35
  308. package/dist/extensions/vercel-ai-gateway/index.d.ts +1 -1
  309. package/dist/extensions/vercel-ai-gateway/index.js +36 -36
  310. package/dist/extensions/vllm/index.d.ts +1 -1
  311. package/dist/extensions/vllm/index.js +35 -35
  312. package/dist/extensions/voice-call/index.d.ts +1 -1
  313. package/dist/extensions/voice-call/index.js +35 -35
  314. package/dist/extensions/volcengine/index.d.ts +1 -1
  315. package/dist/extensions/volcengine/index.js +35 -35
  316. package/dist/extensions/whatsapp/index.d.ts +1 -1
  317. package/dist/extensions/whatsapp/index.js +38 -38
  318. package/dist/extensions/whatsapp/setup-entry.d.ts +1 -1
  319. package/dist/extensions/whatsapp/setup-entry.js +38 -38
  320. package/dist/extensions/xai/index.d.ts +1 -1
  321. package/dist/extensions/xai/index.js +35 -35
  322. package/dist/extensions/xiaomi/index.d.ts +1 -1
  323. package/dist/extensions/xiaomi/index.js +35 -35
  324. package/dist/extensions/zai/index.d.ts +1 -1
  325. package/dist/extensions/zai/index.js +35 -35
  326. package/dist/extensions/zalo/index.d.ts +1 -1
  327. package/dist/extensions/zalo/index.js +39 -39
  328. package/dist/extensions/zalo/setup-entry.d.ts +1 -1
  329. package/dist/extensions/zalo/setup-entry.js +39 -39
  330. package/dist/extensions/zalouser/index.d.ts +1 -1
  331. package/dist/extensions/zalouser/index.js +40 -40
  332. package/dist/extensions/zalouser/setup-entry.d.ts +1 -1
  333. package/dist/extensions/zalouser/setup-entry.js +40 -40
  334. package/dist/feishu-fIcnHDTd.d.ts +36 -0
  335. package/dist/gateway-cli-DofujQf3.js +26437 -0
  336. package/dist/gateway-install-token-vvtOvufH.js +163 -0
  337. package/dist/gateway-rpc-C0Vk51W7.js +26 -0
  338. package/dist/gateway-runtime-CBm3CCoA.js +69 -0
  339. package/dist/git-commit-BTWXFY41.js +177 -0
  340. package/dist/git-commit-D6GTN5Yt.js +2 -0
  341. package/dist/googlechat-BvwsCVKl.d.ts +12 -0
  342. package/dist/googlechat-DzoFLiDG.js +307 -0
  343. package/dist/group-access-DpiQnd-G.d.ts +61 -0
  344. package/dist/health-CqUU_ecm.js +570 -0
  345. package/dist/health-Dzn8BT5I.js +113 -0
  346. package/dist/heartbeat-summary-Dct2lqJj.js +57 -0
  347. package/dist/help-CtwSApfq.js +81 -0
  348. package/dist/hooks-9gokOxZ5.d.ts +6 -0
  349. package/dist/hooks-cli-DtBvd1lb.js +1000 -0
  350. package/dist/hooks-status-Bm_pGORf.js +78 -0
  351. package/dist/http-registry-D-S6a1Na.d.ts +20 -0
  352. package/dist/identity-file-Diub2a0t.js +60 -0
  353. package/dist/image-generation-CbIVzmAR.d.ts +9 -0
  354. package/dist/imessage-C7Z59nbV.js +31 -0
  355. package/dist/imessage-scXvYYHX.js +115 -0
  356. package/dist/inbound-reply-dispatch-gzPJFtkc.js +71 -0
  357. package/dist/inbound-reply-dispatch-n7U3qg15.d.ts +72 -0
  358. package/dist/index.js +2 -2
  359. package/dist/install-target-B4n74f_B.js +574 -0
  360. package/dist/installs-e1WEcS2x.js +532 -0
  361. package/dist/io-BaBxjB1v.js +9739 -0
  362. package/dist/io-CgHb1Jld.js +29 -0
  363. package/dist/irc-DxJ7uOKl.js +672 -0
  364. package/dist/library-DjjiKiBC.js +112 -0
  365. package/dist/lifecycle-core-Dn8PK6nk.js +382 -0
  366. package/dist/line/accounts.d.ts +2 -2
  367. package/dist/line/send.d.ts +1 -1
  368. package/dist/line/send.js +7 -7
  369. package/dist/line/template-messages.d.ts +1 -1
  370. package/dist/line-B5QFpgN_.d.ts +75 -0
  371. package/dist/line-BBiBiGgL.js +530 -0
  372. package/dist/llm-slug-generator-BQ09Fz6D.js +67 -0
  373. package/dist/llm-slug-generator.d.ts +1 -1
  374. package/dist/llm-slug-generator.js +36 -36
  375. package/dist/logging-CdisccbY.js +13 -0
  376. package/dist/logging-LKQSgX1d.js +30 -0
  377. package/dist/login-qr-B2ElPfmb.js +112 -0
  378. package/dist/login-qr-Di3uPIK1.js +233 -0
  379. package/dist/logs-cli-CNzOvZ2d.js +256 -0
  380. package/dist/manager-runtime-2RwW64dE.js +111 -0
  381. package/dist/manager.runtime-BacHmSFL.js +715 -0
  382. package/dist/manifest-registry-CS_p1OBQ.js +1329 -0
  383. package/dist/matrix-43_RGLZN.d.ts +68 -0
  384. package/dist/matrix-6-xpfQHf.js +1269 -0
  385. package/dist/matrix-DKYdZvGK.js +1495 -0
  386. package/dist/mcp-cli-Ci2jvv3s.js +87 -0
  387. package/dist/media-understanding.runtime-0668UZMb.js +116 -0
  388. package/dist/memory-cli-BGfRJOPh.js +111 -0
  389. package/dist/memory-search-BHhETk6u.js +17 -0
  390. package/dist/memory-search-tTD5o_rU.js +204 -0
  391. package/dist/method-scopes-B2ZKSsxQ.js +2452 -0
  392. package/dist/model-auth-markers-LqZ4qhrZ.d.ts +20 -0
  393. package/dist/model-picker-D9Gmg9vM.js +390 -0
  394. package/dist/model-picker-VOam6Dfa.js +112 -0
  395. package/dist/model-picker.runtime-B8h4yaGk.js +125 -0
  396. package/dist/model-selection-bBBxfXdb.js +653 -0
  397. package/dist/model-suppression.runtime-IpdzuuaW.js +116 -0
  398. package/dist/models-CEr8OkSA.js +118 -0
  399. package/dist/models-FgjlnyvT.js +2514 -0
  400. package/dist/models-cli-CdXULEZe.js +309 -0
  401. package/dist/models-config-UQxq76ac.js +111 -0
  402. package/dist/models-config.providers.discovery-puxTsH39.d.ts +18 -0
  403. package/dist/moldclaw-root-Cb6HRlUO.js +92 -0
  404. package/dist/monitor-BGAB5pZp.js +772 -0
  405. package/dist/monitor-C_1qA4q5.js +6823 -0
  406. package/dist/monitor-D8WcCUuA.js +782 -0
  407. package/dist/monitor-DesGoihT.js +113 -0
  408. package/dist/monitor-DhrUY3U6.js +3468 -0
  409. package/dist/monitor-DsDCIG87.js +3076 -0
  410. package/dist/monitor-dBB-luY7.js +115 -0
  411. package/dist/monitor-shared-CkicpwVc.js +444 -0
  412. package/dist/msteams-qmY7xMCK.js +852 -0
  413. package/dist/node-cli-B_2nTm80.js +2503 -0
  414. package/dist/node-resolve-BYC2FbO2.js +835 -0
  415. package/dist/nodes-cli-CBX71Wd_.js +1380 -0
  416. package/dist/nostr-BFKRoOlz.d.ts +7 -0
  417. package/dist/nostr-OB78XVlq.js +8744 -0
  418. package/dist/npm-resolution-DZJB3Hgh.js +60 -0
  419. package/dist/oauth-env-CLG8KOrz.js +10 -0
  420. package/dist/onboard-BON0C360.js +48 -0
  421. package/dist/onboard-DsKI17iq.js +25 -0
  422. package/dist/onboard-DyBwXVGT.js +589 -0
  423. package/dist/onboard-channels-BaVA02kK.js +1241 -0
  424. package/dist/onboard-channels-JJVMXpKl.js +205 -0
  425. package/dist/onboard-custom-D6YDrk9n.js +571 -0
  426. package/dist/onboard-custom-DqsNalL1.js +114 -0
  427. package/dist/onboard-helpers-DiSRTpZC.js +335 -0
  428. package/dist/onboard-helpers-DqZsjdb8.js +113 -0
  429. package/dist/onboard-hooks-pzEPZAvl.js +72 -0
  430. package/dist/onboard-remote-DFMLELsg.js +181 -0
  431. package/dist/onboard-remote-DmMYxY80.js +117 -0
  432. package/dist/onboard-search-B7FsNd7m.js +302 -0
  433. package/dist/onboard-skills-BJRdI-K3.js +133 -0
  434. package/dist/onboard-skills-Cg1YQAZa.js +117 -0
  435. package/dist/outbound-media-BHD4aJEX.d.ts +11 -0
  436. package/dist/outbound-media-CrraEXXv.js +11 -0
  437. package/dist/pairing-access-CzHpaM0R.d.ts +21 -0
  438. package/dist/pairing-cli-DSQTYgc0.js +217 -0
  439. package/dist/perplexity-CXwMDD3u.js +24 -0
  440. package/dist/persistent-dedupe-B9vrAf8t.d.ts +26 -0
  441. package/dist/pi-model-discovery-runtime-vSSbBDFG.js +111 -0
  442. package/dist/pi-tools.before-tool-call.runtime-C5yLUogH.js +381 -0
  443. package/dist/plugin-install-B1RfdrdV.js +117 -0
  444. package/dist/plugin-install-C9aaL42Y.js +184 -0
  445. package/dist/plugin-install-plan-BlfDt117.js +49 -0
  446. package/dist/plugin-registry-D2P9SYJ9.js +113 -0
  447. package/dist/plugin-registry-QtjVXmj3.js +49 -0
  448. package/dist/plugin-sdk/account-resolution.js +35 -35
  449. package/dist/plugin-sdk/acp-runtime.js +35 -35
  450. package/dist/plugin-sdk/agent-runtime.js +35 -35
  451. package/dist/plugin-sdk/bluebubbles.js +37 -37
  452. package/dist/plugin-sdk/channel-config-helpers.js +35 -35
  453. package/dist/plugin-sdk/channel-policy.js +35 -35
  454. package/dist/plugin-sdk/channel-runtime.js +35 -35
  455. package/dist/plugin-sdk/compat.js +36 -36
  456. package/dist/plugin-sdk/config-runtime.js +35 -35
  457. package/dist/plugin-sdk/conversation-runtime.js +35 -35
  458. package/dist/plugin-sdk/copilot-proxy.js +4 -4
  459. package/dist/plugin-sdk/core.js +4 -4
  460. package/dist/plugin-sdk/device-pair.js +4 -4
  461. package/dist/plugin-sdk/discord.js +35 -35
  462. package/dist/plugin-sdk/feishu.js +35 -35
  463. package/dist/plugin-sdk/gateway-runtime.js +10 -10
  464. package/dist/plugin-sdk/googlechat.js +37 -37
  465. package/dist/plugin-sdk/image-generation-runtime.js +35 -35
  466. package/dist/plugin-sdk/image-generation.js +35 -35
  467. package/dist/plugin-sdk/imessage.js +36 -36
  468. package/dist/plugin-sdk/index.js +35 -35
  469. package/dist/plugin-sdk/infra-runtime.js +35 -35
  470. package/dist/plugin-sdk/irc.js +37 -37
  471. package/dist/plugin-sdk/line.js +36 -36
  472. package/dist/plugin-sdk/llm-task.js +35 -35
  473. package/dist/plugin-sdk/lobster.js +4 -4
  474. package/dist/plugin-sdk/matrix.js +37 -37
  475. package/dist/plugin-sdk/mattermost.js +36 -36
  476. package/dist/plugin-sdk/media-runtime.js +35 -35
  477. package/dist/plugin-sdk/media-understanding-runtime.js +35 -35
  478. package/dist/plugin-sdk/media-understanding.js +35 -35
  479. package/dist/plugin-sdk/memory-lancedb.js +4 -4
  480. package/dist/plugin-sdk/minimax-portal-auth.js +4 -4
  481. package/dist/plugin-sdk/msteams.js +38 -38
  482. package/dist/plugin-sdk/nextcloud-talk.js +36 -36
  483. package/dist/plugin-sdk/nostr.js +36 -36
  484. package/dist/plugin-sdk/ollama-setup.js +9 -9
  485. package/dist/plugin-sdk/open-prose.js +4 -4
  486. package/dist/plugin-sdk/phone-control.js +4 -4
  487. package/dist/plugin-sdk/plugin-runtime.js +35 -35
  488. package/dist/plugin-sdk/provider-auth.js +35 -35
  489. package/dist/plugin-sdk/provider-models.js +5 -5
  490. package/dist/plugin-sdk/provider-onboard.js +4 -4
  491. package/dist/plugin-sdk/provider-setup.js +39 -39
  492. package/dist/plugin-sdk/provider-stream.js +4 -4
  493. package/dist/plugin-sdk/provider-usage.js +4 -4
  494. package/dist/plugin-sdk/qwen-portal-auth.js +35 -35
  495. package/dist/plugin-sdk/reply-history.js +35 -35
  496. package/dist/plugin-sdk/reply-runtime.js +35 -35
  497. package/dist/plugin-sdk/routing.js +3 -3
  498. package/dist/plugin-sdk/sandbox.js +35 -35
  499. package/dist/plugin-sdk/security-runtime.js +35 -35
  500. package/dist/plugin-sdk/self-hosted-provider-setup.js +37 -37
  501. package/dist/plugin-sdk/setup.js +35 -35
  502. package/dist/plugin-sdk/signal.js +35 -35
  503. package/dist/plugin-sdk/slack.js +35 -35
  504. package/dist/plugin-sdk/speech-runtime.js +35 -35
  505. package/dist/plugin-sdk/speech.js +35 -35
  506. package/dist/plugin-sdk/src/secrets/secure-file-store.d.ts +26 -0
  507. package/dist/plugin-sdk/src/subscription/provider.d.ts +5 -3
  508. package/dist/plugin-sdk/synology-chat.js +36 -36
  509. package/dist/plugin-sdk/talk-voice.js +4 -4
  510. package/dist/plugin-sdk/telegram.js +35 -35
  511. package/dist/plugin-sdk/text-runtime.js +7 -7
  512. package/dist/plugin-sdk/thread-ownership.js +4 -4
  513. package/dist/plugin-sdk/tlon.js +36 -36
  514. package/dist/plugin-sdk/twitch.js +35 -35
  515. package/dist/plugin-sdk/voice-call.js +35 -35
  516. package/dist/plugin-sdk/whatsapp.js +35 -35
  517. package/dist/plugin-sdk/zalo.js +38 -38
  518. package/dist/plugin-sdk/zalouser.js +38 -38
  519. package/dist/plugins/runtime/index.d.ts +1 -1
  520. package/dist/plugins/runtime/index.js +35 -35
  521. package/dist/plugins-CAULK-lt.js +111 -0
  522. package/dist/plugins-cli-BGAgYy3Z.js +917 -0
  523. package/dist/policy-WKZJ8cPK.js +143 -0
  524. package/dist/preflight-audio.runtime-Bc6Hv-u4.js +116 -0
  525. package/dist/probe-B7a_VBCB.js +47 -0
  526. package/dist/probe-BLioBOhT.js +6329 -0
  527. package/dist/probe-BkM5pykD.js +21 -0
  528. package/dist/probe-DOEaWez2.js +1793 -0
  529. package/dist/probe-DpcJ0WeP.js +129 -0
  530. package/dist/probe-auth-BcNjX8hy.js +40 -0
  531. package/dist/probe-auth-DhuAb8ls.js +48 -0
  532. package/dist/program-zG0CuBsn.js +253 -0
  533. package/dist/prompt-select-styled-B-D6NQFO.js +2673 -0
  534. package/dist/provider-api-key-auth.runtime-DgGM_pHf.js +121 -0
  535. package/dist/provider-auth-choice-BOQA0idb.js +126 -0
  536. package/dist/provider-auth-choice-helpers-hzDkh3f1.js +48 -0
  537. package/dist/provider-auth-choice-preference-BPcuoO9b.js +189 -0
  538. package/dist/provider-auth-choice.runtime-B4E0A4J8.js +123 -0
  539. package/dist/provider-auth-choices-0KaDNPBQ.js +57 -0
  540. package/dist/provider-auth-guidance-BxxMxMEt.js +34 -0
  541. package/dist/provider-auth-result-Bto1bYtS.d.ts +18 -0
  542. package/dist/provider-models-DxOmeToO.d.ts +867 -0
  543. package/dist/provider-models-xnyxy6mO.js +2113 -0
  544. package/dist/provider-ollama-setup-DBYK__ov.d.ts +32 -0
  545. package/dist/provider-ollama-setup-QzgCxj44.js +314 -0
  546. package/dist/provider-onboard-B9ionepI.js +139 -0
  547. package/dist/provider-onboard-CURxJ_UX.d.ts +40 -0
  548. package/dist/provider-runtime.runtime-DFAIaPZT.js +111 -0
  549. package/dist/provider-self-hosted-setup-CclMg3QB.js +182 -0
  550. package/dist/provider-self-hosted-setup-qeY8BYSy.d.ts +61 -0
  551. package/dist/provider-stream-Chz_EFw3.js +512 -0
  552. package/dist/provider-usage-Cn_OrdMP.js +111 -0
  553. package/dist/provider-usage-kxemdMp2.js +633 -0
  554. package/dist/provider-wizard-BMc1Dzks.js +152 -0
  555. package/dist/push-apns-CuIs_G0k.js +1038 -0
  556. package/dist/pw-ai-DUe4BbH2.js +1867 -0
  557. package/dist/qmd-manager-CAAFp7qK.js +1570 -0
  558. package/dist/qr-cli-9H9go9JE.js +113 -0
  559. package/dist/qr-cli-Bxxttvx3.js +369 -0
  560. package/dist/reactions-Dx2ypGlm.js +281 -0
  561. package/dist/read-only-account-inspect.discord.runtime-D_RVd1-r.js +116 -0
  562. package/dist/read-only-account-inspect.slack.runtime-Ckl92Rhy.js +116 -0
  563. package/dist/read-only-account-inspect.telegram.runtime-D97ssjQk.js +116 -0
  564. package/dist/redact-snapshot-ojhTflxp.js +2663 -0
  565. package/dist/register.agent-DlBmy_RL.js +439 -0
  566. package/dist/register.backup-8nOYtJqg.js +625 -0
  567. package/dist/register.configure-BV_GUQ5w.js +252 -0
  568. package/dist/register.maintenance-BafAHBum.js +574 -0
  569. package/dist/register.message-CHhfcEq2.js +709 -0
  570. package/dist/register.onboard-DjPNnlnr.js +192 -0
  571. package/dist/register.setup-BMGXI9PG.js +212 -0
  572. package/dist/register.status-health-sessions-BJMsh2AL.js +498 -0
  573. package/dist/register.subclis-B7nrik3-.js +315 -0
  574. package/dist/register.subclis-BCoAVyGn.js +13 -0
  575. package/dist/replies-BU4AvOyD.js +110 -0
  576. package/dist/resolve-channels-CDfj5NGq.js +226 -0
  577. package/dist/resolve-channels-Cz120Lvf.js +262 -0
  578. package/dist/resolve-route-DdX-HBVt.js +538 -0
  579. package/dist/resolve-users-Bc6nRqpb.js +143 -0
  580. package/dist/root-help-QAkoA7GD.js +32 -0
  581. package/dist/routes-CcJNnwTF.js +7097 -0
  582. package/dist/rpc-DDUAlBbH.js +67 -0
  583. package/dist/run-main-Cf8vXm6i.js +424 -0
  584. package/dist/runtime-Bitmi8Er.d.ts +26 -0
  585. package/dist/runtime-discord-ops.runtime-DWBnG-Hf.js +9078 -0
  586. package/dist/runtime-slack-ops.runtime-oYfbYvX4.js +4556 -0
  587. package/dist/runtime-telegram-ops.runtime-EPGDYN1f.js +133 -0
  588. package/dist/runtime-whatsapp-login.runtime-BGJoKM2h.js +114 -0
  589. package/dist/runtime-whatsapp-outbound.runtime-D3Sag6Bv.js +117 -0
  590. package/dist/sandbox-cli-waaYyhsC.js +535 -0
  591. package/dist/search-manager-BjDsOXzB.js +16 -0
  592. package/dist/search-manager-D-G9UaXe.js +386 -0
  593. package/dist/secrets-cli-BmeEhlzt.js +2070 -0
  594. package/dist/security-cli-CSsLnFuN.js +575 -0
  595. package/dist/send-6o7piqfv.js +100 -0
  596. package/dist/send-99FyFLgk.js +629 -0
  597. package/dist/send-B1pX9_Oc.js +283 -0
  598. package/dist/send-Dg5-AjXW.js +1025 -0
  599. package/dist/send-LdV9TRoN.js +631 -0
  600. package/dist/server-node-events-BAUUKNFW.js +506 -0
  601. package/dist/server-zI_K-D05.js +107 -0
  602. package/dist/sessions-DJGywtY2.js +112 -0
  603. package/dist/sessions-WR0GKdGl.js +218 -0
  604. package/dist/setup-2LvBON2J.js +387 -0
  605. package/dist/setup-CFIMq-Pz.d.ts +37 -0
  606. package/dist/setup-binary-CcAv8NXz.js +406 -0
  607. package/dist/setup-browser-C4eRV3h6.js +70 -0
  608. package/dist/setup-core-ByqF8Nvc.js +166 -0
  609. package/dist/setup-core-COkq8Zop.js +205 -0
  610. package/dist/setup-core-C_o77DVV.js +143 -0
  611. package/dist/setup-core-tAdHbqi9.js +47 -0
  612. package/dist/setup-surface-DMHtZByF.js +490 -0
  613. package/dist/setup-wizard-helpers-r0J6l8ST.d.ts +203 -0
  614. package/dist/setup.finalize-pTkXn8pV.js +522 -0
  615. package/dist/setup.gateway-config-D1wiUQe6.js +343 -0
  616. package/dist/shared-BaM_tMxk.js +102 -0
  617. package/dist/shared-BgUgXsM9.js +75 -0
  618. package/dist/shared-CezRuVfl.js +96 -0
  619. package/dist/shared-DQgf3R0B.js +298 -0
  620. package/dist/shared-RA6kxQfu.js +182 -0
  621. package/dist/signal-xxP4dGx7.js +114 -0
  622. package/dist/skills-Bio8GwTE.js +20 -0
  623. package/dist/skills-DE_MXFSN.js +853 -0
  624. package/dist/skills-cli-BGuW-tKw.js +292 -0
  625. package/dist/skills-install-BIlG41ei.js +763 -0
  626. package/dist/skills-status-B08PtBc_.js +21 -0
  627. package/dist/skills-status-CzM008aB.js +169 -0
  628. package/dist/slack-Bzt3M7d8.js +114 -0
  629. package/dist/slash-commands.runtime-EYqj8SbV.js +128 -0
  630. package/dist/slash-dispatch.runtime-vWH92PUY.js +141 -0
  631. package/dist/slash-skill-commands.runtime-sUTjM3J0.js +116 -0
  632. package/dist/src-Iso9-DPo.js +1701 -0
  633. package/dist/status-8S882KRO.js +43 -0
  634. package/dist/status-BF7h_jTB.js +126 -0
  635. package/dist/status-DxOIyRm9.js +131 -0
  636. package/dist/status-HlvixAOq.js +606 -0
  637. package/dist/status-json-CShBo8A6.js +288 -0
  638. package/dist/status-qhtgsJFd.js +1599 -0
  639. package/dist/status.link-channel-D3dLYZiH.js +143 -0
  640. package/dist/status.scan.deps.runtime-mCmOLzpG.js +126 -0
  641. package/dist/status.scan.runtime-CYuUlDeg.js +119 -0
  642. package/dist/status.summary-BjB1aTjV.js +592 -0
  643. package/dist/status.summary.runtime-DW4MOt1Z.js +118 -0
  644. package/dist/status.update-BxblMS7P.js +77 -0
  645. package/dist/subagent-orphan-recovery-CCVopsdP.js +307 -0
  646. package/dist/subagent-registry-runtime-oG47Fzvg.js +111 -0
  647. package/dist/subscription-CpFdxuFS.js +33 -0
  648. package/dist/subscription-DaA1urx-.js +102 -0
  649. package/dist/subscription-cli-Bvto9EmO.js +134 -0
  650. package/dist/synology-chat-CVy1tJGY.js +297 -0
  651. package/dist/system-cli-BvNps8sl.js +94 -0
  652. package/dist/telegram/audit.d.ts +1 -1
  653. package/dist/telegram/audit.js +1 -1
  654. package/dist/telegram/token.d.ts +1 -1
  655. package/dist/telegram/token.js +35 -35
  656. package/dist/telegram-Dug8pd82.js +114 -0
  657. package/dist/text-chunking-CQ6ttpWs.js +84 -0
  658. package/dist/text-chunking-DDUU_vAF.d.ts +79 -0
  659. package/dist/tlon-BnckVr_7.js +433 -0
  660. package/dist/tui-DXTge9Ac.js +3834 -0
  661. package/dist/tui-cli-BRUfLUTd.js +137 -0
  662. package/dist/types-2H_e7eWT.d.ts +45 -0
  663. package/dist/types-ZKnGUchG.d.ts +22692 -0
  664. package/dist/types.base-BFiQZ4J9.d.ts +188 -0
  665. package/dist/ui--iP08xRA.js +31 -0
  666. package/dist/update-CtxBD-Cf.js +1036 -0
  667. package/dist/update-cli-DPE3GCHJ.js +1503 -0
  668. package/dist/update-offset-store-BlBY7dWj.js +112 -0
  669. package/dist/update-runner-Cfcrhf2j.js +1496 -0
  670. package/dist/upsert-with-lock-BZU7Le8n.js +33 -0
  671. package/dist/usage-Czgwvg0h.js +115 -0
  672. package/dist/web-BGDXhunB.js +112 -0
  673. package/dist/web-shared-B5Q0mIJq.d.ts +45 -0
  674. package/dist/webhook-request-guards-CsKDhZJr.d.ts +76 -0
  675. package/dist/webhook-targets-CjxuEE9C.d.ts +106 -0
  676. package/dist/webhook-targets-Dtt6rH4N.js +181 -0
  677. package/dist/webhooks-cli-Wl9y6AWW.js +350 -0
  678. package/dist/whatsapp-D64cBQ_9.js +114 -0
  679. package/dist/whatsapp-actions-CVoTcagb.js +167 -0
  680. package/dist/workspace-DJ_S272u.js +484 -0
  681. package/dist/workspace-DbZSqjw0.js +289 -0
  682. package/dist/workspace-cli-D93DLmAh.js +154 -0
  683. package/dist/workspace-dirs-CGeIPpGN.js +2003 -0
  684. package/dist/zalo-CK2dlGmu.d.ts +9 -0
  685. package/dist/zalo-DxoY8M22.js +415 -0
  686. package/dist/zalouser-DTHIrPvs.js +30911 -0
  687. package/extensions/discord/src/monitor/allow-list.ts +8 -1
  688. package/extensions/discord/src/monitor/message-handler.preflight.ts +4 -1
  689. package/package.json +1 -1
  690. package/dist/accounts-CS8U4v8C.js +0 -114
  691. package/dist/accounts-gLr-Udmt.d.ts +0 -103
  692. package/dist/acp-cli-BGT0jXcC.js +0 -2093
  693. package/dist/actions.runtime-BfckTw6c.js +0 -119
  694. package/dist/actions.runtime-Cl9mBfqH.js +0 -133
  695. package/dist/agent-scope-C-YmLnnb.js +0 -208
  696. package/dist/agents-CydD54p8.js +0 -222
  697. package/dist/agents-DpQsZO6O.js +0 -853
  698. package/dist/agents.config-XU7IsYE-.js +0 -121
  699. package/dist/agents.config-ssoQXuvF.js +0 -17
  700. package/dist/allow-list-Cfn6lmMK.js +0 -81
  701. package/dist/allowlist-CCYXVpM9.js +0 -142
  702. package/dist/api-BoXoFKxy.js +0 -117
  703. package/dist/audit-Bv05N5o9.js +0 -787
  704. package/dist/audit-CIWW1Aqm.js +0 -54
  705. package/dist/audit-channel.collect.runtime-Bi7yrdcO.js +0 -605
  706. package/dist/audit-channel.runtime-C_NDweiW.js +0 -121
  707. package/dist/audit-extra.async-Dp7OKSXg.js +0 -813
  708. package/dist/audit-membership-runtime-B8FQ6VtN.js +0 -162
  709. package/dist/audit.deep.runtime-CXhobL6b.js +0 -25
  710. package/dist/audit.nondeep.runtime-CrEm3T16.js +0 -832
  711. package/dist/audit.runtime-CJPKj1Zg.js +0 -118
  712. package/dist/auth-Byfp0flq.js +0 -101
  713. package/dist/auth-choice-BgOjdeXN.js +0 -507
  714. package/dist/auth-choice-CD1Heq0M.js +0 -122
  715. package/dist/auth-choice-ePNfg0iQ.js +0 -268
  716. package/dist/auth-choice-options-BlewQWI0.js +0 -123
  717. package/dist/auth-choice-prompt-BP2b6aXz.js +0 -36
  718. package/dist/auth-choice-prompt-Cmwl4n97.js +0 -115
  719. package/dist/auth-choice.apply-helpers-Dq-nxuuX.js +0 -66
  720. package/dist/auth-choice.plugin-providers.runtime-B23kOUzQ.js +0 -119
  721. package/dist/auth-profiles-1kPLbBwI.js +0 -127823
  722. package/dist/auth-profiles.runtime-DAfSjku1.js +0 -116
  723. package/dist/banner-DeOsobLO.js +0 -342
  724. package/dist/bluebubbles-BsLGedBM.js +0 -64
  725. package/dist/bluebubbles-U2sAfO4_.d.ts +0 -6
  726. package/dist/bot-DW12K3bO.d.ts +0 -478
  727. package/dist/brave-BoWimrLe.js +0 -24
  728. package/dist/browser-cli-D_S3wEYE.js +0 -1494
  729. package/dist/call-ByEzDJ1_.js +0 -640
  730. package/dist/call-CHCWVg-O.js +0 -39
  731. package/dist/channel-3VC0oOMu.js +0 -214
  732. package/dist/channel-B9fCBPiS.js +0 -207
  733. package/dist/channel-B9q775cM.js +0 -562
  734. package/dist/channel-BG3UK54j.js +0 -803
  735. package/dist/channel-BRQAdMML.js +0 -352
  736. package/dist/channel-BmlLp933.js +0 -1321
  737. package/dist/channel-By6KvdTG.js +0 -920
  738. package/dist/channel-C8rRsdf6.js +0 -226
  739. package/dist/channel-CLEDBbXE.js +0 -943
  740. package/dist/channel-CMvBAG7o.js +0 -306
  741. package/dist/channel-CmlxxjHY.js +0 -1598
  742. package/dist/channel-CqG6_xN0.js +0 -949
  743. package/dist/channel-DNueHKs92.js +0 -316
  744. package/dist/channel-DUtyN7BX.js +0 -4681
  745. package/dist/channel-DWD6GrfZ.js +0 -538
  746. package/dist/channel-DaRYMYzj.js +0 -619
  747. package/dist/channel-Dj6BgLp8.js +0 -575
  748. package/dist/channel-account-context-Ba3u5D21.js +0 -103
  749. package/dist/channel-crabk6Em.js +0 -542
  750. package/dist/channel-i8uqQaK2.js +0 -497
  751. package/dist/channel-options-xljvwHS2.js +0 -50
  752. package/dist/channel-plugin-ids-DAgknSG4.js +0 -26
  753. package/dist/channel-summary-dHTMCG75.js +0 -111
  754. package/dist/channel-xVWQ96Ni.js +0 -397
  755. package/dist/channel.runtime-B6PoZ4BV.js +0 -182
  756. package/dist/channel.runtime-BPZmo57e.js +0 -404
  757. package/dist/channel.runtime-B_1uGR-U.js +0 -199
  758. package/dist/channel.runtime-BiXnPU0d.js +0 -218
  759. package/dist/channel.runtime-BpvDc9sv.js +0 -870
  760. package/dist/channel.runtime-CUua3W80.js +0 -418
  761. package/dist/channel.runtime-CaCBTd0A.js +0 -179
  762. package/dist/channel.runtime-D0FfYvUj.js +0 -4011
  763. package/dist/channel.runtime-DhoJtpvJ.js +0 -241
  764. package/dist/channel.runtime-Kj9EXNE0.js +0 -127
  765. package/dist/channel.runtime-r4tPuPyh.js +0 -171
  766. package/dist/channel.setup-B7d_grfe.js +0 -6
  767. package/dist/channel.setup-C0vu1fhi.js +0 -9
  768. package/dist/channel.setup-CAI0FNHj.js +0 -11
  769. package/dist/channel.setup-CkDVwv5R.js +0 -57
  770. package/dist/channel.setup-Cpd00YqQ.js +0 -8
  771. package/dist/channel.setup-DbBz1-WT.js +0 -9
  772. package/dist/channel.setup-GZnAvD9g.js +0 -8
  773. package/dist/channels-5H484RSw.js +0 -1118
  774. package/dist/channels-BnPudfyx.js +0 -404
  775. package/dist/channels-cli-WIC-QeH_.js +0 -291
  776. package/dist/channels-status-issues-RDmzovJU.js +0 -16
  777. package/dist/clawbot-cli-BgutNwf8.js +0 -118
  778. package/dist/cleanup-utils-DBl1Aij1.js +0 -96
  779. package/dist/cli-1P7u6zqu.js +0 -154
  780. package/dist/command-registry-B8jovrws.js +0 -232
  781. package/dist/command-registry-DtDl1FVm.js +0 -14
  782. package/dist/command-secret-gateway-BgUo3FxJ.js +0 -111
  783. package/dist/compact.runtime-CXbXM0AU.js +0 -116
  784. package/dist/completion-cli-Cik_owAE.js +0 -17
  785. package/dist/completion-cli-RU3P2RSl.js +0 -445
  786. package/dist/config-5HUpB1L1.js +0 -31
  787. package/dist/config-cli-QHaUHoZI.js +0 -433
  788. package/dist/config-guard-C9Sn3pE-.js +0 -118
  789. package/dist/config-sW57gztj.js +0 -44
  790. package/dist/config-validation-5LkjIKNt.js +0 -262
  791. package/dist/config-value-CtTWALxG.js +0 -132
  792. package/dist/configure-BmR2TPLf.js +0 -243
  793. package/dist/configure-DaLN-5xM.js +0 -1100
  794. package/dist/control-ui-assets-CH3MYmAo.js +0 -232
  795. package/dist/control-ui-shared-CA77PTml.js +0 -29
  796. package/dist/core-CvDzLs7B.js +0 -150
  797. package/dist/core-dPA4nFkn.d.ts +0 -87
  798. package/dist/cron-cli-tguLpzyq.js +0 -639
  799. package/dist/daemon-cli-ptosOkL8.js +0 -339
  800. package/dist/daemon-install-DzU4EnVa.js +0 -180
  801. package/dist/deliver-DwxFoHM3.js +0 -111
  802. package/dist/deliver-runtime-DOdDyaPI.js +0 -111
  803. package/dist/device-id-cli-GopvlxxZ.js +0 -52
  804. package/dist/device-identity-CRfhC3_s.js +0 -365
  805. package/dist/devices-cli-ain7ESqU.js +0 -342
  806. package/dist/diagnostic-D96Xaqrj.js +0 -310
  807. package/dist/directory-cli-fh1UxGgY.js +0 -311
  808. package/dist/directory-config-helpers-CpU1oflo.d.ts +0 -38
  809. package/dist/directory.static-CKjJUNGl.js +0 -44
  810. package/dist/discord-CflhwDEM.js +0 -114
  811. package/dist/discovery-x0ZqY4AB.js +0 -48
  812. package/dist/dm-policy-shared-73A52W6E.d.ts +0 -95
  813. package/dist/dns-cli-DCHyKjGf.js +0 -217
  814. package/dist/docs-cli-D3OoqYSP.js +0 -174
  815. package/dist/doctor-completion-Bq2eP87s.js +0 -90
  816. package/dist/doctor-config-flow-D8XRG9Ku.js +0 -2437
  817. package/dist/doctor-config-flow-DGiF1HGc.js +0 -112
  818. package/dist/enable-0QSF4YGH.js +0 -24
  819. package/dist/exec-approvals-cli-Bncym0Gd.js +0 -421
  820. package/dist/feishu-B5JDcyF9.d.ts +0 -36
  821. package/dist/gateway-cli-DYscsmA-.js +0 -26437
  822. package/dist/gateway-install-token-CNv17ac9.js +0 -163
  823. package/dist/gateway-rpc-BGC1Rxvg.js +0 -26
  824. package/dist/gateway-runtime-D89mSQPB.js +0 -69
  825. package/dist/git-commit-CeLH5Ozm.js +0 -2
  826. package/dist/git-commit-DUKRiCP-.js +0 -177
  827. package/dist/googlechat-BgXeXjd1.js +0 -307
  828. package/dist/googlechat-De-T7C31.d.ts +0 -12
  829. package/dist/group-access-Deh1tVNr.d.ts +0 -61
  830. package/dist/health-BEjzWwaB.js +0 -570
  831. package/dist/health-FjqrWQL6.js +0 -113
  832. package/dist/heartbeat-summary-CfdSA9M1.js +0 -57
  833. package/dist/help-BZeVprq1.js +0 -81
  834. package/dist/hooks-B5pYs_d7.d.ts +0 -6
  835. package/dist/hooks-cli-B7uGJs2O.js +0 -1000
  836. package/dist/hooks-status-CfceaUSg.js +0 -78
  837. package/dist/http-registry-C-KXqwnj.d.ts +0 -20
  838. package/dist/identity-file-sshkKKIr.js +0 -60
  839. package/dist/image-generation-CafM5hZh.d.ts +0 -9
  840. package/dist/imessage-BcV3WGx_.js +0 -31
  841. package/dist/imessage-Dhje7Ty-.js +0 -115
  842. package/dist/inbound-reply-dispatch-C73_7SOl.js +0 -71
  843. package/dist/inbound-reply-dispatch-DmL0KWLe.d.ts +0 -72
  844. package/dist/install-target-D7NRhfzc.js +0 -574
  845. package/dist/installs-Bj6jblqc.js +0 -532
  846. package/dist/io-CMfWWPXQ.js +0 -9738
  847. package/dist/io-CV844hAM.js +0 -29
  848. package/dist/irc-DKi1fDYI.js +0 -672
  849. package/dist/library-rygTG3oA.js +0 -112
  850. package/dist/lifecycle-core-BPlvShWY.js +0 -382
  851. package/dist/line-CGsemKWJ.js +0 -530
  852. package/dist/line-CKU3ER-n.d.ts +0 -75
  853. package/dist/llm-slug-generator-DlhVyMqT.js +0 -67
  854. package/dist/logging-5wu9k6w4.js +0 -30
  855. package/dist/logging-CxP9suT8.js +0 -13
  856. package/dist/login-qr-BcDsiwHs.js +0 -233
  857. package/dist/login-qr-Y8pJ5yV4.js +0 -112
  858. package/dist/logs-cli-XI9oVXpH.js +0 -256
  859. package/dist/manager-runtime-DkIlXBhD.js +0 -111
  860. package/dist/manager.runtime-Q0q2rJCC.js +0 -715
  861. package/dist/manifest-registry-DAd0SRAP.js +0 -1329
  862. package/dist/matrix-BI0DBBrG.js +0 -1495
  863. package/dist/matrix-DiABGjJR.js +0 -1269
  864. package/dist/matrix-fC6NrFM5.d.ts +0 -68
  865. package/dist/mcp-cli-BOyn_DLL.js +0 -87
  866. package/dist/media-understanding.runtime-DjUa7Dka.js +0 -116
  867. package/dist/memory-cli-CJd_vl-Y.js +0 -111
  868. package/dist/memory-search-CEEItIFR.js +0 -17
  869. package/dist/memory-search-Cv1SBrn7.js +0 -204
  870. package/dist/method-scopes-CQE7-bZ-.js +0 -2452
  871. package/dist/model-auth-markers-B1bbs9Qd.d.ts +0 -20
  872. package/dist/model-picker-D6_89XHg.js +0 -112
  873. package/dist/model-picker-Svaw-APs.js +0 -390
  874. package/dist/model-picker.runtime-Chi9nV7A.js +0 -125
  875. package/dist/model-selection-hL8i1Jbs.js +0 -653
  876. package/dist/model-suppression.runtime-DjWJZ0X-.js +0 -116
  877. package/dist/models-7qj1dG_W.js +0 -118
  878. package/dist/models-BPOB_xJF.js +0 -2514
  879. package/dist/models-cli-DdlOVUjS.js +0 -309
  880. package/dist/models-config-CBqUS-jX.js +0 -111
  881. package/dist/models-config.providers.discovery-BKB5JH9M.d.ts +0 -18
  882. package/dist/moldclaw-root-D6PbhbZk.js +0 -88
  883. package/dist/monitor-BPYhkEqF.js +0 -782
  884. package/dist/monitor-BuTcQ24j.js +0 -3468
  885. package/dist/monitor-CuXvNhFh.js +0 -113
  886. package/dist/monitor-D-TqSIHF.js +0 -6823
  887. package/dist/monitor-DRSgo9u2.js +0 -3076
  888. package/dist/monitor-DcHch39z.js +0 -772
  889. package/dist/monitor-DsHBMrXp.js +0 -115
  890. package/dist/monitor-shared-CL8T4gt1.js +0 -444
  891. package/dist/msteams-7FMwTvQG.js +0 -852
  892. package/dist/node-cli-BCjaSCZM.js +0 -2503
  893. package/dist/node-resolve-D5Hvcgyx.js +0 -835
  894. package/dist/nodes-cli-Dd_SNbkt.js +0 -1380
  895. package/dist/nostr-D8scBiYq.d.ts +0 -7
  896. package/dist/nostr-DBTFTxKs.js +0 -8744
  897. package/dist/npm-resolution-CYfb3MHG.js +0 -60
  898. package/dist/oauth-env-zPt5RywA.js +0 -10
  899. package/dist/onboard-BEFQQeig.js +0 -25
  900. package/dist/onboard-CJHNyxJh.js +0 -48
  901. package/dist/onboard-D_3UeLEN.js +0 -589
  902. package/dist/onboard-channels-B_JL0Djc.js +0 -1241
  903. package/dist/onboard-channels-CqZzHt2C.js +0 -205
  904. package/dist/onboard-custom-CER3Ggbq.js +0 -571
  905. package/dist/onboard-custom-bNRdGECb.js +0 -114
  906. package/dist/onboard-helpers-BK0Hsb7Y.js +0 -335
  907. package/dist/onboard-helpers-CXZ5RPoR.js +0 -113
  908. package/dist/onboard-hooks-1NsxEDjH.js +0 -72
  909. package/dist/onboard-remote-DuKhC_7W.js +0 -117
  910. package/dist/onboard-remote-OwRcDuB3.js +0 -181
  911. package/dist/onboard-search-Cy8dOq2W.js +0 -302
  912. package/dist/onboard-skills-D5phRa6r.js +0 -117
  913. package/dist/onboard-skills-c9qWCNe9.js +0 -133
  914. package/dist/outbound-media-CgNYEQWb.d.ts +0 -11
  915. package/dist/outbound-media-DYRO2vTD.js +0 -11
  916. package/dist/pairing-access-Dsiu5Mvl.d.ts +0 -21
  917. package/dist/pairing-cli-BOnv0TYn.js +0 -217
  918. package/dist/perplexity-EZwC3y2b.js +0 -24
  919. package/dist/persistent-dedupe-DMLOqJ23.d.ts +0 -26
  920. package/dist/pi-model-discovery-runtime-BToY3A6K.js +0 -111
  921. package/dist/pi-tools.before-tool-call.runtime-D_acPtld.js +0 -381
  922. package/dist/plugin-install-CgJpSjYd.js +0 -184
  923. package/dist/plugin-install-Cl1A4EF6.js +0 -117
  924. package/dist/plugin-install-plan-Dc2Z4DeU.js +0 -49
  925. package/dist/plugin-registry-B1UaWrQD.js +0 -49
  926. package/dist/plugin-registry-Cy8biwnn.js +0 -113
  927. package/dist/plugins-CXwvg50F.js +0 -111
  928. package/dist/plugins-cli-Uvzp2aYV.js +0 -917
  929. package/dist/policy-DsMBbEe7.js +0 -143
  930. package/dist/preflight-audio.runtime-hWsZIYvc.js +0 -116
  931. package/dist/probe-CNsSf1Uf.js +0 -6329
  932. package/dist/probe-CqOIrPhb.js +0 -47
  933. package/dist/probe-DH6gDw-h.js +0 -129
  934. package/dist/probe-DM16PLf4.js +0 -21
  935. package/dist/probe-DvAEEWYr.js +0 -1793
  936. package/dist/probe-auth-COfgCble.js +0 -48
  937. package/dist/probe-auth-I_5TX1Eh.js +0 -40
  938. package/dist/program-Dz80sgTU.js +0 -253
  939. package/dist/prompt-select-styled-wQehwFxK.js +0 -2673
  940. package/dist/provider-api-key-auth.runtime-BR9GU4ya.js +0 -121
  941. package/dist/provider-auth-choice-CdhA84kr.js +0 -126
  942. package/dist/provider-auth-choice-helpers-kabp_0zA.js +0 -48
  943. package/dist/provider-auth-choice-preference-se3zAM_2.js +0 -189
  944. package/dist/provider-auth-choice.runtime-BMc8-xNQ.js +0 -123
  945. package/dist/provider-auth-choices-CYsCViGi.js +0 -57
  946. package/dist/provider-auth-guidance-CMjUWlNf.js +0 -34
  947. package/dist/provider-auth-result-Cw6qIhO-.d.ts +0 -18
  948. package/dist/provider-models-BCId_Lfu.js +0 -2113
  949. package/dist/provider-models-Ok-DrSiY.d.ts +0 -867
  950. package/dist/provider-ollama-setup-B6XJZ0So.js +0 -314
  951. package/dist/provider-ollama-setup-lGDdTl0b.d.ts +0 -32
  952. package/dist/provider-onboard-CSPi7jOK.d.ts +0 -40
  953. package/dist/provider-onboard-Ca0TaNud.js +0 -139
  954. package/dist/provider-runtime.runtime-DwwkHw_7.js +0 -111
  955. package/dist/provider-self-hosted-setup-BEKLVGpj.js +0 -182
  956. package/dist/provider-self-hosted-setup-Df91By-J.d.ts +0 -61
  957. package/dist/provider-stream-DrUD69ai.js +0 -512
  958. package/dist/provider-usage-BgKHCnjr.js +0 -111
  959. package/dist/provider-usage-D8EZpFz9.js +0 -633
  960. package/dist/provider-wizard-DMdb-zj_.js +0 -152
  961. package/dist/push-apns-BPH6d4VV.js +0 -1038
  962. package/dist/pw-ai-DttfldtL.js +0 -1867
  963. package/dist/qmd-manager-CybcDUfk.js +0 -1570
  964. package/dist/qr-cli-8NcmJ8Ft.js +0 -369
  965. package/dist/qr-cli-DWe0Our3.js +0 -113
  966. package/dist/reactions-D6N0LR16.js +0 -281
  967. package/dist/read-only-account-inspect.discord.runtime-CqUWTRfl.js +0 -116
  968. package/dist/read-only-account-inspect.slack.runtime-9-jpln3q.js +0 -116
  969. package/dist/read-only-account-inspect.telegram.runtime-EKPI1D7n.js +0 -116
  970. package/dist/redact-snapshot-DwJEIVk9.js +0 -2663
  971. package/dist/register.agent-D3YdDirP.js +0 -439
  972. package/dist/register.backup-dR27qCuo.js +0 -625
  973. package/dist/register.configure-BjFhkkka.js +0 -252
  974. package/dist/register.maintenance-DiMQJIOa.js +0 -574
  975. package/dist/register.message-CdZsKYH1.js +0 -709
  976. package/dist/register.onboard-B0rV1eaO.js +0 -192
  977. package/dist/register.setup-wKMvohzo.js +0 -212
  978. package/dist/register.status-health-sessions-BJ68m6pt.js +0 -498
  979. package/dist/register.subclis-CnnrWt2a.js +0 -315
  980. package/dist/register.subclis-lSvTkC6z.js +0 -13
  981. package/dist/replies-BABt9b48.js +0 -110
  982. package/dist/resolve-channels-BqZFl2Ux.js +0 -262
  983. package/dist/resolve-channels-DjQLXb7B.js +0 -226
  984. package/dist/resolve-route-CSHDsa_m.js +0 -538
  985. package/dist/resolve-users-BG6HaSR5.js +0 -143
  986. package/dist/root-help-ohmaCyC_.js +0 -32
  987. package/dist/routes-4k2kpvoT.js +0 -7097
  988. package/dist/rpc-Cnwn4Q6L.js +0 -67
  989. package/dist/run-main-VYlacKA0.js +0 -424
  990. package/dist/runtime-D61jzMiI.d.ts +0 -26
  991. package/dist/runtime-discord-ops.runtime-DafrU-rI.js +0 -9078
  992. package/dist/runtime-slack-ops.runtime-CdXBKXwd.js +0 -4556
  993. package/dist/runtime-telegram-ops.runtime-B12sF7gE.js +0 -133
  994. package/dist/runtime-whatsapp-login.runtime-CqEudH37.js +0 -114
  995. package/dist/runtime-whatsapp-outbound.runtime-D5m2qyn-.js +0 -117
  996. package/dist/sandbox-cli-CHJiEWXB.js +0 -535
  997. package/dist/search-manager-BtNC3-i_.js +0 -16
  998. package/dist/search-manager-C7J7B3_a.js +0 -386
  999. package/dist/secrets-cli-C6yIWBbN.js +0 -2070
  1000. package/dist/security-cli-BVu9BkjD.js +0 -575
  1001. package/dist/send-BSreC7rr.js +0 -631
  1002. package/dist/send-BsLHQG_B.js +0 -1025
  1003. package/dist/send-BuNhp8PH.js +0 -283
  1004. package/dist/send-DOCswVar.js +0 -100
  1005. package/dist/send-Dl0LLErk.js +0 -629
  1006. package/dist/server-node-events-Bq2067EG.js +0 -506
  1007. package/dist/server-y38L7N5H.js +0 -107
  1008. package/dist/sessions-BV8gXURR.js +0 -112
  1009. package/dist/sessions-dl1Kc-Ci.js +0 -218
  1010. package/dist/setup-BSPXdMuK.d.ts +0 -37
  1011. package/dist/setup-DGszQH0_.js +0 -387
  1012. package/dist/setup-binary-C17YnmA8.js +0 -406
  1013. package/dist/setup-browser-CPx-nEsr.js +0 -70
  1014. package/dist/setup-core-BByHN1ME.js +0 -143
  1015. package/dist/setup-core-C0KPlBmL.js +0 -47
  1016. package/dist/setup-core-Cq37G6of.js +0 -166
  1017. package/dist/setup-core-uO84_Y75.js +0 -205
  1018. package/dist/setup-surface-BEMi7Rmb.js +0 -490
  1019. package/dist/setup-wizard-helpers-Ck9wDR0b.d.ts +0 -203
  1020. package/dist/setup.finalize-BzPBa8zW.js +0 -522
  1021. package/dist/setup.gateway-config-DdwkF-8e.js +0 -343
  1022. package/dist/shared-BCw4SKjB.js +0 -96
  1023. package/dist/shared-CjNzsULP.js +0 -75
  1024. package/dist/shared-Cu1BE7ZE.js +0 -298
  1025. package/dist/shared-DSClmyUn.js +0 -182
  1026. package/dist/shared-DyJdGH6y.js +0 -102
  1027. package/dist/signal-Dyv4NZsB.js +0 -114
  1028. package/dist/skills-CbB5b27M.js +0 -853
  1029. package/dist/skills-CnfI7Szw.js +0 -20
  1030. package/dist/skills-cli-CavB1f_3.js +0 -292
  1031. package/dist/skills-install-B1OBdgd0.js +0 -763
  1032. package/dist/skills-status-B3gAmIbW.js +0 -169
  1033. package/dist/skills-status-DrHhFgU9.js +0 -21
  1034. package/dist/slack-BRzqnoAz.js +0 -114
  1035. package/dist/slash-commands.runtime-BK88kgds.js +0 -128
  1036. package/dist/slash-dispatch.runtime-COGywwJE.js +0 -141
  1037. package/dist/slash-skill-commands.runtime-Ti4brxgh.js +0 -116
  1038. package/dist/src-DUR6OQxI.js +0 -1701
  1039. package/dist/status-C6dgQY9a.js +0 -131
  1040. package/dist/status-CNK0Q7QH.js +0 -606
  1041. package/dist/status-DBcX0DSC.js +0 -43
  1042. package/dist/status-DKgFgbwv.js +0 -1599
  1043. package/dist/status-Wn5lhNAc.js +0 -126
  1044. package/dist/status-json-D2EkWqAl.js +0 -288
  1045. package/dist/status.link-channel-D3ULIdEa.js +0 -143
  1046. package/dist/status.scan.deps.runtime-BsjWTAm4.js +0 -126
  1047. package/dist/status.scan.runtime-D4HbzROD.js +0 -119
  1048. package/dist/status.summary-C3YxPrDK.js +0 -592
  1049. package/dist/status.summary.runtime-DAkXPSaK.js +0 -118
  1050. package/dist/status.update-B4NnN9P1.js +0 -77
  1051. package/dist/subagent-orphan-recovery-QiQEBv36.js +0 -307
  1052. package/dist/subagent-registry-runtime-BJatPQFK.js +0 -111
  1053. package/dist/subscription-BhZORXN9.js +0 -100
  1054. package/dist/subscription-QEUjQRMv.js +0 -33
  1055. package/dist/subscription-cli-HrULlAgc.js +0 -134
  1056. package/dist/synology-chat-DB76GWMN.js +0 -297
  1057. package/dist/system-cli-D8jDwWuL.js +0 -94
  1058. package/dist/telegram-BHiiqKkQ.js +0 -114
  1059. package/dist/text-chunking-Baonm9Lu.js +0 -84
  1060. package/dist/text-chunking-DzB11ONk.d.ts +0 -79
  1061. package/dist/tlon-DLESxNgD.js +0 -433
  1062. package/dist/tui-C75zi2Cl.js +0 -3834
  1063. package/dist/tui-cli-DFwx5e6i.js +0 -137
  1064. package/dist/types-BKldC9YN.d.ts +0 -22692
  1065. package/dist/types-MeyueBE0.d.ts +0 -45
  1066. package/dist/types.base-Cw0-zIvE.d.ts +0 -188
  1067. package/dist/ui-B55NOIB6.js +0 -31
  1068. package/dist/update--ojavYQ4.js +0 -1036
  1069. package/dist/update-cli-Cvj5aWYM.js +0 -1503
  1070. package/dist/update-offset-store-upatuWwX.js +0 -112
  1071. package/dist/update-runner-DHkY_-76.js +0 -1496
  1072. package/dist/upsert-with-lock-C171GLaR.js +0 -33
  1073. package/dist/usage-N3bxnbmt.js +0 -115
  1074. package/dist/web-RdvT7gKa.js +0 -112
  1075. package/dist/web-shared-C2qHVxw1.d.ts +0 -45
  1076. package/dist/webhook-request-guards-CosLyl01.d.ts +0 -76
  1077. package/dist/webhook-targets-Bfnag-du.js +0 -181
  1078. package/dist/webhook-targets-DP_EkQa4.d.ts +0 -106
  1079. package/dist/webhooks-cli-ZpnXrq7G.js +0 -350
  1080. package/dist/whatsapp-DNTAyZHt.js +0 -114
  1081. package/dist/whatsapp-actions-o1zKQzKZ.js +0 -167
  1082. package/dist/workspace-CpWi5wPr.js +0 -479
  1083. package/dist/workspace-Ii7aRS7c.js +0 -289
  1084. package/dist/workspace-dirs-x10McA9t.js +0 -2003
  1085. package/dist/zalo-C9OQRYRw.d.ts +0 -9
  1086. package/dist/zalo-zm_bYCKg.js +0 -415
  1087. package/dist/zalouser-CvVEUvc5.js +0 -30911
  1088. /package/dist/{account-id-B3YSn4hl.d.ts → account-id-B8ce6G_4.d.ts} +0 -0
  1089. /package/dist/{acpx-CnNv70m2.d.ts → acpx-Ci50I9T2.d.ts} +0 -0
  1090. /package/dist/{agent-media-payload-DE2pEcsz.d.ts → agent-media-payload-en-gS5p6.d.ts} +0 -0
  1091. /package/dist/{allow-from-DPpHnT2A.d.ts → allow-from-cMeQ47Ot.d.ts} +0 -0
  1092. /package/dist/{allowlist-resolution-CLFiZ6nE.d.ts → allowlist-resolution-DoAWbfXV.d.ts} +0 -0
  1093. /package/dist/{bluebubbles-Duhu-Jer.d.ts → bluebubbles-C6yYmUl0.d.ts} +0 -0
  1094. /package/dist/{boolean-param-BhFjB3gp.d.ts → boolean-param-CdO2TFTk.d.ts} +0 -0
  1095. /package/dist/{channel-config-schema-DnnVMdjR.d.ts → channel-config-schema-Chp38wel.d.ts} +0 -0
  1096. /package/dist/{channel-policy-Baq-Z06b.d.ts → channel-policy-g2h6AbYQ.d.ts} +0 -0
  1097. /package/dist/{chat-type-DpiBgwuG.d.ts → chat-type-BLt59pPT.d.ts} +0 -0
  1098. /package/dist/{command-format-vi4xq8e8.d.ts → command-format-BDJC05Jp.d.ts} +0 -0
  1099. /package/dist/{diffs-DK7fVSDo.d.ts → diffs-D_iNKCyn.d.ts} +0 -0
  1100. /package/dist/{directory-runtime-BTLPaysA.d.ts → directory-runtime-DhMex6HY.d.ts} +0 -0
  1101. /package/dist/{exec-C01wtBHu.d.ts → exec-pjfUY4KM.d.ts} +0 -0
  1102. /package/dist/{gaxios-fetch-compat-wZ38b3w3.js → gaxios-fetch-compat-B_vtINdV.js} +0 -0
  1103. /package/dist/{history-CwXuP2TW.d.ts → history-aqSS5VGQ.d.ts} +0 -0
  1104. /package/dist/{inbound-envelope-SggrBs9m.d.ts → inbound-envelope-C5hWuZod.d.ts} +0 -0
  1105. /package/dist/{index-apAZHsDo.d.ts → index-DXVQFYGX.d.ts} +0 -0
  1106. /package/dist/{json-store-r75IZGk9.d.ts → json-store-UnqQ5aV3.d.ts} +0 -0
  1107. /package/dist/{keyed-async-queue-DHIr7yNe.d.ts → keyed-async-queue-guucpLw3.d.ts} +0 -0
  1108. /package/dist/{links-HeQ3r_L0.d.ts → links-Bar0meEK.d.ts} +0 -0
  1109. /package/dist/{markdown-to-line-CDb4Jy3V.d.ts → markdown-to-line-D8uH_KOj.d.ts} +0 -0
  1110. /package/dist/{mattermost-DtCsxpgg.d.ts → mattermost-xl7jAFJL.d.ts} +0 -0
  1111. /package/dist/{net-BATPDwdQ.d.ts → net-rGOKGds6.d.ts} +0 -0
  1112. /package/dist/{nextcloud-talk-Bb2wHOwp.d.ts → nextcloud-talk-De2CZ9dV.d.ts} +0 -0
  1113. /package/dist/{oauth-utils-u567CLT0.d.ts → oauth-utils-DzN1AlEH.d.ts} +0 -0
  1114. /package/dist/{parse-finite-number-l3tNlrZh.d.ts → parse-finite-number-odgyqhi0.d.ts} +0 -0
  1115. /package/dist/{provider-usage.types-C6061OVN.d.ts → provider-usage.types-EDE9o-H_.d.ts} +0 -0
  1116. /package/dist/{reply-history-BDsFnZFl.d.ts → reply-history-CVuU31xe.d.ts} +0 -0
  1117. /package/dist/{reply-payload-CCvM4W9u.d.ts → reply-payload-CHkpBYwL.d.ts} +0 -0
  1118. /package/dist/{request-url-C54l4-xC.d.ts → request-url-DHisbiHY.d.ts} +0 -0
  1119. /package/dist/{run-command-D3RqWcHu.d.ts → run-command-y0Cndsb1.d.ts} +0 -0
  1120. /package/dist/{secret-input-schema-BLBt-NAP.d.ts → secret-input-schema-b1vpYDQN.d.ts} +0 -0
  1121. /package/dist/{session-key-BQ2-bR-9.d.ts → session-key-DTHQl57f.d.ts} +0 -0
  1122. /package/dist/{ssh-config-C4mcH9Ly.js → ssh-config-hEHBfU2_.js} +0 -0
  1123. /package/dist/{testing-DLkhGsoz.d.ts → testing-DszuZXgK.d.ts} +0 -0
  1124. /package/dist/{thinking-DRkjX18p.d.ts → thinking-IwXTGSeT.d.ts} +0 -0
  1125. /package/dist/{tool-send-CMMD1uDu.d.ts → tool-send-DWHRmKpz.d.ts} +0 -0
  1126. /package/dist/{vllm-defaults-CcGuf4hL.d.ts → vllm-defaults-CrxZgE6-.d.ts} +0 -0
  1127. /package/dist/{wait-Daog8bxM.d.ts → wait-wDWw_MTI.d.ts} +0 -0
  1128. /package/dist/{webhook-memory-guards-C5MrExwT.d.ts → webhook-memory-guards-DreORuJy.d.ts} +0 -0
  1129. /package/dist/{windows-spawn-j2l-dqu8.d.ts → windows-spawn-BIzH92x2.d.ts} +0 -0
  1130. /package/dist/{zod-schema.agent-runtime-krMrBnIn.d.ts → zod-schema.agent-runtime-CP2rmis3.d.ts} +0 -0
  1131. /package/dist/{zod-schema.core-BNDieZDZ.d.ts → zod-schema.core-Foi1tYwi.d.ts} +0 -0
@@ -0,0 +1,2514 @@
1
+ import { n as isRich$1, r as theme, t as colorize } from "./theme-BSXzMzAA.js";
2
+ import { S as shortenHomePath } from "./utils-C7ykRPCQ.js";
3
+ import { S as resolvemoldClawAgentDir, b as resolveAuthStorePathForDisplay } from "./setup-binary-CcAv8NXz.js";
4
+ import { $a as DEFAULT_OAUTH_WARN_MS, Am as createVpsAwareOAuthHandlers, Bm as resolveKnownAgentId, EE as loadAuthProfileStoreForRuntime, Eu as describeFailoverError, Fm as formatTokenK, Gc as runEmbeddedPiAgent, Gm as applyAuthProfileConfig, Hm as resolveModelTarget, IE as resolveAuthProfileDisplayLabel, Im as isLocalBaseUrl, Lm as loadValidConfigOrThrow, Mm as applyDefaultModelPrimaryUpdate, Nm as ensureFlagCompatibility, Ol as loadProviderUsageSummary, Pm as formatMs, Pn as resolvePluginProviders, Qa as maskApiKey, Rm as mergePrimaryFallbackConfig, Sv as shouldSuppressBuiltInModel, Um as updateConfig, Vb as loadModelCatalog, Vm as resolveModelKeysFromEntries, Wm as upsertCanonicalModelConfigEntry, _v as resolveModelWithRegistry, ax as hasUsableCustomProviderApiKey, bE as setAuthProfileOrder, bv as discoverAuthStorage, bx as isNonSecretApiKeyMarker, cx as resolveAwsSdkEnvVarName, d as resolveProfileUnusableUntilForDisplay, dx as resolveUsableCustomProviderApiKey, eo as buildAuthHealthSummary, i as clearAuthProfileCooldown, jl as formatUsageWindowSummary, lx as resolveEnvApiKey, n as resolveAuthProfileOrder, rx as getCustomProviderApiKey, sx as resolveApiKeyForProvider, t as resolveAuthProfileEligibility, to as formatRemainingShort, vE as listProfilesForProvider, wE as ensureAuthProfileStore, xE as upsertAuthProfile, xv as discoverModels, yu as resolveCommandSecretRefsViaGateway, zm as normalizeAlias } from "./auth-profiles-C-Ul-Qkn.js";
5
+ import { C as findNormalizedProviderValue, O as DEFAULT_MODEL, _ as resolveModelRefFromString, c as modelKey, d as parseModelRef, h as resolveDefaultModelForAgent, k as DEFAULT_PROVIDER, m as resolveConfiguredModelRef, r as buildModelAliasIndex, w as normalizeProviderId } from "./model-selection-bBBxfXdb.js";
6
+ import { S as toAgentModelListLike, a as resolveAgentDir, b as resolveAgentModelFallbackValues, m as resolveDefaultAgentId, p as resolveAgentWorkspaceDir, s as resolveAgentExplicitModelPrimary, u as resolveAgentModelFallbacksOverride, x as resolveAgentModelPrimaryValue } from "./agent-scope-lZlwP1At.js";
7
+ import { r as normalizeStringEntries } from "./string-normalization-28MhO2sd.js";
8
+ import { g as resolveDefaultAgentWorkspaceDir } from "./workspace-DJ_S272u.js";
9
+ import { An as getShellEnvAppliedKeys, Nn as shouldEnableShellEnvFallback, c as loadConfig, g as setRuntimeConfigSnapshot, i as createConfigIO, p as readConfigFileSnapshotForWrite } from "./io-BaBxjB1v.js";
10
+ import { i as coerceSecretRef, l as normalizeSecretInputString } from "./types.secrets-Ca-9L8vU.js";
11
+ import { t as parseDurationMs } from "./parse-duration-CwV75fzr.js";
12
+ import { n as resolveSecretRefString } from "./resolve-PSlwZjg3.js";
13
+ import { t as formatCliCommand } from "./command-format-C_z0Ru-7.js";
14
+ import { a as resolveSessionTranscriptPath, c as resolveSessionTranscriptsDirForAgent } from "./paths-ApLcu1Uu.js";
15
+ import { n as logConfigUpdated } from "./logging-CdisccbY.js";
16
+ import { i as stylePromptTitle, n as stylePromptHint, r as stylePromptMessage } from "./note-dOl5kPAy.js";
17
+ import { i as getModelsCommandSecretTargetIds } from "./command-secret-targets-BFF4x_RB.js";
18
+ import { m as resolveUsageProviderId } from "./provider-usage-kxemdMp2.js";
19
+ import { r as withProgressTotals } from "./progress-Cwq59vgZ.js";
20
+ import { d as openUrl } from "./onboard-helpers-DiSRTpZC.js";
21
+ import { n as renderTable, t as getTerminalTableWidth } from "./table-BldgNDVQ.js";
22
+ import { n as redactSecrets } from "./format-BcYacdHi.js";
23
+ import { t as createClackPrompter } from "./clack-prompter-yY7QJAil.js";
24
+ import { t as isRemoteEnvironment } from "./oauth-env-CLG8KOrz.js";
25
+ import { i as resolveProviderMatch, n as mergeConfigPatch, r as pickAuthMethod, t as applyDefaultModel } from "./provider-auth-choice-helpers-hzDkh3f1.js";
26
+ import { t as buildProviderAuthRecoveryHint } from "./provider-auth-guidance-BxxMxMEt.js";
27
+ import { t as inferParamBFromIdOrName } from "./model-param-b-DY4IkmF9.js";
28
+ import path from "node:path";
29
+ import fs from "node:fs/promises";
30
+ import crypto from "node:crypto";
31
+ import { complete, getEnvApiKey, getModel } from "@mariozechner/pi-ai";
32
+ import { Type } from "@sinclair/typebox";
33
+ import { cancel, confirm, isCancel, multiselect, select, text } from "@clack/prompts";
34
+ //#region src/commands/models/load-config.ts
35
+ async function loadSourceConfigSnapshot(fallback) {
36
+ try {
37
+ const { snapshot } = await readConfigFileSnapshotForWrite();
38
+ if (snapshot.valid) return snapshot.resolved;
39
+ } catch {}
40
+ return fallback;
41
+ }
42
+ async function loadModelsConfigWithSource(params) {
43
+ const runtimeConfig = loadConfig();
44
+ const sourceConfig = await loadSourceConfigSnapshot(runtimeConfig);
45
+ const { resolvedConfig, diagnostics } = await resolveCommandSecretRefsViaGateway({
46
+ config: runtimeConfig,
47
+ commandName: params.commandName,
48
+ targetIds: getModelsCommandSecretTargetIds()
49
+ });
50
+ if (params.runtime) for (const entry of diagnostics) params.runtime.log(`[secrets] ${entry}`);
51
+ setRuntimeConfigSnapshot(resolvedConfig, sourceConfig);
52
+ return {
53
+ sourceConfig,
54
+ resolvedConfig,
55
+ diagnostics
56
+ };
57
+ }
58
+ async function loadModelsConfig(params) {
59
+ return (await loadModelsConfigWithSource(params)).resolvedConfig;
60
+ }
61
+ //#endregion
62
+ //#region src/commands/models/aliases.ts
63
+ async function modelsAliasesListCommand(opts, runtime) {
64
+ ensureFlagCompatibility(opts);
65
+ const models = (await loadModelsConfig({
66
+ commandName: "models aliases list",
67
+ runtime
68
+ })).agents?.defaults?.models ?? {};
69
+ const aliases = Object.entries(models).reduce((acc, [modelKey, entry]) => {
70
+ const alias = entry?.alias?.trim();
71
+ if (alias) acc[alias] = modelKey;
72
+ return acc;
73
+ }, {});
74
+ if (opts.json) {
75
+ runtime.log(JSON.stringify({ aliases }, null, 2));
76
+ return;
77
+ }
78
+ if (opts.plain) {
79
+ for (const [alias, target] of Object.entries(aliases)) runtime.log(`${alias} ${target}`);
80
+ return;
81
+ }
82
+ runtime.log(`Aliases (${Object.keys(aliases).length}):`);
83
+ if (Object.keys(aliases).length === 0) {
84
+ runtime.log("- none");
85
+ return;
86
+ }
87
+ for (const [alias, target] of Object.entries(aliases)) runtime.log(`- ${alias} -> ${target}`);
88
+ }
89
+ async function modelsAliasesAddCommand(aliasRaw, modelRaw, runtime) {
90
+ const alias = normalizeAlias(aliasRaw);
91
+ const resolved = resolveModelTarget({
92
+ raw: modelRaw,
93
+ cfg: await loadModelsConfig({
94
+ commandName: "models aliases add",
95
+ runtime
96
+ })
97
+ });
98
+ await updateConfig((cfg) => {
99
+ const modelKey = `${resolved.provider}/${resolved.model}`;
100
+ const nextModels = { ...cfg.agents?.defaults?.models };
101
+ for (const [key, entry] of Object.entries(nextModels)) {
102
+ const existing = entry?.alias?.trim();
103
+ if (existing && existing === alias && key !== modelKey) throw new Error(`Alias ${alias} already points to ${key}.`);
104
+ }
105
+ nextModels[modelKey] = {
106
+ ...nextModels[modelKey] ?? {},
107
+ alias
108
+ };
109
+ return {
110
+ ...cfg,
111
+ agents: {
112
+ ...cfg.agents,
113
+ defaults: {
114
+ ...cfg.agents?.defaults,
115
+ models: nextModels
116
+ }
117
+ }
118
+ };
119
+ });
120
+ logConfigUpdated(runtime);
121
+ runtime.log(`Alias ${alias} -> ${resolved.provider}/${resolved.model}`);
122
+ }
123
+ async function modelsAliasesRemoveCommand(aliasRaw, runtime) {
124
+ const alias = normalizeAlias(aliasRaw);
125
+ const updated = await updateConfig((cfg) => {
126
+ const nextModels = { ...cfg.agents?.defaults?.models };
127
+ let found = false;
128
+ for (const [key, entry] of Object.entries(nextModels)) if (entry?.alias?.trim() === alias) {
129
+ nextModels[key] = {
130
+ ...entry,
131
+ alias: void 0
132
+ };
133
+ found = true;
134
+ break;
135
+ }
136
+ if (!found) throw new Error(`Alias not found: ${alias}`);
137
+ return {
138
+ ...cfg,
139
+ agents: {
140
+ ...cfg.agents,
141
+ defaults: {
142
+ ...cfg.agents?.defaults,
143
+ models: nextModels
144
+ }
145
+ }
146
+ };
147
+ });
148
+ logConfigUpdated(runtime);
149
+ if (!updated.agents?.defaults?.models || Object.values(updated.agents.defaults.models).every((entry) => !entry?.alias?.trim())) runtime.log("No aliases configured.");
150
+ }
151
+ //#endregion
152
+ //#region src/commands/models/auth.ts
153
+ function guardCancel(value) {
154
+ if (typeof value === "symbol" || isCancel(value)) {
155
+ cancel("Cancelled.");
156
+ process.exit(0);
157
+ }
158
+ return value;
159
+ }
160
+ const confirm$1 = async (params) => guardCancel(await confirm({
161
+ ...params,
162
+ message: stylePromptMessage(params.message)
163
+ }));
164
+ const text$1 = async (params) => guardCancel(await text({
165
+ ...params,
166
+ message: stylePromptMessage(params.message)
167
+ }));
168
+ const select$1 = async (params) => guardCancel(await select({
169
+ ...params,
170
+ message: stylePromptMessage(params.message),
171
+ options: params.options.map((opt) => opt.hint === void 0 ? opt : {
172
+ ...opt,
173
+ hint: stylePromptHint(opt.hint)
174
+ })
175
+ }));
176
+ function resolveDefaultTokenProfileId(provider) {
177
+ return `${normalizeProviderId(provider)}:manual`;
178
+ }
179
+ function listProvidersWithAuthMethods(providers) {
180
+ return providers.filter((provider) => provider.auth.length > 0);
181
+ }
182
+ function listTokenAuthMethods(provider) {
183
+ return provider.auth.filter((method) => method.kind === "token");
184
+ }
185
+ function listProvidersWithTokenMethods(providers) {
186
+ return providers.filter((provider) => listTokenAuthMethods(provider).length > 0);
187
+ }
188
+ async function resolveModelsAuthContext() {
189
+ const config = await loadValidConfigOrThrow();
190
+ const defaultAgentId = resolveDefaultAgentId(config);
191
+ const agentDir = resolveAgentDir(config, defaultAgentId);
192
+ const workspaceDir = resolveAgentWorkspaceDir(config, defaultAgentId) ?? resolveDefaultAgentWorkspaceDir();
193
+ return {
194
+ config,
195
+ agentDir,
196
+ workspaceDir,
197
+ providers: resolvePluginProviders({
198
+ config,
199
+ workspaceDir,
200
+ bundledProviderAllowlistCompat: true,
201
+ bundledProviderVitestCompat: true
202
+ })
203
+ };
204
+ }
205
+ function resolveRequestedProviderOrThrow(providers, rawProvider) {
206
+ const requested = rawProvider?.trim();
207
+ if (!requested) return null;
208
+ const matched = resolveProviderMatch(providers, requested);
209
+ if (matched) return matched;
210
+ const available = providers.map((provider) => provider.id).filter(Boolean).toSorted((a, b) => a.localeCompare(b));
211
+ const availableText = available.length > 0 ? available.join(", ") : "(none)";
212
+ throw new Error(`Unknown provider "${requested}". Loaded providers: ${availableText}. Verify plugins via \`${formatCliCommand("moldclaw plugins list --json")}\`.`);
213
+ }
214
+ function resolveTokenMethodOrThrow(provider, rawMethod) {
215
+ const tokenMethods = listTokenAuthMethods(provider);
216
+ if (rawMethod?.trim()) {
217
+ const matched = pickAuthMethod(provider, rawMethod);
218
+ if (matched && matched.kind === "token") return matched;
219
+ const available = tokenMethods.map((method) => method.id).join(", ") || "(none)";
220
+ throw new Error(`Unknown token auth method "${rawMethod}" for provider "${provider.id}". Available token methods: ${available}.`);
221
+ }
222
+ return null;
223
+ }
224
+ async function pickProviderAuthMethod(params) {
225
+ const requestedMethod = pickAuthMethod(params.provider, params.requestedMethod);
226
+ if (requestedMethod) return requestedMethod;
227
+ if (params.provider.auth.length === 1) return params.provider.auth[0] ?? null;
228
+ return await params.prompter.select({
229
+ message: `Auth method for ${params.provider.label}`,
230
+ options: params.provider.auth.map((method) => ({
231
+ value: method.id,
232
+ label: method.label,
233
+ hint: method.hint
234
+ }))
235
+ }).then((id) => params.provider.auth.find((method) => method.id === String(id)) ?? null);
236
+ }
237
+ async function pickProviderTokenMethod(params) {
238
+ const explicitTokenMethod = resolveTokenMethodOrThrow(params.provider, params.requestedMethod);
239
+ if (explicitTokenMethod) return explicitTokenMethod;
240
+ const tokenMethods = listTokenAuthMethods(params.provider);
241
+ if (tokenMethods.length === 0) return null;
242
+ const setupTokenMethod = tokenMethods.find((method) => method.id === "setup-token");
243
+ if (setupTokenMethod) return setupTokenMethod;
244
+ if (tokenMethods.length === 1) return tokenMethods[0] ?? null;
245
+ return await params.prompter.select({
246
+ message: `Token method for ${params.provider.label}`,
247
+ options: tokenMethods.map((method) => ({
248
+ value: method.id,
249
+ label: method.label,
250
+ hint: method.hint
251
+ }))
252
+ }).then((id) => tokenMethods.find((method) => method.id === String(id)) ?? null);
253
+ }
254
+ async function persistProviderAuthResult(params) {
255
+ for (const profile of params.result.profiles) upsertAuthProfile({
256
+ profileId: profile.profileId,
257
+ credential: profile.credential,
258
+ agentDir: params.agentDir
259
+ });
260
+ await updateConfig((cfg) => {
261
+ let next = cfg;
262
+ if (params.result.configPatch) next = mergeConfigPatch(next, params.result.configPatch);
263
+ for (const profile of params.result.profiles) next = applyAuthProfileConfig(next, {
264
+ profileId: profile.profileId,
265
+ provider: profile.credential.provider,
266
+ mode: credentialMode(profile.credential)
267
+ });
268
+ if (params.setDefault && params.result.defaultModel) next = applyDefaultModel(next, params.result.defaultModel);
269
+ return next;
270
+ });
271
+ logConfigUpdated(params.runtime);
272
+ for (const profile of params.result.profiles) params.runtime.log(`Auth profile: ${profile.profileId} (${profile.credential.provider}/${credentialMode(profile.credential)})`);
273
+ if (params.result.defaultModel) params.runtime.log(params.setDefault ? `Default model set to ${params.result.defaultModel}` : `Default model available: ${params.result.defaultModel} (use --set-default to apply)`);
274
+ if (params.result.notes && params.result.notes.length > 0) await params.prompter.note(params.result.notes.join("\n"), "Provider notes");
275
+ }
276
+ async function runProviderAuthMethod(params) {
277
+ await clearStaleProfileLockouts(params.provider.id, params.agentDir);
278
+ await persistProviderAuthResult({
279
+ result: await params.method.run({
280
+ config: params.config,
281
+ agentDir: params.agentDir,
282
+ workspaceDir: params.workspaceDir,
283
+ prompter: params.prompter,
284
+ runtime: params.runtime,
285
+ allowSecretRefPrompt: false,
286
+ isRemote: isRemoteEnvironment(),
287
+ openUrl: async (url) => {
288
+ await openUrl(url);
289
+ },
290
+ oauth: { createVpsAwareHandlers: (runtimeParams) => createVpsAwareOAuthHandlers(runtimeParams) }
291
+ }),
292
+ agentDir: params.agentDir,
293
+ runtime: params.runtime,
294
+ prompter: params.prompter,
295
+ setDefault: params.setDefault
296
+ });
297
+ }
298
+ async function modelsAuthSetupTokenCommand(opts, runtime) {
299
+ if (!process.stdin.isTTY) throw new Error("setup-token requires an interactive TTY.");
300
+ const { config, agentDir, workspaceDir, providers } = await resolveModelsAuthContext();
301
+ const tokenProviders = listProvidersWithTokenMethods(providers);
302
+ if (tokenProviders.length === 0) throw new Error(`No provider token-auth plugins found. Install one via \`${formatCliCommand("moldclaw plugins install")}\`.`);
303
+ const provider = resolveRequestedProviderOrThrow(tokenProviders, opts.provider ?? "anthropic") ?? tokenProviders.find((candidate) => normalizeProviderId(candidate.id) === "anthropic") ?? tokenProviders[0] ?? null;
304
+ if (!provider) throw new Error("No token-capable provider is available.");
305
+ if (!opts.yes) {
306
+ if (!await confirm$1({
307
+ message: `Continue with ${provider.label} token auth?`,
308
+ initialValue: true
309
+ })) return;
310
+ }
311
+ const prompter = createClackPrompter();
312
+ const method = await pickProviderTokenMethod({
313
+ provider,
314
+ prompter
315
+ });
316
+ if (!method) throw new Error(`Provider "${provider.id}" does not expose a token auth method.`);
317
+ await runProviderAuthMethod({
318
+ config,
319
+ agentDir,
320
+ workspaceDir,
321
+ provider,
322
+ method,
323
+ runtime,
324
+ prompter
325
+ });
326
+ }
327
+ async function modelsAuthPasteTokenCommand(opts, runtime) {
328
+ const rawProvider = opts.provider?.trim();
329
+ if (!rawProvider) throw new Error("Missing --provider.");
330
+ const provider = normalizeProviderId(rawProvider);
331
+ const profileId = opts.profileId?.trim() || resolveDefaultTokenProfileId(provider);
332
+ const tokenInput = await text$1({
333
+ message: `Paste token for ${provider}`,
334
+ validate: (value) => value?.trim() ? void 0 : "Required"
335
+ });
336
+ const token = String(tokenInput ?? "").trim();
337
+ const expires = opts.expiresIn?.trim() && opts.expiresIn.trim().length > 0 ? Date.now() + parseDurationMs(String(opts.expiresIn ?? "").trim(), { defaultUnit: "d" }) : void 0;
338
+ upsertAuthProfile({
339
+ profileId,
340
+ credential: {
341
+ type: "token",
342
+ provider,
343
+ token,
344
+ ...expires ? { expires } : {}
345
+ }
346
+ });
347
+ await updateConfig((cfg) => applyAuthProfileConfig(cfg, {
348
+ profileId,
349
+ provider,
350
+ mode: "token"
351
+ }));
352
+ logConfigUpdated(runtime);
353
+ runtime.log(`Auth profile: ${profileId} (${provider}/token)`);
354
+ }
355
+ async function modelsAuthAddCommand(_opts, runtime) {
356
+ const { config, agentDir, workspaceDir, providers } = await resolveModelsAuthContext();
357
+ const tokenProviders = listProvidersWithTokenMethods(providers);
358
+ const provider = await select$1({
359
+ message: "Token provider",
360
+ options: [...tokenProviders.map((providerPlugin) => ({
361
+ value: providerPlugin.id,
362
+ label: providerPlugin.id,
363
+ hint: providerPlugin.docsPath ? `Docs: ${providerPlugin.docsPath}` : void 0
364
+ })), {
365
+ value: "custom",
366
+ label: "custom (type provider id)"
367
+ }]
368
+ });
369
+ const providerId = provider === "custom" ? normalizeProviderId(String(await text$1({
370
+ message: "Provider id",
371
+ validate: (value) => value?.trim() ? void 0 : "Required"
372
+ }))) : provider;
373
+ const providerPlugin = provider === "custom" ? null : resolveRequestedProviderOrThrow(tokenProviders, providerId);
374
+ if (providerPlugin) {
375
+ const tokenMethods = listTokenAuthMethods(providerPlugin);
376
+ const methodId = tokenMethods.length > 0 ? await select$1({
377
+ message: "Token method",
378
+ options: [...tokenMethods.map((method) => ({
379
+ value: method.id,
380
+ label: method.label,
381
+ hint: method.hint
382
+ })), {
383
+ value: "paste",
384
+ label: "paste token"
385
+ }]
386
+ }) : "paste";
387
+ if (methodId !== "paste") {
388
+ const prompter = createClackPrompter();
389
+ const method = tokenMethods.find((candidate) => candidate.id === methodId);
390
+ if (!method) throw new Error(`Unknown token auth method "${String(methodId)}".`);
391
+ await runProviderAuthMethod({
392
+ config,
393
+ agentDir,
394
+ workspaceDir,
395
+ provider: providerPlugin,
396
+ method,
397
+ runtime,
398
+ prompter
399
+ });
400
+ return;
401
+ }
402
+ }
403
+ const profileIdDefault = resolveDefaultTokenProfileId(providerId);
404
+ await modelsAuthPasteTokenCommand({
405
+ provider: providerId,
406
+ profileId: String(await text$1({
407
+ message: "Profile id",
408
+ initialValue: profileIdDefault,
409
+ validate: (value) => value?.trim() ? void 0 : "Required"
410
+ })).trim(),
411
+ expiresIn: await confirm$1({
412
+ message: "Does this token expire?",
413
+ initialValue: false
414
+ }) ? String(await text$1({
415
+ message: "Expires in (duration)",
416
+ initialValue: "365d",
417
+ validate: (value) => {
418
+ try {
419
+ parseDurationMs(String(value ?? ""), { defaultUnit: "d" });
420
+ return;
421
+ } catch {
422
+ return "Invalid duration (e.g. 365d, 12h, 30m)";
423
+ }
424
+ }
425
+ })).trim() : void 0
426
+ }, runtime);
427
+ }
428
+ /**
429
+ * Clear stale cooldown/disabled state for all profiles matching a provider.
430
+ * When a user explicitly runs `models auth login`, they intend to fix auth —
431
+ * stale `auth_permanent` / `billing` lockouts should not persist across
432
+ * a deliberate re-authentication attempt.
433
+ */
434
+ async function clearStaleProfileLockouts(provider, agentDir) {
435
+ try {
436
+ const store = loadAuthProfileStoreForRuntime(agentDir);
437
+ const profileIds = listProfilesForProvider(store, provider);
438
+ for (const profileId of profileIds) await clearAuthProfileCooldown({
439
+ store,
440
+ profileId,
441
+ agentDir
442
+ });
443
+ } catch {}
444
+ }
445
+ function resolveRequestedLoginProviderOrThrow(providers, rawProvider) {
446
+ return resolveRequestedProviderOrThrow(providers, rawProvider);
447
+ }
448
+ function credentialMode(credential) {
449
+ if (credential.type === "api_key") return "api_key";
450
+ if (credential.type === "token") return "token";
451
+ return "oauth";
452
+ }
453
+ async function modelsAuthLoginCommand(opts, runtime) {
454
+ if (!process.stdin.isTTY) throw new Error("models auth login requires an interactive TTY.");
455
+ const { config, agentDir, workspaceDir, providers } = await resolveModelsAuthContext();
456
+ const prompter = createClackPrompter();
457
+ const authProviders = listProvidersWithAuthMethods(providers);
458
+ if (authProviders.length === 0) throw new Error(`No provider plugins found. Install one via \`${formatCliCommand("moldclaw plugins install")}\`.`);
459
+ const selectedProvider = resolveRequestedLoginProviderOrThrow(authProviders, opts.provider) ?? await prompter.select({
460
+ message: "Select a provider",
461
+ options: authProviders.map((provider) => ({
462
+ value: provider.id,
463
+ label: provider.label,
464
+ hint: provider.docsPath ? `Docs: ${provider.docsPath}` : void 0
465
+ }))
466
+ }).then((id) => resolveProviderMatch(authProviders, String(id)));
467
+ if (!selectedProvider) throw new Error("Unknown provider. Use --provider <id> to pick a provider plugin.");
468
+ const chosenMethod = await pickProviderAuthMethod({
469
+ provider: selectedProvider,
470
+ requestedMethod: opts.method,
471
+ prompter
472
+ });
473
+ if (!chosenMethod) throw new Error("Unknown auth method. Use --method <id> to select one.");
474
+ await runProviderAuthMethod({
475
+ config,
476
+ agentDir,
477
+ workspaceDir,
478
+ provider: selectedProvider,
479
+ method: chosenMethod,
480
+ runtime,
481
+ prompter,
482
+ setDefault: opts.setDefault
483
+ });
484
+ }
485
+ //#endregion
486
+ //#region src/commands/models/auth-order.ts
487
+ function resolveTargetAgent(cfg, raw) {
488
+ const agentId = resolveKnownAgentId({
489
+ cfg,
490
+ rawAgentId: raw
491
+ }) ?? resolveDefaultAgentId(cfg);
492
+ return {
493
+ agentId,
494
+ agentDir: resolveAgentDir(cfg, agentId)
495
+ };
496
+ }
497
+ function describeOrder(store, provider) {
498
+ const providerKey = normalizeProviderId(provider);
499
+ const order = store.order?.[providerKey];
500
+ return Array.isArray(order) ? order : [];
501
+ }
502
+ async function resolveAuthOrderContext(opts, runtime) {
503
+ const rawProvider = opts.provider?.trim();
504
+ if (!rawProvider) throw new Error("Missing --provider.");
505
+ const provider = normalizeProviderId(rawProvider);
506
+ const cfg = await loadModelsConfig({
507
+ commandName: "models auth-order",
508
+ runtime
509
+ });
510
+ const { agentId, agentDir } = resolveTargetAgent(cfg, opts.agent);
511
+ return {
512
+ cfg,
513
+ agentId,
514
+ agentDir,
515
+ provider
516
+ };
517
+ }
518
+ async function modelsAuthOrderGetCommand(opts, runtime) {
519
+ const { agentId, agentDir, provider } = await resolveAuthOrderContext(opts, runtime);
520
+ const order = describeOrder(ensureAuthProfileStore(agentDir, { allowKeychainPrompt: false }), provider);
521
+ if (opts.json) {
522
+ runtime.log(JSON.stringify({
523
+ agentId,
524
+ agentDir,
525
+ provider,
526
+ authStorePath: shortenHomePath(`${agentDir}/auth-profiles.json`),
527
+ order: order.length > 0 ? order : null
528
+ }, null, 2));
529
+ return;
530
+ }
531
+ runtime.log(`Agent: ${agentId}`);
532
+ runtime.log(`Provider: ${provider}`);
533
+ runtime.log(`Auth file: ${shortenHomePath(`${agentDir}/auth-profiles.json`)}`);
534
+ runtime.log(order.length > 0 ? `Order override: ${order.join(", ")}` : "Order override: (none)");
535
+ }
536
+ async function modelsAuthOrderClearCommand(opts, runtime) {
537
+ const { agentId, agentDir, provider } = await resolveAuthOrderContext(opts, runtime);
538
+ if (!await setAuthProfileOrder({
539
+ agentDir,
540
+ provider,
541
+ order: null
542
+ })) throw new Error("Failed to update auth-profiles.json (lock busy?).");
543
+ runtime.log(`Agent: ${agentId}`);
544
+ runtime.log(`Provider: ${provider}`);
545
+ runtime.log("Cleared per-agent order override.");
546
+ }
547
+ async function modelsAuthOrderSetCommand(opts, runtime) {
548
+ const { agentId, agentDir, provider } = await resolveAuthOrderContext(opts, runtime);
549
+ const store = ensureAuthProfileStore(agentDir, { allowKeychainPrompt: false });
550
+ const providerKey = provider;
551
+ const requested = normalizeStringEntries(opts.order ?? []);
552
+ if (requested.length === 0) throw new Error("Missing profile ids. Provide one or more profile ids.");
553
+ for (const profileId of requested) {
554
+ const cred = store.profiles[profileId];
555
+ if (!cred) throw new Error(`Auth profile "${profileId}" not found in ${agentDir}.`);
556
+ if (normalizeProviderId(cred.provider) !== providerKey) throw new Error(`Auth profile "${profileId}" is for ${cred.provider}, not ${provider}.`);
557
+ }
558
+ const updated = await setAuthProfileOrder({
559
+ agentDir,
560
+ provider,
561
+ order: requested
562
+ });
563
+ if (!updated) throw new Error("Failed to update auth-profiles.json (lock busy?).");
564
+ runtime.log(`Agent: ${agentId}`);
565
+ runtime.log(`Provider: ${provider}`);
566
+ runtime.log(`Order override: ${describeOrder(updated, provider).join(", ")}`);
567
+ }
568
+ //#endregion
569
+ //#region src/commands/models/fallbacks-shared.ts
570
+ function getFallbacks(cfg, key) {
571
+ return resolveAgentModelFallbackValues(cfg.agents?.defaults?.[key]);
572
+ }
573
+ function patchDefaultsFallbacks(cfg, params) {
574
+ const existing = toAgentModelListLike(cfg.agents?.defaults?.[params.key]);
575
+ return {
576
+ ...cfg,
577
+ agents: {
578
+ ...cfg.agents,
579
+ defaults: {
580
+ ...cfg.agents?.defaults,
581
+ [params.key]: mergePrimaryFallbackConfig(existing, { fallbacks: params.fallbacks }),
582
+ ...params.models ? { models: params.models } : void 0
583
+ }
584
+ }
585
+ };
586
+ }
587
+ async function listFallbacksCommand(params, opts, runtime) {
588
+ ensureFlagCompatibility(opts);
589
+ const fallbacks = getFallbacks(await loadModelsConfig({
590
+ commandName: `models ${params.key} list`,
591
+ runtime
592
+ }), params.key);
593
+ if (opts.json) {
594
+ runtime.log(JSON.stringify({ fallbacks }, null, 2));
595
+ return;
596
+ }
597
+ if (opts.plain) {
598
+ for (const entry of fallbacks) runtime.log(entry);
599
+ return;
600
+ }
601
+ runtime.log(`${params.label} (${fallbacks.length}):`);
602
+ if (fallbacks.length === 0) {
603
+ runtime.log("- none");
604
+ return;
605
+ }
606
+ for (const entry of fallbacks) runtime.log(`- ${entry}`);
607
+ }
608
+ async function addFallbackCommand(params, modelRaw, runtime) {
609
+ const updated = await updateConfig((cfg) => {
610
+ const resolved = resolveModelTarget({
611
+ raw: modelRaw,
612
+ cfg
613
+ });
614
+ const nextModels = { ...cfg.agents?.defaults?.models };
615
+ const targetKey = upsertCanonicalModelConfigEntry(nextModels, resolved);
616
+ const existing = getFallbacks(cfg, params.key);
617
+ if (resolveModelKeysFromEntries({
618
+ cfg,
619
+ entries: existing
620
+ }).includes(targetKey)) return cfg;
621
+ return patchDefaultsFallbacks(cfg, {
622
+ key: params.key,
623
+ fallbacks: [...existing, targetKey],
624
+ models: nextModels
625
+ });
626
+ });
627
+ logConfigUpdated(runtime);
628
+ runtime.log(`${params.logPrefix}: ${getFallbacks(updated, params.key).join(", ")}`);
629
+ }
630
+ async function removeFallbackCommand(params, modelRaw, runtime) {
631
+ const updated = await updateConfig((cfg) => {
632
+ const resolved = resolveModelTarget({
633
+ raw: modelRaw,
634
+ cfg
635
+ });
636
+ const targetKey = modelKey(resolved.provider, resolved.model);
637
+ const aliasIndex = buildModelAliasIndex({
638
+ cfg,
639
+ defaultProvider: DEFAULT_PROVIDER
640
+ });
641
+ const existing = getFallbacks(cfg, params.key);
642
+ const filtered = existing.filter((entry) => {
643
+ const resolvedEntry = resolveModelRefFromString({
644
+ raw: String(entry ?? ""),
645
+ defaultProvider: DEFAULT_PROVIDER,
646
+ aliasIndex
647
+ });
648
+ if (!resolvedEntry) return true;
649
+ return modelKey(resolvedEntry.ref.provider, resolvedEntry.ref.model) !== targetKey;
650
+ });
651
+ if (filtered.length === existing.length) throw new Error(`${params.notFoundLabel} not found: ${targetKey}`);
652
+ return patchDefaultsFallbacks(cfg, {
653
+ key: params.key,
654
+ fallbacks: filtered
655
+ });
656
+ });
657
+ logConfigUpdated(runtime);
658
+ runtime.log(`${params.logPrefix}: ${getFallbacks(updated, params.key).join(", ")}`);
659
+ }
660
+ async function clearFallbacksCommand(params, runtime) {
661
+ await updateConfig((cfg) => {
662
+ return patchDefaultsFallbacks(cfg, {
663
+ key: params.key,
664
+ fallbacks: []
665
+ });
666
+ });
667
+ logConfigUpdated(runtime);
668
+ runtime.log(params.clearedMessage);
669
+ }
670
+ //#endregion
671
+ //#region src/commands/models/fallbacks.ts
672
+ async function modelsFallbacksListCommand(opts, runtime) {
673
+ return await listFallbacksCommand({
674
+ label: "Fallbacks",
675
+ key: "model"
676
+ }, opts, runtime);
677
+ }
678
+ async function modelsFallbacksAddCommand(modelRaw, runtime) {
679
+ return await addFallbackCommand({
680
+ label: "Fallbacks",
681
+ key: "model",
682
+ logPrefix: "Fallbacks"
683
+ }, modelRaw, runtime);
684
+ }
685
+ async function modelsFallbacksRemoveCommand(modelRaw, runtime) {
686
+ return await removeFallbackCommand({
687
+ label: "Fallbacks",
688
+ key: "model",
689
+ notFoundLabel: "Fallback",
690
+ logPrefix: "Fallbacks"
691
+ }, modelRaw, runtime);
692
+ }
693
+ async function modelsFallbacksClearCommand(runtime) {
694
+ return await clearFallbacksCommand({
695
+ key: "model",
696
+ clearedMessage: "Fallback list cleared."
697
+ }, runtime);
698
+ }
699
+ //#endregion
700
+ //#region src/commands/models/image-fallbacks.ts
701
+ async function modelsImageFallbacksListCommand(opts, runtime) {
702
+ return await listFallbacksCommand({
703
+ label: "Image fallbacks",
704
+ key: "imageModel"
705
+ }, opts, runtime);
706
+ }
707
+ async function modelsImageFallbacksAddCommand(modelRaw, runtime) {
708
+ return await addFallbackCommand({
709
+ label: "Image fallbacks",
710
+ key: "imageModel",
711
+ logPrefix: "Image fallbacks"
712
+ }, modelRaw, runtime);
713
+ }
714
+ async function modelsImageFallbacksRemoveCommand(modelRaw, runtime) {
715
+ return await removeFallbackCommand({
716
+ label: "Image fallbacks",
717
+ key: "imageModel",
718
+ notFoundLabel: "Image fallback",
719
+ logPrefix: "Image fallbacks"
720
+ }, modelRaw, runtime);
721
+ }
722
+ async function modelsImageFallbacksClearCommand(runtime) {
723
+ return await clearFallbacksCommand({
724
+ key: "imageModel",
725
+ clearedMessage: "Image fallback list cleared."
726
+ }, runtime);
727
+ }
728
+ //#endregion
729
+ //#region src/commands/models/list.configured.ts
730
+ function resolveConfiguredEntries(cfg) {
731
+ const resolvedDefault = resolveConfiguredModelRef({
732
+ cfg,
733
+ defaultProvider: DEFAULT_PROVIDER,
734
+ defaultModel: DEFAULT_MODEL
735
+ });
736
+ const aliasIndex = buildModelAliasIndex({
737
+ cfg,
738
+ defaultProvider: DEFAULT_PROVIDER
739
+ });
740
+ const order = [];
741
+ const tagsByKey = /* @__PURE__ */ new Map();
742
+ const aliasesByKey = /* @__PURE__ */ new Map();
743
+ for (const [key, aliases] of aliasIndex.byKey.entries()) aliasesByKey.set(key, aliases);
744
+ const addEntry = (ref, tag) => {
745
+ const key = modelKey(ref.provider, ref.model);
746
+ if (!tagsByKey.has(key)) {
747
+ tagsByKey.set(key, /* @__PURE__ */ new Set());
748
+ order.push(key);
749
+ }
750
+ tagsByKey.get(key)?.add(tag);
751
+ };
752
+ const addResolvedModelRef = (raw, tag) => {
753
+ const resolved = resolveModelRefFromString({
754
+ raw,
755
+ defaultProvider: DEFAULT_PROVIDER,
756
+ aliasIndex
757
+ });
758
+ if (resolved) addEntry(resolved.ref, tag);
759
+ };
760
+ addEntry(resolvedDefault, "default");
761
+ const modelFallbacks = resolveAgentModelFallbackValues(cfg.agents?.defaults?.model);
762
+ const imageFallbacks = resolveAgentModelFallbackValues(cfg.agents?.defaults?.imageModel);
763
+ const imagePrimary = resolveAgentModelPrimaryValue(cfg.agents?.defaults?.imageModel) ?? "";
764
+ modelFallbacks.forEach((raw, idx) => {
765
+ addResolvedModelRef(String(raw ?? ""), `fallback#${idx + 1}`);
766
+ });
767
+ if (imagePrimary) addResolvedModelRef(imagePrimary, "image");
768
+ imageFallbacks.forEach((raw, idx) => {
769
+ addResolvedModelRef(String(raw ?? ""), `img-fallback#${idx + 1}`);
770
+ });
771
+ for (const key of Object.keys(cfg.agents?.defaults?.models ?? {})) {
772
+ const parsed = parseModelRef(String(key ?? ""), DEFAULT_PROVIDER);
773
+ if (!parsed) continue;
774
+ addEntry(parsed, "configured");
775
+ }
776
+ return { entries: order.map((key) => {
777
+ const slash = key.indexOf("/");
778
+ return {
779
+ key,
780
+ ref: {
781
+ provider: slash === -1 ? key : key.slice(0, slash),
782
+ model: slash === -1 ? "" : key.slice(slash + 1)
783
+ },
784
+ tags: tagsByKey.get(key) ?? /* @__PURE__ */ new Set(),
785
+ aliases: aliasesByKey.get(key) ?? []
786
+ };
787
+ }) };
788
+ }
789
+ //#endregion
790
+ //#region src/commands/models/list.errors.ts
791
+ const MODEL_AVAILABILITY_UNAVAILABLE_CODE = "MODEL_AVAILABILITY_UNAVAILABLE";
792
+ function formatErrorWithStack(err) {
793
+ if (err instanceof Error) return err.stack ?? `${err.name}: ${err.message}`;
794
+ return String(err);
795
+ }
796
+ function shouldFallbackToAuthHeuristics(err) {
797
+ if (!(err instanceof Error)) return false;
798
+ return err.code === MODEL_AVAILABILITY_UNAVAILABLE_CODE;
799
+ }
800
+ //#endregion
801
+ //#region src/commands/models/list.registry.ts
802
+ const hasAuthForProvider = (provider, cfg, authStore) => {
803
+ if (!cfg || !authStore) return false;
804
+ if (listProfilesForProvider(authStore, provider).length > 0) return true;
805
+ if (provider === "amazon-bedrock" && resolveAwsSdkEnvVarName()) return true;
806
+ if (resolveEnvApiKey(provider)) return true;
807
+ if (hasUsableCustomProviderApiKey(cfg, provider)) return true;
808
+ return false;
809
+ };
810
+ function createAvailabilityUnavailableError(message) {
811
+ const err = new Error(message);
812
+ err.code = MODEL_AVAILABILITY_UNAVAILABLE_CODE;
813
+ return err;
814
+ }
815
+ function normalizeAvailabilityError(err) {
816
+ if (shouldFallbackToAuthHeuristics(err) && err instanceof Error) return err;
817
+ return createAvailabilityUnavailableError(`Model availability unavailable: getAvailable() failed.\n${formatErrorWithStack(err)}`);
818
+ }
819
+ function validateAvailableModels(availableModels) {
820
+ if (!Array.isArray(availableModels)) throw createAvailabilityUnavailableError("Model availability unavailable: getAvailable() returned a non-array value.");
821
+ for (const model of availableModels) if (!model || typeof model !== "object" || typeof model.provider !== "string" || typeof model.id !== "string") throw createAvailabilityUnavailableError("Model availability unavailable: getAvailable() returned invalid model entries.");
822
+ return availableModels;
823
+ }
824
+ function loadAvailableModels(registry) {
825
+ let availableModels;
826
+ try {
827
+ availableModels = registry.getAvailable();
828
+ } catch (err) {
829
+ throw normalizeAvailabilityError(err);
830
+ }
831
+ try {
832
+ return validateAvailableModels(availableModels).filter((model) => !shouldSuppressBuiltInModel({
833
+ provider: model.provider,
834
+ id: model.id
835
+ }));
836
+ } catch (err) {
837
+ throw normalizeAvailabilityError(err);
838
+ }
839
+ }
840
+ async function loadModelRegistry(_cfg, _opts) {
841
+ const agentDir = resolvemoldClawAgentDir();
842
+ const registry = discoverModels(discoverAuthStorage(agentDir), agentDir);
843
+ const models = registry.getAll().filter((model) => !shouldSuppressBuiltInModel({
844
+ provider: model.provider,
845
+ id: model.id
846
+ }));
847
+ let availableKeys;
848
+ let availabilityErrorMessage;
849
+ try {
850
+ const availableModels = loadAvailableModels(registry);
851
+ availableKeys = new Set(availableModels.map((model) => modelKey(model.provider, model.id)));
852
+ } catch (err) {
853
+ if (!shouldFallbackToAuthHeuristics(err)) throw err;
854
+ availableKeys = void 0;
855
+ if (!availabilityErrorMessage) availabilityErrorMessage = formatErrorWithStack(err);
856
+ }
857
+ return {
858
+ registry,
859
+ models,
860
+ availableKeys,
861
+ availabilityErrorMessage
862
+ };
863
+ }
864
+ function toModelRow(params) {
865
+ const { model, key, tags, aliases = [], availableKeys, cfg, authStore, allowProviderAvailabilityFallback = false } = params;
866
+ if (!model) return {
867
+ key,
868
+ name: key,
869
+ input: "-",
870
+ contextWindow: null,
871
+ local: null,
872
+ available: null,
873
+ tags: [...tags, "missing"],
874
+ missing: true
875
+ };
876
+ const input = model.input.join("+") || "text";
877
+ const local = isLocalBaseUrl(model.baseUrl);
878
+ const modelIsAvailable = availableKeys?.has(modelKey(model.provider, model.id)) ?? false;
879
+ const available = availableKeys !== void 0 && !allowProviderAvailabilityFallback ? modelIsAvailable : modelIsAvailable || (cfg && authStore ? hasAuthForProvider(model.provider, cfg, authStore) : false);
880
+ const aliasTags = aliases.length > 0 ? [`alias:${aliases.join(",")}`] : [];
881
+ const mergedTags = new Set(tags);
882
+ if (aliasTags.length > 0) {
883
+ for (const tag of mergedTags) if (tag === "alias" || tag.startsWith("alias:")) mergedTags.delete(tag);
884
+ for (const tag of aliasTags) mergedTags.add(tag);
885
+ }
886
+ return {
887
+ key,
888
+ name: model.name || model.id,
889
+ input,
890
+ contextWindow: model.contextWindow ?? null,
891
+ local,
892
+ available,
893
+ tags: Array.from(mergedTags),
894
+ missing: false
895
+ };
896
+ }
897
+ //#endregion
898
+ //#region src/commands/models/list.rows.ts
899
+ function matchesRowFilter(filter, model) {
900
+ if (filter.provider && model.provider.toLowerCase() !== filter.provider) return false;
901
+ if (filter.local && !isLocalBaseUrl(model.baseUrl ?? "")) return false;
902
+ return true;
903
+ }
904
+ function buildRow(params) {
905
+ const configured = params.context.configuredByKey.get(params.key);
906
+ return toModelRow({
907
+ model: params.model,
908
+ key: params.key,
909
+ tags: configured ? Array.from(configured.tags) : [],
910
+ aliases: configured?.aliases ?? [],
911
+ availableKeys: params.context.availableKeys,
912
+ cfg: params.context.cfg,
913
+ authStore: params.context.authStore,
914
+ allowProviderAvailabilityFallback: params.allowProviderAvailabilityFallback ?? false
915
+ });
916
+ }
917
+ async function loadListModelRegistry(cfg, opts) {
918
+ const loaded = await loadModelRegistry(cfg, opts);
919
+ return {
920
+ ...loaded,
921
+ discoveredKeys: new Set(loaded.models.map((model) => modelKey(model.provider, model.id)))
922
+ };
923
+ }
924
+ function appendDiscoveredRows(params) {
925
+ const seenKeys = /* @__PURE__ */ new Set();
926
+ const sorted = [...params.models].toSorted((a, b) => {
927
+ const providerCompare = a.provider.localeCompare(b.provider);
928
+ if (providerCompare !== 0) return providerCompare;
929
+ return a.id.localeCompare(b.id);
930
+ });
931
+ for (const model of sorted) {
932
+ if (shouldSuppressBuiltInModel({
933
+ provider: model.provider,
934
+ id: model.id
935
+ })) continue;
936
+ if (!matchesRowFilter(params.context.filter, model)) continue;
937
+ const key = modelKey(model.provider, model.id);
938
+ params.rows.push(buildRow({
939
+ model,
940
+ key,
941
+ context: params.context
942
+ }));
943
+ seenKeys.add(key);
944
+ }
945
+ return seenKeys;
946
+ }
947
+ async function appendCatalogSupplementRows(params) {
948
+ const catalog = await loadModelCatalog({ config: params.context.cfg });
949
+ for (const entry of catalog) {
950
+ if (params.context.filter.provider && entry.provider.toLowerCase() !== params.context.filter.provider) continue;
951
+ const key = modelKey(entry.provider, entry.id);
952
+ if (params.seenKeys.has(key)) continue;
953
+ const model = resolveModelWithRegistry({
954
+ provider: entry.provider,
955
+ modelId: entry.id,
956
+ modelRegistry: params.modelRegistry,
957
+ cfg: params.context.cfg
958
+ });
959
+ if (!model || !matchesRowFilter(params.context.filter, model)) continue;
960
+ params.rows.push(buildRow({
961
+ model,
962
+ key,
963
+ context: params.context,
964
+ allowProviderAvailabilityFallback: !params.context.discoveredKeys.has(key)
965
+ }));
966
+ params.seenKeys.add(key);
967
+ }
968
+ }
969
+ function appendConfiguredRows(params) {
970
+ for (const entry of params.entries) {
971
+ if (params.context.filter.provider && entry.ref.provider.toLowerCase() !== params.context.filter.provider) continue;
972
+ const model = resolveModelWithRegistry({
973
+ provider: entry.ref.provider,
974
+ modelId: entry.ref.model,
975
+ modelRegistry: params.modelRegistry,
976
+ cfg: params.context.cfg
977
+ });
978
+ if (params.context.filter.local && model && !isLocalBaseUrl(model.baseUrl ?? "")) continue;
979
+ if (params.context.filter.local && !model) continue;
980
+ params.rows.push(toModelRow({
981
+ model,
982
+ key: entry.key,
983
+ tags: Array.from(entry.tags),
984
+ aliases: entry.aliases,
985
+ availableKeys: params.context.availableKeys,
986
+ cfg: params.context.cfg,
987
+ authStore: params.context.authStore,
988
+ allowProviderAvailabilityFallback: model ? !params.context.discoveredKeys.has(modelKey(model.provider, model.id)) : false
989
+ }));
990
+ }
991
+ }
992
+ //#endregion
993
+ //#region src/commands/models/list.format.ts
994
+ const isRich = (opts) => Boolean(isRich$1() && !opts?.json && !opts?.plain);
995
+ const pad = (value, size) => value.padEnd(size);
996
+ const formatTag = (tag, rich) => {
997
+ if (!rich) return tag;
998
+ if (tag === "default") return theme.success(tag);
999
+ if (tag === "image") return theme.accentBright(tag);
1000
+ if (tag === "configured") return theme.accent(tag);
1001
+ if (tag === "missing") return theme.error(tag);
1002
+ if (tag.startsWith("fallback#")) return theme.warn(tag);
1003
+ if (tag.startsWith("img-fallback#")) return theme.warn(tag);
1004
+ if (tag.startsWith("alias:")) return theme.accentDim(tag);
1005
+ return theme.muted(tag);
1006
+ };
1007
+ const truncate = (value, max) => {
1008
+ if (value.length <= max) return value;
1009
+ if (max <= 3) return value.slice(0, max);
1010
+ return `${value.slice(0, max - 3)}...`;
1011
+ };
1012
+ //#endregion
1013
+ //#region src/commands/models/list.table.ts
1014
+ const MODEL_PAD$1 = 42;
1015
+ const INPUT_PAD = 10;
1016
+ const CTX_PAD$1 = 8;
1017
+ const LOCAL_PAD = 5;
1018
+ const AUTH_PAD = 5;
1019
+ function printModelTable(rows, runtime, opts = {}) {
1020
+ if (opts.json) {
1021
+ runtime.log(JSON.stringify({
1022
+ count: rows.length,
1023
+ models: rows
1024
+ }, null, 2));
1025
+ return;
1026
+ }
1027
+ if (opts.plain) {
1028
+ for (const row of rows) runtime.log(row.key);
1029
+ return;
1030
+ }
1031
+ const rich = isRich(opts);
1032
+ const header = [
1033
+ pad("Model", MODEL_PAD$1),
1034
+ pad("Input", INPUT_PAD),
1035
+ pad("Ctx", CTX_PAD$1),
1036
+ pad("Local", LOCAL_PAD),
1037
+ pad("Auth", AUTH_PAD),
1038
+ "Tags"
1039
+ ].join(" ");
1040
+ runtime.log(rich ? theme.heading(header) : header);
1041
+ for (const row of rows) {
1042
+ const keyLabel = pad(truncate(row.key, MODEL_PAD$1), MODEL_PAD$1);
1043
+ const inputLabel = pad(row.input || "-", INPUT_PAD);
1044
+ const ctxLabel = pad(formatTokenK(row.contextWindow), CTX_PAD$1);
1045
+ const localLabel = pad(row.local === null ? "-" : row.local ? "yes" : "no", LOCAL_PAD);
1046
+ const authLabel = pad(row.available === null ? "-" : row.available ? "yes" : "no", AUTH_PAD);
1047
+ const tagsLabel = row.tags.length > 0 ? rich ? row.tags.map((tag) => formatTag(tag, rich)).join(",") : row.tags.join(",") : "";
1048
+ const coloredInput = colorize(rich, row.input.includes("image") ? theme.accentBright : theme.info, inputLabel);
1049
+ const coloredLocal = colorize(rich, row.local === null ? theme.muted : row.local ? theme.success : theme.muted, localLabel);
1050
+ const coloredAuth = colorize(rich, row.available === null ? theme.muted : row.available ? theme.success : theme.error, authLabel);
1051
+ const line = [
1052
+ rich ? theme.accent(keyLabel) : keyLabel,
1053
+ coloredInput,
1054
+ ctxLabel,
1055
+ coloredLocal,
1056
+ coloredAuth,
1057
+ tagsLabel
1058
+ ].join(" ");
1059
+ runtime.log(line);
1060
+ }
1061
+ }
1062
+ //#endregion
1063
+ //#region src/commands/models/list.list-command.ts
1064
+ async function modelsListCommand(opts, runtime) {
1065
+ ensureFlagCompatibility(opts);
1066
+ const { ensureAuthProfileStore } = await import("./auth-profiles.runtime-Clyka_jV.js");
1067
+ const { ensuremoldClawModelsJson } = await import("./models-config-UQxq76ac.js");
1068
+ const { sourceConfig, resolvedConfig: cfg } = await loadModelsConfigWithSource({
1069
+ commandName: "models list",
1070
+ runtime
1071
+ });
1072
+ const authStore = ensureAuthProfileStore();
1073
+ const providerFilter = (() => {
1074
+ const raw = opts.provider?.trim();
1075
+ if (!raw) return;
1076
+ return parseModelRef(`${raw}/_`, "anthropic")?.provider ?? raw.toLowerCase();
1077
+ })();
1078
+ let modelRegistry;
1079
+ let discoveredKeys = /* @__PURE__ */ new Set();
1080
+ let availableKeys;
1081
+ let availabilityErrorMessage;
1082
+ try {
1083
+ await ensuremoldClawModelsJson(sourceConfig ?? cfg);
1084
+ const loaded = await loadListModelRegistry(cfg, { sourceConfig });
1085
+ modelRegistry = loaded.registry;
1086
+ discoveredKeys = loaded.discoveredKeys;
1087
+ availableKeys = loaded.availableKeys;
1088
+ availabilityErrorMessage = loaded.availabilityErrorMessage;
1089
+ } catch (err) {
1090
+ runtime.error(`Model registry unavailable:\n${formatErrorWithStack(err)}`);
1091
+ process.exitCode = 1;
1092
+ return;
1093
+ }
1094
+ if (availabilityErrorMessage !== void 0) runtime.error(`Model availability lookup failed; falling back to auth heuristics for discovered models: ${availabilityErrorMessage}`);
1095
+ const { entries } = resolveConfiguredEntries(cfg);
1096
+ const configuredByKey = new Map(entries.map((entry) => [entry.key, entry]));
1097
+ const rows = [];
1098
+ const rowContext = {
1099
+ cfg,
1100
+ authStore,
1101
+ availableKeys,
1102
+ configuredByKey,
1103
+ discoveredKeys,
1104
+ filter: {
1105
+ provider: providerFilter,
1106
+ local: opts.local
1107
+ }
1108
+ };
1109
+ if (opts.all) {
1110
+ const seenKeys = appendDiscoveredRows({
1111
+ rows,
1112
+ models: modelRegistry?.getAll() ?? [],
1113
+ context: rowContext
1114
+ });
1115
+ if (modelRegistry) await appendCatalogSupplementRows({
1116
+ rows,
1117
+ modelRegistry,
1118
+ context: rowContext,
1119
+ seenKeys
1120
+ });
1121
+ } else {
1122
+ const registry = modelRegistry;
1123
+ if (!registry) {
1124
+ runtime.error("Model registry unavailable.");
1125
+ process.exitCode = 1;
1126
+ return;
1127
+ }
1128
+ appendConfiguredRows({
1129
+ rows,
1130
+ entries,
1131
+ modelRegistry: registry,
1132
+ context: rowContext
1133
+ });
1134
+ }
1135
+ if (rows.length === 0) {
1136
+ runtime.log("No models found.");
1137
+ return;
1138
+ }
1139
+ printModelTable(rows, runtime, opts);
1140
+ }
1141
+ //#endregion
1142
+ //#region src/commands/models/list.auth-overview.ts
1143
+ function formatMarkerOrSecret(value) {
1144
+ return isNonSecretApiKeyMarker(value, { includeEnvVarName: false }) ? `marker(${value.trim()})` : maskApiKey(value);
1145
+ }
1146
+ function formatProfileSecretLabel(params) {
1147
+ const value = typeof params.value === "string" ? params.value.trim() : "";
1148
+ if (value) {
1149
+ const display = formatMarkerOrSecret(value);
1150
+ return params.kind === "token" ? `token:${display}` : display;
1151
+ }
1152
+ if (params.ref) {
1153
+ const refLabel = `ref(${params.ref.source}:${params.ref.id})`;
1154
+ return params.kind === "token" ? `token:${refLabel}` : refLabel;
1155
+ }
1156
+ return params.kind === "token" ? "token:missing" : "missing";
1157
+ }
1158
+ function resolveProviderAuthOverview(params) {
1159
+ const { provider, cfg, store } = params;
1160
+ const now = Date.now();
1161
+ const profiles = listProfilesForProvider(store, provider);
1162
+ const withUnusableSuffix = (base, profileId) => {
1163
+ const unusableUntil = resolveProfileUnusableUntilForDisplay(store, profileId);
1164
+ if (!unusableUntil || now >= unusableUntil) return base;
1165
+ const stats = store.usageStats?.[profileId];
1166
+ return `${base} [${typeof stats?.disabledUntil === "number" && now < stats.disabledUntil ? `disabled${stats.disabledReason ? `:${stats.disabledReason}` : ""}` : "cooldown"} ${formatRemainingShort(unusableUntil - now)}]`;
1167
+ };
1168
+ const labels = profiles.map((profileId) => {
1169
+ const profile = store.profiles[profileId];
1170
+ if (!profile) return `${profileId}=missing`;
1171
+ if (profile.type === "api_key") return withUnusableSuffix(`${profileId}=${formatProfileSecretLabel({
1172
+ value: profile.key,
1173
+ ref: profile.keyRef,
1174
+ kind: "api-key"
1175
+ })}`, profileId);
1176
+ if (profile.type === "token") return withUnusableSuffix(`${profileId}=${formatProfileSecretLabel({
1177
+ value: profile.token,
1178
+ ref: profile.tokenRef,
1179
+ kind: "token"
1180
+ })}`, profileId);
1181
+ const display = resolveAuthProfileDisplayLabel({
1182
+ cfg,
1183
+ store,
1184
+ profileId
1185
+ });
1186
+ const suffix = display === profileId ? "" : display.startsWith(profileId) ? display.slice(profileId.length).trim() : `(${display})`;
1187
+ return withUnusableSuffix(`${profileId}=OAuth${suffix ? ` ${suffix}` : ""}`, profileId);
1188
+ });
1189
+ const oauthCount = profiles.filter((id) => store.profiles[id]?.type === "oauth").length;
1190
+ const tokenCount = profiles.filter((id) => store.profiles[id]?.type === "token").length;
1191
+ const apiKeyCount = profiles.filter((id) => store.profiles[id]?.type === "api_key").length;
1192
+ const envKey = resolveEnvApiKey(provider);
1193
+ const customKey = getCustomProviderApiKey(cfg, provider);
1194
+ const usableCustomKey = resolveUsableCustomProviderApiKey({
1195
+ cfg,
1196
+ provider
1197
+ });
1198
+ return {
1199
+ provider,
1200
+ effective: (() => {
1201
+ if (profiles.length > 0) return {
1202
+ kind: "profiles",
1203
+ detail: shortenHomePath(resolveAuthStorePathForDisplay())
1204
+ };
1205
+ if (envKey) return {
1206
+ kind: "env",
1207
+ detail: envKey.source.includes("OAUTH_TOKEN") || envKey.source.toLowerCase().includes("oauth") ? "OAuth (env)" : maskApiKey(envKey.apiKey)
1208
+ };
1209
+ if (usableCustomKey) return {
1210
+ kind: "models.json",
1211
+ detail: formatMarkerOrSecret(usableCustomKey.apiKey)
1212
+ };
1213
+ return {
1214
+ kind: "missing",
1215
+ detail: "missing"
1216
+ };
1217
+ })(),
1218
+ profiles: {
1219
+ count: profiles.length,
1220
+ oauth: oauthCount,
1221
+ token: tokenCount,
1222
+ apiKey: apiKeyCount,
1223
+ labels
1224
+ },
1225
+ ...envKey ? { env: {
1226
+ value: envKey.source.includes("OAUTH_TOKEN") || envKey.source.toLowerCase().includes("oauth") ? "OAuth (env)" : maskApiKey(envKey.apiKey),
1227
+ source: envKey.source
1228
+ } } : {},
1229
+ ...customKey ? { modelsJson: {
1230
+ value: formatMarkerOrSecret(customKey),
1231
+ source: `models.json: ${shortenHomePath(params.modelsPath)}`
1232
+ } } : {}
1233
+ };
1234
+ }
1235
+ //#endregion
1236
+ //#region src/commands/models/list.probe.ts
1237
+ const PROBE_PROMPT = "Reply with OK. Do not use tools.";
1238
+ function mapFailoverReasonToProbeStatus(reason) {
1239
+ if (!reason) return "unknown";
1240
+ if (reason === "auth" || reason === "auth_permanent") return "auth";
1241
+ if (reason === "rate_limit" || reason === "overloaded") return "rate_limit";
1242
+ if (reason === "billing") return "billing";
1243
+ if (reason === "timeout") return "timeout";
1244
+ if (reason === "format") return "format";
1245
+ return "unknown";
1246
+ }
1247
+ function buildCandidateMap(modelCandidates) {
1248
+ const map = /* @__PURE__ */ new Map();
1249
+ for (const raw of modelCandidates) {
1250
+ const parsed = parseModelRef(String(raw ?? ""), DEFAULT_PROVIDER);
1251
+ if (!parsed) continue;
1252
+ const list = map.get(parsed.provider) ?? [];
1253
+ if (!list.includes(parsed.model)) list.push(parsed.model);
1254
+ map.set(parsed.provider, list);
1255
+ }
1256
+ return map;
1257
+ }
1258
+ function selectProbeModel(params) {
1259
+ const { provider, candidates, catalog } = params;
1260
+ const direct = candidates.get(provider);
1261
+ if (direct && direct.length > 0) return {
1262
+ provider,
1263
+ model: direct[0]
1264
+ };
1265
+ const fromCatalog = catalog.find((entry) => entry.provider === provider);
1266
+ if (fromCatalog) return {
1267
+ provider: fromCatalog.provider,
1268
+ model: fromCatalog.id
1269
+ };
1270
+ return null;
1271
+ }
1272
+ function mapEligibilityReasonToProbeReasonCode(reasonCode) {
1273
+ if (reasonCode === "missing_credential") return "missing_credential";
1274
+ if (reasonCode === "expired") return "expired";
1275
+ if (reasonCode === "invalid_expires") return "invalid_expires";
1276
+ if (reasonCode === "unresolved_ref") return "unresolved_ref";
1277
+ return "ineligible_profile";
1278
+ }
1279
+ function formatMissingCredentialProbeError(reasonCode) {
1280
+ const legacyLine = "Auth profile credentials are missing or expired.";
1281
+ if (reasonCode === "expired") return `${legacyLine}\n↳ Auth reason [expired]: token credentials are expired.`;
1282
+ if (reasonCode === "invalid_expires") return `${legacyLine}\n↳ Auth reason [invalid_expires]: token expires must be a positive Unix ms timestamp.`;
1283
+ if (reasonCode === "missing_credential") return `${legacyLine}\n↳ Auth reason [missing_credential]: no inline credential or SecretRef is configured.`;
1284
+ if (reasonCode === "unresolved_ref") return `${legacyLine}\n↳ Auth reason [unresolved_ref]: configured SecretRef could not be resolved.`;
1285
+ return `${legacyLine}\n↳ Auth reason [ineligible_profile]: profile is incompatible with provider config.`;
1286
+ }
1287
+ function resolveProbeSecretRef(profile, cfg) {
1288
+ const defaults = cfg.secrets?.defaults;
1289
+ if (profile.type === "api_key") {
1290
+ if (normalizeSecretInputString(profile.key) !== void 0) return null;
1291
+ return coerceSecretRef(profile.keyRef, defaults);
1292
+ }
1293
+ if (profile.type === "token") {
1294
+ if (normalizeSecretInputString(profile.token) !== void 0) return null;
1295
+ return coerceSecretRef(profile.tokenRef, defaults);
1296
+ }
1297
+ return null;
1298
+ }
1299
+ function formatUnresolvedRefProbeError(refLabel) {
1300
+ return `Auth profile credentials are missing or expired.\n↳ Auth reason [unresolved_ref]: could not resolve SecretRef "${refLabel}".`;
1301
+ }
1302
+ async function maybeResolveUnresolvedRefIssue(params) {
1303
+ if (!params.profile) return null;
1304
+ const ref = resolveProbeSecretRef(params.profile, params.cfg);
1305
+ if (!ref) return null;
1306
+ try {
1307
+ await resolveSecretRefString(ref, {
1308
+ config: params.cfg,
1309
+ env: process.env,
1310
+ cache: params.cache
1311
+ });
1312
+ return null;
1313
+ } catch {
1314
+ return {
1315
+ reasonCode: "unresolved_ref",
1316
+ error: formatUnresolvedRefProbeError(`${ref.source}:${ref.provider}:${ref.id}`)
1317
+ };
1318
+ }
1319
+ }
1320
+ async function buildProbeTargets(params) {
1321
+ const { cfg, providers, modelCandidates, options } = params;
1322
+ const store = ensureAuthProfileStore();
1323
+ const providerFilter = options.provider?.trim();
1324
+ const providerFilterKey = providerFilter ? normalizeProviderId(providerFilter) : null;
1325
+ const profileFilter = new Set((options.profileIds ?? []).map((id) => id.trim()).filter(Boolean));
1326
+ const refResolveCache = {};
1327
+ const catalog = await loadModelCatalog({ config: cfg });
1328
+ const candidates = buildCandidateMap(modelCandidates);
1329
+ const targets = [];
1330
+ const results = [];
1331
+ for (const provider of providers) {
1332
+ const providerKey = normalizeProviderId(provider);
1333
+ if (providerFilterKey && providerKey !== providerFilterKey) continue;
1334
+ const model = selectProbeModel({
1335
+ provider: providerKey,
1336
+ candidates,
1337
+ catalog
1338
+ });
1339
+ const profileIds = listProfilesForProvider(store, providerKey);
1340
+ const explicitOrder = findNormalizedProviderValue(store.order, providerKey) ?? findNormalizedProviderValue(cfg?.auth?.order, providerKey);
1341
+ const allowedProfiles = explicitOrder && explicitOrder.length > 0 ? new Set(resolveAuthProfileOrder({
1342
+ cfg,
1343
+ store,
1344
+ provider: providerKey
1345
+ })) : null;
1346
+ const filteredProfiles = profileFilter.size ? profileIds.filter((id) => profileFilter.has(id)) : profileIds;
1347
+ if (filteredProfiles.length > 0) {
1348
+ for (const profileId of filteredProfiles) {
1349
+ const profile = store.profiles[profileId];
1350
+ const mode = profile?.type;
1351
+ const label = resolveAuthProfileDisplayLabel({
1352
+ cfg,
1353
+ store,
1354
+ profileId
1355
+ });
1356
+ if (explicitOrder && !explicitOrder.includes(profileId)) {
1357
+ results.push({
1358
+ provider: providerKey,
1359
+ profileId,
1360
+ model: model ? `${model.provider}/${model.model}` : void 0,
1361
+ label,
1362
+ source: "profile",
1363
+ mode,
1364
+ status: "unknown",
1365
+ reasonCode: "excluded_by_auth_order",
1366
+ error: "Excluded by auth.order for this provider."
1367
+ });
1368
+ continue;
1369
+ }
1370
+ if (allowedProfiles && !allowedProfiles.has(profileId)) {
1371
+ const reasonCode = mapEligibilityReasonToProbeReasonCode(resolveAuthProfileEligibility({
1372
+ cfg,
1373
+ store,
1374
+ provider: providerKey,
1375
+ profileId
1376
+ }).reasonCode);
1377
+ results.push({
1378
+ provider: providerKey,
1379
+ model: model ? `${model.provider}/${model.model}` : void 0,
1380
+ profileId,
1381
+ label,
1382
+ source: "profile",
1383
+ mode,
1384
+ status: "unknown",
1385
+ reasonCode,
1386
+ error: formatMissingCredentialProbeError(reasonCode)
1387
+ });
1388
+ continue;
1389
+ }
1390
+ const unresolvedRefIssue = await maybeResolveUnresolvedRefIssue({
1391
+ cfg,
1392
+ profile,
1393
+ cache: refResolveCache
1394
+ });
1395
+ if (unresolvedRefIssue) {
1396
+ results.push({
1397
+ provider: providerKey,
1398
+ model: model ? `${model.provider}/${model.model}` : void 0,
1399
+ profileId,
1400
+ label,
1401
+ source: "profile",
1402
+ mode,
1403
+ status: "unknown",
1404
+ reasonCode: unresolvedRefIssue.reasonCode,
1405
+ error: unresolvedRefIssue.error
1406
+ });
1407
+ continue;
1408
+ }
1409
+ if (!model) {
1410
+ results.push({
1411
+ provider: providerKey,
1412
+ model: void 0,
1413
+ profileId,
1414
+ label,
1415
+ source: "profile",
1416
+ mode,
1417
+ status: "no_model",
1418
+ reasonCode: "no_model",
1419
+ error: "No model available for probe"
1420
+ });
1421
+ continue;
1422
+ }
1423
+ targets.push({
1424
+ provider: providerKey,
1425
+ model,
1426
+ profileId,
1427
+ label,
1428
+ source: "profile",
1429
+ mode
1430
+ });
1431
+ }
1432
+ continue;
1433
+ }
1434
+ if (profileFilter.size > 0) continue;
1435
+ const envKey = resolveEnvApiKey(providerKey);
1436
+ const hasUsableModelsJsonKey = hasUsableCustomProviderApiKey(cfg, providerKey);
1437
+ if (!envKey && !hasUsableModelsJsonKey) continue;
1438
+ const label = envKey ? "env" : "models.json";
1439
+ const source = envKey ? "env" : "models.json";
1440
+ const mode = envKey?.source.includes("OAUTH_TOKEN") ? "oauth" : "api_key";
1441
+ if (!model) {
1442
+ results.push({
1443
+ provider: providerKey,
1444
+ model: void 0,
1445
+ label,
1446
+ source,
1447
+ mode,
1448
+ status: "no_model",
1449
+ reasonCode: "no_model",
1450
+ error: "No model available for probe"
1451
+ });
1452
+ continue;
1453
+ }
1454
+ targets.push({
1455
+ provider: providerKey,
1456
+ model,
1457
+ label,
1458
+ source,
1459
+ mode
1460
+ });
1461
+ }
1462
+ return {
1463
+ targets,
1464
+ results
1465
+ };
1466
+ }
1467
+ async function probeTarget(params) {
1468
+ const { cfg, agentId, agentDir, workspaceDir, sessionDir, target, timeoutMs, maxTokens } = params;
1469
+ if (!target.model) return {
1470
+ provider: target.provider,
1471
+ model: void 0,
1472
+ profileId: target.profileId,
1473
+ label: target.label,
1474
+ source: target.source,
1475
+ mode: target.mode,
1476
+ status: "no_model",
1477
+ reasonCode: "no_model",
1478
+ error: "No model available for probe"
1479
+ };
1480
+ const model = target.model;
1481
+ const sessionId = `probe-${target.provider}-${crypto.randomUUID()}`;
1482
+ const sessionFile = resolveSessionTranscriptPath(sessionId, agentId);
1483
+ await fs.mkdir(sessionDir, { recursive: true });
1484
+ const start = Date.now();
1485
+ const buildResult = (status, error) => ({
1486
+ provider: target.provider,
1487
+ model: `${model.provider}/${model.model}`,
1488
+ profileId: target.profileId,
1489
+ label: target.label,
1490
+ source: target.source,
1491
+ mode: target.mode,
1492
+ status,
1493
+ ...error ? { error } : {},
1494
+ latencyMs: Date.now() - start
1495
+ });
1496
+ try {
1497
+ await runEmbeddedPiAgent({
1498
+ sessionId,
1499
+ sessionFile,
1500
+ agentId,
1501
+ workspaceDir,
1502
+ agentDir,
1503
+ config: cfg,
1504
+ prompt: PROBE_PROMPT,
1505
+ provider: target.model.provider,
1506
+ model: target.model.model,
1507
+ authProfileId: target.profileId,
1508
+ authProfileIdSource: target.profileId ? "user" : void 0,
1509
+ timeoutMs,
1510
+ runId: `probe-${crypto.randomUUID()}`,
1511
+ lane: `auth-probe:${target.provider}:${target.profileId ?? target.source}`,
1512
+ thinkLevel: "off",
1513
+ reasoningLevel: "off",
1514
+ verboseLevel: "off",
1515
+ streamParams: { maxTokens }
1516
+ });
1517
+ return buildResult("ok");
1518
+ } catch (err) {
1519
+ const described = describeFailoverError(err);
1520
+ return buildResult(mapFailoverReasonToProbeStatus(described.reason), redactSecrets(described.message));
1521
+ }
1522
+ }
1523
+ async function runTargetsWithConcurrency(params) {
1524
+ const { cfg, targets, timeoutMs, maxTokens, onProgress } = params;
1525
+ const concurrency = Math.max(1, Math.min(targets.length || 1, params.concurrency));
1526
+ const agentId = resolveDefaultAgentId(cfg);
1527
+ const agentDir = resolvemoldClawAgentDir();
1528
+ const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId) ?? resolveDefaultAgentWorkspaceDir();
1529
+ const sessionDir = resolveSessionTranscriptsDirForAgent(agentId);
1530
+ await fs.mkdir(workspaceDir, { recursive: true });
1531
+ let completed = 0;
1532
+ const results = Array.from({ length: targets.length });
1533
+ let cursor = 0;
1534
+ const worker = async () => {
1535
+ while (true) {
1536
+ const index = cursor;
1537
+ cursor += 1;
1538
+ if (index >= targets.length) return;
1539
+ const target = targets[index];
1540
+ onProgress?.({
1541
+ completed,
1542
+ total: targets.length,
1543
+ label: `Probing ${target.provider}${target.profileId ? ` (${target.label})` : ""}`
1544
+ });
1545
+ results[index] = await probeTarget({
1546
+ cfg,
1547
+ agentId,
1548
+ agentDir,
1549
+ workspaceDir,
1550
+ sessionDir,
1551
+ target,
1552
+ timeoutMs,
1553
+ maxTokens
1554
+ });
1555
+ completed += 1;
1556
+ onProgress?.({
1557
+ completed,
1558
+ total: targets.length
1559
+ });
1560
+ }
1561
+ };
1562
+ await Promise.all(Array.from({ length: concurrency }, () => worker()));
1563
+ return results.filter((entry) => Boolean(entry));
1564
+ }
1565
+ async function runAuthProbes(params) {
1566
+ const startedAt = Date.now();
1567
+ const plan = await buildProbeTargets({
1568
+ cfg: params.cfg,
1569
+ providers: params.providers,
1570
+ modelCandidates: params.modelCandidates,
1571
+ options: params.options
1572
+ });
1573
+ const totalTargets = plan.targets.length;
1574
+ params.onProgress?.({
1575
+ completed: 0,
1576
+ total: totalTargets
1577
+ });
1578
+ const results = totalTargets ? await runTargetsWithConcurrency({
1579
+ cfg: params.cfg,
1580
+ targets: plan.targets,
1581
+ timeoutMs: params.options.timeoutMs,
1582
+ maxTokens: params.options.maxTokens,
1583
+ concurrency: params.options.concurrency,
1584
+ onProgress: params.onProgress
1585
+ }) : [];
1586
+ const finishedAt = Date.now();
1587
+ return {
1588
+ startedAt,
1589
+ finishedAt,
1590
+ durationMs: finishedAt - startedAt,
1591
+ totalTargets,
1592
+ options: params.options,
1593
+ results: [...plan.results, ...results]
1594
+ };
1595
+ }
1596
+ function formatProbeLatency(latencyMs) {
1597
+ if (!latencyMs && latencyMs !== 0) return "-";
1598
+ return formatMs(latencyMs);
1599
+ }
1600
+ function sortProbeResults(results) {
1601
+ return results.slice().toSorted((a, b) => {
1602
+ const provider = a.provider.localeCompare(b.provider);
1603
+ if (provider !== 0) return provider;
1604
+ const aLabel = a.label || a.profileId || "";
1605
+ const bLabel = b.label || b.profileId || "";
1606
+ return aLabel.localeCompare(bLabel);
1607
+ });
1608
+ }
1609
+ function describeProbeSummary(summary) {
1610
+ if (summary.totalTargets === 0) return "No probe targets.";
1611
+ return `Probed ${summary.totalTargets} target${summary.totalTargets === 1 ? "" : "s"} in ${formatMs(summary.durationMs)}`;
1612
+ }
1613
+ //#endregion
1614
+ //#region src/commands/models/list.status-command.ts
1615
+ async function modelsStatusCommand(opts, runtime) {
1616
+ ensureFlagCompatibility(opts);
1617
+ if (opts.plain && opts.probe) throw new Error("--probe cannot be used with --plain output.");
1618
+ const configPath = createConfigIO().configPath;
1619
+ const cfg = await loadModelsConfig({
1620
+ commandName: "models status",
1621
+ runtime
1622
+ });
1623
+ const agentId = resolveKnownAgentId({
1624
+ cfg,
1625
+ rawAgentId: opts.agent
1626
+ });
1627
+ const agentDir = agentId ? resolveAgentDir(cfg, agentId) : resolvemoldClawAgentDir();
1628
+ const agentModelPrimary = agentId ? resolveAgentExplicitModelPrimary(cfg, agentId) : void 0;
1629
+ const agentFallbacksOverride = agentId ? resolveAgentModelFallbacksOverride(cfg, agentId) : void 0;
1630
+ const resolved = agentId ? resolveDefaultModelForAgent({
1631
+ cfg,
1632
+ agentId
1633
+ }) : resolveConfiguredModelRef({
1634
+ cfg,
1635
+ defaultProvider: DEFAULT_PROVIDER,
1636
+ defaultModel: DEFAULT_MODEL
1637
+ });
1638
+ const rawDefaultsModel = resolveAgentModelPrimaryValue(cfg.agents?.defaults?.model) ?? "";
1639
+ const rawModel = agentModelPrimary ?? rawDefaultsModel;
1640
+ const resolvedLabel = `${resolved.provider}/${resolved.model}`;
1641
+ const defaultLabel = rawModel || resolvedLabel;
1642
+ const defaultsFallbacks = resolveAgentModelFallbackValues(cfg.agents?.defaults?.model);
1643
+ const fallbacks = agentFallbacksOverride ?? defaultsFallbacks;
1644
+ const imageModel = resolveAgentModelPrimaryValue(cfg.agents?.defaults?.imageModel) ?? "";
1645
+ const imageFallbacks = resolveAgentModelFallbackValues(cfg.agents?.defaults?.imageModel);
1646
+ const aliases = Object.entries(cfg.agents?.defaults?.models ?? {}).reduce((acc, [key, entry]) => {
1647
+ const alias = typeof entry?.alias === "string" ? entry.alias.trim() : void 0;
1648
+ if (alias) acc[alias] = key;
1649
+ return acc;
1650
+ }, {});
1651
+ const allowed = Object.keys(cfg.agents?.defaults?.models ?? {});
1652
+ const store = ensureAuthProfileStore(agentDir);
1653
+ const modelsPath = path.join(agentDir, "models.json");
1654
+ const providersFromStore = new Set(Object.values(store.profiles).map((profile) => profile.provider).filter((p) => Boolean(p)));
1655
+ const providersFromConfig = new Set(Object.keys(cfg.models?.providers ?? {}).map((p) => typeof p === "string" ? p.trim() : "").filter(Boolean));
1656
+ const providersFromModels = /* @__PURE__ */ new Set();
1657
+ const providersInUse = /* @__PURE__ */ new Set();
1658
+ for (const raw of [
1659
+ defaultLabel,
1660
+ ...fallbacks,
1661
+ imageModel,
1662
+ ...imageFallbacks,
1663
+ ...allowed
1664
+ ]) {
1665
+ const parsed = parseModelRef(String(raw ?? ""), DEFAULT_PROVIDER);
1666
+ if (parsed?.provider) providersFromModels.add(parsed.provider);
1667
+ }
1668
+ for (const raw of [
1669
+ defaultLabel,
1670
+ ...fallbacks,
1671
+ imageModel,
1672
+ ...imageFallbacks
1673
+ ]) {
1674
+ const parsed = parseModelRef(String(raw ?? ""), DEFAULT_PROVIDER);
1675
+ if (parsed?.provider) providersInUse.add(parsed.provider);
1676
+ }
1677
+ const providersFromEnv = /* @__PURE__ */ new Set();
1678
+ for (const provider of [
1679
+ "anthropic",
1680
+ "github-copilot",
1681
+ "google-vertex",
1682
+ "openai",
1683
+ "google",
1684
+ "groq",
1685
+ "cerebras",
1686
+ "xai",
1687
+ "openrouter",
1688
+ "zai",
1689
+ "mistral",
1690
+ "synthetic"
1691
+ ]) if (resolveEnvApiKey(provider)) providersFromEnv.add(provider);
1692
+ const providers = Array.from(new Set([
1693
+ ...providersFromStore,
1694
+ ...providersFromConfig,
1695
+ ...providersFromModels,
1696
+ ...providersFromEnv
1697
+ ])).map((p) => typeof p === "string" ? p.trim() : "").filter(Boolean).toSorted((a, b) => a.localeCompare(b));
1698
+ const applied = getShellEnvAppliedKeys();
1699
+ const shellFallbackEnabled = shouldEnableShellEnvFallback(process.env) || cfg.env?.shellEnv?.enabled === true;
1700
+ const providerAuth = providers.map((provider) => resolveProviderAuthOverview({
1701
+ provider,
1702
+ cfg,
1703
+ store,
1704
+ modelsPath
1705
+ })).filter((entry) => {
1706
+ return entry.profiles.count > 0 || Boolean(entry.env) || Boolean(entry.modelsJson);
1707
+ });
1708
+ const providerAuthMap = new Map(providerAuth.map((entry) => [entry.provider, entry]));
1709
+ const missingProvidersInUse = Array.from(providersInUse).filter((provider) => !providerAuthMap.has(provider)).toSorted((a, b) => a.localeCompare(b));
1710
+ const probeProfileIds = (() => {
1711
+ if (!opts.probeProfile) return [];
1712
+ return (Array.isArray(opts.probeProfile) ? opts.probeProfile : [opts.probeProfile]).flatMap((value) => String(value ?? "").split(",")).map((value) => value.trim()).filter(Boolean);
1713
+ })();
1714
+ const probeTimeoutMs = opts.probeTimeout ? Number(opts.probeTimeout) : 8e3;
1715
+ if (!Number.isFinite(probeTimeoutMs) || probeTimeoutMs <= 0) throw new Error("--probe-timeout must be a positive number (ms).");
1716
+ const probeConcurrency = opts.probeConcurrency ? Number(opts.probeConcurrency) : 2;
1717
+ if (!Number.isFinite(probeConcurrency) || probeConcurrency <= 0) throw new Error("--probe-concurrency must be > 0.");
1718
+ const probeMaxTokens = opts.probeMaxTokens ? Number(opts.probeMaxTokens) : 8;
1719
+ if (!Number.isFinite(probeMaxTokens) || probeMaxTokens <= 0) throw new Error("--probe-max-tokens must be > 0.");
1720
+ const aliasIndex = buildModelAliasIndex({
1721
+ cfg,
1722
+ defaultProvider: DEFAULT_PROVIDER
1723
+ });
1724
+ const modelCandidates = [
1725
+ rawModel || resolvedLabel,
1726
+ ...fallbacks,
1727
+ imageModel,
1728
+ ...imageFallbacks,
1729
+ ...allowed
1730
+ ].filter(Boolean).map((raw) => resolveModelRefFromString({
1731
+ raw: String(raw ?? ""),
1732
+ defaultProvider: DEFAULT_PROVIDER,
1733
+ aliasIndex
1734
+ })?.ref).filter((ref) => Boolean(ref)).map((ref) => `${ref.provider}/${ref.model}`);
1735
+ let probeSummary;
1736
+ if (opts.probe) probeSummary = await withProgressTotals({
1737
+ label: "Probing auth profiles…",
1738
+ total: 1
1739
+ }, async (update) => {
1740
+ return await runAuthProbes({
1741
+ cfg,
1742
+ providers,
1743
+ modelCandidates,
1744
+ options: {
1745
+ provider: opts.probeProvider,
1746
+ profileIds: probeProfileIds,
1747
+ timeoutMs: probeTimeoutMs,
1748
+ concurrency: probeConcurrency,
1749
+ maxTokens: probeMaxTokens
1750
+ },
1751
+ onProgress: update
1752
+ });
1753
+ });
1754
+ const providersWithOauth = providerAuth.filter((entry) => entry.profiles.oauth > 0 || entry.profiles.token > 0 || entry.env?.value === "OAuth (env)").map((entry) => {
1755
+ const count = entry.profiles.oauth + entry.profiles.token + (entry.env?.value === "OAuth (env)" ? 1 : 0);
1756
+ return `${entry.provider} (${count})`;
1757
+ });
1758
+ const authHealth = buildAuthHealthSummary({
1759
+ store,
1760
+ cfg,
1761
+ warnAfterMs: DEFAULT_OAUTH_WARN_MS,
1762
+ providers
1763
+ });
1764
+ const oauthProfiles = authHealth.profiles.filter((profile) => profile.type === "oauth" || profile.type === "token");
1765
+ const unusableProfiles = (() => {
1766
+ const now = Date.now();
1767
+ const out = [];
1768
+ for (const profileId of Object.keys(store.usageStats ?? {})) {
1769
+ const unusableUntil = resolveProfileUnusableUntilForDisplay(store, profileId);
1770
+ if (!unusableUntil || now >= unusableUntil) continue;
1771
+ const stats = store.usageStats?.[profileId];
1772
+ const kind = typeof stats?.disabledUntil === "number" && now < stats.disabledUntil ? "disabled" : "cooldown";
1773
+ out.push({
1774
+ profileId,
1775
+ provider: store.profiles[profileId]?.provider,
1776
+ kind,
1777
+ reason: stats?.disabledReason,
1778
+ until: unusableUntil,
1779
+ remainingMs: unusableUntil - now
1780
+ });
1781
+ }
1782
+ return out.toSorted((a, b) => a.remainingMs - b.remainingMs);
1783
+ })();
1784
+ const checkStatus = (() => {
1785
+ const hasExpiredOrMissing = oauthProfiles.some((profile) => ["expired", "missing"].includes(profile.status)) || missingProvidersInUse.length > 0;
1786
+ const hasExpiring = oauthProfiles.some((profile) => profile.status === "expiring");
1787
+ if (hasExpiredOrMissing) return 1;
1788
+ if (hasExpiring) return 2;
1789
+ return 0;
1790
+ })();
1791
+ if (opts.json) {
1792
+ runtime.log(JSON.stringify({
1793
+ configPath,
1794
+ ...agentId ? { agentId } : {},
1795
+ agentDir,
1796
+ defaultModel: defaultLabel,
1797
+ resolvedDefault: resolvedLabel,
1798
+ fallbacks,
1799
+ imageModel: imageModel || null,
1800
+ imageFallbacks,
1801
+ ...agentId ? { modelConfig: {
1802
+ defaultSource: agentModelPrimary ? "agent" : "defaults",
1803
+ fallbacksSource: agentFallbacksOverride !== void 0 ? "agent" : "defaults"
1804
+ } } : {},
1805
+ aliases,
1806
+ allowed,
1807
+ auth: {
1808
+ storePath: resolveAuthStorePathForDisplay(agentDir),
1809
+ shellEnvFallback: {
1810
+ enabled: shellFallbackEnabled,
1811
+ appliedKeys: applied
1812
+ },
1813
+ providersWithOAuth: providersWithOauth,
1814
+ missingProvidersInUse,
1815
+ providers: providerAuth,
1816
+ unusableProfiles,
1817
+ oauth: {
1818
+ warnAfterMs: authHealth.warnAfterMs,
1819
+ profiles: authHealth.profiles,
1820
+ providers: authHealth.providers
1821
+ },
1822
+ probes: probeSummary
1823
+ }
1824
+ }, null, 2));
1825
+ if (opts.check) runtime.exit(checkStatus);
1826
+ return;
1827
+ }
1828
+ if (opts.plain) {
1829
+ runtime.log(resolvedLabel);
1830
+ if (opts.check) runtime.exit(checkStatus);
1831
+ return;
1832
+ }
1833
+ const rich = isRich(opts);
1834
+ const label = (value) => colorize(rich, theme.accent, value.padEnd(14));
1835
+ const labelWithSource = (value, source) => label(source ? `${value} (${source})` : value);
1836
+ const displayDefault = rawModel && rawModel !== resolvedLabel ? `${resolvedLabel} (from ${rawModel})` : resolvedLabel;
1837
+ runtime.log(`${label("Config")}${colorize(rich, theme.muted, ":")} ${colorize(rich, theme.info, shortenHomePath(configPath))}`);
1838
+ runtime.log(`${label("Agent dir")}${colorize(rich, theme.muted, ":")} ${colorize(rich, theme.info, shortenHomePath(agentDir))}`);
1839
+ runtime.log(`${labelWithSource("Default", agentId ? agentModelPrimary ? "agent" : "defaults" : void 0)}${colorize(rich, theme.muted, ":")} ${colorize(rich, theme.success, displayDefault)}`);
1840
+ runtime.log(`${labelWithSource(`Fallbacks (${fallbacks.length || 0})`, agentId ? agentFallbacksOverride !== void 0 ? "agent" : "defaults" : void 0)}${colorize(rich, theme.muted, ":")} ${colorize(rich, fallbacks.length ? theme.warn : theme.muted, fallbacks.length ? fallbacks.join(", ") : "-")}`);
1841
+ runtime.log(`${labelWithSource("Image model", agentId ? "defaults" : void 0)}${colorize(rich, theme.muted, ":")} ${colorize(rich, imageModel ? theme.accentBright : theme.muted, imageModel || "-")}`);
1842
+ runtime.log(`${labelWithSource(`Image fallbacks (${imageFallbacks.length || 0})`, agentId ? "defaults" : void 0)}${colorize(rich, theme.muted, ":")} ${colorize(rich, imageFallbacks.length ? theme.accentBright : theme.muted, imageFallbacks.length ? imageFallbacks.join(", ") : "-")}`);
1843
+ runtime.log(`${label(`Aliases (${Object.keys(aliases).length || 0})`)}${colorize(rich, theme.muted, ":")} ${colorize(rich, Object.keys(aliases).length ? theme.accent : theme.muted, Object.keys(aliases).length ? Object.entries(aliases).map(([alias, target]) => rich ? `${theme.accentDim(alias)} ${theme.muted("->")} ${theme.info(target)}` : `${alias} -> ${target}`).join(", ") : "-")}`);
1844
+ runtime.log(`${label(`Configured models (${allowed.length || 0})`)}${colorize(rich, theme.muted, ":")} ${colorize(rich, allowed.length ? theme.info : theme.muted, allowed.length ? allowed.join(", ") : "all")}`);
1845
+ runtime.log("");
1846
+ runtime.log(colorize(rich, theme.heading, "Auth overview"));
1847
+ runtime.log(`${label("Auth store")}${colorize(rich, theme.muted, ":")} ${colorize(rich, theme.info, shortenHomePath(resolveAuthStorePathForDisplay(agentDir)))}`);
1848
+ runtime.log(`${label("Shell env")}${colorize(rich, theme.muted, ":")} ${colorize(rich, shellFallbackEnabled ? theme.success : theme.muted, shellFallbackEnabled ? "on" : "off")}${applied.length ? colorize(rich, theme.muted, ` (applied: ${applied.join(", ")})`) : ""}`);
1849
+ runtime.log(`${label(`Providers w/ OAuth/tokens (${providersWithOauth.length || 0})`)}${colorize(rich, theme.muted, ":")} ${colorize(rich, providersWithOauth.length ? theme.info : theme.muted, providersWithOauth.length ? providersWithOauth.join(", ") : "-")}`);
1850
+ const formatKey = (key) => colorize(rich, theme.warn, key);
1851
+ const formatKeyValue = (key, value) => `${formatKey(key)}=${colorize(rich, theme.info, value)}`;
1852
+ const formatSeparator = () => colorize(rich, theme.muted, " | ");
1853
+ for (const entry of providerAuth) {
1854
+ const separator = formatSeparator();
1855
+ const bits = [];
1856
+ bits.push(formatKeyValue("effective", `${colorize(rich, theme.accentBright, entry.effective.kind)}:${colorize(rich, theme.muted, entry.effective.detail)}`));
1857
+ if (entry.profiles.count > 0) {
1858
+ bits.push(formatKeyValue("profiles", `${entry.profiles.count} (oauth=${entry.profiles.oauth}, token=${entry.profiles.token}, api_key=${entry.profiles.apiKey})`));
1859
+ if (entry.profiles.labels.length > 0) bits.push(colorize(rich, theme.info, entry.profiles.labels.join(", ")));
1860
+ }
1861
+ if (entry.env) bits.push(formatKeyValue("env", `${entry.env.value}${separator}${formatKeyValue("source", entry.env.source)}`));
1862
+ if (entry.modelsJson) bits.push(formatKeyValue("models.json", `${entry.modelsJson.value}${separator}${formatKeyValue("source", entry.modelsJson.source)}`));
1863
+ runtime.log(`- ${theme.heading(entry.provider)} ${bits.join(separator)}`);
1864
+ }
1865
+ if (missingProvidersInUse.length > 0) {
1866
+ runtime.log("");
1867
+ runtime.log(colorize(rich, theme.heading, "Missing auth"));
1868
+ for (const provider of missingProvidersInUse) {
1869
+ const hint = buildProviderAuthRecoveryHint({
1870
+ provider,
1871
+ config: cfg,
1872
+ includeEnvVar: true
1873
+ });
1874
+ runtime.log(`- ${theme.heading(provider)} ${hint}`);
1875
+ }
1876
+ }
1877
+ runtime.log("");
1878
+ runtime.log(colorize(rich, theme.heading, "OAuth/token status"));
1879
+ if (oauthProfiles.length === 0) runtime.log(colorize(rich, theme.muted, "- none"));
1880
+ else {
1881
+ const usageByProvider = /* @__PURE__ */ new Map();
1882
+ const usageProviders = Array.from(new Set(oauthProfiles.map((profile) => resolveUsageProviderId(profile.provider)).filter((provider) => Boolean(provider))));
1883
+ if (usageProviders.length > 0) try {
1884
+ const usageSummary = await loadProviderUsageSummary({
1885
+ providers: usageProviders,
1886
+ agentDir,
1887
+ timeoutMs: 3500
1888
+ });
1889
+ for (const snapshot of usageSummary.providers) {
1890
+ const formatted = formatUsageWindowSummary(snapshot, {
1891
+ now: Date.now(),
1892
+ maxWindows: 2,
1893
+ includeResets: true
1894
+ });
1895
+ if (formatted) usageByProvider.set(snapshot.provider, formatted);
1896
+ }
1897
+ } catch {}
1898
+ const formatStatus = (status) => {
1899
+ if (status === "ok") return colorize(rich, theme.success, "ok");
1900
+ if (status === "static") return colorize(rich, theme.muted, "static");
1901
+ if (status === "expiring") return colorize(rich, theme.warn, "expiring");
1902
+ if (status === "missing") return colorize(rich, theme.warn, "unknown");
1903
+ return colorize(rich, theme.error, "expired");
1904
+ };
1905
+ const profilesByProvider = /* @__PURE__ */ new Map();
1906
+ for (const profile of oauthProfiles) {
1907
+ const current = profilesByProvider.get(profile.provider);
1908
+ if (current) current.push(profile);
1909
+ else profilesByProvider.set(profile.provider, [profile]);
1910
+ }
1911
+ for (const [provider, profiles] of profilesByProvider) {
1912
+ const usageKey = resolveUsageProviderId(provider);
1913
+ const usage = usageKey ? usageByProvider.get(usageKey) : void 0;
1914
+ const usageSuffix = usage ? colorize(rich, theme.muted, ` usage: ${usage}`) : "";
1915
+ runtime.log(`- ${colorize(rich, theme.heading, provider)}${usageSuffix}`);
1916
+ for (const profile of profiles) {
1917
+ const labelText = profile.label || profile.profileId;
1918
+ const label = colorize(rich, theme.accent, labelText);
1919
+ const status = formatStatus(profile.status);
1920
+ const expiry = profile.status === "static" ? "" : profile.expiresAt ? ` expires in ${formatRemainingShort(profile.remainingMs)}` : " expires unknown";
1921
+ runtime.log(` - ${label} ${status}${expiry}`);
1922
+ }
1923
+ }
1924
+ }
1925
+ if (probeSummary) {
1926
+ runtime.log("");
1927
+ runtime.log(colorize(rich, theme.heading, "Auth probes"));
1928
+ if (probeSummary.results.length === 0) runtime.log(colorize(rich, theme.muted, "- none"));
1929
+ else {
1930
+ const tableWidth = getTerminalTableWidth();
1931
+ const sorted = sortProbeResults(probeSummary.results);
1932
+ const statusColor = (status) => {
1933
+ if (status === "ok") return theme.success;
1934
+ if (status === "rate_limit") return theme.warn;
1935
+ if (status === "timeout" || status === "billing") return theme.warn;
1936
+ if (status === "auth" || status === "format") return theme.error;
1937
+ if (status === "no_model") return theme.muted;
1938
+ return theme.muted;
1939
+ };
1940
+ const rows = sorted.map((result) => {
1941
+ const status = colorize(rich, statusColor(result.status), result.status);
1942
+ const latency = formatProbeLatency(result.latencyMs);
1943
+ const modelLabel = result.model ?? `${result.provider}/-`;
1944
+ const modeLabel = result.mode ? ` ${colorize(rich, theme.muted, `(${result.mode})`)}` : "";
1945
+ const profile = `${colorize(rich, theme.accent, result.label)}${modeLabel}`;
1946
+ const detail = result.error?.trim();
1947
+ const detailLabel = detail ? `\n${colorize(rich, theme.muted, `↳ ${detail}`)}` : "";
1948
+ const statusLabel = `${status}${colorize(rich, theme.muted, ` · ${latency}`)}${detailLabel}`;
1949
+ return {
1950
+ Model: colorize(rich, theme.heading, modelLabel),
1951
+ Profile: profile,
1952
+ Status: statusLabel
1953
+ };
1954
+ });
1955
+ runtime.log(renderTable({
1956
+ width: tableWidth,
1957
+ columns: [
1958
+ {
1959
+ key: "Model",
1960
+ header: "Model",
1961
+ minWidth: 18
1962
+ },
1963
+ {
1964
+ key: "Profile",
1965
+ header: "Profile",
1966
+ minWidth: 24
1967
+ },
1968
+ {
1969
+ key: "Status",
1970
+ header: "Status",
1971
+ minWidth: 12
1972
+ }
1973
+ ],
1974
+ rows
1975
+ }).trimEnd());
1976
+ runtime.log(colorize(rich, theme.muted, describeProbeSummary(probeSummary)));
1977
+ }
1978
+ }
1979
+ if (opts.check) runtime.exit(checkStatus);
1980
+ }
1981
+ //#endregion
1982
+ //#region src/agents/model-scan.ts
1983
+ const OPENROUTER_MODELS_URL = "https://openrouter.ai/api/v1/models";
1984
+ const DEFAULT_TIMEOUT_MS = 12e3;
1985
+ const DEFAULT_CONCURRENCY = 3;
1986
+ const BASE_IMAGE_PNG = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+X3mIAAAAASUVORK5CYII=";
1987
+ const TOOL_PING = {
1988
+ name: "ping",
1989
+ description: "Return OK.",
1990
+ parameters: Type.Object({})
1991
+ };
1992
+ function normalizeCreatedAtMs(value) {
1993
+ if (typeof value !== "number" || !Number.isFinite(value)) return null;
1994
+ if (value <= 0) return null;
1995
+ if (value > 0xe8d4a51000) return Math.round(value);
1996
+ return Math.round(value * 1e3);
1997
+ }
1998
+ function parseModality(modality) {
1999
+ if (!modality) return ["text"];
2000
+ return modality.toLowerCase().split(/[^a-z]+/).filter(Boolean).includes("image") ? ["text", "image"] : ["text"];
2001
+ }
2002
+ function parseNumberString(value) {
2003
+ if (typeof value === "number" && Number.isFinite(value)) return value;
2004
+ if (typeof value !== "string") return null;
2005
+ const trimmed = value.trim();
2006
+ if (!trimmed) return null;
2007
+ const num = Number(trimmed);
2008
+ if (!Number.isFinite(num)) return null;
2009
+ return num;
2010
+ }
2011
+ function parseOpenRouterPricing(value) {
2012
+ if (!value || typeof value !== "object") return null;
2013
+ const obj = value;
2014
+ const prompt = parseNumberString(obj.prompt);
2015
+ const completion = parseNumberString(obj.completion);
2016
+ const request = parseNumberString(obj.request) ?? 0;
2017
+ const image = parseNumberString(obj.image) ?? 0;
2018
+ const webSearch = parseNumberString(obj.web_search) ?? 0;
2019
+ const internalReasoning = parseNumberString(obj.internal_reasoning) ?? 0;
2020
+ if (prompt === null || completion === null) return null;
2021
+ return {
2022
+ prompt,
2023
+ completion,
2024
+ request,
2025
+ image,
2026
+ webSearch,
2027
+ internalReasoning
2028
+ };
2029
+ }
2030
+ function isFreeOpenRouterModel(entry) {
2031
+ if (entry.id.endsWith(":free")) return true;
2032
+ if (!entry.pricing) return false;
2033
+ return entry.pricing.prompt === 0 && entry.pricing.completion === 0;
2034
+ }
2035
+ async function withTimeout(timeoutMs, fn) {
2036
+ const controller = new AbortController();
2037
+ const timer = setTimeout(controller.abort.bind(controller), timeoutMs);
2038
+ try {
2039
+ return await fn(controller.signal);
2040
+ } finally {
2041
+ clearTimeout(timer);
2042
+ }
2043
+ }
2044
+ async function fetchOpenRouterModels(fetchImpl) {
2045
+ const res = await fetchImpl(OPENROUTER_MODELS_URL, { headers: { Accept: "application/json" } });
2046
+ if (!res.ok) throw new Error(`OpenRouter /models failed: HTTP ${res.status}`);
2047
+ const payload = await res.json();
2048
+ return (Array.isArray(payload.data) ? payload.data : []).map((entry) => {
2049
+ if (!entry || typeof entry !== "object") return null;
2050
+ const obj = entry;
2051
+ const id = typeof obj.id === "string" ? obj.id.trim() : "";
2052
+ if (!id) return null;
2053
+ const name = typeof obj.name === "string" && obj.name.trim() ? obj.name.trim() : id;
2054
+ const contextLength = typeof obj.context_length === "number" && Number.isFinite(obj.context_length) ? obj.context_length : null;
2055
+ const maxCompletionTokens = typeof obj.max_completion_tokens === "number" && Number.isFinite(obj.max_completion_tokens) ? obj.max_completion_tokens : typeof obj.max_output_tokens === "number" && Number.isFinite(obj.max_output_tokens) ? obj.max_output_tokens : null;
2056
+ const supportedParameters = Array.isArray(obj.supported_parameters) ? obj.supported_parameters.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean) : [];
2057
+ return {
2058
+ id,
2059
+ name,
2060
+ contextLength,
2061
+ maxCompletionTokens,
2062
+ supportedParameters,
2063
+ supportedParametersCount: supportedParameters.length,
2064
+ supportsToolsMeta: supportedParameters.includes("tools"),
2065
+ modality: typeof obj.modality === "string" && obj.modality.trim() ? obj.modality.trim() : null,
2066
+ inferredParamB: inferParamBFromIdOrName(`${id} ${name}`),
2067
+ createdAtMs: normalizeCreatedAtMs(obj.created_at),
2068
+ pricing: parseOpenRouterPricing(obj.pricing)
2069
+ };
2070
+ }).filter((entry) => Boolean(entry));
2071
+ }
2072
+ async function probeTool(model, apiKey, timeoutMs) {
2073
+ const context = {
2074
+ messages: [{
2075
+ role: "user",
2076
+ content: "Call the ping tool with {} and nothing else.",
2077
+ timestamp: Date.now()
2078
+ }],
2079
+ tools: [TOOL_PING]
2080
+ };
2081
+ const startedAt = Date.now();
2082
+ try {
2083
+ if (!(await withTimeout(timeoutMs, (signal) => complete(model, context, {
2084
+ apiKey,
2085
+ maxTokens: 256,
2086
+ temperature: 0,
2087
+ toolChoice: "required",
2088
+ signal
2089
+ }))).content.some((block) => block.type === "toolCall")) return {
2090
+ ok: false,
2091
+ latencyMs: Date.now() - startedAt,
2092
+ error: "No tool call returned"
2093
+ };
2094
+ return {
2095
+ ok: true,
2096
+ latencyMs: Date.now() - startedAt
2097
+ };
2098
+ } catch (err) {
2099
+ return {
2100
+ ok: false,
2101
+ latencyMs: Date.now() - startedAt,
2102
+ error: err instanceof Error ? err.message : String(err)
2103
+ };
2104
+ }
2105
+ }
2106
+ async function probeImage(model, apiKey, timeoutMs) {
2107
+ const context = { messages: [{
2108
+ role: "user",
2109
+ content: [{
2110
+ type: "text",
2111
+ text: "Reply with OK."
2112
+ }, {
2113
+ type: "image",
2114
+ data: BASE_IMAGE_PNG,
2115
+ mimeType: "image/png"
2116
+ }],
2117
+ timestamp: Date.now()
2118
+ }] };
2119
+ const startedAt = Date.now();
2120
+ try {
2121
+ await withTimeout(timeoutMs, (signal) => complete(model, context, {
2122
+ apiKey,
2123
+ maxTokens: 16,
2124
+ temperature: 0,
2125
+ signal
2126
+ }));
2127
+ return {
2128
+ ok: true,
2129
+ latencyMs: Date.now() - startedAt
2130
+ };
2131
+ } catch (err) {
2132
+ return {
2133
+ ok: false,
2134
+ latencyMs: Date.now() - startedAt,
2135
+ error: err instanceof Error ? err.message : String(err)
2136
+ };
2137
+ }
2138
+ }
2139
+ function ensureImageInput(model) {
2140
+ if (model.input?.includes("image")) return model;
2141
+ return {
2142
+ ...model,
2143
+ input: Array.from(new Set([...model.input ?? [], "image"]))
2144
+ };
2145
+ }
2146
+ function buildOpenRouterScanResult(params) {
2147
+ const { entry, isFree } = params;
2148
+ return {
2149
+ id: entry.id,
2150
+ name: entry.name,
2151
+ provider: "openrouter",
2152
+ modelRef: `openrouter/${entry.id}`,
2153
+ contextLength: entry.contextLength,
2154
+ maxCompletionTokens: entry.maxCompletionTokens,
2155
+ supportedParametersCount: entry.supportedParametersCount,
2156
+ supportsToolsMeta: entry.supportsToolsMeta,
2157
+ modality: entry.modality,
2158
+ inferredParamB: entry.inferredParamB,
2159
+ createdAtMs: entry.createdAtMs,
2160
+ pricing: entry.pricing,
2161
+ isFree,
2162
+ tool: params.tool,
2163
+ image: params.image
2164
+ };
2165
+ }
2166
+ async function mapWithConcurrency(items, concurrency, fn, opts) {
2167
+ const limit = Math.max(1, Math.floor(concurrency));
2168
+ const results = Array.from({ length: items.length }, () => void 0);
2169
+ let nextIndex = 0;
2170
+ let completed = 0;
2171
+ const worker = async () => {
2172
+ while (true) {
2173
+ const current = nextIndex;
2174
+ nextIndex += 1;
2175
+ if (current >= items.length) return;
2176
+ results[current] = await fn(items[current], current);
2177
+ completed += 1;
2178
+ opts?.onProgress?.(completed, items.length);
2179
+ }
2180
+ };
2181
+ if (items.length === 0) {
2182
+ opts?.onProgress?.(0, 0);
2183
+ return results;
2184
+ }
2185
+ await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()));
2186
+ return results;
2187
+ }
2188
+ async function scanOpenRouterModels(options = {}) {
2189
+ const fetchImpl = options.fetchImpl ?? fetch;
2190
+ const probe = options.probe ?? true;
2191
+ const apiKey = options.apiKey?.trim() || getEnvApiKey("openrouter") || "";
2192
+ if (probe && !apiKey) throw new Error("Missing OpenRouter API key. Set OPENROUTER_API_KEY to run models scan.");
2193
+ const timeoutMs = Math.max(1, Math.floor(options.timeoutMs ?? DEFAULT_TIMEOUT_MS));
2194
+ const concurrency = Math.max(1, Math.floor(options.concurrency ?? DEFAULT_CONCURRENCY));
2195
+ const minParamB = Math.max(0, Math.floor(options.minParamB ?? 0));
2196
+ const maxAgeDays = Math.max(0, Math.floor(options.maxAgeDays ?? 0));
2197
+ const providerFilter = options.providerFilter?.trim().toLowerCase() ?? "";
2198
+ const catalog = await fetchOpenRouterModels(fetchImpl);
2199
+ const now = Date.now();
2200
+ const filtered = catalog.filter((entry) => {
2201
+ if (!isFreeOpenRouterModel(entry)) return false;
2202
+ if (providerFilter) {
2203
+ if ((entry.id.split("/")[0]?.toLowerCase() ?? "") !== providerFilter) return false;
2204
+ }
2205
+ if (minParamB > 0) {
2206
+ if ((entry.inferredParamB ?? 0) < minParamB) return false;
2207
+ }
2208
+ if (maxAgeDays > 0 && entry.createdAtMs) {
2209
+ if ((now - entry.createdAtMs) / (1440 * 60 * 1e3) > maxAgeDays) return false;
2210
+ }
2211
+ return true;
2212
+ });
2213
+ const baseModel = getModel("openrouter", "openrouter/auto");
2214
+ options.onProgress?.({
2215
+ phase: "probe",
2216
+ completed: 0,
2217
+ total: filtered.length
2218
+ });
2219
+ return mapWithConcurrency(filtered, concurrency, async (entry) => {
2220
+ const isFree = isFreeOpenRouterModel(entry);
2221
+ if (!probe) return buildOpenRouterScanResult({
2222
+ entry,
2223
+ isFree,
2224
+ tool: {
2225
+ ok: false,
2226
+ latencyMs: null,
2227
+ skipped: true
2228
+ },
2229
+ image: {
2230
+ ok: false,
2231
+ latencyMs: null,
2232
+ skipped: true
2233
+ }
2234
+ });
2235
+ const model = {
2236
+ ...baseModel,
2237
+ id: entry.id,
2238
+ name: entry.name || entry.id,
2239
+ contextWindow: entry.contextLength ?? baseModel.contextWindow,
2240
+ maxTokens: entry.maxCompletionTokens ?? baseModel.maxTokens,
2241
+ input: parseModality(entry.modality),
2242
+ reasoning: baseModel.reasoning
2243
+ };
2244
+ return buildOpenRouterScanResult({
2245
+ entry,
2246
+ isFree,
2247
+ tool: await probeTool(model, apiKey, timeoutMs),
2248
+ image: model.input?.includes("image") ? await probeImage(ensureImageInput(model), apiKey, timeoutMs) : {
2249
+ ok: false,
2250
+ latencyMs: null,
2251
+ skipped: true
2252
+ }
2253
+ });
2254
+ }, { onProgress: (completed, total) => options.onProgress?.({
2255
+ phase: "probe",
2256
+ completed,
2257
+ total
2258
+ }) });
2259
+ }
2260
+ //#endregion
2261
+ //#region src/commands/models/scan.ts
2262
+ const MODEL_PAD = 42;
2263
+ const CTX_PAD = 8;
2264
+ const multiselect$1 = (params) => multiselect({
2265
+ ...params,
2266
+ message: stylePromptMessage(params.message),
2267
+ options: params.options.map((opt) => opt.hint === void 0 ? opt : {
2268
+ ...opt,
2269
+ hint: stylePromptHint(opt.hint)
2270
+ })
2271
+ });
2272
+ function guardPromptCancel(value, runtime) {
2273
+ if (isCancel(value)) {
2274
+ cancel(stylePromptTitle("Model scan cancelled.") ?? "Model scan cancelled.");
2275
+ runtime.exit(0);
2276
+ throw new Error("unreachable");
2277
+ }
2278
+ return value;
2279
+ }
2280
+ function sortScanResults(results) {
2281
+ return results.slice().toSorted((a, b) => {
2282
+ const aImage = a.image.ok ? 1 : 0;
2283
+ const bImage = b.image.ok ? 1 : 0;
2284
+ if (aImage !== bImage) return bImage - aImage;
2285
+ const aToolLatency = a.tool.latencyMs ?? Number.POSITIVE_INFINITY;
2286
+ const bToolLatency = b.tool.latencyMs ?? Number.POSITIVE_INFINITY;
2287
+ if (aToolLatency !== bToolLatency) return aToolLatency - bToolLatency;
2288
+ return compareScanMetadata(a, b);
2289
+ });
2290
+ }
2291
+ function sortImageResults(results) {
2292
+ return results.slice().toSorted((a, b) => {
2293
+ const aLatency = a.image.latencyMs ?? Number.POSITIVE_INFINITY;
2294
+ const bLatency = b.image.latencyMs ?? Number.POSITIVE_INFINITY;
2295
+ if (aLatency !== bLatency) return aLatency - bLatency;
2296
+ return compareScanMetadata(a, b);
2297
+ });
2298
+ }
2299
+ function compareScanMetadata(a, b) {
2300
+ const aCtx = a.contextLength ?? 0;
2301
+ const bCtx = b.contextLength ?? 0;
2302
+ if (aCtx !== bCtx) return bCtx - aCtx;
2303
+ const aParams = a.inferredParamB ?? 0;
2304
+ const bParams = b.inferredParamB ?? 0;
2305
+ if (aParams !== bParams) return bParams - aParams;
2306
+ return a.modelRef.localeCompare(b.modelRef);
2307
+ }
2308
+ function buildScanHint(result) {
2309
+ return [
2310
+ result.tool.ok ? `tool ${formatMs(result.tool.latencyMs)}` : "tool fail",
2311
+ result.image.skipped ? "img skip" : result.image.ok ? `img ${formatMs(result.image.latencyMs)}` : "img fail",
2312
+ result.contextLength ? `ctx ${formatTokenK(result.contextLength)}` : "ctx ?",
2313
+ result.inferredParamB ? `${result.inferredParamB}b` : null
2314
+ ].filter(Boolean).join(" | ");
2315
+ }
2316
+ function printScanSummary(results, runtime) {
2317
+ const toolOk = results.filter((r) => r.tool.ok);
2318
+ const imageOk = results.filter((r) => r.image.ok);
2319
+ const toolImageOk = results.filter((r) => r.tool.ok && r.image.ok);
2320
+ const imageOnly = imageOk.filter((r) => !r.tool.ok);
2321
+ runtime.log(`Scan results: tested ${results.length}, tool ok ${toolOk.length}, image ok ${imageOk.length}, tool+image ok ${toolImageOk.length}, image only ${imageOnly.length}`);
2322
+ }
2323
+ function printScanTable(results, runtime) {
2324
+ const header = [
2325
+ pad("Model", MODEL_PAD),
2326
+ pad("Tool", 10),
2327
+ pad("Image", 10),
2328
+ pad("Ctx", CTX_PAD),
2329
+ pad("Params", 8),
2330
+ "Notes"
2331
+ ].join(" ");
2332
+ runtime.log(header);
2333
+ for (const entry of results) {
2334
+ const modelLabel = pad(truncate(entry.modelRef, MODEL_PAD), MODEL_PAD);
2335
+ const toolLabel = pad(entry.tool.ok ? formatMs(entry.tool.latencyMs) : "fail", 10);
2336
+ const imageLabel = pad(entry.image.ok ? formatMs(entry.image.latencyMs) : entry.image.skipped ? "skip" : "fail", 10);
2337
+ const ctxLabel = pad(formatTokenK(entry.contextLength), CTX_PAD);
2338
+ const paramsLabel = pad(entry.inferredParamB ? `${entry.inferredParamB}b` : "-", 8);
2339
+ const notes = entry.modality ? `modality:${entry.modality}` : "";
2340
+ runtime.log([
2341
+ modelLabel,
2342
+ toolLabel,
2343
+ imageLabel,
2344
+ ctxLabel,
2345
+ paramsLabel,
2346
+ notes
2347
+ ].join(" "));
2348
+ }
2349
+ }
2350
+ async function modelsScanCommand(opts, runtime) {
2351
+ const minParams = opts.minParams ? Number(opts.minParams) : void 0;
2352
+ if (minParams !== void 0 && (!Number.isFinite(minParams) || minParams < 0)) throw new Error("--min-params must be >= 0");
2353
+ const maxAgeDays = opts.maxAgeDays ? Number(opts.maxAgeDays) : void 0;
2354
+ if (maxAgeDays !== void 0 && (!Number.isFinite(maxAgeDays) || maxAgeDays < 0)) throw new Error("--max-age-days must be >= 0");
2355
+ const maxCandidates = opts.maxCandidates ? Number(opts.maxCandidates) : 6;
2356
+ if (!Number.isFinite(maxCandidates) || maxCandidates <= 0) throw new Error("--max-candidates must be > 0");
2357
+ const timeout = opts.timeout ? Number(opts.timeout) : void 0;
2358
+ if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout <= 0)) throw new Error("--timeout must be > 0");
2359
+ const concurrency = opts.concurrency ? Number(opts.concurrency) : void 0;
2360
+ if (concurrency !== void 0 && (!Number.isFinite(concurrency) || concurrency <= 0)) throw new Error("--concurrency must be > 0");
2361
+ const cfg = await loadModelsConfig({
2362
+ commandName: "models scan",
2363
+ runtime
2364
+ });
2365
+ const probe = opts.probe ?? true;
2366
+ let storedKey;
2367
+ if (probe) try {
2368
+ storedKey = (await resolveApiKeyForProvider({
2369
+ provider: "openrouter",
2370
+ cfg
2371
+ })).apiKey;
2372
+ } catch {
2373
+ storedKey = void 0;
2374
+ }
2375
+ const results = await withProgressTotals({
2376
+ label: "Scanning OpenRouter models...",
2377
+ indeterminate: false,
2378
+ enabled: opts.json !== true
2379
+ }, async (update) => await scanOpenRouterModels({
2380
+ apiKey: storedKey ?? void 0,
2381
+ minParamB: minParams,
2382
+ maxAgeDays,
2383
+ providerFilter: opts.provider,
2384
+ timeoutMs: timeout,
2385
+ concurrency,
2386
+ probe,
2387
+ onProgress: ({ phase, completed, total }) => {
2388
+ if (phase !== "probe") return;
2389
+ update({
2390
+ completed,
2391
+ total,
2392
+ label: `${probe ? "Probing models" : "Scanning models"} (${completed}/${total})`
2393
+ });
2394
+ }
2395
+ }));
2396
+ if (!probe) {
2397
+ if (!opts.json) {
2398
+ runtime.log(`Found ${results.length} OpenRouter free models (metadata only; pass --probe to test tools/images).`);
2399
+ printScanTable(sortScanResults(results), runtime);
2400
+ } else runtime.log(JSON.stringify(results, null, 2));
2401
+ return;
2402
+ }
2403
+ const toolOk = results.filter((entry) => entry.tool.ok);
2404
+ if (toolOk.length === 0) throw new Error("No tool-capable OpenRouter free models found.");
2405
+ const sorted = sortScanResults(results);
2406
+ const toolSorted = sortScanResults(toolOk);
2407
+ const imageSorted = sortImageResults(results.filter((entry) => entry.image.ok));
2408
+ const imagePreferred = toolSorted.filter((entry) => entry.image.ok);
2409
+ const preselected = (imagePreferred.length > 0 ? imagePreferred : toolSorted).slice(0, Math.floor(maxCandidates)).map((entry) => entry.modelRef);
2410
+ const imagePreselected = imageSorted.slice(0, Math.floor(maxCandidates)).map((entry) => entry.modelRef);
2411
+ if (!opts.json) {
2412
+ printScanSummary(results, runtime);
2413
+ printScanTable(sorted, runtime);
2414
+ }
2415
+ const noInput = opts.input === false;
2416
+ const canPrompt = process.stdin.isTTY && !opts.yes && !noInput && !opts.json;
2417
+ let selected = preselected;
2418
+ let selectedImages = imagePreselected;
2419
+ if (canPrompt) {
2420
+ selected = guardPromptCancel(await multiselect$1({
2421
+ message: "Select fallback models (ordered)",
2422
+ options: toolSorted.map((entry) => ({
2423
+ value: entry.modelRef,
2424
+ label: entry.modelRef,
2425
+ hint: buildScanHint(entry)
2426
+ })),
2427
+ initialValues: preselected
2428
+ }), runtime);
2429
+ if (imageSorted.length > 0) selectedImages = guardPromptCancel(await multiselect$1({
2430
+ message: "Select image fallback models (ordered)",
2431
+ options: imageSorted.map((entry) => ({
2432
+ value: entry.modelRef,
2433
+ label: entry.modelRef,
2434
+ hint: buildScanHint(entry)
2435
+ })),
2436
+ initialValues: imagePreselected
2437
+ }), runtime);
2438
+ } else if (!process.stdin.isTTY && !opts.yes && !noInput && !opts.json) throw new Error("Non-interactive scan: pass --yes to apply defaults.");
2439
+ if (selected.length === 0) throw new Error("No models selected for fallbacks.");
2440
+ if (opts.setImage && selectedImages.length === 0) throw new Error("No image-capable models selected for image model.");
2441
+ await updateConfig((cfg) => {
2442
+ const nextModels = { ...cfg.agents?.defaults?.models };
2443
+ for (const entry of selected) if (!nextModels[entry]) nextModels[entry] = {};
2444
+ for (const entry of selectedImages) if (!nextModels[entry]) nextModels[entry] = {};
2445
+ const existingImageModel = toAgentModelListLike(cfg.agents?.defaults?.imageModel);
2446
+ const nextImageModel = selectedImages.length > 0 ? {
2447
+ ...existingImageModel?.primary ? { primary: existingImageModel.primary } : void 0,
2448
+ fallbacks: selectedImages,
2449
+ ...opts.setImage ? { primary: selectedImages[0] } : {}
2450
+ } : cfg.agents?.defaults?.imageModel;
2451
+ const existingModel = toAgentModelListLike(cfg.agents?.defaults?.model);
2452
+ const defaults = {
2453
+ ...cfg.agents?.defaults,
2454
+ model: {
2455
+ ...existingModel?.primary ? { primary: existingModel.primary } : void 0,
2456
+ fallbacks: selected,
2457
+ ...opts.setDefault ? { primary: selected[0] } : {}
2458
+ },
2459
+ ...nextImageModel ? { imageModel: nextImageModel } : {},
2460
+ models: nextModels
2461
+ };
2462
+ return {
2463
+ ...cfg,
2464
+ agents: {
2465
+ ...cfg.agents,
2466
+ defaults
2467
+ }
2468
+ };
2469
+ });
2470
+ if (opts.json) {
2471
+ runtime.log(JSON.stringify({
2472
+ selected,
2473
+ selectedImages,
2474
+ setDefault: Boolean(opts.setDefault),
2475
+ setImage: Boolean(opts.setImage),
2476
+ results,
2477
+ warnings: []
2478
+ }, null, 2));
2479
+ return;
2480
+ }
2481
+ logConfigUpdated(runtime);
2482
+ runtime.log(`Fallbacks: ${selected.join(", ")}`);
2483
+ if (selectedImages.length > 0) runtime.log(`Image fallbacks: ${selectedImages.join(", ")}`);
2484
+ if (opts.setDefault) runtime.log(`Default model: ${selected[0]}`);
2485
+ if (opts.setImage && selectedImages.length > 0) runtime.log(`Image model: ${selectedImages[0]}`);
2486
+ }
2487
+ //#endregion
2488
+ //#region src/commands/models/set.ts
2489
+ async function modelsSetCommand(modelRaw, runtime) {
2490
+ const updated = await updateConfig((cfg) => {
2491
+ return applyDefaultModelPrimaryUpdate({
2492
+ cfg,
2493
+ modelRaw,
2494
+ field: "model"
2495
+ });
2496
+ });
2497
+ logConfigUpdated(runtime);
2498
+ runtime.log(`Default model: ${resolveAgentModelPrimaryValue(updated.agents?.defaults?.model) ?? modelRaw}`);
2499
+ }
2500
+ //#endregion
2501
+ //#region src/commands/models/set-image.ts
2502
+ async function modelsSetImageCommand(modelRaw, runtime) {
2503
+ const updated = await updateConfig((cfg) => {
2504
+ return applyDefaultModelPrimaryUpdate({
2505
+ cfg,
2506
+ modelRaw,
2507
+ field: "imageModel"
2508
+ });
2509
+ });
2510
+ logConfigUpdated(runtime);
2511
+ runtime.log(`Image model: ${resolveAgentModelPrimaryValue(updated.agents?.defaults?.imageModel) ?? modelRaw}`);
2512
+ }
2513
+ //#endregion
2514
+ export { modelsAliasesRemoveCommand as C, modelsAliasesListCommand as S, modelsAuthAddCommand as _, modelsListCommand as a, modelsAuthSetupTokenCommand as b, modelsImageFallbacksListCommand as c, modelsFallbacksClearCommand as d, modelsFallbacksListCommand as f, modelsAuthOrderSetCommand as g, modelsAuthOrderGetCommand as h, modelsStatusCommand as i, modelsImageFallbacksRemoveCommand as l, modelsAuthOrderClearCommand as m, modelsSetCommand as n, modelsImageFallbacksAddCommand as o, modelsFallbacksRemoveCommand as p, modelsScanCommand as r, modelsImageFallbacksClearCommand as s, modelsSetImageCommand as t, modelsFallbacksAddCommand as u, modelsAuthLoginCommand as v, modelsAliasesAddCommand as x, modelsAuthPasteTokenCommand as y };