feat(phase-9.75g-0): Implement BID-FFI Day 2 - Metadata API and plugin lifecycle

BID-1 Implementation Progress (Day 2 Complete\! 🎉):

Metadata API Implementation:
- Add NyashHostVtable for host function integration
  - Memory allocation/free functions
  - FutureBox wake support
  - Logging capability
- Implement plugin metadata structures
  - NyashPluginInfo: type_id, type_name, methods
  - NyashMethodInfo: method_id, method_name, signature_hash
  - PluginMetadata: Rust-side holder with lifecycle state

Plugin API Definitions:
- Define C FFI function signatures
  - nyash_plugin_abi(): Get ABI version
  - nyash_plugin_init(): Initialize with host vtable
  - nyash_plugin_invoke(): Unified method invocation
  - nyash_plugin_shutdown(): Cleanup resources
- Implement PluginHandle for loaded plugin management
- Add two-call pattern support for dynamic result sizes

Test Coverage: 7/7 
- bid::types::tests (2 tests)
- bid::tlv::tests (2 tests)
- bid::metadata::tests (2 tests)
- bid::plugin_api::tests (1 test)

Everything is Box philosophy progressing with practical FFI design\!

Next: Day 3 - Existing Box integration (StringBox/IntegerBox/FutureBox bridge)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-17 19:01:16 +09:00
parent f5ee08f375
commit ec99a97957
3 changed files with 506 additions and 0 deletions

View File

@ -4,10 +4,14 @@
pub mod types;
pub mod tlv;
pub mod error;
pub mod metadata;
pub mod plugin_api;
pub use types::*;
pub use tlv::*;
pub use error::*;
pub use metadata::*;
pub use plugin_api::*;
/// BID-1 version constant
pub const BID_VERSION: u16 = 1;