@githolon/dsl 0.101.5 → 0.102.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 (120) hide show
  1. package/dart/CHANGELOG.md +13 -0
  2. package/dart/lib/nomos_client.dart +3 -52
  3. package/dart/lib/src/dev_cloud.dart +5 -0
  4. package/dart/lib/src/home.dart +10 -15
  5. package/dart/lib/src/nms_conformance_runtime.dart +12 -0
  6. package/dart/lib/src/nms_generated_runtime.dart +29 -0
  7. package/dart/lib/src/nms_test_environment.dart +8 -0
  8. package/dart/lib/src/node_runner_transport.dart +56 -18
  9. package/dart/lib/src/provider.dart +5 -1
  10. package/dart/lib/src/record_origin.dart +55 -0
  11. package/dart/lib/src/runner/node-entry.mjs +9105 -0
  12. package/dart/lib/src/runner/offline-install.mjs +4729 -0
  13. package/dart/lib/src/session_bound.dart +23 -10
  14. package/dart/lib/src/source_trust.dart +51 -0
  15. package/dart/lib/src/test_harness.dart +490 -58
  16. package/dart/lib/src/webview_bridge.dart +167 -58
  17. package/dart/lib/src/workspace_name.dart +7 -1
  18. package/dart/pubspec.lock +3 -3
  19. package/dart/pubspec.yaml +4 -2
  20. package/dart/test/acquire_session_credentials_test.dart +34 -17
  21. package/dart/test/acquire_session_test.dart +109 -24
  22. package/dart/test/adv_realm_interference_test.dart +227 -99
  23. package/dart/test/bundle_version_pairing_test.dart +1 -1
  24. package/dart/test/cloud_bound_topology_test.dart +1 -1
  25. package/dart/test/cluster_attested_test.dart +52 -35
  26. package/dart/test/cluster_births_test.dart +5 -2
  27. package/dart/test/cluster_device_keyed_acceptance_test.dart +5 -2
  28. package/dart/test/cluster_local_autosync_test.dart +5 -2
  29. package/dart/test/cluster_scale_test.dart +5 -2
  30. package/dart/test/compat_test.dart +1 -1
  31. package/dart/test/dlq_session_surface_test.dart +2 -1
  32. package/dart/test/errors_test.dart +1 -1
  33. package/dart/test/first_app_gauntlet_test.dart +78 -51
  34. package/dart/test/four_layer_nested_topology_test.dart +1 -1
  35. package/dart/test/harness_phase_timeout_test.dart +1 -1
  36. package/dart/test/home_parity_test.dart +9 -5
  37. package/dart/test/local_sync_inert_test.dart +22 -14
  38. package/dart/test/node_runner_transport_test.dart +9 -5
  39. package/dart/test/null_slot_test.dart +1 -1
  40. package/dart/test/parent_signer_recovery_test.dart +5 -2
  41. package/dart/test/schema_validation_test.dart +1 -1
  42. package/dart/test/sealing_client_test.dart +2 -1
  43. package/dart/test/session_bound_test.dart +92 -119
  44. package/dart/test/stale_bundle_test.dart +1 -1
  45. package/dart/test/test_harness_test.dart +77 -22
  46. package/dart/test/vo_read_typing_test.dart +32 -14
  47. package/dart/test/watch_after_offer_stall_test.dart +2 -1
  48. package/dart/test/webview_bridge_test.dart +17 -4
  49. package/dart/test/wire_test.dart +1 -1
  50. package/dart_types/CHANGELOG.md +8 -0
  51. package/dart_types/lib/nomos_types.dart +7 -6
  52. package/dart_types/lib/src/activity.dart +23 -13
  53. package/dart_types/lib/src/foreign_ref.dart +61 -112
  54. package/dart_types/lib/src/invitation.dart +96 -0
  55. package/dart_types/lib/src/nomos_ref.dart +97 -59
  56. package/dart_types/pubspec.yaml +1 -1
  57. package/dart_types/test/surfaced_test.dart +125 -19
  58. package/package.json +7 -3
  59. package/runtime/generated-application-host.js +8851 -0
  60. package/src/activity.ts +2 -2
  61. package/src/aggregate.ts +24 -1
  62. package/src/application_composition.ts +282 -0
  63. package/src/application_topology.ts +151 -0
  64. package/src/attested_core.ts +2 -2
  65. package/src/authoring_context.ts +9 -0
  66. package/src/birth_meter_ensure.ts +1 -1
  67. package/src/births.ts +53 -5
  68. package/src/build_package.ts +79 -71
  69. package/src/business_birth.ts +93 -10
  70. package/src/clear_directive.ts +3 -1
  71. package/src/codegen_dart.ts +369 -420
  72. package/src/codegen_dart_application.ts +1508 -0
  73. package/src/codegen_dart_client.ts +156 -95
  74. package/src/codegen_dart_scenario.ts +299 -0
  75. package/src/codegen_openapi.ts +8 -3
  76. package/src/codegen_proof.ts +1113 -1137
  77. package/src/codegen_provider_dart.ts +12 -1
  78. package/src/codegen_ts.ts +1176 -496
  79. package/src/compat_package_main.ts +22 -10
  80. package/src/compile_package_main.ts +1536 -337
  81. package/src/contract.ts +10 -4
  82. package/src/dart_barrel_guard.ts +5 -1
  83. package/src/describe_model.ts +13 -5
  84. package/src/directive.ts +244 -5
  85. package/src/engine_entry.ts +56 -13
  86. package/src/engine_javascript.ts +31 -0
  87. package/src/evolve_preview.ts +3 -12
  88. package/src/framework/application_home.ts +24 -10
  89. package/src/framework/capability.ts +15 -1
  90. package/src/framework/domain_lifecycle.ts +8 -0
  91. package/src/framework/framework_aggregates.ts +2 -2
  92. package/src/framework/genesis.ts +11 -1
  93. package/src/framework/home.ts +178 -75
  94. package/src/framework/impure_capability.ts +24 -7
  95. package/src/framework/relations.ts +13 -5
  96. package/src/framework/workspaces.ts +13 -12
  97. package/src/generated_client_names.ts +42 -3
  98. package/src/idof_lint.ts +65 -13
  99. package/src/index.ts +46 -12
  100. package/src/intent.ts +587 -0
  101. package/src/law_check.ts +64 -16
  102. package/src/precondition.ts +16 -4
  103. package/src/read_projection_namespace.ts +2 -7
  104. package/src/recipient.ts +33 -0
  105. package/src/relation_schema.ts +93 -0
  106. package/src/secondary_ensure.ts +11 -2
  107. package/src/shape_compat.ts +11 -1
  108. package/src/usd.ts +30 -8
  109. package/src/usd_layers.ts +447 -246
  110. package/src/usd_state.ts +1 -1
  111. package/src/value_object.ts +49 -13
  112. package/src/wire_encode.ts +124 -26
  113. package/src/workspace_sharing.ts +269 -0
  114. package/src/zod_introspection.ts +84 -0
  115. package/dart/example/nomos_secure_key_store.dart +0 -82
  116. package/dart/example/nomos_webview_transport.dart +0 -63
  117. package/dart/lib/nomos_headless.dart +0 -50
  118. package/dart/lib/testing.dart +0 -14
  119. package/dart/test/co2_product_gauntlet_test.dart +0 -244
  120. package/src/framework/identity.ts +0 -537
