feat(plugin): Fix plugin BoxRef return and Box argument support

- Fixed deadlock in FileBox plugin copyFrom implementation (single lock)
- Added TLV Handle (tag=8) parsing in calls.rs for returned BoxRefs
- Improved plugin loader with config path consistency and detailed logging
- Fixed loader routing for proper Handle type_id/fini_method_id resolution
- Added detailed logging for TLV encoding/decoding in plugin_loader_v2

Test docs/examples/plugin_boxref_return.nyash now works correctly:
- cloneSelf() returns FileBox Handle properly
- copyFrom(Box) accepts plugin Box arguments
- Both FileBox instances close and fini correctly

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-21 00:41:26 +09:00
parent af32896574
commit cc2a820af7
274 changed files with 7244 additions and 4608 deletions

View File

@ -0,0 +1,53 @@
# 🎯 CURRENT TASK - 2025年8月20日
## 📊 現在の状況
### ✅ 完了したタスク
1. **ドキュメント再編成** - 完全完了!
- 283ファイル → 4大カテゴリに整理
- Phaseファイルも統合済み
- 説明書/予定フォルダ削除済み
2. **プラグインBox基本実装** (Phase 9.78c)
- FileBoxプラグイン実装済み
- インタープリター経由の呼び出し成功
- 基本的な引数/戻り値サポート追加ChatGPT5による
### 🚧 現在の課題
1. **Bashコマンドエラー問題**
- docs整理で現在のディレクトリが削除された影響
- セッション再起動が必要かも
2. **E2Eテスト状況**tests/e2e_plugin_filebox.rs
- インタープリターテスト: ✅ 成功FileBox.close()が"ok"を返す)
- デリゲーションテスト: ❓ 未実装の可能性
- VMテスト: ❌ 失敗VMはまだプラグインBox未対応
### 🎯 次のタスク (Phase 9.78b)
#### Step 3: BoxFactory dyn化優先度: 高)
- 現在: `HashMap<String, Box<dyn Fn() -> Arc<dyn NyashBox>>>`
- 目標: `HashMap<String, Arc<dyn BoxFactory>>`
- 利点: プラグインBoxもVMで統一処理可能
#### Step 4: グローバル排除
- `get_global_registry()``runtime.registry`
- `get_global_loader_v2()``runtime.plugin_loader`
#### Step 5: SharedState分解
- 巨大なSharedState構造体を分割
- Box管理、メソッド管理、スコープ管理を分離
### 📝 メモ
- ChatGPT5がプラグインBoxメソッド呼び出しに引数/戻り値サポートを追加
- TLV (Type-Length-Value) エンコーディングで引数をプラグインに渡す実装
- Rustの借用チェッカーとの格闘の跡が見られる複数回の修正
### 🔧 推奨アクション
1. セッション再起動してBashコマンドを復活
2. ビルド実行: `cargo build --release -j32`
3. E2Eテスト実行: `cargo test e2e_plugin_filebox --features plugins -- --show-output`
4. VMプラグイン統合の実装開始Phase 9.78b Step 3
---
最終更新: 2025年8月20日 22:45