# Computer use

One tool, `computer_use`, lets the model operate a screen. Every call names where it lands: a `type`, and a `device` when it is not this computer. Application windows work in the background: nothing comes to the front and the keyboard and mouse stay yours.

## Targets

| Call | Operates | Listed when |
| --- | --- | --- |
| `type="window"` | Application windows on this computer, by element tree, named by `app`: Finder, Notes, Xcode, a chat client, a game launcher. `title` picks one window. | macOS, Linux under X11 or Windows. See [Requirements](#requirements). |
| `type="screen"` | A whole display of this computer, by pixels: the desktop, the menu bar, system dialogs, drags across windows. It moves your pointer. | macOS, after you turn on `computer_use.whole_screen`; off by default |
| `type="browser"` | This conversation's pages in the App's built-in browser; with the App closed, a background browser without the App's sign-ins | The browser application is enabled |
| `type="browser", app="chrome"`, `"safari"`, `"firefox"`, … | Your own browser, with your tabs and sign-ins | The browser is installed; Chromium browsers also need the [extension](#your-own-browser) |
| `device="lab", type="screen"` | The screen of a device you set up, here one named `lab` | The device is an OSWorld virtual machine or a paired computer, and is switched on. See [Another device](#another-machine). |
| `device="studio", type="window"`, `"screen"`, `"browser"` | Windows, screen and browsers of another computer running OpenProgram, here one named `studio`; the call runs there | The computer is paired and switched on. See [Another computer](#another-computer). |

A call without `device` is always this computer, also in a conversation whose commands run on an SSH host or in Docker. A window, browser or application you name without a device is on this computer.

**How the model learns the actions**

| Part | Rule |
| --- | --- |
| What can be operated | A `<devices>` note beside your message lists it by device, this computer first: the whole list at the start and after compaction, then only the changes. Connecting a device leaves the tool's description, and so the prompt cache, unchanged. A target lacking a permission is listed with what to grant. A computer that has not answered for about a minute says so, and later says when it is back. With no target the tool is not offered. |
| First call to a target | Returns the guide of its type (`window`, `screen` or `browser`), a short note on that target (its system, what it lacks, its keys) and its current state. Where code can run, the code guide comes too. |
| Guide delivery | No call is turned back for a guide. A guide counts as read while it is in the model's context; after compaction the next call delivers it again. `action="guide"` or `help("computer_use.window")` shows one. |
| One spelling | An action has one name and one set of arguments on every target. Names from other tools are rewritten, not refused: `left_click` to `click`, `double_click` to `click` with `click_count=2`, `element_index` and `ref` to `element`, `tabs` to `list_tabs`. |
| Checking a call | Before anything runs. A wrong call fails at once with a coded error that says what works instead; see [What the tool refuses](#what-the-tool-refuses). |

## What a step looks like

```
computer_use(type="window", app="Calculator")

0 window "Calculator" actions: AXRaise
  12 static text value="0"
  18 button "7"
  23 button "All Clear"

computer_use(type="window", app="Calculator", action="click", args={"element": 18})
```

Each line: element number, role, label, value, flags such as `[focused]` or `[checked]`, secondary actions.

| Behaviour | Detail |
| --- | --- |
| Result | `Done: …`, then a diff of the tree: `-` disappeared, `+` new or changed |
| Element numbers | Stable while the element stays, new elements get unused numbers. When an app replaces its elements, the tool finds the same control under its number. A number is valid only on the target that printed it. |
| Limits | Trees 1500 elements, screenshots 1568 pixels on the long side. `full=true` on `get_state` returns the whole tree. |
| Settling | At least 0.3 s, until the tree stops changing, at most 1.5 s; 5 s while a spinner or progress bar shows |
| Sparse windows | Fewer than 12 elements (games, canvas editors, remote desktops, some Electron apps): the state also lists text read off the screenshot, such as `"New Game" at (160, 215), 120x30`, and textless icons as outlines like `(112, 169), 55x56`. Recognition runs on the Mac, preferred languages first, per screenshot. |

## Application actions

| Action | Arguments | Effect |
| --- | --- | --- |
| `list_apps` | — | Running and installed apps, with bundle ids |
| `list_windows` | `app` | `window_id`, title, size; main, focused, minimised or on another Space |
| `get_state` | `app`, `window?` or `window_id?`, `full?`, `include?` | Screenshot and tree. Opens a closed app in the background. `window`: title substring or index; the last read stays selected. `include`: `all`, `tree`, `screenshot`. |
| `zoom` | `app`, `x`, `y`, `width`, `height` | A region of the last screenshot at full pixel density. Action coordinates still refer to the screenshot. |
| `find` | `app`, `text?`, `role?` | Elements of the last tree by label, value or placeholder; otherwise screenshot lines showing `text` |
| `click` | `app`, `element` or `x`,`y`, `mouse_button?`, `click_count?`, `modifiers?`, `seconds?` | `modifiers` are keys held during the click, like `super` or `shift+alt`; `seconds` holds the button, up to 10 s |
| `type_text` | `app`, `text`, `element?`, `clear?`, `submit?` | Inserts at the focus, or focuses first. `clear` empties the field first, `submit` presses Return after; if that key fails, the text still counts as typed. Refused on a control that cannot take text. |
| `press_key` | `app`, `key`, `element?`, `seconds?` | One chord in xdotool spelling: `Return`, `super+c`, `ctrl+shift+Tab`, `KP_0`, `F5`. On a Mac `super` means Command. |
| `set_value` | `app`, `element`, `value` | Replaces a whole value, moves a slider, toggles a checkbox |
| `scroll` | `app`, `element` or `x`,`y`, `direction?`, `pages?` or `pixels?` | By pages (fractions allowed) or points |
| `drag` | `app`, `element` or `x`,`y`, `seconds?` | Presses there, moves to `to_element` or `to_x`,`to_y` and releases; `seconds` slows the move |
| `perform_secondary_action` | `app`, `element`, `action_name` | A listed action, such as `AXShowMenu`, `AXIncrement` |
| `select_text` | `app`, `element`, `text`, `prefix?`, `suffix?`, `selection_type?` | Selects a phrase or places the cursor beside it |
| `paste` | `app`, `text`, `format?`, `element?` | Via the clipboard as `text`, `md` or `html`; clipboard restored |
| `copy` | `app`, `element?` | Runs the app's Copy and returns the text; clipboard restored |
| `focus` | `app`, `element` | Moves focus without clicking |
| `menu` | `app`, `menu_path?` | No path: the menu bar. `["View", "Scientific"]`: lists it or chooses a leaf. Ignores case and trailing `…`. No menu opens on screen. |
| `show_window` | `app`, `window?` or `window_id?` | Restores or unhides, without bringing to the front |
| `open_file` | `app`, `path` | Opens a document (absolute path) like Open With, in the background. Refuses programs, scripts, executables and any file for a terminal app. macOS only. |
| `hover` | `app`, `element` or `x`,`y`, `seconds?` | Rests the pointer (default 0.8 s) for tooltips; your cursor does not move. Apps ignoring the pointer in the background show nothing. |
| `wait` | `app`, `seconds?`, `text?` | Up to 10 s (default 1), then what changed; with `text`, until the window shows it, in its tree or read off its screenshot |
| `start_audio_recording` | `app`, `max_duration?` | Records that app's sound, default 60 s, at most 300. Other actions run meanwhile. |
| `stop_audio_recording` | `app`, `transcribe?` | Saves a 16 kHz WAV and returns its path, plus a transcript if a speech engine is set |

`app` is a name, bundle id or `.app` path as `list_apps` prints. `x`,`y` are pixels of that app's latest screenshot. Prefer an element; coordinates are for canvases and custom controls.

Element actions reach hidden, minimised or covered windows; coordinate clicks, drags and wheel scrolls run in the background too. A click or hover on an element scrolled out of view scrolls it in first. An element with no frame, such as an option of a closed dropdown, is refused with a note to open what holds it, and nothing changes.

**What you see on macOS**

While the agent holds a window, a soft accent glow runs inside its edge, its traffic-light buttons turn the accent colour and pulse in turn, and the agent cursor glides to each target and leaves a small dot where it clicks. Your pointer stays put.

The overlay sits just above that window, so a window in front covers it, and it never takes clicks. It fades about 20 seconds after the last step. **Show actions** in the browser toolbar turns it off for Pages and applications. macOS also shows its screen-sharing icon in the menu bar.

## The whole screen

```
computer_use(type="screen", action="list_displays")
computer_use(type="screen", display="2")
computer_use(type="screen", display="2", action="click", args={"x": 640, "y": 412})
```

| Part | Rule |
| --- | --- |
| Off by default | Listed only after `openprogram config set computer_use.whole_screen true`. An ordinary task needs one application, so the model works through `type="window"`; while it is off, a call with `type="screen"` answers that the target does not exist and sends nothing. |
| When | What lies outside one window: the desktop, the menu bar, system dialogs, drags across windows, and windows that ignore background input. For one application, `type="window"` works without taking your pointer. |
| Pixels only | `get_state` is a screenshot of one display, the main one without `display`. `x`,`y` are pixels of the last screenshot of that display; every acting call returns a new one. |
| Actions | `click`, `type_text`, `press_key`, `scroll`, `drag`, `hover`, `wait`, plus `list_displays`, `zoom` and `paste` |
| Real input | The pointer moves where you see it, and keys and text go to the front application. A call holds this computer: other calls on it wait. |
| Left out | Applications you refused and OpenProgram's windows are not in the screenshots, and a step on them is refused (OpenProgram's are allowed in Bypass permissions) |

## Several steps and code

```
computer_use(type="window", app="Calculator", actions=[
  {"action": "click", "args": {"element": 18}},
  {"action": "press_key", "args": {"key": "KP_Multiply"}},
  {"action": "click", "args": {"element": 18}},
  {"action": "press_key", "args": {"key": "KP_Enter"}}
])
```

| Form | Limits | Behaviour |
| --- | --- | --- |
| `actions` | Up to 20, one target and one application, window, tab or display, named once by the call | Run in order, stop at the first error, return the state once. Every step uses the element numbers of the state read before. A failure says how many steps are done. |
| `code` (macOS) | 120 s, 100 actions, first 256 KB of output | Python with top-level `await`, in an isolated interpreter without files, network or processes. `cu` is the call's target: `await cu.get_state()`, `await cu.click(element=3)`. `dir(cu)` and `help(cu.click)` explore. |

**Code and shared windows**

| Part | Rule |
| --- | --- |
| Scope | Code acts only on the target and the application, tab or display its call names, with what single actions can do. Work on two targets takes two calls; variables carry over between them for the turn. |
| Failing step | Raises in the code; earlier steps stay done |
| Running out of time | Returns an error: what was done stays, the current step may or may not have applied, and the next call starts a new interpreter |
| Agent state | Every agent keeps its own window states, element numbers and interpreter. The conversation's turns share theirs, so a later message continues with the same numbers. |
| Sharing an application | Agents take turns on one application: a call holds it until it returns, and another waits up to 60 seconds in all, then answers `SCREEN_BUSY` without sending anything. On different applications they work together, except on Linux and Windows, where clicks, keys and text (on Linux also scrolls, hovers and drags; on Windows pastes) take turns across the whole computer. An agent's next result says when another acted since it last looked, and lists those changes. |

## Web pages

Each tab has a short id such as `tk3fa`, the same across turns, sub-agents and workflow programs; `list_tabs` prints it and every result names the tab it acted on.

`get_state` returns Playwright's accessibility outline, such as `- button "Next" [ref=e12]`; a ref holds while the element is on the page, and an element can be named by `role` and `name` instead.

Every action returns what changed, marked `<changed>` with `[unchanged]` for parts seen; a navigation returns the whole page. A re-rendered ref is found again by role and name; if gone, the error carries the page as it is.

| Action | Arguments | Effect |
| --- | --- | --- |
| `list_tabs` / `create_tab` / `close_tab` | `all?` / `url`, `visible?` / `tab` | List; open, in the background unless `visible: true`; close the tab named. Other actions use the tab this agent last used unless given `tab`. |
| `get_state` | `include?`, `full?` | The outline (`tree`), a `screenshot` of the tab without bringing it forward, or `all`, the default; from code, the outline. Without `full`, what changed since the last read. |
| `click` | `element` or `role`,`name` or `x`,`y`, `mouse_button?`, `click_count?`, `modifiers?` | Right, middle, double and modifier clicks. `x`,`y` stop working once the page was acted on, navigated or scrolled. |
| `type_text` | `text`, `element?`, `clear?`, `submit?` | Inserts at the caret; `clear: true` replaces the field's text; `submit: true` presses Return; no `element` types into the focus |
| `paste` | `text`, `format?`, `element?` | Offers a paste: `md` and `html` format in rich editors |
| `set_value` | `element`, `value` | A field's whole value: options by value or label, a checkbox, a text field |
| `press_key` | `key`, `element?`, `seconds?` | No `element`: to the page's focus |
| `hover` / `drag` / `scroll` | `element` / `element`, `to_element` / `element?`, `direction?`, `pages?` or `pixels?` | `scroll` with `element` moves its nearest scrollable container |
| `navigate` / `back` / `forward` / `reload` / `wait` | `url` / — / `text?`, `seconds?` | `wait` until a text appears, or for seconds |
| `upload_file` | `path`, `element?`, `field?` | A local file up to 50 MiB. The click's file window is held for the agent; `upload_file` answers it. With `element` it does both. |
| `read_console_messages` / `read_network_requests` | `pattern?`, `only_errors?`, `limit?` | Since the agent first used the tab |
| `evaluate` | `script`, `element?` | JavaScript: expression, statements or a function, `await` included. JSON result up to 20,000 characters; a promise gets 30 s; password values redacted. |

| Rule | Detail |
| --- | --- |
| Concurrency | Agents and sub-agents can share the browser. An action holds its tab until its result is read, a list holds the tabs it touches until it ends; a tab held for a minute answers `SCREEN_BUSY`. Each agent has its own current tab and sees all changes since it last looked, told when another acted. Waiting does not block others. |
| Retry | No action is sent twice. A failure after input may have landed answers `OUTCOME_UNKNOWN`, carries the page, and is not retried. |
| New tabs | The result names a tab an action opens; the agent keeps its current tab until it passes the new one. |
| Workflow programs | Confined to the starting window; tabs it opened close when it ends |
| Agent access off | Every action is refused in that conversation |
| Background | Input reaches a tab without activating it. `visible: true` brings it forward, for when you asked to watch. `file://` opens a local file the sandbox lets the agent read. Password values never reach the model. |
| Approval | Opening, acting and `evaluate` ask nothing on built-in tabs. `upload_file` asks in the modes that ask, and Auto reviews each upload. A script runs only in a conversation you started; scheduled runs, outside MCP clients, handoffs and automatic Goals are refused and told to use page actions, whether by action or code. |
| Built-in only | `list_panes`, `start_video_recording` and `stop_video_recording` record one pane of the OpenProgram window |

**Watching and taking over Pages**

Agent-opened Pages stay in the background. **Resources** in the right sidebar lists the conversation's Pages by branch, including child agents'. Continuing a branch keeps its group; identical URLs stay distinct; unowned pages appear under **Unassigned**.

A popup from an Agent's Page loads in the background as its own Page in the same branch, without taking your view, and the next result names it. A popup from a Page you opened opens in front as a tab.

| Control | Effect |
| --- | --- |
| Select a resource | Shows an image preview in chat, without pinning or stealing tab focus |
| **Preview in conversation** | Same Page; adds no top tab; if a webpage occupies center, returns to the owning session |
| **Pin preview** / **Unpin preview** | Chat preview only. Fixed preview holds the page; Auto preview follows the Page last opened, read or acted on by that branch. A pin lasts until the app reloads. |
| **Hide** | Stops capture, keeps the Page. Restore from the resource row or **Preview in conversation**. |
| **Expand** | Enlarges the preview without changing its mode |
| **Open page** | The existing Page as a top tab; hides the preview, which returns with the conversation unless hidden |

| Part | Behaviour |
| --- | --- |
| Tab and preview | Never display together. There is no dimming mask, and the real page stays usable. |
| Toolbar | **Show actions**, **Operation history**, and **Review request** while the Agent waits. In the page these sit behind a small draggable Agent button at bottom right, from the Agent's first operation until the page closes. |
| While the Agent operates | The page's edge glows and its cursor glides to each step; the glow fades when it lets go. Using the page does not pause it; stop its run in the conversation, and the glow stays until stopped. |
| Preview | One compact row, with status only when the Agent needs you or the state cannot be confirmed. While anything in the App is fullscreen, its page is hidden. Default 300×198.75; drag the header or any edge, the aspect stays linked and the page is not resized. |
| Action markers and history | Markers are brief and do not intercept input. History holds operation types and results, not typed text. |
| Closing | Affects every branch referencing the Page. An active Page requests stopping first. Closing differs from hiding. Disconnection shows the last image as stale. |
| Other things the preview follows | A desktop app window, with the latest screenshot after each step, and a Desktop Terminal the Agent takes or types into, live and read-only. Same Auto, pin and close rules. Screenshots stay in memory, gone after a worker restart. These controls apply to exact OpenProgram Pages; application windows, the screen and other machines keep their own approvals. |
| App or worker restart | Unclosed pages return in the background with their tab, session, branch and last confirmed title and URL, as new live pages; old live handles are invalid. Explicitly closed pages stay under **Closed pages**, and a hidden preview stays hidden. |
| After a restart | Rows show **Restoring page…**, **Could not restore page** or **Reconnect** in their original branch. **Continue Agent** is not required; new actions need a fresh observation and current permission. Restore reloads the URL with site storage; unsaved DOM and form values are lost. An older record with no retained tab descriptor reports **Could not restore page**. |

## Your own browser

```
computer_use(type="browser", app="chrome", action="list_tabs")
computer_use(type="browser", app="safari", title="tq7mb", action="click", args={"element": "e12"})
```

Your own browser has your sign-ins and cookies and the same actions as the built-in browser, without its pane recording. Tab ids stay the same across calls. The model is told to use it only when you name the browser or the task needs your signed-in state.

| `app` | Driven through | What you set up once |
| --- | --- | --- |
| `chrome`, `edge`, `brave`, `vivaldi`, `opera`, `arc`, `chromium`; the Beta, Dev and Canary channels as `chrome-beta`, `edge-canary`, … | Microsoft's Playwright MCP server (`@playwright/mcp --extension`), fetched with `npx` | Node.js, and the [Playwright Extension](https://chromewebstore.google.com/detail/playwright-extension/mmlmfjhmonkocbjadbfplnigmagldckm) in that browser. On the first action it asks which tab to share; `openprogram config set computer_use.chrome_extension_token <token>`, with the token the extension shows, skips that. |
| `safari` (macOS) | AppleScript: Safari runs the page script itself | Safari → Settings → Advanced → Show features for web developers, then Develop → **Allow JavaScript from Apple Events**. macOS asks once to let OpenProgram control Safari; screenshots need Screen Recording. |
| `firefox` | Firefox's WebDriver BiDi remote agent on port 9222 | Nothing when Firefox is closed: the first call starts it in the background with the agent on. When it is already running without it, quit Firefox once or start it with `firefox --remote-debugging-port 9222`. |

| Part | Rule |
| --- | --- |
| Listed when | The browser is installed (for a Chromium browser, with the extension in one of its profiles). Names are matched without regard to case, and `"Google Chrome"` or `"Microsoft Edge"` work too. |
| Something missing | A call answers `DEPENDENCY_MISSING` (no Node.js, no extension, browser not installed) or `PERMISSION_MISSING` (Safari's setting or the macOS permission, Firefox running without the agent), naming the fix |
| Choosing a tab | `title` is a tab id or a title only one tab has; a title several tabs share is refused with the candidates |
| Tabs | A step without `title` or `tab` acts on the tab this agent used last there, at first the browser's current tab. Once that tab is gone, such a step answers `BAD_ARGUMENT` naming it, and the agent names the tab. Choosing a tab never brings it to the front. `close_tab` closes only a tab the call names, and `create_tab` opens in the background. |
| Safari and Firefox | Keys and typing reach a tab in the background as page events; Firefox uses real input on the tab in front. Safari takes no `upload_file` and no console or network reads, and a screenshot needs the tab to be the one showing in its window. |
| Filtering | Filtering console messages or requests (`pattern`, `only_errors`, `limit`) is `NOT_SUPPORTED` in Chromium browsers |
| Several agents | One call at a time per browser, from any conversation; another waits up to 60 seconds |
| Approval | One approval covers that browser and everything in it, `evaluate` and uploads included; if the first call is an upload, the card says so |

## Another device

A virtual machine running an [OSWorld](https://os-world.github.io/)-compatible server is set up as a device reached by OSWorld, in **Settings → Devices** or from the terminal:

```
openprogram machines add lab --name "Lab VM" osworld url=http://192.168.64.2:5000
openprogram machines test lab

computer_use(device="lab", type="screen", action="click", args={"x": 640, "y": 412})
```

| Part | Rule |
| --- | --- |
| Server | `GET /screenshot` and `POST /execute` with pyautogui |
| Actions | Pixels only, one display, no clipboard: `get_state`, `click`, `type_text`, `press_key`, `scroll`, `drag`, `hover`, `wait`, by pixels of the last screenshot. Each acting call returns a screenshot. A batch is checked whole first: one bad argument refuses it and nothing is sent. |
| Results | Start with where they come from, `[device="lab", type="screen"]` |
| Device off or unreachable | Stays listed; a call answers `MACHINE_UNREACHABLE` and sends nothing, also when the machine was switched off or removed while the call was on its way. `openprogram machines disable lab` takes it out of the list. |
| Several agents | One call at a time; another waits up to 60 seconds. A stopped call lets the machine go within 10 seconds. |
| Approval | None: setting the device up is the consent. A rule can still deny it. |

### Another computer

A computer paired with this one ([Run conversations on another machine](https://fzkuji.github.io/OpenProgram/docs/capabilities/environments.html)) can be operated too: `computer_use(device="studio", type="window", app="Safari", …)`. The call is sent there and runs on that computer.

| Part | Rule |
| --- | --- |
| On the other computer | Turn on **Settings → Devices → This computer → Let paired devices operate this computer**. It is off by default; until then each call fails and says where to turn it on. |
| Its rules apply | Its whole screen stays off unless turned on there, its system permissions apply, and its own computer use rules apply: a rule that denies or asks refuses the call, since nobody there is asked. |
| Here | You are asked once per application, screen or browser, with a key that names the computer: `studio window safari`, `studio screen`, `studio browser chrome`. |
| When it fails | Offline: answered at once, nothing sent. Revoked there: pair again. An older OpenProgram there: update it. |

## Approval

The first touch of an application shows a card with its icon, name and bundle id and what this step does ("Click element #7"), noting it runs in the background. Raw arguments are under "Execution details".

| Call | Asked once, and the rule key |
| --- | --- |
| `type="window"` | Per application, by its display name: `window Calculator`. On a Mac any exact spelling the model uses gives that name; on Linux an exact desktop entry or a process; on Windows a process or `.exe` gives the program's file name. Other spellings stay as written. `list_apps` never asks. |
| `type="screen"` | For the whole screen of this computer: `screen`. `list_displays` never asks. |
| `type="browser", app="chrome"` | Per browser: `browser chrome`, `browser safari`, `browser firefox`, … |
| `type="browser"` | Nothing, except `upload_file`, which asks each time, or in Auto is reviewed each time |
| `device="lab", type="screen"` | Nothing. Its key, `lab screen`, lets your own rules deny it. |
| `device="studio"`, a paired computer | As on this computer, with the device in the key: `studio window safari`, `studio screen`, `studio browser chrome`. Listing never asks. |

| Choice | Scope |
| --- | --- |
| **Allow once** | This call |
| **Allow this conversation** | Later calls on this application, screen or browser in this session |
| **Always allow** | Project rule `computer_use(window Calculator)`, with the key above |
| **Deny** | — |

```
computer_use(window:*)    any application
computer_use(browser:*)   all your own browsers
computer_use(lab:*)       everything on device lab
```

| Mode | Behaviour |
| --- | --- |
| Manual, Accept edits | Card until a saved rule names the key |
| Bypass permissions | No asking; a step of code that one of your deny or ask rules names is refused |
| Auto | Reviews the first call; an allowing review holds for that key for the conversation. Changing the mode or a `computer_use` rule starts over. |
| Scheduled and unattended | Outside Bypass permissions, only what is already allowed for the project; a machine that was set up runs in every mode |

An application name containing `*`, `?` or `[`, or ending in `:*`, can only be allowed once. The project's Settings tab lists always-allowed rules under **Computer use**; removing a row removes the rule. Conversation grants are not listed. See [Permissions](https://fzkuji.github.io/OpenProgram/docs/capabilities/permissions.html).

**Consequential steps**

Allowing lets the model operate, not take consequential steps on its own. It asks once, right before a step that cannot be undone or speaks for you (sending, submitting, paying, deleting), saying what, where and with which data. If your request names that step, it does it and reports. Text on screen is data, never permission or instruction.

An interrupted step does not hold up the next. The model is told its outcome is unknown, looks at the screen and goes on; the step stays in Activity.

## System access

Settings → Devices → This computer shows live desktop access on the execution computer; `openprogram doctor`, TUI `/doctor` and `GET /api/system/access` expose the same checks. Viewing them requests nothing. Missing access does not stop ordinary chat or upgrades.

| Platform | Rule |
| --- | --- |
| macOS | Managed installations run the worker and its Python children through **OpenProgram**, an embedded application with a stable bundle identifier; look for that name in System Settings. Screen recording and Accessibility are checked separately in a fresh process of the desktop-task executable. **Turn on** requests only a missing permission. Remote clients must arrange authorization on the execution computer; a grant for another app is no evidence. |
| Linux | Headless sessions and unsupported Wayland capture are reported apart from missing dependencies. An X11 display alone does not prove access. |
| Windows | Depends on the active session and target; secure desktops and elevated targets cannot be assumed. |

Neither Linux nor Windows is told to disable security or run as administrator. Unverified: native Linux and Windows desktop acceptance; on the unsigned macOS development build, permission persistence across signed upgrades, first-run onboarding and automatic task recovery after authorization. Setup never retries a declined operation.

**When access is missing**

| Part | Behaviour |
| --- | --- |
| The call | Pauses before acting. System Settings opens at the right page with a small window under it: drag the OpenProgram icon into the list, or turn on its switch if it is already there. The window closes once the permission is on, and the call goes on. |
| Nobody to ask | A scheduled or unattended run does not wait: the call answers `PERMISSION_MISSING` with the permission and where to grant it |
| In the conversation | A brief waiting status and an Open System Settings action; no form, Continue, null result, Retry or Edit on the paused card. Failed and cancelled runs keep their own statuses. |
| Checking and continuing | The worker saves the task and checks through a fresh OpenProgram process, which requests nothing and avoids a stale result. Once available the same task continues once. A turn's later steps do not recheck; the next turn does. |
| While waiting | Closing the page does not stop this, a needed restart rechecks after startup, cancelling prevents continuation, and a failed check keeps waiting. |
| Old conversations | Do not start an operation or reopen prompts; repeated delivery does not reopen authorization when switching conversations. You can still open System Settings. System access does not replace operation approval. |
| Local ad-hoc macOS builds | An update can invalidate a recording grant while the switch stays on. OpenProgram remembers successful checks; if identity changed and recording is denied, the next local authorization renews only its obsolete registration, at most once per identity. Status checks and reconnects never reset permissions. Developer ID releases use the normal flow. |

**Automation errors on macOS**

Apple Events to System Events or a target app need Automation, granted per target and separate from screen recording and Accessibility. On a denial, open **System Settings → Privacy & Security → Automation** on the execution Mac and inspect the requesting app's access to the target.

The failed operation stays failed; changing the setting neither approves nor repeats it. Other native failures keep their actual error.

## When something is in the way

| Situation | Behaviour | Next |
| --- | --- | --- |
| Screen locked (macOS) | Application calls return an error and send nothing; apps and windows stay open | Continue after unlocking. The built-in browser and other machines are unaffected. |
| Application busy (saving, a dialog it just opened) | A step is sent once and waited on up to 10 s. Longer: done, with a note that state could not be read. | The model waits and reads again, never repeating the step |
| Busy, before a read or step | Waits up to 10 s, then fails and sends nothing | `wait` always runs |
| Result unreadable after a step, such as a click that quits the app | The step stays done; the result says why | — |
| Window on another Space | `list_windows` marks it. Screenshots, clicks, scrolls, drags and element actions reach it. Key presses do not: `type_text` and `paste` insert plain text in the focused field, `press_key` reports it cannot. | Only you or the Dock can move it |
| A step opens a window in front | The returned state is of the new window and names what it opened over | `get_state` with `window` goes back |
| macOS Open or Save dialog | Separate process. Clicks and `set_value` reach it; keys do not, and those actions report it. Its file list is not in Accessibility, so state lists text read off the screenshot. | Use `open_file` |

## Requirements

- macOS, Linux with X11 (Xorg), or Windows 10 or 11.
- macOS: the signed runtime (`ai.openprogram.runtime`) must hold **Accessibility** and **Screen Recording**, for `app` and `screen` alike. See [System access](#system-access) and [Permissions](https://fzkuji.github.io/OpenProgram/docs/capabilities/permissions.html).
- `screen`: macOS only, and only with `computer_use.whole_screen` on.

## On Linux and Windows

|  | Linux | Windows |
| --- | --- | --- |
| Tree | AT-SPI: GTK 3, GTK 4, Qt with `QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1` | UI Automation: Win32, WPF, WinForms, Store (UWP, WinUI), Chromium. Screenshots even while covered. |
| Needs | X11 (Wayland cannot drive other windows, so the tool reports unavailable), `python3-gi` with `gir1.2-atspi-2.0` and `gir1.2-gtk-3.0`, `xdotool` | `comtypes`, included in the Windows install |
| Optional | `x11-utils` (tells real windows from helpers), `tesseract-ocr`, `pulseaudio-utils` | `tesseract` on `PATH` |
| Same as macOS | Tree, element numbers, diffs, screenshots, `zoom`, `find`, `actions`, `menu`, `select_text`, `set_value`, scroll by element, approvals | Tree, element numbers, diffs, screenshots, `zoom`, `find`, `actions`, `select_text`, `set_value`, `copy`, `paste` (all formats), scroll by element, recording, approvals |
| Names | Desktop entry id (`org.gnome.Calculator`), name or process, launched through the entry | Start menu name (`Calculator`), executable (`notepad`) or pid, launched from Start |
| Background | Element actions (press, toggle, set value, insert and select text, menu, Return). Pointer at `x`,`y`, `hover` and other keys reach a GTK or Qt window only when focused: it comes forward, then focus and pointer return. `hover` leaves the pointer. The card says so. | Element actions; clicks, scrolls and plain keys are posted without raising; `hover` keeps your pointer |
| Comes forward | As above | Keys with modifiers (`ctrl+s`), `paste` pressing `ctrl+v` in most apps, and pointer input in Store frames, Chromium and Firefox; focus and pointer return. Use Windows shortcuts: `ctrl+c`. |
| `paste`, `copy` | Plain text into the focus, no clipboard, no `md` or `html`. `copy` leaves the clipboard. | `copy` leaves the clipboard. `paste` restores its text, not other formats. |
| `menu` | Apps with a menu bar | Classic menus and UI Automation menus; ribbons are in the tree |
| No tree | Listed "no accessibility tree"; screenshot (OCR with tesseract) and coordinates | OCR with `tesseract` |
| Recording | The app's own and child streams from PipeWire or PulseAudio. PipeWire starts within a quarter second; PulseAudio alone can miss the first second of a playing stream. | Own process tree through process loopback, Windows 10 2004 or later |

Windows support has not yet been run on a Windows machine by the project; report the step that failed.

## Recording sound

Uses the Screen Recording grant and captures only the named application: no other apps, microphone or alert sounds. The newest 20 stay in `~/.openprogram/computer-use/audio/`.

`stop_audio_recording` transcribes with the engine in Settings → Voice: whisper.cpp keeps sound on the Mac, OpenAI and Groq send it there. `transcribe=false` keeps only the file. Silence is reported and not transcribed. A chat model accepting audio, such as Gemini and OpenAI's gpt-audio models, also receives the recording.

## What the tool refuses

| Case | Rule |
| --- | --- |
| OpenProgram's own windows | Only in modes showing approval cards, where the agent could answer its own card; Bypass permissions operates them |
| On `screen` | A pointer step on a refused application or an OpenProgram window; a key or text step while one of them is in front, or, with `computer_use.refuse_password_fields` on, into a password field. Screenshots leave them out. |
| Secure keyboard input on macOS | Does not type; the keys would not arrive |
| `computer_use.refused_apps` | Your list of names or bundle ids |
| `computer_use.refuse_password_fields` | Stops typing into password fields |
| WeChat and Telegram channels, plan mode | Tool not offered |

A refusal names the setting to change.

**Error codes**

| Code | Says |
| --- | --- |
| `UNKNOWN_TARGET` | The targets listed now; it comes before any approval card or review |
| `UNKNOWN_ACTION` | The nearest action, or the targets of the same machine that have it |
| `NOT_SUPPORTED` | What this target lacks and the step that works instead |
| `BAD_ARGUMENT` | The action's arguments and those its type shares; for a wrong or closed tab, the open tabs; for a title that matches several windows or tabs, the candidates |
| `PERMISSION_MISSING` | Which system permission, and where to grant it |
| `DEPENDENCY_MISSING` | What the computer lacks, such as Node.js for your own browser |
| `MACHINE_UNREACHABLE` | Why the machine or browser did not answer, or that the machine was switched off or removed; nothing was sent |
| `OUTCOME_UNKNOWN` | A step was sent without an answer: read the state, do not repeat it |
| `SCREEN_BUSY` | Another agent held it for 60 seconds in all; nothing was sent |
| `ELEMENT_GONE` | The element is no longer there; the current state follows |
| `TIMEOUT` | The steps that took effect before the deadline, or that nothing was sent; an action call stops after 5 minutes |
