feat: real-time tool call streaming indicator with blinking UI
- Add ToolParsingHint enum (Detected/Active/Complete) for UI feedback - New UiWriter methods: print_tool_streaming_hint(), print_tool_streaming_active() - Refactor ConsoleUiWriter state to use atomics in ParsingHintState - Add tool_call_streaming field to CompletionChunk for provider hints - Anthropic provider sends streaming hints when tool name detected - New streaming helpers: make_tool_streaming_hint(), make_tool_streaming_active() Parser improvements: - Add is_json_invalidated() to detect false positive tool patterns - Fix tool result poisoning when file contents contain partial JSON - Unescaped newlines in strings or prose after JSON invalidates detection User sees ' ● tool_name |' immediately when tool call starts streaming, with blinking indicator while args are received.
This commit is contained in:
@@ -67,6 +67,14 @@ pub trait UiWriter: Send + Sync {
|
||||
/// Notify that an SSE event was received (including pings)
|
||||
fn notify_sse_received(&self);
|
||||
|
||||
/// Print a hint that a tool call is being streamed (show indicator immediately)
|
||||
/// This is called when the provider starts receiving a tool call but args are still streaming
|
||||
fn print_tool_streaming_hint(&self, tool_name: &str);
|
||||
|
||||
/// Signal that a tool call is still actively streaming (for blinking indicator)
|
||||
/// This is called periodically while tool args are being received
|
||||
fn print_tool_streaming_active(&self);
|
||||
|
||||
/// Flush any buffered output
|
||||
fn flush(&self);
|
||||
|
||||
@@ -127,6 +135,8 @@ impl UiWriter for NullUiWriter {
|
||||
fn print_agent_prompt(&self) {}
|
||||
fn print_agent_response(&self, _content: &str) {}
|
||||
fn notify_sse_received(&self) {}
|
||||
fn print_tool_streaming_hint(&self, _tool_name: &str) {}
|
||||
fn print_tool_streaming_active(&self) {}
|
||||
fn flush(&self) {}
|
||||
fn finish_streaming_markdown(&self) {}
|
||||
fn wants_full_output(&self) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user