vidspotai-shared 1.0.82 → 1.0.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (442) hide show
  1. package/lib/globals/aiModels/enums.d.ts +11 -1
  2. package/lib/globals/aiModels/enums.d.ts.map +1 -1
  3. package/lib/globals/aiModels/enums.js +24 -1
  4. package/lib/globals/aiModels/index.d.ts.map +1 -1
  5. package/lib/globals/aiModels/index.js +2 -0
  6. package/lib/globals/aiModels/providers/anthropic.d.ts +12 -0
  7. package/lib/globals/aiModels/providers/anthropic.d.ts.map +1 -0
  8. package/lib/globals/aiModels/providers/anthropic.js +88 -0
  9. package/lib/globals/aiModels/providers/google.d.ts.map +1 -1
  10. package/lib/globals/aiModels/providers/google.js +82 -0
  11. package/lib/globals/aiModels/providers/openai.d.ts.map +1 -1
  12. package/lib/globals/aiModels/providers/openai.js +63 -4
  13. package/lib/globals/aiModels/tierHelpers.d.ts +12 -0
  14. package/lib/globals/aiModels/tierHelpers.d.ts.map +1 -1
  15. package/lib/globals/aiModels/tierHelpers.js +83 -0
  16. package/lib/globals/aiModels/types.d.ts +19 -0
  17. package/lib/globals/aiModels/types.d.ts.map +1 -1
  18. package/lib/globals/types.d.ts +120 -1
  19. package/lib/globals/types.d.ts.map +1 -1
  20. package/lib/globals/types.js +135 -1
  21. package/lib/models/agent.model.d.ts +41 -1
  22. package/lib/models/agent.model.d.ts.map +1 -1
  23. package/lib/models/index.d.ts +1 -0
  24. package/lib/models/index.d.ts.map +1 -1
  25. package/lib/models/index.js +1 -0
  26. package/lib/models/social.model.d.ts +180 -0
  27. package/lib/models/social.model.d.ts.map +1 -0
  28. package/lib/models/social.model.js +2 -0
  29. package/lib/models/user.model.d.ts +10 -0
  30. package/lib/models/user.model.d.ts.map +1 -1
  31. package/lib/models/video.model.d.ts +6 -0
  32. package/lib/models/video.model.d.ts.map +1 -1
  33. package/lib/schemas/brief.schema.d.ts +46 -0
  34. package/lib/schemas/brief.schema.d.ts.map +1 -1
  35. package/lib/schemas/brief.schema.js +72 -1
  36. package/lib/schemas/index.d.ts +1 -0
  37. package/lib/schemas/index.d.ts.map +1 -1
  38. package/lib/schemas/index.js +1 -0
  39. package/lib/schemas/project.schema.d.ts +67 -0
  40. package/lib/schemas/project.schema.d.ts.map +1 -1
  41. package/lib/schemas/project.schema.js +12 -0
  42. package/lib/schemas/social.schema.d.ts +91 -0
  43. package/lib/schemas/social.schema.d.ts.map +1 -0
  44. package/lib/schemas/social.schema.js +114 -0
  45. package/lib/schemas/videoPlan.schema.d.ts +114 -0
  46. package/lib/schemas/videoPlan.schema.d.ts.map +1 -1
  47. package/lib/schemas/videoPlan.schema.js +141 -1
  48. package/lib/services/agent/chatAgent.d.ts +25 -1
  49. package/lib/services/agent/chatAgent.d.ts.map +1 -1
  50. package/lib/services/agent/chatAgent.js +145 -9
  51. package/lib/services/agent/costPreflight.d.ts +11 -1
  52. package/lib/services/agent/costPreflight.d.ts.map +1 -1
  53. package/lib/services/agent/costPreflight.js +18 -1
  54. package/lib/services/agent/covers/coverPlanner.d.ts +41 -0
  55. package/lib/services/agent/covers/coverPlanner.d.ts.map +1 -0
  56. package/lib/services/agent/covers/coverPlanner.js +278 -0
  57. package/lib/services/agent/covers/covers.schema.d.ts +158 -0
  58. package/lib/services/agent/covers/covers.schema.d.ts.map +1 -0
  59. package/lib/services/agent/covers/covers.schema.js +166 -0
  60. package/lib/services/agent/covers/index.d.ts +3 -0
  61. package/lib/services/agent/covers/index.d.ts.map +1 -0
  62. package/lib/services/agent/covers/index.js +18 -0
  63. package/lib/services/agent/critic.d.ts +10 -0
  64. package/lib/services/agent/critic.d.ts.map +1 -1
  65. package/lib/services/agent/critic.js +37 -1
  66. package/lib/services/agent/editClassifier.d.ts +2 -2
  67. package/lib/services/agent/editClassifier.js +2 -2
  68. package/lib/services/agent/editExisting/editAssembler.d.ts +78 -0
  69. package/lib/services/agent/editExisting/editAssembler.d.ts.map +1 -0
  70. package/lib/services/agent/editExisting/editAssembler.js +172 -0
  71. package/lib/services/agent/editExisting/editExisting.schema.d.ts +119 -0
  72. package/lib/services/agent/editExisting/editExisting.schema.d.ts.map +1 -0
  73. package/lib/services/agent/editExisting/editExisting.schema.js +157 -0
  74. package/lib/services/agent/editExisting/highlightPicker.d.ts +48 -0
  75. package/lib/services/agent/editExisting/highlightPicker.d.ts.map +1 -0
  76. package/lib/services/agent/editExisting/highlightPicker.js +199 -0
  77. package/lib/services/agent/editExisting/index.d.ts +4 -0
  78. package/lib/services/agent/editExisting/index.d.ts.map +1 -0
  79. package/lib/services/agent/editExisting/index.js +19 -0
  80. package/lib/services/agent/eval/seedBriefs.d.ts +4 -3
  81. package/lib/services/agent/eval/seedBriefs.d.ts.map +1 -1
  82. package/lib/services/agent/eval/seedBriefs.js +283 -3
  83. package/lib/services/agent/eval/types.d.ts +10 -0
  84. package/lib/services/agent/eval/types.d.ts.map +1 -1
  85. package/lib/services/agent/executor/core.d.ts +70 -0
  86. package/lib/services/agent/executor/core.d.ts.map +1 -0
  87. package/lib/services/agent/executor/core.js +250 -0
  88. package/lib/services/agent/executor/duration.d.ts +20 -0
  89. package/lib/services/agent/executor/duration.d.ts.map +1 -0
  90. package/lib/services/agent/executor/duration.js +46 -0
  91. package/lib/services/agent/executor/index.d.ts +15 -0
  92. package/lib/services/agent/executor/index.d.ts.map +1 -0
  93. package/lib/services/agent/executor/index.js +32 -0
  94. package/lib/services/agent/executor/types.d.ts +183 -0
  95. package/lib/services/agent/executor/types.d.ts.map +1 -0
  96. package/lib/services/agent/executor/types.js +29 -0
  97. package/lib/services/agent/executor/visual.d.ts +32 -0
  98. package/lib/services/agent/executor/visual.d.ts.map +1 -0
  99. package/lib/services/agent/executor/visual.js +400 -0
  100. package/lib/services/agent/executor/voice.d.ts +17 -0
  101. package/lib/services/agent/executor/voice.d.ts.map +1 -0
  102. package/lib/services/agent/executor/voice.js +119 -0
  103. package/lib/services/agent/extendChain.d.ts +101 -0
  104. package/lib/services/agent/extendChain.d.ts.map +1 -0
  105. package/lib/services/agent/extendChain.js +177 -0
  106. package/lib/services/agent/index.d.ts +11 -1
  107. package/lib/services/agent/index.d.ts.map +1 -1
  108. package/lib/services/agent/index.js +11 -1
  109. package/lib/services/agent/llmCaller.d.ts +7 -8
  110. package/lib/services/agent/llmCaller.d.ts.map +1 -1
  111. package/lib/services/agent/llmCallerAnthropic.d.ts +44 -31
  112. package/lib/services/agent/llmCallerAnthropic.d.ts.map +1 -1
  113. package/lib/services/agent/llmCallerAnthropic.js +135 -60
  114. package/lib/services/agent/llmCallerFactory.d.ts +34 -0
  115. package/lib/services/agent/llmCallerFactory.d.ts.map +1 -0
  116. package/lib/services/agent/llmCallerFactory.js +31 -0
  117. package/lib/services/agent/llmCallerGemini.d.ts +62 -0
  118. package/lib/services/agent/llmCallerGemini.d.ts.map +1 -0
  119. package/lib/services/agent/llmCallerGemini.js +235 -0
  120. package/lib/services/agent/llmCallerOpenai.d.ts +56 -0
  121. package/lib/services/agent/llmCallerOpenai.d.ts.map +1 -0
  122. package/lib/services/agent/llmCallerOpenai.js +230 -0
  123. package/lib/services/agent/llmCallerRegistry.d.ts.map +1 -1
  124. package/lib/services/agent/llmCallerRegistry.js +7 -7
  125. package/lib/services/agent/llmCallerRouting.d.ts +63 -0
  126. package/lib/services/agent/llmCallerRouting.d.ts.map +1 -0
  127. package/lib/services/agent/llmCallerRouting.js +124 -0
  128. package/lib/services/agent/llmModelRegistry.d.ts +59 -0
  129. package/lib/services/agent/llmModelRegistry.d.ts.map +1 -0
  130. package/lib/services/agent/llmModelRegistry.js +168 -0
  131. package/lib/services/agent/llmRetry.d.ts +57 -0
  132. package/lib/services/agent/llmRetry.d.ts.map +1 -0
  133. package/lib/services/agent/llmRetry.js +102 -0
  134. package/lib/services/agent/modelRouter.d.ts +3 -3
  135. package/lib/services/agent/modelRouter.d.ts.map +1 -1
  136. package/lib/services/agent/modelRouter.js +27 -13
  137. package/lib/services/agent/planMutations.d.ts +54 -1
  138. package/lib/services/agent/planMutations.d.ts.map +1 -1
  139. package/lib/services/agent/planMutations.js +78 -0
  140. package/lib/services/agent/planner/Planner.d.ts +0 -17
  141. package/lib/services/agent/planner/Planner.d.ts.map +1 -1
  142. package/lib/services/agent/planner/Planner.js +67 -303
  143. package/lib/services/agent/planner/overlayRegen.d.ts +38 -0
  144. package/lib/services/agent/planner/overlayRegen.d.ts.map +1 -0
  145. package/lib/services/agent/planner/overlayRegen.js +145 -0
  146. package/lib/services/agent/planner/plannerMessages.d.ts +34 -0
  147. package/lib/services/agent/planner/plannerMessages.d.ts.map +1 -0
  148. package/lib/services/agent/planner/plannerMessages.js +185 -0
  149. package/lib/services/agent/planner/promptSections.d.ts +12 -0
  150. package/lib/services/agent/planner/promptSections.d.ts.map +1 -1
  151. package/lib/services/agent/planner/promptSections.js +57 -0
  152. package/lib/services/agent/planner/scriptFirstPlanner.d.ts +35 -0
  153. package/lib/services/agent/planner/scriptFirstPlanner.d.ts.map +1 -0
  154. package/lib/services/agent/planner/scriptFirstPlanner.js +140 -0
  155. package/lib/services/agent/planner/structuralRules.d.ts +10 -0
  156. package/lib/services/agent/planner/structuralRules.d.ts.map +1 -1
  157. package/lib/services/agent/planner/structuralRules.js +92 -9
  158. package/lib/services/agent/planner/validators.d.ts +18 -0
  159. package/lib/services/agent/planner/validators.d.ts.map +1 -1
  160. package/lib/services/agent/planner/validators.js +97 -0
  161. package/lib/services/agent/planner.d.ts +2 -1
  162. package/lib/services/agent/planner.d.ts.map +1 -1
  163. package/lib/services/agent/planner.js +5 -1
  164. package/lib/services/agent/priorProject.d.ts +26 -0
  165. package/lib/services/agent/priorProject.d.ts.map +1 -0
  166. package/lib/services/agent/priorProject.js +51 -0
  167. package/lib/services/agent/providerFallback/chains.d.ts.map +1 -1
  168. package/lib/services/agent/providerFallback/chains.js +27 -15
  169. package/lib/services/agent/repurpose/index.d.ts +3 -0
  170. package/lib/services/agent/repurpose/index.d.ts.map +1 -0
  171. package/lib/services/agent/repurpose/index.js +18 -0
  172. package/lib/services/agent/repurpose/repurpose.schema.d.ts +132 -0
  173. package/lib/services/agent/repurpose/repurpose.schema.d.ts.map +1 -0
  174. package/lib/services/agent/repurpose/repurpose.schema.js +144 -0
  175. package/lib/services/agent/repurpose/shortsPicker.d.ts +25 -0
  176. package/lib/services/agent/repurpose/shortsPicker.d.ts.map +1 -0
  177. package/lib/services/agent/repurpose/shortsPicker.js +218 -0
  178. package/lib/services/agent/runHelpers.d.ts +21 -2
  179. package/lib/services/agent/runHelpers.d.ts.map +1 -1
  180. package/lib/services/agent/runHelpers.js +71 -2
  181. package/lib/services/agent/tools/animateImage.tool.d.ts +1 -0
  182. package/lib/services/agent/tools/animateImage.tool.d.ts.map +1 -1
  183. package/lib/services/agent/tools/animateImage.tool.js +12 -0
  184. package/lib/services/agent/tools/chapterOutline.tool.d.ts +42 -0
  185. package/lib/services/agent/tools/chapterOutline.tool.d.ts.map +1 -0
  186. package/lib/services/agent/tools/chapterOutline.tool.js +115 -0
  187. package/lib/services/agent/tools/composeScene.tool.d.ts +63 -0
  188. package/lib/services/agent/tools/composeScene.tool.d.ts.map +1 -1
  189. package/lib/services/agent/tools/estimateCost.tool.d.ts +27 -0
  190. package/lib/services/agent/tools/estimateCost.tool.d.ts.map +1 -1
  191. package/lib/services/agent/tools/estimateCost.tool.js +55 -7
  192. package/lib/services/agent/tools/extendVideo.tool.d.ts +26 -0
  193. package/lib/services/agent/tools/extendVideo.tool.d.ts.map +1 -0
  194. package/lib/services/agent/tools/extendVideo.tool.js +149 -0
  195. package/lib/services/agent/tools/generateScript.tool.d.ts +184 -0
  196. package/lib/services/agent/tools/generateScript.tool.d.ts.map +1 -0
  197. package/lib/services/agent/tools/generateScript.tool.js +123 -0
  198. package/lib/services/agent/tools/generateVideo.tool.d.ts +1 -0
  199. package/lib/services/agent/tools/generateVideo.tool.d.ts.map +1 -1
  200. package/lib/services/agent/tools/generateVideo.tool.js +20 -1
  201. package/lib/services/agent/tools/index.d.ts +4 -0
  202. package/lib/services/agent/tools/index.d.ts.map +1 -1
  203. package/lib/services/agent/tools/index.js +4 -0
  204. package/lib/services/agent/tools/matchBrollToScript.tool.d.ts +50 -0
  205. package/lib/services/agent/tools/matchBrollToScript.tool.d.ts.map +1 -0
  206. package/lib/services/agent/tools/matchBrollToScript.tool.js +139 -0
  207. package/lib/services/agent/tools/planVideo.tool.d.ts +56 -0
  208. package/lib/services/agent/tools/planVideo.tool.d.ts.map +1 -1
  209. package/lib/services/agent/tools/planVideo.tool.js +3 -3
  210. package/lib/services/agent/tools/render.tool.d.ts +21 -0
  211. package/lib/services/agent/tools/render.tool.d.ts.map +1 -1
  212. package/lib/services/aiGen/aiGenFactory.service.d.ts.map +1 -1
  213. package/lib/services/aiGen/aiGenFactory.service.js +18 -3
  214. package/lib/services/aiGen/providers/anthropic/anthropic.service.d.ts +26 -0
  215. package/lib/services/aiGen/providers/anthropic/anthropic.service.d.ts.map +1 -0
  216. package/lib/services/aiGen/providers/anthropic/anthropic.service.js +95 -0
  217. package/lib/services/aiGen/providers/google/google.service.d.ts +24 -1
  218. package/lib/services/aiGen/providers/google/google.service.d.ts.map +1 -1
  219. package/lib/services/aiGen/providers/google/google.service.js +96 -244
  220. package/lib/services/aiGen/providers/google/googleErrors.d.ts +13 -0
  221. package/lib/services/aiGen/providers/google/googleErrors.d.ts.map +1 -0
  222. package/lib/services/aiGen/providers/google/googleErrors.js +102 -0
  223. package/lib/services/aiGen/providers/google/googleFetch.d.ts +8 -0
  224. package/lib/services/aiGen/providers/google/googleFetch.d.ts.map +1 -0
  225. package/lib/services/aiGen/providers/google/googleFetch.js +96 -0
  226. package/lib/services/aiGen/providers/google/googleMusic.d.ts +15 -0
  227. package/lib/services/aiGen/providers/google/googleMusic.d.ts.map +1 -0
  228. package/lib/services/aiGen/providers/google/googleMusic.js +77 -0
  229. package/lib/services/aiGen/providers/kling/kling.service.d.ts +7 -3
  230. package/lib/services/aiGen/providers/kling/kling.service.d.ts.map +1 -1
  231. package/lib/services/aiGen/providers/kling/kling.service.js +23 -367
  232. package/lib/services/aiGen/providers/kling/klingCredits.d.ts +9 -0
  233. package/lib/services/aiGen/providers/kling/klingCredits.d.ts.map +1 -0
  234. package/lib/services/aiGen/providers/kling/klingCredits.js +63 -0
  235. package/lib/services/aiGen/providers/kling/klingRequests.d.ts +32 -0
  236. package/lib/services/aiGen/providers/kling/klingRequests.d.ts.map +1 -0
  237. package/lib/services/aiGen/providers/kling/klingRequests.js +194 -0
  238. package/lib/services/aiGen/providers/kling/klingStatus.d.ts +16 -0
  239. package/lib/services/aiGen/providers/kling/klingStatus.d.ts.map +1 -0
  240. package/lib/services/aiGen/providers/kling/klingStatus.js +173 -0
  241. package/lib/services/bullmq.service.d.ts +61 -0
  242. package/lib/services/bullmq.service.d.ts.map +1 -1
  243. package/lib/services/bullmq.service.js +101 -1
  244. package/lib/services/crypto/index.d.ts +2 -0
  245. package/lib/services/crypto/index.d.ts.map +1 -0
  246. package/lib/services/crypto/index.js +17 -0
  247. package/lib/services/crypto/tokenVault.d.ts +47 -0
  248. package/lib/services/crypto/tokenVault.d.ts.map +1 -0
  249. package/lib/services/crypto/tokenVault.js +179 -0
  250. package/lib/services/editor/captionStyleHint.d.ts +3 -0
  251. package/lib/services/editor/captionStyleHint.d.ts.map +1 -0
  252. package/lib/services/editor/captionStyleHint.js +112 -0
  253. package/lib/services/editor/planToProject.d.ts +7 -66
  254. package/lib/services/editor/planToProject.d.ts.map +1 -1
  255. package/lib/services/editor/planToProject.helpers.d.ts +40 -0
  256. package/lib/services/editor/planToProject.helpers.d.ts.map +1 -0
  257. package/lib/services/editor/planToProject.helpers.js +177 -0
  258. package/lib/services/editor/planToProject.js +197 -180
  259. package/lib/services/editor/planToProject.types.d.ts +94 -0
  260. package/lib/services/editor/planToProject.types.d.ts.map +1 -0
  261. package/lib/services/editor/planToProject.types.js +2 -0
  262. package/lib/services/firestore.service.d.ts +5 -0
  263. package/lib/services/firestore.service.d.ts.map +1 -1
  264. package/lib/services/firestore.service.js +13 -0
  265. package/lib/services/index.d.ts +12 -0
  266. package/lib/services/index.d.ts.map +1 -1
  267. package/lib/services/index.js +12 -0
  268. package/lib/services/promptEnhancer/index.d.ts +18 -0
  269. package/lib/services/promptEnhancer/index.d.ts.map +1 -0
  270. package/lib/services/promptEnhancer/index.js +33 -0
  271. package/lib/services/promptEnhancer/models.d.ts +54 -0
  272. package/lib/services/promptEnhancer/models.d.ts.map +1 -0
  273. package/lib/services/promptEnhancer/models.js +37 -0
  274. package/lib/services/promptEnhancer/profiles/agent.profile.d.ts +14 -0
  275. package/lib/services/promptEnhancer/profiles/agent.profile.d.ts.map +1 -0
  276. package/lib/services/promptEnhancer/profiles/agent.profile.js +40 -0
  277. package/lib/services/promptEnhancer/profiles/avatar.profile.d.ts +13 -0
  278. package/lib/services/promptEnhancer/profiles/avatar.profile.d.ts.map +1 -0
  279. package/lib/services/promptEnhancer/profiles/avatar.profile.js +40 -0
  280. package/lib/services/promptEnhancer/profiles/base.d.ts +28 -0
  281. package/lib/services/promptEnhancer/profiles/base.d.ts.map +1 -0
  282. package/lib/services/promptEnhancer/profiles/base.js +35 -0
  283. package/lib/services/promptEnhancer/profiles/image.profile.d.ts +11 -0
  284. package/lib/services/promptEnhancer/profiles/image.profile.d.ts.map +1 -0
  285. package/lib/services/promptEnhancer/profiles/image.profile.js +42 -0
  286. package/lib/services/promptEnhancer/profiles/index.d.ts +12 -0
  287. package/lib/services/promptEnhancer/profiles/index.d.ts.map +1 -0
  288. package/lib/services/promptEnhancer/profiles/index.js +33 -0
  289. package/lib/services/promptEnhancer/profiles/video.profile.d.ts +15 -0
  290. package/lib/services/promptEnhancer/profiles/video.profile.d.ts.map +1 -0
  291. package/lib/services/promptEnhancer/profiles/video.profile.js +81 -0
  292. package/lib/services/promptEnhancer/promptEnhancer.service.d.ts +45 -0
  293. package/lib/services/promptEnhancer/promptEnhancer.service.d.ts.map +1 -0
  294. package/lib/services/promptEnhancer/promptEnhancer.service.js +157 -0
  295. package/lib/services/promptEnhancer/schema.d.ts +19 -0
  296. package/lib/services/promptEnhancer/schema.d.ts.map +1 -0
  297. package/lib/services/promptEnhancer/schema.js +43 -0
  298. package/lib/services/promptEnhancer/types.d.ts +112 -0
  299. package/lib/services/promptEnhancer/types.d.ts.map +1 -0
  300. package/lib/services/promptEnhancer/types.js +2 -0
  301. package/lib/services/socialAI/captionGen.d.ts +81 -0
  302. package/lib/services/socialAI/captionGen.d.ts.map +1 -0
  303. package/lib/services/socialAI/captionGen.js +206 -0
  304. package/lib/services/socialAI/hookScore.d.ts +85 -0
  305. package/lib/services/socialAI/hookScore.d.ts.map +1 -0
  306. package/lib/services/socialAI/hookScore.js +170 -0
  307. package/lib/services/socialAI/index.d.ts +3 -0
  308. package/lib/services/socialAI/index.d.ts.map +1 -0
  309. package/lib/services/socialAI/index.js +18 -0
  310. package/lib/services/socialAccounts/index.d.ts +2 -0
  311. package/lib/services/socialAccounts/index.d.ts.map +1 -0
  312. package/lib/services/socialAccounts/index.js +17 -0
  313. package/lib/services/socialAccounts/socialAccountService.d.ts +25 -0
  314. package/lib/services/socialAccounts/socialAccountService.d.ts.map +1 -0
  315. package/lib/services/socialAccounts/socialAccountService.js +105 -0
  316. package/lib/services/socialEngage/factory.d.ts +7 -0
  317. package/lib/services/socialEngage/factory.d.ts.map +1 -0
  318. package/lib/services/socialEngage/factory.js +25 -0
  319. package/lib/services/socialEngage/index.d.ts +6 -0
  320. package/lib/services/socialEngage/index.d.ts.map +1 -0
  321. package/lib/services/socialEngage/index.js +21 -0
  322. package/lib/services/socialEngage/meta.engage.d.ts +17 -0
  323. package/lib/services/socialEngage/meta.engage.d.ts.map +1 -0
  324. package/lib/services/socialEngage/meta.engage.js +128 -0
  325. package/lib/services/socialEngage/metaWebhook.d.ts +50 -0
  326. package/lib/services/socialEngage/metaWebhook.d.ts.map +1 -0
  327. package/lib/services/socialEngage/metaWebhook.js +93 -0
  328. package/lib/services/socialEngage/types.d.ts +72 -0
  329. package/lib/services/socialEngage/types.d.ts.map +1 -0
  330. package/lib/services/socialEngage/types.js +10 -0
  331. package/lib/services/socialEngage/youtube.engage.d.ts +9 -0
  332. package/lib/services/socialEngage/youtube.engage.d.ts.map +1 -0
  333. package/lib/services/socialEngage/youtube.engage.js +87 -0
  334. package/lib/services/socialFormat/aspectGeometry.d.ts +74 -0
  335. package/lib/services/socialFormat/aspectGeometry.d.ts.map +1 -0
  336. package/lib/services/socialFormat/aspectGeometry.js +135 -0
  337. package/lib/services/socialFormat/index.d.ts +2 -0
  338. package/lib/services/socialFormat/index.d.ts.map +1 -0
  339. package/lib/services/socialFormat/index.js +19 -0
  340. package/lib/services/socialInsights/index.d.ts +3 -0
  341. package/lib/services/socialInsights/index.d.ts.map +1 -0
  342. package/lib/services/socialInsights/index.js +18 -0
  343. package/lib/services/socialInsights/recommendations.d.ts +131 -0
  344. package/lib/services/socialInsights/recommendations.d.ts.map +1 -0
  345. package/lib/services/socialInsights/recommendations.js +277 -0
  346. package/lib/services/socialInsights/timeBuckets.d.ts +35 -0
  347. package/lib/services/socialInsights/timeBuckets.d.ts.map +1 -0
  348. package/lib/services/socialInsights/timeBuckets.js +78 -0
  349. package/lib/services/socialMetrics/factory.d.ts +5 -0
  350. package/lib/services/socialMetrics/factory.d.ts.map +1 -0
  351. package/lib/services/socialMetrics/factory.js +24 -0
  352. package/lib/services/socialMetrics/index.d.ts +6 -0
  353. package/lib/services/socialMetrics/index.d.ts.map +1 -0
  354. package/lib/services/socialMetrics/index.js +21 -0
  355. package/lib/services/socialMetrics/meta.metrics.d.ts +22 -0
  356. package/lib/services/socialMetrics/meta.metrics.d.ts.map +1 -0
  357. package/lib/services/socialMetrics/meta.metrics.js +137 -0
  358. package/lib/services/socialMetrics/tiktok.metrics.d.ts +8 -0
  359. package/lib/services/socialMetrics/tiktok.metrics.d.ts.map +1 -0
  360. package/lib/services/socialMetrics/tiktok.metrics.js +43 -0
  361. package/lib/services/socialMetrics/types.d.ts +54 -0
  362. package/lib/services/socialMetrics/types.d.ts.map +1 -0
  363. package/lib/services/socialMetrics/types.js +2 -0
  364. package/lib/services/socialMetrics/youtube.metrics.d.ts +8 -0
  365. package/lib/services/socialMetrics/youtube.metrics.d.ts.map +1 -0
  366. package/lib/services/socialMetrics/youtube.metrics.js +43 -0
  367. package/lib/services/socialOAuth/factory.d.ts +7 -0
  368. package/lib/services/socialOAuth/factory.d.ts.map +1 -0
  369. package/lib/services/socialOAuth/factory.js +42 -0
  370. package/lib/services/socialOAuth/index.d.ts +11 -0
  371. package/lib/services/socialOAuth/index.d.ts.map +1 -0
  372. package/lib/services/socialOAuth/index.js +26 -0
  373. package/lib/services/socialOAuth/linkedin.oauth.d.ts +14 -0
  374. package/lib/services/socialOAuth/linkedin.oauth.d.ts.map +1 -0
  375. package/lib/services/socialOAuth/linkedin.oauth.js +127 -0
  376. package/lib/services/socialOAuth/meta.oauth.d.ts +31 -0
  377. package/lib/services/socialOAuth/meta.oauth.d.ts.map +1 -0
  378. package/lib/services/socialOAuth/meta.oauth.js +214 -0
  379. package/lib/services/socialOAuth/oauthState.d.ts +14 -0
  380. package/lib/services/socialOAuth/oauthState.d.ts.map +1 -0
  381. package/lib/services/socialOAuth/oauthState.js +66 -0
  382. package/lib/services/socialOAuth/pinterest.oauth.d.ts +15 -0
  383. package/lib/services/socialOAuth/pinterest.oauth.d.ts.map +1 -0
  384. package/lib/services/socialOAuth/pinterest.oauth.js +126 -0
  385. package/lib/services/socialOAuth/threads.oauth.d.ts +14 -0
  386. package/lib/services/socialOAuth/threads.oauth.d.ts.map +1 -0
  387. package/lib/services/socialOAuth/threads.oauth.js +129 -0
  388. package/lib/services/socialOAuth/tiktok.oauth.d.ts +15 -0
  389. package/lib/services/socialOAuth/tiktok.oauth.d.ts.map +1 -0
  390. package/lib/services/socialOAuth/tiktok.oauth.js +151 -0
  391. package/lib/services/socialOAuth/types.d.ts +67 -0
  392. package/lib/services/socialOAuth/types.d.ts.map +1 -0
  393. package/lib/services/socialOAuth/types.js +2 -0
  394. package/lib/services/socialOAuth/x.oauth.d.ts +17 -0
  395. package/lib/services/socialOAuth/x.oauth.d.ts.map +1 -0
  396. package/lib/services/socialOAuth/x.oauth.js +134 -0
  397. package/lib/services/socialOAuth/youtube.oauth.d.ts +15 -0
  398. package/lib/services/socialOAuth/youtube.oauth.d.ts.map +1 -0
  399. package/lib/services/socialOAuth/youtube.oauth.js +156 -0
  400. package/lib/services/socialPublish/factory.d.ts +5 -0
  401. package/lib/services/socialPublish/factory.d.ts.map +1 -0
  402. package/lib/services/socialPublish/factory.js +32 -0
  403. package/lib/services/socialPublish/index.d.ts +10 -0
  404. package/lib/services/socialPublish/index.d.ts.map +1 -0
  405. package/lib/services/socialPublish/index.js +25 -0
  406. package/lib/services/socialPublish/linkedin.publish.d.ts +9 -0
  407. package/lib/services/socialPublish/linkedin.publish.d.ts.map +1 -0
  408. package/lib/services/socialPublish/linkedin.publish.js +143 -0
  409. package/lib/services/socialPublish/meta.publish.d.ts +28 -0
  410. package/lib/services/socialPublish/meta.publish.d.ts.map +1 -0
  411. package/lib/services/socialPublish/meta.publish.js +149 -0
  412. package/lib/services/socialPublish/pinterest.publish.d.ts +13 -0
  413. package/lib/services/socialPublish/pinterest.publish.d.ts.map +1 -0
  414. package/lib/services/socialPublish/pinterest.publish.js +130 -0
  415. package/lib/services/socialPublish/threads.publish.d.ts +12 -0
  416. package/lib/services/socialPublish/threads.publish.d.ts.map +1 -0
  417. package/lib/services/socialPublish/threads.publish.js +96 -0
  418. package/lib/services/socialPublish/tiktok.publish.d.ts +13 -0
  419. package/lib/services/socialPublish/tiktok.publish.d.ts.map +1 -0
  420. package/lib/services/socialPublish/tiktok.publish.js +118 -0
  421. package/lib/services/socialPublish/types.d.ts +47 -0
  422. package/lib/services/socialPublish/types.d.ts.map +1 -0
  423. package/lib/services/socialPublish/types.js +2 -0
  424. package/lib/services/socialPublish/x.publish.d.ts +12 -0
  425. package/lib/services/socialPublish/x.publish.d.ts.map +1 -0
  426. package/lib/services/socialPublish/x.publish.js +147 -0
  427. package/lib/services/socialPublish/youtube.publish.d.ts +9 -0
  428. package/lib/services/socialPublish/youtube.publish.d.ts.map +1 -0
  429. package/lib/services/socialPublish/youtube.publish.js +107 -0
  430. package/lib/services/stock/index.d.ts +2 -0
  431. package/lib/services/stock/index.d.ts.map +1 -0
  432. package/lib/services/stock/index.js +17 -0
  433. package/lib/services/stock/realPersonSafety.d.ts +99 -0
  434. package/lib/services/stock/realPersonSafety.d.ts.map +1 -0
  435. package/lib/services/stock/realPersonSafety.js +248 -0
  436. package/lib/utils/index.d.ts +1 -0
  437. package/lib/utils/index.d.ts.map +1 -1
  438. package/lib/utils/index.js +1 -0
  439. package/lib/utils/renderTier.d.ts +26 -0
  440. package/lib/utils/renderTier.d.ts.map +1 -0
  441. package/lib/utils/renderTier.js +34 -0
  442. package/package.json +1 -1
