feat: stream pi thinking as ephemeral live preview #27
No reviewers
Labels
No labels
in-review
ready-for-agent
ready-for-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
weiwen/evie!27
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "sandcastle/issue-19"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
While pi is thinking (but before text starts streaming), forward thinking content to the user as a live
💭-prefixed preview. The moment text begins streaming, the preview is replaced by the answer — so the final delivered message contains only the answer, not the thinking.What changed
assistant_thinking()— new helper that extractsthinkingcontent blocks from aMessageUpdate, parallel to the existingassistant_text().thinking_preview()— formats thinking text with a💭prefix and tail-bounds it to 3800 Unicode chars. The 3800-char limit keeps the preview inside Telegram's 4096 UTF-16-unit message cap even after MarkdownV2 escaping.read_agent_response()— the snapshot selection now usesassistant_text().or_else(|| thinking_preview): text always wins when present; thinking preview fires only while no text exists yet.pi.rssummary to document the new ephemeral-preview behaviour.Tests added
test_thinking_only_update_emits_preview— thinking-only event emits a💭-prefixed snapshot.test_preview_flips_to_answer_text_when_text_arrives— once text appears, text takes over; thinking preview stops.test_thinking_preview_tail_bounded— a 5000-char thinking string is capped to ≤ 3800 chars in the preview.Review notes
Closes #19