@githolon/dsl 0.113.4 → 0.115.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 (103) hide show
  1. package/assets/operation-contract.wasm +0 -0
  2. package/compile_package.mjs +23 -3
  3. package/compile_proof.d.mts +7 -0
  4. package/compile_proof.mjs +38 -3
  5. package/dart/CHANGELOG.md +60 -0
  6. package/dart/lib/src/application_framework_calls.dart +16 -6
  7. package/dart/lib/src/console_enrolment.dart +7 -0
  8. package/dart/lib/src/console_http_io.dart +22 -15
  9. package/dart/lib/src/dev_cloud.dart +62 -0
  10. package/dart/lib/src/generated_call.dart +14 -3
  11. package/dart/lib/src/nms_generated_runtime.dart +7 -0
  12. package/dart/lib/src/node_runner_transport.dart +77 -8
  13. package/dart/lib/src/nomos_trace.dart +107 -0
  14. package/dart/lib/src/operation_receipts.dart +74 -7
  15. package/dart/lib/src/reception/dart_reception.dart +174 -17
  16. package/dart/lib/src/rows_watch.dart +390 -0
  17. package/dart/lib/src/runner/node-entry.mjs +7678 -2860
  18. package/dart/lib/src/runtime_v2_transport.dart +3 -0
  19. package/dart/lib/src/sync_status_projection.dart +94 -1
  20. package/dart/lib/src/sync_status_reducer.dart +5 -2
  21. package/dart/lib/src/test_harness.dart +107 -41
  22. package/dart/lib/src/testing/test_peer.dart +107 -99
  23. package/dart/lib/src/testing/test_peer_host.dart +305 -0
  24. package/dart/lib/src/typed_watch_registry.dart +26 -3
  25. package/dart/pubspec.lock +1 -1
  26. package/dart/pubspec.yaml +2 -2
  27. package/dart/test/background_model_adoption_test.dart +1 -0
  28. package/dart/test/console_enrolment_test.dart +47 -0
  29. package/dart/test/custodian_warming_test.dart +105 -0
  30. package/dart/test/fixtures/offer_watch_order_peer.dart +74 -0
  31. package/dart/test/kernel_author_after_read_test.dart +6 -3
  32. package/dart/test/kernel_fence_test.dart +4 -1
  33. package/dart/test/model_adoption_test.dart +66 -0
  34. package/dart/test/nomos_trace_test.dart +91 -0
  35. package/dart/test/own_offer_watch_order_test.dart +90 -0
  36. package/dart/test/receiving_group_open_test.dart +4 -8
  37. package/dart/test/replica_readiness_test.dart +14 -4
  38. package/dart/test/rows_watch_test.dart +331 -0
  39. package/dart/test/runtime_projections_test.dart +41 -0
  40. package/dart/test/test_peer_host_selection_test.dart +49 -0
  41. package/dart_types/CHANGELOG.md +39 -0
  42. package/dart_types/lib/src/approved_model.dart +100 -6
  43. package/dart_types/lib/src/proto/nomos/kernel/v1/kernel.pb.dart +1063 -3
  44. package/dart_types/lib/src/proto/nomos/kernel/v1/kernel.pbenum.dart +89 -0
  45. package/dart_types/lib/src/proto/nomos/runtime/v2/application_desk.pb.dart +14 -0
  46. package/dart_types/lib/src/proto/nomos/runtime/v2/correspondence_desk.pb.dart +2272 -130
  47. package/dart_types/lib/src/proto/nomos/runtime/v2/correspondence_desk.pbenum.dart +65 -0
  48. package/dart_types/lib/src/proto/nomos/runtime/v2/model_adoption_desk.pb.dart +118 -2
  49. package/dart_types/lib/src/proto/nomos/runtime/v2/observability_desk.pb.dart +278 -9
  50. package/dart_types/lib/src/proto/nomos/runtime/v2/receiving_group_desk.pb.dart +7 -85
  51. package/dart_types/lib/src/proto/nomos/runtime/v2/records_desk.pb.dart +16 -0
  52. package/dart_types/lib/src/proto/nomos/runtime/v2/residency_desk.pb.dart +35 -0
  53. package/dart_types/lib/src/proto/nomos/runtime/v2/runtime.pb.dart +43 -2
  54. package/dart_types/pubspec.yaml +1 -1
  55. package/package.json +6 -2
  56. package/src/aggregate.ts +93 -0
  57. package/src/anonymous_value_interning.ts +205 -0
  58. package/src/baseline.ts +27 -0
  59. package/src/baseline_export.ts +432 -0
  60. package/src/baseline_import.ts +312 -0
  61. package/src/baseline_usda.ts +186 -0
  62. package/src/birth_key_rule.ts +472 -0
  63. package/src/births.ts +207 -24
  64. package/src/build_provenance.ts +17 -2
  65. package/src/business_birth.ts +50 -4
  66. package/src/check_package_main.ts +50 -6
  67. package/src/codegen_call_proto.ts +5 -18
  68. package/src/codegen_dart.ts +95 -3
  69. package/src/codegen_dart_client.ts +73 -15
  70. package/src/codegen_dart_facade.ts +58 -35
  71. package/src/codegen_dart_framework_calls.ts +32 -10
  72. package/src/codegen_dart_scenario.ts +7 -0
  73. package/src/codegen_proof.ts +5 -2
  74. package/src/codegen_result_proto.ts +8 -6
  75. package/src/codegen_result_usda.ts +4 -0
  76. package/src/codegen_ts.ts +135 -34
  77. package/src/compatibility_graph.ts +41 -4
  78. package/src/compatibility_usda.ts +11 -1
  79. package/src/compile_package_main.ts +272 -105
  80. package/src/composed_wire_identity.ts +24 -0
  81. package/src/directive.ts +6 -0
  82. package/src/domain_requirements.ts +75 -0
  83. package/src/engine_entry.ts +4 -48
  84. package/src/engine_javascript.ts +12 -6
  85. package/src/fields.ts +109 -0
  86. package/src/identity_usda.ts +77 -51
  87. package/src/index.ts +25 -1
  88. package/src/intent.ts +5 -0
  89. package/src/law_graph.ts +142 -1
  90. package/src/law_graph_usda.ts +25 -141
  91. package/src/law_layer_prims.ts +199 -0
  92. package/src/law_unit_selection.ts +45 -0
  93. package/src/law_unit_set_identity.ts +44 -0
  94. package/src/law_version.ts +107 -0
  95. package/src/package_config.ts +44 -0
  96. package/src/package_dependencies.ts +8 -0
  97. package/src/query/compile.ts +0 -0
  98. package/src/release_inspection.ts +24 -0
  99. package/src/release_publication.ts +298 -0
  100. package/src/value_object.ts +6 -3
  101. package/src/wire.ts +2 -0
  102. package/src/wire_paths.ts +17 -0
  103. package/src/workspace_routing.ts +1 -1
