githolon 0.60.0 → 0.60.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 +43 -0
  2. package/package.json +3 -3
package/dist/cli.mjs CHANGED
@@ -2312,6 +2312,14 @@ function runChildBirthLeg(eng, ws, lawHash, cb, frameworkHash) {
2312
2312
  parentWs = bornParent;
2313
2313
  lines.push(`\u2713 parent setup ${setup.parentDomain}/${setup.birthDirectiveId} \u2014 ${parentWs} born before gated child birth`);
2314
2314
  }
2315
+ if (cb.relationSetup !== void 0 && actor !== void 0) {
2316
+ const seat = seatRelationAuthority(eng, parentWs, lawHash, cb.relationSetup, actor, stamp, lines);
2317
+ if (seat.error !== void 0) return done(false, `child birth ${cb.parentDomain}/${cb.birthDirectiveId}: ${seat.error}`);
2318
+ if (seat.skipped !== void 0) {
2319
+ lines.push(`\u2013 child-birth leg SKIPPED \u2014 ${cb.birthDirectiveId} .requires("${cb.birthRequiresRelation}") and the discovered authority path could not be seated: ${seat.skipped}; prove the birth by hand (or expose an ungated bootstrap seed)`);
2320
+ return done(true);
2321
+ }
2322
+ }
2315
2323
  const opts = actor !== void 0 ? { actor } : {};
2316
2324
  const res = author(eng, parentWs, cb.parentDomain, cb.birthDirectiveId, payload, lawHash, opts);
2317
2325
  if (res.ok === false) {
@@ -2389,6 +2397,41 @@ function runChildBirthLeg(eng, ws, lawHash, cb, frameworkHash) {
2389
2397
  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)`);
2390
2398
  return done(true);
2391
2399
  }
2400
+ function seatRelationAuthority(eng, ws, lawHash, rb, actor, stamp, lines) {
2401
+ const actorOpts = { actor };
2402
+ const grantedRelation = rb.grantedRelation ?? rb.relation;
2403
+ const speculative = rb.seedSpeculative === true;
2404
+ if (rb.granterAuthority !== void 0) {
2405
+ const inner = seatRelationAuthority(eng, ws, lawHash, rb.granterAuthority, actor, stamp, lines);
2406
+ if (!inner.ok) return inner;
2407
+ }
2408
+ const seatActorFields = (payload, routed) => {
2409
+ const set = new Set(routed);
2410
+ for (const k of Object.keys(payload)) {
2411
+ if (set.has(k) || /^(subject|principal|grantedBy|grantee|member|user|owner|founder)$/i.test(k)) payload[k] = actor;
2412
+ }
2413
+ };
2414
+ for (const seed of rb.prerequisiteSeeds ?? []) {
2415
+ const seedPayload = { ...seed.payload };
2416
+ seatActorFields(seedPayload, []);
2417
+ for (const f of seed.autoStamped) seedPayload[f] = stamp;
2418
+ const seedRes = author(eng, ws, rb.domain, seed.directiveId, seedPayload, lawHash, actorOpts);
2419
+ if (seedRes.ok === false) {
2420
+ return { ok: false, skipped: `the prerequisite seed ${rb.domain}/${seed.directiveId} REFUSED with a synthesized payload (${seedRes.error ?? "refused"})` };
2421
+ }
2422
+ lines.push(`\u2713 relation seat (prerequisite) \u2014 ${rb.domain}/${seed.directiveId} established (as ${actor})`);
2423
+ }
2424
+ const grantPayload = { ...rb.grantPayload };
2425
+ seatActorFields(grantPayload, [...rb.grantSubjectFields, ...rb.grantGrantedByFields]);
2426
+ for (const f of rb.grantAutoStamped) grantPayload[f] = stamp;
2427
+ const grantRes = author(eng, ws, rb.domain, rb.grantDirectiveId, grantPayload, lawHash, actorOpts);
2428
+ if (grantRes.ok === false) {
2429
+ if (speculative) return { ok: false, skipped: `the declared seed ${rb.domain}/${rb.grantDirectiveId} could not be replayed (${grantRes.error ?? "refused"})` };
2430
+ return { ok: false, error: `relation seat ${rb.domain}/${rb.grantDirectiveId} refused: ${grantRes.error ?? "unknown"} \u2014 the grant that should seat "${grantedRelation}" on ${actor} was rejected` };
2431
+ }
2432
+ lines.push(`\u2713 relation seat \u2014 ${rb.domain}/${rb.grantDirectiveId} granted "${grantedRelation}" to ${actor} (${rb.via})`);
2433
+ return { ok: true };
2434
+ }
2392
2435
  function runRelationBootstrapLeg(eng, ws, lawHash, rb) {
2393
2436
  const t0 = performance.now();
2394
2437
  const lines = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "githolon",
3
- "version": "0.60.0",
3
+ "version": "0.60.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.60.0",
33
- "@githolon/dsl": "^0.60.0",
32
+ "@githolon/client": "^0.60.1",
33
+ "@githolon/dsl": "^0.60.1",
34
34
  "isomorphic-git": "^1.38.4"
35
35
  },
36
36
  "devDependencies": {