@ai-ecoverse/slicc-kernel 1.163.1 → 1.164.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.
@@ -5068,14 +5068,14 @@ function hostnameOf(env) {
5068
5068
  function initHostname(init) {
5069
5069
  return isHostname(init.hostname) ? init.hostname : hostnameOf(init.env);
5070
5070
  }
5071
- function ownNames(hostname) {
5071
+ function ownNames2(hostname) {
5072
5072
  return [...new capturedSet([hostname.toLowerCase(), ...LIBC_HOSTNAMES])];
5073
5073
  }
5074
5074
  function hostsFile(hostname = DEFAULT_HOSTNAME) {
5075
5075
  return [
5076
5076
  "127.0.0.1 localhost localhost.localdomain",
5077
5077
  "::1 localhost ip6-localhost",
5078
- `${HOSTNAME_ADDRESS} ${ownNames(hostname).join(" ")}`,
5078
+ `${HOSTNAME_ADDRESS} ${ownNames2(hostname).join(" ")}`,
5079
5079
  `${HOST_LOOPBACK_ADDRESS.join(".")} ${HOST_LOOPBACK}`,
5080
5080
  ""
5081
5081
  ].join("\n");
@@ -7365,7 +7365,7 @@ var init_version = __esm({
7365
7365
  "src/version.ts"() {
7366
7366
  "use strict";
7367
7367
  init_captured_globals();
7368
- KERNEL_VERSION = true ? "1.163.1" : "0.0.0-dev";
7368
+ KERNEL_VERSION = true ? "1.164.1" : "0.0.0-dev";
7369
7369
  OS_RELEASE = "6.0.0-slicc";
7370
7370
  }
7371
7371
  });
@@ -16184,10 +16184,12 @@ function measured(measure) {
16184
16184
  }
16185
16185
  function realmOps(o) {
16186
16186
  const hook = o.stackFormatter;
16187
+ const source = o.errorSource;
16187
16188
  return {
16188
16189
  runScript: scriptRunner(o.runScript),
16189
16190
  promiseState: (promise) => o.promiseState?.(promise),
16190
- ...hook ? { setStackFormatter: (fn) => hook(fn) } : {}
16191
+ ...hook ? { setStackFormatter: (fn) => hook(fn) } : {},
16192
+ ...source ? { errorSource: (error) => source(error) } : {}
16191
16193
  };
16192
16194
  }
16193
16195
  function scriptRunner(run) {
@@ -16783,6 +16785,7 @@ async function runJs(init, port3, deps, thread) {
16783
16785
  modulePath: modulePathOf(init.program),
16784
16786
  promiseState: deps.promiseState,
16785
16787
  stackFormatter: deps.stackFormatter,
16788
+ errorSource: deps.errorSource,
16786
16789
  ...thread?.owned ? { owned: thread.owned } : {},
16787
16790
  held: init.held,
16788
16791
  failed: () => failedWith
@@ -17404,9 +17407,9 @@ function write(view, at, type, value2) {
17404
17407
  else if (type === "f32") view.setFloat32(at, capturedNumber(value2), true);
17405
17408
  else view.setFloat64(at, capturedNumber(value2), true);
17406
17409
  }
17407
- function scalars(types2) {
17408
- if (types2.includes("other")) throw new WasiError("EINVAL");
17409
- return types2;
17410
+ function scalars(types3) {
17411
+ if (types3.includes("other")) throw new WasiError("EINVAL");
17412
+ return types3;
17410
17413
  }
17411
17414
  function callDynamic(ctx, ...operands) {
17412
17415
  const [id, values, valuesLen, results, resultsLen, strict] = operands.map((n) => n >>> 0);
@@ -17417,7 +17420,7 @@ function callDynamic(ctx, ...operands) {
17417
17420
  if (!fn || !sig) throw new WasiError("EINVAL");
17418
17421
  const params = scalars(sig.params);
17419
17422
  const outs = scalars(sig.results);
17420
- const size = (types2) => types2.reduce((n, type) => n + SIZE2[type], 0);
17423
+ const size = (types3) => types3.reduce((n, type) => n + SIZE2[type], 0);
17421
17424
  if (strict && (size(params) !== valuesLen || size(outs) !== resultsLen)) {
17422
17425
  throw new WasiError("EINVAL");
17423
17426
  }
@@ -19594,13 +19597,36 @@ import { AsyncLocalStorage } from "node:async_hooks";
19594
19597
  import { createHash } from "node:crypto";
19595
19598
  import { isBuiltin, registerHooks } from "node:module";
19596
19599
  import { resolve, sep } from "node:path";
19597
- import { types } from "node:util";
19600
+ import { types as types2 } from "node:util";
19598
19601
  import { getHeapStatistics } from "node:v8";
19599
19602
  import { runInThisContext } from "node:vm";
19600
19603
 
19601
19604
  // src/node-stack.ts
19602
19605
  init_captured_globals();
19603
19606
  import { createRequire } from "node:module";
19607
+ import { types } from "node:util";
19608
+ function quietly(target, run) {
19609
+ const emit = target.emitWarning;
19610
+ target.emitWarning = () => {
19611
+ };
19612
+ try {
19613
+ return run();
19614
+ } finally {
19615
+ target.emitWarning = emit;
19616
+ }
19617
+ }
19618
+ function positionsOf(load) {
19619
+ try {
19620
+ const { internalBinding } = quietly(
19621
+ capturedprocess,
19622
+ () => load("internal/test/binding")
19623
+ );
19624
+ const get = internalBinding("errors").getErrorSourcePositions;
19625
+ return typeof get === "function" ? get : void 0;
19626
+ } catch {
19627
+ return void 0;
19628
+ }
19629
+ }
19604
19630
  var apply = capturedReflect.apply;
19605
19631
  var push = capturedArray.prototype.push;
19606
19632
  var startsWith = capturedString.prototype.startsWith;
@@ -19609,6 +19635,11 @@ var lastIndexOf = capturedString.prototype.lastIndexOf;
19609
19635
  var indexOf = capturedString.prototype.indexOf;
19610
19636
  var setHas = capturedSet.prototype.has;
19611
19637
  var setAdd = capturedSet.prototype.add;
19638
+ var mapGet = capturedWeakMap.prototype.get;
19639
+ var mapSet = capturedWeakMap.prototype.set;
19640
+ var isNativeError = types.isNativeError;
19641
+ var freeze = capturedObject.freeze;
19642
+ var blank = capturedObject.create;
19612
19643
  function internals() {
19613
19644
  try {
19614
19645
  const load = createRequire(import.meta.url);
@@ -19621,7 +19652,8 @@ function internals() {
19621
19652
  if (typeof set !== "function" || typeof fallback !== "function") return void 0;
19622
19653
  return {
19623
19654
  setInternalPrepareStackTrace: set,
19624
- fallback
19655
+ fallback,
19656
+ positions: positionsOf(load)
19625
19657
  };
19626
19658
  } catch {
19627
19659
  return void 0;
@@ -19647,6 +19679,11 @@ var fileOf = proto.getFileName;
19647
19679
  var hashOf = proto.getScriptHash;
19648
19680
  var isEval = proto.isEval;
19649
19681
  var originOf = proto.getEvalOrigin;
19682
+ var lineOf = proto.getLineNumber;
19683
+ var ownNames = new capturedSet([
19684
+ apply(fileOf, self, []),
19685
+ apply(proto.getScriptNameOrSourceURL, self, [])
19686
+ ]);
19650
19687
  var ownHash = apply(hashOf, self, []);
19651
19688
  var programHashes = new capturedSet();
19652
19689
  var programNames = new capturedSet();
@@ -19702,8 +19739,12 @@ function keptFrames(trace) {
19702
19739
  }
19703
19740
  var formatter = null;
19704
19741
  var formatting = false;
19742
+ var tops = new capturedWeakMap();
19705
19743
  function stackDispatcher(fallback) {
19706
19744
  return (error, trace) => {
19745
+ if (typeof error === "object" && error !== null && trace.length > 0) {
19746
+ apply(mapSet, tops, [error, trace[0]]);
19747
+ }
19707
19748
  const fn = formatter;
19708
19749
  if (fn === null || formatting) return apply(fallback, void 0, [error, trace]);
19709
19750
  formatting = true;
@@ -19727,6 +19768,29 @@ var nodeStackFormatter = found ? (fn) => {
19727
19768
  formatter = fn;
19728
19769
  return previous;
19729
19770
  } : void 0;
19771
+ function errorSourceOf(positions2, error) {
19772
+ if (typeof error !== "object" || error === null || !isNativeError(error)) return void 0;
19773
+ try {
19774
+ void error.stack;
19775
+ } catch {
19776
+ return void 0;
19777
+ }
19778
+ const site = apply(mapGet, tops, [error]);
19779
+ if (site === void 0 || !keptFrame(site)) return void 0;
19780
+ const at = positions2(error);
19781
+ if (!at || typeof at.sourceLine !== "string" || typeof at.lineNumber !== "number")
19782
+ return void 0;
19783
+ if (apply(setHas, ownNames, [at.scriptResourceName]) === true) return void 0;
19784
+ const file = apply(isEval, site, []) === true ? void 0 : apply(fileOf, site, []);
19785
+ if (at.scriptResourceName !== file || apply(lineOf, site, []) !== at.lineNumber) return void 0;
19786
+ const out = blank(null);
19787
+ out.sourceLine = at.sourceLine;
19788
+ out.lineNumber = at.lineNumber;
19789
+ out.startColumn = typeof at.startColumn === "number" ? at.startColumn : 0;
19790
+ return freeze(out);
19791
+ }
19792
+ var positions = found?.positions;
19793
+ var nodeErrorSource = positions ? (error) => errorSourceOf(positions, error) : void 0;
19730
19794
 
19731
19795
  // src/node-lockdown.ts
19732
19796
  init_lockdown();
@@ -19851,13 +19915,13 @@ function ownCache(dir, result, optional = false) {
19851
19915
  }
19852
19916
  var runHere = runInThisContext;
19853
19917
  function nodeRunScript(source, filename) {
19854
- const options = blank(null);
19918
+ const options = blank2(null);
19855
19919
  options.filename = filename;
19856
19920
  options.displayErrors = false;
19857
19921
  programScript(filename, sourceHash(source));
19858
- return freeze({ value: runHere(source, options), completion: true });
19922
+ return freeze2({ value: runHere(source, options), completion: true });
19859
19923
  }
19860
- var isPromise = types.isPromise;
19924
+ var isPromise = types2.isPromise;
19861
19925
  var here2 = capturedGlobalThis;
19862
19926
  var define = capturedReflect.defineProperty;
19863
19927
  var remove = capturedReflect.deleteProperty;
@@ -20042,21 +20106,21 @@ function nodePromiseState(promise) {
20042
20106
  }
20043
20107
  var Storage = AsyncLocalStorage;
20044
20108
  var apply2 = capturedReflect.apply;
20045
- var freeze = capturedObject.freeze;
20046
- var blank = capturedObject.create;
20109
+ var freeze2 = capturedObject.freeze;
20110
+ var blank2 = capturedObject.create;
20047
20111
  function nodeAsyncContext() {
20048
20112
  const storage = new Storage();
20049
20113
  const run = storage.run.bind(storage);
20050
20114
  const getStore = storage.getStore.bind(storage);
20051
20115
  const enterWith = storage.enterWith.bind(storage);
20052
- const api = blank(null);
20053
- api.run = freeze((store, fn, ...args) => {
20116
+ const api = blank2(null);
20117
+ api.run = freeze2((store, fn, ...args) => {
20054
20118
  if (typeof fn !== "function") throw new capturedTypeError("asyncContext.run needs a function");
20055
20119
  return run(store, () => apply2(fn, void 0, args));
20056
20120
  });
20057
- api.getStore = freeze(() => getStore());
20058
- api.enterWith = freeze((store) => enterWith(store));
20059
- return freeze(api);
20121
+ api.getStore = freeze2(() => getStore());
20122
+ api.enterWith = freeze2((store) => enterWith(store));
20123
+ return freeze2(api);
20060
20124
  }
20061
20125
 
20062
20126
  // src/node-process-worker.ts
@@ -20161,6 +20225,7 @@ var onMessage = processEntry(
20161
20225
  moduleSource,
20162
20226
  promiseState: nodePromiseState,
20163
20227
  stackFormatter: nodeStackFormatter,
20228
+ errorSource: nodeErrorSource,
20164
20229
  imported
20165
20230
  }),
20166
20231
  runJsThread: (init, at) => runJsThread(init, at, {
@@ -20172,6 +20237,7 @@ var onMessage = processEntry(
20172
20237
  moduleSource,
20173
20238
  promiseState: nodePromiseState,
20174
20239
  stackFormatter: nodeStackFormatter,
20240
+ errorSource: nodeErrorSource,
20175
20241
  imported
20176
20242
  })
20177
20243
  }),