ForcePilot/backend/package/yuxi/gateway/protocol/__init__.py
Kris fee71576a2 feat(gateway): add core gateway protocol implementation
新建了完整的网关协议模块,包含版本协商、基础类型定义、信道请求模型、错误码规范、通信帧结构以及握手流程,实现了完整的客户端-服务端通信协议基础框架
2026-05-12 00:54:15 +08:00

38 lines
1.1 KiB
Python

from __future__ import annotations
from typing import Annotated
from pydantic import Field
from yuxi.gateway.protocol.channels import ChannelLogoutRequest, ChannelStartRequest, ChannelStatusRequest
from yuxi.gateway.protocol.errors import ErrorCode, ErrorDetail
from yuxi.gateway.protocol.frames import EventFrame, RequestFrame, ResponseFrame
from yuxi.gateway.protocol.handshake import ConnectParams, HelloFeatures, HelloOk, handle_handshake
from yuxi.gateway.protocol.primitives import NonEmptyString, PositiveInt
from yuxi.gateway.protocol.version import PROTOCOL_VERSION, negotiate_version
GatewayFrame = Annotated[
RequestFrame | ResponseFrame | EventFrame,
Field(discriminator="type"),
]
__all__ = [
"RequestFrame",
"ResponseFrame",
"EventFrame",
"GatewayFrame",
"ErrorCode",
"ErrorDetail",
"PROTOCOL_VERSION",
"negotiate_version",
"ConnectParams",
"HelloFeatures",
"HelloOk",
"handle_handshake",
"NonEmptyString",
"PositiveInt",
"ChannelStatusRequest",
"ChannelStartRequest",
"ChannelLogoutRequest",
]