@githolon/dsl 0.108.6 → 0.110.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 (307) hide show
  1. package/assets/operation-contract.wasm +0 -0
  2. package/check_package.mjs +12 -15
  3. package/compile_package.mjs +17 -18
  4. package/compile_proof.mjs +16 -1
  5. package/dart/CHANGELOG.md +76 -1
  6. package/dart/README.md +25 -2
  7. package/dart/lib/src/admission_decision.dart +41 -0
  8. package/dart/lib/src/application_framework_calls.dart +52 -2
  9. package/dart/lib/src/application_model_adoption.dart +187 -0
  10. package/dart/lib/src/application_status.dart +73 -0
  11. package/dart/lib/src/console_enrolment.dart +271 -0
  12. package/dart/lib/src/console_http_io.dart +26 -0
  13. package/dart/lib/src/console_http_stub.dart +7 -0
  14. package/dart/lib/src/dev_cloud.dart +69 -22
  15. package/dart/lib/src/generated_call.dart +83 -23
  16. package/dart/lib/src/kernel_primitives.dart +119 -0
  17. package/dart/lib/src/nms_conformance_runtime.dart +1 -1
  18. package/dart/lib/src/nms_generated_runtime.dart +32 -10
  19. package/dart/lib/src/nms_test_environment.dart +1 -1
  20. package/dart/lib/src/node_runner_transport.dart +41 -46
  21. package/dart/lib/src/observed_session_directory.dart +70 -0
  22. package/dart/lib/src/operation_receipts.dart +112 -0
  23. package/dart/lib/src/peer_application_streams.dart +103 -0
  24. package/dart/lib/src/reception/dart_reception.dart +4280 -0
  25. package/dart/lib/src/reception/event_desk.dart +211 -0
  26. package/dart/lib/src/reception/extremum_read.dart +46 -0
  27. package/dart/lib/src/reception/local_copies.dart +371 -0
  28. package/dart/lib/src/reception/peer_office_connection.dart +11 -0
  29. package/dart/lib/src/reception/progress_desk.dart +267 -0
  30. package/dart/lib/src/reception/reception_contract.dart +11 -0
  31. package/dart/lib/src/reception/reception_session.dart +284 -0
  32. package/dart/lib/src/reception/sync_diagnostics.dart +26 -0
  33. package/dart/lib/src/reception/workspace_preparation_report.dart +126 -0
  34. package/dart/lib/src/replica_readiness.dart +123 -0
  35. package/dart/lib/src/runner/node-entry.mjs +23905 -15774
  36. package/dart/lib/src/runtime_v2_gateway.dart +56 -3
  37. package/dart/lib/src/runtime_v2_transport.dart +544 -3
  38. package/dart/lib/src/session_bound.dart +200 -311
  39. package/dart/lib/src/signing_identity_kernel.dart +84 -0
  40. package/dart/lib/src/sync_status_projection.dart +548 -0
  41. package/dart/lib/src/sync_status_reducer.dart +170 -0
  42. package/dart/lib/src/test_harness.dart +809 -1153
  43. package/dart/lib/src/testing/test_custody.dart +66 -0
  44. package/dart/lib/src/testing/test_peer.dart +328 -0
  45. package/dart/lib/src/typed_watch_registry.dart +169 -0
  46. package/dart/lib/src/workspace_open_progress.dart +27 -0
  47. package/dart/pubspec.lock +24 -1
  48. package/dart/pubspec.yaml +7 -2
  49. package/dart/pubspec_overrides.yaml +2 -0
  50. package/dart/test/admission_decision_test.dart +48 -0
  51. package/dart/test/background_model_adoption_test.dart +228 -0
  52. package/dart/test/bundle_version_pairing_test.dart +4 -4
  53. package/dart/test/child_authentication_repair_test.dart +359 -0
  54. package/dart/test/cloud_bound_local_shell_test.dart +119 -0
  55. package/dart/test/console_enrolment_refusal_test.dart +52 -0
  56. package/dart/test/console_enrolment_test.dart +227 -0
  57. package/dart/test/errors_test.dart +5 -5
  58. package/dart/test/event_plane_seam_test.dart +50 -164
  59. package/dart/test/extremum_read_test.dart +58 -0
  60. package/dart/test/fixtures/wedge/wedge-entry.mjs +3 -21
  61. package/dart/test/generated_query_test.dart +32 -0
  62. package/dart/test/harness_phase_timeout_test.dart +18 -23
  63. package/dart/test/kernel_author_after_read_test.dart +242 -0
  64. package/dart/test/kernel_fence_test.dart +137 -0
  65. package/dart/test/local_copies_test.dart +222 -0
  66. package/dart/test/model_adoption_test.dart +198 -0
  67. package/dart/test/node_peer_local_custody_test.dart +153 -0
  68. package/dart/test/offer_authentication_proof_test.dart +352 -52
  69. package/dart/test/operation_compatibility_test.dart +151 -0
  70. package/dart/test/platform_credential_effect_test.dart +386 -0
  71. package/dart/test/receiving_group_open_test.dart +213 -0
  72. package/dart/test/reception/workspace_preparation_report_test.dart +103 -0
  73. package/dart/test/reception_span_trace_test.dart +23 -0
  74. package/dart/test/replica_readiness_test.dart +156 -0
  75. package/dart/test/runtime_projections_test.dart +92 -0
  76. package/dart/test/runtime_v2_gateway_test.dart +131 -0
  77. package/dart/test/signing_identity_kernel_test.dart +75 -0
  78. package/dart/test/sync_status_preparation_report_test.dart +29 -0
  79. package/dart/test/sync_status_reducer_test.dart +419 -0
  80. package/dart/test/test_harness_test.dart +71 -95
  81. package/dart/test/typed_query_watch_test.dart +170 -0
  82. package/dart/test/typed_watch_registry_test.dart +249 -0
  83. package/dart_lints/README.md +18 -0
  84. package/dart_lints/lib/nomos_lints.dart +70 -0
  85. package/dart_lints/pubspec.lock +580 -0
  86. package/dart_lints/pubspec.yaml +12 -0
  87. package/dart_lints/test/reference_identity_test.dart +75 -0
  88. package/dart_types/CHANGELOG.md +18 -0
  89. package/dart_types/lib/nomos_kernel_protocol.dart +21 -1
  90. package/dart_types/lib/nomos_types.dart +9 -1
  91. package/dart_types/lib/src/admission_decision.dart +37 -0
  92. package/dart_types/lib/src/aggregate_meta.dart +1 -1
  93. package/dart_types/lib/src/approved_model.dart +65 -0
  94. package/dart_types/lib/src/custody.dart +10 -18
  95. package/dart_types/lib/src/error_info.dart +4 -4
  96. package/dart_types/lib/src/errors.dart +29 -29
  97. package/dart_types/lib/src/foreign_ref.dart +62 -33
  98. package/dart_types/lib/src/local_work_rejected.dart +3 -3
  99. package/dart_types/lib/src/nomos_ref.dart +3 -1
  100. package/dart_types/lib/src/principal.dart +2 -2
  101. package/dart_types/lib/src/proto/google/protobuf/any.pb.dart +163 -0
  102. package/dart_types/lib/src/proto/google/protobuf/any.pbenum.dart +11 -0
  103. package/dart_types/lib/src/proto/nomos/discovery/v1/workspace_placement.pb.dart +137 -0
  104. package/dart_types/lib/src/proto/nomos/discovery/v1/workspace_placement.pbenum.dart +11 -0
  105. package/dart_types/lib/src/proto/nomos/kernel/v1/kernel.pb.dart +20721 -10433
  106. package/dart_types/lib/src/proto/nomos/kernel/v1/kernel.pbenum.dart +555 -27
  107. package/dart_types/lib/src/proto/nomos/runtime/v2/application_desk.pb.dart +387 -0
  108. package/dart_types/lib/src/proto/nomos/runtime/v2/application_desk.pbenum.dart +46 -0
  109. package/dart_types/lib/src/proto/nomos/runtime/v2/application_readiness_desk.pb.dart +295 -0
  110. package/dart_types/lib/src/proto/nomos/runtime/v2/application_readiness_desk.pbenum.dart +139 -0
  111. package/dart_types/lib/src/proto/nomos/runtime/v2/authentication_desk.pb.dart +269 -0
  112. package/dart_types/lib/src/proto/nomos/runtime/v2/authentication_desk.pbenum.dart +103 -0
  113. package/dart_types/lib/src/proto/nomos/runtime/v2/compatibility_desk.pb.dart +417 -0
  114. package/dart_types/lib/src/proto/nomos/runtime/v2/compatibility_desk.pbenum.dart +62 -0
  115. package/dart_types/lib/src/proto/nomos/runtime/v2/correspondence_desk.pb.dart +9968 -0
  116. package/dart_types/lib/src/proto/nomos/runtime/v2/correspondence_desk.pbenum.dart +133 -0
  117. package/dart_types/lib/src/proto/nomos/runtime/v2/credentials_desk.pb.dart +204 -0
  118. package/dart_types/lib/src/proto/nomos/runtime/v2/credentials_desk.pbenum.dart +54 -0
  119. package/dart_types/lib/src/proto/nomos/runtime/v2/custody_desk.pb.dart +1550 -0
  120. package/dart_types/lib/src/proto/nomos/runtime/v2/custody_desk.pbenum.dart +11 -0
  121. package/dart_types/lib/src/proto/nomos/runtime/v2/framework.pb.dart +710 -0
  122. package/dart_types/lib/src/proto/nomos/runtime/v2/framework.pbenum.dart +11 -0
  123. package/dart_types/lib/src/proto/nomos/runtime/v2/identity_desk.pb.dart +845 -0
  124. package/dart_types/lib/src/proto/nomos/runtime/v2/identity_desk.pbenum.dart +11 -0
  125. package/dart_types/lib/src/proto/nomos/runtime/v2/interaction_desk.pb.dart +198 -0
  126. package/dart_types/lib/src/proto/nomos/runtime/v2/interaction_desk.pbenum.dart +11 -0
  127. package/dart_types/lib/src/proto/nomos/runtime/v2/law_desk.pb.dart +369 -0
  128. package/dart_types/lib/src/proto/nomos/runtime/v2/law_desk.pbenum.dart +11 -0
  129. package/dart_types/lib/src/proto/nomos/runtime/v2/maintenance_desk.pb.dart +609 -0
  130. package/dart_types/lib/src/proto/nomos/runtime/v2/maintenance_desk.pbenum.dart +65 -0
  131. package/dart_types/lib/src/proto/nomos/runtime/v2/model_adoption_desk.pb.dart +358 -0
  132. package/dart_types/lib/src/proto/nomos/runtime/v2/model_adoption_desk.pbenum.dart +100 -0
  133. package/dart_types/lib/src/proto/nomos/runtime/v2/observability_desk.pb.dart +2231 -0
  134. package/dart_types/lib/src/proto/nomos/runtime/v2/observability_desk.pbenum.dart +271 -0
  135. package/dart_types/lib/src/proto/nomos/runtime/v2/placement_desk.pb.dart +1286 -0
  136. package/dart_types/lib/src/proto/nomos/runtime/v2/placement_desk.pbenum.dart +11 -0
  137. package/dart_types/lib/src/proto/nomos/runtime/v2/receiving_group_desk.pb.dart +636 -0
  138. package/dart_types/lib/src/proto/nomos/runtime/v2/receiving_group_desk.pbenum.dart +116 -0
  139. package/dart_types/lib/src/proto/nomos/runtime/v2/records_desk.pb.dart +1637 -0
  140. package/dart_types/lib/src/proto/nomos/runtime/v2/records_desk.pbenum.dart +175 -0
  141. package/dart_types/lib/src/proto/nomos/runtime/v2/recovery_desk.pb.dart +1269 -0
  142. package/dart_types/lib/src/proto/nomos/runtime/v2/recovery_desk.pbenum.dart +129 -0
  143. package/dart_types/lib/src/proto/nomos/runtime/v2/residency_desk.pb.dart +2782 -0
  144. package/dart_types/lib/src/proto/nomos/runtime/v2/residency_desk.pbenum.dart +97 -0
  145. package/dart_types/lib/src/proto/nomos/runtime/v2/runtime.pb.dart +2232 -8627
  146. package/dart_types/lib/src/proto/nomos/runtime/v2/runtime.pbenum.dart +0 -358
  147. package/dart_types/lib/src/proto/nomos/runtime/v2/sealing_desk.pb.dart +1639 -0
  148. package/dart_types/lib/src/proto/nomos/runtime/v2/sealing_desk.pbenum.dart +46 -0
  149. package/dart_types/lib/src/runtime_outcome.dart +133 -0
  150. package/dart_types/lib/src/subscriptions.dart +116 -23
  151. package/dart_types/pubspec.yaml +1 -1
  152. package/dart_types/test/extremum_subscriptions_test.dart +40 -0
  153. package/dart_types/test/foreign_ref_resolution_test.dart +75 -0
  154. package/dart_types/test/nomos_ref_address_test.dart +25 -0
  155. package/dart_types/test/ordered_subscriptions_test.dart +34 -0
  156. package/operation_contract_check.mjs +24 -0
  157. package/package.json +11 -6
  158. package/src/aggregate.ts +70 -10
  159. package/src/application_topology.ts +18 -11
  160. package/src/attested.ts +3 -0
  161. package/src/attested_core.ts +46 -3
  162. package/src/birth_meter_ensure.ts +19 -7
  163. package/src/births.ts +29 -4
  164. package/src/build_package.ts +140 -13
  165. package/src/business_birth.ts +181 -4
  166. package/src/codegen_call_proto.ts +1274 -0
  167. package/src/codegen_call_usda.ts +49 -6
  168. package/src/codegen_dart.ts +79 -44
  169. package/src/codegen_dart_client.ts +458 -800
  170. package/src/{codegen_dart_application.ts → codegen_dart_facade.ts} +331 -582
  171. package/src/codegen_dart_framework_calls.ts +320 -37
  172. package/src/codegen_dart_indexed_variant.ts +159 -0
  173. package/src/codegen_dart_scenario.ts +42 -13
  174. package/src/codegen_proof.ts +3 -3
  175. package/src/codegen_provider_dart.ts +5 -0
  176. package/src/codegen_query_proto.ts +158 -0
  177. package/src/codegen_refusal.ts +189 -0
  178. package/src/codegen_result_proto.ts +931 -0
  179. package/src/codegen_result_usda.ts +4 -0
  180. package/src/codegen_ts.ts +464 -616
  181. package/src/codegen_workspace_access.ts +105 -0
  182. package/src/compatibility_graph.ts +759 -0
  183. package/src/compatibility_usda.ts +264 -0
  184. package/src/compile_package_main.ts +2083 -1248
  185. package/src/custody_placement.ts +156 -0
  186. package/src/custody_placement_usda.ts +91 -0
  187. package/src/decl_shapes.ts +21 -2
  188. package/src/describe_model.ts +1 -0
  189. package/src/directive.ts +59 -2
  190. package/src/drivers.ts +51 -0
  191. package/src/engine_entry.ts +52 -8
  192. package/src/evolve_preview.ts +11 -4
  193. package/src/exists.ts +2 -0
  194. package/src/fields.ts +75 -11
  195. package/src/flow_gate.ts +2 -1
  196. package/src/framework/application_home.ts +170 -18
  197. package/src/framework/attested_receipts.ts +8 -3
  198. package/src/framework/auth_provider_law.ts +169 -9
  199. package/src/framework/birth_certificate_law.ts +4 -0
  200. package/src/framework/capability.ts +34 -3
  201. package/src/framework/child_authentication.ts +346 -0
  202. package/src/framework/console_governance.ts +295 -0
  203. package/src/framework/delegated_roles.ts +301 -0
  204. package/src/framework/domain_lifecycle.ts +26 -13
  205. package/src/framework/founding_genesis.ts +193 -0
  206. package/src/framework/framework_aggregates.ts +1 -1
  207. package/src/framework/genesis.ts +6 -1
  208. package/src/framework/governance_relations.ts +19 -0
  209. package/src/framework/home.ts +5 -734
  210. package/src/framework/legacy/child_auth_provider_epoch.ts +73 -0
  211. package/src/framework/model_authority_repair.ts +116 -0
  212. package/src/framework/model_authority_seed.ts +185 -0
  213. package/src/framework/model_transition.ts +211 -0
  214. package/src/framework/owned_custody.ts +1 -1
  215. package/src/framework/principal_enrollment.ts +302 -0
  216. package/src/framework/receiving_group.ts +857 -0
  217. package/src/framework/receiving_group_recovery.ts +314 -0
  218. package/src/framework/relations.ts +4 -8
  219. package/src/framework/signing_identity.ts +242 -95
  220. package/src/framework/source_roster.ts +11 -5
  221. package/src/framework/workspace_access.ts +149 -0
  222. package/src/framework/workspace_invariant.ts +73 -52
  223. package/src/framework/workspaces.ts +407 -40
  224. package/src/framework_call_definitions.ts +32 -3
  225. package/src/generated_client_bundle_boundary.ts +97 -0
  226. package/src/generated_client_names.ts +1 -0
  227. package/src/identity_usda.ts +27 -0
  228. package/src/index.ts +183 -12
  229. package/src/indexed_variant.ts +83 -0
  230. package/src/intent.ts +173 -45
  231. package/src/law_check.ts +8 -5
  232. package/src/law_dependency_index.ts +231 -0
  233. package/src/law_graph.ts +508 -71
  234. package/src/law_graph_usda.ts +170 -24
  235. package/src/law_identity.ts +119 -81
  236. package/src/law_source_map.ts +4 -1
  237. package/src/law_units.ts +498 -0
  238. package/src/law_value_type.ts +7 -3
  239. package/src/member_authentication.ts +302 -0
  240. package/src/null_meta.ts +1 -1
  241. package/src/openusd_compiled_layer.ts +132 -0
  242. package/src/operation_contract_check.ts +31 -0
  243. package/src/ordered_read.ts +2 -1
  244. package/src/package_config.ts +33 -12
  245. package/src/package_dependencies.ts +1 -0
  246. package/src/plan_source_slice.ts +30 -1
  247. package/src/protobuf_field_number.ts +36 -0
  248. package/src/provenance_wire.ts +6 -0
  249. package/src/query.ts +2 -1
  250. package/src/read.ts +50 -0
  251. package/src/relation.ts +4 -1
  252. package/src/relation_schema.ts +15 -2
  253. package/src/report.ts +2 -2
  254. package/src/sqlite_computation_bundle.ts +78 -0
  255. package/src/sqlite_computed.ts +102 -0
  256. package/src/sqlite_counts.ts +154 -0
  257. package/src/sqlite_layout.ts +823 -0
  258. package/src/sqlite_reads.ts +275 -0
  259. package/src/sqlite_samples.ts +185 -0
  260. package/src/stable_id_identity_bridge.ts +1 -1
  261. package/src/stable_ids_for_module.ts +16 -4
  262. package/src/test_call_usda.ts +6 -6
  263. package/src/usda_relationship_integrity.ts +20 -3
  264. package/src/usda_text.ts +21 -1
  265. package/src/value_object.ts +81 -11
  266. package/src/wire.ts +22 -0
  267. package/src/wire_encode.ts +227 -20
  268. package/src/workspace_sharding.ts +15 -6
  269. package/src/workspace_sharing.ts +51 -49
  270. package/src/zod_introspection.ts +2 -0
  271. package/compat_package.mjs +0 -46
  272. package/dart/lib/src/home.dart +0 -15
  273. package/dart/lib/src/runner/offline-install.mjs +0 -15367
  274. package/dart/lib/src/source_trust.dart +0 -51
  275. package/dart/lib/src/webview_bridge.dart +0 -6540
  276. package/dart/lib/src/workspace_name.dart +0 -30
  277. package/dart/test/acquire_session_credentials_test.dart +0 -150
  278. package/dart/test/acquire_session_test.dart +0 -534
  279. package/dart/test/adv_realm_interference_test.dart +0 -600
  280. package/dart/test/cloud_bound_topology_test.dart +0 -168
  281. package/dart/test/cluster_births_test.dart +0 -202
  282. package/dart/test/cluster_device_keyed_acceptance_test.dart +0 -105
  283. package/dart/test/cluster_local_autosync_test.dart +0 -123
  284. package/dart/test/cluster_scale_test.dart +0 -122
  285. package/dart/test/compat_test.dart +0 -61
  286. package/dart/test/dlq_session_surface_test.dart +0 -222
  287. package/dart/test/first_app_gauntlet_test.dart +0 -386
  288. package/dart/test/fixtures/wedge/fake-install.mjs +0 -11
  289. package/dart/test/four_layer_nested_topology_test.dart +0 -290
  290. package/dart/test/home_parity_test.dart +0 -13
  291. package/dart/test/local_sync_inert_test.dart +0 -107
  292. package/dart/test/node_runner_transport_test.dart +0 -78
  293. package/dart/test/parent_signer_recovery_test.dart +0 -155
  294. package/dart/test/residency_refusal_test.dart +0 -49
  295. package/dart/test/sealing_client_test.dart +0 -181
  296. package/dart/test/session_bound_test.dart +0 -285
  297. package/dart/test/stale_bundle_test.dart +0 -80
  298. package/dart/test/vo_read_typing_test.dart +0 -131
  299. package/dart/test/watch_after_offer_stall_test.dart +0 -100
  300. package/dart/test/webview_bridge_test.dart +0 -1930
  301. package/dart/test/workspace_name_test.dart +0 -24
  302. package/runtime/generated-application-host.js +0 -22860
  303. package/src/codegen_query_usda.ts +0 -214
  304. package/src/compat_manifest.ts +0 -26
  305. package/src/compat_package_main.ts +0 -224
  306. package/src/shape_compat.ts +0 -352
  307. package/src/usd_state.ts +0 -505
Binary file
package/check_package.mjs CHANGED
@@ -6,10 +6,10 @@
6
6
 
7
7
  // `githolon check` launcher — the twin of `compile_package.mjs`: resolve `tsx`
8
8
  // (the caller's, else the DSL's own dependency) and run `src/check_package_main.ts`
9
- // under it (the main dynamically imports the caller's TS domain modules, which
10
- // needs the tsx ESM loader). Resolution goes through Node's resolver (createRequire),
11
- // NOT node_modules/.bin paths — hoisted/workspace installs put the bin shims elsewhere.
12
- import { execFileSync } from "node:child_process";
9
+ // through its ESM loader in this process (the main dynamically imports the caller's
10
+ // TS domain modules, which needs the tsx loader). Resolution goes through Node's
11
+ // resolver (createRequire), NOT node_modules/.bin paths — hoisted/workspace installs
12
+ // put the bin shims elsewhere.
13
13
  import { readFileSync } from "node:fs";
14
14
  import { createRequire } from "node:module";
15
15
  import path from "node:path";
@@ -32,15 +32,12 @@ if (!tsxDir) {
32
32
  console.error("githolon check: tsx not found — reinstall @githolon/dsl (tsx is one of its dependencies)");
33
33
  process.exit(1);
34
34
  }
35
- const tsxPkg = JSON.parse(readFileSync(path.join(tsxDir, "package.json"), "utf8"));
36
- const tsxBinRel = typeof tsxPkg.bin === "string" ? tsxPkg.bin : tsxPkg.bin?.tsx;
37
- const tsxCli = path.join(tsxDir, tsxBinRel ?? "dist/cli.mjs");
35
+ const tsxApi = JSON.parse(readFileSync(path.join(tsxDir, "package.json"), "utf8")).exports?.["./esm/api"];
36
+ const tsxApiEntry = path.join(
37
+ tsxDir,
38
+ (typeof tsxApi === "string" ? tsxApi : tsxApi?.import?.default ?? tsxApi?.import ?? tsxApi?.default) ?? "dist/esm/api/index.mjs"
39
+ );
38
40
 
39
- try {
40
- execFileSync(process.execPath, [tsxCli, MAIN, ...process.argv.slice(2)], {
41
- stdio: "inherit",
42
- cwd: process.cwd(),
43
- });
44
- } catch (e) {
45
- process.exit(e.status ?? 1);
46
- }
41
+ const { register } = await import(pathToFileURL(tsxApiEntry).href);
42
+ register();
43
+ await import(pathToFileURL(MAIN).href);
@@ -7,12 +7,13 @@
7
7
 
