refactor(shadcn): share agent token logic between Vercel route and dev server#1395
Merged
Merged
Conversation
…e and dev server Extracts the AccessToken-building logic duplicated across the Vercel Preview API route and the local Storybook dev middleware into a single tokenCore.ts, addressing review feedback on #1394. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
size-limit report 📦
|
1egoman
approved these changes
Jul 23, 2026
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.
Issue
Addresses reviewer feedback on merged PR #1394 — no Linear ticket for this follow-up.
Overview
AgentSessionView-01story needs a LiveKit token from two places: a Vercel Preview API route and a local Storybook dev-server middleware.Summary of changes
docs/storybook/api/agents-ui/tokenCore.tscreateAgentToken(env)— env validation,AccessToken+RoomConfigurationconstruction.docs/storybook/api/agents-ui/token.tscreateAgentTokenand sends the response.docs/storybook/.storybook/main.jstokenCore.tsvia Vite'sserver.ssrLoadModule(needed since this file is CommonJS and can't natively import TS), then callscreateAgentToken.Testing
pnpm --filter @livekit/component-docs-storybook tsx:checkpasses on all touched/new files.pnpm dev:storybooklocally and confirmed the token route still executes end-to-end through the new shared module (returns the expected validation error withoutLIVEKIT_URLset).AgentSessionView-01story still connects to a live room at<preview-url>/?path=/story/agents-ui-agentsessionview-01--default.🤖 Generated with Claude Code