@@ -870,6 +870,9 @@ pub struct BrowserConfig {
870870 pub executable_path : Option < String > ,
871871 /// Directory for storing screenshots and other browser artifacts.
872872 pub screenshot_dir : Option < PathBuf > ,
873+ /// Directory for caching a fetcher-downloaded Chromium binary.
874+ /// Populated from `{instance_dir}/chrome_cache` during config resolution.
875+ pub chrome_cache_dir : PathBuf ,
873876}
874877
875878impl Default for BrowserConfig {
@@ -880,6 +883,7 @@ impl Default for BrowserConfig {
880883 evaluate_enabled : false ,
881884 executable_path : None ,
882885 screenshot_dir : None ,
886+ chrome_cache_dir : PathBuf :: from ( "chrome_cache" ) ,
883887 }
884888 }
885889}
@@ -4121,10 +4125,13 @@ impl Config {
41214125 let mut api = ApiConfig :: default ( ) ;
41224126 api. bind = hosted_api_bind ( api. bind ) ;
41234127
4128+ let mut defaults = DefaultsConfig :: default ( ) ;
4129+ defaults. browser . chrome_cache_dir = instance_dir. join ( "chrome_cache" ) ;
4130+
41244131 Ok ( Self {
41254132 instance_dir : instance_dir. to_path_buf ( ) ,
41264133 llm,
4127- defaults : DefaultsConfig :: default ( ) ,
4134+ defaults,
41284135 agents,
41294136 links : Vec :: new ( ) ,
41304137 groups : Vec :: new ( ) ,
@@ -4729,23 +4736,31 @@ impl Config {
47294736 . unwrap_or ( base_defaults. warmup . startup_delay_secs ) ,
47304737 } )
47314738 . unwrap_or ( base_defaults. warmup ) ,
4732- browser : toml
4733- . defaults
4734- . browser
4735- . map ( |b| {
4736- let base = & base_defaults. browser ;
4737- BrowserConfig {
4738- enabled : b. enabled . unwrap_or ( base. enabled ) ,
4739- headless : b. headless . unwrap_or ( base. headless ) ,
4740- evaluate_enabled : b. evaluate_enabled . unwrap_or ( base. evaluate_enabled ) ,
4741- executable_path : b. executable_path . or_else ( || base. executable_path . clone ( ) ) ,
4742- screenshot_dir : b
4743- . screenshot_dir
4744- . map ( PathBuf :: from)
4745- . or_else ( || base. screenshot_dir . clone ( ) ) ,
4746- }
4747- } )
4748- . unwrap_or_else ( || base_defaults. browser . clone ( ) ) ,
4739+ browser : {
4740+ let chrome_cache_dir = instance_dir. join ( "chrome_cache" ) ;
4741+ toml. defaults
4742+ . browser
4743+ . map ( |b| {
4744+ let base = & base_defaults. browser ;
4745+ BrowserConfig {
4746+ enabled : b. enabled . unwrap_or ( base. enabled ) ,
4747+ headless : b. headless . unwrap_or ( base. headless ) ,
4748+ evaluate_enabled : b. evaluate_enabled . unwrap_or ( base. evaluate_enabled ) ,
4749+ executable_path : b
4750+ . executable_path
4751+ . or_else ( || base. executable_path . clone ( ) ) ,
4752+ screenshot_dir : b
4753+ . screenshot_dir
4754+ . map ( PathBuf :: from)
4755+ . or_else ( || base. screenshot_dir . clone ( ) ) ,
4756+ chrome_cache_dir : chrome_cache_dir. clone ( ) ,
4757+ }
4758+ } )
4759+ . unwrap_or_else ( || BrowserConfig {
4760+ chrome_cache_dir,
4761+ ..base_defaults. browser . clone ( )
4762+ } )
4763+ } ,
47494764 mcp : default_mcp,
47504765 brave_search_key : toml
47514766 . defaults
@@ -4935,6 +4950,7 @@ impl Config {
49354950 . screenshot_dir
49364951 . map ( PathBuf :: from)
49374952 . or_else ( || defaults. browser . screenshot_dir . clone ( ) ) ,
4953+ chrome_cache_dir : defaults. browser . chrome_cache_dir . clone ( ) ,
49384954 } ) ,
49394955 mcp : match a. mcp {
49404956 Some ( mcp_servers) => Some (
0 commit comments