magi-code 0.96.1

Repository-aware CLI coding agent for terminal work
Documentation
use super::*;
use crate::config::SettingsScope;
use ratatui::text::Line;

impl MissionControlState {
    pub(crate) fn cached_transcript_lines(&self, width: u16) -> Vec<Line<'static>> {
        crate::tui::transcript_cards::cached_visual_lines_ref(self, width)
            .iter()
            .map(|line| line.line.clone())
            .collect()
    }

    pub(crate) fn selected_activity_display_lines(&self) -> Vec<DisplayLine> {
        let mut lines = self.selected_activity_summary_lines();
        self.ensure_selected_activity_detail_cache();
        let body = self
            .activity_render_cache
            .borrow()
            .selected_detail
            .as_ref()
            .map(|detail| detail.body_lines.clone())
            .unwrap_or_default();
        if !body.is_empty() {
            lines.push(DisplayLine::plain(""));
            lines.extend(body);
        }
        lines
    }

    pub(crate) fn detail_visual_rows(&self, wrap_width: u16) -> usize {
        self.selected_activity_display_lines()
            .iter()
            .map(|line| {
                transcript::ratatui_wrapped_visual_rows(&line.plain_text(), wrap_width.max(1))
            })
            .sum()
    }

    pub(crate) fn visible_nodes(&self) -> Vec<(usize, ActivityId)> {
        self.cached_visible_nodes().clone()
    }

    pub(crate) fn open_skills_modal(&mut self, rows: Vec<SkillToggleRow>, visible: usize) {
        self.open_skills_modal_scoped(rows, visible, SettingsScope::Global, "Global".to_string());
    }
}