codewhale_memory/
runtime.rs1use crate::{Access, Result, Scope, Store, protocol::ToolServer};
4use std::path::PathBuf;
5
6#[derive(Debug, Clone)]
7pub struct RuntimeOptions {
8 pub enabled: bool,
9 pub database: PathBuf,
10 pub workspace_root: Option<PathBuf>,
11}
12
13pub fn open_tools(
16 options: RuntimeOptions,
17 access: Access,
18 write_scope: Scope,
19 checkpoint_scope: Option<Scope>,
20) -> Result<Option<ToolServer>> {
21 if !options.enabled {
22 return Ok(None);
23 }
24 let store = Store::open(&options.database)?;
25 Ok(Some(ToolServer::new(
26 store,
27 access,
28 write_scope,
29 checkpoint_scope,
30 options.workspace_root,
31 )?))
32}