Skip to content

Make Codex and Claude Code subscriptions go further: a local model router that gives routine agent work to economical models and keeps your strongest model for the hard parts.

835 B
Raw Blame
use super::ClientContext;
use crate::confirmation::CONFIRMATION_TTL;
pub use crate::web_confirmation::*;
pub(super) async fn request_web_confirmation(
    window: &ClientContext<'_>,
    prompt: WebConfirmationPrompt,
) -> bool {
    let state = window.confirmations;
    let Ok((request, receive)) = state.begin(window.label(), prompt) else {
        return false;
    };
    let _pending = state.pending_guard(window.label(), &request);
    let id = request.confirmation_id.clone();
    if window
        .notify
        .is_some_and(|notify| notify(&request).is_err())
    {
        state.cancel(window.label(), &id);
    }
    let decision = tokio::time::timeout(CONFIRMATION_TTL, receive).await;
    if decision.is_err() {
        state.cancel(window.label(), &id);
    }
    decision.ok().and_then(Result::ok).unwrap_or(false)
}