zhaohai666 opened a new pull request, #934:
URL: https://github.com/apache/rocketmq-dashboard/pull/934

   # RIP-3: Implement missing topic/route/dlq/progress tools and topic LLM 
context
   
   ## Summary
   
   This PR implements the **unimplemented RIP-3 (AI-native integration) 
capabilities** as complete
   backend (MCP Server + `rmqctl` CLI) and frontend features, packaged as a 
single pull request.
   
   RIP-3 requires the `rmq.*` tool surface to cover the full **BASE-01** 
capability list. The existing
   `feature/rip-1-control-plane-5.0` scaffold already provided the MCP server, 
the CLI, and the
   in-console LLM bridge, but several BASE-01 resources were either missing or 
registered-but-dangling.
   This PR closes those gaps end-to-end.
   
   ## Motivation
   
   During RIP-3 acceptance review we found the following concrete holes against 
the BASE-01 checklist:
   
   - **No route capability** (BASE-01 **E**) — `rmq.route.*` did not exist, so 
users could not inspect
     per-broker queue layout / broker addresses for a topic.
   - **No dead-letter capability** (BASE-01 **DLQ**) — `rmq.dlq.*` did not 
exist.
   - **No read-only consumption progress** (BASE-01 **G**, L1) — `group` only 
exposed `reset-offset`
     (a write operation); there was no way to *read* per-queue consumer 
progress / lag.
   - **No topic-type enumeration** (BASE-01 **F**) — the 5.0 topic message 
types were only a parameter
     inside `topic create`, with no discoverable enumeration tool.
   - **Dangling `rmq.namespace.*` tools** — these were registered but the live 
cluster admin API
     (`MQAdminExt`) has no namespace operations, so they threw 
`UnsupportedOperationException` at
     runtime. This is misleading in a capability advertisement.
   - **AI-01.1 signal 5 missing** — the Topic detail page had no "Ask LLM" 
entry point that
     auto-injects the current topic/cluster context into the console LLM.
   
   ## Changes
   
   ### Backend — `rocketmq-dashboard-cli` (single source of truth → 
auto-generated MCP + CLI)
   
   All tools below are declared once in `ToolRegistry` and are 
**automatically** exposed as both MCP
   tools (`rmq.<resource>.<action>`) and `rmqctl` sub-commands, because the 
CLI/MCP layer shares one
   `ToolRegistry` schema (RIP-3 signal 7: CLI help and MCP descriptions come 
from one source).
   
   | Tool | Backend API | BASE-01 | Risk |
   |------|-------------|---------|------|
   | `rmq.route.list` | `MQAdminExt.examineTopicRouteInfo` → queue distribution 
per broker | **E** | L1 |
   | `rmq.route.describe` | `examineTopicRouteInfo` → broker name/address 
detail | **E** | L1 |
   | `rmq.dlq.list` | inspect `%DLQ%<group>` dead-letter topic | **DLQ** | L1 |
   | `rmq.dlq.resend` | `queryMessage` + `consumeMessageDirectly` to replay a 
DLQ message | **DLQ** | L2 |
   | `rmq.group.progress` | `MQAdminExt.examineConsumeStats` → per-queue 
broker/consumer offset, lag, total lag | **G** / L1 | L1 |
   | `rmq.topic.types` | static enumeration of 5.0 message types 
(NORMAL/FIFO/DELAY/TRANSACTION/LITE) — short-circuits before connecting to a 
cluster | **F** | L1 |
   
   - **Removed the dangling `rmq.namespace.*` registration.** The live cluster 
admin API has no
     namespace operations, so advertising them as capabilities was incorrect. 
The `ToolExecutor`
     guard is retained as a safety net (still returns a clear error if invoked 
directly), and
     `ExplainCommand`'s resource list was updated to drop `namespace` and add 
`route`/`dlq`.
   
   ### Frontend — `frontend-new`
   
   - Added an **"Ask LLM"** action button on the Topic detail page
     (`CapabilityTopicPage.jsx`). Clicking it opens the AI sidebar 
(`useLlm.setIsPanelOpen`) and
     auto-injects the current **topic + cluster** context into a prompt, so the 
assistant can analyse
     the topic via the newly added MCP tools (route / progress / dlq / 
describe) without the user
     re-typing identifiers. This satisfies **AI-01.1 signal 5**.
   - The button is `disabled` when no LLM provider is configured 
(`isDegraded`), which keeps the
     existing "degrade to global search" behaviour intact (AI-01.1 signal 1).
   
   ## Files changed
   
   ```
   
rocketmq-dashboard-cli/src/main/java/org/apache/rocketmq/dashboard/cli/schema/ToolRegistry.java
   
rocketmq-dashboard-cli/src/main/java/org/apache/rocketmq/dashboard/cli/executor/ToolExecutor.java
   
rocketmq-dashboard-cli/src/main/java/org/apache/rocketmq/dashboard/cli/ExplainCommand.java
   frontend-new/src/pages/Topic/CapabilityTopicPage.jsx
   ```
   
   ## Verification
   
   - `mvn -pl rocketmq-dashboard-cli -am compile` → **BUILD SUCCESS** (JDK 21).
   - Unit tests `ToolRegistryTest` + `ToolExecutorTest` → **66 tests pass**.
   - `ToolRegistryTest.testAllToolsHaveClusterParam` still holds: 
`rmq.topic.types` keeps a required
     `cluster` param for contract consistency even though it short-circuits 
before connecting.
   
   ## Notes / follow-ups
   
   - This branch is cut from `feature/rip-1-control-plane-5.0`, which is the 
only baseline that
     contains the RIP-3 scaffold (MCP server, CLI, LLM bridge). A future 
cleanup could rebase the
     RIP-3-only deltas onto the competition baseline to keep the PR diff 
minimal.
   - Remaining out-of-scope items (not addressed here, tracked separately): 
cluster-name
     pre-validation (reject an unreachable cluster before API call), 
`riskLevel` field in
     `LlmAuditLogger`, and rate-limiting / tenant isolation on the backend LLM 
proxy.
   


-- 
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]

Reply via email to