diff --git a/org/gateway-tui-main.org b/org/gateway-tui-main.org index f63f452..05a9497 100644 --- a/org/gateway-tui-main.org +++ b/org/gateway-tui-main.org @@ -17,7 +17,10 @@ Event handlers + daemon I/O + main loop. chat and history. Non-printable keys are ignored. 2. (on-daemon-msg msg): processes inbound daemon messages. Routes text responses to chat display (:agent), handshake to system - messages, routes errors to log via ~log-message~. + messages, routes errors to log via ~log-message~. Extracts + ~:gate-trace~ (attached to message), ~:rule-count~, and + ~:foveal-id~ (v0.4.0 differentiator) from daemon response and + updates TUI state for status bar rendering. 3. (send-daemon msg): serializes and sends a message to the daemon over the framed TCP protocol. 4. (tui-main): the main loop — connects to daemon, initializes diff --git a/org/gateway-tui-model.org b/org/gateway-tui-model.org index e114ae0..a186cac 100644 --- a/org/gateway-tui-model.org +++ b/org/gateway-tui-model.org @@ -10,9 +10,9 @@ All state mutation flows through event handlers in the controller. 1. (init-state): returns a fresh state plist with ~:msgs~ list, ~:input~ buffer, ~:dirty~ flag, ~:busy~ flag, and ~:connection~ status. -2. (add-msg type text): appends a message to the ~:msgs~ list in - ~*state*~, tagged with a timestamp and type. Truncates at the - message buffer limit. +2. (add-msg role content &key gate-trace): appends a message object + to the ~:messages~ vector (v0.3.3), tagged with timestamp, role, + and optional gate-trace from the daemon (v0.4.0). 3. (queue-event ev): thread-safely enqueues an event for the reader loop. (drain-queue) returns and clears the queue. diff --git a/org/gateway-tui-view.org b/org/gateway-tui-view.org index 3e73d0b..f3562d6 100644 --- a/org/gateway-tui-view.org +++ b/org/gateway-tui-view.org @@ -9,7 +9,8 @@ State is read via ~(st :key)~ — no mutation here. ** Contract 1. (view-status win): renders the status bar with connection info, - version, and timestamp. + msg count, scroll offset, rule counter, focus map (v0.4.0), and + timestamp. Two lines: line 1 (status + rules), line 2 (focus + time). 2. (view-chat win h): renders the scrolled chat message list. Takes window and available height. Messages are color-coded: green (user), white (agent), yellow (system). @@ -19,6 +20,23 @@ State is read via ~(st :key)~ — no mutation here. flags (status, chat, input). Minimizes terminal writes. ** Status Bar + +The status bar, as of v0.4.0, renders Passepartout's three differentiator +visualizations — data only available because of the deterministic gate +architecture: + +- *Rule counter* (~Rules:N~): the number of pending HITL actions from the + Dispatcher's ~*hitl-pending*~ hash table. The user watches this tick up + as they teach the agent their preferences through approve/deny decisions. +- *Focus map* (~[Focus: ]~): the foveal focus from the daemon's signal + context. Shows the user what the agent is currently looking at. +- *Gate trace* (not rendered in status bar — attached to individual + messages via ~:gate-trace~ field for future collapsible rendering per + message). + +All three enrichments cost 0 LLM tokens — they are daemon-state queries +that the TUI actuator attaches to the response plist before transmission. + #+begin_src lisp (in-package :passepartout.gateway-tui)