/**
 * GET /api/chat/sessions/<id>/events — SSE stream of agent events.
 *
 * Proxied to chat-standalone (port 8408). Used by surfaces that don't
 * subscribe via the browser bridge (web /chat tab, future server-side
 * consumers). The extension still receives events through its persistent
 * WS to the bridge — both paths emit the same AgentEvent payloads.
 */

import { proxyToChat } from '@/lib/chat/proxy';

export const dynamic = 'force-dynamic';

export async function GET(req: Request, { params }: { params: Promise<{ id: string }> }) {
  const { id } = await params;
  return proxyToChat(req, `/api/sessions/${encodeURIComponent(id)}/events`);
}
