ragent-cli 1.4.3 → 1.4.4

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 +74 -3
  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.4.3",
34
+ version: "1.4.4",
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: {
@@ -581,6 +581,9 @@ async function collectSessionInventory(hostId, command) {
581
581
  };
582
582
  return [...tmux, ...screen, ...zellij, ...bare, ptySession];
583
583
  }
584
+ function isElectronProcess(cmd) {
585
+ return cmd.includes("--type=") || cmd.includes("--user-data-dir=") || cmd.includes("--crashpad-handler-pid=");
586
+ }
584
587
  function detectAgentType(command) {
585
588
  if (!command) return void 0;
586
589
  const cmd = command.toLowerCase();
@@ -593,8 +596,14 @@ function detectAgentType(command) {
593
596
  }
594
597
  if (binary === "codex" || scriptArg === "codex" || cmd.includes("codex-cli")) return "Codex CLI";
595
598
  if (binary === "aider") return "aider";
596
- if (binary === "cursor") return "Cursor";
597
- if (binary === "windsurf") return "Windsurf";
599
+ if (binary === "cursor") {
600
+ if (isElectronProcess(cmd)) return void 0;
601
+ return "Cursor";
602
+ }
603
+ if (binary === "windsurf") {
604
+ if (isElectronProcess(cmd)) return void 0;
605
+ return "Windsurf";
606
+ }
598
607
  if (binary === "gemini") return "Gemini CLI";
599
608
  if (binary === "amazon-q" || binary === "amazon_q") return "Amazon Q";
600
609
  if (binary === "copilot") return "Copilot CLI";
@@ -1102,6 +1111,64 @@ var SessionStreamer = class {
1102
1111
  get activeCount() {
1103
1112
  return this.active.size;
1104
1113
  }
1114
+ /**
1115
+ * Re-send capture-pane data for an already-active tmux stream.
1116
+ * Used when a viewer missed the initial burst (e.g. joinGroup race)
1117
+ * or reconnected ("Retry stream"). Does NOT restart pipe-pane.
1118
+ */
1119
+ resyncStream(sessionId) {
1120
+ const stream = this.active.get(sessionId);
1121
+ if (!stream || stream.stopped || stream.streamType !== "tmux-pipe") return false;
1122
+ const { paneTarget, cleanEnv } = stream;
1123
+ if (!paneTarget || !cleanEnv) return false;
1124
+ try {
1125
+ try {
1126
+ const scrollback = (0, import_node_child_process2.execFileSync)(
1127
+ "tmux",
1128
+ ["capture-pane", "-t", paneTarget, "-p", "-e", "-S", "-5000", "-E", "-1"],
1129
+ { env: cleanEnv, timeout: 1e4, encoding: "utf-8" }
1130
+ );
1131
+ if (scrollback && scrollback.length > 0) {
1132
+ this.sendFn(sessionId, scrollback);
1133
+ }
1134
+ } catch {
1135
+ }
1136
+ this.sendFn(sessionId, "\x1B[0m\x1B[2J\x1B[H");
1137
+ try {
1138
+ const initial = (0, import_node_child_process2.execFileSync)(
1139
+ "tmux",
1140
+ ["capture-pane", "-t", paneTarget, "-p", "-e"],
1141
+ { env: cleanEnv, timeout: 5e3, encoding: "utf-8" }
1142
+ );
1143
+ if (initial) {
1144
+ this.sendFn(sessionId, initial);
1145
+ }
1146
+ } catch {
1147
+ }
1148
+ try {
1149
+ const cursorInfo = (0, import_node_child_process2.execFileSync)(
1150
+ "tmux",
1151
+ ["display-message", "-t", paneTarget, "-p", "#{cursor_x} #{cursor_y}"],
1152
+ { env: cleanEnv, timeout: 5e3, encoding: "utf-8" }
1153
+ ).trim();
1154
+ const parts = cursorInfo.split(" ");
1155
+ if (parts.length === 2) {
1156
+ const x = parseInt(parts[0], 10);
1157
+ const y = parseInt(parts[1], 10);
1158
+ if (!isNaN(x) && !isNaN(y)) {
1159
+ this.sendFn(sessionId, `\x1B[${y + 1};${x + 1}H`);
1160
+ }
1161
+ }
1162
+ } catch {
1163
+ }
1164
+ console.log(`[rAgent] Resync capture for: ${sessionId}`);
1165
+ return true;
1166
+ } catch (error) {
1167
+ const message = error instanceof Error ? error.message : String(error);
1168
+ console.warn(`[rAgent] Failed to resync stream for ${sessionId}: ${message}`);
1169
+ return false;
1170
+ }
1171
+ }
1105
1172
  // ---------------------------------------------------------------------------
1106
1173
  // tmux streaming (pipe-pane with cursor sync)
1107
1174
  // ---------------------------------------------------------------------------
@@ -2578,9 +2645,13 @@ var ControlDispatcher = class {
2578
2645
  const ws = this.connection.activeSocket;
2579
2646
  const group = this.connection.activeGroups.privateGroup;
2580
2647
  if (sessionId.startsWith("tmux:") || sessionId.startsWith("screen:") || sessionId.startsWith("zellij:") || sessionId.startsWith("process:")) {
2648
+ const alreadyStreaming = this.streamer.isStreaming(sessionId);
2581
2649
  const started = this.streamer.startStream(sessionId);
2582
2650
  if (ws && ws.readyState === import_ws4.default.OPEN && group) {
2583
2651
  if (started) {
2652
+ if (alreadyStreaming) {
2653
+ this.streamer.resyncStream(sessionId);
2654
+ }
2584
2655
  sendToGroup(ws, group, { type: "stream-started", sessionId });
2585
2656
  } else {
2586
2657
  sendToGroup(ws, group, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ragent-cli",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
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": {