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:
+22
-2
@@ -238,9 +238,29 @@ async fn main() -> Result<()> {
|
||||
|
||||
if cli.acp_server {
|
||||
ctx.render_mode = RenderMode::Silent;
|
||||
}
|
||||
|
||||
if cli.acp_server {
|
||||
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)?;
|
||||
}
|
||||
|
||||
return acp::run_acp_server(ctx, abort_signal).await;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user