vidspotai-shared 1.0.136 → 1.0.138

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 (106) hide show
  1. package/lib/globals/aiModels/enums.d.ts +2 -0
  2. package/lib/globals/aiModels/enums.d.ts.map +1 -1
  3. package/lib/globals/aiModels/enums.js +7 -0
  4. package/lib/globals/aiModels/index.d.ts.map +1 -1
  5. package/lib/globals/aiModels/index.js +2 -0
  6. package/lib/globals/film/filmCatalog.d.ts +88 -0
  7. package/lib/globals/film/filmCatalog.d.ts.map +1 -0
  8. package/lib/globals/film/filmCatalog.js +218 -0
  9. package/lib/globals/index.d.ts +2 -0
  10. package/lib/globals/index.d.ts.map +1 -1
  11. package/lib/globals/index.js +2 -0
  12. package/lib/globals/reelRemake.d.ts +116 -0
  13. package/lib/globals/reelRemake.d.ts.map +1 -0
  14. package/lib/globals/reelRemake.js +142 -0
  15. package/lib/globals/types.d.ts +15 -1
  16. package/lib/globals/types.d.ts.map +1 -1
  17. package/lib/globals/types.js +16 -0
  18. package/lib/libs/storage/cdnUrl.d.ts +1 -3
  19. package/lib/libs/storage/cdnUrl.d.ts.map +1 -1
  20. package/lib/libs/storage/cdnUrl.js +8 -6
  21. package/lib/models/filmProject.model.d.ts +424 -0
  22. package/lib/models/filmProject.model.d.ts.map +1 -0
  23. package/lib/models/filmProject.model.js +14 -0
  24. package/lib/models/image.model.d.ts +3 -0
  25. package/lib/models/image.model.d.ts.map +1 -1
  26. package/lib/models/index.d.ts +2 -0
  27. package/lib/models/index.d.ts.map +1 -1
  28. package/lib/models/index.js +2 -0
  29. package/lib/models/reelRemake.model.d.ts +222 -0
  30. package/lib/models/reelRemake.model.d.ts.map +1 -0
  31. package/lib/models/reelRemake.model.js +2 -0
  32. package/lib/models/video.model.d.ts +5 -0
  33. package/lib/models/video.model.d.ts.map +1 -1
  34. package/lib/schemas/film.schema.d.ts +500 -0
  35. package/lib/schemas/film.schema.d.ts.map +1 -0
  36. package/lib/schemas/film.schema.js +201 -0
  37. package/lib/schemas/index.d.ts +1 -0
  38. package/lib/schemas/index.d.ts.map +1 -1
  39. package/lib/schemas/index.js +1 -0
  40. package/lib/services/agent/providerFallback/chains.d.ts.map +1 -1
  41. package/lib/services/agent/providerFallback/chains.js +13 -0
  42. package/lib/services/agent/tools/generateVideo.tool.d.ts.map +1 -1
  43. package/lib/services/agent/tools/generateVideo.tool.js +2 -1
  44. package/lib/services/aiGen/aiGenFactory.service.d.ts.map +1 -1
  45. package/lib/services/aiGen/aiGenFactory.service.js +4 -0
  46. package/lib/services/aiGen/providers/bytedance/bytedance.service.d.ts.map +1 -1
  47. package/lib/services/aiGen/providers/bytedance/bytedance.service.js +17 -0
  48. package/lib/services/aiGen/providers/fal/index.d.ts +1 -0
  49. package/lib/services/aiGen/providers/fal/index.d.ts.map +1 -1
  50. package/lib/services/aiGen/providers/fal/index.js +1 -0
  51. package/lib/services/aiGen/providers/kling/klingRequests.d.ts.map +1 -1
  52. package/lib/services/aiGen/providers/kling/klingRequests.js +3 -0
  53. package/lib/services/aiGen/providers/types.d.ts +6 -0
  54. package/lib/services/aiGen/providers/types.d.ts.map +1 -1
  55. package/lib/services/film/compileShotPrompt.d.ts +16 -0
  56. package/lib/services/film/compileShotPrompt.d.ts.map +1 -0
  57. package/lib/services/film/compileShotPrompt.js +152 -0
  58. package/lib/services/film/filmAssets.d.ts +73 -0
  59. package/lib/services/film/filmAssets.d.ts.map +1 -0
  60. package/lib/services/film/filmAssets.js +341 -0
  61. package/lib/services/film/filmCut.d.ts +159 -0
  62. package/lib/services/film/filmCut.d.ts.map +1 -0
  63. package/lib/services/film/filmCut.js +616 -0
  64. package/lib/services/film/filmPublic.d.ts +9 -0
  65. package/lib/services/film/filmPublic.d.ts.map +1 -0
  66. package/lib/services/film/filmPublic.js +39 -0
  67. package/lib/services/film/filmTakes.d.ts +65 -0
  68. package/lib/services/film/filmTakes.d.ts.map +1 -0
  69. package/lib/services/film/filmTakes.js +168 -0
  70. package/lib/services/film/writersRoom.d.ts +276 -0
  71. package/lib/services/film/writersRoom.d.ts.map +1 -0
  72. package/lib/services/film/writersRoom.js +431 -0
  73. package/lib/services/firestore.service.d.ts +7 -0
  74. package/lib/services/firestore.service.d.ts.map +1 -1
  75. package/lib/services/firestore.service.js +15 -0
  76. package/lib/services/index.d.ts +12 -0
  77. package/lib/services/index.d.ts.map +1 -1
  78. package/lib/services/index.js +12 -0
  79. package/lib/services/providerHealth.service.d.ts +12 -0
  80. package/lib/services/providerHealth.service.d.ts.map +1 -0
  81. package/lib/services/providerHealth.service.js +75 -0
  82. package/lib/services/reelRemake/castDetection.d.ts +56 -0
  83. package/lib/services/reelRemake/castDetection.d.ts.map +1 -0
  84. package/lib/services/reelRemake/castDetection.js +146 -0
  85. package/lib/services/reelRemake/castSuggestion.d.ts +43 -0
  86. package/lib/services/reelRemake/castSuggestion.d.ts.map +1 -0
  87. package/lib/services/reelRemake/castSuggestion.js +99 -0
  88. package/lib/services/reelRemake/keyframeSwap.d.ts +44 -0
  89. package/lib/services/reelRemake/keyframeSwap.d.ts.map +1 -0
  90. package/lib/services/reelRemake/keyframeSwap.js +139 -0
  91. package/lib/services/reelRemake/shootPlan.d.ts +65 -0
  92. package/lib/services/reelRemake/shootPlan.d.ts.map +1 -0
  93. package/lib/services/reelRemake/shootPlan.js +193 -0
  94. package/lib/services/reelRemake/stopWork.d.ts +54 -0
  95. package/lib/services/reelRemake/stopWork.d.ts.map +1 -0
  96. package/lib/services/reelRemake/stopWork.js +91 -0
  97. package/lib/services/translation/translation.service.d.ts +10 -1
  98. package/lib/services/translation/translation.service.d.ts.map +1 -1
  99. package/lib/services/translation/translation.service.js +34 -1
  100. package/lib/utils/errors.d.ts +3 -0
  101. package/lib/utils/errors.d.ts.map +1 -1
  102. package/lib/utils/errors.js +6 -0
  103. package/lib/utils/helpers.d.ts +1 -1
  104. package/lib/utils/helpers.d.ts.map +1 -1
  105. package/lib/utils/helpers.js +2 -1
  106. package/package.json +1 -1
