Promote test → main: remove legacy /api/chat endpoint (#632)

Merged
SW
5mo ago
+26-1435

Promotes test → main. Brings 5 commits forward; headline change is the legacy chat endpoint removal.

Included

  • #632 — remove legacy POST /api/chat streaming endpoint + dead handlers (handleChatStream, handleChatCompletion, handleSendEmailToolOutputs) and orphaned code (extractSendEmailResults, lib/messages/validateMessages, upsertMemory, getLatestUserMessageText). Net +26/−1435.
  • #635 — migrate research provider to SongStats (already on main via prior merges; carried in test's merge commits)
  • #634 — credit-spend visibility digest cron (already on main via #637; carried in merge commits)

Verification (#632)

  • Local: lint clean, 692 tests pass.
  • Preview E2E: POST /api/chat → 404 (removed); /api/chat/workflow, /api/chat/generate, /api/chats all respond 400/401 (alive, graphs intact after deletions).

Advances cleanup tracker recoupable/chat#1767.


Summary by cubic

Removes the legacy POST /api/chat streaming endpoint and deletes its unused handlers and tests to simplify the chat surface. Active chat routes (/api/chat/workflow, /api/chat/generate) remain unchanged.

  • Refactors

    • Deleted app/api/chat/route.ts and legacy handlers (handleChatStream, handleChatCompletion).
    • Removed email tool wiring (handleSendEmailToolOutputs, extractSendEmailResults) and dead helpers (lib/messages/validateMessages duplicate, getLatestUserMessageText, upsertMemory).
    • Trimmed chat integration tests to cover validate/setup/credits; minor comment updates in validateChatRequest and handleChatCredits.
  • Migration

    • Stop calling POST /api/chat.
    • Use POST /api/chat/workflow for tool-driven flows or POST /api/chat/generate for text generation.