This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 1bd2e6250556 Camel TUI: add reset-stats to tui_control so the AI panel
can clear statistics without a restart
1bd2e6250556 is described below
commit 1bd2e6250556f3ea39a0be5b66cea6fff8482c5c
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Sep 8 17:34:46 2026 +0200
Camel TUI: add reset-stats to tui_control so the AI panel can clear
statistics without a restart
reset-stats only existed under tui_action, which is not in the core tool set
sent to local models, so the model restarted the integration to get the same
effect. Add reset-stats (alias clear-stats) to tui_control, matching the
camel cmd reset-stats command and the F2 menu entry, and tell the model
never
to restart, stop or kill an integration unless the user explicitly asked.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Claus Ibsen <[email protected]>
---
.../org/apache/camel/dsl/jbang/core/commands/tui/AiPanel.java | 4 +++-
.../org/apache/camel/dsl/jbang/core/commands/tui/McpFacade.java | 7 +++++++
.../camel/dsl/jbang/core/commands/tui/TuiToolRegistry.java | 9 ++++++---
3 files changed, 16 insertions(+), 4 deletions(-)
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 a11279f6aace..4e6ecec0beb4 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
@@ -1808,7 +1808,9 @@ class AiPanel {
sb.append("the MCP log only records external clients\n");
sb.append("- Be concise and actionable in your answers\n");
sb.append("- When something looks wrong, explain what it means and
suggest fixes\n");
- sb.append("- For stopping routes or applications, use tui_control for
graceful shutdown\n");
+ sb.append("- For stopping routes or applications, use tui_control for
graceful shutdown; ");
+ sb.append("tui_control reset-stats clears statistics without touching
the routes\n");
+ sb.append("- Never restart, stop or kill an integration unless the
user explicitly asked for that\n");
if (!useCoreTools()) {
sb.append("- Use tui_locate + tui_draw_shape to visually highlight
problems on screen for the user\n");
}
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/McpFacade.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/McpFacade.java
index a39bcf1666bd..db75bc20437f 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/McpFacade.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/McpFacade.java
@@ -877,6 +877,13 @@ class McpFacade {
}
String name = ctx.selectedName();
return switch (action) {
+ case "reset-stats", "clear-stats" -> {
+ if (ctx.isInfraSelected()) {
+ yield "Error: cannot reset statistics on infra service";
+ }
+ actionsPopup.executeActionByName("reset-stats");
+ yield "Statistics reset for " + name;
+ }
case "stop-routes", "pause" -> {
if (ctx.isInfraSelected()) {
yield "Error: cannot stop routes on infra service";
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TuiToolRegistry.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TuiToolRegistry.java
index 1ab25da7511f..641dc13b50f2 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TuiToolRegistry.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TuiToolRegistry.java
@@ -511,8 +511,10 @@ class TuiToolRegistry {
"Integration name. If omitted, uses the currently
selected integration.")))));
tools.add(toToolDef(toolDef(
"tui_control",
- "Controls the selected integration: stop/start routes,
restart, stop, or kill the process. "
- + "Actions: stop-routes (or pause) — suspend
all routes; "
+ "Controls the selected integration: reset statistics,
stop/start routes, restart, stop, or kill "
+ + "the process. Actions: reset-stats (or
clear-stats) — clear exchange statistics, "
+ + "activity, errors and traces without touching
the routes; "
+ + "stop-routes (or pause) — suspend all routes;
"
+ "start-routes (or resume) — resume all
routes; "
+ "restart — gracefully restart the
integration; "
+ "stop — gracefully stop the process; "
@@ -520,7 +522,8 @@ class TuiToolRegistry {
+ "stop-all — stop all running processes; "
+ "close — close a phantom (opened but not
running) project.",
Map.of("action", propDef("string",
- "Control action: stop-routes, start-routes, pause,
resume, restart, stop, kill, stop-all, or close")),
+ "Control action: reset-stats, stop-routes,
start-routes, pause, resume, restart, stop, kill, "
+ + "stop-all, or close")),
List.of("action"))));
tools.add(toToolDef(toolDef(
"tui_open_project",