vidspotai-shared 1.0.82 → 1.0.84

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 (442) hide show
  1. package/lib/globals/aiModels/enums.d.ts +11 -1
  2. package/lib/globals/aiModels/enums.d.ts.map +1 -1
  3. package/lib/globals/aiModels/enums.js +24 -1
  4. package/lib/globals/aiModels/index.d.ts.map +1 -1
  5. package/lib/globals/aiModels/index.js +2 -0
  6. package/lib/globals/aiModels/providers/anthropic.d.ts +12 -0
  7. package/lib/globals/aiModels/providers/anthropic.d.ts.map +1 -0
  8. package/lib/globals/aiModels/providers/anthropic.js +88 -0
  9. package/lib/globals/aiModels/providers/google.d.ts.map +1 -1
  10. package/lib/globals/aiModels/providers/google.js +82 -0
  11. package/lib/globals/aiModels/providers/openai.d.ts.map +1 -1
  12. package/lib/globals/aiModels/providers/openai.js +63 -4
  13. package/lib/globals/aiModels/tierHelpers.d.ts +12 -0
  14. package/lib/globals/aiModels/tierHelpers.d.ts.map +1 -1
  15. package/lib/globals/aiModels/tierHelpers.js +83 -0
  16. package/lib/globals/aiModels/types.d.ts +19 -0
  17. package/lib/globals/aiModels/types.d.ts.map +1 -1
  18. package/lib/globals/types.d.ts +120 -1
  19. package/lib/globals/types.d.ts.map +1 -1
  20. package/lib/globals/types.js +135 -1
  21. package/lib/models/agent.model.d.ts +41 -1
  22. package/lib/models/agent.model.d.ts.map +1 -1
  23. package/lib/models/index.d.ts +1 -0
  24. package/lib/models/index.d.ts.map +1 -1
  25. package/lib/models/index.js +1 -0
  26. package/lib/models/social.model.d.ts +180 -0
  27. package/lib/models/social.model.d.ts.map +1 -0
  28. package/lib/models/social.model.js +2 -0
  29. package/lib/models/user.model.d.ts +10 -0
  30. package/lib/models/user.model.d.ts.map +1 -1
  31. package/lib/models/video.model.d.ts +6 -0
  32. package/lib/models/video.model.d.ts.map +1 -1
  33. package/lib/schemas/brief.schema.d.ts +46 -0
  34. package/lib/schemas/brief.schema.d.ts.map +1 -1
  35. package/lib/schemas/brief.schema.js +72 -1
  36. package/lib/schemas/index.d.ts +1 -0
  37. package/lib/schemas/index.d.ts.map +1 -1
  38. package/lib/schemas/index.js +1 -0
  39. package/lib/schemas/project.schema.d.ts +67 -0
  40. package/lib/schemas/project.schema.d.ts.map +1 -1
  41. package/lib/schemas/project.schema.js +12 -0
  42. package/lib/schemas/social.schema.d.ts +91 -0
  43. package/lib/schemas/social.schema.d.ts.map +1 -0
  44. package/lib/schemas/social.schema.js +114 -0
  45. package/lib/schemas/videoPlan.schema.d.ts +114 -0
  46. package/lib/schemas/videoPlan.schema.d.ts.map +1 -1
  47. package/lib/schemas/videoPlan.schema.js +141 -1
  48. package/lib/services/agent/chatAgent.d.ts +25 -1
  49. package/lib/services/agent/chatAgent.d.ts.map +1 -1
  50. package/lib/services/agent/chatAgent.js +145 -9
  51. package/lib/services/agent/costPreflight.d.ts +11 -1
  52. package/lib/services/agent/costPreflight.d.ts.map +1 -1
  53. package/lib/services/agent/costPreflight.js +18 -1
  54. package/lib/services/agent/covers/coverPlanner.d.ts +41 -0
  55. package/lib/services/agent/covers/coverPlanner.d.ts.map +1 -0
  56. package/lib/services/agent/covers/coverPlanner.js +278 -0
  57. package/lib/services/agent/covers/covers.schema.d.ts +158 -0
  58. package/lib/services/agent/covers/covers.schema.d.ts.map +1 -0
  59. package/lib/services/agent/covers/covers.schema.js +166 -0
  60. package/lib/services/agent/covers/index.d.ts +3 -0
  61. package/lib/services/agent/covers/index.d.ts.map +1 -0
  62. package/lib/services/agent/covers/index.js +18 -0
  63. package/lib/services/agent/critic.d.ts +10 -0
  64. package/lib/services/agent/critic.d.ts.map +1 -1
  65. package/lib/services/agent/critic.js +37 -1
  66. package/lib/services/agent/editClassifier.d.ts +2 -2
  67. package/lib/services/agent/editClassifier.js +2 -2
  68. package/lib/services/agent/editExisting/editAssembler.d.ts +78 -0
  69. package/lib/services/agent/editExisting/editAssembler.d.ts.map +1 -0
  70. package/lib/services/agent/editExisting/editAssembler.js +172 -0
  71. package/lib/services/agent/editExisting/editExisting.schema.d.ts +119 -0
  72. package/lib/services/agent/editExisting/editExisting.schema.d.ts.map +1 -0
  73. package/lib/services/agent/editExisting/editExisting.schema.js +157 -0
  74. package/lib/services/agent/editExisting/highlightPicker.d.ts +48 -0
  75. package/lib/services/agent/editExisting/highlightPicker.d.ts.map +1 -0
  76. package/lib/services/agent/editExisting/highlightPicker.js +199 -0
  77. package/lib/services/agent/editExisting/index.d.ts +4 -0
  78. package/lib/services/agent/editExisting/index.d.ts.map +1 -0
  79. package/lib/services/agent/editExisting/index.js +19 -0
  80. package/lib/services/agent/eval/seedBriefs.d.ts +4 -3
  81. package/lib/services/agent/eval/seedBriefs.d.ts.map +1 -1
  82. package/lib/services/agent/eval/seedBriefs.js +283 -3
  83. package/lib/services/agent/eval/types.d.ts +10 -0
  84. package/lib/services/agent/eval/types.d.ts.map +1 -1
  85. package/lib/services/agent/executor/core.d.ts +70 -0
  86. package/lib/services/agent/executor/core.d.ts.map +1 -0
  87. package/lib/services/agent/executor/core.js +250 -0
  88. package/lib/services/agent/executor/duration.d.ts +20 -0
  89. package/lib/services/agent/executor/duration.d.ts.map +1 -0
  90. package/lib/services/agent/executor/duration.js +46 -0
  91. package/lib/services/agent/executor/index.d.ts +15 -0
  92. package/lib/services/agent/executor/index.d.ts.map +1 -0
  93. package/lib/services/agent/executor/index.js +32 -0
  94. package/lib/services/agent/executor/types.d.ts +183 -0
  95. package/lib/services/agent/executor/types.d.ts.map +1 -0
  96. package/lib/services/agent/executor/types.js +29 -0
  97. package/lib/services/agent/executor/visual.d.ts +32 -0
  98. package/lib/services/agent/executor/visual.d.ts.map +1 -0
  99. package/lib/services/agent/executor/visual.js +400 -0
  100. package/lib/services/agent/executor/voice.d.ts +17 -0
  101. package/lib/services/agent/executor/voice.d.ts.map +1 -0
  102. package/lib/services/agent/executor/voice.js +119 -0
  103. package/lib/services/agent/extendChain.d.ts +101 -0
  104. package/lib/services/agent/extendChain.d.ts.map +1 -0
  105. package/lib/services/agent/extendChain.js +177 -0
  106. package/lib/services/agent/index.d.ts +11 -1
  107. package/lib/services/agent/index.d.ts.map +1 -1
  108. package/lib/services/agent/index.js +11 -1
  109. package/lib/services/agent/llmCaller.d.ts +7 -8
  110. package/lib/services/agent/llmCaller.d.ts.map +1 -1
  111. package/lib/services/agent/llmCallerAnthropic.d.ts +44 -31
  112. package/lib/services/agent/llmCallerAnthropic.d.ts.map +1 -1
  113. package/lib/services/agent/llmCallerAnthropic.js +135 -60
  114. package/lib/services/agent/llmCallerFactory.d.ts +34 -0
  115. package/lib/services/agent/llmCallerFactory.d.ts.map +1 -0
  116. package/lib/services/agent/llmCallerFactory.js +31 -0
  117. package/lib/services/agent/llmCallerGemini.d.ts +62 -0
  118. package/lib/services/agent/llmCallerGemini.d.ts.map +1 -0
  119. package/lib/services/agent/llmCallerGemini.js +235 -0
  120. package/lib/services/agent/llmCallerOpenai.d.ts +56 -0
  121. package/lib/services/agent/llmCallerOpenai.d.ts.map +1 -0
  122. package/lib/services/agent/llmCallerOpenai.js +230 -0
  123. package/lib/services/agent/llmCallerRegistry.d.ts.map +1 -1
  124. package/lib/services/agent/llmCallerRegistry.js +7 -7
  125. package/lib/services/agent/llmCallerRouting.d.ts +63 -0
  126. package/lib/services/agent/llmCallerRouting.d.ts.map +1 -0
  127. package/lib/services/agent/llmCallerRouting.js +124 -0
  128. package/lib/services/agent/llmModelRegistry.d.ts +59 -0
  129. package/lib/services/agent/llmModelRegistry.d.ts.map +1 -0
  130. package/lib/services/agent/llmModelRegistry.js +168 -0
  131. package/lib/services/agent/llmRetry.d.ts +57 -0
  132. package/lib/services/agent/llmRetry.d.ts.map +1 -0
  133. package/lib/services/agent/llmRetry.js +102 -0
  134. package/lib/services/agent/modelRouter.d.ts +3 -3
  135. package/lib/services/agent/modelRouter.d.ts.map +1 -1
  136. package/lib/services/agent/modelRouter.js +27 -13
  137. package/lib/services/agent/planMutations.d.ts +54 -1
  138. package/lib/services/agent/planMutations.d.ts.map +1 -1
  139. package/lib/services/agent/planMutations.js +78 -0
  140. package/lib/services/agent/planner/Planner.d.ts +0 -17
  141. package/lib/services/agent/planner/Planner.d.ts.map +1 -1
  142. package/lib/services/agent/planner/Planner.js +67 -303
  143. package/lib/services/agent/planner/overlayRegen.d.ts +38 -0
  144. package/lib/services/agent/planner/overlayRegen.d.ts.map +1 -0
  145. package/lib/services/agent/planner/overlayRegen.js +145 -0
  146. package/lib/services/agent/planner/plannerMessages.d.ts +34 -0
  147. package/lib/services/agent/planner/plannerMessages.d.ts.map +1 -0
  148. package/lib/services/agent/planner/plannerMessages.js +185 -0
  149. package/lib/services/agent/planner/promptSections.d.ts +12 -0
  150. package/lib/services/agent/planner/promptSections.d.ts.map +1 -1
  151. package/lib/services/agent/planner/promptSections.js +57 -0
  152. package/lib/services/agent/planner/scriptFirstPlanner.d.ts +35 -0
  153. package/lib/services/agent/planner/scriptFirstPlanner.d.ts.map +1 -0
  154. package/lib/services/agent/planner/scriptFirstPlanner.js +140 -0
  155. package/lib/services/agent/planner/structuralRules.d.ts +10 -0
  156. package/lib/services/agent/planner/structuralRules.d.ts.map +1 -1
  157. package/lib/services/agent/planner/structuralRules.js +92 -9
  158. package/lib/services/agent/planner/validators.d.ts +18 -0
  159. package/lib/services/agent/planner/validators.d.ts.map +1 -1
  160. package/lib/services/agent/planner/validators.js +97 -0
  161. package/lib/services/agent/planner.d.ts +2 -1
  162. package/lib/services/agent/planner.d.ts.map +1 -1
  163. package/lib/services/agent/planner.js +5 -1
  164. package/lib/services/agent/priorProject.d.ts +26 -0
  165. package/lib/services/agent/priorProject.d.ts.map +1 -0
  166. package/lib/services/agent/priorProject.js +51 -0
  167. package/lib/services/agent/providerFallback/chains.d.ts.map +1 -1
  168. package/lib/services/agent/providerFallback/chains.js +27 -15
  169. package/lib/services/agent/repurpose/index.d.ts +3 -0
  170. package/lib/services/agent/repurpose/index.d.ts.map +1 -0
  171. package/lib/services/agent/repurpose/index.js +18 -0
  172. package/lib/services/agent/repurpose/repurpose.schema.d.ts +132 -0
  173. package/lib/services/agent/repurpose/repurpose.schema.d.ts.map +1 -0
  174. package/lib/services/agent/repurpose/repurpose.schema.js +144 -0
  175. package/lib/services/agent/repurpose/shortsPicker.d.ts +25 -0
  176. package/lib/services/agent/repurpose/shortsPicker.d.ts.map +1 -0
  177. package/lib/services/agent/repurpose/shortsPicker.js +218 -0
  178. package/lib/services/agent/runHelpers.d.ts +21 -2
  179. package/lib/services/agent/runHelpers.d.ts.map +1 -1
  180. package/lib/services/agent/runHelpers.js +71 -2
  181. package/lib/services/agent/tools/animateImage.tool.d.ts +1 -0
  182. package/lib/services/agent/tools/animateImage.tool.d.ts.map +1 -1
  183. package/lib/services/agent/tools/animateImage.tool.js +12 -0
  184. package/lib/services/agent/tools/chapterOutline.tool.d.ts +42 -0
  185. package/lib/services/agent/tools/chapterOutline.tool.d.ts.map +1 -0
  186. package/lib/services/agent/tools/chapterOutline.tool.js +115 -0
  187. package/lib/services/agent/tools/composeScene.tool.d.ts +63 -0
  188. package/lib/services/agent/tools/composeScene.tool.d.ts.map +1 -1
  189. package/lib/services/agent/tools/estimateCost.tool.d.ts +27 -0
  190. package/lib/services/agent/tools/estimateCost.tool.d.ts.map +1 -1
  191. package/lib/services/agent/tools/estimateCost.tool.js +55 -7
  192. package/lib/services/agent/tools/extendVideo.tool.d.ts +26 -0
  193. package/lib/services/agent/tools/extendVideo.tool.d.ts.map +1 -0
  194. package/lib/services/agent/tools/extendVideo.tool.js +149 -0
  195. package/lib/services/agent/tools/generateScript.tool.d.ts +184 -0
  196. package/lib/services/agent/tools/generateScript.tool.d.ts.map +1 -0
  197. package/lib/services/agent/tools/generateScript.tool.js +123 -0
  198. package/lib/services/agent/tools/generateVideo.tool.d.ts +1 -0
  199. package/lib/services/agent/tools/generateVideo.tool.d.ts.map +1 -1
  200. package/lib/services/agent/tools/generateVideo.tool.js +20 -1
  201. package/lib/services/agent/tools/index.d.ts +4 -0
  202. package/lib/services/agent/tools/index.d.ts.map +1 -1
  203. package/lib/services/agent/tools/index.js +4 -0
  204. package/lib/services/agent/tools/matchBrollToScript.tool.d.ts +50 -0
  205. package/lib/services/agent/tools/matchBrollToScript.tool.d.ts.map +1 -0
  206. package/lib/services/agent/tools/matchBrollToScript.tool.js +139 -0
  207. package/lib/services/agent/tools/planVideo.tool.d.ts +56 -0
  208. package/lib/services/agent/tools/planVideo.tool.d.ts.map +1 -1
  209. package/lib/services/agent/tools/planVideo.tool.js +3 -3
  210. package/lib/services/agent/tools/render.tool.d.ts +21 -0
  211. package/lib/services/agent/tools/render.tool.d.ts.map +1 -1
  212. package/lib/services/aiGen/aiGenFactory.service.d.ts.map +1 -1
  213. package/lib/services/aiGen/aiGenFactory.service.js +18 -3
  214. package/lib/services/aiGen/providers/anthropic/anthropic.service.d.ts +26 -0
  215. package/lib/services/aiGen/providers/anthropic/anthropic.service.d.ts.map +1 -0
  216. package/lib/services/aiGen/providers/anthropic/anthropic.service.js +95 -0
  217. package/lib/services/aiGen/providers/google/google.service.d.ts +24 -1
  218. package/lib/services/aiGen/providers/google/google.service.d.ts.map +1 -1
  219. package/lib/services/aiGen/providers/google/google.service.js +96 -244
  220. package/lib/services/aiGen/providers/google/googleErrors.d.ts +13 -0
  221. package/lib/services/aiGen/providers/google/googleErrors.d.ts.map +1 -0
  222. package/lib/services/aiGen/providers/google/googleErrors.js +102 -0
  223. package/lib/services/aiGen/providers/google/googleFetch.d.ts +8 -0
  224. package/lib/services/aiGen/providers/google/googleFetch.d.ts.map +1 -0
  225. package/lib/services/aiGen/providers/google/googleFetch.js +96 -0
  226. package/lib/services/aiGen/providers/google/googleMusic.d.ts +15 -0
  227. package/lib/services/aiGen/providers/google/googleMusic.d.ts.map +1 -0
  228. package/lib/services/aiGen/providers/google/googleMusic.js +77 -0
  229. package/lib/services/aiGen/providers/kling/kling.service.d.ts +7 -3
  230. package/lib/services/aiGen/providers/kling/kling.service.d.ts.map +1 -1
  231. package/lib/services/aiGen/providers/kling/kling.service.js +23 -367
  232. package/lib/services/aiGen/providers/kling/klingCredits.d.ts +9 -0
  233. package/lib/services/aiGen/providers/kling/klingCredits.d.ts.map +1 -0
  234. package/lib/services/aiGen/providers/kling/klingCredits.js +63 -0
  235. package/lib/services/aiGen/providers/kling/klingRequests.d.ts +32 -0
  236. package/lib/services/aiGen/providers/kling/klingRequests.d.ts.map +1 -0
  237. package/lib/services/aiGen/providers/kling/klingRequests.js +194 -0
  238. package/lib/services/aiGen/providers/kling/klingStatus.d.ts +16 -0
  239. package/lib/services/aiGen/providers/kling/klingStatus.d.ts.map +1 -0
  240. package/lib/services/aiGen/providers/kling/klingStatus.js +173 -0
  241. package/lib/services/bullmq.service.d.ts +61 -0
  242. package/lib/services/bullmq.service.d.ts.map +1 -1
  243. package/lib/services/bullmq.service.js +101 -1
  244. package/lib/services/crypto/index.d.ts +2 -0
  245. package/lib/services/crypto/index.d.ts.map +1 -0
  246. package/lib/services/crypto/index.js +17 -0
  247. package/lib/services/crypto/tokenVault.d.ts +47 -0
  248. package/lib/services/crypto/tokenVault.d.ts.map +1 -0
  249. package/lib/services/crypto/tokenVault.js +179 -0
  250. package/lib/services/editor/captionStyleHint.d.ts +3 -0
  251. package/lib/services/editor/captionStyleHint.d.ts.map +1 -0
  252. package/lib/services/editor/captionStyleHint.js +112 -0
  253. package/lib/services/editor/planToProject.d.ts +7 -66
  254. package/lib/services/editor/planToProject.d.ts.map +1 -1
  255. package/lib/services/editor/planToProject.helpers.d.ts +40 -0
  256. package/lib/services/editor/planToProject.helpers.d.ts.map +1 -0
  257. package/lib/services/editor/planToProject.helpers.js +177 -0
  258. package/lib/services/editor/planToProject.js +197 -180
  259. package/lib/services/editor/planToProject.types.d.ts +94 -0
  260. package/lib/services/editor/planToProject.types.d.ts.map +1 -0
  261. package/lib/services/editor/planToProject.types.js +2 -0
  262. package/lib/services/firestore.service.d.ts +5 -0
  263. package/lib/services/firestore.service.d.ts.map +1 -1
  264. package/lib/services/firestore.service.js +13 -0
  265. package/lib/services/index.d.ts +12 -0
  266. package/lib/services/index.d.ts.map +1 -1
  267. package/lib/services/index.js +12 -0
  268. package/lib/services/promptEnhancer/index.d.ts +18 -0
  269. package/lib/services/promptEnhancer/index.d.ts.map +1 -0
  270. package/lib/services/promptEnhancer/index.js +33 -0
  271. package/lib/services/promptEnhancer/models.d.ts +54 -0
  272. package/lib/services/promptEnhancer/models.d.ts.map +1 -0
  273. package/lib/services/promptEnhancer/models.js +37 -0
  274. package/lib/services/promptEnhancer/profiles/agent.profile.d.ts +14 -0
  275. package/lib/services/promptEnhancer/profiles/agent.profile.d.ts.map +1 -0
  276. package/lib/services/promptEnhancer/profiles/agent.profile.js +40 -0
  277. package/lib/services/promptEnhancer/profiles/avatar.profile.d.ts +13 -0
  278. package/lib/services/promptEnhancer/profiles/avatar.profile.d.ts.map +1 -0
  279. package/lib/services/promptEnhancer/profiles/avatar.profile.js +40 -0
  280. package/lib/services/promptEnhancer/profiles/base.d.ts +28 -0
  281. package/lib/services/promptEnhancer/profiles/base.d.ts.map +1 -0
  282. package/lib/services/promptEnhancer/profiles/base.js +35 -0
  283. package/lib/services/promptEnhancer/profiles/image.profile.d.ts +11 -0
  284. package/lib/services/promptEnhancer/profiles/image.profile.d.ts.map +1 -0
  285. package/lib/services/promptEnhancer/profiles/image.profile.js +42 -0
  286. package/lib/services/promptEnhancer/profiles/index.d.ts +12 -0
  287. package/lib/services/promptEnhancer/profiles/index.d.ts.map +1 -0
  288. package/lib/services/promptEnhancer/profiles/index.js +33 -0
  289. package/lib/services/promptEnhancer/profiles/video.profile.d.ts +15 -0
  290. package/lib/services/promptEnhancer/profiles/video.profile.d.ts.map +1 -0
  291. package/lib/services/promptEnhancer/profiles/video.profile.js +81 -0
  292. package/lib/services/promptEnhancer/promptEnhancer.service.d.ts +45 -0
  293. package/lib/services/promptEnhancer/promptEnhancer.service.d.ts.map +1 -0
  294. package/lib/services/promptEnhancer/promptEnhancer.service.js +157 -0
  295. package/lib/services/promptEnhancer/schema.d.ts +19 -0
  296. package/lib/services/promptEnhancer/schema.d.ts.map +1 -0
  297. package/lib/services/promptEnhancer/schema.js +43 -0
  298. package/lib/services/promptEnhancer/types.d.ts +112 -0
  299. package/lib/services/promptEnhancer/types.d.ts.map +1 -0
  300. package/lib/services/promptEnhancer/types.js +2 -0
  301. package/lib/services/socialAI/captionGen.d.ts +81 -0
  302. package/lib/services/socialAI/captionGen.d.ts.map +1 -0
  303. package/lib/services/socialAI/captionGen.js +206 -0
  304. package/lib/services/socialAI/hookScore.d.ts +85 -0
  305. package/lib/services/socialAI/hookScore.d.ts.map +1 -0
  306. package/lib/services/socialAI/hookScore.js +170 -0
  307. package/lib/services/socialAI/index.d.ts +3 -0
  308. package/lib/services/socialAI/index.d.ts.map +1 -0
  309. package/lib/services/socialAI/index.js +18 -0
  310. package/lib/services/socialAccounts/index.d.ts +2 -0
  311. package/lib/services/socialAccounts/index.d.ts.map +1 -0
  312. package/lib/services/socialAccounts/index.js +17 -0
  313. package/lib/services/socialAccounts/socialAccountService.d.ts +25 -0
  314. package/lib/services/socialAccounts/socialAccountService.d.ts.map +1 -0
  315. package/lib/services/socialAccounts/socialAccountService.js +105 -0
  316. package/lib/services/socialEngage/factory.d.ts +7 -0
  317. package/lib/services/socialEngage/factory.d.ts.map +1 -0
  318. package/lib/services/socialEngage/factory.js +25 -0
  319. package/lib/services/socialEngage/index.d.ts +6 -0
  320. package/lib/services/socialEngage/index.d.ts.map +1 -0
  321. package/lib/services/socialEngage/index.js +21 -0
  322. package/lib/services/socialEngage/meta.engage.d.ts +17 -0
  323. package/lib/services/socialEngage/meta.engage.d.ts.map +1 -0
  324. package/lib/services/socialEngage/meta.engage.js +128 -0
  325. package/lib/services/socialEngage/metaWebhook.d.ts +50 -0
  326. package/lib/services/socialEngage/metaWebhook.d.ts.map +1 -0
  327. package/lib/services/socialEngage/metaWebhook.js +93 -0
  328. package/lib/services/socialEngage/types.d.ts +72 -0
  329. package/lib/services/socialEngage/types.d.ts.map +1 -0
  330. package/lib/services/socialEngage/types.js +10 -0
  331. package/lib/services/socialEngage/youtube.engage.d.ts +9 -0
  332. package/lib/services/socialEngage/youtube.engage.d.ts.map +1 -0
  333. package/lib/services/socialEngage/youtube.engage.js +87 -0
  334. package/lib/services/socialFormat/aspectGeometry.d.ts +74 -0
  335. package/lib/services/socialFormat/aspectGeometry.d.ts.map +1 -0
  336. package/lib/services/socialFormat/aspectGeometry.js +135 -0
  337. package/lib/services/socialFormat/index.d.ts +2 -0
  338. package/lib/services/socialFormat/index.d.ts.map +1 -0
  339. package/lib/services/socialFormat/index.js +19 -0
  340. package/lib/services/socialInsights/index.d.ts +3 -0
  341. package/lib/services/socialInsights/index.d.ts.map +1 -0
  342. package/lib/services/socialInsights/index.js +18 -0
  343. package/lib/services/socialInsights/recommendations.d.ts +131 -0
  344. package/lib/services/socialInsights/recommendations.d.ts.map +1 -0
  345. package/lib/services/socialInsights/recommendations.js +277 -0
  346. package/lib/services/socialInsights/timeBuckets.d.ts +35 -0
  347. package/lib/services/socialInsights/timeBuckets.d.ts.map +1 -0
  348. package/lib/services/socialInsights/timeBuckets.js +78 -0
  349. package/lib/services/socialMetrics/factory.d.ts +5 -0
  350. package/lib/services/socialMetrics/factory.d.ts.map +1 -0
  351. package/lib/services/socialMetrics/factory.js +24 -0
  352. package/lib/services/socialMetrics/index.d.ts +6 -0
  353. package/lib/services/socialMetrics/index.d.ts.map +1 -0
  354. package/lib/services/socialMetrics/index.js +21 -0
  355. package/lib/services/socialMetrics/meta.metrics.d.ts +22 -0
  356. package/lib/services/socialMetrics/meta.metrics.d.ts.map +1 -0
  357. package/lib/services/socialMetrics/meta.metrics.js +137 -0
  358. package/lib/services/socialMetrics/tiktok.metrics.d.ts +8 -0
  359. package/lib/services/socialMetrics/tiktok.metrics.d.ts.map +1 -0
  360. package/lib/services/socialMetrics/tiktok.metrics.js +43 -0
  361. package/lib/services/socialMetrics/types.d.ts +54 -0
  362. package/lib/services/socialMetrics/types.d.ts.map +1 -0
  363. package/lib/services/socialMetrics/types.js +2 -0
  364. package/lib/services/socialMetrics/youtube.metrics.d.ts +8 -0
  365. package/lib/services/socialMetrics/youtube.metrics.d.ts.map +1 -0
  366. package/lib/services/socialMetrics/youtube.metrics.js +43 -0
  367. package/lib/services/socialOAuth/factory.d.ts +7 -0
  368. package/lib/services/socialOAuth/factory.d.ts.map +1 -0
  369. package/lib/services/socialOAuth/factory.js +42 -0
  370. package/lib/services/socialOAuth/index.d.ts +11 -0
  371. package/lib/services/socialOAuth/index.d.ts.map +1 -0
  372. package/lib/services/socialOAuth/index.js +26 -0
  373. package/lib/services/socialOAuth/linkedin.oauth.d.ts +14 -0
  374. package/lib/services/socialOAuth/linkedin.oauth.d.ts.map +1 -0
  375. package/lib/services/socialOAuth/linkedin.oauth.js +127 -0
  376. package/lib/services/socialOAuth/meta.oauth.d.ts +31 -0
  377. package/lib/services/socialOAuth/meta.oauth.d.ts.map +1 -0
  378. package/lib/services/socialOAuth/meta.oauth.js +214 -0
  379. package/lib/services/socialOAuth/oauthState.d.ts +14 -0
  380. package/lib/services/socialOAuth/oauthState.d.ts.map +1 -0
  381. package/lib/services/socialOAuth/oauthState.js +66 -0
  382. package/lib/services/socialOAuth/pinterest.oauth.d.ts +15 -0
  383. package/lib/services/socialOAuth/pinterest.oauth.d.ts.map +1 -0
  384. package/lib/services/socialOAuth/pinterest.oauth.js +126 -0
  385. package/lib/services/socialOAuth/threads.oauth.d.ts +14 -0
  386. package/lib/services/socialOAuth/threads.oauth.d.ts.map +1 -0
  387. package/lib/services/socialOAuth/threads.oauth.js +129 -0
  388. package/lib/services/socialOAuth/tiktok.oauth.d.ts +15 -0
  389. package/lib/services/socialOAuth/tiktok.oauth.d.ts.map +1 -0
  390. package/lib/services/socialOAuth/tiktok.oauth.js +151 -0
  391. package/lib/services/socialOAuth/types.d.ts +67 -0
  392. package/lib/services/socialOAuth/types.d.ts.map +1 -0
  393. package/lib/services/socialOAuth/types.js +2 -0
  394. package/lib/services/socialOAuth/x.oauth.d.ts +17 -0
  395. package/lib/services/socialOAuth/x.oauth.d.ts.map +1 -0
  396. package/lib/services/socialOAuth/x.oauth.js +134 -0
  397. package/lib/services/socialOAuth/youtube.oauth.d.ts +15 -0
  398. package/lib/services/socialOAuth/youtube.oauth.d.ts.map +1 -0
  399. package/lib/services/socialOAuth/youtube.oauth.js +156 -0
  400. package/lib/services/socialPublish/factory.d.ts +5 -0
  401. package/lib/services/socialPublish/factory.d.ts.map +1 -0
  402. package/lib/services/socialPublish/factory.js +32 -0
  403. package/lib/services/socialPublish/index.d.ts +10 -0
  404. package/lib/services/socialPublish/index.d.ts.map +1 -0
  405. package/lib/services/socialPublish/index.js +25 -0
  406. package/lib/services/socialPublish/linkedin.publish.d.ts +9 -0
  407. package/lib/services/socialPublish/linkedin.publish.d.ts.map +1 -0
  408. package/lib/services/socialPublish/linkedin.publish.js +143 -0
  409. package/lib/services/socialPublish/meta.publish.d.ts +28 -0
  410. package/lib/services/socialPublish/meta.publish.d.ts.map +1 -0
  411. package/lib/services/socialPublish/meta.publish.js +149 -0
  412. package/lib/services/socialPublish/pinterest.publish.d.ts +13 -0
  413. package/lib/services/socialPublish/pinterest.publish.d.ts.map +1 -0
  414. package/lib/services/socialPublish/pinterest.publish.js +130 -0
  415. package/lib/services/socialPublish/threads.publish.d.ts +12 -0
  416. package/lib/services/socialPublish/threads.publish.d.ts.map +1 -0
  417. package/lib/services/socialPublish/threads.publish.js +96 -0
  418. package/lib/services/socialPublish/tiktok.publish.d.ts +13 -0
  419. package/lib/services/socialPublish/tiktok.publish.d.ts.map +1 -0
  420. package/lib/services/socialPublish/tiktok.publish.js +118 -0
  421. package/lib/services/socialPublish/types.d.ts +47 -0
  422. package/lib/services/socialPublish/types.d.ts.map +1 -0
  423. package/lib/services/socialPublish/types.js +2 -0
  424. package/lib/services/socialPublish/x.publish.d.ts +12 -0
  425. package/lib/services/socialPublish/x.publish.d.ts.map +1 -0
  426. package/lib/services/socialPublish/x.publish.js +147 -0
  427. package/lib/services/socialPublish/youtube.publish.d.ts +9 -0
  428. package/lib/services/socialPublish/youtube.publish.d.ts.map +1 -0
  429. package/lib/services/socialPublish/youtube.publish.js +107 -0
  430. package/lib/services/stock/index.d.ts +2 -0
  431. package/lib/services/stock/index.d.ts.map +1 -0
  432. package/lib/services/stock/index.js +17 -0
  433. package/lib/services/stock/realPersonSafety.d.ts +99 -0
  434. package/lib/services/stock/realPersonSafety.d.ts.map +1 -0
  435. package/lib/services/stock/realPersonSafety.js +248 -0
  436. package/lib/utils/index.d.ts +1 -0
  437. package/lib/utils/index.d.ts.map +1 -1
  438. package/lib/utils/index.js +1 -0
  439. package/lib/utils/renderTier.d.ts +26 -0
  440. package/lib/utils/renderTier.d.ts.map +1 -0
  441. package/lib/utils/renderTier.js +34 -0
  442. package/package.json +1 -1
