vidspotai-shared 1.0.132 → 1.0.134

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.
Files changed (39) hide show
  1. package/lib/globals/index.d.ts +1 -0
  2. package/lib/globals/index.d.ts.map +1 -1
  3. package/lib/globals/index.js +1 -0
  4. package/lib/globals/musicStudio.d.ts +90 -0
  5. package/lib/globals/musicStudio.d.ts.map +1 -0
  6. package/lib/globals/musicStudio.js +221 -0
  7. package/lib/globals/types.d.ts +10 -1
  8. package/lib/globals/types.d.ts.map +1 -1
  9. package/lib/globals/types.js +12 -0
  10. package/lib/models/index.d.ts +1 -0
  11. package/lib/models/index.d.ts.map +1 -1
  12. package/lib/models/index.js +1 -0
  13. package/lib/models/musicJob.model.d.ts +73 -0
  14. package/lib/models/musicJob.model.d.ts.map +1 -0
  15. package/lib/models/musicJob.model.js +2 -0
  16. package/lib/services/aiGen/providers/fal/falMusic.service.d.ts +63 -0
  17. package/lib/services/aiGen/providers/fal/falMusic.service.d.ts.map +1 -0
  18. package/lib/services/aiGen/providers/fal/falMusic.service.js +310 -0
  19. package/lib/services/aiGen/providers/fal/index.d.ts +1 -0
  20. package/lib/services/aiGen/providers/fal/index.d.ts.map +1 -1
  21. package/lib/services/aiGen/providers/fal/index.js +1 -0
  22. package/lib/services/aiGen/providers/google/google.service.d.ts.map +1 -1
  23. package/lib/services/aiGen/providers/google/google.service.js +9 -1
  24. package/lib/services/firestore.service.d.ts +2 -0
  25. package/lib/services/firestore.service.d.ts.map +1 -1
  26. package/lib/services/firestore.service.js +3 -0
  27. package/lib/services/index.d.ts +1 -0
  28. package/lib/services/index.d.ts.map +1 -1
  29. package/lib/services/index.js +1 -0
  30. package/lib/services/music/index.d.ts +3 -0
  31. package/lib/services/music/index.d.ts.map +1 -0
  32. package/lib/services/music/index.js +18 -0
  33. package/lib/services/music/musicLyricWriter.d.ts +25 -0
  34. package/lib/services/music/musicLyricWriter.d.ts.map +1 -0
  35. package/lib/services/music/musicLyricWriter.js +58 -0
  36. package/lib/services/music/musicLyrics.d.ts +66 -0
  37. package/lib/services/music/musicLyrics.d.ts.map +1 -0
  38. package/lib/services/music/musicLyrics.js +258 -0
  39. package/package.json +1 -1
