Workers

Website capture

Takes a URL and produces a structured capture: full-page screenshot, cleaned HTML, extracted assets, copy text, sitemap snapshot, plus optional re-deploy as a static clone for design teardown. Uses a managed Chrome runner (Puppeteer over the platform's browser binding) rather than a Docker container.

Updated today

Overview

At a glance
Worker
ultron-capture
Browser
Managed Chrome via Puppeteer over the platform browser binding (no Docker)
Workflow
CaptureWorkflow (durable, multi-step)
D1
ultron-capture
R2
ultron-capture-assets
Cron
*/5 * * * * (reprocess stuck)
Pages target
ultron-clones
Vision model
Kimi (Moonshot-hosted) for the layout teardown summary

Used to seed competitor design audits, build "scrape, learn, iterate" loops for landing pages, and back the carousel engine's exemplar harvest. Capture is destination-agnostic; the same artefacts feed any downstream surface that needs visual or copy reference material.

Worker shape

wrangler.toml (key bindings)toml
1name = "ultron-capture"
2main = "src/index.ts"
3
4[triggers]
5crons = ["*/5 * * * *"]
6
7[browser]
8binding = "BROWSER"
9
10[[d1_databases]]
11binding = "DB"
12database_name = "ultron-capture"
13
14[[r2_buckets]]
15binding = "ASSETS"
16bucket_name = "ultron-capture-assets"
17
18[[workflows]]
19binding = "CAPTURE_WORKFLOW"
20name = "ultron-capture-workflow"
21class_name = "CaptureWorkflow"
22
23[vars]
24PAGES_PROJECT = "ultron-clones"
25KIMI_MODEL = "@cf/moonshotai/kimi-k2.6"

Capture flow

capture flowtxt
1# 1. Caller POSTs /captures with { url, options? }.
2# 2. Worker inserts a captures row in D1, status='pending'.
3# 3. Worker triggers CaptureWorkflow with the row id.
4# 4. Workflow opens the URL in managed Chrome:
5# a. wait for page network idle (with timeout)
6# b. inject any per-domain warmups (cookie banners, modals)
7# c. snapshot full-page screenshot at 1, 2, and 3 DPR
8# d. dump rendered HTML, computed CSS, and resource manifest
9# 5. Asset upload:
10# a. screenshot/<dpr>.png -> R2
11# b. snapshot.html -> R2
12# c. assets/<hash>.<ext> per static resource -> R2
13# 6. Layout teardown summary:
14# a. send screenshot + cleaned HTML to the Kimi backend with a
15# structured prompt asking for sections, hierarchy, typography,
16# palette, and component inventory
17# b. persist as captures.teardown_json
18# 7. (Optional) Deploy clone:
19# a. rewrite asset URLs to point at the R2 public URLs
20# b. push to the ultron-clones Pages project under a per-capture slug
21# c. write the resulting URL to captures.clone_url
22# 8. Mark status='succeeded'. Webhook back to caller if a webhook was set.

CaptureWorkflow steps

Each step is checkpointed.

StepWhat it doesOn retry
fetch-pageOpen URL in managed Chrome, wait for stability.Reopen browser tab fresh.
snapshot-screensThree DPR screenshots, full-page.Re-snapshot.
snapshot-htmlRendered HTML + computed style.Re-read.
upload-assetsPush every blob to R2.Idempotent by content hash; skips already-uploaded.
teardownKimi vision summary.Re-prompt with same inputs.
deploy-clone (optional)Push to the Pages project.Re-deploy under same slug.
finaliseUpdate D1, fire webhook.Re-fire webhook with same payload.

Output assets

D1 captures rowts
1{
2 id: 'cap_<uuid>',
3 url: 'https://example.com/pricing',
4 status: 'succeeded',
5 startedAt: '2026-05-19T12:00:00Z',
6 finishedAt: '2026-05-19T12:00:42Z',
7 screenshotKeys: ['cap_<id>/screen-1x.png', '...2x.png', '...3x.png'],
8 htmlKey: 'cap_<id>/snapshot.html',
9 assetKeys: ['cap_<id>/assets/<hash>.css', ...],
10 teardownJson: { sections: [...], typography: {...}, palette: [...] },
11 cloneUrl: 'https://ultron-clones.pages.dev/cap_<id>/' // optional
12}

Cloning to a static surface

The optional Pages deploy.

When the caller sets options.deployClone: true, the workflow rewrites the snapshot HTML to reference the R2 public URLs for its assets, then pushes the resulting directory to the ultron-clones Pages project under a per-capture slug. The capture row's cloneUrl field is set to the resulting static URL. Useful for design teardown sessions where engineers want a live mirror of a competitor page to inspect in their devtools.

Warning
The cloned surface is hosted under our domain, so any third-party assets that block hotlinking will fail to load. The workflow caches each asset to R2 first to avoid that class of failure for the most common asset types.

File map

cf-workers/ultron-capture
wrangler.toml
src
index.tsfetch + cron handlers, workflow trigger
workflow.tsCaptureWorkflow class with steps
render.tsPuppeteer page open + snapshot
teardown.tsKimi vision prompt + parser
clone.tsHTML rewrite + Pages deploy
migrations
0001_captures.sql