@ai-ecoverse/slicc-kernel 1.100.2 → 1.100.4

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.
@@ -4767,7 +4767,7 @@ var KERNEL_VERSION, OS_RELEASE;
4767
4767
  var init_version = __esm({
4768
4768
  "src/version.ts"() {
4769
4769
  "use strict";
4770
- KERNEL_VERSION = true ? "1.100.2" : "0.0.0-dev";
4770
+ KERNEL_VERSION = true ? "1.100.4" : "0.0.0-dev";
4771
4771
  OS_RELEASE = "6.0.0-slicc";
4772
4772
  }
4773
4773
  });
package/dist/node.js CHANGED
@@ -11107,7 +11107,7 @@ var PATH_OPS = new Set(SYNC_FS_OPS);
11107
11107
  var EARLY_WHOLE_FILE = 64 * 1024;
11108
11108
 
11109
11109
  // src/version.ts
11110
- var KERNEL_VERSION = true ? "1.100.2" : "0.0.0-dev";
11110
+ var KERNEL_VERSION = true ? "1.100.4" : "0.0.0-dev";
11111
11111
  var OS_RELEASE = "6.0.0-slicc";
11112
11112
  function procVersion() {
11113
11113
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -13674,6 +13674,7 @@ var KernelTty = class {
13674
13674
  this.wake();
13675
13675
  }
13676
13676
  resize(cols, rows) {
13677
+ if (cols === this.cols && rows === this.rows) return;
13677
13678
  this.setSize(cols, rows);
13678
13679
  this.signal(SIG.WINCH);
13679
13680
  }
@@ -14048,6 +14049,9 @@ function terminalOf(ctx, fd) {
14048
14049
  }
14049
14050
  var json4 = (value) => ({ ok: true, kind: "json", json: value });
14050
14051
  var done3 = { ok: true, kind: "void" };
14052
+ function sizeKey(rows, cols) {
14053
+ return `${rows}x${cols}`;
14054
+ }
14051
14055
  function ptySyscall(req, ctx) {
14052
14056
  switch (req.op) {
14053
14057
  case "pty-open": {
@@ -14080,9 +14084,11 @@ function ptySyscall(req, ctx) {
14080
14084
  case "pty-packet":
14081
14085
  masterOf(ctx, req.fd).packet = req.on;
14082
14086
  return done3;
14083
- case "pty-winsz-set":
14084
- terminalOf(ctx, req.fd).resize(req.cols, req.rows);
14087
+ case "pty-winsz-set": {
14088
+ const tty = terminalOf(ctx, req.fd);
14089
+ if (ctx.sizesRead?.get(tty) !== sizeKey(req.rows, req.cols)) tty.resize(req.cols, req.rows);
14085
14090
  return done3;
14091
+ }
14086
14092
  }
14087
14093
  }
14088
14094
 
@@ -15464,6 +15470,10 @@ function identityKey(st, path) {
15464
15470
  }
15465
15471
  var DYING = { ok: false, errno: "EINTR", message: "the process is being killed" };
15466
15472
  var HOSTS_ONLY = new Resolver({ routes: new Routes() });
15473
+ function timeLeft2(req, started) {
15474
+ if (!("timeoutMs" in req) || typeof req.timeoutMs !== "number" || req.timeoutMs < 0) return req;
15475
+ return { ...req, timeoutMs: Math.max(0, req.timeoutMs - (performance.now() - started)) };
15476
+ }
15467
15477
  var WasmProcess = class {
15468
15478
  exited = false;
15469
15479
  children;
@@ -15622,24 +15632,31 @@ var WasmProcess = class {
15622
15632
  for (const listener of this.stateListeners) listener("continued", SIG.CONT);
15623
15633
  }
15624
15634
  blocks = /* @__PURE__ */ new WeakMap();
15635
+ sizesRead = /* @__PURE__ */ new WeakMap();
15625
15636
  async syscall(req, cancelled, block) {
15626
15637
  this.options.onSyscall?.(req);
15638
+ const started = performance.now();
15639
+ let restarted = false;
15627
15640
  for (; ; ) {
15628
15641
  await this.resumed;
15629
15642
  if (this.dying) return DYING;
15643
+ const current = restarted ? timeLeft2(req, started) : req;
15630
15644
  const stops = this.stops;
15631
15645
  const scope = new AbortController();
15632
15646
  const forward = () => scope.abort();
15633
15647
  if (cancelled?.aborted) scope.abort();
15634
15648
  cancelled?.addEventListener("abort", forward, { once: true });
15635
15649
  if (block) this.blocks.set(scope.signal, block);
15636
- const result = await this.dispatch(req, scope.signal).finally(() => {
15650
+ const result = await this.dispatch(current, scope.signal).finally(() => {
15637
15651
  cancelled?.removeEventListener("abort", forward);
15638
15652
  this.waiting.delete(scope.signal);
15639
15653
  });
15640
15654
  if (this.dying) return DYING;
15641
15655
  const restart = !result.ok && result.errno === "EINTR" && this.stops !== stops;
15642
- if (restart && !this.options.hasPending?.()) continue;
15656
+ if (restart && !this.options.hasPending?.() && req.op !== "epoll-wait") {
15657
+ restarted = true;
15658
+ continue;
15659
+ }
15643
15660
  await this.resumed;
15644
15661
  return result;
15645
15662
  }
@@ -15686,7 +15703,17 @@ var WasmProcess = class {
15686
15703
  const owner = this.options.owners ? this.ttyOwner() : void 0;
15687
15704
  const guard2 = this.guarded();
15688
15705
  const { outputFilter } = this.options;
15689
- const ctx = { pid: this.pid, fds: this.fds, ptys, jobs, guard: guard2, owner, outputFilter };
15706
+ const sizesRead = this.sizesRead;
15707
+ const ctx = {
15708
+ pid: this.pid,
15709
+ fds: this.fds,
15710
+ ptys,
15711
+ jobs,
15712
+ guard: guard2,
15713
+ owner,
15714
+ outputFilter,
15715
+ sizesRead
15716
+ };
15690
15717
  return ptySyscall(req, ctx);
15691
15718
  }
15692
15719
  return await this.procSyscall(req, cancelled);
@@ -16322,8 +16349,11 @@ var WasmProcess = class {
16322
16349
  case "tty-set":
16323
16350
  tty.tcsets(req.termios, req.flush === true);
16324
16351
  return { ok: true, kind: "void" };
16325
- case "tty-winsz":
16326
- return { ok: true, kind: "json", json: tty.winsize() };
16352
+ case "tty-winsz": {
16353
+ const size = tty.winsize();
16354
+ this.sizesRead.set(tty, sizeKey(...size));
16355
+ return { ok: true, kind: "json", json: size };
16356
+ }
16327
16357
  case "tty-pgrp-get":
16328
16358
  return { ok: true, kind: "json", json: jobs ? jobs.tcgetpgrp(tty, this.sid()) : this.pid };
16329
16359
  case "tty-pgrp-set":