feat(tui): implement agent turn engine for background processing and enhance input handling

This commit is contained in:
asepharyana
2026-07-20 10:55:09 +07:00
parent da2ed6da25
commit 792695b65a
31 changed files with 603 additions and 153 deletions
+33 -2
View File
@@ -100,7 +100,7 @@ pub enum Overlay {
Effort,
/// MCP server management panel.
Mcp,
/// TODO list overlay.
/// Task list overlay.
Todo,
/// Session rewind / history scrubber.
Rewind,
@@ -311,6 +311,8 @@ pub struct MiscState {
pub lesson_running: bool,
/// Text waiting to be written to the system clipboard.
pub pending_clipboard_copy: Option<String>,
/// Inline editor state, if the editor overlay is active.
pub editor: Option<EditorState>,
}
impl MiscState {
@@ -327,6 +329,7 @@ impl MiscState {
todo_content: String::new(),
lesson_running: false,
pending_clipboard_copy: None,
editor: None,
}
}
@@ -362,7 +365,7 @@ pub struct AgentState {
pub current_tool: String,
}
/// Minimal workflow-engine placeholder for hive-mind orchestration state.
/// Workflow engine state tracking agents in hive-mind orchestration.
#[derive(Debug, Clone, Default)]
pub struct WorkflowEngine {
/// List of running workflow agent states.
@@ -378,6 +381,34 @@ impl WorkflowEngine {
}
}
/// Simple inline editor state for the TUI.
#[derive(Debug, Clone)]
pub struct EditorState {
/// Path to the file being edited.
pub path: PathBuf,
/// Current buffer content.
pub content: String,
/// Cursor position (byte offset).
pub cursor: usize,
}
impl EditorState {
/// Create a new editor state for the given path.
pub fn new(path: PathBuf, content: String) -> Self {
let cursor = content.len();
EditorState {
path,
content,
cursor,
}
}
/// Return the full buffer content.
pub fn as_string(&self) -> String {
self.content.clone()
}
}
// ---------------------------------------------------------------------------
// AppStateRest — single source-of-truth application state
// ---------------------------------------------------------------------------