8
8
  // `nomos-compile` / `holon-compile` — the thin launcher: resolve `tsx` (the
9
9
  // caller's, else the DSL's own dependency) and run `src/compile_package_main.ts`
10
- // under it (the main dynamically imports the caller's TS domain modules, which
11
- // needs the tsx ESM loader). tsx is a regular dependency of @githolon/dsl, so a bare
12
- // `npx githolon compile` / `npx nomos-compile` works with zero devDependency setup.
13
- // Resolution goes through Node's resolver (createRequire), NOT node_modules/.bin
14
- // paths — hoisted/workspace installs put the bin shims elsewhere.
15
- import { execFileSync } from "node:child_process";
10
+ // through its ESM loader IN THIS PROCESS (the main dynamically imports the caller's
11
+ // TS domain modules, which needs the tsx loader). tsx is a regular dependency of
12
+ // @githolon/dsl, so a bare `npx githolon compile` / `npx nomos-compile` works with
13
+ // zero devDependency setup. Resolution goes through Node's resolver (createRequire),
14
+ // NOT node_modules/.bin paths — hoisted/workspace installs put the bin shims elsewhere.
15
+ // The former `tsx` CLI hop spawned two further node processes per compile (~0.25s
16
+ // of pure startup on every save); `tsImport` keeps one.
16
17
  import { existsSync, readFileSync } from "node:fs";
17
18
  import { createRequire } from "node:module";
18
19
  import path from "node:path";
@@ -76,16 +77,14 @@ if (!tsxDir) {
76
77
  console.error("nomos-compile: tsx not found — reinstall @githolon/dsl (tsx is one of its dependencies)");
77
78
  process.exit(1);
78
79
  }
79
- const tsxPkg = JSON.parse(readFileSync(path.join(tsxDir, "package.json"), "utf8"));
80
- const tsxBinRel = typeof tsxPkg.bin === "string" ? tsxPkg.bin : tsxPkg.bin?.tsx;
81
- const tsxCli = path.join(tsxDir, tsxBinRel ?? "dist/cli.mjs");
80
+ const tsxApi = JSON.parse(readFileSync(path.join(tsxDir, "package.json"), "utf8")).exports?.["./esm/api"];
81
+ const tsxApiEntry = path.join(
82
+ tsxDir,
83
+ (typeof tsxApi === "string" ? tsxApi : tsxApi?.import?.default ?? tsxApi?.import ?? tsxApi?.default) ?? "dist/esm/api/index.mjs"
84
+ );
82
85
 
