feat: Introduce unified tooling system for plugins and MCP

- Added a new `tooling` module to define a unified model for tool declarations, invocations, and execution results, facilitating compatibility between plugins, legacy actions, and MCP tools.
- Implemented `ToolProvider` interface for various tool providers including built-in tools, MCP tools, and plugin runtime tools.
- Enhanced `MCPManager` and `MCPConnection` to support unified tool invocation and execution results.
- Updated `ComponentRegistry` and related classes to accommodate the new tool specifications and descriptions.
- Refactored existing components to utilize the new tooling system, ensuring backward compatibility with legacy actions.
- Improved error handling and logging for tool invocations across different providers.
This commit is contained in:
DrSmoothl
2026-03-30 23:11:56 +08:00
parent 898b693fe0
commit dc2bf02a42
35 changed files with 1663 additions and 6756 deletions

View File

@@ -29,6 +29,19 @@ class _RuntimeComponentManagerProtocol(Protocol):
def _build_api_unavailable_error(self, entry: "APIEntry") -> str: ...
def _collect_api_reference_matches(
self,
caller_plugin_id: str,
normalized_api_name: str,
normalized_version: str,
) -> tuple[List[tuple["PluginSupervisor", "APIEntry"]], List[tuple["PluginSupervisor", "APIEntry"]], bool]: ...
def _collect_api_toggle_reference_matches(
self,
normalized_name: str,
normalized_version: str,
) -> List[tuple["PluginSupervisor", "APIEntry"]]: ...
def _get_supervisor_for_plugin(self, plugin_id: str) -> Optional["PluginSupervisor"]: ...
def _resolve_api_target(
@@ -136,7 +149,10 @@ class RuntimeComponentCapabilityMixin:
str: 统一转为大写后的组件类型名。
"""
return str(component_type or "").strip().upper()
normalized_component_type = str(component_type or "").strip().upper()
if normalized_component_type == "ACTION":
return "TOOL"
return normalized_component_type
@classmethod
def _is_api_component_type(cls, component_type: str) -> bool: