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
119
120
121
122
123
//! Error types for each protocol.
use thiserror::Error;
/// Operator execution errors.
#[non_exhaustive]
#[derive(Debug, Error)]
pub enum OperatorError {
/// An error from the model/LLM provider.
#[error("model error: {0}")]
Model(String),
/// An error during sub-dispatch execution.
#[error("sub-dispatch error in {operator}: {message}")]
SubDispatch {
/// Name of the operator that failed.
operator: String,
/// Error message.
message: String,
},
/// Context assembly failed before the model call.
#[error("context assembly failed: {0}")]
ContextAssembly(String),
/// The operator failed but retrying might succeed.
/// The orchestrator's retry policy decides.
#[error("retryable: {0}")]
Retryable(String),
/// The operator failed and retrying won't help.
/// Budget exceeded, invalid input, safety refusal.
#[error("non-retryable: {0}")]
NonRetryable(String),
/// Catch-all. Include context.
#[error("{0}")]
Other(#[from] Box<dyn std::error::Error + Send + Sync>),
}
/// Orchestration errors.
#[non_exhaustive]
#[derive(Debug, Error)]
pub enum OrchError {
/// The requested operator was not found.
#[error("operator not found: {0}")]
OperatorNotFound(String),
/// The requested workflow was not found.
#[error("workflow not found: {0}")]
WorkflowNotFound(String),
/// Dispatching a turn failed.
#[error("dispatch failed: {0}")]
DispatchFailed(String),
/// Signal delivery failed.
#[error("signal delivery failed: {0}")]
SignalFailed(String),
/// An operator error propagated through orchestration.
#[error("operator error: {0}")]
OperatorError(#[from] OperatorError),
/// Catch-all.
#[error("{0}")]
Other(#[from] Box<dyn std::error::Error + Send + Sync>),
}
/// State errors.
#[non_exhaustive]
#[derive(Debug, Error)]
pub enum StateError {
/// Key not found in the given scope.
#[error("not found: {scope}/{key}")]
NotFound {
/// The scope that was searched.
scope: String,
/// The key that was not found.
key: String,
},
/// A write operation failed.
#[error("write failed: {0}")]
WriteFailed(String),
/// Serialization or deserialization error.
#[error("serialization error: {0}")]
Serialization(String),
/// Catch-all.
#[error("{0}")]
Other(#[from] Box<dyn std::error::Error + Send + Sync>),
}
/// Environment errors.
#[non_exhaustive]
#[derive(Debug, Error)]
pub enum EnvError {
/// Failed to provision the execution environment.
#[error("provisioning failed: {0}")]
ProvisionFailed(String),
/// The isolation boundary was violated.
#[error("isolation violation: {0}")]
IsolationViolation(String),
/// Credential injection failed.
#[error("credential injection failed: {0}")]
CredentialFailed(String),
/// A resource limit was exceeded.
#[error("resource limit exceeded: {0}")]
ResourceExceeded(String),
/// An operator error propagated through the environment.
#[error("operator error: {0}")]
OperatorError(#[from] OperatorError),
/// Catch-all.
#[error("{0}")]
Other(#[from] Box<dyn std::error::Error + Send + Sync>),
}