description:"List the running apps (pid, name, bundle id), the on-screen windows front to back (id, app, title, size and position in screen points) and the displays of this Mac, the machine byre runs on. "
+"Window ids are what capture, ax_tree and act take.",
schema:#"{"type": "object", "properties": {}}"#,
run:screenList
),
Tool(
name:"capture",
description:"Capture one window or a whole display, and see it. A window's capture shows its app's windows only, so other apps covering it don't hide it, and its menus, popups and sheets show; it must be on screen (not minimized). "
+"Prefer a window: a display is 5120 points wide here and shrinks until text is unreadable; crop a region to read small text. "
+"The reply says how image pixels map to window points, which are what act's [x, y] takes.",
description:"Read a window's accessibility tree: one line per element that has text or actions, indented under its parent, e.g. `e12 button \"New Tab\" [press]`. "
+"Web pages in Orion appear as text, links and form fields. The refs (e12) are for act and stay valid until the next tree, which replaces them. "
+"Bracketed: the actions an element takes (press, confirm, menu, increment…), set when its value can be set, focused, disabled. "
+"With menu_bar_pid instead of window, read an app's menu bar; pressing a menu item's ref runs it without opening the menu.",
+"Through real mouse and keyboard events, which bring the window to the front and move the cursor of whoever sits at this Mac (use when accessibility doesn't work): "
+"{\"type\": \"text\"} (into the focused element), {\"key\": \"cmd+shift+t\"} (modifiers cmd shift alt ctrl fn; keys a-z 0-9, return tab space delete escape left right up down home end pageup pagedown f1-f12 and punctuation). "
+"And {\"wait\": 500} (ms). [x, y] are window points, from the top left of the window. A failing step stops the rest and says which. "
+"Other agents share this Mac's apps, mouse and keyboard: a call with steps (and every browser call but tabs) holds them for the whole call, waiting and capture included, so keep such calls short, and waits up to 30s for another agent's call to finish.",
description:"Drive Orion, the logged-in browser on this Mac, through AppleScript; for web work, prefer this to clicking. "
+"ops: tabs (list every window's tabs: window, tab, title, url), navigate (url, optionally new_tab; waits for the page to load), "
+"js (run code in the tab and return its value: the value of the last expression, synchronously, so return strings, JSON.stringify objects, and don't return promises), select (tab), close (tab). "
+"window is Orion's window index (1 is the front one) and tab the tab index from tabs; without tab, the window's current tab. "