@agentmedia/schema 0.1.0 → 0.1.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/README.md +97 -0
- package/package.json +13 -1
package/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# @agentmedia/schema
|
|
2
|
+
|
|
3
|
+
Single source of truth for the [agent-media](https://agent-media.ai) platform — enums, Zod validation schemas, TypeScript types, and the generator registry.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@agentmedia/schema)
|
|
6
|
+
[](https://github.com/yuvalsuede/agent-media/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
## Why This Package Exists
|
|
9
|
+
|
|
10
|
+
Every option in the agent-media API — tones, music genres, subtitle styles, durations, templates, scene types — is defined exactly once in this package. All consumers (REST API, CLI, dashboard, MCP server, SDKs, docs) import from here. Adding a new subtitle style or template is a one-line change that propagates everywhere on the next build.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @agentmedia/schema
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## What's Inside
|
|
19
|
+
|
|
20
|
+
### Enums (as `const` arrays + TypeScript types)
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import {
|
|
24
|
+
TONES, // ['energetic', 'calm', 'confident', 'dramatic']
|
|
25
|
+
MUSIC_GENRES, // ['chill', 'energetic', 'corporate', 'dramatic', 'upbeat']
|
|
26
|
+
SUBTITLE_STYLES,// 17 styles: 'hormozi', 'minimal', 'bold', 'neon', 'fire', ...
|
|
27
|
+
DURATIONS, // [5, 10, 15]
|
|
28
|
+
ASPECT_RATIOS, // ['9:16', '16:9', '1:1']
|
|
29
|
+
SCENE_TYPES, // ['talking_head', 'broll']
|
|
30
|
+
TEMPLATES, // 8 templates
|
|
31
|
+
VOICES, // ['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer']
|
|
32
|
+
REVIEW_ANGLES, // ['honest', 'enthusiastic', 'roast', 'tutorial', 'comparison']
|
|
33
|
+
// + PIP_POSITIONS, PIP_SIZES, PIP_ANIMATIONS, PIP_FRAME_STYLES, COMPOSITION_MODES
|
|
34
|
+
} from '@agentmedia/schema';
|
|
35
|
+
|
|
36
|
+
// TypeScript literal types are derived automatically:
|
|
37
|
+
import type { Tone, SubtitleStyle, Template } from '@agentmedia/schema';
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Zod Validation Schemas
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { CreateVideoSchema, SubtitleSchema, ProductReviewSchema } from '@agentmedia/schema';
|
|
44
|
+
|
|
45
|
+
// Validate API input
|
|
46
|
+
const result = CreateVideoSchema.safeParse(requestBody);
|
|
47
|
+
if (!result.success) {
|
|
48
|
+
console.error(result.error.issues); // structured errors with field paths
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Generator Registry
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { GENERATORS, GENERATOR_IDS } from '@agentmedia/schema';
|
|
56
|
+
|
|
57
|
+
// Each generator is a black box: inputs -> [generator] -> output
|
|
58
|
+
console.log(GENERATOR_IDS); // ['ugc_video', 'product_review', 'subtitle']
|
|
59
|
+
|
|
60
|
+
// Access a generator's Zod input schema
|
|
61
|
+
const schema = GENERATORS.ugc_video.inputSchema;
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Use Cases
|
|
65
|
+
|
|
66
|
+
This package is useful if you're building:
|
|
67
|
+
|
|
68
|
+
- **A custom integration** with the agent-media API (validate inputs before sending)
|
|
69
|
+
- **An SDK** in another language (read the enums, generate code)
|
|
70
|
+
- **A UI** that needs dropdown options from the schema
|
|
71
|
+
- **A testing harness** (import valid values for test fixtures)
|
|
72
|
+
|
|
73
|
+
## Build-Time Generation
|
|
74
|
+
|
|
75
|
+
The schema powers auto-generated artifacts:
|
|
76
|
+
|
|
77
|
+
- `generated/openapi.json` — full OpenAPI 3.1 spec (via `npm run generate:openapi`)
|
|
78
|
+
- `supabase/functions/_shared/schema.generated.ts` — Deno-compatible copy for edge functions (via `npm run generate:edge-schema`)
|
|
79
|
+
|
|
80
|
+
## Related Packages
|
|
81
|
+
|
|
82
|
+
| Package | Description |
|
|
83
|
+
|---|---|
|
|
84
|
+
| [`@agentmedia/sdk`](https://www.npmjs.com/package/@agentmedia/sdk) | TypeScript SDK — uses this schema for types |
|
|
85
|
+
| [`@agentmedia/mcp-server`](https://www.npmjs.com/package/@agentmedia/mcp-server) | MCP server for Claude Code, Cursor, Windsurf |
|
|
86
|
+
| [`agent-media-cli`](https://www.npmjs.com/package/agent-media-cli) | CLI tool — generate videos from your terminal |
|
|
87
|
+
| [`agent-media`](https://pypi.org/project/agent-media/) | Python SDK |
|
|
88
|
+
|
|
89
|
+
## Links
|
|
90
|
+
|
|
91
|
+
- [Interactive API Docs](https://agent-media.ai/docs/api-reference)
|
|
92
|
+
- [OpenAPI Spec](https://agent-media.ai/openapi.json)
|
|
93
|
+
- [Website](https://agent-media.ai)
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
Apache-2.0
|
package/package.json
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentmedia/schema",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Type-safe schema definitions for AI UGC video generation — enums, Zod validation, and generator registry. Single source of truth for the agent-media platform.",
|
|
4
5
|
"type": "module",
|
|
5
6
|
"license": "Apache-2.0",
|
|
7
|
+
"homepage": "https://agent-media.ai/docs/api-reference",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/yuvalsuede/agent-media.git",
|
|
11
|
+
"directory": "packages/schema"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"ugc", "video-generation", "ai", "schema", "zod", "validation",
|
|
15
|
+
"typescript", "sdk", "developer-tools", "text-to-video", "talking-head",
|
|
16
|
+
"openapi", "mcp", "agent-media"
|
|
17
|
+
],
|
|
6
18
|
"publishConfig": { "access": "public" },
|
|
7
19
|
"main": "./dist/index.js",
|
|
8
20
|
"types": "./dist/index.d.ts",
|