@wrongstack/cli 0.295.1 → 0.296.3

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 (398) hide show
  1. package/data/providers.json +0 -24
  2. package/dist/acp-A5OSIU2P.js +824 -0
  3. package/dist/acp-A5OSIU2P.js.map +7 -0
  4. package/dist/acp-server-agent.d.ts.map +1 -1
  5. package/dist/arg-parser.d.ts.map +1 -1
  6. package/dist/audit-2ZSFGNIF.js +102 -0
  7. package/dist/audit-2ZSFGNIF.js.map +7 -0
  8. package/dist/auth-CJWQJVRH.js +504 -0
  9. package/dist/auth-CJWQJVRH.js.map +7 -0
  10. package/dist/auth-menu/auth-menu-audit.d.ts +0 -4
  11. package/dist/auth-menu/auth-menu-audit.d.ts.map +1 -1
  12. package/dist/bench-7ZDWSNEF.js +278 -0
  13. package/dist/bench-7ZDWSNEF.js.map +7 -0
  14. package/dist/boot/brain-decision-log.d.ts +7 -5
  15. package/dist/boot/brain-decision-log.d.ts.map +1 -1
  16. package/dist/boot/dispatch-webui.d.ts +5 -8
  17. package/dist/boot/dispatch-webui.d.ts.map +1 -1
  18. package/dist/boot/system-prompt-builder.d.ts +3 -0
  19. package/dist/boot/system-prompt-builder.d.ts.map +1 -1
  20. package/dist/boot/tui-coordinator-callbacks.d.ts +45 -0
  21. package/dist/boot/tui-coordinator-callbacks.d.ts.map +1 -0
  22. package/dist/boot/tui-project-switch.d.ts +2 -3
  23. package/dist/boot/tui-project-switch.d.ts.map +1 -1
  24. package/dist/boot/tui-runtime-state.d.ts +5 -6
  25. package/dist/boot/tui-runtime-state.d.ts.map +1 -1
  26. package/dist/boot/tui-session-resume.d.ts.map +1 -1
  27. package/dist/boot/tui-settings-adapter.d.ts +2 -3
  28. package/dist/boot/tui-settings-adapter.d.ts.map +1 -1
  29. package/dist/boot.d.ts.map +1 -1
  30. package/dist/brain-menu/panel-service.d.ts.map +1 -1
  31. package/dist/chimera-review-task.d.ts +6 -0
  32. package/dist/chimera-review-task.d.ts.map +1 -0
  33. package/dist/chimera-reviewer-policy.d.ts +34 -0
  34. package/dist/chimera-reviewer-policy.d.ts.map +1 -0
  35. package/dist/chronicle-QQEQFSSE.js +256 -0
  36. package/dist/chronicle-QQEQFSSE.js.map +7 -0
  37. package/dist/chunk-5N34EWJR.js +418 -0
  38. package/dist/chunk-5N34EWJR.js.map +7 -0
  39. package/dist/chunk-66T43Q4Y.js +90 -0
  40. package/dist/chunk-66T43Q4Y.js.map +7 -0
  41. package/dist/chunk-7OCVIDC7.js +11 -0
  42. package/dist/chunk-7OCVIDC7.js.map +7 -0
  43. package/dist/chunk-ABXK4VVY.js +84 -0
  44. package/dist/chunk-ABXK4VVY.js.map +7 -0
  45. package/dist/chunk-AXVZMEWG.js +306 -0
  46. package/dist/chunk-AXVZMEWG.js.map +7 -0
  47. package/dist/chunk-AZESNNIC.js +216 -0
  48. package/dist/chunk-AZESNNIC.js.map +7 -0
  49. package/dist/chunk-BGFM3PD7.js +41 -0
  50. package/dist/chunk-BGFM3PD7.js.map +7 -0
  51. package/dist/chunk-BQCAJ7FI.js +425 -0
  52. package/dist/chunk-BQCAJ7FI.js.map +7 -0
  53. package/dist/chunk-DPJZQCVP.js +13 -0
  54. package/dist/chunk-DPJZQCVP.js.map +7 -0
  55. package/dist/chunk-F4PEGAJZ.js +176 -0
  56. package/dist/chunk-F4PEGAJZ.js.map +7 -0
  57. package/dist/chunk-IHBYBYGA.js +443 -0
  58. package/dist/chunk-IHBYBYGA.js.map +7 -0
  59. package/dist/chunk-JBSQ7ONN.js +1023 -0
  60. package/dist/chunk-JBSQ7ONN.js.map +7 -0
  61. package/dist/chunk-JBTFWWKV.js +1325 -0
  62. package/dist/chunk-JBTFWWKV.js.map +7 -0
  63. package/dist/chunk-JUHRI6OV.js +100 -0
  64. package/dist/chunk-JUHRI6OV.js.map +7 -0
  65. package/dist/chunk-OI7GWJDS.js +3303 -0
  66. package/dist/chunk-OI7GWJDS.js.map +7 -0
  67. package/dist/chunk-OP47B3IX.js +142 -0
  68. package/dist/chunk-OP47B3IX.js.map +7 -0
  69. package/dist/chunk-PJHET45A.js +158 -0
  70. package/dist/chunk-PJHET45A.js.map +7 -0
  71. package/dist/chunk-Q5GTM25S.js +17 -0
  72. package/dist/chunk-Q5GTM25S.js.map +7 -0
  73. package/dist/chunk-QD544J2B.js +19 -0
  74. package/dist/chunk-QD544J2B.js.map +7 -0
  75. package/dist/chunk-QUNHS6O3.js +258 -0
  76. package/dist/chunk-QUNHS6O3.js.map +7 -0
  77. package/dist/chunk-TADVX644.js +480 -0
  78. package/dist/chunk-TADVX644.js.map +7 -0
  79. package/dist/chunk-TGDHN4LM.js +81 -0
  80. package/dist/chunk-TGDHN4LM.js.map +7 -0
  81. package/dist/chunk-TYO2OVAD.js +50 -0
  82. package/dist/chunk-TYO2OVAD.js.map +7 -0
  83. package/dist/chunk-VCYZ3WZV.js +14 -0
  84. package/dist/chunk-VCYZ3WZV.js.map +7 -0
  85. package/dist/chunk-VJUEZZYB.js +29 -0
  86. package/dist/chunk-VJUEZZYB.js.map +7 -0
  87. package/dist/chunk-WHOIR577.js +1 -0
  88. package/dist/chunk-WHOIR577.js.map +7 -0
  89. package/dist/chunk-WY7KKOUK.js +460 -0
  90. package/dist/chunk-WY7KKOUK.js.map +7 -0
  91. package/dist/chunk-XJXDOF63.js +28 -0
  92. package/dist/chunk-XJXDOF63.js.map +7 -0
  93. package/dist/chunk-XWEGWYDU.js +560 -0
  94. package/dist/chunk-XWEGWYDU.js.map +7 -0
  95. package/dist/chunk-YWUPHRGB.js +346 -0
  96. package/dist/chunk-YWUPHRGB.js.map +7 -0
  97. package/dist/chunk-Z7YGASQP.js +313 -0
  98. package/dist/chunk-Z7YGASQP.js.map +7 -0
  99. package/dist/cli-entry-main.d.ts +2 -0
  100. package/dist/cli-entry-main.d.ts.map +1 -0
  101. package/dist/cli-entry-point.d.ts +3 -3
  102. package/dist/cli-entry-point.d.ts.map +1 -1
  103. package/dist/cli-main-RTY35OPD.js +29268 -0
  104. package/dist/cli-main-RTY35OPD.js.map +7 -0
  105. package/dist/cli-main-helpers.d.ts +21 -0
  106. package/dist/cli-main-helpers.d.ts.map +1 -0
  107. package/dist/cli-main.d.ts +25 -1
  108. package/dist/cli-main.d.ts.map +1 -1
  109. package/dist/context-limit.d.ts +48 -0
  110. package/dist/context-limit.d.ts.map +1 -1
  111. package/dist/diag-doctor-OQ3AA63O.js +170 -0
  112. package/dist/diag-doctor-OQ3AA63O.js.map +7 -0
  113. package/dist/execute-deps.d.ts +11 -12
  114. package/dist/execute-deps.d.ts.map +1 -1
  115. package/dist/execution-O7I5DYE6.js +4682 -0
  116. package/dist/execution-O7I5DYE6.js.map +7 -0
  117. package/dist/execution-chimera-ask.d.ts +10 -0
  118. package/dist/execution-chimera-ask.d.ts.map +1 -0
  119. package/dist/execution-chimera-cascade.d.ts +15 -0
  120. package/dist/execution-chimera-cascade.d.ts.map +1 -0
  121. package/dist/execution-cleanup.d.ts +23 -0
  122. package/dist/execution-cleanup.d.ts.map +1 -0
  123. package/dist/execution-kanban-dispatch.d.ts +10 -0
  124. package/dist/execution-kanban-dispatch.d.ts.map +1 -0
  125. package/dist/execution-repl-fleet-callbacks.d.ts +11 -0
  126. package/dist/execution-repl-fleet-callbacks.d.ts.map +1 -0
  127. package/dist/execution-storage-observability.d.ts +3 -0
  128. package/dist/execution-storage-observability.d.ts.map +1 -0
  129. package/dist/execution-tui-next-step-callbacks.d.ts +20 -0
  130. package/dist/execution-tui-next-step-callbacks.d.ts.map +1 -0
  131. package/dist/execution.d.ts +2 -139
  132. package/dist/execution.d.ts.map +1 -1
  133. package/dist/export-TPORYVRZ.js +64 -0
  134. package/dist/export-TPORYVRZ.js.map +7 -0
  135. package/dist/fleet/host-acp-runner-cache.d.ts +9 -0
  136. package/dist/fleet/host-acp-runner-cache.d.ts.map +1 -0
  137. package/dist/fleet/host-acp.d.ts +3 -0
  138. package/dist/fleet/host-acp.d.ts.map +1 -0
  139. package/dist/fleet/host-concurrency.d.ts +2 -0
  140. package/dist/fleet/host-concurrency.d.ts.map +1 -0
  141. package/dist/fleet/host-context.d.ts +5 -0
  142. package/dist/fleet/host-context.d.ts.map +1 -0
  143. package/dist/fleet/host-director-builder.d.ts +24 -0
  144. package/dist/fleet/host-director-builder.d.ts.map +1 -0
  145. package/dist/fleet/host-director-event-bridges.d.ts +37 -0
  146. package/dist/fleet/host-director-event-bridges.d.ts.map +1 -0
  147. package/dist/fleet/host-director-services.d.ts +20 -0
  148. package/dist/fleet/host-director-services.d.ts.map +1 -0
  149. package/dist/fleet/host-event-bridge.d.ts +17 -0
  150. package/dist/fleet/host-event-bridge.d.ts.map +1 -0
  151. package/dist/fleet/host-helpers.d.ts +22 -0
  152. package/dist/fleet/host-helpers.d.ts.map +1 -0
  153. package/dist/fleet/host-learning-tracker.d.ts +11 -0
  154. package/dist/fleet/host-learning-tracker.d.ts.map +1 -0
  155. package/dist/fleet/host-learning.d.ts +4 -0
  156. package/dist/fleet/host-learning.d.ts.map +1 -0
  157. package/dist/fleet/host-lifecycle-events.d.ts +4 -0
  158. package/dist/fleet/host-lifecycle-events.d.ts.map +1 -0
  159. package/dist/fleet/host-paths.d.ts +3 -0
  160. package/dist/fleet/host-paths.d.ts.map +1 -0
  161. package/dist/fleet/host-provider.d.ts +22 -0
  162. package/dist/fleet/host-provider.d.ts.map +1 -0
  163. package/dist/fleet/host-session-writer.d.ts +3 -0
  164. package/dist/fleet/host-session-writer.d.ts.map +1 -0
  165. package/dist/fleet/host-shadow-pass.d.ts +21 -0
  166. package/dist/fleet/host-shadow-pass.d.ts.map +1 -0
  167. package/dist/fleet/host-spawn-types.d.ts +25 -0
  168. package/dist/fleet/host-spawn-types.d.ts.map +1 -0
  169. package/dist/fleet/host-status.d.ts +48 -0
  170. package/dist/fleet/host-status.d.ts.map +1 -0
  171. package/dist/fleet/host-subagent-factory.d.ts +16 -0
  172. package/dist/fleet/host-subagent-factory.d.ts.map +1 -0
  173. package/dist/fleet/host-supervisor.d.ts +16 -0
  174. package/dist/fleet/host-supervisor.d.ts.map +1 -0
  175. package/dist/fleet/host-task-result-report.d.ts +11 -0
  176. package/dist/fleet/host-task-result-report.d.ts.map +1 -0
  177. package/dist/fleet/host-types.d.ts +89 -0
  178. package/dist/fleet/host-types.d.ts.map +1 -0
  179. package/dist/fleet/host.d.ts +10 -357
  180. package/dist/fleet/host.d.ts.map +1 -1
  181. package/dist/hq-JUYKUNJX.js +547 -0
  182. package/dist/hq-JUYKUNJX.js.map +7 -0
  183. package/dist/hq-command-controller.d.ts +2 -2
  184. package/dist/hq-command-controller.d.ts.map +1 -1
  185. package/dist/hq-server/auth.d.ts +15 -4
  186. package/dist/hq-server/auth.d.ts.map +1 -1
  187. package/dist/hq-server/project-root.d.ts +5 -0
  188. package/dist/hq-server/project-root.d.ts.map +1 -0
  189. package/dist/hq-server/routes/auth-handlers.d.ts +25 -0
  190. package/dist/hq-server/routes/auth-handlers.d.ts.map +1 -0
  191. package/dist/hq-server/routes/session-handlers.d.ts +8 -0
  192. package/dist/hq-server/routes/session-handlers.d.ts.map +1 -0
  193. package/dist/hq-server/routes.d.ts +8 -6
  194. package/dist/hq-server/routes.d.ts.map +1 -1
  195. package/dist/hq-server/snapshot.d.ts +44 -0
  196. package/dist/hq-server/snapshot.d.ts.map +1 -1
  197. package/dist/hq-server/types.d.ts +22 -4
  198. package/dist/hq-server/types.d.ts.map +1 -1
  199. package/dist/hq-server/utils.d.ts +8 -0
  200. package/dist/hq-server/utils.d.ts.map +1 -1
  201. package/dist/hq-server/ws.d.ts +1 -1
  202. package/dist/hq-server/ws.d.ts.map +1 -1
  203. package/dist/hq-server-6AQ3BXZA.js +39 -0
  204. package/dist/hq-server-6AQ3BXZA.js.map +7 -0
  205. package/dist/hq-server.d.ts +3 -3
  206. package/dist/hq-server.d.ts.map +1 -1
  207. package/dist/hq-ttl-U2FAYFAT.js +8 -0
  208. package/dist/hq-ttl-U2FAYFAT.js.map +7 -0
  209. package/dist/hq-tunnel-RFKGC4HI.js +114 -0
  210. package/dist/hq-tunnel-RFKGC4HI.js.map +7 -0
  211. package/dist/hq-tunnel.d.ts +1 -1
  212. package/dist/hq-tunnel.d.ts.map +1 -1
  213. package/dist/index.d.ts +2 -1
  214. package/dist/index.d.ts.map +1 -1
  215. package/dist/index.js +2503 -53026
  216. package/dist/index.js.map +4 -4
  217. package/dist/init-E2NDDOHI.js +27 -0
  218. package/dist/init-E2NDDOHI.js.map +7 -0
  219. package/dist/kanban-dispatch-route.d.ts +14 -0
  220. package/dist/kanban-dispatch-route.d.ts.map +1 -0
  221. package/dist/kanban-hq-sync.d.ts +2 -0
  222. package/dist/kanban-hq-sync.d.ts.map +1 -1
  223. package/dist/kanban-run-mirror-EKVNGXWW.js +12 -0
  224. package/dist/kanban-run-mirror-EKVNGXWW.js.map +7 -0
  225. package/dist/live-settings-input.d.ts +69 -0
  226. package/dist/live-settings-input.d.ts.map +1 -0
  227. package/dist/mailbox-serve-2UWHEN3M.js +302 -0
  228. package/dist/mailbox-serve-2UWHEN3M.js.map +7 -0
  229. package/dist/mcp-CYLPUEHC.js +413 -0
  230. package/dist/mcp-CYLPUEHC.js.map +7 -0
  231. package/dist/modeldiag-HENYJ4N7.js +1290 -0
  232. package/dist/modeldiag-HENYJ4N7.js.map +7 -0
  233. package/dist/permissions-FNYLZIL4.js +115 -0
  234. package/dist/permissions-FNYLZIL4.js.map +7 -0
  235. package/dist/picker-key-state.d.ts +7 -0
  236. package/dist/picker-key-state.d.ts.map +1 -0
  237. package/dist/picker-model-picker.d.ts +6 -0
  238. package/dist/picker-model-picker.d.ts.map +1 -0
  239. package/dist/picker-ui.d.ts +17 -0
  240. package/dist/picker-ui.d.ts.map +1 -0
  241. package/dist/picker.d.ts +4 -37
  242. package/dist/picker.d.ts.map +1 -1
  243. package/dist/plugin-usage-OU6X6LM3.js +40 -0
  244. package/dist/plugin-usage-OU6X6LM3.js.map +7 -0
  245. package/dist/plugins-4LJ5IUBI.js +24 -0
  246. package/dist/plugins-4LJ5IUBI.js.map +7 -0
  247. package/dist/pre-launch.d.ts +0 -1
  248. package/dist/pre-launch.d.ts.map +1 -1
  249. package/dist/project-BLQ3ALVL.js +76 -0
  250. package/dist/project-BLQ3ALVL.js.map +7 -0
  251. package/dist/project-manifest-GE25PW4S.js +18 -0
  252. package/dist/project-manifest-GE25PW4S.js.map +7 -0
  253. package/dist/project-picker-BOCWHBXP.js +17 -0
  254. package/dist/project-picker-BOCWHBXP.js.map +7 -0
  255. package/dist/projects-XE76NFNZ.js +38 -0
  256. package/dist/projects-XE76NFNZ.js.map +7 -0
  257. package/dist/provider-helpers.d.ts +22 -6
  258. package/dist/provider-helpers.d.ts.map +1 -1
  259. package/dist/providers-models-GDELBHZK.js +589 -0
  260. package/dist/providers-models-GDELBHZK.js.map +7 -0
  261. package/dist/quick-VIO2BEHS.js +10 -0
  262. package/dist/quick-VIO2BEHS.js.map +7 -0
  263. package/dist/repl-auto-proceed.d.ts +19 -0
  264. package/dist/repl-auto-proceed.d.ts.map +1 -0
  265. package/dist/repl-client-registration.d.ts +7 -0
  266. package/dist/repl-client-registration.d.ts.map +1 -0
  267. package/dist/repl-input.d.ts +11 -0
  268. package/dist/repl-input.d.ts.map +1 -0
  269. package/dist/repl-options.d.ts +54 -0
  270. package/dist/repl-options.d.ts.map +1 -0
  271. package/dist/repl-rendering.d.ts +4 -0
  272. package/dist/repl-rendering.d.ts.map +1 -0
  273. package/dist/repl-suggestions.d.ts +21 -0
  274. package/dist/repl-suggestions.d.ts.map +1 -0
  275. package/dist/repl.d.ts +3 -162
  276. package/dist/repl.d.ts.map +1 -1
  277. package/dist/replay-KCTXNMZQ.js +75 -0
  278. package/dist/replay-KCTXNMZQ.js.map +7 -0
  279. package/dist/rewind-EJMVFVLS.js +185 -0
  280. package/dist/rewind-EJMVFVLS.js.map +7 -0
  281. package/dist/sdd-runtime-JG4EEKL6.js +54 -0
  282. package/dist/sdd-runtime-JG4EEKL6.js.map +7 -0
  283. package/dist/services/sdd/project-context.d.ts +1 -1
  284. package/dist/services/sdd/project-context.d.ts.map +1 -1
  285. package/dist/services/sdd/task-manager.d.ts.map +1 -1
  286. package/dist/services/statusline-config.d.ts +1 -1
  287. package/dist/services/statusline-config.d.ts.map +1 -1
  288. package/dist/session-event-wiring.d.ts +2 -2
  289. package/dist/session-event-wiring.d.ts.map +1 -1
  290. package/dist/sessions-config-NLCMK3BY.js +409 -0
  291. package/dist/sessions-config-NLCMK3BY.js.map +7 -0
  292. package/dist/settings-menu.d.ts +3 -18
  293. package/dist/settings-menu.d.ts.map +1 -1
  294. package/dist/simpleui-dist-JIFGUJO7.js +93 -0
  295. package/dist/simpleui-dist-JIFGUJO7.js.map +7 -0
  296. package/dist/slash-commands/brain.d.ts.map +1 -1
  297. package/dist/slash-commands/clear.d.ts.map +1 -1
  298. package/dist/slash-commands/fallback.d.ts.map +1 -1
  299. package/dist/slash-commands/kanban-agent-helpers.d.ts +18 -0
  300. package/dist/slash-commands/kanban-agent-helpers.d.ts.map +1 -0
  301. package/dist/slash-commands/kanban-format.d.ts +16 -0
  302. package/dist/slash-commands/kanban-format.d.ts.map +1 -0
  303. package/dist/slash-commands/kanban-help.d.ts +2 -0
  304. package/dist/slash-commands/kanban-help.d.ts.map +1 -0
  305. package/dist/slash-commands/kanban.d.ts.map +1 -1
  306. package/dist/slash-commands/mailbox-demo.d.ts.map +1 -1
  307. package/dist/slash-commands/mailbox.d.ts +2 -1
  308. package/dist/slash-commands/mailbox.d.ts.map +1 -1
  309. package/dist/slash-commands/memory-compact.d.ts +5 -0
  310. package/dist/slash-commands/memory-compact.d.ts.map +1 -0
  311. package/dist/slash-commands/memory-flags.d.ts +36 -0
  312. package/dist/slash-commands/memory-flags.d.ts.map +1 -0
  313. package/dist/slash-commands/memory-formatters.d.ts +16 -0
  314. package/dist/slash-commands/memory-formatters.d.ts.map +1 -0
  315. package/dist/slash-commands/memory.d.ts.map +1 -1
  316. package/dist/slash-commands/mouse.d.ts +2 -2
  317. package/dist/slash-commands/review.d.ts.map +1 -1
  318. package/dist/slash-commands/sdd-command-helpers.d.ts +23 -0
  319. package/dist/slash-commands/sdd-command-helpers.d.ts.map +1 -0
  320. package/dist/slash-commands/sdd-format.d.ts +32 -0
  321. package/dist/slash-commands/sdd-format.d.ts.map +1 -0
  322. package/dist/slash-commands/sdd.d.ts.map +1 -1
  323. package/dist/slash-commands/settings.d.ts.map +1 -1
  324. package/dist/subcommands/handlers/chronicle.d.ts.map +1 -1
  325. package/dist/subcommands/handlers/mailbox-serve.d.ts.map +1 -1
  326. package/dist/subcommands/handlers/model-smoke-test.d.ts +51 -0
  327. package/dist/subcommands/handlers/model-smoke-test.d.ts.map +1 -0
  328. package/dist/subcommands/handlers/modeldiag-profiles.d.ts +64 -0
  329. package/dist/subcommands/handlers/modeldiag-profiles.d.ts.map +1 -0
  330. package/dist/subcommands/handlers/modeldiag.d.ts.map +1 -1
  331. package/dist/subcommands/handlers/per-subcommand-deep-help-table.d.ts +3 -0
  332. package/dist/subcommands/handlers/per-subcommand-deep-help-table.d.ts.map +1 -0
  333. package/dist/subcommands/handlers/per-subcommand-help-data.d.ts +3 -0
  334. package/dist/subcommands/handlers/per-subcommand-help-data.d.ts.map +1 -0
  335. package/dist/subcommands/handlers/per-subcommand-help-table.d.ts +36 -0
  336. package/dist/subcommands/handlers/per-subcommand-help-table.d.ts.map +1 -0
  337. package/dist/subcommands/handlers/per-subcommand-help-types.d.ts +18 -0
  338. package/dist/subcommands/handlers/per-subcommand-help-types.d.ts.map +1 -0
  339. package/dist/subcommands/handlers/per-subcommand-help.d.ts +2 -80
  340. package/dist/subcommands/handlers/per-subcommand-help.d.ts.map +1 -1
  341. package/dist/subcommands/handlers/rewind.d.ts.map +1 -1
  342. package/dist/subcommands/index.d.ts +7 -0
  343. package/dist/subcommands/index.d.ts.map +1 -1
  344. package/dist/tools-skills-UNKLOB7M.js +29 -0
  345. package/dist/tools-skills-UNKLOB7M.js.map +7 -0
  346. package/dist/update-YC4TYW2Y.js +16 -0
  347. package/dist/update-YC4TYW2Y.js.map +7 -0
  348. package/dist/update-check-UMYTOH7Z.js +18 -0
  349. package/dist/update-check-UMYTOH7Z.js.map +7 -0
  350. package/dist/version-help-DROHZRW6.js +11 -0
  351. package/dist/version-help-DROHZRW6.js.map +7 -0
  352. package/dist/webui-server/connection-handler.d.ts.map +1 -1
  353. package/dist/webui-server/kanban-host-adapter.d.ts +5 -1
  354. package/dist/webui-server/kanban-host-adapter.d.ts.map +1 -1
  355. package/dist/webui-server/listen-helpers.d.ts +18 -0
  356. package/dist/webui-server/listen-helpers.d.ts.map +1 -0
  357. package/dist/webui-server/node-pty-loader.d.ts +6 -0
  358. package/dist/webui-server/node-pty-loader.d.ts.map +1 -0
  359. package/dist/webui-server-ZF5KVGC5.js +1460 -0
  360. package/dist/webui-server-ZF5KVGC5.js.map +7 -0
  361. package/dist/webui-server-options.d.ts +191 -0
  362. package/dist/webui-server-options.d.ts.map +1 -0
  363. package/dist/webui-server.d.ts +2 -178
  364. package/dist/webui-server.d.ts.map +1 -1
  365. package/dist/wiring/brain-and-orchestration.d.ts.map +1 -1
  366. package/dist/wiring/codebase-index.d.ts.map +1 -1
  367. package/dist/wiring/command-host-state.d.ts +4 -4
  368. package/dist/wiring/dep-watcher-bridge.d.ts +23 -0
  369. package/dist/wiring/dep-watcher-bridge.d.ts.map +1 -0
  370. package/dist/wiring/dep-watcher.d.ts.map +1 -1
  371. package/dist/wiring/hq-telemetry.d.ts +2 -2
  372. package/dist/wiring/lifecycle-plugins.d.ts +4 -3
  373. package/dist/wiring/lifecycle-plugins.d.ts.map +1 -1
  374. package/dist/wiring/mailbox-bridge-bootstrap.d.ts +1 -1
  375. package/dist/wiring/management-tools.d.ts +15 -0
  376. package/dist/wiring/management-tools.d.ts.map +1 -0
  377. package/dist/wiring/pipeline.d.ts +2 -1
  378. package/dist/wiring/pipeline.d.ts.map +1 -1
  379. package/dist/wiring/plugins.d.ts +1 -1
  380. package/dist/wiring/plugins.d.ts.map +1 -1
  381. package/dist/wiring/provider-runtime-setup.d.ts +14 -1
  382. package/dist/wiring/provider-runtime-setup.d.ts.map +1 -1
  383. package/dist/wiring/provider.d.ts.map +1 -1
  384. package/dist/wiring/runtime-controller-deps.d.ts +1 -1
  385. package/dist/wiring/runtime-controller-deps.d.ts.map +1 -1
  386. package/dist/wiring/sage.d.ts.map +1 -1
  387. package/dist/wiring/session-registry.d.ts +38 -0
  388. package/dist/wiring/session-registry.d.ts.map +1 -0
  389. package/dist/wiring/session.d.ts +10 -6
  390. package/dist/wiring/session.d.ts.map +1 -1
  391. package/dist/wiring/tools.d.ts.map +1 -1
  392. package/package.json +22 -22
  393. package/dist/cli-recovery-prompt.d.ts +0 -19
  394. package/dist/cli-recovery-prompt.d.ts.map +0 -1
  395. package/dist/first-run-auth-gate.d.ts +0 -20
  396. package/dist/first-run-auth-gate.d.ts.map +0 -1
  397. package/dist/pre-launch/indexing-question.d.ts +0 -28
  398. package/dist/pre-launch/indexing-question.d.ts.map +0 -1