@@ -0,0 +1,431 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FILM_WRITE_DEFAULTS = exports.FilmSingleShotDraftSchema = exports.FilmSceneShotsDraftSchema = exports.FilmEpisodeDraftSchema = exports.FilmBibleDraftSchema = void 0;
4
+ exports.resolveTargetSeconds = resolveTargetSeconds;
5
+ exports.draftFilmBible = draftFilmBible;
6
+ exports.draftFilmEpisode = draftFilmEpisode;
7
+ exports.draftFilmScene = draftFilmScene;
8
+ exports.draftFilmShot = draftFilmShot;
9
+ exports.materializeBible = materializeBible;
10
+ exports.materializeShot = materializeShot;
11
+ exports.materializeEpisode = materializeEpisode;
12
+ exports.describeShot = describeShot;
13
+ exports.storyContextOf = storyContextOf;
14
+ /**
15
+ * Film Studio Writers' Room — logline → story bible → per-episode shot lists.
16
+ *
17
+ * Two LLM passes, both structured output:
18
+ * 1. Bible: title, logline, synopsis, look, cast, locations, episode outlines.
19
+ * 2. Episode (one call per episode, run concurrently by the worker): scenes,
20
+ * each broken into shots with framing, camera moves, action, cast and dialogue.
21
+ * Narrower rewrites (scene, shot) reuse the same prompt pieces.
22
+ *
23
+ * Draft schemas are strict-mode friendly (every key required, `null` for "none",
24
+ * no min/max) because OpenAI's strict json_schema rejects optional keys. Limits
25
+ * and catalog checks are applied afterwards by the `materialize*` functions,
26
+ * which are pure so they're unit-tested without an LLM.
27
+ */
28
+ const node_crypto_1 = require("node:crypto");
29
+ const zod_1 = require("zod");
30
+ const filmCatalog_1 = require("../../globals/film/filmCatalog");
31
+ const film_schema_1 = require("../../schemas/film.schema");
32
+ const modelRouter_1 = require("../agent/modelRouter");
33
+ // ─── Draft schemas (what the LLM returns) ────────────────────────────────────
34
+ const keysOf = (options) => options.map((o) => o.key);
35
+ const nullableKey = (options) => zod_1.z.enum(keysOf(options)).nullable();
36
+ const LookDraftSchema = zod_1.z.object({
37
+ genre: nullableKey(filmCatalog_1.FILM_LOOK_CATALOG.genre),
38
+ era: nullableKey(filmCatalog_1.FILM_LOOK_CATALOG.era),
39
+ tempo: nullableKey(filmCatalog_1.FILM_LOOK_CATALOG.tempo),
40
+ cameraBody: nullableKey(filmCatalog_1.FILM_LOOK_CATALOG.cameraBody),
41
+ lens: nullableKey(filmCatalog_1.FILM_LOOK_CATALOG.lens),
42
+ focalLength: nullableKey(filmCatalog_1.FILM_LOOK_CATALOG.focalLength),
43
+ aperture: nullableKey(filmCatalog_1.FILM_LOOK_CATALOG.aperture),
44
+ palette: nullableKey(filmCatalog_1.FILM_LOOK_CATALOG.palette),
45
+ lighting: nullableKey(filmCatalog_1.FILM_LOOK_CATALOG.lighting),
46
+ });
47
+ exports.FilmBibleDraftSchema = zod_1.z.object({
48
+ title: zod_1.z.string(),
49
+ logline: zod_1.z.string(),
50
+ synopsis: zod_1.z.string(),
51
+ look: LookDraftSchema,
52
+ cast: zod_1.z.array(zod_1.z.object({
53
+ name: zod_1.z.string(),
54
+ role: zod_1.z.enum(["lead", "supporting", "extra"]),
55
+ description: zod_1.z.string(),
56
+ })),
57
+ locations: zod_1.z.array(zod_1.z.object({ name: zod_1.z.string(), description: zod_1.z.string() })),
58
+ episodes: zod_1.z.array(zod_1.z.object({
59
+ title: zod_1.z.string(),
60
+ synopsis: zod_1.z.string(),
61
+ cliffhanger: zod_1.z.string().nullable(),
62
+ })),
63
+ });
64
+ const ShotDraftSchema = zod_1.z.object({
65
+ shotType: zod_1.z.enum(keysOf(filmCatalog_1.FILM_SHOT_TYPES)),
66
+ cameraMoves: zod_1.z.array(zod_1.z.enum(keysOf(filmCatalog_1.FILM_CAMERA_MOVES))),
67
+ durationSec: zod_1.z.number(),
68
+ action: zod_1.z.string(),
69
+ /** Cast member names, exactly as in the bible. */
70
+ cast: zod_1.z.array(zod_1.z.string()),
71
+ dialogue: zod_1.z.array(zod_1.z.object({ speaker: zod_1.z.string(), line: zod_1.z.string(), delivery: zod_1.z.string().nullable() })),
72
+ sfx: zod_1.z.string().nullable(),
73
+ });
74
+ const SceneDraftSchema = zod_1.z.object({
75
+ heading: zod_1.z.string(),
76
+ summary: zod_1.z.string(),
77
+ /** A location name from the bible, or null. */
78
+ location: zod_1.z.string().nullable(),
79
+ shots: zod_1.z.array(ShotDraftSchema),
80
+ });
81
+ exports.FilmEpisodeDraftSchema = zod_1.z.object({ scenes: zod_1.z.array(SceneDraftSchema) });
82
+ exports.FilmSceneShotsDraftSchema = zod_1.z.object({ summary: zod_1.z.string(), shots: zod_1.z.array(ShotDraftSchema) });
83
+ exports.FilmSingleShotDraftSchema = zod_1.z.object({ shot: ShotDraftSchema });
84
+ // ─── Defaults ────────────────────────────────────────────────────────────────
85
+ exports.FILM_WRITE_DEFAULTS = {
86
+ /** Whole-film runtime target. */
87
+ filmSeconds: 90,
88
+ /** Per-episode runtime target for a reel drama. */
89
+ episodeSeconds: 60,
90
+ episodeCount: 5,
91
+ minSeconds: 15,
92
+ maxSeconds: 600,
93
+ };
94
+ function resolveTargetSeconds(format, requested) {
95
+ const base = format === "film" ? exports.FILM_WRITE_DEFAULTS.filmSeconds : exports.FILM_WRITE_DEFAULTS.episodeSeconds;
96
+ const v = requested ?? base;
97
+ return Math.min(exports.FILM_WRITE_DEFAULTS.maxSeconds, Math.max(exports.FILM_WRITE_DEFAULTS.minSeconds, Math.round(v)));
98
+ }
99
+ // ─── Prompts ─────────────────────────────────────────────────────────────────
100
+ const optionList = (options) => options.map((o) => `${o.key} (${o.hint})`).join("; ");
101
+ function craftRules(format, spec) {
102
+ const formatRules = format === "series"
103
+ ? [
104
+ "This is a vertical reel drama for TikTok, Reels and Shorts.",
105
+ "Hook the viewer in the first 3 seconds of every episode: open on conflict, a reveal or a striking image, never on setup.",
106
+ "Every episode ends on a cliffhanger that makes the next episode feel urgent.",
107
+ "Favour close-ups, medium-close and over-the-shoulder framing: the frame is tall and small.",
108
+ "Big, legible emotions. Secrets, betrayals, reversals. Keep the cast small.",
109
+ ]
110
+ : [
111
+ "This is a cinematic short film. Give it a clear beginning, turn and ending.",
112
+ "Vary scale: establish, then move in for emotion. Earn the close-ups.",
113
+ ];
114
+ return [
115
+ ...formatRules,
116
+ `Each shot is ONE continuous clip from an AI video model (${spec.label}), ${spec.minDurationSec}–${spec.maxDurationSec} seconds long.`,
117
+ "A shot holds one visible action beat. Write only what the camera sees and hears, in present tense. No camera jargon in the action (that goes in shotType/cameraMoves), no inner thoughts, no 'we see'.",
118
+ "Use at most 2 camera moves per shot; most shots need 0 or 1. Static is fine.",
119
+ "Name characters exactly as in the cast list. Put every character who is visible in the shot in `cast`.",
120
+ "Dialogue is short and spoken: about 2.5 words per second of shot, at most 2 lines per shot. Speakers must be in that shot's cast.",
121
+ spec.nativeAudio
122
+ ? "The model voices dialogue and sound in-shot, so write lines that can be performed in one take."
123
+ : "The model is silent; dialogue is dubbed later, so keep lines tight.",
124
+ "Keep characters' looks, wardrobe and props continuous between shots.",
125
+ "Write all story text (titles, synopsis, action, dialogue) in the language of the premise. Catalog keys stay as given.",
126
+ ].join("\n- ");
127
+ }
128
+ function bibleSystemPrompt(format, spec) {
129
+ return [
130
+ "You are the head writer of a film studio that shoots entirely with AI video models.",
131
+ "Turn the premise into a story bible.",
132
+ "",
133
+ "Rules:\n- " + craftRules(format, spec),
134
+ "",
135
+ "Bible rules:",
136
+ "- Cast descriptions are casting-sheet physical descriptions (age, build, face, hair, wardrobe, one distinctive detail) because they are pasted into every shot to keep the character consistent. No personality in the description.",
137
+ `- At most ${film_schema_1.FILM_LIMITS.cast} cast members; most stories need 2–5.`,
138
+ `- Locations are recurring sets, described visually. At most ${film_schema_1.FILM_LIMITS.locations}; most stories need 2–5.`,
139
+ "- Pick a look that suits the story. Use null for anything that should stay neutral.",
140
+ "",
141
+ `Look options. genre: ${optionList(filmCatalog_1.FILM_LOOK_CATALOG.genre)}`,
142
+ `era: ${optionList(filmCatalog_1.FILM_LOOK_CATALOG.era)}`,
143
+ `tempo: ${optionList(filmCatalog_1.FILM_LOOK_CATALOG.tempo)}`,
144
+ `cameraBody: ${optionList(filmCatalog_1.FILM_LOOK_CATALOG.cameraBody)}`,
145
+ `lens: ${optionList(filmCatalog_1.FILM_LOOK_CATALOG.lens)}`,
146
+ `focalLength: ${optionList(filmCatalog_1.FILM_LOOK_CATALOG.focalLength)}`,
147
+ `aperture: ${optionList(filmCatalog_1.FILM_LOOK_CATALOG.aperture)}`,
148
+ `palette: ${optionList(filmCatalog_1.FILM_LOOK_CATALOG.palette)}`,
149
+ `lighting: ${optionList(filmCatalog_1.FILM_LOOK_CATALOG.lighting)}`,
150
+ ].join("\n");
151
+ }
152
+ function shotsSystemPrompt(format, spec) {
153
+ return [
154
+ "You are the director breaking a screenplay into a shot list for a film studio that shoots entirely with AI video models.",
155
+ "",
156
+ "Rules:\n- " + craftRules(format, spec),
157
+ "",
158
+ `shotType options: ${optionList(filmCatalog_1.FILM_SHOT_TYPES)}`,
159
+ `cameraMoves options: ${optionList(filmCatalog_1.FILM_CAMERA_MOVES)}`,
160
+ ].join("\n");
161
+ }
162
+ function storyContextText(ctx) {
163
+ const cast = ctx.cast.length
164
+ ? ctx.cast.map((c) => `- ${c.name} (${c.role}): ${c.description}`).join("\n")
165
+ : "- (no cast yet: invent none, keep shots unpopulated or use unnamed background people in the action)";
166
+ const locations = ctx.locations.length
167
+ ? ctx.locations.map((l) => `- ${l.name}: ${l.description}`).join("\n")
168
+ : "- (none)";
169
+ return [
170
+ `Title: ${ctx.title}`,
171
+ ctx.logline ? `Logline: ${ctx.logline}` : "",
172
+ ctx.synopsis ? `Synopsis: ${ctx.synopsis}` : "",
173
+ `Cast:\n${cast}`,
174
+ `Locations:\n${locations}`,
175
+ ]
176
+ .filter(Boolean)
177
+ .join("\n\n");
178
+ }
179
+ function shotBudget(targetSeconds, spec) {
180
+ const avg = Math.min(spec.maxDurationSec, Math.max(spec.minDurationSec, 6));
181
+ const shots = Math.max(1, Math.round(targetSeconds / avg));
182
+ return `Aim for about ${targetSeconds} seconds in total: roughly ${shots} shots averaging ${avg}s. Durations are whole seconds between ${spec.minDurationSec} and ${spec.maxDurationSec}.`;
183
+ }
184
+ function models(deps) {
185
+ const router = deps.router ?? new modelRouter_1.ModelRouter();
186
+ return { model: router.pickFor("planner"), fallbackModel: router.fallbackFor("planner") };
187
+ }
188
+ async function draftFilmBible(deps, input) {
189
+ const spec = (0, filmCatalog_1.getFilmVideoModelSpec)(input.videoModel);
190
+ const episodesAsk = input.format === "series"
191
+ ? `Outline exactly ${input.episodeCount} episodes of about ${input.targetSeconds} seconds each, each with a cliffhanger.`
192
+ : `Outline exactly 1 episode: the whole film, about ${input.targetSeconds} seconds long. Use its title for the film title and set cliffhanger to null.`;
193
+ const locked = filmCatalog_1.FILM_LOOK_FIELDS.filter((f) => input.lockedLook[f]).map((f) => `${f}=${input.lockedLook[f]}`);
194
+ const user = [
195
+ `Premise: ${input.premise}`,
196
+ input.title ? `Working title: ${input.title}` : "",
197
+ episodesAsk,
198
+ locked.length ? `The director already chose this look; keep it: ${locked.join(", ")}.` : "",
199
+ ]
200
+ .filter(Boolean)
201
+ .join("\n\n");
202
+ const { data } = await deps.llm.structured({
203
+ ...models(deps),
204
+ messages: [
205
+ { role: "system", content: bibleSystemPrompt(input.format, spec) },
206
+ { role: "user", content: user },
207
+ ],
208
+ schema: exports.FilmBibleDraftSchema,
209
+ schemaName: "FilmBible",
210
+ temperature: 0.8,
211
+ maxTokens: 6000,
212
+ });
213
+ return exports.FilmBibleDraftSchema.parse(data);
214
+ }
215
+ async function draftFilmEpisode(deps, input) {
216
+ const spec = (0, filmCatalog_1.getFilmVideoModelSpec)(input.videoModel);
217
+ const ep = input.episode;
218
+ const user = [
219
+ storyContextText(input.story),
220
+ input.story.format === "series"
221
+ ? [
222
+ `Write episode ${ep.index}: "${ep.title}".`,
223
+ ep.synopsis ? `Episode synopsis: ${ep.synopsis}` : "",
224
+ ep.cliffhanger ? `It must end on: ${ep.cliffhanger}` : "",
225
+ input.previousSynopsis ? `Previously: ${input.previousSynopsis}` : "",
226
+ input.nextSynopsis ? `Next episode (set it up, don't spoil it): ${input.nextSynopsis}` : "",
227
+ ]
228
+ .filter(Boolean)
229
+ .join("\n")
230
+ : `Write the whole film as scenes and shots.${ep.synopsis ? `\nStory: ${ep.synopsis}` : ""}`,
231
+ "Break it into scenes (a scene = one place and time; heading in screenplay style like 'INT. DINER - NIGHT'), each with its shots in order. Set each scene's location to a location name from the list, or null.",
232
+ shotBudget(input.targetSeconds, spec),
233
+ input.note ? `Director's note: ${input.note}` : "",
234
+ ]
235
+ .filter(Boolean)
236
+ .join("\n\n");
237
+ const { data } = await deps.llm.structured({
238
+ ...models(deps),
239
+ messages: [
240
+ { role: "system", content: shotsSystemPrompt(input.story.format, spec) },
241
+ { role: "user", content: user },
242
+ ],
243
+ schema: exports.FilmEpisodeDraftSchema,
244
+ schemaName: "FilmEpisodeShotList",
245
+ temperature: 0.7,
246
+ maxTokens: 10000,
247
+ });
248
+ return exports.FilmEpisodeDraftSchema.parse(data);
249
+ }
250
+ async function draftFilmScene(deps, input) {
251
+ const spec = (0, filmCatalog_1.getFilmVideoModelSpec)(input.videoModel);
252
+ const user = [
253
+ storyContextText(input.story),
254
+ input.episodeSynopsis ? `This episode: ${input.episodeSynopsis}` : "",
255
+ `Rewrite the shot list for the scene "${input.scene.heading}".`,
256
+ input.scene.summary ? `Scene summary: ${input.scene.summary}` : "",
257
+ input.scene.location ? `Location: ${input.scene.location}` : "",
258
+ input.previousScene ? `Previous scene: ${input.previousScene}` : "",
259
+ input.nextScene ? `Next scene: ${input.nextScene}` : "",
260
+ shotBudget(input.targetSeconds, spec),
261
+ "Also return a one-sentence summary of the scene as rewritten.",
262
+ input.note ? `Director's note: ${input.note}` : "",
263
+ ]
264
+ .filter(Boolean)
265
+ .join("\n\n");
266
+ const { data } = await deps.llm.structured({
267
+ ...models(deps),
268
+ messages: [
269
+ { role: "system", content: shotsSystemPrompt(input.story.format, spec) },
270
+ { role: "user", content: user },
271
+ ],
272
+ schema: exports.FilmSceneShotsDraftSchema,
273
+ schemaName: "FilmSceneShotList",
274
+ temperature: 0.7,
275
+ maxTokens: 4000,
276
+ });
277
+ return exports.FilmSceneShotsDraftSchema.parse(data);
278
+ }
279
+ async function draftFilmShot(deps, input) {
280
+ const spec = (0, filmCatalog_1.getFilmVideoModelSpec)(input.videoModel);
281
+ const user = [
282
+ storyContextText(input.story),
283
+ `Scene: ${input.scene.heading}${input.scene.summary ? ` (${input.scene.summary})` : ""}${input.scene.location ? `, at ${input.scene.location}` : ""}.`,
284
+ input.previousShot ? `Shot before: ${input.previousShot}` : "",
285
+ `Shot to rewrite: ${input.current}`,
286
+ input.nextShot ? `Shot after: ${input.nextShot}` : "",
287
+ "Rewrite this one shot so it plays better and still flows from the shot before into the shot after.",
288
+ input.note ? `Director's note: ${input.note}` : "",
289
+ ]
290
+ .filter(Boolean)
291
+ .join("\n\n");
292
+ const { data } = await deps.llm.structured({
293
+ ...models(deps),
294
+ messages: [
295
+ { role: "system", content: shotsSystemPrompt(input.story.format, spec) },
296
+ { role: "user", content: user },
297
+ ],
298
+ schema: exports.FilmSingleShotDraftSchema,
299
+ schemaName: "FilmShot",
300
+ temperature: 0.8,
301
+ maxTokens: 1500,
302
+ });
303
+ return exports.FilmSingleShotDraftSchema.parse(data).shot;
304
+ }
305
+ // ─── Materialize (draft → stored models). Pure. ──────────────────────────────
306
+ const clip = (s, max) => (s ?? "").trim().slice(0, max);
307
+ const shortId = (prefix) => `${prefix}_${(0, node_crypto_1.randomUUID)().replace(/-/g, "").slice(0, 12)}`;
308
+ const norm = (s) => s.trim().toLowerCase();
309
+ function materializeBible(draft, opts) {
310
+ const look = {};
311
+ for (const field of filmCatalog_1.FILM_LOOK_FIELDS) {
312
+ const v = opts.lockedLook[field] ?? draft.look[field] ?? undefined;
313
+ if (v && filmCatalog_1.FILM_LOOK_CATALOG[field].some((o) => o.key === v))
314
+ look[field] = v;
315
+ }
316
+ const seenNames = new Set();
317
+ const cast = [];
318
+ for (const c of draft.cast) {
319
+ const name = clip(c.name, 60);
320
+ if (!name || seenNames.has(norm(name)) || cast.length >= film_schema_1.FILM_LIMITS.cast)
321
+ continue;
322
+ seenNames.add(norm(name));
323
+ cast.push({ id: shortId("cast"), name, role: c.role, description: clip(c.description, 600) });
324
+ }
325
+ const seenLocations = new Set();
326
+ const locations = [];
327
+ for (const l of draft.locations) {
328
+ const name = clip(l.name, 80);
329
+ if (!name || seenLocations.has(norm(name)) || locations.length >= film_schema_1.FILM_LIMITS.locations)
330
+ continue;
331
+ seenLocations.add(norm(name));
332
+ locations.push({ id: shortId("loc"), name, description: clip(l.description, 600) });
333
+ }
334
+ const wanted = opts.format === "film" ? 1 : Math.min(film_schema_1.FILM_LIMITS.episodes, Math.max(1, opts.episodeCount));
335
+ const outlines = draft.episodes.slice(0, wanted);
336
+ while (outlines.length < wanted) {
337
+ outlines.push({ title: `Episode ${outlines.length + 1}`, synopsis: "", cliffhanger: null });
338
+ }
339
+ const title = clip(draft.title, 120) || opts.fallbackTitle;
340
+ const episodes = outlines.map((e, i) => {
341
+ const ep = {
342
+ id: shortId("ep"),
343
+ index: i + 1,
344
+ title: opts.format === "film" ? title : clip(e.title, 120) || `Episode ${i + 1}`,
345
+ scenes: [],
346
+ };
347
+ const synopsis = clip(e.synopsis, 2000);
348
+ if (synopsis)
349
+ ep.synopsis = synopsis;
350
+ const cliffhanger = opts.format === "series" ? clip(e.cliffhanger, 500) : "";
351
+ if (cliffhanger)
352
+ ep.cliffhanger = cliffhanger;
353
+ return ep;
354
+ });
355
+ return {
356
+ title,
357
+ logline: clip(draft.logline, 500),
358
+ synopsis: clip(draft.synopsis, 4000),
359
+ look,
360
+ cast,
361
+ locations,
362
+ episodes,
363
+ };
364
+ }
365
+ function materializeShot(draft, ctx) {
366
+ const byName = new Map(ctx.cast.map((c) => [norm(c.name), c.id]));
367
+ const castIds = [...new Set(draft.cast.map((n) => byName.get(norm(n))).filter((id) => Boolean(id)))];
368
+ const dialogue = [];
369
+ for (const d of draft.dialogue) {
370
+ const castId = byName.get(norm(d.speaker));
371
+ const line = clip(d.line, 400);
372
+ if (!castId || !line || dialogue.length >= film_schema_1.FILM_LIMITS.dialoguePerShot)
373
+ continue;
374
+ if (!castIds.includes(castId))
375
+ castIds.push(castId);
376
+ const delivery = clip(d.delivery, 60);
377
+ dialogue.push({ castId, line, ...(delivery ? { delivery } : {}) });
378
+ }
379
+ const validMoves = new Set(filmCatalog_1.FILM_CAMERA_MOVES.map((o) => o.key));
380
+ const cameraMoves = [...new Set(draft.cameraMoves.filter((m) => validMoves.has(m)))].slice(0, film_schema_1.FILM_LIMITS.cameraMovesPerShot);
381
+ const rawDuration = Number.isFinite(draft.durationSec) ? Math.round(draft.durationSec) : 5;
382
+ const durationSec = Math.min(ctx.spec.maxDurationSec, Math.max(ctx.spec.minDurationSec, rawDuration));
383
+ const sfx = clip(draft.sfx, 300);
384
+ return {
385
+ ...(filmCatalog_1.FILM_SHOT_TYPES.some((o) => o.key === draft.shotType) ? { shotType: draft.shotType } : {}),
386
+ cameraMoves,
387
+ durationSec,
388
+ action: clip(draft.action, 1500),
389
+ castIds,
390
+ ...(ctx.locationId ? { locationId: ctx.locationId } : {}),
391
+ dialogue,
392
+ ...(sfx ? { sfx } : {}),
393
+ };
394
+ }
395
+ function materializeEpisode(draft, ctx) {
396
+ const spec = (0, filmCatalog_1.getFilmVideoModelSpec)(ctx.videoModel);
397
+ const locationByName = new Map(ctx.locations.map((l) => [norm(l.name), l.id]));
398
+ const scenes = [];
399
+ let shotCount = 0;
400
+ for (const s of draft.scenes.slice(0, film_schema_1.FILM_LIMITS.scenesPerEpisode)) {
401
+ const locationId = s.location ? locationByName.get(norm(s.location)) : undefined;
402
+ const scene = { id: shortId("sc"), heading: clip(s.heading, 120) || `Scene ${scenes.length + 1}` };
403
+ const summary = clip(s.summary, 1000);
404
+ if (summary)
405
+ scene.summary = summary;
406
+ if (locationId)
407
+ scene.locationId = locationId;
408
+ const room = film_schema_1.FILM_LIMITS.shotsPerEpisode - shotCount;
409
+ const shots = s.shots.slice(0, Math.max(0, room)).map((d) => materializeShot(d, { cast: ctx.cast, locationId, spec }));
410
+ shotCount += shots.length;
411
+ scenes.push({ scene, shots });
412
+ }
413
+ return scenes;
414
+ }
415
+ /** One-line description of a stored shot, for neighbour context in rewrites. */
416
+ function describeShot(shot, cast) {
417
+ const names = new Map(cast.map((c) => [c.id, c.name]));
418
+ const type = filmCatalog_1.FILM_SHOT_TYPES.find((o) => o.key === shot.shotType)?.label;
419
+ const lines = shot.dialogue.map((d) => `${names.get(d.castId) ?? "Someone"}: "${d.line}"`).join(" ");
420
+ return [type, shot.action, lines].filter(Boolean).join(" — ");
421
+ }
422
+ function storyContextOf(project) {
423
+ return {
424
+ format: project.format,
425
+ title: project.title,
426
+ logline: project.logline,
427
+ synopsis: project.synopsis,
428
+ cast: project.cast,
429
+ locations: project.locations,
430
+ };
431
+ }
@@ -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 { IReelRemakeModel } from "../models/reelRemake.model";
12
13
  import { IMusicJobModel } from "../models/musicJob.model";
13
14
  import { IPosterExportJobModel } from "../models/posterExport.model";
14
15
  import { INotificationModel } from "../models/notification.model";
@@ -27,6 +28,7 @@ import { IOutreachCampaignModel, IOutreachRecipientModel, IOutreachTemplateModel
27
28
  import { IApiKeyModel, IWebhookSubscriptionModel } from "../models/outreachIntegration.model";
28
29
  import { IOrganizationBrandKitModel, IOrganizationCreditLedgerEntry, IOrganizationInviteModel, IOrganizationMemberModel, IOrganizationModel } from "../models/organization.model";
29
30
  import { IPosterProjectModel } from "../models/posterProject.model";
31
+ import { IFilmProjectModel, IFilmShareModel, IFilmShotModel, IFilmShowcaseModel } from "../models/filmProject.model";
30
32
  /**
31
33
  * FirestoreService
32
34
  * ----------------
@@ -37,6 +39,7 @@ export declare class FirestoreService {
37
39
  static imageJobsCol: CollectionReference<IImageJobModel, DocumentData>;
38
40
  static upscaleJobsCol: CollectionReference<IUpscaleJobModel, DocumentData>;
39
41
  static videoToolJobsCol: CollectionReference<IVideoToolJobModel, DocumentData>;
42
+ static reelRemakesCol: CollectionReference<IReelRemakeModel, DocumentData>;
40
43
  static musicJobsCol: CollectionReference<IMusicJobModel, DocumentData>;
41
44
  static communitySeedCol: CollectionReference<ICommunitySeedModel, DocumentData>;
42
45
  static assetPoolCol: CollectionReference<IAssetPoolModel, DocumentData>;
@@ -67,6 +70,10 @@ export declare class FirestoreService {
67
70
  static assetCacheRawCol: CollectionReference<ICachedRawAssetModel, DocumentData>;
68
71
  static brandKitsCol: CollectionReference<IBrandKitModel, DocumentData>;
69
72
  static posterProjectsCol: CollectionReference<IPosterProjectModel, DocumentData>;
73
+ static filmProjectsCol: CollectionReference<IFilmProjectModel, DocumentData>;
74
+ static filmShotsCol: CollectionReference<IFilmShotModel, DocumentData>;
75
+ static filmSharesCol: CollectionReference<IFilmShareModel, DocumentData>;
76
+ static filmShowcaseCol: CollectionReference<IFilmShowcaseModel, DocumentData>;
70
77
  static posterExportsCol: CollectionReference<IPosterExportJobModel, DocumentData>;
71
78
  static styleMemoryCol: CollectionReference<IStyleMemoryModel, DocumentData>;
72
79
  static agentProjectsCol: CollectionReference<IAgentProjectModel, 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;AAC/B,OAA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.firestore
135
135
  .collection("videoToolJobs")
136
136
  .withConverter(collectionConverter());
137
+ FirestoreService.reelRemakesCol = firebase_1.firestore
138
+ .collection("reelRemakes")
139
+ .withConverter(collectionConverter());
137
140
  FirestoreService.musicJobsCol = firebase_1.firestore
138
141
  .collection("musicJobs")
139
142
  .withConverter(collectionConverter());
@@ -167,6 +170,18 @@ FirestoreService.brandKitsCol = firebase_1.firestore
167
170
  FirestoreService.posterProjectsCol = firebase_1.firestore
168
171
  .collection("posterProjects")
169
172
  .withConverter(collectionConverter());
173
+ FirestoreService.filmProjectsCol = firebase_1.firestore
174
+ .collection("filmProjects")
175
+ .withConverter(collectionConverter());
176
+ FirestoreService.filmShotsCol = firebase_1.firestore
177
+ .collection("filmShots")
178
+ .withConverter(collectionConverter());
179
+ FirestoreService.filmSharesCol = firebase_1.firestore
180
+ .collection("filmShares")
181
+ .withConverter(collectionConverter());
182
+ FirestoreService.filmShowcaseCol = firebase_1.firestore
183
+ .collection("filmShowcase")
184
+ .withConverter(collectionConverter());
170
185
  FirestoreService.posterExportsCol = firebase_1.firestore
171
186
  .collection("posterExports")
172
187
  .withConverter(collectionConverter());
@@ -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";
@@ -46,4 +47,15 @@ export * from "./brandKit.service";
46
47
  export * from "./email";
47
48
  export * from "./assetPool";
48
49
  export * from "./klingElements/klingElementLibrary.service";
50
+ export * from "./film/compileShotPrompt";
51
+ export * from "./film/writersRoom";
52
+ export * from "./film/filmAssets";
53
+ export * from "./film/filmTakes";
54
+ export * from "./film/filmCut";
55
+ export * from "./reelRemake/castDetection";
56
+ export * from "./reelRemake/castSuggestion";
57
+ export * from "./reelRemake/keyframeSwap";
58
+ export * from "./reelRemake/shootPlan";
59
+ export * from "./reelRemake/stopWork";
60
+ export * from "./film/filmPublic";
49
61
  //# sourceMappingURL=index.d.ts.map
@@ -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,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qCAAqC,CAAC;AACpD,cAAc,qBAAqB,CAAC;AACpC,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;AA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AC;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;AAC5D,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
@@ -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);
@@ -62,3 +63,14 @@ __exportStar(require("./brandKit.service"), exports);
62
63
  __exportStar(require("./email"), exports);
63
64
  __exportStar(require("./assetPool"), exports);
64
65
  __exportStar(require("./klingElements/klingElementLibrary.service"), exports);
66
+ __exportStar(require("./film/compileShotPrompt"), exports);
67
+ __exportStar(require("./film/writersRoom"), exports);
68
+ __exportStar(require("./film/filmAssets"), exports);
69
+ __exportStar(require("./film/filmTakes"), exports);
70
+ __exportStar(require("./film/filmCut"), exports);
71
+ __exportStar(require("./reelRemake/castDetection"), exports);
72
+ __exportStar(require("./reelRemake/castSuggestion"), exports);
73
+ __exportStar(require("./reelRemake/keyframeSwap"), exports);
74
+ __exportStar(require("./reelRemake/shootPlan"), exports);
75
+ __exportStar(require("./reelRemake/stopWork"), exports);
76
+ __exportStar(require("./film/filmPublic"), 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"}