@ai-ecoverse/slicc-kernel 1.147.10 → 1.148.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.
@@ -1129,6 +1129,7 @@ function parseSyncFsStat(json2) {
1129
1129
  ...typeof s.atimeMs === "number" ? { atimeMs: s.atimeMs } : {},
1130
1130
  ...typeof s.ctimeMs === "number" ? { ctimeMs: s.ctimeMs } : {},
1131
1131
  ...typeof s.ino === "number" ? { ino: s.ino } : {},
1132
+ ...typeof s.fid === "string" ? { fid: s.fid } : {},
1132
1133
  ...typeof s.nlink === "number" ? { nlink: s.nlink } : {},
1133
1134
  ...typeof s.dev === "number" ? { dev: s.dev } : {},
1134
1135
  ...s.readonly === true ? { readonly: true } : {},
@@ -2963,7 +2964,7 @@ var KERNEL_VERSION, OS_RELEASE;
2963
2964
  var init_version = __esm({
2964
2965
  "src/version.ts"() {
2965
2966
  "use strict";
2966
- KERNEL_VERSION = true ? "1.147.10" : "0.0.0-dev";
2967
+ KERNEL_VERSION = true ? "1.148.0" : "0.0.0-dev";
2967
2968
  OS_RELEASE = "6.0.0-slicc";
2968
2969
  }
2969
2970
  });
@@ -8088,6 +8089,22 @@ var init_js_kernel = __esm({
8088
8089
  });
8089
8090
 
8090
8091
  // src/process/js/js-io.ts
8092
+ function readingInto(read2) {
8093
+ return (position, into, offset = 0, length = into.length - offset) => {
8094
+ const target = intoTarget(into, offset, length);
8095
+ const chunk = read2(position, length);
8096
+ target.into.set(chunk, target.at);
8097
+ return chunk.length;
8098
+ };
8099
+ }
8100
+ function readingIntoAsync(read2) {
8101
+ return async (position, into, offset = 0, length = into.length - offset) => {
8102
+ const target = intoTarget(into, offset, length);
8103
+ const chunk = await read2(position, length);
8104
+ target.into.set(chunk, target.at);
8105
+ return chunk.length;
8106
+ };
8107
+ }
8091
8108
  function intoTarget(into, offset, length) {
8092
8109
  if (!into) return void 0;
8093
8110
  if (!Number.isSafeInteger(offset) || offset < 0 || offset + length > into.length)
@@ -8447,6 +8464,13 @@ function allowed(may, what) {
8447
8464
  }
8448
8465
  function streamFile(fd, path, io, access) {
8449
8466
  const { live, end } = liveness(path);
8467
+ const readAsync = async (position, length) => {
8468
+ index2(position, "read");
8469
+ index2(length, "read");
8470
+ live();
8471
+ allowed(access.read, "read");
8472
+ return length === 0 ? new Uint8Array(0) : io.read(fd, Math.min(length, MAX_IO));
8473
+ };
8450
8474
  const file = {
8451
8475
  fd,
8452
8476
  path,
@@ -8454,13 +8478,8 @@ function streamFile(fd, path, io, access) {
8454
8478
  live();
8455
8479
  return 0;
8456
8480
  },
8457
- async read(position, length) {
8458
- index2(position, "read");
8459
- index2(length, "read");
8460
- live();
8461
- allowed(access.read, "read");
8462
- return length === 0 ? new Uint8Array(0) : io.read(fd, Math.min(length, MAX_IO));
8463
- },
8481
+ read: (position, length) => readAsync(position, length),
8482
+ readInto: readingIntoAsync((position, length) => readAsync(position, length)),
8464
8483
  async write(position, data) {
8465
8484
  index2(position, "write");
8466
8485
  live();
@@ -8484,6 +8503,13 @@ function streamFile(fd, path, io, access) {
8484
8503
  }
8485
8504
  function streamSyncFile(fd, path, io, access) {
8486
8505
  const { live, end } = liveness(path);
8506
+ const readSync = (position, length) => {
8507
+ index2(position, "read");
8508
+ index2(length, "read");
8509
+ live();
8510
+ allowed(access.read, "read");
8511
+ return length === 0 ? new Uint8Array(0) : io.read(fd, Math.min(length, MAX_IO));
8512
+ };
8487
8513
  const file = {
8488
8514
  fd,
8489
8515
  path,
@@ -8491,13 +8517,8 @@ function streamSyncFile(fd, path, io, access) {
8491
8517
  live();
8492
8518
  return 0;
8493
8519
  },
8494
- read(position, length) {
8495
- index2(position, "read");
8496
- index2(length, "read");
8497
- live();
8498
- allowed(access.read, "read");
8499
- return length === 0 ? new Uint8Array(0) : io.read(fd, Math.min(length, MAX_IO));
8500
- },
8520
+ read: (position, length) => readSync(position, length),
8521
+ readInto: readingInto((position, length) => readSync(position, length)),
8501
8522
  write(position, data) {
8502
8523
  index2(position, "write");
8503
8524
  live();
@@ -12739,6 +12760,7 @@ function same(fs, path, id) {
12739
12760
  if (GONE2.has(err?.code ?? "")) return false;
12740
12761
  throw err;
12741
12762
  }
12763
+ if (id.startsWith("fid:")) return st.fid !== void 0 && id.startsWith(`fid:${st.fid}:`);
12742
12764
  const now = fileIdentity(st.ino, st.mtimeMs);
12743
12765
  return now === void 0 || now === id;
12744
12766
  }
@@ -16879,6 +16901,12 @@ function snapshotFile(path, bytes) {
16879
16901
  const live = () => {
16880
16902
  if (closed) throw new JsCallError("EBADF", path);
16881
16903
  };
16904
+ const read2 = (position, length) => {
16905
+ live();
16906
+ index2(position, "read");
16907
+ index2(length, "read");
16908
+ return bytes.slice(position, position + length);
16909
+ };
16882
16910
  return {
16883
16911
  fd: -1,
16884
16912
  path,
@@ -16886,12 +16914,8 @@ function snapshotFile(path, bytes) {
16886
16914
  live();
16887
16915
  return bytes.length;
16888
16916
  },
16889
- read: (position, length) => {
16890
- live();
16891
- index2(position, "read");
16892
- index2(length, "read");
16893
- return bytes.slice(position, position + length);
16894
- },
16917
+ read: read2,
16918
+ readInto: readingInto(read2),
16895
16919
  write: () => {
16896
16920
  throw new JsCallError("EBADF", path);
16897
16921
  },
@@ -18210,6 +18234,10 @@ async function fifoOpen(kernel, abs, options, io) {
18210
18234
  seekless(position, "read");
18211
18235
  return io.read(fd, length);
18212
18236
  },
18237
+ readInto: readingIntoAsync(async (position, length) => {
18238
+ seekless(position, "read");
18239
+ return io.read(fd, length);
18240
+ }),
18213
18241
  async write(position, data) {
18214
18242
  seekless(position, "write");
18215
18243
  await io.write(fd, data);