@@ -1,15 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildStructuralRulesSection = buildStructuralRulesSection;
4
+ const brief_schema_1 = require("../../../schemas/brief.schema");
4
5
  /**
5
6
  * Strict structural rules surfaced by Phase 1 dry-run (AG-8/9/10). These three
6
7
  * gaps consistently capped UGC eval scores at 0.887 — pacing ignored, duration
7
8
  * under-delivered, CTA caption order wrong. Spelled out as hard contracts in
8
9
  * the planner prompt rather than soft hints, plus AG-9 also has a post-plan
9
10
  * validator (checkDurationContract) so the planner can't silently miss it.
11
+ *
12
+ * Stream L (L-2) — per-tier branches. The rules above were authored for
13
+ * short-form (S1/S2) and still apply verbatim there. For M1+ the pacing band,
14
+ * scene-count cap, and chapter requirements diverge:
15
+ * - S1/S2: unchanged short-form rules.
16
+ * - M1 (60s–3min): mixed pacing — wider per-scene band, chapters recommended.
17
+ * - L1/L2 (3min+): per-scene band relaxed to 3–8s, MANY scenes expected, and
18
+ * a chapter structure is REQUIRED. (L-3 layers script-first authoring on
19
+ * top; this branch just sets the structural contract.)
20
+ * - L3: edit-existing, not planner-driven (routed to L-5) — never reaches here.
10
21
  */
