UIV is a self-hosted image/video service. After uploading, it returns a public link that anyone (including GitHub) can access directly.
Prerequisites
Two environment variables are required:
UIV_URL: UIV'spublicaddress, e.g.https://uiv.example.comorhttp://1.2.3.4:7000. It must be an address GitHub can reach; links generated from LAN or Tailscale addresses will show as broken images in PRs.UIV_TOKEN: the token used for uploading.
If these two variables are not present in the current shell, load ~/.agents/env/uiv.sh(source ~/.agents/env/uiv.sh) first; do not search around for config files. If either is still missing after loading, or the file does not exist, stop and ask the user to provide it; do not guess.
Capture the final state
A screenshot should present the scene after the target state is in place. After clicking, navigating, or submitting, the interface takes a while to stabilize: loading indicators exit, data finishes rendering, animations finish playing. Taking a screenshot before that yields a useless image captured mid-transition.
- Wait for the target state's sentinel before capturing: pick an element or text that exists only in that state (success message, target data, new page title), wait for it to appear, and do not guess timing with a fixed sleep.
- Transition animations (modals, expansions, fades) keep playing for a while after the sentinel appears; wait a few hundred more milliseconds to settle before capturing.
- Review each image yourself before uploading: if it still shows loading, partial rendering, or a mid-animation state, retake it.
Upload
Upload one file at a time; the field name is fixed as file:
curl -fsS -H "Authorization: Bearer $UIV_TOKEN" -F "file=@screenshot.png" "$UIV_URL/api/files"
In Windows PowerShell, curl is an alias, so write curl.exe:
curl.exe -fsS -H "Authorization: Bearer $env:UIV_TOKEN" -F "file=@screenshot.png" "$env:UIV_URL/api/files"
On success it returns HTTP 201 and JSON:
{
"id": "k3J9xQ2mPa",
"url": "https://uiv.example.com/f/k3J9xQ2mPa.png",
"markdown": "",
"name": "screenshot.png",
"size": 48213,
"type": "image/png",
"created_at": "2026-10-03T15:44:18.486Z"
}
Paste the markdown field as-is into the PR description or comment. Images will produce  form and display directly; videos will produce [..](..) form and display as links.
Choosing a format
- Screenshots: PNG, or WebP (smaller size).
- Demonstrating an operation flow: prefer recording a GIF or animated WebP. GitHub only plays videos uploaded to GitHub itself inline; external MP4 links are shown only as links and play only after clicking.
- Longer demos: MP4 (H.264) or WebM; just paste the link.
- Only images and videos are accepted (PNG, JPEG, GIF, WebP, AVIF, HEIC, BMP, SVG, MP4, WebM, MOV, AVI), determined by file content, regardless of extension. The default per-file limit is 200MB.
Demo animations
This section covers short demos that can be explained with a few state images; for longer demos, do not stitch a GIF—upload an MP4 link directly as described in "Choosing a format".
- By default, capture screenshots by state and then stitch them into a GIF; do not record continuous video. Capture one screenshot for each meaningful state during the operation and set the dwell time individually: under 1 second for intermediate states, at least 3 seconds for the final state.
- Capture each frame only after it is in place per "Capture the final state"; the first frame must be the page after loading completes, with no "loading" shown.
- Key UI should occupy the main part of the frame. Use a viewport around 900 wide, or crop only the operation area, so text remains legible after being pasted into a PR table.
- Record continuous video only when the change itself is an animation or transition effect. In that case, upload the MP4 as a link and also paste a few key-state screenshots.
- Self-check before upload: the longest frame must be the final state and at least 3 seconds long; the first frame must not be a loading state; watch the entire thing through once.
Assemble the GIF from screenshots by state, setting the dwell time for each frame individually:
from PIL import Image
frames = [("board.png", 1000), ("hover.png", 700), ("dialog.png", 3600)]
imgs = [Image.open(f) for f, _ in frames]
imgs[0].save("demo.gif", save_all=True, append_images=imgs[1:],
duration=[d for _, d in frames], loop=0, optimize=True)
Self-check before upload, printing dimensions, frame count, per-frame duration, and total duration:
from PIL import Image, ImageSequence
im = Image.open("demo.gif")
d = [f.info.get("duration", 0) for f in ImageSequence.Iterator(im)]
print(im.size, len(d), d, sum(d))
Note
- Links are public and accessible without a token. Do not upload screenshots containing secrets, personal information, or internal data; crop or redact them first if necessary.
- Links remain valid permanently unless someone manually deletes them in the UIV admin console.
- Uploading the same file twice produces two different links; confirm you really need to before re-uploading.
Error handling
On failure, returns JSON {"error": "..."}:
| Status code | Meaning | Handling |
|---|---|---|
| 401 | Token missing or incorrect | Check UIV_TOKEN; do not retry repeatedly |
| 413 | File exceeds the size limit | Compress, crop, lower the resolution, or shorten the video |
| 415 | Not an allowed image/video type | Convert to one of the formats listed above |
| 400 | Incorrect request format | Confirm that you are using -F "file=@路径" |
Check whether the service is available:curl -fsS "$UIV_URL/api/health", returns {"version":"..."}。