@vanillaskyai/video 0.2.0 → 0.3.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.
@@ -5,7 +5,7 @@
5
5
  Install VanillaSky and one AI SDK provider:
6
6
 
7
7
  ```bash
8
- npm install @vanillaskyai/video@0.2.0 ai @ai-sdk/openai
8
+ npm install @vanillaskyai/video@0.3.1 ai @ai-sdk/openai
9
9
  ```
10
10
 
11
11
  Create an ignored `.env.local`:
@@ -27,7 +27,7 @@ const model = openai(process.env.OPENAI_MODEL ?? "gpt-4.1");
27
27
  const handle = createVideoHandler({
28
28
  // Local development only. Replace with your session check before deploying.
29
29
  authorize: (request) => {
30
- if (process.env.NODE_ENV !== "development") return false;
30
+ if (process.env.VANILLASKY_LOCAL_DEMO !== "1") return false;
31
31
  const hostname = new URL(request.url).hostname;
32
32
  return hostname === "localhost" || hostname === "127.0.0.1";
33
33
  },
@@ -43,6 +43,9 @@ export const POST = handle;
43
43
  export const OPTIONS = handle;
44
44
  ```
45
45
 
46
+ The packaged `npm run dev` command supplies this non-secret marker only to
47
+ `next dev`. Production builds and `next start` never receive it.
48
+
46
49
  Create a Client Component:
47
50
 
48
51
  ```tsx
@@ -71,7 +74,7 @@ requests; replace it with your application's session validation before
71
74
  deploying.
72
75
 
73
76
  The copy-and-run app is in the
74
- [`examples/nextjs-quickstart` directory](https://github.com/VanillaSkyAi/video/tree/v0.2.0/examples/nextjs-quickstart).
77
+ [`examples/nextjs-quickstart` directory](https://github.com/VanillaSkyAi/video/tree/v0.3.1/examples/nextjs-quickstart).
75
78
 
76
79
  For another LLM, replace `openai(...)` with the matching AI SDK model. The route
77
80
  shape and React code stay the same. See [Provider integration](provider-integration.md)
@@ -81,7 +81,11 @@ Use `playbackMode="manual"` to require the button on every run,
81
81
  `playbackMode="muted-autoplay"` for browser-safe muted autoplay, or
82
82
  `playbackMode="autoplay-with-sound"` to try audible autoplay immediately. The
83
83
  lower-level `autoPlay` and `startMuted` props remain available when no playback
84
- mode is set.
84
+ mode is set. For a chat response that should try audible autoplay without the
85
+ SDK generation intro, pass `opening: false`, wait to mount the player until a
86
+ generated scene exists, and render it with `autoPlay` and `startMuted={false}`.
87
+ If the browser blocks the audible start, the player returns to the first frame
88
+ and exposes its sound-start control.
85
89
 
86
90
  ## Media providers
87
91
 
@@ -40,16 +40,17 @@ video.generate({
40
40
  ```
41
41
 
42
42
  Instructions can influence selection, emphasis, ordering, tone, and pacing.
43
- They never expand the factual boundary, authorize a new media URL, or weaken
44
- the event and validation contract.
43
+ They never change `knowledgeMode`, authorize a new media URL, or weaken the
44
+ event and validation contract.
45
45
 
46
46
  For durable product-wide direction, use the server handler's `basePrompt`.
47
47
  Keep per-request creative direction in `instructions`.
48
48
 
49
- ### 3. Grounded input
49
+ ### 3. Input and knowledge mode
50
50
 
51
- `input` is required and is the complete factual source for the video. It may be
52
- plain text or a serialized structured object:
51
+ `input` is required. With the default `knowledgeMode: "input-only"`, it is the
52
+ complete factual source for the video. It may be plain text or a serialized
53
+ structured object:
53
54
 
54
55
  ```ts
55
56
  video.generate({
@@ -71,6 +72,20 @@ Include exact numbers, quote wording, attribution, names, dates, and product
71
72
  facts that may appear on screen. Do not place secrets, provider keys, or hidden
72
73
  policy in input.
73
74
 
75
+ For a chat question or a request to develop content, opt in explicitly:
76
+
77
+ ```ts
78
+ video.generate({
79
+ input: "How can a small team improve customer onboarding?",
80
+ knowledgeMode: "general",
81
+ });
82
+ ```
83
+
84
+ General mode permits stable model knowledge. The generated system prompt still
85
+ forbids invented citations, quotations, URLs, personal details, live facts,
86
+ guarantees, and precise claims that require a source. Claims already present in
87
+ `input` remain authoritative.
88
+
74
89
  `personalization`, `brand`, and `suppliedMedia` are separate structured context.
75
90
  They do not replace the source material.
76
91
 
@@ -106,7 +121,8 @@ streamText: ({ systemPrompt, userPrompt, signal }) => streamText({
106
121
  `userPrompt` is assembled by VanillaSky from:
107
122
 
108
123
  - orientation and maximum duration;
109
- - whether an opening scene already exists;
124
+ - whether a deterministic opening scene already exists or the host is waiting
125
+ for the first generated scene;
110
126
  - raw `input`;
111
127
  - creative `instructions`;
112
128
  - personalization;
@@ -144,7 +160,7 @@ video.generate({
144
160
  escalationsResolved: "96%",
145
161
  improvementsLaunched: 4,
146
162
  }),
147
- personalization: { firstName: "Joris" },
163
+ personalization: { role: "Product leader", focus: "activation" },
148
164
  });
149
165
  ```
150
166
 
@@ -45,6 +45,41 @@ same handler without adding a VanillaSky abstraction. See
45
45
  [provider adapter reference](reference/provider-adapters.md) for model alternatives and advanced native
46
46
  provider loops.
47
47
 
48
+ ## Planning effort and reasoning modes
49
+
50
+ Planning is a structured emit against a trusted catalog, not a reasoning task.
51
+ Where a provider exposes a reasoning or effort control, a host that wants a
52
+ video to start quickly should turn extended reasoning off and keep effort low
53
+ to moderate. The default matters: several current models reason by default, and
54
+ that reasoning happens before the first plan part is emitted, so it is added
55
+ directly to time to first generated scene.
56
+
57
+ With the Vercel AI SDK and a current Anthropic model, that is one option object:
58
+
59
+ ```ts
60
+ streamText: ({ systemPrompt, userPrompt, signal }) => streamText({
61
+ model,
62
+ system: systemPrompt,
63
+ prompt: userPrompt,
64
+ abortSignal: signal,
65
+ providerOptions: {
66
+ anthropic: { thinking: { type: "disabled" }, effort: "medium" },
67
+ },
68
+ }),
69
+ ```
70
+
71
+ Measured on one grounded chat answer with the 28 built-in templates, leaving
72
+ the Anthropic default in place cost roughly twenty seconds before the first
73
+ scene; disabling reasoning brought the same plan to a few seconds. Other
74
+ providers expose equivalent controls under their own names. Treat the exact
75
+ values as host-owned tuning: the lowest effort setting is the fastest, but a
76
+ weaker plan misses schema limits more often, which shows up as rejected scenes
77
+ in `onComplete`. Compare `timeToFirstSceneMs` and `rejectedSceneCount` across
78
+ settings before fixing one.
79
+
80
+ VanillaSky never sets these controls. Provider selection, sampling parameters,
81
+ and credentials stay with the application.
82
+
48
83
  ## Completion and usage
49
84
 
50
85
  Use `onComplete` for server-side cost and completion measurement:
@@ -118,5 +153,6 @@ same explicit request budget.
118
153
  `createVideoHandler` constructs the planner prompt from the generated server
119
154
  template registry. Normal integrations do not build prompts or capabilities.
120
155
  Use the handler's `basePrompt` option only for durable product-level direction.
121
- Grounded facts still come from `VideoInput.input`; presentation guidance must
122
- never override that factual boundary.
156
+ `VideoInput.knowledgeMode` owns the knowledge boundary: `input-only` is strict
157
+ and remains the default, while `general` permits stable model knowledge.
158
+ Presentation guidance in `basePrompt` or `instructions` never changes it.
@@ -16,7 +16,9 @@ Add your OpenAI API key to `.env.local` before selecting **Generate video**.
16
16
 
17
17
  Open <http://localhost:3000> and select **Generate video**.
18
18
 
19
- The example authorizes local development only and denies production requests.
19
+ The packaged development command supplies a non-secret marker only to
20
+ `next dev`, so the example authorizes local development and denies production
21
+ requests.
20
22
  Replace the local-only authorization before deploying. See the
21
23
  [Next.js guide](../../docs/integrate-nextjs.md) for production and optional
22
24
  configuration.
@@ -3,13 +3,13 @@
3
3
  "private": true,
4
4
  "version": "0.0.0",
5
5
  "scripts": {
6
- "dev": "next dev",
6
+ "dev": "cross-env VANILLASKY_LOCAL_DEMO=1 next dev",
7
7
  "build": "next build",
8
8
  "start": "next start"
9
9
  },
10
10
  "dependencies": {
11
11
  "@ai-sdk/openai": "^4.0.42",
12
- "@vanillaskyai/video": "0.2.0",
12
+ "@vanillaskyai/video": "0.3.1",
13
13
  "ai": "^7.0.66",
14
14
  "next": "16.3.1",
15
15
  "react": "19.2.8",
@@ -19,6 +19,7 @@
19
19
  "@types/node": "^24.10.1",
20
20
  "@types/react": "^19",
21
21
  "@types/react-dom": "^19",
22
+ "cross-env": "10.1.0",
22
23
  "typescript": "^5.9.3"
23
24
  }
24
25
  }
@@ -6,7 +6,7 @@ const model = openai(process.env.OPENAI_MODEL ?? "gpt-4.1");
6
6
 
7
7
  const handle = createVideoHandler({
8
8
  authorize: (request) => {
9
- if (process.env.NODE_ENV !== "development") return false;
9
+ if (process.env.VANILLASKY_LOCAL_DEMO !== "1") return false;
10
10
  const hostname = new URL(request.url).hostname;
11
11
  return hostname === "localhost" || hostname === "127.0.0.1";
12
12
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanillaskyai/video",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Open-source video response SDK for personalized AI applications.",
5
5
  "keywords": [
6
6
  "generative-video",
@@ -1,8 +0,0 @@
1
- import {
2
- DEFAULT_VIDEO_SYSTEM_PROMPT,
3
- VIDEO_PLAN_INSTRUCTION
4
- } from "./chunk-K5SRF7D3.js";
5
- export {
6
- DEFAULT_VIDEO_SYSTEM_PROMPT,
7
- VIDEO_PLAN_INSTRUCTION
8
- };