@ai-ecoverse/slicc-kernel 1.159.5 → 1.160.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/node.js CHANGED
@@ -3672,7 +3672,7 @@ function satisfies(version, range2) {
3672
3672
  }
3673
3673
 
3674
3674
  // src/version.ts
3675
- var KERNEL_VERSION = true ? "1.159.5" : "0.0.0-dev";
3675
+ var KERNEL_VERSION = true ? "1.160.0" : "0.0.0-dev";
3676
3676
  var OS_RELEASE = "6.0.0-slicc";
3677
3677
  function procVersion() {
3678
3678
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -3052,7 +3052,7 @@ var init_version = __esm({
3052
3052
  "src/version.ts"() {
3053
3053
  "use strict";
3054
3054
  init_captured_globals();
3055
- KERNEL_VERSION = true ? "1.159.5" : "0.0.0-dev";
3055
+ KERNEL_VERSION = true ? "1.160.0" : "0.0.0-dev";
3056
3056
  OS_RELEASE = "6.0.0-slicc";
3057
3057
  }
3058
3058
  });
@@ -17638,6 +17638,7 @@ function laneOf(lane, silence = SYNC_FS_REQUEST_TIMEOUT_MS, open = createSyncSab
17638
17638
  }
17639
17639
  function syncOps(kernel, shared) {
17640
17640
  const { infos, handles, resolve } = shared;
17641
+ const clean = () => shared.clean?.() === true;
17641
17642
  const tryDevSync = (abs) => {
17642
17643
  try {
17643
17644
  const resolved2 = physicalPath(
@@ -17693,7 +17694,7 @@ function syncOps(kernel, shared) {
17693
17694
  const abs = resolve(path);
17694
17695
  if (inDev(abs)) return devSync(kernel, devStat(abs, op === "stat"));
17695
17696
  try {
17696
- kernel.call({ op: "fd-path-flush", path: abs });
17697
+ if (!clean()) kernel.call({ op: "fd-path-flush", path: abs });
17697
17698
  const s = parseSyncFsStat(kernel.json({ op, path: abs }));
17698
17699
  if (!s) throw new JsCallError("EIO", op);
17699
17700
  return s;
@@ -17770,7 +17771,7 @@ function syncOps(kernel, shared) {
17770
17771
  },
17771
17772
  pipe: () => kernel.json({ op: "fd-pipe" }),
17772
17773
  open: procOpenSync(open, kernel, { resolve, pid: shared.pid }),
17773
- fs: procFsSync(syncPathOps(kernel, resolve, statOf, open, tryDevSync), kernel, {
17774
+ fs: procFsSync(syncPathOps(kernel, resolve, statOf, open, tryDevSync, clean), kernel, {
17774
17775
  resolve,
17775
17776
  pid: shared.pid
17776
17777
  })
@@ -17847,7 +17848,7 @@ function syncFile(kernel, fd, path, append, forget) {
17847
17848
  }
17848
17849
  };
17849
17850
  }
17850
- function syncPathOps(kernel, resolve, statOf, open, tryDev) {
17851
+ function syncPathOps(kernel, resolve, statOf, open, tryDev, clean) {
17851
17852
  return {
17852
17853
  stat: (path) => statOf("stat", path),
17853
17854
  lstat: (path) => statOf("lstat", path),
@@ -17896,7 +17897,7 @@ function syncPathOps(kernel, resolve, statOf, open, tryDev) {
17896
17897
  const abs = resolve(path);
17897
17898
  if (inDev(abs)) return readWholeSync(open(abs));
17898
17899
  try {
17899
- kernel.call({ op: "fd-path-flush", path: abs });
17900
+ if (!clean()) kernel.call({ op: "fd-path-flush", path: abs });
17900
17901
  return kernel.bytes({ op: "read", path: abs });
17901
17902
  } catch (err) {
17902
17903
  if (!(err instanceof JsCallError) || err.code !== "ENOENT") throw err;
@@ -18728,9 +18729,9 @@ async function resolveDevAsync(kernel, abs) {
18728
18729
  return void 0;
18729
18730
  }
18730
18731
  }
18731
- async function vfsStat(kernel, abs, op, tryDev) {
18732
+ async function vfsStat(kernel, abs, op, tryDev, clean) {
18732
18733
  try {
18733
- await kernel.call({ op: "fd-path-flush", path: abs });
18734
+ if (!clean()) await kernel.call({ op: "fd-path-flush", path: abs });
18734
18735
  const s = parseSyncFsStat(await kernel.json({ op, path: abs }));
18735
18736
  if (!s) throw new JsCallError("EIO", op);
18736
18737
  return s;
@@ -18915,11 +18916,18 @@ function scriptRunner(run) {
18915
18916
  };
18916
18917
  }
18917
18918
  function hostExtras(o) {
18919
+ const path = o.modulePath;
18920
+ const module = path === void 0 ? {} : { module: capturedObject.freeze({ path }) };
18918
18921
  return {
18919
18922
  memory: () => measured(o.memory),
18920
- ...o.asyncContext ? { asyncContext: o.asyncContext() } : {}
18923
+ ...o.asyncContext ? { asyncContext: o.asyncContext() } : {},
18924
+ ...module
18921
18925
  };
18922
18926
  }
18927
+ function cleanOf(sab) {
18928
+ const changes = sab ? new ChangeView(sab) : void 0;
18929
+ return () => changes?.clean() === true;
18930
+ }
18923
18931
  function createContext(o) {
18924
18932
  const { kernel } = o;
18925
18933
  const infos = new capturedMap();
@@ -18929,6 +18937,7 @@ function createContext(o) {
18929
18937
  let held2;
18930
18938
  const resolve = (path) => resolvePath(cwdFor(o.cwd, held2, path), path);
18931
18939
  const tryDev = (abs) => resolveDevAsync(kernel, abs);
18940
+ const clean = cleanOf(o.changes);
18932
18941
  let exiting;
18933
18942
  const exit = (code2 = 0) => {
18934
18943
  exiting ??= code2;
@@ -18957,7 +18966,7 @@ function createContext(o) {
18957
18966
  const statOf = async (op, path) => {
18958
18967
  const abs = resolve(path);
18959
18968
  if (inDev(abs)) return devAsync(kernel, devStat(abs, op === "stat"));
18960
- return vfsStat(kernel, abs, op, tryDev);
18969
+ return vfsStat(kernel, abs, op, tryDev, clean);
18961
18970
  };
18962
18971
  const devIo = { infos, handles, read: read2, write: writeAll };
18963
18972
  const open = async (path, options = {}, whole = false) => {
@@ -18972,7 +18981,7 @@ function createContext(o) {
18972
18981
  return openDev(kernel, devPath, options, devIo);
18973
18982
  }
18974
18983
  };
18975
- const fs = procFsAsync(pathOps(kernel, resolve, statOf, open, tryDev), kernel, {
18984
+ const fs = procFsAsync(pathOps(kernel, resolve, statOf, open, tryDev, clean), kernel, {
18976
18985
  resolve,
18977
18986
  pid: o.pid
18978
18987
  });
@@ -18981,7 +18990,7 @@ function createContext(o) {
18981
18990
  const syncKernel = new JsSyncKernel(lane, kernel, unwind);
18982
18991
  held2 = heldOn(o.held, lane, syncKernel);
18983
18992
  const terminal = ttyOps(kernel, syncKernel);
18984
- const shared = { pid: o.pid, resolve, random, infos, handles, closing };
18993
+ const shared = { pid: o.pid, resolve, random, infos, handles, closing, clean };
18985
18994
  const wasi = wasiFor({ lane, pid: o.pid, cwd: o.cwd, resolve, fs: o.fs, owned: o.owned });
18986
18995
  const sync = {
18987
18996
  kernel: KERNEL_INFO,
@@ -19188,7 +19197,7 @@ async function sendSome(kernel, fd, body, signal) {
19188
19197
  await kernel.blocking({ op: "fd-select", read: [], write: [fd], timeoutMs: -1 }, signal);
19189
19198
  }
19190
19199
  }
19191
- function pathOps(kernel, resolve, statOf, open, tryDev) {
19200
+ function pathOps(kernel, resolve, statOf, open, tryDev, clean) {
19192
19201
  return {
19193
19202
  stat: (path) => statOf("stat", path),
19194
19203
  lstat: (path) => statOf("lstat", path),
@@ -19239,7 +19248,7 @@ function pathOps(kernel, resolve, statOf, open, tryDev) {
19239
19248
  const abs = resolve(path);
19240
19249
  if (inDev(abs)) return readWhole(await open(abs));
19241
19250
  try {
19242
- await kernel.call({ op: "fd-path-flush", path: abs });
19251
+ if (!clean()) await kernel.call({ op: "fd-path-flush", path: abs });
19243
19252
  return await kernel.bytes({ op: "read", path: abs });
19244
19253
  } catch (err) {
19245
19254
  if (!(err instanceof JsCallError) || err.code !== "ENOENT") throw err;
@@ -19268,6 +19277,7 @@ var init_js_context = __esm({
19268
19277
  "src/process/js/js-context.ts"() {
19269
19278
  "use strict";
19270
19279
  init_captured_globals();
19280
+ init_changes();
19271
19281
  init_physical_path();
19272
19282
  init_held_cwd();
19273
19283
  init_signals();
@@ -19479,12 +19489,14 @@ async function runJs(init, port2, deps, thread) {
19479
19489
  cwd: init.cwd,
19480
19490
  exit: (status3) => exited(statusOf(status3)),
19481
19491
  lane: laneOf(init.lane),
19492
+ changes: init.changes,
19482
19493
  fs: { owners: init.owners === true, links: init.links === true },
19483
19494
  strays,
19484
19495
  thread: threadContext(port2, thread),
19485
19496
  memory: deps.memory,
19486
19497
  asyncContext: deps.asyncContext,
19487
19498
  runScript: deps.runScript,
19499
+ modulePath: modulePathOf(init.program),
19488
19500
  promiseState: deps.promiseState,
19489
19501
  ...thread?.owned ? { owned: thread.owned } : {},
19490
19502
  held: init.held,
@@ -19530,6 +19542,10 @@ async function runJs(init, port2, deps, thread) {
19530
19542
  if (exitedWith !== void 0) return exitedWith;
19531
19543
  return status2;
19532
19544
  }
19545
+ function modulePathOf(program) {
19546
+ if (program.glue !== "") return void 0;
19547
+ return program.path;
19548
+ }
19533
19549
  var NOT_RUNNABLE;
19534
19550
  var init_js_runtime = __esm({
19535
19551
  "src/process/js/js-runtime.ts"() {