githolon 0.27.0 → 0.28.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 +41 -8
  2. package/package.json +3 -3
package/dist/cli.mjs CHANGED
@@ -651,12 +651,11 @@ async function wsRetire(ws, opts) {
651
651
  let v;
652
652
  try {
653
653
  const principal = resolveGovernancePrincipal2(opts);
654
- v = await signAndPostGovernance2(
655
- parent,
656
- "retireWorkspace",
657
- { workspaceId: ws, retiredBy: principal, retiredAt: Date.now() },
658
- opts
659
- );
654
+ const payload = { workspaceId: ws, retiredBy: principal, retiredAt: Date.now() };
655
+ v = await signAndPostGovernance2(parent, "retireOwnWorkspace", payload, opts);
656
+ if (!v.ok && v.status === 422) {
657
+ v = await signAndPostGovernance2(parent, "retireWorkspace", payload, opts);
658
+ }
660
659
  } catch (e) {
661
660
  err2(e.message);
662
661
  return 1;
@@ -1436,7 +1435,8 @@ __export(proof_offline_exports, {
1436
1435
  parseOfflineLegs: () => parseOfflineLegs,
1437
1436
  runChildBirthLeg: () => runChildBirthLeg,
1438
1437
  runOfflineLegs: () => runOfflineLegs,
1439
- runOfflineProofStandalone: () => runOfflineProofStandalone
1438
+ runOfflineProofStandalone: () => runOfflineProofStandalone,
1439
+ runRelationBootstrapLeg: () => runRelationBootstrapLeg
1440
1440
  });
1441
1441
  import { existsSync as existsSync5, readFileSync as readFileSync4 } from "node:fs";
1442
1442
  import { basename, dirname as dirname3, join as join6 } from "node:path";
@@ -1531,7 +1531,12 @@ function runOfflineLegs(eng, ws, lawHash, legs, frameworkHash) {
1531
1531
  lines.push(...v.legs);
1532
1532
  if (!v.ok) return done(false, lines, v.error);
1533
1533
  }
1534
- if (legs.directiveId === void 0 && legs.childBirth === void 0) {
1534
+ if (legs.relationBootstrap !== void 0) {
1535
+ const v = runRelationBootstrapLeg(eng, ws, lawHash, legs.relationBootstrap);
1536
+ lines.push(...v.legs);
1537
+ if (!v.ok) return done(false, lines, v.error);
1538
+ }
1539
+ if (legs.directiveId === void 0 && legs.childBirth === void 0 && legs.relationBootstrap === void 0) {
1535
1540
  lines.push(`\u2713 ${legs.domain} \u2014 compile-valid (the law compiled; no standalone create or .births() to prove a write)${kinds.length ? ` [${kinds.join(", ")}]` : ""}`);
1536
1541
  }
1537
1542
  return done(true, lines);
@@ -1636,6 +1641,34 @@ function runChildBirthLeg(eng, ws, lawHash, cb, frameworkHash) {
1636
1641
  lines.push(`\u2713 verify_chain GREEN on the born child ${childWs} (${verdict.plansRerun ?? "?"} plans re-run \u2014 it self-validates from intent 0 through its OWN gate)`);
1637
1642
  return done(true);
1638
1643
  }
1644
+ function runRelationBootstrapLeg(eng, ws, lawHash, rb) {
1645
+ const t0 = performance.now();
1646
+ const lines = [];
1647
+ const done = (ok, error) => ({ ok, ms: performance.now() - t0, legs: lines, ...error !== void 0 ? { error } : {} });
1648
+ const ACTOR = "user:proof-conformance";
1649
+ const actorOpts = { actor: ACTOR };
1650
+ const stamp = (/* @__PURE__ */ new Date()).toISOString();
1651
+ const grantPayload = { ...rb.grantPayload };
1652
+ const overwrite = /* @__PURE__ */ new Set([...rb.grantSubjectFields, ...rb.grantGrantedByFields]);
1653
+ for (const k of Object.keys(grantPayload)) {
1654
+ if (overwrite.has(k) || /^(subject|principal|grantedBy|grantee|member|user)$/i.test(k)) grantPayload[k] = ACTOR;
1655
+ }
1656
+ for (const f of rb.grantAutoStamped) grantPayload[f] = stamp;
1657
+ const grantRes = author(eng, ws, rb.domain, rb.grantDirectiveId, grantPayload, lawHash, actorOpts);
1658
+ if (grantRes.ok === false) {
1659
+ return done(false, `relation bootstrap grant ${rb.domain}/${rb.grantDirectiveId} refused: ${grantRes.error ?? "unknown"} \u2014 the grant that should seat "${rb.relation}" on the proof actor was rejected (is ${rb.grantDirectiveId} itself gated? add .grants("${rb.relation}") + an ungated bootstrap, or prove by hand)`);
1660
+ }
1661
+ lines.push(`\u2713 relation bootstrap (grant) \u2014 ${rb.domain}/${rb.grantDirectiveId} granted "${rb.relation}" to ${ACTOR} (${rb.via})`);
1662
+ const gatedPayload = { ...rb.gatedPayload };
1663
+ for (const f of rb.gatedAutoStamped) gatedPayload[f] = stamp;
1664
+ if (rb.gatedMintField !== void 0 && rb.gatedAggregateId !== void 0) gatedPayload[rb.gatedMintField] = mintId(eng, rb.gatedAggregateId);
1665
+ const gatedRes = author(eng, ws, rb.domain, rb.gatedDirectiveId, gatedPayload, lawHash, actorOpts);
1666
+ if (gatedRes.ok === false) {
1667
+ return done(false, `relation bootstrap prove ${rb.domain}/${rb.gatedDirectiveId} refused: ${gatedRes.error ?? "unknown"} \u2014 the gated write did NOT succeed even after granting "${rb.relation}" to the actor (the gate is not honoring the seeded relation, OR the grant did not seat R on ${ACTOR})`);
1668
+ }
1669
+ lines.push(`\u2713 relation bootstrap (prove) \u2014 ${rb.domain}/${rb.gatedDirectiveId} authored under the seeded holder of "${rb.relation}" (gated write SUCCEEDS once granted)`);
1670
+ return done(true);
1671
+ }
1639
1672
  function actorFromPayload(payload, field) {
1640
1673
  if (field === void 0) return void 0;
1641
1674
  const value = payload[field];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "githolon",
3
- "version": "0.27.0",
3
+ "version": "0.28.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.27.0",
33
- "@githolon/dsl": "^0.27.0",
32
+ "@githolon/client": "^0.28.0",
33
+ "@githolon/dsl": "^0.28.0",
34
34
  "isomorphic-git": "^1.38.4"
35
35
  },
36
36
  "devDependencies": {