Skip to content

feat(web): add purpose-built renderers for file, diff, test, and terminal evidence #345

Description

@sowen1023

Parent

Problem

The Web transcript currently renders thinking, tool calls, and tool results through generic expandable text blocks. This preserves basic evidence but makes common coding-agent output difficult to inspect:

  • file reads lose line-oriented navigation;
  • write/edit results do not provide a reviewed change view;
  • diffs are not rendered as additions/deletions with file identity;
  • test results are not grouped by command, status, or failure;
  • terminal output lacks a dedicated bounded log view.

A generic raw-text fallback is necessary, but it should not be the primary UI for structured evidence.

Value

  • Make actual code changes and validation evidence reviewable.
  • Reduce the risk of treating a tool label as proof of success.
  • Preserve exact raw evidence while providing useful bounded projections.

Approach constraints

  • Use Pi/OpenPI tool events and canonical results as the source of truth.
  • Keep user-visible presentation, model-visible context, and persisted runtime evidence separate.
  • Every renderer must have explicit byte/line/item bounds and a raw fallback.
  • Never infer success, file identity, or changed lines from colors or display labels.
  • Escape untrusted content and avoid executing rendered HTML, ANSI, links, or terminal control sequences.
  • Unknown and future tools must continue to render safely through the generic path.

Acceptance criteria

  • File-read evidence shows canonical path, line context, truncation, and recovery information.
  • Write/edit evidence shows affected files and a bounded, reviewable diff when exact evidence exists.
  • Test evidence distinguishes command, running/completed state, pass/fail/cancel, and failure excerpts.
  • Terminal evidence supports bounded incremental output and exact terminal status.
  • Each specialized view can reveal the sanitized raw arguments/result.
  • Oversized and malformed results remain bounded and cannot break transcript rendering.
  • Unknown tool types retain the current generic fallback.
  • Snapshot, SSE replay, and reconnect produce stable renderer input.
  • Protocol projection, UI rendering, accessibility, and browser tests cover each renderer.
  • bun run check and bun run test pass.

Out of scope

  • A browser code editor or filesystem explorer.
  • Reimplementing tool execution in the UI.
  • Treating presentation state as execution evidence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions