ragent-cli 1.7.1 → 1.7.2

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 +63 -30
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var require_package = __commonJS({
31
31
  "package.json"(exports2, module2) {
32
32
  module2.exports = {
33
33
  name: "ragent-cli",
34
- version: "1.7.1",
34
+ version: "1.7.2",
35
35
  description: "CLI agent for rAgent Live \u2014 browser-first terminal control plane for AI coding agents",
36
36
  main: "dist/index.js",
37
37
  bin: {
@@ -575,14 +575,17 @@ async function collectSessionInventory(hostId, command) {
575
575
  for (const s of [...screen, ...zellij]) {
576
576
  if (s.pids) s.pids.forEach((p) => multiplexerPids.add(p));
577
577
  }
578
- for (const s of tmux) {
579
- if (s.pids) {
580
- for (const pid of s.pids) {
581
- multiplexerPids.add(pid);
582
- const childInfo = await getChildAgentInfo(pid);
583
- if (childInfo) {
584
- childInfo.childPids.forEach((p) => multiplexerPids.add(p));
585
- }
578
+ const tmuxChildTasks = tmux.flatMap(
579
+ (s) => (s.pids ?? []).map(async (pid) => ({ session: s, pid, childInfo: await getChildAgentInfo(pid) }))
580
+ );
581
+ const tmuxChildResults = await Promise.all(tmuxChildTasks);
582
+ for (const { session: s, pid, childInfo } of tmuxChildResults) {
583
+ multiplexerPids.add(pid);
584
+ if (childInfo) {
585
+ childInfo.childPids.forEach((p) => multiplexerPids.add(p));
586
+ if (!s.agentType && childInfo.agentType) {
587
+ s.agentType = childInfo.agentType;
588
+ s.command = childInfo.command;
586
589
  }
587
590
  }
588
591
  }
@@ -606,12 +609,13 @@ function detectAgentType(command) {
606
609
  const cmd = command.toLowerCase();
607
610
  const parts = cmd.split(/\s+/);
608
611
  const binary = parts[0]?.split("/").pop() ?? "";
609
- const scriptArg = binary === "node" && parts[1] ? parts[1].split("/").pop() ?? "" : "";
610
- if (binary === "claude" || binary === "claude-code" || scriptArg === "cli.js" && cmd.includes("claude-code")) {
612
+ const rawScriptArg = binary === "node" && parts[1] ? parts[1].split("/").pop() ?? "" : "";
613
+ const scriptArg = rawScriptArg.replace(/\.m?js$/, "");
614
+ if (binary === "claude" || binary === "claude-code" || scriptArg === "cli" && cmd.includes("claude-code")) {
611
615
  if (cmd.includes("--chrome-native-host")) return void 0;
612
616
  return "Claude Code";
613
617
  }
614
- if (binary === "codex" || scriptArg === "codex" || cmd.includes("codex-cli")) return "Codex CLI";
618
+ if (binary === "codex" || scriptArg === "codex" && cmd.includes("@openai/codex") || cmd.includes("codex-cli")) return "Codex CLI";
615
619
  if (binary === "aider") return "aider";
616
620
  if (binary === "cursor") {
617
621
  if (isElectronProcess(cmd)) return void 0;
@@ -621,9 +625,9 @@ function detectAgentType(command) {
621
625
  if (isElectronProcess(cmd)) return void 0;
622
626
  return "Windsurf";
623
627
  }
624
- if (binary === "gemini") return "Gemini CLI";
628
+ if (binary === "gemini" || scriptArg === "gemini" && cmd.includes("gemini-cli")) return "Gemini CLI";
625
629
  if (binary === "amazon-q" || binary === "amazon_q") return "Amazon Q";
626
- if (binary === "copilot") return "Copilot CLI";
630
+ if (binary === "copilot" || scriptArg === "copilot" && cmd.includes("@github/copilot")) return "Copilot CLI";
627
631
  return void 0;
628
632
  }
629
633
  function sessionInventoryFingerprint(sessions) {
@@ -1289,18 +1293,32 @@ var SessionStreamer = class {
1289
1293
  if (!paneTarget || !cleanEnv) return false;
1290
1294
  stream.initializing = true;
1291
1295
  try {
1296
+ let alternateScreen = false;
1292
1297
  try {
1293
- const scrollback = (0, import_node_child_process2.execFileSync)(
1298
+ const altFlag = (0, import_node_child_process2.execFileSync)(
1294
1299
  "tmux",
1295
- ["capture-pane", "-t", paneTarget, "-p", "-e", "-S", "-5000", "-E", "-1"],
1296
- { env: cleanEnv, timeout: 1e4, encoding: "utf-8" }
1297
- );
1298
- if (scrollback && scrollback.length > 0) {
1299
- this.sendFn(sessionId, scrollback.replace(/\n/g, "\r\n"));
1300
- }
1300
+ ["display-message", "-t", paneTarget, "-p", "#{alternate_on}"],
1301
+ { env: cleanEnv, timeout: 5e3, encoding: "utf-8" }
1302
+ ).trim();
1303
+ alternateScreen = altFlag === "1";
1301
1304
  } catch {
1302
1305
  }
1303
- this.sendFn(sessionId, "\x1B[0m\x1B[2J\x1B[H");
1306
+ if (alternateScreen) {
1307
+ this.sendFn(sessionId, "\x1B[?1049h\x1B[0m\x1B[2J\x1B[H");
1308
+ } else {
1309
+ try {
1310
+ const scrollback = (0, import_node_child_process2.execFileSync)(
1311
+ "tmux",
1312
+ ["capture-pane", "-t", paneTarget, "-p", "-e", "-S", "-5000", "-E", "-1"],
1313
+ { env: cleanEnv, timeout: 1e4, encoding: "utf-8" }
1314
+ );
1315
+ if (scrollback && scrollback.length > 0) {
1316
+ this.sendFn(sessionId, scrollback.replace(/\n/g, "\r\n"));
1317
+ }
1318
+ } catch {
1319
+ }
1320
+ this.sendFn(sessionId, "\x1B[?1049l\x1B[0m\x1B[2J\x1B[H");
1321
+ }
1304
1322
  try {
1305
1323
  const initial = (0, import_node_child_process2.execFileSync)(
1306
1324
  "tmux",
@@ -1414,18 +1432,33 @@ var SessionStreamer = class {
1414
1432
  this.onStreamStopped?.(sessionId);
1415
1433
  }
1416
1434
  });
1435
+ let alternateScreen = false;
1417
1436
  try {
1418
- const scrollback = (0, import_node_child_process2.execFileSync)(
1437
+ const altFlag = (0, import_node_child_process2.execFileSync)(
1419
1438
  "tmux",
1420
- ["capture-pane", "-t", paneTarget, "-p", "-e", "-S", "-5000", "-E", "-1"],
1421
- { env: cleanEnv, timeout: 1e4, encoding: "utf-8" }
1422
- );
1423
- if (scrollback && scrollback.length > 0) {
1424
- this.sendFn(sessionId, scrollback.replace(/\n/g, "\r\n"));
1425
- }
1439
+ ["display-message", "-t", paneTarget, "-p", "#{alternate_on}"],
1440
+ { env: cleanEnv, timeout: 5e3, encoding: "utf-8" }
1441
+ ).trim();
1442
+ alternateScreen = altFlag === "1";
1426
1443
  } catch {
1427
1444
  }
1428
- this.sendFn(sessionId, "\x1B[0m\x1B[2J\x1B[H");
1445
+ stream.alternateScreen = alternateScreen;
1446
+ if (alternateScreen) {
1447
+ this.sendFn(sessionId, "\x1B[?1049h\x1B[0m\x1B[2J\x1B[H");
1448
+ } else {
1449
+ try {
1450
+ const scrollback = (0, import_node_child_process2.execFileSync)(
1451
+ "tmux",
1452
+ ["capture-pane", "-t", paneTarget, "-p", "-e", "-S", "-5000", "-E", "-1"],
1453
+ { env: cleanEnv, timeout: 1e4, encoding: "utf-8" }
1454
+ );
1455
+ if (scrollback && scrollback.length > 0) {
1456
+ this.sendFn(sessionId, scrollback.replace(/\n/g, "\r\n"));
1457
+ }
1458
+ } catch {
1459
+ }
1460
+ this.sendFn(sessionId, "\x1B[?1049l\x1B[0m\x1B[2J\x1B[H");
1461
+ }
1429
1462
  try {
1430
1463
  const initial = (0, import_node_child_process2.execFileSync)(
1431
1464
  "tmux",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ragent-cli",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "CLI agent for rAgent Live — browser-first terminal control plane for AI coding agents",
5
5
  "main": "dist/index.js",
6
6
  "bin": {