feat: implement Phase 8 - Process Stdin
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 1m10s
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>
This commit is contained in:
36
app/api/supervisor/processes/[name]/stdin/route.ts
Normal file
36
app/api/supervisor/processes/[name]/stdin/route.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
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 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user