Preview
Shows a Vercel preview of the current branch in an iframe artifact.
Steps
git_status→ get current branch namegetDeployments(teamId=“uvilo”, limit=5) → find the most recent deployment whosemeta.githubCommitRefmatches the current branch- Wait for build completion: If the deployment state is not
READY: a. Show a brief status message to the user (e.g., “Build in progress, waiting…”) b. Poll withgetDeployment(teamId=“uvilo”, deploymentId=ID). Max 6 polling calls. Each call counts toward the LangGraph recursion limit, so do NOT poll aggressively. Vercel builds typically take 30-40 seconds. c. Repeat until the state becomesREADYorERRORd. IfERROR: report the failure (optionally show build logs viagetDeploymentEvents) and stop — do NOT render the iframe artifact e. If stillBUILDINGafter 6 polls: render the artifact anyway with statusbuildingand tell the user to run/previewagain in a moment - Read bypass token from the
VERCEL_PROTECTION_BYPASSenvironment variable on the forgentic container - Determine the preview URL:
- If branch is
dev:https://os.uvilo.com - Otherwise: use the deployment’s
meta.branchAliasorurlfield
- If branch is
- Output a
text/htmlartifact with identifiervercel-preview. CSS is hosted athttps://os.uvilo.com/preview-bar.css(source:.internal/public/preview-bar.css).
HTML Template
Placeholders
| Placeholder | Value |
|---|---|
BRANCH | Current git branch |
STATE | Deployment state as CSS class + text (ready, building, error) |
URL | Full preview URL (e.g., https://os.uvilo.com) |
DISPLAY | Short display form (e.g., os.uvilo.com) |
GITHUB | https://github.com/ErikDakoda/uvilo-os/tree/<branch> |
VERCEL | Vercel inspector URL from deployment inspectorUrl |
TOKEN | Bypass token from the VERCEL_PROTECTION_BYPASS environment variable |
Fallbacks
If no deployment is found for the current branch, tell the user the branch hasn’t been pushed/deployed yet and suggest pushing first.
The artifact identifier must always be vercel-preview so it updates in place.