feat: stream intermediate progress to user during tool execution

This commit is contained in:
Re-bin
2026-02-18 14:23:51 +00:00
parent ce4f00529e
commit 715b2db24b
4 changed files with 57 additions and 11 deletions

View File

@@ -494,11 +494,14 @@ def agent(
# Animated spinner is safe to use with prompt_toolkit input handling
return console.status("[dim]nanobot is thinking...[/dim]", spinner="dots")
async def _cli_progress(content: str) -> None:
console.print(f" [dim]↳ {content}[/dim]")
if message:
# Single message mode
async def run_once():
with _thinking_ctx():
response = await agent_loop.process_direct(message, session_id)
response = await agent_loop.process_direct(message, session_id, on_progress=_cli_progress)
_print_agent_response(response, render_markdown=markdown)
await agent_loop.close_mcp()
@@ -531,7 +534,7 @@ def agent(
break
with _thinking_ctx():
response = await agent_loop.process_direct(user_input, session_id)
response = await agent_loop.process_direct(user_input, session_id, on_progress=_cli_progress)
_print_agent_response(response, render_markdown=markdown)
except KeyboardInterrupt:
_restore_terminal()