Skip to content

feat: add streaming draft support (ADR-002)#119

Merged
sudoskys merged 1 commit into
mainfrom
feat/streaming-draft-support
Jun 13, 2026
Merged

feat: add streaming draft support (ADR-002)#119
sudoskys merged 1 commit into
mainfrom
feat/streaming-draft-support

Conversation

@sudoskys

Copy link
Copy Markdown
Owner

Summary

  • Two-layer async streaming architecture for LLM token-by-token output via Telegram draft API
    • StreamCore[T]: protocol-agnostic throttled buffer (state machine, keepalive, degraded mode, concurrent send guard)
    • DraftStream: facade for sendMessageDraft / sendRichMessageDraft (private chats, thinking indicator, sliding window truncation)
    • EditStream: facade for send-then-edit pattern (group chats, ≥1.0s interval enforced)
  • 22 unit tests covering all 8 ADR verification flags + DraftStream strategy layer
  • Live integration tests against real Telegram Bot API (pdm run test-live-stream)
  • README updated with streaming usage section; "For AI Assistants" section streamlined to reference llms.txt

Test plan

  • pdm run pytest tests/test_stream.py -v — 22 passed
  • pdm run test — 244 passed (full regression, no breakage)
  • pdm run test-live-stream — entity + rich mode pass against real Telegram API
  • playground/stream_draft_case.py — 15 drafts sent, final message delivered (message_id=179)
  • Reviewer: verify streaming behavior in Telegram client (run pdm run python playground/stream_draft_case.py)

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.
@sudoskys sudoskys merged commit 5fbd78a into main Jun 13, 2026
4 checks passed
@sudoskys sudoskys deleted the feat/streaming-draft-support branch June 13, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant