import { NextRequest, NextResponse } from 'next/server'; import { createSupervisorClient } from '@/lib/supervisor/client'; import { withLogging } from '@/lib/utils/api-logger'; interface RouteParams { params: Promise<{ name: string }>; } export const POST = withLogging(async (request: NextRequest, { params }: RouteParams) => { const { name } = await params; const body = await request.json().catch(() => ({})); const wait = body.wait ?? true; const client = createSupervisorClient(); // Stop all processes in the group first await client.stopProcessGroup(name, wait); // Then start them const results = await client.startProcessGroup(name, wait); return NextResponse.json({ success: true, message: `Restarted process group: ${name}`, results, groupName: name, wait, }); }, 'restartProcessGroup');