@vanillaskyai/video 0.10.22 → 0.11.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.
Files changed (128) hide show
  1. package/CHANGELOG.md +74 -1
  2. package/PUBLIC-API.md +45 -438
  3. package/README.md +57 -96
  4. package/dist/builtin-metadata-OT6V7TB4.js +8 -0
  5. package/dist/{chapter-title-2JVDU62E.js → chapter-title-2RCXX7SN.js} +1 -2
  6. package/dist/{chunk-PDQFQIQW.js → chunk-3EQ6PVWL.js} +1 -1
  7. package/dist/chunk-4G4JBMCM.js +37 -0
  8. package/dist/{chunk-7AA2JWHZ.js → chunk-5DOQTIMD.js} +6 -6
  9. package/dist/chunk-666HGTVZ.js +41 -0
  10. package/dist/{chunk-7M56IUUX.js → chunk-6Z3ID54H.js} +0 -18
  11. package/dist/{chunk-5BSJLT6H.js → chunk-E7FHBLAC.js} +16 -29
  12. package/dist/chunk-HIQM4J3U.js +30 -0
  13. package/dist/chunk-ISWQ6T5X.js +36 -0
  14. package/dist/{chunk-224QNWRA.js → chunk-K5J7ESRO.js} +1 -10
  15. package/dist/chunk-KMVRBUL5.js +50 -0
  16. package/dist/chunk-NM4CXXZY.js +25 -0
  17. package/dist/{chunk-44WND2VP.js → chunk-V2CP7PVY.js} +19 -63
  18. package/dist/{chunk-3O7OMMMF.js → chunk-WZESNEPT.js} +0 -1
  19. package/dist/{chunk-RXTN2CW6.js → chunk-Z3DLSLAJ.js} +1 -1
  20. package/dist/cinema-media-YZ2UANJG.js +365 -0
  21. package/dist/cli.js +154 -1753
  22. package/dist/{compose-video-BH5K6XWT.js → compose-video-H2YUQDUY.js} +4 -4
  23. package/dist/{events-B4YCc4vc.d.ts → events-BZAfl0Dm.d.ts} +1 -1
  24. package/dist/index.d.ts +2 -2
  25. package/dist/index.js +4 -6
  26. package/dist/preload-media-23JXUFCF.js +77 -0
  27. package/dist/react.d.ts +39 -15
  28. package/dist/react.js +1350 -739
  29. package/dist/scene-validation-SGLLLFY5.js +9 -0
  30. package/dist/server.d.ts +67 -117
  31. package/dist/server.js +262 -614
  32. package/dist/test.d.ts +2 -2
  33. package/dist/test.js +21 -21
  34. package/dist/{text-stream-LD364KBI.js → text-stream-SOVLYR2L.js} +2 -2
  35. package/dist/{types-BqB8zC9u.d.ts → types-CG-kPI81.d.ts} +3 -1
  36. package/dist/{types-DdZw4GRQ.d.ts → types-ht-Zw3Wv.d.ts} +1 -1
  37. package/docs/agent-integration.md +19 -64
  38. package/docs/architecture.md +82 -87
  39. package/docs/customization.md +49 -66
  40. package/docs/development.md +18 -17
  41. package/docs/errors.md +4 -4
  42. package/docs/getting-started.md +74 -93
  43. package/docs/media-and-audio.md +9 -7
  44. package/docs/performance.md +11 -6
  45. package/docs/persistence.md +3 -7
  46. package/docs/production.md +4 -15
  47. package/docs/prompt-and-input.md +1 -2
  48. package/docs/provider-integration.md +134 -181
  49. package/docs/reference/protocol.md +5 -14
  50. package/docs/reference/provider-adapters.md +21 -13
  51. package/docs/security.md +1 -14
  52. package/docs/testing.md +56 -123
  53. package/package.json +5 -27
  54. package/starters/video-chat/.env.example +12 -4
  55. package/starters/video-chat/.env.native.example +13 -0
  56. package/starters/video-chat/README.md +72 -11
  57. package/starters/video-chat/package.json +1 -1
  58. package/starters/video-chat/providers/text-native.ts +94 -0
  59. package/starters/video-chat/providers/text.ts +19 -0
  60. package/starters/video-chat/providers/transcription.ts +32 -0
  61. package/starters/video-chat/providers/video-custom.ts +45 -0
  62. package/starters/video-chat/providers/video-delivery.ts +57 -0
  63. package/starters/video-chat/providers/video-google.ts +48 -0
  64. package/starters/video-chat/providers/video-job.ts +103 -0
  65. package/starters/video-chat/providers/video-runway.ts +45 -0
  66. package/starters/video-chat/providers/video.ts +39 -63
  67. package/starters/video-chat/server.ts +3 -29
  68. package/starters/video-chat/vite.config.ts +2 -8
  69. package/styles/video-chat.css +8 -105
  70. package/dist/builtin-server-W4PLJUZ5.js +0 -8
  71. package/dist/catalog-types-WTbLP6Jh.d.ts +0 -78
  72. package/dist/check-runtime.d.ts +0 -15
  73. package/dist/check-runtime.js +0 -96
  74. package/dist/chunk-2E6T633S.js +0 -27
  75. package/dist/chunk-4YM2M62S.js +0 -13
  76. package/dist/chunk-4ZJLPHBV.js +0 -684
  77. package/dist/chunk-5JBMYQP6.js +0 -156
  78. package/dist/chunk-73NTSFFI.js +0 -81
  79. package/dist/chunk-EGVQODKU.js +0 -83
  80. package/dist/chunk-HFVNAPHZ.js +0 -35
  81. package/dist/chunk-IIN5M5HW.js +0 -697
  82. package/dist/chunk-IQMYK5DX.js +0 -133
  83. package/dist/chunk-IR44XKBI.js +0 -46
  84. package/dist/chunk-JKVOBTRO.js +0 -145
  85. package/dist/chunk-LVM5Q2DL.js +0 -68
  86. package/dist/chunk-M4QTEJTK.js +0 -709
  87. package/dist/chunk-QSBDB4J2.js +0 -16
  88. package/dist/chunk-R3XAOMKP.js +0 -29
  89. package/dist/chunk-SPVTJH3F.js +0 -24
  90. package/dist/chunk-YAHT3LST.js +0 -663
  91. package/dist/chunk-ZD2VTUYR.js +0 -28
  92. package/dist/cinema-media-HYCDG65Z.js +0 -11
  93. package/dist/comparison-XXAP4S4J.js +0 -36
  94. package/dist/editorial-timeline-VUQC6KPA.js +0 -42
  95. package/dist/key-figure-4TJK7HLT.js +0 -29
  96. package/dist/kit-DrRpdn0p.d.ts +0 -79
  97. package/dist/mobile-message-FIHAO6XC.js +0 -49
  98. package/dist/preload-media-LJXWKTWG.js +0 -57
  99. package/dist/quote-GRPIYKQJ.js +0 -32
  100. package/dist/system-prompt-AG26KJAA.js +0 -12
  101. package/dist/template-catalog.d.ts +0 -400
  102. package/dist/template-catalog.js +0 -6
  103. package/dist/templates.d.ts +0 -25
  104. package/dist/templates.js +0 -102
  105. package/dist/validate-4OUD2CLX.js +0 -10
  106. package/docs/concepts.md +0 -107
  107. package/docs/custom-templates.md +0 -346
  108. package/docs/immersive-interface.md +0 -86
  109. package/docs/maintainers/cinematic-migration.md +0 -38
  110. package/docs/motion-and-effects.md +0 -109
  111. package/docs/reference/design-system.html +0 -125
  112. package/docs/responsive-orientation.md +0 -37
  113. package/docs/streaming-protocol.md +0 -15
  114. package/examples/custom-template/README.md +0 -19
  115. package/examples/custom-template/minimal-text.tsx +0 -82
  116. package/examples/custom-template/structured-data.tsx +0 -104
  117. package/registry/items/backgrounds.json +0 -70
  118. package/registry/items/chapterTitle.json +0 -80
  119. package/registry/items/cinemaMedia.json +0 -136
  120. package/registry/items/comparison.json +0 -168
  121. package/registry/items/editorialTimeline.json +0 -172
  122. package/registry/items/keyFigure.json +0 -162
  123. package/registry/items/mobileMessage.json +0 -153
  124. package/registry/items/motion.json +0 -45
  125. package/registry/items/quote.json +0 -161
  126. package/registry/items/template-context.json +0 -31
  127. package/registry/items/theme.json +0 -47
  128. package/registry/items/typography.json +0 -47
