Skip to content

增强 Pixelle CLI 运行中的状态线与阶段展示 #28

Description

@ztygod

背景

长任务中,用户最需要知道 agent 现在是在思考、调用工具、等待验证,还是遇到了错误。当前 CLI 已有 StatusBar 和 assistant stage 展示,但整体信息较粗:状态栏只显示 Ready/Thinking/Working/Error 和工具数量,timeline 中的阶段标签也主要是 thinking/planning/executing/complete。

当 agent 运行时间变长时,这种展示不足以建立可观测性。用户无法快速判断 Pixelle 是否正在推进、正在做哪一步、最近一次动作是什么、验证是否还在运行。

目标

增加更现代的运行中状态展示:当前阶段、最近动作、运行时长、正在运行的工具数量、验证状态和错误状态都能被清楚展示。用户在长任务中不需要打开 debug 也能知道 agent 正在做什么。

当前问题

src/cli/runtime-events.ts 当前没有映射 runtime.status_changedruntime.step_startedruntime.step_completedruntime.step_failedtask.started 等 runtime/task 事件。src/cli/components/chrome/StatusBar.tsx 不展示当前任务名、运行耗时或最近动作。RuntimeNote 对 verification 的展示也只有 running/passed/failed,缺少命令摘要和上下文。

参考体验

参考 Claude Code / Codex CLI 的 live status line:用户能看到 agent 正在扫描、读取文件、执行命令、编辑文件或验证,而不是只有泛泛的 Thinking。状态线应稳定、简洁,避免刷屏。

改动方向

新增运行状态模型和状态线组件,优先复用现有 runtime events。该 issue 不要求 runtime 新增大量事件,重点是把已有事件映射到 CLI 视图并优化展示。

可能涉及模块

  • src/cli/runtime-events.ts
  • src/cli/state/cli-state.ts
  • src/cli/types.ts
  • src/cli/components/chrome/StatusBar.tsx
  • src/cli/components/timeline/RuntimeNote.tsx
  • src/events/event-bus.ts

大致实现方案

  • 新增 RuntimeStatusState,记录当前阶段、最近动作、开始时间和验证状态
  • 映射 runtime/task/step 事件为 CLI event
  • StatusBar 拆分或升级为 AgentStatusLine
  • 对 running tools、verification、last action 做更语义化展示
  • debug 模式下继续展示 event count、last event、width 等细节

任务清单

  • 扩展 CLI event 类型以承载 runtime/task/step 状态
  • 在 reducer 中维护当前运行阶段、最近动作和开始时间
  • 新增或升级状态线组件,展示阶段、耗时、工具数量和验证状态
  • 优化 verification note,展示命令摘要和结果
  • 保持 debug 模式下的详细事件信息

验收标准

  • 长任务执行时用户能看到当前动作,而不是只看到 Thinking
  • 工具执行、验证和错误状态会反映到状态线
  • 没有 runtime event 时仍保持现有 Ready/Thinking 行为
  • 状态线不会在流式输出时造成明显闪烁或刷屏
  • debug 模式可显示更详细事件信息

建议标签

cli、ux、feature、agent-runtime

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-runtimeAgent runtime integrationcliCLI experience and terminal interfacefeatureNew feature or capabilityuxUser experience improvements

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions