githolon 0.84.0 → 0.85.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 +11 -1
- package/dist/dev-server.mjs +40 -3
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -1778,7 +1778,17 @@ function servePack(eng, ws, base = "") {
|
|
|
1778
1778
|
try {
|
|
1779
1779
|
r = JSON.parse(call(eng.ex, "pack_delta", { repoArg: repoArgOf(ws), workspace: ws, base, branch: BRANCH }, eng.STDERR));
|
|
1780
1780
|
} catch (e) {
|
|
1781
|
-
|
|
1781
|
+
const msg = String(e);
|
|
1782
|
+
if (/nothing to pack|head == base/.test(msg)) return { packB64: "", bytes: 0, upToDate: true, ...head ? { head } : {} };
|
|
1783
|
+
if (base && /reached root|before base|not found|unknown|no (?:merge )?base|missing|invalid/i.test(msg)) {
|
|
1784
|
+
try {
|
|
1785
|
+
const full = JSON.parse(call(eng.ex, "pack_delta", { repoArg: repoArgOf(ws), workspace: ws, base: "", branch: BRANCH }, eng.STDERR));
|
|
1786
|
+
if (full && full.ok === true && typeof full.packB64 === "string") {
|
|
1787
|
+
return { packB64: full.packB64, bytes: full.bytes, divergent: true, ...head ? { head } : {} };
|
|
1788
|
+
}
|
|
1789
|
+
} catch {
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1782
1792
|
throw e;
|
|
1783
1793
|
}
|
|
1784
1794
|
if (!r || r.ok !== true || typeof r.packB64 !== "string") throw new Error("servePack: kernel produced no pack");
|
package/dist/dev-server.mjs
CHANGED
|
@@ -794,7 +794,17 @@ function servePack(eng, ws, base = "") {
|
|
|
794
794
|
try {
|
|
795
795
|
r = JSON.parse(call(eng.ex, "pack_delta", { repoArg: repoArgOf(ws), workspace: ws, base, branch: BRANCH }, eng.STDERR));
|
|
796
796
|
} catch (e) {
|
|
797
|
-
|
|
797
|
+
const msg = String(e);
|
|
798
|
+
if (/nothing to pack|head == base/.test(msg)) return { packB64: "", bytes: 0, upToDate: true, ...head ? { head } : {} };
|
|
799
|
+
if (base && /reached root|before base|not found|unknown|no (?:merge )?base|missing|invalid/i.test(msg)) {
|
|
800
|
+
try {
|
|
801
|
+
const full = JSON.parse(call(eng.ex, "pack_delta", { repoArg: repoArgOf(ws), workspace: ws, base: "", branch: BRANCH }, eng.STDERR));
|
|
802
|
+
if (full && full.ok === true && typeof full.packB64 === "string") {
|
|
803
|
+
return { packB64: full.packB64, bytes: full.bytes, divergent: true, ...head ? { head } : {} };
|
|
804
|
+
}
|
|
805
|
+
} catch {
|
|
806
|
+
}
|
|
807
|
+
}
|
|
798
808
|
throw e;
|
|
799
809
|
}
|
|
800
810
|
if (!r || r.ok !== true || typeof r.packB64 !== "string") throw new Error("servePack: kernel produced no pack");
|
|
@@ -1774,6 +1784,13 @@ async function startDevCloud(opts = {}) {
|
|
|
1774
1784
|
return res.end();
|
|
1775
1785
|
}
|
|
1776
1786
|
if (url.pathname === "/health") return sendJson(res, { ok: true, kernelSha, dataDir, wasmPath, workspaces: custody.list() });
|
|
1787
|
+
if (url.pathname === "/v1/runtime/holon.wasm" || url.pathname === "/v1/runtime/holon-testmint.wasm") {
|
|
1788
|
+
res.writeHead(200, { ...CORS, "content-type": "application/wasm", "cache-control": "no-store", "x-nomos-kernel": kernelKind, "x-nomos-kernel-sha": kernelSha });
|
|
1789
|
+
return res.end(Buffer.from(wasmBytes));
|
|
1790
|
+
}
|
|
1791
|
+
if (url.pathname === "/v1/runtime/packages") {
|
|
1792
|
+
return sendJson(res, { bootstrap: bootstrapPkg, nomos: nomosPkg });
|
|
1793
|
+
}
|
|
1777
1794
|
if (seg[0] === "git" && seg[1] === "nomos") {
|
|
1778
1795
|
return await gitBackend(req, res, seg.slice(2).join("/"), null);
|
|
1779
1796
|
}
|
|
@@ -1890,9 +1907,20 @@ async function startDevCloud(opts = {}) {
|
|
|
1890
1907
|
return serialize(async () => {
|
|
1891
1908
|
await mountWorkspace(eng, ws, ledgerFor(ws));
|
|
1892
1909
|
const have = url.searchParams.get("have") || "";
|
|
1893
|
-
|
|
1910
|
+
let r;
|
|
1911
|
+
try {
|
|
1912
|
+
r = servePack(eng, ws, have);
|
|
1913
|
+
} catch (e) {
|
|
1914
|
+
return sendJson(res, { ok: false, custodyBreak: true, error: String(e && e.message || e).slice(0, 400), have }, 409);
|
|
1915
|
+
}
|
|
1894
1916
|
if (!r.packB64) return sendBytes(res, Buffer.alloc(0), 204, r.head ? { "x-nomos-head": r.head } : {});
|
|
1895
|
-
|
|
1917
|
+
const kind = r.divergent ? "full" : have ? "delta" : "full";
|
|
1918
|
+
sendBytes(res, unb64(r.packB64), 200, {
|
|
1919
|
+
"content-type": "application/x-git-packfile",
|
|
1920
|
+
"x-nomos-pack": kind,
|
|
1921
|
+
...r.divergent ? { "x-nomos-divergent": "1" } : {},
|
|
1922
|
+
...r.head ? { "x-nomos-head": r.head } : {}
|
|
1923
|
+
});
|
|
1896
1924
|
});
|
|
1897
1925
|
}
|
|
1898
1926
|
if (sub[0] === "snapshot" && req.method === "GET") {
|
|
@@ -2037,6 +2065,15 @@ Sec-WebSocket-Accept: ${accept}\r
|
|
|
2037
2065
|
socket.on("error", () => {
|
|
2038
2066
|
});
|
|
2039
2067
|
});
|
|
2068
|
+
if (!globalThis.__nomosDevGuards) {
|
|
2069
|
+
globalThis.__nomosDevGuards = true;
|
|
2070
|
+
process.on("unhandledRejection", (e) => {
|
|
2071
|
+
console.error("[dev-cloud] unhandledRejection (kept alive):", String(e && e.stack || e && e.message || e).slice(0, 500));
|
|
2072
|
+
});
|
|
2073
|
+
process.on("uncaughtException", (e) => {
|
|
2074
|
+
console.error("[dev-cloud] uncaughtException (kept alive):", String(e && e.stack || e && e.message || e).slice(0, 500));
|
|
2075
|
+
});
|
|
2076
|
+
}
|
|
2040
2077
|
await new Promise((resolve) => server.listen(port, host, resolve));
|
|
2041
2078
|
return { server, origin, dataDir, kernelSha, eng, custody, ledgerFor, serialize, persistBorn, close: () => new Promise((r) => server.close(r)) };
|
|
2042
2079
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "githolon",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.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.85.0",
|
|
33
|
+
"@githolon/dsl": "^0.85.0",
|
|
34
34
|
"isomorphic-git": "^1.38.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|