@loucompanion/forge-bridge 0.1.4-dev.fb770705136a → 0.2.1-dev.0f8fb73715e8

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 (329) hide show
  1. package/README.md +183 -4
  2. package/dist/bridge/bridge-chat-giphy-look.d.ts +48 -0
  3. package/dist/bridge/bridge-chat-giphy-look.js +55 -0
  4. package/dist/bridge/bridge-chat-provider-command.d.ts +40 -0
  5. package/dist/bridge/bridge-chat-provider-command.js +230 -0
  6. package/dist/bridge/bridge-chat.types.d.ts +20 -0
  7. package/dist/bridge/bridge-chat.types.js +28 -1
  8. package/dist/bridge/bridge-state-file.d.ts +161 -0
  9. package/dist/bridge/bridge-state-file.js +376 -0
  10. package/dist/bridge/bridge-state-io.d.ts +15 -0
  11. package/dist/bridge/bridge-state-io.js +68 -0
  12. package/dist/bridge/bridge-state-lock.d.ts +11 -0
  13. package/dist/bridge/bridge-state-lock.js +102 -0
  14. package/dist/bridge/bridge-state-unpublished.d.ts +17 -0
  15. package/dist/bridge/bridge-state-unpublished.js +111 -0
  16. package/dist/bridge/bridge.base.d.ts +9 -0
  17. package/dist/bridge/bridge.service.d.ts +102 -14
  18. package/dist/bridge/bridge.service.js +499 -471
  19. package/dist/bridge/bridge.types.d.ts +37 -0
  20. package/dist/bridge/bridge.types.js +2 -1
  21. package/dist/bridge/default-session-service.d.ts +13 -0
  22. package/dist/bridge/default-session-service.js +22 -0
  23. package/dist/bridge/dispatch-offer-policy.d.ts +22 -0
  24. package/dist/bridge/dispatch-offer-policy.js +58 -0
  25. package/dist/bridge/in-flight-registry.d.ts +62 -0
  26. package/dist/bridge/in-flight-registry.js +207 -0
  27. package/dist/bridge/local-yield-flag.d.ts +6 -0
  28. package/dist/bridge/local-yield-flag.js +34 -0
  29. package/dist/bridge/readiness-result-outbox.d.ts +5 -1
  30. package/dist/bridge/readiness-result-outbox.js +20 -0
  31. package/dist/bridge/runner-host-capabilities.d.ts +5 -0
  32. package/dist/bridge/runner-host-capabilities.js +31 -1
  33. package/dist/bridge/sandbox-resource-accounting.d.ts +16 -0
  34. package/dist/bridge/sandbox-resource-accounting.js +150 -0
  35. package/dist/bridge/test-postgres-capability.d.ts +14 -0
  36. package/dist/bridge/test-postgres-capability.js +120 -0
  37. package/dist/bridge/windows-bash-resolution.d.ts +31 -0
  38. package/dist/bridge/windows-bash-resolution.js +153 -0
  39. package/dist/cleanup/cleanup-wip.d.ts +12 -0
  40. package/dist/cleanup/cleanup-wip.js +66 -0
  41. package/dist/cleanup/cleanup.service.d.ts +20 -1
  42. package/dist/cleanup/cleanup.service.js +150 -169
  43. package/dist/cleanup/cleanup.types.d.ts +6 -0
  44. package/dist/cleanup/forge-owned-paths.d.ts +11 -0
  45. package/dist/cleanup/forge-owned-paths.js +62 -0
  46. package/dist/cleanup/host-runtime-ledger.d.ts +7 -0
  47. package/dist/cleanup/host-runtime-ledger.js +130 -0
  48. package/dist/cleanup/managed-branch-sweep.d.ts +27 -0
  49. package/dist/cleanup/managed-branch-sweep.js +111 -0
  50. package/dist/cli/cli.help.js +75 -13
  51. package/dist/cli/cli.service.d.ts +19 -10
  52. package/dist/cli/cli.service.js +161 -228
  53. package/dist/cli/idle-status.d.ts +84 -0
  54. package/dist/cli/idle-status.js +181 -0
  55. package/dist/cli/local-config.d.ts +18 -1
  56. package/dist/cli/local-config.js +67 -5
  57. package/dist/cli/provider-cli-advertising.d.ts +24 -0
  58. package/dist/cli/provider-cli-advertising.js +88 -0
  59. package/dist/cli/provider-cli-detection.d.ts +10 -0
  60. package/dist/cli/provider-cli-detection.js +160 -0
  61. package/dist/runtime/aspnet-runtime-prebuild.d.ts +20 -0
  62. package/dist/runtime/aspnet-runtime-prebuild.js +184 -18
  63. package/dist/runtime/attempt-database-broker.d.ts +1 -1
  64. package/dist/runtime/attempt-node-runtime-launcher.d.ts +36 -0
  65. package/dist/runtime/attempt-node-runtime-launcher.js +169 -0
  66. package/dist/runtime/attempt-process-supervisor.d.ts +2 -0
  67. package/dist/runtime/attempt-process-supervisor.js +12 -6
  68. package/dist/runtime/docker-engine-probe.d.ts +5 -0
  69. package/dist/runtime/docker-engine-probe.js +7 -0
  70. package/dist/runtime/dotnet-build-outputs.d.ts +107 -0
  71. package/dist/runtime/dotnet-build-outputs.js +402 -0
  72. package/dist/runtime/ephemeral-test-postgres-grant.d.ts +37 -0
  73. package/dist/runtime/ephemeral-test-postgres-grant.js +85 -0
  74. package/dist/runtime/ephemeral-test-postgres.d.ts +57 -0
  75. package/dist/runtime/ephemeral-test-postgres.js +303 -0
  76. package/dist/runtime/host-facts.d.ts +2 -1
  77. package/dist/runtime/host-listener-inspector.d.ts +26 -0
  78. package/dist/runtime/host-listener-inspector.js +84 -3
  79. package/dist/runtime/host-load-admission.d.ts +72 -0
  80. package/dist/runtime/host-load-admission.js +99 -0
  81. package/dist/runtime/host-load-capacity.d.ts +198 -0
  82. package/dist/runtime/host-load-capacity.js +353 -0
  83. package/dist/runtime/host-load-child-environment.d.ts +40 -0
  84. package/dist/runtime/host-load-child-environment.js +110 -0
  85. package/dist/runtime/host-load-forge-cgroups.d.ts +49 -0
  86. package/dist/runtime/host-load-forge-cgroups.js +140 -0
  87. package/dist/runtime/host-load-governor-config.d.ts +82 -0
  88. package/dist/runtime/host-load-governor-config.js +104 -0
  89. package/dist/runtime/host-load-governor.d.ts +273 -0
  90. package/dist/runtime/host-load-governor.js +831 -0
  91. package/dist/runtime/host-load-ledger-lock.d.ts +69 -0
  92. package/dist/runtime/host-load-ledger-lock.js +187 -0
  93. package/dist/runtime/host-load-live-test-slots.d.ts +61 -0
  94. package/dist/runtime/host-load-live-test-slots.js +193 -0
  95. package/dist/runtime/host-load-runtime-settings.d.ts +25 -0
  96. package/dist/runtime/host-load-runtime-settings.js +80 -0
  97. package/dist/runtime/host-load-sampler.d.ts +92 -2
  98. package/dist/runtime/host-load-sampler.js +166 -8
  99. package/dist/runtime/host-load-step-class.d.ts +70 -0
  100. package/dist/runtime/host-load-step-class.js +161 -0
  101. package/dist/runtime/host-load-step-reaper.d.ts +27 -0
  102. package/dist/runtime/host-load-step-reaper.js +95 -0
  103. package/dist/runtime/host-load-step-run.d.ts +107 -0
  104. package/dist/runtime/host-load-step-run.js +158 -0
  105. package/dist/runtime/host-load-test-slot.d.ts +46 -0
  106. package/dist/runtime/host-load-test-slot.js +100 -0
  107. package/dist/runtime/host-load-token-ledger.d.ts +200 -0
  108. package/dist/runtime/host-load-token-ledger.js +453 -0
  109. package/dist/runtime/host-load-windows-cpu.d.ts +34 -0
  110. package/dist/runtime/host-load-windows-cpu.js +85 -0
  111. package/dist/runtime/host-pressure-stall.d.ts +21 -1
  112. package/dist/runtime/host-pressure-stall.js +48 -1
  113. package/dist/runtime/host-runtime-contract.d.ts +15 -0
  114. package/dist/runtime/host-runtime-contract.js +39 -6
  115. package/dist/runtime/host-runtime-lease.d.ts +101 -6
  116. package/dist/runtime/host-runtime-lease.js +408 -294
  117. package/dist/runtime/host-runtime-ledger-recovery.d.ts +20 -0
  118. package/dist/runtime/host-runtime-ledger-recovery.js +134 -0
  119. package/dist/runtime/host-runtime-promotion.d.ts +101 -2
  120. package/dist/runtime/host-runtime-promotion.js +355 -14
  121. package/dist/runtime/host-runtime-requirements-check.d.ts +17 -0
  122. package/dist/runtime/host-runtime-requirements-check.js +29 -0
  123. package/dist/runtime/host-runtime-requirements.d.ts +36 -0
  124. package/dist/runtime/host-runtime-requirements.js +117 -0
  125. package/dist/runtime/managed-command-teardown.js +5 -16
  126. package/dist/runtime/native-test-postgres-fallback.d.ts +51 -7
  127. package/dist/runtime/native-test-postgres-fallback.js +60 -8
  128. package/dist/runtime/playwright-host-runtime-adapter.d.ts +7 -0
  129. package/dist/runtime/playwright-host-runtime-adapter.js +13 -1
  130. package/dist/runtime/prepared-runtime-identity.d.ts +4 -0
  131. package/dist/runtime/prepared-runtime-identity.js +130 -9
  132. package/dist/runtime/prepared-runtime-readiness.d.ts +23 -1
  133. package/dist/runtime/prepared-runtime-readiness.js +89 -18
  134. package/dist/runtime/runner-settings.d.ts +104 -0
  135. package/dist/runtime/runner-settings.js +236 -0
  136. package/dist/runtime/supervised-runtime-build-guard.d.ts +45 -0
  137. package/dist/runtime/supervised-runtime-build-guard.js +112 -0
  138. package/dist/sandbox/host-capacity-broker.d.ts +115 -0
  139. package/dist/sandbox/host-capacity-broker.js +336 -0
  140. package/dist/sandbox/managed-branch.d.ts +13 -0
  141. package/dist/sandbox/managed-branch.js +90 -0
  142. package/dist/sandbox/provider-auth/codex.js +11 -11
  143. package/dist/sandbox/runtime.d.ts +11 -3
  144. package/dist/sandbox/runtime.js +53 -20
  145. package/dist/sandbox/sandbox-cgroups.d.ts +14 -0
  146. package/dist/sandbox/sandbox-cgroups.js +42 -0
  147. package/dist/sandbox/sandbox-input.d.ts +22 -0
  148. package/dist/sandbox/sandbox-input.js +49 -0
  149. package/dist/sandbox/workspace.service.js +15 -2
  150. package/dist/session/architect-waits.d.ts +2 -0
  151. package/dist/session/architect-waits.js +138 -0
  152. package/dist/session/managed-attempt-tools.d.ts +2 -7
  153. package/dist/session/managed-attempt-tools.js +204 -141
  154. package/dist/session/managed-build-coordinator.d.ts +16 -0
  155. package/dist/session/managed-build-coordinator.js +10 -0
  156. package/dist/session/managed-build-receipt.d.ts +7 -0
  157. package/dist/session/managed-build-receipt.js +11 -3
  158. package/dist/session/managed-command-environment.d.ts +8 -0
  159. package/dist/session/managed-command-environment.js +28 -0
  160. package/dist/session/managed-command-host-load.d.ts +52 -0
  161. package/dist/session/managed-command-host-load.js +87 -0
  162. package/dist/session/mcp-argument-coercion.d.ts +23 -0
  163. package/dist/session/mcp-argument-coercion.js +121 -0
  164. package/dist/session/phase-completion.artifact-bundle.d.ts +20 -0
  165. package/dist/session/phase-completion.artifact-bundle.js +167 -0
  166. package/dist/session/phase-completion.artifacts.d.ts +9 -17
  167. package/dist/session/phase-completion.artifacts.js +158 -190
  168. package/dist/session/phase-completion.command-validation.d.ts +7 -0
  169. package/dist/session/phase-completion.command-validation.js +77 -0
  170. package/dist/session/phase-completion.d.ts +31 -2
  171. package/dist/session/phase-completion.helpers.js +18 -65
  172. package/dist/session/phase-completion.js +19 -32
  173. package/dist/session/phase-completion.mcp-args.d.ts +9 -0
  174. package/dist/session/phase-completion.mcp-args.js +195 -0
  175. package/dist/session/phase-completion.phase-aliases.d.ts +5 -0
  176. package/dist/session/phase-completion.phase-aliases.js +43 -0
  177. package/dist/session/phase-completion.pr-review-schema.d.ts +1 -0
  178. package/dist/session/phase-completion.pr-review-schema.js +75 -0
  179. package/dist/session/phase-completion.pr-review-validation.d.ts +11 -0
  180. package/dist/session/phase-completion.pr-review-validation.js +212 -0
  181. package/dist/session/phase-completion.pr-review.d.ts +36 -0
  182. package/dist/session/phase-completion.pr-review.js +294 -0
  183. package/dist/session/phase-completion.prompts.d.ts +1 -1
  184. package/dist/session/phase-completion.prompts.js +20 -1
  185. package/dist/session/phase-completion.runtime.d.ts +13 -12
  186. package/dist/session/phase-completion.runtime.js +113 -214
  187. package/dist/session/phase-completion.schema-parts.d.ts +19 -0
  188. package/dist/session/phase-completion.schema-parts.js +188 -0
  189. package/dist/session/phase-completion.schemas.d.ts +3 -3
  190. package/dist/session/phase-completion.schemas.js +219 -232
  191. package/dist/session/phase-completion.validation.d.ts +3 -3
  192. package/dist/session/phase-completion.validation.js +58 -94
  193. package/dist/session/pr-review-diff-base.d.ts +18 -0
  194. package/dist/session/pr-review-diff-base.js +44 -0
  195. package/dist/session/pr-review-placement.d.ts +50 -0
  196. package/dist/session/pr-review-placement.js +91 -0
  197. package/dist/session/pre-publication-change-set.d.ts +62 -0
  198. package/dist/session/pre-publication-change-set.js +166 -0
  199. package/dist/session/pre-publication-host-load.d.ts +27 -0
  200. package/dist/session/pre-publication-host-load.js +112 -0
  201. package/dist/session/pre-publication-native-postgres.d.ts +30 -0
  202. package/dist/session/pre-publication-native-postgres.js +111 -0
  203. package/dist/session/pre-publication-pass.d.ts +61 -0
  204. package/dist/session/pre-publication-pass.js +148 -0
  205. package/dist/session/pre-publication-process.d.ts +3 -0
  206. package/dist/session/pre-publication-process.js +32 -19
  207. package/dist/session/pre-publication-step-execution.d.ts +12 -0
  208. package/dist/session/pre-publication-step-execution.js +50 -0
  209. package/dist/session/pre-publication-validation.d.ts +39 -22
  210. package/dist/session/pre-publication-validation.js +241 -207
  211. package/dist/session/provider-cli/claude-background-work.d.ts +67 -0
  212. package/dist/session/provider-cli/claude-background-work.js +181 -0
  213. package/dist/session/provider-cli/dispatch-target-branch.d.ts +7 -0
  214. package/dist/session/provider-cli/dispatch-target-branch.js +8 -0
  215. package/dist/session/provider-cli/host-build-lock.d.ts +18 -0
  216. package/dist/session/provider-cli/host-build-lock.js +30 -0
  217. package/dist/session/provider-cli/pr-review-credential-isolation.d.ts +83 -0
  218. package/dist/session/provider-cli/pr-review-credential-isolation.js +144 -0
  219. package/dist/session/provider-cli/pr-review-guardrails.d.ts +70 -0
  220. package/dist/session/provider-cli/pr-review-guardrails.js +360 -0
  221. package/dist/session/provider-cli/pr-review-prompt.d.ts +2 -0
  222. package/dist/session/provider-cli/pr-review-prompt.js +119 -0
  223. package/dist/session/provider-cli/pre-publication-repair.d.ts +56 -0
  224. package/dist/session/provider-cli/pre-publication-repair.js +281 -0
  225. package/dist/session/provider-cli/provider-cli.base.d.ts +1 -0
  226. package/dist/session/provider-cli/provider-cli.child-environment.d.ts +7 -0
  227. package/dist/session/provider-cli/provider-cli.child-environment.js +75 -0
  228. package/dist/session/provider-cli/provider-cli.codex-models-cache.d.ts +3 -0
  229. package/dist/session/provider-cli/provider-cli.codex-models-cache.js +37 -0
  230. package/dist/session/provider-cli/provider-cli.deterministic.d.ts +1 -0
  231. package/dist/session/provider-cli/provider-cli.deterministic.js +5 -0
  232. package/dist/session/provider-cli/provider-cli.merge-integrity.d.ts +6 -3
  233. package/dist/session/provider-cli/provider-cli.merge-integrity.js +29 -10
  234. package/dist/session/provider-cli/provider-cli.pr-review.d.ts +23 -0
  235. package/dist/session/provider-cli/provider-cli.pr-review.js +213 -0
  236. package/dist/session/provider-cli/provider-cli.process.d.ts +15 -36
  237. package/dist/session/provider-cli/provider-cli.process.js +41 -432
  238. package/dist/session/provider-cli/provider-cli.prompts.d.ts +15 -3
  239. package/dist/session/provider-cli/provider-cli.prompts.js +183 -90
  240. package/dist/session/provider-cli/provider-cli.reapply-conflicts.d.ts +10 -0
  241. package/dist/session/provider-cli/provider-cli.reapply-conflicts.js +37 -0
  242. package/dist/session/provider-cli/provider-cli.runtime.d.ts +15 -0
  243. package/dist/session/provider-cli/provider-cli.runtime.js +43 -1
  244. package/dist/session/provider-cli/provider-cli.service-support.d.ts +37 -0
  245. package/dist/session/provider-cli/provider-cli.service-support.js +146 -0
  246. package/dist/session/provider-cli/provider-cli.service.d.ts +18 -18
  247. package/dist/session/provider-cli/provider-cli.service.js +127 -317
  248. package/dist/session/provider-cli/provider-cli.types.d.ts +35 -0
  249. package/dist/session/provider-cli/provider-cli.windows-environment.d.ts +10 -0
  250. package/dist/session/provider-cli/provider-cli.windows-environment.js +151 -0
  251. package/dist/session/provider-cli/provider-cli.windows-launch.d.ts +23 -0
  252. package/dist/session/provider-cli/provider-cli.windows-launch.js +131 -0
  253. package/dist/session/provider-cli/provider-in-flight-work.d.ts +4 -0
  254. package/dist/session/provider-cli/provider-in-flight-work.js +45 -0
  255. package/dist/session/provider-cli/provider-output-pipes.d.ts +30 -0
  256. package/dist/session/provider-cli/provider-output-pipes.js +67 -0
  257. package/dist/session/provider-cli/provider-output-state.d.ts +2 -0
  258. package/dist/session/provider-cli/provider-output-state.js +6 -0
  259. package/dist/session/provider-cli/provider-user-config-isolation.d.ts +69 -0
  260. package/dist/session/provider-cli/provider-user-config-isolation.js +164 -0
  261. package/dist/session/qa-sidecar-validation.d.ts +6 -0
  262. package/dist/session/qa-sidecar-validation.js +28 -0
  263. package/dist/session/sandbox-host-capacity-gate.d.ts +51 -0
  264. package/dist/session/sandbox-host-capacity-gate.js +279 -0
  265. package/dist/session/session-host-project.d.ts +22 -0
  266. package/dist/session/session-host-project.js +98 -0
  267. package/dist/session/session-redaction.js +31 -181
  268. package/dist/session/session.base.d.ts +9 -1
  269. package/dist/session/session.parse-helpers.d.ts +10 -0
  270. package/dist/session/session.parse-helpers.js +84 -0
  271. package/dist/session/session.runtime-refresh.d.ts +46 -0
  272. package/dist/session/session.runtime-refresh.js +116 -0
  273. package/dist/session/session.service.d.ts +16 -2
  274. package/dist/session/session.service.js +208 -155
  275. package/dist/session/session.types.d.ts +8 -0
  276. package/dist/session/session.types.js +13 -83
  277. package/dist/session/session.types.pr-review.d.ts +48 -0
  278. package/dist/session/session.types.pr-review.js +51 -0
  279. package/dist/session/sidecar-json-shape.d.ts +31 -0
  280. package/dist/session/sidecar-json-shape.js +217 -0
  281. package/dist/session/workspace-runtime-fingerprint.d.ts +32 -0
  282. package/dist/session/workspace-runtime-fingerprint.js +138 -0
  283. package/dist/shared/fs/file-identity.d.ts +10 -0
  284. package/dist/shared/fs/file-identity.js +15 -0
  285. package/dist/shared/fs/replace-file.d.ts +7 -0
  286. package/dist/shared/fs/replace-file.js +33 -0
  287. package/dist/shared/process/host-process-recovery.d.ts +14 -3
  288. package/dist/shared/process/host-process-recovery.js +23 -3
  289. package/dist/shared/process/host-process-supervisor.d.ts +14 -1
  290. package/dist/shared/process/host-process-supervisor.js +67 -15
  291. package/dist/shared/process/process-tree.d.ts +52 -0
  292. package/dist/shared/process/process-tree.js +144 -0
  293. package/dist/shared/process/process.d.ts +67 -0
  294. package/dist/shared/process/process.js +213 -11
  295. package/dist/shared/process/windows-app-execution-alias.d.ts +19 -0
  296. package/dist/shared/process/windows-app-execution-alias.js +45 -0
  297. package/dist/shared/process/windows-launch.d.ts +18 -0
  298. package/dist/shared/process/windows-launch.js +68 -0
  299. package/dist/shared/provider-capabilities.d.ts +2 -0
  300. package/dist/shared/provider-capabilities.js +23 -7
  301. package/dist/version.d.ts +1 -1
  302. package/dist/version.js +1 -1
  303. package/dist/worktree/artifact-injector.js +24 -0
  304. package/dist/worktree/dependency-warmer.d.ts +25 -0
  305. package/dist/worktree/dependency-warmer.js +46 -10
  306. package/dist/worktree/orphan-relink.d.ts +19 -0
  307. package/dist/worktree/orphan-relink.js +106 -0
  308. package/dist/worktree/wip-git.d.ts +58 -0
  309. package/dist/worktree/wip-git.js +182 -0
  310. package/dist/worktree/wip-refs.d.ts +85 -0
  311. package/dist/worktree/wip-refs.js +169 -0
  312. package/dist/worktree/wip-restore.d.ts +51 -0
  313. package/dist/worktree/wip-restore.js +324 -0
  314. package/dist/worktree/wip-snapshot.d.ts +53 -0
  315. package/dist/worktree/wip-snapshot.js +270 -0
  316. package/dist/worktree/worktree-inputs.d.ts +8 -0
  317. package/dist/worktree/worktree-inputs.js +134 -0
  318. package/dist/worktree/worktree-origin-sync.d.ts +35 -0
  319. package/dist/worktree/worktree-origin-sync.js +128 -0
  320. package/dist/worktree/worktree-wip-events.d.ts +20 -0
  321. package/dist/worktree/worktree-wip-events.js +148 -0
  322. package/dist/worktree/worktree-wip.d.ts +57 -0
  323. package/dist/worktree/worktree-wip.js +200 -0
  324. package/dist/worktree/worktree.base.d.ts +7 -1
  325. package/dist/worktree/worktree.service.d.ts +58 -5
  326. package/dist/worktree/worktree.service.js +237 -161
  327. package/dist/worktree/worktree.types.d.ts +54 -0
  328. package/package.json +2 -2
  329. package/runtime/windows-listener-owner.ps1 +12 -1
