This is the exact logical evolution of the microkernel we just built. You are
describing an Agent Automation Studioa fully transparent, human-in-the-loop
IDE for autonomous workflows.
By running the orchestration in one pane and the target environment in the
other, you completely demystify AI automation. It becomes an auditable script
rather than a black box. If it fails, the agent halts, dumps the core to the
left pane, the user visually inspects the right pane, patches the AST, and
resumes execution.
To make this work using the engine we just proved, we need to bridge the gap
between our isolated Web Worker and the actual Chrome Debugging Protocol (CDP)
/ X11 layer.
Here is a breakdown of how we architect this dual-view studio.
The Architecture: "The Cockpit and the Target"
Because of browser CORS and security models, a standard web page (our
index.html) cannot directly manipulate another tab or open raw TCP WebSockets
to the CDP port. We need a "Bridge" to act as the Host OS for our worker.js.
Option A: The Local Daemon (The System Engineer Route)
Since you already work with REST APIs and X11 tools, the most robust way to
build this is a lightweight local bridge (e.g., FastAPI or Node.js).
* The Launch: You launch your target Chrome instance with --remote-debugging-p
ort=9222.
* The Bridge: A local REST/WebSocket server connects to the CDP port and your
X11 automation tools.
* The Studio: You open your index.html Studio. The left pane runs the
worker.js agent.
* The Execution: When the AST hits a tool like {"type": "EXECUTE_TOOL",
"tool_name": "cdp_click", "params": {"selector": "#login"}}, the Web Worker
emits a REST call to the Local Daemon, which translates it into the CDP
WebSocket command.
Option B: The Chrome Extension (The Portable Route)
If you want this to be a single installable open-source package with zero
local server dependencies, you package the Studio as a Chrome Extension.
* The UI: The Extension opens a full-screen Tab (The Studio).
* The Split View: The Extension uses the chrome.windows or chrome.tabs API to
snap the target tab to the right half of the screen, and the Studio to the
left.
* The Bridge: Extensions have native access to the chrome.debugger API (which
is a direct pipe to CDP) and chrome.scripting. The worker.js passes messages
to the Extension Background Script, which executes the CDP commands on the
target tab natively.
Expanding the AST for Browser Control
To drive this, we just map new EXECUTE_TOOL names to CDP or X11 actions. Your
AST becomes a literal robotic script.
{
"node_nav": {
"type": "EXECUTE_TOOL",
"tool_name": "cdp_navigate",
"params": { "url": "https://news.ycombinator.com" },
"returns_to": "nav_status",
"next": "node_read_dom"
},
"node_read_dom": {
"type": "EXECUTE_TOOL",
"tool_name": "cdp_extract_semantic_tree",
"params": { "target": "body" },
"returns_to": "current_dom_state",
"next": "node_find_link"
}
}
The "Dual View" Synchronization
The magic of this setup is visibility.
* The AST Visualizer: In the left pane, as the agent ticks, the UI highlights
the current node (just like the Mermaid diagrams we looked at).
* The Semantic Overlay: Because you have access to CDP, you can inject CSS
highlights into the target tab on the right. When the agent is "thinking"
about a specific div, the studio instructs CDP to draw a red box around it in
the target tab.
* The X11 Fallback: If the agent encounters a Canvas element or an app where
the DOM is useless, the AST falls back to tool_name: "x11_screenshot", routes
the image to your Vision REST API, gets the coordinates, and uses tool_name:
"x11_click" to bypass the browser entirely.
Open-Source Value Proposition
If you open-source a tool that allows a user to say "Go to this URL, extract
this table, and put it in a CSV," and they can watch the agent build the AST,
step through the DOM, and pause for permission if it gets confused... you
solve the biggest problem with current AI agents: Trust.