1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
use async_trait;
use Debug;
use crateSkillError;
use crateSkillFilter;
use crateSkillSummary;
use crate;
/// Skill lifecycle management trait.
///
/// `SkillRegistry` defines the core abstraction for managing skills throughout
/// their lifecycle: registration, lookup, search, disable/enable, and removal.
///
/// Implementations may be backed by in-memory collections, file-system
/// manifests, SQLite databases, or any other storage layer. All operations
/// are async to avoid blocking the runtime on I/O.
///
/// # Required bounds
///
/// `Send + Sync` so the registry can be shared across tasks via `Arc`.
/// `Debug` so tracing and logging can inspect the registry for diagnostics.
///
/// # Disabled skills
///
/// When [`enable`](Self::enable) is set to `false`, the skill is considered
/// disabled. Disabled skills MAY still appear in [`get`](Self::get) results
/// but MUST NOT be executed. Implementations SHOULD exclude disabled skills
/// from [`list`](Self::list) results by default (use [`SkillFilter::include_disabled`]
/// to override).
///
/// # Thread safety
///
/// All methods take `&self` (not `&mut self`), allowing shared references
/// to be used concurrently. Implementations must use interior mutability
/// (e.g. `tokio::sync::RwLock`, `std::sync::RwLock`) for mutable state.
///
/// # Examples
///
/// ```ignore
/// use xz_skill_core::registry::SkillRegistry;
/// use xz_skill_core::types::skill::{Skill, UpsertResult};
///
/// async fn example(registry: &dyn SkillRegistry) -> Result<(), SkillError> {
/// let count = registry.count().await?;
/// assert_eq!(count, 0);
///
/// let skill = Skill { id: "my-skill".into(), ..Default::default() };
/// let result = registry.register(skill).await?;
/// assert!(matches!(result, UpsertResult::Created));
///
/// let retrieved = registry.get("my-skill").await?;
/// assert!(retrieved.is_some());
///
/// registry.enable("my-skill", false).await?;
/// registry.unregister("my-skill").await?;
/// Ok(())
/// }
/// ```