@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.
@@ -1071,6 +1071,9 @@ var RemoteWatch = class {
1071
1071
  await new Promise((resolve2) => setTimeout(resolve2, ANNOUNCE_POLL_MS));
1072
1072
  }
1073
1073
  }
1074
+ legacy() {
1075
+ return [...this.peers].filter((peer) => !this.ackers.has(peer));
1076
+ }
1074
1077
  crowded() {
1075
1078
  return !this.settled || this.peers.size > 0;
1076
1079
  }
@@ -1078,7 +1081,7 @@ var RemoteWatch = class {
1078
1081
  return `${this.name}:${tab}`;
1079
1082
  }
1080
1083
  receive(data) {
1081
- const sender = data.hello ?? data.here;
1084
+ const sender = data.hello ?? data.here ?? (data.paths !== void 0 ? data.tab : void 0);
1082
1085
  if (sender !== void 0 && data.renames) this.ackers.add(sender);
1083
1086
  if (data.hello !== void 0) this.greeted(data.hello);
1084
1087
  if (data.renaming !== void 0 && data.tab !== void 0) this.heard(data);
@@ -1185,7 +1188,7 @@ var RemoteWatch = class {
1185
1188
  announce(paths) {
1186
1189
  this.mine = [...paths];
1187
1190
  const seq2 = ++this.seq;
1188
- this.channel.postMessage({ tab: this.tab, paths: this.mine, seq: seq2 });
1191
+ this.channel.postMessage({ tab: this.tab, paths: this.mine, seq: seq2, renames: true });
1189
1192
  return this.acks(seq2, this.peers);
1190
1193
  }
1191
1194
  renamingTree(rename, cap = RENAME_ACK_MAX_MS) {
@@ -1564,6 +1567,19 @@ var OpfsFs = class {
1564
1567
  for (const path of paths) this.forget(path);
1565
1568
  this.channel?.postMessage(paths);
1566
1569
  }
1570
+ async fileId(path) {
1571
+ const found = await this.locate(path, true);
1572
+ const [entry] = await this.meta.get([found.path]);
1573
+ if (entry?.fid !== void 0) return entry.fid;
1574
+ const fid = crypto.randomUUID();
1575
+ await this.meta.update(found.path, (now) => ({
1576
+ ...occupied(now),
1577
+ path: found.path,
1578
+ fid: now?.fid ?? fid
1579
+ }));
1580
+ const [stored] = await this.meta.get([found.path]);
1581
+ return stored?.fid ?? fid;
1582
+ }
1567
1583
  heldUnder = () => [];
1568
1584
  heldBy(held) {
1569
1585
  this.heldUnder = held;
@@ -2161,6 +2177,7 @@ var OpfsFs = class {
2161
2177
  atime: new Date(meta?.atimeMs ?? mtime),
2162
2178
  ctime: new Date(Math.max(touched ?? meta?.ctimeMs ?? mtime, modified)),
2163
2179
  ino: meta?.ino ?? inodeOf(path),
2180
+ ...meta?.fid !== void 0 ? { fid: meta.fid } : {},
2164
2181
  ...this.ranged && !directory ? { ranged: true } : {}
2165
2182
  };
2166
2183
  }
@@ -2798,6 +2815,17 @@ var OpfsFs = class {
2798
2815
  }
2799
2816
  async admitted(locks, lock, from, to, place, hooks) {
2800
2817
  const remote = this.remote;
2818
+ const older = remote?.legacy() ?? [];
2819
+ if (older.length > 0) {
2820
+ this.ackBusy++;
2821
+ if (!this.warnedLegacy) {
2822
+ this.warnedLegacy = true;
2823
+ console.warn(
2824
+ `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)`
2825
+ );
2826
+ }
2827
+ throw fsError("EBUSY", from);
2828
+ }
2801
2829
  if (remote && !this.shared() && !await remote.joinedAll(RENAME_ACK_MAX_MS)) {
2802
2830
  this.ackBusy++;
2803
2831
  console.warn(
@@ -2848,6 +2876,7 @@ var OpfsFs = class {
2848
2876
  await run2;
2849
2877
  }
2850
2878
  renameAcks = 0;
2879
+ warnedLegacy = false;
2851
2880
  ackBusy = 0;
2852
2881
  ackMs = [];
2853
2882
  ownLocks = /* @__PURE__ */ new Set();
@@ -7826,7 +7855,7 @@ function satisfies(version, range2) {
7826
7855
  }
7827
7856
 
7828
7857
  // src/version.ts
7829
- var KERNEL_VERSION = true ? "1.147.10" : "0.0.0-dev";
7858
+ var KERNEL_VERSION = true ? "1.148.1" : "0.0.0-dev";
7830
7859
  var OS_RELEASE = "6.0.0-slicc";
7831
7860
  function procVersion() {
7832
7861
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -13429,6 +13458,7 @@ function statJson(s) {
13429
13458
  atimeMs: s.atime.getTime(),
13430
13459
  ctimeMs: s.ctime.getTime(),
13431
13460
  ino: s.ino,
13461
+ ...s.fid !== void 0 ? { fid: s.fid } : {},
13432
13462
  ...s.nlink !== void 0 ? { nlink: s.nlink } : {},
13433
13463
  ...s.dev !== void 0 ? { dev: s.dev } : {},
13434
13464
  ...s.readonly ? { readonly: true } : {},
@@ -30161,7 +30191,9 @@ var Launcher = class {
30161
30191
  ];
30162
30192
  if (after.exeId === void 0) return gone;
30163
30193
  return this.reread(target, read).then(
30164
- (again) => id2().then((last) => [again, last]),
30194
+ (again) => id2().then(
30195
+ (last) => [again, last.exeId === after.exeId ? last : gone[1]]
30196
+ ),
30165
30197
  () => gone
30166
30198
  );
30167
30199
  }
@@ -30179,8 +30211,13 @@ var Launcher = class {
30179
30211
  if (target.abi !== "wasi" || (target.copy ?? target.glue) !== target.wasm) {
30180
30212
  return Promise.resolve({});
30181
30213
  }
30214
+ const assign = this.mounts.locate(target.wasm) === void 0 ? this.rootFs.fileId : void 0;
30182
30215
  return this.base.stat(target.wasm).then(
30183
- (st) => exeIdOf(fileIdentity(st.ino, st.mtime.getTime())),
30216
+ async (st) => {
30217
+ const fid = st.fid ?? await assign?.call(this.rootFs, target.wasm);
30218
+ if (fid === void 0) return exeIdOf(fileIdentity(st.ino, st.mtime.getTime()));
30219
+ return { exeId: `fid:${fid}:${st.mtime.getTime()}` };
30220
+ },
30184
30221
  () => ({})
30185
30222
  );
30186
30223
  }