@ai-ecoverse/slicc-kernel 1.122.3 → 1.123.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.
@@ -1259,13 +1259,14 @@ var init_wasi_files = __esm({
1259
1259
  });
1260
1260
 
1261
1261
  // src/kernel/protocol.ts
1262
- var WASM_PROCESS_INIT, WASM_PROCESS_EXIT, WASM_PROCESS_ERROR, WASM_THREAD_SPAWN, WASM_THREAD_INIT, WASM_THREAD_EXIT, WASM_MAX_THREADS, WASM_DEFAULT_THREADS;
1262
+ var WASM_PROCESS_INIT, WASM_PROCESS_EXIT, WASM_PROCESS_ERROR, WASM_PROCESS_READY, WASM_THREAD_SPAWN, WASM_THREAD_INIT, WASM_THREAD_EXIT, WASM_MAX_THREADS, WASM_DEFAULT_THREADS;
1263
1263
  var init_protocol = __esm({
1264
1264
  "src/kernel/protocol.ts"() {
1265
1265
  "use strict";
1266
1266
  WASM_PROCESS_INIT = "wasm-process-init";
1267
1267
  WASM_PROCESS_EXIT = "wasm-process-exit";
1268
1268
  WASM_PROCESS_ERROR = "wasm-process-error";
1269
+ WASM_PROCESS_READY = "wasm-process-ready";
1269
1270
  WASM_THREAD_SPAWN = "wasm-thread-spawn";
1270
1271
  WASM_THREAD_INIT = "wasm-thread-init";
1271
1272
  WASM_THREAD_EXIT = "wasm-thread-exit";
@@ -5432,7 +5433,7 @@ var KERNEL_VERSION, OS_RELEASE;
5432
5433
  var init_version = __esm({
5433
5434
  "src/version.ts"() {
5434
5435
  "use strict";
5435
- KERNEL_VERSION = true ? "1.122.3" : "0.0.0-dev";
5436
+ KERNEL_VERSION = true ? "1.123.0" : "0.0.0-dev";
5436
5437
  OS_RELEASE = "6.0.0-slicc";
5437
5438
  }
5438
5439
  });
@@ -9709,14 +9710,20 @@ var init_process_fds = __esm({
9709
9710
  });
9710
9711
 
9711
9712
  // src/process/procfs.ts
9713
+ function isSysFile(at) {
9714
+ return typeof at === "string" || typeof at === "function";
9715
+ }
9712
9716
  function sysEntry(parts) {
9713
9717
  let at = SYS_TREE;
9714
9718
  for (const part of parts) {
9715
- if (typeof at !== "object" || !Object.hasOwn(at, part)) return void 0;
9719
+ if (isSysFile(at) || !Object.hasOwn(at, part)) return void 0;
9716
9720
  at = at[part];
9717
9721
  }
9718
9722
  return at;
9719
9723
  }
9724
+ function sysText(file, listing) {
9725
+ return typeof file === "string" ? file : file(listing());
9726
+ }
9720
9727
  function commOf(info) {
9721
9728
  const name2 = info.argv[0] ?? "";
9722
9729
  return name2.slice(name2.lastIndexOf("/") + 1).slice(0, 15);
@@ -9966,7 +9973,7 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
9966
9973
  dir.node_ops.lookup = (at, child) => {
9967
9974
  if (!Object.hasOwn(tree, child)) throw error();
9968
9975
  const next2 = tree[child];
9969
- return typeof next2 === "string" ? file(at, child, () => next2) : sysDir(at, child, next2);
9976
+ return isSysFile(next2) ? file(at, child, () => sysText(next2, procList)) : sysDir(at, child, next2);
9970
9977
  };
9971
9978
  dir.node_ops.readdir = () => [".", "..", ...Object.keys(tree)];
9972
9979
  return dir;
@@ -10090,8 +10097,13 @@ var init_procfs = __esm({
10090
10097
  PID_FILES = ["cmdline", "comm", "stat", "statm", "status"];
10091
10098
  SYSTEM_FILES = ["loadavg", "meminfo", "stat", "uptime", "version"];
10092
10099
  SYS_TREE = {
10093
- kernel: { osrelease: `${OS_RELEASE}
10094
- `, ostype: "Linux\n" }
10100
+ kernel: {
10101
+ osrelease: `${OS_RELEASE}
10102
+ `,
10103
+ ostype: "Linux\n",
10104
+ slicc_wasm_memories: (listing) => `${listing.wasm?.live ?? 0} ${listing.wasm?.ceiling ?? 0}
10105
+ `
10106
+ }
10095
10107
  };
10096
10108
  sigMask = (mask = 0) => (mask >>> 1).toString(16).padStart(16, "0");
10097
10109
  STATES = {
@@ -10374,7 +10386,9 @@ var init_wasi_procfs = __esm({
10374
10386
  }
10375
10387
  if (top === "sys") {
10376
10388
  const entry = sysEntry(parts.slice(1));
10377
- if (typeof entry === "string") return { kind: "file", content: () => entry };
10389
+ if (typeof entry === "string" || typeof entry === "function") {
10390
+ return { kind: "file", content: () => sysText(entry, () => this.listing()) };
10391
+ }
10378
10392
  return entry && { kind: "dir", names: () => Object.keys(entry) };
10379
10393
  }
10380
10394
  if (top === "self") {
@@ -13966,6 +13980,7 @@ async function runWasmProcess(init, port3, deps = {}) {
13966
13980
  return WebAssembly.instantiate(init.program.module, imports);
13967
13981
  }).then((instance) => {
13968
13982
  memory = wasmMemory(instance, imports);
13983
+ port3.postMessage({ type: WASM_PROCESS_READY });
13969
13984
  exports = instance.exports;
13970
13985
  publishMemory(init.sab, memory?.buffer.byteLength ?? 0);
13971
13986
  done(
@@ -14136,6 +14151,7 @@ var init_process_runtime = __esm({
14136
14151
  "src/process/process-runtime.ts"() {
14137
14152
  "use strict";
14138
14153
  init_loopback_names();
14154
+ init_protocol();
14139
14155
  init_signals();
14140
14156
  init_emscripten_vfs_hook();
14141
14157
  init_live_vfs_fs();
@@ -16524,6 +16540,7 @@ async function runWasiProcess(init, port3) {
16524
16540
  restoreExportedMemory(instance, memory, init);
16525
16541
  main.memory = memoryOf(instance, memory);
16526
16542
  publishMemory(init.sab, sizeOf2(main)());
16543
+ port3.postMessage({ type: WASM_PROCESS_READY });
16527
16544
  signals.bind(instance.exports);
16528
16545
  if (importsSigactionHook(module)) signals.useHook();
16529
16546
  if (fork?.signals) signals.restore(fork.signals);