feat(setup): auto-detect npx path during installation
The setup wizard now auto-detects the npx/npx.cmd path via `which npx` (Unix) or `where npx.cmd` (Windows) and writes it to [browser].node_path in config.toml. Changes: - detect_npx_path(): cross-platform detection using which/where - SerializedConfig now includes optional [browser] section - Flat config parser (main.rs) handles [browser] section - browser: BrowserSection threaded through AgentConfig everywhere - init_browser() accepts node_path parameter with proper fallback
This commit is contained in:
13
src/main.rs
13
src/main.rs
@@ -293,6 +293,8 @@ fn load_and_convert_config(path: &std::path::Path) -> Result<gyandoot_core::conf
|
||||
struct FlatConfig {
|
||||
provider: FlatProvider,
|
||||
agent: Option<FlatAgent>,
|
||||
#[serde(default)]
|
||||
browser: Option<FlatBrowser>,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
@@ -316,6 +318,12 @@ fn load_and_convert_config(path: &std::path::Path) -> Result<gyandoot_core::conf
|
||||
name: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
struct FlatBrowser {
|
||||
#[serde(default)]
|
||||
node_path: Option<String>,
|
||||
}
|
||||
|
||||
let flat: FlatConfig = toml::from_str(&content)?;
|
||||
tracing::info!("Loaded config from {} (converted from flat [provider] format)", path.display());
|
||||
|
||||
@@ -346,7 +354,10 @@ fn load_and_convert_config(path: &std::path::Path) -> Result<gyandoot_core::conf
|
||||
platform: gyandoot_core::config::PlatformSection::default(),
|
||||
memory: gyandoot_core::config::MemorySection::default(),
|
||||
gateway: gyandoot_core::config::GatewaySection::default(),
|
||||
browser: gyandoot_core::config::BrowserSection::default(),
|
||||
browser: gyandoot_core::config::BrowserSection {
|
||||
node_path: flat.browser.and_then(|b| b.node_path),
|
||||
..gyandoot_core::config::BrowserSection::default()
|
||||
},
|
||||
};
|
||||
|
||||
Ok(gyandoot_core::config::AgentConfig::from(gyandoot_cfg))
|
||||
|
||||
Reference in New Issue
Block a user