feat(web): 前端 P0 收尾(多路忙态收口 / 握手 history 落 store / 清理幽灵键)
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

This commit is contained in:
AskaEth committed 2026-10-05 11:29:17 +08:00
1 parent e852e60af9
commit 012e9f3ad4
10 files changed
+365 -31

No files matched your search

+14
View File
@@ -229,6 +229,20 @@ export function parsePersistedMessage(v: unknown): ChatMessage | null {
};
}
/** 解析握手 `history` 回放帧的 `data.messages` 数组(契约 §3.2):服务端在 owner/admin
* 连接注册后**定向**发一帧,内含主会话(`web`)最近 50 条(`wsReplayLimit`)。每条就是
* 同一个 `historyMessage` DTO(§4.4),因此复用 `parsePersistedMessage` 收窄;坏行走
* `null` 被丢弃,绝不把一条畸形行塞进列表。 */
export function parseHistoryMessages(v: unknown): ChatMessage[] {
if (!Array.isArray(v)) return [];
const out: ChatMessage[] = [];
for (const item of v) {
const msg = parsePersistedMessage(item);
if (msg) out.push(msg);
}
return out;
}
/** Build an AdminChannelMessage from a `channel_persisted` payload (design/16
* §4.6 §4): the backend broadcast a fully-persisted isolated (group/stranger)
* channel message carrying the backend id + adapter id, for the IM adapter log