The live run viewer formats an agent's outputs too - #58
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#57 formatted the session timeline. The run viewer is a different path:
partTemplaterenders an agent's live parts, and atextpart went to the DOM as typed. So the view that actually shows a running agent, which is where anask_flowrun is watched, still displayed the escaped JSON:It now reads:
What changed
A
textpart 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.