use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum OperationExposure {
DefaultAgent,
OptIn,
Lifecycle,
}
impl OperationExposure {
pub fn as_str(self) -> &'static str {
match self {
Self::DefaultAgent => "defaultAgent",
Self::OptIn => "optIn",
Self::Lifecycle => "lifecycle",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum OperationCapability {
Navigation,
Observation,
Interaction,
JavaScript,
BrowserState,
Tabs,
Spa,
Wasm,
Network,
Policy,
Media,
Captcha,
Lifecycle,
}
impl OperationCapability {
pub fn as_str(self) -> &'static str {
match self {
Self::Navigation => "navigation",
Self::Observation => "observation",
Self::Interaction => "interaction",
Self::JavaScript => "javascript",
Self::BrowserState => "browser-state",
Self::Tabs => "tabs",
Self::Spa => "spa",
Self::Wasm => "wasm",
Self::Network => "network",
Self::Policy => "policy",
Self::Media => "media",
Self::Captcha => "captcha",
Self::Lifecycle => "lifecycle",
}
}
pub fn parse(value: &str) -> Option<Self> {
match value {
"navigation" => Some(Self::Navigation),
"observation" => Some(Self::Observation),
"interaction" => Some(Self::Interaction),
"javascript" => Some(Self::JavaScript),
"browser-state" | "browser_state" => Some(Self::BrowserState),
"tabs" => Some(Self::Tabs),
"spa" => Some(Self::Spa),
"wasm" => Some(Self::Wasm),
"network" => Some(Self::Network),
"policy" => Some(Self::Policy),
"media" => Some(Self::Media),
"captcha" => Some(Self::Captcha),
"lifecycle" => Some(Self::Lifecycle),
_ => None,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ToolManifestEntry {
pub path: String,
pub cmd: &'static str,
pub name: &'static str,
pub description: &'static str,
pub capability: &'static str,
pub exposure: &'static str,
pub read_only: bool,
pub destructive: bool,
pub input_schema: serde_json::Value,
pub tags: Vec<&'static str>,
}