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