重构+修复: ARC-06 composables/ai 循环依赖破环 + B-34 多选审批 select_type 回归
- ARC-06: 提 aiShared.ts 下沉 nextMsgId+_msgCounter(叶子模块),useAiEvents/useAiStream/useAiSend/useAiWindow import 源改 aiShared,useAiStream 不再 import useAiEvents 环消除。watchdog 三函数留 useAiStream(持计时器状态非纯函数)。行为零变化。 - B-34(另一会话走查发现 P0): stores/project.ts:273 selectType→select_type(Tauri 2 IPC 不转 camelCase),对齐后端 workflow.rs:211。F-260615-01 多选审批回归修复——前端传 selectType 后端收 None 归一化 Single 致多选被拒。删错误注释。 批1 wwllb4ith(ARC-06)+主代理(B-34),vue-tsc 0 err
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
//! AI composables 共享层 — 多 composable 共用的模块级状态与纯函数
|
||||
//!
|
||||
//! 存在意义:打破 useAiEvents ↔ useAiStream 之间的循环依赖。
|
||||
//! - useAiStream.onStreamTimeout 调用 nextMsgId
|
||||
//! - useAiEvents.handleEvent 调用 useAiStream 的 resetStreamWatchdog/clearStreamWatchdog
|
||||
//! 把两者互相依赖的 nextMsgId(全局消息 id 自增计数器,无其他依赖的纯函数 + 模块级状态)
|
||||
//! 下沉到本模块,使 useAiStream 改为依赖 aiShared 而非 useAiEvents,环即消除。
|
||||
//!
|
||||
//! 下沉范围(严格限定为「无依赖、被多个 composable 共用」的成员):
|
||||
//! - nextMsgId / _msgCounter:events/stream/send/window 四个 composable 共用同一计数器
|
||||
|
||||
/** 客户端消息自增 id(全局唯一,多个 composable 共用 nextMsgId) */
|
||||
let _msgCounter = 0
|
||||
|
||||
/** 全局消息 id 自增(供 events/stream/send/window 各 composable 共享同一计数器) */
|
||||
export function nextMsgId(): number {
|
||||
return ++_msgCounter
|
||||
}
|
||||
Reference in New Issue
Block a user