83
- try {
84
- execFileSync(process.execPath, [tsxCli, MAIN, ...args], {
85
- stdio: "inherit",
86
- cwd: process.cwd(),
87
- env: process.env,
88
- });
89
- } catch (e) {
90
- process.exit(e.status ?? 1);
91
- }
86
+ // Global hooks (not a namespaced `tsImport`): the compiler's `import.meta.url` and every
87
+ // `createRequire` must stay plain file URLs, exactly as under the tsx CLI.
88
+ const { register } = await import(pathToFileURL(tsxApiEntry).href);
89
+ register();
90
+ await import(pathToFileURL(MAIN).href);
package/compile_proof.mjs CHANGED
@@ -70,7 +70,17 @@ function inventoryIdentity(kind, entries) {
70
70
 
71
71
  function dependencyPackageFiles(dslDir, cwd) {
72
72
  const files = [];
73
- for (const name of ["esbuild", "tsx", "typescript", "zod"]) {
73
+ // These packages contribute executable bytes or generated bindings to compiler output.
74
+ // Omitting @bufbuild here let an unchanged proof reuse operator bundles produced by an
75
+ // older Protobuf runtime, even though the newly generated application used the newer one.
76
+ for (const name of [
77
+ "@bufbuild/protobuf",
78
+ "@bufbuild/protoc-gen-es",
79
+ "esbuild",
80
+ "tsx",
81
+ "typescript",
82
+ "zod",
83
+ ]) {
74
84
  for (const base of [cwd, dslDir]) {
75
85
  try {
76
86
  const request = createRequire(pathToFileURL(path.join(base, "noop.js")));
@@ -87,6 +97,9 @@ function dependencyPackageFiles(dslDir, cwd) {
87
97
  export function compileInputs({ cwd, dslDir, configPath, argumentIdentity }) {
88
98
  const authoring = inventory([
89
99
  configPath,
100
+ // An operator may compile an absolute project path from a different repo.
101
+ // Its sibling sources are inputs too; cwd alone can falsely certify stale law.
102
+ ...walk(path.dirname(path.resolve(configPath)), (file) => INPUT_EXTENSIONS.has(path.extname(file)), { excludeDefaultBuild: true }),
90
103
  ...walk(cwd, (file) => INPUT_EXTENSIONS.has(path.extname(file)), { excludeDefaultBuild: true }),
91
104
  ]);
92
105
  const compiler = inventory([
@@ -95,6 +108,8 @@ export function compileInputs({ cwd, dslDir, configPath, argumentIdentity }) {
95
108
  path.join(dslDir, "package.json"),
96
109
  path.join(dslDir, "compile_package.mjs"),
97
110
  path.join(dslDir, "compile_proof.mjs"),
111
+ path.join(dslDir, "operation_contract_check.mjs"),
112
+ path.join(dslDir, "assets", "operation-contract.wasm"),
98
113
  ...dependencyPackageFiles(dslDir, cwd),
99
114
  ]);
100
115
  return {
package/dart/CHANGELOG.md CHANGED
@@ -1,7 +1,82 @@
1
+ ## 0.66.5
2
+
3
+ - Resolve the Node runtime runner through `@githolon/runtime`, the public name for the application runtime package.
4
+
5
+ ## 0.66.4
6
+
7
+ - Consume the current `nomos_types` protocol and deliver the source-matched
8
+ Reception and runtime bridge used by the generated Dart application proofs.
9
+
10
+ ## 0.66.3
11
+
12
+ - Restaged the generated runtime bridge: regenerated vendored runtime assets. Published pub.dev archives are immutable, so regenerated bytes ride their own version.
13
+
14
+ ## 0.66.2
15
+
16
+ - Move platform-supplied capability ports into the independent
17
+ `nomos_peer_host` contract package; the client runtime consumes those ports
18
+ without exposing peer lifecycle control.
19
+
20
+ ## 0.66.1
21
+
22
+ - Requires `nomos_types` 0.11.1, whose `HostHealth` carries custody-open and provider-request telemetry.
23
+
24
+ ## 0.66.0
25
+
26
+ - THIN-CLIENT AUDIT (2026-09-12). Every unit of `lib/src` was classified against the thin-client
27
+ line in `architecture/reception_peer_office_boundary.md`; what no caller reached is gone. There
28
+ are no compat shims — a removed symbol breaks its callers at compile, by design.
29
+
30
+ BREAKING — removed, all with zero references in this package, its tests, `nomos_flutter`, the
31
+ nomos2 examples/bench, the generated Dart facades, or the CO2 applications:
32
+ - The superseded client-side model-decision lane, replaced by the office's model-adoption desk:
33
+ `application_model_policy.dart` in full (`DomainClientModelAdoptionRequired`,
34
+ `DomainModelReview`, `DomainModelDifference`, `DomainModelDifferenceKind`,
35
+ `NomosModelDecisionHandler`, `NomosApplicationModelPolicies`,
36
+ `NmsApplicationModelPolicyHost`), plus `nmsInternalConvergeGeneratedModel`,
37
+ `DomainClientModelLifecycleStalled`, `DomainClientSessionMismatch.canAttemptGeneratedModelAdoption`,
38
+ `nmsInternalMaySkipShapeCompatibility`, `nmsInternalClientExpectsNewerInterface`,
39
+ `nomosInternalRetainModelChangeHandler` and `nomosInternalHandleModelChange`. Adoption is the
40
+ office's answer, observed as `NomosModelAdoptionProgress`. A platform transport that mixed in
41
+ `NmsApplicationModelPolicyHost` simply drops the mixin.
42
+ - The cross-custody share pair `NomosSession.attestationSign` and `DartReception.shareWith`, and
43
+ with them `authority_attestation_kernel.dart` (`NmsAuthorityAttestationKernel`, their only
44
+ consumer).
45
+ - `source_trust.dart` (`NmsInternalSourceTrust`).
46
+ - `NomosEpochResult`, `EncryptionMemberKeyMissing`, `EncryptionRosterMismatch`,
47
+ `NomosBirthCertificateSpec` (a duplicate alias — `signBirthCert` now names
48
+ `NomosBirthCertificate`), the `NomosRefAcquire` extension (`ref.acquire(reception)`; use
49
+ `reception.acquireSession(ref.workspace)`), and `NmsInvitationMaterial`.
50
+ - `lastRecovery`, `mintDeviceKey` (use `authorKeygen`), `nmsQueryUsda`, `nmsQueryAtUsda`,
51
+ `nmsQueryPageUsda` (the compiler no longer emits them; `nmsQueryByIdUsda` remains),
52
+ `noteLocalSpan`, `assertConnected`, `canAuthorTyped` (use `canAuthor`, which returns the
53
+ kernel's typed answer), `nomosInternalDeliverLocalWorkspaceEffectsTo`,
54
+ `nmsAwaitProviderTokenReady` and `nomosInternalResidencyRequiredWorkspace`.
55
+
56
+ Still resident and named as office work, not to be worked around locally: the source-less path of
57
+ `acquireSession` (residency probe, connect fallback, credential retry) belongs to
58
+ `WorkspaceAcquisitionDesk`; `assertKernelCoherence`'s OSGi contract comparison belongs to
59
+ `CompatibilityDesk`; the foreign `watchById` re-read-per-sync-tick belongs to the watch desk.
60
+
61
+
62
+ - The receiving-group gate from Dart (`architecture/receiving_group_lifecycle.md` cut 4):
63
+ `NomosSession.nmsOpenReceivingGroup(...)` transports one `OpenReceivingGroupRequest` to the
64
+ shared Peer Office desk and returns its `ReceivingGroupOpened` (MOUNTED_LOCAL | ACQUIRED | BORN);
65
+ `receivingGroupConvergence` streams the desk's convergence tail (`ReceivingGroupConvergence`
66
+ runtime events), scoped to the session's workspace. Reception owns no ceremony: device identity,
67
+ born-ness, acquisition, birth, recovery and verification are the office's.
68
+ - `NmsApplicationFrameworkCalls.applicationBirthContract` (LOUD REQUIRED, compiler-emitted): the
69
+ application's law package identity for the receiving-group desk. Regenerate generated Dart
70
+ packages with the matching compiler. The parent platform's Nomos controller identity is
71
+ per-platform installed state the desk observes at birth; the descriptor never carries it.
72
+
1
73
  ## 0.65.3
2
74
 
3
75
  - Generate parent-law authentication cascades that wait for both provider and signer custody, without a child self-enrolment shortcut.
4
76
  - Preserve nominal USDA calls and typed Runtime v2 results across local and remote workspace boundaries.
77
+ - Replace the abandoned whole-history model-review shape with a current-frontier decision: generated
78
+ clients expose `ready` plus stable-identity differences, while explicit counterfactual results remain
79
+ outside ordinary law adoption.
5
80
 
6
81
  ## 0.65.2
7
82
 
@@ -201,7 +276,7 @@
201
276
 
202
277
  ## 0.64.16
203
278
 
204
- - Rebundle the runner runtime (`node-entry.mjs`, `offline-install.mjs`) generated from `@githolon/client` 0.103.19, which carries the evolve-gate fix: `promoteDomain` dispositions are read from the law that DECLARES the call, so a law upgrade with a genuine field/aggregate removal is promotable through the offer lane.
279
+ - Rebundle the runner runtime (`node-entry.mjs`, `offline-install.mjs`) generated from `@githolon/client` 0.103.19, which carries the evolve-gate fix: `promoteDomain` dispositions are read from the law that DECLARES the call, so a law upgrade with a genuine field/aggregate removal can pass the offer lane.
205
280
 
206
281
  ## 0.64.15
207
282
 
package/dart/README.md CHANGED
@@ -2,8 +2,31 @@
2
2
 
3
3
  Dart frontend types for [Nomos](https://github.com/Captain-App/nomos2) — the hand-written kernel
4
4
  wire types plus the code-generated per-domain aggregate + directive-payload types. (De)serializes
5
- the exact serde JSON the Rust kernel + projection produce/consume, and defines the `NomosBridge`
5
+ the exact typed protocol the Rust kernel + projection produce/consume, and defines Dart Reception
6
6
  protocol the runtime ([`nomos_flutter`](https://pub.dev/packages/nomos_flutter)) drives.
7
7
 
8
- You normally depend on `nomos_flutter` (which re-exports the bridge surface) rather than this package
8
+ You normally depend on `nomos_flutter` (which re-exports Reception) rather than this package
9
9
  directly. Licensed under the Nomos Pre-Release License — see `LICENSE`.
10
+
11
+ ## What belongs in this package
12
+
13
+ `nomos_client` is a THIN client. It is the language-native presentation of a Peer Office, and it
14
+ decides nothing the office decides. Only these belong here:
15
+
16
+ - the generated protobuf types and the `RuntimeRequest` / `RuntimeResponse` / `RuntimeEvent`
17
+ transport to a Peer Office (`runtime_v2_transport.dart`, `reception/peer_office_connection.dart`,
18
+ `node_runner_transport.dart`);
19
+ - the physical effect executors a platform shell answers — HTTP, git smart-HTTP, custody probes,
20
+ device identity, credential refresh, law package;
21
+ - the generated facade binding (`generated_call.dart`, `nms_generated_runtime.dart`,
22
+ `application_framework_calls.dart`);
23
+ - typed refusal decoding, and the projections that only fold events the office already published
24
+ (`sync_status_projection.dart`, `operation_receipts.dart`, `result_usda.dart`);
25
+ - the test harness (`test_harness.dart`, `dev_cloud.dart`, `testing/`).
26
+
27
+ These do NOT belong here, and a review should refuse them: workspace lifecycle decisions, ceremony
28
+ sequencing, retry/fallback/backoff policy, custody or sync orchestration, model-lifecycle decisions,
29
+ workspace name-prefix logic, and JSON probes of the host. They belong to a named Peer Office desk.
30
+ `architecture/reception_peer_office_boundary.md` carries the trap table of patterns already removed
31
+ and the short list of office procedure still resident here; add to that list rather than adding a
32
+ second client-side lane.
@@ -0,0 +1,41 @@
1
+ import 'package:nomos_types/nomos_types.dart';
2
+ import 'package:nomos_types/nomos_kernel_protocol.dart' as protocol;
3
+ import 'reception/dart_reception.dart' show NomosTypedOfferFailure;
4
+ export 'package:nomos_types/nomos_types.dart' show AdmissionDecision, Admitted,
5
+ DomainRefused, FrameworkRefused, UnsupportedRefusalContract, NomosDomainRefusalEvidence;
6
+
7
+ /// Generated decoders distinguish a newer nominal shape from malformed values.
8
+ final class NmsUnsupportedNominalRefusal implements Exception {
9
+ const NmsUnsupportedNominalRefusal();
10
+ }
11
+
12
+ /// Stateless adaptation of the existing offer lane. No retry, policy, pending
13
+ /// state, persistence or tenant validation is owned here.
14
+ Future<AdmissionDecision<S, R>> nmsAdmissionDecision<S, R>(Future<S> Function() command,
15
+ R? Function(NomosDomainRefusalEvidence) decode) async {
16
+ try {
17
+ return Admitted<S, R>(await command());
18
+ } on NomosTypedOfferFailure catch (failure) {
19
+ if (failure.response.whichOutcome() != protocol.OfferResponse_Outcome.refused) rethrow;
20
+ final reply = failure.response.refused;
21
+ if (!reply.hasDomainRefusal()) {
22
+ if (reply.refusal.code == protocol.KernelRefusalCode.KERNEL_REFUSAL_CODE_DOMAIN_REFUSED) {
23
+ throw const FormatException('Kernel domain refusal omitted its nominal value');
24
+ }
25
+ return FrameworkRefused<S, R>(reply.refusal.code, reply.refusal.message);
26
+ }
27
+ final value = reply.domainRefusal;
28
+ if (value.lawSha256.length != 32 || value.invariant.isEmpty || value.typeIdentity.isEmpty
29
+ || value.valueUsda.isEmpty || value.valueUsda.length > 65536 || reply.refusal.code != protocol.KernelRefusalCode.KERNEL_REFUSAL_CODE_DOMAIN_REFUSED) {
30
+ throw const FormatException('Invalid kernel domain-refusal envelope');
31
+ }
32
+ final evidence = NomosDomainRefusalEvidence(lawSha256: value.lawSha256,
33
+ invariant: value.invariant, typeIdentity: value.typeIdentity, valueUsda: value.valueUsda);
34
+ try {
35
+ final reason = decode(evidence);
36
+ return reason == null ? UnsupportedRefusalContract<S, R>(evidence) : DomainRefused<S, R>(reason, evidence);
37
+ } on NmsUnsupportedNominalRefusal {
38
+ return UnsupportedRefusalContract<S, R>(evidence);
39
+ }
40
+ }
41
+ }
@@ -4,7 +4,7 @@ import 'dart:convert' show utf8;
4
4
  import 'dart:typed_data' show Uint8List;
5
5
  import 'package:meta/meta.dart' show internal;
6
6
  import 'package:nomos_types/nomos_types.dart' show Sha256Digest;
7
- import 'package:nomos_types/nomos_kernel_protocol.dart' show BirthCertificate;
7
+ import 'package:nomos_types/nomos_kernel_protocol.dart' show ApplicationBirthContract, BirthCertificate;
8
8
 
9
9
  import 'generated_call.dart';
10
10
  import 'result_usda.dart' show NmsUsdaLayer, NmsUsdaPrim;
@@ -210,8 +210,35 @@ final class NmsInvitationMaterial {
210
210
  }
211
211
 
212
212
  @internal
213
+ /// One device that may author as a model-lifecycle holder, as the birth seed records it.
214
+ typedef NmsModelAuthoritySigner = ({
215
+ String deviceKeySubject,
216
+ String grantedAt,
217
+ String? verifiedVia,
218
+ int? validFromEpoch,
219
+ });
220
+
221
+ /// One principal that may install law into a workspace, and the devices that may author as it.
222
+ typedef NmsModelAuthorityHolder = ({
223
+ String principal,
224
+ List<NmsModelAuthoritySigner> signers,
225
+ });
226
+
213
227
  abstract interface class NmsApplicationFrameworkCalls {
214
228
  String get applicationHomeDomain;
229
+ String get applicationAuthorityDomain;
230
+
231
+ /// The framework record the model-authority self-heal writes when this workspace seats its parent's
232
+ /// model-lifecycle holders (`ParentModelAuthoritySeat` at a constant id — the in-history fact, and the
233
+ /// peer's own answer to "is my parent seated here yet"). The Reception reads it before offering the
234
+ /// self-heal, so the law's own identity is the only representation of it.
235
+ String get parentModelAuthoritySeatAggregate;
236
+ String get parentModelAuthoritySeatId;
237
+
238
+ /// The application's birth contract for the receiving-group desk: the compiled law package identity
239
+ /// (the closure serving the injected application-home domain). The parent platform's controller is
240
+ /// per-platform installed state the desk observes at birth, never a value the descriptor carries.
241
+ ApplicationBirthContract get applicationBirthContract;
215
242
 
216
243
  NmsGeneratedCall enrollFirstDevice({
217
244
  required String domain,
@@ -221,7 +248,6 @@ abstract interface class NmsApplicationFrameworkCalls {
221
248
  required int validFromEpoch,
222
249
  required String grantedAt,
223
250
  required String idpToken,
224
- String? delegationCert,
225
251
  BirthCertificate delegationCertificate,
226
252
  });
227
253
 
@@ -242,6 +268,7 @@ abstract interface class NmsApplicationFrameworkCalls {
242
268
  required Sha256Digest lawHash,
243
269
  required String bornAt,
244
270
  bool? inheritAuthProvider,
271
+ Sha256Digest? foundingKeyHash,
245
272
  });
246
273
 
247
274
  NmsGeneratedCall seedBirthPolicy({
@@ -302,6 +329,29 @@ abstract interface class NmsApplicationFrameworkCalls {
302
329
  /// The generated implementation binds this semantic capability to one exact nominal application intent.
303
330
  NmsGeneratedCall recoverExistingReceivingGroupDevice({
304
331
  required String user,
332
+ String? deviceKeySubject,
333
+ });
334
+
335
+ /// The framework child-authentication repair (`nomosInternalRepairChildAuthentication7c1f5e`), composed
336
+ /// into the application-home domain whenever the application births children: the ONE parent action
337
+ /// that seats this device and the current verifier into the child that refused the key, addressed by
338
+ /// workspace. The Reception's repair lane calls it; an application that births nothing has no such law.
339
+ NmsGeneratedCall repairChildAuthentication({
340
+ required String workspace,
341
+ required String user,
342
+ String? deviceKeySubject,
343
+ });
344
+
345
+ /// The framework model-authority self-seat (`nomosInternalSeatModelAuthority7c1f5e`), composed into
346
+ /// the application-home domain whenever the application births children: the ONE action by which a
347
+ /// workspace's own model-lifecycle holder names who ELSE may install law here, so the platform can
348
+ /// ship law without the signed-in person's device signing every time. Gated on
349
+ /// `workspace:self#installDomain` and nothing else — whoever may install law here may say who else
350
+ /// may, and grants no privilege they do not already hold. The Reception offers it when the workspace
351
+ /// records no seat; an application that births nothing has no such law.
352
+ NmsGeneratedCall seatParentModelAuthority({
353
+ required List<NmsModelAuthorityHolder> holders,
354
+ required String seatedAt,
305
355
  });
306
356
 
307
357
  NmsGeneratedCall redeemInvitation({
@@ -0,0 +1,187 @@
1
+ /// The application's approved law model and the typed observations of the
2
+ /// Peer Office model-adoption desk.
3
+ ///
4
+ /// An application is released against one compiled law package. Deploying and
5
+ /// adopting that package on the platform leaves every existing child workspace
6
+ /// (a receiving group, an estate, a catalogue) on its previous law; the shared
7
+ /// Peer Office brings each workspace the application opens onto the approved
8
+ /// package through the ordinary signed lifecycle offers, and reports what it
9
+ /// did here. Nothing in this file decides a lifecycle step: the office observes,
10
+ /// stages, proves and promotes; Reception transports the paper and presents the
11
+ /// typed outcome.
12
+ library;
13
+
14
+ import 'dart:typed_data';
15
+
16
+ import 'package:nomos_types/nomos_types.dart' show NomosApprovedModel;
17
+ import 'package:nomos_types/nomos_kernel_protocol.dart' as nomos_protocol;
18
+
19
+ import 'package:nomos_peer_host/nomos_peer_host.dart'
20
+ show NomosLawPackageSource;
21
+
22
+ // The approved model is an INPUT a release declares, so it is pure data and lives
23
+ // in `nomos_types` beside `CustodyBreakPolicy`. Re-exported here so this file
24
+ // remains the one place to read the whole model-adoption vocabulary.
25
+ export 'package:nomos_types/nomos_types.dart' show NomosApprovedModel;
26
+
27
+ /// The shell-side answer to the runtime's law-package effect for one approved
28
+ /// model: the package for its identity, and nothing for any other identity.
29
+ final class NmsApprovedModelLawPackageSource implements NomosLawPackageSource {
30
+ const NmsApprovedModelLawPackageSource(this.model);
31
+
32
+ final NomosApprovedModel model;
33
+
34
+ @override
35
+ Future<Uint8List?> load(String lawSha256) async =>
36
+ lawSha256 == model.lawSha256 ? await model.loadPackage() : null;
37
+ }
38
+
39
+ enum NomosModelAdoptionPhase { observe, stage, promote, sync }
40
+
41
+ enum NomosModelAdoptionOutcome {
42
+ inProgress,
43
+
44
+ /// Every served domain key already resolves to the approved package.
45
+ current,
46
+
47
+ /// The approved package is now the workspace's current law.
48
+ adopted,
49
+
50
+ /// Not adopted on this run; [NomosModelAdoptionDeferred] carries the typed
51
+ /// detail. The application keeps working on the law the workspace serves.
52
+ deferred,
53
+
54
+ /// A dry run: the kernel's preflight is reported; nothing was written.
55
+ previewed,
56
+ }
57
+
58
+ NomosModelAdoptionPhase _phaseOf(nomos_protocol.ModelAdoptionPhase phase) =>
59
+ switch (phase) {
60
+ nomos_protocol.ModelAdoptionPhase.MODEL_ADOPTION_PHASE_STAGE =>
61
+ NomosModelAdoptionPhase.stage,
62
+ nomos_protocol.ModelAdoptionPhase.MODEL_ADOPTION_PHASE_PROMOTE =>
63
+ NomosModelAdoptionPhase.promote,
64
+ nomos_protocol.ModelAdoptionPhase.MODEL_ADOPTION_PHASE_SYNC =>
65
+ NomosModelAdoptionPhase.sync,
66
+ _ => NomosModelAdoptionPhase.observe,
67
+ };
68
+
69
+ NomosModelAdoptionOutcome _outcomeOf(
70
+ nomos_protocol.ModelAdoptionOutcome outcome) =>
71
+ switch (outcome) {
72
+ nomos_protocol.ModelAdoptionOutcome.MODEL_ADOPTION_OUTCOME_CURRENT =>
73
+ NomosModelAdoptionOutcome.current,
74
+ nomos_protocol.ModelAdoptionOutcome.MODEL_ADOPTION_OUTCOME_ADOPTED =>
75
+ NomosModelAdoptionOutcome.adopted,
76
+ nomos_protocol.ModelAdoptionOutcome.MODEL_ADOPTION_OUTCOME_DEFERRED =>
77
+ NomosModelAdoptionOutcome.deferred,
78
+ nomos_protocol.ModelAdoptionOutcome.MODEL_ADOPTION_OUTCOME_PREVIEWED =>
79
+ NomosModelAdoptionOutcome.previewed,
80
+ _ => NomosModelAdoptionOutcome.inProgress,
81
+ };
82
+
83
+ /// The typed condition of an adoption the office deferred: the workspace keeps
84
+ /// serving [currentLawSha256] and [detail] is the kernel's or the shell's own
85
+ /// refusal, verbatim. Render it; do not interpret it into a repair.
86
+ final class NomosModelAdoptionDeferred {
87
+ const NomosModelAdoptionDeferred({
88
+ required this.workspace,
89
+ required this.phase,
90
+ required this.detail,
91
+ this.currentLawSha256,
92
+ });
93
+
94
+ final String workspace;
95
+ final NomosModelAdoptionPhase phase;
96
+ final String detail;
97
+ final String? currentLawSha256;
98
+
99
+ @override
100
+ String toString() =>
101
+ 'NomosModelAdoptionDeferred($workspace at ${phase.name}: $detail)';
102
+ }
103
+
104
+ /// One observation of the model-adoption desk for a workspace: progress while
105
+ /// it runs, then the terminal outcome. Presentation data only.
106
+ final class NomosModelAdoptionProgress {
107
+ const NomosModelAdoptionProgress({
108
+ required this.workspace,
109
+ required this.phase,
110
+ required this.outcome,
111
+ this.detail,
112
+ this.currentLawSha256,
113
+ });
114
+
115
+ factory NomosModelAdoptionProgress.fromRuntime(
116
+ nomos_protocol.ModelAdoptionProgress progress,
117
+ ) =>
118
+ NomosModelAdoptionProgress(
119
+ workspace: progress.workspace,
120
+ phase: _phaseOf(progress.phase),
121
+ outcome: _outcomeOf(progress.outcome),
122
+ detail: progress.hasDetail() ? progress.detail : null,
123
+ currentLawSha256:
124
+ progress.hasCurrentLawSha256() ? progress.currentLawSha256 : null,
125
+ );
126
+
127
+ final String workspace;
128
+ final NomosModelAdoptionPhase phase;
129
+ final NomosModelAdoptionOutcome outcome;
130
+ final String? detail;
131
+ final String? currentLawSha256;
132
+
133
+ bool get isTerminal => outcome != NomosModelAdoptionOutcome.inProgress;
134
+
135
+ /// The typed deferred condition, when this observation is one.
136
+ NomosModelAdoptionDeferred? get deferred =>
137
+ outcome == NomosModelAdoptionOutcome.deferred
138
+ ? NomosModelAdoptionDeferred(
139
+ workspace: workspace,
140
+ phase: phase,
141
+ detail: detail ?? 'the office deferred the adoption',
142
+ currentLawSha256: currentLawSha256,
143
+ )
144
+ : null;
145
+ }
146
+
147
+ /// The desk's answer to one adoption paper.
148
+ final class NomosModelAdoption {
149
+ const NomosModelAdoption({
150
+ required this.workspace,
151
+ required this.outcome,
152
+ this.detail,
153
+ this.currentLawSha256,
154
+ this.transitionReady,
155
+ });
156
+
157
+ factory NomosModelAdoption.fromRuntime(
158
+ nomos_protocol.ApplicationModelAdopted adopted,
159
+ ) =>
160
+ NomosModelAdoption(
161
+ workspace: adopted.workspace,
162
+ outcome: _outcomeOf(adopted.outcome),
163
+ detail: adopted.hasDetail() ? adopted.detail : null,
164
+ currentLawSha256:
165
+ adopted.hasCurrentLawSha256() ? adopted.currentLawSha256 : null,
166
+ transitionReady:
167
+ adopted.hasTransition() ? adopted.transition.ready : null,
168
+ );
169
+
170
+ final String workspace;
171
+ final NomosModelAdoptionOutcome outcome;
172
+ final String? detail;
173
+ final String? currentLawSha256;
174
+
175
+ /// The kernel's current-frontier verdict, when one was derived.
176
+ final bool? transitionReady;
177
+
178
+ NomosModelAdoptionDeferred? get deferred =>
179
+ outcome == NomosModelAdoptionOutcome.deferred
180
+ ? NomosModelAdoptionDeferred(
181
+ workspace: workspace,
182
+ phase: NomosModelAdoptionPhase.observe,
183
+ detail: detail ?? 'the office deferred the adoption',
184
+ currentLawSha256: currentLawSha256,
185
+ )
186
+ : null;
187
+ }
@@ -0,0 +1,73 @@
1
+ import 'sync_status_projection.dart' show WorkspaceFollowStatus;
2
+
3
+ /// Read-only presentation of one Peer Office workspace handle.
4
+ enum ApplicationStatusPhase {
5
+ checking,
6
+ current,
7
+ saving,
8
+ awaitingRemoteDurability,
9
+ receiving,
10
+ catchingUp,
11
+ offline,
12
+ attention,
13
+ }
14
+
15
+ final class ApplicationStatus {
16
+ const ApplicationStatus({
17
+ required this.phase,
18
+ required this.localChanges,
19
+ required this.availableChanges,
20
+ required this.savedChanges,
21
+ required this.acceptedChanges,
22
+ required this.decisionsNeeded,
23
+ this.receivedBytes,
24
+ this.totalBytes,
25
+ this.lastUpdatedAt,
26
+ this.message,
27
+ this.live = false,
28
+ this.followedWorkspaces,
29
+ this.workspacesInSync,
30
+ this.workspacesLive,
31
+ this.workspaceFollows = const [],
32
+ this.followReportAt,
33
+ this.preparingWorkspaces = 0,
34
+ this.retryingWorkspaces = 0,
35
+ this.preparationActivity,
36
+ });
37
+
38
+ final ApplicationStatusPhase phase;
39
+
40
+ /// Null counts have not been reported by the runtime; they are not zero.
41
+ final int? localChanges;
42
+ final int? availableChanges;
43
+ final int? savedChanges;
44
+ final int? acceptedChanges;
45
+ final int? decisionsNeeded;
46
+ final int? receivedBytes;
47
+ final int? totalBytes;
48
+ final DateTime? lastUpdatedAt;
49
+ final String? message;
50
+
51
+ /// Every workspace this handle depends on is settled and its live link is open: current NOW,
52
+ /// not as of [lastUpdatedAt]. A presentation shows "just now" rather than the age of that stamp.
53
+ final bool live;
54
+
55
+ /// The replica follows the peer keeps up with in the background, and how many are in sync.
56
+ /// Null until the runtime reports its follow inventory; never zero-filled.
57
+ final int? followedWorkspaces;
58
+ final int? workspacesInSync;
59
+ final int? workspacesLive;
60
+ final List<WorkspaceFollowStatus> workspaceFollows;
61
+
62
+ /// Peer-authored timestamp of the latest changed follow observation.
63
+ final DateTime? followReportAt;
64
+ final int preparingWorkspaces;
65
+ final int retryingWorkspaces;
66
+ final String? preparationActivity;
67
+
68
+ bool get isUsable => phase != ApplicationStatusPhase.attention;
69
+ bool get isCurrent =>
70
+ phase == ApplicationStatusPhase.current &&
71
+ localChanges == 0 &&
72
+ availableChanges == 0;
73
+ }