rho-coding-agent 3.11.0

A fast Rust agent harness with a small footprint and opinionated defaults
Documentation
use super::{App, HistoryScroll, InputSubmissionMode};

impl App {
    pub(super) fn is_ui_busy(&self) -> bool {
        self.turn.is_busy()
    }

    /// True during an active provider turn.
    pub(super) fn is_provider_turn_ui(&self) -> bool {
        self.turn.is_provider_turn()
    }

    pub(super) fn busy_status_label(&self) -> &'static str {
        self.turn.session_ui().busy_status_label()
    }

    pub(super) fn begin_provider_turn_ui(&mut self) {
        self.turn_finished_attention = false;
        self.turn.enter_provider_turn();
    }

    pub(super) fn end_busy_ui(&mut self) {
        // Live stream estimates are display-only for the in-flight provider
        // attempt. Drop them when the turn is no longer busy so statusline cost
        // returns to the durable ledger (plus claimed subagent totals).
        self.usage.live_stream.clear();
        self.turn.end_busy();
    }

    /// End-of-turn cleanup for a provider turn that produced a response. Flags
    /// the jump chip when the user is scrolled away; failed, cancelled, and
    /// abandoned turns use [`Self::end_busy_ui`] and stay neutral.
    pub(super) fn end_provider_turn_ui(&mut self) {
        self.end_busy_ui();
        if !matches!(self.history.scroll(), HistoryScroll::Bottom) {
            self.turn_finished_attention = true;
        }
    }

    pub(super) fn preserve_unapplied_steering_as_follow_ups(&mut self) {
        self.pending.preserve_unapplied_steering_as_follow_ups();
        self.pending_input_changed();
        self.select_pending_recall_target();
    }

    /// Puts every pending prompt back in the composer, its text ahead of
    /// what the composer holds and its attachments after the composer's.
    pub(super) fn restore_pending_work_to_input(&mut self) {
        let prompts = self.pending.drain_prompts();
        if prompts.is_empty() {
            return;
        }
        let mut messages = Vec::with_capacity(prompts.len() + 1);
        for prompt in prompts {
            if !prompt.prompt.is_empty() {
                messages.push(prompt.prompt);
            }
            for media in prompt.media {
                self.input_ui.push_ready_attachment(media, None);
            }
        }
        if !self.expanded_input().trim().is_empty() {
            messages.push(self.expanded_input());
        }
        let text = messages.join("\n\n");
        let cursor = text.chars().count();
        self.input_ui.set_text_and_cursor(text, cursor);
        self.input_ui.clear_paste_segments();
        self.input_ui.set_shell_mode(None);
        self.input_ui
            .set_submission_mode(InputSubmissionMode::ParseCommands);
        self.reset_input_history_navigation();
        self.input_changed();
        self.pending_input_changed();
    }

    pub(super) fn clear_transient_key_state(&mut self) {
        self.input_ui.clear_transient_edit_state();
        self.ctrl_c_streak = 0;
    }
}

#[cfg(test)]
#[path = "run_lifecycle_tests.rs"]
mod tests;