@juspay/neurolink 7.33.4 → 7.35.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 (115) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +101 -7
  3. package/dist/cli/commands/setup-anthropic.d.ts +16 -0
  4. package/dist/cli/commands/setup-anthropic.js +414 -0
  5. package/dist/cli/commands/setup-azure.d.ts +17 -0
  6. package/dist/cli/commands/setup-azure.js +415 -0
  7. package/dist/cli/commands/setup-bedrock.d.ts +13 -0
  8. package/dist/cli/commands/setup-bedrock.js +487 -0
  9. package/dist/cli/commands/setup-gcp.d.ts +18 -0
  10. package/dist/cli/commands/setup-gcp.js +569 -0
  11. package/dist/cli/commands/setup-google-ai.d.ts +16 -0
  12. package/dist/cli/commands/setup-google-ai.js +369 -0
  13. package/dist/cli/commands/setup-huggingface.d.ts +8 -0
  14. package/dist/cli/commands/setup-huggingface.js +200 -0
  15. package/dist/cli/commands/setup-mistral.d.ts +8 -0
  16. package/dist/cli/commands/setup-mistral.js +233 -0
  17. package/dist/cli/commands/setup-openai.d.ts +16 -0
  18. package/dist/cli/commands/setup-openai.js +402 -0
  19. package/dist/cli/commands/setup.d.ts +19 -0
  20. package/dist/cli/commands/setup.js +539 -0
  21. package/dist/cli/errorHandler.d.ts +1 -0
  22. package/dist/cli/errorHandler.js +28 -0
  23. package/dist/cli/factories/commandFactory.d.ts +27 -0
  24. package/dist/cli/factories/commandFactory.js +416 -60
  25. package/dist/cli/factories/ollamaCommandFactory.js +7 -1
  26. package/dist/cli/factories/setupCommandFactory.d.ts +18 -0
  27. package/dist/cli/factories/setupCommandFactory.js +137 -0
  28. package/dist/cli/index.d.ts +1 -1
  29. package/dist/cli/index.js +9 -164
  30. package/dist/cli/loop/optionsSchema.d.ts +15 -0
  31. package/dist/cli/loop/optionsSchema.js +59 -0
  32. package/dist/cli/loop/session.d.ts +15 -0
  33. package/dist/cli/loop/session.js +252 -0
  34. package/dist/cli/parser.d.ts +1 -0
  35. package/dist/cli/parser.js +161 -0
  36. package/dist/cli/utils/envManager.d.ts +3 -2
  37. package/dist/cli/utils/envManager.js +18 -4
  38. package/dist/cli/utils/ollamaUtils.js +6 -0
  39. package/dist/config/{conversationMemoryConfig.d.ts → conversationMemory.d.ts} +1 -1
  40. package/dist/core/baseProvider.js +17 -3
  41. package/dist/core/conversationMemoryFactory.d.ts +23 -0
  42. package/dist/core/conversationMemoryFactory.js +144 -0
  43. package/dist/core/conversationMemoryInitializer.d.ts +14 -0
  44. package/dist/core/conversationMemoryInitializer.js +127 -0
  45. package/dist/core/conversationMemoryManager.d.ts +3 -2
  46. package/dist/core/conversationMemoryManager.js +4 -3
  47. package/dist/core/redisConversationMemoryManager.d.ts +73 -0
  48. package/dist/core/redisConversationMemoryManager.js +483 -0
  49. package/dist/core/types.d.ts +1 -1
  50. package/dist/lib/config/{conversationMemoryConfig.d.ts → conversationMemory.d.ts} +1 -1
  51. package/dist/lib/core/baseProvider.js +17 -3
  52. package/dist/lib/core/conversationMemoryFactory.d.ts +23 -0
  53. package/dist/lib/core/conversationMemoryFactory.js +144 -0
  54. package/dist/lib/core/conversationMemoryInitializer.d.ts +14 -0
  55. package/dist/lib/core/conversationMemoryInitializer.js +127 -0
  56. package/dist/lib/core/conversationMemoryManager.d.ts +3 -2
  57. package/dist/lib/core/conversationMemoryManager.js +4 -3
  58. package/dist/lib/core/redisConversationMemoryManager.d.ts +73 -0
  59. package/dist/lib/core/redisConversationMemoryManager.js +483 -0
  60. package/dist/lib/core/types.d.ts +1 -1
  61. package/dist/lib/neurolink.d.ts +15 -9
  62. package/dist/lib/neurolink.js +218 -67
  63. package/dist/lib/providers/amazonBedrock.d.ts +4 -4
  64. package/dist/lib/providers/anthropic.d.ts +4 -4
  65. package/dist/lib/providers/azureOpenai.d.ts +4 -4
  66. package/dist/lib/providers/googleAiStudio.d.ts +4 -4
  67. package/dist/lib/providers/googleAiStudio.js +1 -1
  68. package/dist/lib/providers/huggingFace.d.ts +4 -4
  69. package/dist/lib/providers/litellm.d.ts +1 -1
  70. package/dist/lib/providers/mistral.d.ts +4 -4
  71. package/dist/lib/providers/mistral.js +2 -2
  72. package/dist/lib/providers/openAI.d.ts +4 -4
  73. package/dist/lib/session/globalSessionState.d.ts +27 -0
  74. package/dist/lib/session/globalSessionState.js +77 -0
  75. package/dist/lib/types/{conversationTypes.d.ts → conversation.d.ts} +32 -0
  76. package/dist/lib/types/generateTypes.d.ts +1 -1
  77. package/dist/lib/types/streamTypes.d.ts +1 -1
  78. package/dist/lib/utils/conversationMemory.d.ts +22 -0
  79. package/dist/lib/utils/conversationMemory.js +121 -0
  80. package/dist/lib/utils/conversationMemoryUtils.d.ts +1 -1
  81. package/dist/lib/utils/conversationMemoryUtils.js +2 -2
  82. package/dist/lib/utils/messageBuilder.d.ts +1 -1
  83. package/dist/lib/utils/messageBuilder.js +1 -1
  84. package/dist/lib/utils/redis.d.ts +42 -0
  85. package/dist/lib/utils/redis.js +263 -0
  86. package/dist/neurolink.d.ts +15 -9
  87. package/dist/neurolink.js +218 -67
  88. package/dist/providers/amazonBedrock.d.ts +4 -4
  89. package/dist/providers/anthropic.d.ts +4 -4
  90. package/dist/providers/azureOpenai.d.ts +4 -4
  91. package/dist/providers/googleAiStudio.d.ts +4 -4
  92. package/dist/providers/googleAiStudio.js +1 -1
  93. package/dist/providers/huggingFace.d.ts +4 -4
  94. package/dist/providers/litellm.d.ts +1 -1
  95. package/dist/providers/mistral.d.ts +4 -4
  96. package/dist/providers/mistral.js +2 -2
  97. package/dist/providers/openAI.d.ts +4 -4
  98. package/dist/session/globalSessionState.d.ts +27 -0
  99. package/dist/session/globalSessionState.js +77 -0
  100. package/dist/types/{conversationTypes.d.ts → conversation.d.ts} +32 -0
  101. package/dist/types/generateTypes.d.ts +1 -1
  102. package/dist/types/streamTypes.d.ts +1 -1
  103. package/dist/utils/conversationMemory.d.ts +22 -0
  104. package/dist/utils/conversationMemory.js +121 -0
  105. package/dist/utils/conversationMemoryUtils.d.ts +1 -1
  106. package/dist/utils/conversationMemoryUtils.js +2 -2
  107. package/dist/utils/messageBuilder.d.ts +1 -1
  108. package/dist/utils/messageBuilder.js +1 -1
  109. package/dist/utils/redis.d.ts +42 -0
  110. package/dist/utils/redis.js +263 -0
  111. package/package.json +3 -1
  112. /package/dist/config/{conversationMemoryConfig.js → conversationMemory.js} +0 -0
  113. /package/dist/lib/config/{conversationMemoryConfig.js → conversationMemory.js} +0 -0
  114. /package/dist/lib/types/{conversationTypes.js → conversation.js} +0 -0
  115. /package/dist/types/{conversationTypes.js → conversation.js} +0 -0
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Setup Command Factory for NeuroLink
3
+ * Consolidates all provider setup commands into a unified interface
4
+ */
5
+ import { handleGCPSetup } from "../commands/setup-gcp.js";
6
+ import { handleBedrockSetup } from "../commands/setup-bedrock.js";
7
+ import { handleOpenAISetup } from "../commands/setup-openai.js";
8
+ import { handleGoogleAISetup } from "../commands/setup-google-ai.js";
9
+ import { handleAnthropicSetup } from "../commands/setup-anthropic.js";
10
+ import { handleAzureSetup } from "../commands/setup-azure.js";
11
+ import { handleHuggingFaceSetup } from "../commands/setup-huggingface.js";
12
+ import { handleMistralSetup } from "../commands/setup-mistral.js";
13
+ import { handleSetup } from "../commands/setup.js";
14
+ /**
15
+ * Setup Command Factory
16
+ */
17
+ export class SetupCommandFactory {
18
+ /**
19
+ * Create the main setup command with all provider subcommands
20
+ */
21
+ static createSetupCommands() {
22
+ return {
23
+ command: ["setup [provider]", "s [provider]"],
24
+ describe: "Setup AI provider configurations",
25
+ builder: (yargs) => {
26
+ return (yargs
27
+ .positional("provider", {
28
+ type: "string",
29
+ description: "Specific provider to set up",
30
+ choices: [
31
+ "google-ai",
32
+ "openai",
33
+ "anthropic",
34
+ "azure",
35
+ "bedrock",
36
+ "gcp",
37
+ "vertex",
38
+ "huggingface",
39
+ "mistral",
40
+ ],
41
+ })
42
+ .option("list", {
43
+ type: "boolean",
44
+ description: "List all available providers",
45
+ alias: "l",
46
+ })
47
+ .option("status", {
48
+ type: "boolean",
49
+ description: "Show provider configuration status",
50
+ })
51
+ .option("check", {
52
+ type: "boolean",
53
+ description: "Only check existing configuration without prompting",
54
+ default: false,
55
+ })
56
+ .option("non-interactive", {
57
+ type: "boolean",
58
+ description: "Skip interactive prompts",
59
+ default: false,
60
+ })
61
+ .option("quiet", {
62
+ type: "boolean",
63
+ alias: "q",
64
+ default: false,
65
+ description: "Suppress non-essential output",
66
+ })
67
+ .option("debug", {
68
+ type: "boolean",
69
+ default: false,
70
+ description: "Enable debug output",
71
+ })
72
+ // Subcommands for each provider
73
+ .command("google-ai", "Setup Google AI Studio configuration", (y) => this.buildProviderOptions(y),
74
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
75
+ async (argv) => await handleGoogleAISetup(argv))
76
+ .command("openai", "Setup OpenAI configuration", (y) => this.buildProviderOptions(y),
77
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
78
+ async (argv) => await handleOpenAISetup(argv))
79
+ .command("anthropic", "Setup Anthropic Claude configuration", (y) => this.buildProviderOptions(y),
80
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
81
+ async (argv) => await handleAnthropicSetup(argv))
82
+ .command("azure", "Setup Azure OpenAI configuration", (y) => this.buildProviderOptions(y),
83
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
84
+ async (argv) => await handleAzureSetup(argv))
85
+ .command("bedrock", "Setup AWS Bedrock configuration", (y) => this.buildProviderOptions(y),
86
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
87
+ async (argv) => await handleBedrockSetup(argv))
88
+ .command(["gcp", "vertex"], "Setup Google Cloud Platform / Vertex AI configuration", (y) => this.buildProviderOptions(y),
89
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
90
+ async (argv) => await handleGCPSetup(argv))
91
+ .command("huggingface", "Setup Hugging Face configuration", (y) => this.buildProviderOptions(y),
92
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
93
+ async (argv) => await handleHuggingFaceSetup(argv))
94
+ .command("mistral", "Setup Mistral AI configuration", (y) => this.buildProviderOptions(y),
95
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
96
+ async (argv) => await handleMistralSetup(argv))
97
+ .example("$0 setup", "Interactive setup wizard")
98
+ .example("$0 setup google-ai", "Setup Google AI Studio")
99
+ .example("$0 setup openai --check", "Check OpenAI configuration")
100
+ .example("$0 setup --list", "List all providers")
101
+ .example("$0 setup --status", "Check provider status")
102
+ .help());
103
+ },
104
+ handler: async (argv) => {
105
+ // If no subcommand specified, run main setup wizard
106
+ await handleSetup(argv);
107
+ },
108
+ };
109
+ }
110
+ /**
111
+ * Build common options for provider setup commands
112
+ */
113
+ static buildProviderOptions(yargs) {
114
+ return yargs
115
+ .option("check", {
116
+ type: "boolean",
117
+ describe: "Only check existing configuration without prompting",
118
+ default: false,
119
+ })
120
+ .option("non-interactive", {
121
+ type: "boolean",
122
+ describe: "Skip interactive prompts",
123
+ default: false,
124
+ })
125
+ .option("quiet", {
126
+ type: "boolean",
127
+ alias: "q",
128
+ default: false,
129
+ description: "Suppress non-essential output",
130
+ })
131
+ .option("debug", {
132
+ type: "boolean",
133
+ default: false,
134
+ description: "Enable debug output",
135
+ });
136
+ }
137
+ }
@@ -5,4 +5,4 @@
5
5
  * Professional CLI experience with minimal maintenance overhead.
6
6
  * Features: Spinners, colors, batch processing, provider testing, rich help
7
7
  */
8
- export declare function handleError(_error: Error, context: string): void;
8
+ export {};
package/dist/cli/index.js CHANGED
@@ -5,15 +5,8 @@
5
5
  * Professional CLI experience with minimal maintenance overhead.
6
6
  * Features: Spinners, colors, batch processing, provider testing, rich help
7
7
  */
8
- import yargs from "yargs";
9
- import { hideBin } from "yargs/helpers";
8
+ import { initializeCliParser } from "./parser.js";
10
9
  import chalk from "chalk";
11
- import _fs from "fs";
12
- import path from "path";
13
- import { fileURLToPath } from "url";
14
- import { CLICommandFactory } from "./factories/commandFactory.js";
15
- import { AuthenticationError, AuthorizationError, NetworkError, RateLimitError, } from "../lib/types/errors.js";
16
- import { logger } from "../lib/utils/logger.js";
17
10
  // Clean up pnpm-specific environment variables that cause npm warnings
18
11
  // These variables are set by pnpm but cause "Unknown env config" warnings in npm
19
12
  if (process.env.npm_config_verify_deps_before_run) {
@@ -22,11 +15,6 @@ if (process.env.npm_config_verify_deps_before_run) {
22
15
  if (process.env.npm_config__jsr_registry) {
23
16
  delete process.env.npm_config__jsr_registry;
24
17
  }
25
- // Get version from package.json
26
- const __filename = fileURLToPath(import.meta.url);
27
- const __dirname = path.dirname(__filename);
28
- const packageJson = JSON.parse(_fs.readFileSync(path.resolve(__dirname, "../../package.json"), "utf-8"));
29
- const cliVersion = packageJson.version;
30
18
  // Load environment variables from .env file
31
19
  try {
32
20
  // Try to import and configure dotenv
@@ -37,158 +25,8 @@ catch {
37
25
  // dotenv is not available (dev dependency only) - this is fine for production
38
26
  // Environment variables should be set externally in production
39
27
  }
40
- // Utility Functions (Simple, Zero Maintenance)
41
- export function handleError(_error, context) {
42
- logger.error(chalk.red(`❌ ${context} failed: ${_error.message}`));
43
- if (_error instanceof AuthenticationError) {
44
- logger.error(chalk.yellow("💡 Set Google AI Studio API key (RECOMMENDED): export GOOGLE_AI_API_KEY=AIza-..."));
45
- logger.error(chalk.yellow("💡 Or set OpenAI API key: export OPENAI_API_KEY=sk-..."));
46
- logger.error(chalk.yellow("💡 Or set AWS Bedrock credentials: export AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=... AWS_REGION=us-east-1"));
47
- logger.error(chalk.yellow("💡 Or set Google Vertex AI credentials: export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json"));
48
- logger.error(chalk.yellow("💡 Or set Anthropic API key: export ANTHROPIC_API_KEY=sk-ant-..."));
49
- logger.error(chalk.yellow("💡 Or set Azure OpenAI credentials: export AZURE_OPENAI_API_KEY=... AZURE_OPENAI_ENDPOINT=..."));
50
- }
51
- else if (_error instanceof RateLimitError) {
52
- logger.error(chalk.yellow("💡 Try again in a few moments or use --provider vertex"));
53
- }
54
- else if (_error instanceof AuthorizationError) {
55
- logger.error(chalk.yellow("💡 Check your account permissions for the selected model/service."));
56
- logger.error(chalk.yellow("💡 For AWS Bedrock, ensure you have permissions for the specific model and consider using inference profile ARNs."));
57
- }
58
- else if (_error instanceof NetworkError) {
59
- logger.error(chalk.yellow("💡 Check your internet connection and the provider's status page."));
60
- }
61
- process.exit(1);
62
- }
63
- // Manual pre-validation for unknown flags
64
- const args = hideBin(process.argv);
65
28
  // Enhanced CLI with Professional UX
66
- const cli = yargs(args)
67
- .scriptName("neurolink")
68
- .usage("Usage: $0 <command> [options]")
69
- .version(cliVersion)
70
- .help()
71
- .alias("h", "help")
72
- .alias("V", "version")
73
- .strictOptions()
74
- .strictCommands()
75
- .demandCommand(1, "")
76
- .epilogue("For more info: https://github.com/juspay/neurolink")
77
- .showHelpOnFail(true, "Specify --help for available options")
78
- .middleware((argv) => {
79
- // Handle no-color option globally
80
- if (argv.noColor || process.env.NO_COLOR || !process.stdout.isTTY) {
81
- process.env.FORCE_COLOR = "0";
82
- }
83
- // Handle custom config file
84
- if (argv.configFile) {
85
- process.env.NEUROLINK_CONFIG_FILE = argv.configFile;
86
- }
87
- // Control SDK logging based on debug flag
88
- if (argv.debug) {
89
- process.env.NEUROLINK_DEBUG = "true";
90
- }
91
- else {
92
- // Always set to false when debug is not enabled (including when not provided)
93
- process.env.NEUROLINK_DEBUG = "false";
94
- }
95
- // Keep existing quiet middleware
96
- if (process.env.NEUROLINK_QUIET === "true" &&
97
- typeof argv.quiet === "undefined") {
98
- argv.quiet = true;
99
- }
100
- })
101
- .fail((msg, err, yargsInstance) => {
102
- const exitProcess = () => {
103
- if (!process.exitCode) {
104
- process.exit(1);
105
- }
106
- };
107
- if (err) {
108
- // Error likely from an async command handler (e.g., via _handleError)
109
- // _handleError already prints and calls process.exit(1).
110
- // If we're here, it means _handleError's process.exit might not have been caught by the top-level async IIFE.
111
- // Or, it's a synchronous yargs error during parsing that yargs itself throws.
112
- const alreadyExitedByHandleError = err?.exitCode !== undefined;
113
- // A simple heuristic: if the error message doesn't look like one of our handled generic messages,
114
- // it might be a direct yargs parsing error.
115
- const isLikelyYargsInternalError = err.message && // Ensure err.message exists
116
- !err.message.includes("Authentication error") &&
117
- !err.message.includes("Network error") &&
118
- !err.message.includes("Authorization error") &&
119
- !err.message.includes("Permission denied") && // from config export
120
- !err.message.includes("Invalid or unparseable JSON"); // from config import
121
- if (!alreadyExitedByHandleError) {
122
- process.stderr.write(chalk.red(`CLI Error: ${err.message || msg || "An unexpected error occurred."}\n`));
123
- // If it's a yargs internal parsing error, show help.
124
- if (isLikelyYargsInternalError && msg) {
125
- yargsInstance.showHelp((h) => {
126
- process.stderr.write(h + "\n");
127
- exitProcess();
128
- });
129
- return;
130
- }
131
- exitProcess();
132
- }
133
- return; // Exit was already called or error handled
134
- }
135
- // Yargs parsing/validation error (msg is present, err is null)
136
- if (msg) {
137
- let processedMsg = `Error: ${msg}\n`;
138
- if (msg.includes("Not enough non-option arguments") ||
139
- msg.includes("Missing required argument") ||
140
- msg.includes("Unknown command")) {
141
- process.stderr.write(chalk.red(processedMsg)); // Print error first
142
- yargsInstance.showHelp((h) => {
143
- process.stderr.write("\n" + h + "\n");
144
- exitProcess();
145
- });
146
- return; // Exit happens in callback
147
- }
148
- else if (msg.includes("Unknown argument") ||
149
- msg.includes("Invalid values")) {
150
- processedMsg = `Error: ${msg}\nUse --help to see available options.\n`;
151
- }
152
- process.stderr.write(chalk.red(processedMsg));
153
- }
154
- else {
155
- // No specific message, but failure occurred (e.g. demandCommand failed silently)
156
- yargsInstance.showHelp((h) => {
157
- process.stderr.write(h + "\n");
158
- exitProcess();
159
- });
160
- return; // Exit happens in callback
161
- }
162
- exitProcess(); // Default exit
163
- })
164
- // Generate Command (Primary) - Using CLICommandFactory
165
- .command(CLICommandFactory.createGenerateCommand())
166
- // Stream Text Command - Using CLICommandFactory
167
- .command(CLICommandFactory.createStreamCommand())
168
- // Batch Processing Command - Using CLICommandFactory
169
- .command(CLICommandFactory.createBatchCommand())
170
- // Provider Command Group - Using CLICommandFactory
171
- .command(CLICommandFactory.createProviderCommands())
172
- // Status command alias - Using CLICommandFactory
173
- .command(CLICommandFactory.createStatusCommand())
174
- // Models Command Group - Using CLICommandFactory
175
- .command(CLICommandFactory.createModelsCommands())
176
- // MCP Command Group - Using CLICommandFactory
177
- .command(CLICommandFactory.createMCPCommands())
178
- // Discover Command - Using CLICommandFactory
179
- .command(CLICommandFactory.createDiscoverCommand())
180
- // Configuration Command Group - Using CLICommandFactory
181
- .command(CLICommandFactory.createConfigCommands())
182
- // Get Best Provider Command - Using CLICommandFactory
183
- .command(CLICommandFactory.createBestProviderCommand())
184
- // Validate Command (alias for config validate)
185
- .command(CLICommandFactory.createValidateCommand())
186
- // Completion Command - Using CLICommandFactory
187
- .command(CLICommandFactory.createCompletionCommand())
188
- // Ollama Command Group - Using CLICommandFactory
189
- .command(CLICommandFactory.createOllamaCommands())
190
- // SageMaker Command Group - Using CLICommandFactory
191
- .command(CLICommandFactory.createSageMakerCommands());
29
+ const cli = initializeCliParser();
192
30
  // Execute CLI
193
31
  (async () => {
194
32
  try {
@@ -201,3 +39,10 @@ const cli = yargs(args)
201
39
  process.exit(1);
202
40
  }
203
41
  })();
42
+ // Cleanup on exit
43
+ process.on("SIGINT", () => {
44
+ process.exit(0);
45
+ });
46
+ process.on("SIGTERM", () => {
47
+ process.exit(0);
48
+ });
@@ -0,0 +1,15 @@
1
+ import { type TextGenerationOptions } from "../../lib/core/types.js";
2
+ /**
3
+ * Defines the schema for a session variable or a generation option.
4
+ */
5
+ export interface OptionSchema {
6
+ type: "string" | "boolean" | "number";
7
+ description: string;
8
+ allowedValues?: string[];
9
+ }
10
+ /**
11
+ * Master schema for all text generation options.
12
+ * This object provides metadata for validation and help text in the CLI loop.
13
+ * It is derived from the main TextGenerationOptions interface to ensure consistency.
14
+ */
15
+ export declare const textGenerationOptionsSchema: Record<keyof Omit<TextGenerationOptions, "prompt" | "input" | "schema" | "tools" | "context" | "conversationHistory" | "conversationMessages" | "conversationMemoryConfig" | "originalPrompt" | "middleware" | "expectedOutcome" | "evaluationCriteria">, OptionSchema>;
@@ -0,0 +1,59 @@
1
+ import { AIProviderName, } from "../../lib/core/types.js";
2
+ /**
3
+ * Master schema for all text generation options.
4
+ * This object provides metadata for validation and help text in the CLI loop.
5
+ * It is derived from the main TextGenerationOptions interface to ensure consistency.
6
+ */
7
+ export const textGenerationOptionsSchema = {
8
+ provider: {
9
+ type: "string",
10
+ description: "The AI provider to use.",
11
+ allowedValues: Object.values(AIProviderName)
12
+ .filter((p) => typeof p === "string")
13
+ .filter((p) => p !== AIProviderName.AUTO),
14
+ },
15
+ model: {
16
+ type: "string",
17
+ description: "The specific model to use from the provider.",
18
+ },
19
+ temperature: {
20
+ type: "number",
21
+ description: "Controls randomness of the output (e.g., 0.2, 0.8).",
22
+ },
23
+ maxTokens: {
24
+ type: "number",
25
+ description: "The maximum number of tokens to generate.",
26
+ },
27
+ systemPrompt: {
28
+ type: "string",
29
+ description: "The system prompt to guide the AI's behavior.",
30
+ },
31
+ timeout: {
32
+ type: "number",
33
+ description: "Timeout for the generation request in milliseconds.",
34
+ },
35
+ disableTools: {
36
+ type: "boolean",
37
+ description: "Disable all tool usage for the AI.",
38
+ },
39
+ maxSteps: {
40
+ type: "number",
41
+ description: "Maximum number of tool execution steps.",
42
+ },
43
+ enableAnalytics: {
44
+ type: "boolean",
45
+ description: "Enable or disable analytics for responses.",
46
+ },
47
+ enableEvaluation: {
48
+ type: "boolean",
49
+ description: "Enable or disable AI-powered evaluation of responses.",
50
+ },
51
+ evaluationDomain: {
52
+ type: "string",
53
+ description: 'Domain expertise for evaluation (e.g., "general AI assistant").',
54
+ },
55
+ toolUsageContext: {
56
+ type: "string",
57
+ description: "Context about tools/MCPs used in the interaction.",
58
+ },
59
+ };
@@ -0,0 +1,15 @@
1
+ import type { Argv } from "yargs";
2
+ import type { ConversationMemoryConfig } from "../../lib/types/conversation.js";
3
+ export declare class LoopSession {
4
+ private conversationMemoryConfig?;
5
+ private initializeCliParser;
6
+ private isRunning;
7
+ private sessionId?;
8
+ private sessionVariablesSchema;
9
+ constructor(initializeCliParser: () => Argv, conversationMemoryConfig?: ConversationMemoryConfig | undefined);
10
+ start(): Promise<void>;
11
+ private handleSessionCommands;
12
+ private parseValue;
13
+ private showHelp;
14
+ private showSetHelp;
15
+ }