# Computer use interface

## Agent cursor

| Item |  |
| --- | --- |
| Step point | Before a step that names an element or a point, `MacComputer.act` computes where it lands (the element's centre from its `AXPosition` and `AXSize`, or the screenshot point mapped through the window origin and scale) and calls `native_window.note_action_point`, then waits `CUE_LEAD_SECONDS` (0.15 s) so the cursor arrives first. |
| Coordinate space | The point is in screen points with the origin at the top left of the main display, the space Electron also uses. |
| Frame | The worker broadcasts it as a `native.action` frame (`session_id`, `x`, `y`, `sequence`, `at`, `action`, `app_name`); an agentic subprocess forwards it through the same parent channel as operated windows (`kind: "action"`). |
| Web client | In the web client `native-window-store.ts` hands the frame to `openprogramDesktop.nativeActionCue` unless **Show actions** is off. |
| Drawing | The desktop main process (`main/worker/agent-control.js`) draws it in the conversation's control overlay: the cursor glides there and stays. |
| Deduplication | Every App window receives the frame, so the main process drops a step it has already shown by `session_id`, `sequence` and `at`. |
| Platforms | Linux and Windows do not emit points yet. |

## Window marker

| Item |  |
| --- | --- |
| Marker | The operated window carries the macOS screen-sharing marker, as under Codex Computer Use: a badge over its title-bar buttons and the sharing icon in the menu bar. macOS draws both for any window under a live ScreenCaptureKit stream, so `window_watch.WindowWatch` keeps one open on it. |
| Touch | `MacComputer` touches it with the window id, the app's name and the frame of its title-bar buttons (read through Accessibility) on every `act` and every `get_state` that names a window. |
| Stream | The stream filters to that one window (`SCContentFilter.initWithDesktopIndependentWindow`), asks for a 2x2 frame at one frame a second and attaches no output, so nothing is recorded. |
| Release | Each session watches at most one window: moving to another window releases the previous one, and a window with no step for `IDLE_SECONDS` (20 s) is released by a sweep timer. |
| Failure | Opening the stream runs on its own thread and its failures are ignored, so a step never waits on or fails because of the marker. |

| Item |  |
| --- | --- |
| Place report | While a window is watched, a second thread reports its place when it changed: `window_place` reads the on-screen window list for the window's frame and the windows in front of it within `GLOW_MARGIN` (32 pt), leaving out windows titled `OVERLAY_TITLE` (the App's own overlays). |
| When the place is read | An Accessibility observer on each application with a window on screen (`ax_events.ScreenEvents`) says a window was created, moved, resized, minimized, restored or closed, or focus moved: one read per burst. At least every `RESYNC_SECONDS` (5 s); every `REPORT_SECONDS` (0.12 s) without Accessibility access. |
| Control frame | The report goes through `native_window.note_control` with the owner captured when the window was touched, as a `native.control` frame (`session_id`, `window_id`, `active`, `app_name`, `frame`, `buttons`, `occluders`); a subprocess forwards it as `kind: "control"`. |
| End | Releasing the window sends `active: false`. |
| Web client | The web client passes reports to `openprogramDesktop.nativeControl` while **Show actions** is on, and always passes the end. |
| Overlay window | The desktop main process keeps one transparent, click-through, unfocusable window per conversation over the window plus the margin and loads `/menu-overlay/agent-control`, which draws the inward glow, the accent lights over the buttons and the cursor. |
| Stacking | The overlay sits in the window stack directly above the controlled window (`moveAbove` with its window id, ordered again on every report because the stack changes whenever the user switches apps), so a window in front of the controlled one also covers the overlay; only when the window server refuses that order does it float above all windows. |
| Covering windows | Either way covering windows are cut out of the glow and lights, and the cursor hides while its point lies under one. |
| Look | Its look is set in [Agent control overlay](https://fzkuji.github.io/OpenProgram/docs/reference/design/ui/browser/agent-control-overlay.html). |

## Web presentation

| Item |  |
| --- | --- |
| Reading a call | `lib/computer-use/computer-use-call.ts` reads every `computer_use` call and nothing else does: `callTarget` reads `device`, `type` and a browser's `app` into the target's key, device and type, and `callStep` gives one flat step in the present names (`presentAction` is the web's copy of the rewrite table in `actions/vocabulary.py`). `appStepArgs` gives a window call's step, `screenStep` another call's action, `resultBody` drops the target header and guides, `resultFailed` reads `Error:` and the coded failures. |
| Stored calls | History keeps what a model wrote: the action and argument names other tools use, which `actions/vocabulary.py` rewrites, are read here too and shown in the present wording. Calls written in an earlier shape of the tool are not read: nothing before 2.0 is kept working. |
| App steps | `tool-presentation.ts` renders window steps with the monitor icon and the system tone; the title names the action and the application ("Clicked in Calculator"), the target line shows the key, text, action name or window where one is given. |
| Other calls | Browser calls show the action and URL under "Chrome", "Safari", … or "Browser on <machine>"; screen calls the action ("Clicked on the screen", "Hovered on Lab VM's screen"), with the machine's name from Settings (`rememberMachineNames`; a message draws again when the list arrives or a machine is renamed); code "Ran code in <app>". A conversation recorded while the tool could pass a task on shows that call as "Handed to a new agent" with the brief's first line. |
| Approval card | The approval card's scope buttons add "Allow this conversation" between once and always, and the answer summary prints "Allowed for this conversation". |
| Old calls | Calls recorded by the earlier tools (`computer_use`, `web_use`, `gui_agent`) keep their renderers so old conversations read. |

## Interface work

| Item |  |
| --- | --- |
| Card header | The approval card (`computer-use-approval.tsx`) is used for this computer's window and screen calls and the user's own browsers (`asksAboutComputerUse`); a call with a device never asks. For a window call it leads with the application itself, the one the call names or else the first one its steps name: its icon, display name and bundle id come from the `computer_use_apps` WebSocket action, which calls the backend's `app_info` and launches nothing, and the web caches them per name (`lib/net/computer-use-apps.ts`). |
| Card body | Below it a chip names the step in words (`computer-use-step.ts`), two lines state that the step runs in the background (or, for audio, that only that application's sound is recorded) and what the offered scopes cover, and the arguments without empty values fold into "Execution details". |

| Item |  |
| --- | --- |
| Section | The project's Settings tab has a Computer use section (`computer-use-apps-section.tsx`) between the default settings and the permission rules. |
| Rows | It lists the project's `computer_use(window <application>)` allow rules as one row per application with icon, name, bundle id and a remove control. The generic rule list leaves those rules out and words every other computer-use key under its rule (`computerUseRuleWords`: the screen, Chrome, every surface of Lab VM). |
| Removing | Removing a row removes the rule. |
| Conversation grants | Conversation-scoped grants are session rules that end with their conversation, so the section does not list them. |

The person points the agent at things the way Codex lets them:

| Item |  |
| --- | --- |
| Comment and region | In a web tab, **Comment on the page…** picks one element and adds its selector, text and the comment to the draft; **Screenshot a region…** lets them drag a rectangle and adds those pixels as a PNG attachment. |
| Isolated world | Both run in one isolated world (`PICKER_WORLD` in `apps/desktop/main/web-views/web-views.js`) that shares a cancel hook, so one mode ends the other. |
| Region overlay | The region overlay is removed and two frames are painted before `capturePage` takes the rectangle, scaled by the page zoom. |
| Delivery | The file reaches the target conversation through `lib/chat/composer-inbox.ts`: the composer showing that conversation takes it as a dropped file, and it waits there until one does. |
| @ menu | The composer's `@` menu lists, above the files, every web page the conversation's Resources lists, windows of other applications shown in tabs, and running apps (`attach/mention/mention-sources.ts`). A tab is written as a markdown link to its address, an app as its name and bundle id, and a window with the call that reaches it (`target "app", app "Notes", window_id 812`), so "this tab" resolves without the model guessing. |
| Running apps | The `@` menu's running apps come from `computer_use_apps` with `running: true` (regular apps other than the refused ones), cached ten seconds. |

## Implementation status

| State | Scope |
| --- | --- |
| Implemented | element comments and region screenshots in web tabs; `@`-mentions of the conversation's pages, windows in tabs and running apps. |
| Implemented on macOS | the control overlay over desktop apps (inward glow, accent title-bar lights and agent cursor), with unit tests for the window place and step point frames and for the desktop overlay window. Not implemented: the Linux and Windows backends report neither window places nor step points, so no overlay shows there. |
| Implemented on macOS | the window marker, with unit tests for watching, switching and idle release. Not implemented on Linux and Windows. |

[Computer and browser use](https://fzkuji.github.io/OpenProgram/docs/reference/design/integrations/computer-use/computer-and-browser-use.html)
