Skip to content

refactor(client)!: converge DM types on core message payload#93

Merged
willwashburn merged 16 commits intomainfrom
feat/core-message-model-convergence
Mar 18, 2026
Merged

refactor(client)!: converge DM types on core message payload#93
willwashburn merged 16 commits intomainfrom
feat/core-message-model-convergence

Conversation

@barryonthecape
Copy link
Copy Markdown
Contributor

@barryonthecape barryonthecape commented Mar 17, 2026

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.ts
  • packages/types/src/events.ts
  • packages/types/src/dm.ts
  • packages/sdk-rust/src/types.rs
  • docs/message-model-convergence.md

No server route/engine behavior changes in this PR.

Breaking client changes

@relaycast/types

  • Introduces shared CoreMessagePayloadSchema in message.ts:
    • id, agent_id?, agent_name, text, injection_mode?
  • Event schemas converge on shared core payload (events.ts):
    • message.updated, thread.reply, dm.received, group_dm.received
  • DM typed response models are now unified and breaking (dm.ts):
    • SendDmResponse => { conversation_id, message, created_at }
    • GroupDmMessageResponse => { conversation_id, message, created_at }

Rust SDK typed models

  • DmSendResponse and GroupDmMessageResponse now use nested message core payload shape (breaking for typed consumers).

Why this is safe operationally

  • Server can continue emitting legacy fields; client model change is the intentional major-version break.
  • This lets us ship a clean, explicit client migration path now, then tighten server payloads later.

Validation

  • packages/types: npm run build
  • packages/sdk-rust: cargo test -p relaycast --tests

Open with Devin

@github-actions
Copy link
Copy Markdown

Preview deployed!

Environment URL
API https://pr93-api.relaycast.dev
Health https://pr93-api.relaycast.dev/health
Observer https://pr93-observer.relaycast.dev/observer

This preview shares the staging database and will be cleaned up when the PR is merged or closed.

Run E2E tests

npm run e2e -- https://pr93-api.relaycast.dev --ci

Open observer dashboard

https://pr93-observer.relaycast.dev/observer

@barryonthecape barryonthecape changed the title refactor(types): converge on shared core message payload model refactor(client)!: converge DM types on core message payload Mar 17, 2026
Comment thread docs/message-model-convergence.md Outdated
Comment thread packages/server/src/engine/groupDm.ts

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Comment thread packages/server/src/engine/dm.ts
Comment thread docs/message-model-convergence.md Outdated
Comment thread packages/sdk-rust/src/agent.rs Outdated
Comment thread packages/sdk-rust/src/agent.rs Outdated
Comment thread packages/server/src/engine/dm.ts

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Open in Devin Review

@willwashburn willwashburn merged commit 89fb44e into main Mar 18, 2026
4 checks passed
@willwashburn willwashburn deleted the feat/core-message-model-convergence branch March 18, 2026 17:19
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.

3 participants