feat(api): migrate GET /api/chats to session-scoped shape

Merged
AR
5mo ago
+704-482

Rewrites GET /api/chats (and the MCP get_chats tool) to read from chats ⋈ sessions and emit { id, title, accountId, sessionId, updatedAt } so the chat sidebar can render canonical /sessions/{sid}/chats/{cid} URLs. artist_account_id is accepted-but-ignored for backward compat.

Test plan

  • On a Vercel preview, call GET /api/chats with a personal Bearer token and confirm the response carries sessionId and accountId per row.
  • Hit GET /api/chats?artist_account_id=<uuid> and confirm the param is accepted (200) but does not filter.
  • As a Recoup admin key, confirm the response includes chats across accounts.
  • Invoke the get_chats MCP tool and confirm the same projection.

Summary by CodeRabbit

  • API Changes
    • Chat retrieval endpoint now returns sessionId and accountId for each chat to support canonical session-based URLs.
    • Query parameter clarification: artist_account_id is accepted for backward compatibility but no longer affects authorization or results.