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

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,7 @@ 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
200
201
  ```
201
202
 
202
203
  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,7 @@ export interface SemanticImportSidecarImportEntry {
968
968
  readonly universalAstLayerCount: number;
969
969
  readonly universalAstLayerNames: readonly string[];
970
970
  readonly universalAstLayerIds: readonly string[];
971
+ readonly proofSpec: SemanticImportSidecarProofSpecSummary;
971
972
  readonly readiness: SemanticMergeReadiness;
972
973
  readonly emptySemanticIndex: boolean;
973
974
  readonly regionTaxonomy?: SemanticImportRegionTaxonomySummary;
@@ -999,6 +1000,32 @@ export interface SemanticImportSidecarUniversalAstLayerSummary {
999
1000
  readonly empty: boolean;
1000
1001
  }
1001
1002
 
1003
+ export interface SemanticImportSidecarProofSpecSummary {
1004
+ readonly total: number;
1005
+ readonly ids: readonly string[];
1006
+ readonly contracts: number;
1007
+ readonly refinements: number;
1008
+ readonly invariants: number;
1009
+ readonly termination: number;
1010
+ readonly temporal: number;
1011
+ readonly obligations: number;
1012
+ readonly artifacts: number;
1013
+ readonly assumptions: number;
1014
+ readonly evidence: number;
1015
+ readonly discharged: number;
1016
+ readonly failed: number;
1017
+ readonly open: number;
1018
+ readonly unknown: number;
1019
+ readonly stale: number;
1020
+ readonly assumed: number;
1021
+ readonly contractKinds: readonly string[];
1022
+ readonly artifactKinds: readonly string[];
1023
+ readonly byStatus: Readonly<Record<string, number>>;
1024
+ readonly byContractKind: Readonly<Record<string, number>>;
1025
+ readonly byArtifactKind: Readonly<Record<string, number>>;
1026
+ readonly empty: boolean;
1027
+ }
1028
+
1002
1029
  export interface SemanticImportSidecar {
1003
1030
  readonly kind: 'frontier.lang.semanticImportSidecar';
1004
1031
  readonly version: 1;
@@ -1028,6 +1055,7 @@ export interface SemanticImportSidecar {
1028
1055
  readonly records: readonly SemanticImportSidecarSourcePreservationRecord[];
1029
1056
  };
1030
1057
  readonly universalAstLayers: SemanticImportSidecarUniversalAstLayerSummary;
1058
+ readonly proofSpec: SemanticImportSidecarProofSpecSummary;
1031
1059
  readonly patchHints: readonly SemanticImportPatchHint[];
1032
1060
  readonly mergeCandidates: readonly {
1033
1061
  readonly id?: string;
@@ -1059,6 +1087,9 @@ export interface SemanticImportSidecar {
1059
1087
  readonly sourcePreservationRecords: number;
1060
1088
  readonly universalAstLayers: number;
1061
1089
  readonly universalAstLayerNames: readonly string[];
1090
+ readonly proofSpecRecords: number;
1091
+ readonly proofSpecObligations: number;
1092
+ readonly proofSpecFailedObligations: number;
1062
1093
  readonly readiness: SemanticMergeReadiness;
1063
1094
  readonly emptySemanticIndex: boolean;
1064
1095
  };
package/dist/index.js CHANGED
@@ -2566,6 +2566,7 @@ 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);
2569
2570
  const readiness = mergeCandidates.reduce(
2570
2571
  (current, candidate) => maxSemanticMergeReadiness(current, candidate.readiness),
2571
2572
  lossSummary.semanticMergeReadiness
@@ -2588,6 +2589,7 @@ export function createSemanticImportSidecar(importResult, options = {}) {
2588
2589
  },
2589
2590
  sourcePreservation,
2590
2591
  universalAstLayers,
2592
+ proofSpec,
2591
2593
  patchHints,
2592
2594
  mergeCandidates: mergeCandidates.map((candidate) => ({
2593
2595
  id: candidate.id,
@@ -2619,6 +2621,9 @@ export function createSemanticImportSidecar(importResult, options = {}) {
2619
2621
  sourcePreservationRecords: sourcePreservation.total,
2620
2622
  universalAstLayers: universalAstLayers.total,
2621
2623
  universalAstLayerNames: universalAstLayers.names,
2624
+ proofSpecRecords: proofSpec.total,
2625
+ proofSpecObligations: proofSpec.obligations,
2626
+ proofSpecFailedObligations: proofSpec.failed,
2622
2627
  readiness,
2623
2628
  emptySemanticIndex: symbols.length === 0
2624
2629
  },
@@ -8582,6 +8587,7 @@ function semanticImportSidecarEntry(imported, index, options) {
8582
8587
  const sourceMapMappings = sourceMaps.flatMap((sourceMap) => sourceMap?.mappings ?? []);
8583
8588
  const sourcePreservationRecords = collectKernelSourcePreservationFromImport(imported);
8584
8589
  const universalAstLayers = summarizeUniversalAstLayers(imported?.universalAst);
8590
+ const proofSpec = summarizeProofSpecLayer(imported?.universalAst?.proof ?? imported?.proof);
8585
8591
  const mappingsBySymbolId = new Map();
8586
8592
  for (const mapping of sourceMapMappings) {
8587
8593
  if (mapping.semanticSymbolId && !mappingsBySymbolId.has(mapping.semanticSymbolId)) {
@@ -8631,6 +8637,7 @@ function semanticImportSidecarEntry(imported, index, options) {
8631
8637
  universalAstLayerCount: universalAstLayers.total,
8632
8638
  universalAstLayerNames: universalAstLayers.names,
8633
8639
  universalAstLayerIds: universalAstLayers.ids,
8640
+ proofSpec,
8634
8641
  readiness: imported?.metadata?.semanticMergeReadiness ?? imported?.mergeCandidates?.[0]?.readiness ?? 'needs-review',
8635
8642
  emptySemanticIndex: symbols.length === 0,
8636
8643
  regionTaxonomy,
@@ -8639,6 +8646,121 @@ function semanticImportSidecarEntry(imported, index, options) {
8639
8646
  };
8640
8647
  }
8641
8648
 
8649
+ function summarizeSemanticImportSidecarProofSpec(importEntries) {
8650
+ const byStatus = {};
8651
+ const byContractKind = {};
8652
+ const byArtifactKind = {};
8653
+ const ids = [];
8654
+ const contractKinds = [];
8655
+ const artifactKinds = [];
8656
+ const totals = {
8657
+ total: 0,
8658
+ contracts: 0,
8659
+ refinements: 0,
8660
+ invariants: 0,
8661
+ termination: 0,
8662
+ temporal: 0,
8663
+ obligations: 0,
8664
+ artifacts: 0,
8665
+ assumptions: 0,
8666
+ evidence: 0,
8667
+ discharged: 0,
8668
+ failed: 0,
8669
+ open: 0,
8670
+ unknown: 0,
8671
+ stale: 0,
8672
+ assumed: 0
8673
+ };
8674
+ for (const entry of importEntries) {
8675
+ const proof = entry.proofSpec ?? summarizeProofSpecLayer();
8676
+ ids.push(...(proof.ids ?? []));
8677
+ contractKinds.push(...(proof.contractKinds ?? []));
8678
+ artifactKinds.push(...(proof.artifactKinds ?? []));
8679
+ for (const key of Object.keys(totals)) {
8680
+ totals[key] += proof[key] ?? 0;
8681
+ }
8682
+ for (const [status, count] of Object.entries(proof.byStatus ?? {})) {
8683
+ byStatus[status] = (byStatus[status] ?? 0) + count;
8684
+ }
8685
+ for (const [kind, count] of Object.entries(proof.byContractKind ?? {})) {
8686
+ byContractKind[kind] = (byContractKind[kind] ?? 0) + count;
8687
+ }
8688
+ for (const [kind, count] of Object.entries(proof.byArtifactKind ?? {})) {
8689
+ byArtifactKind[kind] = (byArtifactKind[kind] ?? 0) + count;
8690
+ }
8691
+ }
8692
+ return {
8693
+ ...totals,
8694
+ ids: uniqueStrings(ids),
8695
+ contractKinds: uniqueStrings(contractKinds),
8696
+ artifactKinds: uniqueStrings(artifactKinds),
8697
+ byStatus,
8698
+ byContractKind,
8699
+ byArtifactKind,
8700
+ empty: totals.total === 0
8701
+ };
8702
+ }
8703
+
8704
+ function summarizeProofSpecLayer(proof = {}) {
8705
+ const contracts = proof?.contracts ?? [];
8706
+ const refinements = proof?.refinements ?? [];
8707
+ const invariants = proof?.invariants ?? [];
8708
+ const termination = proof?.termination ?? [];
8709
+ const temporal = proof?.temporal ?? [];
8710
+ const obligations = proof?.obligations ?? [];
8711
+ const artifacts = proof?.artifacts ?? [];
8712
+ const assumptions = proof?.assumptions ?? [];
8713
+ const evidence = proof?.evidence ?? [];
8714
+ const allContracts = [...contracts, ...refinements, ...invariants, ...termination, ...temporal];
8715
+ const byStatus = {};
8716
+ for (const obligation of obligations) {
8717
+ const status = obligation?.status ?? 'unknown';
8718
+ byStatus[status] = (byStatus[status] ?? 0) + 1;
8719
+ }
8720
+ const byContractKind = {};
8721
+ for (const contract of allContracts) {
8722
+ const kind = contract?.kind ?? 'unknown';
8723
+ byContractKind[kind] = (byContractKind[kind] ?? 0) + 1;
8724
+ }
8725
+ const byArtifactKind = {};
8726
+ for (const artifact of artifacts) {
8727
+ const kind = artifact?.kind ?? 'unknown';
8728
+ byArtifactKind[kind] = (byArtifactKind[kind] ?? 0) + 1;
8729
+ }
8730
+ const recordGroups = [allContracts, obligations, artifacts, assumptions];
8731
+ const ids = uniqueStrings([
8732
+ proof?.id,
8733
+ ...recordGroups.flatMap((records) => records.map((record) => record?.id)),
8734
+ ...evidence.map((record) => record?.id)
8735
+ ].filter(Boolean));
8736
+ const total = allContracts.length + obligations.length + artifacts.length + assumptions.length;
8737
+ return {
8738
+ total,
8739
+ ids,
8740
+ contracts: contracts.length,
8741
+ refinements: refinements.length,
8742
+ invariants: invariants.length,
8743
+ termination: termination.length,
8744
+ temporal: temporal.length,
8745
+ obligations: obligations.length,
8746
+ artifacts: artifacts.length,
8747
+ assumptions: assumptions.length,
8748
+ evidence: evidence.length,
8749
+ discharged: byStatus.discharged ?? 0,
8750
+ failed: byStatus.failed ?? 0,
8751
+ open: byStatus.open ?? 0,
8752
+ unknown: byStatus.unknown ?? 0,
8753
+ stale: byStatus.stale ?? 0,
8754
+ assumed: byStatus.assumed ?? 0,
8755
+ contractKinds: uniqueStrings(allContracts.map((record) => record?.kind).filter(Boolean)),
8756
+ artifactKinds: uniqueStrings(artifacts.map((record) => record?.kind).filter(Boolean)),
8757
+ byStatus,
8758
+ byContractKind,
8759
+ byArtifactKind,
8760
+ empty: total === 0
8761
+ };
8762
+ }
8763
+
8642
8764
  function summarizeSemanticImportSidecarUniversalAstLayers(importEntries) {
8643
8765
  const names = [];
8644
8766
  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.37",
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.7",
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",