refactor(api): move artist copy flow server-side
AR
7mo ago+419+419+012345678901234567890123456789-116-116-012345678901234567890123456789
Summary
- move artist chat copying into the API flow
- add a generic redirect tool to the create artist chain
- reuse shared copy logic for both the endpoint and chat completion sync
Testing
- pnpm test lib/chats/tests/copyChatMessages.test.ts lib/chats/tests/copyChatMessagesHandler.test.ts lib/mcp/tools/artists/tests/registerCreateNewArtistTool.test.ts lib/chat/toolChains/tests/toolChains.test.ts
Summary by cubic
Moves the artist handoff fully to the server and finalizes it after chat completion. When create_new_artist runs, the server creates a new room, copies the chat, and streams a redirect to the new room before sending the final finish.
-
New Features
- Added
handleCreateArtistRedirectto parsecreate_new_artist(tool or dynamic-tool), runcopyRoom+copyChatMessages, and return a redirect path. handleChatStreamnow accepts an optional finish callback; it setssendFinish: false, emitsdata-redirect, then writes the finalfinish. The chat API wires this up.
- Added
-
Refactors
- Extracted
copyChatMessagesand updated the copy messages API handler to use it. - Removed room creation and
newRoomIdfromregisterCreateNewArtistTool; it now returns onlyartistAccountId.
- Extracted
Summary by CodeRabbit
-
New Features
- Enhanced artist creation with automatic chat room setup and intelligent redirection.
- Improved chat message management when creating new artists.
-
Bug Fixes
- Refined chat streaming completion handling to better support post-response workflows.