lawspec 0.25.0 → 0.27.0

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.
Files changed (156) hide show
  1. package/CHANGELOG.md +109 -1
  2. package/NORMALIZATION-LICENSES.txt +296 -0
  3. package/README.md +13 -4
  4. package/api.mjs +0 -8
  5. package/bin/lawspec.mjs +114 -79
  6. package/build.json +99 -117
  7. package/core.wasm +2 -2
  8. package/core_jsffi.js +5 -0
  9. package/doctor.mjs +14 -4
  10. package/examples/native-payments/clojure/lawspec.json +1 -1
  11. package/examples/native-payments/csharp/lawspec.json +1 -1
  12. package/examples/native-payments/elixir/lawspec.json +1 -1
  13. package/examples/native-payments/erlang/lawspec.json +1 -1
  14. package/examples/native-payments/fsharp/lawspec.json +1 -1
  15. package/examples/native-payments/gleam/lawspec.json +1 -1
  16. package/examples/native-payments/go/lawspec.json +1 -1
  17. package/examples/native-payments/groovy/lawspec.json +1 -1
  18. package/examples/native-payments/haskell/lawspec.json +1 -1
  19. package/examples/native-payments/java/lawspec.json +1 -1
  20. package/examples/native-payments/javascript/lawspec.json +1 -1
  21. package/examples/native-payments/kotlin/lawspec.json +1 -1
  22. package/examples/native-payments/prolog/lawspec.json +20 -0
  23. package/examples/native-payments/prolog/src/domain/payments.pl +23 -0
  24. package/examples/native-payments/prolog/tests/domain/payment_generators.pl +17 -0
  25. package/examples/native-payments/python/lawspec.json +1 -1
  26. package/examples/native-payments/rust/lawspec.json +1 -1
  27. package/examples/native-payments/scala/lawspec.json +1 -1
  28. package/examples/native-payments/swift/lawspec.json +1 -1
  29. package/examples/native-payments/typescript/lawspec.json +1 -1
  30. package/examples/packages/orders/lawspec.json +1 -1
  31. package/examples/packages/orders/orders.lawspec +27 -25
  32. package/examples/packages/shop-domain/src/domain.lawspec +15 -14
  33. package/examples/packages/shop-tax-1/src/api.lawspec +1 -0
  34. package/examples/packages/shop-tax-1/src/rates.lawspec +1 -0
  35. package/examples/packages/shop-tax-2/src/api.lawspec +1 -0
  36. package/examples/packages/shop-tax-2/src/rates.lawspec +1 -0
  37. package/examples/rc1/authorization-snapshots.lawspec +24 -23
  38. package/examples/rc1/banner-filenames.lawspec +7 -6
  39. package/examples/rc1/bit-codec.lawspec +12 -11
  40. package/examples/rc1/bounded-witness-search.lawspec +52 -45
  41. package/examples/rc1/conflicting-requirements.lawspec +8 -7
  42. package/examples/rc1/constructive-witnesses.lawspec +40 -33
  43. package/examples/rc1/documentary-review.lawspec +9 -8
  44. package/examples/rc1/empty-domains.lawspec +16 -15
  45. package/examples/rc1/finite-integer-domains.lawspec +24 -23
  46. package/examples/rc1/law-metadata.lawspec +6 -5
  47. package/examples/rc1/native-payments.lawspec +17 -16
  48. package/examples/rc1/nesting/rrr.lawspec +4 -3
  49. package/examples/rc1/nesting/rru.lawspec +7 -6
  50. package/examples/rc1/nesting/rur.lawspec +7 -6
  51. package/examples/rc1/nesting/ruu.lawspec +10 -9
  52. package/examples/rc1/nesting/urr.lawspec +7 -6
  53. package/examples/rc1/nesting/uru.lawspec +10 -9
  54. package/examples/rc1/nesting/uur.lawspec +10 -9
  55. package/examples/rc1/nesting/uuu.lawspec +13 -12
  56. package/examples/rc1/order-workflow.lawspec +18 -17
  57. package/examples/rc1/parcel-measurements.lawspec +14 -13
  58. package/examples/rc1/picture-records.lawspec +6 -5
  59. package/examples/rc1/picture-tuples.lawspec +6 -5
  60. package/examples/rc1/record-payloads.lawspec +12 -11
  61. package/examples/rc1/recursive-records.lawspec +11 -10
  62. package/examples/rc1/refund-conformance.lawspec +7 -6
  63. package/examples/rc1/refund-policy.lawspec +15 -14
  64. package/examples/rc1/requirement-composition.lawspec +26 -25
  65. package/examples/rc1/structural-records.lawspec +13 -12
  66. package/examples/rc1-authoring.lawspec +6 -5
  67. package/examples/specs/abilities.lawspec +67 -65
  68. package/examples/specs/ability_imports.lawspec +58 -57
  69. package/examples/specs/actors.lawspec +23 -22
  70. package/examples/specs/algebra.lawspec +142 -141
  71. package/examples/specs/approvals.lawspec +19 -18
  72. package/examples/specs/async_bindings.lawspec +10 -9
  73. package/examples/specs/async_fetch.lawspec +12 -11
  74. package/examples/specs/atoi_codec.lawspec +16 -15
  75. package/examples/specs/boolean_flags.lawspec +10 -9
  76. package/examples/specs/builtins.lawspec +73 -72
  77. package/examples/specs/canonical_url.lawspec +14 -13
  78. package/examples/specs/collections.lawspec +153 -154
  79. package/examples/specs/composition.lawspec +70 -66
  80. package/examples/specs/concurrent_collections.lawspec +8 -7
  81. package/examples/specs/consistency.lawspec +4 -3
  82. package/examples/specs/contracts.lawspec +80 -79
  83. package/examples/specs/crypto.lawspec +26 -25
  84. package/examples/specs/ctc.lawspec +148 -0
  85. package/examples/specs/currying.lawspec +32 -31
  86. package/examples/specs/data_types.lawspec +50 -49
  87. package/examples/specs/distribution.lawspec +57 -56
  88. package/examples/specs/domain_modeling.lawspec +68 -47
  89. package/examples/specs/durations.lawspec +39 -38
  90. package/examples/specs/equivalent.lawspec +25 -24
  91. package/examples/specs/failures.lawspec +64 -63
  92. package/examples/specs/finite_data.lawspec +32 -31
  93. package/examples/specs/flow_stack.lawspec +64 -63
  94. package/examples/specs/gadt_expressions.lawspec +50 -49
  95. package/examples/specs/generation.lawspec +115 -114
  96. package/examples/specs/handler_bindings.lawspec +42 -40
  97. package/examples/specs/handles.lawspec +2 -1
  98. package/examples/specs/harness.lawspec +45 -43
  99. package/examples/specs/harness_testing.lawspec +18 -13
  100. package/examples/specs/indexed_arithmetic.lawspec +401 -126
  101. package/examples/specs/indexed_families.lawspec +182 -66
  102. package/examples/specs/keywords.lawspec +22 -21
  103. package/examples/specs/limits.lawspec +7 -6
  104. package/examples/specs/list_contracts.lawspec +121 -120
  105. package/examples/specs/list_refinements.lawspec +43 -42
  106. package/examples/specs/lists.lawspec +45 -44
  107. package/examples/specs/matchers.lawspec +79 -78
  108. package/examples/specs/matching.lawspec +43 -42
  109. package/examples/specs/mixed_inputs.lawspec +25 -24
  110. package/examples/specs/models.lawspec +44 -43
  111. package/examples/specs/parse_port.lawspec +28 -27
  112. package/examples/specs/payments.lawspec +55 -54
  113. package/examples/specs/railway.lawspec +59 -58
  114. package/examples/specs/records.lawspec +149 -148
  115. package/examples/specs/records_inner.lawspec +5 -4
  116. package/examples/specs/recursive_refinements.lawspec +30 -29
  117. package/examples/specs/refined_definitions.lawspec +24 -23
  118. package/examples/specs/refinements.lawspec +58 -57
  119. package/examples/specs/resilience.lawspec +161 -160
  120. package/examples/specs/resources.lawspec +61 -60
  121. package/examples/specs/scalar_adapters.lawspec +60 -59
  122. package/examples/specs/scalar_catalog.lawspec +165 -164
  123. package/examples/specs/scalars.lawspec +78 -77
  124. package/examples/specs/scheduling_order.lawspec +8 -7
  125. package/examples/specs/scheduling_overlap.lawspec +5 -4
  126. package/examples/specs/sequences.lawspec +66 -65
  127. package/examples/specs/sessions.lawspec +13 -12
  128. package/examples/specs/slug.lawspec +16 -15
  129. package/examples/specs/sum_refinements.lawspec +42 -41
  130. package/examples/specs/tables.lawspec +29 -28
  131. package/examples/specs/total_functions.lawspec +71 -70
  132. package/examples/specs/workflows.lawspec +101 -100
  133. package/examples-command.mjs +7 -7
  134. package/explain.mjs +6 -4
  135. package/expression-presentation.mjs +8 -8
  136. package/files.mjs +1 -1
  137. package/index.d.ts +10 -528
  138. package/launcher.mjs +9 -2
  139. package/lsp.mjs +10 -6
  140. package/native-evidence.mjs +25 -12
  141. package/native-examples.mjs +3 -3
  142. package/package.json +2 -1
  143. package/starter-rc1.lawspec +6 -5
  144. package/starter.lawspec +16 -15
  145. package/templates.mjs +88 -5
  146. package/test-command.mjs +40 -4
  147. package/migrate.mjs +0 -135
  148. package/migration-bindings.mjs +0 -86
  149. package/migration-cases.mjs +0 -45
  150. package/migration-collections.mjs +0 -54
  151. package/migration-correspondence.mjs +0 -275
  152. package/migration-generation.mjs +0 -99
  153. package/migration-laws.mjs +0 -102
  154. package/migration-records.mjs +0 -166
  155. package/migration-source.mjs +0 -247
  156. package/migration-write.mjs +0 -156
