feat(chat): add /sessions/[sid]/chats/[cid] route + session-scoped loader

Merged
AR
6mo ago
+55-43

Adds the canonical workflow URL /sessions/{sessionId}/chats/{chatId} and points the message loader at the matching session-scoped api endpoint.

  • New route app/sessions/[sessionId]/chats/[chatId]/page.tsx mounts <Chat id={chatId} sessionId={sessionId} />.
  • useMessageLoader takes (sessionId, chatId, ...) and fetches from GET /api/sessions/{sid}/chats/{cid}; legacy memories fetcher deleted.
  • Skips when either id is missing — the legacy /chat/{roomId} route still renders, just with an empty transcript (no fallback to memories).

The sidebar PR (chat#1756) emits canonical URLs that this route receives. Merge order: chat#1756 → chat#1752 (back-to-back; sidebar links 404 between them).

silentlyUpdateUrl rewrite + HomePage refactor live in a follow-up PR.

Test plan

  • On a Vercel preview, navigate directly to /sessions/{sid}/chats/{cid} for a workflow chat → messages load → reload preserves them.
  • Visit a sidebar row (after chat#1756 lands) → arrives at the same route → messages render.
  • Legacy /chat/{roomId} still resolves but shows an empty transcript.