githolon 0.83.0 → 0.84.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.
- package/dist/cli.mjs +2 -1
- package/dist/dev-server.mjs +64 -13
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -9448,7 +9448,8 @@ ${commandHelp("dev")}`);
|
|
|
9448
9448
|
if (sub2 !== "dev") {
|
|
9449
9449
|
process.stderr.write(`error: unknown cloud subcommand '${sub2 ?? ""}'
|
|
9450
9450
|
usage: githolon cloud dev [--port <n>] [--data <dir>] [--ephemeral]
|
|
9451
|
-
[--platform <name>] [--deploy <file>] [--auth-provider <p>] [--firebase-project <id>]
|
|
9451
|
+
[--platform <name>] [--deploy <file>] [--auth-provider <p>] [--firebase-project <id>]
|
|
9452
|
+
[--bootstrap] [--attested] [--kernel-source <url>]
|
|
9452
9453
|
`);
|
|
9453
9454
|
return 1;
|
|
9454
9455
|
}
|
package/dist/dev-server.mjs
CHANGED
|
@@ -1412,7 +1412,7 @@ init_engine();
|
|
|
1412
1412
|
init_custody_transport();
|
|
1413
1413
|
import http from "node:http";
|
|
1414
1414
|
import { createHash, randomBytes } from "node:crypto";
|
|
1415
|
-
import { readFileSync as readFileSync2, existsSync as existsSync2, mkdirSync as mkdirSync2, mkdtempSync } from "node:fs";
|
|
1415
|
+
import { readFileSync as readFileSync2, writeFileSync, existsSync as existsSync2, mkdirSync as mkdirSync2, mkdtempSync } from "node:fs";
|
|
1416
1416
|
import { fileURLToPath } from "node:url";
|
|
1417
1417
|
import path from "node:path";
|
|
1418
1418
|
import os from "node:os";
|
|
@@ -1596,21 +1596,61 @@ function firstExisting(...paths) {
|
|
|
1596
1596
|
}
|
|
1597
1597
|
return null;
|
|
1598
1598
|
}
|
|
1599
|
-
|
|
1599
|
+
var TEST_MINT_MARKER = Buffer.from("set_test_k_root");
|
|
1600
|
+
var isTestMintBytes = (bytes) => bytes.includes(TEST_MINT_MARKER);
|
|
1601
|
+
var DEFAULT_KERNEL_SOURCE = "https://nomos.captainapp.co.uk";
|
|
1602
|
+
async function resolveTestMintWasm(kernelSource) {
|
|
1603
|
+
const runtimeCache = path.join(configDir(), "runtime");
|
|
1604
|
+
const cachePath = path.join(runtimeCache, "holon-testmint.wasm");
|
|
1605
|
+
const local = process.env.NOMOS_LOCAL_WASM;
|
|
1606
|
+
if (local && existsSync2(local)) {
|
|
1607
|
+
const bytes = readFileSync2(local);
|
|
1608
|
+
if (isTestMintBytes(bytes)) return { wasmPath: local, wasmBytes: bytes, kernelKind: "test-mint", kernelSource: "NOMOS_LOCAL_WASM" };
|
|
1609
|
+
}
|
|
1610
|
+
if (existsSync2(cachePath)) {
|
|
1611
|
+
const bytes = readFileSync2(cachePath);
|
|
1612
|
+
if (isTestMintBytes(bytes)) return { wasmPath: cachePath, wasmBytes: bytes, kernelKind: "test-mint", kernelSource: "cache" };
|
|
1613
|
+
}
|
|
1614
|
+
const src = String(kernelSource || process.env.NOMOS_KERNEL_SOURCE || DEFAULT_KERNEL_SOURCE).replace(/\/+$/, "");
|
|
1615
|
+
const url = `${src}/v1/runtime/holon-testmint.wasm`;
|
|
1616
|
+
try {
|
|
1617
|
+
const resp = await _realFetch(url);
|
|
1618
|
+
if (resp.ok) {
|
|
1619
|
+
const bytes = Buffer.from(await resp.arrayBuffer());
|
|
1620
|
+
if (isTestMintBytes(bytes)) {
|
|
1621
|
+
mkdirSync2(runtimeCache, { recursive: true });
|
|
1622
|
+
writeFileSync(cachePath, bytes);
|
|
1623
|
+
return { wasmPath: cachePath, wasmBytes: bytes, kernelKind: "test-mint", kernelSource: `fetched ${url}` };
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
} catch {
|
|
1627
|
+
}
|
|
1628
|
+
throw new Error(
|
|
1629
|
+
`attested births need the test-mint kernel; it couldn't be fetched from ${src} (offline?) \u2014 build one: git-holon/build_wasm.sh --release --features test-mint --bin wasm_git_holon and set NOMOS_LOCAL_WASM`
|
|
1630
|
+
);
|
|
1631
|
+
}
|
|
1632
|
+
async function loadRuntime(opts = {}) {
|
|
1600
1633
|
const runtimeCache = path.join(configDir(), "runtime");
|
|
1601
1634
|
const repoDomainsDir = path.join(REPO_ROOT, "cloud/cloudflare-shell/container/domains");
|
|
1602
1635
|
const vendoredFrameworkDir = path.join(DIR, "framework");
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1636
|
+
let wasmPath, wasmBytes, kernelKind, kernelSource;
|
|
1637
|
+
if (opts.attested) {
|
|
1638
|
+
({ wasmPath, wasmBytes, kernelKind, kernelSource } = await resolveTestMintWasm(opts.kernelSource));
|
|
1639
|
+
} else {
|
|
1640
|
+
wasmPath = firstExisting(
|
|
1641
|
+
process.env.NOMOS_LOCAL_WASM,
|
|
1642
|
+
path.join(REPO_ROOT, "cloud/cloudflare-shell/container/vendor/wasm_git_holon.wasm"),
|
|
1643
|
+
path.join(runtimeCache, "holon.wasm")
|
|
1611
1644
|
);
|
|
1645
|
+
if (!wasmPath) {
|
|
1646
|
+
throw new Error(
|
|
1647
|
+
"no kernel wasm found. Warm the kernel first:\n \u2022 set NOMOS_LOCAL_WASM=<path to holon.wasm>, OR\n \u2022 run any `githolon` cloud command once (e.g. `githolon ledger verify \u2026`) to cache ~/.holon/runtime/holon.wasm\n (attested births additionally require a test-mint wasm \u2014 pass --bootstrap or --attested)"
|
|
1648
|
+
);
|
|
1649
|
+
}
|
|
1650
|
+
wasmBytes = readFileSync2(wasmPath);
|
|
1651
|
+
kernelKind = isTestMintBytes(wasmBytes) ? "test-mint" : "production";
|
|
1652
|
+
kernelSource = wasmPath === process.env.NOMOS_LOCAL_WASM ? "NOMOS_LOCAL_WASM" : wasmPath.startsWith(runtimeCache) ? "cache" : "repo-vendor";
|
|
1612
1653
|
}
|
|
1613
|
-
const wasmBytes = readFileSync2(wasmPath);
|
|
1614
1654
|
const repoBootstrap = firstExisting(path.join(repoDomainsDir, "domain_bootstrap.package.usda"));
|
|
1615
1655
|
const repoNomos = firstExisting(path.join(repoDomainsDir, "domain_nomos.package.usda"));
|
|
1616
1656
|
let bootstrapPkg, nomosPkg;
|
|
@@ -1631,7 +1671,7 @@ function loadRuntime() {
|
|
|
1631
1671
|
bootstrapPkg = pkgs.bootstrap;
|
|
1632
1672
|
nomosPkg = pkgs.nomos;
|
|
1633
1673
|
}
|
|
1634
|
-
return { wasmPath, wasmBytes, bootstrapPkg, nomosPkg };
|
|
1674
|
+
return { wasmPath, wasmBytes, bootstrapPkg, nomosPkg, kernelKind, kernelSource };
|
|
1635
1675
|
}
|
|
1636
1676
|
async function startDevCloud(opts = {}) {
|
|
1637
1677
|
const port = opts.port || 8787;
|
|
@@ -1640,7 +1680,9 @@ async function startDevCloud(opts = {}) {
|
|
|
1640
1680
|
const ephemeral = !!opts.ephemeral;
|
|
1641
1681
|
const dataDir = ephemeral ? mkdtempSync(path.join(os.tmpdir(), "nomos-dev-cloud-")) : path.resolve(opts.data || ".nomos/dev-cloud");
|
|
1642
1682
|
mkdirSync2(dataDir, { recursive: true });
|
|
1643
|
-
const
|
|
1683
|
+
const attested = !!(opts.attested || opts.bootstrap);
|
|
1684
|
+
const { wasmPath, wasmBytes, bootstrapPkg, nomosPkg, kernelKind, kernelSource } = await loadRuntime({ attested, kernelSource: opts.kernelSource });
|
|
1685
|
+
console.log(`[dev-cloud] kernel : ${kernelKind} (from ${kernelSource})`);
|
|
1644
1686
|
const wasmModule = await WebAssembly.compile(wasmBytes);
|
|
1645
1687
|
const kernelSha = createHash("sha256").update(wasmBytes).digest("hex");
|
|
1646
1688
|
const enc4 = new TextEncoder();
|
|
@@ -1732,6 +1774,13 @@ async function startDevCloud(opts = {}) {
|
|
|
1732
1774
|
return res.end();
|
|
1733
1775
|
}
|
|
1734
1776
|
if (url.pathname === "/health") return sendJson(res, { ok: true, kernelSha, dataDir, wasmPath, workspaces: custody.list() });
|
|
1777
|
+
if (url.pathname === "/v1/runtime/holon.wasm" || url.pathname === "/v1/runtime/holon-testmint.wasm") {
|
|
1778
|
+
res.writeHead(200, { ...CORS, "content-type": "application/wasm", "cache-control": "no-store", "x-nomos-kernel": kernelKind, "x-nomos-kernel-sha": kernelSha });
|
|
1779
|
+
return res.end(Buffer.from(wasmBytes));
|
|
1780
|
+
}
|
|
1781
|
+
if (url.pathname === "/v1/runtime/packages") {
|
|
1782
|
+
return sendJson(res, { bootstrap: bootstrapPkg, nomos: nomosPkg });
|
|
1783
|
+
}
|
|
1735
1784
|
if (seg[0] === "git" && seg[1] === "nomos") {
|
|
1736
1785
|
return await gitBackend(req, res, seg.slice(2).join("/"), null);
|
|
1737
1786
|
}
|
|
@@ -2010,6 +2059,8 @@ function parseArgs(argv) {
|
|
|
2010
2059
|
else if (a === "--deploy") o.deploy = argv[++i];
|
|
2011
2060
|
else if (a === "--auth-provider") o.authProvider = argv[++i];
|
|
2012
2061
|
else if (a === "--bootstrap") o.bootstrap = true;
|
|
2062
|
+
else if (a === "--attested") o.attested = true;
|
|
2063
|
+
else if (a === "--kernel-source") o.kernelSource = argv[++i];
|
|
2013
2064
|
}
|
|
2014
2065
|
return o;
|
|
2015
2066
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "githolon",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.84.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.
|
|
33
|
-
"@githolon/dsl": "^0.
|
|
32
|
+
"@githolon/client": "^0.84.1",
|
|
33
|
+
"@githolon/dsl": "^0.84.1",
|
|
34
34
|
"isomorphic-git": "^1.38.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|