opencode-sdk-python/src
Alberto Garcia Illera 301f5cec71
fix: correct session.chat() return type to match server response
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
2026-02-21 12:37:30 -08:00
..
opencode/lib feat(api): update via SDK Studio 2025-06-27 14:47:09 +00:00
opencode_ai fix: correct session.chat() return type to match server response 2026-02-21 12:37:30 -08:00