Spectra-Frontend: The Multiplayer Browser for Humans and AI
How a React application uses VNC streams and Kubernetes namespaces to build a shared, ephemeral workspace for security researchers and autonomous agents.
- Spectra integrates a live VNC stream into a React interface to create a shared workspace for humans and AI agents.
- A global request deduplication pattern prevents slow Kubernetes cold starts from spawning duplicate infrastructure.
- The system features a dedicated hacking mode that provisions ephemeral sandbox environments for security research.
- Unlike headless AI browsing tools, Spectra provides real-time visual observability and manual intervention capabilities.
The Shared Cursor
Most AI browsing tools operate as headless black boxes. You issue a command, and you wait for a result. Spectra takes a different approach. By embedding a live VNC stream directly into a React application, it creates a multiplayer environment where a human and an AI agent share the same virtual workspace. You can ask the agent to execute a task and watch it happen in real time. If the agent gets stuck, you can intervene using your own mouse and keyboard.
Bridging the RFB Protocol and React
Rendering a remote desktop protocol inside a modern web application presents unique challenges. Spectra relies on react-vnc to handle the raw RFB stream. The BrowserSessionPage synchronizes this visual canvas with a chat interface, treating the remote browser as a first-class application rather than a simple video stream. This requires meticulous JWT lifecycle management to keep long-running websocket connections alive without forcing a page reload.
Surviving the Kubernetes Cold Start
The brain of the application lives in SessionContext.tsx. When a user requests a session, Kubernetes must spin up a new namespace and container. This cold start is notoriously slow. Spectra uses a global request deduplication pattern to handle this latency. An out-of-cycle activeRequests Map prevents users from mashing the start button and accidentally provisioning duplicate infrastructure.
const activeRequests = new Map<string, boolean>();
const startSession = async (mode: string) => {
if (activeRequests.has(mode)) return;
activeRequests.set(mode, true);
try {
// Provision Kubernetes namespace and container
} finally {
activeRequests.delete(mode);
}
};
The Disposable Sandbox
Spectra is built with security researchers in mind. The interface includes an explicit hacking mode toggle. This instructs the backend to provision specialized, ephemeral environments designed to safely detonate malicious links or run intensive open-source intelligence tools.
The Visual vs. Headless Paradigm
Headless browsing APIs are faster and cheaper at scale. However, they lack the visual feedback required for complex, unpredictable workflows. Spectra sacrifices the raw speed of a headless API to provide deep observability and the option for immediate human override.
| Feature | Spectra (Visual) | Headless APIs | Traditional VNC |
|---|---|---|---|
| Visual Feedback | Real-time VNC | Screenshots only | Real-time VNC |
| AI Integration | Built-in chat | Native | None |
| Primary Actor | Human + AI | AI only | Human only |
| Infrastructure | Ephemeral K8s | Serverless | Persistent or Ephemeral |