TUI: append fresh assistant block after tools instead of overwriting

ober

e47df0ee18e92da4e9cb2557871068ae66567793

diff --git a/src/jcode/ui/tui.ss b/src/jcode/ui/tui.ss
index d578682..e67bc95 100644
--- a/src/jcode/ui/tui.ss
+++ b/src/jcode/ui/tui.ss
@@ -849,12 +849,17 @@
   "Handle a streaming token from the LLM — called from agent thread."
   (let ((buf (app-state-stream-buf state)))
     (tui-log "tui-stream-token: buf-len=~a token-len=~a" (string-length buf) (string-length token))
-    ;; If buf was reset (tools ran), add a new assistant block for this round
+    ;; buf="" marks the start of an assistant turn (initial round, or a round
+    ;; resumed after tool calls). Reuse the trailing assistant block only
+    ;; when it is still the empty placeholder; otherwise append a fresh one
+    ;; so we don't overwrite the previous round's reply.
     (when (and (string-empty? buf)
                (let ((msgs (app-state-messages state)))
                  (or (null? msgs)
-                     (not (eq? (msg-block-role (car (reverse msgs))) 'assistant)))))
-      (tui-log "tui-stream-token: adding new assistant block (last msg is not assistant)")
+                     (let ((last (car (reverse msgs))))
+                       (or (not (eq? (msg-block-role last) 'assistant))
+                           (not (string-empty? (msg-block-content last))))))))
+      (tui-log "tui-stream-token: adding new assistant block")
       (add-message! state (msg-block-assistant "")))
     (let ((new-buf (string-append buf token)))
       (app-state-stream-buf-set! state new-buf)