githolon 0.30.0 → 0.31.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 (2) hide show
  1. package/dist/cli.mjs +73 -8
  2. package/package.json +3 -3
package/dist/cli.mjs CHANGED
@@ -1488,7 +1488,14 @@ function parseOfflineLegs(proofSource) {
1488
1488
  ...countLeg !== void 0 ? { count: countLeg } : {}
1489
1489
  };
1490
1490
  }
1491
- function runOfflineLegs(eng, ws, lawHash, legs, frameworkHash) {
1491
+ async function mountIsolatedProofWs(eng, baseWs, lawHash, deployUsda) {
1492
+ const iso = `${baseWs}-rb`;
1493
+ await mountFresh(eng, iso);
1494
+ author(eng, iso, "bootstrap", "installDomain", installPayload(eng.hashes.nomos, eng.nomosPkg, "githolon-proof"), "");
1495
+ author(eng, iso, "nomos", "installDomain", installPayload(lawHash, deployUsda, "githolon-proof"), eng.hashes.nomos);
1496
+ return iso;
1497
+ }
1498
+ async function runOfflineLegs(eng, ws, lawHash, legs, frameworkHash, deployUsda) {
1492
1499
  const t0 = performance.now();
1493
1500
  const done = (ok, lines2, error) => ({
1494
1501
  ok,
@@ -1532,7 +1539,11 @@ function runOfflineLegs(eng, ws, lawHash, legs, frameworkHash) {
1532
1539
  if (!v.ok) return done(false, lines, v.error);
1533
1540
  }
1534
1541
  if (legs.relationBootstrap !== void 0) {
1535
- const v = runRelationBootstrapLeg(eng, ws, lawHash, legs.relationBootstrap);
1542
+ let rbWs = ws;
1543
+ if (legs.relationBootstrap.bornContext === void 0 && deployUsda !== void 0) {
1544
+ rbWs = await mountIsolatedProofWs(eng, ws, lawHash, deployUsda);
1545
+ }
1546
+ const v = runRelationBootstrapLeg(eng, rbWs, lawHash, legs.relationBootstrap);
1536
1547
  lines.push(...v.legs);
1537
1548
  if (!v.ok) return done(false, lines, v.error);
1538
1549
  }
@@ -1651,11 +1662,28 @@ function runRelationBootstrapLeg(eng, ws, lawHash, rb) {
1651
1662
  const grantedRelation = rb.grantedRelation ?? rb.relation;
1652
1663
  const computed = grantedRelation !== rb.relation;
1653
1664
  const speculative = rb.seedSpeculative === true;
1654
- const grantPayload = { ...rb.grantPayload };
1655
- const overwrite = /* @__PURE__ */ new Set([...rb.grantSubjectFields, ...rb.grantGrantedByFields]);
1656
- for (const k of Object.keys(grantPayload)) {
1657
- if (overwrite.has(k) || /^(subject|principal|grantedBy|grantee|member|user|owner)$/i.test(k)) grantPayload[k] = ACTOR;
1665
+ if (rb.bornContext !== void 0) {
1666
+ return runBornContextLeg(eng, ws, lawHash, rb, ACTOR, stamp);
1667
+ }
1668
+ const seatActorFields = (payload, routed) => {
1669
+ const set = new Set(routed);
1670
+ for (const k of Object.keys(payload)) {
1671
+ if (set.has(k) || /^(subject|principal|grantedBy|grantee|member|user|owner|founder)$/i.test(k)) payload[k] = ACTOR;
1672
+ }
1673
+ };
1674
+ for (const seed of rb.prerequisiteSeeds ?? []) {
1675
+ const seedPayload = { ...seed.payload };
1676
+ seatActorFields(seedPayload, []);
1677
+ for (const f of seed.autoStamped) seedPayload[f] = stamp;
1678
+ const seedRes = author(eng, ws, rb.domain, seed.directiveId, seedPayload, lawHash, actorOpts);
1679
+ if (seedRes.ok === false) {
1680
+ lines.push(`\u2013 relation-bootstrap leg SKIPPED (prerequisite-seed chain) \u2014 the prerequisite seed ${rb.domain}/${seed.directiveId} REFUSED with a synthesized payload (${seedRes.error ?? "refused"}); the granter ${rb.grantDirectiveId}'s prerequisite can't be established standalone \u2014 prove ${rb.gatedDirectiveId} via a birth genesis / by hand`);
1681
+ return done(true);
1682
+ }
1683
+ lines.push(`\u2713 relation bootstrap (prerequisite) \u2014 ${rb.domain}/${seed.directiveId} established (as founder ${ACTOR}) before the grant`);
1658
1684
  }
1685
+ const grantPayload = { ...rb.grantPayload };
1686
+ seatActorFields(grantPayload, [...rb.grantSubjectFields, ...rb.grantGrantedByFields]);
1659
1687
  for (const f of rb.grantAutoStamped) grantPayload[f] = stamp;
1660
1688
  const grantRes = author(eng, ws, rb.domain, rb.grantDirectiveId, grantPayload, lawHash, actorOpts);
1661
1689
  if (grantRes.ok === false) {
@@ -1681,6 +1709,43 @@ function runRelationBootstrapLeg(eng, ws, lawHash, rb) {
1681
1709
  lines.push(speculative ? `\u2713 relation bootstrap (prove) \u2014 ${rb.domain}/${rb.gatedDirectiveId} authored under the replayed seed (gated write SUCCEEDS \u2014 the REAL kernel gate confirmed the replayed seed establishes authority for "${rb.relation}")` : `\u2713 relation bootstrap (prove) \u2014 ${rb.domain}/${rb.gatedDirectiveId} authored under the seeded holder of "${rb.relation}" (gated write SUCCEEDS once granted)`);
1682
1710
  return done(true);
1683
1711
  }
1712
+ function runBornContextLeg(eng, ws, lawHash, rb, ACTOR, stamp) {
1713
+ const t0 = performance.now();
1714
+ const lines = [];
1715
+ const done = (ok, error) => ({ ok, ms: performance.now() - t0, legs: lines, ...error !== void 0 ? { error } : {} });
1716
+ const bc = rb.bornContext;
1717
+ const fw = eng.hashes?.nomos;
1718
+ const actorOpts = { actor: ACTOR };
1719
+ const birthPayload = { ...bc.birthPayload };
1720
+ if (bc.ownerField !== void 0) birthPayload[bc.ownerField] = ACTOR;
1721
+ if (bc.frameworkHashField !== void 0) birthPayload[bc.frameworkHashField] = fw;
1722
+ if (bc.lawHashField !== void 0) birthPayload[bc.lawHashField] = lawHash;
1723
+ for (const f of bc.birthAutoStamped) birthPayload[f] = stamp;
1724
+ const birthRes = author(eng, ws, rb.domain, bc.birthDirectiveId, birthPayload, lawHash, actorOpts);
1725
+ if (birthRes.ok === false) {
1726
+ lines.push(`\u2013 relation-bootstrap leg SKIPPED (layer-4 born-context) \u2014 the self-birth ${rb.domain}/${bc.birthDirectiveId} refused (${birthRes.error ?? "refused"}); could not establish born-genesis authority for "${rb.relation}"`);
1727
+ return done(true);
1728
+ }
1729
+ const bornWs = (birthRes.born ?? []).map((b) => b?.workspace).find((w) => typeof w === "string" && w.length > 0);
1730
+ if (bornWs === void 0) {
1731
+ lines.push(`\u2013 relation-bootstrap leg SKIPPED (layer-4 born-context) \u2014 the self-birth ${rb.domain}/${bc.birthDirectiveId} admitted but spawned no workspace (the genesis did not fold); "${rb.relation}" authority not established`);
1732
+ return done(true);
1733
+ }
1734
+ lines.push(`\u2713 relation bootstrap (born-context) \u2014 birthed ${bornWs} via ${rb.domain}/${bc.birthDirectiveId}; its genesis (${bc.seatsViaDirectiveId}) seated "${rb.relation}" for the owner ${ACTOR}`);
1735
+ const gatedPayload = { ...rb.gatedPayload };
1736
+ for (const k of Object.keys(gatedPayload)) {
1737
+ if (/^(subject|principal|owner|ownerSubject|grantee|member|user)$/i.test(k)) gatedPayload[k] = ACTOR;
1738
+ }
1739
+ for (const f of rb.gatedAutoStamped) gatedPayload[f] = stamp;
1740
+ if (rb.gatedMintField !== void 0 && rb.gatedAggregateId !== void 0) gatedPayload[rb.gatedMintField] = mintId(eng, rb.gatedAggregateId);
1741
+ const gatedRes = author(eng, bornWs, rb.domain, rb.gatedDirectiveId, gatedPayload, lawHash, actorOpts);
1742
+ if (gatedRes.ok === false) {
1743
+ lines.push(`\u2013 relation-bootstrap leg SKIPPED (layer-4 born-context) \u2014 dispatching ${rb.domain}/${rb.gatedDirectiveId} .requires("${rb.relation}") inside the born ${bornWs} as ${ACTOR} was REFUSED on the real gate (${gatedRes.error ?? "refused"}); the born genesis did not establish the authority the gate needs`);
1744
+ return done(true);
1745
+ }
1746
+ lines.push(`\u2713 relation bootstrap (prove) \u2014 ${rb.domain}/${rb.gatedDirectiveId} authored INSIDE the born ${bornWs} as the genesis-established owner (gated write SUCCEEDS \u2014 the REAL kernel gate confirmed the born genesis seats "${rb.relation}")`);
1747
+ return done(true);
1748
+ }
1684
1749
  function actorFromPayload(payload, field) {
1685
1750
  if (field === void 0) return void 0;
1686
1751
  const value = payload[field];
@@ -1722,7 +1787,7 @@ async function runOfflineProofStandalone(proofPath, cloud, domain) {
1722
1787
  await mountFresh(eng, ws);
1723
1788
  author(eng, ws, "bootstrap", "installDomain", installPayload(eng.hashes.nomos, eng.nomosPkg, "githolon-proof"), "");
1724
1789
  author(eng, ws, "nomos", "installDomain", installPayload(lawHash, deployBody.packageUsda, "githolon-proof"), eng.hashes.nomos);
1725
- const v = runOfflineLegs(eng, ws, lawHash, legs, eng.hashes.nomos);
1790
+ const v = await runOfflineLegs(eng, ws, lawHash, legs, eng.hashes.nomos, deployBody.packageUsda);
1726
1791
  for (const l of v.legs) console.log(l);
1727
1792
  if (!v.ok) {
1728
1793
  console.error(`\u2717 ${v.error}`);
@@ -2186,7 +2251,7 @@ async function runProofCycle(s, cwd, deployBody, installedBy) {
2186
2251
  await mountFresh(s.eng, scratch);
2187
2252
  author(s.eng, scratch, "bootstrap", "installDomain", installPayload(s.eng.hashes.nomos, s.eng.nomosPkg, installedBy), "");
2188
2253
  author(s.eng, scratch, "nomos", "installDomain", installPayload(s.lawHash, deployBody.packageUsda, installedBy), s.eng.hashes.nomos);
2189
- return runOfflineLegs(s.eng, scratch, s.lawHash, legs);
2254
+ return await runOfflineLegs(s.eng, scratch, s.lawHash, legs, s.eng.hashes.nomos, deployBody.packageUsda);
2190
2255
  } catch (e) {
2191
2256
  return { ok: false, ms: 0, legs: [], error: String(e.message ?? e) };
2192
2257
  } finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "githolon",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "type": "module",
5
5
  "description": "githolon — the Nomos developer CLI: Rails-style generators for @githolon/dsl domains + the package compiler. Kernel-independent.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@bjorn3/browser_wasi_shim": "0.4.2",
32
- "@githolon/client": "^0.30.0",
33
- "@githolon/dsl": "^0.30.0",
32
+ "@githolon/client": "^0.31.0",
33
+ "@githolon/dsl": "^0.31.0",
34
34
  "isomorphic-git": "^1.38.4"
35
35
  },
36
36
  "devDependencies": {