@roam-agent/roam-computer-use 0.0.0-stage → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +80 -2
- package/assets/reference/img.jpg +0 -0
- package/docs/README.md +45 -0
- package/docs/content/docs/explanation/action-pipeline.mdx +36 -0
- package/docs/content/docs/explanation/architecture.mdx +161 -0
- package/docs/content/docs/explanation/index.mdx +19 -0
- package/docs/content/docs/explanation/meta.json +5 -0
- package/docs/content/docs/explanation/observation-pipeline.mdx +37 -0
- package/docs/content/docs/explanation/platform-boundary.mdx +37 -0
- package/docs/content/docs/explanation/state-and-scheduling.mdx +35 -0
- package/docs/content/docs/how-to-guides/develop-and-validate.mdx +112 -0
- package/docs/content/docs/how-to-guides/index.mdx +12 -0
- package/docs/content/docs/how-to-guides/linux.mdx +68 -0
- package/docs/content/docs/how-to-guides/meta.json +1 -0
- package/docs/content/docs/how-to-guides/troubleshooting.mdx +126 -0
- package/docs/content/docs/index.mdx +67 -0
- package/docs/content/docs/meta.json +5 -0
- package/docs/content/docs/reference/agent/contract.mdx +162 -0
- package/docs/content/docs/reference/agent/index.mdx +8 -0
- package/docs/content/docs/reference/agent/meta.json +8 -0
- package/docs/content/docs/reference/agent/tools.mdx +221 -0
- package/docs/content/docs/reference/codebase.mdx +139 -0
- package/docs/content/docs/reference/configuration.mdx +113 -0
- package/docs/content/docs/reference/index.mdx +28 -0
- package/docs/content/docs/reference/meta.json +10 -0
- package/docs/content/docs/reference/platforms/index.mdx +18 -0
- package/docs/content/docs/reference/platforms/macos/accessibility.mdx +61 -0
- package/docs/content/docs/reference/platforms/macos/actions.mdx +63 -0
- package/docs/content/docs/reference/platforms/macos/capture.mdx +58 -0
- package/docs/content/docs/reference/platforms/macos/implementation.mdx +98 -0
- package/docs/content/docs/reference/platforms/macos/index.mdx +16 -0
- package/docs/content/docs/reference/platforms/macos/meta.json +10 -0
- package/docs/content/docs/reference/platforms/macos/root-targeting.mdx +47 -0
- package/docs/content/docs/reference/platforms/meta.json +8 -0
- package/docs/content/docs/reference/platforms/windows.mdx +75 -0
- package/docs/content/docs/tutorials/getting-started.mdx +46 -0
- package/docs/content/docs/tutorials/index.mdx +10 -0
- package/docs/content/docs/tutorials/meta.json +1 -0
- package/extensions/computer-use.ts +235 -0
- package/native/linux/bridge-rs/Cargo.lock +1204 -0
- package/native/linux/bridge-rs/Cargo.toml +21 -0
- package/native/linux/bridge-rs/src/atspi.rs +670 -0
- package/native/linux/bridge-rs/src/error.rs +65 -0
- package/native/linux/bridge-rs/src/lib.rs +11 -0
- package/native/linux/bridge-rs/src/main.rs +1110 -0
- package/native/linux/bridge-rs/src/protocol.rs +49 -0
- package/native/linux/bridge-rs/src/state.rs +293 -0
- package/native/linux/bridge-rs/src/wayland.rs +89 -0
- package/native/linux/bridge-rs/src/x11.rs +909 -0
- package/native/linux/bridge-rs/tests/protocol_tests.rs +73 -0
- package/native/macos/activity_glow.swift +169 -0
- package/native/macos/bridge.swift +3968 -0
- package/native/windows/bridge-rs/Cargo.lock +396 -0
- package/native/windows/bridge-rs/Cargo.toml +30 -0
- package/native/windows/bridge-rs/src/capture.rs +561 -0
- package/native/windows/bridge-rs/src/error.rs +81 -0
- package/native/windows/bridge-rs/src/input.rs +501 -0
- package/native/windows/bridge-rs/src/lib.rs +85 -0
- package/native/windows/bridge-rs/src/main.rs +1683 -0
- package/native/windows/bridge-rs/src/protocol.rs +53 -0
- package/native/windows/bridge-rs/src/refs.rs +237 -0
- package/native/windows/bridge-rs/src/state.rs +55 -0
- package/native/windows/bridge-rs/src/uia.rs +1252 -0
- package/native/windows/bridge-rs/src/window.rs +718 -0
- package/native/windows/bridge-rs/tests/protocol_tests.rs +252 -0
- package/native/windows/bridge-rs/tests/refs_tests.rs +86 -0
- package/native/windows/bridge-rs/tests/state_tests.rs +33 -0
- package/package.json +104 -5
- package/prebuilt/macos/arm64/bridge +0 -0
- package/prebuilt/macos/x64/bridge +0 -0
- package/roam/README.md +52 -0
- package/roam/bridge/macos/arm64/bridge +0 -0
- package/roam/bridge/macos/x64/bridge +0 -0
- package/roam/bridge/manifest.json +20 -0
- package/roam/helper-path.d.mts +9 -0
- package/roam/helper-path.mjs +36 -0
- package/roam/identity.d.mts +16 -0
- package/roam/identity.mjs +64 -0
- package/roam/index.ts +51 -0
- package/roam/redirect.ts +51 -0
- package/roam/repair.ts +120 -0
- package/scripts/build-native.mjs +286 -0
- package/scripts/setup-helper.mjs +635 -0
- package/src/actions.ts +130 -0
- package/src/bridge.ts +2594 -0
- package/src/cdp.ts +658 -0
- package/src/config.ts +226 -0
- package/src/contract.ts +107 -0
- package/src/extension/index.ts +9 -0
- package/src/find-params.ts +21 -0
- package/src/note.ts +195 -0
- package/src/outline.ts +702 -0
- package/src/output.ts +134 -0
- package/src/permissions.ts +111 -0
- package/src/platform/architecture.ts +23 -0
- package/src/platform/coerce.ts +16 -0
- package/src/platform/index.ts +61 -0
- package/src/platform/linux/backend.ts +186 -0
- package/src/platform/linux/helper.ts +238 -0
- package/src/platform/macos/backend.ts +147 -0
- package/src/platform/macos/browser.ts +110 -0
- package/src/platform/macos/helper.ts +369 -0
- package/src/platform/macos/permissions.ts +146 -0
- package/src/platform/types.ts +229 -0
- package/src/platform/windows/backend.ts +142 -0
- package/src/platform/windows/helper.ts +140 -0
- package/src/root-selection.ts +25 -0
- package/src/runtime.ts +129 -0
- package/src/state.ts +146 -0
- package/src/view.ts +147 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Actions and input delivery'
|
|
3
|
+
description: 'AX delivery, synthesized event, foreground fallback, strict headless, and outcome evidence reference.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
{/* This file is generated by scripts/docs-generators/generate-source-references.mjs. Do not edit it directly. */}
|
|
7
|
+
|
|
8
|
+
Action delivery is divided between model-level coordination in [`src/bridge.ts`](https://github.com/injaneity/pi-computer-use/blob/main/src/bridge.ts) and native grounding, delivery, and verification in [`native/macos/bridge.swift`](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift).
|
|
9
|
+
|
|
10
|
+
## Delivery order
|
|
11
|
+
|
|
12
|
+
Ref-based actions prefer the least disruptive credible strategy:
|
|
13
|
+
|
|
14
|
+
1. use a supported semantic AX operation;
|
|
15
|
+
2. use background event delivery when semantic delivery is unavailable and policy permits it;
|
|
16
|
+
3. request foreground delivery only when the action requires focus or a checked background attempt proves it had no effect.
|
|
17
|
+
|
|
18
|
+
Coordinate clicks and focus-dependent steps can begin in the foreground. Ambiguous pointer outcomes are not replayed because repeating an uncertain click can duplicate a side effect.
|
|
19
|
+
|
|
20
|
+
Actions and the successor capture stay on the root the state belongs to; `act_ui` does not redirect to a foreground modal. A modal that appears afterwards is reported in `rootDelta` as `appeared`.
|
|
21
|
+
|
|
22
|
+
## AX delivery
|
|
23
|
+
|
|
24
|
+
Eligible presses use `AXPress`, text replacement writes `AXValue`, and semantic scrolling searches the target and ancestor chain for AX scroll actions. These paths are described in [Accessibility and AX](./accessibility.mdx).
|
|
25
|
+
|
|
26
|
+
## Synthesized delivery
|
|
27
|
+
|
|
28
|
+
Web-backed editable controls and controls without usable AX actions can require synthesized keyboard or pointer events. Background events use [`CGEvent.postToPid(_:)`](https://developer.apple.com/documentation/coregraphics/cgevent/posttopid%28_%3A%29). Foreground delivery activates and raises the target before posting at the [CG event tap](https://developer.apple.com/documentation/coregraphics/cgevent/post%28tap%3A%29).
|
|
29
|
+
|
|
30
|
+
These are synthesized events, not physical hardware input. Before foreground coordinate delivery, the helper hit-tests the intended point with AX. An unrelated resolved element produces `occluded_target`; an unavailable or coarse result remains unknown rather than proving visibility.
|
|
31
|
+
|
|
32
|
+
## Headless policy
|
|
33
|
+
|
|
34
|
+
`headless: true` is a strict prohibition, not a preference. It maps the transaction to the native `ax_only` policy. The helper fails these actions with `foreground_required` before it posts events or activates the target:
|
|
35
|
+
|
|
36
|
+
- coordinate delivery: raw `x`/`y` targets, `moveMouse`, `drag`, and press, click, `setText`, or scroll requests whose Accessibility operation is unavailable or fails;
|
|
37
|
+
- `typeText` and `keypress`, including ref-targeted requests;
|
|
38
|
+
- `setText` inside web content, which needs synthesized keyboard input.
|
|
39
|
+
|
|
40
|
+
The bridge returns that error instead of retrying in the foreground. `ax_only` actions never display the agent cursor overlay.
|
|
41
|
+
|
|
42
|
+
Without strict headless mode, ref-based work normally starts in the background and can escalate only through checked fallback rules.
|
|
43
|
+
|
|
44
|
+
## Outcome evidence
|
|
45
|
+
|
|
46
|
+
Native results distinguish:
|
|
47
|
+
|
|
48
|
+
- `worked`: observable evidence supports the intended effect;
|
|
49
|
+
- `didnt`: checked evidence supports that the intended effect did not occur;
|
|
50
|
+
- `unknown`: delivery happened, but available evidence cannot prove the application-level result.
|
|
51
|
+
|
|
52
|
+
Text writes and text entry can use read-back evidence. Pointer actions often need value, selection, focused-window, sheet, or root-delta changes; a successfully posted event alone is not universal proof. When the source root disappears after delivery, the result reports `target_closed` with its cause, as described in the [root targeting reference](./root-targeting.mdx#post-action-outcomes).
|
|
53
|
+
|
|
54
|
+
## Agent cursor overlay
|
|
55
|
+
|
|
56
|
+
When `cursor_overlay` is enabled, non-headless pointer actions delivered in the background with `postToPid` schedule the noninteractive AppKit/SwiftUI agent cursor at the grounded point. Foreground actions that control the physical cursor don't display the overlay. The overlay ignores mouse events, cannot become key or main, and hides automatically. It is visual only and currently limited to the main display.
|
|
57
|
+
|
|
58
|
+
For state ownership, batching, and successor observations, use the generated [agent state and action contract](../../agent/contract.mdx). For line-level implementation citations and every current limit, use the [complete macOS implementation reference](./implementation.mdx).
|
|
59
|
+
|
|
60
|
+
<details className="reference-provenance">
|
|
61
|
+
<summary>source provenance</summary>
|
|
62
|
+
<p>Generated from <a href="https://github.com/roam-agent/roam-computer-use/blob/main/native/macos/bridge.swift"><code>native/macos/bridge.swift</code></a>. The evidence check requires <code>postToPid</code>, <code>cghidEventTap</code>, <code>ax_only</code>, <code>AgentCursor</code>; external API citations remain independently maintained.</p>
|
|
63
|
+
</details>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Capture and OCR'
|
|
3
|
+
description: 'Screen Recording, Core Graphics pairing, ScreenCaptureKit, fallback capture, and Vision OCR reference.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
{/* This file is generated by scripts/docs-generators/generate-source-references.mjs. Do not edit it directly. */}
|
|
7
|
+
|
|
8
|
+
macOS image evidence is separate from Accessibility. A target can have a complete AX outline while capture fails, or a valid image while its AX tree is sparse.
|
|
9
|
+
|
|
10
|
+
## Screen Recording permission
|
|
11
|
+
|
|
12
|
+
The helper preflights Screen Recording with [`CGPreflightScreenCaptureAccess()`](https://developer.apple.com/documentation/coregraphics/cgpreflightscreencaptureaccess%28%29) and requests it with [`CGRequestScreenCaptureAccess()`](https://developer.apple.com/documentation/coregraphics/cgrequestscreencaptureaccess%28%29). It additionally requires a nonempty [`SCShareableContent`](https://developer.apple.com/documentation/screencapturekit/scshareablecontent) query before reporting capture readiness.
|
|
13
|
+
|
|
14
|
+
That content query is a project readiness check, not an Apple-defined permission-status API. Passing it does not guarantee that every later window capture will succeed.
|
|
15
|
+
|
|
16
|
+
## Window identity and pairing
|
|
17
|
+
|
|
18
|
+
[`CGWindowListCopyWindowInfo`](https://developer.apple.com/documentation/coregraphics/cgwindowlistcopywindowinfo%28_%3A_%3A%29) supplies window IDs, owner PIDs, bounds, layers, titles, onscreen state, and ordering candidates. AX windows do not expose the same project-owned identifier, so the helper pairs AX and Core Graphics windows using title, geometry, onscreen state, and one-to-one assignment.
|
|
19
|
+
|
|
20
|
+
Pairing metadata reports `exact`, `high`, or `low` confidence. A low-confidence match is useful evidence but is not guaranteed identity. A root with no matching Core Graphics window is unpaired and has no `windowId`.
|
|
21
|
+
|
|
22
|
+
## ScreenCaptureKit path
|
|
23
|
+
|
|
24
|
+
For a requested image, the helper:
|
|
25
|
+
|
|
26
|
+
1. retrieves the matching `SCWindow` from `SCShareableContent`;
|
|
27
|
+
2. creates an `SCContentFilter` for that desktop-independent window;
|
|
28
|
+
3. disables cursor rendering and ignores single-window shadows;
|
|
29
|
+
4. captures one frame with [`SCScreenshotManager.captureImage`](https://developer.apple.com/documentation/screencapturekit/scscreenshotmanager/captureimage%28contentfilter%3Aconfiguration%3Acompletionhandler%3A%29).
|
|
30
|
+
|
|
31
|
+
`SCScreenshotManager` requires macOS 14, which is why the helper's deployment target is macOS 14 or newer.
|
|
32
|
+
|
|
33
|
+
Visual observation of an unpaired root fails with `root_not_capturable`; use semantic observation (`image: never`). No other window is captured in its place.
|
|
34
|
+
|
|
35
|
+
## Fallback capture
|
|
36
|
+
|
|
37
|
+
If ScreenCaptureKit times out or fails, the helper invokes `/usr/sbin/screencapture -x -l <window-id>` and reads an owner-only temporary PNG. This is a fallback implementation detail, not a guarantee that capture will work after a ScreenCaptureKit failure.
|
|
38
|
+
|
|
39
|
+
## OCR and picture-only nodes
|
|
40
|
+
|
|
41
|
+
Forced visual observation runs Vision's accurate [`VNRecognizeTextRequest`](https://developer.apple.com/documentation/vision/vnrecognizetextrequest), with language correction disabled. Nonduplicate recognized text boxes are attached to the outline.
|
|
42
|
+
|
|
43
|
+
OCR-derived nodes are marked `pictureOnly`. They can provide text and geometry evidence, but ref-targeted Accessibility actions are blocked because no corresponding AX element exists. A coordinate action can use visual evidence only when the saved observation includes the required image geometry.
|
|
44
|
+
|
|
45
|
+
## Failure boundaries
|
|
46
|
+
|
|
47
|
+
- A successful permission readiness check does not guarantee capture of every window.
|
|
48
|
+
- Protected, remote, transient, or rapidly closing surfaces may not produce an image.
|
|
49
|
+
- AX-to-Core-Graphics pairing can be uncertain, and unpaired roots are never capturable.
|
|
50
|
+
- OCR recognizes pixels, not control semantics.
|
|
51
|
+
- Outline-only menu roots cannot be coordinate targets without image geometry.
|
|
52
|
+
|
|
53
|
+
For semantic UI structure, use [Accessibility and AX](./accessibility.mdx). For coordinate delivery and outcome evidence, use [Actions and input delivery](./actions.mdx).
|
|
54
|
+
|
|
55
|
+
<details className="reference-provenance">
|
|
56
|
+
<summary>source provenance</summary>
|
|
57
|
+
<p>Generated from <a href="https://github.com/roam-agent/roam-computer-use/blob/main/native/macos/bridge.swift"><code>native/macos/bridge.swift</code></a>. The evidence check requires <code>CGPreflightScreenCaptureAccess</code>, <code>SCScreenshotManager.captureImage</code>, <code>VNRecognizeTextRequest</code>; external API citations remain independently maintained.</p>
|
|
58
|
+
</details>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'macOS implementation reference'
|
|
3
|
+
description: 'Source-backed macOS requirements, APIs, permissions, capture, actions, and current limits.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
{/* This file is generated by scripts/docs-generators/generate-source-references.mjs. Do not edit it directly. */}
|
|
7
|
+
|
|
8
|
+
This page describes the current macOS implementation, not an intended design. Apple links establish the platform API semantics; source links establish what this project actually does.
|
|
9
|
+
|
|
10
|
+
For focused lookup, use [Accessibility and AX](./accessibility.mdx), [Capture and OCR](./capture.mdx), [Actions and input delivery](./actions.mdx), or [Root targeting](./root-targeting.mdx). This complete page remains the source-backed inventory of requirements, helper behavior, and current limits.
|
|
11
|
+
|
|
12
|
+
## Support boundary
|
|
13
|
+
|
|
14
|
+
The helper requires macOS 14 or newer because it is compiled with a `14.0` deployment target and uses `SCScreenshotManager`, which Apple introduced in macOS 14 ([Apple: `SCScreenshotManager`](https://developer.apple.com/documentation/screencapturekit/scscreenshotmanager), [setup-helper.mjs](https://github.com/injaneity/pi-computer-use/blob/main/scripts/setup-helper.mjs#L46), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L3177)). Builds target Apple silicon and Intel (`arm64` and `x86_64`) ([setup-helper.mjs](https://github.com/injaneity/pi-computer-use/blob/main/scripts/setup-helper.mjs#L42)).
|
|
15
|
+
|
|
16
|
+
The normal runtime uses the per-user `~/Applications/pi-computer-use.app`; existing writable system-wide installs remain at `/Applications/pi-computer-use.app`, and `PI_COMPUTER_USE_HELPER_APP_PATH` selects an explicit location ([helper-path.mjs](https://github.com/injaneity/pi-computer-use/blob/main/src/platform/macos/helper-path.mjs#L15)). The bundle identifier is `com.injaneity.pi-computer-use`, and the daemon listens on a Unix-domain socket below `~/Library/Caches/pi-computer-use/`. The TypeScript client launches the resolved app with `open -n -g <app> --args serve …` and communicates with its daemon over that socket ([helper.ts](https://github.com/injaneity/pi-computer-use/blob/main/src/platform/macos/helper.ts#L19), [helper.ts](https://github.com/injaneity/pi-computer-use/blob/main/src/platform/macos/helper.ts#L169)). The app is an `LSUIElement`, so it is packaged as an agent-style app rather than a normal Dock app ([setup-helper.mjs](https://github.com/injaneity/pi-computer-use/blob/main/scripts/setup-helper.mjs#L405)).
|
|
17
|
+
|
|
18
|
+
## Permissions
|
|
19
|
+
|
|
20
|
+
Two grants are required for the complete feature set:
|
|
21
|
+
|
|
22
|
+
- Accessibility is checked with `AXIsProcessTrusted()` and requested with `AXIsProcessTrustedWithOptions(_:)` ([Apple: `AXIsProcessTrusted`](https://developer.apple.com/documentation/applicationservices/1460720-axisprocesstrusted), [Apple: `AXIsProcessTrustedWithOptions`](https://developer.apple.com/documentation/applicationservices/1459186-axisprocesstrustedwithoptions), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L872)). It enables Accessibility API observation and actions.
|
|
23
|
+
- Screen Recording is preflighted and requested with `CGPreflightScreenCaptureAccess()` and `CGRequestScreenCaptureAccess()` ([Apple: preflight](https://developer.apple.com/documentation/coregraphics/cgpreflightscreencaptureaccess%28%29), [Apple: request](https://developer.apple.com/documentation/coregraphics/cgrequestscreencaptureaccess%28%29), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L872)). It enables window image capture.
|
|
24
|
+
|
|
25
|
+
The extension reports Screen Recording as ready only when the helper can also retrieve nonempty display content through `SCShareableContent`. Apple documents that API as retrieving matching displays, apps, and windows; the project uses it as an additional readiness check, not as an Apple-defined permission-status API ([Apple: `getExcludingDesktopWindows`](https://developer.apple.com/documentation/screencapturekit/scshareablecontent/getexcludingdesktopwindows%28_%3Aonscreenwindowsonly%3Acompletionhandler%3A%29), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L812)).
|
|
26
|
+
|
|
27
|
+
Setup invokes the request APIs before opening the relevant System Settings pane, then restarts the helper after the user chooses recheck ([permissions.ts](https://github.com/injaneity/pi-computer-use/blob/main/src/platform/macos/permissions.ts#L82), [permissions.ts](https://github.com/injaneity/pi-computer-use/blob/main/src/platform/macos/permissions.ts#L136)). The helper reports `source.attribution: helper-app` only when its executable path is inside the installed bundle and its parent PID is 1; every other launch reports `caller` ([bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L836)). This is a project launch diagnostic, not an Apple API statement about grant ownership.
|
|
28
|
+
|
|
29
|
+
The documentation does not promise a particular pane label, automatic listing behavior, or grant persistence across re-signing because those details are not stable API contracts.
|
|
30
|
+
|
|
31
|
+
## Root discovery
|
|
32
|
+
|
|
33
|
+
Discovery combines three sources:
|
|
34
|
+
|
|
35
|
+
1. `NSWorkspace.runningApplications` supplies running-process identity and frontmost state ([Apple: `runningApplications`](https://developer.apple.com/documentation/appkit/nsworkspace/runningapplications), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L951)).
|
|
36
|
+
2. `AXUIElementCreateApplication` plus Accessibility window attributes supplies controllable windows, roles, state, and element trees. An empty `AXWindows` list falls back to `AXMainWindow` and `AXFocusedWindow` ([Apple: `AXUIElement`](https://developer.apple.com/documentation/applicationservices/axuielement), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L1260)).
|
|
37
|
+
3. `CGWindowListCopyWindowInfo` supplies session window IDs, bounds, layers, owner PIDs, titles, onscreen state, and ordering candidates ([Apple: `CGWindowListCopyWindowInfo`](https://developer.apple.com/documentation/coregraphics/cgwindowlistcopywindowinfo%28_%3A_%3A%29), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L2936)).
|
|
38
|
+
|
|
39
|
+
Single-window lookups call `CGWindowListCreateDescriptionFromArray(_:)` for the requested window ID first and fall back to an all-window `CGWindowListCopyWindowInfo` query when that returns no match ([Apple: `CGWindowListCreateDescriptionFromArray`](https://developer.apple.com/documentation/coregraphics/cgwindowlistcreatedescriptionfromarray%28_%3A%29), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L3317)).
|
|
40
|
+
|
|
41
|
+
Accessibility windows and Core Graphics windows do not share one project-owned identifier, so the helper pairs them heuristically using title, frame geometry, onscreen state, and one-to-one assignment. The returned metadata exposes `exact`, `high`, or `low` pairing confidence instead of presenting every match as certain ([bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L3080)). Roots without a match are unpaired and omit `windowId`; the [root targeting reference](./root-targeting.mdx) defines how they are addressed.
|
|
42
|
+
|
|
43
|
+
Windows, sheets, dialogs, popovers, and open menus can become roots. Menus are identified by the Accessibility `AXMenu` role and Core Graphics popup-menu window level; a menu with no matching Accessibility element remains an outline-only, `pictureOnly` root ([bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L1232), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L3004)).
|
|
44
|
+
|
|
45
|
+
## Observation and capture
|
|
46
|
+
|
|
47
|
+
A look walks the target Accessibility subtree breadth-first and reads roles, subroles, identifiers, titles, descriptions, values, frames, focus, actions, and settable attributes. The walk stops at 2,000 nodes or 20 seconds and marks incomplete ancestors as `truncated` ([bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L1533)).
|
|
48
|
+
|
|
49
|
+
When an image is requested, the helper:
|
|
50
|
+
|
|
51
|
+
1. retrieves the matching `SCWindow` from `SCShareableContent`;
|
|
52
|
+
2. builds an `SCContentFilter` for that desktop-independent window;
|
|
53
|
+
3. sets `showsCursor = false` and `ignoreShadowsSingleWindow = true`;
|
|
54
|
+
4. captures one frame with `SCScreenshotManager.captureImage` ([Apple: capture one image](https://developer.apple.com/documentation/screencapturekit/scscreenshotmanager/captureimage%28contentfilter%3Aconfiguration%3Acompletionhandler%3A%29), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L3202)).
|
|
55
|
+
|
|
56
|
+
If ScreenCaptureKit times out or fails, the helper tries `/usr/sbin/screencapture -x -l <window-id>` and reads the temporary PNG with owner-only file permissions ([bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L3277)). The fallback is an implementation detail, not a guarantee that capture succeeds when ScreenCaptureKit fails. Unpaired roots fail visual observation with `root_not_capturable` instead of capturing another window ([bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L1367)).
|
|
57
|
+
|
|
58
|
+
Forced visual text recognition uses Vision's accurate `VNRecognizeTextRequest`, disables language correction, and attaches nonduplicate text boxes to the Accessibility outline. Apple defines that request as finding and recognizing text in an image ([Apple: `VNRecognizeTextRequest`](https://developer.apple.com/documentation/vision/vnrecognizetextrequest), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L1637)). OCR-only nodes are marked `pictureOnly` and cannot receive ref-targeted Accessibility actions.
|
|
59
|
+
|
|
60
|
+
## Actions and delivery
|
|
61
|
+
|
|
62
|
+
The helper prefers Accessibility operations where the target exposes them:
|
|
63
|
+
|
|
64
|
+
- press and eligible click actions use `AXUIElementPerformAction` with `AXPress` ([Apple: `AXUIElementPerformAction`](https://developer.apple.com/documentation/applicationservices/1462091-axuielementperformaction), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L2079));
|
|
65
|
+
- `setText` writes `AXValue` and reads it back ([Apple: `AXUIElementSetAttributeValue`](https://developer.apple.com/documentation/applicationservices/1460434-axuielementsetattributevalue), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L2093));
|
|
66
|
+
- semantic scrolling walks the target and its ancestors looking for supported Accessibility scroll actions ([bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L2467)).
|
|
67
|
+
|
|
68
|
+
Web-backed editable controls and controls without a usable Accessibility action can require synthesized keyboard or pointer events. Background event delivery uses `CGEvent.postToPid(_:)`; foreground delivery activates and raises the target, then posts the synthesized event at `.cghidEventTap` ([Apple: `postToPid`](https://developer.apple.com/documentation/coregraphics/cgevent/posttopid%28_%3A%29), [Apple: `post(tap:)`](https://developer.apple.com/documentation/coregraphics/cgevent/post%28tap%3A%29), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L3362)). These are synthesized events; this documentation does not describe them as physical hardware input.
|
|
69
|
+
|
|
70
|
+
`headless: true` maps every native action to the `ax_only` policy. The helper rejects coordinate delivery, `typeText`, `keypress`, and web text replacement with `foreground_required` before posting synthesized events, and the bridge does not escalate that error ([bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L1922)). Without strict headless mode, ref-based actions normally start with background delivery; coordinate clicks and focus-dependent steps can start in foreground, while checked keyboard failures and explicit `foreground_required` errors can escalate there ([bridge.ts](https://github.com/injaneity/pi-computer-use/blob/main/src/bridge.ts#L1185), [bridge.ts](https://github.com/injaneity/pi-computer-use/blob/main/src/bridge.ts#L1208)).
|
|
71
|
+
|
|
72
|
+
Before foreground coordinate delivery, the helper uses `AXUIElementCopyElementAtPosition` to check whether the point resolves to the intended element or a related ancestor or descendant. An unrelated resolved element produces `occluded_target`; an unavailable or coarse hit test produces an unknown preflight rather than proof of visibility ([bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L2021), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L2440)).
|
|
73
|
+
|
|
74
|
+
Action results distinguish `worked`, `didnt`, and `unknown`. A successful API call or posted event is not universally treated as proof of application-level effect: value writes and text entry get read-back evidence, while pointer actions can remain unknown unless value, selection, focused-window, or sheet state changes ([bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L2079), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L2197)).
|
|
75
|
+
|
|
76
|
+
## Agent cursor overlay
|
|
77
|
+
|
|
78
|
+
When `cursor_overlay` is enabled, non-headless pointer-oriented actions delivered in the background with `postToPid` schedule the AppKit/SwiftUI `AgentCursor` overlay at the grounded point; foreground actions that control the physical cursor and `ax_only` actions don't display it ([bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L1982)). The overlay ignores mouse events, cannot become key or main, and hides after eight seconds ([Apple: `ignoresMouseEvents`](https://developer.apple.com/documentation/appkit/nswindow/ignoresmouseevents), [agent_cursor.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/agent_cursor.swift#L6)). It is visual only; action delivery remains in `bridge.swift`.
|
|
79
|
+
|
|
80
|
+
The current overlay is main-display-only because its frame is created from `NSScreen.main`. The helper excludes its own process from app discovery, but the overlay is not a supported target ([agent_cursor.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/agent_cursor.swift#L61), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L951)).
|
|
81
|
+
|
|
82
|
+
## Activity glow
|
|
83
|
+
|
|
84
|
+
`activity_glow` defaults to `false`. When it is enabled and `headless` is `false`, the extension sends `setActivityGlow` over a persistent helper connection when a computer-use tool starts and clears it when the agent run ends ([computer-use.ts](https://github.com/injaneity/pi-computer-use/blob/main/extensions/computer-use.ts#L207)). The helper's `ActivityGlowController` tracks active connections and shows the glow while any is active; a closed connection removes its state ([bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L485), [bridge.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/bridge.swift#L634), [activity_glow.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/activity_glow.swift#L74)). It creates one borderless window per `NSScreen`, rebuilt when screen parameters change. Each window ignores mouse events, is excluded from Accessibility, and sits at the screen-saver level ([activity_glow.swift](https://github.com/injaneity/pi-computer-use/blob/main/native/macos/activity_glow.swift#L130)).
|
|
85
|
+
|
|
86
|
+
## Current limits
|
|
87
|
+
|
|
88
|
+
- Accessibility completeness and supported actions depend on what the target app exposes; sparse or web-backed trees can require image evidence or foreground event delivery.
|
|
89
|
+
- Accessibility-to-Core-Graphics window pairing is heuristic, and callers must treat low-confidence pairing accordingly. Unpaired roots support semantic observation only.
|
|
90
|
+
- Raw coordinate targets require an image-bearing look; outline-only menu roots cannot be coordinate targets.
|
|
91
|
+
- ScreenCaptureKit readiness, capture, and the command-line screenshot fallback are separate checks, so one successful check does not guarantee every later window capture.
|
|
92
|
+
- The visual agent cursor only covers the main display.
|
|
93
|
+
- Strict headless mode rejects actions that need synthesized pointer or keyboard input, including every `typeText` and `keypress`.
|
|
94
|
+
|
|
95
|
+
<details className="reference-provenance">
|
|
96
|
+
<summary>source provenance</summary>
|
|
97
|
+
<p>Generated from <a href="https://github.com/roam-agent/roam-computer-use/blob/main/native/macos/bridge.swift"><code>native/macos/bridge.swift</code></a>. The evidence check requires <code>CGWindowListCopyWindowInfo</code>, <code>SCScreenshotManager.captureImage</code>, <code>AXUIElementSetAttributeValue</code>, <code>/usr/sbin/screencapture</code>; external API citations remain independently maintained.</p>
|
|
98
|
+
</details>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'macOS reference'
|
|
3
|
+
description: 'Routing map for macOS Accessibility, capture, input delivery, and complete implementation details.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
{/* This file is generated by scripts/docs-generators/generate-source-references.mjs. Do not edit it directly. */}
|
|
7
|
+
|
|
8
|
+
The macOS backend is split between [`src/platform/macos/`](https://github.com/roam-agent/roam-computer-use/tree/main/src/platform/macos) and [`native/macos/`](https://github.com/roam-agent/roam-computer-use/tree/main/native/macos).
|
|
9
|
+
|
|
10
|
+
| Question | Reference | Primary source |
|
|
11
|
+
|---|---|---|
|
|
12
|
+
| AX trust, roles, trees, attributes, actions, or sparse outlines | [Accessibility and AX](./accessibility.mdx) | `native/macos/bridge.swift` |
|
|
13
|
+
| Screen Recording, window images, pairing, or OCR | [Capture and OCR](./capture.mdx) | `native/macos/bridge.swift` |
|
|
14
|
+
| clicks, typing, scrolling, headless policy, or evidence | [Actions and input delivery](./actions.mdx) | `src/bridge.ts`, `native/macos/bridge.swift` |
|
|
15
|
+
| root targets, unpaired roots, modality, or post-action outcomes | [Root targeting](./root-targeting.mdx) | `src/platform/macos/backend.ts`, `native/macos/bridge.swift` |
|
|
16
|
+
| support boundary, helper behavior, and all limits | [Complete implementation reference](./implementation.mdx) | macOS adapter, helper, and setup sources |
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Root targeting'
|
|
3
|
+
description: 'macOS root target shape, unpaired roots, capture, modality, post-action outcomes, and ref lifecycle.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
{/* This file is generated by scripts/docs-generators/generate-source-references.mjs. Do not edit it directly. */}
|
|
7
|
+
|
|
8
|
+
These are the target, capture, modality, and post-action contracts the macOS path guarantees.
|
|
9
|
+
|
|
10
|
+
## Target contract
|
|
11
|
+
|
|
12
|
+
- A root target is `{ pid, windowId?, rootRef?, windowRef? }`. `windowId` is present only when positive. An unpaired root (no matching CG window) has no `windowId`, never `0`.
|
|
13
|
+
- `rootRef` and `windowRef` are the same native ref. Every macOS helper call (`look`, `focusWindow`, `axWaitFor`) goes through `normalizeTarget()` in [`src/platform/macos/backend.ts`](https://github.com/injaneity/pi-computer-use/blob/main/src/platform/macos/backend.ts), which sends only `windowRef`.
|
|
14
|
+
- The helper treats `windowId <= 0` as absent. A `windowRef` that no longer resolves fails; it never falls back to the app's first window.
|
|
15
|
+
- Looks remember their `windowRef`, so `act` resolves the root by ref for unpaired roots.
|
|
16
|
+
|
|
17
|
+
## Capture
|
|
18
|
+
|
|
19
|
+
- Paired root: semantic and visual observation work.
|
|
20
|
+
- Unpaired root: semantic works. Visual fails with `root_not_capturable`; use `image: never`. No other window is ever captured in its place.
|
|
21
|
+
|
|
22
|
+
## Modality
|
|
23
|
+
|
|
24
|
+
`isModal` is true for: a sheet child, role `AXSheet`, or `AXModal == true`. When the app does not report `AXModal` at all, a dialog-like role/subrole still counts. An explicit `AXModal == false` wins: Fusion's BROWSER sidebar (subrole `AXDialog`, `AXModal=0`) is nonmodal.
|
|
25
|
+
|
|
26
|
+
`act_ui` no longer redirects to a foreground modal. Actions and the successor capture stay on the root the state belongs to; a modal that appears afterwards shows up in `rootDelta` as `appeared`. `observe_ui` without a root may still prefer a confirmed foreground modal.
|
|
27
|
+
|
|
28
|
+
## Post-action outcomes
|
|
29
|
+
|
|
30
|
+
Terminal `act_ui` results always say the action was delivered, and:
|
|
31
|
+
|
|
32
|
+
- `target_closed`, `cause: replaced`, `successors: [...]`: source root gone and new roots of the same pid appeared. Observe a successor via `find_roots`.
|
|
33
|
+
- `target_closed`, `cause: closed`: source root gone, nothing replaced it.
|
|
34
|
+
- `post_action_observation_failed` with code `root_stale`: root still listed or unknown but the ref no longer resolves. Rediscover with `find_roots`.
|
|
35
|
+
|
|
36
|
+
## Ref lifecycle
|
|
37
|
+
|
|
38
|
+
Native refs live in the helper's `refStore` and are only valid while the helper process and the AX element live. Refs from earlier sessions, pids and state ids are stale: rediscover with `find_roots`.
|
|
39
|
+
|
|
40
|
+
## Tests
|
|
41
|
+
|
|
42
|
+
`npm run test:macos-target`, `test:macos-native` (compiles the `PURE` region of `bridge.swift`), `test:act-outcomes`.
|
|
43
|
+
|
|
44
|
+
<details className="reference-provenance">
|
|
45
|
+
<summary>source provenance</summary>
|
|
46
|
+
<p>Generated from <a href="https://github.com/roam-agent/roam-computer-use/blob/main/native/macos/bridge.swift"><code>native/macos/bridge.swift</code></a>. The evidence check requires <code>root_not_capturable</code>, <code>classifyModal</code>, <code>AXModal</code>, <code>refStore</code>; external API citations remain independently maintained.</p>
|
|
47
|
+
</details>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Windows bridge reference'
|
|
3
|
+
description: 'Windows backend contract, UIA behavior, refs, actions, deltas, protocol, and constraints.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
{/* This file is generated by scripts/docs-generators/generate-source-references.mjs. Do not edit it directly. */}
|
|
7
|
+
|
|
8
|
+
`windows-bridge.exe` is the native helper for the root-forest Windows backend. It is spawned by the TypeScript helper client and speaks stdin/stdout JSON-lines protocol version **4**.
|
|
9
|
+
|
|
10
|
+
## Backend contract
|
|
11
|
+
|
|
12
|
+
The TypeScript Windows backend is intentionally stateless. It forwards root-forest seam calls to the Rust helper:
|
|
13
|
+
|
|
14
|
+
- `listRoots({ pid? })`: cheap HWND metadata only. Roots do not fabricate pairing or sheet counts; HWND/class/style diagnostics live under `metadata` when useful.
|
|
15
|
+
- `look`: atomic observe result with `lookId`, outline, window payload (`rootRef`, `kind`, frame, scale), and optional image. Menu/outline-only roots omit `image`; coordinate acts against those roots fail with `coordinate_unavailable_for_root`.
|
|
16
|
+
- `act`: forwards the typed `PlatformActRequest` whole. The helper validates `lookId`, resolves refs from helper-owned look state, applies policy, executes, and returns honest outcome/evidence plus `performed.deltaSource` and shallow `rootDelta`.
|
|
17
|
+
- `uiaReadText` / `uiaWaitFor`: helper-side live UIA reads/polls. No TypeScript screenshot polling or module-level element state is used.
|
|
18
|
+
|
|
19
|
+
## Root metadata
|
|
20
|
+
|
|
21
|
+
Windows roots are top-level HWNDs:
|
|
22
|
+
|
|
23
|
+
- `#32768` class => `kind: "menu"`
|
|
24
|
+
- `#32770` class => `kind: "dialog"`
|
|
25
|
+
- owned popups => `kind: "popover"`
|
|
26
|
+
- other HWNDs => `kind: "window"`
|
|
27
|
+
|
|
28
|
+
The helper declares per-monitor-v2 DPI awareness at startup and reports `scaleFactor = GetDpiForWindow(hwnd) / 96`.
|
|
29
|
+
|
|
30
|
+
## Refs, actions, and deltas
|
|
31
|
+
|
|
32
|
+
Observed `@e` refs store UIA RuntimeId and AutomationId metadata. Ref-targeted actions resolve a live `IUIAutomationElement` first:
|
|
33
|
+
|
|
34
|
+
- `press`/`click`: `InvokePattern`, then `TogglePattern`, then `SelectionItemPattern`, then `ExpandCollapsePattern`, then LegacyIAccessible default action; successful pattern grounding reports `grounding: "description"`, `delivery: "ax"`. Coordinate fallback is blocked by `ax_only` and preflights occlusion with `ElementFromPoint`.
|
|
35
|
+
- `setText`: `ValuePattern.SetValue`, then `CurrentValue` read-back. `evidence.value` is the value actually read.
|
|
36
|
+
- `scroll`: `ScrollPattern` where exposed; wheel fallback is raw input and policy-gated.
|
|
37
|
+
- `typeText`, `keypress`, `drag`, `moveMouse`, and coordinate targets remain raw input and report `unknown` unless verified.
|
|
38
|
+
|
|
39
|
+
`readText` resolves the live element and reads TextPattern → ValuePattern → CurrentName. `waitFor` polls the live UIA subtree at about 150ms intervals.
|
|
40
|
+
|
|
41
|
+
Root deltas are baselined at act time. The helper polls a cheap top-level HWND signature for early settle (`deltaSource: "win-poll"`), then takes short catch-up snapshots before returning the final full before/after diff. If no change is seen before the cap, it returns the full snapshot timeout path (`"snapshot"`).
|
|
42
|
+
|
|
43
|
+
## Protocol
|
|
44
|
+
|
|
45
|
+
Request envelope:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{ "protocolVersion": 4, "id": "req_1", "cmd": "listRoots", "args": {} }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Response envelope:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{ "protocolVersion": 4, "id": "req_1", "ok": true, "result": { } }
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Diagnostics (`cmd: "diagnostics"`) returns the protocol version and helper process metadata. The TypeScript backend rejects a mismatched version with a “Restart Pi …” error.
|
|
58
|
+
|
|
59
|
+
## Remote acceptance notes
|
|
60
|
+
|
|
61
|
+
- **Item 5 / menus:** click Notepad's File menu, read `rootDelta`, then observe the `appeared` root's `ref`. Menus are separate roots; observing the original Notepad window will not show the menu contents.
|
|
62
|
+
- **Item 7 / occlusion:** record element coordinates from a fresh look, cover the window, then issue a coordinate act (`target: { "x": ..., "y": ... }`, `policy: "default"`). Expect `occluded_target`. Ref-targeted acts may re-resolve and do not exercise this coordinate preflight path.
|
|
63
|
+
- **Item 8 / ref re-resolve:** fresh look, capture any element ref, move the window, then act on the same ref with the same `lookId`. RuntimeId/AutomationId re-resolution should succeed with refound semantics, not `stale_ref`.
|
|
64
|
+
- **Pressability smoke:** a fresh look at Win11 Notepad must show `canPress: true` on menu bar items and buttons. If not, attach the raw outline dump so the capability matrix can be inspected.
|
|
65
|
+
|
|
66
|
+
## Local constraints
|
|
67
|
+
|
|
68
|
+
- Local child process only; no service, socket, or network listener.
|
|
69
|
+
- Helper path: `%USERPROFILE%\.pi\agent\helpers\pi-computer-use\windows-bridge.exe`.
|
|
70
|
+
- UIAccess/elevated-window limitations are reported as errors; there is no interactive permission grant loop.
|
|
71
|
+
|
|
72
|
+
<details className="reference-provenance">
|
|
73
|
+
<summary>source provenance</summary>
|
|
74
|
+
<p>Generated from <a href="https://github.com/roam-agent/roam-computer-use/blob/main/native/windows/bridge-rs/src/lib.rs"><code>native/windows/bridge-rs/src/lib.rs</code></a>. The evidence check requires <code>protocol</code>, <code>uia</code>, <code>capture</code>, <code>input</code>; external API citations remain independently maintained.</p>
|
|
75
|
+
</details>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Get started with pi-computer-use'
|
|
3
|
+
description: 'Install the extension and complete a first checked desktop action.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
This tutorial installs the extension, verifies platform setup, and completes a first observation-and-action loop.
|
|
7
|
+
|
|
8
|
+
## 1. Install the extension
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pi install npm:@injaneity/pi-computer-use
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Start Pi after installation. On macOS 14 or newer, the helper is installed per user by default; grant Accessibility and Screen Recording to `~/Applications/pi-computer-use.app` (existing writable system-wide installs remain at `/Applications/pi-computer-use.app`), then choose Recheck. The [macOS reference](../reference/platforms/macos/accessibility.mdx#trust-and-permission) documents the exact checks. On Windows, run Pi in an unlocked interactive desktop session; the macOS helper is not used. On Linux, run Pi inside the target user's graphical session with a working AT-SPI2 accessibility bus; the [Linux guide](../how-to-guides/linux.mdx) lists what X11 and Wayland support.
|
|
15
|
+
|
|
16
|
+
## 2. Check the active configuration
|
|
17
|
+
|
|
18
|
+
Run this command inside Pi:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
/computer-use
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The response shows whether browser access, strict background execution, the macOS agent cursor, and the macOS activity glow are enabled, along with the source of each configuration file.
|
|
25
|
+
|
|
26
|
+
## 3. Ask the agent to inspect an app
|
|
27
|
+
|
|
28
|
+
Open a simple desktop app such as Calculator or TextEdit, then ask Pi:
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
find the app's window, inspect its visible controls, and tell me what you can act on. don't change anything yet.
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The agent first calls `find_roots`, then `observe_ui`. The observation returns a `stateId` and element refs such as `@e12`; those refs belong to that immutable state.
|
|
35
|
+
|
|
36
|
+
## 4. Ask for one checked action
|
|
37
|
+
|
|
38
|
+
Give the agent a small action with an observable result, for example:
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
click the 7 button and verify that the display shows 7.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The agent acts from the observed `stateId` and attaches the expected result to `act_ui`. A successful action returns the next state, often as a compact diff. The agent should use that returned state directly rather than immediately observing again.
|
|
45
|
+
|
|
46
|
+
You now have a working desktop loop. Use the generated [agent state and action contract](../reference/agent/contract.mdx) for state, batching, browser, and fallback behavior, or the generated [tool schema reference](../reference/agent/tools.mdx) for exact parameters.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Overview'
|
|
3
|
+
description: 'Learn pi-computer-use through one guided end-to-end path.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Tutorials teach by doing. Start here if the extension is not installed or you have not completed a checked desktop action.
|
|
7
|
+
|
|
8
|
+
- [Get started with pi-computer-use](./getting-started.mdx) — install the extension, verify setup, observe an app, and perform one checked action.
|
|
9
|
+
|
|
10
|
+
Once the first loop works, use [how-to guides](/how-to-guides) for a specific problem or [reference](/reference) for exact contracts.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "title": "Tutorials", "icon": "Route", "pages": ["index", "getting-started"] }
|