refactor(frontend): 拆 types.ts(871) / ws.ts::dispatchFrame(266)(纯搬移 + barrel)
执行方案 DevDocs/audit/_plan.md 阶段 0 · G0-D: - lib/types.ts(871) → lib/types/ 11 个域文件 + 14 行 `export *` barrel(仿 lib/api.ts 先例) chat / ws / session / agent / flow / persona / api / admin(269) / adminWrite(176) / kook / notification - lib/ws.ts(494) → 203 行入口 + lib/ws/handlers/ 8 文件;dispatchFrame(266 行) 改为按组 分发链(7 个 handler 各持一组 case,命中 return true,未命中走原 default 兜底), 33 个 case 标签一一守恒 机械证明:type 导出集 86 个守恒(拆后并集 diff 为空);去掉空行与 import/export 语句后 **784=784 行、排序 diff 为空**;dispatchFrame 的 case 标签集 33=33 守恒;ws.ts 的 scheduleReconnect 至文件尾与 HEAD 字节级一致。 65 个 lib/types 消费方 + 3 个 lib/ws 消费方**零改动**通过 —— tsc 0 错误正是这一点的强判据。 验证:npx tsc --noEmit 0 错误;npm run build 成功;9 个前端逻辑测试全绿(含真实驱动 拆后 dispatchFrame 的 messageSync 54 checks 与 personaSession 23 checks); 最大文件 admin.ts 269 行、最大函数 openSocket 72 行(均达标)。
This commit is contained in:
1 parent
e9afca9b29
commit
6e0323b446
21 files changed
+1288
-1183
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import { useAppStore } from "../../../store/useAppStore";
|
||||
|
||||
/** dispatchFrame 处理的单个下行帧(信封形状,与 lib/ws.ts 导出的 dispatchFrame 签名一致)。 */
|
||||
export interface FrameEvent {
|
||||
type: string;
|
||||
sessionId?: string;
|
||||
data: unknown;
|
||||
}
|
||||
|
||||
/** toRecord(ev.data) 解析后的帧 payload(与 lib/wsParse.ts#toRecord 的返回形状一致)。 */
|
||||
export type FramePayload = Record<string, unknown> | null;
|
||||
|
||||
/** dispatchFrame 入口处取到的 store 快照类型,按参数传给各帧处理组。 */
|
||||
export type StoreState = ReturnType<typeof useAppStore.getState>;
|
||||
Reference in new issue
Block a user