@vanillaskyai/video 0.6.0 → 0.7.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.
- package/CHANGELOG.md +164 -0
- package/PUBLIC-API.md +123 -9
- package/README.md +69 -115
- package/dist/{bg-confetti-SHQI7ATB.js → bg-confetti-HITCGLGD.js} +1 -1
- package/dist/{bg-emoji-XYFRA63Q.js → bg-emoji-VU4UZYZN.js} +1 -1
- package/dist/{bg-media-G4XOQEAS.js → bg-media-L34PDQXJ.js} +2 -2
- package/dist/{brand-message-XHONEDNW.js → brand-message-FUJ4STFO.js} +1 -1
- package/dist/{builtin-server-YHEZ2JRF.js → builtin-server-KB7FKF6A.js} +2 -2
- package/dist/{chart-bar-HRHD57ML.js → chart-bar-EGPHJATL.js} +2 -2
- package/dist/{chart-counter-KFPV44RB.js → chart-counter-5FFWQNZO.js} +2 -2
- package/dist/{chart-progress-ring-OR2VOIHV.js → chart-progress-ring-JMXQLMLC.js} +2 -2
- package/dist/{chunk-66MNRUCR.js → chunk-2PYO6VAC.js} +51 -3
- package/dist/{chunk-ZQQQAAKP.js → chunk-2XT4MZ76.js} +33 -2
- package/dist/{chunk-PNS52FL4.js → chunk-5SLENAJW.js} +19 -6
- package/dist/{chunk-EFL34TXF.js → chunk-AITKH6QT.js} +24 -8
- package/dist/{chunk-FZHMQFG3.js → chunk-GAIOHGNR.js} +5 -21
- package/dist/{chunk-3RV4YKB3.js → chunk-JNN3EYVP.js} +51 -26
- package/dist/{chunk-HVCPEAQF.js → chunk-LKBZX7GV.js} +9 -6
- package/dist/{chunk-34O5BY6X.js → chunk-LLPMVDJZ.js} +21 -4
- package/dist/{chunk-G66Z5CWR.js → chunk-MMUXVA47.js} +27 -3
- package/dist/{chunk-7BGAU6C3.js → chunk-MXZSDGZQ.js} +2 -1
- package/dist/{chunk-3OU7HIEB.js → chunk-RE4IMWJR.js} +15 -31
- package/dist/{chunk-FVTMYS6U.js → chunk-RGF452LL.js} +1 -1
- package/dist/chunk-SKRGRKHY.js +142 -0
- package/dist/{chunk-TCEHK2BW.js → chunk-YJJC4N4D.js} +2 -1
- package/dist/cli.js +438 -30
- package/dist/{compose-video-JWIEDTEJ.js → compose-video-PD6LKKRK.js} +4 -4
- package/dist/{cta-logo-JJOGK4UC.js → cta-logo-YR7LYUR5.js} +1 -1
- package/dist/{cta-media-IQ3MAWEH.js → cta-media-DQJBKUO2.js} +2 -2
- package/dist/{events-BBP30j3c.d.ts → events-B6qS1Lsb.d.ts} +2 -2
- package/dist/{incoming-call-KXF67OT2.js → incoming-call-54KQ7O5A.js} +1 -1
- package/dist/index.d.ts +89 -3
- package/dist/index.js +12 -1
- package/dist/{infographic-before-after-2I7YZVDD.js → infographic-before-after-ROS52GOW.js} +1 -1
- package/dist/{infographic-feature-list-QDM4I7XE.js → infographic-feature-list-E7MGUDAN.js} +2 -2
- package/dist/{infographic-problem-solution-FMLJCPG6.js → infographic-problem-solution-3S6NGO5N.js} +2 -2
- package/dist/{infographic-stat-row-VFTIXS5F.js → infographic-stat-row-SYB7AB7H.js} +2 -2
- package/dist/{infographic-steps-L7W24Z35.js → infographic-steps-KCE6JWE2.js} +2 -2
- package/dist/{kit-DEG3fcaL.d.ts → kit-8g46H2RZ.d.ts} +1 -1
- package/dist/{prompt-input-F3CYU2XH.js → prompt-input-MHX4O42G.js} +1 -1
- package/dist/react.d.ts +194 -6
- package/dist/react.js +1849 -40
- package/dist/{reaction-2XCLOJOK.js → reaction-SLEGR3BE.js} +2 -2
- package/dist/server.d.ts +102 -4
- package/dist/server.js +972 -27
- package/dist/{showcase-code-KHSMIPG6.js → showcase-code-2HLAVKBM.js} +2 -2
- package/dist/{showcase-phone-M4CEANIW.js → showcase-phone-Q4HEO4LH.js} +2 -2
- package/dist/{showcase-terminal-26I3DYF7.js → showcase-terminal-DL45LUFG.js} +2 -2
- package/dist/{showcase-web-TY6CZV2Z.js → showcase-web-2QZO73FZ.js} +2 -2
- package/dist/{social-milestone-TF6MX7ET.js → social-milestone-GEFUQSBF.js} +1 -1
- package/dist/{social-notification-2RJDAZSF.js → social-notification-FJ5VHVLK.js} +1 -1
- package/dist/{social-review-stack-2ICKJQG7.js → social-review-stack-KXQCKFRP.js} +1 -1
- package/dist/{social-testimonial-X7OGADA3.js → social-testimonial-JZ7CHC7S.js} +1 -1
- package/dist/{social-tweet-TK7SH2F6.js → social-tweet-UCDXM25F.js} +1 -1
- package/dist/{system-prompt-4I6Z5HK3.js → system-prompt-RRXIWDDD.js} +5 -3
- package/dist/template-catalog.js +1 -1
- package/dist/templates.d.ts +3 -3
- package/dist/test.d.ts +2 -2
- package/dist/test.js +3 -3
- package/dist/{text-stream-J6EDDJP4.js → text-stream-ROTNGSD4.js} +2 -2
- package/dist/{types-BV9IqExh.d.ts → types-2wHBqtg8.d.ts} +29 -1
- package/dist/types-DrABlRa7.d.ts +46 -0
- package/docs/agent-integration.md +49 -25
- package/docs/architecture.md +37 -22
- package/docs/branding-and-personalization.md +1 -1
- package/docs/concepts.md +14 -0
- package/docs/custom-templates.md +9 -9
- package/docs/customization.md +41 -5
- package/docs/getting-started.md +81 -84
- package/docs/media-and-audio.md +103 -166
- package/docs/persistence.md +1 -1
- package/docs/production.md +81 -92
- package/docs/prompt-and-input.md +71 -161
- package/docs/provider-integration.md +91 -49
- package/docs/responsive-orientation.md +1 -1
- package/docs/security.md +6 -5
- package/docs/streaming-protocol.md +1 -1
- package/docs/testing.md +51 -43
- package/examples/custom-template/README.md +1 -1
- package/package.json +20 -22
- package/registry/items/barChart.json +6 -4
- package/registry/items/beforeAfter.json +1 -1
- package/registry/items/bigNumber.json +4 -3
- package/registry/items/brandMessage.json +3 -2
- package/registry/items/cardList.json +6 -4
- package/registry/items/codeEditor.json +4 -3
- package/registry/items/confetti.json +1 -1
- package/registry/items/ctaLogo.json +3 -2
- package/registry/items/ctaMedia.json +4 -3
- package/registry/items/emojiBurst.json +1 -1
- package/registry/items/incomingCall.json +3 -2
- package/registry/items/media.json +4 -3
- package/registry/items/milestone.json +3 -2
- package/registry/items/notification.json +3 -2
- package/registry/items/phoneMockup.json +4 -3
- package/registry/items/problemSolution.json +4 -3
- package/registry/items/progressRing.json +4 -3
- package/registry/items/promptInput.json +3 -2
- package/registry/items/reaction.json +2 -2
- package/registry/items/reviewStack.json +3 -2
- package/registry/items/steps.json +6 -4
- package/registry/items/terminal.json +5 -4
- package/registry/items/testimonial.json +3 -2
- package/registry/items/tripleStats.json +4 -3
- package/registry/items/tweet.json +3 -2
- package/registry/items/webMockup.json +4 -3
- package/starters/video-chat/.env.example +16 -0
- package/starters/video-chat/README.md +63 -0
- package/starters/video-chat/index.html +12 -0
- package/starters/video-chat/package.json +28 -0
- package/starters/video-chat/server.ts +152 -0
- package/starters/video-chat/src/main.tsx +8 -0
- package/starters/video-chat/stock.ts +139 -0
- package/starters/video-chat/tsconfig.json +20 -0
- package/starters/video-chat/vite.config.ts +81 -0
- package/styles/video-chat.css +713 -0
- package/docs/input-and-first-scene.md +0 -64
- package/docs/integrate-nextjs.md +0 -86
- package/docs/live-channels.md +0 -149
- package/docs/use-cases.md +0 -59
- package/examples/nextjs-quickstart/.env.example +0 -2
- package/examples/nextjs-quickstart/README.md +0 -27
- package/examples/nextjs-quickstart/next-env.d.ts +0 -4
- package/examples/nextjs-quickstart/package.json +0 -25
- package/examples/nextjs-quickstart/src/app/api/video/route.ts +0 -33
- package/examples/nextjs-quickstart/src/app/layout.tsx +0 -5
- package/examples/nextjs-quickstart/src/app/page.tsx +0 -31
- package/examples/nextjs-quickstart/tsconfig.json +0 -26
- package/examples/server-integrations/README.md +0 -20
- package/examples/server-integrations/src/ai-sdk-media.ts +0 -90
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"noUnusedLocals": true,
|
|
11
|
+
"noUnusedParameters": true,
|
|
12
|
+
"module": "ESNext",
|
|
13
|
+
"moduleResolution": "Bundler",
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
"jsx": "react-jsx"
|
|
18
|
+
},
|
|
19
|
+
"include": ["src", "vite.config.ts", "server.ts", "stock.ts"]
|
|
20
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { defineConfig, loadEnv, type Plugin } from "vite";
|
|
2
|
+
import react from "@vitejs/plugin-react";
|
|
3
|
+
|
|
4
|
+
/** Mount the SDK's single video-chat endpoint on the Vite development server. */
|
|
5
|
+
function videoChatRoutes(): Plugin {
|
|
6
|
+
return {
|
|
7
|
+
name: "video-chat-routes",
|
|
8
|
+
apply: "serve",
|
|
9
|
+
configureServer(server) {
|
|
10
|
+
server.middlewares.use(async (request, response, next) => {
|
|
11
|
+
const url = new URL(request.url ?? "/", "http://localhost");
|
|
12
|
+
const path = url.pathname;
|
|
13
|
+
if (path !== "/api/video-chat") return next();
|
|
14
|
+
const action = url.searchParams.get("action");
|
|
15
|
+
if (!process.env.ANTHROPIC_API_KEY && action !== "welcome" && action !== "capabilities") {
|
|
16
|
+
response.statusCode = 503;
|
|
17
|
+
response.end("Set ANTHROPIC_API_KEY and restart. Video responses require a text provider.");
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const startedAt = Date.now();
|
|
22
|
+
const since = () => `${String(Date.now() - startedAt).padStart(6)}ms`;
|
|
23
|
+
const client = new AbortController();
|
|
24
|
+
request.once("aborted", () => client.abort("client disconnected"));
|
|
25
|
+
response.once("close", () => {
|
|
26
|
+
if (!response.writableEnded) client.abort("client disconnected");
|
|
27
|
+
});
|
|
28
|
+
try {
|
|
29
|
+
const chunks: Buffer[] = [];
|
|
30
|
+
for await (const chunk of request) chunks.push(chunk as Buffer);
|
|
31
|
+
const routes = await server.ssrLoadModule("/server.ts");
|
|
32
|
+
const raw = Buffer.concat(chunks);
|
|
33
|
+
const headers = new Headers();
|
|
34
|
+
for (const [name, value] of Object.entries(request.headers)) {
|
|
35
|
+
if (Array.isArray(value)) value.forEach((entry) => headers.append(name, entry));
|
|
36
|
+
else if (value != null) headers.set(name, value);
|
|
37
|
+
}
|
|
38
|
+
headers.delete("content-length");
|
|
39
|
+
const incoming = new Request(`http://localhost${request.url}`, {
|
|
40
|
+
method: request.method,
|
|
41
|
+
headers,
|
|
42
|
+
signal: client.signal,
|
|
43
|
+
...(request.method === "GET" || request.method === "HEAD" ? {} : { body: raw }),
|
|
44
|
+
});
|
|
45
|
+
const result: Response = await routes.handleVideoChat(incoming);
|
|
46
|
+
response.statusCode = result.status;
|
|
47
|
+
result.headers.forEach((value, key) => response.setHeader(key, value));
|
|
48
|
+
if (!result.body) return void response.end();
|
|
49
|
+
|
|
50
|
+
const streamsEvents = result.headers.get("content-type")?.includes("text/event-stream") === true;
|
|
51
|
+
if (streamsEvents) {
|
|
52
|
+
response.setHeader("cache-control", "no-cache, no-transform");
|
|
53
|
+
response.flushHeaders();
|
|
54
|
+
response.socket?.setNoDelay(true);
|
|
55
|
+
}
|
|
56
|
+
let firstChunk = true;
|
|
57
|
+
for await (const chunk of result.body as unknown as AsyncIterable<Uint8Array>) {
|
|
58
|
+
if (firstChunk) {
|
|
59
|
+
firstChunk = false;
|
|
60
|
+
server.config.logger.info(`[video-chat] ${since()} ${action ?? "unknown"} first byte`);
|
|
61
|
+
}
|
|
62
|
+
response.write(chunk);
|
|
63
|
+
}
|
|
64
|
+
server.config.logger.info(`[video-chat] ${since()} ${action ?? "unknown"} complete`);
|
|
65
|
+
response.end();
|
|
66
|
+
} catch (cause) {
|
|
67
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
68
|
+
server.config.logger.error(`[video-chat] ${action ?? "unknown"} failed: ${message}`);
|
|
69
|
+
if (!response.headersSent) response.statusCode = 500;
|
|
70
|
+
response.end("Video chat request failed");
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default defineConfig(({ mode }) => {
|
|
78
|
+
const localEnvironment = loadEnv(mode, process.cwd(), "");
|
|
79
|
+
for (const [name, value] of Object.entries(localEnvironment)) process.env[name] ??= value;
|
|
80
|
+
return { plugins: [react(), videoChatRoutes()] };
|
|
81
|
+
});
|