feat(runtime): Phase 103 CoreServices Optional化 - Memory Constraints対応
- Add CoreServicesConfig struct (from_env, minimal, all_enabled) - Implement with_core_from_registry_optional() for selective initialization - Update CoreBoxesImpl fields to Option<Arc<dyn XyzService>> - Maintain backward compatibility (with_core_from_registry calls all_enabled) - Add NYASH_CORE_DISABLE_* environment variable support - ConsoleBox remains mandatory (Graceful Degradation principle) - Add unit tests for optional initialization - Update console_println! macro to handle Option type - Fix direct console.println() calls in vm.rs and selfhost.rs - Create core_optional_design.md documentation Note: Phase 104 will extend ConsoleService to be optional as well with graceful fallback in console_println! macro. Files modified: - src/runtime/plugin_host.rs (CoreServicesConfig, with_core_from_registry_optional, tests) - src/runtime/core_services.rs (CoreBoxesImpl fields → Option type) - src/runtime/mod.rs (console_println! macro updated) - src/runner/modes/vm.rs (handle Option console) - src/runner/selfhost.rs (handle Option console) - docs/development/current/main/core_optional_design.md (new) - docs/development/current/main/ring0-inventory.md (Phase 103 entry) Test results: - Build: ✅ Success (0 errors, 7 warnings) - Unit tests: ✅ 3/3 passed (optional_core_tests) - Runtime tests: ✅ 63/63 passed - Smoke tests: ✅ 30/31 passed (1 pre-existing timeout)
This commit is contained in:
@ -587,8 +587,13 @@ impl NyashRunner {
|
||||
// Quiet mode: suppress "RC:" output for JSON-only pipelines
|
||||
if !quiet_pipe {
|
||||
// Phase 98: ConsoleService if available, otherwise eprintln
|
||||
// Phase 103: Handle Option<Arc<dyn ConsoleService>>
|
||||
if let Some(host) = crate::runtime::try_get_core_plugin_host() {
|
||||
host.core.console.println(&format!("RC: {}", exit_code));
|
||||
if let Some(ref console) = host.core.console {
|
||||
console.println(&format!("RC: {}", exit_code));
|
||||
} else {
|
||||
println!("RC: {}", exit_code);
|
||||
}
|
||||
} else {
|
||||
println!("RC: {}", exit_code);
|
||||
}
|
||||
|
||||
@ -49,8 +49,11 @@ impl NyashRunner {
|
||||
match crate::runtime::initialize_runtime(ring0) {
|
||||
Ok(()) => {
|
||||
// Phase 95: ConsoleService 経由でログ出力(代表パス)
|
||||
// Phase 103: Handle Option<Arc<dyn ConsoleService>>
|
||||
let host = crate::runtime::get_core_plugin_host();
|
||||
host.core.console.println("[selfhost] PluginHost initialized successfully");
|
||||
if let Some(ref console) = host.core.console {
|
||||
console.println("[selfhost] PluginHost initialized successfully");
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
// Phase 100: ConsoleService 経由でエラー出力
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
//! Runner tracing helpers (verbose-guarded)
|
||||
|
||||
use crate::runtime::get_global_ring0;
|
||||
|
||||
/// Return whether CLI verbose logging is enabled
|
||||
#[allow(dead_code)]
|
||||
pub fn cli_verbose() -> bool {
|
||||
@ -9,11 +11,13 @@ pub fn cli_verbose() -> bool {
|
||||
#[macro_export]
|
||||
macro_rules! cli_v {
|
||||
($($arg:tt)*) => {{
|
||||
if crate::config::env::cli_verbose() { eprintln!($($arg)*); }
|
||||
if crate::config::env::cli_verbose() {
|
||||
crate::runtime::get_global_ring0().log.debug(&format!($($arg)*));
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
/// Unstructured trace output function used by pipeline helpers
|
||||
pub fn log<S: AsRef<str>>(msg: S) {
|
||||
eprintln!("{}", msg.as_ref());
|
||||
get_global_ring0().log.debug(msg.as_ref());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user