@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
|
@@ -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'
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
373
|
-
|
|
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
|
-
//
|
|
854
|
-
if (!enhancedOptions.
|
|
855
|
-
enhancedOptions.
|
|
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(
|
|
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" ||
|
|
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
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
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
|
-
:
|
|
1745
|
-
|
|
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,
|
|
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.",
|