vidspotai-shared 1.0.82 → 1.0.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +82 -0
- 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 +67 -0
- 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 +114 -0
- 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 +2 -2
- 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/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 +63 -0
- package/lib/services/agent/tools/composeScene.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/estimateCost.tool.d.ts +27 -0
- 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 +56 -0
- 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 +21 -0
- 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/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 +24 -1
- package/lib/services/aiGen/providers/google/google.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/google/google.service.js +96 -244
- 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/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/bullmq.service.d.ts +61 -0
- package/lib/services/bullmq.service.d.ts.map +1 -1
- package/lib/services/bullmq.service.js +101 -1
- 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 +12 -0
- package/lib/services/index.d.ts.map +1 -1
- package/lib/services/index.js +12 -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/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/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,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Token vault — symmetric encryption for secrets stored at rest in Firestore.
|
|
4
|
+
*
|
|
5
|
+
* Social-account OAuth tokens (access + refresh) must NEVER live in Firestore as
|
|
6
|
+
* plaintext: anyone with a DB export (or an over-broad security rule) would
|
|
7
|
+
* inherit publish/DM/analytics access to every connected account. We encrypt
|
|
8
|
+
* them with AES-256-GCM (authenticated encryption) before write and decrypt only
|
|
9
|
+
* inside workers / Cloud Functions at call time.
|
|
10
|
+
*
|
|
11
|
+
* Key management: the 32-byte key comes from `SOCIAL_TOKEN_ENC_KEY` (hex or
|
|
12
|
+
* base64). In dev it can sit in `.env`; in prod it should be sourced from GCP
|
|
13
|
+
* Secret Manager and injected as an env var. Rotating the key is supported via
|
|
14
|
+
* a key-id prefix on the ciphertext (`v1:`) so a future key can decrypt old
|
|
15
|
+
* blobs by id — see `EncryptedBlob` format below.
|
|
16
|
+
*
|
|
17
|
+
* Ciphertext wire format (single string, safe for Firestore):
|
|
18
|
+
* `<keyId>:<base64(iv)>:<base64(authTag)>:<base64(ciphertext)>`
|
|
19
|
+
* keyId lets us roll keys without a migration; iv is random per-encrypt (GCM
|
|
20
|
+
* must never reuse an iv under the same key).
|
|
21
|
+
*/
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.isTokenVaultConfigured = isTokenVaultConfigured;
|
|
24
|
+
exports.encryptToken = encryptToken;
|
|
25
|
+
exports.decryptToken = decryptToken;
|
|
26
|
+
exports.tryDecryptToken = tryDecryptToken;
|
|
27
|
+
exports.safeEqual = safeEqual;
|
|
28
|
+
exports.__resetTokenVaultCacheForTests = __resetTokenVaultCacheForTests;
|
|
29
|
+
const crypto_1 = require("crypto");
|
|
30
|
+
const logger_1 = require("../../utils/logger");
|
|
31
|
+
const ALGORITHM = "aes-256-gcm";
|
|
32
|
+
const IV_BYTES = 12; // GCM standard nonce length
|
|
33
|
+
const KEY_BYTES = 32; // AES-256
|
|
34
|
+
const KEY_ENV = "SOCIAL_TOKEN_ENC_KEY";
|
|
35
|
+
/** Current key id baked into new ciphertext. Bump when rotating keys. */
|
|
36
|
+
const CURRENT_KEY_ID = "v1";
|
|
37
|
+
/**
|
|
38
|
+
* Resolved encryption keys, indexed by key id. Lets old ciphertext (encrypted
|
|
39
|
+
* under a retired key) still decrypt after a rotation: set `SOCIAL_TOKEN_ENC_KEY`
|
|
40
|
+
* to the new key and `SOCIAL_TOKEN_ENC_KEY_<OLDID>` to each retired key.
|
|
41
|
+
*/
|
|
42
|
+
function loadKeys() {
|
|
43
|
+
const keys = {};
|
|
44
|
+
const primary = process.env[KEY_ENV];
|
|
45
|
+
if (primary)
|
|
46
|
+
keys[CURRENT_KEY_ID] = parseKey(primary, CURRENT_KEY_ID);
|
|
47
|
+
// Optional retired keys: SOCIAL_TOKEN_ENC_KEY_V0, ..._VN
|
|
48
|
+
for (const [name, value] of Object.entries(process.env)) {
|
|
49
|
+
const match = name.match(/^SOCIAL_TOKEN_ENC_KEY_([A-Z0-9]+)$/);
|
|
50
|
+
if (match && value) {
|
|
51
|
+
const id = match[1].toLowerCase();
|
|
52
|
+
keys[id] = parseKey(value, id);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return keys;
|
|
56
|
+
}
|
|
57
|
+
/** Accept a 32-byte key as hex (64 chars) or base64. Throws on wrong length. */
|
|
58
|
+
function parseKey(raw, keyId) {
|
|
59
|
+
const trimmed = raw.trim();
|
|
60
|
+
let buf;
|
|
61
|
+
if (/^[0-9a-fA-F]{64}$/.test(trimmed)) {
|
|
62
|
+
buf = Buffer.from(trimmed, "hex");
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
buf = Buffer.from(trimmed, "base64");
|
|
66
|
+
}
|
|
67
|
+
if (buf.length !== KEY_BYTES) {
|
|
68
|
+
throw new Error(`tokenVault: key '${keyId}' must be 32 bytes (got ${buf.length}). ` +
|
|
69
|
+
`Provide 64 hex chars or 32-byte base64.`);
|
|
70
|
+
}
|
|
71
|
+
return buf;
|
|
72
|
+
}
|
|
73
|
+
let keyCache = null;
|
|
74
|
+
function keys() {
|
|
75
|
+
if (!keyCache)
|
|
76
|
+
keyCache = loadKeys();
|
|
77
|
+
return keyCache;
|
|
78
|
+
}
|
|
79
|
+
/** True when at least the current key is configured. Use to gate features. */
|
|
80
|
+
function isTokenVaultConfigured() {
|
|
81
|
+
try {
|
|
82
|
+
return Boolean(keys()[CURRENT_KEY_ID]);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function requireKey(keyId) {
|
|
89
|
+
const k = keys()[keyId];
|
|
90
|
+
if (!k) {
|
|
91
|
+
throw new Error(`tokenVault: no key for id '${keyId}'. Set ${KEY_ENV}` +
|
|
92
|
+
(keyId === CURRENT_KEY_ID ? "" : `_${keyId.toUpperCase()}`) +
|
|
93
|
+
" (32-byte hex/base64).");
|
|
94
|
+
}
|
|
95
|
+
return k;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Encrypt a plaintext secret. Returns the opaque wire-format string to store.
|
|
99
|
+
* Empty/whitespace input throws — callers should not persist empty tokens.
|
|
100
|
+
*/
|
|
101
|
+
function encryptToken(plaintext) {
|
|
102
|
+
if (!plaintext)
|
|
103
|
+
throw new Error("tokenVault.encryptToken: empty plaintext");
|
|
104
|
+
const key = requireKey(CURRENT_KEY_ID);
|
|
105
|
+
const iv = (0, crypto_1.randomBytes)(IV_BYTES);
|
|
106
|
+
const cipher = (0, crypto_1.createCipheriv)(ALGORITHM, key, iv);
|
|
107
|
+
const ciphertext = Buffer.concat([
|
|
108
|
+
cipher.update(plaintext, "utf8"),
|
|
109
|
+
cipher.final(),
|
|
110
|
+
]);
|
|
111
|
+
const authTag = cipher.getAuthTag();
|
|
112
|
+
return [
|
|
113
|
+
CURRENT_KEY_ID,
|
|
114
|
+
iv.toString("base64"),
|
|
115
|
+
authTag.toString("base64"),
|
|
116
|
+
ciphertext.toString("base64"),
|
|
117
|
+
].join(":");
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Decrypt a wire-format string produced by `encryptToken`. Throws if the blob is
|
|
121
|
+
* malformed, the key id is unknown, or the auth tag fails (tampering / wrong
|
|
122
|
+
* key). Never logs the plaintext.
|
|
123
|
+
*/
|
|
124
|
+
function decryptToken(blob) {
|
|
125
|
+
const parts = blob.split(":");
|
|
126
|
+
if (parts.length !== 4) {
|
|
127
|
+
throw new Error("tokenVault.decryptToken: malformed ciphertext");
|
|
128
|
+
}
|
|
129
|
+
const [keyId, ivB64, tagB64, dataB64] = parts;
|
|
130
|
+
const key = requireKey(keyId);
|
|
131
|
+
const iv = Buffer.from(ivB64, "base64");
|
|
132
|
+
const authTag = Buffer.from(tagB64, "base64");
|
|
133
|
+
const ciphertext = Buffer.from(dataB64, "base64");
|
|
134
|
+
const decipher = (0, crypto_1.createDecipheriv)(ALGORITHM, key, iv);
|
|
135
|
+
decipher.setAuthTag(authTag);
|
|
136
|
+
try {
|
|
137
|
+
return Buffer.concat([
|
|
138
|
+
decipher.update(ciphertext),
|
|
139
|
+
decipher.final(),
|
|
140
|
+
]).toString("utf8");
|
|
141
|
+
}
|
|
142
|
+
catch (err) {
|
|
143
|
+
logger_1.logger.warn("tokenVault.decryptToken: auth failed", {
|
|
144
|
+
keyId,
|
|
145
|
+
error: err instanceof Error ? err.message : String(err),
|
|
146
|
+
});
|
|
147
|
+
throw new Error("tokenVault.decryptToken: authentication failed");
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Safe wrapper: decrypt, returning null instead of throwing. Use on read paths
|
|
152
|
+
* where a single corrupt/rotated blob shouldn't crash a batch (e.g. analytics
|
|
153
|
+
* poller iterating many accounts).
|
|
154
|
+
*/
|
|
155
|
+
function tryDecryptToken(blob) {
|
|
156
|
+
if (!blob)
|
|
157
|
+
return null;
|
|
158
|
+
try {
|
|
159
|
+
return decryptToken(blob);
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Constant-time compare for opaque secrets (e.g. OAuth `state`, webhook
|
|
167
|
+
* signatures). Avoids leaking length/contents via early-exit timing.
|
|
168
|
+
*/
|
|
169
|
+
function safeEqual(a, b) {
|
|
170
|
+
const ab = Buffer.from(a);
|
|
171
|
+
const bb = Buffer.from(b);
|
|
172
|
+
if (ab.length !== bb.length)
|
|
173
|
+
return false;
|
|
174
|
+
return (0, crypto_1.timingSafeEqual)(ab, bb);
|
|
175
|
+
}
|
|
176
|
+
/** Test-only: reset the memoized key cache so env changes take effect. */
|
|
177
|
+
function __resetTokenVaultCacheForTests() {
|
|
178
|
+
keyCache = null;
|
|
179
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captionStyleHint.d.ts","sourceRoot":"","sources":["../../../src/services/editor/captionStyleHint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AA0EnE,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,YAAY,CA8CrF"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveCaptionStyleHint = resolveCaptionStyleHint;
|
|
4
|
+
/**
|
|
5
|
+
* CH-1 — translate a free-form caption "style hint" into the structured
|
|
6
|
+
* {@link CaptionStyle} the renderer actually reads. The in-editor chat agent
|
|
7
|
+
* accepts hints like "bold yellow", "thin minimal white", or "big TikTok-style
|
|
8
|
+
* word-pop"; the model usually emits structured fields directly, but the
|
|
9
|
+
* `add_captions` tool still takes a free-form `styleHint`, and that text was
|
|
10
|
+
* previously recorded and then discarded. This resolver gives that hint a
|
|
11
|
+
* deterministic, testable mapping onto color / highlightColor / fontSize /
|
|
12
|
+
* fontWeight so the look is persisted on the plan (see planToProject) and
|
|
13
|
+
* survives future caption regenerations.
|
|
14
|
+
*
|
|
15
|
+
* Intentionally conservative: only well-understood vocabulary maps to a field.
|
|
16
|
+
* Anything it can't interpret yields no entry for that field (the renderer
|
|
17
|
+
* default stands). Returns {} when nothing is recognised — callers should treat
|
|
18
|
+
* an empty object as "no structured style derived from the hint".
|
|
19
|
+
*/
|
|
20
|
+
/** Named colors we map to stable hex. Kept small + deliberate (not full CSS). */
|
|
21
|
+
const NAMED_COLORS = {
|
|
22
|
+
white: "#ffffff",
|
|
23
|
+
black: "#000000",
|
|
24
|
+
yellow: "#facc15",
|
|
25
|
+
gold: "#fbbf24",
|
|
26
|
+
red: "#ef4444",
|
|
27
|
+
orange: "#fb923c",
|
|
28
|
+
green: "#22c55e",
|
|
29
|
+
blue: "#3b82f6",
|
|
30
|
+
cyan: "#22d3ee",
|
|
31
|
+
pink: "#ec4899",
|
|
32
|
+
purple: "#a855f7",
|
|
33
|
+
violet: "#8b5cf6",
|
|
34
|
+
lime: "#a3e635",
|
|
35
|
+
};
|
|
36
|
+
/** Weight keywords → numeric font-weight (100–900). */
|
|
37
|
+
const WEIGHT_WORDS = [
|
|
38
|
+
[/\b(thin|hairline)\b/, 100],
|
|
39
|
+
[/\b(extra[\s-]?light|ultra[\s-]?light)\b/, 200],
|
|
40
|
+
[/\b(light)\b/, 300],
|
|
41
|
+
[/\b(normal|regular|book)\b/, 400],
|
|
42
|
+
[/\b(medium)\b/, 500],
|
|
43
|
+
[/\b(semi[\s-]?bold|demi[\s-]?bold)\b/, 600],
|
|
44
|
+
// "extra/ultra/heavy/black/boldest/bolder" outrank plain "bold".
|
|
45
|
+
[/\b(extra[\s-]?bold|ultra[\s-]?bold|heavy|black|boldest|bolder)\b/, 900],
|
|
46
|
+
[/\b(bold)\b/, 700],
|
|
47
|
+
];
|
|
48
|
+
/** Size keywords → px. Only applied when no explicit pixel value is present. */
|
|
49
|
+
const SIZE_WORDS = [
|
|
50
|
+
[/\b(huge|giant|massive|enormous)\b/, 96],
|
|
51
|
+
[/\b(big|large|larger|bigger)\b/, 72],
|
|
52
|
+
[/\b(small|smaller|tiny)\b/, 36],
|
|
53
|
+
];
|
|
54
|
+
/** Every color mention (hex or named) with its position, sorted left-to-right. */
|
|
55
|
+
function colorHits(text) {
|
|
56
|
+
const hits = [];
|
|
57
|
+
const hexRe = /#[0-9a-f]{3,8}\b/gi;
|
|
58
|
+
let m;
|
|
59
|
+
while ((m = hexRe.exec(text)))
|
|
60
|
+
hits.push({ index: m.index, value: m[0].toLowerCase() });
|
|
61
|
+
for (const [name, value] of Object.entries(NAMED_COLORS)) {
|
|
62
|
+
const re = new RegExp(`\\b${name}\\b`, "g");
|
|
63
|
+
while ((m = re.exec(text)))
|
|
64
|
+
hits.push({ index: m.index, value });
|
|
65
|
+
}
|
|
66
|
+
return hits.sort((a, b) => a.index - b.index);
|
|
67
|
+
}
|
|
68
|
+
function resolveCaptionStyleHint(hint) {
|
|
69
|
+
const out = {};
|
|
70
|
+
if (typeof hint !== "string" || !hint.trim())
|
|
71
|
+
return out;
|
|
72
|
+
const text = hint.toLowerCase();
|
|
73
|
+
// Weight — first matching rule wins (heavier synonyms are listed first).
|
|
74
|
+
for (const [re, weight] of WEIGHT_WORDS) {
|
|
75
|
+
if (re.test(text)) {
|
|
76
|
+
out.fontWeight = weight;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Size — explicit "<n>px" / "size <n>" beats keyword buckets.
|
|
81
|
+
const px = /(\d{2,3})\s*px\b/.exec(text) ?? /\bsize\s+(\d{2,3})\b/.exec(text);
|
|
82
|
+
if (px) {
|
|
83
|
+
const n = Number.parseInt(px[1], 10);
|
|
84
|
+
if (Number.isFinite(n))
|
|
85
|
+
out.fontSize = Math.max(8, Math.min(200, n));
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
for (const [re, size] of SIZE_WORDS) {
|
|
89
|
+
if (re.test(text)) {
|
|
90
|
+
out.fontSize = size;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Color assignment is position-aware. When "highlight" appears, the color
|
|
96
|
+
// nearest that word is the highlightColor; the first *other* color (by
|
|
97
|
+
// position) becomes the base color. Without "highlight", the first color is
|
|
98
|
+
// the base.
|
|
99
|
+
const hits = colorHits(text);
|
|
100
|
+
if (hits.length) {
|
|
101
|
+
const hi = text.search(/\bhighlight/);
|
|
102
|
+
let highlightHit;
|
|
103
|
+
if (hi >= 0) {
|
|
104
|
+
highlightHit = hits.reduce((best, h) => Math.abs(h.index - hi) < Math.abs(best.index - hi) ? h : best);
|
|
105
|
+
out.highlightColor = highlightHit.value;
|
|
106
|
+
}
|
|
107
|
+
const base = hits.find((h) => h !== highlightHit);
|
|
108
|
+
if (base)
|
|
109
|
+
out.color = base.value;
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { Project
|
|
2
|
-
import type {
|
|
1
|
+
import type { Project } from "../../schemas/project.schema";
|
|
2
|
+
import type { PlanToProjectInput } from "./planToProject.types";
|
|
3
|
+
export { TRACK_ID, buildOverlayClipsForScene } from "./planToProject.helpers";
|
|
4
|
+
export type { PlanToProjectInput, SceneRenderOutcome } from "./planToProject.types";
|
|
3
5
|
/**
|
|
4
6
|
* planToProject — pure translator from an approved VideoPlan + per-scene
|
|
5
7
|
* executor outcomes into the canonical Project IR. The Project is what gets
|
|
@@ -14,71 +16,10 @@ import type { TextOverlay, VideoPlan } from "../../schemas/videoPlan.schema";
|
|
|
14
16
|
* a placeholder data URL is emitted so the Project is schema-valid and the
|
|
15
17
|
* editor can render a grey placeholder pinned to the scene's intended
|
|
16
18
|
* duration. Worker fills in the real URL via Firestore update later.
|
|
17
|
-
*/
|
|
18
|
-
export interface SceneRenderOutcome {
|
|
19
|
-
/** Resolved URL for the scene's visual asset (image or video). */
|
|
20
|
-
visualUrl?: string;
|
|
21
|
-
/** Resolved URL for the scene's voiceover. */
|
|
22
|
-
voiceoverUrl?: string;
|
|
23
|
-
/**
|
|
24
|
-
* VO duration in ms used by planToProject to size the clip's display
|
|
25
|
-
* window. When set from a probed actual mp3 (preferred), reflects real
|
|
26
|
-
* playback length; when set from the wpm estimator it can undershoot
|
|
27
|
-
* emotive/punctuated lines by 400–900ms and the editor's Remotion Audio
|
|
28
|
-
* truncates at endAt. Caller should set the actual when available.
|
|
29
|
-
*/
|
|
30
|
-
voiceoverDurationMs?: number;
|
|
31
|
-
/** Resolved URL for an external captions file (.vtt/.srt) if any. */
|
|
32
|
-
captionsUrl?: string;
|
|
33
|
-
/** Word-level caption timing (start/end ms within scene). */
|
|
34
|
-
captionWords?: Array<{
|
|
35
|
-
word: string;
|
|
36
|
-
start: number;
|
|
37
|
-
end: number;
|
|
38
|
-
}>;
|
|
39
|
-
/** Final model key the executor landed on (may differ from preferredModel). */
|
|
40
|
-
modelKey?: string;
|
|
41
|
-
/** Provider chain walked, primary first; recorded in provenance. */
|
|
42
|
-
attemptedProviders?: string[];
|
|
43
|
-
/** Provider idempotency key (used for reuse on regen). */
|
|
44
|
-
generationId?: string;
|
|
45
|
-
/** Credits actually spent on this scene. */
|
|
46
|
-
creditsSpent?: number;
|
|
47
|
-
/** Content hash of the visual asset, when computed. */
|
|
48
|
-
assetHash?: string;
|
|
49
|
-
}
|
|
50
|
-
export interface PlanToProjectInput {
|
|
51
|
-
plan: VideoPlan;
|
|
52
|
-
outcomes?: Record<number, SceneRenderOutcome | undefined>;
|
|
53
|
-
projectId: string;
|
|
54
|
-
name?: string;
|
|
55
|
-
agentRunId?: string;
|
|
56
|
-
/** When set, overrides plan.music.url (caller can swap to CDN-hosted version). */
|
|
57
|
-
musicUrl?: string;
|
|
58
|
-
/** Music duration in ms; falls back to plan.music.durationSec*1000 if unset. */
|
|
59
|
-
musicDurationMs?: number;
|
|
60
|
-
/** Project createdAt; defaults to now. */
|
|
61
|
-
createdAt?: string;
|
|
62
|
-
/** Project updatedAt; defaults to now. */
|
|
63
|
-
updatedAt?: string;
|
|
64
|
-
}
|
|
65
|
-
export declare const TRACK_ID: {
|
|
66
|
-
readonly visual: "track-visual";
|
|
67
|
-
readonly voiceover: "track-vo";
|
|
68
|
-
readonly music: "track-music";
|
|
69
|
-
readonly text: "track-text";
|
|
70
|
-
readonly caption: "track-caption";
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Build the TextClip[] for a single scene's overlays at a known timeline
|
|
74
|
-
* offset. Extracted from the planToProject loop so the regen handlers
|
|
75
|
-
* (Stage 6 slice 4) can splice fresh overlays into projectJson without
|
|
76
|
-
* duplicating the role → font/size/weight mapping. Pure / no I/O.
|
|
77
19
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
20
|
+
* Input/outcome types live in ./planToProject.types; the pure clip-builder
|
|
21
|
+
* helpers (track ids, size/transition lookups, overlay styling) in
|
|
22
|
+
* ./planToProject.helpers.
|
|
81
23
|
*/
|
|
82
|
-
export declare function buildOverlayClipsForScene(sceneIndex: number, offsetMs: number, sceneDurationMs: number, overlays: readonly TextOverlay[], frameHeight: number): TextClip[];
|
|
83
24
|
export declare function planToProject(input: PlanToProjectInput): Project;
|
|
84
25
|
//# sourceMappingURL=planToProject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planToProject.d.ts","sourceRoot":"","sources":["../../../src/services/editor/planToProject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,OAAO,
|
|
1
|
+
{"version":3,"file":"planToProject.d.ts","sourceRoot":"","sources":["../../../src/services/editor/planToProject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,OAAO,EAIR,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAchE,OAAO,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAC9E,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEpF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAmYhE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Provenance, TextClip, Track, Transition } from "../../schemas/project.schema";
|
|
2
|
+
import type { PlannedScene, SceneAssetStrategy, TextOverlay, TransitionKind, VideoPlan } from "../../schemas/videoPlan.schema";
|
|
3
|
+
import type { SceneRenderOutcome } from "./planToProject.types";
|
|
4
|
+
/**
|
|
5
|
+
* Pure building blocks for planToProject: track ids, strategy/transition/size
|
|
6
|
+
* lookups, provenance + overlay styling, the per-scene overlay clip builder,
|
|
7
|
+
* and the track factory. No I/O. Split out so the translator reads as the
|
|
8
|
+
* scene-walk orchestration and the regen handlers can reuse
|
|
9
|
+
* buildOverlayClipsForScene without re-deriving the role → font mapping.
|
|
10
|
+
*/
|
|
11
|
+
export declare const TRACK_ID: {
|
|
12
|
+
readonly visual: "track-visual";
|
|
13
|
+
readonly broll: "track-broll";
|
|
14
|
+
readonly voiceover: "track-vo";
|
|
15
|
+
readonly music: "track-music";
|
|
16
|
+
readonly text: "track-text";
|
|
17
|
+
readonly caption: "track-caption";
|
|
18
|
+
};
|
|
19
|
+
export declare function isStillStrategy(s: SceneAssetStrategy): boolean;
|
|
20
|
+
/** A passable URL we can put in skeleton clips so ProjectSchema.url() passes. */
|
|
21
|
+
export declare const PLACEHOLDER_URL = "data:,placeholder";
|
|
22
|
+
export declare function sizeForAspect(aspect: VideoPlan["aspect"]): {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
};
|
|
26
|
+
export declare const TRANSITION_KIND_MAP: Record<TransitionKind, Transition["kind"] | null>;
|
|
27
|
+
export declare function provenanceForScene(scene: PlannedScene, outcome: SceneRenderOutcome | undefined): Provenance;
|
|
28
|
+
/**
|
|
29
|
+
* Build the TextClip[] for a single scene's overlays at a known timeline
|
|
30
|
+
* offset. Extracted from the planToProject loop so the regen handlers
|
|
31
|
+
* (Stage 6 slice 4) can splice fresh overlays into projectJson without
|
|
32
|
+
* duplicating the role → font/size/weight mapping. Pure / no I/O.
|
|
33
|
+
*
|
|
34
|
+
* `offsetMs` is the scene's start on the master timeline (cumulative sum
|
|
35
|
+
* of prior scene durations). `sceneDurationMs` clamps any overlay.endMs
|
|
36
|
+
* that overshoots the scene.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildOverlayClipsForScene(sceneIndex: number, offsetMs: number, sceneDurationMs: number, overlays: readonly TextOverlay[], frameHeight: number): TextClip[];
|
|
39
|
+
export declare function makeTrack(id: string, kind: Track["kind"], index: number, name: string): Track;
|
|
40
|
+
//# sourceMappingURL=planToProject.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planToProject.helpers.d.ts","sourceRoot":"","sources":["../../../src/services/editor/planToProject.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,KAAK,EACL,UAAU,EACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,SAAS,EACV,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE;;;;;;GAMG;AAIH,eAAO,MAAM,QAAQ;;;;;;;CASX,CAAC;AASX,wBAAgB,eAAe,CAAC,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAE9D;AAED,iFAAiF;AACjF,eAAO,MAAM,eAAe,sBAAsB,CAAC;AAInD,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAW5F;AAID,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,IAAI,CASjF,CAAC;AAIF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,kBAAkB,GAAG,SAAS,GACtC,UAAU,CAiBZ;AA4CD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,SAAS,WAAW,EAAE,EAChC,WAAW,EAAE,MAAM,GAClB,QAAQ,EAAE,CAoCZ;AAED,wBAAgB,SAAS,CACvB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,KAAK,CAWP"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TRANSITION_KIND_MAP = exports.PLACEHOLDER_URL = exports.TRACK_ID = void 0;
|
|
4
|
+
exports.isStillStrategy = isStillStrategy;
|
|
5
|
+
exports.sizeForAspect = sizeForAspect;
|
|
6
|
+
exports.provenanceForScene = provenanceForScene;
|
|
7
|
+
exports.buildOverlayClipsForScene = buildOverlayClipsForScene;
|
|
8
|
+
exports.makeTrack = makeTrack;
|
|
9
|
+
/**
|
|
10
|
+
* Pure building blocks for planToProject: track ids, strategy/transition/size
|
|
11
|
+
* lookups, provenance + overlay styling, the per-scene overlay clip builder,
|
|
12
|
+
* and the track factory. No I/O. Split out so the translator reads as the
|
|
13
|
+
* scene-walk orchestration and the regen handlers can reuse
|
|
14
|
+
* buildOverlayClipsForScene without re-deriving the role → font mapping.
|
|
15
|
+
*/
|
|
16
|
+
// ─── track id constants ──────────────────────────────────────────────────
|
|
17
|
+
exports.TRACK_ID = {
|
|
18
|
+
visual: "track-visual",
|
|
19
|
+
// CH-6 — second video lane for B-roll overlays, composited ABOVE the main
|
|
20
|
+
// visual (higher track index → painted on top).
|
|
21
|
+
broll: "track-broll",
|
|
22
|
+
voiceover: "track-vo",
|
|
23
|
+
music: "track-music",
|
|
24
|
+
text: "track-text",
|
|
25
|
+
caption: "track-caption",
|
|
26
|
+
};
|
|
27
|
+
// ─── strategy → clip kind ────────────────────────────────────────────────
|
|
28
|
+
const STILL_STRATEGIES = new Set([
|
|
29
|
+
"stock-image-ken-burns",
|
|
30
|
+
"ai-image-static",
|
|
31
|
+
]);
|
|
32
|
+
function isStillStrategy(s) {
|
|
33
|
+
return STILL_STRATEGIES.has(s);
|
|
34
|
+
}
|
|
35
|
+
/** A passable URL we can put in skeleton clips so ProjectSchema.url() passes. */
|
|
36
|
+
exports.PLACEHOLDER_URL = "data:,placeholder";
|
|
37
|
+
// ─── aspect → size defaults ──────────────────────────────────────────────
|
|
38
|
+
function sizeForAspect(aspect) {
|
|
39
|
+
switch (aspect) {
|
|
40
|
+
case "9:16":
|
|
41
|
+
return { width: 1080, height: 1920 };
|
|
42
|
+
case "1:1":
|
|
43
|
+
return { width: 1080, height: 1080 };
|
|
44
|
+
case "4:5":
|
|
45
|
+
return { width: 1080, height: 1350 };
|
|
46
|
+
case "16:9":
|
|
47
|
+
return { width: 1920, height: 1080 };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// ─── transition kind → renderable subset ─────────────────────────────────
|
|
51
|
+
exports.TRANSITION_KIND_MAP = {
|
|
52
|
+
none: null,
|
|
53
|
+
cut: null,
|
|
54
|
+
fade: "fade",
|
|
55
|
+
crossfade: "crossfade",
|
|
56
|
+
wipe: "wipe",
|
|
57
|
+
whipPan: "whipPan",
|
|
58
|
+
dipToBlack: "dipToBlack",
|
|
59
|
+
dipToWhite: "dipToWhite",
|
|
60
|
+
};
|
|
61
|
+
// ─── provenance builder ──────────────────────────────────────────────────
|
|
62
|
+
function provenanceForScene(scene, outcome) {
|
|
63
|
+
const attempted = outcome?.attemptedProviders;
|
|
64
|
+
const source = (attempted && attempted.length > 0 ? attempted[0] : undefined) ??
|
|
65
|
+
scene.preferredProvider ??
|
|
66
|
+
scene.strategy;
|
|
67
|
+
return {
|
|
68
|
+
tier: scene.tier,
|
|
69
|
+
source,
|
|
70
|
+
modelKey: outcome?.modelKey ?? scene.preferredModel,
|
|
71
|
+
prompt: scene.prompt,
|
|
72
|
+
assetHash: outcome?.assetHash,
|
|
73
|
+
creditsSpent: outcome?.creditsSpent ?? scene.estimatedCredits,
|
|
74
|
+
generationId: outcome?.generationId,
|
|
75
|
+
// P-UNS-2: visible-credit attribution for licenses that require it (Unsplash).
|
|
76
|
+
attribution: outcome?.attribution,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
// ─── overlay role → text styling defaults ────────────────────────────────
|
|
80
|
+
function fontSizeForOverlay(o, frameHeight) {
|
|
81
|
+
// Explicit px wins.
|
|
82
|
+
if (typeof o.fontSize === "number")
|
|
83
|
+
return o.fontSize;
|
|
84
|
+
// sizePct (2–20% of frame height) → px. Resolution-independent.
|
|
85
|
+
if (typeof o.sizePct === "number") {
|
|
86
|
+
return Math.max(8, Math.round((o.sizePct / 100) * frameHeight));
|
|
87
|
+
}
|
|
88
|
+
switch (o.role) {
|
|
89
|
+
case "headline":
|
|
90
|
+
return 96;
|
|
91
|
+
case "cta":
|
|
92
|
+
return 72;
|
|
93
|
+
case "subheadline":
|
|
94
|
+
case "body":
|
|
95
|
+
return 48;
|
|
96
|
+
case "watermark":
|
|
97
|
+
case "disclaimer":
|
|
98
|
+
case "label":
|
|
99
|
+
return 28;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function fontWeightForOverlay(o) {
|
|
103
|
+
if (o.weight) {
|
|
104
|
+
return { regular: 400, medium: 500, bold: 700, black: 900 }[o.weight];
|
|
105
|
+
}
|
|
106
|
+
switch (o.role) {
|
|
107
|
+
case "headline":
|
|
108
|
+
case "cta":
|
|
109
|
+
return 900;
|
|
110
|
+
case "subheadline":
|
|
111
|
+
return 700;
|
|
112
|
+
case "watermark":
|
|
113
|
+
case "disclaimer":
|
|
114
|
+
return 400;
|
|
115
|
+
default:
|
|
116
|
+
return 700;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Build the TextClip[] for a single scene's overlays at a known timeline
|
|
121
|
+
* offset. Extracted from the planToProject loop so the regen handlers
|
|
122
|
+
* (Stage 6 slice 4) can splice fresh overlays into projectJson without
|
|
123
|
+
* duplicating the role → font/size/weight mapping. Pure / no I/O.
|
|
124
|
+
*
|
|
125
|
+
* `offsetMs` is the scene's start on the master timeline (cumulative sum
|
|
126
|
+
* of prior scene durations). `sceneDurationMs` clamps any overlay.endMs
|
|
127
|
+
* that overshoots the scene.
|
|
128
|
+
*/
|
|
129
|
+
function buildOverlayClipsForScene(sceneIndex, offsetMs, sceneDurationMs, overlays, frameHeight) {
|
|
130
|
+
const clips = [];
|
|
131
|
+
for (const [oi, overlay] of overlays.entries()) {
|
|
132
|
+
const overlayFrom = offsetMs + Math.max(0, overlay.startMs ?? 0);
|
|
133
|
+
const overlayTo = offsetMs + Math.min(sceneDurationMs, overlay.endMs ?? sceneDurationMs);
|
|
134
|
+
if (overlayTo <= overlayFrom)
|
|
135
|
+
continue;
|
|
136
|
+
clips.push({
|
|
137
|
+
id: `scene-${sceneIndex}-overlay-${oi}`,
|
|
138
|
+
trackId: exports.TRACK_ID.text,
|
|
139
|
+
type: "text",
|
|
140
|
+
display: { from: overlayFrom, to: overlayTo },
|
|
141
|
+
name: overlay.role,
|
|
142
|
+
text: overlay.text,
|
|
143
|
+
fontFamily: overlay.font ?? "Poppins",
|
|
144
|
+
fontSize: fontSizeForOverlay(overlay, frameHeight),
|
|
145
|
+
fontWeight: fontWeightForOverlay(overlay),
|
|
146
|
+
color: overlay.color ?? "#ffffff",
|
|
147
|
+
align: "center",
|
|
148
|
+
backgroundColor: overlay.bgColor,
|
|
149
|
+
effects: [],
|
|
150
|
+
transform: { x: 0, y: 0, scaleX: 1, scaleY: 1, rotation: 0, opacity: 1 },
|
|
151
|
+
locked: false,
|
|
152
|
+
metadata: {
|
|
153
|
+
sceneIndex,
|
|
154
|
+
role: overlay.role,
|
|
155
|
+
position: overlay.position,
|
|
156
|
+
emphasis: overlay.emphasis,
|
|
157
|
+
animation: overlay.animation,
|
|
158
|
+
bgStyle: overlay.bgStyle,
|
|
159
|
+
sizePct: overlay.sizePct,
|
|
160
|
+
persistAcrossScenes: overlay.persistAcrossScenes ?? false,
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
return clips;
|
|
165
|
+
}
|
|
166
|
+
function makeTrack(id, kind, index, name) {
|
|
167
|
+
return {
|
|
168
|
+
id,
|
|
169
|
+
kind,
|
|
170
|
+
name,
|
|
171
|
+
index,
|
|
172
|
+
muted: false,
|
|
173
|
+
hidden: false,
|
|
174
|
+
locked: false,
|
|
175
|
+
gainDb: 0,
|
|
176
|
+
};
|
|
177
|
+
}
|