style: render item ids with trailing dot

This commit is contained in:
banteg
2025-12-29 14:57:37 +04:00
parent 14dcb34d38
commit cb7911847a
2 changed files with 10 additions and 10 deletions
@@ -91,7 +91,7 @@ def format_event(
item = event["item"] item = event["item"]
item_num = extract_numeric_id(item["id"], last_item) item_num = extract_numeric_id(item["id"], last_item)
last_item = item_num if item_num is not None else last_item last_item = item_num if item_num is not None else last_item
prefix = f"{item_num} " prefix = f"{item_num}. "
match (item["type"], etype): match (item["type"], etype):
case ("agent_message", "item.completed"): case ("agent_message", "item.completed"):
@@ -32,10 +32,10 @@ def test_render_event_cli_sample_stream() -> None:
assert out == [ assert out == [
"thread started", "thread started",
"turn started", "turn started",
"0 **Searching for README files**", "0. **Searching for README files**",
"1 ▸ `bash -lc ls`", "1. ▸ `bash -lc ls`",
"1 ✓ `bash -lc ls`", "1. ✓ `bash -lc ls`",
"2 **Checking repository root for README**", "2. **Checking repository root for README**",
"assistant:", "assistant:",
" Yep — theres a `README.md` in the repository root.", " Yep — theres a `README.md` in the repository root.",
"turn completed", "turn completed",
@@ -54,8 +54,8 @@ def test_render_event_cli_real_run_fixture() -> None:
assert out[0] == "thread started" assert out[0] == "thread started"
assert "turn started" in out assert "turn started" in out
assert any(line.startswith("0 ▸ `") for line in out) assert any(line.startswith("0. ▸ `") for line in out)
assert any(line.startswith("0 ✓ `") for line in out) assert any(line.startswith("0. ✓ `") for line in out)
assert "assistant:" in out assert "assistant:" in out
assert any("exec-bridge" in line for line in out) assert any("exec-bridge" in line for line in out)
assert out[-1] == "turn completed" assert out[-1] == "turn completed"
@@ -68,7 +68,7 @@ def test_progress_renderer_renders_progress_and_final() -> None:
progress = r.render_progress(3.0) progress = r.render_progress(3.0)
assert progress.startswith("working · 3s · item 3") assert progress.startswith("working · 3s · item 3")
assert "1 ✓ `bash -lc ls`" in progress assert "1. ✓ `bash -lc ls`" in progress
final = r.render_final(3.0, "answer", status="done") final = r.render_final(3.0, "answer", status="done")
assert final.startswith("done · 3s · item 3") assert final.startswith("done · 3s · item 3")
@@ -97,6 +97,6 @@ def test_progress_renderer_clamps_actions_and_ignores_unknown() -> None:
assert r.note_event(evt) is True assert r.note_event(evt) is True
assert len(r.recent_actions) == 3 assert len(r.recent_actions) == 3
assert r.recent_actions[0].startswith("3 ") assert r.recent_actions[0].startswith("3. ")
assert r.recent_actions[-1].startswith("5 ") assert r.recent_actions[-1].startswith("5. ")
assert r.note_event({"type": "mystery"}) is False assert r.note_event({"type": "mystery"}) is False