@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
|
@@ -11,6 +11,8 @@ import type { DirectorModeOptions, DirectorSegment, VideoGenerationResult, Video
|
|
|
11
11
|
import type { PPTGenerationResult, PPTOutputOptions } from "./ppt.js";
|
|
12
12
|
import type { TTSOptions, TTSResult } from "./tts.js";
|
|
13
13
|
import type { STTOptions, STTResult } from "./stt.js";
|
|
14
|
+
import type { AvatarOptions, AvatarResult } from "./avatar.js";
|
|
15
|
+
import type { MusicOptions, MusicResult } from "./music.js";
|
|
14
16
|
import type { StandardRecord, ValidationSchema, ZodUnknownSchema } from "./aliases.js";
|
|
15
17
|
import type { NeurolinkCredentials } from "./providers.js";
|
|
16
18
|
import type { FileWithMetadata } from "./file.js";
|
|
@@ -20,8 +22,14 @@ import type { WorkflowConfig } from "./workflow.js";
|
|
|
20
22
|
* Supports multimodal content while maintaining backward compatibility
|
|
21
23
|
*/
|
|
22
24
|
export type GenerateOptions = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Input content for generation. Optional for media-only modes (avatar, music,
|
|
27
|
+
* video) where all configuration lives in `output`; the SDK synthesises an
|
|
28
|
+
* empty `input` automatically when this field is omitted.
|
|
29
|
+
*/
|
|
30
|
+
input?: {
|
|
31
|
+
/** Prompt text. Optional for media-only modes (avatar, music) that are driven by uploaded files rather than a prompt. */
|
|
32
|
+
text?: string;
|
|
25
33
|
/**
|
|
26
34
|
* Images to include in the request.
|
|
27
35
|
* Supports simple image data (Buffer, string) or objects with alt text for accessibility.
|
|
@@ -81,8 +89,10 @@ export type GenerateOptions = {
|
|
|
81
89
|
* - "text": Standard text generation (default)
|
|
82
90
|
* - "video": Video generation using models like Veo 3.1
|
|
83
91
|
* - "ppt": PowerPoint presentation generation
|
|
92
|
+
* - "avatar": Talking-head / lip-sync video (D-ID, HeyGen, Replicate-MuseTalk)
|
|
93
|
+
* - "music": Music / sound generation (Beatoven, ElevenLabs Music, Lyria, Replicate)
|
|
84
94
|
*/
|
|
85
|
-
mode?: "text" | "video" | "ppt";
|
|
95
|
+
mode?: "text" | "video" | "ppt" | "avatar" | "music";
|
|
86
96
|
/**
|
|
87
97
|
* Video generation configuration (used when mode is "video")
|
|
88
98
|
* Requires an input image and text prompt
|
|
@@ -98,6 +108,17 @@ export type GenerateOptions = {
|
|
|
98
108
|
* Controls transition prompts, durations, and concurrency.
|
|
99
109
|
*/
|
|
100
110
|
director?: DirectorModeOptions;
|
|
111
|
+
/**
|
|
112
|
+
* Avatar generation configuration (used when mode is "avatar")
|
|
113
|
+
* Combines a portrait image with audio (or text via TTS) to produce
|
|
114
|
+
* a lip-synced talking-head video.
|
|
115
|
+
*/
|
|
116
|
+
avatar?: AvatarOptions;
|
|
117
|
+
/**
|
|
118
|
+
* Music generation configuration (used when mode is "music")
|
|
119
|
+
* Generates music / sound from a text prompt.
|
|
120
|
+
*/
|
|
121
|
+
music?: MusicOptions;
|
|
101
122
|
};
|
|
102
123
|
csvOptions?: {
|
|
103
124
|
maxRows?: number;
|
|
@@ -217,6 +238,12 @@ export type GenerateOptions = {
|
|
|
217
238
|
region?: string;
|
|
218
239
|
temperature?: number;
|
|
219
240
|
maxTokens?: number;
|
|
241
|
+
/** Top-p (nucleus) sampling parameter. Controls diversity of generated tokens. */
|
|
242
|
+
topP?: number;
|
|
243
|
+
/** Top-k sampling parameter. Limits the number of tokens considered. (Google/Gemini models only) */
|
|
244
|
+
topK?: number;
|
|
245
|
+
/** Stop sequences that will halt generation when encountered. */
|
|
246
|
+
stopSequences?: string[];
|
|
220
247
|
systemPrompt?: string;
|
|
221
248
|
/**
|
|
222
249
|
* Zod schema for structured output validation
|
|
@@ -589,6 +616,14 @@ export type GenerateResult = {
|
|
|
589
616
|
* ```
|
|
590
617
|
*/
|
|
591
618
|
video?: VideoGenerationResult;
|
|
619
|
+
/**
|
|
620
|
+
* Avatar (talking-head) generation result (present when output.mode is "avatar")
|
|
621
|
+
*/
|
|
622
|
+
avatar?: AvatarResult;
|
|
623
|
+
/**
|
|
624
|
+
* Music generation result (present when output.mode is "music")
|
|
625
|
+
*/
|
|
626
|
+
music?: MusicResult;
|
|
592
627
|
/**
|
|
593
628
|
* PowerPoint generation result (present when output.mode is "ppt")
|
|
594
629
|
*
|
|
@@ -737,7 +772,8 @@ export type TextGenerationOptions = {
|
|
|
737
772
|
* Supports text, images, and other multimodal inputs.
|
|
738
773
|
*/
|
|
739
774
|
input?: {
|
|
740
|
-
text
|
|
775
|
+
/** Prompt text. Optional for media-only modes (avatar, music) that are driven by uploaded files rather than a prompt. */
|
|
776
|
+
text?: string;
|
|
741
777
|
/**
|
|
742
778
|
* Images to include in the request.
|
|
743
779
|
* For video generation, the first image is used as the source frame.
|
|
@@ -753,6 +789,12 @@ export type TextGenerationOptions = {
|
|
|
753
789
|
region?: string;
|
|
754
790
|
temperature?: number;
|
|
755
791
|
maxTokens?: number;
|
|
792
|
+
/** Top-p (nucleus) sampling parameter. Controls diversity of generated tokens. */
|
|
793
|
+
topP?: number;
|
|
794
|
+
/** Top-k sampling parameter. Limits the number of tokens considered. (Google/Gemini models only) */
|
|
795
|
+
topK?: number;
|
|
796
|
+
/** Stop sequences that will halt generation when encountered. */
|
|
797
|
+
stopSequences?: string[];
|
|
756
798
|
systemPrompt?: string;
|
|
757
799
|
schema?: ZodUnknownSchema | Schema<unknown>;
|
|
758
800
|
/**
|
|
@@ -773,8 +815,10 @@ export type TextGenerationOptions = {
|
|
|
773
815
|
* - "text": Standard text generation (default)
|
|
774
816
|
* - "video": Video generation using models like Veo 3.1
|
|
775
817
|
* - "ppt": PowerPoint presentation generation
|
|
818
|
+
* - "avatar": Talking-head / lip-sync video (D-ID, HeyGen, Replicate-MuseTalk)
|
|
819
|
+
* - "music": Music / sound generation (Beatoven, ElevenLabs Music, Lyria, Replicate)
|
|
776
820
|
*/
|
|
777
|
-
mode?: "text" | "video" | "ppt";
|
|
821
|
+
mode?: "text" | "video" | "ppt" | "avatar" | "music";
|
|
778
822
|
/**
|
|
779
823
|
* Video generation configuration (used when mode is "video")
|
|
780
824
|
*/
|
|
@@ -787,6 +831,14 @@ export type TextGenerationOptions = {
|
|
|
787
831
|
* Director Mode configuration (only used when input.segments is provided)
|
|
788
832
|
*/
|
|
789
833
|
director?: DirectorModeOptions;
|
|
834
|
+
/**
|
|
835
|
+
* Avatar generation configuration (used when mode is "avatar")
|
|
836
|
+
*/
|
|
837
|
+
avatar?: AvatarOptions;
|
|
838
|
+
/**
|
|
839
|
+
* Music generation configuration (used when mode is "music")
|
|
840
|
+
*/
|
|
841
|
+
music?: MusicOptions;
|
|
790
842
|
};
|
|
791
843
|
tools?: Record<string, Tool>;
|
|
792
844
|
/**
|
|
@@ -926,6 +978,8 @@ export type TextGenerationOptions = {
|
|
|
926
978
|
conversationMemoryConfig?: Partial<ConversationMemoryConfig>;
|
|
927
979
|
originalPrompt?: string;
|
|
928
980
|
middleware?: MiddlewareFactoryOptions;
|
|
981
|
+
onFinish?: OnFinishCallback;
|
|
982
|
+
onError?: OnErrorCallback;
|
|
929
983
|
expectedOutcome?: string;
|
|
930
984
|
evaluationCriteria?: string[];
|
|
931
985
|
csvOptions?: {
|
|
@@ -1082,6 +1136,10 @@ export type TextGenerationResult = {
|
|
|
1082
1136
|
transcription?: STTResult;
|
|
1083
1137
|
/** Video generation result */
|
|
1084
1138
|
video?: VideoGenerationResult;
|
|
1139
|
+
/** Avatar (talking-head) generation result */
|
|
1140
|
+
avatar?: AvatarResult;
|
|
1141
|
+
/** Music generation result */
|
|
1142
|
+
music?: MusicResult;
|
|
1085
1143
|
/** PowerPoint generation result */
|
|
1086
1144
|
ppt?: PPTGenerationResult;
|
|
1087
1145
|
/** Image generation output */
|
|
@@ -1090,6 +1148,10 @@ export type TextGenerationResult = {
|
|
|
1090
1148
|
} | null;
|
|
1091
1149
|
/** Gemini 3 thought signature for reasoning continuity across turns */
|
|
1092
1150
|
thoughtSignature?: string;
|
|
1151
|
+
/** Thinking/reasoning text from provider (Anthropic thinking blocks, Gemini thought parts, DeepSeek/NIM reasoning_content) */
|
|
1152
|
+
reasoning?: string;
|
|
1153
|
+
/** Token count for reasoning content */
|
|
1154
|
+
reasoningTokens?: number;
|
|
1093
1155
|
retries?: {
|
|
1094
1156
|
count: number;
|
|
1095
1157
|
errors: Array<{
|
|
@@ -1116,3 +1178,12 @@ export type ModelAliasConfig = {
|
|
|
1116
1178
|
reason?: string;
|
|
1117
1179
|
}>;
|
|
1118
1180
|
};
|
|
1181
|
+
/**
|
|
1182
|
+
* Internal alias used by messageBuilder helpers after the entry-point
|
|
1183
|
+
* (`buildMultimodalMessagesArray`) has guaranteed that `input` is non-null.
|
|
1184
|
+
* All private helper functions that receive post-normalised options should
|
|
1185
|
+
* accept this type to avoid repetitive null checks on every `input.*` access.
|
|
1186
|
+
*/
|
|
1187
|
+
export type GenerateOptionsNormalized = GenerateOptions & {
|
|
1188
|
+
input: NonNullable<GenerateOptions["input"]>;
|
|
1189
|
+
};
|
|
@@ -30,6 +30,7 @@ export * from "./guardrails.js";
|
|
|
30
30
|
export * from "./hitl.js";
|
|
31
31
|
export * from "./mcp.js";
|
|
32
32
|
export * from "./mcpOutput.js";
|
|
33
|
+
export * from "./memory.js";
|
|
33
34
|
export * from "./middleware.js";
|
|
34
35
|
export * from "./model.js";
|
|
35
36
|
export * from "./multimodal.js";
|
|
@@ -59,3 +60,8 @@ export * from "./elicitation.js";
|
|
|
59
60
|
export * from "./dynamic.js";
|
|
60
61
|
export * from "./streamDedup.js";
|
|
61
62
|
export * from "./noOutputSentinel.js";
|
|
63
|
+
export * from "./video.js";
|
|
64
|
+
export * from "./avatar.js";
|
|
65
|
+
export * from "./music.js";
|
|
66
|
+
export * from "./replicate.js";
|
|
67
|
+
export * from "./safeFetch.js";
|
package/dist/lib/types/index.js
CHANGED
|
@@ -31,6 +31,7 @@ export * from "./guardrails.js";
|
|
|
31
31
|
export * from "./hitl.js";
|
|
32
32
|
export * from "./mcp.js";
|
|
33
33
|
export * from "./mcpOutput.js";
|
|
34
|
+
export * from "./memory.js";
|
|
34
35
|
export * from "./middleware.js";
|
|
35
36
|
export * from "./model.js";
|
|
36
37
|
export * from "./multimodal.js";
|
|
@@ -64,4 +65,11 @@ export * from "./dynamic.js";
|
|
|
64
65
|
export * from "./streamDedup.js";
|
|
65
66
|
// Curator P3-6: NoOutputGeneratedError sentinel chunk shape
|
|
66
67
|
export * from "./noOutputSentinel.js";
|
|
68
|
+
// New modality categories (M9.1+)
|
|
69
|
+
export * from "./video.js";
|
|
70
|
+
export * from "./avatar.js";
|
|
71
|
+
export * from "./music.js";
|
|
72
|
+
export * from "./replicate.js";
|
|
73
|
+
// Safe-fetch helper types (SSRF-hardened download)
|
|
74
|
+
export * from "./safeFetch.js";
|
|
67
75
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local structural types for the optional @juspay/hippocampus integration.
|
|
3
|
+
*
|
|
4
|
+
* These mirror the public shapes that ship with @juspay/hippocampus's
|
|
5
|
+
* `dist/types.d.ts` so NeuroLink's public type surface stays compatible
|
|
6
|
+
* for consumers that already configure memory, while the runtime package
|
|
7
|
+
* itself becomes an optional peer dependency. The previous setup (a hard
|
|
8
|
+
* value import of @juspay/hippocampus) made pnpm pull a registry copy of
|
|
9
|
+
* @juspay/neurolink to satisfy Hippocampus's peer, which transitively
|
|
10
|
+
* dragged @ai-sdk/google + @ai-sdk/google-vertex into the production
|
|
11
|
+
* dependency graph.
|
|
12
|
+
*
|
|
13
|
+
* Naming:
|
|
14
|
+
* - Hippocampus's own `StorageType` and `RedisStorageConfig` collide with
|
|
15
|
+
* NeuroLink's in-house Redis manager types in `common.ts` /
|
|
16
|
+
* `conversation.ts`. To satisfy the `unique-type-names` ESLint rule,
|
|
17
|
+
* the storage variants get a `Memory*` prefix here.
|
|
18
|
+
* - `HippocampusMemory` (consumer-facing) and `StorageConfig` (legacy
|
|
19
|
+
* re-export) keep their original public names — only their definitions
|
|
20
|
+
* move from `import("@juspay/hippocampus").Foo` to local structural form.
|
|
21
|
+
*/
|
|
22
|
+
export type MemorySqliteStorageConfig = {
|
|
23
|
+
type: "sqlite";
|
|
24
|
+
/** Path to SQLite file. Default: ./data/hippocampus.sqlite */
|
|
25
|
+
path?: string;
|
|
26
|
+
};
|
|
27
|
+
export type MemoryRedisStorageConfig = {
|
|
28
|
+
type: "redis";
|
|
29
|
+
host?: string;
|
|
30
|
+
port?: number;
|
|
31
|
+
password?: string;
|
|
32
|
+
db?: number;
|
|
33
|
+
keyPrefix?: string;
|
|
34
|
+
ttl?: number;
|
|
35
|
+
};
|
|
36
|
+
export type MemoryS3StorageConfig = {
|
|
37
|
+
type: "s3";
|
|
38
|
+
bucket: string;
|
|
39
|
+
prefix?: string;
|
|
40
|
+
};
|
|
41
|
+
export type MemoryCustomStorageConfig = {
|
|
42
|
+
type: "custom";
|
|
43
|
+
onGet: (ownerId: string) => Promise<string | null>;
|
|
44
|
+
onSet: (ownerId: string, memory: string) => Promise<void>;
|
|
45
|
+
onDelete: (ownerId: string) => Promise<void>;
|
|
46
|
+
onClose?: () => Promise<void>;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Storage configuration accepted by the optional Hippocampus client.
|
|
50
|
+
* Re-exported with the legacy `StorageConfig` name from `conversation.ts`
|
|
51
|
+
* to preserve the existing public type surface.
|
|
52
|
+
*/
|
|
53
|
+
export type HippocampusStorageConfig = MemorySqliteStorageConfig | MemoryRedisStorageConfig | MemoryS3StorageConfig | MemoryCustomStorageConfig;
|
|
54
|
+
/** Per-call options accepted by `Hippocampus.add`. */
|
|
55
|
+
export type HippocampusAddOptions = {
|
|
56
|
+
prompt?: string;
|
|
57
|
+
maxWords?: number;
|
|
58
|
+
};
|
|
59
|
+
/** Constructor config accepted by the Hippocampus class. */
|
|
60
|
+
export type HippocampusConfig = {
|
|
61
|
+
storage?: HippocampusStorageConfig;
|
|
62
|
+
prompt?: string;
|
|
63
|
+
neurolink?: {
|
|
64
|
+
provider?: string;
|
|
65
|
+
model?: string;
|
|
66
|
+
temperature?: number;
|
|
67
|
+
};
|
|
68
|
+
maxWords?: number;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Subset of the @juspay/hippocampus client surface that NeuroLink core
|
|
72
|
+
* actually calls. Defining this locally lets the initializer / SDK code
|
|
73
|
+
* avoid a value or even a type import from the optional package.
|
|
74
|
+
*/
|
|
75
|
+
export type HippocampusLike = {
|
|
76
|
+
add: (ownerId: string, content: string, options?: HippocampusAddOptions) => Promise<string>;
|
|
77
|
+
get: (ownerId: string) => Promise<string | null>;
|
|
78
|
+
delete: (ownerId: string) => Promise<void>;
|
|
79
|
+
close: () => Promise<void>;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Consumer-facing memory config. Same shape as before — the `enabled`
|
|
83
|
+
* flag toggles activation while the rest is passed straight through to
|
|
84
|
+
* the Hippocampus constructor when the optional package is installed.
|
|
85
|
+
*/
|
|
86
|
+
export type HippocampusMemory = HippocampusConfig & {
|
|
87
|
+
enabled?: boolean;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Shape of the dynamically-required `@juspay/hippocampus` module surface
|
|
91
|
+
* that NeuroLink's lazy initializer reaches for. Only the constructor is
|
|
92
|
+
* surfaced here; the rest of the module is irrelevant to core.
|
|
93
|
+
*/
|
|
94
|
+
export type HippocampusModule = {
|
|
95
|
+
Hippocampus: new (config?: HippocampusConfig) => HippocampusLike;
|
|
96
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local structural types for the optional @juspay/hippocampus integration.
|
|
3
|
+
*
|
|
4
|
+
* These mirror the public shapes that ship with @juspay/hippocampus's
|
|
5
|
+
* `dist/types.d.ts` so NeuroLink's public type surface stays compatible
|
|
6
|
+
* for consumers that already configure memory, while the runtime package
|
|
7
|
+
* itself becomes an optional peer dependency. The previous setup (a hard
|
|
8
|
+
* value import of @juspay/hippocampus) made pnpm pull a registry copy of
|
|
9
|
+
* @juspay/neurolink to satisfy Hippocampus's peer, which transitively
|
|
10
|
+
* dragged @ai-sdk/google + @ai-sdk/google-vertex into the production
|
|
11
|
+
* dependency graph.
|
|
12
|
+
*
|
|
13
|
+
* Naming:
|
|
14
|
+
* - Hippocampus's own `StorageType` and `RedisStorageConfig` collide with
|
|
15
|
+
* NeuroLink's in-house Redis manager types in `common.ts` /
|
|
16
|
+
* `conversation.ts`. To satisfy the `unique-type-names` ESLint rule,
|
|
17
|
+
* the storage variants get a `Memory*` prefix here.
|
|
18
|
+
* - `HippocampusMemory` (consumer-facing) and `StorageConfig` (legacy
|
|
19
|
+
* re-export) keep their original public names — only their definitions
|
|
20
|
+
* move from `import("@juspay/hippocampus").Foo` to local structural form.
|
|
21
|
+
*/
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -285,6 +285,33 @@ export type LifecycleMiddlewareConfig = {
|
|
|
285
285
|
onFinish?: OnFinishCallback;
|
|
286
286
|
onError?: OnErrorCallback;
|
|
287
287
|
onChunk?: OnChunkCallback;
|
|
288
|
+
/**
|
|
289
|
+
* Per-callback deadline in milliseconds applied to every
|
|
290
|
+
* `onChunk` / `onFinish` / `onError` invocation. When a callback
|
|
291
|
+
* exceeds this it is logged and abandoned — generate()/stream()
|
|
292
|
+
* still resolves or rejects on schedule.
|
|
293
|
+
*
|
|
294
|
+
* Defaults to the `NEUROLINK_LIFECYCLE_TIMEOUT_MS` env var (also
|
|
295
|
+
* read by the CLI) and ultimately falls back to 5_000. Set `0`
|
|
296
|
+
* to make consumer callbacks effectively fire-and-forget.
|
|
297
|
+
*/
|
|
298
|
+
timeoutMs?: number;
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* Structural view of the nested lifecycle config buried inside a request's
|
|
302
|
+
* middleware blob. Extracted so call sites that need to read it (e.g.
|
|
303
|
+
* `BaseProvider.wrapStreamWithLifecycleCallbacks`,
|
|
304
|
+
* `BaseProvider.fireLifecycleErrorCallback`) don't each inline the same
|
|
305
|
+
* three-level cast.
|
|
306
|
+
*/
|
|
307
|
+
export type OptionsWithLifecycleMiddleware = {
|
|
308
|
+
middleware?: {
|
|
309
|
+
middlewareConfig?: {
|
|
310
|
+
lifecycle?: {
|
|
311
|
+
config?: LifecycleMiddlewareConfig;
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
};
|
|
288
315
|
};
|
|
289
316
|
/** Options for the abort-signal middleware. */
|
|
290
317
|
export type AbortSignalMiddlewareOptions = {
|
|
@@ -141,14 +141,47 @@ export type AudioContent = {
|
|
|
141
141
|
* ```
|
|
142
142
|
*/
|
|
143
143
|
export type VideoOutputOptions = {
|
|
144
|
+
/**
|
|
145
|
+
* Per-call cancellation signal forwarded to provider requests and polling
|
|
146
|
+
* loops. When aborted, long-running video generation is interrupted and
|
|
147
|
+
* the handler throws a non-retriable abort error.
|
|
148
|
+
*/
|
|
149
|
+
abortSignal?: AbortSignal;
|
|
150
|
+
/**
|
|
151
|
+
* Override the video-gen provider. Defaults to "vertex" or to the LLM
|
|
152
|
+
* provider name if it is also a registered video handler.
|
|
153
|
+
*
|
|
154
|
+
* Registered providers are managed via `VideoProcessor.registerHandler`
|
|
155
|
+
* (see src/lib/utils/videoProcessor.ts). Examples: "vertex", "kling",
|
|
156
|
+
* "runway", "replicate".
|
|
157
|
+
*/
|
|
158
|
+
provider?: string;
|
|
159
|
+
/**
|
|
160
|
+
* Specific model to use within the provider. Provider-specific shape
|
|
161
|
+
* (e.g. "veo-3.1-generate-001" for vertex; "atonamy/wan-alpha:..." for
|
|
162
|
+
* replicate).
|
|
163
|
+
*/
|
|
164
|
+
model?: string;
|
|
144
165
|
/** Output resolution - "720p" (1280x720) or "1080p" (1920x1080) */
|
|
145
166
|
resolution?: "720p" | "1080p";
|
|
146
167
|
/** Video duration in seconds (4, 6, or 8 seconds supported) */
|
|
147
168
|
length?: 4 | 6 | 8;
|
|
148
|
-
/** Aspect ratio - "9:16" for portrait
|
|
149
|
-
aspectRatio?: "9:16" | "16:9";
|
|
169
|
+
/** Aspect ratio - "9:16" for portrait, "16:9" for landscape, "1:1" for square */
|
|
170
|
+
aspectRatio?: "9:16" | "16:9" | "1:1";
|
|
150
171
|
/** Enable audio generation (default: true) */
|
|
151
172
|
audio?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Publicly accessible URL of the input image.
|
|
175
|
+
* Required by providers that do not accept inline base64 data (e.g. PiAPI Kling).
|
|
176
|
+
* When provided and the provider requires a URL, this takes precedence over the
|
|
177
|
+
* `image` Buffer argument passed to `generate()`.
|
|
178
|
+
*/
|
|
179
|
+
imageUrl?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Per-call provider credentials. Takes precedence over instance-level
|
|
182
|
+
* credentials set at construction time, which in turn override env vars.
|
|
183
|
+
*/
|
|
184
|
+
credentials?: import("./providers.js").NeurolinkCredentials;
|
|
152
185
|
};
|
|
153
186
|
/**
|
|
154
187
|
* A single segment in Director Mode, representing one video clip.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Music Generation Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Types for music / sound-effect generation across providers (Beatoven,
|
|
5
|
+
* ElevenLabs Music, Lyria, Replicate-hosted MusicGen / Riffusion / AudioGen).
|
|
6
|
+
*
|
|
7
|
+
* Music is a separate modality from TTS — TTS produces voiced speech with
|
|
8
|
+
* prosody; Music produces melodic / harmonic / textural audio.
|
|
9
|
+
*
|
|
10
|
+
* @module types/music
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Output audio formats supported across music providers.
|
|
14
|
+
*/
|
|
15
|
+
export type MusicAudioFormat = "mp3" | "wav" | "flac" | "ogg";
|
|
16
|
+
/**
|
|
17
|
+
* Music genre — provider-specific, free-text accepted.
|
|
18
|
+
*
|
|
19
|
+
* Common genres: "ambient", "cinematic", "rock", "pop", "jazz", "classical",
|
|
20
|
+
* "electronic", "lo-fi", "hip-hop", "orchestral", "synthwave", "folk".
|
|
21
|
+
*/
|
|
22
|
+
export type MusicGenre = string;
|
|
23
|
+
/**
|
|
24
|
+
* Music mood — provider-specific, free-text accepted.
|
|
25
|
+
*
|
|
26
|
+
* Common moods: "uplifting", "melancholic", "tense", "calm", "energetic",
|
|
27
|
+
* "mysterious", "romantic", "epic".
|
|
28
|
+
*/
|
|
29
|
+
export type MusicMood = string;
|
|
30
|
+
/**
|
|
31
|
+
* Options for music generation requests.
|
|
32
|
+
*/
|
|
33
|
+
export type MusicOptions = {
|
|
34
|
+
/** Text prompt describing the music to generate (required). */
|
|
35
|
+
prompt: string;
|
|
36
|
+
/** Target duration in seconds. Provider-clamped to its supported range. */
|
|
37
|
+
duration?: number;
|
|
38
|
+
/** Output format (default: "mp3"). */
|
|
39
|
+
format?: MusicAudioFormat;
|
|
40
|
+
/** Genre hint (e.g. "ambient", "cinematic"). */
|
|
41
|
+
genre?: MusicGenre;
|
|
42
|
+
/** Mood / emotion hint (e.g. "uplifting", "tense"). */
|
|
43
|
+
mood?: MusicMood;
|
|
44
|
+
/** Tempo in BPM (provider-specific support). */
|
|
45
|
+
tempo?: number;
|
|
46
|
+
/** Override the music provider (e.g. "beatoven", "elevenlabs-music", "lyria", "replicate"). */
|
|
47
|
+
provider?: string;
|
|
48
|
+
/** Reference audio for melody / style guidance (Buffer or path). */
|
|
49
|
+
referenceAudio?: Buffer | string;
|
|
50
|
+
/** Output file path (optional — buffer is always returned in result). */
|
|
51
|
+
output?: string;
|
|
52
|
+
/** Per-call timeout in ms (default: 5 minutes). */
|
|
53
|
+
timeout?: number;
|
|
54
|
+
/** Provider-specific additional options. */
|
|
55
|
+
[key: string]: unknown;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Result of a music generation request.
|
|
59
|
+
*/
|
|
60
|
+
export type MusicResult = {
|
|
61
|
+
/** Generated audio buffer. */
|
|
62
|
+
buffer: Buffer;
|
|
63
|
+
/** Output format. */
|
|
64
|
+
format: MusicAudioFormat;
|
|
65
|
+
/** File size in bytes. */
|
|
66
|
+
size: number;
|
|
67
|
+
/** Duration in seconds (when reported by the provider). */
|
|
68
|
+
duration?: number;
|
|
69
|
+
/** Provider used for generation. */
|
|
70
|
+
provider?: string;
|
|
71
|
+
/** Performance / request metadata. */
|
|
72
|
+
metadata?: {
|
|
73
|
+
/** Request latency in milliseconds. */
|
|
74
|
+
latency: number;
|
|
75
|
+
/** Provider name. */
|
|
76
|
+
provider?: string;
|
|
77
|
+
/** Model variant used (when applicable). */
|
|
78
|
+
model?: string;
|
|
79
|
+
/** Sample rate (when known). */
|
|
80
|
+
sampleRate?: number;
|
|
81
|
+
/** Bit rate (when known). */
|
|
82
|
+
bitRate?: number;
|
|
83
|
+
/** Track / job identifier from the upstream. */
|
|
84
|
+
jobId?: string;
|
|
85
|
+
/** Any additional provider-specific metadata. */
|
|
86
|
+
[key: string]: unknown;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Handler contract for music-generation providers.
|
|
91
|
+
*
|
|
92
|
+
* Implementations enforce their own timeouts. Recommended:
|
|
93
|
+
* - Per-request fetch timeout: 30 seconds
|
|
94
|
+
* - Total job-completion timeout: 5 minutes
|
|
95
|
+
*/
|
|
96
|
+
export type MusicHandler = {
|
|
97
|
+
/**
|
|
98
|
+
* Generate a music track from prompt + options.
|
|
99
|
+
*
|
|
100
|
+
* @param options - prompt, duration, format, genre, mood, etc.
|
|
101
|
+
*/
|
|
102
|
+
generate(options: MusicOptions): Promise<MusicResult>;
|
|
103
|
+
/**
|
|
104
|
+
* Validate the provider is configured (auth, base URL, etc.).
|
|
105
|
+
*/
|
|
106
|
+
isConfigured(): boolean;
|
|
107
|
+
/** Maximum supported track duration in seconds (provider-specific). */
|
|
108
|
+
readonly maxDurationSeconds?: number;
|
|
109
|
+
/** Output formats supported by this handler. */
|
|
110
|
+
readonly supportedFormats?: readonly MusicAudioFormat[];
|
|
111
|
+
/** Genres / styles the upstream advertises (informational). */
|
|
112
|
+
readonly supportedGenres?: readonly string[];
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Valid music audio formats — runtime validation array.
|
|
116
|
+
*/
|
|
117
|
+
export declare const VALID_MUSIC_FORMATS: readonly MusicAudioFormat[];
|
|
118
|
+
/**
|
|
119
|
+
* Beatoven.ai task status response.
|
|
120
|
+
*
|
|
121
|
+
* Used by `BeatovenMusic` handler to type-check polling responses.
|
|
122
|
+
*/
|
|
123
|
+
export type BeatovenTaskStatus = {
|
|
124
|
+
status: "composing" | "running" | "composed" | "failed";
|
|
125
|
+
meta?: {
|
|
126
|
+
track_url?: string;
|
|
127
|
+
project_id?: string;
|
|
128
|
+
track_id?: string;
|
|
129
|
+
duration?: number;
|
|
130
|
+
};
|
|
131
|
+
message?: string;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Beatoven.ai compose-track submit response.
|
|
135
|
+
*/
|
|
136
|
+
export type BeatovenComposeResponse = {
|
|
137
|
+
task_id: string;
|
|
138
|
+
status?: string;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Google Lyria 3 Pro :generateContent response shape.
|
|
142
|
+
*
|
|
143
|
+
* The audio comes back as a part with `inlineData: { mimeType, data }`
|
|
144
|
+
* where `data` is base64-encoded WAV.
|
|
145
|
+
*/
|
|
146
|
+
export type LyriaResponse = {
|
|
147
|
+
candidates?: {
|
|
148
|
+
content?: {
|
|
149
|
+
parts?: {
|
|
150
|
+
inlineData?: {
|
|
151
|
+
mimeType?: string;
|
|
152
|
+
data?: string;
|
|
153
|
+
};
|
|
154
|
+
text?: string;
|
|
155
|
+
}[];
|
|
156
|
+
};
|
|
157
|
+
finishReason?: string;
|
|
158
|
+
index?: number;
|
|
159
|
+
}[];
|
|
160
|
+
usageMetadata?: {
|
|
161
|
+
promptTokenCount?: number;
|
|
162
|
+
candidatesTokenCount?: number;
|
|
163
|
+
totalTokenCount?: number;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Music Generation Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Types for music / sound-effect generation across providers (Beatoven,
|
|
5
|
+
* ElevenLabs Music, Lyria, Replicate-hosted MusicGen / Riffusion / AudioGen).
|
|
6
|
+
*
|
|
7
|
+
* Music is a separate modality from TTS — TTS produces voiced speech with
|
|
8
|
+
* prosody; Music produces melodic / harmonic / textural audio.
|
|
9
|
+
*
|
|
10
|
+
* @module types/music
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Valid music audio formats — runtime validation array.
|
|
14
|
+
*/
|
|
15
|
+
export const VALID_MUSIC_FORMATS = [
|
|
16
|
+
"mp3",
|
|
17
|
+
"wav",
|
|
18
|
+
"flac",
|
|
19
|
+
"ogg",
|
|
20
|
+
];
|
|
21
|
+
//# sourceMappingURL=music.js.map
|