tenseleyflow/loader / dafa5bc

Browse files

fix: filter streaming content to hide bracket tool calls

**The Problem:**
Bracket-format tool calls like [USE write tool: ...] were showing
to users in the stream before being extracted and executed.

**Root Cause:**
on_stream_chunk() was displaying content directly without filtering.
Only complete (non-streaming) content went through safeguards.

**The Fix:**
Apply agent.safeguards.filter_stream_chunk() to streaming content
before appending to StreamingText widget.

**What This Fixes:**
- Bracket tool calls no longer visible to users
- Code blocks removed from stream in real-time
- JSON tool attempts filtered out as they're generated
- Cleaner, more professional output during streaming
Authored by espadonne
SHA
dafa5bcbfa7f7716389962edd0f60650a9bc48d1
Parents
750735d
Tree
de8fd82

1 changed file

StatusFile+-
M src/loader/ui/app.py 7 2
src/loader/ui/app.pymodified
@@ -451,8 +451,13 @@ class LoaderApp(App):
451451
             self._current_streaming.start_streaming()
452452
             msg_area.mount(self._current_streaming)
453453
 
454
-        self._current_streaming.append(message.content)
455
-        msg_area.scroll_end(animate=False)
454
+        # Filter content through safeguards before displaying
455
+        # This removes bracket tool calls, code blocks, etc. from stream
456
+        filtered_content = self.agent.safeguards.filter_stream_chunk(message.content)
457
+
458
+        if filtered_content:
459
+            self._current_streaming.append(filtered_content)
460
+            msg_area.scroll_end(animate=False)
456461
 
457462
         # Track that we've shown actual content
458463
         if message.content.strip():