Skip to content

增加 Pixelle CLI 任务完成后的总结与变更摘要卡片 #31

Description

@ztygod

背景

Agent 完成任务后,用户需要快速确认做了什么、改了哪些文件、调用了哪些工具、验证是否通过。这是决定是否继续追问、手动检查或 git commit 的关键。当前 CLI 已有 FileChangeCardRuntimeNote 和 trace note,但它们按事件顺序分散展示,缺少任务级最终摘要。

没有收尾摘要时,用户需要回看整段 timeline 才能理解结果,长任务尤其不方便。

目标

任务完成后展示一个清晰的 Run Summary:最终状态、修改文件列表、工具调用摘要、验证结果、trace/checkpoint 路径,以及必要的下一步提示。这个摘要应适合作为用户确认和 commit 前检查的入口。

当前问题

CLI state 分散保存 messages、tools、changeSets、verifications、traces;selectTimelineItems 只是按事件时间排序渲染,没有聚合视图。trace.persisted 默认 debug 才可见。验证结果只显示 passed/failed,文件变更和工具调用之间缺少最终归纳。

参考体验

参考现代 Agent CLI 的任务收尾体验:结束时有一个简短但完整的 summary block,清楚列出 changed files、commands run、checks passed/failed 和后续建议。

改动方向

新增 RunSummaryCard,在一次 agent run 完成后基于现有 CLI state 聚合摘要。先使用现有事件和状态,不要求 runtime 新增复杂协议;后续如果 runtime 增加 run stopped/task completed 事件,再进一步精确关联 runId。

可能涉及模块

  • src/cli/state/cli-state.ts
  • src/cli/state/timeline.ts
  • src/cli/components/timeline/TimelineItem.tsx
  • src/cli/components/timeline/FileChangeCard.tsx
  • src/cli/components/timeline/RuntimeNote.tsx
  • src/cli/runtime-events.ts
  • src/cli/types.ts

大致实现方案

  • 增加 RunSummaryStateRunSummaryCard
  • 从 tools、changeSets、verifications、traces 聚合摘要
  • 展示文件数量、失败工具、验证命令和结果
  • debug 模式下展示 trace/checkpoint 路径
  • 避免普通 ask 任务显示空洞 summary,只在有工具、验证、变更或错误时展示

任务清单

  • 定义 CLI 层 run summary 数据结构
  • 在 reducer 中根据 run 完成事件或 assistant done 聚合摘要
  • 新增 RunSummaryCard 展示变更、工具、验证和 trace
  • 对失败任务展示错误原因和已回滚/未回滚状态
  • 保持普通问答任务的 summary 简洁,不制造噪音
  • 确保 summary 在窄终端下可读

验收标准

  • edit 任务结束后能看到修改文件和验证结果
  • 工具失败时 summary 能突出失败工具和错误摘要
  • 无文件变更的 ask 任务不会显示空洞变更摘要
  • trace/checkpoint 信息在 debug 或明确位置可见
  • summary 适合作为用户 commit 前快速检查入口

建议标签

cli、ux、feature、developer-experience

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliCLI experience and terminal interfacedeveloper-experienceDeveloper experience improvementsfeatureNew feature or capabilityuxUser experience improvements

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions