@githolon/dsl 0.101.4 → 0.101.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@githolon/dsl",
3
- "version": "0.101.4",
3
+ "version": "0.101.6",
4
4
  "type": "module",
5
5
  "description": "Nomos 2 domain-authoring DSL: aggregates + directives in TS, executed and encoded to the Rust kernel's wire shapes.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -470,14 +470,13 @@ function authorityConformanceLegLines(
470
470
  ` const realFetch2 = globalThis.fetch;`,
471
471
  ` globalThis.fetch = (() => { throw new Error("OFFLINE PROOF VIOLATED: authority-conformance touched the network"); }) as typeof fetch;`,
472
472
  ` try {`,
473
- ` // (a) SPY on offerDirective: capture what the generated client passes, re-encode the v2 envelope it`,
474
- ` // would produce (the one-encoder shape), decode it back, and assert security.actor IS the actor.`,
473
+ ` // (a) SPY on offerDirective: capture what the generated client passes WITHOUT admitting a synthetic`,
474
+ ` // business write, re-encode the v2 envelope, and assert security.actor IS the actor.`,
475
475
  ` const ACTOR = "user:proof-conformance";`,
476
476
  ` let captured: { domain: string; directiveId: string; payload: unknown; opts?: { domainHash?: string; actor?: string } } | undefined;`,
477
- ` const realOffer: typeof holon.offerDirective = holon.offerDirective.bind(holon);`,
478
477
  ` holon.offerDirective = (domain, directiveId, payload, opts) => {`,
479
478
  ` captured = { domain, directiveId, payload, opts };`,
480
- ` return realOffer(domain, directiveId, payload, opts);`,
479
+ ` return Promise.resolve("0000000000000000000000000000000000000000");`,
481
480
  ` };`,
482
481
  ` try {`,
483
482
  ` await ${factory}(holon, { actor: ACTOR }).${leg.directiveId}(${payloadEntries});`,
@@ -2576,8 +2575,9 @@ export function legsForDomain(
2576
2575
  * (gaps 1+3, co2 feedback), with its taxonomy (compile-valid | standalone-provable | child-birth-provable).
2577
2576
  * A CHILD-ONLY law (no standalone create, installed only via a parent birth) is registered under its OWN
2578
2577
  * domain key pointing at the parent birth that proves it. `githolon proof [--domain <key>]` resolves for
2579
- * every domain. The default is the first STANDALONE-provable domain (the live `.mts` lane needs one), else
2580
- * the first child-birth-provable, else the first compiled domain. */
2578
+ * every domain. The default is the first BUSINESS birth: that is the product surface `proof --live`
2579
+ * promises to exercise even when the same domain also exposes ordinary standalone creates. Otherwise use
2580
+ * the first standalone-provable domain, then the first child-birth-provable, then the first compiled domain. */
2581
2581
  export function proofLegsIndex(
2582
2582
  modules: readonly DomainModule[],
2583
2583
  packageInterface?: Readonly<Record<string, DomainInterface>>,
@@ -2608,9 +2608,10 @@ export function proofLegsIndex(
2608
2608
  }
2609
2609
  }
2610
2610
  if (order.length === 0) return null;
2611
+ const businessBirthFirst = order.find((d) => domains[d]!.childBirth?.businessAggregateId !== undefined);
2611
2612
  const standaloneFirst = order.find((d) => (domains[d]!.legs ?? []).includes("standalone-provable"));
2612
2613
  const childBirthFirst = order.find((d) => (domains[d]!.legs ?? []).includes("child-birth-provable"));
2613
- const def = standaloneFirst ?? childBirthFirst ?? order[0]!;
2614
+ const def = businessBirthFirst ?? standaloneFirst ?? childBirthFirst ?? order[0]!;
2614
2615
  return { default: def, domains };
2615
2616
  }
2616
2617
 
