ForcePilot/backend/package/yuxi/channel/domain/__init__.py
Kris 39b7df2ce0 refactor(channel-domain): 重构端口定义与导入结构
1. 新增多个领域端口协议类,包括签名验证、路由贡献、关键词匹配等完整的端口定义
2. 重构ChannelRouteContributor重命名为ChannelRouteContributorPort并统一导入路径
3. 调整端口目录结构,拆分external和internal子目录并分别导出
4. 更新所有引用了旧端口定义的业务代码和测试用例
2026-05-31 17:38:33 +08:00

69 lines
3.2 KiB
Python

_LAZY_IMPORTS = {
"AgentError": "yuxi.channel.domain.event",
"MessageBlocked": "yuxi.channel.domain.event",
"MessageReceived": "yuxi.channel.domain.event",
"MessageReplied": "yuxi.channel.domain.event",
"ABORT_CODE_TO_HTTP": "yuxi.channel.domain.exception",
"AgentCrashError": "yuxi.channel.domain.exception",
"ChannelError": "yuxi.channel.domain.exception",
"RecoverableError": "yuxi.channel.domain.exception",
"UnrecoverableError": "yuxi.channel.domain.exception",
"CallNext": "yuxi.channel.domain.middleware",
"Configurable": "yuxi.channel.domain.middleware",
"Middleware": "yuxi.channel.domain.middleware",
"Attachment": "yuxi.channel.domain.model",
"ChannelBinding": "yuxi.channel.domain.model",
"ChannelCapabilities": "yuxi.channel.domain.model",
"ChannelSession": "yuxi.channel.domain.model",
"ChannelType": "yuxi.channel.domain.model",
"DispatchResult": "yuxi.channel.domain.model",
"MessagePriority": "yuxi.channel.domain.model",
"MessageType": "yuxi.channel.domain.model",
"OutboxEntry": "yuxi.channel.domain.model",
"Peer": "yuxi.channel.domain.model",
"SendResult": "yuxi.channel.domain.model",
"StreamChatRequest": "yuxi.channel.domain.model",
"UnifiedMessage": "yuxi.channel.domain.model",
"AgentPort": "yuxi.channel.domain.port",
"BotLoopGuardPort": "yuxi.channel.domain.port",
"KeywordMatcherPort": "yuxi.channel.domain.port",
"CachePort": "yuxi.channel.domain.port",
"ChannelAdapterPort": "yuxi.channel.domain.port",
"ChannelRouteContributorPort": "yuxi.channel.domain.port",
"CircuitBreakerPort": "yuxi.channel.domain.port",
"ConfigReloadPort": "yuxi.channel.domain.port",
"ContentFilterPort": "yuxi.channel.domain.port",
"DomainEvent": "yuxi.channel.domain.port",
"EventPublisherPort": "yuxi.channel.domain.port",
"FilterResult": "yuxi.channel.domain.port",
"MetricsPort": "yuxi.channel.domain.port",
"QueuePort": "yuxi.channel.domain.port",
"RateLimitPort": "yuxi.channel.domain.port",
"SignatureVerifyPort": "yuxi.channel.domain.port",
"SsePushPort": "yuxi.channel.domain.port",
"WsConnectionPort": "yuxi.channel.domain.port",
"BindingRepositoryPort": "yuxi.channel.domain.repository",
"ChannelMessageData": "yuxi.channel.domain.repository",
"MessageLogData": "yuxi.channel.domain.repository",
"MessageLogQuery": "yuxi.channel.domain.repository",
"MessageLogRepositoryPort": "yuxi.channel.domain.repository",
"MessageRepositoryPort": "yuxi.channel.domain.repository",
"OutboxRepositoryPort": "yuxi.channel.domain.repository",
"SessionRepositoryPort": "yuxi.channel.domain.repository",
"MessageContext": "yuxi.channel.domain.service",
"Span": "yuxi.channel.domain.service",
"Pipeline": "yuxi.channel.domain.service",
"PipelineBuilder": "yuxi.channel.domain.service",
}
def __getattr__(name: str):
if name in _LAZY_IMPORTS:
module = __import__(_LAZY_IMPORTS[name], fromlist=[name])
return getattr(module, name)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
def __dir__():
return sorted(set(globals()) | set(_LAZY_IMPORTS.keys()))