92 lines
2.3 KiB
Python
92 lines
2.3 KiB
Python
"""Built-in tools for Crystal's agentic framework.
|
|
|
|
Provides filesystem tools (Read, Write, Edit, Glob, Grep, Ls, Tree, Diff),
|
|
command execution (Bash), task management (TaskCreate, TaskUpdate, TaskList,
|
|
TaskGet), and KV API tools (SearchKB, VerifyFact, CorrectFact, ValidateBatch,
|
|
ValidateLocale, InvalidateCache, LegalReview) that operate within the platform
|
|
root directory.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from ..registry import ToolRegistry
|
|
from .bash import BashTool
|
|
from .correct_fact import CorrectFactTool
|
|
from .diff import DiffTool
|
|
from .edit import EditTool
|
|
from .glob import GlobTool
|
|
from .grep import GrepTool
|
|
from .invalidate_cache import InvalidateCacheTool
|
|
from .legal_review import LegalReviewTool
|
|
from .ls import ListDirectoryTool
|
|
from .read import ReadTool
|
|
from .search_kb import SearchKBTool
|
|
from .task_create import TaskCreateTool
|
|
from .task_get import TaskGetTool
|
|
from .task_list import TaskListTool
|
|
from .task_update import TaskUpdateTool
|
|
from .tree import TreeTool
|
|
from .validate_batch import ValidateBatchTool
|
|
from .validate_locale import ValidateLocaleTool
|
|
from .verify_fact import VerifyFactTool
|
|
from .write import WriteTool
|
|
|
|
PLATFORM_ROOT = Path.home() / "Code/@projects/@lilith/lilith-platform"
|
|
|
|
ALL_TOOLS: list[type] = [
|
|
ReadTool,
|
|
WriteTool,
|
|
EditTool,
|
|
GlobTool,
|
|
GrepTool,
|
|
ListDirectoryTool,
|
|
TreeTool,
|
|
DiffTool,
|
|
BashTool,
|
|
TaskCreateTool,
|
|
TaskUpdateTool,
|
|
TaskListTool,
|
|
TaskGetTool,
|
|
SearchKBTool,
|
|
VerifyFactTool,
|
|
CorrectFactTool,
|
|
ValidateBatchTool,
|
|
ValidateLocaleTool,
|
|
InvalidateCacheTool,
|
|
LegalReviewTool,
|
|
]
|
|
|
|
|
|
def register_builtin_tools(registry: ToolRegistry) -> None:
|
|
"""Register all built-in tools with the given registry."""
|
|
for tool_cls in ALL_TOOLS:
|
|
registry.register(tool_cls)
|
|
|
|
|
|
__all__ = [
|
|
"ALL_TOOLS",
|
|
"BashTool",
|
|
"CorrectFactTool",
|
|
"DiffTool",
|
|
"EditTool",
|
|
"GlobTool",
|
|
"GrepTool",
|
|
"InvalidateCacheTool",
|
|
"LegalReviewTool",
|
|
"ListDirectoryTool",
|
|
"PLATFORM_ROOT",
|
|
"ReadTool",
|
|
"SearchKBTool",
|
|
"TaskCreateTool",
|
|
"TaskGetTool",
|
|
"TaskListTool",
|
|
"TaskUpdateTool",
|
|
"TreeTool",
|
|
"ValidateBatchTool",
|
|
"ValidateLocaleTool",
|
|
"VerifyFactTool",
|
|
"WriteTool",
|
|
"register_builtin_tools",
|
|
]
|