List messages for a task with cursor-based pagination.
This endpoint is designed for infinite scroll UIs where new messages may arrive
while paginating through older ones.
Args:
task_id: The task ID to filter messages by
limit: Maximum number of messages to return (default: 50)
cursor: Opaque cursor string for pagination. Pass the `next_cursor` from
a previous response to get the next page.
direction: Pagination direction - "older" to get older messages (default),
"newer" to get newer messages.
Returns:
PaginatedMessagesResponse with:
- data: List of messages (newest first when direction="older")
- next_cursor: Cursor for fetching the next page (null if no more pages)
- has_more: Whether there are more messages to fetch
Example:
First request: GET /messages/paginated?task_id=xxx&limit=50
Next page: GET /messages/paginated?task_id=xxx&limit=50&cursor=<next_cursor>