@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.
@@ -9480,7 +9480,7 @@ var init_version = __esm({
9480
9480
  "src/version.ts"() {
9481
9481
  "use strict";
9482
9482
  init_captured_globals();
9483
- KERNEL_VERSION = true ? "1.196.52" : "0.0.0-dev";
9483
+ KERNEL_VERSION = true ? "1.196.53" : "0.0.0-dev";
9484
9484
  OS_RELEASE = "6.0.0-slicc";
9485
9485
  }
9486
9486
  });
@@ -9479,7 +9479,7 @@ var init_version = __esm({
9479
9479
  "src/version.ts"() {
9480
9480
  "use strict";
9481
9481
  init_captured_globals();
9482
- KERNEL_VERSION = true ? "1.196.52" : "0.0.0-dev";
9482
+ KERNEL_VERSION = true ? "1.196.53" : "0.0.0-dev";
9483
9483
  OS_RELEASE = "6.0.0-slicc";
9484
9484
  }
9485
9485
  });
package/dist/node.js CHANGED
@@ -7874,7 +7874,7 @@ function satisfies(version, range2) {
7874
7874
  }
7875
7875
 
7876
7876
  // src/version.ts
7877
- var KERNEL_VERSION = true ? "1.196.52" : "0.0.0-dev";
7877
+ var KERNEL_VERSION = true ? "1.196.53" : "0.0.0-dev";
7878
7878
  var OS_RELEASE = "6.0.0-slicc";
7879
7879
  function procVersion() {
7880
7880
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -19427,6 +19427,21 @@ var SealedBroker = class {
19427
19427
  }
19428
19428
  };
19429
19429
 
19430
+ // src/sudo-argv.ts
19431
+ var SUDO_VECTOR_MAX = 4096;
19432
+ var SUDO_INPUT_BYTES = 1024 * 1024;
19433
+ function budgetAfterArgs(args) {
19434
+ if (!Array.isArray(args)) return void 0;
19435
+ let remaining = args.length > SUDO_VECTOR_MAX ? -1 : SUDO_INPUT_BYTES;
19436
+ for (const word of args) {
19437
+ if (typeof word !== "string") return void 0;
19438
+ if (word.includes("\0")) return "nul";
19439
+ if (remaining >= 0)
19440
+ remaining = word.length + 1 > remaining ? -1 : remaining - storedSize(word) - 1;
19441
+ }
19442
+ return remaining;
19443
+ }
19444
+
19430
19445
  // src/sudo-files.ts
19431
19446
  var HEADER_BYTES = 256;
