Skip to main content

run

Function run 

Source
pub async fn run(
    model: &ModelConfig,
    mode: Mode,
    stream_stdout: bool,
    system: &str,
    user: &str,
    cwd: &Path,
    verbose: bool,
    color: Style,
    usage: &mut Usage,
    turn_timeout: Duration,
    interrupted: Arc<AtomicBool>,
) -> Result<String>
Expand description

Run one prompt through the configured subprocess backend in cwd, returning the CLI’s final text. In Mode::Edit this is the round’s change summary (the CLI edits cwd directly); in Mode::Plan it is the plan handed to the coder. When stream_stdout is set the assistant’s text and reasoning are streamed to stdout as the CLI emits them (chunk-level, mirroring the openai backend). Token usage reported by the CLI is summed into usage (reliably for claude; opencode/codex only when they emit it).