|
| 1 | +# `@onkernel/cua-pi-extension` |
| 2 | + |
| 3 | +An installable [pi](https://pi.dev) extension that adds Kernel browser tools to |
| 4 | +pi's existing agent session. pi owns the agent loop, session, and UI; this |
| 5 | +extension contributes the tools, the browser they run against, and the provider |
| 6 | +wiring that provider-native surfaces need. |
| 7 | + |
| 8 | +It does not start a second model loop, and it adds no implicit screenshots or |
| 9 | +prompt instructions. |
| 10 | + |
| 11 | +## Install |
| 12 | + |
| 13 | +```sh |
| 14 | +pi install ./packages/pi-extension |
| 15 | +# or, once published |
| 16 | +pi install npm:@onkernel/cua-pi-extension |
| 17 | +``` |
| 18 | + |
| 19 | +`KERNEL_API_KEY` is required when a tool first executes, not at startup. |
| 20 | +`KERNEL_BASE_URL` is honored. Neither is written to session entries or output. |
| 21 | + |
| 22 | +## Use |
| 23 | + |
| 24 | +No selector means no Kernel tool is active and no browser is provisioned. |
| 25 | + |
| 26 | +```sh |
| 27 | +pi -p --provider openai --model gpt-5.6-sol \ |
| 28 | + --cua-tools browser,browser-act "Open example.com and report its heading" |
| 29 | + |
| 30 | +pi --mode rpc --no-session --provider openai --model gpt-5.6-sol --cua-tools browser |
| 31 | + |
| 32 | +pi -p --provider anthropic --model claude-opus-5 --cua-tools anthropic-computer \ |
| 33 | + "Open example.com and report its heading" |
| 34 | +``` |
| 35 | + |
| 36 | +### Selectors |
| 37 | + |
| 38 | +| selector | tools | |
| 39 | +| --- | --- | |
| 40 | +| `browser` | the CDP browser toolset | |
| 41 | +| `computer` | the canonical computer toolset | |
| 42 | +| `mixed` | both, deduplicated | |
| 43 | +| `browser-act` | `browser_act` alone, the verified-plan tool | |
| 44 | +| `browser-batch`, `computer-batch` | one mechanical batch tool | |
| 45 | +| `playwright` | `playwright_execute` | |
| 46 | +| `anthropic-computer`, `anthropic-browser` | Anthropic's native surfaces | |
| 47 | +| `openai-computer` | OpenAI's native computer tool | |
| 48 | +| `google-browser` | Google's predefined browser action set | |
| 49 | +| any individual tool name | that tool alone | |
| 50 | + |
| 51 | +`--cua-coordinates` selects `pixels` (default) or `normalized-1000` for the |
| 52 | +computer toolset's coordinate contract. |
| 53 | + |
| 54 | +### Commands |
| 55 | + |
| 56 | +- `/cua` — current selectors, active tools, and browser status. |
| 57 | +- `/cua-tools` — with no argument, list every selector for the current model, |
| 58 | + marking the selected ones and showing the compiler's own reason for any that |
| 59 | + this model cannot take. With an argument, replace the selection. `none` clears |
| 60 | + it. |
| 61 | + |
| 62 | +A selection is checked by compiling it, so a model that cannot take a tool |
| 63 | +deactivates it with a reason rather than failing at request time. Switching |
| 64 | +models re-checks, and restores a previously forced-off selection when the new |
| 65 | +model can take it. |
| 66 | + |
| 67 | +### Browser |
| 68 | + |
| 69 | +| flag | effect | |
| 70 | +| --- | --- | |
| 71 | +| `--cua-browser-session` | attach an existing session; never deleted on exit | |
| 72 | +| `--cua-profile-id`, `--cua-profile-save-changes` | load and optionally persist a profile | |
| 73 | +| `--cua-proxy-id` | route through a Kernel proxy | |
| 74 | +| `--cua-browser-timeout` | owned-browser timeout in seconds (default 300) | |
| 75 | + |
| 76 | +One browser is provisioned lazily per session, on first tool execution. |
| 77 | +Compiling declarations, generating headers, and transforming a payload never |
| 78 | +provision one. An owned browser is deleted on session shutdown. |
| 79 | + |
| 80 | +## Development |
| 81 | + |
| 82 | +```bash |
| 83 | +npm run typecheck --workspace @onkernel/cua-pi-extension |
| 84 | +npm test --workspace @onkernel/cua-pi-extension |
| 85 | +``` |
| 86 | + |
| 87 | +The test suite includes an end-to-end run that spawns real `pi` in print and RPC |
| 88 | +modes against a fake provider and Kernel server. |
| 89 | + |
| 90 | +## License |
| 91 | + |
| 92 | +MIT |
0 commit comments