@ai-ecoverse/slicc-kernel 1.166.0 → 1.166.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.
@@ -2815,7 +2815,7 @@ function intoTarget(into, offset, length) {
2815
2815
  throw capturedObject.assign(new capturedRangeError("read: the buffer is too small"), { code: "EINVAL" });
2816
2816
  return { into, at: offset };
2817
2817
  }
2818
- function typeOf(info) {
2818
+ function typeOf2(info) {
2819
2819
  if (info.meta && "dir" in info.meta) return "directory";
2820
2820
  if (info.meta && "device" in info.meta) return "device";
2821
2821
  if (info.tty || info.kind === "tty") return "tty";
@@ -2826,7 +2826,7 @@ function device(info) {
2826
2826
  return info.meta && "device" in info.meta ? info.meta : void 0;
2827
2827
  }
2828
2828
  function readDevice(info, max, random2) {
2829
- if (typeOf(info) === "directory") throw new JsCallError("EISDIR", "read");
2829
+ if (typeOf2(info) === "directory") throw new JsCallError("EISDIR", "read");
2830
2830
  const dev = device(info);
2831
2831
  if (!dev) return void 0;
2832
2832
  if (dev.access === "write") throw new JsCallError("EBADF", "read");
@@ -2836,7 +2836,7 @@ function readDevice(info, max, random2) {
2836
2836
  return out;
2837
2837
  }
2838
2838
  function writeDevice(info) {
2839
- if (typeOf(info) === "directory") throw new JsCallError("EISDIR", "write");
2839
+ if (typeOf2(info) === "directory") throw new JsCallError("EISDIR", "write");
2840
2840
  const dev = device(info);
2841
2841
  if (!dev) return false;
2842
2842
  if (dev.access === "read") throw new JsCallError("EBADF", "write");
@@ -2844,7 +2844,7 @@ function writeDevice(info) {
2844
2844
  return true;
2845
2845
  }
2846
2846
  function brokenPipe(err, info) {
2847
- return err instanceof JsCallError && err.code === "EPIPE" && typeOf(info) !== "socket";
2847
+ return err instanceof JsCallError && err.code === "EPIPE" && typeOf2(info) !== "socket";
2848
2848
  }
2849
2849
  function written(r, fallback) {
2850
2850
  return r.ok && r.kind === "json" && typeof r.json === "number" ? r.json : fallback;
@@ -3146,26 +3146,26 @@ function* devOpen(abs, o) {
3146
3146
  async function devAsync(kernel, step) {
3147
3147
  let next2 = step.next();
3148
3148
  while (!next2.done) {
3149
- let answer2;
3149
+ let answer3;
3150
3150
  try {
3151
- answer2 = { value: await kernel.json(next2.value) };
3151
+ answer3 = { value: await kernel.json(next2.value) };
3152
3152
  } catch (error) {
3153
- answer2 = { error };
3153
+ answer3 = { error };
3154
3154
  }
3155
- next2 = "value" in answer2 ? step.next(answer2.value) : step.throw(answer2.error);
3155
+ next2 = "value" in answer3 ? step.next(answer3.value) : step.throw(answer3.error);
3156
3156
  }
3157
3157
  return next2.value;
3158
3158
  }
3159
3159
  function devSync(kernel, step) {
3160
3160
  let next2 = step.next();
3161
3161
  while (!next2.done) {
3162
- let answer2;
3162
+ let answer3;
3163
3163
  try {
3164
- answer2 = { value: kernel.json(next2.value) };
3164
+ answer3 = { value: kernel.json(next2.value) };
3165
3165
  } catch (error) {
3166
- answer2 = { error };
3166
+ answer3 = { error };
3167
3167
  }
3168
- next2 = "value" in answer2 ? step.next(answer2.value) : step.throw(answer2.error);
3168
+ next2 = "value" in answer3 ? step.next(answer3.value) : step.throw(answer3.error);
3169
3169
  }
3170
3170
  return next2.value;
3171
3171
  }
@@ -6545,9 +6545,9 @@ var init_wasi_host = __esm({
6545
6545
  }
6546
6546
  return this.file(fd, "read").read(max);
6547
6547
  }
6548
- local(answer2) {
6548
+ local(answer3) {
6549
6549
  this.interrupted?.();
6550
- return answer2;
6550
+ return answer3;
6551
6551
  }
6552
6552
  seek(fd, offset, whence) {
6553
6553
  const e = this.fds.get(fd);
@@ -7407,11 +7407,11 @@ var init_held_cwd = __esm({
7407
7407
  return true;
7408
7408
  }
7409
7409
  follow() {
7410
- const answer2 = this.ask();
7411
- if (answer2.slot !== void 0) this.slot = answer2.slot;
7412
- this.seen = answer2.gen;
7413
- this.dead = !answer2.alive;
7414
- return answer2.alive;
7410
+ const answer3 = this.ask();
7411
+ if (answer3.slot !== void 0) this.slot = answer3.slot;
7412
+ this.seen = answer3.gen;
7413
+ this.dead = !answer3.alive;
7414
+ return answer3.alive;
7415
7415
  }
7416
7416
  alive(path) {
7417
7417
  if (path !== void 0 && this.at !== void 0 && path !== this.at) {
@@ -7465,7 +7465,7 @@ var init_version = __esm({
7465
7465
  "src/version.ts"() {
7466
7466
  "use strict";
7467
7467
  init_captured_globals();
7468
- KERNEL_VERSION = true ? "1.166.0" : "0.0.0-dev";
7468
+ KERNEL_VERSION = true ? "1.166.1" : "0.0.0-dev";
7469
7469
  OS_RELEASE = "6.0.0-slicc";
7470
7470
  }
7471
7471
  });
@@ -10376,13 +10376,13 @@ function ptyIoctl(ioctl, deps) {
10376
10376
  if (!heap) return -wasiErrno("EFAULT");
10377
10377
  const argp = (heap[varargs >> 2] ?? 0) >>> 0;
10378
10378
  try {
10379
- return answer(request, kfd, argp, heap, deps.kernel);
10379
+ return answer2(request, kfd, argp, heap, deps.kernel);
10380
10380
  } catch (e) {
10381
10381
  return failed2(e);
10382
10382
  }
10383
10383
  };
10384
10384
  }
10385
- function answer(request, kfd, argp, heap, kernel) {
10385
+ function answer2(request, kfd, argp, heap, kernel) {
10386
10386
  switch (request) {
10387
10387
  case TIOCGPTN:
10388
10388
  heap[argp >> 2] = kernel.ptyNumber(kfd);
@@ -15984,8 +15984,8 @@ function listen(listeners, listener) {
15984
15984
  listeners.add(own2);
15985
15985
  return () => void listeners.delete(own2);
15986
15986
  }
15987
- function identityOf(answer2, fallback) {
15988
- const id = answer2;
15987
+ function identityOf(answer3, fallback) {
15988
+ const id = answer3;
15989
15989
  return {
15990
15990
  pid: typeof id?.pid === "number" ? id.pid : fallback.pid,
15991
15991
  ppid: typeof id?.ppid === "number" ? id.ppid : fallback.ppid ?? 1
@@ -16426,10 +16426,10 @@ function createContext(o) {
16426
16426
  pipe: async () => await kernel.json({ op: "fd-pipe" }),
16427
16427
  select: (sets, options) => selectOp(kernel, sets, options?.signal),
16428
16428
  async fdStatus(fd) {
16429
- const type = typeOf(await info(fd));
16429
+ const type = typeOf2(await info(fd));
16430
16430
  return { type, tty: type === "tty", seekable: type === "file" };
16431
16431
  },
16432
- isatty: async (fd) => typeOf(await info(fd)) === "tty",
16432
+ isatty: async (fd) => typeOf2(await info(fd)) === "tty",
16433
16433
  open: procOpenAsync(open, kernel, { resolve: resolve2, pid: o.pid }),
16434
16434
  resolve: resolve2,
16435
16435
  fs,
@@ -19796,6 +19796,10 @@ var isEval = proto.isEval;
19796
19796
  var originOf = proto.getEvalOrigin;
19797
19797
  var lineOf = proto.getLineNumber;
19798
19798
  var nameOf = proto.getScriptNameOrSourceURL;
19799
+ var functionOf = proto.getFunctionName;
19800
+ var typeOf = proto.getTypeName;
19801
+ var syntaxProto = capturedSyntaxError.prototype;
19802
+ var protoOf = capturedObject.getPrototypeOf;
19799
19803
  var ownNames = new capturedSet([
19800
19804
  apply(fileOf, self, []),
19801
19805
  apply(proto.getScriptNameOrSourceURL, self, [])
@@ -19893,7 +19897,8 @@ function record(positions, error, trace) {
19893
19897
  if (typeof error === "object" && error !== null && trace.length > 0) {
19894
19898
  noteSourceUrls(trace);
19895
19899
  const site = trace[0];
19896
- apply(mapSet, seen, [error, { site, at: positionsAt(positions, error, site) }]);
19900
+ const next2 = trace[1];
19901
+ apply(mapSet, seen, [error, { site, next: next2, at: positionsAt(positions, error, site) }]);
19897
19902
  }
19898
19903
  }
19899
19904
  function stackDispatcher(fallback, positions) {
@@ -19989,6 +19994,18 @@ var nodeStackFormatter = found ? (next2, options) => {
19989
19994
  withOwn = next2 !== null && own2 === true;
19990
19995
  return previous;
19991
19996
  } : void 0;
19997
+ function programFrame(site) {
19998
+ if (site === void 0 || !keptFrame(site)) return false;
19999
+ if (apply(isEval, site, []) === true) return true;
20000
+ const file = apply(fileOf, site, []);
20001
+ return typeof file === "string" && apply(startsWith, file, ["node:"]) !== true;
20002
+ }
20003
+ function jsonParseSite(error, got) {
20004
+ const { site, next: next2 } = got;
20005
+ if (protoOf(error) !== syntaxProto || apply(fileOf, site, []) !== null) return false;
20006
+ if (apply(functionOf, site, []) !== "parse" || apply(typeOf, site, []) !== "JSON") return false;
20007
+ return programFrame(next2);
20008
+ }
19992
20009
  function errorSourceOf(error) {
19993
20010
  if (typeof error !== "object" || error === null || !isNativeError(error)) return void 0;
19994
20011
  try {
@@ -20002,8 +20019,13 @@ function errorSourceOf(error) {
20002
20019
  if (!at || typeof at.sourceLine !== "string" || typeof at.lineNumber !== "number")
20003
20020
  return void 0;
20004
20021
  if (apply(setHas, ownNames, [at.scriptResourceName]) === true) return void 0;
20022
+ if (jsonParseSite(error, got))
20023
+ return at.scriptResourceName === void 0 ? answer(at) : void 0;
20005
20024
  const file = scriptOf(site);
20006
20025
  if (at.scriptResourceName !== file || apply(lineOf, site, []) !== at.lineNumber) return void 0;
20026
+ return answer(at);
20027
+ }
20028
+ function answer(at) {
20007
20029
  const out = blank(null);
20008
20030
  out.sourceLine = at.sourceLine;
20009
20031
  out.lineNumber = at.lineNumber;