@depths/waves 0.1.0 → 0.2.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/dist/cli.mjs CHANGED
@@ -3,15 +3,15 @@ import {
3
3
  WavesEngine,
4
4
  __wavesVersion,
5
5
  getPromptPayload
6
- } from "./chunk-WGQITADJ.mjs";
6
+ } from "./chunk-7QPNRHMW.mjs";
7
7
  import {
8
- VideoIRSchema,
8
+ VideoIRv2AuthoringSchema,
9
9
  WavesRenderError,
10
10
  __require,
11
11
  globalRegistry,
12
12
  registerBuiltInComponents,
13
13
  zodSchemaToJsonSchema
14
- } from "./chunk-TGAL5RQN.mjs";
14
+ } from "./chunk-PKLHVWMD.mjs";
15
15
 
16
16
  // src/cli.ts
17
17
  import fs from "fs/promises";
@@ -42,7 +42,7 @@ function parseArgs(argv) {
42
42
  const hasInlineValue = eq >= 0;
43
43
  const inlineValue = hasInlineValue ? arg.slice(eq + 1) : void 0;
44
44
  const next = argv[i + 1];
45
- const isBoolean = key === "help" || key === "pretty";
45
+ const isBoolean = key === "help" || key === "pretty" || key === "includeInternal";
46
46
  if (isBoolean) {
47
47
  flags[key] = true;
48
48
  continue;
@@ -81,6 +81,7 @@ Usage:
81
81
  waves <command> [options]
82
82
 
83
83
  Commands:
84
+ catalog Print the built-in component catalog
84
85
  prompt Print an agent-ready system prompt + schema payload
85
86
  schema Print JSON Schemas for IR/components
86
87
  write-ir Write a starter IR JSON file
@@ -122,22 +123,6 @@ async function importRegistrationModules(modules) {
122
123
  function stringifyJSON(value, pretty) {
123
124
  return JSON.stringify(value, null, pretty ? 2 : 0) + "\n";
124
125
  }
125
- function collectComponentTypes(ir) {
126
- const types = /* @__PURE__ */ new Set();
127
- for (const scene of ir.scenes) {
128
- walkComponent(scene, types);
129
- }
130
- return types;
131
- }
132
- function walkComponent(component, types) {
133
- types.add(component.type);
134
- const children = component.children;
135
- if (children?.length) {
136
- for (const child of children) {
137
- walkComponent(child, types);
138
- }
139
- }
140
- }
141
126
  async function main(argv = process.argv.slice(2)) {
142
127
  const parsed = parseArgs(argv);
143
128
  if (parsed.flags.version) {
@@ -165,6 +150,66 @@ async function main(argv = process.argv.slice(2)) {
165
150
  return EXIT_USAGE;
166
151
  }
167
152
  registerBuiltInComponents();
153
+ if (parsed.command === "catalog") {
154
+ const format = (getFlagString(parsed.flags, "format") ?? "text").toLowerCase();
155
+ const includeInternal = Boolean(parsed.flags.includeInternal);
156
+ if (format !== "text" && format !== "json") {
157
+ process.stderr.write(`Invalid --format: ${format} (expected "text" or "json")
158
+ `);
159
+ return EXIT_USAGE;
160
+ }
161
+ const types = includeInternal ? globalRegistry.getTypes().sort() : globalRegistry.getTypesForLLM().sort();
162
+ const byCategory = {};
163
+ const items = [];
164
+ for (const t of types) {
165
+ const reg = globalRegistry.get(t);
166
+ if (!reg) continue;
167
+ const cat = reg.metadata.category;
168
+ if (!byCategory[cat]) byCategory[cat] = [];
169
+ byCategory[cat].push(t);
170
+ items.push({ type: t, kind: reg.metadata.kind, category: cat, description: reg.metadata.description });
171
+ }
172
+ if (format === "json") {
173
+ const payload = { categories: byCategory, items };
174
+ const json = stringifyJSON(payload, pretty);
175
+ const writeErr2 = await tryWriteOut(outPath, json);
176
+ if (writeErr2) {
177
+ process.stderr.write(`Failed to write ${outPath}: ${writeErr2}
178
+ `);
179
+ process.stdout.write(json);
180
+ return EXIT_IO;
181
+ }
182
+ process.stdout.write(json);
183
+ if (outPath) process.stderr.write(`Wrote ${outPath}
184
+ `);
185
+ return EXIT_OK;
186
+ }
187
+ const categories = Object.keys(byCategory).sort();
188
+ const lines = [];
189
+ lines.push(`waves catalog (v${__wavesVersion})`);
190
+ lines.push("");
191
+ for (const c of categories) {
192
+ lines.push(`${c}:`);
193
+ for (const t of byCategory[c].sort()) {
194
+ lines.push(`- ${t}`);
195
+ }
196
+ lines.push("");
197
+ }
198
+ const text = lines.join("\n");
199
+ const writeErr = await tryWriteOut(outPath, text.endsWith("\n") ? text : `${text}
200
+ `);
201
+ if (writeErr) {
202
+ process.stderr.write(`Failed to write ${outPath}: ${writeErr}
203
+ `);
204
+ process.stdout.write(text);
205
+ return EXIT_IO;
206
+ }
207
+ process.stdout.write(text.endsWith("\n") ? text : `${text}
208
+ `);
209
+ if (outPath) process.stderr.write(`Wrote ${outPath}
210
+ `);
211
+ return EXIT_OK;
212
+ }
168
213
  if (parsed.command === "prompt") {
169
214
  const format = (getFlagString(parsed.flags, "format") ?? "text").toLowerCase();
170
215
  const maxCharsRaw = getFlagString(parsed.flags, "maxChars");
@@ -208,12 +253,12 @@ async function main(argv = process.argv.slice(2)) {
208
253
  const kind = (getFlagString(parsed.flags, "kind") ?? "all").toLowerCase();
209
254
  let output;
210
255
  if (kind === "video-ir") {
211
- output = zodSchemaToJsonSchema(VideoIRSchema);
256
+ output = zodSchemaToJsonSchema(VideoIRv2AuthoringSchema);
212
257
  } else if (kind === "components") {
213
258
  output = globalRegistry.getJSONSchemaForLLM();
214
259
  } else if (kind === "all") {
215
260
  output = {
216
- videoIR: zodSchemaToJsonSchema(VideoIRSchema),
261
+ videoIR: zodSchemaToJsonSchema(VideoIRv2AuthoringSchema),
217
262
  components: globalRegistry.getJSONSchemaForLLM()
218
263
  };
219
264
  } else {
@@ -242,33 +287,75 @@ async function main(argv = process.argv.slice(2)) {
242
287
  return EXIT_USAGE;
243
288
  }
244
289
  const ir = template === "basic" ? {
245
- version: "1.0",
246
- video: { id: "main", width: 1920, height: 1080, fps: 30, durationInFrames: 90 },
247
- scenes: [
290
+ version: "2.0",
291
+ video: { id: "main", width: 1920, height: 1080, fps: 30, durationInFrames: 165 },
292
+ segments: [
248
293
  {
249
294
  id: "scene-1",
250
- type: "Scene",
251
- timing: { from: 0, durationInFrames: 90 },
252
- props: { background: { type: "color", value: "#000000" } },
253
- children: [
254
- {
255
- id: "title",
256
- type: "Text",
257
- timing: { from: 0, durationInFrames: 90 },
258
- props: { content: "Hello Waves", fontSize: 72, animation: "fade" }
259
- }
260
- ]
295
+ durationInFrames: 90,
296
+ transitionToNext: { type: "FadeTransition", durationInFrames: 15 },
297
+ root: {
298
+ id: "root",
299
+ type: "Scene",
300
+ props: { background: { type: "color", value: "#000000" } },
301
+ children: [
302
+ {
303
+ id: "title",
304
+ type: "SplitText",
305
+ props: { content: "Waves v0.2.0", fontSize: 96, splitBy: "word", stagger: 3, animation: "slideUp" }
306
+ },
307
+ {
308
+ id: "subtitle",
309
+ type: "TypewriterText",
310
+ props: { content: "Composite components + hybrid IR", fontSize: 48, position: "bottom", speed: 1.5 }
311
+ },
312
+ {
313
+ id: "wm",
314
+ type: "Watermark",
315
+ props: { type: "text", text: "@depths.ai", position: "bottomRight", opacity: 0.4, size: 60 }
316
+ }
317
+ ]
318
+ }
319
+ },
320
+ {
321
+ id: "scene-2",
322
+ durationInFrames: 90,
323
+ root: {
324
+ id: "root-2",
325
+ type: "Scene",
326
+ props: { background: { type: "color", value: "#0B1220" } },
327
+ children: [
328
+ {
329
+ id: "lower-third",
330
+ type: "ThirdLowerBanner",
331
+ props: { name: "Waves", title: "v0.2.0 \u2014 Composites + transitions", accentColor: "#3B82F6" }
332
+ },
333
+ {
334
+ id: "count",
335
+ type: "AnimatedCounter",
336
+ props: { from: 0, to: 35, suffix: " components", fontSize: 96, color: "#FFFFFF" }
337
+ },
338
+ {
339
+ id: "wm-2",
340
+ type: "Watermark",
341
+ props: { type: "text", text: "waves", position: "topLeft", opacity: 0.25, size: 52 }
342
+ }
343
+ ]
344
+ }
261
345
  }
262
346
  ]
263
347
  } : template === "minimal" ? {
264
- version: "1.0",
348
+ version: "2.0",
265
349
  video: { id: "main", width: 1920, height: 1080, fps: 30, durationInFrames: 60 },
266
- scenes: [
350
+ segments: [
267
351
  {
268
352
  id: "scene-1",
269
- type: "Scene",
270
- timing: { from: 0, durationInFrames: 60 },
271
- props: { background: { type: "color", value: "#000000" } }
353
+ durationInFrames: 60,
354
+ root: {
355
+ id: "root",
356
+ type: "Scene",
357
+ props: { background: { type: "color", value: "#000000" } }
358
+ }
272
359
  }
273
360
  ]
274
361
  } : null;
@@ -277,9 +364,9 @@ async function main(argv = process.argv.slice(2)) {
277
364
  `);
278
365
  return EXIT_USAGE;
279
366
  }
280
- const schemaCheck = VideoIRSchema.safeParse(ir);
367
+ const schemaCheck = VideoIRv2AuthoringSchema.safeParse(ir);
281
368
  if (!schemaCheck.success) {
282
- process.stderr.write("Internal error: generated template does not validate against VideoIRSchema\n");
369
+ process.stderr.write("Internal error: generated template does not validate against VideoIRv2AuthoringSchema\n");
283
370
  return EXIT_INTERNAL;
284
371
  }
285
372
  const json = stringifyJSON(ir, pretty);
@@ -333,20 +420,9 @@ async function main(argv = process.argv.slice(2)) {
333
420
  }
334
421
  return EXIT_VALIDATE;
335
422
  }
336
- const validator = new IRValidator();
423
+ const validator = new IRValidator(globalRegistry);
337
424
  const result = validator.validate(json);
338
425
  const errors = result.success ? [] : result.errors;
339
- if (result.success) {
340
- const types = collectComponentTypes(result.data);
341
- const unknownTypes = [...types].filter((t) => !globalRegistry.has(t)).sort();
342
- for (const t of unknownTypes) {
343
- errors.push({
344
- path: ["components", t],
345
- message: `Unknown component type: ${t}`,
346
- code: "UNKNOWN_COMPONENT_TYPE"
347
- });
348
- }
349
- }
350
426
  const ok = errors.length === 0;
351
427
  if (format === "json") {
352
428
  process.stdout.write(stringifyJSON(ok ? { success: true } : { success: false, errors }, pretty));
@@ -398,7 +474,7 @@ async function main(argv = process.argv.slice(2)) {
398
474
  const publicDir = getFlagString(parsed.flags, "publicDir");
399
475
  const crf = crfRaw ? Number(crfRaw) : void 0;
400
476
  const concurrency = concurrencyRaw ? /^[0-9]+$/.test(concurrencyRaw) ? Number(concurrencyRaw) : concurrencyRaw : void 0;
401
- const engine = new WavesEngine(globalRegistry, new IRValidator());
477
+ const engine = new WavesEngine(globalRegistry, new IRValidator(globalRegistry));
402
478
  try {
403
479
  const opts = { outputPath, registrationModules };
404
480
  if (publicDir) opts.publicDir = publicDir;
package/dist/index.d.mts CHANGED
@@ -1,36 +1,41 @@
1
- import { V as VideoIR, C as ComponentRegistry } from './registry-hVIyqwS6.mjs';
2
- export { A as AssetPathSchema, a as AudioComponentIRSchema, b as AudioIR, B as BackgroundSpec, c as BackgroundSpecSchema, d as BaseComponentIR, e as BaseComponentIRSchema, f as ComponentIR, g as ComponentIRSchema, h as ComponentSchemas, S as SceneComponentIRSchema, i as SceneIR, T as TextComponentIRSchema, j as TextIR, k as TimingSpec, l as TimingSpecSchema, m as VideoIRSchema, n as globalRegistry, r as registerBuiltInComponents } from './registry-hVIyqwS6.mjs';
1
+ import { C as ComponentRegistry, V as VideoIRv2, a as CompiledVideoIR, b as ComponentKind, c as ComponentCategory } from './registry-C6H9G0df.mjs';
2
+ export { A as AssetPathSchema, B as BackgroundSpec, d as BackgroundSpecSchema, e as ComponentNode, f as ComponentNodeSchema, T as TimingSpec, g as TimingSpecSchema, h as TransitionSpec, i as TransitionSpecSchema, j as VideoIR, k as VideoIRSchema, l as VideoIRv2AuthoringSchema, m as VideoIRv2Schema, n as globalRegistry, r as registerBuiltInComponents } from './registry-C6H9G0df.mjs';
3
3
  import 'zod';
4
4
  import 'react';
5
5
 
6
- declare const __wavesVersion = "0.1.0";
6
+ declare const __wavesVersion = "0.2.0";
7
7
 
8
8
  interface ValidationError {
9
9
  path: string[];
10
10
  message: string;
11
11
  code: string;
12
12
  }
13
- interface ValidationResult {
14
- success: boolean;
15
- errors?: ValidationError[];
16
- }
17
13
  declare class IRValidator {
14
+ private readonly registry?;
15
+ constructor(registry?: ComponentRegistry | undefined);
18
16
  validateSchema(ir: unknown): {
19
17
  success: true;
20
- data: VideoIR;
18
+ data: VideoIRv2;
19
+ } | {
20
+ success: false;
21
+ errors: ValidationError[];
22
+ };
23
+ validateSemantics(latest: VideoIRv2): {
24
+ success: true;
25
+ data: CompiledVideoIR;
21
26
  } | {
22
27
  success: false;
23
28
  errors: ValidationError[];
24
29
  };
25
- validateSemantics(ir: VideoIR): ValidationResult;
26
30
  validate(ir: unknown): {
27
31
  success: true;
28
- data: VideoIR;
32
+ data: CompiledVideoIR;
29
33
  } | {
30
34
  success: false;
31
35
  errors: ValidationError[];
32
36
  };
33
37
  private validateComponentTimingRecursive;
38
+ private validateRegistryContracts;
34
39
  }
35
40
 
36
41
  interface RenderOptions {
@@ -63,8 +68,18 @@ declare class WavesRenderError extends WavesError {
63
68
  type PromptPayload = {
64
69
  package: '@depths/waves';
65
70
  version: string;
66
- irVersion: '1.0';
71
+ irVersion: '2.0';
67
72
  systemPrompt: string;
73
+ catalog: {
74
+ categories: Record<string, string[]>;
75
+ items: Array<{
76
+ type: string;
77
+ kind: ComponentKind;
78
+ category: ComponentCategory;
79
+ description: string;
80
+ llmGuidance?: string;
81
+ }>;
82
+ };
68
83
  schemas: {
69
84
  videoIR: Record<string, unknown>;
70
85
  components: Record<string, unknown>;
@@ -86,4 +101,4 @@ declare function renderVideo(ir: unknown, options: {
86
101
  publicDir?: string;
87
102
  }): Promise<void>;
88
103
 
89
- export { ComponentRegistry, IRValidator, type PromptPayload, VideoIR, WavesEngine, WavesError, WavesRenderError, WavesValidationError, __wavesVersion, getPromptPayload, getSystemPrompt, renderVideo };
104
+ export { ComponentRegistry, IRValidator, type PromptPayload, VideoIRv2, WavesEngine, WavesError, WavesRenderError, WavesValidationError, __wavesVersion, getPromptPayload, getSystemPrompt, renderVideo };
package/dist/index.d.ts CHANGED
@@ -1,36 +1,41 @@
1
- import { V as VideoIR, C as ComponentRegistry } from './registry-hVIyqwS6.js';
2
- export { A as AssetPathSchema, a as AudioComponentIRSchema, b as AudioIR, B as BackgroundSpec, c as BackgroundSpecSchema, d as BaseComponentIR, e as BaseComponentIRSchema, f as ComponentIR, g as ComponentIRSchema, h as ComponentSchemas, S as SceneComponentIRSchema, i as SceneIR, T as TextComponentIRSchema, j as TextIR, k as TimingSpec, l as TimingSpecSchema, m as VideoIRSchema, n as globalRegistry, r as registerBuiltInComponents } from './registry-hVIyqwS6.js';
1
+ import { C as ComponentRegistry, V as VideoIRv2, a as CompiledVideoIR, b as ComponentKind, c as ComponentCategory } from './registry-C6H9G0df.js';
2
+ export { A as AssetPathSchema, B as BackgroundSpec, d as BackgroundSpecSchema, e as ComponentNode, f as ComponentNodeSchema, T as TimingSpec, g as TimingSpecSchema, h as TransitionSpec, i as TransitionSpecSchema, j as VideoIR, k as VideoIRSchema, l as VideoIRv2AuthoringSchema, m as VideoIRv2Schema, n as globalRegistry, r as registerBuiltInComponents } from './registry-C6H9G0df.js';
3
3
  import 'zod';
4
4
  import 'react';
5
5
 
6
- declare const __wavesVersion = "0.1.0";
6
+ declare const __wavesVersion = "0.2.0";
7
7
 
8
8
  interface ValidationError {
9
9
  path: string[];
10
10
  message: string;
11
11
  code: string;
12
12
  }
13
- interface ValidationResult {
14
- success: boolean;
15
- errors?: ValidationError[];
16
- }
17
13
  declare class IRValidator {
14
+ private readonly registry?;
15
+ constructor(registry?: ComponentRegistry | undefined);
18
16
  validateSchema(ir: unknown): {
19
17
  success: true;
20
- data: VideoIR;
18
+ data: VideoIRv2;
19
+ } | {
20
+ success: false;
21
+ errors: ValidationError[];
22
+ };
23
+ validateSemantics(latest: VideoIRv2): {
24
+ success: true;
25
+ data: CompiledVideoIR;
21
26
  } | {
22
27
  success: false;
23
28
  errors: ValidationError[];
24
29
  };
25
- validateSemantics(ir: VideoIR): ValidationResult;
26
30
  validate(ir: unknown): {
27
31
  success: true;
28
- data: VideoIR;
32
+ data: CompiledVideoIR;
29
33
  } | {
30
34
  success: false;
31
35
  errors: ValidationError[];
32
36
  };
33
37
  private validateComponentTimingRecursive;
38
+ private validateRegistryContracts;
34
39
  }
35
40
 
36
41
  interface RenderOptions {
@@ -63,8 +68,18 @@ declare class WavesRenderError extends WavesError {
63
68
  type PromptPayload = {
64
69
  package: '@depths/waves';
65
70
  version: string;
66
- irVersion: '1.0';
71
+ irVersion: '2.0';
67
72
  systemPrompt: string;
73
+ catalog: {
74
+ categories: Record<string, string[]>;
75
+ items: Array<{
76
+ type: string;
77
+ kind: ComponentKind;
78
+ category: ComponentCategory;
79
+ description: string;
80
+ llmGuidance?: string;
81
+ }>;
82
+ };
68
83
  schemas: {
69
84
  videoIR: Record<string, unknown>;
70
85
  components: Record<string, unknown>;
@@ -86,4 +101,4 @@ declare function renderVideo(ir: unknown, options: {
86
101
  publicDir?: string;
87
102
  }): Promise<void>;
88
103
 
89
- export { ComponentRegistry, IRValidator, type PromptPayload, VideoIR, WavesEngine, WavesError, WavesRenderError, WavesValidationError, __wavesVersion, getPromptPayload, getSystemPrompt, renderVideo };
104
+ export { ComponentRegistry, IRValidator, type PromptPayload, VideoIRv2, WavesEngine, WavesError, WavesRenderError, WavesValidationError, __wavesVersion, getPromptPayload, getSystemPrompt, renderVideo };