Skip to content

feat: MessageContext model + canonical render_message_context() helper - #2

Merged
sanctrl merged 2 commits into
mainfrom
feat/message-context
Jul 24, 2026
Merged

feat: MessageContext model + canonical render_message_context() helper#2
sanctrl merged 2 commits into
mainfrom
feat/message-context

Conversation

@sanctrl

@sanctrl sanctrl commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Types the server's trusted context block and adds a canonical renderer (mirrors the TS SDK) so integrations built on the SDK get the rich context path by default.

Verification: ruff (touched files) ✓, mypy ✓, pytest 140 (+4 render tests).

sanctrl added 2 commits July 24, 2026 03:39
Add MessageContext / MessageContextSender / MessageContextConversation models and an optional context field on Message, matching the server's trusted context block. Add render_message_context(message, self_handle=..., now=...) — the canonical way to render a received message (Message model OR raw inbound dict) into the compact context block an LLM agent reads. Mirrors the TypeScript SDK; degrades gracefully without a context block.
Pre-existing handler type unions in _http.py/_realtime.py — ruff 0.16.0 (freshly released, auto-installed by CI's `ruff>=0.6`) now enforces RUF036. Mechanical, semantically-identical reorder (None to the end); unblocks CI for this repo (main is red for the same reason). Not part of the MessageContext feature.
@sanctrl
sanctrl merged commit f993a30 into main Jul 24, 2026
10 checks passed
@sanctrl
sanctrl deleted the feat/message-context branch July 24, 2026 10:45
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