[
https://issues.apache.org/jira/browse/CAMEL-24798?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-24798:
--------------------------------
Fix Version/s: 4.23.0
> camel-jbang - camel_get_files should understand the Maven project layout:
> recursive listing, relative paths, and the routes' source files from the
> running integration
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-24798
> URL: https://issues.apache.org/jira/browse/CAMEL-24798
> Project: Camel
> Issue Type: Improvement
> Components: camel-jbang
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.23.0
>
>
> Observed 2026-09-17 in the TUI AI panel with Ollama (qwen3.6:35b-a3b) against
> an integration started with camel run --runtime=spring-boot, which exports a
> Maven project to ~/workspace/.camel-jbang-run/<id>/ and runs the fat jar. The
> question "what's the name of the source file that has the route" cost 26
> requests (the 25 tool-call limit plus the wrap-up) and a wrong answer ("the
> route file is missing"). The file is
> src/main/resources/camel/timer-log.camel.yaml.
> The AI log shows why, and none of it is the model's fault:
> # {{camel_get_files}} lists regular files of one directory only
> ({{Files.list}} filtered by {{isRegularFile}}). Listing src/main/resources
> returned application.properties, log4j2*.properties and README.md and gave no
> hint that a camel/ folder exists. The model then guessed routes/, META-INF/,
> timer-log.yaml, routes.yaml, timer-log.camel.yaml in the wrong folder, one
> call each.
> # {{file}} must be a plain name: {{routes/timer-log.yaml}} was refused with
> "file must be a plain file name", so even a correct guess of
> camel/timer-log.camel.yaml would have failed.
> # The TUI's variant ({{McpFacade.getFiles}}, used when no directory is given)
> answers "No source files found for the selected integration" when a *file* is
> missing, which sent the model looking for the project elsewhere although the
> directory had been resolved correctly to the exported project root.
> # The running integration already knows the answer: the status document's
> routes[].source is
> {{nested:/Users/.../.camel-jbang-run/1789636115302/target/timer-log-1.0-SNAPSHOT.jar/!BOOT-INF/classes/!/camel/timer-log.camel.yaml:4}}
> and runtime.directory is the project root. Nothing maps that onto
> src/main/resources/camel/timer-log.camel.yaml for the model.
> A human with {{ls -R}} answers this in one look; the tool must let a 35B
> model do the same. Proposal, in the shared authoring tools (camel-jbang-core
> AuthoringTools, so camel mcp, camel tui --mcp and the F8 panel all get it):
> * *Recursive listing with relative paths.* Without {{file}}, walk the project
> directory (skipping target/, build/, .git, .mvn, .idea, node_modules and the
> like) up to the existing cap of 99 entries and return path, size, type and a
> kind: route (YAML/XML files whose content starts a route, e.g. "- route:", "-
> from:", "<routes", "<camelContext"; Java files containing RouteBuilder),
> config (application*.properties/yaml), java, pom, doc, other. Add a short
> summary up front: layout (maven or flat), the project root, routeFiles[] and
> configFiles[], so the first call already names the route files.
> * *Relative paths in {{file}}.* Accept camel/timer-log.camel.yaml, still
> refusing anything that escapes the directory. Same for camel_write_file.
> * *The routes' source files from the running integration.* When the tool
> answers for a selected integration, add routes[] with routeId, file (relative
> to the project root) and line, derived from routes[].source: map
> nested:<jar>/!BOOT-INF/classes/!/<p> and classpath:<p> to
> src/main/resources/<p>, Quarkus' equivalent likewise, file:<p> as is. This is
> the direct answer to "which file has route X" and to "show me the route
> source".
> * *One implementation.* Fold the TUI's own variant into the shared tool (keep
> its editing/temporary metadata and its default directory from
> FilesBrowser.resolveSourceDirectory) and report a missing file as a missing
> file.
> * *Tell the model where to look.* The tool description should say that routes
> of a Maven project live under src/main/resources/camel or src/main/java. Keep
> it short: the description counts toward the local-model prompt budget
> (AiPanelPromptBudgetTest).
> Tests: fixtures for the exported Spring Boot layout, a flat directory and a
> Quarkus layout; the nested/classpath/file source mapping; parent-traversal
> still refused; the TUI's tool path with a missing file. Expected effect: the
> question above becomes one listing plus one read, two calls instead of 25,
> and the Ollama tab's per-question request count is the measure.
> Related: CAMEL-24794 (the Ollama tab that made the cost visible), CAMEL-24796
> (context and compaction), and the local model benchmark findings that most
> local-model failures are Camel problems that trip humans too.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)