feat: apply --agent/--role/--rag/--model flags in --acp-server mode

These CLI flags were previously ignored because the ACP branch returned
before run() could apply them. Now the context is configured with the
requested agent, role, RAG index, and model before the server starts.
Session management remains protocol-driven via session/new and session/load.
This commit is contained in:
2026-07-27 19:31:45 -06:00
parent 2128390f99
commit 087d0c320c
+21 -1
View File
@@ -238,9 +238,29 @@ async fn main() -> Result<()> {
if cli.acp_server {
ctx.render_mode = RenderMode::Silent;
if let Some(agent) = &cli.agent {
if !cli.agent_variable.is_empty() {
ctx.agent_variables = Some(
cli.agent_variable
.chunks(2)
.map(|v| (v[0].to_string(), v[1].to_string()))
.collect(),
);
}
ctx.use_agent(app_config.as_ref(), agent, None, abort_signal.clone())
.await?;
} else if let Some(role) = &cli.role {
ctx.use_role(app_config.as_ref(), role, abort_signal.clone())
.await?;
}
if let Some(rag) = &cli.rag {
ctx.use_rag(Some(rag), abort_signal.clone()).await?;
}
if let Some(model_id) = &cli.model {
ctx.set_model_on_role_like(app_config.as_ref(), model_id)?;
}
if cli.acp_server {
return acp::run_acp_server(ctx, abort_signal).await;
}