@@ -12,23 +12,82 @@ import 'dart:typed_data';
12
12
 
13
13
  final RegExp _lowerHex64 = RegExp(r'^[0-9a-f]{64}$');
14
14
 
15
+ /// ONE APPLICATION DOMAIN'S REQUIREMENT (CAP-666), as the compiler generated it
16
+ /// beside the unit set: the exact law unit the client was compiled against
17
+ /// (`domain:<key>` in `build/<name>.units`) and the identity of the generated
18
+ /// consumer requirement for that domain (the domain's slice of
19
+ /// `<name>.compatibility.usda`, which the kernel's Compatibility Desk judges).
20
+ ///
21
+ /// A workspace serving exactly [unitSha256] for [domainKey] satisfies this
22
+ /// release for that domain even when its unit set carries other domains the
23
+ /// application never touches. Identities only; the bytes stay in the generated
24
+ /// client. Const-constructible so generated code can bake it; the approved
25
+ /// model validates it.
26
+ final class NomosDomainRequirement {
27
+ const NomosDomainRequirement({
28
+ required this.domainKey,
29
+ required this.unitSha256,
30
+ required this.requirementSha256,
31
+ });
32
+
33
+ /// The application domain key this requirement is about.
34
+ final String domainKey;
35
+
36
+ /// The hash of the domain's law unit (`domain:<key>`), 64 lowercase hex.
37
+ final String unitSha256;
38
+
39
+ /// The sha256 of the domain's generated compatibility requirement, 64
40
+ /// lowercase hex. Observation and qualification name the contract by it.
41
+ final String requirementSha256;
42
+
43
+ /// The wire shape the inventory carries (identities only).
44
+ Map<String, String> toJson() => {
45
+ 'unit': unitSha256,
46
+ 'requirement': requirementSha256,
47
+ };
48
+
49
+ @override
50
+ bool operator ==(Object other) =>
51
+ other is NomosDomainRequirement &&
52
+ other.domainKey == domainKey &&
53
+ other.unitSha256 == unitSha256 &&
54
+ other.requirementSha256 == requirementSha256;
55
+
56
+ @override
57
+ int get hashCode => Object.hash(domainKey, unitSha256, requirementSha256);
58
+
59
+ @override
60
+ String toString() =>
61
+ 'NomosDomainRequirement($domainKey: unit $unitSha256, requirement $requirementSha256)';
62
+ }
63
+
15
64
  /// The law model an application release approves, supplied once at the
