vidspotai-shared 1.0.82 → 1.0.83

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 +87 -243
  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
@@ -0,0 +1,400 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runVisual = runVisual;
4
+ const logger_1 = require("../../../utils/logger");
5
+ const referenceImageRenderer_1 = require("../referenceImageRenderer");
6
+ const extendChain_1 = require("../extendChain");
7
+ const helpers_1 = require("../../aiGen/helpers");
8
+ const unsplash_service_1 = require("../../aiGen/providers/unsplash/unsplash.service");
9
+ const duration_1 = require("./duration");
10
+ async function runVisual(deps, scene, ctx, aspect, plan) {
11
+ // Gap #1 follow-up — skip-generation. The user froze this scene's visual in
12
+ // a prior run; planToProject reproduces the preserved clip verbatim, so any
13
+ // gen we ran here would be discarded. Return a no-op outcome (no visualUrl,
14
+ // no pendingTaskId) BEFORE any provider call: no task minted, no $$ spent.
15
+ if (deps.frozenVisualScenes?.has(scene.sceneIndex)) {
16
+ logger_1.logger.info("executor: skip-gen — visual frozen (preserved), no provider call", {
17
+ sceneIndex: scene.sceneIndex,
18
+ strategy: scene.strategy,
19
+ });
20
+ return { ok: true, output: { tool: "frozen" } };
21
+ }
22
+ const durationSec = Math.max(2, Math.round(scene.durationMs / 1000));
23
+ // AG-13: collect reference images for this scene's bible entities. Empty
24
+ // array when bible is C0/C1 or no entities are tagged — image-gen falls
25
+ // back to pure text prompt.
26
+ const referenceImageUrls = (0, referenceImageRenderer_1.collectReferenceImageUrls)(plan.bible, scene.bibleEntityIds ?? []);
27
+ // AG-11b: if this scene reuses a character from an earlier scene, prepend
28
+ // that anchor's generated still as an inputImage for image-to-image
29
+ // identity transfer. The Visual Bible (C2) is the primary consistency
30
+ // signal; this is the backup signal (characterAnchorSceneIndex) made real
31
+ // on the executor side. Merge ahead of bible refs and de-dupe.
32
+ const anchorImageUrl = await deps.resolveAnchorIdentityImage(scene);
33
+ const identityRefs = anchorImageUrl
34
+ ? Array.from(new Set([anchorImageUrl, ...referenceImageUrls]))
35
+ : referenceImageUrls;
36
+ const wrap = (tool, outcome) => outcome.ok
37
+ ? { ok: true, output: { tool, ...outcome.output } }
38
+ : { ok: false, error: outcome.error };
39
+ switch (scene.strategy) {
40
+ case "stock-video":
41
+ case "stock-image-ken-burns": {
42
+ const out = await deps.runTool("search_stock", {
43
+ query: scene.prompt,
44
+ kind: scene.strategy === "stock-video" ? "video" : "image",
45
+ aspectRatio: aspect,
46
+ minDurationSec: scene.strategy === "stock-video" ? durationSec : undefined,
47
+ }, ctx);
48
+ if (!out.ok)
49
+ return wrap("search_stock", out);
50
+ const stockAsset = out.output.assets[0];
51
+ const url = stockAsset?.url;
52
+ if (!url)
53
+ return {
54
+ ok: false,
55
+ error: {
56
+ code: "NO_STOCK_RESULTS",
57
+ message: `No stock results for: ${scene.prompt}`,
58
+ attemptedProviders: out.output.attemptedProviders,
59
+ },
60
+ };
61
+ // P-UNS-1: Unsplash API ToS requires firing the provider's
62
+ // download-tracking endpoint when an asset is actually USED in a render
63
+ // (not at search time). runVisual runs once per scene at execution, so
64
+ // this is exactly the commit point. Unsplash-only — Pexels/Pixabay omit
65
+ // trackingUrl, and pingDownload() self-guards when the key is unset.
66
+ // Fire-and-forget: a tracking hiccup must never fail the scene.
67
+ if (stockAsset?.trackingUrl) {
68
+ void new unsplash_service_1.UnsplashProviderService()
69
+ .pingDownload(stockAsset.trackingUrl)
70
+ .catch((err) => logger_1.logger.warn("unsplash pingDownload failed (non-fatal)", {
71
+ error: err instanceof Error ? err.message : String(err),
72
+ sceneIndex: scene.sceneIndex,
73
+ agentRunId: ctx.agentRunId,
74
+ }));
75
+ }
76
+ return {
77
+ ok: true,
78
+ output: {
79
+ tool: "search_stock",
80
+ visualUrl: url,
81
+ attemptedProviders: out.output.attemptedProviders,
82
+ // P-UNS-2: carry stock attribution to the clip provenance (Unsplash
83
+ // requires visible credit; Pexels/Pixabay leave it undefined).
84
+ attribution: stockAsset.attribution,
85
+ },
86
+ };
87
+ }
88
+ case "ai-image-static":
89
+ case "ai-image-motion": {
90
+ const out = await deps.runTool("generate_image", {
91
+ prompt: scene.prompt,
92
+ modelKey: scene.preferredModel ?? "google-nano-banana",
93
+ aspectRatio: aspect,
94
+ ...(identityRefs.length
95
+ ? { inputImageUrls: identityRefs }
96
+ : {}),
97
+ }, ctx);
98
+ if (!out.ok)
99
+ return wrap("generate_image", out);
100
+ // AG-11b: this generated still is the scene's identity frame — publish
101
+ // it so later same-character scenes can anchor off it.
102
+ deps.publishIdentityImage(scene.sceneIndex, out.output.imageUrl);
103
+ return { ok: true, output: { tool: "generate_image", visualUrl: out.output.imageUrl } };
104
+ }
105
+ case "ai-image-to-video": {
106
+ const animateModelKey = scene.preferredModel ?? "kling-v2.6";
107
+ // AG-2 / L-4: if the scene wants more seconds than this model emits in
108
+ // one clip and the model supports native extension, build the initial
109
+ // clip at the model's max length and emit the rest as extension steps
110
+ // (resolved sequentially host-side). Otherwise fall back to the snap
111
+ // path, which clamps to the nearest legal value.
112
+ const chain = (0, extendChain_1.planExtendChain)(animateModelKey, durationSec);
113
+ const extendChain = chain?.segments;
114
+ const animateDurationSec = chain
115
+ ? chain.initialDurationSec
116
+ : (0, duration_1.resolveDurationForPreferredModel)(animateModelKey, durationSec, !!scene.preferredModel, scene.sceneIndex);
117
+ if (chain) {
118
+ logger_1.logger.info("executor: scene needs extend chain", {
119
+ sceneIndex: scene.sceneIndex,
120
+ modelKey: animateModelKey,
121
+ targetSec: durationSec,
122
+ initialSec: chain.initialDurationSec,
123
+ extensions: chain.segments.length,
124
+ });
125
+ }
126
+ // AG-1 Phase 2 — first-last-frame (FLF) interpolation. Only honour
127
+ // scene.lastFramePrompt when the chosen model actually accepts an end
128
+ // frame (capability gate reads `lastFrameImageUrl` from its config).
129
+ // On a non-FLF model the field is silently ignored so a stray planner
130
+ // value never breaks the scene — it just renders as plain i2v.
131
+ const useFlf = !!scene.lastFramePrompt && (0, helpers_1.modelSupportsLastFrame)(animateModelKey);
132
+ if (scene.lastFramePrompt && !useFlf) {
133
+ logger_1.logger.warn("executor: ignoring lastFramePrompt — model is not FLF-capable", { sceneIndex: scene.sceneIndex, modelKey: animateModelKey });
134
+ }
135
+ // Stage 7 slice 1: cache key spans the WHOLE strategy (both image-gen
136
+ // + animate). Hashing only upstream-stable inputs — prompt, model,
137
+ // duration, aspect, reference images — lets a re-execute skip BOTH
138
+ // tool calls, replaying the cached animate taskId through the poller.
139
+ // AG-1: the end-frame prompt is part of the cache identity so toggling
140
+ // FLF on a scene re-generates rather than replaying the old single-frame task.
141
+ const clipId = `scene-${scene.sceneIndex}-visual`;
142
+ const cacheInput = {
143
+ strategy: "ai-image-to-video",
144
+ prompt: scene.prompt,
145
+ modelKey: animateModelKey,
146
+ durationSec: animateDurationSec,
147
+ aspect,
148
+ // AG-11b: intentionally keys on referenceImageUrls (bible), NOT
149
+ // identityRefs. The anchor still is generated per-run and is absent
150
+ // on a cache-hit re-execute (the anchor scene replays without
151
+ // re-generating its image); including it would bust the cache every
152
+ // re-execute and re-submit gen tasks. The anchored identity is
153
+ // already baked into the minted animate task, so a plain replay
154
+ // preserves consistency. Do NOT add identityRefs here.
155
+ referenceImageUrls,
156
+ extendSegments: extendChain?.length ?? 0,
157
+ ...(useFlf ? { lastFramePrompt: scene.lastFramePrompt } : {}),
158
+ };
159
+ const { hit, inputsHash } = deps.checkTaskCache(clipId, "animate_image", cacheInput);
160
+ if (hit) {
161
+ return {
162
+ ok: true,
163
+ output: {
164
+ tool: "animate_image",
165
+ pendingTaskId: hit.taskId,
166
+ pendingModelKey: hit.modelKey,
167
+ // Re-emit the chain on cache replay so the host still resolves the
168
+ // extensions from the cached source task (extensions aren't cached).
169
+ ...(extendChain ? { extendChain } : {}),
170
+ },
171
+ };
172
+ }
173
+ const img = await deps.runTool("generate_image", {
174
+ prompt: scene.prompt,
175
+ modelKey: "google-nano-banana",
176
+ aspectRatio: aspect,
177
+ ...(identityRefs.length
178
+ ? { inputImageUrls: identityRefs }
179
+ : {}),
180
+ }, { ...ctx, idempotencyKey: `${ctx.idempotencyKey}:img` });
181
+ if (!img.ok)
182
+ return wrap("generate_image", img);
183
+ // AG-11b: publish the i2v first frame as this scene's identity still so
184
+ // later same-character scenes can anchor off it.
185
+ deps.publishIdentityImage(scene.sceneIndex, img.output.imageUrl);
186
+ // AG-1: generate the END composition for FLF. Same reference images as
187
+ // the first frame so identity stays locked across the interpolation.
188
+ let lastFrameImageUrl;
189
+ if (useFlf) {
190
+ const endImg = await deps.runTool("generate_image", {
191
+ prompt: scene.lastFramePrompt,
192
+ modelKey: "google-nano-banana",
193
+ aspectRatio: aspect,
194
+ ...(identityRefs.length
195
+ ? { inputImageUrls: identityRefs }
196
+ : {}),
197
+ }, { ...ctx, idempotencyKey: `${ctx.idempotencyKey}:imgEnd` });
198
+ if (!endImg.ok)
199
+ return wrap("generate_image", endImg);
200
+ lastFrameImageUrl = endImg.output.imageUrl;
201
+ }
202
+ const animate = await deps.runTool("animate_image", {
203
+ imageUrl: img.output.imageUrl,
204
+ motionHint: scene.prompt,
205
+ durationSec: animateDurationSec,
206
+ modelKey: animateModelKey,
207
+ ...(lastFrameImageUrl ? { lastFrameImageUrl } : {}),
208
+ }, ctx);
209
+ if (!animate.ok)
210
+ return wrap("animate_image", animate);
211
+ const mintedModelKey = animate.output.modelKeyUsed ?? animateModelKey;
212
+ await deps.mintTaskCache(clipId, {
213
+ tool: "animate_image",
214
+ taskId: animate.output.taskId,
215
+ modelKey: mintedModelKey,
216
+ inputsHash,
217
+ createdAt: Date.now(),
218
+ });
219
+ return {
220
+ ok: true,
221
+ output: {
222
+ tool: "animate_image",
223
+ pendingTaskId: animate.output.taskId,
224
+ pendingModelKey: mintedModelKey,
225
+ attemptedProviders: animate.output.attemptedProviders,
226
+ ...(extendChain ? { extendChain } : {}),
227
+ },
228
+ };
229
+ }
230
+ case "ai-text-to-video": {
231
+ const t2vModelKey = scene.preferredModel ?? "kling-v2.6";
232
+ // AG-2 / L-4: same extend-chain decision as ai-image-to-video.
233
+ const chain = (0, extendChain_1.planExtendChain)(t2vModelKey, durationSec);
234
+ const extendChain = chain?.segments;
235
+ const t2vDurationSec = chain
236
+ ? chain.initialDurationSec
237
+ : (0, duration_1.resolveDurationForPreferredModel)(t2vModelKey, durationSec, !!scene.preferredModel, scene.sceneIndex);
238
+ if (chain) {
239
+ logger_1.logger.info("executor: scene needs extend chain", {
240
+ sceneIndex: scene.sceneIndex,
241
+ modelKey: t2vModelKey,
242
+ targetSec: durationSec,
243
+ initialSec: chain.initialDurationSec,
244
+ extensions: chain.segments.length,
245
+ });
246
+ }
247
+ const clipId = `scene-${scene.sceneIndex}-visual`;
248
+ const cacheInput = {
249
+ strategy: "ai-text-to-video",
250
+ prompt: scene.prompt,
251
+ modelKey: t2vModelKey,
252
+ durationSec: t2vDurationSec,
253
+ extendSegments: extendChain?.length ?? 0,
254
+ };
255
+ const { hit, inputsHash } = deps.checkTaskCache(clipId, "generate_video", cacheInput);
256
+ if (hit) {
257
+ return {
258
+ ok: true,
259
+ output: {
260
+ tool: "generate_video",
261
+ pendingTaskId: hit.taskId,
262
+ pendingModelKey: hit.modelKey,
263
+ ...(extendChain ? { extendChain } : {}),
264
+ },
265
+ };
266
+ }
267
+ const out = await deps.runTool("generate_video", {
268
+ prompt: scene.prompt,
269
+ modelKey: t2vModelKey,
270
+ durationSec: t2vDurationSec,
271
+ }, ctx);
272
+ if (!out.ok)
273
+ return wrap("generate_video", out);
274
+ const mintedModelKey = out.output.modelKeyUsed ?? t2vModelKey;
275
+ await deps.mintTaskCache(clipId, {
276
+ tool: "generate_video",
277
+ taskId: out.output.taskId,
278
+ modelKey: mintedModelKey,
279
+ inputsHash,
280
+ createdAt: Date.now(),
281
+ });
282
+ return {
283
+ ok: true,
284
+ output: {
285
+ tool: "generate_video",
286
+ pendingTaskId: out.output.taskId,
287
+ pendingModelKey: mintedModelKey,
288
+ attemptedProviders: out.output.attemptedProviders,
289
+ ...(extendChain ? { extendChain } : {}),
290
+ },
291
+ };
292
+ }
293
+ case "user-asset": {
294
+ // Per-user library search. The host injects the searcher at boot
295
+ // (see userLibrarySearcher bootstrap); if no match, fall back to
296
+ // stock so the scene still renders rather than failing hard.
297
+ const out = await deps.runTool("search_user_library", { query: scene.prompt, limit: 5 }, ctx);
298
+ if (out.ok) {
299
+ const first = out.output.assets[0];
300
+ if (first) {
301
+ return { ok: true, output: { tool: "search_user_library", visualUrl: first.url } };
302
+ }
303
+ }
304
+ // No hits or searcher missing — fall back to stock-video as the
305
+ // closest cheap substitute so the executor still produces an asset.
306
+ const stock = await deps.runTool("search_stock", {
307
+ query: scene.prompt,
308
+ kind: "video",
309
+ aspectRatio: aspect,
310
+ minDurationSec: durationSec,
311
+ }, ctx);
312
+ if (!stock.ok)
313
+ return wrap("search_stock", stock);
314
+ const fallbackUrl = stock.output.assets[0]?.url;
315
+ if (!fallbackUrl) {
316
+ return {
317
+ ok: false,
318
+ error: {
319
+ code: "USER_ASSET_NO_MATCH",
320
+ message: `No user-library match for "${scene.prompt}" and no stock fallback.`,
321
+ attemptedProviders: stock.output.attemptedProviders,
322
+ },
323
+ };
324
+ }
325
+ return {
326
+ ok: true,
327
+ output: {
328
+ tool: "search_user_library",
329
+ visualUrl: fallbackUrl,
330
+ attemptedProviders: stock.output.attemptedProviders,
331
+ },
332
+ };
333
+ }
334
+ case "talking-head-avatar": {
335
+ if (!scene.avatarFaceUrl) {
336
+ return {
337
+ ok: false,
338
+ error: {
339
+ code: "AVATAR_FACE_REQUIRED",
340
+ message: "talking-head-avatar requires scene.avatarFaceUrl (set on the user's brand kit).",
341
+ },
342
+ };
343
+ }
344
+ if (!scene.voiceoverLine) {
345
+ return {
346
+ ok: false,
347
+ error: {
348
+ code: "AVATAR_VO_REQUIRED",
349
+ message: "talking-head-avatar requires scene.voiceoverLine for the lipsync audio.",
350
+ },
351
+ };
352
+ }
353
+ const avatarMode = scene.tier === "T3" ? "pro" : "std";
354
+ const clipId = `scene-${scene.sceneIndex}-visual`;
355
+ const cacheInput = {
356
+ strategy: "talking-head-avatar",
357
+ inputImageUrl: scene.avatarFaceUrl,
358
+ ttsText: scene.voiceoverLine,
359
+ mode: avatarMode,
360
+ };
361
+ const { hit, inputsHash } = deps.checkTaskCache(clipId, "generate_avatar_video", cacheInput);
362
+ if (hit) {
363
+ return {
364
+ ok: true,
365
+ output: {
366
+ tool: "generate_avatar_video",
367
+ pendingTaskId: hit.taskId,
368
+ pendingModelKey: hit.modelKey,
369
+ },
370
+ };
371
+ }
372
+ const out = await deps.runTool("generate_avatar_video", {
373
+ inputImageUrl: scene.avatarFaceUrl,
374
+ ttsText: scene.voiceoverLine,
375
+ mode: avatarMode,
376
+ }, ctx);
377
+ if (!out.ok)
378
+ return wrap("generate_avatar_video", out);
379
+ await deps.mintTaskCache(clipId, {
380
+ tool: "generate_avatar_video",
381
+ taskId: out.output.taskId,
382
+ // Avatar tool hardcodes Kling Avatar internally; poller needs the
383
+ // actual model key to route via getAiGenProviderService (no special
384
+ // resolver exists). AG-20: was "generate_avatar_video" which would
385
+ // throw at factory lookup the moment the avatar path was polled.
386
+ modelKey: "kling-avatar",
387
+ inputsHash,
388
+ createdAt: Date.now(),
389
+ });
390
+ return {
391
+ ok: true,
392
+ output: {
393
+ tool: "generate_avatar_video",
394
+ pendingTaskId: out.output.taskId,
395
+ pendingModelKey: "kling-avatar",
396
+ },
397
+ };
398
+ }
399
+ }
400
+ }
@@ -0,0 +1,17 @@
1
+ import { VoiceStyle } from "../../../schemas/brief.schema";
2
+ export declare function sanitizeVoiceId(voiceId: string | undefined): string | undefined;
3
+ /**
4
+ * AG-31: map a brief-level voice style adjective to ElevenLabs voice_settings.
5
+ * `style` is the exaggeration param (use sparingly above 0.5 — artifacts);
6
+ * `stability` is the consistency knob (low = more emotive, high = monotone);
7
+ * `speed` is rate (0.7-1.2). Defaults match ElevenLabs' own (style=0,
8
+ * stability=0.5, speed=1.0). Tuning per persona is conservative — we'd rather
9
+ * be slightly flat than artifact-laden.
10
+ */
11
+ export declare function resolveVoiceSettings(style: VoiceStyle | undefined): {
12
+ style?: number;
13
+ stability?: number;
14
+ speed?: number;
15
+ };
16
+ export declare function normalizeVoiceStyle(raw: string | undefined): VoiceStyle | undefined;
17
+ //# sourceMappingURL=voice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/executor/voice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAkB3D,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAU/E;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,UAAU,GAAG,SAAS,GAC5B;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAyBxD;AAgDD,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,GAAG,SAAS,GACtB,UAAU,GAAG,SAAS,CAKxB"}
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sanitizeVoiceId = sanitizeVoiceId;
4
+ exports.resolveVoiceSettings = resolveVoiceSettings;
5
+ exports.normalizeVoiceStyle = normalizeVoiceStyle;
6
+ const voices_1 = require("../../../globals/ttsModels/voices");
7
+ const logger_1 = require("../../../utils/logger");
8
+ /**
9
+ * Voice resolution helpers for the executor's TTS step: strip hallucinated
10
+ * voice IDs, map a (normalized) voice-style adjective onto ElevenLabs
11
+ * voice_settings, and canonicalise freeform style synonyms.
12
+ */
13
+ /**
14
+ * AG-37: planners (LLMs) keep inventing voice IDs like "female-young-adult-en"
15
+ * or "narrator-1" that look reasonable but don't exist in any catalog. When
16
+ * those flow into ElevenLabs the API returns a 400 and the silent-fail VO
17
+ * outcome path drops the VO entirely — final video ships muted. Strip
18
+ * unknown IDs here so the provider falls back to its default voice instead.
19
+ */
20
+ const ELEVENLABS_VOICE_IDS = new Set(voices_1.ELEVENLABS_VOICES.map((v) => v.id));
21
+ function sanitizeVoiceId(voiceId) {
22
+ if (!voiceId)
23
+ return undefined;
24
+ if (ELEVENLABS_VOICE_IDS.has(voiceId))
25
+ return voiceId;
26
+ // Heuristic for non-ElevenLabs providers (openai = "alloy"/"echo"/..., minimax = "male-qn-qingse").
27
+ // Only strip strings that look like LLM-invented descriptive labels (contain a hyphen + recognisable word).
28
+ if (/^(female|male|narrator|presenter|voice)[-_]/i.test(voiceId)) {
29
+ logger_1.logger.warn("executor: stripping invalid voiceId (LLM hallucination)", { voiceId });
30
+ return undefined;
31
+ }
32
+ return voiceId;
33
+ }
34
+ /**
35
+ * AG-31: map a brief-level voice style adjective to ElevenLabs voice_settings.
36
+ * `style` is the exaggeration param (use sparingly above 0.5 — artifacts);
37
+ * `stability` is the consistency knob (low = more emotive, high = monotone);
38
+ * `speed` is rate (0.7-1.2). Defaults match ElevenLabs' own (style=0,
39
+ * stability=0.5, speed=1.0). Tuning per persona is conservative — we'd rather
40
+ * be slightly flat than artifact-laden.
41
+ */
42
+ function resolveVoiceSettings(style) {
43
+ switch (style) {
44
+ case "calm":
45
+ return { style: 0.15, stability: 0.7, speed: 0.95 };
46
+ case "warm":
47
+ return { style: 0.25, stability: 0.6, speed: 1.0 };
48
+ case "casual":
49
+ return { style: 0.3, stability: 0.5, speed: 1.0 };
50
+ case "excited":
51
+ return { style: 0.55, stability: 0.35, speed: 1.05 };
52
+ case "energetic":
53
+ return { style: 0.6, stability: 0.35, speed: 1.08 };
54
+ case "happy":
55
+ return { style: 0.5, stability: 0.4, speed: 1.05 };
56
+ case "serious":
57
+ return { style: 0.2, stability: 0.75, speed: 0.95 };
58
+ case "dramatic":
59
+ return { style: 0.65, stability: 0.4, speed: 0.95 };
60
+ case "whisper":
61
+ return { style: 0.2, stability: 0.85, speed: 0.9 };
62
+ case "neutral":
63
+ case undefined:
64
+ default:
65
+ return {};
66
+ }
67
+ }
68
+ /**
69
+ * AG-4: canonical VoiceStyle values that resolveVoiceSettings actually maps.
70
+ * Anything outside this set falls through to `{}` (flat delivery).
71
+ */
72
+ const CANONICAL_VOICE_STYLES = new Set([
73
+ "neutral", "calm", "warm", "casual", "excited",
74
+ "energetic", "happy", "serious", "dramatic", "whisper",
75
+ ]);
76
+ /**
77
+ * AG-4: map a freeform voice-style adjective onto the canonical VoiceStyle
78
+ * vocabulary so per-scene emotional beats actually reach voice_settings.
79
+ * The planner is prompted to emit canonical values, but LLMs drift toward
80
+ * synonyms ('whispered', 'authoritative', 'frustrated', 'curious'); without
81
+ * this they silently no-op to default delivery. Unknown words → undefined
82
+ * (same as today). Case/whitespace-insensitive.
83
+ */
84
+ const VOICE_STYLE_SYNONYMS = {
85
+ // whisper
86
+ whispered: "whisper", hushed: "whisper", soft: "whisper",
87
+ quiet: "whisper", intimate: "whisper", reflective: "whisper",
88
+ // calm
89
+ thoughtful: "calm", curious: "calm", intrigued: "calm", sad: "calm",
90
+ somber: "calm", melancholy: "calm", contemplative: "calm", gentle: "calm",
91
+ // warm
92
+ reassuring: "warm", friendly: "warm", soothing: "warm", inviting: "warm",
93
+ // casual
94
+ conversational: "casual", relaxed: "casual", chill: "casual",
95
+ informal: "casual", "laid-back": "casual",
96
+ // serious
97
+ authoritative: "serious", confident: "serious", assertive: "serious",
98
+ skeptical: "serious", professional: "serious", commanding: "serious",
99
+ // dramatic
100
+ frustrated: "dramatic", urgent: "dramatic", intense: "dramatic",
101
+ tense: "dramatic", angry: "dramatic",
102
+ // energetic
103
+ enthusiastic: "energetic", hyped: "energetic", lively: "energetic",
104
+ upbeat: "energetic", peppy: "energetic",
105
+ // happy
106
+ joyful: "happy", playful: "happy", cheerful: "happy", delighted: "happy",
107
+ // excited
108
+ thrilled: "excited", eager: "excited", animated: "excited",
109
+ // neutral
110
+ monotone: "neutral", deadpan: "neutral", flat: "neutral", robotic: "neutral",
111
+ };
112
+ function normalizeVoiceStyle(raw) {
113
+ if (!raw)
114
+ return undefined;
115
+ const key = raw.trim().toLowerCase();
116
+ if (CANONICAL_VOICE_STYLES.has(key))
117
+ return key;
118
+ return VOICE_STYLE_SYNONYMS[key];
119
+ }
@@ -0,0 +1,101 @@
1
+ import type { RunToolFn } from "./executor";
2
+ import { ToolContext } from "./toolRegistry";
3
+ /** One extension step in a chain (the source clip is implicit / step 0). */
4
+ export interface ExtendChainStep {
5
+ /**
6
+ * Seconds to extend by. The provider clamps to its native increment, so this
7
+ * drives cost + the time-window split, not a frame-exact length.
8
+ */
9
+ extraDurationSec: number;
10
+ /**
11
+ * Optional continuation prompt. Omitted by default so the provider continues
12
+ * the source clip's motion naturally (a fresh prompt risks a visible cut).
13
+ */
14
+ prompt?: string;
15
+ }
16
+ /** Output of `planExtendChain` — how to build a too-long scene's visual. */
17
+ export interface ExtendChainPlan {
18
+ /** Seconds for the initial clip (the model's max legal single-clip length). */
19
+ initialDurationSec: number;
20
+ /** Ordered extension segments fired after the initial clip completes. */
21
+ segments: ExtendChainStep[];
22
+ }
23
+ /** A resolved visual sub-clip (source or one extension), in render order. */
24
+ export interface SceneClip {
25
+ /** Final asset URL for this sub-clip. */
26
+ visualUrl: string;
27
+ /** Provider task id this clip came from (trace / reuse). */
28
+ taskId?: string;
29
+ /** Nominal seconds for this sub-clip; drives the planToProject window split. */
30
+ durationSec: number;
31
+ }
32
+ /**
33
+ * Decide whether a video scene needs an extend chain, and slice the extra
34
+ * seconds into provider-legal extension steps. Returns `null` when:
35
+ * - the model has no declared duration constraint (unconstrained → one clip),
36
+ * - the target already fits one clip (within snap tolerance), or
37
+ * - the model has no native extension endpoint (caller clamps as before — a
38
+ * non-extend model can't continue a clip, so the extra seconds are dropped
39
+ * by the existing capability/snap path).
40
+ *
41
+ * `targetDurationSec` is the scene's full requested length (scene.durationMs/1000).
42
+ */
43
+ export declare function planExtendChain(modelKey: string, targetDurationSec: number): ExtendChainPlan | null;
44
+ /** Poll result shape the host's TaskPoller wrapper returns. */
45
+ export interface ExtendPollResult {
46
+ status: "completed" | "failed" | "timed-out";
47
+ videoUrl?: string;
48
+ errorMessage?: string;
49
+ }
50
+ /** Injected capabilities resolveExtendChain needs (host wires real impls). */
51
+ export interface ExtendChainDeps {
52
+ /** Tool dispatcher (same one the executor uses) — runs `extend_video`. */
53
+ runTool: RunToolFn;
54
+ /** Polls a single provider task to completion (TaskPoller wrapper host-side). */
55
+ pollTask: (args: {
56
+ ref: string;
57
+ taskId: string;
58
+ modelKey: string;
59
+ outputFilename?: string;
60
+ }) => Promise<ExtendPollResult>;
61
+ }
62
+ export interface ResolveExtendChainArgs {
63
+ sceneIndex: number;
64
+ /** Extend-capable model the whole chain runs on (no cross-provider fallback). */
65
+ modelKey: string;
66
+ /** Task id of the already-triggered initial clip. */
67
+ initialTaskId: string;
68
+ /** Nominal seconds of the initial clip (from planExtendChain.initialDurationSec). */
69
+ initialDurationSec: number;
70
+ /** Ordered extension segments (from planExtendChain.segments). */
71
+ segments: ExtendChainStep[];
72
+ /** Tool context for the extend_video calls. */
73
+ ctx: ToolContext;
74
+ /** Filename hint prefix for the poller (e.g. `${projectId}-scene${i}`). */
75
+ outputFilenamePrefix?: string;
76
+ }
77
+ export type ResolveExtendChainResult = {
78
+ ok: true;
79
+ clips: SceneClip[];
80
+ } | {
81
+ ok: false;
82
+ /** Clips that DID resolve before the failure (may be empty). */
83
+ clips: SceneClip[];
84
+ error: {
85
+ code: string;
86
+ message: string;
87
+ failedTaskId?: string;
88
+ };
89
+ };
90
+ /**
91
+ * Run an extend chain to completion, enforcing source-task ordering: poll the
92
+ * current task → on completion, fire the next extension → poll that → repeat.
93
+ * Returns the source + extension clips in render order.
94
+ *
95
+ * Failure is partial-tolerant: if a mid-chain task fails/times out we stop and
96
+ * return the clips resolved so far with ok:false, so the caller can decide to
97
+ * ship a shorter scene rather than lose the whole thing. A failed SOURCE clip
98
+ * (no clips resolved) is a hard scene failure.
99
+ */
100
+ export declare function resolveExtendChain(deps: ExtendChainDeps, args: ResolveExtendChainArgs): Promise<ResolveExtendChainResult>;
101
+ //# sourceMappingURL=extendChain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extendChain.d.ts","sourceRoot":"","sources":["../../../src/services/agent/extendChain.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAgD7C,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,kBAAkB,EAAE,MAAM,CAAC;IAC3B,yEAAyE;IACzE,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED,6EAA6E;AAC7E,MAAM,WAAW,SAAS;IACxB,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,MAAM,GACxB,eAAe,GAAG,IAAI,CA2BxB;AAED,+DAA+D;AAC/D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC9B,0EAA0E;IAC1E,OAAO,EAAE,SAAS,CAAC;IACnB,iFAAiF;IACjF,QAAQ,EAAE,CAAC,IAAI,EAAE;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,aAAa,EAAE,MAAM,CAAC;IACtB,qFAAqF;IACrF,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kEAAkE;IAClE,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,+CAA+C;IAC/C,GAAG,EAAE,WAAW,CAAC;IACjB,2EAA2E;IAC3E,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,MAAM,wBAAwB,GAChC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,SAAS,EAAE,CAAA;CAAE,GAChC;IACE,EAAE,EAAE,KAAK,CAAC;IACV,gEAAgE;IAChE,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACjE,CAAC;AAEN;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,eAAe,EACrB,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,wBAAwB,CAAC,CAiFnC"}