@wrongstack/cli 0.295.1 → 0.296.2

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 (383) 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 +4 -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-DPJZQCVP.js +13 -0
  52. package/dist/chunk-DPJZQCVP.js.map +7 -0
  53. package/dist/chunk-F4PEGAJZ.js +176 -0
  54. package/dist/chunk-F4PEGAJZ.js.map +7 -0
  55. package/dist/chunk-IHBYBYGA.js +443 -0
  56. package/dist/chunk-IHBYBYGA.js.map +7 -0
  57. package/dist/chunk-IN4GXGYW.js +425 -0
  58. package/dist/chunk-IN4GXGYW.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-OP47B3IX.js +142 -0
  66. package/dist/chunk-OP47B3IX.js.map +7 -0
  67. package/dist/chunk-PJHET45A.js +158 -0
  68. package/dist/chunk-PJHET45A.js.map +7 -0
  69. package/dist/chunk-Q5GTM25S.js +17 -0
  70. package/dist/chunk-Q5GTM25S.js.map +7 -0
  71. package/dist/chunk-QD544J2B.js +19 -0
  72. package/dist/chunk-QD544J2B.js.map +7 -0
  73. package/dist/chunk-QUNHS6O3.js +258 -0
  74. package/dist/chunk-QUNHS6O3.js.map +7 -0
  75. package/dist/chunk-TADVX644.js +480 -0
  76. package/dist/chunk-TADVX644.js.map +7 -0
  77. package/dist/chunk-TGDHN4LM.js +81 -0
  78. package/dist/chunk-TGDHN4LM.js.map +7 -0
  79. package/dist/chunk-TYO2OVAD.js +50 -0
  80. package/dist/chunk-TYO2OVAD.js.map +7 -0
  81. package/dist/chunk-VCYZ3WZV.js +14 -0
  82. package/dist/chunk-VCYZ3WZV.js.map +7 -0
  83. package/dist/chunk-VJUEZZYB.js +29 -0
  84. package/dist/chunk-VJUEZZYB.js.map +7 -0
  85. package/dist/chunk-WHOIR577.js +1 -0
  86. package/dist/chunk-WHOIR577.js.map +7 -0
  87. package/dist/chunk-WY7KKOUK.js +460 -0
  88. package/dist/chunk-WY7KKOUK.js.map +7 -0
  89. package/dist/chunk-X5DQTPXT.js +3059 -0
  90. package/dist/chunk-X5DQTPXT.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-6AU6E4XZ.js +29126 -0
  104. package/dist/cli-main-6AU6E4XZ.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 +10 -12
  114. package/dist/execute-deps.d.ts.map +1 -1
  115. package/dist/execution-V26SE52F.js +4656 -0
  116. package/dist/execution-V26SE52F.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-BECGICEZ.js +547 -0
  182. package/dist/hq-BECGICEZ.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/project-root.d.ts +5 -0
  186. package/dist/hq-server/project-root.d.ts.map +1 -0
  187. package/dist/hq-server/routes/auth-handlers.d.ts +32 -0
  188. package/dist/hq-server/routes/auth-handlers.d.ts.map +1 -0
  189. package/dist/hq-server/routes/session-handlers.d.ts +8 -0
  190. package/dist/hq-server/routes/session-handlers.d.ts.map +1 -0
  191. package/dist/hq-server/routes.d.ts +2 -2
  192. package/dist/hq-server/routes.d.ts.map +1 -1
  193. package/dist/hq-server-FJOVOERO.js +39 -0
  194. package/dist/hq-server-FJOVOERO.js.map +7 -0
  195. package/dist/hq-server.d.ts.map +1 -1
  196. package/dist/hq-ttl-U2FAYFAT.js +8 -0
  197. package/dist/hq-ttl-U2FAYFAT.js.map +7 -0
  198. package/dist/hq-tunnel-YZLRONPV.js +111 -0
  199. package/dist/hq-tunnel-YZLRONPV.js.map +7 -0
  200. package/dist/index.d.ts +2 -1
  201. package/dist/index.d.ts.map +1 -1
  202. package/dist/index.js +2503 -53026
  203. package/dist/index.js.map +4 -4
  204. package/dist/init-E2NDDOHI.js +27 -0
  205. package/dist/init-E2NDDOHI.js.map +7 -0
  206. package/dist/kanban-dispatch-route.d.ts +14 -0
  207. package/dist/kanban-dispatch-route.d.ts.map +1 -0
  208. package/dist/kanban-hq-sync.d.ts +2 -0
  209. package/dist/kanban-hq-sync.d.ts.map +1 -1
  210. package/dist/kanban-run-mirror-EKVNGXWW.js +12 -0
  211. package/dist/kanban-run-mirror-EKVNGXWW.js.map +7 -0
  212. package/dist/live-settings-input.d.ts +69 -0
  213. package/dist/live-settings-input.d.ts.map +1 -0
  214. package/dist/mailbox-serve-2UWHEN3M.js +302 -0
  215. package/dist/mailbox-serve-2UWHEN3M.js.map +7 -0
  216. package/dist/mcp-CYLPUEHC.js +413 -0
  217. package/dist/mcp-CYLPUEHC.js.map +7 -0
  218. package/dist/modeldiag-HENYJ4N7.js +1290 -0
  219. package/dist/modeldiag-HENYJ4N7.js.map +7 -0
  220. package/dist/permissions-FNYLZIL4.js +115 -0
  221. package/dist/permissions-FNYLZIL4.js.map +7 -0
  222. package/dist/picker-key-state.d.ts +7 -0
  223. package/dist/picker-key-state.d.ts.map +1 -0
  224. package/dist/picker-model-picker.d.ts +6 -0
  225. package/dist/picker-model-picker.d.ts.map +1 -0
  226. package/dist/picker-ui.d.ts +17 -0
  227. package/dist/picker-ui.d.ts.map +1 -0
  228. package/dist/picker.d.ts +4 -37
  229. package/dist/picker.d.ts.map +1 -1
  230. package/dist/plugin-usage-OU6X6LM3.js +40 -0
  231. package/dist/plugin-usage-OU6X6LM3.js.map +7 -0
  232. package/dist/plugins-4LJ5IUBI.js +24 -0
  233. package/dist/plugins-4LJ5IUBI.js.map +7 -0
  234. package/dist/pre-launch.d.ts +0 -1
  235. package/dist/pre-launch.d.ts.map +1 -1
  236. package/dist/project-BLQ3ALVL.js +76 -0
  237. package/dist/project-BLQ3ALVL.js.map +7 -0
  238. package/dist/project-manifest-GE25PW4S.js +18 -0
  239. package/dist/project-manifest-GE25PW4S.js.map +7 -0
  240. package/dist/project-picker-BOCWHBXP.js +17 -0
  241. package/dist/project-picker-BOCWHBXP.js.map +7 -0
  242. package/dist/projects-XE76NFNZ.js +38 -0
  243. package/dist/projects-XE76NFNZ.js.map +7 -0
  244. package/dist/provider-helpers.d.ts +22 -6
  245. package/dist/provider-helpers.d.ts.map +1 -1
  246. package/dist/providers-models-GDELBHZK.js +589 -0
  247. package/dist/providers-models-GDELBHZK.js.map +7 -0
  248. package/dist/quick-VIO2BEHS.js +10 -0
  249. package/dist/quick-VIO2BEHS.js.map +7 -0
  250. package/dist/repl-auto-proceed.d.ts +19 -0
  251. package/dist/repl-auto-proceed.d.ts.map +1 -0
  252. package/dist/repl-client-registration.d.ts +7 -0
  253. package/dist/repl-client-registration.d.ts.map +1 -0
  254. package/dist/repl-input.d.ts +11 -0
  255. package/dist/repl-input.d.ts.map +1 -0
  256. package/dist/repl-options.d.ts +54 -0
  257. package/dist/repl-options.d.ts.map +1 -0
  258. package/dist/repl-rendering.d.ts +4 -0
  259. package/dist/repl-rendering.d.ts.map +1 -0
  260. package/dist/repl-suggestions.d.ts +21 -0
  261. package/dist/repl-suggestions.d.ts.map +1 -0
  262. package/dist/repl.d.ts +3 -162
  263. package/dist/repl.d.ts.map +1 -1
  264. package/dist/replay-KCTXNMZQ.js +75 -0
  265. package/dist/replay-KCTXNMZQ.js.map +7 -0
  266. package/dist/rewind-EJMVFVLS.js +185 -0
  267. package/dist/rewind-EJMVFVLS.js.map +7 -0
  268. package/dist/sdd-runtime-IKPROVV2.js +54 -0
  269. package/dist/sdd-runtime-IKPROVV2.js.map +7 -0
  270. package/dist/services/sdd/project-context.d.ts +1 -1
  271. package/dist/services/sdd/project-context.d.ts.map +1 -1
  272. package/dist/services/statusline-config.d.ts +1 -1
  273. package/dist/services/statusline-config.d.ts.map +1 -1
  274. package/dist/session-event-wiring.d.ts +2 -2
  275. package/dist/session-event-wiring.d.ts.map +1 -1
  276. package/dist/sessions-config-NLCMK3BY.js +409 -0
  277. package/dist/sessions-config-NLCMK3BY.js.map +7 -0
  278. package/dist/settings-menu.d.ts +3 -18
  279. package/dist/settings-menu.d.ts.map +1 -1
  280. package/dist/simpleui-dist-JIFGUJO7.js +93 -0
  281. package/dist/simpleui-dist-JIFGUJO7.js.map +7 -0
  282. package/dist/slash-commands/brain.d.ts.map +1 -1
  283. package/dist/slash-commands/clear.d.ts.map +1 -1
  284. package/dist/slash-commands/fallback.d.ts.map +1 -1
  285. package/dist/slash-commands/kanban-agent-helpers.d.ts +18 -0
  286. package/dist/slash-commands/kanban-agent-helpers.d.ts.map +1 -0
  287. package/dist/slash-commands/kanban-format.d.ts +16 -0
  288. package/dist/slash-commands/kanban-format.d.ts.map +1 -0
  289. package/dist/slash-commands/kanban-help.d.ts +2 -0
  290. package/dist/slash-commands/kanban-help.d.ts.map +1 -0
  291. package/dist/slash-commands/kanban.d.ts.map +1 -1
  292. package/dist/slash-commands/mailbox-demo.d.ts.map +1 -1
  293. package/dist/slash-commands/mailbox.d.ts +2 -1
  294. package/dist/slash-commands/mailbox.d.ts.map +1 -1
  295. package/dist/slash-commands/memory-compact.d.ts +5 -0
  296. package/dist/slash-commands/memory-compact.d.ts.map +1 -0
  297. package/dist/slash-commands/memory-flags.d.ts +36 -0
  298. package/dist/slash-commands/memory-flags.d.ts.map +1 -0
  299. package/dist/slash-commands/memory-formatters.d.ts +16 -0
  300. package/dist/slash-commands/memory-formatters.d.ts.map +1 -0
  301. package/dist/slash-commands/memory.d.ts.map +1 -1
  302. package/dist/slash-commands/mouse.d.ts +2 -2
  303. package/dist/slash-commands/review.d.ts.map +1 -1
  304. package/dist/slash-commands/sdd-command-helpers.d.ts +23 -0
  305. package/dist/slash-commands/sdd-command-helpers.d.ts.map +1 -0
  306. package/dist/slash-commands/sdd-format.d.ts +32 -0
  307. package/dist/slash-commands/sdd-format.d.ts.map +1 -0
  308. package/dist/slash-commands/sdd.d.ts.map +1 -1
  309. package/dist/subcommands/handlers/chronicle.d.ts.map +1 -1
  310. package/dist/subcommands/handlers/mailbox-serve.d.ts.map +1 -1
  311. package/dist/subcommands/handlers/model-smoke-test.d.ts +51 -0
  312. package/dist/subcommands/handlers/model-smoke-test.d.ts.map +1 -0
  313. package/dist/subcommands/handlers/modeldiag-profiles.d.ts +64 -0
  314. package/dist/subcommands/handlers/modeldiag-profiles.d.ts.map +1 -0
  315. package/dist/subcommands/handlers/modeldiag.d.ts.map +1 -1
  316. package/dist/subcommands/handlers/per-subcommand-deep-help-table.d.ts +3 -0
  317. package/dist/subcommands/handlers/per-subcommand-deep-help-table.d.ts.map +1 -0
  318. package/dist/subcommands/handlers/per-subcommand-help-data.d.ts +3 -0
  319. package/dist/subcommands/handlers/per-subcommand-help-data.d.ts.map +1 -0
  320. package/dist/subcommands/handlers/per-subcommand-help-table.d.ts +36 -0
  321. package/dist/subcommands/handlers/per-subcommand-help-table.d.ts.map +1 -0
  322. package/dist/subcommands/handlers/per-subcommand-help-types.d.ts +18 -0
  323. package/dist/subcommands/handlers/per-subcommand-help-types.d.ts.map +1 -0
  324. package/dist/subcommands/handlers/per-subcommand-help.d.ts +2 -80
  325. package/dist/subcommands/handlers/per-subcommand-help.d.ts.map +1 -1
  326. package/dist/subcommands/handlers/rewind.d.ts.map +1 -1
  327. package/dist/subcommands/index.d.ts +7 -0
  328. package/dist/subcommands/index.d.ts.map +1 -1
  329. package/dist/tools-skills-UNKLOB7M.js +29 -0
  330. package/dist/tools-skills-UNKLOB7M.js.map +7 -0
  331. package/dist/update-YC4TYW2Y.js +16 -0
  332. package/dist/update-YC4TYW2Y.js.map +7 -0
  333. package/dist/update-check-UMYTOH7Z.js +18 -0
  334. package/dist/update-check-UMYTOH7Z.js.map +7 -0
  335. package/dist/version-help-DROHZRW6.js +11 -0
  336. package/dist/version-help-DROHZRW6.js.map +7 -0
  337. package/dist/webui-server/connection-handler.d.ts.map +1 -1
  338. package/dist/webui-server/kanban-host-adapter.d.ts +5 -1
  339. package/dist/webui-server/kanban-host-adapter.d.ts.map +1 -1
  340. package/dist/webui-server/listen-helpers.d.ts +18 -0
  341. package/dist/webui-server/listen-helpers.d.ts.map +1 -0
  342. package/dist/webui-server/node-pty-loader.d.ts +6 -0
  343. package/dist/webui-server/node-pty-loader.d.ts.map +1 -0
  344. package/dist/webui-server-G3TISUIY.js +1459 -0
  345. package/dist/webui-server-G3TISUIY.js.map +7 -0
  346. package/dist/webui-server-options.d.ts +189 -0
  347. package/dist/webui-server-options.d.ts.map +1 -0
  348. package/dist/webui-server.d.ts +2 -178
  349. package/dist/webui-server.d.ts.map +1 -1
  350. package/dist/wiring/brain-and-orchestration.d.ts.map +1 -1
  351. package/dist/wiring/codebase-index.d.ts.map +1 -1
  352. package/dist/wiring/command-host-state.d.ts +4 -4
  353. package/dist/wiring/dep-watcher-bridge.d.ts +23 -0
  354. package/dist/wiring/dep-watcher-bridge.d.ts.map +1 -0
  355. package/dist/wiring/dep-watcher.d.ts.map +1 -1
  356. package/dist/wiring/hq-telemetry.d.ts +2 -2
  357. package/dist/wiring/lifecycle-plugins.d.ts +4 -3
  358. package/dist/wiring/lifecycle-plugins.d.ts.map +1 -1
  359. package/dist/wiring/mailbox-bridge-bootstrap.d.ts +1 -1
  360. package/dist/wiring/management-tools.d.ts +15 -0
  361. package/dist/wiring/management-tools.d.ts.map +1 -0
  362. package/dist/wiring/pipeline.d.ts +2 -1
  363. package/dist/wiring/pipeline.d.ts.map +1 -1
  364. package/dist/wiring/plugins.d.ts +1 -1
  365. package/dist/wiring/plugins.d.ts.map +1 -1
  366. package/dist/wiring/provider-runtime-setup.d.ts +14 -1
  367. package/dist/wiring/provider-runtime-setup.d.ts.map +1 -1
  368. package/dist/wiring/provider.d.ts.map +1 -1
  369. package/dist/wiring/runtime-controller-deps.d.ts +1 -1
  370. package/dist/wiring/runtime-controller-deps.d.ts.map +1 -1
  371. package/dist/wiring/sage.d.ts.map +1 -1
  372. package/dist/wiring/session-registry.d.ts +38 -0
  373. package/dist/wiring/session-registry.d.ts.map +1 -0
  374. package/dist/wiring/session.d.ts +7 -5
  375. package/dist/wiring/session.d.ts.map +1 -1
  376. package/dist/wiring/tools.d.ts.map +1 -1
  377. package/package.json +22 -22
  378. package/dist/cli-recovery-prompt.d.ts +0 -19
  379. package/dist/cli-recovery-prompt.d.ts.map +0 -1
  380. package/dist/first-run-auth-gate.d.ts +0 -20
  381. package/dist/first-run-auth-gate.d.ts.map +0 -1
  382. package/dist/pre-launch/indexing-question.d.ts +0 -28
  383. package/dist/pre-launch/indexing-question.d.ts.map +0 -1
