hyperframes 0.8.139 → 0.8.141
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-VYJQ4S3P.js → add-KH2CF4FD.js} +20 -22
- package/dist/{animatedGifPrep-IBMW6FZB.js → animatedGifPrep-QO4BSKR7.js} +15 -8
- package/dist/{asset-FLSUS73X.js → asset-4RDZILVJ.js} +3 -3
- package/dist/{assetCataloger-TGD7TRCR.js → assetCataloger-WGR4LYYN.js} +6 -3
- package/dist/{auth-EZXIN4M4.js → auth-WYQCOYE5.js} +7 -7
- package/dist/{autoUpdate-ZPMY5T3X.js → autoUpdate-PC5TN3NL.js} +2 -2
- package/dist/{backgroundChecks-JIDTAUFE.js → backgroundChecks-7M3T44EP.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-FNZ6TJYY.js → batchRender-GOLLOE4V.js} +11 -8
- package/dist/beat-analyzer.global.js +5 -2
- package/dist/{beats-EAA4U3YN.js → beats-XJ7WP6QS.js} +24 -17
- package/dist/{benchmark-KKZQVK2Y.js → benchmark-HCGFBEZJ.js} +20 -23
- package/dist/{browser-ZIVVJLJT.js → browser-VQKO2FKG.js} +14 -28
- package/dist/{bundleWithLocalizedFonts-2XWC3PEM.js → bundleWithLocalizedFonts-FH7PHTTX.js} +5 -5
- package/dist/{capture-EFYPXI42.js → capture-TFZZSF6F.js} +22 -15
- package/dist/{capture-MKJHABUL.js → capture-XD3P3YQR.js} +2 -2
- package/dist/{catalog-EWX4BBI2.js → catalog-4S33QWJJ.js} +28 -30
- package/dist/{catch-up-FJFH7T4W.js → catch-up-RW7YXXNT.js} +11 -25
- package/dist/{check-YJNVDCBP.js → check-XVTRRN4Y.js} +72 -54
- package/dist/{checkBrowser-I6SPPEGD.js → checkBrowser-HZXJ2EDU.js} +81 -36
- package/dist/chunk-24OWOBQH.js +3656 -0
- package/dist/{chunk-OENM2JVZ.js → chunk-34TXESM7.js} +3 -3
- package/dist/{chunk-GWV2Y36Q.js → chunk-35RSNI77.js} +5 -106
- package/dist/{chunk-BC3OY2ED.js → chunk-3A5AAPMP.js} +1 -1
- package/dist/{chunk-U3HX7WE6.js → chunk-3NBKW2QJ.js} +1 -1
- package/dist/{chunk-A4X2YWNQ.js → chunk-4BB7V6AI.js} +38 -301
- package/dist/{chunk-EJ7OWYF2.js → chunk-6E6CM7WS.js} +19 -163
- package/dist/{chunk-CDMB3PRC.js → chunk-6IFXWJDX.js} +7 -7
- package/dist/{chunk-Z67RZ4XO.js → chunk-6Q6FR4KH.js} +279 -1968
- package/dist/{chunk-R4QIE6UY.js → chunk-7M4KAPAA.js} +92 -31
- package/dist/{chunk-25DHUDOK.js → chunk-7XTZVLE6.js} +12 -3
- package/dist/chunk-A4KQZXZI.js +116 -0
- package/dist/{chunk-DUQJF7FK.js → chunk-A7YQNIQT.js} +8 -8
- package/dist/{chunk-XOZ3J3LB.js → chunk-AVWEIOEN.js} +1 -1
- package/dist/{chunk-UQXOHEQ7.js → chunk-BM5PX3DJ.js} +4 -4
- package/dist/{chunk-SHB5VDMH.js → chunk-BRITLL56.js} +1 -1
- package/dist/{chunk-JX7Y57YY.js → chunk-E4BSCXMU.js} +1 -1
- package/dist/{chunk-QXOFUKBF.js → chunk-E6SDW5FV.js} +168 -165
- package/dist/{chunk-JH556Q42.js → chunk-EDYBFSPE.js} +2 -2
- package/dist/{chunk-R7LWDIKB.js → chunk-EKA4ZZBI.js} +1 -1
- package/dist/chunk-FXMKHHPO.js +123 -0
- package/dist/chunk-G75ENCEZ.js +283 -0
- package/dist/{chunk-PLNWWGE7.js → chunk-GQJZORQP.js} +1 -1
- package/dist/{chunk-U3GEXWI5.js → chunk-GS6FE3IW.js} +1 -1
- package/dist/{chunk-Y6W4DVPS.js → chunk-HKCNZITN.js} +1 -1
- package/dist/{chunk-HOIHGPWO.js → chunk-IKVBTDLO.js} +1 -1
- package/dist/{chunk-YOL4QRSL.js → chunk-INI3TM6I.js} +2 -2
- package/dist/{chunk-SIKMUO45.js → chunk-IO7ZIDRP.js} +12 -12
- package/dist/{chunk-W7SAWBQC.js → chunk-IV7EI5E2.js} +1 -1
- package/dist/{chunk-TCWL4BKK.js → chunk-IYFKBFTW.js} +1 -1
- package/dist/{chunk-JIIIBTN2.js → chunk-J5IPIQU2.js} +1 -1
- package/dist/chunk-JFKL3WAE.js +161 -0
- package/dist/{chunk-IBRZUVTH.js → chunk-K2GOFLTX.js} +2 -2
- package/dist/{chunk-X3TMMIDP.js → chunk-KFH6UD26.js} +8 -8
- package/dist/{chunk-O6K5DWXM.js → chunk-KOEWEFHK.js} +1 -1
- package/dist/{chunk-VTVS4IIP.js → chunk-L3JSAB4L.js} +2 -2
- package/dist/{chunk-3RT6D4P6.js → chunk-N77KD7ZZ.js} +1 -1
- package/dist/{chunk-FLRCVYNE.js → chunk-NORZWWLK.js} +2 -2
- package/dist/{chunk-4VZBKOQJ.js → chunk-O3SKIXQK.js} +1 -1
- package/dist/{chunk-PFI3VD77.js → chunk-OLDDJS3S.js} +10 -10
- package/dist/{chunk-UGI77E35.js → chunk-P6E4HFFU.js} +167 -61
- package/dist/{chunk-GIDHR5OL.js → chunk-Q65ZQFF2.js} +1 -1
- package/dist/chunk-QZ3AZTXI.js +1740 -0
- package/dist/{chunk-NTIOLSFE.js → chunk-R7UDXKI3.js} +3 -3
- package/dist/{chunk-7SI7GCX6.js → chunk-RCFCZT5O.js} +6 -6
- package/dist/{chunk-DW32KBHN.js → chunk-RPYPW5NN.js} +13 -13
- package/dist/chunk-SYKKFAUW.js +3711 -0
- package/dist/chunk-T76PLPD6.js +57 -0
- package/dist/{chunk-JTAYFSLO.js → chunk-TC2FBZJZ.js} +1 -1
- package/dist/{chunk-Q73ISOVQ.js → chunk-U7E736AJ.js} +1 -1
- package/dist/chunk-USDEMXXL.js +110 -0
- package/dist/{chunk-UMWROSIP.js → chunk-W6HTOVHU.js} +2 -2
- package/dist/{chunk-STA43FMY.js → chunk-WY5OODN5.js} +71 -3855
- package/dist/{chunk-EZ2P7LAP.js → chunk-XDSOIJC3.js} +8 -8
- package/dist/{chunk-ZTZ7NCJT.js → chunk-XTFJOR3K.js} +1 -1
- package/dist/{chunk-CDJ7FPPJ.js → chunk-XWVGSEUT.js} +1 -1
- package/dist/chunk-YA62XGXS.js +45 -0
- package/dist/{chunk-EH4VUY27.js → chunk-YURXPGAM.js} +2 -2
- package/dist/{clean-P4KTCOUA.js → clean-L2E4VD57.js} +29 -20
- package/dist/cli.js +55 -55
- package/dist/{cloud-PDY7S4HU.js → cloud-IDUQRYLO.js} +7 -7
- package/dist/{cloudrun-54MA2W5H.js → cloudrun-R3JXWXGG.js} +11 -8
- package/dist/commands/layout-audit.browser.js +37 -8
- package/dist/commands/motion-signature.browser.js +51 -2
- package/dist/{compare-LDWVSPC5.js → compare-VYBWSP3Y.js} +40 -31
- package/dist/{compiler-CWSZ4W7J.js → compiler-ACHWOU5N.js} +7 -3
- package/dist/{component-FIEGC22U.js → component-PYYV2V3F.js} +4 -4
- package/dist/{compositions-JR7PX356.js → compositions-B5GQSXH7.js} +23 -16
- package/dist/{delete-FXA2IHOS.js → delete-EAX2U3WI.js} +8 -8
- package/dist/{deterministicFonts-GTITFRSJ.js → deterministicFonts-F6WIVL2W.js} +1 -1
- package/dist/{dist-OJTEVNJR.js → dist-NZSQCYOF.js} +3 -1
- package/dist/{dist-4JZWRWS6.js → dist-ROUDWGLO.js} +27 -15
- package/dist/{doctor-OTDHPM6K.js → doctor-PJX7MLFG.js} +20 -13
- package/dist/{events-UAFTI24U.js → events-SBC54MHO.js} +6 -22
- package/dist/{events-6T7M2VCO.js → events-YFFXKAQQ.js} +10 -23
- package/dist/{feedback-ZGZODHB6.js → feedback-UETLWREV.js} +67 -45
- package/dist/{figma-D26EJ7ZB.js → figma-QDSJPIRW.js} +6 -6
- package/dist/fontLocalizeCli.js +18 -11
- package/dist/{get-IAREU7IK.js → get-B5TS6C7H.js} +8 -8
- package/dist/{gpuPolicy-NS7WZRDJ.js → gpuPolicy-LYOVBAJP.js} +15 -8
- package/dist/{grade-compare-ZXHFHCD2.js → grade-compare-LBIHMAUN.js} +40 -31
- package/dist/{help-RVNYHW3N.js → help-XBP6A6LT.js} +4 -4
- package/dist/{history-THP4VNMF.js → history-2S42ZXKL.js} +12 -30
- package/dist/hyperframe-runtime.js +59 -59
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +59 -59
- package/dist/hyperframes-player.global.js +3 -3
- package/dist/{info-EOFRHN5A.js → info-I2VDAWT7.js} +17 -20
- package/dist/{init-YLIJE4CG.js → init-BGHSDODI.js} +48 -41
- package/dist/{inspect-3D56ONJD.js → inspect-MZK5B5RP.js} +39 -30
- package/dist/{installer-GRR2GDZK.js → installer-LL4QAKFW.js} +8 -5
- package/dist/{keyframes-NXNCTQPK.js → keyframes-2EBF7OSS.js} +14 -25
- package/dist/{lambda-VGRZD7TR.js → lambda-XKFPAOFE.js} +16 -13
- package/dist/{layout-Z5DOS6DU.js → layout-TP5ERKEF.js} +39 -30
- package/dist/{lint-YD6NJGR2.js → lint-FQ6CEI7E.js} +17 -23
- package/dist/{lintProject-ANMPLBIT.js → lintProject-LM3XZRPZ.js} +3 -1
- package/dist/{list-XGDKILYN.js → list-FRNUJXZ3.js} +8 -8
- package/dist/{login-GD5SA4RD.js → login-C25QU3BQ.js} +9 -9
- package/dist/{logout-Q654A3SI.js → logout-GJXZQKOA.js} +5 -5
- package/dist/{media-treatment-TY4X4GQQ.js → media-treatment-DCANGWSV.js} +21 -20
- package/dist/{models-MXRDH4WJ.js → models-GOD6ARB3.js} +19 -12
- package/dist/{motionShot-6LKR3C2E.js → motionShot-FSKETANX.js} +22 -15
- package/dist/{normalize-O76AC4HE.js → normalize-IGLHCWTF.js} +0 -4
- package/dist/{normalize-audio-5ADDZKPJ.js → normalize-audio-C2IM7OID.js} +13 -26
- package/dist/{open-JXAMO325.js → open-VVISXIII.js} +11 -25
- package/dist/{pipeline-Q5MOPIIX.js → pipeline-7YHZPYIS.js} +15 -8
- package/dist/{play-3SPH5GWZ.js → play-DSELK7G3.js} +38 -32
- package/dist/{preflight-2PWAPKWC.js → preflight-Y5DN5D37.js} +3 -18
- package/dist/{present-ZTJQDKXZ.js → present-N72YFDKP.js} +32 -26
- package/dist/{preview-4A3XZR6J.js → preview-XTYN4NJ2.js} +33 -26
- package/dist/{producer-5ZKKKQPB.js → producer-NDCU3MHK.js} +1 -1
- package/dist/{projectConfig-WA4CS4SN.js → projectConfig-MH4QU4AC.js} +10 -7
- package/dist/{publication-CLG2FRRI.js → publication-KUSHI5MG.js} +6 -3
- package/dist/{publish-YTT2WMXO.js → publish-3XEEFWMF.js} +27 -20
- package/dist/{refresh-K24ETHMA.js → refresh-MFITBIKV.js} +5 -5
- package/dist/{remove-background-W35INR3B.js → remove-background-2QKJ7XOD.js} +22 -15
- package/dist/{render-WUBFQMAH.js → render-2DVYTVLQ.js} +52 -32
- package/dist/{render-7A4P5WMU.js → render-75E342ZU.js} +10 -7
- package/dist/{render-KICXUPNR.js → render-S73DW4KK.js} +23 -26
- package/dist/{render-batch-N7EFGE6S.js → render-batch-YURBS54Q.js} +11 -8
- package/dist/{renderCancellation-LYQPPFAO.js → renderCancellation-373ASJTO.js} +15 -8
- package/dist/renderSetupWorker.js +4 -2
- package/dist/{resolver-YTT2NENF.js → resolver-FE3GBZ4T.js} +8 -5
- package/dist/{sherpa-353MW4UV.js → sherpa-B2D3AGP6.js} +16 -9
- package/dist/skills/hyperframes/references/capability-menu.md +1 -1
- package/dist/skills/hyperframes-cli/SKILL.md +5 -0
- package/dist/skills/hyperframes-cli/references/lint-validate-inspect.md +1 -1
- package/dist/skills/hyperframes-cli/references/preview-render.md +1 -1
- package/dist/skills/media-use/SKILL.md +9 -5
- package/dist/skills/media-use/audio/scripts/lib/heygen.mjs +47 -4
- package/dist/skills/media-use/audio/scripts/lib/heygen.test.mjs +125 -18
- package/dist/skills/media-use/audio/scripts/lib/host-audio.mjs +28 -0
- package/dist/skills/media-use/audio/scripts/lib/host-audio.test.mjs +106 -0
- package/dist/skills/media-use/references/setup-providers.md +16 -2
- package/dist/skills/media-use/scripts/lib/heygen-cli.mjs +21 -1
- package/dist/skills/media-use/scripts/lib/heygen-cli.test.mjs +14 -0
- package/dist/skills/media-use/scripts/resolve.mjs +11 -6
- package/dist/{skills-2XJIOEBT.js → skills-ICJ22CZZ.js} +15 -30
- package/dist/{skillsUpdateCheck-LMCCWGNO.js → skillsUpdateCheck-GXZN56I5.js} +3 -3
- package/dist/{snapshot-WBRSTLJ2.js → snapshot-XHKOAWF4.js} +41 -32
- package/dist/{src-ZS3BLTZ5.js → src-74PFDTDX.js} +17 -10
- package/dist/{src-YWFJILQF.js → src-I7UC3JTL.js} +19 -11
- package/dist/{staticProjectServer-4VKVHPNG.js → staticProjectServer-2DGKD6TF.js} +24 -16
- package/dist/{status-73MBN37B.js → status-JA6SKQVH.js} +7 -24
- package/dist/studio/assets/hyperframes-player-5Vx2AiUz.js +473 -0
- package/dist/studio/assets/{index-DsEkE5_G.js → index-BAnh7cSQ.js} +1 -1
- package/dist/studio/assets/{index-Br1Whc0f.js → index-C0thd4eM.js} +204 -204
- package/dist/studio/assets/{index-BmIPrb8I.js → index-P8fgj_Xa.js} +1 -1
- package/dist/studio/{chunk-E422JDF5.js → chunk-H2DUOXTF.js} +2 -1
- package/dist/studio/index.d.ts +19 -3
- package/dist/studio/index.html +1 -1
- package/dist/studio/index.js +6518 -5813
- package/dist/studio/index.js.map +1 -1
- package/dist/studio/player.js +1 -1
- package/dist/{studio-api-5V4TVSQV.js → studio-api-PROBO7JG.js} +40 -28
- package/dist/{studioServer-M5XY3HYC.js → studioServer-ID6UV2NE.js} +100 -69
- package/dist/{system-RCRNX5VF.js → system-OQLOGGPJ.js} +2 -19
- package/dist/{telemetry-LOBRQGUD.js → telemetry-65LFHIWH.js} +8 -23
- package/dist/{timeline-3JCP6PXU.js → timeline-6UV3JJXD.js} +32 -22
- package/dist/{tokens-MLMIJBVF.js → tokens-HIL4TZXI.js} +3 -3
- package/dist/{transcribe-KNFXDEAX.js → transcribe-TIO6W3EQ.js} +16 -9
- package/dist/{transcribe-POH25ZPX.js → transcribe-V7F6QDSN.js} +20 -44
- package/dist/{updateCheck-5ITBSBST.js → updateCheck-GZELANMA.js} +2 -2
- package/dist/{upgrade-K6OK4FKT.js → upgrade-BX3KDDZJ.js} +5 -5
- package/dist/{urlDownloader-TJJQKADT.js → urlDownloader-R76OHFIE.js} +14 -7
- package/dist/{validate-PPPOBJHB.js → validate-7UX4I443.js} +26 -19
- package/dist/{video-OB22HWXZ.js → video-RVGYEFQU.js} +18 -11
- package/package.json +1 -1
- package/dist/chunk-HYYSJI5D.js +0 -3742
- package/dist/studio/assets/hyperframes-player-CckOoCJ8.js +0 -473
- package/dist/{chunk-I465DBM6.js → chunk-246MOR5U.js} +3 -3
- package/dist/{deploy-MX76RZ36.js → deploy-5G4Z6LPA.js} +1 -1
- package/dist/{destroy-H2TZBYHH.js → destroy-GFQLTIY3.js} +1 -1
- package/dist/{docs-QAPJEGLS.js → docs-MPOM3PHH.js} +3 -3
- package/dist/{policies-FSDZVS2E.js → policies-4FEXMXPK.js} +3 -3
- package/dist/{progress-FBIEEB7Y.js → progress-5AM2MZ7V.js} +3 -3
- package/dist/{sites-TNVKZS73.js → sites-HZMADOA3.js} +1 -1
- package/dist/studio/{chunk-E422JDF5.js.map → chunk-H2DUOXTF.js.map} +0 -0
- package/dist/{telemetry-2YC4SGQU.js → telemetry-W5AKPI4R.js} +3 -3
- package/dist/{tts-FU35O6YB.js → tts-TOHSPWEG.js} +4 -4
|
@@ -142,6 +142,11 @@ npx hyperframes feedback --rating <0-10> --comment "<specific result or friction
|
|
|
142
142
|
|
|
143
143
|
Keep clean-run feedback concise. For any bug or friction, capture a **reproduction packet** before submitting; do not send only a symptom summary. Include the rerunnable command (relative to the project directory — feedback is submitted to a public channel, so do **not** paste absolute paths, home-directory prefixes, or user/machine identifiers), expected versus actual behavior, exact error (also strip absolute paths from stack traces — keep basename + line, drop the leading directory), whether output completed/fell back/failed, workaround, and repro-project status. For a rating ≤ 7 that describes a visual defect (black frame, flicker, corrupt output, wrong frame, blank output, other visual anomaly), also include a `COMPOSITION_STRUCTURE:` block — a privacy-preserving structural anatomy (element census + attribute presence + timeline shape) so maintainers can pattern-match against known bug families without the composition ZIP. Agents auto-fill this via the composition-census helper; the human user does not fill it by hand. If the issue did not reproduce again, say so and still include the last failing command and logs. Use `--file-issue` only with consent: it publishes a minimal reproduction to a public URL. The required packet format and privacy warning live in `references/preview-render.md`.
|
|
144
144
|
|
|
145
|
+
Two more reports are a `--comment` with no `--rating`, so they never count in the rating metric. Send them unless telemetry is disabled or the user opted out, under the same privacy rules:
|
|
146
|
+
|
|
147
|
+
- **Missing feature.** Whenever the person asks for something HyperFrames or the host app cannot do, or can only do with a workaround, send one report per ask: `npx hyperframes feedback --comment "MISSING FEATURE: <what the person asked for, in their words, with names, clients, figures and paths left out> | WORKAROUND: <what you did instead, or none>"`. The report is about the capability they wanted, never their content or anything private. A catalog search that found nothing goes to `--search-miss` instead.
|
|
148
|
+
- **Host app.** When `HYPERFRAMES_CLIENT` is set, the CLI is running inside a host app. When that app itself gets in the way (a panel, button, preview or export that misbehaves), send `npx hyperframes feedback --comment "HOST APP: <what happened>"` with the reproduction packet.
|
|
149
|
+
|
|
145
150
|
## Read the matching reference before running a command
|
|
146
151
|
|
|
147
152
|
The following references and owning skills are mandatory command contracts, not optional background reading. Before running a command in the table, read its matching row.
|
|
@@ -50,7 +50,7 @@ One command, one Chrome boot. `check` runs the linter first and skips the browse
|
|
|
50
50
|
|
|
51
51
|
Every finding carries a selector, the element's `data-*` identity, the composition source file, a bbox, and the sample time: jump straight from the JSON to the HTML you must edit and re-run.
|
|
52
52
|
|
|
53
|
-
**Severity is persistence-aware.** A dynamic issue observed at a single grid sample (an entrance/exit transient) demotes to info and never gates. Issues held across samples gate the exit code, a held `content_overlap` is an error, and a held, partially-visible `canvas_overflow` breaching ≥5% of the canvas promotes to warning. Coordinate-frame findings (`escaped_container`, `panel_out_of_canvas`, `connector_detached`) flag geometry computed in one frame but rendered in another — an element far outside its offset parent, a painted panel stuck across the canvas edge, a connector line detached from every node. Text drawn into a `<canvas>` has no DOM box, so `canvas_overflow` cannot see it; `canvas_content_at_edge` warns when a canvas's pixels show sharp content (drawn text, hard shapes) along the frame edge — mark intentional full-bleed art (particles, photos) with `data-layout-allow-overflow`. If a 3s+ composition shows
|
|
53
|
+
**Severity is persistence-aware.** A dynamic issue observed at a single grid sample (an entrance/exit transient) demotes to info and never gates. Issues held across samples gate the exit code, a held `content_overlap` is an error, and a held, partially-visible `canvas_overflow` breaching ≥5% of the canvas promotes to warning. Coordinate-frame findings (`escaped_container`, `panel_out_of_canvas`, `connector_detached`) flag geometry computed in one frame but rendered in another — an element far outside its offset parent, a painted panel stuck across the canvas edge, a connector line detached from every node. Text drawn into a `<canvas>` has no DOM box, so `canvas_overflow` cannot see it; `canvas_content_at_edge` warns when a canvas's pixels show sharp content (drawn text, hard shapes) along the frame edge — mark intentional full-bleed art (particles, photos) with `data-layout-allow-overflow`. If a 3s+ composition shows no visible change across every sample, `check` fails with `sweep_static`: a frozen timeline makes every green verdict unreliable, so it refuses to pass. When only audio advanced, it warns instead; a composition meant to be still takes `data-no-timeline` on its root. The fingerprint includes per-element opacity, so opacity-only reveals (code typing, staggered fades) count as motion — but only while they're still in flight at the sampled times. The classic trap is a reveal that completes early and then holds a static frame for the rest of the duration: every sample lands on the settled state and the run fails. Spread the reveal across the timeline or keep one continuously animated element alive (a blinking caret is idiomatic for code typing) — don't bolt on a slow position drift just to appease the check.
|
|
54
54
|
|
|
55
55
|
**Escape hatches** (mark intent in the HTML, then re-run):
|
|
56
56
|
|
|
@@ -157,7 +157,7 @@ npx hyperframes feedback --rating 10 # clean run, n
|
|
|
157
157
|
npx hyperframes feedback --rating 6 --comment "bg <video> renders grey in multi-scene; worked around with --format png-sequence"
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
-
`--rating` is an integer from 0-10
|
|
160
|
+
`--rating` is an integer from 0-10; `--comment` is free text. A `--comment` with no `--rating` is a ratingless report (`MISSING FEATURE:` and `HOST APP:` in `SKILL.md`) that never counts in the rating metric. Feedback is anonymous and attaches a `doctorSummary` (OS/Node/CPU/mem/ffmpeg) automatically, so don't repeat those fields. A clean run needs only a short result. Before sending any bug, workaround, or confusing behavior, collect this compact reproduction packet:
|
|
161
161
|
|
|
162
162
|
```text
|
|
163
163
|
REPRO COMMAND: <HF_*/PRODUCER_* env> npx hyperframes <exact command> # run from the project directory; do NOT paste absolute paths
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: media-use
|
|
3
|
-
description: Agent Media OS
|
|
3
|
+
description: Agent Media OS for a HyperFrames project. Resolve BGM, SFX, image, icon, brand logo, voice, color grade, or LUT into a frozen local file or paste-ready block + ledger record (one verb, `resolve`); generate via TTS / music / image models when the catalog misses; produce voiceover, transcription, captions, and background removal through one shared audio engine; operate on media (cut / reframe / transform); and reuse assets across projects. Also use for vague feedback that real footage looks dark, flat, boring, should feel retro/camcorder/print/ASCII, needs privacy, or needs a media reveal. When the host app provides its own music or sound-effect tools, use those for music and sound effects; `resolve --type bgm|sfx` needs the heygen CLI. When `HEYGEN_API_BASE` is set, HeyGen calls go through that host with no CLI sign-in.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
**Plugin installs:** Before setup or freshness commands, follow [plugin execution rules](../hyperframes/references/plugin-installation.md) when this skill is inside a HyperFrames plugin. Standalone installs keep the update instructions below.
|
|
@@ -9,9 +9,13 @@ description: Agent Media OS, the single skill for every media need in a HyperFra
|
|
|
9
9
|
|
|
10
10
|
The media OS for HyperFrames: resolve · generate · operate · remember — every media type, one skill, zero context noise.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Only when `HEYGEN_API_BASE` is set in your environment (a host app set it and pays for HeyGen with its own key): HeyGen media is already paid for. Do not ask the person to install or sign in to the `heygen` CLI and do not offer its OAuth allowance; catalog search, TTS and avatar calls here go through the host. When that same host also gives you its own HeyGen tools, use those first. When a call through the host is refused, tell the person the host's message as written (it names the fix, such as adding or replacing the key in the app's Settings) and stop; do not switch to another provider unless they ask.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
First run otherwise (no `HEYGEN_API_BASE`), when you will use HeyGen media (catalog search, TTS, avatar video): install and sign in to the `heygen` CLI (the free-usage path), then verify with `npx hyperframes media-use resolve --doctor`. Setup and providers: `references/setup-providers.md`.
|
|
15
|
+
|
|
16
|
+
Music and sound effects inside a host app: when the app you run in gives you its own music or sound-effect tools, use those. Without `HEYGEN_API_BASE`, `resolve --type bgm` and `--type sfx` search the HeyGen catalog through the `heygen` CLI; without it they fail and say so (`sfx` still answers from its bundled library).
|
|
17
|
+
|
|
18
|
+
Without `HEYGEN_API_BASE`, before generating a voiceover or an avatar video, tell the person: signing in to the heygen CLI with OAuth (`heygen auth login --oauth`) gives a free allowance for TTS voiceover and avatar videos, while an API key bills API credits.
|
|
15
19
|
|
|
16
20
|
## Resolve — the one verb
|
|
17
21
|
|
|
@@ -23,8 +27,8 @@ Returns one line: `resolved <id> → <path> (<type>, <metadata>)`. All search no
|
|
|
23
27
|
|
|
24
28
|
| Type | One-line intent |
|
|
25
29
|
| ------- | -------------------------------------------------------------------------------- |
|
|
26
|
-
| `bgm` | background music (HeyGen catalog, 10k+ tracks)
|
|
27
|
-
| `sfx` | sound effects (bundled 19-file library + catalog)
|
|
30
|
+
| `bgm` | background music (HeyGen catalog via the `heygen` CLI, 10k+ tracks) |
|
|
31
|
+
| `sfx` | sound effects (bundled 19-file library + catalog via the `heygen` CLI) |
|
|
28
32
|
| `image` | photos, backgrounds (HeyGen asset search, 75k+ vectors) |
|
|
29
33
|
| `icon` | icons, symbols (transparent) |
|
|
30
34
|
| `logo` | official brand marks (theSVG → GitHub avatar → favicon; never redrawn) |
|
|
@@ -1,16 +1,51 @@
|
|
|
1
1
|
import { fetchMedia } from "../../../scripts/lib/media-fetch.mjs";
|
|
2
2
|
// heygen.mjs — vendored HeyGen REST helpers (auth + transport) for the audio
|
|
3
3
|
// pipeline. The credential resolver matches the hyperframes CLI auth: first
|
|
4
|
-
// usable source wins — a host
|
|
4
|
+
// usable source wins — a host gateway ($HEYGEN_API_BASE with its own
|
|
5
|
+
// $HEYGEN_API_KEY) → a host-injected OAuth $HEYGEN_ACCESS_TOKEN (Bearer) →
|
|
5
6
|
// $HEYGEN_API_KEY / $HYPERFRAMES_API_KEY → a nearby .env → ~/.heygen/
|
|
6
7
|
// credentials (oauth → Bearer, else api_key → X-Api-Key; $HEYGEN_CONFIG_DIR
|
|
7
|
-
// overrides the dir).
|
|
8
|
+
// overrides the dir). $HEYGEN_API_BASE moves every request to that host, as it
|
|
9
|
+
// does for the heygen CLI; plain HTTP needs $HEYGEN_ALLOW_HTTP=1, as there.
|
|
10
|
+
// Vendored so the skill ships standalone. Pure node.
|
|
8
11
|
|
|
9
12
|
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
10
13
|
import { homedir } from "node:os";
|
|
11
14
|
import { dirname, join, resolve } from "node:path";
|
|
12
15
|
|
|
13
16
|
export const HEYGEN_BASE = "https://api.heygen.com/v3";
|
|
17
|
+
|
|
18
|
+
// The v3 base every request goes to: $HEYGEN_API_BASE when a host app names its own gateway (HyperFrames Desktop
|
|
19
|
+
// forwards it to HeyGen with the API key saved in its Settings), else HeyGen's public API. Plain HTTP carries the key
|
|
20
|
+
// in the clear, so it needs $HEYGEN_ALLOW_HTTP=1, the heygen CLI's own rule.
|
|
21
|
+
export function heygenBase() {
|
|
22
|
+
const host = process.env.HEYGEN_API_BASE?.trim().replace(/\/+$/, "");
|
|
23
|
+
if (!host) return HEYGEN_BASE;
|
|
24
|
+
if (host.startsWith("http://") && process.env.HEYGEN_ALLOW_HTTP !== "1")
|
|
25
|
+
throw new Error(
|
|
26
|
+
`HEYGEN_API_BASE (${host}) uses HTTP, which sends the key in plaintext. Set HEYGEN_ALLOW_HTTP=1 to allow it.`,
|
|
27
|
+
);
|
|
28
|
+
return `${host}/v3`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// No base override, or one on HeyGen's own hosts (a canary or dev API).
|
|
32
|
+
function heygenOwnBase() {
|
|
33
|
+
const host = process.env.HEYGEN_API_BASE?.trim();
|
|
34
|
+
if (!host) return true;
|
|
35
|
+
try {
|
|
36
|
+
const name = new URL(host).hostname;
|
|
37
|
+
return name === "heygen.com" || name.endsWith(".heygen.com");
|
|
38
|
+
} catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// A host gateway: the host named its own API base and the key that base accepts. It pays for every call, so it wins
|
|
44
|
+
// over any other credential the environment carries.
|
|
45
|
+
const hostGatewayKey = () =>
|
|
46
|
+
process.env.HEYGEN_API_BASE?.trim() && process.env.HEYGEN_API_KEY
|
|
47
|
+
? process.env.HEYGEN_API_KEY
|
|
48
|
+
: null;
|
|
14
49
|
export const HEYGEN_CLI_SOURCE_HEADERS = { "X-HeyGen-Source": "cli" };
|
|
15
50
|
// Tool-attribution sent on EVERY media-use HeyGen call regardless of auth type, so
|
|
16
51
|
// the backend can isolate media-use consumption from other free TTS / avatar video.
|
|
@@ -29,6 +64,10 @@ function envFileText(path) {
|
|
|
29
64
|
}
|
|
30
65
|
}
|
|
31
66
|
|
|
67
|
+
// A host app sets these in the environment it spawns, never in a project file: a project's .env naming its own base
|
|
68
|
+
// would send the person's shell HEYGEN_API_KEY to that host.
|
|
69
|
+
const HOST_ONLY = new Set(["HEYGEN_API_BASE", "HEYGEN_ALLOW_HTTP"]);
|
|
70
|
+
|
|
32
71
|
// Walk up ≤5 dirs from startDir; load the first .env (shell env always wins).
|
|
33
72
|
export function loadEnvFromDir(startDir) {
|
|
34
73
|
let dir = resolve(startDir);
|
|
@@ -48,7 +87,7 @@ export function loadEnvFromDir(startDir) {
|
|
|
48
87
|
const end = val.indexOf(q, 1);
|
|
49
88
|
val = end > 0 ? val.slice(1, end) : val.slice(1);
|
|
50
89
|
}
|
|
51
|
-
if (!(key in process.env)) process.env[key] = val;
|
|
90
|
+
if (!HOST_ONLY.has(key) && !(key in process.env)) process.env[key] = val;
|
|
52
91
|
}
|
|
53
92
|
return;
|
|
54
93
|
}
|
|
@@ -68,6 +107,10 @@ export function heygenCredential() {
|
|
|
68
107
|
// (a folder, a locked ~/.heygen), so heygenAuthHeaders can say to fix that path: logging in again would fail there too.
|
|
69
108
|
// Read without checking first, so the file cannot change between a check and the read.
|
|
70
109
|
function resolveCredential() {
|
|
110
|
+
const gatewayKey = hostGatewayKey();
|
|
111
|
+
if (gatewayKey) return { headers: { "X-Api-Key": gatewayKey } };
|
|
112
|
+
// Every other credential belongs to HeyGen: a base on any other host gets none of them.
|
|
113
|
+
if (!heygenOwnBase()) return null;
|
|
71
114
|
const accessToken = process.env.HEYGEN_ACCESS_TOKEN;
|
|
72
115
|
if (accessToken) return { headers: { Authorization: `Bearer ${accessToken}` } };
|
|
73
116
|
const envKey = process.env.HEYGEN_API_KEY || process.env.HYPERFRAMES_API_KEY;
|
|
@@ -144,7 +187,7 @@ export async function heygenJSON(path, { method = "GET", headers = {}, body } =
|
|
|
144
187
|
opts.headers["Content-Type"] = "application/json";
|
|
145
188
|
opts.body = JSON.stringify(body);
|
|
146
189
|
}
|
|
147
|
-
const res = await fetch(`${
|
|
190
|
+
const res = await fetch(`${heygenBase()}${path}`, opts);
|
|
148
191
|
if (!res.ok) {
|
|
149
192
|
const detail = await res.text().catch(() => "");
|
|
150
193
|
const message = `HeyGen ${method} ${path} → HTTP ${res.status}${detail ? `\n${detail.slice(0, 300)}` : ""}`;
|
|
@@ -1,36 +1,47 @@
|
|
|
1
1
|
import { test } from "node:test";
|
|
2
2
|
import assert from "node:assert/strict";
|
|
3
3
|
import { mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { createServer } from "node:http";
|
|
4
5
|
import { tmpdir } from "node:os";
|
|
5
6
|
import { join } from "node:path";
|
|
6
7
|
import {
|
|
7
8
|
heygenAuthHeaders,
|
|
8
9
|
heygenAuthMethod,
|
|
10
|
+
heygenBase,
|
|
9
11
|
heygenCredential,
|
|
12
|
+
heygenJSON,
|
|
10
13
|
loadEnvFromDir,
|
|
11
14
|
} from "./heygen.mjs";
|
|
12
15
|
|
|
16
|
+
const HEYGEN_ENV = [
|
|
17
|
+
"HEYGEN_ACCESS_TOKEN",
|
|
18
|
+
"HEYGEN_API_KEY",
|
|
19
|
+
"HYPERFRAMES_API_KEY",
|
|
20
|
+
"HEYGEN_CONFIG_DIR",
|
|
21
|
+
"HEYGEN_API_BASE",
|
|
22
|
+
"HEYGEN_ALLOW_HTTP",
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
// Runs fn with every HeyGen variable unset, then puts them back; an async fn restores once it settles.
|
|
13
26
|
function withCleanHeygenEnv(fn) {
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
27
|
+
const previous = Object.fromEntries(HEYGEN_ENV.map((name) => [name, process.env[name]]));
|
|
28
|
+
const restore = () => {
|
|
29
|
+
for (const [name, value] of Object.entries(previous)) {
|
|
30
|
+
if (value === undefined) delete process.env[name];
|
|
31
|
+
else process.env[name] = value;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
for (const name of HEYGEN_ENV) delete process.env[name];
|
|
35
|
+
let result;
|
|
18
36
|
try {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return fn();
|
|
24
|
-
} finally {
|
|
25
|
-
if (previousAccessToken === undefined) delete process.env.HEYGEN_ACCESS_TOKEN;
|
|
26
|
-
else process.env.HEYGEN_ACCESS_TOKEN = previousAccessToken;
|
|
27
|
-
if (previousApiKey === undefined) delete process.env.HEYGEN_API_KEY;
|
|
28
|
-
else process.env.HEYGEN_API_KEY = previousApiKey;
|
|
29
|
-
if (previousHyperframesApiKey === undefined) delete process.env.HYPERFRAMES_API_KEY;
|
|
30
|
-
else process.env.HYPERFRAMES_API_KEY = previousHyperframesApiKey;
|
|
31
|
-
if (previousConfigDir === undefined) delete process.env.HEYGEN_CONFIG_DIR;
|
|
32
|
-
else process.env.HEYGEN_CONFIG_DIR = previousConfigDir;
|
|
37
|
+
result = fn();
|
|
38
|
+
} catch (error) {
|
|
39
|
+
restore();
|
|
40
|
+
throw error;
|
|
33
41
|
}
|
|
42
|
+
if (result && typeof result.then === "function") return result.finally(restore);
|
|
43
|
+
restore();
|
|
44
|
+
return result;
|
|
34
45
|
}
|
|
35
46
|
|
|
36
47
|
test("heygenAuthHeaders does not tag API-key requests as CLI traffic, but still carries the media-use tool tag", () => {
|
|
@@ -138,6 +149,27 @@ test("loadEnvFromDir skips a .env folder and loads the .env file above it", () =
|
|
|
138
149
|
}
|
|
139
150
|
});
|
|
140
151
|
|
|
152
|
+
test("a project's .env cannot name the HeyGen base, so a shell key never leaves for its host", () => {
|
|
153
|
+
withCleanHeygenEnv(() => {
|
|
154
|
+
const project = mkdtempSync(join(tmpdir(), "heygen-env-"));
|
|
155
|
+
writeFileSync(
|
|
156
|
+
join(project, ".env"),
|
|
157
|
+
"HEYGEN_API_BASE=https://proxy.example.com\nHEYGEN_ALLOW_HTTP=1\nMEDIA_USE_ENV_BASE_TEST=loaded\n",
|
|
158
|
+
);
|
|
159
|
+
try {
|
|
160
|
+
process.env.HEYGEN_API_KEY = "hg_shell_real";
|
|
161
|
+
loadEnvFromDir(project);
|
|
162
|
+
assert.equal(process.env.MEDIA_USE_ENV_BASE_TEST, "loaded");
|
|
163
|
+
assert.equal(process.env.HEYGEN_API_BASE, undefined);
|
|
164
|
+
assert.equal(process.env.HEYGEN_ALLOW_HTTP, undefined);
|
|
165
|
+
assert.equal(heygenBase(), "https://api.heygen.com/v3");
|
|
166
|
+
} finally {
|
|
167
|
+
delete process.env.MEDIA_USE_ENV_BASE_TEST;
|
|
168
|
+
rmSync(project, { recursive: true, force: true });
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
141
173
|
test("heygenAuthMethod returns null when the credentials path is a folder", () => {
|
|
142
174
|
withCleanHeygenEnv(() => {
|
|
143
175
|
const dir = mkdtempSync(join(tmpdir(), "heygen-cred-"));
|
|
@@ -183,3 +215,78 @@ test("heygenAuthHeaders says to fix an unreadable credentials path, and to log i
|
|
|
183
215
|
}
|
|
184
216
|
});
|
|
185
217
|
});
|
|
218
|
+
|
|
219
|
+
test("heygenBase is HeyGen's public API unless a host names another", () => {
|
|
220
|
+
withCleanHeygenEnv(() => {
|
|
221
|
+
assert.equal(heygenBase(), "https://api.heygen.com/v3");
|
|
222
|
+
process.env.HEYGEN_API_BASE = "https://api-canary.heygen.com/";
|
|
223
|
+
assert.equal(heygenBase(), "https://api-canary.heygen.com/v3");
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
test("heygenBase refuses a plain-HTTP host unless HEYGEN_ALLOW_HTTP is set, as the heygen CLI does", () => {
|
|
228
|
+
withCleanHeygenEnv(() => {
|
|
229
|
+
process.env.HEYGEN_API_BASE = "http://127.0.0.1:4100";
|
|
230
|
+
assert.throws(() => heygenBase(), /HEYGEN_ALLOW_HTTP=1/);
|
|
231
|
+
process.env.HEYGEN_ALLOW_HTTP = "1";
|
|
232
|
+
assert.equal(heygenBase(), "http://127.0.0.1:4100/v3");
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
test("a host gateway (HEYGEN_API_BASE with its own HEYGEN_API_KEY) wins over a host OAuth token", () => {
|
|
237
|
+
withCleanHeygenEnv(() => {
|
|
238
|
+
process.env.HEYGEN_API_BASE = "http://127.0.0.1:4100";
|
|
239
|
+
process.env.HEYGEN_ALLOW_HTTP = "1";
|
|
240
|
+
process.env.HEYGEN_API_KEY = "gateway-token";
|
|
241
|
+
process.env.HEYGEN_ACCESS_TOKEN = "at_host";
|
|
242
|
+
assert.deepEqual(heygenAuthHeaders(), {
|
|
243
|
+
"X-Api-Key": "gateway-token",
|
|
244
|
+
"X-HeyGen-Client-Source": "media-use",
|
|
245
|
+
});
|
|
246
|
+
assert.equal(heygenAuthMethod(), "api_key");
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
test("heygenJSON sends its request to the host's HEYGEN_API_BASE with the host's key", async () => {
|
|
251
|
+
/** @type {{ url?: string, key?: string | string[] }} */
|
|
252
|
+
const seen = {};
|
|
253
|
+
const server = createServer((req, res) => {
|
|
254
|
+
seen.url = req.url;
|
|
255
|
+
seen.key = req.headers["x-api-key"];
|
|
256
|
+
res.writeHead(200, { "content-type": "application/json" }).end('{"data":[]}');
|
|
257
|
+
});
|
|
258
|
+
await new Promise((done) => server.listen(0, "127.0.0.1", done));
|
|
259
|
+
const { port } = /** @type {import("node:net").AddressInfo} */ (server.address());
|
|
260
|
+
try {
|
|
261
|
+
await withCleanHeygenEnv(async () => {
|
|
262
|
+
process.env.HEYGEN_API_BASE = `http://127.0.0.1:${port}`;
|
|
263
|
+
process.env.HEYGEN_ALLOW_HTTP = "1";
|
|
264
|
+
process.env.HEYGEN_API_KEY = "gateway-token";
|
|
265
|
+
const reply = await heygenJSON("/voices?limit=1", { headers: heygenAuthHeaders() });
|
|
266
|
+
assert.deepEqual(reply, { data: [] });
|
|
267
|
+
});
|
|
268
|
+
assert.equal(seen.url, "/v3/voices?limit=1");
|
|
269
|
+
assert.equal(seen.key, "gateway-token");
|
|
270
|
+
} finally {
|
|
271
|
+
server.close();
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
test("a base that isn't HeyGen's gets no stored or host OAuth credential, only a key named for it", () => {
|
|
276
|
+
withCleanHeygenEnv(() => {
|
|
277
|
+
const dir = mkdtempSync(join(tmpdir(), "heygen-cred-"));
|
|
278
|
+
try {
|
|
279
|
+
process.env.HEYGEN_CONFIG_DIR = dir;
|
|
280
|
+
writeFileSync(join(dir, "credentials"), JSON.stringify({ api_key: "hg_stored" }));
|
|
281
|
+
process.env.HEYGEN_ACCESS_TOKEN = "at_host";
|
|
282
|
+
process.env.HEYGEN_API_BASE = "https://proxy.example.com";
|
|
283
|
+
assert.equal(heygenCredential(), null);
|
|
284
|
+
assert.throws(() => heygenAuthHeaders(), /no HeyGen credentials/);
|
|
285
|
+
// HeyGen's own hosts keep every credential source.
|
|
286
|
+
process.env.HEYGEN_API_BASE = "https://api-canary.heygen.com";
|
|
287
|
+
assert.equal(heygenAuthMethod(), "oauth");
|
|
288
|
+
} finally {
|
|
289
|
+
rmSync(dir, { recursive: true, force: true });
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Audio the host app supplied survives every pass that rebuilds audio_meta.json from the storyboard: an entry
|
|
2
|
+
// marked "source": "host" whose file exists. A frame the host scored takes no looked-up cue sound.
|
|
3
|
+
/** The host's own entries in an earlier audio_meta.json, and why any other host-marked entry was dropped; `exists`
|
|
4
|
+
* resolves a path from the project root. A frame written as "1" is frame 1. */
|
|
5
|
+
export function hostAudio(previous, exists) {
|
|
6
|
+
const marked = [[previous?.bgm, "path"], ...(previous?.sfx ?? []).map((s) => [s, "file"])].filter(
|
|
7
|
+
([entry]) => entry?.source === "host",
|
|
8
|
+
);
|
|
9
|
+
const kept = new Set();
|
|
10
|
+
const dropped = [];
|
|
11
|
+
for (const [entry, key] of marked) {
|
|
12
|
+
const path = entry[key];
|
|
13
|
+
if (typeof path !== "string") dropped.push(`a host entry has no "${key}"`);
|
|
14
|
+
else if (!exists(path)) dropped.push(`${path} is not on disk`);
|
|
15
|
+
else kept.add(entry);
|
|
16
|
+
}
|
|
17
|
+
const bgm = kept.has(previous?.bgm) ? previous.bgm : null;
|
|
18
|
+
const sfx = (previous?.sfx ?? [])
|
|
19
|
+
.filter((s) => kept.has(s))
|
|
20
|
+
.map((s) => ({ ...s, frame: Number(s.frame) }));
|
|
21
|
+
return { bgm, sfx, frames: new Set(sfx.map((s) => s.frame)), dropped };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** `rebuilt` with the host's bed and sounds put back; the host's bed wins over a looked-up one. */
|
|
25
|
+
export function keepHostAudio(rebuilt, host) {
|
|
26
|
+
const looked = (rebuilt.sfx ?? []).filter((s) => !host.frames.has(s.frame));
|
|
27
|
+
return { ...rebuilt, bgm: host.bgm ?? rebuilt.bgm, sfx: [...host.sfx, ...looked] };
|
|
28
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import test from "node:test";
|
|
4
|
+
import { hostAudio, keepHostAudio } from "./host-audio.mjs";
|
|
5
|
+
|
|
6
|
+
const onDisk = new Set([
|
|
7
|
+
"assets/bgm/host.mp3",
|
|
8
|
+
"assets/sfx/custom-whoosh.mp3",
|
|
9
|
+
"assets/sfx/whoosh.mp3",
|
|
10
|
+
]);
|
|
11
|
+
const exists = (path) => onDisk.has(path);
|
|
12
|
+
const hostWhoosh = {
|
|
13
|
+
frame: 1,
|
|
14
|
+
file: "assets/sfx/custom-whoosh.mp3",
|
|
15
|
+
offset_s: 0,
|
|
16
|
+
duration_s: 2,
|
|
17
|
+
source: "host",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
test("a host sound and bed survive a rebuild, and the host's frame takes no looked-up sound", () => {
|
|
21
|
+
const previous = {
|
|
22
|
+
bgm: { path: "assets/bgm/host.mp3", source: "host" },
|
|
23
|
+
sfx: [hostWhoosh, { frame: 2, file: "assets/sfx/whoosh.mp3", offset_s: 0 }],
|
|
24
|
+
};
|
|
25
|
+
const rebuilt = {
|
|
26
|
+
bgm: null,
|
|
27
|
+
voices: [],
|
|
28
|
+
sfx: [
|
|
29
|
+
{ frame: 1, file: "assets/sfx/whoosh.mp3", offset_s: 0 },
|
|
30
|
+
{ frame: 2, file: "assets/sfx/whoosh.mp3", offset_s: 0 },
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
const kept = keepHostAudio(rebuilt, hostAudio(previous, exists));
|
|
34
|
+
assert.deepEqual(kept.bgm, previous.bgm);
|
|
35
|
+
assert.deepEqual(kept.sfx, [hostWhoosh, rebuilt.sfx[1]]);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("an unmarked entry or a missing file is not the host's", () => {
|
|
39
|
+
const previous = {
|
|
40
|
+
bgm: { path: "assets/bgm/gone.mp3", source: "host" },
|
|
41
|
+
sfx: [
|
|
42
|
+
{ frame: 1, file: "assets/sfx/whoosh.mp3", offset_s: 0 },
|
|
43
|
+
{ frame: 3, file: "assets/sfx/gone.mp3", source: "host" },
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
const host = hostAudio(previous, exists);
|
|
47
|
+
assert.equal(host.bgm, null);
|
|
48
|
+
assert.deepEqual(host.sfx, []);
|
|
49
|
+
const rebuilt = { bgm: { path: "assets/bgm/looked.mp3" }, voices: [], sfx: [] };
|
|
50
|
+
assert.deepEqual(keepHostAudio(rebuilt, host), rebuilt);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test("no earlier audio_meta.json keeps the rebuild as it is", () => {
|
|
54
|
+
const rebuilt = { bgm: null, voices: [], sfx: [{ frame: 1, file: "assets/sfx/whoosh.mp3" }] };
|
|
55
|
+
assert.deepEqual(keepHostAudio(rebuilt, hostAudio(null, exists)), rebuilt);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// The narrated workflows tell the agent the same host-audio contract and the same meaning of silent.
|
|
59
|
+
const workflowText = (skill, file) =>
|
|
60
|
+
readFileSync(new URL(`../../../../${skill}/${file}`, import.meta.url), "utf8");
|
|
61
|
+
|
|
62
|
+
test("each narrated workflow tells a host app's music and sounds the way in, and when a film is silent", () => {
|
|
63
|
+
for (const skill of ["product-launch-video", "pr-to-video", "faceless-explainer"]) {
|
|
64
|
+
const steps = workflowText(skill, "SKILL.md");
|
|
65
|
+
assert.match(
|
|
66
|
+
steps,
|
|
67
|
+
/host app's own tools make the music or a sound effect[^\n]+"source": "host"/,
|
|
68
|
+
skill,
|
|
69
|
+
);
|
|
70
|
+
assert.match(steps, /"duration_s": <its length>[^\n]+Every audio pass keeps these/, skill);
|
|
71
|
+
assert.match(steps, /no `SCRIPT.md`, \*\*and\*\* no `sfx:` cues or host audio/, skill);
|
|
72
|
+
assert.match(
|
|
73
|
+
steps,
|
|
74
|
+
/marked silent \(`music: none`, no `SCRIPT.md`, no `sfx:` cues or host audio\)/,
|
|
75
|
+
skill,
|
|
76
|
+
);
|
|
77
|
+
assert.match(
|
|
78
|
+
workflowText(skill, "references/story-design.md"),
|
|
79
|
+
/no `SCRIPT.md` \+ no `sfx:` cues or host audio\*\* — the canonical/,
|
|
80
|
+
skill,
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test("a frame written as a string is the same frame, and a gone host file is reported", () => {
|
|
86
|
+
const previous = {
|
|
87
|
+
bgm: { path: "assets/bgm/gone.mp3", source: "host" },
|
|
88
|
+
sfx: [{ ...hostWhoosh, frame: "1" }],
|
|
89
|
+
};
|
|
90
|
+
const host = hostAudio(previous, exists);
|
|
91
|
+
assert.deepEqual(host.sfx, [hostWhoosh]);
|
|
92
|
+
assert.ok(host.frames.has(1));
|
|
93
|
+
assert.deepEqual(host.dropped, ["assets/bgm/gone.mp3 is not on disk"]);
|
|
94
|
+
const rebuilt = { bgm: null, voices: [], sfx: [{ frame: 1, file: "assets/sfx/whoosh.mp3" }] };
|
|
95
|
+
assert.deepEqual(keepHostAudio(rebuilt, host).sfx, [hostWhoosh]);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test("a host entry with no path is reported, not thrown", () => {
|
|
99
|
+
const throwsOnNonString = (path) => {
|
|
100
|
+
if (typeof path !== "string") throw new TypeError("path must be a string");
|
|
101
|
+
return onDisk.has(path);
|
|
102
|
+
};
|
|
103
|
+
const host = hostAudio({ bgm: { src: "x.mp3", source: "host" }, sfx: [] }, throwsOnNonString);
|
|
104
|
+
assert.equal(host.bgm, null);
|
|
105
|
+
assert.deepEqual(host.dropped, ['a host entry has no "path"']);
|
|
106
|
+
});
|
|
@@ -15,11 +15,25 @@ This unlocks the FREE path for bgm/sfx/image/icon catalog search, TTS (voice), a
|
|
|
15
15
|
npx hyperframes media-use resolve --doctor
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
## Host HeyGen access (no CLI sign-in)
|
|
19
|
+
|
|
20
|
+
A host app can give media-use HeyGen access of its own by setting
|
|
21
|
+
`HEYGEN_API_BASE` (its gateway), `HEYGEN_API_KEY` (the token that gateway
|
|
22
|
+
accepts) and, for a loopback gateway, `HEYGEN_ALLOW_HTTP=1`. The gateway adds
|
|
23
|
+
the host's key, so it never enters the agent's environment, and every
|
|
24
|
+
call is charged to that key's API credits. The `heygen` CLI honours the same
|
|
25
|
+
variables, so `resolve` (bgm/sfx/image/icon/voice/avatar-video) and the audio
|
|
26
|
+
engine's TTS all go through the host. With host access, skip CLI install and
|
|
27
|
+
sign-in, prefer the host's own HeyGen tools where it has them, never fall back
|
|
28
|
+
to a local or third-party generator on your own, and relay a refused call's
|
|
29
|
+
message (for example "add a key in Settings > Account") as written.
|
|
30
|
+
|
|
18
31
|
## Providers
|
|
19
32
|
|
|
20
33
|
media-use holds no keys; every external tool owns its auth. Generation is
|
|
21
34
|
centered on the HeyGen CLI free-usage path. Install and authenticate `heygen`
|
|
22
|
-
before resolving bgm/sfx/image/icon/voice/avatar-video
|
|
35
|
+
before resolving bgm/sfx/image/icon/voice/avatar-video; music and sound effects from
|
|
36
|
+
a host app's own tools need none of it. Local tools are opt-in
|
|
23
37
|
alternatives where they exist: mflux for image, Kokoro for voice, Parakeet for
|
|
24
38
|
transcription, and LTX for local video generation. `resolve` spec-checks
|
|
25
39
|
AVAILABLE RAM for those local ladders (`describeModelLadder`); the agent can
|
|
@@ -27,7 +41,7 @@ see the ladder and override.
|
|
|
27
41
|
|
|
28
42
|
| Type | Provider / path |
|
|
29
43
|
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
30
|
-
| bgm/sfx | heygen catalog free-usage path
|
|
44
|
+
| bgm/sfx | heygen catalog free-usage path; a host app's own music and sound tools come first |
|
|
31
45
|
| image | heygen search free-usage path; optional local mflux; codex `image_gen` upsell |
|
|
32
46
|
| voice | heygen tts free-usage path; optional local **Kokoro** (free, on-device) |
|
|
33
47
|
| icon | heygen asset search free-usage path |
|
|
@@ -68,7 +68,11 @@ function classifyHeygenErrorResult(err) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
const version = firstSemver(text);
|
|
71
|
-
|
|
71
|
+
// A CLI older than the --headers flag rejects it before printing any version.
|
|
72
|
+
if (
|
|
73
|
+
(version && versionLessThan(version, HEYGEN_MIN_VERSION)) ||
|
|
74
|
+
lower.includes("unknown flag: --headers")
|
|
75
|
+
) {
|
|
72
76
|
return { code: "outdated", message: HEYGEN_OUTDATED_MESSAGE };
|
|
73
77
|
}
|
|
74
78
|
|
|
@@ -98,6 +102,22 @@ const pendingFailureTracking = new Set();
|
|
|
98
102
|
// API, move this state into a per-resolve context before reusing that path.
|
|
99
103
|
let pendingRemediation = null;
|
|
100
104
|
|
|
105
|
+
const TOOL_WORDS = { bgm: "music", sfx: "sound-effect" };
|
|
106
|
+
|
|
107
|
+
/** A music or sound-effect resolve miss after the heygen CLI was missing or too old: what is missing, the host
|
|
108
|
+
* app's own tool, the fix. Other types keep the generic miss. */
|
|
109
|
+
export function heygenMiss(type, { code }) {
|
|
110
|
+
const tool = TOOL_WORDS[type];
|
|
111
|
+
if (!tool) return null;
|
|
112
|
+
const outdated = code === "outdated";
|
|
113
|
+
const state = outdated ? `older than v${HEYGEN_MIN_VERSION}` : "not installed";
|
|
114
|
+
return {
|
|
115
|
+
code: outdated ? "heygen_cli_outdated" : "heygen_cli_missing",
|
|
116
|
+
fix: outdated ? HEYGEN_UPDATE_COMMAND : HEYGEN_INSTALL_COMMAND,
|
|
117
|
+
error: `${type} needs the heygen CLI, which is ${state}: use your host app's own ${tool} tool if it has one, or ${outdated ? "update" : "install"} the CLI.`,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
101
121
|
export function consumeHeygenRemediation() {
|
|
102
122
|
const remediation = pendingRemediation;
|
|
103
123
|
pendingRemediation = null;
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
HEYGEN_NOT_AUTHENTICATED_MESSAGE,
|
|
10
10
|
HEYGEN_NOT_FOUND_MESSAGE,
|
|
11
11
|
HEYGEN_OUTDATED_MESSAGE,
|
|
12
|
+
heygenMiss,
|
|
12
13
|
reportHeygenFailure,
|
|
13
14
|
} from "./heygen-cli.mjs";
|
|
14
15
|
|
|
@@ -299,3 +300,16 @@ test("flushHeygenFailureTracking waits for a pending report before resolving", a
|
|
|
299
300
|
test("flushHeygenFailureTracking resolves immediately when nothing is pending", async () => {
|
|
300
301
|
await flushHeygenFailureTracking();
|
|
301
302
|
});
|
|
303
|
+
|
|
304
|
+
test("only a music or sound-effect miss names the heygen CLI and the host app's own tool", () => {
|
|
305
|
+
for (const type of ["image", "icon", "voice", "video"])
|
|
306
|
+
assert.equal(heygenMiss(type, { code: "not_found" }), null, type);
|
|
307
|
+
assert.equal(heygenMiss("bgm", { code: "not_found" }).code, "heygen_cli_missing");
|
|
308
|
+
const sfx = heygenMiss("sfx", { code: "outdated" });
|
|
309
|
+
assert.equal(sfx.code, "heygen_cli_outdated");
|
|
310
|
+
assert.match(sfx.error, /host app's own sound-effect tool/);
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
test("a CLI that rejects --headers without printing a version is outdated", () => {
|
|
314
|
+
assert.equal(classifyHeygenErrorCode({ stderr: "Error: unknown flag: --headers" }), "outdated");
|
|
315
|
+
});
|
|
@@ -49,6 +49,7 @@ import {
|
|
|
49
49
|
HEYGEN_MIN_VERSION,
|
|
50
50
|
HEYGEN_UPDATE_COMMAND,
|
|
51
51
|
consumeHeygenRemediation,
|
|
52
|
+
heygenMiss,
|
|
52
53
|
firstSemver,
|
|
53
54
|
flushHeygenFailureTracking,
|
|
54
55
|
versionLessThan,
|
|
@@ -530,10 +531,16 @@ async function run() {
|
|
|
530
531
|
});
|
|
531
532
|
// brand stays local: no frame.md/design.md -> upsell the HyperFrames design
|
|
532
533
|
// flow rather than reporting a generic miss (B5).
|
|
533
|
-
const
|
|
534
|
+
const ownFailure =
|
|
534
535
|
providerFailure instanceof BundledSfxAssetsError ||
|
|
535
|
-
providerFailure instanceof FfBinarySettingError
|
|
536
|
-
|
|
536
|
+
providerFailure instanceof FfBinarySettingError;
|
|
537
|
+
const heygen = consumeHeygenRemediation();
|
|
538
|
+
const miss = heygen && !ownFailure ? heygenMiss(type, heygen) : null;
|
|
539
|
+
const typed = providerFailure instanceof BundledSfxAssetsError ? providerFailure : miss;
|
|
540
|
+
const msg = ownFailure
|
|
541
|
+
? providerFailure.message
|
|
542
|
+
: miss
|
|
543
|
+
? miss.error
|
|
537
544
|
: type === "brand"
|
|
538
545
|
? "no brand spec found — add a frame.md or design.md (colors/font/logo) to this project. Run the HyperFrames design flow to create one; brand tokens are read locally for deterministic rendering."
|
|
539
546
|
: args.provider
|
|
@@ -543,9 +550,7 @@ async function run() {
|
|
|
543
550
|
console.log(
|
|
544
551
|
JSON.stringify({
|
|
545
552
|
ok: false,
|
|
546
|
-
...(
|
|
547
|
-
? { code: providerFailure.code, fix: providerFailure.fix }
|
|
548
|
-
: {}),
|
|
553
|
+
...(typed ? { code: typed.code, fix: typed.fix } : {}),
|
|
549
554
|
error: msg,
|
|
550
555
|
}),
|
|
551
556
|
);
|