What's New
Streaming draft support (ADR-002)
New DraftStream and EditStream classes for token-by-token LLM output via Telegram's draft API:
from telegramify_markdown.stream import DraftStream
async with DraftStream(
send_draft=my_send_draft_fn,
send_final=my_send_final_fn,
mode="rich",
interval=0.3,
thinking_delay=0.5,
) as stream:
async for token in llm_response:
stream.feed(token)- DraftStream — for private chats via
sendMessageDraft/sendRichMessageDraft(Bot API 9.3+) - EditStream — for group/channel chats via
editMessageText(≥1.0s interval enforced) - StreamCore — protocol-agnostic base with throttling, keepalive, degraded mode, and concurrent send guard
Rich Message improvements
- Oversized blocks (>32KB paragraph or code block) are now split into valid chunks instead of being emitted as-is with a warning
- Empty
richify()/telegramify_rich()input returns empty list instead of a single empty payload
Migration from v1.1.x
Fully backward-compatible. No API changes, no behavior regressions. Streaming is purely additive — import from telegramify_markdown.stream when needed.
Full Changelog
feat: add streaming draft support (ADR-002)— StreamCore, DraftStream, EditStream, 22 unit tests, live integration testsfix: split oversized rich message blocks— paragraph, pre, and Markdown blocks exceeding 32KB are now split correctlyci: add stream live test and unit test steps to CI