19432
19447
  async function fingerprint(bytes) {
@@ -19662,6 +19677,8 @@ var PLAIN = /^[A-Za-z0-9_@%+=:,./-]+$/;
19662
19677
  var CONTROL2 = /[\p{Cc}\u2028\u2029]/u;
19663
19678
  var CONTROLS = /[\p{Cc}\u2028\u2029]/gu;
19664
19679
  var SHOWN_MAX = 60;
19680
+ var DISPLAY_BYTES = 4096;
19681
+ var encoder9 = new TextEncoder();
19665
19682
  var KERNEL_SYNTAX = "[NOPASSWD] <user|%group|ALL> [(<target>)] [Cwd <dir>] [Stdin none] [ChainSha256 <sha256>] [RouteSha256 <sha256>] [Sha256 none|<file>=<sha256>\u2026] Cmnd <command\u2026|*>";
19666
19683
  var SUDOERS_SYNTAX = "<user|%group|ALL> ALL=[(<target>[,<target>\u2026])] [NOPASSWD:] <command\u2026|ALL>";
19667
19684
  var EXPECTED = `expected '${KERNEL_SYNTAX}' or '${SUDOERS_SYNTAX}'`;
@@ -19712,6 +19729,36 @@ function shellQuote(word) {
19712
19729
  function quoteWord(word) {
19713
19730
  return shellQuote(hasControl2(word) ? withoutControl(word) : word);
19714
19731
  }
19732
+ function clip(text, bytes, marker = "\u2026") {
19733
+ const { read } = encoder9.encodeInto(text, new Uint8Array(bytes - encoder9.encode(marker).length));
19734
+ return text.slice(0, read) + marker;
19735
+ }
19736
+ function limitText(text, bytes) {
19737
+ return encoder9.encode(text.slice(0, bytes + 1)).length > bytes ? clip(text, bytes) : text;
19738
+ }
19739
+ function auditField(value2, bytes = 256) {
19740
+ return limitText(quoteWord(value2.slice(0, bytes + 1)), bytes);
19741
+ }
19742
+ async function commandDisplay(prefix, argv, suffix = "", fullArgv = argv) {
19743
+ const before = limitText(prefix, 2048);
19744
+ const after = limitText(suffix, 512);
19745
+ const limit = DISPLAY_BYTES - encoder9.encode(before + after).length;
19746
+ let room = limit;
19747
+ let text = "";
19748
+ for (const [i, arg] of argv.entries()) {
19749
+ const part = (i ? " " : "") + quoteWord(arg.slice(0, room + 1));
19750
+ room -= encoder9.encode(part).length;
19751
+ if (room < 0) {
19752
+ const marker = `\u2026 [sha256=${await argvDigest(fullArgv)}]`;
19753
+ return before + clip(text + part, limit, marker) + after;
19754
+ }
19755
+ text += part;
19756
+ }
19757
+ return before + text + after;
19758
+ }
19759
+ function wordDisplay(argv, suffix) {
19760
+ return commandDisplay("sudo: ", argv.slice(0, 1), suffix, argv);
19761
+ }
19715
19762
  function addPart(word, part) {
19716
19763
  const last = word.length - 1;
19717
19764
  if (part === null) {
@@ -20643,11 +20690,14 @@ function stdinMatches(rule2, stdin) {
20643
20690
  function recordable(cwd, argv) {
20644
20691
  return !hasControl2(cwd) && !argv.some(hasControl2);
20645
20692
  }
20646
- function changedText(word) {
20647
- return `sudo: ${quoteWord(word)} changed since it was approved`;
20693
+ function changedText(argv) {
20694
+ return wordDisplay(argv, " changed since it was approved");
20648
20695
  }
20649
- function requestedText(word) {
20650
- return `sudo: ${quoteWord(word)} changed since it was requested`;
20696
+ function requestedText(argv, hint = "") {
20697
+ return wordDisplay(argv, " changed since it was requested" + hint);
20698
+ }
20699
+ function auditPrefix(user, tty, cwd, target, kind) {
20700
+ return `sudo: ${auditField(user)} : TTY=${auditField(tty)} ; PWD=${auditField(cwd, 768)} ; USER=${auditField(target)} ; ${kind} ; COMMAND=`;
20651
20701
  }
20652
20702
  function changedFile(approved, now) {
20653
20703
  const files = /* @__PURE__ */ new Set([...Object.keys(approved), ...Object.keys(now)]);
@@ -20685,16 +20735,15 @@ function stampOf(files) {
20685
20735
  }
20686
20736
  var REPLAY_ID = /^[!-~]{1,256}$/;
20687
20737
  var REPLAY_TAGS_MAX = 64;
20688
- var REPLAY_ARGV_MAX = 4096;
20689
20738
  var REPLAY_BYTES_MAX = 1024 * 1024;
20690
20739
  var NOT_A_REQUEST = "sudo: that isn't a sudo request this kernel can run";
20691
20740
  function strings2(value2, max) {
20692
20741
  return Array.isArray(value2) && value2.length <= max && value2.every((s) => typeof s === "string");
20693
20742
  }
20694
20743
  function words(value2) {
20695
- if (!strings2(value2, REPLAY_ARGV_MAX) || value2.length === 0) return false;
20696
- const bytes = value2.reduce((n, s) => n + s.length + 1, 0);
20697
- return bytes <= REPLAY_BYTES_MAX && !value2.some((s) => s.includes("\0"));
20744
+ if (!Array.isArray(value2) || value2.length === 0 || value2.length > SUDO_VECTOR_MAX) return false;
20745
+ const remaining = budgetAfterArgs(value2);
20746
+ return typeof remaining === "number" && remaining >= 0;
20698
20747
  }
20699
20748
  var FACT_OVERHEAD = 66;
20700
20749
  function factsFit(files) {
@@ -21189,8 +21238,9 @@ var Sudo = class {
21189
21238
  const st = await fs.stat(path);
21190
21239
  return st.isFile && (st.mode & 73) !== 0 ? path : void 0;
21191
21240
  }
21192
- async locate(word, cwd, reads, target) {
21241
+ async locate(argv, cwd, reads, target) {
21193
21242
  const fs = this.o.planFs?.(reads) ?? this.o.fs;
21243
+ const [word = ""] = argv;
21194
21244
  const candidates = word.includes("/") ? [askedPath(cwd, word)] : SECURE_PATH.split(":").map((dir) => `${dir}/${word}`);
21195
21245
  const cred = credOf(target);
21196
21246
  let denial;
@@ -21200,9 +21250,10 @@ var Sudo = class {
21200
21250
  if (path !== void 0) return { path, asked };
21201
21251
  } catch (err) {
21202
21252
  const code = err.code;
21203
- if (code === "EACCES") denial = failed2(code, `sudo: ${word}: Permission denied`);
21253
+ if (code === "EACCES")
21254
+ denial = failed2(code, await wordDisplay(argv, ": Permission denied"));
21204
21255
  else if (code === "ELOOP")
21205
- return failed2(code, `sudo: ${word}: Too many levels of symbolic links`);
21256
+ return failed2(code, await wordDisplay(argv, ": Too many levels of symbolic links"));
21206
21257
  }
21207
21258
  }
21208
21259
  return denial;
@@ -21273,12 +21324,16 @@ ${SCRIPT_HELP}
21273
21324
  const target = await this.lookup(r.target);
21274
21325
  if (!target) return failed2("ENOENT", `sudo: unknown user ${r.target}`);
21275
21326
  const cred = credOf(self);
21276
- const [word = "", ...args] = r.argv;
21327
+ const args = r.argv.slice(1);
21277
21328
  const argv = [r.path, ...args];
21278
21329
  const rules = await this.replayRules(self, target, r, argv);
21279
- const denied2 = () => failed2(
21330
+ const denied2 = async () => failed2(
21280
21331
  "EACCES",
21281
- `sudo: ${self.name} may no longer ask to run ${r.argv.map(quoteWord).join(" ")} as ${target.name}`
21332
+ await commandDisplay(
21333
+ `sudo: ${self.name} may no longer ask to run `,
21334
+ r.argv,
21335
+ ` as ${target.name}`
21336
+ )
21282
21337
  );
21283
21338
  if (rules?.length === 0) return denied2();
21284
21339
  if (await this.canonical(r.cwd) !== r.cwd) {
@@ -21291,23 +21346,23 @@ ${SCRIPT_HELP}
21291
21346
  );
21292
21347
  }
21293
21348
  const reads = this.reads();
21294
- const located = await this.locate(word, r.cwd, reads, target);
21349
+ const located = await this.locate(r.argv, r.cwd, reads, target);
21295
21350
  if (located && "error" in located) return located;
21296
21351
  if (!located) {
21297
21352
  const gone = await this.missingBacking(r.bound, r.path);
21298
- return gone ? failed2("EPERM", requestedText(word)) : failed2("ENOENT", `sudo: ${word}: command not found`);
21353
+ return gone ? failed2("EPERM", await requestedText(r.argv)) : failed2("ENOENT", await wordDisplay(r.argv, ": command not found"));
21299
21354
  }
21300
21355
  const { path, asked } = located;
21301
- if (path !== r.path) return failed2("EPERM", requestedText(word));
21356
+ if (path !== r.path) return failed2("EPERM", await requestedText(r.argv));
21302
21357
  const bound3 = await this.bound(path, r.cwd, asked, void 0, reads);
21303
- if (!bound3) return failed2("EPERM", requestedText(word));
21358
+ if (!bound3) return failed2("EPERM", await requestedText(r.argv));
21304
21359
  const changed2 = changedDecision(r.bound, r, bound3, path);
21305
21360
  if (changed2 !== void 0) {
21306
21361
  const missing7 = ["chainSha256", "routeSha256"].filter(
21307
21362
  (key) => bound3[key] !== void 0 && r[key] === void 0
21308
21363
  );
21309
21364
  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` : "";
21310
- return failed2("EPERM", requestedText(word) + hint);
21365
+ return failed2("EPERM", await requestedText(r.argv, hint));
21311
21366
  }
21312
21367
  if (bound3.writableEnvPath && rules && !rules.some((rule2) => pinned(rule2, bound3.hashes, bound3)))
21313
21368
  return denied2();
@@ -21327,7 +21382,10 @@ ${SCRIPT_HELP}
21327
21382
  asked
21328
21383
  );
21329
21384
  (this.o.warn ?? console.warn)(
21330
- `sudo: ${self.name} : TTY=unknown ; PWD=${quoteWord(r.cwd)} ; USER=${target.name} ; REPLAY=${r.id} ; COMMAND=${argv.map(quoteWord).join(" ")}`
21385
+ await commandDisplay(
21386
+ auditPrefix(self.name, "unknown", r.cwd, target.name, `REPLAY=${auditField(r.id)}`),
21387
+ argv
21388
+ )
21331
21389
  );
21332
21390
  return { grant, caller: self, target, tags: r.tags };
21333
21391
  }
@@ -21343,10 +21401,14 @@ ${SCRIPT_HELP}
21343
21401
  async command(s, root, mine, call) {
21344
21402
  const { caller, self, target, parsed: parsed3 } = s;
21345
21403
  const { cred } = caller;
21346
- const [word = "", ...args] = parsed3.command;
21347
- const notAllowed = () => failed2(
21404
+ const args = parsed3.command.slice(1);
21405
+ const notAllowed = async () => failed2(
21348
21406
  "EPERM",
21349
- `sudo: ${self.name} is not allowed to run ${parsed3.command.map(quoteWord).join(" ")} as ${target.name}`
21407
+ await commandDisplay(
21408
+ `sudo: ${self.name} is not allowed to run `,
21409
+ parsed3.command,
21410
+ ` as ${target.name}`
21411
+ )
21350
21412
  );
21351
21413
  if (!root && mine.length === 0) return notAllowed();
21352
21414
  const cwd = await this.canonical(call.cwd, cred);
@@ -21357,10 +21419,11 @@ ${SCRIPT_HELP}
21357
21419
  );
21358
21420
  }
21359
21421
  const reads = this.reads();
21360
- const located = await this.locate(word, cwd, reads, target);
21422
+ const located = await this.locate(parsed3.command, cwd, reads, target);
21361
21423
  if (located && "error" in located) return located;
21362
21424
  const bound3 = located && await this.bound(located.path, cwd, located.asked, caller.pid, reads);
21363
- if (!located || !bound3) return failed2("ENOENT", `sudo: ${word}: command not found`);
21425
+ if (!located || !bound3)
21426
+ return failed2("ENOENT", await wordDisplay(parsed3.command, ": command not found"));
21364
21427
  const { path, asked } = located;
21365
21428
  const argv = [path, ...args];
21366
21429
  const applicable = mine.filter(
@@ -21372,7 +21435,7 @@ ${SCRIPT_HELP}
21372
21435
  if (matching.length === 0) return notAllowed();
21373
21436
  if (!parsed3.reset && this.timestamps.current(s.owner, s.policy, stampOf(bound3))) {
21374
21437
  this.timestamps.stamp(s.owner, s.policy, stampOf(bound3));
21375
- this.logged(s, cwd, argv);
21438
+ await this.logged(s, cwd, argv);
21376
21439
  return grant();
21377
21440
  }
21378
21441
  if (parsed3.nonInteractive) return failed2("EPERM", "sudo: a password is required");
@@ -21393,11 +21456,11 @@ ${SCRIPT_HELP}
21393
21456
  if (await this.canonical(call.cwd, cred) !== cwd || !await this.reachable(cred, cwd)) {
21394
21457
  return failed2("EACCES", `sudo: ${call.cwd} changed while the request waited`);
21395
21458
  }
21396
- if (await this.moved(bound3)) return failed2("EPERM", changedText(word));
21459
+ if (await this.moved(bound3)) return failed2("EPERM", await changedText(parsed3.command));
21397
21460
  if (answer2.answer === "once" && !answer2.person) return grant();
21398
21461
  const now = await this.bound(path, cwd, asked, caller.pid);
21399
21462
  if (!now || changedDecision(bound3.hashes, bound3, now, path) !== void 0)
21400
- return failed2("EPERM", changedText(word));
21463
+ return failed2("EPERM", await changedText(parsed3.command));
21401
21464
  const shown2 = recordable(cwd, [...parsed3.command, ...Object.keys(bound3.hashes)]);
21402
21465
  const result = answer2.answer === "once" ? grant() : await this.always(
21403
21466
  self,
@@ -21443,13 +21506,12 @@ ${SCRIPT_HELP}
21443
21506
  stamped(s, answer2, bound3 = {}) {
21444
21507
  if (answer2.person && !s.parsed.reset) this.timestamps.stamp(s.owner, s.policy, bound3);
21445
21508
  }
21446
- logged(s, cwd, argv) {
21509
+ async logged(s, cwd, argv) {
21447
21510
  const { caller, self, target, owner, policy } = s;
21448
21511
  const type = policy.type === "tty" && !owner.terminal ? "ppid" : policy.type;
21449
21512
  const tty = owner.terminal?.tty ?? caller.tty ?? "unknown";
21450
- const command = argv.map(quoteWord).join(" ");
21451
21513
  (this.o.warn ?? console.warn)(
21452
- `sudo: ${self.name} : TTY=${tty} ; PWD=${quoteWord(cwd)} ; USER=${target.name} ; TIMESTAMP=${type} ; COMMAND=${command}`
21514
+ await commandDisplay(auditPrefix(self.name, tty, cwd, target.name, `TIMESTAMP=${type}`), argv)
21453
21515
  );
21454
21516
  }
21455
21517
  async always(self, target, line, shown2, grant) {
@@ -25335,10 +25397,10 @@ var ANY_PLACEHOLDER = /fnox_proxy_[0-9a-f]{24}/g;
25335
25397
  var REQUEST_LINE2 = /^([!#$%&'*+.^_`|~0-9A-Za-z-]+) ([\x21-\x7e]+) HTTP\/1\.[01]$/;
25336
25398
  var HEADER_LINE = /^([!#$%&'*+.^_`|~0-9A-Za-z-]+):[ \t]*(.*?)[ \t]*$/;
25337
25399
  var BASIC2 = /^(Basic[ \t]+)([A-Za-z0-9+/]+={0,2})$/i;
25338
- var encoder9 = new TextEncoder();
25400
+ var encoder10 = new TextEncoder();
25339
25401
  function binary(text) {
25340
25402
  let out = "";
25341
- for (const b of encoder9.encode(text)) out += String.fromCharCode(b);
25403
+ for (const b of encoder10.encode(text)) out += String.fromCharCode(b);
25342
25404
  return out;
25343
25405
  }
25344
25406
  function sniffHttp1(start2) {
@@ -25382,7 +25444,7 @@ function replaced(text, values) {
25382
25444
  function usable2(values) {
25383
25445
  const out = {};
25384
25446
  for (const [ph, value2] of Object.entries(values ?? {}))
25385
- if (encoder9.encode(value2).length >= MIN_VALUE) out[ph] = value2;
25447
+ if (encoder10.encode(value2).length >= MIN_VALUE) out[ph] = value2;
25386
25448
  return out;
25387
25449
  }
25388
25450
  async function substituteHead(head, ask) {
@@ -25446,7 +25508,7 @@ function prepFails(prepared) {
25446
25508
  }
25447
25509
 
25448
25510
  // src/kernel/net/sealed-scram.ts
25449
- var encoder10 = new TextEncoder();
25511
+ var encoder11 = new TextEncoder();
25450
25512
  function base64Bytes(text) {
25451
25513
  try {
25452
25514
  return Uint8Array.from(atob(text), (c) => c.charCodeAt(0));
@@ -25518,7 +25580,7 @@ async function hmac(key, data) {
25518
25580
  return new Uint8Array(await crypto.subtle.sign("HMAC", k, data));
25519
25581
  }
25520
25582
  async function scramKeys(password, x) {
25521
- const base = await crypto.subtle.importKey("raw", encoder10.encode(password), "PBKDF2", false, [
25583
+ const base = await crypto.subtle.importKey("raw", encoder11.encode(password), "PBKDF2", false, [
25522
25584
  "deriveBits"
25523
25585
  ]);
25524
25586
  const salted = new Uint8Array(
@@ -25533,14 +25595,14 @@ async function scramKeys(password, x) {
25533
25595
  256
25534
25596
  )
25535
25597
  );
25536
- const clientKey = await hmac(salted, encoder10.encode("Client Key"));
25598
+ const clientKey = await hmac(salted, encoder11.encode("Client Key"));
25537
25599
  const stored = new Uint8Array(
25538
25600
  await crypto.subtle.digest("SHA-256", clientKey)
25539
25601
  );
25540
- const auth = encoder10.encode(`${x.clientFirstBare},${x.serverFirst},${x.clientFinalBare}`);
25602
+ const auth = encoder11.encode(`${x.clientFirstBare},${x.serverFirst},${x.clientFinalBare}`);
25541
25603
  const signature = await hmac(stored, auth);
25542
25604
  const proof = clientKey.map((b, i) => b ^ signature[i]);
25543
- const serverKey = await hmac(salted, encoder10.encode("Server Key"));
25605
+ const serverKey = await hmac(salted, encoder11.encode("Server Key"));
25544
25606
  const serverSignature = await hmac(serverKey, auth);
25545
25607
  for (const k of [salted, clientKey, stored, signature, serverKey]) k.fill(0);
25546
25608
  return { proof, serverSignature };
@@ -29027,20 +29089,6 @@ var PATH_FLAGS = PATH_ONLY | 65536 | 131072;
29027
29089
  var KEYBOARD = /* @__PURE__ */ new Set([SIG.INT, SIG.QUIT, SIG.TSTP]);
29028
29090
  var STUCK_ESCAPES = /* @__PURE__ */ new Set([SIG.INT, SIG.TERM, SIG.QUIT, SIG.HUP]);
29029
29091
  var DEFAULT_UMASK2 = 18;
29030
- var SUDO_VECTOR_MAX = 4096;
29031
- var SUDO_INPUT_BYTES = 1024 * 1024;
29032
- function budgetAfterArgs(args) {
29033
- if (!Array.isArray(args)) throw new KernelError("EINVAL");
29034
- if (args.length > SUDO_VECTOR_MAX) return -1;
29035
- let remaining = SUDO_INPUT_BYTES;
29036
- for (const word of args) {
29037
- if (typeof word !== "string") throw new KernelError("EINVAL");
29038
- if (word.length + 1 > remaining) return -1;
29039
- remaining -= storedSize(word) + 1;
29040
- if (remaining < 0) return -1;
29041
- }
29042
- return remaining;
29043
- }
29044
29092
  function sudoVariables(value2, term, budget) {
29045
29093
  const input = typeof value2 === "object" && value2 !== null ? value2 : {};
29046
29094
  const env = /* @__PURE__ */ Object.create(null);
@@ -31129,6 +31177,9 @@ var WasmProcess = class _WasmProcess {
31129
31177
  const { sudo } = this.options;
31130
31178
  if (!sudo) throw new KernelError("ENOSYS");
31131
31179
  const budget = budgetAfterArgs(req.args);
31180
+ if (budget === "nul")
31181
+ return { errno: "EINVAL", error: "sudo: an argument contains a NUL character" };
31182
+ if (budget === void 0) throw new KernelError("EINVAL");
31132
31183
  if (budget < 0) return { errno: "E2BIG", error: "sudo: the submitted arguments are too large" };
31133
31184
  const term = typeof req.term === "string" ? req.term : void 0;
31134
31185
  const submitted = sudoVariables(req.env, term, budget);
@@ -31162,8 +31213,7 @@ var WasmProcess = class _WasmProcess {
31162
31213
  })
31163
31214
  };
31164
31215
  } catch (err) {
31165
- if (err instanceof ChangedError)
31166
- return { error: changedText(argv[0] ?? asked), errno: err.code };
31216
+ if (err instanceof ChangedError) return { error: await changedText(argv), errno: err.code };
31167
31217
  throw err;
31168
31218
  }
31169
31219
  }
@@ -39635,7 +39685,7 @@ var LAYOUT = [
39635
39685
  var IN_TREE = /* @__PURE__ */ new Set([SUDO_PATH, VISUDO_PATH, CRONTAB_PATH, SEALED_BIN]);
39636
39686
  var LOAD_SAMPLE_MS = 5e3;
39637
39687
  var LOAD_WINDOWS_MS = [6e4, 3e5, 9e5];
39638
- var encoder11 = new TextEncoder();
39688
+ var encoder12 = new TextEncoder();
39639
39689
  var USERS_MODES = ["off", "report", "enforce"];
39640
39690
  function usersMode(mode = "off") {
39641
39691
  if (USERS_MODES.includes(mode)) return mode;
@@ -43462,7 +43512,7 @@ var Launcher = class {
43462
43512
  account,
43463
43513
  options.session
43464
43514
  );
43465
- const report = (message3) => options.onData(encoder11.encode(`${message3}\r
43515
+ const report = (message3) => options.onData(encoder12.encode(`${message3}\r
43466
43516
  `));
43467
43517
  const handle = await this.launch(planned, {
43468
43518
  ...reserved2,
@@ -43510,7 +43560,7 @@ var Launcher = class {
43510
43560
  };
43511
43561
  const stdout = collect2(out, options.onStdout);
43512
43562
  const stderr = collect2(err, options.onStderr);
43513
- const report = (message3) => stderr(encoder11.encode(`${message3}
43563
+ const report = (message3) => stderr(encoder12.encode(`${message3}
43514
43564
  `));
43515
43565
  if (!planned) {
43516
43566
  const directory = !missingFile && await this.directory(file, this.fs.resolvePath(cwd, file));
@@ -43551,21 +43601,20 @@ var Launcher = class {
43551
43601
  this.resetCatalogs();
43552
43602
  const req = { file: grant.file, argv: grant.argv, env: grant.env, cwd: grant.cwd };
43553
43603
  const ctx = { ppid: 0, cred: grant.cred, scope: "", grant };
43554
- const word = grant.argv[0] ?? grant.asked;
43555
- const requested = (err2) => {
43556
- if (err2 instanceof ChangedError) throw sudoFailure(err2.code, requestedText(word));
43604
+ const requested = async (err2) => {
43605
+ if (err2 instanceof ChangedError) throw sudoFailure(err2.code, await requestedText(grant.argv));
43557
43606
  throw err2;
43558
43607
  };
43559
- const planned = await this.planOne(req, ctx).catch((err2) => {
43560
- if (err2 instanceof ChangedError) requested(err2);
43608
+ const planned = await this.planOne(req, ctx).catch(async (err2) => {
43609
+ if (err2 instanceof ChangedError) return requested(err2);
43561
43610
  const code = sudoCause(err2);
43562
- if (code === "ENOENT") throw sudoFailure(code, `sudo: ${quoteWord(word)}: command not found`);
43563
- throw sudoFailure(code, `sudo: ${quoteWord(word)}: ${ERRNO_TEXT[code] ?? code}`);
43611
+ const reason = code === "ENOENT" ? "command not found" : ERRNO_TEXT[code] ?? code;
43612
+ throw sudoFailure(code, await wordDisplay(grant.argv, ": " + reason));
43564
43613
  });
43565
43614
  const pin = await this.unchanged(planned, grant.file, grant.cwd, grant).catch(requested);
43566
43615
  const fds = await this.sudoOutputs(options, caller, this.stackFor(tags, tagged.tagBase));
43567
43616
  const err = fds.get(2).file;
43568
- const report = (message3) => void Promise.resolve(err.write?.(encoder11.encode(`${message3}
43617
+ const report = (message3) => void Promise.resolve(err.write?.(encoder12.encode(`${message3}
43569
43618
  `))).catch(() => void 0);
43570
43619
  const replan = () => this.planOne(req, ctx);
43571
43620
  const recheck = this.approvedChain(planned, grant.file, grant.cwd, grant);
@@ -45869,7 +45918,7 @@ function dialStream(port, onClose) {
45869
45918
 
45870
45919
  // src/client/loopback-fetch.ts
45871
45920
  var OWN_HEADERS2 = /* @__PURE__ */ new Set(["host", "connection", "content-length", "transfer-encoding"]);
45872
- var encoder12 = new TextEncoder();
45921
+ var encoder13 = new TextEncoder();
45873
45922
  var latin13 = new TextDecoder("latin1");
45874
45923
  var ByteSource = class {
45875
45924
  buffered = new Uint8Array(0);
@@ -45887,7 +45936,7 @@ var ByteSource = class {
45887
45936
  return true;
45888
45937
  }
45889
45938
  async until(marker) {
45890
- const needle = encoder12.encode(marker);
45939
+ const needle = encoder13.encode(marker);
45891
45940
  for (; ; ) {
45892
45941
  const at = indexOf(this.buffered, needle);
45893
45942
  if (at >= 0) return this.take(at + needle.length);
@@ -45995,7 +46044,7 @@ async function requestBytes(request2) {
45995
46044
  });
45996
46045
  if (body) lines3.push(`Content-Length: ${body.length}`);
45997
46046
  lines3.push("Connection: close", "", "");
45998
- const head = encoder12.encode(lines3.join("\r\n"));
46047
+ const head = encoder13.encode(lines3.join("\r\n"));
45999
46048
  const out = new Uint8Array(head.length + (body?.length ?? 0));
46000
46049
  out.set(head);
46001
46050
  if (body) out.set(body, head.length);
@@ -46049,8 +46098,8 @@ var KernelCallError = class extends Error {
46049
46098
  this.code = code;
46050
46099
  }
46051
46100
  };
46052
- var encoder13 = new TextEncoder();
46053
- var bytesOf4 = (data) => typeof data === "string" ? encoder13.encode(data) : data;
46101
+ var encoder14 = new TextEncoder();
46102
+ var bytesOf4 = (data) => typeof data === "string" ? encoder14.encode(data) : data;
46054
46103
  var UNAVAILABLE = {
46055
46104
  manualRedirects: false,
46056
46105
  encodedBodies: false,