feat(framework): hosted run relay — watch one run from multiple browsers (#230)#278
Merged
Conversation
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.
Closes #230.
First concrete slice toward shared team sessions (#204): prove two people can watch the same run before we build any accounts/teams/billing.
framework relayhosts a relay (a tiny HTTP server).framework "..." --share <relay-url>publishes the run's event stream to it and prints a shareable URL.Why it's small: the dashboard is already a multi-client SSE projection of one event stream with per-client history replay. This factors the SSE serving into a shared helper and makes the page's stream/stop paths relative so they resolve both on the localhost dashboard (
/events) and under the relay (/r/<id>/events). The genuinely new pieces are the relay server (multi-run, keyed by id) and the CLI publisher. New exports:startRelay,relayPublisher.Out of scope by design (keeps it a keystone): accounts/auth, teams, RBAC, billing, authorized steering. The relay is unauthenticated — anyone with a run URL can watch — and never runs an agent; it only projects the stream. Those layer on later via vike-auth/-rbac/-data.
Verified end to end: hosted a relay, ran
--fake --shareagainst it, then a viewer connecting after the run finished replayed the full 42-event run (session -> ... -> end ok=true);/r/:idredirects to the trailing-slash page; the page loads its SSE relatively. 150 framework tests green (relay: two browsers replay one run, HTTP publish re-serves live, run isolation, redirect + page, healthz + bad-publish handling).Note: run streams accumulate in memory for the process lifetime (late joiners replay) — fine for the keystone; a TTL/cap is a follow-up. Real hosting + identity is the next layer, not this PR.