'use client'; import { useState } from 'react'; import { useSendProcessStdin } from '@/lib/hooks/useSupervisor'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { X, Terminal, Info } from 'lucide-react'; interface StdinInputProps { processName: string; onClose: () => void; } export function StdinInput({ processName, onClose }: StdinInputProps) { const [input, setInput] = useState(''); const [appendNewline, setAppendNewline] = useState(true); const stdinMutation = useSendProcessStdin(); const handleSend = () => { if (!input) return; const chars = appendNewline ? input + '\n' : input; stdinMutation.mutate( { name: processName, chars }, { onSuccess: () => { setInput(''); onClose(); }, } ); }; const handleKeyDown = (e: React.KeyboardEvent) => { // Allow Ctrl+Enter to send if (e.ctrlKey && e.key === 'Enter') { e.preventDefault(); handleSend(); } }; return (
Send Input to Process Send text to stdin of {processName}
{/* Info Banner */}

This sends input directly to the process's standard input stream. The process must be configured to read from stdin.

{/* Textarea */}