@webpresso/agent-kit 3.1.28 → 3.2.0

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.

Potentially problematic release.


This version of @webpresso/agent-kit might be problematic. Click here for more details.

Files changed (329) hide show
  1. package/README.md +53 -15
  2. package/bin/_run.js +179 -19
  3. package/catalog/AGENTS.md.tpl +6 -6
  4. package/catalog/agent/agents/implementer.md +45 -0
  5. package/catalog/agent/rules/ci-cost-local-first.md +139 -0
  6. package/catalog/agent/rules/ci-test-perf.md +5 -1
  7. package/catalog/agent/rules/cmd-execution.md +9 -0
  8. package/catalog/agent/rules/parallel-orchestration-quota.md +100 -0
  9. package/catalog/agent/rules/pre-implementation.md +30 -2
  10. package/catalog/agent/rules/supported-agent-clis.md +9 -0
  11. package/catalog/agent/rules/test-scan-perf.md +80 -0
  12. package/catalog/agent/rules/typescript-version.md +50 -0
  13. package/catalog/agent/rules/workflow-skills-routing.md +4 -2
  14. package/catalog/agent/skills/codex/SKILL.md +25 -1
  15. package/catalog/agent/skills/fix/SKILL.md +3 -0
  16. package/catalog/agent/skills/verify/SKILL.md +22 -2
  17. package/catalog/docs/templates/blueprint.md +1 -1
  18. package/dist/esm/audit/agents.js +1 -0
  19. package/dist/esm/audit/blueprint-lifecycle-sql.d.ts +12 -0
  20. package/dist/esm/audit/blueprint-lifecycle-sql.js +23 -2
  21. package/dist/esm/audit/blueprint-pr-coverage.js +72 -7
  22. package/dist/esm/audit/ci-guardrails-wiring.d.ts +22 -0
  23. package/dist/esm/audit/ci-guardrails-wiring.js +90 -0
  24. package/dist/esm/audit/ci-test-perf.js +30 -0
  25. package/dist/esm/audit/command-surface.js +4 -2
  26. package/dist/esm/audit/host-substitution-risk.d.ts +2 -0
  27. package/dist/esm/audit/host-substitution-risk.js +256 -0
  28. package/dist/esm/audit/registry.d.ts +4 -4
  29. package/dist/esm/audit/registry.js +11 -1
  30. package/dist/esm/audit/roadmap-links.js +6 -0
  31. package/dist/esm/audit/test-scan-perf.d.ts +18 -0
  32. package/dist/esm/audit/test-scan-perf.js +275 -0
  33. package/dist/esm/audit/toolchain-isolation.js +1 -2
  34. package/dist/esm/audit/typescript-version.d.ts +2 -0
  35. package/dist/esm/audit/typescript-version.js +123 -0
  36. package/dist/esm/blueprint/core/parser.js +43 -1
  37. package/dist/esm/blueprint/core/validation/criteria.d.ts +14 -0
  38. package/dist/esm/blueprint/core/validation/criteria.js +41 -2
  39. package/dist/esm/blueprint/core/validation/state.js +25 -14
  40. package/dist/esm/blueprint/db/migrations/run.js +4 -2
  41. package/dist/esm/blueprint/lifecycle/audit.d.ts +20 -0
  42. package/dist/esm/blueprint/lifecycle/audit.js +65 -10
  43. package/dist/esm/blueprint/lifecycle/canonicalize.d.ts +6 -0
  44. package/dist/esm/blueprint/lifecycle/canonicalize.js +135 -0
  45. package/dist/esm/blueprint/lifecycle/engine.d.ts +9 -0
  46. package/dist/esm/blueprint/lifecycle/engine.js +53 -6
  47. package/dist/esm/blueprint/lifecycle/local.d.ts +2 -1
  48. package/dist/esm/blueprint/lifecycle/local.js +19 -3
  49. package/dist/esm/blueprint/lifecycle/review-provenance.d.ts +6 -0
  50. package/dist/esm/blueprint/lifecycle/review-provenance.js +118 -12
  51. package/dist/esm/blueprint/markdown/helpers.js +6 -2
  52. package/dist/esm/blueprint/service/BlueprintCreationService.d.ts +1 -0
  53. package/dist/esm/blueprint/service/BlueprintCreationService.js +53 -4
  54. package/dist/esm/blueprint/service/blueprint-tech-debt-links.js +16 -2
  55. package/dist/esm/blueprint/trust/command-runner.d.ts +26 -0
  56. package/dist/esm/blueprint/trust/command-runner.js +148 -0
  57. package/dist/esm/blueprint/trust/gates.d.ts +7 -0
  58. package/dist/esm/blueprint/trust/gates.js +20 -0
  59. package/dist/esm/blueprint/trust/promotion.d.ts +8 -0
  60. package/dist/esm/blueprint/trust/promotion.js +62 -112
  61. package/dist/esm/blueprint/trust/scaffold.d.ts +19 -0
  62. package/dist/esm/blueprint/trust/scaffold.js +64 -0
  63. package/dist/esm/blueprint/trust/validator.d.ts +1 -0
  64. package/dist/esm/blueprint/trust/validator.js +7 -1
  65. package/dist/esm/blueprint/utils/archive.js +27 -5
  66. package/dist/esm/blueprint/utils/document-paths.d.ts +18 -0
  67. package/dist/esm/blueprint/utils/document-paths.js +45 -12
  68. package/dist/esm/build/cli-mcp-parity.js +10 -0
  69. package/dist/esm/ci/act-replay.js +110 -7
  70. package/dist/esm/ci/act-runner.d.ts +4 -0
  71. package/dist/esm/ci/act-runner.js +85 -26
  72. package/dist/esm/ci/act-worktree-git.d.ts +11 -0
  73. package/dist/esm/ci/act-worktree-git.js +219 -0
  74. package/dist/esm/cli/bundle/commands/blueprint.d.ts +1 -0
  75. package/dist/esm/cli/bundle/commands/blueprint.js +1 -0
  76. package/dist/esm/cli/cli.d.ts +1 -1
  77. package/dist/esm/cli/cli.js +34 -0
  78. package/dist/esm/cli/commands/agent-launch.d.ts +6 -1
  79. package/dist/esm/cli/commands/agent-launch.js +82 -4
  80. package/dist/esm/cli/commands/audit-core.d.ts +1 -1
  81. package/dist/esm/cli/commands/audit-core.js +8 -1
  82. package/dist/esm/cli/commands/audit.js +20 -5
  83. package/dist/esm/cli/commands/blueprint/execution.js +18 -6
  84. package/dist/esm/cli/commands/blueprint/mutations.js +83 -47
  85. package/dist/esm/cli/commands/blueprint/router-dispatch.d.ts +2 -1
  86. package/dist/esm/cli/commands/blueprint/router-dispatch.js +20 -1
  87. package/dist/esm/cli/commands/blueprint/router-output.d.ts +21 -0
  88. package/dist/esm/cli/commands/blueprint/router-output.js +48 -17
  89. package/dist/esm/cli/commands/blueprint/router.d.ts +7 -0
  90. package/dist/esm/cli/commands/blueprint/router.js +40 -3
  91. package/dist/esm/cli/commands/ci-preflight.d.ts +13 -2
  92. package/dist/esm/cli/commands/ci-preflight.js +6 -3
  93. package/dist/esm/cli/commands/ci.d.ts +8 -1
  94. package/dist/esm/cli/commands/ci.js +80 -21
  95. package/dist/esm/cli/commands/compile.js +5 -31
  96. package/dist/esm/cli/commands/dash/delivery-status.d.ts +1 -0
  97. package/dist/esm/cli/commands/dash/delivery-status.js +11 -4
  98. package/dist/esm/cli/commands/dash/keymap.js +1 -0
  99. package/dist/esm/cli/commands/dash/launch-preferences.d.ts +15 -0
  100. package/dist/esm/cli/commands/dash/launch-preferences.js +46 -17
  101. package/dist/esm/cli/commands/dash/plan-once-label.d.ts +7 -0
  102. package/dist/esm/cli/commands/dash/plan-once-label.js +5 -0
  103. package/dist/esm/cli/commands/dash/plan-once-membership.d.ts +67 -0
  104. package/dist/esm/cli/commands/dash/plan-once-membership.js +151 -0
  105. package/dist/esm/cli/commands/dash/plan-once-merge.d.ts +143 -0
  106. package/dist/esm/cli/commands/dash/plan-once-merge.js +238 -0
  107. package/dist/esm/cli/commands/dash/plan-once.d.ts +22 -2
  108. package/dist/esm/cli/commands/dash/plan-once.js +41 -4
  109. package/dist/esm/cli/commands/dash/tui/attention-hud.d.ts +9 -0
  110. package/dist/esm/cli/commands/dash/tui/attention-hud.js +9 -0
  111. package/dist/esm/cli/commands/dash/tui/chat-bridge.d.ts +41 -0
  112. package/dist/esm/cli/commands/dash/tui/chat-bridge.js +73 -0
  113. package/dist/esm/cli/commands/dash/tui/chat-mode.d.ts +47 -0
  114. package/dist/esm/cli/commands/dash/tui/chat-mode.js +98 -0
  115. package/dist/esm/cli/commands/dash/tui/frame.d.ts +3 -0
  116. package/dist/esm/cli/commands/dash/tui/frame.js +3 -1
  117. package/dist/esm/cli/commands/dash/tui/palette.d.ts +1 -1
  118. package/dist/esm/cli/commands/dash/tui/palette.js +14 -0
  119. package/dist/esm/cli/commands/dash/tui/runtime.js +239 -4
  120. package/dist/esm/cli/commands/dash/tui/state.d.ts +41 -0
  121. package/dist/esm/cli/commands/dash/tui/state.js +257 -4
  122. package/dist/esm/cli/commands/doctor.js +5 -0
  123. package/dist/esm/cli/commands/format.js +0 -2
  124. package/dist/esm/cli/commands/hook.d.ts +5 -0
  125. package/dist/esm/cli/commands/hook.js +15 -9
  126. package/dist/esm/cli/commands/init/config.d.ts +0 -1
  127. package/dist/esm/cli/commands/init/config.js +3 -6
  128. package/dist/esm/cli/commands/init/convergence-apply.d.ts +24 -0
  129. package/dist/esm/cli/commands/init/convergence-apply.js +221 -0
  130. package/dist/esm/cli/commands/init/convergence-state.d.ts +13 -0
  131. package/dist/esm/cli/commands/init/convergence-state.js +54 -0
  132. package/dist/esm/cli/commands/init/convergence.d.ts +23 -0
  133. package/dist/esm/cli/commands/init/convergence.js +57 -0
  134. package/dist/esm/cli/commands/init/git-convergence.d.ts +19 -0
  135. package/dist/esm/cli/commands/init/git-convergence.js +168 -0
  136. package/dist/esm/cli/commands/init/gitignore-patcher.js +2 -0
  137. package/dist/esm/cli/commands/init/grok-privacy-smoke.d.ts +52 -0
  138. package/dist/esm/cli/commands/init/grok-privacy-smoke.js +91 -0
  139. package/dist/esm/cli/commands/init/host-native-proof.d.ts +18 -0
  140. package/dist/esm/cli/commands/init/host-native-proof.js +88 -0
  141. package/dist/esm/cli/commands/init/host-visibility.d.ts +2 -2
  142. package/dist/esm/cli/commands/init/host-visibility.js +94 -5
  143. package/dist/esm/cli/commands/init/index.d.ts +1 -0
  144. package/dist/esm/cli/commands/init/index.js +326 -173
  145. package/dist/esm/cli/commands/init/mcp-spec.d.ts +57 -0
  146. package/dist/esm/cli/commands/init/mcp-spec.js +273 -0
  147. package/dist/esm/cli/commands/init/merge.d.ts +1 -0
  148. package/dist/esm/cli/commands/init/merge.js +30 -1
  149. package/dist/esm/cli/commands/init/plugin-cache-prune.d.ts +0 -3
  150. package/dist/esm/cli/commands/init/plugin-cache-prune.js +0 -1
  151. package/dist/esm/cli/commands/init/scaffold-agents-md.d.ts +1 -1
  152. package/dist/esm/cli/commands/init/scaffold-agents-md.js +9 -3
  153. package/dist/esm/cli/commands/init/scaffold-base-kit.d.ts +11 -0
  154. package/dist/esm/cli/commands/init/scaffold-base-kit.js +56 -1
  155. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/emitters/claude.d.ts +5 -6
  156. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/emitters/claude.js +6 -13
  157. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/emitters/grok.d.ts +14 -8
  158. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/emitters/grok.js +41 -24
  159. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/index.d.ts +2 -0
  160. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/index.js +51 -23
  161. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/ir.d.ts +0 -2
  162. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/ir.js +0 -2
  163. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/merge.d.ts +6 -3
  164. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/merge.js +39 -26
  165. package/dist/esm/cli/commands/init/scaffolders/codex-mcp/index.d.ts +12 -31
  166. package/dist/esm/cli/commands/init/scaffolders/codex-mcp/index.js +297 -173
  167. package/dist/esm/cli/commands/init/scaffolders/file-transaction.d.ts +7 -0
  168. package/dist/esm/cli/commands/init/scaffolders/file-transaction.js +58 -0
  169. package/dist/esm/cli/commands/init/scaffolders/grok-mcp/index.d.ts +38 -0
  170. package/dist/esm/cli/commands/init/scaffolders/grok-mcp/index.js +73 -0
  171. package/dist/esm/cli/commands/init/scaffolders/opencode-plugin/index.d.ts +21 -0
  172. package/dist/esm/cli/commands/init/scaffolders/opencode-plugin/index.js +559 -63
  173. package/dist/esm/cli/commands/init/untracked-collision.d.ts +14 -0
  174. package/dist/esm/cli/commands/init/untracked-collision.js +42 -0
  175. package/dist/esm/cli/commands/logs.d.ts +15 -0
  176. package/dist/esm/cli/commands/logs.js +192 -3
  177. package/dist/esm/cli/commands/opencode-rotate.d.ts +49 -0
  178. package/dist/esm/cli/commands/opencode-rotate.js +135 -0
  179. package/dist/esm/cli/commands/public-readiness.d.ts +11 -0
  180. package/dist/esm/cli/commands/public-readiness.js +42 -0
  181. package/dist/esm/cli/commands/quality-log-store.d.ts +1 -0
  182. package/dist/esm/cli/commands/quality-log-store.js +187 -51
  183. package/dist/esm/cli/commands/review.d.ts +35 -3
  184. package/dist/esm/cli/commands/review.js +734 -217
  185. package/dist/esm/cli/commands/run-wait.d.ts +2 -0
  186. package/dist/esm/cli/commands/run-wait.js +122 -0
  187. package/dist/esm/cli/commands/secrets.d.ts +1 -0
  188. package/dist/esm/cli/commands/secrets.js +4 -1
  189. package/dist/esm/cli/commands/setup-help.js +1 -1
  190. package/dist/esm/cli/commands/setup-repair-help.js +1 -1
  191. package/dist/esm/cli/commands/worktree/router-dispatch.js +13 -8
  192. package/dist/esm/cli/direct-provider-launch.js +31 -3
  193. package/dist/esm/cli/optional-tool-freshness.d.ts +27 -0
  194. package/dist/esm/cli/optional-tool-freshness.js +219 -9
  195. package/dist/esm/daemon/domains/git-actions.d.ts +29 -0
  196. package/dist/esm/daemon/domains/git-actions.js +136 -0
  197. package/dist/esm/daemon/domains/run-registry-interop.d.ts +16 -0
  198. package/dist/esm/daemon/domains/run-registry-interop.js +45 -0
  199. package/dist/esm/daemon/domains/sessions-search.d.ts +11 -0
  200. package/dist/esm/daemon/domains/sessions-search.js +29 -0
  201. package/dist/esm/daemon/handlers/blueprints-handlers.d.ts +5 -0
  202. package/dist/esm/daemon/handlers/blueprints-handlers.js +36 -0
  203. package/dist/esm/daemon/handlers/deploy-handlers.d.ts +6 -0
  204. package/dist/esm/daemon/handlers/deploy-handlers.js +5 -0
  205. package/dist/esm/daemon/handlers/fleet-handlers.d.ts +15 -0
  206. package/dist/esm/daemon/handlers/fleet-handlers.js +91 -0
  207. package/dist/esm/daemon/handlers/git-handlers.d.ts +6 -0
  208. package/dist/esm/daemon/handlers/git-handlers.js +27 -0
  209. package/dist/esm/daemon/handlers/product.d.ts +7 -0
  210. package/dist/esm/daemon/handlers/product.js +10 -119
  211. package/dist/esm/daemon/handlers/sessions-handlers.d.ts +12 -0
  212. package/dist/esm/daemon/handlers/sessions-handlers.js +31 -0
  213. package/dist/esm/daemon/handlers/shared.d.ts +5 -0
  214. package/dist/esm/daemon/handlers/shared.js +16 -0
  215. package/dist/esm/daemon/methods.d.ts +8 -1
  216. package/dist/esm/daemon/methods.js +7 -0
  217. package/dist/esm/daemon/protocol/contract.d.ts +43 -0
  218. package/dist/esm/daemon/protocol/contract.js +26 -0
  219. package/dist/esm/daemon/protocol/index.d.ts +1 -1
  220. package/dist/esm/daemon/protocol/index.js +1 -1
  221. package/dist/esm/hooks/__conformance__/matrix.d.ts +6 -0
  222. package/dist/esm/hooks/__conformance__/matrix.js +137 -0
  223. package/dist/esm/hooks/conformance/batch.js +5 -0
  224. package/dist/esm/hooks/doctor.d.ts +15 -0
  225. package/dist/esm/hooks/doctor.js +79 -8
  226. package/dist/esm/hooks/permission-request/index.js +9 -3
  227. package/dist/esm/hooks/permission-request/policy.d.ts +9 -0
  228. package/dist/esm/hooks/permission-request/policy.js +13 -0
  229. package/dist/esm/hooks/pretool-guard/dev-routing.d.ts +9 -0
  230. package/dist/esm/hooks/pretool-guard/dev-routing.js +41 -5
  231. package/dist/esm/hooks/pretool-guard/logger.d.ts +7 -0
  232. package/dist/esm/hooks/pretool-guard/logger.js +16 -0
  233. package/dist/esm/hooks/pretool-guard/runner.d.ts +6 -0
  234. package/dist/esm/hooks/pretool-guard/runner.js +68 -16
  235. package/dist/esm/hooks/pretool-guard/validators/blueprint.js +30 -10
  236. package/dist/esm/hooks/pretool-guard/validators/forbidden-commands.js +58 -4
  237. package/dist/esm/hooks/pretool-guard/validators/index.d.ts +7 -0
  238. package/dist/esm/hooks/pretool-guard/validators/index.js +21 -0
  239. package/dist/esm/hooks/pretool-guard/validators/mcp-redirect.d.ts +0 -1
  240. package/dist/esm/hooks/pretool-guard/validators/mcp-redirect.js +8 -5
  241. package/dist/esm/hooks/pretool-guard/validators/path-contract.d.ts +19 -0
  242. package/dist/esm/hooks/pretool-guard/validators/path-contract.js +25 -8
  243. package/dist/esm/hooks/pretool-guard/validators/worktree-discipline.d.ts +9 -7
  244. package/dist/esm/hooks/pretool-guard/validators/worktree-discipline.js +126 -14
  245. package/dist/esm/hooks/shared/guard-outcome.d.ts +149 -0
  246. package/dist/esm/hooks/shared/guard-outcome.js +215 -0
  247. package/dist/esm/hooks/shared/hook-bootstrap.d.ts +26 -0
  248. package/dist/esm/hooks/shared/hook-bootstrap.js +64 -1
  249. package/dist/esm/hooks/shared/types.d.ts +8 -5
  250. package/dist/esm/hooks/shared/types.js +23 -8
  251. package/dist/esm/hooks/stop/qa-changed-files.d.ts +11 -0
  252. package/dist/esm/hooks/stop/qa-changed-files.js +74 -0
  253. package/dist/esm/mcp/blueprint/_shared/lifecycle.js +14 -1
  254. package/dist/esm/mcp/blueprint/handlers/document-mutations.js +78 -4
  255. package/dist/esm/mcp/blueprint/handlers/review-log.js +8 -1
  256. package/dist/esm/mcp/blueprint/handlers/task-advance.js +113 -54
  257. package/dist/esm/mcp/blueprint/handlers/task-verify.js +39 -19
  258. package/dist/esm/mcp/blueprint/registration.js +3 -2
  259. package/dist/esm/mcp/server.d.ts +1 -0
  260. package/dist/esm/mcp/server.js +27 -0
  261. package/dist/esm/mcp/tools/_names.d.ts +1 -1
  262. package/dist/esm/mcp/tools/_names.js +5 -0
  263. package/dist/esm/mcp/tools/_registry.js +10 -0
  264. package/dist/esm/mcp/tools/_shared/audit-kinds.d.ts +1 -1
  265. package/dist/esm/mcp/tools/_shared/result.js +44 -1
  266. package/dist/esm/mcp/tools/audit.d.ts +5 -1
  267. package/dist/esm/mcp/tools/audit.js +40 -0
  268. package/dist/esm/mcp/tools/audits.d.ts +4 -0
  269. package/dist/esm/mcp/tools/ci-act.js +9 -11
  270. package/dist/esm/mcp/tools/ci-preflight.d.ts +50 -0
  271. package/dist/esm/mcp/tools/ci-preflight.js +183 -0
  272. package/dist/esm/mcp/tools/pr-upsert.js +39 -1
  273. package/dist/esm/mcp/tools/review-run.d.ts +28 -0
  274. package/dist/esm/mcp/tools/review-run.js +216 -0
  275. package/dist/esm/mcp/tools/run-wait.d.ts +86 -0
  276. package/dist/esm/mcp/tools/run-wait.js +593 -0
  277. package/dist/esm/mcp/tools/session-id.d.ts +3 -0
  278. package/dist/esm/mcp/tools/session-id.js +45 -0
  279. package/dist/esm/mcp/tools/session-info.d.ts +3 -0
  280. package/dist/esm/mcp/tools/session-info.js +49 -0
  281. package/dist/esm/output-transforms/audit.d.ts +23 -0
  282. package/dist/esm/output-transforms/audit.js +47 -0
  283. package/dist/esm/output-transforms/index.js +2 -0
  284. package/dist/esm/paths/state-root.js +3 -0
  285. package/dist/esm/review/authority.js +30 -7
  286. package/dist/esm/review/availability.d.ts +22 -0
  287. package/dist/esm/review/availability.js +123 -23
  288. package/dist/esm/review/delivery-verifier.d.ts +27 -0
  289. package/dist/esm/review/delivery-verifier.js +115 -0
  290. package/dist/esm/review/events.d.ts +3 -2
  291. package/dist/esm/review/events.js +23 -3
  292. package/dist/esm/review/execution/adapters.js +26 -9
  293. package/dist/esm/review/execution/output-policy.d.ts +2 -0
  294. package/dist/esm/review/execution/output-policy.js +12 -0
  295. package/dist/esm/review/execution/review-checkout.js +87 -6
  296. package/dist/esm/review/execution/supervisor.js +5 -0
  297. package/dist/esm/review/execution/types.d.ts +8 -0
  298. package/dist/esm/review/opencode-account.d.ts +24 -0
  299. package/dist/esm/review/opencode-account.js +68 -0
  300. package/dist/esm/review/opencode-auth.d.ts +33 -0
  301. package/dist/esm/review/opencode-auth.js +79 -0
  302. package/dist/esm/review/subject.d.ts +27 -0
  303. package/dist/esm/review/subject.js +179 -32
  304. package/dist/esm/runtime/executor.d.ts +1 -0
  305. package/dist/esm/runtime/executor.js +2 -1
  306. package/dist/esm/runtime/opencode-account-materializer.d.ts +34 -0
  307. package/dist/esm/runtime/opencode-account-materializer.js +33 -0
  308. package/dist/esm/secret-gate/runner.d.ts +1 -0
  309. package/dist/esm/secret-gate/runner.js +4 -1
  310. package/dist/esm/status/snapshot.js +30 -19
  311. package/dist/esm/test/duration-sequencer.d.ts +20 -0
  312. package/dist/esm/test/duration-sequencer.js +54 -0
  313. package/dist/esm/test/shard-durations.json +922 -0
  314. package/dist/esm/test/worker-budget.d.ts +6 -0
  315. package/dist/esm/test/worker-budget.js +59 -1
  316. package/dist/esm/test-helpers/global-setup.d.ts +1 -1
  317. package/dist/esm/test-helpers/global-setup.js +68 -24
  318. package/dist/esm/ultragoal/service.d.ts +7 -0
  319. package/dist/esm/ultragoal/service.js +42 -2
  320. package/dist/esm/utils/write-json-file.js +3 -1
  321. package/dist/esm/worktrees/codex-project-trust.d.ts +15 -0
  322. package/dist/esm/worktrees/codex-project-trust.js +56 -0
  323. package/dist/esm/worktrees/current.d.ts +1 -0
  324. package/dist/esm/worktrees/current.js +1 -0
  325. package/dist/esm/worktrees/project-agent-surfaces.d.ts +1 -0
  326. package/dist/esm/worktrees/project-agent-surfaces.js +2 -1
  327. package/dist/esm/worktrees/registry.d.ts +8 -0
  328. package/dist/esm/worktrees/registry.js +18 -3
  329. package/package.json +18 -15
@@ -7,6 +7,7 @@ import { CONTROL_PLANE_HOSTS } from "#cli/commands/dash/tui/hosts.js";
7
7
  import { isWizardProvider } from "#cli/commands/dash/session-wizard.js";
8
8
  import { browserOverlayLines, createBlueprintBrowser, reduceBlueprintBrowserKey, } from "#cli/commands/dash/tui/browser.js";
9
9
  import { filterWorktreePickerItems } from "#cli/commands/dash/worktree-picker.js";
10
+ import { DEFAULT_CONTROL_PLANE_CHAT_MODE, reduceChatModeSwitch, toggleControlPlaneChatMode, } from "#cli/commands/dash/tui/chat-mode.js";
10
11
  export function createInitialTuiState(input) {
11
12
  const menu = {
12
13
  selectedKey: input.agents[0] ? `group:${input.agents[0].key ?? "claude"}` : null,
@@ -16,6 +17,10 @@ export function createInitialTuiState(input) {
16
17
  menu: reconcileSelection(menu, input.agents),
17
18
  agents: input.agents,
18
19
  permissionMode: input.permissionMode,
20
+ chatMode: input.chatMode ?? DEFAULT_CONTROL_PLANE_CHAT_MODE,
21
+ chatSession: null,
22
+ chatDraft: "",
23
+ chatOpenGeneration: 0,
19
24
  overlay: { kind: "none" },
20
25
  status: null,
21
26
  warnings: [],
@@ -53,7 +58,7 @@ export function reduceTuiKey(state, key) {
53
58
  if (state.overlay.kind === "help") {
54
59
  if (key.kind === "escape" ||
55
60
  (key.kind === "char" && (key.value === "?" || key.value === "q"))) {
56
- return { state: { ...state, overlay: { kind: "none" } }, effects: [] };
61
+ return { state: dismissTransientOverlay(state), effects: [] };
57
62
  }
58
63
  return { state, effects: [] };
59
64
  }
@@ -63,6 +68,10 @@ export function reduceTuiKey(state, key) {
63
68
  if (state.overlay.kind === "browser" && state.browser) {
64
69
  return reduceBrowserKey(state, key);
65
70
  }
71
+ // Integrated-chat overlay uses browser chrome without blueprint browser state.
72
+ if (state.overlay.kind === "browser" && !state.browser && state.chatMode === "integrated-chat") {
73
+ return reduceIntegratedChatKey(state, key);
74
+ }
66
75
  if (state.overlay.kind === "wizard" && state.wizard) {
67
76
  return reduceWizardKey(state, key);
68
77
  }
@@ -110,6 +119,19 @@ export function reduceTuiKey(state, key) {
110
119
  effects: [{ kind: "launch", command: "wp fleet watch", provider: "fleet", newRun: true }],
111
120
  };
112
121
  }
122
+ if (key.kind === "char" && key.value === "m") {
123
+ return {
124
+ state: {
125
+ ...state,
126
+ browser: null,
127
+ overlay: { kind: "browser", title: "Plan-once merge", lines: ["loading…"] },
128
+ },
129
+ effects: [{ kind: "palette-command", id: "merge.status" }],
130
+ };
131
+ }
132
+ if (key.kind === "char" && key.value === "c") {
133
+ return toggleChatMode(state);
134
+ }
113
135
  if (key.kind === "char" && key.value === "n") {
114
136
  const provider = wizardProviderFromSelection(state) ?? "claude";
115
137
  const blocked = hostBlockedReason(state, provider);
@@ -269,7 +291,7 @@ function reducePaletteKey(state, key) {
269
291
  const { query, cursor } = state.overlay;
270
292
  const matches = filterPaletteCommands(query);
271
293
  if (key.kind === "escape" || (key.kind === "ctrl" && key.value === "c")) {
272
- return { state: { ...state, overlay: { kind: "none" } }, effects: [] };
294
+ return { state: dismissTransientOverlay(state), effects: [] };
273
295
  }
274
296
  if (key.kind === "backspace") {
275
297
  const nextQuery = query.slice(0, -1);
@@ -310,8 +332,9 @@ function reducePaletteKey(state, key) {
310
332
  if (key.kind === "enter") {
311
333
  const command = matches[cursor];
312
334
  if (!command)
313
- return { state: { ...state, overlay: { kind: "none" } }, effects: [] };
314
- return applyPaletteCommand({ ...state, overlay: { kind: "none" } }, command.id);
335
+ return { state: dismissTransientOverlay(state), effects: [] };
336
+ // Dismiss palette first; integrated-chat restores compose overlay when still active.
337
+ return applyPaletteCommand(dismissTransientOverlay(state), command.id);
315
338
  }
316
339
  if (key.kind === "char") {
317
340
  const nextQuery = query + key.value;
@@ -433,6 +456,21 @@ export function applyPaletteCommand(state, id) {
433
456
  return reduceTuiKey(state, { kind: "char", value: "b" });
434
457
  case "fleet.open":
435
458
  return reduceTuiKey(state, { kind: "char", value: "f" });
459
+ case "merge.status":
460
+ return reduceTuiKey(state, { kind: "char", value: "m" });
461
+ case "chat.mode.toggle":
462
+ return toggleChatMode(state);
463
+ case "chat.mode.open":
464
+ // Runtime-owned open; pure path only re-emits when already requesting open.
465
+ return {
466
+ state,
467
+ effects: [{ kind: "palette-command", id: "chat.mode.open" }],
468
+ };
469
+ case "chat.mode.send":
470
+ return {
471
+ state,
472
+ effects: [{ kind: "palette-command", id: "chat.mode.send" }],
473
+ };
436
474
  case "permission.toggle":
437
475
  return reduceTuiKey(state, { kind: "char", value: "d" });
438
476
  case "help.open":
@@ -445,6 +483,221 @@ export function applyPaletteCommand(state, id) {
445
483
  return { state, effects: [] };
446
484
  }
447
485
  }
486
+ /**
487
+ * Toggle host-pane ↔ integrated-chat. Integrated chat requires an ACP-capable
488
+ * selected host and an existing dash run identity (no second registry).
489
+ */
490
+ export function toggleChatMode(state) {
491
+ if (state.chatMode === "integrated-chat") {
492
+ return leaveIntegratedChat(state);
493
+ }
494
+ const host = selectedDashProvider(state);
495
+ const target = toggleControlPlaneChatMode(state.chatMode);
496
+ const decision = reduceChatModeSwitch({
497
+ mode: state.chatMode,
498
+ target,
499
+ host,
500
+ });
501
+ if (!decision.ok) {
502
+ // Refused: no persist effect.
503
+ return { state: { ...state, status: decision.error }, effects: [] };
504
+ }
505
+ const run = closeTargetFromState(state);
506
+ if (!run?.runId) {
507
+ return {
508
+ state: {
509
+ ...state,
510
+ status: "Select a host session (run) before switching to integrated chat",
511
+ },
512
+ effects: [],
513
+ };
514
+ }
515
+ const nextGen = state.chatOpenGeneration + 1;
516
+ return {
517
+ state: {
518
+ ...state,
519
+ chatMode: "integrated-chat",
520
+ chatDraft: "",
521
+ chatOpenGeneration: nextGen,
522
+ browser: null,
523
+ wizard: null,
524
+ status: "mode:integrated-chat (opening…)",
525
+ overlay: {
526
+ kind: "browser",
527
+ title: "Integrated chat",
528
+ lines: ["opening chat bridge…", "type to compose · ⏎ send · esc → host-pane"],
529
+ },
530
+ },
531
+ // Persist after bridge open succeeds in runtime; open effect only here.
532
+ effects: [{ kind: "palette-command", id: "chat.mode.open" }],
533
+ };
534
+ }
535
+ /**
536
+ * After agents load: if preferred is integrated-chat and gates pass, apply the
537
+ * normal toggle path once. Never forces integrated-chat chrome without host/run.
538
+ */
539
+ export function applyPreferredChatModeSeed(state, preferred) {
540
+ if (preferred === "host-pane") {
541
+ if (state.chatMode === "host-pane")
542
+ return { state, effects: [] };
543
+ return leaveIntegratedChat(state);
544
+ }
545
+ // preferred integrated-chat
546
+ if (state.chatMode === "integrated-chat")
547
+ return { state, effects: [] };
548
+ return toggleChatMode(state);
549
+ }
550
+ function leaveIntegratedChat(state) {
551
+ return {
552
+ state: {
553
+ ...state,
554
+ chatMode: "host-pane",
555
+ chatSession: null,
556
+ chatDraft: "",
557
+ // Bump generation so in-flight open/send cannot re-enter chat mode.
558
+ chatOpenGeneration: state.chatOpenGeneration + 1,
559
+ overlay: { kind: "none" },
560
+ browser: null,
561
+ status: "mode:host-pane",
562
+ },
563
+ effects: [{ kind: "persist-chat-mode", mode: "host-pane" }],
564
+ };
565
+ }
566
+ function reduceIntegratedChatKey(state, key) {
567
+ // Escape (or Ctrl+C with empty draft) returns to host-pane. Printable `c` is
568
+ // a normal composer character so operators can type freely.
569
+ if (key.kind === "escape") {
570
+ return leaveIntegratedChat(state);
571
+ }
572
+ // Empty draft: pass through menu global chords (?, q, palette, help).
573
+ if (state.chatDraft.length === 0) {
574
+ if (key.kind === "ctrl" && (key.value === "p" || key.value === "k")) {
575
+ return {
576
+ state: { ...state, overlay: { kind: "palette", query: "", cursor: 0 } },
577
+ effects: [],
578
+ };
579
+ }
580
+ if (key.kind === "ctrl" && key.value === "x") {
581
+ return { state: { ...state, overlay: { kind: "help" } }, effects: [] };
582
+ }
583
+ if (key.kind === "char" && key.value === "q") {
584
+ return { state: { ...state, quit: true }, effects: [{ kind: "quit" }] };
585
+ }
586
+ if (key.kind === "char" && key.value === "?") {
587
+ return { state: { ...state, overlay: { kind: "help" } }, effects: [] };
588
+ }
589
+ }
590
+ if (key.kind === "ctrl" && key.value === "c") {
591
+ if (state.chatDraft.length === 0)
592
+ return leaveIntegratedChat(state);
593
+ return {
594
+ state: withChatOverlay({ ...state, chatDraft: "" }),
595
+ effects: [],
596
+ };
597
+ }
598
+ if (key.kind === "backspace") {
599
+ if (state.chatDraft.length === 0)
600
+ return { state, effects: [] };
601
+ return {
602
+ state: withChatOverlay({ ...state, chatDraft: state.chatDraft.slice(0, -1) }),
603
+ effects: [],
604
+ };
605
+ }
606
+ if (key.kind === "enter") {
607
+ const text = state.chatDraft.trim();
608
+ if (!text) {
609
+ return { state: { ...state, status: "type a message before send" }, effects: [] };
610
+ }
611
+ if (!state.chatSession) {
612
+ return {
613
+ state: { ...state, status: "chat session not open yet" },
614
+ effects: [],
615
+ };
616
+ }
617
+ // Keep draft until runtime drains it after send.
618
+ return {
619
+ state: {
620
+ ...withChatOverlay({
621
+ ...state,
622
+ chatDraft: text,
623
+ status: "sending…",
624
+ }),
625
+ },
626
+ effects: [{ kind: "palette-command", id: "chat.mode.send" }],
627
+ };
628
+ }
629
+ if (key.kind === "char") {
630
+ const nextDraft = state.chatDraft + key.value;
631
+ return {
632
+ state: withChatOverlay({ ...state, chatDraft: nextDraft }),
633
+ effects: [],
634
+ };
635
+ }
636
+ return { state, effects: [] };
637
+ }
638
+ function withChatOverlay(state) {
639
+ return {
640
+ ...state,
641
+ overlay: {
642
+ kind: "browser",
643
+ title: "Integrated chat",
644
+ lines: formatIntegratedChatLines(state),
645
+ },
646
+ };
647
+ }
648
+ /** Dismiss help/palette without stranding integrated-chat (restore browser compose overlay). */
649
+ function dismissTransientOverlay(state) {
650
+ if (state.chatMode === "integrated-chat") {
651
+ return withChatOverlay(state);
652
+ }
653
+ return { ...state, overlay: { kind: "none" } };
654
+ }
655
+ function formatIntegratedChatLines(state) {
656
+ const session = state.chatSession;
657
+ const body = session
658
+ ? [
659
+ `chat · ${session.host} · run ${session.runId.slice(0, 8)}`,
660
+ session.label ? `label · ${session.label}` : "label · —",
661
+ "scope · integrated-chat (⏎ send · esc → host-pane)",
662
+ "─".repeat(32),
663
+ ...session.messages.map((msg) => {
664
+ const tag = msg.role === "user" ? "you" : msg.role === "assistant" ? "host" : "sys";
665
+ return `${tag} · ${msg.text}`;
666
+ }),
667
+ ]
668
+ : ["opening chat bridge…"];
669
+ return [...body, "", `compose> ${state.chatDraft}█`];
670
+ }
671
+ function selectedDashProvider(state) {
672
+ const host = wizardProviderFromSelection(state);
673
+ return host && isDashProvider(host) ? host : null;
674
+ }
675
+ /** Runtime applies hermetic/real bridge result into state + overlay. */
676
+ export function applyChatBridgeSession(state, session, error, options = {}) {
677
+ // Stale completion: operator already left or re-entered chat.
678
+ if (options.expectedGeneration !== undefined &&
679
+ options.expectedGeneration !== state.chatOpenGeneration) {
680
+ return state;
681
+ }
682
+ if (error || !session) {
683
+ return {
684
+ ...state,
685
+ chatMode: "host-pane",
686
+ chatSession: null,
687
+ chatDraft: "",
688
+ overlay: { kind: "none" },
689
+ status: error ?? "chat bridge failed",
690
+ };
691
+ }
692
+ const next = {
693
+ ...state,
694
+ chatMode: "integrated-chat",
695
+ chatSession: session,
696
+ browser: null,
697
+ status: `mode:integrated-chat · ${session.host}`,
698
+ };
699
+ return withChatOverlay(next);
700
+ }
448
701
  /** Open the worktree/permission wizard with a real wizard object (not overlay-only). */
449
702
  export function openLaunchWizard(state, provider) {
450
703
  return {
@@ -1,4 +1,5 @@
1
1
  import { auditBlueprintLifecycleSql } from "#audit/blueprint-lifecycle-sql";
2
+ import { auditCiGuardrailsWiring } from "#audit/ci-guardrails-wiring";
2
3
  import { readConfig } from "#cli/commands/init/config";
3
4
  import { auditCatalogDrift, auditDocsFrontmatter, formatRepoAuditReport, } from "#audit/repo-guardrails";
4
5
  import { countWorktreeLifecycleScripts } from "#worktrees/lifecycle-scripts.js";
@@ -7,6 +8,9 @@ const REMEDIATIONS = {
7
8
  "Catalog drift — single package (no workspace file)": "none needed",
8
9
  "Docs frontmatter": "wp audit docs-frontmatter --fix",
9
10
  "Blueprint lifecycle": "wp audit blueprint-lifecycle",
11
+ // Name the missing invocation explicitly so an operator sees which CI step to
12
+ // restore, not just a generic "drifted" signal.
13
+ "CI guardrails wiring": "restore the `wp audit guardrails` CI step (run `wp setup`)",
10
14
  };
11
15
  export async function runDoctor(options = {}) {
12
16
  try {
@@ -17,6 +21,7 @@ export async function runDoctor(options = {}) {
17
21
  docsRoot: options.docsRoot,
18
22
  fix: options.fix,
19
23
  }),
24
+ auditCiGuardrailsWiring(root),
20
25
  await auditBlueprintLifecycleSql(root, { includeRuntimePlans: options.runtimePlans }),
21
26
  ];
22
27
  let failed = false;
@@ -19,8 +19,6 @@ const OXFMT_EXTENSIONS = new Set([
19
19
  ".json",
20
20
  ".md",
21
21
  ".mdx",
22
- ".sh",
23
- ".tmpl",
24
22
  ".yaml",
25
23
  ".yml",
26
24
  ]);
@@ -1,4 +1,9 @@
1
1
  import type { CAC } from "cac";
2
+ /**
3
+ * Registered GUARD_* codes emitted by the hook-command fail-closed path.
4
+ * Consumed by the guard-outcome registry-completeness test.
5
+ */
6
+ export declare const HOOK_FALLBACK_GUARD_CODES: readonly ["GUARD_PRETOOL_FAILURE"];
2
7
  declare const HOOK_NAMES: readonly ["pretool-guard", "post-tool", "stop-qa", "stop-ultragoal", "guard-switch", "sessionstart-routing", "precompact-snapshot", "permission-request", "test-quality-check"];
3
8
  export type HookName = (typeof HOOK_NAMES)[number];
4
9
  export declare function isHookName(value: string): value is HookName;
@@ -2,8 +2,16 @@ import { performance } from "node:perf_hooks";
2
2
  import { reportHookDegradation, takeHookDegradation, } from "#hooks/errors/index.js";
3
3
  import { recordHookInvocation, summarizeHookText, takeRememberedHookStdin, } from "#hooks/logs/store.js";
4
4
  import { createSyntheticProcessExit, isSyntheticProcessExit, } from "#hooks/shared/synthetic-process-exit.js";
5
- import { writeHookOutput } from "#hooks/shared/hook-bootstrap";
5
+ import { writeGuardStderr, writeHookOutput } from "#hooks/shared/hook-bootstrap";
6
+ import { formatGuardReason } from "#hooks/shared/guard-outcome.js";
6
7
  import { buildDenyEnvelope } from "#hooks/shared/types.js";
8
+ /**
9
+ * Registered GUARD_* codes emitted by the hook-command fail-closed path.
10
+ * Consumed by the guard-outcome registry-completeness test.
11
+ */
12
+ export const HOOK_FALLBACK_GUARD_CODES = [
13
+ "GUARD_PRETOOL_FAILURE",
14
+ ];
7
15
  import { resolveHookProjectDirFromText } from "#hooks/shared/project-dir.js";
8
16
  import { createManagedHookExecutionContext, } from "#hooks/shared/session-memory-deadline.js";
9
17
  const HOOK_NAMES = [
@@ -101,13 +109,9 @@ function exitCodeFrom(value) {
101
109
  }
102
110
  function writePretoolDeny(reason) {
103
111
  writeHookOutput(`${JSON.stringify(buildDenyEnvelope({ reason }))}\n`);
104
- // Best-effort stderr reason for Claude/Codex exit-2 UX (may be suppressed in some runners).
105
- try {
106
- process.stderr.write(`${reason}\n`);
107
- }
108
- catch {
109
- // ignore
110
- }
112
+ // Deliver to the REAL stderr too: Claude reads stderr on an exit-2 PreToolUse
113
+ // deny, and it is suppressed for decorative output.
114
+ writeGuardStderr(`${reason}\n`);
111
115
  }
112
116
  function emitFallback(name, error) {
113
117
  const metadata = HOOK_METADATA[name];
@@ -121,7 +125,9 @@ function emitFallback(name, error) {
121
125
  detail,
122
126
  });
123
127
  if (metadata.fallback === "fail-closed-deny") {
124
- writePretoolDeny(`webpresso pretool guard failed: ${detail}`);
128
+ // Coded fail-closed denial so the host still sees a stable GUARD_ code even
129
+ // when the guard handler itself threw.
130
+ writePretoolDeny(formatGuardReason("GUARD_PRETOOL_FAILURE", `webpresso pretool guard failed: ${detail}`));
125
131
  // Exit 2 so Grok (and exit-code runners) treat fail-closed as an explicit deny.
126
132
  return 2;
127
133
  }
@@ -27,7 +27,6 @@ export interface AgentkitConfig {
27
27
  visibility?: Record<string, Record<string, VisibilityStatus>>;
28
28
  };
29
29
  mcp?: {
30
- serverName?: string;
31
30
  toolPrefix?: string;
32
31
  };
33
32
  /** Pretool-guard routing policy. `mechanism` lives in agent-kit; this is the
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
6
6
  import { isAbsolute, join, normalize } from "node:path";
7
- import { REQUIRED_CORE_CAPABILITIES } from "./host-visibility.js";
7
+ import { AGENT_HOSTS, REQUIRED_CORE_CAPABILITIES } from "./host-visibility.js";
8
8
  export const CONFIG_VERSION = "1";
9
9
  export const CONFIG_FILENAME = ".webpressorc.json";
10
10
  export const LEGACY_CONFIG_FILENAME = ".agent-kitrc.json";
@@ -105,11 +105,8 @@ function parseConfigFile(path) {
105
105
  const overrides = Array.isArray(rules?.overrides) ? rules.overrides : [];
106
106
  const durablePlanningRoot = readOptionalString(parsed.durablePlanningRoot);
107
107
  const blueprintsDir = readOptionalString(parsed.blueprintsDir);
108
- const serverName = readOptionalString(mcp?.serverName);
109
108
  const toolPrefix = readOptionalString(mcp?.toolPrefix);
110
- const normalizedMcp = serverName || toolPrefix
111
- ? { ...(serverName ? { serverName } : {}), ...(toolPrefix ? { toolPrefix } : {}) }
112
- : undefined;
109
+ const normalizedMcp = toolPrefix ? { toolPrefix } : undefined;
113
110
  const guard = parsed.guard;
114
111
  const packageManager = guard?.packageManager === "vp-only" ? "vp-only" : undefined;
115
112
  const rawScriptRoutes = guard?.scriptRoutes && typeof guard.scriptRoutes === "object"
@@ -139,7 +136,7 @@ function parseConfigFile(path) {
139
136
  }
140
137
  : undefined;
141
138
  const selectedHosts = Array.isArray(hosts?.selected)
142
- ? hosts.selected.filter((s) => ["codex", "claude", "opencode"].includes(String(s)))
139
+ ? hosts.selected.filter((s) => AGENT_HOSTS.includes(String(s)))
143
140
  : [];
144
141
  const requiredCapabilities = Array.isArray(hosts?.requiredCapabilities)
145
142
  ? hosts.requiredCapabilities.filter((s) => typeof s === "string")
@@ -0,0 +1,24 @@
1
+ import { type ConvergeUnit } from "./convergence.js";
2
+ export { resolveUntrackedCollision } from "./untracked-collision.js";
3
+ export type AuthorCommitStatus = "committed" | "no-change" | "skipped-ci" | "failed" | "rolled-back";
4
+ export interface AuthorCommitResult {
5
+ readonly status: AuthorCommitStatus;
6
+ readonly ok: boolean;
7
+ readonly commit?: string;
8
+ readonly allowlist: readonly string[];
9
+ readonly unexpectedPaths?: readonly string[];
10
+ readonly missingPaths?: readonly string[];
11
+ readonly error?: string;
12
+ }
13
+ export interface AuthorCommitOptions {
14
+ readonly repoRoot: string;
15
+ readonly appliedUnits: readonly ConvergeUnit[];
16
+ readonly message: string;
17
+ readonly isCi?: boolean;
18
+ }
19
+ export interface AppliedConvergenceCandidate {
20
+ readonly targetPath: string;
21
+ readonly reason: string;
22
+ }
23
+ export declare function collectAppliedConvergeUnits(repoRoot: string, candidates: readonly AppliedConvergenceCandidate[]): ConvergeUnit[];
24
+ export declare function authorConvergenceCommit(options: AuthorCommitOptions): AuthorCommitResult;