新增了插件相关的完整领域模型、应用服务、基础设施实现,包括: 1. 插件状态、注册模式、来源等基础枚举和数据结构 2. 插件清单解析、发现、加载工具类 3. 插件注册表领域服务和内存存储实现 4. 插件相关的命令、查询、事件定义 5. 插件REST API接口和DTO映射 6. 集成了原有通道适配器到插件系统 7. 新增内置插件注册和自动发现能力
29 lines
902 B
Python
29 lines
902 B
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
|
|
from yuxi.channel.channels.hooks.outbound import HOOKS_CAPABILITIES
|
|
from yuxi.channel.domain.model.shared.channel_capabilities import ChannelCapabilities
|
|
|
|
|
|
@dataclass
|
|
class HookMapping:
|
|
match_path: str
|
|
match_source: str = "*"
|
|
default_agent_id: int = 1
|
|
allowed_agent_ids: list[int] = field(default_factory=list)
|
|
default_session_key: str = "main"
|
|
allow_request_session_key: bool = False
|
|
allowed_session_key_prefixes: list[str] = field(default_factory=list)
|
|
session_key_strategy: str = "main"
|
|
channel: str = "last"
|
|
deliver: bool = True
|
|
max_body_bytes: int = 256 * 1024
|
|
secret: str | None = None
|
|
|
|
|
|
@dataclass
|
|
class HooksConfig:
|
|
mappings: list[HookMapping] = field(default_factory=list)
|
|
capabilities: ChannelCapabilities = field(default_factory=lambda: HOOKS_CAPABILITIES)
|