@githolon/dsl 0.114.0 → 0.116.2

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 (86) hide show
  1. package/assets/operation-contract.wasm +0 -0
  2. package/dart/CHANGELOG.md +55 -0
  3. package/dart/lib/src/application_framework_calls.dart +7 -1
  4. package/dart/lib/src/console_enrolment.dart +7 -0
  5. package/dart/lib/src/console_http_io.dart +22 -15
  6. package/dart/lib/src/dev_cloud.dart +62 -0
  7. package/dart/lib/src/nms_generated_runtime.dart +1 -0
  8. package/dart/lib/src/operation_receipts.dart +74 -7
  9. package/dart/lib/src/reception/dart_reception.dart +26 -6
  10. package/dart/lib/src/result_usda.dart +64 -27
  11. package/dart/lib/src/runner/node-entry.mjs +4733 -1534
  12. package/dart/lib/src/runtime_v2_transport.dart +3 -0
  13. package/dart/lib/src/sync_status_projection.dart +11 -0
  14. package/dart/pubspec.lock +1 -1
  15. package/dart/pubspec.yaml +2 -2
  16. package/dart/test/console_enrolment_test.dart +47 -0
  17. package/dart/test/kernel_refused_follow_test.dart +36 -0
  18. package/dart/test/model_adoption_test.dart +49 -0
  19. package/dart/test/result_usda_test.dart +67 -0
  20. package/dart/test/runtime_projections_test.dart +41 -0
  21. package/dart_types/CHANGELOG.md +30 -0
  22. package/dart_types/lib/src/approved_model.dart +78 -1
  23. package/dart_types/lib/src/proto/nomos/kernel/v1/kernel.pb.dart +528 -2
  24. package/dart_types/lib/src/proto/nomos/kernel/v1/kernel.pbenum.dart +24 -0
  25. package/dart_types/lib/src/proto/nomos/runtime/v2/correspondence_desk.pb.dart +1897 -112
  26. package/dart_types/lib/src/proto/nomos/runtime/v2/model_adoption_desk.pb.dart +98 -0
  27. package/dart_types/lib/src/proto/nomos/runtime/v2/observability_desk.pbenum.dart +11 -1
  28. package/dart_types/lib/src/proto/nomos/runtime/v2/records_desk.pb.dart +16 -0
  29. package/dart_types/lib/src/proto/nomos/runtime/v2/runtime.pb.dart +43 -2
  30. package/dart_types/lib/src/vo_canonical.dart +185 -0
  31. package/dart_types/pubspec.lock +1 -1
  32. package/dart_types/pubspec.yaml +3 -1
  33. package/dart_types/test/vo_canonical_test.dart +91 -0
  34. package/package.json +4 -2
  35. package/src/aggregate.ts +95 -0
  36. package/src/anonymous_value_interning.ts +205 -0
  37. package/src/baseline.ts +27 -0
  38. package/src/baseline_export.ts +432 -0
  39. package/src/baseline_import.ts +312 -0
  40. package/src/baseline_usda.ts +185 -0
  41. package/src/birth_key_rule.ts +472 -0
  42. package/src/births.ts +207 -24
  43. package/src/build_package.ts +47 -7
  44. package/src/build_provenance.ts +10 -0
  45. package/src/business_birth.ts +50 -4
  46. package/src/check_package_main.ts +50 -6
  47. package/src/codegen_call_proto.ts +5 -18
  48. package/src/codegen_call_usda.ts +6 -3
  49. package/src/codegen_dart.ts +114 -60
  50. package/src/codegen_dart_client.ts +52 -6
  51. package/src/codegen_dart_facade.ts +57 -35
  52. package/src/codegen_dart_framework_calls.ts +20 -1
  53. package/src/codegen_proof.ts +5 -2
  54. package/src/codegen_result_proto.ts +8 -6
  55. package/src/codegen_result_usda.ts +12 -4
  56. package/src/codegen_ts.ts +109 -10
  57. package/src/compatibility_graph.ts +41 -4
  58. package/src/compatibility_usda.ts +11 -1
  59. package/src/compile_package_main.ts +222 -52
  60. package/src/composed_wire_identity.ts +24 -0
  61. package/src/directive.ts +6 -0
  62. package/src/domain_requirements.ts +75 -0
  63. package/src/engine_entry.ts +12 -4
  64. package/src/engine_javascript.ts +12 -6
  65. package/src/fields.ts +109 -0
  66. package/src/identity_usda.ts +80 -103
  67. package/src/index.ts +35 -1
  68. package/src/intent.ts +33 -3
  69. package/src/law_check.ts +34 -0
  70. package/src/law_graph.ts +142 -1
  71. package/src/law_graph_usda.ts +27 -144
  72. package/src/law_layer_prims.ts +174 -0
  73. package/src/law_unit_selection.ts +45 -0
  74. package/src/law_units.ts +7 -6
  75. package/src/law_version.ts +108 -0
  76. package/src/package_config.ts +44 -0
  77. package/src/package_dependencies.ts +8 -0
  78. package/src/point_guard.ts +5 -1
  79. package/src/release_inspection.ts +6 -4
  80. package/src/release_publication.ts +6 -5
  81. package/src/usda_text.ts +78 -3
  82. package/src/value_identity.ts +355 -0
  83. package/src/value_object.ts +35 -4
  84. package/src/wire.ts +2 -0
  85. package/src/wire_paths.ts +17 -0
  86. package/src/workspace_routing.ts +1 -1
