@@ -88,6 +88,7 @@ pub struct Config {
|
||||
pub screenshot_format: Option<String>,
|
||||
pub idle_timeout: Option<String>,
|
||||
pub no_auto_dialog: Option<bool>,
|
||||
pub model: Option<String>,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
@@ -134,6 +135,7 @@ impl Config {
|
||||
screenshot_format: other.screenshot_format.or(self.screenshot_format),
|
||||
idle_timeout: other.idle_timeout.or(self.idle_timeout),
|
||||
no_auto_dialog: other.no_auto_dialog.or(self.no_auto_dialog),
|
||||
model: other.model.or(self.model),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -219,6 +221,7 @@ fn extract_config_path(args: &[String]) -> Option<Option<String>> {
|
||||
"--screenshot-quality",
|
||||
"--screenshot-format",
|
||||
"--idle-timeout",
|
||||
"--model",
|
||||
];
|
||||
let mut i = 0;
|
||||
while i < args.len() {
|
||||
@@ -302,6 +305,9 @@ pub struct Flags {
|
||||
pub idle_timeout: Option<String>, // Canonical milliseconds string for AGENT_BROWSER_IDLE_TIMEOUT_MS
|
||||
pub default_timeout: Option<u64>, // AGENT_BROWSER_DEFAULT_TIMEOUT in ms
|
||||
pub no_auto_dialog: bool,
|
||||
pub model: Option<String>,
|
||||
pub verbose: bool,
|
||||
pub quiet: bool,
|
||||
|
||||
// Track which launch-time options were explicitly passed via CLI
|
||||
// (as opposed to being set only via environment variables)
|
||||
@@ -438,6 +444,9 @@ pub fn parse_flags(args: &[String]) -> Flags {
|
||||
.and_then(|s| s.parse::<u64>().ok()),
|
||||
no_auto_dialog: env_var_is_truthy("AGENT_BROWSER_NO_AUTO_DIALOG")
|
||||
|| config.no_auto_dialog.unwrap_or(false),
|
||||
model: env::var("AI_GATEWAY_MODEL").ok().or(config.model),
|
||||
verbose: false,
|
||||
quiet: false,
|
||||
cli_executable_path: false,
|
||||
cli_extensions: false,
|
||||
cli_profile: false,
|
||||
@@ -719,6 +728,18 @@ pub fn parse_flags(args: &[String]) -> Flags {
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
"--model" => {
|
||||
if let Some(s) = args.get(i + 1) {
|
||||
flags.model = Some(s.clone());
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
"-v" | "--verbose" => {
|
||||
flags.verbose = true;
|
||||
}
|
||||
"-q" | "--quiet" => {
|
||||
flags.quiet = true;
|
||||
}
|
||||
"--config" => {
|
||||
// Already handled by load_config(); skip the value
|
||||
i += 1;
|
||||
@@ -746,6 +767,10 @@ pub fn clean_args(args: &[String]) -> Vec<String> {
|
||||
"--content-boundaries",
|
||||
"--confirm-interactive",
|
||||
"--no-auto-dialog",
|
||||
"-v",
|
||||
"--verbose",
|
||||
"-q",
|
||||
"--quiet",
|
||||
];
|
||||
// Global flags that always take a value (need to skip the next arg too)
|
||||
const GLOBAL_FLAGS_WITH_VALUE: &[&str] = &[
|
||||
@@ -776,6 +801,7 @@ pub fn clean_args(args: &[String]) -> Vec<String> {
|
||||
"--screenshot-quality",
|
||||
"--screenshot-format",
|
||||
"--idle-timeout",
|
||||
"--model",
|
||||
];
|
||||
|
||||
let mut i = 0;
|
||||
|
||||
Reference in New Issue
Block a user