@@ -21,8 +21,11 @@
21
21
  /// * [DomainNotInstalledForSession] — the context-rich replacement for the kernel's generic
22
22
  /// "no active installed law declares domain 'x'" refusal, thrown wherever that error used to
23
23
  /// surface (bridge dispatch, birth lanes) with the full session context.
24
+ @internal
24
25
  library;
25
26
 
27
+ import 'package:meta/meta.dart' show internal;
28
+
26
29
  import 'dart:convert';
27
30
 
28
31
  import 'webview_bridge.dart';
@@ -221,15 +224,18 @@ extension NomosSessionCompat on NomosSession {
221
224
  // co2 blocker #2: a PROJECTION READ FAILURE (an unmountable/failing query shape — the runner surfaces
222
225
  // `nomos.projection.read_failed` carrying the failed query) is NOT "not reachable" and MUST NOT be
223
226
  // reclassified as trulyNotDeployed downstream — surface it as its own cause with the real fault text.
224
- final isProjectionFault = e.toString().contains('nomos.projection.read_failed') ||
225
- e.toString().contains('projection read failed');
227
+ final isProjectionFault =
228
+ e.toString().contains('nomos.projection.read_failed') ||
229
+ e.toString().contains('projection read failed');
226
230
  throw DomainClientSessionMismatch(
227
231
  expectedDomainKey: iface.domain,
228
232
  expectedDomainHash: iface.expectedDomainHash,
229
233
  expectedInterfaceHash: iface.expectedInterfaceHash,
230
234
  sessionId: workspace,
231
235
  sessionWorkspace: workspace,
232
- cause: isProjectionFault ? SessionMismatchCause.projectionReadFailed : null,
236
+ cause: isProjectionFault
237
+ ? SessionMismatchCause.projectionReadFailed
238
+ : null,
233
239
  hint: isProjectionFault
234
240
  ? 'the workspace law could NOT be READ — a projection/mount failure (NOT undeployed law): $e'
235
241
  : 'the session workspace is not reachable/mounted on this plane: $e',
@@ -244,7 +250,9 @@ extension NomosSessionCompat on NomosSession {
244
250
  (jsonDecode(iface.compatJson!) as Map).cast<String, Object?>(),
245
251
  iface.requirement);
246
252
  if (c != null) activeHashes = c.workspaceRuns;
247
- } catch (_) {/* diagnosis only — never fail the preflight on the hash axis */}
253
+ } catch (_) {
254
+ /* diagnosis only — never fail the preflight on the hash axis */
255
+ }
248
256
  }
