@loucompanion/forge-bridge 0.1.3-dev.d46a8e73d03d → 0.1.3-dev.eeefdb0d19c1

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 (118) hide show
  1. package/README.md +34 -0
  2. package/dist/bridge/bridge.base.d.ts +2 -1
  3. package/dist/bridge/bridge.service.d.ts +22 -3
  4. package/dist/bridge/bridge.service.js +416 -40
  5. package/dist/bridge/bridge.types.d.ts +59 -1
  6. package/dist/cleanup/cleanup.service.d.ts +13 -2
  7. package/dist/cleanup/cleanup.service.js +435 -3
  8. package/dist/cleanup/cleanup.types.d.ts +10 -0
  9. package/dist/cleanup/index.d.ts +1 -1
  10. package/dist/cleanup/index.js +1 -1
  11. package/dist/cleanup/internals.d.ts +2 -2
  12. package/dist/cleanup/internals.js +1 -1
  13. package/dist/cli/cli.help.js +37 -3
  14. package/dist/cli/cli.service.d.ts +30 -2
  15. package/dist/cli/cli.service.js +182 -23
  16. package/dist/cli/local-config.d.ts +4 -0
  17. package/dist/cli/local-config.js +41 -1
  18. package/dist/runtime/attempt-node-runtime-launcher.d.ts +17 -0
  19. package/dist/runtime/attempt-node-runtime-launcher.js +101 -0
  20. package/dist/runtime/attempt-process-supervisor-registry.d.ts +20 -0
  21. package/dist/runtime/attempt-process-supervisor-registry.js +64 -0
  22. package/dist/runtime/attempt-process-supervisor.d.ts +86 -0
  23. package/dist/runtime/attempt-process-supervisor.js +343 -0
  24. package/dist/runtime/generated-output-reset.d.ts +10 -0
  25. package/dist/runtime/generated-output-reset.js +103 -0
  26. package/dist/runtime/host-listener-inspector.d.ts +44 -0
  27. package/dist/runtime/host-listener-inspector.js +324 -0
  28. package/dist/runtime/host-port-broker.d.ts +76 -0
  29. package/dist/runtime/host-port-broker.js +333 -0
  30. package/dist/runtime/host-runtime-contract.d.ts +47 -0
  31. package/dist/runtime/host-runtime-contract.js +700 -0
  32. package/dist/runtime/host-runtime-lease.d.ts +133 -0
  33. package/dist/runtime/host-runtime-lease.js +1460 -0
  34. package/dist/runtime/host-runtime-promotion.d.ts +23 -0
  35. package/dist/runtime/host-runtime-promotion.js +159 -0
  36. package/dist/runtime/node-host-runtime-adapter.d.ts +51 -0
  37. package/dist/runtime/node-host-runtime-adapter.js +268 -0
  38. package/dist/runtime/playwright-host-runtime-adapter.d.ts +20 -0
  39. package/dist/runtime/playwright-host-runtime-adapter.js +220 -0
  40. package/dist/runtime/runtime-isolation-lease.d.ts +67 -0
  41. package/dist/runtime/runtime-isolation-lease.js +158 -0
  42. package/dist/sandbox/preflight.d.ts +14 -0
  43. package/dist/sandbox/preflight.js +91 -12
  44. package/dist/sandbox/process.js +125 -40
  45. package/dist/sandbox/repository-lock.js +37 -1
  46. package/dist/sandbox/runtime.d.ts +66 -3
  47. package/dist/sandbox/runtime.js +670 -105
  48. package/dist/sandbox/sandbox.types.d.ts +3 -0
  49. package/dist/sandbox/smoke.d.ts +76 -0
  50. package/dist/sandbox/smoke.js +380 -0
  51. package/dist/sandbox/worker-supervisor.js +1 -1
  52. package/dist/sandbox/worker.js +2 -5
  53. package/dist/sandbox/workspace.service.d.ts +1 -0
  54. package/dist/sandbox/workspace.service.js +28 -5
  55. package/dist/session/managed-attempt-tools.d.ts +12 -0
  56. package/dist/session/managed-attempt-tools.js +350 -0
  57. package/dist/session/phase-completion.artifacts.js +9 -2
  58. package/dist/session/phase-completion.d.ts +4 -2
  59. package/dist/session/phase-completion.helpers.js +27 -3
  60. package/dist/session/phase-completion.js +12 -3
  61. package/dist/session/phase-completion.prompts.d.ts +3 -3
  62. package/dist/session/phase-completion.prompts.js +19 -5
  63. package/dist/session/phase-completion.runtime.d.ts +12 -1
  64. package/dist/session/phase-completion.runtime.js +127 -7
  65. package/dist/session/phase-completion.schemas.js +108 -3
  66. package/dist/session/phase-completion.validation.d.ts +4 -1
  67. package/dist/session/phase-completion.validation.js +106 -2
  68. package/dist/session/provider-cli/ci-repair-readiness.d.ts +8 -0
  69. package/dist/session/provider-cli/ci-repair-readiness.js +90 -0
  70. package/dist/session/provider-cli/provider-cli.artifacts.d.ts +1 -1
  71. package/dist/session/provider-cli/provider-cli.artifacts.js +28 -4
  72. package/dist/session/provider-cli/provider-cli.deterministic.js +47 -1
  73. package/dist/session/provider-cli/provider-cli.process.d.ts +16 -0
  74. package/dist/session/provider-cli/provider-cli.process.js +212 -25
  75. package/dist/session/provider-cli/provider-cli.prompts.d.ts +4 -1
  76. package/dist/session/provider-cli/provider-cli.prompts.js +84 -17
  77. package/dist/session/provider-cli/provider-cli.qa-sidecars.js +1 -0
  78. package/dist/session/provider-cli/provider-cli.runtime.d.ts +1 -1
  79. package/dist/session/provider-cli/provider-cli.runtime.js +3 -2
  80. package/dist/session/provider-cli/provider-cli.service.d.ts +3 -2
  81. package/dist/session/provider-cli/provider-cli.service.js +254 -71
  82. package/dist/session/provider-cli/provider-cli.types.d.ts +5 -0
  83. package/dist/session/provider-cli/provider-output-state.d.ts +2 -0
  84. package/dist/session/provider-cli/provider-output-state.js +30 -2
  85. package/dist/session/session-redaction.d.ts +3 -0
  86. package/dist/session/session-redaction.js +23 -0
  87. package/dist/session/session.base.d.ts +6 -1
  88. package/dist/session/session.service.d.ts +8 -2
  89. package/dist/session/session.service.js +436 -41
  90. package/dist/session/session.types.d.ts +55 -0
  91. package/dist/session/session.types.js +69 -2
  92. package/dist/shared/path/path.js +3 -1
  93. package/dist/shared/process/host-process-recovery.d.ts +12 -0
  94. package/dist/shared/process/host-process-recovery.js +78 -0
  95. package/dist/shared/process/host-process-supervisor.d.ts +57 -0
  96. package/dist/shared/process/host-process-supervisor.js +282 -0
  97. package/dist/shared/process/process.d.ts +1 -0
  98. package/dist/shared/process/process.js +1 -0
  99. package/dist/shared/redaction/redaction.js +6 -1
  100. package/dist/version.d.ts +1 -1
  101. package/dist/version.js +1 -1
  102. package/dist/worktree/artifact-injector.d.ts +3 -2
  103. package/dist/worktree/artifact-injector.js +43 -4
  104. package/dist/worktree/dependency-warmer.d.ts +10 -1
  105. package/dist/worktree/dependency-warmer.js +94 -5
  106. package/dist/worktree/index.d.ts +1 -0
  107. package/dist/worktree/index.js +1 -0
  108. package/dist/worktree/prior-phase-artifact-hydrator.d.ts +2 -0
  109. package/dist/worktree/prior-phase-artifact-hydrator.js +136 -0
  110. package/dist/worktree/worktree-paths.d.ts +4 -0
  111. package/dist/worktree/worktree-paths.js +30 -0
  112. package/dist/worktree/worktree.base.d.ts +3 -0
  113. package/dist/worktree/worktree.service.d.ts +7 -2
  114. package/dist/worktree/worktree.service.js +72 -44
  115. package/dist/worktree/worktree.types.d.ts +3 -1
  116. package/package.json +3 -2
  117. package/runtime/windows-job-supervisor.ps1 +356 -0
  118. package/runtime/windows-listener-owner.ps1 +33 -0
