refactor(client)!: converge DM types on core message payload#93
refactor(client)!: converge DM types on core message payload#93willwashburn merged 16 commits intomainfrom
Conversation
|
Preview deployed!
This preview shares the staging database and will be cleaned up when the PR is merged or closed. Run E2E testsnpm run e2e -- https://pr93-api.relaycast.dev --ciOpen observer dashboard |
There was a problem hiding this comment.
Devin Review found 1 new potential issue.
🐛 1 issue in files not directly in the diff
🐛 Python SDK FileAttachment model has stale fields, causing Pydantic validation errors for DM messages with attachments (packages/sdk-python/src/relay_sdk/models.py:132-136)
The Python SDK's FileAttachment model at packages/sdk-python/src/relay_sdk/models.py:132-136 expects url: str and size: int, but the server returns content_type and size_bytes for all attachments (see packages/server/src/engine/dm.ts:39-43 and packages/server/src/engine/message.ts:28-32). This PR introduces attachment support for DMs, so when dms.messages() fetches a DM conversation containing attachments, MessageWithMeta.model_validate(m) at packages/sdk-python/src/relay_sdk/agent.py:67 will raise a Pydantic ValidationError because each attachment dict has content_type/size_bytes instead of the expected url/size fields.
View 17 additional findings in Devin Review.
Summary
Per request, this PR is now client-breaking only (major-version style) and keeps server behavior unchanged.
Scope (clean)
Changed files are only:
packages/types/src/message.tspackages/types/src/events.tspackages/types/src/dm.tspackages/sdk-rust/src/types.rsdocs/message-model-convergence.mdNo server route/engine behavior changes in this PR.
Breaking client changes
@relaycast/typesCoreMessagePayloadSchemainmessage.ts:id,agent_id?,agent_name,text,injection_mode?events.ts):message.updated,thread.reply,dm.received,group_dm.receiveddm.ts):SendDmResponse=>{ conversation_id, message, created_at }GroupDmMessageResponse=>{ conversation_id, message, created_at }Rust SDK typed models
DmSendResponseandGroupDmMessageResponsenow use nestedmessagecore payload shape (breaking for typed consumers).Why this is safe operationally
Validation
packages/types:npm run buildpackages/sdk-rust:cargo test -p relaycast --tests