@ai-ecoverse/slicc-kernel 1.160.0 → 1.160.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.
@@ -206,7 +206,13 @@ function decodeSabResult(status2, payload) {
206
206
  const parsed = capturedJSON.parse(decoder.decode(payload));
207
207
  const errno2 = typeof parsed.errno === "string" && /^E[A-Z]+$|^EAI_[A-Z]+$/.test(parsed.errno) ? parsed.errno : "EIO";
208
208
  const message2 = capturedString(parsed.message ?? errno2);
209
- return parsed.direct === true ? { ok: false, errno: errno2, message: message2, direct: true } : { ok: false, errno: errno2, message: message2 };
209
+ return {
210
+ ok: false,
211
+ errno: errno2,
212
+ message: message2,
213
+ ...parsed.direct === true ? { direct: true } : {},
214
+ ...typeof parsed.dev === "string" ? { dev: parsed.dev } : {}
215
+ };
210
216
  } catch {
211
217
  return { ok: false, errno: "EIO", message: "sync-sab: malformed errno payload" };
212
218
  }
@@ -3052,7 +3058,7 @@ var init_version = __esm({
3052
3058
  "src/version.ts"() {
3053
3059
  "use strict";
3054
3060
  init_captured_globals();
3055
- KERNEL_VERSION = true ? "1.160.0" : "0.0.0-dev";
3061
+ KERNEL_VERSION = true ? "1.160.1" : "0.0.0-dev";
3056
3062
  OS_RELEASE = "6.0.0-slicc";
3057
3063
  }
3058
3064
  });
@@ -7991,6 +7997,10 @@ var init_async_sab = __esm({
7991
7997
  });
7992
7998
 
7993
7999
  // src/process/js/js-kernel.ts
