vidspotai-shared 1.0.112 → 1.0.114
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/globals/types.d.ts +9 -1
- package/lib/globals/types.d.ts.map +1 -1
- package/lib/globals/types.js +9 -0
- package/lib/libs/index.d.ts +3 -0
- package/lib/libs/index.d.ts.map +1 -1
- package/lib/libs/index.js +3 -0
- package/lib/libs/mediaStore.d.ts +7 -0
- package/lib/libs/mediaStore.d.ts.map +1 -0
- package/lib/libs/mediaStore.js +24 -0
- package/lib/libs/r2KeyMap.d.ts +40 -0
- package/lib/libs/r2KeyMap.d.ts.map +1 -0
- package/lib/libs/r2KeyMap.js +110 -0
- package/lib/libs/storage/GcsBackend.d.ts +9 -0
- package/lib/libs/storage/GcsBackend.d.ts.map +1 -0
- package/lib/libs/storage/GcsBackend.js +42 -0
- package/lib/libs/storage/MediaStorage.d.ts +80 -0
- package/lib/libs/storage/MediaStorage.d.ts.map +1 -0
- package/lib/libs/storage/MediaStorage.js +105 -0
- package/lib/libs/storage/R2Backend.d.ts +23 -0
- package/lib/libs/storage/R2Backend.d.ts.map +1 -0
- package/lib/libs/storage/R2Backend.js +156 -0
- package/lib/libs/storage/StorageBackend.d.ts +41 -0
- package/lib/libs/storage/StorageBackend.d.ts.map +1 -0
- package/lib/libs/storage/StorageBackend.js +2 -0
- package/lib/libs/storage/index.d.ts +5 -0
- package/lib/libs/storage/index.d.ts.map +1 -0
- package/lib/libs/storage/index.js +20 -0
- package/lib/services/agent/tools/generateAvatarVideo.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/generateAvatarVideo.tool.js +3 -5
- package/lib/services/aiGen/providers/alibaba/alibaba.d.ts.map +1 -1
- package/lib/services/aiGen/providers/alibaba/alibaba.js +5 -11
- package/lib/services/aiGen/providers/bytedance/bytedance.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/bytedance/bytedance.service.js +5 -0
- package/lib/services/aiGen/providers/elevenlabs/elevenlabs.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/elevenlabs/elevenlabs.service.js +3 -7
- package/lib/services/aiGen/providers/google/google.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/google/google.service.js +20 -10
- package/lib/services/aiGen/providers/google/googleMusic.d.ts.map +1 -1
- package/lib/services/aiGen/providers/google/googleMusic.js +3 -7
- package/lib/services/aiGen/providers/kling/kling.service.d.ts +16 -7
- package/lib/services/aiGen/providers/kling/kling.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/kling/kling.service.js +2 -2
- package/lib/services/aiGen/providers/kling/klingImage.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/kling/klingImage.service.js +3 -5
- package/lib/services/aiGen/providers/kling/klingStatus.d.ts +1 -1
- package/lib/services/aiGen/providers/kling/klingStatus.d.ts.map +1 -1
- package/lib/services/aiGen/providers/kling/klingStatus.js +8 -19
- package/lib/services/aiGen/providers/minimax/minimax.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/minimax/minimax.service.js +15 -17
- package/lib/services/aiGen/providers/openai/openai.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/openai/openai.service.js +5 -13
- package/lib/services/aiGen/providers/pixverse/pixverse.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/pixverse/pixverse.service.js +5 -0
- package/lib/services/aiGen/providers/runway/runway.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/runway/runway.service.js +5 -10
- package/lib/services/gcp/uploadAudioBuffer.d.ts.map +1 -1
- package/lib/services/gcp/uploadAudioBuffer.js +4 -0
- package/package.json +2 -1
|
@@ -11,7 +11,7 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
11
11
|
const http_1 = __importDefault(require("http"));
|
|
12
12
|
const https_1 = __importDefault(require("https"));
|
|
13
13
|
const types_1 = require("../../../../globals/types");
|
|
14
|
-
const
|
|
14
|
+
const storage_1 = require("../../../../libs/storage");
|
|
15
15
|
const logger_1 = require("../../../../utils/logger");
|
|
16
16
|
/**
|
|
17
17
|
* Kling status polling + result stashing. Extracted from KlingService so the
|
|
@@ -43,7 +43,7 @@ function parseKlingDurationSec(raw) {
|
|
|
43
43
|
* this helper in a separate commit.
|
|
44
44
|
*/
|
|
45
45
|
async function stashVideoToGcs(videoUrl, outputFilePath, outputFilename, timeout, logContext) {
|
|
46
|
-
const
|
|
46
|
+
const filePath = `${outputFilePath}/${outputFilename}.mp4`;
|
|
47
47
|
const maxAttempts = 3;
|
|
48
48
|
let lastErr;
|
|
49
49
|
let downloadHost = "unknown";
|
|
@@ -63,11 +63,8 @@ async function stashVideoToGcs(videoUrl, outputFilePath, outputFilename, timeout
|
|
|
63
63
|
httpAgent: v4Http,
|
|
64
64
|
httpsAgent: v4Https,
|
|
65
65
|
});
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
action: "read",
|
|
69
|
-
expires: "03-09-2491",
|
|
70
|
-
});
|
|
66
|
+
// mediaStorage: GCS write + best-effort R2 mirror (zero-egress delivery).
|
|
67
|
+
const signedUrl = await storage_1.mediaStorage.put(filePath, Buffer.from(videoResp.data), "video/mp4");
|
|
71
68
|
return signedUrl;
|
|
72
69
|
}
|
|
73
70
|
catch (err) {
|
|
@@ -192,18 +189,14 @@ async function checkRegularVideoStatus(deps, { task, outputFilename, outputFileP
|
|
|
192
189
|
};
|
|
193
190
|
}
|
|
194
191
|
const filePath = `${outputFilePath}/${outputFilename}.mp4`;
|
|
195
|
-
const file = (0, firebase_1.getBucket)().file(filePath);
|
|
196
192
|
// Download video using axios — use generateTimeout since video files can be large
|
|
197
193
|
const videoResp = await axios_1.default.get(videoUrl, {
|
|
198
194
|
responseType: "arraybuffer",
|
|
199
195
|
timeout: deps.generateTimeout,
|
|
200
196
|
});
|
|
201
197
|
const buffer = Buffer.from(videoResp.data);
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
action: "read",
|
|
205
|
-
expires: "03-09-2491",
|
|
206
|
-
});
|
|
198
|
+
// mediaStorage: GCS write + best-effort R2 mirror (zero-egress delivery).
|
|
199
|
+
const signedUrl = await storage_1.mediaStorage.put(filePath, buffer, "video/mp4");
|
|
207
200
|
return {
|
|
208
201
|
videoUrl: signedUrl,
|
|
209
202
|
status: types_1.EVideoSceneStatus.COMPLETED,
|
|
@@ -248,7 +241,6 @@ async function checkAvatarVideoStatus(deps, { task, outputFilename, outputFilePa
|
|
|
248
241
|
// status that's already known. Wrap the post-success work in its own
|
|
249
242
|
// bounded retry so a transient blip doesn't poison the poll loop.
|
|
250
243
|
const filePath = `${outputFilePath}/${outputFilename}.mp4`;
|
|
251
|
-
const file = (0, firebase_1.getBucket)().file(filePath);
|
|
252
244
|
const maxAttempts = 3;
|
|
253
245
|
let lastErr;
|
|
254
246
|
// Force IPv4 on the download. The Kling-returned video URL frequently
|
|
@@ -274,11 +266,8 @@ async function checkAvatarVideoStatus(deps, { task, outputFilename, outputFilePa
|
|
|
274
266
|
httpsAgent: v4Https,
|
|
275
267
|
});
|
|
276
268
|
const buffer = Buffer.from(videoResp.data);
|
|
277
|
-
|
|
278
|
-
const
|
|
279
|
-
action: "read",
|
|
280
|
-
expires: "03-09-2491",
|
|
281
|
-
});
|
|
269
|
+
// mediaStorage: GCS write + best-effort R2 mirror (zero-egress delivery).
|
|
270
|
+
const signedUrl = await storage_1.mediaStorage.put(filePath, buffer, "video/mp4");
|
|
282
271
|
return {
|
|
283
272
|
videoUrl: signedUrl,
|
|
284
273
|
status: types_1.EVideoSceneStatus.COMPLETED,
|
|
@@ -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,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAUlB;;;GAGG;AAGH,eAAO,MAAM,+BAA+B,uBAAuB,CAAC;
|
|
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,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAUlB;;;GAGG;AAGH,eAAO,MAAM,+BAA+B,uBAAuB,CAAC;AAuHpE,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;IAgE3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAwEjD;;;;OAIG;IACG,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAqDjC;;;;;OAKG;IACG,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IA2CjC,aAAa,CAAC,EACZ,QAAQ,EACR,UAAmB,EACnB,QAAY,EACZ,SAAiB,EACjB,SAAa,EACb,WAAW,GACZ,EAAE,iBAAiB,GAAG,MAAM;CAgC9B"}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.MinimaxService = exports.MINIMAX_USER_INPUT_ERROR_PREFIX = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const aiModels_1 = require("../../../../globals/aiModels");
|
|
9
|
-
const
|
|
9
|
+
const storage_1 = require("../../../../libs/storage");
|
|
10
10
|
const types_1 = require("../../../../globals/types");
|
|
11
11
|
const helpers_1 = require("../../helpers");
|
|
12
12
|
const errors_1 = require("../../../../utils/errors");
|
|
@@ -71,6 +71,14 @@ function classifyMinimaxError(code, msg) {
|
|
|
71
71
|
// 1004 = authentication failed — a bad/revoked MiniMax key (deploy/config
|
|
72
72
|
// fault). Must page: PROVIDER_AUTH_ERROR is not in the non-paging set.
|
|
73
73
|
return { message: "Authorization failed for the video generation service. Please contact support.", code: errors_1.USER_FACING_ERROR_CODES.PROVIDER_AUTH_ERROR, isUserInput: false };
|
|
74
|
+
case 2153:
|
|
75
|
+
// 2153 = Music API withdrawn from our account tier ("no longer available
|
|
76
|
+
// to new users; existing paying customers can continue"). Confirmed live
|
|
77
|
+
// 2026-09-14 — every music_generation call fails 100%. Not user-fixable
|
|
78
|
+
// (no prompt change helps) and not a transient outage — an account/billing
|
|
79
|
+
// decision (upgrade the MiniMax plan, or move music-gen to another
|
|
80
|
+
// provider). Must page: isUserInput:false, same bucket as 1008/1004.
|
|
81
|
+
return { message: "Music generation is temporarily unavailable on our current plan with this provider. You haven't been charged — please try again later.", code: errors_1.USER_FACING_ERROR_CODES.CAPABILITY_MISMATCH, isUserInput: false };
|
|
74
82
|
default:
|
|
75
83
|
return { message: msg || `Generation failed (code ${code})`, isUserInput: false };
|
|
76
84
|
}
|
|
@@ -258,12 +266,8 @@ class MinimaxService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
|
|
|
258
266
|
}
|
|
259
267
|
const buffer = Buffer.from(videoResp.data);
|
|
260
268
|
const filePath = `${outputFilePath}/${outputFilename}.mp4`;
|
|
261
|
-
|
|
262
|
-
await
|
|
263
|
-
const [signedUrl] = await file.getSignedUrl({
|
|
264
|
-
action: "read",
|
|
265
|
-
expires: "03-09-2491",
|
|
266
|
-
});
|
|
269
|
+
// mediaStorage: GCS write + best-effort R2 mirror (zero-egress delivery).
|
|
270
|
+
const signedUrl = await storage_1.mediaStorage.put(filePath, buffer, "video/mp4");
|
|
267
271
|
return {
|
|
268
272
|
videoUrl: signedUrl,
|
|
269
273
|
status: types_1.EVideoSceneStatus.COMPLETED,
|
|
@@ -306,7 +310,6 @@ class MinimaxService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
|
|
|
306
310
|
if (!remoteUrls.length) {
|
|
307
311
|
throw new Error("MiniMax image API returned no image_urls");
|
|
308
312
|
}
|
|
309
|
-
const bucket = (0, firebase_1.getBucket)();
|
|
310
313
|
const ts = Date.now();
|
|
311
314
|
const urls = [];
|
|
312
315
|
for (let i = 0; i < remoteUrls.length; i++) {
|
|
@@ -316,9 +319,8 @@ class MinimaxService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
|
|
|
316
319
|
timeout: 60000,
|
|
317
320
|
});
|
|
318
321
|
const path = `images/minimax/${ts}-${Math.random().toString(36).slice(2, 8)}-${i}.png`;
|
|
319
|
-
|
|
320
|
-
await
|
|
321
|
-
const [signed] = await file.getSignedUrl({ action: "read", expires: "03-09-2491" });
|
|
322
|
+
// mediaStorage: GCS write + best-effort R2 mirror (zero-egress delivery).
|
|
323
|
+
const signed = await storage_1.mediaStorage.put(path, Buffer.from(r.data), "image/png");
|
|
322
324
|
urls.push(signed);
|
|
323
325
|
}
|
|
324
326
|
return {
|
|
@@ -361,12 +363,8 @@ class MinimaxService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
|
|
|
361
363
|
}
|
|
362
364
|
const buffer = Buffer.from(audioHex, "hex");
|
|
363
365
|
const path = `music/minimax/${params.outputFilename}.mp3`;
|
|
364
|
-
|
|
365
|
-
await
|
|
366
|
-
const [signed] = await file.getSignedUrl({
|
|
367
|
-
action: "read",
|
|
368
|
-
expires: "03-09-2491",
|
|
369
|
-
});
|
|
366
|
+
// mediaStorage: GCS write + best-effort R2 mirror (zero-egress delivery).
|
|
367
|
+
const signed = await storage_1.mediaStorage.put(path, buffer, "audio/mpeg");
|
|
370
368
|
return {
|
|
371
369
|
audioUrl: signed,
|
|
372
370
|
mimeType: "audio/mpeg",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/openai/openai.service.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAclB,qBAAa,aAAc,SAAQ,wBAAwB;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,MAAM,CAAS;;IAQjB,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAwF3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"openai.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/openai/openai.service.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAclB,qBAAa,aAAc,SAAQ,wBAAwB;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,MAAM,CAAS;;IAQjB,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAwF3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA8B3C,YAAY,CAChB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IA2ChC;;;;OAIG;IACG,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IA2HjC,aAAa,CAAC,EACZ,QAAQ,EACR,UAAuB,EACvB,QAAY,EACZ,SAAiB,EACjB,SAAa,EACb,OAAO,EACP,WAAW,GACZ,EAAE,iBAAiB,GAAG,MAAM;CAqB9B"}
|
|
@@ -38,7 +38,7 @@ exports.OpenaiService = void 0;
|
|
|
38
38
|
const openai_1 = __importStar(require("openai"));
|
|
39
39
|
const aiModels_1 = require("../../../../globals/aiModels");
|
|
40
40
|
const types_1 = require("../../../../globals/types");
|
|
41
|
-
const
|
|
41
|
+
const storage_1 = require("../../../../libs/storage");
|
|
42
42
|
const utils_1 = require("../../../../utils");
|
|
43
43
|
const logger_1 = require("../../../../utils/logger");
|
|
44
44
|
const errors_1 = require("../../../../utils/errors");
|
|
@@ -148,15 +148,9 @@ class OpenaiService extends baseAiGenProvider_service_1.BaseAiGenProviderService
|
|
|
148
148
|
const response = await this.client.videos.downloadContent(task);
|
|
149
149
|
const blob = await response.blob();
|
|
150
150
|
const buffer = Buffer.from(await blob.arrayBuffer());
|
|
151
|
-
// Upload to
|
|
151
|
+
// Upload to storage — GCS write + best-effort R2 mirror (zero-egress).
|
|
152
152
|
const filePath = `${outputFilePath}/${outputFilename}.mp4`;
|
|
153
|
-
const
|
|
154
|
-
await file.save(buffer, { contentType: "video/mp4" });
|
|
155
|
-
// Generate a signed URL
|
|
156
|
-
const [signedUrl] = await file.getSignedUrl({
|
|
157
|
-
action: "read",
|
|
158
|
-
expires: "03-09-2491",
|
|
159
|
-
});
|
|
153
|
+
const signedUrl = await storage_1.mediaStorage.put(filePath, buffer, "video/mp4");
|
|
160
154
|
return {
|
|
161
155
|
status: types_1.EVideoSceneStatus.COMPLETED,
|
|
162
156
|
videoUrl: signedUrl,
|
|
@@ -307,7 +301,6 @@ class OpenaiService extends baseAiGenProvider_service_1.BaseAiGenProviderService
|
|
|
307
301
|
}
|
|
308
302
|
}
|
|
309
303
|
const data = resp.data ?? [];
|
|
310
|
-
const bucket = (0, firebase_1.getBucket)();
|
|
311
304
|
const ts = Date.now();
|
|
312
305
|
const ext = params.outputFormat ?? "png";
|
|
313
306
|
const urls = [];
|
|
@@ -323,9 +316,8 @@ class OpenaiService extends baseAiGenProvider_service_1.BaseAiGenProviderService
|
|
|
323
316
|
else
|
|
324
317
|
continue;
|
|
325
318
|
const path = `images/openai/${ts}-${Math.random().toString(36).slice(2, 8)}-${i}.${ext}`;
|
|
326
|
-
|
|
327
|
-
await
|
|
328
|
-
const [signed] = await file.getSignedUrl({ action: "read", expires: "03-09-2491" });
|
|
319
|
+
// mediaStorage: GCS write + best-effort R2 mirror (zero-egress delivery).
|
|
320
|
+
const signed = await storage_1.mediaStorage.put(path, bytes, `image/${ext}`);
|
|
329
321
|
urls.push(signed);
|
|
330
322
|
}
|
|
331
323
|
if (!urls.length)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pixverse.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/pixverse/pixverse.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"pixverse.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/pixverse/pixverse.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAgGlB,qBAAa,eAAgB,SAAQ,wBAAwB;IAC3D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkD;IAK1E;;;;;;OAMG;YACW,WAAW;IA6CnB,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAyL3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAoHjD,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;CAkDjD"}
|
|
@@ -10,6 +10,7 @@ const helpers_1 = require("../../helpers");
|
|
|
10
10
|
const aiModels_1 = require("../../../../globals/aiModels");
|
|
11
11
|
const types_1 = require("../../../../globals/types");
|
|
12
12
|
const firebase_1 = require("../../../../libs/firebase");
|
|
13
|
+
const storage_1 = require("../../../../libs/storage");
|
|
13
14
|
const helpers_2 = require("../../../../utils/helpers");
|
|
14
15
|
const mp4Duration_1 = require("../../../../utils/mp4Duration");
|
|
15
16
|
const logger_1 = require("../../../../utils/logger");
|
|
@@ -372,6 +373,10 @@ class PixVerseService extends baseAiGenProvider_service_1.BaseAiGenProviderServi
|
|
|
372
373
|
},
|
|
373
374
|
},
|
|
374
375
|
});
|
|
376
|
+
// mediaStorage: best-effort R2 mirror (zero-egress delivery). GCS keeps the
|
|
377
|
+
// firebaseStorage download-token URL as the stored system-of-record URL; the
|
|
378
|
+
// CDN Worker resolves either URL family to the same R2 object.
|
|
379
|
+
await storage_1.mediaStorage.mirrorBytes(filePath, buffer, "video/mp4");
|
|
375
380
|
const publicVideoUrl = `https://firebasestorage.googleapis.com/v0/b/${bucket.name}` +
|
|
376
381
|
`/o/${encodeURIComponent(filePath)}?alt=media&token=${downloadToken}`;
|
|
377
382
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runway.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/runway/runway.service.ts"],"names":[],"mappings":"AAOA,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;AAIlB,qBAAa,aAAc,SAAQ,wBAAwB;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqC;IAC7D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;;YAUlB,OAAO;IAgCf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IA6G3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"runway.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/runway/runway.service.ts"],"names":[],"mappings":"AAOA,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;AAIlB,qBAAa,aAAc,SAAQ,wBAAwB;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqC;IAC7D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;;YAUlB,OAAO;IAgCf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IA6G3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAuDjD,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAY,EAAE,SAAiB,EAAE,SAAa,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,iBAAiB,GAAG,MAAM;IA0BhI;;;;;;;;OAQG;IACG,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;CAyElC"}
|
|
@@ -7,7 +7,7 @@ exports.RunwayService = void 0;
|
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const aiModels_1 = require("../../../../globals/aiModels");
|
|
9
9
|
const types_1 = require("../../../../globals/types");
|
|
10
|
-
const
|
|
10
|
+
const storage_1 = require("../../../../libs/storage");
|
|
11
11
|
const helpers_1 = require("../../../../utils/helpers");
|
|
12
12
|
const logger_1 = require("../../../../utils/logger");
|
|
13
13
|
const helpers_2 = require("../../helpers");
|
|
@@ -161,12 +161,8 @@ class RunwayService extends baseAiGenProvider_service_1.BaseAiGenProviderService
|
|
|
161
161
|
}
|
|
162
162
|
const buffer = Buffer.from(videoResp.data);
|
|
163
163
|
const filePath = `${outputFilePath}/${outputFilename}.mp4`;
|
|
164
|
-
|
|
165
|
-
await
|
|
166
|
-
const [signedUrl] = await file.getSignedUrl({
|
|
167
|
-
action: "read",
|
|
168
|
-
expires: "03-09-2491",
|
|
169
|
-
});
|
|
164
|
+
// mediaStorage: GCS write + best-effort R2 mirror (zero-egress delivery).
|
|
165
|
+
const signedUrl = await storage_1.mediaStorage.put(filePath, buffer, "video/mp4");
|
|
170
166
|
return {
|
|
171
167
|
videoUrl: signedUrl,
|
|
172
168
|
status: types_1.EVideoSceneStatus.COMPLETED,
|
|
@@ -264,9 +260,8 @@ class RunwayService extends baseAiGenProvider_service_1.BaseAiGenProviderService
|
|
|
264
260
|
const ext = (contentType.split("/")[1] ?? "png").toLowerCase();
|
|
265
261
|
const ts = Date.now();
|
|
266
262
|
const path = `images/runway/${ts}-${Math.random().toString(36).slice(2, 8)}.${ext}`;
|
|
267
|
-
|
|
268
|
-
await
|
|
269
|
-
const [signed] = await file.getSignedUrl({ action: "read", expires: "03-09-2491" });
|
|
263
|
+
// mediaStorage: GCS write + best-effort R2 mirror (zero-egress delivery).
|
|
264
|
+
const signed = await storage_1.mediaStorage.put(path, Buffer.from(imgResp.data), contentType);
|
|
270
265
|
return {
|
|
271
266
|
imageUrl: signed,
|
|
272
267
|
providerRequestId: run.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadAudioBuffer.d.ts","sourceRoot":"","sources":["../../../src/services/gcp/uploadAudioBuffer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"uploadAudioBuffer.d.ts","sourceRoot":"","sources":["../../../src/services/gcp/uploadAudioBuffer.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,WAAW,GAAE,MAAqB,GACjC,OAAO,CAAC,MAAM,CAAC,CAcjB"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.uploadAudioBufferToGcs = uploadAudioBufferToGcs;
|
|
4
4
|
const node_crypto_1 = require("node:crypto");
|
|
5
5
|
const firebase_1 = require("../../libs/firebase");
|
|
6
|
+
const storage_1 = require("../../libs/storage");
|
|
6
7
|
/**
|
|
7
8
|
* Uploads an audio buffer to the project's Firebase Storage bucket and
|
|
8
9
|
* returns a public download URL. Used by the agent VO pipeline: ElevenLabs
|
|
@@ -24,5 +25,8 @@ async function uploadAudioBufferToGcs(buffer, destination, contentType = "audio/
|
|
|
24
25
|
metadata: { firebaseStorageDownloadTokens: downloadToken },
|
|
25
26
|
},
|
|
26
27
|
});
|
|
28
|
+
// mediaStorage: best-effort R2 mirror (zero-egress delivery). GCS keeps the
|
|
29
|
+
// firebaseStorage download-token URL as the stored system-of-record URL.
|
|
30
|
+
await storage_1.mediaStorage.mirrorBytes(destination, buffer, contentType);
|
|
27
31
|
return `https://firebasestorage.googleapis.com/v0/b/${bucket.name}/o/${encodeURIComponent(destination)}?alt=media&token=${downloadToken}`;
|
|
28
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vidspotai-shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.114",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@anthropic-ai/sdk": "^0.98.0",
|
|
18
|
+
"@aws-sdk/client-s3": "^3.1119.0",
|
|
18
19
|
"@google-cloud/storage": "*",
|
|
19
20
|
"@google/genai": "^1.22.0",
|
|
20
21
|
"@googleapis/sheets": "^13.0.1",
|