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

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
@@ -197,6 +197,8 @@ const sidecar = createSemanticImportSidecar(imported);
197
197
  console.log(sidecar.summary.emptySemanticIndex); // false when symbols were found
198
198
  console.log(sidecar.ownershipRegions[0].key); // source#src/runtime.ts#type#Runtime
199
199
  console.log(sidecar.patchHints[0].supportedOperations); // source-region patch operations
200
+ console.log(sidecar.proofSpec.obligations); // proof/spec obligations when the import carries a universal AST proof layer
201
+ console.log(sidecar.paradigmSemantics.hasLowering); // true when source import preserved lowering/paradigm records
200
202
  ```
201
203
 
202
204
  The built-in JavaScript/TypeScript lightweight scanner also emits review-required ownership regions for clear route/config/content/property shapes in exported objects and arrays:
package/dist/index.d.ts CHANGED
@@ -968,6 +968,8 @@ export interface SemanticImportSidecarImportEntry {
968
968
  readonly universalAstLayerCount: number;
969
969
  readonly universalAstLayerNames: readonly string[];
970
970
  readonly universalAstLayerIds: readonly string[];
971
+ readonly proofSpec: SemanticImportSidecarProofSpecSummary;
972
+ readonly paradigmSemantics: SemanticImportSidecarParadigmSemanticsSummary;
971
973
  readonly readiness: SemanticMergeReadiness;
972
974
  readonly emptySemanticIndex: boolean;
973
975
  readonly regionTaxonomy?: SemanticImportRegionTaxonomySummary;
@@ -999,6 +1001,68 @@ export interface SemanticImportSidecarUniversalAstLayerSummary {
999
1001
  readonly empty: boolean;
1000
1002
  }
1001
1003
 
1004
+ export interface SemanticImportSidecarProofSpecSummary {
1005
+ readonly total: number;
1006
+ readonly ids: readonly string[];
1007
+ readonly contracts: number;
1008
+ readonly refinements: number;
1009
+ readonly invariants: number;
1010
+ readonly termination: number;
1011
+ readonly temporal: number;
1012
+ readonly obligations: number;
1013
+ readonly artifacts: number;
1014
+ readonly assumptions: number;
1015
+ readonly evidence: number;
1016
+ readonly discharged: number;
1017
+ readonly failed: number;
1018
+ readonly open: number;
1019
+ readonly unknown: number;
1020
+ readonly stale: number;
1021
+ readonly assumed: number;
1022
+ readonly contractKinds: readonly string[];
1023
+ readonly artifactKinds: readonly string[];
1024
+ readonly byStatus: Readonly<Record<string, number>>;
1025
+ readonly byContractKind: Readonly<Record<string, number>>;
1026
+ readonly byArtifactKind: Readonly<Record<string, number>>;
1027
+ readonly empty: boolean;
1028
+ }
1029
+
1030
+ export interface SemanticImportSidecarParadigmSemanticsSummary {
1031
+ readonly total: number;
1032
+ readonly ids: readonly string[];
1033
+ readonly groups: readonly string[];
1034
+ readonly kinds: readonly string[];
1035
+ readonly evidence: number;
1036
+ readonly bindingScopes: number;
1037
+ readonly bindings: number;
1038
+ readonly patterns: number;
1039
+ readonly typeConstraints: number;
1040
+ readonly evaluationModels: number;
1041
+ readonly memoryLocations: number;
1042
+ readonly effectRegions: number;
1043
+ readonly controlRegions: number;
1044
+ readonly logicPrograms: number;
1045
+ readonly actorSystems: number;
1046
+ readonly stackEffects: number;
1047
+ readonly arrayShapes: number;
1048
+ readonly numericKernels: number;
1049
+ readonly dataflowNetworks: number;
1050
+ readonly clockModels: number;
1051
+ readonly objectModels: number;
1052
+ readonly macroExpansions: number;
1053
+ readonly reflectionBoundaries: number;
1054
+ readonly loweringRecords: number;
1055
+ readonly byGroup: Readonly<Record<string, number>>;
1056
+ readonly byKind: Readonly<Record<string, number>>;
1057
+ readonly hasRuntimeSemantics: boolean;
1058
+ readonly hasLogicSemantics: boolean;
1059
+ readonly hasStackSemantics: boolean;
1060
+ readonly hasArraySemantics: boolean;
1061
+ readonly hasMacroOrReflection: boolean;
1062
+ readonly hasLowering: boolean;
1063
+ readonly empty: boolean;
1064
+ }
1065
+
1002
1066
  export interface SemanticImportSidecar {
1003
1067
  readonly kind: 'frontier.lang.semanticImportSidecar';
1004
1068
  readonly version: 1;
@@ -1028,6 +1092,8 @@ export interface SemanticImportSidecar {
1028
1092
  readonly records: readonly SemanticImportSidecarSourcePreservationRecord[];
1029
1093
  };
1030
1094
  readonly universalAstLayers: SemanticImportSidecarUniversalAstLayerSummary;
1095
+ readonly proofSpec: SemanticImportSidecarProofSpecSummary;
1096
+ readonly paradigmSemantics: SemanticImportSidecarParadigmSemanticsSummary;
1031
1097
  readonly patchHints: readonly SemanticImportPatchHint[];
1032
1098
  readonly mergeCandidates: readonly {
1033
1099
  readonly id?: string;
@@ -1059,6 +1125,12 @@ export interface SemanticImportSidecar {
1059
1125
  readonly sourcePreservationRecords: number;
1060
1126
  readonly universalAstLayers: number;
1061
1127
  readonly universalAstLayerNames: readonly string[];
1128
+ readonly proofSpecRecords: number;
1129
+ readonly proofSpecObligations: number;
1130
+ readonly proofSpecFailedObligations: number;
1131
+ readonly paradigmSemanticsRecords: number;
1132
+ readonly paradigmSemanticsGroups: number;
1133
+ readonly paradigmSemanticsLoweringRecords: number;
1062
1134
  readonly readiness: SemanticMergeReadiness;
1063
1135
  readonly emptySemanticIndex: boolean;
1064
1136
  };
package/dist/index.js CHANGED
@@ -2566,6 +2566,8 @@ export function createSemanticImportSidecar(importResult, options = {}) {
2566
2566
  const regionTaxonomy = summarizeSemanticImportRegionTaxonomy(ownershipRegions);
2567
2567
  const sourcePreservation = summarizeKernelSourcePreservation(importResult, imports);
2568
2568
  const universalAstLayers = summarizeSemanticImportSidecarUniversalAstLayers(importEntries);
2569
+ const proofSpec = summarizeSemanticImportSidecarProofSpec(importEntries);
2570
+ const paradigmSemantics = summarizeSemanticImportSidecarParadigmSemantics(importEntries);
2569
2571
  const readiness = mergeCandidates.reduce(
2570
2572
  (current, candidate) => maxSemanticMergeReadiness(current, candidate.readiness),
2571
2573
  lossSummary.semanticMergeReadiness
@@ -2588,6 +2590,8 @@ export function createSemanticImportSidecar(importResult, options = {}) {
2588
2590
  },
2589
2591
  sourcePreservation,
2590
2592
  universalAstLayers,
2593
+ proofSpec,
2594
+ paradigmSemantics,
2591
2595
  patchHints,
2592
2596
  mergeCandidates: mergeCandidates.map((candidate) => ({
2593
2597
  id: candidate.id,
@@ -2619,6 +2623,12 @@ export function createSemanticImportSidecar(importResult, options = {}) {
2619
2623
  sourcePreservationRecords: sourcePreservation.total,
2620
2624
  universalAstLayers: universalAstLayers.total,
2621
2625
  universalAstLayerNames: universalAstLayers.names,
2626
+ proofSpecRecords: proofSpec.total,
2627
+ proofSpecObligations: proofSpec.obligations,
2628
+ proofSpecFailedObligations: proofSpec.failed,
2629
+ paradigmSemanticsRecords: paradigmSemantics.total,
2630
+ paradigmSemanticsGroups: paradigmSemantics.groups.length,
2631
+ paradigmSemanticsLoweringRecords: paradigmSemantics.loweringRecords,
2622
2632
  readiness,
2623
2633
  emptySemanticIndex: symbols.length === 0
2624
2634
  },
@@ -8582,6 +8592,8 @@ function semanticImportSidecarEntry(imported, index, options) {
8582
8592
  const sourceMapMappings = sourceMaps.flatMap((sourceMap) => sourceMap?.mappings ?? []);
8583
8593
  const sourcePreservationRecords = collectKernelSourcePreservationFromImport(imported);
8584
8594
  const universalAstLayers = summarizeUniversalAstLayers(imported?.universalAst);
8595
+ const proofSpec = summarizeProofSpecLayer(imported?.universalAst?.proof ?? imported?.proof);
8596
+ const paradigmSemantics = summarizeParadigmSemanticsLayer(imported?.universalAst?.paradigmSemantics ?? imported?.paradigmSemantics);
8585
8597
  const mappingsBySymbolId = new Map();
8586
8598
  for (const mapping of sourceMapMappings) {
8587
8599
  if (mapping.semanticSymbolId && !mappingsBySymbolId.has(mapping.semanticSymbolId)) {
@@ -8631,6 +8643,8 @@ function semanticImportSidecarEntry(imported, index, options) {
8631
8643
  universalAstLayerCount: universalAstLayers.total,
8632
8644
  universalAstLayerNames: universalAstLayers.names,
8633
8645
  universalAstLayerIds: universalAstLayers.ids,
8646
+ proofSpec,
8647
+ paradigmSemantics,
8634
8648
  readiness: imported?.metadata?.semanticMergeReadiness ?? imported?.mergeCandidates?.[0]?.readiness ?? 'needs-review',
8635
8649
  emptySemanticIndex: symbols.length === 0,
8636
8650
  regionTaxonomy,
@@ -8639,6 +8653,235 @@ function semanticImportSidecarEntry(imported, index, options) {
8639
8653
  };
8640
8654
  }
8641
8655
 
8656
+ function summarizeSemanticImportSidecarProofSpec(importEntries) {
8657
+ const byStatus = {};
8658
+ const byContractKind = {};
8659
+ const byArtifactKind = {};
8660
+ const ids = [];
8661
+ const contractKinds = [];
8662
+ const artifactKinds = [];
8663
+ const totals = {
8664
+ total: 0,
8665
+ contracts: 0,
8666
+ refinements: 0,
8667
+ invariants: 0,
8668
+ termination: 0,
8669
+ temporal: 0,
8670
+ obligations: 0,
8671
+ artifacts: 0,
8672
+ assumptions: 0,
8673
+ evidence: 0,
8674
+ discharged: 0,
8675
+ failed: 0,
8676
+ open: 0,
8677
+ unknown: 0,
8678
+ stale: 0,
8679
+ assumed: 0
8680
+ };
8681
+ for (const entry of importEntries) {
8682
+ const proof = entry.proofSpec ?? summarizeProofSpecLayer();
8683
+ ids.push(...(proof.ids ?? []));
8684
+ contractKinds.push(...(proof.contractKinds ?? []));
8685
+ artifactKinds.push(...(proof.artifactKinds ?? []));
8686
+ for (const key of Object.keys(totals)) {
8687
+ totals[key] += proof[key] ?? 0;
8688
+ }
8689
+ for (const [status, count] of Object.entries(proof.byStatus ?? {})) {
8690
+ byStatus[status] = (byStatus[status] ?? 0) + count;
8691
+ }
8692
+ for (const [kind, count] of Object.entries(proof.byContractKind ?? {})) {
8693
+ byContractKind[kind] = (byContractKind[kind] ?? 0) + count;
8694
+ }
8695
+ for (const [kind, count] of Object.entries(proof.byArtifactKind ?? {})) {
8696
+ byArtifactKind[kind] = (byArtifactKind[kind] ?? 0) + count;
8697
+ }
8698
+ }
8699
+ return {
8700
+ ...totals,
8701
+ ids: uniqueStrings(ids),
8702
+ contractKinds: uniqueStrings(contractKinds),
8703
+ artifactKinds: uniqueStrings(artifactKinds),
8704
+ byStatus,
8705
+ byContractKind,
8706
+ byArtifactKind,
8707
+ empty: totals.total === 0
8708
+ };
8709
+ }
8710
+
8711
+ const ParadigmSemanticSummaryGroups = Object.freeze([
8712
+ 'bindingScopes',
8713
+ 'bindings',
8714
+ 'patterns',
8715
+ 'typeConstraints',
8716
+ 'evaluationModels',
8717
+ 'memoryLocations',
8718
+ 'effectRegions',
8719
+ 'controlRegions',
8720
+ 'logicPrograms',
8721
+ 'actorSystems',
8722
+ 'stackEffects',
8723
+ 'arrayShapes',
8724
+ 'numericKernels',
8725
+ 'dataflowNetworks',
8726
+ 'clockModels',
8727
+ 'objectModels',
8728
+ 'macroExpansions',
8729
+ 'reflectionBoundaries',
8730
+ 'loweringRecords'
8731
+ ]);
8732
+
8733
+ function summarizeSemanticImportSidecarParadigmSemantics(importEntries) {
8734
+ const totals = emptyParadigmSemanticsSummary();
8735
+ const ids = [];
8736
+ const kinds = [];
8737
+ const byGroup = {};
8738
+ const byKind = {};
8739
+ for (const entry of importEntries) {
8740
+ const summary = entry.paradigmSemantics ?? summarizeParadigmSemanticsLayer();
8741
+ ids.push(...(summary.ids ?? []));
8742
+ kinds.push(...(summary.kinds ?? []));
8743
+ totals.total += summary.total ?? 0;
8744
+ totals.evidence += summary.evidence ?? 0;
8745
+ for (const group of ParadigmSemanticSummaryGroups) {
8746
+ totals[group] += summary[group] ?? 0;
8747
+ }
8748
+ for (const [group, count] of Object.entries(summary.byGroup ?? {})) {
8749
+ byGroup[group] = (byGroup[group] ?? 0) + count;
8750
+ }
8751
+ for (const [kind, count] of Object.entries(summary.byKind ?? {})) {
8752
+ byKind[kind] = (byKind[kind] ?? 0) + count;
8753
+ }
8754
+ }
8755
+ return {
8756
+ ...totals,
8757
+ ids: uniqueStrings(ids),
8758
+ groups: uniqueStrings(Object.keys(byGroup).filter((group) => byGroup[group] > 0)),
8759
+ kinds: uniqueStrings(kinds),
8760
+ byGroup,
8761
+ byKind,
8762
+ hasRuntimeSemantics: hasAnyParadigmCount(totals, ['evaluationModels', 'memoryLocations', 'effectRegions', 'controlRegions', 'actorSystems', 'clockModels']),
8763
+ hasLogicSemantics: totals.logicPrograms > 0,
8764
+ hasStackSemantics: totals.stackEffects > 0,
8765
+ hasArraySemantics: totals.arrayShapes > 0 || totals.numericKernels > 0,
8766
+ hasMacroOrReflection: totals.macroExpansions > 0 || totals.reflectionBoundaries > 0,
8767
+ hasLowering: totals.loweringRecords > 0,
8768
+ empty: totals.total === 0
8769
+ };
8770
+ }
8771
+
8772
+ function summarizeParadigmSemanticsLayer(paradigmSemantics = {}) {
8773
+ const totals = emptyParadigmSemanticsSummary();
8774
+ const ids = [];
8775
+ const kinds = [];
8776
+ const byGroup = {};
8777
+ const byKind = {};
8778
+ ids.push(paradigmSemantics?.id);
8779
+ for (const group of ParadigmSemanticSummaryGroups) {
8780
+ const records = paradigmSemantics?.[group] ?? [];
8781
+ totals[group] = records.length;
8782
+ totals.total += records.length;
8783
+ if (records.length > 0) {
8784
+ byGroup[group] = records.length;
8785
+ }
8786
+ for (const record of records) {
8787
+ ids.push(record?.id);
8788
+ if (record?.kind) {
8789
+ kinds.push(record.kind);
8790
+ byKind[record.kind] = (byKind[record.kind] ?? 0) + 1;
8791
+ }
8792
+ }
8793
+ }
8794
+ totals.evidence = (paradigmSemantics?.evidence ?? []).length;
8795
+ ids.push(...(paradigmSemantics?.evidence ?? []).map((record) => record?.id));
8796
+ return {
8797
+ ...totals,
8798
+ ids: uniqueStrings(ids.filter(Boolean)),
8799
+ groups: uniqueStrings(Object.keys(byGroup)),
8800
+ kinds: uniqueStrings(kinds),
8801
+ byGroup,
8802
+ byKind,
8803
+ hasRuntimeSemantics: hasAnyParadigmCount(totals, ['evaluationModels', 'memoryLocations', 'effectRegions', 'controlRegions', 'actorSystems', 'clockModels']),
8804
+ hasLogicSemantics: totals.logicPrograms > 0,
8805
+ hasStackSemantics: totals.stackEffects > 0,
8806
+ hasArraySemantics: totals.arrayShapes > 0 || totals.numericKernels > 0,
8807
+ hasMacroOrReflection: totals.macroExpansions > 0 || totals.reflectionBoundaries > 0,
8808
+ hasLowering: totals.loweringRecords > 0,
8809
+ empty: totals.total === 0
8810
+ };
8811
+ }
8812
+
8813
+ function emptyParadigmSemanticsSummary() {
8814
+ return {
8815
+ total: 0,
8816
+ evidence: 0,
8817
+ ...Object.fromEntries(ParadigmSemanticSummaryGroups.map((group) => [group, 0]))
8818
+ };
8819
+ }
8820
+
8821
+ function hasAnyParadigmCount(summary, groups) {
8822
+ return groups.some((group) => (summary[group] ?? 0) > 0);
8823
+ }
8824
+
8825
+ function summarizeProofSpecLayer(proof = {}) {
8826
+ const contracts = proof?.contracts ?? [];
8827
+ const refinements = proof?.refinements ?? [];
8828
+ const invariants = proof?.invariants ?? [];
8829
+ const termination = proof?.termination ?? [];
8830
+ const temporal = proof?.temporal ?? [];
8831
+ const obligations = proof?.obligations ?? [];
8832
+ const artifacts = proof?.artifacts ?? [];
8833
+ const assumptions = proof?.assumptions ?? [];
8834
+ const evidence = proof?.evidence ?? [];
8835
+ const allContracts = [...contracts, ...refinements, ...invariants, ...termination, ...temporal];
8836
+ const byStatus = {};
8837
+ for (const obligation of obligations) {
8838
+ const status = obligation?.status ?? 'unknown';
8839
+ byStatus[status] = (byStatus[status] ?? 0) + 1;
8840
+ }
8841
+ const byContractKind = {};
8842
+ for (const contract of allContracts) {
8843
+ const kind = contract?.kind ?? 'unknown';
8844
+ byContractKind[kind] = (byContractKind[kind] ?? 0) + 1;
8845
+ }
8846
+ const byArtifactKind = {};
8847
+ for (const artifact of artifacts) {
8848
+ const kind = artifact?.kind ?? 'unknown';
8849
+ byArtifactKind[kind] = (byArtifactKind[kind] ?? 0) + 1;
8850
+ }
8851
+ const recordGroups = [allContracts, obligations, artifacts, assumptions];
8852
+ const ids = uniqueStrings([
8853
+ proof?.id,
8854
+ ...recordGroups.flatMap((records) => records.map((record) => record?.id)),
8855
+ ...evidence.map((record) => record?.id)
8856
+ ].filter(Boolean));
8857
+ const total = allContracts.length + obligations.length + artifacts.length + assumptions.length;
8858
+ return {
8859
+ total,
8860
+ ids,
8861
+ contracts: contracts.length,
8862
+ refinements: refinements.length,
8863
+ invariants: invariants.length,
8864
+ termination: termination.length,
8865
+ temporal: temporal.length,
8866
+ obligations: obligations.length,
8867
+ artifacts: artifacts.length,
8868
+ assumptions: assumptions.length,
8869
+ evidence: evidence.length,
8870
+ discharged: byStatus.discharged ?? 0,
8871
+ failed: byStatus.failed ?? 0,
8872
+ open: byStatus.open ?? 0,
8873
+ unknown: byStatus.unknown ?? 0,
8874
+ stale: byStatus.stale ?? 0,
8875
+ assumed: byStatus.assumed ?? 0,
8876
+ contractKinds: uniqueStrings(allContracts.map((record) => record?.kind).filter(Boolean)),
8877
+ artifactKinds: uniqueStrings(artifacts.map((record) => record?.kind).filter(Boolean)),
8878
+ byStatus,
8879
+ byContractKind,
8880
+ byArtifactKind,
8881
+ empty: total === 0
8882
+ };
8883
+ }
8884
+
8642
8885
  function summarizeSemanticImportSidecarUniversalAstLayers(importEntries) {
8643
8886
  const names = [];
8644
8887
  const ids = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshift-labs/frontier-lang-compiler",
3
- "version": "0.2.36",
3
+ "version": "0.2.38",
4
4
  "description": "Compiler facade for Frontier Lang source documents and language projection adapters.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -59,7 +59,7 @@
59
59
  "@shapeshift-labs/frontier-lang-c": "0.2.5",
60
60
  "@shapeshift-labs/frontier-lang-checker": "0.3.4",
61
61
  "@shapeshift-labs/frontier-lang-javascript": "0.2.5",
62
- "@shapeshift-labs/frontier-lang-kernel": "0.3.6",
62
+ "@shapeshift-labs/frontier-lang-kernel": "0.3.8",
63
63
  "@shapeshift-labs/frontier-lang-parser": "0.3.4",
64
64
  "@shapeshift-labs/frontier-lang-python": "0.2.5",
65
65
  "@shapeshift-labs/frontier-lang-rust": "0.2.5",