@@ -0,0 +1,34 @@
1
+ import { AgentPersona } from "../../../schemas/agentPersona.schema";
2
+ import { VideoBrief } from "../../../schemas/brief.schema";
3
+ import { AgentVisualBible } from "../../../schemas/videoPlan.schema";
4
+ import { IBrandKitModel, IStyleMemoryModel } from "../../../models/agent.model";
5
+ /**
6
+ * Planner prompt assembly + the web-research heuristic. Pure functions (no LLM
7
+ * call, no class state) so the Planner class stays focused on the
8
+ * call/validate/retry loop. buildPlannerMessages is shared by plan() and
9
+ * planStream().
10
+ */
11
+ export declare function buildPlannerMessages(brief: VideoBrief, persona: AgentPersona | undefined, brandKit: IBrandKitModel | null, styleMemory: IStyleMemoryModel | null, bible: AgentVisualBible | null, lastErrors?: string, useResearchCall?: boolean): ({
12
+ role: "system";
13
+ content: string;
14
+ } | {
15
+ role: "user";
16
+ content: string;
17
+ })[];
18
+ /**
19
+ * Heuristic — does the brief mention real-world entities that benefit from
20
+ * web grounding? A planner without research will happily invent fake app
21
+ * names, fabricate statistics, and miss real-world brand details. Triggers
22
+ * when the brief contains:
23
+ * - explicit "top N / best / popular / list of" framings
24
+ * - proper-noun-heavy briefs (≥2 capitalized non-sentence-start words)
25
+ * - listicle/comparison/news/review keywords
26
+ * - explicit time markers ("2026", "latest", "this year", "recent")
27
+ * - statistics signals ("statistics", "data", "percent", "study")
28
+ *
29
+ * Deliberately conservative — false negatives are fine (we just skip the
30
+ * search), false positives waste $0.01 per planner call. Override via
31
+ * `useWebResearch: true|false` when the caller knows better.
32
+ */
33
+ export declare function briefNeedsWebResearch(brief: VideoBrief): boolean;
34
+ //# sourceMappingURL=plannerMessages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plannerMessages.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/planner/plannerMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAchF;;;;;GAKG;AAEH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,YAAY,GAAG,SAAS,EACjC,QAAQ,EAAE,cAAc,GAAG,IAAI,EAC/B,WAAW,EAAE,iBAAiB,GAAG,IAAI,EACrC,KAAK,EAAE,gBAAgB,GAAG,IAAI,EAC9B,UAAU,CAAC,EAAE,MAAM,EACnB,eAAe,UAAQ;;;;;;KAmIxB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAiChE"}
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildPlannerMessages = buildPlannerMessages;
4
+ exports.briefNeedsWebResearch = briefNeedsWebResearch;
5
+ const personas_1 = require("../personas");
6
+ const modelQualityNotes_1 = require("../modelQualityNotes");
7
+ const promptSections_1 = require("./promptSections");
8
+ const structuralRules_1 = require("./structuralRules");
9
+ /**
10
+ * Planner prompt assembly + the web-research heuristic. Pure functions (no LLM
11
+ * call, no class state) so the Planner class stays focused on the
12
+ * call/validate/retry loop. buildPlannerMessages is shared by plan() and
13
+ * planStream().
14
+ */
15
+ function buildPlannerMessages(brief, persona, brandKit, styleMemory, bible, lastErrors, useResearchCall = false) {
16
+ const structuralRulesSection = (0, structuralRules_1.buildStructuralRulesSection)(brief);
17
+ const personaSection = persona
18
+ ? [
19
+ "",
20
+ `Selected persona: ${persona}.`,
21
+ `Set plan.persona to "${persona}" in the output.`,
22
+ "Persona-specific structural rules (apply on top of the global tier rules):",
23
+ personas_1.PERSONA_PACKS[persona].plannerPrompt,
24
+ ].join("\n")
25
+ : "";
26
+ const brandKitSection = (0, promptSections_1.buildBrandKitSection)(brandKit);
27
+ const styleMemorySection = (0, promptSections_1.buildStyleMemorySection)(styleMemory);
28
+ const bibleSection = (0, promptSections_1.buildBibleSection)(bible);
29
+ const modelCatalogSection = (0, promptSections_1.buildModelCatalogSection)();
30
+ const preferredModelsSection = (0, promptSections_1.buildPreferredModelsSection)(brief.preferredModelKeys);
31
+ const videoStrategySection = (0, promptSections_1.buildVideoStrategySection)(brief.videoStrategy);
32
+ // AG-39: warn the planner away from models with known capability gaps for
33
+ // dimensions this brief signals it cares about (brand text on product
34
+ // labels is the immediate driver). Empty string when nothing rated.
35
+ const modelQualitySection = (0, modelQualityNotes_1.renderModelQualityHintsForSystemPrompt)({
36
+ needsBrandText: (0, promptSections_1.briefMentionsBrandText)(brief),
37
+ needsCharacterContinuity: persona === "ugc-ad" || persona === "talking-head",
38
+ needsFastMotion: brief.tone?.toLowerCase()?.includes("energetic") || brief.tone?.toLowerCase()?.includes("action"),
39
+ needsCinematic: brief.tone?.toLowerCase()?.includes("cinematic"),
40
+ });
41
+ const researchSection = useResearchCall
42
+ ? [
43
+ "",
44
+ "RESEARCH MODE — `web_search` is enabled. The brief mentions real-world",
45
+ "subjects (products, companies, people, places, events, or statistics).",
46
+ "Before planning, run targeted `web_search` calls (max 5) to ground the",
47
+ "plan in real facts: real product names, real feature lists, real logos,",
48
+ "real statistics, real quotes. Use the results to populate scene prompts,",
49
+ "voiceover lines, and overlay copy — NEVER fabricate company names,",
50
+ "product specs, or numbers. Cite findings implicitly via accurate copy;",
51
+ "do not embed raw URLs in the plan. When done researching, call the",
52
+ "`submit_VideoPlan` tool with the final plan.",
53
+ "",
54
+ ].join("\n")
55
+ : "";
56
+ const system = [
57
+ "You are a video-production planner.",
58
+ "Given a VideoBrief, produce a VideoPlan: an ordered list of scenes",
59
+ "with per-scene asset strategy, tier, prompt, duration, and voiceover.",
60
+ researchSection,
61
+ "",
62
+ "Tier rules — respect brief.tierBudget as the maximum tier:",
63
+ " T0: stock footage / image with Ken-Burns motion.",
64
+ " T1: AI-generated still + camera motion.",
65
+ " T2: AI image-to-video on key frames only.",
66
+ " T3: full text-to-video (most expensive — use sparingly).",
67
+ "",
68
+ "Stock strategy bias — when budget is T0 and the scene depicts something",
69
+ "with natural motion (skies, light, water, traffic, hands at work,",
70
+ "animals, machinery, weather, crowds), prefer strategy='stock-video' over",
71
+ "'stock-image-ken-burns'. Static images with synthesized zoom feel like",
72
+ "a slideshow when chained for >3 cuts; real stock clips give the same",
73
+ "T0 cost with genuine motion. Only fall back to stock-image-ken-burns",
74
+ "when the subject is inherently still (diagrams, infographics, single",
75
+ "objects on a table, frozen moments) OR when the brief explicitly asks",
76
+ "for a poster/title-card feel.",
77
+ "",
78
+ videoStrategySection,
79
+ "",
80
+ "talking-head-avatar is wired and runs the kling-avatar pipeline (face",
81
+ "still + TTS lipsync). Pick it ONLY when the brand kit exposes a",
82
+ "presenterFaceUrl — set scene.avatarFaceUrl to that URL on every avatar",
83
+ "scene. If no presenter face is available, fall back to ai-image-to-video",
84
+ "or stock-video of a presenter instead.",
85
+ "",
86
+ "user-asset is wired and reuses the requesting user's existing library",
87
+ "(their previously generated images / videos / audio) instead of spending",
88
+ "credits to make a new asset. Pick user-asset when the brief mentions a",
89
+ "recurring brand subject (their product photo, spokesperson, b-roll) —",
90
+ "the executor falls back to stock-video if no library match scores high",
91
+ "enough, so picking it is safe.",
92
+ "",
93
+ "Keep total estimated credits as low as possible while honoring the",
94
+ "brief. Mix tiers within a single video where it helps cost without",
95
+ "harming quality (e.g. T2 hero shot + T0 b-roll between).",
96
+ "",
97
+ "Smart model routing — set preferredModel per scene from the catalog:",
98
+ " - Hero / opening-hook / product-reveal scenes: pick the highest-",
99
+ " quality model in the chosen tier (most expensive in that tier).",
100
+ " - B-roll / filler / transition scenes: pick the cheapest model in",
101
+ " the chosen tier — the audience won't notice the difference and",
102
+ " cost drops 3–5x.",
103
+ " - When in doubt for a non-hero scene, pick the median-cost model.",
104
+ " - preferredModel must match a key from the catalog below; the",
105
+ " executor will swap on rate-limit, so picking is best-effort, not",
106
+ " a hard contract.",
107
+ modelCatalogSection,
108
+ preferredModelsSection,
109
+ modelQualitySection,
110
+ // AG-14 fix: persona section moved above structuralRulesSection and
111
+ // bibleSection. The bible block has multiple "MUST" rules that were
112
+ // crowding out persona.hookStyle when persona was the last item before
113
+ // brandKit; on `seed-ugc-skincare` this regressed hookStrength to 0.4
114
+ // (planner picked a generic "Wait…" opener instead of the brief's
115
+ // problem-statement hook). Order is now: persona (voice + hookStyle) →
116
+ // structural rules → bible (entity verbatim re-statement).
117
+ personaSection,
118
+ structuralRulesSection,
119
+ bibleSection,
120
+ brandKitSection,
121
+ styleMemorySection,
122
+ ]
123
+ .filter(Boolean)
124
+ .join("\n");
125
+ const user = [
126
+ `Brief:\n${JSON.stringify(brief, null, 2)}`,
127
+ lastErrors
128
+ ? `\nYour previous attempt failed validation: ${lastErrors}\nFix the structure and try again.`
129
+ : "",
130
+ ]
131
+ .filter(Boolean)
132
+ .join("\n");
133
+ return [
134
+ { role: "system", content: system },
135
+ { role: "user", content: user },
136
+ ];
137
+ }
138
+ /**
139
+ * Heuristic — does the brief mention real-world entities that benefit from
140
+ * web grounding? A planner without research will happily invent fake app
141
+ * names, fabricate statistics, and miss real-world brand details. Triggers
142
+ * when the brief contains:
143
+ * - explicit "top N / best / popular / list of" framings
144
+ * - proper-noun-heavy briefs (≥2 capitalized non-sentence-start words)
145
+ * - listicle/comparison/news/review keywords
146
+ * - explicit time markers ("2026", "latest", "this year", "recent")
147
+ * - statistics signals ("statistics", "data", "percent", "study")
148
+ *
149
+ * Deliberately conservative — false negatives are fine (we just skip the
150
+ * search), false positives waste $0.01 per planner call. Override via
151
+ * `useWebResearch: true|false` when the caller knows better.
152
+ */
153
+ function briefNeedsWebResearch(brief) {
154
+ const text = [
155
+ brief.rawPrompt ?? "",
156
+ brief.tone ?? "",
157
+ brief.niche ?? "",
158
+ ]
159
+ .filter(Boolean)
160
+ .join(" ");
161
+ if (!text.trim())
162
+ return false;
163
+ const lower = text.toLowerCase();
164
+ const listicleSignals = /\b(top\s+\d+|best\s+\d*\s*\w+|popular|list\s+of|review|comparison|vs\.?|versus|trending|latest|recent|news|breaking|study|statistics?|data|percent|%|million|billion|industry|market|report)\b/;
165
+ if (listicleSignals.test(lower))
166
+ return true;
167
+ const yearMarker = /\b(20\d{2}|this\s+year|last\s+year)\b/;
168
+ if (yearMarker.test(lower))
169
+ return true;
170
+ // Count proper nouns that aren't sentence-starters — heuristic for
171
+ // "specific brands / people / places".
172
+ const words = text.split(/\s+/);
173
+ let properNouns = 0;
174
+ for (let i = 0; i < words.length; i++) {
175
+ const w = words[i] ?? "";
176
+ const prev = i > 0 ? words[i - 1] ?? "" : "";
177
+ const isSentenceStart = i === 0 || /[.!?]$/.test(prev);
178
+ if (!isSentenceStart && /^[A-Z][a-zA-Z0-9]{2,}/.test(w)) {
179
+ properNouns++;
180
+ if (properNouns >= 2)
181
+ return true;
182
+ }
183
+ }
184
+ return false;
185
+ }
@@ -12,6 +12,18 @@ export declare function briefMentionsBrandText(brief: VideoBrief): boolean;
12
12
  */
