@claudexor/orchestrator 2.1.2 → 3.0.0
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/attemptTelemetry.d.ts +9 -0
- package/dist/attemptTelemetry.d.ts.map +1 -1
- package/dist/attemptTelemetry.js +25 -0
- package/dist/attemptTelemetry.js.map +1 -1
- package/dist/attemptUsage.d.ts +19 -0
- package/dist/attemptUsage.d.ts.map +1 -0
- package/dist/attemptUsage.js +29 -0
- package/dist/attemptUsage.js.map +1 -0
- package/dist/candidateEvidence.d.ts +22 -0
- package/dist/candidateEvidence.d.ts.map +1 -0
- package/dist/candidateEvidence.js +40 -0
- package/dist/candidateEvidence.js.map +1 -0
- package/dist/candidateOutputs.d.ts +56 -0
- package/dist/candidateOutputs.d.ts.map +1 -0
- package/dist/candidateOutputs.js +209 -0
- package/dist/candidateOutputs.js.map +1 -0
- package/dist/continuity-facts.d.ts +37 -0
- package/dist/continuity-facts.d.ts.map +1 -0
- package/dist/continuity-facts.js +100 -0
- package/dist/continuity-facts.js.map +1 -0
- package/dist/continuity-summary.d.ts +45 -0
- package/dist/continuity-summary.d.ts.map +1 -0
- package/dist/continuity-summary.js +113 -0
- package/dist/continuity-summary.js.map +1 -0
- package/dist/continuity.d.ts +119 -0
- package/dist/continuity.d.ts.map +1 -0
- package/dist/continuity.js +220 -0
- package/dist/continuity.js.map +1 -0
- package/dist/contract-gates.d.ts +2 -3
- package/dist/contract-gates.d.ts.map +1 -1
- package/dist/contract-gates.js +2 -3
- package/dist/contract-gates.js.map +1 -1
- package/dist/council.d.ts +57 -0
- package/dist/council.d.ts.map +1 -0
- package/dist/council.js +98 -0
- package/dist/council.js.map +1 -0
- package/dist/credential-profiles.d.ts +37 -1
- package/dist/credential-profiles.d.ts.map +1 -1
- package/dist/credential-profiles.js +111 -3
- package/dist/credential-profiles.js.map +1 -1
- package/dist/diffReview.d.ts +3 -0
- package/dist/diffReview.d.ts.map +1 -1
- package/dist/diffReview.js +3 -0
- package/dist/diffReview.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/orchestrator.d.ts +218 -62
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +1078 -1236
- package/dist/orchestrator.js.map +1 -1
- package/dist/planQuestions.d.ts +11 -0
- package/dist/planQuestions.d.ts.map +1 -0
- package/dist/planQuestions.js +119 -0
- package/dist/planQuestions.js.map +1 -0
- package/dist/planRun.d.ts +114 -0
- package/dist/planRun.d.ts.map +1 -0
- package/dist/planRun.js +346 -0
- package/dist/planRun.js.map +1 -0
- package/dist/runSupport.d.ts +31 -80
- package/dist/runSupport.d.ts.map +1 -1
- package/dist/runSupport.js +33 -106
- package/dist/runSupport.js.map +1 -1
- package/dist/runTerminals.d.ts.map +1 -1
- package/dist/runTerminals.js +18 -7
- package/dist/runTerminals.js.map +1 -1
- package/package.json +18 -19
- package/dist/orchestrateExecutor.d.ts +0 -43
- package/dist/orchestrateExecutor.d.ts.map +0 -1
- package/dist/orchestrateExecutor.js +0 -207
- package/dist/orchestrateExecutor.js.map +0 -1
- package/dist/orchestratePlanner.d.ts +0 -12
- package/dist/orchestratePlanner.d.ts.map +0 -1
- package/dist/orchestratePlanner.js +0 -91
- package/dist/orchestratePlanner.js.map +0 -1
- package/dist/outcomeReducer.d.ts +0 -25
- package/dist/outcomeReducer.d.ts.map +0 -1
- package/dist/outcomeReducer.js +0 -121
- package/dist/outcomeReducer.js.map +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PlanQuestion } from "@claudexor/schema";
|
|
2
|
+
/** Parse the whole plan text; returns the best-scoring Open Questions block.
|
|
3
|
+
* A plan can contain SEVERAL such headings (the echoed prompt template, the
|
|
4
|
+
* real section, appended diagnostics) — parse every block and pick the one
|
|
5
|
+
* with the most STRUCTURED (tagged single/multi) questions; the echoed
|
|
6
|
+
* instruction block is skipped outright by its signature. */
|
|
7
|
+
export declare function extractPlanQuestions(plan: string): {
|
|
8
|
+
parse: "found" | "none_found";
|
|
9
|
+
questions: PlanQuestion[];
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=planQuestions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planQuestions.d.ts","sourceRoot":"","sources":["../src/planQuestions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AA+BtD;;;;6DAI6D;AAC7D,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG;IAClD,KAAK,EAAE,OAAO,GAAG,YAAY,CAAC;IAC9B,SAAS,EAAE,YAAY,EAAE,CAAC;CAC3B,CAwCA"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Engine-owned parser for the planner's tagged `## Open Questions` block
|
|
3
|
+
* (ported from the retired spec-interview grounding parser; the plan
|
|
4
|
+
* lifecycle is its sole owner now). Parsing is TOLERANT so the loop degrades
|
|
5
|
+
* gracefully: an untagged bullet with no `::` becomes a free-text question;
|
|
6
|
+
* an untagged bullet WITH 2+ options defaults to single-choice; a tagged
|
|
7
|
+
* choice with no options falls back to text; `(none)` bullets are skipped.
|
|
8
|
+
* This is plain delimiter parsing of the harness's own structured output (a
|
|
9
|
+
* data shape we instructed), not a governance signal (INV-049).
|
|
10
|
+
*/
|
|
11
|
+
const QUESTION_KINDS = new Set(["single", "multi", "text"]);
|
|
12
|
+
function isMarkdownHeading(line) {
|
|
13
|
+
return /^#{1,6}\s+\S/.test(line);
|
|
14
|
+
}
|
|
15
|
+
function markdownHeadingText(line) {
|
|
16
|
+
return line.replace(/^#{1,6}\s+/, "").trim();
|
|
17
|
+
}
|
|
18
|
+
function isNoneBullet(body) {
|
|
19
|
+
return /^\(?none\)?\.?$/i.test(body.trim());
|
|
20
|
+
}
|
|
21
|
+
function isPlaceholder(text) {
|
|
22
|
+
return /^<[^<>]+>$/.test(text.trim());
|
|
23
|
+
}
|
|
24
|
+
/** Parse the whole plan text; returns the best-scoring Open Questions block.
|
|
25
|
+
* A plan can contain SEVERAL such headings (the echoed prompt template, the
|
|
26
|
+
* real section, appended diagnostics) — parse every block and pick the one
|
|
27
|
+
* with the most STRUCTURED (tagged single/multi) questions; the echoed
|
|
28
|
+
* instruction block is skipped outright by its signature. */
|
|
29
|
+
export function extractPlanQuestions(plan) {
|
|
30
|
+
const lines = plan.split("\n");
|
|
31
|
+
const blocks = [];
|
|
32
|
+
let sawHeading = false;
|
|
33
|
+
for (let i = 0; i < lines.length; i++) {
|
|
34
|
+
const t = (lines[i] ?? "").trim();
|
|
35
|
+
if (!isMarkdownHeading(t))
|
|
36
|
+
continue;
|
|
37
|
+
if (!markdownHeadingText(t).toLowerCase().includes("open questions"))
|
|
38
|
+
continue;
|
|
39
|
+
sawHeading = true;
|
|
40
|
+
const blockLines = [];
|
|
41
|
+
for (const raw of lines.slice(i + 1)) {
|
|
42
|
+
if (isMarkdownHeading(raw.trim()))
|
|
43
|
+
break;
|
|
44
|
+
blockLines.push(raw);
|
|
45
|
+
}
|
|
46
|
+
if (blockLines.some((l) => {
|
|
47
|
+
const low = l.toLowerCase();
|
|
48
|
+
return (low.includes("in exactly this format") || low.includes("[single] = pick exactly one"));
|
|
49
|
+
})) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
blocks.push(parseQuestionBullets(blockLines));
|
|
53
|
+
}
|
|
54
|
+
let best = [];
|
|
55
|
+
let bestScore = [-1, -1];
|
|
56
|
+
for (const qs of blocks) {
|
|
57
|
+
const tagged = qs.filter((q) => q.kind === "single" || q.kind === "multi").length;
|
|
58
|
+
const score = [tagged, qs.length];
|
|
59
|
+
if (score[0] > bestScore[0] || (score[0] === bestScore[0] && score[1] > bestScore[1])) {
|
|
60
|
+
bestScore = score;
|
|
61
|
+
best = qs;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// A heading with only "(none)" bullets is a FOUND block with zero questions
|
|
65
|
+
// (ready); no heading at all is none_found (unverified — disclosed, never
|
|
66
|
+
// silently ready).
|
|
67
|
+
return { parse: sawHeading ? "found" : "none_found", questions: best };
|
|
68
|
+
}
|
|
69
|
+
function parseQuestionBullets(blockLines) {
|
|
70
|
+
const questions = [];
|
|
71
|
+
for (const raw of blockLines) {
|
|
72
|
+
const line = raw.trim();
|
|
73
|
+
if (!line.startsWith("- ") && !line.startsWith("* "))
|
|
74
|
+
continue;
|
|
75
|
+
let body = line.slice(2).trim();
|
|
76
|
+
if (isNoneBullet(body))
|
|
77
|
+
continue;
|
|
78
|
+
let kind = "text";
|
|
79
|
+
let kindTagged = false;
|
|
80
|
+
if (body.startsWith("[")) {
|
|
81
|
+
const close = body.indexOf("]");
|
|
82
|
+
if (close > 0) {
|
|
83
|
+
const tag = body.slice(1, close).trim().toLowerCase();
|
|
84
|
+
if (QUESTION_KINDS.has(tag)) {
|
|
85
|
+
kind = tag;
|
|
86
|
+
kindTagged = true;
|
|
87
|
+
body = body.slice(close + 1).trim();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (isNoneBullet(body))
|
|
92
|
+
continue;
|
|
93
|
+
const segments = body
|
|
94
|
+
.split("::")
|
|
95
|
+
.map((p) => p.trim())
|
|
96
|
+
.filter((p) => p.length > 0);
|
|
97
|
+
const splitAsChoice = kindTagged ? segments.length > 1 : segments.length >= 3;
|
|
98
|
+
const promptText = splitAsChoice ? (segments[0] ?? "") : body;
|
|
99
|
+
if (!promptText || isPlaceholder(promptText))
|
|
100
|
+
continue;
|
|
101
|
+
const options = (splitAsChoice ? segments.slice(1) : [])
|
|
102
|
+
.filter((label) => !isPlaceholder(label))
|
|
103
|
+
.map((label, i) => ({ id: `o${i + 1}`, label }));
|
|
104
|
+
if (!kindTagged)
|
|
105
|
+
kind = options.length > 0 ? "single" : "text";
|
|
106
|
+
if (kind !== "text" && options.length === 0)
|
|
107
|
+
kind = "text";
|
|
108
|
+
const isText = kind === "text";
|
|
109
|
+
questions.push({
|
|
110
|
+
id: `q${questions.length + 1}`,
|
|
111
|
+
kind,
|
|
112
|
+
prompt: promptText,
|
|
113
|
+
options: isText ? [] : options,
|
|
114
|
+
allow_text: isText,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return questions;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=planQuestions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planQuestions.js","sourceRoot":"","sources":["../src/planQuestions.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAE5D,SAAS,iBAAiB,CAAC,IAAY;IACrC,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAY;IACvC,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AAC/C,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AACxC,CAAC;AAED;;;;6DAI6D;AAC7D,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAI/C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,MAAM,GAAqB,EAAE,CAAC;IACpC,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,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AAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QACnD,IAAI,CAAC,UAAU;YAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;QAC/D,IAAI,IAAI,KAAK,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,IAAI,GAAG,MAAM,CAAC;QAC3D,MAAM,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC;QAC/B,SAAS,CAAC,IAAI,CAAC;YACb,EAAE,EAAE,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9B,IAAI;YACJ,MAAM,EAAE,UAAU;YAClB,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO;YAC9B,UAAU,EAAE,MAAM;SACnB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { type CouncilProjection, type ModeKind, type TaskContract } from "@claudexor/schema";
|
|
2
|
+
import { ArtifactStore, type RunPaths } from "@claudexor/artifact-store";
|
|
3
|
+
import { EventLog } from "@claudexor/event-log";
|
|
4
|
+
import { BudgetLedger } from "@claudexor/budget";
|
|
5
|
+
import type { AttemptTelemetry } from "./attemptTelemetry.js";
|
|
6
|
+
import type { OrchestratorResult, PlannerAttemptArgs, PlannerAttemptOutcome, RoutedAdapter, RunInput } from "./orchestrator.js";
|
|
7
|
+
/**
|
|
8
|
+
* Council plan strategy (INV-031 / D31) + the shared plan-run finalize/failure
|
|
9
|
+
* tails, extracted from orchestrator.ts so the god-file does not absorb the new
|
|
10
|
+
* behavior (complexity ratchet). These are FREE functions that receive the few
|
|
11
|
+
* orchestrator methods they need via `PlanRunDeps`; every other collaborator is
|
|
12
|
+
* a module-level import, identical to what the orchestrator used inline.
|
|
13
|
+
*/
|
|
14
|
+
export interface PlanRunDeps {
|
|
15
|
+
/** One planner spawn (native plan mode, read-only) — the SAME machinery the
|
|
16
|
+
* solo plan loop drives; council reuses it per member + for the merge. */
|
|
17
|
+
runPlannerAttempt(args: PlannerAttemptArgs): Promise<PlannerAttemptOutcome>;
|
|
18
|
+
/** Persist the run telemetry artifact (auth-preference resolution lives on
|
|
19
|
+
* the orchestrator, so this stays a bound method). */
|
|
20
|
+
writeRunTelemetry(store: ArtifactStore, paths: RunPaths, contract: TaskContract, runId: string, taskId: string, mode: ModeKind, attempts: {
|
|
21
|
+
attemptId: string;
|
|
22
|
+
harnessId: string;
|
|
23
|
+
telemetry: AttemptTelemetry;
|
|
24
|
+
}[], finalAttemptId: string | null): void;
|
|
25
|
+
/** The tree the harness executes in (project vs. isolated thread worktree). */
|
|
26
|
+
execRootOf(input: RunInput): string;
|
|
27
|
+
/** The solo planner prompt (native plan-mode template with the tagged Open
|
|
28
|
+
* Questions block); council members draft with the same prompt. */
|
|
29
|
+
planPrompt(goal: string): string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Council plan strategy (INV-031 / D31). Round 1: every member drafts a plan
|
|
33
|
+
* in parallel, REUSING the same planner spawn (native plan mode, read-only,
|
|
34
|
+
* own lane home on a thread turn). Drafts land as file-backed run artifacts.
|
|
35
|
+
* Merge: ONE extra planner iteration on the PRIMARY (intent=synthesize) whose
|
|
36
|
+
* prompt POINTS at the surviving draft files by absolute path — the tagged
|
|
37
|
+
* Open-Questions parser then runs on the MERGE output only, producing the
|
|
38
|
+
* same final artifacts a solo plan produces (downstream unchanged). A failed
|
|
39
|
+
* member is disclosed and the merge proceeds with survivors; ALL members
|
|
40
|
+
* failing is a typed failure.
|
|
41
|
+
*/
|
|
42
|
+
export declare function runCouncilPlan(deps: PlanRunDeps, args: {
|
|
43
|
+
input: RunInput;
|
|
44
|
+
contract: TaskContract;
|
|
45
|
+
taskId: string;
|
|
46
|
+
runId: string;
|
|
47
|
+
store: ArtifactStore;
|
|
48
|
+
paths: RunPaths;
|
|
49
|
+
log: EventLog;
|
|
50
|
+
ledger: BudgetLedger;
|
|
51
|
+
adapters: RoutedAdapter[];
|
|
52
|
+
roHome: {
|
|
53
|
+
env: Record<string, string>;
|
|
54
|
+
dispose: () => void;
|
|
55
|
+
};
|
|
56
|
+
contextSection: string;
|
|
57
|
+
laneRun: boolean;
|
|
58
|
+
}): Promise<OrchestratorResult>;
|
|
59
|
+
/** Write final plan artifacts (plan.md, questions.json, work_product,
|
|
60
|
+
* summary, telemetry) and the terminal event, then return the result. ONE
|
|
61
|
+
* owner for both the solo and council success tails so the artifacts are
|
|
62
|
+
* shape-identical (downstream readiness/freeze/implement never branch). */
|
|
63
|
+
export declare function finalizePlanRun(deps: PlanRunDeps, args: {
|
|
64
|
+
input: RunInput;
|
|
65
|
+
contract: TaskContract;
|
|
66
|
+
taskId: string;
|
|
67
|
+
runId: string;
|
|
68
|
+
store: ArtifactStore;
|
|
69
|
+
paths: RunPaths;
|
|
70
|
+
log: EventLog;
|
|
71
|
+
ledger: BudgetLedger;
|
|
72
|
+
plans: {
|
|
73
|
+
id: string;
|
|
74
|
+
text: string;
|
|
75
|
+
}[];
|
|
76
|
+
planAttempts: {
|
|
77
|
+
attemptId: string;
|
|
78
|
+
harnessId: string;
|
|
79
|
+
status: "success" | "failed" | "blocked";
|
|
80
|
+
error: string | null;
|
|
81
|
+
}[];
|
|
82
|
+
attemptTelemetries: {
|
|
83
|
+
attemptId: string;
|
|
84
|
+
harnessId: string;
|
|
85
|
+
telemetry: AttemptTelemetry;
|
|
86
|
+
}[];
|
|
87
|
+
winnerAttemptId?: string | null;
|
|
88
|
+
council: CouncilProjection | null;
|
|
89
|
+
}): OrchestratorResult;
|
|
90
|
+
/** Shared typed-failure tail for a plan run where NO plan body was produced
|
|
91
|
+
* (every planner failed, or the council merge failed). Mirrors the solo
|
|
92
|
+
* plans.length===0 path so both surfaces disclose identically. */
|
|
93
|
+
export declare function writePlanHarnessFailure(deps: PlanRunDeps, ctx: {
|
|
94
|
+
input: RunInput;
|
|
95
|
+
contract: TaskContract;
|
|
96
|
+
taskId: string;
|
|
97
|
+
runId: string;
|
|
98
|
+
store: ArtifactStore;
|
|
99
|
+
paths: RunPaths;
|
|
100
|
+
log: EventLog;
|
|
101
|
+
ledger: BudgetLedger;
|
|
102
|
+
planAttempts: {
|
|
103
|
+
attemptId: string;
|
|
104
|
+
harnessId: string;
|
|
105
|
+
status: "success" | "failed" | "blocked";
|
|
106
|
+
error: string | null;
|
|
107
|
+
}[];
|
|
108
|
+
attemptTelemetries: {
|
|
109
|
+
attemptId: string;
|
|
110
|
+
harnessId: string;
|
|
111
|
+
telemetry: AttemptTelemetry;
|
|
112
|
+
}[];
|
|
113
|
+
}, fallbackMessage: string): OrchestratorResult;
|
|
114
|
+
//# sourceMappingURL=planRun.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planRun.d.ts","sourceRoot":"","sources":["../src/planRun.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,KAAK,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAW9D,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,aAAa,EACb,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAE3B;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B;8EAC0E;IAC1E,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAA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AI,CAAC;KACtB,EAAE,CAAC;IACJ,kBAAkB,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,gBAAgB,CAAA;KAAE,EAAE,CAAC;CAC7F,EACD,eAAe,EAAE,MAAM,GACtB,kBAAkB,CAmEpB"}
|
package/dist/planRun.js
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { PlanQuestionsArtifact, derivePlanReadiness, makeOutcomeFacts, } from "@claudexor/schema";
|
|
3
|
+
import { newId, redactSecrets } from "@claudexor/util";
|
|
4
|
+
import { cancelledResult, writeFailure } from "./runTerminals.js";
|
|
5
|
+
import { extractPlanQuestions } from "./planQuestions.js";
|
|
6
|
+
import { resolveReadOnlyRouteContext } from "./routeContext.js";
|
|
7
|
+
import { buildCouncilProjection, councilDegradationNote, councilDraftRelPath, councilMergePrompt, resolveCouncilWidth, } from "./council.js";
|
|
8
|
+
/**
|
|
9
|
+
* Council plan strategy (INV-031 / D31). Round 1: every member drafts a plan
|
|
10
|
+
* in parallel, REUSING the same planner spawn (native plan mode, read-only,
|
|
11
|
+
* own lane home on a thread turn). Drafts land as file-backed run artifacts.
|
|
12
|
+
* Merge: ONE extra planner iteration on the PRIMARY (intent=synthesize) whose
|
|
13
|
+
* prompt POINTS at the surviving draft files by absolute path — the tagged
|
|
14
|
+
* Open-Questions parser then runs on the MERGE output only, producing the
|
|
15
|
+
* same final artifacts a solo plan produces (downstream unchanged). A failed
|
|
16
|
+
* member is disclosed and the merge proceeds with survivors; ALL members
|
|
17
|
+
* failing is a typed failure.
|
|
18
|
+
*/
|
|
19
|
+
export async function runCouncilPlan(deps, args) {
|
|
20
|
+
const { input, contract, taskId, runId, store, paths, log, ledger, adapters, roHome } = args;
|
|
21
|
+
const planAttempts = [];
|
|
22
|
+
const attemptTelemetries = [];
|
|
23
|
+
// Distinct pool members, primary first (adapters are already ordered +
|
|
24
|
+
// deduped by resolveCandidateAdapters with n=undefined). Council never
|
|
25
|
+
// duplicates a harness into two members.
|
|
26
|
+
const { requested, members: memberCount } = resolveCouncilWidth(input.n, adapters.length);
|
|
27
|
+
const memberAdapters = adapters.slice(0, memberCount);
|
|
28
|
+
log.emit("council.started", {
|
|
29
|
+
requested,
|
|
30
|
+
members: memberAdapters.map((a) => a.adapter.id),
|
|
31
|
+
});
|
|
32
|
+
let drafts = [];
|
|
33
|
+
try {
|
|
34
|
+
// Round 1 — parallel drafts (each member = one planner attempt).
|
|
35
|
+
const outcomes = await Promise.all(memberAdapters.map((routed, idx) => deps.runPlannerAttempt({
|
|
36
|
+
input,
|
|
37
|
+
contract,
|
|
38
|
+
taskId,
|
|
39
|
+
runId,
|
|
40
|
+
log,
|
|
41
|
+
store,
|
|
42
|
+
paths,
|
|
43
|
+
ledger,
|
|
44
|
+
routed,
|
|
45
|
+
attemptId: `p${String(idx + 1).padStart(2, "0")}`,
|
|
46
|
+
laneRun: args.laneRun,
|
|
47
|
+
fallbackHome: roHome.env,
|
|
48
|
+
promptBody: deps.planPrompt(input.prompt) + args.contextSection,
|
|
49
|
+
intent: "plan",
|
|
50
|
+
})));
|
|
51
|
+
for (const [idx, outcome] of outcomes.entries()) {
|
|
52
|
+
const routed = memberAdapters[idx];
|
|
53
|
+
if (outcome.telemetry)
|
|
54
|
+
attemptTelemetries.push({
|
|
55
|
+
attemptId: outcome.attemptId,
|
|
56
|
+
harnessId: outcome.harnessId,
|
|
57
|
+
telemetry: outcome.telemetry,
|
|
58
|
+
});
|
|
59
|
+
planAttempts.push({
|
|
60
|
+
attemptId: outcome.attemptId,
|
|
61
|
+
harnessId: outcome.harnessId,
|
|
62
|
+
status: outcome.status,
|
|
63
|
+
error: outcome.error,
|
|
64
|
+
});
|
|
65
|
+
if (outcome.status === "success" && outcome.text) {
|
|
66
|
+
const rel = councilDraftRelPath(routed.adapter.id);
|
|
67
|
+
const absPath = join(paths.root, rel);
|
|
68
|
+
store.writeText(absPath, redactSecrets(outcome.text) + "\n");
|
|
69
|
+
drafts.push({ harnessId: routed.adapter.id, text: outcome.text, absPath });
|
|
70
|
+
log.emit("council.draft", { harness_id: routed.adapter.id, path: rel });
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
log.emit("council.member.failed", {
|
|
74
|
+
harness_id: outcome.harnessId,
|
|
75
|
+
attempt_id: outcome.attemptId,
|
|
76
|
+
error: outcome.error,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
// Round-1 planners done — reclaim the shared read-only route context BEFORE
|
|
83
|
+
// the merge (which spawns in the primary's own lane/route home again).
|
|
84
|
+
roHome.dispose();
|
|
85
|
+
}
|
|
86
|
+
if (input.signal?.aborted) {
|
|
87
|
+
return cancelledResult(log, runId, taskId, "plan", paths.root, planAttempts.map((p) => ({
|
|
88
|
+
attemptId: p.attemptId,
|
|
89
|
+
harnessId: p.harnessId,
|
|
90
|
+
status: p.status,
|
|
91
|
+
})), () => deps.writeRunTelemetry(store, paths, contract, runId, taskId, "plan", attemptTelemetries, null), ledger.spend(), input.signal, store);
|
|
92
|
+
}
|
|
93
|
+
// Degradation is honest: ALL members failed → typed failure (no plan to
|
|
94
|
+
// merge). One survivor still merges (normalizes format + extracts questions).
|
|
95
|
+
if (drafts.length === 0) {
|
|
96
|
+
return writePlanHarnessFailure(deps, {
|
|
97
|
+
input,
|
|
98
|
+
contract,
|
|
99
|
+
taskId,
|
|
100
|
+
runId,
|
|
101
|
+
store,
|
|
102
|
+
paths,
|
|
103
|
+
log,
|
|
104
|
+
ledger,
|
|
105
|
+
planAttempts,
|
|
106
|
+
attemptTelemetries,
|
|
107
|
+
}, "all council members failed");
|
|
108
|
+
}
|
|
109
|
+
// The merger is the primary when it survived round 1, else the first
|
|
110
|
+
// surviving member — degradation must not sink an otherwise-good council on
|
|
111
|
+
// a dead nominal primary. drafts.length > 0 guarantees a survivor exists.
|
|
112
|
+
const draftedIds = new Set(drafts.map((d) => d.harnessId));
|
|
113
|
+
const primary = memberAdapters.find((a) => draftedIds.has(a.adapter.id)) ??
|
|
114
|
+
memberAdapters[0];
|
|
115
|
+
const roHome2 = resolveReadOnlyRouteContext(deps.execRootOf(input));
|
|
116
|
+
let mergeOutcome;
|
|
117
|
+
try {
|
|
118
|
+
mergeOutcome = await deps.runPlannerAttempt({
|
|
119
|
+
input,
|
|
120
|
+
contract,
|
|
121
|
+
taskId,
|
|
122
|
+
runId,
|
|
123
|
+
log,
|
|
124
|
+
store,
|
|
125
|
+
paths,
|
|
126
|
+
ledger,
|
|
127
|
+
routed: primary,
|
|
128
|
+
attemptId: `p${String(memberCount + 1).padStart(2, "0")}`,
|
|
129
|
+
laneRun: args.laneRun,
|
|
130
|
+
fallbackHome: roHome2.env,
|
|
131
|
+
// The merge references the draft FILES by absolute path (pointer lines);
|
|
132
|
+
// full draft text never rides the prompt bubble.
|
|
133
|
+
promptBody: councilMergePrompt(input.prompt, drafts.map((d) => ({ harnessId: d.harnessId, absPath: d.absPath }))),
|
|
134
|
+
// D31: the merge is a synthesis iteration on the primary.
|
|
135
|
+
intent: "synthesize",
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
finally {
|
|
139
|
+
roHome2.dispose();
|
|
140
|
+
}
|
|
141
|
+
if (mergeOutcome.telemetry)
|
|
142
|
+
attemptTelemetries.push({
|
|
143
|
+
attemptId: mergeOutcome.attemptId,
|
|
144
|
+
harnessId: mergeOutcome.harnessId,
|
|
145
|
+
telemetry: mergeOutcome.telemetry,
|
|
146
|
+
});
|
|
147
|
+
planAttempts.push({
|
|
148
|
+
attemptId: mergeOutcome.attemptId,
|
|
149
|
+
harnessId: mergeOutcome.harnessId,
|
|
150
|
+
status: mergeOutcome.status,
|
|
151
|
+
error: mergeOutcome.error,
|
|
152
|
+
});
|
|
153
|
+
const mergedBy = mergeOutcome.status === "success" ? primary.adapter.id : null;
|
|
154
|
+
const councilProjection = buildCouncilProjection({
|
|
155
|
+
requested,
|
|
156
|
+
members: memberAdapters.map((a) => ({
|
|
157
|
+
harnessId: a.adapter.id,
|
|
158
|
+
role: a.adapter.id === primary.adapter.id ? "primary" : "member",
|
|
159
|
+
drafted: draftedIds.has(a.adapter.id),
|
|
160
|
+
error: planAttempts.find((p) => p.harnessId === a.adapter.id && p.error)?.error ?? null,
|
|
161
|
+
})),
|
|
162
|
+
mergedBy,
|
|
163
|
+
});
|
|
164
|
+
log.emit("council.merged", {
|
|
165
|
+
merged_by: mergedBy,
|
|
166
|
+
drafted: councilProjection.drafted,
|
|
167
|
+
requested: councilProjection.requested,
|
|
168
|
+
degraded: councilProjection.degraded,
|
|
169
|
+
});
|
|
170
|
+
if (mergeOutcome.status !== "success" || !mergeOutcome.text) {
|
|
171
|
+
// The merge itself failed despite surviving drafts — no unified plan
|
|
172
|
+
// exists. Fail typed; the drafts remain as disclosed artifacts.
|
|
173
|
+
store.writeYaml(join(paths.root, "council", "membership.yaml"), councilProjection);
|
|
174
|
+
return writePlanHarnessFailure(deps, {
|
|
175
|
+
input,
|
|
176
|
+
contract,
|
|
177
|
+
taskId,
|
|
178
|
+
runId,
|
|
179
|
+
store,
|
|
180
|
+
paths,
|
|
181
|
+
log,
|
|
182
|
+
ledger,
|
|
183
|
+
planAttempts,
|
|
184
|
+
attemptTelemetries,
|
|
185
|
+
}, `council merge failed: ${mergeOutcome.error ?? "the primary produced no unified plan"}`);
|
|
186
|
+
}
|
|
187
|
+
return finalizePlanRun(deps, {
|
|
188
|
+
input,
|
|
189
|
+
contract,
|
|
190
|
+
taskId,
|
|
191
|
+
runId,
|
|
192
|
+
store,
|
|
193
|
+
paths,
|
|
194
|
+
log,
|
|
195
|
+
ledger,
|
|
196
|
+
plans: [{ id: primary.adapter.id, text: mergeOutcome.text }],
|
|
197
|
+
planAttempts,
|
|
198
|
+
attemptTelemetries,
|
|
199
|
+
winnerAttemptId: mergeOutcome.attemptId,
|
|
200
|
+
council: councilProjection,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
/** Write final plan artifacts (plan.md, questions.json, work_product,
|
|
204
|
+
* summary, telemetry) and the terminal event, then return the result. ONE
|
|
205
|
+
* owner for both the solo and council success tails so the artifacts are
|
|
206
|
+
* shape-identical (downstream readiness/freeze/implement never branch). */
|
|
207
|
+
export function finalizePlanRun(deps, args) {
|
|
208
|
+
const { input, contract, taskId, runId, store, paths, log, ledger, plans, planAttempts, council, } = args;
|
|
209
|
+
const failedPlanners = planAttempts.filter((p) => p.status !== "success");
|
|
210
|
+
const winner = plans[0];
|
|
211
|
+
const winnerHarness = winner?.id ?? "(none)";
|
|
212
|
+
const winnerAttemptId = args.winnerAttemptId ?? planAttempts.find((p) => p.status === "success")?.attemptId ?? null;
|
|
213
|
+
// final/plan.md is the PURE plan body (the winning planner's / merger's own
|
|
214
|
+
// text): implement freezes and hashes THIS file, so wrapper prose lives in
|
|
215
|
+
// summary.md instead (advisor pass, V6a).
|
|
216
|
+
const planDoc = redactSecrets(winner?.text ?? "(no output)");
|
|
217
|
+
store.writeText(join(paths.finalDir, "plan.md"), planDoc + "\n");
|
|
218
|
+
// Engine-parsed open questions (final/questions.json): the ONE artifact
|
|
219
|
+
// plan readiness derives from. For council this runs on the MERGE output
|
|
220
|
+
// only — draft questions never leak into the final set.
|
|
221
|
+
const parsedQuestions = extractPlanQuestions(planDoc);
|
|
222
|
+
store.writeJson(join(paths.finalDir, "questions.json"), parsedQuestions);
|
|
223
|
+
if (council)
|
|
224
|
+
store.writeYaml(join(paths.root, "council", "membership.yaml"), council);
|
|
225
|
+
// A plan is a delivered work product (a report), even with risks — parity
|
|
226
|
+
// with the other read-only modes. result_kind=plan tells surfaces NO files
|
|
227
|
+
// changed.
|
|
228
|
+
store.writeYaml(join(paths.finalDir, "work_product.yaml"), {
|
|
229
|
+
id: newId("wp"),
|
|
230
|
+
kind: "report",
|
|
231
|
+
source_task_id: taskId,
|
|
232
|
+
producer_attempt_id: winnerAttemptId,
|
|
233
|
+
meta: {
|
|
234
|
+
mode: "plan",
|
|
235
|
+
result_kind: "plan",
|
|
236
|
+
planners: plans.length,
|
|
237
|
+
diffstat: { files: 0, additions: 0, deletions: 0 },
|
|
238
|
+
blockers: 0,
|
|
239
|
+
adopted: null,
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
const readiness = derivePlanReadiness(PlanQuestionsArtifact.parse(parsedQuestions));
|
|
243
|
+
const councilNote = council ? councilDegradationNote(council) : "";
|
|
244
|
+
store.writeText(join(paths.finalDir, "summary.md"), [
|
|
245
|
+
`# Run ${runId} (plan)`,
|
|
246
|
+
"",
|
|
247
|
+
`- Lifecycle: succeeded (plan only — no files changed)`,
|
|
248
|
+
council
|
|
249
|
+
? `- Council: merged by ${council.mergedBy ?? "(none)"} from ${council.drafted} of ${council.requested} member(s)`
|
|
250
|
+
: `- Planner: ${winnerHarness}`,
|
|
251
|
+
`- Plan: final/plan.md`,
|
|
252
|
+
`- Open questions: ${readiness.questionCount}${parsedQuestions.parse === "none_found" ? " (no tagged block — unverified)" : ""}`,
|
|
253
|
+
`- Goal: ${redactSecrets(input.prompt).slice(0, 400)}`,
|
|
254
|
+
...(councilNote ? [`- Council note: ${councilNote}`] : []),
|
|
255
|
+
...(failedPlanners.length > 0 && !council
|
|
256
|
+
? [
|
|
257
|
+
`- Fallback omissions: ${failedPlanners.map((p) => `${p.harnessId} ${p.status}`).join(", ")}`,
|
|
258
|
+
]
|
|
259
|
+
: []),
|
|
260
|
+
"",
|
|
261
|
+
].join("\n"));
|
|
262
|
+
deps.writeRunTelemetry(store, paths, contract, runId, taskId, "plan", args.attemptTelemetries, winnerAttemptId);
|
|
263
|
+
log.emit("output.ready", { kind: "plan", path: "final/plan.md" });
|
|
264
|
+
log.emit("plan.questions", {
|
|
265
|
+
parse: parsedQuestions.parse,
|
|
266
|
+
question_count: readiness.questionCount,
|
|
267
|
+
readiness: readiness.state,
|
|
268
|
+
});
|
|
269
|
+
const planFacts = makeOutcomeFacts("succeeded", { noChanges: true });
|
|
270
|
+
log.emit("run.completed", { lifecycle: planFacts.lifecycle, facts: planFacts, reason: null });
|
|
271
|
+
return {
|
|
272
|
+
spendUsd: ledger.spend(),
|
|
273
|
+
runId,
|
|
274
|
+
taskId,
|
|
275
|
+
mode: "plan",
|
|
276
|
+
lifecycle: planFacts.lifecycle,
|
|
277
|
+
facts: planFacts,
|
|
278
|
+
winner: null,
|
|
279
|
+
runDir: paths.root,
|
|
280
|
+
summary: `${council ? `Council plan (merged by ${winnerHarness})` : `Plan by ${winnerHarness}`}; ${readiness.questionCount} open question(s)${parsedQuestions.parse === "none_found" ? " (untagged plan — unverified)" : ""}.`,
|
|
281
|
+
candidates: planAttempts.map((p) => ({
|
|
282
|
+
attemptId: p.attemptId,
|
|
283
|
+
harnessId: p.harnessId,
|
|
284
|
+
status: p.status,
|
|
285
|
+
})),
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
/** Shared typed-failure tail for a plan run where NO plan body was produced
|
|
289
|
+
* (every planner failed, or the council merge failed). Mirrors the solo
|
|
290
|
+
* plans.length===0 path so both surfaces disclose identically. */
|
|
291
|
+
export function writePlanHarnessFailure(deps, ctx, fallbackMessage) {
|
|
292
|
+
const { input, contract, taskId, runId, store, paths, log, ledger, planAttempts } = ctx;
|
|
293
|
+
const blocked = planAttempts.some((p) => p.status === "blocked");
|
|
294
|
+
const message = planAttempts.map((p) => `${p.attemptId}/${p.harnessId}: ${p.error ?? "failed"}`).join("\n") ||
|
|
295
|
+
fallbackMessage;
|
|
296
|
+
deps.writeRunTelemetry(store, paths, contract, runId, taskId, "plan", ctx.attemptTelemetries, null);
|
|
297
|
+
store.writeText(join(paths.contextDir, "context_error.md"), `# Harness Error\n\n${message}\n`);
|
|
298
|
+
writeFailure(store, paths, {
|
|
299
|
+
phase: "harness",
|
|
300
|
+
category: blocked ? "policy" : "harness_error",
|
|
301
|
+
safeMessage: message,
|
|
302
|
+
eventRefs: planAttempts.map((p) => `attempts/${p.attemptId}/events.jsonl`),
|
|
303
|
+
runDir: paths.root,
|
|
304
|
+
nextActions: ["Open diagnostics", "Check harness authentication", "Retry after setup"],
|
|
305
|
+
});
|
|
306
|
+
store.writeText(join(paths.finalDir, "summary.md"), `# Run ${runId} (plan)\n\n- Lifecycle: ${blocked ? "succeeded (needs review)" : "failed"}\n\n${message}\n`);
|
|
307
|
+
log.emit("output.ready", { kind: "summary", path: "final/summary.md", state: "diagnostic" });
|
|
308
|
+
const planFailFacts = blocked
|
|
309
|
+
? makeOutcomeFacts("succeeded", { review: "blocked", reason: "review_blocked" })
|
|
310
|
+
: makeOutcomeFacts("failed", { reason: "harness_failed" });
|
|
311
|
+
if (blocked)
|
|
312
|
+
log.emit("run.blocked", {
|
|
313
|
+
lifecycle: planFailFacts.lifecycle,
|
|
314
|
+
facts: planFailFacts,
|
|
315
|
+
phase: "harness",
|
|
316
|
+
error: message,
|
|
317
|
+
failure_ref: "final/failure.yaml",
|
|
318
|
+
});
|
|
319
|
+
else
|
|
320
|
+
log.emit("run.failed", {
|
|
321
|
+
lifecycle: planFailFacts.lifecycle,
|
|
322
|
+
facts: planFailFacts,
|
|
323
|
+
reason: planFailFacts.reason,
|
|
324
|
+
phase: "harness",
|
|
325
|
+
error: message,
|
|
326
|
+
failure_ref: "final/failure.yaml",
|
|
327
|
+
});
|
|
328
|
+
void input;
|
|
329
|
+
return {
|
|
330
|
+
spendUsd: ledger.spend(),
|
|
331
|
+
runId,
|
|
332
|
+
taskId,
|
|
333
|
+
mode: "plan",
|
|
334
|
+
lifecycle: planFailFacts.lifecycle,
|
|
335
|
+
facts: planFailFacts,
|
|
336
|
+
winner: null,
|
|
337
|
+
runDir: paths.root,
|
|
338
|
+
summary: message,
|
|
339
|
+
candidates: planAttempts.map((p) => ({
|
|
340
|
+
attemptId: p.attemptId,
|
|
341
|
+
harnessId: p.harnessId,
|
|
342
|
+
status: p.status,
|
|
343
|
+
})),
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
//#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