runner: add NyVM wrapper core_bridge (canonicalize/dump) + opt-in wrapper canary; export module in common_util

This commit is contained in:
nyash-codex
2025-11-01 02:51:49 +09:00
parent 5597b78f0d
commit 978bb4a5c6
25 changed files with 604 additions and 27 deletions

View 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())
}

View File

@ -10,3 +10,4 @@ pub mod io;
pub mod selfhost;
pub mod resolve;
pub mod exec;
pub mod core_bridge;