11
22
  function buildStructuralRulesSection(brief) {
12
23
  const lines = ["", "Strict structural rules (hard contracts):"];
24
+ // Stream L (L-2): effective length tier drives the per-tier branches below.
25
+ const lengthTier = brief.lengthTier ?? (0, brief_schema_1.deriveLengthTier)(brief.durationSec);
26
+ const isMedium = lengthTier === "M1";
27
+ const isLongForm = lengthTier === "L1" || lengthTier === "L2";
28
+ const isMediumPlus = isMedium || isLongForm;
13
29
  const targetMs = brief.durationSec ? Math.round(brief.durationSec * 1000) : null;
14
30
  if (targetMs) {
15
31
  const minMs = Math.round(targetMs * 0.95);
@@ -42,22 +58,67 @@ function buildStructuralRulesSection(brief) {
42
58
  const effectivePacing = brief.pacing ??
43
59
  ((brief.niche && fastCutNiches.includes(brief.niche)) ? "fast" : "medium");
44
60
  const band = PACING_BANDS_MS[effectivePacing];
45
- const minMsScene = Math.max(band.minMs, 2000); // provider floor wins
46
- const maxMsScene = Math.max(band.maxMs, minMsScene);
61
+ // Stream L (L-2): per-tier band override.
62
+ // - L1/L2: relax to a fixed 3–8s band regardless of pacing — long-form
63
+ // B-roll cuts read best at 3–8s, and the chapter structure (not the
64
+ // per-scene pacing) carries the rhythm.
65
+ // - M1: "mixed pacing" — keep the pacing-derived floor but widen the
66
+ // ceiling to 8s so explainers can intersperse longer establishing beats
67
+ // between faster cuts.
68
+ // - S1/S2: untouched short-form band.
69
+ let minMsScene;
70
+ let maxMsScene;
71
+ if (isLongForm) {
72
+ minMsScene = 3000;
73
+ maxMsScene = 8000;
74
+ }
75
+ else if (isMedium) {
76
+ minMsScene = Math.max(band.minMs, 2000);
77
+ maxMsScene = Math.max(8000, minMsScene);
78
+ }
79
+ else {
80
+ minMsScene = Math.max(band.minMs, 2000); // provider floor wins
81
+ maxMsScene = Math.max(band.maxMs, minMsScene);
82
+ }
47
83
  // Hook gets a little extra headroom (one band step faster) so the opener
48
84
  // can set up the topic without forcing the rest of the video to match.
49
85
  const hookMaxMs = Math.max(maxMsScene, 3000);
50
- const flooredNote = minMsScene > band.minMs
86
+ const flooredNote = !isLongForm && minMsScene > band.minMs
51
87
  ? ` (provider floor 2000ms overrides pacing min ${band.minMs}ms — no model accepts sub-2s clips)`
52
88
  : "";
53
- lines.push(` - Pacing: brief.pacing="${effectivePacing}" → per-scene durationMs in [${minMsScene}, ${maxMsScene}]${flooredNote}. The hook (sceneIndex 0) may run up to ${hookMaxMs}ms.`);
89
+ if (isLongForm) {
90
+ lines.push(` - Pacing (long-form ${lengthTier}): per-scene durationMs in [${minMsScene}, ${maxMsScene}] — long-form B-roll reads best at 3–8s cuts. Do NOT pad scenes to 10s+; rhythm comes from the chapter structure (below) and varied shots, not long single clips. The opening scene may run up to ${hookMaxMs}ms to establish the topic.`);
91
+ }
92
+ else if (isMedium) {
93
+ lines.push(` - Pacing (M1 explainer, mixed): brief.pacing="${effectivePacing}" → per-scene durationMs in [${minMsScene}, ${maxMsScene}]. Mix faster cuts (3–4s) for lists/demos with longer establishing beats (6–8s) for context — avoid a monotone single duration. The hook (sceneIndex 0) may run up to ${hookMaxMs}ms.`);
94
+ }
95
+ else {
96
+ lines.push(` - Pacing: brief.pacing="${effectivePacing}" → per-scene durationMs in [${minMsScene}, ${maxMsScene}]${flooredNote}. The hook (sceneIndex 0) may run up to ${hookMaxMs}ms.`);
97
+ }
54
98
  if (targetMs) {
55
99
  // Derive scene count from target duration / avg band (round to nearest).
56
100
  const avgMs = Math.round((minMsScene + maxMsScene) / 2);
57
101
  const idealCount = Math.max(1, Math.round(targetMs / avgMs));
58
102
  const minCount = Math.max(1, Math.floor(targetMs / maxMsScene));
59
103
  const maxCount = Math.max(minCount, Math.floor(targetMs / minMsScene));
60
- lines.push(` - Scene count: with target ${targetMs}ms and per-scene band [${minMsScene}, ${maxMsScene}]ms, plan ${minCount}-${maxCount} scenes (target ~${idealCount} scenes of ~${avgMs}ms each). For pacing="${effectivePacing}" do NOT ship more than ${maxCount} scenes — telegraphic micro-cuts are the wrong feel. Pick scene durations from the preferredModel's allowed-durations list (e.g. seedance-1.0-pro-fast supports any integer 2-12s; pixverse supports [5,8,10]).`);
104
+ if (isLongForm) {
105
+ lines.push(` - Scene count (long-form ${lengthTier}): with target ${targetMs}ms and a 3–8s band, expect ~${idealCount} scenes (range ${minCount}-${maxCount}). Long-form legitimately has MANY scenes — do not compress into a handful of 10s+ clips. Group them into chapters (see chapter rule below): each chapter spans a run of consecutive scenes. Pick scene durations from the preferredModel's allowed-durations list (e.g. seedance-1.0-pro-fast supports any integer 2-12s; pixverse supports [5,8,10]).`);
106
+ }
107
+ else {
108
+ lines.push(` - Scene count: with target ${targetMs}ms and per-scene band [${minMsScene}, ${maxMsScene}]ms, plan ${minCount}-${maxCount} scenes (target ~${idealCount} scenes of ~${avgMs}ms each). For pacing="${effectivePacing}" do NOT ship more than ${maxCount} scenes — telegraphic micro-cuts are the wrong feel. Pick scene durations from the preferredModel's allowed-durations list (e.g. seedance-1.0-pro-fast supports any integer 2-12s; pixverse supports [5,8,10]).`);
109
+ }
110
+ }
111
+ // Stream L (L-2): chapter structure for M1+ videos. Required for L1/L2 (long
112
+ // enough that an unstructured scene list is unusable + YT needs chapter
113
+ // markers), recommended for M1. L-3 will layer script-first narration on top;
114
+ // this contract just requires the planner to group scenes into titled,
115
+ // contiguous, gap-free, non-overlapping sections covering every scene index.
116
+ if (isMediumPlus) {
117
+ const requiredWord = isLongForm ? "MUST" : "SHOULD";
118
+ const chapterCountHint = isLongForm
119
+ ? "Typically 3-7 chapters for a 3-10min video, more for longer."
120
+ : "Typically 2-4 chapters for a 1-3min explainer.";
121
+ lines.push(` - Chapter structure (${lengthTier}): you ${requiredWord} populate the top-level plan.chapters[] array. Each chapter = { id: "CH_<n>" (CH_1, CH_2, … in order), title (a short YT-style section title, e.g. "The hidden cost"), sceneIndices: [contiguous list of the sceneIndex values in this chapter] }. HARD RULES: (1) chapters cover EVERY scene exactly once — the union of all sceneIndices equals [0..N-1] with no gaps and no overlaps; (2) sceneIndices within a chapter are consecutive and ascending; (3) chapters are in render order (CH_1's scenes come before CH_2's). ${chapterCountHint} Open with a hook chapter and close with a payoff/CTA chapter. Leave chapter.narration unset for now (the script-first pass fills it); title + sceneIndices are what matter here.`);
61
122
  }
62
123
  // AG-15: provider duration capability. Every AI-video scene's durationMs/1000
63
124
  // MUST be in the picked model's allowed durations. Hard floor: 2s — no model
@@ -93,15 +154,37 @@ function buildStructuralRulesSection(brief) {
93
154
  // AG-37: voiceId must come from brief (real ElevenLabs ID), never invented
94
155
  // by the LLM. Earlier runs saw the planner hallucinating descriptive labels
95
156
  // like "female-young-adult-excited" which then got stripped by the executor.
96
- lines.push(" - voiceId: leave UNDEFINED at BOTH plan level AND every scene. ElevenLabs voice IDs are 20-char opaque strings (e.g. 'EXAVITQu4vr4xnSDxMaL'). You do NOT know any of them and MUST NOT invent them. Descriptive labels like 'female-young-adult-excited' are invalid and get stripped. The orchestrator overwrites plan.voiceId post-parse from the brief; per-scene voiceId is a hallucination — never emit it. Use voiceStyle (adjective like 'excited', 'calm', 'authoritative') to convey delivery; that's what the executor maps to voice settings.");
97
- // AG-44: per-scene voiceStyle. A single global tone is too coarse for an
98
- // emotional arc (e.g. UGC ads that open frustrated and close excited).
99
- lines.push(" - Per-scene voiceStyle: set scene.voiceStyle (adjective: 'frustrated', 'curious', 'excited', 'whispered', 'authoritative', 'calm') when the emotional beat of that scene differs from the global tone. Common pattern for UGC: scene 0 frustrated/skeptical (the problem), middle scenes curious/intrigued (the reveal), final scene excited/confident (the CTA). If a scene has no special emotional shift, omit voiceStyle and the executor uses plan.voiceStyle.");
157
+ lines.push(" - voiceId: leave UNDEFINED at BOTH plan level AND every scene. ElevenLabs voice IDs are 20-char opaque strings (e.g. 'EXAVITQu4vr4xnSDxMaL'). You do NOT know any of them and MUST NOT invent them. Descriptive labels like 'female-young-adult-excited' are invalid and get stripped. The orchestrator overwrites plan.voiceId post-parse from the brief; per-scene voiceId is a hallucination — never emit it. Use voiceStyle (one of the canonical adjectives below) to convey delivery; that's what the executor maps to voice settings.");
158
+ // AG-44 + AG-4: per-scene voiceStyle. A single global tone is too coarse for
159
+ // an emotional arc (e.g. UGC ads that open frustrated and close excited).
160
+ // AG-4: the adjective MUST be one of the 10 canonical VoiceStyle values
161
+ // only those map to ElevenLabs voice_settings in resolveVoiceSettings();
162
+ // anything else (the executor normalizes common synonyms, but unknown words)
163
+ // silently no-ops to default delivery. Give the planner the exact vocabulary
164
+ // plus an emotional-beat → adjective mapping so the arc actually lands.
165
+ lines.push(" - Per-scene voiceStyle (AG-4): set scene.voiceStyle when this scene's emotional beat differs from the global tone. Use EXACTLY ONE of these canonical adjectives (others silently fall back to flat delivery): 'neutral', 'calm', 'warm', 'casual', 'excited', 'energetic', 'happy', 'serious', 'dramatic', 'whisper'. Emotional-beat mapping — reflective/intimate/soft → 'whisper'; thoughtful/curious/sad → 'calm'; reassuring/friendly → 'warm'; conversational/relaxed → 'casual'; authoritative/confident/skeptical → 'serious'; frustrated/urgent/intense → 'dramatic'; enthusiastic/hyped → 'energetic'; joyful/playful → 'happy'; thrilled/eager → 'excited'; monotone/deadpan → 'neutral'. Common UGC arc: scene 0 'serious' or 'dramatic' (the problem), middle 'calm' or 'casual' (the reveal), final 'excited' or 'energetic' (the CTA). Omit voiceStyle when the scene matches plan.voiceStyle.");
166
+ // AG-3: auto-captions on voiceover scenes. Word-timed on-screen captions
167
+ // drive retention + accessibility on caption-heavy niches. Gate the strong
168
+ // recommendation on niche so cinematic / ambient briefs don't get noisy
169
+ // karaoke text by default, but expose the field for any brief that asks.
170
+ {
171
+ const captionNiches = ["ugc-ad", "social-recap", "faceless-yt", "fitness"];
172
+ const captionDefault = brief.niche != null && captionNiches.includes(brief.niche);
173
+ lines.push(captionDefault
174
+ ? ` - Auto-captions: brief.niche="${brief.niche}" is a caption-first format — set scene.autoCaptions=true on EVERY scene that has a voiceoverLine. The host transcribes the generated VO into word-timed karaoke captions automatically; you do NOT also need to duplicate the spoken line as an overlay/onScreenText (that double-renders). Leave autoCaptions unset on scenes with no voiceoverLine.`
175
+ : ` - Auto-captions: set scene.autoCaptions=true only when the brief explicitly calls for on-screen captions/subtitles AND the scene has a voiceoverLine; the host then transcribes the VO into word-timed captions. For this niche, default to leaving it off and carry any on-screen message via overlays instead.`);
176
+ }
100
177
  // AG-11: character consistency across scenes. When the same person appears
101
178
  // in multiple scenes, the planner must (a) describe identity verbatim each
102
179
  // time, (b) set characterAnchorSceneIndex on later scenes pointing to the
103
180
  // first scene the character appeared in.
104
181
  lines.push(" - Character consistency: when the SAME person (presenter, customer, mascot) appears in multiple scenes, you MUST: (1) in the FIRST scene the character appears, write a complete identity description in scene.prompt — age range, ethnicity, hair color/length/style, build, distinctive features, exact wardrobe (color + garment type). (2) in every LATER scene with the same character, RE-STATE those identity descriptors verbatim AND set scene.characterAnchorSceneIndex to the sceneIndex of the first appearance. Do NOT write generic phrases like \"a woman doing X\" in later scenes — that produces a different face every time. If the brief implies recurring presenter (UGC ads, talking-head), assume ONE character throughout unless explicitly multi-cast.");
182
+ // AG-1 Phase 2: first-last-frame (FLF) interpolation. The planner opts a
183
+ // scene into FLF by authoring scene.lastFramePrompt (the END composition).
184
+ // Only meaningful on ai-image-to-video scenes whose preferredModel is
185
+ // FLF-capable; the executor silently ignores it otherwise, so the rule is
186
+ // additive and safe to skip when no scene needs directed two-anchor motion.
187
+ lines.push(" - First-last-frame (FLF) interpolation: for a scene with strategy=ai-image-to-video where the motion goes between TWO distinct, specific compositions (wide establishing shot → product close-up; closed door → open door; ingredient on counter → finished plated dish; logo small → logo filling frame), set scene.lastFramePrompt to a COMPLETE image prompt describing the END frame. scene.prompt is the START frame; the model interpolates between them for reliable directed motion instead of guessing from a single image + motion words. Rules: (1) lastFramePrompt is a full visual description of the final composition, NOT a motion verb (GOOD: \"extreme close-up of the bottle label, soft studio light\"; BAD: \"zoom into the label\"). (2) Keep subject/lighting/style consistent with scene.prompt so the interpolation reads as one continuous shot — re-state shared identity descriptors verbatim. (3) ONLY set it when preferredModel is FLF-capable: google-veo-3.1 / -fast, kling-v2.6 / -v2.5-turbo / -v3.0, runway-gen4-turbo / -gen4.5, alibaba-wan. On any other model it is ignored. (4) Use sparingly — only when a scene genuinely has two anchor compositions; ordinary single-image motion needs no lastFramePrompt. It costs one extra (cheap) image generation per FLF scene.");
105
188
  // text-layout v1 — per-scene composition decision. Optional but strongly
106
189
  // recommended when source aspect ≠ target aspect (i.e. most stock video
107
190
  // and avatar shots on 9:16 vertical, or vertical UGC on 16:9 horizontal).
@@ -45,6 +45,24 @@ export declare function checkSceneTtsBudget(plan: VideoPlan): string | null;
45
45
  * exhausted because every fallback was also a ≥6s model.
46
46
  */
47
47
  export declare function checkSceneDurationCapability(plan: VideoPlan): string | null;
48
+ /**
49
+ * Stream L (L-2): chapter contract for long-form plans. L1/L2 plans MUST carry
50
+ * a plan.chapters[] structure that partitions the scene list into titled,
51
+ * contiguous, gap-free, non-overlapping sections covering every scene exactly
52
+ * once. Returns a correction message on violation, null when satisfied or N/A
53
+ * (S1/S2/M1 — M1 chapters are recommended, not enforced).
54
+ */
55
+ export declare function checkChapterContract(plan: VideoPlan, brief: VideoBrief): string | null;
56
+ /**
57
+ * Stream L (L-6) — hard spend cap. When brief.maxSpendUSD is set, reject any
58
+ * plan whose estimated scene-generation cost exceeds it BEFORE any spend.
59
+ * Returns a correction message (used as planner-retry feedback for scene-first;
60
+ * the script-first pipeline downgrades tiers itself). Null when no cap is set
61
+ * or the plan is within budget. Overhead (planner/critic/bible ≈ $0.50) is
62
+ * intentionally excluded — the cap governs the dominant generation spend, and
63
+ * counting fixed overhead against a user-facing "video cost" cap reads wrong.
64
+ */
65
+ export declare function checkBudgetContract(plan: VideoPlan, brief: VideoBrief): string | null;
48
66
  /**
49
67
  * Warning-channel siblings of the rejection validators above. These run on
50
68
  * an already-approved plan (or after a sceneEdit patch) and produce
@@ -1 +1 @@
1
- {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/planner/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAe9E;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CA4BvF;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CA6BvF;AAED;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,UAAU,GAChB,MAAM,GAAG,IAAI,CAuBf;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAgClE;AAED;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAyC3E;AAED;;;;GAIG;AAEH,qFAAqF;AACrF,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,SAAS,GAAG,cAAc,EAAE,CA2B5E;AAED;;;;;;GAMG;AACH,wBAAgB,mCAAmC,CACjD,IAAI,EAAE,SAAS,GACd,cAAc,EAAE,CAyBlB;AAED,kFAAkF;AAClF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,cAAc,EAAE,CAKrE"}
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/planner/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoB,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAiB9E;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CA4BvF;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CA6BvF;AAED;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,UAAU,GAChB,MAAM,GAAG,IAAI,CAuBf;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAgClE;AAED;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAkD3E;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAsDtF;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAerF;AAED;;;;GAIG;AAEH,qFAAqF;AACrF,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,SAAS,GAAG,cAAc,EAAE,CA2B5E;AAED;;;;;;GAMG;AACH,wBAAgB,mCAAmC,CACjD,IAAI,EAAE,SAAS,GACd,cAAc,EAAE,CAyBlB;AAED,kFAAkF;AAClF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,cAAc,EAAE,CAKrE"}
@@ -5,10 +5,15 @@ exports.checkCaptionsContract = checkCaptionsContract;
5
5
  exports.checkNarrationDensityContract = checkNarrationDensityContract;
6
6
  exports.checkSceneTtsBudget = checkSceneTtsBudget;
7
7
  exports.checkSceneDurationCapability = checkSceneDurationCapability;
8
+ exports.checkChapterContract = checkChapterContract;
9
+ exports.checkBudgetContract = checkBudgetContract;
8
10
  exports.collectSceneVoClipWarnings = collectSceneVoClipWarnings;
9
11
  exports.collectSceneTrailingSilenceWarnings = collectSceneTrailingSilenceWarnings;
10
12
  exports.collectPlanWarnings = collectPlanWarnings;
13
+ const brief_schema_1 = require("../../../schemas/brief.schema");
11
14
  const tierHelpers_1 = require("../../../globals/aiModels/tierHelpers");
15
+ const extendVideo_tool_1 = require("../tools/extendVideo.tool");
16
+ const costPreflight_1 = require("../costPreflight");
12
17
  const ttsDuration_1 = require("../ttsDuration");
13
18
  /**
14
19
  * Single threshold for the trailing-silence warning. The executor pads
@@ -184,6 +189,15 @@ function checkSceneDurationCapability(plan) {
184
189
  // Allow ±0.25s wiggle so 1.8s → 2 floor doesn't trip on rounding.
185
190
  const matches = allowed.some((v) => Math.abs(v - seconds) < 0.25);
186
191
  if (!matches) {
192
+ // AG-2 / L-4: a scene LONGER than the model's max single clip is not a
193
+ // capability error when the model supports native extension — the
194
+ // executor builds an initial clip + N extensions (extend chain), so the
195
+ // long duration is intentional. Only genuine mismatches still flag:
196
+ // too-short, between-legal-values, or over-max on a non-extend model.
197
+ const maxAllowed = allowed[allowed.length - 1]; // sorted ascending
198
+ if (seconds > maxAllowed + 0.25 && (0, extendVideo_tool_1.modelSupportsExtend)(scene.preferredModel)) {
199
+ continue;
200
+ }
187
201
  offending.push({
188
202
  sceneIndex: scene.sceneIndex,
189
203
  seconds: Math.round(seconds * 100) / 100,
@@ -203,6 +217,89 @@ function checkSceneDurationCapability(plan) {
203
217
  `Short-duration capable models: bytedance-seedance-1.0-pro-fast (2-12s), bytedance-seedance-1.0-pro (2-12s), runway-gen4.5 (2-10s), kling-v3.0 (3-15s), google-veo-3.1-lite (4-8s). ` +
204
218
  `Do NOT pick minimax-hailuo for any scene shorter than 6s.`);
205
219
  }
220
+ /**
221
+ * Stream L (L-2): chapter contract for long-form plans. L1/L2 plans MUST carry
222
+ * a plan.chapters[] structure that partitions the scene list into titled,
223
+ * contiguous, gap-free, non-overlapping sections covering every scene exactly
224
+ * once. Returns a correction message on violation, null when satisfied or N/A
225
+ * (S1/S2/M1 — M1 chapters are recommended, not enforced).
226
+ */
227
+ function checkChapterContract(plan, brief) {
228
+ const tier = brief.lengthTier ?? (0, brief_schema_1.deriveLengthTier)(brief.durationSec);
229
+ if (tier !== "L1" && tier !== "L2")
230
+ return null; // only long-form is enforced
231
+ const sceneCount = plan.scenes.length;
232
+ const allIndices = plan.scenes.map((s) => s.sceneIndex).sort((a, b) => a - b);
233
+ const chapters = plan.chapters ?? [];
234
+ if (chapters.length === 0) {
235
+ return (`Chapter contract violation: lengthTier=${tier} (long-form) requires a ` +
236
+ `top-level plan.chapters[] structure, but none was provided. Group the ` +
237
+ `${sceneCount} scenes into 3-7 titled chapters. Each chapter = ` +
238
+ `{ id: "CH_<n>", title, sceneIndices: [...] }. The union of all ` +
239
+ `sceneIndices MUST equal every scene index [${allIndices.join(", ")}] ` +
240
+ `exactly once, in render order, with no gaps or overlaps.`);
241
+ }
242
+ // Validate coverage: flatten all chapter sceneIndices, check exact partition.
243
+ const seen = new Map(); // sceneIndex → count
244
+ for (const ch of chapters) {
245
+ for (const idx of ch.sceneIndices) {
246
+ seen.set(idx, (seen.get(idx) ?? 0) + 1);
247
+ }
248
+ }
249
+ const validIdx = new Set(allIndices);
250
+ const duplicates = [...seen.entries()].filter(([, n]) => n > 1).map(([i]) => i);
251
+ const unknown = [...seen.keys()].filter((i) => !validIdx.has(i));
252
+ const uncovered = allIndices.filter((i) => !seen.has(i));
253
+ const problems = [];
254
+ if (uncovered.length)
255
+ problems.push(`scenes NOT in any chapter: ${uncovered.join(", ")}`);
256
+ if (duplicates.length)
257
+ problems.push(`scenes in MORE THAN ONE chapter: ${duplicates.join(", ")}`);
258
+ if (unknown.length)
259
+ problems.push(`chapter sceneIndices that don't exist: ${unknown.join(", ")}`);
260
+ // Within-chapter contiguity + ascending order.
261
+ for (const ch of chapters) {
262
+ const ids = ch.sceneIndices;
263
+ for (let i = 1; i < ids.length; i++) {
264
+ if (ids[i] <= ids[i - 1]) {
265
+ problems.push(`chapter ${ch.id} sceneIndices not strictly ascending: [${ids.join(", ")}]`);
266
+ break;
267
+ }
268
+ }
269
+ }
270
+ if (problems.length === 0)
271
+ return null;
272
+ return (`Chapter contract violation (lengthTier=${tier}): ${problems.join("; ")}. ` +
273
+ `Fix so plan.chapters[] partitions the scene list exactly: every scene ` +
274
+ `index [${allIndices.join(", ")}] appears in EXACTLY ONE chapter, chapters ` +
275
+ `are in render order, and each chapter's sceneIndices are consecutive and ` +
276
+ `ascending.`);
277
+ }
278
+ /**
279
+ * Stream L (L-6) — hard spend cap. When brief.maxSpendUSD is set, reject any
280
+ * plan whose estimated scene-generation cost exceeds it BEFORE any spend.
281
+ * Returns a correction message (used as planner-retry feedback for scene-first;
282
+ * the script-first pipeline downgrades tiers itself). Null when no cap is set
283
+ * or the plan is within budget. Overhead (planner/critic/bible ≈ $0.50) is
284
+ * intentionally excluded — the cap governs the dominant generation spend, and
285
+ * counting fixed overhead against a user-facing "video cost" cap reads wrong.
286
+ */
287
+ function checkBudgetContract(plan, brief) {
288
+ if (brief.maxSpendUSD == null)
289
+ return null;
290
+ const credits = (0, costPreflight_1.estimatePlanCost)(plan).totalCredits;
291
+ const usd = (0, costPreflight_1.creditsToUsd)(credits);
292
+ if (usd <= brief.maxSpendUSD)
293
+ return null;
294
+ const overBy = usd - brief.maxSpendUSD;
295
+ return (`Budget contract violation: estimated generation cost $${usd.toFixed(2)} ` +
296
+ `(${Math.round(credits)} credits) exceeds brief.maxSpendUSD=$${brief.maxSpendUSD.toFixed(2)} ` +
297
+ `by $${overBy.toFixed(2)}. Bring it under budget BY: (a) lowering per-scene ` +
298
+ `tiers (prefer T0/T1 stock + ai-image-static for B-roll, reserve T2/T3 for ` +
299
+ `the hook/hero scene only); (b) using strategy="stock-video"/"stock-image-ken-burns" ` +
300
+ `where a generated clip isn't essential; and/or (c) reducing scene count or ` +
301
+ `total duration. Do NOT exceed the cap — it is a hard pre-spend limit.`);
302
+ }
206
303
  /**
207
304
  * Warning-channel siblings of the rejection validators above. These run on
208
305
  * an already-approved plan (or after a sceneEdit patch) and produce
@@ -1,3 +1,4 @@
1
1
  export { Planner, type PlannerOptions } from "./planner/Planner";
2
- export { checkSceneTtsBudget, checkSceneDurationCapability, collectPlanWarnings, collectSceneVoClipWarnings, collectSceneTrailingSilenceWarnings, } from "./planner/validators";
2
+ export { planScriptFirst, type ScriptFirstDeps, } from "./planner/scriptFirstPlanner";
3
+ export { checkBudgetContract, checkChapterContract, checkSceneTtsBudget, checkSceneDurationCapability, collectPlanWarnings, collectSceneVoClipWarnings, collectSceneTrailingSilenceWarnings, } from "./planner/validators";
3
4
  //# sourceMappingURL=planner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../../src/services/agent/planner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,mBAAmB,EACnB,0BAA0B,EAC1B,mCAAmC,GACpC,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../../src/services/agent/planner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EACL,eAAe,EACf,KAAK,eAAe,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,4BAA4B,EAC5B,mBAAmB,EACnB,0BAA0B,EAC1B,mCAAmC,GACpC,MAAM,sBAAsB,CAAC"}
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.collectSceneTrailingSilenceWarnings = exports.collectSceneVoClipWarnings = exports.collectPlanWarnings = exports.checkSceneDurationCapability = exports.checkSceneTtsBudget = exports.Planner = void 0;
3
+ exports.collectSceneTrailingSilenceWarnings = exports.collectSceneVoClipWarnings = exports.collectPlanWarnings = exports.checkSceneDurationCapability = exports.checkSceneTtsBudget = exports.checkChapterContract = exports.checkBudgetContract = exports.planScriptFirst = exports.Planner = void 0;
4
4
  // Barrel — planner was split into per-concern modules under `planner/`.
5
5
  // Public surface (`Planner`, `PlannerOptions`) is preserved byte-for-byte
6
6
  // for npm consumers of `vidspotai-shared`.
7
7
  var Planner_1 = require("./planner/Planner");
8
8
  Object.defineProperty(exports, "Planner", { enumerable: true, get: function () { return Planner_1.Planner; } });
9
+ var scriptFirstPlanner_1 = require("./planner/scriptFirstPlanner");
10
+ Object.defineProperty(exports, "planScriptFirst", { enumerable: true, get: function () { return scriptFirstPlanner_1.planScriptFirst; } });
9
11
  var validators_1 = require("./planner/validators");
12
+ Object.defineProperty(exports, "checkBudgetContract", { enumerable: true, get: function () { return validators_1.checkBudgetContract; } });
13
+ Object.defineProperty(exports, "checkChapterContract", { enumerable: true, get: function () { return validators_1.checkChapterContract; } });
10
14
  Object.defineProperty(exports, "checkSceneTtsBudget", { enumerable: true, get: function () { return validators_1.checkSceneTtsBudget; } });
11
15
  Object.defineProperty(exports, "checkSceneDurationCapability", { enumerable: true, get: function () { return validators_1.checkSceneDurationCapability; } });
12
16
  Object.defineProperty(exports, "collectPlanWarnings", { enumerable: true, get: function () { return validators_1.collectPlanWarnings; } });
@@ -0,0 +1,26 @@
1
+ import { Project } from "../../schemas/project.schema";
2
+ /**
3
+ * Gap #1 follow-up (round-trip seam, Stage 9) — resolve the "prior project"
4
+ * the agent must preserve / ask permission against, picking the surface that
5
+ * actually carries the user's editor edits.
6
+ *
7
+ * Why two surfaces exist and which wins:
8
+ * - `agentProjects/{id}.projectJson` is the AGENT's own last output. The
9
+ * drawer subscribes to it via onSnapshot and reloads the timeline on every
10
+ * change, so the editor must NOT write its edits there (a write would echo
11
+ * back and clobber the canvas mid-edit).
12
+ * - `videoJobs/{id}.project` is the EDITOR's canonical store. finalize.ts
13
+ * mirrors the agent Project into it with doc-id === projectId, and the
14
+ * editor autosave (PUT /v1/video/{id}/editor-state) writes the user's
15
+ * locks/trims/text edits straight there.
16
+ *
17
+ * So the editor copy WINS when present: it's either identical to the agent
18
+ * copy (no edits since the last run — the finalize mirror) or strictly ahead
19
+ * of it (user edited after the run). We fall back to the agent copy when the
20
+ * editor doc is missing (project planned but never rendered) or unparseable.
21
+ *
22
+ * Returns the parsed `Project` or `null` (first run / empty canvas / both
23
+ * surfaces malformed) — a clean no-op for the preserve + permission callers.
24
+ */
25
+ export declare function loadEffectivePriorProject(projectId: string, agentProjectJson: unknown): Promise<Project | null>;
26
+ //# sourceMappingURL=priorProject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"priorProject.d.ts","sourceRoot":"","sources":["../../../src/services/agent/priorProject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiB,MAAM,8BAA8B,CAAC;AAItE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,OAAO,GACxB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAqBzB"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadEffectivePriorProject = loadEffectivePriorProject;
4
+ const project_schema_1 = require("../../schemas/project.schema");
5
+ const firestore_service_1 = require("../firestore.service");
6
+ const logger_1 = require("../../utils/logger");
7
+ /**
8
+ * Gap #1 follow-up (round-trip seam, Stage 9) — resolve the "prior project"
9
+ * the agent must preserve / ask permission against, picking the surface that
10
+ * actually carries the user's editor edits.
11
+ *
12
+ * Why two surfaces exist and which wins:
13
+ * - `agentProjects/{id}.projectJson` is the AGENT's own last output. The
14
+ * drawer subscribes to it via onSnapshot and reloads the timeline on every
15
+ * change, so the editor must NOT write its edits there (a write would echo
16
+ * back and clobber the canvas mid-edit).
17
+ * - `videoJobs/{id}.project` is the EDITOR's canonical store. finalize.ts
18
+ * mirrors the agent Project into it with doc-id === projectId, and the
19
+ * editor autosave (PUT /v1/video/{id}/editor-state) writes the user's
20
+ * locks/trims/text edits straight there.
21
+ *
22
+ * So the editor copy WINS when present: it's either identical to the agent
23
+ * copy (no edits since the last run — the finalize mirror) or strictly ahead
24
+ * of it (user edited after the run). We fall back to the agent copy when the
25
+ * editor doc is missing (project planned but never rendered) or unparseable.
26
+ *
27
+ * Returns the parsed `Project` or `null` (first run / empty canvas / both
28
+ * surfaces malformed) — a clean no-op for the preserve + permission callers.
29
+ */
30
+ async function loadEffectivePriorProject(projectId, agentProjectJson) {
31
+ let editorProjectJson;
32
+ try {
33
+ const snap = await firestore_service_1.FirestoreService.videoJobsCol.doc(projectId).get();
34
+ if (snap.exists) {
35
+ editorProjectJson = snap.data()?.project;
36
+ }
37
+ }
38
+ catch (err) {
39
+ // videoJobs read failed — fall back to the agent copy. Non-fatal: the
40
+ // worst case is we miss the user's latest editor edits this run.
41
+ logger_1.logger.warn("agent.priorProject.videoJobsReadFailed", {
42
+ projectId,
43
+ err: err.message,
44
+ });
45
+ }
46
+ const editorParsed = project_schema_1.ProjectSchema.safeParse(editorProjectJson);
47
+ if (editorParsed.success)
48
+ return editorParsed.data;
49
+ const agentParsed = project_schema_1.ProjectSchema.safeParse(agentProjectJson);
50
+ return agentParsed.success ? agentParsed.data : null;
51
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/providerFallback/chains.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,eAAe,EACf,aAAa,EAEb,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;;;;;;GAYG;AAGH,eAAO,MAAM,sBAAsB,EAAE,SAAS,eAAe,EAM5D,CAAC;AAKF,eAAO,MAAM,sBAAsB,EAAE,SAAS,eAAe,EAQ5D,CAAC;AAQF,eAAO,MAAM,uBAAuB,EAAE,SAAS,eAAe,EAQ7D,CAAC;AAKF,eAAO,MAAM,uBAAuB,EAAE,SAAS,eAAe,EAM7D,CAAC;AAGF,eAAO,MAAM,kBAAkB,EAAE,SAAS,eAAe,EAExD,CAAC;AAGF,eAAO,MAAM,WAAW,EAAE,SAAS,eAAe,EAGjD,CAAC;AAGF,eAAO,MAAM,SAAS,EAAE,SAAS,aAAa,EAE7C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wCAAwC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,eAAe,EACtB,GAAG,EAAE,sBAAsB,GAC1B,OAAO,CAuCT;AA8CD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,eAAe,EAC5B,aAAa,EAAE,SAAS,eAAe,EAAE,GACxC,eAAe,EAAE,CAMnB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,mBAAmB;IAClC,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,8CAA8C;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,GAAG,eAAe,EAC/B,WAAW,EAAE,MAAM,EACnB,IAAI,GAAE,mBAAwB,GAC7B,kBAAkB,GAAG,IAAI,CAyB3B"}
1
+ {"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/providerFallback/chains.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,eAAe,EACf,aAAa,EAEb,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAGnC;;;;;;;;;;;;GAYG;AAGH,eAAO,MAAM,sBAAsB,EAAE,SAAS,eAAe,EAM5D,CAAC;AAKF,eAAO,MAAM,sBAAsB,EAAE,SAAS,eAAe,EAQ5D,CAAC;AAQF,eAAO,MAAM,uBAAuB,EAAE,SAAS,eAAe,EAQ7D,CAAC;AAKF,eAAO,MAAM,uBAAuB,EAAE,SAAS,eAAe,EAM7D,CAAC;AAGF,eAAO,MAAM,kBAAkB,EAAE,SAAS,eAAe,EAExD,CAAC;AAGF,eAAO,MAAM,WAAW,EAAE,SAAS,eAAe,EAGjD,CAAC;AAGF,eAAO,MAAM,SAAS,EAAE,SAAS,aAAa,EAE7C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wCAAwC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,eAAe,EACtB,GAAG,EAAE,sBAAsB,GAC1B,OAAO,CAuCT;AAyDD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,eAAe,EAC5B,aAAa,EAAE,SAAS,eAAe,EAAE,GACxC,eAAe,EAAE,CAMnB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,mBAAmB;IAClC,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,8CAA8C;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,GAAG,eAAe,EAC/B,WAAW,EAAE,MAAM,EACnB,IAAI,GAAE,mBAAwB,GAC7B,kBAAkB,GAAG,IAAI,CAyB3B"}
@@ -5,6 +5,7 @@ exports.isVideoModelCapable = isVideoModelCapable;
5
5
  exports.buildVideoChain = buildVideoChain;
6
6
  exports.snapDurationForModel = snapDurationForModel;
7
7
  const aiModels_1 = require("../../../globals/aiModels");
8
+ const helpers_1 = require("../../aiGen/helpers");
8
9
  /**
9
10
  * Provider-chain configuration per modality (F3.3).
10
11
  * Ordered primary → fallback. The wrapper walks the chain on recoverable
@@ -133,20 +134,30 @@ function normalizeAspect(a) {
133
134
  function gcd(a, b) {
134
135
  return b === 0 ? a : gcd(b, a % b);
135
136
  }
136
- // AG-16: small allow-lists for capabilities not yet on the schema. Conservative
137
- // extend as we wire native audio / lastFrame as proper schema fields.
138
- const END_FRAME_MODELS = new Set([
139
- aiModels_1.EVideoGenModels.GOOGLE_VEO_3_1,
140
- aiModels_1.EVideoGenModels.GOOGLE_VEO_3_1_FAST,
141
- aiModels_1.EVideoGenModels.GOOGLE_VEO_3_1_LITE,
142
- aiModels_1.EVideoGenModels.KLING_V2_6,
143
- aiModels_1.EVideoGenModels.KLING_V2_5_TURBO,
144
- aiModels_1.EVideoGenModels.KLING_V3_0,
145
- aiModels_1.EVideoGenModels.RUNWAY_GEN4_TURBO,
146
- aiModels_1.EVideoGenModels.RUNWAY_GEN4_5,
147
- aiModels_1.EVideoGenModels.BYTEDANCE_SEEDANCE_2_0,
148
- aiModels_1.EVideoGenModels.PIXVERSE_V5_6,
149
- ]);
137
+ // AG-1: last-frame (FLF) support is now read from the SAME source of truth the
138
+ // prod API-time guard uses a model declares `lastFrameImageUrl` in its config
139
+ // `fields` (see aiGen/helpers.modelSupportsLastFrame). The old hardcoded
140
+ // END_FRAME_MODELS set had drifted (it listed veo-3.1-lite, pixverse-v5.6 and
141
+ // seedance-2.0, none of which actually declare the field), so the agent gate
142
+ // would pass a request the provider/validator then rejected — wasting a chain
143
+ // slot. Reading the config removes that drift and self-maintains.
144
+ //
145
+ // REMOVED FOR v2 (AG-1) — kept for reference: the stale hardcoded allow-list.
146
+ // const END_FRAME_MODELS = new Set<string>([
147
+ // EVideoGenModels.GOOGLE_VEO_3_1,
148
+ // EVideoGenModels.GOOGLE_VEO_3_1_FAST,
149
+ // EVideoGenModels.GOOGLE_VEO_3_1_LITE,
150
+ // EVideoGenModels.KLING_V2_6,
151
+ // EVideoGenModels.KLING_V2_5_TURBO,
152
+ // EVideoGenModels.KLING_V3_0,
153
+ // EVideoGenModels.RUNWAY_GEN4_TURBO,
154
+ // EVideoGenModels.RUNWAY_GEN4_5,
155
+ // EVideoGenModels.BYTEDANCE_SEEDANCE_2_0,
156
+ // EVideoGenModels.PIXVERSE_V5_6,
157
+ // ]);
158
+ // AG-16: small allow-list for native-audio support — not yet on the schema as a
159
+ // queryable field, so kept hardcoded (conservative). Extend when audio becomes
160
+ // a proper config field like lastFrameImageUrl did.
150
161
  const AUDIO_MODELS = new Set([
151
162
  aiModels_1.EVideoGenModels.GOOGLE_VEO_3,
152
163
  aiModels_1.EVideoGenModels.GOOGLE_VEO_3_1,
@@ -156,7 +167,8 @@ const AUDIO_MODELS = new Set([
156
167
  aiModels_1.EVideoGenModels.KLING_AVATAR,
157
168
  ]);
158
169
  function supportsEndFrame(m) {
159
- return END_FRAME_MODELS.has(m);
170
+ // Single source of truth: model config declares `lastFrameImageUrl` in fields.
171
+ return (0, helpers_1.modelSupportsLastFrame)(m);
160
172
  }
161
173
  function supportsAudio(m) {
162
174
  return AUDIO_MODELS.has(m);
@@ -0,0 +1,3 @@
1
+ export * from "./repurpose.schema";
2
+ export * from "./shortsPicker";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/repurpose/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,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("./repurpose.schema"), exports);
18
+ __exportStar(require("./shortsPicker"), exports);