@vanillaskyai/video 0.4.1 → 0.5.1

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 (53) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/PUBLIC-API.md +12 -5
  3. package/README.md +13 -18
  4. package/dist/{builtin-server-BRTZN4Q7.js → builtin-server-YHEZ2JRF.js} +2 -2
  5. package/dist/check-runtime.js +1 -1
  6. package/dist/{chunk-BKF3A357.js → chunk-34O5BY6X.js} +1 -1
  7. package/dist/{chunk-LHFADNWJ.js → chunk-3ROGEU5A.js} +179 -342
  8. package/dist/{chunk-XAMUOSX7.js → chunk-3RV4YKB3.js} +0 -1
  9. package/dist/{chunk-GHJEAP4O.js → chunk-66MNRUCR.js} +1 -1
  10. package/dist/{chunk-EE6PK6XC.js → chunk-AOWSXU2K.js} +1 -1
  11. package/dist/{chunk-GR4I3MN2.js → chunk-EFL34TXF.js} +3 -3
  12. package/dist/{chunk-I5YWVQ5R.js → chunk-FVTMYS6U.js} +1 -1
  13. package/dist/{chunk-STIFILQG.js → chunk-FZHMQFG3.js} +46 -38
  14. package/dist/{chunk-JW47XCRL.js → chunk-G66Z5CWR.js} +30 -72
  15. package/dist/{chunk-RBQN3VSY.js → chunk-HVCPEAQF.js} +83 -1265
  16. package/dist/{chunk-N3KUA7VP.js → chunk-K6YVQODK.js} +4 -1
  17. package/dist/{chunk-WHPZED7X.js → chunk-PNS52FL4.js} +2 -5
  18. package/dist/{chunk-S5ZU5WUU.js → chunk-ZQQQAAKP.js} +2 -2
  19. package/dist/cli.js +20 -14
  20. package/dist/compose-video-QJHKTOQ7.js +13 -0
  21. package/dist/{events-D_1F6gw5.d.ts → events-BBP30j3c.d.ts} +3 -14
  22. package/dist/index.d.ts +2 -2
  23. package/dist/index.js +2 -2
  24. package/dist/{kit-DLeCr3d0.d.ts → kit-DEG3fcaL.d.ts} +1 -1
  25. package/dist/react.d.ts +6 -5
  26. package/dist/react.js +999 -348
  27. package/dist/server.d.ts +3 -3
  28. package/dist/server.js +18 -79
  29. package/dist/{system-prompt-NMYHLAMJ.js → system-prompt-4I6Z5HK3.js} +1 -1
  30. package/dist/template-catalog.js +1 -1
  31. package/dist/templates.d.ts +3 -3
  32. package/dist/templates.js +87 -4
  33. package/dist/test.d.ts +3 -27
  34. package/dist/test.js +3 -3
  35. package/dist/{text-stream-UPGUD2TD.js → text-stream-J6EDDJP4.js} +3 -3
  36. package/dist/{types-Cg0Onj7l.d.ts → types-BV9IqExh.d.ts} +1 -16
  37. package/docs/agent-integration.md +4 -3
  38. package/docs/concepts.md +4 -4
  39. package/docs/custom-templates.md +2 -2
  40. package/docs/getting-started.md +13 -18
  41. package/docs/integrate-nextjs.md +12 -8
  42. package/docs/persistence.md +1 -1
  43. package/docs/prompt-and-input.md +2 -2
  44. package/docs/reference/protocol.md +9 -12
  45. package/docs/reference/provider-adapters.md +5 -5
  46. package/docs/testing.md +1 -1
  47. package/examples/nextjs-quickstart/.env.example +2 -2
  48. package/examples/nextjs-quickstart/README.md +4 -1
  49. package/examples/nextjs-quickstart/package.json +4 -4
  50. package/examples/nextjs-quickstart/src/app/api/video/route.ts +4 -2
  51. package/package.json +8 -8
  52. package/dist/chunk-CR7FE7BW.js +0 -109
  53. package/dist/compose-video-6UQ33DOO.js +0 -13
