@githolon/dsl 0.119.32 → 0.119.34

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.
package/dart/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.70.32
2
+
3
+ - Restage the bundled runtime with the projection fix that keeps a founding record's owner contract, so reading it on an upgraded Home no longer reports `evolutionRequired` (CAP-1012).
4
+
5
+ ## 0.70.31
6
+
7
+ - Restage the bundled runtime with the coordinated compiler release that keeps each founded domain's `FoundingPrincipal` aggregate in place, so laws using the CAP-1011 founding read upgrade existing workspaces instead of being refused for removing it.
8
+
1
9
  ## 0.70.30
2
10
 
3
11
  - Restage the bundled runtime with the coordinated compiler release that selects founded business births from the durable founding record, so console device re-enrolment keeps a founded workspace able to birth children (CAP-1011).
@@ -26258,7 +26258,7 @@ function delayUntilDue(follow, nowUnixMillis) {
26258
26258
 
26259
26259
  // ../src/runtime/runtime_identity.ts
26260
26260
  init_define_NOMOS_KERNEL_RELEASE();
26261
- var PEER_RUNTIME_IDENTITY = "0.119.32" ? `@githolon/runtime@${"0.119.32"}` : "@githolon/runtime@unbundled";
26261
+ var PEER_RUNTIME_IDENTITY = "0.119.34" ? `@githolon/runtime@${"0.119.34"}` : "@githolon/runtime@unbundled";
26262
26262
 
26263
26263
  // ../src/runtime/replica_follow_desk.ts
26264
26264
  init_define_NOMOS_KERNEL_RELEASE();
package/dart/pubspec.yaml CHANGED
@@ -7,7 +7,7 @@ repository: https://github.com/Captain-App/nomos2
7
7
  description: >-
8
8
  Nomos 2 Dart client — generated domain values, intent payloads and application
9
9
  lifecycle types over the typed Nomos kernel protocol and USDA custody model.
10
- version: 0.70.30
10
+ version: 0.70.32
11
11
 
12
12
  environment:
13
13
  sdk: ^3.5.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@githolon/dsl",
3
- "version": "0.119.32",
3
+ "version": "0.119.34",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Nomos 2 domain-authoring DSL: aggregates + directives in TS, executed and encoded to the Rust kernel's wire shapes.",
@@ -82,7 +82,7 @@
82
82
  "test": "vitest run"
83
83
  },
84
84
  "dependencies": {
85
- "@githolon/runtime": "0.119.32",
85
+ "@githolon/runtime": "0.119.34",
86
86
  "@bufbuild/protobuf": "2.13.0",
87
87
  "@bufbuild/protoc-gen-es": "2.13.0",
88
88
  "esbuild": "0.24.2",
@@ -79,6 +79,7 @@ import {
79
79
  } from "./value_object.js";
80
80
  import { expandCapabilityExports, isCapabilityDecl } from "./capability_exports.js";
81
81
  import { RelationTuple, relationTuplesByObject } from "./framework/relations.js";
82
+ import { isNamespacedAggregate, qualifyReadProjectionType } from "./read_projection_namespace.js";
82
83
  import { type FoundingPrincipalSourceQuery } from "./framework/founding_genesis.js";
83
84
  import {
84
85
  SignerDelegation,
@@ -359,6 +360,12 @@ export function composeDomainModule(spec: DomainModuleSpec): DomainModule {
359
360
  }
360
361
  }
361
362
  }
