Commit Graph

3 Commits

Author SHA1 Message Date
DaiChaoXiong a9de6fe24e fix(tui): surface concrete run errors instead of a bare error header
StreamEvent::Error is encoded by the agent loop as an assistant message with
stop_reason=error and error_message, but the UI only rendered the header and
the (empty) content, hiding the actual message (e.g. a provider HTTP 400
detail). Now:

- UiBlock::Error renders error_message in red, for both committed and live
  assistant messages
- on job Done, the error is also surfaced into the status bar and a note,
  even when the job itself reported no error (it was encoded as a message)
- regression test: an error message renders its concrete text
2026-08-09 21:48:29 +08:00
DaiChaoXiong 4ffd82b096 feat(tui): animated working indicator with phase detection
- Braille spinner driven by a per-frame counter, shown in both the status
  bar (bottom) and at the bottom of the message area while a job runs
- phase detection (RunState::working_phase): running tool > thinking >
  streaming > generic, so the hint reads e.g. "⠹ shell: cargo test…"
- testable via the injected clock (tests/state_tests.rs)
2026-08-09 21:43:28 +08:00
DaiChaoXiong 676dc1503e feat(tui): add focus-tui terminal UI
- ratatui + crossterm chat UI: streaming assistant text, multi-line input,
  bottom status bar (model / protocol / session id / context usage)
- thinking blocks collapse to a summary with duration + estimated tokens;
  tool calls collapse to a concrete summary (path / command) + duration;
  click or Tab expands the details
- config modal (/config): provider, OpenAI protocol, baseUrl, apiKey, model,
  contextWindow — persisted to ~/.focus/config.json; session list (/sessions)
  on the harness JSONL tree; /new, /compact, /help
- auto-compaction (80% threshold, no confirmation) + dynamic system prompt
  with usage info run in a background job (fake-provider-testable)
- Esc aborts a run (abandons the job thread; bounded by the provider timeout)
- tests: config codec, summaries/durations/wrap/caret, UI state machine with
  an injected clock, job flow with a fake provider, session persistence
2026-08-09 21:35:58 +08:00