@ai-ecoverse/slicc-kernel 1.116.0 → 1.116.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
@@ -4817,13 +4817,20 @@ var OpfsFs = class {
4817
4817
  if (handle.kind === "directory") throw fsError("EISDIR", path);
4818
4818
  return handle;
4819
4819
  }
4820
+ async refuseNode(path, empty) {
4821
+ if (!empty) return;
4822
+ const [entry] = await this.meta.get([(await this.locate(path, true)).path]);
4823
+ if (entry?.fifo || entry?.socket) throw fsError("ENXIO", path);
4824
+ }
4820
4825
  async readFileBuffer(path) {
4821
4826
  const handle = await this.existing(path);
4822
- return this.retrying(
4827
+ const bytes = await this.retrying(
4823
4828
  path,
4824
4829
  async () => new Uint8Array(await (await handle.getFile()).arrayBuffer()),
4825
4830
  false
4826
4831
  );
4832
+ await this.refuseNode(path, bytes.length === 0);
4833
+ return bytes;
4827
4834
  }
4828
4835
  async readVersioned(path, cached = false) {
4829
4836
  const handle = await this.existing(path);
@@ -4833,6 +4840,7 @@ var OpfsFs = class {
4833
4840
  const stamp = await this.stamp(path, cached);
4834
4841
  const file = await handle.getFile();
4835
4842
  const bytes = new Uint8Array(await file.arrayBuffer());
4843
+ await this.refuseNode(path, bytes.length === 0);
4836
4844
  return { bytes, version: `${file.lastModified}:${file.size}:${stamp}` };
4837
4845
  },
4838
4846
  false
@@ -4854,7 +4862,11 @@ var OpfsFs = class {
4854
4862
  const handle = await this.existing(path);
4855
4863
  return this.retrying(
4856
4864
  path,
4857
- async () => new Uint8Array(await (await handle.getFile()).slice(offset, offset + length2).arrayBuffer()),
4865
+ async () => {
4866
+ const file = await handle.getFile();
4867
+ await this.refuseNode(path, file.size === 0);
4868
+ return new Uint8Array(await file.slice(offset, offset + length2).arrayBuffer());
4869
+ },
4858
4870
  false
4859
4871
  );
4860
4872
  }
@@ -4870,6 +4882,7 @@ var OpfsFs = class {
4870
4882
  }
4871
4883
  async truncate(path, size) {
4872
4884
  const handle = await this.existing(path, true);
4885
+ await this.refuseNode(path, (await handle.getFile()).size === 0);
4873
4886
  const resolve2 = this.ranged || this.remote?.watched();
4874
4887
  const target = resolve2 || this.counted.length > 0 ? (await this.locate(path, true)).path : path;
4875
4888
  await this.counting(target);
@@ -4922,6 +4935,10 @@ var OpfsFs = class {
4922
4935
  }
4923
4936
  async fileFor(path) {
4924
4937
  const [target, existed] = await this.writeTarget(path);
4938
+ if (existed) {
4939
+ const [entry] = await this.meta.get([target]);
4940
+ if (entry?.fifo || entry?.socket) throw fsError("ENXIO", path);
4941
+ }
4925
4942
  const [dir, name2] = await this.parent(target);
4926
4943
  try {
4927
4944
  const handle = await this.inDir(
@@ -6559,7 +6576,7 @@ function satisfies(version, range2) {
6559
6576
  }
6560
6577
 
6561
6578
  // src/version.ts
6562
- var KERNEL_VERSION = true ? "1.116.0" : "0.0.0-dev";
6579
+ var KERNEL_VERSION = true ? "1.116.2" : "0.0.0-dev";
6563
6580
  var OS_RELEASE = "6.0.0-slicc";
6564
6581
  function procVersion() {
6565
6582
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -7207,7 +7224,25 @@ function missedFires(schedule, from, until, utc = false, cap = MISSED_CAP) {
7207
7224
  count2++;
7208
7225
  }
7209
7226
  const next3 = nextFire(schedule, last, utc);
7210
- return { count: count2, last, more: next3 !== null && next3 <= until };
7227
+ if (next3 === null || next3 > until) return { count: count2, last, more: false };
7228
+ return { count: count2, last: latestFire(schedule, last, until, utc), more: true };
7229
+ }
7230
+ function latestFire(schedule, from, until, utc = false) {
7231
+ let found = from;
7232
+ for (let span = 6e4; ; span *= 2) {
7233
+ const start2 = Math.max(from, until - span);
7234
+ const first = nextFire(schedule, start2, utc);
7235
+ if (first !== null && first <= until) {
7236
+ found = first;
7237
+ break;
7238
+ }
7239
+ if (start2 === from) return from;
7240
+ }
7241
+ for (let at = nextFire(schedule, found, utc); at !== null && at <= until; ) {
7242
+ found = at;
7243
+ at = nextFire(schedule, at, utc);
7244
+ }
7245
+ return found;
7211
7246
  }
7212
7247
 
7213
7248
  // src/cron/table.ts