Files
hermes-agent/workspace/__init__.py
T
alt-glitch 4fb0c7d08d refactor(workspace): remove indexer.py and search.py, use DefaultIndexer everywhere
Delete the old workspace/indexer.py and workspace/search.py modules.
All test imports now use workspace.default.DefaultIndexer directly.
Backwards-compat re-exports removed from workspace/__init__.py.
2026-04-18 15:54:54 +05:30

49 lines
1.2 KiB
Python

"""Workspace indexing and search.
Public API:
get_indexer(config) -> BaseIndexer
load_workspace_config() -> WorkspaceConfig
"""
from __future__ import annotations
import logging
from workspace.base import BaseIndexer
from workspace.config import WorkspaceConfig, load_workspace_config
from workspace.default import DefaultIndexer
from workspace.types import IndexingError, IndexSummary, SearchResult
log = logging.getLogger(__name__)
def get_indexer(config: WorkspaceConfig | None = None) -> BaseIndexer:
if config is None:
config = load_workspace_config()
if config.indexer == "default":
return DefaultIndexer(config)
try:
from plugins.workspace import load_workspace_indexer
cls = load_workspace_indexer(config.indexer)
except ImportError:
cls = None
if cls is None:
log.warning(
"Indexer plugin '%s' not found, falling back to default", config.indexer
)
return DefaultIndexer(config)
return cls(config)
__all__ = [
"BaseIndexer",
"DefaultIndexer",
"WorkspaceConfig",
"load_workspace_config",
"get_indexer",
"IndexingError",
"IndexSummary",
"SearchResult",
]