feat(plugin): ModuleEvent::PluginFileDialog for native file import

Add-ons had no way to request a file picker — only the host's own Open
dialog. PluginFileDialog lets a plugin tool ask the host to open a native
picker; on selection the host dispatches "<command> <path>" back to the
plugin with original case preserved (bypassing the command-line
upper-casing that mangles case-sensitive paths on Linux/macOS). The demo
plugin gains an Import tool exercising it.

Part of the #100 extensibility epic (surfaced in #106).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-17 10:22:08 +03:00
1 parent 844069b4ef
commit 50825b6346
8 files changed
+107 -7

No files matched your search

+6
View File
@@ -1,6 +1,12 @@
use crate::plugin::host::HostSession;
pub fn handle(host: &mut HostSession<'_>, cmd: &str) -> bool {
// "DP_IMPORT <path>" arrives from ModuleEvent::PluginFileDialog with the
// path in its original case (the command line is bypassed).
if let Some(path) = cmd.strip_prefix("DP_IMPORT ") {
host.push_info(&format!("demo_plugin imported: {path}"));
return true;
}
match cmd {
"DP_HELLO" => {
host.push_info("Hello from demo_plugin (plugin host OK).");