vidspotai-shared 1.0.82-dev.0 → 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 (468) 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 +115 -10
  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 +70 -3
  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 +117 -3
  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 +4 -4
  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/recorder.d.ts +13 -1
  81. package/lib/services/agent/eval/recorder.d.ts.map +1 -1
  82. package/lib/services/agent/eval/recorder.js +59 -0
  83. package/lib/services/agent/eval/seedBriefs.d.ts +4 -3
  84. package/lib/services/agent/eval/seedBriefs.d.ts.map +1 -1
  85. package/lib/services/agent/eval/seedBriefs.js +283 -3
  86. package/lib/services/agent/eval/types.d.ts +10 -0
  87. package/lib/services/agent/eval/types.d.ts.map +1 -1
  88. package/lib/services/agent/executor/core.d.ts +70 -0
  89. package/lib/services/agent/executor/core.d.ts.map +1 -0
  90. package/lib/services/agent/executor/core.js +250 -0
  91. package/lib/services/agent/executor/duration.d.ts +20 -0
  92. package/lib/services/agent/executor/duration.d.ts.map +1 -0
  93. package/lib/services/agent/executor/duration.js +46 -0
  94. package/lib/services/agent/executor/index.d.ts +15 -0
  95. package/lib/services/agent/executor/index.d.ts.map +1 -0
  96. package/lib/services/agent/executor/index.js +32 -0
  97. package/lib/services/agent/executor/types.d.ts +183 -0
  98. package/lib/services/agent/executor/types.d.ts.map +1 -0
  99. package/lib/services/agent/executor/types.js +29 -0
  100. package/lib/services/agent/executor/visual.d.ts +32 -0
  101. package/lib/services/agent/executor/visual.d.ts.map +1 -0
  102. package/lib/services/agent/executor/visual.js +400 -0
  103. package/lib/services/agent/executor/voice.d.ts +17 -0
  104. package/lib/services/agent/executor/voice.d.ts.map +1 -0
  105. package/lib/services/agent/executor/voice.js +119 -0
  106. package/lib/services/agent/extendChain.d.ts +101 -0
  107. package/lib/services/agent/extendChain.d.ts.map +1 -0
  108. package/lib/services/agent/extendChain.js +177 -0
  109. package/lib/services/agent/index.d.ts +11 -1
  110. package/lib/services/agent/index.d.ts.map +1 -1
  111. package/lib/services/agent/index.js +11 -1
  112. package/lib/services/agent/llmCaller.d.ts +7 -8
  113. package/lib/services/agent/llmCaller.d.ts.map +1 -1
  114. package/lib/services/agent/llmCallerAnthropic.d.ts +44 -31
  115. package/lib/services/agent/llmCallerAnthropic.d.ts.map +1 -1
  116. package/lib/services/agent/llmCallerAnthropic.js +135 -60
  117. package/lib/services/agent/llmCallerFactory.d.ts +34 -0
  118. package/lib/services/agent/llmCallerFactory.d.ts.map +1 -0
  119. package/lib/services/agent/llmCallerFactory.js +31 -0
  120. package/lib/services/agent/llmCallerGemini.d.ts +62 -0
  121. package/lib/services/agent/llmCallerGemini.d.ts.map +1 -0
  122. package/lib/services/agent/llmCallerGemini.js +235 -0
  123. package/lib/services/agent/llmCallerOpenai.d.ts +56 -0
  124. package/lib/services/agent/llmCallerOpenai.d.ts.map +1 -0
  125. package/lib/services/agent/llmCallerOpenai.js +230 -0
  126. package/lib/services/agent/llmCallerRegistry.d.ts.map +1 -1
  127. package/lib/services/agent/llmCallerRegistry.js +7 -7
  128. package/lib/services/agent/llmCallerRouting.d.ts +63 -0
  129. package/lib/services/agent/llmCallerRouting.d.ts.map +1 -0
  130. package/lib/services/agent/llmCallerRouting.js +124 -0
  131. package/lib/services/agent/llmModelRegistry.d.ts +59 -0
  132. package/lib/services/agent/llmModelRegistry.d.ts.map +1 -0
  133. package/lib/services/agent/llmModelRegistry.js +168 -0
  134. package/lib/services/agent/llmRetry.d.ts +57 -0
  135. package/lib/services/agent/llmRetry.d.ts.map +1 -0
  136. package/lib/services/agent/llmRetry.js +102 -0
  137. package/lib/services/agent/modelRouter.d.ts +3 -3
  138. package/lib/services/agent/modelRouter.d.ts.map +1 -1
  139. package/lib/services/agent/modelRouter.js +27 -13
  140. package/lib/services/agent/planMutations.d.ts +54 -1
  141. package/lib/services/agent/planMutations.d.ts.map +1 -1
  142. package/lib/services/agent/planMutations.js +78 -0
  143. package/lib/services/agent/planner/Planner.d.ts +0 -17
  144. package/lib/services/agent/planner/Planner.d.ts.map +1 -1
  145. package/lib/services/agent/planner/Planner.js +67 -303
  146. package/lib/services/agent/planner/overlayRegen.d.ts +38 -0
  147. package/lib/services/agent/planner/overlayRegen.d.ts.map +1 -0
  148. package/lib/services/agent/planner/overlayRegen.js +145 -0
  149. package/lib/services/agent/planner/plannerMessages.d.ts +34 -0
  150. package/lib/services/agent/planner/plannerMessages.d.ts.map +1 -0
  151. package/lib/services/agent/planner/plannerMessages.js +185 -0
  152. package/lib/services/agent/planner/promptSections.d.ts +12 -0
  153. package/lib/services/agent/planner/promptSections.d.ts.map +1 -1
  154. package/lib/services/agent/planner/promptSections.js +57 -0
  155. package/lib/services/agent/planner/scriptFirstPlanner.d.ts +35 -0
  156. package/lib/services/agent/planner/scriptFirstPlanner.d.ts.map +1 -0
  157. package/lib/services/agent/planner/scriptFirstPlanner.js +140 -0
  158. package/lib/services/agent/planner/structuralRules.d.ts +10 -0
  159. package/lib/services/agent/planner/structuralRules.d.ts.map +1 -1
  160. package/lib/services/agent/planner/structuralRules.js +92 -9
  161. package/lib/services/agent/planner/validators.d.ts +18 -0
  162. package/lib/services/agent/planner/validators.d.ts.map +1 -1
  163. package/lib/services/agent/planner/validators.js +97 -0
  164. package/lib/services/agent/planner.d.ts +2 -1
  165. package/lib/services/agent/planner.d.ts.map +1 -1
  166. package/lib/services/agent/planner.js +5 -1
  167. package/lib/services/agent/priorProject.d.ts +26 -0
  168. package/lib/services/agent/priorProject.d.ts.map +1 -0
  169. package/lib/services/agent/priorProject.js +51 -0
  170. package/lib/services/agent/providerFallback/chains.d.ts.map +1 -1
  171. package/lib/services/agent/providerFallback/chains.js +27 -15
  172. package/lib/services/agent/repurpose/index.d.ts +3 -0
  173. package/lib/services/agent/repurpose/index.d.ts.map +1 -0
  174. package/lib/services/agent/repurpose/index.js +18 -0
  175. package/lib/services/agent/repurpose/repurpose.schema.d.ts +132 -0
  176. package/lib/services/agent/repurpose/repurpose.schema.d.ts.map +1 -0
  177. package/lib/services/agent/repurpose/repurpose.schema.js +144 -0
  178. package/lib/services/agent/repurpose/shortsPicker.d.ts +25 -0
  179. package/lib/services/agent/repurpose/shortsPicker.d.ts.map +1 -0
  180. package/lib/services/agent/repurpose/shortsPicker.js +218 -0
  181. package/lib/services/agent/runHelpers.d.ts +21 -2
  182. package/lib/services/agent/runHelpers.d.ts.map +1 -1
  183. package/lib/services/agent/runHelpers.js +71 -2
  184. package/lib/services/agent/tools/animateImage.tool.d.ts +1 -0
  185. package/lib/services/agent/tools/animateImage.tool.d.ts.map +1 -1
  186. package/lib/services/agent/tools/animateImage.tool.js +12 -0
  187. package/lib/services/agent/tools/chapterOutline.tool.d.ts +42 -0
  188. package/lib/services/agent/tools/chapterOutline.tool.d.ts.map +1 -0
  189. package/lib/services/agent/tools/chapterOutline.tool.js +115 -0
  190. package/lib/services/agent/tools/composeScene.tool.d.ts +65 -2
  191. package/lib/services/agent/tools/composeScene.tool.d.ts.map +1 -1
  192. package/lib/services/agent/tools/estimateCost.tool.d.ts +28 -1
  193. package/lib/services/agent/tools/estimateCost.tool.d.ts.map +1 -1
  194. package/lib/services/agent/tools/estimateCost.tool.js +55 -7
  195. package/lib/services/agent/tools/extendVideo.tool.d.ts +26 -0
  196. package/lib/services/agent/tools/extendVideo.tool.d.ts.map +1 -0
  197. package/lib/services/agent/tools/extendVideo.tool.js +149 -0
  198. package/lib/services/agent/tools/generateScript.tool.d.ts +184 -0
  199. package/lib/services/agent/tools/generateScript.tool.d.ts.map +1 -0
  200. package/lib/services/agent/tools/generateScript.tool.js +123 -0
  201. package/lib/services/agent/tools/generateVideo.tool.d.ts +1 -0
  202. package/lib/services/agent/tools/generateVideo.tool.d.ts.map +1 -1
  203. package/lib/services/agent/tools/generateVideo.tool.js +20 -1
  204. package/lib/services/agent/tools/index.d.ts +4 -0
  205. package/lib/services/agent/tools/index.d.ts.map +1 -1
  206. package/lib/services/agent/tools/index.js +4 -0
  207. package/lib/services/agent/tools/matchBrollToScript.tool.d.ts +50 -0
  208. package/lib/services/agent/tools/matchBrollToScript.tool.d.ts.map +1 -0
  209. package/lib/services/agent/tools/matchBrollToScript.tool.js +139 -0
  210. package/lib/services/agent/tools/planVideo.tool.d.ts +57 -1
  211. package/lib/services/agent/tools/planVideo.tool.d.ts.map +1 -1
  212. package/lib/services/agent/tools/planVideo.tool.js +3 -3
  213. package/lib/services/agent/tools/render.tool.d.ts +22 -1
  214. package/lib/services/agent/tools/render.tool.d.ts.map +1 -1
  215. package/lib/services/aiGen/aiGenFactory.service.d.ts.map +1 -1
  216. package/lib/services/aiGen/aiGenFactory.service.js +18 -3
  217. package/lib/services/aiGen/helpers.d.ts +8 -0
  218. package/lib/services/aiGen/helpers.d.ts.map +1 -1
  219. package/lib/services/aiGen/helpers.js +12 -0
  220. package/lib/services/aiGen/providers/anthropic/anthropic.service.d.ts +26 -0
  221. package/lib/services/aiGen/providers/anthropic/anthropic.service.d.ts.map +1 -0
  222. package/lib/services/aiGen/providers/anthropic/anthropic.service.js +95 -0
  223. package/lib/services/aiGen/providers/google/google.service.d.ts +25 -1
  224. package/lib/services/aiGen/providers/google/google.service.d.ts.map +1 -1
  225. package/lib/services/aiGen/providers/google/google.service.js +136 -237
  226. package/lib/services/aiGen/providers/google/googleApiKeys.d.ts +71 -0
  227. package/lib/services/aiGen/providers/google/googleApiKeys.d.ts.map +1 -0
  228. package/lib/services/aiGen/providers/google/googleApiKeys.js +137 -0
  229. package/lib/services/aiGen/providers/google/googleErrors.d.ts +13 -0
  230. package/lib/services/aiGen/providers/google/googleErrors.d.ts.map +1 -0
  231. package/lib/services/aiGen/providers/google/googleErrors.js +102 -0
  232. package/lib/services/aiGen/providers/google/googleFetch.d.ts +8 -0
  233. package/lib/services/aiGen/providers/google/googleFetch.d.ts.map +1 -0
  234. package/lib/services/aiGen/providers/google/googleFetch.js +96 -0
  235. package/lib/services/aiGen/providers/google/googleKeyPool.d.ts +52 -0
  236. package/lib/services/aiGen/providers/google/googleKeyPool.d.ts.map +1 -0
  237. package/lib/services/aiGen/providers/google/googleKeyPool.js +129 -0
  238. package/lib/services/aiGen/providers/google/googleMusic.d.ts +15 -0
  239. package/lib/services/aiGen/providers/google/googleMusic.d.ts.map +1 -0
  240. package/lib/services/aiGen/providers/google/googleMusic.js +77 -0
  241. package/lib/services/aiGen/providers/kling/kling.service.d.ts +7 -3
  242. package/lib/services/aiGen/providers/kling/kling.service.d.ts.map +1 -1
  243. package/lib/services/aiGen/providers/kling/kling.service.js +23 -367
  244. package/lib/services/aiGen/providers/kling/klingCredits.d.ts +9 -0
  245. package/lib/services/aiGen/providers/kling/klingCredits.d.ts.map +1 -0
  246. package/lib/services/aiGen/providers/kling/klingCredits.js +63 -0
  247. package/lib/services/aiGen/providers/kling/klingRequests.d.ts +32 -0
  248. package/lib/services/aiGen/providers/kling/klingRequests.d.ts.map +1 -0
  249. package/lib/services/aiGen/providers/kling/klingRequests.js +194 -0
  250. package/lib/services/aiGen/providers/kling/klingStatus.d.ts +16 -0
  251. package/lib/services/aiGen/providers/kling/klingStatus.d.ts.map +1 -0
  252. package/lib/services/aiGen/providers/kling/klingStatus.js +173 -0
  253. package/lib/services/aiGen/providers/pixverse/pixverse.service.d.ts.map +1 -1
  254. package/lib/services/aiGen/providers/pixverse/pixverse.service.js +7 -1
  255. package/lib/services/bullmq.service.d.ts +61 -0
  256. package/lib/services/bullmq.service.d.ts.map +1 -1
  257. package/lib/services/bullmq.service.js +124 -2
  258. package/lib/services/crypto/index.d.ts +2 -0
  259. package/lib/services/crypto/index.d.ts.map +1 -0
  260. package/lib/services/crypto/index.js +17 -0
  261. package/lib/services/crypto/tokenVault.d.ts +47 -0
  262. package/lib/services/crypto/tokenVault.d.ts.map +1 -0
  263. package/lib/services/crypto/tokenVault.js +179 -0
  264. package/lib/services/editor/captionStyleHint.d.ts +3 -0
  265. package/lib/services/editor/captionStyleHint.d.ts.map +1 -0
  266. package/lib/services/editor/captionStyleHint.js +112 -0
  267. package/lib/services/editor/planToProject.d.ts +7 -66
  268. package/lib/services/editor/planToProject.d.ts.map +1 -1
  269. package/lib/services/editor/planToProject.helpers.d.ts +40 -0
  270. package/lib/services/editor/planToProject.helpers.d.ts.map +1 -0
  271. package/lib/services/editor/planToProject.helpers.js +177 -0
  272. package/lib/services/editor/planToProject.js +197 -180
  273. package/lib/services/editor/planToProject.types.d.ts +94 -0
  274. package/lib/services/editor/planToProject.types.d.ts.map +1 -0
  275. package/lib/services/editor/planToProject.types.js +2 -0
  276. package/lib/services/firestore.service.d.ts +5 -0
  277. package/lib/services/firestore.service.d.ts.map +1 -1
  278. package/lib/services/firestore.service.js +13 -0
  279. package/lib/services/index.d.ts +13 -0
  280. package/lib/services/index.d.ts.map +1 -1
  281. package/lib/services/index.js +13 -0
  282. package/lib/services/promptEnhancer/index.d.ts +18 -0
  283. package/lib/services/promptEnhancer/index.d.ts.map +1 -0
  284. package/lib/services/promptEnhancer/index.js +33 -0
  285. package/lib/services/promptEnhancer/models.d.ts +54 -0
  286. package/lib/services/promptEnhancer/models.d.ts.map +1 -0
  287. package/lib/services/promptEnhancer/models.js +37 -0
  288. package/lib/services/promptEnhancer/profiles/agent.profile.d.ts +14 -0
  289. package/lib/services/promptEnhancer/profiles/agent.profile.d.ts.map +1 -0
  290. package/lib/services/promptEnhancer/profiles/agent.profile.js +40 -0
  291. package/lib/services/promptEnhancer/profiles/avatar.profile.d.ts +13 -0
  292. package/lib/services/promptEnhancer/profiles/avatar.profile.d.ts.map +1 -0
  293. package/lib/services/promptEnhancer/profiles/avatar.profile.js +40 -0
  294. package/lib/services/promptEnhancer/profiles/base.d.ts +28 -0
  295. package/lib/services/promptEnhancer/profiles/base.d.ts.map +1 -0
  296. package/lib/services/promptEnhancer/profiles/base.js +35 -0
  297. package/lib/services/promptEnhancer/profiles/image.profile.d.ts +11 -0
  298. package/lib/services/promptEnhancer/profiles/image.profile.d.ts.map +1 -0
  299. package/lib/services/promptEnhancer/profiles/image.profile.js +42 -0
  300. package/lib/services/promptEnhancer/profiles/index.d.ts +12 -0
  301. package/lib/services/promptEnhancer/profiles/index.d.ts.map +1 -0
  302. package/lib/services/promptEnhancer/profiles/index.js +33 -0
  303. package/lib/services/promptEnhancer/profiles/video.profile.d.ts +15 -0
  304. package/lib/services/promptEnhancer/profiles/video.profile.d.ts.map +1 -0
  305. package/lib/services/promptEnhancer/profiles/video.profile.js +81 -0
  306. package/lib/services/promptEnhancer/promptEnhancer.service.d.ts +45 -0
  307. package/lib/services/promptEnhancer/promptEnhancer.service.d.ts.map +1 -0
  308. package/lib/services/promptEnhancer/promptEnhancer.service.js +157 -0
  309. package/lib/services/promptEnhancer/schema.d.ts +19 -0
  310. package/lib/services/promptEnhancer/schema.d.ts.map +1 -0
  311. package/lib/services/promptEnhancer/schema.js +43 -0
  312. package/lib/services/promptEnhancer/types.d.ts +112 -0
  313. package/lib/services/promptEnhancer/types.d.ts.map +1 -0
  314. package/lib/services/promptEnhancer/types.js +2 -0
  315. package/lib/services/rateLimiter/distributedRateLimiter.service.d.ts +60 -5
  316. package/lib/services/rateLimiter/distributedRateLimiter.service.d.ts.map +1 -1
  317. package/lib/services/rateLimiter/distributedRateLimiter.service.js +184 -16
  318. package/lib/services/socialAI/captionGen.d.ts +81 -0
  319. package/lib/services/socialAI/captionGen.d.ts.map +1 -0
  320. package/lib/services/socialAI/captionGen.js +206 -0
  321. package/lib/services/socialAI/hookScore.d.ts +85 -0
  322. package/lib/services/socialAI/hookScore.d.ts.map +1 -0
  323. package/lib/services/socialAI/hookScore.js +170 -0
  324. package/lib/services/socialAI/index.d.ts +3 -0
  325. package/lib/services/socialAI/index.d.ts.map +1 -0
  326. package/lib/services/socialAI/index.js +18 -0
  327. package/lib/services/socialAccounts/index.d.ts +2 -0
  328. package/lib/services/socialAccounts/index.d.ts.map +1 -0
  329. package/lib/services/socialAccounts/index.js +17 -0
  330. package/lib/services/socialAccounts/socialAccountService.d.ts +25 -0
  331. package/lib/services/socialAccounts/socialAccountService.d.ts.map +1 -0
  332. package/lib/services/socialAccounts/socialAccountService.js +105 -0
  333. package/lib/services/socialEngage/factory.d.ts +7 -0
  334. package/lib/services/socialEngage/factory.d.ts.map +1 -0
  335. package/lib/services/socialEngage/factory.js +25 -0
  336. package/lib/services/socialEngage/index.d.ts +6 -0
  337. package/lib/services/socialEngage/index.d.ts.map +1 -0
  338. package/lib/services/socialEngage/index.js +21 -0
  339. package/lib/services/socialEngage/meta.engage.d.ts +17 -0
  340. package/lib/services/socialEngage/meta.engage.d.ts.map +1 -0
  341. package/lib/services/socialEngage/meta.engage.js +128 -0
  342. package/lib/services/socialEngage/metaWebhook.d.ts +50 -0
  343. package/lib/services/socialEngage/metaWebhook.d.ts.map +1 -0
  344. package/lib/services/socialEngage/metaWebhook.js +93 -0
  345. package/lib/services/socialEngage/types.d.ts +72 -0
  346. package/lib/services/socialEngage/types.d.ts.map +1 -0
  347. package/lib/services/socialEngage/types.js +10 -0
  348. package/lib/services/socialEngage/youtube.engage.d.ts +9 -0
  349. package/lib/services/socialEngage/youtube.engage.d.ts.map +1 -0
  350. package/lib/services/socialEngage/youtube.engage.js +87 -0
  351. package/lib/services/socialFormat/aspectGeometry.d.ts +74 -0
  352. package/lib/services/socialFormat/aspectGeometry.d.ts.map +1 -0
  353. package/lib/services/socialFormat/aspectGeometry.js +135 -0
  354. package/lib/services/socialFormat/index.d.ts +2 -0
  355. package/lib/services/socialFormat/index.d.ts.map +1 -0
  356. package/lib/services/socialFormat/index.js +19 -0
  357. package/lib/services/socialInsights/index.d.ts +3 -0
  358. package/lib/services/socialInsights/index.d.ts.map +1 -0
  359. package/lib/services/socialInsights/index.js +18 -0
  360. package/lib/services/socialInsights/recommendations.d.ts +131 -0
  361. package/lib/services/socialInsights/recommendations.d.ts.map +1 -0
  362. package/lib/services/socialInsights/recommendations.js +277 -0
  363. package/lib/services/socialInsights/timeBuckets.d.ts +35 -0
  364. package/lib/services/socialInsights/timeBuckets.d.ts.map +1 -0
  365. package/lib/services/socialInsights/timeBuckets.js +78 -0
  366. package/lib/services/socialMetrics/factory.d.ts +5 -0
  367. package/lib/services/socialMetrics/factory.d.ts.map +1 -0
  368. package/lib/services/socialMetrics/factory.js +24 -0
  369. package/lib/services/socialMetrics/index.d.ts +6 -0
  370. package/lib/services/socialMetrics/index.d.ts.map +1 -0
  371. package/lib/services/socialMetrics/index.js +21 -0
  372. package/lib/services/socialMetrics/meta.metrics.d.ts +22 -0
  373. package/lib/services/socialMetrics/meta.metrics.d.ts.map +1 -0
  374. package/lib/services/socialMetrics/meta.metrics.js +137 -0
  375. package/lib/services/socialMetrics/tiktok.metrics.d.ts +8 -0
  376. package/lib/services/socialMetrics/tiktok.metrics.d.ts.map +1 -0
  377. package/lib/services/socialMetrics/tiktok.metrics.js +43 -0
  378. package/lib/services/socialMetrics/types.d.ts +54 -0
  379. package/lib/services/socialMetrics/types.d.ts.map +1 -0
  380. package/lib/services/socialMetrics/types.js +2 -0
  381. package/lib/services/socialMetrics/youtube.metrics.d.ts +8 -0
  382. package/lib/services/socialMetrics/youtube.metrics.d.ts.map +1 -0
  383. package/lib/services/socialMetrics/youtube.metrics.js +43 -0
  384. package/lib/services/socialOAuth/factory.d.ts +7 -0
  385. package/lib/services/socialOAuth/factory.d.ts.map +1 -0
  386. package/lib/services/socialOAuth/factory.js +42 -0
  387. package/lib/services/socialOAuth/index.d.ts +11 -0
  388. package/lib/services/socialOAuth/index.d.ts.map +1 -0
  389. package/lib/services/socialOAuth/index.js +26 -0
  390. package/lib/services/socialOAuth/linkedin.oauth.d.ts +14 -0
  391. package/lib/services/socialOAuth/linkedin.oauth.d.ts.map +1 -0
  392. package/lib/services/socialOAuth/linkedin.oauth.js +127 -0
  393. package/lib/services/socialOAuth/meta.oauth.d.ts +31 -0
  394. package/lib/services/socialOAuth/meta.oauth.d.ts.map +1 -0
  395. package/lib/services/socialOAuth/meta.oauth.js +214 -0
  396. package/lib/services/socialOAuth/oauthState.d.ts +14 -0
  397. package/lib/services/socialOAuth/oauthState.d.ts.map +1 -0
  398. package/lib/services/socialOAuth/oauthState.js +66 -0
  399. package/lib/services/socialOAuth/pinterest.oauth.d.ts +15 -0
  400. package/lib/services/socialOAuth/pinterest.oauth.d.ts.map +1 -0
  401. package/lib/services/socialOAuth/pinterest.oauth.js +126 -0
  402. package/lib/services/socialOAuth/threads.oauth.d.ts +14 -0
  403. package/lib/services/socialOAuth/threads.oauth.d.ts.map +1 -0
  404. package/lib/services/socialOAuth/threads.oauth.js +129 -0
  405. package/lib/services/socialOAuth/tiktok.oauth.d.ts +15 -0
  406. package/lib/services/socialOAuth/tiktok.oauth.d.ts.map +1 -0
  407. package/lib/services/socialOAuth/tiktok.oauth.js +151 -0
  408. package/lib/services/socialOAuth/types.d.ts +67 -0
  409. package/lib/services/socialOAuth/types.d.ts.map +1 -0
  410. package/lib/services/socialOAuth/types.js +2 -0
  411. package/lib/services/socialOAuth/x.oauth.d.ts +17 -0
  412. package/lib/services/socialOAuth/x.oauth.d.ts.map +1 -0
  413. package/lib/services/socialOAuth/x.oauth.js +134 -0
  414. package/lib/services/socialOAuth/youtube.oauth.d.ts +15 -0
  415. package/lib/services/socialOAuth/youtube.oauth.d.ts.map +1 -0
  416. package/lib/services/socialOAuth/youtube.oauth.js +156 -0
  417. package/lib/services/socialPublish/factory.d.ts +5 -0
  418. package/lib/services/socialPublish/factory.d.ts.map +1 -0
  419. package/lib/services/socialPublish/factory.js +32 -0
  420. package/lib/services/socialPublish/index.d.ts +10 -0
  421. package/lib/services/socialPublish/index.d.ts.map +1 -0
  422. package/lib/services/socialPublish/index.js +25 -0
  423. package/lib/services/socialPublish/linkedin.publish.d.ts +9 -0
  424. package/lib/services/socialPublish/linkedin.publish.d.ts.map +1 -0
  425. package/lib/services/socialPublish/linkedin.publish.js +143 -0
  426. package/lib/services/socialPublish/meta.publish.d.ts +28 -0
  427. package/lib/services/socialPublish/meta.publish.d.ts.map +1 -0
  428. package/lib/services/socialPublish/meta.publish.js +149 -0
  429. package/lib/services/socialPublish/pinterest.publish.d.ts +13 -0
  430. package/lib/services/socialPublish/pinterest.publish.d.ts.map +1 -0
  431. package/lib/services/socialPublish/pinterest.publish.js +130 -0
  432. package/lib/services/socialPublish/threads.publish.d.ts +12 -0
  433. package/lib/services/socialPublish/threads.publish.d.ts.map +1 -0
  434. package/lib/services/socialPublish/threads.publish.js +96 -0
  435. package/lib/services/socialPublish/tiktok.publish.d.ts +13 -0
  436. package/lib/services/socialPublish/tiktok.publish.d.ts.map +1 -0
  437. package/lib/services/socialPublish/tiktok.publish.js +118 -0
  438. package/lib/services/socialPublish/types.d.ts +47 -0
  439. package/lib/services/socialPublish/types.d.ts.map +1 -0
  440. package/lib/services/socialPublish/types.js +2 -0
  441. package/lib/services/socialPublish/x.publish.d.ts +12 -0
  442. package/lib/services/socialPublish/x.publish.d.ts.map +1 -0
  443. package/lib/services/socialPublish/x.publish.js +147 -0
  444. package/lib/services/socialPublish/youtube.publish.d.ts +9 -0
  445. package/lib/services/socialPublish/youtube.publish.d.ts.map +1 -0
  446. package/lib/services/socialPublish/youtube.publish.js +107 -0
  447. package/lib/services/stock/index.d.ts +2 -0
  448. package/lib/services/stock/index.d.ts.map +1 -0
  449. package/lib/services/stock/index.js +17 -0
  450. package/lib/services/stock/realPersonSafety.d.ts +99 -0
  451. package/lib/services/stock/realPersonSafety.d.ts.map +1 -0
  452. package/lib/services/stock/realPersonSafety.js +248 -0
  453. package/lib/services/translation/index.d.ts +2 -0
  454. package/lib/services/translation/index.d.ts.map +1 -0
  455. package/lib/services/translation/index.js +9 -0
  456. package/lib/services/translation/translation.service.d.ts +50 -0
  457. package/lib/services/translation/translation.service.d.ts.map +1 -0
  458. package/lib/services/translation/translation.service.js +211 -0
  459. package/lib/utils/helpers.d.ts +2 -4
  460. package/lib/utils/helpers.d.ts.map +1 -1
  461. package/lib/utils/helpers.js +9 -63
  462. package/lib/utils/index.d.ts +1 -0
  463. package/lib/utils/index.d.ts.map +1 -1
  464. package/lib/utils/index.js +1 -0
  465. package/lib/utils/renderTier.d.ts +26 -0
  466. package/lib/utils/renderTier.d.ts.map +1 -0
  467. package/lib/utils/renderTier.js +34 -0
  468. package/package.json +1 -1
