feat: Implement nyash.toml v2 plugin system with PluginLoaderV2

- Add plugin_loader_v2.rs with nyash.toml v2 support
- Create PluginBoxV2 as temporary wrapper for v2 plugins
- Update runner.rs to use v2 loader instead of legacy BID registry
- Update box_registry.rs to work with v2 plugin system
- Support single FFI entry point (nyash_plugin_invoke) + optional init
- Integrate with existing BoxFactoryRegistry for seamless Box creation
- All compilation errors resolved, ready for testing
This commit is contained in:
Moe Charm
2025-08-19 05:16:40 +09:00
parent 806aece8ad
commit 52c8ce1f7b
4 changed files with 278 additions and 16 deletions

View File

@ -75,11 +75,17 @@ impl BoxFactoryRegistry {
}
}
/// プラグインBoxを生成v2への移行中の一時的スタブ
/// プラグインBoxを生成v2実装
fn create_plugin_box(&self, plugin_name: &str, box_name: &str, args: &[Box<dyn NyashBox>]) -> Result<Box<dyn NyashBox>, String> {
// TODO: v2プラグインシステムへの実装
// 現在は一時的にエラーを返す
Err(format!("Plugin system v2 migration in progress. Cannot create {} from plugin {}", box_name, plugin_name))
use crate::runtime::get_global_loader_v2;
// v2ローダーを取得
let loader = get_global_loader_v2();
let loader = loader.read().unwrap();
// プラグインからBoxを生成
loader.create_box(box_name, args)
.map_err(|e| format!("Failed to create {} from plugin {}: {:?}", box_name, plugin_name, e))
}
}