ragent-cli 1.11.4 → 1.11.5
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 +246 -41
- 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.5",
|
|
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: {
|
|
@@ -111,7 +111,7 @@ var require_package = __commonJS({
|
|
|
111
111
|
});
|
|
112
112
|
|
|
113
113
|
// src/index.ts
|
|
114
|
-
var
|
|
114
|
+
var fs8 = __toESM(require("fs"));
|
|
115
115
|
var import_commander = require("commander");
|
|
116
116
|
|
|
117
117
|
// src/constants.ts
|
|
@@ -311,12 +311,12 @@ async function maybeWarnUpdate() {
|
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
// src/commands/connect.ts
|
|
314
|
-
var
|
|
314
|
+
var os10 = __toESM(require("os"));
|
|
315
315
|
|
|
316
316
|
// src/agent.ts
|
|
317
|
-
var
|
|
318
|
-
var
|
|
319
|
-
var
|
|
317
|
+
var fs6 = __toESM(require("fs"));
|
|
318
|
+
var os9 = __toESM(require("os"));
|
|
319
|
+
var path5 = __toESM(require("path"));
|
|
320
320
|
var import_ws5 = __toESM(require("ws"));
|
|
321
321
|
|
|
322
322
|
// src/auth.ts
|
|
@@ -1288,14 +1288,14 @@ function pathMatchesAgentTranscript(target, agentType) {
|
|
|
1288
1288
|
if (agentType === "Gemini CLI") return isGeminiTranscript;
|
|
1289
1289
|
return isClaudeTranscript || isCodexTranscript || isGeminiTranscript;
|
|
1290
1290
|
}
|
|
1291
|
-
function getNewestPath(paths) {
|
|
1291
|
+
function getNewestPath(paths, options) {
|
|
1292
1292
|
const ranked = paths.map((target) => {
|
|
1293
1293
|
try {
|
|
1294
1294
|
return { target, mtimeMs: fs2.statSync(target).mtimeMs };
|
|
1295
1295
|
} catch {
|
|
1296
1296
|
return null;
|
|
1297
1297
|
}
|
|
1298
|
-
}).filter((entry) => entry !== null).sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
1298
|
+
}).filter((entry) => entry !== null).filter((entry) => options?.minMtimeMs === void 0 || entry.mtimeMs >= options.minMtimeMs).sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
1299
1299
|
return ranked[0]?.target ?? null;
|
|
1300
1300
|
}
|
|
1301
1301
|
function discoverTranscriptForPid(pid, agentType) {
|
|
@@ -1327,6 +1327,79 @@ function listChildPids(pid) {
|
|
|
1327
1327
|
return [];
|
|
1328
1328
|
}
|
|
1329
1329
|
}
|
|
1330
|
+
function getProcessCommand(pid) {
|
|
1331
|
+
try {
|
|
1332
|
+
return (0, import_child_process.execFileSync)("ps", ["-p", String(pid), "-o", "args="], {
|
|
1333
|
+
encoding: "utf-8",
|
|
1334
|
+
timeout: 3e3,
|
|
1335
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
1336
|
+
}).trim() || null;
|
|
1337
|
+
} catch {
|
|
1338
|
+
return null;
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
function commandMatchesAgent(command, agentType) {
|
|
1342
|
+
if (!command || !agentType) return false;
|
|
1343
|
+
const parts = command.toLowerCase().trim().split(/\s+/);
|
|
1344
|
+
const binary = parts[0]?.split("/").pop() ?? "";
|
|
1345
|
+
const scriptArg = parts[1]?.split("/").pop() ?? "";
|
|
1346
|
+
if (agentType === "Claude Code") {
|
|
1347
|
+
return binary === "claude" || binary === "claude-code" || command.includes("claude-code");
|
|
1348
|
+
}
|
|
1349
|
+
if (agentType === "Codex CLI") {
|
|
1350
|
+
return binary === "codex" || scriptArg === "codex" || command.includes("codex-cli");
|
|
1351
|
+
}
|
|
1352
|
+
if (agentType === "Gemini CLI") {
|
|
1353
|
+
return binary === "gemini" || scriptArg === "gemini";
|
|
1354
|
+
}
|
|
1355
|
+
return false;
|
|
1356
|
+
}
|
|
1357
|
+
function getProcessStartEpochMs(pid) {
|
|
1358
|
+
try {
|
|
1359
|
+
const stat = fs2.readFileSync(`/proc/${pid}/stat`, "utf8");
|
|
1360
|
+
const closeParen = stat.lastIndexOf(")");
|
|
1361
|
+
if (closeParen < 0) return null;
|
|
1362
|
+
const rest = stat.slice(closeParen + 2).split(" ");
|
|
1363
|
+
const startTicks = Number(rest[19]);
|
|
1364
|
+
if (!Number.isFinite(startTicks) || startTicks < 0) return null;
|
|
1365
|
+
const procStat = fs2.readFileSync("/proc/stat", "utf8");
|
|
1366
|
+
const bootLine = procStat.split("\n").find((line) => line.startsWith("btime "));
|
|
1367
|
+
const bootSeconds = Number(bootLine?.split(/\s+/)[1]);
|
|
1368
|
+
if (!Number.isFinite(bootSeconds) || bootSeconds <= 0) return null;
|
|
1369
|
+
const ticksPerSecond = Number((0, import_child_process.execFileSync)("getconf", ["CLK_TCK"], {
|
|
1370
|
+
encoding: "utf-8",
|
|
1371
|
+
timeout: 3e3
|
|
1372
|
+
}).trim());
|
|
1373
|
+
if (!Number.isFinite(ticksPerSecond) || ticksPerSecond <= 0) return null;
|
|
1374
|
+
return (bootSeconds + startTicks / ticksPerSecond) * 1e3;
|
|
1375
|
+
} catch {
|
|
1376
|
+
return null;
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
function findAgentProcessInfos(rootPid, agentType) {
|
|
1380
|
+
const queue = [rootPid];
|
|
1381
|
+
const visited = /* @__PURE__ */ new Set();
|
|
1382
|
+
const infos = [];
|
|
1383
|
+
while (queue.length > 0 && visited.size < 64) {
|
|
1384
|
+
const pid = queue.shift();
|
|
1385
|
+
if (!pid || visited.has(pid)) continue;
|
|
1386
|
+
visited.add(pid);
|
|
1387
|
+
const command = getProcessCommand(pid);
|
|
1388
|
+
if (commandMatchesAgent(command, agentType)) {
|
|
1389
|
+
let cwd = null;
|
|
1390
|
+
try {
|
|
1391
|
+
cwd = fs2.readlinkSync(`/proc/${pid}/cwd`);
|
|
1392
|
+
} catch {
|
|
1393
|
+
cwd = null;
|
|
1394
|
+
}
|
|
1395
|
+
infos.push({ pid, command, startEpochMs: getProcessStartEpochMs(pid), cwd });
|
|
1396
|
+
}
|
|
1397
|
+
for (const childPid of listChildPids(pid)) {
|
|
1398
|
+
if (!visited.has(childPid)) queue.push(childPid);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
return infos;
|
|
1402
|
+
}
|
|
1330
1403
|
function discoverViaProc(rootPid, agentType) {
|
|
1331
1404
|
const queue = [rootPid];
|
|
1332
1405
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -1347,10 +1420,10 @@ function discoverViaProc(rootPid, agentType) {
|
|
|
1347
1420
|
}
|
|
1348
1421
|
return getNewestPath(candidates);
|
|
1349
1422
|
}
|
|
1350
|
-
function discoverViaProcessCwd(pid) {
|
|
1423
|
+
function discoverViaProcessCwd(pid, minMtimeMs) {
|
|
1351
1424
|
try {
|
|
1352
1425
|
const processCwd = fs2.readlinkSync(`/proc/${pid}/cwd`);
|
|
1353
|
-
return processCwd ? discoverViaCwd(processCwd, pid) : null;
|
|
1426
|
+
return processCwd ? discoverViaCwd(processCwd, pid, minMtimeMs) : null;
|
|
1354
1427
|
} catch {
|
|
1355
1428
|
return null;
|
|
1356
1429
|
}
|
|
@@ -1378,6 +1451,35 @@ function resolveUserHome(pid) {
|
|
|
1378
1451
|
return null;
|
|
1379
1452
|
}
|
|
1380
1453
|
}
|
|
1454
|
+
function discoverCodexTranscriptFromHome(pid, minMtimeMs) {
|
|
1455
|
+
const userHome = resolveUserHome(pid);
|
|
1456
|
+
if (!userHome) return null;
|
|
1457
|
+
const sessionsDir = path2.join(userHome, ".codex", "sessions");
|
|
1458
|
+
if (!fs2.existsSync(sessionsDir)) return null;
|
|
1459
|
+
const matches = [];
|
|
1460
|
+
const stack = [sessionsDir];
|
|
1461
|
+
let visited = 0;
|
|
1462
|
+
while (stack.length > 0 && visited < 3e3) {
|
|
1463
|
+
const current = stack.pop();
|
|
1464
|
+
if (!current) continue;
|
|
1465
|
+
visited++;
|
|
1466
|
+
let entries;
|
|
1467
|
+
try {
|
|
1468
|
+
entries = fs2.readdirSync(current, { withFileTypes: true });
|
|
1469
|
+
} catch {
|
|
1470
|
+
continue;
|
|
1471
|
+
}
|
|
1472
|
+
for (const entry of entries) {
|
|
1473
|
+
const fullPath = path2.join(current, entry.name);
|
|
1474
|
+
if (entry.isDirectory()) {
|
|
1475
|
+
stack.push(fullPath);
|
|
1476
|
+
} else if (entry.isFile() && entry.name.endsWith(".jsonl")) {
|
|
1477
|
+
matches.push(fullPath);
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
return getNewestPath(matches, { minMtimeMs });
|
|
1482
|
+
}
|
|
1381
1483
|
function discoverGeminiTranscriptFromHome(pid) {
|
|
1382
1484
|
const userHome = resolveUserHome(pid);
|
|
1383
1485
|
if (!userHome) return null;
|
|
@@ -1407,27 +1509,21 @@ function discoverGeminiTranscriptFromHome(pid) {
|
|
|
1407
1509
|
}
|
|
1408
1510
|
return getNewestPath(matches);
|
|
1409
1511
|
}
|
|
1410
|
-
function discoverViaCwd(paneCwd, pid) {
|
|
1512
|
+
function discoverViaCwd(paneCwd, pid, minMtimeMs) {
|
|
1411
1513
|
const userHome = resolveUserHome(pid);
|
|
1412
1514
|
if (!userHome) return null;
|
|
1413
1515
|
const claudeProjectsDir = path2.join(userHome, ".claude", "projects");
|
|
1414
1516
|
if (!fs2.existsSync(claudeProjectsDir)) return null;
|
|
1415
|
-
|
|
1517
|
+
const possibleCwds = /* @__PURE__ */ new Set([paneCwd]);
|
|
1416
1518
|
try {
|
|
1417
|
-
|
|
1519
|
+
possibleCwds.add(fs2.realpathSync(paneCwd));
|
|
1418
1520
|
} catch {
|
|
1419
|
-
return null;
|
|
1420
1521
|
}
|
|
1421
|
-
const
|
|
1422
|
-
|
|
1423
|
-
if (!fs2.existsSync(projectDir)) return null;
|
|
1522
|
+
const projectDirs = Array.from(possibleCwds).map((cwd) => path2.join(claudeProjectsDir, cwd.replace(/\//g, "-"))).filter((projectDir, index, arr) => arr.indexOf(projectDir) === index).filter((projectDir) => fs2.existsSync(projectDir));
|
|
1523
|
+
if (projectDirs.length === 0) return null;
|
|
1424
1524
|
try {
|
|
1425
|
-
const jsonlFiles = fs2.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).map((f) =>
|
|
1426
|
-
|
|
1427
|
-
const stat = fs2.statSync(fullPath);
|
|
1428
|
-
return { path: fullPath, mtime: stat.mtimeMs };
|
|
1429
|
-
}).sort((a, b) => b.mtime - a.mtime);
|
|
1430
|
-
return jsonlFiles.length > 0 ? jsonlFiles[0].path : null;
|
|
1525
|
+
const jsonlFiles = projectDirs.flatMap((projectDir) => fs2.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).map((f) => path2.join(projectDir, f)));
|
|
1526
|
+
return getNewestPath(jsonlFiles, { minMtimeMs });
|
|
1431
1527
|
} catch {
|
|
1432
1528
|
return null;
|
|
1433
1529
|
}
|
|
@@ -1438,9 +1534,18 @@ function discoverTranscriptFile(sessionId, agentType) {
|
|
|
1438
1534
|
const procResult = discoverViaProc(processPid, agentType);
|
|
1439
1535
|
if (procResult) return procResult;
|
|
1440
1536
|
if (agentType === "Claude Code") {
|
|
1441
|
-
const
|
|
1537
|
+
const startMs = getProcessStartEpochMs(processPid);
|
|
1538
|
+
const cwdResult = discoverViaProcessCwd(processPid, startMs ? startMs - 6e4 : void 0);
|
|
1442
1539
|
if (cwdResult) return cwdResult;
|
|
1443
1540
|
}
|
|
1541
|
+
if (agentType === "Codex CLI") {
|
|
1542
|
+
const startMs = getProcessStartEpochMs(processPid);
|
|
1543
|
+
const command = getProcessCommand(processPid);
|
|
1544
|
+
if (commandMatchesAgent(command, agentType)) {
|
|
1545
|
+
const codexResult = discoverCodexTranscriptFromHome(processPid, startMs ? startMs - 6e4 : void 0);
|
|
1546
|
+
if (codexResult) return codexResult;
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1444
1549
|
if (agentType === "Gemini CLI") {
|
|
1445
1550
|
const geminiResult = discoverGeminiTranscriptFromHome(processPid);
|
|
1446
1551
|
if (geminiResult) return geminiResult;
|
|
@@ -1469,6 +1574,16 @@ function discoverTranscriptFile(sessionId, agentType) {
|
|
|
1469
1574
|
} catch {
|
|
1470
1575
|
}
|
|
1471
1576
|
if (agentType === "Claude Code") {
|
|
1577
|
+
const agentInfos = panePid ? findAgentProcessInfos(panePid, agentType) : [];
|
|
1578
|
+
for (const info of agentInfos) {
|
|
1579
|
+
if (!info.cwd) continue;
|
|
1580
|
+
const cwdResult = discoverViaCwd(
|
|
1581
|
+
info.cwd,
|
|
1582
|
+
info.pid,
|
|
1583
|
+
info.startEpochMs ? info.startEpochMs - 6e4 : void 0
|
|
1584
|
+
);
|
|
1585
|
+
if (cwdResult) return cwdResult;
|
|
1586
|
+
}
|
|
1472
1587
|
try {
|
|
1473
1588
|
const paneCwd = (0, import_child_process.execFileSync)(
|
|
1474
1589
|
"tmux",
|
|
@@ -1479,6 +1594,16 @@ function discoverTranscriptFile(sessionId, agentType) {
|
|
|
1479
1594
|
} catch {
|
|
1480
1595
|
}
|
|
1481
1596
|
}
|
|
1597
|
+
if (agentType === "Codex CLI") {
|
|
1598
|
+
const agentInfos = panePid ? findAgentProcessInfos(panePid, agentType) : [];
|
|
1599
|
+
const newestForAgent = getNewestPath(
|
|
1600
|
+
agentInfos.map((info) => discoverCodexTranscriptFromHome(
|
|
1601
|
+
info.pid,
|
|
1602
|
+
info.startEpochMs ? info.startEpochMs - 6e4 : void 0
|
|
1603
|
+
)).filter((value) => Boolean(value))
|
|
1604
|
+
);
|
|
1605
|
+
if (newestForAgent) return newestForAgent;
|
|
1606
|
+
}
|
|
1482
1607
|
if (agentType === "Gemini CLI") {
|
|
1483
1608
|
return discoverGeminiTranscriptFromHome(panePid ?? void 0);
|
|
1484
1609
|
}
|
|
@@ -4196,6 +4321,9 @@ var ConnectionManager = class {
|
|
|
4196
4321
|
// src/control-dispatcher.ts
|
|
4197
4322
|
var crypto2 = __toESM(require("crypto"));
|
|
4198
4323
|
var import_child_process5 = require("child_process");
|
|
4324
|
+
var fs5 = __toESM(require("fs"));
|
|
4325
|
+
var os8 = __toESM(require("os"));
|
|
4326
|
+
var path4 = __toESM(require("path"));
|
|
4199
4327
|
var import_ws4 = __toESM(require("ws"));
|
|
4200
4328
|
|
|
4201
4329
|
// src/service.ts
|
|
@@ -4853,6 +4981,10 @@ function isProcessAlive(pid) {
|
|
|
4853
4981
|
function delay(ms) {
|
|
4854
4982
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
4855
4983
|
}
|
|
4984
|
+
function safeAttachmentName(name) {
|
|
4985
|
+
const base = path4.basename(name || "attachment").replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
4986
|
+
return base.slice(0, 120) || "attachment";
|
|
4987
|
+
}
|
|
4856
4988
|
var ControlDispatcher = class {
|
|
4857
4989
|
shell;
|
|
4858
4990
|
streamer;
|
|
@@ -4931,9 +5063,10 @@ var ControlDispatcher = class {
|
|
|
4931
5063
|
"disconnect",
|
|
4932
5064
|
"kill-process",
|
|
4933
5065
|
"start-agent",
|
|
4934
|
-
"provision"
|
|
5066
|
+
"provision",
|
|
5067
|
+
"upload-file"
|
|
4935
5068
|
]);
|
|
4936
|
-
if (dangerousActions.has(action) && this.connection.sessionKey) {
|
|
5069
|
+
if (dangerousActions.has(action) && this.connection.sessionKey && payload._verifiedEncrypted !== true) {
|
|
4937
5070
|
if (!this.verifyMessageHmac(payload)) {
|
|
4938
5071
|
log13.warn("rejecting control action \u2014 HMAC verification failed", { action });
|
|
4939
5072
|
return;
|
|
@@ -5065,9 +5198,42 @@ var ControlDispatcher = class {
|
|
|
5065
5198
|
this.transcriptWatcher.handleSyncRequest(sessionId, fromSeq);
|
|
5066
5199
|
}
|
|
5067
5200
|
return;
|
|
5201
|
+
case "upload-file":
|
|
5202
|
+
this.handleUploadFile(sessionId, payload);
|
|
5203
|
+
return;
|
|
5068
5204
|
default:
|
|
5069
5205
|
}
|
|
5070
5206
|
}
|
|
5207
|
+
handleUploadFile(sessionId, payload) {
|
|
5208
|
+
if (!sessionId) return;
|
|
5209
|
+
const fileName = typeof payload.fileName === "string" ? payload.fileName : "attachment";
|
|
5210
|
+
const contentBase64 = typeof payload.contentBase64 === "string" ? payload.contentBase64 : "";
|
|
5211
|
+
if (!contentBase64 || contentBase64.length > 8 * 1024 * 1024) {
|
|
5212
|
+
log13.warn("rejecting attachment upload \u2014 invalid size", { sessionId, fileName });
|
|
5213
|
+
return;
|
|
5214
|
+
}
|
|
5215
|
+
let content;
|
|
5216
|
+
try {
|
|
5217
|
+
content = Buffer.from(contentBase64, "base64");
|
|
5218
|
+
} catch {
|
|
5219
|
+
log13.warn("rejecting attachment upload \u2014 invalid base64", { sessionId, fileName });
|
|
5220
|
+
return;
|
|
5221
|
+
}
|
|
5222
|
+
if (content.length === 0 || content.length > 6 * 1024 * 1024) {
|
|
5223
|
+
log13.warn("rejecting attachment upload \u2014 decoded size out of bounds", {
|
|
5224
|
+
sessionId,
|
|
5225
|
+
fileName,
|
|
5226
|
+
bytes: content.length
|
|
5227
|
+
});
|
|
5228
|
+
return;
|
|
5229
|
+
}
|
|
5230
|
+
const uploadDir = path4.join(os8.homedir(), ".cache", "ragent", "attachments");
|
|
5231
|
+
fs5.mkdirSync(uploadDir, { recursive: true, mode: 448 });
|
|
5232
|
+
const writtenPath = path4.join(uploadDir, `${Date.now()}-${safeAttachmentName(fileName)}`);
|
|
5233
|
+
fs5.writeFileSync(writtenPath, content, { mode: 384 });
|
|
5234
|
+
log13.info("attachment uploaded", { sessionId, path: writtenPath, bytes: content.length });
|
|
5235
|
+
this.handleInput(writtenPath, sessionId);
|
|
5236
|
+
}
|
|
5071
5237
|
/** Handle input routing to the correct target. */
|
|
5072
5238
|
handleInput(data, sessionId) {
|
|
5073
5239
|
this.connection.requestInventorySync(800);
|
|
@@ -5645,11 +5811,11 @@ var ApprovalEnforcer = class {
|
|
|
5645
5811
|
var log15 = createLogger("agent");
|
|
5646
5812
|
var MAX_TRANSPORT_CHUNK_BYTES = 24 * 1024;
|
|
5647
5813
|
function pidFilePath(hostId) {
|
|
5648
|
-
return
|
|
5814
|
+
return path5.join(CONFIG_DIR, `agent-${hostId}.pid`);
|
|
5649
5815
|
}
|
|
5650
5816
|
function readPidFile(filePath) {
|
|
5651
5817
|
try {
|
|
5652
|
-
const raw =
|
|
5818
|
+
const raw = fs6.readFileSync(filePath, "utf8").trim();
|
|
5653
5819
|
const pid = Number.parseInt(raw, 10);
|
|
5654
5820
|
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
5655
5821
|
} catch {
|
|
@@ -5674,7 +5840,7 @@ function acquirePidLock(hostId) {
|
|
|
5674
5840
|
Stop it first with: kill ${existingPid} \u2014 or: ragent service stop`
|
|
5675
5841
|
);
|
|
5676
5842
|
}
|
|
5677
|
-
|
|
5843
|
+
fs6.writeFileSync(lockPath, `${process.pid}
|
|
5678
5844
|
`, "utf8");
|
|
5679
5845
|
return lockPath;
|
|
5680
5846
|
}
|
|
@@ -5682,7 +5848,7 @@ function releasePidLock(lockPath) {
|
|
|
5682
5848
|
try {
|
|
5683
5849
|
const currentPid = readPidFile(lockPath);
|
|
5684
5850
|
if (currentPid === process.pid) {
|
|
5685
|
-
|
|
5851
|
+
fs6.unlinkSync(lockPath);
|
|
5686
5852
|
}
|
|
5687
5853
|
} catch {
|
|
5688
5854
|
}
|
|
@@ -5691,7 +5857,7 @@ function resolveRunOptions(commandOptions) {
|
|
|
5691
5857
|
const config = loadConfig();
|
|
5692
5858
|
const portal = commandOptions.portal || config.portal || DEFAULT_PORTAL;
|
|
5693
5859
|
const hostId = sanitizeHostId(commandOptions.id || config.hostId || inferHostId());
|
|
5694
|
-
const hostName = commandOptions.name || config.hostName ||
|
|
5860
|
+
const hostName = commandOptions.name || config.hostName || os9.hostname();
|
|
5695
5861
|
const command = commandOptions.command || config.command || "bash";
|
|
5696
5862
|
const agentToken = commandOptions.agentToken || config.agentToken || "";
|
|
5697
5863
|
return { portal, hostId, hostName, command, agentToken };
|
|
@@ -5927,7 +6093,7 @@ async function runAgent(rawOptions) {
|
|
|
5927
6093
|
sendToGroup(ws, groups.privateGroup, {
|
|
5928
6094
|
type: "register",
|
|
5929
6095
|
hostName: options.hostName,
|
|
5930
|
-
environment:
|
|
6096
|
+
environment: os9.platform()
|
|
5931
6097
|
});
|
|
5932
6098
|
conn.replayBufferedOutput((chunk) => {
|
|
5933
6099
|
for (const outputChunk of splitTransportChunks(chunk)) {
|
|
@@ -6019,7 +6185,46 @@ async function runAgent(rawOptions) {
|
|
|
6019
6185
|
const sid = typeof payload.sessionId === "string" ? payload.sessionId.trim() : "";
|
|
6020
6186
|
dispatcher.handleResize(payload.cols, payload.rows, sid);
|
|
6021
6187
|
} else if (payload.type === "control" && typeof payload.action === "string") {
|
|
6022
|
-
|
|
6188
|
+
let controlPayload = payload;
|
|
6189
|
+
if (typeof payload.enc === "string" && typeof payload.iv === "string" && conn.sessionKey) {
|
|
6190
|
+
const inSeq = typeof payload.seq === "number" ? payload.seq : null;
|
|
6191
|
+
const rxSeq = conn.getRxSeqForViewer(payload.viewerId);
|
|
6192
|
+
if (inSeq === null) {
|
|
6193
|
+
log15.warn("rejecting encrypted control frame without seq");
|
|
6194
|
+
return;
|
|
6195
|
+
}
|
|
6196
|
+
if (!rxSeq.accept(inSeq)) {
|
|
6197
|
+
log15.warn("rejecting replayed/out-of-order control", {
|
|
6198
|
+
seq: inSeq,
|
|
6199
|
+
lastSeen: rxSeq.lastSeq,
|
|
6200
|
+
viewerId: typeof payload.viewerId === "string" ? payload.viewerId : "_legacy"
|
|
6201
|
+
});
|
|
6202
|
+
return;
|
|
6203
|
+
}
|
|
6204
|
+
const decrypted = decryptPayload(
|
|
6205
|
+
payload.enc,
|
|
6206
|
+
payload.iv,
|
|
6207
|
+
conn.sessionKey,
|
|
6208
|
+
inSeq
|
|
6209
|
+
);
|
|
6210
|
+
if (decrypted === null) {
|
|
6211
|
+
log15.warn("failed to decrypt control \u2014 ignoring");
|
|
6212
|
+
return;
|
|
6213
|
+
}
|
|
6214
|
+
try {
|
|
6215
|
+
controlPayload = {
|
|
6216
|
+
...JSON.parse(decrypted),
|
|
6217
|
+
_verifiedEncrypted: true
|
|
6218
|
+
};
|
|
6219
|
+
} catch {
|
|
6220
|
+
log15.warn("failed to parse encrypted control payload");
|
|
6221
|
+
return;
|
|
6222
|
+
}
|
|
6223
|
+
} else if (conn.sessionKey && payload.action === "upload-file") {
|
|
6224
|
+
log15.warn("rejecting plaintext attachment upload while encrypted channel is active");
|
|
6225
|
+
return;
|
|
6226
|
+
}
|
|
6227
|
+
await dispatcher.handleControlAction(controlPayload);
|
|
6023
6228
|
} else if (payload.type === "start-agent") {
|
|
6024
6229
|
await dispatcher.handleControlAction({ ...payload, action: "start-agent" });
|
|
6025
6230
|
} else if (payload.type === "provision") {
|
|
@@ -6190,7 +6395,7 @@ var log16 = createLogger("connect");
|
|
|
6190
6395
|
async function connectMachine(opts) {
|
|
6191
6396
|
const portal = opts.portal || DEFAULT_PORTAL;
|
|
6192
6397
|
const hostId = sanitizeHostId(opts.id || inferHostId());
|
|
6193
|
-
const hostName = opts.name ||
|
|
6398
|
+
const hostName = opts.name || os10.hostname();
|
|
6194
6399
|
const command = opts.command || "bash";
|
|
6195
6400
|
if (!opts.token) {
|
|
6196
6401
|
throw new Error("Connection token is required.");
|
|
@@ -6265,13 +6470,13 @@ function registerRunCommand(program2) {
|
|
|
6265
6470
|
}
|
|
6266
6471
|
|
|
6267
6472
|
// src/commands/doctor.ts
|
|
6268
|
-
var
|
|
6473
|
+
var os11 = __toESM(require("os"));
|
|
6269
6474
|
var log18 = createLogger("doctor");
|
|
6270
6475
|
async function runDoctor(opts) {
|
|
6271
6476
|
const options = resolveRunOptions(opts);
|
|
6272
6477
|
const checks = [];
|
|
6273
|
-
const platformOk =
|
|
6274
|
-
checks.push({ name: "platform", ok: platformOk, detail:
|
|
6478
|
+
const platformOk = os11.platform() === "linux";
|
|
6479
|
+
checks.push({ name: "platform", ok: platformOk, detail: os11.platform() });
|
|
6275
6480
|
checks.push({
|
|
6276
6481
|
name: "node",
|
|
6277
6482
|
ok: Number(process.versions.node.split(".")[0]) >= 20,
|
|
@@ -6456,7 +6661,7 @@ function registerServiceCommand(program2) {
|
|
|
6456
6661
|
}
|
|
6457
6662
|
|
|
6458
6663
|
// src/commands/uninstall.ts
|
|
6459
|
-
var
|
|
6664
|
+
var fs7 = __toESM(require("fs"));
|
|
6460
6665
|
var log21 = createLogger("uninstall");
|
|
6461
6666
|
async function uninstallAgent(opts) {
|
|
6462
6667
|
const config = loadConfig();
|
|
@@ -6488,8 +6693,8 @@ async function uninstallAgent(opts) {
|
|
|
6488
6693
|
}
|
|
6489
6694
|
log21.info("stopping and removing service");
|
|
6490
6695
|
await uninstallService().catch(() => void 0);
|
|
6491
|
-
if (
|
|
6492
|
-
|
|
6696
|
+
if (fs7.existsSync(CONFIG_DIR)) {
|
|
6697
|
+
fs7.rmSync(CONFIG_DIR, { recursive: true, force: true });
|
|
6493
6698
|
log21.info("removed config directory", { path: CONFIG_DIR });
|
|
6494
6699
|
}
|
|
6495
6700
|
try {
|
|
@@ -6592,7 +6797,7 @@ function showStatus() {
|
|
|
6592
6797
|
ragent v${CURRENT_VERSION}
|
|
6593
6798
|
`);
|
|
6594
6799
|
try {
|
|
6595
|
-
const raw =
|
|
6800
|
+
const raw = fs8.readFileSync(CONFIG_FILE, "utf8");
|
|
6596
6801
|
const config = JSON.parse(raw);
|
|
6597
6802
|
if (config.portal && config.agentToken) {
|
|
6598
6803
|
console.log(` Status: Connected`);
|
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.5",
|
|
1170
|
+
"bom-ref": "ragent-live|ragent-cli@1.11.5",
|
|
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.5",
|
|
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.5"
|
|
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.5",
|
|
1440
1440
|
"dependsOn": [
|
|
1441
1441
|
"ragent-live|@azure/web-pubsub-client@1.0.4",
|
|
1442
1442
|
"ragent-live|commander@14.0.3",
|