@ai-ecoverse/slicc-kernel 1.155.0 → 1.157.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.
@@ -7245,7 +7245,7 @@ var KERNEL_VERSION, OS_RELEASE;
7245
7245
  var init_version = __esm({
7246
7246
  "src/version.ts"() {
7247
7247
  "use strict";
7248
- KERNEL_VERSION = true ? "1.155.0" : "0.0.0-dev";
7248
+ KERNEL_VERSION = true ? "1.157.0" : "0.0.0-dev";
7249
7249
  OS_RELEASE = "6.0.0-slicc";
7250
7250
  }
7251
7251
  });
@@ -15934,6 +15934,14 @@ function measured(measure) {
15934
15934
  }
15935
15935
  return out;
15936
15936
  }
15937
+ function scriptRunner(run) {
15938
+ return (source, options = {}) => {
15939
+ if (typeof source !== "string") throw new TypeError("runScript needs a source string");
15940
+ const filename = options.filename ?? "[eval]";
15941
+ if (typeof filename !== "string") throw new TypeError("runScript needs a filename string");
15942
+ return run?.(source, filename);
15943
+ };
15944
+ }
15937
15945
  function hostExtras(o) {
15938
15946
  return {
15939
15947
  memory: () => measured(o.memory),
@@ -16019,7 +16027,8 @@ function createContext(o) {
16019
16027
  kill: killer({ self: o.pid, kernel, syncKernel, lane, writes, modes: terminal.modes }),
16020
16028
  cred: () => syncKernel.json({ op: "proc-cred" }),
16021
16029
  umask: (mask) => syncKernel.json(umaskRequest(mask)),
16022
- setcred: setcredOn(syncKernel)
16030
+ setcred: setcredOn(syncKernel),
16031
+ runScript: scriptRunner(o.runScript)
16023
16032
  };
16024
16033
  const io = { read: read2, send: writeAll, close: (fd) => ctx.close(fd) };
16025
16034
  const defaults = { env: o.env, cwd: o.cwd, signal: signalNumber };
@@ -16493,6 +16502,7 @@ async function runJs(init, port3, deps, thread) {
16493
16502
  thread: threadContext(port3, thread),
16494
16503
  memory: deps.memory,
16495
16504
  asyncContext: deps.asyncContext,
16505
+ runScript: deps.runScript,
16496
16506
  ...thread?.owned ? { owned: thread.owned } : {},
16497
16507
  held: init.held,
16498
16508
  failed: () => failedWith
@@ -19284,6 +19294,7 @@ import { AsyncLocalStorage } from "node:async_hooks";
19284
19294
  import { isBuiltin, registerHooks } from "node:module";
19285
19295
  import { resolve, sep } from "node:path";
19286
19296
  import { getHeapStatistics } from "node:v8";
19297
+ import { runInThisContext } from "node:vm";
19287
19298
  var NODE_GLOBALS = ["localStorage", "sessionStorage"];
19288
19299
  var NODE_SLOTS = [
19289
19300
  "require",
@@ -19385,6 +19396,12 @@ function ownCache(dir, result) {
19385
19396
  }
19386
19397
  return true;
19387
19398
  }
19399
+ var runHere = runInThisContext;
19400
+ function nodeRunScript(source, filename) {
19401
+ const options = blank(null);
19402
+ options.filename = filename;
19403
+ return freeze({ value: runHere(source, options), completion: true });
19404
+ }
19388
19405
  var Storage = AsyncLocalStorage;
19389
19406
  var apply = Reflect.apply;
19390
19407
  var freeze = Object.freeze;
@@ -19500,6 +19517,7 @@ var onMessage = processEntry(
19500
19517
  scope: strayScope,
19501
19518
  memory: nodeMemory,
19502
19519
  asyncContext: nodeAsyncContext,
19520
+ runScript: nodeRunScript,
19503
19521
  imported
19504
19522
  }),
19505
19523
  runJsThread: (init, at) => runJsThread(init, at, {
@@ -19507,6 +19525,7 @@ var onMessage = processEntry(
19507
19525
  scope: strayScope,
19508
19526
  memory: nodeMemory,
19509
19527
  asyncContext: nodeAsyncContext,
19528
+ runScript: nodeRunScript,
19510
19529
  imported
19511
19530
  })
19512
19531
  }),