@ai-ecoverse/slicc-kernel 1.120.1 → 1.120.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.
package/dist/node.js CHANGED
@@ -3998,6 +3998,14 @@ var RemoteWatch = class {
3998
3998
  met;
3999
3999
  settled = false;
4000
4000
  quiet;
4001
+ crowd;
4002
+ told;
4003
+ recount() {
4004
+ const now = this.crowded();
4005
+ if (now === this.told) return;
4006
+ this.told = now;
4007
+ this.crowd?.(now);
4008
+ }
4001
4009
  constructor(name2, options = {}) {
4002
4010
  this.name = name2;
4003
4011
  this.locks = options.locks === void 0 ? lockManager() : options.locks ?? void 0;
@@ -4014,6 +4022,7 @@ var RemoteWatch = class {
4014
4022
  });
4015
4023
  this.joined = granted2.then(() => this.join()).then(() => {
4016
4024
  this.settled = true;
4025
+ this.recount();
4017
4026
  });
4018
4027
  this.channel.postMessage({ hello: this.tab });
4019
4028
  }
@@ -4046,6 +4055,7 @@ var RemoteWatch = class {
4046
4055
  if (data.hello !== void 0) this.greeted(data.hello);
4047
4056
  if (data.here !== void 0 && data.to === this.tab) {
4048
4057
  this.peers.add(data.here);
4058
+ this.recount();
4049
4059
  this.met?.();
4050
4060
  }
4051
4061
  if (data.tab !== void 0 && data.paths !== void 0) this.announced(data);
@@ -4056,6 +4066,7 @@ var RemoteWatch = class {
4056
4066
  }
4057
4067
  greeted(peer) {
4058
4068
  this.peers.add(peer);
4069
+ this.recount();
4059
4070
  const answer = () => {
4060
4071
  this.channel.postMessage({ here: this.tab, to: peer });
4061
4072
  if (this.mine.length > 0) void this.announce(this.mine);
@@ -4066,6 +4077,7 @@ var RemoteWatch = class {
4066
4077
  announced({ tab, paths, seq: seq2 }) {
4067
4078
  const from = tab;
4068
4079
  this.peers.add(from);
4080
+ this.recount();
4069
4081
  if (paths.length > 0) this.others.set(from, paths);
4070
4082
  else this.others.delete(from);
4071
4083
  this.rebuild();
@@ -4091,6 +4103,7 @@ var RemoteWatch = class {
4091
4103
  }
4092
4104
  }
4093
4105
  this.rebuild();
4106
+ this.recount();
4094
4107
  }
4095
4108
  watched() {
4096
4109
  return this.union.size > 0;
@@ -4481,7 +4494,14 @@ var OpfsFs = class {
4481
4494
  peers() {
4482
4495
  const remote = this.remote;
4483
4496
  if (!remote) return void 0;
4484
- return { joined: () => remote.peered(), crowded: () => remote.crowded() };
4497
+ return {
4498
+ joined: () => remote.peered(),
4499
+ crowded: () => remote.crowded(),
4500
+ watch: (listener) => {
4501
+ remote.crowd = listener;
4502
+ listener(remote.crowded());
4503
+ }
4504
+ };
4485
4505
  }
4486
4506
  quiet() {
4487
4507
  if (this.unlocked === 0) return Promise.resolve();
@@ -6756,7 +6776,7 @@ function satisfies(version, range2) {
6756
6776
  }
6757
6777
 
6758
6778
  // src/version.ts
6759
- var KERNEL_VERSION = true ? "1.120.1" : "0.0.0-dev";
6779
+ var KERNEL_VERSION = true ? "1.120.2" : "0.0.0-dev";
6760
6780
  var OS_RELEASE = "6.0.0-slicc";
6761
6781
  function procVersion() {
6762
6782
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -8759,7 +8779,8 @@ var RING = 1;
8759
8779
  var RING_SIZE = 4096;
8760
8780
  var SLOT = 2;
8761
8781
  var DIRTY = RING + RING_SIZE * SLOT;
8762
- var CHANGES_BYTES = (DIRTY + 1) * 4;
8782
+ var FOREIGN = DIRTY + 1;
8783
+ var CHANGES_BYTES = (FOREIGN + 1) * 4;
8763
8784
  function changeHash(path) {
8764
8785
  let h = 2166136261;
8765
8786
  for (let i = 0; i < path.length; i++) {
@@ -8787,6 +8808,9 @@ var FileChanges = class {
8787
8808
  dirtied(delta) {
8788
8809
  Atomics.add(this.view, DIRTY, delta);
8789
8810
  }
8811
+ foreign(on) {
8812
+ Atomics.store(this.view, FOREIGN, on ? 1 : 0);
8813
+ }
8790
8814
  publish(...paths) {
8791
8815
  for (const path of paths) {
8792
8816
  const g = Atomics.add(this.view, GEN, 1) + 1 | 0;
@@ -23562,7 +23586,9 @@ var Launcher = class {
23562
23586
  constructor(options) {
23563
23587
  this.usersMode = usersMode(options.users);
23564
23588
  this.rootFs = options.fs;
23565
- this.locks = kernelLocks(options.fs.rootName, options.fs.peers?.());
23589
+ const peers = options.fs.peers?.();
23590
+ this.locks = kernelLocks(options.fs.rootName, peers);
23591
+ peers?.watch((crowded) => this.changes.foreign(crowded));
23566
23592
  this.dac = this.usersMode === "off" ? void 0 : new Dac(this.usersMode, options.onDenial);
23567
23593
  if (this.dac) this.dac.tagOf = (pid) => this.tagOf(pid);
23568
23594
  this.clipboard = new ClipboardBroker(