agent-nuvira 3.1.3 → 3.2.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.
Files changed (146) hide show
  1. package/dist/agents/agents/reasoner.d.ts +8 -0
  2. package/dist/agents/agents/reasoner.d.ts.map +1 -1
  3. package/dist/agents/agents/reasoner.js +53 -2
  4. package/dist/agents/agents/reasoner.js.map +1 -1
  5. package/dist/agents/agents/writer.d.ts +24 -0
  6. package/dist/agents/agents/writer.d.ts.map +1 -1
  7. package/dist/agents/agents/writer.js +194 -0
  8. package/dist/agents/agents/writer.js.map +1 -1
  9. package/dist/agents/composite-plan.d.ts +143 -0
  10. package/dist/agents/composite-plan.d.ts.map +1 -0
  11. package/dist/agents/composite-plan.js +399 -0
  12. package/dist/agents/composite-plan.js.map +1 -0
  13. package/dist/agents/long-form-plan.d.ts +156 -0
  14. package/dist/agents/long-form-plan.d.ts.map +1 -0
  15. package/dist/agents/long-form-plan.js +274 -0
  16. package/dist/agents/long-form-plan.js.map +1 -0
  17. package/dist/agents/orchestrator.d.ts +107 -0
  18. package/dist/agents/orchestrator.d.ts.map +1 -1
  19. package/dist/agents/orchestrator.js +501 -35
  20. package/dist/agents/orchestrator.js.map +1 -1
  21. package/dist/agents/prompt-assembly.d.ts +8 -0
  22. package/dist/agents/prompt-assembly.d.ts.map +1 -1
  23. package/dist/agents/prompt-assembly.js +17 -0
  24. package/dist/agents/prompt-assembly.js.map +1 -1
  25. package/dist/cli/chat.d.ts +27 -0
  26. package/dist/cli/chat.d.ts.map +1 -1
  27. package/dist/cli/chat.js +116 -6
  28. package/dist/cli/chat.js.map +1 -1
  29. package/dist/cli/execute.d.ts +12 -0
  30. package/dist/cli/execute.d.ts.map +1 -1
  31. package/dist/cli/execute.js +105 -2
  32. package/dist/cli/execute.js.map +1 -1
  33. package/dist/cli/models.d.ts.map +1 -1
  34. package/dist/cli/models.js +10 -0
  35. package/dist/cli/models.js.map +1 -1
  36. package/dist/cli/trace.d.ts.map +1 -1
  37. package/dist/cli/trace.js +27 -0
  38. package/dist/cli/trace.js.map +1 -1
  39. package/dist/gateway/registry.d.ts +31 -0
  40. package/dist/gateway/registry.d.ts.map +1 -1
  41. package/dist/gateway/registry.js +143 -13
  42. package/dist/gateway/registry.js.map +1 -1
  43. package/dist/inference/model-entitlement.d.ts +46 -0
  44. package/dist/inference/model-entitlement.d.ts.map +1 -0
  45. package/dist/inference/model-entitlement.js +98 -0
  46. package/dist/inference/model-entitlement.js.map +1 -0
  47. package/dist/learning/autonomy-policy.d.ts +334 -0
  48. package/dist/learning/autonomy-policy.d.ts.map +1 -0
  49. package/dist/learning/autonomy-policy.js +500 -0
  50. package/dist/learning/autonomy-policy.js.map +1 -0
  51. package/dist/learning/credential-fingerprint.d.ts +58 -0
  52. package/dist/learning/credential-fingerprint.d.ts.map +1 -0
  53. package/dist/learning/credential-fingerprint.js +126 -0
  54. package/dist/learning/credential-fingerprint.js.map +1 -0
  55. package/dist/learning/deliverable-class.d.ts +130 -0
  56. package/dist/learning/deliverable-class.d.ts.map +1 -0
  57. package/dist/learning/deliverable-class.js +432 -0
  58. package/dist/learning/deliverable-class.js.map +1 -0
  59. package/dist/learning/long-form.d.ts +252 -0
  60. package/dist/learning/long-form.d.ts.map +1 -0
  61. package/dist/learning/long-form.js +510 -0
  62. package/dist/learning/long-form.js.map +1 -0
  63. package/dist/learning/model-first-router.d.ts +17 -0
  64. package/dist/learning/model-first-router.d.ts.map +1 -1
  65. package/dist/learning/model-first-router.js +27 -0
  66. package/dist/learning/model-first-router.js.map +1 -1
  67. package/dist/learning/model-registry.d.ts +66 -4
  68. package/dist/learning/model-registry.d.ts.map +1 -1
  69. package/dist/learning/model-registry.js +67 -6
  70. package/dist/learning/model-registry.js.map +1 -1
  71. package/dist/learning/model-warmup.d.ts +97 -2
  72. package/dist/learning/model-warmup.d.ts.map +1 -1
  73. package/dist/learning/model-warmup.js +165 -60
  74. package/dist/learning/model-warmup.js.map +1 -1
  75. package/dist/learning/prompt-layers.d.ts +61 -0
  76. package/dist/learning/prompt-layers.d.ts.map +1 -0
  77. package/dist/learning/prompt-layers.js +140 -0
  78. package/dist/learning/prompt-layers.js.map +1 -0
  79. package/dist/learning/provider-limits.d.ts +66 -0
  80. package/dist/learning/provider-limits.d.ts.map +1 -0
  81. package/dist/learning/provider-limits.js +184 -0
  82. package/dist/learning/provider-limits.js.map +1 -0
  83. package/dist/learning/reasoning-trace.d.ts +36 -1
  84. package/dist/learning/reasoning-trace.d.ts.map +1 -1
  85. package/dist/learning/reasoning-trace.js +36 -2
  86. package/dist/learning/reasoning-trace.js.map +1 -1
  87. package/dist/learning/resilient-call.d.ts +36 -1
  88. package/dist/learning/resilient-call.d.ts.map +1 -1
  89. package/dist/learning/resilient-call.js +80 -5
  90. package/dist/learning/resilient-call.js.map +1 -1
  91. package/dist/learning/unattended-job.d.ts +293 -0
  92. package/dist/learning/unattended-job.d.ts.map +1 -0
  93. package/dist/learning/unattended-job.js +544 -0
  94. package/dist/learning/unattended-job.js.map +1 -0
  95. package/dist/learning/unattended-progress.d.ts +95 -0
  96. package/dist/learning/unattended-progress.d.ts.map +1 -0
  97. package/dist/learning/unattended-progress.js +147 -0
  98. package/dist/learning/unattended-progress.js.map +1 -0
  99. package/dist/learning/working-state.d.ts +109 -0
  100. package/dist/learning/working-state.d.ts.map +1 -0
  101. package/dist/learning/working-state.js +244 -0
  102. package/dist/learning/working-state.js.map +1 -0
  103. package/dist/nlu/conversation-gate.d.ts +24 -0
  104. package/dist/nlu/conversation-gate.d.ts.map +1 -1
  105. package/dist/nlu/conversation-gate.js +47 -3
  106. package/dist/nlu/conversation-gate.js.map +1 -1
  107. package/dist/tools/coding-tools.d.ts.map +1 -1
  108. package/dist/tools/coding-tools.js +95 -19
  109. package/dist/tools/coding-tools.js.map +1 -1
  110. package/dist/tools/edit-verification.d.ts +125 -0
  111. package/dist/tools/edit-verification.d.ts.map +1 -0
  112. package/dist/tools/edit-verification.js +237 -0
  113. package/dist/tools/edit-verification.js.map +1 -0
  114. package/dist/tools/git-tool.d.ts.map +1 -1
  115. package/dist/tools/git-tool.js +37 -4
  116. package/dist/tools/git-tool.js.map +1 -1
  117. package/dist/tools/registry.d.ts +30 -2
  118. package/dist/tools/registry.d.ts.map +1 -1
  119. package/dist/tools/registry.js +40 -11
  120. package/dist/tools/registry.js.map +1 -1
  121. package/dist/tools/run-cli.d.ts.map +1 -1
  122. package/dist/tools/run-cli.js +40 -13
  123. package/dist/tools/run-cli.js.map +1 -1
  124. package/dist/tools/run-terminal.d.ts +6 -1
  125. package/dist/tools/run-terminal.d.ts.map +1 -1
  126. package/dist/tools/run-terminal.js +158 -18
  127. package/dist/tools/run-terminal.js.map +1 -1
  128. package/dist/tools/tool-loop.d.ts +35 -0
  129. package/dist/tools/tool-loop.d.ts.map +1 -1
  130. package/dist/tools/tool-loop.js +141 -1
  131. package/dist/tools/tool-loop.js.map +1 -1
  132. package/dist/web-dashboard/chat-console.d.ts +6 -0
  133. package/dist/web-dashboard/chat-console.d.ts.map +1 -1
  134. package/dist/web-dashboard/chat-console.js.map +1 -1
  135. package/dist/web-dashboard/chat-retry.d.ts.map +1 -1
  136. package/dist/web-dashboard/chat-retry.js +10 -2
  137. package/dist/web-dashboard/chat-retry.js.map +1 -1
  138. package/dist/web-dashboard/server.d.ts.map +1 -1
  139. package/dist/web-dashboard/server.js +80 -8
  140. package/dist/web-dashboard/server.js.map +1 -1
  141. package/dist/web-dashboard/src/types.d.ts +81 -4
  142. package/dist/web-dashboard/src/types.d.ts.map +1 -1
  143. package/package.json +1 -1
  144. package/src/web-dashboard/public/assets/{index-Co7Hk2FT.js → index-kCUkORm7.js} +2 -2
  145. package/src/web-dashboard/public/assets/{index-Co7Hk2FT.js.map → index-kCUkORm7.js.map} +1 -1
  146. package/src/web-dashboard/public/index.html +1 -1
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Composite planning — phased plans for deliverables that are more than one
3
+ * thing (enterprise-grade hardening, G12).
4
+ *
5
+ * WHY THIS EXISTS. The audit fixed "a story is not a program" (G7/G8) and the
6
+ * next class of ask showed the same shape one level up:
7
+ *
8
+ * "develop a web-based book (interactive, with voice assistance)"
9
+ * "build the app from this plan — it's a phased build, take the time you need"
10
+ *
11
+ * Both are AUTHORED work AND software, and a single-class planner can only fail
12
+ * one half of them:
13
+ * - plan it as prose and the site never appears — the user asked for a web
14
+ * book and got a markdown file;
15
+ * - plan it as code and the book never appears — the exact non-delivery the
16
+ * original audit found, where the agent built a machine to write the story
17
+ * instead of writing the story.
18
+ *
19
+ * The answer is not a better single answer; it is PHASES. `buildCompositePlan`
20
+ * emits the phases in dependency order, with the hard rule encoded: SHAPE first
21
+ * (so the content has somewhere to land), then CONTENT, then the EXPERIENCE
22
+ * layer, then optional SERVICES, then VERIFICATION.
23
+ *
24
+ * TWO DESIGN CALLS WORTH STATING
25
+ *
26
+ * 1. CONTENT IS NOT LAST, AND IT IS NOT OPTIONAL. A site scaffold is one
27
+ * small step; the book is dozens of units. Reserving the experience layer
28
+ * for the end means a run that stalls early still leaves real chapters on
29
+ * disk — which is what makes the work RESUMABLE rather than a half-built
30
+ * shell.
31
+ * 2. AN OPTIONAL SERVICE MUST NEVER GATE THE DELIVERABLE. When the ask names
32
+ * Python/voice/TTS, the plan does create the script — but the web layer is
33
+ * required to work without it (browser speech), so the deliverable is
34
+ * complete the moment it is opened. A page that needs `pip install` before
35
+ * it says a word is not enterprise-grade; it is a dependency the user never
36
+ * agreed to maintain.
37
+ */
38
+ import type { TaskStep } from './agent.js';
39
+ import { type DeliverableVerdict, type Substrate } from '../learning/deliverable-class.js';
40
+ import { type LongFormJob } from '../learning/long-form.js';
41
+ import { type ProseUnit } from './long-form-plan.js';
42
+ /** What a phase is for. Drives ordering, naming and reporting. */
43
+ export type PhaseKind = 'scaffold' | 'content' | 'interactivity' | 'assets' | 'verify';
44
+ /** One stage of a composite deliverable. */
45
+ export interface CompositePhase {
46
+ /** Stable id, e.g. `phase-1-scaffold`. */
47
+ id: string;
48
+ kind: PhaseKind;
49
+ /** Short label for the board/report, e.g. "Shape the site". */
50
+ title: string;
51
+ /** The steps that implement this phase, already dependency-wired. */
52
+ steps: TaskStep[];
53
+ }
54
+ /** The plan for a composite ask. */
55
+ export interface CompositePlan {
56
+ /** Phases in execution order. */
57
+ phases: CompositePhase[];
58
+ /** Every step, flattened and wired (this is what becomes the task plan). */
59
+ steps: TaskStep[];
60
+ /** `proseUnit` per step id, consumed by the writer via metadata. */
61
+ proseUnits: Map<string, ProseUnit>;
62
+ /**
63
+ * The long-form ledger job backing the content phase.
64
+ *
65
+ * Always present: a composite plan only exists when it contains authored
66
+ * content (see `buildCompositePlan`), and the ledger is how that content's
67
+ * progress is measured and resumed.
68
+ */
69
+ job: LongFormJob;
70
+ /** Honest one-line progress, shown to the user. */
71
+ progressLine: string;
72
+ /**
73
+ * Files that must ALL exist before the deliverable counts as finished.
74
+ *
75
+ * The unattended runner uses this to MEASURE completion instead of trusting
76
+ * a batch that reported success — the same "ran ≠ worked" rule G1/G2/G3
77
+ * apply to single edits.
78
+ */
79
+ expectedArtifacts: string[];
80
+ /** One line describing what the user is getting. */
81
+ deliverableSummary: string;
82
+ /** Which substrates this plan covers (for logs/traces). */
83
+ substrates: Substrate[];
84
+ /**
85
+ * Steps that CREATE files from scratch — shape, experience layer, services.
86
+ *
87
+ * The orchestrator routes these to the ONE-SHOT writer rather than the
88
+ * tool-calling one. The tool-calling writer exists for the read→edit→verify
89
+ * loop, and there is nothing to read in a directory that does not exist yet:
90
+ * in the live run the tool-calling writer returned zero file changes for the
91
+ * site scaffold and the whole pipeline died on its first step. Writing a new
92
+ * file from nothing is exactly what the one-shot writer's contract (complete
93
+ * file contents in `filepath:` blocks) is for.
94
+ */
95
+ creationStepIds: string[];
96
+ }
97
+ /**
98
+ * The deterministic end-to-end check for a composite deliverable.
99
+ *
100
+ * Generated by US, not written by the model, for the same reason the assembly
101
+ * of a book is pure concatenation: the thing that decides whether the work is
102
+ * done must not be part of the work being judged. It runs as a `runner` step
103
+ * whose non-zero exit FAILS the phase, so the run reports an honest "not
104
+ * delivered" instead of a green summary over a missing site.
105
+ *
106
+ * It asserts the two facts a user would check in the first ten seconds:
107
+ * 1. every artifact the deliverable promises exists on disk;
108
+ * 2. for a web deliverable, the site actually enumerates the chapters —
109
+ * a reader that cannot see chapter 12 has not presented chapter 12.
110
+ */
111
+ export declare function buildVerifyCommand(input: {
112
+ artifacts: string[];
113
+ /** The site's own directory, when there is a web layer to check. */
114
+ siteDir?: string;
115
+ /** The directory the site must read its chapters from. */
116
+ chaptersDir?: string;
117
+ }): string;
118
+ /**
119
+ * Plan a hybrid ask as phases, or return `null` when the ask is not one.
120
+ *
121
+ * Returning null for every single-substrate goal is deliberate: this module
122
+ * must be invisible to the existing code path, or it would change how ordinary
123
+ * software and ordinary prose are planned — both of which work today.
124
+ */
125
+ export declare function buildCompositePlan(input: {
126
+ goal: string;
127
+ workingDir: string;
128
+ /** Units of prose to plan for this run. */
129
+ limit?: number;
130
+ /** Reuse an already-computed verdict (the orchestrator has one). */
131
+ verdict?: DeliverableVerdict;
132
+ }): CompositePlan | null;
133
+ /**
134
+ * The honest progress line for a composite job, derived from the ledger.
135
+ *
136
+ * Reported as units AND phases, because "3 of 5 phases" is meaningless when the
137
+ * content phase is 36 of 39 chapters: the user asked for a book, so the book's
138
+ * own completion is the number that matters.
139
+ */
140
+ export declare function compositeProgressLine(job: LongFormJob, extra?: string): string;
141
+ /** Phase labels in execution order (for reports and traces). */
142
+ export declare function phaseSummary(plan: CompositePlan): string;
143
+ //# sourceMappingURL=composite-plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composite-plan.d.ts","sourceRoot":"","sources":["../../src/agents/composite-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAA2C,KAAK,kB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,GAAG,MAAM,CAsCT;AA2LD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B,GAAG,aAAa,GAAG,IAAI,CAiHvB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,SAAK,GAAG,MAAM,CAG1E;AAED,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAExD"}
@@ -0,0 +1,399 @@
1
+ /**
2
+ * Composite planning — phased plans for deliverables that are more than one
3
+ * thing (enterprise-grade hardening, G12).
4
+ *
5
+ * WHY THIS EXISTS. The audit fixed "a story is not a program" (G7/G8) and the
6
+ * next class of ask showed the same shape one level up:
7
+ *
8
+ * "develop a web-based book (interactive, with voice assistance)"
9
+ * "build the app from this plan — it's a phased build, take the time you need"
10
+ *
11
+ * Both are AUTHORED work AND software, and a single-class planner can only fail
12
+ * one half of them:
13
+ * - plan it as prose and the site never appears — the user asked for a web
14
+ * book and got a markdown file;
15
+ * - plan it as code and the book never appears — the exact non-delivery the
16
+ * original audit found, where the agent built a machine to write the story
17
+ * instead of writing the story.
18
+ *
19
+ * The answer is not a better single answer; it is PHASES. `buildCompositePlan`
20
+ * emits the phases in dependency order, with the hard rule encoded: SHAPE first
21
+ * (so the content has somewhere to land), then CONTENT, then the EXPERIENCE
22
+ * layer, then optional SERVICES, then VERIFICATION.
23
+ *
24
+ * TWO DESIGN CALLS WORTH STATING
25
+ *
26
+ * 1. CONTENT IS NOT LAST, AND IT IS NOT OPTIONAL. A site scaffold is one
27
+ * small step; the book is dozens of units. Reserving the experience layer
28
+ * for the end means a run that stalls early still leaves real chapters on
29
+ * disk — which is what makes the work RESUMABLE rather than a half-built
30
+ * shell.
31
+ * 2. AN OPTIONAL SERVICE MUST NEVER GATE THE DELIVERABLE. When the ask names
32
+ * Python/voice/TTS, the plan does create the script — but the web layer is
33
+ * required to work without it (browser speech), so the deliverable is
34
+ * complete the moment it is opened. A page that needs `pip install` before
35
+ * it says a word is not enterprise-grade; it is a dependency the user never
36
+ * agreed to maintain.
37
+ */
38
+ import { existsSync } from 'node:fs';
39
+ import { resolve } from 'node:path';
40
+ import { classifyDeliverable, describeSubstrates } from '../learning/deliverable-class.js';
41
+ import { MAX_UNITS_PER_RUN, formatProgress, } from '../learning/long-form.js';
42
+ import { buildLongFormPlan } from './long-form-plan.js';
43
+ // ─── Project shape ──────────────────────────────────────────────────────────
44
+ /** Where a composite web deliverable puts its presentation layer. */
45
+ const SITE_DIR = 'site';
46
+ /** Where a composite authored deliverable puts its prose. */
47
+ const CONTENT_DIR = 'content';
48
+ /** Where optional service scripts live. */
49
+ const TOOLS_DIR = 'tools';
50
+ /** The document the prose phase assembles. */
51
+ const BOOK_PATH = `${CONTENT_DIR}/book.md`;
52
+ /** Per-unit prose files, so the web layer can enumerate them predictably. */
53
+ const CHAPTERS_DIR = `${CONTENT_DIR}/chapters`;
54
+ /** The site's entry point and its supporting files. */
55
+ const SITE_FILES = [`${SITE_DIR}/index.html`, `${SITE_DIR}/styles.css`, `${SITE_DIR}/reader.js`];
56
+ /** The generated chapter index the reader consumes. */
57
+ const CHAPTER_INDEX = `${SITE_DIR}/chapters.js`;
58
+ /** The optional high-quality narration service. */
59
+ const NARRATION_SCRIPT = `${TOOLS_DIR}/narrate.py`;
60
+ /** A dependency-free export/build helper, for asks that named a runtime. */
61
+ const EXPORT_SCRIPT = `${TOOLS_DIR}/export.mjs`;
62
+ // ─── Helpers ────────────────────────────────────────────────────────────────
63
+ /** JSON literal for embedding in a generated command. */
64
+ function jsArray(values) {
65
+ return `[${values.map((v) => `'${v.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`).join(',')}]`;
66
+ }
67
+ /**
68
+ * A JS single-quoted string literal for embedding in the generated command.
69
+ *
70
+ * NOT a shell-quoted argument: the command runs inside `node -e "…"`, so a
71
+ * shell-quoted `"site"` has its quotes consumed by the shell and the script
72
+ * then sees a bare identifier (`ReferenceError: site is not defined`). The
73
+ * value has to arrive at Node as JS source, so it is rendered as one.
74
+ */
75
+ function jsString(value) {
76
+ return `'${value.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`;
77
+ }
78
+ /**
79
+ * The deterministic end-to-end check for a composite deliverable.
80
+ *
81
+ * Generated by US, not written by the model, for the same reason the assembly
82
+ * of a book is pure concatenation: the thing that decides whether the work is
83
+ * done must not be part of the work being judged. It runs as a `runner` step
84
+ * whose non-zero exit FAILS the phase, so the run reports an honest "not
85
+ * delivered" instead of a green summary over a missing site.
86
+ *
87
+ * It asserts the two facts a user would check in the first ten seconds:
88
+ * 1. every artifact the deliverable promises exists on disk;
89
+ * 2. for a web deliverable, the site actually enumerates the chapters —
90
+ * a reader that cannot see chapter 12 has not presented chapter 12.
91
+ */
92
+ export function buildVerifyCommand(input) {
93
+ const artifacts = jsArray(input.artifacts);
94
+ const siteDir = input.siteDir ?? '';
95
+ const chaptersDir = jsString(input.chaptersDir ?? '');
96
+ const checksSite = !!input.siteDir && !!input.chaptersDir;
97
+ // ── What the site check asserts, and why it is shaped this way ──────────
98
+ // It asserts the site ENUMERATES a chapters directory instead of hard-coding
99
+ // a list. The tempting stronger check — "does the site source mention each
100
+ // chapter FILE" — is wrong: a correct reader lists the directory at load time
101
+ // and therefore names NO chapter file in its source, so that check would fail
102
+ // exactly the implementation we asked for. Proving chapter 12 renders needs a
103
+ // browser, which a runner step does not have. So we assert what is genuinely
104
+ // verifiable: every promised file exists, and the site reads its content from
105
+ // the chapters directory rather than embedding it.
106
+ const siteScan = checksSite
107
+ ? `const roots=[];const walk=d=>{for(const e of fs.readdirSync(d,{withFileTypes:true})){const p=path.join(d,e.name);if(e.isDirectory())walk(p);else roots.push(p)}};` +
108
+ `if(fs.existsSync(${jsString(siteDir)}))walk(${jsString(siteDir)});` +
109
+ `const blob=roots.map(p=>fs.readFileSync(p,'utf8')).join(String.fromCharCode(10));` +
110
+ `const enumerates=blob.includes(${chaptersDir});`
111
+ : '';
112
+ const siteCheck = checksSite
113
+ ? `if(!enumerates){console.error('THE SITE DOES NOT READ ITS CHAPTERS FROM '+${chaptersDir});process.exit(1)}`
114
+ : '';
115
+ const success = checksSite
116
+ ? `'OK: '+need.length+' artifact(s) present and the site reads its chapters from '+${chaptersDir}`
117
+ : `'OK: '+need.length+' artifact(s) present'`;
118
+ return (`node -e "const fs=require('fs');const path=require('path');` +
119
+ `const need=${artifacts};` +
120
+ `const missing=need.filter(p=>!fs.existsSync(p));` +
121
+ siteScan +
122
+ siteCheck +
123
+ `if(missing.length){` +
124
+ `console.error('MISSING FILES: '+missing.join(', '));` +
125
+ `process.exit(1)}` +
126
+ `console.log(${success})"`).trim();
127
+ }
128
+ /**
129
+ * Is this step's deliverable already on disk?
130
+ *
131
+ * A satisfied step is NOT planned again, and the second reason is the sharp
132
+ * one: re-running a scaffold wastes tokens, and an idempotent writer that
133
+ * correctly reports "no changes needed" is then marked as having FAILED its
134
+ * expected files — a false failure that burned a whole repair budget on the
135
+ * second run of the live composite test. A continuation must plan only what is
136
+ * left to do.
137
+ */
138
+ function alreadySatisfied(step, workingDir) {
139
+ const files = step.expectedFiles ?? [];
140
+ if (files.length === 0)
141
+ return false;
142
+ return files.every((f) => existsSync(resolve(workingDir, f)));
143
+ }
144
+ /** A step that runs a deterministic command (the runner extracts backticks). */
145
+ function runStep(id, description, command, dependsOn) {
146
+ return {
147
+ id,
148
+ description: `${description} Run: \`${command}\``,
149
+ agentType: 'runner',
150
+ dependsOn,
151
+ status: 'pending',
152
+ complexity: 'simple',
153
+ routingHints: { runSerially: true },
154
+ };
155
+ }
156
+ /** A step that writes files. */
157
+ function writeStep(input) {
158
+ return {
159
+ id: input.id,
160
+ description: input.description,
161
+ agentType: 'writer',
162
+ dependsOn: input.dependsOn,
163
+ status: 'pending',
164
+ complexity: input.complexity ?? 'complex',
165
+ expectedFiles: input.expectedFiles,
166
+ routingHints: { runSerially: true },
167
+ };
168
+ }
169
+ // ─── Phase builders ─────────────────────────────────────────────────────────
170
+ /** Phase 1 — the shape the content will land in. */
171
+ function scaffoldPhase(substrates) {
172
+ if (!substrates.includes('web'))
173
+ return null;
174
+ return {
175
+ id: 'phase-1-scaffold',
176
+ kind: 'scaffold',
177
+ title: 'Shape the site',
178
+ steps: [
179
+ writeStep({
180
+ id: 'scaffold-site',
181
+ description: `Create the static site that will read and present the book: ${SITE_FILES.join(', ')}. ` +
182
+ 'The entry point must work by opening the HTML file directly from disk — no build step, no server, no package install. ' +
183
+ `The reader must load the written content from the ${CHAPTERS_DIR}/ directory at runtime and render one chapter at a time ` +
184
+ 'with previous/next navigation and a table of contents. Include a "Read aloud" control that uses the browser\'s built-in ' +
185
+ 'speech synthesis so narration works with nothing installed. Keep styling self-contained in the CSS file; no external CDNs.',
186
+ expectedFiles: SITE_FILES,
187
+ dependsOn: [],
188
+ }),
189
+ ],
190
+ };
191
+ }
192
+ /** Phase 2 — the content itself, via the bounded long-form engine. */
193
+ function contentPhase(input) {
194
+ const prose = buildLongFormPlan({
195
+ goal: input.goal,
196
+ workingDir: input.workingDir,
197
+ limit: input.limit,
198
+ assumeAuthored: true,
199
+ docPath: BOOK_PATH,
200
+ dir: CHAPTERS_DIR,
201
+ });
202
+ if (!prose)
203
+ return null;
204
+ // The first unit must wait for the scaffold only when there IS one; a prose
205
+ // unit's own chain already serializes the rest of the batch.
206
+ const steps = prose.steps.map((step, i) => ({
207
+ ...step,
208
+ dependsOn: i === 0 ? [...input.dependsOn] : step.dependsOn,
209
+ }));
210
+ return {
211
+ phase: { id: 'phase-2-content', kind: 'content', title: 'Write the content', steps },
212
+ job: prose.job,
213
+ proseUnits: prose.units,
214
+ progressLine: prose.progressLine,
215
+ };
216
+ }
217
+ /** Phase 3 — the experience layer that makes the content usable. */
218
+ function interactivityPhase(input) {
219
+ const steps = [
220
+ writeStep({
221
+ id: 'site-chapter-index',
222
+ description: `Create ${CHAPTER_INDEX}: a small module that lists every chapter file in ${CHAPTERS_DIR}/ ` +
223
+ 'in reading order, with a display title for each (derived from the file name), so the reader can build its ' +
224
+ 'table of contents and navigation without a server. It must enumerate the directory contents at load time ' +
225
+ 'rather than hard-coding a count.' +
226
+ (input.wantsNarration
227
+ ? ' Also wire the "Read aloud" button to the browser speech synthesis API with play/pause, and make the page ' +
228
+ 'note that an optional higher-quality narration script is available for those who want it.'
229
+ : ''),
230
+ expectedFiles: [CHAPTER_INDEX],
231
+ dependsOn: input.dependsOn,
232
+ complexity: 'moderate',
233
+ }),
234
+ ];
235
+ return { id: 'phase-3-interactivity', kind: 'interactivity', title: 'Make it interactive', steps };
236
+ }
237
+ /**
238
+ * Phase 4 — optional services.
239
+ *
240
+ * The narration script is generated but NOT wired as a requirement, and the
241
+ * phase never fails the run on its own: a missing Python interpreter must not
242
+ * cost the user their book (see the module header).
243
+ */
244
+ function assetsPhase(input) {
245
+ const wantsNarration = input.substrates.includes('python') || /audio|narrat|voice|speech|tts|listen|read\s+aloud/i.test(input.goal);
246
+ const steps = [];
247
+ if (wantsNarration) {
248
+ steps.push(writeStep({
249
+ id: 'tools-narrate',
250
+ description: `Create ${NARRATION_SCRIPT}: an optional high-quality narration generator for this book. It must list the ` +
251
+ `chapters, synthesise speech for each into an audio file next to it, and require only standard third-party ` +
252
+ 'libraries (gTTS or edge-tts), detecting which is installed and explaining what to install when neither is. ' +
253
+ 'It must NOT be required for the site to work — the site narrates through the browser without it.',
254
+ expectedFiles: [NARRATION_SCRIPT],
255
+ dependsOn: input.dependsOn,
256
+ complexity: 'moderate',
257
+ }));
258
+ }
259
+ if (input.substrates.includes('python') && !wantsNarration) {
260
+ steps.push(writeStep({
261
+ id: 'tools-export',
262
+ description: `Create ${EXPORT_SCRIPT}: a dependency-free Node build helper that assembles the finished document from its ` +
263
+ 'per-unit files into a single file and reports the word and page counts, so the deliverable can be rebuilt ' +
264
+ 'after any edit without an LLM.',
265
+ expectedFiles: [EXPORT_SCRIPT],
266
+ dependsOn: input.dependsOn,
267
+ complexity: 'moderate',
268
+ }));
269
+ }
270
+ if (steps.length === 0)
271
+ return null;
272
+ return { id: 'phase-4-assets', kind: 'assets', title: 'Optional services', steps };
273
+ }
274
+ // ─── Entry point ────────────────────────────────────────────────────────────
275
+ /**
276
+ * Plan a hybrid ask as phases, or return `null` when the ask is not one.
277
+ *
278
+ * Returning null for every single-substrate goal is deliberate: this module
279
+ * must be invisible to the existing code path, or it would change how ordinary
280
+ * software and ordinary prose are planned — both of which work today.
281
+ */
282
+ export function buildCompositePlan(input) {
283
+ const verdict = input.verdict ?? classifyDeliverable(input.goal);
284
+ // Only hybrid asks take this path. An authored-only ask stays with
285
+ // `buildLongFormPlan`; a software-only ask stays with the code planner.
286
+ if (!verdict.composite)
287
+ return null;
288
+ // And the hybrid must actually contain authored content. "A React app with a
289
+ // Python backend" is multi-substrate but it is a SOFTWARE ask, and the code
290
+ // planner already plans those correctly.
291
+ if (!verdict.substrates.includes('prose'))
292
+ return null;
293
+ const substrates = verdict.substrates;
294
+ const limit = Math.max(1, input.limit ?? MAX_UNITS_PER_RUN);
295
+ const phases = [];
296
+ const scaffold = scaffoldPhase(substrates);
297
+ if (scaffold) {
298
+ // Pruned BEFORE the content phase is built, not after: the content must not
299
+ // declare a dependency on a step that is about to be dropped from the plan.
300
+ // (Live evidence: on the second run the scaffold was satisfied and pruned,
301
+ // but unit 1 still depended on `scaffold-site` — the scheduler found zero
302
+ // runnable steps and the whole continuation failed at planning.)
303
+ scaffold.steps = scaffold.steps.filter((s) => !alreadySatisfied(s, input.workingDir));
304
+ if (scaffold.steps.length > 0)
305
+ phases.push(scaffold);
306
+ }
307
+ const content = contentPhase({
308
+ goal: input.goal,
309
+ workingDir: input.workingDir,
310
+ limit,
311
+ dependsOn: scaffold && scaffold.steps.length > 0 ? scaffold.steps.map((s) => s.id) : [],
312
+ });
313
+ // Authored content is the point of a composite ask that includes prose. If
314
+ // the long-form engine cannot plan it at all, the hybrid cannot be delivered
315
+ // honestly — bail out to the ordinary path rather than planning a shell.
316
+ if (!content)
317
+ return null;
318
+ phases.push(content.phase);
319
+ // Everything after the content depends on the LAST content step: the site
320
+ // must be able to enumerate finished chapters, and the narration script
321
+ // should see real files.
322
+ const lastContentStep = content.phase.steps[content.phase.steps.length - 1]?.id;
323
+ const afterContent = lastContentStep ? [lastContentStep] : [];
324
+ if (substrates.includes('web')) {
325
+ phases.push(interactivityPhase({
326
+ goal: input.goal,
327
+ job: content.job,
328
+ dependsOn: afterContent,
329
+ wantsNarration: substrates.includes('python') || /audio|narrat|voice|speech|tts/i.test(input.goal),
330
+ }));
331
+ }
332
+ const assets = assetsPhase({ substrates, dependsOn: afterContent, goal: input.goal });
333
+ if (assets)
334
+ phases.push(assets);
335
+ // ── Verification, generated by us ───────────────────────────────────────
336
+ const chapterPaths = content.job.sections.map((s) => s.path);
337
+ // Captured BEFORE pruning: a satisfied step is not planned again, but its
338
+ // files are still part of what the deliverable promises — completion is
339
+ // measured against this list either way.
340
+ const expectedArtifacts = [
341
+ BOOK_PATH,
342
+ ...chapterPaths,
343
+ ...(substrates.includes('web') ? [...SITE_FILES, CHAPTER_INDEX] : []),
344
+ ...(assets ? assets.steps.flatMap((s) => s.expectedFiles ?? []) : []),
345
+ ];
346
+ // ── Plan only what is LEFT ──────────────────────────────────────────────
347
+ // A presentation-layer step whose files already exist is dropped, so a
348
+ // continuation goes straight to the unfinished content instead of rewriting a
349
+ // site that is already correct.
350
+ for (const phase of phases) {
351
+ if (phase.kind === 'content' || phase.kind === 'verify')
352
+ continue;
353
+ phase.steps = phase.steps.filter((s) => !alreadySatisfied(s, input.workingDir));
354
+ }
355
+ const planned = phases.filter((p) => p.steps.length > 0);
356
+ const verifyDependsOn = planned.flatMap((p) => p.steps.map((s) => s.id));
357
+ const verify = {
358
+ id: 'phase-5-verify',
359
+ kind: 'verify',
360
+ title: 'Verify the whole deliverable',
361
+ steps: [
362
+ runStep('verify-deliverable', 'Verify the whole deliverable end to end: every promised file exists on disk, and the site reads its chapters from the content directory.', buildVerifyCommand({
363
+ artifacts: expectedArtifacts,
364
+ ...(substrates.includes('web') ? { siteDir: SITE_DIR, chaptersDir: CHAPTERS_DIR } : {}),
365
+ }), verifyDependsOn),
366
+ ],
367
+ };
368
+ planned.push(verify);
369
+ const steps = planned.flatMap((p) => p.steps);
370
+ return {
371
+ phases: planned,
372
+ steps,
373
+ proseUnits: content.proseUnits,
374
+ job: content.job,
375
+ progressLine: content.progressLine,
376
+ expectedArtifacts,
377
+ substrates,
378
+ creationStepIds: planned
379
+ .filter((p) => p.kind === 'scaffold' || p.kind === 'interactivity' || p.kind === 'assets')
380
+ .flatMap((p) => p.steps.map((s) => s.id)),
381
+ deliverableSummary: `${describeSubstrates(verdict)} — ${steps.length} step(s) across ${planned.length} phase(s), ${content.job.sections.length} content units`,
382
+ };
383
+ }
384
+ /**
385
+ * The honest progress line for a composite job, derived from the ledger.
386
+ *
387
+ * Reported as units AND phases, because "3 of 5 phases" is meaningless when the
388
+ * content phase is 36 of 39 chapters: the user asked for a book, so the book's
389
+ * own completion is the number that matters.
390
+ */
391
+ export function compositeProgressLine(job, extra = '') {
392
+ const suffix = extra ? ` · ${extra}` : '';
393
+ return `${formatProgress(job)}${suffix}`;
394
+ }
395
+ /** Phase labels in execution order (for reports and traces). */
396
+ export function phaseSummary(plan) {
397
+ return plan.phases.map((p) => `${p.title} (${p.steps.length})`).join(' → ');
398
+ }
399
+ //# sourceMappingURL=composite-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composite-plan.js","sourceRoot":"","sources":["../../src/agents/composite-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAA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