import React, { useEffect, useState } from 'react'; export default function App() { const [browserFrame, setBrowserFrame] = useState(""); const [logs, setLogs] = useState([]); const [input, setInput] = useState(""); useEffect(() => { const eventSource = new EventSource("/api/stream"); eventSource.onmessage = (event) => { try { const data = JSON.parse(event.data); if (data.type === "frame") setBrowserFrame(data.data); if (data.type === "log") setLogs(prev => [...prev, data.data].slice(-10)); } catch (e) { console.error("SSE Parse Error", e); } }; return () => eventSource.close(); }, []); const sendMessage = async () => { if (!input) return; setLogs(prev => [...prev, `You: ${input}`]); await fetch("/api/chat", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ message: input }) }); setInput(""); }; return (

Polymorphic Agent

{logs.map((log, i) => (
{log}
))}
setInput(e.target.value)} onKeyDown={(e) => e.key === 'Enter' && sendMessage()} placeholder="Ask agent..." />
Live Nix Environment View
{browserFrame ? ( ) : (
Initializing Browser...
)}
); }