UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and

111 lines (110 loc) 2.97 kB
/** * Context Types for NeuroLink - Factory Pattern Implementation * Provides type-safe context integration for AI generation */ import { JsonObject } from "./common.js"; /** * Base context interface for all AI operations */ export interface BaseContext { userId?: string; sessionId?: string; requestId?: string; userRole?: string; userPreferences?: JsonObject; userMetadata?: JsonObject; applicationContext?: { name: string; version?: string; environment?: "development" | "staging" | "production"; }; organizationId?: string; departmentId?: string; projectId?: string; [key: string]: unknown; } /** * Context integration mode types */ export type ContextIntegrationMode = "prompt_prefix" | "prompt_suffix" | "system_prompt" | "metadata_only" | "structured_prompt" | "none"; /** * Context configuration for AI generation */ export interface ContextConfig { mode: ContextIntegrationMode; includeInPrompt?: boolean; includeInAnalytics?: boolean; includeInEvaluation?: boolean; template?: string; maxLength?: number; } /** * Context processing result */ export interface ProcessedContext { originalContext: BaseContext; processedContext: string | null; config: ContextConfig; metadata: { truncated: boolean; processingTime: number; template: string; mode: ContextIntegrationMode; }; } /** * Factory for context processing */ export declare class ContextFactory { /** * Default context configuration */ static readonly DEFAULT_CONFIG: ContextConfig; /** * Validate and normalize context data */ static validateContext(context: unknown): BaseContext | null; /** * Process context for AI generation based on configuration */ static processContext(context: BaseContext, config?: Partial<ContextConfig>): ProcessedContext; /** * Format context for prompt integration */ private static formatContextForPrompt; /** * Format context as prompt prefix */ private static formatAsPrefix; /** * Format context as prompt suffix */ private static formatAsSuffix; /** * Format context for system prompt */ private static formatForSystemPrompt; /** * Format context in structured format */ private static formatStructured; /** * Extract analytics data from context */ static extractAnalyticsContext(context: BaseContext): JsonObject; /** * Extract evaluation context */ static extractEvaluationContext(context: BaseContext): JsonObject; } /** * Type guard to check if value is valid context */ export declare function isValidContext(value: unknown): value is BaseContext; /** * Context integration options for AI generation */ export interface ContextIntegrationOptions { context?: BaseContext; contextConfig?: Partial<ContextConfig>; }