vidspotai-shared 1.0.66 → 1.0.68

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.
@@ -3,4 +3,34 @@ export * from "./types";
3
3
  import { TAiGenModel } from "./enums";
4
4
  import { IModelSchema } from "./types";
5
5
  export declare const aiModelConfigs: Record<TAiGenModel, IModelSchema>;
6
+ export interface IProviderRateLimit {
7
+ concurrentRequests?: number;
8
+ requestPerMin?: number;
9
+ requestPerDay?: number;
10
+ }
11
+ /**
12
+ * Per-provider rate limits applied IN ADDITION TO any per-model limits.
13
+ * Use this when a provider documents a single bucket shared across multiple
14
+ * models (e.g. Minimax: 5 RPM across all Hailuo Video Generation models).
15
+ *
16
+ * The rate-limit factory composes the matching provider limiter as a parent
17
+ * of the model limiter — both buckets must have a free slot before a request
18
+ * proceeds, and both are reserved/released atomically.
19
+ *
20
+ * Keyed by the prefix segment of the modelKey (everything before the first
21
+ * "-"). If a provider exposes multiple APIs with different shared buckets
22
+ * (e.g. Minimax video 5 RPM vs Minimax LLM 500 RPM), split into a separate
23
+ * key here and stop using the prefix-based default for that group.
24
+ */
25
+ export declare const aiProviderRateLimits: Record<string, IProviderRateLimit>;
26
+ /**
27
+ * Returns the provider key for a given modelKey — everything before the first
28
+ * "-". Used both for provider-level rate-limit lookups and for detecting
29
+ * cross-provider task mismatches (a scene whose `task` was issued by provider
30
+ * X should never be polled with provider Y after a modelKey swap).
31
+ *
32
+ * Matches the prefix convention used in EVideoGenModels / ETextGenModels.
33
+ * E.g. "minimax-hailuo-2.3" → "minimax", "google-veo-3.1-lite" → "google".
34
+ */
35
+ export declare function getProviderKey(modelKey: string): string;
6
36
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/globals/aiModels/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAUvC,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,YAAY,CAQvB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/globals/aiModels/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAUvC,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,YAAY,CAQvB,CAAC;AAEvC,MAAM,WAAW,kBAAkB;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAMnE,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEvD"}
@@ -14,7 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.aiModelConfigs = void 0;
17
+ exports.aiProviderRateLimits = exports.aiModelConfigs = void 0;
18
+ exports.getProviderKey = getProviderKey;
18
19
  __exportStar(require("./enums"), exports);
19
20
  __exportStar(require("./types"), exports);
20
21
  const pixverse_1 = require("./providers/pixverse");
@@ -33,3 +34,36 @@ exports.aiModelConfigs = {
33
34
  ...minimax_1.minimaxConfigs,
34
35
  ...openai_1.openaiConfigs,
35
36
  };
37
+ /**
38
+ * Per-provider rate limits applied IN ADDITION TO any per-model limits.
39
+ * Use this when a provider documents a single bucket shared across multiple
40
+ * models (e.g. Minimax: 5 RPM across all Hailuo Video Generation models).
41
+ *
42
+ * The rate-limit factory composes the matching provider limiter as a parent
43
+ * of the model limiter — both buckets must have a free slot before a request
44
+ * proceeds, and both are reserved/released atomically.
45
+ *
46
+ * Keyed by the prefix segment of the modelKey (everything before the first
47
+ * "-"). If a provider exposes multiple APIs with different shared buckets
48
+ * (e.g. Minimax video 5 RPM vs Minimax LLM 500 RPM), split into a separate
49
+ * key here and stop using the prefix-based default for that group.
50
+ */
51
+ exports.aiProviderRateLimits = {
52
+ // Minimax Video Generation API: 5 RPM shared across Hailuo 2.3, 2.3-Fast, 02
53
+ // https://platform.minimax.io/docs/guides/rate-limits
54
+ // Safe to key as "minimax" only while we have no Minimax LLM/TTS/Image
55
+ // models registered — re-key when that changes.
56
+ minimax: { requestPerMin: 5 },
57
+ };
58
+ /**
59
+ * Returns the provider key for a given modelKey — everything before the first
60
+ * "-". Used both for provider-level rate-limit lookups and for detecting
61
+ * cross-provider task mismatches (a scene whose `task` was issued by provider
62
+ * X should never be polled with provider Y after a modelKey swap).
63
+ *
64
+ * Matches the prefix convention used in EVideoGenModels / ETextGenModels.
65
+ * E.g. "minimax-hailuo-2.3" → "minimax", "google-veo-3.1-lite" → "google".
66
+ */
67
+ function getProviderKey(modelKey) {
68
+ return modelKey.split("-")[0] ?? modelKey;
69
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"minimax.d.ts","sourceRoot":"","sources":["../../../../src/globals/aiModels/providers/minimax.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,CAgErE,CAAC"}
1
+ {"version":3,"file":"minimax.d.ts","sourceRoot":"","sources":["../../../../src/globals/aiModels/providers/minimax.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,CAsErE,CAAC"}
@@ -14,7 +14,9 @@ exports.minimaxConfigs = {
14
14
  6: ["768P", "1080P"],
15
15
  10: ["768P"],
16
16
  },
17
- // parallelRequests: 1,
17
+ // No per-model rate limits — Minimax enforces a single 5 RPM bucket
18
+ // shared across ALL Hailuo Video Generation models, configured at the
19
+ // provider level in aiProviderRateLimits.minimax.
18
20
  cost: {
19
21
  table: {
20
22
  "768P": { 6: 0.19, 10: 0.32 },
@@ -34,7 +36,9 @@ exports.minimaxConfigs = {
34
36
  6: ["768P", "1080P"],
35
37
  10: ["768P"],
36
38
  },
37
- // parallelRequests: 1,
39
+ // No per-model rate limits — Minimax enforces a single 5 RPM bucket
40
+ // shared across ALL Hailuo Video Generation models, configured at the
41
+ // provider level in aiProviderRateLimits.minimax.
38
42
  cost: {
39
43
  table: {
40
44
  "768P": { 6: 0.28, 10: 0.56 },
@@ -54,7 +58,9 @@ exports.minimaxConfigs = {
54
58
  6: ["512P", "768P", "1080P"],
55
59
  10: ["512P", "768P"],
56
60
  },
57
- // parallelRequests: 1,
61
+ // No per-model rate limits — Minimax enforces a single 5 RPM bucket
62
+ // shared across ALL Hailuo Video Generation models, configured at the
63
+ // provider level in aiProviderRateLimits.minimax.
58
64
  cost: {
59
65
  table: {
60
66
  "512P": { 6: 0.1, 10: 0.15 },
@@ -4,6 +4,14 @@ import { EVideoDurationType, EVideoJobStatus, EVideoSceneStatus, TVideoJobTask,
4
4
  import { EVideoMode } from "../services/aiGen/types";
5
5
  export interface IVideoScene {
6
6
  task?: TVideoJobTask;
7
+ /**
8
+ * Provider that issued `task` (e.g. "google", "kling", "minimax"). Persisted
9
+ * alongside `task` so the resume path can detect a stale cross-provider
10
+ * mismatch — when the job's current modelKey resolves to a different provider
11
+ * than the one that originally created the task, polling the new provider
12
+ * with the old task ID would 404. Such tasks are cleared and re-submitted.
13
+ */
14
+ taskProvider?: string;
7
15
  sceneIndex: number;
8
16
  duration?: number;
9
17
  prompt?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"video.model.d.ts","sourceRoot":"","sources":["../../src/models/video.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IAEnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CAOpB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,CAAC,EA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1C,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAI9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGnB,SAAS,EAAE,UAAU,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC;IACtB,aAAa,CAAC,EAAE,UAAU,CAAC;CAC5B"}
@@ -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,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAUlB,qBAAa,gBAAiB,SAAQ,wBAAwB;IAC5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CACsD;IAI9E,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,WAAW;IAIb,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAuJ3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA4HjD,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;CAgDjD"}
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,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAUlB,qBAAa,gBAAiB,SAAQ,wBAAwB;IAC5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CACsD;IAI9E,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,WAAW;IAIb,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IA2K3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA4HjD,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;CAgDjD"}
@@ -128,15 +128,29 @@ class ByteDanceService extends baseAiGenProvider_service_1.BaseAiGenProviderServ
128
128
  if (code?.startsWith("InputImageSensitiveContentDetected")) {
129
129
  throw new errors_1.UserFacingError("Your input image contains sensitive content and cannot be processed. Please use a different image.");
130
130
  }
131
+ // Seedance r2v (reference-to-video) rejects input videos that contain
132
+ // real people / PII synchronously with this code. Treat as user-facing
133
+ // so we don't page Slack for moderation hits.
134
+ if (code?.startsWith("InputVideoSensitiveContentDetected")) {
135
+ throw new errors_1.UserFacingError("Your input video contains content (e.g. a recognizable real person) that this model cannot process. Please use a different video or an AI-generated clip.");
136
+ }
131
137
  if (code === "InvalidParameter.UnsupportedImageFormat" || (code?.includes("UnsupportedImageFormat"))) {
132
138
  throw new errors_1.UserFacingError("Your input image format is not supported. Please use JPEG or PNG.");
133
139
  }
134
- if (code === "InvalidParameter" && param?.includes("image_url")) {
140
+ // Seedance 2.x reports image-related errors against `content[N]` (the
141
+ // reference image is the Nth item in the multipart `content` array)
142
+ // rather than the older flat `image_url` param. Treat both shapes the
143
+ // same so the user sees a friendly hint instead of a system alert.
144
+ const isImageParam = param?.includes("image_url") || /^content\[\d+\]$/.test(param ?? "");
145
+ if (code === "InvalidParameter" && isImageParam) {
135
146
  if (message.includes("aspect ratio")) {
136
147
  throw new errors_1.UserFacingError("Your input image's aspect ratio is not supported by this model. Please use an image with an aspect ratio between 0.40 and 2.50 (e.g. 1:1, 9:16, 16:9).");
137
148
  }
138
- if (message.includes("width") || message.includes("height") || message.includes("px")) {
139
- throw new errors_1.UserFacingError("Your input image is too small. Please use an image with a minimum width of 300px.");
149
+ if (/pixel count|must be greater than or equal to \d+/i.test(message) ||
150
+ message.includes("width") ||
151
+ message.includes("height") ||
152
+ message.includes("px")) {
153
+ throw new errors_1.UserFacingError("Your input image is too small for this model. Please use a higher-resolution image (at least 640×640, or 300px on the shorter side).");
140
154
  }
141
155
  throw new errors_1.UserFacingError(`Your input image is not valid: ${message}`);
142
156
  }
@@ -1 +1 @@
1
- {"version":3,"file":"minimax.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/minimax/minimax.service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAUlB;;;GAGG;AAGH,eAAO,MAAM,+BAA+B,uBAAuB,CAAC;AAmGpE,qBAAa,cAAe,SAAQ,wBAAwB;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IAEpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;;YAUlB,OAAO;IAuDf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAoD3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA6EjD,aAAa,CAAC,EACZ,QAAQ,EACR,UAAmB,EACnB,QAAY,EACZ,SAAiB,GAClB,EAAE,iBAAiB,GAAG,MAAM;CAW9B"}
1
+ {"version":3,"file":"minimax.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/minimax/minimax.service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAUlB;;;GAGG;AAGH,eAAO,MAAM,+BAA+B,uBAAuB,CAAC;AAsGpE,qBAAa,cAAe,SAAQ,wBAAwB;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IAEpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;;YAUlB,OAAO;IAuDf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAoD3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA6EjD,aAAa,CAAC,EACZ,QAAQ,EACR,UAAmB,EACnB,QAAY,EACZ,SAAiB,GAClB,EAAE,iBAAiB,GAAG,MAAM;CAW9B"}
@@ -56,7 +56,10 @@ function classifyMinimaxError(code, msg) {
56
56
  case 1027:
57
57
  return { message: "Your request was declined because the generated content was flagged for sensitive material. Please adjust your prompt and try again.", code: errors_1.USER_FACING_ERROR_CODES.CONTENT_POLICY_VIOLATION, isUserInput: true };
58
58
  case 1002:
59
- return { message: "The request was rejected due to a rate limit or quota issue. Please try again in a moment.", code: errors_1.USER_FACING_ERROR_CODES.VIDEO_PROVIDER_RATE_LIMITED, isUserInput: false };
59
+ // Minimax-side rate limit. Not strictly "user input" but treated as
60
+ // user-facing so the frontend shows a translated retry message AND so
61
+ // sceneGeneration logs it as warn (no Slack page for upstream throttle).
62
+ return { message: "The request was rejected due to a rate limit or quota issue. Please try again in a moment.", code: errors_1.USER_FACING_ERROR_CODES.VIDEO_PROVIDER_RATE_LIMITED, isUserInput: true };
60
63
  case 1004:
61
64
  return { message: "Authorization failed for the video generation service. Please contact support.", isUserInput: false };
62
65
  default:
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings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,GAAG,MAAM,CAEnF;AAED,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD,eAAO,MAAM,qBAAqB,GAChC,MAAM,MAAM,EACZ,MAAM,cAAc,EACpB,KAAI,cAAkC,EACtC,UAAS,IAAI,GAAG,IAAW,KAC1B,OAAO,CAAC,MAAM,CA+BhB,CAAC;AAEF,eAAO,MAAM,UAAU,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,WAAW,CAqBlE,CAAC;AAEF,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;AAqDrB,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAatE"}
@@ -159,8 +159,12 @@ async function generateAndValidate({ userPrompt, systemPrompt, jsonSchema, zodSc
159
159
  return parsed;
160
160
  }
161
161
  catch (err) {
162
- console.warn("⚠️ Parse or validation failed:", err, "\nRaw:", raw);
163
- return null;
162
+ // Returning null here previously caused downstream "Cannot read properties
163
+ // of null" crashes in callers that immediately accessed fields on the
164
+ // result. Surface the real failure so the caller can present a friendly
165
+ // error (and so Slack shows the LLM payload that broke).
166
+ const snippet = raw.length > 500 ? `${raw.slice(0, 500)}…` : raw;
167
+ throw new Error(`generateAndValidate: failed to parse or validate model output — ${err?.message}; raw="${snippet}"`);
164
168
  }
165
169
  }
166
170
  function getVideoDurationRangeText(durationType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vidspotai-shared",
3
- "version": "1.0.66",
3
+ "version": "1.0.68",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "exports": {