feat(tui): truthful-state §2 — last-event clock + unknown-event raw fallback

Implements the load-bearing TUI-requirements §2 hard requirements:

- Last-event clock: "last event Ns ago" always visible in the status bar while
  in-session, updating every frame tick. Turns warn-colored when an active session
  has gone quiet past the stale threshold — the "thinking vs hung" tell. The
  WebSocket connection indicator (●/◌/○) already covers immediate drop visibility.
- Unknown-event raw fallback: applyServer now surfaces any unrecognized,
  session-scoped event type as a raw row in the event stream instead of silently
  dropping it (the frontend must not lie by omission). Recognized-but-unrendered
  types (router.response, protocol_error) get an explicit no-op so the default
  branch means genuinely unknown.

Tests: agoLabel formatting, unknown-event surfaces-as-row, known-ignored
no-spurious-row. Preview "session" frame exercises the clock.

Deferred: the full Go↔Kotlin per-event-type render matrix (§2 last bullet) — a
larger fixture effort than the core behaviors landed here.
This commit is contained in:
2026-06-13 10:46:06 +04:00
parent 4f6bfa85f7
commit 8b896b519a
4 changed files with 116 additions and 0 deletions
+1
View File
@@ -48,6 +48,7 @@ func PreviewFrame(kind string, w, h int) string {
s.Events = sampleEvents()
s.Active = true
s.ToolsByStage = sampleManifest()
s.LastEventAt = nowMillis() - 3000 // 3s ago — exercises the last-event clock
}
if kind == "insert" {
m.editMode = ModeInsert