13
13
  export declare function buildVideoStrategySection(strategy: "direct" | "indirect" | "auto" | undefined): string;
14
14
  export declare function buildModelCatalogSection(): string;
15
+ /**
16
+ * Render the user's soft model preference (`brief.preferredModelKeys`, fed by
17
+ * the composer's "@Models" mention category) into a planner-readable rule.
18
+ *
19
+ * Each key is annotated with its REAL modality from the catalog so the planner
20
+ * can tell a video model from an image-generation-only one. The instruction
21
+ * makes the preference advisory: favor a preferred model when it can produce
22
+ * the scene, and gracefully fall back (same provider first) when it can't —
23
+ * which is exactly the "user @-mentioned an image-gen model for a video"
24
+ * false-request case. Returns "" when the user expressed no preference.
25
+ */
26
+ export declare function buildPreferredModelsSection(preferredModelKeys: string[] | undefined): string;
15
27
  export declare function buildBrandKitSection(brandKit: IBrandKitModel | null): string;
16
28
  /**
17
29
  * AG-12 — render the Visual Bible into the planner system prompt. When a
@@ -1 +1 @@
1
- {"version":3,"file":"promptSections.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/planner/promptSections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAQhF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAGjE;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,GACnD,MAAM,CAkCR;AAED,wBAAgB,wBAAwB,IAAI,MAAM,CAWjD;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,GAAG,MAAM,CAgC5E;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,MAAM,CAqCxE;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,GAAG,MAAM,CAsBhF"}
1
+ {"version":3,"file":"promptSections.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/planner/promptSections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAShF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAGjE;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,GACnD,MAAM,CAkCR;AAED,wBAAgB,wBAAwB,IAAI,MAAM,CAWjD;AAYD;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,kBAAkB,EAAE,MAAM,EAAE,GAAG,SAAS,GACvC,MAAM,CAmCR;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,GAAG,MAAM,CAgC5E;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,MAAM,CAqCxE;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,GAAG,MAAM,CAsBhF"}
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.briefMentionsBrandText = briefMentionsBrandText;
4
4
  exports.buildVideoStrategySection = buildVideoStrategySection;
5
5
  exports.buildModelCatalogSection = buildModelCatalogSection;
6
+ exports.buildPreferredModelsSection = buildPreferredModelsSection;
6
7
  exports.buildBrandKitSection = buildBrandKitSection;
7
8
  exports.buildBibleSection = buildBibleSection;
8
9
  exports.buildStyleMemorySection = buildStyleMemorySection;
9
10
  const tierHelpers_1 = require("../../../globals/aiModels/tierHelpers");
11
+ const aiModels_1 = require("../../../globals/aiModels");
10
12
  // AG-39: heuristic — does the brief signal that the planner should care
11
13
  // about on-screen brand text (so scenes get steered away from models
12
14
  // known to mangle text)? Looks at brief.brandName, brief.productName,
@@ -73,6 +75,61 @@ function buildModelCatalogSection() {
73
75
  sections.push("", "Image-to-video models by tier (cheapest first):", i2v);
74
76
  return sections.join("\n");
75
77
  }
78
+ const VIDEO_MODALITIES = new Set([
79
+ "text-to-video",
80
+ "image-to-video",
81
+ "video-to-video",
82
+ "audio-to-video",
83
+ "avatar-video",
84
+ "motion-control",
85
+ "lip-sync",
86
+ ]);
87
+ /**
88
+ * Render the user's soft model preference (`brief.preferredModelKeys`, fed by
89
+ * the composer's "@Models" mention category) into a planner-readable rule.
90
+ *
91
+ * Each key is annotated with its REAL modality from the catalog so the planner
92
+ * can tell a video model from an image-generation-only one. The instruction
93
+ * makes the preference advisory: favor a preferred model when it can produce
94
+ * the scene, and gracefully fall back (same provider first) when it can't —
95
+ * which is exactly the "user @-mentioned an image-gen model for a video"
96
+ * false-request case. Returns "" when the user expressed no preference.
97
+ */
98
+ function buildPreferredModelsSection(preferredModelKeys) {
99
+ if (!preferredModelKeys || preferredModelKeys.length === 0)
100
+ return "";
101
+ const lines = preferredModelKeys.map((key) => {
102
+ const config = aiModels_1.aiModelConfigs[key];
103
+ if (!config) {
104
+ return ` - ${key} (unknown model — ignore unless it matches a catalog key)`;
105
+ }
106
+ const modality = config.type.join(", ");
107
+ const videoCapable = config.type.some((t) => VIDEO_MODALITIES.has(t));
108
+ const note = videoCapable
109
+ ? ""
110
+ : " ← image-generation only, cannot produce a video scene";
111
+ return ` - ${key} (modality: ${modality})${note}`;
112
+ });
113
+ return [
114
+ "",
115
+ "User model preference (SOFT hint — NOT a hard constraint):",
116
+ "The user @-mentioned the following generation model(s), strongest first:",
117
+ ...lines,
118
+ "Apply this preference as follows:",
119
+ " - For each AI video scene, if a preferred model's modality supports the",
120
+ " scene's strategy (text-to-video → ai-text-to-video; image-to-video →",
121
+ " ai-image-to-video), set scene.preferredModel to it — favor the",
122
+ " earliest-listed compatible one.",
123
+ " - If NONE of the preferred models can produce a given scene (e.g. the",
124
+ " user only named an image-generation model but the scene needs video),",
125
+ " DO NOT force it. Prefer the closest model from the SAME provider/family",
126
+ " that can (e.g. a Kling image model → a Kling video model), otherwise",
127
+ " fall back to the best catalog model per the routing rules above.",
128
+ " - NEVER set scene.preferredModel to a model that can't output the scene's",
129
+ " required modality. The preference improves model choice; it must not",
130
+ " break the plan.",
131
+ ].join("\n");
132
+ }
76
133
  function buildBrandKitSection(brandKit) {
77
134
  if (!brandKit)
78
135
  return "";
@@ -0,0 +1,35 @@
1
+ import { AgentPersona } from "../../../schemas/agentPersona.schema";
2
+ import { VideoBrief } from "../../../schemas/brief.schema";
3
+ import { AgentVisualBible, VideoPlan } from "../../../schemas/videoPlan.schema";
4
+ import { LlmCaller } from "../llmCaller";
5
+ /**
6
+ * Stream L (L-3) — script-first authoring pipeline for long-form (L1/L2) plans.
7
+ *
8
+ * The scene-first Planner (single structured LLM call → VideoPlan) is tuned for
9
+ * shorts; on a 3-60min video its per-scene voiceoverLines drift because each is
10
+ * written in isolation and the through-line is lost. Script-first fixes that
11
+ * with three passes (the L-4 tool cores):
12
+ *
13
+ * 1. generate_script — brief → full coherent narration (one writer pass)
14
+ * 2. chapter_outline — script → titled chapters (verbatim slices)
15
+ * 3. match_broll_to_script — per chapter: narration → B-roll scenes whose
16
+ * voiceoverLines are verbatim sentence slices
17
+ *
18
+ * The scenes are concatenated in chapter order (sceneIndex contiguous from 0),
19
+ * each chapter's sceneIndices back-filled, and the result assembled + validated
20
+ * into a VideoPlan that already satisfies the L-2 chapter contract by
21
+ * construction. Credit/duration/warning stamps mirror the scene-first finalize.
22
+ *
23
+ * Note: this path does NOT use the LLM to author scene durations or pick
24
+ * preferredModel — durations come from TTS length (3-8s band, in the core) and
25
+ * model selection is left to the executor's default + autoCorrectPreferredModels
26
+ * at execute time, same as a scene-first plan that omits preferredModel.
27
+ */
28
+ export interface ScriptFirstDeps {
29
+ llm: LlmCaller;
30
+ }
31
+ export declare function planScriptFirst(deps: ScriptFirstDeps, brief: VideoBrief, opts?: {
32
+ persona?: AgentPersona;
33
+ bible?: AgentVisualBible | null;
34
+ }): Promise<VideoPlan>;
35
+ //# sourceMappingURL=scriptFirstPlanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scriptFirstPlanner.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/planner/scriptFirstPlanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAoB,MAAM,+BAA+B,CAAC;AAE7E,OAAO,EACL,gBAAgB,EAGhB,SAAS,EAEV,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAYzC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,SAAS,CAAC;CAChB;AAQD,wBAAsB,eAAe,CACnC,IAAI,EAAE,eAAe,EACrB,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC;IAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAA;CAAO,GACrE,OAAO,CAAC,SAAS,CAAC,CAuIpB"}
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.planScriptFirst = planScriptFirst;
4
+ const brief_schema_1 = require("../../../schemas/brief.schema");
5
+ const videoPlan_schema_1 = require("../../../schemas/videoPlan.schema");
6
+ const logger_1 = require("../../../utils/logger");
7
+ const costPreflight_1 = require("../costPreflight");
8
+ const generateScript_tool_1 = require("../tools/generateScript.tool");
9
+ const chapterOutline_tool_1 = require("../tools/chapterOutline.tool");
10
+ const matchBrollToScript_tool_1 = require("../tools/matchBrollToScript.tool");
11
+ const validators_1 = require("./validators");
12
+ const TIER_ORDER = ["T0", "T1", "T2", "T3"];
13
+ /** The lower (cheaper) of two tiers. */
14
+ function tierMin(a, b) {
15
+ return TIER_ORDER.indexOf(a) <= TIER_ORDER.indexOf(b) ? a : b;
16
+ }
17
+ async function planScriptFirst(deps, brief, opts = {}) {
18
+ const { llm } = deps;
19
+ const lengthTier = brief.lengthTier ?? (0, brief_schema_1.deriveLengthTier)(brief.durationSec);
20
+ // Long-form defaults to landscape (YouTube) unless the brief says otherwise.
21
+ const aspect = brief.aspect ?? "16:9";
22
+ const persona = opts.persona ?? "faceless-yt";
23
+ // Stream L (L-6) lower-tier defaults: long-form B-roll defaults to the cheaper
24
+ // of the budget and T1; only the hero/intro scene (global sceneIndex 0) gets
25
+ // the full budget tier. Keeps an L2 (10-60min) plan from defaulting every one
26
+ // of 100+ scenes to T2/T3.
27
+ const budgetTier = brief.tierBudget;
28
+ const bodyTier = tierMin(budgetTier, "T1");
29
+ // Pass 1 — full narration.
30
+ const { script } = await (0, generateScript_tool_1.generateScriptCore)(llm, brief);
31
+ const wpm = script.wpm;
32
+ // Pass 2 — chapters (verbatim slices of the script).
33
+ const { chapters } = await (0, chapterOutline_tool_1.chapterOutlineCore)(llm, {
34
+ script: script.fullText,
35
+ wpm,
36
+ });
37
+ // Pass 3 — explode each chapter into B-roll scenes, keeping sceneIndex
38
+ // globally contiguous and back-filling chapter.sceneIndices.
39
+ const scenes = [];
40
+ const finalChapters = [];
41
+ let cursor = 0;
42
+ for (const ch of chapters) {
43
+ const narration = ch.narration?.trim();
44
+ if (!narration) {
45
+ // A chapter with no narration can't be exploded; keep it as a marker
46
+ // with no scenes rather than dropping it (preserves the outline).
47
+ finalChapters.push({ ...ch, sceneIndices: [] });
48
+ continue;
49
+ }
50
+ const { scenes: broll } = await (0, matchBrollToScript_tool_1.matchBrollToScriptCore)(llm, {
51
+ narration,
52
+ aspect,
53
+ niche: brief.niche,
54
+ startSceneIndex: cursor,
55
+ wpm,
56
+ });
57
+ const sceneIndices = [];
58
+ for (const bs of broll) {
59
+ scenes.push({
60
+ sceneIndex: bs.sceneIndex,
61
+ intent: bs.intent,
62
+ strategy: bs.strategy,
63
+ tier: bs.sceneIndex === 0 ? budgetTier : bodyTier,
64
+ prompt: bs.prompt,
65
+ durationMs: bs.durationMs,
66
+ voiceoverLine: bs.voiceoverLine,
67
+ transitionIn: "cut",
68
+ estimatedCredits: 0, // stamped below
69
+ bibleEntityIds: [],
70
+ });
71
+ sceneIndices.push(bs.sceneIndex);
72
+ }
73
+ finalChapters.push({ ...ch, sceneIndices });
74
+ cursor += broll.length;
75
+ }
76
+ if (scenes.length === 0) {
77
+ throw new Error("planScriptFirst: produced zero scenes — generate_script / chapter_outline / match_broll_to_script returned no usable narration.");
78
+ }
79
+ // Stamp per-scene + total credits (same helpers the scene-first finalize uses).
80
+ for (const s of scenes)
81
+ s.estimatedCredits = (0, costPreflight_1.estimateSceneCredits)(s);
82
+ // Stream L (L-6): hard spend cap. If the lower-tier defaults still blow the
83
+ // cap (sheer length), downgrade EVERY scene to T0 and re-stamp. If even an
84
+ // all-T0 plan is over budget, the cap is unachievable at this duration —
85
+ // throw with concrete guidance rather than silently overspending.
86
+ if (brief.maxSpendUSD != null) {
87
+ const usd = () => (0, costPreflight_1.creditsToUsd)(scenes.reduce((s, sc) => s + (0, costPreflight_1.estimateSceneCredits)(sc), 0));
88
+ if (usd() > brief.maxSpendUSD) {
89
+ for (const s of scenes) {
90
+ s.tier = "T0";
91
+ s.estimatedCredits = (0, costPreflight_1.estimateSceneCredits)(s);
92
+ }
93
+ logger_1.logger.warn("agent.plan.scriptFirst.budgetDowngrade", {
94
+ maxSpendUSD: brief.maxSpendUSD,
95
+ usdAfterDowngrade: Number(usd().toFixed(2)),
96
+ scenes: scenes.length,
97
+ });
98
+ }
99
+ if (usd() > brief.maxSpendUSD) {
100
+ throw new Error(`planScriptFirst: even an all-T0 plan ($${usd().toFixed(2)}) exceeds ` +
101
+ `maxSpendUSD=$${brief.maxSpendUSD.toFixed(2)} for ${scenes.length} scenes ` +
102
+ `(~${Math.round(scenes.reduce((sum, s) => sum + s.durationMs, 0) / 1000)}s). ` +
103
+ `Reduce the requested duration or raise the budget.`);
104
+ }
105
+ }
106
+ const totalDurationMs = scenes.reduce((sum, s) => sum + s.durationMs, 0);
107
+ const plan = {
108
+ persona,
109
+ aspect,
110
+ totalDurationMs,
111
+ totalEstimatedCredits: 0,
112
+ lengthTier,
113
+ scenes,
114
+ chapters: finalChapters,
115
+ script,
116
+ // voiceId/voiceStyle flow brief → plan deterministically (AG-31/37), same
117
+ // as the scene-first path; the LLM never authors them here.
118
+ voiceId: brief.voice?.voiceId,
119
+ voiceStyle: brief.voice?.style,
120
+ warnings: [],
121
+ ...(opts.bible ? { bible: opts.bible } : {}),
122
+ };
123
+ plan.totalEstimatedCredits = (0, costPreflight_1.estimatePlanCost)(plan).totalCredits;
124
+ plan.warnings = (0, validators_1.collectPlanWarnings)(plan);
125
+ const parsed = videoPlan_schema_1.VideoPlanSchema.safeParse(plan);
126
+ if (!parsed.success) {
127
+ const issues = parsed.error.issues
128
+ .map((i) => `${i.path.join(".")}: ${i.message}`)
129
+ .join("; ");
130
+ throw new Error(`planScriptFirst: assembled plan failed validation: ${issues}`);
131
+ }
132
+ logger_1.logger.info("agent.plan.scriptFirst", {
133
+ lengthTier,
134
+ chapters: finalChapters.length,
135
+ scenes: scenes.length,
136
+ words: script.wordCount,
137
+ totalDurationMs,
138
+ });
139
+ return parsed.data;
140
+ }
@@ -5,6 +5,16 @@ import { VideoBrief } from "../../../schemas/brief.schema";
5
5
  * under-delivered, CTA caption order wrong. Spelled out as hard contracts in
6
6
  * the planner prompt rather than soft hints, plus AG-9 also has a post-plan
7
7
  * validator (checkDurationContract) so the planner can't silently miss it.
8
+ *
9
+ * Stream L (L-2) — per-tier branches. The rules above were authored for
10
+ * short-form (S1/S2) and still apply verbatim there. For M1+ the pacing band,
11
+ * scene-count cap, and chapter requirements diverge:
12
+ * - S1/S2: unchanged short-form rules.
13
+ * - M1 (60s–3min): mixed pacing — wider per-scene band, chapters recommended.
14
+ * - L1/L2 (3min+): per-scene band relaxed to 3–8s, MANY scenes expected, and
15
+ * a chapter structure is REQUIRED. (L-3 layers script-first authoring on
16
+ * top; this branch just sets the structural contract.)
17
+ * - L3: edit-existing, not planner-driven (routed to L-5) — never reaches here.
8
18
  */
9
19
  export declare function buildStructuralRulesSection(brief: VideoBrief): string;
10
20
  //# sourceMappingURL=structuralRules.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"structuralRules.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/planner/structuralRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAkJrE"}
1
+ {"version":3,"file":"structuralRules.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/planner/structuralRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoB,MAAM,+BAA+B,CAAC;AAE7E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAsOrE"}