ragent-cli 1.11.6 → 1.11.8
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.
- package/dist/index.js +85 -10
- package/dist/sbom.json +5 -5
- 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.11.
|
|
34
|
+
version: "1.11.8",
|
|
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: {
|
|
@@ -2930,6 +2930,10 @@ var BACKPRESSURE_RESUME_CHECK_MS = 100;
|
|
|
2930
2930
|
var STOP_DEBOUNCE_MS = 2e3;
|
|
2931
2931
|
var MAX_CONCURRENT_STREAMS = 20;
|
|
2932
2932
|
var MAX_SESSION_BUFFER_BYTES = 64 * 1024;
|
|
2933
|
+
var ALT_SCREEN_MODE_RE = /\x1b\[\?(?=[0-9;]*(?:47|1047|1048|1049)(?:;|[hl]))[0-9;]*[hl]/g;
|
|
2934
|
+
function stripAlternateScreenModeSwitches(data) {
|
|
2935
|
+
return data.replace(ALT_SCREEN_MODE_RE, "");
|
|
2936
|
+
}
|
|
2933
2937
|
function parsePaneTarget(sessionId) {
|
|
2934
2938
|
if (!sessionId.startsWith("tmux:")) return null;
|
|
2935
2939
|
const rest = sessionId.slice("tmux:".length);
|
|
@@ -3286,7 +3290,7 @@ var SessionStreamer = class {
|
|
|
3286
3290
|
{ env: cleanEnv, timeout: 5e3, encoding: "utf-8" }
|
|
3287
3291
|
);
|
|
3288
3292
|
if (initial) {
|
|
3289
|
-
this.sendFn(sessionId, initial.replace(/\n/g, "\r\n").replace(/\r\n$/, ""));
|
|
3293
|
+
this.sendFn(sessionId, stripAlternateScreenModeSwitches(initial.replace(/\n/g, "\r\n").replace(/\r\n$/, "")));
|
|
3290
3294
|
}
|
|
3291
3295
|
} catch {
|
|
3292
3296
|
}
|
|
@@ -3379,13 +3383,13 @@ var SessionStreamer = class {
|
|
|
3379
3383
|
if (stream.initializing) {
|
|
3380
3384
|
stream.initBuffer.push(data);
|
|
3381
3385
|
} else {
|
|
3382
|
-
this.sendFn(sessionId, data);
|
|
3386
|
+
this.sendFn(sessionId, stripAlternateScreenModeSwitches(data));
|
|
3383
3387
|
}
|
|
3384
3388
|
});
|
|
3385
3389
|
catProc.on("exit", () => {
|
|
3386
3390
|
if (!stream.stopped) {
|
|
3387
3391
|
const remaining = stream.utf8Decoder.end();
|
|
3388
|
-
if (remaining) this.sendFn(sessionId, remaining);
|
|
3392
|
+
if (remaining) this.sendFn(sessionId, stripAlternateScreenModeSwitches(remaining));
|
|
3389
3393
|
this.cleanupStream(stream);
|
|
3390
3394
|
this.active.delete(sessionId);
|
|
3391
3395
|
this.pendingStops.delete(sessionId);
|
|
@@ -3424,7 +3428,7 @@ var SessionStreamer = class {
|
|
|
3424
3428
|
{ env: cleanEnv, timeout: 5e3, encoding: "utf-8" }
|
|
3425
3429
|
);
|
|
3426
3430
|
if (initial) {
|
|
3427
|
-
this.sendFn(sessionId, initial.replace(/\n/g, "\r\n").replace(/\r\n$/, ""));
|
|
3431
|
+
this.sendFn(sessionId, stripAlternateScreenModeSwitches(initial.replace(/\n/g, "\r\n").replace(/\r\n$/, "")));
|
|
3428
3432
|
}
|
|
3429
3433
|
} catch {
|
|
3430
3434
|
}
|
|
@@ -4687,6 +4691,26 @@ function requestStopSelfService() {
|
|
|
4687
4691
|
}
|
|
4688
4692
|
}
|
|
4689
4693
|
}
|
|
4694
|
+
function requestRestartSelfService() {
|
|
4695
|
+
const backend = getConfiguredServiceBackend();
|
|
4696
|
+
if (backend === "systemd") {
|
|
4697
|
+
const child = (0, import_child_process3.spawn)("systemctl", ["--user", "restart", SERVICE_NAME], {
|
|
4698
|
+
detached: true,
|
|
4699
|
+
stdio: "ignore"
|
|
4700
|
+
});
|
|
4701
|
+
child.unref();
|
|
4702
|
+
return;
|
|
4703
|
+
}
|
|
4704
|
+
if (backend === "pidfile") {
|
|
4705
|
+
const child = (0, import_child_process3.spawn)(process.execPath, [__filename, "service", "restart"], {
|
|
4706
|
+
detached: true,
|
|
4707
|
+
stdio: "ignore",
|
|
4708
|
+
cwd: os7.homedir(),
|
|
4709
|
+
env: process.env
|
|
4710
|
+
});
|
|
4711
|
+
child.unref();
|
|
4712
|
+
}
|
|
4713
|
+
}
|
|
4690
4714
|
|
|
4691
4715
|
// src/provisioner.ts
|
|
4692
4716
|
var import_child_process4 = require("child_process");
|
|
@@ -4990,8 +5014,17 @@ function isSafeWorkingDir(raw) {
|
|
|
4990
5014
|
return true;
|
|
4991
5015
|
}
|
|
4992
5016
|
|
|
5017
|
+
// src/updater.ts
|
|
5018
|
+
async function installLatestCliFromNpm() {
|
|
5019
|
+
await execAsync(`npm install -g ${shellQuote(`${PACKAGE_NAME}@latest`)}`, {
|
|
5020
|
+
timeout: 5 * 60 * 1e3,
|
|
5021
|
+
maxBuffer: 10 * 1024 * 1024
|
|
5022
|
+
});
|
|
5023
|
+
}
|
|
5024
|
+
|
|
4993
5025
|
// src/control-dispatcher.ts
|
|
4994
5026
|
var log13 = createLogger("control");
|
|
5027
|
+
var TMUX_RESYNC_DEBOUNCE_MS = 150;
|
|
4995
5028
|
function collectProcessTreePids(rootPid, visited = /* @__PURE__ */ new Set()) {
|
|
4996
5029
|
if (visited.has(rootPid)) return [];
|
|
4997
5030
|
visited.add(rootPid);
|
|
@@ -5033,6 +5066,7 @@ var ControlDispatcher = class {
|
|
|
5033
5066
|
transcriptWatcher;
|
|
5034
5067
|
options;
|
|
5035
5068
|
_approvalEnforcer = null;
|
|
5069
|
+
tmuxResizeState = /* @__PURE__ */ new Map();
|
|
5036
5070
|
/** Set to true when a reconnect was requested (restart-agent, disconnect). */
|
|
5037
5071
|
reconnectRequested = false;
|
|
5038
5072
|
/** Set to false to stop the agent. */
|
|
@@ -5098,6 +5132,7 @@ var ControlDispatcher = class {
|
|
|
5098
5132
|
"stop-agent",
|
|
5099
5133
|
"restart-agent",
|
|
5100
5134
|
"restart-shell",
|
|
5135
|
+
"update-agent",
|
|
5101
5136
|
"stop-session",
|
|
5102
5137
|
"stop-detached",
|
|
5103
5138
|
"disconnect",
|
|
@@ -5125,6 +5160,9 @@ var ControlDispatcher = class {
|
|
|
5125
5160
|
this.connection.activeSocket.close();
|
|
5126
5161
|
}
|
|
5127
5162
|
return;
|
|
5163
|
+
case "update-agent":
|
|
5164
|
+
await this.updateAgentFromNpm();
|
|
5165
|
+
return;
|
|
5128
5166
|
case "stop-agent":
|
|
5129
5167
|
this.shouldRun = false;
|
|
5130
5168
|
this.streamer.stopAll();
|
|
@@ -5291,9 +5329,31 @@ var ControlDispatcher = class {
|
|
|
5291
5329
|
if (!sessionId || sessionId.startsWith("pty:")) {
|
|
5292
5330
|
this.shell.resize(cols, rows);
|
|
5293
5331
|
} else if (sessionId.startsWith("tmux:")) {
|
|
5332
|
+
const previous = this.tmuxResizeState.get(sessionId);
|
|
5333
|
+
if (previous?.cols === cols && previous.rows === rows) return;
|
|
5334
|
+
if (previous?.timer) clearTimeout(previous.timer);
|
|
5335
|
+
const state = { cols, rows, timer: null };
|
|
5336
|
+
this.tmuxResizeState.set(sessionId, state);
|
|
5294
5337
|
resizeTmuxPaneBySessionId(sessionId, cols, rows).then((resized) => {
|
|
5295
|
-
if (resized)
|
|
5338
|
+
if (!resized) {
|
|
5339
|
+
if (this.tmuxResizeState.get(sessionId) === state) {
|
|
5340
|
+
this.tmuxResizeState.delete(sessionId);
|
|
5341
|
+
}
|
|
5342
|
+
return;
|
|
5343
|
+
}
|
|
5344
|
+
const current = this.tmuxResizeState.get(sessionId);
|
|
5345
|
+
if (current !== state) return;
|
|
5346
|
+
current.timer = setTimeout(() => {
|
|
5347
|
+
const latest = this.tmuxResizeState.get(sessionId);
|
|
5348
|
+
if (latest === current) {
|
|
5349
|
+
latest.timer = null;
|
|
5350
|
+
this.streamer.resyncStream(sessionId);
|
|
5351
|
+
}
|
|
5352
|
+
}, TMUX_RESYNC_DEBOUNCE_MS);
|
|
5296
5353
|
}).catch((error) => {
|
|
5354
|
+
if (this.tmuxResizeState.get(sessionId) === state) {
|
|
5355
|
+
this.tmuxResizeState.delete(sessionId);
|
|
5356
|
+
}
|
|
5297
5357
|
const message = error instanceof Error ? error.message : String(error);
|
|
5298
5358
|
log13.warn("tmux resize failed", { sessionId, error: message });
|
|
5299
5359
|
});
|
|
@@ -5301,6 +5361,24 @@ var ControlDispatcher = class {
|
|
|
5301
5361
|
this.streamer.resize(sessionId, cols, rows);
|
|
5302
5362
|
}
|
|
5303
5363
|
}
|
|
5364
|
+
/** Update the installed connector package, then restart when a service backend exists. */
|
|
5365
|
+
async updateAgentFromNpm() {
|
|
5366
|
+
log13.info("updating ragent CLI", { current: CURRENT_VERSION });
|
|
5367
|
+
try {
|
|
5368
|
+
await installLatestCliFromNpm();
|
|
5369
|
+
} catch (error) {
|
|
5370
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5371
|
+
log13.error("failed to update ragent CLI", { error: message });
|
|
5372
|
+
return;
|
|
5373
|
+
}
|
|
5374
|
+
const backend = getConfiguredServiceBackend();
|
|
5375
|
+
if (!backend) {
|
|
5376
|
+
log13.warn("ragent CLI updated, but no service backend is configured; restart the connector manually to use the new version");
|
|
5377
|
+
return;
|
|
5378
|
+
}
|
|
5379
|
+
log13.info("ragent CLI updated; restarting connector service", { backend });
|
|
5380
|
+
requestRestartSelfService();
|
|
5381
|
+
}
|
|
5304
5382
|
/** Handle provision request from dashboard. */
|
|
5305
5383
|
async handleProvision(payload) {
|
|
5306
5384
|
const provReq = validateProvisionRequest(payload);
|
|
@@ -6597,10 +6675,7 @@ function registerUpdateCommand(program2) {
|
|
|
6597
6675
|
}
|
|
6598
6676
|
log19.info("update available", { current: CURRENT_VERSION, latest: latestVersion });
|
|
6599
6677
|
if (opts.check) return;
|
|
6600
|
-
await
|
|
6601
|
-
timeout: 5 * 60 * 1e3,
|
|
6602
|
-
maxBuffer: 10 * 1024 * 1024
|
|
6603
|
-
});
|
|
6678
|
+
await installLatestCliFromNpm();
|
|
6604
6679
|
log19.info("updated", { version: latestVersion });
|
|
6605
6680
|
const backend = getConfiguredServiceBackend();
|
|
6606
6681
|
if (backend && opts.restart) {
|
package/dist/sbom.json
CHANGED
|
@@ -1166,8 +1166,8 @@
|
|
|
1166
1166
|
{
|
|
1167
1167
|
"type": "library",
|
|
1168
1168
|
"name": "ragent-cli",
|
|
1169
|
-
"version": "1.11.
|
|
1170
|
-
"bom-ref": "ragent-live|ragent-cli@1.11.
|
|
1169
|
+
"version": "1.11.8",
|
|
1170
|
+
"bom-ref": "ragent-live|ragent-cli@1.11.8",
|
|
1171
1171
|
"author": "Intellimetrics",
|
|
1172
1172
|
"description": "CLI agent for rAgent Live — browser-first terminal control plane for AI coding agents",
|
|
1173
1173
|
"licenses": [
|
|
@@ -1178,7 +1178,7 @@
|
|
|
1178
1178
|
}
|
|
1179
1179
|
}
|
|
1180
1180
|
],
|
|
1181
|
-
"purl": "pkg:npm/ragent-cli@1.11.
|
|
1181
|
+
"purl": "pkg:npm/ragent-cli@1.11.8",
|
|
1182
1182
|
"externalReferences": [
|
|
1183
1183
|
{
|
|
1184
1184
|
"url": "https://github.com/chadlindell/ragent-live/issues",
|
|
@@ -1303,7 +1303,7 @@
|
|
|
1303
1303
|
"ragent-live|@emnapi/wasi-threads@1.2.1",
|
|
1304
1304
|
"ragent-live|@pkgjs/parseargs@0.11.0",
|
|
1305
1305
|
"ragent-live|@tybys/wasm-util@0.10.1",
|
|
1306
|
-
"ragent-live|ragent-cli@1.11.
|
|
1306
|
+
"ragent-live|ragent-cli@1.11.8"
|
|
1307
1307
|
]
|
|
1308
1308
|
},
|
|
1309
1309
|
{
|
|
@@ -1436,7 +1436,7 @@
|
|
|
1436
1436
|
]
|
|
1437
1437
|
},
|
|
1438
1438
|
{
|
|
1439
|
-
"ref": "ragent-live|ragent-cli@1.11.
|
|
1439
|
+
"ref": "ragent-live|ragent-cli@1.11.8",
|
|
1440
1440
|
"dependsOn": [
|
|
1441
1441
|
"ragent-live|@azure/web-pubsub-client@1.0.4",
|
|
1442
1442
|
"ragent-live|commander@14.0.3",
|