mirror of
https://github.com/anomalyco/opencode-sdk-python.git
synced 2026-05-21 10:42:58 +00:00
The OpenCode server's POST /session/{id}/message endpoint returns a
wrapper object with 'info' (the assistant message) and 'parts' (the
message parts):
{"info": AssistantMessage, "parts": Part[]}
The SDK was casting this response to bare AssistantMessage, which
caused Pydantic to silently produce a hollow object where all fields
(id, role, tokens, etc.) were None.
This commit:
- Adds SessionChatResponse type with 'info: Message' and 'parts: List[Part]'
fields matching the actual server response shape
- Updates both sync and async chat() to return SessionChatResponse
- Exports the new type from types/__init__.py
- Updates api.md documentation
|
||
|---|---|---|
| .. | ||
| opencode/lib | ||
| opencode_ai | ||