@juspay/neurolink 9.64.0 → 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.
Files changed (322) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +18 -17
  3. package/dist/adapters/providerImageAdapter.js +29 -1
  4. package/dist/adapters/replicate/auth.d.ts +19 -0
  5. package/dist/adapters/replicate/auth.js +32 -0
  6. package/dist/adapters/replicate/predictionLifecycle.d.ts +46 -0
  7. package/dist/adapters/replicate/predictionLifecycle.js +283 -0
  8. package/dist/adapters/video/klingVideoHandler.d.ts +37 -0
  9. package/dist/adapters/video/klingVideoHandler.js +305 -0
  10. package/dist/adapters/video/replicateVideoHandler.d.ts +29 -0
  11. package/dist/adapters/video/replicateVideoHandler.js +157 -0
  12. package/dist/adapters/video/runwayVideoHandler.d.ts +32 -0
  13. package/dist/adapters/video/runwayVideoHandler.js +316 -0
  14. package/dist/adapters/video/vertexVideoHandler.d.ts +19 -1
  15. package/dist/adapters/video/vertexVideoHandler.js +33 -9
  16. package/dist/autoresearch/runner.js +8 -2
  17. package/dist/avatar/index.d.ts +13 -0
  18. package/dist/avatar/index.js +13 -0
  19. package/dist/avatar/providers/DIDAvatar.d.ts +49 -0
  20. package/dist/avatar/providers/DIDAvatar.js +501 -0
  21. package/dist/avatar/providers/HeyGenAvatar.d.ts +30 -0
  22. package/dist/avatar/providers/HeyGenAvatar.js +337 -0
  23. package/dist/avatar/providers/ReplicateAvatar.d.ts +36 -0
  24. package/dist/avatar/providers/ReplicateAvatar.js +267 -0
  25. package/dist/browser/neurolink.min.js +633 -610
  26. package/dist/cli/commands/mcp.js +29 -0
  27. package/dist/cli/commands/proxy.js +24 -5
  28. package/dist/cli/factories/commandFactory.d.ts +11 -1
  29. package/dist/cli/factories/commandFactory.js +291 -38
  30. package/dist/constants/contextWindows.js +101 -0
  31. package/dist/constants/enums.d.ts +273 -2
  32. package/dist/constants/enums.js +290 -1
  33. package/dist/constants/videoErrors.d.ts +4 -0
  34. package/dist/constants/videoErrors.js +4 -0
  35. package/dist/core/baseProvider.d.ts +22 -2
  36. package/dist/core/baseProvider.js +217 -11
  37. package/dist/core/constants.d.ts +11 -0
  38. package/dist/core/constants.js +69 -1
  39. package/dist/core/redisConversationMemoryManager.js +6 -0
  40. package/dist/evaluation/index.d.ts +2 -0
  41. package/dist/evaluation/index.js +4 -0
  42. package/dist/factories/providerFactory.js +7 -1
  43. package/dist/factories/providerRegistry.js +202 -5
  44. package/dist/features/ppt/contentPlanner.js +42 -14
  45. package/dist/index.d.ts +9 -1
  46. package/dist/index.js +16 -1
  47. package/dist/lib/adapters/providerImageAdapter.js +29 -1
  48. package/dist/lib/adapters/replicate/auth.d.ts +19 -0
  49. package/dist/lib/adapters/replicate/auth.js +33 -0
  50. package/dist/lib/adapters/replicate/predictionLifecycle.d.ts +46 -0
  51. package/dist/lib/adapters/replicate/predictionLifecycle.js +284 -0
  52. package/dist/lib/adapters/video/klingVideoHandler.d.ts +37 -0
  53. package/dist/lib/adapters/video/klingVideoHandler.js +306 -0
  54. package/dist/lib/adapters/video/replicateVideoHandler.d.ts +29 -0
  55. package/dist/lib/adapters/video/replicateVideoHandler.js +158 -0
  56. package/dist/lib/adapters/video/runwayVideoHandler.d.ts +32 -0
  57. package/dist/lib/adapters/video/runwayVideoHandler.js +317 -0
  58. package/dist/lib/adapters/video/vertexVideoHandler.d.ts +19 -1
  59. package/dist/lib/adapters/video/vertexVideoHandler.js +33 -9
  60. package/dist/lib/autoresearch/runner.js +8 -2
  61. package/dist/lib/avatar/index.d.ts +13 -0
  62. package/dist/lib/avatar/index.js +14 -0
  63. package/dist/lib/avatar/providers/DIDAvatar.d.ts +49 -0
  64. package/dist/lib/avatar/providers/DIDAvatar.js +502 -0
  65. package/dist/lib/avatar/providers/HeyGenAvatar.d.ts +30 -0
  66. package/dist/lib/avatar/providers/HeyGenAvatar.js +338 -0
  67. package/dist/lib/avatar/providers/ReplicateAvatar.d.ts +36 -0
  68. package/dist/lib/avatar/providers/ReplicateAvatar.js +268 -0
  69. package/dist/lib/constants/contextWindows.js +101 -0
  70. package/dist/lib/constants/enums.d.ts +273 -2
  71. package/dist/lib/constants/enums.js +290 -1
  72. package/dist/lib/constants/videoErrors.d.ts +4 -0
  73. package/dist/lib/constants/videoErrors.js +4 -0
  74. package/dist/lib/core/baseProvider.d.ts +22 -2
  75. package/dist/lib/core/baseProvider.js +217 -11
  76. package/dist/lib/core/constants.d.ts +11 -0
  77. package/dist/lib/core/constants.js +69 -1
  78. package/dist/lib/core/redisConversationMemoryManager.js +6 -0
  79. package/dist/lib/evaluation/index.d.ts +2 -0
  80. package/dist/lib/evaluation/index.js +4 -0
  81. package/dist/lib/factories/providerFactory.js +7 -1
  82. package/dist/lib/factories/providerRegistry.js +202 -5
  83. package/dist/lib/features/ppt/contentPlanner.js +42 -14
  84. package/dist/lib/index.d.ts +9 -1
  85. package/dist/lib/index.js +16 -1
  86. package/dist/lib/middleware/builtin/lifecycle.js +39 -9
  87. package/dist/lib/music/index.d.ts +13 -0
  88. package/dist/lib/music/index.js +14 -0
  89. package/dist/lib/music/providers/BeatovenMusic.d.ts +31 -0
  90. package/dist/lib/music/providers/BeatovenMusic.js +334 -0
  91. package/dist/lib/music/providers/ElevenLabsMusic.d.ts +30 -0
  92. package/dist/lib/music/providers/ElevenLabsMusic.js +169 -0
  93. package/dist/lib/music/providers/LyriaMusic.d.ts +29 -0
  94. package/dist/lib/music/providers/LyriaMusic.js +173 -0
  95. package/dist/lib/music/providers/ReplicateMusic.d.ts +31 -0
  96. package/dist/lib/music/providers/ReplicateMusic.js +262 -0
  97. package/dist/lib/neurolink.d.ts +30 -0
  98. package/dist/lib/neurolink.js +323 -77
  99. package/dist/lib/providers/amazonBedrock.d.ts +10 -0
  100. package/dist/lib/providers/amazonBedrock.js +94 -39
  101. package/dist/lib/providers/anthropic.js +55 -7
  102. package/dist/lib/providers/anthropicBaseProvider.js +1 -1
  103. package/dist/lib/providers/azureOpenai.js +66 -17
  104. package/dist/lib/providers/cloudflare.d.ts +35 -0
  105. package/dist/lib/providers/cloudflare.js +174 -0
  106. package/dist/lib/providers/cohere.d.ts +52 -0
  107. package/dist/lib/providers/cohere.js +253 -0
  108. package/dist/lib/providers/deepseek.js +72 -17
  109. package/dist/lib/providers/fireworks.d.ts +33 -0
  110. package/dist/lib/providers/fireworks.js +164 -0
  111. package/dist/lib/providers/googleAiStudio.js +45 -6
  112. package/dist/lib/providers/googleNativeGemini3.d.ts +24 -1
  113. package/dist/lib/providers/googleNativeGemini3.js +173 -21
  114. package/dist/lib/providers/googleVertex.js +173 -17
  115. package/dist/lib/providers/groq.d.ts +33 -0
  116. package/dist/lib/providers/groq.js +181 -0
  117. package/dist/lib/providers/huggingFace.js +9 -8
  118. package/dist/lib/providers/ideogram.d.ts +34 -0
  119. package/dist/lib/providers/ideogram.js +184 -0
  120. package/dist/lib/providers/index.d.ts +13 -0
  121. package/dist/lib/providers/index.js +13 -0
  122. package/dist/lib/providers/jina.d.ts +59 -0
  123. package/dist/lib/providers/jina.js +218 -0
  124. package/dist/lib/providers/llamaCpp.js +14 -46
  125. package/dist/lib/providers/lmStudio.js +14 -47
  126. package/dist/lib/providers/mistral.js +7 -7
  127. package/dist/lib/providers/nvidiaNim.js +160 -19
  128. package/dist/lib/providers/ollama.js +7 -7
  129. package/dist/lib/providers/openAI.d.ts +22 -1
  130. package/dist/lib/providers/openAI.js +181 -0
  131. package/dist/lib/providers/openRouter.js +35 -23
  132. package/dist/lib/providers/openaiCompatible.js +9 -8
  133. package/dist/lib/providers/perplexity.d.ts +33 -0
  134. package/dist/lib/providers/perplexity.js +179 -0
  135. package/dist/lib/providers/recraft.d.ts +34 -0
  136. package/dist/lib/providers/recraft.js +197 -0
  137. package/dist/lib/providers/replicate.d.ts +75 -0
  138. package/dist/lib/providers/replicate.js +403 -0
  139. package/dist/lib/providers/stability.d.ts +37 -0
  140. package/dist/lib/providers/stability.js +191 -0
  141. package/dist/lib/providers/togetherAi.d.ts +33 -0
  142. package/dist/lib/providers/togetherAi.js +176 -0
  143. package/dist/lib/providers/voyage.d.ts +47 -0
  144. package/dist/lib/providers/voyage.js +177 -0
  145. package/dist/lib/providers/xai.d.ts +33 -0
  146. package/dist/lib/providers/xai.js +172 -0
  147. package/dist/lib/telemetry/index.d.ts +1 -1
  148. package/dist/lib/telemetry/index.js +1 -1
  149. package/dist/lib/telemetry/tracers.d.ts +19 -0
  150. package/dist/lib/telemetry/tracers.js +19 -0
  151. package/dist/lib/telemetry/withSpan.d.ts +35 -0
  152. package/dist/lib/telemetry/withSpan.js +103 -0
  153. package/dist/lib/types/avatar.d.ts +143 -0
  154. package/dist/lib/types/avatar.js +20 -0
  155. package/dist/lib/types/cli.d.ts +6 -0
  156. package/dist/lib/types/generate.d.ts +62 -5
  157. package/dist/lib/types/index.d.ts +5 -0
  158. package/dist/lib/types/index.js +7 -0
  159. package/dist/lib/types/middleware.d.ts +27 -0
  160. package/dist/lib/types/multimodal.d.ts +35 -2
  161. package/dist/lib/types/music.d.ts +165 -0
  162. package/dist/lib/types/music.js +21 -0
  163. package/dist/lib/types/providers.d.ts +144 -1
  164. package/dist/lib/types/replicate.d.ts +67 -0
  165. package/dist/lib/types/replicate.js +10 -0
  166. package/dist/lib/types/safeFetch.d.ts +15 -0
  167. package/dist/lib/types/safeFetch.js +7 -0
  168. package/dist/lib/types/stream.d.ts +2 -1
  169. package/dist/lib/types/tools.d.ts +13 -0
  170. package/dist/lib/types/video.d.ts +89 -0
  171. package/dist/lib/types/video.js +15 -0
  172. package/dist/lib/utils/avatarProcessor.d.ts +68 -0
  173. package/dist/lib/utils/avatarProcessor.js +172 -0
  174. package/dist/lib/utils/cloneOptions.d.ts +36 -0
  175. package/dist/lib/utils/cloneOptions.js +62 -0
  176. package/dist/lib/utils/lifecycleCallbacks.d.ts +51 -8
  177. package/dist/lib/utils/lifecycleCallbacks.js +82 -26
  178. package/dist/lib/utils/lifecycleTimeout.d.ts +25 -0
  179. package/dist/lib/utils/lifecycleTimeout.js +39 -0
  180. package/dist/lib/utils/logSanitize.d.ts +49 -0
  181. package/dist/lib/utils/logSanitize.js +170 -0
  182. package/dist/lib/utils/loggingFetch.d.ts +29 -0
  183. package/dist/lib/utils/loggingFetch.js +60 -0
  184. package/dist/lib/utils/messageBuilder.js +43 -25
  185. package/dist/lib/utils/modelChoices.js +236 -3
  186. package/dist/lib/utils/musicProcessor.d.ts +67 -0
  187. package/dist/lib/utils/musicProcessor.js +189 -0
  188. package/dist/lib/utils/optionsConversion.js +3 -2
  189. package/dist/lib/utils/parameterValidation.js +14 -4
  190. package/dist/lib/utils/pricing.js +193 -0
  191. package/dist/lib/utils/providerConfig.d.ts +55 -0
  192. package/dist/lib/utils/providerConfig.js +224 -0
  193. package/dist/lib/utils/safeFetch.d.ts +26 -0
  194. package/dist/lib/utils/safeFetch.js +83 -0
  195. package/dist/lib/utils/sizeGuard.d.ts +34 -0
  196. package/dist/lib/utils/sizeGuard.js +45 -0
  197. package/dist/lib/utils/ssrfGuard.d.ts +52 -0
  198. package/dist/lib/utils/ssrfGuard.js +411 -0
  199. package/dist/lib/utils/videoProcessor.d.ts +60 -0
  200. package/dist/lib/utils/videoProcessor.js +201 -0
  201. package/dist/lib/voice/providers/FishAudioTTS.d.ts +27 -0
  202. package/dist/lib/voice/providers/FishAudioTTS.js +183 -0
  203. package/dist/lib/workflow/core/ensembleExecutor.js +26 -9
  204. package/dist/middleware/builtin/lifecycle.js +39 -9
  205. package/dist/music/index.d.ts +13 -0
  206. package/dist/music/index.js +13 -0
  207. package/dist/music/providers/BeatovenMusic.d.ts +31 -0
  208. package/dist/music/providers/BeatovenMusic.js +333 -0
  209. package/dist/music/providers/ElevenLabsMusic.d.ts +30 -0
  210. package/dist/music/providers/ElevenLabsMusic.js +168 -0
  211. package/dist/music/providers/LyriaMusic.d.ts +29 -0
  212. package/dist/music/providers/LyriaMusic.js +172 -0
  213. package/dist/music/providers/ReplicateMusic.d.ts +31 -0
  214. package/dist/music/providers/ReplicateMusic.js +261 -0
  215. package/dist/neurolink.d.ts +30 -0
  216. package/dist/neurolink.js +323 -77
  217. package/dist/providers/amazonBedrock.d.ts +10 -0
  218. package/dist/providers/amazonBedrock.js +94 -39
  219. package/dist/providers/anthropic.js +55 -7
  220. package/dist/providers/anthropicBaseProvider.js +1 -1
  221. package/dist/providers/azureOpenai.js +66 -17
  222. package/dist/providers/cloudflare.d.ts +35 -0
  223. package/dist/providers/cloudflare.js +173 -0
  224. package/dist/providers/cohere.d.ts +52 -0
  225. package/dist/providers/cohere.js +252 -0
  226. package/dist/providers/deepseek.js +72 -17
  227. package/dist/providers/fireworks.d.ts +33 -0
  228. package/dist/providers/fireworks.js +163 -0
  229. package/dist/providers/googleAiStudio.js +45 -6
  230. package/dist/providers/googleNativeGemini3.d.ts +24 -1
  231. package/dist/providers/googleNativeGemini3.js +173 -21
  232. package/dist/providers/googleVertex.js +173 -17
  233. package/dist/providers/groq.d.ts +33 -0
  234. package/dist/providers/groq.js +180 -0
  235. package/dist/providers/huggingFace.js +9 -8
  236. package/dist/providers/ideogram.d.ts +34 -0
  237. package/dist/providers/ideogram.js +183 -0
  238. package/dist/providers/index.d.ts +13 -0
  239. package/dist/providers/index.js +13 -0
  240. package/dist/providers/jina.d.ts +59 -0
  241. package/dist/providers/jina.js +217 -0
  242. package/dist/providers/llamaCpp.js +14 -46
  243. package/dist/providers/lmStudio.js +14 -47
  244. package/dist/providers/mistral.js +7 -7
  245. package/dist/providers/nvidiaNim.js +160 -19
  246. package/dist/providers/ollama.js +7 -7
  247. package/dist/providers/openAI.d.ts +22 -1
  248. package/dist/providers/openAI.js +181 -0
  249. package/dist/providers/openRouter.js +35 -23
  250. package/dist/providers/openaiCompatible.js +9 -8
  251. package/dist/providers/perplexity.d.ts +33 -0
  252. package/dist/providers/perplexity.js +178 -0
  253. package/dist/providers/recraft.d.ts +34 -0
  254. package/dist/providers/recraft.js +196 -0
  255. package/dist/providers/replicate.d.ts +75 -0
  256. package/dist/providers/replicate.js +402 -0
  257. package/dist/providers/stability.d.ts +37 -0
  258. package/dist/providers/stability.js +190 -0
  259. package/dist/providers/togetherAi.d.ts +33 -0
  260. package/dist/providers/togetherAi.js +175 -0
  261. package/dist/providers/voyage.d.ts +47 -0
  262. package/dist/providers/voyage.js +176 -0
  263. package/dist/providers/xai.d.ts +33 -0
  264. package/dist/providers/xai.js +171 -0
  265. package/dist/telemetry/index.d.ts +1 -1
  266. package/dist/telemetry/index.js +1 -1
  267. package/dist/telemetry/tracers.d.ts +19 -0
  268. package/dist/telemetry/tracers.js +19 -0
  269. package/dist/telemetry/withSpan.d.ts +35 -0
  270. package/dist/telemetry/withSpan.js +103 -0
  271. package/dist/types/avatar.d.ts +143 -0
  272. package/dist/types/avatar.js +19 -0
  273. package/dist/types/cli.d.ts +6 -0
  274. package/dist/types/generate.d.ts +62 -5
  275. package/dist/types/index.d.ts +5 -0
  276. package/dist/types/index.js +7 -0
  277. package/dist/types/middleware.d.ts +27 -0
  278. package/dist/types/multimodal.d.ts +35 -2
  279. package/dist/types/music.d.ts +165 -0
  280. package/dist/types/music.js +20 -0
  281. package/dist/types/providers.d.ts +144 -1
  282. package/dist/types/replicate.d.ts +67 -0
  283. package/dist/types/replicate.js +9 -0
  284. package/dist/types/safeFetch.d.ts +15 -0
  285. package/dist/types/safeFetch.js +6 -0
  286. package/dist/types/stream.d.ts +2 -1
  287. package/dist/types/tools.d.ts +13 -0
  288. package/dist/types/video.d.ts +89 -0
  289. package/dist/types/video.js +14 -0
  290. package/dist/utils/avatarProcessor.d.ts +68 -0
  291. package/dist/utils/avatarProcessor.js +171 -0
  292. package/dist/utils/cloneOptions.d.ts +36 -0
  293. package/dist/utils/cloneOptions.js +61 -0
  294. package/dist/utils/lifecycleCallbacks.d.ts +51 -8
  295. package/dist/utils/lifecycleCallbacks.js +82 -26
  296. package/dist/utils/lifecycleTimeout.d.ts +25 -0
  297. package/dist/utils/lifecycleTimeout.js +38 -0
  298. package/dist/utils/logSanitize.d.ts +49 -0
  299. package/dist/utils/logSanitize.js +169 -0
  300. package/dist/utils/loggingFetch.d.ts +29 -0
  301. package/dist/utils/loggingFetch.js +59 -0
  302. package/dist/utils/messageBuilder.js +43 -25
  303. package/dist/utils/modelChoices.js +236 -3
  304. package/dist/utils/musicProcessor.d.ts +67 -0
  305. package/dist/utils/musicProcessor.js +188 -0
  306. package/dist/utils/optionsConversion.js +3 -2
  307. package/dist/utils/parameterValidation.js +14 -4
  308. package/dist/utils/pricing.js +193 -0
  309. package/dist/utils/providerConfig.d.ts +55 -0
  310. package/dist/utils/providerConfig.js +224 -0
  311. package/dist/utils/safeFetch.d.ts +26 -0
  312. package/dist/utils/safeFetch.js +82 -0
  313. package/dist/utils/sizeGuard.d.ts +34 -0
  314. package/dist/utils/sizeGuard.js +44 -0
  315. package/dist/utils/ssrfGuard.d.ts +52 -0
  316. package/dist/utils/ssrfGuard.js +410 -0
  317. package/dist/utils/videoProcessor.d.ts +60 -0
  318. package/dist/utils/videoProcessor.js +200 -0
  319. package/dist/voice/providers/FishAudioTTS.d.ts +27 -0
  320. package/dist/voice/providers/FishAudioTTS.js +182 -0
  321. package/dist/workflow/core/ensembleExecutor.js +26 -9
  322. package/package.json +32 -5
