githolon 0.14.0 → 0.15.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.
Files changed (2) hide show
  1. package/dist/cli.mjs +8 -61
  2. package/package.json +3 -3
package/dist/cli.mjs CHANGED
@@ -495,14 +495,9 @@ function call(ex, mode, fields, STDERR) {
495
495
  ex.git_holon_dealloc(reqPtr, req.length);
496
496
  }
497
497
  }
498
- function seedManifests(m, strings) {
499
- m.set("domain_manifests.json", new File(enc2.encode(strings.read)));
500
- m.set("identity-manifests.json", new File(enc2.encode(strings.identity)));
501
- }
502
- async function createEngine({ wasmModule, bootstrapPkg, nomosPkg, manifestStrings, replica, installedBy = "nomos-cloud" }) {
498
+ async function createEngine({ wasmModule, bootstrapPkg, nomosPkg, replica, installedBy = "nomos-cloud" }) {
503
499
  const hashes = { bootstrap: await sha256hex(bootstrapPkg), nomos: await sha256hex(nomosPkg) };
504
500
  const root = /* @__PURE__ */ new Map();
505
- seedManifests(root, manifestStrings);
506
501
  root.set("domain.package.usda", new File(enc2.encode(bootstrapPkg)));
507
502
  root.set("ws", new Directory(/* @__PURE__ */ new Map()));
508
503
  const preopen = new PreopenDirectory("/work", root);
@@ -523,36 +518,17 @@ async function createEngine({ wasmModule, bootstrapPkg, nomosPkg, manifestString
523
518
  hashes,
524
519
  bootstrapPkg,
525
520
  nomosPkg,
526
- manifestStrings,
527
521
  installedBy,
528
522
  fs: makeGitFs(preopen, "/work", { File, Directory }),
529
523
  mounted: /* @__PURE__ */ new Map(),
530
524
  // ws -> { restored, remoteMain, restoreError }
531
- mainIntents: /* @__PURE__ */ new Map(),
525
+ mainIntents: /* @__PURE__ */ new Map()
532
526
  // ws -> { head, ids:Set, oids:Set } (admission idempotence)
533
- knownDomainsCache: null
534
527
  };
535
528
  return eng;
536
529
  }
537
- function setManifests(eng, strings) {
538
- eng.manifestStrings = strings;
539
- eng.knownDomainsCache = null;
540
- eng.directiveRoutesCache = null;
541
- eng.scopedReadsCache = null;
542
- eng.placementDirectivesCache = null;
543
- eng.tenantTypesCache = null;
544
- eng.globalAggregatesCache = null;
545
- const root = eng.preopen.dir.contents;
546
- seedManifests(root, strings);
547
- const wsRoot = root.get("ws");
548
- for (const ws of eng.mounted.keys()) {
549
- const wsDir = wsRoot.contents.get(ws);
550
- if (wsDir) seedManifests(wsDir.contents, strings);
551
- }
552
- }
553
530
  function stageWorkspaceDir(eng, ws) {
554
531
  const wsContents = /* @__PURE__ */ new Map();
555
- seedManifests(wsContents, eng.manifestStrings);
556
532
  eng.preopen.dir.contents.get("ws").contents.set(ws, new Directory(wsContents));
557
533
  }
558
534
  async function mountWorkspace(eng, ws, ledger) {
@@ -740,9 +716,8 @@ async function fetchRuntime(cloud) {
740
716
  const localWasm = process.env["NOMOS_LOCAL_WASM"];
741
717
  if (localWasm) {
742
718
  const bytes = readFileSync2(localWasm);
743
- const manifests2 = await fetchJsonCached(`${cloud}/v1/runtime/manifests`, join4(cache, "manifests.json"));
744
719
  const packages2 = await fetchJsonCached(`${cloud}/v1/runtime/packages`, join4(cache, "packages.json"));
745
- return { wasmBytes: bytes, manifests: manifests2, packages: packages2 };
720
+ return { wasmBytes: bytes, packages: packages2 };
746
721
  }
747
722
  try {
748
723
  const r = await fetch(`${cloud}/v1/runtime/holon.wasm`);
@@ -754,25 +729,8 @@ async function fetchRuntime(cloud) {
754
729
  if (!existsSync3(wasmCache)) throw e;
755
730
  wasmBytes = readFileSync2(wasmCache);
756
731
  }
757
- const manifests = await fetchJsonCached(`${cloud}/v1/runtime/manifests`, join4(cache, "manifests.json"));
758
732
  const packages = await fetchJsonCached(`${cloud}/v1/runtime/packages`, join4(cache, "packages.json"));
759
- return { wasmBytes, manifests, packages };
760
- }
761
- function mergeManifests(baked, overlay) {
762
- const read = JSON.parse(baked.domainManifests);
763
- const identity = JSON.parse(baked.identityManifests);
764
- for (const [k, v] of Object.entries(overlay.identityManifests ?? {})) identity[k] = v;
765
- const r = overlay.readManifest;
766
- if (r !== void 0) {
767
- for (const [t, schema] of Object.entries(r["aggregateFieldKinds"] ?? {})) read["aggregateFieldKinds"][t] = schema;
768
- for (const key of ["queries", "counts", "sums", "mins", "maxes", "spatials", "deriveds", "combineds"]) {
769
- for (const d of r[key] ?? []) {
770
- const list = read[key] = read[key] ?? [];
771
- if (!list.some((x) => JSON.stringify(x) === JSON.stringify(d))) list.push(d);
772
- }
773
- }
774
- }
775
- return { read: JSON.stringify(read), identity: JSON.stringify(identity) };
733
+ return { wasmBytes, packages };
776
734
  }
777
735
  function writeTreeToDisk(dir, diskPath) {
778
736
  mkdirSync3(diskPath, { recursive: true });
@@ -793,13 +751,11 @@ function readTreeFromDisk(diskPath) {
793
751
  }
794
752
  async function holonEngine(cloud, overlay, installedBy) {
795
753
  const runtime = await fetchRuntime(cloud);
796
- const manifestStrings = overlay === void 0 ? { read: runtime.manifests.domainManifests, identity: runtime.manifests.identityManifests } : mergeManifests(runtime.manifests, overlay);
797
754
  const replica = BigInt(`0x${randomBytes(8).toString("hex")}`) & (1n << 63n) - 1n;
798
755
  const eng = await createEngine({
799
756
  wasmModule: await WebAssembly.compile(runtime.wasmBytes),
800
757
  bootstrapPkg: runtime.packages.bootstrap,
801
758
  nomosPkg: runtime.packages.nomos,
802
- manifestStrings,
803
759
  replica,
804
760
  installedBy
805
761
  });
@@ -1567,12 +1523,9 @@ function readDeployBody(cwd, packageName) {
1567
1523
  async function installLaw(s, deployBody, installedBy) {
1568
1524
  const newHash = await sha256hex(deployBody.packageUsda);
1569
1525
  if (newHash === s.lawHash) return { ok: true };
1570
- const previous = { ...s.eng.manifestStrings };
1571
1526
  const t0 = performance.now();
1572
- setManifests(s.eng, mergeManifests(s.runtime.manifests, deployBody));
1573
1527
  const res = author(s.eng, WS, "nomos", "installDomain", installPayload(newHash, deployBody.packageUsda, installedBy), s.eng.hashes.nomos);
1574
1528
  if (res.ok === false) {
1575
- setManifests(s.eng, previous);
1576
1529
  return { ok: false, error: `law install refused: ${res.error ?? "unknown"} \u2014 the previous law (${s.lawHash.slice(0, 12)}\u2026) keeps serving; fix and save again` };
1577
1530
  }
1578
1531
  s.lawHash = newHash;
@@ -1850,7 +1803,7 @@ async function gitRemote(ws, name, opts) {
1850
1803
  var HELP = {
1851
1804
  compile: {
1852
1805
  usage: "githolon compile [config] [--layered]",
1853
- what: "Compile the package by ./nomos.package.mjs (the @githolon/dsl launcher): ONE deterministic\n.package.usda (sha256 = the law's content hash) + read/identity manifests + the deploy body +\nthe typed TS client + the generated proof \u2014 all into build/.",
1806
+ what: "Compile the package by ./nomos.package.mjs (the @githolon/dsl launcher): ONE deterministic\n.package.usda (sha256 = the law's content hash) + the deploy body +\nthe typed TS client + the generated proof \u2014 all into build/.",
1854
1807
  flags: [
1855
1808
  ["[config]", "an alternate config file (default: nomos.package.mjs)"],
1856
1809
  ["--layered", "also emit the per-domain layered USD view"]
@@ -1884,7 +1837,7 @@ var HELP = {
1884
1837
  ["<ws|dir>", "a workspace name on the cloud, or a local holon directory (githolon ledger init)"],
1885
1838
  ["--step N", "non-interactive; print the running tallies every N intents"],
1886
1839
  ["--json", "one JSON line per step + the final verdict (pipe it)"],
1887
- ["--file <deploy.json>", "stage this deploy body's read manifests (default: the one in ./build)"]
1840
+ ["--file <deploy.json>", "reserved for local package hints (default: the one in ./build)"]
1888
1841
  ],
1889
1842
  examples: ["githolon replay my-guestbook", "githolon replay ./my-holon --step 10", "githolon replay my-guestbook --json | jq .directive"]
1890
1843
  },
@@ -2057,7 +2010,7 @@ init_engine();
2057
2010
  init_engine();
2058
2011
  init_cloud();
2059
2012
  init_local_holon();
2060
- import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
2013
+ import { existsSync as existsSync8 } from "node:fs";
2061
2014
  import { join as join9 } from "node:path";
2062
2015
  import git3 from "isomorphic-git";
2063
2016
  var out7 = (s) => void process.stdout.write(s + "\n");
@@ -2147,15 +2100,9 @@ async function replay(target, opts) {
2147
2100
  const cloud = cloudBase(opts.cloud);
2148
2101
  const json = opts.json === true;
2149
2102
  const emit = (o) => out7(JSON.stringify(o));
2150
- let overlay;
2151
- try {
2152
- overlay = JSON.parse(readFileSync7(discoverDeployJson(process.cwd(), opts.file), "utf8"));
2153
- } catch {
2154
- overlay = void 0;
2155
- }
2156
2103
  let eng;
2157
2104
  try {
2158
- ({ eng } = await holonEngine(cloud, overlay, "githolon-replay"));
2105
+ ({ eng } = await holonEngine(cloud, void 0, "githolon-replay"));
2159
2106
  } catch (e) {
2160
2107
  err7(`cannot boot the local holon: ${String(e.message ?? e)}
2161
2108
  the runtime rides ${cloud}/v1/runtime/* (cached in ~/.holon/runtime after one fetch)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "githolon",
3
- "version": "0.14.0",
3
+ "version": "0.15.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",
@@ -10,7 +10,7 @@
10
10
  "directory": "cli"
11
11
  },
12
12
  "bin": {
13
- "githolon": "./dist/cli.mjs"
13
+ "githolon": "dist/cli.mjs"
14
14
  },
15
15
  "files": [
16
16
  "dist"
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@bjorn3/browser_wasi_shim": "0.4.2",
30
- "@githolon/dsl": "^0.14.0",
30
+ "@githolon/dsl": "^0.15.0",
31
31
  "isomorphic-git": "^1.38.4"
32
32
  },
33
33
  "devDependencies": {