feat(plugins): hot reload des plugins sans relancer IdeA — use case ReloadPlugin (invalidation registry/catalogue, resultat hashes+changed), tools MCP d'administration plugin agent-facing (mcp/plugins.rs + PluginToolProvider), evenement domaine plugin_reloaded relaye sur le wire (dto/events), exposition openai_tools rafraichie, wiring app-tauri — #271/#269 (QA verte #273: application 32, mcp_server 38, openai_tools 10, plugin_install_load 5, plugin 10, wire 1 — 96 tests ciblés; app-tauri compile sans desktop runtime)
This commit is contained in:
@ -199,6 +199,59 @@ impl From<application::PluginInstallResult> for PluginInstallResultDto {
|
||||
}
|
||||
}
|
||||
|
||||
/// Plugin reload request DTO.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ReloadPluginDto {
|
||||
/// Installed plugin id.
|
||||
pub plugin_id: String,
|
||||
/// Optional installed-hash concurrency guard.
|
||||
pub expected_content_hash: Option<String>,
|
||||
}
|
||||
|
||||
impl From<ReloadPluginDto> for application::ReloadPluginInput {
|
||||
fn from(value: ReloadPluginDto) -> Self {
|
||||
Self {
|
||||
plugin_id: value.plugin_id,
|
||||
expected_content_hash: value.expected_content_hash,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Plugin hot-reload result DTO.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PluginReloadResultDto {
|
||||
/// Reloaded plugin.
|
||||
pub plugin: PluginAdminDto,
|
||||
/// Previous content hash.
|
||||
pub old_content_hash: String,
|
||||
/// New content hash.
|
||||
pub new_content_hash: String,
|
||||
/// Whether the content changed.
|
||||
pub changed: bool,
|
||||
/// Runtime catalogue entry when active.
|
||||
pub runtime_catalog_entry: Option<application::PluginRuntimePlugin>,
|
||||
/// MCP status after reconciliation.
|
||||
pub mcp_statuses: domain::PluginMcpStatusSet,
|
||||
/// Non-fatal warnings.
|
||||
pub warnings: Vec<String>,
|
||||
}
|
||||
|
||||
impl From<application::PluginReloadResult> for PluginReloadResultDto {
|
||||
fn from(value: application::PluginReloadResult) -> Self {
|
||||
Self {
|
||||
plugin: value.plugin.into(),
|
||||
old_content_hash: value.old_content_hash,
|
||||
new_content_hash: value.new_content_hash,
|
||||
changed: value.changed,
|
||||
runtime_catalog_entry: value.runtime_catalog_entry,
|
||||
mcp_statuses: value.mcp_statuses,
|
||||
warnings: value.warnings,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Plugin uninstall result DTO.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
||||
@ -127,6 +127,18 @@ pub enum DomainEventDto {
|
||||
/// Installed version.
|
||||
version: String,
|
||||
},
|
||||
/// A plugin package was hot-reloaded.
|
||||
#[serde(rename_all = "camelCase")]
|
||||
PluginReloaded {
|
||||
/// Plugin id.
|
||||
plugin_id: String,
|
||||
/// Previous content hash.
|
||||
old_content_hash: String,
|
||||
/// New content hash.
|
||||
new_content_hash: String,
|
||||
/// Whether the content changed.
|
||||
changed: bool,
|
||||
},
|
||||
/// A plugin was enabled.
|
||||
#[serde(rename_all = "camelCase")]
|
||||
PluginEnabled {
|
||||
@ -782,6 +794,17 @@ impl From<&DomainEvent> for DomainEventDto {
|
||||
plugin_id: plugin_id.to_string(),
|
||||
version: version.as_str().to_owned(),
|
||||
},
|
||||
DomainEvent::PluginReloaded {
|
||||
plugin_id,
|
||||
old_content_hash,
|
||||
new_content_hash,
|
||||
changed,
|
||||
} => Self::PluginReloaded {
|
||||
plugin_id: plugin_id.to_string(),
|
||||
old_content_hash: old_content_hash.clone(),
|
||||
new_content_hash: new_content_hash.clone(),
|
||||
changed: *changed,
|
||||
},
|
||||
DomainEvent::PluginEnabled { plugin_id } => Self::PluginEnabled {
|
||||
plugin_id: plugin_id.to_string(),
|
||||
},
|
||||
@ -1327,6 +1350,24 @@ mod tests {
|
||||
assert_eq!(json["status"]["reused"], true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plugin_reloaded_relays_hashes_and_changed_flag_to_wire() {
|
||||
let plugin_id = domain::PluginId::new("dev.acme.gitgraph").unwrap();
|
||||
let dto = DomainEventDto::from(&DomainEvent::PluginReloaded {
|
||||
plugin_id,
|
||||
old_content_hash: "abc123".to_owned(),
|
||||
new_content_hash: "def456".to_owned(),
|
||||
changed: true,
|
||||
});
|
||||
|
||||
let json = serde_json::to_value(&dto).expect("serialisable");
|
||||
assert_eq!(json["type"], "pluginReloaded");
|
||||
assert_eq!(json["pluginId"], "dev.acme.gitgraph");
|
||||
assert_eq!(json["oldContentHash"], "abc123");
|
||||
assert_eq!(json["newContentHash"], "def456");
|
||||
assert_eq!(json["changed"], true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn model_server_status_changed_relays_downloading_to_dto_and_wire() {
|
||||
let dto = DomainEventDto::from(&DomainEvent::ModelServerStatusChanged {
|
||||
|
||||
@ -44,21 +44,22 @@ use application::{
|
||||
ReadIssue, ReadIssueAttachment, ReadIssueCarnet, ReadMcpToolPermissions, ReadMemory,
|
||||
ReadMemoryIndex, ReadProjectContext, ReadSkill, ReadTemplate, RecallMemory, ReconcileLayouts,
|
||||
ReconcileLiveState, ReconcileLiveStateInput, ReconcilePluginMcpServers, RecordTurn,
|
||||
RecordTurnProvider, ReferenceProfiles, ReleaseManagedTemp, RenameDevice, RenameLayout,
|
||||
RenameSprint, ReorderSprints, ResizeTerminal, ResolveAgentCapabilities,
|
||||
ResolveAgentPermissions, ResolveAgentSystemPermissions, ResolveManagedTemp, ResolveMemoryLinks,
|
||||
RestoreOpenWindows, RetryBackgroundTask, ReviewPluginPackage, RevokeAllDevices, RevokeDevice,
|
||||
RotateConversationLog, SaveChatDraft, SaveEmbedderProfile, SaveModelServer,
|
||||
SaveOpenCodeProviderProfile, SaveProfile, SessionLimitService, SetActiveLayout,
|
||||
SetPluginEnabled, SlashCommandRegistry, SnapshotOpenWindows, SnapshotRunningAgents,
|
||||
SpawnBackgroundCommand, StopLiveAgent, StructuredRoutingMode, StructuredSessions,
|
||||
SuggestedThisSession, SyncAgentWithTemplate, TerminalSessions, TouchDevice,
|
||||
UnassignSkillFromAgent, UnassignTicketFromSprint, UninstallPlugin, UnlinkIssues,
|
||||
UpdateAgentContactable, UpdateAgentContext, UpdateAgentEffort, UpdateAgentMcpToolPermissions,
|
||||
UpdateAgentPermissions, UpdateAgentSystemPermissions, UpdateIssue, UpdateIssueCarnet,
|
||||
UpdateLiveState, UpdateMemory, UpdateProjectContext, UpdateProjectMcpToolPermissions,
|
||||
UpdateProjectPermissions, UpdateProjectSystemPermissions, UpdateSkill, UpdateTemplate,
|
||||
WakeSessionProvider, WriteMemory, WriteToTerminal, AGENT_MEMORY_RECALL_BUDGET,
|
||||
RecordTurnProvider, ReferenceProfiles, ReleaseManagedTemp, ReloadPlugin, ReloadPluginInput,
|
||||
RenameDevice, RenameLayout, RenameSprint, ReorderSprints, ResizeTerminal,
|
||||
ResolveAgentCapabilities, ResolveAgentPermissions, ResolveAgentSystemPermissions,
|
||||
ResolveManagedTemp, ResolveMemoryLinks, RestoreOpenWindows, RetryBackgroundTask,
|
||||
ReviewPluginPackage, RevokeAllDevices, RevokeDevice, RotateConversationLog, SaveChatDraft,
|
||||
SaveEmbedderProfile, SaveModelServer, SaveOpenCodeProviderProfile, SaveProfile,
|
||||
SessionLimitService, SetActiveLayout, SetPluginEnabled, SlashCommandRegistry,
|
||||
SnapshotOpenWindows, SnapshotRunningAgents, SpawnBackgroundCommand, StopLiveAgent,
|
||||
StructuredRoutingMode, StructuredSessions, SuggestedThisSession, SyncAgentWithTemplate,
|
||||
TerminalSessions, TouchDevice, UnassignSkillFromAgent, UnassignTicketFromSprint,
|
||||
UninstallPlugin, UnlinkIssues, UpdateAgentContactable, UpdateAgentContext, UpdateAgentEffort,
|
||||
UpdateAgentMcpToolPermissions, UpdateAgentPermissions, UpdateAgentSystemPermissions,
|
||||
UpdateIssue, UpdateIssueCarnet, UpdateLiveState, UpdateMemory, UpdateProjectContext,
|
||||
UpdateProjectMcpToolPermissions, UpdateProjectPermissions, UpdateProjectSystemPermissions,
|
||||
UpdateSkill, UpdateTemplate, WakeSessionProvider, WriteMemory, WriteToTerminal,
|
||||
AGENT_MEMORY_RECALL_BUDGET,
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
use domain::ports::{
|
||||
@ -124,6 +125,7 @@ pub use infrastructure::{acquire_app_data_dir_lock, AppDataDirLock, AppDataDirLo
|
||||
use crate::mcp_endpoint::{mcp_endpoint, AppMcpRuntimeProvider, McpEndpoint};
|
||||
use crate::openai_tools::{AppOpenAiToolInvoker, LateBoundOpenAiToolInvoker};
|
||||
|
||||
use infrastructure::orchestrator::mcp::{PluginToolError, PluginToolProvider};
|
||||
use infrastructure::StdioTransport;
|
||||
|
||||
use interprocess::local_socket::tokio::Listener as LocalSocketListener;
|
||||
@ -143,6 +145,51 @@ fn spawn_detached(future: impl std::future::Future<Output = ()> + Send + 'static
|
||||
});
|
||||
}
|
||||
|
||||
struct AppPluginToolProvider {
|
||||
reload: Arc<ReloadPlugin>,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||
struct PluginReloadToolArgs {
|
||||
plugin_id: String,
|
||||
expected_content_hash: Option<String>,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl PluginToolProvider for AppPluginToolProvider {
|
||||
async fn handle_plugin_tool(
|
||||
&self,
|
||||
_project: &Project,
|
||||
_requester: &str,
|
||||
name: &str,
|
||||
arguments: Value,
|
||||
) -> Result<Value, PluginToolError> {
|
||||
if name != "idea_plugin_reload" {
|
||||
return Err(PluginToolError::new(
|
||||
"NOT_FOUND",
|
||||
format!("unknown plugin tool: {name}"),
|
||||
));
|
||||
}
|
||||
let args: PluginReloadToolArgs = serde_json::from_value(arguments)
|
||||
.map_err(|err| PluginToolError::new("INVALID", format!("invalid arguments: {err}")))?;
|
||||
let result = self
|
||||
.reload
|
||||
.execute(ReloadPluginInput {
|
||||
plugin_id: args.plugin_id,
|
||||
expected_content_hash: args.expected_content_hash,
|
||||
})
|
||||
.await
|
||||
.map_err(|err| PluginToolError::new(err.code(), err.to_string()))?;
|
||||
serde_json::to_value(result).map_err(|err| {
|
||||
PluginToolError::new(
|
||||
"INTERNAL",
|
||||
format!("failed to serialize plugin reload result: {err}"),
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod backend_core_build_tests {
|
||||
use super::BackendCore;
|
||||
@ -1224,6 +1271,8 @@ pub struct BackendCore {
|
||||
pub(crate) template_tool_provider: Arc<dyn TemplateToolProvider>,
|
||||
/// MCP provider for the public `idea_managed_temp_*` tools.
|
||||
pub(crate) managed_temp_tool_provider: Arc<dyn ManagedTempToolProvider>,
|
||||
/// MCP provider for public plugin administration tools.
|
||||
pub(crate) plugin_tool_provider: Arc<dyn PluginToolProvider>,
|
||||
/// Open an ephemeral AI assistant chat bound to one ticket.
|
||||
pub open_ticket_assistant: Arc<OpenTicketAssistant>,
|
||||
/// Close an ephemeral AI assistant chat bound to one ticket.
|
||||
@ -1324,6 +1373,8 @@ pub struct BackendCore {
|
||||
pub install_plugin_from_archive: Arc<InstallPluginFromArchive>,
|
||||
/// Install a plugin directory snapshot.
|
||||
pub install_plugin_from_directory: Arc<InstallPluginFromDirectory>,
|
||||
/// Hot-reload an installed plugin from its recorded directory source.
|
||||
pub reload_plugin: Arc<ReloadPlugin>,
|
||||
/// List installed plugins for admin UI.
|
||||
pub list_plugins: Arc<ListPlugins>,
|
||||
/// Enable or disable a plugin.
|
||||
@ -2704,6 +2755,16 @@ impl BackendCore {
|
||||
Arc::clone(&events_port),
|
||||
Arc::clone(&plugin_mcp_supervisor_port),
|
||||
));
|
||||
let reload_plugin = Arc::new(ReloadPlugin::new(
|
||||
Arc::clone(&plugin_package_store),
|
||||
Arc::clone(&plugin_registry_store),
|
||||
Arc::clone(&plugin_manifest_validator),
|
||||
Arc::clone(&events_port),
|
||||
Arc::clone(&plugin_mcp_supervisor_port),
|
||||
));
|
||||
let plugin_tool_provider: Arc<dyn PluginToolProvider> = Arc::new(AppPluginToolProvider {
|
||||
reload: Arc::clone(&reload_plugin),
|
||||
});
|
||||
let set_plugin_enabled = Arc::new(SetPluginEnabled::new(
|
||||
Arc::clone(&plugin_package_store),
|
||||
Arc::clone(&plugin_registry_store),
|
||||
@ -3147,6 +3208,7 @@ impl BackendCore {
|
||||
Arc::clone(&ticket_tool_provider),
|
||||
Arc::clone(&template_tool_provider),
|
||||
Arc::clone(&managed_temp_tool_provider),
|
||||
Arc::clone(&plugin_tool_provider),
|
||||
)) as Arc<dyn ToolInvoker>);
|
||||
|
||||
let stop_live_agent = Arc::new(
|
||||
@ -3364,6 +3426,7 @@ impl BackendCore {
|
||||
review_plugin_package,
|
||||
install_plugin_from_archive,
|
||||
install_plugin_from_directory,
|
||||
reload_plugin,
|
||||
list_plugins,
|
||||
set_plugin_enabled,
|
||||
uninstall_plugin,
|
||||
@ -3382,6 +3445,7 @@ impl BackendCore {
|
||||
ticket_tool_binder,
|
||||
template_tool_binder,
|
||||
managed_temp_tool_binder,
|
||||
plugin_tool_provider,
|
||||
}
|
||||
}
|
||||
|
||||
@ -3474,6 +3538,7 @@ impl BackendCore {
|
||||
.with_ticket_tools(Arc::clone(&self.ticket_tool_provider))
|
||||
.with_template_tools(Arc::clone(&self.template_tool_provider))
|
||||
.with_managed_temp_tools(Arc::clone(&self.managed_temp_tool_provider))
|
||||
.with_plugin_tools(Arc::clone(&self.plugin_tool_provider))
|
||||
.with_tool_policies(Arc::clone(&self.tool_policy_registry))
|
||||
.with_mcp_tool_permissions(Arc::clone(&self.mcp_tool_permission_store)),
|
||||
endpoint,
|
||||
|
||||
@ -14,6 +14,7 @@ use domain::ports::{
|
||||
ToolSpec,
|
||||
};
|
||||
use domain::{AgentToolPolicy, IssueRef, McpToolPolicy, Project};
|
||||
use infrastructure::orchestrator::mcp::PluginToolProvider;
|
||||
use infrastructure::{ManagedTempToolProvider, TemplateToolProvider, TicketToolProvider};
|
||||
use serde_json::Value;
|
||||
|
||||
@ -29,6 +30,7 @@ pub struct AppOpenAiToolInvoker {
|
||||
ticket_tools: Arc<dyn TicketToolProvider>,
|
||||
template_tools: Arc<dyn TemplateToolProvider>,
|
||||
managed_temp_tools: Arc<dyn ManagedTempToolProvider>,
|
||||
plugin_tools: Arc<dyn PluginToolProvider>,
|
||||
}
|
||||
|
||||
/// Proxy injecté avant que l'orchestrateur soit construit, puis lié dans la
|
||||
@ -103,6 +105,7 @@ impl AppOpenAiToolInvoker {
|
||||
ticket_tools: Arc<dyn TicketToolProvider>,
|
||||
template_tools: Arc<dyn TemplateToolProvider>,
|
||||
managed_temp_tools: Arc<dyn ManagedTempToolProvider>,
|
||||
plugin_tools: Arc<dyn PluginToolProvider>,
|
||||
) -> Self {
|
||||
Self {
|
||||
orchestrator,
|
||||
@ -112,6 +115,7 @@ impl AppOpenAiToolInvoker {
|
||||
ticket_tools,
|
||||
template_tools,
|
||||
managed_temp_tools,
|
||||
plugin_tools,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -232,6 +236,19 @@ impl ToolInvoker for AppOpenAiToolInvoker {
|
||||
ToolInvocationError::Execution(format!("JSON managed temp tool: {e}"))
|
||||
});
|
||||
}
|
||||
if infrastructure::orchestrator::mcp::tools::is_plugin_tool(name) {
|
||||
let value = self
|
||||
.plugin_tools
|
||||
.handle_plugin_tool(&project, &requester, name, value)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
let detail =
|
||||
serde_json::to_string(&e.to_value()).unwrap_or_else(|_| e.to_string());
|
||||
ToolInvocationError::Execution(detail)
|
||||
})?;
|
||||
return serde_json::to_string(&value)
|
||||
.map_err(|e| ToolInvocationError::Execution(format!("JSON plugin tool: {e}")));
|
||||
}
|
||||
let command = infrastructure::orchestrator::mcp::map_tool_call(name, &value, &requester)
|
||||
.map_err(|e| match e {
|
||||
infrastructure::orchestrator::mcp::ToolMapError::UnknownTool(tool) => {
|
||||
@ -424,6 +441,7 @@ mod tests {
|
||||
AgentId, AgentMcpToolPolicyOverride, McpToolPolicy, Project, ProjectId,
|
||||
ProjectMcpToolPermissions, ProjectPath, RemoteRef, StoreError, Workspace,
|
||||
};
|
||||
use infrastructure::orchestrator::mcp::PluginToolError;
|
||||
use infrastructure::{ManagedTempToolError, TemplateToolError, TicketToolError};
|
||||
use serde_json::json;
|
||||
use uuid::Uuid;
|
||||
@ -606,6 +624,36 @@ mod tests {
|
||||
Arc::new(FakeManagedTempTools::default())
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct FakePluginTools {
|
||||
calls: Mutex<Vec<(String, String, Value)>>,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl PluginToolProvider for FakePluginTools {
|
||||
async fn handle_plugin_tool(
|
||||
&self,
|
||||
_project: &Project,
|
||||
requester: &str,
|
||||
name: &str,
|
||||
arguments: Value,
|
||||
) -> Result<Value, PluginToolError> {
|
||||
self.calls.lock().unwrap().push((
|
||||
requester.to_owned(),
|
||||
name.to_owned(),
|
||||
arguments.clone(),
|
||||
));
|
||||
Ok(json!({
|
||||
"pluginId": arguments.get("pluginId").and_then(Value::as_str).unwrap_or_default(),
|
||||
"changed": true,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
fn fake_plugin_tools() -> Arc<FakePluginTools> {
|
||||
Arc::new(FakePluginTools::default())
|
||||
}
|
||||
|
||||
fn issue_ref(raw: &str) -> IssueRef {
|
||||
IssueRef::from_str(raw).unwrap()
|
||||
}
|
||||
@ -772,6 +820,7 @@ mod tests {
|
||||
ticket_tools.clone(),
|
||||
template_tools,
|
||||
fake_managed_temp_tools(),
|
||||
fake_plugin_tools(),
|
||||
);
|
||||
|
||||
let denied = invoker
|
||||
@ -838,6 +887,7 @@ mod tests {
|
||||
ticket_tools.clone(),
|
||||
template_tools.clone(),
|
||||
fake_managed_temp_tools(),
|
||||
fake_plugin_tools(),
|
||||
);
|
||||
|
||||
for tool in ["idea_ticket_list", "idea_template_list"] {
|
||||
@ -928,6 +978,7 @@ mod tests {
|
||||
Arc::new(FakeTicketTools::default()),
|
||||
Arc::new(FakeTemplateTools::default()),
|
||||
fake_managed_temp_tools(),
|
||||
fake_plugin_tools(),
|
||||
);
|
||||
|
||||
let tools = invoker
|
||||
@ -968,6 +1019,7 @@ mod tests {
|
||||
Arc::new(FakeTicketTools::default()),
|
||||
Arc::new(FakeTemplateTools::default()),
|
||||
fake_managed_temp_tools(),
|
||||
fake_plugin_tools(),
|
||||
);
|
||||
|
||||
let tools = invoker
|
||||
@ -1001,6 +1053,7 @@ mod tests {
|
||||
ticket_tools.clone(),
|
||||
template_tools,
|
||||
fake_managed_temp_tools(),
|
||||
fake_plugin_tools(),
|
||||
);
|
||||
|
||||
let result = invoker
|
||||
@ -1048,6 +1101,7 @@ mod tests {
|
||||
ticket_tools,
|
||||
template_tools.clone(),
|
||||
fake_managed_temp_tools(),
|
||||
fake_plugin_tools(),
|
||||
);
|
||||
|
||||
let result = invoker
|
||||
@ -1095,4 +1149,51 @@ mod tests {
|
||||
|
||||
let _ = std::fs::remove_dir_all(temp);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn openai_explicit_plugin_reload_permission_routes_to_plugin_provider() {
|
||||
let temp = std::env::temp_dir().join(format!(
|
||||
"idea-openai-plugin-reload-permissions-{}",
|
||||
Uuid::new_v4()
|
||||
));
|
||||
let core = crate::BackendCore::build(temp.clone());
|
||||
let agent = AgentId::from_uuid(Uuid::from_u128(271));
|
||||
let requester = agent.to_string();
|
||||
let plugin_tools = fake_plugin_tools();
|
||||
let invoker = AppOpenAiToolInvoker::new(
|
||||
Arc::clone(&core.orchestrator_service),
|
||||
Arc::new(FakeProjects::with(project())) as Arc<dyn ProjectStore>,
|
||||
Arc::new(FakePolicies::default()),
|
||||
mcp_permissions(allow_doc(agent, &["idea_plugin_reload"])),
|
||||
Arc::new(FakeTicketTools::default()),
|
||||
Arc::new(FakeTemplateTools::default()),
|
||||
fake_managed_temp_tools(),
|
||||
plugin_tools.clone(),
|
||||
);
|
||||
|
||||
let result = invoker
|
||||
.call(
|
||||
"idea_plugin_reload",
|
||||
&json!({
|
||||
PROJECT_ROOT_ARG: "/tmp/project",
|
||||
REQUESTER_ARG: requester,
|
||||
"pluginId": "dev.acme.gitgraph",
|
||||
"expectedContentHash": "abc123",
|
||||
})
|
||||
.to_string(),
|
||||
)
|
||||
.await
|
||||
.expect("explicit durable override should reach plugin provider");
|
||||
let result: Value = serde_json::from_str(&result).unwrap();
|
||||
assert_eq!(result["pluginId"], "dev.acme.gitgraph");
|
||||
assert_eq!(result["changed"], true);
|
||||
|
||||
let calls = plugin_tools.calls.lock().unwrap();
|
||||
assert_eq!(calls.len(), 1);
|
||||
assert_eq!(calls[0].0, requester);
|
||||
assert_eq!(calls[0].1, "idea_plugin_reload");
|
||||
assert_eq!(calls[0].2["expectedContentHash"], "abc123");
|
||||
|
||||
let _ = std::fs::remove_dir_all(temp);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user