@ai-ecoverse/slicc-kernel 1.147.10 → 1.148.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.
package/dist/node.js CHANGED
@@ -3305,7 +3305,7 @@ function satisfies(version, range2) {
3305
3305
  }
3306
3306
 
3307
3307
  // src/version.ts
3308
- var KERNEL_VERSION = true ? "1.147.10" : "0.0.0-dev";
3308
+ var KERNEL_VERSION = true ? "1.148.1" : "0.0.0-dev";
3309
3309
  var OS_RELEASE = "6.0.0-slicc";
3310
3310
  function procVersion() {
3311
3311
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -9489,6 +9489,7 @@ function statJson(s) {
9489
9489
  atimeMs: s.atime.getTime(),
9490
9490
  ctimeMs: s.ctime.getTime(),
9491
9491
  ino: s.ino,
9492
+ ...s.fid !== void 0 ? { fid: s.fid } : {},
9492
9493
  ...s.nlink !== void 0 ? { nlink: s.nlink } : {},
9493
9494
  ...s.dev !== void 0 ? { dev: s.dev } : {},
9494
9495
  ...s.readonly ? { readonly: true } : {},
@@ -21790,6 +21791,9 @@ var RemoteWatch = class {
21790
21791
  await new Promise((resolve2) => setTimeout(resolve2, ANNOUNCE_POLL_MS));
21791
21792
  }
21792
21793
  }
21794
+ legacy() {
21795
+ return [...this.peers].filter((peer) => !this.ackers.has(peer));
21796
+ }
21793
21797
  crowded() {
21794
21798
  return !this.settled || this.peers.size > 0;
21795
21799
  }
@@ -21797,7 +21801,7 @@ var RemoteWatch = class {
21797
21801
  return `${this.name}:${tab}`;
21798
21802
  }
21799
21803
  receive(data) {
21800
- const sender = data.hello ?? data.here;
21804
+ const sender = data.hello ?? data.here ?? (data.paths !== void 0 ? data.tab : void 0);
21801
21805
  if (sender !== void 0 && data.renames) this.ackers.add(sender);
21802
21806
  if (data.hello !== void 0) this.greeted(data.hello);
21803
21807
  if (data.renaming !== void 0 && data.tab !== void 0) this.heard(data);
@@ -21904,7 +21908,7 @@ var RemoteWatch = class {
21904
21908
  announce(paths) {
21905
21909
  this.mine = [...paths];
21906
21910
  const seq2 = ++this.seq;
21907
- this.channel.postMessage({ tab: this.tab, paths: this.mine, seq: seq2 });
21911
+ this.channel.postMessage({ tab: this.tab, paths: this.mine, seq: seq2, renames: true });
21908
21912
  return this.acks(seq2, this.peers);
21909
21913
  }
21910
21914
  renamingTree(rename, cap = RENAME_ACK_MAX_MS) {
@@ -23588,6 +23592,19 @@ var OpfsFs = class {
23588
23592
  for (const path of paths) this.forget(path);
23589
23593
  this.channel?.postMessage(paths);
23590
23594
  }
23595
+ async fileId(path) {
23596
+ const found = await this.locate(path, true);
23597
+ const [entry] = await this.meta.get([found.path]);
23598
+ if (entry?.fid !== void 0) return entry.fid;
23599
+ const fid = crypto.randomUUID();
23600
+ await this.meta.update(found.path, (now) => ({
23601
+ ...occupied(now),
23602
+ path: found.path,
23603
+ fid: now?.fid ?? fid
23604
+ }));
23605
+ const [stored] = await this.meta.get([found.path]);
23606
+ return stored?.fid ?? fid;
23607
+ }
23591
23608
  heldUnder = () => [];
23592
23609
  heldBy(held) {
23593
23610
  this.heldUnder = held;
@@ -24185,6 +24202,7 @@ var OpfsFs = class {
24185
24202
  atime: new Date(meta?.atimeMs ?? mtime),
24186
24203
  ctime: new Date(Math.max(touched ?? meta?.ctimeMs ?? mtime, modified)),
24187
24204
  ino: meta?.ino ?? inodeOf(path),
24205
+ ...meta?.fid !== void 0 ? { fid: meta.fid } : {},
24188
24206
  ...this.ranged && !directory ? { ranged: true } : {}
24189
24207
  };
24190
24208
  }
@@ -24822,6 +24840,17 @@ var OpfsFs = class {
24822
24840
  }
24823
24841
  async admitted(locks, lock, from, to, place, hooks) {
24824
24842
  const remote = this.remote;
24843
+ const older = remote?.legacy() ?? [];
24844
+ if (older.length > 0) {
24845
+ this.ackBusy++;
24846
+ if (!this.warnedLegacy) {
24847
+ this.warnedLegacy = true;
24848
+ console.warn(
24849
+ `slicc-kernel: renaming ${from} to ${to} gave up (EBUSY): a tab running an older slicc-kernel shares this root and can't be waited for; reload it to rename directories (#1309)`
24850
+ );
24851
+ }
24852
+ throw fsError("EBUSY", from);
24853
+ }
24825
24854
  if (remote && !this.shared() && !await remote.joinedAll(RENAME_ACK_MAX_MS)) {
24826
24855
  this.ackBusy++;
24827
24856
  console.warn(
@@ -24872,6 +24901,7 @@ var OpfsFs = class {
24872
24901
  await run2;
24873
24902
  }
24874
24903
  renameAcks = 0;
24904
+ warnedLegacy = false;
24875
24905
  ackBusy = 0;
24876
24906
  ackMs = [];
24877
24907
  ownLocks = /* @__PURE__ */ new Set();
@@ -29178,7 +29208,9 @@ var Launcher = class {
29178
29208
  ];
29179
29209
  if (after.exeId === void 0) return gone;
29180
29210
  return this.reread(target, read).then(
29181
- (again) => id2().then((last) => [again, last]),
29211
+ (again) => id2().then(
29212
+ (last) => [again, last.exeId === after.exeId ? last : gone[1]]
29213
+ ),
29182
29214
  () => gone
29183
29215
  );
29184
29216
  }
@@ -29196,8 +29228,13 @@ var Launcher = class {
29196
29228
  if (target.abi !== "wasi" || (target.copy ?? target.glue) !== target.wasm) {
29197
29229
  return Promise.resolve({});
29198
29230
  }
29231
+ const assign = this.mounts.locate(target.wasm) === void 0 ? this.rootFs.fileId : void 0;
29199
29232
  return this.base.stat(target.wasm).then(
29200
- (st) => exeIdOf(fileIdentity(st.ino, st.mtime.getTime())),
29233
+ async (st) => {
29234
+ const fid = st.fid ?? await assign?.call(this.rootFs, target.wasm);
29235
+ if (fid === void 0) return exeIdOf(fileIdentity(st.ino, st.mtime.getTime()));
29236
+ return { exeId: `fid:${fid}:${st.mtime.getTime()}` };
29237
+ },
29201
29238
  () => ({})
29202
29239
  );
29203
29240
  }