feat(Ring0): Phase 107 - Ring0.FsApi FileIo integration complete

Implementation Summary:
Phase 107 establishes FileBox as a unified layer over Ring0.FsApi

Completed Tasks:
- Task 1: FsApi SSOT review and documentation
- Task 2: FileIo designed as FsApi wrapper
- Task 3: Ring0FsFileIo implementation added
- Task 4: Fail-Fast integration verified
- Task 5: Documentation integration complete

Key Changes:
1. New File: src/providers/ring1/file/ring0_fs_fileio.rs
   - Ring0.FsApi-based FileIo implementation
   - Stateful wrapper (open/read/close)
   - UTF-8 handling via read_to_string()
   - One-file-at-a-time semantics (tested)

2. provider_lock.rs:
   - Added init_default_filebox_provider()
   - Auto-registration helper for Ring0FsFileIo

3. plugin_host.rs:
   - with_core_from_registry_optional() auto-registers default provider
   - Plugin priority maintained (debug logging)
   - Phase 106 MissingService check still active (Fail-Fast preserved)

4. Documentation:
   - phase107_fsapi_fileio_bridge.md: Complete design doc
   - phase106_filebox_design_revised.md: Phase 107 integration notes
   - core_boxes_design.md: Layer diagram and principles

Design Decisions:
- UTF-8 handling: read_to_string() for text-focused use cases
- One file at a time: open() returns Err if already open
- Plugin priority: init_default_filebox_provider() fails gracefully

Test Results:
- cargo build --release: SUCCESS
- plugin_host tests: 11 passed
- ring0_fs_fileio tests: 4 passed

Next Steps (Phase 108+):
- minimal/no-fs profile support
- write operations
- multi-file handle support
This commit is contained in:
nyash-codex
2025-12-03 18:16:49 +09:00
parent 38db674101
commit 0fd4962e4c
9 changed files with 375 additions and 102 deletions

View File

@ -2,6 +2,22 @@
//!
//! This module defines the unified File I/O abstraction used by both the
//! core readonly implementation and the plugin implementation.
//!
//! # Phase 107: Ring0.FsApi 統合
//!
//! **FileIo = 現在開いているファイルハンドルに対する操作stateful**
//! - open() でファイルを開く
//! - read() で内容を読み込む
//! - close() でファイルを閉じる
//!
//! **FsApi = stateless な OS ファイル I/O 抽象Ring0**
//! - Path → 直接 read/write
//! - FileIo 実装は内部で FsApi を使用する
//!
//! **設計原則**:
//! - FileIo は「現在開いているファイル」の状態を管理
//! - FsApi は「パス → データ」の変換のみ担当
//! - 実装例: Ring0FsFileIo が FsApi を内部で使用
/// File capabilities (minimal flag set)
#[derive(Debug, Clone, Copy)]