Skip to content

feat(capture): product walkthrough recording and composition - #455

Open
liujianye1 wants to merge 12 commits into
hypit-ai:mainfrom
liujianye1:feat/capture-plan
Open

liujianye1 wants to merge 12 commits into
hypit-ai:mainfrom
liujianye1:feat/capture-plan

Conversation

@liujianye1

@liujianye1 liujianye1 commented Oct 27, 2026 •

Copy link
Copy Markdown

What

Adds plan replay to @hypit/browser-capture, so an agent can record a product walkthrough or website tour from a JSON step plan instead of hand-writing a Puppeteer script per take.

  • hypit capture plan <plan.json> --to <new-dir>: steps goto / wait / assert / dismiss / hover / click / dblclick / fill / type / press / scroll / pause / screenshot / drag / upload. Targets are Puppeteer selectors; text= and role=…[name='…'] shorthands are translated.
    • Start page loads before recording; each step must resolve exactly one visible element (or an explicit index); the take stops at the first failure and keeps the partial recording plus screenshots/failed.png.
    • steps.json (hypit.capture-plan@1) reports each step's start/end on the recording's clock, target box and pointer in CSS px, checkpoint screenshots and skip reasons. The footage stays clean by default so the composition can draw cursor/zoom/callouts; --cursor page draws one into the page.
    • scroll with durationMs glides with easing (website tours).
  • Safety: clicks on paid/destructive controls (generate, buy, delete, send, publish…) are refused unless the step has "authorized": true; asset: { attribute, value } checks an exact identity.
  • Login: hypit capture login <url> --profile <name> opens a visible browser on a profile outside the project (~/.cache/hypit/capture-profiles); --profile reuses it. --storage-state imports a { cookies, origins } export. --login-check <url> asks the product's own session endpoint before recording and keeps only an account label.
  • Library: runCapturePlan, parseCapturePlan, planSelector, captureProfileDirectory, openCaptureLogin, CaptureOptions.storageState.
  • Skill docs: browser-capture.md (plan format, review, login rules) and screen-demonstrations.md (requirement → shot → review).

Tests

  • packages/browser-capture/test/plan.test.ts: validation and selector translation; a replay asserting boxes, skipped optional steps, fill replacing old text, and that step times match the recorded video (frame colour before/after a click); guarded click, ambiguous target, identity mismatch and non-empty output directory; storageState cookies + localStorage and login check (no token leaks into steps.json).
  • CLI argument validation for plan / login.
  • Ran locally with Chrome 156 (HYPIT_CAPTURE_TEST_BROWSER): all 10 browser-capture tests pass; tsc -p tsconfig.json --noEmit clean.
  • Manual: recorded a hypit.ai scroll tour and a hover → click → pricing walkthrough with --cursor page.

Not covered by an automated test: capture login (needs a person to log in in a headed window).

Composition: examples/product-walkthrough

  • capture plan now re-times Chrome's change-only native recording to constant-rate H.264 (--fps, default 30). Without this, mediaop:Normalize rejects a take with a still screen (Primary moving video has no eligible stream: frame gaps > 0.5 s are "discontinuous").
  • Each take also writes steps.svs, a walkthrough.take Recipe Source can import (<import as="take" source="./captures/take/steps.svs"/>), and steps.json keeps paths relative so takes can be committed.
  • @example/screen-walkthrough project component: presents a take on a screen card; the cursor travels to each recorded pointer, clicks/typing press with a ripple, and a camera moves in on actions, pans between nearby ones and lets go during pauses. Everything derives from the steps and the requested frame, and follows source-window if the recording moves in the program.
  • Example: fictional product page (demo/app.html), its plan, a committed 146 KB take, walkthrough.svml/.svrun. Added to the Distribution files next to semantic-composition.

Verified: hypit check + local hypit build of the example (1280×720, 30 fps, 12.2 s) and frame inspection; component unit tests (failed take refused, cursor/press/camera keys, motion shifts with the source Window).

Full node test/run.mjs locally: 3 failures (caption-fine layout.browser, media-local file-frames, provider-html-local capture-process); the same tests fail identically on a clean main worktree on this machine (Node 26 deprecation output), so unrelated.

🤖 Generated with Claude Code

liujianye1 and others added 3 commits October 27, 2026 16:01
…ings

`hypit capture plan <plan.json> --to <dir>` replays a step plan while recording
it: the start page loads before the recording, each step needs exactly one
visible target (or an explicit index), and the take stops at the first failure
with the partial recording and a failure screenshot. steps.json reports every
step's start/end on the recording's clock plus the target box and pointer in
CSS pixels, so a composition can draw the cursor, zoom or callout itself; the
footage stays clean unless --cursor page draws a cursor into the page.

