@shapeshift-labs/frontier-lang-parser 0.3.69 → 0.3.70
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.
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
export function parseGateAdmissionEvidenceBlock(block) {
|
|
2
|
+
const name = nameFrom(block.header);
|
|
3
|
+
const surface = {
|
|
4
|
+
kind: 'frontier.lang.authoredGateAdmissionEvidenceInput',
|
|
5
|
+
version: 1,
|
|
6
|
+
schema: 'frontier.lang.authoredGateAdmissionEvidenceInput.v1',
|
|
7
|
+
id: idFrom(block.header, `gate_admission_${safeId(name)}`),
|
|
8
|
+
name,
|
|
9
|
+
gates: [],
|
|
10
|
+
evidence: [],
|
|
11
|
+
admissions: [],
|
|
12
|
+
proofGaps: [],
|
|
13
|
+
parser: { status: 'authored', errors: [] },
|
|
14
|
+
claims: falseClaims(),
|
|
15
|
+
metadata: { authoredName: name, authoredBlockKind: block.kind }
|
|
16
|
+
};
|
|
17
|
+
for (const authoredLine of readAuthoredLines(block)) {
|
|
18
|
+
const line = authoredLine.text;
|
|
19
|
+
if (!line || line.startsWith('#')) continue;
|
|
20
|
+
const match = /^(gate|evidence|proofEvidence|admission|admissionDecision|gap|proofGap)\s+([A-Za-z_$@/.:*-][\w$./@:*+-]*)(.*)$/.exec(line);
|
|
21
|
+
if (!match) continue;
|
|
22
|
+
const [, rowKind, rowName, text] = match;
|
|
23
|
+
if (rowKind === 'gate') surface.gates.push(gateRecord(rowName, text, authoredLine));
|
|
24
|
+
else if (rowKind === 'evidence' || rowKind === 'proofEvidence') surface.evidence.push(evidenceRecord(rowName, text, authoredLine, rowKind));
|
|
25
|
+
else if (rowKind === 'admission' || rowKind === 'admissionDecision') surface.admissions.push(admissionRecord(rowName, text, authoredLine));
|
|
26
|
+
else surface.proofGaps.push(proofGapRecord(rowName, text, authoredLine));
|
|
27
|
+
}
|
|
28
|
+
surface.gateIds = ids(surface.gates);
|
|
29
|
+
surface.evidenceIds = ids(surface.evidence);
|
|
30
|
+
surface.proofEvidenceIds = surface.evidence.filter((record) => record.proof).map((record) => record.id).filter(Boolean);
|
|
31
|
+
surface.admissionIds = ids(surface.admissions);
|
|
32
|
+
surface.proofGapCodes = uniqueStrings(surface.proofGaps.map((record) => record.code));
|
|
33
|
+
surface.missingEvidence = uniqueStrings([
|
|
34
|
+
...surface.gates.flatMap((record) => record.missingEvidence ?? []),
|
|
35
|
+
...surface.admissions.flatMap((record) => record.missingEvidence ?? []),
|
|
36
|
+
...surface.proofGaps.map((record) => record.code)
|
|
37
|
+
]);
|
|
38
|
+
surface.summary = {
|
|
39
|
+
gateCount: surface.gates.length,
|
|
40
|
+
evidenceCount: surface.evidence.length,
|
|
41
|
+
proofEvidenceCount: surface.proofEvidenceIds.length,
|
|
42
|
+
admissionCount: surface.admissions.length,
|
|
43
|
+
proofGapCount: surface.proofGaps.length,
|
|
44
|
+
missingEvidenceCount: surface.missingEvidence.length,
|
|
45
|
+
passedGateCount: surface.gates.filter((record) => record.status === 'passed').length,
|
|
46
|
+
failedGateCount: surface.gates.filter((record) => record.status === 'failed').length,
|
|
47
|
+
blockedAdmissionCount: surface.admissions.filter((record) => /blocked|missing|failed|review/.test(record.status ?? '')).length
|
|
48
|
+
};
|
|
49
|
+
return surface;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function mergeGateAdmissionEvidenceBlocks(blocks) {
|
|
53
|
+
const gates = uniqueRecords(blocks.flatMap((block) => block.gates ?? []));
|
|
54
|
+
const evidence = uniqueRecords(blocks.flatMap((block) => block.evidence ?? []));
|
|
55
|
+
const admissions = uniqueRecords(blocks.flatMap((block) => block.admissions ?? []));
|
|
56
|
+
const proofGaps = uniqueRecords(blocks.flatMap((block) => block.proofGaps ?? []));
|
|
57
|
+
const proofEvidenceIds = evidence.filter((record) => record.proof).map((record) => record.id).filter(Boolean);
|
|
58
|
+
const missingEvidence = uniqueStrings([
|
|
59
|
+
...gates.flatMap((record) => record.missingEvidence ?? []),
|
|
60
|
+
...admissions.flatMap((record) => record.missingEvidence ?? []),
|
|
61
|
+
...proofGaps.map((record) => record.code)
|
|
62
|
+
]);
|
|
63
|
+
return {
|
|
64
|
+
kind: 'frontier.lang.authoredGateAdmissionEvidenceInput',
|
|
65
|
+
version: 1,
|
|
66
|
+
schema: 'frontier.lang.authoredGateAdmissionEvidenceInput.v1',
|
|
67
|
+
id: blocks.length === 1 ? blocks[0].id : 'gateAdmissionEvidence:source',
|
|
68
|
+
blocks,
|
|
69
|
+
blockIds: ids(blocks),
|
|
70
|
+
gates,
|
|
71
|
+
evidence,
|
|
72
|
+
admissions,
|
|
73
|
+
proofGaps,
|
|
74
|
+
gateIds: ids(gates),
|
|
75
|
+
evidenceIds: ids(evidence),
|
|
76
|
+
proofEvidenceIds,
|
|
77
|
+
admissionIds: ids(admissions),
|
|
78
|
+
proofGapCodes: uniqueStrings(proofGaps.map((record) => record.code)),
|
|
79
|
+
missingEvidence,
|
|
80
|
+
summary: {
|
|
81
|
+
blockCount: blocks.length,
|
|
82
|
+
gateCount: gates.length,
|
|
83
|
+
evidenceCount: evidence.length,
|
|
84
|
+
proofEvidenceCount: proofEvidenceIds.length,
|
|
85
|
+
admissionCount: admissions.length,
|
|
86
|
+
proofGapCount: proofGaps.length,
|
|
87
|
+
missingEvidenceCount: missingEvidence.length,
|
|
88
|
+
passedGateCount: gates.filter((record) => record.status === 'passed').length,
|
|
89
|
+
failedGateCount: gates.filter((record) => record.status === 'failed').length,
|
|
90
|
+
blockedAdmissionCount: admissions.filter((record) => /blocked|missing|failed|review/.test(record.status ?? '')).length
|
|
91
|
+
},
|
|
92
|
+
claims: falseClaims(),
|
|
93
|
+
metadata: { authoredGateAdmissionBlockIds: ids(blocks) }
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function gateRecord(name, text, authoredLine) {
|
|
98
|
+
const evidenceIds = readInlineList(text, 'evidence', 'evidenceIds');
|
|
99
|
+
return cleanRecord({
|
|
100
|
+
kind: 'frontier.lang.gateAdmissionEvidence.gate',
|
|
101
|
+
version: 1,
|
|
102
|
+
id: idFrom(text, `gate_${safeId(name)}`),
|
|
103
|
+
name,
|
|
104
|
+
gateKind: readInlineWord('kind', text) ?? readInlineWord('gateKind', text) ?? 'gate',
|
|
105
|
+
status: readInlineWord('status', text) ?? 'unknown',
|
|
106
|
+
required: readInlineFlag('required', text),
|
|
107
|
+
command: readInlineQuoted('command', text) ?? readInlineWord('command', text),
|
|
108
|
+
routeId: readInlineWord('route', text) ?? readInlineWord('routeId', text),
|
|
109
|
+
routeIds: readInlineList(text, 'routeIds'),
|
|
110
|
+
language: readInlineWord('language', text) ?? readInlineWord('sourceLanguage', text),
|
|
111
|
+
sourceLanguage: readInlineWord('sourceLanguage', text) ?? readInlineWord('language', text),
|
|
112
|
+
target: readInlineWord('target', text) ?? readInlineWord('targetLanguage', text),
|
|
113
|
+
sourcePath: readInlineWord('sourcePath', text) ?? readInlineWord('path', text),
|
|
114
|
+
sourceHash: readInlineWord('sourceHash', text),
|
|
115
|
+
outputHash: readInlineWord('outputHash', text),
|
|
116
|
+
telemetryHash: readInlineWord('telemetryHash', text),
|
|
117
|
+
subjectIds: readInlineList(text, 'subject', 'subjects', 'subjectId', 'subjectIds'),
|
|
118
|
+
semanticChangeIds: readInlineList(text, 'semanticChange', 'semanticChangeId', 'semanticChangeIds'),
|
|
119
|
+
semanticEditScriptIds: readInlineList(text, 'semanticEditScript', 'semanticEditScriptId', 'semanticEditScriptIds', 'script', 'scriptIds'),
|
|
120
|
+
semanticEditReplayIds: readInlineList(text, 'semanticEditReplay', 'semanticEditReplayId', 'semanticEditReplayIds', 'replay', 'replayIds'),
|
|
121
|
+
evidenceIds,
|
|
122
|
+
proofEvidenceIds: readInlineList(text, 'proofEvidence', 'proofEvidenceIds'),
|
|
123
|
+
missingEvidence: readInlineList(text, 'missingEvidence'),
|
|
124
|
+
reasonCodes: readInlineList(text, 'reasonCode', 'reasonCodes'),
|
|
125
|
+
failClosed: true,
|
|
126
|
+
claims: falseClaims(),
|
|
127
|
+
sourceSpan: authoredLine.sourceSpan,
|
|
128
|
+
authoredSourceSpan: authoredLine.sourceSpan,
|
|
129
|
+
metadata: cleanRecord({ authoredName: name, summary: readInlineQuoted('summary', text), ...falseClaims() })
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function evidenceRecord(name, text, authoredLine, rowKind) {
|
|
134
|
+
return cleanRecord({
|
|
135
|
+
kind: 'frontier.lang.gateAdmissionEvidence.evidence',
|
|
136
|
+
version: 1,
|
|
137
|
+
id: idFrom(text, `evidence_${safeId(name)}`),
|
|
138
|
+
name,
|
|
139
|
+
evidenceKind: readInlineWord('kind', text) ?? 'evidence',
|
|
140
|
+
status: readInlineWord('status', text) ?? 'unknown',
|
|
141
|
+
proof: rowKind === 'proofEvidence' || readInlineFlag('proof', text),
|
|
142
|
+
path: readInlineWord('path', text),
|
|
143
|
+
hash: readInlineWord('hash', text),
|
|
144
|
+
command: readInlineQuoted('command', text) ?? readInlineWord('command', text),
|
|
145
|
+
probeId: readInlineWord('probeId', text) ?? readInlineWord('probe', text),
|
|
146
|
+
routeId: readInlineWord('route', text) ?? readInlineWord('routeId', text),
|
|
147
|
+
routeIds: readInlineList(text, 'routeIds'),
|
|
148
|
+
language: readInlineWord('language', text) ?? readInlineWord('sourceLanguage', text),
|
|
149
|
+
sourceLanguage: readInlineWord('sourceLanguage', text) ?? readInlineWord('language', text),
|
|
150
|
+
target: readInlineWord('target', text) ?? readInlineWord('targetLanguage', text),
|
|
151
|
+
sourcePath: readInlineWord('sourcePath', text) ?? readInlineWord('path', text),
|
|
152
|
+
sourceHash: readInlineWord('sourceHash', text),
|
|
153
|
+
outputHash: readInlineWord('outputHash', text),
|
|
154
|
+
telemetryHash: readInlineWord('telemetryHash', text),
|
|
155
|
+
gateIds: readInlineList(text, 'gate', 'gateId', 'gateIds'),
|
|
156
|
+
admissionIds: readInlineList(text, 'admission', 'admissionId', 'admissionIds'),
|
|
157
|
+
summary: readInlineQuoted('summary', text),
|
|
158
|
+
failClosed: true,
|
|
159
|
+
autoMergeClaim: false,
|
|
160
|
+
semanticEquivalenceClaim: false,
|
|
161
|
+
runtimeEquivalenceClaim: false,
|
|
162
|
+
sourceSpan: authoredLine.sourceSpan,
|
|
163
|
+
authoredSourceSpan: authoredLine.sourceSpan,
|
|
164
|
+
metadata: cleanRecord({ authoredName: name, authoredRowKind: rowKind, ...falseClaims() })
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function admissionRecord(name, text, authoredLine) {
|
|
169
|
+
const status = readInlineWord('status', text) ?? readInlineWord('admissionStatus', text) ?? 'review';
|
|
170
|
+
return cleanRecord({
|
|
171
|
+
kind: 'frontier.lang.gateAdmissionEvidence.admission',
|
|
172
|
+
version: 1,
|
|
173
|
+
id: idFrom(text, `admission_${safeId(name)}`),
|
|
174
|
+
name,
|
|
175
|
+
status,
|
|
176
|
+
action: readInlineWord('action', text) ?? readInlineWord('admissionAction', text) ?? 'review',
|
|
177
|
+
readiness: readInlineWord('readiness', text) ?? readInlineWord('admissionReadiness', text),
|
|
178
|
+
decision: readInlineWord('decision', text),
|
|
179
|
+
classification: readInlineWord('classification', text),
|
|
180
|
+
routeId: readInlineWord('route', text) ?? readInlineWord('routeId', text),
|
|
181
|
+
routeIds: readInlineList(text, 'routeIds'),
|
|
182
|
+
language: readInlineWord('language', text) ?? readInlineWord('sourceLanguage', text),
|
|
183
|
+
sourceLanguage: readInlineWord('sourceLanguage', text) ?? readInlineWord('language', text),
|
|
184
|
+
target: readInlineWord('target', text) ?? readInlineWord('targetLanguage', text),
|
|
185
|
+
sourcePath: readInlineWord('sourcePath', text) ?? readInlineWord('path', text),
|
|
186
|
+
baseHash: readInlineWord('baseHash', text),
|
|
187
|
+
targetHash: readInlineWord('targetHash', text),
|
|
188
|
+
gateIds: readInlineList(text, 'gate', 'gateId', 'gateIds'),
|
|
189
|
+
evidenceIds: readInlineList(text, 'evidence', 'evidenceIds'),
|
|
190
|
+
proofEvidenceIds: readInlineList(text, 'proofEvidence', 'proofEvidenceIds'),
|
|
191
|
+
missingEvidence: readInlineList(text, 'missingEvidence'),
|
|
192
|
+
conflictKeys: readInlineList(text, 'conflictKey', 'conflictKeys'),
|
|
193
|
+
reasonCodes: readInlineList(text, 'reasonCode', 'reasonCodes', 'reason', 'reasons'),
|
|
194
|
+
semanticEditScriptIds: readInlineList(text, 'semanticEditScript', 'semanticEditScriptId', 'semanticEditScriptIds', 'script', 'scriptIds'),
|
|
195
|
+
semanticEditReplayIds: readInlineList(text, 'semanticEditReplay', 'semanticEditReplayId', 'semanticEditReplayIds', 'replay', 'replayIds'),
|
|
196
|
+
reviewRequired: true,
|
|
197
|
+
failClosed: true,
|
|
198
|
+
autoMergeClaim: false,
|
|
199
|
+
semanticEquivalenceClaim: false,
|
|
200
|
+
runtimeEquivalenceClaim: false,
|
|
201
|
+
sourceSpan: authoredLine.sourceSpan,
|
|
202
|
+
authoredSourceSpan: authoredLine.sourceSpan,
|
|
203
|
+
metadata: cleanRecord({ authoredName: name, summary: readInlineQuoted('summary', text), ...falseClaims() })
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function proofGapRecord(name, text, authoredLine) {
|
|
208
|
+
const code = readInlineWord('code', text) ?? name;
|
|
209
|
+
return cleanRecord({
|
|
210
|
+
kind: 'frontier.lang.gateAdmissionEvidence.proofGap',
|
|
211
|
+
version: 1,
|
|
212
|
+
id: idFrom(text, `gate_admission_gap_${safeId(code)}`),
|
|
213
|
+
name,
|
|
214
|
+
code,
|
|
215
|
+
status: readInlineWord('status', text) ?? 'missing',
|
|
216
|
+
routeId: readInlineWord('route', text) ?? readInlineWord('routeId', text),
|
|
217
|
+
routeIds: readInlineList(text, 'routeIds'),
|
|
218
|
+
gateIds: readInlineList(text, 'gate', 'gateId', 'gateIds'),
|
|
219
|
+
admissionIds: readInlineList(text, 'admission', 'admissionId', 'admissionIds'),
|
|
220
|
+
evidenceIds: readInlineList(text, 'evidence', 'evidenceIds'),
|
|
221
|
+
summary: readInlineQuoted('summary', text) ?? readInlineQuoted('message', text),
|
|
222
|
+
failClosed: true,
|
|
223
|
+
...falseClaims(),
|
|
224
|
+
sourceSpan: authoredLine.sourceSpan,
|
|
225
|
+
authoredSourceSpan: authoredLine.sourceSpan,
|
|
226
|
+
metadata: cleanRecord({ authoredName: name, ...falseClaims() })
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function readAuthoredLines(block) {
|
|
231
|
+
const lines = block.body.split('\n');
|
|
232
|
+
const records = [];
|
|
233
|
+
let lineStart = block.syntax?.bodyStartOffset ?? 0;
|
|
234
|
+
for (const rawLine of lines) {
|
|
235
|
+
const rawEnd = lineStart + rawLine.length;
|
|
236
|
+
const leading = /^\s*/.exec(rawLine)?.[0].length ?? 0;
|
|
237
|
+
const trailing = /\s*$/.exec(rawLine)?.[0].length ?? 0;
|
|
238
|
+
const startOffset = lineStart + leading;
|
|
239
|
+
const endOffset = Math.max(startOffset, rawEnd - trailing);
|
|
240
|
+
records.push({
|
|
241
|
+
text: rawLine.trim(),
|
|
242
|
+
startOffset,
|
|
243
|
+
endOffset,
|
|
244
|
+
sourceSpan: typeof block.sourceSpan === 'function' ? block.sourceSpan(startOffset, endOffset) : undefined
|
|
245
|
+
});
|
|
246
|
+
lineStart = rawEnd + 1;
|
|
247
|
+
}
|
|
248
|
+
return records;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function falseClaims() {
|
|
252
|
+
return {
|
|
253
|
+
autoMergeClaim: false,
|
|
254
|
+
semanticEquivalenceClaim: false,
|
|
255
|
+
runtimeEquivalenceClaim: false,
|
|
256
|
+
gatePassImpliesAdmissionClaim: false
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function ids(records = []) { return records.map((record) => record?.id).filter(Boolean); }
|
|
261
|
+
function uniqueRecords(records) {
|
|
262
|
+
const seen = new Set();
|
|
263
|
+
return records.filter((record) => {
|
|
264
|
+
const key = record?.id ?? JSON.stringify(record);
|
|
265
|
+
if (seen.has(key)) return false;
|
|
266
|
+
seen.add(key);
|
|
267
|
+
return true;
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
function uniqueStrings(values = []) { return [...new Set(values.filter(Boolean).map(String))]; }
|
|
271
|
+
function idFrom(text, fallback) { return /@id\(\s*["']([^"']+)["']\s*\)/.exec(text)?.[1] ?? fallback; }
|
|
272
|
+
function nameFrom(header) { return /^([A-Za-z_$][\w$]*)/.exec(header)?.[1] ?? 'GateAdmissionEvidence'; }
|
|
273
|
+
function safeId(value) { return String(value ?? 'record').replace(/[^A-Za-z0-9_$-]+/g, '_'); }
|
|
274
|
+
function readInlineWord(label, text) { return new RegExp('(?:^|\\s)' + label + '\\s+([^\\s,]+)').exec(unquotedText(text))?.[1]?.trim(); }
|
|
275
|
+
function readInlineQuoted(label, text) { return new RegExp("(?:^|\\s)" + label + "\\s+[\"']([^\"']+)[\"']").exec(text)?.[1]?.trim(); }
|
|
276
|
+
function readInlineFlag(label, text) { return new RegExp('(?:^|\\s)' + label + '(?:\\s|$)').test(unquotedText(text)) || undefined; }
|
|
277
|
+
function readInlineList(text, ...labels) {
|
|
278
|
+
const source = unquotedText(text);
|
|
279
|
+
for (const label of labels) {
|
|
280
|
+
const value = new RegExp('(?:^|\\s)' + label + '\\s+([^\\s]+)').exec(source)?.[1]?.trim();
|
|
281
|
+
if (value) return value.split(/[|,]/).map((item) => item.trim()).filter(Boolean);
|
|
282
|
+
}
|
|
283
|
+
return undefined;
|
|
284
|
+
}
|
|
285
|
+
function unquotedText(text) { return text.replace(/"[^"]*"|'[^']*'/g, (match) => ' '.repeat(match.length)); }
|
|
286
|
+
function cleanRecord(record) {
|
|
287
|
+
return Object.fromEntries(Object.entries(record).filter(([, value]) => value !== undefined && (!Array.isArray(value) || value.length > 0) && !(value && typeof value === 'object' && !Array.isArray(value) && Object.keys(value).length === 0)));
|
|
288
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { parseApplicationSurfaceBlock } from './application-surface.js';
|
|
|
6
6
|
import { parseCanvasSurfaceBlock } from './canvas-surface.js';
|
|
7
7
|
import { parseDecisionGraphBlock } from './decision-graph.js';
|
|
8
8
|
import { parseDialectRegistryBlock } from './dialect-registry.js';
|
|
9
|
+
import { parseGateAdmissionEvidenceBlock } from './gate-admission-evidence.js';
|
|
9
10
|
import { parseInterlinguaBlock } from './interlingua.js';
|
|
10
11
|
import { createParsedMetadata } from './metadata.js';
|
|
11
12
|
import { parseEntityBlock, parseStateBlock, readTypeFields } from './member-records.js';
|
|
@@ -34,6 +35,7 @@ export function parseFrontierSource(source, options = {}) {
|
|
|
34
35
|
const conversionBlocks = [];
|
|
35
36
|
const constraintSpaceBlocks = [];
|
|
36
37
|
const decisionGraphBlocks = [];
|
|
38
|
+
const gateAdmissionEvidenceBlocks = [];
|
|
37
39
|
const dialectRegistryBlocks = [];
|
|
38
40
|
const interlinguaBlocks = [];
|
|
39
41
|
const resourceGraphBlocks = [];
|
|
@@ -68,6 +70,7 @@ export function parseFrontierSource(source, options = {}) {
|
|
|
68
70
|
if (block.kind === 'conversion' || block.kind === 'universalConversionPlan') conversionBlocks.push(parseConversionBlock(block));
|
|
69
71
|
if (block.kind === 'constraintSpace' || block.kind === 'possibilitySpace') constraintSpaceBlocks.push(parseConstraintSpaceBlock(block));
|
|
70
72
|
if (block.kind === 'decisionGraph' || block.kind === 'admissionGraph') decisionGraphBlocks.push(parseDecisionGraphBlock(block));
|
|
73
|
+
if (block.kind === 'gateEvidence' || block.kind === 'admissionEvidence' || block.kind === 'routeEvidence') gateAdmissionEvidenceBlocks.push(parseGateAdmissionEvidenceBlock(block));
|
|
71
74
|
if (block.kind === 'dialectRegistry' || block.kind === 'universalDialectRegistry') dialectRegistryBlocks.push(parseDialectRegistryBlock(block));
|
|
72
75
|
if (block.kind === 'interlingua' || block.kind === 'universalInterlingua') interlinguaBlocks.push(parseInterlinguaBlock(block));
|
|
73
76
|
if (block.kind === 'resourceGraph' || block.kind === 'semanticResourceGraph') resourceGraphBlocks.push(parseResourceGraphBlock(block));
|
|
@@ -76,7 +79,7 @@ export function parseFrontierSource(source, options = {}) {
|
|
|
76
79
|
if (block.kind === 'applicationSurface' || block.kind === 'appHost' || block.kind === 'plugin' || block.kind === 'pluginSurface' || block.kind === 'pluginContract') applicationSurfaceBlocks.push(parseApplicationSurfaceBlock(block));
|
|
77
80
|
if (block.kind === 'runtimeCapabilities' || block.kind === 'runtimeCapabilityMatrix' || block.kind === 'runtimeHosts') runtimeCapabilityBlocks.push(parseRuntimeCapabilityBlock(block));
|
|
78
81
|
}
|
|
79
|
-
const metadata = createParsedMetadata({ proofBlocks, paradigmBlocks, operationBlocks, semanticEditBlocks, conversionBlocks, constraintSpaceBlocks, decisionGraphBlocks, dialectRegistryBlocks, interlinguaBlocks, resourceGraphBlocks, nativeSourceBlocks, packageManifestBlocks, canvasSurfaceBlocks, applicationSurfaceBlocks, runtimeCapabilityBlocks, targetProjectionTargets });
|
|
82
|
+
const metadata = createParsedMetadata({ proofBlocks, paradigmBlocks, operationBlocks, semanticEditBlocks, conversionBlocks, constraintSpaceBlocks, decisionGraphBlocks, gateAdmissionEvidenceBlocks, dialectRegistryBlocks, interlinguaBlocks, resourceGraphBlocks, nativeSourceBlocks, packageManifestBlocks, canvasSurfaceBlocks, applicationSurfaceBlocks, runtimeCapabilityBlocks, targetProjectionTargets });
|
|
80
83
|
return createDocument({ id: documentId, name: documentName, nodes, ...(metadata ? { metadata } : {}) });
|
|
81
84
|
}
|
|
82
85
|
|
package/dist/metadata.js
CHANGED
|
@@ -4,6 +4,7 @@ import { mergeRuntimeCapabilityBlocks } from './runtime-capability.js';
|
|
|
4
4
|
import { mergeTargetProjectionTargets } from './target-projection-aggregate.js';
|
|
5
5
|
import { mergeConversionBlocks } from './conversion-metadata.js';
|
|
6
6
|
import { mergeSemanticEditBlocks } from './semantic-edit-metadata.js';
|
|
7
|
+
import { mergeGateAdmissionEvidenceBlocks } from './gate-admission-evidence.js';
|
|
7
8
|
|
|
8
9
|
const PROOF_GROUPS = ['contracts', 'refinements', 'invariants', 'termination', 'temporal', 'obligations', 'artifacts', 'assumptions'];
|
|
9
10
|
const PARADIGM_GROUPS = [
|
|
@@ -12,7 +13,7 @@ const PARADIGM_GROUPS = [
|
|
|
12
13
|
'clockModels', 'objectModels', 'macroExpansions', 'reflectionBoundaries', 'loweringRecords'
|
|
13
14
|
];
|
|
14
15
|
|
|
15
|
-
export function createParsedMetadata({ proofBlocks = [], paradigmBlocks = [], operationBlocks = [], semanticEditBlocks = [], conversionBlocks = [], constraintSpaceBlocks = [], decisionGraphBlocks = [], dialectRegistryBlocks = [], interlinguaBlocks = [], resourceGraphBlocks = [], nativeSourceBlocks = [], packageManifestBlocks = [], canvasSurfaceBlocks = [], applicationSurfaceBlocks = [], runtimeCapabilityBlocks = [], targetProjectionTargets = [] } = {}) {
|
|
16
|
+
export function createParsedMetadata({ proofBlocks = [], paradigmBlocks = [], operationBlocks = [], semanticEditBlocks = [], conversionBlocks = [], constraintSpaceBlocks = [], decisionGraphBlocks = [], gateAdmissionEvidenceBlocks = [], dialectRegistryBlocks = [], interlinguaBlocks = [], resourceGraphBlocks = [], nativeSourceBlocks = [], packageManifestBlocks = [], canvasSurfaceBlocks = [], applicationSurfaceBlocks = [], runtimeCapabilityBlocks = [], targetProjectionTargets = [] } = {}) {
|
|
16
17
|
const metadata = {};
|
|
17
18
|
if (proofBlocks.length) metadata.proof = mergeProofBlocks(proofBlocks);
|
|
18
19
|
if (paradigmBlocks.length) metadata.paradigmSemantics = mergeParadigmBlocks(paradigmBlocks);
|
|
@@ -21,6 +22,7 @@ export function createParsedMetadata({ proofBlocks = [], paradigmBlocks = [], op
|
|
|
21
22
|
if (conversionBlocks.length) metadata.universalConversionPlan = mergeConversionBlocks(conversionBlocks);
|
|
22
23
|
if (constraintSpaceBlocks.length) metadata.constraintSpaces = mergeConstraintSpaceBlocks(constraintSpaceBlocks);
|
|
23
24
|
if (decisionGraphBlocks.length) metadata.decisionGraph = mergeDecisionGraphBlocks(decisionGraphBlocks);
|
|
25
|
+
if (gateAdmissionEvidenceBlocks.length) metadata.gateAdmissionEvidence = mergeGateAdmissionEvidenceBlocks(gateAdmissionEvidenceBlocks);
|
|
24
26
|
if (dialectRegistryBlocks.length) metadata.dialects = mergeDialectRegistryBlocks(dialectRegistryBlocks);
|
|
25
27
|
if (interlinguaBlocks.length) metadata.universalInterlingua = mergeInterlinguaBlocks(interlinguaBlocks);
|
|
26
28
|
if (resourceGraphBlocks.length) metadata.semanticResourceGraphs = mergeResourceGraphBlocks(resourceGraphBlocks);
|
|
@@ -6,6 +6,7 @@ const interlinguaRows = words('layer constraint edge obligation proofObligation
|
|
|
6
6
|
const packageRows = words('metadata dependency script export gap proofGap evidence proofEvidence');
|
|
7
7
|
const runtimeRows = words('host runtimeHost hostProfile sourceHost targetHost capability hostCapability hostBinding binding requirement runtimeRequirement requiredRuntime evidence proofEvidence gap proofGap');
|
|
8
8
|
const semanticEditRows = words('script semanticEditScript projection semanticEditProjection replay semanticEditReplay');
|
|
9
|
+
const gateAdmissionRows = words('gate evidence proofEvidence admission admissionDecision gap proofGap');
|
|
9
10
|
|
|
10
11
|
export const ROW_SYNTAX_CONFIG = Object.freeze({
|
|
11
12
|
interlingua: rowConfig('interlinguaRow', 'interlingua_row', interlinguaRows, normalizeInterlinguaRow),
|
|
@@ -32,6 +33,9 @@ export const ROW_SYNTAX_CONFIG = Object.freeze({
|
|
|
32
33
|
possibilitySpace: rowConfig('constraintSpaceRow', 'constraint_space_row', constraintRows, normalizeConstraintSpaceRow),
|
|
33
34
|
decisionGraph: rowConfig('decisionGraphRow', 'decision_graph_row', words('node edge chunk gate evidence semanticChange change patchEvent patch admissionDecision admission candidateDecision candidate mergeDecision merge replay tournament tournamentCandidate panelProjection panel rsiLoop improvementFeedback feedback'), normalizeDecisionGraphRow),
|
|
34
35
|
admissionGraph: rowConfig('decisionGraphRow', 'decision_graph_row', words('node edge chunk gate evidence semanticChange change patchEvent patch admissionDecision admission candidateDecision candidate mergeDecision merge replay tournament tournamentCandidate panelProjection panel rsiLoop improvementFeedback feedback'), normalizeDecisionGraphRow),
|
|
36
|
+
gateEvidence: rowConfig('gateAdmissionEvidenceRow', 'gate_admission_evidence_row', gateAdmissionRows, normalizeGateAdmissionRow),
|
|
37
|
+
admissionEvidence: rowConfig('gateAdmissionEvidenceRow', 'gate_admission_evidence_row', gateAdmissionRows, normalizeGateAdmissionRow),
|
|
38
|
+
routeEvidence: rowConfig('gateAdmissionEvidenceRow', 'gate_admission_evidence_row', gateAdmissionRows, normalizeGateAdmissionRow),
|
|
35
39
|
operations: rowConfig('semanticOperationRow', 'semantic_operation_row', words('operation op'), normalizeOperationRow),
|
|
36
40
|
semanticOperations: rowConfig('semanticOperationRow', 'semantic_operation_row', words('operation op'), normalizeOperationRow),
|
|
37
41
|
semanticEdits: rowConfig('semanticEditRecordRow', 'semantic_edit_record_row', semanticEditRows, normalizeSemanticEditRow),
|
|
@@ -128,6 +132,13 @@ function normalizeSemanticEditRow(rowKind) {
|
|
|
128
132
|
return rowKind;
|
|
129
133
|
}
|
|
130
134
|
|
|
135
|
+
function normalizeGateAdmissionRow(rowKind) {
|
|
136
|
+
if (rowKind === 'proofEvidence') return 'evidence';
|
|
137
|
+
if (rowKind === 'admissionDecision') return 'admission';
|
|
138
|
+
if (rowKind === 'gap') return 'proofGap';
|
|
139
|
+
return rowKind;
|
|
140
|
+
}
|
|
141
|
+
|
|
131
142
|
function normalizeParadigmRow(rowKind) {
|
|
132
143
|
if (rowKind === 'ownership') return 'ownershipModel';
|
|
133
144
|
if (rowKind === 'lifetime') return 'lifetimeModel';
|