Commit Graph

8 Commits

Author SHA1 Message Date
e1b148051b feat: nyash.toml v2完全対応とinit関数オプション化
主な変更:
- nyash.toml v2形式(マルチBox型プラグイン)に完全対応
- plugin-testerをv2対応に全面更新
- Host VTable完全廃止でシンプル化
- init関数をオプション化(グローバル初期化用)
- FileBoxプラグインを新設計に移行(once_cell使用)

仕様更新:
- nyash_plugin_invoke(必須)とnyash_plugin_init(オプション)の2関数体制
- すべてのメタ情報はnyash.tomlから取得
- プラグインは自己完結でログ出力

テスト確認:
- plugin-testerでFileBoxの動作確認済み
- birth/finiライフサイクル正常動作

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 04:48:25 +09:00
5f6f946179 feat: 汎用プラグインBox生成システム実装とnyash.toml v2対応準備
- GenericPluginBoxを実装し、任意のプラグインBoxを動的に生成可能に
- FileBox決め打ちコードを削除(設計思想違反の解消)
- CURRENT_TASK.mdを更新し、nyash.toml v2対応の必要性を明確化
- 問題: プラグインテスターとNyash本体が古い単一Box型形式のまま

次のステップ:
1. nyash.tomlをv2形式(マルチBox型)に更新
2. プラグインテスターをv2対応に
3. Nyash本体のレジストリをv2対応に

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 03:48:44 +09:00
c6c3c8e2f9 fix(bid-ffi): Fix HostVtable lifetime issue causing segfault
🚨 Critical memory safety fix:
- HostVtable was created on stack and destroyed after init
- Plugin stored reference to destroyed memory → NULL pointer access
- Changed to static LazyLock storage for lifetime safety

 Results:
- Segfault completely eliminated
- Plugin logging now works properly
- Type info system confirmed working
- Full E2E FileBox plugin operation successful

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 14:10:41 +09:00
f5ab4910e4 fix(plugins): Fix FileBox plugin I/O operations and add TLV debugging
## FileBox Plugin Fixes

### Issue Resolution
- Fixed file write operations not persisting to disk
- Fixed TLV tag mismatch preventing read operations
- Added comprehensive TLV debugging capability

### Changes Made

#### plugins/nyash-filebox-plugin/src/lib.rs
- Added file.flush() after write operations to ensure data persistence
- Modified tlv_parse_bytes to accept both String(6) and Bytes(7) tags
- Resolves compatibility issue with plugin-tester String encoding

#### tools/plugin-tester/src/main.rs
- Added `tlv-debug` subcommand with detailed TLV analysis
- Provides hex dumps, encoding/decoding verification
- Full plugin round-trip testing with file I/O validation
- Detailed error analysis for debugging TLV protocol issues

## Test Results

### Before Fix
```
INFO: WRITE 8 bytes
INFO: READ 0 bytes  ← Problem: no data read
✗: Plugin round-trip failed\!
```

### After Fix
```
INFO: WRITE 8 bytes
INFO: READ 8 bytes  ← Fixed: data successfully read
✓: Plugin round-trip successful\!
```

## Technical Details
- Root cause: Missing file.flush() + TLV tag type mismatch
- Plugin-tester sends String(6), plugin expected Bytes(7) only
- File buffer not flushed to disk before close/reopen
- Solution: Added flush() + dual tag support for compatibility

This completes the core BID-FFI plugin I/O functionality validation.
Nyash integration still needs method dispatch optimization.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 11:21:04 +09:00
0441608db3 BID-FFI integration:\n- Add plugin-tester io subcommand and TLV helpers; E2E open/write/read/close\n- Implement FileBox plugin invoke (birth/open/read/write/close) with BID-1 two-pass\n- Add BID loader/registry/plugin_box modules; prefer plugin-backed FileBox in interpreter\n- Introduce PluginFileBox with minimal read/write/close dispatch\n- Update runner debug paths; add local simple tests\n- Docs: plugin-tester guide and FileBox Nyash↔BID mapping; CURRENT_TASK updated 2025-08-18 11:07:03 +09:00
2efdd0ac0c feat: BID-FFIプラグインシステム基盤実装(Step 1-3完了)
- FileBoxプラグイン単体実装
  - birth/finiライフサイクル対応
  - 6つのメソッド定義(birth/open/read/write/close/fini)
  - プラグインが自らBox名「FileBox」を宣言

- nyash.toml設定ファイル作成
  - FileBox = "nyash-filebox-plugin" マッピング定義
  - プラグイン検索パス設定

- プラグインテスター作成(tools/plugin-tester)
  - Box名を決め打ちしない汎用設計
  - プラグインから型情報を動的取得
  - メソッド一覧表示機能
  - 診断機能付きチェックコマンド

重要な設計原則:
- プラグインが自分のBox名を宣言(ローダーは知らない)
- 汎用的で拡張可能な設計
- メモリ管理の明確な責任分担

次のステップ:Nyashとの統合(Step 4)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 09:32:54 +09:00
bec0e9bc92 revert: 古いプラグインシステム実装前の状態に巻き戻し
- ソースコードをcommit 3f7d71fの状態に復元(古いプラグインシステム実装前)
- docsフォルダは最新の状態を維持(BID-FFI設計ドキュメント含む)
- nyashバイナリの基本動作確認済み
- BID-FFIシステムをクリーンに再実装する準備完了

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 08:34:19 +09:00
75868a5a96 feat(phase-9.75g-0): Implement BID-FFI Day 5 - FileBox plugin library and transparent switching (90% complete)
Day 5 achievements:
- Created independent FileBox plugin crate with C FFI exports
- Integrated plugin loading into Nyash interpreter startup
- Implemented transparent builtin/plugin Box switching via nyash.toml
- Successfully loaded plugin library (385KB .so) at runtime
- Confirmed PluginBox proxy creation for FileBox instances

Architecture changes:
- Added plugins/ directory with .gitignore for build artifacts
- Modified runner.rs to load plugins from nyash.toml on startup
- Updated objects.rs to use BoxFactoryRegistry for FileBox creation
- Fixed bid module visibility between lib.rs and main.rs

Remaining work (10%):
- Complete PluginBox proxy method implementations (toString, etc.)
- Test actual file operations through plugin interface
- Finalize error handling and edge cases

Build status: All tests passing, plugin loading confirmed
2025-08-18 00:33:01 +09:00