Skip to content

feat(computer-use-sdk): add native app control sessions - #1

Draft
DeJeune wants to merge 5 commits into
mainfrom
ankara-v3
Draft

DeJeune wants to merge 5 commits into
mainfrom
ankara-v3

Conversation

@DeJeune

@DeJeune DeJeune commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Add @cherrystudio/computer-use as a typed Node/Electron-main SDK over a private native protocol, with Swift on macOS and Go on Windows/Linux. Each runtime supports application discovery, structured observation, PNG capture and one semantic left element click.

Protocol v2 introduces per-app control contexts and snapshot ownership. App stop bypasses the desktop queue, cancels pending work, waits for native cleanup and invalidates old identities. macOS also exposes explicit permission onboarding with the existing drag-to-add UI. Windows owns PowerShell UIA workers through Job Objects; Linux uses Go AT-SPI/X11 without Python or cgo on the SDK path.

This is a draft for cross-platform testing. Platform npm packages, remaining actions, Wayland capture, Cherry task ownership/Tray controls and software cursors remain pending. Existing CLI/MCP entry points are retained.

Validation

  • Passed: SDK typecheck and 36 client/tarball tests, including ESM/CJS and NodeNext consumers.
  • Passed: shared Go session tests with the race detector.
  • Previously passed on this implementation: 15 Swift session tests, 6 macOS native protocol tests, Linux backend tests and the Linux X11 real counter/stop fixture.
  • Windows ARM64 and x64 cross-builds passed. Windows x64 CI (windows-2025) passed Go worker/descendant cleanup, 4 native protocol tests and the real v2 counter/stop fixture. The local Windows 11 ARM64 v2 rerun remains pending after Parallels execution problems.
  • Documentation structure, changed relative links and whitespace checks passed. SDK CI initially exposed an offline-install assumption on fresh runners; this was reproduced with an empty cache and fixed by giving each package consumer a new cache for normal installation. The focused cold-cache test passes locally; updated CI is pending.

Windows testing

Use Node 24 and Go 1.23.4 or later in an interactive Windows PowerShell session. After checking out this PR, follow the complete Windows build and fixture instructions.

The fixture verifies Count: 0 → 1 → 2, screenshot bytes, stale/foreign reference rejection, confirmed app stop and continued access through another runtime. The Windows Go tests additionally verify worker and descendant cleanup after cancellation or owner death. Only the repository's counter fixture is manipulated.

For Cherry integration, build packages/sdk and dist/native/open-computer-use.exe, then follow companion Cherry Studio PR CherryHQ/cherry-studio#20718 and its Windows setup instructions. No npm release is required.

Compatibility and limitations

The SDK and helper must use matching protocol v2 artifacts; v1 helpers are rejected at initialization. No deployed SDK package is being upgraded or published by this PR. Permission state does not authorize an Agent task, and an empty Windows/Linux permission list does not establish desktop readiness. macOS desktop validation still requires system permission grants.

Signed-off-by: suyao <sy20010504@gmail.com>
DeJeune and others added 4 commits September 18, 2026 15:27
Signed-off-by: suyao <sy20010504@gmail.com>
The X11 capture path treated depth 24 as a proxy for a decodable 32-bit
reply, so the ARGB (depth 32) windows Firefox and other compositing
clients map always failed with `X11 pixel format is unsupported`. Both
depths carry one 32-bit BGRA pixel per point, which the decoder already
assumes; the check now states that directly and still rejects big-endian
servers, non-32-bit depths and short replies.

`Apps()` silently dropped any registered application whose accessibility
name or process id could not be read, which is exactly what a sandbox
policy denial looks like: the target disappeared from `listApps()` with
no error and no log. The design contract requires collection state to
distinguish "nothing there" from "not allowed to read", and an empty
`AppList` tells an agent the desktop is empty. Skips now keep the
underlying D-Bus error and reach stderr, and a desktop that registers
applications but yields none returns `TARGET_UNAVAILABLE`.

Both were found by driving Firefox rather than the repository fixture:
the fixture is a depth-24 GTK window and always has a readable name.
Verified on X11 against Firefox 142, where an unconfined caller captures
a 2532x1372 PNG and a confined caller reports the AppArmor denial that
hides the target. The snap policy itself is out of reach here; this only
makes the condition visible, and only on the SDK path — MCP/CLI still
runs runtime.py.

Signed-off-by: suyao <sy20010504@gmail.com>
Signed-off-by: greycheng255 <greycheng255@gmail.com>
Signed-off-by: greycheng255 <greycheng255@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants