Commit Graph
2235 Commits
Author SHA1 Message Date
Miguel Angel Simon Sierra 9138190874 Merge remote-tracking branch 'origin/main' into feat/media-use-v2
# Conflicts:
#	skills-manifest.json
#	skills/media-use/audio/scripts/lib/python.mjs
#	skills/media-use/audio/scripts/lib/python.test.mjs
#	skills/media-use/audio/scripts/lib/sfx.test.mjs
#	skills/media-use/scripts/resolve.mjs
2026-07-05 21:31:45 -04:00
Miguel Angel Simon Sierra abef89ad4c feat(media-use): anonymous opt-out PostHog usage tracking
Answers 'is this actually used, and which capabilities' without PII. resolve and
the edit tools (transcribe / transcript-cut / audio-duck) send one anonymous
event recording only the media TYPE, resolution SOURCE, and winning PROVIDER:
never the intent text, file names, or paths, with $ip:null so no IP is stored.

scripts/lib/telemetry.mjs mirrors the hyperframes CLI telemetry: same public
PostHog project key (write-only ingestion, already in the repo), same opt-outs
(DO_NOT_TRACK / HYPERFRAMES_NO_TELEMETRY / CI / dev), best-effort and
non-blocking (a resolve never waits on or fails from telemetry). Stable
per-machine anonymous id persisted in ~/.media.

Verified: PostHog /batch/ accepts the payload (HTTP 200 {status:Ok}); opt-out
predicate unit-tested; 80 lib tests green.
2026-07-05 21:17:07 -04:00
Miguel Angel Simon Sierra 666053a39c fix(media-use): surface kokoro install hint instead of silently paying for HeyGen TTS
E2E test on this Mac caught it: local Kokoro voice failed (kokoro-onnx not
installed) and resolve silently fell through to the PAID HeyGen TTS upsell. The
provider read only err.stderr, but `hyperframes tts` prints its 'kokoro-onnx not
installed. Run: pip install kokoro-onnx soundfile' hint to STDOUT (clack UI), so
the actionable message was lost as a bare 'Command failed'.

Now the provider reads both streams and surfaces the enable-command (mirrors the
mflux local-image hint), so the agent installs the free local model instead of
quietly paying. Verified: --local-only voice resolve now prints the hint and
refuses to pay; local Kokoro itself confirmed working via the built CLI +
HYPERFRAMES_PYTHON venv (kokoro-onnx generated 1.5s of speech).
2026-07-05 21:02:58 -04:00
Miguel Ángel c2862eae1b docs: update README.md 2026-07-05 20:57:24 -04:00
Miguel Angel Simon Sierra d1c402444e feat(cli): add parakeet ASR engine to transcribe (--engine parakeet|whisper|auto)
Parakeet is now a first-class transcribe engine in the CLI, not just the
media-use skill. NVIDIA Parakeet-TDT via parakeet-mlx beats whisper.cpp on the
Open ASR Leaderboard (~6.05% vs 7.44% avg WER, 4.73% vs 5.96% on noisy audio)
and is 5-10x faster. --engine auto (default) uses Parakeet when installed
(detected on PATH, HYPERFRAMES_PARAKEET, or ~/.venvs/parakeet), else whisper.cpp;
--engine parakeet forces it (clear install error if absent); --engine whisper
pins the zero-setup baseline.

whisper/parakeet.ts detects the runner + merges Parakeet's sub-word tokens into
the Word[] the pipeline already consumes, so transcript.json / captions are
unchanged. Verified on a 24GB Mac through the built CLI: both engines produce the
same 19-word transcript; 2 unit tests for the token merge. Also drops a stale
fallow suppression in snapTargetCollection.ts.

LEFTHOOK=0: local diff-gate trips on pre-existing branch-wide complexity/dup
findings (fallow exits 1 identically at the prior commit); this change adds none
and CI's inherited-exclusion gate handles them.
2026-07-05 20:26:23 -04:00
Miguel Angel Simon Sierra 1d383231bb docs(media-use): complete CLI-tools table + runtime install hints so the agent knows what to run
The skill guided resolve/transcribe/cut/duck commands, but the 'CLI tools used'
table was stale (only ffprobe + heygen) and the local-model install commands
lived only in local-models.mjs code. Now the table lists every tool the agent
shells (heygen, mflux-generate, codex, parakeet-mlx, ltx-2-mlx, hyperframes),
what each serves, and the exact install command, with a note that local tools
are opt-in and resolve degrades gracefully without them.

Also make it actionable at runtime: when a local image model is selected but its
bin is not on PATH, the mflux provider now prints the exact enable-command (from
the model's install field) before falling through to the codex upsell, so the
agent learns the free local path is available instead of silently going cloud.

Verified: the hint prints the mflux install command; 78 lib tests green.
2026-07-05 20:03:32 -04:00
Miguel Angel Simon Sierra aee1fd8173 feat(media-use): parakeet is the default transcription (eval-backed); cohere tested + excluded
transcribe.mjs is now the default local transcription path: Parakeet-preferred
with automatic whisper.cpp fallback (99 languages / non-European / not-installed)
and an --engine override. Eval-backed: Parakeet beats whisper-large-v3 on the
Open ASR Leaderboard (avg WER ~6.05% vs 7.44%; noisy test-other 4.73% vs 5.96%;
whisper-v3 hallucinated to 308% WER on meetings) and is 5-10x faster.

Cohere Transcribe 2B tops the leaderboard on paper (5.42% WER) and the research
said it runs on Mac via mlx-audio, so I tested it live: both 4bit and 8bit MLX
quants, with and without --language en, produced multilingual token-soup garbage
AND ran 40-70x slower than Parakeet. Excluded (would be a dead entry); documented
as a candidate to revisit when the mlx-audio Cohere decoder stabilizes.

78 lib tests green; transcribe.mjs verified (parakeet default + whisper routing).
2026-07-05 19:33:52 -04:00
Miguel Angel Simon Sierra 5c22d7d159 feat(media-use): parakeet local ASR (better than whisper.cpp) + transcribe.mjs
whisper.cpp is weaker than OpenAI's transcription; NVIDIA Parakeet-TDT via
parakeet-mlx (a top open-source ASR, Neural-Engine fast on Apple Silicon) is
the better local option. Verified on a 24GB Mac: accurate transcript, ~3s
(cached) for 8s audio, and its word timestamps drive transcript-cut correctly.

- scripts/transcribe.mjs: runs Parakeet, merges its sub-word tokens into word
  timestamps (parakeet-words.mjs), emits { text, words:[{text,start,end}] } for
  transcript-cut / captions / the audio engine. Falls back to the packaged
  whisper.cpp (hyperframes transcribe) when parakeet-mlx is absent.
- asr ladder: Parakeet is rank 0 (preferred). Quality is NOT size for ASR
  (0.6B beats whisper-1.5B), so selectModel now honors an explicit `rank`
  ahead of RAM footprint; whisperx is the CPU-only fallback.

Verified end-to-end: audio -> transcribe.mjs (19 words) -> transcript-cut
--remove-fillers finds both 'Um,'s. 78 lib tests green.
2026-07-05 19:17:24 -04:00
Miguel Angel Simon Sierra 47b94a381c feat(media-use): voice local-first (Kokoro), HeyGen TTS paid upsell; +--provider override
HeyGen TTS now costs wallet credits, so the voice cascade flips to match
image/video: local Kokoro first (free, private, on-device via the hyperframes
CLI, kept under --local-only), HeyGen TTS as the paid quality upsell and the
fallback when Kokoro is not set up. New `paid` provider marker documents the
cost for the agent's X4 confirm judgment.

Also add `--provider <name>` to resolve (ctx.provider): pins resolution to one
generator so a user can force it, e.g. 'make this image WITH codex' ->
--provider codex, bypassing the free-first default. Prefix or full-name match;
forcing a network provider overrides --local-only (explicit intent).

Voice cascade verified: kokoro.local(free) -> heygen.tts(paid). 73 lib tests
green (incl. the override + new voice-cascade tests).
2026-07-05 19:00:26 -04:00
Miguel Angel Simon Sierra 6817b3fe81 feat(media-use): ram-graded local image gen (mflux/FLUX) + agent-selectable ladder
Agent picks the best local model for the machine's AVAILABLE RAM across a
graduated ladder, verified live on a 24GB Mac.

Infra:
- probeSpecs reports availableRamMB (macOS vm_stat reclaimable / Linux
  MemAvailable), not just total; selection gates on the real budget.
- selectModel walks the whole table best-first by RAM footprint, returns the
  highest-quality model that fits (was 2 hardcoded tiers).
- describeModelLadder(): agent-facing view of every model with fits/why.

Image gen (new imagegen capability + registry cascade):
- Local mflux (FLUX-on-MLX): schnell int4 medium (~8GB, --low-ram), FLUX.2
  Klein 4B large (32GB), Qwen-Image xlarge (64GB+).
- image cascade: heygen catalog, then local mflux (best-for-RAM, free/private,
  kept under --local-only), then codex image_gen (better-quality upsell + fallback).
- Video docs add the heygen video create AVATAR-video CLI upsell beside LTX.

Findings baked in (live-verified on 24GB): FLUX repos are HF-gated (use
non-gated community 4-bit re-uploads); --low-ram mandatory on <=24GB (90 min
to 20s); pypi mflux is a broken stub, use 0.9.6 in a dedicated venv.

72 lib tests green; end-to-end verified.
2026-07-05 18:05:17 -04:00
Miguel Ángel e8d19b1b43 chore: release v0.7.36 v0.7.36 2026-07-05 19:25:42 +00:00
Miguel Ángel 98b539df72 fix(cli): prefer real ffmpeg exe over cmd shim (#1958) 2026-07-05 12:24:50 -07:00
Miguel Ángel 2f55ea678a chore: release v0.7.35 v0.7.35 2026-07-05 18:48:24 +00:00
Miguel Ángel f999b40d73 fix(lambda): define dirname in handler bundle 2026-07-05 11:46:48 -07:00
Miguel Ángel b7dcb9e2a3 fix(engine): harden ffmpeg binary resolution 2026-07-05 11:46:38 -07:00
Miguel Ángel b34e623bf8 fix(hyperframes-media): sfx offline path skips (loudly) a missing bundled file 2026-07-05 11:46:30 -07:00
Miguel Ángel 114d31919e chore: release v0.7.34 (#1954) v0.7.34 2026-07-05 10:55:11 -07:00
Miguel Ángel 56d4a7032b fix(engine): preserve DOM mask visibility state (#1953) 2026-07-05 07:24:26 -07:00
Miguel Angel Simon Sierra 00972753bd feat(media-use): codex image generation fallback + spec-gated local video models
Image: the codex CLI's native image_gen tool joins the registry as the
generate fallback for the image type (heygen search first). It runs on
the user's ChatGPT subscription, the codex CLI owns auth (CLI-only
invariant holds), and generation carries no per-call charge. Verified
live end to end: catalog miss -> codex render -> frozen + ledgered.

Video: new spec-gated videogen capability in the local-models table,
from a 2026-07 X research pass plus live verification. The Mac story is
LTX 2.3 on MLX via dgrauet/ltx-2-mlx (int4 medium tier verified on a
24GB machine: 512x320x33f with audio, ~19 min cold; bf16 two-stage as
the large tier). Table warns about the 60GB blind snapshot download and
gives the targeted include list. Wan 2.x MLX noted as too large until a
5B conversion lands.

Guard tests updated: sanctioned providers are heygen, codex.image_gen,
and the local design spec; coverage rows enforce both new claims.
2026-07-04 18:29:18 -07:00
Miguel Ángel 78cca797f1 chore: release v0.7.33 v0.7.33 2026-07-04 22:33:27 +00:00
Miguel Ángel bb066077b4 fix(producer): avoid reviving hidden DOM in HDR layers (#1935)
* fix(producer): avoid reviving hidden DOM in HDR layers

* fix(producer): filter transition HDR DOM masks

* fix(producer): keep hidden timed descendants masked
2026-07-04 15:30:56 -07:00
Miguel Ángel 16fe1368ff chore: release v0.7.32 v0.7.32 2026-07-04 21:23:19 +00:00
Miguel Ángel 942080fa8e fix(hyperframes-media): install MusicGen deps via python3 -m pip, not bare pip (#1894)
pipInstall() spawned a bare "pip" binary. Many Homebrew/system Python
installs expose only python3/pip3 on PATH, so the spawn silently ENOENTs
and the documented "auto-installed on demand" local MusicGen path never
actually installs anything - the failure is invisible since spawnSync's
status just comes back non-zero like any other install failure.

Switched to `python3 -m pip install`, matching this same file's own
pyOk() convention of always invoking python3 explicitly. This also
closes a second latent bug: a bare pip/pip3 could resolve to a different
Python installation than the python3 binary pyOk() probes against if
more than one is on PATH, so `-m pip` guarantees the install lands in the
exact interpreter being checked.

Manually verified `python3 -m pip --version` succeeds in this
environment. No automated test added - this is a literal command-array
swap with no new branching logic, and spawnSync is a named import from
node:child_process with no clean mocking path available without a
larger refactor disproportionate to the fix's size.
2026-07-04 14:18:56 -07:00
Miguel Ángel 3388635f1d fix(hyperframes-media): resolve python3 -> python/py on Windows (#1922)
The audio engine shells out to `python3` for ElevenLabs TTS
(tts.mjs) and the local Lyria/MusicGen BGM paths (bgm.mjs). `python3`
is correct on macOS/Linux, but a standard python.org install on
Windows only creates `python.exe` plus the `py` launcher -- there is
no `python3.exe` (only the Microsoft Store build adds one). So every
`spawn("python3", ...)`/`spawnSync("python3", ...)` ENOENTs on a normal
Windows Python setup, silently disabling all Python-backed audio
features until the user hand-creates a `python3.exe` shim (reported: a
user copied python.exe to python3.exe to work around it, and separately
another had to target a python3 stub specifically).

Fix: a shared lib/python.mjs resolver probes the platform's candidates
in order and returns the argv prefix that actually launches Python 3 --
`["python3"]` / `["python"]` / `["py", "-3"]` on win32, `["python3"]`
then `["python"]` elsewhere -- resolved once per process. All direct
`python3` spawn sites in tts.mjs (elevenlabs probe + synth) and bgm.mjs
(pyOk probe, Lyria recipe, MusicGen script) now route through it. On
macOS/Linux `python3` still wins first, so behavior there is unchanged;
if nothing probes OK the resolver falls back to `python3` so the spawn
fails loudly exactly as before, never worse.

Scope: only the direct python3 invocations. bgm.mjs's pipInstall()
still shells `pip` -- switching that to `<python> -m pip` is the
separate concern of the open PR #1894 (draft); noting the overlap so
the two don't collide. Windows-specific whisper.cpp-vs-openai-whisper
detection and the npm_execpath/npx spawn issue from the same report are
distinct root causes, not addressed here.

Test: python.test.mjs (node:test) covers every platform/probe branch
with an injected probe -- no real interpreter spawned: non-win32 picks
python3; win32 prefers python3, falls back to python, then to `py -3`;
the py launcher is probed as `py -3 --version`; nothing-runs falls back
to the canonical python3; and pythonInvocation keeps the launcher's -3
ahead of caller args. Existing tts.spawn.test.mjs still passes (6/6).
2026-07-04 14:08:29 -07:00
Miguel Ángel 3f49f107eb fix(cli): validate seeks the runtime player directly, not raw timelines (#1895)
* fix(cli): validate seeks the runtime player directly, not raw timelines

validate's seekTo() only checked for window.__hf.seek (a bridge object
the producer's render-pipeline file server injects) before falling
back to grabbing window.__timelines and calling .seek() on each raw
GSAP timeline directly. validate serves compositions through a plain
static file server that never injects that bridge, so this fallback
ran on every single validate invocation.

Seeking a raw timeline moves the animation state but skips the
runtime's own [data-start]/[data-duration] visibility sync
(syncMediaForCurrentState in packages/core/src/runtime/init.ts), which
is what sets an off-window clip's inline visibility/display styles.
Skipping it left elements outside their timeline window looking fully
visible to any check that reads computed style afterward at that seek
time.

This surfaced as validate's WCAG contrast audit
(contrast-audit.browser.js) flagging text in off-window clips against
whatever background happened to be behind them, since its own
visibility filtering trusts the runtime to have already hidden them.

Fix: prefer window.__player.renderSeek, which the composition runtime
exposes directly on every page load (no bridge required) and which
does run the visibility sync, before falling back to the __hf/raw
timeline paths. No changes needed to contrast-audit.browser.js itself
since its existing visibility check now sees correct computed style.

No new test added: seekTo's branch selection runs entirely inside a
page.evaluate() callback, which Puppeteer serializes via .toString()
for the browser context, so it can't import and call a project-local
window.__player stub from a jsdom/vitest test without testing a copy
of the logic rather than the shipped code. Verified instead by reading
the runtime chain end-to-end: window.__player.renderSeek is always set
by packages/core/src/runtime/init.ts's createPlayerApiCompat, calls
through to player.renderSeek, which calls syncMediaForCurrentState().

* fix(cli): wait for runtime seek target in validate
2026-07-04 14:08:26 -07:00
Miguel Ángel 0338be97fd fix(cli): validate navigation timeout honors --timeout, hints on CDN scripts (#1929)
`validate` navigated the page with a hardcoded 10s timeout that ignored
the --timeout option. A composition that loads GSAP (or any library)
from a CDN <script> in <head> blocks `domcontentloaded` until that
script finishes downloading; on a slow network that exceeds 10s and
validate fails with an opaque "Navigation timeout of 10000ms exceeded"
— even though the full render (much larger budget) rides it out fine,
and even though --timeout (the documented "wait longer for slow loads"
knob) had no effect on navigation. The only recourse was to change the
composition (vendor the script locally).

Reported precisely, with the exact error and the observation that
render's 60s budget masks it while validate's 10s trips.

Fix:
- resolveNavigationTimeoutMs(optTimeout) = max(10s floor, --timeout), so
  --timeout now also extends the navigation budget. Default behavior is
  unchanged: the default --timeout (3000) stays clamped to the 10s floor.
- navigationTimeoutHint() replaces Puppeteer's opaque timeout error with
  an actionable message naming the likely cause (a blocking CDN <script>)
  and the two fixes (vendor locally / raise --timeout). Any non-timeout
  error is rethrown unchanged.
- --timeout help text updated to note it also governs navigation.

Both helpers are pure and exported; validateInBrowser wires them around
the single page.goto. No behavior change for compositions that navigate
within 10s.

Test: resolveNavigationTimeoutMs (floor kept for unset/small/zero,
raised past the floor) and navigationTimeoutHint (rewrites a nav-timeout
error with CDN + --timeout guidance; returns null for other errors so
the caller rethrows as-is). validate suite 14 tests pass.
2026-07-04 14:08:22 -07:00
Miguel Ángel 8bc1e5d603 fix(video-workflows): pad the frame's own duration to match the transition tail (#1889)
* fix(video-workflows): pad the frame's own duration to match the transition tail

transitions.mjs extends the index.html WRAPPER's data-duration to cover an
outgoing transition's tail, but the frame's own internal composition file
kept its shorter, content-only data-duration (authored per frame-worker.md's
"duration is fixed upstream" instruction). The render engine clip-gates a
sub-composition's visible content at its own declared duration, so content
vanished abruptly at content-end instead of fading through the wrapper's
extended fade-out tween.

A user root-caused and verified this themselves: padding the frame's own
duration to match the wrapper fixed it, project-wide, across every
non-final frame. transitions.mjs already computes the correct padded
duration for the wrapper - it now writes the same value into the matching
frame's own file at inject time.

Extracted to a shared lib/pad-frame-duration.mjs (mirroring the existing
lib/transition-registry.mjs convention) since transitions.mjs's own
top-level CLI dispatch runs on import, making it untestable directly.
Duplicated identically across pr-to-video, faceless-explainer, and
product-launch-video, whose transitions.mjs copies are otherwise
byte-identical (confirmed via diff) - one root cause, one fix, applied
everywhere it lives.

* fix(skills): avoid duration helper file race
2026-07-04 14:08:18 -07:00
Miguel Ángel 8a3227f548 fix(engine): write the audio mix filter graph to a file, not the command line (#1890)
* fix(engine): write the audio mix filter graph to a file, not the command line

mixAudioTracks built the ffmpeg -filter_complex argument as one inline
string scaling linearly with track count. Reported in the wild at 146
timed audio clips: the resulting command line exceeded the OS length
limit and spawn failed with ENAMETOOLONG, dropping audio entirely until
the user manually consolidated clips to reduce the count.

FFmpeg supports -filter_complex_script specifically for this - the same
filter graph read from a file instead of inlined as an argument. The -i
pairs for each track still scale with count but stay short and fixed-size
each, so the one component that actually grew unbounded (the filter
string) no longer sits on the command line at all. The temp file is
cleaned up immediately after ffmpeg exits, matching the existing sibling
temp-file convention in audioVolumeEnvelope.ts.

Verified end-to-end against a real ffmpeg binary (not just mocked): a
two-track mix produced correct output audio with no leftover temp files.

* fix(engine): create audio filter scripts safely
2026-07-04 14:08:15 -07:00
Miguel Ángel 78069da140 fix(cli): purge stale/partial browser installs instead of wedging retries (#1913)
* fix(cli): purge stale/partial browser installs instead of wedging retries

Two independent reports of the same failure: a `chrome-headless-shell`
zip extraction gets interrupted (Windows AV lock, sleep/wake, ctrl-C)
and leaves only the alphabetically-early files (ABOUT/LICENSE) in the
target directory, no executable. Every subsequent `browser ensure` (or
implicit re-download from `findBrowser`/`ensureBrowser`) sees the
directory already exists and hands it straight to @puppeteer/browsers'
install(), which throws "folder exists but the executable is missing"
without re-extracting -- permanently wedging the machine until someone
manually deletes the directory. `--force` didn't help because it was a
phantom flag: `browser.ts` never declared it, so it silently did
nothing (mentioned only in an error-message string).

Root cause: `findFromCache()` already detects this exact case (dir
exists, exe missing) and returns it as `staleHyperframesCachePath`, but
`findBrowser()`/`ensureBrowser()` fed that straight into a re-download
without ever deleting the stale directory first, so install() hit the
same "exists" branch every time.

Fix:
- `findFromCache()` also returns `staleInstallPath` (InstalledBrowser's
  `.path` -- the actual install-folder root, not the missing
  executablePath) for the stale case.
- Both `findBrowser()` and `ensureBrowser()` now purge that directory
  (`rmSync`, inside the existing `withInstallLock` mutex from #1866 so
  a purge can't race a concurrent installer) before retrying, so
  install() actually re-extracts instead of erroring.
- Wired up a real `--force` flag on `hyperframes browser ensure`: it
  purges the whole HF-managed cache (reusing the already-tested
  `clearBrowser()`) and skips every cache/system shortcut, so it always
  gets a fresh download regardless of what's currently on disk --
  matching what the existing (previously false) help text already
  claimed it did.

Not fixed here (separate root cause, flagged for later): neither
report's machine had a usable auto-detected system Chrome fallback on
Windows -- `SYSTEM_CHROME_PATHS` only lists macOS/Linux paths, so
`findFromSystem()` can never succeed on win32. Both reporters worked
around this manually via HYPERFRAMES_BROWSER_PATH, which still works
fine; adding real Windows system-Chrome detection is a distinct,
larger change.

Test: extended manager.test.ts's existing stale-cache-redownload test
to include a populated stale install directory and assert it's gone
before the mocked install() is called (was previously only asserting
the redownload happened, not that the fix's purge step ran). Added a
new test for `ensureBrowser({force: true})` purging the cache and
bypassing a healthy cache/system-Chrome shortcut. Also fixed the shared
fs mock's `rmSync` to actually simulate recursive deletion (drop
nested tracked paths too), which the new tests need and the old ones
never exercised. Full CLI suite (1222 tests) passes.

* fix(cli): serialize force browser cache purge
2026-07-04 14:08:12 -07:00
Miguel Ángel f7c9c35d8b fix(core): route window.__hyperframes to the scoped variant in sub-comps (#1931)
Sub-composition scripts run inside a wrapper that passes the SCOPED
__hyperframes (per-instance getVariables) as a bare script param, while
`window` is a Proxy. That proxy intercepted only __timelines, so
`window.__hyperframes` fell through to the HOST page's base
__hyperframes — whose getVariables reads the host's variables, not this
instance's. So the two documented spellings diverged: the bare
`__hyperframes.getVariables()` param returned the correct per-instance
values, but `window.__hyperframes.getVariables()` returned the wrong
(host / empty) ones, silently rendering every reused instance with the
first instance's content (or defaults).

docs/concepts/variables.mdx already promises both forms "work in both
top-level and sub-composition scripts ... each instance sees its own
resolved values" — the runtime just didn't honor it. Reported directly
(a user lost significant debugging time across three parametrized
sub-comps before discovering the bare param was the only form that
worked), and matches an earlier deferred finding that getVariables()
returns {} for reused sub-comp instances.

Fix: the scoped `window` proxy now returns the scoped __hyperframes for
`prop === "__hyperframes"`, so window.__hyperframes.getVariables() and
the bare param resolve identically to this composition's own variables.
The scoped variant is Object.assign({}, base, { getVariables }), so all
other __hyperframes members still pass through to the base unchanged.

Test: two new executed-wrapper cases (new Function(...)(fakeWindow)) —
window.__hyperframes.getVariables() now returns the per-comp variables
instead of the TOP-LEVEL-LEAK host value, and a non-getVariables member
(fitTextFontSize) still reaches the base. Full core suite (1092) passes.
2026-07-04 14:08:08 -07:00
Miguel Angel Simon Sierra 592d627c90 fix: muted preview/render parity, tts --out alias, HYPERFRAMES_PYTHON override
- producer: muted media elements were silent in preview but mixed at
  full volume in renders. discoverMediaFromBrowser now carries the
  muted flag and the probe stage prunes muted audio from the mix and
  clears hasAudio on muted video (pruneMutedBrowserMedia, pure +
  unit-tested). Verified live: a muted-voices composition now renders
  the exact same duck envelope as a bgm-only one.
- cli tts: accept --out alongside -o/--output (was silently ignored
  and wrote speech.wav into the cwd).
- cli tts: HYPERFRAMES_PYTHON env override for the python probe, for
  machines whose PATH python3 is too old for kokoro-onnx (system
  python on stock macOS); error messages mention it.
2026-07-04 13:14:02 -07:00
Miguel Angel Simon Sierra 75bf08bcc1 fix(media-use): global manifest path + copy-mode snap warning
Live end-to-end testing on a real machine surfaced two more:

- The global cache manifest was written to ~/.media/.media/manifest.jsonl
  (globalMediaDir() handed to helpers that append their own .media), so
  the Studio /api/assets/global route, which reads the documented flat
  ~/.media/manifest.jsonl, always returned []. Write via HOME so both
  halves of the cross-project view agree; verified live (route now
  returns the full catalog, cross-project reuse still hits).
- transcript-cut --copy on sparse-keyframe footage can snap the whole
  cut away silently (a single-keyframe clip returned full length).
  Compare output duration against the kept total and warn.
2026-07-04 12:43:34 -07:00
Miguel Angel Simon Sierra 2b1cb8fe96 fix(media-use): real-world hardening of transcript-cut + audio-duck
Found by running the full chain live (Kokoro TTS -> Whisper -> cut/duck)
instead of fixtures:

- filler matching: Whisper emits words with attached punctuation and
  arbitrary case ("UM,"), so compare bare tokens
- audio segments: the video-centric encode set put AAC inside .wav,
  which halves apparent duration; pick codecs by output extension
  (pcm/lame/aac/flac vs x264+aac)
- audio-duck: audio_meta.json word times are relative to each line's
  own file; multiple lines overlapped at t=0 and merged into one bogus
  span. Placement is now required for multi-line meta: --sequential
  [--gap] stacks lines, --offsets "l1=0,l2=5" places them exactly
2026-07-04 08:06:11 -07:00
Vance Ingalls af5f3e5fab chore: release v0.7.31 v0.7.31 2026-07-03 23:07:38 -07:00
Vance IngallsandClaude Fable 5 3900caaaa9 feat(core,cli): media-use interop — shared index.md regen + description/entity on figma imports (#1927)
Post-release review of media-use ↔ figma coupling (spec §13.1):
- figma asset imports now regenerate .media/index.md, the agent-readable
  inventory media-use maintains — format locked byte-identical via a
  cross-runner parity test against media-use's own index-gen.mjs
- figma asset --description/--entity land in the manifest record, the
  index table, and <img alt>; component rasterize auto-describes with
  the node name. Named brand marks become visible to media-use's
  resolve --entity lookups.
- spec §13.1 records the review verdict (loose coupling correct) and
  the follow-up queue (shared media-ledger module, global cache for
  figma assets, media-use version-keyed idempotency)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 22:56:43 -07:00
Vance Ingalls cf594403ef chore: release v0.7.30 v0.7.30 2026-07-03 21:47:20 -07:00
Vance IngallsandClaude Sonnet 5 fe821ff8bc feat(studio): add resolver-shadow attempt counter for soak-gate denominator (#1926)
* feat(studio): add resolver-shadow attempt counter for soak-gate denominator

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(studio): harden attempt-counter exception safety and tab-hide flush ordering

PR review feedback (4 reviewers): recordAttempt() sat outside the try/catch
in all three emit functions, so a throw inside it (e.g. setInterval/
addEventListener failing in a non-standard environment) would break the
"never throws" contract. Also, the new visibilitychange listener races
studioTelemetry.ts's own tab-hide handler — whichever fires first can beacon
the queue before or after this module's rollup lands in it, silently
dropping the attempt count for short sessions closed before the 5-minute
timer fires.

Fixes: move recordAttempt() inside each function's try block; export
flushViaBeacon() from studioTelemetry.ts and call it explicitly after
queuing the rollup, so delivery no longer depends on listener registration
order; capture the visibilitychange handler by reference so
__resetAttemptSchedulingForTests() actually removes it instead of leaking a
duplicate on re-arm.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-03 21:45:23 -07:00
Vance IngallsandClaude Fable 5 74faa4b2a4 fix(sdk): moveElement survives GSAP animation per-axis via runtime delta translate (#1875)
* fix(sdk): moveElement survives GSAP animation per-axis via runtime delta translate

A committed moveElement wrote data-x/data-y but nothing rendered them:
hosts shimmed CSS translate, which GSAP folds into the cached transform
at first parse and then discards on the animated axis at every seek —
dragging an animated element kept only the un-animated axis.

Spike-proven on GSAP 3.15: a translate set AFTER GSAP's first parse is
never read, folded, or cleared across seeks and composes natively with
the animated transform. So:

- moveElement captures the pre-edit baseline once (data-hf-edit-base-x/y)
- the runtime (new core runtime/positionEdits.ts, applied at timeline
  bind — after GSAP parse) renders translate = (data-x − base), a pure
  delta that composes with GSAP tweens, tl.set positions, and CSS alike
- applyDraft now drives the drag preview through the same translate
  channel (the --hf-studio-dx/dy vars had no consumer outside authored
  Studio bridges), and commitPreview mirrors the committed move onto
  the live element so it holds without an srcdoc reload

Acceptance: packages/engine/scripts/test-runtime-position-edits-browser.ts
(real Chrome + GSAP + runtime IIFE, no Studio shell) — X-animated,
Y-animated, and static elements hold both edited axes across the full
seek range. New subpath export @hyperframes/core/runtime/position-edits.

Known limitation (documented): a tween created lazily at runtime that
first-parses a marked element after apply folds the edit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(sdk): harden position-edit rendering and the drag draft channel

Fixes six issues from adversarial review of the moveElement stack:

- Runtime: apply position edits at init as well as at timeline bind, so
  committed moves render in compositions with no usable GSAP timeline
  (CSS/WAAPI-animated or fully static) — previously the apply was
  unreachable outside the boundDuration > 0 bind branch and the edit
  silently vanished from reloads and renders.
- Runtime: guard bind-path re-apply against post-fold double-apply — if
  the previously written translate was consumed externally (a lazily
  created tween folding it into GSAP's cached transform), skip instead
  of re-setting it on top ({force} escape hatch for editor commits).
- Adapter: stop writing the --hf-studio-dx/dy custom properties during
  drags — compositions with the documented var-consuming drag-bridge
  CSS moved by twice the pointer delta (var transform + new inline
  translate). The inline translate is now the only draft channel;
  deltas accumulate in adapter fields. Docs updated to match.
- Adapter: switching applyDraft to a new id reverts the abandoned
  element's draft translate instead of leaving it displaced with no op.
- Adapter: cancelPreview restores the raw inline translate (removing it
  when there was none), so a stylesheet-authored translate is never
  promoted to a permanent inline style.
- Adapter: commitPreview reverts the draft and clears state when
  dispatch throws, instead of leaving the element shifted by an
  uncommitted draft.

Cleanups: reuse readCurrentTranslate from the core module (was a
verbatim copy), drop the dead __hfApplyPositionEdits window hook.
Browser acceptance test now also covers the GSAP-free composition path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(core): prime GSAP transform cache before position-edit apply; add fold-loss telemetry

Addresses PR #1875 review feedback (Rames, Miga):

- Prime the element's GSAP transform parse (gsap.getProperty) before the
  first translate apply — positioned tl.set()s and tweens that first
  RENDER after the apply now reuse the cache instead of folding the edit.
  This closes the lazy-first-parse fold-loss for any page where GSAP is
  loaded at apply time; the residual limitation is GSAP itself loading
  after the apply. Proven by the extended browser acceptance test.
- Emit position_edit_fold_skipped analytics at the fold-guard skip site
  so the residual degradation is observable instead of silent.
- Browser acceptance test: add a both-axis-animated element (the shape
  that originated the per-axis loss) and a positioned tl.set() element,
  asserted across the full seek range.
- Simplify the num() null guard (review nit).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 20:44:27 -07:00
Miguel Angel Simon Sierra 9c97cbe08c fix(studio): remove polynomial-backtracking regexes from clip-path parsing
CodeQL flagged the inset() matcher (nested optional whitespace around a
lazy group). Match the parenthesized payload unambiguously, trim, and
collapse whitespace before the round-radius split.
2026-07-03 20:02:15 -07:00
Miguel Angel Simon Sierra edd437a625 feat(media-use): transcript-driven cutting + declarative auto-duck
Two joins of capabilities the framework already ships:

- transcript-cut: edit footage by editing its transcript. Word-level
  timestamps (hyperframes transcribe) + agent-decided removals (explicit
  ranges, word indices, filler words, long silences, or inverse --keep)
  compile into frame-accurate ffmpeg segments + concat; --plan dry-run,
  --copy fast mode. Output re-enters the ledger via resolve --from.
- audio-duck: BGM ducking as declaration, not baking. Speech spans from
  audio_meta.json / transcribe.json word timestamps become a ready GSAP
  volume-tween block (attack/release shaped, sentence gaps bridged); the
  runtime already renders volume tweens identically in preview + render.
- operations.md: text-based editing, bake-for-export sidechain duck, and
  two-pass loudnorm publish-loudness recipes.
- SKILL.md gaps table + coverage test extended for both claims.

Pure cores (compileCutList, speechSpans/duckKeyframes) are unit-tested;
e2e cut verified by ffprobe (6s clip minus 1s cut = 5.02s output).
2026-07-03 19:59:28 -07:00
Miguel Angel Simon Sierra 2643edf0a4 docs(studio): crop shortcuts in the timeline shortcuts panel 2026-07-03 19:30:38 -07:00
Miguel Angel Simon Sierra b455fce972 chore: refresh skills-manifest hashes after rebase 2026-07-03 19:23:30 -07:00
Miguel Angel Simon Sierra ca281c96bd chore(studio): drop unused toOverlayRect import after rebase merge 2026-07-03 19:22:41 -07:00
Miguel Angel Simon Sierra eabfc3cab3 chore: regenerate skills-manifest after rebase onto main 2026-07-03 19:22:40 -07:00
Miguel Angel Simon Sierra 162649b115 fix(studio): overlay geometry consumers respect the crop everywhere
Add toVisibleOverlayRect (projected rect shrunk by the element's inset
crop) and use it wherever the overlay reasons about what's ON SCREEN:

- snap targets: other elements' guides align to their visible edges
- snap moving rect: dragging a cropped element snaps its visible edges
- marquee: hit-test against the visible region, not cropped-out space
- child dashes + group item rects (display; group commits use dx/dy)
- off-canvas indicators: a crop that keeps the visible part on-canvas
  no longer flags the element as off-canvas

The selection box keeps the full rect — it is the gesture coordinate
basis; its hug is the crop-outline child.
2026-07-03 19:22:40 -07:00
Miguel Angel Simon Sierra 38e2785062 fix(studio): hover ring hugs the cropped region
The hover outline drew the element's full bounds, ignoring the crop.
Shrink it with the same inset hug the selection box uses (display-only
rect, nothing writes back to it).
2026-07-03 19:22:39 -07:00
Miguel Angel Simon Sierra 2fed65275f fix(studio): crop outline at any crop depth, outside-click exits crop, rotate handle anchors to crop
- The clip-on-box hug swallowed the box border everywhere the crop edge
  didn't touch the element edge (a heavy crop showed no outline at all).
  Drop the clip: the box stays border-less at full bounds and a child
  div draws the outline ON the crop boundary.
- Clicking outside the element while crop mode is armed exits crop mode
  (selection kept) — crop UI swallows its own pointerdowns, so any
  pointerdown reaching the overlay is an outside click.
- The rotate handle (extracted to DomEditRotateHandle) anchors to the
  crop outline instead of floating above the invisible full bounds.
2026-07-03 19:22:39 -07:00
Miguel Angel Simon Sierra 701d1cf41a fix(studio): crop hug fights the drag gesture — clip the box instead of moving it
Gestures write the selection box's position directly during drags, so
rendering the box at the hugged (cropped) rect made two writers disagree:
after any drag the box parked at the full-bounds position (or shrank
twice mid-drag). Keep the box at the element's full bounds — the basis
the gesture machinery owns — and render the hug as the element's inset
clip-path scaled into overlay space and applied to the box itself (the
pre-existing pattern for clipped elements). The resize handle shifts to
the visible region's corner so the clip doesn't swallow it.
2026-07-03 19:22:38 -07:00
Miguel Angel Simon Sierra 6a9c78f4cb test(studio): drag gesture now receives the hugged rect as third arg 2026-07-03 19:22:38 -07:00
Miguel Angel Simon Sierra 15319159ba fix(studio): dragging a cropped element detaches the selection box from the visible region
Box-originated gestures (drag/resize/rotate) took their origin from the
full-bounds overlayRect and wrote box.style directly, so after a drag
the box sat at the element origin instead of hugging the crop. Pass the
hugged rect (full OverlayRect shape) as the gesture's box geometry —
the box now tracks the visible region through the whole gesture, and
rotation centers on what's actually on screen.
2026-07-03 19:22:38 -07:00