runner: add NyVM wrapper core_bridge (canonicalize/dump) + opt-in wrapper canary; export module in common_util
This commit is contained in:
23
src/runner/modes/common_util/core_bridge.rs
Normal file
23
src/runner/modes/common_util/core_bridge.rs
Normal file
@ -0,0 +1,23 @@
|
||||
/*!
|
||||
* core_bridge.rs — NyVM wrapper bridge helpers
|
||||
*
|
||||
* Provides a minimal JSON canonicalizer for NyVmDispatcher wrapper path.
|
||||
* Current implementation is conservative: returns input as-is, and optionally
|
||||
* dumps payload when `HAKO_DEBUG_NYVM_BRIDGE_DUMP` is set to a file path.
|
||||
*/
|
||||
|
||||
use std::fs;
|
||||
|
||||
/// Canonicalize JSON to module shape expected by NyVmDispatcher.
|
||||
/// For now, this is a passthrough with optional debug dump.
|
||||
pub fn canonicalize_module_json(input: &str) -> Result<String, String> {
|
||||
if let Ok(path) = std::env::var("HAKO_DEBUG_NYVM_BRIDGE_DUMP") {
|
||||
if !path.trim().is_empty() {
|
||||
if let Err(e) = fs::write(&path, input.as_bytes()) {
|
||||
eprintln!("[bridge/dump] write error: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(input.to_string())
|
||||
}
|
||||
|
||||
@ -10,3 +10,4 @@ pub mod io;
|
||||
pub mod selfhost;
|
||||
pub mod resolve;
|
||||
pub mod exec;
|
||||
pub mod core_bridge;
|
||||
|
||||
Reference in New Issue
Block a user