visualfries 0.1.10115 → 0.3.2

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.
Files changed (139) hide show
  1. package/README.md +122 -0
  2. package/bin/visualfries.js +1570 -0
  3. package/dist/DIContainer.d.ts +2 -1
  4. package/dist/DIContainer.js +16 -5
  5. package/dist/SceneBuilder.svelte.d.ts +70 -1
  6. package/dist/SceneBuilder.svelte.js +96 -29
  7. package/dist/agent/audioMixer.d.ts +34 -0
  8. package/dist/agent/audioMixer.js +308 -0
  9. package/dist/agent/broll.d.ts +35 -0
  10. package/dist/agent/broll.js +226 -0
  11. package/dist/agent/capabilities.d.ts +34 -0
  12. package/dist/agent/capabilities.js +246 -0
  13. package/dist/agent/captionScene.d.ts +23 -0
  14. package/dist/agent/captionScene.js +204 -0
  15. package/dist/agent/catalog.d.ts +24 -0
  16. package/dist/agent/catalog.js +67 -0
  17. package/dist/agent/cueFiles.d.ts +54 -0
  18. package/dist/agent/cueFiles.js +219 -0
  19. package/dist/agent/cuePresets.d.ts +7 -0
  20. package/dist/agent/cuePresets.js +50 -0
  21. package/dist/agent/deterministicMedia.d.ts +61 -0
  22. package/dist/agent/deterministicMedia.js +303 -0
  23. package/dist/agent/index.d.ts +18 -0
  24. package/dist/agent/index.js +18 -0
  25. package/dist/agent/inspectScene.d.ts +36 -0
  26. package/dist/agent/inspectScene.js +139 -0
  27. package/dist/agent/localRender.d.ts +82 -0
  28. package/dist/agent/localRender.js +702 -0
  29. package/dist/agent/overlays.d.ts +40 -0
  30. package/dist/agent/overlays.js +325 -0
  31. package/dist/agent/productionPlan.d.ts +131 -0
  32. package/dist/agent/productionPlan.js +322 -0
  33. package/dist/agent/renderPlan.d.ts +27 -0
  34. package/dist/agent/renderPlan.js +68 -0
  35. package/dist/agent/renderRanges.d.ts +24 -0
  36. package/dist/agent/renderRanges.js +73 -0
  37. package/dist/agent/runtimeSupport.d.ts +19 -0
  38. package/dist/agent/runtimeSupport.js +192 -0
  39. package/dist/agent/streamingEncoder.d.ts +31 -0
  40. package/dist/agent/streamingEncoder.js +208 -0
  41. package/dist/agent/transcripts.d.ts +29 -0
  42. package/dist/agent/transcripts.js +146 -0
  43. package/dist/agent/transitions.d.ts +20 -0
  44. package/dist/agent/transitions.js +169 -0
  45. package/dist/animations/PixiAnimationTarget.d.ts +29 -0
  46. package/dist/animations/PixiAnimationTarget.js +63 -0
  47. package/dist/animations/builders/LineHighlighterAnimationBuilder.js +20 -3
  48. package/dist/animations/builders/WordHighlighterAnimationBuilder.js +15 -2
  49. package/dist/browser/browserExport.d.ts +73 -0
  50. package/dist/browser/browserExport.js +180 -0
  51. package/dist/browser/glTransitions.d.ts +37 -0
  52. package/dist/browser/glTransitions.js +261 -0
  53. package/dist/browser/index.d.ts +3 -0
  54. package/dist/browser/index.js +3 -0
  55. package/dist/browser/mediaDecode.d.ts +31 -0
  56. package/dist/browser/mediaDecode.js +152 -0
  57. package/dist/builders/PixiComponentBuilder.d.ts +6 -0
  58. package/dist/builders/PixiComponentBuilder.js +12 -0
  59. package/dist/builders/_ComponentState.svelte.d.ts +7 -5
  60. package/dist/builders/_ComponentState.svelte.js +29 -15
  61. package/dist/builders/html/StyleBuilder.js +9 -8
  62. package/dist/builders/html/TextComponentHtmlBuilder.js +4 -2
  63. package/dist/builders/html/processors/AppearanceStyleProcessor.js +1 -1
  64. package/dist/builders/html/processors/TextAppearanceStyleProcessor.js +7 -0
  65. package/dist/builders/html/processors/TextEffectsStyleProcessor.js +32 -13
  66. package/dist/commands/ReplaceSourceOnTimeCommand.js +9 -1
  67. package/dist/commands/SeekCommand.js +19 -6
  68. package/dist/components/AnimatedGIF.d.ts +3 -0
  69. package/dist/components/AnimatedGIF.js +28 -1
  70. package/dist/components/Component.svelte.d.ts +5 -5
  71. package/dist/components/Component.svelte.js +29 -13
  72. package/dist/components/ComponentContext.svelte.js +68 -23
  73. package/dist/components/hooks/AnimationHook.js +1 -1
  74. package/dist/components/hooks/CanvasFillHook.d.ts +12 -0
  75. package/dist/components/hooks/CanvasFillHook.js +75 -0
  76. package/dist/components/hooks/DeterministicMediaFrameHook.js +3 -0
  77. package/dist/components/hooks/HtmlTextHook.js +11 -3
  78. package/dist/components/hooks/HtmlToCanvasHook.js +8 -25
  79. package/dist/components/hooks/MediaHook.js +172 -47
  80. package/dist/components/hooks/MediaSeekingHook.js +138 -88
  81. package/dist/components/hooks/PixiGifHook.js +4 -4
  82. package/dist/components/hooks/PixiSplitScreenDisplayObjectHook.d.ts +3 -0
  83. package/dist/components/hooks/PixiSplitScreenDisplayObjectHook.js +85 -8
  84. package/dist/components/hooks/PixiVideoTextureHook.js +10 -4
  85. package/dist/components/hooks/PixiVisualTransformHook.d.ts +16 -0
  86. package/dist/components/hooks/PixiVisualTransformHook.js +102 -0
  87. package/dist/components/hooks/SubtitlesHook.js +48 -24
  88. package/dist/components/hooks/VerifyMediaHook.js +2 -2
  89. package/dist/directors/ComponentDirector.d.ts +1 -0
  90. package/dist/directors/ComponentDirector.js +41 -8
  91. package/dist/factories/SceneBuilderFactory.d.ts +3 -0
  92. package/dist/factories/SceneBuilderFactory.js +6 -0
  93. package/dist/fonts/fontDiscovery.js +12 -1
  94. package/dist/layers/Layer.svelte.d.ts +54 -0
  95. package/dist/layers/Layer.svelte.js +2 -25
  96. package/dist/managers/AppManager.svelte.d.ts +12 -0
  97. package/dist/managers/AppManager.svelte.js +180 -8
  98. package/dist/managers/ComponentsManager.svelte.d.ts +7 -7
  99. package/dist/managers/ComponentsManager.svelte.js +29 -15
  100. package/dist/managers/DeterministicMediaManager.d.ts +6 -0
  101. package/dist/managers/DeterministicMediaManager.js +57 -3
  102. package/dist/managers/EventManager.js +3 -1
  103. package/dist/managers/LayersManager.svelte.d.ts +54 -0
  104. package/dist/managers/RenderManager.d.ts +5 -0
  105. package/dist/managers/RenderManager.js +67 -21
  106. package/dist/managers/StateManager.svelte.d.ts +56 -0
  107. package/dist/managers/StateManager.svelte.js +60 -58
  108. package/dist/managers/SubtitlesManager.svelte.js +1 -3
  109. package/dist/managers/TimeManager.svelte.d.ts +4 -0
  110. package/dist/managers/TimeManager.svelte.js +23 -7
  111. package/dist/schemas/runtime/deterministic.d.ts +3 -0
  112. package/dist/schemas/runtime/deterministic.js +5 -1
  113. package/dist/schemas/runtime/types.d.ts +36 -15
  114. package/dist/schemas/scene/components.d.ts +126 -0
  115. package/dist/schemas/scene/components.js +11 -0
  116. package/dist/schemas/scene/core.d.ts +109 -10
  117. package/dist/schemas/scene/core.js +1 -1
  118. package/dist/utils/mediaWindow.d.ts +13 -0
  119. package/dist/utils/mediaWindow.js +25 -0
  120. package/dist/utils/svgGenerator.js +1 -1
  121. package/dist/utils/timelineWindow.d.ts +2 -0
  122. package/dist/utils/timelineWindow.js +7 -0
  123. package/dist/utils/utils.js +2 -4
  124. package/docs/AGENT_PATTERNS.md +243 -0
  125. package/docs/AGENT_WORKFLOW.md +364 -0
  126. package/docs/AUTHORING_BEST_PRACTICES.md +188 -0
  127. package/docs/AUTHORING_SYSTEM_AUDIT.md +98 -0
  128. package/docs/BROWSER_EXPORT_SPIKE.md +55 -0
  129. package/docs/DETERMINISTIC_RENDERER.md +83 -0
  130. package/docs/NEXT_RELEASE.md +28 -0
  131. package/docs/PROPOSED_VISUALFRIES_SKILL.md +68 -0
  132. package/docs/examples/agent-cues.json +49 -0
  133. package/docs/examples/agent-transcript.json +23 -0
  134. package/docs/examples/agent-transcript.srt +7 -0
  135. package/docs/examples/agent-transcript.vtt +7 -0
  136. package/docs/examples/image-animation.json +87 -0
  137. package/docs/examples/native-text-metric-badge.json +109 -0
  138. package/package.json +133 -100
  139. package/skills/visualfries/SKILL.md +328 -0
@@ -0,0 +1,328 @@
1
+ ---
2
+ name: visualfries
3
+ description: Create and validate VisualFries scene JSON, caption videos from transcripts, prepare agent-friendly video overlays, and hand off render-ready scenes without opening the ContentFries UI.
4
+ ---
5
+
6
+ # VisualFries
7
+
8
+ VisualFries is a JSON-first Svelte/Pixi/GSAP video scene engine. For agents, treat `scene.json` as the source of truth.
9
+
10
+ Use this skill when the user asks to:
11
+
12
+ - add captions/subtitles to a video without ContentFries UI
13
+ - build a VisualFries scene from assets and a transcript
14
+ - create reusable overlays, text effects, b-roll layouts, or short-form scene JSON
15
+ - validate or inspect VisualFries scene JSON before sending it to a renderer
16
+
17
+ ## Mental Model
18
+
19
+ VisualFries uses typed scene JSON as its authoring format:
20
+
21
+ ```text
22
+ scene
23
+ settings
24
+ assets
25
+ layers
26
+ components
27
+ VIDEO / IMAGE / TEXT / SHAPE / AUDIO / SUBTITLES
28
+ ```
29
+
30
+ Agent rule:
31
+
32
+ ```text
33
+ video/transcript/assets -> scene.json -> validate -> inspect -> render
34
+ ```
35
+
36
+ Do not require the user to open ContentFries UI for captioning or scene creation.
37
+
38
+ For authored short-form edits with named beats, exact multi-track audio, source trims, freeze holds, proof cards, and timeline QA, use a production plan instead of raw component JSON:
39
+
40
+ ```bash
41
+ visualfries produce ./production-plan.json \
42
+ --scene-output ./scene.json \
43
+ --generated-assets ./generated \
44
+ --qa-output ./qa \
45
+ --output ./final.mp4
46
+ ```
47
+
48
+ `produce` is the preferred path for authored, production-ready edits. It compiles editable plan text into deterministic SVG overlays, extracts freeze frames, segments rendering at timeline event boundaries, mixes audio, writes exact QA frames, and enforces the declared leading-silence limit.
49
+
50
+ ## First Commands
51
+
52
+ From a project with `visualfries` installed:
53
+
54
+ ```bash
55
+ visualfries --help
56
+ visualfries doctor --json
57
+ visualfries catalog --json
58
+ visualfries validate-cues ./cues.json --duration 45 --json
59
+ visualfries validate scene.json
60
+ visualfries inspect scene.json --json
61
+ ```
62
+
63
+ Create a caption scene:
64
+
65
+ ```bash
66
+ visualfries compose \
67
+ --video ./input.mp4 \
68
+ --transcript ./captions.srt \
69
+ --cue-preset hidden-engine-dynamic \
70
+ --cues ./cues.json \
71
+ --scene-output ./scene.json \
72
+ --qa-output ./qa/frames \
73
+ --output ./out.mp4
74
+ ```
75
+
76
+ Or step-by-step:
77
+
78
+ ```bash
79
+ visualfries init ./video-package \
80
+ --video ./input.mp4 \
81
+ --transcript ./captions.srt \
82
+ --preset hidden-engine-center \
83
+ --cue-preset hidden-engine-dynamic
84
+
85
+ visualfries caption-scene \
86
+ --video ./input.mp4 \
87
+ --transcript ./captions.srt \
88
+ --preset hidden-engine-center \
89
+ --output ./scene.json
90
+
91
+ visualfries preset-cues \
92
+ --duration 45 \
93
+ --preset hidden-engine-dynamic \
94
+ --output ./cues.json
95
+
96
+ visualfries apply-cues ./scene.json \
97
+ --cues ./cues.json \
98
+ --output ./scene.with-cues.json
99
+ ```
100
+
101
+ Then:
102
+
103
+ ```bash
104
+ visualfries validate ./scene.json
105
+ visualfries inspect ./scene.json --json
106
+ visualfries qa ./scene.json --output ./qa
107
+ visualfries render ./scene.json --output ./qa-frames --frames-only --to-frame 3
108
+ visualfries render ./scene.json --render-mode preview --output ./preview.mp4
109
+ ```
110
+
111
+ Important: browser media rendering is preview/QA only for scenes with `VIDEO` or `GIF` components. Final VIDEO/GIF output uses the local deterministic renderer path, which predecodes active media ranges into exact frame images before browser composition. Use `--render-mode preview` only for QA or rough checks.
112
+
113
+ For final contiguous MP4 renders after QA, prefer:
114
+
115
+ ```bash
116
+ visualfries render ./scene.json --stream-encode --image-format jpg --output ./out.mp4
117
+ ```
118
+
119
+ For static-heavy scenes after QA:
120
+
121
+ ```bash
122
+ visualfries render ./scene.json --output ./out.mp4 --skip-duplicates
123
+ ```
124
+
125
+ Contiguous renders use the browser-side `renderFrameRange()` path. Sparse QA screenshots still use direct sampled frame rendering.
126
+
127
+ Preferred full agent path:
128
+
129
+ ```text
130
+ production plan -> produce (authored edit)
131
+ compose (caption-first video)
132
+ ```
133
+
134
+ Debug path:
135
+
136
+ ```text
137
+ caption-scene -> preset-cues -> edit cues -> apply-cues -> qa -> render
138
+ ```
139
+
140
+ ## Caption Workflow
141
+
142
+ Inputs:
143
+
144
+ - video file or URL
145
+ - transcript JSON with one of:
146
+ - `segments: [{ text, start, end, words }]`
147
+ - `subtitles: [{ text, start_at, end_at, words }]`
148
+ - `words: [{ text, start, end }]`
149
+ - or a plain subtitle file:
150
+ - `.srt`
151
+ - `.vtt`
152
+
153
+ Recommended presets:
154
+
155
+ - `hidden-engine-center` for Hidden Engine short videos with middle captions
156
+ - `reels-center` for default high-energy vertical captions
157
+ - `reels-lower` when the middle must stay clean
158
+ - `podcast-clean` for calmer interview clips
159
+
160
+ Caption constraints:
161
+
162
+ - Keep subtitles away from important faces, product UI, and proof overlays.
163
+ - For videos that will get ContentFries-style overlays, prefer center captions only if the overlay is top/bottom.
164
+ - Validate and inspect after generating the scene.
165
+
166
+ ## Scene Rules
167
+
168
+ - All media components must reference assets with stable `assetId`.
169
+ - SUBTITLES must have `timingAnchor.assetId` matching `scene.settings.subtitles.data[assetId]`.
170
+ - Higher layer `order` renders above lower layers.
171
+ - Use `SceneShape` validation, never raw unvalidated JSON.
172
+ - For Node agents, prefer the agent-only subpath so Svelte/browser exports are not loaded:
173
+
174
+ ```ts
175
+ import { createCaptionScene, inspectScene, normalizeTranscript } from 'visualfries/agent';
176
+ ```
177
+
178
+ - Composer helpers are useful inside app/runtime code, but CLI and automation should stay on `visualfries/agent` unless they explicitly need full VisualFries UI/runtime exports.
179
+
180
+ ## Overlay Workflow
181
+
182
+ For Hidden Engine / short-form reaction overlays, use cue files or timed overlay helpers instead of hand-building TEXT components:
183
+
184
+ ```json
185
+ {
186
+ "broll": [
187
+ { "url": "./assets/profile-scroll.mp4", "start": 2, "end": 5, "type": "VIDEO" },
188
+ { "url": "./assets/chart.png", "start": 5, "end": 7, "type": "IMAGE", "motion": "slow-zoom-in" }
189
+ ],
190
+ "overlays": [
191
+ { "text": "LOVE THIS 😍", "start": 0.4, "end": 1.1, "style": "hook-punch" },
192
+ { "text": "NECK 🤯", "start": 1.1, "end": 1.7, "style": "shock-word" }
193
+ ],
194
+ "transitions": [
195
+ { "time": 2, "style": "dip-to-black" },
196
+ { "time": 5, "style": "swipe-left", "color": "#04483D" }
197
+ ]
198
+ }
199
+ ```
200
+
201
+ Apply it:
202
+
203
+ ```bash
204
+ visualfries apply-cues ./scene.json --cues ./cues.json --output ./scene.with-cues.json
205
+ ```
206
+
207
+ Relative b-roll URLs resolve relative to the cue file.
208
+
209
+ If the agent is starting from scratch, create a cue skeleton first:
210
+
211
+ ```bash
212
+ visualfries preset-cues --duration 45 --preset hidden-engine-dynamic --output ./cues.json
213
+ ```
214
+
215
+ Starter presets:
216
+
217
+ - `hidden-engine-dynamic`: 40-60s story-driven shorts with hook/proof/mechanism/choice/CTA overlay beats.
218
+ - `captioned-clean`: caption-first videos with minimal transitions.
219
+
220
+ For Node automations:
221
+
222
+ ```ts
223
+ import {
224
+ addAgentBrollSequence,
225
+ addAgentTextOverlays,
226
+ addAgentTransitions
227
+ } from 'visualfries/agent';
228
+
229
+ const sceneWithOverlays = addAgentTextOverlays({
230
+ scene,
231
+ overlays: [
232
+ { text: 'LOVE THIS 😍', start: 0.4, end: 1.1, style: 'pop-label' },
233
+ { text: 'NECK 🤯', start: 1.1, end: 1.7, style: 'shock-word' }
234
+ ]
235
+ });
236
+
237
+ const sceneWithBroll = addAgentBrollSequence({
238
+ scene,
239
+ cues: [
240
+ { url: './broll/profile.mp4', start: 2.0, end: 5.0, type: 'VIDEO' },
241
+ { url: './broll/chart.png', start: 5.0, end: 7.0, type: 'IMAGE', motion: 'slow-zoom-in' }
242
+ ]
243
+ });
244
+
245
+ const sceneWithTransitions = addAgentTransitions({
246
+ scene,
247
+ transitions: [
248
+ { time: 2.0, style: 'dip-to-black' },
249
+ { time: 5.0, style: 'swipe-left', color: '#04483D' }
250
+ ]
251
+ });
252
+ ```
253
+
254
+ Available initial styles:
255
+
256
+ - `pop-label`: reaction label with fast pop animation.
257
+ - `shock-word`: large high-emphasis keyword reveal.
258
+ - `soft-card`: calmer context/proof card.
259
+ - `hook-punch`: loud yellow hook label for the first second.
260
+ - `proof-pill`: compact proof/credibility pill.
261
+ - `metric-badge`: big number/proof badge.
262
+ - `danger-crossout`: wrong-path or negative-beat callout.
263
+ - `cta-card`: final question/choice card.
264
+
265
+ Rules:
266
+
267
+ - One overlay idea per beat.
268
+ - Prefer 0.4-1.4 second overlay durations.
269
+ - Keep the caption lane clear. If captions sit in the middle, place overlays top/bottom or time them between caption-heavy beats.
270
+ - Render `--frames-only --to-frame 3` before encoding when a new overlay style or position is used.
271
+
272
+ For b-roll, use `addAgentBrollSequence` instead of manually creating media layers. It defaults to layer order `5`, which keeps it below captions and overlays.
273
+
274
+ B-roll image cues default to subtle `slow-zoom-in`. Available motion values: `none`, `slow-zoom-in`, `slow-zoom-out`, `drift-up`.
275
+
276
+ For transitions, use `addAgentTransitions` instead of manually creating SHAPE covers. It defaults to layer order `95`, so short transition covers can hide hard cuts. Available styles: `dip-to-black`, `flash`, `swipe-left`, `swipe-up`, `focus-pull`.
277
+
278
+ ## Render Workflow
279
+
280
+ Use `visualfries render` after validation:
281
+
282
+ ```bash
283
+ visualfries render scene.json --output out.mp4
284
+ ```
285
+
286
+ For fast QA:
287
+
288
+ ```bash
289
+ visualfries doctor --json
290
+ visualfries qa scene.json --output ./qa
291
+ visualfries render scene.json --output ./qa-frames --frames-only --to-frame 3
292
+ ```
293
+
294
+ Renderer requirements:
295
+
296
+ - `ffmpeg` must be available on `PATH` for MP4 output.
297
+ - `vite`, `@sveltejs/vite-plugin-svelte`, and `playwright` must be resolvable. In agent environments, set `VISUALFRIES_NODE_MODULES=/path/to/node_modules` when Playwright is provided by a shared runtime.
298
+ - Local media files are copied into a temporary render root and served over the local Vite server so browser rendering does not depend on `file://` access.
299
+ - Audio is mapped from the first local VIDEO asset by default. Use `--audio none` for silent output or `--audio ./voiceover.wav` to override.
300
+
301
+ Run `visualfries doctor --json` before the first render in a new agent environment. It checks ffmpeg, Vite, Svelte Vite plugin, Playwright, Chromium executable resolution, and the temp directory.
302
+
303
+ Run `visualfries catalog --json` when an agent needs valid values for caption presets, cue presets, overlay styles, b-roll motions, transitions, transcript formats, or supported CLI commands.
304
+
305
+ Run `visualfries validate-cues ./cues.json --duration <seconds> --json` before applying hand-edited cues. It catches unknown overlay styles, b-roll motions, transition styles, invalid time ranges, and cues outside the scene duration.
306
+
307
+ Use `visualfries qa scene.json --output ./qa` as the normal agent quality gate. It writes `inspect.json`, `screenshots.json`, and sampled `frames/` into one QA directory.
308
+
309
+ ## Agent Output Contract
310
+
311
+ For any generated VisualFries video package, produce:
312
+
313
+ ```text
314
+ scene.json
315
+ cues.json
316
+ assets/
317
+ qa/
318
+ inspect.json
319
+ frames/
320
+ out.mp4
321
+ notes.md
322
+ ```
323
+
324
+ For caption-only work, `scene.json` plus `inspect.json` is acceptable only when the user explicitly does not need a rendered asset yet.
325
+
326
+ ## Current Coverage
327
+
328
+ The CLI covers JSON creation, validation, inspection, production plans, automatic freeze holds, deterministic SVG overlays, exact audio tracks, timeline-segmented MP4 rendering, QA frames, captions, b-roll, transitions, cue files, and one-command compose/produce.