@githolon/dsl 0.103.4 → 0.103.6

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 (40) hide show
  1. package/dart/CHANGELOG.md +8 -0
  2. package/dart/lib/src/runner/node-entry.mjs +333 -117
  3. package/dart/lib/src/runner/offline-install.mjs +173 -67
  4. package/dart/lib/src/session_bound.dart +111 -2
  5. package/dart/lib/src/test_harness.dart +51 -41
  6. package/dart/lib/src/webview_bridge.dart +714 -60
  7. package/dart/pubspec.lock +1 -1
  8. package/dart/pubspec.yaml +2 -2
  9. package/dart/test/acquire_session_test.dart +62 -5
  10. package/dart/test/cloud_bound_topology_test.dart +59 -38
  11. package/dart/test/session_bound_test.dart +25 -10
  12. package/dart/test/webview_bridge_test.dart +326 -7
  13. package/dart_types/CHANGELOG.md +5 -0
  14. package/dart_types/lib/nomos_types.dart +1 -0
  15. package/dart_types/lib/src/git_object_id.dart +37 -0
  16. package/dart_types/pubspec.yaml +1 -1
  17. package/package.json +1 -1
  18. package/runtime/generated-application-host.js +347 -113
  19. package/src/births.ts +16 -1
  20. package/src/business_birth.ts +55 -34
  21. package/src/codegen_dart.ts +68 -12
  22. package/src/codegen_dart_application.ts +114 -19
  23. package/src/codegen_dart_client.ts +149 -6
  24. package/src/codegen_proof.ts +16 -9
  25. package/src/codegen_provider_dart.ts +5 -0
  26. package/src/codegen_ts.ts +115 -19
  27. package/src/compile_package_main.ts +159 -43
  28. package/src/fields.ts +43 -0
  29. package/src/framework/domain_lifecycle.ts +108 -88
  30. package/src/framework/genesis.ts +2 -1
  31. package/src/framework/home.ts +6 -43
  32. package/src/framework/workspaces.ts +42 -25
  33. package/src/idof_lint.ts +65 -51
  34. package/src/index.ts +21 -1
  35. package/src/intent.ts +11 -1
  36. package/src/law_graph.ts +81 -11
  37. package/src/relation_schema.ts +18 -0
  38. package/src/shape_compat.ts +3 -0
  39. package/src/stable_ids_for_module.ts +7 -1
  40. package/src/value_object.ts +40 -0
@@ -46,7 +46,8 @@ import 'package:package_config/package_config.dart' show loadPackageConfigUri;
46
46
  import 'dev_cloud.dart';
47
47
  import 'node_runner_transport.dart';
48
48
  import 'session_bound.dart' show DomainNotInstalledForSession;
49
- import 'webview_bridge.dart' show NomosBridge, NomosSession;
49
+ import 'webview_bridge.dart'
50
+ show NomosBirthCertificateSpec, NomosBridge, NomosSession;
50
51
 
51
52
  enum _KernelRuntimeArtifact {
52
53
  executable('holon.wasm'),
@@ -714,7 +715,6 @@ class NomosTestHarness {
714
715
  'the offline application parent did not return the framework law, application law and test device needed to birth the signed-in application',
715
716
  );
716
717
  }
717
- final keyHash = sha256.convert(base64Decode(devicePublic)).toString();
718
718
  final bornAt = DateTime.now().toUtc().toIso8601String();
719
719
  await _phased(
720
720
  phase: 'application: establish the parent birth policy',
@@ -751,7 +751,6 @@ class NomosTestHarness {
751
751
  authorSecret: deviceSecret,
752
752
  payload: <String, Object?>{
753
753
  'owner': owner,
754
- 'ownerKeyHash': keyHash,
755
754
  'frameworkHash': framework,
756
755
  // Ordered application deployment is reference packages first, deferred child payload last.
757
756
  // The parent serves the references; the receiving group is born with only its payload law.
@@ -862,14 +861,16 @@ class NomosTestHarness {
862
861
  );
863
862
  },
864
863
  );
865
- final parentCert = await plane.signBirthCert(<String, Object?>{
866
- 'child': workspace,
867
- 'founder': owner,
868
- 'verified': true,
869
- 'parentKey': devicePublic,
870
- 'parentId': 'root',
871
- 'epoch': 0,
872
- }, deviceSecret);
864
+ final parentCert = await plane.signBirthCert(
865
+ NomosBirthCertificateSpec(
866
+ child: workspace,
867
+ founder: owner,
868
+ verified: true,
869
+ parentKey: devicePublic,
870
+ parentId: 'root',
871
+ epoch: 0,
872
+ ),
873
+ deviceSecret);
873
874
  await _phased(
874
875
  phase: 'owner: establish the verified test application root',
875
876
  workspace: workspace,
@@ -890,7 +891,7 @@ class NomosTestHarness {
890
891
  'parentKey': devicePublic,
891
892
  'epoch': 0,
892
893
  'certChain': jsonEncode(<String, Object?>{
893
- 'links': <Object?>[parentCert],
894
+ 'links': <Object?>[parentCert.toWire()],
894
895
  }),
895
896
  },
896
897
  );
@@ -1725,8 +1726,7 @@ class NomosTestHarness {
1725
1726
  // 5/6 — THE HOME CEREMONY. Author the birth in the already-mounted PARENT kernel, then sync its sealed
1726
1727
  // intent to the remote parent where the same offer gate replays it. The HTTP host never receives
1727
1728
  // business fields or a signing secret and has no birth-authoring lane. The offer carries the
1728
- // device-signed homeCert + the owner's device keyHash (the home's genesis ENROLS it, so the born
1729
- // home is SIGNER-READY — it can birth its own estates/catalogues from intent 0).
1729
+ // typed device-signed certificate. The kernel derives and enrolls the founding signer from it.
1730
1730
  String? home;
1731
1731
  await _phased(
1732
1732
  phase: '5/6: remote home-birth ceremony (attested)',
@@ -1741,31 +1741,33 @@ class NomosTestHarness {
1741
1741
  // platform session explicitly; relying on the single-session convenience API becomes
1742
1742
  // ambiguous as soon as the ceremony correctly opens the target workspace in-kernel.
1743
1743
  final homeCert =
1744
- await plane.session('$clientId-platform-author').signBirthCert({
1745
- 'child': homeName,
1746
- 'founder': subject,
1747
- // The cert's `verified` must MATCH the gate verdict (CAS-as-law): the offer carries the
1748
- // dev-IdP token, so the gate resolves a VERIFIED founder.
1749
- 'verified': true,
1750
- 'parentKey': device.publicB64,
1751
- 'parentId': platformWorkspace,
1752
- 'epoch': 0,
1753
- }, device.secret);
1744
+ await plane.session('$clientId-platform-author').signBirthCert(
1745
+ NomosBirthCertificateSpec(
1746
+ child: homeName,
1747
+ founder: subject,
1748
+ // The cert's `verified` must MATCH the gate verdict (CAS-as-law): the offer carries
1749
+ // the dev-IdP token, so the gate resolves a VERIFIED founder.
1750
+ verified: true,
1751
+ parentKey: device.publicB64,
1752
+ parentId: platformWorkspace,
1753
+ epoch: 0,
1754
+ ),
1755
+ device.secret,
1756
+ );
1754
1757
  final localBirth =
1755
1758
  await plane.session('$clientId-platform-author').offerOutcome(
1756
- domain: applicationHomeDomain,
1757
- directiveId: 'nomosInternalBirthReceivingGroup7c1f5e',
1758
- actor: subject,
1759
- authorSecret: device.secret,
1760
- payload: <String, Object?>{
1761
- 'owner': subject,
1762
- 'ownerKeyHash': device.keyHash,
1763
- 'frameworkHash': frameworkHash,
1764
- 'lawHash': applicationHomeLawHash,
1765
- 'bornAt': DateTime.now().toUtc().toIso8601String(),
1766
- 'homeCert': jsonEncode(homeCert),
1767
- },
1768
- );
1759
+ domain: applicationHomeDomain,
1760
+ directiveId: 'nomosInternalBirthReceivingGroup7c1f5e',
1761
+ actor: subject,
1762
+ authorSecret: device.secret,
1763
+ payload: <String, Object?>{
1764
+ 'owner': subject,
1765
+ 'frameworkHash': frameworkHash,
1766
+ 'lawHash': applicationHomeLawHash,
1767
+ 'bornAt': DateTime.now().toUtc().toIso8601String(),
1768
+ },
1769
+ birthCertificate: homeCert,
1770
+ );
1769
1771
  if (!localBirth.born.contains(homeName)) {
1770
1772
  throw NomosTestHarnessException(
1771
1773
  'cloudBound: the local parent kernel admitted the receiving-group offer but did not birth '
@@ -1815,12 +1817,22 @@ class NomosTestHarness {
1815
1817
  // A PRIVATE home (declared read caps — co2's shape) serves its ledger only to a VERIFIED
1816
1818
  // principal: ride the caller's token when given, else the dev-IdP token the ceremony minted.
1817
1819
  authToken: authToken ?? device.idpToken,
1818
- // The home was born WARRANTED with THIS device enrolled in its genesis (ownerKeyHash) —
1820
+ // The home was born WARRANTED with THIS device enrolled by the kernel-owned attestation step —
1819
1821
  // connect with the same key so every write is signed and the home's own `.births()` offers
1820
1822
  // (estates/catalogues) are device-attested (the client signs the birth cert automatically).
1821
1823
  authorSecret: device.secret,
1822
1824
  ),
1823
1825
  );
1826
+ // A cloud-bound generated application owns continuous convergence from the moment its home is
1827
+ // mounted. Starting it here makes the harness exercise the product lifecycle: local writes flush,
1828
+ // transport debt survives a partition, and reconnect settles exact operation receipts without tenant
1829
+ // code calling sync(). Child sessions take the same path in acquireSession().
1830
+ final applicationSession = plane.session(home!);
1831
+ applicationSession.nomosInternalRetainCloudAccess(
1832
+ cloud: cloud.origin,
1833
+ signIn: () async => authToken ?? device.idpToken,
1834
+ );
1835
+ await applicationSession.autoSync(fallbackMs: 60000);
1824
1836
  // NO DECOY on a cloudBound harness: the app is genuinely multi-workspace (the home plus every
1825
1837
  // locally-born child), so the plane is never sole-session — the decoy the offline harness
1826
1838
  // needs (to break single-session inference) would just be a spurious local-only workspace here.
@@ -1833,9 +1845,7 @@ class NomosTestHarness {
1833
1845
  workdir,
1834
1846
  onDiagnostic,
1835
1847
  [home!],
1836
- // The owner's device (enrolled in the home's genesis via ownerKeyHash) — the app derives the
1837
- // keyHash for its own `.births()` payloads from [devicePublicKey] and signs locally-born-child
1838
- // sessions with [deviceSecret].
1848
+ // The owner's device (enrolled by the typed birth attestation) signs later child births locally.
1839
1849
  devicePublics: {home!: device.publicB64},
1840
1850
  deviceSecrets: {home!: device.secret},
1841
1851
  frameworkHash: frameworkHash,