Skip to content

The live run viewer formats an agent's outputs too - #58

Merged
endrix merged 1 commit into
mainfrom
fix/run-viewer-formats-outputs
Sep 22, 2026
Merged

endrix merged 1 commit into
mainfrom
fix/run-viewer-formats-outputs

Conversation

@endrix

@endrix endrix commented Sep 22, 2026

Copy link
Copy Markdown
Owner

#57 formatted the session timeline. The run viewer is a different path: partTemplate renders an agent's live parts, and a text part went to the DOM as typed. So the view that actually shows a running agent, which is where an ask_flow run is watched, still displayed the escaped JSON:

{"outputs": {"Answer": "{\"question\": \"In one sentence, what should the planner try first on the core, and why?\", \"answer\": \"pipelining\", \"declined\": false}"}}

It now reads:

Answer

  • question In one sentence, what should the planner try first on the core, and why?
  • answer pipelining
  • declined false

What changed

A text part formats an outputs object through the module #57 added, and leaves ordinary text as typed, which is what the viewer has always shown for an agent's prose. The headings, lists and blocks it produces are styled from the editor's own tokens, so they follow the theme.

Testing

Two tests on the branch taken and on what reaches the renderer. They mock the markdown module, which sanitizes through DOMPurify and needs a DOM the node environment does not have; the point of the tests is the decision and the payload, not the HTML.

221 tests pass, five packages type-check, five of five neutrality gates pass.

The previous change formatted the session timeline. The run viewer is a
different path: it renders an agent's parts, and a text part went to the
DOM as typed, with no markdown and no formatting. So the view that shows
a running agent — the one an ask_flow run is watched in — still displayed
the escaped JSON.

A text part now formats an outputs object and leaves ordinary text alone,
which is what the viewer has always shown for an agent's prose. Its
headings, lists and blocks are styled from the editor's own tokens.

Two tests, with the markdown module mocked because it sanitizes through
DOMPurify and these tests run without a DOM: they assert which branch is
taken and that the formatted Markdown, not the escaped JSON, reaches the
renderer.
@endrix
endrix merged commit 8815a7f into main Sep 22, 2026
1 check passed
@endrix
endrix deleted the fix/run-viewer-formats-outputs branch September 22, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant