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. "
description:"Drive Chrome on this Mac through its DevTools protocol: pages, DOM, network, console and performance traces. "
+"It is Chrome with byre's own profile, started on first use and kept between calls, so a site the human has logged into there (passkeys included) stays logged in; when a site needs a login, ask the human to sign in in that Chrome window. "
+"ops: tabs (list tabs: id, title, url), navigate (url, optionally new_tab; waits for the page to load and clears the tab's network and console logs), "
+"js (run code in the tab and return its value: the last expression's, promises awaited, objects as JSON; use it to explore the DOM), select (tab), close (tab), "
+"network (the tab's requests since this tool first touched the tab or its last navigate: number, status, type, start and duration in ms, bytes, method, url; with request, one request's headers and bodies; filter keeps urls containing the text), "
+"console (console messages, exceptions and browser log entries), "
+"trace_start and trace_stop (a performance trace: start, navigate or act, stop; stop saves the trace file and reports FCP, LCP, DOMContentLoaded, load and the main thread's long tasks), "
+"cdp (send any DevTools protocol method with params to the tab, e.g. DOM.getDocument, CSS.getComputedStyleForNode, Emulation.setCPUThrottlingRate, Network.setCacheDisabled; returns its result as JSON). "
+"tab is a tab id from tabs; without it, the tab this tool last used, else Chrome's first tab. capture screenshots the tab's page. "
+"It drives Chrome without the mouse or keyboard; select, close, navigate with new_tab, cdp, capture and the first call that starts Chrome can change what is in front, so those hold the shared input lock like act does.",