Skip to main content

agent_hub_runtime/core/preview/
actions.rs

1//! Renderer-independent page operation contract.
2use serde::Deserialize;
3use serde_json::Value;
4#[derive(Deserialize)]
5#[serde(tag = "kind", rename_all = "snake_case")]
6pub enum Action {
7    SetTheme {
8        dark: bool,
9        #[serde(default)]
10        system: bool,
11    },
12    VerifyRevision {
13        expected_revision: String,
14    },
15    HandleDialog {
16        accept: bool,
17        prompt: Option<String>,
18    },
19    CancelUpload {
20        token: String,
21    },
22    InspectRef {
23        reference: String,
24    },
25    ClickRef {
26        reference: String,
27    },
28    FillRef {
29        reference: String,
30        value: String,
31    },
32    Navigate {
33        url: String,
34    },
35    Reload {
36        hard: bool,
37    },
38    Devtools,
39    Stop,
40    Back,
41    Forward,
42    Resize {
43        #[serde(default)]
44        device_scale_factor: Option<f64>,
45        width: u32,
46        height: u32,
47        mobile: bool,
48    },
49    Mouse {
50        x: f64,
51        y: f64,
52        event: String,
53        button: Option<String>,
54        delta_x: Option<f64>,
55        delta_y: Option<f64>,
56    },
57    Text {
58        text: String,
59    },
60    Key {
61        key: String,
62        code: String,
63        modifiers: u32,
64    },
65    Evaluate {
66        expression: String,
67    },
68    Pick {
69        x: f64,
70        y: f64,
71    },
72    Snapshot,
73    Screenshot {
74        full: bool,
75        clip: Option<Value>,
76        #[serde(default)]
77        expected_revision: Option<String>,
78    },
79    Find {
80        text: String,
81        backwards: bool,
82    },
83    Cookies,
84    ImportCookies {
85        cookies: Value,
86    },
87    Storage,
88}
89
90#[cfg(test)]
91#[path = "actions_tests.rs"]
92mod tests;