@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.
Files changed (358) hide show
  1. package/CHANGELOG.md +12 -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 +42 -11
  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 +573 -554
  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 +25 -1
  29. package/dist/cli/factories/commandFactory.js +341 -63
  30. package/dist/cli/loop/optionsSchema.d.ts +1 -1
  31. package/dist/cli/loop/optionsSchema.js +12 -0
  32. package/dist/constants/contextWindows.js +101 -0
  33. package/dist/constants/enums.d.ts +273 -2
  34. package/dist/constants/enums.js +290 -1
  35. package/dist/constants/videoErrors.d.ts +4 -0
  36. package/dist/constants/videoErrors.js +4 -0
  37. package/dist/core/baseProvider.d.ts +23 -3
  38. package/dist/core/baseProvider.js +217 -11
  39. package/dist/core/constants.d.ts +11 -0
  40. package/dist/core/constants.js +69 -1
  41. package/dist/core/modules/MessageBuilder.js +20 -0
  42. package/dist/core/redisConversationMemoryManager.js +6 -0
  43. package/dist/evaluation/index.d.ts +2 -0
  44. package/dist/evaluation/index.js +4 -0
  45. package/dist/factories/providerFactory.js +7 -1
  46. package/dist/factories/providerRegistry.js +203 -2
  47. package/dist/features/ppt/contentPlanner.js +42 -14
  48. package/dist/index.d.ts +9 -1
  49. package/dist/index.js +16 -1
  50. package/dist/lib/adapters/providerImageAdapter.js +29 -1
  51. package/dist/lib/adapters/replicate/auth.d.ts +19 -0
  52. package/dist/lib/adapters/replicate/auth.js +33 -0
  53. package/dist/lib/adapters/replicate/predictionLifecycle.d.ts +46 -0
  54. package/dist/lib/adapters/replicate/predictionLifecycle.js +284 -0
  55. package/dist/lib/adapters/video/klingVideoHandler.d.ts +37 -0
  56. package/dist/lib/adapters/video/klingVideoHandler.js +306 -0
  57. package/dist/lib/adapters/video/replicateVideoHandler.d.ts +29 -0
  58. package/dist/lib/adapters/video/replicateVideoHandler.js +158 -0
  59. package/dist/lib/adapters/video/runwayVideoHandler.d.ts +32 -0
  60. package/dist/lib/adapters/video/runwayVideoHandler.js +317 -0
  61. package/dist/lib/adapters/video/vertexVideoHandler.d.ts +19 -1
  62. package/dist/lib/adapters/video/vertexVideoHandler.js +42 -11
  63. package/dist/lib/autoresearch/runner.js +8 -2
  64. package/dist/lib/avatar/index.d.ts +13 -0
  65. package/dist/lib/avatar/index.js +14 -0
  66. package/dist/lib/avatar/providers/DIDAvatar.d.ts +49 -0
  67. package/dist/lib/avatar/providers/DIDAvatar.js +502 -0
  68. package/dist/lib/avatar/providers/HeyGenAvatar.d.ts +30 -0
  69. package/dist/lib/avatar/providers/HeyGenAvatar.js +338 -0
  70. package/dist/lib/avatar/providers/ReplicateAvatar.d.ts +36 -0
  71. package/dist/lib/avatar/providers/ReplicateAvatar.js +268 -0
  72. package/dist/lib/constants/contextWindows.js +101 -0
  73. package/dist/lib/constants/enums.d.ts +273 -2
  74. package/dist/lib/constants/enums.js +290 -1
  75. package/dist/lib/constants/videoErrors.d.ts +4 -0
  76. package/dist/lib/constants/videoErrors.js +4 -0
  77. package/dist/lib/core/baseProvider.d.ts +23 -3
  78. package/dist/lib/core/baseProvider.js +217 -11
  79. package/dist/lib/core/constants.d.ts +11 -0
  80. package/dist/lib/core/constants.js +69 -1
  81. package/dist/lib/core/modules/MessageBuilder.js +20 -0
  82. package/dist/lib/core/redisConversationMemoryManager.js +6 -0
  83. package/dist/lib/evaluation/index.d.ts +2 -0
  84. package/dist/lib/evaluation/index.js +4 -0
  85. package/dist/lib/factories/providerFactory.js +7 -1
  86. package/dist/lib/factories/providerRegistry.js +203 -2
  87. package/dist/lib/features/ppt/contentPlanner.js +42 -14
  88. package/dist/lib/index.d.ts +9 -1
  89. package/dist/lib/index.js +16 -1
  90. package/dist/lib/memory/hippocampusInitializer.d.ts +2 -2
  91. package/dist/lib/memory/hippocampusInitializer.js +32 -2
  92. package/dist/lib/middleware/builtin/lifecycle.js +52 -51
  93. package/dist/lib/music/index.d.ts +13 -0
  94. package/dist/lib/music/index.js +14 -0
  95. package/dist/lib/music/providers/BeatovenMusic.d.ts +31 -0
  96. package/dist/lib/music/providers/BeatovenMusic.js +334 -0
  97. package/dist/lib/music/providers/ElevenLabsMusic.d.ts +30 -0
  98. package/dist/lib/music/providers/ElevenLabsMusic.js +169 -0
  99. package/dist/lib/music/providers/LyriaMusic.d.ts +29 -0
  100. package/dist/lib/music/providers/LyriaMusic.js +173 -0
  101. package/dist/lib/music/providers/ReplicateMusic.d.ts +31 -0
  102. package/dist/lib/music/providers/ReplicateMusic.js +262 -0
  103. package/dist/lib/neurolink.d.ts +30 -0
  104. package/dist/lib/neurolink.js +342 -49
  105. package/dist/lib/providers/amazonBedrock.d.ts +10 -0
  106. package/dist/lib/providers/amazonBedrock.js +94 -39
  107. package/dist/lib/providers/anthropic.js +55 -7
  108. package/dist/lib/providers/anthropicBaseProvider.js +1 -1
  109. package/dist/lib/providers/azureOpenai.js +66 -17
  110. package/dist/lib/providers/cloudflare.d.ts +35 -0
  111. package/dist/lib/providers/cloudflare.js +174 -0
  112. package/dist/lib/providers/cohere.d.ts +52 -0
  113. package/dist/lib/providers/cohere.js +253 -0
  114. package/dist/lib/providers/deepseek.js +72 -17
  115. package/dist/lib/providers/fireworks.d.ts +33 -0
  116. package/dist/lib/providers/fireworks.js +164 -0
  117. package/dist/lib/providers/googleAiStudio.d.ts +11 -3
  118. package/dist/lib/providers/googleAiStudio.js +336 -344
  119. package/dist/lib/providers/googleNativeGemini3.d.ts +107 -2
  120. package/dist/lib/providers/googleNativeGemini3.js +381 -25
  121. package/dist/lib/providers/googleVertex.d.ts +116 -129
  122. package/dist/lib/providers/googleVertex.js +3002 -1988
  123. package/dist/lib/providers/groq.d.ts +33 -0
  124. package/dist/lib/providers/groq.js +181 -0
  125. package/dist/lib/providers/huggingFace.js +9 -8
  126. package/dist/lib/providers/ideogram.d.ts +34 -0
  127. package/dist/lib/providers/ideogram.js +184 -0
  128. package/dist/lib/providers/index.d.ts +13 -0
  129. package/dist/lib/providers/index.js +13 -0
  130. package/dist/lib/providers/jina.d.ts +59 -0
  131. package/dist/lib/providers/jina.js +218 -0
  132. package/dist/lib/providers/llamaCpp.js +14 -46
  133. package/dist/lib/providers/lmStudio.js +14 -47
  134. package/dist/lib/providers/mistral.js +7 -7
  135. package/dist/lib/providers/nvidiaNim.js +160 -19
  136. package/dist/lib/providers/ollama.js +7 -7
  137. package/dist/lib/providers/openAI.d.ts +22 -1
  138. package/dist/lib/providers/openAI.js +181 -0
  139. package/dist/lib/providers/openRouter.js +38 -22
  140. package/dist/lib/providers/openaiCompatible.js +9 -8
  141. package/dist/lib/providers/perplexity.d.ts +33 -0
  142. package/dist/lib/providers/perplexity.js +179 -0
  143. package/dist/lib/providers/recraft.d.ts +34 -0
  144. package/dist/lib/providers/recraft.js +197 -0
  145. package/dist/lib/providers/replicate.d.ts +75 -0
  146. package/dist/lib/providers/replicate.js +403 -0
  147. package/dist/lib/providers/stability.d.ts +37 -0
  148. package/dist/lib/providers/stability.js +191 -0
  149. package/dist/lib/providers/togetherAi.d.ts +33 -0
  150. package/dist/lib/providers/togetherAi.js +176 -0
  151. package/dist/lib/providers/voyage.d.ts +47 -0
  152. package/dist/lib/providers/voyage.js +177 -0
  153. package/dist/lib/providers/xai.d.ts +33 -0
  154. package/dist/lib/providers/xai.js +172 -0
  155. package/dist/lib/telemetry/index.d.ts +1 -1
  156. package/dist/lib/telemetry/index.js +1 -1
  157. package/dist/lib/telemetry/tracers.d.ts +19 -0
  158. package/dist/lib/telemetry/tracers.js +19 -0
  159. package/dist/lib/telemetry/withSpan.d.ts +35 -0
  160. package/dist/lib/telemetry/withSpan.js +103 -0
  161. package/dist/lib/types/aliases.d.ts +14 -0
  162. package/dist/lib/types/avatar.d.ts +143 -0
  163. package/dist/lib/types/avatar.js +20 -0
  164. package/dist/lib/types/cli.d.ts +6 -0
  165. package/dist/lib/types/common.d.ts +0 -3
  166. package/dist/lib/types/conversation.d.ts +10 -3
  167. package/dist/lib/types/generate.d.ts +76 -5
  168. package/dist/lib/types/index.d.ts +6 -0
  169. package/dist/lib/types/index.js +8 -0
  170. package/dist/lib/types/memory.d.ts +96 -0
  171. package/dist/lib/types/memory.js +23 -0
  172. package/dist/lib/types/middleware.d.ts +27 -0
  173. package/dist/lib/types/multimodal.d.ts +35 -2
  174. package/dist/lib/types/music.d.ts +165 -0
  175. package/dist/lib/types/music.js +21 -0
  176. package/dist/lib/types/providers.d.ts +284 -3
  177. package/dist/lib/types/replicate.d.ts +67 -0
  178. package/dist/lib/types/replicate.js +10 -0
  179. package/dist/lib/types/safeFetch.d.ts +15 -0
  180. package/dist/lib/types/safeFetch.js +7 -0
  181. package/dist/lib/types/stream.d.ts +8 -1
  182. package/dist/lib/types/tools.d.ts +13 -0
  183. package/dist/lib/types/video.d.ts +89 -0
  184. package/dist/lib/types/video.js +15 -0
  185. package/dist/lib/utils/avatarProcessor.d.ts +68 -0
  186. package/dist/lib/utils/avatarProcessor.js +172 -0
  187. package/dist/lib/utils/cloneOptions.d.ts +36 -0
  188. package/dist/lib/utils/cloneOptions.js +62 -0
  189. package/dist/lib/utils/lifecycleCallbacks.d.ts +56 -0
  190. package/dist/lib/utils/lifecycleCallbacks.js +100 -0
  191. package/dist/lib/utils/lifecycleTimeout.d.ts +25 -0
  192. package/dist/lib/utils/lifecycleTimeout.js +39 -0
  193. package/dist/lib/utils/logSanitize.d.ts +49 -0
  194. package/dist/lib/utils/logSanitize.js +170 -0
  195. package/dist/lib/utils/loggingFetch.d.ts +29 -0
  196. package/dist/lib/utils/loggingFetch.js +60 -0
  197. package/dist/lib/utils/messageBuilder.d.ts +10 -0
  198. package/dist/lib/utils/messageBuilder.js +83 -30
  199. package/dist/lib/utils/modelChoices.js +236 -3
  200. package/dist/lib/utils/modelDetection.d.ts +11 -0
  201. package/dist/lib/utils/modelDetection.js +27 -0
  202. package/dist/lib/utils/musicProcessor.d.ts +67 -0
  203. package/dist/lib/utils/musicProcessor.js +189 -0
  204. package/dist/lib/utils/optionsConversion.js +3 -2
  205. package/dist/lib/utils/parameterValidation.js +14 -4
  206. package/dist/lib/utils/pricing.js +193 -0
  207. package/dist/lib/utils/providerConfig.d.ts +55 -0
  208. package/dist/lib/utils/providerConfig.js +224 -0
  209. package/dist/lib/utils/providerHealth.js +7 -7
  210. package/dist/lib/utils/safeFetch.d.ts +26 -0
  211. package/dist/lib/utils/safeFetch.js +83 -0
  212. package/dist/lib/utils/schemaConversion.d.ts +1 -1
  213. package/dist/lib/utils/schemaConversion.js +59 -4
  214. package/dist/lib/utils/sizeGuard.d.ts +34 -0
  215. package/dist/lib/utils/sizeGuard.js +45 -0
  216. package/dist/lib/utils/ssrfGuard.d.ts +52 -0
  217. package/dist/lib/utils/ssrfGuard.js +411 -0
  218. package/dist/lib/utils/tokenLimits.js +23 -32
  219. package/dist/lib/utils/videoProcessor.d.ts +60 -0
  220. package/dist/lib/utils/videoProcessor.js +201 -0
  221. package/dist/lib/voice/providers/FishAudioTTS.d.ts +27 -0
  222. package/dist/lib/voice/providers/FishAudioTTS.js +183 -0
  223. package/dist/lib/workflow/core/ensembleExecutor.js +26 -9
  224. package/dist/memory/hippocampusInitializer.d.ts +2 -2
  225. package/dist/memory/hippocampusInitializer.js +32 -2
  226. package/dist/middleware/builtin/lifecycle.js +52 -51
  227. package/dist/music/index.d.ts +13 -0
  228. package/dist/music/index.js +13 -0
  229. package/dist/music/providers/BeatovenMusic.d.ts +31 -0
  230. package/dist/music/providers/BeatovenMusic.js +333 -0
  231. package/dist/music/providers/ElevenLabsMusic.d.ts +30 -0
  232. package/dist/music/providers/ElevenLabsMusic.js +168 -0
  233. package/dist/music/providers/LyriaMusic.d.ts +29 -0
  234. package/dist/music/providers/LyriaMusic.js +172 -0
  235. package/dist/music/providers/ReplicateMusic.d.ts +31 -0
  236. package/dist/music/providers/ReplicateMusic.js +261 -0
  237. package/dist/neurolink.d.ts +30 -0
  238. package/dist/neurolink.js +342 -49
  239. package/dist/providers/amazonBedrock.d.ts +10 -0
  240. package/dist/providers/amazonBedrock.js +94 -39
  241. package/dist/providers/anthropic.js +55 -7
  242. package/dist/providers/anthropicBaseProvider.js +1 -1
  243. package/dist/providers/azureOpenai.js +66 -17
  244. package/dist/providers/cloudflare.d.ts +35 -0
  245. package/dist/providers/cloudflare.js +173 -0
  246. package/dist/providers/cohere.d.ts +52 -0
  247. package/dist/providers/cohere.js +252 -0
  248. package/dist/providers/deepseek.js +72 -17
  249. package/dist/providers/fireworks.d.ts +33 -0
  250. package/dist/providers/fireworks.js +163 -0
  251. package/dist/providers/googleAiStudio.d.ts +11 -3
  252. package/dist/providers/googleAiStudio.js +335 -344
  253. package/dist/providers/googleNativeGemini3.d.ts +107 -2
  254. package/dist/providers/googleNativeGemini3.js +381 -25
  255. package/dist/providers/googleVertex.d.ts +116 -129
  256. package/dist/providers/googleVertex.js +3000 -1987
  257. package/dist/providers/groq.d.ts +33 -0
  258. package/dist/providers/groq.js +180 -0
  259. package/dist/providers/huggingFace.js +9 -8
  260. package/dist/providers/ideogram.d.ts +34 -0
  261. package/dist/providers/ideogram.js +183 -0
  262. package/dist/providers/index.d.ts +13 -0
  263. package/dist/providers/index.js +13 -0
  264. package/dist/providers/jina.d.ts +59 -0
  265. package/dist/providers/jina.js +217 -0
  266. package/dist/providers/llamaCpp.js +14 -46
  267. package/dist/providers/lmStudio.js +14 -47
  268. package/dist/providers/mistral.js +7 -7
  269. package/dist/providers/nvidiaNim.js +160 -19
  270. package/dist/providers/ollama.js +7 -7
  271. package/dist/providers/openAI.d.ts +22 -1
  272. package/dist/providers/openAI.js +181 -0
  273. package/dist/providers/openRouter.js +38 -22
  274. package/dist/providers/openaiCompatible.js +9 -8
  275. package/dist/providers/perplexity.d.ts +33 -0
  276. package/dist/providers/perplexity.js +178 -0
  277. package/dist/providers/recraft.d.ts +34 -0
  278. package/dist/providers/recraft.js +196 -0
  279. package/dist/providers/replicate.d.ts +75 -0
  280. package/dist/providers/replicate.js +402 -0
  281. package/dist/providers/stability.d.ts +37 -0
  282. package/dist/providers/stability.js +190 -0
  283. package/dist/providers/togetherAi.d.ts +33 -0
  284. package/dist/providers/togetherAi.js +175 -0
  285. package/dist/providers/voyage.d.ts +47 -0
  286. package/dist/providers/voyage.js +176 -0
  287. package/dist/providers/xai.d.ts +33 -0
  288. package/dist/providers/xai.js +171 -0
  289. package/dist/telemetry/index.d.ts +1 -1
  290. package/dist/telemetry/index.js +1 -1
  291. package/dist/telemetry/tracers.d.ts +19 -0
  292. package/dist/telemetry/tracers.js +19 -0
  293. package/dist/telemetry/withSpan.d.ts +35 -0
  294. package/dist/telemetry/withSpan.js +103 -0
  295. package/dist/types/aliases.d.ts +14 -0
  296. package/dist/types/avatar.d.ts +143 -0
  297. package/dist/types/avatar.js +19 -0
  298. package/dist/types/cli.d.ts +6 -0
  299. package/dist/types/common.d.ts +0 -3
  300. package/dist/types/conversation.d.ts +10 -3
  301. package/dist/types/generate.d.ts +76 -5
  302. package/dist/types/index.d.ts +6 -0
  303. package/dist/types/index.js +8 -0
  304. package/dist/types/memory.d.ts +96 -0
  305. package/dist/types/memory.js +22 -0
  306. package/dist/types/middleware.d.ts +27 -0
  307. package/dist/types/multimodal.d.ts +35 -2
  308. package/dist/types/music.d.ts +165 -0
  309. package/dist/types/music.js +20 -0
  310. package/dist/types/providers.d.ts +284 -3
  311. package/dist/types/replicate.d.ts +67 -0
  312. package/dist/types/replicate.js +9 -0
  313. package/dist/types/safeFetch.d.ts +15 -0
  314. package/dist/types/safeFetch.js +6 -0
  315. package/dist/types/stream.d.ts +8 -1
  316. package/dist/types/tools.d.ts +13 -0
  317. package/dist/types/video.d.ts +89 -0
  318. package/dist/types/video.js +14 -0
  319. package/dist/utils/avatarProcessor.d.ts +68 -0
  320. package/dist/utils/avatarProcessor.js +171 -0
  321. package/dist/utils/cloneOptions.d.ts +36 -0
  322. package/dist/utils/cloneOptions.js +61 -0
  323. package/dist/utils/lifecycleCallbacks.d.ts +56 -0
  324. package/dist/utils/lifecycleCallbacks.js +99 -0
  325. package/dist/utils/lifecycleTimeout.d.ts +25 -0
  326. package/dist/utils/lifecycleTimeout.js +38 -0
  327. package/dist/utils/logSanitize.d.ts +49 -0
  328. package/dist/utils/logSanitize.js +169 -0
  329. package/dist/utils/loggingFetch.d.ts +29 -0
  330. package/dist/utils/loggingFetch.js +59 -0
  331. package/dist/utils/messageBuilder.d.ts +10 -0
  332. package/dist/utils/messageBuilder.js +83 -30
  333. package/dist/utils/modelChoices.js +236 -3
  334. package/dist/utils/modelDetection.d.ts +11 -0
  335. package/dist/utils/modelDetection.js +27 -0
  336. package/dist/utils/musicProcessor.d.ts +67 -0
  337. package/dist/utils/musicProcessor.js +188 -0
  338. package/dist/utils/optionsConversion.js +3 -2
  339. package/dist/utils/parameterValidation.js +14 -4
  340. package/dist/utils/pricing.js +193 -0
  341. package/dist/utils/providerConfig.d.ts +55 -0
  342. package/dist/utils/providerConfig.js +224 -0
  343. package/dist/utils/providerHealth.js +7 -7
  344. package/dist/utils/safeFetch.d.ts +26 -0
  345. package/dist/utils/safeFetch.js +82 -0
  346. package/dist/utils/schemaConversion.d.ts +1 -1
  347. package/dist/utils/schemaConversion.js +59 -4
  348. package/dist/utils/sizeGuard.d.ts +34 -0
  349. package/dist/utils/sizeGuard.js +44 -0
  350. package/dist/utils/ssrfGuard.d.ts +52 -0
  351. package/dist/utils/ssrfGuard.js +410 -0
  352. package/dist/utils/tokenLimits.js +23 -32
  353. package/dist/utils/videoProcessor.d.ts +60 -0
  354. package/dist/utils/videoProcessor.js +200 -0
  355. package/dist/voice/providers/FishAudioTTS.d.ts +27 -0
  356. package/dist/voice/providers/FishAudioTTS.js +182 -0
  357. package/dist/workflow/core/ensembleExecutor.js +26 -9
  358. package/package.json +42 -8
@@ -28,6 +28,35 @@ import { SageMakerCommandFactory } from "./sagemakerCommandFactory.js";
28
28
  * CLI Command Factory for generate commands
29
29
  */
30
30
  export class CLICommandFactory {
31
+ /**
32
+ * Normalize loop session variables before merging them into provider options.
33
+ *
34
+ * The CLI loop schema models some fields (e.g. `stopSequences`,
35
+ * `enabledToolNames`) as a single comma-separated string for ergonomic
36
+ * input, but providers expect `string[]`. Without conversion,
37
+ * `set stopSequences a,b` would be sent as one stop token "a,b" instead
38
+ * of two ("a", "b"); `set enabledToolNames read,write` would be cast to
39
+ * a `string[]` containing the single literal "read,write" and silently
40
+ * filter out every tool. This helper splits and trims those fields so
41
+ * the spread into `enhancedOptions` produces the correct shape across
42
+ * generate / batch / stream paths.
43
+ */
44
+ static normalizeLoopSessionVariables(vars) {
45
+ const normalized = { ...vars };
46
+ if (typeof normalized.stopSequences === "string") {
47
+ normalized.stopSequences = normalized.stopSequences
48
+ .split(",")
49
+ .map((s) => s.trim())
50
+ .filter(Boolean);
51
+ }
52
+ if (typeof normalized.enabledToolNames === "string") {
53
+ normalized.enabledToolNames = normalized.enabledToolNames
54
+ .split(",")
55
+ .map((s) => s.trim())
56
+ .filter(Boolean);
57
+ }
58
+ return normalized;
59
+ }
31
60
  // Common options available on all commands
32
61
  static commonOptions = {
33
62
  // Core generation options
@@ -61,6 +90,28 @@ export class CLICommandFactory {
61
90
  "lms",
62
91
  "llamacpp",
63
92
  "llama.cpp",
93
+ "xai",
94
+ "grok",
95
+ "groq",
96
+ "cohere",
97
+ "together-ai",
98
+ "together",
99
+ "fireworks",
100
+ "perplexity",
101
+ "pplx",
102
+ "cloudflare",
103
+ "workers-ai",
104
+ "cf-ai",
105
+ "replicate",
106
+ "voyage",
107
+ "voyage-ai",
108
+ "jina",
109
+ "jina-ai",
110
+ "stability",
111
+ "stability-ai",
112
+ "sd",
113
+ "ideogram",
114
+ "recraft",
64
115
  ],
65
116
  default: "auto",
66
117
  description: "AI provider to use (auto-selects best available). Use 'anthropic-subscription' for Claude subscription plans.",
@@ -337,12 +388,16 @@ export class CLICommandFactory {
337
388
  type: "string",
338
389
  description: "Path to audio file for STT transcription",
339
390
  },
340
- // Video Generation options (Veo 3.1)
391
+ // Video Generation options (Veo 3.1, Kling, Runway, Replicate)
341
392
  outputMode: {
342
393
  type: "string",
343
- choices: ["text", "video", "ppt"],
394
+ choices: ["text", "video", "ppt", "avatar", "music"],
344
395
  default: "text",
345
- description: "Output mode: 'text' for standard generation, 'video' for video, 'ppt' for presentation",
396
+ description: "Output mode: 'text' (default), 'video' (Veo/Kling/Runway/Replicate), 'ppt' (presentation), 'avatar' (D-ID/HeyGen/MuseTalk talking-head), 'music' (Beatoven/ElevenLabs/Lyria/MusicGen)",
397
+ },
398
+ videoProvider: {
399
+ type: "string",
400
+ description: "Video provider override (e.g., 'vertex' (default), 'kling', 'runway', 'replicate')",
346
401
  },
347
402
  videoOutput: {
348
403
  type: "string",
@@ -352,25 +407,86 @@ export class CLICommandFactory {
352
407
  videoResolution: {
353
408
  type: "string",
354
409
  choices: ["720p", "1080p"],
355
- default: "720p",
356
- description: "Video output resolution (720p or 1080p)",
410
+ description: "Video output resolution (720p or 1080p; provider default applied if omitted)",
357
411
  },
358
412
  videoLength: {
359
413
  type: "number",
360
414
  choices: [4, 6, 8],
361
- default: 4,
362
- description: "Video duration in seconds (4, 6, or 8)",
415
+ description: "Video duration in seconds (4, 6, or 8; provider default applied if omitted)",
363
416
  },
364
417
  videoAspectRatio: {
365
418
  type: "string",
366
419
  choices: ["9:16", "16:9"],
367
- default: "16:9",
368
- description: "Video aspect ratio (9:16 for portrait, 16:9 for landscape)",
420
+ description: "Video aspect ratio (9:16 for portrait, 16:9 for landscape; provider default applied if omitted)",
369
421
  },
370
422
  videoAudio: {
371
423
  type: "boolean",
372
- default: true,
373
- description: "Enable/disable audio generation in video",
424
+ description: "Enable/disable audio generation in video (provider default applied if omitted)",
425
+ },
426
+ // Avatar Generation options (D-ID, HeyGen, MuseTalk via Replicate)
427
+ avatarProvider: {
428
+ type: "string",
429
+ description: "Avatar provider (e.g., 'd-id' (default), 'heygen', 'replicate', 'musetalk')",
430
+ },
431
+ avatarImage: {
432
+ type: "string",
433
+ description: "Path to source portrait image (or HeyGen avatar id when --avatarProvider heygen)",
434
+ },
435
+ avatarAudio: {
436
+ type: "string",
437
+ description: "Path to narration audio (alternative to --avatarText)",
438
+ },
439
+ avatarText: {
440
+ type: "string",
441
+ description: "Text the avatar should speak (the provider runs TTS internally)",
442
+ },
443
+ avatarVoice: {
444
+ type: "string",
445
+ description: "Voice id for TTS-driven avatars (provider-specific catalog id)",
446
+ },
447
+ avatarQuality: {
448
+ type: "string",
449
+ choices: ["standard", "hd"],
450
+ description: "Avatar output quality preset (provider default applied if omitted)",
451
+ },
452
+ avatarFormat: {
453
+ type: "string",
454
+ choices: ["mp4", "webm", "mov"],
455
+ description: "Avatar video output format (provider default applied if omitted)",
456
+ },
457
+ avatarOutput: {
458
+ type: "string",
459
+ description: "Path to save generated avatar video (e.g., ./avatar.mp4)",
460
+ },
461
+ // Music Generation options (Beatoven, ElevenLabs, Lyria, MusicGen via Replicate)
462
+ musicProvider: {
463
+ type: "string",
464
+ description: "Music provider (e.g., 'beatoven' (default), 'elevenlabs-music', 'lyria', 'replicate', 'musicgen')",
465
+ },
466
+ musicDuration: {
467
+ type: "number",
468
+ description: "Music duration in seconds (provider-clamped)",
469
+ },
470
+ musicFormat: {
471
+ type: "string",
472
+ choices: ["mp3", "wav", "flac", "ogg"],
473
+ description: "Music output format",
474
+ },
475
+ musicGenre: {
476
+ type: "string",
477
+ description: "Music genre hint (e.g., 'ambient', 'cinematic', 'electronic')",
478
+ },
479
+ musicMood: {
480
+ type: "string",
481
+ description: "Music mood hint (e.g., 'uplifting', 'tense', 'melancholic')",
482
+ },
483
+ musicTempo: {
484
+ type: "number",
485
+ description: "Music tempo in BPM",
486
+ },
487
+ musicOutput: {
488
+ type: "string",
489
+ description: "Path to save generated music (e.g., ./track.mp3)",
374
490
  },
375
491
  // PPT Generation options
376
492
  pptPages: {
@@ -621,6 +737,13 @@ export class CLICommandFactory {
621
737
  model: argv.model,
622
738
  temperature: argv.temperature,
623
739
  maxTokens: argv.maxTokens,
740
+ // Sampling controls — surfaced here so all three command paths
741
+ // (generate / stream / batch) get them consistently typed instead
742
+ // of relying on an ad-hoc cast at each sdk call site.
743
+ topP: argv.topP,
744
+ topK: argv.topK,
745
+ stopSequences: argv.stopSequences,
746
+ enabledToolNames: argv.enabledToolNames,
624
747
  systemPrompt: argv.system,
625
748
  timeout: argv.timeout,
626
749
  disableTools: argv.disableTools,
@@ -657,11 +780,29 @@ export class CLICommandFactory {
657
780
  inputAudio: argv.inputAudio,
658
781
  // Video generation options (Veo 3.1)
659
782
  outputMode: argv.outputMode,
783
+ videoProvider: argv.videoProvider,
660
784
  videoOutput: argv.videoOutput,
661
785
  videoResolution: argv.videoResolution,
662
786
  videoLength: argv.videoLength,
663
787
  videoAspectRatio: argv.videoAspectRatio,
664
788
  videoAudio: argv.videoAudio,
789
+ // Avatar generation options
790
+ avatarProvider: argv.avatarProvider,
791
+ avatarImage: argv.avatarImage,
792
+ avatarAudio: argv.avatarAudio,
793
+ avatarText: argv.avatarText,
794
+ avatarVoice: argv.avatarVoice,
795
+ avatarQuality: argv.avatarQuality,
796
+ avatarFormat: argv.avatarFormat,
797
+ avatarOutput: argv.avatarOutput,
798
+ // Music generation options
799
+ musicProvider: argv.musicProvider,
800
+ musicDuration: argv.musicDuration,
801
+ musicFormat: argv.musicFormat,
802
+ musicGenre: argv.musicGenre,
803
+ musicMood: argv.musicMood,
804
+ musicTempo: argv.musicTempo,
805
+ musicOutput: argv.musicOutput,
665
806
  // PPT generation options
666
807
  pptPages: argv.pptPages,
667
808
  pptTheme: argv.pptTheme,
@@ -850,19 +991,13 @@ export class CLICommandFactory {
850
991
  static configureVideoMode(enhancedOptions, argv, options) {
851
992
  const userEnabledTools = !argv.disableTools; // Tools are enabled by default
852
993
  enhancedOptions.disableTools = true;
853
- // Auto-set provider to vertex for video generation if not explicitly specified
854
- if (!enhancedOptions.provider) {
855
- enhancedOptions.provider = "vertex";
994
+ // Resolve video provider from explicit --videoProvider first, then top-level --provider, then default to vertex.
995
+ if (!enhancedOptions.videoProvider) {
996
+ enhancedOptions.videoProvider =
997
+ enhancedOptions.provider ?? "vertex";
856
998
  if (options.debug) {
857
- logger.debug("Auto-setting provider to 'vertex' for video generation mode");
858
- }
859
- }
860
- else if (enhancedOptions.provider !== "vertex") {
861
- // Warn if user specified a non-vertex provider
862
- if (!options.quiet) {
863
- logger.always(chalk.yellow(`⚠️ Warning: Video generation only supports Vertex AI. Overriding provider '${enhancedOptions.provider}' to 'vertex'.`));
999
+ logger.debug(`Auto-setting video provider to '${enhancedOptions.videoProvider}' for video generation mode`);
864
1000
  }
865
- enhancedOptions.provider = "vertex";
866
1001
  }
867
1002
  // Auto-set model to veo-3.1 if not explicitly specified
868
1003
  if (!enhancedOptions.model) {
@@ -976,6 +1111,68 @@ export class CLICommandFactory {
976
1111
  handleError(error, "Video Output");
977
1112
  }
978
1113
  }
1114
+ /**
1115
+ * Helper method to handle avatar video file output.
1116
+ * Saves the generated avatar buffer to --avatarOutput path when provided.
1117
+ */
1118
+ static async handleAvatarOutput(result, options) {
1119
+ const avatarOutputPath = options.avatarOutput;
1120
+ if (!avatarOutputPath) {
1121
+ return;
1122
+ }
1123
+ if (!result || typeof result !== "object") {
1124
+ return;
1125
+ }
1126
+ const generateResult = result;
1127
+ const avatar = generateResult.avatar;
1128
+ if (!avatar) {
1129
+ if (!options.quiet) {
1130
+ logger.always(chalk.yellow("⚠️ No avatar video available in result. Avatar generation may not be enabled or the request failed."));
1131
+ }
1132
+ return;
1133
+ }
1134
+ try {
1135
+ fs.writeFileSync(avatarOutputPath, avatar.buffer);
1136
+ if (!options.quiet) {
1137
+ const sizeStr = formatFileSize(avatar.size);
1138
+ logger.always(chalk.green(`👤 Avatar video saved to: ${avatarOutputPath} (${sizeStr})`));
1139
+ }
1140
+ }
1141
+ catch (error) {
1142
+ handleError(error, "Avatar Output");
1143
+ }
1144
+ }
1145
+ /**
1146
+ * Helper method to handle music audio file output.
1147
+ * Saves the generated music buffer to --musicOutput path when provided.
1148
+ */
1149
+ static async handleMusicOutput(result, options) {
1150
+ const musicOutputPath = options.musicOutput;
1151
+ if (!musicOutputPath) {
1152
+ return;
1153
+ }
1154
+ if (!result || typeof result !== "object") {
1155
+ return;
1156
+ }
1157
+ const generateResult = result;
1158
+ const music = generateResult.music;
1159
+ if (!music) {
1160
+ if (!options.quiet) {
1161
+ logger.always(chalk.yellow("⚠️ No music available in result. Music generation may not be enabled or the request failed."));
1162
+ }
1163
+ return;
1164
+ }
1165
+ try {
1166
+ fs.writeFileSync(musicOutputPath, music.buffer);
1167
+ if (!options.quiet) {
1168
+ const sizeStr = formatFileSize(music.size);
1169
+ logger.always(chalk.green(`🎵 Music saved to: ${musicOutputPath} (${sizeStr})`));
1170
+ }
1171
+ }
1172
+ catch (error) {
1173
+ handleError(error, "Music Output");
1174
+ }
1175
+ }
979
1176
  /**
980
1177
  * Helper method to handle PPT file output
981
1178
  * Displays PPT generation result info
@@ -1383,6 +1580,19 @@ export class CLICommandFactory {
1383
1580
  "nvidia-nim",
1384
1581
  "lm-studio",
1385
1582
  "llamacpp",
1583
+ "xai",
1584
+ "groq",
1585
+ "cohere",
1586
+ "together-ai",
1587
+ "fireworks",
1588
+ "perplexity",
1589
+ "cloudflare",
1590
+ "replicate",
1591
+ "voyage",
1592
+ "jina",
1593
+ "stability",
1594
+ "ideogram",
1595
+ "recraft",
1386
1596
  ],
1387
1597
  })
1388
1598
  .option("list", {
@@ -1719,11 +1929,10 @@ export class CLICommandFactory {
1719
1929
  return argv.input;
1720
1930
  }
1721
1931
  /**
1722
- * Detect output mode (video, ppt, or text) based on CLI arguments
1932
+ * Detect output mode (video, ppt, avatar, music, or text) based on CLI arguments
1723
1933
  */
1724
1934
  static detectGenerateOutputMode(argv, options) {
1725
1935
  const outputMode = options.outputMode;
1726
- const isVideoMode = outputMode === "video";
1727
1936
  const hasPPTFlags = argv.pptPages !== undefined ||
1728
1937
  argv.pptTheme !== undefined ||
1729
1938
  argv.pptAudience !== undefined ||
@@ -1731,18 +1940,58 @@ export class CLICommandFactory {
1731
1940
  argv.pptOutput !== undefined ||
1732
1941
  argv.pptAspectRatio !== undefined ||
1733
1942
  argv.pptNoImages === true;
1734
- const hasVideoSignals = outputMode === "video" || argv.videoOutput !== undefined;
1943
+ const hasVideoSignals = outputMode === "video" ||
1944
+ argv.videoOutput !== undefined ||
1945
+ argv.videoProvider !== undefined ||
1946
+ argv.videoLength !== undefined ||
1947
+ argv.videoResolution !== undefined ||
1948
+ argv.videoAspectRatio !== undefined;
1735
1949
  const hasPPTSignals = outputMode === "ppt" || hasPPTFlags;
1736
- if (hasVideoSignals && hasPPTSignals) {
1737
- throw new Error("Conflicting output mode signals detected. Use either video mode (--outputMode video, optionally with --videoOutput) or PPT mode (--outputMode ppt / --ppt* flags), not both.");
1738
- }
1739
- const isPPTMode = outputMode === "ppt" || hasPPTFlags;
1950
+ const hasAvatarSignals = outputMode === "avatar" ||
1951
+ argv.avatarProvider !== undefined ||
1952
+ argv.avatarImage !== undefined ||
1953
+ argv.avatarText !== undefined ||
1954
+ argv.avatarAudio !== undefined ||
1955
+ argv.avatarVoice !== undefined ||
1956
+ argv.avatarOutput !== undefined;
1957
+ const hasMusicSignals = outputMode === "music" ||
1958
+ argv.musicProvider !== undefined ||
1959
+ argv.musicGenre !== undefined ||
1960
+ argv.musicMood !== undefined ||
1961
+ argv.musicDuration !== undefined ||
1962
+ argv.musicTempo !== undefined ||
1963
+ argv.musicOutput !== undefined;
1964
+ const activeModes = [
1965
+ hasVideoSignals,
1966
+ hasPPTSignals,
1967
+ hasAvatarSignals,
1968
+ hasMusicSignals,
1969
+ ].filter(Boolean).length;
1970
+ if (activeModes > 1) {
1971
+ throw new Error("Conflicting output mode signals detected. Use exactly one of video / ppt / avatar / music modes (or text).");
1972
+ }
1973
+ // Derive mode flags from the full signal set so that flag-only invocations
1974
+ // (e.g. --videoOutput without --output-mode video) are handled correctly.
1975
+ const isVideoMode = hasVideoSignals;
1976
+ const isAvatarMode = hasAvatarSignals;
1977
+ const isMusicMode = hasMusicSignals;
1978
+ const isPPTMode = hasPPTSignals;
1740
1979
  const spinnerMessage = isVideoMode
1741
1980
  ? "🎬 Generating video... (this may take 1-2 minutes)"
1742
1981
  : isPPTMode
1743
1982
  ? "📊 Generating presentation... (this may take 2-5 minutes)"
1744
- : "🤖 Generating text...";
1745
- return { isVideoMode, isPPTMode, spinnerMessage };
1983
+ : isAvatarMode
1984
+ ? "👤 Generating avatar video... (this may take 1-3 minutes)"
1985
+ : isMusicMode
1986
+ ? "🎵 Generating music... (this may take 30s-2 minutes)"
1987
+ : "🤖 Generating text...";
1988
+ return {
1989
+ isVideoMode,
1990
+ isPPTMode,
1991
+ isAvatarMode,
1992
+ isMusicMode,
1993
+ spinnerMessage,
1994
+ };
1746
1995
  }
1747
1996
  /**
1748
1997
  * Process context for generation command
@@ -1792,11 +2041,12 @@ export class CLICommandFactory {
1792
2041
  /**
1793
2042
  * Build output configuration for generate request
1794
2043
  */
1795
- static buildGenerateOutputConfig(isVideoMode, isPPTMode, enhancedOptions) {
2044
+ static buildGenerateOutputConfig(isVideoMode, isPPTMode, enhancedOptions, isAvatarMode = false, isMusicMode = false) {
1796
2045
  if (isVideoMode) {
1797
2046
  return {
1798
2047
  mode: "video",
1799
2048
  video: {
2049
+ provider: enhancedOptions.videoProvider,
1800
2050
  resolution: enhancedOptions.videoResolution,
1801
2051
  length: enhancedOptions.videoLength,
1802
2052
  aspectRatio: enhancedOptions.videoAspectRatio,
@@ -1804,6 +2054,36 @@ export class CLICommandFactory {
1804
2054
  },
1805
2055
  };
1806
2056
  }
2057
+ if (isAvatarMode) {
2058
+ return {
2059
+ mode: "avatar",
2060
+ avatar: {
2061
+ provider: enhancedOptions.avatarProvider,
2062
+ image: enhancedOptions.avatarImage,
2063
+ audio: enhancedOptions.avatarAudio,
2064
+ text: enhancedOptions.avatarText,
2065
+ voice: enhancedOptions.avatarVoice,
2066
+ quality: enhancedOptions.avatarQuality,
2067
+ format: enhancedOptions.avatarFormat,
2068
+ output: enhancedOptions.avatarOutput,
2069
+ },
2070
+ };
2071
+ }
2072
+ if (isMusicMode) {
2073
+ return {
2074
+ mode: "music",
2075
+ music: {
2076
+ prompt: "", // Filled in from input.text/prompt by baseProvider
2077
+ provider: enhancedOptions.musicProvider,
2078
+ duration: enhancedOptions.musicDuration,
2079
+ format: enhancedOptions.musicFormat,
2080
+ genre: enhancedOptions.musicGenre,
2081
+ mood: enhancedOptions.musicMood,
2082
+ tempo: enhancedOptions.musicTempo,
2083
+ output: enhancedOptions.musicOutput,
2084
+ },
2085
+ };
2086
+ }
1807
2087
  if (isPPTMode) {
1808
2088
  return {
1809
2089
  mode: "ppt",
@@ -1823,7 +2103,8 @@ export class CLICommandFactory {
1823
2103
  /**
1824
2104
  * Handle successful generation result
1825
2105
  */
1826
- static async handleGenerateSuccess(result, options, isVideoMode, isPPTMode, spinner) {
2106
+ static async handleGenerateSuccess(result, options, modes, spinner) {
2107
+ const { isVideoMode, isPPTMode, isAvatarMode, isMusicMode } = modes;
1827
2108
  const genResult = result;
1828
2109
  if (spinner) {
1829
2110
  if (isVideoMode) {
@@ -1832,6 +2113,12 @@ export class CLICommandFactory {
1832
2113
  else if (isPPTMode) {
1833
2114
  spinner.succeed(chalk.green("✅ Presentation generated successfully!"));
1834
2115
  }
2116
+ else if (isAvatarMode) {
2117
+ spinner.succeed(chalk.green("✅ Avatar video generated successfully!"));
2118
+ }
2119
+ else if (isMusicMode) {
2120
+ spinner.succeed(chalk.green("✅ Music generated successfully!"));
2121
+ }
1835
2122
  else {
1836
2123
  spinner.succeed(chalk.green("✅ Text generated successfully!"));
1837
2124
  }
@@ -1841,11 +2128,13 @@ export class CLICommandFactory {
1841
2128
  const modelInfo = genResult.model || "default";
1842
2129
  logger.always(chalk.gray(`🔧 Provider: ${providerInfo} | Model: ${modelInfo}`));
1843
2130
  }
1844
- if (!isVideoMode && !isPPTMode) {
2131
+ if (!isVideoMode && !isPPTMode && !isAvatarMode && !isMusicMode) {
1845
2132
  CLICommandFactory.handleOutput(genResult, options);
1846
2133
  }
1847
2134
  await CLICommandFactory.handleTTSOutput(genResult, options);
1848
2135
  await CLICommandFactory.handleVideoOutput(genResult, options);
2136
+ await CLICommandFactory.handleAvatarOutput(genResult, options);
2137
+ await CLICommandFactory.handleMusicOutput(genResult, options);
1849
2138
  await CLICommandFactory.handlePPTOutput(genResult, options);
1850
2139
  if (options.debug) {
1851
2140
  logger.debug("\n" + chalk.yellow("Debug Information:"));
@@ -1872,7 +2161,7 @@ export class CLICommandFactory {
1872
2161
  argv.input = rawInput;
1873
2162
  const options = CLICommandFactory.processOptions(argv);
1874
2163
  // Detect output mode
1875
- const { isVideoMode, isPPTMode, spinnerMessage } = CLICommandFactory.detectGenerateOutputMode(argv, options);
2164
+ const { isVideoMode, isPPTMode, isAvatarMode, isMusicMode, spinnerMessage, } = CLICommandFactory.detectGenerateOutputMode(argv, options);
1876
2165
  const spinner = argv.quiet ? null : ora(spinnerMessage).start();
1877
2166
  try {
1878
2167
  // Add delay if specified
@@ -1930,18 +2219,8 @@ export class CLICommandFactory {
1930
2219
  }
1931
2220
  // Initialize SDK and session
1932
2221
  const sdk = globalSession.getOrCreateNeuroLink();
1933
- const sessionVariables = globalSession.getSessionVariables();
1934
- const enhancedOptions = {
1935
- ...options,
1936
- ...sessionVariables,
1937
- // enabledToolNames must be string[] for the SDK — normalize from CSV string
1938
- ...(typeof sessionVariables.enabledToolNames === "string" && {
1939
- enabledToolNames: sessionVariables.enabledToolNames
1940
- .split(",")
1941
- .map((t) => t.trim())
1942
- .filter(Boolean),
1943
- }),
1944
- };
2222
+ const sessionVariables = CLICommandFactory.normalizeLoopSessionVariables(globalSession.getSessionVariables());
2223
+ const enhancedOptions = { ...options, ...sessionVariables };
1945
2224
  const sessionId = globalSession.getCurrentSessionId();
1946
2225
  const context = sessionId
1947
2226
  ? { ...options.context, sessionId }
@@ -1961,7 +2240,7 @@ export class CLICommandFactory {
1961
2240
  }
1962
2241
  // Build multimodal input and output configuration
1963
2242
  const generateInput = CLICommandFactory.buildGenerateMultimodalInput(inputText, argv);
1964
- const outputConfig = CLICommandFactory.buildGenerateOutputConfig(isVideoMode, isPPTMode, enhancedOptions);
2243
+ const outputConfig = CLICommandFactory.buildGenerateOutputConfig(isVideoMode, isPPTMode, enhancedOptions, isAvatarMode, isMusicMode);
1965
2244
  // Read audio file for STT if --input-audio is provided.
1966
2245
  // NEW10: existsSync guard mirrors the stream handler so a missing file
1967
2246
  // produces a friendly error here too instead of a raw ENOENT crash.
@@ -1993,6 +2272,9 @@ export class CLICommandFactory {
1993
2272
  model: enhancedOptions.model,
1994
2273
  temperature: enhancedOptions.temperature,
1995
2274
  maxTokens: enhancedOptions.maxTokens,
2275
+ topP: enhancedOptions.topP,
2276
+ topK: enhancedOptions.topK,
2277
+ stopSequences: enhancedOptions.stopSequences,
1996
2278
  systemPrompt: enhancedOptions.systemPrompt,
1997
2279
  timeout: enhancedOptions.timeout
1998
2280
  ? enhancedOptions.timeout * 1000
@@ -2050,7 +2332,7 @@ export class CLICommandFactory {
2050
2332
  });
2051
2333
  const result = await runGenerate();
2052
2334
  // Handle successful result
2053
- await CLICommandFactory.handleGenerateSuccess(result, options, isVideoMode, isPPTMode, spinner);
2335
+ await CLICommandFactory.handleGenerateSuccess(result, options, { isVideoMode, isPPTMode, isAvatarMode, isMusicMode }, spinner);
2054
2336
  }
2055
2337
  catch (error) {
2056
2338
  if (spinner) {
@@ -2166,7 +2448,7 @@ export class CLICommandFactory {
2166
2448
  */
2167
2449
  static async executeRealStream(argv, options, inputText, contextMetadata) {
2168
2450
  const sdk = globalSession.getOrCreateNeuroLink();
2169
- const sessionVariables = globalSession.getSessionVariables();
2451
+ const sessionVariables = CLICommandFactory.normalizeLoopSessionVariables(globalSession.getSessionVariables());
2170
2452
  const enhancedOptions = { ...options, ...sessionVariables };
2171
2453
  const sessionId = globalSession.getCurrentSessionId();
2172
2454
  const context = sessionId
@@ -2201,6 +2483,9 @@ export class CLICommandFactory {
2201
2483
  model: enhancedOptions.model,
2202
2484
  temperature: enhancedOptions.temperature,
2203
2485
  maxTokens: enhancedOptions.maxTokens,
2486
+ topP: enhancedOptions.topP,
2487
+ topK: enhancedOptions.topK,
2488
+ stopSequences: enhancedOptions.stopSequences,
2204
2489
  systemPrompt: enhancedOptions.systemPrompt,
2205
2490
  timeout: enhancedOptions.timeout
2206
2491
  ? enhancedOptions.timeout * 1000
@@ -2639,18 +2924,8 @@ export class CLICommandFactory {
2639
2924
  }
2640
2925
  const results = [];
2641
2926
  const sdk = globalSession.getOrCreateNeuroLink();
2642
- const sessionVariables = globalSession.getSessionVariables();
2643
- const enhancedOptions = {
2644
- ...options,
2645
- ...sessionVariables,
2646
- // enabledToolNames must be string[] for the SDK — normalize from CSV string
2647
- ...(typeof sessionVariables.enabledToolNames === "string" && {
2648
- enabledToolNames: sessionVariables.enabledToolNames
2649
- .split(",")
2650
- .map((t) => t.trim())
2651
- .filter(Boolean),
2652
- }),
2653
- };
2927
+ const sessionVariables = CLICommandFactory.normalizeLoopSessionVariables(globalSession.getSessionVariables());
2928
+ const enhancedOptions = { ...options, ...sessionVariables };
2654
2929
  const sessionId = globalSession.getCurrentSessionId();
2655
2930
  for (let i = 0; i < prompts.length; i++) {
2656
2931
  if (spinner) {
@@ -2692,6 +2967,9 @@ export class CLICommandFactory {
2692
2967
  model: enhancedOptions.model,
2693
2968
  temperature: enhancedOptions.temperature,
2694
2969
  maxTokens: enhancedOptions.maxTokens,
2970
+ topP: enhancedOptions.topP,
2971
+ topK: enhancedOptions.topK,
2972
+ stopSequences: enhancedOptions.stopSequences,
2695
2973
  systemPrompt: enhancedOptions.systemPrompt,
2696
2974
  timeout: enhancedOptions.timeout
2697
2975
  ? enhancedOptions.timeout * 1000
@@ -3016,7 +3294,7 @@ export class CLICommandFactory {
3016
3294
  " generate|gen)\n" +
3017
3295
  ' case "${prev}" in\n' +
3018
3296
  " --provider|-p)\n" +
3019
- ' COMPREPLY=( $(compgen -W "auto openai openai-compatible openrouter or bedrock vertex googleVertex anthropic anthropic-subscription azure google-ai google-ai-studio huggingface ollama mistral litellm sagemaker deepseek ds nvidia-nim nim lm-studio lmstudio llamacpp llama.cpp" -- ${cur}) )\n' +
3297
+ ' COMPREPLY=( $(compgen -W "auto openai openai-compatible openrouter or bedrock vertex googleVertex anthropic anthropic-subscription azure google-ai google-ai-studio huggingface ollama mistral litellm sagemaker deepseek ds nvidia-nim nim lm-studio lmstudio llamacpp llama.cpp xai grok groq cohere together-ai together fireworks perplexity pplx cloudflare workers-ai cf-ai replicate voyage voyage-ai jina jina-ai stability stability-ai sd ideogram recraft" -- ${cur}) )\n' +
3020
3298
  " return 0\n" +
3021
3299
  " ;;\n" +
3022
3300
  " --format|-f|--output-format)\n" +
@@ -4,4 +4,4 @@ import type { OptionSchema, TextGenerationOptions } from "../../lib/types/index.
4
4
  * This object provides metadata for validation and help text in the CLI loop.
5
5
  * It is derived from the main TextGenerationOptions interface to ensure consistency.
6
6
  */
7
- export declare const textGenerationOptionsSchema: Record<keyof Omit<TextGenerationOptions, "prompt" | "input" | "schema" | "tools" | "context" | "conversationHistory" | "conversationMessages" | "conversationMemoryConfig" | "originalPrompt" | "middleware" | "expectedOutcome" | "evaluationCriteria" | "region" | "csvOptions" | "tts" | "stt" | "thinkingConfig" | "requestId" | "fileRegistry" | "abortSignal" | "toolFilter" | "excludeTools" | "toolChoice" | "prepareStep" | "credentials">, OptionSchema>;
7
+ export declare const textGenerationOptionsSchema: Record<keyof Omit<TextGenerationOptions, "prompt" | "input" | "schema" | "tools" | "context" | "conversationHistory" | "conversationMessages" | "conversationMemoryConfig" | "originalPrompt" | "middleware" | "expectedOutcome" | "evaluationCriteria" | "region" | "csvOptions" | "tts" | "stt" | "thinkingConfig" | "requestId" | "fileRegistry" | "abortSignal" | "toolFilter" | "excludeTools" | "toolChoice" | "prepareStep" | "credentials" | "onFinish" | "onError">, OptionSchema>;
@@ -24,6 +24,18 @@ export const textGenerationOptionsSchema = {
24
24
  type: "number",
25
25
  description: "The maximum number of tokens to generate.",
26
26
  },
27
+ topP: {
28
+ type: "number",
29
+ description: "Top-p (nucleus) sampling parameter. Controls diversity of generated tokens (0.0-1.0).",
30
+ },
31
+ topK: {
32
+ type: "number",
33
+ description: "Top-k sampling parameter. Limits the number of tokens considered (Google/Gemini models only).",
34
+ },
35
+ stopSequences: {
36
+ type: "string",
37
+ description: "Stop sequences that will halt generation when encountered (comma-separated).",
38
+ },
27
39
  output: {
28
40
  type: "string",
29
41
  description: "AI response format - specify just the format value (e.g., 'json', 'structured'). Note: This is automatically transformed to { format: value } for the API.",