vidspotai-shared 1.0.81 → 1.0.82-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../../src/globals/aiModels/providers/google.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../../src/globals/aiModels/providers/google.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,CA8SpE,CAAC"}
|
|
@@ -37,7 +37,14 @@ exports.googleConfigs = {
|
|
|
37
37
|
6: ["720p"],
|
|
38
38
|
8: ["720p", "1080p", "4k"],
|
|
39
39
|
},
|
|
40
|
-
|
|
40
|
+
// Gemini Developer API paid Tier 2 ceiling (verified 2026-06-09 via
|
|
41
|
+
// aistudio.google.com/rate-limit): 4 req/min, ~50/day per Veo model on the
|
|
42
|
+
// shared `predict_long_running_requests_per_model` quota. The previous `50`
|
|
43
|
+
// was fictional (Google 429s long before that). NOTE: the real binding
|
|
44
|
+
// constraint in prod is the DAILY cap (~50/model/day) which this per-minute
|
|
45
|
+
// limiter does not model — watch for it under load. Raise after a tier-3
|
|
46
|
+
// upgrade / quota increase.
|
|
47
|
+
requestPerMin: 4,
|
|
41
48
|
cost: {
|
|
42
49
|
// Vertex: $0.40/s @ 720p/1080p, $0.60/s @ 4k.
|
|
43
50
|
perResolution: { "720p": 0.40, "1080p": 0.40, "4k": 0.60 },
|
|
@@ -73,7 +80,8 @@ exports.googleConfigs = {
|
|
|
73
80
|
6: ["720p"],
|
|
74
81
|
8: ["720p", "1080p"],
|
|
75
82
|
},
|
|
76
|
-
|
|
83
|
+
// Tier 2 ceiling: 4 RPM / ~50 RPD per model (see veo-3.1 note above).
|
|
84
|
+
requestPerMin: 4,
|
|
77
85
|
cost: {
|
|
78
86
|
perResolution: { "720p": 0.10, "1080p": 0.12 },
|
|
79
87
|
},
|
|
@@ -107,7 +115,8 @@ exports.googleConfigs = {
|
|
|
107
115
|
6: ["720p"],
|
|
108
116
|
8: ["720p", "1080p"],
|
|
109
117
|
},
|
|
110
|
-
|
|
118
|
+
// Tier 2 ceiling: 4 RPM / ~50 RPD per model (see veo-3.1 note above).
|
|
119
|
+
requestPerMin: 4,
|
|
111
120
|
cost: {
|
|
112
121
|
perResolution: { "720p": 0.05, "1080p": 0.08 },
|
|
113
122
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/google/google.service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"google.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/google/google.service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AA2MlB,qBAAa,aAAc,SAAQ,wBAAwB;IACzD,OAAO,CAAC,EAAE,CAAc;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAK;;IAO/C;;;;OAIG;YACW,kBAAkB;IA+B1B,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAyG3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAoG3C,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;YAiBnB,cAAc;IAwG5B;;;;;;OAMG;IACG,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAqEjC,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAY,EAAE,UAAmB,EAAE,SAAiB,EAAE,SAAa,EAAE,SAAS,EAAE,EAAE,iBAAiB,GAAG,MAAM;CA8BvI"}
|
|
@@ -151,6 +151,33 @@ function classifyGoogleApiError(err) {
|
|
|
151
151
|
/(filtered out because they violated|violated Google's (?:Responsible AI|content) (?:practices|policies))/i.test(msg)) {
|
|
152
152
|
return new errors_1.UserFacingError("Your prompt was flagged by Google's safety filters. Please rephrase and try again.", errors_1.USER_FACING_ERROR_CODES.CONTENT_POLICY_VIOLATION);
|
|
153
153
|
}
|
|
154
|
+
// Generic INVALID_ARGUMENT 400 on a provided string field. Veo echoes the
|
|
155
|
+
// offending value back ("The string value `<prompt>` ...") and the only
|
|
156
|
+
// large free-text field we send is the prompt, so attribute this to the
|
|
157
|
+
// prompt: it's either over the model's length limit or otherwise rejected
|
|
158
|
+
// by the validator. Either way it's user input, not a platform bug —
|
|
159
|
+
// surface a typed, actionable, non-retryable error (logged warn, no Slack
|
|
160
|
+
// page) instead of leaking the echoed prompt into the error channel.
|
|
161
|
+
if ((status === "INVALID_ARGUMENT" || httpCode === 400) &&
|
|
162
|
+
/string value/i.test(msg)) {
|
|
163
|
+
const tooLong = /(exceed|too long|maximum length|length limit|\blimit\b)/i.test(msg);
|
|
164
|
+
return tooLong
|
|
165
|
+
? new errors_1.UserFacingError("Your prompt is too long for this model. Please shorten it and try again.", errors_1.USER_FACING_ERROR_CODES.PROMPT_TOO_LONG)
|
|
166
|
+
: new errors_1.UserFacingError("Your prompt was rejected by the model. Please simplify or rephrase it and try again.", errors_1.USER_FACING_ERROR_CODES.PROMPT_INVALID);
|
|
167
|
+
}
|
|
168
|
+
// gRPC code 13 = INTERNAL. Veo returns this for transient backend failures
|
|
169
|
+
// ("Video generation failed due to an internal server issue. Please try
|
|
170
|
+
// again in a few minutes."). It is NOT our bug and NOT moderation — a
|
|
171
|
+
// Google-side flake. Surface as a transient PROVIDER_UNAVAILABLE so the
|
|
172
|
+
// user gets a "try again" message and it logs warn (Loki) instead of
|
|
173
|
+
// paging Slack as a platform error. (Egregiously-blocked content that Veo
|
|
174
|
+
// masks as code 13 also lands here; we can't distinguish it from a real
|
|
175
|
+
// internal flake, and "try again" is an acceptable fallback message.)
|
|
176
|
+
if (httpCode === 13 ||
|
|
177
|
+
status === "INTERNAL" ||
|
|
178
|
+
/internal (server|error)/i.test(msg)) {
|
|
179
|
+
return new errors_1.UserFacingError("Google's video service had a temporary problem. Please try again in a few minutes.", errors_1.USER_FACING_ERROR_CODES.PROVIDER_UNAVAILABLE);
|
|
180
|
+
}
|
|
154
181
|
}
|
|
155
182
|
catch {
|
|
156
183
|
// Not JSON — fall through to non-JSON checks.
|
|
@@ -284,9 +311,19 @@ class GoogleService extends baseAiGenProvider_service_1.BaseAiGenProviderService
|
|
|
284
311
|
const result = await this.withTransientRetry("getVideosOperation", () => this.ai.operations.getVideosOperation({ operation }));
|
|
285
312
|
if (result.done) {
|
|
286
313
|
if (result.error) {
|
|
314
|
+
// A long-running operation can finish with an error (e.g. gRPC 13
|
|
315
|
+
// INTERNAL) instead of throwing. Route it through the same classifier
|
|
316
|
+
// as thrown API errors so transient INTERNAL and invalid-prompt
|
|
317
|
+
// failures get a typed `{code, message}` (which sceneMonitor demotes to
|
|
318
|
+
// warn) instead of leaking raw gRPC JSON that pages Slack as a bug.
|
|
319
|
+
const classified = classifyGoogleApiError({
|
|
320
|
+
message: JSON.stringify(result.error),
|
|
321
|
+
});
|
|
287
322
|
return {
|
|
288
323
|
status: types_1.EVideoSceneStatus.FAILED,
|
|
289
|
-
errorMessage:
|
|
324
|
+
errorMessage: classified
|
|
325
|
+
? JSON.stringify(classified.toJSON())
|
|
326
|
+
: JSON.stringify(result.error),
|
|
290
327
|
};
|
|
291
328
|
}
|
|
292
329
|
const videoUri = result.response?.generatedVideos?.[0]?.video?.uri;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vidspotai-shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.82-dev.0",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -13,10 +13,6 @@
|
|
|
13
13
|
"files": [
|
|
14
14
|
"lib"
|
|
15
15
|
],
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "tsc -p tsconfig.json",
|
|
18
|
-
"watch": "tsc -p tsconfig.json --watch"
|
|
19
|
-
},
|
|
20
16
|
"dependencies": {
|
|
21
17
|
"@anthropic-ai/sdk": "^0.98.0",
|
|
22
18
|
"@google-cloud/storage": "*",
|
|
@@ -47,5 +43,9 @@
|
|
|
47
43
|
"peerDependencies": {
|
|
48
44
|
"firebase-admin": "^13.5.0",
|
|
49
45
|
"ioredis": "^5.8.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsc -p tsconfig.json",
|
|
49
|
+
"watch": "tsc -p tsconfig.json --watch"
|
|
50
50
|
}
|
|
51
|
-
}
|
|
51
|
+
}
|