Skip to main content

Action

Enum Action 

Source
pub enum Action {
Show 54 variants Screenshot { output: Option<String>, region: Option<Region>, format: Option<ImageFormat>, max_width: Option<u32>, canvas: Option<String>, base64: bool, marks: bool, }, Click { x: Option<i32>, y: Option<i32>, button: MouseButton, double: bool, count: u8, }, TripleClick { x: Option<i32>, y: Option<i32>, button: MouseButton, }, DoubleClick { x: Option<i32>, y: Option<i32>, button: MouseButton, }, Press { count: u8, button: MouseButton, }, Drag { path: Vec<Point>, button: MouseButton, }, MouseDown { x: i32, y: i32, button: MouseButton, }, MouseUp { x: i32, y: i32, button: MouseButton, }, HoldKey { keys: String, ms: u64, }, ClipboardGet, ClipboardSet { text: Option<String>, image: Option<String>, }, Zoom { output: Option<String>, region: Region, format: Option<ImageFormat>, max_width: Option<u32>, canvas: Option<String>, base64: bool, }, Focus, SetValue { value: String, }, SelectText { start: i64, end: i64, }, PerformAction { name: String, }, ScrollTo, Move { x: i32, y: i32, }, Type { text: String, }, Key { keys: String, }, Scroll { x: Option<i32>, y: Option<i32>, dx: Option<i32>, dy: Option<i32>, direction: Option<ScrollDirection>, amount: Option<i32>, }, GetState, Wait { ms: Option<u64>, seconds: Option<f64>, }, Displays, Isolation, ListApps { all: bool, }, ListWindows, Launch, Activate, Quit { force: bool, }, PolicyCheck, Pause, Resume, Doctor { prompt: bool, open_settings: bool, x11: bool, }, Tree, SessionEnd, CursorPosition, Batch { stop_on_error: bool, actions: Vec<Value>, }, SessionPrune { dry_run: bool, ttl_secs: Option<u64>, }, MenuList { app: Option<String>, depth: Option<u32>, }, MenuClick { app: Option<String>, path: String, }, AppleEvent { app: Option<String>, script: String, language: Option<AppleEventLanguage>, }, ShortcutsRun { name: String, }, DockList {}, DockClick { title: String, }, Spaces {}, BrowserTabs {}, BrowserActivate { target_id: Option<String>, }, BrowserNavigate { url: String, target_id: Option<String>, }, BrowserClick { selector: String, target_id: Option<String>, }, BrowserText { selector: String, target_id: Option<String>, }, BrowserType { text: String, selector: Option<String>, target_id: Option<String>, }, BrowserEval { script: String, target_id: Option<String>, }, Ocr { force: bool, },
}
Expand description

One desktop action. Serialized with an action tag.

{"action":"click","x":10,"y":20}

Variants§

§

Screenshot

Capture the screen or a region.

Fields

§output: Option<String>

File path. A temp path is used when omitted.

§region: Option<Region>

Logical region, as x,y,width,height or an object.

§format: Option<ImageFormat>

png (default) or jpeg.

§max_width: Option<u32>

Scale the image down so its width is at most this many pixels.

Absent means 1440. 0 keeps the source width.

§canvas: Option<String>

Letterbox into WxH pixels, for example 1440x900.

§base64: bool

Include standard base64 bytes in data.

§marks: bool

Stamp numbered element rectangles on the image. tree indices (n) on a window target; OCR indices (on) when a tree cannot be read. --marks from the CLI turns this on.

§

Click

Move to a point and click, or press an element when element is set.

Fields

§x: Option<i32>

Logical x. Omit it when element is set.

§y: Option<i32>

Logical y. Omit it when element is set.

§button: MouseButton

Button. Defaults to left.

§double: bool

Click twice when true. With element, this is press count 2.

§count: u8

Repeat count. 1, 2, or 3. double: true means 2 when count is 1.

§

TripleClick

Click three times.

Fields

§x: Option<i32>

Logical x. Omit it when element is set.

§y: Option<i32>

Logical y. Omit it when element is set.

§button: MouseButton

Button. Defaults to left.

§

DoubleClick

Click twice. Equivalent to click with double: true.

Fields

§x: Option<i32>

Logical x. Omit it when element is set.

§y: Option<i32>

Logical y. Omit it when element is set.

§button: MouseButton

Button. Defaults to left.

§

Press

Press an element. count is 1, 2, or 3.

Fields

§count: u8

Repeat count. Defaults to 1.

§button: MouseButton

Mouse button. Left uses AXPress. Right uses AXShowMenu when advertised.

§

Drag

Button down at the first point, dragged events through the rest, up at the last.

Fields

§path: Vec<Point>

At least two points. A JSON array, or a flat x,y,x,y string.

§button: MouseButton

Mouse button. Defaults to left.

§

MouseDown

Button down. A later mouse_up, or the end of a one-shot command, releases it.

Fields

§x: i32

Logical x.

§y: i32

Logical y.

§button: MouseButton

Mouse button. Defaults to left.

§

MouseUp

Button up.

Fields

§x: i32

Logical x.

§y: i32

Logical y.

§button: MouseButton

Mouse button. Defaults to left.

§

HoldKey

Key down, sleep ms, key up. One combination. ms above 30000 is refused.

Fields

§keys: String

One combo such as shift or ctrl+alt+Delete.

§ms: u64

Milliseconds to hold.

§

ClipboardGet

Read the clipboard. Text wins over an image. Empty is kind: empty.

§

ClipboardSet

Write the clipboard. Confirmed. The audit stores the character count, not the text.

Fields

§text: Option<String>

Text to write. Empty is invalid_arguments.

§image: Option<String>

PNG path. Used when text is absent.

§

Zoom

Screenshot of a region. A window target crops that region in window-local points.

Fields

§output: Option<String>

File path. A temp path is used when omitted.

§region: Region

Logical region, as x,y,width,height or an object. Required.

§format: Option<ImageFormat>

png (default) or jpeg.

§max_width: Option<u32>

Scale the image down so its width is at most this many pixels.

§canvas: Option<String>

Letterbox into WxH pixels, for example 1440x900.

§base64: bool

Include standard base64 bytes in data.

§

Focus

Set AXFocused on an element.

§

SetValue

Set an element’s value. Refused for secure fields.

Fields

§value: String

New value.

§

SelectText

Set the selected character range. Refused for secure fields.

Fields

§start: i64

First selected character.

§end: i64

Character after the selection.

§

PerformAction

Perform an allowlisted accessibility action.

Fields

§name: String

Action name such as AXShowMenu.

§

ScrollTo

Scroll an element into view.

§

Move

Move the pointer without clicking.

Fields

§x: i32

Logical x.

§y: i32

Logical y.

§

Type

Type text into the focused control.

Fields

§text: String

Text to type.

§

Key

Press a key combination such as cmd+shift+4.

Fields

§keys: String

Combo string.

§

Scroll

Scroll the wheel. Positive dy is down. Positive dx is right.

Fields

§x: Option<i32>

Optional pointer x. Must be paired with y.

§y: Option<i32>

Optional pointer y. Must be paired with x.

§dx: Option<i32>

Horizontal wheel steps.

§dy: Option<i32>

Vertical wheel steps.

§direction: Option<ScrollDirection>

Direction used with amount.

§amount: Option<i32>

Wheel steps used with direction. Defaults to 1.

§

GetState

Screen, cursor, frontmost window, and a best-effort accessibility tree.

§

Wait

Sleep, then return.

Fields

§ms: Option<u64>

Milliseconds. Added to seconds when both are set.

§seconds: Option<f64>

Seconds, including fractions. Added to ms.

§

Displays

List displays without capturing pixels.

§

Isolation

Report what this build can isolate and what it cannot.

§

ListApps

List running applications. all includes accessory and prohibited apps.

Fields

§all: bool

Include accessory and prohibited activation policies.

§

ListWindows

List on-screen windows. app comes from the shared request context.

§

Launch

Launch an application named by the shared app field.

§

Activate

Activate an application named by the shared app field.

§

Quit

Ask an application to quit. force requests a forced terminate.

Fields

§force: bool

Force-quit when the platform supports it. Still requires confirmation.

§

PolicyCheck

Report whether policy would allow app. Does not perform an action.

§

Pause

Pause mutating actions until resume.

§

Resume

Clear the pause flag.

§

Doctor

Report permissions and the TCC identity.

The process exits 0 when the report is produced. permissions_ok in the body is the permission aggregate. prompt asks macOS to show dialogs. request is an alias of prompt.

Fields

§prompt: bool

Prompt for Accessibility, Screen Recording, Post Event, and Input Monitoring.

§open_settings: bool

Open the first missing System Settings pane. macOS only.

§x11: bool

Linux only: force X11 detection even when WAYLAND_DISPLAY is set. Other platforms ignore the field so the dispatcher can pass it unconditionally.

§

