feat(demo): URL routing for shareable demo state#494
Open
blove wants to merge 12 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Locks decisions: full state in URL (thread id in path + agent knobs + theme + color scheme + project as query params), defaults omitted to keep links short, ephemeral hydration semantics (URL writes signals but not localStorage, so shared links don't infect recipients' preferences), thread id moves from localStorage to URL (drops threadId persistence entirely). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop the localStorage init read; threadIdSignal now starts as null and is set by readUrlState() on mount and on every NavigationEnd, reading the :threadId param from the active leaf route. Also fix pre-existing LANGGRAPH_THREADS_CONFIG provider missing from all spec beforeEach blocks. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace direct threadIdSignal.set() + persistence.write('threadId') calls
in onThreadSelected, onNewThread, threadActions.delete/archive, and the
agent's onThreadId callback with router.navigate(); onThreadId uses
replaceUrl: true to avoid extra history entries.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add KNOB_DEFAULTS table and buildQueryParams()/writeKnobsToUrl() helpers. Wire each knob handler (model, effort, genui, theme, color, project) to call writeKnobsToUrl after set+persist; omit params that match defaults so a fresh session shares a bare URL. replaceUrl:true keeps dropdown clicks out of browser history. Also wire the constructor color-scheme auto-sync effect that updates the A2UI theme preset. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extend readUrlState() to read model, effort, genui, theme, color, and project query params on mount and every NavigationEnd. Hydration is ephemeral — no persistence.write() calls inside readUrlState(). Five new tests cover the round-trip. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
549889f to
66467eb
Compare
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.
Summary
:threadIdpath segment per mode; agent knobs (model, effort, genui, theme, color, project) round-trip via query params with defaults omitted.threadIdfrom localStorage entirely.Spec: docs/superpowers/specs/2026-05-20-demo-url-routing-design.md
Plan: docs/superpowers/plans/2026-05-20-demo-url-routing.md
Relationship to PR #500
PR #500 landed first with the thread-id-in-URL half (
/embed,/embed/:threadId) plus id validation/redirect on 404/422. This PR reverts that commit and re-implements the same routing with a broader scope: also rounds knob state (?model=&effort=&theme=&color=&genui=&project=) through the URL, and pins ephemeral hydration semantics so a shared link cannot clobber a recipient's localStorage.Net change relative to PR 500:
+knob URL writes,+knob hydration from URL,+ephemeral test contract,+e2e deep-link smoke. Removed: PR 500'sgetThread()id validation + 404/422 redirect (out of scope for this PR — happy to add as a follow-up; the spec deliberately deferred validation as "thread ids are guessable but threads contain no sensitive data").URL shape
Examples:
/embed— fresh demo, all defaults/embed/019e434c-...— that thread, defaults for everything else/popup/abc123?genui=json-render&theme=material-dark&color=light— full stateHistory behavior
onThreadId)Test plan
examples-chat-angular(hydration, navigation, ephemeral contract)nx build examples-chat-angulargreennx lint examples-chat-angularcleannx e2e examples-chat-angular) — runs in CI; note the e2e job is currently failing on main too (pre-existing, unrelated to this PR)/embed/<id>?theme=material-darkto incognito tab → loads correctly, localStorage untouched🤖 Generated with Claude Code