feat(brain): botBrowser tool drives the bot's own Chrome over CDP

open, read, click (label or [n]), type (optionally Enter) and back; page content comes back fenced
as untrusted data; only http(s) addresses; no LLM call. Offered only when the app started the bot
browser (JARVIS_BROWSER_CDP) and the browser feature is on; meanwhile fetchWebPage, which has no
address guard, is not offered. Eval evals/test_bot_browser_tool.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-13 22:18:05 +09:00
parent 55d19364a0
commit 077db5031c
9 changed files with 672 additions and 7 deletions

View File

@@ -16,6 +16,7 @@ pub const FEATURE_TOOLS: &[(&str, &[&str])] = &[
("weather", &["getWeather"]),
("webSearch", &["webSearch", "fetchWebPage"]),
("meals", &["logMeal", "fetchMeals", "deleteMeal"]),
("browser", &["botBrowser"]),
];
/// The built-in tools of the features that are off.
@@ -23,6 +24,7 @@ pub fn disabled_tools(f: &FeatureSettings) -> Vec<&'static str> {
let on = |key: &str| match key {
"weather" => f.weather,
"webSearch" => f.web_search,
"browser" => f.browser,
_ => f.meals,
};
FEATURE_TOOLS.iter().filter(|(k, _)| !on(k)).flat_map(|(_, tools)| tools.iter().copied()).collect()
@@ -103,7 +105,7 @@ mod tests {
let all_on = FeatureSettings { weather: true, web_search: true, meals: true, collect: true, browser: true };
assert!(disabled_tools(&all_on).is_empty());
let off = disabled_tools(&FeatureSettings { weather: false, web_search: true, meals: false, collect: false, browser: false });
assert_eq!(off, vec!["getWeather", "logMeal", "fetchMeals", "deleteMeal"]);
assert_eq!(off, vec!["getWeather", "logMeal", "fetchMeals", "deleteMeal", "botBrowser"]);
}
#[test]