Twin outputs: components surface rendered images to the dashboard - #38
Merged
Conversation
The DT service has no file staging, so a twin's visual output (e.g. a rendered heatmap) rides back inline: a component calls RuntimeAPI.record_output(name, dataurl) with a small data-URI, the runtime keeps the latest (id-tagged, monotonic count), and summary() forwards it under the frame cap. The dashboard dedups on the id to accumulate a bounded gallery -- latest large, recent thumbnails behind it -- in a new Outputs panel on the twin card (dt_dash.js 0.11.0). Only the newest image is on the wire each poll, so the frame stays small however many outputs a twin has produced. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Npyz3Hbnwos12ESsdJ2YU
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.
A twin can now push a rendered visual output (e.g. a heatmap) to the dashboard. Motivation: the DT service has no file staging (both ORBIT staging plugins exist but neither is wired to the rhapsody/DT path), so the only way endpoint-produced data returns is inline
return_value— which is plenty for a small image.RuntimeAPI.record_output(name, dataurl)— any component calls this with a smalldata:URI (a downscaled PNG it rendered). The runtime keeps the latest, id-tagged with a monotonic count;outputs()returns{latest, count}.TwinInstance.summary()forwardsoutputsin everytwin_list/admin/sessionspoll — only the newest image, so the frame stays small under the 4 MiB cap however many a twin produces.dt_dash.js0.11.0): dedups on the id to accumulate a bounded client-side gallery, rendered in a new Outputs panel on the twin card — latest large, recent thumbnails behind it.signature()learns the new field so the card rebuilds on a new image; cache-buster bumped.Validated end to end against a live local broker with the xGFabric service twin: heatmaps arrive in the panel as they're produced (screenshot in the session). Full unit suite: 180 passed.
A component-side consumer (the xGFabric sink returning its PNG bytes and calling
record_output) rides in the xGFabric PR.🤖 Generated with Claude Code
https://claude.ai/code/session_016Npyz3Hbnwos12ESsdJ2YU