feat(browser): cross-platform node_path config for npx resolution

Adds [browser].node_path config option so camoufox-browser can use
an explicit npx path (essential for nvm/fnm/asdf users).

Resolution order (cross-platform):
1. config.browser.node_path — explicit user override
2. 'npx.cmd' on Windows, 'npx' on Linux/macOS — PATH lookup

Changes:
- BrowserSection config: added node_path: Option<String>
- AgentConfig: now carries browser section (was dropped in From<GyandootConfig>)
- browser_manager::init_browser(node_path): accepts optional path
- All call sites updated (run(), init_session(), subagents, tests)
- Error messages now hint at browser.node_path config
This commit is contained in:
2026-06-12 16:08:37 +05:30
parent 3030f6eadf
commit 697c2c63b2
4 changed files with 57 additions and 18 deletions

View File

@@ -230,6 +230,12 @@ pub struct BrowserSection {
/// Camofox URL for browser automation.
#[serde(default)]
pub camofox_url: Option<String>,
/// Explicit path to the npx (or npx.cmd on Windows) executable.
/// When set, `init_browser()` uses this instead of bare `"npx"`.
/// Useful when nvm / fnm / asdf manages Node — e.g.
/// `/home/user/.nvm/versions/node/v22/bin/npx`.
#[serde(default)]
pub node_path: Option<String>,
}
impl Default for BrowserSection {
@@ -237,6 +243,7 @@ impl Default for BrowserSection {
Self {
enabled: false,
camofox_url: None,
node_path: None,
}
}
}
@@ -292,6 +299,7 @@ pub struct AgentConfig {
pub kanban: KanbanRootConfig,
pub skills: SkillsRootConfig,
pub identity: IdentitySection,
pub browser: BrowserSection,
}
impl Default for AgentConfig {
@@ -309,6 +317,7 @@ impl Default for AgentConfig {
kanban: KanbanRootConfig::default(),
skills: SkillsRootConfig::default(),
identity: IdentitySection::default(),
browser: BrowserSection::default(),
}
}
}
@@ -348,6 +357,7 @@ impl From<GyandootConfig> for AgentConfig {
kanban: KanbanRootConfig::default(),
skills: SkillsRootConfig::default(),
identity: cfg.identity,
browser: cfg.browser,
}
}
}