@specverse/engines 6.32.11 → 6.33.1
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/ai/analyse-runner.js +1 -1
- package/dist/ai/analyse-runner.js.map +1 -1
- package/dist/ai/behaviours-runner.js +1 -1
- package/dist/ai/behaviours-runner.js.map +1 -1
- package/dist/ai/deployment-emitter.d.ts +3 -0
- package/dist/ai/deployment-emitter.d.ts.map +1 -1
- package/dist/ai/deployment-emitter.js +145 -0
- package/dist/ai/deployment-emitter.js.map +1 -1
- package/dist/ai/skeleton-emitter.d.ts +1 -1
- package/dist/ai/skeleton-emitter.d.ts.map +1 -1
- package/dist/ai/skeleton-emitter.js +73 -26
- package/dist/ai/skeleton-emitter.js.map +1 -1
- package/dist/analyse-prepass/imports-graph.d.ts +274 -0
- package/dist/analyse-prepass/imports-graph.d.ts.map +1 -1
- package/dist/analyse-prepass/imports-graph.js +770 -0
- package/dist/analyse-prepass/imports-graph.js.map +1 -1
- package/dist/analyse-prepass/index.d.ts +20 -0
- package/dist/analyse-prepass/index.d.ts.map +1 -1
- package/dist/analyse-prepass/index.js +17 -0
- package/dist/analyse-prepass/index.js.map +1 -1
- package/dist/libs/instance-factories/orms/templates/prisma/schema-generator.js +66 -4
- package/dist/parser/unified-parser.d.ts.map +1 -1
- package/dist/parser/unified-parser.js +103 -0
- package/dist/parser/unified-parser.js.map +1 -1
- package/dist/realize/index.d.ts.map +1 -1
- package/dist/realize/index.js +84 -147
- package/dist/realize/index.js.map +1 -1
- package/dist/realize/per-action-emitter.d.ts +235 -0
- package/dist/realize/per-action-emitter.d.ts.map +1 -0
- package/dist/realize/per-action-emitter.js +229 -0
- package/dist/realize/per-action-emitter.js.map +1 -0
- package/dist/realize/per-action-llm-emit.d.ts +87 -0
- package/dist/realize/per-action-llm-emit.d.ts.map +1 -0
- package/dist/realize/per-action-llm-emit.js +427 -0
- package/dist/realize/per-action-llm-emit.js.map +1 -0
- package/dist/realize/per-action-runner.d.ts +127 -0
- package/dist/realize/per-action-runner.d.ts.map +1 -0
- package/dist/realize/per-action-runner.js +269 -0
- package/dist/realize/per-action-runner.js.map +1 -0
- package/dist/realize/structural-validator.d.ts +71 -0
- package/dist/realize/structural-validator.d.ts.map +1 -0
- package/dist/realize/structural-validator.js +167 -0
- package/dist/realize/structural-validator.js.map +1 -0
- package/libs/instance-factories/orms/templates/prisma/__tests__/schema-generator.test.ts +416 -0
- package/libs/instance-factories/orms/templates/prisma/schema-generator.ts +182 -5
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"per-action-emitter.js","sourceRoot":"","sources":["../../src/realize/per-action-emitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAsLH;;;;;GAKG;AACH,SAAS,iBAAiB;IACxB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IACnD,IAAI,QAAQ,KAAK,MAAM;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,GAAG;QAAE,OAAO,KAAK,CAAC;IACjD,kEAAkE;IAClE,kEAAkE;IAClE,2DAA2D;IAC3D,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,UAAU,CACjB,MAAkB,EAClB,OAAuB;IAEvB,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAC1D,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QAC7C,8DAA8D;QAC9D,oEAAoE;QACpE,8DAA8D;QAC9D,YAAY;QACZ,OAAO,MAAM,C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
+
/**
|
|
2
|
+
* Per-action LLM emit hook — Phase 3 of the L3 redesign.
|
|
3
|
+
*
|
|
4
|
+
* Builds an `LlmEmitFn` (the dependency-injection seam exposed by
|
|
5
|
+
* `per-action-emitter.ts`) that loads `realize-action.prompt.yaml`,
|
|
6
|
+
* calls `runPrompt` with the assembled per-action context, runs the
|
|
7
|
+
* structural validator over the LLM output, and surgically retries
|
|
8
|
+
* once on parse failure (DR3-aligned).
|
|
9
|
+
*
|
|
10
|
+
* Three quality gates run on every LLM emission:
|
|
11
|
+
* 1. Markdown extraction — pull the ```typescript fenced block out of
|
|
12
|
+
* the LLM response. Empty / missing block → null (caller falls
|
|
13
|
+
* through to γ stub).
|
|
14
|
+
* 2. Structural preservation (DR3) — every pre-baked snippet must
|
|
15
|
+
* appear verbatim in the body. A rewritten snippet is a loud
|
|
16
|
+
* failure; we throw with a diff so the user knows the LLM
|
|
17
|
+
* misbehaved.
|
|
18
|
+
* 3. esbuild parse check — the body must be syntactically valid TS.
|
|
19
|
+
* On parse failure we run ONE surgical retry with the parse error
|
|
20
|
+
* fed back as a userPrefix; if it fails again we return null and
|
|
21
|
+
* the caller emits the γ stub.
|
|
22
|
+
*
|
|
23
|
+
* The realize-action.prompt.yaml asset (Phase 2 deliverable) lives in
|
|
24
|
+
* `@specverse/assets/prompts/core/standard/default/realize-action.prompt.yaml`
|
|
25
|
+
* once that package is republished. Until then, we fall back to a
|
|
26
|
+
* filesystem path under specverse-self/assets/ so Phase 3 doesn't have
|
|
27
|
+
* to wait on a registry roundtrip.
|
|
28
|
+
*/
|
|
29
|
+
import { runPrompt as runPromptFn, type PromptYaml } from '../ai/prompt-runner.js';
|
|
30
|
+
import type { LlmEmitFn } from './per-action-emitter.js';
|
|
31
|
+
/** Options for {@link createRealizeActionLlmEmit}. */
|
|
32
|
+
export interface CreateRealizeActionLlmEmitOptions {
|
|
33
|
+
/** Override `runPrompt` for tests. */
|
|
34
|
+
runPromptOverride?: typeof runPromptFn;
|
|
35
|
+
/** Override `loadPrompt` for tests; default is loadPrompt('realize-action'). */
|
|
36
|
+
loadPromptOverride?: () => PromptYaml;
|
|
37
|
+
/** Override the parse-check for tests. Must return null on success
|
|
38
|
+
* and an error message string on failure. */
|
|
39
|
+
parseCheckOverride?: (code: string) => Promise<string | null>;
|
|
40
|
+
/** Override the model passed to runPrompt (rare). */
|
|
41
|
+
model?: any;
|
|
42
|
+
/** Per-call timeout. Default 5min — same as microcall-orchestrator. */
|
|
43
|
+
timeoutMs?: number;
|
|
44
|
+
/** Disable the surgical retry (tests). */
|
|
45
|
+
disableSurgicalRetry?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Available clients string passed into the prompt's `availableClients`
|
|
48
|
+
* variable. Caller (the realize runner) builds this from the
|
|
49
|
+
* component's `import:` block + the action's `uses:`. When omitted,
|
|
50
|
+
* the prompt receives a "(none)" placeholder.
|
|
51
|
+
*/
|
|
52
|
+
availableClients?: string;
|
|
53
|
+
/** Sibling-action signatures string. Same convention. */
|
|
54
|
+
siblingActions?: string;
|
|
55
|
+
/** Cross-method process context string. Same convention. */
|
|
56
|
+
processContext?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Build an {@link LlmEmitFn} for use in per-action realize emission.
|
|
60
|
+
*
|
|
61
|
+
* The returned function:
|
|
62
|
+
* 1. Builds the prompt input from the per-action emitter's request.
|
|
63
|
+
* 2. Calls runPrompt({ operation: 'realize-action', ... }).
|
|
64
|
+
* 3. Extracts the ```typescript block from the response.
|
|
65
|
+
* 4. Runs the structural validator (DR3); throws on rewrite.
|
|
66
|
+
* 5. Runs an esbuild parse check; surgical-retries once on failure.
|
|
67
|
+
* 6. Returns the body string, or null when all attempts fail (caller
|
|
68
|
+
* falls through to γ stub).
|
|
69
|
+
*/
|
|
70
|
+
export declare function createRealizeActionLlmEmit(opts?: CreateRealizeActionLlmEmitOptions): LlmEmitFn;
|
|
71
|
+
/**
|
|
72
|
+
* Filesystem fallback for realize-action.prompt.yaml when the installed
|
|
73
|
+
* @specverse/assets package predates Phase 2's prompt addition.
|
|
74
|
+
*
|
|
75
|
+
* Searches a small fixed set of candidate paths relative to the engines
|
|
76
|
+
* package's installed location and the worktree layout used in
|
|
77
|
+
* specverse-self repo. Returns null when none are found; runPrompt then
|
|
78
|
+
* surfaces the canonical "prompt file not found" error.
|
|
79
|
+
*/
|
|
80
|
+
export declare function loadRealizeActionPromptFromFallback(): PromptYaml | null;
|
|
81
|
+
/**
|
|
82
|
+
* Pull the first ```typescript fenced block out of an LLM response.
|
|
83
|
+
* Tolerates plain ``` (no language tag) when the body starts with
|
|
84
|
+
* recognisably-TS content. Returns null if no block is found.
|
|
85
|
+
*/
|
|
86
|
+
export declare function extractTypescriptBlock(text: string): string | null;
|
|
87
|
+
//# sourceMappingURL=per-action-llm-emit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"per-action-llm-emit.d.ts","sourceRoot":"","sources":["../../src/realize/per-action-llm-emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAOH,OAAO,EAEL,SAAS,IAAI,WAAW,EAGxB,KAAK,UAAU,EAGhB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,KAAK,EACV,SAAS,EAKV,MAAM,yBAAyB,CAAC;AAIjC,sDAAsD;AACtD,MAAM,WAAW,iCAAiC;IAChD,sCAAsC;IACtC,iBAAiB,CAAC,EAAE,OAAO,WAAW,CAAC;IACvC,gFAAgF;IAChF,kBAAkB,CAAC,EAAE,MAAM,UAAU,CAAC;IACtC;kDAC8C;IAC9C,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9D,qDAAqD;IACrD,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yDAAyD;IACzD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,GAAE,iCAAsC,GAC3C,SAAS,CAuFX;AA4ED;;;;;;;;GAQG;AACH,wBAAgB,mCAAmC,IAAI,UAAU,GAAG,IAAI,CAqDvE;AAsID;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAalE"}
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-action LLM emit hook — Phase 3 of the L3 redesign.
|
|
3
|
+
*
|
|
4
|
+
* Builds an `LlmEmitFn` (the dependency-injection seam exposed by
|
|
5
|
+
* `per-action-emitter.ts`) that loads `realize-action.prompt.yaml`,
|
|
6
|
+
* calls `runPrompt` with the assembled per-action context, runs the
|
|
7
|
+
* structural validator over the LLM output, and surgically retries
|
|
8
|
+
* once on parse failure (DR3-aligned).
|
|
9
|
+
*
|
|
10
|
+
* Three quality gates run on every LLM emission:
|
|
11
|
+
* 1. Markdown extraction — pull the ```typescript fenced block out of
|
|
12
|
+
* the LLM response. Empty / missing block → null (caller falls
|
|
13
|
+
* through to γ stub).
|
|
14
|
+
* 2. Structural preservation (DR3) — every pre-baked snippet must
|
|
15
|
+
* appear verbatim in the body. A rewritten snippet is a loud
|
|
16
|
+
* failure; we throw with a diff so the user knows the LLM
|
|
17
|
+
* misbehaved.
|
|
18
|
+
* 3. esbuild parse check — the body must be syntactically valid TS.
|
|
19
|
+
* On parse failure we run ONE surgical retry with the parse error
|
|
20
|
+
* fed back as a userPrefix; if it fails again we return null and
|
|
21
|
+
* the caller emits the γ stub.
|
|
22
|
+
*
|
|
23
|
+
* The realize-action.prompt.yaml asset (Phase 2 deliverable) lives in
|
|
24
|
+
* `@specverse/assets/prompts/core/standard/default/realize-action.prompt.yaml`
|
|
25
|
+
* once that package is republished. Until then, we fall back to a
|
|
26
|
+
* filesystem path under specverse-self/assets/ so Phase 3 doesn't have
|
|
27
|
+
* to wait on a registry roundtrip.
|
|
28
|
+
*/
|
|
29
|
+
import { readFileSync, existsSync } from 'fs';
|
|
30
|
+
import { dirname, join, resolve } from 'path';
|
|
31
|
+
import { fileURLToPath } from 'url';
|
|
32
|
+
import { createRequire } from 'module';
|
|
33
|
+
import yaml from 'js-yaml';
|
|
34
|
+
import { loadPrompt, runPrompt as runPromptFn, assembleSystem, assembleUser, } from '../ai/prompt-runner.js';
|
|
35
|
+
import { validateLlmOutputPreservesConventions, } from './structural-validator.js';
|
|
36
|
+
const require = createRequire(import.meta.url);
|
|
37
|
+
/**
|
|
38
|
+
* Build an {@link LlmEmitFn} for use in per-action realize emission.
|
|
39
|
+
*
|
|
40
|
+
* The returned function:
|
|
41
|
+
* 1. Builds the prompt input from the per-action emitter's request.
|
|
42
|
+
* 2. Calls runPrompt({ operation: 'realize-action', ... }).
|
|
43
|
+
* 3. Extracts the ```typescript block from the response.
|
|
44
|
+
* 4. Runs the structural validator (DR3); throws on rewrite.
|
|
45
|
+
* 5. Runs an esbuild parse check; surgical-retries once on failure.
|
|
46
|
+
* 6. Returns the body string, or null when all attempts fail (caller
|
|
47
|
+
* falls through to γ stub).
|
|
48
|
+
*/
|
|
49
|
+
export function createRealizeActionLlmEmit(opts = {}) {
|
|
50
|
+
const runPrompt = opts.runPromptOverride ?? runPromptFn;
|
|
51
|
+
const loadPromptResolved = opts.loadPromptOverride ?? loadRealizeActionPrompt;
|
|
52
|
+
const parseCheck = opts.parseCheckOverride ?? esbuildParseCheck;
|
|
53
|
+
return async (request) => {
|
|
54
|
+
// 1. Pre-bake snippets for the structural validator. Pull from the
|
|
55
|
+
// per-step matches; matched ones contribute, unmatched skip.
|
|
56
|
+
const prebakedSnippets = [];
|
|
57
|
+
request.perStepMatches.forEach((match, idx) => {
|
|
58
|
+
if (match?.matched && match.call) {
|
|
59
|
+
prebakedSnippets.push({
|
|
60
|
+
stepNum: idx + 1,
|
|
61
|
+
stepText: request.action.steps[idx] ?? '',
|
|
62
|
+
snippet: match.call,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
// 2. Build prompt values.
|
|
67
|
+
const promptValues = buildPromptValues({
|
|
68
|
+
action: request.action,
|
|
69
|
+
context: request.context,
|
|
70
|
+
perStepMatches: request.perStepMatches,
|
|
71
|
+
availableClients: opts.availableClients,
|
|
72
|
+
siblingActions: opts.siblingActions,
|
|
73
|
+
processContext: opts.processContext,
|
|
74
|
+
});
|
|
75
|
+
// 3. Surgical retry loop (cap at 1).
|
|
76
|
+
const maxAttempts = opts.disableSurgicalRetry ? 1 : 2;
|
|
77
|
+
let lastParseError = null;
|
|
78
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
79
|
+
const userPrefix = lastParseError
|
|
80
|
+
? buildSurgicalRetryPrefix(lastParseError, request.action.name)
|
|
81
|
+
: '';
|
|
82
|
+
let runResult;
|
|
83
|
+
try {
|
|
84
|
+
const runOpts = {
|
|
85
|
+
operation: 'realize-action',
|
|
86
|
+
values: promptValues,
|
|
87
|
+
model: opts.model,
|
|
88
|
+
timeoutMs: opts.timeoutMs,
|
|
89
|
+
userPrefix,
|
|
90
|
+
};
|
|
91
|
+
// The default loadPrompt searches @specverse/assets first, then
|
|
92
|
+
// engines' bundled assets dir. Most environments hit one of those.
|
|
93
|
+
// For the local-development dev-loop where realize-action.prompt.yaml
|
|
94
|
+
// is freshly added but assets isn't republished yet, we fall back
|
|
95
|
+
// to a filesystem path inside specverse-self/assets/.
|
|
96
|
+
runResult = await callRunPromptWithFallback(runPrompt, runOpts, loadPromptResolved);
|
|
97
|
+
}
|
|
98
|
+
catch (e) {
|
|
99
|
+
// Any error from runPrompt — bubble up as null (γ stub).
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
// 4. Extract the ```typescript fenced block.
|
|
103
|
+
const body = extractTypescriptBlock(runResult.text);
|
|
104
|
+
if (!body || body.trim().length === 0) {
|
|
105
|
+
// No usable body — γ stub.
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
// 5. Structural validator — DR3. A rewritten pre-baked snippet
|
|
109
|
+
// is a LOUD failure (not a silent retry).
|
|
110
|
+
const structural = validateLlmOutputPreservesConventions(body, prebakedSnippets);
|
|
111
|
+
if (structural.ok === false) {
|
|
112
|
+
throw new Error(`[realize-action] structural-preservation failed for ${request.action.ownerName}.${request.action.name}:\n${structural.reason}`);
|
|
113
|
+
}
|
|
114
|
+
// 6. esbuild parse check — surgical retry once on parse failure.
|
|
115
|
+
const parseError = await parseCheck(body);
|
|
116
|
+
if (parseError === null) {
|
|
117
|
+
// All gates green — return the body.
|
|
118
|
+
return body;
|
|
119
|
+
}
|
|
120
|
+
lastParseError = parseError;
|
|
121
|
+
// Loop continues only if we have an attempt left.
|
|
122
|
+
}
|
|
123
|
+
// Exhausted retries — fall through to γ stub.
|
|
124
|
+
return null;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
// ─── Prompt loading + assets fallback ────────────────────────────────
|
|
128
|
+
/**
|
|
129
|
+
* Default loader — uses the canonical loadPrompt('realize-action') path
|
|
130
|
+
* (@specverse/assets first, then engine-bundled assets).
|
|
131
|
+
*/
|
|
132
|
+
function loadRealizeActionPrompt() {
|
|
133
|
+
return loadPrompt('realize-action');
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Wrapper around runPrompt that falls back to a workspace-relative
|
|
137
|
+
* specverse-self/assets/ lookup when realize-action.prompt.yaml isn't
|
|
138
|
+
* yet in the installed @specverse/assets package. Returns the same shape
|
|
139
|
+
* as runPrompt.
|
|
140
|
+
*
|
|
141
|
+
* This is a Phase 3 bridging concern — once @specverse/assets ships
|
|
142
|
+
* realize-action.prompt.yaml, the fallback is dead code (but harmless).
|
|
143
|
+
*/
|
|
144
|
+
async function callRunPromptWithFallback(runPromptImpl, opts, fallbackLoader) {
|
|
145
|
+
// First try: just call runPrompt — it does its own loadPrompt.
|
|
146
|
+
try {
|
|
147
|
+
return await runPromptImpl(opts);
|
|
148
|
+
}
|
|
149
|
+
catch (e) {
|
|
150
|
+
const msg = e?.message ?? String(e);
|
|
151
|
+
if (!/prompt file not found for "realize-action"/i.test(msg)) {
|
|
152
|
+
throw e;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// Second try: load the prompt via the fallback resolver and call the
|
|
156
|
+
// generateText path manually. We use runPrompt's public assembleSystem /
|
|
157
|
+
// assembleUser helpers so we don't reimplement the substitution logic.
|
|
158
|
+
const prompt = fallbackLoader();
|
|
159
|
+
const system = assembleSystem(prompt);
|
|
160
|
+
const baseUser = assembleUser(prompt, opts.values);
|
|
161
|
+
const user = (opts.userPrefix || '') + baseUser;
|
|
162
|
+
// Fire onAssembled so callers (audit-trail recorders) see the input.
|
|
163
|
+
if (typeof opts.onAssembled === 'function') {
|
|
164
|
+
opts.onAssembled({ system, user });
|
|
165
|
+
}
|
|
166
|
+
// Defer to the AI SDK directly — same shape as runPrompt's body but
|
|
167
|
+
// with the prompt content already loaded.
|
|
168
|
+
const aiSdk = await import('ai');
|
|
169
|
+
const { resolveModel } = await import('../ai/model-resolver.js');
|
|
170
|
+
const model = opts.model ?? resolveModel({ ...(opts.modelOptions ?? {}), timeout: opts.timeoutMs ?? 300_000 });
|
|
171
|
+
const t0 = Date.now();
|
|
172
|
+
const result = await aiSdk.generateText({
|
|
173
|
+
model,
|
|
174
|
+
system,
|
|
175
|
+
prompt: user,
|
|
176
|
+
abortSignal: AbortSignal.timeout(opts.timeoutMs ?? 300_000),
|
|
177
|
+
});
|
|
178
|
+
const duration_ms = Date.now() - t0;
|
|
179
|
+
return {
|
|
180
|
+
text: result.text,
|
|
181
|
+
tokens: {
|
|
182
|
+
input: result.usage?.inputTokens?.total ?? null,
|
|
183
|
+
output: result.usage?.outputTokens?.total ?? null,
|
|
184
|
+
},
|
|
185
|
+
duration_ms,
|
|
186
|
+
system,
|
|
187
|
+
user,
|
|
188
|
+
providerId: model.provider,
|
|
189
|
+
modelId: model.modelId,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Filesystem fallback for realize-action.prompt.yaml when the installed
|
|
194
|
+
* @specverse/assets package predates Phase 2's prompt addition.
|
|
195
|
+
*
|
|
196
|
+
* Searches a small fixed set of candidate paths relative to the engines
|
|
197
|
+
* package's installed location and the worktree layout used in
|
|
198
|
+
* specverse-self repo. Returns null when none are found; runPrompt then
|
|
199
|
+
* surfaces the canonical "prompt file not found" error.
|
|
200
|
+
*/
|
|
201
|
+
export function loadRealizeActionPromptFromFallback() {
|
|
202
|
+
const candidates = [];
|
|
203
|
+
// 1. @specverse/assets package (covers the post-Phase-2 publish case).
|
|
204
|
+
try {
|
|
205
|
+
const pkg = require.resolve('@specverse/assets/package.json');
|
|
206
|
+
candidates.push(join(dirname(pkg), 'prompts/core/standard/default/realize-action.prompt.yaml'), join(dirname(pkg), 'prompts/core/standard/v9/realize-action.prompt.yaml'));
|
|
207
|
+
}
|
|
208
|
+
catch {
|
|
209
|
+
/* assets not installed */
|
|
210
|
+
}
|
|
211
|
+
// 2. Engine-bundled assets (engines ≤ 6.0.2-style layouts).
|
|
212
|
+
try {
|
|
213
|
+
const enginesPkg = require.resolve('@specverse/engines/package.json');
|
|
214
|
+
candidates.push(join(dirname(enginesPkg), 'assets/prompts/core/standard/default/realize-action.prompt.yaml'), join(dirname(enginesPkg), 'assets/prompts/core/standard/v9/realize-action.prompt.yaml'));
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
/* engines not installed at this path */
|
|
218
|
+
}
|
|
219
|
+
// 3. Worktree fallback — specverse-self lives next to specverse-engines.
|
|
220
|
+
// The path here is from `engines/dist/realize/per-action-llm-emit.js`
|
|
221
|
+
// (or `engines/src/realize/per-action-llm-emit.ts` in dev) up to the
|
|
222
|
+
// SpecVerse parent dir. Resolved at runtime so we tolerate either layout.
|
|
223
|
+
try {
|
|
224
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
225
|
+
const specverseSelfFallbacks = [
|
|
226
|
+
resolve(here, '../../../../specverse-self/assets/prompts/core/standard/default/realize-action.prompt.yaml'),
|
|
227
|
+
resolve(here, '../../../../specverse-self/assets/prompts/core/standard/v9/realize-action.prompt.yaml'),
|
|
228
|
+
resolve(here, '../../../../../specverse-self/assets/prompts/core/standard/default/realize-action.prompt.yaml'),
|
|
229
|
+
resolve(here, '../../../../../specverse-self/assets/prompts/core/standard/v9/realize-action.prompt.yaml'),
|
|
230
|
+
];
|
|
231
|
+
candidates.push(...specverseSelfFallbacks);
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
/* import.meta.url unavailable — skip */
|
|
235
|
+
}
|
|
236
|
+
for (const p of candidates) {
|
|
237
|
+
if (existsSync(p)) {
|
|
238
|
+
try {
|
|
239
|
+
return yaml.load(readFileSync(p, 'utf-8'));
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
/* try next */
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Convert an ActionSpec + per-step matcher results into the variable
|
|
250
|
+
* map consumed by realize-action.prompt.yaml's `user.template`.
|
|
251
|
+
*
|
|
252
|
+
* Variables (matching the prompt template):
|
|
253
|
+
* - ownerKind, ownerName, actionName
|
|
254
|
+
* - actionSpec — yaml block of the action's spec body
|
|
255
|
+
* - parameterList, returnType — for the signature line
|
|
256
|
+
* - perStepScaffolding — annotated [PRE-BAKED] / [WRITE] step list
|
|
257
|
+
* - availableClients, siblingActions, processContext — context
|
|
258
|
+
* strings the caller composes (default placeholder when omitted)
|
|
259
|
+
*/
|
|
260
|
+
function buildPromptValues(args) {
|
|
261
|
+
const { action, perStepMatches, availableClients, siblingActions, processContext } = args;
|
|
262
|
+
const actionSpecYaml = yamlDumpAction(action);
|
|
263
|
+
const parameterList = buildParameterList(action);
|
|
264
|
+
const returnType = buildReturnType(action);
|
|
265
|
+
const perStepScaffolding = buildPerStepScaffolding(action.steps, perStepMatches);
|
|
266
|
+
return {
|
|
267
|
+
ownerKind: action.ownerKind,
|
|
268
|
+
ownerName: action.ownerName,
|
|
269
|
+
actionName: action.name,
|
|
270
|
+
actionSpec: actionSpecYaml,
|
|
271
|
+
parameterList,
|
|
272
|
+
returnType,
|
|
273
|
+
perStepScaffolding,
|
|
274
|
+
availableClients: availableClients ?? '(none)',
|
|
275
|
+
siblingActions: siblingActions ?? '(none listed)',
|
|
276
|
+
processContext: processContext ?? '(no related processes)',
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
/** Render the action's spec body as YAML for the SOURCE OF TRUTH section. */
|
|
280
|
+
function yamlDumpAction(action) {
|
|
281
|
+
const body = {};
|
|
282
|
+
if (action.description)
|
|
283
|
+
body.description = action.description;
|
|
284
|
+
if (action.parameters)
|
|
285
|
+
body.parameters = action.parameters;
|
|
286
|
+
if (action.returns)
|
|
287
|
+
body.returns = action.returns;
|
|
288
|
+
if (action.steps?.length)
|
|
289
|
+
body.steps = action.steps;
|
|
290
|
+
if (action.requires?.length)
|
|
291
|
+
body.requires = action.requires;
|
|
292
|
+
if (action.ensures?.length)
|
|
293
|
+
body.ensures = action.ensures;
|
|
294
|
+
if (action.publishes?.length)
|
|
295
|
+
body.publishes = action.publishes;
|
|
296
|
+
return yaml.dump({ [action.name]: body }, { lineWidth: 100, noRefs: true });
|
|
297
|
+
}
|
|
298
|
+
/** Build the param list for the signature line shown to the LLM. */
|
|
299
|
+
function buildParameterList(action) {
|
|
300
|
+
if (!action.parameters || Object.keys(action.parameters).length === 0) {
|
|
301
|
+
return '';
|
|
302
|
+
}
|
|
303
|
+
return Object.entries(action.parameters)
|
|
304
|
+
.map(([name, spec]) => `${name}: ${specTypeToTs(spec)}`)
|
|
305
|
+
.join(', ');
|
|
306
|
+
}
|
|
307
|
+
/** Build the return-type string for the signature line. */
|
|
308
|
+
function buildReturnType(action) {
|
|
309
|
+
if (!action.returns)
|
|
310
|
+
return 'void';
|
|
311
|
+
return specTypeToTs(action.returns);
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Translate spec-type strings into approximate TS types. The realize
|
|
315
|
+
* pipeline has a more rigorous translator; this is a "good enough for
|
|
316
|
+
* the prompt" version. The LLM only uses it as documentation — the
|
|
317
|
+
* realize template does the real signature emission.
|
|
318
|
+
*/
|
|
319
|
+
function specTypeToTs(specType) {
|
|
320
|
+
// "UUID required" → "string"; "Decimal required" → "number"; etc.
|
|
321
|
+
const tokens = specType.split(/\s+/);
|
|
322
|
+
const head = tokens[0]?.toLowerCase() ?? '';
|
|
323
|
+
switch (head) {
|
|
324
|
+
case 'string':
|
|
325
|
+
case 'uuid':
|
|
326
|
+
case 'date':
|
|
327
|
+
case 'datetime':
|
|
328
|
+
return 'string';
|
|
329
|
+
case 'integer':
|
|
330
|
+
case 'int':
|
|
331
|
+
case 'float':
|
|
332
|
+
case 'number':
|
|
333
|
+
case 'decimal':
|
|
334
|
+
return 'number';
|
|
335
|
+
case 'boolean':
|
|
336
|
+
case 'bool':
|
|
337
|
+
return 'boolean';
|
|
338
|
+
case 'object':
|
|
339
|
+
case 'json':
|
|
340
|
+
return 'Record<string, unknown>';
|
|
341
|
+
default:
|
|
342
|
+
// Domain types like `OrderResult` come through verbatim.
|
|
343
|
+
return tokens[0] ?? 'unknown';
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/** Render the per-step scaffolding block: annotated [PRE-BAKED] / [WRITE]. */
|
|
347
|
+
function buildPerStepScaffolding(steps, perStepMatches) {
|
|
348
|
+
if (steps.length === 0)
|
|
349
|
+
return '(no steps)';
|
|
350
|
+
const lines = [];
|
|
351
|
+
for (let i = 0; i < steps.length; i++) {
|
|
352
|
+
const stepText = steps[i];
|
|
353
|
+
const match = perStepMatches[i];
|
|
354
|
+
if (match?.matched && match.call) {
|
|
355
|
+
lines.push(` ${i + 1}. [PRE-BAKED] "${stepText}"`);
|
|
356
|
+
// Indent the snippet so it's clearly nested under the step.
|
|
357
|
+
const snippetLines = match.call.split('\n').map((l) => ` ${l.trimStart()}`);
|
|
358
|
+
lines.push(...snippetLines);
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
lines.push(` ${i + 1}. [WRITE] "${stepText}"`);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return lines.join('\n');
|
|
365
|
+
}
|
|
366
|
+
// ─── Output extraction + parse check ─────────────────────────────────
|
|
367
|
+
/**
|
|
368
|
+
* Pull the first ```typescript fenced block out of an LLM response.
|
|
369
|
+
* Tolerates plain ``` (no language tag) when the body starts with
|
|
370
|
+
* recognisably-TS content. Returns null if no block is found.
|
|
371
|
+
*/
|
|
372
|
+
export function extractTypescriptBlock(text) {
|
|
373
|
+
const tsBlock = text.match(/```(?:typescript|ts)\s*\n([\s\S]*?)```/);
|
|
374
|
+
if (tsBlock?.[1])
|
|
375
|
+
return tsBlock[1].trim();
|
|
376
|
+
// Generic ``` block — accept when the content looks like TS (has at
|
|
377
|
+
// least one of: const, let, await, return, throw at start of line).
|
|
378
|
+
const generic = text.match(/```\s*\n([\s\S]*?)```/);
|
|
379
|
+
if (generic?.[1]) {
|
|
380
|
+
const candidate = generic[1].trim();
|
|
381
|
+
if (/^(const|let|await|return|throw|if|try)\b/m.test(candidate)) {
|
|
382
|
+
return candidate;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return null;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* esbuild parse check on a method body. We wrap the body in a synthetic
|
|
389
|
+
* async function so esbuild can parse top-level await + return as
|
|
390
|
+
* function-scoped statements.
|
|
391
|
+
*
|
|
392
|
+
* Returns null on success, a brief error message on failure. Skipped
|
|
393
|
+
* silently (returns null) if esbuild isn't installed — matches the
|
|
394
|
+
* existing per-step ai-behaviors-generator's tolerance.
|
|
395
|
+
*/
|
|
396
|
+
async function esbuildParseCheck(body) {
|
|
397
|
+
try {
|
|
398
|
+
const esbuild = await import('esbuild');
|
|
399
|
+
const wrapped = `export async function __realizeAction(): Promise<unknown> {\n${body}\n}`;
|
|
400
|
+
await esbuild.transform(wrapped, { loader: 'ts', format: 'esm', target: 'es2022' });
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
catch (err) {
|
|
404
|
+
const msg = err?.errors?.[0]?.text || err?.message || 'unknown parse error';
|
|
405
|
+
return msg;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Build the user-prefix prepended on the surgical-retry attempt. Frames
|
|
410
|
+
* the prior parse error as a fix-up directive without re-stating the
|
|
411
|
+
* whole prompt.
|
|
412
|
+
*/
|
|
413
|
+
function buildSurgicalRetryPrefix(parseError, actionName) {
|
|
414
|
+
return [
|
|
415
|
+
`Your previous output for ${actionName} failed esbuild parse:`,
|
|
416
|
+
'',
|
|
417
|
+
parseError,
|
|
418
|
+
'',
|
|
419
|
+
'Re-emit the method body, fixing the syntax error. Same output format ' +
|
|
420
|
+
'(```typescript fenced block, body only). Preserve all [PRE-BAKED] ' +
|
|
421
|
+
'snippets verbatim.',
|
|
422
|
+
'',
|
|
423
|
+
'---',
|
|
424
|
+
'',
|
|
425
|
+
].join('\n');
|
|
426
|
+
}
|
|
427
|
+
//# sourceMappingURL=per-action-llm-emit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"per-action-llm-emit.js","sourceRoot":"","sources":["../../src/realize/per-action-llm-emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EA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