Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/cli/commands/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import type { CommandModule, Argv } from "yargs";
import type { UnknownRecord } from "../../lib/types/common.js";
import type {
MCPServerInfo,
MCPStatus,
MCPTransportType,
} from "../../lib/types/mcpTypes.js";
Comment thread
RajuSudhar marked this conversation as resolved.
import { createExternalServerInfo } from "../../lib/utils/mcpDefaults.js";
import type { MCPCommandArgs } from "../../lib/types/cli.js";
import { NeuroLink, type MCPStatus } from "../../lib/neurolink.js";
import { NeuroLink } from "../../lib/neurolink.js";
import { logger } from "../../lib/utils/logger.js";
import chalk from "chalk";
import ora from "ora";
Expand Down
12 changes: 7 additions & 5 deletions src/cli/commands/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import type { CommandModule, Argv } from "yargs";
import type { AIProviderName } from "../../lib/types/index.js";
import type { AIProviderName } from "../../lib/constants/enums.js";
import type { ModelsCommandArgs } from "../../lib/types/cli.js";
import type { ModelPricing } from "../../lib/types/providers.js";
import {
Expand All @@ -19,11 +19,13 @@ import {
getModelsByProvider,
getAvailableProviders,
formatModelForDisplay,
type ModelSearchFilters,
type ModelCapabilities,
type UseCaseSuitability,
} from "../../lib/models/modelRegistry.js";
import type { RecommendationContext } from "../../lib/models/modelResolver.js";
import type {
RecommendationContext,
ModelSearchFilters,
ModelCapabilities,
UseCaseSuitability,
} from "../../lib/types/modelTypes.js";
import chalk from "chalk";
import ora from "ora";

Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/setup-google-ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import inquirer from "inquirer";
import chalk from "chalk";
import ora from "ora";
import { logger } from "../../lib/utils/logger.js";
import { GoogleAIModels } from "../../lib/types/providers.js";
import { GoogleAIModels } from "../../lib/constants/enums.js";
import {
updateEnvFile as updateEnvFileManager,
displayEnvUpdateSummary,
Expand Down
12 changes: 2 additions & 10 deletions src/cli/loop/optionsSchema.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import { AIProviderName } from "../../lib/types/providers.js";
import { AIProviderName } from "../../lib/constants/enums.js";
import type { TextGenerationOptions } from "../../lib/types/generateTypes.js";

/**
* Defines the schema for a session variable or a generation option.
*/
export interface OptionSchema {
type: "string" | "boolean" | "number";
description: string;
allowedValues?: string[];
}
import type { OptionSchema } from "../../lib/types/cli.js";

/**
* Master schema for all text generation options.
Expand Down
2 changes: 1 addition & 1 deletion src/cli/loop/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
NeurolinkOptions,
} from "../../lib/types/conversation.js";
import { textGenerationOptionsSchema } from "./optionsSchema.js";
import type { OptionSchema } from "./optionsSchema.js";
import type { OptionSchema } from "../../lib/types/cli.js";
import { handleError } from "../errorHandler.js";
import { ConversationSelector } from "./conversationSelector.js";
import { NeuroLink } from "../../lib/neurolink.js";
Expand Down
14 changes: 1 addition & 13 deletions src/cli/utils/envManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,7 @@
import fs from "fs";
import chalk from "chalk";
import { logger } from "../../lib/utils/logger.js";

export interface EnvBackupResult {
backupPath?: string;
existed: boolean;
}

export interface EnvUpdateResult {
backup: EnvBackupResult;
updated: string[];
added: string[];
unchanged: string[];
deleted: string[];
}
import type { EnvBackupResult, EnvUpdateResult } from "../../lib/types/cli.js";

/**
* Create a timestamped backup of the existing .env file
Expand Down
2 changes: 1 addition & 1 deletion src/cli/utils/interactiveSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* credential collection, testing, and environment file management.
*/

import { AIProviderName } from "../../lib/types/index.js";
import { AIProviderName } from "../../lib/constants/enums.js";
import { NeuroLink } from "../../lib/neurolink.js";
import chalk from "chalk";
import ora from "ora";
Expand Down
150 changes: 150 additions & 0 deletions src/lib/constants/enums.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
// ============================================================================
// ENUMS
// ============================================================================

/**
* Supported AI Provider Names
*/
export enum AIProviderName {
BEDROCK = "bedrock",
OPENAI = "openai",
OPENAI_COMPATIBLE = "openai-compatible",
VERTEX = "vertex",
ANTHROPIC = "anthropic",
AZURE = "azure",
GOOGLE_AI = "google-ai",
HUGGINGFACE = "huggingface",
OLLAMA = "ollama",
MISTRAL = "mistral",
LITELLM = "litellm",
SAGEMAKER = "sagemaker",
AUTO = "auto",
}

/**
* Supported Models for Amazon Bedrock
*/
export enum BedrockModels {
CLAUDE_3_SONNET = "anthropic.claude-3-sonnet-20240229-v1:0",
CLAUDE_3_HAIKU = "anthropic.claude-3-haiku-20240307-v1:0",
CLAUDE_3_5_SONNET = "anthropic.claude-3-5-sonnet-20240620-v1:0",
CLAUDE_3_7_SONNET = "arn:aws:bedrock:us-east-2:225681119357:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0",
}

/**
* Supported Models for OpenAI
*/
export enum OpenAIModels {
GPT_4 = "gpt-4",
GPT_4_TURBO = "gpt-4-turbo",
GPT_4O = "gpt-4o",
GPT_4O_MINI = "gpt-4o-mini",
GPT_3_5_TURBO = "gpt-3.5-turbo",
O1_PREVIEW = "o1-preview",
O1_MINI = "o1-mini",
}

/**
* Supported Models for Google Vertex AI
*/
export enum VertexModels {
// Claude 4 Series (Latest - May 2025)
CLAUDE_4_0_SONNET = "claude-sonnet-4@20250514",
CLAUDE_4_0_OPUS = "claude-opus-4@20250514",

// Claude 3.5 Series (Still supported)
CLAUDE_3_5_SONNET = "claude-3-5-sonnet-20241022",
CLAUDE_3_5_HAIKU = "claude-3-5-haiku-20241022",

// Claude 3 Series (Legacy support)
CLAUDE_3_SONNET = "claude-3-sonnet-20240229",
CLAUDE_3_OPUS = "claude-3-opus-20240229",
CLAUDE_3_HAIKU = "claude-3-haiku-20240307",

// Gemini 2.5 Series (Latest - 2025)
GEMINI_2_5_PRO = "gemini-2.5-pro",
GEMINI_2_5_FLASH = "gemini-2.5-flash",
GEMINI_2_5_FLASH_LITE = "gemini-2.5-flash-lite",

// Gemini 2.0 Series
GEMINI_2_0_FLASH_001 = "gemini-2.0-flash-001",

// Gemini 1.5 Series (Legacy support)
GEMINI_1_5_PRO = "gemini-1.5-pro",
GEMINI_1_5_FLASH = "gemini-1.5-flash",
}

/**
* Supported Models for Google AI Studio
*/
export enum GoogleAIModels {
// Gemini 2.5 Series (Latest - 2025)
GEMINI_2_5_PRO = "gemini-2.5-pro",
GEMINI_2_5_FLASH = "gemini-2.5-flash",
GEMINI_2_5_FLASH_LITE = "gemini-2.5-flash-lite",

// Gemini 2.0 Series
GEMINI_2_0_FLASH_001 = "gemini-2.0-flash-001",

// Gemini 1.5 Series (Legacy support)
GEMINI_1_5_PRO = "gemini-1.5-pro",
GEMINI_1_5_FLASH = "gemini-1.5-flash",
GEMINI_1_5_FLASH_LITE = "gemini-1.5-flash-lite",
}

/**
* Supported Models for Anthropic (Direct API)
*/
export enum AnthropicModels {
// Claude 3.5 Series (Latest)
CLAUDE_3_5_SONNET = "claude-3-5-sonnet-20241022",
CLAUDE_3_5_HAIKU = "claude-3-5-haiku-20241022",

// Claude 3 Series (Legacy support)
CLAUDE_3_SONNET = "claude-3-sonnet-20240229",
CLAUDE_3_OPUS = "claude-3-opus-20240229",
CLAUDE_3_HAIKU = "claude-3-haiku-20240307",
}

/**
* API Versions for various providers
*/
export enum APIVersions {
// Azure OpenAI API versions
AZURE_LATEST = "2025-04-01-preview",
AZURE_STABLE = "2024-10-21",
AZURE_LEGACY = "2023-12-01-preview",

// OpenAI API versions
OPENAI_CURRENT = "v1",
OPENAI_BETA = "v1-beta",

// Google AI API versions
GOOGLE_AI_CURRENT = "v1",
GOOGLE_AI_BETA = "v1beta",

// Anthropic API versions
ANTHROPIC_CURRENT = "2023-06-01",

// Other provider versions can be added here
}

// Error categories for proper handling
export enum ErrorCategory {
VALIDATION = "validation",
TIMEOUT = "timeout",
NETWORK = "network",
RESOURCE = "resource",
PERMISSION = "permission",
CONFIGURATION = "configuration",
EXECUTION = "execution",
SYSTEM = "system",
}

// Error severity levels
export enum ErrorSeverity {
LOW = "low",
MEDIUM = "medium",
HIGH = "high",
CRITICAL = "critical",
}
2 changes: 1 addition & 1 deletion src/lib/core/baseProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import type {
TextGenerationResult,
EnhancedGenerateResult,
AnalyticsData,
AIProviderName,
ExtendedTool,
AISDKGenerateResult,
} from "../types/index.js";
import { AIProviderName } from "../constants/enums.js";
import type { EvaluationData } from "../index.js";
import { MiddlewareFactory } from "../middleware/factory.js";
import type { MiddlewareFactoryOptions } from "../types/middlewareTypes.js";
Expand Down
7 changes: 2 additions & 5 deletions src/lib/core/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ import { ProviderRegistry } from "../factories/providerRegistry.js";
import { getBestProvider } from "../utils/providerUtils.js";
import { logger } from "../utils/logger.js";
import { dynamicModelProvider } from "./dynamicModels.js";
import type {
AIProvider,
AIProviderName,
SupportedModelName,
} from "../types/index.js";
import type { AIProvider, SupportedModelName } from "../types/index.js";
import { AIProviderName } from "../constants/enums.js";
import type { UnknownRecord } from "../types/common.js";
import type { ProviderPairResult } from "../types/typeAliases.js";

Expand Down
3 changes: 2 additions & 1 deletion src/lib/factories/providerFactory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { AIProvider, AIProviderName } from "../types/index.js";
import type { AIProvider } from "../types/index.js";
import type { UnknownRecord } from "../types/common.js";
import { logger } from "../utils/logger.js";
import { AIProviderName } from "../constants/enums.js";

// Pure factory pattern with no hardcoded imports
// All providers loaded dynamically via registry to avoid circular dependencies
Expand Down
22 changes: 6 additions & 16 deletions src/lib/factories/providerRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,16 @@ import { ProviderFactory } from "./providerFactory.js";
// Lazy loading all providers to avoid circular dependencies
// Removed all static imports - providers loaded dynamically when needed
// This breaks the circular dependency chain completely
import {
AIProviderName,
GoogleAIModels,
OpenAIModels,
} from "../types/index.js";
import type { ProviderRegistryOptions } from "../types/index.js";
import { logger } from "../utils/logger.js";
import type { UnknownRecord } from "../types/common.js";
import type { NeuroLink } from "../neurolink.js";
import type { MistralProvider as MistralProviderType } from "@ai-sdk/mistral";

/**
* Configuration options for the provider registry
*/
export interface ProviderRegistryOptions {
/**
* Enable loading of manual MCP configurations from .mcp-config.json
* Should only be true for CLI mode, false for SDK mode
*/
enableManualMCP?: boolean;
}
import {
AIProviderName,
GoogleAIModels,
OpenAIModels,
} from "../constants/enums.js";

/**
* Provider Registry - registers all providers with the factory
Expand Down
2 changes: 1 addition & 1 deletion src/lib/hitl/hitlManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type {
ConfirmationTimeoutEvent,
HITLStatistics,
HITLAuditLog,
} from "./types.js";
} from "../types/hitlTypes.js";
import { HITLTimeoutError, HITLConfigurationError } from "./hitlErrors.js";
import { logger } from "../utils/logger.js";

Expand Down
13 changes: 0 additions & 13 deletions src/lib/hitl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,6 @@
// Core HITL Manager
export { HITLManager } from "./hitlManager.js";

// Type Definitions
export type {
HITLConfig,
HITLRule,
ConfirmationRequest,
ConfirmationResult,
ConfirmationRequestEvent,
ConfirmationResponseEvent,
ConfirmationTimeoutEvent,
HITLStatistics,
HITLAuditLog,
} from "./types.js";

// Error Classes
export {
HITLError,
Expand Down
Loading
Loading