Skip to main content

rain_engine_core/
traits.rs

1#![allow(unused_imports)]
2
3use crate::{AgentStateSnapshot, AgentTrigger, KernelEvent};
4use async_trait::async_trait;
5
6pub use crate::blob::{BlobStore, BlobStoreError, InMemoryBlobStore};
7pub use crate::coordination::{
8    CoordinationClaim, CoordinationError, CoordinationStore, InMemoryCoordinationStore,
9};
10pub use crate::engine::{NativeSkill, SkillExecutionError, SkillExecutor, WasmSkillExecutor};
11pub use crate::llm::{LlmProvider, MockLlmProvider, ProviderError, ProviderErrorKind};
12pub use crate::memory::{InMemoryMemoryStore, MemoryError, MemoryStore, MemoryStoreExt};
13pub use crate::retrieval::{
14    RetrievalError, RetrievalStore, RetrievedItem, RetrievedItemKind, WorkingSet,
15};
16
17#[derive(Debug, Clone, PartialEq, Default)]
18pub struct PlannerOutput {
19    pub events: Vec<KernelEvent>,
20    pub proposed_plan: Option<crate::ExecutionPlan>,
21}
22
23#[async_trait]
24pub trait Planner: Send + Sync {
25    async fn plan(&self, state: &AgentStateSnapshot, trigger: &AgentTrigger) -> PlannerOutput;
26}
27
28#[async_trait]
29pub trait SkillStore: Send + Sync {
30    async fn store_skill(
31        &self,
32        manifest: crate::SkillManifest,
33        wasm_bytes: Vec<u8>,
34    ) -> Result<(), String>;
35    async fn list_skills(&self) -> Result<Vec<(crate::SkillManifest, Vec<u8>)>, String>;
36    async fn remove_skill(&self, name: &str) -> Result<(), String>;
37}
38
39#[async_trait]
40pub trait StateProjectionCache: Send + Sync {
41    async fn get_projection(
42        &self,
43        session_id: &str,
44    ) -> Result<Option<crate::SessionSnapshot>, String>;
45    async fn set_projection(
46        &self,
47        session_id: &str,
48        snapshot: crate::SessionSnapshot,
49    ) -> Result<(), String>;
50    async fn invalidate(&self, session_id: &str) -> Result<(), String>;
51}