@shapeshift-labs/frontier-lang-compiler 0.2.38 → 0.2.40

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 CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  Compiler facade for Frontier Lang. It composes the parser, checker, semantic kernel, and projection adapters for TypeScript, JavaScript, Rust, Python, and C.
4
4
 
5
+ ## Vision
6
+
7
+ Frontier Lang and Frontier Swarm are two parts of the same system: a semantic programming substrate for agent teams.
8
+
9
+ Frontier Lang is the universal code representation. It imports source from native languages into a replayable semantic graph: AST layers, symbols, ownership regions, source maps, effects, proof obligations, runtime assumptions, tests, traces, and merge history. It preserves exact native source where needed, imports parser/compiler facts where available, and projects semantic programs back out through target-language adapters.
10
+
11
+ Frontier Swarm is the coordination layer for many agents working on that graph. It breaks large engineering goals into owned semantic regions, assigns workers isolated slices of context, collects machine-readable evidence, scores merge readiness, and lets the coordinator integrate patches without reading every worker transcript manually.
12
+
13
+ The shared goal is semantic merging for code. A worker output should say what it changed, what semantic region it owns, what source hashes it depended on, what tests or traces prove the change, what assumptions it conflicts with, and whether it is ready to merge, needs porting, or is discovery-only.
14
+
5
15
  ```js
6
16
  import { compileFrontierSource } from '@shapeshift-labs/frontier-lang-compiler';
7
17
 
@@ -118,6 +128,7 @@ import {
118
128
  createNativeImportCoverageMatrix,
119
129
  createNativeParserAstFormatMatrix,
120
130
  createProjectionTargetLossMatrix,
131
+ createUniversalCapabilityMatrix,
121
132
  importNativeSource
122
133
  } from '@shapeshift-labs/frontier-lang-compiler';
123
134
 
@@ -142,6 +153,15 @@ const pythonProjection = projectionMatrix.languages.find((entry) => entry.langua
142
153
  console.log(pythonProjection.sourceProjection.exactSource.lossClass); // "exactSourceProjection"
143
154
  console.log(pythonProjection.sourceProjection.stubs.lossClass); // "nativeSourceStubs"
144
155
  console.log(pythonProjection.targets.find((entry) => entry.target === 'rust').lossClass); // "missingAdapter"
156
+
157
+ const universalMatrix = createUniversalCapabilityMatrix({
158
+ imports: [imported],
159
+ requiredFeatures: ['syntax', 'semantic', 'sourcePreservation']
160
+ });
161
+ const pythonUniversal = universalMatrix.languages.find((entry) => entry.language === 'python');
162
+
163
+ console.log(pythonUniversal.readiness); // combined import/parser/projection readiness
164
+ console.log(pythonUniversal.blockers); // missing evidence/adapters that prevent merge admission
145
165
  ```
146
166
 
147
167
  The projection target matrix separates five runtime/API classes:
@@ -152,6 +172,8 @@ The projection target matrix separates five runtime/API classes:
152
172
  - `targetAdapterProjection`: a host-owned native-to-target adapter is present and produced target output with its own evidence/readiness.
153
173
  - `missingAdapter`: no native-to-target projection adapter is declared; preserve or stub the original source language instead, or inject host-owned parser/semantic adapter evidence.
154
174
 
175
+ `createUniversalCapabilityMatrix` composes the import coverage, parser AST format, parser feature, and projection target matrices into a single language row per source language. It is the coordinator-facing view for universal-language work: it shows imports, symbols, source-map mappings, parser feature readiness, projection targets, missing adapters, unsupported target features, blockers, and review reasons without claiming lossless conversion where evidence is absent.
176
+
155
177
  Preserve exact native source text, token/trivia hashes, comments, whitespace, and source directives as evidence. This does not claim full semantic understanding; it keeps round-trip material available while exact parser adapters catch up:
156
178
 
157
179
  ```js
@@ -242,6 +264,44 @@ console.log(changeSet.mergeCandidate.readiness); // merge-admission classificati
242
264
 
243
265
  Use `diffNativeSourceImports` when the worker or runner already produced `importNativeSource` results. Changed regions include a `metadata.changedRegionProjection` envelope with before/after source hashes, source-map links, ownership keys, readiness, and `autoMergeClaim: false` so swarm admission tools can score or port patches without treating semantic metadata as proof. Body-only edits that the lightweight scanner cannot anchor to a symbol are still reported as file-level changed regions instead of being silently treated as safe.
244
266
 
267
+ Extract a surgical semantic slice when a worker only needs one symbol, region, native AST node, or source path:
268
+
269
+ ```js
270
+ import {
271
+ createSemanticSlice,
272
+ importNativeSource,
273
+ testSemanticSlice,
274
+ writeSemanticSliceJson
275
+ } from '@shapeshift-labs/frontier-lang-compiler';
276
+
277
+ const sourceText = 'export function parseExpression(input) { return input; }\n';
278
+ const imported = importNativeSource({
279
+ language: 'typescript',
280
+ sourcePath: 'src/parser.ts',
281
+ sourceText
282
+ });
283
+
284
+ const slice = createSemanticSlice(imported, {
285
+ entryRefs: ['symbol:parseExpression'],
286
+ includeDependencies: true,
287
+ focusedCommands: ['npm test -- parser-expression'],
288
+ fixtureHints: ['operator precedence corpus']
289
+ });
290
+
291
+ console.log(slice.kind); // "frontier.lang.semanticSlice"
292
+ console.log(slice.mergeAdmission.conflictKeys); // semantic ownership keys
293
+ console.log(slice.sourceFiles[0].sourceHash); // stale-check input for admission
294
+
295
+ const gate = testSemanticSlice(slice, {
296
+ currentSources: { 'src/parser.ts': sourceText }
297
+ });
298
+
299
+ console.log(gate.status); // "passed", "needs-review", or "failed"
300
+ console.log(writeSemanticSliceJson(slice)); // stable JSON for worker inputs
301
+ ```
302
+
303
+ A semantic slice is the small unit a swarm can hand to a worker instead of copying a full repository. It carries the selected symbols, ownership regions, native nodes, relations, occurrences, source-map links, source spans, source excerpts, source hashes, focused verification commands, fixture hints, and merge-admission metadata. It does not claim the patch is correct; it makes the context and conflicts machine-readable so admission scoring can combine changed ownership, focused test status, stale/source-hash checks, evidence, and semantic risk in one sortable record.
304
+
245
305
  Compile native source imports through the same reader/IR/writer facade that swarms use for sidecar evidence. Same-language targets preserve exact source when hashes match; cross-language targets emit declaration stubs until a real adapter provides stronger evidence:
246
306
 
247
307
  ```js
@@ -484,7 +544,7 @@ The published Frontier package family is generated from one shared package catal
484
544
  - [`@shapeshift-labs/frontier-lang-csharp`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang-csharp): C# Roslyn source-language importer package for Frontier Lang semantic documents, including package-level metadata, Roslyn adapter helpers, native import results, and semantic sidecar generation for SyntaxTree/SyntaxNode-shaped ASTs.
485
545
  - [`@shapeshift-labs/frontier-lang-clang`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang-clang): Clang AST source-language importer package for Frontier Lang semantic documents, including package-level metadata, Clang AST JSON adapter helpers, native import results, and semantic sidecar generation for C/C++ translation units.
486
546
  - [`@shapeshift-labs/frontier-lang-cli`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang-cli): Command line interface for parsing, checking, hashing, and emitting Frontier Lang projects.
