@lobehub/cli 0.0.184 → 0.0.185

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.
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import { Buffer as Buffer$1 } from "node:buffer";
15
15
  import * as net$1 from "node:net";
16
16
  import net, { BlockList, connect, createServer, isIP } from "node:net";
17
17
  import { scheduler, setImmediate as setImmediate$1, setTimeout as setTimeout$1 } from "node:timers/promises";
18
- import process$1, { cwd, execArgv, execPath, hrtime, platform as platform$1 } from "node:process";
18
+ import _w, { cwd, execArgv, execPath, hrtime, platform as platform$1 } from "node:process";
19
19
  import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
20
20
  import { finished, pipeline } from "node:stream/promises";
21
21
  import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark, pipeline as pipeline$1 } from "node:stream";
@@ -22200,7 +22200,7 @@ var require_command = /* @__PURE__ */ __commonJSMin$2(((exports) => {
22200
22200
  const childProcess$2 = __require("node:child_process");
22201
22201
  const path$16 = __require("node:path");
22202
22202
  const fs$17 = __require("node:fs");
22203
- const process$3 = __require("node:process");
22203
+ const process$2 = __require("node:process");
22204
22204
  const { Argument, humanReadableArgName } = require_argument();
22205
22205
  const { CommanderError } = require_error$1();
22206
22206
  const { Help, stripColor } = require_help();
@@ -22252,13 +22252,13 @@ var require_command = /* @__PURE__ */ __commonJSMin$2(((exports) => {
22252
22252
  this._showSuggestionAfterError = true;
22253
22253
  this._savedState = null;
22254
22254
  this._outputConfiguration = {
22255
- writeOut: (str) => process$3.stdout.write(str),
22256
- writeErr: (str) => process$3.stderr.write(str),
22255
+ writeOut: (str) => process$2.stdout.write(str),
22256
+ writeErr: (str) => process$2.stderr.write(str),
22257
22257
  outputError: (str, write) => write(str),
22258
- getOutHelpWidth: () => process$3.stdout.isTTY ? process$3.stdout.columns : void 0,
22259
- getErrHelpWidth: () => process$3.stderr.isTTY ? process$3.stderr.columns : void 0,
22260
- getOutHasColors: () => useColor() ?? (process$3.stdout.isTTY && process$3.stdout.hasColors?.()),
22261
- getErrHasColors: () => useColor() ?? (process$3.stderr.isTTY && process$3.stderr.hasColors?.()),
22258
+ getOutHelpWidth: () => process$2.stdout.isTTY ? process$2.stdout.columns : void 0,
22259
+ getErrHelpWidth: () => process$2.stderr.isTTY ? process$2.stderr.columns : void 0,
22260
+ getOutHasColors: () => useColor() ?? (process$2.stdout.isTTY && process$2.stdout.hasColors?.()),
22261
+ getErrHasColors: () => useColor() ?? (process$2.stderr.isTTY && process$2.stderr.hasColors?.()),
22262
22262
  stripColor: (str) => stripColor(str)
22263
22263
  };
22264
22264
  this._hidden = false;
@@ -22616,7 +22616,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
22616
22616
  */
22617
22617
  _exit(exitCode, code, message) {
22618
22618
  if (this._exitCallback) this._exitCallback(new CommanderError(exitCode, code, message));
22619
- process$3.exit(exitCode);
22619
+ process$2.exit(exitCode);
22620
22620
  }
22621
22621
  /**
22622
22622
  * Register callback `fn` for the command.
@@ -22955,11 +22955,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
22955
22955
  if (argv !== void 0 && !Array.isArray(argv)) throw new Error("first parameter to parse must be array or undefined");
22956
22956
  parseOptions = parseOptions || {};
22957
22957
  if (argv === void 0 && parseOptions.from === void 0) {
22958
- if (process$3.versions?.electron) parseOptions.from = "electron";
22959
- const execArgv = process$3.execArgv ?? [];
22958
+ if (process$2.versions?.electron) parseOptions.from = "electron";
22959
+ const execArgv = process$2.execArgv ?? [];
22960
22960
  if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) parseOptions.from = "eval";
22961
22961
  }
22962
- if (argv === void 0) argv = process$3.argv;
22962
+ if (argv === void 0) argv = process$2.argv;
22963
22963
  this.rawArgs = argv.slice();
22964
22964
  let userArgs;
22965
22965
  switch (parseOptions.from) {
@@ -22969,7 +22969,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
22969
22969
  userArgs = argv.slice(2);
22970
22970
  break;
22971
22971
  case "electron":
22972
- if (process$3.defaultApp) {
22972
+ if (process$2.defaultApp) {
22973
22973
  this._scriptPath = argv[1];
22974
22974
  userArgs = argv.slice(2);
22975
22975
  } else userArgs = argv.slice(1);
@@ -23134,16 +23134,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
23134
23134
  }
23135
23135
  launchWithNode = sourceExt.includes(path$16.extname(executableFile));
23136
23136
  let proc;
23137
- if (process$3.platform !== "win32") if (launchWithNode) {
23137
+ if (process$2.platform !== "win32") if (launchWithNode) {
23138
23138
  args.unshift(executableFile);
23139
- args = incrementNodeInspectorPort(process$3.execArgv).concat(args);
23140
- proc = childProcess$2.spawn(process$3.argv[0], args, { stdio: "inherit" });
23139
+ args = incrementNodeInspectorPort(process$2.execArgv).concat(args);
23140
+ proc = childProcess$2.spawn(process$2.argv[0], args, { stdio: "inherit" });
23141
23141
  } else proc = childProcess$2.spawn(executableFile, args, { stdio: "inherit" });
23142
23142
  else {
23143
23143
  this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
23144
23144
  args.unshift(executableFile);
23145
- args = incrementNodeInspectorPort(process$3.execArgv).concat(args);
23146
- proc = childProcess$2.spawn(process$3.execPath, args, { stdio: "inherit" });
23145
+ args = incrementNodeInspectorPort(process$2.execArgv).concat(args);
23146
+ proc = childProcess$2.spawn(process$2.execPath, args, { stdio: "inherit" });
23147
23147
  }
23148
23148
  if (!proc.killed) [
23149
23149
  "SIGUSR1",
@@ -23152,20 +23152,20 @@ Expecting one of '${allowedValues.join("', '")}'`);
23152
23152
  "SIGINT",
23153
23153
  "SIGHUP"
23154
23154
  ].forEach((signal) => {
23155
- process$3.on(signal, () => {
23155
+ process$2.on(signal, () => {
23156
23156
  if (proc.killed === false && proc.exitCode === null) proc.kill(signal);
23157
23157
  });
23158
23158
  });
23159
23159
  const exitCallback = this._exitCallback;
23160
23160
  proc.on("close", (code) => {
23161
23161
  code = code ?? 1;
23162
- if (!exitCallback) process$3.exit(code);
23162
+ if (!exitCallback) process$2.exit(code);
23163
23163
  else exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
23164
23164
  });
23165
23165
  proc.on("error", (err) => {
23166
23166
  if (err.code === "ENOENT") this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
23167
23167
  else if (err.code === "EACCES") throw new Error(`'${executableFile}' not executable`);
23168
- if (!exitCallback) process$3.exit(1);
23168
+ if (!exitCallback) process$2.exit(1);
23169
23169
  else {
23170
23170
  const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
23171
23171
  wrappedError.nestedError = err;
@@ -23574,13 +23574,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
23574
23574
  */
23575
23575
  _parseOptionsEnv() {
23576
23576
  this.options.forEach((option) => {
23577
- if (option.envVar && option.envVar in process$3.env) {
23577
+ if (option.envVar && option.envVar in process$2.env) {
23578
23578
  const optionKey = option.attributeName();
23579
23579
  if (this.getOptionValue(optionKey) === void 0 || [
23580
23580
  "default",
23581
23581
  "config",
23582
23582
  "env"
23583
- ].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$3.env[option.envVar]);
23583
+ ].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$2.env[option.envVar]);
23584
23584
  else this.emit(`optionEnv:${option.name()}`);
23585
23585
  }
23586
23586
  });
@@ -23997,7 +23997,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
23997
23997
  */
23998
23998
  help(contextOptions) {
23999
23999
  this.outputHelp(contextOptions);
24000
- let exitCode = Number(process$3.exitCode ?? 0);
24000
+ let exitCode = Number(process$2.exitCode ?? 0);
24001
24001
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) exitCode = 1;
24002
24002
  this._exit(exitCode, "commander.help", "(outputHelp)");
24003
24003
  }
@@ -24087,8 +24087,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
24087
24087
  * @package
24088
24088
  */
24089
24089
  function useColor() {
24090
- if (process$3.env.NO_COLOR || process$3.env.FORCE_COLOR === "0" || process$3.env.FORCE_COLOR === "false") return false;
24091
- if (process$3.env.FORCE_COLOR || process$3.env.CLICOLOR_FORCE !== void 0) return true;
24090
+ if (process$2.env.NO_COLOR || process$2.env.FORCE_COLOR === "0" || process$2.env.FORCE_COLOR === "false") return false;
24091
+ if (process$2.env.FORCE_COLOR || process$2.env.CLICOLOR_FORCE !== void 0) return true;
24092
24092
  }
24093
24093
  exports.Command = Command;
24094
24094
  exports.useColor = useColor;
@@ -60370,10 +60370,234 @@ const buildAntigravityArgs = ({ extraArgs = [], resumeSessionId }) => {
60370
60370
  ];
60371
60371
  };
60372
60372
 
60373
+ //#endregion
60374
+ //#region ../../packages/heterogeneous-agents/src/spawn/wsl.ts
60375
+ var WSL_COMMAND_PREFIX, isWslCommand, parseWslCommand, formatWslCommand, getWslExecutable, toWslPath, toWslArg, NEVER_FORWARDED, FORWARDED_PREFIXES, FORWARDED_PROXY, ENV_NAME, collectForwardedEnvNames, mergeWslEnv, buildWslSpawnPlan, WSL_PROBE_TIMEOUT_MS, WSL_LIST_TIMEOUT_MS, PATH_MARKER, COMMAND_MARKER, WSL_PROBED_COMMANDS, PROBE_SCRIPT, runWsl, decodeWslOutput, parseWslDistroList, parseWslProbeOutput, distrosPromise, distroProbes, settledPathEnv, listWslDistros, probeWslDistro, invalidateWslCache, findWslCommandCandidates, getWslPathEnv;
60376
+ var init_wsl = __esmMin((() => {
60377
+ init_config();
60378
+ WSL_COMMAND_PREFIX = "wsl://";
60379
+ isWslCommand = (command) => command.trim().toLowerCase().startsWith(WSL_COMMAND_PREFIX);
60380
+ parseWslCommand = (command) => {
60381
+ const trimmed = command.trim();
60382
+ if (!isWslCommand(trimmed)) return;
60383
+ const rest = trimmed.slice(6);
60384
+ const slash = rest.indexOf("/");
60385
+ if (slash <= 0) return;
60386
+ const linuxPath = rest.slice(slash);
60387
+ if (linuxPath.length < 2) return;
60388
+ return {
60389
+ distro: rest.slice(0, slash),
60390
+ linuxPath
60391
+ };
60392
+ };
60393
+ formatWslCommand = ({ distro, linuxPath }) => `${WSL_COMMAND_PREFIX}${distro}${linuxPath}`;
60394
+ getWslExecutable = (env = process.env) => `${(env.SystemRoot || env.SYSTEMROOT || "C:\\Windows").replace(/[\\/]+$/, "")}\\System32\\wsl.exe`;
60395
+ toWslPath = (value) => {
60396
+ const drive = value.match(/^([A-Za-z]):[\\/](.*)$/s);
60397
+ if (drive) {
60398
+ const rest = drive[2].replaceAll("\\", "/");
60399
+ return `/mnt/${drive[1].toLowerCase()}${rest ? `/${rest}` : ""}`;
60400
+ }
60401
+ const unc = value.match(/^\\\\wsl(?:\$|\.localhost)\\[^\\]+(\\.*)?$/i);
60402
+ if (unc) return (unc[1] ?? "\\").replaceAll("\\", "/");
60403
+ return value;
60404
+ };
60405
+ toWslArg = (arg) => {
60406
+ const translated = toWslPath(arg);
60407
+ if (translated !== arg) return translated;
60408
+ const flag = arg.match(/^(--?[\w-]+=)(.+)$/s);
60409
+ if (!flag) return arg;
60410
+ const value = toWslPath(flag[2]);
60411
+ return value === flag[2] ? arg : `${flag[1]}${value}`;
60412
+ };
60413
+ NEVER_FORWARDED = new Set([
60414
+ "appdata",
60415
+ "comspec",
60416
+ "home",
60417
+ "homedrive",
60418
+ "homepath",
60419
+ "localappdata",
60420
+ "path",
60421
+ "pathext",
60422
+ "programdata",
60423
+ "programfiles",
60424
+ "programfiles(x86)",
60425
+ "pwd",
60426
+ "shell",
60427
+ "systemroot",
60428
+ "temp",
60429
+ "tmp",
60430
+ "userprofile",
60431
+ "windir",
60432
+ "wslenv"
60433
+ ]);
60434
+ FORWARDED_PREFIXES = [
60435
+ "ANTHROPIC_",
60436
+ "CLAUDE_",
60437
+ "CODEX_",
60438
+ "CURSOR_",
60439
+ "DEEPSEEK_",
60440
+ "DSH_",
60441
+ "LOBEHUB_",
60442
+ "OPENAI_"
60443
+ ];
60444
+ FORWARDED_PROXY = /^(?:all|http|https|no)_proxy$/i;
60445
+ ENV_NAME = /^[A-Za-z_]\w*$/;
60446
+ collectForwardedEnvNames = (env) => Object.keys(env).filter((name) => {
60447
+ if (!ENV_NAME.test(name) || NEVER_FORWARDED.has(name.toLowerCase())) return false;
60448
+ if (env[name] === void 0) return false;
60449
+ return env[name] !== process.env[name] || FORWARDED_PREFIXES.some((prefix) => name.toUpperCase().startsWith(prefix)) || FORWARDED_PROXY.test(name);
60450
+ });
60451
+ mergeWslEnv = (current, names) => {
60452
+ const entries = (current ?? "").split(":").filter(Boolean);
60453
+ const present = new Set(entries.map((entry) => entry.split("/")[0].toLowerCase()));
60454
+ for (const name of names) if (!present.has(name.toLowerCase())) entries.push(`${name}/u`);
60455
+ return entries.join(":");
60456
+ };
60457
+ buildWslSpawnPlan = ({ distro, linuxPath }, args, env, pathEnv) => {
60458
+ const forwarded = env ? collectForwardedEnvNames(env) : [];
60459
+ return {
60460
+ args: [
60461
+ "--distribution",
60462
+ distro,
60463
+ "--exec",
60464
+ ...pathEnv ? ["env", `PATH=${pathEnv}`] : [],
60465
+ linuxPath,
60466
+ ...args.map(toWslArg)
60467
+ ],
60468
+ command: getWslExecutable(env),
60469
+ env: env && forwarded.length > 0 ? {
60470
+ ...env,
60471
+ WSLENV: mergeWslEnv(env.WSLENV, forwarded)
60472
+ } : env
60473
+ };
60474
+ };
60475
+ WSL_PROBE_TIMEOUT_MS = 2e4;
60476
+ WSL_LIST_TIMEOUT_MS = 5e3;
60477
+ PATH_MARKER = "__LOBEHUB_WSL_PATH__=";
60478
+ COMMAND_MARKER = "__LOBEHUB_WSL_CMD__=";
60479
+ WSL_PROBED_COMMANDS = [...new Set([
60480
+ ...HETEROGENEOUS_AGENT_CONFIGS.map((config) => config.defaultCommand),
60481
+ "cursor-agent",
60482
+ "dsh"
60483
+ ])].filter((name) => /^[\w.-]+$/.test(name));
60484
+ PROBE_SCRIPT = `lobehub_shell="\${SHELL:-/bin/sh}"
60485
+ case "\${lobehub_shell##*/}" in bash|zsh|ksh|sh|dash) ;; *) lobehub_shell=/bin/sh ;; esac
60486
+ "$lobehub_shell" -ilc 'printf "\\n${PATH_MARKER}%s\\n" "$PATH"; for c in "$@"; do p=$(command -v "$c" 2>/dev/null) || continue; case "$p" in /*) printf "${COMMAND_MARKER}%s=%s\\n" "$c" "$p" ;; esac; done' lobehub "$@" </dev/null
60487
+ `;
60488
+ runWsl = (args, { env, input, timeout }) => new Promise((resolve, reject) => {
60489
+ let settled = false;
60490
+ const finish = (error, output) => {
60491
+ if (settled) return;
60492
+ settled = true;
60493
+ clearTimeout(timer);
60494
+ if (error) reject(error);
60495
+ else resolve(output);
60496
+ };
60497
+ const child = spawn(getWslExecutable(env), args, {
60498
+ env: {
60499
+ ...env ?? process.env,
60500
+ WSL_UTF8: "1"
60501
+ },
60502
+ stdio: [
60503
+ "pipe",
60504
+ "pipe",
60505
+ "ignore"
60506
+ ],
60507
+ windowsHide: true
60508
+ });
60509
+ const chunks = [];
60510
+ const timer = setTimeout(() => {
60511
+ child.kill();
60512
+ finish(/* @__PURE__ */ new Error("Timed out waiting for WSL"));
60513
+ }, timeout);
60514
+ child.stdout?.on("data", (chunk) => chunks.push(chunk));
60515
+ child.on("error", (error) => finish(error));
60516
+ child.on("close", (code) => {
60517
+ if (code === 0) finish(void 0, Buffer.concat(chunks));
60518
+ else finish(/* @__PURE__ */ new Error(`wsl.exe exited with code ${code}`));
60519
+ });
60520
+ child.stdin?.on("error", () => {});
60521
+ child.stdin?.end(input ?? "");
60522
+ });
60523
+ decodeWslOutput = (output) => (output.includes(0) ? output.toString("utf16le") : output.toString("utf8")).replace(/^\uFEFF/, "");
60524
+ parseWslDistroList = (output) => output.split(/\r?\n/).map((line) => line.replaceAll("\0", "").trim()).filter((name) => name && !/^docker-desktop/i.test(name));
60525
+ parseWslProbeOutput = (output) => {
60526
+ const commands = /* @__PURE__ */ new Map();
60527
+ let pathEnv;
60528
+ for (const rawLine of output.split(/\r?\n/)) {
60529
+ const line = rawLine.trim();
60530
+ if (line.startsWith(PATH_MARKER)) pathEnv = line.slice(21) || void 0;
60531
+ else if (line.startsWith(COMMAND_MARKER)) {
60532
+ const entry = line.slice(20);
60533
+ const separator = entry.indexOf("=");
60534
+ const name = entry.slice(0, separator);
60535
+ const linuxPath = entry.slice(separator + 1);
60536
+ if (separator > 0 && linuxPath.startsWith("/")) commands.set(name, linuxPath);
60537
+ }
60538
+ }
60539
+ return {
60540
+ commands,
60541
+ pathEnv
60542
+ };
60543
+ };
60544
+ ;
60545
+ distroProbes = /* @__PURE__ */ new Map();
60546
+ settledPathEnv = /* @__PURE__ */ new Map();
60547
+ listWslDistros = () => {
60548
+ distrosPromise ??= runWsl(["--list", "--quiet"], { timeout: WSL_LIST_TIMEOUT_MS }).then((output) => parseWslDistroList(decodeWslOutput(output))).catch(() => []);
60549
+ return distrosPromise;
60550
+ };
60551
+ probeWslDistro = (distro) => {
60552
+ let probe = distroProbes.get(distro);
60553
+ if (!probe) {
60554
+ probe = runWsl([
60555
+ "--distribution",
60556
+ distro,
60557
+ "--exec",
60558
+ "sh",
60559
+ "-s",
60560
+ "--",
60561
+ ...WSL_PROBED_COMMANDS
60562
+ ], {
60563
+ input: PROBE_SCRIPT,
60564
+ timeout: WSL_PROBE_TIMEOUT_MS
60565
+ }).then((output) => {
60566
+ const result = parseWslProbeOutput(decodeWslOutput(output));
60567
+ settledPathEnv.set(distro, result.pathEnv);
60568
+ return result;
60569
+ }).catch(() => {
60570
+ distroProbes.delete(distro);
60571
+ });
60572
+ distroProbes.set(distro, probe);
60573
+ }
60574
+ return probe;
60575
+ };
60576
+ invalidateWslCache = () => {
60577
+ distrosPromise = void 0;
60578
+ distroProbes.clear();
60579
+ settledPathEnv.clear();
60580
+ };
60581
+ findWslCommandCandidates = async (command) => {
60582
+ if (platform() !== "win32") return [];
60583
+ const distros = await listWslDistros();
60584
+ const probes = await Promise.all(distros.map((distro) => probeWslDistro(distro)));
60585
+ return distros.flatMap((distro, index) => {
60586
+ const linuxPath = probes[index]?.commands.get(command);
60587
+ return linuxPath ? [formatWslCommand({
60588
+ distro,
60589
+ linuxPath
60590
+ })] : [];
60591
+ });
60592
+ };
60593
+ getWslPathEnv = async (distro) => (await probeWslDistro(distro))?.pathEnv;
60594
+ }));
60595
+
60373
60596
  //#endregion
60374
60597
  //#region ../../packages/heterogeneous-agents/src/spawn/cliSpawn.ts
60375
- var WINDOWS_EXE_EXT_PATTERN, WINDOWS_MAX_COMMAND_LINE_LENGTH, WINDOWS_NODE_EXE_PATTERN, isWindows$1, quoteWindowsCommandLineArgument, assertWindowsCommandLineFits, isPathLikeCommand$1, fileExists$1, execFileString, pickWindowsNodeExecutable, joinShimRelativePath, resolveShimPathToken, getExistingShimPathToken, resolveWindowsNodeCommand, getNodeCommand, getNodeScriptTarget, inferWindowsNodeScriptFromShim, inferWindowsExecutableFromShim, inferWindowsNpmShimTarget, resolveWindowsBareCommand, resolveCliSpawnPlan;
60598
+ var WINDOWS_EXE_EXT_PATTERN, WINDOWS_MAX_COMMAND_LINE_LENGTH, WINDOWS_NODE_EXE_PATTERN, isWindows$1, quoteWindowsCommandLineArgument, assertWindowsCommandLineFits, isPathLikeCommand$1, fileExists$1, execFileString, pickWindowsNodeExecutable, joinShimRelativePath, resolveShimPathToken, getExistingShimPathToken, resolveWindowsNodeCommand, getNodeCommand, getNodeScriptTarget, inferWindowsNodeScriptFromShim, inferWindowsExecutableFromShim, inferWindowsPowerShellShimTarget, inferWindowsNpmShimTarget, resolveWindowsBareCommand, resolveCliSpawnPlan;
60376
60599
  var init_cliSpawn = __esmMin((() => {
60600
+ init_wsl();
60377
60601
  WINDOWS_EXE_EXT_PATTERN = /\.exe$/i;
60378
60602
  WINDOWS_MAX_COMMAND_LINE_LENGTH = 32767;
60379
60603
  WINDOWS_NODE_EXE_PATTERN = /(?:^|[\\/])node(?:\.exe)?$/i;
@@ -60489,12 +60713,33 @@ var init_cliSpawn = __esmMin((() => {
60489
60713
  if (await fileExists$1(command)) return { command };
60490
60714
  }
60491
60715
  };
60716
+ inferWindowsPowerShellShimTarget = async (shimPath, source, env) => {
60717
+ const match = source.match(/\b(powershell|pwsh)(?:\.exe)?\b[^\r\n]*?-File\s+"?(%(?:~dp0|dp0%))?\\?([^"\r\n]+?\.ps1)"?/i);
60718
+ if (!match) return;
60719
+ const [, host, relativeToShim, scriptToken] = match;
60720
+ const script = relativeToShim ? joinShimRelativePath(shimPath, scriptToken) : scriptToken.replaceAll("/", "\\");
60721
+ if (!path.win32.isAbsolute(script) || !await fileExists$1(script)) return;
60722
+ const systemRoot = env?.SystemRoot || process.env.SystemRoot || "C:\\Windows";
60723
+ const command = host.toLowerCase() === "pwsh" ? "pwsh.exe" : path.win32.join(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
60724
+ return {
60725
+ argsPrefix: [
60726
+ "-NoLogo",
60727
+ "-NoProfile",
60728
+ "-NonInteractive",
60729
+ "-ExecutionPolicy",
60730
+ "Bypass",
60731
+ "-File",
60732
+ script
60733
+ ],
60734
+ command
60735
+ };
60736
+ };
60492
60737
  inferWindowsNpmShimTarget = async (shimPath, env) => {
60493
60738
  if (WINDOWS_EXE_EXT_PATTERN.test(shimPath)) return { command: shimPath };
60494
60739
  if (!await fileExists$1(shimPath)) return;
60495
60740
  try {
60496
60741
  const source = await readFile(shimPath, "utf8");
60497
- return await inferWindowsNodeScriptFromShim(shimPath, source, env) ?? await inferWindowsExecutableFromShim(shimPath, source);
60742
+ return await inferWindowsNodeScriptFromShim(shimPath, source, env) ?? await inferWindowsExecutableFromShim(shimPath, source) ?? await inferWindowsPowerShellShimTarget(shimPath, source, env);
60498
60743
  } catch {
60499
60744
  return;
60500
60745
  }
@@ -60513,6 +60758,13 @@ var init_cliSpawn = __esmMin((() => {
60513
60758
  };
60514
60759
  resolveCliSpawnPlan = async (command, args, env) => {
60515
60760
  const trimmedCommand = command.trim();
60761
+ const wslCommand = parseWslCommand(trimmedCommand);
60762
+ if (wslCommand) {
60763
+ if (!isWindows$1()) throw new Error(`A WSL command only runs on Windows: ${trimmedCommand}`);
60764
+ const wslPlan = buildWslSpawnPlan(wslCommand, args, env, await getWslPathEnv(wslCommand.distro));
60765
+ assertWindowsCommandLineFits(wslPlan);
60766
+ return wslPlan;
60767
+ }
60516
60768
  if (!isWindows$1() || !trimmedCommand) return {
60517
60769
  args,
60518
60770
  command
@@ -60537,6 +60789,7 @@ var resolveCliCommand_exports = /* @__PURE__ */ __exportAll$2({
60537
60789
  LOGIN_SHELL_TIMEOUT_STATUS_ERROR: () => LOGIN_SHELL_TIMEOUT_STATUS_ERROR,
60538
60790
  LoginShellPathTimeoutError: () => LoginShellPathTimeoutError,
60539
60791
  detectHeterogeneousCliCommand: () => detectHeterogeneousCliCommand,
60792
+ detectInWslWhenMissing: () => detectInWslWhenMissing,
60540
60793
  detectValidatedCommand: () => detectValidatedCommand,
60541
60794
  detectValidatedCommandCandidates: () => detectValidatedCommandCandidates,
60542
60795
  invalidateLoginShellPathCache: () => invalidateLoginShellPathCache,
@@ -60544,10 +60797,11 @@ var resolveCliCommand_exports = /* @__PURE__ */ __exportAll$2({
60544
60797
  resolveHeteroSpawnCommand: () => resolveHeteroSpawnCommand,
60545
60798
  resolveUserSpawnPath: () => resolveUserSpawnPath
60546
60799
  });
60547
- var execFilePromise$2, VERSION_PATTERN, extractVersion, isWindows, shellPathPromise, registryPathPromise, WINDOWS_SHELL_METAS, WINDOWS_RUNNABLE_EXTS, WINDOWS_SHIM_EXTS, WINDOWS_SHELL_MAX_COMMAND_LINE_LENGTH, isWindowsRunnablePath, isWindowsShimPath, pickWindowsRunnables, isPathLikeCommand, LOGIN_SHELL_PATH_TIMEOUT_MS, LOGIN_SHELL_TIMEOUT_STATUS_ERROR, isLoginShellTimeoutStatus, LoginShellPathTimeoutError, getLoginShellPath, cachedShellPath, shellPathGeneration, getCurrentLoginShellPath, invalidateLoginShellPathCache, WINDOWS_REGISTRY_PATH_KEYS, WINDOWS_REGISTRY_PATH_VALUE, expandWindowsEnvRefs$1, readWindowsRegistryPathValue, readMergedWindowsRegistryPath, getWindowsRegistryPath, mergePathValues, resolveUserSpawnPath, recoverProbeEnvironment, getCommandPathLines, resolveCommandCandidates, quoteWindowsShellToken, buildWindowsShellProbe, UNRESOLVED_SHIM, execProbe, detectValidatedCommandInEnvironment, isProbeableCommand, detectValidatedCommandCandidates, detectValidatedCommand, HETEROGENEOUS_CLI_AGENT_OPTIONS, DEFAULT_HETERO_COMMAND, getWellKnownCommandPaths, detectHeterogeneousCliCommand, resolveHeteroSpawnCommand;
60800
+ var execFilePromise$2, VERSION_PATTERN, extractVersion, isWindows, shellPathPromise, registryPathPromise, WINDOWS_SHELL_METAS, WINDOWS_RUNNABLE_EXTS, WINDOWS_SHIM_EXTS, WINDOWS_SHELL_MAX_COMMAND_LINE_LENGTH, isWindowsRunnablePath, isWindowsShimPath, pickWindowsRunnables, isPathLikeCommand, LOGIN_SHELL_PATH_TIMEOUT_MS, LOGIN_SHELL_TIMEOUT_STATUS_ERROR, isLoginShellTimeoutStatus, LoginShellPathTimeoutError, getLoginShellPath, cachedShellPath, shellPathGeneration, getCurrentLoginShellPath, invalidateLoginShellPathCache, WINDOWS_REGISTRY_PATH_KEYS, WINDOWS_REGISTRY_PATH_VALUE, expandWindowsEnvRefs$1, readWindowsRegistryPathValue, readMergedWindowsRegistryPath, getWindowsRegistryPath, mergePathValues, resolveUserSpawnPath, recoverProbeEnvironment, getCommandPathLines, resolveCommandCandidates, quoteWindowsShellToken, buildWindowsShellProbe, UNRESOLVED_SHIM, execProbe, detectValidatedCommandInEnvironment, isProbeableCommand, detectValidatedCommandCandidates, detectValidatedCommand, HETEROGENEOUS_CLI_AGENT_OPTIONS, DEFAULT_HETERO_COMMAND, getWellKnownCommandPaths, detectHeterogeneousCliCommand, WSL_COMMAND_NAMES, detectInWslWhenMissing, resolveHeteroSpawnCommand;
60548
60801
  var init_resolveCliCommand = __esmMin((() => {
60549
60802
  init_config();
60550
60803
  init_cliSpawn();
60804
+ init_wsl();
60551
60805
  execFilePromise$2 = promisify(execFile);
60552
60806
  VERSION_PATTERN = /v?(\d+\.\d+\.\d+(?:-[\dA-Za-z.-]+)?(?:\+[\dA-Za-z.-]+)?)/;
60553
60807
  extractVersion = (versionBanner) => versionBanner.match(VERSION_PATTERN)?.[1];
@@ -60612,6 +60866,7 @@ var init_resolveCliCommand = __esmMin((() => {
60612
60866
  return shellPathPromise;
60613
60867
  };
60614
60868
  invalidateLoginShellPathCache = () => {
60869
+ invalidateWslCache();
60615
60870
  cachedShellPath = void 0;
60616
60871
  shellPathGeneration += 1;
60617
60872
  shellPathPromise = void 0;
@@ -60743,7 +60998,7 @@ var init_resolveCliCommand = __esmMin((() => {
60743
60998
  const spawnPlan = await resolveCliSpawnPlan(command, args, env);
60744
60999
  if (isWindows() && spawnPlan.command === command && isWindowsShimPath(command)) return UNRESOLVED_SHIM;
60745
61000
  return execFilePromise$2(spawnPlan.command, spawnPlan.args, {
60746
- env,
61001
+ env: spawnPlan.env ?? env,
60747
61002
  timeout: 5e3,
60748
61003
  windowsHide: true
60749
61004
  });
@@ -60828,7 +61083,7 @@ var init_resolveCliCommand = __esmMin((() => {
60828
61083
  const inheritedStatus = await detectValidatedCommandInEnvironment(command, options, probeEnv);
60829
61084
  if (inheritedStatus.available) return inheritedStatus;
60830
61085
  lastStatus = inheritedStatus;
60831
- if (!isProbeableCommand(command)) continue;
61086
+ if (!isProbeableCommand(command) || isWslCommand(command)) continue;
60832
61087
  if (!recoveryAttempted) {
60833
61088
  recoveryAttempted = true;
60834
61089
  try {
@@ -60965,6 +61220,11 @@ var init_resolveCliCommand = __esmMin((() => {
60965
61220
  path.join(homedir(), "Library", "pnpm", "copilot")
60966
61221
  ];
60967
61222
  case "cursor":
61223
+ if (platform() === "win32") {
61224
+ const localAppData = process.env.LOCALAPPDATA;
61225
+ if (!localAppData) return [];
61226
+ return [path.win32.join(localAppData, "cursor-agent", "agent.cmd")];
61227
+ }
60968
61228
  if (platform() !== "darwin" && platform() !== "linux") return [];
60969
61229
  return [path.join(homedir(), ".local", "bin", "agent"), path.join(homedir(), ".local", "bin", "cursor-agent")];
60970
61230
  case "droid":
@@ -61036,7 +61296,19 @@ var init_resolveCliCommand = __esmMin((() => {
61036
61296
  detectHeterogeneousCliCommand = async (agentType, command, probeEnv) => {
61037
61297
  const validator = HETEROGENEOUS_CLI_AGENT_OPTIONS[agentType];
61038
61298
  if (!validator) return { available: false };
61039
- return detectValidatedCommandCandidates(command.trim() === DEFAULT_HETERO_COMMAND[agentType] ? [command, ...getWellKnownCommandPaths(agentType)] : [command], validator, probeEnv);
61299
+ const isDefaultCommand = command.trim() === DEFAULT_HETERO_COMMAND[agentType];
61300
+ const status = await detectValidatedCommandCandidates(isDefaultCommand ? [command, ...getWellKnownCommandPaths(agentType)] : [command], validator, probeEnv);
61301
+ if (!isDefaultCommand) return status;
61302
+ return detectInWslWhenMissing(status, WSL_COMMAND_NAMES[agentType] ?? [command], validator);
61303
+ };
61304
+ WSL_COMMAND_NAMES = { cursor: ["agent", "cursor-agent"] };
61305
+ detectInWslWhenMissing = async (status, commandNames, options) => {
61306
+ if (status.available || !isWindows()) return status;
61307
+ const candidates = [];
61308
+ for (const name of commandNames) candidates.push(...await findWslCommandCandidates(name));
61309
+ if (candidates.length === 0) return status;
61310
+ const wslStatus = await detectValidatedCommandCandidates(candidates, options);
61311
+ return wslStatus.available ? wslStatus : status;
61040
61312
  };
61041
61313
  resolveHeteroSpawnCommand = async (agentType, command) => {
61042
61314
  const requested = command?.trim();
@@ -61119,7 +61391,7 @@ const fetchAntigravityQuota = async (params = {}) => {
61119
61391
  const query = execFilePromise$1(plan.command, plan.args, {
61120
61392
  cwd: tmpdir(),
61121
61393
  encoding: "utf8",
61122
- env,
61394
+ env: plan.env ?? env,
61123
61395
  killSignal: "SIGKILL",
61124
61396
  maxBuffer: 1024 * 1024,
61125
61397
  timeout: 2e4,
@@ -62930,7 +63202,7 @@ var CodexAppServerClient = class {
62930
63202
  const child = spawnManaged(spawnPlan.command, spawnPlan.args, {
62931
63203
  cwd: this.options.cwd,
62932
63204
  detached: process.platform !== "win32",
62933
- env: this.options.env,
63205
+ env: spawnPlan.env ?? this.options.env,
62934
63206
  stdio: [
62935
63207
  "pipe",
62936
63208
  "pipe",
@@ -65343,7 +65615,7 @@ var AcpStdioClient = class {
65343
65615
  const child = spawnManaged(spawnPlan.command, spawnPlan.args, {
65344
65616
  cwd: this.options.cwd,
65345
65617
  detached,
65346
- env: this.options.env,
65618
+ env: spawnPlan.env ?? this.options.env,
65347
65619
  stdio: [
65348
65620
  "pipe",
65349
65621
  "pipe",
@@ -74877,8 +75149,17 @@ const isSupportedDshVersion = (version) => {
74877
75149
  * `--version` but has no `acp` profile, so it is reported unavailable here
74878
75150
  * rather than failing every turn after the agent was created.
74879
75151
  */
75152
+ /**
75153
+ * `dsh` is installed with `npm i -g`. On Windows that drops `dsh.cmd` in npm's
75154
+ * global prefix (`%APPDATA%\npm`), a directory npm's installer only adds to the
75155
+ * registry User PATH, so an app started before it never sees it.
75156
+ */
75157
+ const getDshWellKnownPaths = () => platform() === "win32" ? [path.win32.join(process.env.APPDATA || path.win32.join(homedir(), "AppData", "Roaming"), "npm", "dsh.cmd")] : [];
74880
75158
  const detectDshCommand = async (command = "dsh", env) => {
74881
- const status = await detectValidatedCommand(command, { validatePattern: DSH_VERSION_PATTERN }, env);
75159
+ const isDefaultCommand = command.trim() === "dsh";
75160
+ const validation = { validatePattern: DSH_VERSION_PATTERN };
75161
+ const nativeStatus = await detectValidatedCommandCandidates(isDefaultCommand ? [command, ...getDshWellKnownPaths()] : [command], validation, env);
75162
+ const status = isDefaultCommand ? await detectInWslWhenMissing(nativeStatus, ["dsh"], validation) : nativeStatus;
74882
75163
  if (!status.available || isSupportedDshVersion(status.version)) return status;
74883
75164
  return {
74884
75165
  ...status,
@@ -76304,7 +76585,7 @@ const spawnCliAgent = async (options, command, cwd, inputPlan, childEnv, codexJw
76304
76585
  const proc = spawnManaged(cliSpawnPlan.command, cliSpawnPlan.args, {
76305
76586
  cwd,
76306
76587
  detached,
76307
- env: childEnv,
76588
+ env: cliSpawnPlan.env ?? childEnv,
76308
76589
  stdio: [
76309
76590
  "pipe",
76310
76591
  "pipe",
@@ -76745,14 +77026,15 @@ const requestViaRpc = async (options, { failureMessage, method, params, timeoutM
76745
77026
  timeout = setTimeout(() => {
76746
77027
  settleError(/* @__PURE__ */ new Error(`${failureMessage}: RPC timed out`), true);
76747
77028
  }, timeoutMs);
76748
- resolveCliSpawnPlan(options.command ?? "codex", rpcArgs).then((spawnPlan) => {
77029
+ const childEnv = {
77030
+ ...process.env,
77031
+ ...options.env,
77032
+ ...options.codexHomePath ? { CODEX_HOME: options.codexHomePath } : {}
77033
+ };
77034
+ resolveCliSpawnPlan(options.command ?? "codex", rpcArgs, childEnv).then((spawnPlan) => {
76749
77035
  if (finished) return;
76750
77036
  child = spawn(spawnPlan.command, spawnPlan.args, {
76751
- env: {
76752
- ...process.env,
76753
- ...options.env,
76754
- ...options.codexHomePath ? { CODEX_HOME: options.codexHomePath } : {}
76755
- },
77037
+ env: spawnPlan.env ?? childEnv,
76756
77038
  stdio: [
76757
77039
  "pipe",
76758
77040
  "pipe",
@@ -306443,7 +306725,7 @@ const listHeterogeneousAgentModels = async (params) => {
306443
306725
  const { stderr, stdout } = await execFilePromise(spawnPlan.command, spawnPlan.args, {
306444
306726
  cwd,
306445
306727
  encoding: "utf8",
306446
- env,
306728
+ env: spawnPlan.env ?? env,
306447
306729
  maxBuffer: MODEL_CATALOG_MAX_BUFFER,
306448
306730
  timeout: MODEL_CATALOG_TIMEOUT_MS,
306449
306731
  windowsHide: true
@@ -334585,7 +334867,7 @@ var stdio_exports = /* @__PURE__ */ __exportAll$2({
334585
334867
  function getDefaultEnvironment() {
334586
334868
  const env = {};
334587
334869
  for (const key of DEFAULT_INHERITED_ENV_VARS) {
334588
- const value = process$1.env[key];
334870
+ const value = _w.env[key];
334589
334871
  if (value === void 0) continue;
334590
334872
  if (value.startsWith("()")) continue;
334591
334873
  env[key] = value;
@@ -334596,7 +334878,7 @@ var import_cross_spawn$1, DEFAULT_INHERITED_ENV_VARS, StdioClientTransport;
334596
334878
  var init_stdio = __esmMin((() => {
334597
334879
  init_src_CeKsbNLO();
334598
334880
  import_cross_spawn$1 = /* @__PURE__ */ __toESM$2(require_cross_spawn(), 1);
334599
- DEFAULT_INHERITED_ENV_VARS = process$1.platform === "win32" ? [
334881
+ DEFAULT_INHERITED_ENV_VARS = _w.platform === "win32" ? [
334600
334882
  "APPDATA",
334601
334883
  "COMSPEC",
334602
334884
  "HOMEDRIVE",
@@ -334653,7 +334935,7 @@ var init_stdio = __esmMin((() => {
334653
334935
  this._serverParams.stderr ?? "inherit"
334654
334936
  ],
334655
334937
  shell: false,
334656
- windowsHide: process$1.platform === "win32",
334938
+ windowsHide: _w.platform === "win32",
334657
334939
  cwd: this._serverParams.cwd
334658
334940
  });
334659
334941
  this._process.on("error", (error) => {
@@ -337687,9 +337969,9 @@ const getSubprocessResult = ({ stdout }) => {
337687
337969
  //#region node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/utils/standard-stream.js
337688
337970
  const isStandardStream = (stream) => STANDARD_STREAMS.includes(stream);
337689
337971
  const STANDARD_STREAMS = [
337690
- process$1.stdin,
337691
- process$1.stdout,
337692
- process$1.stderr
337972
+ _w.stdin,
337973
+ _w.stdout,
337974
+ _w.stderr
337693
337975
  ];
337694
337976
  const STANDARD_STREAMS_ALIASES = [
337695
337977
  "stdin",
@@ -337814,9 +338096,9 @@ const NO_ESCAPE_REGEXP = /^[\w./-]+$/;
337814
338096
  //#endregion
337815
338097
  //#region node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
337816
338098
  function isUnicodeSupported() {
337817
- const { env } = process$1;
338099
+ const { env } = _w;
337818
338100
  const { TERM, TERM_PROGRAM } = env;
337819
- if (process$1.platform !== "win32") return TERM !== "linux";
338101
+ if (_w.platform !== "win32") return TERM !== "linux";
337820
338102
  return Boolean(env.WT_SESSION) || Boolean(env.TERMINUS_SUBLIME) || env.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
337821
338103
  }
337822
338104
 
@@ -338351,7 +338633,7 @@ function traversePathUp(startPath) {
338351
338633
 
338352
338634
  //#endregion
338353
338635
  //#region node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
338354
- const npmRunPath = ({ cwd = process$1.cwd(), path: pathOption = process$1.env[pathKey()], preferLocal = true, execPath = process$1.execPath, addExecPath = true } = {}) => {
338636
+ const npmRunPath = ({ cwd = _w.cwd(), path: pathOption = _w.env[pathKey()], preferLocal = true, execPath = _w.execPath, addExecPath = true } = {}) => {
338355
338637
  const cwdPath = path.resolve(toPath(cwd));
338356
338638
  const result = [];
338357
338639
  const pathParts = pathOption.split(path.delimiter);
@@ -338369,7 +338651,7 @@ const applyExecPath = (result, pathParts, execPath, cwdPath) => {
338369
338651
  const pathPart = path.resolve(cwdPath, toPath(execPath), "..");
338370
338652
  if (!pathParts.includes(pathPart)) result.push(pathPart);
338371
338653
  };
338372
- const npmRunPathEnv = ({ env = process$1.env, ...options } = {}) => {
338654
+ const npmRunPathEnv = ({ env = _w.env, ...options } = {}) => {
338373
338655
  env = { ...env };
338374
338656
  const pathName = pathKey({ env });
338375
338657
  options.path = env[pathName];
@@ -339504,7 +339786,7 @@ const normalizeCwd = (cwd = getDefaultCwd()) => {
339504
339786
  };
339505
339787
  const getDefaultCwd = () => {
339506
339788
  try {
339507
- return process$1.cwd();
339789
+ return _w.cwd();
339508
339790
  } catch (error) {
339509
339791
  error.message = `The current directory does not exist.\n${error.message}`;
339510
339792
  throw error;
@@ -339540,7 +339822,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
339540
339822
  options.killSignal = normalizeKillSignal(options.killSignal);
339541
339823
  options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
339542
339824
  options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
339543
- if (process$1.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
339825
+ if (_w.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
339544
339826
  return {
339545
339827
  file,
339546
339828
  commandArguments,
@@ -339567,7 +339849,7 @@ const addDefaultOptions = ({ extendEnv = true, preferLocal = false, cwd, localDi
339567
339849
  });
339568
339850
  const getEnv = ({ env: envOption, extendEnv, preferLocal, node, localDirectory, nodePath }) => {
339569
339851
  const env = extendEnv ? {
339570
- ...process$1.env,
339852
+ ..._w.env,
339571
339853
  ...envOption
339572
339854
  } : envOption;
339573
339855
  if (preferLocal || node) return npmRunPathEnv({
@@ -340569,12 +340851,12 @@ const guessStreamDirection = {
340569
340851
  }
340570
340852
  };
340571
340853
  const getStandardStreamDirection = (value) => {
340572
- if ([0, process$1.stdin].includes(value)) return "input";
340854
+ if ([0, _w.stdin].includes(value)) return "input";
340573
340855
  if ([
340574
340856
  1,
340575
340857
  2,
340576
- process$1.stdout,
340577
- process$1.stderr
340858
+ _w.stdout,
340859
+ _w.stderr
340578
340860
  ].includes(value)) return "output";
340579
340861
  };
340580
340862
  const DEFAULT_DIRECTION = "output";
@@ -341638,9 +341920,9 @@ const addIpcMethods = (subprocess, { ipc }) => {
341638
341920
  Object.assign(subprocess, getIpcMethods(subprocess, false, ipc));
341639
341921
  };
341640
341922
  const getIpcExport = () => {
341641
- const anyProcess = process$1;
341923
+ const anyProcess = _w;
341642
341924
  const isSubprocess = true;
341643
- const ipc = process$1.channel !== void 0;
341925
+ const ipc = _w.channel !== void 0;
341644
341926
  return {
341645
341927
  ...getIpcMethods(anyProcess, isSubprocess, ipc),
341646
341928
  getCancelSignal: getCancelSignal$1.bind(void 0, {
@@ -342117,7 +342399,7 @@ var SignalExitFallback = class extends SignalExitBase {
342117
342399
  };
342118
342400
  var SignalExit = class extends SignalExitBase {
342119
342401
  /* c8 ignore start */
342120
- #hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
342402
+ #hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
342121
342403
  /* c8 ignore stop */
342122
342404
  #emitter = new Emitter();
342123
342405
  #process;
@@ -342212,8 +342494,8 @@ var SignalExit = class extends SignalExitBase {
342212
342494
  } else return og.call(this.#process, ev, ...args);
342213
342495
  }
342214
342496
  };
342215
- const process$2 = globalThis.process;
342216
- const { onExit, load: load$1, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
342497
+ const process$1 = globalThis.process;
342498
+ const { onExit, load: load$1, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
342217
342499
 
342218
342500
  //#endregion
342219
342501
  //#region node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/terminate/cleanup.js
@@ -555693,10 +555975,13 @@ const resolveRemotePlatformRuntime = async (type, baseEnv = process.env) => {
555693
555975
  };
555694
555976
  const validatedPath = status.path;
555695
555977
  const env = buildRemotePlatformEnvironment(status, baseEnv);
555696
- const prepareSpawn = async (args) => ({
555697
- ...await resolveCliSpawnPlan(validatedPath, args, env),
555698
- env
555699
- });
555978
+ const prepareSpawn = async (args) => {
555979
+ const plan = await resolveCliSpawnPlan(validatedPath, args, env);
555980
+ return {
555981
+ ...plan,
555982
+ env: plan.env ?? env
555983
+ };
555984
+ };
555700
555985
  return {
555701
555986
  available: true,
555702
555987
  execute: async (args, options) => executeSpawnPlan(await prepareSpawn(args), options?.timeout),
@@ -583425,7 +583710,7 @@ var RpcStdioClient = class {
583425
583710
  const child = spawnManaged(spawnPlan.command, spawnPlan.args, {
583426
583711
  cwd: this.options.cwd,
583427
583712
  detached: process.platform !== "win32" && (this.options.detached ?? true),
583428
- env: this.options.env,
583713
+ env: spawnPlan.env ?? this.options.env,
583429
583714
  stdio: [
583430
583715
  "pipe",
583431
583716
  "pipe",
@@ -583820,7 +584105,7 @@ var PiRpcClient = class {
583820
584105
  version = await new Promise((resolve, reject) => {
583821
584106
  const probe = execFile(plan.command, plan.args, {
583822
584107
  cwd: this.options.cwd,
583823
- env: this.options.env,
584108
+ env: plan.env ?? this.options.env,
583824
584109
  killSignal: "SIGKILL",
583825
584110
  signal: this.probeAbort.signal,
583826
584111
  timeout: 5e3,
package/man/man1/lh.1 CHANGED
@@ -1,6 +1,6 @@
1
1
  .\" Code generated by `npm run man:generate`; DO NOT EDIT.
2
2
  .\" Manual command details come from the Commander command tree.
3
- .TH LH 1 "" "@lobehub/cli 0.0.184" "User Commands"
3
+ .TH LH 1 "" "@lobehub/cli 0.0.185" "User Commands"
4
4
  .SH NAME
5
5
  lh \- LobeHub CLI \- manage and connect to LobeHub services
6
6
  .SH SYNOPSIS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/cli",
3
- "version": "0.0.184",
3
+ "version": "0.0.185",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/lobehub/lobehub",
@@ -83,5 +83,5 @@
83
83
  "access": "public",
84
84
  "registry": "https://registry.npmjs.org"
85
85
  },
86
- "gitHead": "e7474360fa6b0e3c196ce272585c697c995a0b15"
86
+ "gitHead": "e57ac79e1f3ba88e7b5a6f6dfaeda80a684ccebb"
87
87
  }