feat(plugins): tool MCP agent-facing idea_plugin_install_from_directory + reload couvrant le refresh UI — backend #279 (use case InstallPluginFromDirectory avec expectedPluginId, confinement répertoire sous project root: rejet absolu hors root/fichier/symlink escaping, soft refresh + événements plugin_installed/plugin_reloaded relayés, wiring app-tauri; QA verte ré-exécutée: application 2/2 directory_install, infrastructure mcp_server 39/39 dont routing plugin_install/plugin_reload, plugin_install_load 5/5)

This commit is contained in:
2026-09-08 13:08:48 +02:00
parent 391bff82ee
commit 979965aef3
6 changed files with 333 additions and 22 deletions

View File

@ -49,23 +49,41 @@ pub trait PluginToolProvider: Send + Sync {
/// Returns true when `name` is a public plugin tool.
#[must_use]
pub fn is_plugin_tool(name: &str) -> bool {
name == "idea_plugin_reload"
matches!(
name,
"idea_plugin_install_from_directory" | "idea_plugin_reload"
)
}
/// Public plugin tool definitions advertised by `tools/list`.
#[must_use]
pub fn catalogue() -> Vec<ToolDef> {
vec![ToolDef {
name: "idea_plugin_reload",
description: "Hot-reload an installed directory plugin from its recorded source.",
input_schema: json!({
"type": "object",
"properties": {
"pluginId": { "type": "string" },
"expectedContentHash": { "type": "string" }
},
"required": ["pluginId"],
"additionalProperties": false
}),
}]
vec![
ToolDef {
name: "idea_plugin_install_from_directory",
description: "Install a plugin from a directory confined to the requester project root; the emitted event lets the UI refresh plugin contributions without restarting IdeA.",
input_schema: json!({
"type": "object",
"properties": {
"path": { "type": "string" },
"expectedPluginId": { "type": "string" }
},
"required": ["path"],
"additionalProperties": false
}),
},
ToolDef {
name: "idea_plugin_reload",
description: "Hot-reload an installed directory plugin from its recorded source; the emitted event lets the UI refresh plugin contributions.",
input_schema: json!({
"type": "object",
"properties": {
"pluginId": { "type": "string" },
"expectedContentHash": { "type": "string" }
},
"required": ["pluginId"],
"additionalProperties": false
}),
},
]
}

View File

@ -96,6 +96,7 @@ pub const WRITE_ACTION_TOOLS: &[&str] = &[
"idea_managed_temp_allocate",
"idea_managed_temp_release",
"idea_managed_temp_gc",
"idea_plugin_install_from_directory",
"idea_plugin_reload",
];