@vanillaskyai/video 0.4.0 → 0.5.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/CHANGELOG.md +89 -0
- package/PUBLIC-API.md +12 -5
- package/README.md +14 -17
- package/dist/{builtin-server-BRTZN4Q7.js → builtin-server-YHEZ2JRF.js} +2 -2
- package/dist/check-runtime.js +1 -1
- package/dist/{chunk-BKF3A357.js → chunk-34O5BY6X.js} +1 -1
- package/dist/{chunk-LHFADNWJ.js → chunk-3ROGEU5A.js} +179 -342
- package/dist/{chunk-XAMUOSX7.js → chunk-3RV4YKB3.js} +0 -1
- package/dist/{chunk-GHJEAP4O.js → chunk-66MNRUCR.js} +1 -1
- package/dist/{chunk-EE6PK6XC.js → chunk-AOWSXU2K.js} +1 -1
- package/dist/{chunk-GR4I3MN2.js → chunk-EFL34TXF.js} +3 -3
- package/dist/{chunk-I5YWVQ5R.js → chunk-FVTMYS6U.js} +1 -1
- package/dist/{chunk-STIFILQG.js → chunk-FZHMQFG3.js} +46 -38
- package/dist/{chunk-JW47XCRL.js → chunk-G66Z5CWR.js} +30 -72
- package/dist/{chunk-RBQN3VSY.js → chunk-HVCPEAQF.js} +83 -1265
- package/dist/{chunk-N3KUA7VP.js → chunk-K6YVQODK.js} +4 -1
- package/dist/{chunk-WHPZED7X.js → chunk-PNS52FL4.js} +2 -5
- package/dist/{chunk-S5ZU5WUU.js → chunk-ZQQQAAKP.js} +2 -2
- package/dist/cli.js +20 -14
- package/dist/compose-video-QJHKTOQ7.js +13 -0
- package/dist/{events-D_1F6gw5.d.ts → events-BBP30j3c.d.ts} +3 -14
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{kit-DLeCr3d0.d.ts → kit-DEG3fcaL.d.ts} +1 -1
- package/dist/react.d.ts +7 -6
- package/dist/react.js +1000 -349
- package/dist/server.d.ts +3 -3
- package/dist/server.js +18 -79
- package/dist/{system-prompt-NMYHLAMJ.js → system-prompt-4I6Z5HK3.js} +1 -1
- package/dist/template-catalog.js +1 -1
- package/dist/templates.d.ts +3 -3
- package/dist/templates.js +87 -4
- package/dist/test.d.ts +3 -27
- package/dist/test.js +3 -3
- package/dist/{text-stream-UPGUD2TD.js → text-stream-J6EDDJP4.js} +3 -3
- package/dist/{types-Cg0Onj7l.d.ts → types-BV9IqExh.d.ts} +1 -16
- package/docs/agent-integration.md +4 -3
- package/docs/concepts.md +4 -4
- package/docs/custom-templates.md +2 -2
- package/docs/getting-started.md +13 -18
- package/docs/integrate-nextjs.md +12 -8
- package/docs/live-channels.md +5 -2
- package/docs/media-and-audio.md +7 -0
- package/docs/persistence.md +1 -1
- package/docs/prompt-and-input.md +2 -2
- package/docs/reference/protocol.md +9 -12
- package/docs/reference/provider-adapters.md +5 -5
- package/docs/testing.md +1 -1
- package/examples/nextjs-quickstart/.env.example +2 -2
- package/examples/nextjs-quickstart/README.md +4 -1
- package/examples/nextjs-quickstart/package.json +4 -4
- package/examples/nextjs-quickstart/src/app/api/video/route.ts +4 -2
- package/package.json +8 -8
- package/dist/chunk-CR7FE7BW.js +0 -109
- package/dist/compose-video-6UQ33DOO.js +0 -13
|
@@ -101,7 +101,10 @@ function SceneLayer({
|
|
|
101
101
|
style: { position: "absolute", inset: 0 }
|
|
102
102
|
}
|
|
103
103
|
), children: createElement(template.component, {
|
|
104
|
-
variables: {
|
|
104
|
+
variables: {
|
|
105
|
+
...template.defaults ?? getTemplateDefaults(template.schema),
|
|
106
|
+
...range.scene.variables
|
|
107
|
+
},
|
|
105
108
|
style: config.style,
|
|
106
109
|
progress,
|
|
107
110
|
motionProgress,
|
|
@@ -3,8 +3,6 @@ var VIDEO_PLAN_INSTRUCTION = `Wire format: newline-delimited JSON (NDJSON), exac
|
|
|
3
3
|
Allowed plan parts:
|
|
4
4
|
{"type":"scene.add","scene":{"id":"stable-id","templateId":"trusted-template-id","variables":{},"timing":{"fixedDuration":4}}}
|
|
5
5
|
{"type":"scene.add","placement":"closer","scene":{"id":"closer","templateId":"trusted-closer-template-id","variables":{},"timing":{"fixedDuration":3}}}
|
|
6
|
-
{"type":"scene.patch","sceneId":"stable-id","patch":{"variables":{"message":"Updated copy"}}}
|
|
7
|
-
{"type":"asset.patch","sceneId":"stable-id","variables":{"mediaUrl":"https://customer-approved.example/asset"}}
|
|
8
6
|
{"type":"plan.complete","finishReason":"stop"}
|
|
9
7
|
Do not emit protocol envelopes, Markdown fences, comments, prose, partial objects, audio, generated source, or any part type not listed above.`;
|
|
10
8
|
function knowledgeRules(mode) {
|
|
@@ -39,10 +37,9 @@ Composition rules:
|
|
|
39
37
|
- Audio is selected by the host before generation. Never emit audio.
|
|
40
38
|
|
|
41
39
|
Streaming rules:
|
|
42
|
-
- Emit
|
|
40
|
+
- Emit every scene once as a complete scene.add.
|
|
43
41
|
- Emit exactly one closer immediately after the first playable body scene using placement:"closer". The runtime holds that closer and appends it last while later body scenes continue streaming.
|
|
44
|
-
-
|
|
45
|
-
- Prefer resolved media on scene.add. Use asset.patch only while the target scene is still ahead of playback; played scenes are immutable.
|
|
42
|
+
- Prefer resolved media on scene.add. Scenes are immutable after emission.
|
|
46
43
|
- End explicitly with plan.complete. A truncated stream is never treated as complete.
|
|
47
44
|
- Return only plan parts accepted by the provided schema.
|
|
48
45
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseVideoEvent
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-G66Z5CWR.js";
|
|
4
4
|
import {
|
|
5
5
|
VIDEO_PROTOCOL_VERSION
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AOWSXU2K.js";
|
|
7
7
|
|
|
8
8
|
// src/protocol/sse.ts
|
|
9
9
|
var VIDEO_STREAM_HEADER = "x-vanillasky-video-stream";
|
package/dist/cli.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./chunk-
|
|
3
|
-
import "./chunk-
|
|
2
|
+
import "./chunk-EFL34TXF.js";
|
|
3
|
+
import "./chunk-PNS52FL4.js";
|
|
4
4
|
import "./chunk-3O7OMMMF.js";
|
|
5
|
+
import {
|
|
6
|
+
getBuiltinTemplateMetadata,
|
|
7
|
+
listBuiltinTemplateMetadata
|
|
8
|
+
} from "./chunk-3RV4YKB3.js";
|
|
5
9
|
import {
|
|
6
10
|
isTemplatePropertyFormatSupported,
|
|
7
11
|
validateTemplateSchemaValue
|
|
8
12
|
} from "./chunk-352ZZCET.js";
|
|
9
|
-
import {
|
|
10
|
-
getBuiltinTemplateMetadata,
|
|
11
|
-
listBuiltinTemplateMetadata
|
|
12
|
-
} from "./chunk-XAMUOSX7.js";
|
|
13
13
|
import {
|
|
14
14
|
assertTemplateTransitionMetadata
|
|
15
15
|
} from "./chunk-2E6T633S.js";
|
|
16
16
|
import {
|
|
17
17
|
BUILTIN_TEMPLATE_MANIFEST
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-HVCPEAQF.js";
|
|
19
19
|
import {
|
|
20
20
|
getTemplateDefaults,
|
|
21
21
|
isMeaningfullyPresentTemplateValue,
|
|
@@ -318,7 +318,7 @@ import { pathToFileURL } from "url";
|
|
|
318
318
|
|
|
319
319
|
// src/cli/trusted-source-process.ts
|
|
320
320
|
import { spawn } from "child_process";
|
|
321
|
-
var
|
|
321
|
+
var DEFAULT_TRUSTED_SOURCE_TIMEOUT_MS = 1e4;
|
|
322
322
|
var DEFAULT_MAX_OUTPUT_BYTES = 1024 * 1024;
|
|
323
323
|
var TrustedSourceProcessError = class extends Error {
|
|
324
324
|
kind;
|
|
@@ -359,7 +359,7 @@ async function runTrustedSourceProcess(args, options) {
|
|
|
359
359
|
"Project template execution is not supported on Windows because portable process-tree cleanup cannot be guaranteed. Use --builtin from Windows or run project template commands in WSL."
|
|
360
360
|
);
|
|
361
361
|
}
|
|
362
|
-
const timeoutMs = options.timeoutMs ??
|
|
362
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TRUSTED_SOURCE_TIMEOUT_MS;
|
|
363
363
|
const maxOutputBytes = options.maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES;
|
|
364
364
|
const operation = options.operation ?? "loading";
|
|
365
365
|
let cleanup;
|
|
@@ -771,7 +771,7 @@ async function syncTemplates(options = {}) {
|
|
|
771
771
|
import { createHash } from "crypto";
|
|
772
772
|
import { join as join5, relative as relative4, resolve as resolve5 } from "path";
|
|
773
773
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
774
|
-
var
|
|
774
|
+
var DEFAULT_TIMEOUT_MS = 15e3;
|
|
775
775
|
var checkRuntimeUrl = new URL("./check-runtime.js", import.meta.url).href;
|
|
776
776
|
var JOBS = new Set(BUILTIN_TEMPLATE_MANIFEST.flatMap(({ jobs }) => jobs));
|
|
777
777
|
var REGISTERS = new Set(BUILTIN_TEMPLATE_MANIFEST.map(({ register }) => register));
|
|
@@ -960,7 +960,7 @@ function validateVariables(schema, variables, path, enforceRequiredAnyOf) {
|
|
|
960
960
|
}
|
|
961
961
|
}
|
|
962
962
|
}
|
|
963
|
-
function
|
|
963
|
+
function validateDiscoveredTemplate(template, cwd) {
|
|
964
964
|
const metadata = template.metadata;
|
|
965
965
|
const file = relative4(cwd, template.filePath);
|
|
966
966
|
const fail = (message) => {
|
|
@@ -1116,15 +1116,21 @@ async function verifyGeneratedParity(cwd, expected, timeoutMs, maxOutputBytes, r
|
|
|
1116
1116
|
}
|
|
1117
1117
|
async function checkTemplates(options = {}) {
|
|
1118
1118
|
const cwd = resolve5(options.cwd ?? process.cwd());
|
|
1119
|
-
const timeoutMs = options.timeoutMs ??
|
|
1119
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1120
1120
|
const templates = await discoverProjectTemplates(cwd, {
|
|
1121
1121
|
timeoutMs,
|
|
1122
1122
|
maxOutputBytes: options.maxOutputBytes
|
|
1123
1123
|
});
|
|
1124
1124
|
if (templates.length === 0) throw new Error("No templates found in vanillasky/templates.");
|
|
1125
1125
|
const runtime = resolveProjectTsxRuntime();
|
|
1126
|
-
const examples = templates.map((template) => ({
|
|
1127
|
-
|
|
1126
|
+
const examples = templates.map((template) => ({
|
|
1127
|
+
template,
|
|
1128
|
+
examples: validateDiscoveredTemplate(template, cwd)
|
|
1129
|
+
}));
|
|
1130
|
+
const generated = await inspectGeneratedTemplateStatus(cwd, templates);
|
|
1131
|
+
if (!generated.current) {
|
|
1132
|
+
throw new Error(`Generated template files are out of date: ${generated.stale.join(", ")}. Run \`vanillasky sync\`.`);
|
|
1133
|
+
}
|
|
1128
1134
|
let renders = 0;
|
|
1129
1135
|
for (const item2 of examples) {
|
|
1130
1136
|
for (const example of item2.examples) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createVideo
|
|
3
|
+
} from "./chunk-3ROGEU5A.js";
|
|
4
|
+
import "./chunk-E7CL7UPB.js";
|
|
5
|
+
import "./chunk-FZHMQFG3.js";
|
|
6
|
+
import "./chunk-G66Z5CWR.js";
|
|
7
|
+
import "./chunk-66MNRUCR.js";
|
|
8
|
+
import "./chunk-AOWSXU2K.js";
|
|
9
|
+
import "./chunk-3O7OMMMF.js";
|
|
10
|
+
import "./chunk-XGRA2MUV.js";
|
|
11
|
+
export {
|
|
12
|
+
createVideo
|
|
13
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { b as VideoOrientation, V as VideoStyle, c as Video, a as VideoCapabilities, d as VideoAudio, e as VideoScene, f as VIDEO_PROTOCOL_VERSION } from './types-
|
|
1
|
+
import { b as VideoOrientation, V as VideoStyle, c as Video, a as VideoCapabilities, d as VideoAudio, e as VideoScene, f as VIDEO_PROTOCOL_VERSION } from './types-BV9IqExh.js';
|
|
2
2
|
|
|
3
3
|
type VideoWarningCategory = "validation" | "readability" | "grounding" | "provider" | "media" | "protocol";
|
|
4
|
-
type VideoWarningCode = "scene_duration_adjusted" | "scene_omitted_unreadable" | "scene_omitted_for_closer" | "
|
|
4
|
+
type VideoWarningCode = "scene_duration_adjusted" | "scene_omitted_unreadable" | "scene_omitted_for_closer" | "chart_scale_imbalance" | "plan_incomplete" | "plan_missing_closer" | "provider_warning" | "provider_diagnostics_unavailable";
|
|
5
5
|
/** A bounded, client-safe diagnostic that never includes provider payloads. */
|
|
6
6
|
interface VideoWarning {
|
|
7
7
|
code: VideoWarningCode;
|
|
@@ -28,17 +28,6 @@ interface VideoEventDataMap {
|
|
|
28
28
|
"scene.add": {
|
|
29
29
|
scene: VideoScene;
|
|
30
30
|
position: number;
|
|
31
|
-
revision: number;
|
|
32
|
-
};
|
|
33
|
-
"scene.patch": {
|
|
34
|
-
sceneId: string;
|
|
35
|
-
revision: number;
|
|
36
|
-
patch: Partial<Omit<VideoScene, "id" | "templateId">>;
|
|
37
|
-
};
|
|
38
|
-
"asset.patch": {
|
|
39
|
-
sceneId: string;
|
|
40
|
-
revision: number;
|
|
41
|
-
variables: Record<string, unknown>;
|
|
42
31
|
};
|
|
43
32
|
"response.warning": {
|
|
44
33
|
warning: VideoWarning;
|
|
@@ -78,4 +67,4 @@ type VideoCoreEvent = {
|
|
|
78
67
|
type VideoExtensionEvent<TData = unknown> = VideoEventEnvelope<VideoExtensionEventType, TData>;
|
|
79
68
|
type VideoEvent = VideoCoreEvent | VideoExtensionEvent;
|
|
80
69
|
|
|
81
|
-
export type {
|
|
70
|
+
export type { VideoWarning as V, VideoFinishReason as a, VideoEvent as b, VideoWarningCategory as c };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as Video, g as VideoBrandInput, h as VideoBrand } from './types-
|
|
2
|
-
export { d as VideoAudio, i as VideoBackground, j as VideoInput, k as VideoKnowledgeMode, b as VideoOrientation, e as VideoScene, V as VideoStyle, l as VideoStyleOptions, m as VideoSuppliedMedia } from './types-
|
|
1
|
+
import { c as Video, g as VideoBrandInput, h as VideoBrand } from './types-BV9IqExh.js';
|
|
2
|
+
export { d as VideoAudio, i as VideoBackground, j as VideoInput, k as VideoKnowledgeMode, b as VideoOrientation, e as VideoScene, V as VideoStyle, l as VideoStyleOptions, m as VideoSuppliedMedia } from './types-BV9IqExh.js';
|
|
3
3
|
export { V as VideoStatus } from './state-DZcKuS32.js';
|
|
4
4
|
|
|
5
5
|
type VideoValidationErrorCode = "invalid_video" | "unsupported_video_version";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { V as VideoStyle, a as VideoCapabilities } from './types-
|
|
1
|
+
import { V as VideoStyle, a as VideoCapabilities } from './types-BV9IqExh.js';
|
|
2
2
|
import { ComponentType } from 'react';
|
|
3
3
|
import { S as SceneTemplateMetadata, d as TemplateJsonSchema, f as TemplateJsonSchemaProperty } from './catalog-types-BIhSpOWK.js';
|
|
4
4
|
|
package/dist/react.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { CSSProperties, ReactElement } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { b as VideoOrientation, c as Video, e as VideoScene, j as VideoInput } from './types-
|
|
4
|
-
import { T as TemplateRegistry } from './kit-
|
|
2
|
+
import { b as VideoEvent, V as VideoWarning } from './events-BBP30j3c.js';
|
|
3
|
+
import { b as VideoOrientation, c as Video, e as VideoScene, j as VideoInput } from './types-BV9IqExh.js';
|
|
4
|
+
import { T as TemplateRegistry } from './kit-DEG3fcaL.js';
|
|
5
5
|
import { V as VideoStatus } from './state-DZcKuS32.js';
|
|
6
6
|
import './catalog-types-BIhSpOWK.js';
|
|
7
7
|
|
|
8
8
|
type VideoPlaybackMode = "manual" | "muted-autoplay" | "autoplay-with-sound" | "autoplay-after-interaction";
|
|
9
|
+
|
|
9
10
|
interface VideoPlayerSharedProps {
|
|
10
11
|
/** High-level startup policy. When set, this overrides autoPlay and startMuted. */
|
|
11
12
|
playbackMode?: VideoPlaybackMode;
|
|
@@ -22,7 +23,7 @@ interface VideoPlayerSharedProps {
|
|
|
22
23
|
style?: CSSProperties;
|
|
23
24
|
/** Accessible name for the player region. */
|
|
24
25
|
ariaLabel?: string;
|
|
25
|
-
/**
|
|
26
|
+
/** Repeat the saved video and its soundtrack instead of showing the replay affordance. */
|
|
26
27
|
loop?: boolean;
|
|
27
28
|
onComplete?: (video: Video) => void;
|
|
28
29
|
onError?: (error: Error) => void;
|
|
@@ -36,8 +37,9 @@ type VideoPlayerProps = VideoPlayerSharedProps & ({
|
|
|
36
37
|
} | {
|
|
37
38
|
stream?: AsyncIterable<VideoEvent>;
|
|
38
39
|
video?: never;
|
|
39
|
-
templates
|
|
40
|
+
templates?: TemplateRegistry;
|
|
40
41
|
});
|
|
42
|
+
|
|
41
43
|
declare function VideoPlayer({ templates, stream, video, onComplete, onError, ...props }: VideoPlayerProps): ReactElement | null;
|
|
42
44
|
|
|
43
45
|
interface VideoErrorOptions {
|
|
@@ -79,7 +81,6 @@ interface UseVideoResult {
|
|
|
79
81
|
warnings: readonly VideoWarning[];
|
|
80
82
|
/** Spread into an explicitly rendered VideoPlayer. */
|
|
81
83
|
playerProps: VideoPlayerProps & {
|
|
82
|
-
templates: TemplateRegistry;
|
|
83
84
|
video?: never;
|
|
84
85
|
};
|
|
85
86
|
}
|