2026-03-21 10:13:29 +08:00
|
|
|
from app.agents.tools.search import (
|
feat(agents): Phase 6 tool system refactoring
Phase 6.1: ToolRegistry infrastructure
- Add ToolManifest with ToolCategory, PermissionClass, SideEffectScope
- Add ToolRegistry singleton with register/get/unregister/list/search
- Add BaseTool abstract class with ReadTool/WriteTool/DBWriteTool/ExternalTool/NetworkTool subclasses
- Add migration layer for backward compatibility
Phase 6.2: Hook interception system
- Add HookType (PRE_TOOL_USE, POST_TOOL_USE, TOOL_ERROR, TOOL_SKIP)
- Add HookManager with singleton for hook registration
- Add HookExecutor for pre/post/error hook execution
Phase 6.3: Streaming execution
- Add StreamingToolExecutor with batch execution support
Phase 6.4: New builtin tools
- Add file_tools: GlobTool, GrepTool, ReadFileTool, WriteFileTool
- Add system_tools: BashTool, PowerShellTool
- Add dev_tools: LSPTools, GitTool
- Add collaboration_tools: TeamAgentTool, TaskBroadcastTool
Tests: 29 passed
2026-04-04 22:47:48 +08:00
|
|
|
search_knowledge,
|
|
|
|
|
get_knowledge_graph_context,
|
|
|
|
|
build_knowledge_graph,
|
|
|
|
|
hybrid_search,
|
|
|
|
|
web_search,
|
2026-03-21 10:13:29 +08:00
|
|
|
)
|
|
|
|
|
from app.agents.tools.task import get_tasks, create_task, update_task_status
|
|
|
|
|
from app.agents.tools.forum import get_forum_posts, create_forum_post, scan_forum_for_instructions
|
2026-03-29 20:31:13 +08:00
|
|
|
from app.agents.tools.schedule import (
|
|
|
|
|
get_schedule_day,
|
|
|
|
|
create_todo,
|
|
|
|
|
create_schedule_task,
|
|
|
|
|
create_reminder,
|
|
|
|
|
create_goal,
|
|
|
|
|
)
|
|
|
|
|
from app.agents.tools.time_reasoning import resolve_time_expression
|
2026-03-21 10:13:29 +08:00
|
|
|
|
feat(agents): Phase 6 tool system refactoring
Phase 6.1: ToolRegistry infrastructure
- Add ToolManifest with ToolCategory, PermissionClass, SideEffectScope
- Add ToolRegistry singleton with register/get/unregister/list/search
- Add BaseTool abstract class with ReadTool/WriteTool/DBWriteTool/ExternalTool/NetworkTool subclasses
- Add migration layer for backward compatibility
Phase 6.2: Hook interception system
- Add HookType (PRE_TOOL_USE, POST_TOOL_USE, TOOL_ERROR, TOOL_SKIP)
- Add HookManager with singleton for hook registration
- Add HookExecutor for pre/post/error hook execution
Phase 6.3: Streaming execution
- Add StreamingToolExecutor with batch execution support
Phase 6.4: New builtin tools
- Add file_tools: GlobTool, GrepTool, ReadFileTool, WriteFileTool
- Add system_tools: BashTool, PowerShellTool
- Add dev_tools: LSPTools, GitTool
- Add collaboration_tools: TeamAgentTool, TaskBroadcastTool
Tests: 29 passed
2026-04-04 22:47:48 +08:00
|
|
|
# Phase 6.1: Tool Registry exports
|
|
|
|
|
from app.agents.tools.registry import (
|
|
|
|
|
ToolRegistry,
|
|
|
|
|
get_tool_registry,
|
|
|
|
|
reset_tool_registry,
|
|
|
|
|
)
|
|
|
|
|
from app.agents.tools.manifest import (
|
|
|
|
|
HookConfig,
|
|
|
|
|
PermissionClass,
|
|
|
|
|
SideEffectScope,
|
|
|
|
|
ToolCategory,
|
|
|
|
|
ToolManifest,
|
|
|
|
|
)
|
|
|
|
|
from app.agents.tools.migration import (
|
|
|
|
|
migrate_tool,
|
|
|
|
|
migrate_all_tools,
|
|
|
|
|
get_tool_executor,
|
|
|
|
|
BackwardCompatTool,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Phase 6.2: Hook System exports
|
|
|
|
|
from app.agents.tools.hooks import (
|
|
|
|
|
HookManager,
|
|
|
|
|
HookExecutor,
|
|
|
|
|
HookType,
|
|
|
|
|
HookDefinition,
|
|
|
|
|
HookResult,
|
|
|
|
|
ExecutionContext,
|
|
|
|
|
get_hook_manager,
|
|
|
|
|
get_hook_executor,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Phase 6.3: Streaming Executor exports
|
|
|
|
|
from app.agents.tools.streaming import (
|
|
|
|
|
StreamingToolExecutor,
|
|
|
|
|
get_streaming_executor,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Phase 6.4: Builtin Tools exports
|
|
|
|
|
from app.agents.tools.builtins import (
|
|
|
|
|
GlobTool,
|
|
|
|
|
GrepTool,
|
|
|
|
|
ReadFileTool,
|
|
|
|
|
WriteFileTool,
|
|
|
|
|
BashTool,
|
|
|
|
|
PowerShellTool,
|
|
|
|
|
LSPTools,
|
|
|
|
|
GitTool,
|
|
|
|
|
TeamAgentTool,
|
|
|
|
|
TaskBroadcastTool,
|
|
|
|
|
)
|
|
|
|
|
|
2026-03-24 21:44:04 +08:00
|
|
|
TASK_TOOLS = [
|
2026-03-21 10:13:29 +08:00
|
|
|
get_tasks,
|
|
|
|
|
create_task,
|
|
|
|
|
update_task_status,
|
2026-03-24 21:44:04 +08:00
|
|
|
]
|
|
|
|
|
|
2026-03-29 20:31:13 +08:00
|
|
|
SCHEDULE_READ_TOOLS = [
|
|
|
|
|
get_schedule_day,
|
|
|
|
|
get_tasks,
|
|
|
|
|
resolve_time_expression,
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
SCHEDULE_WRITE_TOOLS = [
|
|
|
|
|
create_todo,
|
|
|
|
|
create_schedule_task,
|
|
|
|
|
create_reminder,
|
|
|
|
|
create_goal,
|
|
|
|
|
]
|
|
|
|
|
|
2026-03-24 21:44:04 +08:00
|
|
|
FORUM_TOOLS = [
|
2026-03-21 10:13:29 +08:00
|
|
|
get_forum_posts,
|
|
|
|
|
create_forum_post,
|
|
|
|
|
scan_forum_for_instructions,
|
|
|
|
|
]
|
2026-03-24 21:44:04 +08:00
|
|
|
|
|
|
|
|
KNOWLEDGE_RETRIEVAL_TOOLS = [
|
|
|
|
|
search_knowledge,
|
|
|
|
|
hybrid_search,
|
2026-03-29 20:31:13 +08:00
|
|
|
web_search,
|
2026-03-24 21:44:04 +08:00
|
|
|
get_knowledge_graph_context,
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
KNOWLEDGE_GRAPH_TOOLS = [
|
|
|
|
|
get_knowledge_graph_context,
|
|
|
|
|
build_knowledge_graph,
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
ANALYST_PROGRESS_TOOLS = [
|
|
|
|
|
get_tasks,
|
|
|
|
|
get_forum_posts,
|
|
|
|
|
scan_forum_for_instructions,
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
ANALYST_INSIGHT_TOOLS = [
|
|
|
|
|
get_tasks,
|
|
|
|
|
get_forum_posts,
|
|
|
|
|
search_knowledge,
|
|
|
|
|
hybrid_search,
|
2026-03-29 20:31:13 +08:00
|
|
|
web_search,
|
2026-03-24 21:44:04 +08:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
ALL_TOOLS = [
|
|
|
|
|
*KNOWLEDGE_RETRIEVAL_TOOLS,
|
|
|
|
|
build_knowledge_graph,
|
|
|
|
|
*TASK_TOOLS,
|
2026-03-29 20:31:13 +08:00
|
|
|
*SCHEDULE_READ_TOOLS,
|
|
|
|
|
*SCHEDULE_WRITE_TOOLS,
|
2026-03-24 21:44:04 +08:00
|
|
|
*FORUM_TOOLS,
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
SUB_COMMANDER_TOOLSETS = {
|
2026-03-29 20:31:13 +08:00
|
|
|
"schedule_analysis": SCHEDULE_READ_TOOLS,
|
|
|
|
|
"schedule_planning": [*SCHEDULE_READ_TOOLS, *SCHEDULE_WRITE_TOOLS],
|
|
|
|
|
"executor_tasks": [*TASK_TOOLS, resolve_time_expression, *SCHEDULE_WRITE_TOOLS],
|
2026-03-24 21:44:04 +08:00
|
|
|
"executor_forum": FORUM_TOOLS,
|
|
|
|
|
"librarian_retrieval": KNOWLEDGE_RETRIEVAL_TOOLS,
|
|
|
|
|
"librarian_graph": KNOWLEDGE_GRAPH_TOOLS,
|
|
|
|
|
"analyst_progress": ANALYST_PROGRESS_TOOLS,
|
|
|
|
|
"analyst_insights": ANALYST_INSIGHT_TOOLS,
|
|
|
|
|
}
|
2026-04-05 14:56:45 +08:00
|
|
|
|
|
|
|
|
# Code Commander toolset (tools implemented in later phases)
|
|
|
|
|
CODE_COMMANDER_TOOLSET_NAMES = [
|
|
|
|
|
"execute_code_task",
|
|
|
|
|
"get_execution_status",
|
|
|
|
|
"send_interactive_input",
|
|
|
|
|
"download_workspace",
|
|
|
|
|
"cleanup_workspace",
|
|
|
|
|
]
|