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
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.estimateCostTool = void 0;
4
4
  const zod_1 = require("zod");
5
+ const aiModels_1 = require("../../../globals/aiModels");
5
6
  const project_schema_1 = require("../../../schemas/project.schema");
6
7
  const toolRegistry_1 = require("../toolRegistry");
7
8
  const InputSchema = zod_1.z.object({
@@ -13,16 +14,27 @@ const OutputSchema = zod_1.z.object({
13
14
  clipId: zod_1.z.string(),
14
15
  tier: zod_1.z.string(),
15
16
  source: zod_1.z.string(),
17
+ /** Model the clip was (or will be) generated with, when known. */
18
+ modelKey: zod_1.z.string().optional(),
16
19
  credits: zod_1.z.number().nonnegative(),
20
+ /**
21
+ * How `credits` was derived:
22
+ * actual — clip already generated; provenance.creditsSpent is exact.
23
+ * model — AG-6 real per-model rate from aiModelConfigs[modelKey].
24
+ * tier — coarse per-tier coefficient (no/unknown modelKey or no cost block).
25
+ */
26
+ basis: zod_1.z.enum(["actual", "model", "tier"]),
17
27
  })),
18
28
  });
19
29
  exports.estimateCostTool = {
20
30
  name: "estimate_cost",
21
31
  description: [
22
32
  "Estimate the credit cost of rendering a Project JSON without spending any",
23
- "credits. Reads each clip's provenance.creditsSpent (if already generated)",
24
- "or estimates from tier when not yet generated. Always call before",
25
- "executing a plan so the planner can stay within budget.",
33
+ "credits. Per clip, in order: uses provenance.creditsSpent if already",
34
+ "generated (exact); else the real per-model rate from the clip's",
35
+ "provenance.modelKey (AG-6); else a coarse per-tier coefficient when the",
36
+ "model is unknown. Always call before executing a plan so the planner can",
37
+ "stay within budget.",
26
38
  ].join(" "),
27
39
  inputSchema: InputSchema,
28
40
  outputSchema: OutputSchema,
@@ -31,8 +43,42 @@ exports.estimateCostTool = {
31
43
  const breakdown = project.clips.map((clip) => {
32
44
  const tier = clip.provenance?.tier ?? "T0";
33
45
  const source = clip.provenance?.source ?? "user-upload";
34
- const credits = clip.provenance?.creditsSpent ?? estimateFromTier(tier, clip.display);
35
- return { clipId: clip.id, tier, source, credits };
46
+ const modelKey = clip.provenance?.modelKey;
47
+ // 1. Already generated → provenance.creditsSpent is the exact charge.
48
+ if (clip.provenance?.creditsSpent != null) {
49
+ return {
50
+ clipId: clip.id,
51
+ tier,
52
+ source,
53
+ modelKey,
54
+ credits: clip.provenance.creditsSpent,
55
+ basis: "actual",
56
+ };
57
+ }
58
+ // 2. AG-6: real per-model rate keyed on the planned modelKey.
59
+ const seconds = Math.max(0, (clip.display.to - clip.display.from) / 1000);
60
+ if (modelKey) {
61
+ const modelCredits = (0, aiModels_1.estimateModelCredits)(modelKey, seconds);
62
+ if (modelCredits != null) {
63
+ return {
64
+ clipId: clip.id,
65
+ tier,
66
+ source,
67
+ modelKey,
68
+ credits: modelCredits,
69
+ basis: "model",
70
+ };
71
+ }
72
+ }
73
+ // 3. Fall back to the coarse per-tier coefficient.
74
+ return {
75
+ clipId: clip.id,
76
+ tier,
77
+ source,
78
+ modelKey,
79
+ credits: estimateFromTier(tier, clip.display),
80
+ basis: "tier",
81
+ };
36
82
  });
37
83
  return {
38
84
  totalCredits: breakdown.reduce((s, b) => s + b.credits, 0),
@@ -41,8 +87,10 @@ exports.estimateCostTool = {
41
87
  },
42
88
  };
43
89
  /**
44
- * Rough per-second per-tier estimate, in credits. Refined later via aiModelConfigs
45
- * lookups once tier annotations are backfilled across providers.
90
+ * Coarse per-second per-tier estimate, in credits. Fallback ONLY used when a
91
+ * clip has no modelKey or the model has no usable cost block. Generated clips
92
+ * with a known modelKey now go through estimateModelCredits() (AG-6) for real
93
+ * per-model rates.
46
94
  */
47
95
  function estimateFromTier(tier, display) {
48
96
  const seconds = Math.max(0, (display.to - display.from) / 1000);
@@ -0,0 +1,26 @@
1
+ import { z } from "zod";
2
+ import { EVideoGenModels } from "../../../globals/aiModels";
3
+ import { ToolDefinition } from "../toolRegistry";
4
+ /** Whether a model key can be extended via its provider's extend endpoint. */
5
+ export declare function modelSupportsExtend(modelKey: string): boolean;
6
+ declare const InputSchema: z.ZodObject<{
7
+ previousTaskId: z.ZodString;
8
+ modelKey: z.ZodEnum<typeof EVideoGenModels>;
9
+ extraDurationSec: z.ZodDefault<z.ZodNumber>;
10
+ prompt: z.ZodOptional<z.ZodString>;
11
+ negativePrompt: z.ZodOptional<z.ZodString>;
12
+ resolution: z.ZodOptional<z.ZodEnum<{
13
+ "720p": "720p";
14
+ "1080p": "1080p";
15
+ "4k": "4k";
16
+ }>>;
17
+ }, z.core.$strip>;
18
+ declare const OutputSchema: z.ZodObject<{
19
+ status: z.ZodLiteral<"triggered">;
20
+ taskId: z.ZodString;
21
+ raw: z.ZodUnknown;
22
+ modelKeyUsed: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$strip>;
24
+ export declare const extendVideoTool: ToolDefinition<typeof InputSchema, typeof OutputSchema>;
25
+ export {};
26
+ //# sourceMappingURL=extendVideo.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extendVideo.tool.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/tools/extendVideo.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAI5D,OAAO,EAAgB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAyB/D,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED,QAAA,MAAM,WAAW;;;;;;;;;;;iBAsCf,CAAC;AAEH,QAAA,MAAM,YAAY;;;;;iBAMhB,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,cAAc,CAC1C,OAAO,WAAW,EAClB,OAAO,YAAY,CA6EpB,CAAC"}
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extendVideoTool = void 0;
4
+ exports.modelSupportsExtend = modelSupportsExtend;
5
+ const zod_1 = require("zod");
6
+ const aiModels_1 = require("../../../globals/aiModels");
7
+ const logger_1 = require("../../../utils/logger");
8
+ const aiGenFactory_service_1 = require("../../aiGen/aiGenFactory.service");
9
+ const rateLimiter_1 = require("../../rateLimiter");
10
+ const toolRegistry_1 = require("../toolRegistry");
11
+ /**
12
+ * AG-2: models whose provider exposes a native video-extension endpoint
13
+ * (`endpoint: "extend"` + `sourceTaskId`). Extension continues a SPECIFIC prior
14
+ * provider task, so — unlike generate_video — there is NO cross-provider
15
+ * fallback: the source clip physically lives on the originating provider's
16
+ * account. Kling video-extend (/v1/videos/video-extend) and Pixverse
17
+ * (/video/extend/generate) are the two implemented today. Special-endpoint
18
+ * Kling variants (avatar, omni-video, motion-control, lip-sync) are excluded —
19
+ * the generic video-extend endpoint does not accept their tasks.
20
+ */
21
+ const EXTEND_CAPABLE_MODELS = new Set([
22
+ aiModels_1.EVideoGenModels.KLING_V2_MASTER,
23
+ aiModels_1.EVideoGenModels.KLING_V2_1,
24
+ aiModels_1.EVideoGenModels.KLING_V2_1_MASTER,
25
+ aiModels_1.EVideoGenModels.KLING_V2_5_TURBO,
26
+ aiModels_1.EVideoGenModels.KLING_V2_6,
27
+ aiModels_1.EVideoGenModels.KLING_V3_0,
28
+ aiModels_1.EVideoGenModels.PIXVERSE_V5,
29
+ aiModels_1.EVideoGenModels.PIXVERSE_V5_5,
30
+ aiModels_1.EVideoGenModels.PIXVERSE_V5_6,
31
+ aiModels_1.EVideoGenModels.PIXVERSE_V6,
32
+ ]);
33
+ /** Whether a model key can be extended via its provider's extend endpoint. */
34
+ function modelSupportsExtend(modelKey) {
35
+ return EXTEND_CAPABLE_MODELS.has(modelKey);
36
+ }
37
+ const InputSchema = zod_1.z.object({
38
+ previousTaskId: zod_1.z
39
+ .string()
40
+ .min(1)
41
+ .describe("Provider task id of the clip to continue FROM — the taskId returned by a " +
42
+ "prior generate_video/animate_image call on the SAME provider/model. " +
43
+ "Extension physically continues that clip; it cannot reference a task " +
44
+ "from a different provider."),
45
+ modelKey: zod_1.z
46
+ .nativeEnum(aiModels_1.EVideoGenModels)
47
+ .describe("MUST be the same extend-capable model that produced previousTaskId. " +
48
+ "Only Kling (v2-master/v2.1/v2.1-master/v2.5-turbo/v2.6/v3.0) and " +
49
+ "Pixverse (v5/v5.5/v5.6/v6) support extension."),
50
+ extraDurationSec: zod_1.z
51
+ .number()
52
+ .int()
53
+ .min(2)
54
+ .max(10)
55
+ .default(5)
56
+ .describe("Requested additional seconds. NOTE: providers extend by a fixed native " +
57
+ "increment (Kling ~4-5s, Pixverse ~5-8s) and may not honour an arbitrary " +
58
+ "value exactly — this drives cost estimation and the provider's quality " +
59
+ "tier, not a precise cut length."),
60
+ prompt: zod_1.z
61
+ .string()
62
+ .optional()
63
+ .describe("Optional motion/visual prompt for the continuation. Omit to let the " +
64
+ "extension continue the source clip's motion naturally."),
65
+ negativePrompt: zod_1.z.string().optional(),
66
+ resolution: zod_1.z.enum(["720p", "1080p", "4k"]).optional(),
67
+ });
68
+ const OutputSchema = zod_1.z.object({
69
+ status: zod_1.z.literal("triggered"),
70
+ taskId: zod_1.z.string().describe("New provider task id for the extension clip — poll like any other."),
71
+ raw: zod_1.z.unknown(),
72
+ /** Echoes the model used (extension never falls back, so == input.modelKey). */
73
+ modelKeyUsed: zod_1.z.string().optional(),
74
+ });
75
+ exports.extendVideoTool = {
76
+ name: "extend_video",
77
+ description: [
78
+ "Continue an EXISTING video clip past a model's per-clip max by calling the",
79
+ "provider's native extension endpoint, instead of falling back to a different",
80
+ "provider (which would visibly change look/identity). Returns a new provider",
81
+ "task id for the continuation clip — poll it like any other; the stitcher",
82
+ "concatenates the source clip + extension(s) in order.",
83
+ "Use when a single scene needs more seconds than the chosen model allows:",
84
+ "first generate_video/animate_image for the initial clip, then N extend_video",
85
+ "calls each continuing the PREVIOUS task. Only Kling and Pixverse video models",
86
+ "support this; the same model that produced previousTaskId must be passed.",
87
+ "Example:",
88
+ ' { previousTaskId: "<kling task id>", modelKey: "kling-v2.6", extraDurationSec: 5 }',
89
+ ].join(" "),
90
+ inputSchema: InputSchema,
91
+ outputSchema: OutputSchema,
92
+ idempotent: false,
93
+ estimateCost: async (input) => {
94
+ // Same per-second tier coefficient as generate_video; extension is billed
95
+ // per added second at the base model's rate.
96
+ const isPremium = input.modelKey === aiModels_1.EVideoGenModels.KLING_V3_0 ||
97
+ input.modelKey === aiModels_1.EVideoGenModels.KLING_V2_6;
98
+ return Math.ceil(input.extraDurationSec * (isPremium ? 12 : 4));
99
+ },
100
+ handler: async (input) => {
101
+ if (!modelSupportsExtend(input.modelKey)) {
102
+ throw new Error(`extend_video: model "${input.modelKey}" has no extension endpoint. ` +
103
+ "Extend-capable: Kling (v2-master/v2.1/v2.1-master/v2.5-turbo/v2.6/v3.0), " +
104
+ "Pixverse (v5/v5.5/v5.6/v6).");
105
+ }
106
+ // No provider fallback: the source task lives on this provider only. Hold a
107
+ // rate-limit slot through return (the host's TaskPoller releases it when the
108
+ // task settles); release here on submit error / missing taskId.
109
+ const limiter = (0, rateLimiter_1.getAiGenModelRateLimiter)(input.modelKey);
110
+ await limiter.waitUntilAvailable();
111
+ let heldSlot = true;
112
+ try {
113
+ const provider = (0, aiGenFactory_service_1.getAiGenProviderService)(input.modelKey);
114
+ const result = await provider.generateVideo({
115
+ modelKey: input.modelKey,
116
+ endpoint: "extend",
117
+ sourceTaskId: input.previousTaskId,
118
+ duration: input.extraDurationSec,
119
+ prompt: input.prompt,
120
+ negativePrompt: input.negativePrompt,
121
+ resolution: input.resolution,
122
+ });
123
+ const taskId = result.task?.taskId ??
124
+ result.task?.id ??
125
+ (typeof result.task === "string" ? result.task : "unknown");
126
+ if (taskId === "unknown") {
127
+ limiter.releaseSlot();
128
+ heldSlot = false;
129
+ }
130
+ logger_1.logger.info("extend_video: extension submitted", {
131
+ modelKey: input.modelKey,
132
+ previousTaskId: input.previousTaskId,
133
+ taskId,
134
+ });
135
+ return {
136
+ status: "triggered",
137
+ taskId,
138
+ raw: result.task,
139
+ modelKeyUsed: input.modelKey,
140
+ };
141
+ }
142
+ catch (err) {
143
+ if (heldSlot)
144
+ limiter.releaseSlot();
145
+ throw err;
146
+ }
147
+ },
148
+ };
149
+ (0, toolRegistry_1.registerTool)(exports.extendVideoTool);
@@ -0,0 +1,184 @@
1
+ import { z } from "zod";
2
+ import { VideoBrief } from "../../../schemas/brief.schema";
3
+ import { Script } from "../../../schemas/videoPlan.schema";
4
+ import { LlmCaller } from "../llmCaller";
5
+ import { ToolDefinition } from "../toolRegistry";
6
+ /**
7
+ * Stream L (L-4) — generate_script. Script-first authoring for long-form (L1+):
8
+ * the FIRST pass of L-3's two-pass flow. Produces the full spoken narration for
9
+ * the whole video as ONE coherent piece of writing, before any scenes exist.
10
+ *
11
+ * Why script-first: long-form (3-60min) authored scene-by-scene drifts — each
12
+ * scene's voiceoverLine is written in isolation and the through-line is lost.
13
+ * Writing the whole narration first keeps argument flow, callbacks, and pacing
14
+ * coherent; chapter_outline then segments it (L-4) and match_broll_to_script
15
+ * explodes each segment into scenes (L-4) whose voiceoverLines are slices of
16
+ * THIS text.
17
+ *
18
+ * The LLM returns prose only; word count + duration estimate are computed
19
+ * deterministically (estimateTtsMs) rather than trusted from the model, mirror-
20
+ * ing how the planner stamps credit estimates rather than believing the LLM.
21
+ */
22
+ declare const InputSchema: z.ZodObject<{
23
+ brief: z.ZodObject<{
24
+ rawPrompt: z.ZodString;
25
+ goal: z.ZodOptional<z.ZodString>;
26
+ niche: z.ZodOptional<z.ZodEnum<{
27
+ other: "other";
28
+ news: "news";
29
+ "ugc-ad": "ugc-ad";
30
+ "faceless-yt": "faceless-yt";
31
+ "product-demo": "product-demo";
32
+ "talking-head": "talking-head";
33
+ "social-recap": "social-recap";
34
+ "real-estate": "real-estate";
35
+ recipe: "recipe";
36
+ travel: "travel";
37
+ fitness: "fitness";
38
+ "podcast-clip": "podcast-clip";
39
+ education: "education";
40
+ }>>;
41
+ audience: z.ZodOptional<z.ZodString>;
42
+ tone: z.ZodOptional<z.ZodEnum<{
43
+ professional: "professional";
44
+ energetic: "energetic";
45
+ calm: "calm";
46
+ cinematic: "cinematic";
47
+ casual: "casual";
48
+ playful: "playful";
49
+ edgy: "edgy";
50
+ warm: "warm";
51
+ informational: "informational";
52
+ }>>;
53
+ hookStyle: z.ZodOptional<z.ZodEnum<{
54
+ question: "question";
55
+ "bold-claim": "bold-claim";
56
+ "pattern-interrupt": "pattern-interrupt";
57
+ story: "story";
58
+ stat: "stat";
59
+ demo: "demo";
60
+ "voiceover-only": "voiceover-only";
61
+ }>>;
62
+ pacing: z.ZodOptional<z.ZodEnum<{
63
+ medium: "medium";
64
+ fast: "fast";
65
+ slow: "slow";
66
+ "very-fast": "very-fast";
67
+ }>>;
68
+ durationSec: z.ZodOptional<z.ZodNumber>;
69
+ aspect: z.ZodOptional<z.ZodEnum<{
70
+ "9:16": "9:16";
71
+ "1:1": "1:1";
72
+ "4:5": "4:5";
73
+ "16:9": "16:9";
74
+ }>>;
75
+ lengthTier: z.ZodOptional<z.ZodEnum<{
76
+ S1: "S1";
77
+ S2: "S2";
78
+ M1: "M1";
79
+ L1: "L1";
80
+ L2: "L2";
81
+ L3: "L3";
82
+ }>>;
83
+ voice: z.ZodOptional<z.ZodObject<{
84
+ gender: z.ZodOptional<z.ZodEnum<{
85
+ male: "male";
86
+ female: "female";
87
+ neutral: "neutral";
88
+ }>>;
89
+ ageRange: z.ZodOptional<z.ZodEnum<{
90
+ child: "child";
91
+ teen: "teen";
92
+ "young-adult": "young-adult";
93
+ adult: "adult";
94
+ senior: "senior";
95
+ }>>;
96
+ accent: z.ZodOptional<z.ZodString>;
97
+ language: z.ZodDefault<z.ZodString>;
98
+ voiceId: z.ZodOptional<z.ZodString>;
99
+ style: z.ZodOptional<z.ZodEnum<{
100
+ energetic: "energetic";
101
+ calm: "calm";
102
+ casual: "casual";
103
+ warm: "warm";
104
+ neutral: "neutral";
105
+ excited: "excited";
106
+ happy: "happy";
107
+ serious: "serious";
108
+ dramatic: "dramatic";
109
+ whisper: "whisper";
110
+ }>>;
111
+ }, z.core.$strip>>;
112
+ music: z.ZodOptional<z.ZodObject<{
113
+ moods: z.ZodDefault<z.ZodArray<z.ZodEnum<{
114
+ energetic: "energetic";
115
+ calm: "calm";
116
+ cinematic: "cinematic";
117
+ playful: "playful";
118
+ uplifting: "uplifting";
119
+ tense: "tense";
120
+ dreamy: "dreamy";
121
+ dark: "dark";
122
+ }>>>;
123
+ bpmMin: z.ZodOptional<z.ZodNumber>;
124
+ bpmMax: z.ZodOptional<z.ZodNumber>;
125
+ }, z.core.$strip>>;
126
+ cta: z.ZodOptional<z.ZodString>;
127
+ claims: z.ZodDefault<z.ZodObject<{
128
+ allow: z.ZodDefault<z.ZodArray<z.ZodString>>;
129
+ block: z.ZodDefault<z.ZodArray<z.ZodString>>;
130
+ }, z.core.$strip>>;
131
+ references: z.ZodDefault<z.ZodArray<z.ZodObject<{
132
+ url: z.ZodString;
133
+ analyzed: z.ZodOptional<z.ZodObject<{
134
+ durationMs: z.ZodNumber;
135
+ sceneCount: z.ZodNumber;
136
+ hookMs: z.ZodNumber;
137
+ cutsPerSecond: z.ZodNumber;
138
+ bpm: z.ZodOptional<z.ZodNumber>;
139
+ transcriptExcerpt: z.ZodOptional<z.ZodString>;
140
+ }, z.core.$strip>>;
141
+ }, z.core.$strip>>>;
142
+ preferredModelKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
143
+ tierBudget: z.ZodDefault<z.ZodEnum<{
144
+ T0: "T0";
145
+ T1: "T1";
146
+ T2: "T2";
147
+ T3: "T3";
148
+ }>>;
149
+ maxSpendUSD: z.ZodOptional<z.ZodNumber>;
150
+ videoStrategy: z.ZodOptional<z.ZodEnum<{
151
+ auto: "auto";
152
+ direct: "direct";
153
+ indirect: "indirect";
154
+ }>>;
155
+ consistencyTier: z.ZodOptional<z.ZodEnum<{
156
+ C0: "C0";
157
+ C1: "C1";
158
+ C2: "C2";
159
+ }>>;
160
+ confidence: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
161
+ }, z.core.$strip>;
162
+ wpm: z.ZodOptional<z.ZodNumber>;
163
+ }, z.core.$strip>;
164
+ declare const OutputSchema: z.ZodObject<{
165
+ script: z.ZodObject<{
166
+ fullText: z.ZodString;
167
+ wordCount: z.ZodOptional<z.ZodNumber>;
168
+ estimatedDurationMs: z.ZodOptional<z.ZodNumber>;
169
+ wpm: z.ZodOptional<z.ZodNumber>;
170
+ }, z.core.$strip>;
171
+ suggestedTitle: z.ZodOptional<z.ZodString>;
172
+ }, z.core.$strip>;
173
+ /**
174
+ * Pure core, shared by the tool handler and the script-first planner (L-3).
175
+ * Takes an explicit LlmCaller so the planner can pass its own injected caller
176
+ * rather than relying on the global registry. Returns the script + title.
177
+ */
178
+ export declare function generateScriptCore(llm: LlmCaller, brief: VideoBrief, wpmOverride?: number): Promise<{
179
+ script: Script;
180
+ suggestedTitle?: string;
181
+ }>;
182
+ export declare const generateScriptTool: ToolDefinition<typeof InputSchema, typeof OutputSchema>;
183
+ export {};
184
+ //# sourceMappingURL=generateScript.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateScript.tool.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/tools/generateScript.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAoB,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAgB,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,OAAO,EAAgB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;;;;;;;;;;;;;;GAeG;AAEH,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUf,CAAC;AAeH,QAAA,MAAM,YAAY;;;;;;;;iBAGhB,CAAC;AAEH;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,UAAU,EACjB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAyDtD;AAED,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAC7C,OAAO,WAAW,EAClB,OAAO,YAAY,CAcpB,CAAC"}
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateScriptTool = void 0;
4
+ exports.generateScriptCore = generateScriptCore;
5
+ const zod_1 = require("zod");
6
+ const brief_schema_1 = require("../../../schemas/brief.schema");
7
+ const videoPlan_schema_1 = require("../../../schemas/videoPlan.schema");
8
+ const llmCallerRegistry_1 = require("../llmCallerRegistry");
9
+ const modelRouter_1 = require("../modelRouter");
10
+ const ttsDuration_1 = require("../ttsDuration");
11
+ const toolRegistry_1 = require("../toolRegistry");
12
+ /**
13
+ * Stream L (L-4) — generate_script. Script-first authoring for long-form (L1+):
14
+ * the FIRST pass of L-3's two-pass flow. Produces the full spoken narration for
15
+ * the whole video as ONE coherent piece of writing, before any scenes exist.
16
+ *
17
+ * Why script-first: long-form (3-60min) authored scene-by-scene drifts — each
18
+ * scene's voiceoverLine is written in isolation and the through-line is lost.
19
+ * Writing the whole narration first keeps argument flow, callbacks, and pacing
20
+ * coherent; chapter_outline then segments it (L-4) and match_broll_to_script
21
+ * explodes each segment into scenes (L-4) whose voiceoverLines are slices of
22
+ * THIS text.
23
+ *
24
+ * The LLM returns prose only; word count + duration estimate are computed
25
+ * deterministically (estimateTtsMs) rather than trusted from the model, mirror-
26
+ * ing how the planner stamps credit estimates rather than believing the LLM.
27
+ */
28
+ const InputSchema = zod_1.z.object({
29
+ brief: brief_schema_1.VideoBriefSchema.describe("Structured brief. durationSec drives the target word count; tone / audience / niche steer the writing."),
30
+ /**
31
+ * Override the words-per-minute used to size the script against durationSec.
32
+ * Defaults to the TTS calibration (150 wpm). Lower for slow/contemplative
33
+ * narration, higher for energetic delivery.
34
+ */
35
+ wpm: zod_1.z.number().int().positive().optional(),
36
+ });
37
+ /** What we ask the LLM for — prose + an optional working title only. */
38
+ const LlmScriptSchema = zod_1.z.object({
39
+ fullText: zod_1.z
40
+ .string()
41
+ .describe("The complete spoken narration for the entire video, as flowing prose with normal sentence punctuation. No scene markers, no '[VISUAL]' directions, no headings — just what the narrator says, start to finish."),
42
+ suggestedTitle: zod_1.z
43
+ .string()
44
+ .optional()
45
+ .describe("A working title for the video (used for chapter UI / file naming)."),
46
+ });
47
+ const OutputSchema = zod_1.z.object({
48
+ script: videoPlan_schema_1.ScriptSchema,
49
+ suggestedTitle: zod_1.z.string().optional(),
50
+ });
51
+ /**
52
+ * Pure core, shared by the tool handler and the script-first planner (L-3).
53
+ * Takes an explicit LlmCaller so the planner can pass its own injected caller
54
+ * rather than relying on the global registry. Returns the script + title.
55
+ */
56
+ async function generateScriptCore(llm, brief, wpmOverride) {
57
+ const router = new modelRouter_1.ModelRouter();
58
+ const wpm = wpmOverride ?? ttsDuration_1.TTS_DEFAULT_WPM;
59
+ // Target word count from requested duration at the chosen wpm. Gives the
60
+ // model a concrete length budget so it doesn't under/over-write.
61
+ const durationSec = brief.durationSec ?? 300;
62
+ const targetWords = Math.max(80, Math.round((durationSec / 60) * wpm));
63
+ const system = [
64
+ "You are a senior long-form video scriptwriter (YouTube essays, explainers,",
65
+ "documentaries). Write spoken narration that one narrator reads start to",
66
+ "finish: a strong hook, a clear through-line, signposted transitions between",
67
+ "ideas, and a payoff/CTA at the end. Use natural spoken rhythm and normal",
68
+ "punctuation. Do NOT write scene directions, shot lists, headings, or",
69
+ "bracketed visual notes — ONLY the words spoken aloud.",
70
+ ].join(" ");
71
+ const user = [
72
+ `Topic / request: ${brief.rawPrompt}`,
73
+ brief.goal ? `Goal: ${brief.goal}` : "",
74
+ brief.audience ? `Audience: ${brief.audience}` : "",
75
+ brief.tone ? `Tone: ${brief.tone}` : "",
76
+ brief.niche ? `Niche: ${brief.niche}` : "",
77
+ brief.cta ? `Call to action to land at the end: ${brief.cta}` : "",
78
+ `Target length: ~${durationSec}s of speech ≈ ${targetWords} words at ${wpm} wpm. Stay within ±15% of that word count.`,
79
+ brief.claims?.block?.length
80
+ ? `NEVER use these phrases (compliance): ${brief.claims.block.join("; ")}.`
81
+ : "",
82
+ ]
83
+ .filter(Boolean)
84
+ .join("\n");
85
+ const res = await llm.structured({
86
+ model: router.pickFor("planner", { premium: brief.tierBudget === "T3" }),
87
+ fallbackModel: router.fallbackFor("planner"),
88
+ schema: LlmScriptSchema,
89
+ schemaName: "Script",
90
+ messages: [
91
+ { role: "system", content: system },
92
+ { role: "user", content: user },
93
+ ],
94
+ temperature: 0.7,
95
+ maxTokens: 8000,
96
+ });
97
+ const fullText = res.data.fullText.trim();
98
+ const wordCount = fullText.split(/\s+/).filter(Boolean).length;
99
+ return {
100
+ script: {
101
+ fullText,
102
+ wordCount,
103
+ estimatedDurationMs: (0, ttsDuration_1.estimateTtsMs)(fullText, wpm),
104
+ wpm,
105
+ },
106
+ suggestedTitle: res.data.suggestedTitle,
107
+ };
108
+ }
109
+ exports.generateScriptTool = {
110
+ name: "generate_script",
111
+ description: [
112
+ "Write the full spoken narration for a long-form (L1+) video as one coherent",
113
+ "script BEFORE planning scenes. First pass of script-first authoring: the",
114
+ "output feeds chapter_outline (to segment) then match_broll_to_script (to",
115
+ "explode each segment into scenes). Only for M1+/L1+ tiers — short-form",
116
+ "(S1/S2) stays scene-first via plan_video.",
117
+ ].join(" "),
118
+ inputSchema: InputSchema,
119
+ outputSchema: OutputSchema,
120
+ idempotent: false,
121
+ handler: async (input) => generateScriptCore((0, llmCallerRegistry_1.getLlmCaller)(), input.brief, input.wpm),
122
+ };
123
+ (0, toolRegistry_1.registerTool)(exports.generateScriptTool);
@@ -16,6 +16,7 @@ declare const InputSchema: z.ZodObject<{
16
16
  "4k": "4k";
17
17
  }>>;
18
18
  inputImageUrl: z.ZodOptional<z.ZodString>;
19
+ lastFrameImageUrl: z.ZodOptional<z.ZodString>;
19
20
  audio: z.ZodOptional<z.ZodBoolean>;
20
21
  negativePrompt: z.ZodOptional<z.ZodString>;
21
22
  }, z.core.$strip>;
@@ -1 +1 @@
1
- {"version":3,"file":"generateVideo.tool.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/tools/generateVideo.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAI5D,OAAO,EAAgB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AA4B/D,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;iBA+Bf,CAAC;AAEH,QAAA,MAAM,YAAY;;;;;;iBAOhB,CAAC;AAEH,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAC5C,OAAO,WAAW,EAClB,OAAO,YAAY,CA0GpB,CAAC"}
1
+ {"version":3,"file":"generateVideo.tool.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/tools/generateVideo.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAI5D,OAAO,EAAgB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AA4B/D,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;iBA4Cf,CAAC;AAEH,QAAA,MAAM,YAAY;;;;;;iBAOhB,CAAC;AAEH,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAC5C,OAAO,WAAW,EAClB,OAAO,YAAY,CAqHpB,CAAC"}
@@ -42,6 +42,17 @@ const InputSchema = zod_1.z.object({
42
42
  .url()
43
43
  .optional()
44
44
  .describe("Source image for image-to-video. If set, this is an animate_image-style call."),
45
+ lastFrameImageUrl: zod_1.z
46
+ .string()
47
+ .url()
48
+ .optional()
49
+ .describe("AG-1: last/end frame for first-last-frame (FLF) interpolation — the model " +
50
+ "animates FROM inputImageUrl (first frame) TO this image (last frame), the " +
51
+ "cleanest way to get reliable directed motion between two specific " +
52
+ "compositions. REQUIRES inputImageUrl (the first frame). Only " +
53
+ "FLF-capable models accept it (google-veo-3.1/-fast, kling, runway-gen4-turbo, " +
54
+ "alibaba-wan); the capability gate skips models that don't, and the chain " +
55
+ "falls back. Omit for normal single-image animation."),
45
56
  audio: zod_1.z.boolean().optional().describe("Whether the model should generate audio."),
46
57
  negativePrompt: zod_1.z.string().optional(),
47
58
  });
@@ -78,6 +89,13 @@ exports.generateVideoTool = {
78
89
  },
79
90
  handler: async (input) => {
80
91
  const isI2V = Boolean(input.inputImageUrl);
92
+ // AG-1: FLF needs a first frame to interpolate FROM. A last frame without an
93
+ // inputImageUrl is meaningless, so ignore it (and warn) rather than passing
94
+ // it to a text-to-video chain that would dead-end on the capability gate.
95
+ if (input.lastFrameImageUrl && !isI2V) {
96
+ logger_1.logger.warn("generate_video: lastFrameImageUrl ignored — no inputImageUrl (first frame) supplied", { modelKey: input.modelKey });
97
+ }
98
+ const lastFrameImageUrl = isI2V ? input.lastFrameImageUrl : undefined;
81
99
  const chain = (0, chains_1.buildVideoChain)(input.modelKey, pickChain(input.modelKey, isI2V));
82
100
  const outcome = await (0, withFallback_1.withProviderFallback)({
83
101
  providers: chain,
@@ -85,7 +103,7 @@ exports.generateVideoTool = {
85
103
  aspect: input.aspectRatio,
86
104
  durationSec: input.durationSec,
87
105
  type: isI2V ? "image-to-video" : "text-to-video",
88
- lastFrame: false,
106
+ lastFrame: Boolean(lastFrameImageUrl),
89
107
  audio: input.audio,
90
108
  hasInputImage: isI2V,
91
109
  }),
@@ -118,6 +136,7 @@ exports.generateVideoTool = {
118
136
  aspectRatio: input.aspectRatio,
119
137
  resolution: input.resolution,
120
138
  inputImageUrl: input.inputImageUrl,
139
+ lastFrameImageUrl,
121
140
  audio: input.audio,
122
141
  negativePrompt: input.negativePrompt,
123
142
  type: isI2V ? "image-to-video" : "text-to-video",