1use crate::support::*;
2
3#[derive(Debug, thiserror::Error)]
4pub enum EmbedError {
5 #[error(
6 "protocol plugin is required; call .protocol_plugin(...) or use LashCore::standard_builder()/LashCore::rlm_builder(...)"
7 )]
8 MissingProtocolPlugin,
9 #[error("model spec is required; hosts must supply explicit model metadata")]
10 MissingModelSpec,
11 #[error("effect host is required; provide an explicit effect host with .effect_host(...)")]
12 MissingEffectHost,
13 #[error(
14 "attachment store is required; provide an explicit attachment store with .attachment_store(...)"
15 )]
16 MissingAttachmentStore,
17 #[error(
18 "process execution environment store is required; provide an explicit process env store with .process_env_store(...)"
19 )]
20 MissingProcessEnvStore,
21 #[error("failed to create store for session `{session_id}`: {message}")]
22 StoreFactory { session_id: String, message: String },
23 #[error("store is bound to session `{loaded}` but builder requested `{requested}`")]
24 StoreSessionMismatch { loaded: String, requested: String },
25 #[error("durable process worker requires a LashCore store factory")]
26 MissingProcessWorkerStoreFactory,
27 #[error(
28 "durable session store requires a durable {facet}; an ephemeral {facet} cannot back a durable session store"
29 )]
30 DurableStorePeerRequired { facet: &'static str },
31 #[error(
32 "durable process registry requires a durable session store factory; call .store_factory(...) with a durable store"
33 )]
34 DurableProcessRegistryRequiresStoreFactory,
35 #[error(
36 "a process registry is configured for the default inline process work runner but no session store factory is wired; the runner rebuilds a session runtime per process and cannot do so without one. Wire .store_factory(...) - InMemorySessionStoreFactory::new() for ephemeral process execution, or a durable factory - or use .process_work_driver(...) for an externally driven durable runner."
37 )]
38 ProcessRegistryRequiresStoreFactory,
39 #[error("durable process worker config requires a LashCore process registry")]
40 MissingProcessRegistry,
41 #[error("session deletion requires a LashCore store factory")]
42 MissingSessionStoreFactory,
43 #[error("failed to delete process state for session `{session_id}`: {message}")]
44 SessionDeleteProcess { session_id: String, message: String },
45 #[error("missing required turn input for plugin `{plugin_id}`")]
46 MissingPluginTurnInput { plugin_id: &'static str },
47 #[error(
48 "configured effect host for {operation} is durable and requires a handler context; use .effects(&controller) and provide .turn_id(...) for replayable foreground requests"
49 )]
50 DurableEffectHostRequiresHandlerContext { operation: &'static str },
51 #[error(
52 "pull-style turn streams require an effect host that can create a static scoped controller; use stream_to(...) inside the handler context"
53 )]
54 StaticTurnStreamRequiresStaticEffectHost,
55 #[error("runtime session error: {0}")]
56 Session(#[from] SessionError),
57 #[error("runtime turn error: {0}")]
58 Runtime(#[from] lash_core::RuntimeError),
59 #[error("runtime plugin/control error: {0}")]
60 Plugin(#[from] lash_core::PluginError),
61 #[error("remote protocol error: {0}")]
62 RemoteProtocol(#[from] lash_remote_protocol::RemoteProtocolError),
63 #[error("failed to encode protocol turn options: {0}")]
64 ProtocolTurnOptions(#[from] serde_json::Error),
65 #[error("failed to decode protocol turn options: {0}")]
66 DecodeProtocolTurnOptions(#[from] lash_core::ProtocolTurnOptionsError),
67 #[error("runtime control unavailable: {0}")]
68 Control(#[from] lash_core::PluginOperationInvokeError),
69}
70
71pub type Result<T> = std::result::Result<T, EmbedError>;