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
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { PlannedScene } from "../../../schemas/videoPlan.schema";
|
|
2
|
+
import { ToolContext, ToolOutcome } from "../toolRegistry";
|
|
3
|
+
import { ExtendChainStep, SceneClip } from "../extendChain";
|
|
4
|
+
import { ProviderTaskCache, ProviderTaskCacheEntry } from "../providerTaskCache";
|
|
5
|
+
/**
|
|
6
|
+
* Executor public types: the per-scene asset/outcome shapes, the run options,
|
|
7
|
+
* the injectable runTool signature, and the failure classifier. Kept separate
|
|
8
|
+
* from the Executor class so tool/host modules can import these without pulling
|
|
9
|
+
* in the class (and its provider deps).
|
|
10
|
+
*/
|
|
11
|
+
export type RunToolFn = <O = unknown>(name: string, input: unknown, ctx: ToolContext) => Promise<ToolOutcome<O>>;
|
|
12
|
+
export interface SceneAssetResult {
|
|
13
|
+
/** Concrete asset URL for the visual track (image or video). */
|
|
14
|
+
visualUrl?: string;
|
|
15
|
+
/** P-UNS-2: stock attribution for the visual, when the provider requires credit (Unsplash). */
|
|
16
|
+
attribution?: {
|
|
17
|
+
name: string;
|
|
18
|
+
url?: string;
|
|
19
|
+
};
|
|
20
|
+
/** Voiceover audio (base64 or url depending on host policy). */
|
|
21
|
+
voiceoverAudioBase64?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Resolved voiceover URL once the host has uploaded the base64 buffer to
|
|
24
|
+
* its asset store (GCS / Firebase Storage). The agent.controller flow
|
|
25
|
+
* sets this in `onSceneComplete` so `planToProject` can render a real VO
|
|
26
|
+
* clip on `track-vo`. When unset, planToProject skips the VO clip.
|
|
27
|
+
*/
|
|
28
|
+
voiceoverUrl?: string;
|
|
29
|
+
/** Provider task id for async generations the host still needs to poll. */
|
|
30
|
+
pendingTaskId?: string;
|
|
31
|
+
/** Model key the pending task was triggered on — the poller needs this to pick the provider. */
|
|
32
|
+
pendingModelKey?: string;
|
|
33
|
+
/**
|
|
34
|
+
* AG-2 / L-4 extend chain. Set when the scene's requested duration exceeds the
|
|
35
|
+
* chosen model's max single clip AND the model supports native extension: the
|
|
36
|
+
* executor triggers the initial clip (at the model's max legal length, its id
|
|
37
|
+
* in `pendingTaskId`) and lists the remaining length here as ordered extension
|
|
38
|
+
* segments. The host runs them SEQUENTIALLY via `resolveExtendChain` (each
|
|
39
|
+
* extend continues the previous provider task, so each waits for that task to
|
|
40
|
+
* COMPLETE) and fills `clips`. Absent on the common path (scene fits one clip).
|
|
41
|
+
*/
|
|
42
|
+
extendChain?: ExtendChainStep[];
|
|
43
|
+
/**
|
|
44
|
+
* AG-2 / L-4. Resolved visual sub-clips (source + extensions) in render order,
|
|
45
|
+
* filled by the host's `resolveExtendChain` after sequential polling.
|
|
46
|
+
* planToProject lays these out as adjacent video clips across the scene's
|
|
47
|
+
* time window. When unset, the single `visualUrl` is used.
|
|
48
|
+
*/
|
|
49
|
+
clips?: SceneClip[];
|
|
50
|
+
/** AG-22: provider chain the tool walked (in order, primary first). For trace + post-mortem. */
|
|
51
|
+
attemptedProviders?: string[];
|
|
52
|
+
/** Tool name used. */
|
|
53
|
+
tool: string;
|
|
54
|
+
/** Idempotency key the executor minted; useful for retries. */
|
|
55
|
+
idempotencyKey: string;
|
|
56
|
+
/**
|
|
57
|
+
* AG-28: estimated VO duration (ms) from the wpm heuristic. Set when
|
|
58
|
+
* voiceoverAudioBase64 is set. Used pre-upload for budget math; the
|
|
59
|
+
* editor-side display window prefers voiceoverActualMs when available.
|
|
60
|
+
*/
|
|
61
|
+
voiceoverEstimateMs?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Probed actual mp3 duration (ms). Stamped by `resolveVoiceoverUrl` after
|
|
64
|
+
* generation, before the buffer is discarded. Reflects real playback
|
|
65
|
+
* length — required to size the editor VO clip's display window so
|
|
66
|
+
* Remotion's `endAt` doesn't truncate emotive/punctuated deliveries that
|
|
67
|
+
* the wpm estimate undershoots. Falls back to `voiceoverEstimateMs` when
|
|
68
|
+
* ffprobe is unavailable.
|
|
69
|
+
*/
|
|
70
|
+
voiceoverActualMs?: number;
|
|
71
|
+
/**
|
|
72
|
+
* AG-28: TTS over-budget signal. True when the line + style produces audio
|
|
73
|
+
* longer than scene.durationMs * 1.05 even after the executor's atempo
|
|
74
|
+
* adjustment. Stitcher should freeze-frame-pad rather than clip.
|
|
75
|
+
*/
|
|
76
|
+
voiceoverOverBudget?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* AG-3: word-level captions transcribed from the resolved VO audio. Stamped
|
|
79
|
+
* host-side by `resolveSceneCaptions` (NOT the executor — captions need the
|
|
80
|
+
* uploaded voiceoverUrl, which only exists post-resolveVoiceoverUrl). Times
|
|
81
|
+
* are ms relative to scene start (== VO audio start). planToProject turns
|
|
82
|
+
* this into a CaptionClip on the caption track.
|
|
83
|
+
*/
|
|
84
|
+
captionWords?: Array<{
|
|
85
|
+
word: string;
|
|
86
|
+
start: number;
|
|
87
|
+
end: number;
|
|
88
|
+
}>;
|
|
89
|
+
}
|
|
90
|
+
export interface SceneOutcome {
|
|
91
|
+
scene: PlannedScene;
|
|
92
|
+
ok: boolean;
|
|
93
|
+
result?: SceneAssetResult;
|
|
94
|
+
error?: {
|
|
95
|
+
code: string;
|
|
96
|
+
message: string;
|
|
97
|
+
/**
|
|
98
|
+
* Set when the failure came from a provider-fallback-wrapped tool whose
|
|
99
|
+
* entire chain exhausted (or terminated on auth/safety/input). Used by
|
|
100
|
+
* the orchestrator to decide between agent re-plan / scene degrade /
|
|
101
|
+
* hard fail.
|
|
102
|
+
*/
|
|
103
|
+
classification?: "transient" | "rate_limit" | "capability" | "safety" | "auth" | "quota" | "input" | "unknown";
|
|
104
|
+
needsReplan?: boolean;
|
|
105
|
+
attemptedProviders?: string[];
|
|
106
|
+
};
|
|
107
|
+
durationMs: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Inspect a failed scene to decide the next orchestration step.
|
|
111
|
+
*
|
|
112
|
+
* - "replan" : agent should re-plan the scene (safety / bad input)
|
|
113
|
+
* - "degrade" : try a cheaper strategy (e.g. T2/T3 chain exhausted on quota)
|
|
114
|
+
* - "fail" : terminal — surface to user (auth / chain-exhausted-unknown)
|
|
115
|
+
* - "retry" : transient — caller may re-run the scene as-is later
|
|
116
|
+
*/
|
|
117
|
+
export declare function classifySceneFailure(outcome: SceneOutcome): "replan" | "degrade" | "fail" | "retry" | null;
|
|
118
|
+
export interface ExecutorOptions {
|
|
119
|
+
/** Max scenes to run in parallel. Generation providers rate-limit themselves; this guards on top. */
|
|
120
|
+
concurrency?: number;
|
|
121
|
+
/** Inject a recording wrapper (e.g. runToolRecorded) for eval / replay. */
|
|
122
|
+
runTool?: RunToolFn;
|
|
123
|
+
/**
|
|
124
|
+
* Stage 3 hook: invoked after each scene finishes (success OR failure).
|
|
125
|
+
* Lets the orchestrator stream incremental Project updates into Firestore
|
|
126
|
+
* so the editor + agent drawer surfaces light up as scenes complete,
|
|
127
|
+
* rather than waiting for the whole executor to finish. Errors thrown
|
|
128
|
+
* from the callback are swallowed (logged) so a Firestore blip can't
|
|
129
|
+
* crash the executor.
|
|
130
|
+
*/
|
|
131
|
+
onSceneComplete?: (sceneIndex: number, outcome: SceneOutcome) => Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Stage 7 slice 1: provider task-id cache (read side). When the upstream
|
|
134
|
+
* inputs for animate_image / generate_video / generate_avatar_video hash
|
|
135
|
+
* to the same value as a cached entry (and entry is within TTL), the
|
|
136
|
+
* executor returns the cached taskId + modelKey and skips the tool call.
|
|
137
|
+
* /execute passes the project's cache here so re-runs after downstream
|
|
138
|
+
* (poll/stitch/critic) bugs reuse the prior $$ gens. /regenerate-scene
|
|
139
|
+
* deliberately omits this (user wants a fresh gen) but still mints.
|
|
140
|
+
*/
|
|
141
|
+
taskCache?: ProviderTaskCache;
|
|
142
|
+
/**
|
|
143
|
+
* Stage 7 slice 1: cache write side. Invoked after a successful tool call
|
|
144
|
+
* that produced a pendingTaskId. Orchestrator persists the entry on the
|
|
145
|
+
* AgentProject doc so the NEXT execute can replay. Errors swallowed —
|
|
146
|
+
* cache is best-effort optimisation, not correctness.
|
|
147
|
+
*/
|
|
148
|
+
onTaskMint?: (clipId: string, entry: ProviderTaskCacheEntry) => Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Gap #1 follow-up (skip-generation). Scene indices whose VISUAL is preserved
|
|
151
|
+
* verbatim from a prior run (locked / user-placed, unapproved for mutation).
|
|
152
|
+
* runVisual returns a no-op "frozen" outcome for these — no provider call, no
|
|
153
|
+
* task minted, no $$ — and planToProject injects the real clip instead of a
|
|
154
|
+
* placeholder twin. Without this the lock guarantee held but we still PAID to
|
|
155
|
+
* regenerate footage we immediately discarded.
|
|
156
|
+
*/
|
|
157
|
+
frozenVisualScenes?: ReadonlySet<number>;
|
|
158
|
+
/** Gap #1 follow-up. Scene indices whose VOICEOVER is preserved — skip TTS. */
|
|
159
|
+
frozenVoiceoverScenes?: ReadonlySet<number>;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Visual outcome shape returned by runVisual — either a resolved visual
|
|
163
|
+
* (URL or pending task) or a structured scene error.
|
|
164
|
+
*/
|
|
165
|
+
export type VisualOutcome = {
|
|
166
|
+
ok: true;
|
|
167
|
+
output: {
|
|
168
|
+
tool: string;
|
|
169
|
+
visualUrl?: string;
|
|
170
|
+
pendingTaskId?: string;
|
|
171
|
+
pendingModelKey?: string;
|
|
172
|
+
attemptedProviders?: string[];
|
|
173
|
+
extendChain?: ExtendChainStep[];
|
|
174
|
+
attribution?: {
|
|
175
|
+
name: string;
|
|
176
|
+
url?: string;
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
} | {
|
|
180
|
+
ok: false;
|
|
181
|
+
error: SceneOutcome["error"];
|
|
182
|
+
};
|
|
183
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/executor/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.classifySceneFailure = classifySceneFailure;
|
|
4
|
+
/**
|
|
5
|
+
* Inspect a failed scene to decide the next orchestration step.
|
|
6
|
+
*
|
|
7
|
+
* - "replan" : agent should re-plan the scene (safety / bad input)
|
|
8
|
+
* - "degrade" : try a cheaper strategy (e.g. T2/T3 chain exhausted on quota)
|
|
9
|
+
* - "fail" : terminal — surface to user (auth / chain-exhausted-unknown)
|
|
10
|
+
* - "retry" : transient — caller may re-run the scene as-is later
|
|
11
|
+
*/
|
|
12
|
+
function classifySceneFailure(outcome) {
|
|
13
|
+
if (outcome.ok)
|
|
14
|
+
return null;
|
|
15
|
+
const c = outcome.error?.classification;
|
|
16
|
+
if (!c)
|
|
17
|
+
return "fail";
|
|
18
|
+
if (outcome.error?.needsReplan)
|
|
19
|
+
return "replan"; // safety / input
|
|
20
|
+
if (c === "auth")
|
|
21
|
+
return "fail";
|
|
22
|
+
if (c === "quota")
|
|
23
|
+
return "degrade";
|
|
24
|
+
if (c === "rate_limit" || c === "transient")
|
|
25
|
+
return "retry";
|
|
26
|
+
if (c === "capability")
|
|
27
|
+
return "degrade";
|
|
28
|
+
return "fail";
|
|
29
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PlannedScene, VideoPlan } from "../../../schemas/videoPlan.schema";
|
|
2
|
+
import { ToolContext } from "../toolRegistry";
|
|
3
|
+
import { ProviderTaskCacheEntry } from "../providerTaskCache";
|
|
4
|
+
import { RunToolFn, VisualOutcome } from "./types";
|
|
5
|
+
/**
|
|
6
|
+
* Per-scene VISUAL resolution — the strategy switch that the Executor delegates
|
|
7
|
+
* to. Extracted as a free function so the Executor class stays a thin
|
|
8
|
+
* orchestrator. It receives a `VisualDeps` bundle (the bound Executor helpers
|
|
9
|
+
* it needs: runTool, the task-cache read/write, and the AG-11b identity-image
|
|
10
|
+
* publish/resolve) rather than `this`, keeping it independently testable.
|
|
11
|
+
*/
|
|
12
|
+
export interface VisualDeps {
|
|
13
|
+
runTool: RunToolFn;
|
|
14
|
+
/**
|
|
15
|
+
* Gap #1 follow-up — scene indices whose visual is preserved verbatim; a
|
|
16
|
+
* match returns a no-op "frozen" outcome before any provider call.
|
|
17
|
+
*/
|
|
18
|
+
frozenVisualScenes?: ReadonlySet<number>;
|
|
19
|
+
/** Stage 7 slice 1 — task-cache read: cached pending-task or null + the input hash. */
|
|
20
|
+
checkTaskCache(clipId: string, tool: string, input: Record<string, unknown>): {
|
|
21
|
+
hit: ProviderTaskCacheEntry | null;
|
|
22
|
+
inputsHash: string;
|
|
23
|
+
};
|
|
24
|
+
/** Stage 7 slice 1 — best-effort task-cache write. */
|
|
25
|
+
mintTaskCache(clipId: string, entry: ProviderTaskCacheEntry): Promise<void>;
|
|
26
|
+
/** AG-11b — publish this scene's generated identity still for dependents. */
|
|
27
|
+
publishIdentityImage(sceneIndex: number, url: string | undefined): void;
|
|
28
|
+
/** AG-11b — resolve this scene's character-anchor identity still (or undefined). */
|
|
29
|
+
resolveAnchorIdentityImage(scene: PlannedScene): Promise<string | undefined>;
|
|
30
|
+
}
|
|
31
|
+
export declare function runVisual(deps: VisualDeps, scene: PlannedScene, ctx: ToolContext, aspect: VideoPlan["aspect"], plan: VideoPlan): Promise<VisualOutcome>;
|
|
32
|
+
//# sourceMappingURL=visual.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visual.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/executor/visual.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAG5E,OAAO,EAAE,WAAW,EAAe,MAAM,iBAAiB,CAAC;AAG3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAG9D,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,SAAS,CAAC;IACnB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACzC,uFAAuF;IACvF,cAAc,CACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B;QAAE,GAAG,EAAE,sBAAsB,GAAG,IAAI,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9D,sDAAsD;IACtD,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5E,6EAA6E;IAC7E,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACxE,oFAAoF;IACpF,0BAA0B,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAC9E;AAED,wBAAsB,SAAS,CAC7B,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,EAC3B,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,aAAa,CAAC,CAkdxB"}
|
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runVisual = runVisual;
|
|
4
|
+
const logger_1 = require("../../../utils/logger");
|
|
5
|
+
const referenceImageRenderer_1 = require("../referenceImageRenderer");
|
|
6
|
+
const extendChain_1 = require("../extendChain");
|
|
7
|
+
const helpers_1 = require("../../aiGen/helpers");
|
|
8
|
+
const unsplash_service_1 = require("../../aiGen/providers/unsplash/unsplash.service");
|
|
9
|
+
const duration_1 = require("./duration");
|
|
10
|
+
async function runVisual(deps, scene, ctx, aspect, plan) {
|
|
11
|
+
// Gap #1 follow-up — skip-generation. The user froze this scene's visual in
|
|
12
|
+
// a prior run; planToProject reproduces the preserved clip verbatim, so any
|
|
13
|
+
// gen we ran here would be discarded. Return a no-op outcome (no visualUrl,
|
|
14
|
+
// no pendingTaskId) BEFORE any provider call: no task minted, no $$ spent.
|
|
15
|
+
if (deps.frozenVisualScenes?.has(scene.sceneIndex)) {
|
|
16
|
+
logger_1.logger.info("executor: skip-gen — visual frozen (preserved), no provider call", {
|
|
17
|
+
sceneIndex: scene.sceneIndex,
|
|
18
|
+
strategy: scene.strategy,
|
|
19
|
+
});
|
|
20
|
+
return { ok: true, output: { tool: "frozen" } };
|
|
21
|
+
}
|
|
22
|
+
const durationSec = Math.max(2, Math.round(scene.durationMs / 1000));
|
|
23
|
+
// AG-13: collect reference images for this scene's bible entities. Empty
|
|
24
|
+
// array when bible is C0/C1 or no entities are tagged — image-gen falls
|
|
25
|
+
// back to pure text prompt.
|
|
26
|
+
const referenceImageUrls = (0, referenceImageRenderer_1.collectReferenceImageUrls)(plan.bible, scene.bibleEntityIds ?? []);
|
|
27
|
+
// AG-11b: if this scene reuses a character from an earlier scene, prepend
|
|
28
|
+
// that anchor's generated still as an inputImage for image-to-image
|
|
29
|
+
// identity transfer. The Visual Bible (C2) is the primary consistency
|
|
30
|
+
// signal; this is the backup signal (characterAnchorSceneIndex) made real
|
|
31
|
+
// on the executor side. Merge ahead of bible refs and de-dupe.
|
|
32
|
+
const anchorImageUrl = await deps.resolveAnchorIdentityImage(scene);
|
|
33
|
+
const identityRefs = anchorImageUrl
|
|
34
|
+
? Array.from(new Set([anchorImageUrl, ...referenceImageUrls]))
|
|
35
|
+
: referenceImageUrls;
|
|
36
|
+
const wrap = (tool, outcome) => outcome.ok
|
|
37
|
+
? { ok: true, output: { tool, ...outcome.output } }
|
|
38
|
+
: { ok: false, error: outcome.error };
|
|
39
|
+
switch (scene.strategy) {
|
|
40
|
+
case "stock-video":
|
|
41
|
+
case "stock-image-ken-burns": {
|
|
42
|
+
const out = await deps.runTool("search_stock", {
|
|
43
|
+
query: scene.prompt,
|
|
44
|
+
kind: scene.strategy === "stock-video" ? "video" : "image",
|
|
45
|
+
aspectRatio: aspect,
|
|
46
|
+
minDurationSec: scene.strategy === "stock-video" ? durationSec : undefined,
|
|
47
|
+
}, ctx);
|
|
48
|
+
if (!out.ok)
|
|
49
|
+
return wrap("search_stock", out);
|
|
50
|
+
const stockAsset = out.output.assets[0];
|
|
51
|
+
const url = stockAsset?.url;
|
|
52
|
+
if (!url)
|
|
53
|
+
return {
|
|
54
|
+
ok: false,
|
|
55
|
+
error: {
|
|
56
|
+
code: "NO_STOCK_RESULTS",
|
|
57
|
+
message: `No stock results for: ${scene.prompt}`,
|
|
58
|
+
attemptedProviders: out.output.attemptedProviders,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
// P-UNS-1: Unsplash API ToS requires firing the provider's
|
|
62
|
+
// download-tracking endpoint when an asset is actually USED in a render
|
|
63
|
+
// (not at search time). runVisual runs once per scene at execution, so
|
|
64
|
+
// this is exactly the commit point. Unsplash-only — Pexels/Pixabay omit
|
|
65
|
+
// trackingUrl, and pingDownload() self-guards when the key is unset.
|
|
66
|
+
// Fire-and-forget: a tracking hiccup must never fail the scene.
|
|
67
|
+
if (stockAsset?.trackingUrl) {
|
|
68
|
+
void new unsplash_service_1.UnsplashProviderService()
|
|
69
|
+
.pingDownload(stockAsset.trackingUrl)
|
|
70
|
+
.catch((err) => logger_1.logger.warn("unsplash pingDownload failed (non-fatal)", {
|
|
71
|
+
error: err instanceof Error ? err.message : String(err),
|
|
72
|
+
sceneIndex: scene.sceneIndex,
|
|
73
|
+
agentRunId: ctx.agentRunId,
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
ok: true,
|
|
78
|
+
output: {
|
|
79
|
+
tool: "search_stock",
|
|
80
|
+
visualUrl: url,
|
|
81
|
+
attemptedProviders: out.output.attemptedProviders,
|
|
82
|
+
// P-UNS-2: carry stock attribution to the clip provenance (Unsplash
|
|
83
|
+
// requires visible credit; Pexels/Pixabay leave it undefined).
|
|
84
|
+
attribution: stockAsset.attribution,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
case "ai-image-static":
|
|
89
|
+
case "ai-image-motion": {
|
|
90
|
+
const out = await deps.runTool("generate_image", {
|
|
91
|
+
prompt: scene.prompt,
|
|
92
|
+
modelKey: scene.preferredModel ?? "google-nano-banana",
|
|
93
|
+
aspectRatio: aspect,
|
|
94
|
+
...(identityRefs.length
|
|
95
|
+
? { inputImageUrls: identityRefs }
|
|
96
|
+
: {}),
|
|
97
|
+
}, ctx);
|
|
98
|
+
if (!out.ok)
|
|
99
|
+
return wrap("generate_image", out);
|
|
100
|
+
// AG-11b: this generated still is the scene's identity frame — publish
|
|
101
|
+
// it so later same-character scenes can anchor off it.
|
|
102
|
+
deps.publishIdentityImage(scene.sceneIndex, out.output.imageUrl);
|
|
103
|
+
return { ok: true, output: { tool: "generate_image", visualUrl: out.output.imageUrl } };
|
|
104
|
+
}
|
|
105
|
+
case "ai-image-to-video": {
|
|
106
|
+
const animateModelKey = scene.preferredModel ?? "kling-v2.6";
|
|
107
|
+
// AG-2 / L-4: if the scene wants more seconds than this model emits in
|
|
108
|
+
// one clip and the model supports native extension, build the initial
|
|
109
|
+
// clip at the model's max length and emit the rest as extension steps
|
|
110
|
+
// (resolved sequentially host-side). Otherwise fall back to the snap
|
|
111
|
+
// path, which clamps to the nearest legal value.
|
|
112
|
+
const chain = (0, extendChain_1.planExtendChain)(animateModelKey, durationSec);
|
|
113
|
+
const extendChain = chain?.segments;
|
|
114
|
+
const animateDurationSec = chain
|
|
115
|
+
? chain.initialDurationSec
|
|
116
|
+
: (0, duration_1.resolveDurationForPreferredModel)(animateModelKey, durationSec, !!scene.preferredModel, scene.sceneIndex);
|
|
117
|
+
if (chain) {
|
|
118
|
+
logger_1.logger.info("executor: scene needs extend chain", {
|
|
119
|
+
sceneIndex: scene.sceneIndex,
|
|
120
|
+
modelKey: animateModelKey,
|
|
121
|
+
targetSec: durationSec,
|
|
122
|
+
initialSec: chain.initialDurationSec,
|
|
123
|
+
extensions: chain.segments.length,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
// AG-1 Phase 2 — first-last-frame (FLF) interpolation. Only honour
|
|
127
|
+
// scene.lastFramePrompt when the chosen model actually accepts an end
|
|
128
|
+
// frame (capability gate reads `lastFrameImageUrl` from its config).
|
|
129
|
+
// On a non-FLF model the field is silently ignored so a stray planner
|
|
130
|
+
// value never breaks the scene — it just renders as plain i2v.
|
|
131
|
+
const useFlf = !!scene.lastFramePrompt && (0, helpers_1.modelSupportsLastFrame)(animateModelKey);
|
|
132
|
+
if (scene.lastFramePrompt && !useFlf) {
|
|
133
|
+
logger_1.logger.warn("executor: ignoring lastFramePrompt — model is not FLF-capable", { sceneIndex: scene.sceneIndex, modelKey: animateModelKey });
|
|
134
|
+
}
|
|
135
|
+
// Stage 7 slice 1: cache key spans the WHOLE strategy (both image-gen
|
|
136
|
+
// + animate). Hashing only upstream-stable inputs — prompt, model,
|
|
137
|
+
// duration, aspect, reference images — lets a re-execute skip BOTH
|
|
138
|
+
// tool calls, replaying the cached animate taskId through the poller.
|
|
139
|
+
// AG-1: the end-frame prompt is part of the cache identity so toggling
|
|
140
|
+
// FLF on a scene re-generates rather than replaying the old single-frame task.
|
|
141
|
+
const clipId = `scene-${scene.sceneIndex}-visual`;
|
|
142
|
+
const cacheInput = {
|
|
143
|
+
strategy: "ai-image-to-video",
|
|
144
|
+
prompt: scene.prompt,
|
|
145
|
+
modelKey: animateModelKey,
|
|
146
|
+
durationSec: animateDurationSec,
|
|
147
|
+
aspect,
|
|
148
|
+
// AG-11b: intentionally keys on referenceImageUrls (bible), NOT
|
|
149
|
+
// identityRefs. The anchor still is generated per-run and is absent
|
|
150
|
+
// on a cache-hit re-execute (the anchor scene replays without
|
|
151
|
+
// re-generating its image); including it would bust the cache every
|
|
152
|
+
// re-execute and re-submit gen tasks. The anchored identity is
|
|
153
|
+
// already baked into the minted animate task, so a plain replay
|
|
154
|
+
// preserves consistency. Do NOT add identityRefs here.
|
|
155
|
+
referenceImageUrls,
|
|
156
|
+
extendSegments: extendChain?.length ?? 0,
|
|
157
|
+
...(useFlf ? { lastFramePrompt: scene.lastFramePrompt } : {}),
|
|
158
|
+
};
|
|
159
|
+
const { hit, inputsHash } = deps.checkTaskCache(clipId, "animate_image", cacheInput);
|
|
160
|
+
if (hit) {
|
|
161
|
+
return {
|
|
162
|
+
ok: true,
|
|
163
|
+
output: {
|
|
164
|
+
tool: "animate_image",
|
|
165
|
+
pendingTaskId: hit.taskId,
|
|
166
|
+
pendingModelKey: hit.modelKey,
|
|
167
|
+
// Re-emit the chain on cache replay so the host still resolves the
|
|
168
|
+
// extensions from the cached source task (extensions aren't cached).
|
|
169
|
+
...(extendChain ? { extendChain } : {}),
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
const img = await deps.runTool("generate_image", {
|
|
174
|
+
prompt: scene.prompt,
|
|
175
|
+
modelKey: "google-nano-banana",
|
|
176
|
+
aspectRatio: aspect,
|
|
177
|
+
...(identityRefs.length
|
|
178
|
+
? { inputImageUrls: identityRefs }
|
|
179
|
+
: {}),
|
|
180
|
+
}, { ...ctx, idempotencyKey: `${ctx.idempotencyKey}:img` });
|
|
181
|
+
if (!img.ok)
|
|
182
|
+
return wrap("generate_image", img);
|
|
183
|
+
// AG-11b: publish the i2v first frame as this scene's identity still so
|
|
184
|
+
// later same-character scenes can anchor off it.
|
|
185
|
+
deps.publishIdentityImage(scene.sceneIndex, img.output.imageUrl);
|
|
186
|
+
// AG-1: generate the END composition for FLF. Same reference images as
|
|
187
|
+
// the first frame so identity stays locked across the interpolation.
|
|
188
|
+
let lastFrameImageUrl;
|
|
189
|
+
if (useFlf) {
|
|
190
|
+
const endImg = await deps.runTool("generate_image", {
|
|
191
|
+
prompt: scene.lastFramePrompt,
|
|
192
|
+
modelKey: "google-nano-banana",
|
|
193
|
+
aspectRatio: aspect,
|
|
194
|
+
...(identityRefs.length
|
|
195
|
+
? { inputImageUrls: identityRefs }
|
|
196
|
+
: {}),
|
|
197
|
+
}, { ...ctx, idempotencyKey: `${ctx.idempotencyKey}:imgEnd` });
|
|
198
|
+
if (!endImg.ok)
|
|
199
|
+
return wrap("generate_image", endImg);
|
|
200
|
+
lastFrameImageUrl = endImg.output.imageUrl;
|
|
201
|
+
}
|
|
202
|
+
const animate = await deps.runTool("animate_image", {
|
|
203
|
+
imageUrl: img.output.imageUrl,
|
|
204
|
+
motionHint: scene.prompt,
|
|
205
|
+
durationSec: animateDurationSec,
|
|
206
|
+
modelKey: animateModelKey,
|
|
207
|
+
...(lastFrameImageUrl ? { lastFrameImageUrl } : {}),
|
|
208
|
+
}, ctx);
|
|
209
|
+
if (!animate.ok)
|
|
210
|
+
return wrap("animate_image", animate);
|
|
211
|
+
const mintedModelKey = animate.output.modelKeyUsed ?? animateModelKey;
|
|
212
|
+
await deps.mintTaskCache(clipId, {
|
|
213
|
+
tool: "animate_image",
|
|
214
|
+
taskId: animate.output.taskId,
|
|
215
|
+
modelKey: mintedModelKey,
|
|
216
|
+
inputsHash,
|
|
217
|
+
createdAt: Date.now(),
|
|
218
|
+
});
|
|
219
|
+
return {
|
|
220
|
+
ok: true,
|
|
221
|
+
output: {
|
|
222
|
+
tool: "animate_image",
|
|
223
|
+
pendingTaskId: animate.output.taskId,
|
|
224
|
+
pendingModelKey: mintedModelKey,
|
|
225
|
+
attemptedProviders: animate.output.attemptedProviders,
|
|
226
|
+
...(extendChain ? { extendChain } : {}),
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
case "ai-text-to-video": {
|
|
231
|
+
const t2vModelKey = scene.preferredModel ?? "kling-v2.6";
|
|
232
|
+
// AG-2 / L-4: same extend-chain decision as ai-image-to-video.
|
|
233
|
+
const chain = (0, extendChain_1.planExtendChain)(t2vModelKey, durationSec);
|
|
234
|
+
const extendChain = chain?.segments;
|
|
235
|
+
const t2vDurationSec = chain
|
|
236
|
+
? chain.initialDurationSec
|
|
237
|
+
: (0, duration_1.resolveDurationForPreferredModel)(t2vModelKey, durationSec, !!scene.preferredModel, scene.sceneIndex);
|
|
238
|
+
if (chain) {
|
|
239
|
+
logger_1.logger.info("executor: scene needs extend chain", {
|
|
240
|
+
sceneIndex: scene.sceneIndex,
|
|
241
|
+
modelKey: t2vModelKey,
|
|
242
|
+
targetSec: durationSec,
|
|
243
|
+
initialSec: chain.initialDurationSec,
|
|
244
|
+
extensions: chain.segments.length,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
const clipId = `scene-${scene.sceneIndex}-visual`;
|
|
248
|
+
const cacheInput = {
|
|
249
|
+
strategy: "ai-text-to-video",
|
|
250
|
+
prompt: scene.prompt,
|
|
251
|
+
modelKey: t2vModelKey,
|
|
252
|
+
durationSec: t2vDurationSec,
|
|
253
|
+
extendSegments: extendChain?.length ?? 0,
|
|
254
|
+
};
|
|
255
|
+
const { hit, inputsHash } = deps.checkTaskCache(clipId, "generate_video", cacheInput);
|
|
256
|
+
if (hit) {
|
|
257
|
+
return {
|
|
258
|
+
ok: true,
|
|
259
|
+
output: {
|
|
260
|
+
tool: "generate_video",
|
|
261
|
+
pendingTaskId: hit.taskId,
|
|
262
|
+
pendingModelKey: hit.modelKey,
|
|
263
|
+
...(extendChain ? { extendChain } : {}),
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
const out = await deps.runTool("generate_video", {
|
|
268
|
+
prompt: scene.prompt,
|
|
269
|
+
modelKey: t2vModelKey,
|
|
270
|
+
durationSec: t2vDurationSec,
|
|
271
|
+
}, ctx);
|
|
272
|
+
if (!out.ok)
|
|
273
|
+
return wrap("generate_video", out);
|
|
274
|
+
const mintedModelKey = out.output.modelKeyUsed ?? t2vModelKey;
|
|
275
|
+
await deps.mintTaskCache(clipId, {
|
|
276
|
+
tool: "generate_video",
|
|
277
|
+
taskId: out.output.taskId,
|
|
278
|
+
modelKey: mintedModelKey,
|
|
279
|
+
inputsHash,
|
|
280
|
+
createdAt: Date.now(),
|
|
281
|
+
});
|
|
282
|
+
return {
|
|
283
|
+
ok: true,
|
|
284
|
+
output: {
|
|
285
|
+
tool: "generate_video",
|
|
286
|
+
pendingTaskId: out.output.taskId,
|
|
287
|
+
pendingModelKey: mintedModelKey,
|
|
288
|
+
attemptedProviders: out.output.attemptedProviders,
|
|
289
|
+
...(extendChain ? { extendChain } : {}),
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
case "user-asset": {
|
|
294
|
+
// Per-user library search. The host injects the searcher at boot
|
|
295
|
+
// (see userLibrarySearcher bootstrap); if no match, fall back to
|
|
296
|
+
// stock so the scene still renders rather than failing hard.
|
|
297
|
+
const out = await deps.runTool("search_user_library", { query: scene.prompt, limit: 5 }, ctx);
|
|
298
|
+
if (out.ok) {
|
|
299
|
+
const first = out.output.assets[0];
|
|
300
|
+
if (first) {
|
|
301
|
+
return { ok: true, output: { tool: "search_user_library", visualUrl: first.url } };
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
// No hits or searcher missing — fall back to stock-video as the
|
|
305
|
+
// closest cheap substitute so the executor still produces an asset.
|
|
306
|
+
const stock = await deps.runTool("search_stock", {
|
|
307
|
+
query: scene.prompt,
|
|
308
|
+
kind: "video",
|
|
309
|
+
aspectRatio: aspect,
|
|
310
|
+
minDurationSec: durationSec,
|
|
311
|
+
}, ctx);
|
|
312
|
+
if (!stock.ok)
|
|
313
|
+
return wrap("search_stock", stock);
|
|
314
|
+
const fallbackUrl = stock.output.assets[0]?.url;
|
|
315
|
+
if (!fallbackUrl) {
|
|
316
|
+
return {
|
|
317
|
+
ok: false,
|
|
318
|
+
error: {
|
|
319
|
+
code: "USER_ASSET_NO_MATCH",
|
|
320
|
+
message: `No user-library match for "${scene.prompt}" and no stock fallback.`,
|
|
321
|
+
attemptedProviders: stock.output.attemptedProviders,
|
|
322
|
+
},
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
return {
|
|
326
|
+
ok: true,
|
|
327
|
+
output: {
|
|
328
|
+
tool: "search_user_library",
|
|
329
|
+
visualUrl: fallbackUrl,
|
|
330
|
+
attemptedProviders: stock.output.attemptedProviders,
|
|
331
|
+
},
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
case "talking-head-avatar": {
|
|
335
|
+
if (!scene.avatarFaceUrl) {
|
|
336
|
+
return {
|
|
337
|
+
ok: false,
|
|
338
|
+
error: {
|
|
339
|
+
code: "AVATAR_FACE_REQUIRED",
|
|
340
|
+
message: "talking-head-avatar requires scene.avatarFaceUrl (set on the user's brand kit).",
|
|
341
|
+
},
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
if (!scene.voiceoverLine) {
|
|
345
|
+
return {
|
|
346
|
+
ok: false,
|
|
347
|
+
error: {
|
|
348
|
+
code: "AVATAR_VO_REQUIRED",
|
|
349
|
+
message: "talking-head-avatar requires scene.voiceoverLine for the lipsync audio.",
|
|
350
|
+
},
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
const avatarMode = scene.tier === "T3" ? "pro" : "std";
|
|
354
|
+
const clipId = `scene-${scene.sceneIndex}-visual`;
|
|
355
|
+
const cacheInput = {
|
|
356
|
+
strategy: "talking-head-avatar",
|
|
357
|
+
inputImageUrl: scene.avatarFaceUrl,
|
|
358
|
+
ttsText: scene.voiceoverLine,
|
|
359
|
+
mode: avatarMode,
|
|
360
|
+
};
|
|
361
|
+
const { hit, inputsHash } = deps.checkTaskCache(clipId, "generate_avatar_video", cacheInput);
|
|
362
|
+
if (hit) {
|
|
363
|
+
return {
|
|
364
|
+
ok: true,
|
|
365
|
+
output: {
|
|
366
|
+
tool: "generate_avatar_video",
|
|
367
|
+
pendingTaskId: hit.taskId,
|
|
368
|
+
pendingModelKey: hit.modelKey,
|
|
369
|
+
},
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
const out = await deps.runTool("generate_avatar_video", {
|
|
373
|
+
inputImageUrl: scene.avatarFaceUrl,
|
|
374
|
+
ttsText: scene.voiceoverLine,
|
|
375
|
+
mode: avatarMode,
|
|
376
|
+
}, ctx);
|
|
377
|
+
if (!out.ok)
|
|
378
|
+
return wrap("generate_avatar_video", out);
|
|
379
|
+
await deps.mintTaskCache(clipId, {
|
|
380
|
+
tool: "generate_avatar_video",
|
|
381
|
+
taskId: out.output.taskId,
|
|
382
|
+
// Avatar tool hardcodes Kling Avatar internally; poller needs the
|
|
383
|
+
// actual model key to route via getAiGenProviderService (no special
|
|
384
|
+
// resolver exists). AG-20: was "generate_avatar_video" which would
|
|
385
|
+
// throw at factory lookup the moment the avatar path was polled.
|
|
386
|
+
modelKey: "kling-avatar",
|
|
387
|
+
inputsHash,
|
|
388
|
+
createdAt: Date.now(),
|
|
389
|
+
});
|
|
390
|
+
return {
|
|
391
|
+
ok: true,
|
|
392
|
+
output: {
|
|
393
|
+
tool: "generate_avatar_video",
|
|
394
|
+
pendingTaskId: out.output.taskId,
|
|
395
|
+
pendingModelKey: "kling-avatar",
|
|
396
|
+
},
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|