feat: implement Phase 8 - Process Stdin
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:
2025-11-23 19:46:47 +01:00
parent 68ec8dd3db
commit 4aa0c49372
4 changed files with 212 additions and 1 deletions

View File

@@ -645,3 +645,30 @@ export function useSignalAllProcesses() {
},
});
}
// Process Stdin
async function sendProcessStdin(name: string, chars: string): Promise<{ success: boolean; message: string }> {
const response = await fetch(`/api/supervisor/processes/${encodeURIComponent(name)}/stdin`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ chars }),
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.error || 'Failed to send input');
}
return response.json();
}
export function useSendProcessStdin() {
return useMutation({
mutationFn: ({ name, chars }: { name: string; chars: string }) => sendProcessStdin(name, chars),
onSuccess: (data) => {
toast.success(data.message);
},
onError: (error: Error) => {
toast.error(`Failed to send input: ${error.message}`);
},
});
}