@scenerok/sdk 0.26.0 → 0.28.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scenerok/sdk",
3
- "version": "0.26.0",
3
+ "version": "0.28.0",
4
4
  "description": "TypeScript-first SceneRok authoring SDK — build IRTimeline for complex agent-authored scenes",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -35,14 +35,16 @@ Copy this checklist into your notes and work through it:
35
35
 
36
36
  ```text
37
37
  - [ ] 1. Identify the environment (web editor, CLI, ChatGPT, MCP, chat without tools)
38
- - [ ] 2. Classify the request; read only the references it needs (table below)
39
- - [ ] 3. Branded promo with unknown colors or logo: ask once
40
- - [ ] 4. Probe real assets: type, width, height, duration
41
- - [ ] 5. Write the script
42
- - [ ] 6. Validate. Fix every error and validate again until clean
38
+ - [ ] 2. List the beats. For each: its job and the one thing the viewer takes away
39
+ - [ ] 3. Put the material on the table before choosing: the source's own pictures,
40
+ screenshots, logo, footage, numbers, words. Probe each file
41
+ - [ ] 4. Choose each beat's tools with choosing.md; write one line of why per beat
42
+ - [ ] 5. Decide the look (palette, fonts, sizes) as `let`s: look-and-feel.md
43
+ - [ ] 6. Write the script (recipes.md has complete ones). Validate: fix every error;
44
+ read every aesthetic warning as a question about your choice
43
45
  - [ ] 7. Uses TTS or generated media: deep-validate and fix the report (CLI only)
44
- - [ ] 8. Render
45
- - [ ] 9. Check the rendered MP4; fix and repeat from step 6 if it reports problems (CLI only)
46
+ - [ ] 8. Render, pull one frame per beat, look, and answer the review questions
47
+ - [ ] 9. Fix what the frames show and render again
46
48
  ```
47
49
 
48
50
  With the CLI:
@@ -56,9 +58,13 @@ scenerok lint-video <render-id> --cost medium --json # billed
56
58
 
57
59
  `scenerok render script.vid --validate` renders and checks the MP4 in one step.
58
60
 
59
- With marketplace plugins (fastest when the user pasted structured source data):
60
- search, inspect, dry-run, then run a pinned ref — full workflow in
61
- [plugins.md](references/plugins.md):
61
+ With marketplace plugins: search, inspect, dry-run, then run a pinned ref
62
+ (full workflow in [plugins.md](references/plugins.md)). Review a plugin's
63
+ output with the same questions as your own work. Today the first-party
64
+ `listing-promo` and `release-video` templates set every beat as text over a
65
+ flat colour and leave the product images unused. When the request calls for
66
+ more, draft (`scenerok plugin draft … --out draft.vid`), change the beats that
67
+ need it, then `scenerok plugin render-draft <id> --vidscript draft.vid`.
62
68
 
