ragent-cli 1.7.1 → 1.7.3

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 +70 -29
  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.3",
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,8 +609,17 @@ 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
+ let rawScriptArg = "";
613
+ if (binary === "node") {
614
+ for (let i = 1; i < parts.length; i++) {
615
+ if (!parts[i].startsWith("-")) {
616
+ rawScriptArg = parts[i].split("/").pop() ?? "";
617
+ break;
618
+ }
619
+ }
620
+ }
621
+ const scriptArg = rawScriptArg.replace(/\.m?js$/, "");
622
+ if (binary === "claude" || binary === "claude-code" || scriptArg === "cli" && cmd.includes("claude-code")) {
611
623
  if (cmd.includes("--chrome-native-host")) return void 0;
612
624
  return "Claude Code";
613
625
  }
@@ -621,9 +633,9 @@ function detectAgentType(command) {
621
633
  if (isElectronProcess(cmd)) return void 0;
622
634
  return "Windsurf";
623
635
  }
624
- if (binary === "gemini") return "Gemini CLI";
636
+ if (binary === "gemini" || scriptArg === "gemini") return "Gemini CLI";
625
637
  if (binary === "amazon-q" || binary === "amazon_q") return "Amazon Q";
626
- if (binary === "copilot") return "Copilot CLI";
638
+ if (binary === "copilot" || scriptArg === "copilot") return "Copilot CLI";
627
639
  return void 0;
628
640
  }
629
641
  function sessionInventoryFingerprint(sessions) {
@@ -1289,18 +1301,32 @@ var SessionStreamer = class {
1289
1301
  if (!paneTarget || !cleanEnv) return false;
1290
1302
  stream.initializing = true;
1291
1303
  try {
1304
+ let alternateScreen = false;
1292
1305
  try {
1293
- const scrollback = (0, import_node_child_process2.execFileSync)(
1306
+ const altFlag = (0, import_node_child_process2.execFileSync)(
1294
1307
  "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
- }
1308
+ ["display-message", "-t", paneTarget, "-p", "#{alternate_on}"],
1309
+ { env: cleanEnv, timeout: 5e3, encoding: "utf-8" }
1310
+ ).trim();
1311
+ alternateScreen = altFlag === "1";
1301
1312
  } catch {
1302
1313
  }
1303
- this.sendFn(sessionId, "\x1B[0m\x1B[2J\x1B[H");
1314
+ if (alternateScreen) {
1315
+ this.sendFn(sessionId, "\x1B[?1049h\x1B[0m\x1B[2J\x1B[H");
1316
+ } else {
1317
+ try {
1318
+ const scrollback = (0, import_node_child_process2.execFileSync)(
1319
+ "tmux",
1320
+ ["capture-pane", "-t", paneTarget, "-p", "-e", "-S", "-5000", "-E", "-1"],
1321
+ { env: cleanEnv, timeout: 1e4, encoding: "utf-8" }
1322
+ );
1323
+ if (scrollback && scrollback.length > 0) {
1324
+ this.sendFn(sessionId, scrollback.replace(/\n/g, "\r\n"));
1325
+ }
1326
+ } catch {
1327
+ }
1328
+ this.sendFn(sessionId, "\x1B[?1049l\x1B[0m\x1B[2J\x1B[H");
1329
+ }
1304
1330
  try {
1305
1331
  const initial = (0, import_node_child_process2.execFileSync)(
1306
1332
  "tmux",
@@ -1414,18 +1440,33 @@ var SessionStreamer = class {
1414
1440
  this.onStreamStopped?.(sessionId);
1415
1441
  }
1416
1442
  });
1443
+ let alternateScreen = false;
1417
1444
  try {
1418
- const scrollback = (0, import_node_child_process2.execFileSync)(
1445
+ const altFlag = (0, import_node_child_process2.execFileSync)(
1419
1446
  "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
- }
1447
+ ["display-message", "-t", paneTarget, "-p", "#{alternate_on}"],
1448
+ { env: cleanEnv, timeout: 5e3, encoding: "utf-8" }
1449
+ ).trim();
1450
+ alternateScreen = altFlag === "1";
1426
1451
  } catch {
1427
1452
  }
1428
- this.sendFn(sessionId, "\x1B[0m\x1B[2J\x1B[H");
1453
+ stream.alternateScreen = alternateScreen;
1454
+ if (alternateScreen) {
1455
+ this.sendFn(sessionId, "\x1B[?1049h\x1B[0m\x1B[2J\x1B[H");
1456
+ } else {
1457
+ try {
1458
+ const scrollback = (0, import_node_child_process2.execFileSync)(
1459
+ "tmux",
1460
+ ["capture-pane", "-t", paneTarget, "-p", "-e", "-S", "-5000", "-E", "-1"],
1461
+ { env: cleanEnv, timeout: 1e4, encoding: "utf-8" }
1462
+ );
1463
+ if (scrollback && scrollback.length > 0) {
1464
+ this.sendFn(sessionId, scrollback.replace(/\n/g, "\r\n"));
1465
+ }
1466
+ } catch {
1467
+ }
1468
+ this.sendFn(sessionId, "\x1B[?1049l\x1B[0m\x1B[2J\x1B[H");
1469
+ }
1429
1470
  try {
1430
1471
  const initial = (0, import_node_child_process2.execFileSync)(
1431
1472
  "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.3",
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": {