pub async fn run(
agent: Arc<dyn AgentCore>,
cwd: PathBuf,
message: String,
format: OutputFormat,
resume: Option<SessionId>,
track_denied: bool,
goal: Option<Arc<GoalState>>,
) -> Result<ExitCode>Expand description
Runs a single-turn prompt and returns the process exit code.
Only when track_denied = true (the caller wrapped NonInteractivePolicy)
is PolicyDecision::Deny treated as an “unattended gap” that affects the
exit code —— modes like deny-all, where the user knowingly expects
denials, should pass false to avoid spuriously reporting non-zero.
§Errors
Session open failure, stdin read failure, stdout/stderr write failure.
When goal is Some (--goal mode): if the goal is unreached after the
turn ends (turns exhausted without ever calling goal_done), exits with the
Exhausted code —— prevents CI from mistaking “ran out of turns without
reaching the goal” for success.