@ai-ecoverse/slicc-kernel 1.127.1 → 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.1" : "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
  });
@@ -6709,6 +6713,13 @@ function goneAbove(maps, live, path) {
6709
6713
  }
6710
6714
  return void 0;
6711
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
+ }
6712
6723
  function cachingBridge(bridge, now = () => performance.now(), shared) {
6713
6724
  const blind = shared !== void 0 && shared.length * 4 < SHARED_IDS_BYTES;
6714
6725
  const cache = new StatCache(blind ? void 0 : shared);
@@ -6851,6 +6862,7 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
6851
6862
  ...bridge.mkfifo ? {
6852
6863
  mkfifo: (p, mode) => mutating(() => bridge.mkfifo?.(p, mode), ...entry(p))
6853
6864
  } : {},
6865
+ ...copying(bridge, mutating, entry),
6854
6866
  ...chown ? {
6855
6867
  chown: (p, ...rest2) => relabeling(p, () => chown.call(bridge, p, ...rest2))
6856
6868
  } : {},
@@ -10164,7 +10176,7 @@ function wrap(table) {
10164
10176
  }
10165
10177
  return out;
10166
10178
  }
10167
- 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;
10168
10180
  var init_wasi_host = __esm({
10169
10181
  "src/process/wasi/wasi-host.ts"() {
10170
10182
  "use strict";
@@ -10197,6 +10209,8 @@ var init_wasi_host = __esm({
10197
10209
  NS_PER_MS4 = 1000000n;
10198
10210
  AT_SYMLINK_NOFOLLOW2 = 1;
10199
10211
  AT_FDCWD2 = -2;
10212
+ COPY_EXCL = 1;
10213
+ COPY_MODE = 2;
10200
10214
  AT_EACCESS2 = 2;
10201
10215
  ROOT_IDS = Object.freeze({ uid: 0, gid: 0 });
10202
10216
  GONE = /* @__PURE__ */ new Set(["ENOENT", "ENOTDIR"]);
@@ -10279,6 +10293,31 @@ var init_wasi_host = __esm({
10279
10293
  umask(mask) {
10280
10294
  return mask === void 0 ? this.umasks.get() : this.umasks.set(mask);
10281
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
+ }
10282
10321
  created(path, mode) {
10283
10322
  const umask = this.umasks.get();
10284
10323
  if (umask !== DEFAULT_UMASK) this.o.fs.chmod(path, mode & ~umask);
@@ -10428,6 +10467,7 @@ var init_wasi_host = __esm({
10428
10467
  if ((made & ~want) !== 0) this.o.fs.chmod(path, made & want);
10429
10468
  return E.SUCCESS;
10430
10469
  },
10470
+ path_copy_file: this.copyImport(),
10431
10471
  umask: (mask, out) => {
10432
10472
  const old = this.umasks.set(mask);
10433
10473
  mem.view().setUint32(out, old, true);
@@ -11771,7 +11811,12 @@ function importsContext({
11771
11811
  argv: host.o.args,
11772
11812
  env: host.o.env,
11773
11813
  cwd: () => host.cwd,
11774
- 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
+ }),
11775
11820
  fds,
11776
11821
  syscall: (req) => req.op === "proc-umask" ? host.umask(req.mask) : call2(req),
11777
11822
  net: network(raw, call2),