@loucompanion/forge-bridge 0.1.3-dev.f66395c3ac21 → 0.1.4-dev.0098fdb4e213

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 (381) hide show
  1. package/README.md +306 -1
  2. package/dist/bridge/bridge-chat-provider-command.d.ts +19 -0
  3. package/dist/bridge/bridge-chat-provider-command.js +132 -0
  4. package/dist/bridge/bridge-chat.types.d.ts +121 -0
  5. package/dist/bridge/bridge-chat.types.js +416 -0
  6. package/dist/bridge/bridge-state-file.d.ts +161 -0
  7. package/dist/bridge/bridge-state-file.js +376 -0
  8. package/dist/bridge/bridge-state-io.d.ts +11 -0
  9. package/dist/bridge/bridge-state-io.js +50 -0
  10. package/dist/bridge/bridge-state-lock.d.ts +11 -0
  11. package/dist/bridge/bridge-state-lock.js +102 -0
  12. package/dist/bridge/bridge-state-unpublished.d.ts +17 -0
  13. package/dist/bridge/bridge-state-unpublished.js +111 -0
  14. package/dist/bridge/bridge.base.d.ts +18 -1
  15. package/dist/bridge/bridge.service.d.ts +216 -4
  16. package/dist/bridge/bridge.service.js +2574 -90
  17. package/dist/bridge/bridge.types.d.ts +245 -2
  18. package/dist/bridge/dispatch-result-outbox.d.ts +35 -0
  19. package/dist/bridge/dispatch-result-outbox.js +87 -0
  20. package/dist/bridge/dispatch-result-worker.d.ts +2 -0
  21. package/dist/bridge/dispatch-result-worker.js +122 -0
  22. package/dist/bridge/in-flight-registry.d.ts +62 -0
  23. package/dist/bridge/in-flight-registry.js +207 -0
  24. package/dist/bridge/internals.d.ts +2 -0
  25. package/dist/bridge/internals.js +1 -0
  26. package/dist/bridge/local-yield-flag.d.ts +6 -0
  27. package/dist/bridge/local-yield-flag.js +34 -0
  28. package/dist/bridge/readiness-result-outbox.d.ts +25 -0
  29. package/dist/bridge/readiness-result-outbox.js +74 -0
  30. package/dist/bridge/readiness-result-worker.d.ts +2 -0
  31. package/dist/bridge/readiness-result-worker.js +121 -0
  32. package/dist/bridge/runner-host-capabilities.d.ts +20 -0
  33. package/dist/bridge/runner-host-capabilities.js +110 -0
  34. package/dist/bridge/sandbox-resource-accounting.d.ts +16 -0
  35. package/dist/bridge/sandbox-resource-accounting.js +150 -0
  36. package/dist/bridge/test-postgres-capability.d.ts +14 -0
  37. package/dist/bridge/test-postgres-capability.js +120 -0
  38. package/dist/cleanup/cleanup-wip.d.ts +12 -0
  39. package/dist/cleanup/cleanup-wip.js +66 -0
  40. package/dist/cleanup/cleanup.service.d.ts +33 -2
  41. package/dist/cleanup/cleanup.service.js +477 -3
  42. package/dist/cleanup/cleanup.types.d.ts +16 -0
  43. package/dist/cleanup/forge-owned-paths.d.ts +9 -0
  44. package/dist/cleanup/forge-owned-paths.js +53 -0
  45. package/dist/cleanup/host-runtime-ledger.d.ts +7 -0
  46. package/dist/cleanup/host-runtime-ledger.js +130 -0
  47. package/dist/cleanup/index.d.ts +1 -1
  48. package/dist/cleanup/index.js +1 -1
  49. package/dist/cleanup/internals.d.ts +2 -2
  50. package/dist/cleanup/internals.js +1 -1
  51. package/dist/cleanup/managed-branch-sweep.d.ts +27 -0
  52. package/dist/cleanup/managed-branch-sweep.js +111 -0
  53. package/dist/cli/cli.help.d.ts +2 -0
  54. package/dist/cli/cli.help.js +279 -0
  55. package/dist/cli/cli.service.d.ts +69 -12
  56. package/dist/cli/cli.service.js +557 -382
  57. package/dist/cli/idle-status.d.ts +84 -0
  58. package/dist/cli/idle-status.js +181 -0
  59. package/dist/cli/local-config.d.ts +13 -0
  60. package/dist/cli/local-config.js +82 -6
  61. package/dist/cli/provider-cli-detection.d.ts +10 -0
  62. package/dist/cli/provider-cli-detection.js +160 -0
  63. package/dist/runtime/aspnet-runtime-prebuild.d.ts +41 -0
  64. package/dist/runtime/aspnet-runtime-prebuild.js +474 -0
  65. package/dist/runtime/attempt-database-broker.d.ts +89 -0
  66. package/dist/runtime/attempt-database-broker.js +390 -0
  67. package/dist/runtime/attempt-node-runtime-launcher.d.ts +18 -0
  68. package/dist/runtime/attempt-node-runtime-launcher.js +140 -0
  69. package/dist/runtime/attempt-path-operation.d.ts +21 -0
  70. package/dist/runtime/attempt-path-operation.js +94 -0
  71. package/dist/runtime/attempt-private-directory.d.ts +6 -0
  72. package/dist/runtime/attempt-private-directory.js +54 -0
  73. package/dist/runtime/attempt-process-supervisor-registry.d.ts +20 -0
  74. package/dist/runtime/attempt-process-supervisor-registry.js +64 -0
  75. package/dist/runtime/attempt-process-supervisor.d.ts +121 -0
  76. package/dist/runtime/attempt-process-supervisor.js +471 -0
  77. package/dist/runtime/canonical-source-file.d.ts +3 -0
  78. package/dist/runtime/canonical-source-file.js +54 -0
  79. package/dist/runtime/docker-engine-probe.d.ts +95 -0
  80. package/dist/runtime/docker-engine-probe.js +340 -0
  81. package/dist/runtime/ephemeral-test-postgres-grant.d.ts +37 -0
  82. package/dist/runtime/ephemeral-test-postgres-grant.js +85 -0
  83. package/dist/runtime/ephemeral-test-postgres.d.ts +57 -0
  84. package/dist/runtime/ephemeral-test-postgres.js +303 -0
  85. package/dist/runtime/generated-output-reset.d.ts +20 -0
  86. package/dist/runtime/generated-output-reset.js +157 -0
  87. package/dist/runtime/host-database-capability-boundary.d.ts +16 -0
  88. package/dist/runtime/host-database-capability-boundary.js +63 -0
  89. package/dist/runtime/host-diagnostics.d.ts +11 -0
  90. package/dist/runtime/host-diagnostics.js +192 -0
  91. package/dist/runtime/host-execution-root.d.ts +4 -0
  92. package/dist/runtime/host-execution-root.js +39 -0
  93. package/dist/runtime/host-facts.d.ts +36 -0
  94. package/dist/runtime/host-facts.js +95 -0
  95. package/dist/runtime/host-listener-inspector.d.ts +51 -0
  96. package/dist/runtime/host-listener-inspector.js +385 -0
  97. package/dist/runtime/host-load-admission.d.ts +67 -0
  98. package/dist/runtime/host-load-admission.js +99 -0
  99. package/dist/runtime/host-load-child-environment.d.ts +27 -0
  100. package/dist/runtime/host-load-child-environment.js +76 -0
  101. package/dist/runtime/host-load-forge-cgroups.d.ts +49 -0
  102. package/dist/runtime/host-load-forge-cgroups.js +140 -0
  103. package/dist/runtime/host-load-governor-config.d.ts +52 -0
  104. package/dist/runtime/host-load-governor-config.js +83 -0
  105. package/dist/runtime/host-load-governor.d.ts +186 -0
  106. package/dist/runtime/host-load-governor.js +632 -0
  107. package/dist/runtime/host-load-ledger-lock.d.ts +69 -0
  108. package/dist/runtime/host-load-ledger-lock.js +187 -0
  109. package/dist/runtime/host-load-runtime-settings.d.ts +25 -0
  110. package/dist/runtime/host-load-runtime-settings.js +80 -0
  111. package/dist/runtime/host-load-sampler.d.ts +156 -0
  112. package/dist/runtime/host-load-sampler.js +298 -0
  113. package/dist/runtime/host-load-step-class.d.ts +70 -0
  114. package/dist/runtime/host-load-step-class.js +161 -0
  115. package/dist/runtime/host-load-step-reaper.d.ts +27 -0
  116. package/dist/runtime/host-load-step-reaper.js +95 -0
  117. package/dist/runtime/host-load-step-run.d.ts +73 -0
  118. package/dist/runtime/host-load-step-run.js +102 -0
  119. package/dist/runtime/host-load-test-slot.d.ts +43 -0
  120. package/dist/runtime/host-load-test-slot.js +81 -0
  121. package/dist/runtime/host-load-token-ledger.d.ts +200 -0
  122. package/dist/runtime/host-load-token-ledger.js +453 -0
  123. package/dist/runtime/host-load-windows-cpu.d.ts +34 -0
  124. package/dist/runtime/host-load-windows-cpu.js +85 -0
  125. package/dist/runtime/host-port-broker.d.ts +76 -0
  126. package/dist/runtime/host-port-broker.js +333 -0
  127. package/dist/runtime/host-pressure-stall.d.ts +61 -0
  128. package/dist/runtime/host-pressure-stall.js +168 -0
  129. package/dist/runtime/host-runtime-contract.d.ts +74 -0
  130. package/dist/runtime/host-runtime-contract.js +846 -0
  131. package/dist/runtime/host-runtime-lease.d.ts +287 -0
  132. package/dist/runtime/host-runtime-lease.js +2763 -0
  133. package/dist/runtime/host-runtime-promotion.d.ts +55 -0
  134. package/dist/runtime/host-runtime-promotion.js +254 -0
  135. package/dist/runtime/host-runtime-requirements-check.d.ts +17 -0
  136. package/dist/runtime/host-runtime-requirements-check.js +29 -0
  137. package/dist/runtime/host-runtime-requirements.d.ts +36 -0
  138. package/dist/runtime/host-runtime-requirements.js +117 -0
  139. package/dist/runtime/managed-command-teardown.d.ts +62 -0
  140. package/dist/runtime/managed-command-teardown.js +596 -0
  141. package/dist/runtime/memory-capacity.d.ts +70 -0
  142. package/dist/runtime/memory-capacity.js +123 -0
  143. package/dist/runtime/native-test-postgres-fallback.d.ts +69 -0
  144. package/dist/runtime/native-test-postgres-fallback.js +143 -0
  145. package/dist/runtime/node-host-runtime-adapter.d.ts +54 -0
  146. package/dist/runtime/node-host-runtime-adapter.js +286 -0
  147. package/dist/runtime/pinned-directory-process.d.ts +9 -0
  148. package/dist/runtime/pinned-directory-process.js +61 -0
  149. package/dist/runtime/pinned-source-directory.d.ts +17 -0
  150. package/dist/runtime/pinned-source-directory.js +94 -0
  151. package/dist/runtime/playwright-browser-cache.d.ts +39 -0
  152. package/dist/runtime/playwright-browser-cache.js +227 -0
  153. package/dist/runtime/playwright-host-runtime-adapter.d.ts +39 -0
  154. package/dist/runtime/playwright-host-runtime-adapter.js +274 -0
  155. package/dist/runtime/prepared-runtime-identity.d.ts +6 -0
  156. package/dist/runtime/prepared-runtime-identity.js +218 -0
  157. package/dist/runtime/prepared-runtime-readiness.d.ts +30 -0
  158. package/dist/runtime/prepared-runtime-readiness.js +285 -0
  159. package/dist/runtime/runner-settings.d.ts +104 -0
  160. package/dist/runtime/runner-settings.js +236 -0
  161. package/dist/runtime/runtime-isolation-lease.d.ts +67 -0
  162. package/dist/runtime/runtime-isolation-lease.js +161 -0
  163. package/dist/runtime/workspace-resource-estimator.d.ts +17 -0
  164. package/dist/runtime/workspace-resource-estimator.js +174 -0
  165. package/dist/sandbox/command-runner.d.ts +4 -0
  166. package/dist/sandbox/command-runner.js +47 -0
  167. package/dist/sandbox/contract.d.ts +5 -0
  168. package/dist/sandbox/contract.js +276 -0
  169. package/dist/sandbox/event-budget.d.ts +11 -0
  170. package/dist/sandbox/event-budget.js +27 -0
  171. package/dist/sandbox/host-capacity-broker.d.ts +115 -0
  172. package/dist/sandbox/host-capacity-broker.js +336 -0
  173. package/dist/sandbox/image-policy.d.ts +35 -0
  174. package/dist/sandbox/image-policy.js +247 -0
  175. package/dist/sandbox/index.d.ts +5 -0
  176. package/dist/sandbox/index.js +5 -0
  177. package/dist/sandbox/lease-watchdog.d.ts +18 -0
  178. package/dist/sandbox/lease-watchdog.js +67 -0
  179. package/dist/sandbox/managed-branch.d.ts +13 -0
  180. package/dist/sandbox/managed-branch.js +36 -0
  181. package/dist/sandbox/preflight.d.ts +84 -0
  182. package/dist/sandbox/preflight.js +521 -0
  183. package/dist/sandbox/process.d.ts +20 -0
  184. package/dist/sandbox/process.js +209 -0
  185. package/dist/sandbox/provider-auth/codex.d.ts +26 -0
  186. package/dist/sandbox/provider-auth/codex.js +212 -0
  187. package/dist/sandbox/repository-lock.d.ts +6 -0
  188. package/dist/sandbox/repository-lock.js +129 -0
  189. package/dist/sandbox/runtime.d.ts +311 -0
  190. package/dist/sandbox/runtime.js +2407 -0
  191. package/dist/sandbox/sandbox-cgroups.d.ts +14 -0
  192. package/dist/sandbox/sandbox-cgroups.js +42 -0
  193. package/dist/sandbox/sandbox.types.d.ts +93 -0
  194. package/dist/sandbox/sandbox.types.js +1 -0
  195. package/dist/sandbox/smoke.d.ts +76 -0
  196. package/dist/sandbox/smoke.js +380 -0
  197. package/dist/sandbox/worker-supervisor.d.ts +13 -0
  198. package/dist/sandbox/worker-supervisor.js +36 -0
  199. package/dist/sandbox/worker.d.ts +1 -0
  200. package/dist/sandbox/worker.js +225 -0
  201. package/dist/sandbox/workspace.service.d.ts +13 -0
  202. package/dist/sandbox/workspace.service.js +74 -0
  203. package/dist/session/architect-waits.d.ts +2 -0
  204. package/dist/session/architect-waits.js +138 -0
  205. package/dist/session/managed-attempt-tools.d.ts +48 -0
  206. package/dist/session/managed-attempt-tools.js +1299 -0
  207. package/dist/session/managed-build-coordinator.d.ts +5 -0
  208. package/dist/session/managed-build-coordinator.js +109 -0
  209. package/dist/session/managed-build-receipt.d.ts +26 -0
  210. package/dist/session/managed-build-receipt.js +342 -0
  211. package/dist/session/managed-command-host-load.d.ts +47 -0
  212. package/dist/session/managed-command-host-load.js +83 -0
  213. package/dist/session/managed-verification-timeouts.d.ts +8 -0
  214. package/dist/session/managed-verification-timeouts.js +17 -0
  215. package/dist/session/mcp-argument-coercion.d.ts +23 -0
  216. package/dist/session/mcp-argument-coercion.js +121 -0
  217. package/dist/session/phase-completion.artifacts.d.ts +34 -0
  218. package/dist/session/phase-completion.artifacts.js +903 -0
  219. package/dist/session/phase-completion.command-validation.d.ts +7 -0
  220. package/dist/session/phase-completion.command-validation.js +77 -0
  221. package/dist/session/phase-completion.d.ts +65 -42
  222. package/dist/session/phase-completion.helpers.d.ts +117 -0
  223. package/dist/session/phase-completion.helpers.js +708 -0
  224. package/dist/session/phase-completion.js +130 -3007
  225. package/dist/session/phase-completion.mcp-args.d.ts +9 -0
  226. package/dist/session/phase-completion.mcp-args.js +156 -0
  227. package/dist/session/phase-completion.prompts.d.ts +14 -0
  228. package/dist/session/phase-completion.prompts.js +238 -0
  229. package/dist/session/phase-completion.runtime.d.ts +43 -0
  230. package/dist/session/phase-completion.runtime.js +721 -0
  231. package/dist/session/phase-completion.schema-parts.d.ts +19 -0
  232. package/dist/session/phase-completion.schema-parts.js +188 -0
  233. package/dist/session/phase-completion.schemas.d.ts +3 -0
  234. package/dist/session/phase-completion.schemas.js +836 -0
  235. package/dist/session/phase-completion.validation.d.ts +37 -0
  236. package/dist/session/phase-completion.validation.js +874 -0
  237. package/dist/session/pre-publication-host-load.d.ts +27 -0
  238. package/dist/session/pre-publication-host-load.js +111 -0
  239. package/dist/session/pre-publication-native-postgres.d.ts +30 -0
  240. package/dist/session/pre-publication-native-postgres.js +111 -0
  241. package/dist/session/pre-publication-pass.d.ts +61 -0
  242. package/dist/session/pre-publication-pass.js +148 -0
  243. package/dist/session/pre-publication-process.d.ts +23 -0
  244. package/dist/session/pre-publication-process.js +109 -0
  245. package/dist/session/pre-publication-skipped-tests.d.ts +21 -0
  246. package/dist/session/pre-publication-skipped-tests.js +109 -0
  247. package/dist/session/pre-publication-step-execution.d.ts +12 -0
  248. package/dist/session/pre-publication-step-execution.js +50 -0
  249. package/dist/session/pre-publication-validation.d.ts +91 -0
  250. package/dist/session/pre-publication-validation.js +670 -0
  251. package/dist/session/provider-cli/bridge-cli.conformance-fixtures.d.ts +72 -0
  252. package/dist/session/provider-cli/bridge-cli.conformance-fixtures.js +462 -0
  253. package/dist/session/provider-cli/ci-repair-readiness.d.ts +16 -0
  254. package/dist/session/provider-cli/ci-repair-readiness.js +110 -0
  255. package/dist/session/provider-cli/claude-background-work.d.ts +67 -0
  256. package/dist/session/provider-cli/claude-background-work.js +181 -0
  257. package/dist/session/provider-cli/host-build-lock.d.ts +18 -0
  258. package/dist/session/provider-cli/host-build-lock.js +30 -0
  259. package/dist/session/provider-cli/pre-publication-repair.d.ts +56 -0
  260. package/dist/session/provider-cli/pre-publication-repair.js +276 -0
  261. package/dist/session/provider-cli/provider-cli.artifacts.d.ts +96 -0
  262. package/dist/session/provider-cli/provider-cli.artifacts.js +818 -0
  263. package/dist/session/provider-cli/provider-cli.base.d.ts +1 -0
  264. package/dist/session/provider-cli/provider-cli.child-environment.d.ts +7 -0
  265. package/dist/session/provider-cli/provider-cli.child-environment.js +75 -0
  266. package/dist/session/provider-cli/provider-cli.codex-models-cache.d.ts +3 -0
  267. package/dist/session/provider-cli/provider-cli.codex-models-cache.js +37 -0
  268. package/dist/session/provider-cli/provider-cli.deterministic-payloads.d.ts +12 -0
  269. package/dist/session/provider-cli/provider-cli.deterministic-payloads.js +279 -0
  270. package/dist/session/provider-cli/provider-cli.deterministic.d.ts +14 -0
  271. package/dist/session/provider-cli/provider-cli.deterministic.js +407 -0
  272. package/dist/session/provider-cli/provider-cli.merge-integrity.d.ts +89 -0
  273. package/dist/session/provider-cli/provider-cli.merge-integrity.js +310 -0
  274. package/dist/session/provider-cli/provider-cli.process.d.ts +114 -0
  275. package/dist/session/provider-cli/provider-cli.process.js +757 -0
  276. package/dist/session/provider-cli/provider-cli.prompts.d.ts +62 -0
  277. package/dist/session/provider-cli/provider-cli.prompts.js +770 -0
  278. package/dist/session/provider-cli/provider-cli.qa-sidecars.d.ts +11 -0
  279. package/dist/session/provider-cli/provider-cli.qa-sidecars.js +66 -0
  280. package/dist/session/provider-cli/provider-cli.repair-epoch.d.ts +6 -0
  281. package/dist/session/provider-cli/provider-cli.repair-epoch.js +11 -0
  282. package/dist/session/provider-cli/provider-cli.runtime.d.ts +30 -0
  283. package/dist/session/provider-cli/provider-cli.runtime.js +120 -0
  284. package/dist/session/provider-cli/provider-cli.service.d.ts +53 -53
  285. package/dist/session/provider-cli/provider-cli.service.js +1299 -2523
  286. package/dist/session/provider-cli/provider-cli.types.d.ts +38 -0
  287. package/dist/session/provider-cli/provider-cli.windows-environment.d.ts +10 -0
  288. package/dist/session/provider-cli/provider-cli.windows-environment.js +151 -0
  289. package/dist/session/provider-cli/provider-cli.windows-launch.d.ts +23 -0
  290. package/dist/session/provider-cli/provider-cli.windows-launch.js +131 -0
  291. package/dist/session/provider-cli/provider-in-flight-work.d.ts +10 -0
  292. package/dist/session/provider-cli/provider-in-flight-work.js +92 -0
  293. package/dist/session/provider-cli/provider-output-pipes.d.ts +30 -0
  294. package/dist/session/provider-cli/provider-output-pipes.js +67 -0
  295. package/dist/session/provider-cli/provider-output-state.d.ts +40 -0
  296. package/dist/session/provider-cli/provider-output-state.js +832 -0
  297. package/dist/session/provider-cli/provider-usage.d.ts +9 -1
  298. package/dist/session/provider-cli/provider-usage.js +28 -5
  299. package/dist/session/provider-cli/provider-user-config-isolation.d.ts +69 -0
  300. package/dist/session/provider-cli/provider-user-config-isolation.js +164 -0
  301. package/dist/session/publishable-worktree-changes.d.ts +54 -0
  302. package/dist/session/publishable-worktree-changes.js +193 -0
  303. package/dist/session/qa-sidecar-validation.d.ts +6 -0
  304. package/dist/session/qa-sidecar-validation.js +28 -0
  305. package/dist/session/sandbox-host-capacity-gate.d.ts +51 -0
  306. package/dist/session/sandbox-host-capacity-gate.js +257 -0
  307. package/dist/session/session-redaction.d.ts +3 -0
  308. package/dist/session/session-redaction.js +298 -0
  309. package/dist/session/session.base.d.ts +14 -1
  310. package/dist/session/session.service.d.ts +17 -2
  311. package/dist/session/session.service.js +708 -60
  312. package/dist/session/session.types.d.ts +327 -3
  313. package/dist/session/session.types.js +951 -10
  314. package/dist/session/sidecar-json-shape.d.ts +31 -0
  315. package/dist/session/sidecar-json-shape.js +217 -0
  316. package/dist/session/unreferenced-exports.d.ts +12 -0
  317. package/dist/session/unreferenced-exports.js +59 -0
  318. package/dist/session/workspace-runtime-fingerprint.d.ts +32 -0
  319. package/dist/session/workspace-runtime-fingerprint.js +138 -0
  320. package/dist/shared/format/format-bytes.d.ts +1 -0
  321. package/dist/shared/format/format-bytes.js +9 -0
  322. package/dist/shared/fs/file-identity.d.ts +10 -0
  323. package/dist/shared/fs/file-identity.js +15 -0
  324. package/dist/shared/fs/replace-file.d.ts +7 -0
  325. package/dist/shared/fs/replace-file.js +33 -0
  326. package/dist/shared/git/git.js +2 -1
  327. package/dist/shared/path/path.d.ts +1 -0
  328. package/dist/shared/path/path.js +21 -1
  329. package/dist/shared/process/dotnet-toolchain.d.ts +17 -0
  330. package/dist/shared/process/dotnet-toolchain.js +307 -0
  331. package/dist/shared/process/host-process-recovery.d.ts +23 -0
  332. package/dist/shared/process/host-process-recovery.js +99 -0
  333. package/dist/shared/process/host-process-supervisor.d.ts +72 -0
  334. package/dist/shared/process/host-process-supervisor.js +383 -0
  335. package/dist/shared/process/process-tree.d.ts +52 -0
  336. package/dist/shared/process/process-tree.js +144 -0
  337. package/dist/shared/process/process.d.ts +70 -0
  338. package/dist/shared/process/process.js +224 -16
  339. package/dist/shared/process/windows-app-execution-alias.d.ts +19 -0
  340. package/dist/shared/process/windows-app-execution-alias.js +45 -0
  341. package/dist/shared/process/windows-launch.d.ts +26 -0
  342. package/dist/shared/process/windows-launch.js +109 -0
  343. package/dist/shared/provider-capabilities.d.ts +4 -0
  344. package/dist/shared/provider-capabilities.js +95 -0
  345. package/dist/shared/redaction/redaction.d.ts +1 -0
  346. package/dist/shared/redaction/redaction.js +47 -4
  347. package/dist/shared/time/monotonic.d.ts +1 -0
  348. package/dist/shared/time/monotonic.js +8 -0
  349. package/dist/version.d.ts +1 -1
  350. package/dist/version.js +1 -1
  351. package/dist/worktree/artifact-injector.d.ts +3 -2
  352. package/dist/worktree/artifact-injector.js +82 -10
  353. package/dist/worktree/dependency-warmer.d.ts +78 -1
  354. package/dist/worktree/dependency-warmer.js +731 -13
  355. package/dist/worktree/index.d.ts +2 -1
  356. package/dist/worktree/index.js +1 -0
  357. package/dist/worktree/prior-phase-artifact-hydrator.d.ts +2 -0
  358. package/dist/worktree/prior-phase-artifact-hydrator.js +136 -0
  359. package/dist/worktree/story-qa-reference-hydrator.d.ts +4 -0
  360. package/dist/worktree/story-qa-reference-hydrator.js +253 -0
  361. package/dist/worktree/wip-git.d.ts +33 -0
  362. package/dist/worktree/wip-git.js +122 -0
  363. package/dist/worktree/wip-refs.d.ts +62 -0
  364. package/dist/worktree/wip-refs.js +119 -0
  365. package/dist/worktree/wip-restore.d.ts +38 -0
  366. package/dist/worktree/wip-restore.js +190 -0
  367. package/dist/worktree/wip-snapshot.d.ts +50 -0
  368. package/dist/worktree/wip-snapshot.js +268 -0
  369. package/dist/worktree/worktree-paths.d.ts +4 -0
  370. package/dist/worktree/worktree-paths.js +30 -0
  371. package/dist/worktree/worktree-wip-events.d.ts +18 -0
  372. package/dist/worktree/worktree-wip-events.js +98 -0
  373. package/dist/worktree/worktree-wip.d.ts +49 -0
  374. package/dist/worktree/worktree-wip.js +182 -0
  375. package/dist/worktree/worktree.base.d.ts +10 -1
  376. package/dist/worktree/worktree.service.d.ts +30 -4
  377. package/dist/worktree/worktree.service.js +379 -54
  378. package/dist/worktree/worktree.types.d.ts +38 -1
  379. package/package.json +12 -7
  380. package/runtime/windows-job-supervisor.ps1 +722 -0
  381. package/runtime/windows-listener-owner.ps1 +33 -0