@@ -1,5 +1,8 @@
1
- import { decomposeGateFileNames, isDebugCompletionPhase, phaseFiles, qaBlockerReasons, qaGateFileNames, qaScopeAuthorities, qaScopeConfidence, qaScopeEvidence, qaScopeSources, qaScopeSurfaces, resolvedFindingStatusValues } from "./phase-completion.js";
2
- export function toolDescription(phase, qaGate = null, decomposeGate = null) {
1
+ import { decomposeGateFileNames, decomposeStatuses, draftStatuses, isDebugCompletionPhase, phaseFiles, qaBlockerReasons, qaGateFileNames } from "./phase-completion.js";
2
+ import { browserCheckSchema, qaSidecarsSchema, qaEvidenceWrapperSchema, qaGateEvidenceWrapperSchema, findingEvidenceSchema, objectToolSchema, evidenceObjectSchema, qaScopeSchema, commandEvidenceSchema, resolvedFindingSchema, acceptanceCriteriaSchema, reviewSectionSchema, reviewSectionProperties } from "./phase-completion.schema-parts.js";
3
+ import { prReviewToolInputSchema } from "./phase-completion.pr-review-schema.js";
4
+ import { architectNonPassProperties } from "./architect-waits.js";
5
+ export function toolDescription(phase, qaGate = null, decomposeGate = null, draftGate = null) {
3
6
  if (qaGate) {
4
7
  return qaGate === "qa_verdict"
5
8
  ? "Complete the final Forge QA verdict by writing the canonical QA bundle with pass, needs_rework, or blocked evidence."
@@ -10,6 +13,12 @@ export function toolDescription(phase, qaGate = null, decomposeGate = null) {
10
13
  ? "Complete the Forge Decompose proposal by writing decompose.proposal.json with candidate child items and optional structured QA scopes."
11
14
  : `Complete the ${decomposeGate.replace(/_/g, " ")} Decompose gate by writing ${decomposeGateFileNames[decomposeGate]} before continuing.`;
12
15
  }
16
+ if (phase === "draft") {
17
+ const gate = draftGate ?? "draft_proposal";
18
+ return gate === "draft_proposal"
19
+ ? "Complete the Forge Draft proposal by writing draft.proposal.json with the drafted item in draft_json."
20
+ : `Complete the ${gate.replace(/_/g, " ")} Draft gate before continuing.`;
21
+ }
13
22
  if (isDebugCompletionPhase(phase)) {
14
23
  return `Complete the ${phase.replace(/_/g, " ")} Debug gate by writing ${phaseFiles[phase].jsonFileName} with structured bug-fix evidence before continuing.`;
15
24
  }
@@ -22,6 +31,9 @@ export function toolDescription(phase, qaGate = null, decomposeGate = null) {
22
31
  if (phase === "comment_repair") {
23
32
  return "Complete Forge pull-request comment repair by recording one evidence-backed disposition for every actionable finding in the dispatch snapshot.";
24
33
  }
34
+ if (phase === "pr_review") {
35
+ return "Complete Forge pull-request review by recording one comment-only review bound to the reviewed head: a verdict, overview, security summary, and inline comments anchored on new-side diff lines. Forge posts it afterwards; this tool does not publish. Use stale_head when the worktree is not at the dispatched head and blocked when the diff cannot be read.";
36
+ }
25
37
  if (phase === "self_review") {
26
38
  return "Complete Forge self-review by writing self-review.report.json with diff review, findings, security, edge-case, design, deterministic-comparison, fixes, and remaining-risk evidence.";
27
39
  }
@@ -33,8 +45,8 @@ export function toolDescription(phase, qaGate = null, decomposeGate = null) {
33
45
  }
34
46
  return "Complete Forge validation by writing validation.verdict.json with command, build/test/lint/design, drift, acceptance-criteria, and ready-for-dev-test evidence.";
35
47
  }
36
- export function toolInputSchema(phase, qaGate = null, decomposeGate = null) {
37
- const baseProperties = {
48
+ function baseToolProperties() {
49
+ return {
38
50
  status: {
39
51
  type: "string",
40
52
  enum: ["pass", "needs_rework", "fail", "failed"],
@@ -52,12 +64,18 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null) {
52
64
  })
53
65
  }
54
66
  };
67
+ }
68
+ export function toolInputSchema(phase, qaGate = null, decomposeGate = null, draftGate = null) {
69
+ const baseProperties = baseToolProperties();
55
70
  if (qaGate && qaGate !== "qa_verdict") {
56
71
  return qaGateToolInputSchema(qaGate);
57
72
  }
58
73
  if (decomposeGate) {
59
74
  return decomposeGateToolInputSchema(decomposeGate, baseProperties);
60
75
  }
76
+ if (phase === "draft") {
77
+ return draftGateToolInputSchema(draftGate ?? "draft_proposal", baseProperties);
78
+ }
61
79
  if (isDebugCompletionPhase(phase)) {
62
80
  return debugToolInputSchema(phase, baseProperties);
63
81
  }
@@ -67,6 +85,7 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null) {
67
85
  failed_checks: {
68
86
  type: "array",
69
87
  description: "Required and non-empty for pass. Provider check/job/step evidence inspected before repair.",
88
+ minItems: 1,
70
89
  items: evidenceObjectSchema(["name", "provider_state"], {
71
90
  name: { type: "string" },
72
91
  provider_state: { type: "string" },
@@ -81,15 +100,16 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null) {
81
100
  type: "object",
82
101
  description: "Required for pass. Include classification, summary, and concrete evidence.",
83
102
  additionalProperties: true,
103
+ required: ["classification", "summary", "evidence"],
84
104
  properties: {
85
105
  classification: { type: "string" },
86
106
  summary: { type: "string" },
87
- evidence: { type: "array", items: { type: "string" } }
107
+ evidence: { type: "array", minItems: 1, description: "Non-empty list of concrete evidence strings.", items: { type: "string" } }
88
108
  }
89
109
  },
90
110
  changed_files: {
91
111
  type: "array",
92
- description: "Files changed by the repair. May be empty only when no_code_action explains the provider-only action or blocker.",
112
+ description: "Required for pass, even when nothing changed: list each changed file, or send [] together with no_code_action when the repair is provider-only. Do not omit it.",
93
113
  items: evidenceObjectSchema(["path", "summary"], {
94
114
  path: { type: "string" },
95
115
  summary: { type: "string" }
@@ -99,6 +119,7 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null) {
99
119
  type: "object",
100
120
  description: "Required when changed_files is empty. Describe the evidence-backed provider action or blocker.",
101
121
  additionalProperties: true,
122
+ required: ["action", "reason"],
102
123
  properties: {
103
124
  action: { type: "string" },
104
125
  reason: { type: "string" },
@@ -107,26 +128,29 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null) {
107
128
  },
108
129
  narrow_validation: {
109
130
  type: "array",
110
- description: "Required and non-empty for pass. The focused failing command or evidence-backed substitute.",
131
+ description: "Required and non-empty for pass. The focused failing command or evidence-backed substitute; every entry needs exit_code 0 and status pass.",
132
+ minItems: 1,
111
133
  items: commandEvidenceSchema()
112
134
  },
113
135
  workflow_validation: {
114
136
  type: "array",
115
- description: "Required and non-empty for pass. Each failed-job guard/test/drift step with local equivalence supported, substitute, or provider_only.",
137
+ description: "Required and non-empty for pass. Each failed-job guard/test/drift step with local equivalence supported, substitute, or provider_only. supported and substitute entries must have run locally and passed: command, summary, exit_code 0, and status pass. provider_only entries need a reason instead.",
138
+ minItems: 1,
116
139
  items: evidenceObjectSchema(["step", "equivalence", "status"], {
117
140
  step: { type: "string" },
118
141
  equivalence: { type: "string", enum: ["supported", "substitute", "provider_only"] },
119
- command: { type: "string" },
120
- exit_code: { type: "number" },
121
- status: { type: "string" },
122
- summary: { type: "string" },
123
- reason: { type: "string" },
124
- substitute: { type: "string" }
142
+ command: { type: "string", description: "Required unless equivalence is provider_only: the local command that ran." },
143
+ exit_code: { type: "number", description: "Required unless equivalence is provider_only; must be 0." },
144
+ status: { type: "string", default: "pass", description: "Must be pass unless equivalence is provider_only." },
145
+ summary: { type: "string", description: "Required unless equivalence is provider_only." },
146
+ reason: { type: "string", description: "Required when equivalence is provider_only: why only provider CI can prove this step." },
147
+ substitute: { type: "string", description: "Required when equivalence is substitute: what replaces the provider step locally." }
125
148
  })
126
149
  },
127
150
  broader_validation: {
128
151
  type: "array",
129
- description: "Required and non-empty for pass. Normal validation covering every touched compiled/tested surface.",
152
+ description: "Required and non-empty for pass. Normal validation covering every touched compiled/tested surface; every entry needs exit_code 0 and status pass.",
153
+ minItems: 1,
130
154
  items: commandEvidenceSchema()
131
155
  },
132
156
  remaining_risks: {
@@ -141,13 +165,14 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null) {
141
165
  provider_state: {
142
166
  type: "string",
143
167
  enum: ["ready_for_rerun", "rerun_requested", "checks_pending", "still_failing", "blocked_by_provider"],
144
- description: "Provider state after local validation and before Forge-owned publication."
168
+ description: "Provider state after local validation and before Forge-owned publication. Required for pass, and pass accepts only ready_for_rerun, rerun_requested, or checks_pending."
145
169
  },
146
170
  ready_for_push: {
147
171
  type: "boolean",
172
+ default: true,
148
173
  description: "Required for pass and must be true. Forge Bridge performs the commit/push only after this gate passes."
149
174
  }
150
- }, ["status", "summary"], "For status pass, include failed_checks, root_cause, changed_files or no_code_action, narrow_validation, workflow_validation, broader_validation, remaining_risks, provider_state, and ready_for_push: true.");
175
+ }, ["status", "summary"], "For status pass, include failed_checks, root_cause, changed_files (use [] with no_code_action when nothing changed), narrow_validation, workflow_validation, broader_validation, remaining_risks, provider_state, and ready_for_push: true.");
151
176
  }
152
177
  if (phase === "comment_repair") {
153
178
  return objectToolSchema({
@@ -157,6 +182,7 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null) {
157
182
  dispositions: {
158
183
  type: "array",
159
184
  description: "Exactly one outcome for every actionable dispatch finding; conversation-only comments are omitted.",
185
+ minItems: 1,
160
186
  items: evidenceObjectSchema(["claim_id", "kind", "body_sha256", "disposition", "evidence"], {
161
187
  claim_id: { type: "string" },
162
188
  kind: { type: "string", enum: ["review_thread", "review_body", "issue_comment"] },
@@ -180,11 +206,14 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null) {
180
206
  },
181
207
  validation: {
182
208
  type: "array",
183
- description: "Scoped verification evidence. May be empty only when no source change was made.",
209
+ description: "Scoped verification evidence. Required and non-empty when changed_files is non-empty, and then every entry needs exit_code 0 and status pass. May be empty only when no source change was made.",
184
210
  items: commandEvidenceSchema()
185
211
  }
186
212
  }, ["status", "summary", "repair_head_sha", "repair_issue_key", "dispositions", "changed_files", "validation"], "Use status pass after every actionable finding has an evidence-backed disposition. Rejected and needs_decision are legitimate outcomes and must not be disguised as code changes.");
187
213
  }
214
+ if (phase === "pr_review") {
215
+ return prReviewToolInputSchema();
216
+ }
188
217
  if (phase === "implementation") {
189
218
  return objectToolSchema({
190
219
  ...baseProperties,
@@ -307,58 +336,56 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null) {
307
336
  description: "QA plan/checklist. Forge writes this to qa.plan.json; a default checklist is generated if omitted.",
308
337
  items: { type: "string" }
309
338
  },
339
+ schema_version: { type: "number", enum: [1], description: "Optional; must be 1 when sent." },
310
340
  tested_acceptance_criteria: {
311
341
  type: "array",
312
342
  description: "Required and non-empty for pass/needs_rework. Criteria actually tested by QA.",
313
343
  items: { type: "string" }
314
344
  },
345
+ acceptance_criteria: {
346
+ type: "array",
347
+ description: "Optional fallback for tested_acceptance_criteria in the QA cycle when the plan gate recorded none.",
348
+ items: { type: "string" }
349
+ },
315
350
  commands: {
316
351
  type: "array",
317
- description: "Command evidence written to qa.evidence.json.",
352
+ description: "Command evidence written to qa.evidence.json. When status is pass every entry needs exit_code 0 and status pass. Pass and needs_rework need at least one entry here or in browser_checks, or a notes string.",
318
353
  items: commandEvidenceSchema()
319
354
  },
320
355
  browser_checks: {
321
356
  type: "array",
322
- description: "Browser/manual UI checks with URL or route, action, observed result, screenshot/trace references, console/network notes, and status.",
323
- items: evidenceObjectSchema(["summary", "status"], {
324
- summary: { type: "string" },
325
- url: { type: "string" },
326
- route: { type: "string" },
327
- status: { type: "string" },
328
- screenshot: { type: "string" },
329
- trace: { type: "string" }
330
- })
357
+ description: "Browser/manual UI checks with URL or route, action, observed result, screenshot/trace references, console/network notes, and status. When status is pass every entry needs status pass.",
358
+ items: browserCheckSchema(["summary", "status"])
331
359
  },
332
- sidecars: {
360
+ sidecars: qaSidecarsSchema(),
361
+ notes: { type: "string", description: "Additional QA evidence notes." },
362
+ evidence: qaEvidenceWrapperSchema(),
363
+ finding_ids: {
333
364
  type: "array",
334
- description: "Optional QA sidecar files already written under the dispatch-provided QA artifacts path with path/content_hash/bytes metadata.",
335
- items: evidenceObjectSchema(["path", "content_hash", "bytes"], {
336
- path: { type: "string" },
337
- content_hash: { type: "string" },
338
- bytes: { type: "number" }
339
- })
365
+ description: "Optional ids of the in-scope findings this verdict reports. Each must match the id of an entry in findings with scope in_scope; omit it to derive the ids from findings. Not allowed on pass.",
366
+ items: { type: "string" }
340
367
  },
341
- notes: { type: "string", description: "Additional QA evidence notes." },
342
- evidence: {
343
- type: "object",
344
- description: "Optional wrapper containing commands, browser_checks, and notes when a client prefers nested evidence."
368
+ candidate_bug_ids: {
369
+ type: "array",
370
+ description: "Optional ids of candidate bugs; each must match the id of an entry in candidate_bugs. Omit it to derive the ids from candidate_bugs.",
371
+ items: { type: "string" }
345
372
  },
346
373
  findings: {
347
374
  type: "array",
348
- description: "QA findings. needs_rework requires at least one actionable in_scope finding.",
375
+ description: "QA findings. needs_rework requires at least one actionable in_scope finding; pass allows none. An in_scope finding also requires non-empty acceptance_criteria, repro_steps, and likely_area arrays, expected, actual, an evidence object, required_fix, and required_regression.",
349
376
  items: evidenceObjectSchema(["id", "severity", "scope", "title"], {
350
377
  id: { type: "string" },
351
378
  severity: { type: "string", enum: ["critical", "major", "minor"] },
352
379
  scope: { type: "string", enum: ["in_scope", "out_of_scope", "unclear"] },
353
380
  title: { type: "string" },
354
- acceptance_criteria: { type: "array", items: { type: "string" } },
355
- repro_steps: { type: "array", items: { type: "string" } },
356
- expected: { type: "string" },
357
- actual: { type: "string" },
358
- evidence: { type: "object" },
359
- likely_area: { type: "array", items: { type: "string" } },
360
- required_fix: { type: "string" },
361
- required_regression: { type: "string" }
381
+ acceptance_criteria: { type: "array", description: "Required and non-empty for an in_scope finding.", items: { type: "string" } },
382
+ repro_steps: { type: "array", description: "Required and non-empty for an in_scope finding.", items: { type: "string" } },
383
+ expected: { type: "string", description: "Required for an in_scope finding." },
384
+ actual: { type: "string", description: "Required for an in_scope finding." },
385
+ evidence: findingEvidenceSchema("Required for an in_scope finding."),
386
+ likely_area: { type: "array", description: "Required and non-empty for an in_scope finding.", items: { type: "string" } },
387
+ required_fix: { type: "string", description: "Required for an in_scope finding." },
388
+ required_regression: { type: "string", description: "Required for an in_scope finding." }
362
389
  })
363
390
  },
364
391
  candidate_bugs: {
@@ -370,7 +397,7 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null) {
370
397
  severity: { type: "string" },
371
398
  scope_reason: { type: "string" },
372
399
  repro_steps: { type: "array", items: { type: "string" } },
373
- evidence: { type: "object" },
400
+ evidence: findingEvidenceSchema("Optional evidence object."),
374
401
  suggested_action: { type: "string", enum: ["create_bug", "create_follow_up", "accept_risk", "attach_to_current_item"] }
375
402
  })
376
403
  },
@@ -381,7 +408,7 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null) {
381
408
  code: { type: "string" },
382
409
  message: { type: "string" },
383
410
  severity: { type: "string" },
384
- evidence: { type: "object" }
411
+ evidence: { type: "object", description: "Optional evidence object." }
385
412
  })
386
413
  },
387
414
  blocker_reason: {
@@ -401,28 +428,40 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null) {
401
428
  summary: { type: "string", description: "Concise Architect plan verdict summary." },
402
429
  implementation_plan: {
403
430
  type: "object",
404
- description: "Required for pass. Top-level fields inside this object must include schema_version, plan_id, phases, tasks, dependencies, and phase_gates.",
431
+ description: "Required for pass; may be omitted for needs_revision or blocked. Top-level fields inside this object must include schema_version, plan_id, phases, tasks, dependencies, and phase_gates.",
405
432
  additionalProperties: true,
433
+ required: ["schema_version", "plan_id", "phases", "tasks", "dependencies", "phase_gates"],
406
434
  properties: {
407
435
  schema_version: { type: "number", enum: [1] },
408
436
  plan_id: { type: "string" },
409
437
  phases: {
410
438
  type: "array",
411
- description: "Required top-level implementation_plan.phases array.",
439
+ description: "Required non-empty top-level implementation_plan.phases array.",
440
+ minItems: 1,
412
441
  items: { type: "object", additionalProperties: true }
413
442
  },
414
443
  tasks: {
415
444
  type: "array",
416
- description: "Required Develop child task list. Each task must include id, a non-empty tests array, and should include verification_scope for task-level QA evidence. Do not put parent-story QA/sign-off, child-count/materialization inventory, parent plan artifact checks, or final acceptance proof here; those belong in qa_plan.final_qa.",
445
+ description: "Required non-empty Develop child task list. Each task must have a unique id, a non-empty acceptance_criteria string array, and a non-empty tests array, and should include verification_scope for task-level QA evidence. Do not put parent-story QA/sign-off, child-count/materialization inventory, parent plan artifact checks, or final acceptance proof here; those belong in qa_plan.final_qa.",
446
+ minItems: 1,
417
447
  items: {
418
448
  type: "object",
419
449
  additionalProperties: true,
450
+ required: ["id", "acceptance_criteria", "tests"],
420
451
  properties: {
421
- id: { type: "string" },
452
+ id: { type: "string", description: "Unique, stable task id." },
422
453
  title: { type: "string" },
454
+ acceptance_criteria: {
455
+ type: "array",
456
+ minItems: 1,
457
+ description: "Required: at least one independently testable acceptance criterion for this child task, each a non-empty string.",
458
+ items: { type: "string" }
459
+ },
423
460
  verification_scope: qaScopeSchema("Task-level QA/verification scope for the materialized child task."),
424
461
  tests: {
425
462
  type: "array",
463
+ minItems: 1,
464
+ description: "Required non-empty task-specific verification.",
426
465
  items: { type: "object", additionalProperties: true }
427
466
  }
428
467
  }
@@ -448,19 +487,22 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null) {
448
487
  phase_gates: {
449
488
  type: "array",
450
489
  description: "Required non-empty phase gate array.",
490
+ minItems: 1,
451
491
  items: { type: "object", additionalProperties: true }
452
492
  }
453
493
  }
454
494
  },
455
495
  qa_plan: {
456
496
  type: "object",
457
- description: "Required for pass. Must include schema_version: 1 and non-empty final_qa coverage.",
497
+ description: "Required for pass; may be omitted for needs_revision or blocked. Must include schema_version: 1 and non-empty final_qa coverage.",
458
498
  additionalProperties: true,
499
+ required: ["schema_version", "final_qa"],
459
500
  properties: {
460
501
  schema_version: { type: "number", enum: [1] },
461
502
  final_qa: {
462
503
  type: "array",
463
504
  description: "Required non-empty final QA coverage array.",
505
+ minItems: 1,
464
506
  items: { type: "object", additionalProperties: true }
465
507
  }
466
508
  }
@@ -468,30 +510,22 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null) {
468
510
  report_markdown: { type: "string", description: "Human-readable Architect report. Use report as an alias only when the client cannot send report_markdown." },
469
511
  report: { type: "string", description: "Alias for report_markdown." },
470
512
  blockers: baseProperties.blockers,
471
- revision_questions: {
472
- type: "array",
473
- description: "Required for needs_revision when blockers are not used.",
474
- items: { type: "string" }
475
- },
476
- revision_reasons: {
477
- type: "array",
478
- description: "Concrete reasons that prevent pass status.",
479
- items: { type: "string" }
480
- }
481
- }, ["status", "summary"], "For status pass, include implementation_plan and qa_plan at the top level of the MCP tool arguments. implementation_plan.phases must be a top-level array inside implementation_plan, not nested under another object.");
513
+ ...architectNonPassProperties()
514
+ }, ["status", "summary"], "For status pass, include implementation_plan and qa_plan at the top level of the MCP tool arguments, as JSON objects rather than quoted strings. implementation_plan.phases must be a top-level array inside implementation_plan, not nested under another object. For needs_revision or blocked, implementation_plan and qa_plan may be omitted; include blockers, revision_questions, or revision_reasons instead. When blocked because another Story or pull request must merge first, also list it in waits_on; when the owner must choose, also set owner_decision.");
482
515
  }
483
516
  return objectToolSchema({
484
517
  ...baseProperties,
485
518
  commands: {
486
519
  type: "array",
487
- description: "Required for pass. Include at least one deterministic validation command with exit_code: 0 and status: pass.",
520
+ description: "Required for pass. Include at least one deterministic validation command; for pass every entry needs exit_code: 0 and status: pass.",
521
+ minItems: 1,
488
522
  items: commandEvidenceSchema()
489
523
  },
490
524
  acceptance_criteria: acceptanceCriteriaSchema(),
491
- build_status: { type: "string", description: "Required for pass and must be pass." },
492
- test_status: { type: "string", description: "Required for pass and must be pass." },
493
- lint_status: { type: "string", description: "Required for pass. pass/fail/needs_rework/not_applicable." },
494
- design_status: { type: "string", description: "Required for pass. pass/fail/needs_rework/not_applicable." },
525
+ build_status: { type: "string", default: "pass", description: "Required for pass and must be pass." },
526
+ test_status: { type: "string", default: "pass", description: "Required for pass and must be pass." },
527
+ lint_status: { type: "string", default: "pass", description: "Required for pass, and pass accepts pass or not_applicable. Otherwise fail/needs_rework." },
528
+ design_status: { type: "string", default: "pass", description: "Required for pass, and pass accepts pass or not_applicable. Otherwise fail/needs_rework." },
495
529
  drift_checks: {
496
530
  type: "array",
497
531
  description: "Required for pass. Deterministic checks for unintended drift.",
@@ -501,10 +535,40 @@ export function toolInputSchema(phase, qaGate = null, decomposeGate = null) {
501
535
  summary: { type: "string" }
502
536
  })
503
537
  },
504
- ready_for_dev_test: { type: "boolean", description: "Required for pass and must be true." }
538
+ ready_for_dev_test: { type: "boolean", default: true, description: "Required for pass and must be true." }
505
539
  }, ["status", "summary"], "For status pass, commands must include at least one passing deterministic command, acceptance criteria entries must use status: satisfied plus evidence, and ready_for_dev_test must be true.");
506
540
  }
507
- function decomposeGateToolInputSchema(gate, baseProperties) {
541
+ // Feature-to-Story candidate fields: schedule order, handoff to dependents, and whether the Story
542
+ // needs a design reference before Forge builds it.
543
+ const storyCandidateScheduleProperties = {
544
+ scheduleIndex: { type: "number", description: "Feature-to-Story total schedule order for dependency-safe execution." },
545
+ schedule_index: { type: "number", description: "Snake_case alias for scheduleIndex." },
546
+ waveIndex: { type: "number", description: "Feature-to-Story parallel wave number." },
547
+ wave_index: { type: "number", description: "Snake_case alias for waveIndex." },
548
+ featureScheduleIndex: { type: "number", description: "Optional ordering within the Feature." },
549
+ feature_schedule_index: { type: "number", description: "Snake_case alias for featureScheduleIndex." },
550
+ expectedOutput: { type: "string", description: "Durable output this Story should produce for dependents." },
551
+ expected_output: { type: "string", description: "Snake_case alias for expectedOutput." },
552
+ handoffSummary: { type: "string", description: "How dependent Stories should consume this Story output." },
553
+ handoff_summary: { type: "string", description: "Snake_case alias for handoffSummary." },
554
+ dependencyReason: { type: "string", description: "Why this Story depends on its dependsOn predecessors." },
555
+ dependency_reason: { type: "string", description: "Snake_case alias for dependencyReason." },
556
+ requiresDesign: {
557
+ type: "boolean",
558
+ description: "Feature-to-Story only. True when the Story adds or changes user-visible UI; Forge holds it until a design reference is attached. False for non-visual Stories."
559
+ },
560
+ requires_design: { type: "boolean", description: "Snake_case alias for requiresDesign." }
561
+ };
562
+ function decomposeGateToolInputSchema(gate, phaseProperties) {
563
+ // Advertise every status the Decompose writer accepts, so the schema and the runtime agree.
564
+ const baseProperties = {
565
+ ...phaseProperties,
566
+ status: {
567
+ type: "string",
568
+ enum: [...decomposeStatuses],
569
+ description: "Use pass when the gate is complete (an omitted status means pass); needs_rework, needs_revision, fail, failed, or blocked (with blockers or findings) otherwise."
570
+ }
571
+ };
508
572
  if (gate !== "decompose_proposal") {
509
573
  return objectToolSchema({
510
574
  ...baseProperties,
@@ -512,8 +576,12 @@ function decomposeGateToolInputSchema(gate, baseProperties) {
512
576
  type: "array",
513
577
  description: "Optional issues, constraints, or risks discovered in this Decompose gate.",
514
578
  items: { type: "object", additionalProperties: true }
579
+ },
580
+ summary: {
581
+ type: "string",
582
+ description: "Required. What this gate checked or decided, in a sentence or two; it is the gate's evidence."
515
583
  }
516
- }, ["status", "summary"], `Record the ${gate.replace(/_/g, " ")} Decompose gate before continuing.`);
584
+ }, ["summary"], `Record the ${gate.replace(/_/g, " ")} Decompose gate before continuing.`);
517
585
  }
518
586
  const candidateSchema = {
519
587
  type: "object",
@@ -527,18 +595,7 @@ function decomposeGateToolInputSchema(gate, baseProperties) {
527
595
  acceptanceCriteria: { type: "string" },
528
596
  planningPacket: { type: "string" },
529
597
  sortOrder: { type: "number" },
530
- scheduleIndex: { type: "number", description: "Feature-to-Story total schedule order for dependency-safe execution." },
531
- schedule_index: { type: "number", description: "Snake_case alias for scheduleIndex." },
532
- waveIndex: { type: "number", description: "Feature-to-Story parallel wave number." },
533
- wave_index: { type: "number", description: "Snake_case alias for waveIndex." },
534
- featureScheduleIndex: { type: "number", description: "Optional ordering within the Feature." },
535
- feature_schedule_index: { type: "number", description: "Snake_case alias for featureScheduleIndex." },
536
- expectedOutput: { type: "string", description: "Durable output this Story should produce for dependents." },
537
- expected_output: { type: "string", description: "Snake_case alias for expectedOutput." },
538
- handoffSummary: { type: "string", description: "How dependent Stories should consume this Story output." },
539
- handoff_summary: { type: "string", description: "Snake_case alias for handoffSummary." },
540
- dependencyReason: { type: "string", description: "Why this Story depends on its dependsOn predecessors." },
541
- dependency_reason: { type: "string", description: "Snake_case alias for dependencyReason." },
598
+ ...storyCandidateScheduleProperties,
542
599
  points: { type: "number" },
543
600
  dependsOn: { type: "array", items: { type: "string" } },
544
601
  estimatedQaScope: qaScopeSchema("Work Order-to-Feature planning QA estimate. This is not dispatch-authoritative QA scope."),
@@ -552,7 +609,8 @@ function decomposeGateToolInputSchema(gate, baseProperties) {
552
609
  const proposalSchema = {
553
610
  type: "object",
554
611
  additionalProperties: true,
555
- description: "Final Decompose proposal JSON. Must include candidates, and may include blockedReason.",
612
+ description: "Required unless decomposition_json is sent instead (send one of the two). Final Decompose proposal JSON. Must include candidates, and may include blockedReason.",
613
+ required: ["candidates"],
556
614
  properties: {
557
615
  summary: { type: "string" },
558
616
  blockedReason: { type: "string" },
@@ -567,15 +625,51 @@ function decomposeGateToolInputSchema(gate, baseProperties) {
567
625
  ...baseProperties,
568
626
  status: {
569
627
  type: "string",
570
- enum: ["pass", "needs_rework", "blocked"],
571
- description: "Use pass only when the Decompose proposal is ready for user sign-off."
628
+ enum: [...decomposeStatuses],
629
+ description: "Use pass only when the Decompose proposal is ready for user sign-off; needs_rework, needs_revision, fail, failed, or blocked otherwise."
572
630
  },
573
631
  proposal_json: proposalSchema,
574
632
  decomposition_json: {
575
633
  ...proposalSchema,
576
- description: "Alias for proposal_json when a client cannot send proposal_json."
634
+ description: "Alias for proposal_json, for a client that cannot send proposal_json. Required unless proposal_json is sent (send one of the two)."
577
635
  }
578
- }, ["status", "summary"], "For the final Decompose proposal, include proposal_json with a candidates array. Work Order-to-Feature candidates may include estimatedQaScope/estimated_qa_scope; Feature-to-Story candidates may include qaScope/qa_scope. Both levels may include designerRefCandidates/designer_ref_candidates.");
636
+ // proposal_json and its decomposition_json alias are each required unless the other is sent, so
637
+ // neither is listed as required: an alias-only call is valid, as the writer accepts it.
638
+ }, [], "For the final Decompose proposal, include proposal_json (or its alias decomposition_json) with a candidates array. Work Order-to-Feature candidates may include estimatedQaScope/estimated_qa_scope; Feature-to-Story candidates may include qaScope/qa_scope. Both levels may include designerRefCandidates/designer_ref_candidates.");
639
+ }
640
+ function draftGateToolInputSchema(gate, baseProperties) {
641
+ const status = {
642
+ type: "string",
643
+ enum: [...draftStatuses],
644
+ description: "Use pass when the gate is complete (an omitted status means pass); needs_revision, needs_rework, or blocked otherwise."
645
+ };
646
+ if (gate !== "draft_proposal") {
647
+ const summary = {
648
+ type: "string",
649
+ description: "Required. What this gate checked or decided, in a sentence or two; it is the gate's evidence."
650
+ };
651
+ return objectToolSchema({ ...baseProperties, status, summary }, ["summary"], `Record the ${gate.replace(/_/g, " ")} Draft gate before continuing.`);
652
+ }
653
+ return objectToolSchema({
654
+ ...baseProperties,
655
+ status,
656
+ draft_json: {
657
+ type: "object",
658
+ additionalProperties: true,
659
+ description: "Required. The drafted item as a JSON object, in one of three shapes: a work item (non-empty title, description, and acceptanceCriteria strings), a Work Order (non-empty title, summary, objective, planningPacket, and decompositionContext strings), or a decomposition (non-empty summary string and a candidates array). Optional suggested_qa_scope must be a QA scope object.",
660
+ properties: {
661
+ title: { type: "string", description: "Required and non-empty for a work item or Work Order draft." },
662
+ summary: { type: "string", description: "Required and non-empty for a Work Order or decomposition draft." },
663
+ description: { type: "string", description: "Required and non-empty for a work item draft." },
664
+ acceptanceCriteria: { type: "string", description: "Required and non-empty for a work item draft." },
665
+ objective: { type: "string", description: "Required and non-empty for a Work Order draft." },
666
+ planningPacket: { type: "string", description: "Required and non-empty for a Work Order draft." },
667
+ decompositionContext: { type: "string", description: "Required and non-empty for a Work Order draft." },
668
+ candidates: { type: "array", description: "Required for a decomposition draft.", items: { type: "object", additionalProperties: true } },
669
+ suggested_qa_scope: qaScopeSchema("Optional suggested QA scope for the drafted item.")
670
+ }
671
+ }
672
+ }, ["draft_json"], "Record the final Draft proposal with draft_json as a JSON object.");
579
673
  }
580
674
  function designerRefCandidatesSchema(description) {
581
675
  return {
@@ -603,14 +697,16 @@ function debugToolInputSchema(phase, baseProperties) {
603
697
  ...baseProperties,
604
698
  repro_steps: {
605
699
  type: "array",
606
- description: "Required for pass. Minimal reproduction or characterization steps.",
700
+ description: "Required and non-empty for pass. Minimal reproduction or characterization steps.",
701
+ minItems: 1,
607
702
  items: { type: "string" }
608
703
  },
609
- observed: { type: "string", description: "Observed failure behavior." },
610
- expected: { type: "string", description: "Expected behavior." },
704
+ observed: { type: "string", description: "Required for pass. Observed failure behavior." },
705
+ expected: { type: "string", description: "Required for pass. Expected behavior." },
611
706
  evidence: {
612
707
  type: "array",
613
- description: "Required for pass. Concrete logs, commands, screenshots, file refs, or characterization notes.",
708
+ description: "Required and non-empty for pass. Concrete logs, commands, screenshots, file refs, or characterization notes.",
709
+ minItems: 1,
614
710
  items: { type: "object", additionalProperties: true }
615
711
  }
616
712
  }, ["status", "summary"], "For status pass, include repro_steps, observed, expected, and evidence.");
@@ -618,10 +714,11 @@ function debugToolInputSchema(phase, baseProperties) {
618
714
  if (phase === "debug_root_cause") {
619
715
  return objectToolSchema({
620
716
  ...baseProperties,
621
- root_cause: { type: "string", description: "Likely root cause tied to code or config evidence." },
717
+ root_cause: { type: "string", description: "Required for pass. Likely root cause tied to code or config evidence." },
622
718
  evidence: {
623
719
  type: "array",
624
- description: "Required for pass. Concrete code/log/test evidence supporting the root cause.",
720
+ description: "Required and non-empty for pass. Concrete code/log/test evidence supporting the root cause.",
721
+ minItems: 1,
625
722
  items: { type: "object", additionalProperties: true }
626
723
  },
627
724
  eliminated_alternatives: {
@@ -629,7 +726,7 @@ function debugToolInputSchema(phase, baseProperties) {
629
726
  description: "Required for pass. Plausible alternatives checked or ruled out.",
630
727
  items: { type: "object", additionalProperties: true }
631
728
  },
632
- risk_area: { type: "string", description: "Subsystem or behavior most at risk from the fix." }
729
+ risk_area: { type: "string", description: "Required for pass. Subsystem or behavior most at risk from the fix." }
633
730
  }, ["status", "summary"], "For status pass, include root_cause, evidence, eliminated_alternatives, and risk_area.");
634
731
  }
635
732
  if (phase === "debug_fix") {
@@ -637,7 +734,8 @@ function debugToolInputSchema(phase, baseProperties) {
637
734
  ...baseProperties,
638
735
  changed_files: {
639
736
  type: "array",
640
- description: "Required for pass. Files changed by the bug fix.",
737
+ description: "Required and non-empty for pass. Files changed by the bug fix.",
738
+ minItems: 1,
641
739
  items: evidenceObjectSchema(["path", "summary"], { path: { type: "string" }, summary: { type: "string" } })
642
740
  },
643
741
  tests_added_or_updated: {
@@ -662,17 +760,19 @@ function debugToolInputSchema(phase, baseProperties) {
662
760
  commands: {
663
761
  type: "array",
664
762
  description: "Required for pass. Targeted regression/repro-negative commands with exit_code: 0 and status: pass.",
763
+ minItems: 1,
665
764
  items: commandEvidenceSchema()
666
765
  },
667
766
  required_regressions: {
668
767
  type: "array",
669
- description: "Required for pass. Repro-negative and regression coverage checklist.",
768
+ description: "Required and non-empty for pass. Repro-negative and regression coverage checklist.",
769
+ minItems: 1,
670
770
  items: { type: "string" }
671
771
  },
672
- build_status: { type: "string", description: "Required for pass. pass or not_applicable." },
673
- test_status: { type: "string", description: "Required for pass. pass or not_applicable." },
674
- repro_negative: { type: "boolean", description: "Required for pass and must be true after the original repro no longer fails." },
675
- qa_ready: { type: "boolean", description: "Required for pass and must be true." }
772
+ build_status: { type: "string", default: "pass", description: "Required for pass. pass or not_applicable." },
773
+ test_status: { type: "string", default: "pass", description: "Required for pass. pass or not_applicable." },
774
+ repro_negative: { type: "boolean", default: true, description: "Required for pass and must be true after the original repro no longer fails." },
775
+ qa_ready: { type: "boolean", default: true, description: "Required for pass and must be true." }
676
776
  }, ["status", "summary"], "For status pass, commands must include at least one passing deterministic debug regression check, repro_negative must be true, and qa_ready must be true.");
677
777
  }
678
778
  function qaGateToolInputSchema(gate) {
@@ -710,150 +810,37 @@ function qaGateToolInputSchema(gate) {
710
810
  ...baseProperties,
711
811
  findings: {
712
812
  type: "array",
713
- description: "Normalized in-scope and out-of-scope QA findings.",
813
+ description: "Required for pass or skipped, even when empty. Normalized in-scope and out-of-scope QA findings.",
714
814
  items: { type: "object", additionalProperties: true }
715
815
  },
716
816
  candidate_bugs: {
717
817
  type: "array",
718
- description: "Out-of-scope or follow-up candidates.",
818
+ description: "Required for pass or skipped, even when empty. Out-of-scope or follow-up candidates.",
719
819
  items: { type: "object", additionalProperties: true }
720
820
  }
721
821
  }, ["status", "summary"], "Record normalized QA findings. Pass or skipped requires findings and candidate_bugs arrays, even when empty.");
722
822
  }
823
+ const commandRule = gate === "qa_regression"
824
+ ? "Required and non-empty for pass. Every entry needs exit_code 0 and status pass, except a verified non-blocking failure classified as out_of_scope_failure or baseline_failure with candidate_bug_id, scope_evidence, acceptance_criteria_independent: true, and its repro or baseline fields."
825
+ : gate === "qa_api"
826
+ ? "Required and non-empty for pass, and every entry needs exit_code 0 and status pass."
827
+ : "Command evidence for this gate when applicable.";
723
828
  return objectToolSchema({
724
829
  ...baseProperties,
725
830
  commands: {
726
831
  type: "array",
727
- description: "Command evidence for this gate when applicable.",
832
+ description: commandRule,
728
833
  items: commandEvidenceSchema()
729
834
  },
730
835
  browser_checks: {
731
836
  type: "array",
732
- description: "Browser/manual evidence for this gate when applicable.",
733
- items: { type: "object", additionalProperties: true }
837
+ description: gate === "qa_manual_web"
838
+ ? "Browser/manual evidence. Pass requires at least one browser check or a notes string."
839
+ : "Browser/manual evidence for this gate when applicable.",
840
+ items: browserCheckSchema(["summary", "status"])
734
841
  },
842
+ sidecars: qaSidecarsSchema(),
843
+ evidence: qaGateEvidenceWrapperSchema(),
735
844
  notes: { type: "string", description: "Evidence notes for this gate." }
736
- }, ["status", "summary"], "Record this QA evidence gate. Use skipped with a reason when the gate is not applicable.");
737
- }
738
- function objectToolSchema(properties, required, description) {
739
- return {
740
- type: "object",
741
- additionalProperties: true,
742
- description,
743
- properties,
744
- required: [...required]
745
- };
746
- }
747
- function evidenceObjectSchema(required, properties) {
748
- return {
749
- type: "object",
750
- additionalProperties: true,
751
- properties,
752
- required: [...required]
753
- };
754
- }
755
- function qaScopeSchema(description) {
756
- return {
757
- type: "object",
758
- additionalProperties: false,
759
- description,
760
- properties: {
761
- schema_version: { type: "number", enum: [1] },
762
- surface: { type: "array", items: { type: "string", enum: [...qaScopeSurfaces] } },
763
- required_evidence: { type: "array", items: { type: "string", enum: [...qaScopeEvidence] } },
764
- required_capabilities: {
765
- type: "array",
766
- description: "Runner facilities required by implementation and validation. Use docker_engine when tests or project services require access to a Docker daemon, even when the agent itself runs in a managed host worktree.",
767
- items: { type: "string", enum: ["docker_engine"] }
768
- },
769
- not_applicable: { type: "array", items: { type: "string", enum: [...qaScopeEvidence] } },
770
- browser_required: { type: "boolean" },
771
- api_required: { type: "boolean" },
772
- source: { type: "string", enum: [...qaScopeSources] },
773
- authority: { type: "string", enum: [...qaScopeAuthorities] },
774
- confidence: { type: "string", enum: [...qaScopeConfidence] },
775
- confirmed_by_user: { type: "boolean" },
776
- locked: { type: "boolean" },
777
- derived_from: {
778
- type: "object",
779
- additionalProperties: false,
780
- properties: {
781
- work_item_id: { type: "string" },
782
- mode: { type: "string" }
783
- }
784
- },
785
- rationale: { type: "string" }
786
- },
787
- required: ["schema_version", "required_evidence", "not_applicable"]
788
- };
789
- }
790
- function commandEvidenceSchema() {
791
- return evidenceObjectSchema(["command", "exit_code", "status", "summary"], {
792
- command: { type: "string" },
793
- managed_command_id: { type: "string", description: "Receipt ID returned by forge.start_managed_command after forge.wait_managed_command reports a terminal receipt. A transport-safe wait can return command_continues=true; wait again after retry_after_ms before submitting the gate." },
794
- exit_code: { type: ["number", "null"], description: "Process exit code, or null when the managed runner timed out or could not launch the process." },
795
- status: { type: "string" },
796
- summary: { type: "string" },
797
- classification: {
798
- type: "string",
799
- enum: ["out_of_scope_failure", "baseline_failure"],
800
- description: "Only for a verified non-blocking failure in a passing QA regression gate. Never use for an in-scope or unexplained failure."
801
- },
802
- candidate_bug_id: { type: "string", description: "Required for a classified non-blocking failure; links the preserved failure to candidate_bugs." },
803
- scope_evidence: { type: "string", description: "Required proof that the failing surface is outside the current acceptance criteria and changed-file scope." },
804
- acceptance_criteria_independent: { type: "boolean", description: "Required and true only when the current item can be judged independently of this failure." },
805
- repro_command: { type: "string", description: "Required for out_of_scope_failure; focused command that reproduced the unrelated failure." },
806
- repro_exit_code: { type: "number", description: "Required non-zero focused repro exit code for out_of_scope_failure." },
807
- baseline_ref: { type: "string", description: "Required for baseline_failure; immutable ref where the same failure was observed." },
808
- baseline_exit_code: { type: "number", description: "Required non-zero baseline command exit code for baseline_failure." },
809
- failure_signature_match: { type: "boolean", description: "Required and true for baseline_failure after matching failing test/error signatures." }
810
- });
811
- }
812
- function resolvedFindingSchema() {
813
- return evidenceObjectSchema([
814
- "qa_id",
815
- "status",
816
- "summary",
817
- "evidence",
818
- "changed_files",
819
- "tests_added_or_updated",
820
- "regression_evidence"
821
- ], {
822
- qa_id: { type: "string" },
823
- status: {
824
- type: "string",
825
- enum: [...resolvedFindingStatusValues],
826
- description: "Use resolved when fixed, disputed when the QA finding is incorrect/out-of-scope, or not_reproduced when retesting cannot reproduce it."
827
- },
828
- summary: { type: "string" },
829
- evidence: { description: "Concrete evidence for the resolution." },
830
- changed_files: { type: "array", description: "Required and non-empty when status is resolved." },
831
- tests_added_or_updated: { type: "array", description: "Required and non-empty when status is resolved." },
832
- regression_evidence: { description: "Concrete regression evidence for this QA finding." }
833
- });
834
- }
835
- function acceptanceCriteriaSchema() {
836
- return {
837
- type: "array",
838
- description: "Required for pass. Every entry must be an object with status: satisfied and non-empty evidence.",
839
- items: evidenceObjectSchema(["criterion", "evidence", "status"], {
840
- criterion: { type: "string" },
841
- evidence: { type: "string" },
842
- status: { type: "string", enum: ["satisfied"] }
843
- })
844
- };
845
- }
846
- function reviewSectionSchema() {
847
- return {
848
- type: "object",
849
- description: "Required for pass. Use status pass/fail/needs_rework/not_applicable plus notes.",
850
- additionalProperties: true,
851
- properties: reviewSectionProperties()
852
- };
853
- }
854
- function reviewSectionProperties() {
855
- return {
856
- status: { type: "string" },
857
- notes: { type: "string" }
858
- };
845
+ }, ["status", "summary"], "Record this QA evidence gate. Use skipped with a reason when the gate is not applicable. Send array fields as JSON arrays, not quoted strings.");
859
846
  }