nexrall-code 0.5.205 → 0.5.207

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.
Files changed (2) hide show
  1. package/dist/index.js +344 -119
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11393,6 +11393,102 @@ var require_client = __commonJS({
11393
11393
  }
11394
11394
  });
11395
11395
 
11396
+ // ../core/dist/util/proc.js
11397
+ var require_proc = __commonJS({
11398
+ "../core/dist/util/proc.js"(exports) {
11399
+ "use strict";
11400
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
11401
+ if (k2 === void 0)
11402
+ k2 = k;
11403
+ var desc = Object.getOwnPropertyDescriptor(m2, k);
11404
+ if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
11405
+ desc = { enumerable: true, get: function() {
11406
+ return m2[k];
11407
+ } };
11408
+ }
11409
+ Object.defineProperty(o, k2, desc);
11410
+ } : function(o, m2, k, k2) {
11411
+ if (k2 === void 0)
11412
+ k2 = k;
11413
+ o[k2] = m2[k];
11414
+ });
11415
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
11416
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11417
+ } : function(o, v) {
11418
+ o["default"] = v;
11419
+ });
11420
+ var __importStar = exports && exports.__importStar || /* @__PURE__ */ function() {
11421
+ var ownKeys = function(o) {
11422
+ ownKeys = Object.getOwnPropertyNames || function(o2) {
11423
+ var ar = [];
11424
+ for (var k in o2)
11425
+ if (Object.prototype.hasOwnProperty.call(o2, k))
11426
+ ar[ar.length] = k;
11427
+ return ar;
11428
+ };
11429
+ return ownKeys(o);
11430
+ };
11431
+ return function(mod) {
11432
+ if (mod && mod.__esModule)
11433
+ return mod;
11434
+ var result = {};
11435
+ if (mod != null) {
11436
+ for (var k = ownKeys(mod), i2 = 0; i2 < k.length; i2++)
11437
+ if (k[i2] !== "default")
11438
+ __createBinding(result, mod, k[i2]);
11439
+ }
11440
+ __setModuleDefault(result, mod);
11441
+ return result;
11442
+ };
11443
+ }();
11444
+ Object.defineProperty(exports, "__esModule", { value: true });
11445
+ exports.DETACH_GROUP = exports.IS_WINDOWS = exports.execFile = exports.execFileSync = exports.execSync = exports.spawnSync = exports.spawn = void 0;
11446
+ exports.killProcessTree = killProcessTree3;
11447
+ var cp = __importStar(__require("child_process"));
11448
+ var isOpts = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
11449
+ function hide(args, insertAt2) {
11450
+ const out = args.slice();
11451
+ for (let i2 = 1; i2 < out.length; i2++) {
11452
+ if (isOpts(out[i2])) {
11453
+ out[i2] = { windowsHide: true, ...out[i2] };
11454
+ return out;
11455
+ }
11456
+ }
11457
+ let at = insertAt2;
11458
+ if (Array.isArray(out[1]))
11459
+ at = Math.max(at, 2);
11460
+ out.splice(at, 0, { windowsHide: true });
11461
+ return out;
11462
+ }
11463
+ exports.spawn = (...a) => cp.spawn(...hide(a, 1));
11464
+ exports.spawnSync = (...a) => cp.spawnSync(...hide(a, 1));
11465
+ exports.execSync = (...a) => cp.execSync(...hide(a, 1));
11466
+ exports.execFileSync = (...a) => cp.execFileSync(...hide(a, 1));
11467
+ exports.execFile = (...a) => cp.execFile(...hide(a, 1));
11468
+ exports.IS_WINDOWS = process.platform === "win32";
11469
+ exports.DETACH_GROUP = !exports.IS_WINDOWS;
11470
+ function killProcessTree3(pid, sig = "SIGTERM") {
11471
+ if (!pid)
11472
+ return;
11473
+ if (exports.IS_WINDOWS) {
11474
+ try {
11475
+ cp.spawnSync("taskkill", ["/PID", String(pid), "/T", "/F"], { windowsHide: true, stdio: "ignore", timeout: 5e3 });
11476
+ } catch {
11477
+ }
11478
+ return;
11479
+ }
11480
+ try {
11481
+ process.kill(-pid, sig);
11482
+ } catch {
11483
+ try {
11484
+ process.kill(pid, sig);
11485
+ } catch {
11486
+ }
11487
+ }
11488
+ }
11489
+ }
11490
+ });
11491
+
11396
11492
  // ../core/dist/tools/sandbox.js
