feat: add streaming draft support (ADR-002)#119
Merged
Conversation
Two-layer async streaming architecture for LLM token-by-token output: - StreamCore[T]: protocol-agnostic throttled buffer with state machine, keepalive, degraded mode, and concurrent send guard - DraftStream: facade for sendMessageDraft / sendRichMessageDraft (private chats, thinking indicator, sliding window) - EditStream: facade for send-then-edit pattern (group chats, ≥1.0s interval) Includes 22 unit tests (all 8 ADR verification flags + strategy layer), live integration tests against real Telegram Bot API, and playground script. Also streamlines README "For AI Assistants" section to reference llms.txt instead of duplicating content inline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
StreamCore[T]: protocol-agnostic throttled buffer (state machine, keepalive, degraded mode, concurrent send guard)DraftStream: facade forsendMessageDraft/sendRichMessageDraft(private chats, thinking indicator, sliding window truncation)EditStream: facade for send-then-edit pattern (group chats, ≥1.0s interval enforced)pdm run test-live-stream)llms.txtTest plan
pdm run pytest tests/test_stream.py -v— 22 passedpdm run test— 244 passed (full regression, no breakage)pdm run test-live-stream— entity + rich mode pass against real Telegram APIplayground/stream_draft_case.py— 15 drafts sent, final message delivered (message_id=179)pdm run python playground/stream_draft_case.py)