vidspotai-shared 1.0.136 → 1.0.137
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/lib/libs/storage/cdnUrl.d.ts +1 -3
- package/lib/libs/storage/cdnUrl.d.ts.map +1 -1
- package/lib/libs/storage/cdnUrl.js +8 -6
- package/lib/services/aiGen/providers/bytedance/bytedance.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/bytedance/bytedance.service.js +17 -0
- package/lib/services/aiGen/providers/kling/klingRequests.d.ts.map +1 -1
- package/lib/services/aiGen/providers/kling/klingRequests.js +3 -0
- package/lib/services/aiGen/providers/types.d.ts +6 -0
- package/lib/services/aiGen/providers/types.d.ts.map +1 -1
- package/lib/services/index.d.ts +1 -0
- package/lib/services/index.d.ts.map +1 -1
- package/lib/services/index.js +1 -0
- package/lib/services/providerHealth.service.d.ts +12 -0
- package/lib/services/providerHealth.service.d.ts.map +1 -0
- package/lib/services/providerHealth.service.js +75 -0
- package/lib/services/translation/translation.service.d.ts +10 -1
- package/lib/services/translation/translation.service.d.ts.map +1 -1
- package/lib/services/translation/translation.service.js +34 -1
- package/lib/utils/errors.d.ts +3 -0
- package/lib/utils/errors.d.ts.map +1 -1
- package/lib/utils/errors.js +6 -0
- package/lib/utils/helpers.d.ts +1 -1
- package/lib/utils/helpers.d.ts.map +1 -1
- package/lib/utils/helpers.js +2 -1
- package/package.json +1 -1
- package/lib/globals/aiModels/providers/falVideo.d.ts +0 -34
- package/lib/globals/aiModels/providers/falVideo.d.ts.map +0 -1
- package/lib/globals/aiModels/providers/falVideo.js +0 -102
- package/lib/services/aiGen/providers/fal/falVideo.service.d.ts +0 -39
- package/lib/services/aiGen/providers/fal/falVideo.service.d.ts.map +0 -1
- package/lib/services/aiGen/providers/fal/falVideo.service.js +0 -266
|
@@ -78,9 +78,7 @@ export declare function fetchOwnMedia(url: string, init?: RequestInit): Promise<
|
|
|
78
78
|
*
|
|
79
79
|
* Always routes through the prod BUCKET token, in every env: the Worker only
|
|
80
80
|
* resolves `/gcs-pub/<that bucket>/`, and R2 keys carry no bucket name, so dev
|
|
81
|
-
* writes land in the same R2 namespace and resolve fine.
|
|
82
|
-
* URL (`storage.googleapis.com/vidspot-dev…`) is never rewritten by `cdn()`
|
|
83
|
-
* and 404s against GCS, which no longer holds the bytes.
|
|
81
|
+
* writes land in the same R2 namespace and resolve fine.
|
|
84
82
|
*/
|
|
85
83
|
export declare function publicCdnUrl(objectPath: string): string;
|
|
86
84
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdnUrl.d.ts","sourceRoot":"","sources":["../../../src/libs/storage/cdnUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"cdnUrl.d.ts","sourceRoot":"","sources":["../../../src/libs/storage/cdnUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAmBH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEnD;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,eAAe,CAAA;CAAE,GACtC,MAAM,CAeR;AAQD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,CAAC,EACR,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,eAAe,CAAA;CAA8B,GACjE,CAAC,CASH;AAQD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,eAAe,CAAA;CAA8B,GACjE,MAAM,CAER;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAEhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAGvD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAalD"}
|
|
@@ -22,7 +22,11 @@ exports.isOwnMediaUrl = isOwnMediaUrl;
|
|
|
22
22
|
const FIREBASE_STORAGE_HOST = "https://firebasestorage.googleapis.com";
|
|
23
23
|
const GCS_HOST = "https://storage.googleapis.com";
|
|
24
24
|
const BUCKET = "vidspot-firebase.firebasestorage.app";
|
|
25
|
-
|
|
25
|
+
// Every bucket the Worker serves (its SERVED_BUCKETS). The dev project mints
|
|
26
|
+
// dev-bucket-shaped URLs whose bytes live only in R2, so they must be
|
|
27
|
+
// rewritten too or they stay dead at their literal GCS address.
|
|
28
|
+
const SIGNED_BUCKETS = [BUCKET, "vidspot-dev.firebasestorage.app"];
|
|
29
|
+
const GCS_SIGNED_PREFIXES = SIGNED_BUCKETS.map((b) => `${GCS_HOST}/${b}/`);
|
|
26
30
|
function cdnBase() {
|
|
27
31
|
return (process.env.MEDIA_CDN_BASE ||
|
|
28
32
|
process.env.NEXT_PUBLIC_MEDIA_CDN_BASE ||
|
|
@@ -44,7 +48,7 @@ function toCdnUrl(url, opts) {
|
|
|
44
48
|
if (url.startsWith(FIREBASE_STORAGE_HOST)) {
|
|
45
49
|
return base + url.slice(FIREBASE_STORAGE_HOST.length);
|
|
46
50
|
}
|
|
47
|
-
if (url.startsWith(
|
|
51
|
+
if (GCS_SIGNED_PREFIXES.some((p) => url.startsWith(p))) {
|
|
48
52
|
const rest = url.slice(GCS_HOST.length); // "/<bucket>/<object>?<signed>"
|
|
49
53
|
const seg = opts?.visibility === "private" ? "gcs-priv" : "gcs-pub";
|
|
50
54
|
return `${base}/${seg}${rest}`;
|
|
@@ -82,7 +86,7 @@ function toCdnUrlsDeep(value, opts = { visibility: "private" }) {
|
|
|
82
86
|
return value;
|
|
83
87
|
}
|
|
84
88
|
const escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
|
|
85
|
-
const OWN_URL_IN_TEXT = new RegExp(`(?:${escapeRe
|
|
89
|
+
const OWN_URL_IN_TEXT = new RegExp(`(?:${[FIREBASE_STORAGE_HOST, ...GCS_SIGNED_PREFIXES].map(escapeRe).join("|")})[^\\s"'<>)\\]]+`, "g");
|
|
86
90
|
/**
|
|
87
91
|
* `toCdnUrl` for every one of our storage URLs embedded in free text (a tool
|
|
88
92
|
* result line like "• Video: <url>", an email body). Other text is untouched.
|
|
@@ -125,9 +129,7 @@ function fetchOwnMedia(url, init) {
|
|
|
125
129
|
*
|
|
126
130
|
* Always routes through the prod BUCKET token, in every env: the Worker only
|
|
127
131
|
* resolves `/gcs-pub/<that bucket>/`, and R2 keys carry no bucket name, so dev
|
|
128
|
-
* writes land in the same R2 namespace and resolve fine.
|
|
129
|
-
* URL (`storage.googleapis.com/vidspot-dev…`) is never rewritten by `cdn()`
|
|
130
|
-
* and 404s against GCS, which no longer holds the bytes.
|
|
132
|
+
* writes land in the same R2 namespace and resolve fine.
|
|
131
133
|
*/
|
|
132
134
|
function publicCdnUrl(objectPath) {
|
|
133
135
|
const encoded = objectPath.split("/").map(encodeURIComponent).join("/");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bytedance.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/bytedance/bytedance.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AA8BlB;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQlF;AAsBD,qBAAa,gBAAiB,SAAQ,wBAAwB;IAC5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CACsD;IAQ9E,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,WAAW;IAIb,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAyR3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"bytedance.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/bytedance/bytedance.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AA8BlB;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQlF;AAsBD,qBAAa,gBAAiB,SAAQ,wBAAwB;IAC5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CACsD;IAQ9E,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,WAAW;IAIb,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAyR3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA+JjD;;;;;;;;;;;OAWG;IACG,aAAa,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAyIlF,+EAA+E;YACjE,mBAAmB;IAoCjC;;;OAGG;YACW,eAAe;IAyD7B,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;CAsFjD"}
|
|
@@ -347,6 +347,17 @@ class ByteDanceService extends baseAiGenProvider_service_1.BaseAiGenProviderServ
|
|
|
347
347
|
errorMessage: "user_input_error: This model couldn't process your input image. Please re-save it as a standard JPEG or PNG (or use a different image) and try again.",
|
|
348
348
|
};
|
|
349
349
|
}
|
|
350
|
+
// Async "Invalid input image" — ModelArk accepted the task, then
|
|
351
|
+
// rejected the image itself. Seen on in-spec uploads (1080x2400 and
|
|
352
|
+
// 1080x646 JPEGs, prod 2026-10-31..11-02), so it's a content-level
|
|
353
|
+
// rejection of that image, not a request we built wrong. User-fixable,
|
|
354
|
+
// so don't page.
|
|
355
|
+
if (errCode === "InvalidParameter" && /invalid input image/i.test(errMessage)) {
|
|
356
|
+
return {
|
|
357
|
+
status: types_1.EVideoSceneStatus.FAILED,
|
|
358
|
+
errorMessage: "user_input_error: This model couldn't use your input image. Please try a different image, or pick another model, and try again.",
|
|
359
|
+
};
|
|
360
|
+
}
|
|
350
361
|
return {
|
|
351
362
|
status: types_1.EVideoSceneStatus.FAILED,
|
|
352
363
|
errorMessage: data.error
|
|
@@ -629,6 +640,12 @@ class ByteDanceService extends baseAiGenProvider_service_1.BaseAiGenProviderServ
|
|
|
629
640
|
if (resp.status === 400) {
|
|
630
641
|
throw new errors_1.UserFacingError(message, errors_1.USER_FACING_ERROR_CODES.CAPABILITY_MISMATCH);
|
|
631
642
|
}
|
|
643
|
+
// Model not activated on our Ark account (prod 2026-11-01, 5.0 Pro, HTTP
|
|
644
|
+
// 404). Same treatment as the video path: operator action, still pages
|
|
645
|
+
// via PROVIDER_AUTH_ERROR, but typed instead of a raw Error.
|
|
646
|
+
if (code === "ModelNotOpen" || code.startsWith("ModelNotOpen")) {
|
|
647
|
+
throw new errors_1.UserFacingError(`ByteDance model ${String(body.model)} is not activated on the Ark account: ${message}`, errors_1.USER_FACING_ERROR_CODES.PROVIDER_AUTH_ERROR);
|
|
648
|
+
}
|
|
632
649
|
throw new Error(`seedream images failed (${resp.status}): ${code} ${message}`);
|
|
633
650
|
}
|
|
634
651
|
getCreditUsed(params) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"klingRequests.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/kling/klingRequests.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,OAAO,EAGL,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAEhB,wBAAwB,EAExB,0BAA0B,EAE1B,wBAAwB,EACxB,mBAAmB,EAEnB,yBAAyB,EACzB,qBAAqB,EAGrB,iBAAiB,EACjB,oBAAoB,EAGpB,6BAA6B,EAI7B,4BAA4B,EAC5B,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AAcjB;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAgBjF;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,GACd,yBAAyB,GAAG,wBAAwB,CA+DtD;AAED,uEAAuE;AACvE,wBAAgB,eAAe,CAC7B,MAAM,EAAE,qBAAqB,GAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQzB;AAED,gFAAgF;AAChF,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,GACd,qBAAqB,CA+CvB;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,GACd,yBAAyB,
|
|
1
|
+
{"version":3,"file":"klingRequests.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/kling/klingRequests.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,q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MAAM,EAAE,qBAAqB,GAC5B,4BAA4B,GAAG,6BAA6B,CAoC9D;AAID;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,oBAAoB,CAKtB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,qBAAqB,GAAG,iBAAiB,CAkGpF;AAID,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAAuC,CAAC;AAExF;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,gBAAgB,CAKlB;AAcD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,qBAAqB,GAAG;IACnE,QAAQ,EAAE,cAAc,CAAC;IACzB,IAAI,EAAE,wBAAwB,GAAG,qBAAqB,CAAC;CACxD,CAmFA"}
|
|
@@ -196,6 +196,9 @@ function buildMotionControlBody(params, modelId) {
|
|
|
196
196
|
model_name: modelId,
|
|
197
197
|
image_url: params.inputImageUrl,
|
|
198
198
|
video_url: params.inputVideoUrl,
|
|
199
|
+
// Required by Kling — omitting it is rejected with 1201
|
|
200
|
+
// "character orientation must be specified".
|
|
201
|
+
character_orientation: params.characterOrientation ?? "image",
|
|
199
202
|
};
|
|
200
203
|
if (params.prompt)
|
|
201
204
|
body.prompt = params.prompt;
|
|
@@ -79,6 +79,12 @@ export interface VideoGenerationParams {
|
|
|
79
79
|
promptOptimizer?: boolean;
|
|
80
80
|
/** MiniMax Hailuo fast-pretreatment flag. */
|
|
81
81
|
fastPretreatment?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Kling motion control `character_orientation` (required by Kling): "image"
|
|
84
|
+
* keeps the character facing as in the image (3–10s), "video" follows the
|
|
85
|
+
* motion video (3–30s). Defaults to "image".
|
|
86
|
+
*/
|
|
87
|
+
characterOrientation?: "image" | "video";
|
|
82
88
|
motionMode?: "normal" | "fast";
|
|
83
89
|
style?: string;
|
|
84
90
|
templateId?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/services/aiGen/providers/types.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,iBAAiB,EACjB,aAAa,EACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEtE,MAAM,WAAW,qBAAqB;IAEpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,eAAe,CAAC;IAC1B,4FAA4F;IAC5F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,IAAI,CAAC,EAAE,eAAe,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;IAE7D;;;;;OAKG;IACH,QAAQ,CAAC,EACL,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,oBAAoB,GACpB,QAAQ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AE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mFAAmF;IACnF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,sFAAsF;IACtF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
package/lib/services/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./notification.service";
|
|
|
12
12
|
export * from "./credits/pricing";
|
|
13
13
|
export * from "./credits/unlimitedPlanImageLimiter";
|
|
14
14
|
export * from "./analytics.service";
|
|
15
|
+
export * from "./providerHealth.service";
|
|
15
16
|
export * from "./tts";
|
|
16
17
|
export * from "./translation";
|
|
17
18
|
export * from "./moderation";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,OAAO,CAAC;AACtB,cAA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;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,OAAO,CAAC;AACtB,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qCAAqC,CAAC;AACpD,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,6CAA6C,CAAC"}
|
package/lib/services/index.js
CHANGED
|
@@ -28,6 +28,7 @@ __exportStar(require("./notification.service"), exports);
|
|
|
28
28
|
__exportStar(require("./credits/pricing"), exports);
|
|
29
29
|
__exportStar(require("./credits/unlimitedPlanImageLimiter"), exports);
|
|
30
30
|
__exportStar(require("./analytics.service"), exports);
|
|
31
|
+
__exportStar(require("./providerHealth.service"), exports);
|
|
31
32
|
__exportStar(require("./tts"), exports);
|
|
32
33
|
__exportStar(require("./translation"), exports);
|
|
33
34
|
__exportStar(require("./moderation"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** How long a depletion blocks new jobs. Short on purpose — after a top-up
|
|
2
|
+
* the model comes back on its own within this window. */
|
|
3
|
+
export declare const PROVIDER_DEPLETION_WINDOW_MS: number;
|
|
4
|
+
/** Worker side: record that `modelKey`'s provider account is out of quota. */
|
|
5
|
+
export declare function markModelAccountDepleted(modelKey: string, code: string): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* API side: true while `modelKey` is inside a recorded depletion window.
|
|
8
|
+
* Cached per instance for READ_CACHE_MS; fails open (false) on read errors so
|
|
9
|
+
* a Firestore hiccup never blocks generation.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isModelAccountDepleted(modelKey: string): Promise<boolean>;
|
|
12
|
+
//# sourceMappingURL=providerHealth.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerHealth.service.d.ts","sourceRoot":"","sources":["../../src/services/providerHealth.service.ts"],"names":[],"mappings":"AAkBA;0DAC0D;AAC1D,eAAO,MAAM,4BAA4B,QAAc,CAAC;AAYxD,8EAA8E;AAC9E,wBAAsB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB5F;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAqB/E"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PROVIDER_DEPLETION_WINDOW_MS = void 0;
|
|
4
|
+
exports.markModelAccountDepleted = markModelAccountDepleted;
|
|
5
|
+
exports.isModelAccountDepleted = isModelAccountDepleted;
|
|
6
|
+
const firestore_1 = require("firebase-admin/firestore");
|
|
7
|
+
const firebase_1 = require("../libs/firebase");
|
|
8
|
+
const logger_1 = require("../utils/logger");
|
|
9
|
+
// Provider-account depletion breaker (2026-11-02).
|
|
10
|
+
//
|
|
11
|
+
// When a provider account runs dry (Kling 1102 "Account balance not enough",
|
|
12
|
+
// PixVerse quota, ...) every job for that model fails at submit until an
|
|
13
|
+
// operator tops up. Prod took ~25 kling-v4.0 jobs over four days that way:
|
|
14
|
+
// each one deducted credits, queued, failed in the worker, refunded, and
|
|
15
|
+
// paged Slack. The worker now records the depletion here; the API checks it
|
|
16
|
+
// before charging, so users get an immediate "pick another model" instead of
|
|
17
|
+
// a doomed job, and the pager fires about once per window instead of per job.
|
|
18
|
+
//
|
|
19
|
+
// Firestore rather than Redis: the API (Cloud Run, many instances) doesn't
|
|
20
|
+
// hold Redis clients and prod Redis has a ~30-client ceiling.
|
|
21
|
+
const COLLECTION = "providerHealth";
|
|
22
|
+
/** How long a depletion blocks new jobs. Short on purpose — after a top-up
|
|
23
|
+
* the model comes back on its own within this window. */
|
|
24
|
+
exports.PROVIDER_DEPLETION_WINDOW_MS = 10 * 60000;
|
|
25
|
+
const READ_CACHE_MS = 30000;
|
|
26
|
+
const readCache = new Map();
|
|
27
|
+
/** Worker side: record that `modelKey`'s provider account is out of quota. */
|
|
28
|
+
async function markModelAccountDepleted(modelKey, code) {
|
|
29
|
+
const until = Date.now() + exports.PROVIDER_DEPLETION_WINDOW_MS;
|
|
30
|
+
try {
|
|
31
|
+
const doc = {
|
|
32
|
+
modelKey,
|
|
33
|
+
depletedUntil: firestore_1.Timestamp.fromMillis(until),
|
|
34
|
+
code,
|
|
35
|
+
updatedAt: firestore_1.Timestamp.now(),
|
|
36
|
+
};
|
|
37
|
+
await firebase_1.firestore.collection(COLLECTION).doc(modelKey).set(doc);
|
|
38
|
+
readCache.set(modelKey, { at: Date.now(), depletedUntilMs: until });
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
// Best-effort: failing to record only loses the early rejection.
|
|
42
|
+
logger_1.logger.warn("providerHealth: failed to record depletion", {
|
|
43
|
+
modelKey,
|
|
44
|
+
err: err instanceof Error ? err.message : String(err),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* API side: true while `modelKey` is inside a recorded depletion window.
|
|
50
|
+
* Cached per instance for READ_CACHE_MS; fails open (false) on read errors so
|
|
51
|
+
* a Firestore hiccup never blocks generation.
|
|
52
|
+
*/
|
|
53
|
+
async function isModelAccountDepleted(modelKey) {
|
|
54
|
+
const now = Date.now();
|
|
55
|
+
const cached = readCache.get(modelKey);
|
|
56
|
+
if (!cached || now - cached.at > READ_CACHE_MS) {
|
|
57
|
+
try {
|
|
58
|
+
const snap = await firebase_1.firestore.collection(COLLECTION).doc(modelKey).get();
|
|
59
|
+
const data = snap.exists ? snap.data() : undefined;
|
|
60
|
+
readCache.set(modelKey, {
|
|
61
|
+
at: now,
|
|
62
|
+
depletedUntilMs: data?.depletedUntil ? data.depletedUntil.toMillis() : null,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
logger_1.logger.warn("providerHealth: read failed — treating model as available", {
|
|
67
|
+
modelKey,
|
|
68
|
+
err: err instanceof Error ? err.message : String(err),
|
|
69
|
+
});
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const until = readCache.get(modelKey)?.depletedUntilMs;
|
|
74
|
+
return !!until && until > now;
|
|
75
|
+
}
|
|
@@ -72,14 +72,23 @@ declare function pickCloseLanguage(text: string, candidates: {
|
|
|
72
72
|
code: string;
|
|
73
73
|
name: string;
|
|
74
74
|
}[], hint?: string): Promise<string>;
|
|
75
|
+
export declare const REQUEST_PATH_TRANSLATION_DEADLINE_MS = 15000;
|
|
76
|
+
/**
|
|
77
|
+
* `translate` with an overall deadline. On expiry throws
|
|
78
|
+
* Error(TRANSLATION_FAILED) — the same contract as both layers failing — so
|
|
79
|
+
* existing best-effort catch blocks fall back to the original text. The
|
|
80
|
+
* abandoned translation keeps running to completion in the background.
|
|
81
|
+
*/
|
|
82
|
+
declare function translateWithinDeadline(text: string, from: ELANGUAGE_CODE, to?: ELANGUAGE_CODE, deadlineMs?: number): Promise<string>;
|
|
75
83
|
export declare const translationService: {
|
|
76
84
|
translate: typeof translate;
|
|
85
|
+
translateWithinDeadline: typeof translateWithinDeadline;
|
|
77
86
|
detectLanguage: typeof detectLanguage;
|
|
78
87
|
pickCloseLanguage: typeof pickCloseLanguage;
|
|
79
88
|
};
|
|
80
89
|
/** @deprecated use `translationService.translate` */
|
|
81
90
|
export declare const getTranslationWrapper: typeof translate;
|
|
91
|
+
export { translateWithinDeadline };
|
|
82
92
|
/** @deprecated use `translationService.detectLanguage` */
|
|
83
93
|
export declare const detectLang: typeof detectLanguage;
|
|
84
|
-
export {};
|
|
85
94
|
//# sourceMappingURL=translation.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.service.d.ts","sourceRoot":"","sources":["../../../src/services/translation/translation.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIlE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAiDvD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAkB,GAAG,MAAM,EAAE,CA8BjF;AAuJD;;;;;;GAMG;AACH,iBAAe,SAAS,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,cAAc,EACpB,EAAE,GAAE,cAAkC,EACtC,OAAO,GAAE,IAAI,GAAG,IAAW,GAC1B,OAAO,CAAC,MAAM,CAAC,CAiBjB;AA+ID;;;;;;;;;;;;;;GAcG;AACH,iBAAe,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA8ChE;AA8BD;;;;;;;;;;GAUG;AACH,iBAAe,iBAAiB,CAC9B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,EAC5C,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,CAejB;
|
|
1
|
+
{"version":3,"file":"translation.service.d.ts","sourceRoot":"","sources":["../../../src/services/translation/translation.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIlE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAiDvD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAkB,GAAG,MAAM,EAAE,CA8BjF;AAuJD;;;;;;GAMG;AACH,iBAAe,SAAS,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,cAAc,EACpB,EAAE,GAAE,cAAkC,EACtC,OAAO,GAAE,IAAI,GAAG,IAAW,GAC1B,OAAO,CAAC,MAAM,CAAC,CAiBjB;AA+ID;;;;;;;;;;;;;;GAcG;AACH,iBAAe,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA8ChE;AA8BD;;;;;;;;;;GAUG;AACH,iBAAe,iBAAiB,CAC9B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,EAC5C,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,CAejB;AAYD,eAAO,MAAM,oCAAoC,QAAS,CAAC;AAE3D;;;;;GAKG;AACH,iBAAe,uBAAuB,CACpC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,cAAc,EACpB,EAAE,GAAE,cAAkC,EACtC,UAAU,GAAE,MAA6C,GACxD,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED,eAAO,MAAM,kBAAkB;;;;;CAK9B,CAAC;AAGF,qDAAqD;AACrD,eAAO,MAAM,qBAAqB,kBAAY,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,CAAC;AACnC,0DAA0D;AAC1D,eAAO,MAAM,UAAU,uBAAiB,CAAC"}
|
|
@@ -36,8 +36,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.detectLang = exports.getTranslationWrapper = exports.translationService = exports.TRANSLATION_FAILED = void 0;
|
|
39
|
+
exports.detectLang = exports.getTranslationWrapper = exports.translationService = exports.REQUEST_PATH_TRANSLATION_DEADLINE_MS = exports.TRANSLATION_FAILED = void 0;
|
|
40
40
|
exports.splitForTranslation = splitForTranslation;
|
|
41
|
+
exports.translateWithinDeadline = translateWithinDeadline;
|
|
41
42
|
const axios_1 = __importDefault(require("axios"));
|
|
42
43
|
const enums_1 = require("../../globals/aiModels/enums");
|
|
43
44
|
const types_1 = require("../../globals/types");
|
|
@@ -524,8 +525,40 @@ function errMsg(err) {
|
|
|
524
525
|
return err.stack ?? err.message;
|
|
525
526
|
return String(err);
|
|
526
527
|
}
|
|
528
|
+
// 2026-11-02: hedging bounds each chunk, but a long prompt is many chunks
|
|
529
|
+
// run CHUNK_CONCURRENCY at a time, so a uniformly slow primary still stacked
|
|
530
|
+
// into 37-41s on the generate path (prod `ru` / `vi`, ~10 chunks hedged in
|
|
531
|
+
// waves). Callers on a user-facing request path translate best-effort anyway
|
|
532
|
+
// (they keep the original prompt on TRANSLATION_FAILED), so cap the whole call.
|
|
533
|
+
exports.REQUEST_PATH_TRANSLATION_DEADLINE_MS = 15000;
|
|
534
|
+
/**
|
|
535
|
+
* `translate` with an overall deadline. On expiry throws
|
|
536
|
+
* Error(TRANSLATION_FAILED) — the same contract as both layers failing — so
|
|
537
|
+
* existing best-effort catch blocks fall back to the original text. The
|
|
538
|
+
* abandoned translation keeps running to completion in the background.
|
|
539
|
+
*/
|
|
540
|
+
async function translateWithinDeadline(text, from, to = types_1.ELANGUAGE_CODE.en, deadlineMs = exports.REQUEST_PATH_TRANSLATION_DEADLINE_MS) {
|
|
541
|
+
try {
|
|
542
|
+
return await withTimeout(translate(text, from, to), deadlineMs, "translation deadline");
|
|
543
|
+
}
|
|
544
|
+
catch (err) {
|
|
545
|
+
if (err instanceof Error && err.message === exports.TRANSLATION_FAILED)
|
|
546
|
+
throw err;
|
|
547
|
+
logger_1.logger.warn("translation: request-path deadline hit — caller keeps the original text", {
|
|
548
|
+
sourceLang: from,
|
|
549
|
+
targetLang: to,
|
|
550
|
+
deadlineMs,
|
|
551
|
+
chars: text.length,
|
|
552
|
+
err: errMsg(err),
|
|
553
|
+
});
|
|
554
|
+
const e = new Error(exports.TRANSLATION_FAILED);
|
|
555
|
+
e.cause = err;
|
|
556
|
+
throw e;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
527
559
|
exports.translationService = {
|
|
528
560
|
translate,
|
|
561
|
+
translateWithinDeadline,
|
|
529
562
|
detectLanguage,
|
|
530
563
|
pickCloseLanguage,
|
|
531
564
|
};
|
package/lib/utils/errors.d.ts
CHANGED
|
@@ -61,6 +61,9 @@ export declare const USER_FACING_ERROR_MESSAGES: Record<string, string>;
|
|
|
61
61
|
* codes. Duck-typed on `isUserFacingError` so it survives errors crossing a
|
|
62
62
|
* package-copy boundary (functions' npm shared vs the worker's workspace one).
|
|
63
63
|
*/
|
|
64
|
+
/** True for a UserFacingError code an operator must act on (see
|
|
65
|
+
* OPERATOR_ACTION_CODES) — e.g. to trip the provider-depletion breaker. */
|
|
66
|
+
export declare function isOperatorActionCode(code: string | undefined): boolean;
|
|
64
67
|
export declare function isQuietUserFacingError(err: unknown): boolean;
|
|
65
68
|
/** Friendly default for a code, or undefined if the code is unknown/unset. */
|
|
66
69
|
export declare function friendlyMessageForCode(code: string | undefined): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,iBAAiB,QAAQ;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;IAM1C,qEAAqE;IACrE,MAAM,IAAI;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAG7C;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;IASlC,2DAA2D;;IAE3D,+EAA+E;;;IAG/E,wFAAwF;;IAExF,qFAAqF;;IAErF,+FAA+F;;IAE/F,oGAAoG;;IAEpG,gGAAgG;;CAExF,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,uBAAuB,CAAC;AAEvE;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAiC7D,CAAC;AAWF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAK5D;AAED,8EAA8E;AAC9E,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAEnF;AAqBD;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,E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-1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.USER_FACING_ERROR_MESSAGES = exports.USER_FACING_ERROR_CODES = exports.UserFacingError = void 0;
|
|
4
|
+
exports.isOperatorActionCode = isOperatorActionCode;
|
|
4
5
|
exports.isQuietUserFacingError = isQuietUserFacingError;
|
|
5
6
|
exports.friendlyMessageForCode = friendlyMessageForCode;
|
|
6
7
|
exports.sanitizeUserFacingMessage = sanitizeUserFacingMessage;
|
|
@@ -94,6 +95,11 @@ const OPERATOR_ACTION_CODES = new Set([
|
|
|
94
95
|
* codes. Duck-typed on `isUserFacingError` so it survives errors crossing a
|
|
95
96
|
* package-copy boundary (functions' npm shared vs the worker's workspace one).
|
|
96
97
|
*/
|
|
98
|
+
/** True for a UserFacingError code an operator must act on (see
|
|
99
|
+
* OPERATOR_ACTION_CODES) — e.g. to trip the provider-depletion breaker. */
|
|
100
|
+
function isOperatorActionCode(code) {
|
|
101
|
+
return typeof code === "string" && OPERATOR_ACTION_CODES.has(code);
|
|
102
|
+
}
|
|
97
103
|
function isQuietUserFacingError(err) {
|
|
98
104
|
if (!err || typeof err !== "object")
|
|
99
105
|
return false;
|
package/lib/utils/helpers.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export declare const assertCostFound: (modelKey: string, cost: number | undefine
|
|
|
39
39
|
*/
|
|
40
40
|
export declare const MULTI_CLIP_DISCOUNT_FACTORS: Partial<Record<EVideoDurationType, number>>;
|
|
41
41
|
export declare function getMultiClipDiscountFactor(durationType: EVideoDurationType): number;
|
|
42
|
-
export { TRANSLATION_FAILED, getTranslationWrapper, detectLang, } from "../services/translation/translation.service";
|
|
42
|
+
export { TRANSLATION_FAILED, getTranslationWrapper, translateWithinDeadline, detectLang, } from "../services/translation/translation.service";
|
|
43
43
|
export declare function waitForFile(path: string, timeout?: number, interval?: number): Promise<boolean>;
|
|
44
44
|
export declare function generateAndValidate<T extends z.ZodS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MAAM,EAChB,MAAM,MAAM,GAAG,SAAS,EACxB,UAAU,MAAM,KACf,MASF,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B,EAAE,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAInF,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,kBAAkB,GAAG,MAAM,CAEnF;AAOD,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,GACX,MAAM,6CAA6C,CAAC;AAErD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,SAAQ,EACf,QAAQ,SAAM,oBAQf;AAGD,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE;IAC1E,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,SAAS,EAAE,CAAC,CAAC;IACb,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAGxB,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAgErB,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAatE"}
|
package/lib/utils/helpers.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.detectLang = exports.getTranslationWrapper = exports.TRANSLATION_FAILED = exports.MULTI_CLIP_DISCOUNT_FACTORS = exports.assertCostFound = exports.getCreditsFromCost = exports.getPriceIdByType = exports.getFreqById = exports.getPlanTypeById = void 0;
|
|
6
|
+
exports.detectLang = exports.translateWithinDeadline = exports.getTranslationWrapper = exports.TRANSLATION_FAILED = exports.MULTI_CLIP_DISCOUNT_FACTORS = exports.assertCostFound = exports.getCreditsFromCost = exports.getPriceIdByType = exports.getFreqById = exports.getPlanTypeById = void 0;
|
|
7
7
|
exports.getMultiClipDiscountFactor = getMultiClipDiscountFactor;
|
|
8
8
|
exports.waitForFile = waitForFile;
|
|
9
9
|
exports.generateAndValidate = generateAndValidate;
|
|
@@ -122,6 +122,7 @@ function getMultiClipDiscountFactor(durationType) {
|
|
|
122
122
|
var translation_service_1 = require("../services/translation/translation.service");
|
|
123
123
|
Object.defineProperty(exports, "TRANSLATION_FAILED", { enumerable: true, get: function () { return translation_service_1.TRANSLATION_FAILED; } });
|
|
124
124
|
Object.defineProperty(exports, "getTranslationWrapper", { enumerable: true, get: function () { return translation_service_1.getTranslationWrapper; } });
|
|
125
|
+
Object.defineProperty(exports, "translateWithinDeadline", { enumerable: true, get: function () { return translation_service_1.translateWithinDeadline; } });
|
|
125
126
|
Object.defineProperty(exports, "detectLang", { enumerable: true, get: function () { return translation_service_1.detectLang; } });
|
|
126
127
|
async function waitForFile(path, timeout = 10000, interval = 300) {
|
|
127
128
|
const start = Date.now();
|
package/package.json
CHANGED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { IModelSchema } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* fal.ai-HOSTED video generators — served by FalVideoService
|
|
4
|
-
* (services/aiGen/providers/fal/falVideo.service.ts) over fal's queue API.
|
|
5
|
-
*
|
|
6
|
-
* ─── Kling 4.0 / 4.0 Flash ────────────────────────────────────────────────
|
|
7
|
-
* Kling's native 4.0 API isn't available to us yet (kling.ai/dev/pricing
|
|
8
|
-
* 2026-10-27 lists it "Coming Soon"; resource packs don't cover it), so 4.0
|
|
9
|
-
* ships through fal. Endpoints (schemas pulled 2026-10-27 from
|
|
10
|
-
* fal.ai/api/openapi/queue/openapi.json?endpoint_id=…):
|
|
11
|
-
* fal-ai/kling-video/v4/text-to-video prompt|multi_prompt, 3–30s, 16:9/9:16/1:1/21:9, 720p|1080p
|
|
12
|
-
* fal-ai/kling-video/v4/image-to-video start_image_url (+end, ≤8 middle keyframes); ratio follows the frame
|
|
13
|
-
* fal-ai/kling-video/v4/reference-to-video ≤10 image_urls, ≤5 video_urls (30s total), @Image1/@Video1 citations
|
|
14
|
-
* fal-ai/kling-video/v4/flash/text-to-video 3–20s, 720p only
|
|
15
|
-
* fal-ai/kling-video/v4/flash/image-to-video
|
|
16
|
-
* `resolution` defaults to 1080p on fal — FalVideoService ALWAYS sends it so
|
|
17
|
-
* a std request can't silently bill at the 1080p rate.
|
|
18
|
-
* Native stereo audio is always on (no toggle) → listed in chains.ts AUDIO_MODELS
|
|
19
|
-
* rather than declaring an `audio` field.
|
|
20
|
-
*
|
|
21
|
-
* Pricing verified 2026-10-27 against https://api.fal.ai/v1/models/pricing:
|
|
22
|
-
* v4 text/image/reference-to-video $0.157 / output-second (720p base)
|
|
23
|
-
* v4 flash text/image-to-video $0.094 / output-second (720p only)
|
|
24
|
-
* 1080p = 1.5× (matches Kling's own preview units: 1.0 vs 1.5 units/s).
|
|
25
|
-
*
|
|
26
|
-
* Live-verified 2026-10-27 via FalVideoService: v4 text-to-video (5s 16:9
|
|
27
|
-
* 720p → 5.04s 1280x720 + stereo AAC, ~5 min) and v4 image-to-video (3s →
|
|
28
|
-
* 3.04s, ~6 min). The queue's status/result base is the OWNER app
|
|
29
|
-
* (`fal-ai/kling-video`), not the sub-endpoint — taken from status_url.
|
|
30
|
-
* With a reference VIDEO, fal (like Kling) bills 0.6× the rate on
|
|
31
|
-
* (output × 2) when input ≤ output, else (input + output) seconds.
|
|
32
|
-
*/
|
|
33
|
-
export declare const falVideoConfigs: Record<string, IModelSchema>;
|
|
34
|
-
//# sourceMappingURL=falVideo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"falVideo.d.ts","sourceRoot":"","sources":["../../../../src/globals/aiModels/providers/falVideo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAsExD,CAAC"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.falVideoConfigs = void 0;
|
|
4
|
-
const range = (min, max) => Array.from({ length: max - min + 1 }, (_, i) => min + i);
|
|
5
|
-
/**
|
|
6
|
-
* fal.ai-HOSTED video generators — served by FalVideoService
|
|
7
|
-
* (services/aiGen/providers/fal/falVideo.service.ts) over fal's queue API.
|
|
8
|
-
*
|
|
9
|
-
* ─── Kling 4.0 / 4.0 Flash ────────────────────────────────────────────────
|
|
10
|
-
* Kling's native 4.0 API isn't available to us yet (kling.ai/dev/pricing
|
|
11
|
-
* 2026-10-27 lists it "Coming Soon"; resource packs don't cover it), so 4.0
|
|
12
|
-
* ships through fal. Endpoints (schemas pulled 2026-10-27 from
|
|
13
|
-
* fal.ai/api/openapi/queue/openapi.json?endpoint_id=…):
|
|
14
|
-
* fal-ai/kling-video/v4/text-to-video prompt|multi_prompt, 3–30s, 16:9/9:16/1:1/21:9, 720p|1080p
|
|
15
|
-
* fal-ai/kling-video/v4/image-to-video start_image_url (+end, ≤8 middle keyframes); ratio follows the frame
|
|
16
|
-
* fal-ai/kling-video/v4/reference-to-video ≤10 image_urls, ≤5 video_urls (30s total), @Image1/@Video1 citations
|
|
17
|
-
* fal-ai/kling-video/v4/flash/text-to-video 3–20s, 720p only
|
|
18
|
-
* fal-ai/kling-video/v4/flash/image-to-video
|
|
19
|
-
* `resolution` defaults to 1080p on fal — FalVideoService ALWAYS sends it so
|
|
20
|
-
* a std request can't silently bill at the 1080p rate.
|
|
21
|
-
* Native stereo audio is always on (no toggle) → listed in chains.ts AUDIO_MODELS
|
|
22
|
-
* rather than declaring an `audio` field.
|
|
23
|
-
*
|
|
24
|
-
* Pricing verified 2026-10-27 against https://api.fal.ai/v1/models/pricing:
|
|
25
|
-
* v4 text/image/reference-to-video $0.157 / output-second (720p base)
|
|
26
|
-
* v4 flash text/image-to-video $0.094 / output-second (720p only)
|
|
27
|
-
* 1080p = 1.5× (matches Kling's own preview units: 1.0 vs 1.5 units/s).
|
|
28
|
-
*
|
|
29
|
-
* Live-verified 2026-10-27 via FalVideoService: v4 text-to-video (5s 16:9
|
|
30
|
-
* 720p → 5.04s 1280x720 + stereo AAC, ~5 min) and v4 image-to-video (3s →
|
|
31
|
-
* 3.04s, ~6 min). The queue's status/result base is the OWNER app
|
|
32
|
-
* (`fal-ai/kling-video`), not the sub-endpoint — taken from status_url.
|
|
33
|
-
* With a reference VIDEO, fal (like Kling) bills 0.6× the rate on
|
|
34
|
-
* (output × 2) when input ≤ output, else (input + output) seconds.
|
|
35
|
-
*/
|
|
36
|
-
exports.falVideoConfigs = {
|
|
37
|
-
"fal-kling-v4.0": {
|
|
38
|
-
modelId: "fal-ai/kling-video/v4",
|
|
39
|
-
type: ["text-to-video", "image-to-video"],
|
|
40
|
-
tier: "T3",
|
|
41
|
-
fields: {
|
|
42
|
-
prompt: { required: true },
|
|
43
|
-
aspectRatio: { allowedValues: ["16:9", "9:16", "1:1", "21:9"] },
|
|
44
|
-
// Every integer 3–30 is legal; billed per delivered second.
|
|
45
|
-
duration: { allowedValues: range(3, 30), default: 5 },
|
|
46
|
-
// std→720p, pro→1080p (Kling's own equivalence). Explicit resolution wins.
|
|
47
|
-
mode: { allowedValues: ["std", "pro"] },
|
|
48
|
-
resolution: { allowedValues: ["720p", "1080p"], default: "720p" },
|
|
49
|
-
inputImageUrl: {}, // → start_image_url
|
|
50
|
-
lastFrameImageUrl: {}, // → end_image_url
|
|
51
|
-
referenceImageUrls: { max: 10 }, // → reference-to-video image_urls (@Image1…)
|
|
52
|
-
referenceVideoUrls: { max: 5 }, // → reference-to-video video_urls (@Video1…)
|
|
53
|
-
multiShot: {}, // → multi_prompt[] (≤512 chars/shot)
|
|
54
|
-
},
|
|
55
|
-
concurrentRequests: 5,
|
|
56
|
-
pollIntervalMs: 10000,
|
|
57
|
-
// 30s 1080p generations run long on fal's queue.
|
|
58
|
-
pollTimeoutMs: 30 * 60000,
|
|
59
|
-
cost: {
|
|
60
|
-
perSecondByResolution: { "720p": 0.157, "1080p": 0.2355 },
|
|
61
|
-
videoInputPerSecondByResolution: { "720p": 0.0942, "1080p": 0.1413 },
|
|
62
|
-
},
|
|
63
|
-
guidance: {
|
|
64
|
-
quality: 5,
|
|
65
|
-
speed: 3,
|
|
66
|
-
bestFor: "Kling's newest flagship: long single takes up to 30s, native stereo audio, up to 10 keyframes, and Omni reference (10 images + 5 videos cited as @Image1/@Video1). Best Kling for cinematic, multi-shot storytelling.",
|
|
67
|
-
notes: "Audio is always on and included in the price. 1080p costs 1.5× 720p. A reference video bills on input+output seconds. No 4K yet.",
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
// GATED 2026-10-27: a live smoke test of both fal Flash endpoints
|
|
71
|
-
// (flash/text-to-video 3s 9:16, flash/image-to-video 3s) returned fal's
|
|
72
|
-
// canned schema-example clips (12s, 16:9, byte-identical file sizes
|
|
73
|
-
// 3478246 / 2953131) instead of a generation — Flash isn't really live on
|
|
74
|
-
// fal yet. Set KLING_V4_FLASH_LIVE=true (Doppler + Railway) only after a
|
|
75
|
-
// re-test returns a real clip at the requested duration/ratio.
|
|
76
|
-
"fal-kling-v4.0-flash": {
|
|
77
|
-
modelId: "fal-ai/kling-video/v4/flash",
|
|
78
|
-
type: ["text-to-video", "image-to-video"],
|
|
79
|
-
tier: "T2",
|
|
80
|
-
gatedByEnv: "KLING_V4_FLASH_LIVE",
|
|
81
|
-
fields: {
|
|
82
|
-
prompt: { required: true },
|
|
83
|
-
aspectRatio: { allowedValues: ["16:9", "9:16", "1:1", "21:9"] },
|
|
84
|
-
duration: { allowedValues: range(3, 20), default: 5 },
|
|
85
|
-
mode: { allowedValues: ["std"] },
|
|
86
|
-
resolution: { allowedValues: ["720p"], default: "720p" },
|
|
87
|
-
inputImageUrl: {}, // → start_image_url
|
|
88
|
-
},
|
|
89
|
-
concurrentRequests: 5,
|
|
90
|
-
pollIntervalMs: 10000,
|
|
91
|
-
pollTimeoutMs: 20 * 60000,
|
|
92
|
-
cost: {
|
|
93
|
-
perSecondByResolution: { "720p": 0.094 },
|
|
94
|
-
},
|
|
95
|
-
guidance: {
|
|
96
|
-
quality: 4,
|
|
97
|
-
speed: 5,
|
|
98
|
-
bestFor: "Fast, budget Kling 4.0: text or image to video up to 20s with native audio at 720p. Great for drafts, social clips and high-volume B-roll.",
|
|
99
|
-
notes: "720p only, no end frame or references. About 40% cheaper than Kling 4.0.",
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { EVideoMode } from "../../types";
|
|
2
|
-
import { BaseAiGenProviderService } from "../baseAiGenProvider.service";
|
|
3
|
-
import { CreditUsageParams, VideoGenerationParams, VideoGenerationResult, VideoStatusParams, VideoStatusResult } from "../types";
|
|
4
|
-
/**
|
|
5
|
-
* Output resolution actually sent to fal. An explicit, allowed `resolution`
|
|
6
|
-
* wins; otherwise mode maps std→720p, pro→1080p (Kling's own equivalence).
|
|
7
|
-
* Flash is 720p-only. Exported so billing prices the SAME resolution the
|
|
8
|
-
* request carried — fal's default is 1080p, so never leave it implicit.
|
|
9
|
-
*/
|
|
10
|
-
export declare function resolveFalKlingResolution(modelKey: string, resolution?: string, mode?: EVideoMode | string): "720p" | "1080p";
|
|
11
|
-
/**
|
|
12
|
-
* Generic fal.ai video-generation provider. Today it serves Kling 4.0 and
|
|
13
|
-
* Kling 4.0 Flash (configs in globals/aiModels/providers/falVideo.ts), routing
|
|
14
|
-
* each request to the matching fal sub-endpoint:
|
|
15
|
-
* reference images/videos → v4/reference-to-video (not on Flash)
|
|
16
|
-
* a start frame → v4[/flash]/image-to-video
|
|
17
|
-
* otherwise → v4[/flash]/text-to-video
|
|
18
|
-
*
|
|
19
|
-
* The stored task is `<queue app path>|<request_id>`: fal's queue
|
|
20
|
-
* status/result URLs depend on the app path, which differs per sub-endpoint,
|
|
21
|
-
* so the poller needs it back. The path is taken from the submit response's
|
|
22
|
-
* `status_url` when present (fal's own canonical form), else the endpoint id.
|
|
23
|
-
*/
|
|
24
|
-
export declare class FalVideoService extends BaseAiGenProviderService {
|
|
25
|
-
private readonly apiKey;
|
|
26
|
-
constructor();
|
|
27
|
-
private headers;
|
|
28
|
-
private buildRequest;
|
|
29
|
-
generateVideo(params: VideoGenerationParams): Promise<VideoGenerationResult>;
|
|
30
|
-
checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult>;
|
|
31
|
-
/**
|
|
32
|
-
* Per second at the resolution the request sends. With a reference video
|
|
33
|
-
* fal/Kling bill a lower rate on (output × 2) when the input is no longer
|
|
34
|
-
* than the output, else (input + output) seconds. An unknown input length
|
|
35
|
-
* falls back to output × 2 (the input ≤ output case).
|
|
36
|
-
*/
|
|
37
|
-
getCreditUsed({ modelKey, mode, resolution, duration, multiClip, inputType, hasInputVideo, inputVideoDurationSec, creditFloor, }: CreditUsageParams): number;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=falVideo.service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"falVideo.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/fal/falVideo.service.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAoClB;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,GACzB,MAAM,GAAG,OAAO,CAKlB;AAsBD;;;;;;;;;;;;GAYG;AACH,qBAAa,eAAgB,SAAQ,wBAAwB;IAC3D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;;IAUhC,OAAO,CAAC,OAAO;IAMf,OAAO,CAAC,YAAY;IA6Dd,aAAa,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA0C5E,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAsDjD;;;;;OAKG;IACH,aAAa,CAAC,EACZ,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,QAAY,EACZ,SAAiB,EACjB,SAAS,EACT,aAAa,EACb,qBAAqB,EACrB,WAAW,GACZ,EAAE,iBAAiB,GAAG,MAAM;CAwB9B"}
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FalVideoService = void 0;
|
|
4
|
-
exports.resolveFalKlingResolution = resolveFalKlingResolution;
|
|
5
|
-
const aiModels_1 = require("../../../../globals/aiModels");
|
|
6
|
-
const types_1 = require("../../../../globals/types");
|
|
7
|
-
const storage_1 = require("../../../../libs/storage");
|
|
8
|
-
const errors_1 = require("../../../../utils/errors");
|
|
9
|
-
const helpers_1 = require("../../../../utils/helpers");
|
|
10
|
-
const logger_1 = require("../../../../utils/logger");
|
|
11
|
-
const transientRetry_1 = require("../../transientRetry");
|
|
12
|
-
const types_2 = require("../../types");
|
|
13
|
-
const baseAiGenProvider_service_1 = require("../baseAiGenProvider.service");
|
|
14
|
-
const falUpscale_service_1 = require("./falUpscale.service");
|
|
15
|
-
const QUEUE_BASE_URL = "https://queue.fal.run";
|
|
16
|
-
/** Separator between the queue app path and the request id in the stored task. */
|
|
17
|
-
const TASK_SEP = "|";
|
|
18
|
-
/** fal v4 multi_prompt per-shot cap (KlingV4Shot.prompt maxLength). */
|
|
19
|
-
const SHOT_PROMPT_MAX = 512;
|
|
20
|
-
/** fal v4 `prompt` maxLength. */
|
|
21
|
-
const PROMPT_MAX = 26000;
|
|
22
|
-
const FLASH_KEYS = new Set([aiModels_1.EVideoGenModels.FAL_KLING_V4_0_FLASH]);
|
|
23
|
-
/**
|
|
24
|
-
* Output resolution actually sent to fal. An explicit, allowed `resolution`
|
|
25
|
-
* wins; otherwise mode maps std→720p, pro→1080p (Kling's own equivalence).
|
|
26
|
-
* Flash is 720p-only. Exported so billing prices the SAME resolution the
|
|
27
|
-
* request carried — fal's default is 1080p, so never leave it implicit.
|
|
28
|
-
*/
|
|
29
|
-
function resolveFalKlingResolution(modelKey, resolution, mode) {
|
|
30
|
-
if (FLASH_KEYS.has(modelKey))
|
|
31
|
-
return "720p";
|
|
32
|
-
const r = resolution?.toLowerCase();
|
|
33
|
-
if (r === "720p" || r === "1080p")
|
|
34
|
-
return r;
|
|
35
|
-
return mode === types_2.EVideoMode.PROFESSIONAL ? "1080p" : "720p";
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Canonical shots → fal `multi_prompt[]`. Missing per-shot durations split
|
|
39
|
-
* the requested total evenly (integers, ≥1s each); the clip length fal
|
|
40
|
-
* renders is the sum of the shot durations.
|
|
41
|
-
*/
|
|
42
|
-
function toFalShots(shots, totalDuration) {
|
|
43
|
-
const missing = shots.filter((s) => !s.duration).length;
|
|
44
|
-
const declared = shots.reduce((sum, s) => sum + (s.duration ?? 0), 0);
|
|
45
|
-
const fill = missing > 0 ? Math.max(1, Math.floor((totalDuration - declared) / missing)) : 0;
|
|
46
|
-
return shots.map((s, i) => {
|
|
47
|
-
if (s.prompt.length > SHOT_PROMPT_MAX) {
|
|
48
|
-
throw new errors_1.UserFacingError(`Shot ${i + 1} prompt is ${s.prompt.length} characters; Kling 4.0 allows ${SHOT_PROMPT_MAX} per shot.`, errors_1.USER_FACING_ERROR_CODES.PROMPT_TOO_LONG);
|
|
49
|
-
}
|
|
50
|
-
return { prompt: s.prompt, duration: Math.max(1, Math.round(s.duration ?? fill)) };
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Generic fal.ai video-generation provider. Today it serves Kling 4.0 and
|
|
55
|
-
* Kling 4.0 Flash (configs in globals/aiModels/providers/falVideo.ts), routing
|
|
56
|
-
* each request to the matching fal sub-endpoint:
|
|
57
|
-
* reference images/videos → v4/reference-to-video (not on Flash)
|
|
58
|
-
* a start frame → v4[/flash]/image-to-video
|
|
59
|
-
* otherwise → v4[/flash]/text-to-video
|
|
60
|
-
*
|
|
61
|
-
* The stored task is `<queue app path>|<request_id>`: fal's queue
|
|
62
|
-
* status/result URLs depend on the app path, which differs per sub-endpoint,
|
|
63
|
-
* so the poller needs it back. The path is taken from the submit response's
|
|
64
|
-
* `status_url` when present (fal's own canonical form), else the endpoint id.
|
|
65
|
-
*/
|
|
66
|
-
class FalVideoService extends baseAiGenProvider_service_1.BaseAiGenProviderService {
|
|
67
|
-
constructor() {
|
|
68
|
-
super();
|
|
69
|
-
if (!process.env.FAL_KEY) {
|
|
70
|
-
throw new Error("Missing FAL_KEY in environment variables");
|
|
71
|
-
}
|
|
72
|
-
this.apiKey = process.env.FAL_KEY;
|
|
73
|
-
}
|
|
74
|
-
headers(json) {
|
|
75
|
-
const h = { Authorization: `Key ${this.apiKey}` };
|
|
76
|
-
if (json)
|
|
77
|
-
h["Content-Type"] = "application/json";
|
|
78
|
-
return h;
|
|
79
|
-
}
|
|
80
|
-
buildRequest(params) {
|
|
81
|
-
const modelKey = params.modelKey;
|
|
82
|
-
const config = aiModels_1.aiModelConfigs[modelKey];
|
|
83
|
-
if (!config?.modelId) {
|
|
84
|
-
throw new Error(`FalVideoService: no fal model config for "${modelKey}"`);
|
|
85
|
-
}
|
|
86
|
-
const isFlash = FLASH_KEYS.has(modelKey);
|
|
87
|
-
const refImages = params.referenceImageUrls?.filter(Boolean) ?? [];
|
|
88
|
-
const refVideos = params.referenceVideoUrls?.filter(Boolean) ?? [];
|
|
89
|
-
let endpoint;
|
|
90
|
-
if (refImages.length > 0 || refVideos.length > 0) {
|
|
91
|
-
if (isFlash) {
|
|
92
|
-
throw new errors_1.UserFacingError("Kling 4.0 Flash doesn't take reference images or videos — use Kling 4.0 for Omni reference.", errors_1.USER_FACING_ERROR_CODES.CAPABILITY_MISMATCH);
|
|
93
|
-
}
|
|
94
|
-
endpoint = "reference-to-video";
|
|
95
|
-
}
|
|
96
|
-
else if (params.inputImageUrl) {
|
|
97
|
-
endpoint = "image-to-video";
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
endpoint = "text-to-video";
|
|
101
|
-
}
|
|
102
|
-
const duration = Math.round(params.duration ?? 5);
|
|
103
|
-
const body = {
|
|
104
|
-
resolution: resolveFalKlingResolution(modelKey, params.resolution, params.mode),
|
|
105
|
-
};
|
|
106
|
-
if (params.multiShot && params.multiShot.length > 0 && !isFlash) {
|
|
107
|
-
body.multi_prompt = toFalShots(params.multiShot, duration);
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
const prompt = params.prompt ?? "";
|
|
111
|
-
if (prompt.length > PROMPT_MAX) {
|
|
112
|
-
throw new errors_1.UserFacingError(`Prompt is ${prompt.length} characters; Kling 4.0 allows ${PROMPT_MAX}.`, errors_1.USER_FACING_ERROR_CODES.PROMPT_TOO_LONG);
|
|
113
|
-
}
|
|
114
|
-
body.prompt = prompt;
|
|
115
|
-
body.duration = duration;
|
|
116
|
-
}
|
|
117
|
-
if (endpoint === "text-to-video") {
|
|
118
|
-
if (params.aspectRatio)
|
|
119
|
-
body.aspect_ratio = params.aspectRatio;
|
|
120
|
-
}
|
|
121
|
-
else if (endpoint === "image-to-video") {
|
|
122
|
-
// Output ratio follows the start frame — fal's i2v takes no aspect_ratio.
|
|
123
|
-
body.start_image_url = params.inputImageUrl;
|
|
124
|
-
if (params.lastFrameImageUrl && !isFlash)
|
|
125
|
-
body.end_image_url = params.lastFrameImageUrl;
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
if (refImages.length > 0)
|
|
129
|
-
body.image_urls = refImages.slice(0, 10);
|
|
130
|
-
if (refVideos.length > 0)
|
|
131
|
-
body.video_urls = refVideos.slice(0, 5);
|
|
132
|
-
if (params.inputImageUrl)
|
|
133
|
-
body.start_image_url = params.inputImageUrl;
|
|
134
|
-
if (params.lastFrameImageUrl)
|
|
135
|
-
body.end_image_url = params.lastFrameImageUrl;
|
|
136
|
-
body.aspect_ratio = params.aspectRatio ?? "auto";
|
|
137
|
-
}
|
|
138
|
-
return { endpointId: `${config.modelId}/${endpoint}`, body };
|
|
139
|
-
}
|
|
140
|
-
async generateVideo(params) {
|
|
141
|
-
const { endpointId, body } = this.buildRequest(params);
|
|
142
|
-
return (0, transientRetry_1.withTransientRetry)("fal:generateVideo", async () => {
|
|
143
|
-
const resp = await fetch(`${QUEUE_BASE_URL}/${endpointId}`, {
|
|
144
|
-
method: "POST",
|
|
145
|
-
headers: this.headers(true),
|
|
146
|
-
body: JSON.stringify(body),
|
|
147
|
-
});
|
|
148
|
-
if (!resp.ok) {
|
|
149
|
-
throw (0, falUpscale_service_1.classifyFalHttpError)(resp.status, await resp.text(), "generateVideo");
|
|
150
|
-
}
|
|
151
|
-
const data = (await resp.json());
|
|
152
|
-
if (!data.request_id) {
|
|
153
|
-
throw new Error(`fal ${endpointId} did not return a request_id`);
|
|
154
|
-
}
|
|
155
|
-
const appPath = appPathFromStatusUrl(data.status_url) ?? endpointId;
|
|
156
|
-
logger_1.logger.info("fal video submitted", {
|
|
157
|
-
modelKey: params.modelKey,
|
|
158
|
-
endpointId,
|
|
159
|
-
appPath,
|
|
160
|
-
requestId: data.request_id,
|
|
161
|
-
});
|
|
162
|
-
return {
|
|
163
|
-
status: types_1.EVideoSceneStatus.TRIGGERED,
|
|
164
|
-
task: `${appPath}${TASK_SEP}${data.request_id}`,
|
|
165
|
-
};
|
|
166
|
-
}, {
|
|
167
|
-
onRetry: ({ attempt, maxAttempts, backoffMs, err }) => logger_1.logger.warn("fal generateVideo transient error — retrying", {
|
|
168
|
-
attempt,
|
|
169
|
-
maxAttempts,
|
|
170
|
-
backoffMs,
|
|
171
|
-
message: err.message,
|
|
172
|
-
}),
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
async checkVideoStatus({ task, outputFilename, outputFilePath = "videos", }) {
|
|
176
|
-
const sep = task.lastIndexOf(TASK_SEP);
|
|
177
|
-
if (sep <= 0) {
|
|
178
|
-
return { status: types_1.EVideoSceneStatus.FAILED, errorMessage: `Malformed fal video task "${task}"` };
|
|
179
|
-
}
|
|
180
|
-
const appPath = task.slice(0, sep);
|
|
181
|
-
const requestId = task.slice(sep + 1);
|
|
182
|
-
const statusResp = await fetch(`${QUEUE_BASE_URL}/${appPath}/requests/${requestId}/status`, {
|
|
183
|
-
headers: this.headers(false),
|
|
184
|
-
});
|
|
185
|
-
if (!statusResp.ok) {
|
|
186
|
-
throw (0, falUpscale_service_1.classifyFalHttpError)(statusResp.status, await statusResp.text(), "checkVideoStatus");
|
|
187
|
-
}
|
|
188
|
-
const statusData = (await statusResp.json());
|
|
189
|
-
const normalized = (statusData.status ?? "").toUpperCase();
|
|
190
|
-
// fal reports a failed job as COMPLETED + `error` — no separate FAILED state.
|
|
191
|
-
if (normalized === "COMPLETED" && statusData.error) {
|
|
192
|
-
return { status: types_1.EVideoSceneStatus.FAILED, errorMessage: statusData.error };
|
|
193
|
-
}
|
|
194
|
-
if (normalized !== "COMPLETED") {
|
|
195
|
-
return { status: types_1.EVideoSceneStatus.PENDING };
|
|
196
|
-
}
|
|
197
|
-
const resultResp = await fetch(`${QUEUE_BASE_URL}/${appPath}/requests/${requestId}`, {
|
|
198
|
-
headers: this.headers(false),
|
|
199
|
-
});
|
|
200
|
-
if (!resultResp.ok) {
|
|
201
|
-
const text = await resultResp.text();
|
|
202
|
-
// A 4xx on the result (e.g. 422 validation / content checker) is the
|
|
203
|
-
// job's terminal failure, not a transport problem — fail the scene.
|
|
204
|
-
if (resultResp.status >= 400 && resultResp.status < 500 && ![401, 403, 429].includes(resultResp.status)) {
|
|
205
|
-
return { status: types_1.EVideoSceneStatus.FAILED, errorMessage: `fal video failed (${resultResp.status}): ${text.slice(0, 500)}` };
|
|
206
|
-
}
|
|
207
|
-
throw (0, falUpscale_service_1.classifyFalHttpError)(resultResp.status, text, "checkVideoStatus:result");
|
|
208
|
-
}
|
|
209
|
-
const result = (await resultResp.json());
|
|
210
|
-
if (!result.video?.url) {
|
|
211
|
-
const detail = typeof result.detail === "string" ? result.detail : JSON.stringify(result.detail ?? "");
|
|
212
|
-
return { status: types_1.EVideoSceneStatus.FAILED, errorMessage: result.error ?? (detail || "fal video returned no output") };
|
|
213
|
-
}
|
|
214
|
-
const assetResp = await fetch(result.video.url);
|
|
215
|
-
if (!assetResp.ok) {
|
|
216
|
-
// Throw (not FAILED) so the outer poller retries — the video exists.
|
|
217
|
-
throw new Error(`Failed to download fal video: ${assetResp.status}`);
|
|
218
|
-
}
|
|
219
|
-
const buffer = Buffer.from(await assetResp.arrayBuffer());
|
|
220
|
-
// mediaStorage: GCS write + best-effort R2 mirror (zero-egress delivery).
|
|
221
|
-
const signedUrl = await storage_1.mediaStorage.put(`${outputFilePath}/${outputFilename}.mp4`, buffer, "video/mp4");
|
|
222
|
-
return { status: types_1.EVideoSceneStatus.COMPLETED, videoUrl: signedUrl };
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Per second at the resolution the request sends. With a reference video
|
|
226
|
-
* fal/Kling bill a lower rate on (output × 2) when the input is no longer
|
|
227
|
-
* than the output, else (input + output) seconds. An unknown input length
|
|
228
|
-
* falls back to output × 2 (the input ≤ output case).
|
|
229
|
-
*/
|
|
230
|
-
getCreditUsed({ modelKey, mode, resolution, duration = 5, multiClip = false, inputType, hasInputVideo, inputVideoDurationSec, creditFloor, }) {
|
|
231
|
-
const cost = aiModels_1.aiModelConfigs[modelKey]?.cost;
|
|
232
|
-
const res = resolveFalKlingResolution(modelKey, resolution, mode);
|
|
233
|
-
const applyFloor = !multiClip;
|
|
234
|
-
if (inputType === "video" || hasInputVideo) {
|
|
235
|
-
const rate = cost?.videoInputPerSecondByResolution?.[res];
|
|
236
|
-
if (rate !== undefined) {
|
|
237
|
-
const inputSec = inputVideoDurationSec ?? duration;
|
|
238
|
-
const billedSec = inputSec <= duration ? duration * 2 : inputSec + duration;
|
|
239
|
-
return (0, helpers_1.getCreditsFromCost)(rate * billedSec, applyFloor, creditFloor);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
const perSecond = cost?.perSecondByResolution?.[res];
|
|
243
|
-
if (perSecond === undefined) {
|
|
244
|
-
logger_1.logger.warn(`fal video getCreditUsed: no cost for modelKey="${modelKey}" res="${res}" — returning fallback`, {
|
|
245
|
-
modelKey,
|
|
246
|
-
res,
|
|
247
|
-
});
|
|
248
|
-
return (0, helpers_1.getCreditsFromCost)(0.2355 * duration, applyFloor, creditFloor);
|
|
249
|
-
}
|
|
250
|
-
return (0, helpers_1.getCreditsFromCost)(perSecond * duration, applyFloor, creditFloor);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
exports.FalVideoService = FalVideoService;
|
|
254
|
-
/** "https://queue.fal.run/fal-ai/kling-video/requests/<id>/status" → "fal-ai/kling-video". */
|
|
255
|
-
function appPathFromStatusUrl(statusUrl) {
|
|
256
|
-
if (!statusUrl)
|
|
257
|
-
return undefined;
|
|
258
|
-
try {
|
|
259
|
-
const path = new URL(statusUrl).pathname.replace(/^\/+/, "");
|
|
260
|
-
const idx = path.indexOf("/requests/");
|
|
261
|
-
return idx > 0 ? path.slice(0, idx) : undefined;
|
|
262
|
-
}
|
|
263
|
-
catch {
|
|
264
|
-
return undefined;
|
|
265
|
-
}
|
|
266
|
-
}
|