263c357d06
Complete workspace CLI coverage with status, list, retrieve, delete commands. Add 6 separate agent tools (workspace_search, workspace_index, workspace_status, workspace_list, workspace_retrieve, workspace_delete) with per-tool schemas and check_fn gating on workspace.enabled. Wire /workspace slash command in interactive REPL with Rich formatting. - workspace_search and workspace_index are default-enabled in core tools - Full workspace toolset available for opt-in via /tools enable - BaseIndexer ABC extended with list_files(), retrieve(), delete() - SQLiteFTS5Store gains list_files() and get_chunks_for_file()
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
# workspace/base.py
|
|
"""BaseIndexer ABC — the plugin contract for workspace backends.
|
|
|
|
Implementations must define __init__(config), index(), and search().
|
|
status() is optional (default returns empty dict).
|
|
"""
|
|
|
|
from abc import ABC, abstractmethod
|
|
from typing import Callable
|
|
|
|
from workspace.config import WorkspaceConfig
|
|
from workspace.types import IndexSummary, SearchResult
|
|
|
|
ProgressCallback = Callable[[int, int, str], None]
|
|
|
|
|
|
class BaseIndexer(ABC):
|
|
@abstractmethod
|
|
def __init__(self, config: WorkspaceConfig) -> None: ...
|
|
|
|
@abstractmethod
|
|
def index(self, *, progress: ProgressCallback | None = None) -> IndexSummary: ...
|
|
|
|
@abstractmethod
|
|
def search(
|
|
self,
|
|
query: str,
|
|
*,
|
|
limit: int = 20,
|
|
path_prefix: str | None = None,
|
|
file_glob: str | None = None,
|
|
) -> list[SearchResult]: ...
|
|
|
|
def status(self) -> dict:
|
|
return {}
|
|
|
|
def list_files(self) -> list[dict]:
|
|
return []
|
|
|
|
def retrieve(self, path: str) -> list[SearchResult]:
|
|
return []
|
|
|
|
def delete(self, path: str) -> bool:
|
|
return False
|