package/CHANGELOG.md CHANGED
@@ -4,6 +4,94 @@ VanillaSky follows semantic versioning. This changelog begins with the 0.1 beta.
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 0.5.1
8
+
9
+ - Removes the redundant README version badge. Package registries and release
10
+ pages remain the authoritative source for the current version.
11
+
12
+ ## 0.5.0
13
+
14
+ ### Breaking changes
15
+
16
+ - Simplifies streaming protocol `0.5` to complete immutable `scene.add` parts
17
+ followed by `plan.complete`. It removes `scene.patch`, `asset.patch`,
18
+ `plan.error`, and scene revision counters. Provider failures now use thrown
19
+ errors, while media resolution finishes before its scene is emitted.
20
+ - Raises the supported Node.js floor from 20 to 22. Node 20 reached end of life
21
+ and is no longer exercised by the SDK's tests, builds, or clean-room package
22
+ verification.
23
+ - Stops returning the merged built-in template catalog through
24
+ `useVideo().playerProps.templates`. `playerProps` now carries only the
25
+ customer registry passed to `useVideo`, while `VideoPlayer` supplies its
26
+ built-in renderers internally. Existing `<VideoPlayer {...playerProps} />`
27
+ usage is unchanged. This removes planner-only metadata from the initial
28
+ React graph, reducing it from 48,197 to 35,649 gzip bytes.
29
+
30
+ ### Adoption
31
+
32
+ Custom planners that previously emitted a scene and patched it later:
33
+
34
+ ```ts
35
+ yield { type: "scene.add", scene: draftScene };
36
+ yield { type: "asset.patch", sceneId: draftScene.id, variables: resolvedMedia };
37
+ ```
38
+
39
+ should emit one complete scene instead:
40
+
41
+ ```ts
42
+ yield {
43
+ type: "scene.add",
44
+ scene: { ...draftScene, variables: { ...draftScene.variables, ...resolvedMedia } },
45
+ };
46
+ ```
47
+
48
+ Throw planner failures instead of emitting `plan.error`. Protocol `0.4` replay
49
+ logs cannot be mixed into a `0.5` run; completed stored `Video` values remain on
50
+ the unchanged `0.1` storage schema.
51
+
52
+ Update applications that pin Node 20 before installing the next SDK release:
53
+
54
+ ```json
55
+ {
56
+ "engines": { "node": "20.x" }
57
+ }
58
+ ```
59
+
60
+ becomes:
61
+
62
+ ```json
63
+ {
64
+ "engines": { "node": "22.x" }
65
+ }
66
+ ```
67
+
68
+ Code that used the player binding to inspect built-in metadata:
69
+
70
+ ```ts
71
+ const templates = video.playerProps.templates.listTemplateMetadata();
72
+ ```
73
+
74
+ should import the explicit React-free catalog instead:
75
+
76
+ ```ts
77
+ import { builtinTemplates } from "@vanillaskyai/video/templates/catalog";
78
+ ```
79
+
80
+ Inspect a customer registry directly when the application created it; it is
81
+ still passed through `playerProps` unchanged.
82
+
83
+ ### Maintenance
84
+
85
+ - Makes React 19 the primary development and example runtime. CI continues to
86
+ verify React 18 with its own runtime and type packages, including typecheck,
87
+ focused component tests, and a production build.
88
+ - Shares the replay buffer and identical JSON-validation primitives across
89
+ their call sites, removing duplicate implementations without changing the
90
+ public API.
91
+ - Keeps the first install provider-neutral, removes stale version and model
92
+ defaults from public guides, and moves the quality-oriented Anthropic/Sonnet
93
+ choice into the later provider setup step.
94
+
7
95
  ## 0.4.1
8
96
 
9
97
  - Keeps soundtrack audio continuous when a saved `VideoPlayer` uses `loop`.
package/PUBLIC-API.md CHANGED
@@ -1,6 +1,6 @@
1
- # VanillaSky Video 0.2 public API
1
+ # VanillaSky Video public API
2
2
 
3
- Status: frozen public beta contract for `0.3.0`.
3
+ Status: current public beta contract.
4
4
 
5
5
  This document defines the API that may enter the fresh
6
6
  `@vanillaskyai/video` package. An export not listed here is internal. Tests and
@@ -16,7 +16,7 @@ public API review.
16
16
 
17
17
  ## Compatibility promise
18
18
 
19
- - `0.1.x` patch releases do not make breaking changes to documented APIs or the
19
+ - Patch releases do not make breaking changes to documented APIs or the
20
20
  serialized `Video` schema.
21
21
  - A compatible later `0.x` minor needs no migration ceremony. A breaking
22
22
  pre-1.0 minor must document both `### Breaking changes` and `### Adoption` in
@@ -26,7 +26,7 @@ public API review.
26
26
  must pin an exact package version when they use one.
27
27
  - Deprecated APIs remain usable until the next minor release. The `0.1`
28
28
  package starts without undocumented compatibility aliases.
29
- - The package is ESM-only, targets ES2022, and supports Node.js 20 or newer.
29
+ - The package is ESM-only, targets ES2022, and supports Node.js 22 or newer.
30
30
  - React is an optional peer dependency. Only `/react` and renderer definitions
31
31
  under `/templates` may depend on React.
32
32
  - Framework adapters are examples, not separate public APIs. The release suite