63
69
  ```bash
64
70
  scenerok plugin search "product promo"
@@ -96,6 +102,47 @@ ChatGPT, and MCP have their own validate and render calls but no deep
96
102
  validation or MP4 check, and can't read local files:
97
103
  [environments.md](references/environments.md).
98
104
 
105
+ ## Review: look, then ask
106
+
107
+ `validate` tells you the script is valid. Only the rendered frames tell you
108
+ whether the video works. Render, pull one frame per beat, open the frames, and
109
+ ask:
110
+
111
+ 1. **Does each beat do its job at a glance?** A viewer on a phone with the sound
112
+ off gets the beat's point in under two seconds. If not, the job is unclear
113
+ or the tool fights the content.
114
+ 2. **Is every element a choice?** For each picture, motion, transition, grade
115
+ and sound, you can say what it does for its beat. If the honest answer is
116
+ "the recipe had one", cut it. A beat of plain text on a still frame is a
117
+ good choice when you can say why (see `choosing.md`).
118
+ 3. **Did you look at what the source offered?** If the user gave a page, a repo,
119
+ footage or a brand, put its pictures on the table before choosing. Not using
120
+ them can be right. Never having looked is the failure that produced
121
+ text-only videos.
122
+ 4. **Can it be read?** Text is at least 2.2 % of the frame height (44 px at
123
+ 1920), inside the safe area, contrasted against what is behind it, and on
124
+ screen long enough to read.
125
+ 5. **Does the frame match your intent?** Look for wrapped or colliding text,
126
+ black boxes where a picture should be, fallback fonts, letterbox bands, a
127
+ block smaller than you pictured.
128
+ 6. **Is it true?** Every claim, price and number comes from the source.
129
+
130
+ Questions 4 and 6 are facts, not taste: fix them. The rest call for judgement.
131
+ Answer them, change what you would defend poorly, and render again.
132
+
133
+ ```bash
134
+ for t in 1.5 5 9 13; do ffmpeg -loglevel error -y -ss $t -i out.mp4 -frames:v 1 frame-$t.png; done
135
+ ```
136
+
137
+ A diagnostic you can run when you intended motion: this lists every stretch
138
+ of 3 s or more where the picture doesn't change (a `freeze_start` with no
139
+ `freeze_end` runs to the end). A held quote, price or line of code can be
140
+ right, so treat the list as information, not a verdict.
141
+ `ffmpeg -hide_banner -i out.mp4 -vf freezedetect=n=0.003:d=3 -map 0:v -f null - 2>&1 | grep freeze_`
142
+
143
+ Without a shell (web editor, ChatGPT, MCP), ask questions 1-4 and 6 of the
144
+ script itself, and have the user watch the preview.
145
+
99
146
  ## Rules that prevent most failures
100
147
 
101
148
  1. **Import before calling.** `import xai from "@scenerok/xai"`, then
@@ -114,6 +161,11 @@ validation or MP4 check, and can't read local files:
114
161
  6. **Use only documented syntax.** Don't invent functions or parameters. A
115
162
  validation error names the problem; fix that line rather than rewriting the
116
163
  script.
164
+ 7. **`font:` is a Google Fonts family name.** `"Inter Bold"` is not a family
165
+ and falls back. For heavy type use a heavy family such as
166
+ `"Archivo Black"`.
167
+ 8. **Crop stills with ffmpeg, not `.Crop()`.** Prepare images before you place
168
+ them; a cropped remote still rendered as nothing in testing.
117
169
 
118
170
  ## References
119
171
 
@@ -121,6 +173,9 @@ Read the ones the task needs. Paths are relative to this file.
121
173
 
122
174
  | Task | Read |
123
175
  | --- | --- |
176
+ | Any video | [choosing.md](references/choosing.md) (always): how to pick tools for a beat, with worked choices |
177
+ | What a tool looks like, is for, and fights; tools by job | [repertoire.md](references/repertoire.md) (generated; search it by job or name) |
178
+ | Complete scripts to adapt; palette, type scale, safe areas, sourcing pictures | [recipes.md](references/recipes.md), [look-and-feel.md](references/look-and-feel.md) |
124
179
  | Any VidScript | [vidscript-strict.md](references/vidscript-strict.md) (always) |
125
180
  | Editing and compositing: trims, speed, reverse, freeze, picture-in-picture, blend modes, masks, crops, split screens, audio mixing and ducking, grading and LUTs, captions, timecode | [editing-actions.md](references/editing-actions.md) |
126
181
  | Full grammar | [vidscript-guide.md](references/vidscript-guide.md) |
@@ -148,14 +203,33 @@ chat apps are there too: `consumer-chat-apps.md`,
148
203
  `chatgpt-gpt-instructions.md`, `gemini-gem-instructions.md`, `grok-skill.md`.
149
204
  Previews of every catalog item: https://scenerok.com/catalog.
150
205
 
151
- ## Minimal VidScript
206
+ ## Two beats, two choices
207
+
208
+ Each beat gets the tools its job calls for and nothing else. Below, an
209
+ "establish" beat uses a real photo: the push gives a 4 s still a sense of time.
210
+ A "quote" beat is plain text on a flat colour with no motion, because the words
211
+ are the content and the reader needs to be left alone with them. Both are
212
+ finished. `choosing.md` walks through more choices like these.
152
213
 
153
214
  ```vidscript
154
215
  import motion from "@scenerok/basic-animations"
155
216
 
