Files
zesdex/src/view/workflow.rs
T
asepharyana 802d9677ae feat: Enhance OAuth module and OpenRouter client functionality
- Updated OAuth module to include unused imports for better clarity.
- Refactored OpenRouterClient to improve chat functionality and added support for tools in chat requests.
- Modified internet tools (Download, Fetch, Search) to use a more flexible internet mode check.
- Introduced new Bash tools for managing background jobs (BashOutput, BashKill).
- Enhanced workflow tool to parse and execute workflow scripts with arguments.
- Updated status and workflow views to reflect new agent and findings counts.
- Added IPC protocol definitions for client requests and state payloads.
2026-07-11 20:21:59 +07:00

90 lines
3.0 KiB
Rust

use ratatui::layout::Rect;
use ratatui::style::{Style, Modifier};
use ratatui::text::{Line, Span};
use ratatui::widgets::{Block, Borders, List, ListItem};
use ratatui::Frame;
use super::theme::Theme;
pub fn draw_workflow_panel(frame: &mut Frame, area: Rect, state: &crate::app::state::rest::AppStateRest) {
let block = Block::default()
.borders(Borders::ALL)
.border_style(Style::default().fg(Theme::BORDER))
.title(" Workflow ");
let session_runtime = match &state.session_runtime {
Some(r) => r,
None => {
let empty = Block::default().borders(Borders::ALL).title(" Workflow ");
let paragraph = ratatui::widgets::Paragraph::new(Line::from(Span::raw("No active session")))
.block(empty);
frame.render_widget(paragraph, area);
return;
}
};
let tool_count = session_runtime.tool_call_results.len();
let pending_count = session_runtime.pending_tool_queue.len();
let bash_count = session_runtime.bash_jobs.len();
let agent_count = state.workflow_engine.agents.len();
let findings_count = state.workflow_engine.findings.len();
let mut items = Vec::new();
items.push(ListItem::new(Line::from(Span::styled(
format!(" Messages: {}", session_runtime.messages.len()),
Style::default().fg(Theme::TEXT),
))));
items.push(ListItem::new(Line::from(Span::styled(
format!(" Tool calls completed: {}", tool_count),
Style::default().fg(Theme::SUCCESS),
))));
if pending_count > 0 {
items.push(ListItem::new(Line::from(Span::styled(
format!(" Pending tool queue: {}", pending_count),
Style::default().fg(Theme::WARNING),
))));
}
if bash_count > 0 {
items.push(ListItem::new(Line::from(Span::styled(
format!(" Active bash jobs: {}", bash_count),
Style::default().fg(Theme::WARNING),
))));
}
if agent_count > 0 {
items.push(ListItem::new(Line::from(Span::styled(
format!(" Agents: {}", agent_count),
Style::default().fg(Theme::INFO),
))));
}
if findings_count > 0 {
items.push(ListItem::new(Line::from(Span::styled(
format!(" Findings: {}", findings_count),
Style::default().fg(Theme::WARNING),
))));
}
let phase_status = match state.mode {
crate::app::state::types::AgentMode::Auto => "Auto-running",
crate::app::state::types::AgentMode::Normal => "Awaiting input",
crate::app::state::types::AgentMode::Plan => "Planning",
crate::app::state::types::AgentMode::Yolo => "Full autonomy",
};
items.push(ListItem::new(Line::from(Span::styled(
format!(" Phase: {}", phase_status),
Style::default().fg(Theme::PRIMARY),
))));
let list = List::new(items)
.block(block)
.highlight_style(Style::default().add_modifier(Modifier::BOLD));
frame.render_widget(list, area);
}