githolon 0.30.1 → 0.31.1

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 +33 -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
  }
@@ -1654,11 +1665,25 @@ function runRelationBootstrapLeg(eng, ws, lawHash, rb) {
1654
1665
  if (rb.bornContext !== void 0) {
1655
1666
  return runBornContextLeg(eng, ws, lawHash, rb, ACTOR, stamp);
1656
1667
  }
1657
- const grantPayload = { ...rb.grantPayload };
1658
- const overwrite = /* @__PURE__ */ new Set([...rb.grantSubjectFields, ...rb.grantGrantedByFields]);
1659
- for (const k of Object.keys(grantPayload)) {
1660
- if (overwrite.has(k) || /^(subject|principal|grantedBy|grantee|member|user|owner)$/i.test(k)) grantPayload[k] = ACTOR;
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`);
1661
1684
  }
1685
+ const grantPayload = { ...rb.grantPayload };
1686
+ seatActorFields(grantPayload, [...rb.grantSubjectFields, ...rb.grantGrantedByFields]);
1662
1687
  for (const f of rb.grantAutoStamped) grantPayload[f] = stamp;
1663
1688
  const grantRes = author(eng, ws, rb.domain, rb.grantDirectiveId, grantPayload, lawHash, actorOpts);
1664
1689
  if (grantRes.ok === false) {
@@ -1762,7 +1787,7 @@ async function runOfflineProofStandalone(proofPath, cloud, domain) {
1762
1787
  await mountFresh(eng, ws);
1763
1788
  author(eng, ws, "bootstrap", "installDomain", installPayload(eng.hashes.nomos, eng.nomosPkg, "githolon-proof"), "");
1764
1789
  author(eng, ws, "nomos", "installDomain", installPayload(lawHash, deployBody.packageUsda, "githolon-proof"), eng.hashes.nomos);
1765
- const v = runOfflineLegs(eng, ws, lawHash, legs, eng.hashes.nomos);
1790
+ const v = await runOfflineLegs(eng, ws, lawHash, legs, eng.hashes.nomos, deployBody.packageUsda);
1766
1791
  for (const l of v.legs) console.log(l);
1767
1792
  if (!v.ok) {
1768
1793
  console.error(`\u2717 ${v.error}`);
@@ -2226,7 +2251,7 @@ async function runProofCycle(s, cwd, deployBody, installedBy) {
2226
2251
  await mountFresh(s.eng, scratch);
2227
2252
  author(s.eng, scratch, "bootstrap", "installDomain", installPayload(s.eng.hashes.nomos, s.eng.nomosPkg, installedBy), "");
2228
2253
  author(s.eng, scratch, "nomos", "installDomain", installPayload(s.lawHash, deployBody.packageUsda, installedBy), s.eng.hashes.nomos);
2229
- return runOfflineLegs(s.eng, scratch, s.lawHash, legs);
2254
+ return await runOfflineLegs(s.eng, scratch, s.lawHash, legs, s.eng.hashes.nomos, deployBody.packageUsda);
2230
2255
  } catch (e) {
2231
2256
  return { ok: false, ms: 0, legs: [], error: String(e.message ?? e) };
2232
2257
  } finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "githolon",
3
- "version": "0.30.1",
3
+ "version": "0.31.1",
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.1",
33
- "@githolon/dsl": "^0.30.1",
32
+ "@githolon/client": "^0.31.1",
33
+ "@githolon/dsl": "^0.31.1",
34
34
  "isomorphic-git": "^1.38.4"
35
35
  },
36
36
  "devDependencies": {