@ai-ecoverse/slicc-kernel 1.196.52 → 1.196.53

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.
@@ -10512,7 +10512,7 @@ function satisfies(version, range2) {
10512
10512
  }
10513
10513
 
10514
10514
  // src/version.ts
10515
- var KERNEL_VERSION = true ? "1.196.52" : "0.0.0-dev";
10515
+ var KERNEL_VERSION = true ? "1.196.53" : "0.0.0-dev";
10516
10516
  var OS_RELEASE = "6.0.0-slicc";
10517
10517
  function procVersion() {
10518
10518
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -23560,6 +23560,21 @@ var SealedBroker = class {
23560
23560
  }
23561
23561
  };
23562
23562
 
23563
+ // src/sudo-argv.ts
23564
+ var SUDO_VECTOR_MAX = 4096;
23565
+ var SUDO_INPUT_BYTES = 1024 * 1024;
23566
+ function budgetAfterArgs(args) {
23567
+ if (!Array.isArray(args)) return void 0;
23568
+ let remaining = args.length > SUDO_VECTOR_MAX ? -1 : SUDO_INPUT_BYTES;
23569
+ for (const word of args) {
23570
+ if (typeof word !== "string") return void 0;
23571
+ if (word.includes("\0")) return "nul";
23572
+ if (remaining >= 0)
23573
+ remaining = word.length + 1 > remaining ? -1 : remaining - storedSize(word) - 1;
23574
+ }
23575
+ return remaining;
23576
+ }
23577
+
23563
23578
  // src/sudo-files.ts
23564
23579
  var HEADER_BYTES = 256;