249
257
 
250
258
  // 3. THE SHAPE AXIS (#72) — the one compatibility notion. No baked interface ⇒ nothing more to check.
@@ -272,19 +280,22 @@ extension NomosSessionCompat on NomosSession {
272
280
 
273
281
  final missing =
274
282
  ((verdict['missing'] as List?) ?? const []).map((e) => '$e').toList();
275
- final incompatible =
276
- ((verdict['incompatible'] as List?) ?? const []).map((e) => '$e').toList();
283
+ final incompatible = ((verdict['incompatible'] as List?) ?? const [])
284
+ .map((e) => '$e')
285
+ .toList();
277
286
 
278
287
  // 4. CLASSIFY the four causes (ask 9).
279
288
  SessionMismatchCause cause;
280
289
  String hint;
281
290
  if (incompatible.isNotEmpty) {
282
291
  cause = SessionMismatchCause.clientExpectsNewerInterface;
283
- hint = 'the domain is installed but type-divergent from what this client requires '
292
+ hint =
293
+ 'the domain is installed but type-divergent from what this client requires '
284
294
  '(${incompatible.join('; ')}) — recompile the client against the deployed law, or evolve the law';
285
295
  } else if (activeKeys.isNotEmpty && !activeKeys.contains(iface.domain)) {
286
296
  cause = SessionMismatchCause.wrongPackageMounted;
287
- hint = 'this workspace runs a DIFFERENT package (${activeKeys.join(', ')}) — '
297
+ hint =
298
+ 'this workspace runs a DIFFERENT package (${activeKeys.join(', ')}) — '
288
299
  'bind this client to the session whose workspace holds "${iface.domain}"';
289
300
  } else {
290
301
  // The domain (or its whole offer) is absent here. Stale-vs-never-deployed: if this session is
@@ -300,11 +311,13 @@ extension NomosSessionCompat on NomosSession {
300
311
  } catch (_) {/* best-effort */}
301
312
  if (cloudBound && behind > 0) {
302
313
  cause = SessionMismatchCause.liveCloudHasLawButLocalStale;
303
- hint = 'local custody is $behind commit(s) behind its cloud — sync/pull, then re-bind '
314
+ hint =
315
+ 'local custody is $behind commit(s) behind its cloud — sync/pull, then re-bind '
304
316
  '(missing: ${missing.join('; ')})';
305
317
  } else {
306
318
  cause = SessionMismatchCause.trulyNotDeployed;
307
- hint = 'no installed law on this workspace declares "${iface.domain}" — '
319
+ hint =
320
+ 'no installed law on this workspace declares "${iface.domain}" — '
308
321
  'deploy the domain package first (missing: ${missing.join('; ')})';
309
322
  }
310
323
  }
@@ -0,0 +1,51 @@
1
+ @internal
2
+ library;
3
+
4
+ import 'package:meta/meta.dart' show internal;
5
+
6
+ import 'dart:convert';
7
+
8
+ import 'package:crypto/crypto.dart';
9
+
10
+ /// Private support for generated business actions that consume an attested
11
+ /// record from another application. Tenant packages never export this type.
12
+ final class NmsInternalSourceTrust {
13
+ const NmsInternalSourceTrust._();
14
+
15
+ static Map<String, Object?> entry(Map<String, Object?> served) {
16
+ final raw = served['entry'] ?? served;
17
+ if (raw is! Map) {
18
+ throw StateError(
19
+ 'Nomos source did not return an attested business record.');
20
+ }
21
+ return raw.cast<String, Object?>();
22
+ }
23
+
24
+ static Map<String, Object?> attestation(Map<String, Object?> entry) {
25
+ final raw = entry['attestation'];
26
+ if (raw is! Map) {
27
+ throw StateError('Nomos source omitted its signed identity.');
28
+ }
29
+ return raw.cast<String, Object?>();
30
+ }
31
+
32
+ static String genesis(Map<String, Object?> attestation) {
33
+ final value = (attestation['source_genesis'] ?? '').toString();
34
+ if (value.isEmpty) {
35
+ throw StateError('Nomos source omitted its genesis identity.');
36
+ }
37
+ return value;
38
+ }
39
+
40
+ static String keyHash(Map<String, Object?> attestation) {
41
+ final publicKey = (attestation['public_key'] ?? '').toString();
42
+ if (publicKey.isEmpty) {
43
+ throw StateError('Nomos source omitted its attestation key.');
44
+ }
45
+ try {
46
+ return sha256.convert(base64.decode(publicKey)).toString();
47
+ } on FormatException {
48
+ throw StateError('Nomos source returned an invalid attestation key.');
49
+ }
50
+ }
51
+ }