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,45 @@
|
|
|
1
|
+
import { LlmCaller } from "../agent/llmCaller";
|
|
2
|
+
import { EnhancerModelPolicy } from "./models";
|
|
3
|
+
import { EnhanceRequest, EnhanceResult } from "./types";
|
|
4
|
+
/** Dependencies the enhancer needs; defaulted to the shared singletons/policy. */
|
|
5
|
+
export interface PromptEnhancerDeps {
|
|
6
|
+
/** LLM caller. Defaults to the host-wired singleton via getLlmCaller(). */
|
|
7
|
+
llm?: LlmCaller;
|
|
8
|
+
/** Model policy. Defaults to DEFAULT_ENHANCER_MODELS (gemini-2.5-flash primary). */
|
|
9
|
+
models?: EnhancerModelPolicy;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Modular, target-aware prompt enhancer. Reusable across the video, image,
|
|
13
|
+
* avatar, and agent pipelines — same engine, per-target profiles.
|
|
14
|
+
*
|
|
15
|
+
* const enhancer = new PromptEnhancer();
|
|
16
|
+
* const { enhancedPrompt } = await enhancer.enhance({
|
|
17
|
+
* prompt: userPrompt,
|
|
18
|
+
* target: "video",
|
|
19
|
+
* context: { aspectRatio: "16:9", durationSec: 8 },
|
|
20
|
+
* });
|
|
21
|
+
*/
|
|
22
|
+
export declare class PromptEnhancer {
|
|
23
|
+
private readonly deps;
|
|
24
|
+
constructor(deps?: PromptEnhancerDeps);
|
|
25
|
+
/**
|
|
26
|
+
* Enhance a prompt. Throws if the prompt is empty or the LLM call fails
|
|
27
|
+
* (transient errors already retried by the caller). Use `enhanceSafe` when a
|
|
28
|
+
* failure must not break the host pipeline.
|
|
29
|
+
*/
|
|
30
|
+
enhance(req: EnhanceRequest): Promise<EnhanceResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Pipeline-safe variant: on ANY failure (LLM unconfigured, transient errors
|
|
33
|
+
* exhausted, schema mismatch) it logs and returns the untouched original as
|
|
34
|
+
* `enhancedPrompt` with `degraded: true`. Wiring this into a hot path can
|
|
35
|
+
* never break generation — worst case the user's raw prompt is used as-is.
|
|
36
|
+
*/
|
|
37
|
+
enhanceSafe(req: EnhanceRequest): Promise<EnhanceResult>;
|
|
38
|
+
}
|
|
39
|
+
/** Process-wide default instance; convenient for one-off calls. */
|
|
40
|
+
export declare const promptEnhancer: PromptEnhancer;
|
|
41
|
+
/** Convenience wrapper around the default instance. */
|
|
42
|
+
export declare function enhancePrompt(req: EnhanceRequest): Promise<EnhanceResult>;
|
|
43
|
+
/** Pipeline-safe convenience wrapper around the default instance. */
|
|
44
|
+
export declare function enhancePromptSafe(req: EnhanceRequest): Promise<EnhanceResult>;
|
|
45
|
+
//# sourceMappingURL=promptEnhancer.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promptEnhancer.service.d.ts","sourceRoot":"","sources":["../../../src/services/promptEnhancer/promptEnhancer.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAEL,mBAAmB,EAEpB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAkB,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAIxE,kFAAkF;AAClF,MAAM,WAAW,kBAAkB;IACjC,2EAA2E;IAC3E,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,oFAAoF;IACpF,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B;AAED;;;;;;;;;;GAUG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAqB;gBAE9B,IAAI,GAAE,kBAAuB;IAIzC;;;;OAIG;IACG,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IA+C1D;;;;;OAKG;IACG,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAmB/D;AA8DD,mEAAmE;AACnE,eAAO,MAAM,cAAc,gBAAuB,CAAC;AAEnD,uDAAuD;AACvD,wBAAgB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAEzE;AAED,qEAAqE;AACrE,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAE7E"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.promptEnhancer = exports.PromptEnhancer = void 0;
|
|
4
|
+
exports.enhancePrompt = enhancePrompt;
|
|
5
|
+
exports.enhancePromptSafe = enhancePromptSafe;
|
|
6
|
+
const logger_1 = require("../../utils/logger");
|
|
7
|
+
const llmCallerRegistry_1 = require("../agent/llmCallerRegistry");
|
|
8
|
+
const models_1 = require("./models");
|
|
9
|
+
const profiles_1 = require("./profiles");
|
|
10
|
+
const schema_1 = require("./schema");
|
|
11
|
+
const log = (0, logger_1.createLogger)("promptEnhancer");
|
|
12
|
+
/**
|
|
13
|
+
* Modular, target-aware prompt enhancer. Reusable across the video, image,
|
|
14
|
+
* avatar, and agent pipelines — same engine, per-target profiles.
|
|
15
|
+
*
|
|
16
|
+
* const enhancer = new PromptEnhancer();
|
|
17
|
+
* const { enhancedPrompt } = await enhancer.enhance({
|
|
18
|
+
* prompt: userPrompt,
|
|
19
|
+
* target: "video",
|
|
20
|
+
* context: { aspectRatio: "16:9", durationSec: 8 },
|
|
21
|
+
* });
|
|
22
|
+
*/
|
|
23
|
+
class PromptEnhancer {
|
|
24
|
+
constructor(deps = {}) {
|
|
25
|
+
this.deps = deps;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Enhance a prompt. Throws if the prompt is empty or the LLM call fails
|
|
29
|
+
* (transient errors already retried by the caller). Use `enhanceSafe` when a
|
|
30
|
+
* failure must not break the host pipeline.
|
|
31
|
+
*/
|
|
32
|
+
async enhance(req) {
|
|
33
|
+
const original = (req.prompt ?? "").trim();
|
|
34
|
+
if (!original) {
|
|
35
|
+
throw new Error("[promptEnhancer] prompt is empty");
|
|
36
|
+
}
|
|
37
|
+
const profile = (0, profiles_1.getProfile)(req.target);
|
|
38
|
+
// Resolve deps lazily at call time so the host has had a chance to wire the
|
|
39
|
+
// LlmCaller singleton during boot.
|
|
40
|
+
const llm = this.deps.llm ?? (0, llmCallerRegistry_1.getLlmCaller)();
|
|
41
|
+
const policy = this.deps.models ?? models_1.DEFAULT_ENHANCER_MODELS;
|
|
42
|
+
// An explicit per-call model override bypasses the policy + premium flag.
|
|
43
|
+
const { model, fallbackModel } = req.options?.model
|
|
44
|
+
? { model: req.options.model, fallbackModel: req.options.fallbackModel }
|
|
45
|
+
: (0, models_1.pickEnhancerModel)(policy, req.options?.premium);
|
|
46
|
+
const messages = buildMessages(profile, original, req.context);
|
|
47
|
+
const res = await llm.structured({
|
|
48
|
+
model,
|
|
49
|
+
fallbackModel,
|
|
50
|
+
schema: schema_1.EnhancedPromptSchema,
|
|
51
|
+
schemaName: "EnhancedPrompt",
|
|
52
|
+
messages,
|
|
53
|
+
temperature: req.options?.temperature ?? profile.defaultTemperature,
|
|
54
|
+
maxTokens: req.options?.maxTokens ?? profile.defaultMaxTokens,
|
|
55
|
+
});
|
|
56
|
+
const enhanced = (res.data.enhancedPrompt ?? "").trim();
|
|
57
|
+
// Defensive: if the model returned nothing usable, fall back to the original
|
|
58
|
+
// rather than handing an empty prompt to a generation model.
|
|
59
|
+
const enhancedPrompt = enhanced.length > 0 ? enhanced : original;
|
|
60
|
+
return {
|
|
61
|
+
enhancedPrompt,
|
|
62
|
+
originalPrompt: original,
|
|
63
|
+
preservedRequirements: res.data.preservedRequirements ?? [],
|
|
64
|
+
additions: res.data.additions ?? [],
|
|
65
|
+
target: req.target,
|
|
66
|
+
model: model.modelId,
|
|
67
|
+
usedFallback: res.usedFallback,
|
|
68
|
+
degraded: enhanced.length === 0,
|
|
69
|
+
usage: res.usage,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Pipeline-safe variant: on ANY failure (LLM unconfigured, transient errors
|
|
74
|
+
* exhausted, schema mismatch) it logs and returns the untouched original as
|
|
75
|
+
* `enhancedPrompt` with `degraded: true`. Wiring this into a hot path can
|
|
76
|
+
* never break generation — worst case the user's raw prompt is used as-is.
|
|
77
|
+
*/
|
|
78
|
+
async enhanceSafe(req) {
|
|
79
|
+
const original = (req.prompt ?? "").trim();
|
|
80
|
+
try {
|
|
81
|
+
return await this.enhance(req);
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
log.warn("enhance failed; falling back to original prompt", {
|
|
85
|
+
target: req.target,
|
|
86
|
+
error: err instanceof Error ? err.message : String(err),
|
|
87
|
+
});
|
|
88
|
+
return {
|
|
89
|
+
enhancedPrompt: original,
|
|
90
|
+
originalPrompt: original,
|
|
91
|
+
preservedRequirements: [],
|
|
92
|
+
additions: [],
|
|
93
|
+
target: req.target,
|
|
94
|
+
degraded: true,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.PromptEnhancer = PromptEnhancer;
|
|
100
|
+
/** Build the system + context + user messages for one enhance call. */
|
|
101
|
+
function buildMessages(profile, prompt, context) {
|
|
102
|
+
const system = `${profiles_1.BASE_PRESERVATION_CONTRACT}\n\n=== ${profile.target.toUpperCase()} MEDIUM ===\n${profile.systemPrompt}`;
|
|
103
|
+
const contextBlock = buildContextBlock(context);
|
|
104
|
+
const userContent = contextBlock
|
|
105
|
+
? `${contextBlock}\n\nUSER PROMPT:\n${prompt}`
|
|
106
|
+
: `USER PROMPT:\n${prompt}`;
|
|
107
|
+
const userMessage = { role: "user", content: userContent };
|
|
108
|
+
// Attach reference images for vision only when explicitly requested and URLs
|
|
109
|
+
// are present — the host is responsible for routing to a vision-capable model.
|
|
110
|
+
if (context?.useVision && context.referenceImages?.length) {
|
|
111
|
+
const urls = context.referenceImages
|
|
112
|
+
.map((r) => r.url)
|
|
113
|
+
.filter((u) => typeof u === "string" && u.length > 0);
|
|
114
|
+
if (urls.length) {
|
|
115
|
+
userMessage.imageUrls = urls;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return [{ role: "system", content: system }, userMessage];
|
|
119
|
+
}
|
|
120
|
+
/** Render the optional context as a compact, labelled block. Empty fields are omitted. */
|
|
121
|
+
function buildContextBlock(context) {
|
|
122
|
+
if (!context)
|
|
123
|
+
return "";
|
|
124
|
+
const lines = [];
|
|
125
|
+
if (context.modelKey)
|
|
126
|
+
lines.push(`TARGET MODEL: ${context.modelKey}`);
|
|
127
|
+
if (context.aspectRatio)
|
|
128
|
+
lines.push(`ASPECT RATIO: ${context.aspectRatio}`);
|
|
129
|
+
if (typeof context.durationSec === "number") {
|
|
130
|
+
lines.push(`DURATION: ${context.durationSec}s`);
|
|
131
|
+
}
|
|
132
|
+
if (context.persona)
|
|
133
|
+
lines.push(`PERSONA / NICHE: ${context.persona}`);
|
|
134
|
+
if (context.referenceImages?.length) {
|
|
135
|
+
const refs = context.referenceImages
|
|
136
|
+
.map((r, i) => {
|
|
137
|
+
const token = r.token ?? `@image ${i + 1}`;
|
|
138
|
+
return r.role ? ` - ${token} → ${r.role}` : ` - ${token}`;
|
|
139
|
+
})
|
|
140
|
+
.join("\n");
|
|
141
|
+
lines.push(`REFERENCE IMAGES (preserve these tokens and their roles exactly):\n${refs}`);
|
|
142
|
+
}
|
|
143
|
+
if (context.extraInstructions) {
|
|
144
|
+
lines.push(`ADDITIONAL HARD INSTRUCTIONS: ${context.extraInstructions}`);
|
|
145
|
+
}
|
|
146
|
+
return lines.length ? `CONTEXT:\n${lines.join("\n")}` : "";
|
|
147
|
+
}
|
|
148
|
+
/** Process-wide default instance; convenient for one-off calls. */
|
|
149
|
+
exports.promptEnhancer = new PromptEnhancer();
|
|
150
|
+
/** Convenience wrapper around the default instance. */
|
|
151
|
+
function enhancePrompt(req) {
|
|
152
|
+
return exports.promptEnhancer.enhance(req);
|
|
153
|
+
}
|
|
154
|
+
/** Pipeline-safe convenience wrapper around the default instance. */
|
|
155
|
+
function enhancePromptSafe(req) {
|
|
156
|
+
return exports.promptEnhancer.enhanceSafe(req);
|
|
157
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Structured output the enhancer LLM must return.
|
|
4
|
+
*
|
|
5
|
+
* The field ORDER matters: the model is asked to enumerate the user's
|
|
6
|
+
* requirements FIRST, then write the enhanced prompt, then list what it added.
|
|
7
|
+
* Forcing the enumeration up front is the core preservation guard — the model
|
|
8
|
+
* commits to the user's constraints before it starts embellishing, which makes
|
|
9
|
+
* it far less likely to silently drop or "improve" a stated requirement. The
|
|
10
|
+
* enumerated arrays also give callers a hook for a future verification pass
|
|
11
|
+
* (assert every preservedRequirement appears in enhancedPrompt).
|
|
12
|
+
*/
|
|
13
|
+
export declare const EnhancedPromptSchema: z.ZodObject<{
|
|
14
|
+
preservedRequirements: z.ZodArray<z.ZodString>;
|
|
15
|
+
enhancedPrompt: z.ZodString;
|
|
16
|
+
additions: z.ZodArray<z.ZodString>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type EnhancedPromptOutput = z.infer<typeof EnhancedPromptSchema>;
|
|
19
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/services/promptEnhancer/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB;;;;iBAiC/B,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnhancedPromptSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Structured output the enhancer LLM must return.
|
|
7
|
+
*
|
|
8
|
+
* The field ORDER matters: the model is asked to enumerate the user's
|
|
9
|
+
* requirements FIRST, then write the enhanced prompt, then list what it added.
|
|
10
|
+
* Forcing the enumeration up front is the core preservation guard — the model
|
|
11
|
+
* commits to the user's constraints before it starts embellishing, which makes
|
|
12
|
+
* it far less likely to silently drop or "improve" a stated requirement. The
|
|
13
|
+
* enumerated arrays also give callers a hook for a future verification pass
|
|
14
|
+
* (assert every preservedRequirement appears in enhancedPrompt).
|
|
15
|
+
*/
|
|
16
|
+
exports.EnhancedPromptSchema = zod_1.z.object({
|
|
17
|
+
preservedRequirements: zod_1.z
|
|
18
|
+
.array(zod_1.z.string())
|
|
19
|
+
.describe([
|
|
20
|
+
"Every concrete requirement stated or clearly implied by the user's original prompt.",
|
|
21
|
+
"Include: subjects and named entities, specific actions/events, style and mood words the",
|
|
22
|
+
"user chose, brand names, numbers (durations, counts, timestamps), reference-image",
|
|
23
|
+
"bindings (e.g. '@image 2', 'Person A'), aspect ratio, and explicit exclusions",
|
|
24
|
+
"(e.g. 'no music', 'no ground visible'). Each item here MUST appear, unchanged in meaning,",
|
|
25
|
+
"in enhancedPrompt. If the user's prompt is sparse, this list may be short — that is fine.",
|
|
26
|
+
].join(" ")),
|
|
27
|
+
enhancedPrompt: zod_1.z
|
|
28
|
+
.string()
|
|
29
|
+
.min(1)
|
|
30
|
+
.describe([
|
|
31
|
+
"The final, ready-to-use prompt. It must (a) preserve every item in preservedRequirements",
|
|
32
|
+
"with its original meaning intact, and (b) layer production-grade detail on top following",
|
|
33
|
+
"the profile's structure. Output ONLY the prompt text itself — no preamble, no markdown",
|
|
34
|
+
"fences, no commentary about what you did.",
|
|
35
|
+
].join(" ")),
|
|
36
|
+
additions: zod_1.z
|
|
37
|
+
.array(zod_1.z.string())
|
|
38
|
+
.describe([
|
|
39
|
+
"The specific details you ADDED where the user was silent or vague (e.g. color grade, lens,",
|
|
40
|
+
"lighting, camera movement, audio design, pacing). Do NOT list anything that changes or",
|
|
41
|
+
"contradicts a preserved requirement — additions only fill gaps, they never override the user.",
|
|
42
|
+
].join(" ")),
|
|
43
|
+
});
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public types for the modular Prompt Enhancer.
|
|
3
|
+
*
|
|
4
|
+
* The enhancer takes a user's raw prompt and rewrites it into a richer,
|
|
5
|
+
* production-grade prompt for a downstream generative model — while
|
|
6
|
+
* PRESERVING everything the user explicitly asked for and only ADDING detail
|
|
7
|
+
* where the user was silent. It is target-aware (video / image / avatar /
|
|
8
|
+
* agent) so the same engine produces the right idiom for each pipeline.
|
|
9
|
+
*/
|
|
10
|
+
import { ModelChoice } from "../agent/modelRouter";
|
|
11
|
+
/**
|
|
12
|
+
* Which pipeline the enhanced prompt feeds. Each target has its own profile
|
|
13
|
+
* (system prompt + rules + model routing):
|
|
14
|
+
* - "video" : cinematic text-to-video / image-to-video prompt (the richest
|
|
15
|
+
* profile — style+mood, named subjects, dynamic vs static
|
|
16
|
+
* description, timestamped shot breakdown, native audio).
|
|
17
|
+
* - "image" : single still-frame prompt (composition, lens, lighting, grade;
|
|
18
|
+
* no motion, no audio, no temporal beats).
|
|
19
|
+
* - "avatar" : talking-head performance hint over a fixed portrait + audio
|
|
20
|
+
* (expression, micro-gesture, delivery; never a new scene).
|
|
21
|
+
* - "agent" : creative-brief clarifier fed to the agent Planner (sharpens
|
|
22
|
+
* concept/audience/tone/beats; does NOT pre-explode scenes — the
|
|
23
|
+
* Planner owns scene decomposition).
|
|
24
|
+
*/
|
|
25
|
+
export type EnhanceTarget = "video" | "image" | "avatar" | "agent";
|
|
26
|
+
/**
|
|
27
|
+
* A reference image the user supplied. Its token and role are user
|
|
28
|
+
* requirements and MUST survive into the enhanced prompt unchanged.
|
|
29
|
+
*/
|
|
30
|
+
export interface ReferenceImageHint {
|
|
31
|
+
/** Token the prompt uses to refer to this image, e.g. "@image 1", "@Image2". */
|
|
32
|
+
token?: string;
|
|
33
|
+
/** What the image depicts / its role, e.g. "the pilot's face", "Person A". */
|
|
34
|
+
role?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Public URL. Only read by the enhancer when `EnhanceContext.useVision` is
|
|
37
|
+
* true and the routed model is vision-capable — otherwise it is ignored and
|
|
38
|
+
* only `token`/`role` are used.
|
|
39
|
+
*/
|
|
40
|
+
url?: string;
|
|
41
|
+
}
|
|
42
|
+
/** Optional context that lets a profile tailor the enhancement. */
|
|
43
|
+
export interface EnhanceContext {
|
|
44
|
+
/** Destination model key (e.g. "runway-gen4-turbo"). Lets profiles tune syntax/length. */
|
|
45
|
+
modelKey?: string;
|
|
46
|
+
/** Output aspect ratio, e.g. "16:9", "9:16", "2.39:1". Preserved verbatim. */
|
|
47
|
+
aspectRatio?: string;
|
|
48
|
+
/** Target duration in seconds (video/avatar). Drives shot count + timestamp budget. */
|
|
49
|
+
durationSec?: number;
|
|
50
|
+
/** Reference images the user supplied; their tokens/roles MUST be preserved. */
|
|
51
|
+
referenceImages?: ReferenceImageHint[];
|
|
52
|
+
/** Persona / niche hint (agent path), e.g. "ugc-ad". Free-form, advisory only. */
|
|
53
|
+
persona?: string;
|
|
54
|
+
/** Extra hard instructions from the caller that must also be honoured. */
|
|
55
|
+
extraInstructions?: string;
|
|
56
|
+
/**
|
|
57
|
+
* When true, attach `referenceImages[].url` to the LLM call so a
|
|
58
|
+
* vision-capable model can describe them faithfully. Host must ensure the
|
|
59
|
+
* routed model supports vision.
|
|
60
|
+
*/
|
|
61
|
+
useVision?: boolean;
|
|
62
|
+
}
|
|
63
|
+
/** Knobs for a single enhance call. */
|
|
64
|
+
export interface EnhanceOptions {
|
|
65
|
+
/** Use the premium enhancer model (higher quality, higher cost/latency). Default false. */
|
|
66
|
+
premium?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Explicit model override. Bypasses the enhancer model policy (and the
|
|
69
|
+
* `premium` flag) entirely. Provider must have a native caller wired.
|
|
70
|
+
*/
|
|
71
|
+
model?: ModelChoice;
|
|
72
|
+
/** Fallback used alongside `model`. Ignored unless `model` is set. */
|
|
73
|
+
fallbackModel?: ModelChoice;
|
|
74
|
+
/** Creativity. Defaults to the profile's value. Lower = more faithful. */
|
|
75
|
+
temperature?: number;
|
|
76
|
+
/** Max output tokens. Defaults to the profile's value. */
|
|
77
|
+
maxTokens?: number;
|
|
78
|
+
}
|
|
79
|
+
export interface EnhanceRequest {
|
|
80
|
+
/** The user's raw prompt. Required, non-empty after trim. */
|
|
81
|
+
prompt: string;
|
|
82
|
+
/** Which pipeline this prompt feeds. */
|
|
83
|
+
target: EnhanceTarget;
|
|
84
|
+
context?: EnhanceContext;
|
|
85
|
+
options?: EnhanceOptions;
|
|
86
|
+
}
|
|
87
|
+
export interface EnhanceResult {
|
|
88
|
+
/** The enhanced, ready-to-use prompt. Drop-in replacement for the raw prompt. */
|
|
89
|
+
enhancedPrompt: string;
|
|
90
|
+
/** The original prompt, verbatim (so callers can persist it as originalPrompt). */
|
|
91
|
+
originalPrompt: string;
|
|
92
|
+
/**
|
|
93
|
+
* Hard requirements the enhancer extracted from the user prompt and
|
|
94
|
+
* preserved. Useful for debugging/telemetry and a future verification pass.
|
|
95
|
+
*/
|
|
96
|
+
preservedRequirements: string[];
|
|
97
|
+
/** Detail the enhancer added where the user was silent. */
|
|
98
|
+
additions: string[];
|
|
99
|
+
/** Target this was enhanced for. */
|
|
100
|
+
target: EnhanceTarget;
|
|
101
|
+
/** Logical model id that produced the result. */
|
|
102
|
+
model?: string;
|
|
103
|
+
/** True if the fallback model produced the result. */
|
|
104
|
+
usedFallback?: boolean;
|
|
105
|
+
/** True when enhancement failed and `enhancedPrompt` is the untouched original. */
|
|
106
|
+
degraded?: boolean;
|
|
107
|
+
usage?: {
|
|
108
|
+
promptTokens?: number;
|
|
109
|
+
completionTokens?: number;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/promptEnhancer/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,mEAAmE;AACnE,MAAM,WAAW,cAAc;IAC7B,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uFAAuF;IACvF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,eAAe,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACvC,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,uCAAuC;AACvC,MAAM,WAAW,cAAc;IAC7B,2FAA2F;IAC3F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,sEAAsE;IACtE,aAAa,CAAC,EAAE,WAAW,CAAC;IAC5B,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,iFAAiF;IACjF,cAAc,EAAE,MAAM,CAAC;IACvB,mFAAmF;IACnF,cAAc,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,2DAA2D;IAC3D,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,oCAAoC;IACpC,MAAM,EAAE,aAAa,CAAC;IACtB,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9D"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ESocialProvider } from "../../globals/types";
|
|
2
|
+
/**
|
|
3
|
+
* X8 Social Suite — E1: AI caption / hashtag / title generation (Phase 6 AI
|
|
4
|
+
* growth layer). Pure, dependency-free core: builds the LLM prompt, parses +
|
|
5
|
+
* clamps the model's JSON, and exposes `generateSocialSuggestionsCore(llm, ctx)`
|
|
6
|
+
* with the LLM injected so it's unit-/eval-testable away from the OpenAI client
|
|
7
|
+
* (planner-style `*Core(llm,…)` convention — see L-3/L-5).
|
|
8
|
+
*
|
|
9
|
+
* One round-trip produces a platform-agnostic BASE (caption + hashtags + title)
|
|
10
|
+
* that fills the composer's main fields, PLUS per-platform VARIANTS tailored to
|
|
11
|
+
* each requested provider's norms (char limits, hashtag conventions, title use)
|
|
12
|
+
* that pre-seed the composer's per-platform overrides. The composer applies the
|
|
13
|
+
* base by default and reveals the variants progressively (pro depth, beginner
|
|
14
|
+
* surface — plan §B1/§E1).
|
|
15
|
+
*/
|
|
16
|
+
/** Input context for a suggestion request (no secrets — safe to log). */
|
|
17
|
+
export interface ISocialSuggestionContext {
|
|
18
|
+
/** Providers to tailor per-platform variants for (the composer's targets). */
|
|
19
|
+
providers: ESocialProvider[];
|
|
20
|
+
/** Title of the source video, if any. */
|
|
21
|
+
videoTitle?: string;
|
|
22
|
+
/** What the video is about — prompt / script summary that grounds the copy. */
|
|
23
|
+
videoSummary?: string;
|
|
24
|
+
/** ISO-639-1 / locale to WRITE the copy in (defaults to English). */
|
|
25
|
+
language?: string;
|
|
26
|
+
/** Optional brand-voice / tone steer (e.g. "playful, no emojis"). */
|
|
27
|
+
tone?: string;
|
|
28
|
+
}
|
|
29
|
+
/** A per-platform tailored caption + hashtag set. */
|
|
30
|
+
export interface ISocialSuggestionVariant {
|
|
31
|
+
provider: ESocialProvider;
|
|
32
|
+
caption: string;
|
|
33
|
+
hashtags: string[];
|
|
34
|
+
}
|
|
35
|
+
/** The full suggestion the composer renders. */
|
|
36
|
+
export interface ISocialSuggestion {
|
|
37
|
+
/** Platform-agnostic caption the composer fills into the main field. */
|
|
38
|
+
caption: string;
|
|
39
|
+
/** Platform-agnostic hashtag set (no leading '#', deduped). */
|
|
40
|
+
hashtags: string[];
|
|
41
|
+
/** Title (used by YouTube; harmless to ignore on caption-only platforms). */
|
|
42
|
+
title: string;
|
|
43
|
+
/** Per-platform variants for the requested providers (best-effort). */
|
|
44
|
+
variants: ISocialSuggestionVariant[];
|
|
45
|
+
}
|
|
46
|
+
/** A minimal LLM call: take chat messages, return the raw text completion. */
|
|
47
|
+
export type SuggestionLlm = (messages: Array<{
|
|
48
|
+
role: "system" | "user";
|
|
49
|
+
content: string;
|
|
50
|
+
}>) => Promise<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Per-platform copy norms. `maxChars` clamps the caption; `maxHashtags` caps the
|
|
53
|
+
* tag list; `note` is fed to the model so each variant reads native to the
|
|
54
|
+
* platform. Hard limits (X = 280) are real product constraints, not style.
|
|
55
|
+
*/
|
|
56
|
+
interface PlatformCopyHint {
|
|
57
|
+
maxChars: number;
|
|
58
|
+
maxHashtags: number;
|
|
59
|
+
note: string;
|
|
60
|
+
}
|
|
61
|
+
export declare const PLATFORM_COPY_HINTS: Record<ESocialProvider, PlatformCopyHint>;
|
|
62
|
+
/** Build the chat prompt for a suggestion request. Pure — no I/O. */
|
|
63
|
+
export declare function buildSuggestionPrompt(ctx: ISocialSuggestionContext): Array<{
|
|
64
|
+
role: "system" | "user";
|
|
65
|
+
content: string;
|
|
66
|
+
}>;
|
|
67
|
+
/**
|
|
68
|
+
* Parse + validate + clamp the model's JSON into an `ISocialSuggestion`.
|
|
69
|
+
* Defensive: malformed JSON degrades to a plain caption (the raw text) with no
|
|
70
|
+
* hashtags/variants rather than throwing, so the composer always gets something
|
|
71
|
+
* usable. Variants are kept only for providers the caller actually requested.
|
|
72
|
+
*/
|
|
73
|
+
export declare function parseSocialSuggestion(raw: string, ctx: ISocialSuggestionContext): ISocialSuggestion;
|
|
74
|
+
/**
|
|
75
|
+
* Generate social suggestions with the LLM injected (testable). Builds the
|
|
76
|
+
* prompt, calls the model, parses + clamps the result. Never throws on a bad
|
|
77
|
+
* model response — it degrades to a usable caption (see `parseSocialSuggestion`).
|
|
78
|
+
*/
|
|
79
|
+
export declare function generateSocialSuggestionsCore(llm: SuggestionLlm, ctx: ISocialSuggestionContext): Promise<ISocialSuggestion>;
|
|
80
|
+
export {};
|
|
81
|
+
//# sourceMappingURL=captionGen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captionGen.d.ts","sourceRoot":"","sources":["../../../src/services/socialAI/captionGen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AAEH,yEAAyE;AACzE,MAAM,WAAW,wBAAwB;IACvC,8EAA8E;IAC9E,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qDAAqD;AACrD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,gDAAgD;AAChD,MAAM,WAAW,iBAAiB;IAChC,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,QAAQ,EAAE,wBAAwB,EAAE,CAAC;CACtC;AAED,8EAA8E;AAC9E,MAAM,MAAM,aAAa,GAAG,CAC1B,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,KAC1D,OAAO,CAAC,MAAM,CAAC,CAAC;AAErB;;;;GAIG;AACH,UAAU,gBAAgB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,eAAe,EAAE,gBAAgB,CAyCzE,CAAC;AAqCF,qEAAqE;AACrE,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,wBAAwB,GAC5B,KAAK,CAAC;IAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAkDrD;AAYD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,wBAAwB,GAC5B,iBAAiB,CA2DnB;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,GAAG,EAAE,aAAa,EAClB,GAAG,EAAE,wBAAwB,GAC5B,OAAO,CAAC,iBAAiB,CAAC,CAI5B"}
|