8000
+ function devOf(found) {
8001
+ const dev = found?.dev;
8002
+ return typeof dev === "string" ? dev : void 0;
8003
+ }
7994
8004
  function umaskRequest(mask) {
7995
8005
  if (mask === void 0) return { op: "proc-umask" };
7996
8006
  if (!capturedNumber.isInteger(mask) || mask < 0 || mask > 511) {
@@ -8007,11 +8017,13 @@ function modeOf(mode) {
8007
8017
  function callError(result, op) {
8008
8018
  const { errno: errno2, message: message2 } = result;
8009
8019
  const detailed = typeof message2 === "string" && message2 !== errno2 && DETAILED.has(op);
8010
- return new JsCallError(
8020
+ const err = new JsCallError(
8011
8021
  errno2,
8012
8022
  detailed ? `${op}: ${message2}` : op,
8013
8023
  detailed ? message2 : void 0
8014
8024
  );
8025
+ err.dev = result.dev;
8026
+ return err;
8015
8027
  }
8016
8028
  function untilAborted(work, signal) {
8017
8029
  if (!signal) return work;
@@ -8040,6 +8052,7 @@ var init_js_kernel = __esm({
8040
8052
  JsCallError = class extends capturedError {
8041
8053
  code;
8042
8054
  detail;
8055
+ dev;
8043
8056
  constructor(code2, what, detail) {
8044
8057
  super(`${what}: ${code2}`);
8045
8058
  this.name = "JsCallError";
@@ -17695,12 +17708,12 @@ function syncOps(kernel, shared) {
17695
17708
  if (inDev(abs)) return devSync(kernel, devStat(abs, op === "stat"));
17696
17709
  try {
17697
17710
  if (!clean()) kernel.call({ op: "fd-path-flush", path: abs });
17698
- const s = parseSyncFsStat(kernel.json({ op, path: abs }));
17711
+ const s = parseSyncFsStat(kernel.json({ op, path: abs, devs: true }));
17699
17712
  if (!s) throw new JsCallError("EIO", op);
17700
17713
  return s;
17701
17714
  } catch (err) {
17702
17715
  if (!(err instanceof JsCallError) || err.code !== "ENOENT") throw err;
17703
- const devPath = tryDevSync(abs);
17716
+ const devPath = err.dev;
17704
17717
  if (!devPath) throw err;
17705
17718
  return devSync(kernel, devStat(devPath, op === "stat"));
17706
17719
  }
@@ -17771,7 +17784,7 @@ function syncOps(kernel, shared) {
17771
17784
  },
17772
17785
  pipe: () => kernel.json({ op: "fd-pipe" }),
17773
17786
  open: procOpenSync(open, kernel, { resolve, pid: shared.pid }),
17774
- fs: procFsSync(syncPathOps(kernel, resolve, statOf, open, tryDevSync, clean), kernel, {
17787
+ fs: procFsSync(syncPathOps(kernel, resolve, statOf, open, clean), kernel, {
17775
17788
  resolve,
17776
17789
  pid: shared.pid
17777
17790
  })
@@ -17848,15 +17861,16 @@ function syncFile(kernel, fd, path, append, forget) {
17848
17861
  }
17849
17862
  };
17850
17863
  }
17851
- function syncPathOps(kernel, resolve, statOf, open, tryDev, clean) {
17864
+ function syncPathOps(kernel, resolve, statOf, open, clean) {
17852
17865
  return {
17853
17866
  stat: (path) => statOf("stat", path),
17854
17867
  lstat: (path) => statOf("lstat", path),
17855
17868
  exists(path) {
17856
17869
  const abs = resolve(path);
17857
17870
  if (inDev(abs)) return devSync(kernel, devExists(abs));
17858
- if (kernel.json({ op: "exists", path: abs }) === true) return true;
17859
- const devPath = tryDev(abs);
17871
+ const found = kernel.json({ op: "exists", path: abs, devs: true });
17872
+ if (found === true) return true;
17873
+ const devPath = devOf(found);
17860
17874
  return devPath ? devSync(kernel, devExists(devPath)) : false;
17861
17875
  },
17862
17876
  readdir(path) {
@@ -17898,10 +17912,10 @@ function syncPathOps(kernel, resolve, statOf, open, tryDev, clean) {
17898
17912
  if (inDev(abs)) return readWholeSync(open(abs));
17899
17913
  try {
17900
17914
  if (!clean()) kernel.call({ op: "fd-path-flush", path: abs });
17901
- return kernel.bytes({ op: "read", path: abs });
17915
+ return kernel.bytes({ op: "read", path: abs, devs: true });
17902
17916
  } catch (err) {
17903
17917
  if (!(err instanceof JsCallError) || err.code !== "ENOENT") throw err;
17904
- const devPath = tryDev(abs);
17918
+ const devPath = err.dev;
17905
17919
  if (!devPath) throw err;
17906
17920
  return readWholeSync(open(devPath));
17907
17921
  }
@@ -18729,15 +18743,15 @@ async function resolveDevAsync(kernel, abs) {
18729
18743
  return void 0;
18730
18744
  }
18731
18745
  }
18732
- async function vfsStat(kernel, abs, op, tryDev, clean) {
18746
+ async function vfsStat(kernel, abs, op, clean) {
18733
18747
  try {
18734
18748
  if (!clean()) await kernel.call({ op: "fd-path-flush", path: abs });
18735
- const s = parseSyncFsStat(await kernel.json({ op, path: abs }));
18749
+ const s = parseSyncFsStat(await kernel.json({ op, path: abs, devs: true }));
18736
18750
  if (!s) throw new JsCallError("EIO", op);
18737
18751
  return s;
18738
18752
  } catch (err) {
18739
18753
  if (!(err instanceof JsCallError) || err.code !== "ENOENT") throw err;
18740
- const devPath = await tryDev(abs);
18754
+ const devPath = err.dev;
18741
18755
  if (!devPath) throw err;
18742
18756
  return devAsync(kernel, devStat(devPath, op === "stat"));
18743
18757
  }
@@ -18966,7 +18980,7 @@ function createContext(o) {
18966
18980
  const statOf = async (op, path) => {
18967
18981
  const abs = resolve(path);
18968
18982
  if (inDev(abs)) return devAsync(kernel, devStat(abs, op === "stat"));
18969
- return vfsStat(kernel, abs, op, tryDev, clean);
18983
+ return vfsStat(kernel, abs, op, clean);
18970
18984
  };
18971
18985
  const devIo = { infos, handles, read: read2, write: writeAll };
18972
18986
  const open = async (path, options = {}, whole = false) => {
@@ -18981,7 +18995,7 @@ function createContext(o) {
18981
18995
  return openDev(kernel, devPath, options, devIo);
18982
18996
  }
18983
18997
  };
18984
- const fs = procFsAsync(pathOps(kernel, resolve, statOf, open, tryDev, clean), kernel, {
18998
+ const fs = procFsAsync(pathOps(kernel, resolve, statOf, open, clean), kernel, {
18985
18999
  resolve,
18986
19000
  pid: o.pid
18987
19001
  });
@@ -19197,15 +19211,16 @@ async function sendSome(kernel, fd, body, signal) {
19197
19211
  await kernel.blocking({ op: "fd-select", read: [], write: [fd], timeoutMs: -1 }, signal);
19198
19212
  }
19199
19213
  }
19200
- function pathOps(kernel, resolve, statOf, open, tryDev, clean) {
19214
+ function pathOps(kernel, resolve, statOf, open, clean) {
19201
19215
  return {
19202
19216
  stat: (path) => statOf("stat", path),
19203
19217
  lstat: (path) => statOf("lstat", path),
19204
19218
  async exists(path) {
19205
19219
  const abs = resolve(path);
19206
19220
  if (inDev(abs)) return devAsync(kernel, devExists(abs));
19207
- if (await kernel.json({ op: "exists", path: abs }) === true) return true;
19208
- const devPath = await tryDev(abs);
19221
+ const found = await kernel.json({ op: "exists", path: abs, devs: true });
19222
+ if (found === true) return true;
19223
+ const devPath = devOf(found);
19209
19224
  return devPath ? devAsync(kernel, devExists(devPath)) : false;
19210
19225
  },
19211
19226
  async readdir(path) {
@@ -19249,10 +19264,10 @@ function pathOps(kernel, resolve, statOf, open, tryDev, clean) {
19249
19264
  if (inDev(abs)) return readWhole(await open(abs));
19250
19265
  try {
19251
19266
  if (!clean()) await kernel.call({ op: "fd-path-flush", path: abs });
19252
- return await kernel.bytes({ op: "read", path: abs });
19267
+ return await kernel.bytes({ op: "read", path: abs, devs: true });
19253
19268
  } catch (err) {
19254
19269
  if (!(err instanceof JsCallError) || err.code !== "ENOENT") throw err;
19255
- const devPath = await tryDev(abs);
19270
+ const devPath = err.dev;
19256
19271
  if (!devPath) throw err;
19257
19272
  return readWhole(await open(devPath));
19258
19273
  }