gnodet-bot commented on code in PR #29939:
URL: https://github.com/apache/camel/pull/29939#discussion_r4573532970


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/ToolContext.java:
##########
@@ -360,18 +363,58 @@ public String executeAction(String action, 
Consumer<JsonObject> configure) {
             if (!result.isOk()) {
                 throw new ToolExecutionException(result.error());
             }
+            if (unescapeCodeLines(json)) {
+                return json.toJson();
+            }
         }
         return answer;
     }
 
     public JsonObject readErrorFile() {
         requireProcess();
-        return RuntimeHelper.readErrorFile(pid);
+        JsonObject errors = RuntimeHelper.readErrorFile(pid);
+        unescapeCodeLines(errors);
+        return errors;
     }
 
     public JsonObject readHistoryFile() {
         requireProcess();
-        return RuntimeHelper.readHistoryFile(pid);
+        JsonObject history = RuntimeHelper.readHistoryFile(pid);
+        unescapeCodeLines(history);
+        return history;
+    }
+
+    /**
+     * The lines of source code as they are in the file. The dev consoles 
escape each line of a {@code code} list, as
+     * JSON text in JSON, and the CLI commands undo it when they print the 
lines; the AI tools gave the lines as they
+     * came, so the agent saw {@code \"} that is not in the file (CAMEL-26932).

Review Comment:
   **[doc-clarity, low]** The description sentence exceeds 25 words and chains 
multiple clauses. Consider splitting into two shorter sentences:
   
   ```suggestion
        * Unescapes the lines of source code returned by the dev consoles. The 
dev consoles
        * escape each line of a {@code code} list as JSON text in JSON; the AI 
tools returned
        * those lines as-is, so the agent saw {@code \\\"} instead of the 
actual file content
        * (CAMEL-26932).
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to