feat: 集成新版本插件运行时,支持事件桥接与命令处理
This commit is contained in:
@@ -6,7 +6,7 @@ Host 端实现的能力服务,处理来自插件的 cap.* 请求。
|
||||
|
||||
from typing import Any, Callable, Awaitable
|
||||
|
||||
import logging
|
||||
from src.common.logger import get_logger
|
||||
|
||||
from src.plugin_runtime.protocol.envelope import (
|
||||
CapabilityRequestPayload,
|
||||
@@ -16,7 +16,7 @@ from src.plugin_runtime.protocol.envelope import (
|
||||
from src.plugin_runtime.protocol.errors import ErrorCode, RPCError
|
||||
from src.plugin_runtime.host.policy_engine import PolicyEngine
|
||||
|
||||
logger = logging.getLogger("plugin_runtime.host.capability_service")
|
||||
logger = get_logger("plugin_runtime.host.capability_service")
|
||||
|
||||
# 能力实现函数类型: (plugin_id, capability, args) -> result
|
||||
CapabilityImpl = Callable[[str, str, dict[str, Any]], Awaitable[Any]]
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
from typing import Any
|
||||
|
||||
import logging
|
||||
from src.common.logger import get_logger
|
||||
import re
|
||||
|
||||
logger = logging.getLogger("plugin_runtime.host.component_registry")
|
||||
logger = get_logger("plugin_runtime.host.component_registry")
|
||||
|
||||
|
||||
class RegisteredComponent:
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
from typing import Any, Awaitable, Callable
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from src.common.logger import get_logger
|
||||
from src.plugin_runtime.host.component_registry import ComponentRegistry, RegisteredComponent
|
||||
|
||||
logger = logging.getLogger("plugin_runtime.host.event_dispatcher")
|
||||
logger = get_logger("plugin_runtime.host.event_dispatcher")
|
||||
|
||||
# invoke_fn 类型: async (plugin_id, component_name, args) -> response_payload dict
|
||||
InvokeFn = Callable[[str, str, dict[str, Any]], Awaitable[dict[str, Any]]]
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
from typing import Any, Callable, Awaitable
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import secrets
|
||||
|
||||
from src.common.logger import get_logger
|
||||
from src.plugin_runtime.protocol.codec import Codec, MsgPackCodec
|
||||
from src.plugin_runtime.protocol.envelope import (
|
||||
PROTOCOL_VERSION,
|
||||
@@ -27,7 +27,7 @@ from src.plugin_runtime.protocol.envelope import (
|
||||
from src.plugin_runtime.protocol.errors import ErrorCode, RPCError
|
||||
from src.plugin_runtime.transport.base import Connection, TransportServer
|
||||
|
||||
logger = logging.getLogger("plugin_runtime.host.rpc_server")
|
||||
logger = get_logger("plugin_runtime.host.rpc_server")
|
||||
|
||||
# RPC 方法处理器类型
|
||||
MethodHandler = Callable[[Envelope], Awaitable[Envelope]]
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
from typing import Any
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
from src.common.logger import get_logger
|
||||
from src.plugin_runtime.host.capability_service import CapabilityService
|
||||
from src.plugin_runtime.host.component_registry import ComponentRegistry
|
||||
from src.plugin_runtime.host.event_dispatcher import EventDispatcher
|
||||
@@ -29,7 +29,7 @@ from src.plugin_runtime.protocol.envelope import (
|
||||
from src.plugin_runtime.protocol.errors import ErrorCode, RPCError
|
||||
from src.plugin_runtime.transport.factory import create_transport_server
|
||||
|
||||
logger = logging.getLogger("plugin_runtime.host.supervisor")
|
||||
logger = get_logger("plugin_runtime.host.supervisor")
|
||||
|
||||
|
||||
class PluginSupervisor:
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
from typing import Any, Awaitable, Callable
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import time
|
||||
import uuid
|
||||
|
||||
from src.common.logger import get_logger
|
||||
from src.plugin_runtime.host.component_registry import ComponentRegistry, RegisteredComponent
|
||||
|
||||
logger = logging.getLogger("plugin_runtime.host.workflow_executor")
|
||||
logger = get_logger("plugin_runtime.host.workflow_executor")
|
||||
|
||||
# 阶段顺序
|
||||
STAGE_SEQUENCE: list[str] = [
|
||||
|
||||
Reference in New Issue
Block a user