Skip to main content

tirea_agentos/composition/
errors.rs

1use super::{
2    bundle::BundleComposeError,
3    delegation::AgentCatalogError,
4    registry::{
5        AgentRegistryError, BehaviorRegistryError, ModelRegistryError, ProviderRegistryError,
6        StopPolicyRegistryError, ToolRegistryError,
7    },
8};
9#[cfg(feature = "skills")]
10use tirea_extension_skills::{SkillError, SkillRegistryError, SkillRegistryManagerError};
11
12#[derive(Debug, thiserror::Error)]
13pub enum AgentOsWiringError {
14    #[error("reserved behavior id cannot be used: {0}")]
15    ReservedBehaviorId(String),
16
17    #[error("behavior not found: {0}")]
18    BehaviorNotFound(String),
19
20    #[error("stop condition not found: {0}")]
21    StopConditionNotFound(String),
22
23    #[error("behavior id already installed: {0}")]
24    BehaviorAlreadyInstalled(String),
25
26    #[cfg(feature = "skills")]
27    #[error("skills tool id already registered: {0}")]
28    SkillsToolIdConflict(String),
29
30    #[cfg(feature = "skills")]
31    #[error("skills behavior already installed: {0}")]
32    SkillsBehaviorAlreadyInstalled(String),
33
34    #[cfg(feature = "skills")]
35    #[error("skills enabled but no skills configured")]
36    SkillsNotConfigured,
37
38    #[error("agent tool id already registered: {0}")]
39    AgentToolIdConflict(String),
40
41    #[error("agent tools behavior already installed: {0}")]
42    AgentToolsBehaviorAlreadyInstalled(String),
43
44    #[error("agent recovery behavior already installed: {0}")]
45    AgentRecoveryBehaviorAlreadyInstalled(String),
46
47    #[error("bundle '{bundle_id}' includes unsupported contribution in wiring: {kind}")]
48    BundleUnsupportedContribution { bundle_id: String, kind: String },
49
50    #[error("bundle '{bundle_id}' tool id already registered: {id}")]
51    BundleToolIdConflict { bundle_id: String, id: String },
52
53    #[error("bundle '{bundle_id}' behavior id mismatch: key={key} behavior.id()={behavior_id}")]
54    BundleBehaviorIdMismatch {
55        bundle_id: String,
56        key: String,
57        behavior_id: String,
58    },
59
60    #[error("plugin ordering cycle: {0}")]
61    PluginOrderingCycle(#[from] crate::runtime::wiring::PluginOrderingCycleError),
62}
63
64#[derive(Debug, thiserror::Error)]
65pub enum AgentOsBuildError {
66    #[error(transparent)]
67    Agents(#[from] AgentRegistryError),
68
69    #[error(transparent)]
70    Bundle(#[from] BundleComposeError),
71
72    #[error(transparent)]
73    Tools(#[from] ToolRegistryError),
74
75    #[error(transparent)]
76    Behaviors(#[from] BehaviorRegistryError),
77
78    #[error(transparent)]
79    Providers(#[from] ProviderRegistryError),
80
81    #[error(transparent)]
82    Models(#[from] ModelRegistryError),
83
84    #[error(transparent)]
85    AgentCatalog(#[from] AgentCatalogError),
86
87    #[cfg(feature = "skills")]
88    #[error(transparent)]
89    Skills(#[from] SkillError),
90
91    #[cfg(feature = "skills")]
92    #[error(transparent)]
93    SkillRegistry(#[from] SkillRegistryError),
94
95    #[cfg(feature = "skills")]
96    #[error(transparent)]
97    SkillRegistryManager(#[from] SkillRegistryManagerError),
98
99    #[error(transparent)]
100    StopPolicies(#[from] StopPolicyRegistryError),
101
102    #[error("agent {agent_id} references an empty behavior id")]
103    AgentEmptyBehaviorRef { agent_id: String },
104
105    #[error("agent {agent_id} references reserved behavior id: {behavior_id}")]
106    AgentReservedBehaviorId {
107        agent_id: String,
108        behavior_id: String,
109    },
110
111    #[error("agent {agent_id} references unknown behavior id: {behavior_id}")]
112    AgentBehaviorNotFound {
113        agent_id: String,
114        behavior_id: String,
115    },
116
117    #[error("agent {agent_id} has duplicate behavior reference: {behavior_id}")]
118    AgentDuplicateBehaviorRef {
119        agent_id: String,
120        behavior_id: String,
121    },
122
123    #[error("agent {agent_id} references an empty stop condition id")]
124    AgentEmptyStopConditionRef { agent_id: String },
125
126    #[error("agent {agent_id} references unknown stop condition id: {stop_condition_id}")]
127    AgentStopConditionNotFound {
128        agent_id: String,
129        stop_condition_id: String,
130    },
131
132    #[error("agent {agent_id} has duplicate stop condition reference: {stop_condition_id}")]
133    AgentDuplicateStopConditionRef {
134        agent_id: String,
135        stop_condition_id: String,
136    },
137
138    #[error("models configured but no ProviderRegistry configured")]
139    ProvidersNotConfigured,
140
141    #[error("provider not found: {provider_id} (for model id: {model_id})")]
142    ProviderNotFound {
143        provider_id: String,
144        model_id: String,
145    },
146
147    #[cfg(feature = "skills")]
148    #[error("skills enabled but no skills configured")]
149    SkillsNotConfigured,
150}