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

30 lines
796 B
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.

"""流式事件 DTO。
定义 ``AgentRunPort.streamAgentRun`` 返回的流式事件类型,替代原
``AsyncIterator[Any]`` 的弱类型签名CON-019
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any
@dataclass(frozen=True)
class StreamEvent:
"""Agent 运行流式事件。
封装从 Redis Stream 读取的事件,供下游 SSE 渲染或事件重放使用。
属性:
event_type: 事件类型(如 ``messages`` / ``tool_call``)。
payload: 事件负载字典,结构由事件类型决定。
seq: Redis Stream 消息 ID用于分页与去重。
关联约束CON-019端口返回类型不得使用 ``Any``)。
"""
event_type: str
payload: dict[str, Any]
seq: str