@ai-ecoverse/slicc-kernel 1.167.1 → 1.167.2

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