davsclaus opened a new pull request, #27633: URL: https://github.com/apache/camel/pull/27633
[CAMEL-25501](https://issues.apache.org/jira/browse/CAMEL-25501) `camel_edit_file` replaced one snippet per call. A change to two places of a file (send to `direct:shipment` inside a split, and add the route that consumes it) was made in two calls, and in dev mode the half-done file was reloaded in between: the exchanges waited for a route that was not there yet, and the next reload cut them off. In the local-model benchmark this failed the route-aggregator example in 5 of 5 runs; in 109 of 355 steps the model wrote the same file more than once. **Several edits in one call** - `edits`: an optional list of `{find, replace}`, applied in order to the file's content, then validated, written and reloaded once. `find`/`replace` stay for a single edit (no longer required on their own). - All or nothing: when an edit does not match, the file is not changed and the answer says which one (`Edit 2 of 3: ...`), with the same help as today (nearest lines, file window). - The tool descriptor gains array parameters with an `items` schema; the MCP server takes a typed `List<FileEdit>`; `camel ask` passes list arguments as JSON instead of `toString()`. **Steering a model to it** - A write or edit whose YAML route sends to a `direct:` endpoint no route consumes yet now answers with a note (not an error, the route is often still to come): the messages sent there wait for it and are cut off by the reload that adds it, so add the route in the same call with `edits`. This is the existing consumer check (CAMEL-24955), which writes leave out as an error. - The `edits` description carries a short example of its shape. **camel-jbang monitor** - The edits are applied as one change for the user to confirm, and the direct-endpoint note is given there too. - The AI panel prompt points to `camel_edit_file` for changes, `camel_write_file` for a new file. The full-mode prefix budget is raised from 10250 to 10500 for the edits schema (measured ~10400); the system prompt stays within its 620. Related: CAMEL-25500 (#27632) makes the reload drain direct routes it stops; CAMEL-25484 logs a cut-off as one WARN. Tests: - `AuthoringToolsEditTest`: several edits written once, a miss leaves the file unchanged and names the edit, edits sent as a JSON string, a wrong shape, the schema, and the direct-endpoint note (present for the half-done edit, gone when the route comes in the same call). - camel-jbang-mcp `AuthoringToolsTest`: edits through the MCP wrapper; the argument parity test covers the new argument. - `McpFacadeWriteFileTest`: the monitor confirms the edits as one change and notes the endpoint. - camel-jbang-core (1618), camel-jbang-mcp (435), camel-jbang-plugin-tui (1854) suites green; checked live against the built MCP server (schema and an edits call). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m -- 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]
