Skip to content

Render inspector tool results by content type #2066

Description

@jbeda

Problem

The /toolcalls inspector shows complete received result text, but a single plain-text presentation makes Edit/Write diffs, agent summaries or skill content, Shell output, and JSON hard to scan. The current detail sections distinguish where a result came from; they do not render its content according to its type.

Proposed follow-up

Define an explicit UI-internal content-rendering boundary and use it for inspector result bodies. Choose presentation from the known tool/result kind and received typed blocks, with a safe plain-text fallback:

  • Diff-aware highlighting for Edit/Write result diffs, preserving every line.
  • Markdown for agent summaries and skill content when the result is non-JSON; never assume arbitrary tool text is Markdown.
  • Readable Shell output with sensible breaks and optional bounded coloring, without interpreting terminal control sequences as executable output.
  • JSON indentation/highlighting for received structured content (objects, arrays, scalars), while keeping distinct text and typed blocks visible.

Keep the canonical scrollback/result unchanged and use only the received display-safe payload. Rendering must remain bounded by the offered conversation geometry, support scrolling/resize/follow and pending→canonical updates, sanitize untrusted text/metadata, avoid printing raw media bytes, and have an honest fallback for unknown tools and malformed content. Locate the smallest reusable package/interface for these distinct content types instead of adding another ad hoc switch inside toolcalls.go or coupling the inspector to conversation-card rendering.

Acceptance sketch

  • Fixed-width examples show each content type and a safe fallback; no result text is dropped or duplicated.
  • Offline tests cover hostile terminal controls, long output, failed/provisional results, and transcript rehydration, with the stored canonical result unchanged.
  • Existing cards, tool schemas, provider payloads, and ctrl+t stay untouched unless a separately approved contract explicitly expands the scope.

Relates to #1361 and Implementation PR #2061. This is a follow-up; it is not part of the current inspector styling pass.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions