refactor(agent): rename run_plugin_command to run_slash_command to avoid confusion with execute_command (shell)

This commit is contained in:
jxxghp
2026-04-06 23:53:49 +08:00
parent 7806267e92
commit a8fb4a6d84
5 changed files with 16 additions and 16 deletions

View File

@@ -50,7 +50,7 @@ from app.agent.tools.impl.read_file import ReadFileTool
from app.agent.tools.impl.browse_webpage import BrowseWebpageTool
from app.agent.tools.impl.query_installed_plugins import QueryInstalledPluginsTool
from app.agent.tools.impl.query_plugin_capabilities import QueryPluginCapabilitiesTool
from app.agent.tools.impl.run_plugin_command import RunPluginCommandTool
from app.agent.tools.impl.run_slash_command import RunSlashCommandTool
from app.agent.tools.impl.list_all_commands import ListAllCommandsTool
from app.core.plugin import PluginManager
from app.log import logger
@@ -126,7 +126,7 @@ class MoviePilotToolFactory:
BrowseWebpageTool,
QueryInstalledPluginsTool,
QueryPluginCapabilitiesTool,
RunPluginCommandTool,
RunSlashCommandTool,
ListAllCommandsTool,
]
# 创建内置工具

View File

@@ -25,7 +25,7 @@ class ListAllCommandsTool(MoviePilotTool):
"List all available commands in the system, including system preset commands "
"(e.g. /cookiecloud, /sites, /subscribes, /downloading, /transfer, /restart, etc.) "
"and plugin-registered commands. "
"Use this tool to discover what commands are available before executing them with run_plugin_command. "
"Use this tool to discover what commands are available before executing them with run_slash_command. "
"This is especially useful when the user describes an action in natural language and you need to "
"find the matching command to fulfill their request."
)

View File

@@ -29,7 +29,7 @@ class QueryPluginCapabilitiesTool(MoviePilotTool):
name: str = "query_plugin_capabilities"
description: str = (
"Query the capabilities of installed plugins, including supported commands and scheduled services. "
"Commands are slash-commands (e.g. /xxx) that can be executed via the run_plugin_command tool. "
"Commands are slash-commands (e.g. /xxx) that can be executed via the run_slash_command tool. "
"Scheduled services are periodic tasks that can be triggered via the run_scheduler tool. "
"Optionally specify a plugin_id to query a specific plugin, or omit to query all running plugins."
)

View File

@@ -1,4 +1,4 @@
"""运行插件/系统命令工具"""
"""运行斜杠命令工具(系统命令 + 插件命令)"""
import json
from typing import Optional, Type
@@ -12,8 +12,8 @@ from app.log import logger
from app.schemas.types import EventType, MessageChannel
class RunPluginCommandInput(BaseModel):
"""运行插件/系统命令工具的输入参数模型"""
class RunSlashCommandInput(BaseModel):
"""运行斜杠命令工具的输入参数模型"""
explanation: str = Field(
...,
@@ -28,11 +28,11 @@ class RunPluginCommandInput(BaseModel):
)
class RunPluginCommandTool(MoviePilotTool):
name: str = "run_plugin_command"
class RunSlashCommandTool(MoviePilotTool):
name: str = "run_slash_command"
description: str = (
"Execute a system or plugin command by sending a CommandExcute event. "
"This tool supports ALL registered commands, including: "
"Execute a slash command (system or plugin) by sending a CommandExcute event. "
"This tool supports ALL registered slash commands, including: "
"1) System preset commands (e.g. /cookiecloud, /sites, /subscribes, /downloading, /transfer, /restart, etc.) "
"2) Plugin commands registered by installed plugins. "
"Use the query_plugin_capabilities tool to discover plugin commands, "
@@ -40,7 +40,7 @@ class RunPluginCommandTool(MoviePilotTool):
"The command will be executed asynchronously. "
"Note: This tool triggers the command execution but the actual processing happens in the background."
)
args_schema: Type[BaseModel] = RunPluginCommandInput
args_schema: Type[BaseModel] = RunSlashCommandInput
require_admin: bool = True
def get_tool_message(self, **kwargs) -> Optional[str]:

View File

@@ -7,7 +7,7 @@ description: >-
(e.g. "sync sites", "show subscriptions", "refresh subscriptions", "check downloads", etc.).
This skill helps you identify the user's intent, find the matching command, extract necessary parameters,
and execute the corresponding command.
allowed-tools: list_all_commands query_plugin_capabilities run_plugin_command
allowed-tools: list_all_commands query_plugin_capabilities run_slash_command
---
# Command Execute
@@ -31,7 +31,7 @@ Use this skill to identify user intent and invoke the corresponding system or pl
- `list_all_commands` — List all available commands (system + plugin), returns command name, description, and category
- `query_plugin_capabilities` — Query detailed plugin capabilities (commands, actions, scheduled services)
- `run_plugin_command` — Execute a specified command (works for both system and plugin commands)
- `run_slash_command` — Execute a specified command (works for both system and plugin commands)
## Workflow
@@ -59,7 +59,7 @@ Some commands support additional arguments (space-separated after the command),
- `/redo <history_id>` — Manually re-organize a specific record
- `/subscribe_delete <name>` — Delete a specific subscription
Use `run_plugin_command` to execute the command in the format `/command_name arg1 arg2`.
Use `run_slash_command` to execute the command in the format `/command_name arg1 arg2`.
### Step 4: Report Result
@@ -68,6 +68,6 @@ Command execution is asynchronous. After triggering, inform the user that the co
## Important Notes
- Command execution requires admin privileges; the tool will automatically check permissions
- Both system and plugin commands are executed via the `run_plugin_command` tool — no need to distinguish between them
- Both system and plugin commands are executed via the `run_slash_command` tool — no need to distinguish between them
- If you are unsure which command matches the user's intent, use `list_all_commands` first to look up before deciding
- Never guess non-existent commands; always select from the available command list