11397
11493
  var require_sandbox = __commonJS({
11398
11494
  "../core/dist/tools/sandbox.js"(exports) {
@@ -11444,7 +11540,7 @@ var require_sandbox = __commonJS({
11444
11540
  Object.defineProperty(exports, "__esModule", { value: true });
11445
11541
  exports.parseSandboxConfig = parseSandboxConfig;
11446
11542
  exports.wrapCommandForSandbox = wrapCommandForSandbox;
11447
- var child_process_1 = __require("child_process");
11543
+ var proc_1 = require_proc();
11448
11544
  var os25 = __importStar(__require("os"));
11449
11545
  function parseSandboxConfig(raw) {
11450
11546
  if (raw === void 0 || raw === null || raw === false || raw === "off")
@@ -11467,7 +11563,7 @@ var require_sandbox = __commonJS({
11467
11563
  var _bwrapAvailable = false;
11468
11564
  function commandExists3(cmd) {
11469
11565
  try {
11470
- (0, child_process_1.execSync)(`command -v ${cmd}`, { stdio: "ignore" });
11566
+ (0, proc_1.execSync)(process.platform === "win32" ? `where ${cmd}` : `command -v ${cmd}`, { stdio: "ignore" });
11471
11567
  return true;
11472
11568
  } catch {
11473
11569
  return false;
@@ -15869,7 +15965,7 @@ var require_loader = __commonJS({
15869
15965
  var fs33 = __importStar(__require("fs"));
15870
15966
  var path36 = __importStar(__require("path"));
15871
15967
  var os25 = __importStar(__require("os"));
15872
- var child_process_1 = __require("child_process");
15968
+ var proc_1 = require_proc();
15873
15969
  var index_1 = require_plugins();
15874
15970
  var frontmatter_1 = require_frontmatter();
15875
15971
  var agentTypes_1 = require_agentTypes();
@@ -15958,7 +16054,7 @@ var require_loader = __commonJS({
15958
16054
  let out = body;
15959
16055
  out = out.replace(/!`([^`]+)`/g, (_m, c) => {
15960
16056
  try {
15961
- const stdout = (0, child_process_1.execSync)(c, {
16057
+ const stdout = (0, proc_1.execSync)(c, {
15962
16058
  cwd: workDir,
15963
16059
  encoding: "utf-8",
15964
16060
  timeout: 15e3,
@@ -16063,7 +16159,7 @@ var require_skills = __commonJS({
16063
16159
  var fs33 = __importStar(__require("fs"));
16064
16160
  var path36 = __importStar(__require("path"));
16065
16161
  var os25 = __importStar(__require("os"));
16066
- var child_process_1 = __require("child_process");
16162
+ var proc_1 = require_proc();
16067
16163
  var index_1 = require_plugins();
16068
16164
  var resolve_1 = require_resolve();
16069
16165
  var loader_1 = require_loader();
@@ -16447,7 +16543,7 @@ var require_skills = __commonJS({
16447
16543
  verdict = true;
16448
16544
  } else {
16449
16545
  try {
16450
- const r2 = (0, child_process_1.spawnSync)("git", ["-C", workDir, "check-ignore", "-q", "--", dir], {
16546
+ const r2 = (0, proc_1.spawnSync)("git", ["-C", workDir, "check-ignore", "-q", "--", dir], {
16451
16547
  stdio: "ignore",
16452
16548
  timeout: 3e3
16453
16549
  });
@@ -18583,7 +18679,7 @@ var require_executor = __commonJS({
18583
18679
  var https3 = __importStar(__require("https"));
18584
18680
  var http4 = __importStar(__require("http"));
18585
18681
  var dns = __importStar(__require("dns"));
18586
- var child_process_1 = __require("child_process");
18682
+ var proc_1 = require_proc();
18587
18683
  var sandbox_1 = require_sandbox();
18588
18684
  var auth_1 = require_auth();
18589
18685
  var client_1 = require_client();
@@ -19105,11 +19201,11 @@ Resolve the conflict (remove <<<<<<< / ======= / >>>>>>> markers and keep the in
19105
19201
  }
19106
19202
  function startBackgroundShell(command, displayCommand, workDir, note) {
19107
19203
  const id = `bg_${++_bgCounter}`;
19108
- const child = (0, child_process_1.spawn)(command, {
19204
+ const child = (0, proc_1.spawn)(command, {
19109
19205
  shell: true,
19110
19206
  cwd: workDir ?? process.cwd(),
19111
19207
  env: bashSpawnEnv(workDir),
19112
- detached: true,
19208
+ detached: proc_1.DETACH_GROUP,
19113
19209
  stdio: ["ignore", "pipe", "pipe"]
19114
19210
  });
19115
19211
  const shell = {
@@ -19224,14 +19320,10 @@ ${fresh || "(no new output)"}${trunc}` };
19224
19320
  if (shell.status === "running") {
19225
19321
  shell.status = "killed";
19226
19322
  const killTree = (sig) => {
19323
+ (0, proc_1.killProcessTree)(shell.child.pid, sig);
19227
19324
  try {
19228
- if (shell.child.pid)
19229
- process.kill(-shell.child.pid, sig);
19325
+ shell.child.kill(sig);
19230
19326
  } catch {
19231
- try {
19232
- shell.child.kill(sig);
19233
- } catch {
19234
- }
19235
19327
  }
19236
19328
  };
19237
19329
  killTree("SIGTERM");
@@ -19273,22 +19365,18 @@ ${fresh || "(no new output)"}${trunc}` };
19273
19365
  ${r2.output}`;
19274
19366
  return r2;
19275
19367
  };
19276
- const child = (0, child_process_1.spawn)(effectiveCommand, {
19368
+ const child = (0, proc_1.spawn)(effectiveCommand, {
19277
19369
  shell: true,
19278
19370
  cwd: workDir ?? process.cwd(),
19279
19371
  env: bashSpawnEnv(workDir),
19280
- detached: true,
19372
+ detached: proc_1.DETACH_GROUP,
19281
19373
  stdio: ["ignore", "pipe", "pipe"]
19282
19374
  });
19283
19375
  const killTree = (sig) => {
19376
+ (0, proc_1.killProcessTree)(child.pid, sig);
19284
19377
  try {
19285
- if (child.pid)
19286
- process.kill(-child.pid, sig);
19378
+ child.kill(sig);
19287
19379
  } catch {
19288
- try {
19289
- child.kill(sig);
19290
- } catch {
19291
- }
19292
19380
  }
19293
19381
  };
19294
19382
  const HEAD_CHARS = Math.floor(MAX_OUTPUT_CHARS * 0.25);
@@ -19473,7 +19561,7 @@ ${(0, safeSlice_1.sliceSafeStart)(output, output.length - tailLen)}`;
19473
19561
  let settled = false;
19474
19562
  let child;
19475
19563
  try {
19476
- child = (0, child_process_1.spawn)(cmd, args, { cwd: opts.cwd, stdio: ["ignore", "pipe", "pipe"] });
19564
+ child = (0, proc_1.spawn)(cmd, args, { cwd: opts.cwd, stdio: ["ignore", "pipe", "pipe"] });
19477
19565
  } catch (e2) {
19478
19566
  resolve19({ stdout: "", stderr: "", status: null, signal: null, error: e2 });
19479
19567
  return;
@@ -19610,7 +19698,7 @@ ${(0, safeSlice_1.sliceSafeStart)(output, output.length - tailLen)}`;
19610
19698
  for (const bin of ripgrepCandidates()) {
19611
19699
  if (path36.isAbsolute(bin) && !fs33.existsSync(bin))
19612
19700
  continue;
19613
- const probe = (0, child_process_1.spawnSync)(bin, ["--version"], { encoding: "utf-8", timeout: 3e3 });
19701
+ const probe = (0, proc_1.spawnSync)(bin, ["--version"], { encoding: "utf-8", timeout: 3e3 });
19614
19702
  if (probe.status === 0) {
19615
19703
  _rgBin = bin;
19616
19704
  _rgAvailable = true;
@@ -22643,7 +22731,7 @@ var require_worktree = __commonJS({
22643
22731
  exports.findWorktreeByName = findWorktreeByName2;
22644
22732
  var fs33 = __importStar(__require("fs"));
22645
22733
  var path36 = __importStar(__require("path"));
22646
- var child_process_1 = __require("child_process");
22734
+ var proc_1 = require_proc();
22647
22735
  var crypto6 = __importStar(__require("crypto"));
22648
22736
  var rules_1 = require_rules();
22649
22737
  function prRefFromUrl(spec) {
@@ -22669,7 +22757,7 @@ var require_worktree = __commonJS({
22669
22757
  }
22670
22758
  function resolveFreshStartPoint(gitRoot) {
22671
22759
  const run = (args) => {
22672
- const r2 = (0, child_process_1.spawnSync)("git", args, { cwd: gitRoot, encoding: "utf-8", timeout: 1e4 });
22760
+ const r2 = (0, proc_1.spawnSync)("git", args, { cwd: gitRoot, encoding: "utf-8", timeout: 1e4 });
22673
22761
  return { status: r2.status, stdout: r2.stdout };
22674
22762
  };
22675
22763
  const head = run(["symbolic-ref", "--quiet", "--short", "refs/remotes/origin/HEAD"]);
@@ -22698,7 +22786,7 @@ var require_worktree = __commonJS({
22698
22786
  ]);
22699
22787
  function isGitRepo2(dir) {
22700
22788
  try {
22701
- const r2 = (0, child_process_1.spawnSync)("git", ["rev-parse", "--show-toplevel"], {
22789
+ const r2 = (0, proc_1.spawnSync)("git", ["rev-parse", "--show-toplevel"], {
22702
22790
  cwd: dir,
22703
22791
  encoding: "utf-8",
22704
22792
  timeout: 5e3
@@ -22739,7 +22827,7 @@ var require_worktree = __commonJS({
22739
22827
  if (!cmd)
22740
22828
  return { ran: false, ok: false };
22741
22829
  try {
22742
- const r2 = (0, child_process_1.spawnSync)(cmd, {
22830
+ const r2 = (0, proc_1.spawnSync)(cmd, {
22743
22831
  shell: true,
22744
22832
  cwd: workDir,
22745
22833
  timeout: 6e4,
@@ -22806,7 +22894,7 @@ var require_worktree = __commonJS({
22806
22894
  let startPoint;
22807
22895
  let baseLabel;
22808
22896
  if (prRef) {
22809
- const fetched = (0, child_process_1.spawnSync)("git", ["fetch", "--no-tags", "origin", prRef.refspec], {
22897
+ const fetched = (0, proc_1.spawnSync)("git", ["fetch", "--no-tags", "origin", prRef.refspec], {
22810
22898
  cwd: git.root,
22811
22899
  encoding: "utf-8",
22812
22900
  timeout: 12e4
@@ -22817,7 +22905,7 @@ var require_worktree = __commonJS({
22817
22905
  error: `Could not fetch ${prRef.label} (${prRef.refspec}): ${(fetched.stderr ?? fetched.stdout ?? "").trim() || "unknown error"}`
22818
22906
  };
22819
22907
  }
22820
- const head = (0, child_process_1.spawnSync)("git", ["rev-parse", "FETCH_HEAD"], { cwd: git.root, encoding: "utf-8", timeout: 1e4 });
22908
+ const head = (0, proc_1.spawnSync)("git", ["rev-parse", "FETCH_HEAD"], { cwd: git.root, encoding: "utf-8", timeout: 1e4 });
22821
22909
  const sha = head.status === 0 ? (head.stdout ?? "").trim() : "";
22822
22910
  if (!/^[0-9a-f]{40}$/i.test(sha)) {
22823
22911
  return { ok: false, error: `Fetched ${prRef.label} but could not resolve its commit.` };
@@ -22834,7 +22922,7 @@ var require_worktree = __commonJS({
22834
22922
  baseLabel = startPoint;
22835
22923
  }
22836
22924
  const args = ["worktree", "add", "-b", branch, worktreePath, ...startPoint ? [startPoint] : []];
22837
- const r2 = (0, child_process_1.spawnSync)("git", args, {
22925
+ const r2 = (0, proc_1.spawnSync)("git", args, {
22838
22926
  cwd: git.root,
22839
22927
  encoding: "utf-8",
22840
22928
  timeout: 3e4
@@ -22865,7 +22953,7 @@ var require_worktree = __commonJS({
22865
22953
  function worktreeHasWork2(state) {
22866
22954
  if (state.backend === "git") {
22867
22955
  try {
22868
- const status = (0, child_process_1.spawnSync)("git", ["status", "--porcelain"], {
22956
+ const status = (0, proc_1.spawnSync)("git", ["status", "--porcelain"], {
22869
22957
  cwd: state.worktreePath,
22870
22958
  encoding: "utf-8",
22871
22959
  timeout: 1e4
@@ -22873,7 +22961,7 @@ var require_worktree = __commonJS({
22873
22961
  const meaningfulLines = (status.stdout ?? "").split("\n").filter((line) => line.trim().length > 0 && !line.includes(METADATA_FILENAME));
22874
22962
  if (meaningfulLines.length > 0)
22875
22963
  return true;
22876
- const unpushed = (0, child_process_1.spawnSync)("git", ["log", "@{u}..HEAD", "--oneline"], {
22964
+ const unpushed = (0, proc_1.spawnSync)("git", ["log", "@{u}..HEAD", "--oneline"], {
22877
22965
  cwd: state.worktreePath,
22878
22966
  encoding: "utf-8",
22879
22967
  timeout: 1e4
@@ -22911,7 +22999,7 @@ var require_worktree = __commonJS({
22911
22999
  fs33.unlinkSync(metadataPath(state.worktreePath));
22912
23000
  } catch {
22913
23001
  }
22914
- const r2 = (0, child_process_1.spawnSync)("git", ["worktree", "remove", state.worktreePath, ...opts.force ? ["--force"] : []], {
23002
+ const r2 = (0, proc_1.spawnSync)("git", ["worktree", "remove", state.worktreePath, ...opts.force ? ["--force"] : []], {
22915
23003
  cwd: state.mainCheckout,
22916
23004
  encoding: "utf-8",
22917
23005
  timeout: 3e4
@@ -22923,7 +23011,7 @@ var require_worktree = __commonJS({
22923
23011
  };
22924
23012
  }
22925
23013
  if (state.branch) {
22926
- (0, child_process_1.spawnSync)("git", ["branch", "-D", state.branch], { cwd: state.mainCheckout, encoding: "utf-8", timeout: 1e4 });
23014
+ (0, proc_1.spawnSync)("git", ["branch", "-D", state.branch], { cwd: state.mainCheckout, encoding: "utf-8", timeout: 1e4 });
22927
23015
  }
22928
23016
  return { ok: true };
22929
23017
  }
@@ -23685,7 +23773,7 @@ var require_hooks = __commonJS({
23685
23773
  var data_1 = require_data();
23686
23774
  var fs33 = __importStar(__require("fs"));
23687
23775
  var path36 = __importStar(__require("path"));
23688
- var child_process_1 = __require("child_process");
23776
+ var proc_1 = require_proc();
23689
23777
  function withAgentHooks(base, agent) {
23690
23778
  if (!agent)
23691
23779
  return base;
@@ -24019,7 +24107,7 @@ ${d.text}
24019
24107
  };
24020
24108
  let child;
24021
24109
  try {
24022
- child = (0, child_process_1.spawn)(command, {
24110
+ child = (0, proc_1.spawn)(command, {
24023
24111
  shell: true,
24024
24112
  cwd: opts.cwd,
24025
24113
  env: opts.env ?? process.env,
@@ -28722,6 +28810,50 @@ ${s2.prompt}`;
28722
28810
  var require_client2 = __commonJS({
28723
28811
  "../core/dist/mcp/client.js"(exports) {
28724
28812
  "use strict";
28813
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
28814
+ if (k2 === void 0)
28815
+ k2 = k;
28816
+ var desc = Object.getOwnPropertyDescriptor(m2, k);
28817
+ if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
28818
+ desc = { enumerable: true, get: function() {
28819
+ return m2[k];
28820
+ } };
28821
+ }
28822
+ Object.defineProperty(o, k2, desc);
28823
+ } : function(o, m2, k, k2) {
28824
+ if (k2 === void 0)
28825
+ k2 = k;
28826
+ o[k2] = m2[k];
28827
+ });
28828
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
28829
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
28830
+ } : function(o, v) {
28831
+ o["default"] = v;
28832
+ });
28833
+ var __importStar = exports && exports.__importStar || /* @__PURE__ */ function() {
28834
+ var ownKeys = function(o) {
28835
+ ownKeys = Object.getOwnPropertyNames || function(o2) {
28836
+ var ar = [];
28837
+ for (var k in o2)
28838
+ if (Object.prototype.hasOwnProperty.call(o2, k))
28839
+ ar[ar.length] = k;
28840
+ return ar;
28841
+ };
28842
+ return ownKeys(o);
28843
+ };
28844
+ return function(mod) {
28845
+ if (mod && mod.__esModule)
28846
+ return mod;
28847
+ var result = {};
28848
+ if (mod != null) {
28849
+ for (var k = ownKeys(mod), i2 = 0; i2 < k.length; i2++)
28850
+ if (k[i2] !== "default")
28851
+ __createBinding(result, mod, k[i2]);
28852
+ }
28853
+ __setModuleDefault(result, mod);
28854
+ return result;
28855
+ };
28856
+ }();
28725
28857
  Object.defineProperty(exports, "__esModule", { value: true });
28726
28858
  exports.McpClient = exports.MCP_PROTOCOL_VERSION = exports.MCP_PROTOCOL_VERSIONS = exports.MCP_ELICITATION_CAPABILITY = exports.MAX_RESULT_SIZE_CHARS = void 0;
28727
28859
  exports.toolResultSizeCap = toolResultSizeCap;
@@ -28730,7 +28862,8 @@ var require_client2 = __commonJS({
28730
28862
  exports.elicitationCapability = elicitationCapability;
28731
28863
  exports.normalizeElicitationRequest = normalizeElicitationRequest;
28732
28864
  exports.serverRequestReply = serverRequestReply;
28733
- var child_process_1 = __require("child_process");
28865
+ var path36 = __importStar(__require("path"));
28866
+ var proc_1 = require_proc();
28734
28867
  exports.MAX_RESULT_SIZE_CHARS = 5e5;
28735
28868
  function toolResultSizeCap(tool) {
28736
28869
  const raw = (tool._meta ?? {})["anthropic/maxResultSizeChars"];
@@ -28843,10 +28976,11 @@ var require_client2 = __commonJS({
28843
28976
  if (!this.config.command)
28844
28977
  throw new Error(`MCP server "${this.name}" has no command (stdio transport requires one).`);
28845
28978
  const env3 = { ...process.env, ...this.config.env ?? {} };
28846
- this._proc = (0, child_process_1.spawn)(this.config.command, this.config.args ?? [], {
28979
+ const needsShell = process.platform === "win32" && /^(npx|npm|pnpm|yarn|bunx)(\.cmd)?$/i.test(path36.basename(this.config.command));
28980
+ this._proc = (0, proc_1.spawn)(this.config.command, this.config.args ?? [], {
28847
28981
  env: env3,
28848
28982
  stdio: ["pipe", "pipe", "pipe"],
28849
- shell: false
28983
+ shell: needsShell
28850
28984
  });
28851
28985
  this._proc.stdout.on("data", (chunk) => {
28852
28986
  this._buf += chunk.toString("utf-8");
@@ -30522,7 +30656,7 @@ var require_manager2 = __commonJS({
30522
30656
  var os25 = __importStar(__require("os"));
30523
30657
  var path36 = __importStar(__require("path"));
30524
30658
  var crypto6 = __importStar(__require("crypto"));
30525
- var child_process_1 = __require("child_process");
30659
+ var proc_1 = require_proc();
30526
30660
  var MAX_SNAPSHOT_BYTES = 2 * 1024 * 1024;
30527
30661
  var MAX_PERSISTED_TURNS = 50;
30528
30662
  var MUTATING_TOOLS = /* @__PURE__ */ new Set([
@@ -30663,7 +30797,7 @@ var require_manager2 = __commonJS({
30663
30797
  }
30664
30798
  tryGitStashCreate() {
30665
30799
  try {
30666
- const r2 = (0, child_process_1.spawnSync)("git", ["stash", "create", "nexrall-checkpoint"], {
30800
+ const r2 = (0, proc_1.spawnSync)("git", ["stash", "create", "nexrall-checkpoint"], {
30667
30801
  cwd: this.workDir,
30668
30802
  encoding: "utf-8",
30669
30803
  timeout: 1e4
@@ -30921,6 +31055,7 @@ var require_askUser = __commonJS({
30921
31055
  properties: {
30922
31056
  question: { type: "string", description: "The full question, ending with a question mark." },
30923
31057
  header: { type: "string", description: "Very short label (max ~12 chars)." },
31058
+ multiSelect: { type: "boolean", description: "true when the user may pick MORE than one option (default: pick one)." },
30924
31059
  options: {
30925
31060
  type: "array",
30926
31061
  minItems: 2,
@@ -30960,7 +31095,12 @@ var require_askUser = __commonJS({
30960
31095
  const d = x2.description;
30961
31096
  options.push({ label, description: typeof d === "string" && d.trim() ? d.trim() : void 0 });
30962
31097
  }
30963
- out.push({ question, header: typeof o.header === "string" ? o.header.trim().slice(0, 14) : void 0, options });
31098
+ out.push({
31099
+ question,
31100
+ header: typeof o.header === "string" ? o.header.trim().slice(0, 14) : void 0,
31101
+ multiSelect: o.multiSelect === true ? true : void 0,
31102
+ options
31103
+ });
30964
31104
  }
30965
31105
  return out;
30966
31106
  }
@@ -30974,7 +31114,19 @@ var require_askUser = __commonJS({
30974
31114
  for (let i2 = 0; i2 < qs.length; i2++) {
30975
31115
  const a = answers[i2];
30976
31116
  const q = qs[i2];
30977
- if ("text" in a) {
31117
+ if ("indices" in a) {
31118
+ const labels = [];
31119
+ for (const ix of Array.isArray(a.indices) ? a.indices : []) {
31120
+ const opt = q.options[ix];
31121
+ if (opt && !labels.includes(opt.label))
31122
+ labels.push(opt.label);
31123
+ }
31124
+ const t2 = String(a.text ?? "").trim();
31125
+ if (!labels.length && !t2)
31126
+ return dismissed;
31127
+ const shown = labels.map((l) => `"${l}"`).join(", ");
31128
+ parts.push(`"${q.question}" = ${shown}${t2 ? `${shown ? " + " : ""}"${t2}" (user's own answer)` : ""}`);
31129
+ } else if ("text" in a) {
30978
31130
  const t2 = String(a.text ?? "").trim();
30979
31131
  if (!t2)
30980
31132
  return dismissed;
@@ -31506,7 +31658,7 @@ var require_installer = __commonJS({
31506
31658
  var fs33 = __importStar(__require("fs"));
31507
31659
  var path36 = __importStar(__require("path"));
31508
31660
  var os25 = __importStar(__require("os"));
31509
- var child_process_1 = __require("child_process");
31661
+ var proc_1 = require_proc();
31510
31662
  var client_1 = require_client();
31511
31663
  var index_1 = require_plugins();
31512
31664
  var data_1 = require_data();
@@ -31864,7 +32016,7 @@ var require_installer = __commonJS({
31864
32016
  }
31865
32017
  function extractTarball(tarFile, destDir) {
31866
32018
  fs33.mkdirSync(destDir, { recursive: true });
31867
- (0, child_process_1.execFileSync)("tar", ["-xzf", tarFile, "-C", destDir], { stdio: "pipe" });
32019
+ (0, proc_1.execFileSync)("tar", ["-xzf", tarFile, "-C", destDir], { stdio: "pipe" });
31868
32020
  const entries = fs33.readdirSync(destDir).filter((e2) => {
31869
32021
  try {
31870
32022
  return fs33.statSync(path36.join(destDir, e2)).isDirectory();
@@ -32921,7 +33073,7 @@ var require_monitor = __commonJS({
32921
33073
  exports.stopMonitor = stopMonitor;
32922
33074
  exports.stopAllMonitors = stopAllMonitors;
32923
33075
  exports.executeMonitorTool = executeMonitorTool2;
32924
- var child_process_1 = __require("child_process");
33076
+ var proc_1 = require_proc();
32925
33077
  exports.MONITOR_TOOL_NAME = "monitor";
32926
33078
  exports.DEFAULT_TIMEOUT_MS = 5 * 6e4;
32927
33079
  exports.MAX_TIMEOUT_MS = 30 * 6e4;
@@ -32949,10 +33101,8 @@ var require_monitor = __commonJS({
32949
33101
  }
32950
33102
  function killTree(m2) {
32951
33103
  try {
32952
- if (m2.child.pid)
32953
- process.kill(-m2.child.pid, "SIGTERM");
32954
- else
32955
- m2.child.kill("SIGTERM");
33104
+ (0, proc_1.killProcessTree)(m2.child.pid, "SIGTERM");
33105
+ m2.child.kill("SIGTERM");
32956
33106
  } catch {
32957
33107
  }
32958
33108
  if (m2.killTimer)
@@ -32960,8 +33110,7 @@ var require_monitor = __commonJS({
32960
33110
  m2.killTimer = setTimeout(() => {
32961
33111
  m2.killTimer = null;
32962
33112
  try {
32963
- if (m2.child.pid)
32964
- process.kill(-m2.child.pid, "SIGKILL");
33113
+ (0, proc_1.killProcessTree)(m2.child.pid, "SIGKILL");
32965
33114
  } catch {
32966
33115
  }
32967
33116
  }, m2.timing.killGraceMs);
@@ -33082,7 +33231,7 @@ var require_monitor = __commonJS({
33082
33231
  const now = opts.now ?? Date.now;
33083
33232
  const id = `mon${++_seq}`;
33084
33233
  const label = opts.label && String(opts.label).trim().slice(0, 60) || command.slice(0, 60);
33085
- const spawnFn = opts.spawnFn ?? child_process_1.spawn;
33234
+ const spawnFn = opts.spawnFn ?? proc_1.spawn;
33086
33235
  let child;
33087
33236
  try {
33088
33237
  child = spawnFn(command, {
@@ -33092,7 +33241,7 @@ var require_monitor = __commonJS({
33092
33241
  // Own process group so the deadline kill reaches `sh -c "tail -f | grep"`
33093
33242
  // trees; stdin closed so a watcher that reads blocks on nothing and gets
33094
33243
  // EOF instead of hanging the watch until its deadline.
33095
- detached: true,
33244
+ detached: proc_1.DETACH_GROUP,
33096
33245
  stdio: ["ignore", "pipe", "pipe"]
33097
33246
  });
33098
33247
  } catch (e2) {
@@ -33188,8 +33337,7 @@ var require_monitor = __commonJS({
33188
33337
  if (silent) {
33189
33338
  const m2 = _monitors.get(id);
33190
33339
  try {
33191
- if (m2.child.pid)
33192
- process.kill(-m2.child.pid, "SIGKILL");
33340
+ (0, proc_1.killProcessTree)(m2.child.pid, "SIGKILL");
33193
33341
  } catch {
33194
33342
  }
33195
33343
  finalize(m2);
@@ -33946,12 +34094,12 @@ var require_collect = __commonJS({
33946
34094
  exports.gitDiffRaw = gitDiffRaw2;
33947
34095
  exports.collectChangedFiles = collectChangedFiles2;
33948
34096
  exports.gitBranch = gitBranch2;
33949
- var child_process_1 = __require("child_process");
34097
+ var proc_1 = require_proc();
33950
34098
  var fs33 = __importStar(__require("fs"));
33951
34099
  var path36 = __importStar(__require("path"));
33952
34100
  var diffView_1 = require_diffView();
33953
34101
  function gitDiffRaw2(cwd2) {
33954
- const run = (args) => (0, child_process_1.execFileSync)("git", args, {
34102
+ const run = (args) => (0, proc_1.execFileSync)("git", args, {
33955
34103
  cwd: cwd2,
33956
34104
  encoding: "utf8",
33957
34105
  stdio: ["ignore", "pipe", "ignore"],
@@ -47675,7 +47823,7 @@ var require_mergeAssistant = __commonJS({
47675
47823
  exports.parseMergeTree = parseMergeTree2;
47676
47824
  exports.checkBranchMerges = checkBranchMerges2;
47677
47825
  exports.formatMergePanel = formatMergePanel2;
47678
- var child_process_1 = __require("child_process");
47826
+ var proc_1 = require_proc();
47679
47827
  var globalSearch_1 = require_globalSearch();
47680
47828
  var collect_1 = require_collect();
47681
47829
  exports.MAX_NODE_FILES = 40;
@@ -47691,7 +47839,7 @@ var require_mergeAssistant = __commonJS({
47691
47839
  }
47692
47840
  var gitRunnerForMerge2 = (cwd2, args) => {
47693
47841
  try {
47694
- const stdout = (0, child_process_1.execFileSync)("git", args, {
47842
+ const stdout = (0, proc_1.execFileSync)("git", args, {
47695
47843
  cwd: cwd2,
47696
47844
  encoding: "utf-8",
47697
47845
  stdio: ["ignore", "pipe", "pipe"],
@@ -80003,8 +80151,8 @@ async function scheduleRunsCommand(id, opts = {}) {
80003
80151
  }
80004
80152
 
80005
80153
  // src/commands/cloud.ts
80154
+ var import_proc = __toESM(require_proc(), 1);
80006
80155
  var import_code_core5 = __toESM(require_dist2(), 1);
80007
- import { spawn } from "child_process";
80008
80156
  async function requireAuth3() {
80009
80157
  if ((0, import_code_core5.isAuthenticated)())
80010
80158
  return true;
@@ -80040,10 +80188,11 @@ var writeRaw = (s2) => {
80040
80188
  process.stdout.write(s2);
80041
80189
  };
80042
80190
  function openUrl(url) {
80043
- const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
80044
- const args = process.platform === "win32" ? ["/c", "start", "", url] : [url];
80191
+ const win = process.platform === "win32";
80192
+ const cmd = process.platform === "darwin" ? "open" : win ? "rundll32" : "xdg-open";
80193
+ const args = win ? ["url.dll,FileProtocolHandler", url] : [url];
80045
80194
  try {
80046
- const child = spawn(cmd, args, { stdio: "ignore", detached: true });
80195
+ const child = (0, import_proc.spawn)(cmd, args, { stdio: "ignore", detached: !win });
80047
80196
  child.on("error", () => {
80048
80197
  });
80049
80198
  child.unref();
@@ -80838,13 +80987,13 @@ function paintLine(l) {
80838
80987
  var import_code_core8 = __toESM(require_dist2(), 1);
80839
80988
 
80840
80989
  // src/mcp/oauth.ts
80990
+ var import_proc2 = __toESM(require_proc(), 1);
80841
80991
  var import_code_core9 = __toESM(require_dist2(), 1);
80842
80992
  import * as fs3 from "fs";
80843
80993
  import * as os2 from "os";
80844
80994
  import * as path2 from "path";
80845
80995
  import * as http3 from "http";
80846
80996
  import * as crypto from "crypto";
80847
- import { spawn as spawn2 } from "child_process";
80848
80997
  var CALLBACK_TIMEOUT_MS = 5 * 60 * 1e3;
80849
80998
  function tokensFile(env3 = process.env) {
80850
80999
  return env3.NEXRALL_MCP_AUTH_FILE || path2.join(os2.homedir(), ".nexrall", "mcp-auth.json");
@@ -81170,9 +81319,11 @@ function b64url(buf) {
81170
81319
  return buf.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
81171
81320
  }
81172
81321
  function openInBrowser(url) {
81173
- const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
81322
+ const win = process.platform === "win32";
81323
+ const cmd = process.platform === "darwin" ? "open" : win ? "rundll32" : "xdg-open";
81324
+ const args = win ? ["url.dll,FileProtocolHandler", url] : [url];
81174
81325
  try {
81175
- const child = spawn2(cmd, [url], { stdio: "ignore", detached: true, shell: process.platform === "win32" });
81326
+ const child = (0, import_proc2.spawn)(cmd, args, { stdio: "ignore", detached: !win });
81176
81327
  child.on("error", () => void 0);
81177
81328
  child.unref();
81178
81329
  } catch {
@@ -82445,15 +82596,15 @@ async function executeMcpResourceTool(name, input, mgr) {
82445
82596
  }
82446
82597
 
82447
82598
  // src/ui/clipboardImage.ts
82599
+ var import_proc3 = __toESM(require_proc(), 1);
82448
82600
  import * as fs6 from "fs";
82449
82601
  import * as os3 from "os";
82450
82602
  import * as path5 from "path";
82451
- import { spawnSync } from "child_process";
82452
82603
  var MAX_PASTE_BYTES = 10 * 1024 * 1024;
82453
82604
  var PNG_MAGIC = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
82454
82605
  var realRunner = (cmd, args) => {
82455
82606
  try {
82456
- return spawnSync(cmd, args, { stdio: "ignore", timeout: 8e3 }).status === 0;
82607
+ return (0, import_proc3.spawnSync)(cmd, args, { stdio: "ignore", timeout: 8e3 }).status === 0;
82457
82608
  } catch {
82458
82609
  return false;
82459
82610
  }
@@ -82673,6 +82824,7 @@ var ASK_USER_TOOL_SCHEMAS = [
82673
82824
  properties: {
82674
82825
  question: { type: "string", description: "The full question, ending with a question mark." },
82675
82826
  header: { type: "string", description: "Very short label (max ~12 chars)." },
82827
+ multiSelect: { type: "boolean", description: "true when the user may pick MORE than one option (default: pick one)." },
82676
82828
  options: {
82677
82829
  type: "array",
82678
82830
  minItems: 2,
@@ -82713,10 +82865,49 @@ function parseQuestions(input) {
82713
82865
  const d = x2.description;
82714
82866
  options.push({ label, description: typeof d === "string" && d.trim() ? d.trim() : void 0 });
82715
82867
  }
82716
- out.push({ question, header: typeof o.header === "string" ? o.header.trim().slice(0, 14) : void 0, options });
82868
+ out.push({
82869
+ question,
82870
+ header: typeof o.header === "string" ? o.header.trim().slice(0, 14) : void 0,
82871
+ multiSelect: o.multiSelect === true ? true : void 0,
82872
+ options
82873
+ });
82717
82874
  }
82718
82875
  return out;
82719
82876
  }
82877
+ async function askMulti(q, io) {
82878
+ const chosen = /* @__PURE__ */ new Set();
82879
+ let typed = "";
82880
+ let at = 0;
82881
+ for (; ; ) {
82882
+ const n = q.options.length;
82883
+ const options = [
82884
+ ...q.options.map((o, i2) => ({
82885
+ key: String(i2 + 1),
82886
+ label: `${chosen.has(i2) ? "[x]" : "[ ]"} ${o.description ? `${o.label} \u2014 ${o.description}` : o.label}`
82887
+ })),
82888
+ { key: String(n + 1), label: `${typed ? "[x]" : "[ ]"} Other (type your own answer)${typed ? `: ${typed}` : ""}` },
82889
+ { key: String(n + 2), label: chosen.size || typed ? "Done \u2014 submit these" : "Done (pick at least one first)" }
82890
+ ];
82891
+ const title = `${q.header ? `${q.header}: ` : ""}${q.question}`;
82892
+ const pick = await io.choose({ title, detail: "Select all that apply \u2014 toggle with Enter / its number", options, risk: "low", defaultIndex: at, replacesInput: true });
82893
+ if (pick < 0 || pick > n + 1)
82894
+ return null;
82895
+ at = pick;
82896
+ if (pick < n) {
82897
+ if (chosen.has(pick))
82898
+ chosen.delete(pick);
82899
+ else
82900
+ chosen.add(pick);
82901
+ } else if (pick === n) {
82902
+ typed = (await io.line(" Your answer: ")).trim();
82903
+ } else if (chosen.size || typed) {
82904
+ break;
82905
+ }
82906
+ }
82907
+ const labels = [...chosen].sort((a, b) => a - b).map((i2) => `"${q.options[i2].label}"`);
82908
+ const own = typed ? `"${typed}" (user's own answer)` : "";
82909
+ return `"${q.question}" = ${[...labels, own].filter(Boolean).join(", ")}`;
82910
+ }
82720
82911
  async function executeAskUserTool(name, input, io) {
82721
82912
  if (name !== ASK_USER_TOOL_NAME)
82722
82913
  return null;
@@ -82728,7 +82919,17 @@ async function executeAskUserTool(name, input, io) {
82728
82919
  if (typeof qs === "string")
82729
82920
  return { error: qs };
82730
82921
  const answers = [];
82922
+ const dismissedResult = {
82923
+ error: "The user dismissed the question without answering. Do not assume an answer; proceed on your best judgement or stop and say what you need."
82924
+ };
82731
82925
  for (const q of qs) {
82926
+ if (q.multiSelect) {
82927
+ const r2 = await askMulti(q, io);
82928
+ if (r2 === null)
82929
+ return dismissedResult;
82930
+ answers.push(r2);
82931
+ continue;
82932
+ }
82732
82933
  const options = [
82733
82934
  ...q.options.map((o, i2) => ({
82734
82935
  key: String(i2 + 1),
@@ -82736,19 +82937,16 @@ async function executeAskUserTool(name, input, io) {
82736
82937
  })),
82737
82938
  { key: String(q.options.length + 1), label: "Other (type your own answer)" }
82738
82939
  ];
82739
- const pick = await io.choose({ title: q.header ? `${q.header}: ${q.question}` : q.question, options, risk: "low" });
82740
- const dismissed = {
82741
- error: "The user dismissed the question without answering. Do not assume an answer; proceed on your best judgement or stop and say what you need."
82742
- };
82940
+ const pick = await io.choose({ title: q.header ? `${q.header}: ${q.question}` : q.question, options, risk: "low", replacesInput: true });
82743
82941
  if (pick === q.options.length) {
82744
82942
  const typed = (await io.line(" Your answer: ")).trim();
82745
82943
  if (!typed)
82746
- return dismissed;
82944
+ return dismissedResult;
82747
82945
  answers.push(`"${q.question}" = "${typed}" (user's own answer)`);
82748
82946
  continue;
82749
82947
  }
82750
82948
  if (pick < 0 || pick > q.options.length)
82751
- return dismissed;
82949
+ return dismissedResult;
82752
82950
  answers.push(`"${q.question}" = "${q.options[pick].label}"`);
82753
82951
  }
82754
82952
  return { output: "User answered: " + answers.join("; ") };
@@ -82944,7 +83142,7 @@ function capEffortForScale(levels, effort, cap) {
82944
83142
  var import_code_core26 = __toESM(require_dist2(), 1);
82945
83143
 
82946
83144
  // src/ui/statusLine.ts
82947
- import { spawn as spawn3 } from "child_process";
83145
+ var import_proc4 = __toESM(require_proc(), 1);
82948
83146
  var STATUSLINE_TIMEOUT_MS = 2e3;
82949
83147
  var MIN_INTERVAL_MS2 = 1500;
82950
83148
  var MAX_OUTPUT_BYTES = 4096;
@@ -82991,7 +83189,7 @@ var shellRunner = (command, stdin, cwd2, timeoutMs) => new Promise((resolve19) =
82991
83189
  };
82992
83190
  let child;
82993
83191
  try {
82994
- child = spawn3(command, { shell: true, cwd: cwd2, stdio: ["pipe", "pipe", "ignore"], env: process.env });
83192
+ child = (0, import_proc4.spawn)(command, { shell: true, cwd: cwd2, stdio: ["pipe", "pipe", "ignore"], env: process.env });
82995
83193
  } catch {
82996
83194
  resolve19(null);
82997
83195
  return;
@@ -84773,12 +84971,12 @@ function formatDeployTargets(targets, cols3) {
84773
84971
  }
84774
84972
 
84775
84973
  // src/commands/chat.ts
84974
+ var import_proc12 = __toESM(require_proc(), 1);
84776
84975
  var import_code_core66 = __toESM(require_dist2(), 1);
84777
84976
  import * as os17 from "os";
84778
84977
  import * as crypto4 from "crypto";
84779
84978
  import { createRequire } from "module";
84780
84979
  import { fileURLToPath as fileURLToPath2 } from "url";
84781
- import { execFile as execFile2, execFileSync as execFileSync6 } from "child_process";
84782
84980
 
84783
84981
  // src/permissions/handler.ts
84784
84982
  import * as readline2 from "readline";
@@ -87053,17 +87251,17 @@ function debugLog(event, fields) {
87053
87251
  }
87054
87252
 
87055
87253
  // src/commands/doctor.ts
87254
+ var import_proc6 = __toESM(require_proc(), 1);
87056
87255
  var import_code_core46 = __toESM(require_dist2(), 1);
87057
87256
  import fs11 from "fs";
87058
87257
  import os6 from "os";
87059
87258
  import path13 from "path";
87060
- import { spawnSync as spawnSync3, execFileSync as execFileSync2 } from "child_process";
87061
87259
 
87062
87260
  // src/commands/sessionTools.ts
87261
+ var import_proc5 = __toESM(require_proc(), 1);
87063
87262
  var import_code_core42 = __toESM(require_dist2(), 1);
87064
87263
  var import_code_core43 = __toESM(require_dist2(), 1);
87065
87264
  var import_code_core44 = __toESM(require_dist2(), 1);
87066
- import { spawnSync as spawnSync2, execFileSync } from "child_process";
87067
87265
  var UsageTotals = class {
87068
87266
  input = 0;
87069
87267
  output = 0;
@@ -87156,7 +87354,7 @@ function copyToClipboard(text, platform3 = process.platform) {
87156
87354
  ];
87157
87355
  for (const [cmd, args] of candidates) {
87158
87356
  try {
87159
- const r2 = spawnSync2(cmd, args, { input: text, stdio: ["pipe", "ignore", "ignore"], timeout: 5e3 });
87357
+ const r2 = (0, import_proc5.spawnSync)(cmd, args, { input: text, stdio: ["pipe", "ignore", "ignore"], timeout: 5e3 });
87160
87358
  if (!r2.error && r2.status === 0)
87161
87359
  return cmd;
87162
87360
  } catch {
@@ -87168,7 +87366,7 @@ function osc52(text) {
87168
87366
  return `\x1B]52;c;${Buffer.from(text, "utf8").toString("base64")}\x07`;
87169
87367
  }
87170
87368
  function gitChanges(cwd2) {
87171
- const run = (args) => execFileSync("git", args, { cwd: cwd2, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 1e4 }).trimEnd();
87369
+ const run = (args) => (0, import_proc5.execFileSync)("git", args, { cwd: cwd2, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 1e4 }).trimEnd();
87172
87370
  try {
87173
87371
  run(["rev-parse", "--is-inside-work-tree"]);
87174
87372
  return { status: run(["status", "--short"]), stat: run(["diff", "--stat", "HEAD"]) };
@@ -87649,7 +87847,7 @@ function doctorExitCode(checks) {
87649
87847
  return checks.some((c) => c.status === "fail") ? 1 : 0;
87650
87848
  }
87651
87849
  function commandExists(cmd, platform3 = process.platform) {
87652
- const r2 = spawnSync3(platform3 === "win32" ? "where" : "which", [cmd], { stdio: "ignore", timeout: 5e3 });
87850
+ const r2 = (0, import_proc6.spawnSync)(platform3 === "win32" ? "where" : "which", [cmd], { stdio: "ignore", timeout: 5e3 });
87653
87851
  return !r2.error && r2.status === 0;
87654
87852
  }
87655
87853
  function ripgrepInstallHint(platform3) {
@@ -87700,7 +87898,7 @@ function realProbes(c) {
87700
87898
  resolveRipgrep: () => (0, import_code_core46.resolveRipgrepBinary)(),
87701
87899
  gitInfo: () => {
87702
87900
  try {
87703
- execFileSync2("git", ["rev-parse", "--is-inside-work-tree"], { cwd: c.workDir, stdio: "ignore", timeout: 5e3 });
87901
+ (0, import_proc6.execFileSync)("git", ["rev-parse", "--is-inside-work-tree"], { cwd: c.workDir, stdio: "ignore", timeout: 5e3 });
87704
87902
  return { inRepo: true, branch: (0, import_code_core43.gitBranch)(c.workDir) ?? void 0 };
87705
87903
  } catch {
87706
87904
  return { inRepo: false };
@@ -88167,7 +88365,7 @@ async function enableAppleTerminalOptionAsMeta(deps) {
88167
88365
  }
88168
88366
 
88169
88367
  // src/commands/update.ts
88170
- import { execFileSync as execFileSync3, spawn as spawn4 } from "child_process";
88368
+ var import_proc7 = __toESM(require_proc(), 1);
88171
88369
  import * as fs13 from "fs";
88172
88370
  import * as https2 from "https";
88173
88371
  import * as path16 from "path";
@@ -88220,7 +88418,7 @@ function installArgs(version) {
88220
88418
  }
88221
88419
  function installedGlobalVersion() {
88222
88420
  try {
88223
- const root = execFileSync3("npm", ["root", "-g"], { encoding: "utf-8" }).trim();
88421
+ const root = (0, import_proc7.execFileSync)("npm", ["root", "-g"], { encoding: "utf-8" }).trim();
88224
88422
  return JSON.parse(fs13.readFileSync(path16.join(root, "nexrall-code", "package.json"), "utf-8")).version ?? null;
88225
88423
  } catch {
88226
88424
  return null;
@@ -88228,7 +88426,7 @@ function installedGlobalVersion() {
88228
88426
  }
88229
88427
  function npmInstallGlobal(version) {
88230
88428
  return new Promise((resolve19) => {
88231
- const child = spawn4("npm", installArgs(version), { stdio: "pipe" });
88429
+ const child = (0, import_proc7.spawn)("npm", installArgs(version), { stdio: "pipe" });
88232
88430
  let stderr = "";
88233
88431
  child.stderr?.on("data", (c) => {
88234
88432
  stderr += c.toString();
@@ -88237,7 +88435,7 @@ function npmInstallGlobal(version) {
88237
88435
  if (code === 0)
88238
88436
  return resolve19({ ok: true, usedSudo: false });
88239
88437
  if (/EACCES|permission denied/i.test(stderr)) {
88240
- const sudo = spawn4("sudo", ["npm", ...installArgs(version)], { stdio: "inherit" });
88438
+ const sudo = (0, import_proc7.spawn)("sudo", ["npm", ...installArgs(version)], { stdio: "inherit" });
88241
88439
  sudo.on("close", (sudoCode) => resolve19({ ok: sudoCode === 0, usedSudo: true }));
88242
88440
  } else {
88243
88441
  console.error(paint.dim(stderr.trim()));
@@ -99275,9 +99473,9 @@ function decidePick(item, tab2) {
99275
99473
  }
99276
99474
 
99277
99475
  // src/commands/bangShell.ts
99476
+ var import_proc8 = __toESM(require_proc(), 1);
99278
99477
  var import_code_core50 = __toESM(require_dist2(), 1);
99279
99478
  var import_code_core51 = __toESM(require_dist2(), 1);
99280
- import { spawn as spawn5 } from "child_process";
99281
99479
  function parseBang(line) {
99282
99480
  const t2 = line.trim();
99283
99481
  if (!t2.startsWith("!"))
@@ -99300,18 +99498,14 @@ function runBang(cmd, opts) {
99300
99498
  let aborted = false;
99301
99499
  let settled = false;
99302
99500
  let detached = false;
99303
- const child = spawn5("bash", ["-c", cmd], {
99304
- cwd: opts.cwd,
99305
- env: opts.env ?? process.env,
99306
- stdio: ["ignore", "pipe", "pipe"],
99307
- detached: process.platform !== "win32"
99308
- });
99501
+ const common = { cwd: opts.cwd, env: opts.env ?? process.env, stdio: ["ignore", "pipe", "pipe"] };
99502
+ const child = import_proc8.IS_WINDOWS ? (0, import_proc8.spawn)(cmd, { ...common, shell: true }) : (0, import_proc8.spawn)("bash", ["-c", cmd], { ...common, detached: true });
99309
99503
  const kill = () => {
99310
99504
  try {
99311
99505
  if (child.pid && process.platform !== "win32")
99312
99506
  process.kill(-child.pid, "SIGTERM");
99313
99507
  else
99314
- child.kill("SIGTERM");
99508
+ (0, import_proc8.killProcessTree)(child.pid);
99315
99509
  } catch {
99316
99510
  }
99317
99511
  setTimeout(() => {
@@ -99472,16 +99666,16 @@ function searchMeta(scope, origin) {
99472
99666
  var SEARCH_HINT = " type to search \xB7 Ctrl+R older \xB7 Ctrl+S all/this project \xB7 Enter/Tab use it \xB7 Esc cancel";
99473
99667
 
99474
99668
  // src/ui/externalEditor.ts
99669
+ var import_proc9 = __toESM(require_proc(), 1);
99475
99670
  import * as fs20 from "fs";
99476
99671
  import * as os13 from "os";
99477
99672
  import * as path20 from "path";
99478
- import { spawnSync as spawnSync4 } from "child_process";
99479
99673
  function resolveEditor(env3) {
99480
99674
  const pick = (v) => v && v.trim() ? v.trim() : null;
99481
99675
  return pick(env3.VISUAL) ?? pick(env3.EDITOR) ?? "vi";
99482
99676
  }
99483
99677
  function defaultRun(editor, file) {
99484
- const r2 = spawnSync4("sh", ["-c", `${editor} "$1"`, "sh", file], { stdio: "inherit" });
99678
+ const r2 = process.platform === "win32" ? (0, import_proc9.spawnSync)(`${editor} "${file}"`, { stdio: "inherit", shell: true }) : (0, import_proc9.spawnSync)("sh", ["-c", `${editor} "$1"`, "sh", file], { stdio: "inherit" });
99485
99679
  return { status: r2.status, error: r2.error };
99486
99680
  }
99487
99681
  function editInEditor(text, opts = {}) {
@@ -99514,7 +99708,7 @@ function editInEditor(text, opts = {}) {
99514
99708
  }
99515
99709
 
99516
99710
  // src/ui/openInEditor.ts
99517
- import { spawn as spawn6, spawnSync as spawnSync5 } from "node:child_process";
99711
+ var import_proc10 = __toESM(require_proc(), 1);
99518
99712
  import * as fs21 from "node:fs";
99519
99713
  import * as os14 from "node:os";
99520
99714
  import * as path21 from "node:path";
@@ -99734,7 +99928,7 @@ function launchEditor(spec, target, opts = {}) {
99734
99928
  const needsShell = /\s/.test(spec.command);
99735
99929
  const argv = () => needsShell ? ["sh", ["-c", `${spec.command} "$@"`, "sh", ...args]] : [spec.command, args];
99736
99930
  if (spec.kind === "gui") {
99737
- const runSpawn = opts.spawnImpl ?? spawn6;
99931
+ const runSpawn = opts.spawnImpl ?? import_proc10.spawn;
99738
99932
  try {
99739
99933
  const child = runSpawn(...argv(), { detached: true, stdio: "ignore" });
99740
99934
  child.on("error", (e2) => opts.onAsyncError?.(`could not start ${spec.command}: ${e2.message}`));
@@ -99744,7 +99938,7 @@ function launchEditor(spec, target, opts = {}) {
99744
99938
  return { ok: false, reason: `could not start ${spec.command}: ${e2.message}` };
99745
99939
  }
99746
99940
  }
99747
- const r2 = (opts.spawnSyncImpl ?? spawnSync5)(...argv(), { stdio: "inherit" });
99941
+ const r2 = (opts.spawnSyncImpl ?? import_proc10.spawnSync)(...argv(), { stdio: "inherit" });
99748
99942
  if (r2.error)
99749
99943
  return { ok: false, reason: `could not start ${spec.command}: ${r2.error.message}` };
99750
99944
  if (typeof r2.status === "number" && r2.status !== 0)
@@ -99761,9 +99955,9 @@ function describeOpen(spec, target, cwd2) {
99761
99955
  }
99762
99956
 
99763
99957
  // src/ui/fileMention.ts
99958
+ var import_proc11 = __toESM(require_proc(), 1);
99764
99959
  import * as fs22 from "fs";
99765
99960
  import * as path22 from "path";
99766
- import { execFile, execFileSync as execFileSync5 } from "child_process";
99767
99961
 
99768
99962
  // src/ui/contextFiles.ts
99769
99963
  var import_code_core52 = __toESM(require_dist2(), 1);
@@ -99808,7 +100002,7 @@ function listProjectFiles(cwd2) {
99808
100002
  function listProjectFilesFrom(cwd2) {
99809
100003
  let files = null;
99810
100004
  try {
99811
- const out = execFileSync5("git", ["-C", cwd2, "ls-files", "-co", "--exclude-standard", "-z"], {
100005
+ const out = (0, import_proc11.execFileSync)("git", ["-C", cwd2, "ls-files", "-co", "--exclude-standard", "-z"], {
99812
100006
  encoding: "utf-8",
99813
100007
  maxBuffer: 64 * 1024 * 1024,
99814
100008
  stdio: ["ignore", "pipe", "ignore"],
@@ -99944,7 +100138,7 @@ function primeMentionIndex(cwd2) {
99944
100138
  building.cancelled = true;
99945
100139
  const job = { cwd: cwd2, cancelled: false };
99946
100140
  building = job;
99947
- execFile(
100141
+ (0, import_proc11.execFile)(
99948
100142
  "git",
99949
100143
  ["-C", cwd2, "ls-files", "-co", "--exclude-standard", "-z"],
99950
100144
  {
@@ -100187,6 +100381,7 @@ function choiceView(spec, sel, maxRows) {
100187
100381
  });
100188
100382
  const range = size < n ? `rows ${start + 1}-${start + size} of ${n} \xB7 ` : "";
100189
100383
  return {
100384
+ replacesInput: spec.replacesInput === true,
100190
100385
  title: spec.title,
100191
100386
  detail: spec.detail,
100192
100387
  risk: spec.risk,
@@ -102012,7 +102207,7 @@ var App2 = ({ onReady }) => {
102012
102207
  borderRight: false,
102013
102208
  borderDimColor: colorsOn
102014
102209
  }
102015
- ), /* @__PURE__ */ import_react36.default.createElement(Box_default, { ref: inputRowRef }, /* @__PURE__ */ import_react36.default.createElement(Text, { wrap: "hard" }, /* @__PURE__ */ import_react36.default.createElement(Text, null, promptFor(shownPrompt)), vsel ? /* @__PURE__ */ import_react36.default.createElement(import_react36.default.Fragment, null, /* @__PURE__ */ import_react36.default.createElement(Text, null, inputView.text.slice(0, vsel.from)), /* @__PURE__ */ import_react36.default.createElement(Text, { inverse: true }, inputView.text.slice(vsel.from, vsel.to)), /* @__PURE__ */ import_react36.default.createElement(Text, null, inputView.text.slice(vsel.to))) : /* @__PURE__ */ import_react36.default.createElement(import_react36.default.Fragment, null, /* @__PURE__ */ import_react36.default.createElement(Text, null, slices.before), /* @__PURE__ */ import_react36.default.createElement(Text, { inverse: true }, slices.atCursor), /* @__PURE__ */ import_react36.default.createElement(Text, null, slices.after), suggestion && line === "" && !isAxMode() ? /* @__PURE__ */ import_react36.default.createElement(Text, { dimColor: colorsOn }, suggestion) : null))), isAxMode() ? /* @__PURE__ */ import_react36.default.createElement(Box_default, { height: 1 }) : /* @__PURE__ */ import_react36.default.createElement(
102210
+ ), choiceVm?.replacesInput ? null : /* @__PURE__ */ import_react36.default.createElement(Box_default, { ref: inputRowRef }, /* @__PURE__ */ import_react36.default.createElement(Text, { wrap: "hard" }, /* @__PURE__ */ import_react36.default.createElement(Text, null, promptFor(shownPrompt)), vsel ? /* @__PURE__ */ import_react36.default.createElement(import_react36.default.Fragment, null, /* @__PURE__ */ import_react36.default.createElement(Text, null, inputView.text.slice(0, vsel.from)), /* @__PURE__ */ import_react36.default.createElement(Text, { inverse: true }, inputView.text.slice(vsel.from, vsel.to)), /* @__PURE__ */ import_react36.default.createElement(Text, null, inputView.text.slice(vsel.to))) : /* @__PURE__ */ import_react36.default.createElement(import_react36.default.Fragment, null, /* @__PURE__ */ import_react36.default.createElement(Text, null, slices.before), /* @__PURE__ */ import_react36.default.createElement(Text, { inverse: true }, slices.atCursor), /* @__PURE__ */ import_react36.default.createElement(Text, null, slices.after), suggestion && line === "" && !isAxMode() ? /* @__PURE__ */ import_react36.default.createElement(Text, { dimColor: colorsOn }, suggestion) : null))), isAxMode() ? /* @__PURE__ */ import_react36.default.createElement(Box_default, { height: 1 }) : /* @__PURE__ */ import_react36.default.createElement(
102016
102211
  Box_default,
102017
102212
  {
102018
102213
  borderStyle: "single",
@@ -104298,7 +104493,7 @@ function agentFooterBadge() {
104298
104493
  }
104299
104494
  var runGitForMerge = (cwd2, args) => {
104300
104495
  try {
104301
- const stdout = execFileSync6("git", args, {
104496
+ const stdout = (0, import_proc12.execFileSync)("git", args, {
104302
104497
  cwd: cwd2,
104303
104498
  encoding: "utf-8",
104304
104499
  stdio: ["ignore", "pipe", "pipe"],
@@ -104555,7 +104750,7 @@ function resolveModelLabel(alias) {
104555
104750
  async function tryExecAsync(file, args, cwd2) {
104556
104751
  return new Promise((resolve19) => {
104557
104752
  try {
104558
- execFile2(file, args, { cwd: cwd2, encoding: "utf-8" }, (err, stdout) => {
104753
+ (0, import_proc12.execFile)(file, args, { cwd: cwd2, encoding: "utf-8" }, (err, stdout) => {
104559
104754
  resolve19(err ? void 0 : String(stdout).trim() || void 0);
104560
104755
  });
104561
104756
  } catch {
@@ -110577,7 +110772,7 @@ ${text}
110577
110772
  const res = await enableAppleTerminalOptionAsMeta({
110578
110773
  run: async (cmd2, args) => {
110579
110774
  try {
110580
- const stdout = execFileSync6(cmd2, args, { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] });
110775
+ const stdout = (0, import_proc12.execFileSync)(cmd2, args, { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] });
110581
110776
  return { code: 0, stdout };
110582
110777
  } catch (err) {
110583
110778
  const e2 = err;
@@ -112146,11 +112341,11 @@ function pluginSourceRemoveCommand(name, opts) {
112146
112341
  }
112147
112342
 
112148
112343
  // src/commands/pluginEvalCmd.ts
112344
+ var import_proc13 = __toESM(require_proc(), 1);
112149
112345
  var import_code_core71 = __toESM(require_dist2(), 1);
112150
112346
  import * as fs27 from "fs";
112151
112347
  import * as os18 from "os";
112152
112348
  import * as path28 from "path";
112153
- import { spawn as spawn7 } from "node:child_process";
112154
112349
  function pluginEvalInitCommand(dir) {
112155
112350
  const target = path28.resolve(dir ?? process.cwd());
112156
112351
  const displayPath = (p) => {
@@ -112262,7 +112457,7 @@ function walkFiles(root) {
112262
112457
  }
112263
112458
  function runChild(args, cwd2, env3, timeoutMs) {
112264
112459
  return new Promise((resolve19) => {
112265
- const child = spawn7(process.execPath, args, {
112460
+ const child = (0, import_proc13.spawn)(process.execPath, args, {
112266
112461
  cwd: cwd2,
112267
112462
  env: env3,
112268
112463
  stdio: ["ignore", "pipe", "pipe"]
@@ -112770,11 +112965,11 @@ async function projectPurgeCommand(dir, opts = {}) {
112770
112965
  }
112771
112966
 
112772
112967
  // src/commands/sessionPlugins.ts
112968
+ var import_proc14 = __toESM(require_proc(), 1);
112773
112969
  var import_code_core73 = __toESM(require_dist2(), 1);
112774
112970
  import * as fs29 from "node:fs";
112775
112971
  import * as os20 from "node:os";
112776
112972
  import * as path30 from "node:path";
112777
- import { spawnSync as spawnSync6 } from "node:child_process";
112778
112973
  var MAX_ARCHIVE_BYTES = 50 * 1024 * 1024;
112779
112974
  function mkTemp(label) {
112780
112975
  return fs29.mkdtempSync(path30.join(os20.tmpdir(), `nex-${label}-`));
@@ -112796,7 +112991,14 @@ function descendIntoWrapper(root) {
112796
112991
  return root;
112797
112992
  }
112798
112993
  function extractZip(archive, dest) {
112799
- const r2 = spawnSync6("unzip", ["-o", "-q", archive, "-d", dest], { encoding: "utf-8", timeout: 6e4 });
112994
+ if (process.platform === "win32") {
112995
+ const t2 = (0, import_proc14.spawnSync)("tar", ["-xf", archive, "-C", dest], { encoding: "utf-8", timeout: 6e4 });
112996
+ if (t2.status !== 0) {
112997
+ return { ok: false, error: `tar failed: ${(t2.stderr ?? "").trim() || (t2.error?.message ?? "unknown error")}` };
112998
+ }
112999
+ return { ok: true };
113000
+ }
113001
+ const r2 = (0, import_proc14.spawnSync)("unzip", ["-o", "-q", archive, "-d", dest], { encoding: "utf-8", timeout: 6e4 });
112800
113002
  if (r2.error && r2.error.code === "ENOENT") {
112801
113003
  return { ok: false, error: "The `unzip` command was not found \u2014 install it, or use a .tar.gz archive." };
112802
113004
  }
@@ -112806,7 +113008,7 @@ function extractZip(archive, dest) {
112806
113008
  return { ok: true };
112807
113009
  }
112808
113010
  function extractTarGz(archive, dest) {
112809
- const r2 = spawnSync6("tar", ["-xzf", archive, "-C", dest], { encoding: "utf-8", timeout: 6e4 });
113011
+ const r2 = (0, import_proc14.spawnSync)("tar", ["-xzf", archive, "-C", dest], { encoding: "utf-8", timeout: 6e4 });
112810
113012
  if (r2.status !== 0) {
112811
113013
  return { ok: false, error: `tar failed: ${(r2.stderr ?? "").trim() || (r2.error?.message ?? "unknown error")}` };
112812
113014
  }
@@ -113173,11 +113375,11 @@ async function autoModeResetCommand(opts) {
113173
113375
  var import_code_core79 = __toESM(require_dist2(), 1);
113174
113376
 
113175
113377
  // src/commands/bgJobs.ts
113378
+ var import_proc15 = __toESM(require_proc(), 1);
113176
113379
  import * as fs31 from "node:fs";
113177
113380
  import * as os22 from "node:os";
113178
113381
  import * as path32 from "node:path";
113179
113382
  import * as crypto5 from "node:crypto";
113180
- import { spawn as spawn8 } from "node:child_process";
113181
113383
  function bgDir(env3 = process.env) {
113182
113384
  return env3.NEXRALL_CLI_BG_DIR || path32.join(os22.homedir(), ".nexrall", "cli-bg");
113183
113385
  }
@@ -113240,9 +113442,11 @@ function startJob(o) {
113240
113442
  const codeFile = path32.join(dir, `${id}.code`);
113241
113443
  const fd = fs31.openSync(log, "a");
113242
113444
  const command = o.shell !== void 0 ? ["/bin/sh", "-c", o.shell] : [o.execPath ?? process.execPath, o.script ?? "", ...o.args ?? []];
113243
- const child = spawn8("/bin/sh", ["-c", '"$@"; echo $? > "$0"', codeFile, ...command], {
113445
+ const [wrapBin, wrapArgs] = wrapperArgv(codeFile, command, o.shell, process.execPath);
113446
+ const child = (0, import_proc15.spawn)(wrapBin, wrapArgs, {
113244
113447
  cwd: o.cwd,
113245
- detached: true,
113448
+ detached: !import_proc15.IS_WINDOWS,
113449
+ // detached on Windows = DETACHED_PROCESS: ignores windowsHide, pops a console
113246
113450
  stdio: ["ignore", fd, fd],
113247
113451
  env: { ...process.env, NEXRALL_BG_JOB: id }
113248
113452
  });
@@ -113302,6 +113506,23 @@ function respawnJob(job, opts) {
113302
113506
  });
113303
113507
  return { ok: true, job: meta };
113304
113508
  }
113509
+ var WIN_WRAPPER = [
113510
+ "const {spawn}=require('child_process'),fs=require('fs');",
113511
+ "const [codeFile,mode,...rest]=process.argv.slice(1);",
113512
+ "const o={stdio:'inherit',windowsHide:true};",
113513
+ "const c=mode==='shell'?spawn(rest[0],{...o,shell:true}):spawn(rest[0],rest.slice(1),o);",
113514
+ "c.on('error',()=>{fs.writeFileSync(codeFile,'127\\n');process.exit(127)});",
113515
+ "c.on('exit',(code)=>{fs.writeFileSync(codeFile,String(code??1)+'\\n');process.exit(code??1)});"
113516
+ ].join("");
113517
+ function wrapperArgv(codeFile, command, shell, nodePath) {
113518
+ if (import_proc15.IS_WINDOWS) {
113519
+ return [
113520
+ nodePath,
113521
+ ["-e", WIN_WRAPPER, codeFile, shell !== void 0 ? "shell" : "argv", ...shell !== void 0 ? [shell] : command]
113522
+ ];
113523
+ }
113524
+ return ["/bin/sh", ["-c", '"$@"; echo $? > "$0"', codeFile, ...command]];
113525
+ }
113305
113526
  function killJob(job, dir = bgDir()) {
113306
113527
  if (job.state !== "running")
113307
113528
  return false;
@@ -113309,6 +113530,10 @@ function killJob(job, dir = bgDir()) {
113309
113530
  fs31.writeFileSync(path32.join(dir, `${job.id}.killed`), "");
113310
113531
  } catch {
113311
113532
  }
113533
+ if (import_proc15.IS_WINDOWS) {
113534
+ (0, import_proc15.killProcessTree)(job.pid);
113535
+ return true;
113536
+ }
113312
113537
  try {
113313
113538
  process.kill(-job.pid, "SIGTERM");
113314
113539
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexrall-code",
3
- "version": "0.5.205",
3
+ "version": "0.5.207",
4
4
  "description": "Nexrall Code \u2014 AI coding assistant for your terminal (headless agent for scripts, CI and automation)",
5
5
  "keywords": [
6
6
  "ai",