feat: render reasoning as italics
This commit is contained in:
@@ -90,6 +90,9 @@ def extract_numeric_id(item_id: Optional[object], fallback: Optional[int] = None
|
||||
def attach_id(item_id: Optional[int], line: str) -> str:
|
||||
return f"[{item_id if item_id is not None else '?'}] {line}"
|
||||
|
||||
def format_reasoning(text: str) -> str:
|
||||
return f"_{one_line(text)}_"
|
||||
|
||||
|
||||
def format_item_action_line(etype: str, item: dict[str, Any]) -> str | None:
|
||||
match (item["type"], etype):
|
||||
@@ -113,6 +116,8 @@ def format_item_action_line(etype: str, item: dict[str, Any]) -> str | None:
|
||||
|
||||
def format_item_completed_line(item: dict[str, Any]) -> str | None:
|
||||
match item["type"]:
|
||||
case "reasoning":
|
||||
return format_reasoning(item["text"])
|
||||
case "web_search":
|
||||
query = format_query(item["query"])
|
||||
return f"{STATUS_DONE} searched: {query}"
|
||||
|
||||
@@ -28,8 +28,10 @@ def test_render_event_cli_sample_stream() -> None:
|
||||
assert out == [
|
||||
"thread started",
|
||||
"turn started",
|
||||
"[0] _**Searching for README files**_",
|
||||
"[1] ▸ running: `bash -lc ls`",
|
||||
"[1] ✓ ran: `bash -lc ls` (exit 0)",
|
||||
"[2] _**Checking repository root for README**_",
|
||||
"assistant:",
|
||||
" Yep — there’s a `README.md` in the repository root.",
|
||||
"turn completed",
|
||||
@@ -50,4 +52,3 @@ def test_progress_renderer_renders_progress_and_final() -> None:
|
||||
assert "running:" not in final
|
||||
assert "ran:" not in final
|
||||
assert final.endswith("answer")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user