fix: restore brainstorming feature with missing socket server and real-time events
Some checks failed
CI / Lint, Test & Build (push) Failing after 7m48s
CI / Deploy production (on server) (push) Has been cancelled

This commit is contained in:
Antigravity
2026-05-19 20:07:56 +00:00
parent 66c6f7ee8f
commit fdb148144e
15 changed files with 500 additions and 2 deletions

View File

@@ -15,7 +15,9 @@ import {
resolveAiContextUserId,
sanitizeNotesForGuest,
captureSnapshot,
logActivity,
} from '@/lib/brainstorm-collab'
import { emitToSession } from '@/lib/socket-emit'
const expandSchema = z.object({
ideaId: z.string().min(1),
@@ -332,6 +334,17 @@ export async function POST(
for (const idea of updatedSession?.ideas || []) { (idea as any).creator = (idea as any).createdBy ? cm.get((idea as any).createdBy) || null : null }
}
await logActivity(sessionId, 'wave_generated', session.user.id, { count: newIdeas.length, parentIdeaId: ideaId })
await emitToSession(sessionId, 'activity:new', {
action: 'wave_generated',
userId: session.user.id,
userName: session.user.name || 'Guest',
details: { count: newIdeas.length, parentIdeaId: ideaId }
})
// Trigger refetch for all participants
await emitToSession(sessionId, 'idea:added', {})
await captureSnapshot(sessionId, `Wave expanded: ${parentIdea.title}`).catch(() => {})
return NextResponse.json({ success: true, data: updatedSession })