@juspay/neurolink 9.63.1 → 9.65.0
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/CHANGELOG.md +12 -0
- package/README.md +18 -17
- package/dist/adapters/providerImageAdapter.js +29 -1
- package/dist/adapters/replicate/auth.d.ts +19 -0
- package/dist/adapters/replicate/auth.js +32 -0
- package/dist/adapters/replicate/predictionLifecycle.d.ts +46 -0
- package/dist/adapters/replicate/predictionLifecycle.js +283 -0
- package/dist/adapters/video/klingVideoHandler.d.ts +37 -0
- package/dist/adapters/video/klingVideoHandler.js +305 -0
- package/dist/adapters/video/replicateVideoHandler.d.ts +29 -0
- package/dist/adapters/video/replicateVideoHandler.js +157 -0
- package/dist/adapters/video/runwayVideoHandler.d.ts +32 -0
- package/dist/adapters/video/runwayVideoHandler.js +316 -0
- package/dist/adapters/video/vertexVideoHandler.d.ts +19 -1
- package/dist/adapters/video/vertexVideoHandler.js +42 -11
- package/dist/autoresearch/runner.js +8 -2
- package/dist/avatar/index.d.ts +13 -0
- package/dist/avatar/index.js +13 -0
- package/dist/avatar/providers/DIDAvatar.d.ts +49 -0
- package/dist/avatar/providers/DIDAvatar.js +501 -0
- package/dist/avatar/providers/HeyGenAvatar.d.ts +30 -0
- package/dist/avatar/providers/HeyGenAvatar.js +337 -0
- package/dist/avatar/providers/ReplicateAvatar.d.ts +36 -0
- package/dist/avatar/providers/ReplicateAvatar.js +267 -0
- package/dist/browser/neurolink.min.js +573 -554
- package/dist/cli/commands/mcp.js +29 -0
- package/dist/cli/commands/proxy.js +24 -5
- package/dist/cli/factories/commandFactory.d.ts +25 -1
- package/dist/cli/factories/commandFactory.js +341 -63
- package/dist/cli/loop/optionsSchema.d.ts +1 -1
- package/dist/cli/loop/optionsSchema.js +12 -0
- package/dist/constants/contextWindows.js +101 -0
- package/dist/constants/enums.d.ts +273 -2
- package/dist/constants/enums.js +290 -1
- package/dist/constants/videoErrors.d.ts +4 -0
- package/dist/constants/videoErrors.js +4 -0
- package/dist/core/baseProvider.d.ts +23 -3
- package/dist/core/baseProvider.js +217 -11
- package/dist/core/constants.d.ts +11 -0
- package/dist/core/constants.js +69 -1
- package/dist/core/modules/MessageBuilder.js +20 -0
- package/dist/core/redisConversationMemoryManager.js +6 -0
- package/dist/evaluation/index.d.ts +2 -0
- package/dist/evaluation/index.js +4 -0
- package/dist/factories/providerFactory.js +7 -1
- package/dist/factories/providerRegistry.js +203 -2
- package/dist/features/ppt/contentPlanner.js +42 -14
- package/dist/index.d.ts +9 -1
- package/dist/index.js +16 -1
- package/dist/lib/adapters/providerImageAdapter.js +29 -1
- package/dist/lib/adapters/replicate/auth.d.ts +19 -0
- package/dist/lib/adapters/replicate/auth.js +33 -0
- package/dist/lib/adapters/replicate/predictionLifecycle.d.ts +46 -0
- package/dist/lib/adapters/replicate/predictionLifecycle.js +284 -0
- package/dist/lib/adapters/video/klingVideoHandler.d.ts +37 -0
- package/dist/lib/adapters/video/klingVideoHandler.js +306 -0
- package/dist/lib/adapters/video/replicateVideoHandler.d.ts +29 -0
- package/dist/lib/adapters/video/replicateVideoHandler.js +158 -0
- package/dist/lib/adapters/video/runwayVideoHandler.d.ts +32 -0
- package/dist/lib/adapters/video/runwayVideoHandler.js +317 -0
- package/dist/lib/adapters/video/vertexVideoHandler.d.ts +19 -1
- package/dist/lib/adapters/video/vertexVideoHandler.js +42 -11
- package/dist/lib/autoresearch/runner.js +8 -2
- package/dist/lib/avatar/index.d.ts +13 -0
- package/dist/lib/avatar/index.js +14 -0
- package/dist/lib/avatar/providers/DIDAvatar.d.ts +49 -0
- package/dist/lib/avatar/providers/DIDAvatar.js +502 -0
- package/dist/lib/avatar/providers/HeyGenAvatar.d.ts +30 -0
- package/dist/lib/avatar/providers/HeyGenAvatar.js +338 -0
- package/dist/lib/avatar/providers/ReplicateAvatar.d.ts +36 -0
- package/dist/lib/avatar/providers/ReplicateAvatar.js +268 -0
- package/dist/lib/constants/contextWindows.js +101 -0
- package/dist/lib/constants/enums.d.ts +273 -2
- package/dist/lib/constants/enums.js +290 -1
- package/dist/lib/constants/videoErrors.d.ts +4 -0
- package/dist/lib/constants/videoErrors.js +4 -0
- package/dist/lib/core/baseProvider.d.ts +23 -3
- package/dist/lib/core/baseProvider.js +217 -11
- package/dist/lib/core/constants.d.ts +11 -0
- package/dist/lib/core/constants.js +69 -1
- package/dist/lib/core/modules/MessageBuilder.js +20 -0
- package/dist/lib/core/redisConversationMemoryManager.js +6 -0
- package/dist/lib/evaluation/index.d.ts +2 -0
- package/dist/lib/evaluation/index.js +4 -0
- package/dist/lib/factories/providerFactory.js +7 -1
- package/dist/lib/factories/providerRegistry.js +203 -2
- package/dist/lib/features/ppt/contentPlanner.js +42 -14
- package/dist/lib/index.d.ts +9 -1
- package/dist/lib/index.js +16 -1
- package/dist/lib/memory/hippocampusInitializer.d.ts +2 -2
- package/dist/lib/memory/hippocampusInitializer.js +32 -2
- package/dist/lib/middleware/builtin/lifecycle.js +52 -51
- package/dist/lib/music/index.d.ts +13 -0
- package/dist/lib/music/index.js +14 -0
- package/dist/lib/music/providers/BeatovenMusic.d.ts +31 -0
- package/dist/lib/music/providers/BeatovenMusic.js +334 -0
- package/dist/lib/music/providers/ElevenLabsMusic.d.ts +30 -0
- package/dist/lib/music/providers/ElevenLabsMusic.js +169 -0
- package/dist/lib/music/providers/LyriaMusic.d.ts +29 -0
- package/dist/lib/music/providers/LyriaMusic.js +173 -0
- package/dist/lib/music/providers/ReplicateMusic.d.ts +31 -0
- package/dist/lib/music/providers/ReplicateMusic.js +262 -0
- package/dist/lib/neurolink.d.ts +30 -0
- package/dist/lib/neurolink.js +342 -49
- package/dist/lib/providers/amazonBedrock.d.ts +10 -0
- package/dist/lib/providers/amazonBedrock.js +94 -39
- package/dist/lib/providers/anthropic.js +55 -7
- package/dist/lib/providers/anthropicBaseProvider.js +1 -1
- package/dist/lib/providers/azureOpenai.js +66 -17
- package/dist/lib/providers/cloudflare.d.ts +35 -0
- package/dist/lib/providers/cloudflare.js +174 -0
- package/dist/lib/providers/cohere.d.ts +52 -0
- package/dist/lib/providers/cohere.js +253 -0
- package/dist/lib/providers/deepseek.js +72 -17
- package/dist/lib/providers/fireworks.d.ts +33 -0
- package/dist/lib/providers/fireworks.js +164 -0
- package/dist/lib/providers/googleAiStudio.d.ts +11 -3
- package/dist/lib/providers/googleAiStudio.js +336 -344
- package/dist/lib/providers/googleNativeGemini3.d.ts +107 -2
- package/dist/lib/providers/googleNativeGemini3.js +381 -25
- package/dist/lib/providers/googleVertex.d.ts +116 -129
- package/dist/lib/providers/googleVertex.js +3002 -1988
- package/dist/lib/providers/groq.d.ts +33 -0
- package/dist/lib/providers/groq.js +181 -0
- package/dist/lib/providers/huggingFace.js +9 -8
- package/dist/lib/providers/ideogram.d.ts +34 -0
- package/dist/lib/providers/ideogram.js +184 -0
- package/dist/lib/providers/index.d.ts +13 -0
- package/dist/lib/providers/index.js +13 -0
- package/dist/lib/providers/jina.d.ts +59 -0
- package/dist/lib/providers/jina.js +218 -0
- package/dist/lib/providers/llamaCpp.js +14 -46
- package/dist/lib/providers/lmStudio.js +14 -47
- package/dist/lib/providers/mistral.js +7 -7
- package/dist/lib/providers/nvidiaNim.js +160 -19
- package/dist/lib/providers/ollama.js +7 -7
- package/dist/lib/providers/openAI.d.ts +22 -1
- package/dist/lib/providers/openAI.js +181 -0
- package/dist/lib/providers/openRouter.js +38 -22
- package/dist/lib/providers/openaiCompatible.js +9 -8
- package/dist/lib/providers/perplexity.d.ts +33 -0
- package/dist/lib/providers/perplexity.js +179 -0
- package/dist/lib/providers/recraft.d.ts +34 -0
- package/dist/lib/providers/recraft.js +197 -0
- package/dist/lib/providers/replicate.d.ts +75 -0
- package/dist/lib/providers/replicate.js +403 -0
- package/dist/lib/providers/stability.d.ts +37 -0
- package/dist/lib/providers/stability.js +191 -0
- package/dist/lib/providers/togetherAi.d.ts +33 -0
- package/dist/lib/providers/togetherAi.js +176 -0
- package/dist/lib/providers/voyage.d.ts +47 -0
- package/dist/lib/providers/voyage.js +177 -0
- package/dist/lib/providers/xai.d.ts +33 -0
- package/dist/lib/providers/xai.js +172 -0
- package/dist/lib/telemetry/index.d.ts +1 -1
- package/dist/lib/telemetry/index.js +1 -1
- package/dist/lib/telemetry/tracers.d.ts +19 -0
- package/dist/lib/telemetry/tracers.js +19 -0
- package/dist/lib/telemetry/withSpan.d.ts +35 -0
- package/dist/lib/telemetry/withSpan.js +103 -0
- package/dist/lib/types/aliases.d.ts +14 -0
- package/dist/lib/types/avatar.d.ts +143 -0
- package/dist/lib/types/avatar.js +20 -0
- package/dist/lib/types/cli.d.ts +6 -0
- package/dist/lib/types/common.d.ts +0 -3
- package/dist/lib/types/conversation.d.ts +10 -3
- package/dist/lib/types/generate.d.ts +76 -5
- package/dist/lib/types/index.d.ts +6 -0
- package/dist/lib/types/index.js +8 -0
- package/dist/lib/types/memory.d.ts +96 -0
- package/dist/lib/types/memory.js +23 -0
- package/dist/lib/types/middleware.d.ts +27 -0
- package/dist/lib/types/multimodal.d.ts +35 -2
- package/dist/lib/types/music.d.ts +165 -0
- package/dist/lib/types/music.js +21 -0
- package/dist/lib/types/providers.d.ts +284 -3
- package/dist/lib/types/replicate.d.ts +67 -0
- package/dist/lib/types/replicate.js +10 -0
- package/dist/lib/types/safeFetch.d.ts +15 -0
- package/dist/lib/types/safeFetch.js +7 -0
- package/dist/lib/types/stream.d.ts +8 -1
- package/dist/lib/types/tools.d.ts +13 -0
- package/dist/lib/types/video.d.ts +89 -0
- package/dist/lib/types/video.js +15 -0
- package/dist/lib/utils/avatarProcessor.d.ts +68 -0
- package/dist/lib/utils/avatarProcessor.js +172 -0
- package/dist/lib/utils/cloneOptions.d.ts +36 -0
- package/dist/lib/utils/cloneOptions.js +62 -0
- package/dist/lib/utils/lifecycleCallbacks.d.ts +56 -0
- package/dist/lib/utils/lifecycleCallbacks.js +100 -0
- package/dist/lib/utils/lifecycleTimeout.d.ts +25 -0
- package/dist/lib/utils/lifecycleTimeout.js +39 -0
- package/dist/lib/utils/logSanitize.d.ts +49 -0
- package/dist/lib/utils/logSanitize.js +170 -0
- package/dist/lib/utils/loggingFetch.d.ts +29 -0
- package/dist/lib/utils/loggingFetch.js +60 -0
- package/dist/lib/utils/messageBuilder.d.ts +10 -0
- package/dist/lib/utils/messageBuilder.js +83 -30
- package/dist/lib/utils/modelChoices.js +236 -3
- package/dist/lib/utils/modelDetection.d.ts +11 -0
- package/dist/lib/utils/modelDetection.js +27 -0
- package/dist/lib/utils/musicProcessor.d.ts +67 -0
- package/dist/lib/utils/musicProcessor.js +189 -0
- package/dist/lib/utils/optionsConversion.js +3 -2
- package/dist/lib/utils/parameterValidation.js +14 -4
- package/dist/lib/utils/pricing.js +193 -0
- package/dist/lib/utils/providerConfig.d.ts +55 -0
- package/dist/lib/utils/providerConfig.js +224 -0
- package/dist/lib/utils/providerHealth.js +7 -7
- package/dist/lib/utils/safeFetch.d.ts +26 -0
- package/dist/lib/utils/safeFetch.js +83 -0
- package/dist/lib/utils/schemaConversion.d.ts +1 -1
- package/dist/lib/utils/schemaConversion.js +59 -4
- package/dist/lib/utils/sizeGuard.d.ts +34 -0
- package/dist/lib/utils/sizeGuard.js +45 -0
- package/dist/lib/utils/ssrfGuard.d.ts +52 -0
- package/dist/lib/utils/ssrfGuard.js +411 -0
- package/dist/lib/utils/tokenLimits.js +23 -32
- package/dist/lib/utils/videoProcessor.d.ts +60 -0
- package/dist/lib/utils/videoProcessor.js +201 -0
- package/dist/lib/voice/providers/FishAudioTTS.d.ts +27 -0
- package/dist/lib/voice/providers/FishAudioTTS.js +183 -0
- package/dist/lib/workflow/core/ensembleExecutor.js +26 -9
- package/dist/memory/hippocampusInitializer.d.ts +2 -2
- package/dist/memory/hippocampusInitializer.js +32 -2
- package/dist/middleware/builtin/lifecycle.js +52 -51
- package/dist/music/index.d.ts +13 -0
- package/dist/music/index.js +13 -0
- package/dist/music/providers/BeatovenMusic.d.ts +31 -0
- package/dist/music/providers/BeatovenMusic.js +333 -0
- package/dist/music/providers/ElevenLabsMusic.d.ts +30 -0
- package/dist/music/providers/ElevenLabsMusic.js +168 -0
- package/dist/music/providers/LyriaMusic.d.ts +29 -0
- package/dist/music/providers/LyriaMusic.js +172 -0
- package/dist/music/providers/ReplicateMusic.d.ts +31 -0
- package/dist/music/providers/ReplicateMusic.js +261 -0
- package/dist/neurolink.d.ts +30 -0
- package/dist/neurolink.js +342 -49
- package/dist/providers/amazonBedrock.d.ts +10 -0
- package/dist/providers/amazonBedrock.js +94 -39
- package/dist/providers/anthropic.js +55 -7
- package/dist/providers/anthropicBaseProvider.js +1 -1
- package/dist/providers/azureOpenai.js +66 -17
- package/dist/providers/cloudflare.d.ts +35 -0
- package/dist/providers/cloudflare.js +173 -0
- package/dist/providers/cohere.d.ts +52 -0
- package/dist/providers/cohere.js +252 -0
- package/dist/providers/deepseek.js +72 -17
- package/dist/providers/fireworks.d.ts +33 -0
- package/dist/providers/fireworks.js +163 -0
- package/dist/providers/googleAiStudio.d.ts +11 -3
- package/dist/providers/googleAiStudio.js +335 -344
- package/dist/providers/googleNativeGemini3.d.ts +107 -2
- package/dist/providers/googleNativeGemini3.js +381 -25
- package/dist/providers/googleVertex.d.ts +116 -129
- package/dist/providers/googleVertex.js +3000 -1987
- package/dist/providers/groq.d.ts +33 -0
- package/dist/providers/groq.js +180 -0
- package/dist/providers/huggingFace.js +9 -8
- package/dist/providers/ideogram.d.ts +34 -0
- package/dist/providers/ideogram.js +183 -0
- package/dist/providers/index.d.ts +13 -0
- package/dist/providers/index.js +13 -0
- package/dist/providers/jina.d.ts +59 -0
- package/dist/providers/jina.js +217 -0
- package/dist/providers/llamaCpp.js +14 -46
- package/dist/providers/lmStudio.js +14 -47
- package/dist/providers/mistral.js +7 -7
- package/dist/providers/nvidiaNim.js +160 -19
- package/dist/providers/ollama.js +7 -7
- package/dist/providers/openAI.d.ts +22 -1
- package/dist/providers/openAI.js +181 -0
- package/dist/providers/openRouter.js +38 -22
- package/dist/providers/openaiCompatible.js +9 -8
- package/dist/providers/perplexity.d.ts +33 -0
- package/dist/providers/perplexity.js +178 -0
- package/dist/providers/recraft.d.ts +34 -0
- package/dist/providers/recraft.js +196 -0
- package/dist/providers/replicate.d.ts +75 -0
- package/dist/providers/replicate.js +402 -0
- package/dist/providers/stability.d.ts +37 -0
- package/dist/providers/stability.js +190 -0
- package/dist/providers/togetherAi.d.ts +33 -0
- package/dist/providers/togetherAi.js +175 -0
- package/dist/providers/voyage.d.ts +47 -0
- package/dist/providers/voyage.js +176 -0
- package/dist/providers/xai.d.ts +33 -0
- package/dist/providers/xai.js +171 -0
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/telemetry/tracers.d.ts +19 -0
- package/dist/telemetry/tracers.js +19 -0
- package/dist/telemetry/withSpan.d.ts +35 -0
- package/dist/telemetry/withSpan.js +103 -0
- package/dist/types/aliases.d.ts +14 -0
- package/dist/types/avatar.d.ts +143 -0
- package/dist/types/avatar.js +19 -0
- package/dist/types/cli.d.ts +6 -0
- package/dist/types/common.d.ts +0 -3
- package/dist/types/conversation.d.ts +10 -3
- package/dist/types/generate.d.ts +76 -5
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +8 -0
- package/dist/types/memory.d.ts +96 -0
- package/dist/types/memory.js +22 -0
- package/dist/types/middleware.d.ts +27 -0
- package/dist/types/multimodal.d.ts +35 -2
- package/dist/types/music.d.ts +165 -0
- package/dist/types/music.js +20 -0
- package/dist/types/providers.d.ts +284 -3
- package/dist/types/replicate.d.ts +67 -0
- package/dist/types/replicate.js +9 -0
- package/dist/types/safeFetch.d.ts +15 -0
- package/dist/types/safeFetch.js +6 -0
- package/dist/types/stream.d.ts +8 -1
- package/dist/types/tools.d.ts +13 -0
- package/dist/types/video.d.ts +89 -0
- package/dist/types/video.js +14 -0
- package/dist/utils/avatarProcessor.d.ts +68 -0
- package/dist/utils/avatarProcessor.js +171 -0
- package/dist/utils/cloneOptions.d.ts +36 -0
- package/dist/utils/cloneOptions.js +61 -0
- package/dist/utils/lifecycleCallbacks.d.ts +56 -0
- package/dist/utils/lifecycleCallbacks.js +99 -0
- package/dist/utils/lifecycleTimeout.d.ts +25 -0
- package/dist/utils/lifecycleTimeout.js +38 -0
- package/dist/utils/logSanitize.d.ts +49 -0
- package/dist/utils/logSanitize.js +169 -0
- package/dist/utils/loggingFetch.d.ts +29 -0
- package/dist/utils/loggingFetch.js +59 -0
- package/dist/utils/messageBuilder.d.ts +10 -0
- package/dist/utils/messageBuilder.js +83 -30
- package/dist/utils/modelChoices.js +236 -3
- package/dist/utils/modelDetection.d.ts +11 -0
- package/dist/utils/modelDetection.js +27 -0
- package/dist/utils/musicProcessor.d.ts +67 -0
- package/dist/utils/musicProcessor.js +188 -0
- package/dist/utils/optionsConversion.js +3 -2
- package/dist/utils/parameterValidation.js +14 -4
- package/dist/utils/pricing.js +193 -0
- package/dist/utils/providerConfig.d.ts +55 -0
- package/dist/utils/providerConfig.js +224 -0
- package/dist/utils/providerHealth.js +7 -7
- package/dist/utils/safeFetch.d.ts +26 -0
- package/dist/utils/safeFetch.js +82 -0
- package/dist/utils/schemaConversion.d.ts +1 -1
- package/dist/utils/schemaConversion.js +59 -4
- package/dist/utils/sizeGuard.d.ts +34 -0
- package/dist/utils/sizeGuard.js +44 -0
- package/dist/utils/ssrfGuard.d.ts +52 -0
- package/dist/utils/ssrfGuard.js +410 -0
- package/dist/utils/tokenLimits.js +23 -32
- package/dist/utils/videoProcessor.d.ts +60 -0
- package/dist/utils/videoProcessor.js +200 -0
- package/dist/voice/providers/FishAudioTTS.d.ts +27 -0
- package/dist/voice/providers/FishAudioTTS.js +182 -0
- package/dist/workflow/core/ensembleExecutor.js +26 -9
- package/package.json +42 -8
|
@@ -163,6 +163,141 @@ export type NeurolinkCredentials = {
|
|
|
163
163
|
apiKey?: string;
|
|
164
164
|
baseURL?: string;
|
|
165
165
|
};
|
|
166
|
+
xai?: {
|
|
167
|
+
apiKey?: string;
|
|
168
|
+
baseURL?: string;
|
|
169
|
+
};
|
|
170
|
+
groq?: {
|
|
171
|
+
apiKey?: string;
|
|
172
|
+
baseURL?: string;
|
|
173
|
+
};
|
|
174
|
+
cohere?: {
|
|
175
|
+
apiKey?: string;
|
|
176
|
+
baseURL?: string;
|
|
177
|
+
};
|
|
178
|
+
together?: {
|
|
179
|
+
apiKey?: string;
|
|
180
|
+
baseURL?: string;
|
|
181
|
+
};
|
|
182
|
+
fireworks?: {
|
|
183
|
+
apiKey?: string;
|
|
184
|
+
baseURL?: string;
|
|
185
|
+
};
|
|
186
|
+
perplexity?: {
|
|
187
|
+
apiKey?: string;
|
|
188
|
+
baseURL?: string;
|
|
189
|
+
};
|
|
190
|
+
cloudflare?: {
|
|
191
|
+
apiKey?: string;
|
|
192
|
+
accountId?: string;
|
|
193
|
+
baseURL?: string;
|
|
194
|
+
};
|
|
195
|
+
replicate?: {
|
|
196
|
+
apiToken?: string;
|
|
197
|
+
baseUrl?: string;
|
|
198
|
+
};
|
|
199
|
+
voyage?: {
|
|
200
|
+
apiKey?: string;
|
|
201
|
+
baseURL?: string;
|
|
202
|
+
};
|
|
203
|
+
jina?: {
|
|
204
|
+
apiKey?: string;
|
|
205
|
+
baseURL?: string;
|
|
206
|
+
};
|
|
207
|
+
stability?: {
|
|
208
|
+
apiKey?: string;
|
|
209
|
+
baseURL?: string;
|
|
210
|
+
};
|
|
211
|
+
ideogram?: {
|
|
212
|
+
apiKey?: string;
|
|
213
|
+
baseURL?: string;
|
|
214
|
+
};
|
|
215
|
+
recraft?: {
|
|
216
|
+
apiKey?: string;
|
|
217
|
+
baseURL?: string;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* Voyage AI /embeddings response shape.
|
|
222
|
+
*/
|
|
223
|
+
export type VoyageEmbeddingsResponse = {
|
|
224
|
+
object: "list";
|
|
225
|
+
data: {
|
|
226
|
+
object: "embedding";
|
|
227
|
+
embedding: number[];
|
|
228
|
+
index: number;
|
|
229
|
+
}[];
|
|
230
|
+
model: string;
|
|
231
|
+
usage?: {
|
|
232
|
+
total_tokens?: number;
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Jina AI /embeddings response shape (compatible with OpenAI's shape).
|
|
237
|
+
*/
|
|
238
|
+
export type JinaEmbeddingsResponse = {
|
|
239
|
+
object?: string;
|
|
240
|
+
data: {
|
|
241
|
+
object?: string;
|
|
242
|
+
embedding: number[];
|
|
243
|
+
index: number;
|
|
244
|
+
}[];
|
|
245
|
+
model?: string;
|
|
246
|
+
usage?: {
|
|
247
|
+
total_tokens?: number;
|
|
248
|
+
prompt_tokens?: number;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Jina AI /rerank response shape.
|
|
253
|
+
*/
|
|
254
|
+
export type JinaRerankResponse = {
|
|
255
|
+
model?: string;
|
|
256
|
+
results: {
|
|
257
|
+
index: number;
|
|
258
|
+
relevance_score: number;
|
|
259
|
+
document?: {
|
|
260
|
+
text?: string;
|
|
261
|
+
};
|
|
262
|
+
}[];
|
|
263
|
+
usage?: {
|
|
264
|
+
total_tokens?: number;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Stability AI /v2beta/stable-image/generate/{model} response shape
|
|
269
|
+
* (returns either binary directly, or JSON with base64 when Accept is set
|
|
270
|
+
* to application/json). We always request JSON for uniformity.
|
|
271
|
+
*/
|
|
272
|
+
export type StabilityImageResponse = {
|
|
273
|
+
image?: string;
|
|
274
|
+
finish_reason?: "SUCCESS" | "ERROR" | "CONTENT_FILTERED";
|
|
275
|
+
seed?: number;
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* Ideogram /api/v1/ideogram-v3/generate response shape.
|
|
279
|
+
*/
|
|
280
|
+
export type IdeogramImageResponse = {
|
|
281
|
+
created?: string;
|
|
282
|
+
data: {
|
|
283
|
+
prompt?: string;
|
|
284
|
+
resolution?: string;
|
|
285
|
+
is_image_safe?: boolean;
|
|
286
|
+
seed?: number;
|
|
287
|
+
url?: string;
|
|
288
|
+
style_type?: string;
|
|
289
|
+
}[];
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* Recraft /v1/images/generations response shape.
|
|
293
|
+
*/
|
|
294
|
+
export type RecraftImageResponse = {
|
|
295
|
+
created?: number;
|
|
296
|
+
data: {
|
|
297
|
+
url?: string;
|
|
298
|
+
b64_json?: string;
|
|
299
|
+
image_id?: string;
|
|
300
|
+
}[];
|
|
166
301
|
};
|
|
167
302
|
/**
|
|
168
303
|
* NVIDIA NIM extra request body parameters passed via `providerOptions.openai.body`.
|
|
@@ -703,6 +838,15 @@ export type GenAIModelsAPI = {
|
|
|
703
838
|
}>;
|
|
704
839
|
config?: Record<string, unknown>;
|
|
705
840
|
}) => Promise<GenAIGenerateContentResponse>;
|
|
841
|
+
embedContent: (params: {
|
|
842
|
+
model: string;
|
|
843
|
+
contents: string | string[];
|
|
844
|
+
config?: Record<string, unknown>;
|
|
845
|
+
}) => Promise<{
|
|
846
|
+
embeddings?: Array<{
|
|
847
|
+
values?: number[];
|
|
848
|
+
}>;
|
|
849
|
+
}>;
|
|
706
850
|
};
|
|
707
851
|
/**
|
|
708
852
|
* Google AI client interface
|
|
@@ -713,17 +857,52 @@ export type GenAIClient = {
|
|
|
713
857
|
};
|
|
714
858
|
models: GenAIModelsAPI;
|
|
715
859
|
};
|
|
860
|
+
/**
|
|
861
|
+
* HTTP options for Google GenAI SDK
|
|
862
|
+
* Allows custom fetch implementation for proxy support
|
|
863
|
+
*/
|
|
864
|
+
export type GoogleGenAIHttpOptions = {
|
|
865
|
+
/** Custom fetch implementation for proxy support */
|
|
866
|
+
fetch?: typeof fetch;
|
|
867
|
+
};
|
|
716
868
|
/**
|
|
717
869
|
* Google GenAI constructor type
|
|
718
870
|
* Supports both API key (Google AI Studio) and Vertex AI configurations
|
|
719
871
|
*/
|
|
720
872
|
export type GoogleGenAIClass = new (cfg: {
|
|
721
873
|
apiKey: string;
|
|
874
|
+
httpOptions?: GoogleGenAIHttpOptions;
|
|
722
875
|
} | {
|
|
723
876
|
vertexai: boolean;
|
|
724
877
|
project: string;
|
|
725
878
|
location: string;
|
|
879
|
+
httpOptions?: GoogleGenAIHttpOptions;
|
|
726
880
|
}) => GenAIClient;
|
|
881
|
+
/**
|
|
882
|
+
* Google Vertex AI provider settings for native SDK configuration
|
|
883
|
+
* Used with @google/genai SDK in vertexai mode
|
|
884
|
+
*
|
|
885
|
+
* Note: Authentication is handled via environment variables (GOOGLE_APPLICATION_CREDENTIALS)
|
|
886
|
+
* or the temporary credentials file approach, not through these settings fields.
|
|
887
|
+
*/
|
|
888
|
+
export type GoogleVertexProviderSettings = {
|
|
889
|
+
/** Google Cloud project ID */
|
|
890
|
+
project: string;
|
|
891
|
+
/** Google Cloud region/location (e.g., 'us-central1') */
|
|
892
|
+
location: string;
|
|
893
|
+
/** Optional custom fetch implementation */
|
|
894
|
+
fetch?: typeof fetch;
|
|
895
|
+
};
|
|
896
|
+
/**
|
|
897
|
+
* Anthropic Vertex AI settings for Claude models on Vertex
|
|
898
|
+
* Used with @anthropic-ai/vertex-sdk
|
|
899
|
+
*/
|
|
900
|
+
export type AnthropicVertexSettings = {
|
|
901
|
+
/** Google Cloud project ID */
|
|
902
|
+
projectId: string;
|
|
903
|
+
/** Google Cloud region for Anthropic models (e.g., 'us-east5') */
|
|
904
|
+
region: string;
|
|
905
|
+
};
|
|
727
906
|
/**
|
|
728
907
|
* OpenAI-compatible models endpoint response structure
|
|
729
908
|
*/
|
|
@@ -1429,10 +1608,18 @@ export type NativeFunctionDeclaration = {
|
|
|
1429
1608
|
export type NativeToolsConfig = Array<{
|
|
1430
1609
|
functionDeclarations: NativeFunctionDeclaration[];
|
|
1431
1610
|
}>;
|
|
1432
|
-
/**
|
|
1611
|
+
/**
|
|
1612
|
+
* Return value of buildNativeToolDeclarations.
|
|
1613
|
+
*
|
|
1614
|
+
* `originalNameMap` lets callers translate a Google-safe (sanitized,
|
|
1615
|
+
* suffix-disambiguated) tool name back to the original identifier the
|
|
1616
|
+
* SDK consumer registered. Sanitized names are transport-only — they
|
|
1617
|
+
* MUST be hidden from tool-call metadata exposed to consumers.
|
|
1618
|
+
*/
|
|
1433
1619
|
export type NativeToolDeclarationsResult = {
|
|
1434
1620
|
toolsConfig: NativeToolsConfig;
|
|
1435
1621
|
executeMap: Map<string, Tool["execute"]>;
|
|
1622
|
+
originalNameMap: Map<string, string>;
|
|
1436
1623
|
};
|
|
1437
1624
|
/** A single function call returned by the Gemini model. */
|
|
1438
1625
|
export type NativeFunctionCall = {
|
|
@@ -1499,8 +1686,8 @@ export type ToolWithLegacyParams = {
|
|
|
1499
1686
|
* factory functions.
|
|
1500
1687
|
*/
|
|
1501
1688
|
export type ProviderConstructor = {
|
|
1502
|
-
new (modelName?: string, providerName?: string, sdk?: UnknownRecord, region?: string): AIProvider;
|
|
1503
|
-
} | ((modelName?: string, providerName?: string, sdk?: UnknownRecord, region?: string) => Promise<AIProvider>);
|
|
1689
|
+
new (modelName?: string, providerName?: string, sdk?: UnknownRecord, region?: string, credentials?: UnknownRecord): AIProvider;
|
|
1690
|
+
} | ((modelName?: string, providerName?: string, sdk?: UnknownRecord, region?: string, credentials?: UnknownRecord) => Promise<AIProvider>);
|
|
1504
1691
|
/** Provider registration entry held by ProviderFactory. */
|
|
1505
1692
|
export type ProviderRegistration = {
|
|
1506
1693
|
constructor: ProviderConstructor;
|
|
@@ -1603,6 +1790,9 @@ export type GoogleLiveAudioQueueItem = {
|
|
|
1603
1790
|
/**
|
|
1604
1791
|
* Single part inside a Google Vertex "native" (non-AI-SDK) generateContent
|
|
1605
1792
|
* payload — either inline text or an inline base64 data blob.
|
|
1793
|
+
*
|
|
1794
|
+
* Despite the "Vertex" prefix, the shape is identical for the Google AI
|
|
1795
|
+
* Studio native path (`@google/genai` SDK), so AI Studio re-uses this type.
|
|
1606
1796
|
*/
|
|
1607
1797
|
export type VertexNativePart = {
|
|
1608
1798
|
text: string;
|
|
@@ -1612,6 +1802,21 @@ export type VertexNativePart = {
|
|
|
1612
1802
|
data: string;
|
|
1613
1803
|
};
|
|
1614
1804
|
};
|
|
1805
|
+
/**
|
|
1806
|
+
* Subset of `GenerateOptions["input"]` consumed by the shared Gemini-native
|
|
1807
|
+
* multimodal-parts builder. Kept narrow so the helper doesn't depend on the
|
|
1808
|
+
* full `GenerateOptions` shape. The `images` field mirrors the public
|
|
1809
|
+
* `GenerateOptions["input"].images` shape so the helper accepts the same
|
|
1810
|
+
* value SDK callers pass in (plain Buffer/string or `ImageWithAltText`).
|
|
1811
|
+
*/
|
|
1812
|
+
export type GeminiMultimodalInput = {
|
|
1813
|
+
text?: string;
|
|
1814
|
+
pdfFiles?: Array<Buffer | string>;
|
|
1815
|
+
images?: Array<Buffer | string | {
|
|
1816
|
+
data: Buffer | string;
|
|
1817
|
+
altText?: string;
|
|
1818
|
+
}>;
|
|
1819
|
+
};
|
|
1615
1820
|
/**
|
|
1616
1821
|
* Internal helpers used by the conversation-history builder in
|
|
1617
1822
|
* providers/googleVertex.ts to merge interleaved tool call / result turns.
|
|
@@ -1627,3 +1832,79 @@ export type VertexRegularSegment = {
|
|
|
1627
1832
|
parts: unknown[];
|
|
1628
1833
|
};
|
|
1629
1834
|
export type VertexSegment = VertexToolStep | VertexRegularSegment;
|
|
1835
|
+
/**
|
|
1836
|
+
* Function declaration shape accepted by the @google/genai SDK when tools are
|
|
1837
|
+
* attached to a Vertex generateContent call.
|
|
1838
|
+
*/
|
|
1839
|
+
export type VertexGenaiFunctionDeclaration = {
|
|
1840
|
+
name: string;
|
|
1841
|
+
description: string;
|
|
1842
|
+
parametersJsonSchema?: Record<string, unknown>;
|
|
1843
|
+
};
|
|
1844
|
+
/**
|
|
1845
|
+
* Message payload passed to the Anthropic Vertex SDK — mirrors the Anthropic
|
|
1846
|
+
* Messages API shape (role + structured content blocks).
|
|
1847
|
+
*/
|
|
1848
|
+
export type VertexAnthropicMessage = {
|
|
1849
|
+
role: "user" | "assistant";
|
|
1850
|
+
content: string | Array<{
|
|
1851
|
+
type: "text";
|
|
1852
|
+
text: string;
|
|
1853
|
+
} | {
|
|
1854
|
+
type: "image";
|
|
1855
|
+
source: {
|
|
1856
|
+
type: "base64";
|
|
1857
|
+
media_type: string;
|
|
1858
|
+
data: string;
|
|
1859
|
+
};
|
|
1860
|
+
} | {
|
|
1861
|
+
type: "document";
|
|
1862
|
+
source: {
|
|
1863
|
+
type: "base64";
|
|
1864
|
+
media_type: string;
|
|
1865
|
+
data: string;
|
|
1866
|
+
};
|
|
1867
|
+
} | {
|
|
1868
|
+
type: "tool_use";
|
|
1869
|
+
id: string;
|
|
1870
|
+
name: string;
|
|
1871
|
+
input: unknown;
|
|
1872
|
+
} | {
|
|
1873
|
+
type: "tool_result";
|
|
1874
|
+
tool_use_id: string;
|
|
1875
|
+
content: string;
|
|
1876
|
+
} | {
|
|
1877
|
+
type: "thinking";
|
|
1878
|
+
thinking: string;
|
|
1879
|
+
} | {
|
|
1880
|
+
type: "redacted_thinking";
|
|
1881
|
+
data: string;
|
|
1882
|
+
}>;
|
|
1883
|
+
};
|
|
1884
|
+
/** Tool definition accepted by the Anthropic Vertex SDK. */
|
|
1885
|
+
export type VertexAnthropicTool = {
|
|
1886
|
+
name: string;
|
|
1887
|
+
description: string;
|
|
1888
|
+
input_schema: {
|
|
1889
|
+
type: "object";
|
|
1890
|
+
properties?: Record<string, unknown>;
|
|
1891
|
+
required?: string[];
|
|
1892
|
+
};
|
|
1893
|
+
};
|
|
1894
|
+
/**
|
|
1895
|
+
* Content block variants returned by the Anthropic Vertex SDK during streaming
|
|
1896
|
+
* and generation — used to narrow responses before handing tool calls back.
|
|
1897
|
+
*/
|
|
1898
|
+
export type VertexAnthropicContentBlock = {
|
|
1899
|
+
type: "text";
|
|
1900
|
+
text: string;
|
|
1901
|
+
} | {
|
|
1902
|
+
type: "tool_use";
|
|
1903
|
+
id: string;
|
|
1904
|
+
name: string;
|
|
1905
|
+
input: Record<string, unknown>;
|
|
1906
|
+
} | {
|
|
1907
|
+
type: "tool_result";
|
|
1908
|
+
tool_use_id: string;
|
|
1909
|
+
content: string;
|
|
1910
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replicate Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Shared types for the Replicate prediction lifecycle (LLM, video,
|
|
5
|
+
* avatar, music handlers all consume these via the types barrel).
|
|
6
|
+
*
|
|
7
|
+
* @module types/replicate
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Replicate auth payload — bearer token + optional base URL.
|
|
11
|
+
*/
|
|
12
|
+
export type ReplicateAuth = {
|
|
13
|
+
apiToken: string;
|
|
14
|
+
baseUrl?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Replicate prediction status (terminal: succeeded / failed / canceled).
|
|
18
|
+
*/
|
|
19
|
+
export type ReplicatePredictionStatus = "starting" | "processing" | "succeeded" | "failed" | "canceled";
|
|
20
|
+
/**
|
|
21
|
+
* Replicate prediction object as returned by /v1/predictions POST and
|
|
22
|
+
* /v1/predictions/:id GET. Output shape varies by model — caller narrows.
|
|
23
|
+
*/
|
|
24
|
+
export type ReplicatePrediction = {
|
|
25
|
+
id: string;
|
|
26
|
+
model?: string;
|
|
27
|
+
version?: string;
|
|
28
|
+
status: ReplicatePredictionStatus;
|
|
29
|
+
/** URL string, array of URL strings, base64, or model-specific JSON. */
|
|
30
|
+
output?: unknown;
|
|
31
|
+
error?: string | null;
|
|
32
|
+
metrics?: {
|
|
33
|
+
predict_time?: number;
|
|
34
|
+
};
|
|
35
|
+
urls?: {
|
|
36
|
+
get: string;
|
|
37
|
+
cancel: string;
|
|
38
|
+
};
|
|
39
|
+
logs?: string;
|
|
40
|
+
created_at?: string;
|
|
41
|
+
started_at?: string;
|
|
42
|
+
completed_at?: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Input shape for Replicate's createPrediction helper.
|
|
46
|
+
*/
|
|
47
|
+
export type ReplicateCreatePredictionInput = {
|
|
48
|
+
/** Model in "owner/name" or "owner/name:version" form. */
|
|
49
|
+
model: string;
|
|
50
|
+
/** Provider/model-specific input shape. */
|
|
51
|
+
input: Record<string, unknown>;
|
|
52
|
+
/** Optional webhook URL for completion notifications. */
|
|
53
|
+
webhook?: string;
|
|
54
|
+
/** Optional webhook events filter. */
|
|
55
|
+
webhookEventsFilter?: ("start" | "output" | "logs" | "completed")[];
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Options for the Replicate poll loop.
|
|
59
|
+
*/
|
|
60
|
+
export type ReplicatePollOptions = {
|
|
61
|
+
/** Total time to wait before throwing a timeout error (default 5 min). */
|
|
62
|
+
timeoutMs?: number;
|
|
63
|
+
/** Poll interval in milliseconds (default 2 s). */
|
|
64
|
+
pollIntervalMs?: number;
|
|
65
|
+
/** Caller-supplied AbortSignal to cancel polling early. */
|
|
66
|
+
abortSignal?: AbortSignal;
|
|
67
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replicate Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Shared types for the Replicate prediction lifecycle (LLM, video,
|
|
5
|
+
* avatar, music handlers all consume these via the types barrel).
|
|
6
|
+
*
|
|
7
|
+
* @module types/replicate
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=replicate.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the safe-fetch utility (SSRF-hardened binary downloads).
|
|
3
|
+
*
|
|
4
|
+
* Runtime helper lives in `src/lib/utils/safeFetch.ts`.
|
|
5
|
+
*/
|
|
6
|
+
export type SafeDownloadOptions = {
|
|
7
|
+
/** Hard cap on response size in bytes. Pass MAX_VIDEO_BYTES/MAX_AUDIO_BYTES/MAX_IMAGE_BYTES from sizeGuard. */
|
|
8
|
+
maxBytes: number;
|
|
9
|
+
/** Human-readable identifier used in error messages (e.g. "HeyGen video"). */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Optional abort signal for caller-driven cancellation. */
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
/** Optional per-call request timeout (ms). Default: 60_000. */
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
};
|
|
@@ -167,7 +167,8 @@ export type StreamChunk = {
|
|
|
167
167
|
};
|
|
168
168
|
export type StreamOptions = {
|
|
169
169
|
input: {
|
|
170
|
-
text
|
|
170
|
+
/** Prompt text. Optional for media-only modes (avatar, music) that are driven by uploaded files rather than a prompt. */
|
|
171
|
+
text?: string;
|
|
171
172
|
audio?: AudioInputSpec;
|
|
172
173
|
/**
|
|
173
174
|
* Images to include in the request.
|
|
@@ -314,6 +315,12 @@ export type StreamOptions = {
|
|
|
314
315
|
region?: string;
|
|
315
316
|
temperature?: number;
|
|
316
317
|
maxTokens?: number;
|
|
318
|
+
/** Top-p (nucleus) sampling parameter. Controls diversity of generated tokens. */
|
|
319
|
+
topP?: number;
|
|
320
|
+
/** Top-k sampling parameter. Limits the number of tokens considered. (Google/Gemini models only) */
|
|
321
|
+
topK?: number;
|
|
322
|
+
/** Stop sequences that will halt generation when encountered. */
|
|
323
|
+
stopSequences?: string[];
|
|
317
324
|
systemPrompt?: string;
|
|
318
325
|
schema?: ValidationSchema;
|
|
319
326
|
tools?: Record<string, Tool>;
|
|
@@ -515,3 +515,16 @@ export declare function isToolResult(value: unknown): value is ToolResult;
|
|
|
515
515
|
* Type guard for tool definition
|
|
516
516
|
*/
|
|
517
517
|
export declare function isToolDefinition(value: unknown): value is ToolDefinition;
|
|
518
|
+
/**
|
|
519
|
+
* Result shape returned by the built-in `bashTool` execute function in
|
|
520
|
+
* `src/lib/agent/directTools.ts`. Centralised here per CLAUDE.md rule 2
|
|
521
|
+
* so callers (incl. the mcp-bash test suite) don't need to declare a
|
|
522
|
+
* local re-shaping of the runtime contract.
|
|
523
|
+
*/
|
|
524
|
+
export type BashToolResult = {
|
|
525
|
+
success: boolean;
|
|
526
|
+
code: number;
|
|
527
|
+
stdout: string;
|
|
528
|
+
stderr: string;
|
|
529
|
+
error?: string;
|
|
530
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video Generation Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Shared types for video generation across providers (Vertex Veo, Kling,
|
|
5
|
+
* Runway, Replicate-hosted models, etc.).
|
|
6
|
+
*
|
|
7
|
+
* The shared base shapes (`VideoOutputOptions`, `VideoGenerationResult`)
|
|
8
|
+
* are defined in `multimodal.ts` for backwards compatibility — they are
|
|
9
|
+
* re-exported here so callers can import every video-related type from a
|
|
10
|
+
* single module.
|
|
11
|
+
*
|
|
12
|
+
* @module types/video
|
|
13
|
+
*/
|
|
14
|
+
import type { VideoGenerationResult, VideoOutputOptions } from "./multimodal.js";
|
|
15
|
+
export type { VideoGenerationResult, VideoOutputOptions, } from "./multimodal.js";
|
|
16
|
+
/**
|
|
17
|
+
* Director-mode transition options.
|
|
18
|
+
*
|
|
19
|
+
* Used by handlers that support first-and-last-frame interpolation
|
|
20
|
+
* (e.g., Veo 3.1 Fast). Providers without transition support omit the
|
|
21
|
+
* `generateTransition` method on `VideoHandler`.
|
|
22
|
+
*/
|
|
23
|
+
export type VideoTransitionOptions = {
|
|
24
|
+
aspectRatio?: "9:16" | "16:9" | "1:1" | string;
|
|
25
|
+
resolution?: "720p" | "1080p";
|
|
26
|
+
audio?: boolean;
|
|
27
|
+
/** Duration of the transition clip (Veo accepts 4, 6, or 8). Default 4. */
|
|
28
|
+
durationSeconds?: 4 | 6 | 8;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Handler contract for video generation providers.
|
|
32
|
+
*
|
|
33
|
+
* Every concrete handler (`VertexVideoHandler`, `KlingVideoHandler`,
|
|
34
|
+
* `RunwayVideoHandler`, `ReplicateVideoHandler`, …) implements this
|
|
35
|
+
* interface and registers itself with `VideoProcessor.registerHandler`.
|
|
36
|
+
*
|
|
37
|
+
* Implementations MUST enforce their own timeouts. The recommended
|
|
38
|
+
* total-deadline for image-to-video predictLongRunning APIs is
|
|
39
|
+
* 3-5 minutes; the per-request fetch timeout is 30 seconds.
|
|
40
|
+
*/
|
|
41
|
+
export type VideoHandler = {
|
|
42
|
+
/**
|
|
43
|
+
* Generate a single video clip from an input image and prompt.
|
|
44
|
+
*
|
|
45
|
+
* @param image - Input image buffer (JPEG, PNG, or WebP)
|
|
46
|
+
* @param prompt - Text prompt describing desired video motion / content
|
|
47
|
+
* @param options - Resolution, length, aspect ratio, audio settings
|
|
48
|
+
* @param region - Provider-specific region override (e.g. Vertex location)
|
|
49
|
+
* @returns Buffer + metadata
|
|
50
|
+
*/
|
|
51
|
+
generate(image: Buffer, prompt: string, options: VideoOutputOptions, region?: string): Promise<VideoGenerationResult>;
|
|
52
|
+
/**
|
|
53
|
+
* Optional — generate a transition clip between two frames (Director Mode).
|
|
54
|
+
*
|
|
55
|
+
* Providers without first-and-last-frame interpolation omit this method;
|
|
56
|
+
* `VideoProcessor.generateTransition` will surface a typed error.
|
|
57
|
+
*
|
|
58
|
+
* `durationSeconds` is on `VideoTransitionOptions` (default 4).
|
|
59
|
+
*/
|
|
60
|
+
generateTransition?(firstFrame: Buffer, lastFrame: Buffer, prompt: string, options?: VideoTransitionOptions, region?: string): Promise<Buffer>;
|
|
61
|
+
/** Validate the provider is configured (auth, base URL, etc.). */
|
|
62
|
+
isConfigured(): boolean;
|
|
63
|
+
/** Maximum video duration in seconds supported by this provider. */
|
|
64
|
+
readonly maxDurationSeconds?: number;
|
|
65
|
+
/** Supported aspect ratios. */
|
|
66
|
+
readonly supportedAspectRatios?: readonly ("9:16" | "16:9" | "1:1" | "4:3" | "3:4")[];
|
|
67
|
+
/** Supported output resolutions. */
|
|
68
|
+
readonly supportedResolutions?: readonly ("480p" | "720p" | "1080p" | "4k")[];
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Kling (PiAPI) task status response.
|
|
72
|
+
*/
|
|
73
|
+
export type KlingTaskResponse = {
|
|
74
|
+
status?: string;
|
|
75
|
+
video_url?: string;
|
|
76
|
+
output?: {
|
|
77
|
+
video_url?: string;
|
|
78
|
+
};
|
|
79
|
+
error?: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Runway task status response.
|
|
83
|
+
*/
|
|
84
|
+
export type RunwayTaskResponse = {
|
|
85
|
+
status?: string;
|
|
86
|
+
output?: string[] | string;
|
|
87
|
+
error?: string;
|
|
88
|
+
failure?: string;
|
|
89
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video Generation Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Shared types for video generation across providers (Vertex Veo, Kling,
|
|
5
|
+
* Runway, Replicate-hosted models, etc.).
|
|
6
|
+
*
|
|
7
|
+
* The shared base shapes (`VideoOutputOptions`, `VideoGenerationResult`)
|
|
8
|
+
* are defined in `multimodal.ts` for backwards compatibility — they are
|
|
9
|
+
* re-exported here so callers can import every video-related type from a
|
|
10
|
+
* single module.
|
|
11
|
+
*
|
|
12
|
+
* @module types/video
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=video.js.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Avatar / Lip-sync Generation Processing Utility
|
|
3
|
+
*
|
|
4
|
+
* Central registry + dispatch for avatar handlers across providers
|
|
5
|
+
* (D-ID, HeyGen, Replicate-hosted MuseTalk / SadTalker / Wav2Lip).
|
|
6
|
+
*
|
|
7
|
+
* Mirrors the static-handler-registry pattern established by
|
|
8
|
+
* `TTSProcessor` / `STTProcessor` / `VideoProcessor` / `MusicProcessor`.
|
|
9
|
+
*
|
|
10
|
+
* @module utils/avatarProcessor
|
|
11
|
+
*/
|
|
12
|
+
import { ErrorCategory, ErrorSeverity } from "../constants/enums.js";
|
|
13
|
+
import type { AvatarHandler, AvatarOptions, AvatarResult } from "../types/index.js";
|
|
14
|
+
import { NeuroLinkError } from "./errorHandling.js";
|
|
15
|
+
/**
|
|
16
|
+
* Avatar-specific error codes.
|
|
17
|
+
*/
|
|
18
|
+
export declare const AVATAR_ERROR_CODES: {
|
|
19
|
+
readonly PROVIDER_NOT_SUPPORTED: "AVATAR_PROVIDER_NOT_SUPPORTED";
|
|
20
|
+
readonly PROVIDER_NOT_CONFIGURED: "AVATAR_PROVIDER_NOT_CONFIGURED";
|
|
21
|
+
readonly GENERATION_FAILED: "AVATAR_GENERATION_FAILED";
|
|
22
|
+
readonly POLL_TIMEOUT: "AVATAR_POLL_TIMEOUT";
|
|
23
|
+
readonly INVALID_INPUT: "AVATAR_INVALID_INPUT";
|
|
24
|
+
readonly AUDIO_REQUIRED: "AVATAR_AUDIO_REQUIRED";
|
|
25
|
+
readonly IMAGE_REQUIRED: "AVATAR_IMAGE_REQUIRED";
|
|
26
|
+
readonly AUDIO_TOO_LONG: "AVATAR_AUDIO_TOO_LONG";
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Typed error class for avatar-generation failures.
|
|
30
|
+
*/
|
|
31
|
+
export declare class AvatarError extends NeuroLinkError {
|
|
32
|
+
constructor(options: {
|
|
33
|
+
code: string;
|
|
34
|
+
message: string;
|
|
35
|
+
category?: ErrorCategory;
|
|
36
|
+
severity?: ErrorSeverity;
|
|
37
|
+
retriable?: boolean;
|
|
38
|
+
context?: Record<string, unknown>;
|
|
39
|
+
originalError?: Error;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Static processor managing the avatar handler registry.
|
|
44
|
+
*/
|
|
45
|
+
export declare class AvatarProcessor {
|
|
46
|
+
private static readonly handlers;
|
|
47
|
+
/**
|
|
48
|
+
* Register an avatar handler for a specific provider.
|
|
49
|
+
*/
|
|
50
|
+
static registerHandler(providerName: string, handler: AvatarHandler): void;
|
|
51
|
+
/**
|
|
52
|
+
* Check if a provider has a registered avatar handler.
|
|
53
|
+
*/
|
|
54
|
+
static supports(providerName: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* List the names of all registered providers.
|
|
57
|
+
*/
|
|
58
|
+
static listProviders(): string[];
|
|
59
|
+
private static getHandler;
|
|
60
|
+
private static buildSpanAttributes;
|
|
61
|
+
/**
|
|
62
|
+
* Generate an avatar video via the registered handler.
|
|
63
|
+
*
|
|
64
|
+
* @throws AvatarError on registry miss, handler-not-configured, or
|
|
65
|
+
* generation failure.
|
|
66
|
+
*/
|
|
67
|
+
static generate(provider: string, options: AvatarOptions): Promise<AvatarResult>;
|
|
68
|
+
}
|