vidspotai-shared 1.0.82-dev.0 → 1.0.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/globals/aiModels/enums.d.ts +11 -1
- package/lib/globals/aiModels/enums.d.ts.map +1 -1
- package/lib/globals/aiModels/enums.js +24 -1
- package/lib/globals/aiModels/index.d.ts.map +1 -1
- package/lib/globals/aiModels/index.js +2 -0
- package/lib/globals/aiModels/providers/anthropic.d.ts +12 -0
- package/lib/globals/aiModels/providers/anthropic.d.ts.map +1 -0
- package/lib/globals/aiModels/providers/anthropic.js +88 -0
- package/lib/globals/aiModels/providers/google.d.ts.map +1 -1
- package/lib/globals/aiModels/providers/google.js +115 -10
- package/lib/globals/aiModels/providers/openai.d.ts.map +1 -1
- package/lib/globals/aiModels/providers/openai.js +63 -4
- package/lib/globals/aiModels/tierHelpers.d.ts +12 -0
- package/lib/globals/aiModels/tierHelpers.d.ts.map +1 -1
- package/lib/globals/aiModels/tierHelpers.js +83 -0
- package/lib/globals/aiModels/types.d.ts +19 -0
- package/lib/globals/aiModels/types.d.ts.map +1 -1
- package/lib/globals/types.d.ts +120 -1
- package/lib/globals/types.d.ts.map +1 -1
- package/lib/globals/types.js +135 -1
- package/lib/models/agent.model.d.ts +41 -1
- package/lib/models/agent.model.d.ts.map +1 -1
- package/lib/models/index.d.ts +1 -0
- package/lib/models/index.d.ts.map +1 -1
- package/lib/models/index.js +1 -0
- package/lib/models/social.model.d.ts +180 -0
- package/lib/models/social.model.d.ts.map +1 -0
- package/lib/models/social.model.js +2 -0
- package/lib/models/user.model.d.ts +10 -0
- package/lib/models/user.model.d.ts.map +1 -1
- package/lib/models/video.model.d.ts +6 -0
- package/lib/models/video.model.d.ts.map +1 -1
- package/lib/schemas/brief.schema.d.ts +46 -0
- package/lib/schemas/brief.schema.d.ts.map +1 -1
- package/lib/schemas/brief.schema.js +72 -1
- package/lib/schemas/index.d.ts +1 -0
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +1 -0
- package/lib/schemas/project.schema.d.ts +70 -3
- package/lib/schemas/project.schema.d.ts.map +1 -1
- package/lib/schemas/project.schema.js +12 -0
- package/lib/schemas/social.schema.d.ts +91 -0
- package/lib/schemas/social.schema.d.ts.map +1 -0
- package/lib/schemas/social.schema.js +114 -0
- package/lib/schemas/videoPlan.schema.d.ts +117 -3
- package/lib/schemas/videoPlan.schema.d.ts.map +1 -1
- package/lib/schemas/videoPlan.schema.js +141 -1
- package/lib/services/agent/chatAgent.d.ts +25 -1
- package/lib/services/agent/chatAgent.d.ts.map +1 -1
- package/lib/services/agent/chatAgent.js +145 -9
- package/lib/services/agent/costPreflight.d.ts +11 -1
- package/lib/services/agent/costPreflight.d.ts.map +1 -1
- package/lib/services/agent/costPreflight.js +18 -1
- package/lib/services/agent/covers/coverPlanner.d.ts +41 -0
- package/lib/services/agent/covers/coverPlanner.d.ts.map +1 -0
- package/lib/services/agent/covers/coverPlanner.js +278 -0
- package/lib/services/agent/covers/covers.schema.d.ts +158 -0
- package/lib/services/agent/covers/covers.schema.d.ts.map +1 -0
- package/lib/services/agent/covers/covers.schema.js +166 -0
- package/lib/services/agent/covers/index.d.ts +3 -0
- package/lib/services/agent/covers/index.d.ts.map +1 -0
- package/lib/services/agent/covers/index.js +18 -0
- package/lib/services/agent/critic.d.ts +10 -0
- package/lib/services/agent/critic.d.ts.map +1 -1
- package/lib/services/agent/critic.js +37 -1
- package/lib/services/agent/editClassifier.d.ts +4 -4
- package/lib/services/agent/editClassifier.js +2 -2
- package/lib/services/agent/editExisting/editAssembler.d.ts +78 -0
- package/lib/services/agent/editExisting/editAssembler.d.ts.map +1 -0
- package/lib/services/agent/editExisting/editAssembler.js +172 -0
- package/lib/services/agent/editExisting/editExisting.schema.d.ts +119 -0
- package/lib/services/agent/editExisting/editExisting.schema.d.ts.map +1 -0
- package/lib/services/agent/editExisting/editExisting.schema.js +157 -0
- package/lib/services/agent/editExisting/highlightPicker.d.ts +48 -0
- package/lib/services/agent/editExisting/highlightPicker.d.ts.map +1 -0
- package/lib/services/agent/editExisting/highlightPicker.js +199 -0
- package/lib/services/agent/editExisting/index.d.ts +4 -0
- package/lib/services/agent/editExisting/index.d.ts.map +1 -0
- package/lib/services/agent/editExisting/index.js +19 -0
- package/lib/services/agent/eval/recorder.d.ts +13 -1
- package/lib/services/agent/eval/recorder.d.ts.map +1 -1
- package/lib/services/agent/eval/recorder.js +59 -0
- package/lib/services/agent/eval/seedBriefs.d.ts +4 -3
- package/lib/services/agent/eval/seedBriefs.d.ts.map +1 -1
- package/lib/services/agent/eval/seedBriefs.js +283 -3
- package/lib/services/agent/eval/types.d.ts +10 -0
- package/lib/services/agent/eval/types.d.ts.map +1 -1
- package/lib/services/agent/executor/core.d.ts +70 -0
- package/lib/services/agent/executor/core.d.ts.map +1 -0
- package/lib/services/agent/executor/core.js +250 -0
- package/lib/services/agent/executor/duration.d.ts +20 -0
- package/lib/services/agent/executor/duration.d.ts.map +1 -0
- package/lib/services/agent/executor/duration.js +46 -0
- package/lib/services/agent/executor/index.d.ts +15 -0
- package/lib/services/agent/executor/index.d.ts.map +1 -0
- package/lib/services/agent/executor/index.js +32 -0
- package/lib/services/agent/executor/types.d.ts +183 -0
- package/lib/services/agent/executor/types.d.ts.map +1 -0
- package/lib/services/agent/executor/types.js +29 -0
- package/lib/services/agent/executor/visual.d.ts +32 -0
- package/lib/services/agent/executor/visual.d.ts.map +1 -0
- package/lib/services/agent/executor/visual.js +400 -0
- package/lib/services/agent/executor/voice.d.ts +17 -0
- package/lib/services/agent/executor/voice.d.ts.map +1 -0
- package/lib/services/agent/executor/voice.js +119 -0
- package/lib/services/agent/extendChain.d.ts +101 -0
- package/lib/services/agent/extendChain.d.ts.map +1 -0
- package/lib/services/agent/extendChain.js +177 -0
- package/lib/services/agent/index.d.ts +11 -1
- package/lib/services/agent/index.d.ts.map +1 -1
- package/lib/services/agent/index.js +11 -1
- package/lib/services/agent/llmCaller.d.ts +7 -8
- package/lib/services/agent/llmCaller.d.ts.map +1 -1
- package/lib/services/agent/llmCallerAnthropic.d.ts +44 -31
- package/lib/services/agent/llmCallerAnthropic.d.ts.map +1 -1
- package/lib/services/agent/llmCallerAnthropic.js +135 -60
- package/lib/services/agent/llmCallerFactory.d.ts +34 -0
- package/lib/services/agent/llmCallerFactory.d.ts.map +1 -0
- package/lib/services/agent/llmCallerFactory.js +31 -0
- package/lib/services/agent/llmCallerGemini.d.ts +62 -0
- package/lib/services/agent/llmCallerGemini.d.ts.map +1 -0
- package/lib/services/agent/llmCallerGemini.js +235 -0
- package/lib/services/agent/llmCallerOpenai.d.ts +56 -0
- package/lib/services/agent/llmCallerOpenai.d.ts.map +1 -0
- package/lib/services/agent/llmCallerOpenai.js +230 -0
- package/lib/services/agent/llmCallerRegistry.d.ts.map +1 -1
- package/lib/services/agent/llmCallerRegistry.js +7 -7
- package/lib/services/agent/llmCallerRouting.d.ts +63 -0
- package/lib/services/agent/llmCallerRouting.d.ts.map +1 -0
- package/lib/services/agent/llmCallerRouting.js +124 -0
- package/lib/services/agent/llmModelRegistry.d.ts +59 -0
- package/lib/services/agent/llmModelRegistry.d.ts.map +1 -0
- package/lib/services/agent/llmModelRegistry.js +168 -0
- package/lib/services/agent/llmRetry.d.ts +57 -0
- package/lib/services/agent/llmRetry.d.ts.map +1 -0
- package/lib/services/agent/llmRetry.js +102 -0
- package/lib/services/agent/modelRouter.d.ts +3 -3
- package/lib/services/agent/modelRouter.d.ts.map +1 -1
- package/lib/services/agent/modelRouter.js +27 -13
- package/lib/services/agent/planMutations.d.ts +54 -1
- package/lib/services/agent/planMutations.d.ts.map +1 -1
- package/lib/services/agent/planMutations.js +78 -0
- package/lib/services/agent/planner/Planner.d.ts +0 -17
- package/lib/services/agent/planner/Planner.d.ts.map +1 -1
- package/lib/services/agent/planner/Planner.js +67 -303
- package/lib/services/agent/planner/overlayRegen.d.ts +38 -0
- package/lib/services/agent/planner/overlayRegen.d.ts.map +1 -0
- package/lib/services/agent/planner/overlayRegen.js +145 -0
- package/lib/services/agent/planner/plannerMessages.d.ts +34 -0
- package/lib/services/agent/planner/plannerMessages.d.ts.map +1 -0
- package/lib/services/agent/planner/plannerMessages.js +185 -0
- package/lib/services/agent/planner/promptSections.d.ts +12 -0
- package/lib/services/agent/planner/promptSections.d.ts.map +1 -1
- package/lib/services/agent/planner/promptSections.js +57 -0
- package/lib/services/agent/planner/scriptFirstPlanner.d.ts +35 -0
- package/lib/services/agent/planner/scriptFirstPlanner.d.ts.map +1 -0
- package/lib/services/agent/planner/scriptFirstPlanner.js +140 -0
- package/lib/services/agent/planner/structuralRules.d.ts +10 -0
- package/lib/services/agent/planner/structuralRules.d.ts.map +1 -1
- package/lib/services/agent/planner/structuralRules.js +92 -9
- package/lib/services/agent/planner/validators.d.ts +18 -0
- package/lib/services/agent/planner/validators.d.ts.map +1 -1
- package/lib/services/agent/planner/validators.js +97 -0
- package/lib/services/agent/planner.d.ts +2 -1
- package/lib/services/agent/planner.d.ts.map +1 -1
- package/lib/services/agent/planner.js +5 -1
- package/lib/services/agent/priorProject.d.ts +26 -0
- package/lib/services/agent/priorProject.d.ts.map +1 -0
- package/lib/services/agent/priorProject.js +51 -0
- package/lib/services/agent/providerFallback/chains.d.ts.map +1 -1
- package/lib/services/agent/providerFallback/chains.js +27 -15
- package/lib/services/agent/repurpose/index.d.ts +3 -0
- package/lib/services/agent/repurpose/index.d.ts.map +1 -0
- package/lib/services/agent/repurpose/index.js +18 -0
- package/lib/services/agent/repurpose/repurpose.schema.d.ts +132 -0
- package/lib/services/agent/repurpose/repurpose.schema.d.ts.map +1 -0
- package/lib/services/agent/repurpose/repurpose.schema.js +144 -0
- package/lib/services/agent/repurpose/shortsPicker.d.ts +25 -0
- package/lib/services/agent/repurpose/shortsPicker.d.ts.map +1 -0
- package/lib/services/agent/repurpose/shortsPicker.js +218 -0
- package/lib/services/agent/runHelpers.d.ts +21 -2
- package/lib/services/agent/runHelpers.d.ts.map +1 -1
- package/lib/services/agent/runHelpers.js +71 -2
- package/lib/services/agent/tools/animateImage.tool.d.ts +1 -0
- package/lib/services/agent/tools/animateImage.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/animateImage.tool.js +12 -0
- package/lib/services/agent/tools/chapterOutline.tool.d.ts +42 -0
- package/lib/services/agent/tools/chapterOutline.tool.d.ts.map +1 -0
- package/lib/services/agent/tools/chapterOutline.tool.js +115 -0
- package/lib/services/agent/tools/composeScene.tool.d.ts +65 -2
- package/lib/services/agent/tools/composeScene.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/estimateCost.tool.d.ts +28 -1
- package/lib/services/agent/tools/estimateCost.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/estimateCost.tool.js +55 -7
- package/lib/services/agent/tools/extendVideo.tool.d.ts +26 -0
- package/lib/services/agent/tools/extendVideo.tool.d.ts.map +1 -0
- package/lib/services/agent/tools/extendVideo.tool.js +149 -0
- package/lib/services/agent/tools/generateScript.tool.d.ts +184 -0
- package/lib/services/agent/tools/generateScript.tool.d.ts.map +1 -0
- package/lib/services/agent/tools/generateScript.tool.js +123 -0
- package/lib/services/agent/tools/generateVideo.tool.d.ts +1 -0
- package/lib/services/agent/tools/generateVideo.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/generateVideo.tool.js +20 -1
- package/lib/services/agent/tools/index.d.ts +4 -0
- package/lib/services/agent/tools/index.d.ts.map +1 -1
- package/lib/services/agent/tools/index.js +4 -0
- package/lib/services/agent/tools/matchBrollToScript.tool.d.ts +50 -0
- package/lib/services/agent/tools/matchBrollToScript.tool.d.ts.map +1 -0
- package/lib/services/agent/tools/matchBrollToScript.tool.js +139 -0
- package/lib/services/agent/tools/planVideo.tool.d.ts +57 -1
- package/lib/services/agent/tools/planVideo.tool.d.ts.map +1 -1
- package/lib/services/agent/tools/planVideo.tool.js +3 -3
- package/lib/services/agent/tools/render.tool.d.ts +22 -1
- package/lib/services/agent/tools/render.tool.d.ts.map +1 -1
- package/lib/services/aiGen/aiGenFactory.service.d.ts.map +1 -1
- package/lib/services/aiGen/aiGenFactory.service.js +18 -3
- package/lib/services/aiGen/helpers.d.ts +8 -0
- package/lib/services/aiGen/helpers.d.ts.map +1 -1
- package/lib/services/aiGen/helpers.js +12 -0
- package/lib/services/aiGen/providers/anthropic/anthropic.service.d.ts +26 -0
- package/lib/services/aiGen/providers/anthropic/anthropic.service.d.ts.map +1 -0
- package/lib/services/aiGen/providers/anthropic/anthropic.service.js +95 -0
- package/lib/services/aiGen/providers/google/google.service.d.ts +25 -1
- package/lib/services/aiGen/providers/google/google.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/google/google.service.js +136 -237
- package/lib/services/aiGen/providers/google/googleApiKeys.d.ts +71 -0
- package/lib/services/aiGen/providers/google/googleApiKeys.d.ts.map +1 -0
- package/lib/services/aiGen/providers/google/googleApiKeys.js +137 -0
- package/lib/services/aiGen/providers/google/googleErrors.d.ts +13 -0
- package/lib/services/aiGen/providers/google/googleErrors.d.ts.map +1 -0
- package/lib/services/aiGen/providers/google/googleErrors.js +102 -0
- package/lib/services/aiGen/providers/google/googleFetch.d.ts +8 -0
- package/lib/services/aiGen/providers/google/googleFetch.d.ts.map +1 -0
- package/lib/services/aiGen/providers/google/googleFetch.js +96 -0
- package/lib/services/aiGen/providers/google/googleKeyPool.d.ts +52 -0
- package/lib/services/aiGen/providers/google/googleKeyPool.d.ts.map +1 -0
- package/lib/services/aiGen/providers/google/googleKeyPool.js +129 -0
- package/lib/services/aiGen/providers/google/googleMusic.d.ts +15 -0
- package/lib/services/aiGen/providers/google/googleMusic.d.ts.map +1 -0
- package/lib/services/aiGen/providers/google/googleMusic.js +77 -0
- package/lib/services/aiGen/providers/kling/kling.service.d.ts +7 -3
- package/lib/services/aiGen/providers/kling/kling.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/kling/kling.service.js +23 -367
- package/lib/services/aiGen/providers/kling/klingCredits.d.ts +9 -0
- package/lib/services/aiGen/providers/kling/klingCredits.d.ts.map +1 -0
- package/lib/services/aiGen/providers/kling/klingCredits.js +63 -0
- package/lib/services/aiGen/providers/kling/klingRequests.d.ts +32 -0
- package/lib/services/aiGen/providers/kling/klingRequests.d.ts.map +1 -0
- package/lib/services/aiGen/providers/kling/klingRequests.js +194 -0
- package/lib/services/aiGen/providers/kling/klingStatus.d.ts +16 -0
- package/lib/services/aiGen/providers/kling/klingStatus.d.ts.map +1 -0
- package/lib/services/aiGen/providers/kling/klingStatus.js +173 -0
- package/lib/services/aiGen/providers/pixverse/pixverse.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/pixverse/pixverse.service.js +7 -1
- package/lib/services/bullmq.service.d.ts +61 -0
- package/lib/services/bullmq.service.d.ts.map +1 -1
- package/lib/services/bullmq.service.js +124 -2
- package/lib/services/crypto/index.d.ts +2 -0
- package/lib/services/crypto/index.d.ts.map +1 -0
- package/lib/services/crypto/index.js +17 -0
- package/lib/services/crypto/tokenVault.d.ts +47 -0
- package/lib/services/crypto/tokenVault.d.ts.map +1 -0
- package/lib/services/crypto/tokenVault.js +179 -0
- package/lib/services/editor/captionStyleHint.d.ts +3 -0
- package/lib/services/editor/captionStyleHint.d.ts.map +1 -0
- package/lib/services/editor/captionStyleHint.js +112 -0
- package/lib/services/editor/planToProject.d.ts +7 -66
- package/lib/services/editor/planToProject.d.ts.map +1 -1
- package/lib/services/editor/planToProject.helpers.d.ts +40 -0
- package/lib/services/editor/planToProject.helpers.d.ts.map +1 -0
- package/lib/services/editor/planToProject.helpers.js +177 -0
- package/lib/services/editor/planToProject.js +197 -180
- package/lib/services/editor/planToProject.types.d.ts +94 -0
- package/lib/services/editor/planToProject.types.d.ts.map +1 -0
- package/lib/services/editor/planToProject.types.js +2 -0
- package/lib/services/firestore.service.d.ts +5 -0
- package/lib/services/firestore.service.d.ts.map +1 -1
- package/lib/services/firestore.service.js +13 -0
- package/lib/services/index.d.ts +13 -0
- package/lib/services/index.d.ts.map +1 -1
- package/lib/services/index.js +13 -0
- package/lib/services/promptEnhancer/index.d.ts +18 -0
- package/lib/services/promptEnhancer/index.d.ts.map +1 -0
- package/lib/services/promptEnhancer/index.js +33 -0
- package/lib/services/promptEnhancer/models.d.ts +54 -0
- package/lib/services/promptEnhancer/models.d.ts.map +1 -0
- package/lib/services/promptEnhancer/models.js +37 -0
- package/lib/services/promptEnhancer/profiles/agent.profile.d.ts +14 -0
- package/lib/services/promptEnhancer/profiles/agent.profile.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/agent.profile.js +40 -0
- package/lib/services/promptEnhancer/profiles/avatar.profile.d.ts +13 -0
- package/lib/services/promptEnhancer/profiles/avatar.profile.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/avatar.profile.js +40 -0
- package/lib/services/promptEnhancer/profiles/base.d.ts +28 -0
- package/lib/services/promptEnhancer/profiles/base.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/base.js +35 -0
- package/lib/services/promptEnhancer/profiles/image.profile.d.ts +11 -0
- package/lib/services/promptEnhancer/profiles/image.profile.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/image.profile.js +42 -0
- package/lib/services/promptEnhancer/profiles/index.d.ts +12 -0
- package/lib/services/promptEnhancer/profiles/index.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/index.js +33 -0
- package/lib/services/promptEnhancer/profiles/video.profile.d.ts +15 -0
- package/lib/services/promptEnhancer/profiles/video.profile.d.ts.map +1 -0
- package/lib/services/promptEnhancer/profiles/video.profile.js +81 -0
- package/lib/services/promptEnhancer/promptEnhancer.service.d.ts +45 -0
- package/lib/services/promptEnhancer/promptEnhancer.service.d.ts.map +1 -0
- package/lib/services/promptEnhancer/promptEnhancer.service.js +157 -0
- package/lib/services/promptEnhancer/schema.d.ts +19 -0
- package/lib/services/promptEnhancer/schema.d.ts.map +1 -0
- package/lib/services/promptEnhancer/schema.js +43 -0
- package/lib/services/promptEnhancer/types.d.ts +112 -0
- package/lib/services/promptEnhancer/types.d.ts.map +1 -0
- package/lib/services/promptEnhancer/types.js +2 -0
- package/lib/services/rateLimiter/distributedRateLimiter.service.d.ts +60 -5
- package/lib/services/rateLimiter/distributedRateLimiter.service.d.ts.map +1 -1
- package/lib/services/rateLimiter/distributedRateLimiter.service.js +184 -16
- package/lib/services/socialAI/captionGen.d.ts +81 -0
- package/lib/services/socialAI/captionGen.d.ts.map +1 -0
- package/lib/services/socialAI/captionGen.js +206 -0
- package/lib/services/socialAI/hookScore.d.ts +85 -0
- package/lib/services/socialAI/hookScore.d.ts.map +1 -0
- package/lib/services/socialAI/hookScore.js +170 -0
- package/lib/services/socialAI/index.d.ts +3 -0
- package/lib/services/socialAI/index.d.ts.map +1 -0
- package/lib/services/socialAI/index.js +18 -0
- package/lib/services/socialAccounts/index.d.ts +2 -0
- package/lib/services/socialAccounts/index.d.ts.map +1 -0
- package/lib/services/socialAccounts/index.js +17 -0
- package/lib/services/socialAccounts/socialAccountService.d.ts +25 -0
- package/lib/services/socialAccounts/socialAccountService.d.ts.map +1 -0
- package/lib/services/socialAccounts/socialAccountService.js +105 -0
- package/lib/services/socialEngage/factory.d.ts +7 -0
- package/lib/services/socialEngage/factory.d.ts.map +1 -0
- package/lib/services/socialEngage/factory.js +25 -0
- package/lib/services/socialEngage/index.d.ts +6 -0
- package/lib/services/socialEngage/index.d.ts.map +1 -0
- package/lib/services/socialEngage/index.js +21 -0
- package/lib/services/socialEngage/meta.engage.d.ts +17 -0
- package/lib/services/socialEngage/meta.engage.d.ts.map +1 -0
- package/lib/services/socialEngage/meta.engage.js +128 -0
- package/lib/services/socialEngage/metaWebhook.d.ts +50 -0
- package/lib/services/socialEngage/metaWebhook.d.ts.map +1 -0
- package/lib/services/socialEngage/metaWebhook.js +93 -0
- package/lib/services/socialEngage/types.d.ts +72 -0
- package/lib/services/socialEngage/types.d.ts.map +1 -0
- package/lib/services/socialEngage/types.js +10 -0
- package/lib/services/socialEngage/youtube.engage.d.ts +9 -0
- package/lib/services/socialEngage/youtube.engage.d.ts.map +1 -0
- package/lib/services/socialEngage/youtube.engage.js +87 -0
- package/lib/services/socialFormat/aspectGeometry.d.ts +74 -0
- package/lib/services/socialFormat/aspectGeometry.d.ts.map +1 -0
- package/lib/services/socialFormat/aspectGeometry.js +135 -0
- package/lib/services/socialFormat/index.d.ts +2 -0
- package/lib/services/socialFormat/index.d.ts.map +1 -0
- package/lib/services/socialFormat/index.js +19 -0
- package/lib/services/socialInsights/index.d.ts +3 -0
- package/lib/services/socialInsights/index.d.ts.map +1 -0
- package/lib/services/socialInsights/index.js +18 -0
- package/lib/services/socialInsights/recommendations.d.ts +131 -0
- package/lib/services/socialInsights/recommendations.d.ts.map +1 -0
- package/lib/services/socialInsights/recommendations.js +277 -0
- package/lib/services/socialInsights/timeBuckets.d.ts +35 -0
- package/lib/services/socialInsights/timeBuckets.d.ts.map +1 -0
- package/lib/services/socialInsights/timeBuckets.js +78 -0
- package/lib/services/socialMetrics/factory.d.ts +5 -0
- package/lib/services/socialMetrics/factory.d.ts.map +1 -0
- package/lib/services/socialMetrics/factory.js +24 -0
- package/lib/services/socialMetrics/index.d.ts +6 -0
- package/lib/services/socialMetrics/index.d.ts.map +1 -0
- package/lib/services/socialMetrics/index.js +21 -0
- package/lib/services/socialMetrics/meta.metrics.d.ts +22 -0
- package/lib/services/socialMetrics/meta.metrics.d.ts.map +1 -0
- package/lib/services/socialMetrics/meta.metrics.js +137 -0
- package/lib/services/socialMetrics/tiktok.metrics.d.ts +8 -0
- package/lib/services/socialMetrics/tiktok.metrics.d.ts.map +1 -0
- package/lib/services/socialMetrics/tiktok.metrics.js +43 -0
- package/lib/services/socialMetrics/types.d.ts +54 -0
- package/lib/services/socialMetrics/types.d.ts.map +1 -0
- package/lib/services/socialMetrics/types.js +2 -0
- package/lib/services/socialMetrics/youtube.metrics.d.ts +8 -0
- package/lib/services/socialMetrics/youtube.metrics.d.ts.map +1 -0
- package/lib/services/socialMetrics/youtube.metrics.js +43 -0
- package/lib/services/socialOAuth/factory.d.ts +7 -0
- package/lib/services/socialOAuth/factory.d.ts.map +1 -0
- package/lib/services/socialOAuth/factory.js +42 -0
- package/lib/services/socialOAuth/index.d.ts +11 -0
- package/lib/services/socialOAuth/index.d.ts.map +1 -0
- package/lib/services/socialOAuth/index.js +26 -0
- package/lib/services/socialOAuth/linkedin.oauth.d.ts +14 -0
- package/lib/services/socialOAuth/linkedin.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/linkedin.oauth.js +127 -0
- package/lib/services/socialOAuth/meta.oauth.d.ts +31 -0
- package/lib/services/socialOAuth/meta.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/meta.oauth.js +214 -0
- package/lib/services/socialOAuth/oauthState.d.ts +14 -0
- package/lib/services/socialOAuth/oauthState.d.ts.map +1 -0
- package/lib/services/socialOAuth/oauthState.js +66 -0
- package/lib/services/socialOAuth/pinterest.oauth.d.ts +15 -0
- package/lib/services/socialOAuth/pinterest.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/pinterest.oauth.js +126 -0
- package/lib/services/socialOAuth/threads.oauth.d.ts +14 -0
- package/lib/services/socialOAuth/threads.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/threads.oauth.js +129 -0
- package/lib/services/socialOAuth/tiktok.oauth.d.ts +15 -0
- package/lib/services/socialOAuth/tiktok.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/tiktok.oauth.js +151 -0
- package/lib/services/socialOAuth/types.d.ts +67 -0
- package/lib/services/socialOAuth/types.d.ts.map +1 -0
- package/lib/services/socialOAuth/types.js +2 -0
- package/lib/services/socialOAuth/x.oauth.d.ts +17 -0
- package/lib/services/socialOAuth/x.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/x.oauth.js +134 -0
- package/lib/services/socialOAuth/youtube.oauth.d.ts +15 -0
- package/lib/services/socialOAuth/youtube.oauth.d.ts.map +1 -0
- package/lib/services/socialOAuth/youtube.oauth.js +156 -0
- package/lib/services/socialPublish/factory.d.ts +5 -0
- package/lib/services/socialPublish/factory.d.ts.map +1 -0
- package/lib/services/socialPublish/factory.js +32 -0
- package/lib/services/socialPublish/index.d.ts +10 -0
- package/lib/services/socialPublish/index.d.ts.map +1 -0
- package/lib/services/socialPublish/index.js +25 -0
- package/lib/services/socialPublish/linkedin.publish.d.ts +9 -0
- package/lib/services/socialPublish/linkedin.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/linkedin.publish.js +143 -0
- package/lib/services/socialPublish/meta.publish.d.ts +28 -0
- package/lib/services/socialPublish/meta.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/meta.publish.js +149 -0
- package/lib/services/socialPublish/pinterest.publish.d.ts +13 -0
- package/lib/services/socialPublish/pinterest.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/pinterest.publish.js +130 -0
- package/lib/services/socialPublish/threads.publish.d.ts +12 -0
- package/lib/services/socialPublish/threads.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/threads.publish.js +96 -0
- package/lib/services/socialPublish/tiktok.publish.d.ts +13 -0
- package/lib/services/socialPublish/tiktok.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/tiktok.publish.js +118 -0
- package/lib/services/socialPublish/types.d.ts +47 -0
- package/lib/services/socialPublish/types.d.ts.map +1 -0
- package/lib/services/socialPublish/types.js +2 -0
- package/lib/services/socialPublish/x.publish.d.ts +12 -0
- package/lib/services/socialPublish/x.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/x.publish.js +147 -0
- package/lib/services/socialPublish/youtube.publish.d.ts +9 -0
- package/lib/services/socialPublish/youtube.publish.d.ts.map +1 -0
- package/lib/services/socialPublish/youtube.publish.js +107 -0
- package/lib/services/stock/index.d.ts +2 -0
- package/lib/services/stock/index.d.ts.map +1 -0
- package/lib/services/stock/index.js +17 -0
- package/lib/services/stock/realPersonSafety.d.ts +99 -0
- package/lib/services/stock/realPersonSafety.d.ts.map +1 -0
- package/lib/services/stock/realPersonSafety.js +248 -0
- package/lib/services/translation/index.d.ts +2 -0
- package/lib/services/translation/index.d.ts.map +1 -0
- package/lib/services/translation/index.js +9 -0
- package/lib/services/translation/translation.service.d.ts +50 -0
- package/lib/services/translation/translation.service.d.ts.map +1 -0
- package/lib/services/translation/translation.service.js +211 -0
- package/lib/utils/helpers.d.ts +2 -4
- package/lib/utils/helpers.d.ts.map +1 -1
- package/lib/utils/helpers.js +9 -63
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/renderTier.d.ts +26 -0
- package/lib/utils/renderTier.d.ts.map +1 -0
- package/lib/utils/renderTier.js +34 -0
- package/package.json +1 -1
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProviderRoutingLlmCaller = void 0;
|
|
4
|
+
const llmModelRegistry_1 = require("./llmModelRegistry");
|
|
5
|
+
const llmRetry_1 = require("./llmRetry");
|
|
6
|
+
class ProviderRoutingLlmCaller {
|
|
7
|
+
constructor(callers) {
|
|
8
|
+
this.callers = callers;
|
|
9
|
+
}
|
|
10
|
+
pick(model) {
|
|
11
|
+
const provider = (0, llmModelRegistry_1.providerFor)(model);
|
|
12
|
+
const caller = this.callers[provider];
|
|
13
|
+
if (!caller) {
|
|
14
|
+
throw new Error(`ProviderRoutingLlmCaller: no caller wired for provider="${provider}" ` +
|
|
15
|
+
`(model=${model.modelId}). Wire it in the host bootstrap.`);
|
|
16
|
+
}
|
|
17
|
+
return caller;
|
|
18
|
+
}
|
|
19
|
+
async chat(req) {
|
|
20
|
+
const attempted = [];
|
|
21
|
+
const run = (model) => {
|
|
22
|
+
attempted.push(model);
|
|
23
|
+
// Strip fallbackModel: the dispatcher owns fallback, the native caller
|
|
24
|
+
// should not attempt its own (it can't reach other providers anyway).
|
|
25
|
+
return this.pick(model).chat({ ...req, model, fallbackModel: undefined });
|
|
26
|
+
};
|
|
27
|
+
try {
|
|
28
|
+
const out = await run(req.model);
|
|
29
|
+
return { ...out, attemptedModels: [...attempted], usedFallback: false };
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
if (req.fallbackModel && (0, llmRetry_1.isTransientLlmError)(err)) {
|
|
33
|
+
const out = await run(req.fallbackModel);
|
|
34
|
+
return { ...out, attemptedModels: [...attempted], usedFallback: true };
|
|
35
|
+
}
|
|
36
|
+
throw err;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async structured(req) {
|
|
40
|
+
const attempted = [];
|
|
41
|
+
const run = (model) => {
|
|
42
|
+
attempted.push(model);
|
|
43
|
+
return this.pick(model).structured({
|
|
44
|
+
...req,
|
|
45
|
+
model,
|
|
46
|
+
fallbackModel: undefined,
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
const out = await run(req.model);
|
|
51
|
+
return { ...out, attemptedModels: [...attempted], usedFallback: false };
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
if (req.fallbackModel && (0, llmRetry_1.isTransientLlmError)(err)) {
|
|
55
|
+
const out = await run(req.fallbackModel);
|
|
56
|
+
return { ...out, attemptedModels: [...attempted], usedFallback: true };
|
|
57
|
+
}
|
|
58
|
+
throw err;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Forward to the chosen caller's native streaming when available; otherwise
|
|
63
|
+
* emit the full validated payload as a single chunk. Streaming does NOT apply
|
|
64
|
+
* cross-provider fallback mid-stream (matches the gateway): once bytes flow, a
|
|
65
|
+
* drop propagates and the planner's own retry loop (which awaits `result`)
|
|
66
|
+
* handles it.
|
|
67
|
+
*/
|
|
68
|
+
structuredStream(req) {
|
|
69
|
+
const caller = this.pick(req.model);
|
|
70
|
+
const streamReq = { ...req, fallbackModel: undefined };
|
|
71
|
+
if (typeof caller.structuredStream === "function") {
|
|
72
|
+
return caller.structuredStream(streamReq);
|
|
73
|
+
}
|
|
74
|
+
return this.singleChunkStream(streamReq, caller);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Anthropic (and any future non-streaming caller) path: run the blocking
|
|
78
|
+
* `structured` call, then surface its JSON as one token chunk. Failures reject
|
|
79
|
+
* the result promise and return cleanly from the generator rather than
|
|
80
|
+
* throwing — so the caller's token loop completes and its `await result`
|
|
81
|
+
* retry path fires (same contract as the streaming callers).
|
|
82
|
+
*/
|
|
83
|
+
singleChunkStream(req, caller) {
|
|
84
|
+
let resolveResult;
|
|
85
|
+
let rejectResult;
|
|
86
|
+
const result = new Promise((resolve, reject) => {
|
|
87
|
+
resolveResult = resolve;
|
|
88
|
+
rejectResult = reject;
|
|
89
|
+
});
|
|
90
|
+
const tokens = {
|
|
91
|
+
async *[Symbol.asyncIterator]() {
|
|
92
|
+
try {
|
|
93
|
+
const res = await caller.structured(req);
|
|
94
|
+
yield JSON.stringify(res.data);
|
|
95
|
+
resolveResult({
|
|
96
|
+
...res,
|
|
97
|
+
attemptedModels: res.attemptedModels ?? [req.model],
|
|
98
|
+
usedFallback: false,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
rejectResult(e);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
return { tokens, result };
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Anthropic-only server-tool path (web_search). Routes to the anthropic caller
|
|
111
|
+
* if it implements `structuredWithTools`; otherwise throws, since no other
|
|
112
|
+
* provider exposes Anthropic's server tools. Preserves the planner's
|
|
113
|
+
* useWebResearch behavior after the gateway is gone.
|
|
114
|
+
*/
|
|
115
|
+
async structuredWithTools(req) {
|
|
116
|
+
const caller = this.pick(req.model);
|
|
117
|
+
if (typeof caller.structuredWithTools !== "function") {
|
|
118
|
+
throw new Error(`ProviderRoutingLlmCaller: provider for model=${req.model.modelId} ` +
|
|
119
|
+
`does not support server-side tools (structuredWithTools).`);
|
|
120
|
+
}
|
|
121
|
+
return caller.structuredWithTools(req);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.ProviderRoutingLlmCaller = ProviderRoutingLlmCaller;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ModelChoice } from "./modelRouter";
|
|
2
|
+
/**
|
|
3
|
+
* Per-model capability registry for the native LLM callers.
|
|
4
|
+
*
|
|
5
|
+
* The gateway flattened every model to one OpenAI-compatible shape, so callers
|
|
6
|
+
* never had to know what a model could do. Native callers DO — prompt caching is
|
|
7
|
+
* Anthropic-only, `responseSchema` is Gemini's structured-output knob, etc. This
|
|
8
|
+
* registry is the single place that answers "what can model X do, and what native
|
|
9
|
+
* API id does it map to?" so callers branch on capability, not hardcoded strings.
|
|
10
|
+
*
|
|
11
|
+
* Pure + dependency-free (no SDKs, no env) so it stays unit-testable and cheap to
|
|
12
|
+
* import. Add a row when a new model joins `DEFAULT_MODEL_ROUTING` (modelRouter.ts).
|
|
13
|
+
*/
|
|
14
|
+
/** Providers we ship native callers for. */
|
|
15
|
+
export type LlmProvider = "anthropic" | "openai" | "google";
|
|
16
|
+
/** Native model ids we know are valid for their provider's SDK. */
|
|
17
|
+
export interface ModelCapabilities {
|
|
18
|
+
provider: LlmProvider;
|
|
19
|
+
/**
|
|
20
|
+
* The id passed to the provider SDK. Defaults to the logical `modelId` when a
|
|
21
|
+
* model isn't in the table (most ids are pass-through today); listed
|
|
22
|
+
* explicitly so a future rename has one place to fix.
|
|
23
|
+
*/
|
|
24
|
+
nativeModelId: string;
|
|
25
|
+
/** Accepts image input. */
|
|
26
|
+
vision: boolean;
|
|
27
|
+
/** Supports Anthropic ephemeral prompt caching (`cache_control`). */
|
|
28
|
+
promptCaching: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Native strict structured-output: OpenAI `json_schema` strict / Gemini
|
|
31
|
+
* `responseSchema` / Anthropic tool-forcing. All three native callers can
|
|
32
|
+
* always emit structured output one way or another, so this is informational
|
|
33
|
+
* (true for every row today) — kept for symmetry / future opt-outs.
|
|
34
|
+
*/
|
|
35
|
+
structuredOutput: boolean;
|
|
36
|
+
/** Anthropic extended-thinking support. */
|
|
37
|
+
extendedThinking: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Capability rows keyed by the LOGICAL model id used in `DEFAULT_MODEL_ROUTING`.
|
|
41
|
+
* Native ids are pass-through today (proven in AnthropicLlmCaller / the Gemini
|
|
42
|
+
* vision services), so `nativeModelId` mirrors the key unless a provider needs a
|
|
43
|
+
* different wire id.
|
|
44
|
+
*/
|
|
45
|
+
export declare const MODEL_CAPABILITIES: Record<string, ModelCapabilities>;
|
|
46
|
+
/**
|
|
47
|
+
* Normalize a `ModelChoice.provider` string to a known `LlmProvider`. Throws on
|
|
48
|
+
* a provider we don't ship a native caller for (e.g. the legacy `deepseek`
|
|
49
|
+
* executor fallback) — loud failure beats silently 404ing against the wrong SDK.
|
|
50
|
+
* See LLM_NATIVE_MIGRATION_PLAN decision #1.
|
|
51
|
+
*/
|
|
52
|
+
export declare function normalizeProvider(provider: string): LlmProvider;
|
|
53
|
+
/** Capabilities for a model choice — registry row if known, else provider defaults. */
|
|
54
|
+
export declare function capabilitiesFor(model: ModelChoice): ModelCapabilities;
|
|
55
|
+
/** The native SDK model id to send for a given choice. */
|
|
56
|
+
export declare function nativeModelId(model: ModelChoice): string;
|
|
57
|
+
/** Which native caller a choice routes to. */
|
|
58
|
+
export declare function providerFor(model: ModelChoice): LlmProvider;
|
|
59
|
+
//# sourceMappingURL=llmModelRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llmModelRegistry.d.ts","sourceRoot":"","sources":["../../../src/services/agent/llmModelRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;;;;;GAWG;AAEH,4CAA4C;AAC5C,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5D,mEAAmE;AACnE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,WAAW,CAAC;IACtB;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,2BAA2B;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,qEAAqE;IACrE,aAAa,EAAE,OAAO,CAAC;IACvB;;;;;OAKG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B,2CAA2C;IAC3C,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAwGhE,CAAC;AAeF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAgB/D;AAED,uFAAuF;AACvF,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,iBAAiB,CAOrE;AAED,0DAA0D;AAC1D,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAExD;AAED,8CAA8C;AAC9C,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAE3D"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MODEL_CAPABILITIES = void 0;
|
|
4
|
+
exports.normalizeProvider = normalizeProvider;
|
|
5
|
+
exports.capabilitiesFor = capabilitiesFor;
|
|
6
|
+
exports.nativeModelId = nativeModelId;
|
|
7
|
+
exports.providerFor = providerFor;
|
|
8
|
+
/**
|
|
9
|
+
* Capability rows keyed by the LOGICAL model id used in `DEFAULT_MODEL_ROUTING`.
|
|
10
|
+
* Native ids are pass-through today (proven in AnthropicLlmCaller / the Gemini
|
|
11
|
+
* vision services), so `nativeModelId` mirrors the key unless a provider needs a
|
|
12
|
+
* different wire id.
|
|
13
|
+
*/
|
|
14
|
+
exports.MODEL_CAPABILITIES = {
|
|
15
|
+
// ── Anthropic ──────────────────────────────────────────────────────────
|
|
16
|
+
"claude-haiku-4-5": {
|
|
17
|
+
provider: "anthropic",
|
|
18
|
+
nativeModelId: "claude-haiku-4-5",
|
|
19
|
+
vision: true,
|
|
20
|
+
promptCaching: true,
|
|
21
|
+
structuredOutput: true,
|
|
22
|
+
extendedThinking: true,
|
|
23
|
+
},
|
|
24
|
+
"claude-sonnet-4-6": {
|
|
25
|
+
provider: "anthropic",
|
|
26
|
+
nativeModelId: "claude-sonnet-4-6",
|
|
27
|
+
vision: true,
|
|
28
|
+
promptCaching: true,
|
|
29
|
+
structuredOutput: true,
|
|
30
|
+
extendedThinking: true,
|
|
31
|
+
},
|
|
32
|
+
// Legacy Opus tier — kept for compatibility; prefer claude-opus-4-8.
|
|
33
|
+
"claude-opus-4-7": {
|
|
34
|
+
provider: "anthropic",
|
|
35
|
+
nativeModelId: "claude-opus-4-7",
|
|
36
|
+
vision: true,
|
|
37
|
+
promptCaching: true,
|
|
38
|
+
structuredOutput: true,
|
|
39
|
+
extendedThinking: true,
|
|
40
|
+
},
|
|
41
|
+
// Current top Opus tier (released 2026-05-28). The default high-capability
|
|
42
|
+
// choice; routed as premiumPlanner.
|
|
43
|
+
"claude-opus-4-8": {
|
|
44
|
+
provider: "anthropic",
|
|
45
|
+
nativeModelId: "claude-opus-4-8",
|
|
46
|
+
vision: true,
|
|
47
|
+
promptCaching: true,
|
|
48
|
+
structuredOutput: true,
|
|
49
|
+
extendedThinking: true,
|
|
50
|
+
},
|
|
51
|
+
// ── OpenAI ─────────────────────────────────────────────────────────────
|
|
52
|
+
"gpt-5": {
|
|
53
|
+
provider: "openai",
|
|
54
|
+
nativeModelId: "gpt-5",
|
|
55
|
+
vision: true,
|
|
56
|
+
promptCaching: true,
|
|
57
|
+
structuredOutput: true,
|
|
58
|
+
extendedThinking: false,
|
|
59
|
+
},
|
|
60
|
+
// Legacy fast tier — superseded by gpt-5.4-mini.
|
|
61
|
+
"gpt-5-mini": {
|
|
62
|
+
provider: "openai",
|
|
63
|
+
nativeModelId: "gpt-5-mini",
|
|
64
|
+
vision: true,
|
|
65
|
+
promptCaching: true,
|
|
66
|
+
structuredOutput: true,
|
|
67
|
+
extendedThinking: false,
|
|
68
|
+
},
|
|
69
|
+
// Current OpenAI fast/cheap tier — supersedes gpt-5-mini. Cross-provider
|
|
70
|
+
// fallback for the prompt enhancer's primary (gemini-3.5-flash).
|
|
71
|
+
"gpt-5.4-mini": {
|
|
72
|
+
provider: "openai",
|
|
73
|
+
nativeModelId: "gpt-5.4-mini",
|
|
74
|
+
vision: true,
|
|
75
|
+
promptCaching: true,
|
|
76
|
+
structuredOutput: true,
|
|
77
|
+
extendedThinking: false,
|
|
78
|
+
},
|
|
79
|
+
// ── Google ─────────────────────────────────────────────────────────────
|
|
80
|
+
// Current frontier Flash (stable). The prompt enhancer's default primary —
|
|
81
|
+
// frontier-Flash quality + vision at low cost.
|
|
82
|
+
"gemini-3.5-flash": {
|
|
83
|
+
provider: "google",
|
|
84
|
+
nativeModelId: "gemini-3.5-flash",
|
|
85
|
+
vision: true,
|
|
86
|
+
promptCaching: true,
|
|
87
|
+
structuredOutput: true,
|
|
88
|
+
extendedThinking: false,
|
|
89
|
+
},
|
|
90
|
+
// Latest Pro tier. NOTE: no stable dateless id yet — the callable id is the
|
|
91
|
+
// `-preview` snapshot, so the logical id maps to it here. Cross-provider
|
|
92
|
+
// fallback for the enhancer's premium model.
|
|
93
|
+
"gemini-3.1-pro": {
|
|
94
|
+
provider: "google",
|
|
95
|
+
nativeModelId: "gemini-3.1-pro-preview",
|
|
96
|
+
vision: true,
|
|
97
|
+
promptCaching: true,
|
|
98
|
+
structuredOutput: true,
|
|
99
|
+
extendedThinking: false,
|
|
100
|
+
},
|
|
101
|
+
// Older Gemini tiers — cheapest, kept for cost-sensitive / high-volume paths.
|
|
102
|
+
"gemini-2.5-flash": {
|
|
103
|
+
provider: "google",
|
|
104
|
+
nativeModelId: "gemini-2.5-flash",
|
|
105
|
+
vision: true,
|
|
106
|
+
promptCaching: true,
|
|
107
|
+
structuredOutput: true,
|
|
108
|
+
extendedThinking: false,
|
|
109
|
+
},
|
|
110
|
+
"gemini-2.5-pro": {
|
|
111
|
+
provider: "google",
|
|
112
|
+
nativeModelId: "gemini-2.5-pro",
|
|
113
|
+
vision: true,
|
|
114
|
+
promptCaching: true,
|
|
115
|
+
structuredOutput: true,
|
|
116
|
+
extendedThinking: false,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
/** Default capabilities when a model id isn't in the table — derive from provider. */
|
|
120
|
+
function defaultsFor(model) {
|
|
121
|
+
const provider = normalizeProvider(model.provider);
|
|
122
|
+
return {
|
|
123
|
+
provider,
|
|
124
|
+
nativeModelId: model.modelId,
|
|
125
|
+
vision: model.vision ?? false,
|
|
126
|
+
promptCaching: provider === "anthropic",
|
|
127
|
+
structuredOutput: true,
|
|
128
|
+
extendedThinking: provider === "anthropic",
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Normalize a `ModelChoice.provider` string to a known `LlmProvider`. Throws on
|
|
133
|
+
* a provider we don't ship a native caller for (e.g. the legacy `deepseek`
|
|
134
|
+
* executor fallback) — loud failure beats silently 404ing against the wrong SDK.
|
|
135
|
+
* See LLM_NATIVE_MIGRATION_PLAN decision #1.
|
|
136
|
+
*/
|
|
137
|
+
function normalizeProvider(provider) {
|
|
138
|
+
switch (provider) {
|
|
139
|
+
case "anthropic":
|
|
140
|
+
return "anthropic";
|
|
141
|
+
case "openai":
|
|
142
|
+
return "openai";
|
|
143
|
+
case "google":
|
|
144
|
+
case "gemini":
|
|
145
|
+
return "google";
|
|
146
|
+
default:
|
|
147
|
+
throw new Error(`llmModelRegistry: no native caller for provider="${provider}". ` +
|
|
148
|
+
`Supported: anthropic, openai, google. Repoint routing/fallback off it ` +
|
|
149
|
+
`(see LLM_NATIVE_MIGRATION_PLAN decision #1).`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/** Capabilities for a model choice — registry row if known, else provider defaults. */
|
|
153
|
+
function capabilitiesFor(model) {
|
|
154
|
+
const row = exports.MODEL_CAPABILITIES[model.modelId];
|
|
155
|
+
if (row) {
|
|
156
|
+
// Honor an explicit vision flag from routing even if the row omits it.
|
|
157
|
+
return model.vision !== undefined ? { ...row, vision: model.vision } : row;
|
|
158
|
+
}
|
|
159
|
+
return defaultsFor(model);
|
|
160
|
+
}
|
|
161
|
+
/** The native SDK model id to send for a given choice. */
|
|
162
|
+
function nativeModelId(model) {
|
|
163
|
+
return capabilitiesFor(model).nativeModelId;
|
|
164
|
+
}
|
|
165
|
+
/** Which native caller a choice routes to. */
|
|
166
|
+
function providerFor(model) {
|
|
167
|
+
return capabilitiesFor(model).provider;
|
|
168
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared transient-retry primitives for the native LLM callers.
|
|
3
|
+
*
|
|
4
|
+
* Extracted (Phase 1 of LLM_NATIVE_MIGRATION_PLAN) from the duplicated transient
|
|
5
|
+
* logic that lived in the per-caller implementations. All three native callers
|
|
6
|
+
* (OpenAI / Anthropic / Gemini) and the provider-dispatching caller share this so
|
|
7
|
+
* transient classification + backoff behave identically across providers — the
|
|
8
|
+
* single gateway endpoint used to give us this uniformity for free.
|
|
9
|
+
*
|
|
10
|
+
* Contract:
|
|
11
|
+
* - `withRetry(fn)` retries `fn` up to `maxRetries` times on transient errors
|
|
12
|
+
* with exponential backoff (base, base*4, base*16, …). The FINAL failure of a
|
|
13
|
+
* transient error is re-thrown as a `TransientLlmError` so the dispatcher's
|
|
14
|
+
* cross-provider `fallbackModel` path can catch it explicitly. Non-transient
|
|
15
|
+
* errors (4xx other than 408/425/429, schema-validation, malformed JSON)
|
|
16
|
+
* propagate immediately as their original error.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Marks an error worth retrying / falling back on. The provider-dispatching caller
|
|
20
|
+
* catches this specifically to attempt `fallbackModel`; deterministic errors
|
|
21
|
+
* (bad schema, non-JSON, auth) are NOT wrapped and short-circuit the retry loop.
|
|
22
|
+
*/
|
|
23
|
+
export declare class TransientLlmError extends Error {
|
|
24
|
+
readonly cause?: unknown | undefined;
|
|
25
|
+
constructor(message: string, cause?: unknown | undefined);
|
|
26
|
+
}
|
|
27
|
+
export declare function isTransientLlmError(err: unknown): err is TransientLlmError;
|
|
28
|
+
/** HTTP statuses we treat as transient (worth a retry / fallback). */
|
|
29
|
+
export declare const TRANSIENT_HTTP_STATUSES: Set<number>;
|
|
30
|
+
/**
|
|
31
|
+
* Classify an arbitrary thrown value as transient. Covers:
|
|
32
|
+
* - SDK errors carrying a numeric `status` in TRANSIENT_HTTP_STATUSES
|
|
33
|
+
* - Node/undici network codes (ECONNRESET, ETIMEDOUT, UND_ERR_*, …)
|
|
34
|
+
* - AbortError from our own per-request timeout (treated as transient so a
|
|
35
|
+
* single slow call gets a retry / fallback instead of sinking the stage)
|
|
36
|
+
* - SDK connection-error class names + common network phrases in the message
|
|
37
|
+
*/
|
|
38
|
+
export declare function isTransientError(err: unknown): boolean;
|
|
39
|
+
export interface RetryOptions {
|
|
40
|
+
/** Max attempts on transient errors. Default 3. */
|
|
41
|
+
maxRetries?: number;
|
|
42
|
+
/** Base backoff in ms (exponential: base, base*4, base*16). Default 250. */
|
|
43
|
+
retryBaseMs?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Optional sleep override (tests inject a no-op so retries don't wall-clock).
|
|
46
|
+
* Receives the planned delay in ms.
|
|
47
|
+
*/
|
|
48
|
+
sleepImpl?: (ms: number) => Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Run `fn` with transient-error retry + exponential backoff. On the terminal
|
|
52
|
+
* attempt of a transient failure, re-throws as `TransientLlmError`. Errors
|
|
53
|
+
* already classified transient by `isTransientError` but not yet wrapped are
|
|
54
|
+
* wrapped on the final attempt; pre-wrapped `TransientLlmError`s pass through.
|
|
55
|
+
*/
|
|
56
|
+
export declare function withRetry<T>(fn: () => Promise<T>, opts?: RetryOptions): Promise<T>;
|
|
57
|
+
//# sourceMappingURL=llmRetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llmRetry.d.ts","sourceRoot":"","sources":["../../../src/services/agent/llmRetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAGxC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO;gBADxB,OAAO,EAAE,MAAM,EACN,KAAK,CAAC,EAAE,OAAO,YAAA;CAK3B;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,iBAAiB,CAE1E;AAED,sEAAsE;AACtE,eAAO,MAAM,uBAAuB,aAElC,CAAC;AAEH;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CA+BtD;AAED,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C;AAKD;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,IAAI,GAAE,YAAiB,GACtB,OAAO,CAAC,CAAC,CAAC,CA6BZ"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared transient-retry primitives for the native LLM callers.
|
|
4
|
+
*
|
|
5
|
+
* Extracted (Phase 1 of LLM_NATIVE_MIGRATION_PLAN) from the duplicated transient
|
|
6
|
+
* logic that lived in the per-caller implementations. All three native callers
|
|
7
|
+
* (OpenAI / Anthropic / Gemini) and the provider-dispatching caller share this so
|
|
8
|
+
* transient classification + backoff behave identically across providers — the
|
|
9
|
+
* single gateway endpoint used to give us this uniformity for free.
|
|
10
|
+
*
|
|
11
|
+
* Contract:
|
|
12
|
+
* - `withRetry(fn)` retries `fn` up to `maxRetries` times on transient errors
|
|
13
|
+
* with exponential backoff (base, base*4, base*16, …). The FINAL failure of a
|
|
14
|
+
* transient error is re-thrown as a `TransientLlmError` so the dispatcher's
|
|
15
|
+
* cross-provider `fallbackModel` path can catch it explicitly. Non-transient
|
|
16
|
+
* errors (4xx other than 408/425/429, schema-validation, malformed JSON)
|
|
17
|
+
* propagate immediately as their original error.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.TRANSIENT_HTTP_STATUSES = exports.TransientLlmError = void 0;
|
|
21
|
+
exports.isTransientLlmError = isTransientLlmError;
|
|
22
|
+
exports.isTransientError = isTransientError;
|
|
23
|
+
exports.withRetry = withRetry;
|
|
24
|
+
/**
|
|
25
|
+
* Marks an error worth retrying / falling back on. The provider-dispatching caller
|
|
26
|
+
* catches this specifically to attempt `fallbackModel`; deterministic errors
|
|
27
|
+
* (bad schema, non-JSON, auth) are NOT wrapped and short-circuit the retry loop.
|
|
28
|
+
*/
|
|
29
|
+
class TransientLlmError extends Error {
|
|
30
|
+
constructor(message, cause) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.cause = cause;
|
|
33
|
+
this.name = "TransientLlmError";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.TransientLlmError = TransientLlmError;
|
|
37
|
+
function isTransientLlmError(err) {
|
|
38
|
+
return err instanceof Error && err.name === "TransientLlmError";
|
|
39
|
+
}
|
|
40
|
+
/** HTTP statuses we treat as transient (worth a retry / fallback). */
|
|
41
|
+
exports.TRANSIENT_HTTP_STATUSES = new Set([
|
|
42
|
+
408, 425, 429, 500, 502, 503, 504,
|
|
43
|
+
]);
|
|
44
|
+
/**
|
|
45
|
+
* Classify an arbitrary thrown value as transient. Covers:
|
|
46
|
+
* - SDK errors carrying a numeric `status` in TRANSIENT_HTTP_STATUSES
|
|
47
|
+
* - Node/undici network codes (ECONNRESET, ETIMEDOUT, UND_ERR_*, …)
|
|
48
|
+
* - AbortError from our own per-request timeout (treated as transient so a
|
|
49
|
+
* single slow call gets a retry / fallback instead of sinking the stage)
|
|
50
|
+
* - SDK connection-error class names + common network phrases in the message
|
|
51
|
+
*/
|
|
52
|
+
function isTransientError(err) {
|
|
53
|
+
if (!err || typeof err !== "object")
|
|
54
|
+
return false;
|
|
55
|
+
const e = err;
|
|
56
|
+
if (typeof e.status === "number" && exports.TRANSIENT_HTTP_STATUSES.has(e.status)) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
const code = e.code ?? e.cause?.code;
|
|
60
|
+
if (code && /^(ECONNRESET|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|EPIPE|UND_ERR_.*)$/.test(code)) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
if (e.name === "AbortError" ||
|
|
64
|
+
e.name === "APIConnectionError" ||
|
|
65
|
+
e.name === "APIConnectionTimeoutError") {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
const msg = String(e.message ?? "");
|
|
69
|
+
return /fetch failed|socket hang up|other side closed|network|timeout|operation was aborted|ECONNRESET|ETIMEDOUT/i.test(msg);
|
|
70
|
+
}
|
|
71
|
+
const defaultSleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
72
|
+
/**
|
|
73
|
+
* Run `fn` with transient-error retry + exponential backoff. On the terminal
|
|
74
|
+
* attempt of a transient failure, re-throws as `TransientLlmError`. Errors
|
|
75
|
+
* already classified transient by `isTransientError` but not yet wrapped are
|
|
76
|
+
* wrapped on the final attempt; pre-wrapped `TransientLlmError`s pass through.
|
|
77
|
+
*/
|
|
78
|
+
async function withRetry(fn, opts = {}) {
|
|
79
|
+
const maxRetries = opts.maxRetries ?? 3;
|
|
80
|
+
const retryBaseMs = opts.retryBaseMs ?? 250;
|
|
81
|
+
const sleep = opts.sleepImpl ?? defaultSleep;
|
|
82
|
+
let lastErr;
|
|
83
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
84
|
+
try {
|
|
85
|
+
return await fn();
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
lastErr = err;
|
|
89
|
+
const transient = isTransientLlmError(err) || isTransientError(err);
|
|
90
|
+
if (!transient || attempt === maxRetries - 1) {
|
|
91
|
+
if (transient) {
|
|
92
|
+
throw isTransientLlmError(err)
|
|
93
|
+
? err
|
|
94
|
+
: new TransientLlmError(`transient LLM error after ${attempt + 1} attempts: ${String(err?.message ?? err)}`, err);
|
|
95
|
+
}
|
|
96
|
+
throw err;
|
|
97
|
+
}
|
|
98
|
+
await sleep(retryBaseMs * Math.pow(4, attempt));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
throw lastErr;
|
|
102
|
+
}
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
* - critic : vision QA across scenes, rubric-following
|
|
9
9
|
* - reference : ingest a TikTok/Reel URL, extract structure
|
|
10
10
|
*
|
|
11
|
-
* The actual LLM call is delegated to an injected LlmCaller (
|
|
12
|
-
*
|
|
11
|
+
* The actual LLM call is delegated to an injected LlmCaller (the native
|
|
12
|
+
* ProviderRoutingLlmCaller wired at the host layer) — this keeps the
|
|
13
13
|
* agent code provider-agnostic and easy to A/B test against the eval set.
|
|
14
14
|
*/
|
|
15
15
|
export type AgentRole = "router" | "planner" | "executor" | "critic" | "reference";
|
|
16
16
|
export interface ModelChoice {
|
|
17
17
|
/** Logical model id, e.g. "claude-sonnet-4.6", "claude-haiku-4.5", "gpt-5". */
|
|
18
18
|
modelId: string;
|
|
19
|
-
/** Provider key for the LLM
|
|
19
|
+
/** Provider key for the LLM dispatcher, e.g. "anthropic", "openai", "google". */
|
|
20
20
|
provider: string;
|
|
21
21
|
/** Vision input supported. */
|
|
22
22
|
vision?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modelRouter.d.ts","sourceRoot":"","sources":["../../../src/services/agent/modelRouter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,SAAS,GACT,UAAU,GACV,QAAQ,GACR,WAAW,CAAC;AAEhB,MAAM,WAAW,WAAW;IAC1B,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAC;IAChB,
|
|
1
|
+
{"version":3,"file":"modelRouter.d.ts","sourceRoot":"","sources":["../../../src/services/agent/modelRouter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,SAAS,GACT,UAAU,GACV,QAAQ,GACR,WAAW,CAAC;AAEhB,MAAM,WAAW,WAAW;IAC1B,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACxC,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;IACnD,gFAAgF;IAChF,cAAc,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED,eAAO,MAAM,qBAAqB,EAAE,kBA8CnC,CAAC;AAEF,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,GAAE,kBAA0C;IAE/E,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,WAAW;IAOnE,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS;CAGtD"}
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* - critic : vision QA across scenes, rubric-following
|
|
10
10
|
* - reference : ingest a TikTok/Reel URL, extract structure
|
|
11
11
|
*
|
|
12
|
-
* The actual LLM call is delegated to an injected LlmCaller (
|
|
13
|
-
*
|
|
12
|
+
* The actual LLM call is delegated to an injected LlmCaller (the native
|
|
13
|
+
* ProviderRoutingLlmCaller wired at the host layer) — this keeps the
|
|
14
14
|
* agent code provider-agnostic and easy to A/B test against the eval set.
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -21,32 +21,46 @@ exports.DEFAULT_MODEL_ROUTING = {
|
|
|
21
21
|
planner: { modelId: "claude-sonnet-4-6", provider: "anthropic" },
|
|
22
22
|
executor: { modelId: "claude-haiku-4-5", provider: "anthropic" },
|
|
23
23
|
// Critic rubrics today (continuity / consistency / voSync / costVsTier)
|
|
24
|
-
// are pure perception + structured-output tasks
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
24
|
+
// are pure perception + structured-output tasks. Gemini 3.5 Flash is the
|
|
25
|
+
// current Flash tier (q4/s4) — stronger on perception than 2.5 Flash and
|
|
26
|
+
// still far cheaper than Sonnet on vision. Cost note: 3.5 Flash bills
|
|
27
|
+
// ~5× the 2.5 Flash rate ($1.50/$9 vs $0.30/$2.50 per 1M), so per-scene
|
|
28
|
+
// critic spend rises accordingly; if that bites at volume, drop back to
|
|
29
|
+
// "gemini-2.5-flash" (the cost-optimal option). The brand-safety rubric is
|
|
30
|
+
// parked; when it returns, route only that axis to Sonnet (policy slice).
|
|
29
31
|
critic: {
|
|
30
|
-
modelId: "gemini-
|
|
32
|
+
modelId: "gemini-3.5-flash",
|
|
31
33
|
provider: "google",
|
|
32
34
|
vision: true,
|
|
33
35
|
},
|
|
36
|
+
// Reference ingest (TikTok/Reel → structure) is low-volume and benefits
|
|
37
|
+
// from the strongest Pro vision. Gemini 3.1 Pro is the current top Gemini.
|
|
34
38
|
reference: {
|
|
35
|
-
modelId: "gemini-
|
|
39
|
+
modelId: "gemini-3.1-pro",
|
|
36
40
|
provider: "google",
|
|
37
41
|
vision: true,
|
|
38
42
|
},
|
|
39
43
|
},
|
|
40
44
|
fallback: {
|
|
41
|
-
router: { modelId: "gpt-5-mini", provider: "openai" },
|
|
42
|
-
planner: { modelId: "gpt-5", provider: "openai" },
|
|
43
|
-
executor
|
|
45
|
+
router: { modelId: "gpt-5.4-mini", provider: "openai" },
|
|
46
|
+
planner: { modelId: "gpt-5.5", provider: "openai" },
|
|
47
|
+
// executor fallback repointed off DeepSeek → OpenAI mini when the native
|
|
48
|
+
// provider callers replaced the Vercel AI Gateway (we ship native callers
|
|
49
|
+
// only for anthropic/openai/google; the dispatcher throws on "deepseek").
|
|
50
|
+
// gpt-5.4-mini is the current cheap fast tier + handles the executor's
|
|
51
|
+
// mechanical tool-routing. See LLM_NATIVE_MIGRATION_PLAN decision #1.
|
|
52
|
+
// REMOVED FOR v2 — kept for reference:
|
|
53
|
+
// executor: { modelId: "deepseek-chat", provider: "deepseek" },
|
|
54
|
+
// PRIOR (retired ids): router/executor gpt-5-mini, planner gpt-5.
|
|
55
|
+
executor: { modelId: "gpt-5.4-mini", provider: "openai" },
|
|
44
56
|
// Sonnet is the Critic fallback — it costs more but is the safest
|
|
45
57
|
// bet when Flash refuses or returns malformed structured output.
|
|
46
58
|
critic: { modelId: "claude-sonnet-4-6", provider: "anthropic", vision: true },
|
|
47
59
|
reference: { modelId: "claude-sonnet-4-6", provider: "anthropic" },
|
|
48
60
|
},
|
|
49
|
-
|
|
61
|
+
// Opus 4.8 is the current top Opus tier (4.7 is now legacy). Premium briefs
|
|
62
|
+
// route the planner here.
|
|
63
|
+
premiumPlanner: { modelId: "claude-opus-4-8", provider: "anthropic" },
|
|
50
64
|
};
|
|
51
65
|
class ModelRouter {
|
|
52
66
|
constructor(policy = exports.DEFAULT_MODEL_ROUTING) {
|