Skip to content

Latest commit

 

History

History
248 lines (204 loc) · 15.2 KB

PLAN-hyperframes.md

File metadata and controls

248 lines (204 loc) · 15.2 KB

PLAN — dsh-hyperframes: moving figures, not videos

Status: built. The plan below was accepted and shipped as packages/dsh-hyperframes (alpha.1): six tools, three skills, three worked UI examples, a 200-assertion check, and a draft render verified against hyperframes 0.9.106 on this machine. The decisions it left open were settled by the build — the CLI was exercised through the npx cache (never npx at run time), the framing is product-UI animation with a citable still, and the tools came first with no Frames tab. Kept as the decision record; the shipped behaviour lives in packages/dsh-hyperframes/README.md.

1. The verdict, in three sentences

Interesting — but not as a video feature. This pack can already photograph a page (shot_url), photograph a real window (shot_window), probe and play a video (media_probe, dsh-video), and compile a publication figure (diagram_*, table_write). What it cannot do is produce a moving figure whose still frame is citable, whose numbers come from the same data as the paper, and whose render is the same bytes on Tuesday as it was on Monday. That is a scientific artefact that happens to play; "video" is the delivery format, not the point.

A recorder should NOT be built. Still of an app: shot_window (exists). Motion of an app: media_run + ffmpeg (exists, dsh-media owns it). Website → editable scenes: hyperframes capture (the CLI's own command). A rec_* row would be the third owner of one job, which is exactly what ARCHITECTURE.md forbids.

One new package, wrapping the user's own CLI, the way dsh-deckcraft wraps DeckCraft: no engine vendored, nothing installed, nothing started on its own, and a status tool that is useful on a machine where the CLI is missing — which is this machine today (§7).

2. What the pack owns today, and what is genuinely missing

The job Owner today Verdict
Still of a web page / element dsh-screenshot shot_url done
Still of an application window / the screen dsh-screenshot shot_window / shot_screen done (Windows)
Probe, transcode, play, extract frames dsh-media, dsh-video done
A publication figure (TikZ, Mermaid, compiled spec) dsh-diagrams done
A paper table dsh-tables done (LaTeX PNG too)
An HTML page rendered and measured dsh-frontend-craft fe_render done
A deck, rendered to images dsh-deckcraft done
An authored, seekable, deterministic render to MP4 nobody the gap
One source that emits a still + a caption + N variants nobody the gap

The gap is narrow and real. Every existing package produces a picture; ffmpeg can only turn pictures into a recording of something that already happened. Nothing here can author time.

3. Why HyperFrames is the right engine to wrap

Three facts from its own documentation, each of which matters more than "it renders MP4":

  1. It was built to be driven by a harness. HF_TOOL_CONTEXT (v1) lets the caller declare events (an NDJSON file the CLI appends artifact.created records to, with absolute paths for every frame and contact sheet), project-lock (wait for a concurrent browser command instead of racing it) and check-review (findingFrames: one plain frame per finding, plus inspect snippets of the source that caused it). So a tool can hand back the picture that failed, not a log line. That is the editor's Preview loop, generalised to time.
  2. snapshot is the product. hyperframes snapshot --at 3,10.5 --json writes 1920×1080 PNGs and a contact sheet without rendering video. The review loop is cheap; the expensive render is last. That is why the still can be the deliverable.
  3. Determinism is a first-class promise. Every timeline is paused and seeked, time = floor(frame)/fps, and the banned list is enforced by the linter (Date.now(), requestAnimationFrame, unseeded Math.random, repeat:-1, CSS transitions, network fetches). A figure that can be regenerated is a figure a reviewer can check. --docker is the byte-exact path; we would not drive it.

And two facts that shape the science layer:

  1. No math, no chart library. No LaTeX/KaTeX/MathJax anywhere in 135 docs pages or the catalog, and no bundled math font. Charts are catalog blocks with the series hardcoded, or hand-drawn SVG.
  2. The pack already owns both missing halves. dsh-diagrams compiles TikZ and the figure grammar to vectors; dsh-tables sets LaTeX tables and returns a PNG of the real typesetting. So an equation or a mechanism diagram enters a composition as an SVG asset the pack produced, and HyperFrames only has to move it.

4. The thesis

The editor gives you a picture of what you wrote. This gives you a picture of what you wrote at every frame, and then a file that plays.

Concretely, one source (index.html + compositions/*.html + assets/) produces:

  • a poster frame — a snapshot --at of the beat the author chose, citable;
  • a caption file — alt text, duration, fps, engine version, and the scene list;
  • N variants — --variables '{"condition":"treated"}' or --batch rows.json: the same timing, one render per condition;
  • the MP4 — last, gated, with the check rung named beside it.

5. The package

Name dsh-hyperframes, row hyperframes, tools prefixed anim_ — hf_* is already dsh-huggingface's (checked: packages/dsh-huggingface/lib/tools.js), and anim_ is free. Host half only in phases 0–3.

Tool The CLI behind it What it answers Rung
anim_status --version, info, doctor --json the four facts that fail independently: the CLI, Node ≥ 22, a browser, ffmpeg — and the install line when the CLI is absent. Installs nothing a0
anim_new none (our template) a project inside the workspace: index.html, compositions/, assets/, a README naming the rungs a0
anim_scene none (writes HTML) one scene from a figure file (svg/png) with reveal timing, a caption variable and alt text — the bridge from dsh-diagrams / dsh-tables / shot_url a0
anim_check lint --json, then check --json findings passed through verbatim, the frames around each finding, and the rung actually reached a1/a2
anim_snapshot snapshot --at/--range --review --json + HF_TOOL_CONTEXT stills and a contact sheet as pictures in the conversation, read from the events stream a3
anim_render render --format --quality --fps -o the file, its ffprobe facts (duration, fps, size, codec) and the provenance tags the CLI writes a4

The rung ladder (stated on every answer, never rounded up)

a0-source    the project exists and passes the static contract check (no CLI needed)
a1-lint      `lint --json` ran with no errors          (no browser)
a2-checked   `check --json` ran in a browser and is ok (layout / motion / contrast)
a3-stilled   `snapshot` wrote frames and the pictures came back
a4-rendered  `render` wrote the file, and ffprobe agrees with what was asked

anim_render reports the last check rung it saw in the same answer, so "rendered" is never printed as "correct". A render with a failing check is refused unless force: true, and the refusal names the findings.

6. The science layer (the part no other package can do)

  • Figures enter as vector assets. diagram_write (figure/TikZ) → SVG in assets/; table_write → the LaTeX PNG. A scene then reveals parts of a real figure in order (attr:{} on SVG geometry, never left/width — the linter rejects layout-property tweens).
  • Equations are pictures, and that is correct. HyperFrames has no math support and no math font. Set the equation with TikZ and place its SVG at the size it was drawn. Say so in the limits: it will not reflow, and a figure's equation should not.
  • Variants are the methods figure. One composition, --variables per condition, identical timing — a supplementary figure set that differs only in the thing under test.
  • Accessibility is a file, not a check. Every anim_new project carries caption.md: the poster's alt text, the transcript, the duration, and the scene list. A reader without the video still gets the figure and its legend.
  • The numbers stay owned by the data. A chart's series is written into the scene at author time from a CSV or a JSON the paper already has; the composition never becomes the source of a number.

7. What this machine has, measured today

Fact Value
Node v22.20.0 — meets the CLI's >= 22 floor
hyperframes MISSING — not on PATH, not in the npx cache
ffmpeg / ffprobe C:\ffmpeg\bin\ffmpeg.exe — on PATH
Browser C:\Program Files\Google\Chrome\Application\chrome.exe
$DSH_HOME/dsh-media/bin nothing provisioned (the PATH copy is what would be used)
PowerShell 5.1.26100

So every rung above a0 is unproven here until the user installs the CLI. The package can be built, checked and shipped without it — the dsh-deckcraft precedent is a 54-assertion check that needs no DeckCraft — but P3 has no honest acceptance criterion until npx hyperframes --version answers on this box. That is a decision for the user, not something this plan can assume.

8. Policy the row would obey

Resolution. A hyperframes binary on PATH, or DSH_HYPERFRAMES_CLI. Never npx — npx downloads a package when it is missing, which is an install with a different name.

Env set on every child (so the row starts no network egress of its own):

HYPERFRAMES_NO_TELEMETRY=1   DO_NOT_TRACK=1
HYPERFRAMES_NO_UPDATE_CHECK=1
HYPERFRAMES_NO_OPTIONAL_INSTALL=1  HYPERFRAMES_NO_AUTO_INSTALL=1
HYPERFRAMES_NO_CAPTURE_DOTENV=1    HYPERFRAMES_SKIP_SKILLS=1
HYPERFRAMES_AGENT=1
HYPERFRAMES_BROWSER_PATH=<the Chrome/Edge this host already has>

ffmpeg. HyperFrames has no ffmpeg-path variable (confirmed: none in the CLI reference). It uses ffmpeg from PATH, so the row resolves ffmpeg by dsh-media's rules — DSH_MEDIA_FFMPEG, then PATH, then $DSH_HOME/dsh-media/bin/<platform>-<arch>/ — and prepends that directory to the child's PATH. It reads the same variables instead of importing dsh-media's files, because a bundle may not import another bundle's files.

Subcommands that are never run: skills, events, auth, share, publish, cloud, lambda, cloudrun, tts, models, capture, browser ensure, init (it writes AGENTS.md/CLAUDE.md and installs skills). Renders run locally only.

The rest of the house rules. argv arrays, never a shell; cwd is the project; a deadline with a tree kill; every output path resolves inside the session workspace or an allowRoot given for that call; HF_TOOL_CONTEXT set per call and its events read after exit; a JSON field this build renames is passed through verbatim, never reconstructed.

9. Risks, and what is done about each

Risk Reality Response
The CLI is absent Measured today a0 works; anim_status names npm install -g hyperframes and stops
Render time 10 s at 1080p30 = 300 headless seeks + an encode; looks is CRF 16 draft for iteration, looks once, delivery for the master; 4K/60 are never defaults
A font fetch The compiler fetches Google Fonts for weights its bundled families lack name bundled families only; a local woff2 for anything else; the answer says when a fetch could happen
Byte-exactness "Fonts and Chrome versions differ, so a local render can shift by a pixel" claim deterministic given the same engine and fonts, never "identical everywhere"; --docker named as the exact path, not driven
The 16 MB composition cap Documented error COMPOSITION_TOO_LARGE media and data live in assets/, referenced by path
JSON drift in a young CLI Findings' inner keys are not documented read ok + counts, pass the rest through; anim_status records the version
Node floor node_version_unsupported below 22 reported by anim_status, not retried
Two browser commands at once The CLI takes .hyperframes/project.lock project-lock.waitMs below our own deadline

10. Phases, each with an acceptance criterion

Phase What Accepted when
P0 package skeleton, anim_status, the tracked check the check reaches a0 / "CLI missing" on this machine today, with no CLI installed
P1 anim_new, anim_scene, three committed examples (a CSV bar reveal; an SVG mechanism from dsh-diagrams; an equation + labels from TikZ) each example is a0 offline and carries caption.md
P2 anim_check, anim_snapshot, HF_TOOL_CONTEXT a real contact sheet comes back as a picture, and a deliberately broken scene returns its finding with the frame and the source snippet
P3 anim_render, ffprobe facts, provenance needs the CLI installed; the MP4's duration/fps/size are read back with ffprobe and match
P4 the Frames tab (storyboard, findings, the still at any time), two reserved routes the tab draws a contact sheet the agent just made
P5 skills (hyperframes-composition, hyperframes-motion, scientific-animation), .dsh-version.json, installers, README check-node-routes.mjs, check-client-bundles.mjs, check-no-secrets.mjs green

What is deliberately not built: a screen recorder; a renderer; a vendored copy of @hyperframes/* (a Node dependency tree plus a browser); a composition editor (hyperframes' own preview is better than anything written here); cloud rendering; sharing; auth; TTS.

11. Decisions this plan needs from the user

  1. Install the CLI? npm install --global hyperframes on this machine would make P3 provable. Without it the package ships honest and stops at a2.
  2. The framing — is the deliverable a scientific moving figure with a citable still and variants (this plan), or social/marketing clips (a different skill set)?
  3. The tab — tools first and the Frames tab in a later pass (the dsh-screenshot precedent), or the tab in the same pass?
  4. One package or two — dsh-hyperframes recommended; a separate dsh-recorder is the duplication argued against in §1.

12. Files this would add

packages/dsh-hyperframes/package.json           (zero dependencies, node >=22)
packages/dsh-hyperframes/cordis.patch.yml
packages/dsh-hyperframes/lib/index.js           the row: one activation line, tools registered
packages/dsh-hyperframes/lib/cli.js             resolve the binary, argv builder, spawn, deadlines
packages/dsh-hyperframes/lib/env.js             the env policy of §8 + the ffmpeg PATH prepend
packages/dsh-hyperframes/lib/project.js         anim_new / anim_scene: the template and the scene writer
packages/dsh-hyperframes/lib/report.js          lint/check/snapshot/doctor JSON readers + the rung ladder
packages/dsh-hyperframes/lib/tools.js           the six tools
packages/dsh-hyperframes/checks/check-hyperframes.mjs
packages/dsh-hyperframes/skills/…               three skills, every example parsed by a check
packages/dsh-hyperframes/README.md              one page
.dsh-version.json                               one entry