Skip to content

【已审核】feat(tabs): Tab 预览展示完整迷你会话流 - #1428

Open
climashscape wants to merge 1 commit into
proma-ai:mainfrom
climashscape:feature/tab-preview-stream-run
Open

【已审核】feat(tabs): Tab 预览展示完整迷你会话流#1428
climashscape wants to merge 1 commit into
proma-ai:mainfrom
climashscape:feature/tab-preview-stream-run

Conversation

@climashscape

Copy link
Copy Markdown
Contributor

概述

Tab hover 预览面板新增会话流实时运行展示:当会话正在流式运行时,悬停 Tab 弹出的小窗展示完整迷你会话流——thinking、工具调用、文本输出按时间顺序滚动,顶部带运行指示条(耗时 + 模型名),并自动滚动贴底(用户上滚时暂停跟随)。运行中预览窗只保留流式区域一段(不再同时显示历史消息摘要),会话结束后恢复原有消息摘要预览,行为与改动前一致。

改动

  • apps/electron/src/renderer/atoms/agent-atoms.ts:新增 agentSessionLiveMessagesAtomFamily(按 sessionId 切片订阅实时 SDK 消息,避免整树重渲染)
  • apps/electron/src/renderer/atoms/chat-atoms.ts:新增 conversationStreamingStateAtomFamily(Chat 流式状态切片订阅)
  • apps/electron/src/renderer/atoms/tab-atoms.ts:新增 TabStreamRunData / TabStreamActivity 类型(含 liveMessages / reasoning 字段)
  • apps/electron/src/renderer/components/tabs/TabBar.tsx:向 TabBarItem 传入 sessionId
  • apps/electron/src/renderer/components/tabs/TabBarItem.tsx:订阅 agent/chat 流式状态,组装 streamRun 数据(Chat 工具事件 start/result 合并)
  • apps/electron/src/renderer/components/tabs/TabPreviewPanel.tsx:新增 StreamRunSection + 迷你会话流渲染器(buildAgentFlowEntries / buildChatFlowEntries / FlowEntry);工具完成/出错态由 streamState 回填;实时文本用固定 id 追加不覆盖已完成块;Preview memo 化、计时器 250ms 节流
  • apps/electron/src/renderer/components/app-shell/LeftSidebar.tsx:删除会话/对话时清理 streaming / liveMessages atomFamily 缓存

测试

bun run typecheck 通过。已通过 BDD 自审查(独立子会话审查两轮,修复工具完成态回填、实时文本合并误判、自动滚动劫持等 4 个问题)。dev 模式实测:Agent 会话运行时 hover Tab,可看到 thinking / 工具活动(进行中旋转 → 完成绿勾 → 出错红叉)/ 文本输出按序实时滚动,仅显示单段;会话结束后恢复原消息摘要预览。

紧急度

常规

备注

无关联 upstream issue。

@climashscape
climashscape marked this pull request as ready for review August 4, 2026 19:17
@climashscape climashscape changed the title 【等待审核】feat(tabs): Tab 预览展示完整迷你会话流 【已审核】feat(tabs): Tab 预览展示完整迷你会话流 Aug 4, 2026
While a session is streaming, hovering its Tab shows a full live mini
session flow: thinking, tool calls and text output rendered in time
order with auto-scroll, plus a run indicator (elapsed time + model).
The preview collapses to a single stream section while running and
falls back to the message minimap when idle.

- chat-atoms: conversationStreamingStateAtomFamily (sliced subscription)
- agent-atoms: agentSessionLiveMessagesAtomFamily + cleanup on delete
- tab-atoms: TabStreamRunData / TabStreamActivity types
- TabBar/TabBarItem: pass sessionId, subscribe to streaming states and
  assemble streamRun data
- TabPreviewPanel: StreamRunSection + mini session flow renderer
  (buildAgentFlowEntries / buildChatFlowEntries), tool done/error
  backfill, fixed-id live text tail, bottom-aware auto-scroll
- LeftSidebar: clear streaming/liveMessages family caches on delete
@climashscape
climashscape force-pushed the feature/tab-preview-stream-run branch from 5b761fb to 815c860 Compare August 6, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant