Skip to main content

UI_TOOL

Constant UI_TOOL 

Source
pub(crate) const UI_TOOL: &str = r#"{
  "name": "UI",
  "description": "Inspect and drive AgentMux's own UI. Every call takes an action. screenshot: an image of your own pane (or, with pane, a browser pane you opened); returns a file path: Read it to see it, or show it to the user with Pane (action \"open\", view \"media\"). query: the elements matching a CSS selector (tag, text, attributes, rect, focus), to find one before clicking it or to read rendered state. click: a real mouse click on the first element matching selector. query and click reach your own pane and the shared app chrome (status bar, menus, window controls), never another pane or agent. shortcuts: AgentMux's keyboard shortcuts as the Help pane shows them here, with the user's remaps: command ids, keys, the raw key syntax, context. command: run a shortcut's command by id (e.g. split:right, tab:new) as if its key were pressed; keys: press a raw key from shortcuts (e.g. ctrl+shift+d; a chord is two keys separated by a space) as real key events and get the command it ran. Both act in the window that holds your pane; target focuses a pane first (switching to its tab). They keep the user's protections: tab:close asks, files:trash can be undone; pane:close needs target and closes that tab the way Stop pane does; files:deletePermanently, the keys bound to it or to pane:close, and pasting a line break into a shell without bracketed paste are refused. bind: give a command exactly these keys (bindings, a list; empty unbinds it; each a key or a two-step chord in the shortcuts syntax), working where the command works today unless when says otherwise. It changes the user's own shortcuts, so it never takes a key another command has (the answer names what has it: use another key, or ask the user) and never a key the system takes; the user is told and can undo it. reset: put one command (command) or every command (all) back on its defaults. windows: list top-level windows on this machine (pid, title, exe_path, capturable); only AgentMux's unless include_foreign, without your own instance's unless include_self. window: a screenshot of any window by pid (preferred; titles change) or title_contains, index picking among several matches; a window of a different OS user is withheld. windows and window are logged to an audit trail. record: a short animated GIF of your own pane (or a browser pane you opened, with pane), to show a change that moves (a drawer opening, a menu, a resize): op start begins it, op stop ends it and returns a file path; at most 30 seconds and 10 frames a second, one recording at a time, blacked out where the pane shows secret fields. Look at it, then pass its path in files of Tasks update or submit.",
  "inputSchema": {
    "type": "object",
    "properties": {
      "action":          { "type": "string", "enum": ["screenshot", "query", "click", "shortcuts", "command", "keys", "bind", "reset", "windows", "window", "record"], "description": "What to do" },
      "pane":            { "type": "string", "description": "screenshot, query, click, record: a browser pane you opened (its id from Browser open). Default: your own pane" },
      "full_page":       { "type": "boolean", "description": "screenshot: a browser pane's whole page, beyond what is on screen (its own width; cut at 8000 CSS pixels tall, and the answer says so). Not while the pane is zoomed" },
      "region":          { "type": "object", "properties": { "x": { "type": "number" }, "y": { "type": "number" }, "width": { "type": "number" }, "height": { "type": "number" } }, "description": "screenshot: only this part of a browser pane's page, in the page's CSS pixels from its top left (below the fold too)" },
      "canvas":          { "type": "string", "description": "screenshot: a canvas of a browser pane's page by its ref from your last snapshot (a line `canvas`), as the page drew it: at the canvas's own pixel size, so a canvas drawn 2000 by 1000 inside a box of 500 by 250 comes back 2000 by 1000 (scaled down to 4096 pixels along its longer side). Nothing is run in the page" },
      "scale":           { "type": "number", "description": "screenshot: with full_page, region or canvas, pixels of the image for each CSS pixel of the page (0.25 to 4; the image may not pass 32 million pixels). Without it a full_page or region image is at the screen's own density, and a canvas is at the scale of its own drawn size" },
      "op":              { "type": "string", "enum": ["start", "stop"], "description": "record: start a recording, or stop it and get the file" },
      "fps":             { "type": "number", "description": "record start: frames a second, 1 to 10 (default 5)" },
      "seconds":         { "type": "number", "description": "record start: the most seconds to record, 1 to 30 (default 30)" },
      "selector":        { "type": "string", "description": "query, click: a CSS selector, scoped to your own pane and the app chrome" },
      "limit":           { "type": "number", "description": "query: the most matches to return (default all)" },
      "command":         { "type": "string", "description": "command, bind, reset: a command id from shortcuts" },
      "keys":            { "type": "string", "description": "keys: a raw key from shortcuts, in its syntax" },
      "bindings":        { "type": "array", "items": { "type": "string" }, "description": "bind: the keys the command ends with, each in the shortcuts syntax (ctrl+shift+d; a chord is two keys separated by a space); empty unbinds it" },
      "when":            { "type": "string", "description": "bind: where the keys work (!textInputFocus, !terminalFocus, viewType == editor); default: where the command works today" },
      "all":             { "type": "boolean", "description": "reset: every command back on its defaults, instead of one" },
      "target":          { "type": "string", "description": "command, keys: your own pane, or a browser pane you opened, to focus first (default: your own pane)" },
      "include_foreign": { "type": "boolean", "description": "windows: also list other applications' windows" },
      "include_self":    { "type": "boolean", "description": "windows: include your own instance's windows (a torn-off floating pane, say)" },
      "pid":             { "type": "number", "description": "window: the owning process id, from windows" },
      "title_contains":  { "type": "string", "description": "window: a case-insensitive part of the title (ignored with pid)" },
      "index":           { "type": "number", "description": "window: which of several matching windows (0-based); without it several matches return the candidates" }
    },
    "required": ["action"]
  }
}"#;