vargai 0.3.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.
Files changed (154) hide show
  1. package/.claude/settings.local.json +7 -0
  2. package/.env.example +27 -0
  3. package/.github/workflows/ci.yml +23 -0
  4. package/.husky/README.md +102 -0
  5. package/.husky/commit-msg +6 -0
  6. package/.husky/pre-commit +9 -0
  7. package/.husky/pre-push +6 -0
  8. package/.size-limit.json +8 -0
  9. package/.test-hooks.ts +5 -0
  10. package/CLAUDE.md +125 -0
  11. package/CONTRIBUTING.md +150 -0
  12. package/LICENSE.md +53 -0
  13. package/README.md +78 -0
  14. package/SKILLS.md +173 -0
  15. package/STRUCTURE.md +92 -0
  16. package/biome.json +34 -0
  17. package/bun.lock +1254 -0
  18. package/commitlint.config.js +22 -0
  19. package/docs/plan.md +66 -0
  20. package/docs/todo.md +14 -0
  21. package/docs/varg-sdk.md +812 -0
  22. package/ffmpeg/CLAUDE.md +68 -0
  23. package/package.json +69 -0
  24. package/pipeline/cookbooks/SKILL.md +285 -0
  25. package/pipeline/cookbooks/remotion-video.md +585 -0
  26. package/pipeline/cookbooks/round-video-character.md +337 -0
  27. package/pipeline/cookbooks/scripts/animate-frames-parallel.ts +84 -0
  28. package/pipeline/cookbooks/scripts/combine-scenes.sh +53 -0
  29. package/pipeline/cookbooks/scripts/generate-frames-parallel.ts +99 -0
  30. package/pipeline/cookbooks/scripts/still-to-video.sh +37 -0
  31. package/pipeline/cookbooks/talking-character.md +59 -0
  32. package/pipeline/cookbooks/text-to-tiktok.md +669 -0
  33. package/pipeline/cookbooks/trendwatching.md +156 -0
  34. package/plan.md +281 -0
  35. package/scripts/.gitkeep +0 -0
  36. package/src/ai-sdk/cache.ts +142 -0
  37. package/src/ai-sdk/examples/cached-generation.ts +53 -0
  38. package/src/ai-sdk/examples/duet-scene-4.ts +53 -0
  39. package/src/ai-sdk/examples/duet-scene-5-audio.ts +32 -0
  40. package/src/ai-sdk/examples/duet-video.ts +56 -0
  41. package/src/ai-sdk/examples/editly-composition.ts +63 -0
  42. package/src/ai-sdk/examples/editly-test.ts +57 -0
  43. package/src/ai-sdk/examples/editly-video-test.ts +52 -0
  44. package/src/ai-sdk/examples/fal-lipsync.ts +43 -0
  45. package/src/ai-sdk/examples/higgsfield-image.ts +61 -0
  46. package/src/ai-sdk/examples/music-generation.ts +19 -0
  47. package/src/ai-sdk/examples/openai-sora.ts +34 -0
  48. package/src/ai-sdk/examples/replicate-bg-removal.ts +52 -0
  49. package/src/ai-sdk/examples/simpsons-scene.ts +61 -0
  50. package/src/ai-sdk/examples/talking-lion.ts +55 -0
  51. package/src/ai-sdk/examples/video-generation.ts +39 -0
  52. package/src/ai-sdk/examples/workflow-animated-girl.ts +104 -0
  53. package/src/ai-sdk/examples/workflow-before-after.ts +114 -0
  54. package/src/ai-sdk/examples/workflow-character-grid.ts +112 -0
  55. package/src/ai-sdk/examples/workflow-slideshow.ts +161 -0
  56. package/src/ai-sdk/file-cache.ts +112 -0
  57. package/src/ai-sdk/file.ts +238 -0
  58. package/src/ai-sdk/generate-element.ts +92 -0
  59. package/src/ai-sdk/generate-music.ts +46 -0
  60. package/src/ai-sdk/generate-video.ts +165 -0
  61. package/src/ai-sdk/index.ts +72 -0
  62. package/src/ai-sdk/music-model.ts +110 -0
  63. package/src/ai-sdk/providers/editly/editly.test.ts +1108 -0
  64. package/src/ai-sdk/providers/editly/ffmpeg.ts +60 -0
  65. package/src/ai-sdk/providers/editly/index.ts +817 -0
  66. package/src/ai-sdk/providers/editly/layers.ts +772 -0
  67. package/src/ai-sdk/providers/editly/plan.md +144 -0
  68. package/src/ai-sdk/providers/editly/types.ts +328 -0
  69. package/src/ai-sdk/providers/elevenlabs-provider.ts +255 -0
  70. package/src/ai-sdk/providers/fal-provider.ts +512 -0
  71. package/src/ai-sdk/providers/higgsfield.ts +379 -0
  72. package/src/ai-sdk/providers/openai.ts +251 -0
  73. package/src/ai-sdk/providers/replicate.ts +16 -0
  74. package/src/ai-sdk/video-model.ts +185 -0
  75. package/src/cli/commands/find.tsx +137 -0
  76. package/src/cli/commands/help.tsx +85 -0
  77. package/src/cli/commands/index.ts +9 -0
  78. package/src/cli/commands/list.tsx +238 -0
  79. package/src/cli/commands/run.tsx +511 -0
  80. package/src/cli/commands/which.tsx +253 -0
  81. package/src/cli/index.ts +112 -0
  82. package/src/cli/quiet.ts +44 -0
  83. package/src/cli/types.ts +32 -0
  84. package/src/cli/ui/components/Badge.tsx +29 -0
  85. package/src/cli/ui/components/DataTable.tsx +51 -0
  86. package/src/cli/ui/components/Header.tsx +23 -0
  87. package/src/cli/ui/components/HelpBlock.tsx +44 -0
  88. package/src/cli/ui/components/KeyValue.tsx +33 -0
  89. package/src/cli/ui/components/OptionRow.tsx +81 -0
  90. package/src/cli/ui/components/Separator.tsx +23 -0
  91. package/src/cli/ui/components/StatusBox.tsx +108 -0
  92. package/src/cli/ui/components/VargBox.tsx +51 -0
  93. package/src/cli/ui/components/VargProgress.tsx +36 -0
  94. package/src/cli/ui/components/VargSpinner.tsx +34 -0
  95. package/src/cli/ui/components/VargText.tsx +56 -0
  96. package/src/cli/ui/components/index.ts +19 -0
  97. package/src/cli/ui/index.ts +12 -0
  98. package/src/cli/ui/render.ts +35 -0
  99. package/src/cli/ui/theme.ts +63 -0
  100. package/src/cli/utils.ts +78 -0
  101. package/src/core/executor/executor.ts +201 -0
  102. package/src/core/executor/index.ts +13 -0
  103. package/src/core/executor/job.ts +214 -0
  104. package/src/core/executor/pipeline.ts +222 -0
  105. package/src/core/index.ts +11 -0
  106. package/src/core/registry/index.ts +9 -0
  107. package/src/core/registry/loader.ts +149 -0
  108. package/src/core/registry/registry.ts +221 -0
  109. package/src/core/registry/resolver.ts +206 -0
  110. package/src/core/schema/helpers.ts +134 -0
  111. package/src/core/schema/index.ts +8 -0
  112. package/src/core/schema/shared.ts +102 -0
  113. package/src/core/schema/types.ts +279 -0
  114. package/src/core/schema/validator.ts +92 -0
  115. package/src/definitions/actions/captions.ts +261 -0
  116. package/src/definitions/actions/edit.ts +298 -0
  117. package/src/definitions/actions/image.ts +125 -0
  118. package/src/definitions/actions/index.ts +114 -0
  119. package/src/definitions/actions/music.ts +205 -0
  120. package/src/definitions/actions/sync.ts +128 -0
  121. package/src/definitions/actions/transcribe.ts +200 -0
  122. package/src/definitions/actions/upload.ts +111 -0
  123. package/src/definitions/actions/video.ts +163 -0
  124. package/src/definitions/actions/voice.ts +119 -0
  125. package/src/definitions/index.ts +23 -0
  126. package/src/definitions/models/elevenlabs.ts +50 -0
  127. package/src/definitions/models/flux.ts +56 -0
  128. package/src/definitions/models/index.ts +36 -0
  129. package/src/definitions/models/kling.ts +56 -0
  130. package/src/definitions/models/llama.ts +54 -0
  131. package/src/definitions/models/nano-banana-pro.ts +102 -0
  132. package/src/definitions/models/sonauto.ts +68 -0
  133. package/src/definitions/models/soul.ts +65 -0
  134. package/src/definitions/models/wan.ts +54 -0
  135. package/src/definitions/models/whisper.ts +44 -0
  136. package/src/definitions/skills/index.ts +12 -0
  137. package/src/definitions/skills/talking-character.ts +87 -0
  138. package/src/definitions/skills/text-to-tiktok.ts +97 -0
  139. package/src/index.ts +118 -0
  140. package/src/providers/apify.ts +269 -0
  141. package/src/providers/base.ts +264 -0
  142. package/src/providers/elevenlabs.ts +217 -0
  143. package/src/providers/fal.ts +392 -0
  144. package/src/providers/ffmpeg.ts +544 -0
  145. package/src/providers/fireworks.ts +193 -0
  146. package/src/providers/groq.ts +149 -0
  147. package/src/providers/higgsfield.ts +145 -0
  148. package/src/providers/index.ts +143 -0
  149. package/src/providers/replicate.ts +147 -0
  150. package/src/providers/storage.ts +206 -0
  151. package/src/tests/all.test.ts +509 -0
  152. package/src/tests/index.ts +33 -0
  153. package/src/tests/unit.test.ts +403 -0
  154. package/tsconfig.json +45 -0
package/SKILLS.md ADDED
@@ -0,0 +1,173 @@
1
+ # agent skills
2
+
3
+ this sdk includes claude code agent skills for each service. each skill is co-located with its service code.
4
+
5
+ ## available skills
6
+
7
+ ### service skills
8
+
9
+ located in `service/<name>/SKILL.md`:
10
+
11
+ 1. **image-generation** (`service/image/`)
12
+ - generate ai images using fal (flux models) or higgsfield soul characters
13
+ - cli: `bun run service/image fal|soul <prompt> [options]`
14
+
15
+ 2. **video-generation** (`service/video/`)
16
+ - generate videos from images (local or url) or text prompts using fal.ai
17
+ - supports local image files - automatically uploads to fal storage
18
+ - cli: `bun run service/video from_image|from_text <args>`
19
+
20
+ 3. **voice-synthesis** (`service/voice/`)
21
+ - generate realistic text-to-speech audio using elevenlabs
22
+ - cli: `bun run service/voice generate|elevenlabs <text> [options]`
23
+
24
+ 3b. **music-generation** (`lib/elevenlabs.ts`)
25
+ - generate music from text prompts using elevenlabs
26
+ - generate sound effects from descriptions
27
+ - cli: `bun run lib/elevenlabs.ts music|sfx <prompt> [options]`
28
+
29
+ 4. **video-lipsync** (`service/sync/`)
30
+ - sync video with audio using wav2lip or simple overlay
31
+ - cli: `bun run service/sync sync|wav2lip|overlay <args>`
32
+
33
+ 5. **video-captions** (`service/captions/`)
34
+ - add auto-generated or custom subtitles to videos
35
+ - cli: `bun run service/captions <videoPath> [options]`
36
+
37
+ 6. **video-editing** (`service/edit/`)
38
+ - edit videos with ffmpeg (resize, trim, concat, social media prep)
39
+ - cli: `bun run service/edit social|montage|trim|resize|merge_audio <args>`
40
+
41
+ 7. **audio-transcription** (`service/transcribe/`)
42
+ - transcribe audio to text or subtitles using groq/fireworks
43
+ - cli: `bun run service/transcribe <audioUrl> <provider> [outputPath]`
44
+
45
+ ### library skills
46
+
47
+ 8. **apify-scraping** (`lib/apify.ts`)
48
+ - run apify actors for web scraping (tiktok, google maps, social media, etc.)
49
+ - cli: `bun run lib/apify.ts run <actor_id> [input_json]`
50
+ - example: `bun run lib/apify.ts run clockworks/tiktok-scraper '{"hashtags":["viral"],"resultsPerPage":10}'`
51
+
52
+ ### utility skills
53
+
54
+ 9. **telegram-send** (external: `/Users/aleks/Github/Badaboom1995/rumble-b2c`)
55
+ - send videos to telegram users/channels as round videos
56
+ - automatically converts to 512x512 square format for telegram
57
+ - cli: `cd /Users/aleks/Github/Badaboom1995/rumble-b2c && bun run scripts/telegram-send-video.ts <videoPath> <@username>`
58
+ - example: `cd /Users/aleks/Github/Badaboom1995/rumble-b2c && bun run scripts/telegram-send-video.ts /path/to/video.mp4 @caffeinum`
59
+
60
+ ### pipeline skills
61
+
62
+ located in `pipeline/cookbooks/SKILL.md`:
63
+
64
+ 10. **talking-character-pipeline** (`pipeline/cookbooks/`)
65
+ - complete workflow to create talking character videos
66
+ - combines: character generation → voiceover → animation → lipsync → captions → social prep
67
+
68
+ 11. **round-video-character** (`pipeline/cookbooks/round-video-character.md`)
69
+ - create realistic round selfie videos for telegram using nano banana pro + wan 2.5
70
+ - workflow: generate selfie first frame (person in setting) → voiceover → wan 2.5 video
71
+ - uses: `bun run lib/fal.ts`, `bun run lib/replicate.ts`, `bun run lib/elevenlabs.ts`
72
+ - input: text script + profile photo
73
+ - output: extreme close-up selfie video with authentic camera shake, lighting, and audio
74
+
75
+ 12. **trendwatching** (`pipeline/cookbooks/trendwatching.md`)
76
+ - discover viral tiktok content for any topic/hashtag
77
+ - uses apify tiktok scraper to find trending videos
78
+ - get engagement metrics: plays, likes, shares, comments
79
+ - cli: `bun run lib/apify.ts run clockworks/tiktok-scraper '{"hashtags":["topic"],"resultsPerPage":10}'`
80
+
81
+ ## structure
82
+
83
+ each skill follows this pattern:
84
+
85
+ ```
86
+ service/<name>/
87
+ ├── index.ts # service implementation
88
+ └── SKILL.md # claude code agent skill
89
+ ```
90
+
91
+ ## how skills work
92
+
93
+ skills are **model-invoked** - claude autonomously decides when to use them based on your request and the skill's description.
94
+
95
+ **example:**
96
+ - you say: "create a talking character video"
97
+ - claude reads `talking-character-pipeline` skill
98
+ - claude executes the workflow using the pipeline steps
99
+
100
+ ## using skills
101
+
102
+ ### in claude code
103
+
104
+ skills are automatically discovered when you're in the sdk directory:
105
+
106
+ ```
107
+ user: create an image of a sunset
108
+ claude: [uses image-generation skill]
109
+ bun run service/image fal "beautiful sunset over mountains"
110
+ ```
111
+
112
+ ### manually
113
+
114
+ you can also run services directly:
115
+
116
+ ```bash
117
+ # generate image
118
+ bun run service/image fal "sunset over mountains" true
119
+
120
+ # generate video from that image
121
+ bun run service/video from_image "camera pan" https://image-url.jpg 5 true
122
+
123
+ # add voice
124
+ bun run service/voice elevenlabs "this is a beautiful sunset" rachel true
125
+
126
+ # sync with video
127
+ bun run service/sync wav2lip https://video-url.mp4 https://audio-url.mp3
128
+ ```
129
+
130
+ ## skill features
131
+
132
+ each skill includes:
133
+
134
+ - **name**: unique skill identifier
135
+ - **description**: when claude should use this skill
136
+ - **allowed-tools**: restricted to Read, Bash for safety
137
+ - **usage examples**: cli and programmatic examples
138
+ - **when to use**: specific use cases
139
+ - **tips**: best practices
140
+ - **environment variables**: required api keys
141
+
142
+ ## benefits
143
+
144
+ - **discoverability**: claude knows all available services
145
+ - **context**: skills provide usage examples and best practices
146
+ - **safety**: `allowed-tools` limits to read-only and bash execution
147
+ - **documentation**: skills serve as living documentation
148
+
149
+ ## skill reference
150
+
151
+ | skill | service | primary use case |
152
+ |-------|---------|------------------|
153
+ | image-generation | image | create ai images, character headshots |
154
+ | video-generation | video | animate images, generate video clips |
155
+ | voice-synthesis | voice | text-to-speech, voiceovers |
156
+ | music-generation | elevenlabs | generate music, create sound effects |
157
+ | video-lipsync | sync | sync audio with video, talking characters |
158
+ | video-captions | captions | add subtitles, accessibility |
159
+ | video-editing | edit | resize, trim, social media optimization |
160
+ | audio-transcription | transcribe | speech-to-text, subtitle generation |
161
+ | apify-scraping | lib/apify | web scraping via apify actors (tiktok, etc.) |
162
+ | telegram-send | external | send videos to telegram as round videos |
163
+ | talking-character-pipeline | pipeline | end-to-end talking character videos |
164
+ | round-video-character | pipeline | telegram round selfie videos with wan 2.5 |
165
+ | trendwatching | pipeline | discover viral tiktok content by hashtag |
166
+
167
+ ## see also
168
+
169
+ - [README.md](README.md) - sdk overview and installation
170
+ - [STRUCTURE.md](STRUCTURE.md) - detailed module organization
171
+ - [pipeline/cookbooks/talking-character.md](pipeline/cookbooks/talking-character.md) - talking character workflow
172
+ - [pipeline/cookbooks/round-video-character.md](pipeline/cookbooks/round-video-character.md) - telegram round selfie video cookbook
173
+ - [pipeline/cookbooks/trendwatching.md](pipeline/cookbooks/trendwatching.md) - discover viral tiktok content
package/STRUCTURE.md ADDED
@@ -0,0 +1,92 @@
1
+ # sdk structure
2
+
3
+ ## lib/ - two fal implementations
4
+
5
+ ### lib/ai-sdk/fal.ts
6
+ uses `@ai-sdk/fal` with vercel ai sdk
7
+
8
+ **when to use:**
9
+ - standard image generation
10
+ - need consistent api across providers
11
+ - want automatic image format handling
12
+ - prefer typed aspect ratios
13
+
14
+ **commands:**
15
+ ```bash
16
+ bun run lib/ai-sdk/fal.ts generate_image <prompt> [model] [aspectRatio]
17
+ ```
18
+
19
+ ### lib/fal.ts
20
+ uses `@fal-ai/client` directly
21
+
22
+ **when to use:**
23
+ - video generation (image-to-video, text-to-video)
24
+ - advanced fal features
25
+ - need queue/streaming updates
26
+ - custom api parameters
27
+
28
+ **commands:**
29
+ ```bash
30
+ bun run lib/fal.ts generate_image <prompt> [model] [imageSize]
31
+ bun run lib/fal.ts image_to_video <prompt> <imageUrl> [duration]
32
+ bun run lib/fal.ts text_to_video <prompt> [duration]
33
+ ```
34
+
35
+ ### lib/higgsfield.ts
36
+ uses `@higgsfield/client` for soul character generation
37
+
38
+ **commands:**
39
+ ```bash
40
+ bun run lib/higgsfield.ts generate_soul <prompt> [customReferenceId]
41
+ bun run lib/higgsfield.ts create_character <name> <imageUrl1> [imageUrl2...]
42
+ bun run lib/higgsfield.ts list_styles
43
+ ```
44
+
45
+ ## service/ - high-level wrappers
46
+
47
+ ### service/image.ts
48
+ combines fal + higgsfield for image generation
49
+
50
+ ```bash
51
+ bun run service/image.ts fal <prompt> [model] [upload]
52
+ bun run service/image.ts soul <prompt> [customReferenceId] [upload]
53
+ ```
54
+
55
+ ### service/video.ts
56
+ video generation with optional s3 upload
57
+
58
+ ```bash
59
+ bun run service/video.ts from_image <prompt> <imageUrl> [duration] [upload]
60
+ bun run service/video.ts from_text <prompt> [duration] [upload]
61
+ ```
62
+
63
+ ## utilities/
64
+
65
+ ### utilities/s3.ts
66
+ cloudflare r2 / s3 storage operations
67
+
68
+ ```bash
69
+ bun run utilities/s3.ts upload <filePath> <objectKey>
70
+ bun run utilities/s3.ts upload_from_url <url> <objectKey>
71
+ bun run utilities/s3.ts presigned_url <objectKey> [expiresIn]
72
+ ```
73
+
74
+ ## pipeline/cookbooks/
75
+ markdown guides for complex workflows
76
+
77
+ - `talking-character.md`: create talking character videos
78
+
79
+ ## dependencies
80
+
81
+ - `@ai-sdk/fal` - vercel ai sdk fal provider
82
+ - `@fal-ai/client` - official fal client
83
+ - `@higgsfield/client` - higgsfield api client
84
+ - `@aws-sdk/client-s3` - s3 storage
85
+ - `ai` - vercel ai sdk core
86
+
87
+ ## key decisions
88
+
89
+ 1. **two fal implementations** - ai-sdk for simplicity, client for power
90
+ 2. **all scripts are cli + library** - can be run directly or imported
91
+ 3. **consistent logging** - `[module] message` format
92
+ 4. **auto image opening** - ai-sdk version opens images automatically
package/biome.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.3.7/schema.json",
3
+ "vcs": {
4
+ "enabled": true,
5
+ "clientKind": "git",
6
+ "useIgnoreFile": true
7
+ },
8
+ "files": {
9
+ "ignoreUnknown": false,
10
+ "includes": ["**", "!node_modules", "!sdk-py-reference"]
11
+ },
12
+ "formatter": {
13
+ "enabled": true,
14
+ "indentStyle": "space"
15
+ },
16
+ "linter": {
17
+ "enabled": true,
18
+ "rules": {
19
+ "recommended": true
20
+ }
21
+ },
22
+ "assist": {
23
+ "actions": {
24
+ "source": {
25
+ "organizeImports": "on"
26
+ }
27
+ }
28
+ },
29
+ "javascript": {
30
+ "formatter": {
31
+ "quoteStyle": "double"
32
+ }
33
+ }
34
+ }