@@ -150,8 +150,13 @@ export function buildProviderCliCommand(dispatch, run) {
150
150
  const provider = dispatch.execution.provider.trim();
151
151
  const normalizedProvider = provider.toLowerCase();
152
152
  const model = dispatch.execution.model.trim();
153
+ const prompt = run
154
+ ? buildProviderCliPrompt(dispatch, run.prompt ?? "", run.runtimeEnvironment)
155
+ : undefined;
153
156
  if (normalizedProvider === "codex") {
154
- const args = run ? ["-s", codexSandboxModeForPlatform(), "-a", "never", "exec"] : ["exec"];
157
+ const args = run
158
+ ? ["-s", codexSandboxModeForPlatform(process.platform, dispatch.sandbox?.executionMode), "-a", "never", "exec"]
159
+ : ["exec"];
155
160
  if (run?.completionTools) {
156
161
  args.push(...codexMcpConfigArgs(run.completionTools));
157
162
  }
@@ -167,7 +172,7 @@ export function buildProviderCliCommand(dispatch, run) {
167
172
  for (const imagePath of run.imagePaths ?? []) {
168
173
  args.push("--image", imagePath);
169
174
  }
170
- args.push(run.prompt ?? "");
175
+ args.push(run.promptFromStdin ? "-" : prompt ?? "");
171
176
  }
172
177
  return { command: "codex", args };
173
178
  }
@@ -176,19 +181,56 @@ export function buildProviderCliCommand(dispatch, run) {
176
181
  if (run?.worktreePath) {
177
182
  args.push("--workspace", run.worktreePath);
178
183
  }
179
- if (run?.prompt) {
180
- args.push("--yolo", "--approve-mcps", "--trust", run.prompt);
184
+ if (prompt) {
185
+ args.push("--yolo", "--approve-mcps", "--trust", prompt);
181
186
  }
182
187
  return { command: "cursor-agent", args };
183
188
  }
184
189
  const args = ["--model", model];
185
- if (run?.prompt) {
186
- args.push(run.prompt);
190
+ if (prompt) {
191
+ args.push(prompt);
187
192
  }
188
193
  return { command: provider, args };
189
194
  }
190
- export function codexSandboxModeForPlatform(platform = process.platform) {
191
- return platform === "win32" ? "danger-full-access" : "workspace-write";
195
+ export function buildProviderCliPrompt(dispatch, prompt, runtimeEnvironment) {
196
+ const executionMode = dispatch.sandbox?.executionMode;
197
+ if (executionMode !== "docker" && executionMode !== "host") {
198
+ return prompt;
199
+ }
200
+ if (executionMode === "host") {
201
+ const concurrency = runtimeEnvironment?.FORGE_HOST_CONCURRENCY === "host_parallel_safe"
202
+ ? "- `FORGE_HOST_CONCURRENCY=host_parallel_safe` means Forge verified this contract's assigned-port probe and gave this attempt independent ports, paths, and process supervisors. Do not share or discover another attempt's runtime resources."
203
+ : "- `FORGE_HOST_CONCURRENCY=host_serial_only` means Forge holds the runner-local project singleton named by `FORGE_SINGLETON_KEYS`; do not bypass or release it yourself.";
204
+ const playwright = runtimeEnvironment?.FORGE_PLAYWRIGHT_CONFIG
205
+ ? "\n- For Playwright, use the generated `FORGE_PLAYWRIGHT_CONFIG`; it targets this attempt's verified `FORGE_PLAYWRIGHT_BASE_URL`, disables project `webServer` startup/reuse, and writes under `FORGE_TEST_OUTPUT_DIR`. Do not invoke the project Playwright config directly."
206
+ : "";
207
+ return `${prompt.trimEnd()}
208
+
209
+ # Trusted Forge runtime context
210
+
211
+ - Placement: managed host worktree. Host mode prevents ownership collisions but does not provide Docker filesystem, network, credential, or kernel isolation.
212
+ - \`FORGE_RUNTIME_MODE=host\`, \`FORGE_RESOURCE_LEASE_ID\`, and \`FORGE_DISPATCH_ATTEMPT_ID\` identify the fenced runtime lease. \`FORGE_WORKTREE_PATH\` identifies the prepared repository root.
213
+ ${concurrency}
214
+ - Forge owns this attempt's process tree through \`FORGE_PROCESS_SUPERVISOR_ID\`. Do not detach, adopt pre-existing servers, or kill processes by name or port; cancellation and teardown are supervisor-owned.
215
+ - Use \`forge.start_managed_command\` for commands expected to run longer than two minutes, especially broad test suites, then poll \`forge.get_managed_command\` until its durable receipt is terminal. Its timeout terminates and verifies the exact attempt-owned process tree; do not run those commands through the generic shell tool.
216
+ - If a tool creates \`TestResults\`, \`test-results\`, or \`playwright-report\` beneath source, use \`forge.reset_generated_outputs\` to quarantine only those untracked generated directories. Do not issue a recursive delete.
217
+ - Use the attempt-scoped \`FORGE_TMPDIR\`, \`FORGE_LOG_DIR\`, \`FORGE_CACHE_DIR\`, \`FORGE_BROWSER_PROFILE_DIR\`, and \`FORGE_TEST_OUTPUT_DIR\` paths instead of shared host paths.
218
+ - Use supplied \`FORGE_*\` URLs, ports, and paths. Do not search for a free port, kill a process occupying one, or reuse an existing dev server, browser profile, database, container, network, or volume.
219
+ - Never run broad process or Docker cleanup. Stop only resources you created for this resource lease.${playwright}`;
220
+ }
221
+ return `${prompt.trimEnd()}
222
+
223
+ # Trusted Forge runtime context
224
+
225
+ - Placement: Docker sandbox. You are already running inside the agent container with the repository mounted at \`/workspace\`.
226
+ - \`FORGE_RUNTIME_MODE=docker\`, \`FORGE_RESOURCE_LEASE_ID\`, and \`FORGE_DISPATCH_ATTEMPT_ID\` identify the fenced runtime lease. \`FORGE_WORKTREE_PATH\` identifies the mounted repository root.
227
+ - Use the attempt-scoped \`FORGE_TMPDIR\`, \`FORGE_LOG_DIR\`, and \`FORGE_BROWSER_PROFILE_DIR\` paths instead of shared host paths.
228
+ - The host Docker CLI and daemon are intentionally not mounted inside the agent container. Do not use \`docker --version\`, Docker socket access, or a nested container launch to decide whether this run is sandboxed.
229
+ - When the work item requires in-sandbox evidence, use container-local facts such as \`pwd\`, \`printenv FORGE_RUNTIME_MODE\`, and \`printenv FORGE_RESOURCE_LEASE_ID\`.
230
+ - Forge records container startup outside the provider process and performs resource cleanup after the provider exits. Do not block the current phase because host-side cleanup cannot be observed from inside the container.`;
231
+ }
232
+ export function codexSandboxModeForPlatform(platform = process.platform, executionMode) {
233
+ return platform === "win32" || executionMode === "docker" ? "danger-full-access" : "workspace-write";
192
234
  }
193
235
  export function buildArchitectPrompt(dispatch) {
194
236
  return `You are Forge's Architect lane running locally in a prepared git worktree.
@@ -363,8 +405,13 @@ export function phaseWorkInstruction(phase) {
363
405
  export function qaBrowserInstruction(dispatch) {
364
406
  const qaBrowser = dispatch.qaBrowser;
365
407
  const qaScope = dispatch.qaScope;
408
+ const playwrightPolicy = `
409
+ - \`browser_manual\` is Forge's browser-level evidence class; it may be satisfied by a real Playwright interaction against the current prepared worktree. It does not require a human-operated browser.
410
+ - First use an attempt-scoped \`FORGE_PLAYWRIGHT_CONFIG\` when present. Otherwise inspect the repository's package scripts and Playwright configuration and prefer an existing self-contained e2e workflow over an ad-hoc browser script.
411
+ - Run browser evidence against this attempt's checked-out commit. Do not substitute a shared, deployed, or already-running app unless Forge's launch context explicitly identifies it as the target for this commit.
412
+ - Designer refs are optional product context, not a prerequisite for UI QA. When no refs are attached, exercise the acceptance criteria with the repository's existing fixtures, seed APIs, or Playwright route fixtures.`;
366
413
  if (!qaBrowser) {
367
- return "Browser/app launch context: not provided by Forge.";
414
+ return `Browser/app launch context: not provided by Forge.${playwrightPolicy}\n- Return missing_app_launch_target only after confirming that neither a managed Playwright config nor a safe repository-owned Playwright workflow can launch and exercise the affected UI.`;
368
415
  }
369
416
  const scopeAuthority = qaScope
370
417
  ? qaScope.source === "heuristic"
@@ -376,13 +423,13 @@ export function qaBrowserInstruction(dispatch) {
376
423
  : "";
377
424
  const launchTarget = qaBrowser.launchTarget;
378
425
  if (qaBrowser.required && !hasLaunchTarget(launchTarget ?? null)) {
379
- return `Browser/app launch context:\n- UI/browser QA is required for this item by ${scopeAuthority}.\n- No app launch target was provided.\n- Return blocked with blocker_reason: missing_app_launch_target instead of pretending browser testing occurred.${scopeEvidence}\n- Artifact sidecars path when available: ${qaBrowser.artifactsPath || `.forge/work-items/${dispatch.workItem.id}/artifacts/qa`}`;
426
+ return `Browser/app launch context:\n- UI/browser QA is required for this item by ${scopeAuthority}.\n- No configured app launch target was provided.${scopeEvidence}${playwrightPolicy}\n- If a managed or repository-owned Playwright workflow successfully exercises the affected UI, record both its passing command and browser_checks evidence. Otherwise return blocked with blocker_reason: missing_app_launch_target instead of pretending browser testing occurred.\n- Artifact sidecars path when available: ${qaSidecarRoot(dispatch)}`;
380
427
  }
381
428
  if (!launchTarget) {
382
- return `Browser/app launch context:\n- UI/browser QA is not required by ${scopeAuthority} for this item.\n- If you determine browser testing is needed, return blocked with blocker_reason: missing_app_launch_target unless you can safely identify a launch target from the repo.${scopeEvidence}\n- Browser sidecars path: ${qaBrowser.artifactsPath || `.forge/work-items/${dispatch.workItem.id}/artifacts/qa`}`;
429
+ return `Browser/app launch context:\n- UI/browser QA is not required by ${scopeAuthority} for this item.\n- If the diff or acceptance criteria require browser testing, use a managed or repository-owned Playwright workflow when available; otherwise return blocked with blocker_reason: missing_app_launch_target.${scopeEvidence}${playwrightPolicy}\n- Browser sidecars path: ${qaSidecarRoot(dispatch)}`;
383
430
  }
384
431
  const routes = launchTarget.routes.length > 0 ? launchTarget.routes.join(", ") : "not specified";
385
- return `Browser/app launch context:\n- Browser QA required: ${qaBrowser.required ? `yes, by ${scopeAuthority}` : `no by ${scopeAuthority}, unless the diff/AC requires it`}\n- URL: ${launchTarget.url || "not specified"}\n- Ready URL: ${launchTarget.ready_url || "not specified"}\n- Launch command: ${launchTarget.command || "not specified"}\n- Working directory: ${launchTarget.working_directory || "repo root"}\n- Routes to cover: ${routes}\n- Notes: ${launchTarget.notes || "none"}${scopeEvidence}\n- Browser sidecars path: ${qaBrowser.artifactsPath || `.forge/work-items/${dispatch.workItem.id}/artifacts/qa`}`;
432
+ return `Browser/app launch context:\n- Browser QA required: ${qaBrowser.required ? `yes, by ${scopeAuthority}` : `no by ${scopeAuthority}, unless the diff/AC requires it`}\n- URL: ${launchTarget.url || "not specified"}\n- Ready URL: ${launchTarget.ready_url || "not specified"}\n- Launch command: ${launchTarget.command || "not specified"}\n- Working directory: ${launchTarget.working_directory || "repo root"}\n- Routes to cover: ${routes}\n- Notes: ${launchTarget.notes || "none"}${scopeEvidence}${playwrightPolicy}\n- Browser sidecars path: ${qaSidecarRoot(dispatch)}`;
386
433
  }
387
434
  export function storyQaInstruction(dispatch) {
388
435
  const storyQa = dispatch.storyQa;
@@ -418,6 +465,8 @@ ${finalQa}
418
465
  This is parent Story QA: inspect the integrated Story result, all current-plan child specs/evidence, and the final worktree state. Do not treat the final child task as separately signed off.`;
419
466
  }
420
467
  export function buildQaPrompt(dispatch, laneSpec) {
468
+ const sidecarRoot = qaSidecarRoot(dispatch);
469
+ const artifactRoot = sidecarRoot.replace(/\/qa\/?$/i, "");
421
470
  return `You are Forge's QA lane running locally in a prepared git worktree.
422
471
 
423
472
  First read and follow the injected QA lane command at .forge/work-items/${dispatch.workItem.id}/spec.md. It defines the required gated QA skill workflow for this run.
@@ -442,18 +491,28 @@ System info / environment notes:
442
491
  ${dispatch.workItem.systemInfo || "Not provided."}
443
492
 
444
493
  ${storyQaInstruction(dispatch)}
445
- Inspect the validated implementation and Forge artifacts under .forge/work-items/${dispatch.workItem.id}/artifacts/ when present, especially implementation, self-review, and validation evidence.
494
+ Inspect the validated implementation evidence referenced by the dispatch and the owner-scoped QA artifacts under ${artifactRoot}/ when present.
446
495
  ${qaBrowserInstruction(dispatch)}
447
496
  ${qaReworkRetestInstruction(dispatch)}
448
497
  QA is read-mostly: inspect code, run commands, and exercise browser/app flows when available, but do not edit product source or tests.
449
- Record concrete evidence. For UI/browser work, include browser_checks with URLs/routes, actions, observed results, screenshots/traces when available, console errors, failed network requests, and responsive checks. Store browser sidecars under .forge/work-items/${dispatch.workItem.id}/artifacts/qa/.
498
+ Record concrete evidence. For UI/browser work, include browser_checks with URLs/routes, actions, observed results, screenshots/traces when available, console errors, failed network requests, and responsive checks. Store browser sidecars under ${sidecarRoot}/.
450
499
  Report in-scope defects as actionable findings with repro steps, expected/actual behavior, evidence, likely area, required fix, and required regression.
451
- Out-of-scope or follow-up issues belong in candidate_bugs instead of blocking the current item.
500
+ Out-of-scope or follow-up issues belong in candidate_bugs instead of blocking the current item. If a broad regression command fails only on a surface outside both the current diff and acceptance criteria, reproduce that failure with a focused command. The regression gate may pass only when the current item has independent passing evidence and the failed command is preserved with classification out_of_scope_failure, candidate_bug_id, scope_evidence, acceptance_criteria_independent: true, repro_command, and a non-zero repro_exit_code. Never use this classification for an unexplained failure, a runner/environment failure, or a failure that can affect the current item.
452
501
 
453
- ${completionPromptForQaCycle()}
502
+ ${completionPromptForQaCycle("qa_plan", artifactRoot)}
454
503
 
455
504
  Finish with a concise summary only after forge.complete_qa_verdict accepts the QA bundle.`;
456
505
  }
506
+ function qaSidecarRoot(dispatch) {
507
+ const configured = dispatch.qaBrowser?.artifactsPath?.trim().replace(/\\/g, "/").replace(/\/+$/, "");
508
+ if (configured) {
509
+ return configured;
510
+ }
511
+ const ownerType = dispatch.cycleRun.ownerType?.trim().toLowerCase();
512
+ const ownerId = dispatch.cycleRun.ownerId?.trim() || dispatch.workItem.id;
513
+ const ownerDirectory = ownerType === "story" ? "stories" : "work-items";
514
+ return `.forge/${ownerDirectory}/${ownerId}/artifacts/qa`;
515
+ }
457
516
  export function buildConflictResolvePrompt(dispatch, branchName) {
458
517
  const targetBranch = dispatch.cycleRun.requestedBase || dispatch.repo.defaultBranch || "main";
459
518
  return `You are Forge's Conflict Resolve lane running locally in a prepared git worktree.
@@ -487,12 +546,20 @@ This is not a merge-conflict resolution task. Only fetch/merge/rebase ${targetBr
487
546
 
488
547
  Load and follow .forge/commands/operational/ci-repair-prompt.md, including its CI repair phase gate and validation skill. Inspect the failed provider check logs, identify the exact failed workflow job/step, make the smallest scoped repair, and before pushing run the failed job's local workflow-equivalent gate, including pre-test guard/drift steps when available.
489
548
 
549
+ Forge prepared two required inputs before this agent started:
550
+ - Approved spec: .forge/work-items/${dispatch.workItem.id}/spec.md
551
+ - Readiness contract: .forge/work-items/${dispatch.workItem.id}/ci-repair.readiness.json
552
+
553
+ Read both first. The readiness contract supplies attempt-scoped E2E URLs, Playwright/browser readiness, and any provider-only local-equivalence classifications. A provider-only step is not permission to weaken CI; record why it cannot run inside the managed attempt and leave provider CI authoritative.
554
+
555
+ After repair and validation, call forge.complete_ci_repair with the complete structured handoff. Forge Bridge will validate it and will not commit, push, or report success until that gate passes. If the tool rejects the payload, correct the exact missing evidence it reports and call it again.
556
+
490
557
  Keep the original work item intent intact:
491
558
  - Work item: ${dispatch.workItem.id}
492
559
  - Title: ${dispatch.workItem.title}
493
560
  - Acceptance criteria: ${dispatch.workItem.acceptanceCriteria || "Not specified"}
494
561
 
495
- Finish with a concise summary of failing checks, changed files, validation commands, pushed commit status, and any remaining provider checks still pending.`;
562
+ Forge Bridge owns the final commit and push after the completion gate succeeds. Finish with a concise summary of failing checks, changed files, validation commands, and remaining provider checks.`;
496
563
  }
497
564
  export function buildPullRequestCommentsPrompt(dispatch, branchName) {
498
565
  const pr = dispatch.pullRequest;
@@ -4,6 +4,7 @@ import path from "node:path";
4
4
  export function hasLaunchTarget(target) {
5
5
  return Boolean(target?.url?.trim()
6
6
  || target?.ready_url?.trim()
7
+ || target?.managed_runtime_port?.trim()
7
8
  || target?.command?.trim()
8
9
  || (target?.routes ?? []).some((route) => route.trim().length > 0));
9
10
  }
@@ -2,7 +2,7 @@ import type { RunOnceDispatchPacket } from "../session.types.js";
2
2
  import type { ProviderCliRunContext } from "./provider-cli.types.js";
3
3
  import type { ProviderOutputState } from "./provider-output-state.js";
4
4
  import { type ProviderUsage } from "./provider-usage.js";
5
- export declare function providerProcessEnv(dispatch: RunOnceDispatchPacket): Readonly<Record<string, string>> | undefined;
5
+ export declare function providerProcessEnv(dispatch: RunOnceDispatchPacket, runtimeEnvironment?: Readonly<Record<string, string>>): Readonly<Record<string, string>> | undefined;
6
6
  export declare function providerCredentialEnv(dispatch: RunOnceDispatchPacket): Readonly<Record<string, string>>;
7
7
  export declare function exactRedactionSecrets(dispatch: RunOnceDispatchPacket): readonly string[];
8
8
  export declare function emitProviderUsageEvent(emit: ProviderCliRunContext["emit"], dispatch: RunOnceDispatchPacket, outputState: ProviderOutputState): Promise<void>;
@@ -1,9 +1,10 @@
1
1
  import { completionRedactionEnv } from "../phase-completion.js";
2
2
  import { addUsage, buildProviderUsageEvent, emptyUsage, hasUsage } from "./provider-usage.js";
3
- export function providerProcessEnv(dispatch) {
3
+ export function providerProcessEnv(dispatch, runtimeEnvironment) {
4
4
  const env = {
5
5
  ...completionRedactionEnv(exactRedactionSecrets(dispatch)),
6
- ...providerCredentialEnv(dispatch)
6
+ ...providerCredentialEnv(dispatch),
7
+ ...runtimeEnvironment,
7
8
  };
8
9
  return Object.keys(env).length > 0 ? env : undefined;
9
10
  }
@@ -4,7 +4,7 @@ import type { ProviderCliDraftContext, ProviderCliRunContext, ProviderCliRunResu
4
4
  import { type ProviderProcessRunner } from "./provider-cli.process.js";
5
5
  export { DeterministicProviderCliService } from "./provider-cli.deterministic.js";
6
6
  export { buildProviderCliCommand, codexSandboxModeForPlatform, formatProviderCliCommand, formatProviderCliCommandForCheckpoint } from "./provider-cli.prompts.js";
7
- export { buildProviderChildEnvironment, chooseWindowsCommandCandidate, StreamingProviderProcessRunner } from "./provider-cli.process.js";
7
+ export { buildProviderChildEnvironment, chooseWindowsCommandCandidate, resolveCodexNpmDirectLaunch, resolvePackageManagerDirectLaunch, resolveWindowsCommandFromPath, StreamingProviderProcessRunner } from "./provider-cli.process.js";
8
8
  export { buildWindowsLaunchCommand } from "../../shared/process/windows-launch.js";
9
9
  export type { ProviderCliCommand, ProviderProcessRunner, ProviderProcessRunRequest, ProviderProcessRunResult } from "./provider-cli.process.js";
10
10
  export declare class RoutingProviderCliService implements ProviderCliService {
@@ -21,7 +21,8 @@ export declare class RoutingProviderCliService implements ProviderCliService {
21
21
  export declare class ProcessBackedProviderCliService implements ProviderCliService {
22
22
  private readonly processRunner;
23
23
  private readonly git;
24
- constructor(processRunner?: ProviderProcessRunner, git?: GitClient);
24
+ private readonly providerToolHeartbeatIntervalMs;
25
+ constructor(processRunner?: ProviderProcessRunner, git?: GitClient, providerToolHeartbeatIntervalMs?: number);
25
26
  runDraft(context: ProviderCliDraftContext): Promise<ProviderCliRunResult>;
26
27
  runImplementation(context: ProviderCliRunContext): Promise<ProviderCliRunResult>;
27
28
  runArchitect(context: ProviderCliRunContext): Promise<ProviderCliRunResult>;