ragent-cli 1.5.1 → 1.5.2
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 +22 -14
- 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.5.
|
|
34
|
+
version: "1.5.2",
|
|
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: {
|
|
@@ -2775,25 +2775,33 @@ var ClaudeCodeParser = class {
|
|
|
2775
2775
|
parseUserToolResults(obj) {
|
|
2776
2776
|
const content = obj.message.content;
|
|
2777
2777
|
const tools = [];
|
|
2778
|
+
const textBlocks = [];
|
|
2778
2779
|
for (const block of content) {
|
|
2779
|
-
if (block.type
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2780
|
+
if (block.type === "tool_result") {
|
|
2781
|
+
const toolName = (block.tool_use_id && this.pendingTools.get(block.tool_use_id)) ?? "Tool";
|
|
2782
|
+
const resultText = this.extractToolResultText(block);
|
|
2783
|
+
if (block.tool_use_id) {
|
|
2784
|
+
this.pendingTools.delete(block.tool_use_id);
|
|
2785
|
+
}
|
|
2786
|
+
tools.push({
|
|
2787
|
+
name: toolName,
|
|
2788
|
+
status: block.is_error ? "error" : "completed",
|
|
2789
|
+
result: resultText || void 0
|
|
2790
|
+
});
|
|
2791
|
+
} else if (block.type === "text" && typeof block.text === "string") {
|
|
2792
|
+
const t = block.text.trim();
|
|
2793
|
+
if (t && !t.startsWith("<") && !t.startsWith("[Request interrupted")) {
|
|
2794
|
+
textBlocks.push(t);
|
|
2795
|
+
}
|
|
2784
2796
|
}
|
|
2785
|
-
tools.push({
|
|
2786
|
-
name: toolName,
|
|
2787
|
-
status: block.is_error ? "error" : "completed",
|
|
2788
|
-
result: resultText || void 0
|
|
2789
|
-
});
|
|
2790
2797
|
}
|
|
2791
|
-
|
|
2798
|
+
const text = textBlocks.join("\n").trim();
|
|
2799
|
+
if (tools.length === 0 && !text) return null;
|
|
2792
2800
|
return {
|
|
2793
2801
|
turnId: obj.uuid ?? `result-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
2794
2802
|
role: "user",
|
|
2795
|
-
content:
|
|
2796
|
-
tools,
|
|
2803
|
+
content: text,
|
|
2804
|
+
tools: tools.length > 0 ? tools : void 0,
|
|
2797
2805
|
timestamp: obj.timestamp ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
2798
2806
|
};
|
|
2799
2807
|
}
|