Skip to main content

vs_daemon/daemon/
responses.rs

1//! Per-primitive response types and the [`ActCall`] input bundle.
2//!
3//! Split out of `daemon/mod.rs` so each handler file can `use
4//! super::responses::*;` without dragging in the rest of the daemon's
5//! internals.
6
7use vs_engine_webkit::{ActTarget as EngineTarget, Action as EngineAction, LayoutBox};
8use vs_protocol::{Ref, StateToken, Warning};
9
10use crate::page_state::ViewForm;
11
12#[derive(Debug, Clone, PartialEq, Eq)]
13pub struct SessionOpenResponse {
14    pub session_id: String,
15    pub token: StateToken,
16}
17
18#[derive(Debug, Clone, PartialEq, Eq)]
19pub struct SessionCloseResponse;
20
21#[derive(Debug, Clone, PartialEq, Eq)]
22pub struct OpenResponse {
23    pub page_id: String,
24    pub token: StateToken,
25    pub warnings: Vec<Warning>,
26}
27
28#[derive(Debug, Clone, PartialEq, Eq)]
29pub struct CloseResponse;
30
31#[derive(Debug, Clone, PartialEq, Eq)]
32pub struct ViewResponse {
33    pub token: StateToken,
34    pub form: ViewForm,
35    pub warnings: Vec<Warning>,
36}
37
38#[derive(Debug, Clone, PartialEq, Eq)]
39pub struct ReadResponse {
40    pub token: StateToken,
41    pub body: String,
42}
43
44/// Inputs to [`crate::Daemon::act`]. Bundled into a struct so the
45/// method signature stays one-arg and clippy's `too_many_arguments`
46/// lint is satisfied honestly.
47#[derive(Debug, Clone)]
48pub struct ActCall {
49    pub session_id: String,
50    pub page_id: String,
51    pub target: EngineTarget,
52    pub action: EngineAction,
53    pub before_token: StateToken,
54    pub args_hash: String,
55    pub args_redacted: String,
56    pub group_label: Option<String>,
57}
58
59#[derive(Debug, Clone, PartialEq, Eq)]
60pub struct ActResponse {
61    pub token: StateToken,
62    pub warnings: Vec<Warning>,
63}
64
65#[derive(Debug, Clone, PartialEq, Eq)]
66pub struct FindResponse {
67    pub hits: Vec<FindHit>,
68}
69
70#[derive(Debug, Clone, PartialEq, Eq)]
71pub struct FindHit {
72    pub page_id: String,
73    pub r: Ref,
74    pub role: String,
75    pub label: String,
76}
77
78#[derive(Debug, Clone, PartialEq, Eq)]
79pub struct WaitResponse {
80    pub token: StateToken,
81}
82
83#[derive(Debug, Clone, PartialEq, Eq)]
84pub struct StatusResponse {
85    pub body: String,
86}
87
88#[derive(Debug, Clone, PartialEq, Eq)]
89pub struct ExtractResponse {
90    pub token: StateToken,
91    pub records: Vec<Vec<String>>,
92}
93
94#[derive(Debug, Clone, PartialEq, Eq)]
95pub struct MarkResponse {
96    pub mark_id: String,
97    pub token: StateToken,
98}
99
100#[derive(Debug, Clone, PartialEq, Eq)]
101pub struct AnnotateResponse {
102    pub id: String,
103}
104
105#[derive(Debug, Clone, PartialEq, Eq)]
106pub struct LogResponse {
107    pub rows: Vec<vs_store::Action>,
108}
109
110#[derive(Debug, Clone, PartialEq, Eq)]
111pub struct SkillListResponse {
112    pub names: Vec<String>,
113}
114
115#[derive(Debug, Clone, PartialEq, Eq)]
116pub struct SkillShowResponse {
117    pub body: String,
118}
119
120#[derive(Debug, Clone, PartialEq, Eq)]
121pub struct CaptureResponse {
122    pub path: std::path::PathBuf,
123    pub token: StateToken,
124}
125
126#[derive(Debug, Clone, PartialEq, Eq)]
127pub struct ViewportResponse {
128    pub token: StateToken,
129    pub warnings: Vec<Warning>,
130}
131
132#[derive(Debug, Clone, PartialEq)]
133pub struct LayoutResponse {
134    pub boxes: Vec<LayoutBox>,
135    pub token: StateToken,
136}
137
138#[derive(Debug, Clone, PartialEq, Eq)]
139pub struct AuthSaveResponse {
140    pub name: String,
141}
142
143#[derive(Debug, Clone, PartialEq, Eq)]
144pub struct AuthLoadResponse {
145    pub token: StateToken,
146    pub warnings: Vec<Warning>,
147}
148
149#[derive(Debug, Clone, PartialEq, Eq)]
150pub struct AuthListResponse {
151    pub names: Vec<String>,
152}
153
154#[derive(Debug, Clone, PartialEq, Eq)]
155pub struct AuthClearResponse;