@@ -29,6 +29,7 @@ class AdoptApplicationModelRequest extends $pb.GeneratedMessage {
29
29
  $core.String? acceptanceReason,
30
30
  $core.bool? dryRun,
31
31
  $core.String? unitSet,
32
+ $core.Iterable<DomainUnitRequirement>? domainRequirements,
32
33
  }) {
33
34
  final result = create();
34
35
  if (session != null) result.session = session;
@@ -37,6 +38,8 @@ class AdoptApplicationModelRequest extends $pb.GeneratedMessage {
37
38
  if (acceptanceReason != null) result.acceptanceReason = acceptanceReason;
38
39
  if (dryRun != null) result.dryRun = dryRun;
39
40
  if (unitSet != null) result.unitSet = unitSet;
41
+ if (domainRequirements != null)
42
+ result.domainRequirements.addAll(domainRequirements);
40
43
  return result;
41
44
  }
42
45
 
@@ -60,6 +63,8 @@ class AdoptApplicationModelRequest extends $pb.GeneratedMessage {
60
63
  ..aOS(4, _omitFieldNames ? '' : 'acceptanceReason')
61
64
  ..aOB(5, _omitFieldNames ? '' : 'dryRun')
62
65
  ..aOS(6, _omitFieldNames ? '' : 'unitSet')
66
+ ..pPM<DomainUnitRequirement>(7, _omitFieldNames ? '' : 'domainRequirements',
67
+ subBuilder: DomainUnitRequirement.create)
63
68
  ..hasRequiredFields = false;
64
69
 
65
70
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
@@ -148,6 +153,99 @@ class AdoptApplicationModelRequest extends $pb.GeneratedMessage {
148
153
  $core.bool hasUnitSet() => $_has(5);
149
154
  @$pb.TagNumber(6)
150
155
  void clearUnitSet() => $_clearField(6);
156
+
157
+ /// THE PER-DOMAIN REQUIREMENTS (CAP-666): for each application domain key, the
158
+ /// exact law unit and the generated consumer requirement this client was
159
+ /// compiled against. A workspace serving that unit for the key satisfies the
160
+ /// requirement for it even when its unit set carries other domains the
161
+ /// application never touches. Absent on clients generated before this field
162
+ /// existed: the unit set alone then decides.
163
+ @$pb.TagNumber(7)
164
+ $pb.PbList<DomainUnitRequirement> get domainRequirements => $_getList(6);
165
+ }
166
+
167
+ /// One application domain's requirement, as the compiler generated it beside the
168
+ /// unit set: the domain's unit hash (`domain:<key>` in `build/<name>.units`) and
169
+ /// the sha256 of the domain's `<name>.compatibility.usda` slice the kernel's
170
+ /// Compatibility Desk judges. Identities only; the office never reads the bytes.
171
+ class DomainUnitRequirement extends $pb.GeneratedMessage {
172
+ factory DomainUnitRequirement({
173
+ $core.String? domainKey,
174
+ $core.String? unitSha256,
175
+ $core.String? requirementSha256,
176
+ }) {
177
+ final result = create();
178
+ if (domainKey != null) result.domainKey = domainKey;
179
+ if (unitSha256 != null) result.unitSha256 = unitSha256;
180
+ if (requirementSha256 != null) result.requirementSha256 = requirementSha256;
181
+ return result;
182
+ }
183
+
184
+ DomainUnitRequirement._();
185
+
186
+ factory DomainUnitRequirement.fromBuffer($core.List<$core.int> data,
187
+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
188
+ create()..mergeFromBuffer(data, registry);
189
+ factory DomainUnitRequirement.fromJson($core.String json,
190
+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
191
+ create()..mergeFromJson(json, registry);
192
+
193
+ static final $pb.BuilderInfo _i = $pb.BuilderInfo(
194
+ _omitMessageNames ? '' : 'DomainUnitRequirement',
195
+ package:
196
+ const $pb.PackageName(_omitMessageNames ? '' : 'nomos.runtime.v2'),
197
+ createEmptyInstance: create)
198
+ ..aOS(1, _omitFieldNames ? '' : 'domainKey')
199
+ ..aOS(2, _omitFieldNames ? '' : 'unitSha256')
200
+ ..aOS(3, _omitFieldNames ? '' : 'requirementSha256')
201
+ ..hasRequiredFields = false;
202
+
203
+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
204
+ DomainUnitRequirement clone() => deepCopy();
205
+ @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
206
+ DomainUnitRequirement copyWith(
207
+ void Function(DomainUnitRequirement) updates) =>
208
+ super.copyWith((message) => updates(message as DomainUnitRequirement))
209
+ as DomainUnitRequirement;
210
+
211
+ @$core.override
212
+ $pb.BuilderInfo get info_ => _i;
213
+
214
+ @$core.pragma('dart2js:noInline')
215
+ static DomainUnitRequirement create() => DomainUnitRequirement._();
216
+ @$core.override
217
+ DomainUnitRequirement createEmptyInstance() => create();
218
+ @$core.pragma('dart2js:noInline')
219
+ static DomainUnitRequirement getDefault() => _defaultInstance ??=
220
+ $pb.GeneratedMessage.$_defaultFor<DomainUnitRequirement>(create);
221
+ static DomainUnitRequirement? _defaultInstance;
222
+
223
+ @$pb.TagNumber(1)
224
+ $core.String get domainKey => $_getSZ(0);
225
+ @$pb.TagNumber(1)
226
+ set domainKey($core.String value) => $_setString(0, value);
227
+ @$pb.TagNumber(1)
228
+ $core.bool hasDomainKey() => $_has(0);
229
+ @$pb.TagNumber(1)
230
+ void clearDomainKey() => $_clearField(1);
231
+
232
+ @$pb.TagNumber(2)
233
+ $core.String get unitSha256 => $_getSZ(1);
234
+ @$pb.TagNumber(2)
235
+ set unitSha256($core.String value) => $_setString(1, value);
236
+ @$pb.TagNumber(2)
237
+ $core.bool hasUnitSha256() => $_has(1);
238
+ @$pb.TagNumber(2)
239
+ void clearUnitSha256() => $_clearField(2);
240
+
241
+ @$pb.TagNumber(3)
242
+ $core.String get requirementSha256 => $_getSZ(2);
243
+ @$pb.TagNumber(3)
244
+ set requirementSha256($core.String value) => $_setString(2, value);
245
+ @$pb.TagNumber(3)
246
+ $core.bool hasRequirementSha256() => $_has(2);
247
+ @$pb.TagNumber(3)
248
+ void clearRequirementSha256() => $_clearField(3);
151
249
  }
152
250
 
153
251
  class ApplicationModelAdopted extends $pb.GeneratedMessage {
@@ -196,6 +196,15 @@ class FollowObservationPhase extends $pb.ProtobufEnum {
196
196
  ? ''
197
197
  : 'FOLLOW_OBSERVATION_PHASE_LOCAL_COPY_UNREADABLE');
198
198
 
199
+ /// This peer's kernel deterministically refused the follow's last round at this local head and
200
+ /// remote frontier. Sync is BLOCKED: no timer re-runs the same refused round. Only an event
201
+ /// (new local work, an upstream head change, a socket reopen, a changed kernel or runtime) runs
202
+ /// it again; `retry_at_unix_millis` is present only once an event made it due. `detail` carries
203
+ /// the kernel's refusal.
204
+ static const FollowObservationPhase FOLLOW_OBSERVATION_PHASE_KERNEL_REFUSED =
205
+ FollowObservationPhase._(
206
+ 12, _omitEnumNames ? '' : 'FOLLOW_OBSERVATION_PHASE_KERNEL_REFUSED');
207
+
199
208
  static const $core.List<FollowObservationPhase> values =
200
209
  <FollowObservationPhase>[
201
210
  FOLLOW_OBSERVATION_PHASE_UNSPECIFIED,
@@ -210,10 +219,11 @@ class FollowObservationPhase extends $pb.ProtobufEnum {
210
219
  FOLLOW_OBSERVATION_PHASE_REBORN_REMOTELY,
211
220
  FOLLOW_OBSERVATION_PHASE_REPLACING_LOCAL,
212
221
  FOLLOW_OBSERVATION_PHASE_LOCAL_COPY_UNREADABLE,
222
+ FOLLOW_OBSERVATION_PHASE_KERNEL_REFUSED,
213
223
  ];
214
224
 
215
225
  static final $core.List<FollowObservationPhase?> _byValue =
216
- $pb.ProtobufEnum.$_initByValueList(values, 11);
226
+ $pb.ProtobufEnum.$_initByValueList(values, 12);
217
227
  static FollowObservationPhase? valueOf($core.int value) =>
218
228
  value < 0 || value >= _byValue.length ? null : _byValue[value];
219
229
 
@@ -1237,14 +1237,18 @@ class ResolveWorkspaceNameRequest extends $pb.GeneratedMessage {
1237
1237
  }
1238
1238
 
1239
1239
  /// `birth.keyed({ namespace, key })` — `<namespace>-<sha256(namespace + US + key)[:40]>`.
1240
+ /// A business birth's child is named the same way, fixed at birth (CAP-803 withdrew the CAP-788
1241
+ /// parent-scoped naming before release); one parent per node is the kernel's `[birth-child-already-parented]`.
1240
1242
  class KeyedBirthName extends $pb.GeneratedMessage {
1241
1243
  factory KeyedBirthName({
1242
1244
  $core.String? namespace,
1243
1245
  $core.String? key,
1246
+ $core.String? parent,
1244
1247
  }) {
1245
1248
  final result = create();
1246
1249
  if (namespace != null) result.namespace = namespace;
1247
1250
  if (key != null) result.key = key;
1251
+ if (parent != null) result.parent = parent;
1248
1252
  return result;
1249
1253
  }
1250
1254
 
@@ -1264,6 +1268,7 @@ class KeyedBirthName extends $pb.GeneratedMessage {
1264
1268
  createEmptyInstance: create)
1265
1269
  ..aOS(1, _omitFieldNames ? '' : 'namespace')
1266
1270
  ..aOS(2, _omitFieldNames ? '' : 'key')
1271
+ ..aOS(3, _omitFieldNames ? '' : 'parent')
1267
1272
  ..hasRequiredFields = false;
1268
1273
 
1269
1274
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
@@ -1302,6 +1307,17 @@ class KeyedBirthName extends $pb.GeneratedMessage {
1302
1307
  $core.bool hasKey() => $_has(1);
1303
1308
  @$pb.TagNumber(2)
1304
1309
  void clearKey() => $_clearField(2);
1310
+
1311
+ /// UNUSED (reserved, CAP-803): the office ignores it and answers the keyed name above. A child is
1312
+ /// addressed by the name it was born with; a parent never re-derives it.
1313
+ @$pb.TagNumber(3)
1314
+ $core.String get parent => $_getSZ(2);
1315
+ @$pb.TagNumber(3)
1316
+ set parent($core.String value) => $_setString(2, value);
1317
+ @$pb.TagNumber(3)
1318
+ $core.bool hasParent() => $_has(2);
1319
+ @$pb.TagNumber(3)
1320
+ void clearParent() => $_clearField(3);
1305
1321
  }
1306
1322
 
1307
1323
  /// The framework's identity anchor — `nomos-rg-<sha256(principal)[:40]>`.
@@ -85,6 +85,7 @@ enum RuntimeRequest_Command {
85
85
  configureProviderOrigins,
86
86
  fetchWorkspace,
87
87
  provideLawProducts,
88
+ serveLiveStream,
88
89
  notSet
89
90
  }
90
91
 
@@ -145,6 +146,7 @@ class RuntimeRequest extends $pb.GeneratedMessage {
145
146
  $7.ConfigureProviderOriginsRequest? configureProviderOrigins,
146
147
  $2.FetchWorkspaceRequest? fetchWorkspace,
147
148
  $2.ProvideLawProductsRequest? provideLawProducts,
149
+ $3.LiveStreamRequest? serveLiveStream,
148
150
  }) {
149
151
  final result = create();
150
152
  if (protocolVersion != null) result.protocolVersion = protocolVersion;
@@ -223,6 +225,7 @@ class RuntimeRequest extends $pb.GeneratedMessage {
223
225
  if (fetchWorkspace != null) result.fetchWorkspace = fetchWorkspace;
224
226
  if (provideLawProducts != null)
225
227
  result.provideLawProducts = provideLawProducts;
228
+ if (serveLiveStream != null) result.serveLiveStream = serveLiveStream;
226
229
  return result;
227
230
  }
228
231
 
@@ -284,6 +287,7 @@ class RuntimeRequest extends $pb.GeneratedMessage {
284
287
  62: RuntimeRequest_Command.configureProviderOrigins,
285
288
  63: RuntimeRequest_Command.fetchWorkspace,
286
289
  64: RuntimeRequest_Command.provideLawProducts,
290
+ 65: RuntimeRequest_Command.serveLiveStream,
287
291
  0: RuntimeRequest_Command.notSet
288
292
  };
289
293
  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
@@ -338,7 +342,8 @@ class RuntimeRequest extends $pb.GeneratedMessage {
338
342
  61,
339
343
  62,
340
344
  63,
341
- 64
345
+ 64,
346
+ 65
342
347
  ])
343
348
  ..aI(1, _omitFieldNames ? '' : 'protocolVersion',
344
349
  fieldType: $pb.PbFieldType.OU3)
@@ -476,6 +481,8 @@ class RuntimeRequest extends $pb.GeneratedMessage {
476
481
  ..aOM<$2.ProvideLawProductsRequest>(
477
482
  64, _omitFieldNames ? '' : 'provideLawProducts',
478
483
  subBuilder: $2.ProvideLawProductsRequest.create)
484
+ ..aOM<$3.LiveStreamRequest>(65, _omitFieldNames ? '' : 'serveLiveStream',
485
+ subBuilder: $3.LiveStreamRequest.create)
479
486
  ..hasRequiredFields = false;
480
487
 
481
488
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
@@ -544,6 +551,7 @@ class RuntimeRequest extends $pb.GeneratedMessage {
544
551
  @$pb.TagNumber(62)
545
552
  @$pb.TagNumber(63)
546
553
  @$pb.TagNumber(64)
554
+ @$pb.TagNumber(65)
547
555
  RuntimeRequest_Command whichCommand() =>
548
556
  _RuntimeRequest_CommandByTag[$_whichOneof(0)]!;
549
557
  @$pb.TagNumber(10)
@@ -593,6 +601,7 @@ class RuntimeRequest extends $pb.GeneratedMessage {
593
601
  @$pb.TagNumber(62)
594
602
  @$pb.TagNumber(63)
595
603
  @$pb.TagNumber(64)
604
+ @$pb.TagNumber(65)
596
605
  void clearCommand() => $_clearField($_whichOneof(0));
597
606
 
598
607
  @$pb.TagNumber(1)
@@ -1196,6 +1205,18 @@ class RuntimeRequest extends $pb.GeneratedMessage {
1196
1205
  void clearProvideLawProducts() => $_clearField(64);
1197
1206
  @$pb.TagNumber(64)
1198
1207
  $2.ProvideLawProductsRequest ensureProvideLawProducts() => $_ensure(50);
1208
+
1209
+ /// A coordinator asks the cloud peer that holds this workspace to serve one stream request.
1210
+ @$pb.TagNumber(65)
1211
+ $3.LiveStreamRequest get serveLiveStream => $_getN(51);
1212
+ @$pb.TagNumber(65)
1213
+ set serveLiveStream($3.LiveStreamRequest value) => $_setField(65, value);
1214
+ @$pb.TagNumber(65)
1215
+ $core.bool hasServeLiveStream() => $_has(51);
1216
+ @$pb.TagNumber(65)
1217
+ void clearServeLiveStream() => $_clearField(65);
1218
+ @$pb.TagNumber(65)
1219
+ $3.LiveStreamRequest ensureServeLiveStream() => $_ensure(51);
1199
1220
  }
1200
1221
 
1201
1222
  class InvocationTarget extends $pb.GeneratedMessage {
@@ -1318,6 +1339,7 @@ enum RuntimeResponse_Outcome {
1318
1339
  providerOriginsConfigured,
1319
1340
  workspaceFetch,
1320
1341
  lawProducts,
1342
+ liveStreamServed,
1321
1343
  notSet
1322
1344
  }
1323
1345
 
@@ -1377,6 +1399,7 @@ class RuntimeResponse extends $pb.GeneratedMessage {
1377
1399
  $7.ProviderOriginsConfigured? providerOriginsConfigured,
1378
1400
  $2.WorkspaceFetch? workspaceFetch,
1379
1401
  $18.ExportLawProductsResponse? lawProducts,
1402
+ $3.LiveStreamAnswer? liveStreamServed,
1380
1403
  }) {
1381
1404
  final result = create();
1382
1405
  if (protocolVersion != null) result.protocolVersion = protocolVersion;
@@ -1457,6 +1480,7 @@ class RuntimeResponse extends $pb.GeneratedMessage {
1457
1480
  result.providerOriginsConfigured = providerOriginsConfigured;
1458
1481
  if (workspaceFetch != null) result.workspaceFetch = workspaceFetch;
1459
1482
  if (lawProducts != null) result.lawProducts = lawProducts;
1483
+ if (liveStreamServed != null) result.liveStreamServed = liveStreamServed;
1460
1484
  return result;
1461
1485
  }
1462
1486
 
@@ -1523,6 +1547,7 @@ class RuntimeResponse extends $pb.GeneratedMessage {
1523
1547
  66: RuntimeResponse_Outcome.providerOriginsConfigured,
1524
1548
  67: RuntimeResponse_Outcome.workspaceFetch,
1525
1549
  68: RuntimeResponse_Outcome.lawProducts,
1550
+ 69: RuntimeResponse_Outcome.liveStreamServed,
1526
1551
  0: RuntimeResponse_Outcome.notSet
1527
1552
  };
1528
1553
  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
@@ -1582,7 +1607,8 @@ class RuntimeResponse extends $pb.GeneratedMessage {
1582
1607
  65,
1583
1608
  66,
1584
1609
  67,
1585
- 68
1610
+ 68,
1611
+ 69
1586
1612
  ])
1587
1613
  ..aI(1, _omitFieldNames ? '' : 'protocolVersion',
1588
1614
  fieldType: $pb.PbFieldType.OU3)
@@ -1719,6 +1745,8 @@ class RuntimeResponse extends $pb.GeneratedMessage {
1719
1745
  ..aOM<$18.ExportLawProductsResponse>(
1720
1746
  68, _omitFieldNames ? '' : 'lawProducts',
1721
1747
  subBuilder: $18.ExportLawProductsResponse.create)
1748
+ ..aOM<$3.LiveStreamAnswer>(69, _omitFieldNames ? '' : 'liveStreamServed',
1749
+ subBuilder: $3.LiveStreamAnswer.create)
1722
1750
  ..hasRequiredFields = false;
1723
1751
 
1724
1752
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
@@ -1792,6 +1820,7 @@ class RuntimeResponse extends $pb.GeneratedMessage {
1792
1820
  @$pb.TagNumber(66)
1793
1821
  @$pb.TagNumber(67)
1794
1822
  @$pb.TagNumber(68)
1823
+ @$pb.TagNumber(69)
1795
1824
  RuntimeResponse_Outcome whichOutcome() =>
1796
1825
  _RuntimeResponse_OutcomeByTag[$_whichOneof(0)]!;
1797
1826
  @$pb.TagNumber(10)
@@ -1846,6 +1875,7 @@ class RuntimeResponse extends $pb.GeneratedMessage {
1846
1875
  @$pb.TagNumber(66)
1847
1876
  @$pb.TagNumber(67)
1848
1877
  @$pb.TagNumber(68)
1878
+ @$pb.TagNumber(69)
1849
1879
  void clearOutcome() => $_clearField($_whichOneof(0));
1850
1880
 
1851
1881
  @$pb.TagNumber(1)
@@ -2469,6 +2499,17 @@ class RuntimeResponse extends $pb.GeneratedMessage {
2469
2499
  void clearLawProducts() => $_clearField(68);
2470
2500
  @$pb.TagNumber(68)
2471
2501
  $18.ExportLawProductsResponse ensureLawProducts() => $_ensure(53);
2502
+
2503
+ @$pb.TagNumber(69)
2504
+ $3.LiveStreamAnswer get liveStreamServed => $_getN(54);
2505
+ @$pb.TagNumber(69)
2506
+ set liveStreamServed($3.LiveStreamAnswer value) => $_setField(69, value);
2507
+ @$pb.TagNumber(69)
2508
+ $core.bool hasLiveStreamServed() => $_has(54);
2509
+ @$pb.TagNumber(69)
2510
+ void clearLiveStreamServed() => $_clearField(69);
2511
+ @$pb.TagNumber(69)
2512
+ $3.LiveStreamAnswer ensureLiveStreamServed() => $_ensure(54);
2472
2513
  }
2473
2514
 
2474
2515
  enum CustodyOfferBatchResponse_Outcome { admission, failure, blocked, notSet }
@@ -0,0 +1,185 @@
1
+ // NOMOS — Nomos Sovereign: participants act · verify · remember LOCALLY; hosted
2
+ // remotes are replaceable custody/transport, not truth.
3
+
4
+ /// Value identity for generated value objects — the Dart side of `nomos.vo-canonical.v1` (CAP-853).
5
+ ///
6
+ /// The law's definition lives in `dsl/src/value_identity.ts`: RFC 8785 (JCS) over the value the
7
+ /// value object's descriptor admits. A generated class's `toJson()` already IS that typed value
8
+ /// (absent optionals omitted, nullable members `null`, the variant case in `type`), so the Dart side
9
+ /// is the RFC 8785 encoder over it — members in UTF-16 code-unit order, ECMAScript number spelling,
10
+ /// RFC 8785 string escapes — and generated `==` / `hashCode` compare that encoding. One definition
11
+ /// across runtimes: the conformance vectors in `dsl/conformance/vo_canonical.v1.json` are replayed
12
+ /// here (`test/vo_canonical_test.dart`), by the TypeScript suite and by the sealed engine.
13
+ ///
14
+ /// Framework-internal: generated code calls [NmsInternalValueIdentity]; it is not exported from the
15
+ /// `nomos_types` barrel. Digests are the law's to derive and store.
16
+ library;
17
+
18
+ const String nmsVoCanonicalEncoding = 'nomos.vo-canonical.v1';
19
+
20
+ /// The value-identity operations generated value objects use for `==` and `hashCode`.
21
+ abstract final class NmsInternalValueIdentity {
22
+ /// The `nomos.vo-canonical.v1` text of a value object's json (`toJson()`).
23
+ ///
24
+ /// Throws [ArgumentError] for what the law refuses: NaN or Infinity, an integer outside the
25
+ /// exact JavaScript range, a string that is not well-formed UTF-16, or a non-json value.
26
+ static String canonical(Object? json) {
27
+ final out = StringBuffer();
28
+ _write(out, json, strict: true, at: 'value');
29
+ return out.toString();
30
+ }
31
+
32
+ /// Value equality of two value objects' json over the canonical encoding.
33
+ ///
34
+ /// Total: a value the law would refuse (NaN, a lone surrogate) still compares, by a spelling
35
+ /// that never collides with an admissible value's canonical text.
36
+ static bool equals(Object? a, Object? b) => _lenient(a) == _lenient(b);
37
+
38
+ /// A hash consistent with [equals].
39
+ static int hash(Object? json) => _lenient(json).hashCode;
40
+ }
41
+
42
+ String _lenient(Object? json) {
43
+ final out = StringBuffer();
44
+ _write(out, json, strict: false, at: 'value');
45
+ return out.toString();
46
+ }
47
+
48
+ void _write(StringBuffer out, Object? v,
49
+ {required bool strict, required String at}) {
50
+ if (v == null) {
51
+ out.write('null');
52
+ } else if (v is bool) {
53
+ out.write(v ? 'true' : 'false');
54
+ } else if (v is num) {
55
+ out.write(_number(v, strict: strict, at: at));
56
+ } else if (v is String) {
57
+ _string(out, v, strict: strict, at: at);
58
+ } else if (v is List) {
59
+ out.write('[');
60
+ for (var i = 0; i < v.length; i++) {
61
+ if (i > 0) out.write(',');
62
+ _write(out, v[i], strict: strict, at: '$at[$i]');
63
+ }
64
+ out.write(']');
65
+ } else if (v is Map) {
66
+ final keys = v.keys.map((k) {
67
+ if (k is! String)
68
+ throw ArgumentError(
69
+ '$nmsVoCanonicalEncoding: $at has a non-string member name');
70
+ return k;
71
+ }).toList()
72
+ // String.compareTo orders by UTF-16 code units, as RFC 8785 §3.2.3 requires.
73
+ ..sort();
74
+ out.write('{');
75
+ var first = true;
76
+ for (final k in keys) {
77
+ if (!first) out.write(',');
78
+ first = false;
79
+ _string(out, k, strict: strict, at: '$at member name');
80
+ out.write(':');
81
+ _write(out, v[k], strict: strict, at: '$at.$k');
82
+ }
83
+ out.write('}');
84
+ } else {
85
+ throw ArgumentError(
86
+ '$nmsVoCanonicalEncoding: $at is a ${v.runtimeType}, which json cannot carry');
87
+ }
88
+ }
89
+
90
+ const int _maxSafeInteger = 9007199254740991;
91
+
92
+ /// On the web every number is a JavaScript double, so an integral double also `is int`.
93
+ const bool _numbersAreDoubles = identical(1, 1.0);
94
+
95
+ /// ECMAScript Number::toString — the RFC 8785 number spelling — for a Dart [num].
96
+ String _number(num v, {required bool strict, required String at}) {
97
+ if (v is int && !(_numbersAreDoubles && v.abs() > _maxSafeInteger)) {
98
+ if (v.abs() > _maxSafeInteger) {
99
+ if (strict) {
100
+ throw ArgumentError(
101
+ '$nmsVoCanonicalEncoding: $at is an integer outside the exact JavaScript range');
102
+ }
103
+ return 'int:$v';
104
+ }
105
+ return v.toString();
106
+ }
107
+ final d = v.toDouble();
108
+ if (d.isNaN || d.isInfinite) {
109
+ if (strict) {
110
+ throw ArgumentError(
111
+ '$nmsVoCanonicalEncoding: $at is not a finite number (NaN and Infinity have no canonical form)');
112
+ }
113
+ return 'nonfinite:$d';
114
+ }
115
+ if (d == 0) return '0'; // -0 too
116
+ if (d < 0) return '-${_number(-d, strict: strict, at: at)}';
117
+ // The shortest round-trip digits and the exponent, from Dart's own shortest representation.
118
+ final exponential = d.toStringAsExponential(); // e.g. "1.2345e+2", "5e-324"
119
+ final eIndex = exponential.indexOf('e');
120
+ final digits = exponential.substring(0, eIndex).replaceAll('.', '');
121
+ final k = digits.length;
122
+ final n = int.parse(exponential.substring(eIndex + 1)) +
123
+ 1; // value = 0.digits × 10^n
124
+ if (k <= n && n <= 21) return digits + '0' * (n - k);
125
+ if (0 < n && n <= 21)
126
+ return '${digits.substring(0, n)}.${digits.substring(n)}';
127
+ if (-6 < n && n <= 0) return '0.${'0' * -n}$digits';
128
+ final e = n - 1;
129
+ final exponent = e < 0 ? '-${-e}' : '+$e';
130
+ return k == 1
131
+ ? '${digits}e$exponent'
132
+ : '${digits[0]}.${digits.substring(1)}e$exponent';
133
+ }
134
+
135
+ void _string(StringBuffer out, String s,
136
+ {required bool strict, required String at}) {
137
+ out.write('"');
138
+ for (var i = 0; i < s.length; i++) {
139
+ final c = s.codeUnitAt(i);
140
+ if (c >= 0xd800 && c <= 0xdbff) {
141
+ final next = i + 1 < s.length ? s.codeUnitAt(i + 1) : -1;
142
+ if (next >= 0xdc00 && next <= 0xdfff) {
143
+ out.writeCharCode(c);
144
+ out.writeCharCode(next);
145
+ i++;
146
+ continue;
147
+ }
148
+ if (strict)
149
+ throw ArgumentError(
150
+ '$nmsVoCanonicalEncoding: $at is not well-formed UTF-16 (a lone high surrogate)');
151
+ out.write('\\u${c.toRadixString(16)}');
152
+ continue;
153
+ }
154
+ if (c >= 0xdc00 && c <= 0xdfff) {
155
+ if (strict)
156
+ throw ArgumentError(
157
+ '$nmsVoCanonicalEncoding: $at is not well-formed UTF-16 (a lone low surrogate)');
158
+ out.write('\\u${c.toRadixString(16)}');
159
+ continue;
160
+ }
161
+ switch (c) {
162
+ case 0x22:
163
+ out.write(r'\"');
164
+ case 0x5c:
165
+ out.write(r'\\');
166
+ case 0x08:
167
+ out.write(r'\b');
168
+ case 0x0c:
169
+ out.write(r'\f');
170
+ case 0x0a:
171
+ out.write(r'\n');
172
+ case 0x0d:
173
+ out.write(r'\r');
174
+ case 0x09:
175
+ out.write(r'\t');
176
+ default:
177
+ if (c < 0x20) {
178
+ out.write('\\u00${c.toRadixString(16).padLeft(2, '0')}');
179
+ } else {
180
+ out.writeCharCode(c);
181
+ }
182
+ }
183
+ }
184
+ out.write('"');
185
+ }
@@ -74,7 +74,7 @@ packages:
74
74
  source: hosted
75
75
  version: "1.15.1"
76
76
  crypto:
77
- dependency: transitive
77
+ dependency: "direct dev"
78
78
  description:
79
79
  name: crypto
80
80
  sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf
@@ -9,7 +9,7 @@ description: >-
9
9
  Pure kernel wire/data types for Nomos Dart frontends — no transport, no bridge,
10
10
  no runtime. Typed protobuf and USDA boundary values plus the offer codec,
11
11
  reactive read engine, schema validation, and data-only error/trace types.
12
- version: 0.13.0
12
+ version: 0.15.0
13
13
 
14
14
  environment:
15
15
  sdk: ^3.5.0
@@ -20,4 +20,6 @@ dependencies:
20
20
  fixnum: ^1.1.1
21
21
 
22
22
  dev_dependencies:
23
+ # The value-identity conformance test checks vector digests (test/vo_canonical_test.dart).
24
+ crypto: ^3.0.0
23
25
  test: ^1.25.0
@@ -0,0 +1,91 @@
1
+ // `nomos.vo-canonical.v1` (CAP-853): the Dart encoder replays the law's conformance vectors —
2
+ // dsl/conformance/vo_canonical.v1.json, shared with the TypeScript suite and the sealed engine.
3
+ import 'dart:convert';
4
+ import 'dart:io';
5
+ import 'dart:typed_data';
6
+
7
+ import 'package:crypto/crypto.dart' show sha256;
8
+ import 'package:nomos_types/src/vo_canonical.dart';
9
+ import 'package:test/test.dart';
10
+
11
+ void main() {
12
+ final file =
13
+ jsonDecode(File('../conformance/vo_canonical.v1.json').readAsStringSync())
14
+ as Map<String, Object?>;
15
+
16
+ test('names the same encoding', () {
17
+ expect(file['encoding'], nmsVoCanonicalEncoding);
18
+ });
19
+
20
+ test('spells every RFC 8785 Appendix B number exactly', () {
21
+ for (final n in (file['numbers']! as List).cast<Map<String, Object?>>()) {
22
+ final bits = BigInt.parse(n['bits']! as String, radix: 16);
23
+ final bytes = ByteData(8)
24
+ ..setUint32(0, (bits >> 32).toInt())
25
+ ..setUint32(4, (bits & BigInt.from(0xffffffff)).toInt());
26
+ expect(NmsInternalValueIdentity.canonical(bytes.getFloat64(0)),
27
+ n['canonical'],
28
+ reason: n['bits'] as String);
29
+ }
30
+ });
31
+
32
+ test('encodes and digests every vector', () {
33
+ for (final v in (file['vectors']! as List).cast<Map<String, Object?>>()) {
34
+ expect(NmsInternalValueIdentity.canonical(v['value']), v['canonical'],
35
+ reason: v['name'] as String);
36
+ expect(
37
+ sha256
38
+ .convert(
39
+ utf8.encode(NmsInternalValueIdentity.canonical(v['value'])))
40
+ .toString(),
41
+ v['sha256'],
42
+ reason: v['name'] as String);
43
+ }
44
+ });
45
+
46
+ test('judges equality like the law', () {
47
+ for (final e
48
+ in (file['equalities']! as List).cast<Map<String, Object?>>()) {
49
+ expect(NmsInternalValueIdentity.equals(e['a'], e['b']), e['equal'],
50
+ reason: e['name'] as String);
51
+ if (e['equal'] == true)
52
+ expect(NmsInternalValueIdentity.hash(e['a']),
53
+ NmsInternalValueIdentity.hash(e['b']),
54
+ reason: e['name'] as String);
55
+ }
56
+ });
57
+
58
+ test('refuses what the law refuses without a descriptor', () {
59
+ for (final r in (file['refusals']! as List)
60
+ .cast<Map<String, Object?>>()
61
+ .where((r) => r['generic'] == true)) {
62
+ expect(() => NmsInternalValueIdentity.canonical(r['value']),
63
+ throwsArgumentError,
64
+ reason: r['name'] as String);
65
+ // Equality stays total: a refused value still compares, and never equals an admissible one.
66
+ expect(NmsInternalValueIdentity.equals(r['value'], r['value']), isTrue);
67
+ }
68
+ for (final bad in [
69
+ double.nan,
70
+ double.infinity,
71
+ double.negativeInfinity,
72
+ 9007199254740992
73
+ ]) {
74
+ expect(() => NmsInternalValueIdentity.canonical({'x': bad}),
75
+ throwsArgumentError,
76
+ reason: '$bad');
77
+ }
78
+ expect(
79
+ NmsInternalValueIdentity.equals({'x': double.nan}, {'x': double.nan}),
80
+ isTrue);
81
+ });
82
+
83
+ test('a double read back integral is the same value as the authored int', () {
84
+ expect(
85
+ NmsInternalValueIdentity.equals(
86
+ {'x': 2, 'y': -0.0}, {'y': 0, 'x': 2.0}),
87
+ isTrue);
88
+ expect(NmsInternalValueIdentity.hash({'x': 2, 'y': -0.0}),
89
+ NmsInternalValueIdentity.hash({'y': 0, 'x': 2.0}));
90
+ });
91
+ }