Commit Graph
2194 Commits
Author SHA1 Message Date
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
Miguel Angel Simon Sierra 0c8d84fc5c feat(studio): drag the crop window itself
The crop frame is now a drag surface: dragging it slides the whole
visible region — opposing insets shift together so the crop size stays
constant, clamped inside the element bounds. Same commit path as the
edge handles (one undo step per drag).
2026-07-03 19:22:37 -07:00
Miguel Angel Simon Sierra cbde03d5f5 feat(studio): pro-editor crop UX — toolbar button, double-click, crop-line handles, dim, hug
Crop mode now behaves like an NLE crop tool:
- Canvas toolbar gets a Crop button (shown whenever a croppable element
  is selected); crop mode lives in the player store so the toolbar, the
  Clip panel, and the overlay share one switch.
- Double-click a selected element to enter crop mode (timestamp-based:
  selection re-keys the box on every click, so native dblclick never
  fires); Escape exits.
- While cropping, the element's clip is lifted so the full content stays
  visible; the cropped-out region is dimmed and a crop frame with edge
  handles sits ON the crop lines (handles track the insets as you drag).
- Drag end commits through the normal style path (one undo step per
  drag); leaving crop mode re-applies the committed crop.
- Outside crop mode the selection box hugs the visible cropped region
  instead of the full element bounds.
2026-07-03 19:22:37 -07:00
Miguel Angel Simon Sierra 67e08d575c feat(studio): non-destructive crop via clip-path inset (OP2)
Crop a selected element visually: a Crop toggle in the Clip panel arms
edge handles on the overlay; dragging live-previews clip-path inset on
the iframe element and commits once through the existing inline-style
patch path (undo/persist like any style edit). Per-side T/R/B/L inset
fields join the Clip section; radius is preserved, insets clamped.
Render-time only: the media file is untouched.

Clip-path helpers move to clipPathHelpers.ts (re-exported) with 1- and
4-value inset parse/format support.
2026-07-03 19:22:37 -07:00
Miguel Angel Simon Sierra 80a819f24f refactor(media-use): drop the Iconify stub + flag-gating machinery
With fal/ElevenLabs gone and Iconify never enabled, every provider is
always-on heygen (or the local design spec) — remove the envFlag/gated
enablement layer entirely. The guard test now asserts only heygen /
design_spec providers exist.
2026-07-03 19:22:37 -07:00
Miguel Angel Simon Sierra dc8b43c74b refactor(media-use): heygen CLI only — drop fal/ElevenLabs adapters and --allow-paid
Remove the third-party CLI adapters (fal via genmedia, ElevenLabs via
elevenlabs-cli) and the paid-provider cost guard entirely; the heygen
CLI is the only external CLI media-use shells. --local-only stays. A
guard test asserts no fal/elevenlabs provider can silently return.
2026-07-03 19:22:36 -07:00
Miguel Angel Simon Sierra 1145ec5d9e docs(media-use): apply Wenbo's 06-29 review (cost + local-model stance)
- Cost: paid generation is the agent's call, no user-confirmation prompt
  (free-first still tries cache + heygen before anything paid).
- Local models: heygen free-usage is the default (TTS, bg-removal via the
  heygen CLI); local open-source is the opt-out fallback only ('if user no,
  then local'), not the headline answer. Coverage test description updated to
  match while still asserting the fallback table is populated.
2026-07-03 19:22:36 -07:00
Miguel Angel Simon Sierra 6cf8c8d8ed docs(media-use): attribute transcription + bg-removal to the hyperframes CLI
The 'When to use' line credited transcription and background removal to the
audio engine; they actually come from the hyperframes CLI (transcribe,
remove-background), as the audio-engine section already states. The engine
itself does TTS / BGM / SFX / caption timing.
2026-07-03 19:22:36 -07:00
Miguel Angel Simon Sierra 6c44b86aba fix(media-use): correct fal + ElevenLabs adapters to their real CLIs
Verified against the official docs (not guessed --help):
- fal: use the genmedia CLI (genmedia run <model> --prompt .. --download .. --json
  -> downloaded_files[].path/url), not 'fal run --input'. The pip 'fal' is the
  serverless-deploy CLI and can't run hosted models.
- ElevenLabs: the official @elevenlabs/cli is agents-only (no TTS). Use the
  community elevenlabs-cli (tts "<text>" --output <file>): positional text, file
  output. Both download a local file, returned as localPath for freezing.
SKILL providers section now names the correct binaries + install/auth. Live
generation still needs FAL_KEY / ELEVENLABS_API_KEY (absent here).
2026-07-03 19:22:36 -07:00
Miguel Angel Simon Sierra 686b0486ec docs(media-use): list voice in the resolve Types table 2026-07-03 19:22:36 -07:00
Miguel Angel Simon Sierra d9417cdd46 fix(media-use): wire HeyGen TTS to the real CLI surface (m8)
The voice provider guessed 'heygen voice tts --text', which the CLI rejects.
Real command (verified against heygen v0.1.6 --help / --response-schema):
'heygen voice speech create --text <t> --voice-id <id>' returning data.audio_url
+ data.duration. Default voice-id = first starfish-engine voice (deterministic,
overridable via ctx.voiceId). Verified live: a default voice resolve now produces
a real audio file with no --allow-paid. Registry header no longer calls fal/voice
flag-gated seams — they are live; Iconify is the only remaining gated provider.
2026-07-03 19:22:36 -07:00
Miguel Angel Simon Sierra 97bf39f022 docs(media-use): correct doc-rot surfaced by the eval
- voice cascade in SKILL now reflects free HeyGen TTS first, ElevenLabs paid fallback
- --local-only documented as 'skip every network provider', not just paid
- drop the nonexistent 'organize --promote' CLI; promotion is automatic
- point the local-model row at the actual runner (local-run.mjs) without overclaiming auto-cascade
- operations.md: clip-path crop is a composition technique, not a shipped Studio feature
- SFX library is 19 files, not 21; usage.mjs no longer claims it powers the Studio filter
- clarify the faceless/pr-to-video audio adapters intentionally reuse the product-launch model
2026-07-03 19:22:35 -07:00
Miguel Angel Simon Sierra b03c28c42e fix(media-use): stream freeze cap + SSRF guard + drop cached_path from API
M1: freezeUrl streams the body and aborts at the 256MB cap (and checks
content-length first), so a hostile URL can't buffer past the cap into memory.
m11: isDirectMediaUrl rejects loopback/private/link-local hosts on --from ingest.
m13: /assets/global projects to public fields, no absolute cached_path to the browser.
2026-07-03 19:22:35 -07:00
Miguel Angel Simon Sierra ebc1f160c0 fix(media-use): voice resolves free-first via HeyGen TTS + honor --local-only
M2: heygen.tts is free and first in the voice cascade; ElevenLabs is the
paid fallback, so voice resolves by default without --allow-paid.
M3: --local-only now skips every network provider, not just paid ones.
2026-07-03 19:22:34 -07:00
Miguel Angel Simon Sierra f2957b2797 feat(studio): cross-project 'all projects' view in the asset tab (U24)
This project / All projects toggle in the Asset tab. The global view is a
self-contained GlobalAssetsView component (owns its /api/assets/global fetch +
render) — keeps AssetsTab under the file-size cap and lowers its complexity.
Lists the reusable cross-project cache (type + label); category/usage chips are
local-only; search filters both. globalAssetRows pure helper + 3 vitest.
Verified live in agent-browser: 'All projects' shows assets from ~/.media.
2026-07-03 19:22:34 -07:00
Miguel Angel Simon Sierra 39dfb4b81e feat(media-use): weakness-coverage matrix + test-enforced audit (U28)
SKILL.md gains a 'What it owns' matrix mapping each HyperFrames media gap to its
media-use entrypoint. coverage.test.mjs enforces every row — image/icon
providers, voice + audio engine, consolidated engine + bundled SFX, ops
reference, global cache + ingest, local-model tiers, every resolve type has a
provider — so a claim can't silently rot. 7 tests.
2026-07-03 19:22:34 -07:00
Miguel Angel Simon Sierra 7250f81d0e feat(studio-api): /api/assets/global route for cross-project assets (U24)
Non-project-scoped GET /api/assets/global reads only ~/.media/manifest.jsonl and
returns reusable records — the data behind the Studio Asset tab's cross-project
view. Skips malformed lines (torn write won't 500). Registered in createStudioApi
alongside the other route groups. 3 vitest. AssetsTab toggle next.
2026-07-03 19:22:33 -07:00
Miguel Angel Simon Sierra d8128be34e docs(media-use): absorb audio capabilities into SKILL (U23)
Frontmatter reframed to the full media OS (resolve/generate/operate/remember,
incl. voice + the audio engine). New Audio engine section documents
audio/scripts/audio.mjs, the request/meta contract, the auto-degrade switch, and
the relocated per-topic references (tts/bgm/sfx/transcribe/remove-background/
captions). A reader can now do everything hyperframes-media offered from
media-use alone.
2026-07-03 19:22:33 -07:00
Miguel Angel Simon Sierra 339817c519 fix(docs): dedup media-use rows + skill count after consolidation (U22)
Merge the two /media-use rows in the hyperframes router capability map into one;
fix the remaining 'all 19' install-count mentions in README/CLAUDE/skills.mdx →
18. Follow-on cleanup from the hyperframes-media retirement rename.
2026-07-03 19:22:33 -07:00
Miguel Angel Simon Sierra ea8979a18d refactor: retire hyperframes-media skill, fold into media-use (U22)
Delete the hyperframes-media skill (engine relocated in U20). Sweep all 32
referencing files → media-use: engine paths → media-use/audio/scripts, reference
links → media-use/audio/references, skill-name/routing mentions → /media-use.
Catalog dedup: drop the duplicate audio row from README/CLAUDE/skills.mdx (the
single media-use row now covers resolve + audio), router + hyperframes-core
domain list point to media-use, skill count 19→18. Manifest regenerated (18,
hyperframes-media gone). Grep gate clean (only plan docs reference it as history).
dist/ artifacts regenerate from source on build.
2026-07-03 19:22:33 -07:00
Miguel Angel Simon Sierra 8fad6acc9b fix(skills): repoint video skills + engine docs to relocated media-use/audio (U21)
faceless-explainer / pr-to-video / product-launch-video wrappers: DEFAULT_ENGINE
→ media-use/audio/scripts/audio.mjs (engine resolves from each, verified). Fixed
the relocated engine docs' stale self-paths (tts.md) + an inaccurate attribution
comment. Grep gate: no skills/ reference to hyperframes-media/scripts remains
(except general-video doc routing, swept in U22).
2026-07-03 19:22:32 -07:00
Miguel Angel Simon Sierra 6ef5e4e96b refactor(media-use): relocate audio engine from hyperframes-media (U20)
Move the audio engine (audio.mjs + lib + heygen-tts + wait-bgm + lyria-recipe +
bundled SFX + references) as a self-contained subtree into skills/media-use/audio/
via git mv — zero internal path edits (HERE/../assets/sfx + lyria offsets
preserved). CLI primitives still wrapped, not moved. Smoke test proves the
bundled SFX library resolves from the new location. hyperframes-media now holds
only SKILL.md (retired in U22).
2026-07-03 19:22:32 -07:00
Miguel Angel Simon Sierra deb19bdf84 feat(media-use): enable fal + ElevenLabs (Bin approved) + cost guard
Premise: Bin approved B-Q1 (voice/TTS) + B-Q2 (third-party CLIs). fal (bgm/sfx/
image generate) and voice (ElevenLabs + heygen tts) flip from gated to live,
marked paid. Cost guard (X4) ships with them: runProviders skips paid providers
unless ctx.allowPaid; resolve gains --allow-paid (opt-in) + --local-only (block).
Free heygen catalog stays first. Iconify stays gated (not named). SKILL providers
table + flags documented. Tests updated (43 green). Skill consolidation/deletion
(rest of #15) deliberately NOT done — separate, not implied by approval.
2026-07-03 19:22:31 -07:00
Miguel Angel Simon Sierra 7512659166 fix(studio): harden asset usedPaths matching (#13)
deriveUsedPaths extracted + hardened: element src is the raw authored value, so
it can be relative (assets/x.png), ./-prefixed, the served /api/.../preview/ form,
or carry a ?query — normalize all to the bare project path so it matches the
asset-list entries (the in-use badge / sort / filter all key on this). The prior
inline strip only handled the served form. Source stays usePlayerStore.elements
(correct — hydrated from the timeline/__clipManifest); not switched. +2 vitest.
2026-07-03 19:22:31 -07:00
Miguel Angel Simon Sierra 8f73aee229 feat(studio): in-use / unused filter in the Asset tab (#13)
Adds 'In use' / 'Unused' filter chips alongside the category filters, reusing the
existing usedPaths (composition references) the in-use badge + used-first sort
already compute. filterByUsage/countUsage extracted as pure functions + unit
tested (6 vitest). Chips show only on a real used/unused split (no misleading 0s).

Verified in agent-browser: Studio boots, project loads, Asset tab renders + filter
path runs. Note: chip display binds to usePlayerStore.elements (same source as the
existing badge); that store was empty in a synthetic dev project where the timeline
is driven by the iframe __clipManifest — confirm/realign usedPaths source in real
studio usage (follow-up; affects badge+sort+filter equally).
2026-07-03 19:22:30 -07:00
Miguel Angel Simon Sierra 9cf3edeb61 feat(media-use): media-ops guidance + process transforms (#12, #7)
references/operations.md: local-tool recipes (ffmpeg cut/reframe/montage,
auto-editor, scenedetect) + local-vs-HeyGen transform table (bg-removal/upscale/
lipsync/translate) with side-by-side guidance. Outputs register via --from
(auto-promoted). Per OP1, media-use guides to the tools rather than re-wrapping
ffmpeg/heygen as bespoke verbs.
2026-07-03 19:22:30 -07:00
Miguel Angel Simon Sierra c5556898e0 feat(media-use): ingest --from + brand upsell (#9, #10)
resolve --from <file|direct-url> freezes a user-supplied asset + registers +
auto-promotes it. isDirectMediaUrl rejects platform pages (no yt-dlp). brand
resolve with no frame.md/design.md now upsells the HyperFrames design flow
instead of a generic miss.
2026-07-03 19:22:30 -07:00
Miguel Angel Simon Sierra bc946e531b feat(media-use): auto-promote + global cache + search + in-use detection (#11, #16)
Auto-promote every fetched asset into the global content-addressed cache so it's
reusable across all hyperframes projects (cachePut now dedups by sha; resolve
promotes on register, non-fatal). search.mjs: paginated text search (no vector
DB). usage.mjs: tag/partition assets by in-use vs unused (scans compositions) —
powers the Studio Asset-tab filter.
2026-07-03 19:22:30 -07:00
Miguel Angel Simon Sierra ff86a811c6 feat(media-use): local-model runner (#4)
runLocalModel(capability) picks the best tier for the machine (selectModel),
checks the tool is on PATH, fills + runs its invoke template, returns the output
path — or a clear install/CLI recommendation when not runnable. Injectable
which/exec; never throws. Consumed by the process verb.
2026-07-03 19:22:30 -07:00
Miguel Angel Simon Sierra bff2343ed9 feat(media-use): flip-to-enable fal + voice adapters (#5)
fal aggregator + ElevenLabs/HeyGen-TTS voice providers built as real CLI
adapters, registered default-OFF and flipped on by env flag (MEDIA_USE_ENABLE_*)
read at call time. Bin's answer becomes a flag, not a code change. Tests prove
off-by-default + flip-on ordering (heygen stays first).
2026-07-03 19:22:30 -07:00
Miguel Angel Simon Sierra 675c892c84 feat(media-use): spec-gated local-model runtime (U2)
specs.mjs probes CPU/RAM/GPU/VRAM (Apple Silicon unified memory + nvidia-smi),
injectable for tests. local-models.mjs is a declarative table of user-installed
models per capability+tier (tts/asr/upscale) with size/needs/install/invoke;
selectModel picks the highest runnable tier or recommends the CLI path. No
license gate — models are user-installed, local-use-only.
2026-07-03 19:22:30 -07:00
Miguel Angel Simon Sierra a6ff74caf3 feat(media-use): provider registry contract (U1)
Ordered, capability-based registry — search/generate/process slots, tried
deterministically with heygen-CLI first. Disabled slots (fal aggregator,
Iconify, voice TTS, local) carry their gate reason (B-Q1/B-Q2/U2) so enabling
them later is a flag flip, not a refactor. resolve cascade now registry-driven;
providers.mjs kept as a back-compat shim. Regenerated skills-manifest.
2026-07-03 19:22:29 -07:00
Vance Ingalls a2677ca730 chore: release v0.7.29 v0.7.29 2026-07-03 19:15:25 -07:00
Vance IngallsandClaude Fable 5 566d49382c feat(skills): reroute /figma by capability - REST/CLI for phases 1-3, MCP for 4-5 (M4) (#1873)
* feat(skills): reroute /figma by capability - REST/CLI for phases 1-3, MCP for 4-5 (M4)

Rewrites the skill from MCP-first to the spec 2 split: asset/tokens/
component route through the hyperframes figma CLI (FIGMA_TOKEN), motion/
shaders stay agent-driven over MCP (no REST equivalent). Adds two-
credential guidance, Starter rate-limit tactics (recursive:true, raw-
response cache, opt-in screenshots), the 7.1 binding flow (tokens before
components, one ask per unknown library, never value matching), and the
shader manual-export default. Catalog blurbs updated in lockstep.

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

* fix(cli): register figma component subcommand

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

* feat(skills): add storyboard-to-animatic guidance to /figma

Field-tested against a real 26-scene storyboard section: the parsing
grammar (frame-sized nodes incl. loose rectangles = scenes, x-order =
time order, TEXT below the strip = director notes paired by x-overlap),
batched still export (chunk ~4 ids per render call - big frames timeout
past ~12), a note-verb -> transition vocabulary (EXPLOSION/SLIDE/MORPH/
CYCLE), and the stills-vs-component routing rule for within-scene motion
notes. Catalog blurbs updated in lockstep.

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

* feat(skills): storyboard frames are keyframes, not slides

Field-tested against a second real storyboard section: frames sharing an
element (matched by name, else geometry similarity) define that element's
states through time - tween the element between states, crossfade only
when pixels genuinely differ, enter/exit unmatched children, tween frame
backgrounds as a color track. Stills demoted to fallback for frames that
don't decompose. Validated live: a 4-frame logo-rise reconstructed as one
element with four keyframes.

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

* feat(figma): self-explanatory first-run experience + mintlify guide

- NO_TOKEN/BAD_TOKEN errors now carry the full one-time setup (mint URL,
  read-only scope checklist, persist hint) instead of a bare pointer
- figma subcommands print clean guidance on typed client errors, not a
  stack trace (shared withFigmaErrors boundary)
- CLI help gains component subcommand, FIRST-TIME SETUP and WHAT TO
  EXPECT blocks
- /figma skill: preflight the token before the first CLI call and walk
  the user through setup up front; narrate landed-artifact + next action
  at every step
- new docs/guides/figma.mdx (setup, per-phase walkthroughs, provenance,
  troubleshooting table) wired into docs.json nav

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

* fix(figma): review fixes — missing withFigmaErrors imports, 401/403 semantics, docs accuracy

- tokens.ts/component.ts called withFigmaErrors without importing it
  (tsup doesn't typecheck, so every invocation shipped as an immediate
  ReferenceError); imports added, tsc --noEmit now clean
- error boundary widened to all Errors so bad-ref/bad-format input
  errors print their message instead of a stack trace
- 401 no longer claims 'missing scopes' (figma signals that as 403);
  new FORBIDDEN code maps non-variables 403 to scope/access guidance
- docs: asset/component refs require a node id (bare fileKey is
  tokens-only), example snippet matches real output, FORBIDDEN row
- skill: preflight counts a project-.env token as configured (CLI
  auto-loads it); BAD_TOKEN/FORBIDDEN guidance split

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

* fix(cli): present figma errors via standard errorBox

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

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 19:13:08 -07:00
Miguel Ángel 08c0a03510 test(studio): agent-browser e2e smoke for the design panel (#1912)
* test(studio): add design-panel QA fixture and triage matrix

Fixture project covering all panel-editable element archetypes,
plus the QA findings matrix from the design-panel bug campaign.

* fix(studio): make canvas selection hit intended elements

- honor author pointer-events:none in hit-testing (was selecting invisible overlays)
- pause playback before mousedown sampling; fall back to hover selection on null resolve
- invalidate committed selection when the active composition changes
- double-click keeps selection and defers to multi-candidate click cycling

* fix(studio): close remaining selection-layer review findings

- hoverSelection fallback now wired at all 3 mousedown call sites (box-click,
  blocked-drag, plain overlay click) instead of just the overlay path
- pointer-events override detection reads computed style, not inline style,
  so a CSS-class opt-in (not just inline style=) on a descendant is honored
- defensively remove the pointer-events override before the group-fallback
  check too, closing a theoretical gap in the no-elementsFromPoint branch
- a click that resolves to nothing (dead-zone / deselect) no longer leaves
  playback paused if it was already playing

* fix(studio-server): child-scoped patch operations with batch abort

- PatchOperation gains optional childSelector/childIndex resolved under the matched parent
- pre-pass resolves every op target; any miss aborts the batch with matched:false, no partial write
- style-decl parsing extracted to sourceStyleMutation to stay under the file-size cap
- new ./source-mutation subpath export (mirrors ./finite-mutation)

* fix(studio): per-child patch op builders and persist-seam harness

- buildTextFieldChildLocator indexes over the parent's full same-tag child list
- buildTextFieldChildOperations emits per-field ops for same-shape multi-field edits
- SDK cutover declines child-scoped batches (hfId mapping would hit the parent)
- persist-seam integration harness drives real client ops through patchElementInHtml

* fix(studio): fail closed on unresolved text-field child index

buildTextFieldChildLocator guessed a synthetic field's position by
counting same-tag "child" fields elsewhere in the array whenever
sourceChildIndex was absent. That heuristic is unreachable today (the
count-mismatch guard in buildTextFieldChildOperations already refuses
add/remove edits before it's reached) but would silently locate the
wrong element for a future caller that wires up synthetic-field
support without also computing a real sourceChildIndex. Return null
instead so the caller falls back to the unsupported-structure path.

* fix(studio): surface persist failures with toast and guarded revert

- matched:false and persist errors toast, warn structurally, and revert the optimistic write
- reverts guarded by a per-property version counter so stale failures never stomp newer edits
- structural text-field edits refuse persist instead of writing escaped markup
- multi-field child edits persist via per-child ops; shared commit runner extracted

* fix(studio): revert data-attribute and html-attribute commits on persist failure

commitDataAttribute and handleDomHtmlAttributeCommit toasted on failure but
never reverted the optimistic attribute write, leaving the preview showing an
edit that never reached disk (the exact bug this PR closes for style commits).
Extracted into useDomEditAttributeCommits.ts (useDomEditTextCommits.ts was at
the file-size cap) and routed through runDomEditCommit with a per-target+
attribute version guard, mirroring handleDomStyleCommit.

* fix(studio): close coupled persist-hook review findings

Three findings from R2 review that must land together: a patch-rejection
toast doubled up with the generic persist-failure toast (StudioSaveHttpError
had no alreadyToasted marker), a failed prepareContent write (e.g. font-face
injection) reverted and re-toasted a change the server had already
persisted, and text-commit shouldRevert only rolled back on one narrow
error type instead of any persist failure.

* test(studio): cover persist-failure hook behavior

Regression tests for the persist failure paths: unresolvable targets,
no-op warns, rejected requests, revert races, structural-edit refusal,
and read/write failure toasts.

* test(studio): cover attribute-commit revert on persist failure

Regression tests for the data-attribute and html-attribute revert paths
added in #1910: unresolvable target, rejected request, success (no revert),
and a stale-failure-vs-newer-success race guarded by the per-attribute
version counter.

* test(studio): cover the patch-rejection and text-commit revert fixes

Adds the two persist-hook cases R2 flagged as untested: the
!patchResponse.ok HTTP-error path (previously only exercised via a
network-throw, which bypassed this branch) and handleDomTextCommit's
server-failure path. Also strengthens the prepareContent-write-failure
test to assert the already-persisted base patch is recorded, not
reverted, matching the coupled persist-hook fix.

* test(studio): agent-browser e2e smoke for the design panel

Standalone script driving selection plus one input per panel section
against a running preview, asserting disk persistence and reload survival.

* fix(studio): close smoke-test quality nits, add fault-injection coverage

Closes the R2/R3 findings on the design-panel e2e smoke script:

- Section lookup no longer matches h3 display text plus a manual tree
  walk (breaks on wording tweaks). Section now carries a stable
  data-panel-section attribute; the script queries by it directly.
- Fields are located by their sibling label (or, where none exists,
  by being the section's only input of that type) instead of by
  guessing the fixture's current value ahead of time.
- Fixed sleep(1400/2000/6000) waits replaced with polling on the
  actual condition (selection registered, section rendered, patch
  round-tripped, app booted). This surfaced a real bug while
  verifying: computing click coordinates right after a commit reused
  a stale preview-frame position from before the property panel's
  reflow, silently clicking the wrong spot — now waits for the
  frame's rect to stabilize first. Also found and fixed a disk-write
  race on the first commit of a run (patch fetch resolves before the
  server's file write lands).
- FAIL now dumps window.__patchLog for diagnosability.
- Added a fault-injection cell: the server rejects a patch and the
  panel must toast the rejection without persisting it or clobbering
  the prior committed value.

Verified by actually running the script with agent-browser against a
live preview (previously never exercised this way) — all 14 checks
pass across repeated clean runs.
2026-07-03 18:50:23 -07:00
Miguel Ángel 64688ddaf2 test(studio): cover persist-failure hook behavior (#1911)
* test(studio): add design-panel QA fixture and triage matrix

Fixture project covering all panel-editable element archetypes,
plus the QA findings matrix from the design-panel bug campaign.

* fix(studio): make canvas selection hit intended elements

- honor author pointer-events:none in hit-testing (was selecting invisible overlays)
- pause playback before mousedown sampling; fall back to hover selection on null resolve
- invalidate committed selection when the active composition changes
- double-click keeps selection and defers to multi-candidate click cycling

* fix(studio): close remaining selection-layer review findings

- hoverSelection fallback now wired at all 3 mousedown call sites (box-click,
  blocked-drag, plain overlay click) instead of just the overlay path
- pointer-events override detection reads computed style, not inline style,
  so a CSS-class opt-in (not just inline style=) on a descendant is honored
- defensively remove the pointer-events override before the group-fallback
  check too, closing a theoretical gap in the no-elementsFromPoint branch
- a click that resolves to nothing (dead-zone / deselect) no longer leaves
  playback paused if it was already playing

* fix(studio-server): child-scoped patch operations with batch abort

- PatchOperation gains optional childSelector/childIndex resolved under the matched parent
- pre-pass resolves every op target; any miss aborts the batch with matched:false, no partial write
- style-decl parsing extracted to sourceStyleMutation to stay under the file-size cap
- new ./source-mutation subpath export (mirrors ./finite-mutation)

* fix(studio): per-child patch op builders and persist-seam harness

- buildTextFieldChildLocator indexes over the parent's full same-tag child list
- buildTextFieldChildOperations emits per-field ops for same-shape multi-field edits
- SDK cutover declines child-scoped batches (hfId mapping would hit the parent)
- persist-seam integration harness drives real client ops through patchElementInHtml

* fix(studio): fail closed on unresolved text-field child index

buildTextFieldChildLocator guessed a synthetic field's position by
counting same-tag "child" fields elsewhere in the array whenever
sourceChildIndex was absent. That heuristic is unreachable today (the
count-mismatch guard in buildTextFieldChildOperations already refuses
add/remove edits before it's reached) but would silently locate the
wrong element for a future caller that wires up synthetic-field
support without also computing a real sourceChildIndex. Return null
instead so the caller falls back to the unsupported-structure path.

* fix(studio): surface persist failures with toast and guarded revert

- matched:false and persist errors toast, warn structurally, and revert the optimistic write
- reverts guarded by a per-property version counter so stale failures never stomp newer edits
- structural text-field edits refuse persist instead of writing escaped markup
- multi-field child edits persist via per-child ops; shared commit runner extracted

* fix(studio): revert data-attribute and html-attribute commits on persist failure

commitDataAttribute and handleDomHtmlAttributeCommit toasted on failure but
never reverted the optimistic attribute write, leaving the preview showing an
edit that never reached disk (the exact bug this PR closes for style commits).
Extracted into useDomEditAttributeCommits.ts (useDomEditTextCommits.ts was at
the file-size cap) and routed through runDomEditCommit with a per-target+
attribute version guard, mirroring handleDomStyleCommit.

* fix(studio): close coupled persist-hook review findings

Three findings from R2 review that must land together: a patch-rejection
toast doubled up with the generic persist-failure toast (StudioSaveHttpError
had no alreadyToasted marker), a failed prepareContent write (e.g. font-face
injection) reverted and re-toasted a change the server had already
persisted, and text-commit shouldRevert only rolled back on one narrow
error type instead of any persist failure.

* test(studio): cover persist-failure hook behavior

Regression tests for the persist failure paths: unresolvable targets,
no-op warns, rejected requests, revert races, structural-edit refusal,
and read/write failure toasts.

* test(studio): cover attribute-commit revert on persist failure

Regression tests for the data-attribute and html-attribute revert paths
added in #1910: unresolvable target, rejected request, success (no revert),
and a stale-failure-vs-newer-success race guarded by the per-attribute
version counter.

* test(studio): cover the patch-rejection and text-commit revert fixes

Adds the two persist-hook cases R2 flagged as untested: the
!patchResponse.ok HTTP-error path (previously only exercised via a
network-throw, which bypassed this branch) and handleDomTextCommit's
server-failure path. Also strengthens the prepareContent-write-failure
test to assert the already-persisted base patch is recorded, not
reverted, matching the coupled persist-hook fix.
2026-07-03 18:25:16 -07:00
Miguel Ángel e6e0d97cc5 fix(studio): surface persist failures with toast and guarded revert (#1910)
* test(studio): add design-panel QA fixture and triage matrix

Fixture project covering all panel-editable element archetypes,
plus the QA findings matrix from the design-panel bug campaign.

* fix(studio): make canvas selection hit intended elements

- honor author pointer-events:none in hit-testing (was selecting invisible overlays)
- pause playback before mousedown sampling; fall back to hover selection on null resolve
- invalidate committed selection when the active composition changes
- double-click keeps selection and defers to multi-candidate click cycling

* fix(studio): close remaining selection-layer review findings

- hoverSelection fallback now wired at all 3 mousedown call sites (box-click,
  blocked-drag, plain overlay click) instead of just the overlay path
- pointer-events override detection reads computed style, not inline style,
  so a CSS-class opt-in (not just inline style=) on a descendant is honored
- defensively remove the pointer-events override before the group-fallback
  check too, closing a theoretical gap in the no-elementsFromPoint branch
- a click that resolves to nothing (dead-zone / deselect) no longer leaves
  playback paused if it was already playing

* fix(studio-server): child-scoped patch operations with batch abort

- PatchOperation gains optional childSelector/childIndex resolved under the matched parent
- pre-pass resolves every op target; any miss aborts the batch with matched:false, no partial write
- style-decl parsing extracted to sourceStyleMutation to stay under the file-size cap
- new ./source-mutation subpath export (mirrors ./finite-mutation)

* fix(studio): per-child patch op builders and persist-seam harness

- buildTextFieldChildLocator indexes over the parent's full same-tag child list
- buildTextFieldChildOperations emits per-field ops for same-shape multi-field edits
- SDK cutover declines child-scoped batches (hfId mapping would hit the parent)
- persist-seam integration harness drives real client ops through patchElementInHtml

* fix(studio): fail closed on unresolved text-field child index

buildTextFieldChildLocator guessed a synthetic field's position by
counting same-tag "child" fields elsewhere in the array whenever
sourceChildIndex was absent. That heuristic is unreachable today (the
count-mismatch guard in buildTextFieldChildOperations already refuses
add/remove edits before it's reached) but would silently locate the
wrong element for a future caller that wires up synthetic-field
support without also computing a real sourceChildIndex. Return null
instead so the caller falls back to the unsupported-structure path.

* fix(studio): surface persist failures with toast and guarded revert

- matched:false and persist errors toast, warn structurally, and revert the optimistic write
- reverts guarded by a per-property version counter so stale failures never stomp newer edits
- structural text-field edits refuse persist instead of writing escaped markup
- multi-field child edits persist via per-child ops; shared commit runner extracted

* fix(studio): revert data-attribute and html-attribute commits on persist failure

commitDataAttribute and handleDomHtmlAttributeCommit toasted on failure but
never reverted the optimistic attribute write, leaving the preview showing an
edit that never reached disk (the exact bug this PR closes for style commits).
Extracted into useDomEditAttributeCommits.ts (useDomEditTextCommits.ts was at
the file-size cap) and routed through runDomEditCommit with a per-target+
attribute version guard, mirroring handleDomStyleCommit.

* fix(studio): close coupled persist-hook review findings

Three findings from R2 review that must land together: a patch-rejection
toast doubled up with the generic persist-failure toast (StudioSaveHttpError
had no alreadyToasted marker), a failed prepareContent write (e.g. font-face
injection) reverted and re-toasted a change the server had already
persisted, and text-commit shouldRevert only rolled back on one narrow
error type instead of any persist failure.
2026-07-03 18:22:22 -07:00
Vance IngallsandClaude Fable 5 ee7a96147a feat(core,cli): figma component import with binding-aware node-to-html mapper (M3) (#1872)
resolveBindings: scan the full tree (boundVariables + style ids, alias
chains, children) and partition exact-ID-only against the binding index
before any CSS is emitted per spec 7.1 - never value matching.

nodeToHtml: absolute geometry at figma bounds inside a fixed-size root,
solid/linear-gradient fills, corner radius, opacity, drop shadow, blur,
text styles; resolved bindings emit var(--slug, literal), unresolved
bake literals with data-figma-unresolved; visible:false respected;
vectors/boolean ops route to a rasterize list.

hyperframes figma component: tree -> bindings -> html, rasterize
fallback via Phase-1 asset export with src backfill, registry-item
packaging, unresolved-binding guidance in output.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 18:19:01 -07:00
Vance IngallsandClaude Fable 5 4d60792adc feat(core,cli): figma tokens import with alias-aware binding records (M2) (#1871)
tokensToVariables: variables -> composition brand-variable entries
(COLOR->hex/rgba, FLOAT/STRING/BOOLEAN), alias chains walked cycle-safe
to the leaf value while the binding keeps the semantic id. Sidecar
figma-tokens.json + .media/figma-bindings.jsonl records per spec 7.1.

hyperframes figma tokens: variables path, REQUIRES_ENTERPRISE degrades
to published-styles metadata (values resolve at component time).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 18:16:48 -07:00
Miguel Ángel 22942280b6 fix(studio): per-child patch op builders and persist-seam harness (#1909)
* test(studio): add design-panel QA fixture and triage matrix

Fixture project covering all panel-editable element archetypes,
plus the QA findings matrix from the design-panel bug campaign.

* fix(studio): make canvas selection hit intended elements

- honor author pointer-events:none in hit-testing (was selecting invisible overlays)
- pause playback before mousedown sampling; fall back to hover selection on null resolve
- invalidate committed selection when the active composition changes
- double-click keeps selection and defers to multi-candidate click cycling

* fix(studio): close remaining selection-layer review findings

- hoverSelection fallback now wired at all 3 mousedown call sites (box-click,
  blocked-drag, plain overlay click) instead of just the overlay path
- pointer-events override detection reads computed style, not inline style,
  so a CSS-class opt-in (not just inline style=) on a descendant is honored
- defensively remove the pointer-events override before the group-fallback
  check too, closing a theoretical gap in the no-elementsFromPoint branch
- a click that resolves to nothing (dead-zone / deselect) no longer leaves
  playback paused if it was already playing

* fix(studio-server): child-scoped patch operations with batch abort

- PatchOperation gains optional childSelector/childIndex resolved under the matched parent
- pre-pass resolves every op target; any miss aborts the batch with matched:false, no partial write
- style-decl parsing extracted to sourceStyleMutation to stay under the file-size cap
- new ./source-mutation subpath export (mirrors ./finite-mutation)

* fix(studio): per-child patch op builders and persist-seam harness

- buildTextFieldChildLocator indexes over the parent's full same-tag child list
- buildTextFieldChildOperations emits per-field ops for same-shape multi-field edits
- SDK cutover declines child-scoped batches (hfId mapping would hit the parent)
- persist-seam integration harness drives real client ops through patchElementInHtml

* fix(studio): fail closed on unresolved text-field child index

buildTextFieldChildLocator guessed a synthetic field's position by
counting same-tag "child" fields elsewhere in the array whenever
sourceChildIndex was absent. That heuristic is unreachable today (the
count-mismatch guard in buildTextFieldChildOperations already refuses
add/remove edits before it's reached) but would silently locate the
wrong element for a future caller that wires up synthetic-field
support without also computing a real sourceChildIndex. Return null
instead so the caller falls back to the unsupported-structure path.
2026-07-03 18:14:17 -07:00
Vance IngallsandClaude Fable 5 fb13797d2f feat(core,cli): figma REST client, asset import command, binding index (M0+M1) (#1870)
M0: renderNode/imageFills/variables/styles/nodeTree/fileVersion over
api.figma.com with injectable fetch and typed capability errors
(NO_TOKEN/BAD_TOKEN/REQUIRES_ENTERPRISE/RATE_LIMITED/RENDER_FAILED/
NODE_NOT_FOUND/HTTP_ERROR) per design spec 4.4.

M1: svg sanitizer (scripts/foreignObject/handlers/external hrefs) +
hyperframes figma asset: render -> sanitize -> freeze under .media/ ->
manifest provenance -> snippet. Idempotent on
fileKey:nodeId:format:scale:version; re-imports when the version moves.

Plus the 7.1 binding index store (.media/figma-bindings.jsonl): exact-ID
lookup incl. alias chains, per-project library-file answers, shared
jsonl reader with the asset manifest.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 18:11:33 -07:00
Miguel Ángel 23f67da5e2 fix(studio-server): child-scoped patch operations with batch abort (#1908)
* test(studio): add design-panel QA fixture and triage matrix

Fixture project covering all panel-editable element archetypes,
plus the QA findings matrix from the design-panel bug campaign.

* fix(studio): make canvas selection hit intended elements

- honor author pointer-events:none in hit-testing (was selecting invisible overlays)
- pause playback before mousedown sampling; fall back to hover selection on null resolve
- invalidate committed selection when the active composition changes
- double-click keeps selection and defers to multi-candidate click cycling

* fix(studio): close remaining selection-layer review findings

- hoverSelection fallback now wired at all 3 mousedown call sites (box-click,
  blocked-drag, plain overlay click) instead of just the overlay path
- pointer-events override detection reads computed style, not inline style,
  so a CSS-class opt-in (not just inline style=) on a descendant is honored
- defensively remove the pointer-events override before the group-fallback
  check too, closing a theoretical gap in the no-elementsFromPoint branch
- a click that resolves to nothing (dead-zone / deselect) no longer leaves
  playback paused if it was already playing

* fix(studio-server): child-scoped patch operations with batch abort

- PatchOperation gains optional childSelector/childIndex resolved under the matched parent
- pre-pass resolves every op target; any miss aborts the batch with matched:false, no partial write
- style-decl parsing extracted to sourceStyleMutation to stay under the file-size cap
- new ./source-mutation subpath export (mirrors ./finite-mutation)
2026-07-03 17:53:17 -07:00