/**
 * POST /api/chat/sessions/<id>/fork  { title?, up_to_ts? } → { session }
 *
 * Copy a session's messages into a brand-new (temp) session and return
 * the fork. Used by the chat header "⑂ Fork" button to branch the main
 * conversation without losing it. The new session is meta.kind = 'temp'
 * so the user can delete it later from the picker.
 */

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

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