githolon 0.96.0 → 0.97.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.
- package/dist/cli.mjs +153 -45
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -387,6 +387,7 @@ __export(engine_exports, {
|
|
|
387
387
|
ingestPackAsCustody: () => ingestPackAsCustody,
|
|
388
388
|
installPayload: () => installPayload,
|
|
389
389
|
installedLaw: () => installedLaw,
|
|
390
|
+
isWarranted: () => isWarranted,
|
|
390
391
|
kgit: () => kgit,
|
|
391
392
|
lawParity: () => lawParity,
|
|
392
393
|
ledgerStats: () => ledgerStats,
|
|
@@ -1256,7 +1257,7 @@ async function admitIntentOffers(eng, ws, ledger, offers, { receiptFence = null,
|
|
|
1256
1257
|
}
|
|
1257
1258
|
log("admit-intent-offers", { ws, sessions: sessions.size, admitted: admittedTotal, rejected: [...sessions.values()].reduce((n, s) => n + s.rejected.length, 0), resultPack: resultPackB64 ? "inline" : "none" });
|
|
1258
1259
|
const bornPacked = born.length ? packBornChildren(eng, born) : born;
|
|
1259
|
-
return { sessions: [...sessions.values()].map((s) => ({ ...s, ...s.skipped.length ? {} : { skipped: void 0 } })), main: head, deadLetters, timings,
|
|
1260
|
+
return { sessions: [...sessions.values()].map((s) => ({ ...s, ...s.skipped.length ? {} : { skipped: void 0 } })), main: head, deadLetters, timings, summary: summary ?? null, born: bornPacked, birthOutcomes, ...resultPackB64 ? { resultPackB64, resultBase: clientBase } : {}, ...deferDurability && admittedTotal && head ? { deferred: true, head } : {} };
|
|
1260
1261
|
}
|
|
1261
1262
|
async function checkpointStateHash(eng, ws) {
|
|
1262
1263
|
const rows = query(eng, ws, "aggregatesByType", JSON.stringify({ __type: "NomosSummarySubtotal" }));
|
|
@@ -1277,7 +1278,7 @@ async function authorOn(eng, ws, ledger, domain, directiveId, payload, lawHash,
|
|
|
1277
1278
|
if (res && res.ok === false) return { ok: false, error: String(res.error || "the law refused this intent").slice(0, 500) };
|
|
1278
1279
|
await commitAndPush(eng, ws, ledger);
|
|
1279
1280
|
const bornPacked = Array.isArray(res.born) && res.born.length ? packBornChildren(eng, res.born) : res.born;
|
|
1280
|
-
return { ok: true, head: res.head,
|
|
1281
|
+
return { ok: true, head: res.head, born: bornPacked ?? [], birthOutcomes: res.birthOutcomes ?? [] };
|
|
1281
1282
|
}
|
|
1282
1283
|
async function deepVerifyShard(eng, shardWs, shardLedger, coordinatorRows) {
|
|
1283
1284
|
const replay2 = await verifyChain(eng, shardWs, shardLedger);
|
|
@@ -1452,7 +1453,7 @@ function author(eng, ws, domain, directiveId, payload, controllerHash, opts = {}
|
|
|
1452
1453
|
writeWork(eng, `envelope-${seq}.json`, enc3.encode(stringifyBig(envelope)));
|
|
1453
1454
|
v = offerOnce();
|
|
1454
1455
|
}
|
|
1455
|
-
const res = v.outcome === "admitted" ? { ok: true, head: v.head, intentOut: v.intentOut,
|
|
1456
|
+
const res = v.outcome === "admitted" ? { ok: true, head: v.head, intentOut: v.intentOut, born: v.born ?? [], birthOutcomes: v.birthOutcomes ?? [], ...v.kernelSpans ? { kernelSpans: v.kernelSpans } : {} } : v.outcome === "refused" ? { ok: false, error: v.verdict?.reason ?? v.error } : v;
|
|
1456
1457
|
if (defer && res.ok) (eng.pendingProjection ??= /* @__PURE__ */ new Set()).add(ws);
|
|
1457
1458
|
return res;
|
|
1458
1459
|
}
|
|
@@ -2513,11 +2514,16 @@ async function emitOutbox(eng, ws, ledger) {
|
|
|
2513
2514
|
async function boot(eng, ws, ledger) {
|
|
2514
2515
|
const m = await mountWorkspace(eng, ws, ledger);
|
|
2515
2516
|
if (nomosActive(eng, ws)) {
|
|
2516
|
-
|
|
2517
|
+
if (ws !== "root" && !isWarranted(eng, ws)) {
|
|
2518
|
+
throw new Error(
|
|
2519
|
+
`unwarranted-workspace: '${ws}' is booted but its genesis never landed a GenesisWarrant \u2014 an era-0 workspace is born ONLY by its parent's warranted+attested birth. This is a host-authored/legacy orphan and will not serve (author its birth on its parent to bring it into the holarchy lawfully).`
|
|
2520
|
+
);
|
|
2521
|
+
}
|
|
2522
|
+
return { status: "already-initialized", head: m.remoteMain ?? void 0, controllerHash: eng.hashes.nomos, rows: qById(eng, ws, `domain-installation:${eng.hashes.nomos}`), mount: m };
|
|
2517
2523
|
}
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2524
|
+
throw new Error(
|
|
2525
|
+
`unborn-workspace: '${ws}' has no genesis and the host does not create workspaces \u2014 author its birth on its PARENT (birthChild/birthHome/an estate .births()); the parent's offer-effect materializes it in custody, then it serves from here. (root self-adopts via _ensureRootGenesis; this is not that path.)`
|
|
2526
|
+
);
|
|
2521
2527
|
}
|
|
2522
2528
|
async function deploy(eng, ws, ledger, usda, domainHash, dispositions, opts = {}) {
|
|
2523
2529
|
const result = author(eng, ws, "nomos", "installDomain", installPayload(domainHash, usda, eng.installedBy, dispositions), eng.hashes.nomos, { actor: opts.actor ?? "", ...opts.authToken ? { authToken: opts.authToken } : {} });
|
|
@@ -2634,7 +2640,7 @@ function sealAttestationBatches(eng, ws, domain, controllerHash, opts = {}) {
|
|
|
2634
2640
|
}
|
|
2635
2641
|
return outcomes;
|
|
2636
2642
|
}
|
|
2637
|
-
var enc3, dec3, BRANCH, RESULT_PACK_INLINE_MAX, dirOf, repoArgOf, gitdirOf, unpack, log, repoArgOfGitdir, bytesFromB64, kgit, installPayload, routeTagHexOfHomeKey, SUMMARY_SEP, summaryKey, splitSummaryKey, NOMOS_SHARD_ROWS_READ, groupOf, tallyOf, isExtremumRead, extremumMonotone, CKPT_REF, pushVia, fullRef, applyPackInto, custodyLsRefs, qById, query, check, expand, cryptoSealField, cryptoKeygen, authorKeygen, eraCertSign, delegationCertSign, attestationSign, attestedRead, certSign, cryptoWrapKey, cryptoUnwrapKey, readPosture, count, sum, pendingConflicts, spatialBboxParams, spatialWithin, extremum, nomosActive, refusedRefName, outboxRefName, projectionStats;
|
|
2643
|
+
var enc3, dec3, BRANCH, RESULT_PACK_INLINE_MAX, dirOf, repoArgOf, gitdirOf, unpack, log, repoArgOfGitdir, bytesFromB64, kgit, installPayload, routeTagHexOfHomeKey, SUMMARY_SEP, summaryKey, splitSummaryKey, NOMOS_SHARD_ROWS_READ, groupOf, tallyOf, isExtremumRead, extremumMonotone, CKPT_REF, pushVia, fullRef, applyPackInto, custodyLsRefs, qById, query, check, expand, cryptoSealField, cryptoKeygen, authorKeygen, eraCertSign, delegationCertSign, attestationSign, attestedRead, certSign, cryptoWrapKey, cryptoUnwrapKey, readPosture, count, sum, pendingConflicts, spatialBboxParams, spatialWithin, extremum, nomosActive, refusedRefName, outboxRefName, GENESIS_WARRANT_ID, isWarranted, projectionStats;
|
|
2638
2644
|
var init_engine = __esm({
|
|
2639
2645
|
"vendor/engine/engine.ts"() {
|
|
2640
2646
|
"use strict";
|
|
@@ -2773,6 +2779,8 @@ var init_engine = __esm({
|
|
|
2773
2779
|
nomosActive = (eng, ws) => qById(eng, ws, `domain-installation:${eng.hashes.nomos}`).length > 0;
|
|
2774
2780
|
refusedRefName = (offerId) => `refs/heads/refused/${String(offerId || "unknown").replace(/[^A-Za-z0-9._-]/g, "_")}`;
|
|
2775
2781
|
outboxRefName = (requestId) => `refs/heads/outbox/${String(requestId || "unknown").replace(/[^A-Za-z0-9._-]/g, "_")}`;
|
|
2782
|
+
GENESIS_WARRANT_ID = "genesis-warrant:self";
|
|
2783
|
+
isWarranted = (eng, ws) => qById(eng, ws, GENESIS_WARRANT_ID).length > 0;
|
|
2776
2784
|
projectionStats = (eng, ws) => JSON.parse(call(eng.ex, "query", ws ? { repoArg: repoArgOf(ws), workspace: ws, queryBytes: b64Json({ op: "projectionStats" }), branch: BRANCH } : { queryBytes: b64Json({ op: "projectionStats" }) }, eng.STDERR));
|
|
2777
2785
|
}
|
|
2778
2786
|
});
|
|
@@ -5213,6 +5221,16 @@ async function wsCreate(name, opts) {
|
|
|
5213
5221
|
});
|
|
5214
5222
|
const d = await r.json().catch(() => void 0);
|
|
5215
5223
|
if (!r.ok || d?.ok !== true) {
|
|
5224
|
+
if (r.status === 409 || /unborn|does not create|author its birth/i.test(d?.error ?? "")) {
|
|
5225
|
+
err4(
|
|
5226
|
+
`'${name}' cannot be created directly \u2014 in era-0 the host does not create workspaces; a workspace is
|
|
5227
|
+
born only by its PARENT authoring its birth (orphanless holarchy). Today:
|
|
5228
|
+
\u2022 deploy your law to a platform you own and birth homes under it (birthHome), or
|
|
5229
|
+
\u2022 request a child under a platform: githolon ws create ${name} --via <platform>
|
|
5230
|
+
(self-serve keyless birth-under-root \u2014 the direct replacement for this flat command \u2014 is in flight.)`
|
|
5231
|
+
);
|
|
5232
|
+
return 1;
|
|
5233
|
+
}
|
|
5216
5234
|
err4(`create '${name}' refused (${r.status}): ${d ? JSON.stringify(d) : "no body"}`);
|
|
5217
5235
|
return 1;
|
|
5218
5236
|
}
|
|
@@ -5695,6 +5713,7 @@ __export(proof_offline_exports, {
|
|
|
5695
5713
|
runRelationBootstrapLeg: () => runRelationBootstrapLeg
|
|
5696
5714
|
});
|
|
5697
5715
|
import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
|
|
5716
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
5698
5717
|
import { basename, dirname as dirname6, join as join9 } from "node:path";
|
|
5699
5718
|
function parseOfflineLegs(proofSource) {
|
|
5700
5719
|
if (!proofSource.includes("AUTO-GENERATED by nomos-compile")) {
|
|
@@ -5827,7 +5846,7 @@ async function runOfflineLegs(eng, ws, lawHash, legs, frameworkHash, deployUsda)
|
|
|
5827
5846
|
const rbLegs = legs.relationBootstraps ?? (legs.relationBootstrap !== void 0 ? [legs.relationBootstrap] : []);
|
|
5828
5847
|
for (const rbLeg of rbLegs) {
|
|
5829
5848
|
let rbWs = ws;
|
|
5830
|
-
if (
|
|
5849
|
+
if (deployUsda !== void 0) {
|
|
5831
5850
|
rbWs = await mountIsolatedProofWs(eng, ws, lawHash, deployUsda);
|
|
5832
5851
|
}
|
|
5833
5852
|
const v = runRelationBootstrapLeg(eng, rbWs, lawHash, rbLeg);
|
|
@@ -5839,6 +5858,56 @@ async function runOfflineLegs(eng, ws, lawHash, legs, frameworkHash, deployUsda)
|
|
|
5839
5858
|
}
|
|
5840
5859
|
return done(true, lines);
|
|
5841
5860
|
}
|
|
5861
|
+
function warrantParentForBirth(eng, parentWs, parentDomain, lawHash, genesisOwner, birthActor, dev2, stamp) {
|
|
5862
|
+
const authorFrameworkAs = (directiveId, payload, actor) => {
|
|
5863
|
+
for (const dom of [parentDomain, "nomos"]) {
|
|
5864
|
+
const r = author(eng, parentWs, dom, directiveId, payload, lawHash, { actor });
|
|
5865
|
+
if (r.ok !== false || !/no directive registered/.test(r.error ?? "")) return r;
|
|
5866
|
+
}
|
|
5867
|
+
return { ok: false, error: `no directive registered for '${directiveId}' under '${parentDomain}' or 'nomos'` };
|
|
5868
|
+
};
|
|
5869
|
+
for (const principal of birthActor === genesisOwner ? [genesisOwner] : [genesisOwner, birthActor]) {
|
|
5870
|
+
const en = authorFrameworkAs("enrollSigner", { keyHash: keyHashOf(dev2.public), grantedBy: principal, grantedAt: 1 }, principal);
|
|
5871
|
+
if (en.ok === false && !/already|create-once|enrolled/i.test(en.error ?? "")) return { ok: false, error: `enrollSigner(${principal}) refused: ${en.error}` };
|
|
5872
|
+
}
|
|
5873
|
+
const cert = certSign(eng, { child: parentWs, founder: genesisOwner, verified: false, parentKey: dev2.public, parentId: parentWs, epoch: 0, secret: dev2.secret });
|
|
5874
|
+
const sba = authorFrameworkAs("seedBirthAttestation", {
|
|
5875
|
+
child: parentWs,
|
|
5876
|
+
founder: genesisOwner,
|
|
5877
|
+
verified: "false",
|
|
5878
|
+
parentId: parentWs,
|
|
5879
|
+
parentKey: dev2.public,
|
|
5880
|
+
epoch: 0,
|
|
5881
|
+
certChain: JSON.stringify({ links: [cert] })
|
|
5882
|
+
}, genesisOwner);
|
|
5883
|
+
if (sba.ok === false && !/already|create-once|attest/i.test(sba.error ?? "")) return { ok: false, error: `seedBirthAttestation refused: ${sba.error}` };
|
|
5884
|
+
const sg = authorFrameworkAs("seedGenesis", { principal: genesisOwner, workspaceId: parentWs, bornAt: stamp }, genesisOwner);
|
|
5885
|
+
if (sg.ok === false && !/already|create-once|warrant/i.test(sg.error ?? "")) return { ok: false, error: `seedGenesis refused: ${sg.error}` };
|
|
5886
|
+
return { ok: true };
|
|
5887
|
+
}
|
|
5888
|
+
function attestedBirthOffer(eng, parentWs, parentDomain, directiveId, payloadNoCert, lawHash, founder, dev2) {
|
|
5889
|
+
const probe = author(eng, parentWs, parentDomain, directiveId, payloadNoCert, lawHash, { actor: founder });
|
|
5890
|
+
if (probe.ok !== false) {
|
|
5891
|
+
return { res: probe };
|
|
5892
|
+
}
|
|
5893
|
+
const m = /birth-unattestable \(([^)]*)\)/.exec(probe.error ?? "");
|
|
5894
|
+
if (m === null || m[1] === void 0 || m[1].length === 0) {
|
|
5895
|
+
return { res: probe, ...probe.error !== void 0 ? { error: probe.error } : {} };
|
|
5896
|
+
}
|
|
5897
|
+
const childName = m[1];
|
|
5898
|
+
const signed = certSign(eng, {
|
|
5899
|
+
child: childName,
|
|
5900
|
+
founder,
|
|
5901
|
+
verified: false,
|
|
5902
|
+
parentKey: dev2.public,
|
|
5903
|
+
parentId: parentWs,
|
|
5904
|
+
epoch: 0,
|
|
5905
|
+
secret: dev2.secret
|
|
5906
|
+
});
|
|
5907
|
+
const payload = { ...payloadNoCert, birthCert: JSON.stringify(signed) };
|
|
5908
|
+
const res = author(eng, parentWs, parentDomain, directiveId, payload, lawHash, { actor: founder, authorSecret: dev2.secret });
|
|
5909
|
+
return { res, childName };
|
|
5910
|
+
}
|
|
5842
5911
|
function runChildBirthLeg(eng, ws, lawHash, cb, frameworkHash) {
|
|
5843
5912
|
const t0 = performance.now();
|
|
5844
5913
|
const lines = [];
|
|
@@ -5860,6 +5929,27 @@ function runChildBirthLeg(eng, ws, lawHash, cb, frameworkHash) {
|
|
|
5860
5929
|
if (cb.birthRequiresRelation !== void 0 && actor === void 0) {
|
|
5861
5930
|
return done(false, `child birth ${cb.parentDomain}/${cb.birthDirectiveId} is gated by .requires("${cb.birthRequiresRelation}") but the proof could not discover an actor field from the birth recipe \u2014 route the genesis step actor from a payload subject field`);
|
|
5862
5931
|
}
|
|
5932
|
+
const SENTINEL_PRINCIPAL = /^(user:|key:)?0+(-0+)*$/;
|
|
5933
|
+
const founder = actor !== void 0 && !SENTINEL_PRINCIPAL.test(actor) ? actor : "user:00000000-0000-4000-8000-000000000001";
|
|
5934
|
+
if (cb.birthActorField !== void 0) payload[cb.birthActorField] = founder;
|
|
5935
|
+
const seatOwnerFields = (pl) => {
|
|
5936
|
+
for (const k of Object.keys(pl)) {
|
|
5937
|
+
if (/^(subject|principal|owner|ownerSubject|founder|member|grantee|user)$/i.test(k) && typeof pl[k] === "string") pl[k] = founder;
|
|
5938
|
+
}
|
|
5939
|
+
};
|
|
5940
|
+
seatOwnerFields(payload);
|
|
5941
|
+
const genesisOwner = founder;
|
|
5942
|
+
const dev2 = authorKeygen(eng);
|
|
5943
|
+
const devKeyHash = keyHashOf(dev2.public);
|
|
5944
|
+
const injectDeviceKeyHash = (pl) => {
|
|
5945
|
+
for (const k of Object.keys(pl)) if (/keyhash$/i.test(k) && typeof pl[k] === "string") pl[k] = devKeyHash;
|
|
5946
|
+
};
|
|
5947
|
+
injectDeviceKeyHash(payload);
|
|
5948
|
+
const topBirthDomain = cb.parentSetup?.parentDomain ?? cb.parentDomain;
|
|
5949
|
+
const warrant = warrantParentForBirth(eng, ws, topBirthDomain, lawHash, genesisOwner, founder, dev2, stamp);
|
|
5950
|
+
if (warrant.ok === false) {
|
|
5951
|
+
return done(false, `child birth ${cb.parentDomain}/${cb.birthDirectiveId}: could not warrant the parent '${ws}' for attested birth \u2014 ${warrant.error}`);
|
|
5952
|
+
}
|
|
5863
5953
|
let parentWs = ws;
|
|
5864
5954
|
if (cb.parentSetup !== void 0) {
|
|
5865
5955
|
const setup = cb.parentSetup;
|
|
@@ -5867,22 +5957,21 @@ function runChildBirthLeg(eng, ws, lawHash, cb, frameworkHash) {
|
|
|
5867
5957
|
if (setup.frameworkHashField !== void 0) setupPayload[setup.frameworkHashField] = fw;
|
|
5868
5958
|
if (setup.lawHashField !== void 0) setupPayload[setup.lawHashField] = lawHash;
|
|
5869
5959
|
for (const f of setup.birthAutoStamped) setupPayload[f] = stamp;
|
|
5870
|
-
if (setup.birthActorField !== void 0
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
const
|
|
5874
|
-
const setupOpts = setupActor !== void 0 ? { actor: setupActor } : {};
|
|
5875
|
-
const setupRes = author(
|
|
5960
|
+
if (setup.birthActorField !== void 0) setupPayload[setup.birthActorField] = founder;
|
|
5961
|
+
seatOwnerFields(setupPayload);
|
|
5962
|
+
injectDeviceKeyHash(setupPayload);
|
|
5963
|
+
const { res: setupRes, error: setupErr } = attestedBirthOffer(
|
|
5876
5964
|
eng,
|
|
5877
5965
|
ws,
|
|
5878
5966
|
setup.parentDomain,
|
|
5879
5967
|
setup.birthDirectiveId,
|
|
5880
5968
|
setupPayload,
|
|
5881
5969
|
lawHash,
|
|
5882
|
-
|
|
5970
|
+
founder,
|
|
5971
|
+
dev2
|
|
5883
5972
|
);
|
|
5884
5973
|
if (setupRes.ok === false) {
|
|
5885
|
-
return done(false, `parent setup ${setup.parentDomain}/${setup.birthDirectiveId} refused: ${setupRes.error ?? "unknown"} \u2014 the proof could not birth the parent workspace needed before gated child birth`);
|
|
5974
|
+
return done(false, `parent setup ${setup.parentDomain}/${setup.birthDirectiveId} refused: ${setupErr ?? setupRes.error ?? "unknown"} \u2014 the proof could not birth the parent workspace needed before gated child birth`);
|
|
5886
5975
|
}
|
|
5887
5976
|
const bornParent = (setupRes.born ?? []).map((b) => b?.workspace).find((w) => typeof w === "string" && w.length > 0);
|
|
5888
5977
|
if (bornParent === void 0) {
|
|
@@ -5891,16 +5980,15 @@ function runChildBirthLeg(eng, ws, lawHash, cb, frameworkHash) {
|
|
|
5891
5980
|
parentWs = bornParent;
|
|
5892
5981
|
lines.push(`\u2713 parent setup ${setup.parentDomain}/${setup.birthDirectiveId} \u2014 ${parentWs} born before gated child birth`);
|
|
5893
5982
|
}
|
|
5894
|
-
if (cb.relationSetup !== void 0
|
|
5895
|
-
const seat = seatRelationAuthority(eng, parentWs, lawHash, cb.relationSetup,
|
|
5983
|
+
if (cb.relationSetup !== void 0) {
|
|
5984
|
+
const seat = seatRelationAuthority(eng, parentWs, lawHash, cb.relationSetup, genesisOwner, stamp, lines, dev2.secret, founder);
|
|
5896
5985
|
if (seat.error !== void 0) return done(false, `child birth ${cb.parentDomain}/${cb.birthDirectiveId}: ${seat.error}`);
|
|
5897
5986
|
if (seat.skipped !== void 0) {
|
|
5898
5987
|
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)`);
|
|
5899
5988
|
return done(true);
|
|
5900
5989
|
}
|
|
5901
5990
|
}
|
|
5902
|
-
const
|
|
5903
|
-
const res = author(eng, parentWs, cb.parentDomain, cb.birthDirectiveId, payload, lawHash, opts);
|
|
5991
|
+
const { res } = attestedBirthOffer(eng, parentWs, cb.parentDomain, cb.birthDirectiveId, payload, lawHash, founder, dev2);
|
|
5904
5992
|
if (res.ok === false) {
|
|
5905
5993
|
return done(false, `child birth ${cb.parentDomain}/${cb.birthDirectiveId} refused: ${res.error ?? "unknown"} \u2014 the parent's own gate rejected the birth offer (check the .births() plan + payload)`);
|
|
5906
5994
|
}
|
|
@@ -5976,13 +6064,13 @@ function runChildBirthLeg(eng, ws, lawHash, cb, frameworkHash) {
|
|
|
5976
6064
|
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)`);
|
|
5977
6065
|
return done(true);
|
|
5978
6066
|
}
|
|
5979
|
-
function seatRelationAuthority(eng, ws, lawHash, rb, actor, stamp, lines) {
|
|
5980
|
-
const actorOpts = { actor };
|
|
6067
|
+
function seatRelationAuthority(eng, ws, lawHash, rb, actor, stamp, lines, authorSecret, subjectActor = actor) {
|
|
6068
|
+
const actorOpts = authorSecret !== void 0 ? { actor, authorSecret } : { actor };
|
|
5981
6069
|
const bareActor = actor.replace(/^user:/, "");
|
|
5982
6070
|
const grantedRelation = rb.grantedRelation ?? rb.relation;
|
|
5983
6071
|
const speculative = rb.seedSpeculative === true;
|
|
5984
6072
|
if (rb.granterAuthority !== void 0) {
|
|
5985
|
-
const inner = seatRelationAuthority(eng, ws, lawHash, rb.granterAuthority, actor, stamp, lines);
|
|
6073
|
+
const inner = seatRelationAuthority(eng, ws, lawHash, rb.granterAuthority, actor, stamp, lines, authorSecret, actor);
|
|
5986
6074
|
if (!inner.ok) return inner;
|
|
5987
6075
|
}
|
|
5988
6076
|
const seatActorFields = (payload, routed, wrapped = []) => {
|
|
@@ -6026,14 +6114,17 @@ function seatRelationAuthority(eng, ws, lawHash, rb, actor, stamp, lines) {
|
|
|
6026
6114
|
lines.push(`\u2713 relation seat (prerequisite) \u2014 ${rb.domain}/${seed.directiveId} established (as ${actor})`);
|
|
6027
6115
|
}
|
|
6028
6116
|
const grantPayload = { ...rb.grantPayload };
|
|
6029
|
-
seatActorFields(grantPayload, [...rb.
|
|
6117
|
+
seatActorFields(grantPayload, [...rb.grantGrantedByFields], []);
|
|
6118
|
+
const bareSubject = subjectActor.replace(/^user:/, "");
|
|
6119
|
+
for (const f of rb.grantSubjectFields) grantPayload[f] = subjectActor;
|
|
6120
|
+
for (const f of rb.grantSubjectWrappedFields ?? []) grantPayload[f] = bareSubject;
|
|
6030
6121
|
for (const f of rb.grantAutoStamped) grantPayload[f] = stamp;
|
|
6031
6122
|
const grantRes = dispatchSeat(rb.grantDirectiveId, grantPayload);
|
|
6032
6123
|
if (grantRes.ok === false) {
|
|
6033
6124
|
if (speculative) return { ok: false, skipped: `the declared seed ${rb.domain}/${rb.grantDirectiveId} could not be replayed (${grantRes.error ?? "refused"})` };
|
|
6034
|
-
return { ok: false, error: `relation seat ${rb.domain}/${rb.grantDirectiveId} refused: ${grantRes.error ?? "unknown"} \u2014 the grant that should seat "${grantedRelation}" on ${
|
|
6125
|
+
return { ok: false, error: `relation seat ${rb.domain}/${rb.grantDirectiveId} refused: ${grantRes.error ?? "unknown"} \u2014 the grant that should seat "${grantedRelation}" on ${subjectActor} was rejected` };
|
|
6035
6126
|
}
|
|
6036
|
-
lines.push(`\u2713 relation seat \u2014 ${rb.domain}/${rb.grantDirectiveId} granted "${grantedRelation}" to ${
|
|
6127
|
+
lines.push(`\u2713 relation seat \u2014 ${rb.domain}/${rb.grantDirectiveId} granted "${grantedRelation}" to ${subjectActor} (${rb.via})`);
|
|
6037
6128
|
return { ok: true };
|
|
6038
6129
|
}
|
|
6039
6130
|
function runRelationBootstrapLeg(eng, ws, lawHash, rb) {
|
|
@@ -6121,13 +6212,26 @@ function runBornContextLeg(eng, ws, lawHash, rb, ACTOR, stamp) {
|
|
|
6121
6212
|
const done = (ok, error) => ({ ok, ms: performance.now() - t0, legs: lines, ...error !== void 0 ? { error } : {} });
|
|
6122
6213
|
const bc = rb.bornContext;
|
|
6123
6214
|
const fw = eng.hashes?.nomos;
|
|
6124
|
-
const
|
|
6215
|
+
const SENTINEL = /^(user:|key:)?0+(-0+)*$/;
|
|
6216
|
+
const founder = ACTOR && !SENTINEL.test(ACTOR) ? ACTOR : "user:00000000-0000-4000-8000-000000000001";
|
|
6217
|
+
const dev2 = authorKeygen(eng);
|
|
6218
|
+
const devKeyHash = keyHashOf(dev2.public);
|
|
6219
|
+
const warrant = warrantParentForBirth(eng, ws, rb.domain, lawHash, founder, founder, dev2, stamp);
|
|
6220
|
+
if (warrant.ok === false) {
|
|
6221
|
+
lines.push(`\u2013 relation-bootstrap leg SKIPPED (layer-4 born-context) \u2014 could not warrant '${ws}' for attested birth (${warrant.error})`);
|
|
6222
|
+
return done(true);
|
|
6223
|
+
}
|
|
6224
|
+
const actorOpts = { actor: founder, authorSecret: dev2.secret };
|
|
6125
6225
|
const birthPayload = { ...bc.birthPayload };
|
|
6126
|
-
if (bc.ownerField !== void 0) birthPayload[bc.ownerField] =
|
|
6226
|
+
if (bc.ownerField !== void 0) birthPayload[bc.ownerField] = founder;
|
|
6227
|
+
for (const k of Object.keys(birthPayload)) {
|
|
6228
|
+
if (/^(subject|principal|owner|ownerSubject|founder|member|grantee|user)$/i.test(k) && typeof birthPayload[k] === "string") birthPayload[k] = founder;
|
|
6229
|
+
if (/keyhash$/i.test(k) && typeof birthPayload[k] === "string") birthPayload[k] = devKeyHash;
|
|
6230
|
+
}
|
|
6127
6231
|
if (bc.frameworkHashField !== void 0) birthPayload[bc.frameworkHashField] = fw;
|
|
6128
6232
|
if (bc.lawHashField !== void 0) birthPayload[bc.lawHashField] = lawHash;
|
|
6129
6233
|
for (const f of bc.birthAutoStamped) birthPayload[f] = stamp;
|
|
6130
|
-
const birthRes =
|
|
6234
|
+
const { res: birthRes } = attestedBirthOffer(eng, ws, rb.domain, bc.birthDirectiveId, birthPayload, lawHash, founder, dev2);
|
|
6131
6235
|
if (birthRes.ok === false) {
|
|
6132
6236
|
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}"`);
|
|
6133
6237
|
return done(true);
|
|
@@ -6140,11 +6244,11 @@ function runBornContextLeg(eng, ws, lawHash, rb, ACTOR, stamp) {
|
|
|
6140
6244
|
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}`);
|
|
6141
6245
|
const gatedPayload = { ...rb.gatedPayload };
|
|
6142
6246
|
for (const k of Object.keys(gatedPayload)) {
|
|
6143
|
-
if (/^(subject|principal|owner|ownerSubject|grantee|member|user)$/i.test(k)) gatedPayload[k] =
|
|
6247
|
+
if (/^(subject|principal|owner|ownerSubject|grantee|member|user)$/i.test(k)) gatedPayload[k] = founder;
|
|
6144
6248
|
}
|
|
6145
6249
|
for (const f of rb.gatedAutoStamped) gatedPayload[f] = stamp;
|
|
6146
6250
|
if (rb.gatedMintField !== void 0 && rb.gatedAggregateId !== void 0) gatedPayload[rb.gatedMintField] = mintId(eng, rb.gatedAggregateId);
|
|
6147
|
-
const gatedRes = author(eng, bornWs, rb.domain, rb.gatedDirectiveId, gatedPayload, lawHash,
|
|
6251
|
+
const gatedRes = author(eng, bornWs, rb.domain, rb.gatedDirectiveId, gatedPayload, lawHash, { actor: founder, authorSecret: dev2.secret });
|
|
6148
6252
|
if (gatedRes.ok === false) {
|
|
6149
6253
|
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`);
|
|
6150
6254
|
return done(true);
|
|
@@ -6204,11 +6308,13 @@ OFFLINE PROOF GREEN (${Math.round(v.ms)}ms) \u2014 the same legs rerun on every
|
|
|
6204
6308
|
console.log(`Deploy with confidence when ready: githolon ws create <ws> && githolon deploy <ws> (or the full cloud proof: githolon proof --live)`);
|
|
6205
6309
|
return 0;
|
|
6206
6310
|
}
|
|
6311
|
+
var keyHashOf;
|
|
6207
6312
|
var init_proof_offline = __esm({
|
|
6208
6313
|
"src/proof_offline.ts"() {
|
|
6209
6314
|
"use strict";
|
|
6210
6315
|
init_engine();
|
|
6211
6316
|
init_local_holon();
|
|
6317
|
+
keyHashOf = (pubB64) => createHash4("sha256").update(Buffer.from(pubB64, "base64")).digest("hex");
|
|
6212
6318
|
}
|
|
6213
6319
|
});
|
|
6214
6320
|
|
|
@@ -6604,7 +6710,8 @@ async function harnessInstall(opts) {
|
|
|
6604
6710
|
writeFileSync8(outPath, treeBytes);
|
|
6605
6711
|
process.stderr.write(`harness-install: snapshot written (${treeBytes.length} bytes) \u2192 ${outPath}
|
|
6606
6712
|
`);
|
|
6607
|
-
|
|
6713
|
+
const harnessDevice = authorKeygen(eng);
|
|
6714
|
+
process.stdout.write(JSON.stringify({ ok: true, snapshot: outPath, workspace, lawHashes, frameworkHash: eng.hashes.nomos, devicePublic: harnessDevice.public, deviceSecret: harnessDevice.secret }) + "\n");
|
|
6608
6715
|
return 0;
|
|
6609
6716
|
}
|
|
6610
6717
|
var STALE_RUNTIME_HINT, die;
|
|
@@ -6703,7 +6810,7 @@ var init_doctor = __esm({
|
|
|
6703
6810
|
});
|
|
6704
6811
|
|
|
6705
6812
|
// src/scene_projector.ts
|
|
6706
|
-
import { createHash as
|
|
6813
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
6707
6814
|
function fnv1a32(s) {
|
|
6708
6815
|
let h = 2166136261;
|
|
6709
6816
|
for (let i = 0; i < s.length; i++) {
|
|
@@ -7673,7 +7780,7 @@ var sha256Hex, add, sub, mul, norm, cross, seededAngle, r3, round3, sanitize, KI
|
|
|
7673
7780
|
var init_scene_projector = __esm({
|
|
7674
7781
|
"src/scene_projector.ts"() {
|
|
7675
7782
|
"use strict";
|
|
7676
|
-
sha256Hex = (s) =>
|
|
7783
|
+
sha256Hex = (s) => createHash5("sha256").update(s).digest("hex");
|
|
7677
7784
|
add = (a, b) => [a[0] + b[0], a[1] + b[1], a[2] + b[2]];
|
|
7678
7785
|
sub = (a, b) => [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
|
|
7679
7786
|
mul = (a, k) => [a[0] * k, a[1] * k, a[2] * k];
|
|
@@ -7760,7 +7867,7 @@ __export(scene_exports, {
|
|
|
7760
7867
|
});
|
|
7761
7868
|
import { existsSync as existsSync15, mkdirSync as mkdirSync6, writeFileSync as writeFileSync9 } from "node:fs";
|
|
7762
7869
|
import { join as join16, resolve as resolve4 } from "node:path";
|
|
7763
|
-
import { createHash as
|
|
7870
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
7764
7871
|
import git3 from "isomorphic-git";
|
|
7765
7872
|
async function walkChain2(eng, ws) {
|
|
7766
7873
|
const gitdir = gitdirOf(ws);
|
|
@@ -7887,7 +7994,7 @@ var init_scene = __esm({
|
|
|
7887
7994
|
init_scene_projector();
|
|
7888
7995
|
out11 = (s) => void process.stdout.write(s + "\n");
|
|
7889
7996
|
err11 = (s) => void process.stderr.write("error: " + s + "\n");
|
|
7890
|
-
sha256 = (s) =>
|
|
7997
|
+
sha256 = (s) => createHash6("sha256").update(s).digest("hex");
|
|
7891
7998
|
}
|
|
7892
7999
|
});
|
|
7893
8000
|
|
|
@@ -8839,13 +8946,13 @@ var HELP = {
|
|
|
8839
8946
|
},
|
|
8840
8947
|
secret: {
|
|
8841
8948
|
usage: "githolon secret <set <ws> <push-password> | rotate <ws>> [--cloud <url>]",
|
|
8842
|
-
what: "The git push-password store (~/.holon/credentials.json, 0600) for
|
|
8949
|
+
what: "The git push-password store (~/.holon/credentials.json, 0600) for authenticated git sync to the\ncloud host. The open deploy lane uses no secret. `set` imports a push password you already hold;\n`rotate` is RETIRED (the host holds no ownership credential to rotate \u2014 410). (There is no\npush-to-create birth: a workspace is born by its parent authoring its birth.)",
|
|
8843
8950
|
examples: ["githolon secret set my-ws holon_v1_\u2026"]
|
|
8844
8951
|
},
|
|
8845
8952
|
git: {
|
|
8846
8953
|
usage: "githolon git <setup | remote [<ws>] [<remoteName>]> [--cloud <url>] [--target <name>]",
|
|
8847
|
-
what: "Stock git
|
|
8848
|
-
examples: ["githolon git setup", "githolon git remote my-guestbook", "git push nomos
|
|
8954
|
+
what: "Stock git as the sync transport. `setup` installs the credential helper for the cloud host;\n`remote` wires this repo to a workspace (then push your session branch: git push nomos\nrefs/heads/session/<id>). `main` is not push-writable \u2014 a workspace is born by its PARENT\nauthoring its birth (birthHome/birthChild), never by a push. With no <ws>, the project's\n`workspace` binding resolves it.",
|
|
8955
|
+
examples: ["githolon git setup", "githolon git remote my-guestbook", "git push nomos refs/heads/session/dev"]
|
|
8849
8956
|
},
|
|
8850
8957
|
ledger: {
|
|
8851
8958
|
usage: "githolon ledger <init|verify> <dir> [--file <deploy.json>] [--cloud <url>]",
|
|
@@ -8915,8 +9022,9 @@ async function ledgerInit(dir, opts) {
|
|
|
8915
9022
|
spawnSync4("git", ["-C", dir, "reset", "--hard", "main"], { stdio: "ignore" });
|
|
8916
9023
|
out7(`\u2713 holon written \u2192 ${dir} (a normal git repo; git log IS the audit trail)`);
|
|
8917
9024
|
out7(`
|
|
8918
|
-
|
|
8919
|
-
out7(`
|
|
9025
|
+
A workspace is born by its PARENT (birthHome/birthChild/your .births() directive) \u2014 not by a push.`);
|
|
9026
|
+
out7(`Deploy your law + sync your writes:`);
|
|
9027
|
+
out7(` cd ${dir} && npx githolon ws create <ws> && npx githolon deploy <ws>`);
|
|
8920
9028
|
return 0;
|
|
8921
9029
|
}
|
|
8922
9030
|
async function ledgerVerify(dir, opts) {
|
|
@@ -9439,13 +9547,13 @@ deploy is OPEN + kernel-gated \u2014 births return no host secret, ownership is
|
|
|
9439
9547
|
[--with <hashOrKey>] no longer served) via a signed installDomain offer
|
|
9440
9548
|
githolon dlq sweep <ws> [--depth <n>] [--full] sweep a platform subtree's dead-letter queues
|
|
9441
9549
|
(registry-enumerated; exit 2 when jams exist)
|
|
9442
|
-
githolon secret set <ws> <push-password> store a git push password (
|
|
9550
|
+
githolon secret set <ws> <push-password> store a git push password (authenticated git sync)
|
|
9443
9551
|
githolon secret rotate <ws> RETIRED \u2014 host holds no ownership credential (410)
|
|
9444
9552
|
|
|
9445
|
-
Git lane (stock git
|
|
9553
|
+
Git lane (stock git as the sync transport \u2014 main is not push-writable; a workspace is born by its parent):
|
|
9446
9554
|
githolon git setup install the credential helper for the cloud host
|
|
9447
9555
|
githolon git remote [<ws>] [<remoteName>] wire this repo to a workspace (default name: nomos)
|
|
9448
|
-
then: git push nomos
|
|
9556
|
+
then: git push nomos refs/heads/session/<id>
|
|
9449
9557
|
|
|
9450
9558
|
The local-first lane (mint + assert a holon on YOUR machine, under YOUR identity):
|
|
9451
9559
|
githolon ledger init <dir> genesis + your compiled law, verified by the SAME
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "githolon",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.97.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.
|
|
33
|
-
"@githolon/dsl": "^0.
|
|
32
|
+
"@githolon/client": "^0.97.0",
|
|
33
|
+
"@githolon/dsl": "^0.97.0",
|
|
34
34
|
"isomorphic-git": "^1.38.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|