feat: add editing and MCP command handling, enhance SSE streaming with usage tracking

- Implemented `Edit` and `McpAdd` commands in the command parser and handler.
- Added a new `stream` module to the runtime for handling streaming events.
- Enhanced `SseParser` to parse usage information from SSE events.
- Introduced `ToolCallAccumulator` for tracking tool calls independently.
- Updated `AppStateRest` to include `app_config` and `MiscState` to track `effort_level` and `selected_index`.
- Modified `LlmClient` to support streaming responses with usage tracking.
- Improved error handling and retry logic in the streaming API calls.
- Added tests for new features and improved markdown rendering in the chat view.
This commit is contained in:
asepharyana
2026-07-12 01:25:52 +07:00
parent fcef85a327
commit 18a41aad48
28 changed files with 838 additions and 98 deletions
+4 -7
View File
@@ -1,4 +1,5 @@
pub mod chat;
pub mod markdown;
pub mod status;
pub mod theme;
pub mod workflow;
@@ -148,7 +149,7 @@ fn render_overlay(frame: &mut Frame, area: Rect, overlay: crate::app::state::typ
Style::default(),
)),
Line::from(Span::styled(
"Press Ctrl+Q again to confirm, Esc to cancel.",
"Press Enter to confirm, Esc to cancel.",
Style::default().fg(Theme::DIM),
)),
];
@@ -254,12 +255,8 @@ fn render_overlay(frame: &mut Frame, area: Rect, overlay: crate::app::state::typ
}
crate::app::state::types::Overlay::Effort => {
let block = block.title(" Effort Level ");
let levels = ["low", "medium", "high", "xhigh", "max"];
let current_idx = if state.settings.temperature > 0.8 { 0usize }
else if state.settings.temperature > 0.5 { 1 }
else if state.settings.temperature > 0.3 { 2 }
else if state.settings.max_tokens > 4000 { 3 }
else { 4 };
let levels = crate::app::mode::effort::EFFORT_LEVELS;
let current_idx = crate::app::mode::effort::current_effort(state);
let mut lines: Vec<Line> = levels.iter().enumerate().map(|(i, l)| {
let selected = i == current_idx;
Line::from(Span::styled(