@@ -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
- input: {
24
- text: string;
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;
@@ -595,6 +616,14 @@ export type GenerateResult = {
595
616
  * ```
596
617
  */
597
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;
598
627
  /**
599
628
  * PowerPoint generation result (present when output.mode is "ppt")
600
629
  *
@@ -743,7 +772,8 @@ export type TextGenerationOptions = {
743
772
  * Supports text, images, and other multimodal inputs.
744
773
  */
745
774
  input?: {
746
- text: string;
775
+ /** Prompt text. Optional for media-only modes (avatar, music) that are driven by uploaded files rather than a prompt. */
776
+ text?: string;
747
777
  /**
748
778
  * Images to include in the request.
749
779
  * For video generation, the first image is used as the source frame.
@@ -785,8 +815,10 @@ export type TextGenerationOptions = {
785
815
  * - "text": Standard text generation (default)
786
816
  * - "video": Video generation using models like Veo 3.1
787
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)
788
820
  */
789
- mode?: "text" | "video" | "ppt";
821
+ mode?: "text" | "video" | "ppt" | "avatar" | "music";
790
822
  /**
791
823
  * Video generation configuration (used when mode is "video")
792
824
  */
@@ -799,6 +831,14 @@ export type TextGenerationOptions = {
799
831
  * Director Mode configuration (only used when input.segments is provided)
800
832
  */
801
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;
802
842
  };
803
843
  tools?: Record<string, Tool>;
804
844
  /**
@@ -1096,6 +1136,10 @@ export type TextGenerationResult = {
1096
1136
  transcription?: STTResult;
1097
1137
  /** Video generation result */
1098
1138
  video?: VideoGenerationResult;
1139
+ /** Avatar (talking-head) generation result */
1140
+ avatar?: AvatarResult;
1141
+ /** Music generation result */
1142
+ music?: MusicResult;
1099
1143
  /** PowerPoint generation result */
1100
1144
  ppt?: PPTGenerationResult;
1101
1145
  /** Image generation output */
@@ -1104,6 +1148,10 @@ export type TextGenerationResult = {
1104
1148
  } | null;
1105
1149
  /** Gemini 3 thought signature for reasoning continuity across turns */
1106
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;
1107
1155
  retries?: {
1108
1156
  count: number;
1109
1157
  errors: Array<{
@@ -1130,3 +1178,12 @@ export type ModelAliasConfig = {
1130
1178
  reason?: string;
1131
1179
  }>;
1132
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
+ };
@@ -60,3 +60,8 @@ export * from "./elicitation.js";
60
60
  export * from "./dynamic.js";
61
61
  export * from "./streamDedup.js";
62
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";
@@ -65,3 +65,10 @@ export * from "./dynamic.js";
65
65
  export * from "./streamDedup.js";
66
66
  // Curator P3-6: NoOutputGeneratedError sentinel chunk shape
67
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";
@@ -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 or "16:9" for landscape */
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,20 @@
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
+ ];
@@ -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`.
@@ -1473,10 +1608,18 @@ export type NativeFunctionDeclaration = {
1473
1608
  export type NativeToolsConfig = Array<{
1474
1609
  functionDeclarations: NativeFunctionDeclaration[];
1475
1610
  }>;
1476
- /** Return value of buildNativeToolDeclarations. */
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
+ */
1477
1619
  export type NativeToolDeclarationsResult = {
1478
1620
  toolsConfig: NativeToolsConfig;
1479
1621
  executeMap: Map<string, Tool["execute"]>;
1622
+ originalNameMap: Map<string, string>;
1480
1623
  };
1481
1624
  /** A single function call returned by the Gemini model. */
1482
1625
  export type NativeFunctionCall = {
@@ -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,9 @@
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 {};
@@ -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
+ };