This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch fix/CAMEL-24760
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 6d989c0384f5f61ea6404affb3a92d0b69686d30
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Sep 15 23:17:37 2026 +0200

    CAMEL-24760: camel-jbang - camel_catalog_find in the core tool set for 
local models, prefix budgets raised, prompt lines for the canonical YAML shape 
and file writes
    
    camel_catalog_find turns a product or protocol name (postgres, mqtt, 
artemis) into a component; it was outside
    the core set for lack of room in the prefix budget (4,291 of 4,300 
estimated tokens). The budget guards against
    accidental growth, not a model limit: core 5,000, full 9,200, system prompt 
620. Two lines in the system prompt
    from the benchmark traces (CAMEL-24698): write files only with 
camel_write_file, never paste them; the canonical
    YAML DSL shape, since the shorthand a model writes from memory is 
deprecated (CAMEL-24722).
    
    Co-Authored-By: Claude Fable 5.1 <[email protected]>
    Claude-Session: https://claude.ai/code/session_01Bp3538HRBPMQkb5ta9xRaj
---
 .../camel/dsl/jbang/core/commands/ai/AuthoringTools.java       |  1 +
 .../org/apache/camel/dsl/jbang/core/commands/tui/AiPanel.java  |  3 +++
 .../dsl/jbang/core/commands/tui/AiPanelPromptBudgetTest.java   | 10 +++++++---
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/AuthoringTools.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/AuthoringTools.java
index 3a190baef33b..f63629556da2 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/AuthoringTools.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/AuthoringTools.java
@@ -95,6 +95,7 @@ public final class AuthoringTools {
                         false)
                 .param("limit", "integer", "Maximum matches per kind (default 
10)", false)
                 .param("camelVersion", "string", VERSION_DESC, false)
+                .core(true)
                 .executor((ctx, args) -> {
                     applyVersion(ctx, args);
                     return CatalogDocs.find(ctx.catalog(), args.get("term"), 
args.get("kind"),
diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanel.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanel.java
index 1a45751f4eaa..50364f7fb45a 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanel.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanel.java
@@ -2898,6 +2898,9 @@ class AiPanel {
         sb.append(
                 "retry a rejected write. Invalid YAML/properties is refused 
with errors: fix them (camel_catalog_doc has the ");
         sb.append("option names)\n");
+        sb.append("- Write files only with camel_write_file; never paste file 
contents in the answer\n");
+        sb.append("- YAML DSL shape: a step is `- log: {message: ...}`, `- to: 
{uri: ...}`, an expression goes under ");
+        sb.append("expression: (`- setBody: {expression: {simple: ...}}`); the 
shorthand forms are deprecated\n");
         sb.append("- tui_set_log_level is the app's root logger, only when 
asked; 'log at WARN' in a route is the log ");
         sb.append("step's loggingLevel in the source\n");
         sb.append("- Simple: functions inside ${...}, operators between them: 
${header.a} == 'b', ");
diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanelPromptBudgetTest.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanelPromptBudgetTest.java
index 1536f25b26cf..1dabe6e6e4bb 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanelPromptBudgetTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanelPromptBudgetTest.java
@@ -39,13 +39,16 @@ class AiPanelPromptBudgetTest {
     // and from 3900 when the authoring tools became the camel_* set shared 
with camel-jbang-mcp (CAMEL-24695):
     // their schemas carry the directory and name arguments a server without a 
selection needs, and
     // camel_error_diagnose joined the core set
-    static final int CORE_BUDGET_TOKENS = 4_300;
+    // raised to 5000 when camel_catalog_find joined the core set 
(CAMEL-24760): the budget guards against accidental
+    // growth of the prefix, a 32k context leaves ample room
+    static final int CORE_BUDGET_TOKENS = 5_000;
     /** Measured ~6.9k tokens for 47 tools. */
     // raised from 7500 with tui_write_file and tui_validate_source
     // and from 7900 with the shared camel_* set (camel_catalog_find, 
camel_run and camel_error_diagnose added)
     // and from 8500 when camel_catalog_doc gained the api kind (CAMEL-24708): 
its kind argument names the core
     // classes and script languages the API reference covers, which is what 
makes a model ask for them
-    static final int FULL_BUDGET_TOKENS = 8_700;
+    // raised with the core budget (CAMEL-24760)
+    static final int FULL_BUDGET_TOKENS = 9_200;
 
     record Prefix(String mode, int tools, long promptChars, long toolChars) {
 
@@ -122,7 +125,8 @@ class AiPanelPromptBudgetTest {
         // the tool definitions already describe every tool; repeating them in 
prose doubles the cost
         // 450 before the file editing guidance (two bullets) was added
         // 530 before the tools were split into camel_* and tui_* in the 
introduction
-        assertTrue(AiPanel.estimateTokens(prompt.length()) <= 545,
+        // 545 before the file-write and canonical YAML shape lines 
(CAMEL-24760)
+        assertTrue(AiPanel.estimateTokens(prompt.length()) <= 620,
                 "system prompt grew to ~" + 
AiPanel.estimateTokens(prompt.length()) + " tokens");
         assertTrue(!prompt.contains("- tui_get_table:"), "system prompt must 
not list the tools again");
     }

Reply via email to