githolon 0.101.6 → 0.102.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 +24100 -8471
- package/dist/dev-server.mjs +101 -28
- package/dist/framework/domain_bootstrap.package.usda +11789 -6
- package/dist/framework/domain_nomos.package.usda +18377 -6
- package/package.json +2 -3
package/dist/dev-server.mjs
CHANGED
|
@@ -775,6 +775,14 @@ function currentLaw(eng, ws) {
|
|
|
775
775
|
function installedLaw(eng, ws) {
|
|
776
776
|
return JSON.parse(call(eng.ex, "query", { repoArg: repoArgOf(ws), workspace: ws, queryBytes: b64Json({ op: "installedLaw" }), branch: BRANCH }, eng.STDERR));
|
|
777
777
|
}
|
|
778
|
+
function kernelStamp(eng, ws) {
|
|
779
|
+
return JSON.parse(call(eng.ex, "query", {
|
|
780
|
+
repoArg: repoArgOf(ws),
|
|
781
|
+
workspace: ws,
|
|
782
|
+
queryBytes: b64Json({ op: "kernelStamp" }),
|
|
783
|
+
branch: BRANCH
|
|
784
|
+
}, eng.STDERR));
|
|
785
|
+
}
|
|
778
786
|
function domainPackage(eng, ws, hash) {
|
|
779
787
|
return JSON.parse(call(eng.ex, "query", { repoArg: repoArgOf(ws), workspace: ws, queryBytes: b64Json({ op: "domainPackage", hash }), branch: BRANCH }, eng.STDERR));
|
|
780
788
|
}
|
|
@@ -1422,7 +1430,8 @@ async function deploy(eng, ws, ledger, usda, domainHash, dispositions, opts = {}
|
|
|
1422
1430
|
const payload = upgrade ? stagePayload(domainHash, usda, eng.installedBy, supersedes) : installPayload(domainHash, usda, eng.installedBy, dispositions);
|
|
1423
1431
|
const result = author(eng, ws, "nomos", directiveId, payload, eng.hashes.nomos, {
|
|
1424
1432
|
actor: opts.actor ?? "",
|
|
1425
|
-
...opts.authToken ? { authToken: opts.authToken } : {}
|
|
1433
|
+
...opts.authToken ? { authToken: opts.authToken } : {},
|
|
1434
|
+
...opts.authorSecret ? { authorSecret: opts.authorSecret } : {}
|
|
1426
1435
|
});
|
|
1427
1436
|
if (result.ok === false) {
|
|
1428
1437
|
unmount(eng, ws);
|
|
@@ -1738,26 +1747,6 @@ async function bootstrapPlatform(dev, opts) {
|
|
|
1738
1747
|
}
|
|
1739
1748
|
log2(`platform '${platform}' genesis'd via the operator anchor lane (framework ${eng.hashes.nomos.slice(0, 12)})`);
|
|
1740
1749
|
});
|
|
1741
|
-
if (opts.deploy) {
|
|
1742
|
-
const body = JSON.parse(readFileSync(opts.deploy, "utf8"));
|
|
1743
|
-
const usda = body.packageUsda || body.usda;
|
|
1744
|
-
if (!usda) throw new Error(`--deploy ${opts.deploy} has no packageUsda (nothing to install)`);
|
|
1745
|
-
const deployErr = await serialize(async () => {
|
|
1746
|
-
const ledger = ledgerFor(platform);
|
|
1747
|
-
const domainHash = await sha256hex(usda);
|
|
1748
|
-
try {
|
|
1749
|
-
const out = await deploy(eng, platform, ledger, usda, domainHash, body.dispositions || null, { actor: "user:dev-admin" });
|
|
1750
|
-
if (out && out.ok === false) return String(out.error || "the law refused the platform package");
|
|
1751
|
-
log2(`platform law deployed: ${domainHash.slice(0, 12)} (head ${String(out.head).slice(0, 12)})`);
|
|
1752
|
-
return null;
|
|
1753
|
-
} catch (e) {
|
|
1754
|
-
return errMsg(e);
|
|
1755
|
-
}
|
|
1756
|
-
});
|
|
1757
|
-
if (deployErr) throw new Error(`platform law deploy REFUSED: ${deployErr.slice(0, 400)}`);
|
|
1758
|
-
} else {
|
|
1759
|
-
log2("no --deploy given; platform runs framework law only (deploy your platform package to enable births)");
|
|
1760
|
-
}
|
|
1761
1750
|
const testMint = isTestMint(eng);
|
|
1762
1751
|
if (!testMint) {
|
|
1763
1752
|
throw new Error(
|
|
@@ -1797,7 +1786,7 @@ async function bootstrapPlatform(dev, opts) {
|
|
|
1797
1786
|
// signed by S_root
|
|
1798
1787
|
});
|
|
1799
1788
|
const certChain = JSON.stringify({ links: [platformCert] });
|
|
1800
|
-
const homeDomain =
|
|
1789
|
+
const homeDomain = FRAMEWORK_HOME_DOMAIN;
|
|
1801
1790
|
const lawKeys = await serialize(async () => {
|
|
1802
1791
|
await mountWorkspace(eng, platform, ledgerFor(platform));
|
|
1803
1792
|
return currentLaw(eng, platform);
|
|
@@ -1880,6 +1869,31 @@ async function bootstrapPlatform(dev, opts) {
|
|
|
1880
1869
|
dev.homeDomain = homeDomain;
|
|
1881
1870
|
}
|
|
1882
1871
|
}
|
|
1872
|
+
if (opts.deploy) {
|
|
1873
|
+
const body = JSON.parse(readFileSync(opts.deploy, "utf8"));
|
|
1874
|
+
const usda = body.packageUsda || body.usda;
|
|
1875
|
+
if (!usda) throw new Error(`--deploy ${opts.deploy} has no packageUsda (nothing to install)`);
|
|
1876
|
+
const founderDevice = dev.operatorDevice;
|
|
1877
|
+
if (!founderDevice) throw new Error("platform law deploy needs the warranted founder device established by bootstrap");
|
|
1878
|
+
const deployErr = await serialize(async () => {
|
|
1879
|
+
const ledger = ledgerFor(platform);
|
|
1880
|
+
const domainHash = await sha256hex(usda);
|
|
1881
|
+
try {
|
|
1882
|
+
const out = await deploy(eng, platform, ledger, usda, domainHash, body.dispositions || null, {
|
|
1883
|
+
actor: "user:dev-operator",
|
|
1884
|
+
authorSecret: founderDevice.secret
|
|
1885
|
+
});
|
|
1886
|
+
if (out && out.ok === false) return String(out.error || "the law refused the platform package");
|
|
1887
|
+
log2(`platform law deployed: ${domainHash.slice(0, 12)} (head ${String(out.head).slice(0, 12)})`);
|
|
1888
|
+
return null;
|
|
1889
|
+
} catch (e) {
|
|
1890
|
+
return errMsg(e);
|
|
1891
|
+
}
|
|
1892
|
+
});
|
|
1893
|
+
if (deployErr) throw new Error(`platform law deploy REFUSED: ${deployErr.slice(0, 400)}`);
|
|
1894
|
+
} else {
|
|
1895
|
+
log2("no --deploy given; platform runs framework law only (deploy your platform package to enable births)");
|
|
1896
|
+
}
|
|
1883
1897
|
if (opts.authProvider || opts.firebaseProject) {
|
|
1884
1898
|
log2(`AuthProvider: ${opts.authProvider || `firebase:${opts.firebaseProject}`} \u2014 register it via the platform's setAuthProvider governance offer;`);
|
|
1885
1899
|
log2(" the kernel verifies x-nomos-auth JWTs against the law-declared key (host stays blind).");
|
|
@@ -1888,13 +1902,14 @@ async function bootstrapPlatform(dev, opts) {
|
|
|
1888
1902
|
log2(attested ? "bootstrap complete \u2014 platform law deployed + ROOT-ATTESTED (BirthAttestation certChain seeded; birthHome assembles a valid travelling cert)." : "bootstrap complete (platform law deployed; attested-birth legs gated as noted above \u2014 need the test-mint wasm).");
|
|
1889
1903
|
return { platform, testMint, attested };
|
|
1890
1904
|
}
|
|
1891
|
-
var log2;
|
|
1905
|
+
var log2, FRAMEWORK_HOME_DOMAIN;
|
|
1892
1906
|
var init_bootstrap = __esm({
|
|
1893
1907
|
"../cloud/dev-server/bootstrap.ts"() {
|
|
1894
1908
|
"use strict";
|
|
1895
1909
|
init_engine();
|
|
1896
1910
|
init_types();
|
|
1897
1911
|
log2 = (m) => console.log(`[bootstrap] ${m}`);
|
|
1912
|
+
FRAMEWORK_HOME_DOMAIN = "__nomos_application_home_v1";
|
|
1898
1913
|
}
|
|
1899
1914
|
});
|
|
1900
1915
|
|
|
@@ -1998,8 +2013,8 @@ function resolveGatewayOperation(spec, opName, method) {
|
|
|
1998
2013
|
|
|
1999
2014
|
// ../cloud/cloudflare-shell/src/kernel-registry.generated.ts
|
|
2000
2015
|
var DEPLOYED_KERNELS = [
|
|
2001
|
-
{ prefix: "
|
|
2002
|
-
{ prefix: "
|
|
2016
|
+
{ prefix: "bc52f7eb", hash: "bc52f7eb630bc5a9a03b4c62b9b7ab58c4b6f25e687ecd51c72f9251763593fc", version: "kernel-bc52f7eb", note: "production (this candidate)", features: ["compoundKeys", "capturedReads", "invariantGate", "surfacedMerge", "fieldProvenance", "nullSemantics", "attestedReads", "conflictSnapshots", "ownedAudience"] },
|
|
2017
|
+
{ prefix: "17d8f91b", hash: "17d8f91b661dc8c3a6dea72d699f9f5759ab5e6b4e3e3e5e90afceb3a7034154", version: "kernel-17d8f91b", note: "test-mint (this candidate) \u2014 feature-equivalent to production", features: ["compoundKeys", "capturedReads", "invariantGate", "surfacedMerge", "fieldProvenance", "nullSemantics", "attestedReads", "conflictSnapshots", "ownedAudience"] }
|
|
2003
2018
|
];
|
|
2004
2019
|
|
|
2005
2020
|
// ../cloud/cloudflare-shell/src/staged-intents.ts
|
|
@@ -2527,7 +2542,22 @@ async function startDevCloud(opts = {}) {
|
|
|
2527
2542
|
return res.end(Buffer.from(wasmBytes));
|
|
2528
2543
|
}
|
|
2529
2544
|
if (url.pathname === "/v1/runtime/capabilities") {
|
|
2530
|
-
|
|
2545
|
+
let stamp = capabilitiesForKernelHash(kernelSha);
|
|
2546
|
+
if (!stamp.known) {
|
|
2547
|
+
try {
|
|
2548
|
+
const observed = kernelStamp(eng, opts.platform || "root");
|
|
2549
|
+
if (typeof observed.version === "string" && Array.isArray(observed.features) && observed.features.every((feature) => typeof feature === "string")) {
|
|
2550
|
+
stamp = {
|
|
2551
|
+
hash: kernelSha,
|
|
2552
|
+
version: observed.version,
|
|
2553
|
+
note: "kernel self-attested local candidate",
|
|
2554
|
+
features: observed.features,
|
|
2555
|
+
known: true
|
|
2556
|
+
};
|
|
2557
|
+
}
|
|
2558
|
+
} catch {
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2531
2561
|
return sendJson(res, {
|
|
2532
2562
|
ok: true,
|
|
2533
2563
|
prod: stamp,
|
|
@@ -2976,10 +3006,52 @@ Sec-WebSocket-Accept: ${accept}\r
|
|
|
2976
3006
|
persistBorn,
|
|
2977
3007
|
// `--platform` requested ⇒ NOT ready until the boot-time ceremony completes (main flips it true).
|
|
2978
3008
|
...opts.platform ? { platformReady: false } : {},
|
|
2979
|
-
close: () => new Promise((resolve) =>
|
|
3009
|
+
close: () => new Promise((resolve) => {
|
|
3010
|
+
server.close(() => resolve());
|
|
3011
|
+
server.closeAllConnections?.();
|
|
3012
|
+
})
|
|
2980
3013
|
};
|
|
2981
3014
|
return devSelf;
|
|
2982
3015
|
}
|
|
3016
|
+
async function startGeneratedApplicationProofCloud(opts) {
|
|
3017
|
+
const probe = http.createServer();
|
|
3018
|
+
await new Promise((resolve, reject) => {
|
|
3019
|
+
probe.once("error", reject);
|
|
3020
|
+
probe.listen(0, "127.0.0.1", () => resolve());
|
|
3021
|
+
});
|
|
3022
|
+
const address = probe.address();
|
|
3023
|
+
const port = typeof address === "object" && address !== null ? address.port : 0;
|
|
3024
|
+
await new Promise((resolve) => probe.close(() => resolve()));
|
|
3025
|
+
if (port <= 0) throw new Error("could not allocate a local port for the generated application proof");
|
|
3026
|
+
const dev = await startDevCloud({
|
|
3027
|
+
port,
|
|
3028
|
+
ephemeral: true,
|
|
3029
|
+
attested: true,
|
|
3030
|
+
platform: opts.platform,
|
|
3031
|
+
deploy: opts.deploy
|
|
3032
|
+
});
|
|
3033
|
+
try {
|
|
3034
|
+
const { bootstrapPlatform: bootstrapPlatform2 } = await Promise.resolve().then(() => (init_bootstrap(), bootstrap_exports));
|
|
3035
|
+
await bootstrapPlatform2(dev, { platform: opts.platform, deploy: opts.deploy, attested: true });
|
|
3036
|
+
dev.platformReady = true;
|
|
3037
|
+
if (dev.operatorDevice === void 0) {
|
|
3038
|
+
throw new Error("the local proof cloud did not establish its private founding device");
|
|
3039
|
+
}
|
|
3040
|
+
const idp = dev.testIdP;
|
|
3041
|
+
if (idp === void 0) throw new Error("the local proof cloud did not establish its test identity provider");
|
|
3042
|
+
const proofUid = `proof-owner-${createHash2("sha256").update(opts.platform).digest("hex").slice(0, 16)}`;
|
|
3043
|
+
const principal = `user:${proofUid}`;
|
|
3044
|
+
dev.generatedApplicationProof = {
|
|
3045
|
+
principal,
|
|
3046
|
+
authToken: idp.mint({ sub: proofUid })
|
|
3047
|
+
};
|
|
3048
|
+
return dev;
|
|
3049
|
+
} catch (error) {
|
|
3050
|
+
await dev.close().catch(() => {
|
|
3051
|
+
});
|
|
3052
|
+
throw error;
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
2983
3055
|
function parseArgs(argv) {
|
|
2984
3056
|
const o = {};
|
|
2985
3057
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -3035,5 +3107,6 @@ if (import.meta.url === `file://${process.argv[1]}`) {
|
|
|
3035
3107
|
});
|
|
3036
3108
|
}
|
|
3037
3109
|
export {
|
|
3038
|
-
startDevCloud
|
|
3110
|
+
startDevCloud,
|
|
3111
|
+
startGeneratedApplicationProofCloud
|
|
3039
3112
|
};
|