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 crate::extensions::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
61#[derive(Debug, thiserror::Error)]
62pub enum AgentOsBuildError {
63    #[error(transparent)]
64    Agents(#[from] AgentRegistryError),
65
66    #[error(transparent)]
67    Bundle(#[from] BundleComposeError),
68
69    #[error(transparent)]
70    Tools(#[from] ToolRegistryError),
71
72    #[error(transparent)]
73    Behaviors(#[from] BehaviorRegistryError),
74
75    #[error(transparent)]
76    Providers(#[from] ProviderRegistryError),
77
78    #[error(transparent)]
79    Models(#[from] ModelRegistryError),
80
81    #[error(transparent)]
82    AgentCatalog(#[from] AgentCatalogError),
83
84    #[cfg(feature = "skills")]
85    #[error(transparent)]
86    Skills(#[from] SkillError),
87
88    #[cfg(feature = "skills")]
89    #[error(transparent)]
90    SkillRegistry(#[from] SkillRegistryError),
91
92    #[cfg(feature = "skills")]
93    #[error(transparent)]
94    SkillRegistryManager(#[from] SkillRegistryManagerError),
95
96    #[error(transparent)]
97    StopPolicies(#[from] StopPolicyRegistryError),
98
99    #[error("agent {agent_id} references an empty behavior id")]
100    AgentEmptyBehaviorRef { agent_id: String },
101
102    #[error("agent {agent_id} references reserved behavior id: {behavior_id}")]
103    AgentReservedBehaviorId {
104        agent_id: String,
105        behavior_id: String,
106    },
107
108    #[error("agent {agent_id} references unknown behavior id: {behavior_id}")]
109    AgentBehaviorNotFound {
110        agent_id: String,
111        behavior_id: String,
112    },
113
114    #[error("agent {agent_id} has duplicate behavior reference: {behavior_id}")]
115    AgentDuplicateBehaviorRef {
116        agent_id: String,
117        behavior_id: String,
118    },
119
120    #[error("agent {agent_id} references an empty stop condition id")]
121    AgentEmptyStopConditionRef { agent_id: String },
122
123    #[error("agent {agent_id} references unknown stop condition id: {stop_condition_id}")]
124    AgentStopConditionNotFound {
125        agent_id: String,
126        stop_condition_id: String,
127    },
128
129    #[error("agent {agent_id} has duplicate stop condition reference: {stop_condition_id}")]
130    AgentDuplicateStopConditionRef {
131        agent_id: String,
132        stop_condition_id: String,
133    },
134
135    #[error("models configured but no ProviderRegistry configured")]
136    ProvidersNotConfigured,
137
138    #[error("provider not found: {provider_id} (for model id: {model_id})")]
139    ProviderNotFound {
140        provider_id: String,
141        model_id: String,
142    },
143
144    #[cfg(feature = "skills")]
145    #[error("skills enabled but no skills configured")]
146    SkillsNotConfigured,
147}