fix(cli): forward --yolo to TUI binary via DEEPSEEK_YOLO env
The CLI dispatcher accepted --yolo but only passed it to Exec(TuiPassthroughArgs), not to the plain Run(RunArgs) path used for interactive sessions. Fix: pass DEEPSEEK_YOLO=true env var to the TUI binary. The TUI already reads this env var (matching DEEPSEEK_SANDBOX_MODE pattern) and sets allow_shell + start_in_agent_mode + yolo. Also adds yolo field to CliRuntimeOverrides and ResolvedRuntimeOptions so the flag propagates through the full resolve chain.
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
# DEEPSEEK_APPROVAL_POLICY=on-request
|
# DEEPSEEK_APPROVAL_POLICY=on-request
|
||||||
# DEEPSEEK_SANDBOX_MODE=workspace-write
|
# DEEPSEEK_SANDBOX_MODE=workspace-write
|
||||||
# DEEPSEEK_ALLOW_SHELL=true
|
# DEEPSEEK_ALLOW_SHELL=true
|
||||||
|
# DEEPSEEK_YOLO=true
|
||||||
|
|
||||||
# Optional extension paths
|
# Optional extension paths
|
||||||
# DEEPSEEK_SKILLS_DIR=~/.deepseek/skills
|
# DEEPSEEK_SKILLS_DIR=~/.deepseek/skills
|
||||||
|
|||||||
@@ -92,6 +92,9 @@ struct Cli {
|
|||||||
no_mouse_capture: bool,
|
no_mouse_capture: bool,
|
||||||
#[arg(long = "skip-onboarding")]
|
#[arg(long = "skip-onboarding")]
|
||||||
skip_onboarding: bool,
|
skip_onboarding: bool,
|
||||||
|
/// YOLO mode: auto-approve all tools
|
||||||
|
#[arg(long)]
|
||||||
|
yolo: bool,
|
||||||
#[arg(short = 'p', long = "prompt", value_name = "PROMPT")]
|
#[arg(short = 'p', long = "prompt", value_name = "PROMPT")]
|
||||||
prompt_flag: Option<String>,
|
prompt_flag: Option<String>,
|
||||||
#[arg(
|
#[arg(
|
||||||
@@ -425,6 +428,7 @@ fn run() -> Result<()> {
|
|||||||
telemetry: cli.telemetry,
|
telemetry: cli.telemetry,
|
||||||
approval_policy: cli.approval_policy.clone(),
|
approval_policy: cli.approval_policy.clone(),
|
||||||
sandbox_mode: cli.sandbox_mode.clone(),
|
sandbox_mode: cli.sandbox_mode.clone(),
|
||||||
|
yolo: Some(cli.yolo),
|
||||||
};
|
};
|
||||||
let command = cli.command.take();
|
let command = cli.command.take();
|
||||||
|
|
||||||
@@ -1441,6 +1445,9 @@ fn build_tui_command(
|
|||||||
if let Some(mode) = cli.sandbox_mode.as_ref() {
|
if let Some(mode) = cli.sandbox_mode.as_ref() {
|
||||||
cmd.env("DEEPSEEK_SANDBOX_MODE", mode);
|
cmd.env("DEEPSEEK_SANDBOX_MODE", mode);
|
||||||
}
|
}
|
||||||
|
if cli.yolo {
|
||||||
|
cmd.env("DEEPSEEK_YOLO", "true");
|
||||||
|
}
|
||||||
if let Some(api_key) = cli.api_key.as_ref() {
|
if let Some(api_key) = cli.api_key.as_ref() {
|
||||||
cmd.env("DEEPSEEK_API_KEY", api_key);
|
cmd.env("DEEPSEEK_API_KEY", api_key);
|
||||||
if resolved_runtime.provider == ProviderKind::Openai {
|
if resolved_runtime.provider == ProviderKind::Openai {
|
||||||
|
|||||||
@@ -962,6 +962,9 @@ impl ConfigToml {
|
|||||||
.clone()
|
.clone()
|
||||||
.or_else(|| env.sandbox_mode.clone())
|
.or_else(|| env.sandbox_mode.clone())
|
||||||
.or_else(|| self.sandbox_mode.clone());
|
.or_else(|| self.sandbox_mode.clone());
|
||||||
|
let yolo = cli
|
||||||
|
.yolo
|
||||||
|
.or(env.yolo);
|
||||||
|
|
||||||
ResolvedRuntimeOptions {
|
ResolvedRuntimeOptions {
|
||||||
provider,
|
provider,
|
||||||
@@ -975,6 +978,7 @@ impl ConfigToml {
|
|||||||
telemetry,
|
telemetry,
|
||||||
approval_policy,
|
approval_policy,
|
||||||
sandbox_mode,
|
sandbox_mode,
|
||||||
|
yolo,
|
||||||
http_headers,
|
http_headers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1111,6 +1115,7 @@ pub struct CliRuntimeOverrides {
|
|||||||
pub telemetry: Option<bool>,
|
pub telemetry: Option<bool>,
|
||||||
pub approval_policy: Option<String>,
|
pub approval_policy: Option<String>,
|
||||||
pub sandbox_mode: Option<String>,
|
pub sandbox_mode: Option<String>,
|
||||||
|
pub yolo: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
@@ -1146,6 +1151,7 @@ pub struct ResolvedRuntimeOptions {
|
|||||||
pub telemetry: bool,
|
pub telemetry: bool,
|
||||||
pub approval_policy: Option<String>,
|
pub approval_policy: Option<String>,
|
||||||
pub sandbox_mode: Option<String>,
|
pub sandbox_mode: Option<String>,
|
||||||
|
pub yolo: Option<bool>,
|
||||||
pub http_headers: BTreeMap<String, String>,
|
pub http_headers: BTreeMap<String, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1361,6 +1367,7 @@ struct EnvRuntimeOverrides {
|
|||||||
telemetry: Option<bool>,
|
telemetry: Option<bool>,
|
||||||
approval_policy: Option<String>,
|
approval_policy: Option<String>,
|
||||||
sandbox_mode: Option<String>,
|
sandbox_mode: Option<String>,
|
||||||
|
yolo: Option<bool>,
|
||||||
http_headers: Option<BTreeMap<String, String>>,
|
http_headers: Option<BTreeMap<String, String>>,
|
||||||
deepseek_base_url: Option<String>,
|
deepseek_base_url: Option<String>,
|
||||||
nvidia_base_url: Option<String>,
|
nvidia_base_url: Option<String>,
|
||||||
@@ -1388,6 +1395,9 @@ impl EnvRuntimeOverrides {
|
|||||||
.and_then(|v| parse_bool(&v).ok()),
|
.and_then(|v| parse_bool(&v).ok()),
|
||||||
approval_policy: std::env::var("DEEPSEEK_APPROVAL_POLICY").ok(),
|
approval_policy: std::env::var("DEEPSEEK_APPROVAL_POLICY").ok(),
|
||||||
sandbox_mode: std::env::var("DEEPSEEK_SANDBOX_MODE").ok(),
|
sandbox_mode: std::env::var("DEEPSEEK_SANDBOX_MODE").ok(),
|
||||||
|
yolo: std::env::var("DEEPSEEK_YOLO")
|
||||||
|
.ok()
|
||||||
|
.and_then(|v| parse_bool(&v).ok()),
|
||||||
http_headers: std::env::var("DEEPSEEK_HTTP_HEADERS")
|
http_headers: std::env::var("DEEPSEEK_HTTP_HEADERS")
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|value| parse_http_headers(&value).ok())
|
.and_then(|value| parse_http_headers(&value).ok())
|
||||||
|
|||||||
@@ -770,6 +770,7 @@ pub struct Config {
|
|||||||
pub allow_shell: Option<bool>,
|
pub allow_shell: Option<bool>,
|
||||||
pub approval_policy: Option<String>,
|
pub approval_policy: Option<String>,
|
||||||
pub sandbox_mode: Option<String>,
|
pub sandbox_mode: Option<String>,
|
||||||
|
pub yolo: Option<bool>,
|
||||||
/// External sandbox backend: `"none"` or `"opensandbox"`.
|
/// External sandbox backend: `"none"` or `"opensandbox"`.
|
||||||
/// When set, exec_shell routes commands through the backend's HTTP API
|
/// When set, exec_shell routes commands through the backend's HTTP API
|
||||||
/// instead of spawning a local process.
|
/// instead of spawning a local process.
|
||||||
@@ -2163,6 +2164,9 @@ fn apply_env_overrides(config: &mut Config) {
|
|||||||
if let Ok(value) = std::env::var("DEEPSEEK_SANDBOX_MODE") {
|
if let Ok(value) = std::env::var("DEEPSEEK_SANDBOX_MODE") {
|
||||||
config.sandbox_mode = Some(value);
|
config.sandbox_mode = Some(value);
|
||||||
}
|
}
|
||||||
|
if let Ok(value) = std::env::var("DEEPSEEK_YOLO") {
|
||||||
|
config.yolo = Some(value == "1" || value.eq_ignore_ascii_case("true"));
|
||||||
|
}
|
||||||
if let Ok(value) = std::env::var("DEEPSEEK_SANDBOX_BACKEND") {
|
if let Ok(value) = std::env::var("DEEPSEEK_SANDBOX_BACKEND") {
|
||||||
config.sandbox_backend = Some(value);
|
config.sandbox_backend = Some(value);
|
||||||
}
|
}
|
||||||
@@ -2507,6 +2511,7 @@ fn merge_config(base: Config, override_cfg: Config) -> Config {
|
|||||||
// both — they list `~/global.md` inside the project array.
|
// both — they list `~/global.md` inside the project array.
|
||||||
instructions: override_cfg.instructions.or(base.instructions),
|
instructions: override_cfg.instructions.or(base.instructions),
|
||||||
allow_shell: override_cfg.allow_shell.or(base.allow_shell),
|
allow_shell: override_cfg.allow_shell.or(base.allow_shell),
|
||||||
|
yolo: override_cfg.yolo.or(base.yolo),
|
||||||
approval_policy: override_cfg.approval_policy.or(base.approval_policy),
|
approval_policy: override_cfg.approval_policy.or(base.approval_policy),
|
||||||
sandbox_mode: override_cfg.sandbox_mode.or(base.sandbox_mode),
|
sandbox_mode: override_cfg.sandbox_mode.or(base.sandbox_mode),
|
||||||
sandbox_backend: override_cfg.sandbox_backend.or(base.sandbox_backend),
|
sandbox_backend: override_cfg.sandbox_backend.or(base.sandbox_backend),
|
||||||
|
|||||||
@@ -5517,6 +5517,7 @@ mod setup_helper_tests {
|
|||||||
"RUST_LOG",
|
"RUST_LOG",
|
||||||
"DEEPSEEK_APPROVAL_POLICY",
|
"DEEPSEEK_APPROVAL_POLICY",
|
||||||
"DEEPSEEK_SANDBOX_MODE",
|
"DEEPSEEK_SANDBOX_MODE",
|
||||||
|
"DEEPSEEK_YOLO",
|
||||||
] {
|
] {
|
||||||
assert!(
|
assert!(
|
||||||
keys.contains(required),
|
keys.contains(required),
|
||||||
|
|||||||
Reference in New Issue
Block a user