@@ -0,0 +1,836 @@
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 { architectNonPassProperties } from "./architect-waits.js";
4
+ export function toolDescription(phase, qaGate = null, decomposeGate = null, draftGate = null) {
5
+ if (qaGate) {
6
+ return qaGate === "qa_verdict"
7
+ ? "Complete the final Forge QA verdict by writing the canonical QA bundle with pass, needs_rework, or blocked evidence."
8
+ : `Complete the ${qaGate.replace(/_/g, " ")} QA gate by writing ${qaGateFileNames[qaGate]} before continuing to the next QA gate.`;
9
+ }
10
+ if (decomposeGate) {
11
+ return decomposeGate === "decompose_proposal"
12
+ ? "Complete the Forge Decompose proposal by writing decompose.proposal.json with candidate child items and optional structured QA scopes."
13
+ : `Complete the ${decomposeGate.replace(/_/g, " ")} Decompose gate by writing ${decomposeGateFileNames[decomposeGate]} before continuing.`;
14
+ }
15
+ if (phase === "draft") {
16
+ const gate = draftGate ?? "draft_proposal";
17
+ return gate === "draft_proposal"
18
+ ? "Complete the Forge Draft proposal by writing draft.proposal.json with the drafted item in draft_json."
19
+ : `Complete the ${gate.replace(/_/g, " ")} Draft gate before continuing.`;
20
+ }
21
+ if (isDebugCompletionPhase(phase)) {
22
+ return `Complete the ${phase.replace(/_/g, " ")} Debug gate by writing ${phaseFiles[phase].jsonFileName} with structured bug-fix evidence before continuing.`;
23
+ }
24
+ if (phase === "implementation") {
25
+ return "Complete Forge implementation by writing implementation.completeness.json with scoped changed-file, verification, acceptance-criteria, gap, and next-phase evidence.";
26
+ }
27
+ if (phase === "ci_repair") {
28
+ return "Complete Forge CI repair by writing ci-repair.handoff.json with failed-check, root-cause, scoped-change, workflow-equivalence, validation, provider-state, and push-readiness evidence.";
29
+ }
30
+ if (phase === "comment_repair") {
31
+ return "Complete Forge pull-request comment repair by recording one evidence-backed disposition for every actionable finding in the dispatch snapshot.";
32
+ }
33
+ if (phase === "self_review") {
34
+ 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.";
35
+ }
36
+ if (phase === "qa") {
37
+ return "Complete Forge QA by writing qa.plan.json, qa.evidence.json, qa.findings.json, qa.verdict.json, and qa.report.md with structured pass, needs-rework, or blocked evidence.";
38
+ }
39
+ if (phase === "architect") {
40
+ return "Complete Forge Architect planning by writing implementation.plan.json, qa.plan.json, architect.verdict.json, and architect.report.md with a pending-approval plan or explicit revision/blocker reasons.";
41
+ }
42
+ return "Complete Forge validation by writing validation.verdict.json with command, build/test/lint/design, drift, acceptance-criteria, and ready-for-dev-test evidence.";
43
+ }
44
+ export function toolInputSchema(phase, qaGate = null, decomposeGate = null, draftGate = null) {
45
+ const baseProperties = {
46
+ status: {
47
+ type: "string",
48
+ enum: ["pass", "needs_rework", "fail", "failed"],
49
+ description: "Use pass only when the phase evidence satisfies Forge's gate. Use needs_rework/fail/failed with explicit blockers or findings otherwise."
50
+ },
51
+ summary: { type: "string", description: "Concise phase summary." },
52
+ report_markdown: { type: "string", description: "Optional human-readable report. Forge will generate a fallback report if omitted." },
53
+ blockers: {
54
+ type: "array",
55
+ description: "Required for non-pass status unless findings, failures, known_gaps, remaining_risks, or commands provide explicit evidence.",
56
+ items: evidenceObjectSchema(["reason"], {
57
+ reason: { type: "string" },
58
+ owner: { type: "string" },
59
+ next_step: { type: "string" }
60
+ })
61
+ }
62
+ };
63
+ if (qaGate && qaGate !== "qa_verdict") {
64
+ return qaGateToolInputSchema(qaGate);
65
+ }
66
+ if (decomposeGate) {
67
+ return decomposeGateToolInputSchema(decomposeGate, baseProperties);
68
+ }
69
+ if (phase === "draft") {
70
+ return draftGateToolInputSchema(draftGate ?? "draft_proposal", baseProperties);
71
+ }
72
+ if (isDebugCompletionPhase(phase)) {
73
+ return debugToolInputSchema(phase, baseProperties);
74
+ }
75
+ if (phase === "ci_repair") {
76
+ return objectToolSchema({
77
+ ...baseProperties,
78
+ failed_checks: {
79
+ type: "array",
80
+ description: "Required and non-empty for pass. Provider check/job/step evidence inspected before repair.",
81
+ minItems: 1,
82
+ items: evidenceObjectSchema(["name", "provider_state"], {
83
+ name: { type: "string" },
84
+ provider_state: { type: "string" },
85
+ workflow: { type: "string" },
86
+ job: { type: "string" },
87
+ step: { type: "string" },
88
+ details_url: { type: "string" },
89
+ evidence: { type: "string" }
90
+ })
91
+ },
92
+ root_cause: {
93
+ type: "object",
94
+ description: "Required for pass. Include classification, summary, and concrete evidence.",
95
+ additionalProperties: true,
96
+ required: ["classification", "summary", "evidence"],
97
+ properties: {
98
+ classification: { type: "string" },
99
+ summary: { type: "string" },
100
+ evidence: { type: "array", minItems: 1, description: "Non-empty list of concrete evidence strings.", items: { type: "string" } }
101
+ }
102
+ },
103
+ changed_files: {
104
+ type: "array",
105
+ 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.",
106
+ items: evidenceObjectSchema(["path", "summary"], {
107
+ path: { type: "string" },
108
+ summary: { type: "string" }
109
+ })
110
+ },
111
+ no_code_action: {
112
+ type: "object",
113
+ description: "Required when changed_files is empty. Describe the evidence-backed provider action or blocker.",
114
+ additionalProperties: true,
115
+ required: ["action", "reason"],
116
+ properties: {
117
+ action: { type: "string" },
118
+ reason: { type: "string" },
119
+ evidence: { type: "string" }
120
+ }
121
+ },
122
+ narrow_validation: {
123
+ type: "array",
124
+ description: "Required and non-empty for pass. The focused failing command or evidence-backed substitute; every entry needs exit_code 0 and status pass.",
125
+ minItems: 1,
126
+ items: commandEvidenceSchema()
127
+ },
128
+ workflow_validation: {
129
+ type: "array",
130
+ 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.",
131
+ minItems: 1,
132
+ items: evidenceObjectSchema(["step", "equivalence", "status"], {
133
+ step: { type: "string" },
134
+ equivalence: { type: "string", enum: ["supported", "substitute", "provider_only"] },
135
+ command: { type: "string", description: "Required unless equivalence is provider_only: the local command that ran." },
136
+ exit_code: { type: "number", description: "Required unless equivalence is provider_only; must be 0." },
137
+ status: { type: "string", default: "pass", description: "Must be pass unless equivalence is provider_only." },
138
+ summary: { type: "string", description: "Required unless equivalence is provider_only." },
139
+ reason: { type: "string", description: "Required when equivalence is provider_only: why only provider CI can prove this step." },
140
+ substitute: { type: "string", description: "Required when equivalence is substitute: what replaces the provider step locally." }
141
+ })
142
+ },
143
+ broader_validation: {
144
+ type: "array",
145
+ description: "Required and non-empty for pass. Normal validation covering every touched compiled/tested surface; every entry needs exit_code 0 and status pass.",
146
+ minItems: 1,
147
+ items: commandEvidenceSchema()
148
+ },
149
+ remaining_risks: {
150
+ type: "array",
151
+ description: "Required for pass, even when empty.",
152
+ items: evidenceObjectSchema(["summary"], {
153
+ summary: { type: "string" },
154
+ mitigation: { type: "string" },
155
+ owner: { type: "string" }
156
+ })
157
+ },
158
+ provider_state: {
159
+ type: "string",
160
+ enum: ["ready_for_rerun", "rerun_requested", "checks_pending", "still_failing", "blocked_by_provider"],
161
+ 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."
162
+ },
163
+ ready_for_push: {
164
+ type: "boolean",
165
+ default: true,
166
+ description: "Required for pass and must be true. Forge Bridge performs the commit/push only after this gate passes."
167
+ }
168
+ }, ["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.");
169
+ }
170
+ if (phase === "comment_repair") {
171
+ return objectToolSchema({
172
+ ...baseProperties,
173
+ repair_head_sha: { type: "string", description: "Exact pull-request head from the dispatch snapshot." },
174
+ repair_issue_key: { type: "string", description: "Exact review issue key from the dispatch snapshot." },
175
+ dispositions: {
176
+ type: "array",
177
+ description: "Exactly one outcome for every actionable dispatch finding; conversation-only comments are omitted.",
178
+ minItems: 1,
179
+ items: evidenceObjectSchema(["claim_id", "kind", "body_sha256", "disposition", "evidence"], {
180
+ claim_id: { type: "string" },
181
+ kind: { type: "string", enum: ["review_thread", "review_body", "issue_comment"] },
182
+ body_sha256: { type: "string" },
183
+ disposition: { type: "string", enum: ["fixed", "rejected", "already_addressed", "needs_decision", "accepted_transfer", "owned_elsewhere"] },
184
+ accepted_transfer: { type: "object", properties: {
185
+ amendment_id: { type: "string" }, version: { type: "integer", minimum: 1 }, content_hash: { type: "string" },
186
+ target_work_item_id: { type: "string" }, obligation_reference: { type: "string" },
187
+ }, required: ["amendment_id", "version", "content_hash", "target_work_item_id", "obligation_reference"], additionalProperties: false },
188
+ owned_elsewhere: { type: "object", description: "Another open Story in this Work Order whose accepted acceptance criteria already require the requested change.", properties: {
189
+ target_work_item_id: { type: "string" },
190
+ quoted_obligation: { type: "string", description: "Verbatim passage (at least 40 characters) from that Story's acceptance criteria that covers the finding." },
191
+ }, required: ["target_work_item_id", "quoted_obligation"], additionalProperties: false },
192
+ evidence: { type: "string" }
193
+ })
194
+ },
195
+ changed_files: {
196
+ type: "array",
197
+ description: "Files changed for fixed findings. May be empty when every finding is rejected, already addressed, or needs a decision.",
198
+ items: evidenceObjectSchema(["path", "summary"], { path: { type: "string" }, summary: { type: "string" } })
199
+ },
200
+ validation: {
201
+ type: "array",
202
+ 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.",
203
+ items: commandEvidenceSchema()
204
+ }
205
+ }, ["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.");
206
+ }
207
+ if (phase === "implementation") {
208
+ return objectToolSchema({
209
+ ...baseProperties,
210
+ plan: {
211
+ type: "array",
212
+ description: "Required for pass. Ordered implementation steps with status.",
213
+ items: evidenceObjectSchema(["step", "status"], {
214
+ step: { type: "string" },
215
+ status: { type: "string" },
216
+ evidence: { type: "string" }
217
+ })
218
+ },
219
+ changed_files: {
220
+ type: "array",
221
+ description: "Required for pass. Must be non-empty unless known_gaps explains why.",
222
+ items: evidenceObjectSchema(["path", "summary"], {
223
+ path: { type: "string" },
224
+ summary: { type: "string" }
225
+ })
226
+ },
227
+ tests_added_or_updated: {
228
+ type: "array",
229
+ description: "Required for pass. Use an object explaining why no tests were needed for documentation/config-only work if empty would be ambiguous.",
230
+ items: evidenceObjectSchema(["path", "summary"], {
231
+ path: { type: "string" },
232
+ summary: { type: "string" }
233
+ })
234
+ },
235
+ docs_added_or_updated: {
236
+ type: "array",
237
+ description: "Required for pass. Use an object explaining why no docs changed when appropriate.",
238
+ items: evidenceObjectSchema(["path", "summary"], {
239
+ path: { type: "string" },
240
+ summary: { type: "string" }
241
+ })
242
+ },
243
+ verification: {
244
+ type: "array",
245
+ description: "Implementation verification evidence. Objects should include command, exit_code, status, and summary when command-based.",
246
+ items: commandEvidenceSchema()
247
+ },
248
+ acceptance_criteria: acceptanceCriteriaSchema(),
249
+ known_gaps: {
250
+ type: "array",
251
+ description: "Required for pass, even when empty. If changed_files/tests/docs arrays are empty, explain why here.",
252
+ items: evidenceObjectSchema(["summary"], {
253
+ summary: { type: "string" },
254
+ impact: { type: "string" },
255
+ follow_up: { type: "string" }
256
+ })
257
+ },
258
+ next_phase_context: {
259
+ description: "Required for pass. Context the self-review phase should carry forward."
260
+ },
261
+ resolved_findings: {
262
+ type: "array",
263
+ description: "Required for QA rework. Each entry must use status resolved, disputed, or not_reproduced.",
264
+ items: resolvedFindingSchema()
265
+ }
266
+ }, ["status", "summary"], "For status pass, include plan, changed_files, tests_added_or_updated, docs_added_or_updated, acceptance_criteria, known_gaps, and next_phase_context. Acceptance criteria entries must use status: satisfied plus evidence.");
267
+ }
268
+ if (phase === "self_review") {
269
+ return objectToolSchema({
270
+ ...baseProperties,
271
+ reviewed_diff: { type: "boolean", description: "Required for pass. True after reviewing the implementation diff." },
272
+ findings: {
273
+ type: "array",
274
+ description: "Required for pass, even when empty. Include finding objects for issues discovered during review.",
275
+ items: evidenceObjectSchema(["severity", "summary", "status"], {
276
+ severity: { type: "string" },
277
+ summary: { type: "string" },
278
+ status: { type: "string" },
279
+ file: { type: "string" }
280
+ })
281
+ },
282
+ security_review: {
283
+ ...reviewSectionSchema(),
284
+ description: "Required for pass. Use pass after review, or not_applicable only with notes explaining why the change has no security-relevant surface."
285
+ },
286
+ edge_case_review: reviewSectionSchema(),
287
+ design_review: {
288
+ ...reviewSectionSchema(),
289
+ properties: {
290
+ ...reviewSectionProperties(),
291
+ screenshots: { type: "array", items: evidenceObjectSchema(["path"], { path: { type: "string" }, summary: { type: "string" } }) }
292
+ }
293
+ },
294
+ deterministic_comparison: {
295
+ type: "object",
296
+ description: "Required for pass. Evidence that the reviewed diff matches the intended deterministic change.",
297
+ additionalProperties: true,
298
+ properties: {
299
+ status: { type: "string" },
300
+ command_or_tool: { type: "string" },
301
+ notes: { type: "string" }
302
+ }
303
+ },
304
+ fixes_applied: {
305
+ type: "array",
306
+ description: "Required for pass, even when empty.",
307
+ items: evidenceObjectSchema(["summary"], { summary: { type: "string" }, path: { type: "string" } })
308
+ },
309
+ remaining_risks: {
310
+ type: "array",
311
+ description: "Required for pass, even when empty.",
312
+ items: evidenceObjectSchema(["summary"], { summary: { type: "string" }, mitigation: { type: "string" } })
313
+ }
314
+ }, ["status", "summary"], "For status pass, include reviewed_diff, findings, security_review, edge_case_review, design_review, deterministic_comparison, fixes_applied, and remaining_risks.");
315
+ }
316
+ if (phase === "qa") {
317
+ return objectToolSchema({
318
+ ...baseProperties,
319
+ status: {
320
+ type: "string",
321
+ enum: ["pass", "needs_rework", "blocked"],
322
+ description: "Use pass only when QA evidence satisfies acceptance criteria, needs_rework for actionable in-scope defects, or blocked for an inconclusive QA blocker."
323
+ },
324
+ checklist: {
325
+ type: "array",
326
+ description: "QA plan/checklist. Forge writes this to qa.plan.json; a default checklist is generated if omitted.",
327
+ items: { type: "string" }
328
+ },
329
+ schema_version: { type: "number", enum: [1], description: "Optional; must be 1 when sent." },
330
+ tested_acceptance_criteria: {
331
+ type: "array",
332
+ description: "Required and non-empty for pass/needs_rework. Criteria actually tested by QA.",
333
+ items: { type: "string" }
334
+ },
335
+ acceptance_criteria: {
336
+ type: "array",
337
+ description: "Optional fallback for tested_acceptance_criteria in the QA cycle when the plan gate recorded none.",
338
+ items: { type: "string" }
339
+ },
340
+ commands: {
341
+ type: "array",
342
+ 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.",
343
+ items: commandEvidenceSchema()
344
+ },
345
+ browser_checks: {
346
+ type: "array",
347
+ 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.",
348
+ items: browserCheckSchema(["summary", "status"])
349
+ },
350
+ sidecars: qaSidecarsSchema(),
351
+ notes: { type: "string", description: "Additional QA evidence notes." },
352
+ evidence: qaEvidenceWrapperSchema(),
353
+ finding_ids: {
354
+ type: "array",
355
+ 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.",
356
+ items: { type: "string" }
357
+ },
358
+ candidate_bug_ids: {
359
+ type: "array",
360
+ 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.",
361
+ items: { type: "string" }
362
+ },
363
+ findings: {
364
+ type: "array",
365
+ 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.",
366
+ items: evidenceObjectSchema(["id", "severity", "scope", "title"], {
367
+ id: { type: "string" },
368
+ severity: { type: "string", enum: ["critical", "major", "minor"] },
369
+ scope: { type: "string", enum: ["in_scope", "out_of_scope", "unclear"] },
370
+ title: { type: "string" },
371
+ acceptance_criteria: { type: "array", description: "Required and non-empty for an in_scope finding.", items: { type: "string" } },
372
+ repro_steps: { type: "array", description: "Required and non-empty for an in_scope finding.", items: { type: "string" } },
373
+ expected: { type: "string", description: "Required for an in_scope finding." },
374
+ actual: { type: "string", description: "Required for an in_scope finding." },
375
+ evidence: findingEvidenceSchema("Required for an in_scope finding."),
376
+ likely_area: { type: "array", description: "Required and non-empty for an in_scope finding.", items: { type: "string" } },
377
+ required_fix: { type: "string", description: "Required for an in_scope finding." },
378
+ required_regression: { type: "string", description: "Required for an in_scope finding." }
379
+ })
380
+ },
381
+ candidate_bugs: {
382
+ type: "array",
383
+ description: "Out-of-scope/follow-up bug candidates. They do not block the current item unless attached as in-scope findings.",
384
+ items: evidenceObjectSchema(["id", "title", "suggested_action"], {
385
+ id: { type: "string" },
386
+ title: { type: "string" },
387
+ severity: { type: "string" },
388
+ scope_reason: { type: "string" },
389
+ repro_steps: { type: "array", items: { type: "string" } },
390
+ evidence: findingEvidenceSchema("Optional evidence object."),
391
+ suggested_action: { type: "string", enum: ["create_bug", "create_follow_up", "accept_risk", "attach_to_current_item"] }
392
+ })
393
+ },
394
+ policy_warnings: {
395
+ type: "array",
396
+ description: "Non-blocking Forge policy or scope warnings surfaced with the QA verdict.",
397
+ items: evidenceObjectSchema(["code", "message"], {
398
+ code: { type: "string" },
399
+ message: { type: "string" },
400
+ severity: { type: "string" },
401
+ evidence: { type: "object", description: "Optional evidence object." }
402
+ })
403
+ },
404
+ blocker_reason: {
405
+ type: "string",
406
+ enum: [...qaBlockerReasons],
407
+ description: "Required when status is blocked."
408
+ }
409
+ }, ["status", "summary"], "For pass, include tested_acceptance_criteria plus concrete command/browser/note evidence. For needs_rework, include at least one actionable in_scope finding. For blocked, include blocker_reason.");
410
+ }
411
+ if (phase === "architect") {
412
+ return objectToolSchema({
413
+ status: {
414
+ type: "string",
415
+ enum: ["pass", "needs_revision", "blocked"],
416
+ description: "Use pass only for a complete pending-approval Architect plan. Use needs_revision for fixable story/design/repo gaps, or blocked for missing required context or decisions."
417
+ },
418
+ summary: { type: "string", description: "Concise Architect plan verdict summary." },
419
+ implementation_plan: {
420
+ type: "object",
421
+ 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.",
422
+ additionalProperties: true,
423
+ required: ["schema_version", "plan_id", "phases", "tasks", "dependencies", "phase_gates"],
424
+ properties: {
425
+ schema_version: { type: "number", enum: [1] },
426
+ plan_id: { type: "string" },
427
+ phases: {
428
+ type: "array",
429
+ description: "Required non-empty top-level implementation_plan.phases array.",
430
+ minItems: 1,
431
+ items: { type: "object", additionalProperties: true }
432
+ },
433
+ tasks: {
434
+ type: "array",
435
+ 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.",
436
+ minItems: 1,
437
+ items: {
438
+ type: "object",
439
+ additionalProperties: true,
440
+ required: ["id", "acceptance_criteria", "tests"],
441
+ properties: {
442
+ id: { type: "string", description: "Unique, stable task id." },
443
+ title: { type: "string" },
444
+ acceptance_criteria: {
445
+ type: "array",
446
+ minItems: 1,
447
+ description: "Required: at least one independently testable acceptance criterion for this child task, each a non-empty string.",
448
+ items: { type: "string" }
449
+ },
450
+ verification_scope: qaScopeSchema("Task-level QA/verification scope for the materialized child task."),
451
+ tests: {
452
+ type: "array",
453
+ minItems: 1,
454
+ description: "Required non-empty task-specific verification.",
455
+ items: { type: "object", additionalProperties: true }
456
+ }
457
+ }
458
+ }
459
+ },
460
+ dependencies: {
461
+ type: "array",
462
+ description: "Required dependency edge array. Use [] when no task dependencies exist. Each edge should use before and after task ids; from/to are accepted only as aliases and normalized before writing artifacts.",
463
+ items: {
464
+ type: "object",
465
+ additionalProperties: true,
466
+ properties: {
467
+ id: { type: "string" },
468
+ before: { type: "string", description: "Task id that must complete first." },
469
+ after: { type: "string", description: "Task id that depends on before." },
470
+ from: { type: "string", description: "Alias for before." },
471
+ to: { type: "string", description: "Alias for after." },
472
+ type: { type: "string" },
473
+ rationale: { type: "string" }
474
+ }
475
+ }
476
+ },
477
+ phase_gates: {
478
+ type: "array",
479
+ description: "Required non-empty phase gate array.",
480
+ minItems: 1,
481
+ items: { type: "object", additionalProperties: true }
482
+ }
483
+ }
484
+ },
485
+ qa_plan: {
486
+ type: "object",
487
+ description: "Required for pass; may be omitted for needs_revision or blocked. Must include schema_version: 1 and non-empty final_qa coverage.",
488
+ additionalProperties: true,
489
+ required: ["schema_version", "final_qa"],
490
+ properties: {
491
+ schema_version: { type: "number", enum: [1] },
492
+ final_qa: {
493
+ type: "array",
494
+ description: "Required non-empty final QA coverage array.",
495
+ minItems: 1,
496
+ items: { type: "object", additionalProperties: true }
497
+ }
498
+ }
499
+ },
500
+ report_markdown: { type: "string", description: "Human-readable Architect report. Use report as an alias only when the client cannot send report_markdown." },
501
+ report: { type: "string", description: "Alias for report_markdown." },
502
+ blockers: baseProperties.blockers,
503
+ ...architectNonPassProperties()
504
+ }, ["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.");
505
+ }
506
+ return objectToolSchema({
507
+ ...baseProperties,
508
+ commands: {
509
+ type: "array",
510
+ description: "Required for pass. Include at least one deterministic validation command; for pass every entry needs exit_code: 0 and status: pass.",
511
+ minItems: 1,
512
+ items: commandEvidenceSchema()
513
+ },
514
+ acceptance_criteria: acceptanceCriteriaSchema(),
515
+ build_status: { type: "string", default: "pass", description: "Required for pass and must be pass." },
516
+ test_status: { type: "string", default: "pass", description: "Required for pass and must be pass." },
517
+ lint_status: { type: "string", default: "pass", description: "Required for pass, and pass accepts pass or not_applicable. Otherwise fail/needs_rework." },
518
+ design_status: { type: "string", default: "pass", description: "Required for pass, and pass accepts pass or not_applicable. Otherwise fail/needs_rework." },
519
+ drift_checks: {
520
+ type: "array",
521
+ description: "Required for pass. Deterministic checks for unintended drift.",
522
+ items: evidenceObjectSchema(["command_or_tool", "status", "summary"], {
523
+ command_or_tool: { type: "string" },
524
+ status: { type: "string" },
525
+ summary: { type: "string" }
526
+ })
527
+ },
528
+ ready_for_dev_test: { type: "boolean", default: true, description: "Required for pass and must be true." }
529
+ }, ["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.");
530
+ }
531
+ // Feature-to-Story candidate fields: schedule order, handoff to dependents, and whether the Story
532
+ // needs a design reference before Forge builds it.
533
+ const storyCandidateScheduleProperties = {
534
+ scheduleIndex: { type: "number", description: "Feature-to-Story total schedule order for dependency-safe execution." },
535
+ schedule_index: { type: "number", description: "Snake_case alias for scheduleIndex." },
536
+ waveIndex: { type: "number", description: "Feature-to-Story parallel wave number." },
537
+ wave_index: { type: "number", description: "Snake_case alias for waveIndex." },
538
+ featureScheduleIndex: { type: "number", description: "Optional ordering within the Feature." },
539
+ feature_schedule_index: { type: "number", description: "Snake_case alias for featureScheduleIndex." },
540
+ expectedOutput: { type: "string", description: "Durable output this Story should produce for dependents." },
541
+ expected_output: { type: "string", description: "Snake_case alias for expectedOutput." },
542
+ handoffSummary: { type: "string", description: "How dependent Stories should consume this Story output." },
543
+ handoff_summary: { type: "string", description: "Snake_case alias for handoffSummary." },
544
+ dependencyReason: { type: "string", description: "Why this Story depends on its dependsOn predecessors." },
545
+ dependency_reason: { type: "string", description: "Snake_case alias for dependencyReason." },
546
+ requiresDesign: {
547
+ type: "boolean",
548
+ 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."
549
+ },
550
+ requires_design: { type: "boolean", description: "Snake_case alias for requiresDesign." }
551
+ };
552
+ function decomposeGateToolInputSchema(gate, phaseProperties) {
553
+ // Advertise every status the Decompose writer accepts, so the schema and the runtime agree.
554
+ const baseProperties = {
555
+ ...phaseProperties,
556
+ status: {
557
+ type: "string",
558
+ enum: [...decomposeStatuses],
559
+ 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."
560
+ }
561
+ };
562
+ if (gate !== "decompose_proposal") {
563
+ return objectToolSchema({
564
+ ...baseProperties,
565
+ findings: {
566
+ type: "array",
567
+ description: "Optional issues, constraints, or risks discovered in this Decompose gate.",
568
+ items: { type: "object", additionalProperties: true }
569
+ },
570
+ summary: {
571
+ type: "string",
572
+ description: "Required. What this gate checked or decided, in a sentence or two; it is the gate's evidence."
573
+ }
574
+ }, ["summary"], `Record the ${gate.replace(/_/g, " ")} Decompose gate before continuing.`);
575
+ }
576
+ const candidateSchema = {
577
+ type: "object",
578
+ additionalProperties: true,
579
+ properties: {
580
+ origin: { type: "string" },
581
+ key: { type: "string" },
582
+ title: { type: "string" },
583
+ summary: { type: "string" },
584
+ description: { type: "string" },
585
+ acceptanceCriteria: { type: "string" },
586
+ planningPacket: { type: "string" },
587
+ sortOrder: { type: "number" },
588
+ ...storyCandidateScheduleProperties,
589
+ points: { type: "number" },
590
+ dependsOn: { type: "array", items: { type: "string" } },
591
+ estimatedQaScope: qaScopeSchema("Work Order-to-Feature planning QA estimate. This is not dispatch-authoritative QA scope."),
592
+ estimated_qa_scope: qaScopeSchema("Work Order-to-Feature planning QA estimate. Snake_case alias for estimatedQaScope."),
593
+ qaScope: qaScopeSchema("Feature-to-Story QA scope that becomes Story-level QA scope after proposal approval."),
594
+ qa_scope: qaScopeSchema("Feature-to-Story QA scope. Snake_case alias for qaScope."),
595
+ designerRefCandidates: designerRefCandidatesSchema("Designer packet refs that justify this candidate. Omit to inherit all parent refs unchanged."),
596
+ designer_ref_candidates: designerRefCandidatesSchema("Snake_case alias for designerRefCandidates.")
597
+ }
598
+ };
599
+ const proposalSchema = {
600
+ type: "object",
601
+ additionalProperties: true,
602
+ description: "Required unless decomposition_json is sent instead (send one of the two). Final Decompose proposal JSON. Must include candidates, and may include blockedReason.",
603
+ required: ["candidates"],
604
+ properties: {
605
+ summary: { type: "string" },
606
+ blockedReason: { type: "string" },
607
+ blocked_reason: { type: "string" },
608
+ candidates: {
609
+ type: "array",
610
+ items: candidateSchema
611
+ }
612
+ }
613
+ };
614
+ return objectToolSchema({
615
+ ...baseProperties,
616
+ status: {
617
+ type: "string",
618
+ enum: [...decomposeStatuses],
619
+ description: "Use pass only when the Decompose proposal is ready for user sign-off; needs_rework, needs_revision, fail, failed, or blocked otherwise."
620
+ },
621
+ proposal_json: proposalSchema,
622
+ decomposition_json: {
623
+ ...proposalSchema,
624
+ description: "Alias for proposal_json, for a client that cannot send proposal_json. Required unless proposal_json is sent (send one of the two)."
625
+ }
626
+ // proposal_json and its decomposition_json alias are each required unless the other is sent, so
627
+ // neither is listed as required: an alias-only call is valid, as the writer accepts it.
628
+ }, [], "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.");
629
+ }
630
+ function draftGateToolInputSchema(gate, baseProperties) {
631
+ const status = {
632
+ type: "string",
633
+ enum: [...draftStatuses],
634
+ description: "Use pass when the gate is complete (an omitted status means pass); needs_revision, needs_rework, or blocked otherwise."
635
+ };
636
+ if (gate !== "draft_proposal") {
637
+ const summary = {
638
+ type: "string",
639
+ description: "Required. What this gate checked or decided, in a sentence or two; it is the gate's evidence."
640
+ };
641
+ return objectToolSchema({ ...baseProperties, status, summary }, ["summary"], `Record the ${gate.replace(/_/g, " ")} Draft gate before continuing.`);
642
+ }
643
+ return objectToolSchema({
644
+ ...baseProperties,
645
+ status,
646
+ draft_json: {
647
+ type: "object",
648
+ additionalProperties: true,
649
+ 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.",
650
+ properties: {
651
+ title: { type: "string", description: "Required and non-empty for a work item or Work Order draft." },
652
+ summary: { type: "string", description: "Required and non-empty for a Work Order or decomposition draft." },
653
+ description: { type: "string", description: "Required and non-empty for a work item draft." },
654
+ acceptanceCriteria: { type: "string", description: "Required and non-empty for a work item draft." },
655
+ objective: { type: "string", description: "Required and non-empty for a Work Order draft." },
656
+ planningPacket: { type: "string", description: "Required and non-empty for a Work Order draft." },
657
+ decompositionContext: { type: "string", description: "Required and non-empty for a Work Order draft." },
658
+ candidates: { type: "array", description: "Required for a decomposition draft.", items: { type: "object", additionalProperties: true } },
659
+ suggested_qa_scope: qaScopeSchema("Optional suggested QA scope for the drafted item.")
660
+ }
661
+ }
662
+ }, ["draft_json"], "Record the final Draft proposal with draft_json as a JSON object.");
663
+ }
664
+ function designerRefCandidatesSchema(description) {
665
+ return {
666
+ type: "array",
667
+ description,
668
+ items: {
669
+ type: "object",
670
+ additionalProperties: false,
671
+ properties: {
672
+ designerRefId: { type: "string" },
673
+ designer_ref_id: { type: "string" },
674
+ refKey: { type: "string" },
675
+ ref_key: { type: "string" },
676
+ path: { type: "string" },
677
+ anchor: { type: "string" },
678
+ reason: { type: "string" },
679
+ required: { type: "boolean" }
680
+ }
681
+ }
682
+ };
683
+ }
684
+ function debugToolInputSchema(phase, baseProperties) {
685
+ if (phase === "debug_repro") {
686
+ return objectToolSchema({
687
+ ...baseProperties,
688
+ repro_steps: {
689
+ type: "array",
690
+ description: "Required and non-empty for pass. Minimal reproduction or characterization steps.",
691
+ minItems: 1,
692
+ items: { type: "string" }
693
+ },
694
+ observed: { type: "string", description: "Required for pass. Observed failure behavior." },
695
+ expected: { type: "string", description: "Required for pass. Expected behavior." },
696
+ evidence: {
697
+ type: "array",
698
+ description: "Required and non-empty for pass. Concrete logs, commands, screenshots, file refs, or characterization notes.",
699
+ minItems: 1,
700
+ items: { type: "object", additionalProperties: true }
701
+ }
702
+ }, ["status", "summary"], "For status pass, include repro_steps, observed, expected, and evidence.");
703
+ }
704
+ if (phase === "debug_root_cause") {
705
+ return objectToolSchema({
706
+ ...baseProperties,
707
+ root_cause: { type: "string", description: "Required for pass. Likely root cause tied to code or config evidence." },
708
+ evidence: {
709
+ type: "array",
710
+ description: "Required and non-empty for pass. Concrete code/log/test evidence supporting the root cause.",
711
+ minItems: 1,
712
+ items: { type: "object", additionalProperties: true }
713
+ },
714
+ eliminated_alternatives: {
715
+ type: "array",
716
+ description: "Required for pass. Plausible alternatives checked or ruled out.",
717
+ items: { type: "object", additionalProperties: true }
718
+ },
719
+ risk_area: { type: "string", description: "Required for pass. Subsystem or behavior most at risk from the fix." }
720
+ }, ["status", "summary"], "For status pass, include root_cause, evidence, eliminated_alternatives, and risk_area.");
721
+ }
722
+ if (phase === "debug_fix") {
723
+ return objectToolSchema({
724
+ ...baseProperties,
725
+ changed_files: {
726
+ type: "array",
727
+ description: "Required and non-empty for pass. Files changed by the bug fix.",
728
+ minItems: 1,
729
+ items: evidenceObjectSchema(["path", "summary"], { path: { type: "string" }, summary: { type: "string" } })
730
+ },
731
+ tests_added_or_updated: {
732
+ type: "array",
733
+ description: "Required for pass. Regression tests or checks added/updated, or justify omission in remaining_risks.",
734
+ items: evidenceObjectSchema(["path", "summary"], { path: { type: "string" }, summary: { type: "string" } })
735
+ },
736
+ remaining_risks: {
737
+ type: "array",
738
+ description: "Required for pass, even when empty. Include why no regression coverage changed when tests_added_or_updated is empty.",
739
+ items: evidenceObjectSchema(["summary"], { summary: { type: "string" }, mitigation: { type: "string" } })
740
+ },
741
+ resolved_findings: {
742
+ type: "array",
743
+ description: "Required for QA rework. Each entry must use status resolved, disputed, or not_reproduced.",
744
+ items: resolvedFindingSchema()
745
+ }
746
+ }, ["status", "summary"], "For status pass, include changed_files, tests_added_or_updated, and remaining_risks.");
747
+ }
748
+ return objectToolSchema({
749
+ ...baseProperties,
750
+ commands: {
751
+ type: "array",
752
+ description: "Required for pass. Targeted regression/repro-negative commands with exit_code: 0 and status: pass.",
753
+ minItems: 1,
754
+ items: commandEvidenceSchema()
755
+ },
756
+ required_regressions: {
757
+ type: "array",
758
+ description: "Required and non-empty for pass. Repro-negative and regression coverage checklist.",
759
+ minItems: 1,
760
+ items: { type: "string" }
761
+ },
762
+ build_status: { type: "string", default: "pass", description: "Required for pass. pass or not_applicable." },
763
+ test_status: { type: "string", default: "pass", description: "Required for pass. pass or not_applicable." },
764
+ repro_negative: { type: "boolean", default: true, description: "Required for pass and must be true after the original repro no longer fails." },
765
+ qa_ready: { type: "boolean", default: true, description: "Required for pass and must be true." }
766
+ }, ["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.");
767
+ }
768
+ function qaGateToolInputSchema(gate) {
769
+ const baseProperties = {
770
+ status: {
771
+ type: "string",
772
+ enum: ["pass", "skipped", "blocked"],
773
+ description: "Use pass when this QA gate produced evidence, skipped when not applicable, or blocked when a prerequisite prevents this gate."
774
+ },
775
+ summary: { type: "string", description: "Concise QA gate summary." },
776
+ reason: { type: "string", description: "Required for skipped or blocked gates." },
777
+ blocker_reason: {
778
+ type: "string",
779
+ enum: [...qaBlockerReasons],
780
+ description: "Required when status is blocked."
781
+ }
782
+ };
783
+ if (gate === "qa_plan") {
784
+ return objectToolSchema({
785
+ ...baseProperties,
786
+ checklist: {
787
+ type: "array",
788
+ description: "Required for pass. QA checklist entries planned for this work item.",
789
+ items: { type: "string" }
790
+ },
791
+ acceptance_criteria: {
792
+ type: "array",
793
+ description: "Acceptance criteria selected for QA.",
794
+ items: { type: "string" }
795
+ }
796
+ }, ["status", "summary"], "Record the QA plan gate. Pass requires a non-empty checklist.");
797
+ }
798
+ if (gate === "qa_findings") {
799
+ return objectToolSchema({
800
+ ...baseProperties,
801
+ findings: {
802
+ type: "array",
803
+ description: "Required for pass or skipped, even when empty. Normalized in-scope and out-of-scope QA findings.",
804
+ items: { type: "object", additionalProperties: true }
805
+ },
806
+ candidate_bugs: {
807
+ type: "array",
808
+ description: "Required for pass or skipped, even when empty. Out-of-scope or follow-up candidates.",
809
+ items: { type: "object", additionalProperties: true }
810
+ }
811
+ }, ["status", "summary"], "Record normalized QA findings. Pass or skipped requires findings and candidate_bugs arrays, even when empty.");
812
+ }
813
+ const commandRule = gate === "qa_regression"
814
+ ? "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."
815
+ : gate === "qa_api"
816
+ ? "Required and non-empty for pass, and every entry needs exit_code 0 and status pass."
817
+ : "Command evidence for this gate when applicable.";
818
+ return objectToolSchema({
819
+ ...baseProperties,
820
+ commands: {
821
+ type: "array",
822
+ description: commandRule,
823
+ items: commandEvidenceSchema()
824
+ },
825
+ browser_checks: {
826
+ type: "array",
827
+ description: gate === "qa_manual_web"
828
+ ? "Browser/manual evidence. Pass requires at least one browser check or a notes string."
829
+ : "Browser/manual evidence for this gate when applicable.",
830
+ items: browserCheckSchema(["summary", "status"])
831
+ },
832
+ sidecars: qaSidecarsSchema(),
833
+ evidence: qaGateEvidenceWrapperSchema(),
834
+ notes: { type: "string", description: "Evidence notes for this gate." }
835
+ }, ["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.");
836
+ }