feat(cli): display model reasoning content during streaming
Add show_reasoning config (default: False) to display model thinking/reasoning content in the TUI during streaming. Reasoning is emitted via a new emit_reasoning hook on AgentHook, gated by the channels config. Display uses ✻ prefix with dim italic styling. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
1 parent
d630ac90d1
commit
3a27af0018
9 files changed
+182
-13
No files matched your search
@@ -155,6 +155,14 @@ class _LoopHook(AgentHook):
|
||||
session_key=self._session_key,
|
||||
)
|
||||
|
||||
async def emit_reasoning(self, reasoning_content: str | None) -> None:
|
||||
"""Send reasoning/thinking content as progress before the main answer."""
|
||||
ch = self._loop.channels_config
|
||||
if not ch or not ch.show_reasoning:
|
||||
return
|
||||
if self._on_progress and reasoning_content:
|
||||
await self._on_progress(reasoning_content, reasoning=True)
|
||||
|
||||
async def after_iteration(self, context: AgentHookContext) -> None:
|
||||
if (
|
||||
self._on_progress
|
||||
@@ -1114,10 +1122,13 @@ class AgentLoop:
|
||||
*,
|
||||
tool_hint: bool = False,
|
||||
tool_events: list[dict[str, Any]] | None = None,
|
||||
reasoning: bool = False,
|
||||
) -> None:
|
||||
meta = dict(msg.metadata or {})
|
||||
meta["_progress"] = True
|
||||
meta["_tool_hint"] = tool_hint
|
||||
if reasoning:
|
||||
meta["_reasoning"] = True
|
||||
if tool_events:
|
||||
meta["_tool_events"] = tool_events
|
||||
await self.bus.publish_outbound(
|
||||
|
||||
Reference in new issue
Block a user