web: live run updates over a single app-wide watch (R10)

This commit is contained in:
2026-10-19 14:22:53 +01:00
parent 2fe63012f9
commit 21a6ee3c4d
13 changed files with 1580 additions and 90 deletions
+23 -11
View File
@@ -167,17 +167,29 @@ export function serverBuildLabel(build) {
}
/**
* The live-stream badge, mirroring LiveBadge.kt / RunStream.kt: the stream is
* "live" only while a shown run is executing and the socket is connected,
* "reconnecting" while the socket is coming back, and "not live" otherwise. The
* word always carries the meaning, so colour is never the only signal.
* The live-stream states, exactly RunStream.kt's three words. The page tracks
* this itself (it owns the subscription), so the badge says whether the pushes
* are arriving rather than guessing from whether a run happens to be executing.
*/
export function liveBadgeState(run, connection) {
const executing = Boolean(run && run.executing);
const kind = connection?.kind;
if (executing && kind === "connected") return { tone: "live", label: "live" };
if (executing && (kind === "connecting" || kind === "disconnected")) {
return { tone: "reconnecting", label: "reconnecting" };
export const RunStream = Object.freeze({
Live: "live",
Connecting: "connecting",
Offline: "offline",
});
/**
* The live-stream badge, mirroring LiveBadge.kt / RunStream.kt: the explicit
* stream state maps to the app's own word and dot ("live" / "reconnecting" /
* "not live"). The word always carries the meaning, so colour is never the only
* signal, and the badge is independent of whether any run is executing.
*/
export function liveBadgeState(streamState) {
switch (streamState) {
case RunStream.Live:
return { tone: "live", label: "live" };
case RunStream.Connecting:
return { tone: "reconnecting", label: "reconnecting" };
default:
return { tone: "not-live", label: "not live" };
}
return { tone: "not-live", label: "not live" };
}