All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 1m10s
Features added: - Created stdin API route for sending input to process stdin - Added useSendProcessStdin React Query hook - Created StdinInput modal component with: - Multi-line textarea for input - Ctrl+Enter keyboard shortcut - Optional newline append - Character count display - Info banner explaining stdin functionality - Added stdin button to ProcessCard (Terminal icon) - Button only enabled when process is running (state === 20) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
37 lines
1014 B
TypeScript
37 lines
1014 B
TypeScript
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 }
|
|
);
|
|
}
|
|
}
|