Clicks on paid or destructive controls are refused unless the step carries
"authorized": true. Logged-in products use a named profile outside the project
(`hypit capture login <url> --profile <name>`, then --profile) or an exported
{ cookies, origins } state (--storage-state); --login-check asks the product's
own session endpoint and records only an account label.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Chrome's native recorder writes a frame only when the page changes, so a still
product screen left gaps that media normalization rejects as discontinuous.
The plan now re-times its recording to a constant-rate H.264 file (--fps,
default 30) with FFmpeg; the frame-colour test confirms step times still match
the footage after re-timing.

Each take also gets steps.svs, the same steps as a walkthrough.take Recipe that
Source can import, and steps.json keeps paths under the take or the plan
relative so a take can be committed and moved. Relative startUrl, goto and
upload paths resolve from the plan file.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A fictional product page, a capture plan and its recorded take, and a project
component that presents the take on a screen card: a cursor travels to each
recorded pointer, clicks and typing press with a ripple, and a camera moves in
on actions, pans between nearby ones and lets go during pauses. Everything is
derived from the take's steps and the requested frame, and follows the
recording's source Window when it moves in the program.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@liujianye1 liujianye1 changed the title feat(capture): replay JSON step plans into product walkthrough recordings feat(capture): product walkthrough recording and composition Oct 27, 2026
liujianye1 and others added 4 commits October 27, 2026 16:57
… sharp

Headless Chrome's native recorder and screencast deliver CSS pixels only, so a
take zoomed into by the composition looked soft. Above device scale 1 a plan
now records repeated screenshots (about 15 page frames per second at
2560 x 1600), assembled offline into constant-rate H.264 at CRF 14. Chrome
drops mouse and key events dispatched during a screenshot, so input waits for
the capture in flight; typing goes one key at a time so frames land between
keystrokes. The CLI records plans at scale 2; scale 1 keeps the smoother
screencast. The plan test now runs at both scales.

The example renders at 1920 x 1080 with the HTML renderer's high quality.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… tours

Found while recording openart.ai:

- prepare: unrecorded steps before the take. The site loads its videos only
  once they are scrolled into view, so without a warm-up pass every section
  appeared empty in the recording.
- locale: Accept-Language and navigator.language(s). The site offered a
  Chinese translation because of the recording machine's language.
- A scroll with durationMs is now a page-side eased animation. A stream of
  wheel events had to wait for each 2x screenshot, halving the frame rate
  of a glide. The scroller is the one under the pointer that scrolls in the
  requested direction, so a horizontal carousel no longer absorbs a
  vertical page scroll.
- 2x frames are JPEG q92, which captures faster than PNG at that size.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Ported from social-vv's login skill. openart.ai's Cloudflare Turnstile reported
"Verification failed" for every capture browser, so neither a recording nor a
person logging in through `capture login` could get past it. Capture browsers
now drop --enable-automation, add --disable-blink-features=AutomationControlled
and report "Chrome" instead of "HeadlessChrome"; the same check then passes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Overriding only the user agent string cleared Chrome's client hints, so a
headed browser reported "Chrome/156" with no brands. Cloudflare Turnstile then
refused to load ("The CAPTCHA failed to load ... unsupported browser") when a
person tried to sign up on openart.ai. A headed browser is now left untouched;
a headless one reports the brands a headed Chrome of the same version would.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
SanHsien added a commit to SanHsien/hypit that referenced this pull request Oct 28, 2026
…i#447-hypit-ai#456; advance watermarks

PRs hypit-ai#442, hypit-ai#443 and hypit-ai#444 were ported ahead of upstream (d5afdfe, 541ab59,
5dc763c) because the fork has the same defect and it is reachable from
outside input. The rest are recorded with the fork-side evidence and a
re-review trigger in docs/fork/DECISIONS.md. Release track unchanged at
v0.3.1; watermarks PR 455, issue 456.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
liujianye1 and others added 5 commits October 28, 2026 14:20
…ditors

Found recording openart.ai at phone width in a cloud sandbox:

- Responsive pages keep hidden copies of a control (the desktop layout behind
  the mobile one). Waiting for the first match timed out although a visible
  copy was on screen; targets, `wait` and `startUntil` now wait for any
  visible match.
- `fill` on a rich editor (ProseMirror) only changed the DOM selection, so a
  restored draft survived and new text was appended to it. It now selects
  through the editing command and deletes until the editor is empty.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Measured in a 4 vCPU cloud sandbox on a 1080x1920 take: 6.2 s instead of
9.9 s with medium at the same CRF 14, and a smaller file.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
layout="full" fills the Frame edge to edge instead of a framed card with a
margin: a phone-width take on a 1080x1920 Canvas then reads like the app on
the viewer's phone, with its content about 11% larger.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ite or app

The transformation guide sent product replacement through supplied images and
generation only, so an agent remaking a reference for a website or app would
illustrate an interface that does not exist. It now says which product
passages need the real interface recorded, how to plan and size those takes,
how to present them, and the limits on accounts, human checks and paid
actions. The routing table and the screen-demonstration guide point there.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Centre on the element's box and lower the zoom for a step whose element would not fit, so a wide field is not
cut at the edges; small controls keep the requested zoom.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant