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.
- package/lib/globals/aiModels/enums.d.ts +11 -1
- package/lib/globals/aiModels/enums.d.ts.map +1 -1
- package/lib/globals/aiModels/enums.js +24 -1
- package/lib/globals/aiModels/index.d.ts.map +1 -1
- package/lib/globals/aiModels/index.js +2 -0
- package/lib/globals/aiModels/providers/anthropic.d.ts +12 -0
- package/lib/globals/aiModels/providers/anthropic.d.ts.map +1 -0
- package/lib/globals/aiModels/providers/anthropic.js +88 -0
- package/lib/globals/aiModels/providers/google.d.ts.map +1 -1
- package/lib/globals/aiModels/providers/google.js +115 -10
- package/lib/globals/aiModels/providers/openai.d.ts.map +1 -1
- package/lib/globals/aiModels/providers/openai.js +63 -4
- package/lib/globals/aiModels/tierHelpers.d.ts +12 -0
- package/lib/globals/aiModels/tierHelpers.d.ts.map +1 -1
- package/lib/globals/aiModels/tierHelpers.js +83 -0
- package/lib/globals/aiModels/types.d.ts +19 -0
- package/lib/globals/aiModels/types.d.ts.map +1 -1
- package/lib/globals/types.d.ts +120 -1
- package/lib/globals/types.d.ts.map +1 -1
- package/lib/globals/types.js +135 -1
- package/lib/models/agent.model.d.ts +41 -1
- package/lib/models/agent.model.d.ts.map +1 -1
- package/lib/models/index.d.ts +1 -0
- package/lib/models/index.d.ts.map +1 -1
- package/lib/models/index.js +1 -0
- package/lib/models/social.model.d.ts +180 -0
- package/lib/models/social.model.d.ts.map +1 -0
- package/lib/models/social.model.js +2 -0
- package/lib/models/user.model.d.ts +10 -0
- package/lib/models/user.model.d.ts.map +1 -1
- package/lib/models/video.model.d.ts +6 -0
- package/lib/models/video.model.d.ts.map +1 -1
- package/lib/schemas/brief.schema.d.ts +46 -0
- package/lib/schemas/brief.schema.d.ts.map +1 -1
- package/lib/schemas/brief.schema.js +72 -1
- package/lib/schemas/index.d.ts +1 -0
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +1 -0
- package/lib/schemas/project.schema.d.ts +70 -3
- package/lib/schemas/project.schema.d.ts.map +1 -1
- package/lib/schemas/project.schema.js +12 -0
- package/lib/schemas/social.schema.d.ts +91 -0
- package/lib/schemas/social.schema.d.ts.map +1 -0
- package/lib/schemas/social.schema.js +114 -0
- package/lib/schemas/videoPlan.schema.d.ts +117 -3
- package/lib/schemas/videoPlan.schema.d.ts.map +1 -1
- package/lib/schemas/videoPlan.schema.js +141 -1
- package/lib/services/agent/chatAgent.d.ts +25 -1
- package/lib/services/agent/chatAgent.d.ts.map +1 -1
- package/lib/services/agent/chatAgent.js +145 -9
- package/lib/services/agent/costPreflight.d.ts +11 -1
- package/lib/services/agent/costPreflight.d.ts.map +1 -1
- package/lib/services/agent/costPreflight.js +18 -1
- package/lib/services/agent/covers/coverPlanner.d.ts +41 -0
- package/lib/services/agent/covers/coverPlanner.d.ts.map +1 -0
- package/lib/services/agent/covers/coverPlanner.js +278 -0
- package/lib/services/agent/covers/covers.schema.d.ts +158 -0
- package/lib/services/agent/covers/covers.schema.d.ts.map +1 -0
- package/lib/services/agent/covers/covers.schema.js +166 -0
- package/lib/services/agent/covers/index.d.ts +3 -0
- package/lib/services/agent/covers/index.d.ts.map +1 -0
- package/lib/services/agent/covers/index.js +18 -0
- package/lib/services/agent/critic.d.ts +10 -0
- package/lib/services/agent/critic.d.ts.map +1 -1
- package/lib/services/agent/critic.js +37 -1
- package/lib/services/agent/editClassifier.d.ts +4 -4
- package/lib/services/agent/editClassifier.js +2 -2
- package/lib/services/agent/editExisting/editAssembler.d.ts +78 -0
- package/lib/services/agent/editExisting/editAssembler.d.ts.map +1 -0
- package/lib/services/agent/editExisting/editAssembler.js +172 -0
- package/lib/services/agent/editExisting/editExisting.schema.d.ts +119 -0
- package/lib/services/agent/editExisting/editExisting.schema.d.ts.map +1 -0
- package/lib/services/agent/editExisting/editExisting.schema.js +157 -0
- package/lib/services/agent/editExisting/highlightPicker.d.ts +48 -0
- package/lib/services/agent/editExisting/highlightPicker.d.ts.map +1 -0
- package/lib/services/agent/editExisting/highlightPicker.js +199 -0
- package/lib/services/agent/editExisting/index.d.ts +4 -0
- package/lib/services/agent/editExisting/index.d.ts.map +1 -0
- package/lib/services/agent/editExisting/index.js +19 -0
- package/lib/services/agent/eval/recorder.d.ts +13 -1
- package/lib/services/agent/eval/recorder.d.ts.map +1 -1
- package/lib/services/agent/eval/recorder.js +59 -0
- package/lib/services/agent/eval/seedBriefs.d.ts +4 -3
- package/lib/services/agent/eval/seedBriefs.d.ts.map +1 -1
- package/lib/services/agent/eval/seedBriefs.js +283 -3
- package/lib/services/agent/eval/types.d.ts +10 -0
- package/lib/services/agent/eval/types.d.ts.map +1 -1
- package/lib/services/agent/executor/core.d.ts +70 -0
- package/lib/services/agent/executor/core.d.ts.map +1 -0
- package/lib/services/agent/executor/core.js +250 -0
- package/lib/services/agent/executor/duration.d.ts +20 -0
- package/lib/services/agent/executor/duration.d.ts.map +1 -0
- package/lib/services/agent/executor/duration.js +46 -0
- package/lib/services/agent/executor/index.d.ts +15 -0
- package/lib/services/agent/executor/index.d.ts.map +1 -0
- package/lib/services/agent/executor/index.js +32 -0
- package/lib/services/agent/executor/types.d.ts +183 -0
- package/lib/services/agent/executor/types.d.ts.map +1 -0
- package/lib/services/agent/executor/types.js +29 -0
- package/lib/services/agent/executor/visual.d.ts +32 -0
- package/lib/services/agent/executor/visual.d.ts.map +1 -0
- package/lib/services/agent/executor/visual.js +400 -0
- package/lib/services/agent/executor/voice.d.ts +17 -0
- package/lib/services/agent/executor/voice.d.ts.map +1 -0
- package/lib/services/agent/executor/voice.js +119 -0
- package/lib/services/agent/extendChain.d.ts +101 -0
- package/lib/services/agent/extendChain.d.ts.map +1 -0
- package/lib/services/agent/extendChain.js +177 -0
- package/lib/services/agent/index.d.ts +11 -1
- package/lib/services/agent/index.d.ts.map +1 -1
- package/lib/services/agent/index.js +11 -1
- package/lib/services/agent/llmCaller.d.ts +7 -8
- package/lib/services/agent/llmCaller.d.ts.map +1 -1
- package/lib/services/agent/llmCallerAnthropic.d.ts +44 -31
- package/lib/services/agent/llmCallerAnthropic.d.ts.map +1 -1
- package/lib/services/agent/llmCallerAnthropic.js +135 -60
- package/lib/services/agent/llmCallerFactory.d.ts +34 -0
- package/lib/services/agent/llmCallerFactory.d.ts.map +1 -0
- package/lib/services/agent/llmCallerFactory.js +31 -0
- package/lib/services/agent/llmCallerGemini.d.ts +62 -0
- package/lib/services/agent/llmCallerGemini.d.ts.map +1 -0
- package/lib/services/agent/llmCallerGemini.js +235 -0
- package/lib/services/agent/llmCallerOpenai.d.ts +56 -0
- package/lib/services/agent/llmCallerOpenai.d.ts.map +1 -0
- package/lib/services/agent/llmCallerOpenai.js +230 -0
- package/lib/services/agent/llmCallerRegistry.d.ts.map +1 -1
- package/lib/services/agent/llmCallerRegistry.js +7 -7
- package/lib/services/agent/llmCallerRouting.d.ts +63 -0
- package/lib/services/agent/llmCallerRouting.d.ts.map +1 -0
- package/lib/services/agent/llmCallerRouting.js +124 -0
- package/lib/services/agent/llmModelRegistry.d.ts +59 -0
- package/lib/services/agent/llmModelRegistry.d.ts.map +1 -0
- package/lib/services/agent/llmModelRegistry.js +168 -0
- package/lib/services/agent/llmRetry.d.ts +57 -0
- package/lib/services/agent/llmRetry.d.ts.map +1 -0
- package/lib/services/agent/llmRetry.js +102 -0
- package/lib/services/agent/modelRouter.d.ts +3 -3
- package/lib/services/agent/modelRouter.d.ts.map +1 -1
- package/lib/services/agent/modelRouter.js +27 -13
- package/lib/services/agent/planMutations.d.ts +54 -1
- package/lib/services/agent/planMutations.d.ts.map +1 -1
- package/lib/services/agent/planMutations.js +78 -0
- package/lib/services/agent/planner/Planner.d.ts +0 -17
- package/lib/services/agent/planner/Planner.d.ts.map +1 -1
- package/lib/services/agent/planner/Planner.js +67 -303
- package/lib/services/agent/planner/overlayRegen.d.ts +38 -0
- package/lib/services/agent/planner/overlayRegen.d.ts.map +1 -0
- package/lib/services/agent/planner/overlayRegen.js +145 -0
- package/lib/services/agent/planner/plannerMessages.d.ts +34 -0
- package/lib/services/agent/planner/plannerMessages.d.ts.map +1 -0
- package/lib/services/agent/planner/plannerMessages.js +185 -0
- package/lib/services/agent/planner/promptSections.d.ts +12 -0
- package/lib/services/agent/planner/promptSections.d.ts.map +1 -1
- package/lib/services/agent/planner/promptSections.js +57 -0
- package/lib/services/agent/planner/scriptFirstPlanner.d.ts +35 -0
- package/lib/services/agent/planner/scriptFirstPlanner.d.ts.map +1 -0
- package/lib/services/agent/planner/scriptFirstPlanner.js +140 -0
- package/lib/services/agent/planner/structuralRules.d.ts +10 -0
- package/lib/services/agent/planner/structuralRules.d.ts.map +1 -1
- package/lib/services/agent/planner/structuralRules.js +92 -9
- package/lib/services/agent/planner/validators.d.ts +18 -0
- package/lib/services/agent/planner/validators.d.ts.map +1 -1
- package/lib/services/agent/planner/validators.js +97 -0
- package/lib/services/agent/planner.d.ts +2 -1
- package/lib/services/agent/planner.d.ts.map +1 -1
- package/lib/services/agent/planner.js +5 -1
- package/lib/services/agent/priorProject.d.ts +26 -0
- package/lib/services/agent/priorProject.d.ts.map +1 -0
- package/lib/services/agent/priorProject.js +51 -0
- package/lib/services/agent/providerFallback/chains.d.ts.map +1 -1
- package/lib/services/agent/providerFallback/chains.js +27 -15
- package/lib/services/agent/repurpose/index.d.ts +3 -0
- package/lib/services/agent/repurpose/index.d.ts.map +1 -0
- package/lib/services/agent/repurpose/index.js +18 -0
- package/lib/services/agent/repurpose/repurpose.schema.d.ts +132 -0
- package/lib/services/agent/repurpose/repurpose.schema.d.ts.map +1 -0
- package/lib/services/agent/repurpose/repurpose.schema.js +144 -0
- package/lib/services/agent/repurpose/shortsPicker.d.ts +25 -0
- package/lib/services/agent/repurpose/shortsPicker.d.ts.map +1 -0
- package/lib/services/agent/repurpose/shortsPicker.js +218 -0
- package/lib/services/agent/runHelpers.d.ts +21 -2
- package/lib/services/agent/runHelpers.d.ts.map +1 -1
- package/lib/services/agent/runHelpers.js +71 -2
- package/lib/services/agent/tools/animateImage.tool.d.ts +1 -0
- package/lib/services/agent/tools/animateImage.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/animateImage.tool.js +12 -0
- package/lib/services/agent/tools/chapterOutline.tool.d.ts +42 -0
- package/lib/services/agent/tools/chapterOutline.tool.d.ts.map +1 -0
- package/lib/services/agent/tools/chapterOutline.tool.js +115 -0
- package/lib/services/agent/tools/composeScene.tool.d.ts +65 -2
- package/lib/services/agent/tools/composeScene.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/estimateCost.tool.d.ts +28 -1
- package/lib/services/agent/tools/estimateCost.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/estimateCost.tool.js +55 -7
- package/lib/services/agent/tools/extendVideo.tool.d.ts +26 -0
- package/lib/services/agent/tools/extendVideo.tool.d.ts.map +1 -0
- package/lib/services/agent/tools/extendVideo.tool.js +149 -0
- package/lib/services/agent/tools/generateScript.tool.d.ts +184 -0
- package/lib/services/agent/tools/generateScript.tool.d.ts.map +1 -0
- package/lib/services/agent/tools/generateScript.tool.js +123 -0
- package/lib/services/agent/tools/generateVideo.tool.d.ts +1 -0
- package/lib/services/agent/tools/generateVideo.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/generateVideo.tool.js +20 -1
- package/lib/services/agent/tools/index.d.ts +4 -0
- package/lib/services/agent/tools/index.d.ts.map +1 -1
- package/lib/services/agent/tools/index.js +4 -0
- package/lib/services/agent/tools/matchBrollToScript.tool.d.ts +50 -0
- package/lib/services/agent/tools/matchBrollToScript.tool.d.ts.map +1 -0
- package/lib/services/agent/tools/matchBrollToScript.tool.js +139 -0
- package/lib/services/agent/tools/planVideo.tool.d.ts +57 -1
- package/lib/services/agent/tools/planVideo.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/planVideo.tool.js +3 -3
- package/lib/services/agent/tools/render.tool.d.ts +22 -1
- package/lib/services/agent/tools/render.tool.d.ts.map +1 -1
- package/lib/services/aiGen/aiGenFactory.service.d.ts.map +1 -1
- package/lib/services/aiGen/aiGenFactory.service.js +18 -3
- package/lib/services/aiGen/helpers.d.ts +8 -0
- package/lib/services/aiGen/helpers.d.ts.map +1 -1
- package/lib/services/aiGen/helpers.js +12 -0
- package/lib/services/aiGen/providers/anthropic/anthropic.service.d.ts +26 -0
- package/lib/services/aiGen/providers/anthropic/anthropic.service.d.ts.map +1 -0
- package/lib/services/aiGen/providers/anthropic/anthropic.service.js +95 -0
- package/lib/services/aiGen/providers/google/google.service.d.ts +25 -1
- package/lib/services/aiGen/providers/google/google.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/google/google.service.js +136 -237
- package/lib/services/aiGen/providers/google/googleApiKeys.d.ts +71 -0
- package/lib/services/aiGen/providers/google/googleApiKeys.d.ts.map +1 -0
- package/lib/services/aiGen/providers/google/googleApiKeys.js +137 -0
- package/lib/services/aiGen/providers/google/googleErrors.d.ts +13 -0
- package/lib/services/aiGen/providers/google/googleErrors.d.ts.map +1 -0
- package/lib/services/aiGen/providers/google/googleErrors.js +102 -0
- package/lib/services/aiGen/providers/google/googleFetch.d.ts +8 -0
- package/lib/services/aiGen/providers/google/googleFetch.d.ts.map +1 -0
- package/lib/services/aiGen/providers/google/googleFetch.js +96 -0
- package/lib/services/aiGen/providers/google/googleKeyPool.d.ts +52 -0
- package/lib/services/aiGen/providers/google/googleKeyPool.d.ts.map +1 -0
- package/lib/services/aiGen/providers/google/googleKeyPool.js +129 -0
- package/lib/services/aiGen/providers/google/googleMusic.d.ts +15 -0
- package/lib/services/aiGen/providers/google/googleMusic.d.ts.map +1 -0
- package/lib/services/aiGen/providers/google/googleMusic.js +77 -0
- package/lib/services/aiGen/providers/kling/kling.service.d.ts +7 -3
- package/lib/services/aiGen/providers/kling/kling.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/kling/kling.service.js +23 -367
- package/lib/services/aiGen/providers/kling/klingCredits.d.ts +9 -0
- package/lib/services/aiGen/providers/kling/klingCredits.d.ts.map +1 -0
- package/lib/services/aiGen/providers/kling/klingCredits.js +63 -0
- package/lib/services/aiGen/providers/kling/klingRequests.d.ts +32 -0
- package/lib/services/aiGen/providers/kling/klingRequests.d.ts.map +1 -0
- package/lib/services/aiGen/providers/kling/klingRequests.js +194 -0
- package/lib/services/aiGen/providers/kling/klingStatus.d.ts +16 -0
- package/lib/services/aiGen/providers/kling/klingStatus.d.ts.map +1 -0
- package/lib/services/aiGen/providers/kling/klingStatus.js +173 -0
- package/lib/services/aiGen/providers/pixverse/pixverse.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/pixverse/pixverse.service.js +7 -1
- package/lib/services/bullmq.service.d.ts +61 -0
- package/lib/services/bullmq.service.d.ts.map +1 -1
- package/lib/services/bullmq.service.js +124 -2
- package/lib/services/crypto/index.d.ts +2 -0
- package/lib/services/crypto/index.d.ts.map +1 -0
- package/lib/services/crypto/index.js +17 -0
- package/lib/services/crypto/tokenVault.d.ts +47 -0
- package/lib/services/crypto/tokenVault.d.ts.map +1 -0
- package/lib/services/crypto/tokenVault.js +179 -0
- package/lib/services/editor/captionStyleHint.d.ts +3 -0
- package/lib/services/editor/captionStyleHint.d.ts.map +1 -0
- package/lib/services/editor/captionStyleHint.js +112 -0
- package/lib/services/editor/planToProject.d.ts +7 -66
- package/lib/services/editor/planToProject.d.ts.map +1 -1
- package/lib/services/editor/planToProject.helpers.d.ts +40 -0
- package/lib/services/editor/planToProject.helpers.d.ts.map +1 -0
- package/lib/services/editor/planToProject.helpers.js +177 -0
- package/lib/services/editor/planToProject.js +197 -180
- package/lib/services/editor/planToProject.types.d.ts +94 -0
- package/lib/services/editor/planToProject.types.d.ts.map +1 -0
- package/lib/services/editor/planToProject.types.js +2 -0
- package/lib/services/firestore.service.d.ts +5 -0
- package/lib/services/firestore.service.d.ts.map +1 -1
- package/lib/services/firestore.service.js +13 -0
- package/lib/services/index.d.ts +13 -0
- package/lib/services/index.d.ts.map +1 -1
- package/lib/services/index.js +13 -0
- package/lib/services/promptEnhancer/index.d.ts +18 -0
- package/lib/services/promptEnhancer/index.d.ts.map +1 -0
- package/lib/services/promptEnhancer/index.js +33 -0
- package/lib/services/promptEnhancer/models.d.ts +54 -0
- package/lib/services/promptEnhancer/models.d.ts.map +1 -0
- package/lib/services/promptEnhancer/models.js +37 -0
- package/lib/services/promptEnhancer/profiles/agent.profile.d.ts +14 -0
- package/lib/services/promptEnhancer/profiles/agent.profile.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/agent.profile.js +40 -0
- package/lib/services/promptEnhancer/profiles/avatar.profile.d.ts +13 -0
- package/lib/services/promptEnhancer/profiles/avatar.profile.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/avatar.profile.js +40 -0
- package/lib/services/promptEnhancer/profiles/base.d.ts +28 -0
- package/lib/services/promptEnhancer/profiles/base.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/base.js +35 -0
- package/lib/services/promptEnhancer/profiles/image.profile.d.ts +11 -0
- package/lib/services/promptEnhancer/profiles/image.profile.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/image.profile.js +42 -0
- package/lib/services/promptEnhancer/profiles/index.d.ts +12 -0
- package/lib/services/promptEnhancer/profiles/index.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/index.js +33 -0
- package/lib/services/promptEnhancer/profiles/video.profile.d.ts +15 -0
- package/lib/services/promptEnhancer/profiles/video.profile.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/video.profile.js +81 -0
- package/lib/services/promptEnhancer/promptEnhancer.service.d.ts +45 -0
- package/lib/services/promptEnhancer/promptEnhancer.service.d.ts.map +1 -0
- package/lib/services/promptEnhancer/promptEnhancer.service.js +157 -0
- package/lib/services/promptEnhancer/schema.d.ts +19 -0
- package/lib/services/promptEnhancer/schema.d.ts.map +1 -0
- package/lib/services/promptEnhancer/schema.js +43 -0
- package/lib/services/promptEnhancer/types.d.ts +112 -0
- package/lib/services/promptEnhancer/types.d.ts.map +1 -0
- package/lib/services/promptEnhancer/types.js +2 -0
- package/lib/services/rateLimiter/distributedRateLimiter.service.d.ts +60 -5
- package/lib/services/rateLimiter/distributedRateLimiter.service.d.ts.map +1 -1
- package/lib/services/rateLimiter/distributedRateLimiter.service.js +184 -16
- package/lib/services/socialAI/captionGen.d.ts +81 -0
- package/lib/services/socialAI/captionGen.d.ts.map +1 -0
- package/lib/services/socialAI/captionGen.js +206 -0
- package/lib/services/socialAI/hookScore.d.ts +85 -0
- package/lib/services/socialAI/hookScore.d.ts.map +1 -0
- package/lib/services/socialAI/hookScore.js +170 -0
- package/lib/services/socialAI/index.d.ts +3 -0
- package/lib/services/socialAI/index.d.ts.map +1 -0
- package/lib/services/socialAI/index.js +18 -0
- package/lib/services/socialAccounts/index.d.ts +2 -0
- package/lib/services/socialAccounts/index.d.ts.map +1 -0
- package/lib/services/socialAccounts/index.js +17 -0
- package/lib/services/socialAccounts/socialAccountService.d.ts +25 -0
- package/lib/services/socialAccounts/socialAccountService.d.ts.map +1 -0
- package/lib/services/socialAccounts/socialAccountService.js +105 -0
- package/lib/services/socialEngage/factory.d.ts +7 -0
- package/lib/services/socialEngage/factory.d.ts.map +1 -0
- package/lib/services/socialEngage/factory.js +25 -0
- package/lib/services/socialEngage/index.d.ts +6 -0
- package/lib/services/socialEngage/index.d.ts.map +1 -0
- package/lib/services/socialEngage/index.js +21 -0
- package/lib/services/socialEngage/meta.engage.d.ts +17 -0
- package/lib/services/socialEngage/meta.engage.d.ts.map +1 -0
- package/lib/services/socialEngage/meta.engage.js +128 -0
- package/lib/services/socialEngage/metaWebhook.d.ts +50 -0
- package/lib/services/socialEngage/metaWebhook.d.ts.map +1 -0
- package/lib/services/socialEngage/metaWebhook.js +93 -0
- package/lib/services/socialEngage/types.d.ts +72 -0
- package/lib/services/socialEngage/types.d.ts.map +1 -0
- package/lib/services/socialEngage/types.js +10 -0
- package/lib/services/socialEngage/youtube.engage.d.ts +9 -0
- package/lib/services/socialEngage/youtube.engage.d.ts.map +1 -0
- package/lib/services/socialEngage/youtube.engage.js +87 -0
- package/lib/services/socialFormat/aspectGeometry.d.ts +74 -0
- package/lib/services/socialFormat/aspectGeometry.d.ts.map +1 -0
- package/lib/services/socialFormat/aspectGeometry.js +135 -0
- package/lib/services/socialFormat/index.d.ts +2 -0
- package/lib/services/socialFormat/index.d.ts.map +1 -0
- package/lib/services/socialFormat/index.js +19 -0
- package/lib/services/socialInsights/index.d.ts +3 -0
- package/lib/services/socialInsights/index.d.ts.map +1 -0
- package/lib/services/socialInsights/index.js +18 -0
- package/lib/services/socialInsights/recommendations.d.ts +131 -0
- package/lib/services/socialInsights/recommendations.d.ts.map +1 -0
- package/lib/services/socialInsights/recommendations.js +277 -0
- package/lib/services/socialInsights/timeBuckets.d.ts +35 -0
- package/lib/services/socialInsights/timeBuckets.d.ts.map +1 -0
- package/lib/services/socialInsights/timeBuckets.js +78 -0
- package/lib/services/socialMetrics/factory.d.ts +5 -0
- package/lib/services/socialMetrics/factory.d.ts.map +1 -0
- package/lib/services/socialMetrics/factory.js +24 -0
- package/lib/services/socialMetrics/index.d.ts +6 -0
- package/lib/services/socialMetrics/index.d.ts.map +1 -0
- package/lib/services/socialMetrics/index.js +21 -0
- package/lib/services/socialMetrics/meta.metrics.d.ts +22 -0
- package/lib/services/socialMetrics/meta.metrics.d.ts.map +1 -0
- package/lib/services/socialMetrics/meta.metrics.js +137 -0
- package/lib/services/socialMetrics/tiktok.metrics.d.ts +8 -0
- package/lib/services/socialMetrics/tiktok.metrics.d.ts.map +1 -0
- package/lib/services/socialMetrics/tiktok.metrics.js +43 -0
- package/lib/services/socialMetrics/types.d.ts +54 -0
- package/lib/services/socialMetrics/types.d.ts.map +1 -0
- package/lib/services/socialMetrics/types.js +2 -0
- package/lib/services/socialMetrics/youtube.metrics.d.ts +8 -0
- package/lib/services/socialMetrics/youtube.metrics.d.ts.map +1 -0
- package/lib/services/socialMetrics/youtube.metrics.js +43 -0
- package/lib/services/socialOAuth/factory.d.ts +7 -0
- package/lib/services/socialOAuth/factory.d.ts.map +1 -0
- package/lib/services/socialOAuth/factory.js +42 -0
- package/lib/services/socialOAuth/index.d.ts +11 -0
- package/lib/services/socialOAuth/index.d.ts.map +1 -0
- package/lib/services/socialOAuth/index.js +26 -0
- package/lib/services/socialOAuth/linkedin.oauth.d.ts +14 -0
- package/lib/services/socialOAuth/linkedin.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/linkedin.oauth.js +127 -0
- package/lib/services/socialOAuth/meta.oauth.d.ts +31 -0
- package/lib/services/socialOAuth/meta.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/meta.oauth.js +214 -0
- package/lib/services/socialOAuth/oauthState.d.ts +14 -0
- package/lib/services/socialOAuth/oauthState.d.ts.map +1 -0
- package/lib/services/socialOAuth/oauthState.js +66 -0
- package/lib/services/socialOAuth/pinterest.oauth.d.ts +15 -0
- package/lib/services/socialOAuth/pinterest.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/pinterest.oauth.js +126 -0
- package/lib/services/socialOAuth/threads.oauth.d.ts +14 -0
- package/lib/services/socialOAuth/threads.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/threads.oauth.js +129 -0
- package/lib/services/socialOAuth/tiktok.oauth.d.ts +15 -0
- package/lib/services/socialOAuth/tiktok.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/tiktok.oauth.js +151 -0
- package/lib/services/socialOAuth/types.d.ts +67 -0
- package/lib/services/socialOAuth/types.d.ts.map +1 -0
- package/lib/services/socialOAuth/types.js +2 -0
- package/lib/services/socialOAuth/x.oauth.d.ts +17 -0
- package/lib/services/socialOAuth/x.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/x.oauth.js +134 -0
- package/lib/services/socialOAuth/youtube.oauth.d.ts +15 -0
- package/lib/services/socialOAuth/youtube.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/youtube.oauth.js +156 -0
- package/lib/services/socialPublish/factory.d.ts +5 -0
- package/lib/services/socialPublish/factory.d.ts.map +1 -0
- package/lib/services/socialPublish/factory.js +32 -0
- package/lib/services/socialPublish/index.d.ts +10 -0
- package/lib/services/socialPublish/index.d.ts.map +1 -0
- package/lib/services/socialPublish/index.js +25 -0
- package/lib/services/socialPublish/linkedin.publish.d.ts +9 -0
- package/lib/services/socialPublish/linkedin.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/linkedin.publish.js +143 -0
- package/lib/services/socialPublish/meta.publish.d.ts +28 -0
- package/lib/services/socialPublish/meta.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/meta.publish.js +149 -0
- package/lib/services/socialPublish/pinterest.publish.d.ts +13 -0
- package/lib/services/socialPublish/pinterest.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/pinterest.publish.js +130 -0
- package/lib/services/socialPublish/threads.publish.d.ts +12 -0
- package/lib/services/socialPublish/threads.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/threads.publish.js +96 -0
- package/lib/services/socialPublish/tiktok.publish.d.ts +13 -0
- package/lib/services/socialPublish/tiktok.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/tiktok.publish.js +118 -0
- package/lib/services/socialPublish/types.d.ts +47 -0
- package/lib/services/socialPublish/types.d.ts.map +1 -0
- package/lib/services/socialPublish/types.js +2 -0
- package/lib/services/socialPublish/x.publish.d.ts +12 -0
- package/lib/services/socialPublish/x.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/x.publish.js +147 -0
- package/lib/services/socialPublish/youtube.publish.d.ts +9 -0
- package/lib/services/socialPublish/youtube.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/youtube.publish.js +107 -0
- package/lib/services/stock/index.d.ts +2 -0
- package/lib/services/stock/index.d.ts.map +1 -0
- package/lib/services/stock/index.js +17 -0
- package/lib/services/stock/realPersonSafety.d.ts +99 -0
- package/lib/services/stock/realPersonSafety.d.ts.map +1 -0
- package/lib/services/stock/realPersonSafety.js +248 -0
- package/lib/services/translation/index.d.ts +2 -0
- package/lib/services/translation/index.d.ts.map +1 -0
- package/lib/services/translation/index.js +9 -0
- package/lib/services/translation/translation.service.d.ts +50 -0
- package/lib/services/translation/translation.service.d.ts.map +1 -0
- package/lib/services/translation/translation.service.js +211 -0
- package/lib/utils/helpers.d.ts +2 -4
- package/lib/utils/helpers.d.ts.map +1 -1
- package/lib/utils/helpers.js +9 -63
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/renderTier.d.ts +26 -0
- package/lib/utils/renderTier.d.ts.map +1 -0
- package/lib/utils/renderTier.js +34 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Project } from "../../schemas/project.schema";
|
|
1
|
+
import type { Clip, Project } from "../../schemas/project.schema";
|
|
2
|
+
import type { RegenComponent } from "../credits/pricing";
|
|
2
3
|
/**
|
|
3
4
|
* planMutations — Stage 7-prep helper for the agent permission flow.
|
|
4
5
|
*
|
|
@@ -43,4 +44,56 @@ export declare function findClipsNeedingPermission(currentProject: Project | nul
|
|
|
43
44
|
* straight through.
|
|
44
45
|
*/
|
|
45
46
|
export declare function requiresUserConfirmation(currentProject: Project | null | undefined): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Stage 7 (lock enforcement) — the clips from `currentProject` that a
|
|
49
|
+
* regeneration must NOT overwrite: every protected clip (locked or
|
|
50
|
+
* user-placed) whose id the user did NOT explicitly approve to mutate.
|
|
51
|
+
*
|
|
52
|
+
* `allowedMutations` is the set of clip ids the user OK'd in the
|
|
53
|
+
* confirmation modal (echoed back through /execute-confirmed → the run
|
|
54
|
+
* doc → the job payload). A protected clip absent from that set is frozen:
|
|
55
|
+
* planToProject reuses it verbatim instead of rebuilding it from
|
|
56
|
+
* plan+outcome, because the user's edits (trim, volume, text, position)
|
|
57
|
+
* live only on the clip object — they're nowhere in the plan, so a rebuild
|
|
58
|
+
* would silently discard them.
|
|
59
|
+
*
|
|
60
|
+
* Returns `[]` when there's no prior project (first run on an empty canvas)
|
|
61
|
+
* or nothing is protected — the common path, a clean no-op.
|
|
62
|
+
*/
|
|
63
|
+
export declare function computePreservedClips(currentProject: Project | null | undefined, allowedMutations?: readonly string[]): Clip[];
|
|
64
|
+
/** Per-scene sets of asset kinds whose generation can be skipped on regen. */
|
|
65
|
+
export interface FrozenScenes {
|
|
66
|
+
/** Scene indices whose visual clip(s) are preserved — skip provider gen. */
|
|
67
|
+
visual: Set<number>;
|
|
68
|
+
/** Scene indices whose voiceover clip is preserved — skip TTS. */
|
|
69
|
+
voiceover: Set<number>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Gap #1 follow-up (skip-generation) — derive, from the preserved clips, which
|
|
73
|
+
* scenes don't need their assets regenerated at all. A preserved visual means
|
|
74
|
+
* the user froze that scene's footage, so re-running the (expensive) provider
|
|
75
|
+
* gen just to discard the result is pure waste; same for a preserved VO and
|
|
76
|
+
* the TTS call. The executor consults these sets to short-circuit the tool
|
|
77
|
+
* dispatch, and planToProject uses `visual` to skip building a placeholder twin
|
|
78
|
+
* (the real preserved clip is injected verbatim instead).
|
|
79
|
+
*
|
|
80
|
+
* Keyed off the deterministic clip-id contract so it stays in lockstep with the
|
|
81
|
+
* ids planToProject emits (and the ids the preserve-override matches on).
|
|
82
|
+
*/
|
|
83
|
+
/**
|
|
84
|
+
* Gap #5 (diff-based bulk regen, lock-safety) — true if a regen target would
|
|
85
|
+
* overwrite a frozen (locked / user-edited) scene asset, so callers can drop it
|
|
86
|
+
* before charging or executing. The bulk diff (`diffPlans`) is plan-field based
|
|
87
|
+
* and lock-blind: a re-plan that rewrote a locked scene's prompt would emit a
|
|
88
|
+
* `visual` target for it, and running that would clobber the footage the user
|
|
89
|
+
* deliberately froze in the editor. Visual targets are gated by `frozen.visual`;
|
|
90
|
+
* voiceover AND captions by `frozen.voiceover` (captions are derived from the VO
|
|
91
|
+
* audio, so a locked VO keeps its captions too). Overlays/music aren't tracked
|
|
92
|
+
* by the frozen-scene model (they're separate clips), so they pass through.
|
|
93
|
+
*/
|
|
94
|
+
export declare function isRegenTargetFrozen(target: {
|
|
95
|
+
component: RegenComponent;
|
|
96
|
+
sceneIndex?: number;
|
|
97
|
+
}, frozen: FrozenScenes): boolean;
|
|
98
|
+
export declare function computeFrozenScenes(preserveClips: readonly Clip[]): FrozenScenes;
|
|
46
99
|
//# sourceMappingURL=planMutations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planMutations.d.ts","sourceRoot":"","sources":["../../../src/services/agent/planMutations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"planMutations.d.ts","sourceRoot":"","sources":["../../../src/services/agent/planMutations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD;;;;;;;;;;;;;;;;GAgBG;AAEH,uFAAuF;AACvF,eAAO,MAAM,8BAA8B,EAAE,WAAW,CAAC,MAAM,CAG7D,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,aAAa,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,qFAAqF;IACrF,QAAQ,EAAE,QAAQ,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;IAC5E,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,MAAM,EAAE,cAAc,CAAC;IACvB,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAyDD;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,GACzC,gBAAgB,EAAE,CAgBpB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,cAAc,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,GACzC,OAAO,CAET;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,EAC1C,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,GACnC,IAAI,EAAE,CAMR;AAQD,8EAA8E;AAC9E,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,kEAAkE;IAClE,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACxB;AAED;;;;;;;;;;;GAWG;AACH;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE;IAAE,SAAS,EAAE,cAAc,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1D,MAAM,EAAE,YAAY,GACnB,OAAO,CAOT;AAED,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,SAAS,IAAI,EAAE,GAAG,YAAY,CAahF"}
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.USER_PLACED_PROVENANCE_SOURCES = void 0;
|
|
4
4
|
exports.findClipsNeedingPermission = findClipsNeedingPermission;
|
|
5
5
|
exports.requiresUserConfirmation = requiresUserConfirmation;
|
|
6
|
+
exports.computePreservedClips = computePreservedClips;
|
|
7
|
+
exports.isRegenTargetFrozen = isRegenTargetFrozen;
|
|
8
|
+
exports.computeFrozenScenes = computeFrozenScenes;
|
|
6
9
|
const planToProject_1 = require("../editor/planToProject");
|
|
7
10
|
/**
|
|
8
11
|
* planMutations — Stage 7-prep helper for the agent permission flow.
|
|
@@ -118,3 +121,78 @@ function findClipsNeedingPermission(currentProject) {
|
|
|
118
121
|
function requiresUserConfirmation(currentProject) {
|
|
119
122
|
return findClipsNeedingPermission(currentProject).length > 0;
|
|
120
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Stage 7 (lock enforcement) — the clips from `currentProject` that a
|
|
126
|
+
* regeneration must NOT overwrite: every protected clip (locked or
|
|
127
|
+
* user-placed) whose id the user did NOT explicitly approve to mutate.
|
|
128
|
+
*
|
|
129
|
+
* `allowedMutations` is the set of clip ids the user OK'd in the
|
|
130
|
+
* confirmation modal (echoed back through /execute-confirmed → the run
|
|
131
|
+
* doc → the job payload). A protected clip absent from that set is frozen:
|
|
132
|
+
* planToProject reuses it verbatim instead of rebuilding it from
|
|
133
|
+
* plan+outcome, because the user's edits (trim, volume, text, position)
|
|
134
|
+
* live only on the clip object — they're nowhere in the plan, so a rebuild
|
|
135
|
+
* would silently discard them.
|
|
136
|
+
*
|
|
137
|
+
* Returns `[]` when there's no prior project (first run on an empty canvas)
|
|
138
|
+
* or nothing is protected — the common path, a clean no-op.
|
|
139
|
+
*/
|
|
140
|
+
function computePreservedClips(currentProject, allowedMutations) {
|
|
141
|
+
if (!currentProject)
|
|
142
|
+
return [];
|
|
143
|
+
const approved = new Set(allowedMutations ?? []);
|
|
144
|
+
return currentProject.clips.filter((clip) => isProtected(clip) !== null && !approved.has(clip.id));
|
|
145
|
+
}
|
|
146
|
+
// Deterministic clip-id shapes emitted by planToProject. A frozen visual can
|
|
147
|
+
// be a single clip (`scene-3-visual`) or an extend-chain (`scene-3-visual-0`,
|
|
148
|
+
// `-1`, …); both map back to the same scene. VO is always a single clip.
|
|
149
|
+
const VISUAL_CLIP_ID_RE = /^scene-(\d+)-visual(?:-\d+)?$/;
|
|
150
|
+
const VOICEOVER_CLIP_ID_RE = /^scene-(\d+)-vo$/;
|
|
151
|
+
/**
|
|
152
|
+
* Gap #1 follow-up (skip-generation) — derive, from the preserved clips, which
|
|
153
|
+
* scenes don't need their assets regenerated at all. A preserved visual means
|
|
154
|
+
* the user froze that scene's footage, so re-running the (expensive) provider
|
|
155
|
+
* gen just to discard the result is pure waste; same for a preserved VO and
|
|
156
|
+
* the TTS call. The executor consults these sets to short-circuit the tool
|
|
157
|
+
* dispatch, and planToProject uses `visual` to skip building a placeholder twin
|
|
158
|
+
* (the real preserved clip is injected verbatim instead).
|
|
159
|
+
*
|
|
160
|
+
* Keyed off the deterministic clip-id contract so it stays in lockstep with the
|
|
161
|
+
* ids planToProject emits (and the ids the preserve-override matches on).
|
|
162
|
+
*/
|
|
163
|
+
/**
|
|
164
|
+
* Gap #5 (diff-based bulk regen, lock-safety) — true if a regen target would
|
|
165
|
+
* overwrite a frozen (locked / user-edited) scene asset, so callers can drop it
|
|
166
|
+
* before charging or executing. The bulk diff (`diffPlans`) is plan-field based
|
|
167
|
+
* and lock-blind: a re-plan that rewrote a locked scene's prompt would emit a
|
|
168
|
+
* `visual` target for it, and running that would clobber the footage the user
|
|
169
|
+
* deliberately froze in the editor. Visual targets are gated by `frozen.visual`;
|
|
170
|
+
* voiceover AND captions by `frozen.voiceover` (captions are derived from the VO
|
|
171
|
+
* audio, so a locked VO keeps its captions too). Overlays/music aren't tracked
|
|
172
|
+
* by the frozen-scene model (they're separate clips), so they pass through.
|
|
173
|
+
*/
|
|
174
|
+
function isRegenTargetFrozen(target, frozen) {
|
|
175
|
+
if (typeof target.sceneIndex !== "number")
|
|
176
|
+
return false;
|
|
177
|
+
if (target.component === "visual")
|
|
178
|
+
return frozen.visual.has(target.sceneIndex);
|
|
179
|
+
if (target.component === "voiceover" || target.component === "captions") {
|
|
180
|
+
return frozen.voiceover.has(target.sceneIndex);
|
|
181
|
+
}
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
function computeFrozenScenes(preserveClips) {
|
|
185
|
+
const visual = new Set();
|
|
186
|
+
const voiceover = new Set();
|
|
187
|
+
for (const clip of preserveClips) {
|
|
188
|
+
const v = VISUAL_CLIP_ID_RE.exec(clip.id);
|
|
189
|
+
if (v) {
|
|
190
|
+
visual.add(Number(v[1]));
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
const vo = VOICEOVER_CLIP_ID_RE.exec(clip.id);
|
|
194
|
+
if (vo)
|
|
195
|
+
voiceover.add(Number(vo[1]));
|
|
196
|
+
}
|
|
197
|
+
return { visual, voiceover };
|
|
198
|
+
}
|
|
@@ -86,22 +86,5 @@ export declare class Planner {
|
|
|
86
86
|
/** Free-form caller hint, e.g. "punchier CTA" or "drop the watermark". */
|
|
87
87
|
instruction?: string;
|
|
88
88
|
}): Promise<TextOverlay[]>;
|
|
89
|
-
private buildMessages;
|
|
90
89
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Heuristic — does the brief mention real-world entities that benefit from
|
|
93
|
-
* web grounding? A planner without research will happily invent fake app
|
|
94
|
-
* names, fabricate statistics, and miss real-world brand details. Triggers
|
|
95
|
-
* when the brief contains:
|
|
96
|
-
* - explicit "top N / best / popular / list of" framings
|
|
97
|
-
* - proper-noun-heavy briefs (≥2 capitalized non-sentence-start words)
|
|
98
|
-
* - listicle/comparison/news/review keywords
|
|
99
|
-
* - explicit time markers ("2026", "latest", "this year", "recent")
|
|
100
|
-
* - statistics signals ("statistics", "data", "percent", "study")
|
|
101
|
-
*
|
|
102
|
-
* Deliberately conservative — false negatives are fine (we just skip the
|
|
103
|
-
* search), false positives waste $0.01 per planner call. Override via
|
|
104
|
-
* `useWebResearch: true|false` when the caller knows better.
|
|
105
|
-
*/
|
|
106
|
-
export declare function briefNeedsWebResearch(brief: VideoBrief): boolean;
|
|
107
90
|
//# sourceMappingURL=Planner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Planner.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/planner/Planner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Planner.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/planner/Planner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAoB,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,SAAS,EAEV,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAkB7C;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,SAAS,CAAC;IACf,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,OAAO;IAIN,OAAO,CAAC,QAAQ,CAAC,IAAI;IAHjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAEP,IAAI,EAAE,cAAc;IAK3C,IAAI,CACR,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE;QACJ,OAAO,CAAC,EAAE,YAAY,CAAC;QACvB,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;QACjC,WAAW,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;QACvC,KAAK,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;QAChC;;;;;;WAMG;QACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;KAC9B,GACL,OAAO,CAAC,SAAS,CAAC;IAyQrB;;;;;;;;;;;OAWG;IACH,UAAU,CACR,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE;QACJ,OAAO,CAAC,EAAE,YAAY,CAAC;QACvB,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;QACjC,WAAW,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;QACvC,KAAK,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;KAC5B,GACL;QAAE,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;KAAE;IAqEhE;;;;;;;;;;;;;;;;OAgBG;IACG,0BAA0B,CAC9B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE;QACJ,OAAO,CAAC,EAAE,YAAY,CAAC;QACvB,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;QACjC,KAAK,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;QAChC,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,0EAA0E;QAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;KACjB,GACL,OAAO,CAAC,WAAW,EAAE,CAAC;CAQ1B"}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Planner = void 0;
|
|
4
|
-
|
|
5
|
-
const zod_1 = require("zod");
|
|
4
|
+
const brief_schema_1 = require("../../../schemas/brief.schema");
|
|
6
5
|
const videoPlan_schema_1 = require("../../../schemas/videoPlan.schema");
|
|
7
6
|
const llmCallerAnthropic_1 = require("../llmCallerAnthropic");
|
|
8
7
|
const llmCallerRegistry_1 = require("../llmCallerRegistry");
|
|
9
8
|
const modelRouter_1 = require("../modelRouter");
|
|
10
|
-
const
|
|
11
|
-
const modelQualityNotes_1 = require("../modelQualityNotes");
|
|
12
|
-
const promptSections_1 = require("./promptSections");
|
|
13
|
-
const structuralRules_1 = require("./structuralRules");
|
|
9
|
+
const scriptFirstPlanner_1 = require("./scriptFirstPlanner");
|
|
14
10
|
const repair_1 = require("./repair");
|
|
15
11
|
const overlaySanity_1 = require("./overlaySanity");
|
|
16
12
|
const costPreflight_1 = require("../costPreflight");
|
|
17
13
|
const validators_1 = require("./validators");
|
|
14
|
+
const plannerMessages_1 = require("./plannerMessages");
|
|
15
|
+
const overlayRegen_1 = require("./overlayRegen");
|
|
18
16
|
class Planner {
|
|
19
17
|
constructor(opts) {
|
|
20
18
|
this.opts = opts;
|
|
@@ -22,16 +20,27 @@ class Planner {
|
|
|
22
20
|
this.maxRetries = opts.maxRetries ?? 2;
|
|
23
21
|
}
|
|
24
22
|
async plan(brief, opts = {}) {
|
|
23
|
+
// Stream L (L-3): long-form (L1/L2) uses script-first authoring (full
|
|
24
|
+
// narration → chapters → B-roll scenes) rather than the single-call
|
|
25
|
+
// scene-first planner below, which drifts on multi-minute videos. The
|
|
26
|
+
// assembled plan satisfies the L-2 chapter contract by construction.
|
|
27
|
+
const lengthTier = brief.lengthTier ?? (0, brief_schema_1.deriveLengthTier)(brief.durationSec);
|
|
28
|
+
if (lengthTier === "L1" || lengthTier === "L2") {
|
|
29
|
+
return (0, scriptFirstPlanner_1.planScriptFirst)({ llm: this.opts.llm }, brief, {
|
|
30
|
+
persona: opts.persona,
|
|
31
|
+
bible: opts.bible ?? null,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
25
34
|
const model = this.router.pickFor("planner", {
|
|
26
35
|
premium: brief.tierBudget === "T3",
|
|
27
36
|
});
|
|
28
37
|
const fallbackModel = this.router.fallbackFor("planner");
|
|
29
38
|
// Resolve research flag. We only use research when the Anthropic caller
|
|
30
39
|
// is wired AND the brief implies real-world subjects — otherwise the
|
|
31
|
-
//
|
|
40
|
+
// normal dispatcher path (no server-side web_search) is used.
|
|
32
41
|
const anthropic = (0, llmCallerRegistry_1.getAnthropicCaller)();
|
|
33
42
|
const wantsResearch = opts.useWebResearch === true ||
|
|
34
|
-
(opts.useWebResearch !== false && briefNeedsWebResearch(brief));
|
|
43
|
+
(opts.useWebResearch !== false && (0, plannerMessages_1.briefNeedsWebResearch)(brief));
|
|
35
44
|
let useResearchCall = wantsResearch &&
|
|
36
45
|
anthropic !== null &&
|
|
37
46
|
typeof anthropic.structuredWithTools === "function" &&
|
|
@@ -45,7 +54,7 @@ class Planner {
|
|
|
45
54
|
const thinkingBudget = premium ? 4096 : undefined;
|
|
46
55
|
let lastErrors;
|
|
47
56
|
for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
|
|
48
|
-
const messages =
|
|
57
|
+
const messages = (0, plannerMessages_1.buildPlannerMessages)(brief, opts.persona, opts.brandKit ?? null, opts.styleMemory ?? null, opts.bible ?? null, lastErrors, useResearchCall);
|
|
49
58
|
let result;
|
|
50
59
|
try {
|
|
51
60
|
if (useResearchCall && anthropic?.structuredWithTools) {
|
|
@@ -54,9 +63,10 @@ class Planner {
|
|
|
54
63
|
// - `cachePrompt`: 90% discount on cache hits — every retry within
|
|
55
64
|
// 5 minutes pays ~10% of the system + tools tokens.
|
|
56
65
|
// - `thinking`: enabled on T3 premium briefs only.
|
|
57
|
-
// - Transient Anthropic errors fall through to the
|
|
58
|
-
// below via the catch — better to ship a
|
|
59
|
-
// than to 500 the whole /plan endpoint on an
|
|
66
|
+
// - Transient Anthropic errors fall through to the non-research
|
|
67
|
+
// dispatcher path below via the catch — better to ship a
|
|
68
|
+
// non-researched plan than to 500 the whole /plan endpoint on an
|
|
69
|
+
// outage.
|
|
60
70
|
try {
|
|
61
71
|
result = await anthropic.structuredWithTools({
|
|
62
72
|
model,
|
|
@@ -77,7 +87,7 @@ class Planner {
|
|
|
77
87
|
// subsequent attempts. The plan we produce won't be grounded,
|
|
78
88
|
// but it'll exist — and the warning flag tells the UI.
|
|
79
89
|
useResearchCall = false;
|
|
80
|
-
const fallbackMessages =
|
|
90
|
+
const fallbackMessages = (0, plannerMessages_1.buildPlannerMessages)(brief, opts.persona, opts.brandKit ?? null, opts.styleMemory ?? null, opts.bible ?? null, lastErrors, false);
|
|
81
91
|
result = await this.opts.llm.structured({
|
|
82
92
|
model,
|
|
83
93
|
fallbackModel,
|
|
@@ -104,8 +114,8 @@ class Planner {
|
|
|
104
114
|
}
|
|
105
115
|
}
|
|
106
116
|
catch (e) {
|
|
107
|
-
// AG-25: the
|
|
108
|
-
// catch the planner's correction-retry loop never fires — a single
|
|
117
|
+
// AG-25: the LlmCaller throws on schema-validation failures. Without
|
|
118
|
+
// this catch the planner's correction-retry loop never fires — a single
|
|
109
119
|
// sub-1ms scene duration from the LLM would crash the whole agent.
|
|
110
120
|
// Capture the error as correction context and let the loop retry.
|
|
111
121
|
const msg = e instanceof Error ? e.message : String(e);
|
|
@@ -183,6 +193,31 @@ class Planner {
|
|
|
183
193
|
lastErrors = narrationGap;
|
|
184
194
|
continue;
|
|
185
195
|
}
|
|
196
|
+
// Stream L (L-2): chapter contract for L1/L2 long-form plans — chapters
|
|
197
|
+
// MUST partition the scene list exactly. Downgrade-on-last-attempt
|
|
198
|
+
// (like ttsGap): chapters aren't render-breaking (the schema field is
|
|
199
|
+
// optional and the render path ignores it for now), so ship without
|
|
200
|
+
// them rather than throw away an otherwise-valid long-form plan.
|
|
201
|
+
const chapterGap = (0, validators_1.checkChapterContract)(reparsed.data, brief);
|
|
202
|
+
if (chapterGap && attempt < this.maxRetries) {
|
|
203
|
+
lastErrors = chapterGap;
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
// Stream L (L-6): hard spend cap. If brief.maxSpendUSD is set and the
|
|
207
|
+
// plan's estimated generation cost is over it, re-prompt for cheaper
|
|
208
|
+
// tiers / stock / fewer scenes. Hard-reject (no downgrade) — shipping
|
|
209
|
+
// an over-budget plan would spend past the user's explicit cap.
|
|
210
|
+
const budgetGap = (0, validators_1.checkBudgetContract)(reparsed.data, brief);
|
|
211
|
+
if (budgetGap) {
|
|
212
|
+
lastErrors = budgetGap;
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
// Stream L (L-1): stamp the effective length tier so downstream
|
|
216
|
+
// consumers (cost guardrails L-6, editor chapter UI) don't re-derive
|
|
217
|
+
// it. Trust brief.lengthTier when set; otherwise derive from duration.
|
|
218
|
+
// Don't trust the LLM to fill it — overlay deterministically.
|
|
219
|
+
reparsed.data.lengthTier =
|
|
220
|
+
brief.lengthTier ?? (0, brief_schema_1.deriveLengthTier)(brief.durationSec);
|
|
186
221
|
// Persist the bible on the plan so downstream (executor / AG-13)
|
|
187
222
|
// has it without a second read. Planner doesn't author the bible.
|
|
188
223
|
if (opts.bible)
|
|
@@ -239,10 +274,25 @@ class Planner {
|
|
|
239
274
|
* who already painted partial JSON for the first attempt.
|
|
240
275
|
*/
|
|
241
276
|
planStream(brief, opts = {}) {
|
|
277
|
+
// Stream L (L-3): long-form is a multi-pass pipeline (script → chapters →
|
|
278
|
+
// scenes) that can't stream a single structured payload cleanly. Run the
|
|
279
|
+
// non-streaming script-first path and emit the finished plan as one chunk,
|
|
280
|
+
// mirroring the no-structuredStream fallback below.
|
|
281
|
+
const lengthTier = brief.lengthTier ?? (0, brief_schema_1.deriveLengthTier)(brief.durationSec);
|
|
282
|
+
if (lengthTier === "L1" || lengthTier === "L2") {
|
|
283
|
+
const result = this.plan(brief, opts);
|
|
284
|
+
const tokens = {
|
|
285
|
+
async *[Symbol.asyncIterator]() {
|
|
286
|
+
const plan = await result;
|
|
287
|
+
yield JSON.stringify(plan);
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
return { tokens, result };
|
|
291
|
+
}
|
|
242
292
|
const model = this.router.pickFor("planner", {
|
|
243
293
|
premium: brief.tierBudget === "T3",
|
|
244
294
|
});
|
|
245
|
-
const messages =
|
|
295
|
+
const messages = (0, plannerMessages_1.buildPlannerMessages)(brief, opts.persona, opts.brandKit ?? null, opts.styleMemory ?? null, opts.bible ?? null);
|
|
246
296
|
if (!this.opts.llm.structuredStream) {
|
|
247
297
|
// Fallback path — emit the whole plan as one chunk after non-streaming call.
|
|
248
298
|
const result = this.plan(brief, opts);
|
|
@@ -299,293 +349,7 @@ class Planner {
|
|
|
299
349
|
* beyond the LLM call.
|
|
300
350
|
*/
|
|
301
351
|
async regenerateOverlaysForScene(scene, brief, opts = {}) {
|
|
302
|
-
|
|
303
|
-
premium: brief.tierBudget === "T3",
|
|
304
|
-
});
|
|
305
|
-
const fallbackModel = this.router.fallbackFor("planner");
|
|
306
|
-
const FocusedOverlaySchema = zod_1.z.object({
|
|
307
|
-
overlays: zod_1.z.array(videoPlan_schema_1.TextOverlaySchema).max(4),
|
|
308
|
-
});
|
|
309
|
-
const personaPack = opts.persona ? personas_1.PERSONA_PACKS[opts.persona] : null;
|
|
310
|
-
const brandKitSection = (0, promptSections_1.buildBrandKitSection)(opts.brandKit ?? null);
|
|
311
|
-
const bibleSection = (0, promptSections_1.buildBibleSection)(opts.bible ?? null);
|
|
312
|
-
const closingHint = opts.isClosingScene
|
|
313
|
-
? " - This IS the CLOSING scene — you MUST include role='cta' (max 5 words, brand + verb, e.g. 'Get HydraPure Today')."
|
|
314
|
-
: " - This is NOT the closing scene — do NOT emit role='cta' (CTA belongs only on the final scene).";
|
|
315
|
-
const watermarkHint = scene.sceneIndex === 0
|
|
316
|
-
? " - This IS scene 0 — you MAY include exactly one role='watermark' overlay with persistAcrossScenes:true (max 2 words, brand name)."
|
|
317
|
-
: " - This is NOT scene 0 — do NOT emit role='watermark' (watermark is emitted once on scene 0 and auto-carries forward).";
|
|
318
|
-
const overlayContract = [
|
|
319
|
-
"Emit ONLY this scene's overlays (array of TextOverlay, max 4 entries).",
|
|
320
|
-
"Each overlay = { text, role, position?, persistAcrossScenes?, emphasis?, animation?, startMs?, endMs? }.",
|
|
321
|
-
"CRITICAL: `text` is the LITERAL on-screen copy users will read — NOT a description of how it should look. Styling (font, color, position, drop-shadow) is applied automatically from the role.",
|
|
322
|
-
" GOOD: text:\"Your eyes lie to you\"",
|
|
323
|
-
" BAD: text:\"Bold white sans-serif subtitle in the lower third of a 9:16 frame\" (REJECTED as styling description)",
|
|
324
|
-
"Roles + word limits:",
|
|
325
|
-
" headline — top, big-bold, max 6 words (the hook).",
|
|
326
|
-
" subheadline — lower-third, medium, max 8 words.",
|
|
327
|
-
" body — lower-third, small, max 14 words (a supporting line of actual copy).",
|
|
328
|
-
" cta — bottom pill, bold, max 5 words, MUST combine brand + verb.",
|
|
329
|
-
" watermark — bottom-right tiny, max 2 words, just the brand name.",
|
|
330
|
-
" disclaimer — tiny bottom legal copy.",
|
|
331
|
-
" label — in-frame object/person label, max 3 words.",
|
|
332
|
-
"Max 4 overlays per scene. Don't emit two headlines on the same scene.",
|
|
333
|
-
"Emojis are OK — the renderer supports color glyphs natively.",
|
|
334
|
-
closingHint,
|
|
335
|
-
watermarkHint,
|
|
336
|
-
].join("\n");
|
|
337
|
-
const personaLine = personaPack
|
|
338
|
-
? `Persona: ${opts.persona} — ${personaPack.plannerPrompt.split("\n")[0]}`
|
|
339
|
-
: "";
|
|
340
|
-
const system = [
|
|
341
|
-
"You are a video-overlay copywriter.",
|
|
342
|
-
"Given ONE scene from a VideoPlan, emit a fresh `overlays[]` for that scene.",
|
|
343
|
-
"The rest of the plan (other scenes, VO, visuals, music) is fixed — do not comment on it, do not return it.",
|
|
344
|
-
"",
|
|
345
|
-
overlayContract,
|
|
346
|
-
personaLine,
|
|
347
|
-
brandKitSection,
|
|
348
|
-
bibleSection,
|
|
349
|
-
]
|
|
350
|
-
.filter(Boolean)
|
|
351
|
-
.join("\n");
|
|
352
|
-
const sceneContext = {
|
|
353
|
-
sceneIndex: scene.sceneIndex,
|
|
354
|
-
intent: scene.intent,
|
|
355
|
-
prompt: scene.prompt,
|
|
356
|
-
voiceoverLine: scene.voiceoverLine,
|
|
357
|
-
onScreenText: scene.onScreenText,
|
|
358
|
-
durationMs: scene.durationMs,
|
|
359
|
-
currentOverlays: scene.overlays ?? [],
|
|
360
|
-
};
|
|
361
|
-
const userParts = [
|
|
362
|
-
`Brief context:\n${JSON.stringify({
|
|
363
|
-
rawPrompt: brief.rawPrompt,
|
|
364
|
-
tone: brief.tone,
|
|
365
|
-
niche: brief.niche,
|
|
366
|
-
}, null, 2)}`,
|
|
367
|
-
`Scene:\n${JSON.stringify(sceneContext, null, 2)}`,
|
|
368
|
-
];
|
|
369
|
-
if (opts.instruction?.trim()) {
|
|
370
|
-
userParts.push(`Caller instruction: ${opts.instruction.trim()}`);
|
|
371
|
-
}
|
|
372
|
-
else {
|
|
373
|
-
userParts.push("No specific instruction — produce a fresh, on-brand overlay set that fits the scene's intent and voiceoverLine.");
|
|
374
|
-
}
|
|
375
|
-
const user = userParts.join("\n\n");
|
|
376
|
-
let lastErrors;
|
|
377
|
-
for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
|
|
378
|
-
const messages = [
|
|
379
|
-
{ role: "system", content: system },
|
|
380
|
-
{
|
|
381
|
-
role: "user",
|
|
382
|
-
content: lastErrors
|
|
383
|
-
? `${user}\n\nPrevious attempt failed validation: ${lastErrors}\nFix and try again.`
|
|
384
|
-
: user,
|
|
385
|
-
},
|
|
386
|
-
];
|
|
387
|
-
try {
|
|
388
|
-
const result = await this.opts.llm.structured({
|
|
389
|
-
model,
|
|
390
|
-
fallbackModel,
|
|
391
|
-
messages,
|
|
392
|
-
schema: FocusedOverlaySchema,
|
|
393
|
-
schemaName: "SceneOverlays",
|
|
394
|
-
temperature: attempt === 0 ? 0.6 : 0.3,
|
|
395
|
-
});
|
|
396
|
-
const overlays = result.data.overlays;
|
|
397
|
-
// Re-use the same style-leak validator the full-plan path uses by
|
|
398
|
-
// wrapping the overlays in a single-scene VideoPlan-shaped object.
|
|
399
|
-
// Cheaper than re-implementing the regex set here.
|
|
400
|
-
const probe = {
|
|
401
|
-
scenes: [{ ...scene, overlays }],
|
|
402
|
-
};
|
|
403
|
-
const leak = (0, overlaySanity_1.checkOverlayContentSanity)(probe);
|
|
404
|
-
if (leak) {
|
|
405
|
-
lastErrors = leak;
|
|
406
|
-
continue;
|
|
407
|
-
}
|
|
408
|
-
return overlays;
|
|
409
|
-
}
|
|
410
|
-
catch (e) {
|
|
411
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
412
|
-
if (/schema validation failed|non-JSON|empty response/i.test(msg)) {
|
|
413
|
-
lastErrors = `Previous attempt failed validation: ${msg.slice(0, 400)}.`;
|
|
414
|
-
continue;
|
|
415
|
-
}
|
|
416
|
-
throw e;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
throw new Error(`Planner failed to produce valid overlays for scene ${scene.sceneIndex} after ${this.maxRetries + 1} attempts. Last errors: ${lastErrors}`);
|
|
420
|
-
}
|
|
421
|
-
buildMessages(brief, persona, brandKit, styleMemory, bible, lastErrors, useResearchCall = false) {
|
|
422
|
-
const structuralRulesSection = (0, structuralRules_1.buildStructuralRulesSection)(brief);
|
|
423
|
-
const personaSection = persona
|
|
424
|
-
? [
|
|
425
|
-
"",
|
|
426
|
-
`Selected persona: ${persona}.`,
|
|
427
|
-
`Set plan.persona to "${persona}" in the output.`,
|
|
428
|
-
"Persona-specific structural rules (apply on top of the global tier rules):",
|
|
429
|
-
personas_1.PERSONA_PACKS[persona].plannerPrompt,
|
|
430
|
-
].join("\n")
|
|
431
|
-
: "";
|
|
432
|
-
const brandKitSection = (0, promptSections_1.buildBrandKitSection)(brandKit);
|
|
433
|
-
const styleMemorySection = (0, promptSections_1.buildStyleMemorySection)(styleMemory);
|
|
434
|
-
const bibleSection = (0, promptSections_1.buildBibleSection)(bible);
|
|
435
|
-
const modelCatalogSection = (0, promptSections_1.buildModelCatalogSection)();
|
|
436
|
-
const videoStrategySection = (0, promptSections_1.buildVideoStrategySection)(brief.videoStrategy);
|
|
437
|
-
// AG-39: warn the planner away from models with known capability gaps for
|
|
438
|
-
// dimensions this brief signals it cares about (brand text on product
|
|
439
|
-
// labels is the immediate driver). Empty string when nothing rated.
|
|
440
|
-
const modelQualitySection = (0, modelQualityNotes_1.renderModelQualityHintsForSystemPrompt)({
|
|
441
|
-
needsBrandText: (0, promptSections_1.briefMentionsBrandText)(brief),
|
|
442
|
-
needsCharacterContinuity: persona === "ugc-ad" || persona === "talking-head",
|
|
443
|
-
needsFastMotion: brief.tone?.toLowerCase()?.includes("energetic") || brief.tone?.toLowerCase()?.includes("action"),
|
|
444
|
-
needsCinematic: brief.tone?.toLowerCase()?.includes("cinematic"),
|
|
445
|
-
});
|
|
446
|
-
const researchSection = useResearchCall
|
|
447
|
-
? [
|
|
448
|
-
"",
|
|
449
|
-
"RESEARCH MODE — `web_search` is enabled. The brief mentions real-world",
|
|
450
|
-
"subjects (products, companies, people, places, events, or statistics).",
|
|
451
|
-
"Before planning, run targeted `web_search` calls (max 5) to ground the",
|
|
452
|
-
"plan in real facts: real product names, real feature lists, real logos,",
|
|
453
|
-
"real statistics, real quotes. Use the results to populate scene prompts,",
|
|
454
|
-
"voiceover lines, and overlay copy — NEVER fabricate company names,",
|
|
455
|
-
"product specs, or numbers. Cite findings implicitly via accurate copy;",
|
|
456
|
-
"do not embed raw URLs in the plan. When done researching, call the",
|
|
457
|
-
"`submit_VideoPlan` tool with the final plan.",
|
|
458
|
-
"",
|
|
459
|
-
].join("\n")
|
|
460
|
-
: "";
|
|
461
|
-
const system = [
|
|
462
|
-
"You are a video-production planner.",
|
|
463
|
-
"Given a VideoBrief, produce a VideoPlan: an ordered list of scenes",
|
|
464
|
-
"with per-scene asset strategy, tier, prompt, duration, and voiceover.",
|
|
465
|
-
researchSection,
|
|
466
|
-
"",
|
|
467
|
-
"Tier rules — respect brief.tierBudget as the maximum tier:",
|
|
468
|
-
" T0: stock footage / image with Ken-Burns motion.",
|
|
469
|
-
" T1: AI-generated still + camera motion.",
|
|
470
|
-
" T2: AI image-to-video on key frames only.",
|
|
471
|
-
" T3: full text-to-video (most expensive — use sparingly).",
|
|
472
|
-
"",
|
|
473
|
-
"Stock strategy bias — when budget is T0 and the scene depicts something",
|
|
474
|
-
"with natural motion (skies, light, water, traffic, hands at work,",
|
|
475
|
-
"animals, machinery, weather, crowds), prefer strategy='stock-video' over",
|
|
476
|
-
"'stock-image-ken-burns'. Static images with synthesized zoom feel like",
|
|
477
|
-
"a slideshow when chained for >3 cuts; real stock clips give the same",
|
|
478
|
-
"T0 cost with genuine motion. Only fall back to stock-image-ken-burns",
|
|
479
|
-
"when the subject is inherently still (diagrams, infographics, single",
|
|
480
|
-
"objects on a table, frozen moments) OR when the brief explicitly asks",
|
|
481
|
-
"for a poster/title-card feel.",
|
|
482
|
-
"",
|
|
483
|
-
videoStrategySection,
|
|
484
|
-
"",
|
|
485
|
-
"talking-head-avatar is wired and runs the kling-avatar pipeline (face",
|
|
486
|
-
"still + TTS lipsync). Pick it ONLY when the brand kit exposes a",
|
|
487
|
-
"presenterFaceUrl — set scene.avatarFaceUrl to that URL on every avatar",
|
|
488
|
-
"scene. If no presenter face is available, fall back to ai-image-to-video",
|
|
489
|
-
"or stock-video of a presenter instead.",
|
|
490
|
-
"",
|
|
491
|
-
"user-asset is wired and reuses the requesting user's existing library",
|
|
492
|
-
"(their previously generated images / videos / audio) instead of spending",
|
|
493
|
-
"credits to make a new asset. Pick user-asset when the brief mentions a",
|
|
494
|
-
"recurring brand subject (their product photo, spokesperson, b-roll) —",
|
|
495
|
-
"the executor falls back to stock-video if no library match scores high",
|
|
496
|
-
"enough, so picking it is safe.",
|
|
497
|
-
"",
|
|
498
|
-
"Keep total estimated credits as low as possible while honoring the",
|
|
499
|
-
"brief. Mix tiers within a single video where it helps cost without",
|
|
500
|
-
"harming quality (e.g. T2 hero shot + T0 b-roll between).",
|
|
501
|
-
"",
|
|
502
|
-
"Smart model routing — set preferredModel per scene from the catalog:",
|
|
503
|
-
" - Hero / opening-hook / product-reveal scenes: pick the highest-",
|
|
504
|
-
" quality model in the chosen tier (most expensive in that tier).",
|
|
505
|
-
" - B-roll / filler / transition scenes: pick the cheapest model in",
|
|
506
|
-
" the chosen tier — the audience won't notice the difference and",
|
|
507
|
-
" cost drops 3–5x.",
|
|
508
|
-
" - When in doubt for a non-hero scene, pick the median-cost model.",
|
|
509
|
-
" - preferredModel must match a key from the catalog below; the",
|
|
510
|
-
" executor will swap on rate-limit, so picking is best-effort, not",
|
|
511
|
-
" a hard contract.",
|
|
512
|
-
modelCatalogSection,
|
|
513
|
-
modelQualitySection,
|
|
514
|
-
// AG-14 fix: persona section moved above structuralRulesSection and
|
|
515
|
-
// bibleSection. The bible block has multiple "MUST" rules that were
|
|
516
|
-
// crowding out persona.hookStyle when persona was the last item before
|
|
517
|
-
// brandKit; on `seed-ugc-skincare` this regressed hookStrength to 0.4
|
|
518
|
-
// (planner picked a generic "Wait…" opener instead of the brief's
|
|
519
|
-
// problem-statement hook). Order is now: persona (voice + hookStyle) →
|
|
520
|
-
// structural rules → bible (entity verbatim re-statement).
|
|
521
|
-
personaSection,
|
|
522
|
-
structuralRulesSection,
|
|
523
|
-
bibleSection,
|
|
524
|
-
brandKitSection,
|
|
525
|
-
styleMemorySection,
|
|
526
|
-
]
|
|
527
|
-
.filter(Boolean)
|
|
528
|
-
.join("\n");
|
|
529
|
-
const user = [
|
|
530
|
-
`Brief:\n${JSON.stringify(brief, null, 2)}`,
|
|
531
|
-
lastErrors
|
|
532
|
-
? `\nYour previous attempt failed validation: ${lastErrors}\nFix the structure and try again.`
|
|
533
|
-
: "",
|
|
534
|
-
]
|
|
535
|
-
.filter(Boolean)
|
|
536
|
-
.join("\n");
|
|
537
|
-
return [
|
|
538
|
-
{ role: "system", content: system },
|
|
539
|
-
{ role: "user", content: user },
|
|
540
|
-
];
|
|
352
|
+
return (0, overlayRegen_1.regenerateOverlaysForScene)({ llm: this.opts.llm, router: this.router, maxRetries: this.maxRetries }, scene, brief, opts);
|
|
541
353
|
}
|
|
542
354
|
}
|
|
543
355
|
exports.Planner = Planner;
|
|
544
|
-
/**
|
|
545
|
-
* Heuristic — does the brief mention real-world entities that benefit from
|
|
546
|
-
* web grounding? A planner without research will happily invent fake app
|
|
547
|
-
* names, fabricate statistics, and miss real-world brand details. Triggers
|
|
548
|
-
* when the brief contains:
|
|
549
|
-
* - explicit "top N / best / popular / list of" framings
|
|
550
|
-
* - proper-noun-heavy briefs (≥2 capitalized non-sentence-start words)
|
|
551
|
-
* - listicle/comparison/news/review keywords
|
|
552
|
-
* - explicit time markers ("2026", "latest", "this year", "recent")
|
|
553
|
-
* - statistics signals ("statistics", "data", "percent", "study")
|
|
554
|
-
*
|
|
555
|
-
* Deliberately conservative — false negatives are fine (we just skip the
|
|
556
|
-
* search), false positives waste $0.01 per planner call. Override via
|
|
557
|
-
* `useWebResearch: true|false` when the caller knows better.
|
|
558
|
-
*/
|
|
559
|
-
function briefNeedsWebResearch(brief) {
|
|
560
|
-
const text = [
|
|
561
|
-
brief.rawPrompt ?? "",
|
|
562
|
-
brief.tone ?? "",
|
|
563
|
-
brief.niche ?? "",
|
|
564
|
-
]
|
|
565
|
-
.filter(Boolean)
|
|
566
|
-
.join(" ");
|
|
567
|
-
if (!text.trim())
|
|
568
|
-
return false;
|
|
569
|
-
const lower = text.toLowerCase();
|
|
570
|
-
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/;
|
|
571
|
-
if (listicleSignals.test(lower))
|
|
572
|
-
return true;
|
|
573
|
-
const yearMarker = /\b(20\d{2}|this\s+year|last\s+year)\b/;
|
|
574
|
-
if (yearMarker.test(lower))
|
|
575
|
-
return true;
|
|
576
|
-
// Count proper nouns that aren't sentence-starters — heuristic for
|
|
577
|
-
// "specific brands / people / places".
|
|
578
|
-
const words = text.split(/\s+/);
|
|
579
|
-
let properNouns = 0;
|
|
580
|
-
for (let i = 0; i < words.length; i++) {
|
|
581
|
-
const w = words[i] ?? "";
|
|
582
|
-
const prev = i > 0 ? words[i - 1] ?? "" : "";
|
|
583
|
-
const isSentenceStart = i === 0 || /[.!?]$/.test(prev);
|
|
584
|
-
if (!isSentenceStart && /^[A-Z][a-zA-Z0-9]{2,}/.test(w)) {
|
|
585
|
-
properNouns++;
|
|
586
|
-
if (properNouns >= 2)
|
|
587
|
-
return true;
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
return false;
|
|
591
|
-
}
|