dirge-agent 0.12.6

Minimalistic coding agent written in Rust, optimized for memory footprint and performance
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! /btw handler.

use crate::ui::slash::{SlashCtx, c_error};

pub(crate) async fn cmd_btw(ctx: &mut SlashCtx<'_>, parts: &[&str]) -> anyhow::Result<()> {
    let query = parts.get(1..).map(|p| p.join(" ")).unwrap_or_default();
    if query.is_empty() {
        ctx.renderer
            .write_line("usage: /btw <question>", c_error())?;
        return Ok(());
    }
    // dirge-nret: don't run the completion inline (it froze the loop for the
    // whole call). Defer to the loop, which resolves the model on-thread and
    // spawns the query as a task the `btw_phase` arm renders; the UI stays
    // responsive and Ctrl+C aborts. The loop parses the `DEFER_BTW:` prefix.
    Err(anyhow::anyhow!("DEFER_BTW:{}", query))
}