feat(phase91): PluginHost/CoreServices skeleton complete

Phase 91 完了: Ring1-Core 構造の明確化

**実装内容**:
- CoreServices 定義(6つの Service trait)
  - StringService, IntegerService, BoolService
  - ArrayService, MapService, ConsoleService
- PluginHost 構造体(Ring0 ⇔ CoreServices 橋渡し)
- NyashPlugin trait(プラグインシステム標準IF)
- PluginRegistry skeleton

**Phase 87 整合性**:
- CoreServices は core_required (6個) を完全カバー
  - String, Integer, Bool, Array, Map, Console
- CoreBoxId との対応表をドキュメント化

**設計原則確立**:
- Ring1-Core 構造明確化
- core_required は必ず揃う(型レベル保証)
- Fail-Fast 設計(ensure_initialized)
- 既存影響ゼロ(新規ファイルのみ)

**テスト結果**:
- 5件追加(全て合格)
- ビルド成功
- 既存テストに影響なし

**次のステップ**: Phase 92 (UnifiedBoxRegistry との統合)

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-03 07:43:08 +09:00
parent 4e2e45a79d
commit 3d253056bd
4 changed files with 356 additions and 0 deletions

View File

@ -0,0 +1,67 @@
//! Phase 91: CoreServices 定義
//!
//! Ring1-Core: core_required Box の Service trait 群。
//! Phase 87 CoreBoxId の core_required (6個) 全てをカバー。
use std::sync::Arc;
/// StringBox Service trait
pub trait StringService: Send + Sync {
// Phase 92 以降で実装
}
/// IntegerBox Service trait
pub trait IntegerService: Send + Sync {
// Phase 92 以降で実装
}
/// BoolBox Service trait
pub trait BoolService: Send + Sync {
// Phase 92 以降で実装
}
/// ArrayBox Service trait
pub trait ArrayService: Send + Sync {
// Phase 92 以降で実装
}
/// MapBox Service trait
pub trait MapService: Send + Sync {
// Phase 92 以降で実装
}
/// ConsoleBox Service trait
pub trait ConsoleService: Send + Sync {
// Phase 92 以降で実装
}
/// CoreServices: core_required Box の集合
///
/// Phase 85 設計原則:
/// - core_required は必ず全て揃っていなければならない
/// - 起動時に全フィールドが初期化されていることを保証
///
/// Phase 87 CoreBoxId との対応:
/// - String → string
/// - Integer → integer
/// - Bool → bool
/// - Array → array
/// - Map → map
/// - Console → console
pub struct CoreServices {
pub string: Arc<dyn StringService>,
pub integer: Arc<dyn IntegerService>,
pub bool: Arc<dyn BoolService>,
pub array: Arc<dyn ArrayService>,
pub map: Arc<dyn MapService>,
pub console: Arc<dyn ConsoleService>,
}
impl CoreServices {
/// 全フィールドが初期化されているか検証
/// Phase 92 以降で各 Service の初期化を検証
pub fn ensure_initialized(&self) {
// Phase 91 では trait が空なので何もしない
// Phase 92 以降で各 Service の初期化を検証
}
}