@@ -134,7 +134,7 @@ export function createExpressionPresentation(result, { constructors, typeName, s
134
134
  bindings.set(label, name);
135
135
  return `let ${name} = ${value.text} in `;
136
136
  });
137
- return resultText(lets.join('') + `(${positions.map(field => bindings.get(field.name)).join(', ')})`);
137
+ return resultText(lets.join('') + `(${positions.map(field => bindings.get(field.name)).join(', ')})` + ' end let'.repeat(lets.length));
138
138
  }
139
139
  if (entry.declaration.structure?.kind === 'record')
140
140
  return resultText(`record{${entries.map(([label, value]) => `${label} = ${value.text}`).join(', ')}}`, true);
@@ -243,7 +243,7 @@ export function createExpressionPresentation(result, { constructors, typeName, s
243
243
  const record = literal(expression, scope, reserved);
244
244
  if (record) return record;
245
245
  const bound = bind(node.binder, scope, reserved);
246
- return resultText(`let ${bound.name} = ${go(node.value).text} in ${go(node.body, bound.scope).text}`);
246
+ return resultText(`let ${bound.name} = ${go(node.value).text} in ${go(node.body, bound.scope).text} end let`);
247
247
  }
248
248
  case 'field': {
249
249
  const entry = constructors.get(node.constructor), field = entry?.constructor.fields[node.index];
@@ -258,7 +258,7 @@ export function createExpressionPresentation(result, { constructors, typeName, s
258
258
  const used = new Set(reserved), replacement = freshComponent('replacement', scope, used);
259
259
  const names = positions.map((_, i) => freshComponent(`component${i + 1}`, scope, used));
260
260
  const result = positions.map((position, i) => position.name === field.name ? replacement : names[i]);
261
- return resultText(`let ${replacement} = ${go(node.field).text} in first matching case of ${go(node.value).text}: when (${names.join(', ')}) then (${result.join(', ')}) end case`);
261
+ return resultText(`let ${replacement} = ${go(node.field).text} in first matching case of ${go(node.value).text}: when (${names.join(', ')}) then (${result.join(', ')}) end case end let`);
262
262
  }
263
263
  return resultText(`${argument(go(node.value))} with ${field.name} = ${go(node.field).text}`);
264
264
  }
@@ -284,7 +284,7 @@ export function createExpressionPresentation(result, { constructors, typeName, s
284
284
  }
285
285
  case 'if': return resultText(`if ${go(node.condition).text} then ${go(node.then).text} else ${go(node.else).text} end if`);
286
286
  case 'convert': return resultText(`${node.conversion} conversion of (${go(node.argument).text}) to ${typeName(expression.type)}`);
287
- case 'match': return resultText(`case ${argument(go(node.value))} of {${node.cases.map(branch => {
287
+ case 'match': return resultText(`first matching case of ${argument(go(node.value))}: ${node.cases.map(branch => {
288
288
  let bindings = scope;
289
289
  const names = branch.binders.map(binder => {
290
290
  const bound = bind(binder, bindings, reserved);
@@ -297,9 +297,9 @@ export function createExpressionPresentation(result, { constructors, typeName, s
297
297
  const fieldNames = new Map(entry.constructor.fields.map((field, i) => [field.name, names[i]]));
298
298
  const pattern = positions ? `(${positions.map(field => fieldNames.get(field.name)).join(', ')})` : entry.declaration.structure?.kind === 'record'
299
299
  ? `record{${names.map((name, i) => `${entry.constructor.fields[i].name} = ${name}`).join(', ')}}`
300
- : globalName(branch.constructor, scope) + (names.length ? `(${names.join(', ')})` : '');
301
- return `${pattern}: ${go(branch.body, bindings).text}`;
302
- }).join('; ')}}`);
300
+ : globalName(branch.constructor, scope) + (names.length ? ` ${names.join(' ')}` : '');
301
+ return `when ${pattern} then ${go(branch.body, bindings).text}`;
302
+ }).join(' ')} end case`);
303
303
  case 'allElements': {
304
304
  const bound = bind(node.binder, scope, reserved);
305
305
  return resultText(`every ${bound.name} in (${go(node.value).text}) satisfies (${go(node.predicate, bound.scope).text})`);
@@ -311,7 +311,7 @@ export function createExpressionPresentation(result, { constructors, typeName, s
311
311
  case 'perform': return resultText(`perform ${abilityName(node.ability)}.${node.operation}(${node.arguments.map(value => go(value).text).join(', ')})`);
312
312
  case 'handle': {
313
313
  if (node.handling === 'catchFailure') return resultText(`catch failure of ${abilityName(node.ability)} in (${go(node.body).text})`);
314
- if (node.handling === 'withHandler') return resultText(`handle (${go(node.body).text}) with ${node.handler} for ${abilityName(node.ability)}`);
314
+ if (node.handling === 'withHandler') return resultText(`handle (${go(node.body).text}) with ${node.handler} for ${abilityName(node.ability)} end handle`);
315
315
  throw unavailable;
316
316
  }
317
317
  case 'calls': return resultText(`calls of ${abilityName(node.ability)}.${node.operation}${node.arguments === null ? '' : ` with (${node.arguments.map(value => go(value).text).join(', ')})`}`);
package/files.mjs CHANGED
@@ -15,7 +15,7 @@ import path from "node:path";
15
15
  import crypto from "node:crypto";
16
16
  export const digest = (text) =>
17
17
  crypto.createHash("sha256").update(text).digest("hex");
18
- // Keep source discovery identical for CLI checking and migration revalidation.
18
+ // Share source discovery between CLI commands.
19
19
  export async function collectSources(root,entries,relativeTo=root){
20
20
  const files=[];
21
21
  async function visit(file){
package/index.d.ts CHANGED
@@ -16,7 +16,12 @@ export type Target =
16
16
  'scala' |
17
17
  'groovy' |
18
18
  'clojure' |
19
- 'swift';
19
+ 'swift' |
20
+ 'prolog' |
21
+ 'hcl' |
22
+ 'yaml' |
23
+ 'antlr4' |
24
+ 'make';
20
25
 
21
26
  export interface Source {
22
27
  path: string;
@@ -64,34 +69,12 @@ export interface SourceSyntax {
64
69
  references: SourceSyntaxReference[];
65
70
  }
66
71
 
67
- export interface SourceFieldUse {
68
- kind: 'field-access' | 'field-update';
69
- constructor: string;
70
- field: string;
71
- index: number;
72
- span: Span;
73
- base?: Span;
74
- expression?: Span;
75
- }
76
-
77
- export interface SourceConstructorShape {
78
- constructor: string;
79
- nominalRecord: boolean;
80
- }
81
-
82
- export type MigrationSourceFields =
83
- {
84
- status: 'available';
85
- version: 1;
86
- uses: SourceFieldUse[];
87
- constructors: SourceConstructorShape[];
88
- } |
89
- {status: 'unavailable'; reason: string;};
90
-
91
72
  export interface Diagnostic {
92
73
  code: string;
93
74
  message: string;
94
75
  at: Location | null;
76
+ span?: Span;
77
+ related?: {message: string; span: Span;}[];
95
78
  }
96
79
 
97
80
  export interface MatchWarning extends Diagnostic {
@@ -541,9 +524,8 @@ export interface VerificationSelection {
541
524
  }
542
525
 
543
526
  export interface CheckRequest {
544
- languageProfile: '1.0-rc.1';
527
+ languageProfile: '1.0-rc.2';
545
528
  verification?: Verification;
546
- migrationSnapshot?: boolean;
547
529
  warnMatches?: boolean;
548
530
  sources: Source[];
549
531
  schemaVersion?: 5;
@@ -564,487 +546,6 @@ export interface GenerationRequest extends CheckRequest {
564
546
  minify?: boolean;
565
547
  }
566
548
 
567
- export interface MigrationRequest extends CheckRequest {
568
- schemaVersion?: 5;
569
- languageProfile: '1.0-rc.1';
570
- from: '0.24';
571
- }
572
-
573
- export interface MigrationBaselineRequest extends MigrationRequest {
574
- includeGeneration?: boolean;
575
- target?: Target;
576
- sourceDir?: string;
577
- testDir?: string;
578
- minify?: boolean;
579
- }
580
-
581
- export interface MigrationComparisonRequest extends MigrationRequest {
582
- migrated: CheckRequest & {schemaVersion?: 5; languageProfile: '1.0-rc.1'};
583
- }
584
-
585
- export interface MigrationBindingRequest extends MigrationComparisonRequest {
586
- target?: Target;
587
- }
588
-
589
- export interface MigrationGenerationRequest extends MigrationBindingRequest {
590
- target: Target;
591
- sourceDir?: string;
592
- testDir?: string;
593
- minify?: boolean;
594
- migrated: GenerationRequest &
595
- {schemaVersion?: 5; languageProfile: '1.0-rc.1';};
596
- }
597
-
598
- export interface MigrationArtifact {
599
- path: string;
600
- ownership: 'user' | 'generated';
601
- placement: 'source' | 'test';
602
- contentDigest: string;
603
- adapterReferenceDigest?: string;
604
- }
605
-
606
- export type MigrationGenerationSide =
607
- {
608
- status: 'accepted';
609
- artifactDigest: string;
610
- files: MigrationArtifact[];
611
- diagnostics: Diagnostic[];
612
- } |
613
- {status: 'rejected'; diagnostics: Diagnostic[];} |
614
- {status: 'not-established'; reason: string;};
615
-
616
- export type MigrationNativeBoundarySide =
617
- {status: 'available'; contract: Record<string, unknown>; digest: string;} |
618
- {status: 'unavailable'; reason: string;};
619
-
620
- export interface MigrationNativeBoundary {
621
- version: 1;
622
- algorithm: 'sha256';
623
- policy: 'resolved-native-contract-v1';
624
- status: 'matched' | 'not-established';
625
- scope: string;
626
- before: MigrationNativeBoundarySide;
627
- after: MigrationNativeBoundarySide;
628
- nativeConformance: 'not-established';
629
- lawVerification: 'not-established-by-boundary-correspondence';
630
- assumptions: string[];
631
- }
632
-
633
- export type MigrationGenerationReceipt =
634
- {
635
- version: 1;
636
- algorithm: 'sha256';
637
- status: 'accepted' | 'not-established';
638
- scope: string;
639
- target: Target;
640
- machineBits: 32 | 64;
641
- sourceDir: string | null;
642
- testDir: string | null;
643
- minify: boolean;
644
- generation: Generation;
645
- planning: 'legacy-harnesses';
646
- sourceInputs: {before: string; after: string};
647
- bindingProposal: MigrationBindingProposal;
648
- before: MigrationGenerationSide;
649
- after: MigrationGenerationSide;
650
- nativeBoundary: MigrationNativeBoundary;
651
- nativeConformance: 'not-established';
652
- lawVerification: 'not-established-by-generation';
653
- } |
654
- {status: 'unavailable'; reason: string;};
655
-
656
- export interface MigrationPayloadField {
657
- label: string;
658
- fromIndex: number;
659
- toIndex: number;
660
- fromBinder: string;
661
- toBinder: string;
662
- }
663
-
664
- export type MigrationPayloadConstructor =
665
- {constructor: string; kind: 'unchanged';} |
666
- {
667
- constructor: string;
668
- kind: 'single-payload';
669
- fields: MigrationPayloadField[];
670
- } |
671
- {
672
- constructor: string;
673
- kind: 'record-payload';
674
- fields: MigrationPayloadField[];
675
- recordType: string;
676
- recordConstructor: string;
677
- };
678
-
679
- export type MigrationPayloadChange =
680
- {
681
- type: string;
682
- status: 'matched';
683
- constructors: MigrationPayloadConstructor[];
684
- } |
685
- {type: string; status: 'not-established'; reason: string;};
686
-
687
- export interface MigrationPending {
688
- status: 'not-established';
689
- reason: string;
690
- }
691
-
692
- export type MigrationCoreTransport =
693
- MigrationPending |
694
- {
695
- status: 'matched' | 'not-established';
696
- version: 1;
697
- algorithm: 'sha256';
698
- machineBits: 32 | 64;
699
- scope: string;
700
- copyValidated: true;
701
- originalsUnchanged: true;
702
- sourceBeforeDigest: string;
703
- catalogOrdering: string;
704
- assumptions: string[];
705
- indexMeasureBodies?: {
706
- definition: string;
707
- beforeBodyDigest: string;
708
- afterBodyDigest: string;
709
- basis: string;
710
- }[];
711
- program: {
712
- status: 'matched' | 'not-established';
713
- before: string;
714
- after: string;
715
- };
716
- definitionPlane: {
717
- status: 'matched' | 'not-established';
718
- before: string;
719
- after: string;
720
- };
721
- lawBodies: {
722
- status: 'matched' | 'not-established';
723
- before: string;
724
- after: string;
725
- };
726
- domainPolicies: {
727
- status: 'matched' | 'not-established';
728
- before: {comparisonId: string; policy: 'nonempty' | 'universal'}[];
729
- after: {comparisonId: string; policy: 'nonempty' | 'universal'}[];
730
- };
731
- before: MigrationSemanticSnapshot & {status: 'available'};
732
- after: MigrationSemanticSnapshot & {status: 'available'};
733
- };
734
-
735
- export interface MigrationDigestPair {
736
- status: 'matched' | 'not-established';
737
- before: string;
738
- after: string;
739
- }
740
-
741
- export interface MigrationTemplateCertificate {
742
- status: 'matched' | 'not-established';
743
- version: 1;
744
- algorithm: 'sha256';
745
- machineBits: 32 | 64;
746
- scope: string;
747
- before: MigrationTemplateDomainAnchors;
748
- after: MigrationTemplateDomainAnchors;
749
- originalsUnchanged: true;
750
- lawVerification: 'not-established-by-migration-correspondence';
751
- }
752
-
753
- export type MigrationDefinitionTransport =
754
- MigrationPending |
755
- MigrationTemplateCertificate &
756
- {
757
- interfaces: MigrationDigestPair & {scope: string};
758
- typedCore: MigrationCoreTransport;
759
- typeVariables: string;
760
- nativeConformance: 'not-established';
761
- };
762
-
763
- export type MigrationLawTransport =
764
- MigrationPending |
765
- MigrationTemplateCertificate &
766
- {
767
- metadata: MigrationDigestPair;
768
- typedCore: MigrationCoreTransport;
769
- lawBodiesEvaluated: false;
770
- parameterInterpretation: string;
771
- };
772
-
773
- export type MigrationUnitTransport =
774
- MigrationPending |
775
- MigrationTemplateCertificate &
776
- {
777
- metadata: MigrationDigestPair;
778
- definitions: 'matched' | 'not-established';
779
- laws: 'matched' | 'not-established';
780
- payloadShapes: 'matched';
781
- };
782
-
783
- export interface MigrationProgramAnchor {
784
- programDigest: string;
785
- definitionPlaneDigest: string;
786
- lawBodiesDigest: string;
787
- }
788
-
789
- export type MigrationBindingChange =
790
- {
791
- kind: 'single-payload-field';
792
- type: string;
793
- constructor: string;
794
- from: string;
795
- to: string;
796
- native: string;
797
- } |
798
- {
799
- kind: 'grouped-record-payload';
800
- type: string;
801
- constructor: string;
802
- payload: string;
803
- fields: {
804
- field: string;
805
- native: string;
806
- nativeArgumentIndex: number;
807
- payloadPath: string[];
808
- }[];
809
- };
810
-
811
- export type MigrationBindingProposal =
812
- {status: 'unavailable'; reason: string;} |
813
- {
814
- version: 1;
815
- algorithm: 'sha256';
816
- status: 'matched' | 'not-established';
817
- machineBits: 32 | 64;
818
- scope: string;
819
- target: string;
820
- inputBindings: NativeBindings;
821
- originalBindingsDigest: string;
822
- before: MigrationProgramAnchor;
823
- after: MigrationProgramAnchor;
824
- proposedNativeBindings: NativeBindings;
825
- requirements: string[];
826
- changes: MigrationBindingChange[];
827
- beforeValidated: true;
828
- afterValidated: boolean;
829
- proposalComplete: boolean;
830
- originalsUnchanged: true;
831
- sourceTemplates: {
832
- before: MigrationTemplateDomainAnchors;
833
- after: MigrationTemplateDomainAnchors;
834
- };
835
- bindings: {
836
- status: 'matched' | 'not-established';
837
- before: string | null;
838
- after: string | null;
839
- };
840
- obligations: {
841
- status: 'matched' | 'not-established';
842
- before: ObligationEvidence[];
843
- after: ObligationEvidence[] | null;
844
- };
845
- nativeConformance: 'not-established';
846
- targetGeneration: 'not-established';
847
- lawVerification: 'not-established-by-binding-correspondence';
848
- };
849
-
850
- export type MigrationPayloadComparison =
851
- {
852
- version: 1;
853
- algorithm: 'sha256';
854
- status: 'not-established';
855
- machineBits: 32 | 64;
856
- scope: string;
857
- beforeDigest: string;
858
- afterDigest: string;
859
- payloadShapes: {
860
- status: 'matched' | 'not-established';
861
- unchangedTypes: number;
862
- changes: MigrationPayloadChange[];
863
- introducedRecords: string[];
864
- unexplainedAddedTypes: string[];
865
- };
866
- executableTransport: MigrationCoreTransport;
867
- definitionTemplates?: MigrationDefinitionTransport;
868
- lawTemplates?: MigrationLawTransport;
869
- sourceUnits?: MigrationUnitTransport;
870
- dependencyBehavior: MigrationPending;
871
- nativeBindings: MigrationPending;
872
- lawVerification: 'not-established-by-payload-shapes';
873
- validated: false;
874
- } |
875
- {status: 'unavailable'; reason: string;};
876
-
877
- export interface MigrationDomainBinding {
878
- binder: string;
879
- value: DataValue;
880
- }
881
-
882
- export interface MigrationParameterInputCase {
883
- parameters: MigrationDomainBinding[];
884
- witness: MigrationDomainBinding[];
885
- }
886
-
887
- export type MigrationInputDomain =
888
- {
889
- comparisonId: string;
890
- domainDigest: string;
891
- inputCount: number;
892
- search: string;
893
- candidateChecks: number;
894
- searchLimit: number;
895
- finiteLimit: number;
896
- notes: string[];
897
- formalParameterCount?: number;
898
- parameterInterpretation?: string;
899
- status: 'inhabited';
900
- witness: {binder: string; value: DataValue;}[];
901
- uniformity?: 'parameter-independent';
902
- } |
903
- {
904
- comparisonId: string;
905
- domainDigest: string;
906
- inputCount: number;
907
- search: string;
908
- candidateChecks: number;
909
- searchLimit: number;
910
- finiteLimit: number;
911
- notes: string[];
912
- formalParameterCount?: number;
913
- parameterInterpretation?: string;
914
- status: 'empty';
915
- complete: true;
916
- } |
917
- {
918
- comparisonId: string;
919
- domainDigest: string;
920
- inputCount: number;
921
- search: string;
922
- candidateChecks: number;
923
- searchLimit: number;
924
- finiteLimit: number;
925
- notes: string[];
926
- formalParameterCount?: number;
927
- parameterInterpretation?: string;
928
- status: 'uniformly-inhabited';
929
- complete: true;
930
- uniformity: 'complete-finite-parameters';
931
- parameterCases: MigrationParameterInputCase[];
932
- } |
933
- {
934
- comparisonId: string;
935
- domainDigest: string;
936
- inputCount: number;
937
- search: string;
938
- candidateChecks: number;
939
- searchLimit: number;
940
- finiteLimit: number;
941
- notes: string[];
942
- formalParameterCount?: number;
943
- parameterInterpretation?: string;
944
- status: 'empty-parameters';
945
- complete: true;
946
- } |
947
- {
948
- comparisonId: string;
949
- domainDigest: string;
950
- inputCount: number;
951
- search: string;
952
- candidateChecks: number;
953
- searchLimit: number;
954
- finiteLimit: number;
955
- notes: string[];
956
- formalParameterCount?: number;
957
- parameterInterpretation?: string;
958
- status: 'parameter-counterexample';
959
- complete: true;
960
- parameters: MigrationDomainBinding[];
961
- reason: string;
962
- } |
963
- {
964
- comparisonId: string;
965
- domainDigest: string;
966
- inputCount: number;
967
- search: string;
968
- candidateChecks: number;
969
- searchLimit: number;
970
- finiteLimit: number;
971
- notes: string[];
972
- formalParameterCount?: number;
973
- parameterInterpretation?: string;
974
- status: 'incomplete' | 'unsupported';
975
- complete: false;
976
- reason: string;
977
- };
978
-
979
- export type MigrationDomainSnapshot =
980
- {
981
- status: 'available';
982
- version: 1;
983
- algorithm: 'sha256';
984
- machineBits: 32 | 64;
985
- lawBodiesEvaluated: false;
986
- scope: string;
987
- domains: MigrationInputDomain[];
988
- } |
989
- {status: 'unavailable'; reason: string;};
990
-
991
- export interface MigrationTemplateDomainAnchors {
992
- declarationsDigest: string;
993
- definitionTemplatesDigest: string;
994
- lawTemplatesDigest: string;
995
- lawBodiesDigest: string;
996
- }
997
-
998
- export type MigrationTemplateDomainSnapshot =
999
- MigrationDomainSnapshot &
1000
- {status: 'available'; sourceTemplates: MigrationTemplateDomainAnchors;};
1001
-
1002
- export type MigrationTemplateSnapshot =
1003
- {
1004
- status: 'available';
1005
- version: 1;
1006
- algorithm: 'sha256';
1007
- machineBits: 32 | 64;
1008
- scope: string;
1009
- declarationsDigest: string;
1010
- definitionTemplatesDigest: string;
1011
- lawTemplatesDigest: string;
1012
- lawBodiesDigest: string;
1013
- units: {comparisonId: string; digest: string;}[];
1014
- definitions: {comparisonId: string; digest: string;}[];
1015
- laws: {comparisonId: string; digest: string;}[];
1016
- domainPolicies: {
1017
- comparisonId: string;
1018
- policy: 'nonempty' | 'universal';
1019
- formalParameterCount?: number;
1020
- }[];
1021
- inputDomains?: MigrationTemplateDomainSnapshot;
1022
- } |
1023
- {status: 'unavailable'; reason: string;};
1024
-
1025
- export type MigrationSemanticSnapshot =
1026
- {
1027
- status: 'available';
1028
- version: 1;
1029
- algorithm: 'sha256';
1030
- machineBits: 32 | 64;
1031
- scope: string;
1032
- programDigest: string;
1033
- definitionPlaneDigest: string;
1034
- lawBodiesDigest: string;
1035
- sourceTemplates?: MigrationTemplateSnapshot;
1036
- inputDomains?: MigrationDomainSnapshot;
1037
- definitions: {comparisonId: string; digest: string;}[];
1038
- contracts: {comparisonId: string; digest: string;}[];
1039
- dataTypes: {comparisonId: string; digest: string;}[];
1040
- domainPolicies: {
1041
- comparisonId: string;
1042
- policy: 'nonempty' | 'universal';
1043
- formalParameterCount?: number;
1044
- }[];
1045
- } |
1046
- {status: 'unavailable'; reason: string;};
1047
-
1048
549
  export type ProofTask =
1049
550
  {
1050
551
  encoding: 'lawspec-smtlib-v1';
@@ -1211,7 +712,7 @@ export interface NativeTestEntry {
1211
712
  export interface Result {
1212
713
  schemaVersion: 5;
1213
714
  machineBits?: 32 | 64;
1214
- languageProfile?: "1.0-rc.1";
715
+ languageProfile?: "1.0-rc.2";
1215
716
  verification?: VerificationSelection;
1216
717
  generation?: Generation;
1217
718
  units?: Unit[];
@@ -1227,21 +728,6 @@ export interface Result {
1227
728
  files?: Artifact[];
1228
729
  formattedSources?: Source[];
1229
730
  tests?: NativeTestEntry[];
1230
- baselineGeneration?: {
1231
- status: 'generated';
1232
- planning: 'legacy-harnesses';
1233
- execution: 'not-run';
1234
- nativeConformance: 'not-established';
1235
- lawVerification: 'not-established-by-generation';
1236
- };
1237
- sourceLanguageProfile?: '0.24';
1238
- sourceSyntax?: SourceSyntax[];
1239
- sourceFields?: MigrationSourceFields;
1240
- migrationSemantics?: MigrationSemanticSnapshot;
1241
- migrationComparison?: MigrationPayloadComparison;
1242
- migrationBindings?: MigrationBindingProposal;
1243
- migrationGeneration?: MigrationGenerationReceipt;
1244
- migrationComparisonInput?: 'before' | 'migrated';
1245
731
  proofTasks?: ProofTask[];
1246
732
  evidence?: ObligationEvidence[];
1247
733
  attestation?: AttestationView;
@@ -1303,10 +789,6 @@ export interface Compiler {
1303
789
  expand(input: CheckRequest): Promise<Result>;
1304
790
  proofTasks(input: CheckRequest): Promise<Result>;
1305
791
  planGeneration(input: GenerationRequest): Promise<Result>;
1306
- migrationBaseline(input: MigrationBaselineRequest): Promise<Result>;
1307
- migrationComparison(input: MigrationComparisonRequest): Promise<Result>;
1308
- migrationBindings(input: MigrationBindingRequest): Promise<Result>;
1309
- migrationGeneration(input: MigrationGenerationRequest): Promise<Result>;
1310
792
  }
1311
793
 
1312
794
  export function createCompiler(): Promise<Compiler>;
package/launcher.mjs CHANGED
@@ -2,6 +2,12 @@
2
2
  import { readFile } from "node:fs/promises";
3
3
  let compiled;
4
4
 
5
+ // GHC's JSFFI reactor reads these WASI arguments during initialization. Bound
6
+ // the heap below wasm32's address ceiling and compact the oldest generation
7
+ // in place instead of reserving a second copy near that ceiling.
8
+ // -with-rtsopts has no effect on this -no-hs-main reactor build.
9
+ const coreArguments = ["lawspec", "+RTS", "-M3584m", "-c", "-RTS"];
10
+
5
11
  // Instantiate the compiler core with a platform's WASI preview1 imports and
6
12
  // serialize calls: the core handles one JSON request at a time.
7
13
  async function instantiateCore(module, wasiImports, initialize) {
@@ -18,7 +24,8 @@ async function instantiateCore(module, wasiImports, initialize) {
18
24
  const result = pending.then(async () =>
19
25
  JSON.parse(await instance.exports.lawspec_call(JSON.stringify(input))),
20
26
  );
21
- pending = result.catch(() => {});
27
+ // The queue needs completion only, not the previous generated project DTO.
28
+ pending = result.then(() => {}, () => {});
22
29
  return result;
23
30
  };
24
31
  }
@@ -32,7 +39,7 @@ export async function loadCore() {
32
39
  );
33
40
  const wasi = new WASI({
34
41
  version: "preview1",
35
- args: ["lawspec"],
42
+ args: coreArguments,
36
43
  env: { PWD: "/" },
37
44
  preopens: { "/": process.cwd() },
38
45
  });