Файли
openidea/src-tauri/tests/blocking_commands.rs
T
Deng Liuтаdengliu 35a6bec1c2 feat(agents): implement unified Agent Plugins Hub across harnesses (#6877)
Adds a Plugins page under Settings > Agents for the plugin bundles each agent harness installs natively (Claude Code, GitHub Copilot, Codex, Gemini CLI).

- Rows are grouped by harness and scope with counts and paths. Toggles change only the harness's own enablement record, and row ids are stable and owner-qualified, so a toggle never reaches another project's row.
- Enabled plugins project their skills, MCP servers and memory files into Skills, MCP Connections and Memory; a workspace override decides what a globally enabled plugin projects in that workspace.
- Marketplaces can be browsed, previewed and installed from, with pinned git installs. Installs are written into each harness's native store without following symlinks, including at the store root.
- Plugins that run local MCP processes or lifecycle hooks need capability consent. Previews and installed folders resolve capabilities the same way, and consent is tied to the capability hash the user was shown: an install or enable whose capabilities differ is refused.

Closes #6872

Co-authored-by: dengliu <[email protected]>
2026-12-02 09:32:33 +08:00

75 рядки
2.4 KiB
Rust

//! Tauri runs a sync command on the main thread, so disk I/O or a large diff there freezes the
//! window (input, painting, every other IPC call).
use ide_host::catalogue::Mode;
/// Commands that read or write project files, Local History or `.env` files, diff two
/// arbitrary texts, scan the project index or tree, read agent registries and transcripts, or
/// call the OS keychain: they must do that work off the main thread. Commands that parse and
/// validate another project's settings recurse deeply enough to overflow the main thread's stack
/// in a debug build on Windows.
const OFF_MAIN_THREAD: &[&str] = &[
"project_workspace_members",
"project_workspace_member_set",
"history_list",
"history_content",
"find_files",
"find_dirs",
"find_symbols",
"vcs_diff_hunks",
"vcs_shelves",
"vcs_shelf_delete",
"vcs_shelf_rename",
"vcs_shelf_patch",
"vcs_changelists_load",
"run_save_configs",
"run_templates",
"run_save_templates",
"run_import_sources",
"run_import_configs",
"run_env_files",
"agent_entries",
"agent_providers",
"agent_memory_list",
"agent_memory_create",
"agent_memory_promote",
"agent_memory_delete",
"agent_memory_reset_provider",
"agent_plugins_list",
"agent_plugins_set_enabled",
"agent_plugins_add_marketplace",
"agent_plugins_remove_marketplace",
"agent_plugins_browse_marketplace",
"agent_plugins_preview",
"agent_plugins_install",
"agent_automation_snapshot",
"agent_automation_save",
"agent_automation_set_enabled",
"agent_automation_pause_all",
"agent_automation_delete",
"agent_automation_run_now",
"agent_automation_runs",
"agent_automation_mark_read",
"agent_automation_export_markdown",
"agent_automation_import_markdown",
"plugin_post_events",
"plugin_secrets",
"plugin_set_active_file",
"plugin_set_secret",
"spring_route_sources",
"python_route_sources",
];
#[test]
fn disk_and_diff_commands_stay_off_the_main_thread() {
let declarations = openidea_lib::declarations();
let on_main: Vec<_> = OFF_MAIN_THREAD
.iter()
.filter(|name| {
let declared = declarations.iter().find(|c| c.name == **name);
declared.unwrap_or_else(|| panic!("no command {name}")).mode == Mode::Sync
})
.collect();
assert!(on_main.is_empty(), "synchronous commands run on the main thread: {on_main:?}");
}