156
- input hero = "https://cdn.example.com/clip.mp4"
157
- [0s .. 4s] = hero.Trim(1s, 5s)
158
- [0s .. 3s] = text "Hello", style: title, color: "#FFFFFF", area: "title", animate: motion.fadeIn(0.8s)
217
+ let bg = "#0A0C10"
218
+ let ink = "#F4F6FA"
219
+ let muted = "#A3ADBD"
220
+ let display = "Archivo Black"
221
+ let body = "Inter"
222
+
223
+ input shot = "https://cdn.example.com/product-lifestyle.jpg" # 1080x1920, probed
224
+
225
+ # Establish: the product in its place. A slow push, a headline that arrives.
226
+ [0s .. 4s] = shot, width: 1080, height: 1920, x: 0, y: 0, animate: { type: "scale", from: { scale: 1 }, to: { scale: 1.08 }, easing: "linear" }
227
+ [0.2s .. 4s] = text "Cleans while you're out", font: display, size: 96, color: ink, x: "50%", y: "28%", max_width: "86%", align: center, shadow_color: "#000000", shadow_blur: 24, animate: motion.riseIn(0.5s, 60)
228
+
229
+ # Quote: someone's words, held still long enough to read twice.
230
+ [4s .. 9s] = solid(bg)
231
+ [4s .. 9s] = text "\"Simplicity is the ultimate sophistication.\"", font: body, size: 64, color: ink, x: "50%", y: "45%", max_width: "80%", align: center
232
+ [4s .. 9s] = text "Leonardo da Vinci (attributed)", font: body, size: 44, color: muted, x: "50%", y: "56%", align: center
159
233
  output to "video.mp4", resolution: "1080x1920", fps: 30
160
234
  ```
161
235
 
@@ -98,6 +98,15 @@ overlays (composite over video/scenes), honor every param, and scale to any outp
98
98
  Prefer these over hand-authoring when a headline/caption/stat treatment fits; see the
99
99
  `text-anim` rows in `animations-picker.md` for intent mapping.
100
100
 
101
+ ## Code blocks in vertical video
102
+
103
+ At a 9:16 output the 12 VS Code theme `code_snippet_*` blocks and `code_diff` switch to a
104
+ native 1080x1920 layout: no desktop chrome, ~40px type that wraps instead of shrinking, a
105
+ line-by-line reveal with a moving focus bar and caret (a +/− count and a focus ring for
106
+ `code_diff`), a camera that scrolls long code, and a lift-and-fade exit timed to the
107
+ placement. Same params, same theme palettes; 16:9 is unchanged. It still reads best with
108
+ 3–12 short lines: put the one change that matters on screen, not the whole file.
109
+
101
110
  ## Custom HTML (bring your own animation)
102
111
 
103
112
  `animations.custom_html(...)` renders **your own HTML/CSS/JS** through the same HyperFrames
@@ -47,10 +47,13 @@ Param resolution: **named > positional > default**.
47
47
  | Block / family | Issue | Fix |
48
48
  | --- | --- | --- |
49
49
  | `code_diff` | Line indices may be 0-based in adapter | Match sample in `animations-catalog.md` |
50
+ | Code blocks in 9:16 | Only the VS Code theme `code_snippet_*` blocks and `code_diff` have a portrait layout; `code_typing`, `code_morph`, the terminal blocks, etc. are scaled down from 16:9 and read small | Prefer `code_snippet_<theme>` / `code_diff` for vertical video; pass 3–12 short lines, not a file |
50
51
  | Unverified blocks | `scenerok validate` warns `verified:false` | Accept demo render or switch to verified family |
51
52
  | Maps / liquid-glass / app-showcase | Ignore user params | Use for demo aesthetic only, or hand-author |
52
53
  | Adapter blocks | No inline audio/text siblings | Put `audio`, `text`, `filter` on separate time blocks |
53
54
  | `logo_outro` | Renders upstream demo's Figma-style mark when no logo param given | Pass `brand: "scenerok"` or `logoUrl: "<image url>"` |
55
+ | Most blocks in 9:16 | Designed at 1920x1080 and scaled to fit: 56 % size in a centred band. The `code_snippet_*` VS Code themes, `code_diff` and most lower thirds have their own 9:16 layouts | Each record in `repertoire.md` says how it behaves at 9:16 |
56
+ | `text_counter_stat` | `suffix` defaults to `"+"`, so 12 reads "12+" | Pass `suffix: ""` unless the number really is a floor |
54
57
 
55
58
  ## Two-phase compose recipe
56
59