UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

1,503 lines (1,502 loc) 41.6 kB
/** * CLI-specific type definitions for NeuroLink */ import type { UnknownRecord, JsonValue } from "./common.js"; import type { AnalyticsData, TokenUsage } from "./analytics.js"; import type { EvaluationData } from "./evaluation.js"; import type { ToolCall, ToolResult } from "./tools.js"; import type { TTSResult } from "./tts.js"; import type { VideoGenerationResult } from "./multimodal.js"; import type { PPTGenerationResult } from "./ppt.js"; import type { AvatarResult } from "./avatar.js"; import type { MusicResult } from "./music.js"; import type { OAuthTokens } from "./auth.js"; import type { ClaudeSubscriptionTier } from "./subscription.js"; import type { ServerFramework } from "./server.js"; import type { AuthProviderType } from "./auth.js"; import type { AIProviderName } from "./enums.js"; /** * Ollama command utilities type */ export type AllowedCommand = "ollama" | "curl" | "systemctl" | "pkill" | "killall" | "open" | "taskkill" | "start"; /** * Defines the schema for a session variable or a generation option. */ export type OptionSchema = { type: "string" | "boolean" | "number"; description: string; allowedValues?: string[]; }; /** * Base command arguments type */ export type BaseCommandArgs = { /** Enable debug output */ debug?: boolean; /** Output format */ format?: "text" | "json" | "table" | "yaml"; /** Verbose output */ verbose?: boolean; /** Quiet mode */ quiet?: boolean; /** Index signature to allow additional properties */ [key: string]: unknown; }; /** * Generate command arguments */ export type GenerateCommandArgs = BaseCommandArgs & { /** Input text or prompt */ input?: string; /** AI provider to use */ provider?: string; /** Model name */ model?: string; /** System prompt */ system?: string; /** Temperature setting */ temperature?: number; /** Maximum tokens */ maxTokens?: number; /** Enable analytics */ analytics?: boolean; /** Enable evaluation */ evaluation?: boolean; /** Context data */ context?: string; /** Disable tools */ disableTools?: boolean; /** Maximum steps for multi-turn */ maxSteps?: number; /** Output file */ output?: string; /** Enable extended thinking/reasoning */ thinking?: boolean; /** Token budget for thinking */ thinkingBudget?: number; /** Thinking level for extended reasoning */ thinkingLevel?: "minimal" | "low" | "medium" | "high"; /** Vertex AI region */ region?: string; /** Output mode - 'text' for standard generation, 'video' for video generation, 'ppt' for presentation */ outputMode?: "text" | "video" | "ppt"; /** Path to save generated video file */ videoOutput?: string; /** Video output resolution (720p or 1080p) */ videoResolution?: "720p" | "1080p"; /** Video duration in seconds (4, 6, or 8) */ videoLength?: 4 | 6 | 8; /** Video aspect ratio (9:16 for portrait, 16:9 for landscape) */ videoAspectRatio?: "9:16" | "16:9"; /** Enable/disable audio generation in video */ videoAudio?: boolean; /** Number of slides to generate (5-50) */ pptPages?: number; /** Presentation theme/style */ pptTheme?: "modern" | "corporate" | "creative" | "minimal" | "dark"; /** Target audience */ pptAudience?: "business" | "students" | "technical" | "general"; /** Presentation tone/style */ pptTone?: "professional" | "casual" | "educational" | "persuasive"; /** Path to save generated PPTX file */ pptOutput?: string; /** PPT aspect ratio */ pptAspectRatio?: "16:9" | "4:3"; /** Disable AI image generation for PPT slides */ pptNoImages?: boolean; /** Custom path for generated image output */ imageOutput?: string; }; /** * Stream command arguments */ export type StreamCommandArgs = BaseCommandArgs & { /** Input text or prompt */ input?: string; /** AI provider to use */ provider?: string; /** Model name */ model?: string; /** System prompt */ system?: string; /** Temperature setting */ temperature?: number; /** Maximum tokens */ maxTokens?: number; /** Disable tools */ disableTools?: boolean; /** Enable extended thinking/reasoning */ thinking?: boolean; /** Token budget for thinking */ thinkingBudget?: number; /** Thinking level for extended reasoning */ thinkingLevel?: "minimal" | "low" | "medium" | "high"; /** Vertex AI region */ region?: string; }; /** * Batch command arguments */ export type BatchCommandArgs = BaseCommandArgs & { /** Input file path */ file?: string; /** AI provider to use */ provider?: string; /** Model name */ model?: string; /** System prompt */ system?: string; /** Temperature setting */ temperature?: number; /** Maximum tokens */ maxTokens?: number; /** Delay between requests (ms) */ delay?: number; /** Output file */ output?: string; /** Disable tools */ disableTools?: boolean; }; /** * MCP command arguments - Enhanced with transport and server management */ export type MCPCommandArgs = BaseCommandArgs & { /** MCP server name */ server?: string; /** MCP server name (alias for server) */ serverName?: string; /** Tool name to execute */ tool?: string; /** Tool parameters as JSON string */ params?: string; /** List available tools */ list?: boolean; /** List only specific category */ listOnly?: boolean; /** Discover MCP servers */ discover?: boolean; /** Show server information */ info?: boolean; /** Transport type for server connection */ transport?: "stdio" | "websocket" | "tcp" | "unix"; /** Server description */ description?: string; /** Command/executable for stdio transport */ command?: string; /** Arguments for server command */ args?: string[]; /** Environment variables for server (JSON string) */ env?: string; /** Server URL for network transports */ url?: string; /** Server name for add command */ name?: string; /** Show detailed information */ detailed?: boolean; /** Force operation without confirmation */ force?: boolean; /** Auto install discovered servers */ autoInstall?: boolean; /** Discovery source */ source?: string; /** Connection timeout */ timeout?: number; }; /** * Models command arguments - Enhanced for model management */ export type ModelsCommandArgs = Omit<BaseCommandArgs, "format"> & { /** AI provider to query (single or array) */ provider?: string | string[]; /** Model category filter */ category?: string; /** Model capability filter (array) */ capability?: string[]; /** Include deprecated models */ deprecated?: boolean; /** Search query (capability, use case, or model name) */ query?: string; /** Model use case filter */ useCase?: string; /** Maximum cost per 1K tokens (USD) */ maxCost?: number; /** Minimum context window size (tokens) */ minContext?: number; /** Maximum context window size (tokens) */ maxContext?: number; /** Required performance level */ performance?: "fast" | "medium" | "slow" | "high" | "low"; /** Optimize for code generation and programming */ coding?: boolean; /** Optimize for creative writing and content */ creative?: boolean; /** Optimize for data analysis and research */ analysis?: boolean; /** Optimize for conversational interactions */ conversation?: boolean; /** Optimize for logical reasoning tasks */ reasoning?: boolean; /** Optimize for language translation */ translation?: boolean; /** Optimize for text summarization */ summarization?: boolean; /** Prioritize cost-effectiveness */ costEffective?: boolean; /** Prioritize output quality over cost */ highQuality?: boolean; /** Prioritize response speed */ fast?: boolean; /** Require vision/image processing capability */ requireVision?: boolean; /** Require function calling capability */ requireFunctionCalling?: boolean; /** Exclude specific providers */ excludeProviders?: string[]; /** Prefer local/offline models */ preferLocal?: boolean; /** Model name, alias, or partial match to resolve */ model?: string; /** Enable fuzzy matching for partial names */ fuzzy?: boolean; /** Model IDs or aliases to compare */ models?: string[]; /** Show detailed statistics breakdown */ detailed?: boolean; /** Output format for models command */ format?: "table" | "json" | "compact"; /** List all available models */ list?: boolean; /** Show model statistics */ stats?: boolean; /** Show model pricing */ pricing?: boolean; /** Resolve best model for criteria */ resolve?: boolean; /** Maximum tokens filter */ maxTokens?: number; }; /** * Ollama command arguments */ export type OllamaCommandArgs = BaseCommandArgs & { /** Ollama model name */ model?: string; /** List available models */ list?: boolean; /** Pull a model */ pull?: boolean; /** Remove a model */ remove?: boolean; /** Show model information */ show?: boolean; }; /** * SageMaker command arguments */ export type SageMakerCommandArgs = BaseCommandArgs & { /** SageMaker endpoint name */ endpoint?: string; /** Model name for the endpoint */ model?: string; /** Test prompt for endpoint testing */ prompt?: string; /** List endpoints */ list?: boolean; /** Show configuration */ config?: boolean; /** Setup configuration */ setup?: boolean; /** Clear configuration cache */ clearCache?: boolean; /** Run benchmark test */ benchmark?: boolean; /** Duration for benchmark test (in seconds) */ duration?: number; /** Concurrency level for benchmark */ concurrency?: number; /** Number of requests for benchmark */ requests?: number; /** Maximum tokens per request */ maxTokens?: number; /** Validate endpoint configuration */ validate?: boolean; /** AWS region override */ region?: string; /** Force operation without confirmation */ force?: boolean; }; /** * Secure configuration container that avoids process.env exposure */ export type SecureConfiguration = { accessKeyId: string; secretAccessKey: string; region: string; endpointName: string; timeout: number; maxRetries: number; sessionId: string; createdAt: number; }; /** * Provider status command arguments */ export type ProviderStatusArgs = BaseCommandArgs & { /** Specific provider to check */ provider?: string; /** Check all providers */ all?: boolean; }; /** * CLI command result */ export type CommandResult = { /** Command success status */ success: boolean; /** Result data */ data?: unknown; /** Error message if failed */ error?: string; /** Output content */ content?: string; /** Execution metadata */ metadata?: { executionTime?: number; timestamp?: number; command?: string; }; }; /** * Generate command result */ export type CliGenerateResult = CommandResult & { content: string; provider?: string; model?: string; usage?: TokenUsage; responseTime?: number; toolCalls?: ToolCall[]; toolResults?: ToolResult[]; analytics?: AnalyticsData; evaluation?: EvaluationData; toolsUsed?: string[]; toolExecutions?: Array<{ toolName: string; args: UnknownRecord; result: unknown; executionTime: number; }>; enhancedWithTools?: boolean; availableTools?: Array<{ name: string; description: string; }>; /** TTS audio result when TTS is enabled */ audio?: TTSResult; /** Video generation result when video mode is enabled */ video?: VideoGenerationResult; /** Avatar (talking-head) generation result when avatar mode is enabled */ avatar?: AvatarResult; /** Music generation result when music mode is enabled */ music?: MusicResult; /** PPT generation result when ppt mode is enabled */ ppt?: PPTGenerationResult; imageOutput?: { base64: string; savedPath?: string; } | null; }; /** * Stream result chunk */ export type CliStreamChunk = { content?: string; delta?: string; done?: boolean; metadata?: UnknownRecord; }; /** * CLI output formatting options */ export type OutputOptions = { format: "text" | "json" | "table" | "yaml"; pretty?: boolean; color?: boolean; compact?: boolean; }; /** * Command handler function type */ export type CommandHandler<TArgs = BaseCommandArgs, TResult = CommandResult> = (args: TArgs) => Promise<TResult>; /** * Command definition */ export type CommandDefinition<TArgs = BaseCommandArgs> = { name: string; description: string; aliases?: string[]; args?: { [K in keyof TArgs]: { type: "string" | "number" | "boolean"; description: string; required?: boolean; default?: TArgs[K]; }; }; handler: CommandHandler<TArgs>; }; /** * CLI context */ export type CLIContext = { cwd: string; args: string[]; env: NodeJS.ProcessEnv; exitCode?: number; }; /** * Color mapping for CLI output */ export type ColorMap = { [severity: string]: { color: string; symbol?: string; }; }; /** * Display severity colors (for evaluation display) */ export type SeverityColors = { [key: string]: { color: string; symbol: string; }; }; /** * JSON output structure */ export type JSONOutput = { success: boolean; data?: JsonValue; error?: string; metadata?: { timestamp: number; command: string; version?: string; }; }; /** * Console override for quiet mode */ export type ConsoleOverride = { [method: string]: (() => void) | undefined; }; /** * Conversation choice for inquirer prompt */ export type ConversationChoice = { name: string; value: string | "NEW_CONVERSATION"; short: string; }; /** * Session restore result */ export type SessionRestoreResult = { success: boolean; sessionId: string; messageCount: number; error?: string; lastActivity?: string; }; /** * Tool context for restored sessions */ export type RestorationToolContext = Record<string, unknown> & { sessionId: string; userId: string; source: string; restored: boolean; timestamp: string; }; /** * Type guard for generate result */ export declare function isCliGenerateResult(value: unknown): value is CliGenerateResult; /** * Type guard for command result */ export declare function isCommandResult(value: unknown): value is CommandResult; /** * Environment file backup result */ export type EnvBackupResult = { backupPath?: string; existed: boolean; }; /** * Environment file update result */ export type EnvUpdateResult = { backup: EnvBackupResult; updated: string[]; added: string[]; unchanged: string[]; deleted: string[]; }; /** * Provider configuration for interactive setup */ export type CLIProviderConfig = { id: string; name: string; description: string; envVars: Array<{ key: string; prompt: string; secure?: boolean; default?: string; optional?: boolean; }>; }; /** * Interactive setup result */ export type CLISetupResult = { selectedProviders: string[]; credentials: Record<string, string>; envFileBackup?: string; testResults: Array<{ provider: string; status: "working" | "failed"; error?: string; responseTime?: number; }>; }; /** * Main setup command arguments */ export type SetupArgs = { provider?: string; list?: boolean; status?: boolean; interactive?: boolean; help?: boolean; }; /** * Narrowed ProviderInfo used by the main `neurolink setup` command, * where the descriptive fields are always populated. */ export type SetupProviderInfo = ProviderInfo & Required<Pick<ProviderInfo, "bestFor" | "models" | "strengths" | "pricing" | "setupCommand">>; /** * Provider information for setup display */ export type ProviderInfo = { id: string; name: string; emoji: string; description: string; setupTime: string; cost: string; difficulty?: "Easy" | "Medium" | "Hard"; features?: string[]; bestFor?: string; models?: string; strengths?: string; pricing?: string; setupCommand?: string; handler?: (argv: { check?: boolean; nonInteractive?: boolean; }) => Promise<void>; }; /** * Setup command factory arguments */ export type SetupCommandArgs = BaseCommandArgs & { provider?: string; check?: boolean; list?: boolean; status?: boolean; interactive?: boolean; nonInteractive?: boolean; }; /** * MCP server configuration for CLI */ export type CLIMCPServerConfig = { name: string; transport: "stdio" | "websocket" | "tcp" | "unix"; command?: string; args?: string[]; env?: Record<string, string>; url?: string; description?: string; }; /** * OpenAI setup configuration types */ export declare namespace OpenAISetup { type SetupOptions = { checkOnly?: boolean; interactive?: boolean; }; type SetupArgv = { check?: boolean; nonInteractive?: boolean; }; type Config = { apiKey?: string; organization?: string; model?: string; isReconfiguring?: boolean; }; } /** * Anthropic setup configuration types */ export declare namespace AnthropicSetup { type SetupOptions = { checkOnly?: boolean; interactive?: boolean; }; type SetupArgv = { check?: boolean; nonInteractive?: boolean; }; type Config = { apiKey?: string; model?: string; isReconfiguring?: boolean; }; } /** * Google AI setup configuration types */ export declare namespace GoogleAISetup { type SetupOptions = { checkOnly?: boolean; interactive?: boolean; }; type SetupArgv = { check?: boolean; nonInteractive?: boolean; }; type Config = { apiKey?: string; model?: string; isReconfiguring?: boolean; }; } /** * Azure setup configuration types */ export declare namespace AzureSetup { type SetupOptions = { checkOnly?: boolean; interactive?: boolean; }; type SetupArgv = { check?: boolean; nonInteractive?: boolean; }; type Config = { apiKey?: string; endpoint?: string; deploymentName?: string; apiVersion?: string; model?: string; isReconfiguring?: boolean; }; } /** * AWS Bedrock setup configuration types */ export declare namespace BedrockSetup { type SetupOptions = { checkOnly?: boolean; interactive?: boolean; }; type SetupArgv = { check?: boolean; nonInteractive?: boolean; }; type ConfigData = { region?: string; accessKeyId?: string; secretAccessKey?: string; model?: string; }; type ConfigStatus = { hasCredentials: boolean; hasRegion: boolean; hasModel: boolean; isReconfiguring?: boolean; }; } /** * GCP/Vertex AI setup configuration types */ export declare namespace GCPSetup { type SetupOptions = { checkOnly?: boolean; interactive?: boolean; }; type SetupArgv = { check?: boolean; nonInteractive?: boolean; }; type AuthMethodStatus = { hasServiceAccount: boolean; hasGcloudAuth: boolean; hasApplicationDefault: boolean; preferredMethod?: "service-account" | "gcloud" | "adc"; }; } /** * Hugging Face setup configuration types */ export declare namespace HuggingFaceSetup { type SetupArgs = { check?: boolean; nonInteractive?: boolean; help?: boolean; }; } /** * Mistral setup configuration types */ export declare namespace MistralSetup { type SetupArgs = { check?: boolean; nonInteractive?: boolean; help?: boolean; }; } /** Arguments accepted by `neurolink proxy start` */ export type ProxyStartArgs = { port?: number; host?: string; strategy?: string; healthInterval?: number; quiet?: boolean; debug?: boolean; config?: string; envFile?: string; passthrough?: boolean; dev?: boolean; }; /** Arguments accepted by `neurolink proxy status` */ export type ProxyStatusArgs = { format?: "text" | "json"; quiet?: boolean; }; /** Arguments accepted by hidden `neurolink proxy guard` command */ export type ProxyGuardArgs = { host?: string; port?: number; parentPid?: number; maxWaitMs?: number; failureThreshold?: number; pollIntervalMs?: number; quiet?: boolean; }; /** Arguments accepted by `neurolink proxy telemetry <subcommand>` */ export type ProxyTelemetryArgs = { action?: "setup" | "start" | "stop" | "status" | "logs" | "import-dashboard"; quiet?: boolean; }; /** A fallback chain entry (serialisable subset of FallbackEntry) */ export type FallbackInfo = { provider: string; model: string; }; /** Persisted state for a running proxy instance */ export type ProxyState = { pid: number; port: number; host: string; strategy: string; startTime: string; ready?: boolean; readyAt?: string; healthPath?: string; statusPath?: string; envFile?: string; /** Fallback chain from proxy config (persisted at start time) */ fallbackChain?: FallbackInfo[]; /** Optional fail-open guard PID that reverts Claude settings if proxy dies */ guardPid?: number; /** How the proxy was launched — "launchd" if installed as service, "manual" otherwise */ managedBy?: "launchd" | "manual"; /** Whether the proxy is running in transparent passthrough mode */ passthrough?: boolean; }; /** Stored credentials for an authenticated provider. */ export type StoredCredentials = { type: "api-key" | "oauth"; apiKey?: string; oauth?: OAuthTokens; provider: string; subscriptionTier?: ClaudeSubscriptionTier; email?: string; createdAt: number; updatedAt: number; }; /** Result of checking authentication status for a provider. */ export type AuthStatusResult = { provider: string; isAuthenticated: boolean; method: "api-key" | "oauth" | "none"; subscriptionTier?: string; tokenExpiry?: string; hasRefreshToken?: boolean; needsRefresh?: boolean; }; /** Auth command arguments interface */ export type AuthCommandArgs = BaseCommandArgs & { provider?: string; method?: "api-key" | "oauth" | "create-api-key"; format?: "text" | "json"; quiet?: boolean; debug?: boolean; nonInteractive?: boolean; add?: boolean; label?: string; account?: string; force?: boolean; /** Path to the proxy config YAML, used by set-/get-/clear-primary */ config?: string; /** Email passed to `auth set-primary <email>` */ email?: string; /** Yargs positional arguments */ _?: (string | number)[]; }; /** Telemetry command arguments */ export type TelemetryCommandArgs = { format?: "text" | "json" | "table"; quiet?: boolean; }; /** Telemetry status sub-command args */ export type TelemetryStatusArgs = TelemetryCommandArgs; /** Telemetry configure sub-command args */ export type TelemetryConfigureArgs = TelemetryCommandArgs & { exporter: string; config: string; }; /** Telemetry list-exporters sub-command args */ export type TelemetryListExportersArgs = TelemetryCommandArgs; /** Telemetry flush sub-command args */ export type TelemetryFlushArgs = TelemetryCommandArgs & { timeout?: number; }; /** Telemetry stats sub-command args */ export type TelemetryStatsArgs = TelemetryCommandArgs & { detailed?: boolean; byModel?: boolean; byProvider?: boolean; }; /** Available exporter names */ export type ExporterName = "langfuse" | "langsmith" | "otel" | "datadog" | "sentry" | "braintrust" | "arize" | "posthog" | "laminar"; /** Observability command arguments */ export type ObservabilityCommandArgs = { format?: "text" | "json" | "table"; quiet?: boolean; }; /** Observability status sub-command args */ export type ObservabilityStatusArgs = ObservabilityCommandArgs; /** Observability metrics sub-command args */ export type ObservabilityMetricsArgs = ObservabilityCommandArgs & { detailed?: boolean; }; /** Observability exporters sub-command args */ export type ObservabilityExportersArgs = ObservabilityCommandArgs; /** Observability costs sub-command args */ export type ObservabilityCostsArgs = ObservabilityCommandArgs & { byModel?: boolean; byProvider?: boolean; }; /** Docs command arguments */ export type DocsCommandArgs = { transport?: "stdio" | "http"; port?: number; }; /** Server command arguments */ export type ServerCommandArgs = { port?: number; host?: string; framework?: "hono" | "express" | "fastify" | "koa"; basePath?: string; cors?: boolean; rateLimit?: boolean; quiet?: boolean; format?: "text" | "json" | "yaml"; output?: string; debug?: boolean; }; /** Server status stored in state file */ export type ServerState = { pid: number; port: number; host: string; framework: ServerFramework; startTime: string; basePath: string; }; /** Server configuration stored in config file */ export type ServerConfig = { defaultPort: number; defaultHost: string; defaultFramework: "hono" | "express" | "fastify" | "koa"; defaultBasePath: string; cors: { enabled: boolean; origins?: string[]; }; rateLimit: { enabled: boolean; windowMs?: number; maxRequests?: number; }; swagger: { enabled: boolean; path?: string; }; }; /** Serve command arguments */ export type ServeCommandArgs = { port?: number; host?: string; framework?: ServerFramework; basePath?: string; cors?: boolean; rateLimit?: number; swagger?: boolean; config?: string; watch?: boolean; quiet?: boolean; debug?: boolean; format?: "text" | "json"; }; /** Server configuration file format */ export type ServerConfigFile = { port?: number; host?: string; framework?: ServerFramework; basePath?: string; cors?: { enabled?: boolean; origins?: string[]; methods?: string[]; headers?: string[]; credentials?: boolean; maxAge?: number; }; rateLimit?: { enabled?: boolean; windowMs?: number; maxRequests?: number; message?: string; skipPaths?: string[]; }; bodyParser?: { enabled?: boolean; maxSize?: string; jsonLimit?: string; urlEncoded?: boolean; }; logging?: { enabled?: boolean; level?: "debug" | "info" | "warn" | "error"; includeBody?: boolean; includeResponse?: boolean; }; timeout?: number; enableMetrics?: boolean; enableSwagger?: boolean; }; /** Menu choice type for conversation selector (includes separators). */ export type MenuChoice = ConversationChoice | { type: "separator"; line?: string; }; /** * Type for language models that expose the low-level doGenerate method. * Used by SageMaker CLI commands for direct endpoint testing and benchmarking. */ export type DoGenerateModel = { doGenerate(options: Record<string, unknown>): Promise<{ text?: string; finishReason?: string; usage: { /** Token count for the prompt (Vercel AI SDK convention) */ promptTokens?: number; /** Token count for the completion (Vercel AI SDK convention) */ completionTokens?: number; /** Token count for the input (SageMaker/provider convention) */ inputTokens?: number; /** Token count for the output (SageMaker/provider convention) */ outputTokens?: number; totalTokens?: number; }; }>; }; /** Redis client type (awaited return of createRedisClient). */ export type CliRedisClient = { get: (key: string) => Promise<string | null>; set: (key: string, value: string, options?: unknown) => Promise<unknown>; del: (key: string) => Promise<number>; keys: (pattern: string) => Promise<string[]>; quit: () => Promise<void>; [key: string]: unknown; }; /** * Auth command argument types */ export type AuthProvidersArgs = { format?: "text" | "json" | "table"; }; export type AuthValidateArgs = { token: string; provider: AuthProviderType; domain?: string; clientId?: string; secretKey?: string; secret?: string; url?: string; anonKey?: string; apiKey?: string; format?: "text" | "json"; }; export type AuthHealthArgs = { provider: AuthProviderType; domain?: string; clientId?: string; secretKey?: string; secret?: string; url?: string; anonKey?: string; apiKey?: string; format?: "text" | "json"; }; export type SetupResult = { selectedProviders: AIProviderName[]; credentials: Record<string, string>; envFileBackup?: string; testResults: Array<{ provider: AIProviderName; status: "working" | "failed"; error?: string; responseTime?: number; }>; }; /** * Shared options for every provider-specific CLI setup command * (anthropic, azure, bedrock, gcp, google-ai, openai). */ export type ProviderSetupOptions = { checkOnly?: boolean; interactive?: boolean; }; /** Shared yargs-argv shape for every provider-specific CLI setup command. */ export type ProviderSetupArgv = { check?: boolean; nonInteractive?: boolean; }; /** * Superset provider-setup config. `endpoint` is Azure-only; other providers * leave it undefined. Pre-consolidation there were 4 near-duplicate types * (Anthropic/Azure/GoogleAI/OpenAI); they are now one. */ export type ProviderSetupConfig = { apiKey?: string; model?: string; endpoint?: string; isReconfiguring?: boolean; }; /** Providers supported by the `neurolink auth` command. */ export type SupportedProvider = "anthropic"; /** Arguments for `neurolink autoresearch init`. */ export type AutoresearchInitArgs = { repoPath: string; tag: string; target: string; immutable: string; runCommand: string; metricName: string; metricPattern: string; metricDirection: string; timeout: number; provider?: string; model?: string; }; /** Base options shared across all `neurolink evaluate` subcommands. */ export type BaseEvaluateArgs = { json?: boolean; verbose?: boolean; format?: "text" | "json" | "table"; }; /** Arguments for the bare `neurolink evaluate` invocation. */ export type DirectEvaluateArgs = BaseEvaluateArgs & { input?: string; query?: string; scorers?: string[]; context?: string; threshold?: number; }; /** Arguments for `neurolink evaluate run`. */ export type EvaluateRunArgs = BaseEvaluateArgs & { input?: string; output?: string; context?: string[]; groundTruth?: string; pipeline?: string; scorer?: string[]; }; /** Arguments for `neurolink evaluate score`. */ export type EvaluateScoreArgs = BaseEvaluateArgs & { scorer: string; input?: string; output?: string; context?: string[]; groundTruth?: string; }; /** Arguments for `neurolink evaluate report`. */ export type EvaluateReportArgs = BaseEvaluateArgs & { input?: string; output?: string; context?: string[]; groundTruth?: string; "ground-truth"?: string; pipeline?: string; scorer?: string[]; outputFile?: string; "output-file"?: string; }; /** Arguments for `neurolink evaluate presets`. */ export type EvaluatePresetsArgs = { preset?: string; json?: boolean; }; /** Arguments for `neurolink evaluate scorers` (list-scorers). */ export type EvaluateScorersArgs = { category?: string; type?: string; json?: boolean; detailed?: boolean; }; /** Arguments for `neurolink evaluate run-pipeline`. */ export type RunPipelineArgs = BaseEvaluateArgs & { preset: string; input: string; query?: string; context?: string; threshold?: number; }; /** Info row for an MCP tool annotation. */ export type ToolAnnotationInfo = { serverName: string; serverId: string; toolName: string; description: string; annotations: import("./mcp.js").MCPToolAnnotations; }; /** Tool target used by the annotation printer. */ export type AnnotatedToolTarget = { name: string; description: string; serverId: string; serverName: string; }; /** Arguments for `neurolink rag chunk`. */ export type RagChunkArgs = import("./rag.js").RAGCommandArgs & { file: string; output?: string; extract?: boolean; }; /** Arguments for `neurolink rag index`. */ export type RagIndexArgs = import("./rag.js").RAGCommandArgs & { file: string; indexName?: string; }; /** Arguments for `neurolink rag query`. */ export type RagQueryArgs = import("./rag.js").RAGCommandArgs & { query: string; indexName?: string; }; /** Minimal server instance contract used by `neurolink serve`. */ export type ServerInstance = { initialize: () => Promise<void>; start: () => Promise<void>; stop: () => Promise<void>; registerRouteGroup: (group: import("./server.js").RouteGroup) => void; listRoutes?: () => import("./server.js").RouteDefinition[]; }; /** Persisted state for a running `neurolink serve` process. */ export type ServeState = { pid: number; port: number; host: string; framework: string; startTime: string; basePath: string; configFile?: string; }; /** Captured Bedrock setup configuration data. */ export type BedrockConfigData = { accessKeyId?: string; secretAccessKey?: string; region?: string; model?: string; }; /** Status of Bedrock setup configuration flags. */ export type BedrockConfigStatus = { hasAccessKey: boolean; hasSecretKey: boolean; hasRegion: boolean; }; /** Status of each GCP auth method tried by setup-gcp. */ export type GcpAuthMethodStatus = { method1: { complete: boolean; hasCredentials: boolean; missingVars: string[]; }; method2: { complete: boolean; hasServiceAccountKey: boolean; missingVars: string[]; }; method3: { complete: boolean; hasClientEmail: boolean; hasPrivateKey: boolean; missingVars: string[]; }; common: { hasProject: boolean; hasLocation: boolean; missingVars: string[]; }; }; /** Arguments for `neurolink setup huggingface`. */ export type SetupHuggingFaceArgs = { check?: boolean; "non-interactive"?: boolean; }; /** Arguments for `neurolink setup mistral`. */ export type SetupMistralArgs = { check?: boolean; "non-interactive"?: boolean; }; /** Arguments for `neurolink task create`. */ export type TaskCreateArgs = { name: string; prompt: string; cron?: string; timezone?: string; every?: string; at?: string; mode: string; provider?: string; model?: string; maxRuns?: number; maxTokens?: number; temperature?: number; systemPrompt?: string; }; /** Arguments for `neurolink task update`. */ export type TaskUpdateArgs = { taskId: string; prompt?: string; cron?: string; every?: string; at?: string; mode?: string; }; /** Arguments for `neurolink task logs`. */ export type TaskLogsArgs = { taskId: string; limit: number; status?: string; full?: boolean; }; /** Arguments for `neurolink voice-server`. */ export type VoiceServerArgs = { port: number; }; /** Provider config row used by the interactive setup wizard. */ export type InteractiveProviderConfig = { id: AIProviderName; name: string; description: string; envVars: Array<{ key: string; prompt: string; secure?: boolean; default?: string; optional?: boolean; }>; }; /** Result of saving video to file. */ export type VideoSaveResult = { success: boolean; path: string; size: number; error?: string; }; /** Provider identifier recognized by the `neurolink config` command. */ export type CliConfigProvider = "auto" | "openai" | "bedrock" | "vertex" | "anthropic" | "azure" | "google-ai" | "huggingface" | "ollama" | "mistral"; /** Analytics config for the healthcare evaluation domain. */ export type CliHealthcareAnalyticsConfig = { trackPatientData: boolean; trackDiagnosticAccuracy: boolean; trackTreatmentOutcomes: boolean; }; /** Analytics config for the analytics evaluation domain. */ export type CliAnalyticsDomainAnalyticsConfig = { trackDataQuality: boolean; trackModelPerformance: boolean; trackBusinessImpact: boolean; }; /** Analytics config for the finance evaluation domain. */ export type CliFinanceAnalyticsConfig = { trackRiskMetrics: boolean; trackRegulatory: boolean; trackPortfolioImpact: boolean; }; /** Analytics config for the ecommerce evaluation domain. */ export type CliEcommerceAnalyticsConfig = { trackConversions: boolean; trackUserBehavior: boolean; trackRevenueImpact: boolean; }; /** Generic shape of a single domain entry in the CLI config. */ export type CliDomainConfig<TAnalytics extends Record<string, boolean> = Record<string, boolean>> = { evaluationCriteria: string[]; analyticsConfig: TAnalytics; }; /** * Materialized shape of the CLI config parsed from `~/.neurolink/config.json`. * Matches the output of `ConfigSchema.parse()` defined in * `src/cli/commands/config.ts`. The schema is annotated with * `z.ZodType<CliNeuroLinkConfig>` so drift fails at compile time. */ export type CliNeuroLinkConfig = { defaultProvider: CliConfigProvider; providers: { openai?: { apiKey?: string; model: string; baseURL?: string; }; bedrock?: { region?: string; accessKeyId?: string; secretAccessKey?: string; sessionToken?: string; model: string; }; vertex?: { projectId?: string; location: string; credentials?: string; serviceAccountKey?: string; clientEmail?: string; privateKey?: string; model: string; }; anthropic?: { apiKey?: string; model: string; }; azure?: { apiKey?: string; endpoint?: string; deploymentId?: string; model: string; }; "google-ai"?: { apiKey?: string; model: string; }; huggingface?: { apiKey?: string; model: string; }; ollama?: { baseUrl: string; model: string; timeout: number; }; mistral?: { apiKey?: string; model: string; }; }; profiles: Record<string, unknown>; preferences: { outputFormat: "text" | "json" | "yaml"; temperature: number; maxTokens?: number; enableLogging: boolean; enableCaching: boolean; cacheStrategy: "memory" | "file" | "redis"; defaultEvaluationDomain?: string; enableAnalyticsByDefault: boolean; enableEvaluationByDefault: boolean; }; domains: { healthcare: CliDomainConfig<CliHealthcareAnalyticsConfig>; analytics: CliDomainConfig<CliAnalyticsDomainAnalyticsConfig>; finance: CliDomainConfig<CliFinanceAnalyticsConfig>; ecommerce: CliDomainConfig<CliEcommerceAnalyticsConfig>; }; }; /** Row in the MCP tools listing produced by `neurolink mcp tools`. */ export type MCPToolWithServer = { name: string; description: string; serverId: string; serverName: string; inputSchema?: object; category?: string; annotations?: { readOnlyHint?: boolean; destructiveHint?: boolean; idempotentHint?: boolean; requiresConfirmation?: boolean; tags?: string[]; }; }; /** Per-server discovery result produced by `neurolink mcp discover`. */ export type MCPDiscoveryResult = { serverId: string; serverName: string; toolCount: number; tools: Array<{ name: string; description: string; annotations: Record<string, unknown>; }>; }; /** * Minimal route-group shape reflected at runtime by `neurolink serve routes`. * Named with a `CliServe` prefix to disambiguate from the richer RouteGroup * in server.ts (§Rule 9). */ export type CliServeRouteGroup = { prefix: string; routes: Array<{ method: string; path: string; description?: string; }>; }; /** Flat per-route row used by the `neurolink serve routes` listing. */ export type CliServeFlatRoute = { method: string; path: string; description?: string; group: string; };