davsclaus opened a new pull request, #29939: URL: https://github.com/apache/camel/pull/29939
Item 5 of [CAMEL-26932](https://issues.apache.org/jira/browse/CAMEL-26932): source lines come back with escaped quotes. ## Problem The dev consoles escape each line of a `code` list with `Jsoner.escape` (JSON text in JSON): `ConsoleHelper` (source), `RouteDumpDevConsole`, `RouteStructureDevConsole`, `MessageHistoryDevConsole`. The CLI commands undo it when they print the lines (`CamelRouteDumpAction`, `CamelSourceAction`), but the AI tools of the MCP server and `camel ask` gave the answers as they came. So `route_source`, `route_dump`, `route_structure`, `processor_detail`, `config_drift`, `route_analysis` and `history` showed the agent `\"` and `\\` that are not in the file. `camel_edit_file` already works around this for the text an agent copies from such an answer (CAMEL-24909). ## Change `ToolContext` gives the lines as they are in the file: the `code` of each line of a `code` list is unescaped once, in the answers of `executeAction` and in the history and error files the tools read. Only those lines change; a message body or a header is left as the integration wrote it. The consoles are not changed: the CLI unescapes their lines, and an integration of an older Camel still escapes them, so the fix is where the tools read the answers. ## Tests - `ToolContextCodeLinesTest` (new): a route line with quotes and a backslash, escaped as a console escapes it, is the line of the file after the walk, also after a JSON round trip; a line without escapes is no change; a `code` value outside a list of lines, and a body, are left as they were. - The AI tool tests (`ToolRegistry*`, `AuthoringTools*`) pass. - camel-jbang-run: 303 pass. camel-jbang-core: 3005 + 259 pass (`DependencyUpdateTest` failed once and passed on the rerun, as on other branches). _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
