agent_air_runtime/skills/
types.rs1use serde::{Deserialize, Serialize};
7use std::collections::HashMap;
8use std::path::PathBuf;
9
10#[derive(Debug, Clone, Serialize, Deserialize)]
12pub struct SkillMetadata {
13 pub name: String,
15
16 pub description: String,
18
19 #[serde(default)]
21 pub license: Option<String>,
22
23 #[serde(default)]
25 pub compatibility: Option<String>,
26
27 #[serde(default)]
29 pub metadata: Option<HashMap<String, String>>,
30
31 #[serde(default, rename = "allowed-tools")]
33 pub allowed_tools: Option<String>,
34}
35
36#[derive(Debug, Clone)]
38pub struct Skill {
39 pub metadata: SkillMetadata,
41
42 pub path: PathBuf,
44
45 pub skill_md_path: PathBuf,
47}
48
49#[derive(Debug, Default)]
51pub struct SkillReloadResult {
52 pub added: Vec<String>,
54
55 pub removed: Vec<String>,
57
58 pub errors: Vec<SkillDiscoveryError>,
60}
61
62#[derive(Debug, Clone)]
64pub struct SkillDiscoveryError {
65 pub path: PathBuf,
67
68 pub message: String,
70}
71
72impl std::fmt::Display for SkillDiscoveryError {
73 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
74 write!(f, "{}: {}", self.path.display(), self.message)
75 }
76}
77
78impl std::error::Error for SkillDiscoveryError {}
79
80impl SkillDiscoveryError {
81 pub fn new(path: PathBuf, message: impl Into<String>) -> Self {
82 Self {
83 path,
84 message: message.into(),
85 }
86 }
87}