@loucompanion/forge-bridge 0.1.3-dev.9d8f2e7e5241 → 0.1.3-dev.a58d7cd1092f
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.
- package/README.md +83 -0
- package/dist/bridge/bridge.base.d.ts +4 -1
- package/dist/bridge/bridge.service.d.ts +55 -3
- package/dist/bridge/bridge.service.js +834 -87
- package/dist/bridge/bridge.types.d.ts +89 -1
- package/dist/bridge/runner-host-capabilities.d.ts +15 -0
- package/dist/bridge/runner-host-capabilities.js +93 -0
- package/dist/cleanup/cleanup.service.d.ts +14 -2
- package/dist/cleanup/cleanup.service.js +496 -3
- package/dist/cleanup/cleanup.types.d.ts +10 -0
- package/dist/cleanup/index.d.ts +1 -1
- package/dist/cleanup/index.js +1 -1
- package/dist/cleanup/internals.d.ts +2 -2
- package/dist/cleanup/internals.js +1 -1
- package/dist/cli/cli.help.js +37 -3
- package/dist/cli/cli.service.d.ts +33 -2
- package/dist/cli/cli.service.js +209 -27
- package/dist/cli/local-config.d.ts +5 -0
- package/dist/cli/local-config.js +45 -1
- package/dist/runtime/aspnet-runtime-prebuild.d.ts +36 -0
- package/dist/runtime/aspnet-runtime-prebuild.js +340 -0
- package/dist/runtime/attempt-node-runtime-launcher.d.ts +17 -0
- package/dist/runtime/attempt-node-runtime-launcher.js +105 -0
- package/dist/runtime/attempt-process-supervisor-registry.d.ts +20 -0
- package/dist/runtime/attempt-process-supervisor-registry.js +64 -0
- package/dist/runtime/attempt-process-supervisor.d.ts +97 -0
- package/dist/runtime/attempt-process-supervisor.js +386 -0
- package/dist/runtime/docker-engine-probe.d.ts +83 -0
- package/dist/runtime/docker-engine-probe.js +300 -0
- package/dist/runtime/generated-output-reset.d.ts +10 -0
- package/dist/runtime/generated-output-reset.js +103 -0
- package/dist/runtime/host-listener-inspector.d.ts +46 -0
- package/dist/runtime/host-listener-inspector.js +349 -0
- package/dist/runtime/host-port-broker.d.ts +76 -0
- package/dist/runtime/host-port-broker.js +333 -0
- package/dist/runtime/host-runtime-contract.d.ts +47 -0
- package/dist/runtime/host-runtime-contract.js +700 -0
- package/dist/runtime/host-runtime-lease.d.ts +197 -0
- package/dist/runtime/host-runtime-lease.js +2203 -0
- package/dist/runtime/host-runtime-promotion.d.ts +23 -0
- package/dist/runtime/host-runtime-promotion.js +159 -0
- package/dist/runtime/memory-capacity.d.ts +68 -0
- package/dist/runtime/memory-capacity.js +121 -0
- package/dist/runtime/node-host-runtime-adapter.d.ts +54 -0
- package/dist/runtime/node-host-runtime-adapter.js +284 -0
- package/dist/runtime/playwright-host-runtime-adapter.d.ts +21 -0
- package/dist/runtime/playwright-host-runtime-adapter.js +231 -0
- package/dist/runtime/runtime-isolation-lease.d.ts +67 -0
- package/dist/runtime/runtime-isolation-lease.js +158 -0
- package/dist/runtime/workspace-resource-estimator.d.ts +17 -0
- package/dist/runtime/workspace-resource-estimator.js +174 -0
- package/dist/sandbox/preflight.d.ts +45 -1
- package/dist/sandbox/preflight.js +299 -34
- package/dist/sandbox/process.js +21 -2
- package/dist/sandbox/repository-lock.js +41 -3
- package/dist/sandbox/runtime.d.ts +66 -3
- package/dist/sandbox/runtime.js +670 -105
- package/dist/sandbox/sandbox.types.d.ts +10 -0
- package/dist/sandbox/smoke.d.ts +76 -0
- package/dist/sandbox/smoke.js +380 -0
- package/dist/sandbox/worker-supervisor.js +1 -1
- package/dist/sandbox/worker.js +2 -5
- package/dist/sandbox/workspace.service.d.ts +1 -0
- package/dist/sandbox/workspace.service.js +28 -5
- package/dist/session/managed-attempt-tools.d.ts +21 -0
- package/dist/session/managed-attempt-tools.js +912 -0
- package/dist/session/managed-build-coordinator.d.ts +5 -0
- package/dist/session/managed-build-coordinator.js +105 -0
- package/dist/session/managed-build-receipt.d.ts +21 -0
- package/dist/session/managed-build-receipt.js +335 -0
- package/dist/session/phase-completion.artifacts.d.ts +17 -0
- package/dist/session/phase-completion.artifacts.js +233 -24
- package/dist/session/phase-completion.d.ts +12 -2
- package/dist/session/phase-completion.helpers.d.ts +5 -0
- package/dist/session/phase-completion.helpers.js +51 -10
- package/dist/session/phase-completion.js +14 -3
- package/dist/session/phase-completion.prompts.d.ts +3 -3
- package/dist/session/phase-completion.prompts.js +24 -8
- package/dist/session/phase-completion.runtime.d.ts +13 -1
- package/dist/session/phase-completion.runtime.js +189 -8
- package/dist/session/phase-completion.schemas.js +117 -4
- package/dist/session/phase-completion.validation.d.ts +4 -1
- package/dist/session/phase-completion.validation.js +153 -22
- package/dist/session/pre-publication-validation.d.ts +46 -0
- package/dist/session/pre-publication-validation.js +208 -0
- package/dist/session/provider-cli/ci-repair-readiness.d.ts +16 -0
- package/dist/session/provider-cli/ci-repair-readiness.js +110 -0
- package/dist/session/provider-cli/provider-cli.artifacts.d.ts +3 -2
- package/dist/session/provider-cli/provider-cli.artifacts.js +65 -7
- package/dist/session/provider-cli/provider-cli.deterministic.js +47 -1
- package/dist/session/provider-cli/provider-cli.process.d.ts +25 -0
- package/dist/session/provider-cli/provider-cli.process.js +463 -34
- package/dist/session/provider-cli/provider-cli.prompts.d.ts +4 -1
- package/dist/session/provider-cli/provider-cli.prompts.js +108 -25
- package/dist/session/provider-cli/provider-cli.qa-sidecars.js +1 -0
- package/dist/session/provider-cli/provider-cli.runtime.d.ts +1 -1
- package/dist/session/provider-cli/provider-cli.runtime.js +6 -3
- package/dist/session/provider-cli/provider-cli.service.d.ts +22 -2
- package/dist/session/provider-cli/provider-cli.service.js +529 -100
- package/dist/session/provider-cli/provider-cli.types.d.ts +5 -0
- package/dist/session/provider-cli/provider-output-state.d.ts +2 -0
- package/dist/session/provider-cli/provider-output-state.js +91 -16
- package/dist/session/provider-cli/provider-usage.d.ts +7 -0
- package/dist/session/provider-cli/provider-usage.js +28 -5
- package/dist/session/session-redaction.d.ts +3 -0
- package/dist/session/session-redaction.js +38 -0
- package/dist/session/session.base.d.ts +6 -1
- package/dist/session/session.service.d.ts +8 -2
- package/dist/session/session.service.js +522 -41
- package/dist/session/session.types.d.ts +72 -0
- package/dist/session/session.types.js +74 -3
- package/dist/shared/format/format-bytes.d.ts +1 -0
- package/dist/shared/format/format-bytes.js +9 -0
- package/dist/shared/path/path.d.ts +1 -0
- package/dist/shared/path/path.js +21 -1
- package/dist/shared/process/dotnet-toolchain.d.ts +14 -0
- package/dist/shared/process/dotnet-toolchain.js +179 -0
- package/dist/shared/process/host-process-recovery.d.ts +12 -0
- package/dist/shared/process/host-process-recovery.js +78 -0
- package/dist/shared/process/host-process-supervisor.d.ts +59 -0
- package/dist/shared/process/host-process-supervisor.js +330 -0
- package/dist/shared/process/process.d.ts +1 -0
- package/dist/shared/process/process.js +1 -0
- package/dist/shared/redaction/redaction.js +12 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worktree/artifact-injector.d.ts +3 -2
- package/dist/worktree/artifact-injector.js +43 -4
- package/dist/worktree/dependency-warmer.d.ts +28 -1
- package/dist/worktree/dependency-warmer.js +308 -9
- package/dist/worktree/index.d.ts +2 -1
- package/dist/worktree/index.js +1 -0
- package/dist/worktree/prior-phase-artifact-hydrator.d.ts +2 -0
- package/dist/worktree/prior-phase-artifact-hydrator.js +136 -0
- package/dist/worktree/worktree-paths.d.ts +4 -0
- package/dist/worktree/worktree-paths.js +30 -0
- package/dist/worktree/worktree.base.d.ts +3 -0
- package/dist/worktree/worktree.service.d.ts +13 -2
- package/dist/worktree/worktree.service.js +238 -47
- package/dist/worktree/worktree.types.d.ts +5 -1
- package/package.json +5 -3
- package/runtime/windows-job-supervisor.ps1 +444 -0
- package/runtime/windows-listener-owner.ps1 +33 -0
|
@@ -150,15 +150,30 @@ 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
|
|
157
|
+
const resumeThreadId = run ? dispatch.session.resumeProviderThreadId?.trim() : null;
|
|
158
|
+
const args = run
|
|
159
|
+
? ["-s", codexSandboxModeForPlatform(process.platform, dispatch.sandbox?.executionMode), "-a", "never", "exec"]
|
|
160
|
+
: ["exec"];
|
|
161
|
+
// `--cd` belongs to `codex exec`, not its `resume` subcommand. Keep it
|
|
162
|
+
// ahead of `resume` so a continued provider thread starts in the prepared
|
|
163
|
+
// worktree instead of failing argument parsing before the agent launches.
|
|
164
|
+
if (resumeThreadId && run?.worktreePath) {
|
|
165
|
+
args.push("--cd", run.worktreePath);
|
|
166
|
+
}
|
|
167
|
+
if (resumeThreadId) {
|
|
168
|
+
args.push("resume");
|
|
169
|
+
}
|
|
155
170
|
if (run?.completionTools) {
|
|
156
171
|
args.push(...codexMcpConfigArgs(run.completionTools));
|
|
157
172
|
}
|
|
158
173
|
args.push("--model", model);
|
|
159
174
|
if (run) {
|
|
160
175
|
args.push("--json");
|
|
161
|
-
if (run.worktreePath) {
|
|
176
|
+
if (run.worktreePath && !resumeThreadId) {
|
|
162
177
|
args.push("--cd", run.worktreePath);
|
|
163
178
|
}
|
|
164
179
|
if (run.skipGitRepoCheck) {
|
|
@@ -167,7 +182,10 @@ export function buildProviderCliCommand(dispatch, run) {
|
|
|
167
182
|
for (const imagePath of run.imagePaths ?? []) {
|
|
168
183
|
args.push("--image", imagePath);
|
|
169
184
|
}
|
|
170
|
-
|
|
185
|
+
if (resumeThreadId) {
|
|
186
|
+
args.push(resumeThreadId);
|
|
187
|
+
}
|
|
188
|
+
args.push(run.promptFromStdin ? "-" : prompt ?? "");
|
|
171
189
|
}
|
|
172
190
|
return { command: "codex", args };
|
|
173
191
|
}
|
|
@@ -176,19 +194,56 @@ export function buildProviderCliCommand(dispatch, run) {
|
|
|
176
194
|
if (run?.worktreePath) {
|
|
177
195
|
args.push("--workspace", run.worktreePath);
|
|
178
196
|
}
|
|
179
|
-
if (
|
|
180
|
-
args.push("--yolo", "--approve-mcps", "--trust",
|
|
197
|
+
if (prompt) {
|
|
198
|
+
args.push("--yolo", "--approve-mcps", "--trust", prompt);
|
|
181
199
|
}
|
|
182
200
|
return { command: "cursor-agent", args };
|
|
183
201
|
}
|
|
184
202
|
const args = ["--model", model];
|
|
185
|
-
if (
|
|
186
|
-
args.push(
|
|
203
|
+
if (prompt) {
|
|
204
|
+
args.push(prompt);
|
|
187
205
|
}
|
|
188
206
|
return { command: provider, args };
|
|
189
207
|
}
|
|
190
|
-
export function
|
|
191
|
-
|
|
208
|
+
export function buildProviderCliPrompt(dispatch, prompt, runtimeEnvironment) {
|
|
209
|
+
const executionMode = dispatch.sandbox?.executionMode;
|
|
210
|
+
if (executionMode !== "docker" && executionMode !== "host") {
|
|
211
|
+
return prompt;
|
|
212
|
+
}
|
|
213
|
+
if (executionMode === "host") {
|
|
214
|
+
const concurrency = runtimeEnvironment?.FORGE_HOST_CONCURRENCY === "host_parallel_safe"
|
|
215
|
+
? "- `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."
|
|
216
|
+
: "- `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.";
|
|
217
|
+
const playwright = runtimeEnvironment?.FORGE_PLAYWRIGHT_CONFIG
|
|
218
|
+
? "\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."
|
|
219
|
+
: "";
|
|
220
|
+
return `${prompt.trimEnd()}
|
|
221
|
+
|
|
222
|
+
# Trusted Forge runtime context
|
|
223
|
+
|
|
224
|
+
- Placement: managed host worktree. Host mode prevents ownership collisions but does not provide Docker filesystem, network, credential, or kernel isolation.
|
|
225
|
+
- \`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.
|
|
226
|
+
${concurrency}
|
|
227
|
+
- 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.
|
|
228
|
+
- Prefer \`forge.start_managed_verification\` for Forge .NET tiers or the solution suite so the runner owns cwd, arguments, isolated output, timeout, and supervision. Use \`forge.start_managed_command\` only for other commands expected to run longer than two minutes. Continue independent work, then call \`forge.wait_managed_command\` for its terminal receipt. If it returns \`command_continues=true\`, continue useful work or wait again after \`retry_after_ms\`; do not poll \`forge.get_managed_command\`. Forge keeps live progress in its durable UI receipt; its command timeout terminates and verifies the exact attempt-owned process tree. Do not run those commands through the generic shell tool.
|
|
229
|
+
- 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.
|
|
230
|
+
- 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.
|
|
231
|
+
- 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.
|
|
232
|
+
- Never run broad process or Docker cleanup. Stop only resources you created for this resource lease.${playwright}`;
|
|
233
|
+
}
|
|
234
|
+
return `${prompt.trimEnd()}
|
|
235
|
+
|
|
236
|
+
# Trusted Forge runtime context
|
|
237
|
+
|
|
238
|
+
- Placement: Docker sandbox. You are already running inside the agent container with the repository mounted at \`/workspace\`.
|
|
239
|
+
- \`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.
|
|
240
|
+
- Use the attempt-scoped \`FORGE_TMPDIR\`, \`FORGE_LOG_DIR\`, and \`FORGE_BROWSER_PROFILE_DIR\` paths instead of shared host paths.
|
|
241
|
+
- 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.
|
|
242
|
+
- 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\`.
|
|
243
|
+
- 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.`;
|
|
244
|
+
}
|
|
245
|
+
export function codexSandboxModeForPlatform(platform = process.platform, executionMode) {
|
|
246
|
+
return platform === "win32" || executionMode === "docker" ? "danger-full-access" : "workspace-write";
|
|
192
247
|
}
|
|
193
248
|
export function buildArchitectPrompt(dispatch) {
|
|
194
249
|
return `You are Forge's Architect lane running locally in a prepared git worktree.
|
|
@@ -205,7 +260,7 @@ Forge owns protocol files: write Architect artifacts only through the completion
|
|
|
205
260
|
|
|
206
261
|
${completionPromptForPhase("architect")}
|
|
207
262
|
|
|
208
|
-
Finish only after
|
|
263
|
+
Finish only after forge.complete_architect_plan accepts implementation_plan, qa_plan, status, summary, and report/report_markdown. If the tool rejects the payload, apply its correction in the same plan and resubmit; task ids must be unique and every phase/dependency reference must follow any corrected id.`;
|
|
209
264
|
}
|
|
210
265
|
export function architectDependencyInstruction(dispatch) {
|
|
211
266
|
if (!dispatch.architectDependencies || dispatch.architectDependencies.prerequisites.length === 0) {
|
|
@@ -363,8 +418,13 @@ export function phaseWorkInstruction(phase) {
|
|
|
363
418
|
export function qaBrowserInstruction(dispatch) {
|
|
364
419
|
const qaBrowser = dispatch.qaBrowser;
|
|
365
420
|
const qaScope = dispatch.qaScope;
|
|
421
|
+
const playwrightPolicy = `
|
|
422
|
+
- \`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.
|
|
423
|
+
- 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.
|
|
424
|
+
- 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.
|
|
425
|
+
- 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
426
|
if (!qaBrowser) {
|
|
367
|
-
return
|
|
427
|
+
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
428
|
}
|
|
369
429
|
const scopeAuthority = qaScope
|
|
370
430
|
? qaScope.source === "heuristic"
|
|
@@ -372,17 +432,17 @@ export function qaBrowserInstruction(dispatch) {
|
|
|
372
432
|
: "persisted QA scope"
|
|
373
433
|
: "Forge heuristics";
|
|
374
434
|
const scopeEvidence = qaScope
|
|
375
|
-
? `\n- QA scope required evidence: ${qaScope.required_evidence.length > 0 ? qaScope.required_evidence.join(", ") : "none"}\n- QA scope not applicable: ${qaScope.not_applicable.length > 0 ? qaScope.not_applicable.join(", ") : "none"}${qaScope.rationale ? `\n- QA scope rationale: ${qaScope.rationale}` : ""}`
|
|
435
|
+
? `\n- QA scope required evidence: ${qaScope.required_evidence.length > 0 ? qaScope.required_evidence.join(", ") : "none"}\n- Runner capabilities required: ${(qaScope.required_capabilities ?? []).length > 0 ? qaScope.required_capabilities.join(", ") : "none"}\n- QA scope not applicable: ${qaScope.not_applicable.length > 0 ? qaScope.not_applicable.join(", ") : "none"}${qaScope.rationale ? `\n- QA scope rationale: ${qaScope.rationale}` : ""}`
|
|
376
436
|
: "";
|
|
377
437
|
const launchTarget = qaBrowser.launchTarget;
|
|
378
438
|
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
|
|
439
|
+
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
440
|
}
|
|
381
441
|
if (!launchTarget) {
|
|
382
|
-
return `Browser/app launch context:\n- UI/browser QA is not required by ${scopeAuthority} for this item.\n- If
|
|
442
|
+
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
443
|
}
|
|
384
444
|
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: ${
|
|
445
|
+
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
446
|
}
|
|
387
447
|
export function storyQaInstruction(dispatch) {
|
|
388
448
|
const storyQa = dispatch.storyQa;
|
|
@@ -418,6 +478,8 @@ ${finalQa}
|
|
|
418
478
|
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
479
|
}
|
|
420
480
|
export function buildQaPrompt(dispatch, laneSpec) {
|
|
481
|
+
const sidecarRoot = qaSidecarRoot(dispatch);
|
|
482
|
+
const artifactRoot = sidecarRoot.replace(/\/qa\/?$/i, "");
|
|
421
483
|
return `You are Forge's QA lane running locally in a prepared git worktree.
|
|
422
484
|
|
|
423
485
|
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,24 +504,35 @@ System info / environment notes:
|
|
|
442
504
|
${dispatch.workItem.systemInfo || "Not provided."}
|
|
443
505
|
|
|
444
506
|
${storyQaInstruction(dispatch)}
|
|
445
|
-
Inspect the validated implementation and
|
|
507
|
+
Inspect the validated implementation evidence referenced by the dispatch and the owner-scoped QA artifacts under ${artifactRoot}/ when present.
|
|
446
508
|
${qaBrowserInstruction(dispatch)}
|
|
447
509
|
${qaReworkRetestInstruction(dispatch)}
|
|
448
510
|
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
|
|
511
|
+
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
512
|
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.
|
|
513
|
+
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
514
|
|
|
453
|
-
${completionPromptForQaCycle()}
|
|
515
|
+
${completionPromptForQaCycle("qa_plan", artifactRoot)}
|
|
454
516
|
|
|
455
517
|
Finish with a concise summary only after forge.complete_qa_verdict accepts the QA bundle.`;
|
|
456
518
|
}
|
|
519
|
+
function qaSidecarRoot(dispatch) {
|
|
520
|
+
const configured = dispatch.qaBrowser?.artifactsPath?.trim().replace(/\\/g, "/").replace(/\/+$/, "");
|
|
521
|
+
if (configured) {
|
|
522
|
+
return configured;
|
|
523
|
+
}
|
|
524
|
+
const ownerType = dispatch.cycleRun.ownerType?.trim().toLowerCase();
|
|
525
|
+
const ownerId = dispatch.cycleRun.ownerId?.trim() || dispatch.workItem.id;
|
|
526
|
+
const ownerDirectory = ownerType === "story" ? "stories" : "work-items";
|
|
527
|
+
return `.forge/${ownerDirectory}/${ownerId}/artifacts/qa`;
|
|
528
|
+
}
|
|
457
529
|
export function buildConflictResolvePrompt(dispatch, branchName) {
|
|
458
530
|
const targetBranch = dispatch.cycleRun.requestedBase || dispatch.repo.defaultBranch || "main";
|
|
459
531
|
return `You are Forge's Conflict Resolve lane running locally in a prepared git worktree.
|
|
460
532
|
|
|
461
533
|
The current branch is the pull request branch ${branchName}. Resolve merge conflicts against ${targetBranch}.
|
|
462
|
-
Fetch origin, merge
|
|
534
|
+
Fetch origin, merge ${targetBranch} into ${branchName} with --no-commit, resolve conflicts conservatively, and run relevant validation when practical.
|
|
535
|
+
Leave every repair change uncommitted and unpushed. Forge Bridge owns the sole final commit and compare-and-swap push after validation passes.
|
|
463
536
|
Keep the original work item intent intact:
|
|
464
537
|
- Work item: ${dispatch.workItem.id}
|
|
465
538
|
- Title: ${dispatch.workItem.title}
|
|
@@ -483,16 +556,24 @@ PR context:
|
|
|
483
556
|
- Check state: ${pr?.checkState || "unknown"}
|
|
484
557
|
- Required checks: ${pr?.requiredChecksPassed ?? "?"}/${pr?.requiredChecksTotal ?? "?"}
|
|
485
558
|
|
|
486
|
-
This is not a merge-conflict resolution task. Only fetch
|
|
559
|
+
This is not a merge-conflict resolution task. Only fetch or merge ${targetBranch} with --no-commit if needed to inspect the branch, reproduce the failed check, or handle an explicit stale-branch/conflict blocker. Do not rebase this repair epoch. The primary objective is to repair CI.
|
|
560
|
+
|
|
561
|
+
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 handoff run the failed job's local workflow-equivalent gate, including pre-test guard/drift steps when available.
|
|
562
|
+
|
|
563
|
+
Forge prepared two required inputs before this agent started:
|
|
564
|
+
- Approved spec: .forge/work-items/${dispatch.workItem.id}/spec.md
|
|
565
|
+
- Readiness contract: .forge/work-items/${dispatch.workItem.id}/ci-repair.readiness.json
|
|
566
|
+
|
|
567
|
+
Read both first. The readiness contract supplies attempt-scoped E2E URLs, Playwright/browser readiness, runnable local preflight commands, and provider-only spec patterns. Run every listed local preflight. Do not override the readiness environment or bypass its provider-only exclusions: those specs require infrastructure unavailable inside this managed attempt. Record each applicable provider-only step and the provider check that supplies its proof, and leave provider CI authoritative without weakening its coverage.
|
|
487
568
|
|
|
488
|
-
|
|
569
|
+
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.
|
|
489
570
|
|
|
490
571
|
Keep the original work item intent intact:
|
|
491
572
|
- Work item: ${dispatch.workItem.id}
|
|
492
573
|
- Title: ${dispatch.workItem.title}
|
|
493
574
|
- Acceptance criteria: ${dispatch.workItem.acceptanceCriteria || "Not specified"}
|
|
494
575
|
|
|
495
|
-
Finish with a concise summary of failing checks, changed files, validation commands,
|
|
576
|
+
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
577
|
}
|
|
497
578
|
export function buildPullRequestCommentsPrompt(dispatch, branchName) {
|
|
498
579
|
const pr = dispatch.pullRequest;
|
|
@@ -503,14 +584,16 @@ export function buildPullRequestCommentsPrompt(dispatch, branchName) {
|
|
|
503
584
|
return `You are Forge's Pull Request Comments lane running locally in a prepared git worktree.
|
|
504
585
|
|
|
505
586
|
The current branch is the pull request branch ${branchName}. Address unresolved review comments on ${prLocator}.
|
|
587
|
+
Treat the provider's current unresolved-thread snapshot as one batch: inspect and address every thread that is unresolved when this run begins, not only the first or most recent comment.
|
|
506
588
|
PR context:
|
|
507
589
|
- Provider: ${pr?.provider || "not provided"}
|
|
508
590
|
- Source branch: ${pr?.sourceBranch || branchName}
|
|
509
591
|
- Target branch: ${targetBranch}
|
|
510
592
|
- Unresolved comments: ${pr?.unresolvedThreads ?? "unknown"}
|
|
593
|
+
- Expected pull request head: ${dispatch.cycleRun.repairHeadSha ?? "not provided by this legacy dispatch"}
|
|
511
594
|
|
|
512
|
-
Use the PR URL, local git metadata, and available GitHub tooling/auth to inspect unresolved review threads. Make focused code or test changes that answer the feedback,
|
|
513
|
-
After the push succeeds, Forge will resolve the
|
|
595
|
+
Use the PR URL, local git metadata, and available GitHub tooling/auth to inspect unresolved review threads. Make focused code or test changes that answer the feedback, but leave every repair change uncommitted and unpushed. Forge Bridge owns the sole final commit and compare-and-swap push after validation passes.
|
|
596
|
+
After the Bridge-owned push succeeds, Forge will refresh provider state and resolve this batch only when the unresolved-thread snapshot still exactly matches the batch you started with. Threads added while you work remain unresolved for a later repair cycle.
|
|
514
597
|
If the review thread contents are unavailable, stop with a clear summary of what could not be accessed instead of guessing.
|
|
515
598
|
Keep the original work item intent intact:
|
|
516
599
|
- Work item: ${dispatch.workItem.id}
|
|
@@ -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
|
}
|
|
@@ -34,7 +35,9 @@ export async function emitProviderUsageEvent(emit, dispatch, outputState) {
|
|
|
34
35
|
export function estimatedDeterministicUsage() {
|
|
35
36
|
return addUsage(emptyUsage("estimated"), {
|
|
36
37
|
inputTokens: 1000,
|
|
38
|
+
uncachedInputTokens: 1000,
|
|
37
39
|
outputTokens: 400,
|
|
38
|
-
source: "estimated"
|
|
40
|
+
source: "estimated",
|
|
41
|
+
inputTokenSemantics: "includes_cached_input"
|
|
39
42
|
});
|
|
40
43
|
}
|
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
import { GitClient } from "../../shared/git/git.js";
|
|
2
|
+
import type { WorktreeLifecycleCoordinator } from "../../worktree/worktree.base.js";
|
|
3
|
+
import type { RunnerDispatchEvent } from "../session.types.js";
|
|
2
4
|
import type { ProviderCliService } from "./provider-cli.base.js";
|
|
3
5
|
import type { ProviderCliDraftContext, ProviderCliRunContext, ProviderCliRunResult } from "./provider-cli.types.js";
|
|
4
6
|
import { type ProviderProcessRunner } from "./provider-cli.process.js";
|
|
7
|
+
import { PrePublicationValidator } from "../pre-publication-validation.js";
|
|
5
8
|
export { DeterministicProviderCliService } from "./provider-cli.deterministic.js";
|
|
6
9
|
export { buildProviderCliCommand, codexSandboxModeForPlatform, formatProviderCliCommand, formatProviderCliCommandForCheckpoint } from "./provider-cli.prompts.js";
|
|
7
|
-
export { buildProviderChildEnvironment, chooseWindowsCommandCandidate, StreamingProviderProcessRunner } from "./provider-cli.process.js";
|
|
10
|
+
export { buildProviderChildEnvironment, chooseWindowsCommandCandidate, resolveCodexNpmDirectLaunch, resolvePackageManagerDirectLaunch, resolveWindowsCommandFromPath, PROVIDER_OUTPUT_CAPTURE_LIMIT_CHARS, StreamingProviderProcessRunner } from "./provider-cli.process.js";
|
|
8
11
|
export { buildWindowsLaunchCommand } from "../../shared/process/windows-launch.js";
|
|
9
12
|
export type { ProviderCliCommand, ProviderProcessRunner, ProviderProcessRunRequest, ProviderProcessRunResult } from "./provider-cli.process.js";
|
|
13
|
+
export declare function isProviderNetworkFailure(output: string): boolean;
|
|
14
|
+
export declare class ManagedVerificationProgressEmitter {
|
|
15
|
+
private readonly logDirectory;
|
|
16
|
+
private readonly emit;
|
|
17
|
+
private readonly intervalMs;
|
|
18
|
+
private timer;
|
|
19
|
+
private readonly observedStatuses;
|
|
20
|
+
private readonly completedCommands;
|
|
21
|
+
constructor(logDirectory: string | undefined, emit: (event: RunnerDispatchEvent) => Promise<void>, intervalMs?: number);
|
|
22
|
+
start(): void;
|
|
23
|
+
stop(): Promise<void>;
|
|
24
|
+
private scan;
|
|
25
|
+
private emitTransition;
|
|
26
|
+
}
|
|
10
27
|
export declare class RoutingProviderCliService implements ProviderCliService {
|
|
11
28
|
private readonly realProvider;
|
|
12
29
|
private readonly deterministicProvider;
|
|
@@ -21,7 +38,10 @@ export declare class RoutingProviderCliService implements ProviderCliService {
|
|
|
21
38
|
export declare class ProcessBackedProviderCliService implements ProviderCliService {
|
|
22
39
|
private readonly processRunner;
|
|
23
40
|
private readonly git;
|
|
24
|
-
|
|
41
|
+
private readonly providerToolHeartbeatIntervalMs;
|
|
42
|
+
private readonly publicationCoordinator;
|
|
43
|
+
private readonly prePublicationValidator;
|
|
44
|
+
constructor(processRunner?: ProviderProcessRunner, git?: GitClient, providerToolHeartbeatIntervalMs?: number, publicationCoordinator?: WorktreeLifecycleCoordinator, prePublicationValidator?: PrePublicationValidator);
|
|
25
45
|
runDraft(context: ProviderCliDraftContext): Promise<ProviderCliRunResult>;
|
|
26
46
|
runImplementation(context: ProviderCliRunContext): Promise<ProviderCliRunResult>;
|
|
27
47
|
runArchitect(context: ProviderCliRunContext): Promise<ProviderCliRunResult>;
|