1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum Error {
5 #[error("session is already running")]
6 SessionBusy,
7 #[error("cannot continue: session history is empty")]
8 EmptyConversation,
9 #[error("cannot continue: last conversation item is assistant output")]
10 InvalidContinuation,
11 #[error("turn stream closed before response.completed")]
12 StreamClosed,
13 #[error("event channel closed")]
14 EventChannelClosed,
15 #[error("turn aborted")]
16 Aborted,
17 #[error("runtime error: {0}")]
18 Runtime(#[from] lha_llm::Error),
19 #[error(transparent)]
20 Skill(#[from] crate::skills::SkillError),
21 #[error("tool error: {0}")]
22 Tool(#[from] crate::tools::ToolError),
23}
24
25pub type Result<T> = std::result::Result<T, Error>;
26
27#[derive(Debug, Error)]
28pub enum RunCollectTextError {
29 #[error(transparent)]
30 Core(#[from] Error),
31 #[error("turn failed: {0}")]
32 TurnFailed(String),
33}