varg.ai-sdk 0.1.1 → 0.4.0-alpha.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/.claude/settings.local.json +1 -1
- package/.env.example +3 -0
- package/.github/workflows/ci.yml +23 -0
- package/.husky/README.md +102 -0
- package/.husky/commit-msg +6 -0
- package/.husky/pre-commit +9 -0
- package/.husky/pre-push +6 -0
- package/.size-limit.json +8 -0
- package/.test-hooks.ts +5 -0
- package/CLAUDE.md +10 -3
- package/CONTRIBUTING.md +150 -0
- package/LICENSE.md +53 -0
- package/README.md +56 -209
- package/SKILLS.md +26 -10
- package/biome.json +7 -1
- package/bun.lock +1286 -0
- package/commitlint.config.js +22 -0
- package/docs/index.html +1130 -0
- package/docs/prompting.md +326 -0
- package/docs/react.md +834 -0
- package/docs/sdk.md +812 -0
- package/ffmpeg/CLAUDE.md +68 -0
- package/package.json +43 -10
- package/pipeline/cookbooks/scripts/animate-frames-parallel.ts +84 -0
- package/pipeline/cookbooks/scripts/combine-scenes.sh +53 -0
- package/pipeline/cookbooks/scripts/generate-frames-parallel.ts +99 -0
- package/pipeline/cookbooks/scripts/still-to-video.sh +37 -0
- package/pipeline/cookbooks/text-to-tiktok.md +669 -0
- package/pipeline/cookbooks/trendwatching.md +156 -0
- package/plan.md +281 -0
- package/scripts/.gitkeep +0 -0
- package/src/ai-sdk/cache.ts +142 -0
- package/src/ai-sdk/examples/cached-generation.ts +53 -0
- package/src/ai-sdk/examples/duet-scene-4.ts +53 -0
- package/src/ai-sdk/examples/duet-scene-5-audio.ts +32 -0
- package/src/ai-sdk/examples/duet-video.ts +56 -0
- package/src/ai-sdk/examples/editly-composition.ts +63 -0
- package/src/ai-sdk/examples/editly-test.ts +57 -0
- package/src/ai-sdk/examples/editly-video-test.ts +52 -0
- package/src/ai-sdk/examples/fal-lipsync.ts +43 -0
- package/src/ai-sdk/examples/higgsfield-image.ts +61 -0
- package/src/ai-sdk/examples/music-generation.ts +19 -0
- package/src/ai-sdk/examples/openai-sora.ts +34 -0
- package/src/ai-sdk/examples/replicate-bg-removal.ts +52 -0
- package/src/ai-sdk/examples/simpsons-scene.ts +61 -0
- package/src/ai-sdk/examples/talking-lion.ts +55 -0
- package/src/ai-sdk/examples/video-generation.ts +39 -0
- package/src/ai-sdk/examples/workflow-animated-girl.ts +104 -0
- package/src/ai-sdk/examples/workflow-before-after.ts +114 -0
- package/src/ai-sdk/examples/workflow-character-grid.ts +112 -0
- package/src/ai-sdk/examples/workflow-slideshow.ts +161 -0
- package/src/ai-sdk/file-cache.ts +112 -0
- package/src/ai-sdk/file.ts +238 -0
- package/src/ai-sdk/generate-element.ts +92 -0
- package/src/ai-sdk/generate-music.ts +46 -0
- package/src/ai-sdk/generate-video.ts +165 -0
- package/src/ai-sdk/index.ts +72 -0
- package/src/ai-sdk/music-model.ts +110 -0
- package/src/ai-sdk/providers/editly/editly.test.ts +1108 -0
- package/src/ai-sdk/providers/editly/ffmpeg.ts +60 -0
- package/src/ai-sdk/providers/editly/index.ts +817 -0
- package/src/ai-sdk/providers/editly/layers.ts +776 -0
- package/src/ai-sdk/providers/editly/plan.md +144 -0
- package/src/ai-sdk/providers/editly/types.ts +328 -0
- package/src/ai-sdk/providers/elevenlabs-provider.ts +255 -0
- package/src/ai-sdk/providers/fal-provider.ts +512 -0
- package/src/ai-sdk/providers/higgsfield.ts +379 -0
- package/src/ai-sdk/providers/openai.ts +251 -0
- package/src/ai-sdk/providers/replicate.ts +16 -0
- package/src/ai-sdk/video-model.ts +185 -0
- package/src/cli/commands/find.tsx +137 -0
- package/src/cli/commands/help.tsx +85 -0
- package/src/cli/commands/index.ts +6 -0
- package/src/cli/commands/list.tsx +238 -0
- package/src/cli/commands/render.tsx +71 -0
- package/src/cli/commands/run.tsx +511 -0
- package/src/cli/commands/which.tsx +253 -0
- package/src/cli/index.ts +114 -0
- package/src/cli/quiet.ts +44 -0
- package/src/cli/types.ts +32 -0
- package/src/cli/ui/components/Badge.tsx +29 -0
- package/src/cli/ui/components/DataTable.tsx +51 -0
- package/src/cli/ui/components/Header.tsx +23 -0
- package/src/cli/ui/components/HelpBlock.tsx +44 -0
- package/src/cli/ui/components/KeyValue.tsx +33 -0
- package/src/cli/ui/components/OptionRow.tsx +81 -0
- package/src/cli/ui/components/Separator.tsx +23 -0
- package/src/cli/ui/components/StatusBox.tsx +108 -0
- package/src/cli/ui/components/VargBox.tsx +51 -0
- package/src/cli/ui/components/VargProgress.tsx +36 -0
- package/src/cli/ui/components/VargSpinner.tsx +34 -0
- package/src/cli/ui/components/VargText.tsx +56 -0
- package/src/cli/ui/components/index.ts +19 -0
- package/src/cli/ui/index.ts +12 -0
- package/src/cli/ui/render.ts +35 -0
- package/src/cli/ui/theme.ts +63 -0
- package/src/cli/utils.ts +78 -0
- package/src/core/executor/executor.ts +201 -0
- package/src/core/executor/index.ts +13 -0
- package/src/core/executor/job.ts +214 -0
- package/src/core/executor/pipeline.ts +222 -0
- package/src/core/index.ts +11 -0
- package/src/core/registry/index.ts +9 -0
- package/src/core/registry/loader.ts +149 -0
- package/src/core/registry/registry.ts +221 -0
- package/src/core/registry/resolver.ts +206 -0
- package/src/core/schema/helpers.ts +134 -0
- package/src/core/schema/index.ts +8 -0
- package/src/core/schema/shared.ts +102 -0
- package/src/core/schema/types.ts +279 -0
- package/src/core/schema/validator.ts +92 -0
- package/src/definitions/actions/captions.ts +261 -0
- package/src/definitions/actions/edit.ts +298 -0
- package/src/definitions/actions/image.ts +125 -0
- package/src/definitions/actions/index.ts +114 -0
- package/src/definitions/actions/music.ts +205 -0
- package/src/definitions/actions/sync.ts +128 -0
- package/{action/transcribe/index.ts → src/definitions/actions/transcribe.ts} +58 -68
- package/src/definitions/actions/upload.ts +111 -0
- package/src/definitions/actions/video.ts +163 -0
- package/src/definitions/actions/voice.ts +119 -0
- package/src/definitions/index.ts +23 -0
- package/src/definitions/models/elevenlabs.ts +50 -0
- package/src/definitions/models/flux.ts +56 -0
- package/src/definitions/models/index.ts +36 -0
- package/src/definitions/models/kling.ts +56 -0
- package/src/definitions/models/llama.ts +54 -0
- package/src/definitions/models/nano-banana-pro.ts +102 -0
- package/src/definitions/models/sonauto.ts +68 -0
- package/src/definitions/models/soul.ts +65 -0
- package/src/definitions/models/wan.ts +54 -0
- package/src/definitions/models/whisper.ts +44 -0
- package/src/definitions/skills/index.ts +12 -0
- package/src/definitions/skills/talking-character.ts +87 -0
- package/src/definitions/skills/text-to-tiktok.ts +97 -0
- package/src/index.ts +118 -0
- package/src/providers/apify.ts +269 -0
- package/src/providers/base.ts +264 -0
- package/src/providers/elevenlabs.ts +217 -0
- package/src/providers/fal.ts +392 -0
- package/src/providers/ffmpeg.ts +544 -0
- package/src/providers/fireworks.ts +193 -0
- package/src/providers/groq.ts +149 -0
- package/src/providers/higgsfield.ts +145 -0
- package/src/providers/index.ts +143 -0
- package/src/providers/replicate.ts +147 -0
- package/src/providers/storage.ts +206 -0
- package/src/react/cli.ts +52 -0
- package/src/react/elements.ts +146 -0
- package/src/react/examples/branching.tsx +66 -0
- package/src/react/examples/captions-demo.tsx +37 -0
- package/src/react/examples/character-video.tsx +84 -0
- package/src/react/examples/grid.tsx +53 -0
- package/src/react/examples/layouts-demo.tsx +57 -0
- package/src/react/examples/madi.tsx +60 -0
- package/src/react/examples/music-test.tsx +35 -0
- package/src/react/examples/onlyfans-1m/workflow.tsx +88 -0
- package/src/react/examples/orange-portrait.tsx +41 -0
- package/src/react/examples/split-element-demo.tsx +60 -0
- package/src/react/examples/split-layout-demo.tsx +60 -0
- package/src/react/examples/split.tsx +41 -0
- package/src/react/examples/video-grid.tsx +46 -0
- package/src/react/index.ts +43 -0
- package/src/react/layouts/grid.tsx +28 -0
- package/src/react/layouts/index.ts +2 -0
- package/src/react/layouts/split.tsx +20 -0
- package/src/react/react.test.ts +309 -0
- package/src/react/render.ts +21 -0
- package/src/react/renderers/animate.ts +59 -0
- package/src/react/renderers/captions.ts +297 -0
- package/src/react/renderers/clip.ts +248 -0
- package/src/react/renderers/context.ts +17 -0
- package/src/react/renderers/image.ts +109 -0
- package/src/react/renderers/index.ts +22 -0
- package/src/react/renderers/music.ts +60 -0
- package/src/react/renderers/packshot.ts +84 -0
- package/src/react/renderers/progress.ts +173 -0
- package/src/react/renderers/render.ts +243 -0
- package/src/react/renderers/slider.ts +69 -0
- package/src/react/renderers/speech.ts +53 -0
- package/src/react/renderers/split.ts +91 -0
- package/src/react/renderers/subtitle.ts +16 -0
- package/src/react/renderers/swipe.ts +75 -0
- package/src/react/renderers/title.ts +17 -0
- package/src/react/renderers/utils.ts +124 -0
- package/src/react/renderers/video.ts +127 -0
- package/src/react/runtime/jsx-dev-runtime.ts +43 -0
- package/src/react/runtime/jsx-runtime.ts +35 -0
- package/src/react/types.ts +232 -0
- package/src/studio/index.ts +26 -0
- package/src/studio/scanner.ts +102 -0
- package/src/studio/server.ts +554 -0
- package/src/studio/stages.ts +251 -0
- package/src/studio/step-renderer.ts +279 -0
- package/src/studio/types.ts +60 -0
- package/src/studio/ui/cache.html +303 -0
- package/src/studio/ui/index.html +1820 -0
- package/src/tests/all.test.ts +509 -0
- package/src/tests/index.ts +33 -0
- package/src/tests/unit.test.ts +403 -0
- package/tsconfig.cli.json +8 -0
- package/tsconfig.json +21 -3
- package/TEST_RESULTS.md +0 -122
- package/action/captions/SKILL.md +0 -170
- package/action/captions/index.ts +0 -169
- package/action/edit/SKILL.md +0 -235
- package/action/edit/index.ts +0 -437
- package/action/image/SKILL.md +0 -140
- package/action/image/index.ts +0 -105
- package/action/sync/SKILL.md +0 -136
- package/action/sync/index.ts +0 -145
- package/action/transcribe/SKILL.md +0 -179
- package/action/video/SKILL.md +0 -116
- package/action/video/index.ts +0 -125
- package/action/voice/SKILL.md +0 -125
- package/action/voice/index.ts +0 -136
- package/cli/commands/find.ts +0 -58
- package/cli/commands/help.ts +0 -70
- package/cli/commands/list.ts +0 -49
- package/cli/commands/run.ts +0 -237
- package/cli/commands/which.ts +0 -66
- package/cli/discover.ts +0 -66
- package/cli/index.ts +0 -33
- package/cli/runner.ts +0 -65
- package/cli/types.ts +0 -49
- package/cli/ui.ts +0 -185
- package/index.ts +0 -75
- package/lib/README.md +0 -144
- package/lib/ai-sdk/fal.ts +0 -106
- package/lib/ai-sdk/replicate.ts +0 -107
- package/lib/elevenlabs.ts +0 -382
- package/lib/fal.ts +0 -467
- package/lib/ffmpeg.ts +0 -467
- package/lib/fireworks.ts +0 -235
- package/lib/groq.ts +0 -246
- package/lib/higgsfield.ts +0 -176
- package/lib/remotion/SKILL.md +0 -823
- package/lib/remotion/cli.ts +0 -115
- package/lib/remotion/functions.ts +0 -283
- package/lib/remotion/index.ts +0 -19
- package/lib/remotion/templates.ts +0 -73
- package/lib/replicate.ts +0 -304
- package/output.txt +0 -1
- package/test-import.ts +0 -7
- package/test-services.ts +0 -97
- package/utilities/s3.ts +0 -147
package/cli/commands/which.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* varg which command
|
|
3
|
-
* inspect an action by scanning filesystem
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { defineCommand } from "citty";
|
|
7
|
-
import { resolve } from "../discover";
|
|
8
|
-
import { box, c, header, separator } from "../ui";
|
|
9
|
-
|
|
10
|
-
export const whichCmd = defineCommand({
|
|
11
|
-
meta: {
|
|
12
|
-
name: "which",
|
|
13
|
-
description: "inspect what's behind an action",
|
|
14
|
-
},
|
|
15
|
-
args: {
|
|
16
|
-
name: {
|
|
17
|
-
type: "positional",
|
|
18
|
-
description: "action name",
|
|
19
|
-
required: true,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
async run({ args }) {
|
|
23
|
-
const name = args.name;
|
|
24
|
-
|
|
25
|
-
if (!name) {
|
|
26
|
-
console.error(`${c.red("error:")} action name required`);
|
|
27
|
-
console.log(`\nusage: ${c.cyan("varg which <name>")}`);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const item = await resolve(name);
|
|
32
|
-
|
|
33
|
-
if (!item) {
|
|
34
|
-
console.error(`${c.red("error:")} '${name}' not found`);
|
|
35
|
-
console.log(`\nrun ${c.cyan("varg list")} to see available actions`);
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const content: string[] = [];
|
|
40
|
-
content.push("");
|
|
41
|
-
content.push(` ${item.description}`);
|
|
42
|
-
content.push("");
|
|
43
|
-
|
|
44
|
-
content.push(header("SCHEMA"));
|
|
45
|
-
content.push("");
|
|
46
|
-
|
|
47
|
-
for (const [key, prop] of Object.entries(item.schema.input.properties)) {
|
|
48
|
-
const required = item.schema.input.required.includes(key);
|
|
49
|
-
const reqTag = required ? c.yellow("*") : " ";
|
|
50
|
-
const defaultVal = prop.default
|
|
51
|
-
? c.dim(` (default: ${prop.default})`)
|
|
52
|
-
: "";
|
|
53
|
-
content.push(
|
|
54
|
-
` ${reqTag}${c.cyan(key.padEnd(12))}${prop.description}${defaultVal}`,
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
content.push("");
|
|
59
|
-
content.push(separator());
|
|
60
|
-
content.push("");
|
|
61
|
-
content.push(` run ${c.cyan(`varg run ${name} --info`)} for full options`);
|
|
62
|
-
content.push("");
|
|
63
|
-
|
|
64
|
-
console.log(box(`action: ${name}`, content));
|
|
65
|
-
},
|
|
66
|
-
});
|
package/cli/discover.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* filesystem-based discovery for varg cli
|
|
3
|
-
* scans action/ directory for modules with meta exports
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { readdir } from "node:fs/promises";
|
|
7
|
-
import { join } from "node:path";
|
|
8
|
-
import type { ActionMeta, Meta } from "./types";
|
|
9
|
-
|
|
10
|
-
const ACTION_DIR = join(import.meta.dir, "..", "action");
|
|
11
|
-
|
|
12
|
-
let cachedActions: ActionMeta[] | null = null;
|
|
13
|
-
|
|
14
|
-
export async function discoverActions(): Promise<ActionMeta[]> {
|
|
15
|
-
if (cachedActions) return cachedActions;
|
|
16
|
-
|
|
17
|
-
const actions: ActionMeta[] = [];
|
|
18
|
-
const dirs = await readdir(ACTION_DIR);
|
|
19
|
-
|
|
20
|
-
for (const dir of dirs) {
|
|
21
|
-
try {
|
|
22
|
-
const mod = await import(`../action/${dir}`);
|
|
23
|
-
if (mod.meta && mod.meta.type === "action") {
|
|
24
|
-
actions.push(mod.meta);
|
|
25
|
-
}
|
|
26
|
-
} catch {
|
|
27
|
-
// skip directories without valid modules
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
cachedActions = actions;
|
|
32
|
-
return actions;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export async function resolve(name: string): Promise<Meta | null> {
|
|
36
|
-
const actions = await discoverActions();
|
|
37
|
-
|
|
38
|
-
// check explicit namespace
|
|
39
|
-
if (name.startsWith("action/")) {
|
|
40
|
-
const actionName = name.slice(7);
|
|
41
|
-
return actions.find((a) => a.name === actionName) || null;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// check actions
|
|
45
|
-
const action = actions.find((a) => a.name === name);
|
|
46
|
-
if (action) return action;
|
|
47
|
-
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export async function search(query: string): Promise<Meta[]> {
|
|
52
|
-
const actions = await discoverActions();
|
|
53
|
-
const q = query.toLowerCase();
|
|
54
|
-
|
|
55
|
-
return actions.filter(
|
|
56
|
-
(a) =>
|
|
57
|
-
a.name.toLowerCase().includes(q) ||
|
|
58
|
-
a.description.toLowerCase().includes(q) ||
|
|
59
|
-
a.inputType.toLowerCase().includes(q) ||
|
|
60
|
-
a.outputType.toLowerCase().includes(q),
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export async function list(): Promise<Meta[]> {
|
|
65
|
-
return discoverActions();
|
|
66
|
-
}
|
package/cli/index.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* varg cli
|
|
5
|
-
* ai video infrastructure from your terminal
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { defineCommand, runMain } from "citty";
|
|
9
|
-
import { findCmd } from "./commands/find";
|
|
10
|
-
import { helpCmd } from "./commands/help";
|
|
11
|
-
import { listCmd } from "./commands/list";
|
|
12
|
-
import { runCmd } from "./commands/run";
|
|
13
|
-
import { whichCmd } from "./commands/which";
|
|
14
|
-
|
|
15
|
-
const main = defineCommand({
|
|
16
|
-
meta: {
|
|
17
|
-
name: "varg",
|
|
18
|
-
version: "0.1.0",
|
|
19
|
-
description: "ai video infrastructure from your terminal",
|
|
20
|
-
},
|
|
21
|
-
subCommands: {
|
|
22
|
-
run: runCmd,
|
|
23
|
-
list: listCmd,
|
|
24
|
-
ls: listCmd,
|
|
25
|
-
find: findCmd,
|
|
26
|
-
search: findCmd,
|
|
27
|
-
which: whichCmd,
|
|
28
|
-
inspect: whichCmd,
|
|
29
|
-
help: helpCmd,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
runMain(main);
|
package/cli/runner.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* shared cli runner for actions
|
|
3
|
-
* parses args and calls meta.run()
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { Meta } from "./types";
|
|
7
|
-
|
|
8
|
-
export async function runCli(meta: Meta) {
|
|
9
|
-
const args = process.argv.slice(2);
|
|
10
|
-
|
|
11
|
-
if (args[0] === "help" || args[0] === "--help" || args.length === 0) {
|
|
12
|
-
console.log(`
|
|
13
|
-
${meta.name} - ${meta.description}
|
|
14
|
-
|
|
15
|
-
usage:
|
|
16
|
-
bun run action/${meta.name} [options]
|
|
17
|
-
|
|
18
|
-
options:`);
|
|
19
|
-
|
|
20
|
-
for (const [key, prop] of Object.entries(meta.schema.input.properties)) {
|
|
21
|
-
const req = meta.schema.input.required.includes(key) ? " (required)" : "";
|
|
22
|
-
const def =
|
|
23
|
-
prop.default !== undefined ? ` [default: ${prop.default}]` : "";
|
|
24
|
-
console.log(` --${key.padEnd(14)} ${prop.description}${req}${def}`);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
console.log(`
|
|
28
|
-
examples:
|
|
29
|
-
bun run action/${meta.name} --${meta.schema.input.required[0]} "value"
|
|
30
|
-
`);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// parse args
|
|
35
|
-
const options: Record<string, unknown> = {};
|
|
36
|
-
const firstRequired = meta.schema.input.required[0];
|
|
37
|
-
|
|
38
|
-
for (let i = 0; i < args.length; i++) {
|
|
39
|
-
const arg = args[i];
|
|
40
|
-
if (arg?.startsWith("--")) {
|
|
41
|
-
const key = arg.slice(2);
|
|
42
|
-
const value = args[++i];
|
|
43
|
-
options[key] = value;
|
|
44
|
-
} else if (arg && firstRequired && !options[firstRequired]) {
|
|
45
|
-
// first positional arg goes to first required field
|
|
46
|
-
options[firstRequired] = arg;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// validate required
|
|
51
|
-
for (const req of meta.schema.input.required) {
|
|
52
|
-
if (!options[req]) {
|
|
53
|
-
console.error(`error: --${req} is required`);
|
|
54
|
-
process.exit(1);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
try {
|
|
59
|
-
const result = await meta.run(options);
|
|
60
|
-
console.log(JSON.stringify(result, null, 2));
|
|
61
|
-
} catch (err) {
|
|
62
|
-
console.error(`error: ${err instanceof Error ? err.message : err}`);
|
|
63
|
-
process.exit(1);
|
|
64
|
-
}
|
|
65
|
-
}
|
package/cli/types.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* shared types for varg cli
|
|
3
|
-
* actions and models export meta objects conforming to these types
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface SchemaProperty {
|
|
7
|
-
type: string;
|
|
8
|
-
description: string;
|
|
9
|
-
enum?: (string | number)[];
|
|
10
|
-
default?: unknown;
|
|
11
|
-
format?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface Schema {
|
|
15
|
-
input: {
|
|
16
|
-
type: "object";
|
|
17
|
-
required: string[];
|
|
18
|
-
properties: Record<string, SchemaProperty>;
|
|
19
|
-
};
|
|
20
|
-
output: {
|
|
21
|
-
type: string;
|
|
22
|
-
format?: string;
|
|
23
|
-
description: string;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface ActionMeta {
|
|
28
|
-
name: string;
|
|
29
|
-
type: "action";
|
|
30
|
-
description: string;
|
|
31
|
-
inputType: string;
|
|
32
|
-
outputType: string;
|
|
33
|
-
schema: Schema;
|
|
34
|
-
run: (options: Record<string, unknown>) => Promise<unknown>;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface ModelMeta {
|
|
38
|
-
name: string;
|
|
39
|
-
type: "model";
|
|
40
|
-
description: string;
|
|
41
|
-
inputType: string;
|
|
42
|
-
outputType: string;
|
|
43
|
-
providers: string[];
|
|
44
|
-
defaultProvider: string;
|
|
45
|
-
schema: Schema;
|
|
46
|
-
run: (options: Record<string, unknown>) => Promise<unknown>;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export type Meta = ActionMeta | ModelMeta;
|
package/cli/ui.ts
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* terminal ui helpers for varg cli
|
|
3
|
-
* beautiful boxes and formatting
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const COLORS = {
|
|
7
|
-
reset: "\x1b[0m",
|
|
8
|
-
bold: "\x1b[1m",
|
|
9
|
-
dim: "\x1b[2m",
|
|
10
|
-
green: "\x1b[32m",
|
|
11
|
-
yellow: "\x1b[33m",
|
|
12
|
-
blue: "\x1b[34m",
|
|
13
|
-
magenta: "\x1b[35m",
|
|
14
|
-
cyan: "\x1b[36m",
|
|
15
|
-
red: "\x1b[31m",
|
|
16
|
-
gray: "\x1b[90m",
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const c = {
|
|
20
|
-
reset: (s: string) => `${COLORS.reset}${s}${COLORS.reset}`,
|
|
21
|
-
bold: (s: string) => `${COLORS.bold}${s}${COLORS.reset}`,
|
|
22
|
-
dim: (s: string) => `${COLORS.dim}${s}${COLORS.reset}`,
|
|
23
|
-
green: (s: string) => `${COLORS.green}${s}${COLORS.reset}`,
|
|
24
|
-
yellow: (s: string) => `${COLORS.yellow}${s}${COLORS.reset}`,
|
|
25
|
-
blue: (s: string) => `${COLORS.blue}${s}${COLORS.reset}`,
|
|
26
|
-
magenta: (s: string) => `${COLORS.magenta}${s}${COLORS.reset}`,
|
|
27
|
-
cyan: (s: string) => `${COLORS.cyan}${s}${COLORS.reset}`,
|
|
28
|
-
red: (s: string) => `${COLORS.red}${s}${COLORS.reset}`,
|
|
29
|
-
gray: (s: string) => `${COLORS.gray}${s}${COLORS.reset}`,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
// strip ansi codes for length calculation
|
|
33
|
-
// biome-ignore lint/complexity/useRegexLiterals: literal triggers noControlCharactersInRegex
|
|
34
|
-
const ANSI_REGEX = new RegExp("\x1b\\[[0-9;]*m", "g");
|
|
35
|
-
function stripAnsi(s: string): string {
|
|
36
|
-
return s.replace(ANSI_REGEX, "");
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// box drawing characters
|
|
40
|
-
const BOX = {
|
|
41
|
-
topLeft: "┌",
|
|
42
|
-
topRight: "┐",
|
|
43
|
-
bottomLeft: "└",
|
|
44
|
-
bottomRight: "┘",
|
|
45
|
-
horizontal: "─",
|
|
46
|
-
vertical: "│",
|
|
47
|
-
line: "─",
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const WIDTH = 71;
|
|
51
|
-
|
|
52
|
-
export function box(title: string, content: string[]): string {
|
|
53
|
-
const lines: string[] = [];
|
|
54
|
-
|
|
55
|
-
// top border with title
|
|
56
|
-
const titlePart = title ? `${BOX.line} ${title} ` : "";
|
|
57
|
-
const remainingWidth = WIDTH - 2 - stripAnsi(titlePart).length;
|
|
58
|
-
lines.push(
|
|
59
|
-
`${BOX.topLeft}${titlePart}${BOX.horizontal.repeat(remainingWidth)}${BOX.topRight}`,
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
// content lines
|
|
63
|
-
for (const line of content) {
|
|
64
|
-
const stripped = stripAnsi(line);
|
|
65
|
-
const padding = WIDTH - 2 - stripped.length;
|
|
66
|
-
if (padding >= 0) {
|
|
67
|
-
lines.push(`${BOX.vertical}${line}${" ".repeat(padding)}${BOX.vertical}`);
|
|
68
|
-
} else {
|
|
69
|
-
// truncate if too long
|
|
70
|
-
lines.push(
|
|
71
|
-
`${BOX.vertical}${line.slice(0, WIDTH - 5)}...${BOX.vertical}`,
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// bottom border
|
|
77
|
-
lines.push(
|
|
78
|
-
`${BOX.bottomLeft}${BOX.horizontal.repeat(WIDTH - 2)}${BOX.bottomRight}`,
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
return lines.join("\n");
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function separator(): string {
|
|
85
|
-
return ` ${c.dim(BOX.horizontal.repeat(WIDTH - 4))}`;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export function header(text: string): string {
|
|
89
|
-
return c.bold(c.dim(` ${text}`));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function row(label: string, value: string, indent = 2): string {
|
|
93
|
-
const spaces = " ".repeat(indent);
|
|
94
|
-
const labelWidth = 14;
|
|
95
|
-
const paddedLabel = label.padEnd(labelWidth);
|
|
96
|
-
return `${spaces}${c.dim(paddedLabel)}${value}`;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export function success(message: string): string {
|
|
100
|
-
return ` ${c.green("✓")} ${message}`;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export function error(message: string): string {
|
|
104
|
-
return ` ${c.red("✗")} ${message}`;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export function spinner(message: string): string {
|
|
108
|
-
return ` ${c.cyan("◐")} ${message}`;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export function formatDuration(ms: number): string {
|
|
112
|
-
if (ms < 1000) return `${ms}ms`;
|
|
113
|
-
const s = Math.round(ms / 1000);
|
|
114
|
-
return `${s}s`;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export function formatCost(dollars: number): string {
|
|
118
|
-
return `$${dollars.toFixed(3)}`;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// table formatting for list command
|
|
122
|
-
export interface TableRow {
|
|
123
|
-
name: string;
|
|
124
|
-
description: string;
|
|
125
|
-
providers?: string;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export function table(rows: TableRow[], nameWidth = 16): string[] {
|
|
129
|
-
const lines: string[] = [];
|
|
130
|
-
|
|
131
|
-
for (const row of rows) {
|
|
132
|
-
const name = row.name.padEnd(nameWidth);
|
|
133
|
-
const desc = row.description;
|
|
134
|
-
const providers = row.providers ? c.dim(row.providers) : "";
|
|
135
|
-
|
|
136
|
-
if (providers) {
|
|
137
|
-
lines.push(` ${c.cyan(name)}${desc.padEnd(30)}${providers}`);
|
|
138
|
-
} else {
|
|
139
|
-
lines.push(` ${c.cyan(name)}${desc}`);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return lines;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// progress output for running commands
|
|
147
|
-
export function runningBox(
|
|
148
|
-
name: string,
|
|
149
|
-
params: Record<string, string>,
|
|
150
|
-
status: "running" | "done" | "error",
|
|
151
|
-
result?: { output?: string; cost?: number; error?: string; time?: number },
|
|
152
|
-
): string {
|
|
153
|
-
const content: string[] = [""];
|
|
154
|
-
|
|
155
|
-
// params
|
|
156
|
-
for (const [key, value] of Object.entries(params)) {
|
|
157
|
-
const displayValue =
|
|
158
|
-
value.length > 40 ? `"${value.slice(0, 37)}..."` : `"${value}"`;
|
|
159
|
-
content.push(row(key, displayValue));
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
content.push("");
|
|
163
|
-
|
|
164
|
-
// status
|
|
165
|
-
if (status === "running") {
|
|
166
|
-
content.push(spinner("generating..."));
|
|
167
|
-
} else if (status === "done" && result) {
|
|
168
|
-
content.push(success(`done in ${formatDuration(result.time || 0)}`));
|
|
169
|
-
content.push("");
|
|
170
|
-
if (result.output) {
|
|
171
|
-
content.push(row("output", result.output));
|
|
172
|
-
}
|
|
173
|
-
if (result.cost) {
|
|
174
|
-
content.push(row("cost", formatCost(result.cost)));
|
|
175
|
-
}
|
|
176
|
-
} else if (status === "error" && result?.error) {
|
|
177
|
-
content.push(error("failed"));
|
|
178
|
-
content.push("");
|
|
179
|
-
content.push(row("error", result.error));
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
content.push("");
|
|
183
|
-
|
|
184
|
-
return box(name, content);
|
|
185
|
-
}
|
package/index.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* varg.ai sdk
|
|
3
|
-
* video generation and editing tools
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// re-export external clients
|
|
7
|
-
export { fal } from "@ai-sdk/fal";
|
|
8
|
-
export { replicate } from "@ai-sdk/replicate";
|
|
9
|
-
export { fal as falClient } from "@fal-ai/client";
|
|
10
|
-
export { HiggsfieldClient } from "@higgsfield/client";
|
|
11
|
-
// action exports (excluding meta to avoid conflicts)
|
|
12
|
-
export {
|
|
13
|
-
type AddCaptionsOptions,
|
|
14
|
-
addCaptions,
|
|
15
|
-
type SubtitleStyle,
|
|
16
|
-
} from "./action/captions";
|
|
17
|
-
export {
|
|
18
|
-
type CreateMontageOptions,
|
|
19
|
-
createMontage,
|
|
20
|
-
type EditPipelineOptions,
|
|
21
|
-
type EditPipelineStep,
|
|
22
|
-
editPipeline,
|
|
23
|
-
mergeWithAudio,
|
|
24
|
-
type PrepareForSocialOptions,
|
|
25
|
-
prepareForSocial,
|
|
26
|
-
quickResize,
|
|
27
|
-
quickTrim,
|
|
28
|
-
} from "./action/edit";
|
|
29
|
-
export {
|
|
30
|
-
generateWithFal,
|
|
31
|
-
generateWithSoul,
|
|
32
|
-
type ImageGenerationResult,
|
|
33
|
-
} from "./action/image";
|
|
34
|
-
export {
|
|
35
|
-
type LipsyncOptions,
|
|
36
|
-
lipsync,
|
|
37
|
-
lipsyncOverlay,
|
|
38
|
-
lipsyncWav2Lip,
|
|
39
|
-
type Wav2LipOptions,
|
|
40
|
-
} from "./action/sync";
|
|
41
|
-
export {
|
|
42
|
-
type TranscribeOptions,
|
|
43
|
-
type TranscribeResult,
|
|
44
|
-
transcribe,
|
|
45
|
-
} from "./action/transcribe";
|
|
46
|
-
export {
|
|
47
|
-
generateVideoFromImage,
|
|
48
|
-
generateVideoFromText,
|
|
49
|
-
type VideoGenerationResult,
|
|
50
|
-
} from "./action/video";
|
|
51
|
-
export {
|
|
52
|
-
type GenerateVoiceOptions,
|
|
53
|
-
generateVoice,
|
|
54
|
-
type VoiceResult,
|
|
55
|
-
} from "./action/voice";
|
|
56
|
-
// lib exports - ai-sdk/fal (provider)
|
|
57
|
-
export * as aiSdkFal from "./lib/ai-sdk/fal";
|
|
58
|
-
// lib exports - ai-sdk/replicate (provider)
|
|
59
|
-
export * as aiSdkReplicate from "./lib/ai-sdk/replicate";
|
|
60
|
-
// lib exports - elevenlabs
|
|
61
|
-
export * from "./lib/elevenlabs";
|
|
62
|
-
// lib exports - fal (client)
|
|
63
|
-
export * from "./lib/fal";
|
|
64
|
-
// lib exports - ffmpeg
|
|
65
|
-
export * from "./lib/ffmpeg";
|
|
66
|
-
// lib exports - fireworks
|
|
67
|
-
export * from "./lib/fireworks";
|
|
68
|
-
// lib exports - groq
|
|
69
|
-
export * from "./lib/groq";
|
|
70
|
-
// lib exports - higgsfield
|
|
71
|
-
export * from "./lib/higgsfield";
|
|
72
|
-
// lib exports - replicate
|
|
73
|
-
export * from "./lib/replicate";
|
|
74
|
-
// utilities exports
|
|
75
|
-
export * from "./utilities/s3";
|
package/lib/README.md
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
# lib/ modules
|
|
2
|
-
|
|
3
|
-
## two fal implementations
|
|
4
|
-
|
|
5
|
-
### lib/ai-sdk/fal.ts - ai-sdk provider (recommended for images)
|
|
6
|
-
|
|
7
|
-
uses `@ai-sdk/fal` with the vercel ai sdk's `experimental_generateImage`
|
|
8
|
-
|
|
9
|
-
**benefits:**
|
|
10
|
-
- clean, typed api via vercel ai sdk
|
|
11
|
-
- automatic image format handling (uint8array)
|
|
12
|
-
- consistent interface with other ai providers
|
|
13
|
-
- built-in aspect ratio support
|
|
14
|
-
- better for standard image generation
|
|
15
|
-
|
|
16
|
-
**example:**
|
|
17
|
-
```bash
|
|
18
|
-
bun run lib/ai-sdk/fal.ts generate_image "cyberpunk city" "fal-ai/flux/dev" "16:9"
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
**code:**
|
|
22
|
-
```typescript
|
|
23
|
-
import { fal } from "@ai-sdk/fal"
|
|
24
|
-
import { experimental_generateImage as generateImage } from "ai"
|
|
25
|
-
|
|
26
|
-
const { image, providerMetadata } = await generateImage({
|
|
27
|
-
model: fal.image("fal-ai/flux/dev"),
|
|
28
|
-
prompt: "beautiful sunset",
|
|
29
|
-
aspectRatio: "16:9",
|
|
30
|
-
})
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### lib/fal.ts - fal client direct (for video & advanced features)
|
|
34
|
-
|
|
35
|
-
uses `@fal-ai/client` directly with the raw fal api
|
|
36
|
-
|
|
37
|
-
**benefits:**
|
|
38
|
-
- access to all fal features (video, advanced params)
|
|
39
|
-
- streaming/queue updates
|
|
40
|
-
- full control over api parameters
|
|
41
|
-
- required for video generation (no ai-sdk support yet)
|
|
42
|
-
- **supports local images** - automatically uploads local files to fal storage
|
|
43
|
-
|
|
44
|
-
**examples:**
|
|
45
|
-
```bash
|
|
46
|
-
# image generation
|
|
47
|
-
bun run lib/fal.ts generate_image "aurora borealis" "fal-ai/flux-pro/v1.1"
|
|
48
|
-
|
|
49
|
-
# video from url
|
|
50
|
-
bun run lib/fal.ts image_to_video "person talking" "https://image.url" 5
|
|
51
|
-
|
|
52
|
-
# video from local file (auto-uploads)
|
|
53
|
-
bun run lib/fal.ts image_to_video "ocean waves" "./media/beach.jpg" 10
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
**code:**
|
|
57
|
-
```typescript
|
|
58
|
-
import { imageToVideo } from "./lib/fal"
|
|
59
|
-
|
|
60
|
-
// works with both urls and local files
|
|
61
|
-
const result = await imageToVideo({
|
|
62
|
-
prompt: "person talking",
|
|
63
|
-
imageUrl: "./local/image.jpg", // or "https://..."
|
|
64
|
-
duration: 5,
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
// local files are automatically uploaded to fal storage
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## when to use which?
|
|
71
|
-
|
|
72
|
-
| use case | approach |
|
|
73
|
-
|----------|----------|
|
|
74
|
-
| standard image generation | ai-sdk provider ✓ |
|
|
75
|
-
| video generation | fal client direct ✓ |
|
|
76
|
-
| advanced fal features | fal client direct ✓ |
|
|
77
|
-
| multi-provider app | ai-sdk provider ✓ |
|
|
78
|
-
| custom queue handling | fal client direct ✓ |
|
|
79
|
-
|
|
80
|
-
## higgsfield.ts
|
|
81
|
-
|
|
82
|
-
uses `@higgsfield/client` for soul character generation
|
|
83
|
-
|
|
84
|
-
**features:**
|
|
85
|
-
- generate soul images with custom styles
|
|
86
|
-
- create and manage character references
|
|
87
|
-
- list available soul styles
|
|
88
|
-
- poll for job completion
|
|
89
|
-
|
|
90
|
-
**example:**
|
|
91
|
-
```bash
|
|
92
|
-
HF_API_KEY=xxx HF_API_SECRET=xxx bun run lib/higgsfield.ts generate_soul "professional headshot"
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## elevenlabs.ts
|
|
96
|
-
|
|
97
|
-
uses `@elevenlabs/elevenlabs-js` for voice, music, and sound effects generation
|
|
98
|
-
|
|
99
|
-
**features:**
|
|
100
|
-
- text-to-speech with multiple voices
|
|
101
|
-
- music generation from text prompts
|
|
102
|
-
- sound effects generation
|
|
103
|
-
- voice management
|
|
104
|
-
|
|
105
|
-
**examples:**
|
|
106
|
-
```bash
|
|
107
|
-
# text-to-speech
|
|
108
|
-
bun run lib/elevenlabs.ts tts "hello world" rachel output.mp3
|
|
109
|
-
|
|
110
|
-
# music generation
|
|
111
|
-
bun run lib/elevenlabs.ts music "upbeat electronic dance music" 30000 music.mp3
|
|
112
|
-
|
|
113
|
-
# sound effects
|
|
114
|
-
bun run lib/elevenlabs.ts sfx "ocean waves crashing" 5 waves.mp3
|
|
115
|
-
|
|
116
|
-
# list voices
|
|
117
|
-
bun run lib/elevenlabs.ts voices
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
**code:**
|
|
121
|
-
```typescript
|
|
122
|
-
import { textToSpeech, generateMusic, generateSoundEffect } from "./lib/elevenlabs"
|
|
123
|
-
|
|
124
|
-
// voice
|
|
125
|
-
const audio = await textToSpeech({
|
|
126
|
-
text: "hello world",
|
|
127
|
-
voiceId: "rachel",
|
|
128
|
-
outputPath: "output.mp3"
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
// music
|
|
132
|
-
const music = await generateMusic({
|
|
133
|
-
prompt: "epic orchestral music",
|
|
134
|
-
musicLengthMs: 60000,
|
|
135
|
-
outputPath: "music.mp3"
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
// sound effects
|
|
139
|
-
const sfx = await generateSoundEffect({
|
|
140
|
-
text: "thunder and rain",
|
|
141
|
-
durationSeconds: 10,
|
|
142
|
-
outputPath: "sfx.mp3"
|
|
143
|
-
})
|
|
144
|
-
```
|