ragent-cli 1.11.3 → 1.11.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.
- package/dist/index.js +154 -39
- 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.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: {
|
|
@@ -1742,10 +1742,25 @@ var TranscriptWatcherManager = class {
|
|
|
1742
1742
|
}
|
|
1743
1743
|
/** Enable markdown streaming for a session. */
|
|
1744
1744
|
enableMarkdown(sessionId, agentType) {
|
|
1745
|
+
const requestedAgentType = agentType ?? "";
|
|
1745
1746
|
const existing = this.active.get(sessionId);
|
|
1746
1747
|
if (existing) {
|
|
1747
|
-
|
|
1748
|
-
|
|
1748
|
+
const newPath = discoverTranscriptFile(sessionId, agentType);
|
|
1749
|
+
const agentChanged = existing.agentType !== requestedAgentType;
|
|
1750
|
+
const pathChanged = Boolean(newPath && newPath !== existing.filePath);
|
|
1751
|
+
const existingPathGone = !fs2.existsSync(existing.filePath);
|
|
1752
|
+
if (!agentChanged && !pathChanged && !existingPathGone) {
|
|
1753
|
+
existing.watcher.addSubscriber();
|
|
1754
|
+
return { ok: true };
|
|
1755
|
+
}
|
|
1756
|
+
existing.watcher.stop();
|
|
1757
|
+
this.active.delete(sessionId);
|
|
1758
|
+
this.stopRediscovery(sessionId);
|
|
1759
|
+
this.clearTranscriptState(sessionId);
|
|
1760
|
+
if (!newPath) {
|
|
1761
|
+
log5.info("no replacement transcript file found", { sessionId, agentType });
|
|
1762
|
+
return { ok: false, reason: "no_transcript" };
|
|
1763
|
+
}
|
|
1749
1764
|
}
|
|
1750
1765
|
const parser = getParser(agentType);
|
|
1751
1766
|
if (!parser) {
|
|
@@ -1791,6 +1806,12 @@ var TranscriptWatcherManager = class {
|
|
|
1791
1806
|
this.startRediscovery(sessionId, agentType);
|
|
1792
1807
|
return { ok: true };
|
|
1793
1808
|
}
|
|
1809
|
+
clearTranscriptState(sessionId) {
|
|
1810
|
+
this.sendSnapshotFn(sessionId, [], 0);
|
|
1811
|
+
if (this.sendV2SnapshotFn) {
|
|
1812
|
+
this.sendV2SnapshotFn(sessionId, createEmptySnapshot(sessionId), 0);
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1794
1815
|
/** Disable markdown streaming for a session. */
|
|
1795
1816
|
disableMarkdown(sessionId) {
|
|
1796
1817
|
const session = this.active.get(sessionId);
|
|
@@ -3120,26 +3141,23 @@ var SessionStreamer = class {
|
|
|
3120
3141
|
alternateScreen = altFlag === "1";
|
|
3121
3142
|
} catch {
|
|
3122
3143
|
}
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
);
|
|
3132
|
-
if (scrollback && scrollback.length > 0) {
|
|
3133
|
-
this.sendFn(sessionId, scrollback.replace(/\n/g, "\r\n"));
|
|
3134
|
-
}
|
|
3135
|
-
} catch {
|
|
3144
|
+
try {
|
|
3145
|
+
const scrollback = (0, import_node_child_process2.execFileSync)(
|
|
3146
|
+
"tmux",
|
|
3147
|
+
["capture-pane", "-t", paneTarget, "-p", "-e", "-S", "-5000", "-E", "-1"],
|
|
3148
|
+
{ env: cleanEnv, timeout: 1e4, encoding: "utf-8" }
|
|
3149
|
+
);
|
|
3150
|
+
if (scrollback && scrollback.length > 0) {
|
|
3151
|
+
this.sendFn(sessionId, scrollback.replace(/\n/g, "\r\n"));
|
|
3136
3152
|
}
|
|
3137
|
-
|
|
3153
|
+
} catch {
|
|
3138
3154
|
}
|
|
3155
|
+
this.sendFn(sessionId, "\x1B[?1049l\x1B[0m\x1B[2J\x1B[H");
|
|
3139
3156
|
try {
|
|
3157
|
+
const captureArgs = alternateScreen ? ["capture-pane", "-a", "-t", paneTarget, "-p", "-e"] : ["capture-pane", "-t", paneTarget, "-p", "-e"];
|
|
3140
3158
|
const initial = (0, import_node_child_process2.execFileSync)(
|
|
3141
3159
|
"tmux",
|
|
3142
|
-
|
|
3160
|
+
captureArgs,
|
|
3143
3161
|
{ env: cleanEnv, timeout: 5e3, encoding: "utf-8" }
|
|
3144
3162
|
);
|
|
3145
3163
|
if (initial) {
|
|
@@ -3261,26 +3279,23 @@ var SessionStreamer = class {
|
|
|
3261
3279
|
} catch {
|
|
3262
3280
|
}
|
|
3263
3281
|
stream.alternateScreen = alternateScreen;
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
);
|
|
3273
|
-
if (scrollback && scrollback.length > 0) {
|
|
3274
|
-
this.sendFn(sessionId, scrollback.replace(/\n/g, "\r\n"));
|
|
3275
|
-
}
|
|
3276
|
-
} catch {
|
|
3282
|
+
try {
|
|
3283
|
+
const scrollback = (0, import_node_child_process2.execFileSync)(
|
|
3284
|
+
"tmux",
|
|
3285
|
+
["capture-pane", "-t", paneTarget, "-p", "-e", "-S", "-5000", "-E", "-1"],
|
|
3286
|
+
{ env: cleanEnv, timeout: 1e4, encoding: "utf-8" }
|
|
3287
|
+
);
|
|
3288
|
+
if (scrollback && scrollback.length > 0) {
|
|
3289
|
+
this.sendFn(sessionId, scrollback.replace(/\n/g, "\r\n"));
|
|
3277
3290
|
}
|
|
3278
|
-
|
|
3291
|
+
} catch {
|
|
3279
3292
|
}
|
|
3293
|
+
this.sendFn(sessionId, "\x1B[?1049l\x1B[0m\x1B[2J\x1B[H");
|
|
3280
3294
|
try {
|
|
3295
|
+
const captureArgs = alternateScreen ? ["capture-pane", "-a", "-t", paneTarget, "-p", "-e"] : ["capture-pane", "-t", paneTarget, "-p", "-e"];
|
|
3281
3296
|
const initial = (0, import_node_child_process2.execFileSync)(
|
|
3282
3297
|
"tmux",
|
|
3283
|
-
|
|
3298
|
+
captureArgs,
|
|
3284
3299
|
{ env: cleanEnv, timeout: 5e3, encoding: "utf-8" }
|
|
3285
3300
|
);
|
|
3286
3301
|
if (initial) {
|
|
@@ -3642,6 +3657,105 @@ var SequenceTracker = class {
|
|
|
3642
3657
|
var import_node_child_process3 = require("child_process");
|
|
3643
3658
|
var pty2 = __toESM(require("node-pty"));
|
|
3644
3659
|
var log9 = createLogger("pty");
|
|
3660
|
+
var ANSI_KEY_SEQUENCES = /* @__PURE__ */ new Map([
|
|
3661
|
+
["\x1B[A", "Up"],
|
|
3662
|
+
["\x1B[B", "Down"],
|
|
3663
|
+
["\x1B[C", "Right"],
|
|
3664
|
+
["\x1B[D", "Left"],
|
|
3665
|
+
["\x1B[H", "Home"],
|
|
3666
|
+
["\x1B[F", "End"],
|
|
3667
|
+
["\x1BOH", "Home"],
|
|
3668
|
+
["\x1BOF", "End"],
|
|
3669
|
+
["\x1B[1~", "Home"],
|
|
3670
|
+
["\x1B[4~", "End"],
|
|
3671
|
+
["\x1B[3~", "Delete"],
|
|
3672
|
+
["\x1B[5~", "PageUp"],
|
|
3673
|
+
["\x1B[6~", "PageDown"]
|
|
3674
|
+
]);
|
|
3675
|
+
function controlKeyName(charCode) {
|
|
3676
|
+
if (charCode >= 1 && charCode <= 26) {
|
|
3677
|
+
return `C-${String.fromCharCode(charCode + 96)}`;
|
|
3678
|
+
}
|
|
3679
|
+
switch (charCode) {
|
|
3680
|
+
case 0:
|
|
3681
|
+
return "C-Space";
|
|
3682
|
+
case 27:
|
|
3683
|
+
return "Escape";
|
|
3684
|
+
case 28:
|
|
3685
|
+
return "C-\\";
|
|
3686
|
+
case 29:
|
|
3687
|
+
return "C-]";
|
|
3688
|
+
case 30:
|
|
3689
|
+
return "C-^";
|
|
3690
|
+
case 31:
|
|
3691
|
+
return "C-_";
|
|
3692
|
+
default:
|
|
3693
|
+
return null;
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
function appendLiteralSegment(segments, value) {
|
|
3697
|
+
if (!value) return;
|
|
3698
|
+
const previous = segments[segments.length - 1];
|
|
3699
|
+
if (previous?.kind === "literal") {
|
|
3700
|
+
previous.value += value;
|
|
3701
|
+
} else {
|
|
3702
|
+
segments.push({ kind: "literal", value });
|
|
3703
|
+
}
|
|
3704
|
+
}
|
|
3705
|
+
function encodeTmuxInput(data) {
|
|
3706
|
+
const segments = [];
|
|
3707
|
+
let literal = "";
|
|
3708
|
+
const flushLiteral = () => {
|
|
3709
|
+
appendLiteralSegment(segments, literal);
|
|
3710
|
+
literal = "";
|
|
3711
|
+
};
|
|
3712
|
+
for (let i = 0; i < data.length; i++) {
|
|
3713
|
+
const remaining = data.slice(i);
|
|
3714
|
+
const matchedSequence = Array.from(ANSI_KEY_SEQUENCES.entries()).find(([sequence]) => remaining.startsWith(sequence));
|
|
3715
|
+
if (matchedSequence) {
|
|
3716
|
+
flushLiteral();
|
|
3717
|
+
const [sequence, key] = matchedSequence;
|
|
3718
|
+
segments.push({ kind: "key", value: key });
|
|
3719
|
+
i += sequence.length - 1;
|
|
3720
|
+
continue;
|
|
3721
|
+
}
|
|
3722
|
+
const charCode = data.charCodeAt(i);
|
|
3723
|
+
if (data[i] === "\r" || data[i] === "\n") {
|
|
3724
|
+
flushLiteral();
|
|
3725
|
+
segments.push({ kind: "key", value: "Enter" });
|
|
3726
|
+
continue;
|
|
3727
|
+
}
|
|
3728
|
+
if (data[i] === " ") {
|
|
3729
|
+
flushLiteral();
|
|
3730
|
+
segments.push({ kind: "key", value: "Tab" });
|
|
3731
|
+
continue;
|
|
3732
|
+
}
|
|
3733
|
+
if (data[i] === "\x7F" || data[i] === "\b") {
|
|
3734
|
+
flushLiteral();
|
|
3735
|
+
segments.push({ kind: "key", value: "BSpace" });
|
|
3736
|
+
continue;
|
|
3737
|
+
}
|
|
3738
|
+
if (charCode < 32) {
|
|
3739
|
+
const keyName = controlKeyName(charCode);
|
|
3740
|
+
if (keyName) {
|
|
3741
|
+
flushLiteral();
|
|
3742
|
+
segments.push({ kind: "key", value: keyName });
|
|
3743
|
+
continue;
|
|
3744
|
+
}
|
|
3745
|
+
}
|
|
3746
|
+
literal += data[i];
|
|
3747
|
+
}
|
|
3748
|
+
flushLiteral();
|
|
3749
|
+
return segments;
|
|
3750
|
+
}
|
|
3751
|
+
function execTmuxSendKeys(args) {
|
|
3752
|
+
return new Promise((resolve, reject) => {
|
|
3753
|
+
(0, import_node_child_process3.execFile)("tmux", args, { timeout: 5e3 }, (err) => {
|
|
3754
|
+
if (err) reject(err);
|
|
3755
|
+
else resolve();
|
|
3756
|
+
});
|
|
3757
|
+
});
|
|
3758
|
+
}
|
|
3645
3759
|
function isInteractiveShell(command) {
|
|
3646
3760
|
const trimmed = String(command).trim();
|
|
3647
3761
|
return ["bash", "sh", "zsh", "fish"].includes(trimmed);
|
|
@@ -3678,12 +3792,13 @@ async function sendInputToTmux(sessionId, data) {
|
|
|
3678
3792
|
return;
|
|
3679
3793
|
}
|
|
3680
3794
|
try {
|
|
3681
|
-
|
|
3682
|
-
(
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3795
|
+
for (const segment of encodeTmuxInput(data)) {
|
|
3796
|
+
if (segment.kind === "literal") {
|
|
3797
|
+
await execTmuxSendKeys(["send-keys", "-t", target, "-l", "--", segment.value]);
|
|
3798
|
+
} else {
|
|
3799
|
+
await execTmuxSendKeys(["send-keys", "-t", target, "--", segment.value]);
|
|
3800
|
+
}
|
|
3801
|
+
}
|
|
3687
3802
|
} catch (error) {
|
|
3688
3803
|
const message = error instanceof Error ? error.message : String(error);
|
|
3689
3804
|
log9.warn("failed to send input", { sessionId, error: message });
|
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.4",
|
|
1170
|
+
"bom-ref": "ragent-live|ragent-cli@1.11.4",
|
|
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.4",
|
|
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.4"
|
|
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.4",
|
|
1440
1440
|
"dependsOn": [
|
|
1441
1441
|
"ragent-live|@azure/web-pubsub-client@1.0.4",
|
|
1442
1442
|
"ragent-live|commander@14.0.3",
|