Skip to main content

agent_sdk_store_file/
bundle.rs

1use std::path::{Path, PathBuf};
2
3use crate::{
4    FileAgentPoolStore, FileCheckpointStore, FileContentStore, FileEventArchive,
5    FileProviderArgumentStore, FileRunJournal, FileToolExecutionStore,
6};
7
8#[derive(Clone, Debug)]
9/// Filesystem-backed store bundle sharing one root directory.
10pub struct FileStoreBundle {
11    root: PathBuf,
12}
13
14impl FileStoreBundle {
15    /// Creates a store bundle rooted under the provided directory.
16    pub fn new(root: impl Into<PathBuf>) -> Self {
17        Self { root: root.into() }
18    }
19
20    /// Returns the root directory for this bundle.
21    pub fn root(&self) -> &Path {
22        &self.root
23    }
24
25    /// Returns a run journal adapter.
26    pub fn journal(&self) -> FileRunJournal {
27        FileRunJournal::new(self.root.clone())
28    }
29
30    /// Returns a checkpoint store adapter.
31    pub fn checkpoints(&self) -> FileCheckpointStore {
32        FileCheckpointStore::new(self.root.clone())
33    }
34
35    /// Returns a content store adapter.
36    pub fn content(&self) -> FileContentStore {
37        FileContentStore::new(self.root.clone())
38    }
39
40    /// Returns an event archive adapter.
41    pub fn event_archive(&self) -> FileEventArchive {
42        FileEventArchive::new(self.root.clone())
43    }
44
45    /// Returns a provider argument store adapter.
46    pub fn provider_arguments(&self) -> FileProviderArgumentStore {
47        FileProviderArgumentStore::new(self.root.clone())
48    }
49
50    /// Returns an agent-pool store adapter.
51    pub fn agent_pool(&self) -> FileAgentPoolStore {
52        FileAgentPoolStore::new(self.root.clone())
53    }
54
55    /// Returns a rebuildable tool-execution projection store adapter.
56    pub fn tool_execution(&self) -> FileToolExecutionStore {
57        FileToolExecutionStore::new(self.root.clone())
58    }
59}