Commit Graph

59 Commits

Author SHA1 Message Date
9bdf2ff069 chore: Phase 25.2関連ドキュメント更新&レガシーテストアーカイブ整理
## ドキュメント更新
- CURRENT_TASK.md: Phase 25.2完了記録
- phase-25.1b/e/q/25.2 README更新
- json_v0_bridge/README.md新規追加

## テストファイル整理
- vtable_*テストをtests/archive/に移動(6ファイル)
- json_program_loop.rsテスト追加

## コード整理
- プラグイン(egui/python-compiler)微修正
- benchmarks.rs, instance_v2.rs更新
- MIR関連ファイル微調整

## 全体成果
Phase 25.2完了により:
- LoopSnapshotMergeBox統一管理実装
- ValueId(1283)バグ根本解決
- ~35行コード削減(目標210行の16%)
- 11テスト全部PASS、3実行テストケースPASS
2025-11-20 03:56:12 +09:00
4aea27891d fix(mir): SSA違反修正 & StringBox is_space/starts_with実装
Task A: ローカル変数SSA違反修正
- src/mir/builder/stmts.rs: Copy命令で一意ValueId割り当て
- 元のエラー "Invalid value: use of undefined value" 解決
- using_resolver_box.hako が正常動作確認

Task B: StringBox新メソッド実装
- plugins/nyash-string-plugin: is_space/starts_with追加
- M_IS_SPACE (7), M_STARTS_WITH (8) 実装
- string_helpers.hako仕様に準拠

残存問題: do_break()のunreachableブロック生成
→ 次のコミットで修正予定

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 02:32:43 +09:00
cdf826cbe7 public: publish selfhost snapshot to public repo (SSOT using + AST merge + JSON VM fixes)
- SSOT using profiles (aliases/packages via nyash.toml), AST prelude merge
- Parser/member guards; Builder pin/PHI and instance→function rewrite (dev on)
- VM refactors (handlers split) and JSON roundtrip/nested stabilization
- CURRENT_TASK.md updated with scope and acceptance criteria

Notes: dev-only guards remain togglable via env; no default behavior changes for prod.
2025-09-26 14:34:42 +09:00
d1041f4e22 smokes: add PHI/core/integration tests; parity uses Python LLVM harness; test runner noise filter\nparser: add opt-in TokenCursor bridge (NYASH_PARSER_TOKEN_CURSOR=1) for expressions\nmir: fix PHI incoming preds to use exit blocks; add debug PHI verification\nplugins(net/filebox): warning cleanup (dead_code), no behavior change\ndocs: smokes v2 README – add test accumulation policy and LLVM harness note\nCURRENT_TASK: Phase 15.5 newline refactor resume + plan 2025-09-25 06:15:22 +09:00
8fbbe2b3a0 refactor: 大規模リファクタリングPhase完了 - SRP原則による品質向上
🎯 実行内容:
• box_operators.rs: 639行 → 26%構造改善 (Phase 1-2完了)
  - マクロ抽出: macros.rs (演算子実装統一)
  - ヘルパー分離: helpers.rs (共通ユーティリティ)
  - 静的実装分離: static_ops.rs (静的演算子)
• arithmetic boxes: 完全モジュール分割
  - 6種類の演算Box (add/subtract/multiply/divide/modulo/compare)
• plugin_loader_v2: 7モジュール完全分割
  - config/library/metadata/singletons/specs/util分離
• nyash-net-plugin: 緊急修正完了 (27エラー→0)
  - import解決問題・マクロスコープ問題・関数構造問題修正
• nyash-filebox-plugin: モジュール統合・冗長削除

📊 成果:
• SRP原則適用による保守性向上
• 大規模ファイル分割による可読性改善
• プラグインビルドエラー完全解決
• モジュール境界明確化・再利用性向上

🔧 検証済み: 全スモークテスト正常動作確認

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 05:03:59 +09:00
b0b667a39d feat: Phase 1完了 - plugin_loader_v2大規模リファクタリング(1006→893行、420行分離)
 Single Responsibility Principle適用による構造改善