@@ -0,0 +1,158 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * X8 Social Suite · Phase 6 · E2 — "AI covers + A/B" schemas.
4
+ *
5
+ * One source video → an LLM picks the strongest still MOMENTS to grab as cover
6
+ * frames AND writes the thumbnail copy (a punchy headline + optional subtext)
7
+ * for each, deliberately spread across distinct A/B ANGLES (curiosity vs.
8
+ * benefit vs. bold-claim …). Each candidate frame is then extracted, cropped to
9
+ * the cover aspect, and re-scored by a VISION model so the picks reflect what
10
+ * the frame actually looks like (sharp / well-framed / a face), not just what
11
+ * the transcript said. The output is a set of ranked, ready-to-A/B-test covers.
12
+ *
13
+ * Deliberately a sibling of E3 (auto-repurpose), not a fork: E3 cuts VIDEO
14
+ * spans, E2 grabs STILL frames. They share the ffmpeg primitives (download /
15
+ * probe / a new single-frame extract), the ASR transcript shape, and the
16
+ * reframe geometry — but the brain and output shape differ, so E2 gets its own
17
+ * pure planner (coverPlanner.ts) and its own worker, leaving E3 untouched.
18
+ *
19
+ * As elsewhere on the agent surface, the PURE logic (frame selection, copy,
20
+ * vision re-scoring, clamping, credit math) lives in `shared` so it is
21
+ * unit-/eval-able; the IO-heavy stages (download → ASR → ffmpeg frame extract →
22
+ * upload) run in the node-express worker where ffmpeg already is.
23
+ */
24
+ export declare const CoverRequestSchema: z.ZodObject<{
25
+ sourceVideoUrl: z.ZodString;
26
+ sourceDurationSec: z.ZodNumber;
27
+ maxCovers: z.ZodOptional<z.ZodNumber>;
28
+ aspect: z.ZodOptional<z.ZodEnum<{
29
+ "9:16": "9:16";
30
+ "1:1": "1:1";
31
+ "4:5": "4:5";
32
+ "16:9": "16:9";
33
+ }>>;
34
+ language: z.ZodOptional<z.ZodString>;
35
+ instructions: z.ZodOptional<z.ZodString>;
36
+ tone: z.ZodOptional<z.ZodString>;
37
+ title: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$strict>;
39
+ export type CoverRequest = z.infer<typeof CoverRequestSchema>;
40
+ export declare const COVER_HEADLINE_MAX = 80;
41
+ export declare const COVER_SUBTEXT_MAX = 120;
42
+ export declare const COVER_ANGLE_MAX = 40;
43
+ export declare const COVER_REASON_MAX = 400;
44
+ /** The recognised A/B angles. Free strings are allowed but the planner is steered to these. */
45
+ export declare const COVER_ANGLES: readonly ["curiosity", "benefit", "bold-claim", "question", "how-to", "emotional", "contrarian", "listicle"];
46
+ /**
47
+ * One cover candidate: a single still MOMENT of the source plus the thumbnail
48
+ * copy to overlay on it. The overlay text is returned as DATA (not baked into
49
+ * the pixels) so the UI can render every A/B variant live and the user can pick
50
+ * the winner before exporting — keeps v1 flexible and avoids font/placement
51
+ * guesswork in ffmpeg.
52
+ */
53
+ export declare const CoverCandidateSchema: z.ZodObject<{
54
+ atMs: z.ZodNumber;
55
+ headline: z.ZodString;
56
+ subtext: z.ZodOptional<z.ZodString>;
57
+ angle: z.ZodString;
58
+ reason: z.ZodString;
59
+ score: z.ZodNumber;
60
+ }, z.core.$strict>;
61
+ export type CoverCandidate = z.infer<typeof CoverCandidateSchema>;
62
+ export declare const CoverPlanSchema: z.ZodObject<{
63
+ covers: z.ZodArray<z.ZodObject<{
64
+ atMs: z.ZodNumber;
65
+ headline: z.ZodString;
66
+ subtext: z.ZodOptional<z.ZodString>;
67
+ angle: z.ZodString;
68
+ reason: z.ZodString;
69
+ score: z.ZodNumber;
70
+ }, z.core.$strict>>;
71
+ summary: z.ZodOptional<z.ZodString>;
72
+ }, z.core.$strict>;
73
+ export type CoverPlan = z.infer<typeof CoverPlanSchema>;
74
+ /**
75
+ * Per-frame verdict from the vision pass. The planner chose the moment from
76
+ * TEXT; the vision model now actually LOOKS at the extracted frame and reports
77
+ * whether it works as a still (sharp, well-composed, a clear subject/face) and
78
+ * a 0–100 visual score. `index` ties back to the candidate it judged.
79
+ */
80
+ export declare const CoverVisionVerdictSchema: z.ZodObject<{
81
+ index: z.ZodNumber;
82
+ visualScore: z.ZodNumber;
83
+ isPoor: z.ZodBoolean;
84
+ note: z.ZodOptional<z.ZodString>;
85
+ }, z.core.$strict>;
86
+ export type CoverVisionVerdict = z.infer<typeof CoverVisionVerdictSchema>;
87
+ export declare const CoverVisionReportSchema: z.ZodObject<{
88
+ verdicts: z.ZodArray<z.ZodObject<{
89
+ index: z.ZodNumber;
90
+ visualScore: z.ZodNumber;
91
+ isPoor: z.ZodBoolean;
92
+ note: z.ZodOptional<z.ZodString>;
93
+ }, z.core.$strict>>;
94
+ }, z.core.$strict>;
95
+ export type CoverVisionReport = z.infer<typeof CoverVisionReportSchema>;
96
+ /**
97
+ * Tiny job envelope — same design rule as RepurposeJobPayload: the full request
98
+ * lives on `agentProjects/{projectId}.coverRequest`, the worker reads it at job
99
+ * start. Keeps the Redis stream light.
100
+ */
101
+ export declare const CoverJobPayloadSchema: z.ZodObject<{
102
+ runId: z.ZodString;
103
+ projectId: z.ZodString;
104
+ userId: z.ZodString;
105
+ enqueuedAt: z.ZodNumber;
106
+ }, z.core.$strict>;
107
+ export type CoverJobPayload = z.infer<typeof CoverJobPayloadSchema>;
108
+ /**
109
+ * A finished cover on `agentProjects/{projectId}.covers[]`. Carries the
110
+ * extracted/cropped still URL + the overlay copy + the source timestamp it was
111
+ * grabbed from, plus the blended final score (planner + vision). Sorted by
112
+ * `score` desc in the UI so the strongest A/B variant leads.
113
+ */
114
+ export interface ProducedCover {
115
+ index: number;
116
+ /** Source timestamp the still was grabbed from, ms. */
117
+ atMs: number;
118
+ /** Overlay copy (rendered live over the image by the UI; not baked in). */
119
+ headline: string;
120
+ subtext?: string;
121
+ /** The A/B angle this variant tests. */
122
+ angle: string;
123
+ reason: string;
124
+ /** Blended final score 0–100 (planner click-through × vision frame quality). */
125
+ score: number;
126
+ /** Planner's pre-vision click-through prediction (kept for transparency). */
127
+ plannerScore: number;
128
+ /** Vision frame-quality score 0–100 when the vision pass ran (else absent). */
129
+ visualScore?: number;
130
+ /** Output aspect (the requested target, e.g. "9:16"). */
131
+ aspect: string;
132
+ /** Long-lived signed URL of the extracted, aspect-cropped still (JPG). */
133
+ imageUrl: string;
134
+ width: number;
135
+ height: number;
136
+ }
137
+ /**
138
+ * Flat USD overheads beyond the per-second ASR cost:
139
+ * - the cover-planner LLM call (one structured text pass over the transcript),
140
+ * - the vision re-score LLM call (one structured vision pass over the frames),
141
+ * - our ffmpeg compute per cover (a single-frame extract + crop + upload —
142
+ * cheap, but priced so the op isn't free).
143
+ */
144
+ export declare const COVER_PLANNER_LLM_USD = 0.04;
145
+ export declare const COVER_VISION_LLM_USD = 0.02;
146
+ export declare const COVER_COMPUTE_PER_USD = 0.005;
147
+ /** Default covers assumed for the upfront estimate when maxCovers is omitted. */
148
+ export declare const DEFAULT_MAX_COVERS = 4;
149
+ /**
150
+ * Pure upfront credit estimate for a covers job. The controller deducts this
151
+ * before enqueue; the worker reconciles against the REAL ASR duration and the
152
+ * actual number of covers produced, refunding any overcharge. 1 credit = $0.10.
153
+ */
154
+ export declare function estimateCoverCredits(args: {
155
+ sourceDurationSec: number;
156
+ maxCovers?: number;
157
+ }): number;
158
+ //# sourceMappingURL=covers.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"covers.schema.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/covers/covers.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;kBAuBpB,CAAC;AACZ,MAAM,MAAM,YAAY,GAAG,CAAC,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KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,YAAY,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAID;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAC1C,eAAO,MAAM,oBAAoB,OAAO,CAAC;AACzC,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAG3C,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,CAST"}
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_MAX_COVERS = exports.COVER_COMPUTE_PER_USD = exports.COVER_VISION_LLM_USD = exports.COVER_PLANNER_LLM_USD = exports.CoverJobPayloadSchema = exports.CoverVisionReportSchema = exports.CoverVisionVerdictSchema = exports.CoverPlanSchema = exports.CoverCandidateSchema = exports.COVER_ANGLES = exports.COVER_REASON_MAX = exports.COVER_ANGLE_MAX = exports.COVER_SUBTEXT_MAX = exports.COVER_HEADLINE_MAX = exports.CoverRequestSchema = void 0;
4
+ exports.estimateCoverCredits = estimateCoverCredits;
5
+ const zod_1 = require("zod");
6
+ const project_schema_1 = require("../../../schemas/project.schema");
7
+ const helpers_1 = require("../../../utils/helpers");
8
+ /**
9
+ * X8 Social Suite · Phase 6 · E2 — "AI covers + A/B" schemas.
10
+ *
11
+ * One source video → an LLM picks the strongest still MOMENTS to grab as cover
12
+ * frames AND writes the thumbnail copy (a punchy headline + optional subtext)
13
+ * for each, deliberately spread across distinct A/B ANGLES (curiosity vs.
14
+ * benefit vs. bold-claim …). Each candidate frame is then extracted, cropped to
15
+ * the cover aspect, and re-scored by a VISION model so the picks reflect what
16
+ * the frame actually looks like (sharp / well-framed / a face), not just what
17
+ * the transcript said. The output is a set of ranked, ready-to-A/B-test covers.
18
+ *
19
+ * Deliberately a sibling of E3 (auto-repurpose), not a fork: E3 cuts VIDEO
20
+ * spans, E2 grabs STILL frames. They share the ffmpeg primitives (download /
21
+ * probe / a new single-frame extract), the ASR transcript shape, and the
22
+ * reframe geometry — but the brain and output shape differ, so E2 gets its own
23
+ * pure planner (coverPlanner.ts) and its own worker, leaving E3 untouched.
24
+ *
25
+ * As elsewhere on the agent surface, the PURE logic (frame selection, copy,
26
+ * vision re-scoring, clamping, credit math) lives in `shared` so it is
27
+ * unit-/eval-able; the IO-heavy stages (download → ASR → ffmpeg frame extract →
28
+ * upload) run in the node-express worker where ffmpeg already is.
29
+ */
30
+ // ─── request (the controller body) ───────────────────────────────────────────
31
+ exports.CoverRequestSchema = zod_1.z
32
+ .object({
33
+ /** Publicly-fetchable URL of the source video (Firebase Storage / signed). */
34
+ sourceVideoUrl: zod_1.z.string().url(),
35
+ /**
36
+ * Source duration in seconds — needed for the UPFRONT ASR credit estimate
37
+ * (ASR is billed per second). The worker reconciles against the real ASR
38
+ * `audioDuration` after transcription.
39
+ */
40
+ sourceDurationSec: zod_1.z.number().positive(),
41
+ /** Hard cap on how many cover variants to produce. Planner default is 4. */
42
+ maxCovers: zod_1.z.number().int().positive().max(12).optional(),
43
+ /** Output aspect for the cover image. Default 9:16 (Reels/Shorts/TikTok). */
44
+ aspect: project_schema_1.AspectSchema.optional(),
45
+ /** ASR language hint (e.g. "en", "es"). Omitted → AssemblyAI autodetect. */
46
+ language: zod_1.z.string().min(2).max(10).optional(),
47
+ /** Free-form steering for the planner ("lean into the price reveal", etc.). */
48
+ instructions: zod_1.z.string().max(2000).optional(),
49
+ /** Tone hint for the headlines ("punchy", "professional"). */
50
+ tone: zod_1.z.string().max(200).optional(),
51
+ /** Display title for the produced cover set / project. */
52
+ title: zod_1.z.string().max(200).optional(),
53
+ })
54
+ .strict();
55
+ // ─── cover candidates (LLM output) ───────────────────────────────────────────
56
+ exports.COVER_HEADLINE_MAX = 80;
57
+ exports.COVER_SUBTEXT_MAX = 120;
58
+ exports.COVER_ANGLE_MAX = 40;
59
+ exports.COVER_REASON_MAX = 400;
60
+ /** The recognised A/B angles. Free strings are allowed but the planner is steered to these. */
61
+ exports.COVER_ANGLES = [
62
+ "curiosity",
63
+ "benefit",
64
+ "bold-claim",
65
+ "question",
66
+ "how-to",
67
+ "emotional",
68
+ "contrarian",
69
+ "listicle",
70
+ ];
71
+ /**
72
+ * One cover candidate: a single still MOMENT of the source plus the thumbnail
73
+ * copy to overlay on it. The overlay text is returned as DATA (not baked into
74
+ * the pixels) so the UI can render every A/B variant live and the user can pick
75
+ * the winner before exporting — keeps v1 flexible and avoids font/placement
76
+ * guesswork in ffmpeg.
77
+ */
78
+ exports.CoverCandidateSchema = zod_1.z
79
+ .object({
80
+ /** Timestamp in the SOURCE timeline to grab the still from, ms. */
81
+ atMs: zod_1.z.number().nonnegative(),
82
+ /** The big, scroll-stopping overlay headline (the thumbnail's main text). */
83
+ headline: zod_1.z.string().max(exports.COVER_HEADLINE_MAX),
84
+ /** Optional smaller supporting line under the headline. */
85
+ subtext: zod_1.z.string().max(exports.COVER_SUBTEXT_MAX).optional(),
86
+ /** The A/B angle this variant tests (see COVER_ANGLES; free string allowed). */
87
+ angle: zod_1.z.string().max(exports.COVER_ANGLE_MAX),
88
+ /** Why this frame + copy makes a strong cover — surfaced in the UI + eval. */
89
+ reason: zod_1.z.string().max(exports.COVER_REASON_MAX),
90
+ /** Planner's predicted click-through 0–100 (refined by the vision pass). */
91
+ score: zod_1.z.number().min(0).max(100),
92
+ })
93
+ .strict();
94
+ exports.CoverPlanSchema = zod_1.z
95
+ .object({
96
+ covers: zod_1.z.array(exports.CoverCandidateSchema).min(1),
97
+ /** One-line description of the cover set (optional; shown in UI). */
98
+ summary: zod_1.z.string().max(500).optional(),
99
+ })
100
+ .strict();
101
+ // ─── vision re-score (LLM output, pass 2) ────────────────────────────────────
102
+ /**
103
+ * Per-frame verdict from the vision pass. The planner chose the moment from
104
+ * TEXT; the vision model now actually LOOKS at the extracted frame and reports
105
+ * whether it works as a still (sharp, well-composed, a clear subject/face) and
106
+ * a 0–100 visual score. `index` ties back to the candidate it judged.
107
+ */
108
+ exports.CoverVisionVerdictSchema = zod_1.z
109
+ .object({
110
+ index: zod_1.z.number().int().nonnegative(),
111
+ /** 0–100 — purely how good the FRAME looks as a thumbnail still. */
112
+ visualScore: zod_1.z.number().min(0).max(100),
113
+ /** True if the frame is blurry / mid-blink / a transition smear / blank. */
114
+ isPoor: zod_1.z.boolean(),
115
+ /** Short note on the frame ("clear face, good contrast" / "motion blur"). */
116
+ note: zod_1.z.string().max(200).optional(),
117
+ })
118
+ .strict();
119
+ exports.CoverVisionReportSchema = zod_1.z
120
+ .object({
121
+ verdicts: zod_1.z.array(exports.CoverVisionVerdictSchema),
122
+ })
123
+ .strict();
124
+ // ─── BullMQ envelope ─────────────────────────────────────────────────────────
125
+ /**
126
+ * Tiny job envelope — same design rule as RepurposeJobPayload: the full request
127
+ * lives on `agentProjects/{projectId}.coverRequest`, the worker reads it at job
128
+ * start. Keeps the Redis stream light.
129
+ */
130
+ exports.CoverJobPayloadSchema = zod_1.z
131
+ .object({
132
+ runId: zod_1.z.string().min(1),
133
+ projectId: zod_1.z.string().min(1),
134
+ userId: zod_1.z.string().min(1),
135
+ enqueuedAt: zod_1.z.number().int().nonnegative(),
136
+ })
137
+ .strict();
138
+ // ─── cost ────────────────────────────────────────────────────────────────────
139
+ /**
140
+ * Flat USD overheads beyond the per-second ASR cost:
141
+ * - the cover-planner LLM call (one structured text pass over the transcript),
142
+ * - the vision re-score LLM call (one structured vision pass over the frames),
143
+ * - our ffmpeg compute per cover (a single-frame extract + crop + upload —
144
+ * cheap, but priced so the op isn't free).
145
+ */
146
+ exports.COVER_PLANNER_LLM_USD = 0.04;
147
+ exports.COVER_VISION_LLM_USD = 0.02;
148
+ exports.COVER_COMPUTE_PER_USD = 0.005;
149
+ /** AssemblyAI Universal-2 base rate, $/hr (mirrors AssemblyAIService / E3). */
150
+ const ASR_USD_PER_HOUR = 0.15;
151
+ /** Default covers assumed for the upfront estimate when maxCovers is omitted. */
152
+ exports.DEFAULT_MAX_COVERS = 4;
153
+ /**
154
+ * Pure upfront credit estimate for a covers job. The controller deducts this
155
+ * before enqueue; the worker reconciles against the REAL ASR duration and the
156
+ * actual number of covers produced, refunding any overcharge. 1 credit = $0.10.
157
+ */
158
+ function estimateCoverCredits(args) {
159
+ const covers = args.maxCovers ?? exports.DEFAULT_MAX_COVERS;
160
+ const asrUsd = (ASR_USD_PER_HOUR / 3600) * Math.max(0, args.sourceDurationSec);
161
+ const totalUsd = asrUsd +
162
+ exports.COVER_PLANNER_LLM_USD +
163
+ exports.COVER_VISION_LLM_USD +
164
+ exports.COVER_COMPUTE_PER_USD * Math.max(1, covers);
165
+ return (0, helpers_1.getCreditsFromCost)(totalUsd);
166
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./covers.schema";
2
+ export * from "./coverPlanner";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/covers/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./covers.schema"), exports);
18
+ __exportStar(require("./coverPlanner"), exports);
@@ -40,6 +40,7 @@ export declare const CriticFindingSchema: z.ZodObject<{
40
40
  pass: "pass";
41
41
  }>;
42
42
  clipId: z.ZodOptional<z.ZodString>;
43
+ sceneIndex: z.ZodOptional<z.ZodNumber>;
43
44
  message: z.ZodString;
44
45
  suggestedAction: z.ZodOptional<z.ZodObject<{
45
46
  kind: z.ZodEnum<{
@@ -72,6 +73,7 @@ export declare const CriticReportSchema: z.ZodObject<{
72
73
  pass: "pass";
73
74
  }>;
74
75
  clipId: z.ZodOptional<z.ZodString>;
76
+ sceneIndex: z.ZodOptional<z.ZodNumber>;
75
77
  message: z.ZodString;
76
78
  suggestedAction: z.ZodOptional<z.ZodObject<{
77
79
  kind: z.ZodEnum<{
@@ -85,6 +87,14 @@ export declare const CriticReportSchema: z.ZodObject<{
85
87
  }, z.core.$strip>>;
86
88
  }, z.core.$strip>;
87
89
  export type CriticReport = z.infer<typeof CriticReportSchema>;
90
+ /**
91
+ * OD-6 — derive a scene index from a clip id. The executor and regen core mint
92
+ * clip ids as `scene-<n>-visual` / `scene-<n>-vo` / `scene-<n>-caption` and
93
+ * `clip-<n>` (and the cost-preflight uses bare `scene-<n>`). Matching the
94
+ * leading `scene-`/`clip-` token avoids accidentally picking up a trailing
95
+ * number elsewhere in the id. Returns undefined when no scene token is present.
96
+ */
97
+ export declare function sceneIndexFromClipId(clipId: string | undefined): number | undefined;
88
98
  export interface CriticOptions {
89
99
  llm: LlmCaller;
90
100
  router?: ModelRouter;
@@ -1 +1 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OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAER,IAAI,EAAE,aAAa;IAI1C,MAAM,CACV,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE;QAAE,OAAO,CAAC,EAAE,YAAY,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,CAAA;KAAO,GACtD,OAAO,CAAC,YAAY,CAAC;IAkFxB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,aAAa;CAKtB"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Critic = exports.CriticReportSchema = exports.CriticFindingSchema = exports.CriticSeveritySchema = void 0;
4
+ exports.sceneIndexFromClipId = sceneIndexFromClipId;
4
5
  const zod_1 = require("zod");
5
6
  const modelRouter_1 = require("./modelRouter");
6
7
  const personas_1 = require("./personas");
@@ -31,6 +32,15 @@ exports.CriticFindingSchema = zod_1.z.object({
31
32
  severity: exports.CriticSeveritySchema,
32
33
  /** Which clip / scene the finding refers to, if any. */
33
34
  clipId: zod_1.z.string().optional(),
35
+ /**
36
+ * OD-6 — the scene this finding targets, derived deterministically from
37
+ * `clipId` after the LLM returns (see `sceneIndexFromClipId`). Lets both the
38
+ * inline panel and the full-page review match a finding to a storyboard tile
39
+ * by exact index instead of the fragile `clipId.includes(String(idx))` test
40
+ * (which mismatched "scene-3" against "scene-13"). Absent when the finding is
41
+ * project-wide (e.g. a `costVsTier` budget finding with no clip).
42
+ */
43
+ sceneIndex: zod_1.z.number().int().nonnegative().optional(),
34
44
  message: zod_1.z.string(),
35
45
  /** Optional self-heal hint the executor can act on. */
36
46
  suggestedAction: zod_1.z
@@ -44,6 +54,22 @@ exports.CriticReportSchema = zod_1.z.object({
44
54
  overall: exports.CriticSeveritySchema,
45
55
  findings: zod_1.z.array(exports.CriticFindingSchema),
46
56
  });
57
+ /**
58
+ * OD-6 — derive a scene index from a clip id. The executor and regen core mint
59
+ * clip ids as `scene-<n>-visual` / `scene-<n>-vo` / `scene-<n>-caption` and
60
+ * `clip-<n>` (and the cost-preflight uses bare `scene-<n>`). Matching the
61
+ * leading `scene-`/`clip-` token avoids accidentally picking up a trailing
62
+ * number elsewhere in the id. Returns undefined when no scene token is present.
63
+ */
64
+ function sceneIndexFromClipId(clipId) {
65
+ if (!clipId)
66
+ return undefined;
67
+ const m = /^(?:scene|clip)-(\d+)/.exec(clipId);
68
+ if (!m)
69
+ return undefined;
70
+ const n = Number.parseInt(m[1], 10);
71
+ return Number.isInteger(n) && n >= 0 ? n : undefined;
72
+ }
47
73
  class Critic {
48
74
  constructor(opts) {
49
75
  this.opts = opts;
@@ -114,7 +140,17 @@ class Critic {
114
140
  },
115
141
  ],
116
142
  });
117
- return result.data;
143
+ // OD-6 — stamp each finding with a deterministic sceneIndex parsed from its
144
+ // clipId so the UI matches findings to scenes by exact index. The LLM is
145
+ // not asked to emit sceneIndex (it reliably references clipId), so we derive
146
+ // it here rather than trust a second model-supplied field.
147
+ return {
148
+ ...result.data,
149
+ findings: result.data.findings.map((f) => ({
150
+ ...f,
151
+ sceneIndex: f.sceneIndex ?? sceneIndexFromClipId(f.clipId),
152
+ })),
153
+ };
118
154
  }
119
155
  formatEmphasis(persona) {
120
156
  const emphasis = personas_1.PERSONA_PACKS[persona].criticEmphasis;
@@ -69,8 +69,8 @@ export declare const TextEditSchema: z.ZodObject<{
69
69
  fontSize: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodNumber]>>;
70
70
  sizePct: z.ZodOptional<z.ZodNumber>;
71
71
  weight: z.ZodOptional<z.ZodEnum<{
72
- bold: "bold";
73
72
  regular: "regular";
73
+ bold: "bold";
74
74
  black: "black";
75
75
  medium: "medium";
76
76
  }>>;
@@ -164,8 +164,8 @@ export declare const EditRequestSchema: z.ZodObject<{
164
164
  fontSize: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodNumber]>>;
165
165
  sizePct: z.ZodOptional<z.ZodNumber>;
166
166
  weight: z.ZodOptional<z.ZodEnum<{
167
- bold: "bold";
168
167
  regular: "regular";
168
+ bold: "bold";
169
169
  black: "black";
170
170
  medium: "medium";
171
171
  }>>;
@@ -248,8 +248,8 @@ export declare function classifyCriticFindingsToEdit(args: {
248
248
  userIntentScope?: number[];
249
249
  }): EditRequest | null;
250
250
  /**
251
- * LLM-classifier prompt builder. The caller wires this through any LLMCaller
252
- * with structured-output support (Gateway / OpenAI / Gemini).
251
+ * LLM-classifier prompt builder. The caller wires this through any LlmCaller
252
+ * with structured-output support (Anthropic / OpenAI / Gemini).
253
253
  *
254
254
  * NOTE: we don't ship a default LLM caller here so the module stays
255
255
  * dependency-light — same pattern as planner / bibleBuilder. Tests can mock.
@@ -154,8 +154,8 @@ function classifyCriticFindingsToEdit(args) {
154
154
  };
155
155
  }
156
156
  /**
157
- * LLM-classifier prompt builder. The caller wires this through any LLMCaller
158
- * with structured-output support (Gateway / OpenAI / Gemini).
157
+ * LLM-classifier prompt builder. The caller wires this through any LlmCaller
158
+ * with structured-output support (Anthropic / OpenAI / Gemini).
159
159
  *
160
160
  * NOTE: we don't ship a default LLM caller here so the module stays
161
161
  * dependency-light — same pattern as planner / bibleBuilder. Tests can mock.
@@ -0,0 +1,78 @@
1
+ import { Project } from "../../../schemas/project.schema";
2
+ import { HighlightSegment } from "./editExisting.schema";
3
+ /**
4
+ * Stream L · L-5 — pure assembly helpers for the edit-existing pipeline.
5
+ *
6
+ * Everything here is deterministic + IO-free so it can be unit/eval-tested
7
+ * without spend: segment clamping/ordering, caption-word remapping onto the
8
+ * cut timeline, and building the editable Project JSON (a single video track
9
+ * of source-trim clips, the same primitive the extend-chain layout uses).
10
+ */
11
+ /** Drop kept spans shorter than this (sub-half-second slivers aren't usable cuts). */
12
+ export declare const MIN_SEGMENT_MS = 400;
13
+ /** A caption word on the OUTPUT (cut) timeline, ms from the highlight region start. */
14
+ export interface RemappedCaptionWord {
15
+ word: string;
16
+ start: number;
17
+ end: number;
18
+ }
19
+ /** Word-level ASR input for caption remapping. */
20
+ interface TimedWord {
21
+ text: string;
22
+ start: number;
23
+ end: number;
24
+ }
25
+ /** Total kept duration across segments, ms. */
26
+ export declare function totalSegmentMs(segments: HighlightSegment[]): number;
27
+ /**
28
+ * Clamp segments into [0, sourceDurationMs], sort chronologically, remove
29
+ * overlaps (a later segment that starts before the previous one ended is
30
+ * pushed forward; if that collapses it, it's dropped), and drop slivers below
31
+ * MIN_SEGMENT_MS. Idempotent — safe to run on already-clean input.
32
+ */
33
+ export declare function clampSegments(segments: HighlightSegment[], sourceDurationMs: number): HighlightSegment[];
34
+ /**
35
+ * Remap word timings from the SOURCE timeline onto the concatenated cut
36
+ * timeline (0-based at the start of the first kept segment). Only words that
37
+ * fall inside a kept segment survive; each is clamped to its segment and
38
+ * shifted by the cumulative offset of that segment in the output.
39
+ */
40
+ export declare function remapCaptionWords(words: TimedWord[], segments: HighlightSegment[]): RemappedCaptionWord[];
41
+ /** Width/height of the output frame (probed from the source by the worker). */
42
+ export interface OutputSize {
43
+ width: number;
44
+ height: number;
45
+ }
46
+ /** An optional bumper clip (intro/outro) with its probed duration. */
47
+ export interface BumperClip {
48
+ url: string;
49
+ durationMs: number;
50
+ }
51
+ export interface BuildEditProjectArgs {
52
+ projectId: string;
53
+ agentRunId: string;
54
+ name: string;
55
+ sourceVideoUrl: string;
56
+ /** Already clamped/ordered (run clampSegments first). */
57
+ segments: HighlightSegment[];
58
+ size: OutputSize;
59
+ aspect: "9:16" | "1:1" | "4:5" | "16:9";
60
+ fps?: number;
61
+ /** Caption words ALREADY remapped to the highlight region (0-based). */
62
+ captionWords?: RemappedCaptionWord[];
63
+ captionLanguage?: string;
64
+ intro?: BumperClip;
65
+ outro?: BumperClip;
66
+ /** ISO timestamp; injected so the function stays pure/testable. */
67
+ now: string;
68
+ }
69
+ /**
70
+ * Build an editable Project JSON for the re-edit. The highlight clips reference
71
+ * the ORIGINAL source URL with trims (lossless — the user can re-extend a cut
72
+ * in the editor), intro/outro reference their own URLs, and captions (if any)
73
+ * land on a dedicated track over the highlight region. Validated against
74
+ * ProjectSchema before returning, so the editor + renderer accept it as-is.
75
+ */
76
+ export declare function buildEditProject(args: BuildEditProjectArgs): Project;
77
+ export {};
78
+ //# sourceMappingURL=editAssembler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editAssembler.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/editExisting/editAssembler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAGR,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;;;;GAOG;AAEH,sFAAsF;AACtF,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,uFAAuF;AACvF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,kDAAkD;AAClD,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,+CAA+C;AAC/C,wBAAgB,cAAc,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAEnE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,gBAAgB,EAAE,MAAM,GACvB,gBAAgB,EAAE,CAmBpB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,EAAE,EAClB,QAAQ,EAAE,gBAAgB,EAAE,GAC3B,mBAAmB,EAAE,CAgBvB;AAED,+EAA+E;AAC/E,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,sEAA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