@loucompanion/forge-bridge 0.1.3-dev.ba7d36726eda → 0.1.3-dev.bca7d0ccee53
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/dist/bridge/bridge.base.d.ts +2 -1
- package/dist/bridge/bridge.service.d.ts +8 -0
- package/dist/bridge/bridge.service.js +184 -12
- package/dist/bridge/bridge.types.d.ts +37 -0
- package/dist/cli/cli.help.js +1 -1
- package/dist/cli/cli.service.js +1 -1
- package/dist/cli/local-config.js +2 -1
- package/dist/runtime/attempt-node-runtime-launcher.d.ts +3 -1
- package/dist/runtime/attempt-node-runtime-launcher.js +62 -11
- package/dist/runtime/attempt-process-supervisor-registry.js +1 -1
- package/dist/runtime/attempt-process-supervisor.d.ts +12 -0
- package/dist/runtime/attempt-process-supervisor.js +75 -15
- 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 +16 -0
- package/dist/runtime/host-listener-inspector.js +143 -4
- package/dist/runtime/host-runtime-contract.d.ts +9 -1
- package/dist/runtime/host-runtime-contract.js +411 -6
- package/dist/runtime/host-runtime-lease.d.ts +12 -1
- package/dist/runtime/host-runtime-lease.js +271 -50
- package/dist/runtime/host-runtime-promotion.d.ts +2 -0
- package/dist/runtime/host-runtime-promotion.js +35 -4
- package/dist/runtime/node-host-runtime-adapter.d.ts +7 -0
- package/dist/runtime/node-host-runtime-adapter.js +71 -8
- package/dist/runtime/playwright-host-runtime-adapter.js +84 -0
- package/dist/sandbox/preflight.d.ts +9 -0
- package/dist/sandbox/preflight.js +39 -4
- package/dist/sandbox/workspace.service.js +7 -2
- package/dist/session/managed-attempt-tools.d.ts +17 -0
- package/dist/session/managed-attempt-tools.js +712 -0
- package/dist/session/phase-completion.artifacts.js +9 -2
- package/dist/session/phase-completion.d.ts +11 -2
- package/dist/session/phase-completion.helpers.d.ts +5 -0
- package/dist/session/phase-completion.helpers.js +45 -9
- package/dist/session/phase-completion.js +12 -3
- package/dist/session/phase-completion.prompts.d.ts +3 -3
- package/dist/session/phase-completion.prompts.js +21 -6
- package/dist/session/phase-completion.runtime.d.ts +13 -1
- package/dist/session/phase-completion.runtime.js +183 -8
- package/dist/session/phase-completion.schemas.js +108 -3
- package/dist/session/phase-completion.validation.d.ts +4 -1
- package/dist/session/phase-completion.validation.js +144 -18
- package/dist/session/provider-cli/ci-repair-readiness.d.ts +8 -0
- package/dist/session/provider-cli/ci-repair-readiness.js +95 -0
- package/dist/session/provider-cli/provider-cli.deterministic.js +47 -1
- package/dist/session/provider-cli/provider-cli.process.d.ts +14 -0
- package/dist/session/provider-cli/provider-cli.process.js +176 -18
- package/dist/session/provider-cli/provider-cli.prompts.js +30 -8
- package/dist/session/provider-cli/provider-cli.qa-sidecars.js +1 -0
- package/dist/session/provider-cli/provider-cli.service.d.ts +19 -2
- package/dist/session/provider-cli/provider-cli.service.js +390 -83
- package/dist/session/provider-cli/provider-cli.types.d.ts +3 -0
- package/dist/session/provider-cli/provider-output-state.d.ts +2 -0
- package/dist/session/provider-cli/provider-output-state.js +30 -2
- package/dist/session/session.base.d.ts +2 -1
- package/dist/session/session.service.d.ts +2 -1
- package/dist/session/session.service.js +303 -30
- package/dist/session/session.types.d.ts +38 -0
- package/dist/session/session.types.js +17 -0
- package/dist/shared/process/host-process-supervisor.d.ts +18 -1
- package/dist/shared/process/host-process-supervisor.js +94 -7
- package/dist/shared/process/process.d.ts +1 -0
- package/dist/shared/process/process.js +1 -0
- 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 +10 -1
- package/dist/worktree/dependency-warmer.js +94 -5
- package/dist/worktree/worktree.service.d.ts +1 -0
- package/dist/worktree/worktree.service.js +12 -1
- package/package.json +1 -1
- package/runtime/windows-job-supervisor.ps1 +89 -20
|
@@ -237,12 +237,19 @@ export async function writeQaGateCompletionArtifact(config, gate, input) {
|
|
|
237
237
|
const status = normalizeQaGateStatus(requiredString(payload, "status"));
|
|
238
238
|
validateQaGatePayloadShape(gate, payload, status);
|
|
239
239
|
validateOptionalWorkItemId(payload, config.workItemId);
|
|
240
|
-
const
|
|
240
|
+
const ownerFields = artifactOwnerFields(config);
|
|
241
|
+
const validatedSidecars = gate === "qa_manual_web"
|
|
242
|
+
? await validateQaSidecarReferences(config.worktreePath, config.workItemId, qaArray(payload, "sidecars", qaEvidenceSource(payload)), ownerFields.owner_type, ownerFields.owner_id)
|
|
243
|
+
: null;
|
|
244
|
+
const redactedPayload = redactSecrets({
|
|
245
|
+
...payload,
|
|
246
|
+
status,
|
|
247
|
+
...(validatedSidecars ? { sidecars: validatedSidecars } : {})
|
|
248
|
+
}, config.redactionSecrets ?? []);
|
|
241
249
|
const producedBy = optionalString(redactedPayload, "produced_by")
|
|
242
250
|
?? optionalString(redactedPayload, "producedBy")
|
|
243
251
|
?? config.producedBy
|
|
244
252
|
?? "forge-completion-tool";
|
|
245
|
-
const ownerFields = artifactOwnerFields(config);
|
|
246
253
|
const artifactRoot = ownerFields.owner_type && ownerFields.owner_id
|
|
247
254
|
? artifactRootForOwner(config.worktreePath, ownerFields.owner_type, ownerFields.owner_id)
|
|
248
255
|
: artifactRootFor(config.worktreePath, config.workItemId);
|
|
@@ -9,7 +9,8 @@ export type DebugCompletionPhase = "debug_repro" | "debug_root_cause" | "debug_f
|
|
|
9
9
|
export type ArchitectCompletionPhase = "architect";
|
|
10
10
|
export type DraftCompletionPhase = "draft";
|
|
11
11
|
export type DecomposeCompletionPhase = "decompose";
|
|
12
|
-
export type
|
|
12
|
+
export type CiRepairCompletionPhase = "ci_repair";
|
|
13
|
+
export type CompletionPhase = DevelopCompletionPhase | "qa" | DebugCompletionPhase | ArchitectCompletionPhase | DraftCompletionPhase | DecomposeCompletionPhase | CiRepairCompletionPhase;
|
|
13
14
|
export type QaCompletionGate = "qa_plan" | "qa_regression" | "qa_api" | "qa_manual_web" | "qa_bug_repro" | "qa_findings" | "qa_verdict";
|
|
14
15
|
export type DraftCompletionGate = "draft_intent" | "draft_repo_context" | "draft_graph_context" | "draft_product_scope" | "draft_work_order_plan" | "draft_critic" | "draft_proposal";
|
|
15
16
|
export type DecomposeCompletionGate = "decompose_subject_intake" | "decompose_context_review" | "decompose_breakdown_strategy" | "decompose_child_items" | "decompose_dependency_graph" | "decompose_critic" | "decompose_proposal";
|
|
@@ -25,6 +26,7 @@ export interface CompletionToolRuntimeOptions {
|
|
|
25
26
|
readonly dispatch: RunOnceDispatchPacket;
|
|
26
27
|
readonly worktree: WorktreeHandle;
|
|
27
28
|
readonly phase?: CompletionPhase;
|
|
29
|
+
readonly runtimeEnvironment?: Readonly<Record<string, string>>;
|
|
28
30
|
}
|
|
29
31
|
export interface CompletionToolServerConfig {
|
|
30
32
|
readonly worktreePath: string;
|
|
@@ -47,6 +49,13 @@ export interface CompletionToolCallResult {
|
|
|
47
49
|
readonly text: string;
|
|
48
50
|
}[];
|
|
49
51
|
readonly structuredContent: CompletionArtifactReference & {
|
|
52
|
+
readonly artifact_written: true;
|
|
53
|
+
readonly artifact_receipt: {
|
|
54
|
+
readonly schema_version: 1;
|
|
55
|
+
readonly path: string;
|
|
56
|
+
readonly report_path: string;
|
|
57
|
+
readonly content_hash: string;
|
|
58
|
+
};
|
|
50
59
|
readonly gate: {
|
|
51
60
|
readonly phase: CompletionPhase;
|
|
52
61
|
readonly qaGate?: QaCompletionGate;
|
|
@@ -56,7 +65,7 @@ export interface CompletionToolCallResult {
|
|
|
56
65
|
readonly allowed: boolean;
|
|
57
66
|
readonly reason: string;
|
|
58
67
|
};
|
|
59
|
-
readonly nextPhase: CompletionPhase | "dev_test_ready" | "qa_ready" | "sign_off_ready";
|
|
68
|
+
readonly nextPhase: CompletionPhase | "dev_test_ready" | "qa_ready" | "sign_off_ready" | "provider_checks_ready";
|
|
60
69
|
readonly nextInstruction: string;
|
|
61
70
|
};
|
|
62
71
|
}
|
|
@@ -33,6 +33,11 @@ export declare function requireField(payload: Record<string, unknown>, key: stri
|
|
|
33
33
|
export declare function requireNonPassEvidence(payload: Record<string, unknown>): void;
|
|
34
34
|
export declare function requireImplementationEvidence(payload: Record<string, unknown>): void;
|
|
35
35
|
export declare function requirePassingCommands(payload: Record<string, unknown>): void;
|
|
36
|
+
export declare class CompletionPayloadValidationError extends Error {
|
|
37
|
+
readonly issues: readonly string[];
|
|
38
|
+
constructor(issues: readonly string[]);
|
|
39
|
+
}
|
|
40
|
+
export declare function throwCompletionPayloadIssues(issues: readonly string[]): void;
|
|
36
41
|
export declare function requireArray(payload: Record<string, unknown>, key: string): void;
|
|
37
42
|
export declare function requireNonEmptyArray(payload: Record<string, unknown>, key: string): void;
|
|
38
43
|
export declare function arrayLength(payload: Record<string, unknown>, key: string): number;
|
|
@@ -85,6 +85,9 @@ export function parseStrictCompletionPhase(value) {
|
|
|
85
85
|
if (normalized === "decompose" || normalized === "decomposition" || normalized === "work_order_decomposition" || normalized === "feature_decomposition") {
|
|
86
86
|
return "decompose";
|
|
87
87
|
}
|
|
88
|
+
if (normalized === "ci_repair" || normalized === "pr_checks" || normalized === "repair_pr_checks") {
|
|
89
|
+
return "ci_repair";
|
|
90
|
+
}
|
|
88
91
|
return null;
|
|
89
92
|
}
|
|
90
93
|
export function normalizeDebugCompletionPhase(value) {
|
|
@@ -156,6 +159,9 @@ export function phaseFromToolName(toolName) {
|
|
|
156
159
|
if (normalized === "forge.complete_architect_plan" || normalized === "complete_architect_plan") {
|
|
157
160
|
return "architect";
|
|
158
161
|
}
|
|
162
|
+
if (normalized === "forge.complete_ci_repair" || normalized === "complete_ci_repair") {
|
|
163
|
+
return "ci_repair";
|
|
164
|
+
}
|
|
159
165
|
if (draftGateFromToolName(toolName)) {
|
|
160
166
|
return "draft";
|
|
161
167
|
}
|
|
@@ -256,28 +262,45 @@ export function requirePassingCommands(payload) {
|
|
|
256
262
|
if (commands.length === 0) {
|
|
257
263
|
throw new Error("commands must include at least one deterministic validation command.");
|
|
258
264
|
}
|
|
265
|
+
const issues = [];
|
|
259
266
|
for (const [index, command] of commands.entries()) {
|
|
260
267
|
if (!command || typeof command !== "object" || Array.isArray(command)) {
|
|
261
|
-
|
|
268
|
+
issues.push(`commands[${index}] must be an object.`);
|
|
269
|
+
continue;
|
|
262
270
|
}
|
|
263
271
|
const record = command;
|
|
264
272
|
if (typeof record.command !== "string" || record.command.trim().length === 0) {
|
|
265
|
-
|
|
273
|
+
issues.push(`commands[${index}].command must be a non-empty string.`);
|
|
266
274
|
}
|
|
267
275
|
if (typeof record.summary !== "string" || record.summary.trim().length === 0) {
|
|
268
|
-
|
|
276
|
+
issues.push(`commands[${index}].summary must be a non-empty string.`);
|
|
269
277
|
}
|
|
270
278
|
if (typeof record.exit_code !== "number" || !Number.isFinite(record.exit_code)) {
|
|
271
|
-
|
|
279
|
+
issues.push(`commands[${index}].exit_code must be a finite number.`);
|
|
272
280
|
}
|
|
273
|
-
if (record.exit_code !== 0) {
|
|
274
|
-
|
|
281
|
+
else if (record.exit_code !== 0) {
|
|
282
|
+
issues.push(`commands[${index}].exit_code must be 0 when status is pass.`);
|
|
275
283
|
}
|
|
276
284
|
const status = typeof record.status === "string" ? record.status.trim().toLowerCase() : "";
|
|
277
285
|
if (status !== "pass") {
|
|
278
|
-
|
|
286
|
+
issues.push(`commands[${index}].status must be pass.`);
|
|
279
287
|
}
|
|
280
288
|
}
|
|
289
|
+
throwCompletionPayloadIssues(issues);
|
|
290
|
+
}
|
|
291
|
+
export class CompletionPayloadValidationError extends Error {
|
|
292
|
+
issues;
|
|
293
|
+
constructor(issues) {
|
|
294
|
+
super(`completion_payload_invalid: ${issues.length} correction${issues.length === 1 ? "" : "s"} required; no artifact was written.\n`
|
|
295
|
+
+ issues.map(issue => `- ${issue}`).join("\n")
|
|
296
|
+
+ "\nRepair every listed field and resubmit this gate once.");
|
|
297
|
+
this.issues = issues;
|
|
298
|
+
this.name = "CompletionPayloadValidationError";
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
export function throwCompletionPayloadIssues(issues) {
|
|
302
|
+
if (issues.length > 0)
|
|
303
|
+
throw new CompletionPayloadValidationError(issues);
|
|
281
304
|
}
|
|
282
305
|
export function requireArray(payload, key) {
|
|
283
306
|
if (!Array.isArray(payload[key])) {
|
|
@@ -600,9 +623,22 @@ export async function readOptionalFile(filePath) {
|
|
|
600
623
|
}
|
|
601
624
|
export async function writeFileAtomic(filePath, content) {
|
|
602
625
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
603
|
-
const tempPath = path.join(path.dirname(filePath), `.${path.basename(filePath)}.${process.pid}.${
|
|
626
|
+
const tempPath = path.join(path.dirname(filePath), `.${path.basename(filePath)}.${process.pid}.${crypto.randomUUID()}.tmp`);
|
|
604
627
|
await fs.writeFile(tempPath, content, "utf8");
|
|
605
|
-
|
|
628
|
+
try {
|
|
629
|
+
await fs.rename(tempPath, filePath);
|
|
630
|
+
}
|
|
631
|
+
catch (error) {
|
|
632
|
+
if (process.platform !== "win32" || !isNodeError(error) || (error.code !== "EPERM" && error.code !== "EEXIST")) {
|
|
633
|
+
await fs.rm(tempPath, { force: true });
|
|
634
|
+
throw error;
|
|
635
|
+
}
|
|
636
|
+
// Windows rename does not reliably replace an existing destination. QA-cycle gates
|
|
637
|
+
// intentionally refresh canonical bundle files, so remove only the exact destination
|
|
638
|
+
// after the replacement temp file is durable, then complete the rename.
|
|
639
|
+
await fs.rm(filePath, { force: true });
|
|
640
|
+
await fs.rename(tempPath, filePath);
|
|
641
|
+
}
|
|
606
642
|
}
|
|
607
643
|
export function stableStringify(value) {
|
|
608
644
|
return JSON.stringify(sortJson(value));
|
|
@@ -195,6 +195,10 @@ export const phaseFiles = {
|
|
|
195
195
|
decompose: {
|
|
196
196
|
jsonFileName: "decompose.proposal.json",
|
|
197
197
|
reportFileName: "decompose.report.md"
|
|
198
|
+
},
|
|
199
|
+
ci_repair: {
|
|
200
|
+
jsonFileName: "ci-repair.handoff.json",
|
|
201
|
+
reportFileName: "ci-repair.report.md"
|
|
198
202
|
}
|
|
199
203
|
};
|
|
200
204
|
export function completionPhaseFromDispatch(dispatch) {
|
|
@@ -224,6 +228,9 @@ export function normalizeCompletionPhase(value) {
|
|
|
224
228
|
if (normalized === "decompose" || normalized === "decomposition" || normalized === "work_order_decomposition" || normalized === "feature_decomposition") {
|
|
225
229
|
return "decompose";
|
|
226
230
|
}
|
|
231
|
+
if (normalized === "ci_repair" || normalized === "pr_checks" || normalized === "repair_pr_checks") {
|
|
232
|
+
return "ci_repair";
|
|
233
|
+
}
|
|
227
234
|
return "implementation";
|
|
228
235
|
}
|
|
229
236
|
export function usesDevelopCycleCompletion(dispatch) {
|
|
@@ -275,9 +282,11 @@ export function completionToolNamesForPhase(phase) {
|
|
|
275
282
|
? "complete_self_review"
|
|
276
283
|
: phase === "validation"
|
|
277
284
|
? "complete_validation"
|
|
278
|
-
: phase === "
|
|
279
|
-
? "
|
|
280
|
-
: "
|
|
285
|
+
: phase === "ci_repair"
|
|
286
|
+
? "complete_ci_repair"
|
|
287
|
+
: phase === "architect"
|
|
288
|
+
? "complete_architect_plan"
|
|
289
|
+
: "complete_qa";
|
|
281
290
|
return [`forge.${base}`, base];
|
|
282
291
|
}
|
|
283
292
|
export function completionToolNamesForQaGate(gate) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type CompletionPhase, type DebugCompletionPhase, type DecomposeCompletionGate, type DevelopCompletionPhase, type DraftCompletionGate, type QaCompletionGate } from "./phase-completion.js";
|
|
2
|
-
export declare function completionPromptForPhase(phase: CompletionPhase): string;
|
|
2
|
+
export declare function completionPromptForPhase(phase: CompletionPhase, artifactRoot?: string): string;
|
|
3
3
|
export declare function completionPromptForDevelopCycle(phase: CompletionPhase): string;
|
|
4
|
-
export declare function completionPromptForQaCycle(currentGate?: QaCompletionGate): string;
|
|
4
|
+
export declare function completionPromptForQaCycle(currentGate?: QaCompletionGate, artifactRoot?: string): string;
|
|
5
5
|
export declare function completionPromptForDraftCycle(currentGate?: DraftCompletionGate): string;
|
|
6
6
|
export declare function completionPromptForDecomposeCycle(currentGate?: DecomposeCompletionGate): string;
|
|
7
7
|
export declare function completionPromptForDebugCycle(currentGate?: DebugCompletionPhase): string;
|
|
8
8
|
export declare function nextPhaseAfter(phase: CompletionPhase): DevelopCompletionPhase | null;
|
|
9
9
|
export declare function nextDebugPhaseAfter(phase: DebugCompletionPhase): DebugCompletionPhase | null;
|
|
10
|
-
export declare function completionToolNextInstruction(completedPhase: CompletionPhase, status: string, nextPhase: CompletionPhase | "dev_test_ready" | "qa_ready" | "sign_off_ready"): string;
|
|
10
|
+
export declare function completionToolNextInstruction(completedPhase: CompletionPhase, status: string, nextPhase: CompletionPhase | "dev_test_ready" | "qa_ready" | "sign_off_ready" | "provider_checks_ready"): string;
|
|
11
11
|
export declare function completionToolNextInstructionForDraftGate(completedGate: DraftCompletionGate, status: string, nextGate: DraftCompletionGate | null): string;
|
|
12
12
|
export declare function completionToolNextInstructionForQaGate(completedGate: QaCompletionGate, status: string, nextGate: QaCompletionGate | null): string;
|
|
13
13
|
export declare function completionToolNextInstructionForDecomposeGate(completedGate: DecomposeCompletionGate, status: string, nextGate: DecomposeCompletionGate | null): string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { completionPhaseOrder, completionToolNamesForPhase, debugCompletionPhaseOrder, expectedCompletionToolName, expectedDebugCompletionToolName, expectedDecomposeCompletionToolName, phaseFiles, toolServerName } from "./phase-completion.js";
|
|
2
2
|
import { isDebugCompletionPhase, isDevelopCompletionPhase } from "./phase-completion.validation.js";
|
|
3
|
-
export function completionPromptForPhase(phase) {
|
|
3
|
+
export function completionPromptForPhase(phase, artifactRoot = ".forge/work-items/{workItemId}/artifacts") {
|
|
4
4
|
const toolName = expectedCompletionToolName(phase);
|
|
5
5
|
const alias = completionToolNamesForPhase(phase).find((name) => name !== toolName);
|
|
6
6
|
const artifactName = phaseFiles[phase].jsonFileName;
|
|
7
7
|
if (phase === "qa") {
|
|
8
8
|
return `Forge completion tools are available through the MCP server named \`${toolServerName}\`.
|
|
9
9
|
Do not write QA artifacts by hand. When QA is complete, call \`${toolName}(...)\`${alias ? ` (or \`${alias}\` if your client shows unqualified MCP tool names)` : ""} with the required structured QA payload.
|
|
10
|
-
That tool writes the durable QA bundle under
|
|
10
|
+
That tool writes the durable QA bundle under \`${artifactRoot}/\`: \`qa.plan.json\`, \`qa.evidence.json\`, \`qa.findings.json\`, \`${artifactName}\`, and \`qa.report.md\`.
|
|
11
11
|
Use \`status: "pass"\` only when the validated changes satisfy acceptance criteria with concrete evidence. Use \`status: "needs_rework"\` with actionable in-scope findings, or \`status: "blocked"\` with a concrete blocker_reason.
|
|
12
12
|
Include \`policy_warnings\` for non-blocking Forge policy or scope mismatches that should remain visible after QA.
|
|
13
13
|
Forge will mirror only the tool-written QA artifacts; reporting QA completion in prose is not enough.`;
|
|
@@ -22,6 +22,14 @@ The payload must put \`phases\`, \`tasks\`, \`dependencies\`, and \`phase_gates\
|
|
|
22
22
|
Dependency entries use canonical \`before\` and \`after\` task ids, for example \`{ "before": "task-1", "after": "task-2" }\`. Forge accepts \`from\`/\`to\` only as aliases and normalizes them before writing artifacts.
|
|
23
23
|
Use \`status: "pass"\` for a valid pending-approval plan, \`needs_revision\` when story/design input must change, or \`blocked\` with a concrete blocker.
|
|
24
24
|
Forge will mirror only the tool-written Architect artifacts; reporting the plan in prose is not enough.`;
|
|
25
|
+
}
|
|
26
|
+
if (phase === "ci_repair") {
|
|
27
|
+
return `Forge completion tools are available through the MCP server named \`${toolServerName}\`.
|
|
28
|
+
Read the generated \`.forge/work-items/{workItemId}/ci-repair.readiness.json\` before running validation.
|
|
29
|
+
Do not write the CI-repair handoff by hand. After the repair and locally equivalent validation are complete, call \`${toolName}(...)\`${alias ? ` (or \`${alias}\` if your client shows unqualified MCP tool names)` : ""}.
|
|
30
|
+
That tool validates failed-check inspection, root cause, scoped changes, narrow proof, every failed-job guard/test/drift step, provider-only classifications, broader validation, remaining risk, provider state, and push readiness.
|
|
31
|
+
It writes \`.forge/work-items/{workItemId}/artifacts/${artifactName}\`. Forge Bridge will not commit, push, or report CI repair success until this gate passes.
|
|
32
|
+
For a step classified \`provider_only\`, include the exact reason and provider check that will supply the missing proof. Do not weaken or delete the provider check.`;
|
|
25
33
|
}
|
|
26
34
|
return `Forge completion tools are available through the MCP server named \`${toolServerName}\`.
|
|
27
35
|
Do not write phase artifacts by hand. When the phase is complete, call \`${toolName}(...)\`${alias ? ` (or \`${alias}\` if your client shows unqualified MCP tool names)` : ""} with the required evidence payload.
|
|
@@ -38,10 +46,10 @@ Complete the dev cycle in order inside this same provider session:
|
|
|
38
46
|
Each tool writes the canonical artifact under \`.forge/work-items/{workItemId}/artifacts/\` and returns the next-phase instruction Forge expects you to follow.
|
|
39
47
|
If the current phase cannot pass, call the current phase tool with a non-pass status and explicit blockers instead of reporting completion in prose only.`;
|
|
40
48
|
}
|
|
41
|
-
export function completionPromptForQaCycle(currentGate = "qa_plan") {
|
|
49
|
+
export function completionPromptForQaCycle(currentGate = "qa_plan", artifactRoot = ".forge/work-items/{workItemId}/artifacts") {
|
|
42
50
|
return `Forge completion tools are available through the MCP server named \`${toolServerName}\`.
|
|
43
51
|
Do not write QA artifacts by hand. The tool server enforces QA gate order and starts this run at \`${currentGate}\`.
|
|
44
|
-
Complete the QA cycle in order inside this same provider session:
|
|
52
|
+
Complete the QA cycle in order inside this same provider session. Start long, independent regression verification as early as practical, continue API/source/manual review while it runs, and wait for its receipt only when those independent checks are complete:
|
|
45
53
|
1. Call \`forge.complete_qa_plan(...)\` after the QA test plan/checklist is ready.
|
|
46
54
|
2. Follow the returned regression instruction, then call \`forge.complete_qa_regression(...)\`.
|
|
47
55
|
3. Follow the returned API/backend instruction, then call \`forge.complete_qa_api(...)\`.
|
|
@@ -50,7 +58,9 @@ Complete the QA cycle in order inside this same provider session:
|
|
|
50
58
|
6. Follow the returned findings instruction, then call \`forge.complete_qa_findings(...)\`.
|
|
51
59
|
7. Follow the returned verdict instruction, then call \`forge.complete_qa_verdict(...)\`.
|
|
52
60
|
Use \`status: "skipped"\` with a reason for gates that are not applicable. If a gate is blocked, keep moving through later gates as skipped due to the blocker and finish with a blocked verdict.
|
|
53
|
-
|
|
61
|
+
On a managed host, use focused checks plus the relevant runner-authored \`forge.start_managed_verification\` profiles for normal Story QA; shard slow tiers when broader evidence is justified. Reserve the \`dotnet_solution\` profile for shared test/runtime infrastructure, Feature/PR integration, or an explicit QA-plan requirement. Use \`forge.start_managed_command\` only for other commands expected to exceed two minutes. Continue independent QA work, then call \`forge.wait_managed_command\` once for the durable terminal receipt; do not poll \`forge.get_managed_command\`. Include the returned \`managed_command_id\` in command evidence. Forge records live progress outside the provider transcript and delivers one terminal result.
|
|
62
|
+
For a negative assertion, make the command itself exit 0 when the forbidden condition is absent. In particular, raw \`rg\` exit 1 means no matches but cannot be submitted as passing evidence; wrap it so no match exits 0, a match fails, and tool errors remain failures. Before every completion call, ensure passing command records have \`exit_code: 0\`, \`status: "pass"\`, and a summary. A rejected call writes no artifact; repair every issue returned by Forge and resubmit the same gate once without probing the filesystem.
|
|
63
|
+
The final verdict tool writes the canonical QA bundle under \`${artifactRoot}/\`: \`qa.plan.json\`, \`qa.evidence.json\`, \`qa.findings.json\`, \`qa.verdict.json\`, and \`qa.report.md\`.
|
|
54
64
|
Include \`policy_warnings\` in the final verdict for non-blocking Forge policy or scope mismatches that should remain visible after QA.
|
|
55
65
|
The legacy \`forge.complete_qa\` one-shot tool is not available in normal QA-cycle mode. Reporting QA completion in prose is not enough.`;
|
|
56
66
|
}
|
|
@@ -115,6 +125,11 @@ export function completionToolNextInstruction(completedPhase, status, nextPhase)
|
|
|
115
125
|
}
|
|
116
126
|
return "QA accepted. Forge has the structured evidence needed to move this work item to Sign-Off.";
|
|
117
127
|
}
|
|
128
|
+
if (completedPhase === "ci_repair") {
|
|
129
|
+
return status === "pass"
|
|
130
|
+
? "CI repair handoff accepted. Forge Bridge may now commit, push, and return the PR to provider checks."
|
|
131
|
+
: "Stay in CI repair, address the exact missing evidence returned by this gate, then call forge.complete_ci_repair again.";
|
|
132
|
+
}
|
|
118
133
|
if (status !== "pass") {
|
|
119
134
|
return `Stay in ${completedPhase}, address the recorded blockers, then call ${expectedCompletionToolName(completedPhase)} again.`;
|
|
120
135
|
}
|
|
@@ -203,7 +218,7 @@ export function completionToolNextInstructionForDebugGate(completedGate, status,
|
|
|
203
218
|
function qaGateInstruction(gate) {
|
|
204
219
|
switch (gate) {
|
|
205
220
|
case "qa_regression":
|
|
206
|
-
return "Run or explicitly skip applicable regression/build/lint/typecheck/e2e checks, then call forge.complete_qa_regression.";
|
|
221
|
+
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 once and include its terminal managed_command_id in command evidence; do not poll. 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.";
|
|
207
222
|
case "qa_api":
|
|
208
223
|
return "Run or explicitly skip applicable API/backend contract checks, then call forge.complete_qa_api.";
|
|
209
224
|
case "qa_manual_web":
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type CompletionToolCallResult, type CompletionToolRuntime, type CompletionToolRuntimeOptions, type CompletionToolServerConfig } from "./phase-completion.js";
|
|
2
|
+
import { type ManagedAttemptToolResult } from "./managed-attempt-tools.js";
|
|
2
3
|
export declare function prepareCompletionToolRuntime(options: CompletionToolRuntimeOptions): Promise<CompletionToolRuntime>;
|
|
3
4
|
export declare function buildCompletionToolServerArgs(config: CompletionToolServerConfig): readonly string[];
|
|
4
5
|
export declare function codexMcpConfigArgs(runtime: CompletionToolRuntime): readonly string[];
|
|
@@ -10,11 +11,12 @@ export declare class CompletionToolServerSession {
|
|
|
10
11
|
private currentQaGate;
|
|
11
12
|
private currentDraftGate;
|
|
12
13
|
private currentDecomposeGate;
|
|
14
|
+
private readonly managedCommandReceipts;
|
|
13
15
|
private completed;
|
|
14
16
|
constructor(config: CompletionToolServerConfig);
|
|
15
17
|
get instructions(): string;
|
|
16
18
|
toolDefinitions(): readonly unknown[];
|
|
17
|
-
callTool(toolName: string, input: unknown): Promise<CompletionToolCallResult>;
|
|
19
|
+
callTool(toolName: string, input: unknown): Promise<CompletionToolCallResult | ManagedAttemptToolResult>;
|
|
18
20
|
private callDecomposeGateTool;
|
|
19
21
|
private callDraftGateTool;
|
|
20
22
|
private callDebugGateTool;
|
|
@@ -25,6 +27,15 @@ export declare class CompletionToolServerSession {
|
|
|
25
27
|
private advanceAfterQaGate;
|
|
26
28
|
private advanceAfterDebugGate;
|
|
27
29
|
}
|
|
30
|
+
export declare function completionToolRuntimeEnvironment(runtimeEnvironment?: Readonly<Record<string, string>>): Readonly<Record<string, string>>;
|
|
31
|
+
/**
|
|
32
|
+
* A solution-wide Forge test is long enough that a generic provider shell can
|
|
33
|
+
* expire while VSTest is still healthy. On managed host attempts, only the
|
|
34
|
+
* attempt-owned command runner can prove the exact process outcome and clean
|
|
35
|
+
* up its process tree. Keep this check at the completion gate so prompt drift
|
|
36
|
+
* cannot turn an arbitrary shell timeout into a QA blocker.
|
|
37
|
+
*/
|
|
38
|
+
export declare function assertManagedQaRegressionEvidence(input: unknown, receipts: readonly Readonly<Record<string, unknown>>[]): void;
|
|
28
39
|
export declare function runCompletionMcpServer(config: CompletionToolServerConfig): Promise<void>;
|
|
29
40
|
export declare function parseCompletionMcpArgs(argv: readonly string[]): {
|
|
30
41
|
readonly ok: true;
|
|
@@ -34,3 +45,4 @@ export declare function parseCompletionMcpArgs(argv: readonly string[]): {
|
|
|
34
45
|
readonly error: string;
|
|
35
46
|
};
|
|
36
47
|
export declare function completionRedactionEnv(secrets: readonly string[]): Readonly<Record<string, string>>;
|
|
48
|
+
export declare function completionToolRejectedResult(toolName: string, error: unknown): Readonly<Record<string, unknown>>;
|