@@ -0,0 +1,310 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FalMusicService = void 0;
4
+ exports.buildGenerateRequest = buildGenerateRequest;
5
+ exports.buildOpRequest = buildOpRequest;
6
+ exports.buildLyricSyncRequest = buildLyricSyncRequest;
7
+ exports.parseAudioOutput = parseAudioOutput;
8
+ exports.parseStemsOutput = parseStemsOutput;
9
+ exports.parseLyricWords = parseLyricWords;
10
+ const musicStudio_1 = require("../../../../globals/musicStudio");
11
+ const errors_1 = require("../../../../utils/errors");
12
+ const logger_1 = require("../../../../utils/logger");
13
+ const musicLyrics_1 = require("../../../music/musicLyrics");
14
+ const transientRetry_1 = require("../../transientRetry");
15
+ const falUpscale_service_1 = require("./falUpscale.service");
16
+ const QUEUE_BASE_URL = "https://queue.fal.run";
17
+ /**
18
+ * fal.ai music — every Music Studio model except Lyria 2 (Vertex) plus the
19
+ * track operations (ACE-Step extend / remix / inpaint, Stable Audio
20
+ * audio-to-audio, Demucs stems, ElevenLabs Scribe lyric sync). Queue-only:
21
+ * this service exposes submit / status / result and leaves the poll loop to
22
+ * the MUSIC_JOBS worker, which persists the request id so a re-delivered job
23
+ * resumes instead of paying twice.
24
+ *
25
+ * Input builders are pure (job → request) so the provider-shape rules can be
26
+ * unit-tested without the network.
27
+ */
28
+ class FalMusicService {
29
+ constructor() {
30
+ if (!process.env.FAL_KEY) {
31
+ throw new Error("Missing FAL_KEY in environment variables");
32
+ }
33
+ this.apiKey = process.env.FAL_KEY;
34
+ }
35
+ headers(json) {
36
+ const h = { Authorization: `Key ${this.apiKey}` };
37
+ if (json)
38
+ h["Content-Type"] = "application/json";
39
+ return h;
40
+ }
41
+ /**
42
+ * Status/result routes drop an app id's nested sub-path
43
+ * (`fal-ai/minimax-music/v2.5` → `fal-ai/minimax-music`), so a resumed job
44
+ * only needs the persisted app id + request id.
45
+ */
46
+ routes(app, requestId) {
47
+ const [owner, name] = app.split("/");
48
+ const base = `${QUEUE_BASE_URL}/${owner}/${name}/requests/${requestId}`;
49
+ return { statusUrl: `${base}/status`, responseUrl: base };
50
+ }
51
+ async submit(req) {
52
+ return (0, transientRetry_1.withTransientRetry)(`fal:${req.app}:submit`, async () => {
53
+ const resp = await fetch(`${QUEUE_BASE_URL}/${req.app}`, {
54
+ method: "POST",
55
+ headers: this.headers(true),
56
+ body: JSON.stringify(req.input),
57
+ });
58
+ if (!resp.ok) {
59
+ const body = await resp.text();
60
+ if (resp.status === 422)
61
+ throw rejectedInput(body);
62
+ throw (0, falUpscale_service_1.classifyFalHttpError)(resp.status, body, `${req.app}:submit`);
63
+ }
64
+ const data = (await resp.json());
65
+ if (!data.request_id)
66
+ throw new Error(`fal ${req.app} did not return a request_id`);
67
+ return data.request_id;
68
+ }, {
69
+ onRetry: ({ attempt, maxAttempts, backoffMs, err }) => logger_1.logger.warn("fal music submit transient error — retrying", {
70
+ app: req.app,
71
+ attempt,
72
+ maxAttempts,
73
+ backoffMs,
74
+ message: err.message,
75
+ }),
76
+ });
77
+ }
78
+ async status(app, requestId) {
79
+ const resp = await fetch(this.routes(app, requestId).statusUrl, { headers: this.headers(false) });
80
+ if (!resp.ok)
81
+ throw (0, falUpscale_service_1.classifyFalHttpError)(resp.status, await resp.text(), `${app}:status`);
82
+ const data = (await resp.json());
83
+ if (data.error)
84
+ throw new Error(`fal ${app} failed: ${data.error}`);
85
+ const status = (data.status ?? "").toUpperCase();
86
+ if (status === "COMPLETED" || status === "IN_PROGRESS")
87
+ return status;
88
+ return "IN_QUEUE";
89
+ }
90
+ async result(app, requestId) {
91
+ const resp = await fetch(this.routes(app, requestId).responseUrl, { headers: this.headers(false) });
92
+ if (!resp.ok) {
93
+ const body = await resp.text();
94
+ if (resp.status === 422)
95
+ throw rejectedInput(body);
96
+ throw (0, falUpscale_service_1.classifyFalHttpError)(resp.status, body, `${app}:result`);
97
+ }
98
+ return (await resp.json());
99
+ }
100
+ }
101
+ exports.FalMusicService = FalMusicService;
102
+ /** fal 422s on content moderation as well as bad input — both are the user's to fix. */
103
+ function rejectedInput(body) {
104
+ const flagged = /safety|moderat|content policy|nsfw|inappropriate|copyright/i.test(body);
105
+ return new errors_1.UserFacingError(flagged
106
+ ? "The music model declined this prompt or these lyrics. Rephrase them (avoid real artist names and copyrighted lyrics) and try again."
107
+ : "The music model couldn't use these settings. Adjust the prompt, lyrics or length and try again.", flagged ? errors_1.USER_FACING_ERROR_CODES.CONTENT_POLICY_VIOLATION : errors_1.USER_FACING_ERROR_CODES.PROMPT_INVALID);
108
+ }
109
+ // ── Request builders ─────────────────────────────────────────────────────
110
+ function styleInput(job) {
111
+ return {
112
+ prompt: job.prompt,
113
+ genres: job.genres,
114
+ moods: job.moods,
115
+ bpm: job.bpm,
116
+ instrumental: job.instrumental,
117
+ vocalStyle: job.vocalStyle,
118
+ language: job.language,
119
+ };
120
+ }
121
+ /**
122
+ * Text-to-music request for a `generate` job on a fal model. `lyrics` is what
123
+ * should be sung (the user's, or auto-written when the model needs them);
124
+ * empty for instrumentals or when the model writes its own.
125
+ */
126
+ function buildGenerateRequest(job, modelKey, durationSec, lyrics) {
127
+ const model = musicStudio_1.MUSIC_MODELS[modelKey];
128
+ if (!model.falApp)
129
+ throw new Error(`${modelKey} is not a fal model`);
130
+ const style = styleInput(job);
131
+ const prompt = (0, musicLyrics_1.composeStylePrompt)(style, model.maxPromptChars);
132
+ const sing = !job.instrumental && model.vocals;
133
+ switch (modelKey) {
134
+ case "minimax-music-2.5":
135
+ return {
136
+ app: model.falApp,
137
+ input: {
138
+ prompt,
139
+ lyrics: sing ? lyrics : "",
140
+ is_instrumental: !sing,
141
+ lyrics_optimizer: sing && !lyrics,
142
+ audio_setting: { format: "mp3", bitrate: 256000, sample_rate: 44100 },
143
+ },
144
+ };
145
+ case "minimax-music-2":
146
+ return {
147
+ app: model.falApp,
148
+ input: {
149
+ prompt: prompt.length >= 10 ? prompt : `${prompt} song`.padEnd(10, "."),
150
+ lyrics_prompt: lyrics,
151
+ audio_setting: { format: "mp3", bitrate: 256000, sample_rate: 44100 },
152
+ },
153
+ };
154
+ case "elevenlabs-music": {
155
+ const sections = sing && lyrics ? (0, musicLyrics_1.toElevenLabsSections)(lyrics, durationSec) : [];
156
+ if (sections.length > 0) {
157
+ return {
158
+ app: model.falApp,
159
+ input: {
160
+ composition_plan: {
161
+ positive_global_styles: [prompt.slice(0, 500)],
162
+ negative_global_styles: [],
163
+ sections,
164
+ },
165
+ respect_sections_durations: true,
166
+ output_format: "mp3_44100_192",
167
+ },
168
+ };
169
+ }
170
+ return {
171
+ app: model.falApp,
172
+ input: {
173
+ prompt,
174
+ music_length_ms: durationSec * 1000,
175
+ force_instrumental: !sing,
176
+ output_format: "mp3_44100_192",
177
+ },
178
+ };
179
+ }
180
+ case "lyria-3":
181
+ return {
182
+ app: model.falApp,
183
+ input: {
184
+ prompt: (sing && lyrics ? `${prompt}\n\nLyrics:\n${lyrics}` : prompt).slice(0, model.maxPromptChars),
185
+ },
186
+ };
187
+ case "ace-step":
188
+ // No lyrics and a vocal track → prompt-to-audio, which writes tags + lyrics itself.
189
+ if (sing && !lyrics) {
190
+ return {
191
+ app: "fal-ai/ace-step/prompt-to-audio",
192
+ input: { prompt, duration: durationSec, instrumental: false },
193
+ };
194
+ }
195
+ return {
196
+ app: model.falApp,
197
+ input: { tags: (0, musicLyrics_1.composeStyleTags)(style), lyrics: sing ? lyrics : "[inst]", duration: durationSec },
198
+ };
199
+ case "diffrhythm":
200
+ return {
201
+ app: model.falApp,
202
+ input: {
203
+ lyrics: (0, musicLyrics_1.toLrc)(lyrics, durationSec),
204
+ style_prompt: prompt.slice(0, model.maxPromptChars),
205
+ music_duration: durationSec > 95 ? "285s" : "95s",
206
+ },
207
+ };
208
+ case "stable-audio-2.5":
209
+ return { app: model.falApp, input: { prompt, seconds_total: durationSec } };
210
+ case "beatoven":
211
+ return { app: model.falApp, input: { prompt, duration: durationSec } };
212
+ case "cassetteai":
213
+ return { app: model.falApp, input: { prompt, duration: Math.round(durationSec) } };
214
+ default:
215
+ throw new Error(`No fal request builder for ${modelKey}`);
216
+ }
217
+ }
218
+ /** Request for a track operation (extend / remix / section / convert / stems). */
219
+ function buildOpRequest(job, source) {
220
+ const tags = job.genres?.length || job.moods?.length ? (0, musicLyrics_1.composeStyleTags)(styleInput(job)) : source.styleTags;
221
+ const sourceLyrics = source.lyrics || "[inst]";
222
+ switch (job.op) {
223
+ case "extend":
224
+ return {
225
+ app: musicStudio_1.MUSIC_OP_APPS.extend,
226
+ input: {
227
+ audio_url: source.audioUrl,
228
+ tags,
229
+ lyrics: job.lyrics || sourceLyrics,
230
+ extend_after_duration: job.durationSec ?? 30,
231
+ },
232
+ };
233
+ case "remix":
234
+ return {
235
+ app: musicStudio_1.MUSIC_OP_APPS.remix,
236
+ input: {
237
+ audio_url: source.audioUrl,
238
+ edit_mode: job.remixMode ?? "remix",
239
+ tags,
240
+ original_tags: source.styleTags || tags,
241
+ lyrics: job.lyrics || sourceLyrics,
242
+ original_lyrics: sourceLyrics,
243
+ },
244
+ };
245
+ case "section":
246
+ return {
247
+ app: musicStudio_1.MUSIC_OP_APPS.section,
248
+ input: {
249
+ audio_url: source.audioUrl,
250
+ tags,
251
+ lyrics: job.lyrics || sourceLyrics,
252
+ start_time: job.sectionStartSec ?? 0,
253
+ end_time: job.sectionEndSec ?? Math.min(30, source.durationSec),
254
+ variance: 0.6,
255
+ },
256
+ };
257
+ case "convert":
258
+ return {
259
+ app: musicStudio_1.MUSIC_OP_APPS.convert,
260
+ input: {
261
+ prompt: (0, musicLyrics_1.composeStylePrompt)(styleInput(job), 2000),
262
+ audio_url: source.audioUrl,
263
+ strength: job.strength ?? 0.75,
264
+ total_seconds: Math.max(10, Math.min(190, Math.round(source.durationSec))),
265
+ },
266
+ };
267
+ case "stems":
268
+ return {
269
+ app: musicStudio_1.MUSIC_OP_APPS.stems,
270
+ input: { audio_url: source.audioUrl, model: "htdemucs_6s", output_format: "wav" },
271
+ };
272
+ default:
273
+ throw new Error(`No fal request for music op ${job.op}`);
274
+ }
275
+ }
276
+ function buildLyricSyncRequest(audioUrl) {
277
+ return { app: musicStudio_1.MUSIC_OP_APPS.lyricSync, input: { audio_url: audioUrl } };
278
+ }
279
+ // ── Output parsers ───────────────────────────────────────────────────────
280
+ function parseAudioOutput(raw, app) {
281
+ const file = (raw.audio ?? raw.audio_file);
282
+ if (!file?.url)
283
+ throw new Error(`fal ${app} returned no audio`);
284
+ const lyrics = typeof raw.lyrics === "string" && app.includes("ace-step") ? raw.lyrics : undefined;
285
+ return {
286
+ url: file.url,
287
+ contentType: file.content_type ?? "audio/mpeg",
288
+ ...(lyrics && lyrics.trim() !== "[inst]" ? { lyrics } : {}),
289
+ ...(typeof raw.tags === "string" ? { tags: raw.tags } : {}),
290
+ ...(typeof raw.seed === "number" ? { seed: raw.seed } : {}),
291
+ };
292
+ }
293
+ function parseStemsOutput(raw) {
294
+ const stems = {};
295
+ for (const name of musicStudio_1.MUSIC_STEMS) {
296
+ const url = raw[name]?.url;
297
+ if (url)
298
+ stems[name] = url;
299
+ }
300
+ if (Object.keys(stems).length === 0)
301
+ throw new Error("fal demucs returned no stems");
302
+ return stems;
303
+ }
304
+ /** Word timings from ElevenLabs Scribe (audio events like "[singing]" and spacing dropped). */
305
+ function parseLyricWords(raw) {
306
+ const words = Array.isArray(raw.words) ? raw.words : [];
307
+ return words
308
+ .filter((w) => w.type === "word" && typeof w.text === "string")
309
+ .map((w) => ({ text: String(w.text), start: Number(w.start) || 0, end: Number(w.end) || 0 }));
310
+ }
@@ -2,4 +2,5 @@ export * from "./falImage.service";
2
2
  export * from "./falUpscale.service";
3
3
  export * from "./falImageTools.service";
4
4
  export * from "./falVideoMatting.service";
5
+ export * from "./falMusic.service";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/fal/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/fal/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC"}
@@ -18,3 +18,4 @@ __exportStar(require("./falImage.service"), exports);
18
18
  __exportStar(require("./falUpscale.service"), exports);
19
19
  __exportStar(require("./falImageTools.service"), exports);
20
20
  __exportStar(require("./falVideoMatting.service"), exports);
21
+ __exportStar(require("./falMusic.service"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"google.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/google/google.service.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAuIlB,qBAAa,aAAc,SAAQ,wBAAwB;IAKzD,OAAO,CAAC,EAAE,CAAc;IACxB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAK;;IAQ/C;;;;;;;;;OASG;IACG,YAAY,CAChB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IAoChC;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAoCvB;;;;OAIG;YACW,kBAAkB;IAsC1B,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAiUjC;;;;;;;OAOG;YACW,iBAAiB;YAoGjB,eAAe;IA4EvB,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAyEjD;;;;OAIG;YACW,oBAAoB;IAkH5B,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;YAiBnB,cAAc;IAkP5B;;;;;;OAMG;IACH;;;;OAIG;IACG,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAIjC,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAY,EAAE,UAAmB,EAAE,SAAiB,EAAE,SAAa,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,iBAAiB,GAAG,MAAM;CAoCpJ"}
1
+ {"version":3,"file":"google.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/google/google.service.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAuIlB,qBAAa,aAAc,SAAQ,wBAAwB;IAKzD,OAAO,CAAC,EAAE,CAAc;IACxB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAK;;IAQ/C;;;;;;;;;OASG;IACG,YAAY,CAChB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IAoChC;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAoCvB;;;;OAIG;YACW,kBAAkB;IAsC1B,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAiUjC;;;;;;;OAOG;YACW,iBAAiB;YAoGjB,eAAe;IAuFvB,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAyEjD;;;;OAIG;YACW,oBAAoB;IAkH5B,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;YAiBnB,cAAc;IAkP5B;;;;;;OAMG;IACH;;;;OAIG;IACG,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAIjC,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAY,EAAE,UAAmB,EAAE,SAAiB,EAAE,SAAa,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,iBAAiB,GAAG,MAAM;CAoCpJ"}
@@ -600,7 +600,15 @@ class GoogleService extends baseAiGenProvider_service_1.BaseAiGenProviderService
600
600
  return { status: types_1.EVideoSceneStatus.PENDING };
601
601
  if (interaction.status !== "completed") {
602
602
  const apiErr = interaction.errors?.[0] ?? interaction.error;
603
- const classified = apiErr ? (0, googleErrors_1.classifyGoogleApiError)({ message: JSON.stringify({ error: apiErr }) }) : null;
603
+ let classified = apiErr ? (0, googleErrors_1.classifyGoogleApiError)({ message: JSON.stringify({ error: apiErr }) }) : null;
604
+ // Omni's opaque "There was a problem processing your request" failure
605
+ // (no status/code) is what it returns for silently-refused prompts or
606
+ // images (prod 2026-10-24: an explicit sexual prompt, and a
607
+ // two-characters image). Not operator-actionable — surface it as a
608
+ // rejected prompt so it doesn't page and the user gets a rephrase hint.
609
+ if (!classified && /problem processing your request/i.test(apiErr?.message ?? "")) {
610
+ classified = new errors_1.UserFacingError((0, errors_1.friendlyMessageForCode)(errors_1.USER_FACING_ERROR_CODES.PROMPT_INVALID), errors_1.USER_FACING_ERROR_CODES.PROMPT_INVALID);
611
+ }
604
612
  return {
605
613
  status: types_1.EVideoSceneStatus.FAILED,
606
614
  errorMessage: classified
@@ -9,6 +9,7 @@ import { IAssetPoolModel } from "../models/assetPool.model";
9
9
  import { IImageJobModel } from "../models/image.model";
10
10
  import { IUpscaleJobModel } from "../models/upscale.model";
11
11
  import { IVideoToolJobModel } from "../models/videoTool.model";
12
+ import { IMusicJobModel } from "../models/musicJob.model";
12
13
  import { IPosterExportJobModel } from "../models/posterExport.model";
13
14
  import { INotificationModel } from "../models/notification.model";
14
15
  import { IRefModel } from "../models/ref.model";
@@ -36,6 +37,7 @@ export declare class FirestoreService {
36
37
  static imageJobsCol: CollectionReference<IImageJobModel, DocumentData>;
37
38
  static upscaleJobsCol: CollectionReference<IUpscaleJobModel, DocumentData>;
38
39
  static videoToolJobsCol: CollectionReference<IVideoToolJobModel, DocumentData>;
40
+ static musicJobsCol: CollectionReference<IMusicJobModel, DocumentData>;
39
41
  static communitySeedCol: CollectionReference<ICommunitySeedModel, DocumentData>;
40
42
  static assetPoolCol: CollectionReference<IAssetPoolModel, DocumentData>;
41
43
  static notificationsCol: CollectionReference<INotificationModel, DocumentData>;
@@ -1 +1 @@
1
- {"version":3,"file":"firestore.service.d.ts","sourceRoot":"","sources":["../../src/services/firestore.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,gBAAgB,EAEhB,aAAa,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AA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;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IAsBlC,8CAA8C;WACjC,UAAU,CAAC,CAAC,EACvB,aAAa,EAAE,mBAAmB,CAAC,CAAC,CAAC,EACrC,EAAE,EAAE,MAAM,EACV,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC,EAC9B,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAwB,GACrD,OAAO,CAAC,IAAI,CAAC;IAWhB,OAAO,CAAC,MAAM,CAAC,aAAa;IA2B5B,0CAA0C;WAC7B,cAAc,CACzB,EAAE,EAAE,MAAM,EACV,cAAc,EAAE,OAAO,CAAC,UAAU,CAAC,GAClC,OAAO,CAAC,IAAI,CAAC;IAIhB,sBAAsB;WACT,UAAU,CAAC,CAAC,EACvB,aAAa,EAAE,mBAAmB,CAAC,CAAC,CAAC,EACrC,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC;IAKhB,kCAAkC;WACrB,cAAc,CAAC,CAAC,EAC3B,OAAO,EAAE,CAAC,EAAE,EAAE,iBAAiB,CAAC,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GACzD,OAAO,CAAC,CAAC,CAAC;CAGd"}
@@ -134,6 +134,9 @@ FirestoreService.upscaleJobsCol = firebase_1.firestore
134
134
  FirestoreService.videoToolJobsCol = firebase_1.firestore
135
135
  .collection("videoToolJobs")
136
136
  .withConverter(collectionConverter());
137
+ FirestoreService.musicJobsCol = firebase_1.firestore
138
+ .collection("musicJobs")
139
+ .withConverter(collectionConverter());
137
140
  FirestoreService.communitySeedCol = firebase_1.firestore
138
141
  .collection("communitySeed")
139
142
  .withConverter(collectionConverter());
@@ -16,6 +16,7 @@ export * from "./tts";
16
16
  export * from "./translation";
17
17
  export * from "./moderation";
18
18
  export * from "./musicGen";
19
+ export * from "./music";
19
20
  export * from "./audioAnalysis";
20
21
  export * from "./asr";
21
22
  export * from "./agent";
@@ -1 +1 @@
1
- {"version":3,"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C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,6CAA6C,CAAC"}
@@ -32,6 +32,7 @@ __exportStar(require("./tts"), exports);
32
32
  __exportStar(require("./translation"), exports);
33
33
  __exportStar(require("./moderation"), exports);
34
34
  __exportStar(require("./musicGen"), exports);
35
+ __exportStar(require("./music"), exports);
35
36
  __exportStar(require("./audioAnalysis"), exports);
36
37
  __exportStar(require("./asr"), exports);
37
38
  __exportStar(require("./agent"), exports);
@@ -0,0 +1,3 @@
1
+ export * from "./musicLyrics";
2
+ export * from "./musicLyricWriter";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/music/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./musicLyrics"), exports);
18
+ __exportStar(require("./musicLyricWriter"), exports);
@@ -0,0 +1,25 @@
1
+ import type { MusicVocalStyle } from "../../models/musicJob.model";
2
+ /**
3
+ * LLM songwriter for the Music Studio: the "Write lyrics" button, and the
4
+ * worker when the chosen model can only sing written lyrics. Returns
5
+ * `[Section]`-tagged lyrics (the shape every music model reads) plus a title.
6
+ */
7
+ export interface LyricWriterInput {
8
+ /** What the song is about — the user's description. */
9
+ idea: string;
10
+ genres?: string[];
11
+ moods?: string[];
12
+ vocalStyle?: MusicVocalStyle;
13
+ /** Language name to write in (e.g. "Spanish"). Defaults to English. */
14
+ language?: string;
15
+ /** Rough target length, used to size the structure. */
16
+ durationSec?: number;
17
+ /** Existing lyrics to revise instead of writing from scratch. */
18
+ draft?: string;
19
+ }
20
+ export interface LyricWriterResult {
21
+ title: string;
22
+ lyrics: string;
23
+ }
24
+ export declare function writeSongLyrics(input: LyricWriterInput): Promise<LyricWriterResult>;
25
+ //# sourceMappingURL=musicLyricWriter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"musicLyricWriter.d.ts","sourceRoot":"","sources":["../../../src/services/music/musicLyricWriter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGnE;;;;GAIG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAgBD,wBAAsB,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA0CzF"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.writeSongLyrics = writeSongLyrics;
4
+ const zod_1 = require("zod");
5
+ const aiModels_1 = require("../../globals/aiModels");
6
+ const musicStudio_1 = require("../../globals/musicStudio");
7
+ const textFallback_1 = require("../aiGen/textFallback");
8
+ const LyricWriterSchema = zod_1.z.object({
9
+ title: zod_1.z.string().min(1).max(80),
10
+ lyrics: zod_1.z.string().min(1),
11
+ });
12
+ /** Section plan sized to the length: short clips get a verse + chorus, full songs the classic arc. */
13
+ function structureFor(durationSec) {
14
+ const sec = durationSec ?? 150;
15
+ if (sec <= 40)
16
+ return "[Verse] (4 lines), [Chorus] (4 lines)";
17
+ if (sec <= 100)
18
+ return "[Verse] (4 lines), [Chorus] (4 lines), [Verse] (4 lines), [Chorus] (4 lines)";
19
+ if (sec <= 200)
20
+ return "[Intro], [Verse] (4–6 lines), [Pre-Chorus] (2 lines), [Chorus] (4 lines), [Verse] (4–6 lines), [Chorus] (4 lines), [Bridge] (2–4 lines), [Chorus] (4 lines), [Outro]";
21
+ return "[Intro], [Verse], [Pre-Chorus], [Chorus], [Verse], [Pre-Chorus], [Chorus], [Bridge], [Verse], [Chorus], [Chorus], [Outro] — 4–6 lines per sung section";
22
+ }
23
+ async function writeSongLyrics(input) {
24
+ const language = input.language?.trim() || "English";
25
+ const style = [input.genres?.join(", "), input.moods?.join(", "), input.vocalStyle ? `${input.vocalStyle} vocals` : ""]
26
+ .filter(Boolean)
27
+ .join("; ");
28
+ const system = [
29
+ "You are a professional songwriter. Write original, singable song lyrics.",
30
+ `Write every lyric line in ${language} (section tags stay in English).`,
31
+ "Tag sections on their own line in square brackets: [Intro], [Verse], [Pre-Chorus], [Chorus], [Bridge], [Outro]. Instrumental sections ([Intro], [Outro], [Instrumental]) have no lines under them.",
32
+ "Keep lines short (under 12 words) with natural rhythm and rhyme; the chorus is memorable and repeats exactly.",
33
+ "Never quote or imitate existing copyrighted lyrics, and never name real artists.",
34
+ `Stay under ${musicStudio_1.MUSIC_LIMITS.maxLyricsChars - 300} characters in total.`,
35
+ 'Respond with JSON: {"title": string, "lyrics": string} — lyrics uses \\n line breaks.',
36
+ ].join("\n");
37
+ const user = [
38
+ `Song idea: ${input.idea.trim() || "an uplifting song about chasing a dream"}`,
39
+ style ? `Style: ${style}` : "",
40
+ `Structure: ${structureFor(input.durationSec)}`,
41
+ input.draft ? `Revise and complete these draft lyrics, keeping their best lines:\n${input.draft.slice(0, musicStudio_1.MUSIC_LIMITS.maxLyricsChars)}` : "",
42
+ ]
43
+ .filter(Boolean)
44
+ .join("\n");
45
+ const { text } = await (0, textFallback_1.generateTextWithFallback)({
46
+ input: [
47
+ { role: "system", content: system },
48
+ { role: "user", content: user },
49
+ ],
50
+ modelKey: aiModels_1.ETextGenModels.OPENAI_GPT_4O_MINI,
51
+ options: { responseFormat: { type: "json_object" } },
52
+ }, "music-lyric-writer");
53
+ const parsed = LyricWriterSchema.parse(JSON.parse(text));
54
+ return {
55
+ title: parsed.title.replace(/^["']|["']$/g, "").trim(),
56
+ lyrics: parsed.lyrics.replace(/\r\n/g, "\n").trim().slice(0, musicStudio_1.MUSIC_LIMITS.maxLyricsChars),
57
+ };
58
+ }
@@ -0,0 +1,66 @@
1
+ import type { MusicTimedLine, MusicVocalStyle } from "../../models/musicJob.model";
2
+ /**
3
+ * Pure lyric / prompt helpers for the Music Studio worker. No I/O, so the
4
+ * provider-shape rules live somewhere testable.
5
+ */
6
+ export interface LyricSection {
7
+ /** Tag name without brackets, e.g. "Verse", "Chorus". "Verse" when the lyrics had none. */
8
+ name: string;
9
+ lines: string[];
10
+ }
11
+ /** Splits `[Verse]` / `[Chorus]`-tagged lyrics into sections. Untagged text is one Verse. */
12
+ export declare function parseLyricSections(lyrics: string): LyricSection[];
13
+ /** The sung lines only — section tags and blank lines dropped. */
14
+ export declare function lyricLines(lyrics: string): string[];
15
+ /**
16
+ * DiffRhythm wants LRC: every line stamped `[mm:ss.xx]`, at least two
17
+ * sections. Lines are paced evenly across the track with a breath between
18
+ * sections, starting after a short intro.
19
+ */
20
+ export declare function toLrc(lyrics: string, durationSec: number): string;
21
+ export interface ElevenLabsSection {
22
+ section_name: string;
23
+ duration_ms: number;
24
+ positive_local_styles: string[];
25
+ negative_local_styles: string[];
26
+ lines: string[];
27
+ }
28
+ /**
29
+ * ElevenLabs composition plan sections from tagged lyrics. Each section gets a
30
+ * share of `totalSec` proportional to its line count (instrumental tags get a
31
+ * fixed share), clamped to the provider's 3–120 s per section; lines are capped
32
+ * at 200 characters. Long untagged lyrics are chunked into 4-line sections so
33
+ * no section has to exceed 120 s.
34
+ */
35
+ export declare function toElevenLabsSections(lyrics: string, totalSec: number): ElevenLabsSection[];
36
+ export interface LyricWord {
37
+ text: string;
38
+ start: number;
39
+ end: number;
40
+ }
41
+ /**
42
+ * Times lyric lines against a word-level transcript of the track. With known
43
+ * lyrics, each line's words are matched in order against the transcript
44
+ * (fuzzy, with a lookahead so ad-libs and misheard words don't derail it);
45
+ * lines that matched nothing are interpolated between their neighbours.
46
+ * Without lyrics the transcript itself is split into lines at pauses.
47
+ */
48
+ export declare function alignLyrics(words: LyricWord[], lyrics: string | undefined, trackSec: number): MusicTimedLine[];
49
+ export interface StylePromptInput {
50
+ prompt: string;
51
+ genres?: string[];
52
+ moods?: string[];
53
+ bpm?: number;
54
+ instrumental: boolean;
55
+ vocalStyle?: MusicVocalStyle;
56
+ language?: string;
57
+ }
58
+ /**
59
+ * One natural-language style brief from the studio's controls. Every model
60
+ * reads genre / mood / tempo / vocal direction from text, so the controls
61
+ * become a leading descriptor line followed by the user's own description.
62
+ */
63
+ export declare function composeStylePrompt(input: StylePromptInput, maxChars: number): string;
64
+ /** Comma-separated tag string for ACE-Step (`tags`). */
65
+ export declare function composeStyleTags(input: StylePromptInput): string;
66
+ //# sourceMappingURL=musicLyrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"musicLyrics.d.ts","sourceRoot":"","sources":["../../../src/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