sequenceDiagram participant Client as 客户端/CLI participant GW as Gateway Server participant Auth as 认证中间件 participant Proto as 协议处理器 participant CM as Channel Manager participant RT as Route Resolver Client->>GW: WebSocket 连接 (ws://localhost:18789) GW->>Auth: 设备认证 (Ed25519 签名) Auth-->>GW: 认证通过 + 设备 Token GW->>Proto: Hello 握手 (PROTOCOL_VERSION) Proto-->>Client: HelloOk (capabilities, scopes) Note over Client,RT: 消息流 Client->>GW: RequestFrame: chat.send GW->>Proto: AJV Schema 校验 Proto->>RT: 路由解析 (channel + peer → agent) RT-->>GW: sessionKey + agentId GW->>CM: 分发到对应通道