githolon 0.102.0 → 0.102.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.
Files changed (2) hide show
  1. package/dist/dev-server.mjs +52 -10
  2. package/package.json +2 -2
@@ -2227,6 +2227,18 @@ var unb64 = (s) => new Uint8Array(Buffer.from(s, "base64"));
2227
2227
  function configDir() {
2228
2228
  return process.env.HOLON_CONFIG_DIR || path.join(os.homedir(), ".holon");
2229
2229
  }
2230
+ function explicitRuntimeDir() {
2231
+ if (process.env.NOMOS_CANDIDATE_RUNTIME) {
2232
+ return { dir: process.env.NOMOS_CANDIDATE_RUNTIME, candidate: true };
2233
+ }
2234
+ if (process.env.NOMOS_OFFLINE_RUNTIME) {
2235
+ return { dir: process.env.NOMOS_OFFLINE_RUNTIME, candidate: false };
2236
+ }
2237
+ return null;
2238
+ }
2239
+ function selectedRuntimeDir() {
2240
+ return explicitRuntimeDir()?.dir ?? path.join(configDir(), "runtime");
2241
+ }
2230
2242
  function firstExisting(...paths) {
2231
2243
  for (const p of paths) {
2232
2244
  if (p && existsSync2(p)) return p;
@@ -2272,21 +2284,39 @@ function capabilitiesForKernelHash(hash) {
2272
2284
  }
2273
2285
  var DEFAULT_KERNEL_SOURCE = "https://nomos.captainapp.co.uk";
2274
2286
  async function resolveTestMintWasm(kernelSource) {
2275
- const runtimeCache = path.join(configDir(), "runtime");
2287
+ const explicitRuntime = explicitRuntimeDir();
2288
+ const runtimeCache = selectedRuntimeDir();
2276
2289
  const cachePath = path.join(runtimeCache, "holon-testmint.wasm");
2290
+ if (explicitRuntime) {
2291
+ if (existsSync2(cachePath)) {
2292
+ const bytes = readFileSync2(cachePath);
2293
+ if (isTestMintBytes(bytes)) {
2294
+ return { wasmPath: cachePath, wasmBytes: bytes, kernelKind: "test-mint", kernelSource: "explicit-runtime" };
2295
+ }
2296
+ }
2297
+ if (explicitRuntime.candidate || String(process.env.NOMOS_RUNTIME_REFRESH || "auto").toLowerCase() === "never") {
2298
+ throw new Error(
2299
+ `explicit runtime is missing a valid test-mint kernel at ${cachePath}; hydrate that exact runtime bundle before running the generated proof`
2300
+ );
2301
+ }
2302
+ }
2277
2303
  const local = process.env.NOMOS_LOCAL_WASM;
2278
- if (local && existsSync2(local)) {
2304
+ if (!explicitRuntime && local && existsSync2(local)) {
2279
2305
  const bytes = readFileSync2(local);
2280
2306
  if (isTestMintBytes(bytes)) return { wasmPath: local, wasmBytes: bytes, kernelKind: "test-mint", kernelSource: "NOMOS_LOCAL_WASM" };
2281
2307
  }
2282
2308
  const bundled = path.join(DIR, "kernel-testmint.wasm");
2283
- if (existsSync2(bundled)) {
2309
+ if (!explicitRuntime && existsSync2(bundled)) {
2284
2310
  const bytes = readFileSync2(bundled);
2285
2311
  if (isTestMintBytes(bytes)) return { wasmPath: bundled, wasmBytes: bytes, kernelKind: "test-mint", kernelSource: "bundled" };
2286
2312
  }
2287
- if (existsSync2(cachePath)) {
2313
+ if (!explicitRuntime && existsSync2(cachePath)) {
2288
2314
  const bytes = readFileSync2(cachePath);
2289
- if (isTestMintBytes(bytes)) return { wasmPath: cachePath, wasmBytes: bytes, kernelKind: "test-mint", kernelSource: "cache" };
2315
+ const sha = createHash2("sha256").update(bytes).digest("hex");
2316
+ const currentTestMint = DEPLOYED_KERNELS.find((entry) => /test-mint/i.test(entry.note));
2317
+ if (isTestMintBytes(bytes) && currentTestMint?.hash === sha) {
2318
+ return { wasmPath: cachePath, wasmBytes: bytes, kernelKind: "test-mint", kernelSource: "cache" };
2319
+ }
2290
2320
  }
2291
2321
  const src = String(kernelSource || process.env.NOMOS_KERNEL_SOURCE || DEFAULT_KERNEL_SOURCE).replace(/\/+$/, "");
2292
2322
  const url = `${src}/v1/runtime/holon-testmint.wasm`;
@@ -2307,7 +2337,8 @@ async function resolveTestMintWasm(kernelSource) {
2307
2337
  );
2308
2338
  }
2309
2339
  async function loadRuntime(opts = {}) {
2310
- const runtimeCache = path.join(configDir(), "runtime");
2340
+ const explicitRuntime = explicitRuntimeDir();
2341
+ const runtimeCache = selectedRuntimeDir();
2311
2342
  const repoDomainsDir = path.join(REPO_ROOT, "cloud/cloudflare-shell/container/domains");
2312
2343
  const vendoredFrameworkDir = path.join(DIR, "framework");
2313
2344
  let wasmPath, wasmBytes, kernelKind, kernelSource;
@@ -2315,9 +2346,10 @@ async function loadRuntime(opts = {}) {
2315
2346
  ({ wasmPath, wasmBytes, kernelKind, kernelSource } = await resolveTestMintWasm(opts.kernelSource));
2316
2347
  } else {
2317
2348
  wasmPath = firstExisting(
2318
- process.env.NOMOS_LOCAL_WASM,
2319
- path.join(REPO_ROOT, "cloud/cloudflare-shell/container/vendor/wasm_git_holon.wasm"),
2320
- path.join(runtimeCache, "holon.wasm")
2349
+ explicitRuntime ? path.join(runtimeCache, "holon.wasm") : null,
2350
+ explicitRuntime ? null : process.env.NOMOS_LOCAL_WASM,
2351
+ explicitRuntime ? null : path.join(REPO_ROOT, "cloud/cloudflare-shell/container/vendor/wasm_git_holon.wasm"),
2352
+ explicitRuntime ? null : path.join(runtimeCache, "holon.wasm")
2321
2353
  );
2322
2354
  if (!wasmPath) {
2323
2355
  throw new Error(
@@ -2331,7 +2363,16 @@ async function loadRuntime(opts = {}) {
2331
2363
  const repoBootstrap = firstExisting(path.join(repoDomainsDir, "domain_bootstrap.package.usda"));
2332
2364
  const repoNomos = firstExisting(path.join(repoDomainsDir, "domain_nomos.package.usda"));
2333
2365
  let bootstrapPkg, nomosPkg;
2334
- if (repoBootstrap && repoNomos) {
2366
+ const explicitPackages = explicitRuntime ? path.join(runtimeCache, "packages.json") : null;
2367
+ if (explicitPackages && existsSync2(explicitPackages)) {
2368
+ const pkgs = JSON.parse(readFileSync2(explicitPackages, "utf8"));
2369
+ bootstrapPkg = pkgs.bootstrap;
2370
+ nomosPkg = pkgs.nomos;
2371
+ } else if (explicitRuntime) {
2372
+ throw new Error(
2373
+ `explicit runtime is missing framework packages at ${explicitPackages}; hydrate that exact runtime bundle before starting the local Nomos cloud`
2374
+ );
2375
+ } else if (repoBootstrap && repoNomos) {
2335
2376
  bootstrapPkg = readFileSync2(repoBootstrap, "utf8");
2336
2377
  nomosPkg = readFileSync2(repoNomos, "utf8");
2337
2378
  } else if (existsSync2(path.join(vendoredFrameworkDir, "domain_bootstrap.package.usda"))) {
@@ -3107,6 +3148,7 @@ if (import.meta.url === `file://${process.argv[1]}`) {
3107
3148
  });
3108
3149
  }
3109
3150
  export {
3151
+ resolveTestMintWasm,
3110
3152
  startDevCloud,
3111
3153
  startGeneratedApplicationProofCloud
3112
3154
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "githolon",
3
- "version": "0.102.0",
3
+ "version": "0.102.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,7 +29,7 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@bjorn3/browser_wasi_shim": "0.4.2",
32
- "@githolon/dsl": "^0.102.0",
32
+ "@githolon/dsl": "^0.102.1",
33
33
  "isomorphic-git": "^1.38.4"
34
34
  },
35
35
  "devDependencies": {