scud/extensions/
types.rs

1use serde::{Deserialize, Serialize};
2use std::fmt;
3
4/// Unique identifier for an extension
5#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
6pub struct ExtensionId(pub String);
7
8impl fmt::Display for ExtensionId {
9    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
10        write!(f, "{}", self.0)
11    }
12}
13
14impl From<String> for ExtensionId {
15    fn from(s: String) -> Self {
16        ExtensionId(s)
17    }
18}
19
20impl From<&str> for ExtensionId {
21    fn from(s: &str) -> Self {
22        ExtensionId(s.to_string())
23    }
24}
25
26/// Function signature for extension-provided tools
27pub type ToolFn =
28    fn(&[serde_json::Value]) -> Result<serde_json::Value, Box<dyn std::error::Error + Send + Sync>>;