@mevdragon/vidfarm-devcli 0.2.7 → 0.2.9
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/.env.example +9 -0
- package/GETTING_STARTED.developers.md +1 -30
- package/README.md +22 -5
- package/SKILL.developer.md +464 -12
- package/auto-create-templates/AUTO_CREATE_TEMPLATES.md +475 -0
- package/auto-create-templates/extractor-system-prompt.md +113 -0
- package/auto-create-templates/production-graph.schema.json +276 -0
- package/auto-create-templates/runbook.md +140 -0
- package/auto-create-templates/template-plan.schema.json +230 -0
- package/auto-create-templates/template-planner-prompt.md +75 -0
- package/dist/src/account-pages-legacy.js +9064 -0
- package/dist/src/account-pages.js +41 -620
- package/dist/src/app.js +7173 -494
- package/dist/src/cli.js +525 -29
- package/dist/src/config.js +14 -7
- package/dist/src/context.js +51 -35
- package/dist/src/db.js +1049 -55
- package/dist/src/dev-app-legacy.js +693 -0
- package/dist/src/dev-app.js +4 -904
- package/dist/src/domain.js +1 -1
- package/dist/src/editor-chat-history.js +72 -0
- package/dist/src/editor-chat.js +202 -0
- package/dist/src/frontend/flockposter-cache-store.js +116 -0
- package/dist/src/frontend/homepage-client.js +114 -0
- package/dist/src/frontend/homepage-shared.js +3 -0
- package/dist/src/frontend/homepage-store.js +27 -0
- package/dist/src/frontend/homepage-view.js +147 -0
- package/dist/src/frontend/page-runtime-client.js +100 -0
- package/dist/src/frontend/page-runtime-store.js +8 -0
- package/dist/src/frontend/template-editor-chat.js +2261 -0
- package/dist/src/homepage.js +695 -339
- package/dist/src/lib/template-paths.js +10 -4
- package/dist/src/lib/template-style-options.js +95 -15
- package/dist/src/page-runtime.js +1 -0
- package/dist/src/page-shell.js +941 -0
- package/dist/src/primitive-context.js +163 -0
- package/dist/src/primitive-registry.js +340 -0
- package/dist/src/primitive-sdk.js +3 -0
- package/dist/src/primitives/remotion/html-image.js +28 -0
- package/dist/src/react-page-shell.js +34 -0
- package/dist/src/ready-post-schedule-component.js +1514 -0
- package/dist/src/registry.js +44 -18
- package/dist/src/runtime.js +6 -1
- package/dist/src/services/api-call-history.js +245 -0
- package/dist/src/services/auth.js +27 -9
- package/dist/src/services/billing.js +248 -9
- package/dist/src/services/chat-threads.js +88 -0
- package/dist/src/services/job-logs.js +10 -3
- package/dist/src/services/jobs.js +13 -2
- package/dist/src/services/providers.js +944 -55
- package/dist/src/services/rate-limits.js +236 -0
- package/dist/src/services/remotion.js +143 -16
- package/dist/src/services/storage.js +23 -8
- package/dist/src/services/template-certification.js +26 -3
- package/dist/src/services/template-loader.js +19 -1
- package/dist/src/services/template-sources.js +316 -7
- package/dist/src/template-editor-pages.js +2309 -0
- package/dist/src/template-editor-shell.js +1507 -0
- package/dist/src/worker.js +120 -22
- package/package.json +30 -6
- package/public/assets/homepage-app.js +54 -0
- package/public/assets/homepage-client-app.js +54 -0
- package/public/assets/page-runtime-client-app.js +68 -0
- package/dist/templates/template_0000/src/lib/images.js +0 -202
- package/dist/templates/template_0000/src/remotion/Root.js +0 -33
- package/dist/templates/template_0000/src/remotion/index.js +0 -3
- package/dist/templates/template_0000/src/sdk.js +0 -3
- package/dist/templates/template_0000/src/style-options.js +0 -51
- package/dist/templates/template_0000/src/template-dna.js +0 -9
- package/dist/templates/template_0000/src/template.js +0 -1441
- package/templates/template_0000/README.md +0 -77
- package/templates/template_0000/SKILL.md +0 -225
- package/templates/template_0000/assets/Abel-Regular.ttf +0 -0
- package/templates/template_0000/assets/DMSerifDisplay-Regular.ttf +0 -0
- package/templates/template_0000/assets/Montserrat[wght].ttf +0 -0
- package/templates/template_0000/assets/SourceCodePro[wght].ttf +0 -0
- package/templates/template_0000/assets/TikTokSans-SemiBold.ttf +0 -0
- package/templates/template_0000/assets/Yesteryear-Regular.ttf +0 -0
- package/templates/template_0000/composition.json +0 -11
- package/templates/template_0000/package.json +0 -28
- package/templates/template_0000/research/preview/.gitkeep +0 -1
- package/templates/template_0000/research/source_notes.md +0 -7
- package/templates/template_0000/src/lib/images.js +0 -202
- package/templates/template_0000/src/lib/images.ts +0 -241
- package/templates/template_0000/src/remotion/Root.js +0 -33
- package/templates/template_0000/src/remotion/Root.tsx +0 -75
- package/templates/template_0000/src/remotion/index.js +0 -3
- package/templates/template_0000/src/remotion/index.tsx +0 -4
- package/templates/template_0000/src/sdk.js +0 -3
- package/templates/template_0000/src/sdk.ts +0 -122
- package/templates/template_0000/src/style-options.js +0 -51
- package/templates/template_0000/src/style-options.ts +0 -60
- package/templates/template_0000/src/template-dna.js +0 -9
- package/templates/template_0000/src/template-dna.ts +0 -15
- package/templates/template_0000/src/template.js +0 -1441
- package/templates/template_0000/src/template.ts +0 -2042
- package/templates/template_0000/template.config.json +0 -21
- package/templates/template_0000/tsconfig.json +0 -19
package/dist/src/config.js
CHANGED
|
@@ -12,7 +12,7 @@ const schema = z.object({
|
|
|
12
12
|
API_KEY_SALT: z.string().default("development-api-key-salt"),
|
|
13
13
|
WORKER_POLL_MS: z.coerce.number().default(1500),
|
|
14
14
|
WORKER_BATCH_SIZE: z.coerce.number().default(2),
|
|
15
|
-
WORKER_MAX_CONCURRENT_JOBS: z.coerce.number().default(
|
|
15
|
+
WORKER_MAX_CONCURRENT_JOBS: z.coerce.number().default(2),
|
|
16
16
|
WEBHOOK_SECRET: z.string().default("development-webhook-secret"),
|
|
17
17
|
DEFAULT_JOB_DELAY_SECONDS: z.coerce.number().default(20),
|
|
18
18
|
MAX_PENDING_JOBS_GLOBAL: z.coerce.number().default(0),
|
|
@@ -25,13 +25,22 @@ const schema = z.object({
|
|
|
25
25
|
AWS_ACCESS_KEY_ID: z.string().optional(),
|
|
26
26
|
AWS_SECRET_ACCESS_KEY: z.string().optional(),
|
|
27
27
|
PUBLIC_BASE_URL: z.string().optional(),
|
|
28
|
+
PUBLIC_EDITOR_CHAT_URL: z.string().url().optional(),
|
|
29
|
+
EDITOR_CHAT_URL: z.string().url().optional(),
|
|
28
30
|
RESEND_API_KEY: z.string().optional(),
|
|
29
31
|
RESEND_FROM_EMAIL: z.string().default("vidfarm@fwd.zoomgtm.com"),
|
|
32
|
+
FLOCKPOSTER_API_URL: z.string().url().optional(),
|
|
33
|
+
VIDFARM_ZIP_LAMBDA_URL: z.string().url().optional(),
|
|
34
|
+
VIDFARM_ZIP_LAMBDA_SECRET: z.string().optional(),
|
|
35
|
+
VIDFARM_BILLING_URL: z.string().url().optional(),
|
|
36
|
+
VIDFARM_BILLING_SECRET: z.string().optional(),
|
|
37
|
+
VIDFARM_MIN_RENDER_WALLET_BALANCE_USD: z.coerce.number().default(1),
|
|
30
38
|
OPENAI_API_KEY: z.string().optional(),
|
|
31
39
|
OPENROUTER_API_KEY: z.string().optional(),
|
|
32
40
|
GEMINI_API_KEY: z.string().optional(),
|
|
33
41
|
PERPLEXITY_API_KEY: z.string().optional(),
|
|
34
42
|
SUPERAGENCY_KEY: z.string().optional(),
|
|
43
|
+
ARTIFACT_SIGNING_SECRET: z.string().optional(),
|
|
35
44
|
REMOTION_REGION: z.string().default("us-east-1"),
|
|
36
45
|
REMOTION_BUCKET_NAME: z.string().optional(),
|
|
37
46
|
REMOTION_SITE_NAME: z.string().optional(),
|
|
@@ -43,10 +52,10 @@ const schema = z.object({
|
|
|
43
52
|
REMOTION_MODE: z.enum(["auto", "mock", "local", "lambda"]).default("auto"),
|
|
44
53
|
MOCK_PROVIDER_RESPONSES: z.string().optional(),
|
|
45
54
|
VIDFARM_ADMIN_EMAILS: z.string().default(""),
|
|
46
|
-
VIDFARM_DEVELOPER_EMAILS: z.string().default(""),
|
|
47
55
|
VIDFARM_GITHUB_TOKEN: z.string().optional(),
|
|
48
56
|
GITHUB_TOKEN: z.string().optional(),
|
|
49
|
-
TEMPLATE_SOURCE_ROOT: z.string().default("./data/template-sources")
|
|
57
|
+
TEMPLATE_SOURCE_ROOT: z.string().default("./data/template-sources"),
|
|
58
|
+
VIDFARM_RATE_LIMITS_TABLE_NAME: z.string().optional()
|
|
50
59
|
});
|
|
51
60
|
const parsed = schema.parse(process.env);
|
|
52
61
|
const dataDir = path.resolve(parsed.VIDFARM_DATA_DIR);
|
|
@@ -60,16 +69,14 @@ export const config = {
|
|
|
60
69
|
VIDFARM_DATA_DIR: dataDir,
|
|
61
70
|
TEMPLATE_SOURCE_ROOT: templateSourceRoot,
|
|
62
71
|
PUBLIC_BASE_URL: publicBaseUrl,
|
|
72
|
+
ARTIFACT_SIGNING_SECRET: parsed.ARTIFACT_SIGNING_SECRET || parsed.SUPERAGENCY_KEY || "",
|
|
63
73
|
isProduction: parsed.NODE_ENV === "production",
|
|
64
74
|
mockProviders: parsed.MOCK_PROVIDER_RESPONSES === "true" ||
|
|
65
75
|
(parsed.MOCK_PROVIDER_RESPONSES == null && parsed.NODE_ENV !== "production"),
|
|
66
76
|
s3PublicRead: parsed.AWS_S3_PUBLIC_READ === "true",
|
|
77
|
+
minRenderWalletBalanceUsd: parsed.VIDFARM_MIN_RENDER_WALLET_BALANCE_USD,
|
|
67
78
|
adminEmails: parsed.VIDFARM_ADMIN_EMAILS
|
|
68
79
|
.split(",")
|
|
69
80
|
.map((value) => value.trim().toLowerCase())
|
|
70
81
|
.filter(Boolean),
|
|
71
|
-
developerEmails: parsed.VIDFARM_DEVELOPER_EMAILS
|
|
72
|
-
.split(",")
|
|
73
|
-
.map((value) => value.trim().toLowerCase())
|
|
74
|
-
.filter(Boolean)
|
|
75
82
|
};
|
package/dist/src/context.js
CHANGED
|
@@ -5,12 +5,7 @@ import { jobLogStore } from "./services/job-logs.js";
|
|
|
5
5
|
export function createTemplateJobContext(input) {
|
|
6
6
|
const templateConfig = database.getTemplateConfig(input.customer.id, input.template.id);
|
|
7
7
|
const prefix = input.storage.templateJobPrefix(input.template.id, input.customer.id, input.job.id);
|
|
8
|
-
const buildArtifactUrl = (storageKey, fallbackUrl) =>
|
|
9
|
-
if (config.STORAGE_DRIVER !== "s3") {
|
|
10
|
-
return fallbackUrl;
|
|
11
|
-
}
|
|
12
|
-
return `${config.PUBLIC_BASE_URL}/template-media?key=${encodeURIComponent(storageKey)}`;
|
|
13
|
-
};
|
|
8
|
+
const buildArtifactUrl = (storageKey, fallbackUrl) => fallbackUrl ?? input.storage.getPublicUrl(storageKey);
|
|
14
9
|
return {
|
|
15
10
|
env: config.isProduction ? "production" : "development",
|
|
16
11
|
customer: input.customer,
|
|
@@ -97,15 +92,6 @@ export function createTemplateJobContext(input) {
|
|
|
97
92
|
const stored = await input.storage.putJson(`${prefix}/${key}`, value);
|
|
98
93
|
const artifactUrl = buildArtifactUrl(stored.key, stored.url);
|
|
99
94
|
insertArtifact("json", stored.key, artifactUrl, {});
|
|
100
|
-
await input.billing.record({
|
|
101
|
-
customerId: input.customer.id,
|
|
102
|
-
jobId: input.job.id,
|
|
103
|
-
templateId: input.template.id,
|
|
104
|
-
type: "storage_write",
|
|
105
|
-
costUsd: 0.005,
|
|
106
|
-
chargeUsd: 0.01,
|
|
107
|
-
metadata: { key: stored.key }
|
|
108
|
-
});
|
|
109
95
|
return {
|
|
110
96
|
...stored,
|
|
111
97
|
url: artifactUrl
|
|
@@ -115,15 +101,6 @@ export function createTemplateJobContext(input) {
|
|
|
115
101
|
const stored = await input.storage.putText(`${prefix}/${key}`, value, contentType);
|
|
116
102
|
const artifactUrl = buildArtifactUrl(stored.key, stored.url);
|
|
117
103
|
insertArtifact("text", stored.key, artifactUrl, { contentType });
|
|
118
|
-
await input.billing.record({
|
|
119
|
-
customerId: input.customer.id,
|
|
120
|
-
jobId: input.job.id,
|
|
121
|
-
templateId: input.template.id,
|
|
122
|
-
type: "storage_write",
|
|
123
|
-
costUsd: 0.005,
|
|
124
|
-
chargeUsd: 0.01,
|
|
125
|
-
metadata: { key: stored.key }
|
|
126
|
-
});
|
|
127
104
|
return {
|
|
128
105
|
...stored,
|
|
129
106
|
url: artifactUrl
|
|
@@ -136,15 +113,6 @@ export function createTemplateJobContext(input) {
|
|
|
136
113
|
...(options.metadata ?? {}),
|
|
137
114
|
contentType: options.contentType ?? null
|
|
138
115
|
});
|
|
139
|
-
await input.billing.record({
|
|
140
|
-
customerId: input.customer.id,
|
|
141
|
-
jobId: input.job.id,
|
|
142
|
-
templateId: input.template.id,
|
|
143
|
-
type: "storage_write",
|
|
144
|
-
costUsd: 0.005,
|
|
145
|
-
chargeUsd: 0.01,
|
|
146
|
-
metadata: { key: stored.key }
|
|
147
|
-
});
|
|
148
116
|
return {
|
|
149
117
|
...stored,
|
|
150
118
|
url: artifactUrl
|
|
@@ -159,15 +127,22 @@ export function createTemplateJobContext(input) {
|
|
|
159
127
|
await input.billing.record({
|
|
160
128
|
customerId: input.customer.id,
|
|
161
129
|
jobId: input.job.id,
|
|
130
|
+
tracer: input.job.tracer,
|
|
162
131
|
templateId: input.template.id,
|
|
163
132
|
type: record.type,
|
|
164
133
|
costUsd: record.costUsd,
|
|
165
|
-
chargeUsd: record.chargeUsd ?? Number((record.costUsd * 2).toFixed(4)),
|
|
134
|
+
chargeUsd: record.chargeUsd ?? Number((record.costUsd * 1.2).toFixed(4)),
|
|
135
|
+
costCenterSlug: record.costCenterSlug,
|
|
136
|
+
idempotencyKey: record.idempotencyKey,
|
|
137
|
+
occurredAtMs: record.occurredAtMs,
|
|
166
138
|
metadata: record.metadata
|
|
167
139
|
});
|
|
168
140
|
}
|
|
169
141
|
},
|
|
170
142
|
providers: {
|
|
143
|
+
listAvailableProviders() {
|
|
144
|
+
return input.providers.listAvailableProviders(input.customer.id);
|
|
145
|
+
},
|
|
171
146
|
async generateText(request) {
|
|
172
147
|
return input.providers.generateText({
|
|
173
148
|
customerId: input.customer.id,
|
|
@@ -176,6 +151,14 @@ export function createTemplateJobContext(input) {
|
|
|
176
151
|
...request
|
|
177
152
|
});
|
|
178
153
|
},
|
|
154
|
+
async generateSpeech(request) {
|
|
155
|
+
return input.providers.generateSpeech({
|
|
156
|
+
customerId: input.customer.id,
|
|
157
|
+
jobId: input.job.id,
|
|
158
|
+
workerId: input.workerId,
|
|
159
|
+
...request
|
|
160
|
+
});
|
|
161
|
+
},
|
|
179
162
|
async generateImage(request) {
|
|
180
163
|
return input.providers.generateImage({
|
|
181
164
|
customerId: input.customer.id,
|
|
@@ -191,14 +174,47 @@ export function createTemplateJobContext(input) {
|
|
|
191
174
|
workerId: input.workerId,
|
|
192
175
|
...request
|
|
193
176
|
});
|
|
177
|
+
},
|
|
178
|
+
async transcribeSpeech(request) {
|
|
179
|
+
return input.providers.transcribeSpeech({
|
|
180
|
+
customerId: input.customer.id,
|
|
181
|
+
jobId: input.job.id,
|
|
182
|
+
workerId: input.workerId,
|
|
183
|
+
...request
|
|
184
|
+
});
|
|
194
185
|
}
|
|
195
186
|
},
|
|
196
187
|
remotion: {
|
|
197
188
|
async render(request) {
|
|
198
|
-
|
|
189
|
+
const render = await input.remotion.render({
|
|
199
190
|
...request,
|
|
200
191
|
outputKey: request.outputKey ? `${prefix}/${request.outputKey}` : undefined
|
|
201
192
|
});
|
|
193
|
+
const estimatedCostUsd = "estimatedCostUsd" in render.metadata ? render.metadata.estimatedCostUsd : null;
|
|
194
|
+
const chargeUsd = "chargeUsd" in render.metadata ? render.metadata.chargeUsd : null;
|
|
195
|
+
if (render.metadata.mode === "lambda" && typeof estimatedCostUsd === "number" && estimatedCostUsd > 0) {
|
|
196
|
+
await input.billing.record({
|
|
197
|
+
customerId: input.customer.id,
|
|
198
|
+
jobId: input.job.id,
|
|
199
|
+
tracer: input.job.tracer,
|
|
200
|
+
templateId: input.template.id,
|
|
201
|
+
type: "render",
|
|
202
|
+
costUsd: estimatedCostUsd,
|
|
203
|
+
chargeUsd: typeof chargeUsd === "number" ? chargeUsd : undefined,
|
|
204
|
+
costCenterSlug: "remotion_lambda",
|
|
205
|
+
idempotencyKey: `remotion_lambda:${render.renderId}`,
|
|
206
|
+
occurredAtMs: Date.now(),
|
|
207
|
+
metadata: {
|
|
208
|
+
...render.metadata,
|
|
209
|
+
render_id: render.renderId,
|
|
210
|
+
output_url: render.outputUrl,
|
|
211
|
+
composition_id: typeof render.metadata.compositionId === "string"
|
|
212
|
+
? render.metadata.compositionId
|
|
213
|
+
: request.compositionId,
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
return render;
|
|
202
218
|
}
|
|
203
219
|
}
|
|
204
220
|
};
|