feat: add raw session args/opts for agent passthrough

This commit is contained in:
Nathan Flurry 2026-02-05 11:32:39 -08:00
parent 375d73e4cb
commit 2f26f76d9b
14 changed files with 365 additions and 37 deletions

View file

@ -237,6 +237,10 @@ impl AgentManager {
}
_ => {}
}
// Apply raw CLI args
for arg in &options.raw_args {
command.arg(arg);
}
if options.streaming_input {
command
.arg("--input-format")
@ -268,6 +272,10 @@ impl AgentManager {
if let Some(session_id) = options.session_id.as_deref() {
command.arg("-s").arg(session_id);
}
// Apply raw CLI args
for arg in &options.raw_args {
command.arg(arg);
}
command.arg(&options.prompt);
}
AgentId::Amp => {
@ -583,6 +591,10 @@ impl AgentManager {
}
_ => {}
}
// Apply raw CLI args
for arg in &options.raw_args {
command.arg(arg);
}
if options.streaming_input {
command
.arg("--input-format")
@ -614,6 +626,10 @@ impl AgentManager {
if let Some(session_id) = options.session_id.as_deref() {
command.arg("-s").arg(session_id);
}
// Apply raw CLI args
for arg in &options.raw_args {
command.arg(arg);
}
command.arg(&options.prompt);
}
AgentId::Amp => {
@ -682,6 +698,8 @@ pub struct SpawnOptions {
pub env: HashMap<String, String>,
/// Use stream-json input via stdin (Claude only).
pub streaming_input: bool,
/// Raw CLI arguments to pass to the agent (for CLI-based agents).
pub raw_args: Vec<String>,
}
impl SpawnOptions {
@ -696,6 +714,7 @@ impl SpawnOptions {
working_dir: None,
env: HashMap::new(),
streaming_input: false,
raw_args: Vec::new(),
}
}
}
@ -1054,7 +1073,12 @@ fn spawn_amp(
if let Some(session_id) = options.session_id.as_deref() {
command.arg("--continue").arg(session_id);
}
command.args(&args).arg(&options.prompt);
command.args(&args);
// Apply raw CLI args
for arg in &options.raw_args {
command.arg(arg);
}
command.arg(&options.prompt);
for (key, value) in &options.env {
command.env(key, value);
}
@ -1095,6 +1119,10 @@ fn build_amp_command(path: &Path, working_dir: &Path, options: &SpawnOptions) ->
if flags.dangerously_skip_permissions && options.permission_mode.as_deref() == Some("bypass") {
command.arg("--dangerously-skip-permissions");
}
// Apply raw CLI args
for arg in &options.raw_args {
command.arg(arg);
}
command.arg(&options.prompt);
for (key, value) in &options.env {
command.env(key, value);
@ -1157,6 +1185,10 @@ fn spawn_amp_fallback(
if !args.is_empty() {
command.args(&args);
}
// Apply raw CLI args
for arg in &options.raw_args {
command.arg(arg);
}
command.arg(&options.prompt);
for (key, value) in &options.env {
command.env(key, value);
@ -1175,6 +1207,10 @@ fn spawn_amp_fallback(
if let Some(session_id) = options.session_id.as_deref() {
command.arg("--continue").arg(session_id);
}
// Apply raw CLI args
for arg in &options.raw_args {
command.arg(arg);
}
command.arg(&options.prompt);
for (key, value) in &options.env {
command.env(key, value);