16
65
  /// application's Reception. Every field is required: the office refuses to
17
- /// adopt without the package identity, the domain keys it observes, the
18
- /// attributed reason the kernel's transition demands, or the package bytes a
19
- /// child must stage — none of them can be invented later.
66
+ /// adopt without the law (its unit set), the package identity, the domain keys
67
+ /// it observes, the attributed reason the kernel's transition demands, or the
68
+ /// package bytes a child must stage — none of them can be invented later.
20
69
  final class NomosApprovedModel {
21
70
  NomosApprovedModel({
71
+ required this.unitSet,
22
72
  required this.lawSha256,
23
73
  required this.reason,
24
74
  required List<String> domainKeys,
25
75
  required this.loadPackage,
26
- }) : domainKeys = List.unmodifiable(domainKeys) {
76
+ Map<String, NomosDomainRequirement> domainRequirements = const {},
77
+ }) : domainKeys = List.unmodifiable(domainKeys),
78
+ domainRequirements = Map.unmodifiable(domainRequirements) {
79
+ if (!_lowerHex64.hasMatch(unitSet)) {
80
+ throw ArgumentError.value(
81
+ unitSet,
82
+ 'unitSet',
83
+ 'must be the unit set identity of the compiled build/<name>.units (64 lowercase hex)',
84
+ );
85
+ }
27
86
  if (!_lowerHex64.hasMatch(lawSha256)) {
28
87
  throw ArgumentError.value(
29
88
  lawSha256,
30
89
  'lawSha256',
31
- 'must be the kernel-derived identity of the compiled law package (64 lowercase hex)',
90
+ 'must be the identity of the compiled package closure (64 lowercase hex)',
32
91
  );
33
92
  }
34
93
  if (reason.trim().isEmpty) {
@@ -46,9 +105,36 @@ final class NomosApprovedModel {
46
105
  'must name the application domain keys the office observes on each workspace',
47
106
  );
48
107
  }
108
+ for (final entry in this.domainRequirements.entries) {
109
+ final requirement = entry.value;
110
+ if (entry.key.trim().isEmpty || requirement.domainKey != entry.key) {
111
+ throw ArgumentError.value(
112
+ domainRequirements,
113
+ 'domainRequirements',
114
+ 'must be keyed by the domain key each requirement names',
115
+ );
116
+ }
117
+ if (!_lowerHex64.hasMatch(requirement.unitSha256) ||
118
+ !_lowerHex64.hasMatch(requirement.requirementSha256)) {
119
+ throw ArgumentError.value(
120
+ requirement,
121
+ 'domainRequirements',
122
+ "'${entry.key}' must carry the generated domain unit hash and requirement identity (64 lowercase hex each)",
123
+ );
124
+ }
125
+ }
49
126
  }
50
127
 
51
- /// The kernel-derived identity of the compiled `.law.usdz` closure.
128
+ /// THE LAW this release approves (CAP-773): the unit set identity of the
129
+ /// compiled `build/<name>.units` (the generated `frameworkCalls.lawUnitSet`).
130
+ /// A workspace is on it when the closure it serves is composed from exactly
131
+ /// these units, whatever its kernel's composer.
132
+ final String unitSet;
133
+
134
+ /// The compiled package closure (`.law.usdz`, the generated
135
+ /// `frameworkCalls.lawPackageSha256`): the bytes [loadPackage] supplies when a
136
+ /// package-lane workspace must stage them. Package — not what a unit-lane
137
+ /// workspace serves.
52
138
  final String lawSha256;
53
139
 
54
140
  /// The attributed approval text. The kernel's transition demands it whenever
@@ -59,6 +145,14 @@ final class NomosApprovedModel {
59
145
  /// alone; keys it does not serve are ignored.
60
146
  final List<String> domainKeys;
61
147
 
148
+ /// THE PER-DOMAIN REQUIREMENTS this release was generated against (CAP-666):
149
+ /// the generated `frameworkCalls.domainRequirements`, by domain key. A served
150
+ /// key whose workspace serves exactly that domain unit is current for this
151
+ /// release whatever else its unit set carries; the office reports them and
152
+ /// the client inventory records them as this build's contract. Empty on a
153
+ /// client generated before they existed: [unitSet] alone then decides.
154
+ final Map<String, NomosDomainRequirement> domainRequirements;
155
+
62
156
  /// The exact compiled package bytes, read only when a workspace must stage
63
157
  /// them (a bundled asset, a file beside the generated facade).
64
158
  final Future<Uint8List> Function() loadPackage;