363
+ // Founding-source reads served by this domain's own founding aggregate (source wire type -> owned id).
364
+ const ownedFoundingSources = new Map<string, string>();
365
+ const readOwnedFoundingSource = (query: QueryDecl): QueryDecl => {
366
+ const owned = ownedFoundingSources.get(query.returns);
367
+ return owned === undefined ? query : { ...query, returns: owned };
368
+ };
362
369
  const directives = applyConflictPolicyResolvers(
363
370
  applicationLanguage === undefined
364
371
  ? discoveredDirectives
@@ -580,14 +587,42 @@ export function composeDomainModule(spec: DomainModuleSpec): DomainModule {
580
587
  if (!directives.some((d) => d.id === seedAuthProvider.id)) directives.push(seedAuthProvider);
581
588
  if (!directives.some((d) => d.id === setAuthProvider.id)) directives.push(setAuthProvider);
582
589
  // Read-only founding schemas preserve each source's physical namespace. No writer or ensure effect.
590
+ // A source this domain already owns is read through that owned declaration: the domain's own
591
+ // `FoundingPrincipal` lowers to the same wire type, and it keeps its stable id, fields and writer.
592
+ // A second declaration of one wire type would replace that identity in the installed law, and the
593
+ // kernel's evolve gate would then refuse every existing workspace for removing it.
594
+ const ownedByWireType = new Map<string, AggregateHandle>();
595
+ for (const aggregate of byId.values()) {
596
+ ownedByWireType.set(
597
+ isNamespacedAggregate(aggregate) ? qualifyReadProjectionType(spec.name, aggregate.id) : aggregate.id,
598
+ aggregate,
599
+ );
600
+ }
583
601
  for (const reads of [spec.queries ?? [], ...directives.map((directive) => directive.declaredQueryReads ?? [])]) {
584
602
  for (const query of reads) {
585
603
  if (!("foundingPrincipalSource" in query)) continue;
586
604
  const source = (query as FoundingPrincipalSourceQuery).foundingPrincipalSource;
605
+ const owned = ownedByWireType.get(source.id);
606
+ if (owned !== undefined && owned.id !== source.id) {
607
+ const ownedFields = Object.keys(owned.fields).sort().join(",");
608
+ if (ownedFields !== Object.keys(source.fields).sort().join(",")) {
609
+ throw new Error(
610
+ `domain '${domain}': aggregate '${owned.id}' lowers to founding source '${source.id}' ` +
611
+ `but declares fields [${ownedFields}]`,
612
+ );
613
+ }
614
+ ownedFoundingSources.set(source.id, owned.id);
615
+ continue;
616
+ }
587
617
  if (!byId.has(source.id)) byId.set(source.id,
588
618
  { ...source, businessBirthInternal: true } as AggregateHandle);
589
619
  }
590
620
  }
621
+ for (const [index, directive] of directives.entries()) {
622
+ const reads = directive.declaredQueryReads;
623
+ if (reads === undefined || !reads.some((query) => ownedFoundingSources.has(query.returns))) continue;
624
+ directives[index] = { ...directive, declaredQueryReads: reads.map(readOwnedFoundingSource) } as Directive<any>;
625
+ }
591
626
  }
592
627
  // SECONDARY-CREATE AUTO-DECLARE (secondary_ensure.ts — the id-mint-gate DX): a plan may `ensure(B, "det:id")`
593
628
  // a SECOND aggregate at a deterministic id of a type its directive does NOT declare `.ensures()` for. The
@@ -679,7 +714,7 @@ export function composeDomainModule(spec: DomainModuleSpec): DomainModule {
679
714
  // As with directives, one stable query id is one declaration. This also makes an internal framework
680
715
  // wrapper win over an older public re-export discovered earlier in the module bag.
681
716
  const queryById = new Map<string, QueryDecl>();
682
- for (const query of spec.queries ?? []) queryById.set(query.id, query);
717
+ for (const query of spec.queries ?? []) queryById.set(query.id, readOwnedFoundingSource(query));
683
718
  const queries = [...queryById.values()];
684
719
  // A directive's `.reads(query)` retains the complete typed declaration. It is
685
720
  // executable law, even when the query is intentionally absent from the
@@ -2593,8 +2593,8 @@ const NOMOS_TYPES_DEP = "^0.16.0";
2593
2593
  // 0.48.x: session-bound clients (XClient.bind/NomosClientInterface/DomainClientSessionMismatch/
2594
2594
  // DomainNotInstalledForSession, engine.follow, pendingConflicts lanes) — the generated client
2595
2595
  // REQUIRES this surface. 0.48.1 fixes NomosSession.watchPendingConflicts delegation.
2596
- const NOMOS_CLIENT_DEP = "^0.70.30";
2597
- const NOMOS_FLUTTER_DEP = "^0.69.22";
2596
+ const NOMOS_CLIENT_DEP = "^0.70.32";
2597
+ const NOMOS_FLUTTER_DEP = "^0.69.24";
2598
2598
  // DRIFT TRIPWIRE: pubspec_pins.test.ts asserts these equal the CURRENT versions in the Dart and Flutter
2599
2599
  // package pubspecs — a release without this bump fails the suite, so tenants never
2600
2600
  // land back in dependency_overrides (the exact co2 report this closes, third occurrence).
package/src/law_graph.ts CHANGED
@@ -847,6 +847,7 @@ export function discoverLawGraph(
847
847
  const domainRef = ref(domainEntity);
848
848
  const aggregateByLabel = new Map<string, { node: LawAggregateNode; fields: Map<string, LawFieldNode> }>();
849
849
  const aggregateNodes: LawAggregateNode[] = [];
850
+ const aggregateLabelByWireType = new Map<string, string>();
850
851
  const fieldNodes: LawFieldNode[] = [];
851
852
  const anonymousValueNodes = new Map<string, LawAnonymousValueNode>();
852
853
  const identities = createLawIdentityReconciler(sourceRegistry);
@@ -926,6 +927,16 @@ export function discoverLawGraph(
926
927
  implements: [],
927
928
  ...(ownerFieldRef === undefined ? {} : { ownerField: ownerFieldRef }),
928
929
  };
930
+ // The kernel's evolve gate keys a domain's aggregates by wire type. Two declarations sharing one
931
+ // would silently drop a stable id from the installed surface and refuse every existing workspace.
932
+ const sharing = aggregateLabelByWireType.get(node.wireType);
933
+ if (sharing !== undefined) {
934
+ fail(
935
+ `aggregates '${sharing}' and '${aggregate.id}' both lower to wire type ` +
936
+ `'${node.wireType}' in domain '${module.name}'; one physical type has one declaration`,
937
+ );
938
+ }
939
+ aggregateLabelByWireType.set(node.wireType, aggregate.id);
929
940
  aggregateByLabel.set(aggregate.id, { node, fields });
930
941
  aggregateNodes.push(node);
931
942
  }