@ai-ecoverse/slicc-kernel 1.120.1 → 1.121.0

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.
@@ -874,6 +874,14 @@ var RemoteWatch = class {
874
874
  met;
875
875
  settled = false;
876
876
  quiet;
877
+ crowd;
878
+ told;
879
+ recount() {
880
+ const now = this.crowded();
881
+ if (now === this.told) return;
882
+ this.told = now;
883
+ this.crowd?.(now);
884
+ }
877
885
  constructor(name2, options = {}) {
878
886
  this.name = name2;
879
887
  this.locks = options.locks === void 0 ? lockManager() : options.locks ?? void 0;
@@ -890,6 +898,7 @@ var RemoteWatch = class {
890
898
  });
891
899
  this.joined = granted2.then(() => this.join()).then(() => {
892
900
  this.settled = true;
901
+ this.recount();
893
902
  });
894
903
  this.channel.postMessage({ hello: this.tab });
895
904
  }
@@ -922,6 +931,7 @@ var RemoteWatch = class {
922
931
  if (data.hello !== void 0) this.greeted(data.hello);
923
932
  if (data.here !== void 0 && data.to === this.tab) {
924
933
  this.peers.add(data.here);
934
+ this.recount();
925
935
  this.met?.();
926
936
  }
927
937
  if (data.tab !== void 0 && data.paths !== void 0) this.announced(data);
@@ -932,6 +942,7 @@ var RemoteWatch = class {
932
942
  }
933
943
  greeted(peer) {
934
944
  this.peers.add(peer);
945
+ this.recount();
935
946
  const answer = () => {
936
947
  this.channel.postMessage({ here: this.tab, to: peer });
937
948
  if (this.mine.length > 0) void this.announce(this.mine);
@@ -942,6 +953,7 @@ var RemoteWatch = class {
942
953
  announced({ tab, paths, seq: seq2 }) {
943
954
  const from = tab;
944
955
  this.peers.add(from);
956
+ this.recount();
945
957
  if (paths.length > 0) this.others.set(from, paths);
946
958
  else this.others.delete(from);
947
959
  this.rebuild();
@@ -967,6 +979,7 @@ var RemoteWatch = class {
967
979
  }
968
980
  }
969
981
  this.rebuild();
982
+ this.recount();
970
983
  }
971
984
  watched() {
972
985
  return this.union.size > 0;
@@ -1361,7 +1374,14 @@ var OpfsFs = class {
1361
1374
  peers() {
1362
1375
  const remote = this.remote;
1363
1376
  if (!remote) return void 0;
1364
- return { joined: () => remote.peered(), crowded: () => remote.crowded() };
1377
+ return {
1378
+ joined: () => remote.peered(),
1379
+ crowded: () => remote.crowded(),
1380
+ watch: (listener) => {
1381
+ remote.crowd = listener;
1382
+ listener(remote.crowded());
1383
+ }
1384
+ };
1365
1385
  }
1366
1386
  quiet() {
1367
1387
  if (this.unlocked === 0) return Promise.resolve();
@@ -6385,7 +6405,7 @@ function satisfies(version, range2) {
6385
6405
  }
6386
6406
 
6387
6407
  // src/version.ts
6388
- var KERNEL_VERSION = true ? "1.120.1" : "0.0.0-dev";
6408
+ var KERNEL_VERSION = true ? "1.121.0" : "0.0.0-dev";
6389
6409
  var OS_RELEASE = "6.0.0-slicc";
6390
6410
  function procVersion() {
6391
6411
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -8663,7 +8683,8 @@ var RING = 1;
8663
8683
  var RING_SIZE = 4096;
8664
8684
  var SLOT = 2;
8665
8685
  var DIRTY = RING + RING_SIZE * SLOT;
8666
- var CHANGES_BYTES = (DIRTY + 1) * 4;
8686
+ var FOREIGN = DIRTY + 1;
8687
+ var CHANGES_BYTES = (FOREIGN + 1) * 4;
8667
8688
  function changeHash(path) {
8668
8689
  let h = 2166136261;
8669
8690
  for (let i = 0; i < path.length; i++) {
@@ -8691,6 +8712,9 @@ var FileChanges = class {
8691
8712
  dirtied(delta) {
8692
8713
  Atomics.add(this.view, DIRTY, delta);
8693
8714
  }
8715
+ foreign(on) {
8716
+ Atomics.store(this.view, FOREIGN, on ? 1 : 0);
8717
+ }
8694
8718
  publish(...paths) {
8695
8719
  for (const path of paths) {
8696
8720
  const g = Atomics.add(this.view, GEN, 1) + 1 | 0;
@@ -23556,7 +23580,9 @@ var Launcher = class {
23556
23580
  constructor(options) {
23557
23581
  this.usersMode = usersMode(options.users);
23558
23582
  this.rootFs = options.fs;
23559
- this.locks = kernelLocks(options.fs.rootName, options.fs.peers?.());
23583
+ const peers = options.fs.peers?.();
23584
+ this.locks = kernelLocks(options.fs.rootName, peers);
23585
+ peers?.watch((crowded) => this.changes.foreign(crowded));
23560
23586
  this.dac = this.usersMode === "off" ? void 0 : new Dac(this.usersMode, options.onDenial);
23561
23587
  if (this.dac) this.dac.tagOf = (pid) => this.tagOf(pid);
23562
23588
  this.clipboard = new ClipboardBroker(