@githolon/testing 0.45.0 → 0.47.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@githolon/testing",
3
- "version": "0.45.0",
3
+ "version": "0.47.0",
4
4
  "type": "module",
5
5
  "description": "@githolon/testing — law TDD for Nomos domains: boot the REAL engine plane in-process (the exact machinery every cloud DO, heavy container and web client runs), dispatch directives, assert rows, assert TYPED REFUSALS, fork for what-ifs — fully offline inside vitest.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -129,7 +129,8 @@ export async function createEngine({ wasmModule, bootstrapPkg, nomosPkg, replica
129
129
  root.set("ws", new Directory(new Map()));
130
130
  const preopen = new PreopenDirectory("/work", root);
131
131
  const STDERR = [];
132
- const fds = [new OpenFile(new File([])), ConsoleStdout.lineBuffered(() => {}), ConsoleStdout.lineBuffered((l) => STDERR.push(l)), preopen];
132
+ const pushStderr = (l) => { if (STDERR.length >= 500) STDERR.splice(0, STDERR.length - 499); STDERR.push(l); };
133
+ const fds = [new OpenFile(new File([])), ConsoleStdout.lineBuffered(() => {}), ConsoleStdout.lineBuffered(pushStderr), preopen];
133
134
  const wasi = new WASI(["wasm_git_holon", "reactor"], [], fds, { debug: false });
134
135
  const inst = await WebAssembly.instantiate(wasmModule, { wasi_snapshot_preview1: wasi.wasiImport });
135
136
  const code = wasi.start(inst);
@@ -1346,6 +1347,16 @@ export function currentLaw(eng, ws) {
1346
1347
  return out.keyMap || {};
1347
1348
  }
1348
1349
 
1350
+ /** INSTALLED-LAW META-READ — kernel-folded control-plane state, not tenant projection. */
1351
+ export function installedLaw(eng, ws) {
1352
+ return JSON.parse(call(eng.ex, "query", { repoArg: repoArgOf(ws), workspace: ws, queryBytes: b64Json({ op: "installedLaw" }), branch: BRANCH }, eng.STDERR));
1353
+ }
1354
+
1355
+ /** INSTALLED PACKAGE META-READ — package bytes from folded policy/domain-installation state. */
1356
+ export function domainPackage(eng, ws, hash) {
1357
+ return JSON.parse(call(eng.ex, "query", { repoArg: repoArgOf(ws), workspace: ws, queryBytes: b64Json({ op: "domainPackage", hash }), branch: BRANCH }, eng.STDERR));
1358
+ }
1359
+
1349
1360
  /** THE CAPABILITY DECLARATION READ (Full-A — capability_marketplace.md §4): the holon
1350
1361
  * surfaces every CURRENTLY-INSTALLED domain's `nomosCapabilities` law key (the impure-
1351
1362
  * capability quartets sealed into the law). The deploy lane relays these as a "declared —
@@ -1955,6 +1966,9 @@ export const count = (eng, ws, countId, groupKey, principal = "") => JSON.parse(
1955
1966
  export const sum = (eng, ws, sumId, groupKey, principal = "") => JSON.parse(call(eng.ex, "query", { repoArg: repoArgOf(ws), workspace: ws, queryBytes: b64Json({ op: "sum", sumId, groupKey }), principal, branch: BRANCH }, eng.STDERR));
1956
1967
  /** The maintained O(1) min/max read (#47). `kind` = "min"|"max"; an absent group answers `value: null`
1957
1968
  * (never a fabricated 0). Kernel-gated; rides the `query` verb (`op:"extremum"`, `kind` = min/max). */
1969
+ /** THE SPATIAL READ (R*Tree probe): rows of the index's of-type intersecting the bbox. Kernel-gated
1970
+ * like a granular query (a private of-type needs its cap); row shape identical to a declared query. */
1971
+ export const spatialWithin = (eng, ws, spatialId, bbox, principal = "") => JSON.parse(call(eng.ex, "query", { repoArg: repoArgOf(ws), workspace: ws, queryBytes: b64Json({ op: "spatial", spatialId, minLng: bbox.minLng, minLat: bbox.minLat, maxLng: bbox.maxLng, maxLat: bbox.maxLat }), principal, branch: BRANCH }, eng.STDERR));
1958
1972
  export const extremum = (eng, ws, extremumId, kind, groupKey, principal = "") => JSON.parse(call(eng.ex, "query", { repoArg: repoArgOf(ws), workspace: ws, queryBytes: b64Json({ op: "extremum", extremumId, kind, groupKey: groupKey ?? "" }), principal, branch: BRANCH }, eng.STDERR));
1959
1973
  // GIT OFF THE HOT PATH: the KERNEL builds the conformant delta packfile (gix-pack); the adapter is dumb
1960
1974
  // plumbing (frames pkt-lines + POSTs). Returns the pack bytes (Uint8Array), or null if the kernel