vidspotai-shared 1.0.82 → 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 +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 +87 -243
- 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,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MIN_SEGMENT_MS = void 0;
|
|
4
|
+
exports.totalSegmentMs = totalSegmentMs;
|
|
5
|
+
exports.clampSegments = clampSegments;
|
|
6
|
+
exports.remapCaptionWords = remapCaptionWords;
|
|
7
|
+
exports.buildEditProject = buildEditProject;
|
|
8
|
+
const project_schema_1 = require("../../../schemas/project.schema");
|
|
9
|
+
/**
|
|
10
|
+
* Stream L · L-5 — pure assembly helpers for the edit-existing pipeline.
|
|
11
|
+
*
|
|
12
|
+
* Everything here is deterministic + IO-free so it can be unit/eval-tested
|
|
13
|
+
* without spend: segment clamping/ordering, caption-word remapping onto the
|
|
14
|
+
* cut timeline, and building the editable Project JSON (a single video track
|
|
15
|
+
* of source-trim clips, the same primitive the extend-chain layout uses).
|
|
16
|
+
*/
|
|
17
|
+
/** Drop kept spans shorter than this (sub-half-second slivers aren't usable cuts). */
|
|
18
|
+
exports.MIN_SEGMENT_MS = 400;
|
|
19
|
+
/** Total kept duration across segments, ms. */
|
|
20
|
+
function totalSegmentMs(segments) {
|
|
21
|
+
return segments.reduce((sum, s) => sum + Math.max(0, s.endMs - s.startMs), 0);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Clamp segments into [0, sourceDurationMs], sort chronologically, remove
|
|
25
|
+
* overlaps (a later segment that starts before the previous one ended is
|
|
26
|
+
* pushed forward; if that collapses it, it's dropped), and drop slivers below
|
|
27
|
+
* MIN_SEGMENT_MS. Idempotent — safe to run on already-clean input.
|
|
28
|
+
*/
|
|
29
|
+
function clampSegments(segments, sourceDurationMs) {
|
|
30
|
+
const bounded = segments
|
|
31
|
+
.map((s) => {
|
|
32
|
+
const startMs = Math.max(0, Math.min(s.startMs, sourceDurationMs));
|
|
33
|
+
const endMs = Math.max(0, Math.min(s.endMs, sourceDurationMs));
|
|
34
|
+
return { ...s, startMs, endMs };
|
|
35
|
+
})
|
|
36
|
+
.filter((s) => s.endMs - s.startMs >= exports.MIN_SEGMENT_MS)
|
|
37
|
+
.sort((a, b) => a.startMs - b.startMs);
|
|
38
|
+
const out = [];
|
|
39
|
+
let prevEnd = 0;
|
|
40
|
+
for (const s of bounded) {
|
|
41
|
+
const start = Math.max(s.startMs, prevEnd);
|
|
42
|
+
if (s.endMs - start < exports.MIN_SEGMENT_MS)
|
|
43
|
+
continue; // collapsed by overlap removal
|
|
44
|
+
out.push({ ...s, startMs: start, endMs: s.endMs });
|
|
45
|
+
prevEnd = s.endMs;
|
|
46
|
+
}
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Remap word timings from the SOURCE timeline onto the concatenated cut
|
|
51
|
+
* timeline (0-based at the start of the first kept segment). Only words that
|
|
52
|
+
* fall inside a kept segment survive; each is clamped to its segment and
|
|
53
|
+
* shifted by the cumulative offset of that segment in the output.
|
|
54
|
+
*/
|
|
55
|
+
function remapCaptionWords(words, segments) {
|
|
56
|
+
const out = [];
|
|
57
|
+
let cumulative = 0;
|
|
58
|
+
for (const seg of segments) {
|
|
59
|
+
const segLen = seg.endMs - seg.startMs;
|
|
60
|
+
for (const w of words) {
|
|
61
|
+
// Keep words that overlap the segment at all; clamp to segment bounds.
|
|
62
|
+
if (w.end <= seg.startMs || w.start >= seg.endMs)
|
|
63
|
+
continue;
|
|
64
|
+
const start = Math.max(w.start, seg.startMs) - seg.startMs + cumulative;
|
|
65
|
+
const end = Math.min(w.end, seg.endMs) - seg.startMs + cumulative;
|
|
66
|
+
if (end <= start)
|
|
67
|
+
continue;
|
|
68
|
+
out.push({ word: w.text, start, end });
|
|
69
|
+
}
|
|
70
|
+
cumulative += segLen;
|
|
71
|
+
}
|
|
72
|
+
return out.sort((a, b) => a.start - b.start);
|
|
73
|
+
}
|
|
74
|
+
const VIDEO_TRACK_ID = "track-video";
|
|
75
|
+
const CAPTION_TRACK_ID = "track-caption";
|
|
76
|
+
/**
|
|
77
|
+
* Build an editable Project JSON for the re-edit. The highlight clips reference
|
|
78
|
+
* the ORIGINAL source URL with trims (lossless — the user can re-extend a cut
|
|
79
|
+
* in the editor), intro/outro reference their own URLs, and captions (if any)
|
|
80
|
+
* land on a dedicated track over the highlight region. Validated against
|
|
81
|
+
* ProjectSchema before returning, so the editor + renderer accept it as-is.
|
|
82
|
+
*/
|
|
83
|
+
function buildEditProject(args) {
|
|
84
|
+
const fps = args.fps ?? 30;
|
|
85
|
+
const clips = [];
|
|
86
|
+
let cursor = 0;
|
|
87
|
+
if (args.intro && args.intro.durationMs > 0) {
|
|
88
|
+
clips.push({
|
|
89
|
+
id: "intro",
|
|
90
|
+
trackId: VIDEO_TRACK_ID,
|
|
91
|
+
type: "video",
|
|
92
|
+
src: args.intro.url,
|
|
93
|
+
display: { from: 0, to: args.intro.durationMs },
|
|
94
|
+
name: "Intro",
|
|
95
|
+
provenance: { tier: "T0", source: "user-upload" },
|
|
96
|
+
metadata: { editRole: "intro" },
|
|
97
|
+
});
|
|
98
|
+
cursor = args.intro.durationMs;
|
|
99
|
+
}
|
|
100
|
+
const highlightStart = cursor;
|
|
101
|
+
args.segments.forEach((seg, i) => {
|
|
102
|
+
const dur = seg.endMs - seg.startMs;
|
|
103
|
+
clips.push({
|
|
104
|
+
id: `clip-${i}`,
|
|
105
|
+
trackId: VIDEO_TRACK_ID,
|
|
106
|
+
type: "video",
|
|
107
|
+
src: args.sourceVideoUrl,
|
|
108
|
+
trim: { from: seg.startMs, to: seg.endMs },
|
|
109
|
+
display: { from: cursor, to: cursor + dur },
|
|
110
|
+
name: seg.label ?? `Highlight ${i + 1}`,
|
|
111
|
+
provenance: { tier: "T0", source: "edit-existing" },
|
|
112
|
+
metadata: {
|
|
113
|
+
editSegmentIndex: i,
|
|
114
|
+
sourceStartMs: seg.startMs,
|
|
115
|
+
sourceEndMs: seg.endMs,
|
|
116
|
+
reason: seg.reason,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
cursor += dur;
|
|
120
|
+
});
|
|
121
|
+
const highlightEnd = cursor;
|
|
122
|
+
if (args.outro && args.outro.durationMs > 0) {
|
|
123
|
+
clips.push({
|
|
124
|
+
id: "outro",
|
|
125
|
+
trackId: VIDEO_TRACK_ID,
|
|
126
|
+
type: "video",
|
|
127
|
+
src: args.outro.url,
|
|
128
|
+
display: { from: cursor, to: cursor + args.outro.durationMs },
|
|
129
|
+
name: "Outro",
|
|
130
|
+
provenance: { tier: "T0", source: "user-upload" },
|
|
131
|
+
metadata: { editRole: "outro" },
|
|
132
|
+
});
|
|
133
|
+
cursor += args.outro.durationMs;
|
|
134
|
+
}
|
|
135
|
+
const tracks = [
|
|
136
|
+
{ id: VIDEO_TRACK_ID, kind: "video", name: "Video", index: 0 },
|
|
137
|
+
];
|
|
138
|
+
if (args.captionWords && args.captionWords.length > 0 && highlightEnd > highlightStart) {
|
|
139
|
+
tracks.push({
|
|
140
|
+
id: CAPTION_TRACK_ID,
|
|
141
|
+
kind: "caption",
|
|
142
|
+
name: "Captions",
|
|
143
|
+
index: 1,
|
|
144
|
+
});
|
|
145
|
+
clips.push({
|
|
146
|
+
id: "captions",
|
|
147
|
+
trackId: CAPTION_TRACK_ID,
|
|
148
|
+
type: "caption",
|
|
149
|
+
display: { from: highlightStart, to: highlightEnd },
|
|
150
|
+
text: args.captionWords.map((w) => w.word).join(" "),
|
|
151
|
+
words: args.captionWords,
|
|
152
|
+
language: args.captionLanguage ?? "en",
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
const totalMs = Math.max(cursor, 1);
|
|
156
|
+
const raw = {
|
|
157
|
+
schemaVersion: project_schema_1.PROJECT_SCHEMA_VERSION,
|
|
158
|
+
id: args.projectId,
|
|
159
|
+
name: args.name,
|
|
160
|
+
durationMs: totalMs,
|
|
161
|
+
fps,
|
|
162
|
+
size: { width: args.size.width, height: args.size.height },
|
|
163
|
+
aspect: args.aspect,
|
|
164
|
+
tracks,
|
|
165
|
+
clips,
|
|
166
|
+
agentRunId: args.agentRunId,
|
|
167
|
+
metadata: { producedBy: "edit-existing" },
|
|
168
|
+
createdAt: args.now,
|
|
169
|
+
updatedAt: args.now,
|
|
170
|
+
};
|
|
171
|
+
return project_schema_1.ProjectSchema.parse(raw);
|
|
172
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Stream L · L-5 — "edit-existing" pipeline schemas.
|
|
4
|
+
*
|
|
5
|
+
* This pipeline is DELIBERATELY separate from the planner: there is no brief,
|
|
6
|
+
* no persona, no VideoPlan. The user hands us a finished source video; we run
|
|
7
|
+
* ASR, let an LLM pick the highlight segments, ffmpeg-cut them, and reassemble
|
|
8
|
+
* a tighter cut (podcast clipping, vlog re-edit, interview highlights).
|
|
9
|
+
*
|
|
10
|
+
* Two artifacts come out the far end:
|
|
11
|
+
* 1. a stitched MP4 (the deliverable — fast, no Remotion render needed), and
|
|
12
|
+
* 2. an editable Project JSON (source-trim video clips) so the user can
|
|
13
|
+
* keep editing + re-render in the in-frontend editor.
|
|
14
|
+
*
|
|
15
|
+
* Like the rest of the agent surface, the PURE logic (segment math, caption
|
|
16
|
+
* remap, project assembly, highlight validation) lives in `shared` so it is
|
|
17
|
+
* testable + eval-able; the IO-heavy stages (download, ASR poll, ffmpeg,
|
|
18
|
+
* upload) live in the node-express worker where ffmpeg + the stitcher already
|
|
19
|
+
* are.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* What the user wants out of the re-edit. Each goal nudges the highlight
|
|
23
|
+
* picker's prompt (see highlightPicker.ts) toward a different selection bias:
|
|
24
|
+
* - highlights : the single best moments, agnostic of format
|
|
25
|
+
* - podcast-clips : self-contained quotable segments (social clips)
|
|
26
|
+
* - vlog-reedit : keep narrative flow, cut dead air / filler
|
|
27
|
+
* - interview-highlights : strongest Q→A exchanges, speaker-aware
|
|
28
|
+
*/
|
|
29
|
+
export declare const EditGoalSchema: z.ZodEnum<{
|
|
30
|
+
highlights: "highlights";
|
|
31
|
+
"podcast-clips": "podcast-clips";
|
|
32
|
+
"vlog-reedit": "vlog-reedit";
|
|
33
|
+
"interview-highlights": "interview-highlights";
|
|
34
|
+
}>;
|
|
35
|
+
export type EditGoal = z.infer<typeof EditGoalSchema>;
|
|
36
|
+
export declare const EditExistingRequestSchema: z.ZodObject<{
|
|
37
|
+
sourceVideoUrl: z.ZodString;
|
|
38
|
+
sourceDurationSec: z.ZodNumber;
|
|
39
|
+
editGoal: z.ZodEnum<{
|
|
40
|
+
highlights: "highlights";
|
|
41
|
+
"podcast-clips": "podcast-clips";
|
|
42
|
+
"vlog-reedit": "vlog-reedit";
|
|
43
|
+
"interview-highlights": "interview-highlights";
|
|
44
|
+
}>;
|
|
45
|
+
targetDurationSec: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
maxClips: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
language: z.ZodOptional<z.ZodString>;
|
|
48
|
+
addCaptions: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
49
|
+
aspect: z.ZodOptional<z.ZodEnum<{
|
|
50
|
+
"9:16": "9:16";
|
|
51
|
+
"1:1": "1:1";
|
|
52
|
+
"4:5": "4:5";
|
|
53
|
+
"16:9": "16:9";
|
|
54
|
+
}>>;
|
|
55
|
+
introUrl: z.ZodOptional<z.ZodString>;
|
|
56
|
+
outroUrl: z.ZodOptional<z.ZodString>;
|
|
57
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
58
|
+
title: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, z.core.$strict>;
|
|
60
|
+
export type EditExistingRequest = z.infer<typeof EditExistingRequestSchema>;
|
|
61
|
+
export declare const HighlightSegmentSchema: z.ZodObject<{
|
|
62
|
+
startMs: z.ZodNumber;
|
|
63
|
+
endMs: z.ZodNumber;
|
|
64
|
+
reason: z.ZodString;
|
|
65
|
+
label: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, z.core.$strict>;
|
|
67
|
+
export type HighlightSegment = z.infer<typeof HighlightSegmentSchema>;
|
|
68
|
+
export declare const HighlightSelectionSchema: z.ZodObject<{
|
|
69
|
+
segments: z.ZodArray<z.ZodObject<{
|
|
70
|
+
startMs: z.ZodNumber;
|
|
71
|
+
endMs: z.ZodNumber;
|
|
72
|
+
reason: z.ZodString;
|
|
73
|
+
label: z.ZodOptional<z.ZodString>;
|
|
74
|
+
}, z.core.$strict>>;
|
|
75
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
export type HighlightSelection = z.infer<typeof HighlightSelectionSchema>;
|
|
78
|
+
/**
|
|
79
|
+
* Tiny job envelope — same design rule as AgentRunJobPayload: the full request
|
|
80
|
+
* lives on `agentProjects/{projectId}` (the controller stows it under
|
|
81
|
+
* `editRequest`), the worker reads it from Firestore at job start. Keeps the
|
|
82
|
+
* Redis stream light.
|
|
83
|
+
*/
|
|
84
|
+
export declare const EditJobPayloadSchema: z.ZodObject<{
|
|
85
|
+
runId: z.ZodString;
|
|
86
|
+
projectId: z.ZodString;
|
|
87
|
+
userId: z.ZodString;
|
|
88
|
+
enqueuedAt: z.ZodNumber;
|
|
89
|
+
}, z.core.$strict>;
|
|
90
|
+
export type EditJobPayload = z.infer<typeof EditJobPayloadSchema>;
|
|
91
|
+
/**
|
|
92
|
+
* Flat USD overheads for an edit job, beyond the per-second ASR cost:
|
|
93
|
+
* - the highlight-picker LLM call (one structured Sonnet call over a
|
|
94
|
+
* transcript — a few cents), and
|
|
95
|
+
* - our ffmpeg compute (cut + normalize + concat — our own metal, but we
|
|
96
|
+
* price a token amount so the op isn't free).
|
|
97
|
+
* Kept here (not in aiModels) because edit-existing isn't a generation model.
|
|
98
|
+
*/
|
|
99
|
+
export declare const EDIT_PICKER_LLM_USD = 0.04;
|
|
100
|
+
export declare const EDIT_COMPUTE_USD = 0.06;
|
|
101
|
+
/**
|
|
102
|
+
* Speaker diarization is only worth its surcharge when the picker is
|
|
103
|
+
* speaker-aware. Interview / podcast goals benefit; plain highlights / vlog
|
|
104
|
+
* don't. Centralized so the controller (estimate), the picker (prompt), and
|
|
105
|
+
* the worker (ASR submit) all agree on a single rule.
|
|
106
|
+
*/
|
|
107
|
+
export declare function editGoalUsesDiarization(goal: EditGoal): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Pure upfront credit estimate for an edit job. Used by the controller to
|
|
110
|
+
* deduct before enqueue and by the worker to reconcile (passing the real
|
|
111
|
+
* ASR-reported duration). 1 credit = $0.10 (see costPreflight.CREDIT_USD_RATE);
|
|
112
|
+
* `getCreditsFromCost` applies the per-paid-op floor + canonical rounding.
|
|
113
|
+
*/
|
|
114
|
+
export declare function estimateEditCredits(args: {
|
|
115
|
+
sourceDurationSec: number;
|
|
116
|
+
goal: EditGoal;
|
|
117
|
+
addCaptions?: boolean;
|
|
118
|
+
}): number;
|
|
119
|
+
//# sourceMappingURL=editExisting.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editExisting.schema.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/editExisting/editExisting.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;;;;;;;;;;GAkBG;AAIH;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;;;;EAKzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAItD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;kBAkC3B,CAAC;AACZ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAI5E,eAAO,MAAM,sBAAsB;;;;;kBAe/B,CAAC;AACL,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,wBAAwB;;;;;;;;kBAM1B,CAAC;AACZ,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAI1E;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;kBAOtB,CAAC;AACZ,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAIlE;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAMrC;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,MAAM,CAUT"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EDIT_COMPUTE_USD = exports.EDIT_PICKER_LLM_USD = exports.EditJobPayloadSchema = exports.HighlightSelectionSchema = exports.HighlightSegmentSchema = exports.EditExistingRequestSchema = exports.EditGoalSchema = void 0;
|
|
4
|
+
exports.editGoalUsesDiarization = editGoalUsesDiarization;
|
|
5
|
+
exports.estimateEditCredits = estimateEditCredits;
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const project_schema_1 = require("../../../schemas/project.schema");
|
|
8
|
+
const helpers_1 = require("../../../utils/helpers");
|
|
9
|
+
/**
|
|
10
|
+
* Stream L · L-5 — "edit-existing" pipeline schemas.
|
|
11
|
+
*
|
|
12
|
+
* This pipeline is DELIBERATELY separate from the planner: there is no brief,
|
|
13
|
+
* no persona, no VideoPlan. The user hands us a finished source video; we run
|
|
14
|
+
* ASR, let an LLM pick the highlight segments, ffmpeg-cut them, and reassemble
|
|
15
|
+
* a tighter cut (podcast clipping, vlog re-edit, interview highlights).
|
|
16
|
+
*
|
|
17
|
+
* Two artifacts come out the far end:
|
|
18
|
+
* 1. a stitched MP4 (the deliverable — fast, no Remotion render needed), and
|
|
19
|
+
* 2. an editable Project JSON (source-trim video clips) so the user can
|
|
20
|
+
* keep editing + re-render in the in-frontend editor.
|
|
21
|
+
*
|
|
22
|
+
* Like the rest of the agent surface, the PURE logic (segment math, caption
|
|
23
|
+
* remap, project assembly, highlight validation) lives in `shared` so it is
|
|
24
|
+
* testable + eval-able; the IO-heavy stages (download, ASR poll, ffmpeg,
|
|
25
|
+
* upload) live in the node-express worker where ffmpeg + the stitcher already
|
|
26
|
+
* are.
|
|
27
|
+
*/
|
|
28
|
+
// ─── editing intent ────────────────────────────────────────────────────────
|
|
29
|
+
/**
|
|
30
|
+
* What the user wants out of the re-edit. Each goal nudges the highlight
|
|
31
|
+
* picker's prompt (see highlightPicker.ts) toward a different selection bias:
|
|
32
|
+
* - highlights : the single best moments, agnostic of format
|
|
33
|
+
* - podcast-clips : self-contained quotable segments (social clips)
|
|
34
|
+
* - vlog-reedit : keep narrative flow, cut dead air / filler
|
|
35
|
+
* - interview-highlights : strongest Q→A exchanges, speaker-aware
|
|
36
|
+
*/
|
|
37
|
+
exports.EditGoalSchema = zod_1.z.enum([
|
|
38
|
+
"highlights",
|
|
39
|
+
"podcast-clips",
|
|
40
|
+
"vlog-reedit",
|
|
41
|
+
"interview-highlights",
|
|
42
|
+
]);
|
|
43
|
+
// ─── request (the controller body) ───────────────────────────────────────────
|
|
44
|
+
exports.EditExistingRequestSchema = zod_1.z
|
|
45
|
+
.object({
|
|
46
|
+
/** Publicly-fetchable URL of the source video (Firebase Storage / signed). */
|
|
47
|
+
sourceVideoUrl: zod_1.z.string().url(),
|
|
48
|
+
/**
|
|
49
|
+
* Source duration in seconds — the uploader already knows this, and we
|
|
50
|
+
* need it for the UPFRONT credit estimate (ASR is billed per second). The
|
|
51
|
+
* worker reconciles against the real ASR `audioDuration` after transcription.
|
|
52
|
+
*/
|
|
53
|
+
sourceDurationSec: zod_1.z.number().positive(),
|
|
54
|
+
editGoal: exports.EditGoalSchema,
|
|
55
|
+
/**
|
|
56
|
+
* Target length of the re-edit in seconds. The picker treats this as a
|
|
57
|
+
* soft budget (selects segments whose total is within tolerance). Omitted
|
|
58
|
+
* → the picker keeps everything it judges genuinely strong.
|
|
59
|
+
*/
|
|
60
|
+
targetDurationSec: zod_1.z.number().positive().optional(),
|
|
61
|
+
/** Hard cap on number of segments the picker may keep. */
|
|
62
|
+
maxClips: zod_1.z.number().int().positive().max(50).optional(),
|
|
63
|
+
/** ASR language hint (e.g. "en", "es"). Omitted → AssemblyAI autodetect. */
|
|
64
|
+
language: zod_1.z.string().min(2).max(10).optional(),
|
|
65
|
+
/** Burn word-timed captions (built from the ASR words, remapped to the cut). */
|
|
66
|
+
addCaptions: zod_1.z.boolean().optional().default(false),
|
|
67
|
+
/** Output aspect; defaults to 16:9 (long-form source). */
|
|
68
|
+
aspect: project_schema_1.AspectSchema.optional(),
|
|
69
|
+
/** Optional intro clip prepended before the first highlight. */
|
|
70
|
+
introUrl: zod_1.z.string().url().optional(),
|
|
71
|
+
/** Optional outro clip appended after the last highlight. */
|
|
72
|
+
outroUrl: zod_1.z.string().url().optional(),
|
|
73
|
+
/** Free-form steering for the picker ("focus on the funding story", etc.). */
|
|
74
|
+
instructions: zod_1.z.string().max(2000).optional(),
|
|
75
|
+
/** Display title for the produced project. */
|
|
76
|
+
title: zod_1.z.string().max(200).optional(),
|
|
77
|
+
})
|
|
78
|
+
.strict();
|
|
79
|
+
// ─── highlight selection (LLM output) ────────────────────────────────────────
|
|
80
|
+
exports.HighlightSegmentSchema = zod_1.z
|
|
81
|
+
.object({
|
|
82
|
+
/** Inclusive start in the SOURCE timeline, ms. */
|
|
83
|
+
startMs: zod_1.z.number().nonnegative(),
|
|
84
|
+
/** Exclusive end in the SOURCE timeline, ms. Must be > startMs (refined below). */
|
|
85
|
+
endMs: zod_1.z.number().positive(),
|
|
86
|
+
/** Why this moment was kept — surfaced in the UI + useful for eval. */
|
|
87
|
+
reason: zod_1.z.string().max(500),
|
|
88
|
+
/** Short human label (e.g. "Cold open", "Q: pricing"). Optional. */
|
|
89
|
+
label: zod_1.z.string().max(120).optional(),
|
|
90
|
+
})
|
|
91
|
+
.strict()
|
|
92
|
+
.refine((s) => s.endMs > s.startMs, {
|
|
93
|
+
message: "endMs must be greater than startMs",
|
|
94
|
+
path: ["endMs"],
|
|
95
|
+
});
|
|
96
|
+
exports.HighlightSelectionSchema = zod_1.z
|
|
97
|
+
.object({
|
|
98
|
+
segments: zod_1.z.array(exports.HighlightSegmentSchema).min(1),
|
|
99
|
+
/** One-line description of the resulting cut (optional; shown in UI). */
|
|
100
|
+
summary: zod_1.z.string().max(500).optional(),
|
|
101
|
+
})
|
|
102
|
+
.strict();
|
|
103
|
+
// ─── BullMQ envelope ─────────────────────────────────────────────────────────
|
|
104
|
+
/**
|
|
105
|
+
* Tiny job envelope — same design rule as AgentRunJobPayload: the full request
|
|
106
|
+
* lives on `agentProjects/{projectId}` (the controller stows it under
|
|
107
|
+
* `editRequest`), the worker reads it from Firestore at job start. Keeps the
|
|
108
|
+
* Redis stream light.
|
|
109
|
+
*/
|
|
110
|
+
exports.EditJobPayloadSchema = zod_1.z
|
|
111
|
+
.object({
|
|
112
|
+
runId: zod_1.z.string().min(1),
|
|
113
|
+
projectId: zod_1.z.string().min(1),
|
|
114
|
+
userId: zod_1.z.string().min(1),
|
|
115
|
+
enqueuedAt: zod_1.z.number().int().nonnegative(),
|
|
116
|
+
})
|
|
117
|
+
.strict();
|
|
118
|
+
// ─── cost ────────────────────────────────────────────────────────────────────
|
|
119
|
+
/**
|
|
120
|
+
* Flat USD overheads for an edit job, beyond the per-second ASR cost:
|
|
121
|
+
* - the highlight-picker LLM call (one structured Sonnet call over a
|
|
122
|
+
* transcript — a few cents), and
|
|
123
|
+
* - our ffmpeg compute (cut + normalize + concat — our own metal, but we
|
|
124
|
+
* price a token amount so the op isn't free).
|
|
125
|
+
* Kept here (not in aiModels) because edit-existing isn't a generation model.
|
|
126
|
+
*/
|
|
127
|
+
exports.EDIT_PICKER_LLM_USD = 0.04;
|
|
128
|
+
exports.EDIT_COMPUTE_USD = 0.06;
|
|
129
|
+
/** AssemblyAI Universal-2 base rate, $/hr (mirrors AssemblyAIService). */
|
|
130
|
+
const ASR_USD_PER_HOUR = 0.15;
|
|
131
|
+
/** Diarization (speaker labels) surcharge multiplier (≈ +13%). */
|
|
132
|
+
const ASR_DIARIZATION_MULT = 1.133;
|
|
133
|
+
/**
|
|
134
|
+
* Speaker diarization is only worth its surcharge when the picker is
|
|
135
|
+
* speaker-aware. Interview / podcast goals benefit; plain highlights / vlog
|
|
136
|
+
* don't. Centralized so the controller (estimate), the picker (prompt), and
|
|
137
|
+
* the worker (ASR submit) all agree on a single rule.
|
|
138
|
+
*/
|
|
139
|
+
function editGoalUsesDiarization(goal) {
|
|
140
|
+
return goal === "interview-highlights" || goal === "podcast-clips";
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Pure upfront credit estimate for an edit job. Used by the controller to
|
|
144
|
+
* deduct before enqueue and by the worker to reconcile (passing the real
|
|
145
|
+
* ASR-reported duration). 1 credit = $0.10 (see costPreflight.CREDIT_USD_RATE);
|
|
146
|
+
* `getCreditsFromCost` applies the per-paid-op floor + canonical rounding.
|
|
147
|
+
*/
|
|
148
|
+
function estimateEditCredits(args) {
|
|
149
|
+
const diarize = editGoalUsesDiarization(args.goal);
|
|
150
|
+
const asrUsd = (ASR_USD_PER_HOUR / 3600) *
|
|
151
|
+
Math.max(0, args.sourceDurationSec) *
|
|
152
|
+
(diarize ? ASR_DIARIZATION_MULT : 1);
|
|
153
|
+
// Captions reuse the SAME transcript already produced for highlight picking,
|
|
154
|
+
// so they add no second ASR pass — no extra cost line for addCaptions today.
|
|
155
|
+
const totalUsd = asrUsd + exports.EDIT_PICKER_LLM_USD + exports.EDIT_COMPUTE_USD;
|
|
156
|
+
return (0, helpers_1.getCreditsFromCost)(totalUsd);
|
|
157
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { LlmCaller } from "../llmCaller";
|
|
2
|
+
import { EditExistingRequest, HighlightSelection } from "./editExisting.schema";
|
|
3
|
+
/**
|
|
4
|
+
* Stream L · L-5 — highlight picker. The reasoning core of the edit-existing
|
|
5
|
+
* pipeline: given an ASR transcript with word/utterance timestamps, an LLM
|
|
6
|
+
* selects the segments of the source to keep. Pure (injected LlmCaller), so
|
|
7
|
+
* the worker, scripts, and a no-spend eval can all drive it.
|
|
8
|
+
*/
|
|
9
|
+
/** Word-level ASR output (ms timestamps), as AssemblyAI returns it. */
|
|
10
|
+
export interface TranscriptWord {
|
|
11
|
+
text: string;
|
|
12
|
+
/** ms from audio start. */
|
|
13
|
+
start: number;
|
|
14
|
+
end: number;
|
|
15
|
+
speaker?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Utterance (speaker-grouped) ASR output, present when diarization is on. */
|
|
18
|
+
export interface TranscriptUtterance {
|
|
19
|
+
text: string;
|
|
20
|
+
start: number;
|
|
21
|
+
end: number;
|
|
22
|
+
speaker: string;
|
|
23
|
+
}
|
|
24
|
+
export interface TranscriptForPicking {
|
|
25
|
+
fullText: string;
|
|
26
|
+
words?: TranscriptWord[];
|
|
27
|
+
utterances?: TranscriptUtterance[];
|
|
28
|
+
/** Actual audio duration in ms (from ASR). Hard upper bound for any segment. */
|
|
29
|
+
audioDurationMs: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Render the transcript as timestamped lines the model can quote start/end
|
|
33
|
+
* from. Prefers utterances (speaker-aware, naturally chunked); falls back to
|
|
34
|
+
* grouping words into ~sentence lines by punctuation so the model still gets
|
|
35
|
+
* tight, pickable boundaries with real timestamps.
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildTranscriptLines(transcript: TranscriptForPicking): string;
|
|
38
|
+
/**
|
|
39
|
+
* Pick highlight segments from a transcript. Retries up to `maxRetries` times,
|
|
40
|
+
* feeding the model its previous problems. Throws only if every attempt yields
|
|
41
|
+
* zero usable segments.
|
|
42
|
+
*/
|
|
43
|
+
export declare function pickHighlightsCore(llm: LlmCaller, args: {
|
|
44
|
+
request: EditExistingRequest;
|
|
45
|
+
transcript: TranscriptForPicking;
|
|
46
|
+
maxRetries?: number;
|
|
47
|
+
}): Promise<HighlightSelection>;
|
|
48
|
+
//# sourceMappingURL=highlightPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlightPicker.d.ts","sourceRoot":"","sources":["../../../../src/services/agent/editExisting/highlightPicker.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EACL,mBAAmB,EAInB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAM/B;;;;;GAKG;AAEH,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,8EAA8E;AAC9E,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACnC,gFAAgF;IAChF,eAAe,EAAE,MAAM,CAAC;CACzB;AAwCD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,oBAAoB,GAAG,MAAM,CAiC7E;AAkGD;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,SAAS,EACd,IAAI,EAAE;IACJ,OAAO,EAAE,mBAAmB,CAAC;IAC7B,UAAU,EAAE,oBAAoB,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACA,OAAO,CAAC,kBAAkB,CAAC,CAyD7B"}
|