soma_codemode/preamble/discovery.rs
1use serde_json::Value;
2
3pub fn generate_discovery_js(entries: &[Value], blend_weight: f32) -> Result<String, String> {
4 let catalog = serde_json::to_string(entries).map_err(|err| err.to_string())?;
5 Ok(format!(
6 "globalThis.__codemodeDiscovery = {catalog};\nglobalThis.__codemodeBlendWeight = {blend_weight};\n"
7 ))
8}