ForcePilot/backend/package/yuxi/channels/application/__init__.py
Kris b88c0ae29e feat(channels): 批量新增多渠道网关限界上下文基础代码与契约
新增完整的 channels 限界上下文模块,包含契约层、领域核心层、应用服务、管道编排、插件体系、基础设施组合根等全层级代码,新增飞书与微信 iLink 渠道插件基础结构,补充各类 DTO、端口协议与领域服务实现。
2026-07-02 03:22:12 +08:00

68 lines
2.8 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""应用服务层。
应用服务层是 ForcePilot v1.2 多渠道网关的编排层,负责:
- 用例编排:实现驱动端口用例,协调领域服务与管道执行;
- 管道装配:装配入站 / 出站 / 控制面管道的阶段序列;
- 事务边界:在管道或用例编排器中显式控制事务边界;
- 领域服务编排:调用 core 层领域服务完成业务流程,不在应用层重新实现业务规则。
应用层仅依赖契约层yuxi.channels.contract与领域核心层yuxi.channels.core
不得直接依赖 fastapi / sqlalchemy / redis / arq 等框架设施。
新增子包(从 framework/ 拆解迁移):
- ``extension/``扩展点注册中心StageSlot/EventSubscription/ConfigSource+ EventBus + 7 个内置事件订阅者。
- ``lifecycle/``插件生命周期编排状态机、加载器、依赖解析、能力校验、生命周期管理器、PluginHost 实现)。
- ``health/``:健康检查实现(聚合器、渠道探测、诊断导出)。
- ``config/``:配置热更新注册表。
- ``circuit_breaker/``:渠道级熔断器。
- ``outbox/``Outbox 后台任务(恢复扫描、重试 Worker、审计清理、配对过期
- ``executor/``:工具与消息操作执行器。
顶层导出:
- 5 个用例服务:``InboundMessageService`` / ``AdminMessageService`` /
``ChannelControlService`` / ``PluginLifecycleService`` / ``HealthCheckService``。
- 3 条管道:``InboundPipeline`` / ``OutboundPipeline`` / ``ControlPlanePipeline``。
- 3 个上下文:``InboundContext`` / ``OutboundContext`` / ``ControlPlaneContext``。
- 管道基础设施:``Pipeline`` / ``AppStage`` / ``FailureStrategy``。
"""
from __future__ import annotations
from yuxi.channels.application.context import (
ControlPlaneContext,
InboundContext,
OutboundContext,
)
from yuxi.channels.application.pipeline import AppStage, FailureStrategy, Pipeline
from yuxi.channels.application.pipeline.control_plane import ControlPlanePipeline
from yuxi.channels.application.pipeline.inbound import InboundPipeline
from yuxi.channels.application.pipeline.outbound import OutboundPipeline
from yuxi.channels.application.usecase import (
AdminMessageService,
ChannelControlService,
HealthCheckService,
InboundMessageService,
PluginLifecycleService,
)
__all__ = [
# 用例服务5 个)
"InboundMessageService",
"AdminMessageService",
"ChannelControlService",
"PluginLifecycleService",
"HealthCheckService",
# 管道3 条)
"InboundPipeline",
"OutboundPipeline",
"ControlPlanePipeline",
# 上下文3 个)
"InboundContext",
"OutboundContext",
"ControlPlaneContext",
# 管道基础设施
"Pipeline",
"AppStage",
"FailureStrategy",
]