@ai-ecoverse/slicc-kernel 1.127.0 → 1.128.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.
@@ -990,6 +990,7 @@ var init_sync_fs_wire = __esm({
990
990
  "rm",
991
991
  "rename",
992
992
  "link",
993
+ "copy",
993
994
  "unlink",
994
995
  "rmdir",
995
996
  "symlink",
@@ -1322,6 +1323,9 @@ function createSyncFsSabBridge(transport, opts = {}) {
1322
1323
  mkfifo: (path, mode) => {
1323
1324
  run({ op: "mkfifo", path, mode }, path);
1324
1325
  },
1326
+ copy: (from, to, mode, exclusive) => {
1327
+ run({ op: "copy", path: from, arg2: to, mode, ...exclusive ? { exclusive } : {} }, to);
1328
+ },
1325
1329
  create: (path, mode, opening2) => {
1326
1330
  const flags = { ...mode !== void 0 ? { mode } : {}, ...opening2 ? { opening: opening2 } : {} };
1327
1331
  const r = run({ op: "create", path, ...flags, identity: true }, path);
@@ -2655,7 +2659,7 @@ var KERNEL_VERSION, OS_RELEASE;
2655
2659
  var init_version = __esm({
2656
2660
  "src/version.ts"() {
2657
2661
  "use strict";
2658
- KERNEL_VERSION = true ? "1.127.0" : "0.0.0-dev";
2662
+ KERNEL_VERSION = true ? "1.128.0" : "0.0.0-dev";
2659
2663
  OS_RELEASE = "6.0.0-slicc";
2660
2664
  }
2661
2665
  });
@@ -5744,6 +5748,8 @@ var init_procfs = __esm({
5744
5748
  slicc_fs_calls: (listing) => `${listing.fsCalls ?? 0}
5745
5749
  `,
5746
5750
  slicc_opfs_calls: (listing) => `${listing.opfsCalls ?? 0}
5751
+ `,
5752
+ slicc_opfs_ops: (listing) => `${listing.opfsOps ?? 0}
5747
5753
  `
5748
5754
  }
5749
5755
  };
@@ -6707,6 +6713,13 @@ function goneAbove(maps, live, path) {
6707
6713
  }
6708
6714
  return void 0;
6709
6715
  }
6716
+ function copying(bridge, mutating, entry) {
6717
+ const { copy: copy2 } = bridge;
6718
+ if (!copy2) return {};
6719
+ return {
6720
+ copy: (from, to, mode, exclusive) => mutating(() => copy2.call(bridge, from, to, mode, exclusive), ...entry(to))
6721
+ };
6722
+ }
6710
6723
  function cachingBridge(bridge, now = () => performance.now(), shared) {
6711
6724
  const blind = shared !== void 0 && shared.length * 4 < SHARED_IDS_BYTES;
6712
6725
  const cache = new StatCache(blind ? void 0 : shared);
@@ -6849,6 +6862,7 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
6849
6862
  ...bridge.mkfifo ? {
6850
6863
  mkfifo: (p, mode) => mutating(() => bridge.mkfifo?.(p, mode), ...entry(p))
6851
6864
  } : {},
6865
+ ...copying(bridge, mutating, entry),
6852
6866
  ...chown ? {
6853
6867
  chown: (p, ...rest2) => relabeling(p, () => chown.call(bridge, p, ...rest2))
6854
6868
  } : {},
@@ -10162,7 +10176,7 @@ function wrap(table) {
10162
10176
  }
10163
10177
  return out;
10164
10178
  }
10165
- var WasiExit, IDS, NS_PER_MS4, AT_SYMLINK_NOFOLLOW2, AT_FDCWD2, AT_EACCESS2, ROOT_IDS, GONE, S_IFIFO2, S_IFLNK2, DEFAULT_UMASK, MONOTONIC_BASE, MAX_READ, SIGINFO_BYTES, FD_ALIAS, STDIO_FDS, SIGPIPE_EXIT, SIG_IGN, SEALED_MODE, DEVICE_MODE, WasiHost;
10179
+ var WasiExit, IDS, NS_PER_MS4, AT_SYMLINK_NOFOLLOW2, AT_FDCWD2, COPY_EXCL, COPY_MODE, AT_EACCESS2, ROOT_IDS, GONE, S_IFIFO2, S_IFLNK2, DEFAULT_UMASK, MONOTONIC_BASE, MAX_READ, SIGINFO_BYTES, FD_ALIAS, STDIO_FDS, SIGPIPE_EXIT, SIG_IGN, SEALED_MODE, DEVICE_MODE, WasiHost;
10166
10180
  var init_wasi_host = __esm({
10167
10181
  "src/process/wasi/wasi-host.ts"() {
10168
10182
  "use strict";
@@ -10195,6 +10209,8 @@ var init_wasi_host = __esm({
10195
10209
  NS_PER_MS4 = 1000000n;
10196
10210
  AT_SYMLINK_NOFOLLOW2 = 1;
10197
10211
  AT_FDCWD2 = -2;
10212
+ COPY_EXCL = 1;
10213
+ COPY_MODE = 2;
10198
10214
  AT_EACCESS2 = 2;
10199
10215
  ROOT_IDS = Object.freeze({ uid: 0, gid: 0 });
10200
10216
  GONE = /* @__PURE__ */ new Set(["ENOENT", "ENOTDIR"]);
@@ -10277,6 +10293,31 @@ var init_wasi_host = __esm({
10277
10293
  umask(mask) {
10278
10294
  return mask === void 0 ? this.umasks.get() : this.umasks.set(mask);
10279
10295
  }
10296
+ copyImport() {
10297
+ const { mem, fds } = this;
10298
+ const named = (dirfd, p, l) => {
10299
+ const raw = mem.string(p, l);
10300
+ if (raw === "") throw new WasiError("ENOENT");
10301
+ if (raw.startsWith("/")) return fds.resolve(3, raw);
10302
+ return dirfd === AT_FDCWD2 ? fds.resolve(3, `${this.cwd}/${raw}`) : fds.resolve(dirfd, raw);
10303
+ };
10304
+ return (...args) => {
10305
+ const [srcDirfd, sp, sl, dstDirfd, dp, dl, mode, flags] = args;
10306
+ if (!this.o.fs.copy) return E.NOSYS;
10307
+ if ((flags & ~(COPY_EXCL | COPY_MODE)) !== 0) throw new WasiError("EINVAL");
10308
+ const from = named(srcDirfd, sp, sl);
10309
+ const to = named(dstDirfd, dp, dl);
10310
+ const bits = flags & COPY_MODE ? this.o.fs.stat(from).mode ?? 0 : mode;
10311
+ this.copyFile(from, to, bits, (flags & COPY_EXCL) !== 0);
10312
+ return E.SUCCESS;
10313
+ };
10314
+ }
10315
+ copyFile(from, to, mode, exclusive) {
10316
+ const { copy: copy2 } = this.o.fs;
10317
+ if (!copy2) throw new WasiError("ENOSYS");
10318
+ this.fds.flushPath(from);
10319
+ copy2.call(this.o.fs, from, to, mode & 4095 & ~this.umasks.get(), exclusive);
10320
+ }
10280
10321
  created(path, mode) {
10281
10322
  const umask = this.umasks.get();
10282
10323
  if (umask !== DEFAULT_UMASK) this.o.fs.chmod(path, mode & ~umask);
@@ -10426,6 +10467,7 @@ var init_wasi_host = __esm({
10426
10467
  if ((made & ~want) !== 0) this.o.fs.chmod(path, made & want);
10427
10468
  return E.SUCCESS;
10428
10469
  },
10470
+ path_copy_file: this.copyImport(),
10429
10471
  umask: (mask, out) => {
10430
10472
  const old = this.umasks.set(mask);
10431
10473
  mem.view().setUint32(out, old, true);
@@ -11769,7 +11811,12 @@ function importsContext({
11769
11811
  argv: host.o.args,
11770
11812
  env: host.o.env,
11771
11813
  cwd: () => host.cwd,
11772
- fs,
11814
+ fs: Object.assign(Object.create(fs), {
11815
+ copyFile(from, to, options = {}) {
11816
+ const at = (p) => host.fds.resolve(3, p.startsWith("/") ? p : `${host.cwd}/${p}`);
11817
+ host.copyFile(at(from), at(to), options.mode ?? 438, options.excl === true);
11818
+ }
11819
+ }),
11773
11820
  fds,
11774
11821
  syscall: (req) => req.op === "proc-umask" ? host.umask(req.mask) : call2(req),
11775
11822
  net: network(raw, call2),