Compare commits

...
3 Commits
Author SHA1 Message Date
Dark-Alex-17 d50de7c06a lint: fixed test ordering
CI / All (ubuntu-latest) (push) Failing after 25s
CI / All (macos-latest) (push) Has been cancelled
CI / All (windows-latest) (push) Has been cancelled
2026-07-27 19:52:51 -06:00
Dark-Alex-17 0956f08791 refactor: move ACP server dispatch into run() for shared flag setup
All CLI flag processing (--agent, --role, --rag, --model, --no-memory,
--no-stream, --no-workspace-instructions, etc.) now runs through run()
before the REPL/cmd split. The ACP server is dispatched right before
match is_repl, after apply_prelude and skills loading, so it benefits
from the complete context setup with no duplication or drift risk.
2026-07-27 19:44:11 -06:00
Dark-Alex-17 087d0c320c 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.
2026-07-27 19:31:45 -06:00
2 changed files with 28 additions and 31 deletions
+23 -23
View File
@@ -305,6 +305,29 @@ async fn handle_escalated(ctx: &RequestContext, action: &str, args: &Value) -> R
} }
} }
fn parse_options(args: &Value) -> Result<Vec<String>> {
let raw = args
.get("options")
.ok_or_else(|| anyhow!("'options' is required and must be an array of strings"))?;
let arr: Vec<Value> = match raw {
Value::Array(arr) => arr.clone(),
Value::String(s) => serde_json::from_str::<Vec<Value>>(s).map_err(|_| {
anyhow!(
"'options' was a string but did not parse as a JSON array. \
Pass options as a native JSON array, e.g. [\"yes\", \"no\"]."
)
})?,
_ => bail!("'options' is required and must be an array of strings"),
};
Ok(arr
.iter()
.filter_map(Value::as_str)
.map(String::from)
.collect())
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
@@ -329,26 +352,3 @@ mod tests {
assert_eq!(v["options"], json!([])); assert_eq!(v["options"], json!([]));
} }
} }
fn parse_options(args: &Value) -> Result<Vec<String>> {
let raw = args
.get("options")
.ok_or_else(|| anyhow!("'options' is required and must be an array of strings"))?;
let arr: Vec<Value> = match raw {
Value::Array(arr) => arr.clone(),
Value::String(s) => serde_json::from_str::<Vec<Value>>(s).map_err(|_| {
anyhow!(
"'options' was a string but did not parse as a JSON array. \
Pass options as a native JSON array, e.g. [\"yes\", \"no\"]."
)
})?,
_ => bail!("'options' is required and must be an array of strings"),
};
Ok(arr
.iter()
.filter_map(Value::as_str)
.map(String::from)
.collect())
}
+5 -8
View File
@@ -236,14 +236,6 @@ async fn main() -> Result<()> {
} }
} }
if cli.acp_server {
ctx.render_mode = RenderMode::Silent;
}
if cli.acp_server {
return acp::run_acp_server(ctx, abort_signal).await;
}
if let Err(err) = run(ctx, cli, text, abort_signal).await { if let Err(err) = run(ctx, cli, text, abort_signal).await {
render_error(err); render_error(err);
process::exit(1); process::exit(1);
@@ -505,6 +497,11 @@ async fn run(
ctx.load_skill_repl(name, abort_signal.clone()).await?; ctx.load_skill_repl(name, abort_signal.clone()).await?;
} }
if cli.acp_server {
ctx.render_mode = RenderMode::Silent;
return acp::run_acp_server(ctx, abort_signal).await;
}
match is_repl { match is_repl {
false => { false => {
let mut input = create_input(&ctx, text, &cli.file, abort_signal.clone()).await?; let mut input = create_input(&ctx, text, &cli.file, abort_signal.clone()).await?;