stella-computer
Control macOS desktop apps through Stella's persistent Computer Use runtime.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 2
- Forks
- 1
01 前言 Front Matter
- name
- stella-computer
- description
- Control macOS desktop apps through Stella's persistent Computer Use runtime.
03 SKILL.md 正文
Stella Computer for macOS
Use code for desktop-app work. The persistent JavaScript runtime is already initialized and exposes a frozen sky client. Bindings and delivered app instructions persist for this agent session.
Observe
Start each desktop-app turn with fresh state for the named app:
var state = await sky.get_app_state({
app: "Spotify",
screenshot_policy: "auto",
});
codeRuntime.write(state.text);
if (state.screenshot) await codeRuntime.emitImage(state.screenshot.url);
Every state includes an opaque semantic state_id, an immutable compound observation_id, is_diff, and, for a diff, base_state_id. A captured screenshot also has an independent visual_state_id; screenshot capture settings do not change state_id, while a different visual or resource generation changes observation_id. Treat a diff as valid only when its base_state_id matches the full state you are building on. Pass disable_diff: true whenever the base is unavailable or mismatched.
Use the app name directly. Call await sky.list_apps() only when the requested app cannot be resolved.
The sky methods are exactly list_apps, list_windows, get_app_state, wait_for_change, click, drag, perform_secondary_action, press_key, scroll, select_text, set_value, type_text and batch; there is no documentation, activate_app or open_app.
When the same app runs more than once (two Chrome profiles, several simulators), pass window_id from list_windows; actions then go to the process that owns that window.
A hidden or minimized app, or one with no window on the current Space, fails observation with a message saying so. Pass raise: true to get_app_state to unhide or restore it; that brings the window on screen, so use it only when the task needs that app. An app with no windows at all (Dock, a menu-bar app, Finder with every window closed) returns its app-level elements instead.
Stella's own app and password or system-security apps are protected and always refused. To look at Stella's UI, use the verify-stella skill's isolated instance.
Call await sky.list_windows() when window titles or native window IDs are needed to disambiguate several top-level windows.
The default state is an accessibility-tree diff when that is sufficient. A screenshot is returned only when visual context is needed. Prefer the accessibility text and numbered element_index values; inspect the screenshot when the tree is sparse or the visible control is absent.
Pass disable_diff: true only when you need a complete recovery tree.
Act
Actions return a receipt after dispatch without rebuilding state or capturing a screenshot. Every action requires the state_id from the fresh state it was derived from, including element clicks, secondary actions, scrolling, selection, value/focus actions, coordinates, drags, and keyboard input. Missing or stale provenance is rejected before native dispatch instead of targeting changed UI:
await sky.click({
app: "Spotify",
element_index: 42,
state_id: state.state_id,
});
await sky.set_value({
app: "Spotify",
element_index: 18,
value: "Daft Punk",
state_id: state.state_id,
});
await sky.perform_secondary_action({
app: "Spotify",
element_index: 9,
action: "Show Menu",
state_id: state.state_id,
});
await sky.scroll({
app: "Spotify",
element_index: 55,
direction: "down",
pages: 1,
state_id: state.state_id,
});
await sky.drag({
app: "Spotify",
from_x: 420,
from_y: 310,
to_x: 720,
to_y: 310,
state_id: state.state_id,
observation_id: state.observation_id,
});
await sky.press_key({
app: "Spotify",
key: "Return",
state_id: state.state_id,
});
await sky.type_text({
app: "Spotify",
text: "hello",
state_id: state.state_id,
});
drag also accepts path: [{ x, y }, ...] with at least two points. Drag
coordinates must come from the latest screenshot; observe again after the drag.
Perform one or more actions in one code call only when no intermediate result is needed. Then fetch settled state once:
await sky.click({
app: "Spotify",
element_index: 18,
state_id: state.state_id,
});
var nextState = await sky.wait_for_change({
app: "Spotify",
after_state_id: state.state_id,
...(state.visual_state_id
? { after_visual_state_id: state.visual_state_id }
: {}),
timeout_ms: 10000,
screenshot_policy: "auto",
});
codeRuntime.write(nextState.text);
if (nextState.screenshot) await codeRuntime.emitImage(nextState.screenshot.url);
For a data-driven sequence, sky.batch([...]) first validates every action against its supplied observation, then executes the actions in order. A stale action rejects the entire batch before any action is dispatched. Give every item the state_id from the same fresh starting state when they target the same app. Do not batch across a decision point, permission prompt, navigation-policy boundary, or any step whose result determines the next action.
Use wait_for_change when the next step depends on a mutation becoming observable. It polls without advancing the saved diff baseline and returns a final diff anchored exactly to after_state_id. Pass after_visual_state_id when screenshot-only changes matter; omit it to wait only for semantic accessibility changes. Use get_app_state directly when no prior state is available or a change is not required. Always re-derive element indices from the latest state.
Dialogs, Sheets And Alerts
A native modal dialog (a browser's "Leave site?", a save sheet, a permission alert) is listed first in the state, ahead of the window it blocks, and the state carries a [warning] naming it. Act on it like any other element: click its button with that state's state_id, or press Return (its default button) or Escape (its cancel button). Then observe again. A browser may ignore a click that lands in the first instant after its dialog appears; if the dialog is still there in the next state, act again with that new state.
When An Action Is Rejected
A rejection saying the app changed after your state means nothing was sent. Observe again, re-derive the element_index from that state, and act with its state_id straight away. Do not reuse one state for several actions in a row unless you batch them. If the app keeps changing (animations, a page still loading), call wait_for_change so it settles, then act. Repeating the same call with the same old state_id never succeeds.
Every batch item needs type (click, drag, perform_secondary_action, press_key, scroll, select_text, set_value or type_text) plus that method's arguments.
Keys are written like Return, Escape, Tab, Space, Delete, Up/ArrowUp, PageDown, F5, a letter, digit or punctuation (`, -, /), with modifiers cmd, ctrl, alt or shift joined by +, for example cmd+shift+t.
Text Selection
Use semantic selection instead of repeated arrow-key commands:
await sky.select_text({
app: "TextEdit",
element_index: 7,
text: "matching text",
prefix: "optional text before",
suffix: "optional text after",
selection_type: "text",
state_id: state.state_id,
});
selection_type may be text, cursor-before, or cursor-after. Prefix and suffix disambiguate repeated matches.
Coordinates And Input
Use accessibility elements whenever possible. For a visible control missing from the tree, use screenshot pixel coordinates from the latest attached screenshot:
await sky.click({
app: "Spotify",
x: 620,
y: 412,
state_id: state.state_id,
observation_id: state.observation_id,
});
Coordinates are screenshot pixels, not macOS screen points. They require a state captured with screenshot_policy: "always", its semantic state_id, and its immutable observation_id. Never reuse coordinates with a later observation, even when its semantic state_id is unchanged. Coordinate and keyboard actions may affect the active input path. Use them only when the semantic accessibility route is unavailable, and verify with one final state read.
Spotify and other Chromium/Electron apps can expose sparse state briefly. Do not add sleeps; get_app_state performs adaptive settling and waits longer only while the app continues changing.
Do not use AppleScript, osascript, open -a, app-bundle internals, or shell commands to drive desktop apps. Use Bash only to diagnose the Computer Use runtime itself.
04 同仓库更多 Skills
stella-computer
Control Linux desktop apps (Hyprland) through Stella's persistent Computer Use runtime.
stella-browser
暂无简介
skill-creator
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
x-api
Use X (Twitter) through Stella's connected account.
visual-craft
Read before making something people will look at, where the look is the work — a website or landing page, an HTML canvas or interactive piece, an animation or motion graphics, a video, an image, or a visual design. Not for routine UI fixes or code whose output isn't visual.
stella-office
Create, analyze, proofread, and modify Office documents (.docx, .xlsx, .pptx) using Stella's bundled `stella-office` CLI. Use when the user wants to create, inspect, check formatting, find issues, add charts, or modify Office documents.