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

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
@@ -0,0 +1,148 @@
1
+ import { redactText } from "../shared/redaction/redaction.js";
2
+ import { describeSkippedTests, mergeSkippedTests, readSkippedTests, } from "./pre-publication-skipped-tests.js";
3
+ import { ForgeFailureError, failureFactsFromError } from "./session.types.js";
4
+ // One pre-publication validation pass. A failed check no longer ends the pass: the remaining checks
5
+ // that can still meaningfully run keep going, so one in-place repair turn sees every independent
6
+ // failure at once instead of one per turn. The pass records each failure, says which checks it
7
+ // could not run because a check they depend on failed, and reports them all as one failure.
8
+ /** The check id a failed restart of the attempt's runtime stack before the pass is reported under. */
9
+ export const runtimeRestartCheckId = "host-runtime-restart";
10
+ // The checks whose first step builds the .NET solution: CI's whole-tier check and the affected
11
+ // tests every gate profile runs (decision 0017).
12
+ const dotnetBuildCheckIds = new Set(["dotnet-build-and-unit", "comment-repair-dotnet-regression"]);
13
+ // Checks that build the .NET solution themselves and would only repeat the compiler errors once its
14
+ // compile step fails: the OpenAPI export builds Forge.Api and the E2E suite publishes it.
15
+ const dotnetBuildConsumers = new Set(["openapi-and-generated-types", "playwright-e2e"]);
16
+ // Checks that run against the attempt's application stack, which a failed restart left stopped.
17
+ const runtimeStackConsumers = new Set(["playwright-e2e"]);
18
+ // The diagnostics of each further failure that the error message carries; the repair prompt
19
+ // carries every failure's diagnostics in full.
20
+ const additionalFailureMessageDetail = 1500;
21
+ /**
22
+ * A failed validation pass. The single-check fields name the first failure, as they always have;
23
+ * `failures` lists every check that failed in the pass, in the order the checks ran.
24
+ */
25
+ export class PrePublicationValidationError extends ForgeFailureError {
26
+ checkId;
27
+ exitCode;
28
+ command;
29
+ args;
30
+ detail;
31
+ code = "prepublication_validation_failed";
32
+ failures;
33
+ constructor(checkId, exitCode, command, args, detail, additionalFailures = []) {
34
+ super("prepublication_validation_failed", validationFailureMessage([{ checkId, exitCode, command, args, detail }, ...additionalFailures]), "bridge");
35
+ this.checkId = checkId;
36
+ this.exitCode = exitCode;
37
+ this.command = command;
38
+ this.args = args;
39
+ this.detail = detail;
40
+ this.name = "PrePublicationValidationError";
41
+ this.failures = [{ checkId, exitCode, command, args, detail }, ...additionalFailures];
42
+ }
43
+ /** Every failed check's id, first failure first. */
44
+ get checkIds() {
45
+ return this.failures.map(failure => failure.checkId);
46
+ }
47
+ }
48
+ function validationFailureMessage(failures) {
49
+ const [first, ...others] = failures;
50
+ const summary = (failure, detail) => `${failure.checkId} exited ${failure.exitCode}${detail ? `: ${detail}` : ""}`;
51
+ if (others.length === 0)
52
+ return `prepublication_validation_failed: ${summary(first, first.detail)}`;
53
+ // The other check ids come before the first detail, so a clipped failure message still names them.
54
+ const also = `[also failed: ${others.map(failure => failure.checkId).join(", ")}]`;
55
+ const more = others.map(failure => summary(failure, clipDetail(failure.detail)));
56
+ return `prepublication_validation_failed: ${first.checkId} exited ${first.exitCode} ${also}${first.detail ? `: ${first.detail}` : ""}`
57
+ + `\n\nAlso failed in the same validation pass: ${more.join("\n\n")}`;
58
+ }
59
+ function clipDetail(detail) {
60
+ return detail.length <= additionalFailureMessageDetail
61
+ ? detail
62
+ : `${detail.slice(0, additionalFailureMessageDetail)}… (clipped)`;
63
+ }
64
+ export class PrePublicationPass {
65
+ runtimeRestartFailure;
66
+ failures = [];
67
+ /** The check whose .NET build failed to compile in this pass, if any. */
68
+ dotnetCompileFailedIn = null;
69
+ /** A failed runtime restart before the pass is its first failure. */
70
+ constructor(runtimeRestartFailure) {
71
+ this.runtimeRestartFailure = runtimeRestartFailure;
72
+ this.failures.push(...runtimeRestartFailure?.failures ?? []);
73
+ }
74
+ record(failure, failedStep) {
75
+ this.failures.push(failure);
76
+ if (dotnetBuildCheckIds.has(failure.checkId) && failedStep?.command === "dotnet" && failedStep.args[0] === "build") {
77
+ this.dotnetCompileFailedIn ??= failure.checkId;
78
+ }
79
+ }
80
+ /** The failed checks that keep this check from running meaningfully in this pass. */
81
+ blockers(checkId) {
82
+ return [
83
+ ...(this.dotnetCompileFailedIn && dotnetBuildConsumers.has(checkId) ? [this.dotnetCompileFailedIn] : []),
84
+ ...(this.runtimeRestartFailure && runtimeStackConsumers.has(checkId) ? [runtimeRestartCheckId] : []),
85
+ ];
86
+ }
87
+ /**
88
+ * Whether an error ends the pass with the failures it already found. Only a classified retryable
89
+ * failure (a resource hold, lost infrastructure, a supervisor that did not start) does, once the
90
+ * pass has found a failure: the repair turn can fix those failures now, and the next pass meets
91
+ * the condition again. Any other error, or cancellation, still ends the attempt as it did.
92
+ */
93
+ stopsAt(error, signal) {
94
+ if (this.failures.length === 0 || signal?.aborted || !(error instanceof ForgeFailureError))
95
+ return false;
96
+ return failureFactsFromError(error).retryability === "retryable";
97
+ }
98
+ stoppedEvent(checkId, error) {
99
+ const failedCheckIds = this.failures.map(failure => failure.checkId);
100
+ return validationEvent("prepublication_validation_pass_stopped", checkId, `Stopped this pre-publication pass at '${checkId}' (${error.failureCode}). Reporting the ${failedCheckIds.length} failed check${failedCheckIds.length === 1 ? "" : "s"} it already found (${failedCheckIds.join(", ")}) for repair; the next pass runs '${checkId}' again.`, { failureCode: error.failureCode, failedCheckIds });
101
+ }
102
+ /** Throws every failure the pass found as one validation failure. */
103
+ throwIfFailed() {
104
+ const [first, ...others] = this.failures;
105
+ if (!first)
106
+ return;
107
+ throw new PrePublicationValidationError(first.checkId, first.exitCode, first.command, first.args, first.detail, others);
108
+ }
109
+ }
110
+ export function skippedCheckEvent(checkId, blockedBy) {
111
+ const reason = blockedBy.map(blocker => blocker === runtimeRestartCheckId
112
+ ? "the attempt's runtime stack, whose restart failed"
113
+ : `the .NET build, which failed in '${blocker}'`).join(" and ");
114
+ return validationEvent("prepublication_validation_skipped", checkId, `Skipped pre-publication CI parity check '${checkId}' in this pass: it needs ${reason}. The next pass runs it again.`, { blockedBy });
115
+ }
116
+ /** The tests a check's steps skipped, so a check that passed with skips says so with each reason. */
117
+ export class SkippedTestTally {
118
+ worktreePath;
119
+ environment;
120
+ summary = { count: 0, reasons: [] };
121
+ constructor(worktreePath, environment) {
122
+ this.worktreePath = worktreePath;
123
+ this.environment = environment;
124
+ }
125
+ /** The invocation's own arguments: a managed attempt may direct results to its test-output root. */
126
+ async add(args, stepStartedMs) {
127
+ this.summary = mergeSkippedTests(this.summary, await readSkippedTests(this.worktreePath, args, stepStartedMs, this.environment));
128
+ }
129
+ passedEvent(checkId, secrets) {
130
+ const skipped = {
131
+ ...this.summary,
132
+ reasons: this.summary.reasons.map(entry => ({ ...entry, reason: redactText(entry.reason, secrets) })),
133
+ };
134
+ if (skipped.count === 0) {
135
+ return validationEvent("prepublication_validation_passed", checkId, `Pre-publication CI parity check '${checkId}' passed.`);
136
+ }
137
+ return validationEvent("prepublication_validation_passed", checkId, `Pre-publication CI parity check '${checkId}' passed with ${describeSkippedTests(skipped)}.`, { skippedTests: skipped.count, skippedReasons: skipped.reasons });
138
+ }
139
+ }
140
+ export function validationEvent(eventType, checkId, content, detail) {
141
+ return {
142
+ role: "runner",
143
+ kind: "checkpoint",
144
+ content,
145
+ eventType,
146
+ data: JSON.stringify({ checkId, contractId: "forge-ci-parity-v1", ...detail }),
147
+ };
148
+ }
@@ -1,7 +1,10 @@
1
1
  import type { PrePublicationCommandResult, PrePublicationCommandRunner } from "./pre-publication-validation.js";
2
+ /** Output kept per stream for one validation step (the tail). */
3
+ export declare const prePublicationOutputLimitChars: number;
2
4
  export declare class ProcessPrePublicationCommandRunner implements PrePublicationCommandRunner {
3
5
  run(command: string, args: readonly string[], cwd: string, signal?: AbortSignal, environment?: Readonly<Record<string, string>>): Promise<PrePublicationCommandResult>;
4
6
  }
7
+ export declare function prePublicationChildEnvironment(environment?: Readonly<Record<string, string>>): NodeJS.ProcessEnv;
5
8
  interface PackageManagerLaunchLocation {
6
9
  readonly args: readonly string[];
7
10
  readonly cwd: string;
@@ -1,31 +1,44 @@
1
- import { execFile } from "node:child_process";
2
1
  import fs from "node:fs/promises";
3
2
  import path from "node:path";
4
- import { promisify } from "node:util";
5
3
  import { hostRuntimeLegacyTestPostgresEnvironment, hostRuntimeTestPostgresAdminEnvironment, hostRuntimeTestPostgresProvisionerEnvironment, } from "../runtime/host-runtime-contract.js";
4
+ import { withHostTestParallelism, withoutHostLoadGovernorVariables } from "../runtime/host-load-child-environment.js";
6
5
  import { isSubPath } from "../shared/path/path.js";
7
- const execFileAsync = promisify(execFile);
6
+ import { NodeProcessRunner, ProcessTreeTerminationError } from "../shared/process/process.js";
7
+ import { buildWindowsCmdLaunch } from "../shared/process/windows-launch.js";
8
+ /** Output kept per stream for one validation step (the tail). */
9
+ export const prePublicationOutputLimitChars = 4 * 1024 * 1024;
8
10
  export class ProcessPrePublicationCommandRunner {
9
11
  async run(command, args, cwd, signal, environment) {
10
12
  try {
11
13
  const launch = await pnpmDirectoryLaunch(command, args, cwd);
12
- const windowsBatch = process.platform === "win32" && (command === "npm" || command === "pnpm");
13
- const executable = windowsBatch ? (process.env.ComSpec ?? "cmd.exe") : command;
14
- const commandArgs = windowsBatch
15
- ? ["/d", "/s", "/c", [`${command}.cmd`, ...launch.args].map(quoteWindowsCommandArgument).join(" ")]
16
- : [...launch.args];
17
- const result = await execFileAsync(executable, commandArgs, {
14
+ // npm and pnpm are batch files on Windows, run through cmd.exe. Its command line is
15
+ // passed verbatim: Node's own quoting escapes inner quotes as \", which cmd.exe does
16
+ // not read, so a quoted argument reached the package manager with its quotes.
17
+ const windowsBatch = process.platform === "win32" && (command === "npm" || command === "pnpm")
18
+ ? buildWindowsCmdLaunch(`${command}.cmd`, launch.args)
19
+ : null;
20
+ // A process group the runner stops as a whole, settling only once it is gone:
21
+ // a validation step's host capacity is never returned while its test hosts,
22
+ // build nodes or browser workers still run.
23
+ const result = await new NodeProcessRunner().run({
24
+ command: windowsBatch?.command ?? command,
25
+ args: windowsBatch?.args ?? [...launch.args],
26
+ windowsVerbatimArguments: windowsBatch !== null,
18
27
  cwd: launch.cwd,
19
- encoding: "utf8",
20
- maxBuffer: 4 * 1024 * 1024,
21
- signal,
22
28
  env: prePublicationChildEnvironment(environment),
29
+ rawOutput: true,
30
+ processGroup: true,
31
+ // The bound execFile had: a noisy step keeps its last 4 MiB (where failures
32
+ // are reported) instead of holding all of its output in the bridge.
33
+ maxOutputChars: prePublicationOutputLimitChars,
34
+ signal,
23
35
  });
24
- return { exitCode: 0, stdout: result.stdout, stderr: result.stderr };
36
+ return { exitCode: result.exitCode, stdout: result.stdout, stderr: result.stderr };
25
37
  }
26
38
  catch (error) {
27
39
  const failure = error;
28
- if (failure.name === "AbortError")
40
+ // Neither is a command result: a stop, or a tree that outlived it.
41
+ if (failure.name === "AbortError" || error instanceof ProcessTreeTerminationError)
29
42
  throw error;
30
43
  if (failure.code === "ENOENT") {
31
44
  return { exitCode: 127, stderr: `executable_not_found: ${command}` };
@@ -38,10 +51,7 @@ export class ProcessPrePublicationCommandRunner {
38
51
  }
39
52
  }
40
53
  }
41
- function quoteWindowsCommandArgument(value) {
42
- return /^[A-Za-z0-9_./:@=-]+$/u.test(value) ? value : `"${value.replaceAll('"', '""')}"`;
43
- }
44
- function prePublicationChildEnvironment(environment) {
54
+ export function prePublicationChildEnvironment(environment) {
45
55
  const child = {};
46
56
  const privilegedNames = new Set([
47
57
  hostRuntimeTestPostgresAdminEnvironment.toLowerCase(),
@@ -53,7 +63,10 @@ function prePublicationChildEnvironment(environment) {
53
63
  child[name] = value;
54
64
  }
55
65
  }
56
- return { ...child, ...environment };
66
+ // A validation step must not join the host ledger (it would queue behind its own token)
67
+ // or the sandbox broker, whether the variable is inherited or passed in explicitly.
68
+ // A heavy step that shares the host with other heavy steps sizes its test parallelism for its share.
69
+ return withHostTestParallelism(withoutHostLoadGovernorVariables({ ...child, ...environment }));
57
70
  }
58
71
  /**
59
72
  * Corepack picks the pnpm version from the nearest package.json `packageManager`
@@ -0,0 +1,12 @@
1
+ import { type NativeTestPostgresGrant } from "../runtime/native-test-postgres-fallback.js";
2
+ import type { PrePublicationExecutionContext } from "./pre-publication-validation.js";
3
+ export interface ValidationStep {
4
+ readonly command: string;
5
+ readonly fallbackCommand?: string;
6
+ readonly args: readonly string[];
7
+ readonly fallbackArgs?: readonly string[];
8
+ readonly assertUnchangedPaths?: readonly string[];
9
+ }
10
+ export declare function managedAttemptInvocation(checkId: string, step: ValidationStep, environment?: Readonly<Record<string, string>>): Pick<ValidationStep, "command" | "args">;
11
+ export declare function supportsNativeTestPostgresFallback(checkId: string): boolean;
12
+ export declare function validationExecutionForStep(checkId: string, step: ValidationStep, execution?: PrePublicationExecutionContext, postgresAdminConnection?: NativeTestPostgresGrant): PrePublicationExecutionContext | undefined;
@@ -0,0 +1,50 @@
1
+ import { nativeTestPostgresFallbackEnvironment, parseNativeTestPostgresFallback, } from "../runtime/native-test-postgres-fallback.js";
2
+ import { ForgeFailureError } from "./session.types.js";
3
+ export function managedAttemptInvocation(checkId, step, environment) {
4
+ const playwrightConfig = environment?.FORGE_PLAYWRIGHT_CONFIG?.trim();
5
+ const attemptOwned = environment?.FORGE_E2E_OWNERSHIP_MODE === "attempt"
6
+ || Boolean(environment?.FORGE_DISPATCH_ATTEMPT_ID?.trim());
7
+ if (checkId !== "playwright-e2e" || !attemptOwned) {
8
+ return step;
9
+ }
10
+ if (!playwrightConfig) {
11
+ throw new ForgeFailureError("prepublication_capability_unavailable", "prepublication_capability_unavailable: playwright-e2e requires the Bridge-generated FORGE_PLAYWRIGHT_CONFIG for a managed attempt.", "bridge");
12
+ }
13
+ return {
14
+ command: "pnpm",
15
+ args: ["--dir", "tests/e2e", "exec", "playwright", "test", "--config", playwrightConfig],
16
+ };
17
+ }
18
+ const nativeFallbackCheckIds = new Set([
19
+ "owned-suite-registration",
20
+ "dotnet-build-and-unit",
21
+ "comment-repair-dotnet-regression",
22
+ ]);
23
+ const nativeFallbackDotnetTierScripts = [
24
+ "scripts/run-dotnet-test-tier.ps1",
25
+ "scripts/run-dotnet-test-tier-set.ps1",
26
+ "scripts/run-affected-dotnet-tests.mjs",
27
+ ];
28
+ export function supportsNativeTestPostgresFallback(checkId) {
29
+ return nativeFallbackCheckIds.has(checkId);
30
+ }
31
+ export function validationExecutionForStep(checkId, step, execution, postgresAdminConnection) {
32
+ // The grant only exists when the operator provisioned a dedicated native test
33
+ // cluster, and only the runner-authored .NET test tiers and the suite-identity
34
+ // check receive it; build, client, Bridge, and E2E steps never do.
35
+ if (!postgresAdminConnection || !nativeFallbackCheckIds.has(checkId))
36
+ return execution;
37
+ const runsDotnetTier = step.args.some(argument => nativeFallbackDotnetTierScripts
38
+ .some(script => argument.replaceAll("\\", "/").endsWith(script)));
39
+ if (checkId !== "owned-suite-registration" && !runsDotnetTier)
40
+ return execution;
41
+ // Re-validate the connection before it reaches attempt code.
42
+ parseNativeTestPostgresFallback(postgresAdminConnection.connectionString);
43
+ return {
44
+ ...execution,
45
+ environment: {
46
+ ...execution?.environment,
47
+ ...nativeTestPostgresFallbackEnvironment(postgresAdminConnection),
48
+ },
49
+ };
50
+ }
@@ -1,15 +1,12 @@
1
1
  import type { DockerEngineProbe } from "../runtime/docker-engine-probe.js";
2
- import { type NativeTestPostgresFallback } from "../runtime/native-test-postgres-fallback.js";
2
+ import type { HostLoadStepGate } from "../runtime/host-load-governor.js";
3
+ import { type PrePublicationHostLoadOwner } from "./pre-publication-host-load.js";
4
+ import { type NativeTestPostgresFallback, type StartEphemeralTestPostgresGrant } from "./pre-publication-native-postgres.js";
5
+ import { type ValidationStep } from "./pre-publication-step-execution.js";
6
+ import { PrePublicationValidationError, type PrePublicationCheckFailure } from "./pre-publication-pass.js";
3
7
  import type { ProviderProcessRunner } from "./provider-cli/provider-cli.process.js";
4
8
  import { ForgeFailureError, type RunnerDispatchEvent } from "./session.types.js";
5
9
  export type PrePublicationProfile = "implementation" | "comment_repair" | "ci_repair" | "conflict_repair";
6
- interface ValidationStep {
7
- readonly command: string;
8
- readonly fallbackCommand?: string;
9
- readonly args: readonly string[];
10
- readonly fallbackArgs?: readonly string[];
11
- readonly assertUnchangedPaths?: readonly string[];
12
- }
13
10
  interface ValidationCheck {
14
11
  readonly id: string;
15
12
  readonly profiles: readonly string[];
@@ -34,18 +31,19 @@ export interface PrePublicationCommandRunner {
34
31
  }
35
32
  export interface PrePublicationExecutionContext {
36
33
  readonly baselineRevision?: string;
34
+ /** The branch the attempt publishes into; only a merge of it scopes the pass (pre-publication-change-set.ts). */
35
+ readonly targetBranch?: string;
37
36
  readonly environment?: Readonly<Record<string, string>>;
38
37
  readonly processRunner?: ProviderProcessRunner;
38
+ /** The attempt governed steps reserve host capacity for (decision 0013). */
39
+ readonly hostLoadOwner?: PrePublicationHostLoadOwner;
40
+ /**
41
+ * The failed restart of the attempt's runtime stack before this pass. The pass reports it with
42
+ * its own failures and does not run the checks that need the stopped stack.
43
+ */
44
+ readonly runtimeRestartFailure?: PrePublicationValidationError;
39
45
  }
40
- export declare class PrePublicationValidationError extends ForgeFailureError {
41
- readonly checkId: string;
42
- readonly exitCode: number;
43
- readonly command: string;
44
- readonly args: readonly string[];
45
- readonly detail: string;
46
- readonly code = "prepublication_validation_failed";
47
- constructor(checkId: string, exitCode: number, command: string, args: readonly string[], detail: string);
48
- }
46
+ export { PrePublicationValidationError, type PrePublicationCheckFailure };
49
47
  export declare class PrePublicationInfrastructureError extends ForgeFailureError {
50
48
  readonly checkId: string;
51
49
  readonly exitCode: number;
@@ -59,17 +57,36 @@ export declare class PrePublicationValidator {
59
57
  private readonly commands;
60
58
  private readonly dockerEngineProbe?;
61
59
  private readonly nativeTestPostgresFallback;
62
- constructor(commands?: PrePublicationCommandRunner, dockerEngineProbe?: DockerEngineProbe | undefined, nativeTestPostgresFallback?: () => NativeTestPostgresFallback | null);
60
+ private readonly hostLoad?;
61
+ private readonly startEphemeral?;
62
+ constructor(commands?: PrePublicationCommandRunner, dockerEngineProbe?: DockerEngineProbe | undefined, nativeTestPostgresFallback?: () => NativeTestPostgresFallback | null, hostLoad?: HostLoadStepGate | undefined, startEphemeral?: StartEphemeralTestPostgresGrant | undefined);
63
+ /**
64
+ * Runs one pre-publication pass. A failed check does not end the pass: every remaining check that
65
+ * can still meaningfully run keeps going, and the pass then throws all of its failures as one
66
+ * PrePublicationValidationError.
67
+ */
63
68
  validate(worktreePath: string, profile: PrePublicationProfile, capabilities: ReadonlySet<string>, emit?: (event: RunnerDispatchEvent) => Promise<void>, signal?: AbortSignal, execution?: PrePublicationExecutionContext): Promise<readonly string[]>;
64
- /** Returns the native fallback connection when this check must use it instead of Docker. */
69
+ private runChecks;
70
+ /** Runs one check's steps in order; the first failed step ends the check, since later steps use its output. */
71
+ private runCheck;
72
+ private runCheckSteps;
73
+ /** Runs a step, confirming once a failure that matches a known transient pattern. */
74
+ private runConfirmedStep;
75
+ private runCheckedStep;
76
+ private confirmStep;
77
+ private confirmInfrastructure;
78
+ /** Returns the native cluster grant when this check uses it instead of Docker. */
65
79
  private ensurePrerequisite;
80
+ /** Waits for Docker; returns the native cluster grant when Docker stays down and a cluster is provisioned. */
81
+ private ensureDockerPrerequisite;
66
82
  private throwIfPrerequisiteWasLost;
67
- private assertNoTestOnlyExports;
68
- private changedPaths;
83
+ private checkTestOnlyExports;
69
84
  private assertContractMatchesDispatchBaseline;
85
+ /** The approved contract of the branch an in-progress merge brings in (MERGE_HEAD), else null. */
86
+ private mergedInContractDigest;
70
87
  private runStep;
88
+ private launchStep;
71
89
  private runCommand;
72
90
  }
73
91
  export declare function applicableChecks(contract: ValidationContract, profile: PrePublicationProfile | "github_actions", changedPaths: readonly string[]): readonly ValidationCheck[];
74
92
  export declare function loadValidationContract(worktreePath: string): Promise<ValidationContract | null>;
75
- export {};