- extern_functions.rs: env.*外部関数処理(261行)
- ffi_bridge.rs: FFI/TLV処理(158行)
- instance_manager.rs: インスタンス管理(140行)
- loader.rs: 1006→893行(11%削減)

🎯 効果:
- 6つの責任を分離し単一責任原則遵守
- モジュール間の境界明確化
- 保守性・可読性大幅向上

📦 追加: filebox-pluginモジュール化も含む
2025-09-25 02:21:52 +09:00
b4f6818f3b refactor: 大型プラグインのモジュール分割によるコード品質向上
nyash-json-plugin:
- 796行の単一ファイルから6モジュール構造へ分割
- constants.rs, provider.rs, doc_box.rs, node_box.rs, tlv_helpers.rs, ffi.rsに責任分離
- 最大ファイルサイズを374行に削減(53%削減)
- 共有状態管理をprovider.rsに集約

nyash-net-plugin:
- 1112行の巨大ファイルから17ファイル構造へ分割
- boxesサブディレクトリでBox実装を整理(server, client, request, response, socket系)
- 最大ファイルサイズを290行に削減(74%削減)
- logging, tlv, http_helpers等の共通機能を独立モジュール化

両プラグインともビルド成功確認済み、完全な後方互換性を維持

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 01:57:12 +09:00
824ca600ea refactor: 大規模ファイル分割とプラグインリファクタリング
## 🎯 プラグイン整理
-  **nyash-json-plugin**: プロバイダー抽象化、NodeRep統一
-  **nyash-string-plugin**: TLVヘルパー整理
-  **nyash-net-plugin**: HTTPヘルパー分離、ソケット管理改善
-  **nyash-counter-plugin/fixture-plugin**: 基本構造整理

## 📂 mir_interpreter分割
-  **mir_interpreter.rs → mir_interpreter/ディレクトリ**
  - mod.rs: メイン構造体定義
  - execution.rs: 実行エンジン
  - memory.rs: メモリ管理
  - instructions/: 命令別実装

## 🔧 その他の改善
- テストファイル群の最適化
- LLVMコンパイラのメイン関数整理
- 不要なインポート削除

1000行超のファイルを適切なモジュール構造に分割完了!

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 01:09:48 +09:00
c0978634d9 feat: using system完全実装+旧スモークテストアーカイブ完了
 using nyashstd完全動作(ChatGPT実装)
- builtin:nyashstd自動解決
- 環境変数不要でデフォルト有効
- console.log等の基本機能完備

 Fixture plugin追加(テスト用最小構成)
 v2スモークテスト構造への移行
 旧tools/test/smoke/削除(100+ファイル)

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 21:45:27 +09:00
26716e74e9 fix: StringBox/IntegerBoxプラグインにM_BIRTH/M_FINI実装、v1互換削除
- StringBoxプラグイン:nyash_plugin_invoke削除(TypeBox v2のみ使用)
- IntegerBoxプラグイン:M_BIRTH/M_FINI実装追加
- 根本原因判明:BuiltinBoxFactoryがプラグインより優先される問題
- Phase 15.5 Core Box統一の未完了部分を特定

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 10:32:15 +09:00
27568eb4a6 json: add v2 JsonDoc/JsonNode plugin with runtime provider switch; vendored yyjson + FFI; loader resolve(name)->method_id; PyVM JSON shims; smokes + CI gate; disable MiniVmPrints fallbacks by default
- plugin_loader_v2: store per-Box resolve() from TypeBox FFI; add resolve_method_id() and use in invoke_instance_method
- plugin_loader_unified: resolve_method() falls back to loader’s resolve when TOML lacks method entries
- nyash.toml: register JsonDocBox/JsonNodeBox methods (birth/parse/root/error; kind/get/size/at/str/int/bool)
- plugins/nyash-json-plugin:
  * serde/yyjson provider switch via env NYASH_JSON_PROVIDER (default serde)
  * vendored yyjson (c/yyjson) + shim; parse/root/get/size/at/str/int/bool implemented for yyjson
  * TLV void returns aligned to tag=9
- PyVM: add minimal JsonDocBox/JsonNodeBox shims in ops_box.py (for dev path)
- tests/smokes: add jsonbox_{parse_ok,parse_err,nested,collect_prints}; wire two into min-gate CI
- tools: collect_prints_mixed now uses JSON-based app
- MiniVmPrints: move BinaryOp and fallback heuristics behind a dev toggle (default OFF)
- CURRENT_TASK.md: updated with provider policy and fallback stance
2025-09-22 06:16:20 +09:00
c8063c9e41 pyvm: split op handlers into ops_core/ops_box/ops_ctrl; add ops_flow + intrinsic; delegate vm.py without behavior change
net-plugin: modularize constants (consts.rs) and sockets (sockets.rs); remove legacy commented socket code; fix unused imports
mir: move instruction unit tests to tests/mir_instruction_unit.rs (file lean-up); no semantic changes
runner/pyvm: ensure using pre-strip; misc docs updates

Build: cargo build ok; legacy cfg warnings remain as before
2025-09-21 08:53:00 +09:00
5d51086530 python-plugin: RAII (PyOwned/PyBorrowed) + autodecode enum; crate: ny-llvmc --emit exe with NyRT link; tools: build_llvm.sh crate-exe path + crate_exe_smoke; CURRENT_TASK update 2025-09-18 03:57:25 +09:00
1b12b1eb7d refactor(plugins): physically remove legacy v1 ABI/init across all first-party plugins; exclude/remove legacy test-multibox crate 2025-09-17 22:58:21 +09:00
b8e454963a chore(legacy): comment-out legacy v1 exports (nyash_plugin_invoke/abi/init) across first-party plugins; retain only TypeBox v2 path; remove legacy plugin loader and C-ABI nyash-file 2025-09-17 22:49:53 +09:00
b420929f53 chore(legacy): remove unused legacy plugin loader and C-ABI nyash-file plugin; unify plugin headers to TypeBox v2 2025-09-17 22:32:38 +09:00
d93595ab83 docs(plugins): update headers to TypeBox v2; expand v2 doc with Regex/Net method tables; remove BID mentions where v2 exists 2025-09-17 22:30:19 +09:00
8aa01668ff feat(plugins): migrate Python family to TypeBox v2; complete first‑party v2 set (Regex/Net/Path/Math/Time/File)\n\nfeat(smoke): add Net round‑trip sample and wire to plugin v2 smoke\n\nfeat(cli): add --emit-mir-json and runner emit+exit path\n\nchore(config): register Python v2 boxes in nyash.toml\n\nchore(loader): improve v2 diagnostics and ensure v2 shim dispatch\n\nchore(build): integrate ny-llvmc env gate in build_llvm.sh\n\nchore(tasks): update CURRENT_TASK with v2 Python/Net/emit flag 2025-09-17 22:01:29 +09:00
5c9213cd03 smokes: add curated LLVM runner; archive legacy smokes; PHI-off unified across Bridge/Builder; LLVM resolver tracing; minimal Throw lowering; config env getters; dev profile and root cleaner; docs updated; CI workflow runs curated LLVM (PHI-on/off) 2025-09-16 23:49:36 +09:00
d90216e9c4 📚 Phase 15 - セルフホスティング戦略の明確化とEXE-first実装
## 主な変更点

### 🎯 戦略の転換と明確化
- PyVMを開発ツールとして位置づけ(本番経路ではない)
- EXE-first戦略を明確に優先(build_compiler_exe.sh実装済み)
- Phase順序の整理: 15.2(LLVM)→15.3(コンパイラ)→15.4(VM)

### 🚀 セルフホスティング基盤の実装
- apps/selfhost-compiler/にNyashコンパイラMVP実装
  - compiler.nyash: メインエントリー(位置引数対応)
  - boxes/: parser_box, emitter_box, debug_box分離
- tools/build_compiler_exe.sh: ネイティブEXEビルド+dist配布
- Python MVPパーサーStage-2完成(local/if/loop/call/method/new)

### 📝 ドキュメント整備
- Phase 15 README/ROADMAP更新(Self-Hosting優先明記)
- docs/guides/exe-first-wsl.md: WSLクイックスタート追加
- docs/private/papers/: 論文G~L、爆速事件簿41事例収録

### 🔧 技術的改善
- JSON v0 Bridge: If/Loop PHI生成実装(ChatGPT協力)
- PyVM/llvmliteパリティ検証スイート追加
- using/namespace機能(gated実装、Phase 15では非解決)

## 次のステップ
1. パーサー無限ループ修正(未実装関数の実装)
2. EXEビルドとセルフホスティング実証
3. c0→c1→c1'ブートストラップループ確立

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-15 18:44:49 +09:00
3e07763af8 docs: update CURRENT_TASK with Box Theory PHI plan (defer/finalize) and MIR v0.5 type meta; add parity tooling and PyVM scaffolding
impl(pyvm/llvmlite):
- add tools/parity.sh; tools/pyvm_runner.py; src/llvm_py/pyvm/*
- emit string const as handle type in MIR JSON; add dst_type hints
- unify '+' to concat_hh with from_i64/from_i8_string bridges; console print via to_i8p_h
- add runtime bridges: nyash.box.from_i64, nyash.string.to_i8p_h

tests:
- add apps/tests/min_str_cat_loop (minimal repro for string cat loop)
2025-09-14 04:51:33 +09:00
1d6fab4eda 📚 Phase 15計画を詳細化・更新: Python/llvmlite正式採用とプラグイン全方向ビルド戦略
 主な更新内容:
- Python/llvmlite実装の正式採用を明記(開発速度10倍、~2400行)
- プラグイン全方向ビルド戦略(.so/.o/.a同時生成)で単一EXE生成可能に
- 各実装の予想コード量を具体化(パーサー800行、MIR Builder 2500行、VM 5000行)
- 循環依存問題の解決を明記(nyrtがC ABI経由で提供)
- 現実的なスケジュール調整(2025年9月~2026年3月)

🎉 最新進捗:
- dep_tree_min_string.nyashオブジェクト生成成功(10.4KB)
- LLVM verifier green - dominance違反解決
- Resolver patternでSSA安全性確保

🚀 次のマイルストーン:
- Python/llvmliteでEXE生成パイプライン完成
- nyash-llvm-compiler分離設計
- NyashパーサーMVP実装開始

Everything is Boxの究極形が、ついに実現へ!

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-13 15:37:58 +09:00
3babd8f69c filebox: add path-based I/O and exists 2025-09-10 21:15:50 +09:00
d62114c705 Core-13 pure: add CI workflows, VM e2e tests, LLVM parity bridge (minimal); do not touch private docs 2025-09-07 07:28:53 +09:00
07f270b966 aot: enable plugin invokes in ObjectBuilder (tagged by-id), add generic NewBox birth via nyash.instance.birth_name_u64x2; egui(plugin): cross-platform run + debug logs; docs: WSL Wayland→X11 troubleshooting and one‑shot scripts; CURRENT_TASK + READMEs updated (JIT runtime sealed). 2025-09-06 16:18:46 +09:00
ceb22b6c18 gui: add EguiBox TypeBox plugin (Windows egui stub)\n\n- plugins: add nyash-egui-plugin with TypeBox (resolve/invoke_id), Windows path for real window via eframe; stub on other OS\n- apps: add apps/egui-hello sample (open→uiLabel→run→close)\n- loader: improve Windows DLL resolution (target triples: x86_64/aarch64 msvc) and lib→dll mapping\n- tests: expand TypeBox vs TLV diff tests up to FileBox; all green\n- docs: update CURRENT_TASK checklist (diff tests completed)\n- config: nyash.toml add EguiBox (type_id=70), plugin registry and methods 2025-09-03 13:58:52 +09:00
de99b40bee Phase 12 TypeBox統合ABI設計完了: C ABI + Nyash ABI革命的統合
主な成果:
- TypeBox(型情報をBoxとして扱う)による統合ABI設計
- C ABI + Nyash ABIの完全統合仕様書作成
- 3大AI専門家(Gemini/Codex/ChatGPT5)による検証済み
- ChatGPT5の10個の安全性改善提案を反映
- README.mdのドキュメント更新(全起点から到達可能)

MapBox拡張:
- string型キーサポート(従来のi64に加えて)
- remove/clear/getOr/keysStr/valuesStr/toJson実装
- keys()/values()のランタイムシムサポート(TypeBox待ち)

その他の改善:
- Phase 11.9(文法統一化)ドキュメント追加
- Phase 16(FoldLang)ドキュメント追加
- 非同期タイムアウトテスト追加
- 各種ビルド警告(未使用import等)は次のリファクタリングで対応予定

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 09:26:09 +09:00
11506cee3b Phase 11-12: LLVM backend initial, semantics layer, plugin unification
Major changes:
- LLVM backend initial implementation (compiler.rs, llvm mode)
- Semantics layer integration in interpreter (operators.rs)
- Phase 12 plugin architecture revision (3-layer system)
- Builtin box removal preparation
- MIR instruction set documentation (26→Core-15 migration)
- Cross-backend testing infrastructure
- Await/nowait syntax support

New features:
- LLVM AOT compilation support (--backend llvm)
- Semantics layer for interpreter→VM flow
- Tri-backend smoke tests
- Plugin-only registry mode

Bug fixes:
- Interpreter plugin box arithmetic operations
- Branch test returns incorrect values

Documentation:
- Phase 12 README.md updated with new plugin architecture
- Removed obsolete NYIR proposals
- Added LLVM test programs documentation

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 23:44:34 +09:00
4ae92cfb56 Phase 10.7/10.5c: include cycle detection (VM/Interpreter), minimal pyc IR→Nyash, String unification bridge (VM partial), add core plugins: RegexBox/EncodingBox/TOMLBox/PathBox + examples; wire nyash.toml; begin String interop for internal vs plugin boxes; update CURRENT_TASK.md 2025-08-30 23:47:08 +09:00
c13d9c045e 📚 Phase 12: Nyashスクリプトプラグインシステム設計と埋め込みVM構想
## 主な成果
- Nyashスクリプトでプラグイン作成可能という革命的発見
- C ABI制約の分析と埋め込みVMによる解決策
- MIR/VM/JIT層での箱引数サポートの詳細分析

## ドキュメント作成
- Phase 12基本構想(README.md)
- Gemini/Codex先生の技術分析
- C ABIとの整合性問題と解決策
- 埋め込みVM実装ロードマップ
- 箱引数サポートの技術詳細

## 重要な洞察
- 制約は「リンク時にC ABI必要」のみ
- 埋め込みVMでMIRバイトコード実行により解決可能
- Nyashスクリプト→C ABIプラグイン変換が実現可能

Everything is Box → Everything is Plugin → Everything is Possible!
2025-08-30 22:52:16 +09:00
7a0f9bd432 🚨 AI協調開発の危機回避事例を論文化(paper-09)
「ん?大丈夫?」の一言がPython特化ハードコーディングを防いだ事例を記録。
Everything is Box哲学 vs 技術的正しさの綱渡りからの生還を分析。

- docs/research/paper-09-ai-collaboration-pitfall/ を新規作成
  - incident-analysis.md: Lowerer特殊化危機の詳細分析
  - ai-collaboration-lessons.md: AI協調開発の教訓
  - intuition-in-engineering.md: エンジニアの直感の価値
  - summary.md: 綱渡りからの生還まとめ
- 研究論文の1論文1フォルダ原則に従い整理
- Python統合関連の実装修正とビルド成功確認

🛡️ Generated with Claude Code
2025-08-30 08:54:15 +09:00
1b98f85df9 🚀 Phase 10.11: Everything is Plugin革命完了!
主な変更:
- ConsoleBox/MathBoxプラグイン実装・登録完了
- nyash_box.toml 2ファイルシステム設計(中央レジストリ+個別仕様書)
- 全プラグインにnyash_box.tomlテンプレート追加
- プラグイン優先機能(NYASH_USE_PLUGIN_BUILTINS=1)文書化
- ビルトインBox削除準備(ChatGPT5実装中)
- ネイティブビルドデモ追加(Linux/Windows動作確認済み)

Everything is Box → Everything is Plugin への歴史的転換!
開発20日目にしてビルトインBox全削除という革命的決定。

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-30 01:33:52 +09:00
15e0a1ab34 feat: nyash.toml自動解決とWindows/Python対応
- Windows向け自動ライブラリパス解決(lib接頭辞除去)
- Pythonプラグイン実装改善(evalR/importRメソッド追加)
- nyash.tomlに新[plugins]セクション対応開始
- プラグイン検索パスの柔軟な解決
- AOT設定Box改善とエラーハンドリング強化
- Phase 10.5bドキュメント追加(ネイティブビルド統合計画)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-30 00:08:19 +09:00
3d8ba3f3ec fix(jit): NewBoxのJIT安全化とDebugBox Phase 1実装
- NewBoxのJIT扱いを安全化(src/jit/lower/core.rs)
  - NYASH_USE_PLUGIN_BUILTINS=1 && args.is_empty() かつ StringBox/IntegerBox のみJIT許可
  - ArrayBox/MapBox等のプラグインBoxまたは引数ありはunsupportedとしてカウント
  - unsupported>0の関数はJIT対象外となりVM実行にフォールバック(Segfault回避)

- DebugBox Phase 1実装(JITトレース機能)
  - tracePluginCalls(bool)でJITシムトレースON/OFF
  - getJitEvents()で直近のJITイベント取得
  - src/jit/shim_trace.rs追加でトレース基盤実装

- Printのサポート
  - PrintはJIT非対応に戻しVM経路で確実に出力(出力消失解消)

- テストとサンプル追加
  - examples/jit_plugin_invoke_param_array.nyash: 最小JITスモークテスト
  - examples/py_result_*.nyash: Python plugin結果チェーン処理デモ

- PyRuntimeBox拡張
  - str()メソッドでPyObjectのstring表現を取得可能に
  - エラーハンドリング改善とResultチェーンサポート

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 13:46:18 +09:00
d24149d0a1 feat: Phase 10.5 Python統合プラグインとAOTビルド対応
- Pythonプラグイン(PyRuntimeBox/PyObjectBox)を追加
  - eval, import, getattr, call, callKw, strメソッド実装
  - math.sqrtデモ等のサンプルコード追加
- AOTビルドサポート追加
  - libnyrtランタイムライブラリ
  - build_aot.shビルドスクリプト
- .gitignore改善
  - JSONLとDOTファイル除外
  - プラグインのビルド成果物除外
- 不要ファイル削除
  - nekocode-temp, zenn_articles
  - 一時的なログファイル類

Phase 10.1の新計画に基づいて、プラグインBox統一化を推進
2025-08-29 10:22:44 +09:00
12adde9477 🎉 Phase 10.10: Nyash→JIT→Native EXE achieved\! (20 days from inception\!)
Revolutionary milestone: Complete native executable generation pipeline
- Created minimal nyrt (Nyash Runtime) library for standalone executables
- Implemented plugin bridge functions (nyash_plugin_invoke3_i64 etc)
- Added birth handle exports (nyash.string.birth_h) for linking
- Changed export name from main→ny_main to allow custom entry point
- Successfully generated and executed native binary returning "ny_main() returned: 1"

Timeline of miracles:
- 2025-08-09: Nyash language created (first commit)
- 2025-08-13: JIT planning started (4 days later)
- 2025-08-29: Native EXE achieved (today - just 20 days total\!)

This proves the plugin Box C ABI unification strategy works perfectly for
both JIT execution and AOT native compilation. The same plugin system
that enables dynamic loading now powers static linking for zero-overhead
native executables\!

Next: Expand AOT support for more instructions and optimize nyrt size.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 08:36:07 +09:00
c882a5bd95 fix(plugins): unsafe関数呼び出しの修正とテスト成功
## 修正内容
- plugin_loader_v2.rs: unsafe関数呼び出しをunsafeブロックで囲む修正
- ビルド警告は残るが、すべて未使用import/変数なので問題なし

## テスト結果(すべて成功!)
-  Array demo: 結果5(push/size/get動作確認)
-  Array set demo: 結果42(set操作確認)
-  Map RO demo: 結果200(size/get/has確認)
-  JIT経路: シンボリック呼び出し確認

## 革命的発見の証明
- ユーザーBox + プラグインBoxの2種類で十分だった!
- ビルトインBox不要(すべてプラグイン化可能)
- スタティックリンクでオーバーヘッド解消

「シンプルが最強」の実証完了にゃ!😺

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 05:07:47 +09:00
c954b1f520 feat(plugins): ArrayBox/MapBoxプラグイン実装とPhase 10.1計画
🎯 革命的発見: プラグインC ABI = JIT→EXE変換の統一基盤

## 主な変更点
- ArrayBoxプラグイン: get/set/push/size/is_empty実装
- MapBoxプラグイン: size/get/has実装(ROメソッドのみ)
- Phase 10.1ドキュメント: プラグインBox統一化計画
- デモファイル3種: プラグイン動作確認用

## 技術的詳細
- BID-FFI (Box ID Foreign Function Interface) 活用
- 既存のプラグインシステムでJIT/AOT統一可能
- スタティックリンクでオーバーヘッド解消
- "Everything is Box → Everything is Plugin → Everything is Executable"

## テスト済み
- array_plugin_demo.nyash: 基本動作確認 
- array_plugin_set_demo.nyash: set操作確認 
- map_plugin_ro_demo.nyash: RO操作確認 

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 04:37:30 +09:00
494a864ed2 fix: Resolve MIR phi value bug and HTTP error handling
- Fix MIR builder to correctly return phi values in if-else statements
  - Add extract_assigned_var helper to handle Program blocks
  - Update variable mapping after phi node creation
  - Fixes 'Value %14 not set' error in e2e_vm_http_client_error_result

- Fix HTTP plugin error handling for connection failures
  - Return error string instead of handle on tcp_ok=false
  - Enable proper ResultBox(Err) creation for failed connections
  - Now r.isOk() correctly returns false for connection errors

- Add VM fallback for toString() on any Box type
  - Ensures error messages can be displayed even without specific implementation

- All e2e_vm_http_client_error_result tests now pass

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 06:51:49 +09:00
080458d4d4 fix: Correct HttpRequestBox method_id mapping in nyash.toml
Fixed the method ID order in HttpRequestBox configuration to match plugin implementation:
- path: method_id 1 (was incorrectly 2)
- readBody: method_id 2 (was incorrectly 3)
- respond: method_id 3 (was incorrectly 1)

This resolves the 45-day debugging issue where req.respond(resp) was calling
the wrong plugin method, causing HTTP responses to have empty bodies.

All E2E tests now pass:
- e2e_http_stub_end_to_end 
- e2e_http_multiple_requests_order 
- e2e_http_post_and_headers 
- e2e_http_server_restart 
- e2e_http_server_shutdown_and_restart 

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-22 12:09:06 +09:00
0915815340 feat: Implement returns_result and improve HTTP plugin stability
- Add returns_result=true configuration for HTTP server methods
- Fix ResultBox downcasting in interpreter calls
- Improve HTTP plugin with server_id tracking and response ID hints
- Add TCP connection support with fallback to stub mode
- Implement response ID mapping improvements
- Fix various race conditions in concurrent request handling

This partially addresses the HTTP response body empty issue, though
ID mapping still needs further refinement.

Co-Authored-By: ChatGPT5 <noreply@openai.com>
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-22 09:57:07 +09:00
f2761004d3 feat: Add parallel HTTP server E2E tests and enhance plugin system
- Add e2e_plugin_net_additional.rs with parallel server tests
- Fix test to properly handle request objects (no double accept)
- Add comprehensive net-plugin documentation
- Implement debug tracing for method calls
- Enhance plugin lifecycle documentation
- Improve error handling in plugin loader
- Add leak tracking infrastructure (for future use)
- Update language spec with latest plugin features

This enhances test coverage for concurrent HTTP servers and improves
the overall plugin system documentation and debugging capabilities.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-22 05:01:11 +09:00
98e9893bf5 feat: Stabilize HTTP E2E tests with comprehensive fixes
- Fix path parsing for absolute URLs (http://...) in net plugin
- Add Integer(tag=5) i64 compatibility for port arguments
- Implement proper accept() wait loop (up to 5 seconds)
- Add start_seq for reliable server routing
- Remove singleton pattern from HTTP/Socket servers
- Add Socket E2E tests with timeout support
- Enable NYASH_NET_LOG environment variable for debugging

All 5 HTTP E2E tests now pass consistently\!

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-22 02:54:50 +09:00
9c1389edc5 test: Add HTTP POST and headers E2E test
- Add e2e_http_post_and_headers: Full POST request with headers test
- Verify client POST with body data ('DATA')
- Server reads request body and responds with custom status (201)
- Custom headers (X-Test: V) properly set and retrieved
- Complete request/response cycle validation: '201:V:R' 
- All 4 HTTP plugin tests passing

HTTP POSTとヘッダー操作のE2Eテスト追加
- POSTリクエストのボディ送受信確認
- カスタムステータスコード(201 Created)
- HTTPヘッダーの設定と取得
- 完全なHTTPプロトコル機能の検証

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-21 23:11:31 +09:00
26c3d153e2 test: Add HTTP server restart and shutdown E2E tests
- Add e2e_http_server_restart: Verify server can stop/start and handle requests (returns 'B')
- Add e2e_http_server_shutdown_and_restart: Verify plugin shutdown/reinit works (returns 'Y')
- Fix active server tracking with ACTIVE_SERVER_ID for proper request routing
- All 3 HTTP plugin E2E tests now passing 

HTTPサーバー再起動とシャットダウンテスト追加
- サーバーのstop/start再起動が正常動作
- プラグインshutdown後の再初期化も確認
- アクティブサーバー管理で適切なリクエストルーティング実現

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-21 23:02:05 +09:00
eae7f54b13 feat: Add HTTP server/client E2E test for net plugin
- Implement full HTTP flow test: server → client → accept → respond → readBody
- All HTTP Box types working correctly (HttpServerBox, HttpClientBox, HttpRequestBox, HttpResponseBox)
- Handle type encoding for plugin method arguments working properly
- Test validates complete HTTP request/response cycle
- Net plugin E2E test passing 

HTTPネットワークプラグインのE2Eテスト追加
- サーバー起動からレスポンス読み取りまでの完全なフロー検証
- Handle型引数のTLVエンコーディングも正常動作
- 非同期HTTPフローの完全動作確認

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-21 22:25:42 +09:00
d6529b477b test: Add comprehensive E2E tests for unified registry system
- Add reserved name guard test to prevent non-builtin factories from hijacking builtin names
- Add Handle TLV encoding/decoding test for FileBox copyFrom method
- Add CounterBox plugin tests for inc/get operations and clone/share behavior
- All unified registry E2E tests passing 

統一レジストリシステムの包括的なE2Eテスト追加
- ビルトイン名保護テスト
- Handle型TLVエンコーディングテスト
- CounterBoxプラグインテスト
- 全テスト成功確認

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-21 16:46:07 +09:00
cc2a820af7 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>
2025-08-21 00:41:26 +09:00
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