1use crate::safeguard::Safeguard;
2use crate::store::StoreError;
3
4#[derive(Debug, Clone, PartialEq, thiserror::Error)]
6#[non_exhaustive]
7pub enum BuildError {
8 #[error("agent id must not be empty")]
9 EmptyAgentId,
10 #[error("no provider configured")]
11 MissingProvider,
12 #[error("no model configured: call `.model(..)` (the provider names no default model)")]
15 MissingModel,
16 #[error("duplicate tool name `{0}`")]
17 DuplicateTool(String),
18 #[error("invalid tool name `{0}`: use 1-64 characters from [a-zA-Z0-9_-]")]
19 InvalidToolName(String),
20 #[error(
21 "agent has tools but no hook enforces or attestation covers the {0} safeguard; \
22 add the policy hook, `attest` it, or `allow_unguarded`"
23 )]
24 MissingSafeguard(Safeguard),
25}
26
27#[derive(Debug, thiserror::Error)]
31#[non_exhaustive]
32pub enum CoreError {
33 #[error("state belongs to agent `{found}`, not `{expected}`")]
34 AgentMismatch { expected: String, found: String },
35 #[error("nothing to resume: the run is not interrupted")]
36 NotInterrupted,
37 #[error("the run is interrupted; settle it with `Agent::resume` first")]
38 PendingInterruption,
39 #[error("saved run state has schema {found}; this kernel resumes up to {supported}")]
40 UnsupportedRunState { found: u32, supported: u32 },
41 #[error("this approval was already used; the call it approved does not run again")]
44 ApprovalAlreadyUsed,
45 #[error(transparent)]
46 Store(#[from] StoreError),
47}