@@ -1,23 +1,24 @@
1
- # Develop the chat experience
1
+ # Development
2
2
 
3
- Run `npm ci --no-audit`, then `npm run dev:chat`. The localhost HMR surface renders the actual SDK `VideoChat`, templates and server handler from source. It never loads provider credentials. Select an intent and fault condition in the development toolbar; use the chat's normal media-mode controls. The prompt box remains the real product UI.
3
+ Use Node 22+ and the locked npm version. Run `npm ci` once in your worktree.
4
4
 
5
- Offline answers are deterministic for explanation, story, comedy, imagination, practical steps and golf. They use local waterfall footage and locally synthesized speech matching each displayed opening, body and ending. This harness lets you hear complete narration while checking loading, timing, controls and recovery without AI credits. The waterfall remains generic fixture footage; it cannot prove generated answer quality or visual relevance. See [spoken fixture provenance](https://github.com/VanillaSkyAi/video/blob/main/dev/chat/speech/README.md) for transcripts and regeneration commands. Conditions cover ready, delayed footage, missing media, decode failure, speech failure, exhausted video allowance and request throttling. Browser speech may be used in the speech-failure condition.
5
+ ```bash
6
+ npm run dev:chat
7
+ ```
6
8
 
7
- The toolbar labels source and fixture identity. It separates the first body surface from the first decoded moving-footage frame; the former is a renderer paint opportunity and can precede decode. Its bounded safe phase log records browser request/stream arrival phases, speech response completion, first speech, footage and buffer pauses. No prompts, narration, scene IDs or provider bodies are retained. Media start/end/skip reasons come from the handler’s separate host-only `onDiagnostic` callback, shown in the local terminal for offline fixtures; live hosts own that callback themselves. Stream arrival is not the server’s exact authorship timestamp. Local fixtures never fetch external footage or invoke a paid model. Mode boundaries, provider deadlines and host admission remain covered by their dedicated server and host suites.
9
+ The local chat harness imports source directly for HMR. Keep media fixtures:
10
+ they exercise real decoder, readiness, audio-clock, and replay boundaries.
11
+ There is no catalog generation or registry synchronization step.
8
12
 
9
- ## Optional live host
13
+ For an ordinary edit, run the affected test files, lint, and typecheck. Add a
14
+ focused regression for a behavior change. Run browser tests when playback or UI
15
+ behavior changes; use the packed-consumer gates when exports, starter code, or
16
+ public examples change. Do not run the complete release matrix repeatedly during
17
+ the edit loop.
10
18
 
11
- Set `VANILLASKY_CHAT_LIVE_ENDPOINT` to an application-owned video-chat endpoint before starting the harness. The toolbar then offers **Connect live endpoint (uses allowance)**. It stays offline until that explicit click. Live fetches include host cookies, subject to browser cookie policy. The host must allow credentialed requests from the localhost origin and provide its normal authorization; credentials and allowances stay with that application. This tool does not proxy secrets, reset limits, or retry generated answers. Capabilities and welcome requests may run as soon as you connect. Request only the bounded live examples needed to evaluate actual quality.
19
+ `npm run verify:release` is the final candidate gate: it builds one artifact and
20
+ reuses it for clean-room consumers. `verify:package` already verifies public API
21
+ declarations/runtime boundaries; `verify:api` is a targeted shortcut, not an
22
+ additional full-release pass.
12
23
 
13
- ## Fast checks
14
-
15
- `npm run check:chat` runs the harness/unit recovery cases, checks harness TypeScript and runs one Chromium recording with short footage looping under actual audio. Install Chromium once with `npx playwright install chromium`. The harness smoke additionally records submit-to-visible-chapter paint opportunity with a 200 ms warm-UI target. This is a browser animation-frame opportunity, not a physical display measurement. The target for the complete command is under a minute on a warm machine; the command reports its measured duration. It does not replace release checks or claim browser-wide/live-provider coverage.
16
-
17
- ## One candidate for release verification
18
-
19
- `npm run verify:release` runs registry, lint, type, unit, acceptance, size, production dependency audit, API, packed-consumer, onboarding, provider and all existing browser checks. It builds and packs once into ignored `artifacts/chat-candidate/`, then sends the exact tarball and integrity to every consumer verifier. Each verifier still uses its independent clean install. Browser and provider compatibility remain independent gates; no paid API calls are enabled by this command.
20
-
21
- `candidate.json` records version, source commit, dirty-tree status, SHA-256 and npm integrity. A local candidate may include uncommitted work; it is never called a published artifact. `VANILLASKY_CANDIDATE_DIR` selects a different output directory. The command verifies but never publishes, merges or deploys. CI additionally retains the existing Node and React version checks.
22
-
23
- For one targeted consumer check, run `node scripts/chat-candidate.mjs`, then provide `VANILLASKY_PACKED_TARBALL`, `VANILLASKY_EXPECTED_INTEGRITY` and `VANILLASKY_EXPECTED_SHA256` from that manifest to an existing verifier. Do not repack between checks of the same candidate.
24
+ [Architecture](architecture.md) · [Contributing](https://github.com/VanillaSkyAi/video/blob/main/CONTRIBUTING.md)
package/docs/errors.md CHANGED
@@ -11,9 +11,9 @@ be produced. Never put provider details or stack traces in the interface.
11
11
  | Failure | Result |
12
12
  | --- | --- |
13
13
  | Invalid planner scene | Skip the part and accept later valid scenes |
14
- | Generated footage | Try stock media, matching completed footage, then a safe template |
15
- | Stock lookup or candidate | Continue with another candidate or template |
16
- | Template renderer | Isolate the failed scene with a safe visual |
14
+ | Generated footage | Use a narrated chapter; never silently switch to stock |
15
+ | Stock lookup or candidate | Continue with another stock candidate or narrated chapter |
16
+ | Scene renderer | Isolate the failed scene with a safe visual |
17
17
  | Missing narration | Continue with scene text |
18
18
  | Generated speech | Use browser voice |
19
19
  | Late stream failure | Keep playable opening and completed scenes |
@@ -50,7 +50,7 @@ Automated regression and acceptance tests use mocked providers. See
50
50
 
51
51
  ## Slow optional providers
52
52
 
53
- Generated video has a 15-second deadline per lookup. Stock media, generated
53
+ Generated video starts with a 15-second preparation budget; later deadlines account for the scene's position. Stock media, generated
54
54
  speech preparation, and fallback scene narration have 3-second deadlines.
55
55
  A deadline uses the same safe fallback as a failed provider; completed scenes
56
56
  and scene order are preserved. Providers receive cancellation, and late results
@@ -1,115 +1,96 @@
1
- [← Documentation home](../README.md) · [Next: Provider integration →](provider-integration.md)
2
-
3
1
  # Getting started
4
2
 
5
- The fastest VanillaSky integration is the complete, general-purpose video chat.
6
- It starts with a template introduction and browser voice. Add the video adapter
7
- and its server key for generated footage, or choose Pexels for stock footage.
8
- Without a media provider, the answer retains narration and subtitles with an
9
- chapter template. Generated speech is optional.
10
-
11
- ## Create the app
12
-
13
- Start in an empty folder:
3
+ This is the canonical quickstart. Create the default chat in an empty directory:
14
4
 
15
5
  ```bash
16
6
  npx @vanillaskyai/video init
17
7
  ```
18
8
 
19
- Init installs the exact SDK version that ran it, creates a small application
20
- shell, installs baseline dependencies, and runs doctor automatically. Optional
21
- speech and video packages are not installed. If installation is interrupted,
22
- rerun the same init command to finish setup.
23
- It does not copy VanillaSky's template tree. The important generated files are:
24
-
25
- | File | Your application owns |
26
- | --- | --- |
27
- | `src/main.tsx` | The mount point for the SDK-owned chat |
28
- | `server.ts` | Provider choices and callbacks |
29
- | `stock.ts` | Optional stock search policy |
30
- | `vite.config.ts` | Local UI and `/api/video-chat` endpoint |
31
- | `.env.local` | Ignored server-only credentials |
32
-
33
- The generated browser entry is intentionally tiny:
34
-
35
- ```tsx
36
- import { StrictMode } from "react";
37
- import { createRoot } from "react-dom/client";
38
- import { VideoChat } from "@vanillaskyai/video/react";
39
- import "@vanillaskyai/video/video-chat.css";
40
-
41
- createRoot(document.getElementById("root")!).render(
42
- <StrictMode><VideoChat /></StrictMode>,
43
- );
44
- ```
45
-
46
- The SDK owns the responsive interface, conversation state, suggestions, voice
47
- input, narration pacing, streaming player, and packaged templates. Your shell
48
- stays responsible for providers, keys, authorization, limits, storage,
49
- branding, and product copy.
50
-
51
- ## Add the one required key
52
-
53
- Add the text-provider key to the generated, ignored `.env.local`:
54
-
55
- ```dotenv
56
- ANTHROPIC_API_KEY=
57
- ```
58
-
59
- Fill the value locally; do not expose it through a client-prefixed environment
60
- variable. Then inspect the setup without calling any provider:
9
+ Init creates an editable Vite app, installs its dependencies, and runs doctor.
10
+ The default text adapter uses the optional Vercel AI SDK. Add `ANTHROPIC_API_KEY`
11
+ to the generated, ignored `.env.local`, then:
61
12
 
62
13
  ```bash
63
14
  npx vanillasky doctor
15
+ npm run dev
64
16
  ```
65
17
 
66
- The base experience reports `templates + browser voice`. `ANTHROPIC_API_KEY`
67
- is the only required key. Doctor checks setup locally without calling providers
68
- and reports names and readiness, never values.
18
+ Open the reported localhost URL. Ask a question, let its spoken answer finish,
19
+ then ask a follow-up. Doctor reports key names and readiness, never key values.
20
+ Rerun init if installation was interrupted. It preserves keys and installed
21
+ provider adapters, and refuses conflicting scaffold files rather than replacing
22
+ your code.
69
23
 
70
- ## Add optional capabilities
24
+ For the native alternative, start a new directory with
25
+ `npx @vanillaskyai/video init --native` and set `GEMINI_API_KEY` instead.
26
+ Its editable Gemini REST callbacks need no `ai`, `@ai-sdk/anthropic`, or other
27
+ model SDK. You can replace either text adapter with your own implementation.
28
+ Rerunning ordinary init keeps the selected adapter.
71
29
 
72
- Install only the capability you want:
30
+ ## Application files
73
31
 
74
- ```bash
75
- # Generated speech: installs the xAI adapter
76
- npx vanillasky providers add speech
32
+ - `src/main.tsx` mounts `<VideoChat />` and imports the scoped stylesheet.
33
+ - `server.ts` connects one `createVideoChatHandler` to app-owned providers.
34
+ - `providers.ts` holds optional provider wiring.
35
+ - `providers/text.ts` supplies streaming planning and small text tasks.
36
+ - `vite.config.ts` serves the client and `/api/video-chat`.
37
+ - `.env.local` holds server-only keys; never commit it.
77
38
 
78
- # Generated video and transcription: installs the FAL adapter
79
- npx vanillasky providers add video
80
- ```
39
+ The SDK owns the interface, shot planning, streaming, subtitles, voice timing,
40
+ and footage/chapter renderers. It does not copy a template tree into your app.
81
41
 
82
- Add `XAI_API_KEY` for speech or `FAL_KEY` for video and transcription to
83
- `.env.local`, then restart the dev server. Stock media needs only
84
- `PEXELS_API_KEY`; no extra package or command is needed. The client stays the
85
- same. Rerun an interrupted provider command to finish its installation, then
86
- check readiness with `npx vanillasky doctor`.
42
+ ## Add footage and voice
87
43
 
88
- ## Run and verify
44
+ Add `PEXELS_API_KEY` for stock video without another package. For optional
45
+ generated video or speech, run the corresponding setup command:
89
46
 
90
47
  ```bash
91
- npm run dev
48
+ npx vanillasky providers add video fal
49
+ npx vanillasky providers add speech
50
+ npx vanillasky providers add transcription
51
+ npx vanillasky doctor
92
52
  ```
93
53
 
94
- Open the reported localhost URL. Try one explanatory question and one unrelated
95
- creative request in the same conversation. Confirm each response starts with a
96
- spoken hook from the response stream before the full plan is complete, holds its opening until the first
97
- scene is ready, reaches its final frame, and leaves the composer ready for
98
- another turn. With stock media enabled, click a welcome or follow-up card and
99
- confirm its footage carries directly into that opening. With generated video
100
- enabled, confirm that moving shots develop a complete answer with narration
101
- and subtitles, and that the first shot continues the hook without repeating it.
102
- Check that no finished clip freezes while narration continues.
103
-
104
- The generated local authorization accepts localhost only. Replace it with your
105
- real session check, rate limits, and usage policy before deploying.
106
-
107
- ## Continue
108
-
109
- - Change providers or add media capabilities in [Provider integration](provider-integration.md).
110
- - Brand or reshape the default experience in [Customization](customization.md).
111
- - Use a fully custom UI with the headless chat hook described in
112
- [Provider integration](provider-integration.md#custom-interface).
113
- - Copy and edit a visual only when needed in [Custom templates](custom-templates.md).
114
- - Apply production authorization and key handling from
115
- [Production](production.md) and [Security](security.md).
54
+ Choose `fal`, `google`, `runway`, or `custom` after `video`; omitting the name
55
+ selects fal. These install app-owned source, not core vendor dependencies.
56
+ The fal and Runway references use `FAL_KEY` and `RUNWAY_API_KEY`; Google uses
57
+ `GEMINI_API_KEY`. `custom` leaves a callback skeleton for any vendor.
58
+
59
+ Before enabling generated video, configure `providers/video-delivery.ts` with
60
+ your storage. Its example accepts your `VIDEO_UPLOAD_URL` and
61
+ `VIDEO_STORAGE_TOKEN`; that upload service is not supplied by VanillaSky.
62
+ See [provider integration](provider-integration.md#video-delivery-and-cancellation)
63
+ for the callback contract. Provider credentials alone do not enable the
64
+ starter's generated-video capability.
65
+
66
+ Speech and transcription are independent upgrades. Speech installs the optional
67
+ xAI/AI SDK adapter and uses `XAI_API_KEY`; Whisper transcription uses `FAL_KEY`
68
+ without selecting fal for video. Doctor inspects the selected configuration
69
+ locally; it never tests a paid generation.
70
+
71
+ Configure keys locally and restart the server. Generated speech is
72
+ optional; browser speech remains the default. Without usable footage, chapter
73
+ scenes retain the narration and subtitles. See [provider integration](provider-integration.md)
74
+ and [media and voice](media-and-audio.md) for callback and storage responsibilities.
75
+
76
+ To use an existing assistant rather than ask the planner to answer directly,
77
+ add [`resolveAnswer`](provider-integration.md#use-an-existing-assistant) to
78
+ `server.ts`. The UI does not change.
79
+
80
+ ## Verify the result
81
+
82
+ Use the real browser with normal motion enabled. Check one complete response
83
+ and a follow-up, pause/mute, visible error recovery, and the console.
84
+ If generated video is ready, verify that the footage actually moves and that
85
+ the final spoken sentence completes. A passing mocked test does not prove
86
+ provider latency or video quality.
87
+ Google/Runway job APIs can take minutes; the SDK cannot turn that wait into
88
+ real-time footage. Narration aims to finish 0.8 seconds before each clip ends;
89
+ if a bounded rewrite cannot fit it, chapter recovery preserves the full speech.
90
+
91
+ Before exposing the endpoint publicly, add application authentication, request
92
+ limits, media policy, and spending controls. The local starter is not a
93
+ production authorization policy. See [production](production.md) and
94
+ [security](security.md).
95
+
96
+ [Documentation home](../README.md)
@@ -1,4 +1,4 @@
1
- [← Documentation home](../README.md) · [Previous: Customization](customization.md) · [Next: Custom templates →](custom-templates.md)
1
+ [← Documentation home](../README.md) · [Previous: Customization](customization.md) · [Next: Customization →](customization.md)
2
2
 
3
3
  # Media, voice, and audio
4
4
 
@@ -46,8 +46,7 @@ createVideoChatHandler({
46
46
  The planner emits a short semantic keyword, not a URL. The callback returns an
47
47
  application-approved image or video URL, and the SDK validates it before it
48
48
  reaches a scene. Return `null` when no licensed, safe, relevant asset exists;
49
- default chat displays an authored chapter while retaining the spoken answer. An explicit custom `templates` registry retains its structured planner,
50
- validation, and fallback contracts.
49
+ default chat displays an authored chapter while retaining the spoken answer.
51
50
 
52
51
  For Pexels, keep `PEXELS_API_KEY` on the server, enforce a deadline, filter for
53
52
  suitable renditions, and return only validated Pexels asset domains. Licensing,
@@ -85,7 +84,7 @@ Pexels retains literal footage queries; these instructions cannot restyle stock
85
84
  assets. The opening chapter keeps its existing appearance. Automatic direction
86
85
  is generation-time guidance, not a new persisted style field; saved media keeps
87
86
  its rendered appearance and existing caller-supplied style persistence is
88
- unchanged. Custom template planning keeps its existing behavior.
87
+ unchanged.
89
88
 
90
89
  ## Generated shots
91
90
 
@@ -135,8 +134,11 @@ owns the provider key, model, spend, generated bytes, retention, and delivery.
135
134
  Set `generatedClipDurationSec` to the duration your video adapter actually
136
135
  requests (default 5, supported range 2–20 seconds). Keep it aligned with provider
137
136
  settings and host spending limits. The planner fits natural spoken beats to that
138
- budget; measured audio determines the final scene timing. Silent footage may
139
- loop until the finite scene ends. Audible footage is not looped.
137
+ budget with a 0.8-second tail. One bounded rewrite may shorten an oversized
138
+ beat before generation; otherwise its complete narration stays on a chapter.
139
+ Measured audio and actual decoded footage are checked before playback. Normal
140
+ footage plays once at native speed; overruns recover to a chapter without
141
+ cutting off narration or buying another clip.
140
142
 
141
143
  `generateVideoTimeoutMs` sets the first-shot preparation budget (default 15 seconds).
142
144
  Later deadlines account for their position in the answer rather than restarting
@@ -185,4 +187,4 @@ interaction before audible playback on many devices.
185
187
  while narration continues.
186
188
  - Return a safe fallback instead of leaving the response waiting forever.
187
189
 
188
- [← Documentation home](../README.md) · [Previous: Customization](customization.md) · [Next: Custom templates →](custom-templates.md)
190
+ [← Documentation home](../README.md) · [Previous: Customization](customization.md) · [Next: Customization →](customization.md)
@@ -39,10 +39,15 @@ playback. It is not the time a speech request finishes. Custom voices must call
39
39
  `onStart()` when sound begins; otherwise this measurement remains unavailable.
40
40
  Muted responses do not produce a speech-start event.
41
41
 
42
- `stall` measures a wait after the player reaches the end of its available scenes
43
- while more scenes are being prepared. A completed interval includes `durationMs`.
44
- Deliberate pauses are excluded. This does not measure network buffering inside
45
- an image or video, because those assets do not control the scene clock.
42
+ `stall` measures a completed wait interval with `durationMs` and a fixed reason:
43
+ `scene-generation`, `speech`, or `media-decoding`. Deliberate pauses are excluded.
44
+ Custom player owners must not pause voice for a `speech` wait.
45
+
46
+ `scene-duration` compares prepared speech and clip seconds and records chapter
47
+ recovery. `media-playback` reports the actual decoded clip duration, scene duration
48
+ and observed repeat count. `buffer` samples ready buffered seconds across the
49
+ active and next mounted media elements, not total downloaded bytes. The local
50
+ development chat displays these measurements without retaining response content.
46
51
 
47
52
  Elapsed times start at prompt submission and can include user pauses. Compare
48
53
  unpaused runs with the same mode and voice configuration. Treat missing speech
@@ -75,6 +80,6 @@ chapter scenes. Neither callback measures the immediate opening template;
75
80
  measure that surface separately when checking submit-to-template latency.
76
81
 
77
82
  AI and Pexels modes remain separate. Missing, late, or unplayable footage uses
78
- the authored chapter and complete narration. Silent clips loop for the finite
79
- narrated scene. See [the local chat harness](development.md) for fixture timing
83
+ the authored chapter and complete narration. Normal clips play once at native
84
+ speed; overlong narration recovers to a chapter. See [the local chat harness](development.md) for fixture timing
80
85
  and explicit live-provider checks.
@@ -1,4 +1,4 @@
1
- [← Documentation home](../README.md) · [Previous: Core concepts](concepts.md) · [Next: Streaming protocol →](streaming-protocol.md)
1
+ [← Documentation home](../README.md) · [Previous: Core concepts](architecture.md) · [Next: Streaming protocol →](reference/protocol.md)
2
2
 
3
3
  # Persistence and replay
4
4
 
@@ -11,7 +11,7 @@ completed conversation history. The default `VideoChat` keeps history in memory;
11
11
  use the headless hook when the application needs durable storage.
12
12
 
13
13
  Every stored video has `schemaVersion: "0.2"`. This storage version is separate
14
- from streaming protocol `0.5`. The 0.1 policy supports the current storage
14
+ from streaming protocol `0.6`. The SDK supports the current storage
15
15
  schema only: there are no compatibility aliases or implicit coercions.
16
16
 
17
17
  ## Load at the storage boundary
@@ -73,8 +73,4 @@ normal authenticated storage and a cryptographic integrity mechanism when
73
73
  those properties are required.
74
74
 
75
75
  Saved replay makes zero generation endpoint or model-provider requests. It is
76
- not necessarily zero network traffic: audio, images, videos, fonts, and
77
- customer-owned renderers may make separate media network requests.
78
-
79
- When a saved video uses project-owned templates, provide the matching browser
80
- registry: `<VideoPlayer video={savedVideo} templates={templates} />`.
76
+ not necessarily zero network traffic: audio, images, videos, and fonts may make separate media network requests.
@@ -17,7 +17,7 @@ Mount `<VideoChat />` or `useVideoChat` against that boundary.
17
17
  - Forward cancellation to every text, speech, media, transcription, and video provider.
18
18
 
19
19
  The handler rejects unknown templates and fields, invalid variables, unsafe
20
- media, and fabricated quote-template content before a scene reaches the
20
+ media before a scene reaches the
21
21
  player. Read the [security guide](security.md) for the complete controls.
22
22
 
23
23
  ## Cinematic direction and providers
@@ -25,9 +25,7 @@ player. Read the [security guide](security.md) for the complete controls.
25
25
  Default chat shows an immediate chapter while speech and selected footage prepare.
26
26
  Configure `generateVideo` for AI mode and `searchMedia` for Pexels mode. Neither
27
27
  mode calls the other footage source. Missing or late footage uses the authored
28
- chapter with complete narration. Explicit custom template registries keep their
29
- existing composition and fallback contracts.
30
- A stock candidate must match the subject, action and permitted crop. Return
28
+ chapter with complete narration. A stock candidate must match the subject, action and permitted crop. Return
31
29
  `null` for uncertainty rather than broadening an essential detail.
32
30
 
33
31
  Use explicit provider deadlines. Generated video should use idempotency keys
@@ -45,8 +43,7 @@ cards may carry a prepared opening so its speech starts without a model round tr
45
43
 
46
44
  Do not wait for the complete plan before showing the first validated scene.
47
45
  Preload upcoming assets and keep the current visual if the next one is late.
48
- When generated footage is useful, reserve the first shot in the opening object so generation
49
- can begin while the planner streams later scenes.
46
+ The answer brief reserves the ending while body shots stream; do not wait for every clip before sending ready scenes.
50
47
 
51
48
  ## Data and privacy
52
49
 
@@ -90,15 +87,7 @@ small, explicitly gated real-provider smoke test before a release.
90
87
 
91
88
  In CI, build one clean consumer from the packed SDK artifact. This catches
92
89
  missing exports, server/browser boundary leaks, code-generation drift, and
93
- dependency-resolution problems that workspace tests miss. If the application
94
- owns copied templates, also run:
95
-
96
- ```bash
97
- npx vanillasky templates sync --check
98
- npm run build
99
- npm test
100
- ```
101
-
90
+ dependency-resolution problems that workspace tests miss.
102
91
  ## Deployment checklist
103
92
 
104
93
  - [ ] Keys exist only in the server secret store.
@@ -98,8 +98,7 @@ produces safe diagnostics. A media failure does not delete valid narration.
98
98
 
99
99
  AI mode generates footage within the host allowance. Pexels mode searches
100
100
  stock without calling the video generator. Each authored beat includes a short
101
- chapter title; missing footage becomes that chapter with its complete narration. Handlers configured with an explicit custom `templates` registry continue to
102
- support the trusted catalog and its existing structured planner contract.
101
+ chapter title; missing footage becomes that chapter with its complete narration.
103
102
 
104
103
  ## Grounding
105
104