Tree

Numbered accessibility tree for the key window.

§

SessionEnd

Restore Electron accessibility flags and stop observers.

§

CursorPosition

Read the pointer. The Anthropic adapter maps cursor_position here.

§

Batch

Run several actions that share one target and one cache revision sequence.

Fields

§stop_on_error: bool

Stop after the first failed step. Defaults to true.

§actions: Vec<Value>

Native action objects. A nested batch is rejected at dispatch.

§

SessionPrune

Remove empty session directories and stale ones.

Fields

§dry_run: bool

Report matches without deleting them.

§ttl_secs: Option<u64>

Age in seconds after which a dead owner’s session is stale. Absent means 24 hours.

§

MenuList

Walk an application’s menu bar. Reads AXMenuBar -> AXMenuBarItem -> AXMenu.

--app selects the running app. The default depth is 4; depth caps it. Matches are case-insensitive. Disabled items are still reported.

Fields

§app: Option<String>

Override the shared --app flag with one of these variants: name, bundle id, or pid.

§depth: Option<u32>

Maximum depth below the menu bar. Default: 4. Caps recursive submenus.

§

MenuClick

Click a menu item by ">"-separated titles.

--app selects the running app. --path is a list of titles such as "File > Save As > Save". Matches are case-insensitive. Disabled items are not pressed.

Fields

§app: Option<String>

Override the shared --app flag.

§path: String

Path of menu titles separated by >.

§

AppleEvent

Send an Apple event via osascript. macOS only.

--app is recorded and used by the deny policy; the script body decides which application the event targets. --language is applescript (the default) or javascript. The script body is never logged verbatim.

Fields

§app: Option<String>

Override the shared --app flag.

§script: String

Script body passed to osascript -e. Never logged verbatim.

§language: Option<AppleEventLanguage>

applescript (default) or javascript.

§

ShortcutsRun

Run a Shortcuts workflow by name. macOS only.

The shortcuts binary is called with the workflow name as a single argument. A missing binary is execution_failed.

Fields

§name: String

Workflow name.

§

DockList

List the Dock items. macOS only.

§

DockClick

Click a Dock item by title. macOS only.

Fields

§title: String

Dock item title.

§

Spaces

Group the on-screen windows by the screen that contains each window’s center.

Mission Control moves are not attempted; the report only describes the current layout. The skylight feature, when active, may move windows between spaces; otherwise the action reports the visible state only.

§

BrowserTabs

List the tabs the running Chrome exposes. Requires --features cdp. Without the feature this returns unsupported.

§

BrowserActivate

Activate a tab by target_id. Requires --features cdp.

Fields

§target_id: Option<String>

CDP targetId to bring to the front.

§

BrowserNavigate

Navigate the named tab (or first page) to url. The URL is checked against [browser].blocked_urls before the websocket is touched.

Fields

§url: String

Destination URL.

§target_id: Option<String>

Restrict to one tab. Optional.

§

BrowserClick

Click an element matched by CSS selector. Requires --features cdp.

Fields

§selector: String

CSS selector.

§target_id: Option<String>

Restrict to one tab. Optional.

§

BrowserText

Read the innerText of the first element matched by CSS selector. Requires --features cdp. The current page URL is checked against [browser].blocked_urls first; a selector that matches nothing returns element_not_found.

Fields

§selector: String

CSS selector whose innerText should be returned.

§target_id: Option<String>

Restrict to one tab. Optional.

§

BrowserType

Type text into the element matched by selector (or the page body when no selector is given). Requires --features cdp. Classified like Action::Type for audit: the body is never stored, only its character count. The current page URL is checked against [browser].blocked_urls first.

Fields

§text: String

Text to type.

§selector: Option<String>

Optional CSS selector. When omitted the page body receives input.

§target_id: Option<String>

Restrict to one tab. Optional.

§

BrowserEval

Evaluate script in the page context and return the JSON value. Requires --features cdp. The script body is never logged verbatim; only its length and a small hash appear in the audit row.

Fields

§script: String

JavaScript source. Quoted on the CLI via --eval; here it is just a string field that the caller has already prepared.

§target_id: Option<String>

Restrict to one tab. Optional.

§

Ocr

Run OCR on the most recent capture for --app/window target. macOS only. Linux returns unsupported; Windows is a stub until P12.

Fields

§force: bool

Re-run OCR even when --app already produced it. Defaults to false.

Trait Implementations§

Source§

impl Clone for Action

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Action

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Action

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Action

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Action

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Action

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more