@@ -178,6 +178,13 @@ interface UseVideoResult {
178
178
  <VideoPlayer video={savedVideo} />
179
179
  ```
180
180
 
181
+ Built-in renderers are always available, so a streaming `VideoPlayer` does not
182
+ require a template registry. `playerProps` is a spread-ready player binding; it
183
+ contains the customer registry supplied to `useVideo` when one exists, but it
184
+ does not expose the built-in planning catalog. Import `builtinTemplates` from
185
+ `@vanillaskyai/video/templates/catalog` for labels, schemas, selection guidance,
186
+ and other React-free metadata.
187
+
181
188
  Set `playbackMode="autoplay-after-interaction"` for chat feeds: the first
182
189
  soundtrack waits on a visible scene-one poster, and later streams on the same
183
190
  mounted player autoplay with sound after the first successful viewer start.
@@ -290,7 +297,7 @@ from `/server` without crossing a React type boundary.
290
297
 
291
298
  - A completed `Video` is JSON-serializable and may be stored by the host.
292
299
  - Every completed value carries the required storage field
293
- `schemaVersion: "0.1"`; it is independent from streaming protocol `0.4`.
300
+ `schemaVersion: "0.1"`; it is independent from streaming protocol `0.5`.
294
301
  - `parseVideo(value: unknown)` is the strict universal storage boundary. It
295
302
  validates the full document and returns a detached, deeply frozen `Video`.
296
303
  - JSON serialization remains platform-native; the SDK has no redundant public
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # Give your AI a video output
2
2
 
3
- ![Version 0.4.1 beta](https://img.shields.io/badge/version-0.4.1_beta-7c3aed)
4
-
5
3
  **VanillaSky is the open-source video response layer.** Turn text, structured
6
4
  data, and live application context into personalized video responses that start
7
5
  playing while your LLM composes them.
@@ -17,7 +15,7 @@ the planning prompt, trusted templates, validation, streaming, and player.
17
15
  For humans:
18
16
 
19
17
  ```bash
20
- npm install @vanillaskyai/video@0.4.1 ai @ai-sdk/openai
18
+ npm install @vanillaskyai/video
21
19
  ```
22
20
 
23
21
  For coding agents:
@@ -28,24 +26,20 @@ npx skills add VanillaSkyAi/video@vanillasky
28
26
 
29
27
  Then prompt: `Use $vanillasky to turn this application's data into a personalized video response.`
30
28
 
31
- Add your model key to an ignored `.env.local`:
32
-
33
- ```bash
34
- OPENAI_API_KEY=your-key
35
- OPENAI_MODEL=gpt-4.1
36
- ```
37
-
38
29
  ## Connect your LLM
39
30
 
31
+ VanillaSky never chooses a provider or model. Configure that separately on the
32
+ server, then connect the model your application already owns. The route below
33
+ assumes an AI SDK `LanguageModel` exported as `videoModel`; if you do not have
34
+ one yet, choose a provider and current model in [Provider integration](docs/provider-integration.md).
35
+
40
36
  Create one authenticated server route:
41
37
 
42
38
  ```ts
43
39
  // app/api/video/route.ts
44
- import { openai } from "@ai-sdk/openai";
45
40
  import { streamText } from "ai";
46
41
  import { createVideoHandler } from "@vanillaskyai/video/server";
47
-
48
- const model = openai(process.env.OPENAI_MODEL ?? "gpt-4.1");
42
+ import { videoModel } from "@/lib/video-model";
49
43
 
50
44
  const handle = createVideoHandler({
51
45
  // Local development only. Replace with your session check before deploying.
@@ -55,7 +49,7 @@ const handle = createVideoHandler({
55
49
  return hostname === "localhost" || hostname === "127.0.0.1";
56
50
  },
57
51
  streamText: ({ systemPrompt, userPrompt, signal }) => streamText({
58
- model,
52
+ model: videoModel,
59
53
  system: systemPrompt,
60
54
  prompt: userPrompt,
61
55
  abortSignal: signal,
@@ -68,8 +62,10 @@ export const OPTIONS = handle;
68
62
 
69
63
  The packaged development command supplies the local marker only to `next dev`,
70
64
  so production builds and `next start` deny every request. Replace it before
71
- deploying. The model can come from OpenAI, Anthropic, an AI SDK registry or
72
- gateway, or any compatible streaming adapter.
65
+ deploying. The model can come from Anthropic, OpenAI, an AI SDK registry or
66
+ gateway, or any compatible streaming adapter. The
67
+ [Next.js quickstart](examples/nextjs-quickstart) shows the later, explicit
68
+ provider-selection step with a quality-oriented Claude Sonnet model.
73
69
 
74
70
  For planner-selected image and video backgrounds, configure the optional
75
71
  server-only `resolveMedia` callback described in
@@ -105,8 +101,7 @@ That is the complete path. Built-in templates require no setup. VanillaSky
105
101
  shows each complete, validated scene as soon as it is ready and returns a
106
102
  deterministic `Video` object when generation finishes.
107
103
 
108
- A copy-and-run app is in
109
- [`examples/nextjs-quickstart`](https://github.com/VanillaSkyAi/video/tree/v0.4.1/examples/nextjs-quickstart).
104
+ A copy-and-run app is in [`examples/nextjs-quickstart`](examples/nextjs-quickstart).
110
105
 
111
106
  ## Shape the response
112
107
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  BUILTIN_SERVER_TEMPLATE_KIT
3
- } from "./chunk-I5YWVQ5R.js";
4
- import "./chunk-XAMUOSX7.js";
3
+ } from "./chunk-FVTMYS6U.js";
4
+ import "./chunk-3RV4YKB3.js";
5
5
  import "./chunk-2E6T633S.js";
6
6
  export {
7
7
  BUILTIN_SERVER_TEMPLATE_KIT
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VideoFrame
3
- } from "./chunk-N3KUA7VP.js";
3
+ } from "./chunk-K6YVQODK.js";
4
4
  import "./chunk-XWWLKRNU.js";
5
5
  import "./chunk-SPVTJH3F.js";
6
6
  import {
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-E7CL7UPB.js";
7
7
  import {
8
8
  parseVideoPlanPart
9
- } from "./chunk-JW47XCRL.js";
9
+ } from "./chunk-G66Z5CWR.js";
10
10
 
11
11
  // src/server/model/truncated-json.ts
12
12
  function isConfidentlyTruncatedJson(source) {