23565
23580
  async function fingerprint(bytes) {
@@ -23795,6 +23810,8 @@ var PLAIN2 = /^[A-Za-z0-9_@%+=:,./-]+$/;
23795
23810
  var CONTROL2 = /[\p{Cc}\u2028\u2029]/u;
23796
23811
  var CONTROLS = /[\p{Cc}\u2028\u2029]/gu;
23797
23812
  var SHOWN_MAX = 60;
23813
+ var DISPLAY_BYTES = 4096;
23814
+ var encoder9 = new TextEncoder();
23798
23815
  var KERNEL_SYNTAX = "[NOPASSWD] <user|%group|ALL> [(<target>)] [Cwd <dir>] [Stdin none] [ChainSha256 <sha256>] [RouteSha256 <sha256>] [Sha256 none|<file>=<sha256>\u2026] Cmnd <command\u2026|*>";
23799
23816
  var SUDOERS_SYNTAX = "<user|%group|ALL> ALL=[(<target>[,<target>\u2026])] [NOPASSWD:] <command\u2026|ALL>";
23800
23817
  var EXPECTED = `expected '${KERNEL_SYNTAX}' or '${SUDOERS_SYNTAX}'`;
@@ -23845,6 +23862,36 @@ function shellQuote(word) {
23845
23862
  function quoteWord(word) {
23846
23863
  return shellQuote(hasControl(word) ? withoutControl(word) : word);
23847
23864
  }
23865
+ function clip(text, bytes, marker = "\u2026") {
23866
+ const { read } = encoder9.encodeInto(text, new Uint8Array(bytes - encoder9.encode(marker).length));
23867
+ return text.slice(0, read) + marker;
23868
+ }
23869
+ function limitText(text, bytes) {
23870
+ return encoder9.encode(text.slice(0, bytes + 1)).length > bytes ? clip(text, bytes) : text;
23871
+ }
23872
+ function auditField(value2, bytes = 256) {
23873
+ return limitText(quoteWord(value2.slice(0, bytes + 1)), bytes);
23874
+ }
23875
+ async function commandDisplay(prefix, argv, suffix = "", fullArgv = argv) {
23876
+ const before = limitText(prefix, 2048);
23877
+ const after = limitText(suffix, 512);
23878
+ const limit = DISPLAY_BYTES - encoder9.encode(before + after).length;
23879
+ let room = limit;
23880
+ let text = "";
23881
+ for (const [i, arg] of argv.entries()) {
23882
+ const part = (i ? " " : "") + quoteWord(arg.slice(0, room + 1));
23883
+ room -= encoder9.encode(part).length;
23884
+ if (room < 0) {
23885
+ const marker = `\u2026 [sha256=${await argvDigest(fullArgv)}]`;
23886
+ return before + clip(text + part, limit, marker) + after;
23887
+ }
23888
+ text += part;
23889
+ }
23890
+ return before + text + after;
23891
+ }
23892
+ function wordDisplay(argv, suffix) {
23893
+ return commandDisplay("sudo: ", argv.slice(0, 1), suffix, argv);
23894
+ }
23848
23895
  function addPart(word, part) {
23849
23896
  const last = word.length - 1;
23850
23897
  if (part === null) {
@@ -24399,11 +24446,14 @@ function stdinMatches(rule, stdin) {
24399
24446
  function recordable(cwd, argv) {
24400
24447
  return !hasControl(cwd) && !argv.some(hasControl);
24401
24448
  }
24402
- function changedText(word) {
24403
- return `sudo: ${quoteWord(word)} changed since it was approved`;
24449
+ function changedText(argv) {
24450
+ return wordDisplay(argv, " changed since it was approved");
24404
24451
  }
24405
- function requestedText(word) {
24406
- return `sudo: ${quoteWord(word)} changed since it was requested`;
24452
+ function requestedText(argv, hint = "") {
24453
+ return wordDisplay(argv, " changed since it was requested" + hint);
24454
+ }
24455
+ function auditPrefix(user, tty, cwd, target, kind) {
24456
+ return `sudo: ${auditField(user)} : TTY=${auditField(tty)} ; PWD=${auditField(cwd, 768)} ; USER=${auditField(target)} ; ${kind} ; COMMAND=`;
24407
24457
  }
24408
24458
  function changedFile(approved, now) {
24409
24459
  const files = /* @__PURE__ */ new Set([...Object.keys(approved), ...Object.keys(now)]);
@@ -24441,16 +24491,15 @@ function stampOf(files) {
24441
24491
  }
24442
24492
  var REPLAY_ID = /^[!-~]{1,256}$/;
24443
24493
  var REPLAY_TAGS_MAX = 64;
24444
- var REPLAY_ARGV_MAX = 4096;
24445
24494
  var REPLAY_BYTES_MAX = 1024 * 1024;
24446
24495
  var NOT_A_REQUEST = "sudo: that isn't a sudo request this kernel can run";
24447
24496
  function strings2(value2, max) {
24448
24497
  return Array.isArray(value2) && value2.length <= max && value2.every((s) => typeof s === "string");
24449
24498
  }
24450
24499
  function words(value2) {
24451
- if (!strings2(value2, REPLAY_ARGV_MAX) || value2.length === 0) return false;
24452
- const bytes = value2.reduce((n, s) => n + s.length + 1, 0);
24453
- return bytes <= REPLAY_BYTES_MAX && !value2.some((s) => s.includes("\0"));
24500
+ if (!Array.isArray(value2) || value2.length === 0 || value2.length > SUDO_VECTOR_MAX) return false;
24501
+ const remaining = budgetAfterArgs(value2);
24502
+ return typeof remaining === "number" && remaining >= 0;
24454
24503
  }
24455
24504
  var FACT_OVERHEAD = 66;
24456
24505
  function factsFit(files) {
@@ -24945,8 +24994,9 @@ var Sudo = class {
24945
24994
  const st = await fs.stat(path);
24946
24995
  return st.isFile && (st.mode & 73) !== 0 ? path : void 0;
24947
24996
  }
24948
- async locate(word, cwd, reads, target) {
24997
+ async locate(argv, cwd, reads, target) {
24949
24998
  const fs = this.o.planFs?.(reads) ?? this.o.fs;
24999
+ const [word = ""] = argv;
24950
25000
  const candidates = word.includes("/") ? [askedPath(cwd, word)] : SECURE_PATH.split(":").map((dir) => `${dir}/${word}`);
24951
25001
  const cred = credOf(target);
24952
25002
  let denial;
@@ -24956,9 +25006,10 @@ var Sudo = class {
24956
25006
  if (path !== void 0) return { path, asked };
24957
25007
  } catch (err) {
24958
25008
  const code = err.code;
24959
- if (code === "EACCES") denial = failed2(code, `sudo: ${word}: Permission denied`);
25009
+ if (code === "EACCES")
25010
+ denial = failed2(code, await wordDisplay(argv, ": Permission denied"));
24960
25011
  else if (code === "ELOOP")
24961
- return failed2(code, `sudo: ${word}: Too many levels of symbolic links`);
25012
+ return failed2(code, await wordDisplay(argv, ": Too many levels of symbolic links"));
24962
25013
  }
24963
25014
  }
24964
25015
  return denial;
@@ -25029,12 +25080,16 @@ ${SCRIPT_HELP}
25029
25080
  const target = await this.lookup(r.target);
25030
25081
  if (!target) return failed2("ENOENT", `sudo: unknown user ${r.target}`);
25031
25082
  const cred = credOf(self);
25032
- const [word = "", ...args] = r.argv;
25083
+ const args = r.argv.slice(1);
25033
25084
  const argv = [r.path, ...args];
25034
25085
  const rules = await this.replayRules(self, target, r, argv);
25035
- const denied2 = () => failed2(
25086
+ const denied2 = async () => failed2(
25036
25087
  "EACCES",
25037
- `sudo: ${self.name} may no longer ask to run ${r.argv.map(quoteWord).join(" ")} as ${target.name}`
25088
+ await commandDisplay(
25089
+ `sudo: ${self.name} may no longer ask to run `,
25090
+ r.argv,
25091
+ ` as ${target.name}`
25092
+ )
25038
25093
  );
25039
25094
  if (rules?.length === 0) return denied2();
25040
25095
  if (await this.canonical(r.cwd) !== r.cwd) {
@@ -25047,23 +25102,23 @@ ${SCRIPT_HELP}
25047
25102
  );
25048
25103
  }
25049
25104
  const reads = this.reads();
25050
- const located = await this.locate(word, r.cwd, reads, target);
25105
+ const located = await this.locate(r.argv, r.cwd, reads, target);
25051
25106
  if (located && "error" in located) return located;
25052
25107
  if (!located) {
25053
25108
  const gone = await this.missingBacking(r.bound, r.path);
25054
- return gone ? failed2("EPERM", requestedText(word)) : failed2("ENOENT", `sudo: ${word}: command not found`);
25109
+ return gone ? failed2("EPERM", await requestedText(r.argv)) : failed2("ENOENT", await wordDisplay(r.argv, ": command not found"));
25055
25110
  }
25056
25111
  const { path, asked } = located;
25057
- if (path !== r.path) return failed2("EPERM", requestedText(word));
25112
+ if (path !== r.path) return failed2("EPERM", await requestedText(r.argv));
25058
25113
  const bound3 = await this.bound(path, r.cwd, asked, void 0, reads);
25059
- if (!bound3) return failed2("EPERM", requestedText(word));
25114
+ if (!bound3) return failed2("EPERM", await requestedText(r.argv));
25060
25115
  const changed2 = changedDecision(r.bound, r, bound3, path);
25061
25116
  if (changed2 !== void 0) {
25062
25117
  const missing7 = ["chainSha256", "routeSha256"].filter(
25063
25118
  (key) => bound3[key] !== void 0 && r[key] === void 0
25064
25119
  );
25065
25120
  const hint = missing7.length && changedFile(r.bound, bound3.hashes) === void 0 ? `; the saved request lacks ${missing7.join(" and ")}; pass back the whole request from approve unchanged` : "";
25066
- return failed2("EPERM", requestedText(word) + hint);
25121
+ return failed2("EPERM", await requestedText(r.argv, hint));
25067
25122
  }
25068
25123
  if (bound3.writableEnvPath && rules && !rules.some((rule) => pinned(rule, bound3.hashes, bound3)))
25069
25124
  return denied2();
@@ -25083,7 +25138,10 @@ ${SCRIPT_HELP}
25083
25138
  asked
25084
25139
  );
25085
25140
  (this.o.warn ?? console.warn)(
25086
- `sudo: ${self.name} : TTY=unknown ; PWD=${quoteWord(r.cwd)} ; USER=${target.name} ; REPLAY=${r.id} ; COMMAND=${argv.map(quoteWord).join(" ")}`
25141
+ await commandDisplay(
25142
+ auditPrefix(self.name, "unknown", r.cwd, target.name, `REPLAY=${auditField(r.id)}`),
25143
+ argv
25144
+ )
25087
25145
  );
25088
25146
  return { grant, caller: self, target, tags: r.tags };
25089
25147
  }
@@ -25099,10 +25157,14 @@ ${SCRIPT_HELP}
25099
25157
  async command(s, root, mine, call) {
25100
25158
  const { caller, self, target, parsed: parsed3 } = s;
25101
25159
  const { cred } = caller;
25102
- const [word = "", ...args] = parsed3.command;
25103
- const notAllowed = () => failed2(
25160
+ const args = parsed3.command.slice(1);
25161
+ const notAllowed = async () => failed2(
25104
25162
  "EPERM",
25105
- `sudo: ${self.name} is not allowed to run ${parsed3.command.map(quoteWord).join(" ")} as ${target.name}`
25163
+ await commandDisplay(
25164
+ `sudo: ${self.name} is not allowed to run `,
25165
+ parsed3.command,
25166
+ ` as ${target.name}`
25167
+ )
25106
25168
  );
25107
25169
  if (!root && mine.length === 0) return notAllowed();
25108
25170
  const cwd = await this.canonical(call.cwd, cred);
@@ -25113,10 +25175,11 @@ ${SCRIPT_HELP}
25113
25175
  );
25114
25176
  }
25115
25177
  const reads = this.reads();
25116
- const located = await this.locate(word, cwd, reads, target);
25178
+ const located = await this.locate(parsed3.command, cwd, reads, target);
25117
25179
  if (located && "error" in located) return located;
25118
25180
  const bound3 = located && await this.bound(located.path, cwd, located.asked, caller.pid, reads);
25119
- if (!located || !bound3) return failed2("ENOENT", `sudo: ${word}: command not found`);
25181
+ if (!located || !bound3)
25182
+ return failed2("ENOENT", await wordDisplay(parsed3.command, ": command not found"));
25120
25183
  const { path, asked } = located;
25121
25184
  const argv = [path, ...args];
25122
25185
  const applicable = mine.filter(
@@ -25128,7 +25191,7 @@ ${SCRIPT_HELP}
25128
25191
  if (matching.length === 0) return notAllowed();
25129
25192
  if (!parsed3.reset && this.timestamps.current(s.owner, s.policy, stampOf(bound3))) {
25130
25193
  this.timestamps.stamp(s.owner, s.policy, stampOf(bound3));
25131
- this.logged(s, cwd, argv);
25194
+ await this.logged(s, cwd, argv);
25132
25195
  return grant();
25133
25196
  }
25134
25197
  if (parsed3.nonInteractive) return failed2("EPERM", "sudo: a password is required");
@@ -25149,11 +25212,11 @@ ${SCRIPT_HELP}
25149
25212
  if (await this.canonical(call.cwd, cred) !== cwd || !await this.reachable(cred, cwd)) {
25150
25213
  return failed2("EACCES", `sudo: ${call.cwd} changed while the request waited`);
25151
25214
  }
25152
- if (await this.moved(bound3)) return failed2("EPERM", changedText(word));
25215
+ if (await this.moved(bound3)) return failed2("EPERM", await changedText(parsed3.command));
25153
25216
  if (answer2.answer === "once" && !answer2.person) return grant();
25154
25217
  const now = await this.bound(path, cwd, asked, caller.pid);
25155
25218
  if (!now || changedDecision(bound3.hashes, bound3, now, path) !== void 0)
25156
- return failed2("EPERM", changedText(word));
25219
+ return failed2("EPERM", await changedText(parsed3.command));
25157
25220
  const shown2 = recordable(cwd, [...parsed3.command, ...Object.keys(bound3.hashes)]);
25158
25221
  const result = answer2.answer === "once" ? grant() : await this.always(
25159
25222
  self,
@@ -25199,13 +25262,12 @@ ${SCRIPT_HELP}
25199
25262
  stamped(s, answer2, bound3 = {}) {
25200
25263
  if (answer2.person && !s.parsed.reset) this.timestamps.stamp(s.owner, s.policy, bound3);
25201
25264
  }
25202
- logged(s, cwd, argv) {
25265
+ async logged(s, cwd, argv) {
25203
25266
  const { caller, self, target, owner, policy } = s;
25204
25267
  const type = policy.type === "tty" && !owner.terminal ? "ppid" : policy.type;
25205
25268
  const tty = owner.terminal?.tty ?? caller.tty ?? "unknown";
25206
- const command = argv.map(quoteWord).join(" ");
25207
25269
  (this.o.warn ?? console.warn)(
25208
- `sudo: ${self.name} : TTY=${tty} ; PWD=${quoteWord(cwd)} ; USER=${target.name} ; TIMESTAMP=${type} ; COMMAND=${command}`
25270
+ await commandDisplay(auditPrefix(self.name, tty, cwd, target.name, `TIMESTAMP=${type}`), argv)
25209
25271
  );
25210
25272
  }
25211
25273
  async always(self, target, line, shown2, grant) {
@@ -29248,10 +29310,10 @@ var ANY_PLACEHOLDER = /fnox_proxy_[0-9a-f]{24}/g;
29248
29310
  var REQUEST_LINE2 = /^([!#$%&'*+.^_`|~0-9A-Za-z-]+) ([\x21-\x7e]+) HTTP\/1\.[01]$/;
29249
29311
  var HEADER_LINE = /^([!#$%&'*+.^_`|~0-9A-Za-z-]+):[ \t]*(.*?)[ \t]*$/;
29250
29312
  var BASIC2 = /^(Basic[ \t]+)([A-Za-z0-9+/]+={0,2})$/i;
29251
- var encoder9 = new TextEncoder();
29313
+ var encoder10 = new TextEncoder();
29252
29314
  function binary(text) {
29253
29315
  let out = "";
29254
- for (const b of encoder9.encode(text)) out += String.fromCharCode(b);
29316
+ for (const b of encoder10.encode(text)) out += String.fromCharCode(b);
29255
29317
  return out;
29256
29318
  }
29257
29319
  function sniffHttp1(start2) {
@@ -29295,7 +29357,7 @@ function replaced(text, values) {
29295
29357
  function usable2(values) {
29296
29358
  const out = {};
29297
29359
  for (const [ph, value2] of Object.entries(values ?? {}))
29298
- if (encoder9.encode(value2).length >= MIN_VALUE) out[ph] = value2;
29360
+ if (encoder10.encode(value2).length >= MIN_VALUE) out[ph] = value2;
29299
29361
  return out;
29300
29362
  }
29301
29363
  async function substituteHead(head, ask) {
@@ -29359,7 +29421,7 @@ function prepFails(prepared) {
29359
29421
  }
29360
29422
 
29361
29423
  // src/kernel/net/sealed-scram.ts
29362
- var encoder10 = new TextEncoder();
29424
+ var encoder11 = new TextEncoder();
29363
29425
  function base64Bytes(text) {
29364
29426
  try {
29365
29427
  return Uint8Array.from(atob(text), (c) => c.charCodeAt(0));
@@ -29431,7 +29493,7 @@ async function hmac(key, data) {
29431
29493
  return new Uint8Array(await crypto.subtle.sign("HMAC", k, data));
29432
29494
  }
29433
29495
  async function scramKeys(password, x) {
29434
- const base = await crypto.subtle.importKey("raw", encoder10.encode(password), "PBKDF2", false, [
29496
+ const base = await crypto.subtle.importKey("raw", encoder11.encode(password), "PBKDF2", false, [
29435
29497
  "deriveBits"
29436
29498
  ]);
29437
29499
  const salted = new Uint8Array(
@@ -29446,14 +29508,14 @@ async function scramKeys(password, x) {
29446
29508
  256
29447
29509
  )
29448
29510
  );
29449
- const clientKey = await hmac(salted, encoder10.encode("Client Key"));
29511
+ const clientKey = await hmac(salted, encoder11.encode("Client Key"));
29450
29512
  const stored2 = new Uint8Array(
29451
29513
  await crypto.subtle.digest("SHA-256", clientKey)
29452
29514
  );
29453
- const auth = encoder10.encode(`${x.clientFirstBare},${x.serverFirst},${x.clientFinalBare}`);
29515
+ const auth = encoder11.encode(`${x.clientFirstBare},${x.serverFirst},${x.clientFinalBare}`);
29454
29516
  const signature = await hmac(stored2, auth);
29455
29517
  const proof = clientKey.map((b, i) => b ^ signature[i]);
29456
- const serverKey = await hmac(salted, encoder10.encode("Server Key"));
29518
+ const serverKey = await hmac(salted, encoder11.encode("Server Key"));
29457
29519
  const serverSignature = await hmac(serverKey, auth);
29458
29520
  for (const k of [salted, clientKey, stored2, signature, serverKey]) k.fill(0);
29459
29521
  return { proof, serverSignature };
@@ -32953,20 +33015,6 @@ var PATH_FLAGS = PATH_ONLY | 65536 | 131072;
32953
33015
  var KEYBOARD = /* @__PURE__ */ new Set([SIG.INT, SIG.QUIT, SIG.TSTP]);
32954
33016
  var STUCK_ESCAPES = /* @__PURE__ */ new Set([SIG.INT, SIG.TERM, SIG.QUIT, SIG.HUP]);
32955
33017
  var DEFAULT_UMASK2 = 18;
32956
- var SUDO_VECTOR_MAX = 4096;
32957
- var SUDO_INPUT_BYTES = 1024 * 1024;
32958
- function budgetAfterArgs(args) {
32959
- if (!Array.isArray(args)) throw new KernelError("EINVAL");
32960
- if (args.length > SUDO_VECTOR_MAX) return -1;
32961
- let remaining = SUDO_INPUT_BYTES;
32962
- for (const word of args) {
32963
- if (typeof word !== "string") throw new KernelError("EINVAL");
32964
- if (word.length + 1 > remaining) return -1;
32965
- remaining -= storedSize(word) + 1;
32966
- if (remaining < 0) return -1;
32967
- }
32968
- return remaining;
32969
- }
32970
33018
  function sudoVariables(value2, term, budget) {
32971
33019
  const input = typeof value2 === "object" && value2 !== null ? value2 : {};
32972
33020
  const env = /* @__PURE__ */ Object.create(null);
@@ -35055,6 +35103,9 @@ var WasmProcess = class _WasmProcess {
35055
35103
  const { sudo } = this.options;
35056
35104
  if (!sudo) throw new KernelError("ENOSYS");
35057
35105
  const budget = budgetAfterArgs(req.args);
35106
+ if (budget === "nul")
35107
+ return { errno: "EINVAL", error: "sudo: an argument contains a NUL character" };
35108
+ if (budget === void 0) throw new KernelError("EINVAL");
35058
35109
  if (budget < 0) return { errno: "E2BIG", error: "sudo: the submitted arguments are too large" };
35059
35110
  const term = typeof req.term === "string" ? req.term : void 0;
35060
35111
  const submitted = sudoVariables(req.env, term, budget);
@@ -35088,8 +35139,7 @@ var WasmProcess = class _WasmProcess {
35088
35139
  })
35089
35140
  };
35090
35141
  } catch (err) {
35091
- if (err instanceof ChangedError)
35092
- return { error: changedText(argv[0] ?? asked), errno: err.code };
35142
+ if (err instanceof ChangedError) return { error: await changedText(argv), errno: err.code };
35093
35143
  throw err;
35094
35144
  }
35095
35145
  }
@@ -39685,7 +39735,7 @@ var LAYOUT = [
39685
39735
  var IN_TREE = /* @__PURE__ */ new Set([SUDO_PATH, VISUDO_PATH, CRONTAB_PATH, SEALED_BIN]);
39686
39736
  var LOAD_SAMPLE_MS = 5e3;
39687
39737
  var LOAD_WINDOWS_MS = [6e4, 3e5, 9e5];
39688
- var encoder11 = new TextEncoder();
39738
+ var encoder12 = new TextEncoder();
39689
39739
  var USERS_MODES = ["off", "report", "enforce"];
39690
39740
  function usersMode(mode = "off") {
39691
39741
  if (USERS_MODES.includes(mode)) return mode;
@@ -43512,7 +43562,7 @@ var Launcher = class {
43512
43562
  account,
43513
43563
  options.session
43514
43564
  );
43515
- const report = (message3) => options.onData(encoder11.encode(`${message3}\r
43565
+ const report = (message3) => options.onData(encoder12.encode(`${message3}\r
43516
43566
  `));
43517
43567
  const handle = await this.launch(planned, {
43518
43568
  ...reserved2,
@@ -43560,7 +43610,7 @@ var Launcher = class {
43560
43610
  };
43561
43611
  const stdout = collect2(out, options.onStdout);
43562
43612
  const stderr = collect2(err, options.onStderr);
43563
- const report = (message3) => stderr(encoder11.encode(`${message3}
43613
+ const report = (message3) => stderr(encoder12.encode(`${message3}
43564
43614
  `));
43565
43615
  if (!planned) {
43566
43616
  const directory = !missingFile && await this.directory(file, this.fs.resolvePath(cwd, file));
@@ -43601,21 +43651,20 @@ var Launcher = class {
43601
43651
  this.resetCatalogs();
43602
43652
  const req = { file: grant.file, argv: grant.argv, env: grant.env, cwd: grant.cwd };
43603
43653
  const ctx = { ppid: 0, cred: grant.cred, scope: "", grant };
43604
- const word = grant.argv[0] ?? grant.asked;
43605
- const requested = (err2) => {
43606
- if (err2 instanceof ChangedError) throw sudoFailure(err2.code, requestedText(word));
43654
+ const requested = async (err2) => {
43655
+ if (err2 instanceof ChangedError) throw sudoFailure(err2.code, await requestedText(grant.argv));
43607
43656
  throw err2;
43608
43657
  };
43609
- const planned = await this.planOne(req, ctx).catch((err2) => {
43610
- if (err2 instanceof ChangedError) requested(err2);
43658
+ const planned = await this.planOne(req, ctx).catch(async (err2) => {
43659
+ if (err2 instanceof ChangedError) return requested(err2);
43611
43660
  const code = sudoCause(err2);
43612
- if (code === "ENOENT") throw sudoFailure(code, `sudo: ${quoteWord(word)}: command not found`);
43613
- throw sudoFailure(code, `sudo: ${quoteWord(word)}: ${ERRNO_TEXT[code] ?? code}`);
43661
+ const reason = code === "ENOENT" ? "command not found" : ERRNO_TEXT[code] ?? code;
43662
+ throw sudoFailure(code, await wordDisplay(grant.argv, ": " + reason));
43614
43663
  });
43615
43664
  const pin = await this.unchanged(planned, grant.file, grant.cwd, grant).catch(requested);
43616
43665
  const fds = await this.sudoOutputs(options, caller, this.stackFor(tags, tagged.tagBase));
43617
43666
  const err = fds.get(2).file;
43618
- const report = (message3) => void Promise.resolve(err.write?.(encoder11.encode(`${message3}
43667
+ const report = (message3) => void Promise.resolve(err.write?.(encoder12.encode(`${message3}
43619
43668
  `))).catch(() => void 0);
43620
43669
  const replan = () => this.planOne(req, ctx);
43621
43670
  const recheck = this.approvedChain(planned, grant.file, grant.cwd, grant);