diff --git a/src/blacki/registry.py b/src/blacki/registry.py index 1c9a4d0..b4307fb 100644 --- a/src/blacki/registry.py +++ b/src/blacki/registry.py @@ -232,10 +232,15 @@ def build_tool_config_from_env() -> ToolConfig: import os skills_dir = Path(__file__).parent / "skills" + # Match server.py AGENT_DIR calculation (points to src/, not project root) + agent_dir = os.getenv("AGENT_DIR", str(Path(__file__).resolve().parent.parent)) + default_sqlite_path = str(Path(agent_dir) / ".adk" / "tools.db") + + sqlite_path = os.getenv("SQLITE_PATH", "").strip() or default_sqlite_path return ToolConfig( brave_search_api_key=os.getenv("BRAVE_SEARCH_API_KEY", "").strip() or None, - sqlite_path=os.getenv("SQLITE_PATH", "").strip() or None, + sqlite_path=sqlite_path, sandbox_enabled=os.getenv("SANDBOX_ENABLED", "false").strip().lower() in ("true", "1", "yes"), skills_dir=skills_dir, diff --git a/tests/test_registry.py b/tests/test_registry.py index b2fe365..3e5b0c5 100644 --- a/tests/test_registry.py +++ b/tests/test_registry.py @@ -105,12 +105,13 @@ class TestBuildToolConfigFromEnv: """Tests for build_tool_config_from_env function.""" def test_empty_env(self) -> None: - """Should return default config with empty env.""" + """Should return default config with default sqlite path.""" with patch.dict("os.environ", {}, clear=True): config = build_tool_config_from_env() assert config.brave_search_api_key is None - assert config.sqlite_path is None + assert config.sqlite_path is not None + assert config.sqlite_path.endswith(".adk/tools.db") assert config.sandbox_enabled is False assert config.skills_dir is not None