feat(frontends,ui): opus 5.5 progress updates show in the web panel and the vault transcript

This commit is contained in:
hh committed 2026-09-22 20:36:23 +02:00
1 parent bbce425eeb
commit 13873f857b
5 files changed
+125 -72

No files matched your search

@@ -1,7 +1,7 @@
"""Render Anthropic ``Message`` (and user turns) into markdown.
One-way: produces the human-facing artifact only. The parser strips
tool/thinking callouts separately when reshaping history for backend replay.
the tool/thinking callouts of older files when reshaping history for replay.
"""
from __future__ import annotations
@@ -12,8 +12,6 @@ from typing import TYPE_CHECKING, Any, cast
from anthropic.types import Message, TextBlock, ThinkingBlock
if TYPE_CHECKING:
from collections.abc import Iterable
from anthropic.types import MessageParam
@@ -48,21 +46,14 @@ def render_assistant_text(text: str) -> str:
def render_assistant_message(message: Message) -> str:
"""Render an assistant ``Message`` into a turn block.
Tool-use blocks render to nothing; of the thinking blocks between two
texts only the first one reaches the file.
Tool-use blocks and empty thinking render to nothing; a non-empty thinking
block is what the model wrote between tool calls and renders as text.
"""
parts: list[str] = ["### Assistant:", ""]
after_thinking = False
for block in message.content:
thinking = isinstance(block, ThinkingBlock)
if thinking and after_thinking:
continue
lines = list(_render_block(block))
if not lines:
continue
after_thinking = thinking
parts.extend(lines)
parts.append("")
text = _spoken(block)
if text:
parts.extend((text, ""))
return "\n".join(parts).rstrip() + "\n"
@@ -108,21 +99,12 @@ def summarize_tool_input(name: str, tool_input: object) -> str:
return name
def _render_block(block: object) -> Iterable[str]:
def _spoken(block: object) -> str:
if isinstance(block, TextBlock):
text = (block.text or "").strip()
if text:
yield text
return
return (block.text or "").strip()
if isinstance(block, ThinkingBlock):
yield from _render_thinking(block.thinking or "")
return
def _render_thinking(text: str) -> Iterable[str]:
yield "> [!thinking]-"
for line in text.strip().splitlines() or [""]:
yield f"> {line}" if line else ">"
return (block.thinking or "").strip()
return ""
def adaptive_fence(content: str) -> str: