githolon 0.98.2 → 0.99.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 +119 -20
- package/dist/dev-server.mjs +5 -0
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -2527,6 +2527,11 @@ async function boot(eng, ws, ledger) {
|
|
|
2527
2527
|
}
|
|
2528
2528
|
async function deploy(eng, ws, ledger, usda, domainHash, dispositions, opts = {}) {
|
|
2529
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 } : {} });
|
|
2530
|
+
if (result.ok === false) {
|
|
2531
|
+
throw new Error(
|
|
2532
|
+
`deploy-refused: installing ${domainHash.slice(0, 12)}\u2026 was REFUSED by the one gate (custody unchanged): ${result.error ?? "unknown refusal"}`
|
|
2533
|
+
);
|
|
2534
|
+
}
|
|
2530
2535
|
const installation = qById(eng, ws, `domain-installation:${domainHash}`);
|
|
2531
2536
|
const keys = installation[0]?.data?.domainKeys ?? installation[0]?.domainKeys ?? [];
|
|
2532
2537
|
if (keys.length > 0) {
|
|
@@ -2814,10 +2819,12 @@ async function fetchJsonCached(url, cacheFile) {
|
|
|
2814
2819
|
throw e;
|
|
2815
2820
|
}
|
|
2816
2821
|
}
|
|
2817
|
-
async function fetchRuntime(cloud) {
|
|
2822
|
+
async function fetchRuntime(cloud, kind = "production") {
|
|
2818
2823
|
const cache = join2(configDir(), "runtime");
|
|
2819
2824
|
let wasmBytes;
|
|
2820
|
-
const
|
|
2825
|
+
const wasmName = kind === "test-mint" ? "holon-testmint.wasm" : "holon.wasm";
|
|
2826
|
+
const wasmUrl = kind === "test-mint" ? "holon-testmint.wasm" : "holon.wasm";
|
|
2827
|
+
const wasmCache = join2(cache, wasmName);
|
|
2821
2828
|
const localWasm = process.env["NOMOS_LOCAL_WASM"];
|
|
2822
2829
|
if (localWasm) {
|
|
2823
2830
|
const bytes = readFileSync(localWasm);
|
|
@@ -2825,7 +2832,7 @@ async function fetchRuntime(cloud) {
|
|
|
2825
2832
|
return { wasmBytes: bytes, packages: packages2 };
|
|
2826
2833
|
}
|
|
2827
2834
|
try {
|
|
2828
|
-
const r = await fetch(`${cloud}/v1/runtime
|
|
2835
|
+
const r = await fetch(`${cloud}/v1/runtime/${wasmUrl}`);
|
|
2829
2836
|
if (!r.ok) throw new Error(`runtime wasm \u2192 ${r.status}`);
|
|
2830
2837
|
wasmBytes = new Uint8Array(await r.arrayBuffer());
|
|
2831
2838
|
mkdirSync2(cache, { recursive: true });
|
|
@@ -2891,8 +2898,8 @@ function readTreeFromDisk(diskPath) {
|
|
|
2891
2898
|
}
|
|
2892
2899
|
return new Directory2(contents);
|
|
2893
2900
|
}
|
|
2894
|
-
async function holonEngine(cloud, overlay, installedBy) {
|
|
2895
|
-
const runtime = await fetchRuntime(cloud);
|
|
2901
|
+
async function holonEngine(cloud, overlay, installedBy, runtimeKind = "production") {
|
|
2902
|
+
const runtime = await fetchRuntime(cloud, runtimeKind);
|
|
2896
2903
|
const replica = BigInt(`0x${randomBytes(8).toString("hex")}`) & (1n << 63n) - 1n;
|
|
2897
2904
|
const eng = await createEngine({
|
|
2898
2905
|
wasmModule: await WebAssembly.compile(runtime.wasmBytes),
|
|
@@ -5839,7 +5846,7 @@ async function runOfflineLegs(eng, ws, lawHash, legs, frameworkHash, deployUsda)
|
|
|
5839
5846
|
if (i > 0 && deployUsda !== void 0) {
|
|
5840
5847
|
cbWs = await mountIsolatedProofWs(eng, ws, lawHash, deployUsda);
|
|
5841
5848
|
}
|
|
5842
|
-
const v = runChildBirthLeg(eng, cbWs, lawHash, birthLeg, frameworkHash);
|
|
5849
|
+
const v = await runChildBirthLeg(eng, cbWs, lawHash, birthLeg, frameworkHash);
|
|
5843
5850
|
lines.push(...v.legs);
|
|
5844
5851
|
if (!v.ok) return done(false, lines, v.error);
|
|
5845
5852
|
}
|
|
@@ -5867,25 +5874,72 @@ function warrantParentForBirth(eng, parentWs, parentDomain, lawHash, genesisOwne
|
|
|
5867
5874
|
return { ok: false, error: `no directive registered for '${directiveId}' under '${parentDomain}' or 'nomos'` };
|
|
5868
5875
|
};
|
|
5869
5876
|
for (const principal of birthActor === genesisOwner ? [genesisOwner] : [genesisOwner, birthActor]) {
|
|
5870
|
-
const en = authorFrameworkAs("enrollSigner", {
|
|
5877
|
+
const en = authorFrameworkAs("enrollSigner", {
|
|
5878
|
+
keyHash: keyHashOf(dev2.public),
|
|
5879
|
+
grantedBy: principal,
|
|
5880
|
+
grantedAt: 1,
|
|
5881
|
+
// The offline harness runs the explicit test-mint kernel. Give its synthetic founder the same
|
|
5882
|
+
// on-chain provenance a real login's IdP-backed enrollment carries, so a child law that correctly
|
|
5883
|
+
// requires a VERIFIED parent attestation can be proven without weakening that production rule.
|
|
5884
|
+
verifiedVia: OFFLINE_PROOF_VERIFIER
|
|
5885
|
+
}, principal);
|
|
5871
5886
|
if (en.ok === false && !/already|create-once|enrolled/i.test(en.error ?? "")) return { ok: false, error: `enrollSigner(${principal}) refused: ${en.error}` };
|
|
5872
5887
|
}
|
|
5873
|
-
const
|
|
5888
|
+
const root = authorKeygen(eng);
|
|
5889
|
+
setTestKRoot(eng, root.public);
|
|
5890
|
+
const parentCert = certSign(eng, {
|
|
5891
|
+
child: parentWs,
|
|
5892
|
+
founder: genesisOwner,
|
|
5893
|
+
verified: true,
|
|
5894
|
+
parentKey: dev2.public,
|
|
5895
|
+
parentId: "root",
|
|
5896
|
+
epoch: 0,
|
|
5897
|
+
secret: dev2.secret
|
|
5898
|
+
});
|
|
5899
|
+
const rootDelegation = certSign(eng, {
|
|
5900
|
+
child: parentWs,
|
|
5901
|
+
founder: genesisOwner,
|
|
5902
|
+
verified: true,
|
|
5903
|
+
parentKey: dev2.public,
|
|
5904
|
+
parentId: "root",
|
|
5905
|
+
epoch: 0,
|
|
5906
|
+
secret: root.secret
|
|
5907
|
+
});
|
|
5908
|
+
const childDelegation = certSign(eng, {
|
|
5909
|
+
child: parentWs,
|
|
5910
|
+
founder: birthActor,
|
|
5911
|
+
verified: true,
|
|
5912
|
+
parentKey: dev2.public,
|
|
5913
|
+
parentId: parentWs,
|
|
5914
|
+
epoch: 0,
|
|
5915
|
+
secret: dev2.secret
|
|
5916
|
+
});
|
|
5917
|
+
const ed = authorFrameworkAs("enrollDelegation", {
|
|
5918
|
+
user: birthActor,
|
|
5919
|
+
deviceKey: dev2.public,
|
|
5920
|
+
certJson: JSON.stringify(childDelegation),
|
|
5921
|
+
enrolledAt: stamp
|
|
5922
|
+
}, birthActor);
|
|
5923
|
+
const hasDelegation = !(ed.ok === false && /no directive registered/i.test(ed.error ?? ""));
|
|
5924
|
+
if (ed.ok === false && !/already|create-once|enrolled|no directive registered/i.test(ed.error ?? "")) {
|
|
5925
|
+
return { ok: false, error: `enrollDelegation(${birthActor}) refused: ${ed.error}` };
|
|
5926
|
+
}
|
|
5874
5927
|
const sba = authorFrameworkAs("seedBirthAttestation", {
|
|
5875
5928
|
child: parentWs,
|
|
5876
5929
|
founder: genesisOwner,
|
|
5877
|
-
verified: "
|
|
5930
|
+
verified: "true",
|
|
5878
5931
|
parentId: parentWs,
|
|
5879
5932
|
parentKey: dev2.public,
|
|
5880
5933
|
epoch: 0,
|
|
5881
|
-
certChain: JSON.stringify({ links: [
|
|
5934
|
+
certChain: JSON.stringify({ links: [parentCert, rootDelegation] })
|
|
5882
5935
|
}, genesisOwner);
|
|
5883
|
-
|
|
5936
|
+
const hasParentAttestation = !(sba.ok === false && /no directive registered/i.test(sba.error ?? ""));
|
|
5937
|
+
if (sba.ok === false && !/already|create-once|attest|no directive registered/i.test(sba.error ?? "")) return { ok: false, error: `seedBirthAttestation refused: ${sba.error}` };
|
|
5884
5938
|
const sg = authorFrameworkAs("seedGenesis", { principal: genesisOwner, workspaceId: parentWs, bornAt: stamp }, genesisOwner);
|
|
5885
5939
|
if (sg.ok === false && !/already|create-once|warrant/i.test(sg.error ?? "")) return { ok: false, error: `seedGenesis refused: ${sg.error}` };
|
|
5886
|
-
return { ok: true };
|
|
5940
|
+
return { ok: true, attestationVerified: hasDelegation && hasParentAttestation };
|
|
5887
5941
|
}
|
|
5888
|
-
function attestedBirthOffer(eng, parentWs, parentDomain, directiveId, payloadNoCert, lawHash, founder, dev2) {
|
|
5942
|
+
function attestedBirthOffer(eng, parentWs, parentDomain, directiveId, payloadNoCert, lawHash, founder, dev2, verified = true) {
|
|
5889
5943
|
const probe = author(eng, parentWs, parentDomain, directiveId, payloadNoCert, lawHash, { actor: founder });
|
|
5890
5944
|
if (probe.ok !== false) {
|
|
5891
5945
|
return { res: probe };
|
|
@@ -5898,7 +5952,7 @@ function attestedBirthOffer(eng, parentWs, parentDomain, directiveId, payloadNoC
|
|
|
5898
5952
|
const signed = certSign(eng, {
|
|
5899
5953
|
child: childName,
|
|
5900
5954
|
founder,
|
|
5901
|
-
verified
|
|
5955
|
+
verified,
|
|
5902
5956
|
parentKey: dev2.public,
|
|
5903
5957
|
parentId: parentWs,
|
|
5904
5958
|
epoch: 0,
|
|
@@ -5908,7 +5962,7 @@ function attestedBirthOffer(eng, parentWs, parentDomain, directiveId, payloadNoC
|
|
|
5908
5962
|
const res = author(eng, parentWs, parentDomain, directiveId, payload, lawHash, { actor: founder, authorSecret: dev2.secret });
|
|
5909
5963
|
return { res, childName };
|
|
5910
5964
|
}
|
|
5911
|
-
function runChildBirthLeg(eng, ws, lawHash, cb, frameworkHash) {
|
|
5965
|
+
async function runChildBirthLeg(eng, ws, lawHash, cb, frameworkHash) {
|
|
5912
5966
|
const t0 = performance.now();
|
|
5913
5967
|
const lines = [];
|
|
5914
5968
|
const done = (ok, error) => ({ ok, ms: performance.now() - t0, legs: lines, ...error !== void 0 ? { error } : {} });
|
|
@@ -5968,7 +6022,8 @@ function runChildBirthLeg(eng, ws, lawHash, cb, frameworkHash) {
|
|
|
5968
6022
|
setupPayload,
|
|
5969
6023
|
lawHash,
|
|
5970
6024
|
founder,
|
|
5971
|
-
dev2
|
|
6025
|
+
dev2,
|
|
6026
|
+
true
|
|
5972
6027
|
);
|
|
5973
6028
|
if (setupRes.ok === false) {
|
|
5974
6029
|
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`);
|
|
@@ -5988,7 +6043,17 @@ function runChildBirthLeg(eng, ws, lawHash, cb, frameworkHash) {
|
|
|
5988
6043
|
return done(true);
|
|
5989
6044
|
}
|
|
5990
6045
|
}
|
|
5991
|
-
const { res } = attestedBirthOffer(
|
|
6046
|
+
const { res } = attestedBirthOffer(
|
|
6047
|
+
eng,
|
|
6048
|
+
parentWs,
|
|
6049
|
+
cb.parentDomain,
|
|
6050
|
+
cb.birthDirectiveId,
|
|
6051
|
+
payload,
|
|
6052
|
+
lawHash,
|
|
6053
|
+
founder,
|
|
6054
|
+
dev2,
|
|
6055
|
+
cb.parentSetup === void 0 || warrant.attestationVerified === true
|
|
6056
|
+
);
|
|
5992
6057
|
if (res.ok === false) {
|
|
5993
6058
|
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)`);
|
|
5994
6059
|
}
|
|
@@ -6062,6 +6127,28 @@ function runChildBirthLeg(eng, ws, lawHash, cb, frameworkHash) {
|
|
|
6062
6127
|
return done(false, `the born child ${childWs} FAILED verify_chain at ${verdict.check ?? "?"}${verdict.atIndex !== void 0 ? ` (intent ${verdict.atIndex})` : ""}: ${verdict.error ?? "invalid"} \u2014 the child's own gate refused its genesis`);
|
|
6063
6128
|
}
|
|
6064
6129
|
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)`);
|
|
6130
|
+
const bornEntry = (res.born ?? []).find((b) => b?.workspace === childWs);
|
|
6131
|
+
const packed = packBornChildren(eng, bornEntry === void 0 ? [] : [bornEntry]);
|
|
6132
|
+
const childPack = packed.find((b) => b.workspace === childWs);
|
|
6133
|
+
if (!childPack?.packB64 || !childPack.head) {
|
|
6134
|
+
return done(false, `the born child ${childWs} could not be packed for its own custody \u2014 persistence would be masked by the parent engine`);
|
|
6135
|
+
}
|
|
6136
|
+
try {
|
|
6137
|
+
await ingestPackAsCustody(eng, childWs, new Uint8Array(Buffer.from(childPack.packB64, "base64")), childPack.head);
|
|
6138
|
+
} catch (e) {
|
|
6139
|
+
return done(false, `recovering ${childWs} from its custody pack failed: ${e.message}`);
|
|
6140
|
+
}
|
|
6141
|
+
const recoveredVerify = verifyChainLocal(eng, childWs);
|
|
6142
|
+
if (recoveredVerify.valid !== true) {
|
|
6143
|
+
return done(false, `the recovered child ${childWs} FAILED verify_chain from its own custody: ${recoveredVerify.error ?? "invalid"}`);
|
|
6144
|
+
}
|
|
6145
|
+
if (cb.childSeedInstanceId !== void 0) {
|
|
6146
|
+
const recoveredRows = qById(eng, childWs, cb.childSeedInstanceId);
|
|
6147
|
+
if (recoveredRows.length < 1) {
|
|
6148
|
+
return done(false, `the recovered child ${childWs} verified but its business root ${cb.childSeedInstanceId} was missing`);
|
|
6149
|
+
}
|
|
6150
|
+
}
|
|
6151
|
+
lines.push(`\u2713 persistence + recovery \u2014 child custody packed, resident copy discarded, verify_chain GREEN and ${cb.childSeedInstanceId ?? cb.childSeedAggregateId ?? "the business root"} readable after reopen`);
|
|
6065
6152
|
return done(true);
|
|
6066
6153
|
}
|
|
6067
6154
|
function seatRelationAuthority(eng, ws, lawHash, rb, actor, stamp, lines, authorSecret, subjectActor = actor) {
|
|
@@ -6231,7 +6318,17 @@ function runBornContextLeg(eng, ws, lawHash, rb, ACTOR, stamp) {
|
|
|
6231
6318
|
if (bc.frameworkHashField !== void 0) birthPayload[bc.frameworkHashField] = fw;
|
|
6232
6319
|
if (bc.lawHashField !== void 0) birthPayload[bc.lawHashField] = lawHash;
|
|
6233
6320
|
for (const f of bc.birthAutoStamped) birthPayload[f] = stamp;
|
|
6234
|
-
const { res: birthRes } = attestedBirthOffer(
|
|
6321
|
+
const { res: birthRes } = attestedBirthOffer(
|
|
6322
|
+
eng,
|
|
6323
|
+
ws,
|
|
6324
|
+
rb.domain,
|
|
6325
|
+
bc.birthDirectiveId,
|
|
6326
|
+
birthPayload,
|
|
6327
|
+
lawHash,
|
|
6328
|
+
founder,
|
|
6329
|
+
dev2,
|
|
6330
|
+
true
|
|
6331
|
+
);
|
|
6235
6332
|
if (birthRes.ok === false) {
|
|
6236
6333
|
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}"`);
|
|
6237
6334
|
return done(true);
|
|
@@ -6292,7 +6389,8 @@ async function runOfflineProofStandalone(proofPath, cloud, domain) {
|
|
|
6292
6389
|
const deployBody = JSON.parse(readFileSync7(deployFile, "utf8"));
|
|
6293
6390
|
const lawHash = await sha256hex(deployBody.packageUsda);
|
|
6294
6391
|
console.log(`githolon proof \u2014 OFFLINE legs on a local holon (the cloud loop: githolon proof --live)`);
|
|
6295
|
-
const
|
|
6392
|
+
const runtimeKind = legs.childBirth !== void 0 || (legs.childBirths?.length ?? 0) > 0 ? "test-mint" : "production";
|
|
6393
|
+
const { eng } = await holonEngine(cloud, deployBody, "githolon-proof", runtimeKind);
|
|
6296
6394
|
const ws = "proof-offline";
|
|
6297
6395
|
await mountFresh(eng, ws);
|
|
6298
6396
|
author(eng, ws, "bootstrap", "installDomain", installPayload(eng.hashes.nomos, eng.nomosPkg, "githolon-proof"), "");
|
|
@@ -6308,13 +6406,14 @@ OFFLINE PROOF GREEN (${Math.round(v.ms)}ms) \u2014 the same legs rerun on every
|
|
|
6308
6406
|
console.log(`Deploy with confidence when ready: githolon ws create <ws> && githolon deploy <ws> (or the full cloud proof: githolon proof --live)`);
|
|
6309
6407
|
return 0;
|
|
6310
6408
|
}
|
|
6311
|
-
var keyHashOf;
|
|
6409
|
+
var keyHashOf, OFFLINE_PROOF_VERIFIER;
|
|
6312
6410
|
var init_proof_offline = __esm({
|
|
6313
6411
|
"src/proof_offline.ts"() {
|
|
6314
6412
|
"use strict";
|
|
6315
6413
|
init_engine();
|
|
6316
6414
|
init_local_holon();
|
|
6317
6415
|
keyHashOf = (pubB64) => createHash4("sha256").update(Buffer.from(pubB64, "base64")).digest("hex");
|
|
6416
|
+
OFFLINE_PROOF_VERIFIER = "nomos:test-mint";
|
|
6318
6417
|
}
|
|
6319
6418
|
});
|
|
6320
6419
|
|
package/dist/dev-server.mjs
CHANGED
|
@@ -1377,6 +1377,11 @@ async function boot(eng, ws, ledger) {
|
|
|
1377
1377
|
}
|
|
1378
1378
|
async function deploy(eng, ws, ledger, usda, domainHash, dispositions, opts = {}) {
|
|
1379
1379
|
const result = author(eng, ws, "nomos", "installDomain", installPayload(domainHash, usda, eng.installedBy, dispositions), eng.hashes.nomos, { actor: opts.actor ?? "", ...opts.authToken ? { authToken: opts.authToken } : {} });
|
|
1380
|
+
if (result.ok === false) {
|
|
1381
|
+
throw new Error(
|
|
1382
|
+
`deploy-refused: installing ${domainHash.slice(0, 12)}\u2026 was REFUSED by the one gate (custody unchanged): ${result.error ?? "unknown refusal"}`
|
|
1383
|
+
);
|
|
1384
|
+
}
|
|
1380
1385
|
const installation = qById(eng, ws, `domain-installation:${domainHash}`);
|
|
1381
1386
|
const keys = installation[0]?.data?.domainKeys ?? installation[0]?.domainKeys ?? [];
|
|
1382
1387
|
if (keys.length > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "githolon",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.99.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.99.0",
|
|
33
|
+
"@githolon/dsl": "^0.99.0",
|
|
34
34
|
"isomorphic-git": "^1.38.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|