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
47 lines
853 B
Python
47 lines
853 B
Python
"""Hook 系统 - Phase 6.2"""
|
|
|
|
from app.agents.tools.hooks.types import (
|
|
HookDefinition,
|
|
HookResult,
|
|
HookStage,
|
|
HookTrigger,
|
|
HookType,
|
|
ExecutionContext,
|
|
HookHandler,
|
|
PreToolHook,
|
|
PostToolHook,
|
|
ErrorToolHook,
|
|
SkipToolHook,
|
|
)
|
|
from app.agents.tools.hooks.manager import (
|
|
HookManager,
|
|
get_hook_manager,
|
|
reset_hook_manager,
|
|
)
|
|
from app.agents.tools.hooks.executor import (
|
|
HookExecutor,
|
|
get_hook_executor,
|
|
)
|
|
|
|
__all__ = [
|
|
# Types
|
|
"HookType",
|
|
"HookStage",
|
|
"HookTrigger",
|
|
"HookDefinition",
|
|
"HookResult",
|
|
"ExecutionContext",
|
|
"HookHandler",
|
|
"PreToolHook",
|
|
"PostToolHook",
|
|
"ErrorToolHook",
|
|
"SkipToolHook",
|
|
# Manager
|
|
"HookManager",
|
|
"get_hook_manager",
|
|
"reset_hook_manager",
|
|
# Executor
|
|
"HookExecutor",
|
|
"get_hook_executor",
|
|
]
|