@vanillaskyai/video 0.1.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 +45 -0
- package/LICENSE +201 -0
- package/PUBLIC-API.md +276 -0
- package/README.md +152 -0
- package/SECURITY.md +22 -0
- package/SUPPORT.md +28 -0
- package/bin/vanillasky.js +3 -0
- package/dist/bg-confetti-WNQXS7ZS.js +89 -0
- package/dist/bg-emoji-ETI47GLS.js +150 -0
- package/dist/bg-media-SVUZAMGX.js +99 -0
- package/dist/brand-message-F3RD4P3P.js +253 -0
- package/dist/builtin-server-F7YXRVCH.js +8 -0
- package/dist/catalog-types-BIhSpOWK.d.ts +74 -0
- package/dist/chart-bar-CNSC7BNK.js +304 -0
- package/dist/chart-counter-MCRHKN77.js +299 -0
- package/dist/chart-progress-ring-RMI4A7ZK.js +296 -0
- package/dist/check-runtime.d.ts +15 -0
- package/dist/check-runtime.js +102 -0
- package/dist/chunk-2E6T633S.js +27 -0
- package/dist/chunk-352ZZCET.js +83 -0
- package/dist/chunk-73NTSFFI.js +81 -0
- package/dist/chunk-A2X45FET.js +46 -0
- package/dist/chunk-ABPKM4GK.js +187 -0
- package/dist/chunk-ABZACD4G.js +216 -0
- package/dist/chunk-BCRUUJ6A.js +756 -0
- package/dist/chunk-CHLGW22F.js +3551 -0
- package/dist/chunk-CJ7F2CE6.js +104 -0
- package/dist/chunk-CR7FE7BW.js +109 -0
- package/dist/chunk-E7CL7UPB.js +109 -0
- package/dist/chunk-EE6PK6XC.js +18 -0
- package/dist/chunk-ERY4S6QV.js +385 -0
- package/dist/chunk-EVG2ZYIY.js +125 -0
- package/dist/chunk-FNAEQ7QO.js +155 -0
- package/dist/chunk-FQ47WXAJ.js +38 -0
- package/dist/chunk-FSG2PYWG.js +336 -0
- package/dist/chunk-GHJEAP4O.js +504 -0
- package/dist/chunk-GRMUV7QY.js +262 -0
- package/dist/chunk-IFOW65Z6.js +205 -0
- package/dist/chunk-IXCUY3B3.js +786 -0
- package/dist/chunk-L5BTTCZV.js +97 -0
- package/dist/chunk-LMG3GHLL.js +107 -0
- package/dist/chunk-OOPIETLW.js +101 -0
- package/dist/chunk-P22HHFDK.js +43 -0
- package/dist/chunk-QAAO7OAY.js +19 -0
- package/dist/chunk-S7HFLYNN.js +35 -0
- package/dist/chunk-SPVTJH3F.js +24 -0
- package/dist/chunk-W2XJKG6C.js +3177 -0
- package/dist/chunk-XB7LH4J2.js +301 -0
- package/dist/chunk-XGRA2MUV.js +242 -0
- package/dist/chunk-XTOXFMLM.js +105 -0
- package/dist/chunk-YC5MFXA5.js +132 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1681 -0
- package/dist/compose-video-CN3VSWST.js +13 -0
- package/dist/cta-logo-SVA5GP2A.js +209 -0
- package/dist/cta-media-E7VLLK42.js +215 -0
- package/dist/events-_wfjbmEp.d.ts +81 -0
- package/dist/incoming-call-62MFZL3Z.js +320 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +14 -0
- package/dist/infographic-before-after-AXCDAWND.js +460 -0
- package/dist/infographic-feature-list-GW5GUE6O.js +266 -0
- package/dist/infographic-problem-solution-7NURJANA.js +340 -0
- package/dist/infographic-stat-row-J7IZR6ZN.js +241 -0
- package/dist/infographic-steps-VSZM6F5M.js +400 -0
- package/dist/kit-BMNcHqa9.d.ts +79 -0
- package/dist/prompt-input-LOUCRXCY.js +236 -0
- package/dist/react.d.ts +81 -0
- package/dist/react.js +835 -0
- package/dist/reaction-QG4CYZLQ.js +119 -0
- package/dist/server.d.ts +141 -0
- package/dist/server.js +498 -0
- package/dist/showcase-code-RUTFZR3H.js +351 -0
- package/dist/showcase-phone-6CP6XEU5.js +272 -0
- package/dist/showcase-terminal-MGAEQWPR.js +306 -0
- package/dist/showcase-web-Y4W2HVRJ.js +390 -0
- package/dist/social-conversation-75SD2637.js +695 -0
- package/dist/social-milestone-XI2QE5BO.js +292 -0
- package/dist/social-notification-2UOHQCUY.js +244 -0
- package/dist/social-review-stack-FDYZGZTJ.js +239 -0
- package/dist/social-testimonial-OQ7N52GJ.js +284 -0
- package/dist/social-tweet-5OLCNPPC.js +295 -0
- package/dist/state-DZcKuS32.d.ts +3 -0
- package/dist/system-prompt-A6UXNTPK.js +8 -0
- package/dist/template-catalog.d.ts +24 -0
- package/dist/template-catalog.js +6 -0
- package/dist/templates.d.ts +25 -0
- package/dist/templates.js +19 -0
- package/dist/test.d.ts +149 -0
- package/dist/test.js +272 -0
- package/dist/text-stream-6XHC7J47.js +10 -0
- package/dist/types-B-PZR6G_.d.ts +208 -0
- package/dist/validate-T7GBU2YF.js +8 -0
- package/docs/agent-integration.md +39 -0
- package/docs/architecture.md +84 -0
- package/docs/branding-and-personalization.md +87 -0
- package/docs/concepts.md +106 -0
- package/docs/custom-templates.md +329 -0
- package/docs/customization.md +141 -0
- package/docs/errors.md +70 -0
- package/docs/getting-started.md +111 -0
- package/docs/input-and-first-scene.md +41 -0
- package/docs/integrate-nextjs.md +79 -0
- package/docs/media-and-audio.md +69 -0
- package/docs/motion-and-effects.md +107 -0
- package/docs/persistence.md +95 -0
- package/docs/production.md +122 -0
- package/docs/prompt-and-input.md +185 -0
- package/docs/provider-integration.md +115 -0
- package/docs/reference/protocol.md +96 -0
- package/docs/reference/provider-adapters.md +158 -0
- package/docs/responsive-orientation.md +37 -0
- package/docs/security.md +38 -0
- package/docs/streaming-protocol.md +15 -0
- package/docs/testing.md +137 -0
- package/docs/use-cases.md +59 -0
- package/examples/custom-template/README.md +19 -0
- package/examples/custom-template/minimal-text.tsx +82 -0
- package/examples/custom-template/structured-data.tsx +104 -0
- package/examples/custom-template/supplied-media.tsx +92 -0
- package/examples/nextjs-quickstart/.env.example +2 -0
- package/examples/nextjs-quickstart/README.md +22 -0
- package/examples/nextjs-quickstart/next-env.d.ts +4 -0
- package/examples/nextjs-quickstart/package.json +24 -0
- package/examples/nextjs-quickstart/src/app/api/video/route.ts +22 -0
- package/examples/nextjs-quickstart/src/app/layout.tsx +5 -0
- package/examples/nextjs-quickstart/src/app/page.tsx +31 -0
- package/examples/nextjs-quickstart/tsconfig.json +26 -0
- package/package.json +167 -0
- package/registry/items/backgrounds.json +52 -0
- package/registry/items/barChart.json +237 -0
- package/registry/items/beforeAfter.json +180 -0
- package/registry/items/bigNumber.json +225 -0
- package/registry/items/brandMessage.json +158 -0
- package/registry/items/cardList.json +206 -0
- package/registry/items/chatMessenger.json +151 -0
- package/registry/items/chatWhatsapp.json +151 -0
- package/registry/items/codeEditor.json +184 -0
- package/registry/items/confetti.json +107 -0
- package/registry/items/ctaLogo.json +160 -0
- package/registry/items/ctaMedia.json +193 -0
- package/registry/items/emojiBurst.json +101 -0
- package/registry/items/incomingCall.json +170 -0
- package/registry/items/media.json +179 -0
- package/registry/items/milestone.json +205 -0
- package/registry/items/motion.json +45 -0
- package/registry/items/notification.json +182 -0
- package/registry/items/phoneMockup.json +254 -0
- package/registry/items/problemSolution.json +186 -0
- package/registry/items/progressRing.json +199 -0
- package/registry/items/promptInput.json +148 -0
- package/registry/items/reaction.json +170 -0
- package/registry/items/reviewStack.json +224 -0
- package/registry/items/steps.json +207 -0
- package/registry/items/template-context.json +31 -0
- package/registry/items/terminal.json +212 -0
- package/registry/items/testimonial.json +164 -0
- package/registry/items/theme.json +47 -0
- package/registry/items/tripleStats.json +228 -0
- package/registry/items/tweet.json +203 -0
- package/registry/items/typography.json +47 -0
- package/registry/items/webMockup.json +273 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_VIDEO_SYSTEM_PROMPT
|
|
3
|
+
} from "./chunk-FQ47WXAJ.js";
|
|
4
|
+
import {
|
|
5
|
+
PACING_PLANNER_RULES
|
|
6
|
+
} from "./chunk-EVG2ZYIY.js";
|
|
7
|
+
import {
|
|
8
|
+
getTemplateSchemaGates,
|
|
9
|
+
templateVariableNotation
|
|
10
|
+
} from "./chunk-73NTSFFI.js";
|
|
11
|
+
|
|
12
|
+
// src/visual-system/catalog/prompt.ts
|
|
13
|
+
function plannerProperty(property) {
|
|
14
|
+
return {
|
|
15
|
+
...property.type == null ? {} : { type: property.type },
|
|
16
|
+
...property.format == null ? {} : { format: property.format },
|
|
17
|
+
...property.enum == null ? {} : { enum: property.enum },
|
|
18
|
+
...property.minItems == null ? {} : { minItems: property.minItems },
|
|
19
|
+
...property.maxItems == null ? {} : { maxItems: property.maxItems },
|
|
20
|
+
...property.minLength == null ? {} : { minLength: property.minLength },
|
|
21
|
+
...property.maxLength == null ? {} : { maxLength: property.maxLength },
|
|
22
|
+
...property.minimum == null ? {} : { minimum: property.minimum },
|
|
23
|
+
...property.maximum == null ? {} : { maximum: property.maximum },
|
|
24
|
+
...property.items == null ? {} : { items: plannerProperty(property.items) },
|
|
25
|
+
...property.properties == null ? {} : {
|
|
26
|
+
properties: Object.fromEntries(Object.entries(property.properties).map(([name, child]) => [name, plannerProperty(child)]))
|
|
27
|
+
},
|
|
28
|
+
...property.required == null ? {} : { required: property.required },
|
|
29
|
+
...property.additionalProperties == null ? {} : {
|
|
30
|
+
additionalProperties: property.additionalProperties
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function plannerSchema(schema) {
|
|
35
|
+
const hiddenFields = /* @__PURE__ */ new Set(["mediaKeyword"]);
|
|
36
|
+
const properties = Object.fromEntries(
|
|
37
|
+
Object.entries(schema.properties).filter(([name]) => !hiddenFields.has(name)).map(([name, property]) => [name, plannerProperty(property)])
|
|
38
|
+
);
|
|
39
|
+
const required = schema.required?.filter((name) => !hiddenFields.has(name));
|
|
40
|
+
return {
|
|
41
|
+
type: "object",
|
|
42
|
+
properties,
|
|
43
|
+
...required === void 0 ? {} : { required },
|
|
44
|
+
...schema.additionalProperties == null ? {} : {
|
|
45
|
+
additionalProperties: schema.additionalProperties
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function needsPlannerSchema(schema) {
|
|
50
|
+
const visit = (property) => property.minimum != null || property.maximum != null || property.type === "object" || property.items != null && visit(property.items);
|
|
51
|
+
return Object.values(schema.properties).some(visit);
|
|
52
|
+
}
|
|
53
|
+
var COMMON_MEDIA_VARIABLES = {
|
|
54
|
+
mediaUrl: "media",
|
|
55
|
+
mediaType: "enum(auto|photo|video|gradient)",
|
|
56
|
+
mediaPoster: "media",
|
|
57
|
+
mediaPosition: "enum(center|top|bottom|left|right)",
|
|
58
|
+
mediaTreatment: "enum(subtle|cinematic|text-safe)"
|
|
59
|
+
};
|
|
60
|
+
function plannerCatalog(templates) {
|
|
61
|
+
return templates.map((template) => {
|
|
62
|
+
const gates = getTemplateSchemaGates(template.schema);
|
|
63
|
+
const variables = Object.fromEntries(
|
|
64
|
+
Object.entries(template.schema.properties).filter(([name]) => name !== "mediaKeyword").map(([name, property]) => [
|
|
65
|
+
name,
|
|
66
|
+
templateVariableNotation(property, template.schema.required?.includes(name) === true)
|
|
67
|
+
])
|
|
68
|
+
);
|
|
69
|
+
const usesCommonMedia = Object.entries(COMMON_MEDIA_VARIABLES).every(([name, notation]) => variables[name] === notation);
|
|
70
|
+
if (usesCommonMedia) {
|
|
71
|
+
for (const name of Object.keys(COMMON_MEDIA_VARIABLES)) delete variables[name];
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
id: template.id,
|
|
75
|
+
jobs: template.jobs,
|
|
76
|
+
use: template.useWhen ?? template.description,
|
|
77
|
+
...template.minDuration == null && template.preferredDuration == null ? {} : {
|
|
78
|
+
seconds: [template.minDuration ?? null, template.preferredDuration ?? null]
|
|
79
|
+
},
|
|
80
|
+
...gates.requiresStat ? { requiresStat: true } : {},
|
|
81
|
+
...gates.requiresQuote ? { requiresQuote: true } : {},
|
|
82
|
+
...gates.requiresScreenshot ? { requiresScreenshot: true } : {},
|
|
83
|
+
...gates.requiredAnyOf.length > 0 ? { requiredAnyOf: gates.requiredAnyOf } : {},
|
|
84
|
+
...needsPlannerSchema(template.schema) ? { schema: plannerSchema(template.schema) } : {},
|
|
85
|
+
...usesCommonMedia ? { media: true } : {},
|
|
86
|
+
variables
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function createTemplateSystemPrompt(options) {
|
|
91
|
+
const templates = options.kit.listTemplateMetadata();
|
|
92
|
+
const ids = new Set(templates.map(({ id }) => id));
|
|
93
|
+
const fields = new Set(templates.flatMap(({ schema }) => Object.keys(schema.properties)));
|
|
94
|
+
const basePrompt = DEFAULT_VIDEO_SYSTEM_PROMPT.split("\n").filter((line) => !line.includes("Never use media, ctaMedia, or reaction as the first generated body template")).join("\n");
|
|
95
|
+
const factRules = [
|
|
96
|
+
...ids.has("cardList") ? ["cardList needs two or three unused parallel facts"] : [],
|
|
97
|
+
...ids.has("steps") ? ["steps needs two or three unused sequential facts"] : [],
|
|
98
|
+
...ids.has("tripleStats") ? ["tripleStats needs exactly three unused peer values"] : []
|
|
99
|
+
];
|
|
100
|
+
const mediaTemplates = ["media", "ctaMedia", "reaction"].filter((id) => ids.has(id));
|
|
101
|
+
const mediaTemplateNames = mediaTemplates.length === 3 ? "media, ctaMedia, and reaction" : mediaTemplates.join(", ");
|
|
102
|
+
const listFields = ["items", "itemEmojis", "steps", "stepEmojis", "problemEmojis", "solutionEmojis"].filter((name) => fields.has(name));
|
|
103
|
+
return [
|
|
104
|
+
basePrompt.trim(),
|
|
105
|
+
options.basePrompt?.trim() ? `
|
|
106
|
+
APPLICATION GUIDANCE
|
|
107
|
+
${options.basePrompt.trim()}` : void 0,
|
|
108
|
+
"",
|
|
109
|
+
"TRUSTED TEMPLATE CATALOG",
|
|
110
|
+
"Only use template IDs from this catalog. Only emit variables declared for the selected template.",
|
|
111
|
+
"Variable notation is type[count]{characters}(options)! where count is list cardinality, characters is the inclusive character count for a string or each string-array item, and ! means required. Omitted ! means optional.",
|
|
112
|
+
`seconds is [minimum, preferred]. media=true adds these optional variables: ${Object.entries(COMMON_MEDIA_VARIABLES).map(([name, notation]) => `${name}:${notation}`).join(", ")}.`,
|
|
113
|
+
"Choose a template only when the input contains every fact it needs. Never invent peer values to complete a chart, comparison, stat set, timeline, or list.",
|
|
114
|
+
...PACING_PLANNER_RULES,
|
|
115
|
+
ids.has("cardList") && ids.has("steps") && ids.has("tripleStats") ? "Fact availability carries across templates: cardList and steps each need two or three unused facts (parallel for cardList, sequential for steps) and must carry only the count the evidence supports, and tripleStats needs exactly three unused peer values. Never invent a fact to fill a collection, and do not fill one with facts already shown in another scene." : factRules.length > 0 ? `Fact availability carries across templates: ${factRules.join(", and ")}. Use only the count the evidence supports. Never invent a fact to fill a collection, and do not fill one with facts already shown in another scene.` : void 0,
|
|
116
|
+
"Do not compress a list, sequence, metric set, or comparison into a general-purpose prose field when a specific catalog template can show that structure.",
|
|
117
|
+
"If the catalog includes a suitable ask template and the input supplies a grounded CTA or URL, keep that concise action closer as its own final scene instead of folding it into preceding content.",
|
|
118
|
+
"When a grounded CTA or URL is supplied and the catalog contains jobs:[ask], emit that final closer. A brand name may accompany the action but never qualifies as an ask by itself.",
|
|
119
|
+
"requiresQuote is a hard gate: use those templates only for exact quoted words and attribution present in raw input. Never turn a role, relationship, or summary into speech. requiresScreenshot likewise needs an actual supplied screenshot URL.",
|
|
120
|
+
templates.some(({ schema }) => (schema["x-vanillasky"]?.requiredAnyOf?.length ?? 0) > 0) ? "requiredAnyOf is a hard presence gate: satisfy every listed group with at least one non-empty value." : void 0,
|
|
121
|
+
mediaTemplates.length > 0 ? `For streaming startup, ${mediaTemplateNames} ${mediaTemplates.length === 1 ? "is" : "are"} forbidden as the first generated body template, even when mediaType is gradient. Start with a content-fit non-media template.` : void 0,
|
|
122
|
+
listFields.length > 0 ? `For list variables (${listFields.join(", ")}), emit actual JSON arrays. Keep list labels to 1\u20133 words. Keep step labels to 1\u20132 words and at most 18 characters. Do not use pipes or newlines as list delimiters.` : void 0,
|
|
123
|
+
fields.has("bars") ? 'For bars, emit an actual JSON array of 2\u20136 grounded objects with "label" and "value" fields. Use comparable units and avoid a largest-to-smallest positive ratio above 20. Do not encode bars as a string.' : void 0,
|
|
124
|
+
mediaTemplates.length > 0 ? `Use exact grounded values for required fields. mediaUrl must come verbatim from supplied input. Stock queries are not available. Do not select ${mediaTemplateNames} without a supplied mediaUrl; if another template has no mediaUrl, explicitly use mediaType=gradient. mediaType auto detects a URL, while gradient deliberately uses no external asset.` : "Use exact grounded values for required fields.",
|
|
125
|
+
"Catalog guidance describes composition; it is not a factual source and must never replace customer input.",
|
|
126
|
+
JSON.stringify(plannerCatalog(templates))
|
|
127
|
+
].filter((line) => line != null).join("\n");
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export {
|
|
131
|
+
createTemplateSystemPrompt
|
|
132
|
+
};
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|