feat: Pos処理の非同期化・Busy状態の削除

This commit is contained in:
2026-05-04 15:52:27 +09:00
parent 5b38aa6a87
commit 954cf200e2
15 changed files with 537 additions and 256 deletions
+2 -11
View File
@@ -49,9 +49,6 @@ pub struct App {
pub running: bool,
/// True while the Pod is in `PodStatus::Paused`.
pub paused: bool,
/// True after worker `RunEnd` while controller post-run work is still
/// blocking the next method.
pub busy: bool,
pub run_requests: usize,
/// Sum of `input_tokens - cache_read_input_tokens` across the
/// current turn's LLM requests — i.e. the net tokens this turn
@@ -89,7 +86,6 @@ impl App {
pod_status: PodStatus::Idle,
running: false,
paused: false,
busy: false,
run_requests: 0,
run_upload_tokens: 0,
run_output_tokens: 0,
@@ -111,8 +107,7 @@ impl App {
self.pod_status = status;
self.running = status == PodStatus::Running;
self.paused = status == PodStatus::Paused;
self.busy = status == PodStatus::Busy;
if self.running || self.busy {
if self.running {
self.quit_confirm = None;
}
}
@@ -296,10 +291,6 @@ impl App {
}
pub fn submit_input(&mut self) -> Option<Method> {
if self.busy {
self.push_error("Pod is finishing post-run work; wait for idle before submitting.");
return None;
}
let segments = self.input.submit_segments();
if segments_are_blank(&segments) {
// Empty Enter only does something meaningful when the Pod
@@ -640,7 +631,7 @@ impl App {
});
self.set_pod_status(match result {
RunResult::Paused => PodStatus::Paused,
RunResult::Finished | RunResult::LimitReached => PodStatus::Busy,
RunResult::Finished | RunResult::LimitReached => PodStatus::Idle,
});
self.run_requests = 0;
self.run_upload_tokens = 0;
+1 -5
View File
@@ -435,10 +435,6 @@ fn handle_key(app: &mut App, key: KeyEvent) -> Option<Method> {
KeyCode::Char('x') if ctrl => Some(match app.pod_status {
PodStatus::Running => Some(Method::Cancel),
PodStatus::Paused | PodStatus::Idle => Some(Method::Shutdown),
PodStatus::Busy => {
app.push_error("Pod is finishing post-run work; wait for idle or press Ctrl-C twice to exit the TUI.");
None
}
}),
KeyCode::Char('d') if ctrl => {
app.quit = true;
@@ -577,7 +573,7 @@ fn handle_key(app: &mut App, key: KeyEvent) -> Option<Method> {
const CONFIRM_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(3);
/// Running → send `Method::Pause`.
/// Idle / Paused / Busy → 2-tap to quit the TUI (the Pod keeps running).
/// Idle / Paused → 2-tap to quit the TUI (the Pod keeps running).
fn handle_pause_or_quit(app: &mut App) -> Option<Method> {
if app.pod_status == PodStatus::Running {
return Some(Method::Pause);
-12
View File
@@ -877,18 +877,6 @@ fn draw_status(frame: &mut Frame, app: &App, area: Rect) {
" — Enter to resume, type to start new turn",
Style::default().fg(Color::DarkGray),
));
} else if app.busy {
spans.push(Span::raw(" | "));
spans.push(Span::styled(
"busy",
Style::default()
.fg(Color::Yellow)
.add_modifier(Modifier::BOLD),
));
spans.push(Span::styled(
" — finishing post-run work",
Style::default().fg(Color::DarkGray),
));
} else {
spans.push(Span::styled(" idle", Style::default().fg(Color::DarkGray)));
}