@ai-ecoverse/slicc-kernel 1.167.1 → 1.167.3

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.
@@ -1138,6 +1138,7 @@ function cachingBridge(bridge, now = () => capturedperformance.now(), shared) {
1138
1138
  utimes: (p, a, m, now2) => relabeling(p, () => bridge.utimes(p, a, m, now2)),
1139
1139
  lutimes: (p, a, m, now2) => mutating(() => bridge.lutimes(p, a, m, now2)),
1140
1140
  ...bridge.hold ? { hold: bridge.hold.bind(bridge) } : {},
1141
+ ...bridge.heldReal ? { heldReal: bridge.heldReal.bind(bridge) } : {},
1141
1142
  ...bridge.access ? { access: bridge.access.bind(bridge) } : {},
1142
1143
  ...bridge.kept ? { kept: bridge.kept.bind(bridge) } : {},
1143
1144
  ...bridge.keptStat ? { keptStat: bridge.keptStat.bind(bridge) } : {},
@@ -1218,6 +1219,7 @@ var init_wasi_files = __esm({
1218
1219
  handle;
1219
1220
  moved;
1220
1221
  bound;
1222
+ real;
1221
1223
  constructor(fs, path, empty, maxFile, size, version, watch) {
1222
1224
  this.fs = fs;
1223
1225
  this.where = path;
@@ -1293,13 +1295,21 @@ var init_wasi_files = __esm({
1293
1295
  live() {
1294
1296
  if (this.spoiled) throw new WasiError("ESTALE");
1295
1297
  }
1298
+ peered = false;
1299
+ held() {
1300
+ const view = this.watch?.view;
1301
+ if (!view) return false;
1302
+ return view.peerHeld(this.where) || this.real !== void 0 && view.peerHeld(this.real);
1303
+ }
1296
1304
  crowded() {
1297
- return this.watch?.view.peerHeld(this.where) === true;
1305
+ if (this.held()) this.peered = true;
1306
+ return this.peered;
1298
1307
  }
1299
1308
  exact() {
1300
1309
  this.flush();
1301
1310
  const watch = this.watch;
1302
1311
  const size = this.retried(() => watch.stat(this.where)).size;
1312
+ this.peered = this.held();
1303
1313
  if (this.ranged) {
1304
1314
  if (size !== this.ranged.size()) this.ranged.reread();
1305
1315
  return void 0;
@@ -2283,6 +2293,24 @@ function errnoError(code2, path, direct) {
2283
2293
  function holdSeen(seen2) {
2284
2294
  return { gen: seen2.gen, ino: seen2.ino, ...seen2.nofollow ? { nofollow: true } : {} };
2285
2295
  }
2296
+ function holds(json2, run) {
2297
+ const reals = new capturedMap();
2298
+ return {
2299
+ hold: (path, held2, open, handle, want = 0, seen2 = {}) => {
2300
+ const mode = (held2 ? 1 : 0) | (open ? 2 : 0);
2301
+ if (mode === 3) {
2302
+ const reply = json2({ op: "hold", path, mode: mode | want, ...holdSeen(seen2) }, path);
2303
+ if (typeof reply !== "object" || reply === null) return reply;
2304
+ reals.set(reply.handle, reply.real);
2305
+ return reply.handle;
2306
+ }
2307
+ if (handle !== void 0) reals.delete(handle);
2308
+ run({ op: "hold", path, mode, ...handle !== void 0 ? { handle } : {} }, path);
2309
+ return void 0;
2310
+ },
2311
+ heldReal: (handle) => reals.get(handle)
2312
+ };
2313
+ }
2286
2314
  function createSyncFsSabBridge(transport, opts = {}) {
2287
2315
  const direct = opts.direct ? { direct: true } : {};
2288
2316
  const timeoutMs2 = opts.timeoutMs ?? SYNC_FS_REQUEST_TIMEOUT_MS;
@@ -2452,14 +2480,7 @@ function createSyncFsSabBridge(transport, opts = {}) {
2452
2480
  access: (path, mode, kind = "access", nofollow) => {
2453
2481
  run({ op: "access", path, mode, arg2: kind, ...nofollow ? { nofollow } : {} }, path);
2454
2482
  },
2455
- hold: (path, held2, open, handle, want = 0, seen2 = {}) => {
2456
- const mode = (held2 ? 1 : 0) | (open ? 2 : 0);
2457
- if (mode === 3) {
2458
- return json2({ op: "hold", path, mode: mode | want, ...holdSeen(seen2) }, path);
2459
- }
2460
- run({ op: "hold", path, mode, ...handle !== void 0 ? { handle } : {} }, path);
2461
- return void 0;
2462
- },
2483
+ ...holds(json2, run),
2463
2484
  statfs: (path = "/") => parseSyncFsUsage(json2({ op: "statfs", path }, path)),
2464
2485
  renames: (since, held2) => json2(
2465
2486
  { op: "renames", path: "/", offset: since, arg2: capturedJSON.stringify(held2) },
@@ -4524,6 +4545,7 @@ var init_wasi_fds = __esm({
4524
4545
  buffer.moved = (missing2) => this.followRenames(missing2);
4525
4546
  buffer.bound = st;
4526
4547
  buffer.handle = handle;
4548
+ if (handle !== void 0) buffer.real = this.fs.heldReal?.(handle);
4527
4549
  if (st.ino !== void 0) this.inos.set(buffer, st.ino);
4528
4550
  this.buffers.set(path, buffer);
4529
4551
  const id = this.identity(st);
@@ -7489,7 +7511,7 @@ var init_version = __esm({
7489
7511
  "src/version.ts"() {
7490
7512
  "use strict";
7491
7513
  init_captured_globals();
7492
- KERNEL_VERSION = true ? "1.167.1" : "0.0.0-dev";
7514
+ KERNEL_VERSION = true ? "1.167.3" : "0.0.0-dev";
7493
7515
  OS_RELEASE = "6.0.0-slicc";
7494
7516
  }
7495
7517
  });
@@ -11779,9 +11801,9 @@ var init_procfs = __esm({
11779
11801
  `,
11780
11802
  slicc_file_ids: (listing2) => `${listing2.fileIds ?? 0}
11781
11803
  `,
11782
- slicc_peer_holds: ({ holds }) => `${holds?.mine ?? 0} ${holds?.peers ?? 0} ${holds?.sent ?? 0}
11804
+ slicc_peer_holds: ({ holds: holds2 }) => `${holds2?.mine ?? 0} ${holds2?.peers ?? 0} ${holds2?.sent ?? 0}
11783
11805
  `,
11784
- slicc_peer_held: ({ holds }) => (holds?.held ?? []).map((path) => `${path}
11806
+ slicc_peer_held: ({ holds: holds2 }) => (holds2?.held ?? []).map((path) => `${path}
11785
11807
  `).join(""),
11786
11808
  slicc_rename_acks: (listing2) => {
11787
11809
  const samples = [...listing2.renameAcks?.ackMs ?? []].sort((a, b) => a - b);