Điều khiển app desktop local từ một agent qua accessibility tree, screenshot, và các hành động UI an toàn.
CLI orca computer cho phép một agent kiểm tra và điều khiển app desktop native - liệt kê app đang chạy, đọc accessibility tree, click control, đặt giá trị, gõ text, cuộn, và chụp screenshot. Dùng nó khi một task cần thao tác hệ điều hành hoặc một app bên thứ ba thay vì terminal hay trình duyệt built-in.
Thiết lập lần đầu
Phần tiêu đề “Thiết lập lần đầu”Kiểm tra runtime và quyền:
orca status --jsonorca computer permissions --jsonorca computer capabilities --jsonNếu permissions báo thiếu gì đó, cấp quyền Accessibility (và Screen Recording trên macOS) cho Orca Computer Use trong System Settings, rồi chạy lại permissions --json để xác nhận.
Snapshot → hành động → snapshot
Phần tiêu đề “Snapshot → hành động → snapshot”Mọi tương tác theo cùng một vòng lặp: đọc state hiện tại của app, hành động trên một element cụ thể, rồi đọc lại state để xác nhận kết quả.
orca computer list-apps --jsonorca computer get-app-state --app com.spotify.client --jsonorca computer click --app com.spotify.client --element-index 42 --jsonChỉ số element giới hạn theo kết quả get-app-state mới nhất và có thể thưa (sparse). Trong output --json, đọc tree từ result.snapshot.treeText. Đừng tự bịa chỉ số từ elementCount. Refresh state sau khi điều hướng, đổi focus, cuộn, hoặc bất kỳ lần re-render nào của app trước khi dùng lại một chỉ số.
App nhiều cửa sổ
Phần tiêu đề “App nhiều cửa sổ”orca computer list-windows --app com.microsoft.edgemac --jsonorca computer get-app-state --app com.microsoft.edgemac --window-id <id> --jsonorca computer click --app com.microsoft.edgemac --window-id <id> --element-index 12 --jsonƯu tiên --window-id ổn định khi id được liệt kê không phải none; nếu không, dùng --window-index.
Chọn một app
Phần tiêu đề “Chọn một app”Ưu tiên bundle ID trả về từ list-apps:
orca computer get-app-state --app com.microsoft.edgemac --jsonTên app hoạt động khi không mơ hồ (--app Spotify). Chỉ dùng --app pid:<number> khi cả bundle ID lẫn tên đều trùng nhau.
Các hành động khả dụng
Phần tiêu đề “Các hành động khả dụng”orca computer click --app <app> --element-index <i> --jsonorca computer set-value --app <app> --element-index <i> --value "text" --jsonorca computer type-text --app <app> --text "text" --jsonorca computer press-key --app <app> --key Return --jsonorca computer hotkey --app <app> --key CmdOrCtrl+A --jsonorca computer paste-text --app <app> --text "text" --jsonorca computer scroll --app <app> --element-index <i> --direction down --jsonorca computer drag --app <app> --from-x 100 --from-y 100 --to-x 300 --to-y 300 --jsonorca computer perform-secondary-action --app <app> --element-index <i> --action <name> --jsonƯu tiên các hành động ngữ nghĩa (click, set-value, perform-secondary-action) hơn type-text hay press-key thô - chúng nhắm thẳng vào element accessibility và sống sót qua các lần đổi focus mà bàn phím không chịu được.
Khi việc nhắm theo accessibility thất bại, fallback cẩn thận sang toạ độ:
orca computer click --app com.apple.Safari --x 120 --y 340 --jsonorca computer drag --app <app> --from-element-index 3 --to-element-index 9 --jsonInput nhạy cảm
Phần tiêu đề “Input nhạy cảm”Truyền secret qua stdin để chúng không lọt vào shell history:
printf '%s' "$TEXT" | orca computer set-value \ --app com.apple.Safari --element-index 7 --value-stdin --json--text-stdin hoạt động tương tự cho type-text và paste-text.
Screenshot
Phần tiêu đề “Screenshot”get-app-state trả về một accessibility tree và, mặc định, một screenshot. Với --json, byte ảnh được ghi ra đĩa và đường dẫn trả về trong screenshot.path thay vì nhúng trong response. Truyền --no-screenshot khi không cần pixel (nhanh hơn, payload nhỏ hơn). Truyền --restore-window để đưa một cửa sổ bị ẩn hoặc minimize hiện ra trước khi chụp.
Dùng từ một agent
Phần tiêu đề “Dùng từ một agent”Skill computer-use có sẵn đóng gói cùng bề mặt lệnh này kèm hướng dẫn an toàn. Cài nó vào thư mục skill của agent:
npx skills add https://github.com/stablyai/orca --skill computer-useXem Skills registry & MCP để biết cách skill được nhận diện.
Bước tiếp theo
Phần tiêu đề “Bước tiếp theo”- Orca CLI overview - phần còn lại của bề mặt CLI (worktree, terminal, trình duyệt).
- Skills registry & MCP - phân phối CLI này tới agent.
lượt xem