@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.
@@ -1441,6 +1441,24 @@ function errnoError(code2, path, direct) {
1441
1441
  function holdSeen(seen) {
1442
1442
  return { gen: seen.gen, ino: seen.ino, ...seen.nofollow ? { nofollow: true } : {} };
1443
1443
  }
1444
+ function holds(json2, run) {
1445
+ const reals = new capturedMap();
1446
+ return {
1447
+ hold: (path, held2, open, handle, want = 0, seen = {}) => {
1448
+ const mode = (held2 ? 1 : 0) | (open ? 2 : 0);
1449
+ if (mode === 3) {
1450
+ const reply = json2({ op: "hold", path, mode: mode | want, ...holdSeen(seen) }, path);
1451
+ if (typeof reply !== "object" || reply === null) return reply;
1452
+ reals.set(reply.handle, reply.real);
1453
+ return reply.handle;
1454
+ }
1455
+ if (handle !== void 0) reals.delete(handle);
1456
+ run({ op: "hold", path, mode, ...handle !== void 0 ? { handle } : {} }, path);
1457
+ return void 0;
1458
+ },
1459
+ heldReal: (handle) => reals.get(handle)
1460
+ };
1461
+ }
1444
1462
  function createSyncFsSabBridge(transport, opts = {}) {
1445
1463
  const direct = opts.direct ? { direct: true } : {};
1446
1464
  const timeoutMs2 = opts.timeoutMs ?? SYNC_FS_REQUEST_TIMEOUT_MS;
@@ -1610,14 +1628,7 @@ function createSyncFsSabBridge(transport, opts = {}) {
1610
1628
  access: (path, mode, kind = "access", nofollow) => {
1611
1629
  run({ op: "access", path, mode, arg2: kind, ...nofollow ? { nofollow } : {} }, path);
1612
1630
  },
1613
- hold: (path, held2, open, handle, want = 0, seen = {}) => {
1614
- const mode = (held2 ? 1 : 0) | (open ? 2 : 0);
1615
- if (mode === 3) {
1616
- return json2({ op: "hold", path, mode: mode | want, ...holdSeen(seen) }, path);
1617
- }
1618
- run({ op: "hold", path, mode, ...handle !== void 0 ? { handle } : {} }, path);
1619
- return void 0;
1620
- },
1631
+ ...holds(json2, run),
1621
1632
  statfs: (path = "/") => parseSyncFsUsage(json2({ op: "statfs", path }, path)),
1622
1633
  renames: (since, held2) => json2(
1623
1634
  { op: "renames", path: "/", offset: since, arg2: capturedJSON.stringify(held2) },
@@ -3106,7 +3117,7 @@ var init_version = __esm({
3106
3117
  "src/version.ts"() {
3107
3118
  "use strict";
3108
3119
  init_captured_globals();
3109
- KERNEL_VERSION = true ? "1.167.1" : "0.0.0-dev";
3120
+ KERNEL_VERSION = true ? "1.167.2" : "0.0.0-dev";
3110
3121
  OS_RELEASE = "6.0.0-slicc";
3111
3122
  }
3112
3123
  });
@@ -6280,9 +6291,9 @@ var init_procfs = __esm({
6280
6291
  `,
6281
6292
  slicc_file_ids: (listing2) => `${listing2.fileIds ?? 0}
6282
6293
  `,
6283
- slicc_peer_holds: ({ holds }) => `${holds?.mine ?? 0} ${holds?.peers ?? 0} ${holds?.sent ?? 0}
6294
+ slicc_peer_holds: ({ holds: holds2 }) => `${holds2?.mine ?? 0} ${holds2?.peers ?? 0} ${holds2?.sent ?? 0}
6284
6295
  `,
6285
- slicc_peer_held: ({ holds }) => (holds?.held ?? []).map((path) => `${path}
6296
+ slicc_peer_held: ({ holds: holds2 }) => (holds2?.held ?? []).map((path) => `${path}
6286
6297
  `).join(""),
6287
6298
  slicc_rename_acks: (listing2) => {
6288
6299
  const samples = [...listing2.renameAcks?.ackMs ?? []].sort((a, b) => a - b);
@@ -7486,6 +7497,7 @@ function cachingBridge(bridge, now = () => capturedperformance.now(), shared) {
7486
7497
  utimes: (p, a, m, now2) => relabeling(p, () => bridge.utimes(p, a, m, now2)),
7487
7498
  lutimes: (p, a, m, now2) => mutating(() => bridge.lutimes(p, a, m, now2)),
7488
7499
  ...bridge.hold ? { hold: bridge.hold.bind(bridge) } : {},
7500
+ ...bridge.heldReal ? { heldReal: bridge.heldReal.bind(bridge) } : {},
7489
7501
  ...bridge.access ? { access: bridge.access.bind(bridge) } : {},
7490
7502
  ...bridge.kept ? { kept: bridge.kept.bind(bridge) } : {},
7491
7503
  ...bridge.keptStat ? { keptStat: bridge.keptStat.bind(bridge) } : {},
@@ -7566,6 +7578,7 @@ var init_wasi_files = __esm({
7566
7578
  handle;
7567
7579
  moved;
7568
7580
  bound;
7581
+ real;
7569
7582
  constructor(fs, path, empty, maxFile, size, version, watch) {
7570
7583
  this.fs = fs;
7571
7584
  this.where = path;
@@ -7641,13 +7654,21 @@ var init_wasi_files = __esm({
7641
7654
  live() {
7642
7655
  if (this.spoiled) throw new WasiError("ESTALE");
7643
7656
  }
7657
+ peered = false;
7658
+ held() {
7659
+ const view = this.watch?.view;
7660
+ if (!view) return false;
7661
+ return view.peerHeld(this.where) || this.real !== void 0 && view.peerHeld(this.real);
7662
+ }
7644
7663
  crowded() {
7645
- return this.watch?.view.peerHeld(this.where) === true;
7664
+ if (this.held()) this.peered = true;
7665
+ return this.peered;
7646
7666
  }
7647
7667
  exact() {
7648
7668
  this.flush();
7649
7669
  const watch = this.watch;
7650
7670
  const size = this.retried(() => watch.stat(this.where)).size;
7671
+ this.peered = this.held();
7651
7672
  if (this.ranged) {
7652
7673
  if (size !== this.ranged.size()) this.ranged.reread();
7653
7674
  return void 0;
@@ -10068,6 +10089,7 @@ var init_wasi_fds = __esm({
10068
10089
  buffer.moved = (missing2) => this.followRenames(missing2);
10069
10090
  buffer.bound = st;
10070
10091
  buffer.handle = handle;
10092
+ if (handle !== void 0) buffer.real = this.fs.heldReal?.(handle);
10071
10093
  if (st.ino !== void 0) this.inos.set(buffer, st.ino);
10072
10094
  this.buffers.set(path, buffer);
10073
10095
  const id = this.identity(st);