auditaur_core/
drive_bridge.rs1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3
4pub const DRIVE_BRIDGE_CAPABILITY: &str = "drive_bridge";
5pub const DRIVE_BRIDGE_PROTOCOL_VERSION: u8 = 1;
6pub const DRIVE_BRIDGE_DIR: &str = "drive-bridge";
7pub const DRIVE_BRIDGE_REQUESTS_DIR: &str = "requests";
8pub const DRIVE_BRIDGE_IN_FLIGHT_DIR: &str = "in-flight";
9pub const DRIVE_BRIDGE_RESPONSES_DIR: &str = "responses";
10pub const DRIVE_BRIDGE_STATUS_FILE: &str = "status.json";
11pub const DRIVE_BRIDGE_STALE_FILE_NANOS: i64 = 60_000_000_000;
12pub const DRIVE_BRIDGE_REQUEST_EVENT: &str = "auditaur://drive-bridge/request";
13
14#[derive(Debug, Clone, Serialize, Deserialize)]
15#[serde(rename_all = "camelCase")]
16pub struct DriveBridgeStatus {
17 pub schema_version: u8,
18 pub protocol_version: u8,
19 pub active: bool,
20 pub window_label: Option<String>,
21 pub registered_at_unix_nanos: i64,
22 pub last_heartbeat_unix_nanos: i64,
23 #[serde(default)]
24 pub targets: Vec<DriveBridgeTarget>,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(rename_all = "camelCase")]
29pub struct DriveBridgeTarget {
30 pub target_id: String,
31 pub title: String,
32 pub window_label: Option<String>,
33 pub active: bool,
34 pub last_heartbeat_unix_nanos: i64,
35}
36
37#[derive(Debug, Clone, Serialize, Deserialize)]
38#[serde(rename_all = "camelCase")]
39pub struct DriveBridgeRequest {
40 pub schema_version: u8,
41 pub protocol_version: u8,
42 pub request_id: String,
43 pub action: String,
44 pub selector: Option<String>,
45 pub value: Option<String>,
46 pub visible_only: bool,
47 #[serde(default)]
48 pub window_label: Option<String>,
49 pub test_id: Option<String>,
50 pub step_id: Option<String>,
51 pub created_at_unix_nanos: i64,
52}
53
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(rename_all = "camelCase")]
56pub struct DriveBridgeResponse {
57 pub schema_version: u8,
58 pub protocol_version: u8,
59 pub request_id: String,
60 pub action: String,
61 pub selector: Option<String>,
62 pub visible_only: bool,
63 pub ok: bool,
64 pub payload: Value,
65 pub error: Option<String>,
66 pub completed_at_unix_nanos: i64,
67}