@sublang/slc 0.15.1 → 0.16.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/README.md +66 -5
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +35 -1
- package/dist/app.js.map +1 -1
- package/dist/artifacts.d.ts +2 -0
- package/dist/artifacts.d.ts.map +1 -1
- package/dist/artifacts.js.map +1 -1
- package/dist/config-file.d.ts +2 -0
- package/dist/config-file.d.ts.map +1 -1
- package/dist/config-file.js +2 -0
- package/dist/config-file.js.map +1 -1
- package/dist/emitted-imports.d.ts +19 -0
- package/dist/emitted-imports.d.ts.map +1 -1
- package/dist/emitted-imports.js +64 -1
- package/dist/emitted-imports.js.map +1 -1
- package/dist/entry-module.d.ts +6 -1
- package/dist/entry-module.d.ts.map +1 -1
- package/dist/entry-module.js +51 -26
- package/dist/entry-module.js.map +1 -1
- package/dist/invocation.d.ts +6 -0
- package/dist/invocation.d.ts.map +1 -1
- package/dist/invocation.js +20 -0
- package/dist/invocation.js.map +1 -1
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +273 -7
- package/dist/runner.js.map +1 -1
- package/dist/slc.config.template.yaml +1 -1
- package/dist/verify-coverage.d.ts +1 -0
- package/dist/verify-coverage.d.ts.map +1 -1
- package/dist/verify-coverage.js +91 -13
- package/dist/verify-coverage.js.map +1 -1
- package/dist/verify-source.d.ts +11 -4
- package/dist/verify-source.d.ts.map +1 -1
- package/dist/verify-source.js +114 -10
- package/dist/verify-source.js.map +1 -1
- package/dist/verify-support.d.ts +2 -1
- package/dist/verify-support.d.ts.map +1 -1
- package/dist/verify-support.js +4 -3
- package/dist/verify-support.js.map +1 -1
- package/dist/verify.d.ts +4 -1
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +18 -9
- package/dist/verify.js.map +1 -1
- package/package.json +1 -1
package/dist/entry-module.js
CHANGED
|
@@ -9,19 +9,19 @@
|
|
|
9
9
|
* default-exporting a Playbook registry entry derived entirely from the
|
|
10
10
|
* compiled bundle — `id`/`command` from the basename, `requiredRoleIds` from
|
|
11
11
|
* the gears `Roles:`/`Players:` declaration, `intent` from the normalized
|
|
12
|
-
* source's title and
|
|
13
|
-
* validator (or the retained legacy allowlist), and `createRuntime`
|
|
14
|
-
* linked default factory. A current `Roles:` source declares the
|
|
15
|
-
* lowercase local role ids its compiled machine's delegated states
|
|
16
|
-
* the host binds exactly those ids and the session's `callPlayer`
|
|
17
|
-
* no translation (DR-024); a historical `Players:` source keeps
|
|
18
|
-
* declared names behind the DR-017 role-binding boundary, which
|
|
19
|
-
* linked runtime's lowercased player ids back to them. Its
|
|
20
|
-
* consumes the module unchanged (self-hosting-14). See
|
|
12
|
+
* source's title and first prose paragraph, the linked artifact's public pure
|
|
13
|
+
* option validator (or the retained legacy allowlist), and `createRuntime`
|
|
14
|
+
* wiring the linked default factory. A current `Roles:` source declares the
|
|
15
|
+
* canonical lowercase local role ids its compiled machine's delegated states
|
|
16
|
+
* name, so the host binds exactly those ids and the session's `callPlayer`
|
|
17
|
+
* port needs no translation (DR-024); a historical `Players:` source keeps
|
|
18
|
+
* its verbatim declared names behind the DR-017 role-binding boundary, which
|
|
19
|
+
* maps the linked runtime's lowercased player ids back to them. Its
|
|
20
|
+
* generation's host consumes the module unchanged (self-hosting-14). See
|
|
21
21
|
* specs/packages/self-hosting.md.
|
|
22
22
|
*/
|
|
23
23
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
24
|
-
import { join } from 'node:path';
|
|
24
|
+
import { join, relative, sep } from 'node:path';
|
|
25
25
|
import { inspectGearsRoleContract, parseGearsItems } from './verify.js';
|
|
26
26
|
import { linkedOptionsValidator } from './entry-options.js';
|
|
27
27
|
/** Emits the entry module and returns its path. */
|
|
@@ -49,31 +49,55 @@ export async function emitEntryModule(opts) {
|
|
|
49
49
|
byRoleId.set(roleId, name);
|
|
50
50
|
});
|
|
51
51
|
const hasScript = parseGearsItems(gears).some((item) => item.actor === 'script');
|
|
52
|
+
const bundle = opts.artifactDir ?? join(opts.cwd, `${opts.basename}.${opts.pipeline}`);
|
|
52
53
|
const delegatedOptions = schema3 &&
|
|
53
54
|
(await linkedOptionsValidator({
|
|
54
|
-
linkedPath: join(
|
|
55
|
-
fsmPath: join(
|
|
55
|
+
linkedPath: join(bundle, `${opts.basename}.playbook.ts`),
|
|
56
|
+
fsmPath: join(bundle, `${opts.basename}.fsm.ts`),
|
|
56
57
|
})) !== undefined;
|
|
57
58
|
const intent = deriveIntent(text) ?? opts.basename;
|
|
58
59
|
const path = join(opts.cwd, `${opts.basename}.ts`);
|
|
59
|
-
await writeFile(path, renderEntryModule({
|
|
60
|
+
await (opts.write ?? writeFile)(path, renderEntryModule({
|
|
60
61
|
basename: opts.basename,
|
|
61
|
-
bundleLeaf:
|
|
62
|
+
bundleLeaf: relative(opts.cwd, bundle).split(sep).join('/') || '.',
|
|
62
63
|
roleIds: schema3 ? roleContract.roleIds : roleContract.names,
|
|
63
64
|
hasScript,
|
|
64
65
|
delegatedOptions,
|
|
65
66
|
intent,
|
|
66
67
|
schema3,
|
|
67
68
|
concurrentRoleSets: schema3 ? roleContract.concurrentRoleSets : [],
|
|
68
|
-
})
|
|
69
|
+
}));
|
|
69
70
|
return path;
|
|
70
71
|
}
|
|
71
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* An ATX heading on a trimmed line (CommonMark 4.2): one to six `#` followed by
|
|
74
|
+
* whitespace or the line's end, so a `#123` issue reference is prose.
|
|
75
|
+
*/
|
|
76
|
+
const ATX_HEADING = /^#{1,6}(?:\s|$)/;
|
|
77
|
+
/**
|
|
78
|
+
* Besides an ATX heading, a line that ends a hard-wrapped prose paragraph: a
|
|
79
|
+
* comment, a new list item (a marker followed by whitespace, so a wrapped `-1`
|
|
80
|
+
* or `-based` continues the sentence), or a role-declaration label.
|
|
81
|
+
*/
|
|
82
|
+
const PARAGRAPH_BREAK = /^(?:<!--|(?:[-*+]|\d+[.)])\s|(?:Roles|Players):\s*$)/;
|
|
83
|
+
/**
|
|
84
|
+
* Title and first prose paragraph of the normalized source, joined as the
|
|
85
|
+
* intent. The compiler's normalized text hard-wraps paragraphs, so the lead's
|
|
86
|
+
* continuation lines are joined with single spaces until the paragraph ends.
|
|
87
|
+
*/
|
|
72
88
|
function deriveIntent(text) {
|
|
73
89
|
let title;
|
|
74
|
-
|
|
90
|
+
const lead = [];
|
|
75
91
|
for (const line of text.split('\n')) {
|
|
76
92
|
const trimmed = line.trim();
|
|
93
|
+
if (lead.length > 0) {
|
|
94
|
+
if (trimmed === '' ||
|
|
95
|
+
ATX_HEADING.test(trimmed) ||
|
|
96
|
+
PARAGRAPH_BREAK.test(trimmed))
|
|
97
|
+
break;
|
|
98
|
+
lead.push(trimmed);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
77
101
|
if (trimmed === '' || trimmed.startsWith('<!--'))
|
|
78
102
|
continue;
|
|
79
103
|
if (title === undefined) {
|
|
@@ -83,17 +107,18 @@ function deriveIntent(text) {
|
|
|
83
107
|
continue;
|
|
84
108
|
}
|
|
85
109
|
}
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
|
|
110
|
+
if (ATX_HEADING.test(trimmed) ||
|
|
111
|
+
// A bullet's `-` is followed by whitespace, so a leading `-1` is prose.
|
|
112
|
+
/^-(?:\s|$)/.test(trimmed) ||
|
|
113
|
+
/^(?:Roles|Players):\s*$/.test(trimmed)) {
|
|
89
114
|
continue;
|
|
90
115
|
}
|
|
91
|
-
lead
|
|
92
|
-
break;
|
|
116
|
+
lead.push(trimmed);
|
|
93
117
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
118
|
+
const paragraph = lead.length > 0 ? lead.join(' ') : undefined;
|
|
119
|
+
if (title !== undefined && paragraph !== undefined)
|
|
120
|
+
return `${title} — ${paragraph}`;
|
|
121
|
+
return title ?? paragraph;
|
|
97
122
|
}
|
|
98
123
|
function renderEntryModule(spec) {
|
|
99
124
|
const allowed = spec.hasScript ? `['cwd']` : `[]`;
|
|
@@ -195,7 +220,7 @@ function withRoleBinding<T extends object>(runtime: T): T {
|
|
|
195
220
|
// playbook to \`playbook run\`. Derived deterministically from the compiled
|
|
196
221
|
${roleNote}
|
|
197
222
|
|
|
198
|
-
import createPlaybookRuntime${spec.delegatedOptions ? ', { validateOptions as linkedValidateOptions }' : ''} from './${spec.bundleLeaf}
|
|
223
|
+
import createPlaybookRuntime${spec.delegatedOptions ? ', { validateOptions as linkedValidateOptions }' : ''} from './${spec.bundleLeaf === '.' ? '' : `${spec.bundleLeaf}/`}${spec.basename}.playbook.ts';
|
|
199
224
|
|
|
200
225
|
type FactoryInput = NonNullable<Parameters<typeof createPlaybookRuntime>[0]>;
|
|
201
226
|
${runtimeOptionsAlias}
|
package/dist/entry-module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-module.js","sourceRoot":"","sources":["../src/entry-module.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,0EAA0E;AAE1E;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"entry-module.js","sourceRoot":"","sources":["../src/entry-module.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,0EAA0E;AAE1E;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAqB5D,mDAAmD;AACnD,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,IAA4B;IA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AG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1E,OAAO,IAAI,KAAK,GAAG,CAAC;AACtB,CAAC"}
|
package/dist/invocation.d.ts
CHANGED
|
@@ -14,6 +14,12 @@ export interface LinkOption {
|
|
|
14
14
|
}
|
|
15
15
|
/** A parsed `slc` invocation, routed to one of the four run forms. */
|
|
16
16
|
export type Invocation = {
|
|
17
|
+
kind: 'complete';
|
|
18
|
+
pipeline: 'playbook';
|
|
19
|
+
source: string;
|
|
20
|
+
/** Declares the retained bundle's target; completion never links. */
|
|
21
|
+
linkTarget: string | null;
|
|
22
|
+
} | {
|
|
17
23
|
kind: 'full';
|
|
18
24
|
pipeline: string;
|
|
19
25
|
source: string;
|
package/dist/invocation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invocation.d.ts","sourceRoot":"","sources":["../src/invocation.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,4EAA4E;AAC5E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,sEAAsE;AACtE,MAAM,MAAM,UAAU,GAClB;IACE,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,mEAAmE;IACnE,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,GACD;IACE,IAAI,EAAE,WAAW,CA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,iBAAiB,GACjB,cAAc,GACd,qBAAqB,GACrB,gBAAgB,GAChB,kBAAkB,CAAC;AAEvB,8EAA8E;AAC9E,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAE5B,YAAY,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAI9C;CACF;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,CAoKnE"}
|
package/dist/invocation.js
CHANGED
|
@@ -25,6 +25,7 @@ export function parseInvocation(argv) {
|
|
|
25
25
|
let noOptimize = false;
|
|
26
26
|
let normalize = false;
|
|
27
27
|
let rebuild = false;
|
|
28
|
+
let complete = false;
|
|
28
29
|
const options = [];
|
|
29
30
|
for (let i = 0; i < argv.length; i++) {
|
|
30
31
|
const arg = argv[i];
|
|
@@ -55,6 +56,11 @@ export function parseInvocation(argv) {
|
|
|
55
56
|
throw new CliError('duplicate-option', 'repeated --rebuild');
|
|
56
57
|
rebuild = true;
|
|
57
58
|
}
|
|
59
|
+
else if (arg === '--complete') {
|
|
60
|
+
if (complete)
|
|
61
|
+
throw new CliError('duplicate-option', 'repeated --complete');
|
|
62
|
+
complete = true;
|
|
63
|
+
}
|
|
58
64
|
else if (arg.startsWith('-') && arg !== '-') {
|
|
59
65
|
throw new CliError('unknown-option', `unknown option "${arg}"`);
|
|
60
66
|
}
|
|
@@ -73,6 +79,20 @@ export function parseInvocation(argv) {
|
|
|
73
79
|
throw new CliError('no-pipeline', `invalid pipeline reference "${head}"`);
|
|
74
80
|
}
|
|
75
81
|
const rest = positionals.slice(1);
|
|
82
|
+
if (complete) {
|
|
83
|
+
if (pipeline !== 'playbook' ||
|
|
84
|
+
phase !== null ||
|
|
85
|
+
output !== null ||
|
|
86
|
+
optimize ||
|
|
87
|
+
noOptimize ||
|
|
88
|
+
normalize ||
|
|
89
|
+
rebuild ||
|
|
90
|
+
options.length > 0) {
|
|
91
|
+
throw new CliError('unexpected-flag', '--complete requires the full-form playbook invocation with only a Source and optional --link target');
|
|
92
|
+
}
|
|
93
|
+
requireSingleSource(rest);
|
|
94
|
+
return { kind: 'complete', pipeline, source: rest[0], linkTarget: link };
|
|
95
|
+
}
|
|
76
96
|
if (optimize && noOptimize) {
|
|
77
97
|
throw new CliError('duplicate-option', '-O/--optimize conflicts with --no-optimize');
|
|
78
98
|
}
|
package/dist/invocation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invocation.js","sourceRoot":"","sources":["../src/invocation.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,0EAA0E;
|
|
1
|
+
{"version":3,"file":"invocation.js","sourceRoot":"","sources":["../src/invocation.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,0EAA0E;AA+E1E,8EAA8E;AAC9E,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,IAAI,CAAe;IAE5B,YAAY,IAAkB,EAAE,OAAe;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,IAAuB;IACrD,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,IAAI,MAAM,GAAkB,IAAI,CAAC;IACjC,IAAI,IAAI,GAAkB,IAAI,CAAC;IAC/B,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,MAAM,OAAO,GAAiB,EAAE,CAAC;IAEjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,C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AAC;IACD,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,QAAQ;QACR,MAAM;QACN,MAAM;QACN,QAAQ;QACR,UAAU;QACV,SAAS;QACT,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/C,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAChB,IAAuB,EACvB,KAAa,EACb,IAAY;IAEZ,IAAI,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QACzB,MAAM,IAAI,QAAQ,CAAC,cAAc,EAAE,qBAAqB,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACpC,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACZ,MAAM,IAAI,QAAQ,CAChB,qBAAqB,EACrB,0CAA0C,KAAK,GAAG,CACnD,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;AAClE,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAuB;IAClD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,QAAQ,CAChB,UAAU,EACV,sCAAsC,IAAI,CAAC,MAAM,EAAE,CACpD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runner.d.ts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E,SAAS,MAAM,EAAE,EACvB,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,SAAS,CAAC,CA2DpB;AA64BD,6EAA6E;AAC7E,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD"}
|
package/dist/runner.js
CHANGED
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
* injected so a host wires the real pipeline resolution and Cligent agent while
|
|
10
10
|
* tests supply fakes. See specs/packages/pipeline.md and specs/packages/phase-execution.md.
|
|
11
11
|
*/
|
|
12
|
-
import { mkdir, readFile, stat } from 'node:fs/promises';
|
|
12
|
+
import { mkdir, readFile, stat, writeFile } from 'node:fs/promises';
|
|
13
13
|
import { dirname, join, relative, resolve, sep } from 'node:path';
|
|
14
14
|
import { fileURLToPath } from 'node:url';
|
|
15
|
-
import { artifactDir, planArtifacts, parseSource } from './artifacts.js';
|
|
15
|
+
import { artifactDir, planArtifacts, parseSource, } from './artifacts.js';
|
|
16
16
|
import { formatClarificationReport, } from './clarification.js';
|
|
17
17
|
import { encodeLocator, invalidateBuildHistory, loadBuildHistory, recordBuild, verifiedInput, } from './build-history.js';
|
|
18
18
|
import { emitEntryModule } from './entry-module.js';
|
|
19
|
-
import { reconcileLinkObjectImportSpecifiers, unresolvableRelativeImports, } from './emitted-imports.js';
|
|
19
|
+
import { linkObjectEdges, reconcileLinkObjectImportSpecifiers, unresolvableRelativeImports, } from './emitted-imports.js';
|
|
20
20
|
import { messageOf } from './errors.js';
|
|
21
21
|
import { assertSafeTarget, formatFailureReport, phaseProtectedPaths, pathsAlias, runPhase, watchProtectedPaths, } from './execution.js';
|
|
22
22
|
import { compareUtf8, hashBytes, isHash } from './hash.js';
|
|
@@ -33,9 +33,9 @@ import { RESERVED_SLC_PIPELINE, defaultPlaybookLinkTarget, isReservedPipeline, }
|
|
|
33
33
|
import { readPlaybookRuntimeDeclaration, } from './runtime-contract.js';
|
|
34
34
|
import { artifactSchemaForPlaybookProvenance, checkFsmContinuationInputs, checkFsmChildSuspension, checkFsmCoverage, checkGearsActorContract, checkGearsFsmConformance, checkGearsResultContract, checkLinkedModuleContract, emitFsmCoverageTest, FsmCoverageDeadlineError, emitFsmIntrospectionTest, emitGearsFsmConformanceTest, emitPromptContractTest, findConcurrentRoleSets, inspectGearsRoleContract, findMachineConfig, loadFsmModule, loadLinkedModuleForVerification, playbookProvenanceForLinkTarget, resolveArtifactSchemaForVerification, } from './verify.js';
|
|
35
35
|
import { VERIFIER_SUPPORT_MODULE, emitVerifierSupport, verifierSupportFiles, } from './verify-support.js';
|
|
36
|
-
import { checkSourceGearsContract } from './verify-source.js';
|
|
36
|
+
import { checkSourceGearsContract, checkSourceRoles } from './verify-source.js';
|
|
37
37
|
import { checkFsmTypeScript } from './verify-typescript.js';
|
|
38
|
-
import { checkEntryOptions, ENTRY_OPTIONS_CONTRACT } from './entry-options.js';
|
|
38
|
+
import { checkEntryOptions, ENTRY_OPTIONS_CONTRACT, linkedOptionsValidator, } from './entry-options.js';
|
|
39
39
|
/**
|
|
40
40
|
* Parses argv and runs the requested pipeline, phase, or link end-to-end.
|
|
41
41
|
* Never rejects: malformed invocations, refusals, and phase failures all return
|
|
@@ -69,6 +69,8 @@ export async function runSlc(argv, deps) {
|
|
|
69
69
|
};
|
|
70
70
|
try {
|
|
71
71
|
switch (invocation.kind) {
|
|
72
|
+
case 'complete':
|
|
73
|
+
return finish(await runCompletion(invocation, deps));
|
|
72
74
|
case 'full':
|
|
73
75
|
// The reserved playbook pipeline supplies a default link target
|
|
74
76
|
// (self-hosting-13): a bare full run becomes a full-link against the
|
|
@@ -337,6 +339,227 @@ async function runFullLink(invocation, deps) {
|
|
|
337
339
|
function runCwd(deps) {
|
|
338
340
|
return resolve(deps.cwd ?? process.cwd());
|
|
339
341
|
}
|
|
342
|
+
/** Checks an explicitly selected current bundle, without executing phases/history. */
|
|
343
|
+
async function runCompletion(invocation, deps) {
|
|
344
|
+
const cwd = runCwd(deps);
|
|
345
|
+
const pipeline = await loadPipeline(await resolvePipeline(invocation.pipeline, deps.resolver));
|
|
346
|
+
const link = await requireLink(pipeline, invocation.pipeline);
|
|
347
|
+
const entry = pipeline.phases[0];
|
|
348
|
+
const source = resolve(cwd, invocation.source);
|
|
349
|
+
const { basename, raw } = parseSource({
|
|
350
|
+
path: source,
|
|
351
|
+
sourceFormat: entry.source.format,
|
|
352
|
+
ext: entry.source.ext,
|
|
353
|
+
entry: true,
|
|
354
|
+
});
|
|
355
|
+
if (raw)
|
|
356
|
+
return failure('completion requires an entry-form Source; explicitly normalize or compile raw input first');
|
|
357
|
+
const artDir = artifactDir(cwd, basename, invocation.pipeline);
|
|
358
|
+
const plan = planArtifacts({ phases: pipeline.phases, basename, artDir });
|
|
359
|
+
const gears = plan.find((artifact) => artifact.phase.target.format === 'gears');
|
|
360
|
+
const fsm = plan.find((artifact) => artifact.phase.target.format === 'fsm');
|
|
361
|
+
if (entry.source.format !== 'text' ||
|
|
362
|
+
entry.source.ext !== '.md' ||
|
|
363
|
+
gears?.phase.target.ext !== '.md' ||
|
|
364
|
+
fsm?.phase.target.ext !== '.ts' ||
|
|
365
|
+
link.source.format !== 'fsm' ||
|
|
366
|
+
link.source.ext !== '.ts' ||
|
|
367
|
+
link.target.format !== 'playbook' ||
|
|
368
|
+
link.target.ext !== '.ts')
|
|
369
|
+
return failure('completion requires the text/GEARS/TypeScript-FSM/Playbook canonical pipeline formats');
|
|
370
|
+
const linked = join(artDir, `${basename}.playbook.ts`);
|
|
371
|
+
const entryPath = join(cwd, `${basename}.ts`);
|
|
372
|
+
const linkTarget = invocation.linkTarget === null
|
|
373
|
+
? defaultPlaybookLinkTarget()
|
|
374
|
+
: resolve(cwd, invocation.linkTarget);
|
|
375
|
+
const selected = [source, gears.path, fsm.path, linked, linkTarget];
|
|
376
|
+
for (const path of selected) {
|
|
377
|
+
try {
|
|
378
|
+
if (!(await stat(path)).isFile())
|
|
379
|
+
throw new Error('not a regular file');
|
|
380
|
+
await readFile(path);
|
|
381
|
+
}
|
|
382
|
+
catch (error) {
|
|
383
|
+
return failure(`completion requires readable file ${path}: ${messageOf(error)}`);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
const pinInputs = new Set([
|
|
387
|
+
join(pipeline.dir, PINS_FILE),
|
|
388
|
+
join(pipeline.dir, PIN_INPUTS_FILE),
|
|
389
|
+
]);
|
|
390
|
+
const pinFile = (await loadPinFile(pipeline.dir)).file;
|
|
391
|
+
if (pinFile !== undefined) {
|
|
392
|
+
await evaluatePinFile(pipeline.dir, pinFile, {
|
|
393
|
+
observePath: (path) => pinInputs.add(resolve(path)),
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
const definitions = chainDefinitions(pipeline);
|
|
397
|
+
const declared = await declaredInputPaths(pipeline, pinFile, [...pipeline.phases, ...pipeline.passes]
|
|
398
|
+
.map((phase) => ({
|
|
399
|
+
path: phaseDefinition(pipeline, phase.name),
|
|
400
|
+
phase: phase.name,
|
|
401
|
+
}))
|
|
402
|
+
.concat([{ path: pipeline.linkFile, phase: 'link' }]));
|
|
403
|
+
const verification = {
|
|
404
|
+
pipeline: invocation.pipeline,
|
|
405
|
+
plan,
|
|
406
|
+
artDir,
|
|
407
|
+
basename,
|
|
408
|
+
linkTarget,
|
|
409
|
+
};
|
|
410
|
+
const targets = [
|
|
411
|
+
...verificationHostTargets(verification),
|
|
412
|
+
{ path: entryPath },
|
|
413
|
+
];
|
|
414
|
+
const protectedInputs = [
|
|
415
|
+
...new Set([
|
|
416
|
+
...selected,
|
|
417
|
+
...definitions,
|
|
418
|
+
...declared.paths,
|
|
419
|
+
...pinInputs,
|
|
420
|
+
join(artDir, '.slc'),
|
|
421
|
+
...targets.flatMap((target) => target.protectedInputs ?? []),
|
|
422
|
+
]),
|
|
423
|
+
];
|
|
424
|
+
// Reuse ordinary definition/pin validation and physical output guards. There
|
|
425
|
+
// are deliberately no steps and no incremental context to execute or publish.
|
|
426
|
+
return executeSteps([], pipeline, deps, {
|
|
427
|
+
hostTargets: targets.map((target) => ({
|
|
428
|
+
...target,
|
|
429
|
+
required: true,
|
|
430
|
+
protectedInputs,
|
|
431
|
+
})),
|
|
432
|
+
complete: async (_result, guardTarget) => {
|
|
433
|
+
const unchanged = await watchProtectedPaths(protectedInputs);
|
|
434
|
+
const pending = new Map();
|
|
435
|
+
const prepare = async (path, content) => {
|
|
436
|
+
if (pending.has(path))
|
|
437
|
+
throw new Error(`duplicate completion output: ${path}`);
|
|
438
|
+
pending.set(path, content);
|
|
439
|
+
};
|
|
440
|
+
let findings;
|
|
441
|
+
let prepared;
|
|
442
|
+
try {
|
|
443
|
+
deps.signal?.throwIfAborted();
|
|
444
|
+
// The emitted entry must load the very FSM bytes checked below: refuse
|
|
445
|
+
// a JavaScript edge, and require a value import of the TypeScript FSM.
|
|
446
|
+
const edges = await linkObjectEdges(linked, fsm.path);
|
|
447
|
+
findings = edges.javascript.map((specifier) => `completion cannot verify JavaScript FSM import ${specifier} against checked ${fsm.path}; review and correct the retained linked import to select the TypeScript FSM, then rerun --complete`);
|
|
448
|
+
if (findings.length === 0 && edges.typescript.length === 0)
|
|
449
|
+
findings = [
|
|
450
|
+
`completion found no value import of the checked ${fsm.path} in linked module ${linked}; review and correct the retained linked import to select the TypeScript FSM, then rerun --complete`,
|
|
451
|
+
];
|
|
452
|
+
if (findings.length === 0)
|
|
453
|
+
findings = [
|
|
454
|
+
...(await sourceFidelityFindings(source, gears.path)),
|
|
455
|
+
...(await gearsContractFindings(gears.path)),
|
|
456
|
+
...inspectGearsRoleContract(await readFile(gears.path, 'utf8'))
|
|
457
|
+
.findings,
|
|
458
|
+
...(await checkFsmTypeScript(fsm.path, deps.signal)),
|
|
459
|
+
];
|
|
460
|
+
if (findings.length === 0)
|
|
461
|
+
findings = await fsmConformanceFindings(gears.path, fsm.path, linkTarget, deps.signal);
|
|
462
|
+
if (findings.length === 0) {
|
|
463
|
+
const config = findMachineConfig(await loadFsmModule(fsm.path));
|
|
464
|
+
findings = [
|
|
465
|
+
...checkFsmChildSuspension(config),
|
|
466
|
+
...(await linkFidelityFindings(linked, fsm.path)),
|
|
467
|
+
];
|
|
468
|
+
}
|
|
469
|
+
if (findings.length === 0) {
|
|
470
|
+
const module = (await loadLinkedModuleForVerification({
|
|
471
|
+
linkedPath: linked,
|
|
472
|
+
fsmPath: fsm.path,
|
|
473
|
+
}));
|
|
474
|
+
if (typeof module.default !== 'function')
|
|
475
|
+
findings = [
|
|
476
|
+
'linked module has no callable default runtime factory',
|
|
477
|
+
];
|
|
478
|
+
else if (inspectGearsRoleContract(await readFile(gears.path, 'utf8'))
|
|
479
|
+
.generation === 'schema-3' &&
|
|
480
|
+
(await linkedOptionsValidator({
|
|
481
|
+
linkedPath: linked,
|
|
482
|
+
fsmPath: fsm.path,
|
|
483
|
+
})) !== undefined) {
|
|
484
|
+
findings = await checkEntryOptions({
|
|
485
|
+
linkedPath: linked,
|
|
486
|
+
fsmPath: fsm.path,
|
|
487
|
+
signal: deps.signal,
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
if (findings.length === 0) {
|
|
492
|
+
const missing = await unresolvableRelativeImports(linked);
|
|
493
|
+
if (missing.length > 0)
|
|
494
|
+
findings = [
|
|
495
|
+
`linked module has unresolvable relative imports: ${missing.join(', ')}`,
|
|
496
|
+
];
|
|
497
|
+
}
|
|
498
|
+
if (findings.length === 0) {
|
|
499
|
+
prepared = await emitVerification({ ok: true, outputs: [], diagnostics: [] }, verification, guardTarget, prepare);
|
|
500
|
+
await emitEntryModule({
|
|
501
|
+
cwd,
|
|
502
|
+
basename,
|
|
503
|
+
pipeline: invocation.pipeline,
|
|
504
|
+
gearsPath: gears.path,
|
|
505
|
+
textPath: source,
|
|
506
|
+
artifactDir: artDir,
|
|
507
|
+
write: prepare,
|
|
508
|
+
});
|
|
509
|
+
const missing = targets.filter((target) => !pending.has(target.path));
|
|
510
|
+
findings = [
|
|
511
|
+
...prepared.diagnostics,
|
|
512
|
+
...missing.map((target) => `required completion output was not prepared: ${target.path}`),
|
|
513
|
+
];
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
catch (error) {
|
|
517
|
+
findings = [`completion checks could not finish: ${messageOf(error)}`];
|
|
518
|
+
}
|
|
519
|
+
const changes = await unchanged();
|
|
520
|
+
if (changes.length > 0)
|
|
521
|
+
findings = changes;
|
|
522
|
+
if (findings.length > 0)
|
|
523
|
+
return failure(formatFailureReport({
|
|
524
|
+
phase: 'complete',
|
|
525
|
+
target: entryPath,
|
|
526
|
+
reasons: [...findings],
|
|
527
|
+
}));
|
|
528
|
+
if (prepared === undefined)
|
|
529
|
+
throw new Error('completion preparation missing');
|
|
530
|
+
for (const target of targets)
|
|
531
|
+
await guardTarget(target.path);
|
|
532
|
+
deps.signal?.throwIfAborted();
|
|
533
|
+
const outputs = [];
|
|
534
|
+
try {
|
|
535
|
+
for (const path of [...prepared.outputs, entryPath]) {
|
|
536
|
+
deps.signal?.throwIfAborted();
|
|
537
|
+
await guardTarget(path);
|
|
538
|
+
await mkdir(dirname(path), { recursive: true });
|
|
539
|
+
await writeFile(path, pending.get(path));
|
|
540
|
+
outputs.push(path);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
catch (error) {
|
|
544
|
+
return {
|
|
545
|
+
ok: false,
|
|
546
|
+
outputs,
|
|
547
|
+
diagnostics: [
|
|
548
|
+
`completion output write failed: ${messageOf(error)}`,
|
|
549
|
+
...outputs.map((path) => `completion already wrote ${path}`),
|
|
550
|
+
],
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
return {
|
|
554
|
+
ok: true,
|
|
555
|
+
outputs,
|
|
556
|
+
diagnostics: [
|
|
557
|
+
'checked retained current bundle; no phases executed or build history published',
|
|
558
|
+
],
|
|
559
|
+
};
|
|
560
|
+
},
|
|
561
|
+
});
|
|
562
|
+
}
|
|
340
563
|
/**
|
|
341
564
|
* After a reserved-pipeline full run produces a `gears` intermediate and an `fsm`
|
|
342
565
|
* object at their canonical `<basename>.playbook/` locations, emits the
|
|
@@ -351,7 +574,7 @@ function runCwd(deps) {
|
|
|
351
574
|
* to a diagnostic when the artifact cannot be loaded, leaving the run outcome
|
|
352
575
|
* unchanged — the conformance test still fails at test time on a broken module.
|
|
353
576
|
*/
|
|
354
|
-
async function emitVerification(result, ctx, guardTarget) {
|
|
577
|
+
async function emitVerification(result, ctx, guardTarget, write) {
|
|
355
578
|
if (!result.ok)
|
|
356
579
|
return result;
|
|
357
580
|
const hostTargets = verificationHostTargets(ctx);
|
|
@@ -383,7 +606,7 @@ async function emitVerification(result, ctx, guardTarget) {
|
|
|
383
606
|
await guardTarget(target.target);
|
|
384
607
|
}
|
|
385
608
|
}
|
|
386
|
-
outputs.push(...(await emitVerifierSupport(ctx.artDir)));
|
|
609
|
+
outputs.push(...(await emitVerifierSupport(ctx.artDir, write)));
|
|
387
610
|
if (guardTarget !== undefined) {
|
|
388
611
|
await guardTarget(join(ctx.artDir, `${ctx.basename}.gears-fsm.test.ts`));
|
|
389
612
|
}
|
|
@@ -393,6 +616,7 @@ async function emitVerification(result, ctx, guardTarget) {
|
|
|
393
616
|
verifyModule: VERIFIER_SUPPORT_MODULE,
|
|
394
617
|
...(artifactSchema === undefined ? {} : { artifactSchema }),
|
|
395
618
|
schemaFindings: schemaResolution.findings,
|
|
619
|
+
write,
|
|
396
620
|
}));
|
|
397
621
|
try {
|
|
398
622
|
if (guardTarget !== undefined) {
|
|
@@ -402,6 +626,7 @@ async function emitVerification(result, ctx, guardTarget) {
|
|
|
402
626
|
artifactDir: ctx.artDir,
|
|
403
627
|
basename: ctx.basename,
|
|
404
628
|
verifyModule: VERIFIER_SUPPORT_MODULE,
|
|
629
|
+
write,
|
|
405
630
|
}));
|
|
406
631
|
}
|
|
407
632
|
catch (error) {
|
|
@@ -417,6 +642,7 @@ async function emitVerification(result, ctx, guardTarget) {
|
|
|
417
642
|
verifyModule: VERIFIER_SUPPORT_MODULE,
|
|
418
643
|
...(artifactSchema === undefined ? {} : { artifactSchema }),
|
|
419
644
|
...evidence,
|
|
645
|
+
write,
|
|
420
646
|
});
|
|
421
647
|
outputs.push(promptContract.path);
|
|
422
648
|
diagnostics.push(...promptContract.diagnostics.map((diagnostic) => `verification: ${diagnostic}`));
|
|
@@ -432,6 +658,7 @@ async function emitVerification(result, ctx, guardTarget) {
|
|
|
432
658
|
artifactDir: ctx.artDir,
|
|
433
659
|
basename: ctx.basename,
|
|
434
660
|
verifyModule: VERIFIER_SUPPORT_MODULE,
|
|
661
|
+
write,
|
|
435
662
|
});
|
|
436
663
|
outputs.push(coverage.path);
|
|
437
664
|
diagnostics.push(...coverage.diagnostics.map((diagnostic) => `verification: ${diagnostic}`));
|
|
@@ -533,6 +760,14 @@ function buildCompileSteps(opts) {
|
|
|
533
760
|
const gearsContract = entry.source.format === 'gears'
|
|
534
761
|
? () => gearsContractFindings(normalized)
|
|
535
762
|
: undefined;
|
|
763
|
+
// The raw input is the first text that may declare the entry phase's
|
|
764
|
+
// roles, so a malformed one stops the run before normalization (DR-056).
|
|
765
|
+
const rawSource = previous;
|
|
766
|
+
const sourceRoles = opts.sourceFidelity &&
|
|
767
|
+
entry.source.format === 'text' &&
|
|
768
|
+
entry.target.format === 'gears'
|
|
769
|
+
? () => sourceRoleFindings(rawSource)
|
|
770
|
+
: undefined;
|
|
536
771
|
steps.push({
|
|
537
772
|
request: {
|
|
538
773
|
kind: 'compile',
|
|
@@ -549,6 +784,7 @@ function buildCompileSteps(opts) {
|
|
|
549
784
|
...(gearsContract === undefined
|
|
550
785
|
? {}
|
|
551
786
|
: { compileFidelity: gearsContract }),
|
|
787
|
+
...(sourceRoles === undefined ? {} : { sourceRoles }),
|
|
552
788
|
});
|
|
553
789
|
previous = normalized;
|
|
554
790
|
}
|
|
@@ -619,6 +855,7 @@ function compileStep(pipeline, phase, source, target, sourceFidelity, linkTarget
|
|
|
619
855
|
...(phase.source.format === 'gears'
|
|
620
856
|
? { gearsSourceContract: () => gearsContractFindings(source) }
|
|
621
857
|
: {}),
|
|
858
|
+
...(gated ? { sourceRoles: () => sourceRoleFindings(source) } : {}),
|
|
622
859
|
...(phase.source.format === 'fsm' && phase.source.ext === '.ts'
|
|
623
860
|
? { fsmSourceTypecheck: () => checkFsmTypeScript(source, signal) }
|
|
624
861
|
: {}),
|
|
@@ -644,6 +881,21 @@ async function gearsContractFindings(path) {
|
|
|
644
881
|
return [`GEARS contract could not be checked: ${messageOf(error)}`];
|
|
645
882
|
}
|
|
646
883
|
}
|
|
884
|
+
/**
|
|
885
|
+
* The DR-056 boundary over the Source a text-to-GEARS phase, or the
|
|
886
|
+
* normalization ahead of it, reads (phase-execution-69, verification-54). An
|
|
887
|
+
* unreadable Source is left to the step that reads it.
|
|
888
|
+
*/
|
|
889
|
+
async function sourceRoleFindings(source) {
|
|
890
|
+
let sourceText;
|
|
891
|
+
try {
|
|
892
|
+
sourceText = await readFile(source, 'utf8');
|
|
893
|
+
}
|
|
894
|
+
catch {
|
|
895
|
+
return [];
|
|
896
|
+
}
|
|
897
|
+
return checkSourceRoles(sourceText);
|
|
898
|
+
}
|
|
647
899
|
/**
|
|
648
900
|
* The DR-029 gate over one text-to-GEARS phase's live target: the deterministic
|
|
649
901
|
* conservation findings against the Source that phase reads (phase-execution-51,
|
|
@@ -1003,6 +1255,20 @@ async function executeSteps(steps, pipeline, deps, opts = {}) {
|
|
|
1003
1255
|
if (outputContract !== undefined)
|
|
1004
1256
|
request = { ...request, outputContract };
|
|
1005
1257
|
}
|
|
1258
|
+
// A malformed Source role is the author's to fix: refuse it before any
|
|
1259
|
+
// execution strategy or agent runs (DR-056, phase-execution-69).
|
|
1260
|
+
if (step.sourceRoles !== undefined && step.request.kind === 'compile') {
|
|
1261
|
+
const findings = await step.sourceRoles();
|
|
1262
|
+
if (findings.length > 0) {
|
|
1263
|
+
fail();
|
|
1264
|
+
diagnostics.push(formatFailureReport({
|
|
1265
|
+
phase: step.phase,
|
|
1266
|
+
target,
|
|
1267
|
+
reasons: [`invalid Source: ${step.request.source}`, ...findings],
|
|
1268
|
+
}));
|
|
1269
|
+
return stopped(index);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1006
1272
|
// The consumer cannot repair its protected source. Reject these existing
|
|
1007
1273
|
// parser findings before selecting or constructing any execution strategy.
|
|
1008
1274
|
if (step.gearsSourceContract !== undefined) {
|