Skip to content

feat(desktop): rebuild session trace as PiTraceLedger - #93

Merged
bubbleptr merged 1 commit into
mainfrom
feat/trace-ledger-component-82
Aug 9, 2026
Merged

bubbleptr merged 1 commit into
mainfrom
feat/trace-ledger-component-82

Conversation

@bubbleptr

Copy link
Copy Markdown
Owner

#82 的第二个切片(台账组件切片,TDD 先行)。

改动

  • 新组件 shared/ui/pi-trace-ledger:等宽五列网格(状态字形 ✓/✕/● / kind / 名称 / target 截断 / 右对齐 tabular-nums 时长),轮次分组分隔头(label + 时间 + 成本·token 元信息),行内展开 payload。纯展示型;entry 字段(status/name/target/duration/payload)即历史与 live 两条链路共通的抽象,将来 live trace 可直接换用,本切片不接。
  • 性能语义保持:detail 未展开不挂载(session 里有 MB 级工具输出),页面按轮次分组虚拟化(复用 TanStack Virtual)。
  • session-detail 重写映射:toolCall/toolResult 按 toolCallId 配对(顺序兜底)合成单行,消费 feat(backend): surface toolResult isError, duration, and raw payload #92 打通的 isError/durationMs;annotation 轮次渲染为 config 行(值进名称列,避免和组头重复)。target 提取与时长格式化复用 chat-tool.tsx 的 toolTargetFromArgs/formatToolDuration(原型记号要求)。
  • /design 注册:PiTraceLedger 全状态(ok/error/running/info + 展开 + 空态),同 PR 落测试。

验证

  • TDD:组件 7 用例、页面 6 用例、design 注册用例均先红后绿;全量 bun run test 64 文件 526 用例全绿;typecheck 干净。
  • 真实数据截图(electron-vite dev + CDP):174 事件的 Pig session、8MB 的 voily session(首行渲染 146ms)、/design 注册页均正常。

后续:PR 3 会话列表台账化 + 整页布局统一 + roster 措辞更新。

Replace the card/badge timeline in session-detail with the ledger form
validated in the chain-of-thought prototype round: a monospace grid
(status glyph / kind / name / target / right-aligned tabular-nums
duration) grouped by turn, with inline payload expansion.

- New shared/ui component pi-trace-ledger, purely presentational; entry
  fields (status/name/target/duration/payload) are the abstraction the
  historical parser and the live runtime pipeline share, so the live
  trace can adopt it later without reshaping.
- Detail stays unmounted until a row expands — sessions carry
  megabyte-scale tool outputs and the page virtualizes by turn group.
- session-detail pairs toolCall/toolResult parts into single rows via
  toolCallId (order fallback), surfacing the isError/durationMs fields
  PR #92 unlocked; annotation turns render as config rows.
- Registered on /design with all row states plus the empty variant.

Second slice of #82; verified against real sessions (174-event and
8MB JSONL — first ledger row in 146ms) over CDP.
@bubbleptr
bubbleptr merged commit 1c9baca into main Aug 9, 2026
@bubbleptr
bubbleptr deleted the feat/trace-ledger-component-82 branch August 9, 2026 10:58
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