@@ -0,0 +1,142 @@
1
+
2
+ // src/hq-command-controller.ts
3
+ function createHqCommandDispatcher(controller) {
4
+ return async (command) => {
5
+ const cmd = command;
6
+ try {
7
+ const result = await dispatch(controller, cmd.commandId, cmd.type, cmd.payload);
8
+ return result;
9
+ } catch (err) {
10
+ return {
11
+ commandId: command.commandId,
12
+ status: "failed",
13
+ message: err instanceof Error ? err.message : String(err)
14
+ };
15
+ }
16
+ };
17
+ }
18
+ async function dispatch(controller, commandId, type, payload) {
19
+ switch (type) {
20
+ case "steer": {
21
+ const mailbox = controller.steerMailbox;
22
+ if (mailbox === void 0) {
23
+ return { commandId, status: "rejected", message: "no mailbox available" };
24
+ }
25
+ const to = typeof payload["to"] === "string" ? payload["to"] : "leader";
26
+ const subject = typeof payload["subject"] === "string" ? payload["subject"] : "HQ steer";
27
+ const body = typeof payload["body"] === "string" ? payload["body"] : "";
28
+ const priority = payload["priority"] === "high" ? "high" : payload["priority"] === "low" ? "low" : "normal";
29
+ const from = `hq@${controller.sessionTag()}`;
30
+ await mailbox.send({ from, to, type: "steer", subject, body, priority });
31
+ return { commandId, status: "accepted", message: `steered ${to}` };
32
+ }
33
+ case "btw": {
34
+ const mailbox = controller.steerMailbox;
35
+ if (mailbox === void 0) {
36
+ return { commandId, status: "rejected", message: "no mailbox available" };
37
+ }
38
+ const to = typeof payload["to"] === "string" ? payload["to"] : "leader";
39
+ const subject = typeof payload["subject"] === "string" ? payload["subject"] : "HQ note";
40
+ const body = typeof payload["body"] === "string" ? payload["body"] : "";
41
+ const priority = payload["priority"] === "high" ? "high" : payload["priority"] === "low" ? "low" : "normal";
42
+ const from = `hq@${controller.sessionTag()}`;
43
+ await mailbox.send({ from, to, type: "btw", subject, body, priority });
44
+ return { commandId, status: "accepted", message: `noted ${to}` };
45
+ }
46
+ case "queue": {
47
+ const mailbox = controller.steerMailbox;
48
+ if (mailbox === void 0) {
49
+ return { commandId, status: "rejected", message: "no mailbox available" };
50
+ }
51
+ const to = typeof payload["to"] === "string" ? payload["to"] : "leader";
52
+ const subject = typeof payload["subject"] === "string" ? payload["subject"] : "HQ prompt";
53
+ const body = typeof payload["body"] === "string" ? payload["body"] : "";
54
+ const priority = payload["priority"] === "high" ? "high" : payload["priority"] === "low" ? "low" : "normal";
55
+ const from = `hq@${controller.sessionTag()}`;
56
+ await mailbox.send({ from, to, type: "note", subject, body, priority });
57
+ return { commandId, status: "accepted", message: `queued for ${to}` };
58
+ }
59
+ case "broadcast": {
60
+ const mailbox = controller.steerMailbox;
61
+ if (mailbox === void 0) {
62
+ return { commandId, status: "rejected", message: "no mailbox available" };
63
+ }
64
+ const subject = typeof payload["subject"] === "string" ? payload["subject"] : "HQ broadcast";
65
+ const body = typeof payload["body"] === "string" ? payload["body"] : "";
66
+ const priority = payload["priority"] === "high" ? "high" : payload["priority"] === "low" ? "low" : "normal";
67
+ const from = `hq@${controller.sessionTag()}`;
68
+ await mailbox.send({ from, to: "all", type: "broadcast", subject, body, priority });
69
+ return { commandId, status: "accepted", message: "broadcast sent" };
70
+ }
71
+ case "abort": {
72
+ const target = typeof payload["target"] === "string" ? payload["target"] : "leader";
73
+ if (target === "leader") {
74
+ const aborted = controller.interruptLeader();
75
+ return {
76
+ commandId,
77
+ status: aborted ? "completed" : "accepted",
78
+ message: aborted ? "leader aborted" : "no active leader run"
79
+ };
80
+ }
81
+ if (target === "fleet") {
82
+ const killed = await controller.killFleet?.() ?? 0;
83
+ return {
84
+ commandId,
85
+ status: "completed",
86
+ message: `fleet stopped (${killed} agents)`
87
+ };
88
+ }
89
+ const terminated = await controller.terminateAgent?.(target) ?? false;
90
+ return {
91
+ commandId,
92
+ status: terminated ? "completed" : "rejected",
93
+ message: terminated ? `agent ${target} terminated` : `agent ${target} not found`
94
+ };
95
+ }
96
+ case "spawn": {
97
+ const role = typeof payload["role"] === "string" ? payload["role"] : "";
98
+ const task = typeof payload["task"] === "string" ? payload["task"] : void 0;
99
+ const maxIterations = typeof payload["maxIterations"] === "number" ? payload["maxIterations"] : void 0;
100
+ if (controller.spawnAgent === void 0) {
101
+ return { commandId, status: "rejected", message: "no director active" };
102
+ }
103
+ const subagentId = await controller.spawnAgent(role, task, maxIterations);
104
+ return { commandId, status: "completed", message: `spawned ${subagentId}` };
105
+ }
106
+ case "run-command": {
107
+ if (!controller.allowRunCommand()) {
108
+ return {
109
+ commandId,
110
+ status: "rejected",
111
+ message: "run-command requires operator opt-in (--hq-allow-exec)"
112
+ };
113
+ }
114
+ const mailbox = controller.steerMailbox;
115
+ const command = typeof payload["command"] === "string" ? payload["command"] : "";
116
+ if (mailbox !== void 0 && command.length > 0) {
117
+ const from = `hq@${controller.sessionTag()}`;
118
+ await mailbox.send({
119
+ from,
120
+ to: "leader",
121
+ type: "steer",
122
+ subject: "Run command (HQ)",
123
+ body: `Run the following shell command:
124
+
125
+ \`\`\`
126
+ ${command}
127
+ \`\`\``,
128
+ priority: "high"
129
+ });
130
+ return { commandId, status: "accepted", message: "run-command routed to leader as steer" };
131
+ }
132
+ return { commandId, status: "rejected", message: "cannot route run-command (no mailbox)" };
133
+ }
134
+ default:
135
+ return { commandId, status: "rejected", message: `unknown command type: ${type}` };
136
+ }
137
+ }
138
+
139
+ export {
140
+ createHqCommandDispatcher
141
+ };
142
+ //# sourceMappingURL=chunk-OP47B3IX.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/hq-command-controller.ts"],
4
+ "sourcesContent": ["/**\n * HQ command controller \u2014 the client-side dispatch surface for Phase 4 of the\n * HQ command center. A mutable holder (mirroring the established\n * `interruptController` pattern in cli-main.ts) that the `onCommand` handler\n * on the HQ publisher reads lazily, because several of its targets\n * (`director`, the rebound `interruptLeader`) are not yet defined at HQ-connect\n * time.\n *\n * The five command types route through the agent's own decision loop or the\n * project mailbox, so they inherit existing guardrails. `run-command` (raw\n * shell) is deliberately NOT wired here \u2014 it requires a separately-audited\n * escalation policy (operator flag + per-token `control.execute` + allowlist)\n * and is left as a stub that rejects until that policy exists.\n *\n * @module hq-command-controller\n */\nimport type { HqPublisherCommandResult } from '@wrongstack/core/hq';\nimport type { RemoteMailbox } from '@wrongstack/core/coordination';\nimport type { HqCommand } from '@wrongstack/core/hq';\n\n/**\n * Mutable holder for the command dispatch targets. Each field is populated\n * lazily as the corresponding subsystem comes online (director on\n * `onDirectorReady`, interruptLeader rebound by the REPL/TUI, \u2026). The\n * `onCommand` handler reads these at dispatch time, not at construction.\n */\nexport interface HqCommandController {\n /** Project mailbox used to deliver steer/broadcast messages. */\n steerMailbox?: RemoteMailbox | undefined;\n /** Abort the session leader's running Agent.run(). Returns true if a run was aborted. */\n interruptLeader: () => boolean;\n /** Terminate a specific subagent by id. Returns true if terminated. */\n terminateAgent?: (subagentId: string) => boolean | Promise<boolean>;\n /** Stop the entire fleet (all running/idle subagents). Returns kill count. */\n killFleet?: () => number | Promise<number>;\n /** Spawn a subagent of the given role. Returns the new subagentId. */\n spawnAgent?: (role: string, task?: string, maxIterations?: number) => Promise<string>;\n /** Derive the session-unique mailbox tag for addressing (e.g. `leader@<tag>`). */\n sessionTag: () => string;\n /** Whether raw shell execution is explicitly opted-in by the operator. */\n allowRunCommand: () => boolean;\n}\n\n/**\n * Build the `onCommand` handler for an HQ publisher. The handler validates\n * the command, dispatches through the controller, and returns an ack result\n * (or throws to produce a `failed` ack \u2014 the publisher's `handleCommandBatch`\n * wraps it). Best-effort: a dispatch failure never breaks the host.\n */\nexport function createHqCommandDispatcher(\n controller: HqCommandController,\n): (command: { commandId: string; type: string; payload: unknown }) => Promise<HqPublisherCommandResult> {\n return async (command) => {\n const cmd = command as { commandId: string; type: string; payload: Record<string, unknown> };\n try {\n const result = await dispatch(controller, cmd.commandId, cmd.type as HqCommand['type'], cmd.payload);\n return result;\n } catch (err) {\n return {\n commandId: command.commandId,\n status: 'failed',\n message: err instanceof Error ? err.message : String(err),\n };\n }\n };\n}\n\nasync function dispatch(\n controller: HqCommandController,\n commandId: string,\n type: HqCommand['type'],\n payload: Record<string, unknown>,\n): Promise<HqPublisherCommandResult> {\n switch (type) {\n case 'steer': {\n const mailbox = controller.steerMailbox;\n if (mailbox === undefined) {\n return { commandId, status: 'rejected', message: 'no mailbox available' };\n }\n const to = typeof payload['to'] === 'string' ? payload['to'] : 'leader';\n const subject = typeof payload['subject'] === 'string' ? payload['subject'] : 'HQ steer';\n const body = typeof payload['body'] === 'string' ? payload['body'] : '';\n const priority = payload['priority'] === 'high' ? 'high' : payload['priority'] === 'low' ? 'low' : 'normal';\n const from = `hq@${controller.sessionTag()}`;\n await mailbox.send({ from, to, type: 'steer', subject, body, priority });\n return { commandId, status: 'accepted', message: `steered ${to}` };\n }\n\n case 'btw': {\n // Non-urgent FYI. Same targeting as steer, but delivered as a `btw`\n // mailbox message so the receiving agent absorbs it as context instead\n // of treating it as a course-correction. Lands in the mailbox file\n // regardless of whether a loop is currently running.\n const mailbox = controller.steerMailbox;\n if (mailbox === undefined) {\n return { commandId, status: 'rejected', message: 'no mailbox available' };\n }\n const to = typeof payload['to'] === 'string' ? payload['to'] : 'leader';\n const subject = typeof payload['subject'] === 'string' ? payload['subject'] : 'HQ note';\n const body = typeof payload['body'] === 'string' ? payload['body'] : '';\n const priority = payload['priority'] === 'high' ? 'high' : payload['priority'] === 'low' ? 'low' : 'normal';\n const from = `hq@${controller.sessionTag()}`;\n await mailbox.send({ from, to, type: 'btw', subject, body, priority });\n return { commandId, status: 'accepted', message: `noted ${to}` };\n }\n\n case 'queue': {\n // Queue a prompt/note for the target. Delivered as a plain `note` the\n // agent picks up before its next step \u2014 used when the prompt should\n // wait its turn rather than steer the current operation. Like steer/btw,\n // this only writes to the mailbox; no live loop is required.\n const mailbox = controller.steerMailbox;\n if (mailbox === undefined) {\n return { commandId, status: 'rejected', message: 'no mailbox available' };\n }\n const to = typeof payload['to'] === 'string' ? payload['to'] : 'leader';\n const subject = typeof payload['subject'] === 'string' ? payload['subject'] : 'HQ prompt';\n const body = typeof payload['body'] === 'string' ? payload['body'] : '';\n const priority = payload['priority'] === 'high' ? 'high' : payload['priority'] === 'low' ? 'low' : 'normal';\n const from = `hq@${controller.sessionTag()}`;\n await mailbox.send({ from, to, type: 'note', subject, body, priority });\n return { commandId, status: 'accepted', message: `queued for ${to}` };\n }\n\n case 'broadcast': {\n const mailbox = controller.steerMailbox;\n if (mailbox === undefined) {\n return { commandId, status: 'rejected', message: 'no mailbox available' };\n }\n const subject = typeof payload['subject'] === 'string' ? payload['subject'] : 'HQ broadcast';\n const body = typeof payload['body'] === 'string' ? payload['body'] : '';\n const priority = payload['priority'] === 'high' ? 'high' : payload['priority'] === 'low' ? 'low' : 'normal';\n const from = `hq@${controller.sessionTag()}`;\n await mailbox.send({ from, to: 'all', type: 'broadcast', subject, body, priority });\n return { commandId, status: 'accepted', message: 'broadcast sent' };\n }\n\n case 'abort': {\n const target = typeof payload['target'] === 'string' ? payload['target'] : 'leader';\n if (target === 'leader') {\n const aborted = controller.interruptLeader();\n return {\n commandId,\n status: aborted ? 'completed' : 'accepted',\n message: aborted ? 'leader aborted' : 'no active leader run',\n };\n }\n if (target === 'fleet') {\n const killed = (await controller.killFleet?.()) ?? 0;\n return {\n commandId,\n status: 'completed',\n message: `fleet stopped (${killed} agents)`,\n };\n }\n // Specific subagent id.\n const terminated = (await controller.terminateAgent?.(target)) ?? false;\n return {\n commandId,\n status: terminated ? 'completed' : 'rejected',\n message: terminated ? `agent ${target} terminated` : `agent ${target} not found`,\n };\n }\n\n case 'spawn': {\n const role = typeof payload['role'] === 'string' ? payload['role'] : '';\n const task = typeof payload['task'] === 'string' ? payload['task'] : undefined;\n const maxIterations = typeof payload['maxIterations'] === 'number' ? payload['maxIterations'] : undefined;\n if (controller.spawnAgent === undefined) {\n return { commandId, status: 'rejected', message: 'no director active' };\n }\n const subagentId = await controller.spawnAgent(role, task, maxIterations);\n return { commandId, status: 'completed', message: `spawned ${subagentId}` };\n }\n\n case 'run-command': {\n // RCE gate: require explicit operator opt-in. Without it, reject every\n // run-command so a stolen client token can never gain shell access.\n if (!controller.allowRunCommand()) {\n return {\n commandId,\n status: 'rejected',\n message: 'run-command requires operator opt-in (--hq-allow-exec)',\n };\n }\n // Even with opt-in, we do NOT exec shell directly \u2014 we route through the\n // agent as a steer so the agent's own permission policy still applies.\n // A full direct-exec path is deferred until a separately-audited\n // escalation policy + allowlist exists.\n const mailbox = controller.steerMailbox;\n const command = typeof payload['command'] === 'string' ? payload['command'] : '';\n if (mailbox !== undefined && command.length > 0) {\n const from = `hq@${controller.sessionTag()}`;\n await mailbox.send({\n from,\n to: 'leader',\n type: 'steer',\n subject: 'Run command (HQ)',\n body: `Run the following shell command:\\n\\n\\`\\`\\`\\n${command}\\n\\`\\`\\``,\n priority: 'high',\n });\n return { commandId, status: 'accepted', message: 'run-command routed to leader as steer' };\n }\n return { commandId, status: 'rejected', message: 'cannot route run-command (no mailbox)' };\n }\n\n default:\n return { commandId, status: 'rejected', message: `unknown command type: ${type}` };\n }\n}\n"],
5
+ "mappings": ";;;AA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EAAE,WAAW,QAAQ,YAAY,SAAS,qBAAqB;AAAA,MACxE;AACA,YAAM,aAAa,MAAM,WAAW,WAAW,MAAM,MAAM,aAAa;AACxE,aAAO,EAAE,WAAW,QAAQ,aAAa,SAAS,WAAW,UAAU,GAAG;AAAA,IAC5E;AAAA,IAEA,KAAK,eAAe;AAGlB,UAAI,CAAC,WAAW,gBAAgB,GAAG;AACjC,eAAO;AAAA,UACL;AAAA,UACA,QAAQ;AAAA,UACR,SAAS;AAAA,QACX;AAAA,MACF;AAKA,YAAM,UAAU,WAAW;AAC3B,YAAM,UAAU,OAAO,QAAQ,SAAS,MAAM,WAAW,QAAQ,SAAS,IAAI;AAC9E,UAAI,YAAY,UAAa,QAAQ,SAAS,GAAG;AAC/C,cAAM,OAAO,MAAM,WAAW,WAAW,CAAC;AAC1C,cAAM,QAAQ,KAAK;AAAA,UACjB;AAAA,UACA,IAAI;AAAA,UACJ,MAAM;AAAA,UACN,SAAS;AAAA,UACT,MAAM;AAAA;AAAA;AAAA,EAA+C,OAAO;AAAA;AAAA,UAC5D,UAAU;AAAA,QACZ,CAAC;AACD,eAAO,EAAE,WAAW,QAAQ,YAAY,SAAS,wCAAwC;AAAA,MAC3F;AACA,aAAO,EAAE,WAAW,QAAQ,YAAY,SAAS,wCAAwC;AAAA,IAC3F;AAAA,IAEA;AACE,aAAO,EAAE,WAAW,QAAQ,YAAY,SAAS,yBAAyB,IAAI,GAAG;AAAA,EACrF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,158 @@
1
+
2
+ // src/provider-config-utils.ts
3
+ import { expectDefined } from "@wrongstack/core/utils";
4
+ import { FsError } from "@wrongstack/core/types";
5
+ import * as fs from "node:fs/promises";
6
+ import { atomicWrite, color } from "@wrongstack/core/utils";
7
+ import { decryptConfigSecrets, encryptConfigSecrets } from "@wrongstack/core/security";
8
+ function normalizeKeys(cfg) {
9
+ if (Array.isArray(cfg.apiKeys) && cfg.apiKeys.length > 0) {
10
+ return cfg.apiKeys.map((k) => ({ ...k }));
11
+ }
12
+ if (typeof cfg.apiKey === "string" && cfg.apiKey.length > 0) {
13
+ return [{ label: "default", apiKey: cfg.apiKey, createdAt: "" }];
14
+ }
15
+ return [];
16
+ }
17
+ function writeKeysBack(cfg, keys) {
18
+ if (keys.length === 0) {
19
+ delete cfg.apiKeys;
20
+ delete cfg.apiKey;
21
+ delete cfg.activeKey;
22
+ return;
23
+ }
24
+ cfg.apiKeys = keys;
25
+ const active = keys.find((k) => k.label === cfg.activeKey) ?? expectDefined(keys[0]);
26
+ delete cfg.apiKey;
27
+ if (!cfg.activeKey || !keys.some((k) => k.label === cfg.activeKey)) {
28
+ cfg.activeKey = active.label;
29
+ }
30
+ }
31
+ function resolveActiveApiKey(cfg) {
32
+ if (Array.isArray(cfg.apiKeys) && cfg.apiKeys.length > 0) {
33
+ const active = cfg.activeKey ? cfg.apiKeys.find((k) => k.label === cfg.activeKey) : void 0;
34
+ return (active ?? cfg.apiKeys[0])?.apiKey;
35
+ }
36
+ return cfg.apiKey && cfg.apiKey.length > 0 ? cfg.apiKey : void 0;
37
+ }
38
+ function isLoopbackBaseUrl(baseUrl) {
39
+ if (!baseUrl) return false;
40
+ try {
41
+ let host = new URL(baseUrl).hostname.toLowerCase();
42
+ host = host.replace(/^\[|\]$/g, "");
43
+ return host === "localhost" || host === "::1" || host === "0.0.0.0" || /^127\./.test(host);
44
+ } catch {
45
+ return false;
46
+ }
47
+ }
48
+ function providerCanRunWithoutSavedKey(cfg) {
49
+ return isLoopbackBaseUrl(cfg.baseUrl) && (!cfg.envVars || cfg.envVars.length === 0);
50
+ }
51
+ function hasUsableSavedProvider(cfg) {
52
+ return resolveActiveApiKey(cfg) !== void 0 || providerCanRunWithoutSavedKey(cfg);
53
+ }
54
+ function clearStaleProviderDefaults(config) {
55
+ const providerId = typeof config["provider"] === "string" ? config["provider"] : void 0;
56
+ if (!providerId) return;
57
+ const providers = config["providers"];
58
+ const provider = providers?.[providerId];
59
+ if (!provider || !hasUsableSavedProvider(provider)) {
60
+ delete config["provider"];
61
+ delete config["model"];
62
+ return;
63
+ }
64
+ const modelId = typeof config["model"] === "string" ? config["model"] : void 0;
65
+ if (modelId && Array.isArray(provider.models) && provider.models.length > 0 && !provider.models.includes(modelId)) {
66
+ delete config["model"];
67
+ }
68
+ }
69
+ function activeLabel(cfg, keys) {
70
+ if (cfg.activeKey && keys.some((k) => k.label === cfg.activeKey)) return cfg.activeKey;
71
+ return keys[0]?.label;
72
+ }
73
+ function maskedKey(key) {
74
+ if (!key) return color.dim("\u2014");
75
+ if (key.length <= 8) return color.dim("\u2022".repeat(key.length));
76
+ const head = key.slice(0, 4);
77
+ const tail = key.slice(-4);
78
+ return `${color.dim(head + "\u2026")}${tail}`;
79
+ }
80
+ function nowIso() {
81
+ return (/* @__PURE__ */ new Date()).toISOString();
82
+ }
83
+ async function loadConfigProviders(configPath, vault, opts) {
84
+ const warn = opts?.warn;
85
+ const targetPath = opts?.profileConfigPath ?? configPath;
86
+ let raw;
87
+ try {
88
+ raw = await fs.readFile(targetPath, "utf8");
89
+ } catch (err) {
90
+ if (err.code !== "ENOENT") {
91
+ warn?.(`Could not read ${targetPath}: ${err.message}. Treating as empty.`);
92
+ }
93
+ return {};
94
+ }
95
+ let parsed;
96
+ try {
97
+ parsed = JSON.parse(raw);
98
+ } catch (err) {
99
+ warn?.(`Config at ${targetPath} is not valid JSON: ${err.message}`);
100
+ return {};
101
+ }
102
+ const decrypted = decryptConfigSecrets(parsed, vault);
103
+ return decrypted.providers ?? {};
104
+ }
105
+ async function mutateConfigProviders(configPath, vault, mutator, profileConfigPath) {
106
+ const targetPath = profileConfigPath ?? configPath;
107
+ let raw;
108
+ let fileExists = true;
109
+ try {
110
+ raw = await fs.readFile(targetPath, "utf8");
111
+ } catch (err) {
112
+ if (err.code !== "ENOENT") {
113
+ throw new FsError({
114
+ message: `Refusing to mutate ${configPath}: ${err.message}`,
115
+ code: "FS_READ_FAILED",
116
+ path: targetPath,
117
+ context: { operation: "mutateConfigProviders", phase: "read" },
118
+ cause: err
119
+ });
120
+ }
121
+ fileExists = false;
122
+ raw = "{}";
123
+ }
124
+ let parsed;
125
+ try {
126
+ parsed = JSON.parse(raw);
127
+ } catch (err) {
128
+ if (fileExists) {
129
+ throw new FsError({
130
+ message: `Refusing to overwrite corrupt config at ${targetPath} (${err.message}). Fix or move the file aside before retrying.`,
131
+ code: "FS_READ_FAILED",
132
+ path: targetPath,
133
+ context: { operation: "mutateConfigProviders", phase: "parse" },
134
+ cause: err
135
+ });
136
+ }
137
+ parsed = {};
138
+ }
139
+ const decrypted = decryptConfigSecrets(parsed, vault);
140
+ const providers = decrypted.providers ?? {};
141
+ mutator(providers);
142
+ decrypted.providers = providers;
143
+ clearStaleProviderDefaults(decrypted);
144
+ const encrypted = encryptConfigSecrets(decrypted, vault);
145
+ await atomicWrite(targetPath, JSON.stringify(encrypted, null, 2), { mode: 384 });
146
+ }
147
+
148
+ export {
149
+ normalizeKeys,
150
+ writeKeysBack,
151
+ resolveActiveApiKey,
152
+ activeLabel,
153
+ maskedKey,
154
+ nowIso,
155
+ loadConfigProviders,
156
+ mutateConfigProviders
157
+ };
158
+ //# sourceMappingURL=chunk-PJHET45A.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/provider-config-utils.ts"],
4
+ "sourcesContent": ["import { expectDefined } from '@wrongstack/core/utils';\nimport { FsError } from '@wrongstack/core/types';\n\nexport { expectDefined };\n\n/**\n * Pure helpers for ProviderConfig shape normalisation, key masking, and\n * timestamp generation \u2014 plus config file I/O (load/mutate providers).\n * Shared between auth-menu.ts, webui-server.ts, and any future code that\n * touches the config `providers` map.\n */\nimport * as fs from 'node:fs/promises';\nimport type { ProviderApiKey, ProviderConfig, SecretVault } from '@wrongstack/core/types';\nimport { atomicWrite, color } from '@wrongstack/core/utils';\nimport { decryptConfigSecrets, encryptConfigSecrets } from '@wrongstack/core/security';\n/**\n * Normalize a ProviderConfig to the canonical `apiKeys[]` form.\n * Migrates the legacy single-key `apiKey` field on the fly so every\n * consumer sees a uniform shape. Does NOT mutate the input.\n */\nexport function normalizeKeys(cfg: ProviderConfig): ProviderApiKey[] {\n if (Array.isArray(cfg.apiKeys) && cfg.apiKeys.length > 0) {\n return cfg.apiKeys.map((k) => ({ ...k }));\n }\n if (typeof cfg.apiKey === 'string' && cfg.apiKey.length > 0) {\n return [{ label: 'default', apiKey: cfg.apiKey, createdAt: '' }];\n }\n return [];\n}\n\n/**\n * Write a normalized key list back into a ProviderConfig. Does NOT mirror\n * the plaintext key to the legacy `apiKey` field \u2014 that would leak the\n * secret on any accidental JSON.stringify of the config. Consumers that\n * need the real key must call {@link resolveActiveApiKey}.\n */\nexport function writeKeysBack(cfg: ProviderConfig, keys: ProviderApiKey[]): void {\n if (keys.length === 0) {\n delete cfg.apiKeys;\n delete cfg.apiKey;\n delete cfg.activeKey;\n return;\n }\n cfg.apiKeys = keys;\n const active = keys.find((k) => k.label === cfg.activeKey) ?? expectDefined(keys[0]);\n // Do NOT mirror plaintext to cfg.apiKey \u2014 the legacy field is cleared so\n // that accidental serialization (logging, error messages, WS payloads)\n // cannot leak the active key. Use resolveActiveApiKey() to read the real key.\n delete cfg.apiKey;\n if (!cfg.activeKey || !keys.some((k) => k.label === cfg.activeKey)) {\n cfg.activeKey = active.label;\n }\n}\n\n/**\n * Extract the active (decrypted) API key from a ProviderConfig.\n *\n * Resolution order:\n * 1. `apiKeys[]` \u2014 pick the entry matching `activeKey`, or the first one\n * 2. Legacy `apiKey` field \u2014 only for configs not yet migrated to multi-key\n *\n * This is the **preferred** way to read the API key. Never read `cfg.apiKey`\n * directly in new code \u2014 after {@link writeKeysBack} it is cleared, and even\n * when present on a freshly-loaded config it may contain a masked value.\n */\nexport function resolveActiveApiKey(cfg: ProviderConfig): string | undefined {\n if (Array.isArray(cfg.apiKeys) && cfg.apiKeys.length > 0) {\n const active = cfg.activeKey\n ? cfg.apiKeys.find((k) => k.label === cfg.activeKey)\n : undefined;\n return (active ?? cfg.apiKeys[0])?.apiKey;\n }\n return cfg.apiKey && cfg.apiKey.length > 0 ? cfg.apiKey : undefined;\n}\n\nfunction isLoopbackBaseUrl(baseUrl: string | undefined): boolean {\n if (!baseUrl) return false;\n try {\n let host = new URL(baseUrl).hostname.toLowerCase();\n host = host.replace(/^\\[|\\]$/g, '');\n return host === 'localhost' || host === '::1' || host === '0.0.0.0' || /^127\\./.test(host);\n } catch {\n return false;\n }\n}\n\nfunction providerCanRunWithoutSavedKey(cfg: ProviderConfig): boolean {\n return isLoopbackBaseUrl(cfg.baseUrl) && (!cfg.envVars || cfg.envVars.length === 0);\n}\n\nfunction hasUsableSavedProvider(cfg: ProviderConfig): boolean {\n return resolveActiveApiKey(cfg) !== undefined || providerCanRunWithoutSavedKey(cfg);\n}\n\n/**\n * Clear top-level provider/model defaults when provider mutations make them\n * stale. This prevents a removed provider, deleted final key, or edited model\n * allowlist from being accepted on the next boot and crashing provider setup.\n */\nexport function clearStaleProviderDefaults(config: Record<string, unknown>): void {\n const providerId = typeof config['provider'] === 'string' ? config['provider'] : undefined;\n if (!providerId) return;\n const providers = config['providers'] as Record<string, ProviderConfig> | undefined;\n const provider = providers?.[providerId];\n if (!provider || !hasUsableSavedProvider(provider)) {\n delete config['provider'];\n delete config['model'];\n return;\n }\n const modelId = typeof config['model'] === 'string' ? config['model'] : undefined;\n if (modelId && Array.isArray(provider.models) && provider.models.length > 0 && !provider.models.includes(modelId)) {\n delete config['model'];\n }\n}\n\n/**\n * Return the label of the active key, or the first key's label if no\n * active is pinned. Returns `undefined` when there are no keys at all.\n */\nexport function activeLabel(cfg: ProviderConfig, keys: ProviderApiKey[]): string | undefined {\n if (cfg.activeKey && keys.some((k) => k.label === cfg.activeKey)) return cfg.activeKey;\n return keys[0]?.label;\n}\n\n/** Mask an API key for display: show first 4 + last 4 chars. */\nexport function maskedKey(key: string): string {\n if (!key) return color.dim('\u2014');\n if (key.length <= 8) return color.dim('\u2022'.repeat(key.length));\n const head = key.slice(0, 4);\n const tail = key.slice(-4);\n return `${color.dim(head + '\u2026')}${tail}`;\n}\n\n/** ISO-8601 timestamp for key `createdAt` fields. */\nexport function nowIso(): string {\n return new Date().toISOString();\n}\n\n/* ------------------------------------------------------------------ */\n/* Config file I/O \u2014 load / mutate `providers` atomically */\n/* ------------------------------------------------------------------ */\n\n/**\n * Read the on-disk config file and return its `providers` map, fully\n * decrypted. Returns `{}` on ENOENT or corrupt JSON (surfacing the error\n * via the optional `warn` callback when provided).\n */\nexport async function loadConfigProviders(\n configPath: string,\n vault: SecretVault,\n opts?: { warn?: (msg: string) => void; profileConfigPath?: string },\n): Promise<Record<string, ProviderConfig>> {\n const warn = opts?.warn;\n const targetPath = opts?.profileConfigPath ?? configPath;\n let raw: string;\n try {\n raw = await fs.readFile(targetPath, 'utf8');\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== 'ENOENT') {\n warn?.(`Could not read ${targetPath}: ${(err as Error).message}. Treating as empty.`);\n }\n return {};\n }\n let parsed: Record<string, unknown>;\n try {\n parsed = JSON.parse(raw) as Record<string, unknown>;\n } catch (err) {\n warn?.(`Config at ${targetPath} is not valid JSON: ${(err as Error).message}`);\n return {};\n }\n const decrypted = decryptConfigSecrets(parsed, vault);\n return (decrypted as { providers?: Record<string, ProviderConfig> }).providers ?? {};\n}\n\n/**\n * Load \u2192 mutate \u2192 encrypt \u2192 atomic-write. Operates on the FULL config file\n * so non-provider keys are preserved. Refuses to overwrite a corrupt-but-\n * existing config (the user may still have salvageable data).\n */\nexport async function mutateConfigProviders(\n configPath: string,\n vault: SecretVault,\n mutator: (providers: Record<string, ProviderConfig>) => void,\n profileConfigPath?: string,\n): Promise<void> {\n const targetPath = profileConfigPath ?? configPath;\n let raw: string;\n let fileExists = true;\n try {\n raw = await fs.readFile(targetPath, 'utf8');\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== 'ENOENT') {\n throw new FsError({\n message: `Refusing to mutate ${configPath}: ${(err as Error).message}`,\n code: 'FS_READ_FAILED',\n path: targetPath,\n context: { operation: 'mutateConfigProviders', phase: 'read' },\n cause: err,\n });\n }\n fileExists = false;\n raw = '{}';\n }\n let parsed: Record<string, unknown>;\n try {\n parsed = JSON.parse(raw) as Record<string, unknown>;\n } catch (err) {\n if (fileExists) {\n throw new FsError({\n message:\n `Refusing to overwrite corrupt config at ${targetPath} ` +\n `(${(err as Error).message}). Fix or move the file aside before retrying.`,\n code: 'FS_READ_FAILED',\n path: targetPath,\n context: { operation: 'mutateConfigProviders', phase: 'parse' },\n cause: err,\n });\n }\n parsed = {};\n }\n const decrypted = decryptConfigSecrets(parsed, vault) as Record<string, unknown>;\n const providers = (decrypted.providers as Record<string, ProviderConfig>) ?? {};\n mutator(providers);\n decrypted.providers = providers;\n clearStaleProviderDefaults(decrypted);\n const encrypted = encryptConfigSecrets(decrypted, vault);\n await atomicWrite(targetPath, JSON.stringify(encrypted, null, 2), { mode: 0o600 });\n}\n"],
5
+ "mappings": ";;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AAUxB,YAAY,QAAQ;AAEpB,SAAS,aAAa,aAAa;AACnC,SAAS,sBAAsB,4BAA4B;AAMpD,SAAS,cAAc,KAAuC;AACnE,MAAI,MAAM,QAAQ,IAAI,OAAO,KAAK,IAAI,QAAQ,SAAS,GAAG;AACxD,WAAO,IAAI,QAAQ,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE;AAAA,EAC1C;AACA,MAAI,OAAO,IAAI,WAAW,YAAY,IAAI,OAAO,SAAS,GAAG;AAC3D,WAAO,CAAC,EAAE,OAAO,WAAW,QAAQ,IAAI,QAAQ,WAAW,GAAG,CAAC;AAAA,EACjE;AACA,SAAO,CAAC;AACV;AAQO,SAAS,cAAc,KAAqB,MAA8B;AAC/E,MAAI,KAAK,WAAW,GAAG;AACrB,WAAO,IAAI;AACX,WAAO,IAAI;AACX,WAAO,IAAI;AACX;AAAA,EACF;AACA,MAAI,UAAU;AACd,QAAM,SAAS,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:os";
4
+ function resolveAuditActor() {
5
+ const user = (process.env.USERNAME ?? process.env.USER ?? "").toString();
6
+ try {
7
+ const host = os.hostname();
8
+ return user ? `${user}@${host}` : `cli@${host}`;
9
+ } catch {
10
+ return user ? `${user}@unknown` : "cli";
11
+ }
12
+ }
13
+
14
+ export {
15
+ resolveAuditActor
16
+ };
17
+ //# sourceMappingURL=chunk-Q5GTM25S.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/hq-server/audit-actor.ts"],
4
+ "sourcesContent": ["import * as os from 'node:os';\n\n/** Build the non-secret actor label used by HQ authentication audit entries. */\nexport function resolveAuditActor(): string {\n const user = (process.env.USERNAME ?? process.env.USER ?? '').toString();\n try {\n const host = os.hostname();\n return user ? `${user}@${host}` : `cli@${host}`;\n } catch {\n return user ? `${user}@unknown` : 'cli';\n }\n}\n"],
5
+ "mappings": ";;;AAAA,YAAY,QAAQ;AAGb,SAAS,oBAA4B;AAC1C,QAAM,QAAQ,QAAQ,IAAI,YAAY,QAAQ,IAAI,QAAQ,IAAI,SAAS;AACvE,MAAI;AACF,UAAM,OAAU,YAAS;AACzB,WAAO,OAAO,GAAG,IAAI,IAAI,IAAI,KAAK,OAAO,IAAI;AAAA,EAC/C,QAAQ;AACN,WAAO,OAAO,GAAG,IAAI,aAAa;AAAA,EACpC;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,19 @@
1
+
2
+ // src/theme.ts
3
+ import { color } from "@wrongstack/core/utils";
4
+ var theme = {
5
+ primary: color.amber,
6
+ accent: color.pink,
7
+ muted: color.dim,
8
+ success: color.green,
9
+ warn: color.yellow,
10
+ error: color.red,
11
+ info: color.cyan,
12
+ bold: color.bold,
13
+ underline: color.underline
14
+ };
15
+
16
+ export {
17
+ theme
18
+ };
19
+ //# sourceMappingURL=chunk-QD544J2B.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/theme.ts"],
4
+ "sourcesContent": ["import { color } from '@wrongstack/core/utils';\n\nexport const theme = {\n primary: color.amber,\n accent: color.pink,\n muted: color.dim,\n success: color.green,\n warn: color.yellow,\n error: color.red,\n info: color.cyan,\n bold: color.bold,\n underline: color.underline,\n};\n"],
5
+ "mappings": ";;;AAAA,SAAS,aAAa;AAEf,IAAM,QAAQ;AAAA,EACnB,SAAS,MAAM;AAAA,EACf,QAAQ,MAAM;AAAA,EACd,OAAO,MAAM;AAAA,EACb,SAAS,MAAM;AAAA,EACf,MAAM,MAAM;AAAA,EACZ,OAAO,MAAM;AAAA,EACb,MAAM,MAAM;AAAA,EACZ,MAAM,MAAM;AAAA,EACZ,WAAW,MAAM;AACnB;",
6
+ "names": []
7
+ }