@loucompanion/forge-bridge 0.1.4-dev.a5a3a7ab2f02 → 0.1.4-dev.a7b2e9125fed
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 +22 -0
- package/dist/bridge/bridge-chat-provider-command.d.ts +16 -0
- package/dist/bridge/bridge-chat-provider-command.js +137 -0
- package/dist/bridge/bridge-chat.types.d.ts +10 -0
- package/dist/bridge/bridge-chat.types.js +16 -1
- package/dist/bridge/bridge.service.d.ts +1 -1
- package/dist/bridge/bridge.service.js +4 -110
- package/dist/bridge/runner-host-capabilities.d.ts +3 -0
- package/dist/bridge/runner-host-capabilities.js +13 -0
- package/dist/runtime/attempt-database-broker.d.ts +1 -1
- package/dist/runtime/docker-engine-probe.d.ts +5 -0
- package/dist/runtime/docker-engine-probe.js +7 -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-facts.d.ts +2 -1
- package/dist/runtime/host-load-admission.d.ts +9 -2
- package/dist/runtime/host-load-child-environment.d.ts +11 -6
- package/dist/runtime/host-load-child-environment.js +19 -10
- package/dist/runtime/host-load-governor-config.d.ts +10 -1
- package/dist/runtime/host-load-governor-config.js +7 -0
- package/dist/runtime/host-load-governor.d.ts +10 -0
- package/dist/runtime/host-load-governor.js +125 -34
- package/dist/runtime/host-load-sampler.d.ts +34 -4
- package/dist/runtime/host-load-sampler.js +73 -7
- package/dist/runtime/host-load-step-class.d.ts +3 -1
- package/dist/runtime/host-load-step-class.js +60 -5
- 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 +26 -0
- package/dist/runtime/host-load-token-ledger.js +93 -61
- 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-runtime-lease.d.ts +1 -1
- package/dist/runtime/host-runtime-lease.js +1 -1
- package/dist/runtime/native-test-postgres-fallback.d.ts +51 -7
- package/dist/runtime/native-test-postgres-fallback.js +60 -8
- package/dist/sandbox/host-capacity-broker.d.ts +7 -1
- package/dist/sandbox/host-capacity-broker.js +23 -4
- 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 +0 -7
- package/dist/session/managed-attempt-tools.js +51 -62
- package/dist/session/managed-command-host-load.d.ts +2 -0
- package/dist/session/managed-command-host-load.js +2 -1
- package/dist/session/phase-completion.artifacts.js +2 -1
- package/dist/session/phase-completion.d.ts +8 -0
- package/dist/session/phase-completion.js +1 -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.runtime.d.ts +0 -8
- package/dist/session/phase-completion.runtime.js +38 -168
- package/dist/session/phase-completion.schemas.js +25 -23
- package/dist/session/phase-completion.validation.js +3 -1
- 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-step-execution.d.ts +2 -1
- package/dist/session/pre-publication-step-execution.js +6 -5
- package/dist/session/pre-publication-validation.d.ts +30 -14
- package/dist/session/pre-publication-validation.js +207 -134
- package/dist/session/provider-cli/claude-background-work.d.ts +66 -0
- package/dist/session/provider-cli/claude-background-work.js +180 -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.child-environment.d.ts +7 -0
- package/dist/session/provider-cli/provider-cli.child-environment.js +73 -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.process.d.ts +15 -36
- package/dist/session/provider-cli/provider-cli.process.js +39 -430
- package/dist/session/provider-cli/provider-cli.prompts.d.ts +5 -0
- package/dist/session/provider-cli/provider-cli.prompts.js +58 -8
- package/dist/session/provider-cli/provider-cli.runtime.js +7 -0
- package/dist/session/provider-cli/provider-cli.service.d.ts +5 -5
- package/dist/session/provider-cli/provider-cli.service.js +65 -257
- 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 +4 -0
- package/dist/session/provider-cli/provider-in-flight-work.js +45 -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 +2 -0
- package/dist/session/provider-cli/provider-output-state.js +6 -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.js +12 -3
- package/dist/session/session-redaction.js +31 -181
- package/dist/session/session.types.js +2 -2
- package/dist/session/sidecar-json-shape.d.ts +31 -0
- package/dist/session/sidecar-json-shape.js +217 -0
- 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 +5 -6
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { resolveLocalConfigPath } from "../cli/local-config.js";
|
|
4
|
+
import { DockerEngineProbe } from "./docker-engine-probe.js";
|
|
5
|
+
import { ephemeralTestPostgresClusterEnvironment } from "./ephemeral-test-postgres.js";
|
|
4
6
|
import { hostRuntimeLegacyTestPostgresEnvironment, hostRuntimeTestPostgresAdminEnvironment, } from "./host-runtime-contract.js";
|
|
5
7
|
export const nativeTestPostgresFallbackConfigEnvironment = "FORGE_NATIVE_TEST_POSTGRES_CONFIG";
|
|
6
8
|
export const nativeTestPostgresFallbackFileName = "native-test-postgres.json";
|
|
7
9
|
export const nativeTestPostgresFallbackDatabaseMode = "native_fallback";
|
|
10
|
+
/**
|
|
11
|
+
* The cluster serves the shared test server while Docker is up, so tests that need a
|
|
12
|
+
* pinned engine container still start one. Owner policy (2026-11-16): native PostgreSQL
|
|
13
|
+
* first, which keeps test databases out of the Docker VM and saves RAM.
|
|
14
|
+
*/
|
|
15
|
+
export const nativeTestPostgresPreferredDatabaseMode = "native_preferred";
|
|
16
|
+
const nativeTestPostgresUses = ["preferred", "docker_unavailable", "ephemeral"];
|
|
8
17
|
const defaultPostgresPort = 5432;
|
|
9
18
|
const loopbackHosts = new Set(["127.0.0.1", "localhost", "::1", "[::1]"]);
|
|
19
|
+
/**
|
|
20
|
+
* The provisioned cluster's grant for a check that can use it, or null to use Docker. A
|
|
21
|
+
* preferred cluster is granted whether or not Docker is up; the mode says which, because
|
|
22
|
+
* only the fallback mode excludes Docker for pinned-engine tests. An `ephemeral` host
|
|
23
|
+
* normally gets its own cluster instead (ephemeral-test-postgres-grant.ts); if that cannot
|
|
24
|
+
* start, the provisioned cluster serves only while Docker is down, as for `docker_unavailable`.
|
|
25
|
+
*/
|
|
26
|
+
export function nativeTestPostgresGrant(fallback, dockerAvailable) {
|
|
27
|
+
if (!fallback || (dockerAvailable && fallback.use !== "preferred"))
|
|
28
|
+
return null;
|
|
29
|
+
return {
|
|
30
|
+
connectionString: fallback.connectionString,
|
|
31
|
+
endpoint: fallback.endpoint,
|
|
32
|
+
mode: dockerAvailable ? nativeTestPostgresPreferredDatabaseMode : nativeTestPostgresFallbackDatabaseMode,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
10
35
|
export class NativeTestPostgresFallbackError extends Error {
|
|
11
36
|
code = "native_test_postgres_fallback_invalid";
|
|
12
37
|
constructor(detail) {
|
|
@@ -46,9 +71,17 @@ export function readNativeTestPostgresFallback(configPath = resolveNativeTestPos
|
|
|
46
71
|
if (document.schemaVersion !== 1 || typeof document.connectionString !== "string") {
|
|
47
72
|
throw new NativeTestPostgresFallbackError(`${configPath} must contain schemaVersion 1 and a connectionString.`);
|
|
48
73
|
}
|
|
49
|
-
|
|
74
|
+
if (document.use !== undefined && !nativeTestPostgresUses.includes(document.use)) {
|
|
75
|
+
throw new NativeTestPostgresFallbackError(`${configPath} 'use' must be 'preferred', 'docker_unavailable' or 'ephemeral'.`);
|
|
76
|
+
}
|
|
77
|
+
if (document.postgresBin !== undefined
|
|
78
|
+
&& (typeof document.postgresBin !== "string" || !path.isAbsolute(document.postgresBin))) {
|
|
79
|
+
throw new NativeTestPostgresFallbackError(`${configPath} 'postgresBin' must be an absolute path.`);
|
|
80
|
+
}
|
|
81
|
+
const fallback = parseNativeTestPostgresFallback(document.connectionString, document.use ?? "preferred");
|
|
82
|
+
return typeof document.postgresBin === "string" ? { ...fallback, postgresBin: document.postgresBin } : fallback;
|
|
50
83
|
}
|
|
51
|
-
export function parseNativeTestPostgresFallback(connectionString) {
|
|
84
|
+
export function parseNativeTestPostgresFallback(connectionString, use = "preferred") {
|
|
52
85
|
const fields = new Map();
|
|
53
86
|
for (const segment of connectionString.split(";")) {
|
|
54
87
|
const separator = segment.indexOf("=");
|
|
@@ -79,13 +112,32 @@ export function parseNativeTestPostgresFallback(connectionString) {
|
|
|
79
112
|
if (!(fields.get("username") ?? fields.get("userid") ?? fields.get("user"))) {
|
|
80
113
|
throw new NativeTestPostgresFallbackError("the fallback must name a dedicated test role.");
|
|
81
114
|
}
|
|
82
|
-
return { connectionString: connectionString.trim(), endpoint: `${host}:${port}
|
|
115
|
+
return { connectionString: connectionString.trim(), endpoint: `${host}:${port}`, use };
|
|
83
116
|
}
|
|
84
|
-
/** Environment for one runner-authored .NET test process using the
|
|
85
|
-
export function nativeTestPostgresFallbackEnvironment(
|
|
117
|
+
/** Environment for one runner-authored .NET test process using the cluster. */
|
|
118
|
+
export function nativeTestPostgresFallbackEnvironment(grant) {
|
|
86
119
|
return {
|
|
87
|
-
[hostRuntimeTestPostgresAdminEnvironment]:
|
|
88
|
-
[hostRuntimeLegacyTestPostgresEnvironment]:
|
|
89
|
-
FORGE_MANAGED_VERIFICATION_DATABASE_MODE:
|
|
120
|
+
[hostRuntimeTestPostgresAdminEnvironment]: grant.connectionString,
|
|
121
|
+
[hostRuntimeLegacyTestPostgresEnvironment]: grant.connectionString,
|
|
122
|
+
FORGE_MANAGED_VERIFICATION_DATABASE_MODE: grant.mode,
|
|
123
|
+
// The fixtures accept a superuser login only on the cluster that reports this id.
|
|
124
|
+
...(grant.ephemeralClusterId ? { [ephemeralTestPostgresClusterEnvironment]: grant.ephemeralClusterId } : {}),
|
|
90
125
|
};
|
|
91
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Runner-authored verification uses the operator-provisioned native test cluster,
|
|
129
|
+
* which holds no real data, whenever its file prefers it (the default); Docker then
|
|
130
|
+
* only starts pinned-engine containers. A `docker_unavailable` cluster is used only
|
|
131
|
+
* when the Docker engine is unavailable; otherwise the attempt-owned Testcontainers
|
|
132
|
+
* database serves.
|
|
133
|
+
*/
|
|
134
|
+
export async function managedVerificationDatabaseEnvironment(dockerAvailable = async () => (await new DockerEngineProbe().probeWithoutRecovery()).available, readFallback = () => {
|
|
135
|
+
const configPath = process.env[nativeTestPostgresFallbackConfigEnvironment]?.trim();
|
|
136
|
+
return configPath ? readNativeTestPostgresFallback(configPath) : null;
|
|
137
|
+
}) {
|
|
138
|
+
const fallback = readFallback();
|
|
139
|
+
if (!fallback)
|
|
140
|
+
return {};
|
|
141
|
+
const grant = nativeTestPostgresGrant(fallback, await dockerAvailable());
|
|
142
|
+
return grant ? nativeTestPostgresFallbackEnvironment(grant) : {};
|
|
143
|
+
}
|
|
@@ -9,7 +9,7 @@ export declare const sandboxHostCapacityResponseRoot = "/run/forge/host-capacity
|
|
|
9
9
|
export declare const sandboxHostCapacityResponseOwnerUid = 0;
|
|
10
10
|
export declare const sandboxHostCapacityMaxWaitEnvironment = "FORGE_HOST_LOAD_BROKER_MAX_WAIT_MS";
|
|
11
11
|
export interface SandboxHostCapacityRequest {
|
|
12
|
-
readonly action: "acquire" | "release";
|
|
12
|
+
readonly action: "acquire" | "release" | "retain";
|
|
13
13
|
readonly requestId: string;
|
|
14
14
|
readonly stepClass: string;
|
|
15
15
|
readonly label: string;
|
|
@@ -82,6 +82,12 @@ export declare class SandboxHostCapacityBroker {
|
|
|
82
82
|
private takeAllowance;
|
|
83
83
|
private track;
|
|
84
84
|
private acquire;
|
|
85
|
+
/**
|
|
86
|
+
* The sandbox's step ended but part of its tree may still run: the host token is
|
|
87
|
+
* kept, marked retained (so the attempt's own next step does not wait for it),
|
|
88
|
+
* until the sandbox releases the request or exits.
|
|
89
|
+
*/
|
|
90
|
+
private retain;
|
|
85
91
|
private release;
|
|
86
92
|
/** Queues the newest state for a request; at most one delivery per request is in flight. */
|
|
87
93
|
private respond;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { hostLoadStepCostForClass } from "../runtime/host-load-step-class.js";
|
|
2
|
+
import { takesHostTestSlot } from "../runtime/host-load-test-slot.js";
|
|
2
3
|
import { ForgeFailureError } from "../session/session.types.js";
|
|
3
4
|
// Host side of Docker-sandbox admission (decision 0013). The validator inside a
|
|
4
5
|
// container cannot reach the host ledger, so it asks the bridge over the
|
|
@@ -50,11 +51,13 @@ export function parseSandboxHostCapacityRequest(line) {
|
|
|
50
51
|
}
|
|
51
52
|
if (!value || value.type !== sandboxHostCapacityLineType || value.version !== 1)
|
|
52
53
|
return null;
|
|
53
|
-
if (value.action !== "acquire" && value.action !== "release")
|
|
54
|
+
if (value.action !== "acquire" && value.action !== "release" && value.action !== "retain")
|
|
54
55
|
return null;
|
|
55
56
|
if (typeof value.requestId !== "string" || !requestIdPattern.test(value.requestId))
|
|
56
57
|
return null;
|
|
57
|
-
const
|
|
58
|
+
const claimed = typeof value.stepClass === "string" && stepClassPattern.test(value.stepClass) ? value.stepClass : "generic";
|
|
59
|
+
// A sandbox brokers only validation steps; it cannot claim a class that skips the host test slot.
|
|
60
|
+
const stepClass = takesHostTestSlot(claimed) ? claimed : "generic";
|
|
58
61
|
// Diagnostics only, but never control characters or markup from the sandbox.
|
|
59
62
|
const label = typeof value.label === "string" ? value.label.replace(/[^\w .:/@+-]/gu, "_").slice(0, 128) : "";
|
|
60
63
|
return { action: value.action, requestId: value.requestId, stepClass, label };
|
|
@@ -117,7 +120,8 @@ export class SandboxHostCapacityBroker {
|
|
|
117
120
|
if (request.action === "acquire" && !this.tokens.has(request.requestId) && this.tokens.size >= this.maximumOutstanding) {
|
|
118
121
|
this.stop(`more than ${this.maximumOutstanding} host capacity requests outstanding at once`);
|
|
119
122
|
}
|
|
120
|
-
this.track(request.action === "acquire" ? this.acquire(request)
|
|
123
|
+
this.track(request.action === "acquire" ? this.acquire(request)
|
|
124
|
+
: request.action === "retain" ? Promise.resolve(this.retain(request.requestId)) : this.release(request.requestId));
|
|
121
125
|
return true;
|
|
122
126
|
}
|
|
123
127
|
/** The sandbox exited: cancel its waits and return every token it holds. */
|
|
@@ -152,7 +156,7 @@ export class SandboxHostCapacityBroker {
|
|
|
152
156
|
async acquire(request) {
|
|
153
157
|
if (this.closed || this.tokens.has(request.requestId))
|
|
154
158
|
return;
|
|
155
|
-
const entry = { controller: new AbortController(), admission: null, released: false };
|
|
159
|
+
const entry = { controller: new AbortController(), admission: null, released: false, retained: false };
|
|
156
160
|
this.tokens.set(request.requestId, entry);
|
|
157
161
|
let admission;
|
|
158
162
|
try {
|
|
@@ -219,6 +223,9 @@ export class SandboxHostCapacityBroker {
|
|
|
219
223
|
}
|
|
220
224
|
// Registered synchronously after the check above, so no fence can slip between them.
|
|
221
225
|
admission.fenced.addEventListener("abort", () => {
|
|
226
|
+
// Retention stops the step's reservation on purpose; the sandbox already knows.
|
|
227
|
+
if (entry.retained)
|
|
228
|
+
return;
|
|
222
229
|
void this.respond({
|
|
223
230
|
requestId: request.requestId,
|
|
224
231
|
status: "fenced",
|
|
@@ -230,6 +237,18 @@ export class SandboxHostCapacityBroker {
|
|
|
230
237
|
requestId: request.requestId, status: "admitted", waitMs: Math.round(admission.waitMs), reason: admission.decision.reason,
|
|
231
238
|
});
|
|
232
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* The sandbox's step ended but part of its tree may still run: the host token is
|
|
242
|
+
* kept, marked retained (so the attempt's own next step does not wait for it),
|
|
243
|
+
* until the sandbox releases the request or exits.
|
|
244
|
+
*/
|
|
245
|
+
retain(requestId) {
|
|
246
|
+
const entry = this.tokens.get(requestId);
|
|
247
|
+
if (!entry?.admission || entry.released || entry.retained)
|
|
248
|
+
return;
|
|
249
|
+
entry.retained = true;
|
|
250
|
+
entry.admission.retainUntilStopped(async () => entry.released, new Error("The sandbox step's processes could not be proven stopped; its host capacity is kept until the sandbox releases it."));
|
|
251
|
+
}
|
|
233
252
|
async release(requestId) {
|
|
234
253
|
const entry = this.tokens.get(requestId);
|
|
235
254
|
if (!entry || entry.released)
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// Decision 0022: a blocked Architect verdict may say what it waits on (a sibling Story, a pull
|
|
2
|
+
// request, or something outside Forge) and which choice it needs from the owner. Forge records
|
|
3
|
+
// Story and pull request waits as dependency edges and re-plans the Story when they merge.
|
|
4
|
+
const architectWaitKinds = ["story", "pull_request", "external"];
|
|
5
|
+
const architectWaitUntil = ["merged"];
|
|
6
|
+
const storyIdPattern = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{8,32})$/i;
|
|
7
|
+
// Architect tool properties for non-pass verdicts: revision prose plus the structured waits.
|
|
8
|
+
export function architectNonPassProperties() {
|
|
9
|
+
return {
|
|
10
|
+
revision_questions: {
|
|
11
|
+
type: "array",
|
|
12
|
+
description: "Required for needs_revision when blockers are not used.",
|
|
13
|
+
items: { type: "string" }
|
|
14
|
+
},
|
|
15
|
+
revision_reasons: {
|
|
16
|
+
type: "array",
|
|
17
|
+
description: "Concrete reasons that prevent pass status.",
|
|
18
|
+
items: { type: "string" }
|
|
19
|
+
},
|
|
20
|
+
waits_on: {
|
|
21
|
+
type: "array",
|
|
22
|
+
description: "Only with status blocked. What must merge before this Story can be planned: a sibling Story (kind story, story_id as the full id or its first 8+ hex digits), a pull request (kind pull_request, pr_number), or something outside Forge (kind external). Forge records Story and sibling pull request waits and plans the Story again when they merge; external waits hold for the owner.",
|
|
23
|
+
items: {
|
|
24
|
+
type: "object",
|
|
25
|
+
additionalProperties: false,
|
|
26
|
+
required: ["kind", "until", "reason"],
|
|
27
|
+
properties: {
|
|
28
|
+
kind: { type: "string", enum: [...architectWaitKinds] },
|
|
29
|
+
story_id: { type: "string", description: "Required for kind story." },
|
|
30
|
+
pr_number: { type: "integer", minimum: 1, description: "Required for kind pull_request." },
|
|
31
|
+
until: { type: "string", enum: [...architectWaitUntil] },
|
|
32
|
+
reason: { type: "string", description: "What this Story needs from the blocker." }
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
owner_decision: {
|
|
37
|
+
type: "object",
|
|
38
|
+
description: "Only with status blocked. A choice only the owner can make before the Story can be planned. Forge holds the Story for the owner and never picks an option.",
|
|
39
|
+
additionalProperties: false,
|
|
40
|
+
required: ["question", "options"],
|
|
41
|
+
properties: {
|
|
42
|
+
question: { type: "string" },
|
|
43
|
+
options: {
|
|
44
|
+
type: "array",
|
|
45
|
+
minItems: 2,
|
|
46
|
+
items: {
|
|
47
|
+
type: "object",
|
|
48
|
+
additionalProperties: false,
|
|
49
|
+
required: ["label", "summary"],
|
|
50
|
+
properties: {
|
|
51
|
+
label: { type: "string" },
|
|
52
|
+
summary: { type: "string" }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
recommended: { type: "string", description: "Label of the recommended option." }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
// An explicit null is absent, as the API reads it.
|
|
62
|
+
function isPresent(value) {
|
|
63
|
+
return value !== undefined && value !== null;
|
|
64
|
+
}
|
|
65
|
+
function hasArchitectWaitDeclarations(payload) {
|
|
66
|
+
return isPresent(payload.waits_on) || isPresent(payload.owner_decision);
|
|
67
|
+
}
|
|
68
|
+
// Throws an actionable error for a malformed waits_on or owner_decision. Absent (or null) fields are valid.
|
|
69
|
+
export function validateArchitectWaits(payload, status) {
|
|
70
|
+
if (!hasArchitectWaitDeclarations(payload)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (status !== "blocked") {
|
|
74
|
+
throw new Error("waits_on/owner_decision: allowed only with status blocked; correction: remove them, or return status blocked when the plan cannot pass until they are resolved.");
|
|
75
|
+
}
|
|
76
|
+
if (isPresent(payload.waits_on)) {
|
|
77
|
+
validateWaitsOn(payload.waits_on);
|
|
78
|
+
}
|
|
79
|
+
if (isPresent(payload.owner_decision)) {
|
|
80
|
+
validateOwnerDecision(payload.owner_decision);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function validateWaitsOn(value) {
|
|
84
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
85
|
+
throw new Error("waits_on: expected a non-empty array; correction: list each Story, pull request or external dependency, or omit waits_on.");
|
|
86
|
+
}
|
|
87
|
+
value.forEach((entry, index) => validateWait(entry, `waits_on[${index}]`));
|
|
88
|
+
}
|
|
89
|
+
function validateWait(entry, label) {
|
|
90
|
+
const wait = requireRecord(entry, label);
|
|
91
|
+
const kind = wait.kind;
|
|
92
|
+
if (typeof kind !== "string" || !architectWaitKinds.includes(kind)) {
|
|
93
|
+
throw new Error(`${label}.kind: expected one of story, pull_request, external.`);
|
|
94
|
+
}
|
|
95
|
+
if (wait.until !== "merged") {
|
|
96
|
+
throw new Error(`${label}.until: expected "merged".`);
|
|
97
|
+
}
|
|
98
|
+
requireText(wait.reason, `${label}.reason`);
|
|
99
|
+
if (kind === "story") {
|
|
100
|
+
const storyId = requireText(wait.story_id, `${label}.story_id`);
|
|
101
|
+
if (!storyIdPattern.test(storyId)) {
|
|
102
|
+
throw new Error(`${label}.story_id: expected the Story's full id or its first 8+ hex digits; got '${storyId}'.`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (kind === "pull_request" && !(typeof wait.pr_number === "number" && Number.isInteger(wait.pr_number) && wait.pr_number > 0)) {
|
|
106
|
+
throw new Error(`${label}.pr_number: expected a positive integer pull request number.`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function validateOwnerDecision(value) {
|
|
110
|
+
const decision = requireRecord(value, "owner_decision");
|
|
111
|
+
requireText(decision.question, "owner_decision.question");
|
|
112
|
+
if (!Array.isArray(decision.options) || decision.options.length < 2) {
|
|
113
|
+
throw new Error("owner_decision.options: expected at least two options, each with a distinct label and a summary.");
|
|
114
|
+
}
|
|
115
|
+
const labels = decision.options.map((option, index) => {
|
|
116
|
+
const record = requireRecord(option, `owner_decision.options[${index}]`);
|
|
117
|
+
requireText(record.summary, `owner_decision.options[${index}].summary`);
|
|
118
|
+
return requireText(record.label, `owner_decision.options[${index}].label`);
|
|
119
|
+
});
|
|
120
|
+
if (new Set(labels).size !== labels.length) {
|
|
121
|
+
throw new Error("owner_decision.options: expected at least two options, each with a distinct label and a summary.");
|
|
122
|
+
}
|
|
123
|
+
if (isPresent(decision.recommended) && !labels.includes(requireText(decision.recommended, "owner_decision.recommended"))) {
|
|
124
|
+
throw new Error("owner_decision.recommended: expected the label of one of the options.");
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function requireRecord(value, label) {
|
|
128
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
129
|
+
throw new Error(`${label}: expected an object.`);
|
|
130
|
+
}
|
|
131
|
+
return value;
|
|
132
|
+
}
|
|
133
|
+
function requireText(value, label) {
|
|
134
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
135
|
+
throw new Error(`${label}: expected a non-empty string.`);
|
|
136
|
+
}
|
|
137
|
+
return value.trim();
|
|
138
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type NativeTestPostgresFallback } from "../runtime/native-test-postgres-fallback.js";
|
|
2
1
|
export declare const managedAttemptToolNames: readonly ["forge.run_managed_command", "run_managed_command", "forge.start_managed_command", "start_managed_command", "forge.get_managed_command", "get_managed_command", "forge.wait_managed_command", "wait_managed_command", "forge.start_managed_verification", "start_managed_verification", "forge.reset_generated_outputs", "reset_generated_outputs"];
|
|
3
2
|
/**
|
|
4
3
|
* Stops every managed command this MCP server started, proves each process tree stopped,
|
|
@@ -45,11 +44,5 @@ export declare function buildManagedVerificationCommand(profile: string, outputD
|
|
|
45
44
|
export declare function preferredPowerShellExecutable(platform?: NodeJS.Platform, pathValue?: string): string;
|
|
46
45
|
export declare function validatePlaywrightProjectName(project: string, availableProjects: readonly string[]): void;
|
|
47
46
|
export declare function playwrightProjectNamesFromConfigSource(source: string): readonly string[];
|
|
48
|
-
/**
|
|
49
|
-
* Runner-authored verification normally uses its attempt-owned Testcontainers
|
|
50
|
-
* database. Only when the Docker engine is unavailable does it switch to the
|
|
51
|
-
* operator-provisioned native test cluster, which holds no real data.
|
|
52
|
-
*/
|
|
53
|
-
export declare function managedVerificationDatabaseEnvironment(dockerAvailable?: () => Promise<boolean>, readFallback?: () => NativeTestPostgresFallback | null): Promise<Readonly<Record<string, string>>>;
|
|
54
47
|
export declare function isBuildProducingManagedCommand(command: string, args: readonly string[]): boolean;
|
|
55
48
|
export {};
|
|
@@ -3,10 +3,9 @@ import fs from "node:fs/promises";
|
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { resetGeneratedOutputs } from "../runtime/generated-output-reset.js";
|
|
6
|
-
import { DockerEngineProbe } from "../runtime/docker-engine-probe.js";
|
|
7
6
|
import { attemptDatabaseCapabilityEnvironment, attemptDatabaseCapabilitySecrets, } from "../runtime/attempt-database-broker.js";
|
|
8
7
|
import { assertHostDatabaseCapabilityBoundary } from "../runtime/host-database-capability-boundary.js";
|
|
9
|
-
import {
|
|
8
|
+
import { managedVerificationDatabase, noManagedVerificationDatabase, releaseManagedVerificationDatabase, setUpWithManagedVerificationDatabase } from "../runtime/ephemeral-test-postgres-grant.js";
|
|
10
9
|
import { redactText } from "../shared/redaction/redaction.js";
|
|
11
10
|
import { emptyToolInputHint, isEmptyToolInput } from "./mcp-argument-coercion.js";
|
|
12
11
|
import { ManagedBuildCoordinator } from "./managed-build-coordinator.js";
|
|
@@ -14,7 +13,7 @@ import { attachManagedCommandProcess, ManagedCommandHostCapacity, } from "./mana
|
|
|
14
13
|
import { HostCapacityLedgerUnavailableError } from "../runtime/host-load-ledger-lock.js";
|
|
15
14
|
import { isProcessTreeTerminationUnproven } from "../shared/process/process.js";
|
|
16
15
|
import { HostCapacityTokenFencedError } from "../runtime/host-load-token-ledger.js";
|
|
17
|
-
import {
|
|
16
|
+
import { withoutHostLoadGovernorVariables } from "../runtime/host-load-child-environment.js";
|
|
18
17
|
import { managedBuildConfiguration, publishManagedBuildReceipt, verifyManagedBuildReceipt, } from "./managed-build-receipt.js";
|
|
19
18
|
import { managedLongTierTimeoutMs, managedMaximumCommandTimeoutMs, managedVerificationTierTimeoutMs, } from "./managed-verification-timeouts.js";
|
|
20
19
|
import { resolveWindowsCommandFromPath, StreamingProviderProcessRunner } from "./provider-cli/provider-cli.process.js";
|
|
@@ -447,7 +446,7 @@ export function buildManagedVerificationCommand(profile, outputDirectory, shardC
|
|
|
447
446
|
export function preferredPowerShellExecutable(platform = process.platform, pathValue = process.env.PATH ?? "") {
|
|
448
447
|
if (platform !== "win32")
|
|
449
448
|
return "pwsh";
|
|
450
|
-
return resolveWindowsCommandFromPath("pwsh.exe", pathValue) ?? "powershell.exe";
|
|
449
|
+
return resolveWindowsCommandFromPath("pwsh.exe", pathValue, undefined, { skipAppExecutionAliases: true }) ?? "powershell.exe";
|
|
451
450
|
}
|
|
452
451
|
export function validatePlaywrightProjectName(project, availableProjects) {
|
|
453
452
|
if (!availableProjects.includes(project)) {
|
|
@@ -594,41 +593,48 @@ async function executeManagedCommand(invocation) {
|
|
|
594
593
|
return managedCommandPublicResult(receipt);
|
|
595
594
|
}
|
|
596
595
|
}
|
|
596
|
+
/** A command's environment and redaction list; a setup that throws releases the database it started. */
|
|
597
597
|
async function managedCommandProcessEnvironment(invocation) {
|
|
598
598
|
assertHostDatabaseCapabilityBoundary();
|
|
599
|
-
const
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
599
|
+
const database = invocation.verificationProfile ? await managedVerificationDatabase() : noManagedVerificationDatabase;
|
|
600
|
+
return await setUpWithManagedVerificationDatabase(database, () => {
|
|
601
|
+
const exactSecrets = [
|
|
602
|
+
...database.secrets,
|
|
603
|
+
// The attempt's brokered database login reaches managed commands; their output never shows it.
|
|
604
|
+
...attemptDatabaseCapabilitySecrets(process.env[attemptDatabaseCapabilityEnvironment]),
|
|
605
|
+
];
|
|
606
|
+
const environment = inheritedEnvironment({
|
|
607
|
+
FORGE_RUNTIME_MODE: "host",
|
|
608
|
+
FORGE_RESOURCE_LEASE_ID: requiredAttemptEnvironment("FORGE_RESOURCE_LEASE_ID"),
|
|
609
|
+
FORGE_DISPATCH_ATTEMPT_ID: requiredAttemptEnvironment("FORGE_DISPATCH_ATTEMPT_ID"),
|
|
610
|
+
// This nested command owns a distinct supervisor identity. A command-local
|
|
611
|
+
// fence avoids exposing the parent attempt's fencing capability to Codex's
|
|
612
|
+
// MCP subprocess configuration while preserving exact-tree cleanup proof.
|
|
613
|
+
FORGE_FENCING_TOKEN: randomUUID(),
|
|
614
|
+
FORGE_LOG_DIR: invocation.logDirectory,
|
|
615
|
+
FORGE_TEST_OUTPUT_DIR: requiredAttemptEnvironment("FORGE_TEST_OUTPUT_DIR"),
|
|
616
|
+
FORGE_PROCESS_SUPERVISOR_ID: `managed-${invocation.commandId.replaceAll("-", "")}`,
|
|
617
|
+
FORGE_PROCESS_SUPERVISOR_METADATA_PATH: invocation.metadataPath,
|
|
618
|
+
...(invocation.verificationProfile
|
|
619
|
+
? {
|
|
620
|
+
FORGE_MANAGED_VERIFICATION_PROFILE: invocation.verificationProfile,
|
|
621
|
+
// Managed verification executes mutable worktree scripts, SDK targets,
|
|
622
|
+
// and test assemblies. It uses an attempt-owned container, or the
|
|
623
|
+
// dedicated native test cluster while Docker is unavailable; it never
|
|
624
|
+
// receives a capability for a server that holds real data.
|
|
625
|
+
FORGE_MANAGED_VERIFICATION_DATABASE_MODE: "container_only",
|
|
626
|
+
...database.environment,
|
|
627
|
+
}
|
|
628
|
+
: {}),
|
|
629
|
+
});
|
|
630
|
+
return { environment, exactSecrets, release: database.release };
|
|
630
631
|
});
|
|
631
|
-
|
|
632
|
+
}
|
|
633
|
+
function clearManagedCommandTimers(...timers) {
|
|
634
|
+
// clearTimeout and clearInterval share one timer table.
|
|
635
|
+
for (const timer of timers)
|
|
636
|
+
if (timer)
|
|
637
|
+
clearTimeout(timer);
|
|
632
638
|
}
|
|
633
639
|
async function executeManagedCommandProcess(invocation) {
|
|
634
640
|
let prepared;
|
|
@@ -830,11 +836,9 @@ async function executeManagedCommandProcess(invocation) {
|
|
|
830
836
|
return managedCommandPublicResult(receipt);
|
|
831
837
|
}
|
|
832
838
|
finally {
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
if (progressHeartbeat)
|
|
837
|
-
clearInterval(progressHeartbeat);
|
|
839
|
+
clearManagedCommandTimers(launchTimer, timer, progressHeartbeat);
|
|
840
|
+
// An ephemeral verification cluster lives exactly as long as its command; one that would not stop is reaped later and named in the receipt.
|
|
841
|
+
await releaseManagedVerificationDatabase(prepared, async (message) => await annotateManagedCommandReceipt(invocation.receiptPath, { ephemeral_cluster_release_error: redactText(message, exactSecrets) }));
|
|
838
842
|
}
|
|
839
843
|
}
|
|
840
844
|
async function readManagedCommand(input) {
|
|
@@ -907,7 +911,7 @@ async function waitManagedCommand(input) {
|
|
|
907
911
|
const lastOutputAt = Date.parse(String(receipt.structuredContent.last_output_at));
|
|
908
912
|
const hostLoadWaitMs = receipt.structuredContent.host_load_wait_ms;
|
|
909
913
|
const progress = receipt.structuredContent.status === "waiting_for_host_capacity" && typeof hostLoadWaitMs === "number"
|
|
910
|
-
? ` It has waited ${Math.round(hostLoadWaitMs / 1000)}s for host capacity and has not started yet; its timeout starts only once it is admitted, so queue time never counts against it. Keep waiting; a queued command is not a blocker.`
|
|
914
|
+
? ` It has waited ${Math.round(hostLoadWaitMs / 1000)}s for host capacity${typeof receipt.structuredContent.host_load_wait_detail === "string" ? ` (${receipt.structuredContent.host_load_wait_detail})` : ""} and has not started yet; its timeout starts only once it is admitted, so queue time never counts against it. Keep waiting; a queued command is not a blocker.`
|
|
911
915
|
: receipt.structuredContent.status === "running" && typeof elapsedMs === "number"
|
|
912
916
|
? ` It has run for ${Math.round(elapsedMs / 1000)}s`
|
|
913
917
|
+ (Number.isFinite(lastOutputAt) ? `, last output ${Math.max(0, Math.round((Date.now() - lastOutputAt) / 1000))}s ago` : ", with no output yet")
|
|
@@ -1033,7 +1037,7 @@ function managedCommandHostLoadReceipt(hostLoad) {
|
|
|
1033
1037
|
return {
|
|
1034
1038
|
host_load_step_class: hostLoad.stepClass,
|
|
1035
1039
|
host_load_wait_ms: waiting ? Math.max(0, Date.now() - hostLoad.waitStartedAt) : hostLoad.waitMs,
|
|
1036
|
-
...(waiting ? { host_load_wait_started_at: new Date(hostLoad.waitStartedAt).toISOString() } : {}),
|
|
1040
|
+
...(waiting ? { host_load_wait_started_at: new Date(hostLoad.waitStartedAt).toISOString(), host_load_wait_detail: hostLoad.waitDetail ?? null } : {}),
|
|
1037
1041
|
};
|
|
1038
1042
|
}
|
|
1039
1043
|
async function annotateManagedCommandReceipt(receiptPath, fields) {
|
|
@@ -1115,30 +1119,15 @@ async function containedWorkingDirectory(worktreePath, input) {
|
|
|
1115
1119
|
}
|
|
1116
1120
|
function inheritedEnvironment(overrides) {
|
|
1117
1121
|
const env = {};
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
continue;
|
|
1122
|
+
// A nested Forge process must not join the host ledger: it would queue behind the
|
|
1123
|
+
// token this command already holds. Every FORGE_HOST_LOAD_* variable is dropped,
|
|
1124
|
+
// the test slot count too (decision 0018).
|
|
1125
|
+
for (const [key, value] of Object.entries(withoutHostLoadGovernorVariables(process.env))) {
|
|
1123
1126
|
if (typeof value === "string" && !looksSensitiveEnvironmentName(key))
|
|
1124
1127
|
env[key] = value;
|
|
1125
1128
|
}
|
|
1126
1129
|
return { ...env, ...overrides };
|
|
1127
1130
|
}
|
|
1128
|
-
/**
|
|
1129
|
-
* Runner-authored verification normally uses its attempt-owned Testcontainers
|
|
1130
|
-
* database. Only when the Docker engine is unavailable does it switch to the
|
|
1131
|
-
* operator-provisioned native test cluster, which holds no real data.
|
|
1132
|
-
*/
|
|
1133
|
-
export async function managedVerificationDatabaseEnvironment(dockerAvailable = async () => (await new DockerEngineProbe().refresh(true)).available, readFallback = () => {
|
|
1134
|
-
const configPath = process.env[nativeTestPostgresFallbackConfigEnvironment]?.trim();
|
|
1135
|
-
return configPath ? readNativeTestPostgresFallback(configPath) : null;
|
|
1136
|
-
}) {
|
|
1137
|
-
const fallback = readFallback();
|
|
1138
|
-
if (!fallback || await dockerAvailable())
|
|
1139
|
-
return {};
|
|
1140
|
-
return nativeTestPostgresFallbackEnvironment(fallback);
|
|
1141
|
-
}
|
|
1142
1131
|
export function isBuildProducingManagedCommand(command, args) {
|
|
1143
1132
|
const executable = path.basename(command).toLowerCase();
|
|
1144
1133
|
if (executable === "dotnet" || executable === "dotnet.exe") {
|
|
@@ -8,6 +8,8 @@ export interface ManagedCommandHostLoadFields {
|
|
|
8
8
|
readonly waitMs: number;
|
|
9
9
|
/** Set while the command is still queued: the receipt reports the wait so far. */
|
|
10
10
|
readonly waitStartedAt?: number;
|
|
11
|
+
/** Why it waits, for example for the host test slot and who holds it (decision 0018). */
|
|
12
|
+
readonly waitDetail?: string;
|
|
11
13
|
/** When the command was admitted; elapsed_ms counts from here. */
|
|
12
14
|
readonly executionStartedAt?: number;
|
|
13
15
|
}
|
|
@@ -45,11 +45,12 @@ export class ManagedCommandHostCapacity {
|
|
|
45
45
|
signal,
|
|
46
46
|
// The receipt says host_capacity_token_fenced itself (termination_reason).
|
|
47
47
|
reportsOwnFence: true,
|
|
48
|
-
onWaiting:
|
|
48
|
+
onWaiting: decision => {
|
|
49
49
|
this.waitingWrite = this.persistWaiting({
|
|
50
50
|
stepClass: this.classification.stepClass,
|
|
51
51
|
waitMs: 0,
|
|
52
52
|
waitStartedAt: this.requestedAtMs ?? Date.now(),
|
|
53
|
+
waitDetail: decision.detail,
|
|
53
54
|
}).catch(() => undefined);
|
|
54
55
|
},
|
|
55
56
|
onReleaseFailed,
|
|
@@ -2,7 +2,7 @@ import crypto from "node:crypto";
|
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { redactSecrets } from "../shared/redaction/redaction.js";
|
|
5
|
-
import { ensureNoSymbolicLinkPathSegments, isPathUnderRoot, sha256File } from "./qa-sidecar-validation.js";
|
|
5
|
+
import { assertQaSidecarJsonShape, ensureNoSymbolicLinkPathSegments, isPathUnderRoot, sha256File } from "./qa-sidecar-validation.js";
|
|
6
6
|
import { assertClaimedChangedFilesMatchPublishableDiff } from "./publishable-worktree-changes.js";
|
|
7
7
|
import { coerceJsonStringArguments } from "./mcp-argument-coercion.js";
|
|
8
8
|
import { toolInputSchema } from "./phase-completion.schemas.js";
|
|
@@ -690,6 +690,7 @@ async function validateQaSidecarReferences(worktreePath, workItemId, sidecars, o
|
|
|
690
690
|
if (actualHash !== normalizeSha256ContentHash(contentHash)) {
|
|
691
691
|
throw new Error(`sidecars[${index}].content_hash does not match the referenced file.`);
|
|
692
692
|
}
|
|
693
|
+
await assertQaSidecarJsonShape(fullPath, sidecarPath, `sidecars[${index}]`);
|
|
693
694
|
const canonicalPath = path.relative(worktreePath, fullPath).split(path.sep).join("/");
|
|
694
695
|
const duplicateKey = canonicalPath.toLowerCase();
|
|
695
696
|
const existing = validatedByPath.get(duplicateKey);
|
|
@@ -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";
|
|
@@ -31,6 +32,12 @@ export interface CompletionToolRuntimeOptions {
|
|
|
31
32
|
readonly runtimeEnvironment?: Readonly<Record<string, string>>;
|
|
32
33
|
/** Host load governor variables; only the MCP server receives them. */
|
|
33
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;
|
|
34
41
|
}
|
|
35
42
|
export interface CompletionToolServerConfig {
|
|
36
43
|
readonly worktreePath: string;
|
|
@@ -46,6 +53,7 @@ export interface CompletionToolServerConfig {
|
|
|
46
53
|
readonly architectCycle?: boolean;
|
|
47
54
|
readonly draftCycle?: boolean;
|
|
48
55
|
readonly decomposeCycle?: boolean;
|
|
56
|
+
readonly managedToolsOnly?: boolean;
|
|
49
57
|
}
|
|
50
58
|
export interface CompletionToolCallResult {
|
|
51
59
|
readonly content: readonly {
|
|
@@ -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"];
|
|
@@ -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
|
+
};
|