eoka_protocol/
metadata.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4pub enum OperationExposure {
5 DefaultAgent,
6 OptIn,
7 Lifecycle,
8}
9
10impl OperationExposure {
11 pub fn as_str(self) -> &'static str {
12 match self {
13 Self::DefaultAgent => "defaultAgent",
14 Self::OptIn => "optIn",
15 Self::Lifecycle => "lifecycle",
16 }
17 }
18}
19
20#[derive(Debug, Clone, Copy, PartialEq, Eq)]
21pub enum OperationCapability {
22 Navigation,
23 Observation,
24 Interaction,
25 JavaScript,
26 BrowserState,
27 Tabs,
28 Spa,
29 Wasm,
30 Network,
31 Policy,
32 Media,
33 Captcha,
34 Lifecycle,
35}
36
37impl OperationCapability {
38 pub fn as_str(self) -> &'static str {
39 match self {
40 Self::Navigation => "navigation",
41 Self::Observation => "observation",
42 Self::Interaction => "interaction",
43 Self::JavaScript => "javascript",
44 Self::BrowserState => "browser-state",
45 Self::Tabs => "tabs",
46 Self::Spa => "spa",
47 Self::Wasm => "wasm",
48 Self::Network => "network",
49 Self::Policy => "policy",
50 Self::Media => "media",
51 Self::Captcha => "captcha",
52 Self::Lifecycle => "lifecycle",
53 }
54 }
55
56 pub fn parse(value: &str) -> Option<Self> {
57 match value {
58 "navigation" => Some(Self::Navigation),
59 "observation" => Some(Self::Observation),
60 "interaction" => Some(Self::Interaction),
61 "javascript" => Some(Self::JavaScript),
62 "browser-state" | "browser_state" => Some(Self::BrowserState),
63 "tabs" => Some(Self::Tabs),
64 "spa" => Some(Self::Spa),
65 "wasm" => Some(Self::Wasm),
66 "network" => Some(Self::Network),
67 "policy" => Some(Self::Policy),
68 "media" => Some(Self::Media),
69 "captcha" => Some(Self::Captcha),
70 "lifecycle" => Some(Self::Lifecycle),
71 _ => None,
72 }
73 }
74}
75
76#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(rename_all = "camelCase")]
78pub struct ToolManifestEntry {
79 pub path: String,
80 pub cmd: &'static str,
81 pub name: &'static str,
82 pub description: &'static str,
83 pub capability: &'static str,
84 pub exposure: &'static str,
85 pub read_only: bool,
86 pub destructive: bool,
87 pub input_schema: serde_json::Value,
88 pub tags: Vec<&'static str>,
89}