Commit Graph

7 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
cc8553380c feat: Add multi-box plugin support (v2) with test implementation
- Extend plugin-tester to support multi-box plugins with v2 API
- Add nyash_plugin_get_box_count/get_box_info/get_type_id functions
- Create test multi-box plugin providing TestBoxA and TestBoxB
- Update plugin-system.md documentation for v2 format
- Add nyash.toml v2 specification for multi-box support
- Successfully tested multi-box plugin lifecycle and type resolution

This enables one plugin to provide multiple Box types, solving the
dependency issue where HTTPServerBox needs SocketBox.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 01:13:48 +09:00
bfb2d648d5 feat(phase-9.75g-0): Complete BID-FFI Plugin System with enhanced plugin-tester
🎊 Phase 9.75g-0 COMPLETE - Revolutionary Plugin System Achievement\!

 Major Completions:
- plugin-tester type validation: nyash.toml integration & method signature verification
- Duplicate method name detection: Enforces Nyash no-overloading policy
- Comprehensive developer guide: 200+ line technical documentation
- Memory safety: HostVtable lifetime issues resolved with LazyLock
- Type information system: External nyash.toml configuration eliminates hardcoded conversions

🚀 Revolutionary Impact:
Nyash now supports dynamic Box type extension via plugins:
```nyash
local file = new FileBox()        // Plugin-provided
local db = new PostgreSQLBox()    // Future: Plugin-provided
local gpu = new CudaBox()         // Future: Plugin-provided
```

📊 Technical Achievements:
- plugin-tester: 4 comprehensive validation modes (check/lifecycle/io/typecheck)
- BID-FFI Protocol: Production-ready with valgrind-verified memory safety
- Type conversion: Automatic string→bytes mapping via nyash.toml
- Method validation: Prevents overloading conflicts in plugin development

🎯 Next Priority: Phase 8.6 VM Performance Improvement
Current issue: VM is 0.9x slower than interpreter (regression\!)
Target: 2x+ speedup for practical VM execution

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 16:04:30 +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