@@ -0,0 +1,28 @@
1
+
2
+ // src/version.ts
3
+ import { createRequire } from "node:module";
4
+ var req = createRequire(import.meta.url);
5
+ function readOwnVersion() {
6
+ const candidates = ["../package.json", "../../package.json"];
7
+ for (const rel of candidates) {
8
+ try {
9
+ const pkg = req(rel);
10
+ if (typeof pkg.version === "string" && pkg.version.length > 0) return pkg.version;
11
+ } catch {
12
+ }
13
+ }
14
+ return "dev";
15
+ }
16
+ var CLI_VERSION = readOwnVersion();
17
+ var API_VERSION = "0.0.0";
18
+ try {
19
+ const corePkg = req("@wrongstack/core/package.json");
20
+ if (corePkg.wrongstackApiVersion) API_VERSION = corePkg.wrongstackApiVersion;
21
+ } catch {
22
+ }
23
+
24
+ export {
25
+ CLI_VERSION,
26
+ API_VERSION
27
+ };
28
+ //# sourceMappingURL=chunk-XJXDOF63.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/version.ts"],
4
+ "sourcesContent": ["import { createRequire } from 'node:module';\n\nconst req = createRequire(import.meta.url);\n\nfunction readOwnVersion(): string {\n const candidates = ['../package.json', '../../package.json'];\n for (const rel of candidates) {\n try {\n const pkg = req(rel) as { version?: unknown | undefined };\n if (typeof pkg.version === 'string' && pkg.version.length > 0) return pkg.version;\n } catch {\n // try next\n }\n }\n return 'dev';\n}\n\nexport const CLI_VERSION = readOwnVersion();\n\nlet API_VERSION = '0.0.0';\ntry {\n const corePkg = req('@wrongstack/core/package.json') as {\n wrongstackApiVersion?: string | undefined;\n };\n if (corePkg.wrongstackApiVersion) API_VERSION = corePkg.wrongstackApiVersion;\n} catch {\n /* fallback */\n}\n\nexport { API_VERSION };\n"],
5
+ "mappings": ";;;AAAA,SAAS,qBAAqB;AAE9B,IAAM,MAAM,cAAc,YAAY,GAAG;AAEzC,SAAS,iBAAyB;AAChC,QAAM,aAAa,CAAC,mBAAmB,oBAAoB;AAC3D,aAAW,OAAO,YAAY;AAC5B,QAAI;AACF,YAAM,MAAM,IAAI,GAAG;AACnB,UAAI,OAAO,IAAI,YAAY,YAAY,IAAI,QAAQ,SAAS,EAAG,QAAO,IAAI;AAAA,IAC5E,QAAQ;AAAA,IAER;AAAA,EACF;AACA,SAAO;AACT;AAEO,IAAM,cAAc,eAAe;AAE1C,IAAI,cAAc;AAClB,IAAI;AACF,QAAM,UAAU,IAAI,+BAA+B;AAGnD,MAAI,QAAQ,qBAAsB,eAAc,QAAQ;AAC1D,QAAQ;AAER;",
6
+ "names": []
7
+ }
@@ -0,0 +1,560 @@
1
+
2
+ // src/plugin-management.ts
3
+ import * as fs from "node:fs/promises";
4
+ import { atomicWrite } from "@wrongstack/core/utils";
5
+ import { OFFICIAL_PLUGIN_AUDIT_ENTRIES } from "@wrongstack/plugins/audit";
6
+ var HOST_PLUGIN_AUDIT_ENTRIES = [
7
+ {
8
+ name: "wstack-prompts",
9
+ risk: "medium",
10
+ summary: "Prompt library and prompt authoring commands.",
11
+ defaultState: "active",
12
+ canDisable: true
13
+ },
14
+ {
15
+ name: "wstack-sync",
16
+ risk: "medium",
17
+ summary: "Cloud sync commands for prompts, skills, settings, memory, and history.",
18
+ defaultState: "active",
19
+ canDisable: true
20
+ },
21
+ {
22
+ name: "wstack-git",
23
+ risk: "high",
24
+ summary: "Git commands for commit, status checks, and push.",
25
+ defaultState: "active",
26
+ canDisable: true
27
+ },
28
+ {
29
+ name: "wstack-observability",
30
+ risk: "low",
31
+ summary: "Runtime metrics and health slash commands.",
32
+ defaultState: "active",
33
+ canDisable: true
34
+ },
35
+ {
36
+ name: "wstack-chimera",
37
+ risk: "medium",
38
+ summary: "Spawns a post-session code review subagent when explicitly enabled.",
39
+ defaultState: "inactive",
40
+ canDisable: true
41
+ },
42
+ {
43
+ name: "wstack-skills",
44
+ risk: "medium",
45
+ summary: "Skill library, authoring, install, update, and uninstall commands.",
46
+ defaultState: "active",
47
+ canDisable: true
48
+ },
49
+ {
50
+ name: "wstack-plan",
51
+ risk: "medium",
52
+ summary: "Strategic plan board slash command.",
53
+ defaultState: "active",
54
+ canDisable: true
55
+ },
56
+ {
57
+ name: "@wrongstack/plug-lsp",
58
+ risk: "medium",
59
+ summary: "Language Server Protocol tools and slash commands.",
60
+ defaultState: "inactive",
61
+ canDisable: true
62
+ },
63
+ {
64
+ name: "telegram",
65
+ risk: "medium",
66
+ summary: "Telegram bridge for messages, approvals, and notifications.",
67
+ defaultState: "inactive",
68
+ canDisable: true
69
+ }
70
+ ];
71
+ var PLUGIN_AUDIT_ENTRIES = Object.freeze([
72
+ ...HOST_PLUGIN_AUDIT_ENTRIES,
73
+ ...OFFICIAL_PLUGIN_AUDIT_ENTRIES
74
+ ]);
75
+ var OFFICIAL_PLUGINS = [
76
+ {
77
+ alias: "telegram",
78
+ specifier: "@wrongstack/telegram",
79
+ description: "Telegram bridge for prompts, notifications, and slash commands."
80
+ },
81
+ {
82
+ alias: "lsp",
83
+ specifier: "@wrongstack/plug-lsp",
84
+ description: "Language Server Protocol tools for code intelligence."
85
+ }
86
+ ];
87
+ var OFFICIAL_ALIASES = new Map(
88
+ OFFICIAL_PLUGINS.flatMap((p) => [
89
+ [p.alias, p.specifier],
90
+ [p.specifier, p.specifier]
91
+ ])
92
+ );
93
+ async function runPluginManagementCommand(args, deps) {
94
+ const sub = args[0];
95
+ if (!sub || sub === "list" || sub === "status") {
96
+ return {
97
+ code: 0,
98
+ level: "output",
99
+ message: renderConfiguredPlugins(deps.config)
100
+ };
101
+ }
102
+ if (sub === "official" || sub === "officials") {
103
+ return {
104
+ code: 0,
105
+ level: "output",
106
+ message: renderOfficialPlugins(deps.config)
107
+ };
108
+ }
109
+ if (sub === "report" || sub === "audit" || sub === "menu") {
110
+ return {
111
+ code: 0,
112
+ level: "output",
113
+ message: renderPluginAuditReport(deps.config)
114
+ };
115
+ }
116
+ if (sub === "add" || sub === "install") {
117
+ const spec = args[1];
118
+ if (!spec) {
119
+ return errorResult("Usage: wstack plugin add <specifier|official-alias> [--disabled]");
120
+ }
121
+ return upsertPlugin(
122
+ resolvePluginSpecifier(spec),
123
+ { enabled: !args.includes("--disabled") },
124
+ deps,
125
+ "Added"
126
+ );
127
+ }
128
+ if (sub === "remove" || sub === "rm" || sub === "uninstall") {
129
+ const spec = args[1];
130
+ if (!spec) {
131
+ return errorResult("Usage: wstack plugin remove <specifier|official-alias>");
132
+ }
133
+ return removePlugin(resolvePluginSpecifier(spec), deps);
134
+ }
135
+ if (sub === "enable" || sub === "disable") {
136
+ const spec = args[1];
137
+ if (!spec) {
138
+ return errorResult(`Usage: wstack plugin ${sub} <specifier|official-alias>`);
139
+ }
140
+ return upsertPlugin(
141
+ resolvePluginSpecifier(spec),
142
+ { enabled: sub === "enable" },
143
+ deps,
144
+ sub === "enable" ? "Enabled" : "Disabled"
145
+ );
146
+ }
147
+ if (sub === "toggle") {
148
+ const spec = args[1];
149
+ if (!spec) {
150
+ return errorResult("Usage: wstack plugin toggle <plugin-name|official-alias>");
151
+ }
152
+ return togglePlugin(resolvePluginToggleSpecifier(spec), deps);
153
+ }
154
+ if (sub === "manager") {
155
+ return runPluginManagerPolicyCommand(args.slice(1), deps);
156
+ }
157
+ if (sub === "llm") {
158
+ return runPluginLlmCommand(args.slice(1), deps);
159
+ }
160
+ return errorResult(
161
+ `Unknown plugin subcommand: ${sub}
162
+ Usage: wstack plugin [list|status|report|menu|official|add|install|remove|enable|disable|toggle|manager|llm]`
163
+ );
164
+ }
165
+ var PLUGIN_MANAGER_POLICY_USAGE = [
166
+ "Usage:",
167
+ " wstack plugin manager List plugins locked against LLM state changes.",
168
+ " wstack plugin manager lock <plugin|*> Prevent plugin_manager from enabling/disabling it.",
169
+ " wstack plugin manager unlock <plugin|*> Restore plugin_manager enable/disable access.",
170
+ "",
171
+ "This policy affects only the LLM-facing plugin_manager tool. Human /plugin and",
172
+ "wstack plugin enable/disable commands remain available."
173
+ ].join("\n");
174
+ async function runPluginManagerPolicyCommand(args, deps) {
175
+ const action = args[0] ?? "list";
176
+ if (action === "list") {
177
+ const locked = deps.config.pluginManager?.locked ?? [];
178
+ return {
179
+ code: 0,
180
+ level: "output",
181
+ message: locked.length === 0 ? "LLM plugin-manager policy: no plugins are locked." : `LLM plugin-manager policy \u2014 locked (${locked.length}):
182
+ ${locked.map((name2) => ` ${name2}`).join("\n")}`
183
+ };
184
+ }
185
+ if (action !== "lock" && action !== "unlock") {
186
+ return errorResult(PLUGIN_MANAGER_POLICY_USAGE);
187
+ }
188
+ const rawName = args[1];
189
+ if (!rawName) return errorResult(PLUGIN_MANAGER_POLICY_USAGE);
190
+ const name = rawName === "*" ? "*" : resolvePluginToggleSpecifier(rawName);
191
+ const existing = await readConfig(deps.configPath);
192
+ const filePolicy = isRecord(existing.pluginManager) ? existing.pluginManager : void 0;
193
+ const current = Array.isArray(filePolicy?.["locked"]) ? filePolicy["locked"].filter((entry) => typeof entry === "string") : [...deps.config.pluginManager?.locked ?? []];
194
+ const canonical = canonicalPolicyName(name);
195
+ const next = action === "lock" ? current.some((entry) => canonicalPolicyName(entry) === canonical) ? current : [...current, name] : current.filter((entry) => canonicalPolicyName(entry) !== canonical);
196
+ const pluginManager = { locked: next };
197
+ existing.pluginManager = { ...filePolicy ?? {}, ...pluginManager };
198
+ await atomicWrite(deps.configPath, JSON.stringify(existing, null, 2), { mode: 384 });
199
+ return {
200
+ code: 0,
201
+ level: "info",
202
+ message: action === "lock" ? `Locked "${name}" against LLM enable/disable changes. Human plugin commands still work.` : `Unlocked "${name}" for LLM enable/disable changes.`,
203
+ patch: { pluginManager }
204
+ };
205
+ }
206
+ function canonicalPolicyName(name) {
207
+ if (name === "*") return name;
208
+ return resolvePluginToggleSpecifier(name).trim().toLowerCase();
209
+ }
210
+ var PLUGIN_LLM_USAGE = [
211
+ "Usage:",
212
+ " wstack plugin llm List every per-plugin LLM override.",
213
+ " wstack plugin llm <plugin> Show one plugin's LLM override.",
214
+ " wstack plugin llm <plugin> <provider> [model] Route this plugin through a provider (and model).",
215
+ " wstack plugin llm <plugin> - <model> Keep the session provider, override only the model.",
216
+ " wstack plugin llm <plugin> --clear Remove the override (back to the session default).",
217
+ "",
218
+ "The override is stored as config.extensions.<plugin>.llm and is used by",
219
+ "every api.llm call the plugin makes. Without an override, plugins follow",
220
+ "the active session provider/model (the chat leader)."
221
+ ].join("\n");
222
+ function renderPluginLlmOverviews(config, sessionDefault) {
223
+ const rows = [];
224
+ for (const [pluginName2, ext] of Object.entries(config.extensions ?? {})) {
225
+ const llm = ext?.["llm"];
226
+ if (llm && typeof llm === "object") {
227
+ const o = llm;
228
+ rows.push({
229
+ name: pluginName2,
230
+ provider: o.provider ?? "(session)",
231
+ model: o.model ?? "(session)"
232
+ });
233
+ }
234
+ }
235
+ const lines = [`Per-plugin LLM routing (session default: ${sessionDefault}):`];
236
+ if (rows.length === 0) {
237
+ lines.push(
238
+ " No plugin overrides \u2014 every plugin follows the session default.",
239
+ " Set one with: wstack plugin llm <plugin> <provider> [model]"
240
+ );
241
+ } else {
242
+ rows.sort((a, b) => a.name.localeCompare(b.name));
243
+ for (const r of rows) {
244
+ lines.push(` ${r.name.padEnd(24)} provider=${r.provider.padEnd(16)} model=${r.model}`);
245
+ }
246
+ lines.push("", "Clear one with: wstack plugin llm <plugin> --clear");
247
+ }
248
+ return lines.join("\n");
249
+ }
250
+ async function runPluginLlmCommand(args, deps) {
251
+ const sessionDefault = `${deps.config.provider ?? "?"} / ${deps.config.model ?? "?"}`;
252
+ if (args.length === 0 || args[0] === "list") {
253
+ return {
254
+ code: 0,
255
+ level: "output",
256
+ message: renderPluginLlmOverviews(deps.config, sessionDefault)
257
+ };
258
+ }
259
+ const name = args[0];
260
+ if (!name || name.startsWith("-")) return errorResult(PLUGIN_LLM_USAGE);
261
+ const currentOverride = deps.config.extensions?.[name]?.["llm"];
262
+ if (args.length === 1) {
263
+ const lines = [`LLM routing for plugin "${name}":`];
264
+ if (currentOverride && typeof currentOverride === "object") {
265
+ const o = currentOverride;
266
+ lines.push(
267
+ ` override: provider=${o.provider ?? "(session)"} model=${o.model ?? "(session)"}`,
268
+ ` session default: ${sessionDefault}`
269
+ );
270
+ } else {
271
+ lines.push(
272
+ ` no override \u2014 follows the session default (${sessionDefault}).`,
273
+ ` Set one with: wstack plugin llm ${name} <provider> [model]`
274
+ );
275
+ }
276
+ return { code: 0, level: "output", message: lines.join("\n") };
277
+ }
278
+ const existing = await readConfig(deps.configPath);
279
+ const fileExtensions = isRecord(existing.extensions) ? existing.extensions : {};
280
+ const pluginExt = isRecord(fileExtensions[name]) ? { ...fileExtensions[name] } : {};
281
+ if (args[1] === "--clear" || args[1] === "clear") {
282
+ if (!("llm" in pluginExt) && !currentOverride) {
283
+ return { code: 0, level: "info", message: `Plugin "${name}" has no LLM override.` };
284
+ }
285
+ delete pluginExt["llm"];
286
+ if (Object.keys(pluginExt).length === 0) delete fileExtensions[name];
287
+ else fileExtensions[name] = pluginExt;
288
+ existing.extensions = fileExtensions;
289
+ await atomicWrite(deps.configPath, JSON.stringify(existing, null, 2), { mode: 384 });
290
+ const merged2 = mergeExtensionsForPatch(deps.config, fileExtensions);
291
+ const mergedEntry = merged2[name];
292
+ if (mergedEntry) {
293
+ delete mergedEntry["llm"];
294
+ if (Object.keys(mergedEntry).length === 0) delete merged2[name];
295
+ }
296
+ return {
297
+ code: 0,
298
+ level: "info",
299
+ message: `Cleared LLM override for "${name}" \u2014 it now follows the session default (${sessionDefault}). Takes effect immediately for api.llm calls.`,
300
+ patch: { extensions: merged2 }
301
+ };
302
+ }
303
+ const providerArg = args[1];
304
+ const modelArg = args[2];
305
+ if (!providerArg || providerArg.startsWith("--")) return errorResult(PLUGIN_LLM_USAGE);
306
+ const provider = providerArg === "-" ? void 0 : providerArg;
307
+ const model = modelArg && modelArg !== "-" ? modelArg : void 0;
308
+ if (!provider && !model) return errorResult(PLUGIN_LLM_USAGE);
309
+ const llm = {};
310
+ if (provider) llm["provider"] = provider;
311
+ if (model) llm["model"] = model;
312
+ pluginExt["llm"] = llm;
313
+ fileExtensions[name] = pluginExt;
314
+ existing.extensions = fileExtensions;
315
+ await atomicWrite(deps.configPath, JSON.stringify(existing, null, 2), { mode: 384 });
316
+ const configured = Object.keys(deps.config.providers ?? {});
317
+ const note = provider && configured.length > 0 && !configured.includes(provider) ? `
318
+ Note: "${provider}" is not in config.providers (configured: ${configured.join(", ")}). Catalog providers (anthropic, openai, \u2026) still resolve if credentials are available.` : "";
319
+ const merged = mergeExtensionsForPatch(deps.config, fileExtensions);
320
+ return {
321
+ code: 0,
322
+ level: "info",
323
+ message: `Plugin "${name}" now routes api.llm calls via provider=${provider ?? "(session)"} model=${model ?? "(session)"}. Session default stays ${sessionDefault}. Takes effect immediately for api.llm calls.${note}`,
324
+ patch: { extensions: merged }
325
+ };
326
+ }
327
+ function mergeExtensionsForPatch(config, fileExtensions) {
328
+ const merged = {};
329
+ for (const [k, v] of Object.entries(config.extensions ?? {})) {
330
+ merged[k] = { ...v };
331
+ }
332
+ for (const [k, v] of Object.entries(fileExtensions)) {
333
+ if (isRecord(v)) merged[k] = { ...merged[k] ?? {}, ...v };
334
+ }
335
+ for (const k of Object.keys(merged)) {
336
+ if (!(k in fileExtensions) && !(k in (config.extensions ?? {}))) delete merged[k];
337
+ }
338
+ return merged;
339
+ }
340
+ function resolvePluginSpecifier(input) {
341
+ return OFFICIAL_ALIASES.get(input.toLowerCase()) ?? input;
342
+ }
343
+ function resolvePluginToggleSpecifier(input) {
344
+ if (input.toLowerCase() === "@wrongstack/telegram") return "telegram";
345
+ if (auditEntryFor(input)) return input;
346
+ return resolvePluginSpecifier(input);
347
+ }
348
+ function renderOfficialPlugins(config) {
349
+ return [
350
+ "Official plugins:",
351
+ ...OFFICIAL_PLUGINS.map((p) => {
352
+ const state = config ? officialPluginState(config, p.specifier) : "";
353
+ const status = state ? `${state.padEnd(14)} ` : "";
354
+ return ` ${p.alias.padEnd(12)} ${status}${p.specifier.padEnd(24)} ${p.description}`;
355
+ }),
356
+ "",
357
+ "Use `wstack plugin add <alias>` or `/plugin install <alias>`."
358
+ ].join("\n");
359
+ }
360
+ function renderConfiguredPlugins(config) {
361
+ const plugins = config.plugins ?? [];
362
+ if (plugins.length === 0) {
363
+ return [
364
+ "No plugins configured.",
365
+ "Use `wstack plugin add <specifier>` or `/plugin install <official-alias>`."
366
+ ].join("\n");
367
+ }
368
+ return plugins.map((p) => {
369
+ const name = pluginName(p);
370
+ const enabled = typeof p === "object" && p.enabled === false ? "disabled" : "enabled";
371
+ const official = OFFICIAL_PLUGINS.find((entry) => entry.specifier === name);
372
+ const suffix = official ? ` (${official.alias})` : "";
373
+ return ` ${`${name}${suffix}`.padEnd(44)} ${enabled}`;
374
+ }).join("\n");
375
+ }
376
+ function renderPluginAuditReport(config) {
377
+ const configured = config.plugins ?? [];
378
+ const lines = [
379
+ "Plugin audit report:",
380
+ " State shows the effective boot state. Default-active plugins run unless disabled in config.",
381
+ " Built-in audit rows are toggleable unless a future row explicitly marks itself locked.",
382
+ "",
383
+ " Built-in audit entries:"
384
+ ];
385
+ for (const entry of PLUGIN_AUDIT_ENTRIES) {
386
+ const { state, source } = effectiveAuditState(config, entry);
387
+ const policy = entry.canDisable ? "toggleable" : lockedReason(entry);
388
+ lines.push(
389
+ ` ${entry.name.padEnd(24)} ${state.padEnd(8)} ${source.padEnd(8)} risk=${entry.risk.padEnd(6)} ${policy.padEnd(24)} ${entry.summary}`
390
+ );
391
+ }
392
+ const extra = configured.filter(
393
+ (plugin) => !PLUGIN_AUDIT_ENTRIES.some((entry) => pluginMatchesToggleSpec(plugin, entry.name))
394
+ );
395
+ if (extra.length > 0) {
396
+ lines.push("", " Configured plugins outside the audit list:");
397
+ for (const plugin of extra) {
398
+ const name = pluginName(plugin);
399
+ const state = typeof plugin === "object" && plugin.enabled === false ? "disabled" : "enabled";
400
+ lines.push(
401
+ ` ${name.padEnd(24)} ${state.padEnd(8)} config risk=custom user-configured plugin`
402
+ );
403
+ }
404
+ }
405
+ lines.push(
406
+ "",
407
+ "Use `/plugin menu` in the TUI, or `wstack plugin toggle <name>` for toggleable rows."
408
+ );
409
+ return lines.join("\n");
410
+ }
411
+ async function readConfig(file) {
412
+ try {
413
+ return JSON.parse(await fs.readFile(file, "utf8"));
414
+ } catch {
415
+ return {};
416
+ }
417
+ }
418
+ function pluginName(p) {
419
+ return typeof p === "string" ? p : p.name;
420
+ }
421
+ function pluginEntry(spec, enabled) {
422
+ return enabled ? spec : { name: spec, enabled: false };
423
+ }
424
+ function pluginMatchesToggleSpec(p, spec) {
425
+ const name = pluginName(p);
426
+ if (spec === "telegram") return name === "telegram" || name === "@wrongstack/telegram";
427
+ return name === spec;
428
+ }
429
+ function effectiveAuditState(config, entry) {
430
+ const configured = (config.plugins ?? []).find(
431
+ (plugin) => pluginMatchesToggleSpec(plugin, entry.name)
432
+ );
433
+ if (configured) {
434
+ return {
435
+ state: typeof configured === "object" && configured.enabled === false ? "disabled" : "enabled",
436
+ source: "config"
437
+ };
438
+ }
439
+ return {
440
+ state: entry.defaultState === "active" ? "enabled" : "disabled",
441
+ source: "default"
442
+ };
443
+ }
444
+ function lockedReason(entry) {
445
+ if (entry.canDisable) return "toggleable";
446
+ if (entry.name === "secret-scanner") {
447
+ return "locked: safety guard";
448
+ }
449
+ return "locked: core surface";
450
+ }
451
+ function auditEntryFor(spec) {
452
+ return PLUGIN_AUDIT_ENTRIES.find((entry) => entry.name === spec);
453
+ }
454
+ function officialPluginState(config, spec) {
455
+ const match = (config.plugins ?? []).find((p) => pluginName(p) === spec);
456
+ if (!match) return "not configured";
457
+ return typeof match === "object" && match.enabled === false ? "disabled" : "enabled";
458
+ }
459
+ async function togglePlugin(spec, deps) {
460
+ const auditEntry = auditEntryFor(spec);
461
+ if (auditEntry?.canDisable === false) {
462
+ return errorResult(`Plugin "${spec}" is locked and cannot be toggled from the plugin menu.`);
463
+ }
464
+ const existing = await readConfig(deps.configPath);
465
+ const plugins = Array.isArray(existing.plugins) ? existing.plugins : [];
466
+ const idx = plugins.findIndex((p) => pluginMatchesToggleSpec(p, spec));
467
+ const configured = idx >= 0 ? plugins[idx] : void 0;
468
+ const enabled = configured ? !(typeof configured === "object" && configured.enabled === false) : auditEntry?.defaultState === "active";
469
+ if (!configured && !auditEntry) {
470
+ return errorResult(
471
+ `Plugin "${spec}" is not configured. Use "wstack plugin add ${spec}" first.`
472
+ );
473
+ }
474
+ let nextPlugins;
475
+ let nextEnabled;
476
+ if (enabled) {
477
+ nextEnabled = false;
478
+ nextPlugins = plugins.filter((p) => !pluginMatchesToggleSpec(p, spec));
479
+ if (auditEntry?.defaultState !== "inactive") {
480
+ nextPlugins.push({ name: spec, enabled: false });
481
+ }
482
+ } else {
483
+ nextEnabled = true;
484
+ if (auditEntry?.defaultState === "active") {
485
+ nextPlugins = plugins.filter((p) => !pluginMatchesToggleSpec(p, spec));
486
+ } else {
487
+ nextPlugins = plugins.filter((p) => !pluginMatchesToggleSpec(p, spec));
488
+ nextPlugins.push(spec);
489
+ }
490
+ }
491
+ const features = {
492
+ ...isRecord(deps.config.features) ? deps.config.features : {},
493
+ ...isRecord(existing.features) ? existing.features : {},
494
+ plugins: true
495
+ };
496
+ existing.plugins = nextPlugins;
497
+ existing.features = features;
498
+ await atomicWrite(deps.configPath, JSON.stringify(existing, null, 2), { mode: 384 });
499
+ const restartRequired = spec === "branch-guard" && !nextEnabled ? void 0 : true;
500
+ return {
501
+ code: 0,
502
+ level: "info",
503
+ message: `${nextEnabled ? "Enabled" : "Disabled"} "${spec}". Config written to ${deps.configPath}.` + (spec === "branch-guard" && !nextEnabled ? " The running branch-guard hook will disable itself on config update." : ""),
504
+ patch: { plugins: nextPlugins, features },
505
+ restartRequired
506
+ };
507
+ }
508
+ async function upsertPlugin(spec, opts, deps, verb) {
509
+ const existing = await readConfig(deps.configPath);
510
+ const plugins = Array.isArray(existing.plugins) ? existing.plugins : [];
511
+ const idx = plugins.findIndex((p) => pluginName(p) === spec);
512
+ const nextEntry = pluginEntry(spec, opts.enabled);
513
+ if (idx >= 0) plugins[idx] = nextEntry;
514
+ else plugins.push(nextEntry);
515
+ const features = {
516
+ ...isRecord(deps.config.features) ? deps.config.features : {},
517
+ ...isRecord(existing.features) ? existing.features : {},
518
+ plugins: true
519
+ };
520
+ existing.plugins = plugins;
521
+ existing.features = features;
522
+ await atomicWrite(deps.configPath, JSON.stringify(existing, null, 2), { mode: 384 });
523
+ const restartRequired = spec === "branch-guard" && !opts.enabled ? void 0 : true;
524
+ return {
525
+ code: 0,
526
+ level: "info",
527
+ message: `${verb} "${spec}" (${opts.enabled ? "enabled" : "disabled"}). Config written to ${deps.configPath}.` + (spec === "branch-guard" && !opts.enabled ? " The running branch-guard hook will disable itself on config update." : ""),
528
+ patch: { plugins, features },
529
+ restartRequired
530
+ };
531
+ }
532
+ async function removePlugin(spec, deps) {
533
+ const existing = await readConfig(deps.configPath);
534
+ const plugins = Array.isArray(existing.plugins) ? existing.plugins : [];
535
+ const next = plugins.filter((p) => pluginName(p) !== spec);
536
+ if (next.length === plugins.length) {
537
+ return errorResult(`Plugin "${spec}" not in config.`);
538
+ }
539
+ existing.plugins = next;
540
+ await atomicWrite(deps.configPath, JSON.stringify(existing, null, 2), { mode: 384 });
541
+ return {
542
+ code: 0,
543
+ level: "info",
544
+ message: `Removed "${spec}" from config.`,
545
+ patch: { plugins: next },
546
+ restartRequired: true
547
+ };
548
+ }
549
+ function errorResult(message) {
550
+ return { code: 1, level: "error", message };
551
+ }
552
+ function isRecord(value) {
553
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
554
+ }
555
+
556
+ export {
557
+ PLUGIN_AUDIT_ENTRIES,
558
+ runPluginManagementCommand
559
+ };
560
+ //# sourceMappingURL=chunk-XWEGWYDU.js.map