nexrall-code 0.5.206 → 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 +268 -109
  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
@@ -31524,7 +31658,7 @@ var require_installer = __commonJS({
31524
31658
  var fs33 = __importStar(__require("fs"));
31525
31659
  var path36 = __importStar(__require("path"));
31526
31660
  var os25 = __importStar(__require("os"));
31527
- var child_process_1 = __require("child_process");
31661
+ var proc_1 = require_proc();
31528
31662
  var client_1 = require_client();
31529
31663
  var index_1 = require_plugins();
31530
31664
  var data_1 = require_data();
@@ -31882,7 +32016,7 @@ var require_installer = __commonJS({
31882
32016
  }
31883
32017
  function extractTarball(tarFile, destDir) {
31884
32018
  fs33.mkdirSync(destDir, { recursive: true });
31885
- (0, child_process_1.execFileSync)("tar", ["-xzf", tarFile, "-C", destDir], { stdio: "pipe" });
32019
+ (0, proc_1.execFileSync)("tar", ["-xzf", tarFile, "-C", destDir], { stdio: "pipe" });
31886
32020
  const entries = fs33.readdirSync(destDir).filter((e2) => {
31887
32021
  try {
31888
32022
  return fs33.statSync(path36.join(destDir, e2)).isDirectory();
@@ -32939,7 +33073,7 @@ var require_monitor = __commonJS({
32939
33073
  exports.stopMonitor = stopMonitor;
32940
33074
  exports.stopAllMonitors = stopAllMonitors;
32941
33075
  exports.executeMonitorTool = executeMonitorTool2;
32942
- var child_process_1 = __require("child_process");
33076
+ var proc_1 = require_proc();
32943
33077
  exports.MONITOR_TOOL_NAME = "monitor";
32944
33078
  exports.DEFAULT_TIMEOUT_MS = 5 * 6e4;
32945
33079
  exports.MAX_TIMEOUT_MS = 30 * 6e4;
@@ -32967,10 +33101,8 @@ var require_monitor = __commonJS({
32967
33101
  }
32968
33102
  function killTree(m2) {
32969
33103
  try {
32970
- if (m2.child.pid)
32971
- process.kill(-m2.child.pid, "SIGTERM");
32972
- else
32973
- m2.child.kill("SIGTERM");
33104
+ (0, proc_1.killProcessTree)(m2.child.pid, "SIGTERM");
33105
+ m2.child.kill("SIGTERM");
32974
33106
  } catch {
32975
33107
  }
32976
33108
  if (m2.killTimer)
@@ -32978,8 +33110,7 @@ var require_monitor = __commonJS({
32978
33110
  m2.killTimer = setTimeout(() => {
32979
33111
  m2.killTimer = null;
32980
33112
  try {
32981
- if (m2.child.pid)
32982
- process.kill(-m2.child.pid, "SIGKILL");
33113
+ (0, proc_1.killProcessTree)(m2.child.pid, "SIGKILL");
32983
33114
  } catch {
32984
33115
  }
32985
33116
  }, m2.timing.killGraceMs);
@@ -33100,7 +33231,7 @@ var require_monitor = __commonJS({
33100
33231
  const now = opts.now ?? Date.now;
33101
33232
  const id = `mon${++_seq}`;
33102
33233
  const label = opts.label && String(opts.label).trim().slice(0, 60) || command.slice(0, 60);
33103
- const spawnFn = opts.spawnFn ?? child_process_1.spawn;
33234
+ const spawnFn = opts.spawnFn ?? proc_1.spawn;
33104
33235
  let child;
33105
33236
  try {
33106
33237
  child = spawnFn(command, {
@@ -33110,7 +33241,7 @@ var require_monitor = __commonJS({
33110
33241
  // Own process group so the deadline kill reaches `sh -c "tail -f | grep"`
33111
33242
  // trees; stdin closed so a watcher that reads blocks on nothing and gets
33112
33243
  // EOF instead of hanging the watch until its deadline.
33113
- detached: true,
33244
+ detached: proc_1.DETACH_GROUP,
33114
33245
  stdio: ["ignore", "pipe", "pipe"]
33115
33246
  });
33116
33247
  } catch (e2) {
@@ -33206,8 +33337,7 @@ var require_monitor = __commonJS({
33206
33337
  if (silent) {
33207
33338
  const m2 = _monitors.get(id);
33208
33339
  try {
33209
- if (m2.child.pid)
33210
- process.kill(-m2.child.pid, "SIGKILL");
33340
+ (0, proc_1.killProcessTree)(m2.child.pid, "SIGKILL");
33211
33341
  } catch {
33212
33342
  }
33213
33343
  finalize(m2);
@@ -33964,12 +34094,12 @@ var require_collect = __commonJS({
33964
34094
  exports.gitDiffRaw = gitDiffRaw2;
33965
34095
  exports.collectChangedFiles = collectChangedFiles2;
33966
34096
  exports.gitBranch = gitBranch2;
33967
- var child_process_1 = __require("child_process");
34097
+ var proc_1 = require_proc();
33968
34098
  var fs33 = __importStar(__require("fs"));
33969
34099
  var path36 = __importStar(__require("path"));
33970
34100
  var diffView_1 = require_diffView();
33971
34101
  function gitDiffRaw2(cwd2) {
33972
- const run = (args) => (0, child_process_1.execFileSync)("git", args, {
34102
+ const run = (args) => (0, proc_1.execFileSync)("git", args, {
33973
34103
  cwd: cwd2,
33974
34104
  encoding: "utf8",
33975
34105
  stdio: ["ignore", "pipe", "ignore"],
@@ -47693,7 +47823,7 @@ var require_mergeAssistant = __commonJS({
47693
47823
  exports.parseMergeTree = parseMergeTree2;
47694
47824
  exports.checkBranchMerges = checkBranchMerges2;
47695
47825
  exports.formatMergePanel = formatMergePanel2;
47696
- var child_process_1 = __require("child_process");
47826
+ var proc_1 = require_proc();
47697
47827
  var globalSearch_1 = require_globalSearch();
47698
47828
  var collect_1 = require_collect();
47699
47829
  exports.MAX_NODE_FILES = 40;
@@ -47709,7 +47839,7 @@ var require_mergeAssistant = __commonJS({
47709
47839
  }
47710
47840
  var gitRunnerForMerge2 = (cwd2, args) => {
47711
47841
  try {
47712
- const stdout = (0, child_process_1.execFileSync)("git", args, {
47842
+ const stdout = (0, proc_1.execFileSync)("git", args, {
47713
47843
  cwd: cwd2,
47714
47844
  encoding: "utf-8",
47715
47845
  stdio: ["ignore", "pipe", "pipe"],
@@ -80021,8 +80151,8 @@ async function scheduleRunsCommand(id, opts = {}) {
80021
80151
  }
80022
80152
 
80023
80153
  // src/commands/cloud.ts
80154
+ var import_proc = __toESM(require_proc(), 1);
80024
80155
  var import_code_core5 = __toESM(require_dist2(), 1);
80025
- import { spawn } from "child_process";
80026
80156
  async function requireAuth3() {
80027
80157
  if ((0, import_code_core5.isAuthenticated)())
80028
80158
  return true;
@@ -80058,10 +80188,11 @@ var writeRaw = (s2) => {
80058
80188
  process.stdout.write(s2);
80059
80189
  };
80060
80190
  function openUrl(url) {
80061
- const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
80062
- 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];
80063
80194
  try {
80064
- const child = spawn(cmd, args, { stdio: "ignore", detached: true });
80195
+ const child = (0, import_proc.spawn)(cmd, args, { stdio: "ignore", detached: !win });
80065
80196
  child.on("error", () => {
80066
80197
  });
80067
80198
  child.unref();
@@ -80856,13 +80987,13 @@ function paintLine(l) {
80856
80987
  var import_code_core8 = __toESM(require_dist2(), 1);
80857
80988
 
80858
80989
  // src/mcp/oauth.ts
80990
+ var import_proc2 = __toESM(require_proc(), 1);
80859
80991
  var import_code_core9 = __toESM(require_dist2(), 1);
80860
80992
  import * as fs3 from "fs";
80861
80993
  import * as os2 from "os";
80862
80994
  import * as path2 from "path";
80863
80995
  import * as http3 from "http";
80864
80996
  import * as crypto from "crypto";
80865
- import { spawn as spawn2 } from "child_process";
80866
80997
  var CALLBACK_TIMEOUT_MS = 5 * 60 * 1e3;
80867
80998
  function tokensFile(env3 = process.env) {
80868
80999
  return env3.NEXRALL_MCP_AUTH_FILE || path2.join(os2.homedir(), ".nexrall", "mcp-auth.json");
@@ -81188,9 +81319,11 @@ function b64url(buf) {
81188
81319
  return buf.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
81189
81320
  }
81190
81321
  function openInBrowser(url) {
81191
- 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];
81192
81325
  try {
81193
- 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 });
81194
81327
  child.on("error", () => void 0);
81195
81328
  child.unref();
81196
81329
  } catch {
@@ -82463,15 +82596,15 @@ async function executeMcpResourceTool(name, input, mgr) {
82463
82596
  }
82464
82597
 
82465
82598
  // src/ui/clipboardImage.ts
82599
+ var import_proc3 = __toESM(require_proc(), 1);
82466
82600
  import * as fs6 from "fs";
82467
82601
  import * as os3 from "os";
82468
82602
  import * as path5 from "path";
82469
- import { spawnSync } from "child_process";
82470
82603
  var MAX_PASTE_BYTES = 10 * 1024 * 1024;
82471
82604
  var PNG_MAGIC = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
82472
82605
  var realRunner = (cmd, args) => {
82473
82606
  try {
82474
- return spawnSync(cmd, args, { stdio: "ignore", timeout: 8e3 }).status === 0;
82607
+ return (0, import_proc3.spawnSync)(cmd, args, { stdio: "ignore", timeout: 8e3 }).status === 0;
82475
82608
  } catch {
82476
82609
  return false;
82477
82610
  }
@@ -83009,7 +83142,7 @@ function capEffortForScale(levels, effort, cap) {
83009
83142
  var import_code_core26 = __toESM(require_dist2(), 1);
83010
83143
 
83011
83144
  // src/ui/statusLine.ts
83012
- import { spawn as spawn3 } from "child_process";
83145
+ var import_proc4 = __toESM(require_proc(), 1);
83013
83146
  var STATUSLINE_TIMEOUT_MS = 2e3;
83014
83147
  var MIN_INTERVAL_MS2 = 1500;
83015
83148
  var MAX_OUTPUT_BYTES = 4096;
@@ -83056,7 +83189,7 @@ var shellRunner = (command, stdin, cwd2, timeoutMs) => new Promise((resolve19) =
83056
83189
  };
83057
83190
  let child;
83058
83191
  try {
83059
- 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 });
83060
83193
  } catch {
83061
83194
  resolve19(null);
83062
83195
  return;
@@ -84838,12 +84971,12 @@ function formatDeployTargets(targets, cols3) {
84838
84971
  }
84839
84972
 
84840
84973
  // src/commands/chat.ts
84974
+ var import_proc12 = __toESM(require_proc(), 1);
84841
84975
  var import_code_core66 = __toESM(require_dist2(), 1);
84842
84976
  import * as os17 from "os";
84843
84977
  import * as crypto4 from "crypto";
84844
84978
  import { createRequire } from "module";
84845
84979
  import { fileURLToPath as fileURLToPath2 } from "url";
84846
- import { execFile as execFile2, execFileSync as execFileSync6 } from "child_process";
84847
84980
 
84848
84981
  // src/permissions/handler.ts
84849
84982
  import * as readline2 from "readline";
@@ -87118,17 +87251,17 @@ function debugLog(event, fields) {
87118
87251
  }
87119
87252
 
87120
87253
  // src/commands/doctor.ts
87254
+ var import_proc6 = __toESM(require_proc(), 1);
87121
87255
  var import_code_core46 = __toESM(require_dist2(), 1);
87122
87256
  import fs11 from "fs";
87123
87257
  import os6 from "os";
87124
87258
  import path13 from "path";
87125
- import { spawnSync as spawnSync3, execFileSync as execFileSync2 } from "child_process";
87126
87259
 
87127
87260
  // src/commands/sessionTools.ts
87261
+ var import_proc5 = __toESM(require_proc(), 1);
87128
87262
  var import_code_core42 = __toESM(require_dist2(), 1);
87129
87263
  var import_code_core43 = __toESM(require_dist2(), 1);
87130
87264
  var import_code_core44 = __toESM(require_dist2(), 1);
87131
- import { spawnSync as spawnSync2, execFileSync } from "child_process";
87132
87265
  var UsageTotals = class {
87133
87266
  input = 0;
87134
87267
  output = 0;
@@ -87221,7 +87354,7 @@ function copyToClipboard(text, platform3 = process.platform) {
87221
87354
  ];
87222
87355
  for (const [cmd, args] of candidates) {
87223
87356
  try {
87224
- 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 });
87225
87358
  if (!r2.error && r2.status === 0)
87226
87359
  return cmd;
87227
87360
  } catch {
@@ -87233,7 +87366,7 @@ function osc52(text) {
87233
87366
  return `\x1B]52;c;${Buffer.from(text, "utf8").toString("base64")}\x07`;
87234
87367
  }
87235
87368
  function gitChanges(cwd2) {
87236
- 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();
87237
87370
  try {
87238
87371
  run(["rev-parse", "--is-inside-work-tree"]);
87239
87372
  return { status: run(["status", "--short"]), stat: run(["diff", "--stat", "HEAD"]) };
@@ -87714,7 +87847,7 @@ function doctorExitCode(checks) {
87714
87847
  return checks.some((c) => c.status === "fail") ? 1 : 0;
87715
87848
  }
87716
87849
  function commandExists(cmd, platform3 = process.platform) {
87717
- 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 });
87718
87851
  return !r2.error && r2.status === 0;
87719
87852
  }
87720
87853
  function ripgrepInstallHint(platform3) {
@@ -87765,7 +87898,7 @@ function realProbes(c) {
87765
87898
  resolveRipgrep: () => (0, import_code_core46.resolveRipgrepBinary)(),
87766
87899
  gitInfo: () => {
87767
87900
  try {
87768
- 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 });
87769
87902
  return { inRepo: true, branch: (0, import_code_core43.gitBranch)(c.workDir) ?? void 0 };
87770
87903
  } catch {
87771
87904
  return { inRepo: false };
@@ -88232,7 +88365,7 @@ async function enableAppleTerminalOptionAsMeta(deps) {
88232
88365
  }
88233
88366
 
88234
88367
  // src/commands/update.ts
88235
- import { execFileSync as execFileSync3, spawn as spawn4 } from "child_process";
88368
+ var import_proc7 = __toESM(require_proc(), 1);
88236
88369
  import * as fs13 from "fs";
88237
88370
  import * as https2 from "https";
88238
88371
  import * as path16 from "path";
@@ -88285,7 +88418,7 @@ function installArgs(version) {
88285
88418
  }
88286
88419
  function installedGlobalVersion() {
88287
88420
  try {
88288
- const root = execFileSync3("npm", ["root", "-g"], { encoding: "utf-8" }).trim();
88421
+ const root = (0, import_proc7.execFileSync)("npm", ["root", "-g"], { encoding: "utf-8" }).trim();
88289
88422
  return JSON.parse(fs13.readFileSync(path16.join(root, "nexrall-code", "package.json"), "utf-8")).version ?? null;
88290
88423
  } catch {
88291
88424
  return null;
@@ -88293,7 +88426,7 @@ function installedGlobalVersion() {
88293
88426
  }
88294
88427
  function npmInstallGlobal(version) {
88295
88428
  return new Promise((resolve19) => {
88296
- const child = spawn4("npm", installArgs(version), { stdio: "pipe" });
88429
+ const child = (0, import_proc7.spawn)("npm", installArgs(version), { stdio: "pipe" });
88297
88430
  let stderr = "";
88298
88431
  child.stderr?.on("data", (c) => {
88299
88432
  stderr += c.toString();
@@ -88302,7 +88435,7 @@ function npmInstallGlobal(version) {
88302
88435
  if (code === 0)
88303
88436
  return resolve19({ ok: true, usedSudo: false });
88304
88437
  if (/EACCES|permission denied/i.test(stderr)) {
88305
- const sudo = spawn4("sudo", ["npm", ...installArgs(version)], { stdio: "inherit" });
88438
+ const sudo = (0, import_proc7.spawn)("sudo", ["npm", ...installArgs(version)], { stdio: "inherit" });
88306
88439
  sudo.on("close", (sudoCode) => resolve19({ ok: sudoCode === 0, usedSudo: true }));
88307
88440
  } else {
88308
88441
  console.error(paint.dim(stderr.trim()));
@@ -99340,9 +99473,9 @@ function decidePick(item, tab2) {
99340
99473
  }
99341
99474
 
99342
99475
  // src/commands/bangShell.ts
99476
+ var import_proc8 = __toESM(require_proc(), 1);
99343
99477
  var import_code_core50 = __toESM(require_dist2(), 1);
99344
99478
  var import_code_core51 = __toESM(require_dist2(), 1);
99345
- import { spawn as spawn5 } from "child_process";
99346
99479
  function parseBang(line) {
99347
99480
  const t2 = line.trim();
99348
99481
  if (!t2.startsWith("!"))
@@ -99365,18 +99498,14 @@ function runBang(cmd, opts) {
99365
99498
  let aborted = false;
99366
99499
  let settled = false;
99367
99500
  let detached = false;
99368
- const child = spawn5("bash", ["-c", cmd], {
99369
- cwd: opts.cwd,
99370
- env: opts.env ?? process.env,
99371
- stdio: ["ignore", "pipe", "pipe"],
99372
- detached: process.platform !== "win32"
99373
- });
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 });
99374
99503
  const kill = () => {
99375
99504
  try {
99376
99505
  if (child.pid && process.platform !== "win32")
99377
99506
  process.kill(-child.pid, "SIGTERM");
99378
99507
  else
99379
- child.kill("SIGTERM");
99508
+ (0, import_proc8.killProcessTree)(child.pid);
99380
99509
  } catch {
99381
99510
  }
99382
99511
  setTimeout(() => {
@@ -99537,16 +99666,16 @@ function searchMeta(scope, origin) {
99537
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";
99538
99667
 
99539
99668
  // src/ui/externalEditor.ts
99669
+ var import_proc9 = __toESM(require_proc(), 1);
99540
99670
  import * as fs20 from "fs";
99541
99671
  import * as os13 from "os";
99542
99672
  import * as path20 from "path";
99543
- import { spawnSync as spawnSync4 } from "child_process";
99544
99673
  function resolveEditor(env3) {
99545
99674
  const pick = (v) => v && v.trim() ? v.trim() : null;
99546
99675
  return pick(env3.VISUAL) ?? pick(env3.EDITOR) ?? "vi";
99547
99676
  }
99548
99677
  function defaultRun(editor, file) {
99549
- 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" });
99550
99679
  return { status: r2.status, error: r2.error };
99551
99680
  }
99552
99681
  function editInEditor(text, opts = {}) {
@@ -99579,7 +99708,7 @@ function editInEditor(text, opts = {}) {
99579
99708
  }
99580
99709
 
99581
99710
  // src/ui/openInEditor.ts
99582
- import { spawn as spawn6, spawnSync as spawnSync5 } from "node:child_process";
99711
+ var import_proc10 = __toESM(require_proc(), 1);
99583
99712
  import * as fs21 from "node:fs";
99584
99713
  import * as os14 from "node:os";
99585
99714
  import * as path21 from "node:path";
@@ -99799,7 +99928,7 @@ function launchEditor(spec, target, opts = {}) {
99799
99928
  const needsShell = /\s/.test(spec.command);
99800
99929
  const argv = () => needsShell ? ["sh", ["-c", `${spec.command} "$@"`, "sh", ...args]] : [spec.command, args];
99801
99930
  if (spec.kind === "gui") {
99802
- const runSpawn = opts.spawnImpl ?? spawn6;
99931
+ const runSpawn = opts.spawnImpl ?? import_proc10.spawn;
99803
99932
  try {
99804
99933
  const child = runSpawn(...argv(), { detached: true, stdio: "ignore" });
99805
99934
  child.on("error", (e2) => opts.onAsyncError?.(`could not start ${spec.command}: ${e2.message}`));
@@ -99809,7 +99938,7 @@ function launchEditor(spec, target, opts = {}) {
99809
99938
  return { ok: false, reason: `could not start ${spec.command}: ${e2.message}` };
99810
99939
  }
99811
99940
  }
99812
- const r2 = (opts.spawnSyncImpl ?? spawnSync5)(...argv(), { stdio: "inherit" });
99941
+ const r2 = (opts.spawnSyncImpl ?? import_proc10.spawnSync)(...argv(), { stdio: "inherit" });
99813
99942
  if (r2.error)
99814
99943
  return { ok: false, reason: `could not start ${spec.command}: ${r2.error.message}` };
99815
99944
  if (typeof r2.status === "number" && r2.status !== 0)
@@ -99826,9 +99955,9 @@ function describeOpen(spec, target, cwd2) {
99826
99955
  }
99827
99956
 
99828
99957
  // src/ui/fileMention.ts
99958
+ var import_proc11 = __toESM(require_proc(), 1);
99829
99959
  import * as fs22 from "fs";
99830
99960
  import * as path22 from "path";
99831
- import { execFile, execFileSync as execFileSync5 } from "child_process";
99832
99961
 
99833
99962
  // src/ui/contextFiles.ts
99834
99963
  var import_code_core52 = __toESM(require_dist2(), 1);
@@ -99873,7 +100002,7 @@ function listProjectFiles(cwd2) {
99873
100002
  function listProjectFilesFrom(cwd2) {
99874
100003
  let files = null;
99875
100004
  try {
99876
- 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"], {
99877
100006
  encoding: "utf-8",
99878
100007
  maxBuffer: 64 * 1024 * 1024,
99879
100008
  stdio: ["ignore", "pipe", "ignore"],
@@ -100009,7 +100138,7 @@ function primeMentionIndex(cwd2) {
100009
100138
  building.cancelled = true;
100010
100139
  const job = { cwd: cwd2, cancelled: false };
100011
100140
  building = job;
100012
- execFile(
100141
+ (0, import_proc11.execFile)(
100013
100142
  "git",
100014
100143
  ["-C", cwd2, "ls-files", "-co", "--exclude-standard", "-z"],
100015
100144
  {
@@ -104364,7 +104493,7 @@ function agentFooterBadge() {
104364
104493
  }
104365
104494
  var runGitForMerge = (cwd2, args) => {
104366
104495
  try {
104367
- const stdout = execFileSync6("git", args, {
104496
+ const stdout = (0, import_proc12.execFileSync)("git", args, {
104368
104497
  cwd: cwd2,
104369
104498
  encoding: "utf-8",
104370
104499
  stdio: ["ignore", "pipe", "pipe"],
@@ -104621,7 +104750,7 @@ function resolveModelLabel(alias) {
104621
104750
  async function tryExecAsync(file, args, cwd2) {
104622
104751
  return new Promise((resolve19) => {
104623
104752
  try {
104624
- execFile2(file, args, { cwd: cwd2, encoding: "utf-8" }, (err, stdout) => {
104753
+ (0, import_proc12.execFile)(file, args, { cwd: cwd2, encoding: "utf-8" }, (err, stdout) => {
104625
104754
  resolve19(err ? void 0 : String(stdout).trim() || void 0);
104626
104755
  });
104627
104756
  } catch {
@@ -110643,7 +110772,7 @@ ${text}
110643
110772
  const res = await enableAppleTerminalOptionAsMeta({
110644
110773
  run: async (cmd2, args) => {
110645
110774
  try {
110646
- 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"] });
110647
110776
  return { code: 0, stdout };
110648
110777
  } catch (err) {
110649
110778
  const e2 = err;
@@ -112212,11 +112341,11 @@ function pluginSourceRemoveCommand(name, opts) {
112212
112341
  }
112213
112342
 
112214
112343
  // src/commands/pluginEvalCmd.ts
112344
+ var import_proc13 = __toESM(require_proc(), 1);
112215
112345
  var import_code_core71 = __toESM(require_dist2(), 1);
112216
112346
  import * as fs27 from "fs";
112217
112347
  import * as os18 from "os";
112218
112348
  import * as path28 from "path";
112219
- import { spawn as spawn7 } from "node:child_process";
112220
112349
  function pluginEvalInitCommand(dir) {
112221
112350
  const target = path28.resolve(dir ?? process.cwd());
112222
112351
  const displayPath = (p) => {
@@ -112328,7 +112457,7 @@ function walkFiles(root) {
112328
112457
  }
112329
112458
  function runChild(args, cwd2, env3, timeoutMs) {
112330
112459
  return new Promise((resolve19) => {
112331
- const child = spawn7(process.execPath, args, {
112460
+ const child = (0, import_proc13.spawn)(process.execPath, args, {
112332
112461
  cwd: cwd2,
112333
112462
  env: env3,
112334
112463
  stdio: ["ignore", "pipe", "pipe"]
@@ -112836,11 +112965,11 @@ async function projectPurgeCommand(dir, opts = {}) {
112836
112965
  }
112837
112966
 
112838
112967
  // src/commands/sessionPlugins.ts
112968
+ var import_proc14 = __toESM(require_proc(), 1);
112839
112969
  var import_code_core73 = __toESM(require_dist2(), 1);
112840
112970
  import * as fs29 from "node:fs";
112841
112971
  import * as os20 from "node:os";
112842
112972
  import * as path30 from "node:path";
112843
- import { spawnSync as spawnSync6 } from "node:child_process";
112844
112973
  var MAX_ARCHIVE_BYTES = 50 * 1024 * 1024;
112845
112974
  function mkTemp(label) {
112846
112975
  return fs29.mkdtempSync(path30.join(os20.tmpdir(), `nex-${label}-`));
@@ -112862,7 +112991,14 @@ function descendIntoWrapper(root) {
112862
112991
  return root;
112863
112992
  }
112864
112993
  function extractZip(archive, dest) {
112865
- 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 });
112866
113002
  if (r2.error && r2.error.code === "ENOENT") {
112867
113003
  return { ok: false, error: "The `unzip` command was not found \u2014 install it, or use a .tar.gz archive." };
112868
113004
  }
@@ -112872,7 +113008,7 @@ function extractZip(archive, dest) {
112872
113008
  return { ok: true };
112873
113009
  }
112874
113010
  function extractTarGz(archive, dest) {
112875
- 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 });
112876
113012
  if (r2.status !== 0) {
112877
113013
  return { ok: false, error: `tar failed: ${(r2.stderr ?? "").trim() || (r2.error?.message ?? "unknown error")}` };
112878
113014
  }
@@ -113239,11 +113375,11 @@ async function autoModeResetCommand(opts) {
113239
113375
  var import_code_core79 = __toESM(require_dist2(), 1);
113240
113376
 
113241
113377
  // src/commands/bgJobs.ts
113378
+ var import_proc15 = __toESM(require_proc(), 1);
113242
113379
  import * as fs31 from "node:fs";
113243
113380
  import * as os22 from "node:os";
113244
113381
  import * as path32 from "node:path";
113245
113382
  import * as crypto5 from "node:crypto";
113246
- import { spawn as spawn8 } from "node:child_process";
113247
113383
  function bgDir(env3 = process.env) {
113248
113384
  return env3.NEXRALL_CLI_BG_DIR || path32.join(os22.homedir(), ".nexrall", "cli-bg");
113249
113385
  }
@@ -113306,9 +113442,11 @@ function startJob(o) {
113306
113442
  const codeFile = path32.join(dir, `${id}.code`);
113307
113443
  const fd = fs31.openSync(log, "a");
113308
113444
  const command = o.shell !== void 0 ? ["/bin/sh", "-c", o.shell] : [o.execPath ?? process.execPath, o.script ?? "", ...o.args ?? []];
113309
- 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, {
113310
113447
  cwd: o.cwd,
113311
- detached: true,
113448
+ detached: !import_proc15.IS_WINDOWS,
113449
+ // detached on Windows = DETACHED_PROCESS: ignores windowsHide, pops a console
113312
113450
  stdio: ["ignore", fd, fd],
113313
113451
  env: { ...process.env, NEXRALL_BG_JOB: id }
113314
113452
  });
@@ -113368,6 +113506,23 @@ function respawnJob(job, opts) {
113368
113506
  });
113369
113507
  return { ok: true, job: meta };
113370
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
+ }
113371
113526
  function killJob(job, dir = bgDir()) {
113372
113527
  if (job.state !== "running")
113373
113528
  return false;
@@ -113375,6 +113530,10 @@ function killJob(job, dir = bgDir()) {
113375
113530
  fs31.writeFileSync(path32.join(dir, `${job.id}.killed`), "");
113376
113531
  } catch {
113377
113532
  }
113533
+ if (import_proc15.IS_WINDOWS) {
113534
+ (0, import_proc15.killProcessTree)(job.pid);
113535
+ return true;
113536
+ }
113378
113537
  try {
113379
113538
  process.kill(-job.pid, "SIGTERM");
113380
113539
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexrall-code",
3
- "version": "0.5.206",
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",