Desktop 把 ZCode task 的未读数显示到应用 Dock / launcher badge,口径以 task meta 的 unreadAt 为准,也就是“后台完成后还没点开看的 task 数”。
unreadAt。V4 sessions-index 不携带这个组织态字段,列表通过
taskListMembershipSets 平行读取后 join 到 session summary。countAllUnreadTasks 从各 workspace 可见 task meta 统计未读,并用
workspaceIdentity?.trim() || workspacePath + taskId 去重;只有列表尚未加载时才兼容旧临时 map。useRootPlatformEffects 调用 IPlatformService.syncWindowUnreadCount(count),只同步当前窗口总数,
不让 UI 直接感知 Electron。PlatformChannels.SyncWindowUnreadCount 发给 main。windowId -> unreadCount map,窗口更新或关闭时重算应用总数,再调用
app.setBadgeCount(totalUnread);Windows 当前由平台实现决定是否展示,不在 UI 分支写特例。traceId 匹配的 succeeded、failed 或 stopped
终态后,host 必须通过 setTaskUnread(..., true) 持久化关联 task 的 unreadAt。该规则不使用
renderer 的 active session 推断“正在阅读”;用户显式点击 task 后由
useWorkspaceTaskNavigation 清除持久状态,并同步 task query cache 的乐观值。IPlatformService 接口。packages/ui/src/lib/unreadTaskCount.tspackages/ui/src/lib/taskListMembershipSets.tspackages/ui/src/root/useRootPlatformEffects.tspackages/desktop/src/main/desktopMainIpcPlatform.tspackages/desktop/src/main/desktopWindowLifecycle.tspackages/desktop/src/main/unreadBadge.ts