import { NextRequest, NextResponse } from 'next/server'; import { createSupervisorClient } from '@/lib/supervisor/client'; interface RouteParams { params: Promise<{ name: string }>; } // POST - Send signal to a process export async function POST(request: NextRequest, { params }: RouteParams) { try { const { name } = await params; const body = await request.json(); const { signal } = body; if (!signal) { return NextResponse.json( { error: 'Signal is required' }, { status: 400 } ); } const client = createSupervisorClient(); const result = await client.signalProcess(name, signal); return NextResponse.json({ success: result, message: `Signal ${signal} sent to ${name}`, }); } catch (error: any) { console.error('Supervisor signal process error:', error); return NextResponse.json( { error: error.message || 'Failed to send signal to process' }, { status: 500 } ); } }