| 1 | //! MCP UI action helpers: where `/mcp` lands and how MCP receipts reach |
| 2 | //! the transcript. |
| 3 | |
| 4 | use crate::tui::app::App; |
| 5 | use crate::tui::history::HistoryCell; |
| 6 | |
| 7 | /// `/mcp` and every MCP action land on Extensions → MCP, the one MCP |
| 8 | /// surface, rebuilt from the snapshot just stored on `app`. A pager full of |
| 9 | /// text was the 0.9.12 "terrible menu" (defects #17–#20). An Extensions view |
| 10 | /// already on top is replaced so it reads the fresh snapshot. |
| 11 | pub(super) fn open_mcp_extensions(app: &mut App) { |
| 12 | use crate::tui::views::{ |
| 13 | ModalKind, |
| 14 | extensions::{ExtensionsTab, ExtensionsView}, |
| 15 | }; |
| 16 | if app.view_stack.top_kind() == Some(ModalKind::Extensions) { |
| 17 | app.view_stack.pop(); |
| 18 | } |
| 19 | app.view_stack |
| 20 | .push(ExtensionsView::new(app, ExtensionsTab::Mcp)); |
| 21 | app.needs_redraw = true; |
| 22 | } |
| 23 | |
| 24 | pub(super) fn add_mcp_message(app: &mut App, content: String) { |
| 25 | app.add_message(HistoryCell::System { content }); |
| 26 | } |
| 27 |