@sublang/slc 0.16.0 → 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 +4 -3
- package/dist/emitted-imports.d.ts +17 -4
- package/dist/emitted-imports.d.ts.map +1 -1
- package/dist/emitted-imports.js +55 -13
- package/dist/emitted-imports.js.map +1 -1
- package/dist/entry-module.d.ts +1 -1
- package/dist/entry-module.d.ts.map +1 -1
- package/dist/entry-module.js +42 -18
- package/dist/entry-module.js.map +1 -1
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +49 -4
- package/dist/runner.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.d.ts.map +1 -1
- package/dist/verify.js +9 -3
- package/dist/verify.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -176,9 +176,10 @@ It requires no agent credentials, seeds no config, leaves the authored files
|
|
|
176
176
|
and build history unchanged, and never falls back to compilation.
|
|
177
177
|
Omit `--link` when the retained bundle targets the installed Playbook runtime.
|
|
178
178
|
Raw input, `-o`, compile flags, and missing or inconsistent artifacts are refused.
|
|
179
|
-
The linked module must import the checked `.fsm.ts` object: a `.fsm.js`
|
|
180
|
-
edge is refused even when that sibling exists
|
|
181
|
-
import
|
|
179
|
+
The linked module must value-import the checked `.fsm.ts` object: a `.fsm.js`
|
|
180
|
+
object edge is refused even when that sibling exists, and a type-only import or
|
|
181
|
+
an import of another machine file does not count. Review and correct the
|
|
182
|
+
retained import before completing; an unused JavaScript sibling is allowed.
|
|
182
183
|
These are mechanical checks of the selected current bundle; they do not prove
|
|
183
184
|
its earlier compilation or semantic review, or detect every coherently stale
|
|
184
185
|
selection. Review manual Source/artifact amendments before using them.
|
|
@@ -17,10 +17,23 @@ export declare function reconcileLinkObjectImportSpecifiers(modulePath: string,
|
|
|
17
17
|
* to an existing file from the module's own directory, in source order.
|
|
18
18
|
*/
|
|
19
19
|
export declare function unresolvableRelativeImports(modulePath: string): Promise<string[]>;
|
|
20
|
+
/** A linked module's edges to its selected link object, by runtime form. */
|
|
21
|
+
export interface LinkObjectEdges {
|
|
22
|
+
/** Relative `.js` specifiers naming the object's stem, in any import form. */
|
|
23
|
+
javascript: string[];
|
|
24
|
+
/** Relative `.ts` specifiers of the object that bind a runtime value. */
|
|
25
|
+
typescript: string[];
|
|
26
|
+
}
|
|
20
27
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
28
|
+
* Classifies a linked module's edges to the selected link object for
|
|
29
|
+
* completion (completion-3). Every JavaScript edge is found by the same textual
|
|
30
|
+
* scan as settlement, so completion refuses it in any spelling: its TypeScript
|
|
31
|
+
* probes cannot establish fidelity of separate runtime bytes. A TypeScript edge
|
|
32
|
+
* counts only when parsed code binds a runtime value from the object: a static
|
|
33
|
+
* import with a default, namespace, or non-type named binding, or a literal
|
|
34
|
+
* dynamic import. Type-only, side-effect-only, re-export, and commented forms
|
|
35
|
+
* do not. Ordinary link settlement deliberately retains its existing JS
|
|
36
|
+
* preference.
|
|
24
37
|
*/
|
|
25
|
-
export declare function
|
|
38
|
+
export declare function linkObjectEdges(modulePath: string, objectPath: string): Promise<LinkObjectEdges>;
|
|
26
39
|
//# sourceMappingURL=emitted-imports.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitted-imports.d.ts","sourceRoot":"","sources":["../src/emitted-imports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"emitted-imports.d.ts","sourceRoot":"","sources":["../src/emitted-imports.ts"],"names":[],"mappings":"AA0BA,2EAA2E;AAC3E,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAKD;;;;;;;GAOG;AACH,wBAAsB,mCAAmC,CACvD,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,SAAS,MAAM,EAAE,GAC7B,OAAO,CAAC,sBAAsB,EAAE,CAAC,CA8CnC;AAED;;;GAGG;AACH,wBAAsB,2BAA2B,CAC/C,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,EAAE,CAAC,CAWnB;AAED,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,yEAAyE;IACzE,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,CAAC,CAgD1B"}
|
package/dist/emitted-imports.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
|
|
3
3
|
/**
|
|
4
4
|
* Deterministic link-object import settlement and load-integrity checks for
|
|
5
|
-
* emitted modules (pipeline-40, verification-18)
|
|
5
|
+
* emitted modules (pipeline-40, verification-18), and the link-object edge
|
|
6
|
+
* classification retained-bundle completion requires (completion-3).
|
|
6
7
|
*
|
|
7
8
|
* A linked artifact is code whose relative imports Node resolves with exact
|
|
8
9
|
* specifiers — `./workflow.fsm.js` does not find `workflow.fsm.ts`. An
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
import { existsSync, statSync } from 'node:fs';
|
|
16
17
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
17
18
|
import { dirname, resolve } from 'node:path';
|
|
19
|
+
import ts from 'typescript';
|
|
18
20
|
const IMPORT_SPECIFIER = /\bfrom\s+(['"])([^'"\n]+)\1|\bimport\s*\(\s*(['"])([^'"\n]+)\3\s*\)|\bimport\s+(['"])([^'"\n]+)\5/g;
|
|
19
21
|
const isRegularFile = (path) => statSync(path, { throwIfNoEntry: false })?.isFile() ?? false;
|
|
20
22
|
/**
|
|
@@ -90,24 +92,64 @@ export async function unresolvableRelativeImports(modulePath) {
|
|
|
90
92
|
return missing;
|
|
91
93
|
}
|
|
92
94
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
95
|
+
* Classifies a linked module's edges to the selected link object for
|
|
96
|
+
* completion (completion-3). Every JavaScript edge is found by the same textual
|
|
97
|
+
* scan as settlement, so completion refuses it in any spelling: its TypeScript
|
|
98
|
+
* probes cannot establish fidelity of separate runtime bytes. A TypeScript edge
|
|
99
|
+
* counts only when parsed code binds a runtime value from the object: a static
|
|
100
|
+
* import with a default, namespace, or non-type named binding, or a literal
|
|
101
|
+
* dynamic import. Type-only, side-effect-only, re-export, and commented forms
|
|
102
|
+
* do not. Ordinary link settlement deliberately retains its existing JS
|
|
103
|
+
* preference.
|
|
96
104
|
*/
|
|
97
|
-
export async function
|
|
105
|
+
export async function linkObjectEdges(modulePath, objectPath) {
|
|
98
106
|
const source = await readFile(modulePath, 'utf8');
|
|
99
107
|
const dir = dirname(modulePath);
|
|
100
108
|
const objectStem = resolve(objectPath).slice(0, -3);
|
|
101
|
-
const
|
|
109
|
+
const namesObject = (specifier, ext) => (specifier.startsWith('./') || specifier.startsWith('../')) &&
|
|
110
|
+
specifier.endsWith(ext) &&
|
|
111
|
+
resolve(dir, specifier.slice(0, -ext.length)) === objectStem;
|
|
112
|
+
const javascript = [];
|
|
102
113
|
for (const match of source.matchAll(IMPORT_SPECIFIER)) {
|
|
103
114
|
const specifier = match[2] ?? match[4] ?? match[6];
|
|
104
|
-
if (specifier
|
|
105
|
-
|
|
106
|
-
if (!specifier.startsWith('./') && !specifier.startsWith('../'))
|
|
107
|
-
continue;
|
|
108
|
-
if (resolve(dir, specifier.slice(0, -3)) === objectStem)
|
|
109
|
-
edges.push(specifier);
|
|
115
|
+
if (specifier !== undefined && namesObject(specifier, '.js'))
|
|
116
|
+
javascript.push(specifier);
|
|
110
117
|
}
|
|
111
|
-
|
|
118
|
+
const typescript = [];
|
|
119
|
+
const file = ts.createSourceFile(modulePath, source, ts.ScriptTarget.Latest, false, ts.ScriptKind.TS);
|
|
120
|
+
const visit = (node) => {
|
|
121
|
+
if (ts.isImportDeclaration(node) &&
|
|
122
|
+
ts.isStringLiteral(node.moduleSpecifier) &&
|
|
123
|
+
bindsValue(node.importClause) &&
|
|
124
|
+
namesObject(node.moduleSpecifier.text, '.ts')) {
|
|
125
|
+
typescript.push(node.moduleSpecifier.text);
|
|
126
|
+
}
|
|
127
|
+
else if (ts.isCallExpression(node) &&
|
|
128
|
+
node.expression.kind === ts.SyntaxKind.ImportKeyword) {
|
|
129
|
+
const [argument] = node.arguments;
|
|
130
|
+
if (argument !== undefined &&
|
|
131
|
+
ts.isStringLiteralLike(argument) &&
|
|
132
|
+
namesObject(argument.text, '.ts'))
|
|
133
|
+
typescript.push(argument.text);
|
|
134
|
+
}
|
|
135
|
+
ts.forEachChild(node, visit);
|
|
136
|
+
};
|
|
137
|
+
visit(file);
|
|
138
|
+
return { javascript, typescript };
|
|
139
|
+
}
|
|
140
|
+
/** True when an import clause binds at least one runtime value. */
|
|
141
|
+
function bindsValue(clause) {
|
|
142
|
+
if (clause === undefined)
|
|
143
|
+
return false;
|
|
144
|
+
if (clause.phaseModifier === ts.SyntaxKind.TypeKeyword)
|
|
145
|
+
return false;
|
|
146
|
+
if (clause.name !== undefined)
|
|
147
|
+
return true;
|
|
148
|
+
const bindings = clause.namedBindings;
|
|
149
|
+
if (bindings === undefined)
|
|
150
|
+
return false;
|
|
151
|
+
if (ts.isNamespaceImport(bindings))
|
|
152
|
+
return true;
|
|
153
|
+
return bindings.elements.some((element) => !element.isTypeOnly);
|
|
112
154
|
}
|
|
113
155
|
//# sourceMappingURL=emitted-imports.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitted-imports.js","sourceRoot":"","sources":["../src/emitted-imports.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,0EAA0E;AAE1E
|
|
1
|
+
{"version":3,"file":"emit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K,CAAC;IACrE,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAC3C,MAAM,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAC;IACtC,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACzC,IAAI,EAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC;IAChD,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAClE,CAAC"}
|
package/dist/entry-module.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface EmitEntryModuleOptions {
|
|
|
9
9
|
pipeline: string;
|
|
10
10
|
/** The optimized gears artifact: players and script items. */
|
|
11
11
|
gearsPath: string;
|
|
12
|
-
/** The normalized (or entry-form) text source: title and lead
|
|
12
|
+
/** The normalized (or entry-form) text source: title and lead paragraph. */
|
|
13
13
|
textPath: string;
|
|
14
14
|
/** Explicit canonical directory, including invocation from inside a bundle. */
|
|
15
15
|
artifactDir?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-module.d.ts","sourceRoot":"","sources":["../src/entry-module.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACrC,wEAAwE;IACxE,GAAG,EAAE,MAAM,CAAC;IACZ,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;IACjB,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAC;IAClB,
|
|
1
|
+
{"version":3,"file":"entry-module.d.ts","sourceRoot":"","sources":["../src/entry-module.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACrC,wEAAwE;IACxE,GAAG,EAAE,MAAM,CAAC;IACZ,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;IACjB,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uEAAuE;IACvE,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAED,mDAAmD;AACnD,wBAAsB,eAAe,CACnC,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAoDjB"}
|
package/dist/entry-module.js
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
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';
|
|
@@ -69,12 +69,35 @@ export async function emitEntryModule(opts) {
|
|
|
69
69
|
}));
|
|
70
70
|
return path;
|
|
71
71
|
}
|
|
72
|
-
/**
|
|
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
|
+
*/
|
|
73
88
|
function deriveIntent(text) {
|
|
74
89
|
let title;
|
|
75
|
-
|
|
90
|
+
const lead = [];
|
|
76
91
|
for (const line of text.split('\n')) {
|
|
77
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
|
+
}
|
|
78
101
|
if (trimmed === '' || trimmed.startsWith('<!--'))
|
|
79
102
|
continue;
|
|
80
103
|
if (title === undefined) {
|
|
@@ -84,17 +107,18 @@ function deriveIntent(text) {
|
|
|
84
107
|
continue;
|
|
85
108
|
}
|
|
86
109
|
}
|
|
87
|
-
if (
|
|
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) ||
|
|
89
113
|
/^(?:Roles|Players):\s*$/.test(trimmed)) {
|
|
90
114
|
continue;
|
|
91
115
|
}
|
|
92
|
-
lead
|
|
93
|
-
break;
|
|
116
|
+
lead.push(trimmed);
|
|
94
117
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
118
|
+
const paragraph = lead.length > 0 ? lead.join(' ') : undefined;
|
|
119
|
+
if (title !== undefined && paragraph !== undefined)
|
|
120
|
+
return `${title} — ${paragraph}`;
|
|
121
|
+
return title ?? paragraph;
|
|
98
122
|
}
|
|
99
123
|
function renderEntryModule(spec) {
|
|
100
124
|
const allowed = spec.hasScript ? `['cwd']` : `[]`;
|
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,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;A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B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CACT,SAAS,EAAE,iBAAiB,KACzB,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5C,uGAAuG;IACvG,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAED,mCAAmC;AACnC,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,OAAO,CAAC;IACZ,wCAAwC;IACxC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,sEAAsE;IACtE,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,uEAAuE;IACvE,OAAO,CAAC,EAAE,YAAY,GAAG,wBAAwB,CAAC;IAClD,aAAa,CAAC,EAAE,mBAAmB,CAAC;CACrC;AAED;;;;GAIG;AACH,wBAAsB,MAAM,CAC1B,IAAI,EAAE,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
|
@@ -16,7 +16,7 @@ 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 {
|
|
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,7 +33,7 @@ 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
38
|
import { checkEntryOptions, ENTRY_OPTIONS_CONTRACT, linkedOptionsValidator, } from './entry-options.js';
|
|
39
39
|
/**
|
|
@@ -441,8 +441,14 @@ async function runCompletion(invocation, deps) {
|
|
|
441
441
|
let prepared;
|
|
442
442
|
try {
|
|
443
443
|
deps.signal?.throwIfAborted();
|
|
444
|
-
|
|
445
|
-
|
|
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
|
+
];
|
|
446
452
|
if (findings.length === 0)
|
|
447
453
|
findings = [
|
|
448
454
|
...(await sourceFidelityFindings(source, gears.path)),
|
|
@@ -754,6 +760,14 @@ function buildCompileSteps(opts) {
|
|
|
754
760
|
const gearsContract = entry.source.format === 'gears'
|
|
755
761
|
? () => gearsContractFindings(normalized)
|
|
756
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;
|
|
757
771
|
steps.push({
|
|
758
772
|
request: {
|
|
759
773
|
kind: 'compile',
|
|
@@ -770,6 +784,7 @@ function buildCompileSteps(opts) {
|
|
|
770
784
|
...(gearsContract === undefined
|
|
771
785
|
? {}
|
|
772
786
|
: { compileFidelity: gearsContract }),
|
|
787
|
+
...(sourceRoles === undefined ? {} : { sourceRoles }),
|
|
773
788
|
});
|
|
774
789
|
previous = normalized;
|
|
775
790
|
}
|
|
@@ -840,6 +855,7 @@ function compileStep(pipeline, phase, source, target, sourceFidelity, linkTarget
|
|
|
840
855
|
...(phase.source.format === 'gears'
|
|
841
856
|
? { gearsSourceContract: () => gearsContractFindings(source) }
|
|
842
857
|
: {}),
|
|
858
|
+
...(gated ? { sourceRoles: () => sourceRoleFindings(source) } : {}),
|
|
843
859
|
...(phase.source.format === 'fsm' && phase.source.ext === '.ts'
|
|
844
860
|
? { fsmSourceTypecheck: () => checkFsmTypeScript(source, signal) }
|
|
845
861
|
: {}),
|
|
@@ -865,6 +881,21 @@ async function gearsContractFindings(path) {
|
|
|
865
881
|
return [`GEARS contract could not be checked: ${messageOf(error)}`];
|
|
866
882
|
}
|
|
867
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
|
+
}
|
|
868
899
|
/**
|
|
869
900
|
* The DR-029 gate over one text-to-GEARS phase's live target: the deterministic
|
|
870
901
|
* conservation findings against the Source that phase reads (phase-execution-51,
|
|
@@ -1224,6 +1255,20 @@ async function executeSteps(steps, pipeline, deps, opts = {}) {
|
|
|
1224
1255
|
if (outputContract !== undefined)
|
|
1225
1256
|
request = { ...request, outputContract };
|
|
1226
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
|
+
}
|
|
1227
1272
|
// The consumer cannot repair its protected source. Reject these existing
|
|
1228
1273
|
// parser findings before selecting or constructing any execution strategy.
|
|
1229
1274
|
if (step.gearsSourceContract !== undefined) {
|