githolon 0.108.7 → 0.110.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/compile-entry.mjs +67 -1
- package/dist/compile_mountability_entry.js +27713 -5989
- package/dist/dev-server.mjs +21974 -5851
- package/dist/framework/bootstrap.law.usdz +0 -0
- package/dist/framework/nomos.law.usdz +0 -0
- package/dist/framework/nomos.reception.mjs +7403 -0
- package/dist/full-cli.mjs +33946 -29487
- package/package.json +4 -3
package/dist/compile-entry.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// src/compile_command.ts
|
|
4
|
+
import { join as join5 } from "node:path";
|
|
5
|
+
|
|
3
6
|
// src/compile.ts
|
|
4
7
|
import { spawn, spawnSync } from "node:child_process";
|
|
5
8
|
import { createRequire } from "node:module";
|
|
@@ -56,12 +59,74 @@ ${INIT_EDITOR_HINT}
|
|
|
56
59
|
return status;
|
|
57
60
|
}
|
|
58
61
|
|
|
62
|
+
// src/mountability_proof.ts
|
|
63
|
+
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
64
|
+
import { existsSync as existsSync2, readFileSync as readFileSync3, readdirSync, renameSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
65
|
+
import { join as join4 } from "node:path";
|
|
66
|
+
|
|
67
|
+
// src/runtime_selection.ts
|
|
68
|
+
import { createHash } from "node:crypto";
|
|
69
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
70
|
+
import { homedir } from "node:os";
|
|
71
|
+
import { join as join3 } from "node:path";
|
|
72
|
+
var runtimeDirectory = () => process.env.NOMOS_CANDIDATE_RUNTIME ?? process.env.NOMOS_OFFLINE_RUNTIME ?? join3(homedir(), ".holon", "runtime");
|
|
73
|
+
function selectedKernelSha256() {
|
|
74
|
+
try {
|
|
75
|
+
return createHash("sha256").update(readFileSync2(join3(runtimeDirectory(), "holon.wasm"))).digest("hex");
|
|
76
|
+
} catch {
|
|
77
|
+
return void 0;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/mountability_proof.ts
|
|
82
|
+
var PROOF_FORMAT = "nomos.mountability-proof.v1";
|
|
83
|
+
function compiledLawPackages(buildDir) {
|
|
84
|
+
if (!existsSync2(buildDir)) return [];
|
|
85
|
+
return readdirSync(buildDir).filter((file) => file.endsWith(".law.usdz")).map((law) => {
|
|
86
|
+
const name = law.replace(/\.law\.usdz$/, "");
|
|
87
|
+
return {
|
|
88
|
+
name,
|
|
89
|
+
lawPath: join4(buildDir, law),
|
|
90
|
+
identityPath: join4(buildDir, `${name}.law.sha256`),
|
|
91
|
+
proofPath: join4(buildDir, `.nomos-mountability-proof.${name}.usda`)
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function mountabilityProofIdentity(lawUsdz, claimedIdentity, kernelSha256) {
|
|
96
|
+
return createHash2("sha256").update(`${PROOF_FORMAT}\0`).update(kernelSha256).update("\0").update(claimedIdentity).update("\0").update(lawUsdz).digest("hex");
|
|
97
|
+
}
|
|
98
|
+
function mountabilityProofCurrent(pkg) {
|
|
99
|
+
const kernelSha256 = selectedKernelSha256();
|
|
100
|
+
if (kernelSha256 === void 0) return false;
|
|
101
|
+
let text;
|
|
102
|
+
let claimedIdentity;
|
|
103
|
+
let lawUsdz;
|
|
104
|
+
try {
|
|
105
|
+
text = readFileSync3(pkg.proofPath, "utf8");
|
|
106
|
+
claimedIdentity = readFileSync3(pkg.identityPath, "utf8").trim();
|
|
107
|
+
lawUsdz = readFileSync3(pkg.lawPath);
|
|
108
|
+
} catch {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
if (!text.includes(`string "nomos:format" = "${PROOF_FORMAT}"`)) return false;
|
|
112
|
+
const recorded = /string "nomos:proofIdentity" = "([0-9a-f]{64})"/u.exec(text)?.[1];
|
|
113
|
+
return recorded !== void 0 && recorded === mountabilityProofIdentity(lawUsdz, claimedIdentity, kernelSha256);
|
|
114
|
+
}
|
|
115
|
+
|
|
59
116
|
// src/compile_command.ts
|
|
60
117
|
async function runCompileCommand(args) {
|
|
61
118
|
const skipMountCheck = args.includes("--no-mount-check");
|
|
62
119
|
const preflightOnly = args.includes("--preflight");
|
|
63
120
|
const status = runCompile(args.filter((arg) => arg !== "--no-mount-check"));
|
|
64
121
|
if (status !== 0 || skipMountCheck || preflightOnly) return status;
|
|
122
|
+
const packages = compiledLawPackages(join5(process.cwd(), "build"));
|
|
123
|
+
if (packages.length > 0 && packages.every(mountabilityProofCurrent)) {
|
|
124
|
+
process.stderr.write(
|
|
125
|
+
`note: ${packages.map((pkg) => pkg.name).join(", ")} passed canonical kernel package admission (content-addressed proof reused); whole-workspace install and client-compatibility proof awaits its typed Peer Office command
|
|
126
|
+
`
|
|
127
|
+
);
|
|
128
|
+
return status;
|
|
129
|
+
}
|
|
65
130
|
try {
|
|
66
131
|
const { assertPublicCompileMountable } = await import("./compile_mountability_entry.js");
|
|
67
132
|
const verdict = await assertPublicCompileMountable(process.cwd());
|
|
@@ -76,8 +141,9 @@ async function runCompileCommand(args) {
|
|
|
76
141
|
);
|
|
77
142
|
return 1;
|
|
78
143
|
} else if (verdict.checked.length > 0) {
|
|
144
|
+
const kernel = verdict.kernelSha256 === void 0 ? "" : ` [${verdict.kernelSource ?? "selected"} kernel ${verdict.kernelSha256.slice(0, 12)}]`;
|
|
79
145
|
process.stdout.write(
|
|
80
|
-
` mountable \u2713 ${verdict.checked.join(", ")} mount on the real read router${verdict.cached ? " (content-addressed proof reused)" : ""}
|
|
146
|
+
` mountable \u2713 ${verdict.checked.join(", ")} mount on the real read router${kernel}${verdict.cached ? " (content-addressed proof reused)" : ""}
|
|
81
147
|
`
|
|
82
148
|
);
|
|
83
149
|
}
|