oira666_pi-browser-agent
v0.0.4
Published
Pi browser agent broker skeleton with lazy browser tool registration
Readme
pi-browser-agent
pi-browser-agent is a pi extension that starts a local WebSocket broker and registers a browser-driving tool suite for browser-agent-ext.
What it does
- starts a loopback-only broker on
ws://127.0.0.1:7878by default - registers the full
browser_*tool suite at session start when the broker starts listening - exposes
activate_browser_agent_toolsas a self-check / status tool - forwards tool calls to
browser-agent-ext - keeps browser-task history on disk for local inspection
Install
Add the extension to pi from this repo checkout or package it as an npm pi extension.
Local checkout
{
"extensions": ["./pi-browser-agent/src/index.ts"]
}npm package form
When this package is published, the install shape is:
pi install npm:oira666_pi-browser-agentFor the current in-repo state, use the local-checkout form above.
Runtime requirements
- A pi session with this extension enabled.
- Chrome with
browser-agent-extloaded unpacked. - In the extension options, Enable pi bridge must be on.
- The bridge URL must point at the broker, usually
ws://127.0.0.1:7878.
First use in a pi session
All browser_* tools are registered at session start when the broker starts listening. activate_browser_agent_tools remains available as a self-check / status tool:
activate_browser_agent_toolsThe full toolkit registered for the session is:
browser_run_taskbrowser_get_task_historybrowser_list_tasksbrowser_get_screenshotbrowser_get_htmlbrowser_get_dom_infobrowser_get_computed_stylesbrowser_get_console_logsbrowser_get_networkbrowser_get_accessibility_treebrowser_get_performance_metricsbrowser_evaluate_jsbrowser_run_jsbrowser_list_tabsbrowser_switch_tabbrowser_close_tabbrowser_navigatebrowser_reloadbrowser_wait_forbrowser_clear_site_data
Configuration
Environment variables:
PI_BA_HOST— broker bind host, default127.0.0.1PI_BA_PORT— broker port, default7878PI_BA_TASK_TTL_DAYS— task-history retention
If port 7878 is busy, the broker fails fast and asks you to set PI_BA_PORT.
WSL → Windows Chrome
Loopback usually works with modern WSL setups. If your Windows Chrome cannot reach the broker on 127.0.0.1:
- start pi with
PI_BA_HOST=0.0.0.0 - find the WSL IP
- set the extension bridge URL to
ws://<wsl-ip>:7878
Example:
PI_BA_HOST=0.0.0.0 piNotes
- The broker never synthesizes browser input. Browser actions still go through the extension runtime and its configured input backend.
- Large text results are truncated and the full payload is spilled to a temp file.
- Large screenshots are spilled to a temp file instead of being inlined.
