@ai-ecoverse/slicc-kernel 1.178.3 → 1.179.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.
@@ -7518,7 +7518,7 @@ var init_version = __esm({
7518
7518
  "src/version.ts"() {
7519
7519
  "use strict";
7520
7520
  init_captured_globals();
7521
- KERNEL_VERSION = true ? "1.178.3" : "0.0.0-dev";
7521
+ KERNEL_VERSION = true ? "1.179.0" : "0.0.0-dev";
7522
7522
  OS_RELEASE = "6.0.0-slicc";
7523
7523
  }
7524
7524
  });
@@ -7517,7 +7517,7 @@ var init_version = __esm({
7517
7517
  "src/version.ts"() {
7518
7518
  "use strict";
7519
7519
  init_captured_globals();
7520
- KERNEL_VERSION = true ? "1.178.3" : "0.0.0-dev";
7520
+ KERNEL_VERSION = true ? "1.179.0" : "0.0.0-dev";
7521
7521
  OS_RELEASE = "6.0.0-slicc";
7522
7522
  }
7523
7523
  });
package/dist/node.js CHANGED
@@ -868,13 +868,6 @@ async function linkable(g, from, to, follow2) {
868
868
  }
869
869
  await inParent(g, "link", to);
870
870
  }
871
- async function ownerOnly(g, op, path, follow2) {
872
- const walked = await need(g, op, path, 0, { follow: follow2 });
873
- const perm = walked.perm;
874
- if (!perm || g.cred.euid === 0 || perm.uid === g.cred.euid) return walked;
875
- if (await present(g.fs, walked.path, false)) deny(g, op, path, "EPERM");
876
- return walked;
877
- }
878
871
  async function chmodMode(g, path, mode) {
879
872
  const walked = await need(g, "chmod", path, 0, { follow: true });
880
873
  const perm = walked.perm;
@@ -896,17 +889,26 @@ function heldChmodMode(g, path, st, mode) {
896
889
  function heldRetimable(g, path, st, now) {
897
890
  const perm = permOf(st);
898
891
  if (g.cred.euid === 0 || perm.uid === g.cred.euid) return;
899
- if (!now) deny(g, "futimens", path, "EPERM");
900
- else if (!permits(g.cred, perm, W_OK, false)) deny(g, "futimens", path);
892
+ if (now || st.fat) {
893
+ if (!permits(g.cred, perm, W_OK, false)) deny(g, "futimens", path);
894
+ return;
895
+ }
896
+ deny(g, "futimens", path, "EPERM");
901
897
  }
902
898
  async function retimable(g, op, path, now = false) {
903
899
  const follow2 = op !== "lutimes";
904
- if (!now) return void await ownerOnly(g, op, path, follow2);
905
900
  const walked = await need(g, op, path, 0, { follow: follow2 });
906
901
  const perm = walked.perm;
907
902
  if (!perm || g.cred.euid === 0 || perm.uid === g.cred.euid) return;
908
- if (permits(g.cred, perm, W_OK, false)) return;
909
- if (await present(g.fs, walked.path, false)) deny(g, op, path);
903
+ const look = follow2 ? g.fs.stat : g.fs.lstat;
904
+ const st = await look.call(g.fs, walked.path).catch(() => void 0);
905
+ if (now || st?.fat) {
906
+ if (!permits(g.cred, perm, W_OK, false) && await present(g.fs, walked.path, false)) {
907
+ deny(g, op, path);
908
+ }
909
+ return;
910
+ }
911
+ if (await present(g.fs, walked.path, false)) deny(g, op, path, "EPERM");
910
912
  }
911
913
  async function fileWritable(g, op, path) {
912
914
  await need(g, op, path, W_OK, { directory: false });
@@ -3709,7 +3711,7 @@ function satisfies(version, range2) {
3709
3711
  }
3710
3712
 
3711
3713
  // src/version.ts
3712
- var KERNEL_VERSION = true ? "1.178.3" : "0.0.0-dev";
3714
+ var KERNEL_VERSION = true ? "1.179.0" : "0.0.0-dev";
3713
3715
  var OS_RELEASE = "6.0.0-slicc";
3714
3716
  function procVersion() {
3715
3717
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -32609,6 +32611,11 @@ function usersMode(mode = "off") {
32609
32611
  function tagOption(tag) {
32610
32612
  if (tag !== void 0 && typeof tag !== "string") throw new TypeError("a tag must be a string");
32611
32613
  }
32614
+ function cwdMissingOption(value2) {
32615
+ if (value2 === void 0 || value2 === "create") return "create";
32616
+ if (value2 === "error") return "error";
32617
+ throw new TypeError("cwdMissing must be 'create' or 'error'");
32618
+ }
32612
32619
  function withTag(tags, tag) {
32613
32620
  if (tag === void 0 || tags?.includes(tag)) return tags;
32614
32621
  return [...tags ?? [], tag];
@@ -35487,7 +35494,7 @@ var Launcher = class {
35487
35494
  const kept = keepingOpen(fs, nodes, (path) => this.changes.publish(path));
35488
35495
  return this.swaps.wrap(unlinked.wrap(kept));
35489
35496
  }
35490
- async starting(argv, dir, account, tags, base) {
35497
+ async starting(argv, dir, account, tags, base, missing6 = "create") {
35491
35498
  const tag = tags?.[0];
35492
35499
  await this.swaps.settled();
35493
35500
  this.resetCatalogs();
@@ -35496,8 +35503,13 @@ var Launcher = class {
35496
35503
  const cwd = await physicalPathAsync(this.base, start2.startsWith("/") ? start2 : `/${start2}`);
35497
35504
  await this.enterable(this.execGuard(credOf(account), 0, tag), cwd);
35498
35505
  const file = await this.execFile(argv[0] ?? "", cwd, this.execGuard(credOf(account), 0, tag));
35499
- if (!await this.base.exists(cwd))
35506
+ if (!await this.base.exists(cwd)) {
35507
+ if (missing6 === "error")
35508
+ throw Object.assign(new Error(`cannot change to ${cwd}: No such file or directory`), {
35509
+ code: "ENOENT"
35510
+ });
35500
35511
  await this.stackFor(tags, base).fs.mkdir(cwd, { recursive: true });
35512
+ }
35501
35513
  const plan = async () => {
35502
35514
  const found = await this.plan(file, argv, cwd, scope);
35503
35515
  await this.mayExec(credOf(account), { file, cwd, pid: 0, tag }, found);
@@ -35508,6 +35520,7 @@ var Launcher = class {
35508
35520
  }
35509
35521
  async openTerminal(argv, options) {
35510
35522
  const tagged = tagsOption(options);
35523
+ const missing6 = cwdMissingOption(options.cwdMissing);
35511
35524
  const { tags } = tagged;
35512
35525
  const { account, tty: ttyGroup } = await this.terminalAccount(options.user);
35513
35526
  const { cwd, file, planned } = await this.starting(
@@ -35515,7 +35528,8 @@ var Launcher = class {
35515
35528
  options.cwd,
35516
35529
  account,
35517
35530
  tags,
35518
- tagged.tagBase
35531
+ tagged.tagBase,
35532
+ missing6
35519
35533
  );
35520
35534
  if (!planned) throw new Error(`${file}: command not found`);
35521
35535
  let leader = 0;
@@ -35567,6 +35581,7 @@ var Launcher = class {
35567
35581
  }
35568
35582
  async run(argv, options = {}) {
35569
35583
  const tagged = tagsOption(options);
35584
+ const missing6 = cwdMissingOption(options.cwdMissing);
35570
35585
  const { tags } = tagged;
35571
35586
  const account = await this.account(options.user);
35572
35587
  const { cwd, file, planned } = await this.starting(
@@ -35574,7 +35589,8 @@ var Launcher = class {
35574
35589
  options.cwd,
35575
35590
  account,
35576
35591
  tags,
35577
- tagged.tagBase
35592
+ tagged.tagBase,
35593
+ missing6
35578
35594
  );
35579
35595
  const env = this.environment(cwd, options.env, account, options.login);
35580
35596
  const out = [];
@@ -36096,7 +36112,7 @@ function serveTransport(peer, transport, {
36096
36112
  }
36097
36113
 
36098
36114
  // src/client/protocol.ts
36099
- var PROTOCOL = [1, 13];
36115
+ var PROTOCOL = [1, 14];
36100
36116
  var FS_METHODS = [
36101
36117
  "readFile",
36102
36118
  "writeFile",
@@ -37686,6 +37702,8 @@ async function spawnOn(channel, argv, opts) {
37686
37702
  });
37687
37703
  if (opts.tag !== void 0) await since(channel, 12, "a tag per spawn", async () => {
37688
37704
  });
37705
+ if (opts.cwdMissing === "error") await since(channel, 14, "cwdMissing: 'error'", async () => {
37706
+ });
37689
37707
  const started = Promise.withResolvers();
37690
37708
  let endedBy;
37691
37709
  const options = { ...rest2, ...stdin !== void 0 ? { stdin: bytesOf4(stdin) } : {} };
@@ -37745,6 +37763,8 @@ async function terminalOn(channel, argv, opts) {
37745
37763
  });
37746
37764
  if (opts.tag !== void 0) await since(channel, 12, "a tag per terminal", async () => {
37747
37765
  });
37766
+ if (opts.cwdMissing === "error") await since(channel, 14, "cwdMissing: 'error'", async () => {
37767
+ });
37748
37768
  let listener = onData ?? null;
37749
37769
  const backlog = [];
37750
37770
  const started = Promise.withResolvers();