@@ -2625,7 +2626,7 @@ function v2IdentityAndCleanupPreamble(opts: TsProofOptions, hashConst: string, n
2625
2626
  void opts;
2626
2627
  void hashConst;
2627
2628
  return [
2628
- `// Nomos prepared this signed home and installed the package before entering generated application code.`,
2629
+ `// Nomos prepared an isolated signed application workspace and installed the package before entering generated application code.`,
2629
2630
  `// The application proof supplies business facts only; identity/custody/law selection stay underneath.`,
2630
2631
  `const fail: (m: string) => never = (m) => { throw new Error(m); };`,
2631
2632
  `const ok = (m: string) => console.log("✓ " + m);`,
@@ -2636,9 +2637,9 @@ function v2IdentityAndCleanupPreamble(opts: TsProofOptions, hashConst: string, n
2636
2637
  `let runError: unknown = null;`,
2637
2638
  `try {`,
2638
2639
  ``,
2639
- `// ${n()}. the one managed entry: the logged-in user's durable Nomos home`,
2640
+ `// ${n()}. the one managed entry: an isolated application beneath the logged-in user's durable Nomos home`,
2640
2641
  `if (process.env.NOMOS_PROOF_MANAGED !== "1" || !AUTHOR_SECRET) fail("run this cloud proof through: githolon proof --live");`,
2641
- `ok(\`Nomos home ready — \${WS}\`);`,
2642
+ `ok(\`Nomos application ready — \${WS}\`);`,
2642
2643
  ];
2643
2644
  }
2644
2645
 
@@ -2987,12 +2988,14 @@ function generateBootstrapOnlyProof(
2987
2988
  }
2988
2989
 
2989
2990
  export function generateTsProof(modules: readonly DomainModule[], opts: TsProofOptions): string {
2990
- // PRIMARY-DOMAIN SELECTION: the live `.mts` drives a STANDALONE (ungated) create when the package has one
2991
- // (the full deploy → write → query → sync → cloud loop). Else a BIRTH package (`.births()`) drives the
2992
- // birth. Else a GATED-CREATE package — whose only creating write `.requires(R)` (co2's estate `createSite`)
2993
- // — drives the RELATION-BOOTSTRAP leg as its primary write: seed authority, THEN the gated create is
2994
- // admitted (never a naive first dispatch that the gate would refuse). Either way, the marker = the primary
2995
- // domain's FULL legs (so the offline runner + the index never describe different directives).
2991
+ // PRIMARY-DOMAIN SELECTION: a declared BUSINESS birth is always first because `proof --live` promises the
2992
+ // product's one `app.birth(facts)` surface, not a convenient auxiliary create from the same law. Without
2993
+ // one, drive a STANDALONE ungated create; then a generic `.births()` child; then a bootstrap-provable gated
2994
+ // create. Either way, the marker = the primary domain's FULL legs (so the offline runner + index agree).
2995
+ const hasBusinessBirth = (m: DomainModule): boolean =>
2996
+ (m.directives as Directive<unknown>[]).some(
2997
+ (d) => (d as { businessBirth?: unknown }).businessBirth !== undefined,
2998
+ );
2996
2999
  const hasStandaloneCreate = (m: DomainModule): boolean =>
2997
3000
  (m.directives as Directive<unknown>[]).some((d) => isStandaloneCreate(d));
2998
3001
  const hasBirth = (m: DomainModule): boolean => hasBirthDirective(m);
@@ -3006,7 +3009,7 @@ export function generateTsProof(modules: readonly DomainModule[], opts: TsProofO
3006
3009
  }) !== undefined;
3007
3010
  } catch { return false; }
3008
3011
  };
3009
- const mod = modules.find(hasStandaloneCreate) ?? modules.find(hasBirth) ?? modules.find(isBootstrapProvable);
3012
+ const mod = modules.find(hasBusinessBirth) ?? modules.find(hasStandaloneCreate) ?? modules.find(hasBirth) ?? modules.find(isBootstrapProvable);
3010
3013
  if (mod === undefined) {
3011
3014
  // No provable creating write anywhere. If a GATED create exists but its authority can't be seeded, surface
3012
3015
  // the loud bootstrap diagnostic (never a false green); else the generic "add a .creates" remedy.
@@ -3027,6 +3030,12 @@ export function generateTsProof(modules: readonly DomainModule[], opts: TsProofO
3027
3030
  const primaryLegs = legsForDomain(mod, modules, opts.interface);
3028
3031
  const childBirth = primaryLegs.childBirth;
3029
3032
 
3033
+ // A business-birth domain may also contain `addSite`-style standalone creates. Those are useful secondary
3034
+ // verbs, but they must never steal the live acceptance proof from the one public application birth.
3035
+ if (childBirth?.businessAggregateId !== undefined) {
3036
+ return generateBirthOnlyProof(mod, modules, opts, primaryLegs);
3037
+ }
3038
+
3030
3039
  // The standalone-create lane needs an UNGATED create (isStandaloneCreate — never a gated/birth/attestation
3031
3040
  // create, which the gate would refuse dispatched with no seeded authority). Absent one, the primary write
3032
3041
  // is the birth leg (a `.births()` domain) or the relation-bootstrap leg (a gated-create domain).