@loucompanion/forge-bridge 0.1.4-dev.63db04bcffca → 0.1.4-dev.724427ea7be8
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 +144 -3
- package/dist/bridge/bridge-chat-provider-command.d.ts +19 -0
- package/dist/bridge/bridge-chat-provider-command.js +132 -0
- package/dist/bridge/bridge-chat.types.d.ts +10 -0
- package/dist/bridge/bridge-chat.types.js +16 -1
- package/dist/bridge/bridge-state-file.d.ts +161 -0
- package/dist/bridge/bridge-state-file.js +376 -0
- package/dist/bridge/bridge-state-io.d.ts +11 -0
- package/dist/bridge/bridge-state-io.js +50 -0
- package/dist/bridge/bridge-state-lock.d.ts +11 -0
- package/dist/bridge/bridge-state-lock.js +102 -0
- package/dist/bridge/bridge-state-unpublished.d.ts +17 -0
- package/dist/bridge/bridge-state-unpublished.js +111 -0
- package/dist/bridge/bridge.base.d.ts +9 -0
- package/dist/bridge/bridge.service.d.ts +101 -15
- package/dist/bridge/bridge.service.js +472 -345
- package/dist/bridge/bridge.types.d.ts +27 -0
- package/dist/bridge/dispatch-result-outbox.d.ts +11 -1
- package/dist/bridge/dispatch-result-outbox.js +31 -6
- package/dist/bridge/in-flight-registry.d.ts +62 -0
- package/dist/bridge/in-flight-registry.js +207 -0
- package/dist/bridge/local-yield-flag.d.ts +6 -0
- package/dist/bridge/local-yield-flag.js +34 -0
- package/dist/bridge/readiness-result-outbox.d.ts +5 -1
- package/dist/bridge/readiness-result-outbox.js +20 -0
- package/dist/bridge/runner-host-capabilities.d.ts +5 -0
- package/dist/bridge/runner-host-capabilities.js +17 -0
- package/dist/bridge/sandbox-resource-accounting.d.ts +16 -0
- package/dist/bridge/sandbox-resource-accounting.js +150 -0
- package/dist/bridge/test-postgres-capability.d.ts +14 -0
- package/dist/bridge/test-postgres-capability.js +120 -0
- package/dist/cleanup/cleanup-wip.d.ts +12 -0
- package/dist/cleanup/cleanup-wip.js +66 -0
- package/dist/cleanup/cleanup.service.d.ts +20 -1
- package/dist/cleanup/cleanup.service.js +150 -169
- package/dist/cleanup/cleanup.types.d.ts +6 -0
- package/dist/cleanup/forge-owned-paths.d.ts +9 -0
- package/dist/cleanup/forge-owned-paths.js +53 -0
- package/dist/cleanup/host-runtime-ledger.d.ts +7 -0
- package/dist/cleanup/host-runtime-ledger.js +130 -0
- package/dist/cleanup/managed-branch-sweep.d.ts +27 -0
- package/dist/cleanup/managed-branch-sweep.js +111 -0
- package/dist/cli/cli.help.js +74 -12
- package/dist/cli/cli.service.d.ts +19 -10
- package/dist/cli/cli.service.js +152 -187
- package/dist/cli/idle-status.d.ts +84 -0
- package/dist/cli/idle-status.js +181 -0
- package/dist/cli/local-config.d.ts +6 -0
- package/dist/cli/local-config.js +32 -4
- package/dist/cli/provider-cli-detection.d.ts +10 -0
- package/dist/cli/provider-cli-detection.js +160 -0
- package/dist/runtime/aspnet-runtime-prebuild.d.ts +20 -0
- package/dist/runtime/aspnet-runtime-prebuild.js +184 -18
- package/dist/runtime/attempt-database-broker.d.ts +1 -1
- package/dist/runtime/attempt-node-runtime-launcher.js +9 -0
- package/dist/runtime/attempt-process-supervisor.d.ts +21 -0
- package/dist/runtime/attempt-process-supervisor.js +62 -6
- package/dist/runtime/docker-engine-probe.d.ts +5 -0
- package/dist/runtime/docker-engine-probe.js +7 -0
- package/dist/runtime/dotnet-build-outputs.d.ts +107 -0
- package/dist/runtime/dotnet-build-outputs.js +402 -0
- package/dist/runtime/ephemeral-test-postgres-grant.d.ts +37 -0
- package/dist/runtime/ephemeral-test-postgres-grant.js +85 -0
- package/dist/runtime/ephemeral-test-postgres.d.ts +57 -0
- package/dist/runtime/ephemeral-test-postgres.js +303 -0
- package/dist/runtime/host-database-capability-boundary.d.ts +1 -1
- package/dist/runtime/host-database-capability-boundary.js +1 -0
- package/dist/runtime/host-facts.d.ts +36 -0
- package/dist/runtime/host-facts.js +95 -0
- package/dist/runtime/host-load-admission.d.ts +67 -0
- package/dist/runtime/host-load-admission.js +99 -0
- package/dist/runtime/host-load-child-environment.d.ts +27 -0
- package/dist/runtime/host-load-child-environment.js +76 -0
- package/dist/runtime/host-load-forge-cgroups.d.ts +49 -0
- package/dist/runtime/host-load-forge-cgroups.js +140 -0
- package/dist/runtime/host-load-governor-config.d.ts +52 -0
- package/dist/runtime/host-load-governor-config.js +83 -0
- package/dist/runtime/host-load-governor.d.ts +186 -0
- package/dist/runtime/host-load-governor.js +632 -0
- package/dist/runtime/host-load-ledger-lock.d.ts +69 -0
- package/dist/runtime/host-load-ledger-lock.js +187 -0
- package/dist/runtime/host-load-runtime-settings.d.ts +25 -0
- package/dist/runtime/host-load-runtime-settings.js +80 -0
- package/dist/runtime/host-load-sampler.d.ts +156 -0
- package/dist/runtime/host-load-sampler.js +298 -0
- package/dist/runtime/host-load-step-class.d.ts +70 -0
- package/dist/runtime/host-load-step-class.js +161 -0
- package/dist/runtime/host-load-step-reaper.d.ts +27 -0
- package/dist/runtime/host-load-step-reaper.js +95 -0
- package/dist/runtime/host-load-step-run.d.ts +73 -0
- package/dist/runtime/host-load-step-run.js +102 -0
- package/dist/runtime/host-load-test-slot.d.ts +43 -0
- package/dist/runtime/host-load-test-slot.js +81 -0
- package/dist/runtime/host-load-token-ledger.d.ts +200 -0
- package/dist/runtime/host-load-token-ledger.js +453 -0
- package/dist/runtime/host-load-windows-cpu.d.ts +34 -0
- package/dist/runtime/host-load-windows-cpu.js +85 -0
- package/dist/runtime/host-pressure-stall.d.ts +61 -0
- package/dist/runtime/host-pressure-stall.js +168 -0
- package/dist/runtime/host-runtime-contract.d.ts +16 -0
- package/dist/runtime/host-runtime-contract.js +35 -2
- package/dist/runtime/host-runtime-lease.d.ts +76 -5
- package/dist/runtime/host-runtime-lease.js +322 -129
- package/dist/runtime/host-runtime-ledger-recovery.d.ts +20 -0
- package/dist/runtime/host-runtime-ledger-recovery.js +134 -0
- package/dist/runtime/host-runtime-promotion.d.ts +23 -0
- package/dist/runtime/host-runtime-promotion.js +48 -0
- package/dist/runtime/host-runtime-requirements-check.d.ts +17 -0
- package/dist/runtime/host-runtime-requirements-check.js +29 -0
- package/dist/runtime/host-runtime-requirements.d.ts +36 -0
- package/dist/runtime/host-runtime-requirements.js +117 -0
- package/dist/runtime/managed-command-teardown.d.ts +62 -0
- package/dist/runtime/managed-command-teardown.js +596 -0
- package/dist/runtime/native-test-postgres-fallback.d.ts +51 -7
- package/dist/runtime/native-test-postgres-fallback.js +60 -8
- package/dist/runtime/playwright-browser-cache.d.ts +39 -0
- package/dist/runtime/playwright-browser-cache.js +227 -0
- package/dist/runtime/playwright-host-runtime-adapter.d.ts +18 -0
- package/dist/runtime/playwright-host-runtime-adapter.js +61 -55
- package/dist/runtime/runner-settings.d.ts +104 -0
- package/dist/runtime/runner-settings.js +236 -0
- package/dist/runtime/supervised-runtime-build-guard.d.ts +45 -0
- package/dist/runtime/supervised-runtime-build-guard.js +112 -0
- package/dist/sandbox/host-capacity-broker.d.ts +115 -0
- package/dist/sandbox/host-capacity-broker.js +336 -0
- package/dist/sandbox/managed-branch.d.ts +13 -0
- package/dist/sandbox/managed-branch.js +90 -0
- package/dist/sandbox/provider-auth/codex.js +11 -11
- package/dist/sandbox/runtime.d.ts +10 -1
- package/dist/sandbox/runtime.js +47 -8
- package/dist/sandbox/sandbox-cgroups.d.ts +14 -0
- package/dist/sandbox/sandbox-cgroups.js +42 -0
- package/dist/session/architect-waits.d.ts +2 -0
- package/dist/session/architect-waits.js +138 -0
- package/dist/session/managed-attempt-tools.d.ts +27 -7
- package/dist/session/managed-attempt-tools.js +406 -123
- package/dist/session/managed-build-coordinator.d.ts +17 -1
- package/dist/session/managed-build-coordinator.js +14 -1
- package/dist/session/managed-build-receipt.d.ts +5 -0
- package/dist/session/managed-build-receipt.js +8 -3
- package/dist/session/managed-command-host-load.d.ts +47 -0
- package/dist/session/managed-command-host-load.js +83 -0
- package/dist/session/mcp-argument-coercion.d.ts +23 -0
- package/dist/session/mcp-argument-coercion.js +121 -0
- package/dist/session/phase-completion.artifacts.d.ts +7 -0
- package/dist/session/phase-completion.artifacts.js +100 -26
- package/dist/session/phase-completion.command-validation.d.ts +7 -0
- package/dist/session/phase-completion.command-validation.js +77 -0
- package/dist/session/phase-completion.d.ts +12 -0
- package/dist/session/phase-completion.helpers.js +13 -12
- package/dist/session/phase-completion.js +5 -0
- package/dist/session/phase-completion.mcp-args.d.ts +9 -0
- package/dist/session/phase-completion.mcp-args.js +156 -0
- package/dist/session/phase-completion.prompts.js +6 -1
- package/dist/session/phase-completion.runtime.d.ts +5 -11
- package/dist/session/phase-completion.runtime.js +111 -230
- package/dist/session/phase-completion.schema-parts.d.ts +19 -0
- package/dist/session/phase-completion.schema-parts.js +188 -0
- package/dist/session/phase-completion.schemas.d.ts +3 -3
- package/dist/session/phase-completion.schemas.js +208 -231
- package/dist/session/phase-completion.validation.d.ts +2 -3
- package/dist/session/phase-completion.validation.js +49 -93
- package/dist/session/pre-publication-host-load.d.ts +27 -0
- package/dist/session/pre-publication-host-load.js +111 -0
- package/dist/session/pre-publication-native-postgres.d.ts +30 -0
- package/dist/session/pre-publication-native-postgres.js +111 -0
- package/dist/session/pre-publication-pass.d.ts +61 -0
- package/dist/session/pre-publication-pass.js +148 -0
- package/dist/session/pre-publication-process.d.ts +23 -0
- package/dist/session/pre-publication-process.js +109 -0
- package/dist/session/pre-publication-skipped-tests.d.ts +21 -0
- package/dist/session/pre-publication-skipped-tests.js +109 -0
- package/dist/session/pre-publication-step-execution.d.ts +12 -0
- package/dist/session/pre-publication-step-execution.js +50 -0
- package/dist/session/pre-publication-validation.d.ts +37 -21
- package/dist/session/pre-publication-validation.js +228 -219
- package/dist/session/provider-cli/claude-background-work.d.ts +67 -0
- package/dist/session/provider-cli/claude-background-work.js +181 -0
- package/dist/session/provider-cli/host-build-lock.d.ts +18 -0
- package/dist/session/provider-cli/host-build-lock.js +30 -0
- package/dist/session/provider-cli/pre-publication-repair.d.ts +56 -0
- package/dist/session/provider-cli/pre-publication-repair.js +276 -0
- package/dist/session/provider-cli/provider-cli.artifacts.d.ts +2 -1
- package/dist/session/provider-cli/provider-cli.artifacts.js +21 -15
- package/dist/session/provider-cli/provider-cli.child-environment.d.ts +7 -0
- package/dist/session/provider-cli/provider-cli.child-environment.js +75 -0
- package/dist/session/provider-cli/provider-cli.codex-models-cache.d.ts +3 -0
- package/dist/session/provider-cli/provider-cli.codex-models-cache.js +37 -0
- package/dist/session/provider-cli/provider-cli.merge-integrity.d.ts +89 -0
- package/dist/session/provider-cli/provider-cli.merge-integrity.js +310 -0
- package/dist/session/provider-cli/provider-cli.process.d.ts +46 -31
- package/dist/session/provider-cli/provider-cli.process.js +286 -403
- package/dist/session/provider-cli/provider-cli.prompts.d.ts +10 -0
- package/dist/session/provider-cli/provider-cli.prompts.js +87 -32
- package/dist/session/provider-cli/provider-cli.runtime.d.ts +8 -0
- package/dist/session/provider-cli/provider-cli.runtime.js +29 -1
- package/dist/session/provider-cli/provider-cli.service.d.ts +7 -1
- package/dist/session/provider-cli/provider-cli.service.js +207 -192
- package/dist/session/provider-cli/provider-cli.types.d.ts +30 -0
- package/dist/session/provider-cli/provider-cli.windows-environment.d.ts +10 -0
- package/dist/session/provider-cli/provider-cli.windows-environment.js +151 -0
- package/dist/session/provider-cli/provider-cli.windows-launch.d.ts +23 -0
- package/dist/session/provider-cli/provider-cli.windows-launch.js +131 -0
- package/dist/session/provider-cli/provider-in-flight-work.d.ts +10 -0
- package/dist/session/provider-cli/provider-in-flight-work.js +92 -0
- package/dist/session/provider-cli/provider-output-pipes.d.ts +30 -0
- package/dist/session/provider-cli/provider-output-pipes.js +67 -0
- package/dist/session/provider-cli/provider-output-state.d.ts +8 -0
- package/dist/session/provider-cli/provider-output-state.js +15 -0
- package/dist/session/provider-cli/provider-user-config-isolation.d.ts +69 -0
- package/dist/session/provider-cli/provider-user-config-isolation.js +164 -0
- package/dist/session/publishable-worktree-changes.d.ts +54 -0
- package/dist/session/publishable-worktree-changes.js +193 -0
- package/dist/session/qa-sidecar-validation.d.ts +6 -0
- package/dist/session/qa-sidecar-validation.js +28 -0
- package/dist/session/sandbox-host-capacity-gate.d.ts +51 -0
- package/dist/session/sandbox-host-capacity-gate.js +257 -0
- package/dist/session/session-redaction.js +31 -181
- package/dist/session/session.base.d.ts +9 -1
- package/dist/session/session.service.d.ts +11 -2
- package/dist/session/session.service.js +189 -69
- package/dist/session/session.types.d.ts +3 -0
- package/dist/session/session.types.js +15 -3
- package/dist/session/sidecar-json-shape.d.ts +31 -0
- package/dist/session/sidecar-json-shape.js +217 -0
- package/dist/session/workspace-runtime-fingerprint.d.ts +32 -0
- package/dist/session/workspace-runtime-fingerprint.js +138 -0
- package/dist/shared/fs/file-identity.d.ts +10 -0
- package/dist/shared/fs/file-identity.js +15 -0
- package/dist/shared/fs/replace-file.d.ts +7 -0
- package/dist/shared/fs/replace-file.js +33 -0
- package/dist/shared/process/host-process-recovery.d.ts +14 -3
- package/dist/shared/process/host-process-recovery.js +23 -3
- package/dist/shared/process/host-process-supervisor.d.ts +14 -1
- package/dist/shared/process/host-process-supervisor.js +67 -15
- package/dist/shared/process/process-tree.d.ts +52 -0
- package/dist/shared/process/process-tree.js +144 -0
- package/dist/shared/process/process.d.ts +67 -0
- package/dist/shared/process/process.js +213 -11
- package/dist/shared/process/windows-app-execution-alias.d.ts +19 -0
- package/dist/shared/process/windows-app-execution-alias.js +45 -0
- package/dist/shared/process/windows-launch.d.ts +18 -0
- package/dist/shared/process/windows-launch.js +68 -0
- package/dist/shared/provider-capabilities.js +14 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worktree/dependency-warmer.d.ts +25 -0
- package/dist/worktree/dependency-warmer.js +46 -10
- package/dist/worktree/orphan-relink.d.ts +19 -0
- package/dist/worktree/orphan-relink.js +106 -0
- package/dist/worktree/wip-git.d.ts +33 -0
- package/dist/worktree/wip-git.js +122 -0
- package/dist/worktree/wip-refs.d.ts +62 -0
- package/dist/worktree/wip-refs.js +119 -0
- package/dist/worktree/wip-restore.d.ts +38 -0
- package/dist/worktree/wip-restore.js +190 -0
- package/dist/worktree/wip-snapshot.d.ts +50 -0
- package/dist/worktree/wip-snapshot.js +268 -0
- package/dist/worktree/worktree-inputs.d.ts +8 -0
- package/dist/worktree/worktree-inputs.js +134 -0
- package/dist/worktree/worktree-origin-sync.d.ts +34 -0
- package/dist/worktree/worktree-origin-sync.js +127 -0
- package/dist/worktree/worktree-wip-events.d.ts +18 -0
- package/dist/worktree/worktree-wip-events.js +98 -0
- package/dist/worktree/worktree-wip.d.ts +50 -0
- package/dist/worktree/worktree-wip.js +185 -0
- package/dist/worktree/worktree.base.d.ts +7 -1
- package/dist/worktree/worktree.service.d.ts +36 -5
- package/dist/worktree/worktree.service.js +124 -155
- package/dist/worktree/worktree.types.d.ts +38 -0
- package/package.json +2 -2
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks the command evidence records (commands, validation, narrow_validation,
|
|
3
|
+
* and similar fields) that a passing completion must report as passing, with
|
|
4
|
+
* the classified non-blocking failure exception for QA regression.
|
|
5
|
+
*/
|
|
6
|
+
import { structuredTypeHint } from "./mcp-argument-coercion.js";
|
|
7
|
+
import { normalizedString, optionalString, requireNonEmptyStringRecord, throwCompletionPayloadIssues } from "./phase-completion.helpers.js";
|
|
8
|
+
export function validateQaGatePassingCommands(commands, options = {}) {
|
|
9
|
+
const label = options.label ?? "commands";
|
|
10
|
+
const context = options.context ?? "QA gate status is pass";
|
|
11
|
+
const issues = [];
|
|
12
|
+
for (const [index, command] of commands.entries()) {
|
|
13
|
+
if (!command || typeof command !== "object" || Array.isArray(command)) {
|
|
14
|
+
issues.push(`${label}[${index}] must be an object${structuredTypeHint(command, "object")}.`);
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
const record = command;
|
|
18
|
+
if (!optionalString(record, "command"))
|
|
19
|
+
issues.push(`${label}[${index}].command is required.`);
|
|
20
|
+
if (!optionalString(record, "status"))
|
|
21
|
+
issues.push(`${label}[${index}].status is required.`);
|
|
22
|
+
if (!optionalString(record, "summary"))
|
|
23
|
+
issues.push(`${label}[${index}].summary is required.`);
|
|
24
|
+
if (typeof record.exit_code !== "number" || !Number.isFinite(record.exit_code)) {
|
|
25
|
+
issues.push(`${label}[${index}].exit_code is required.`);
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const passed = record.exit_code === 0 && normalizedString(record.status) === "pass";
|
|
29
|
+
if (!passed
|
|
30
|
+
&& options.allowClassifiedNonBlockingFailures
|
|
31
|
+
&& optionalString(record, "classification")) {
|
|
32
|
+
try {
|
|
33
|
+
validateClassifiedNonBlockingQaFailure(record, index, label);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
issues.push(error instanceof Error ? error.message : String(error));
|
|
37
|
+
}
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (record.exit_code !== 0) {
|
|
41
|
+
issues.push(`${label}[${index}].exit_code must be 0 when ${context}.`);
|
|
42
|
+
}
|
|
43
|
+
if (normalizedString(record.status) !== "pass") {
|
|
44
|
+
issues.push(`${label}[${index}].status must be pass when ${context}.`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
throwCompletionPayloadIssues(issues);
|
|
48
|
+
}
|
|
49
|
+
function validateClassifiedNonBlockingQaFailure(record, index, label) {
|
|
50
|
+
const prefix = `${label}[${index}]`;
|
|
51
|
+
const classification = normalizedString(optionalString(record, "classification"));
|
|
52
|
+
if (classification !== "out_of_scope_failure" && classification !== "baseline_failure") {
|
|
53
|
+
throw new Error(`${prefix}.classification must be out_of_scope_failure or baseline_failure: a non-passing command in a QA regression pass needs a classification with corroborating evidence.`);
|
|
54
|
+
}
|
|
55
|
+
const classified = `for a non-blocking ${classification} (also required: candidate_bug_id, scope_evidence, acceptance_criteria_independent: true, and ${classification === "out_of_scope_failure" ? "repro_command with a non-zero repro_exit_code" : "baseline_ref, a non-zero baseline_exit_code, and failure_signature_match: true"})`;
|
|
56
|
+
if (!optionalString(record, "candidate_bug_id"))
|
|
57
|
+
throw new Error(`${prefix}.candidate_bug_id is required ${classified}.`);
|
|
58
|
+
if (!optionalString(record, "scope_evidence"))
|
|
59
|
+
throw new Error(`${prefix}.scope_evidence is required ${classified}.`);
|
|
60
|
+
if (record.acceptance_criteria_independent !== true) {
|
|
61
|
+
throw new Error(`${prefix}.acceptance_criteria_independent must be true for a non-blocking QA regression failure.`);
|
|
62
|
+
}
|
|
63
|
+
if (classification === "out_of_scope_failure") {
|
|
64
|
+
requireNonEmptyStringRecord(record, "repro_command", `${prefix}.`);
|
|
65
|
+
if (typeof record.repro_exit_code !== "number" || !Number.isFinite(record.repro_exit_code) || record.repro_exit_code === 0) {
|
|
66
|
+
throw new Error(`${prefix}.repro_exit_code must be a non-zero number for an out-of-scope failure.`);
|
|
67
|
+
}
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
requireNonEmptyStringRecord(record, "baseline_ref", `${prefix}.`);
|
|
71
|
+
if (typeof record.baseline_exit_code !== "number" || !Number.isFinite(record.baseline_exit_code) || record.baseline_exit_code === 0) {
|
|
72
|
+
throw new Error(`${prefix}.baseline_exit_code must be a non-zero number for a baseline failure.`);
|
|
73
|
+
}
|
|
74
|
+
if (record.failure_signature_match !== true) {
|
|
75
|
+
throw new Error(`${prefix}.failure_signature_match must be true for a baseline failure.`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -4,6 +4,7 @@ export { isDebugCompletionPhase } from "./phase-completion.validation.js";
|
|
|
4
4
|
export { readCompletionArtifact, writeCompletionArtifact } from "./phase-completion.artifacts.js";
|
|
5
5
|
export * from "./phase-completion.prompts.js";
|
|
6
6
|
export * from "./phase-completion.runtime.js";
|
|
7
|
+
export * from "./phase-completion.mcp-args.js";
|
|
7
8
|
export type DevelopCompletionPhase = "implementation" | "self_review" | "validation";
|
|
8
9
|
export type DebugCompletionPhase = "debug_repro" | "debug_root_cause" | "debug_fix" | "debug_regression";
|
|
9
10
|
export type ArchitectCompletionPhase = "architect";
|
|
@@ -29,6 +30,14 @@ export interface CompletionToolRuntimeOptions {
|
|
|
29
30
|
readonly worktree: WorktreeHandle;
|
|
30
31
|
readonly phase?: CompletionPhase;
|
|
31
32
|
readonly runtimeEnvironment?: Readonly<Record<string, string>>;
|
|
33
|
+
/** Host load governor variables; only the MCP server receives them. */
|
|
34
|
+
readonly hostLoadEnvironment?: Readonly<Record<string, string>>;
|
|
35
|
+
/**
|
|
36
|
+
* Serve only the managed-attempt tools (managed commands, verification, waits), never a
|
|
37
|
+
* completion tool. A pre-publication repair turn uses this: its phase's completion artifacts are
|
|
38
|
+
* already recorded and validated, and the repair prompt forbids rewriting them.
|
|
39
|
+
*/
|
|
40
|
+
readonly managedToolsOnly?: boolean;
|
|
32
41
|
}
|
|
33
42
|
export interface CompletionToolServerConfig {
|
|
34
43
|
readonly worktreePath: string;
|
|
@@ -44,6 +53,7 @@ export interface CompletionToolServerConfig {
|
|
|
44
53
|
readonly architectCycle?: boolean;
|
|
45
54
|
readonly draftCycle?: boolean;
|
|
46
55
|
readonly decomposeCycle?: boolean;
|
|
56
|
+
readonly managedToolsOnly?: boolean;
|
|
47
57
|
}
|
|
48
58
|
export interface CompletionToolCallResult {
|
|
49
59
|
readonly content: readonly {
|
|
@@ -94,6 +104,8 @@ export declare const debugCompletionPhaseOrder: readonly DebugCompletionPhase[];
|
|
|
94
104
|
export declare const qaCompletionGateOrder: readonly QaCompletionGate[];
|
|
95
105
|
export declare const draftCompletionGateOrder: readonly DraftCompletionGate[];
|
|
96
106
|
export declare const decomposeCompletionGateOrder: readonly DecomposeCompletionGate[];
|
|
107
|
+
export declare const draftStatuses: readonly ["pass", "needs_revision", "needs_rework", "blocked"];
|
|
108
|
+
export declare const decomposeStatuses: readonly ["pass", "needs_rework", "fail", "failed", "needs_revision", "blocked"];
|
|
97
109
|
export declare const decomposeGateFileNames: Record<DecomposeCompletionGate, string>;
|
|
98
110
|
export declare const decomposeGateToolNames: Record<DecomposeCompletionGate, string>;
|
|
99
111
|
export declare const draftGateFileNames: Record<DraftCompletionGate, string>;
|
|
@@ -3,6 +3,7 @@ import fs from "node:fs/promises";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { debugCompletionPhaseOrder, debugGateToolNames, decomposeCompletionGateOrder, decomposeGateToolNames, draftCompletionGateOrder, draftGateToolNames, qaCompletionGateOrder, qaGateToolNames, resolvedFindingStatuses } from "./phase-completion.js";
|
|
6
|
+
import { structuredTypeHint } from "./mcp-argument-coercion.js";
|
|
6
7
|
export function normalizeArtifactPayload(payload, defaults) {
|
|
7
8
|
const normalized = stripUndefined({ ...payload });
|
|
8
9
|
delete normalized.report_markdown;
|
|
@@ -310,7 +311,7 @@ export function throwCompletionPayloadIssues(issues) {
|
|
|
310
311
|
}
|
|
311
312
|
export function requireArray(payload, key) {
|
|
312
313
|
if (!Array.isArray(payload[key])) {
|
|
313
|
-
throw new Error(`${key} must be an array.`);
|
|
314
|
+
throw new Error(`${key} must be an array${structuredTypeHint(payload[key], "array")}.`);
|
|
314
315
|
}
|
|
315
316
|
}
|
|
316
317
|
export function requireNonEmptyArray(payload, key) {
|
|
@@ -332,7 +333,7 @@ export function requireAllowedStatus(payload, key, allowed) {
|
|
|
332
333
|
export function requireObject(payload, key) {
|
|
333
334
|
const value = payload[key];
|
|
334
335
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
335
|
-
throw new Error(`${key} must be an object.`);
|
|
336
|
+
throw new Error(`${key} must be an object${structuredTypeHint(value, "object")}.`);
|
|
336
337
|
}
|
|
337
338
|
}
|
|
338
339
|
export function requiredRecord(payload, key) {
|
|
@@ -372,12 +373,12 @@ export function validateResolvedFindings(payload) {
|
|
|
372
373
|
return;
|
|
373
374
|
}
|
|
374
375
|
if (!Array.isArray(resolvedFindings)) {
|
|
375
|
-
throw new Error(
|
|
376
|
+
throw new Error(`resolved_findings must be an array${structuredTypeHint(resolvedFindings, "array")}.`);
|
|
376
377
|
}
|
|
377
378
|
for (const [index, finding] of resolvedFindings.entries()) {
|
|
378
379
|
const prefix = `resolved_findings[${index}].`;
|
|
379
380
|
if (!finding || typeof finding !== "object" || Array.isArray(finding)) {
|
|
380
|
-
throw new Error(`resolved_findings[${index}] must be an object.`);
|
|
381
|
+
throw new Error(`resolved_findings[${index}] must be an object${structuredTypeHint(finding, "object")}.`);
|
|
381
382
|
}
|
|
382
383
|
const record = finding;
|
|
383
384
|
requireNonEmptyStringRecord(record, "qa_id", prefix);
|
|
@@ -409,14 +410,14 @@ export function qaArray(payload, key, fallback = {}) {
|
|
|
409
410
|
return [];
|
|
410
411
|
}
|
|
411
412
|
if (!Array.isArray(value)) {
|
|
412
|
-
throw new Error(`${key} must be an array.`);
|
|
413
|
+
throw new Error(`${key} must be an array${structuredTypeHint(value, "array")}.`);
|
|
413
414
|
}
|
|
414
415
|
return value;
|
|
415
416
|
}
|
|
416
417
|
export function qaObjectArray(payload, key) {
|
|
417
418
|
return qaArray(payload, key).map((entry, index) => {
|
|
418
419
|
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
419
|
-
throw new Error(`${key}[${index}] must be an object.`);
|
|
420
|
+
throw new Error(`${key}[${index}] must be an object${structuredTypeHint(entry, "object")}.`);
|
|
420
421
|
}
|
|
421
422
|
return entry;
|
|
422
423
|
});
|
|
@@ -424,7 +425,7 @@ export function qaObjectArray(payload, key) {
|
|
|
424
425
|
export function qaPolicyWarnings(payload) {
|
|
425
426
|
return qaArray(payload, "policy_warnings").map((entry, index) => {
|
|
426
427
|
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
427
|
-
throw new Error(`policy_warnings[${index}] must be an object.`);
|
|
428
|
+
throw new Error(`policy_warnings[${index}] must be an object${structuredTypeHint(entry, "object")}.`);
|
|
428
429
|
}
|
|
429
430
|
const warning = entry;
|
|
430
431
|
const prefix = `policy_warnings[${index}].`;
|
|
@@ -448,7 +449,7 @@ export function qaStringArray(payload, key) {
|
|
|
448
449
|
return [];
|
|
449
450
|
}
|
|
450
451
|
if (!Array.isArray(value)) {
|
|
451
|
-
throw new Error(`${key} must be an array.`);
|
|
452
|
+
throw new Error(`${key} must be an array${structuredTypeHint(value, "array")}.`);
|
|
452
453
|
}
|
|
453
454
|
return value.map((entry, index) => {
|
|
454
455
|
if (typeof entry !== "string" || entry.trim().length === 0) {
|
|
@@ -459,7 +460,7 @@ export function qaStringArray(payload, key) {
|
|
|
459
460
|
}
|
|
460
461
|
export function requireEvidenceRecord(value, label) {
|
|
461
462
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
462
|
-
throw new Error(`${label} must be an object.`);
|
|
463
|
+
throw new Error(`${label} must be an object${structuredTypeHint(value, "object")}.`);
|
|
463
464
|
}
|
|
464
465
|
}
|
|
465
466
|
export function requireNonEmptyStringRecord(source, key, prefix = "") {
|
|
@@ -469,7 +470,7 @@ export function requireNonEmptyStringRecord(source, key, prefix = "") {
|
|
|
469
470
|
}
|
|
470
471
|
export function requireArrayRecord(source, key, prefix = "") {
|
|
471
472
|
if (!Array.isArray(source[key])) {
|
|
472
|
-
throw new Error(`${prefix}${key} must be an array.`);
|
|
473
|
+
throw new Error(`${prefix}${key} must be an array${structuredTypeHint(source[key], "array")}.`);
|
|
473
474
|
}
|
|
474
475
|
}
|
|
475
476
|
export function requireKnownStringRecord(source, key, allowed, prefix = "") {
|
|
@@ -497,7 +498,7 @@ export function requireSubstantiveValueRecord(source, key, prefix = "") {
|
|
|
497
498
|
export function requireSubstantiveEvidenceRecord(source, prefix = "") {
|
|
498
499
|
const evidence = source.evidence;
|
|
499
500
|
if (!evidence || typeof evidence !== "object" || Array.isArray(evidence)) {
|
|
500
|
-
throw new Error(`${prefix}evidence must be an object.`);
|
|
501
|
+
throw new Error(`${prefix}evidence must be an object${structuredTypeHint(evidence, "object")}, for example {"summary": "...", "screenshot": "..."}.`);
|
|
501
502
|
}
|
|
502
503
|
if (!Object.values(evidence).some(hasSubstantiveJsonValue)) {
|
|
503
504
|
throw new Error(`${prefix}evidence must include at least one concrete evidence reference or summary.`);
|
|
@@ -587,7 +588,7 @@ export function parseOptionalJsonObject(content, label) {
|
|
|
587
588
|
}
|
|
588
589
|
export function asRecord(value, label) {
|
|
589
590
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
590
|
-
throw new Error(`${label} must be an object.`);
|
|
591
|
+
throw new Error(`${label} must be an object${structuredTypeHint(value, "object")}.`);
|
|
591
592
|
}
|
|
592
593
|
return value;
|
|
593
594
|
}
|
|
@@ -4,6 +4,7 @@ export { isDebugCompletionPhase } from "./phase-completion.validation.js";
|
|
|
4
4
|
export { readCompletionArtifact, writeCompletionArtifact } from "./phase-completion.artifacts.js";
|
|
5
5
|
export * from "./phase-completion.prompts.js";
|
|
6
6
|
export * from "./phase-completion.runtime.js";
|
|
7
|
+
export * from "./phase-completion.mcp-args.js";
|
|
7
8
|
export const toolServerName = "forge";
|
|
8
9
|
export const completionRedactionSecretsEnv = "FORGE_COMPLETION_REDACTION_SECRETS";
|
|
9
10
|
export const completionPhaseOrder = ["implementation", "self_review", "validation"];
|
|
@@ -40,6 +41,10 @@ export const decomposeCompletionGateOrder = [
|
|
|
40
41
|
"decompose_critic",
|
|
41
42
|
"decompose_proposal"
|
|
42
43
|
];
|
|
44
|
+
// Statuses the Draft and Decompose gate tools advertise and accept. Decompose adds fail/failed;
|
|
45
|
+
// every status except pass records rework, never a pass.
|
|
46
|
+
export const draftStatuses = ["pass", "needs_revision", "needs_rework", "blocked"];
|
|
47
|
+
export const decomposeStatuses = ["pass", "needs_rework", "fail", "failed", "needs_revision", "blocked"];
|
|
43
48
|
export const decomposeGateFileNames = {
|
|
44
49
|
decompose_subject_intake: "decompose.subject-intake.json",
|
|
45
50
|
decompose_context_review: "decompose.context-review.json",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CompletionToolServerConfig } from "./phase-completion.js";
|
|
2
|
+
export declare function buildCompletionToolServerArgs(config: CompletionToolServerConfig): readonly string[];
|
|
3
|
+
export declare function parseCompletionMcpArgs(argv: readonly string[]): {
|
|
4
|
+
readonly ok: true;
|
|
5
|
+
readonly config: CompletionToolServerConfig;
|
|
6
|
+
} | {
|
|
7
|
+
readonly ok: false;
|
|
8
|
+
readonly error: string;
|
|
9
|
+
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { attemptDatabaseCapabilityEnvironment, attemptDatabaseCapabilitySecrets, } from "../runtime/attempt-database-broker.js";
|
|
3
|
+
import { completionRedactionSecretsEnv, } from "./phase-completion.js";
|
|
4
|
+
import { isDebugCompletionPhase, isDevelopCompletionPhase, normalizedOwnerType, parseCompletionRedactionSecrets, parseStrictCompletionPhase, } from "./phase-completion.validation.js";
|
|
5
|
+
// The `forge-bridge mcp` command line: the arguments the Bridge launches its completion-tool server
|
|
6
|
+
// with, and the parsing that server applies to them.
|
|
7
|
+
export function buildCompletionToolServerArgs(config) {
|
|
8
|
+
const args = [
|
|
9
|
+
"mcp",
|
|
10
|
+
"--worktree",
|
|
11
|
+
path.resolve(config.worktreePath),
|
|
12
|
+
"--work-item-id",
|
|
13
|
+
config.workItemId,
|
|
14
|
+
"--phase",
|
|
15
|
+
config.phase,
|
|
16
|
+
"--produced-by",
|
|
17
|
+
config.producedBy ?? "forge-completion-tool"
|
|
18
|
+
];
|
|
19
|
+
if (config.ownerType || config.ownerId) {
|
|
20
|
+
args.push("--owner-type", normalizedOwnerType(config.ownerType) ?? "work_item");
|
|
21
|
+
args.push("--owner-id", config.ownerId ?? config.workItemId);
|
|
22
|
+
}
|
|
23
|
+
if (config.developCycle) {
|
|
24
|
+
args.push("--develop-cycle");
|
|
25
|
+
}
|
|
26
|
+
if (config.qaCycle) {
|
|
27
|
+
args.push("--qa-cycle");
|
|
28
|
+
}
|
|
29
|
+
if (config.debugCycle) {
|
|
30
|
+
args.push("--debug-cycle");
|
|
31
|
+
}
|
|
32
|
+
if (config.architectCycle) {
|
|
33
|
+
args.push("--architect-cycle");
|
|
34
|
+
}
|
|
35
|
+
if (config.draftCycle) {
|
|
36
|
+
args.push("--draft-cycle");
|
|
37
|
+
}
|
|
38
|
+
if (config.decomposeCycle) {
|
|
39
|
+
args.push("--decompose-cycle");
|
|
40
|
+
}
|
|
41
|
+
if (config.managedToolsOnly) {
|
|
42
|
+
args.push("--managed-tools-only");
|
|
43
|
+
}
|
|
44
|
+
return args;
|
|
45
|
+
}
|
|
46
|
+
const completionMcpFlags = {
|
|
47
|
+
"--develop-cycle": "developCycle",
|
|
48
|
+
"--qa-cycle": "qaCycle",
|
|
49
|
+
"--debug-cycle": "debugCycle",
|
|
50
|
+
"--architect-cycle": "architectCycle",
|
|
51
|
+
"--draft-cycle": "draftCycle",
|
|
52
|
+
"--decompose-cycle": "decomposeCycle",
|
|
53
|
+
"--managed-tools-only": "managedToolsOnly",
|
|
54
|
+
};
|
|
55
|
+
const completionMcpValues = {
|
|
56
|
+
"--worktree": "worktreePath",
|
|
57
|
+
"--work-item-id": "workItemId",
|
|
58
|
+
"--owner-id": "ownerId",
|
|
59
|
+
"--produced-by": "producedBy",
|
|
60
|
+
};
|
|
61
|
+
export function parseCompletionMcpArgs(argv) {
|
|
62
|
+
let phase = "implementation";
|
|
63
|
+
let ownerType;
|
|
64
|
+
const values = {};
|
|
65
|
+
const flags = {
|
|
66
|
+
developCycle: false,
|
|
67
|
+
qaCycle: false,
|
|
68
|
+
debugCycle: false,
|
|
69
|
+
architectCycle: false,
|
|
70
|
+
draftCycle: false,
|
|
71
|
+
decomposeCycle: false,
|
|
72
|
+
managedToolsOnly: false,
|
|
73
|
+
};
|
|
74
|
+
for (let index = 1; index < argv.length; index += 1) {
|
|
75
|
+
const arg = argv[index];
|
|
76
|
+
if (Object.hasOwn(completionMcpFlags, arg)) {
|
|
77
|
+
flags[completionMcpFlags[arg]] = true;
|
|
78
|
+
}
|
|
79
|
+
else if (Object.hasOwn(completionMcpValues, arg)) {
|
|
80
|
+
values[completionMcpValues[arg]] = argv[++index];
|
|
81
|
+
}
|
|
82
|
+
else if (arg === "--owner-type") {
|
|
83
|
+
ownerType = normalizedOwnerType(argv[++index]);
|
|
84
|
+
if (!ownerType) {
|
|
85
|
+
return { ok: false, error: "mcp --owner-type must be work_item or story." };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else if (arg === "--phase") {
|
|
89
|
+
const rawPhase = argv[++index];
|
|
90
|
+
const parsedPhase = parseStrictCompletionPhase(rawPhase);
|
|
91
|
+
if (!parsedPhase) {
|
|
92
|
+
return { ok: false, error: "mcp --phase must be one of: implementation, self-review, validation, qa, architect, draft, decompose, ci-repair, comment-repair, debug-repro, debug-root-cause, debug-fix, debug-regression." };
|
|
93
|
+
}
|
|
94
|
+
phase = parsedPhase;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
return { ok: false, error: `Unknown mcp argument: ${arg}` };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const { worktreePath, workItemId, ownerId, producedBy } = values;
|
|
101
|
+
if (!worktreePath?.trim() || !workItemId?.trim()) {
|
|
102
|
+
return { ok: false, error: "mcp requires --worktree and --work-item-id." };
|
|
103
|
+
}
|
|
104
|
+
const { managedToolsOnly, ...cycles } = flags;
|
|
105
|
+
const config = {
|
|
106
|
+
worktreePath: path.resolve(worktreePath),
|
|
107
|
+
workItemId,
|
|
108
|
+
ownerType,
|
|
109
|
+
ownerId,
|
|
110
|
+
phase,
|
|
111
|
+
producedBy,
|
|
112
|
+
redactionSecrets: redactionSecretsFromEnvironment(),
|
|
113
|
+
...cycles,
|
|
114
|
+
...(managedToolsOnly ? { managedToolsOnly } : {})
|
|
115
|
+
};
|
|
116
|
+
const modeError = completionMcpModeError(config);
|
|
117
|
+
return modeError ? { ok: false, error: modeError } : { ok: true, config };
|
|
118
|
+
}
|
|
119
|
+
/** The secrets the server redacts from what it records: the Bridge's list and the attempt database capability. */
|
|
120
|
+
function redactionSecretsFromEnvironment() {
|
|
121
|
+
return [
|
|
122
|
+
...parseCompletionRedactionSecrets(process.env[completionRedactionSecretsEnv]),
|
|
123
|
+
...attemptDatabaseCapabilitySecrets(process.env[attemptDatabaseCapabilityEnvironment]),
|
|
124
|
+
];
|
|
125
|
+
}
|
|
126
|
+
/** Why the parsed cycle mode, phase and tool scope cannot run together, or null when they can. */
|
|
127
|
+
function completionMcpModeError(config) {
|
|
128
|
+
const { phase } = config;
|
|
129
|
+
const cycleModes = [config.developCycle, config.qaCycle, config.debugCycle, config.architectCycle, config.draftCycle, config.decomposeCycle]
|
|
130
|
+
.filter(Boolean).length;
|
|
131
|
+
if (cycleModes > 1) {
|
|
132
|
+
return "mcp accepts only one cycle mode.";
|
|
133
|
+
}
|
|
134
|
+
if (config.managedToolsOnly && cycleModes > 0) {
|
|
135
|
+
return "mcp --managed-tools-only serves no completion tools, so it accepts no cycle mode.";
|
|
136
|
+
}
|
|
137
|
+
if (config.developCycle && !isDevelopCompletionPhase(phase)) {
|
|
138
|
+
return "mcp --develop-cycle requires --phase implementation, self-review, or validation.";
|
|
139
|
+
}
|
|
140
|
+
if (config.qaCycle && phase !== "qa") {
|
|
141
|
+
return "mcp --qa-cycle requires --phase qa.";
|
|
142
|
+
}
|
|
143
|
+
if (config.debugCycle && !isDebugCompletionPhase(phase)) {
|
|
144
|
+
return "mcp --debug-cycle requires --phase debug-repro, debug-root-cause, debug-fix, or debug-regression.";
|
|
145
|
+
}
|
|
146
|
+
if (config.architectCycle && phase !== "architect") {
|
|
147
|
+
return "mcp --architect-cycle requires --phase architect.";
|
|
148
|
+
}
|
|
149
|
+
if (config.draftCycle && phase !== "draft") {
|
|
150
|
+
return "mcp --draft-cycle requires --phase draft.";
|
|
151
|
+
}
|
|
152
|
+
if (config.decomposeCycle && phase !== "decompose") {
|
|
153
|
+
return "mcp --decompose-cycle requires --phase decompose.";
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
@@ -76,6 +76,7 @@ Complete the Draft cycle in order inside this same provider session:
|
|
|
76
76
|
5. Follow the returned draft-plan instruction, draft the requested final JSON shape for the current Draft kind, then call \`forge.complete_draft_work_order_plan(...)\`.
|
|
77
77
|
6. Follow the returned critic instruction, critique literalism, wrong-project scope, and decomposition quality, then call \`forge.complete_draft_critic(...)\`.
|
|
78
78
|
7. Follow the returned proposal instruction, then call \`forge.complete_draft_proposal(...)\` with the final Draft JSON payload in \`draft_json\`.
|
|
79
|
+
Every gate before the proposal needs a \`summary\` of what it checked or decided.
|
|
79
80
|
The final proposal tool writes \`draft.proposal.json\` under \`.forge/work-items/{workItemId}/artifacts/\`. Reporting Draft completion in prose is not enough.`;
|
|
80
81
|
}
|
|
81
82
|
export function completionPromptForDecomposeCycle(currentGate = "decompose_subject_intake") {
|
|
@@ -92,6 +93,7 @@ Required order:
|
|
|
92
93
|
5. Follow the returned dependency-graph instruction, validate keys/dependencies/order, then call \`forge.complete_decompose_dependency_graph(...)\`.
|
|
93
94
|
6. Follow the returned critic instruction, critique scope, DAG safety, manual reconciliation risk, and missing acceptance detail, then call \`forge.complete_decompose_critic(...)\`.
|
|
94
95
|
7. Follow the returned proposal instruction, then call \`forge.complete_decompose_proposal(...)\` with final JSON in \`proposal_json\`.
|
|
96
|
+
Every gate before the proposal needs a \`summary\` of what it checked or decided.
|
|
95
97
|
The final proposal tool writes \`decompose.proposal.json\` under \`.forge/work-items/{workItemId}/artifacts/\`. The proposal_json object must contain summary, optional blockedReason, and candidates. Work Order-to-Feature candidates may include \`estimated_qa_scope\`; Feature-to-Story candidates should include \`qa_scope\` with schema_version 1 plus scheduleIndex, waveIndex, expectedOutput, handoffSummary, and dependencyReason for dependency handoff. Set \`qa_scope.required_capabilities\` to \`["docker_engine"]\` when implementation or validation starts containers or needs a Docker daemon; repository-specific service and image versions do not belong in the runner capability name.`;
|
|
96
98
|
}
|
|
97
99
|
export function completionPromptForDebugCycle(currentGate = "debug_repro") {
|
|
@@ -144,6 +146,9 @@ export function completionToolNextInstructionForDraftGate(completedGate, status,
|
|
|
144
146
|
if (status === "blocked") {
|
|
145
147
|
return `Stay in ${completedGate}; record the blocker and retry the same Draft gate when unblocked.`;
|
|
146
148
|
}
|
|
149
|
+
if (status !== "pass") {
|
|
150
|
+
return `Stay in ${completedGate}; revise the work and call the same Draft gate again with status pass when it is complete.`;
|
|
151
|
+
}
|
|
147
152
|
if (!nextGate) {
|
|
148
153
|
return "Draft proposal accepted. Forge has the structured Work Order draft JSON needed to populate the form.";
|
|
149
154
|
}
|
|
@@ -216,7 +221,7 @@ export function completionToolNextInstructionForDebugGate(completedGate, status,
|
|
|
216
221
|
function qaGateInstruction(gate) {
|
|
217
222
|
switch (gate) {
|
|
218
223
|
case "qa_regression":
|
|
219
|
-
return "Run or explicitly skip applicable regression/build/lint/typecheck/e2e checks, then call forge.complete_qa_regression. For normal Story QA, prefer focused checks and runner-authored forge.start_managed_verification tier profiles; reserve dotnet_solution for shared infrastructure, Feature/PR integration, or an explicit plan requirement. Use forge.start_managed_command only for other commands expected to exceed two minutes, continue independent QA, then call forge.wait_managed_command and include its terminal managed_command_id in command evidence. If the wait returns command_continues=true, continue useful work or wait again after retry_after_ms; do not poll get_managed_command. Normalize negative assertions so an expected no-match exits 0. A reproduced failure outside the current diff and acceptance criteria may remain non-blocking only when the current item has independent passing evidence: preserve it as an out_of_scope_failure with candidate_bug_id, scope_evidence, acceptance_criteria_independent: true, and a failing focused repro command/exit code. Never classify an unexplained, in-scope, or infrastructure failure this way.";
|
|
224
|
+
return "Run or explicitly skip applicable regression/build/lint/typecheck/e2e checks, then call forge.complete_qa_regression. For normal Story QA, prefer focused checks and runner-authored forge.start_managed_verification .NET tier profiles (run_all_shards needs shard_count of at least 2 and no no_build); run Playwright e2e through forge.start_managed_command with the attempt's FORGE_PLAYWRIGHT_CONFIG and the spec files you need; reserve dotnet_solution for shared infrastructure, Feature/PR integration, or an explicit plan requirement. Use forge.start_managed_command only for other commands expected to exceed two minutes, continue independent QA, then call forge.wait_managed_command and include its terminal managed_command_id in command evidence. If the wait returns command_continues=true, continue useful work or wait again after retry_after_ms; do not poll get_managed_command. Normalize negative assertions so an expected no-match exits 0. A reproduced failure outside the current diff and acceptance criteria may remain non-blocking only when the current item has independent passing evidence: preserve it as an out_of_scope_failure with candidate_bug_id, scope_evidence, acceptance_criteria_independent: true, and a failing focused repro command/exit code. Never classify an unexplained, in-scope, or infrastructure failure this way.";
|
|
220
225
|
case "qa_api":
|
|
221
226
|
return "Run or explicitly skip applicable API/backend contract checks, then call forge.complete_qa_api.";
|
|
222
227
|
case "qa_manual_web":
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type CompletionToolCallResult, type CompletionToolRuntime, type CompletionToolRuntimeOptions, type CompletionToolServerConfig } from "./phase-completion.js";
|
|
2
2
|
import { type ManagedAttemptToolResult } from "./managed-attempt-tools.js";
|
|
3
3
|
export declare function prepareCompletionToolRuntime(options: CompletionToolRuntimeOptions): Promise<CompletionToolRuntime>;
|
|
4
|
-
export declare function buildCompletionToolServerArgs(config: CompletionToolServerConfig): readonly string[];
|
|
5
4
|
export declare function codexMcpConfigArgs(runtime: CompletionToolRuntime): readonly string[];
|
|
6
5
|
export declare function cursorMcpServerConfig(runtime: CompletionToolRuntime): unknown;
|
|
7
6
|
export declare function claudeMcpServerConfig(runtime: CompletionToolRuntime): unknown;
|
|
@@ -17,7 +16,7 @@ export declare class CompletionToolServerSession {
|
|
|
17
16
|
constructor(config: CompletionToolServerConfig);
|
|
18
17
|
get instructions(): string;
|
|
19
18
|
toolDefinitions(): readonly unknown[];
|
|
20
|
-
callTool(toolName: string,
|
|
19
|
+
callTool(toolName: string, rawInput: unknown): Promise<CompletionToolCallResult | ManagedAttemptToolResult>;
|
|
21
20
|
private callDecomposeGateTool;
|
|
22
21
|
private callDraftGateTool;
|
|
23
22
|
private callDebugGateTool;
|
|
@@ -28,7 +27,7 @@ export declare class CompletionToolServerSession {
|
|
|
28
27
|
private advanceAfterQaGate;
|
|
29
28
|
private advanceAfterDebugGate;
|
|
30
29
|
}
|
|
31
|
-
export declare function completionToolRuntimeEnvironment(runtimeEnvironment?: Readonly<Record<string, string>>, nativeTestPostgresFallbackPath?: string | null): Readonly<Record<string, string>>;
|
|
30
|
+
export declare function completionToolRuntimeEnvironment(runtimeEnvironment?: Readonly<Record<string, string>>, nativeTestPostgresFallbackPath?: string | null, hostLoadEnvironment?: Readonly<Record<string, string>>): Readonly<Record<string, string>>;
|
|
32
31
|
/**
|
|
33
32
|
* A solution-wide Forge test is long enough that a generic provider shell can
|
|
34
33
|
* expire while VSTest is still healthy. On managed host attempts, only the
|
|
@@ -38,12 +37,7 @@ export declare function completionToolRuntimeEnvironment(runtimeEnvironment?: Re
|
|
|
38
37
|
*/
|
|
39
38
|
export declare function assertManagedQaRegressionEvidence(input: unknown, receipts: readonly Readonly<Record<string, unknown>>[]): void;
|
|
40
39
|
export declare function runCompletionMcpServer(config: CompletionToolServerConfig): Promise<void>;
|
|
41
|
-
export declare function parseCompletionMcpArgs(argv: readonly string[]): {
|
|
42
|
-
readonly ok: true;
|
|
43
|
-
readonly config: CompletionToolServerConfig;
|
|
44
|
-
} | {
|
|
45
|
-
readonly ok: false;
|
|
46
|
-
readonly error: string;
|
|
47
|
-
};
|
|
48
40
|
export declare function completionRedactionEnv(secrets: readonly string[]): Readonly<Record<string, string>>;
|
|
49
|
-
export declare function completionToolRejectedResult(toolName: string, error: unknown): Readonly<Record<string, unknown>>;
|
|
41
|
+
export declare function completionToolRejectedResult(toolName: string, error: unknown, input?: unknown): Readonly<Record<string, unknown>>;
|
|
42
|
+
/** The input schema a completion tool advertises; also the shape its arguments are coerced to. */
|
|
43
|
+
export declare function completionToolInputSchema(name: string): unknown;
|