Protocol-first macOS app-control backend for developer tools.
Project description
computer-use-macos
Protocol-first macOS app-control backend package.
This distribution exposes the planned computer_use_macos import path and
computer-use-macos CLI with its own package-local macOS backend
implementation. The old root package can remain as a compatibility seed, but
this distribution does not depend on it at runtime.
This package must remain independent from wechat-desktop-tool and any
product-specific runtime.
Quick Start
from computer_use_macos import ComputerUseClient, open_app_command
client = ComputerUseClient.from_config("app-control.toml")
observation = client.run_command(
open_app_command("TextEdit", bundle_id="com.apple.TextEdit")
)
print(observation.to_dict())
Use computer_use_command(...) when you need to construct a custom command
envelope while keeping the stable macos.computer_use tool name:
from computer_use_macos import computer_use_command
command = computer_use_command(
"open_app",
{"app": "TextEdit", "bundleId": "com.apple.TextEdit"},
command_id="cmd_open_textedit",
)
Keyboard actions use the same command envelope:
from computer_use_macos import hotkey_command, press_key_command
client.run_command(press_key_command("Return"))
client.run_command(hotkey_command(("Command", "F")))
Scoped Accessibility reads are available through accessibility_query. Use
this when an application needs a small, bounded set of UI nodes instead of a
full raw Accessibility tree:
from computer_use_macos import accessibility_query_command
observation = client.run_command(
accessibility_query_command(
target_app="WeChat",
bundle_id="com.tencent.xinWeChat",
root={"kind": "focusedWindow"},
query={
"scope": "children",
"maxDepth": 1,
"limit": 80,
"attributes": ["AXRole", "AXDescription", "AXValue"],
"actions": True,
},
)
)
nodes = observation.observation["accessibilityQuery"]["nodes"]
Helper manifests can be used directly:
client = ComputerUseClient.from_helper_manifest("helper_config.json")
observation = client.open_app("TextEdit")
Helper-backed clients expose run_command, run_stream, and the same
protocol-first convenience methods as the direct backend. The convenience
methods return ToolObservation objects at the helper boundary.
Standalone helper config works as a constructor input:
from computer_use_macos import ComputerUseClient, HelperConfig
client = ComputerUseClient(
HelperConfig(
helper_app_path="/Applications/Example Computer Use Helper.app",
bundle_id="com.example.computer-use-helper",
allowed_apps=("TextEdit",),
)
)
CLI
computer-use-macos helper init ./computer-use-helper \
--name "Example Computer Use Helper" \
--bundle-id com.example.computer-use-helper
computer-use-macos helper build ./computer-use-helper
computer-use-macos helper doctor ./computer-use-helper
computer-use-macos serve \
--config ./app-control.toml \
--socket-path /tmp/app-control.sock \
--token-file ./app-control.token
computer-use-macos request \
--socket-path /tmp/app-control.sock \
--token-file ./app-control.token \
--operation readiness
TextEdit Smoke
The package includes a small manual TextEdit smoke. First verify the installed entrypoint without touching the desktop:
COMPUTER_USE_DRY_RUN=1 \
python -m computer_use_macos.examples.textedit_smoke
Then run the real smoke on macOS after granting Accessibility permission to the terminal or host process:
python -m computer_use_macos.examples.textedit_smoke
Migration Boundary
The current package is the developer-facing macOS backend distribution. Public
imports are available from computer_use_macos, and the implementation lives
under packages/computer-use-macos/src.
The package provides:
ComputerUseClient/MacOSComputerUseClient- readiness and permission probes with structured
permissions,helper, andenabledOperationsfields - command runner primitives
- helper manifest, transport, discovery, launcher, doctor, and template APIs
- protocol-compatible
run_commandandrun_stream, includingpress_keyandhotkey - scoped
accessibility_queryfor bounded macOS AX reads - observer callbacks compatible with
app_control_protocol.ToolObserver - semantic click, bounded Accessibility selector click, and explicitly enabled coordinate click
- local Unix socket service mode with
run,submit,poll, andstreamactions, a small socket request CLI/client, plus SSE frame formatting helpers for application-owned HTTP wrappers - developer-facing module entrypoints:
commands,observations,errors,readiness, andtransport - stable
COMPUTER_USE_FAILURE_KINDSconstants for package-owned failure routing
It does not provide WeChat semantics, product authorization, UI, LLM decision loops, or caller task state.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file computer_use_macos-0.1.1.tar.gz.
File metadata
- Download URL: computer_use_macos-0.1.1.tar.gz
- Upload date:
- Size: 70.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bc9e1a27c71f989655fff1a99e7c5d631ef064ffe50d5047faa88a741e0bf7b
|
|
| MD5 |
14a48e8b5574a5cf9258dbcd09c8b68a
|
|
| BLAKE2b-256 |
09ec269de37065c3a11a0417e2b9337b795c32adb3adaa7121d596dc8998f8cf
|
File details
Details for the file computer_use_macos-0.1.1-py3-none-any.whl.
File metadata
- Download URL: computer_use_macos-0.1.1-py3-none-any.whl
- Upload date:
- Size: 64.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1ee25e1505b1b36ab4f7e08447812a06d0f3869fd4803add8c97c0fa85dbecd
|
|
| MD5 |
3fb7195fa9efa15baae927566cdde835
|
|
| BLAKE2b-256 |
cdc3a888e241e18645af19447d20c24bf012f58bddf61f2236e10590e6aded45
|