487
- - [`@shapeshift-labs/frontier-lang`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang): Umbrella package for Frontier Lang kernel, parser, checker, and projection adapters.
547
+ - [`@shapeshift-labs/frontier-lang`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang): Umbrella package for Frontier Lang kernel, parser, checker, compiler facade, universal AST helpers, and projection adapters.
488
548
  - [`@shapeshift-labs/frontier-kv`](https://www.npmjs.com/package/@shapeshift-labs/frontier-kv): Serializable in-memory key/value state for Frontier apps, including TTL, versioned compare-and-set, batched patch mutations, scans, watchers, snapshots, JSONL event evidence, and replay verification.
489
549
  - [`@shapeshift-labs/frontier-kv-locks`](https://www.npmjs.com/package/@shapeshift-labs/frontier-kv-locks): Lease-style lock records on top of Frontier KV, including acquire, renew, release, fencing tokens, expiration, owner evidence, and replayable lock events.
490
550
  - [`@shapeshift-labs/frontier-kv-rate-limit`](https://www.npmjs.com/package/@shapeshift-labs/frontier-kv-rate-limit): Patch-native rate limit buckets for Frontier KV, including fixed windows, sliding windows, token buckets, deterministic refill, consume evidence, and reset records.
package/bench/smoke.mjs CHANGED
@@ -12,18 +12,21 @@ import {
12
12
  createNativeParserAstFormatMatrix,
13
13
  createNativeParserFeatureMatrix,
14
14
  createProjectionTargetLossMatrix,
15
+ createUniversalCapabilityMatrix,
15
16
  createNativeSourcePreservation,
16
17
  createPythonAstNativeImporterAdapter,
17
18
  createRustSynNativeImporterAdapter,
18
19
  createSwiftSyntaxNativeImporterAdapter,
19
20
  createSemanticImportSidecar,
21
+ createSemanticSlice,
20
22
  diffNativeSources,
21
23
  importExternalSemanticIndex,
22
24
  importNativeSource,
23
25
  projectNativeImportToSource,
24
26
  queryNativeParserFeatureMatrix,
25
27
  runNativeImporterAdapter,
26
- summarizeNativeImportFeatureEvidence
28
+ summarizeNativeImportFeatureEvidence,
29
+ testSemanticSlice
27
30
  } from '../dist/index.js';
28
31
 
29
32
  const source = `
@@ -140,6 +143,14 @@ const projectionMatrixStart = performance.now();
140
143
  const projectionLossMatrix = createProjectionTargetLossMatrix({ imports: nativeImportResults });
141
144
  const projectionMatrixDurationMs = performance.now() - projectionMatrixStart;
142
145
 
146
+ const universalMatrixStart = performance.now();
147
+ const universalCapabilityMatrix = createUniversalCapabilityMatrix({
148
+ imports: nativeImportResults,
149
+ adapters: [estreeAdapter, createPythonAstNativeImporterAdapter(), createRustSynNativeImporterAdapter(), createClangAstNativeImporterAdapter(), createGoAstNativeImporterAdapter(), createJavaAstNativeImporterAdapter(), kotlinPsiAdapter, createCSharpRoslynNativeImporterAdapter(), createSwiftSyntaxNativeImporterAdapter()],
150
+ requiredFeatures: ['syntax', 'semantic', 'sourcePreservation']
151
+ });
152
+ const universalMatrixDurationMs = performance.now() - universalMatrixStart;
153
+
143
154
  const preservationStart = performance.now();
144
155
  const preservationRecords = nativeImportResults.map((imported) => imported.metadata.sourcePreservation ?? createNativeSourcePreservation({
145
156
  language: imported.language,
@@ -154,6 +165,23 @@ const semanticSidecars = nativeImportResults.map((imported) => createSemanticImp
154
165
  const sidecarDurationMs = performance.now() - sidecarStart;
155
166
  const sidecarOwnershipRegions = semanticSidecars.reduce((sum, sidecar) => sum + sidecar.ownershipRegions.length, 0);
156
167
 
168
+ const sliceStart = performance.now();
169
+ const semanticSlices = nativeImportResults.slice(0, 100).map((imported, index) => {
170
+ const symbol = imported.semanticIndex?.symbols?.[0]?.name ?? imported.semanticIndex?.symbols?.[0]?.id;
171
+ return createSemanticSlice(imported, {
172
+ entryRefs: symbol ? [`symbol:${symbol}`] : [],
173
+ includeDependencies: index % 2 === 0,
174
+ focusedCommands: [`npm test -- semantic-slice-${index}`]
175
+ });
176
+ });
177
+ const sliceDurationMs = performance.now() - sliceStart;
178
+ const sliceSourceMapLinks = semanticSlices.reduce((sum, slice) => sum + slice.sourceMapLinks.length, 0);
179
+ const sliceConflictKeys = semanticSlices.reduce((sum, slice) => sum + slice.mergeAdmission.conflictKeys.length, 0);
180
+ const sliceGateStart = performance.now();
181
+ const semanticSliceGates = semanticSlices.map((slice) => testSemanticSlice(slice, { requireSourceMapLinks: false }));
182
+ const sliceGateDurationMs = performance.now() - sliceGateStart;
183
+ const sliceGateFailures = semanticSliceGates.filter((gate) => gate.status === 'failed').length;
184
+
157
185
  const featureEvidenceStart = performance.now();
158
186
  const featureEvidenceSummaries = nativeImportResults.map((imported) => summarizeNativeImportFeatureEvidence(imported.losses, {
159
187
  evidence: imported.evidence
@@ -304,12 +332,23 @@ console.log(JSON.stringify({
304
332
  projectionMatrixMissingAdapters: projectionLossMatrix.summary.missingAdapters,
305
333
  projectionMatrixUnsupportedTargetFeatures: projectionLossMatrix.summary.unsupportedTargetFeatures,
306
334
  projectionMatrixDurationMs: Number(projectionMatrixDurationMs.toFixed(2)),
335
+ universalMatrixLanguages: universalCapabilityMatrix.summary.languages,
336
+ universalMatrixImports: universalCapabilityMatrix.summary.imports,
337
+ universalMatrixBlockedLanguages: universalCapabilityMatrix.summary.blockedLanguages,
338
+ universalMatrixMissingAdapters: universalCapabilityMatrix.summary.missingAdapters,
339
+ universalMatrixDurationMs: Number(universalMatrixDurationMs.toFixed(2)),
307
340
  sourcePreservationRecords: preservationRecords.length,
308
341
  sourcePreservationTokens: preservationTokens,
309
342
  sourcePreservationDurationMs: Number(preservationDurationMs.toFixed(2)),
310
343
  semanticSidecars: semanticSidecars.length,
311
344
  sidecarOwnershipRegions,
312
345
  sidecarDurationMs: Number(sidecarDurationMs.toFixed(2)),
346
+ semanticSlices: semanticSlices.length,
347
+ sliceDurationMs: Number(sliceDurationMs.toFixed(2)),
348
+ sliceGateDurationMs: Number(sliceGateDurationMs.toFixed(2)),
349
+ sliceSourceMapLinks,
350
+ sliceConflictKeys,
351
+ sliceGateFailures,
313
352
  featureEvidencePolicyMatches,
314
353
  featureEvidenceDurationMs: Number(featureEvidenceDurationMs.toFixed(2)),
315
354
  nativeProjections: nativeProjections.length,
package/dist/index.d.ts CHANGED
@@ -652,6 +652,101 @@ export interface ProjectionTargetLossMatrixOptions {
652
652
  readonly generatedAt?: number;
653
653
  }
654
654
 
655
+ export interface UniversalCapabilityLanguageRow {
656
+ readonly language: FrontierSourceLanguage | string;
657
+ readonly aliases: readonly string[];
658
+ readonly extensions: readonly string[];
659
+ readonly readiness: SemanticMergeReadiness;
660
+ readonly imports: {
661
+ readonly total: number;
662
+ readonly readiness: SemanticMergeReadiness;
663
+ readonly symbols: number;
664
+ readonly sourceMaps: number;
665
+ readonly sourceMapMappings: number;
666
+ readonly losses: number;
667
+ readonly lossKinds: Readonly<Record<string, number>>;
668
+ readonly readinessReasons: readonly string[];
669
+ };
670
+ readonly parser: {
671
+ readonly readiness: SemanticMergeReadiness;
672
+ readonly rows: number;
673
+ readonly parsers: readonly string[];
674
+ readonly mergeReadyParsers: readonly string[];
675
+ readonly blockingFeatures: readonly NativeParserFeatureCategory[];
676
+ readonly reviewFeatures: readonly NativeParserFeatureCategory[];
677
+ readonly languageSummary?: NativeParserFeatureLanguageSummary;
678
+ };
679
+ readonly projection: {
680
+ readonly readiness: SemanticMergeReadiness;
681
+ readonly sourceProjection?: ProjectionTargetLanguageCoverage['sourceProjection'];
682
+ readonly targets: readonly ProjectionTargetCoverageEntry[];
683
+ readonly summary: ProjectionTargetLanguageCoverage['summary'];
684
+ readonly missingTargets: readonly (FrontierCompileTarget | string)[];
685
+ readonly unsupportedTargets: readonly (FrontierCompileTarget | string)[];
686
+ };
687
+ readonly evidence: {
688
+ readonly parserAdapters: number;
689
+ readonly adapterCoverageSummaries: number;
690
+ readonly adapterCoverageGaps: Readonly<Record<string, number>>;
691
+ readonly knownLossKinds: readonly NativeImportKnownLossKind[];
692
+ readonly sourceMapMappings: number;
693
+ };
694
+ readonly blockers: readonly string[];
695
+ readonly review: readonly string[];
696
+ }
697
+
698
+ export interface UniversalCapabilityMatrix {
699
+ readonly kind: 'frontier.lang.universalCapabilityMatrix';
700
+ readonly version: 1;
701
+ readonly generatedAt: number;
702
+ readonly languages: readonly UniversalCapabilityLanguageRow[];
703
+ readonly summary: {
704
+ readonly languages: number;
705
+ readonly imports: number;
706
+ readonly symbols: number;
707
+ readonly sourceMapMappings: number;
708
+ readonly losses: number;
709
+ readonly parserRows: number;
710
+ readonly parserMergeReady: number;
711
+ readonly targetEntries: number;
712
+ readonly missingAdapters: number;
713
+ readonly unsupportedTargetFeatures: number;
714
+ readonly exactSourceProjection: number;
715
+ readonly nativeSourceStubs: number;
716
+ readonly blockers: number;
717
+ readonly reviewReasons: number;
718
+ readonly readyLanguages: number;
719
+ readonly readyWithLossesLanguages: number;
720
+ readonly reviewLanguages: number;
721
+ readonly blockedLanguages: number;
722
+ readonly byReadiness: Readonly<Record<SemanticMergeReadiness, number>>;
723
+ readonly byImportReadiness: Readonly<Record<SemanticMergeReadiness, number>>;
724
+ readonly byParserReadiness: Readonly<Record<SemanticMergeReadiness, number>>;
725
+ readonly byProjectionReadiness: Readonly<Record<SemanticMergeReadiness, number>>;
726
+ };
727
+ readonly matrices: {
728
+ readonly importCoverage: NativeImportCoverageMatrix;
729
+ readonly parserFormats: NativeParserAstFormatMatrix;
730
+ readonly parserFeatures: NativeParserFeatureMatrix;
731
+ readonly projectionTargets: ProjectionTargetLossMatrix;
732
+ };
733
+ readonly metadata: {
734
+ readonly requiredFeatures: readonly NativeParserFeatureCategory[];
735
+ readonly minimumReadiness: SemanticMergeReadiness;
736
+ readonly compileTargets: readonly (FrontierCompileTarget | string)[];
737
+ readonly note: string;
738
+ };
739
+ }
740
+
741
+ export interface UniversalCapabilityMatrixOptions extends
742
+ NativeImportCoverageMatrixOptions,
743
+ NativeParserAstFormatMatrixOptions,
744
+ NativeParserFeatureMatrixOptions,
745
+ ProjectionTargetLossMatrixOptions {
746
+ readonly targetAdapters?: readonly NativeTargetProjectionAdapter[];
747
+ readonly targets?: readonly (FrontierCompileTarget | string)[];
748
+ }
749
+
655
750
  export interface NativeImportContractSource {
656
751
  readonly id: string;
657
752
  readonly language?: FrontierSourceLanguage | string;
@@ -1329,6 +1424,184 @@ export interface NativeSourceChangeSet {
1329
1424
  };
1330
1425
  }
1331
1426
 
1427
+ export type SemanticSliceInput =
1428
+ | NativeSourceImportResult
1429
+ | NativeProjectImportResult
1430
+ | ImportNativeSourceOptions
1431
+ | FrontierUniversalAstEnvelope
1432
+ | SemanticImportSidecar
1433
+ | {
1434
+ readonly import?: NativeSourceImportResult | NativeProjectImportResult | ImportNativeSourceOptions;
1435
+ readonly importResult?: NativeSourceImportResult | NativeProjectImportResult | ImportNativeSourceOptions;
1436
+ readonly universalAst?: FrontierUniversalAstEnvelope;
1437
+ readonly sidecar?: SemanticImportSidecar;
1438
+ readonly source?: ImportNativeSourceOptions;
1439
+ };
1440
+
1441
+ export interface CreateSemanticSliceOptions {
1442
+ readonly id?: string;
1443
+ readonly generatedAt?: number;
1444
+ readonly language?: FrontierSourceLanguage | string;
1445
+ readonly sourcePath?: string;
1446
+ readonly sourceHash?: string;
1447
+ readonly sourceText?: string;
1448
+ readonly symbol?: string;
1449
+ readonly region?: string;
1450
+ readonly nativeNodeId?: string;
1451
+ readonly entryRefs?: readonly string[] | string;
1452
+ readonly semanticRefs?: readonly string[] | string;
1453
+ readonly refs?: readonly string[] | string;
1454
+ readonly includeDependencies?: boolean;
1455
+ readonly maxDependencyDepth?: number;
1456
+ readonly includeSourceText?: boolean;
1457
+ readonly maxExcerptBytes?: number;
1458
+ readonly focusedCommands?: readonly string[] | string;
1459
+ readonly fixtureHints?: readonly string[] | string;
1460
+ readonly regionPrefix?: string;
1461
+ readonly evidenceId?: string;
1462
+ readonly mergeCandidateId?: string;
1463
+ readonly sidecar?: SemanticImportSidecar;
1464
+ readonly metadata?: Record<string, unknown>;
1465
+ }
1466
+
1467
+ export interface SemanticSliceSourceMapLink {
1468
+ readonly id?: string;
1469
+ readonly sourceMapId?: string;
1470
+ readonly sourcePath?: string;
1471
+ readonly sourceHash?: string;
1472
+ readonly targetPath?: string;
1473
+ readonly targetHash?: string;
1474
+ readonly semanticSymbolId?: string;
1475
+ readonly semanticOccurrenceId?: string;
1476
+ readonly semanticNodeId?: string;
1477
+ readonly nativeSourceId?: string;
1478
+ readonly nativeAstNodeId?: string;
1479
+ readonly precision?: string;
1480
+ readonly sourceSpan?: SourceSpan;
1481
+ readonly generatedSpan?: SourceMapMappingRecord['generatedSpan'];
1482
+ readonly ownershipRegionId?: string;
1483
+ readonly ownershipRegionKey?: string;
1484
+ readonly ownershipRegionKind?: NativeImportRegionTaxonomyKind;
1485
+ }
1486
+
1487
+ export interface SemanticSliceSourceFile {
1488
+ readonly path?: string;
1489
+ readonly sourceHash?: string;
1490
+ readonly spans: readonly SourceSpan[];
1491
+ readonly spanCount: number;
1492
+ readonly excerptCount: number;
1493
+ readonly sourceTextAvailable: boolean;
1494
+ readonly excerpts: readonly {
1495
+ readonly span: SourceSpan;
1496
+ readonly text: string;
1497
+ readonly textHash: string;
1498
+ readonly truncated: boolean;
1499
+ }[];
1500
+ }
1501
+
1502
+ export interface SemanticSliceExpectedAssertion {
1503
+ readonly id: string;
1504
+ readonly expected: boolean;
1505
+ }
1506
+
1507
+ export interface SemanticSlice {
1508
+ readonly kind: 'frontier.lang.semanticSlice';
1509
+ readonly version: 1;
1510
+ readonly id: string;
1511
+ readonly generatedAt: number;
1512
+ readonly language?: FrontierSourceLanguage | string;
1513
+ readonly sourcePath?: string;
1514
+ readonly importId?: string;
1515
+ readonly universalAstId?: string;
1516
+ readonly semanticIndexId?: string;
1517
+ readonly sidecarId?: string;
1518
+ readonly entryRefs: readonly string[];
1519
+ readonly matchedEntryRefs: readonly string[];
1520
+ readonly unresolvedEntryRefs: readonly string[];
1521
+ readonly symbols: readonly (SemanticIndexRecord['symbols'][number] | SemanticImportSidecarSymbol)[];
1522
+ readonly ownershipRegions: readonly SemanticImportOwnershipRegion[];
1523
+ readonly nativeNodes: readonly NativeAstNode[];
1524
+ readonly relations: readonly SemanticIndexRecord['relations'][number][];
1525
+ readonly occurrences: readonly SemanticIndexRecord['occurrences'][number][];
1526
+ readonly sourceMapLinks: readonly SemanticSliceSourceMapLink[];
1527
+ readonly sourceSpans: readonly SourceSpan[];
1528
+ readonly sourceFiles: readonly SemanticSliceSourceFile[];
1529
+ readonly losses: readonly NativeAstLossRecord[];
1530
+ readonly evidence: readonly EvidenceRecord[];
1531
+ readonly mergeCandidate: SemanticMergeCandidateRecord;
1532
+ readonly verification: {
1533
+ readonly focusedCommands: readonly string[];
1534
+ readonly fixtureHints: readonly string[];
1535
+ readonly expectedAssertions: readonly SemanticSliceExpectedAssertion[];
1536
+ };
1537
+ readonly summary: {
1538
+ readonly symbols: number;
1539
+ readonly ownershipRegions: number;
1540
+ readonly nativeNodes: number;
1541
+ readonly relations: number;
1542
+ readonly occurrences: number;
1543
+ readonly sourceMapLinks: number;
1544
+ readonly sourceFiles: number;
1545
+ readonly losses: number;
1546
+ readonly conflictKeys: number;
1547
+ readonly readiness: SemanticMergeReadiness;
1548
+ readonly unresolvedEntryRefs: number;
1549
+ readonly sourceTextAvailable: boolean;
1550
+ };
1551
+ readonly mergeAdmission: {
1552
+ readonly autoMergeClaim: false;
1553
+ readonly reviewRequired: boolean;
1554
+ readonly readiness: SemanticMergeReadiness;
1555
+ readonly reasons: readonly string[];
1556
+ readonly conflictKeys: readonly string[];
1557
+ readonly ownershipKeys: readonly string[];
1558
+ readonly sourceHashes: readonly { readonly path?: string; readonly sourceHash?: string }[];
1559
+ readonly staleCheck: {
1560
+ readonly mode: 'source-hash' | string;
1561
+ readonly requiresCurrentSource: boolean;
1562
+ readonly sourceFiles: number;
1563
+ };
1564
+ };
1565
+ readonly metadata?: Record<string, unknown>;
1566
+ }
1567
+
1568
+ export interface TestSemanticSliceOptions {
1569
+ readonly id?: string;
1570
+ readonly generatedAt?: number;
1571
+ readonly requireSourceMapLinks?: boolean;
1572
+ readonly currentSources?: Readonly<Record<string, string>> | ReadonlyMap<string, string>;
1573
+ readonly metadata?: Record<string, unknown>;
1574
+ }
1575
+
1576
+ export interface SemanticSliceTestAssertion {
1577
+ readonly id: string;
1578
+ readonly status: 'passed' | 'warning' | 'failed';
1579
+ readonly summary: string;
1580
+ readonly metadata?: Record<string, unknown>;
1581
+ }
1582
+
1583
+ export interface SemanticSliceTestResult {
1584
+ readonly kind: 'frontier.lang.semanticSliceTestResult';
1585
+ readonly version: 1;
1586
+ readonly id: string;
1587
+ readonly generatedAt: number;
1588
+ readonly sliceId?: string;
1589
+ readonly status: 'passed' | 'needs-review' | 'failed';
1590
+ readonly readiness: SemanticMergeReadiness;
1591
+ readonly assertions: readonly SemanticSliceTestAssertion[];
1592
+ readonly summary: {
1593
+ readonly assertions: number;
1594
+ readonly passed: number;
1595
+ readonly warnings: number;
1596
+ readonly failed: number;
1597
+ readonly sourceHashChecks: number;
1598
+ readonly symbols: number;
1599
+ readonly ownershipRegions: number;
1600
+ readonly sourceMapLinks: number;
1601
+ };
1602
+ readonly metadata?: Record<string, unknown>;
1603
+ }
1604
+
1332
1605
  export type NativeImporterAdapterExactness =
1333
1606
  | 'exact-parser-ast'
1334
1607
  | 'parser-tree'
@@ -2253,6 +2526,7 @@ export declare function createNativeParserAstFormatMatrix(options?: NativeParser
2253
2526
  export declare function createNativeParserFeatureMatrix(options?: NativeParserFeatureMatrixOptions): NativeParserFeatureMatrix;
2254
2527
  export declare function queryNativeParserFeatureMatrix(matrixOrOptions?: NativeParserFeatureMatrix | NativeParserFeatureMatrixOptions, query?: NativeParserFeatureMatrixQuery): NativeParserFeatureMatrixQueryResult;
2255
2528
  export declare function createProjectionTargetLossMatrix(options?: ProjectionTargetLossMatrixOptions): ProjectionTargetLossMatrix;
2529
+ export declare function createUniversalCapabilityMatrix(options?: UniversalCapabilityMatrixOptions): UniversalCapabilityMatrix;
2256
2530
  export declare function createNativeSourcePreservation(options: CreateNativeSourcePreservationOptions): NativeSourcePreservation;
2257
2531
  export declare function createSemanticImportSidecar(importResult: NativeSourceImportResult | NativeProjectImportResult, options?: SemanticImportSidecarOptions): SemanticImportSidecar;
2258
2532
  export declare function createNativeImportResultContract(importResult: NativeSourceImportResult | NativeProjectImportResult, options?: NativeImportResultContractOptions): NativeImportResultContract;
@@ -2275,6 +2549,10 @@ export declare function importExternalSemanticIndex(input: ImportExternalSemanti
2275
2549
  export declare function importNativeSource(input: ImportNativeSourceOptions): NativeSourceImportResult;
2276
2550
  export declare function diffNativeSources(input: DiffNativeSourcesOptions): NativeSourceChangeSet;
2277
2551
  export declare function diffNativeSourceImports(input: DiffNativeSourceImportsOptions): NativeSourceChangeSet;
2552
+ export declare function createSemanticSlice(input: SemanticSliceInput, options?: CreateSemanticSliceOptions): SemanticSlice;
2553
+ export declare function testSemanticSlice(slice: SemanticSlice, options?: TestSemanticSliceOptions): SemanticSliceTestResult;
2554
+ export declare function readSemanticSliceJson(source: string): SemanticSlice;
2555
+ export declare function writeSemanticSliceJson(slice: SemanticSlice): string;
2278
2556
  export declare function importNativeProject(input: ImportNativeProjectOptions): Promise<NativeProjectImportResult>;
2279
2557
  export declare function createUniversalAstFromDocument(document: FrontierLangDocument, input?: {
2280
2558
  readonly id?: string;