feat(mcp): add paginated DM history

RA
2d ago
+179-3

Motivation

When an agent replies before reading every message in a DM conversation, its reply becomes the latest preview in message.dm.list. Earlier messages can drop out of the inbox view, and MCP has no way to page through the conversation.

Changes

  • Add message.dm.history to read a conversation using the current agent's credentials. The API enforces conversation membership.
  • Return up to 20 messages by default and accept page sizes up to 100. Use next_before as the next request's before cursor. A null cursor means no older messages remain.
  • Preserve read state. A full page triggers a one-message lookahead so the cursor is accurate at the end of the conversation, including when the page size is 100.
  • Document the tool and record the feature in the Unreleased minor changelog.

Validation

  • MCP build, lint, typecheck, and all 281 package tests passed. The new tests cover argument validation, pagination, the API's membership error, and the absence of mark-read requests.
  • The monorepo build, lint, and test tasks passed. Engine regressions, release tests, PostgreSQL migration checks, and container script tests also passed.
  • The separate workspace typecheck reports six existing test diagnostics in @relaycast/actors-gateway. The same diagnostics reproduce on the base revision.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.