agent_sdk_store_sqlite/
bundle.rs1use std::path::{Path, PathBuf};
2
3use crate::{
4 SqliteAgentPoolStore, SqliteCheckpointStore, SqliteContentStore, SqliteEventArchive,
5 SqliteProviderArgumentStore, SqliteRunJournal, SqliteToolExecutionStore,
6};
7
8#[derive(Clone, Debug)]
9pub struct SqliteStoreBundle {
11 path: PathBuf,
12}
13
14impl SqliteStoreBundle {
15 pub fn open(path: impl Into<PathBuf>) -> Result<Self, agent_sdk_core::AgentError> {
17 let path = path.into();
18 let bundle = Self { path };
19 let _ = bundle.journal()?;
20 let _ = bundle.checkpoints()?;
21 let _ = bundle.content()?;
22 let _ = bundle.event_archive()?;
23 let _ = bundle.provider_arguments()?;
24 let _ = bundle.tool_execution()?;
25 let _ = bundle.agent_pool()?;
26 Ok(bundle)
27 }
28
29 pub fn path(&self) -> &Path {
31 &self.path
32 }
33
34 pub fn journal(&self) -> Result<SqliteRunJournal, agent_sdk_core::AgentError> {
36 SqliteRunJournal::open(&self.path)
37 }
38
39 pub fn checkpoints(&self) -> Result<SqliteCheckpointStore, agent_sdk_core::AgentError> {
41 SqliteCheckpointStore::open(&self.path)
42 }
43
44 pub fn content(&self) -> Result<SqliteContentStore, agent_sdk_core::AgentError> {
46 SqliteContentStore::open(&self.path)
47 }
48
49 pub fn event_archive(&self) -> Result<SqliteEventArchive, agent_sdk_core::AgentError> {
51 SqliteEventArchive::open(&self.path)
52 }
53
54 pub fn provider_arguments(
56 &self,
57 ) -> Result<SqliteProviderArgumentStore, agent_sdk_core::AgentError> {
58 SqliteProviderArgumentStore::open(&self.path)
59 }
60
61 pub fn agent_pool(&self) -> Result<SqliteAgentPoolStore, agent_sdk_core::AgentError> {
63 SqliteAgentPoolStore::open(&self.path)
64 }
65
66 pub fn tool_execution(&self) -> Result<SqliteToolExecutionStore, agent_sdk_core::AgentError> {
68 SqliteToolExecutionStore::open(&self.path)
69 }
70}