A message shows its shape, and its contents when asked

A record or an artifact reference was serialised into the port row, and the
panel widened until the type selects and the buttons beside them were pushed
off its edge — a checkpoint reference is 130 characters of digest, and none of
them are what you want while wiring a flow. What shows now is what the value
*is*: 'artifact · weights.json · 60B', 'record · 3 fields'. A chevron unfolds
the whole of it, wrapped, inside the panel it belongs to.

A scalar still reads as itself, and scrolls its own overflow into view when it
is longer than the room it was given. That behaviour already existed inside
the edge inspector; it moves to Common/Marquee so the panel can have it too,
and the inspector drops its own copy of the raw-JSON block along with it.

The rows are smaller for it: the type select finally fits the word 'artifact',
and a port nothing has come through on says so with a dash rather than a
sentence — nine ports of 'nothing has come through yet' is a panel of prose
about the absence of values.

The e2e check asserts both halves: that the summary is what appears, and that
the panel is still exactly 400px with the value unfolded.
This commit is contained in:
2026-08-19 13:20:12 +02:00
parent ec54084fb1
commit 4b7dfc066b
6 changed files with 313 additions and 74 deletions
@@ -1,7 +1,7 @@
import { useQuery } from "@tanstack/react-query"
import { useEffect, useState } from "react"
import type { HistoryPoint } from "@/client"
import type { DType, HistoryPoint } from "@/client"
import { Sparkline } from "@/components/Common/Sparkline"
import {
Tooltip,
@@ -11,16 +11,11 @@ import {
import { qualify } from "./deriveEdges"
import { useLiveValue } from "./liveStore"
import { messageHistoryQueryOptions } from "./queries"
import { ValuePreview } from "./ValuePreview"
/** The same bound the server keeps, so the live tail cannot outgrow the window. */
const WINDOW = 120
/** How a value that cannot be plotted still reads. */
function describe(value: unknown): string {
if (typeof value === "string") return value
return JSON.stringify(value) ?? String(value)
}
/** A stretch of time in the coarsest unit that still says it. */
function span(seconds: number): string {
if (seconds < 90) return `${Math.round(seconds)}s`
@@ -65,9 +60,12 @@ function useSettled(value: string): string {
export function MessageSparkline({
flow,
name,
dtype,
}: {
flow: string
name: string
/** What the port declares, so a value that never arrived still says what it would be. */
dtype?: DType
}) {
const message = useSettled(name)
const live = useLiveValue(qualify(flow, message))
@@ -102,21 +100,24 @@ export function MessageSparkline({
].slice(-WINDOW)
if (points.length === 0) {
// Three silences, kept apart: nothing has run, or something arrived that
// no curve can say anything about. The second is worth showing; the first
// is worth admitting to in as few words as the row can spare.
if (live === undefined) {
// A dash rather than a sentence: one of these sits under every port, and
// nine ports of "nothing has come through yet" is a panel of prose about
// the absence of values. The row keeps its height either way, so nothing
// shifts when the first one arrives.
return (
<p className="text-xs text-muted-foreground">
Nothing has come through yet.
<p
className="text-xs leading-5 text-muted-foreground"
title="Nothing has come through yet"
>
—
</p>
)
}
return (
<div className="flex items-baseline gap-2 text-xs">
<span className="min-w-0 flex-1 truncate font-mono">
{describe(live.value)}
</span>
<span className="shrink-0 text-muted-foreground">no history</span>
</div>
)
return <ValuePreview value={live.value} dtype={dtype} />
}
// The value is live here, so the dot on the newest reading is earned. The