Skip to content

Trace 页整体重构:台账形态 + 会话列表统一 #82

Closed

Description

@bubbleptr

背景

思维链形态探索(决策记录: .scratch/cot-variants/PRD.md)中,Ledger 变体(等宽字体、kind/name/subject/duration 对齐网格、轮次分隔、行内展开 payload、✓/✕/● 状态字形)被验证为高密度扫读 trace 的最佳形态——12.4s 的失败 Bash 一眼跳出。它不适合聊天流,但正好命中 Trace 页"做得不好看、信息密度低"的痛点。

2026-08-09 Grill 后范围扩大:不止事件明细,整个 Trace 页重构——左侧会话列表也用同一套等宽/台账密度语言重排,整页视觉统一。

关键事实(决定切法的根据)

  • JSONL 源数据齐全:toolResult 事件带 isError(718/718 条),toolCall 与 toolResult 各有独立 timestamp,工具执行时长可精确相减(实测样本 71ms)。
  • 缺口在解析器:packages/backend/src/workspace/sessions.ts 的 tryMergeToolResult 丢弃了 isError、toolResult 自己的 timestamp,并把 payload 硬编码为 null——台账的 ✓/✕ 状态列与时长列没有数据可用,先修解析器。
  • live trace(SDK driver 事件流)与历史 JSONL 底层字段本质相同(toolCallId/toolName/payload/isError,时长均为时间戳相减)。pi-trace-ledger 的 props 按共通抽象(status / name / target / duration / payload)设计,为将来合流留门,但本切片不接 live。

三个 PR,顺序执行

  • PR 1 — 解析器切片(TDD,真实 JSONL 做 fixture):停止丢弃 isError 与 toolResult timestamp,推导 per-tool duration,修 payload: null;相应扩展 packages/core/src/session.ts 的 SessionTurn/SessionContentPart 类型。
  • PR 2 — 台账组件切片:pi-trace-ledger 落 shared/ui/(动手前先 bunx astryx build 探现成积木),同 PR 注册 /design 页全状态;session-detail 事件列表替换为台账;用真实长 session(几十轮、含图片与长 tool output)截图验收。网格列:状态字形 / kind / 名称 / 对象(target 截断) / 右对齐 tabular-nums 时长;轮次分隔线;行内展开 args/output。
  • PR 3 — 列表与整页布局切片:会话列表(pages/session-list.tsx)台账化重排(项目分组、标题 chip、成本/token 右对齐 tabular-nums),整页视觉统一;同 PR 更新 docs/self-built-ui.md roster 措辞。

明确不做

原型参考实现见决策记录的"关键实现记号"(原型代码已拆除)。

Activity

  1. added
    needs-triage
    ready-for-agent
    and removed
    needs-triage
    on Aug 9, 2026
  2. changed the title [-]Trace 页重构:采用台账(Ledger)形态[/-] [+]Trace 页整体重构:台账形态 + 会话列表统一[/+] on Aug 9, 2026
  3. bubbleptr commented on Aug 9, 2026

    @bubbleptr
    OwnerAuthor

    三个切片全部合并:PR 1 #92(解析器)、PR 2 #93(pi-trace-ledger 台账)、PR 3 #94(整页布局)。#94 还包含 review 中追加的雕刻:单滚动上下文、分组层级、筛选器多选 Tokenizer(彩色身份 token)、去除死返回链接。roster 已同步。

  4. added a commit that references this issue on Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions