{"version":3,"file":"index.cjs","sources":["../src/core/types.ts","../src/core/utils.ts","../src/core/client.ts","../src/core/errors.ts","../src/index.ts","../src/node/cli-integration.ts","../src/node/enhanced-client.ts","../src/node/index.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * Memory types supported by the service\n */\nexport const MEMORY_TYPES = ['context', 'project', 'knowledge', 'reference', 'personal', 'workflow'] as const;\nexport type MemoryType = typeof MEMORY_TYPES[number];\n\n/**\n * Memory status values\n */\nexport const MEMORY_STATUSES = ['active', 'archived', 'draft', 'deleted'] as const;\nexport type MemoryStatus = typeof MEMORY_STATUSES[number];\n\n/**\n * Core memory entry interface\n */\nexport interface MemoryEntry {\n  id: string;\n  title: string;\n  content: string;\n  summary?: string;\n  memory_type: MemoryType;\n  status: MemoryStatus;\n  relevance_score?: number;\n  access_count: number;\n  last_accessed?: string;\n  user_id: string;\n  topic_id?: string;\n  project_ref?: string;\n  tags: string[];\n  metadata?: Record<string, unknown>;\n  created_at: string;\n  updated_at: string;\n}\n\n/**\n * Memory topic for organization\n */\nexport interface MemoryTopic {\n  id: string;\n  name: string;\n  description?: string;\n  color?: string;\n  icon?: string;\n  user_id: string;\n  parent_topic_id?: string;\n  is_system: boolean;\n  metadata?: Record<string, unknown>;\n  created_at: string;\n  updated_at: string;\n}\n\n/**\n * Memory search result with similarity score\n */\nexport interface MemorySearchResult extends MemoryEntry {\n  similarity_score: number;\n}\n\n/**\n * User memory statistics\n */\nexport interface UserMemoryStats {\n  total_memories: number;\n  memories_by_type: Record<MemoryType, number>;\n  total_topics: number;\n  most_accessed_memory?: string;\n  recent_memories: string[];\n}\n\n/**\n * Intelligence API types\n */\nexport interface IntelligenceUsage {\n  tokens_used: number;\n  cost_usd: number;\n  cached: boolean;\n}\n\nexport interface IntelligenceTierInfo {\n  tier: string;\n  usage_remaining: number;\n}\n\nexport interface IntelligenceApiResponse<T> {\n  data?: T;\n  error?: string;\n  message?: string;\n  usage?: IntelligenceUsage;\n  tierInfo?: IntelligenceTierInfo;\n  errorCode?: string;\n  statusCode?: number;\n  details?: unknown;\n}\n\nexport interface IntelligenceEnvelope<T> {\n  success: boolean;\n  data?: T;\n  error?: string;\n  message?: string;\n  usage?: IntelligenceUsage;\n  tier_info?: IntelligenceTierInfo;\n}\n\nexport interface TagSuggestionResult {\n  suggestions: string[];\n  existing_tags: string[];\n  from_user_vocabulary: number;\n  memory_id?: string;\n}\n\nexport interface PatternAnalysisResult {\n  total_memories?: number;\n  time_range_days?: number;\n  average_content_length?: number;\n  memories_by_type?: Record<string, number>;\n  memories_by_day_of_week?: Record<string, number>;\n  peak_creation_hours?: number[];\n  top_tags?: Array<{ tag: string; count: number }>;\n  most_accessed?: Array<{ id: string; title: string; access_count: number }>;\n  insights?: string[];\n  generated_at?: string;\n  message?: string;\n  patterns?: null;\n}\n\nexport interface HealthIssue {\n  severity: 'high' | 'medium' | 'low';\n  category: string;\n  description: string;\n  affected_count: number;\n  recommendation: string;\n}\n\nexport interface HealthCheckResult {\n  health_score?: {\n    overall: number;\n    breakdown?: {\n      organization: number;\n      tagging: number;\n      recency: number;\n      completeness: number;\n      diversity: number;\n    } | null;\n  };\n  status?: 'excellent' | 'good' | 'needs_attention' | 'poor';\n  statistics?: {\n    total_memories: number;\n    active_memories: number;\n    archived_memories: number;\n    memories_with_tags: number;\n    unique_tags: number;\n    memory_types: number;\n    recent_memories_30d: number;\n    stale_memories_90d: number;\n  };\n  issues?: HealthIssue[];\n  recommendations?: string[];\n  generated_at?: string;\n  message?: string;\n}\n\nexport interface RelatedMemory {\n  id: string;\n  title: string;\n  type: string;\n  tags: string[];\n  similarity: number;\n  snippet: string;\n}\n\nexport interface FindRelatedResult {\n  query: string;\n  source_memory_id?: string;\n  related_memories: RelatedMemory[];\n  total_found: number;\n  search_method: 'semantic' | 'keyword';\n  threshold_used: number;\n}\n\nexport interface DuplicateGroup {\n  primary_id: string;\n  primary_title: string;\n  duplicates: Array<{\n    id: string;\n    title: string;\n    similarity: number;\n    created_at: string;\n  }>;\n  similarity_score: number;\n}\n\nexport interface DetectDuplicatesResult {\n  duplicate_groups: DuplicateGroup[];\n  total_groups: number;\n  total_duplicates: number;\n  detection_method: 'semantic' | 'text';\n  threshold_used: number;\n  memories_analyzed: number;\n  potential_storage_savings: string;\n  message?: string;\n}\n\nexport type InsightType = 'themes' | 'connections' | 'gaps' | 'actions' | 'summary';\n\nexport interface Insight {\n  type: InsightType;\n  content: string;\n  confidence: number;\n  related_memory_ids?: string[];\n}\n\nexport interface ExtractInsightsResult {\n  insights: Insight[];\n  overall_summary?: string;\n  memories_analyzed?: number;\n  insight_types?: InsightType[];\n  topic_filter?: string | null;\n  generated_at?: string;\n  message?: string;\n}\n\n/**\n * Validation schemas using Zod\n */\n\nexport const createMemorySchema = z.object({\n  title: z.string().min(1).max(500),\n  content: z.string().min(1).max(50000),\n  summary: z.string().max(1000).optional(),\n  memory_type: z.enum(MEMORY_TYPES).default('context'),\n  topic_id: z.string().uuid().optional(),\n  project_ref: z.string().max(100).optional(),\n  tags: z.array(z.string().min(1).max(50)).max(20).default([]),\n  metadata: z.record(z.string(), z.unknown()).optional()\n});\n\nexport const updateMemorySchema = z.object({\n  title: z.string().min(1).max(500).optional(),\n  content: z.string().min(1).max(50000).optional(),\n  summary: z.string().max(1000).optional(),\n  memory_type: z.enum(MEMORY_TYPES).optional(),\n  status: z.enum(MEMORY_STATUSES).optional(),\n  topic_id: z.string().uuid().nullable().optional(),\n  project_ref: z.string().max(100).nullable().optional(),\n  tags: z.array(z.string().min(1).max(50)).max(20).optional(),\n  metadata: z.record(z.string(), z.unknown()).optional()\n});\n\nexport const searchMemorySchema = z.object({\n  query: z.string().min(1).max(1000),\n  memory_types: z.array(z.enum(MEMORY_TYPES)).optional(),\n  tags: z.array(z.string()).optional(),\n  topic_id: z.string().uuid().optional(),\n  project_ref: z.string().optional(),\n  status: z.enum(MEMORY_STATUSES).default('active'),\n  limit: z.number().int().min(1).max(100).default(20),\n  threshold: z.number().min(0).max(1).default(0.7)\n});\n\nexport const createTopicSchema = z.object({\n  name: z.string().min(1).max(100),\n  description: z.string().max(500).optional(),\n  color: z.string().regex(/^#[0-9A-Fa-f]{6}$/).optional(),\n  icon: z.string().max(50).optional(),\n  parent_topic_id: z.string().uuid().optional()\n});\n\nexport const suggestTagsSchema = z\n  .object({\n    memory_id: z.string().uuid().optional(),\n    content: z.string().min(1).optional(),\n    title: z.string().optional(),\n    existing_tags: z.array(z.string()).optional(),\n    max_suggestions: z.number().int().min(1).max(10).optional()\n  })\n  .refine((data) => data.memory_id || data.content, {\n    message: 'Either memory_id or content is required'\n  });\n\nexport const analyzePatternsSchema = z.object({\n  time_range_days: z.number().int().min(1).max(365).optional(),\n  include_insights: z.boolean().optional(),\n  response_format: z.enum(['json', 'markdown']).optional()\n});\n\nexport const intelligenceHealthCheckSchema = z.object({\n  include_recommendations: z.boolean().optional(),\n  detailed_breakdown: z.boolean().optional()\n});\n\nexport const findRelatedSchema = z\n  .object({\n    memory_id: z.string().uuid().optional(),\n    query: z.string().min(1).optional(),\n    limit: z.number().int().min(1).max(20).optional(),\n    similarity_threshold: z.number().min(0).max(1).optional(),\n    exclude_ids: z.array(z.string().uuid()).optional()\n  })\n  .refine((data) => data.memory_id || data.query, {\n    message: 'Either memory_id or query is required'\n  });\n\nexport const detectDuplicatesSchema = z.object({\n  similarity_threshold: z.number().min(0).max(1).optional(),\n  include_archived: z.boolean().optional(),\n  limit: z.number().int().min(1).max(50).optional()\n});\n\nexport const extractInsightsSchema = z.object({\n  memory_ids: z.array(z.string().uuid()).optional(),\n  topic: z.string().min(1).optional(),\n  time_range_days: z.number().int().min(1).max(365).optional(),\n  insight_types: z.array(z.enum(['themes', 'connections', 'gaps', 'actions', 'summary'])).optional(),\n  detail_level: z.enum(['brief', 'detailed', 'comprehensive']).optional()\n});\n\n/**\n * Inferred types from schemas\n */\nexport type CreateMemoryRequest = z.infer<typeof createMemorySchema>;\nexport type UpdateMemoryRequest = z.infer<typeof updateMemorySchema>;\nexport type SearchMemoryRequest = z.infer<typeof searchMemorySchema>;\nexport type CreateTopicRequest = z.infer<typeof createTopicSchema>;\nexport type SuggestTagsRequest = z.infer<typeof suggestTagsSchema>;\nexport type AnalyzePatternsRequest = z.infer<typeof analyzePatternsSchema>;\nexport type IntelligenceHealthCheckRequest = z.infer<typeof intelligenceHealthCheckSchema>;\nexport type FindRelatedRequest = z.infer<typeof findRelatedSchema>;\nexport type DetectDuplicatesRequest = z.infer<typeof detectDuplicatesSchema>;\nexport type ExtractInsightsRequest = z.infer<typeof extractInsightsSchema>;\n\n// ========================================\n// Intelligence Feature Types (v2.0)\n// ========================================\n\n/**\n * Chunking strategies for content preprocessing\n */\nexport const CHUNKING_STRATEGIES = ['semantic', 'fixed-size', 'paragraph', 'sentence', 'code-block'] as const;\nexport type ChunkingStrategy = typeof CHUNKING_STRATEGIES[number];\n\n/**\n * Content types detected or specified\n */\nexport const CONTENT_TYPES = ['text', 'code', 'markdown', 'json', 'yaml'] as const;\nexport type ContentType = typeof CONTENT_TYPES[number];\n\n/**\n * A chunk of content from a memory entry\n */\nexport interface ContentChunk {\n  index: number;\n  content: string;\n  startChar: number;\n  endChar: number;\n  tokens: number;\n  metadata?: {\n    type: 'paragraph' | 'sentence' | 'code' | 'section';\n    isComplete: boolean;\n  };\n}\n\n/**\n * Extracted intelligence from memory content\n */\nexport interface MemoryIntelligence {\n  entities: string[];\n  keywords: string[];\n  language: string;\n  topics?: string[];\n  sentiment?: 'positive' | 'neutral' | 'negative';\n  complexity?: 'low' | 'medium' | 'high';\n}\n\n/**\n * Extended metadata with intelligence features\n */\nexport interface IntelligentMetadata extends Record<string, unknown> {\n  // Chunking information\n  chunks?: ContentChunk[];\n  total_chunks?: number;\n  chunking_strategy?: ChunkingStrategy;\n  last_rechunked_at?: string;\n\n  // Content intelligence\n  intelligence?: MemoryIntelligence;\n\n  // Content metadata\n  content_type?: ContentType;\n  language?: string;\n  tokens?: number;\n\n  // Custom metadata\n  source?: string;\n  priority?: 'high' | 'medium' | 'low';\n}\n\n/**\n * Preprocessing options for memory creation/update\n */\nexport interface PreprocessingOptions {\n  chunking?: {\n    strategy?: ChunkingStrategy;\n    maxChunkSize?: number;\n    overlap?: number;\n  };\n  cleanContent?: boolean;\n  extractMetadata?: boolean;\n}\n\n/**\n * Extended create memory request with preprocessing\n */\nexport interface CreateMemoryWithPreprocessingRequest extends CreateMemoryRequest {\n  preprocessing?: PreprocessingOptions;\n  metadata?: IntelligentMetadata;\n}\n\n/**\n * Extended update memory request with re-chunking\n */\nexport interface UpdateMemoryWithPreprocessingRequest extends UpdateMemoryRequest {\n  rechunk?: boolean;\n  regenerate_embedding?: boolean;\n}\n\n// ========================================\n// Enhanced Search Types\n// ========================================\n\n/**\n * Search modes for memory queries\n */\nexport const SEARCH_MODES = ['vector', 'text', 'hybrid'] as const;\nexport type SearchMode = typeof SEARCH_MODES[number];\n\n/**\n * A matching chunk from search results\n */\nexport interface MatchingChunk {\n  index: number;\n  content: string;\n  similarity: number;\n}\n\n/**\n * Enhanced search filters\n */\nexport interface SearchFilters {\n  tags?: string[];\n  project_id?: string;\n  topic_id?: string;\n  date_range?: {\n    from?: string;\n    to?: string;\n  };\n}\n\n/**\n * Enhanced search request with hybrid mode\n */\nexport interface EnhancedSearchRequest {\n  query: string;\n  type?: MemoryType;\n  threshold?: number;\n  limit?: number;\n  search_mode?: SearchMode;\n  filters?: SearchFilters;\n  include_chunks?: boolean;\n}\n\n/**\n * Enhanced search result with chunk matching\n */\nexport interface EnhancedMemorySearchResult extends MemorySearchResult {\n  text_rank?: number;\n  combined_score?: number;\n  matching_chunks?: MatchingChunk[];\n}\n\n/**\n * Enhanced search response\n */\nexport interface EnhancedSearchResponse {\n  results: EnhancedMemorySearchResult[];\n  total: number;\n  query: string;\n  search_mode: SearchMode;\n  threshold: number;\n  execution_time_ms: number;\n}\n\n// ========================================\n// Analytics Types\n// ========================================\n\n/**\n * Search analytics data point\n */\nexport interface SearchAnalyticsDataPoint {\n  date: string;\n  searches: number;\n  avg_results: number;\n  avg_time_ms: number;\n}\n\n/**\n * Popular query entry\n */\nexport interface PopularQuery {\n  query: string;\n  count: number;\n  avg_results: number;\n}\n\n/**\n * Search analytics response\n */\nexport interface SearchAnalytics {\n  total_searches: number;\n  avg_results_count: number;\n  avg_execution_time_ms: number;\n  search_types: {\n    vector: number;\n    text: number;\n    hybrid: number;\n  };\n  by_date: SearchAnalyticsDataPoint[];\n  popular_queries: PopularQuery[];\n}\n\n/**\n * Most accessed memory entry\n */\nexport interface MostAccessedMemory {\n  memory_id: string;\n  title: string;\n  access_count: number;\n  last_accessed: string;\n}\n\n/**\n * Hourly access data\n */\nexport interface HourlyAccess {\n  hour: number;\n  count: number;\n}\n\n/**\n * Access patterns response\n */\nexport interface AccessPatterns {\n  total_accesses: number;\n  by_type: {\n    read: number;\n    update: number;\n    delete: number;\n  };\n  by_method: {\n    api: number;\n    search: number;\n    direct: number;\n  };\n  most_accessed: MostAccessedMemory[];\n  access_by_hour: HourlyAccess[];\n}\n\n/**\n * Project memory count\n */\nexport interface ProjectMemoryCount {\n  project_id: string;\n  project_name: string;\n  count: number;\n}\n\n/**\n * Tag count entry\n */\nexport interface TagCount {\n  tag: string;\n  count: number;\n}\n\n/**\n * Extended memory statistics\n */\nexport interface ExtendedMemoryStats {\n  total_memories: number;\n  by_type: Record<MemoryType, number>;\n  by_project: ProjectMemoryCount[];\n  storage: {\n    total_size_mb: number;\n    avg_memory_size_kb: number;\n    total_chunks: number;\n  };\n  activity: {\n    created_today: number;\n    updated_today: number;\n    searched_today: number;\n  };\n  top_tags: TagCount[];\n}\n\n/**\n * Analytics date range filter\n */\nexport interface AnalyticsDateRange {\n  from?: string;\n  to?: string;\n  group_by?: 'day' | 'week' | 'month';\n}\n\n// ========================================\n// Validation Schemas for Intelligence\n// ========================================\n\nexport const preprocessingOptionsSchema = z.object({\n  chunking: z.object({\n    strategy: z.enum(CHUNKING_STRATEGIES).optional(),\n    maxChunkSize: z.number().int().min(100).max(10000).optional(),\n    overlap: z.number().int().min(0).max(500).optional()\n  }).optional(),\n  cleanContent: z.boolean().optional(),\n  extractMetadata: z.boolean().optional()\n}).optional();\n\nexport const enhancedSearchSchema = z.object({\n  query: z.string().min(1).max(1000),\n  type: z.enum(MEMORY_TYPES).optional(),\n  threshold: z.number().min(0).max(1).default(0.7),\n  limit: z.number().int().min(1).max(100).default(20),\n  search_mode: z.enum(SEARCH_MODES).default('hybrid'),\n  filters: z.object({\n    tags: z.array(z.string()).optional(),\n    project_id: z.string().uuid().optional(),\n    topic_id: z.string().uuid().optional(),\n    date_range: z.object({\n      from: z.string().optional(),\n      to: z.string().optional()\n    }).optional()\n  }).optional(),\n  include_chunks: z.boolean().default(false)\n});\n\nexport const analyticsDateRangeSchema = z.object({\n  from: z.string().optional(),\n  to: z.string().optional(),\n  group_by: z.enum(['day', 'week', 'month']).default('day')\n});\n","/**\n * Core Utilities for Memory Client\n * Browser-safe, no Node.js dependencies\n */\n\nimport type { ApiErrorResponse, ErrorCode } from './errors';\n\n/**\n * Safe JSON parse result - discriminated union for type-safe error handling\n */\nexport type SafeJsonResult<T> =\n  | { success: true; data: T }\n  | { success: false; error: string };\n\n/**\n * Safely parse JSON with detailed error reporting\n * Prevents scattered try/catch blocks throughout the codebase\n */\nexport function safeJsonParse<T = unknown>(input: string): SafeJsonResult<T> {\n  try {\n    const data = JSON.parse(input) as T;\n    return { success: true, data };\n  } catch (error) {\n    const message = error instanceof Error\n      ? error.message\n      : 'Unknown JSON parse error';\n    return { success: false, error: `Invalid JSON: ${message}` };\n  }\n}\n\n/**\n * HTTP status code to error code mapping\n */\nexport function httpStatusToErrorCode(status: number): ErrorCode {\n  switch (status) {\n    case 400:\n      return 'VALIDATION_ERROR';\n    case 401:\n      return 'AUTH_ERROR';\n    case 403:\n      return 'FORBIDDEN';\n    case 404:\n      return 'NOT_FOUND';\n    case 408:\n      return 'TIMEOUT_ERROR';\n    case 409:\n      return 'CONFLICT';\n    case 429:\n      return 'RATE_LIMIT_ERROR';\n    case 500:\n    case 502:\n    case 503:\n    case 504:\n      return 'SERVER_ERROR';\n    default:\n      return 'API_ERROR';\n  }\n}\n\n/**\n * Create a standardized error response from various error sources\n */\nexport function createErrorResponse(\n  message: string,\n  code: ErrorCode = 'API_ERROR',\n  statusCode?: number,\n  details?: unknown\n): ApiErrorResponse {\n  return {\n    code,\n    message,\n    statusCode,\n    details,\n    timestamp: new Date().toISOString()\n  };\n}\n\n/**\n * Create an error response from an HTTP response\n */\nexport function createErrorFromResponse(\n  status: number,\n  statusText: string,\n  body?: unknown\n): ApiErrorResponse {\n  const code = httpStatusToErrorCode(status);\n\n  // Try to extract message from response body\n  let message = `HTTP ${status}: ${statusText}`;\n  let details: unknown = undefined;\n\n  if (body && typeof body === 'object') {\n    const bodyObj = body as Record<string, unknown>;\n    if (typeof bodyObj.error === 'string') {\n      message = bodyObj.error;\n    } else if (typeof bodyObj.message === 'string') {\n      message = bodyObj.message;\n    }\n    if (bodyObj.details) {\n      details = bodyObj.details;\n    }\n  }\n\n  return createErrorResponse(message, code, status, details);\n}\n\n/**\n * Sleep utility for retry logic\n */\nexport function sleep(ms: number): Promise<void> {\n  return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n/**\n * Calculate retry delay with exponential backoff and jitter\n */\nexport function calculateRetryDelay(\n  attempt: number,\n  baseDelay: number = 1000,\n  backoff: 'linear' | 'exponential' = 'exponential',\n  maxDelay: number = 30000\n): number {\n  let delay: number;\n\n  if (backoff === 'exponential') {\n    delay = baseDelay * Math.pow(2, attempt);\n  } else {\n    delay = baseDelay * (attempt + 1);\n  }\n\n  // Add jitter (±20%) to prevent thundering herd\n  const jitter = delay * 0.2 * (Math.random() * 2 - 1);\n  delay = Math.min(delay + jitter, maxDelay);\n\n  return Math.round(delay);\n}\n\n/**\n * Check if an error is retryable based on status code\n */\nexport function isRetryableError(statusCode?: number): boolean {\n  if (!statusCode) return true; // Network errors are retryable\n\n  // Retry on server errors and rate limits\n  return statusCode >= 500 || statusCode === 429 || statusCode === 408;\n}\n\n/**\n * Deep merge two objects\n */\nexport function deepMerge<T extends Record<string, unknown>>(\n  target: T,\n  source: Partial<T>\n): T {\n  const result = { ...target };\n\n  for (const key of Object.keys(source) as Array<keyof T>) {\n    const sourceValue = source[key];\n    const targetValue = result[key];\n\n    if (\n      sourceValue !== undefined &&\n      typeof sourceValue === 'object' &&\n      sourceValue !== null &&\n      !Array.isArray(sourceValue) &&\n      typeof targetValue === 'object' &&\n      targetValue !== null &&\n      !Array.isArray(targetValue)\n    ) {\n      result[key] = deepMerge(\n        targetValue as Record<string, unknown>,\n        sourceValue as Record<string, unknown>\n      ) as T[keyof T];\n    } else if (sourceValue !== undefined) {\n      result[key] = sourceValue as T[keyof T];\n    }\n  }\n\n  return result;\n}\n","/**\n * Core Memory Client - Pure Browser-Safe Implementation\n *\n * NO Node.js dependencies, NO CLI code, NO child_process\n * Works in: Browser, React Native, Cloudflare Workers, Edge Functions, Deno, Bun\n *\n * Bundle size: ~15KB gzipped\n */\n\nimport type {\n  MemoryEntry,\n  MemoryTopic,\n  CreateMemoryRequest,\n  UpdateMemoryRequest,\n  SearchMemoryRequest,\n  CreateTopicRequest,\n  MemorySearchResult,\n  UserMemoryStats,\n  // Intelligence types\n  EnhancedSearchRequest,\n  EnhancedSearchResponse,\n  SearchAnalytics,\n  AccessPatterns,\n  ExtendedMemoryStats,\n  AnalyticsDateRange,\n  CreateMemoryWithPreprocessingRequest,\n  UpdateMemoryWithPreprocessingRequest\n} from './types';\n\nimport {\n  createMemorySchema,\n  updateMemorySchema,\n  searchMemorySchema,\n  createTopicSchema,\n  enhancedSearchSchema,\n  analyticsDateRangeSchema\n} from './types';\n\nimport type { ApiErrorResponse } from './errors';\nimport {\n  createErrorResponse,\n  createErrorFromResponse,\n  sleep,\n  calculateRetryDelay,\n  isRetryableError\n} from './utils';\n\n/**\n * Configuration options for the Memory Client\n */\nexport interface CoreMemoryClientConfig {\n  /** API endpoint URL */\n  apiUrl: string;\n  /** API key for authentication */\n  apiKey?: string;\n  /** Bearer token for authentication (alternative to API key) */\n  authToken?: string;\n  /** Organization ID (optional - will be auto-resolved if not provided) */\n  organizationId?: string;\n  /** User ID (optional - used as fallback for organization ID) */\n  userId?: string;\n  /** Request timeout in milliseconds (default: 30000) */\n  timeout?: number;\n  /** Custom headers to include with requests */\n  headers?: Record<string, string>;\n\n  // Advanced options (all optional)\n  /** Retry configuration */\n  retry?: {\n    maxRetries?: number;\n    retryDelay?: number;\n    backoff?: 'linear' | 'exponential';\n  };\n  /** Cache configuration (browser only) */\n  cache?: {\n    enabled?: boolean;\n    ttl?: number;\n  };\n\n  // Hooks for custom behavior\n  /** Called when an error occurs */\n  onError?: (error: ApiErrorResponse) => void;\n  /** Called before each request */\n  onRequest?: (endpoint: string) => void;\n  /** Called after each response */\n  onResponse?: (endpoint: string, duration: number) => void;\n}\n\n/**\n * Standard API response wrapper with typed errors\n * Replaces string errors with structured ApiErrorResponse\n */\nexport interface ApiResponse<T> {\n  data?: T;\n  /** Structured error response for programmatic handling */\n  error?: ApiErrorResponse;\n  /** Optional success message */\n  message?: string;\n  /** Request metadata */\n  meta?: {\n    requestId?: string;\n    duration?: number;\n    retries?: number;\n  };\n}\n\n/**\n * Helper to check if response has error\n */\nexport function hasError<T>(response: ApiResponse<T>): response is ApiResponse<T> & { error: ApiErrorResponse } {\n  return response.error !== undefined;\n}\n\n/**\n * Helper to check if response has data\n */\nexport function hasData<T>(response: ApiResponse<T>): response is ApiResponse<T> & { data: T } {\n  return response.data !== undefined;\n}\n\n/**\n * Paginated response for list operations\n */\nexport interface PaginatedResponse<T> {\n  data: T[];\n  pagination: {\n    page: number;\n    limit: number;\n    total: number;\n    pages: number;\n  };\n}\n\n/**\n * Core Memory Client class for interacting with the Memory as a Service API\n *\n * This is a pure browser-safe client with zero Node.js dependencies.\n * It uses only standard web APIs (fetch, AbortController, etc.)\n */\nexport class CoreMemoryClient {\n  private config: Required<Omit<CoreMemoryClientConfig, 'apiKey' | 'authToken' | 'organizationId' | 'userId' | 'headers' | 'retry' | 'cache' | 'onError' | 'onRequest' | 'onResponse'>> &\n    Pick<CoreMemoryClientConfig, 'apiKey' | 'authToken' | 'organizationId' | 'userId' | 'headers' | 'retry' | 'cache' | 'onError' | 'onRequest' | 'onResponse'>;\n  private baseHeaders: Record<string, string>;\n\n  constructor(config: CoreMemoryClientConfig) {\n    this.config = {\n      timeout: 30000,\n      ...config\n    };\n\n    this.baseHeaders = {\n      'Content-Type': 'application/json',\n      'User-Agent': '@lanonasis/memory-client/2.0.0',\n      'X-Project-Scope': 'lanonasis-maas',  // Required by backend auth middleware\n      ...config.headers\n    };\n\n    // Set authentication headers\n    if (config.authToken) {\n      this.baseHeaders['Authorization'] = `Bearer ${config.authToken}`;\n    } else if (config.apiKey) {\n      this.baseHeaders['X-API-Key'] = config.apiKey;\n    }\n\n    // Add organization ID header if provided\n    if (config.organizationId) {\n      this.baseHeaders['X-Organization-ID'] = config.organizationId;\n    }\n  }\n\n  /**\n   * Enrich request body with organization context if configured\n   * This ensures the API has the organization_id even if not in auth token\n   */\n  private enrichWithOrgContext<T extends Record<string, unknown>>(body: T): T {\n    // If organizationId is configured, include it in the request body\n    if (this.config.organizationId && !body.organization_id) {\n      return {\n        ...body,\n        organization_id: this.config.organizationId\n      };\n    }\n    // Fallback to userId if no organizationId configured\n    if (!this.config.organizationId && this.config.userId && !body.organization_id) {\n      return {\n        ...body,\n        organization_id: this.config.userId\n      };\n    }\n    return body;\n  }\n\n  /**\n   * Make an HTTP request to the API with retry support\n   */\n  private async request<T>(\n    endpoint: string,\n    options: RequestInit = {}\n  ): Promise<ApiResponse<T>> {\n    const startTime = Date.now();\n    const maxRetries = this.config.retry?.maxRetries ?? 3;\n    const baseDelay = this.config.retry?.retryDelay ?? 1000;\n    const backoff = this.config.retry?.backoff ?? 'exponential';\n\n    // Call onRequest hook if provided\n    if (this.config.onRequest) {\n      try {\n        this.config.onRequest(endpoint);\n      } catch (error) {\n        console.warn('onRequest hook error:', error);\n      }\n    }\n\n    // Handle gateway vs direct API URL formatting\n    const baseUrl = this.config.apiUrl.includes('/api')\n      ? this.config.apiUrl.replace('/api', '')\n      : this.config.apiUrl;\n\n    const url = `${baseUrl}/api/v1${endpoint}`;\n\n    let lastError: ApiErrorResponse | undefined;\n    let attempt = 0;\n\n    while (attempt <= maxRetries) {\n      try {\n        const controller = new AbortController();\n        const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);\n\n        const response = await fetch(url, {\n          headers: { ...this.baseHeaders, ...options.headers },\n          signal: controller.signal,\n          ...options,\n        });\n\n        clearTimeout(timeoutId);\n\n        let data: T;\n        const contentType = response.headers.get('content-type');\n\n        if (contentType && contentType.includes('application/json')) {\n          data = await response.json() as T;\n        } else {\n          data = await response.text() as unknown as T;\n        }\n\n        if (!response.ok) {\n          const error = createErrorFromResponse(response.status, response.statusText, data);\n\n          // Only retry on retryable errors (5xx, 429, 408)\n          if (isRetryableError(response.status) && attempt < maxRetries) {\n            lastError = error;\n            const delay = calculateRetryDelay(attempt, baseDelay, backoff);\n            await sleep(delay);\n            attempt++;\n            continue;\n          }\n\n          // Call onError hook if provided\n          if (this.config.onError) {\n            try {\n              this.config.onError(error);\n            } catch (hookError) {\n              console.warn('onError hook error:', hookError);\n            }\n          }\n\n          return { error, meta: { duration: Date.now() - startTime, retries: attempt } };\n        }\n\n        // Call onResponse hook if provided\n        if (this.config.onResponse) {\n          try {\n            const duration = Date.now() - startTime;\n            this.config.onResponse(endpoint, duration);\n          } catch (error) {\n            console.warn('onResponse hook error:', error);\n          }\n        }\n\n        return { data, meta: { duration: Date.now() - startTime, retries: attempt } };\n\n      } catch (error) {\n        if (error instanceof Error && error.name === 'AbortError') {\n          const timeoutError = createErrorResponse('Request timeout', 'TIMEOUT_ERROR', 408);\n\n          // Retry on timeout\n          if (attempt < maxRetries) {\n            lastError = timeoutError;\n            const delay = calculateRetryDelay(attempt, baseDelay, backoff);\n            await sleep(delay);\n            attempt++;\n            continue;\n          }\n\n          if (this.config.onError) {\n            try {\n              this.config.onError(timeoutError);\n            } catch (hookError) {\n              console.warn('onError hook error:', hookError);\n            }\n          }\n\n          return { error: timeoutError, meta: { duration: Date.now() - startTime, retries: attempt } };\n        }\n\n        const networkError = createErrorResponse(\n          error instanceof Error ? error.message : 'Network error',\n          'NETWORK_ERROR'\n        );\n\n        // Retry on network errors\n        if (attempt < maxRetries) {\n          lastError = networkError;\n          const delay = calculateRetryDelay(attempt, baseDelay, backoff);\n          await sleep(delay);\n          attempt++;\n          continue;\n        }\n\n        if (this.config.onError) {\n          try {\n            this.config.onError(networkError);\n          } catch (hookError) {\n            console.warn('onError hook error:', hookError);\n          }\n        }\n\n        return { error: networkError, meta: { duration: Date.now() - startTime, retries: attempt } };\n      }\n    }\n\n    // Should never reach here, but handle it gracefully\n    return {\n      error: lastError ?? createErrorResponse('Max retries exceeded', 'API_ERROR'),\n      meta: { duration: Date.now() - startTime, retries: attempt }\n    };\n  }\n\n  /**\n   * Validate input using Zod schema and return validation error if invalid\n   */\n  private validateInput<T>(\n    schema: { safeParse: (data: unknown) => { success: boolean; error?: unknown; data?: T } },\n    data: unknown\n  ): ApiResponse<T> | null {\n    const result = schema.safeParse(data);\n    if (!result.success) {\n      // Extract error details from Zod error\n      const zodError = result.error as { issues?: Array<{ path: PropertyKey[]; message: string }> } | undefined;\n      const details = zodError?.issues?.map(issue => ({\n        field: issue.path.map(String).join('.'),\n        message: issue.message\n      })) ?? [];\n\n      return {\n        error: createErrorResponse(\n          'Validation failed',\n          'VALIDATION_ERROR',\n          400,\n          details\n        )\n      };\n    }\n    return null;\n  }\n\n  /**\n   * Test the API connection and authentication\n   */\n  async healthCheck(): Promise<ApiResponse<{ status: string; timestamp: string }>> {\n    return this.request('/health');\n  }\n\n  // Memory Operations\n\n  /**\n   * Create a new memory with validation\n   */\n  async createMemory(memory: CreateMemoryRequest): Promise<ApiResponse<MemoryEntry>> {\n    // Validate input before making request\n    const validationError = this.validateInput(createMemorySchema, memory);\n    if (validationError) {\n      return { error: validationError.error };\n    }\n\n    const enrichedMemory = this.enrichWithOrgContext(memory as Record<string, unknown>);\n    return this.request<MemoryEntry>('/memory', {\n      method: 'POST',\n      body: JSON.stringify(enrichedMemory)\n    });\n  }\n\n  /**\n   * Get a memory by ID\n   */\n  async getMemory(id: string): Promise<ApiResponse<MemoryEntry>> {\n    return this.request<MemoryEntry>(`/memory/${encodeURIComponent(id)}`);\n  }\n\n  /**\n   * Update an existing memory with validation\n   */\n  async updateMemory(id: string, updates: UpdateMemoryRequest): Promise<ApiResponse<MemoryEntry>> {\n    // Validate input before making request\n    const validationError = this.validateInput(updateMemorySchema, updates);\n    if (validationError) {\n      return { error: validationError.error };\n    }\n\n    return this.request<MemoryEntry>(`/memory/${encodeURIComponent(id)}`, {\n      method: 'PUT',\n      body: JSON.stringify(updates)\n    });\n  }\n\n  /**\n   * Delete a memory\n   */\n  async deleteMemory(id: string): Promise<ApiResponse<void>> {\n    return this.request<void>(`/memory/${encodeURIComponent(id)}`, {\n      method: 'DELETE'\n    });\n  }\n\n  /**\n   * List memories with optional filtering and pagination\n   */\n  async listMemories(options: {\n    page?: number;\n    limit?: number;\n    memory_type?: string;\n    topic_id?: string;\n    project_ref?: string;\n    status?: string;\n    tags?: string[];\n    sort?: string;\n    order?: 'asc' | 'desc';\n  } = {}): Promise<ApiResponse<PaginatedResponse<MemoryEntry>>> {\n    const params = new URLSearchParams();\n\n    Object.entries(options).forEach(([key, value]) => {\n      if (value !== undefined && value !== null) {\n        if (Array.isArray(value)) {\n          params.append(key, value.join(','));\n        } else {\n          params.append(key, String(value));\n        }\n      }\n    });\n\n    const queryString = params.toString();\n    const endpoint = queryString ? `/memory?${queryString}` : '/memory';\n\n    return this.request<PaginatedResponse<MemoryEntry>>(endpoint);\n  }\n\n  /**\n   * Search memories using semantic search with validation\n   */\n  async searchMemories(request: SearchMemoryRequest): Promise<ApiResponse<{\n    results: MemorySearchResult[];\n    total_results: number;\n    search_time_ms: number;\n  }>> {\n    // Validate input before making request\n    const validationError = this.validateInput(searchMemorySchema, request);\n    if (validationError) {\n      // Return error response (data will be undefined, only error is set)\n      return { error: validationError.error };\n    }\n\n    const enrichedRequest = this.enrichWithOrgContext(request as Record<string, unknown>);\n    return this.request('/memory/search', {\n      method: 'POST',\n      body: JSON.stringify(enrichedRequest)\n    });\n  }\n\n  /**\n   * Bulk delete multiple memories\n   */\n  async bulkDeleteMemories(memoryIds: string[]): Promise<ApiResponse<{\n    deleted_count: number;\n    failed_ids: string[];\n  }>> {\n    const enrichedRequest = this.enrichWithOrgContext({ memory_ids: memoryIds });\n    return this.request('/memory/bulk/delete', {\n      method: 'POST',\n      body: JSON.stringify(enrichedRequest)\n    });\n  }\n\n  // Topic Operations\n\n  /**\n   * Create a new topic with validation\n   */\n  async createTopic(topic: CreateTopicRequest): Promise<ApiResponse<MemoryTopic>> {\n    // Validate input before making request\n    const validationError = this.validateInput(createTopicSchema, topic);\n    if (validationError) {\n      return { error: validationError.error };\n    }\n\n    const enrichedTopic = this.enrichWithOrgContext(topic as Record<string, unknown>);\n    return this.request<MemoryTopic>('/topics', {\n      method: 'POST',\n      body: JSON.stringify(enrichedTopic)\n    });\n  }\n\n  /**\n   * Get all topics\n   */\n  async getTopics(): Promise<ApiResponse<MemoryTopic[]>> {\n    return this.request<MemoryTopic[]>('/topics');\n  }\n\n  /**\n   * Get a topic by ID\n   */\n  async getTopic(id: string): Promise<ApiResponse<MemoryTopic>> {\n    return this.request<MemoryTopic>(`/topics/${encodeURIComponent(id)}`);\n  }\n\n  /**\n   * Update a topic\n   */\n  async updateTopic(id: string, updates: Partial<CreateTopicRequest>): Promise<ApiResponse<MemoryTopic>> {\n    return this.request<MemoryTopic>(`/topics/${encodeURIComponent(id)}`, {\n      method: 'PUT',\n      body: JSON.stringify(updates)\n    });\n  }\n\n  /**\n   * Delete a topic\n   */\n  async deleteTopic(id: string): Promise<ApiResponse<void>> {\n    return this.request<void>(`/topics/${encodeURIComponent(id)}`, {\n      method: 'DELETE'\n    });\n  }\n\n  /**\n   * Get user memory statistics\n   */\n  async getMemoryStats(): Promise<ApiResponse<UserMemoryStats>> {\n    return this.request<UserMemoryStats>('/memory/stats');\n  }\n\n  // ========================================\n  // Intelligence Features (v2.0)\n  // ========================================\n\n  /**\n   * Create a memory with preprocessing options (chunking, intelligence extraction)\n   *\n   * @example\n   * ```typescript\n   * const result = await client.createMemoryWithPreprocessing({\n   *   title: 'Auth System Docs',\n   *   content: 'Long content...',\n   *   memory_type: 'knowledge',\n   *   preprocessing: {\n   *     chunking: { strategy: 'semantic', maxChunkSize: 1000 },\n   *     extractMetadata: true\n   *   }\n   * });\n   * ```\n   */\n  async createMemoryWithPreprocessing(\n    memory: CreateMemoryWithPreprocessingRequest\n  ): Promise<ApiResponse<MemoryEntry>> {\n    // Validate base memory fields\n    const validationError = this.validateInput(createMemorySchema, memory);\n    if (validationError) {\n      return { error: validationError.error };\n    }\n\n    const enrichedMemory = this.enrichWithOrgContext(memory as unknown as Record<string, unknown>);\n    return this.request<MemoryEntry>('/memory', {\n      method: 'POST',\n      body: JSON.stringify(enrichedMemory)\n    });\n  }\n\n  /**\n   * Update a memory with re-chunking and embedding regeneration\n   *\n   * @example\n   * ```typescript\n   * const result = await client.updateMemoryWithPreprocessing('mem_123', {\n   *   content: 'Updated content...',\n   *   rechunk: true,\n   *   regenerate_embedding: true\n   * });\n   * ```\n   */\n  async updateMemoryWithPreprocessing(\n    id: string,\n    updates: UpdateMemoryWithPreprocessingRequest\n  ): Promise<ApiResponse<MemoryEntry>> {\n    const validationError = this.validateInput(updateMemorySchema, updates);\n    if (validationError) {\n      return { error: validationError.error };\n    }\n\n    return this.request<MemoryEntry>(`/memory/${encodeURIComponent(id)}`, {\n      method: 'PUT',\n      body: JSON.stringify(updates)\n    });\n  }\n\n  /**\n   * Enhanced semantic search with hybrid mode (vector + text)\n   *\n   * @example\n   * ```typescript\n   * const result = await client.enhancedSearch({\n   *   query: 'authentication flow',\n   *   search_mode: 'hybrid',\n   *   filters: { tags: ['auth'], project_id: 'proj_123' },\n   *   include_chunks: true\n   * });\n   * ```\n   */\n  async enhancedSearch(\n    request: EnhancedSearchRequest\n  ): Promise<ApiResponse<EnhancedSearchResponse>> {\n    const validationError = this.validateInput(enhancedSearchSchema, request);\n    if (validationError) {\n      return { error: validationError.error };\n    }\n\n    const enrichedRequest = this.enrichWithOrgContext(request as unknown as Record<string, unknown>);\n    return this.request<EnhancedSearchResponse>('/memory/search', {\n      method: 'POST',\n      body: JSON.stringify(enrichedRequest)\n    });\n  }\n\n  // ========================================\n  // Analytics Operations\n  // ========================================\n\n  /**\n   * Get search analytics data\n   *\n   * @example\n   * ```typescript\n   * const analytics = await client.getSearchAnalytics({\n   *   from: '2025-01-01',\n   *   to: '2025-12-31',\n   *   group_by: 'day'\n   * });\n   * ```\n   */\n  async getSearchAnalytics(\n    options: AnalyticsDateRange = {}\n  ): Promise<ApiResponse<SearchAnalytics>> {\n    const validationError = this.validateInput(analyticsDateRangeSchema, options);\n    if (validationError) {\n      return { error: validationError.error };\n    }\n\n    const params = new URLSearchParams();\n    if (options.from) params.append('from', options.from);\n    if (options.to) params.append('to', options.to);\n    if (options.group_by) params.append('group_by', options.group_by);\n\n    const queryString = params.toString();\n    const endpoint = queryString ? `/analytics/search?${queryString}` : '/analytics/search';\n\n    return this.request<SearchAnalytics>(endpoint);\n  }\n\n  /**\n   * Get memory access patterns\n   *\n   * @example\n   * ```typescript\n   * const patterns = await client.getAccessPatterns({\n   *   from: '2025-01-01',\n   *   to: '2025-12-31'\n   * });\n   * console.log(patterns.data?.most_accessed);\n   * ```\n   */\n  async getAccessPatterns(\n    options: AnalyticsDateRange = {}\n  ): Promise<ApiResponse<AccessPatterns>> {\n    const params = new URLSearchParams();\n    if (options.from) params.append('from', options.from);\n    if (options.to) params.append('to', options.to);\n\n    const queryString = params.toString();\n    const endpoint = queryString ? `/analytics/access?${queryString}` : '/analytics/access';\n\n    return this.request<AccessPatterns>(endpoint);\n  }\n\n  /**\n   * Get extended memory statistics with storage and activity metrics\n   *\n   * @example\n   * ```typescript\n   * const stats = await client.getExtendedStats();\n   * console.log(`Total chunks: ${stats.data?.storage.total_chunks}`);\n   * console.log(`Created today: ${stats.data?.activity.created_today}`);\n   * ```\n   */\n  async getExtendedStats(): Promise<ApiResponse<ExtendedMemoryStats>> {\n    return this.request<ExtendedMemoryStats>('/analytics/stats');\n  }\n\n  /**\n   * Get topic with its memories\n   *\n   * @example\n   * ```typescript\n   * const topic = await client.getTopicWithMemories('topic_123');\n   * console.log(topic.data?.memories);\n   * ```\n   */\n  async getTopicWithMemories(\n    topicId: string,\n    options: { limit?: number; offset?: number } = {}\n  ): Promise<ApiResponse<{\n    topic: MemoryTopic;\n    memories: MemoryEntry[];\n    total_memories: number;\n    subtopics: Array<{ id: string; name: string; memory_count: number }>;\n  }>> {\n    const params = new URLSearchParams();\n    if (options.limit) params.append('limit', String(options.limit));\n    if (options.offset) params.append('offset', String(options.offset));\n\n    const queryString = params.toString();\n    const endpoint = queryString\n      ? `/topics/${encodeURIComponent(topicId)}/memories?${queryString}`\n      : `/topics/${encodeURIComponent(topicId)}/memories`;\n\n    return this.request(endpoint);\n  }\n\n  /**\n   * Get topics in hierarchical structure\n   *\n   * @example\n   * ```typescript\n   * const topics = await client.getTopicsHierarchy();\n   * // Returns nested topic tree with children\n   * ```\n   */\n  async getTopicsHierarchy(): Promise<ApiResponse<Array<MemoryTopic & {\n    children: MemoryTopic[];\n    memory_count: number;\n  }>>> {\n    return this.request('/topics?include_hierarchy=true');\n  }\n\n  // Utility Methods\n\n  /**\n   * Update authentication token\n   */\n  setAuthToken(token: string): void {\n    this.baseHeaders['Authorization'] = `Bearer ${token}`;\n    delete this.baseHeaders['X-API-Key'];\n  }\n\n  /**\n   * Update API key\n   */\n  setApiKey(apiKey: string): void {\n    this.baseHeaders['X-API-Key'] = apiKey;\n    delete this.baseHeaders['Authorization'];\n  }\n\n  /**\n   * Clear authentication\n   */\n  clearAuth(): void {\n    delete this.baseHeaders['Authorization'];\n    delete this.baseHeaders['X-API-Key'];\n  }\n\n  /**\n   * Update configuration\n   */\n  updateConfig(updates: Partial<CoreMemoryClientConfig>): void {\n    this.config = { ...this.config, ...updates };\n\n    if (updates.headers) {\n      this.baseHeaders = { ...this.baseHeaders, ...updates.headers };\n    }\n  }\n\n  /**\n   * Get current configuration (excluding sensitive data)\n   */\n  getConfig(): Omit<CoreMemoryClientConfig, 'apiKey' | 'authToken'> {\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\n    const { apiKey, authToken, ...safeConfig } = this.config;\n    return safeConfig;\n  }\n}\n\n/**\n * Factory function to create a new Core Memory Client instance\n */\nexport function createMemoryClient(config: CoreMemoryClientConfig): CoreMemoryClient {\n  return new CoreMemoryClient(config);\n}\n","/**\n * Error handling for Memory Client\n * Browser-safe, no Node.js dependencies\n */\n\n/**\n * Standardized error codes for programmatic error handling\n */\nexport const ERROR_CODES = [\n  'API_ERROR',\n  'AUTH_ERROR',\n  'VALIDATION_ERROR',\n  'TIMEOUT_ERROR',\n  'RATE_LIMIT_ERROR',\n  'NOT_FOUND',\n  'NETWORK_ERROR',\n  'FORBIDDEN',\n  'CONFLICT',\n  'SERVER_ERROR'\n] as const;\n\nexport type ErrorCode = typeof ERROR_CODES[number];\n\n/**\n * Structured API error response - replaces plain string errors\n * Enables programmatic error handling with typed codes\n */\nexport interface ApiErrorResponse {\n  /** Machine-readable error code for programmatic handling */\n  code: ErrorCode;\n  /** Human-readable error message */\n  message: string;\n  /** HTTP status code if from API response */\n  statusCode?: number;\n  /** Additional error details (validation errors, etc.) */\n  details?: unknown;\n  /** Request ID for debugging/support */\n  requestId?: string;\n  /** Timestamp when error occurred */\n  timestamp?: string;\n}\n\n/**\n * Type guard to check if an object is an ApiErrorResponse\n */\nexport function isApiErrorResponse(value: unknown): value is ApiErrorResponse {\n  return (\n    typeof value === 'object' &&\n    value !== null &&\n    'code' in value &&\n    'message' in value &&\n    typeof (value as ApiErrorResponse).code === 'string' &&\n    typeof (value as ApiErrorResponse).message === 'string'\n  );\n}\n\n/**\n * Base error class for Memory Client errors\n */\nexport class MemoryClientError extends Error {\n  constructor(\n    message: string,\n    public code: ErrorCode = 'API_ERROR',\n    public statusCode?: number,\n    public details?: unknown\n  ) {\n    super(message);\n    this.name = 'MemoryClientError';\n\n    // Maintains proper stack trace for where our error was thrown (only available on V8)\n    if (Error.captureStackTrace) {\n      Error.captureStackTrace(this, MemoryClientError);\n    }\n  }\n\n  /**\n   * Convert to ApiErrorResponse for consistent API responses\n   */\n  toResponse(): ApiErrorResponse {\n    return {\n      code: this.code,\n      message: this.message,\n      statusCode: this.statusCode,\n      details: this.details,\n      timestamp: new Date().toISOString()\n    };\n  }\n}\n\n/**\n * Network/API error\n */\nexport class ApiError extends MemoryClientError {\n  constructor(message: string, statusCode?: number, details?: unknown) {\n    super(message, 'API_ERROR', statusCode, details);\n    this.name = 'ApiError';\n  }\n\n  /**\n   * Create from an HTTP response\n   */\n  static fromResponse(status: number, statusText: string, body?: unknown): ApiError {\n    let message = `HTTP ${status}: ${statusText}`;\n    let details: unknown = undefined;\n\n    if (body && typeof body === 'object') {\n      const bodyObj = body as Record<string, unknown>;\n      if (typeof bodyObj.error === 'string') {\n        message = bodyObj.error;\n      } else if (typeof bodyObj.message === 'string') {\n        message = bodyObj.message;\n      }\n      if (bodyObj.details) {\n        details = bodyObj.details;\n      }\n    }\n\n    return new ApiError(message, status, details);\n  }\n}\n\n/**\n * Authentication error\n */\nexport class AuthenticationError extends MemoryClientError {\n  constructor(message: string = 'Authentication required') {\n    super(message, 'AUTH_ERROR', 401);\n    this.name = 'AuthenticationError';\n  }\n}\n\n/**\n * Validation error with field-level details\n */\nexport class ValidationError extends MemoryClientError {\n  public readonly validationErrors: Array<{ field: string; message: string }>;\n\n  constructor(message: string, details?: unknown) {\n    super(message, 'VALIDATION_ERROR', 400, details);\n    this.name = 'ValidationError';\n\n    // Parse validation details into field errors\n    this.validationErrors = [];\n    if (Array.isArray(details)) {\n      this.validationErrors = details.filter(\n        (item): item is { field: string; message: string } =>\n          typeof item === 'object' &&\n          item !== null &&\n          typeof item.field === 'string' &&\n          typeof item.message === 'string'\n      );\n    }\n  }\n\n  /**\n   * Create from Zod error\n   */\n  static fromZodError(error: { issues: Array<{ path: (string | number)[]; message: string }> }): ValidationError {\n    const details = error.issues.map(issue => ({\n      field: issue.path.join('.'),\n      message: issue.message\n    }));\n    return new ValidationError('Validation failed', details);\n  }\n}\n\n/**\n * Timeout error\n */\nexport class TimeoutError extends MemoryClientError {\n  constructor(message: string = 'Request timeout') {\n    super(message, 'TIMEOUT_ERROR', 408);\n    this.name = 'TimeoutError';\n  }\n}\n\n/**\n * Rate limit error with retry-after info\n */\nexport class RateLimitError extends MemoryClientError {\n  public readonly retryAfter?: number;\n\n  constructor(message: string = 'Rate limit exceeded', retryAfter?: number) {\n    super(message, 'RATE_LIMIT_ERROR', 429, { retryAfter });\n    this.name = 'RateLimitError';\n    this.retryAfter = retryAfter;\n  }\n}\n\n/**\n * Not found error\n */\nexport class NotFoundError extends MemoryClientError {\n  public readonly resource: string;\n\n  constructor(resource: string) {\n    super(`${resource} not found`, 'NOT_FOUND', 404);\n    this.name = 'NotFoundError';\n    this.resource = resource;\n  }\n}\n\n/**\n * Network error (no response received)\n */\nexport class NetworkError extends MemoryClientError {\n  constructor(message: string = 'Network error') {\n    super(message, 'NETWORK_ERROR');\n    this.name = 'NetworkError';\n  }\n}\n\n/**\n * Server error (5xx responses)\n */\nexport class ServerError extends MemoryClientError {\n  constructor(message: string, statusCode: number = 500) {\n    super(message, 'SERVER_ERROR', statusCode);\n    this.name = 'ServerError';\n  }\n}\n\n/**\n * Create appropriate error class from status code\n */\nexport function createErrorFromStatus(\n  status: number,\n  message: string,\n  details?: unknown\n): MemoryClientError {\n  switch (status) {\n    case 400:\n      return new ValidationError(message, details);\n    case 401:\n      return new AuthenticationError(message);\n    case 404:\n      return new NotFoundError(message);\n    case 408:\n      return new TimeoutError(message);\n    case 429:\n      return new RateLimitError(message);\n    case 500:\n    case 502:\n    case 503:\n    case 504:\n      return new ServerError(message, status);\n    default:\n      return new ApiError(message, status, details);\n  }\n}\n","/**\n * @lanonasis/memory-client\n *\n * Universal Memory as a Service (MaaS) Client SDK for Lanonasis\n * Intelligent memory management with semantic search capabilities\n *\n * v2.0.0 - Universal SDK Redesign\n * \"Drop In and Sleep\" Architecture - Works everywhere with zero configuration\n *\n * @example Browser/Web App\n * ```ts\n * import { createMemoryClient } from '@lanonasis/memory-client/core';\n * const client = createMemoryClient({ apiKey: 'your-key' });\n * ```\n *\n * @example Node.js\n * ```ts\n * import { createNodeMemoryClient } from '@lanonasis/memory-client/node';\n * const client = await createNodeMemoryClient({ apiKey: process.env.KEY });\n * ```\n *\n * @example React\n * ```tsx\n * import { MemoryProvider, useMemories } from '@lanonasis/memory-client/react';\n * ```\n *\n * @example Vue\n * ```ts\n * import { createMemoryPlugin, useMemories } from '@lanonasis/memory-client/vue';\n * ```\n */\n\n// ========================================\n// Internal Imports (for use in this file)\n// ========================================\nimport {\n  CoreMemoryClient as _CoreMemoryClient,\n  createMemoryClient as _createMemoryClient,\n  type CoreMemoryClientConfig as _CoreMemoryClientConfig\n} from './core/client';\n\n// ========================================\n// Core Exports (Browser-Safe)\n// ========================================\nexport { CoreMemoryClient, createMemoryClient, hasError, hasData } from './core/client';\nexport type {\n  CoreMemoryClientConfig,\n  ApiResponse,\n  PaginatedResponse\n} from './core/client';\n\n// ========================================\n// Utilities\n// ========================================\nexport {\n  safeJsonParse,\n  createErrorResponse,\n  httpStatusToErrorCode,\n  calculateRetryDelay,\n  isRetryableError\n} from './core/utils';\nexport type { SafeJsonResult } from './core/utils';\n\n// ========================================\n// Types (Shared)\n// ========================================\nexport type {\n  MemoryEntry,\n  MemoryTopic,\n  CreateMemoryRequest,\n  UpdateMemoryRequest,\n  SearchMemoryRequest,\n  CreateTopicRequest,\n  MemorySearchResult,\n  UserMemoryStats,\n  MemoryType,\n  MemoryStatus,\n  // Intelligence types (v2.0)\n  ChunkingStrategy,\n  ContentType,\n  ContentChunk,\n  MemoryIntelligence,\n  IntelligentMetadata,\n  PreprocessingOptions,\n  CreateMemoryWithPreprocessingRequest,\n  UpdateMemoryWithPreprocessingRequest,\n  // Enhanced search types\n  SearchMode,\n  MatchingChunk,\n  SearchFilters,\n  EnhancedSearchRequest,\n  EnhancedMemorySearchResult,\n  EnhancedSearchResponse,\n  // Analytics types\n  SearchAnalyticsDataPoint,\n  PopularQuery,\n  SearchAnalytics,\n  MostAccessedMemory,\n  HourlyAccess,\n  AccessPatterns,\n  ProjectMemoryCount,\n  TagCount,\n  ExtendedMemoryStats,\n  AnalyticsDateRange\n} from './core/types';\n\nexport {\n  MEMORY_TYPES,\n  MEMORY_STATUSES,\n  createMemorySchema,\n  updateMemorySchema,\n  searchMemorySchema,\n  createTopicSchema,\n  // Intelligence constants & schemas (v2.0)\n  CHUNKING_STRATEGIES,\n  CONTENT_TYPES,\n  SEARCH_MODES,\n  preprocessingOptionsSchema,\n  enhancedSearchSchema,\n  analyticsDateRangeSchema\n} from './core/types';\n\n// ========================================\n// Errors\n// ========================================\nexport {\n  MemoryClientError,\n  ApiError,\n  AuthenticationError,\n  ValidationError,\n  TimeoutError,\n  RateLimitError,\n  NotFoundError,\n  NetworkError,\n  ServerError,\n  createErrorFromStatus,\n  isApiErrorResponse,\n  ERROR_CODES\n} from './core/errors';\nexport type { ApiErrorResponse, ErrorCode } from './core/errors';\n\n// ========================================\n// Constants\n// ========================================\nexport const VERSION = '2.0.0';\nexport const CLIENT_NAME = '@lanonasis/memory-client';\n\n// ========================================\n// Environment Detection\n// ========================================\nexport const isBrowser = typeof window !== 'undefined';\nexport const isNode = typeof globalThis !== 'undefined' && 'process' in globalThis && globalThis.process?.versions?.node;\nexport const isEdge = !isBrowser && !isNode;\n\n/**\n * Detected runtime environment\n */\nexport type RuntimeEnvironment = 'browser' | 'node' | 'edge';\n\n/**\n * Get the current runtime environment\n */\nexport function getEnvironment(): RuntimeEnvironment {\n  if (isBrowser) return 'browser';\n  if (isNode) return 'node';\n  return 'edge';\n}\n\n// ========================================\n// Auto-Detecting Client Factory\n// ========================================\n\n/**\n * Configuration for the auto-detecting client factory\n */\nexport interface AutoClientConfig {\n  /** API endpoint URL (required) */\n  apiUrl: string;\n  /** API key for authentication */\n  apiKey?: string;\n  /** Bearer token for authentication */\n  authToken?: string;\n  /** Organization ID */\n  organizationId?: string;\n  /** Request timeout in milliseconds */\n  timeout?: number;\n  /** Custom headers */\n  headers?: Record<string, string>;\n  /** Retry configuration */\n  retry?: {\n    maxRetries?: number;\n    retryDelay?: number;\n    backoff?: 'linear' | 'exponential';\n  };\n  /** Node.js specific: prefer CLI when available */\n  preferCLI?: boolean;\n  /** Node.js specific: enable MCP channels */\n  enableMCP?: boolean;\n}\n\n/**\n * Auto-detecting client factory - \"Drop In and Sleep\" architecture\n *\n * Automatically detects the runtime environment and returns the appropriate client:\n * - Browser/Edge: Returns CoreMemoryClient (lightweight, browser-safe)\n * - Node.js: Returns EnhancedMemoryClient (with CLI/MCP support)\n *\n * @example\n * ```typescript\n * import { createClient } from '@lanonasis/memory-client';\n *\n * // Works in any environment!\n * const client = await createClient({\n *   apiUrl: 'https://api.lanonasis.com',\n *   apiKey: 'your-key'\n * });\n *\n * const memories = await client.listMemories();\n * ```\n */\nexport async function createClient(config: AutoClientConfig): Promise<_CoreMemoryClient> {\n  const environment = getEnvironment();\n\n  if (environment === 'node') {\n    try {\n      // Dynamic import for Node.js client to avoid bundling in browser\n      const { createNodeMemoryClient } = await import('./node/index');\n      return await createNodeMemoryClient({\n        ...config,\n        preferCLI: config.preferCLI ?? true,\n        enableMCP: config.enableMCP ?? true\n      }) as unknown as _CoreMemoryClient;\n    } catch {\n      // Fallback to core client if Node module fails to load\n      console.warn('Failed to load Node.js client, falling back to core client');\n    }\n  }\n\n  // Browser, Edge, or fallback\n  const clientConfig: _CoreMemoryClientConfig = {\n    apiUrl: config.apiUrl,\n    apiKey: config.apiKey,\n    authToken: config.authToken,\n    organizationId: config.organizationId,\n    timeout: config.timeout ?? (environment === 'edge' ? 5000 : 30000),\n    headers: config.headers,\n    retry: config.retry\n  };\n\n  return _createMemoryClient(clientConfig);\n}\n\n// ========================================\n// Default Configurations\n// ========================================\nexport const defaultConfigs = {\n  development: {\n    apiUrl: 'http://localhost:3001',\n    timeout: 30000,\n  },\n  production: {\n    apiUrl: 'https://api.lanonasis.com',\n    timeout: 15000,\n  },\n  edge: {\n    apiUrl: 'https://api.lanonasis.com',\n    timeout: 5000,\n  }\n} as const;\n\n// ========================================\n// Migration Guide & Deprecation Warnings\n// ========================================\n\n/**\n * **MIGRATION GUIDE: v1.x → v2.0**\n *\n * The main import still works but is larger. For optimal bundle size:\n *\n * **Browser/Web Apps:**\n * ```ts\n * // Old (v1.x) - still works but larger bundle\n * import { createMemoryClient } from '@lanonasis/memory-client';\n *\n * // New (v2.0) - optimized, smaller bundle\n * import { createMemoryClient } from '@lanonasis/memory-client/core';\n * ```\n *\n * **Node.js with CLI Support:**\n * ```ts\n * // Old (v1.x)\n * import { createEnhancedMemoryClient } from '@lanonasis/memory-client';\n *\n * // New (v2.0)\n * import { createNodeMemoryClient } from '@lanonasis/memory-client/node';\n * ```\n *\n * **React:**\n * ```ts\n * // New in v2.0\n * import { MemoryProvider, useMemories } from '@lanonasis/memory-client/react';\n * ```\n *\n * **Vue:**\n * ```ts\n * // New in v2.0\n * import { createMemoryPlugin, useMemories } from '@lanonasis/memory-client/vue';\n * ```\n *\n * **Configuration Presets:**\n * ```ts\n * // New in v2.0\n * import { browserPreset, nodePreset } from '@lanonasis/memory-client/presets';\n * ```\n */\n\n// ========================================\n// Backward Compatibility\n// ========================================\n\n// For backward compatibility, export old names as aliases\nexport {\n  CoreMemoryClient as MemoryClient,\n  type CoreMemoryClientConfig as MemoryClientConfig\n} from './core/client';\n\n// Note: Enhanced client requires Node.js, so we don't export it from main entry\n// Users should import from '@lanonasis/memory-client/node' instead\n\n// ========================================\n// Usage Instructions\n// ========================================\n\n/**\n * # @lanonasis/memory-client v2.0\n *\n * ## Quick Start\n *\n * ### Browser / Web App\n * ```bash\n * npm install @lanonasis/memory-client\n * ```\n * ```typescript\n * import { createMemoryClient } from '@lanonasis/memory-client/core';\n *\n * const client = createMemoryClient({\n *   apiUrl: 'https://api.lanonasis.com',\n *   apiKey: 'your-key-here'\n * });\n *\n * const memories = await client.listMemories();\n * ```\n *\n * ### Node.js with CLI Support\n * ```typescript\n * import { createNodeMemoryClient } from '@lanonasis/memory-client/node';\n *\n * const client = await createNodeMemoryClient({\n *   apiKey: process.env.LANONASIS_KEY,\n *   preferCLI: true // Automatically uses CLI if available\n * });\n *\n * const result = await client.listMemories();\n * console.log(`Using: ${result.source}`); // 'cli' or 'api'\n * ```\n *\n * ### React\n * ```tsx\n * import { MemoryProvider, useMemories } from '@lanonasis/memory-client/react';\n *\n * function App() {\n *   return (\n *     <MemoryProvider apiKey=\"your-key\">\n *       <MemoryList />\n *     </MemoryProvider>\n *   );\n * }\n *\n * function MemoryList() {\n *   const { memories, loading } = useMemories();\n *   if (loading) return <div>Loading...</div>;\n *   return <div>{memories.map(m => <div key={m.id}>{m.title}</div>)}</div>;\n * }\n * ```\n *\n * ### Vue 3\n * ```typescript\n * import { createMemoryPlugin, useMemories } from '@lanonasis/memory-client/vue';\n *\n * const app = createApp(App);\n * app.use(createMemoryPlugin({ apiKey: 'your-key' }));\n * ```\n *\n * ### Edge Functions (Cloudflare Workers, Vercel Edge)\n * ```typescript\n * import { createMemoryClient } from '@lanonasis/memory-client/core';\n * import { edgePreset } from '@lanonasis/memory-client/presets';\n *\n * export default {\n *   async fetch(request: Request, env: Env) {\n *     const client = createMemoryClient(edgePreset({\n *       apiKey: env.LANONASIS_KEY\n *     }));\n *     const memories = await client.searchMemories({ query: 'test' });\n *     return Response.json(memories.data);\n *   }\n * };\n * ```\n *\n * ## Bundle Sizes\n *\n * - **Core** (browser): ~15KB gzipped\n * - **Node** (with CLI): ~35KB gzipped\n * - **React**: ~18KB gzipped (+ React)\n * - **Vue**: ~17KB gzipped (+ Vue)\n * - **Presets**: ~2KB gzipped\n *\n * ## Documentation\n *\n * - Full docs: https://docs.lanonasis.com/sdk\n * - API reference: https://docs.lanonasis.com/api\n * - Examples: https://github.com/lanonasis/examples\n */\n","/**\n * CLI Integration Module for Memory Client SDK\n *\n * Provides intelligent CLI detection and MCP channel utilization\n * when @lanonasis/cli v1.5.2+ is available in the environment\n *\n * IMPORTANT: This file imports Node.js modules and should only be used in Node.js environments\n */\n\nimport { exec, execSync } from 'child_process';\nimport { promisify } from 'util';\nimport type { ApiResponse, PaginatedResponse } from '../core/client';\nimport { safeJsonParse, createErrorResponse } from '../core/utils';\nimport type {\n  MemoryEntry,\n  MemorySearchResult\n} from '../core/types';\n\nconst execAsync = promisify(exec);\n\nexport interface CLIInfo {\n  available: boolean;\n  version?: string;\n  mcpAvailable?: boolean;\n  authenticated?: boolean;\n}\n\nexport interface CLIExecutionOptions {\n  timeout?: number;\n  verbose?: boolean;\n  outputFormat?: 'json' | 'table' | 'yaml';\n}\n\nexport interface CLICommand {\n  command: string;\n  args: string[];\n  options?: CLIExecutionOptions;\n}\n\nexport interface MCPChannel {\n  available: boolean;\n  version?: string;\n  capabilities?: string[];\n}\n\nexport interface CLICapabilities {\n  cliAvailable: boolean;\n  mcpSupport: boolean;\n  authenticated: boolean;\n  goldenContract: boolean;\n  version?: string;\n}\n\nexport type RoutingStrategy = 'cli-first' | 'api-first' | 'cli-only' | 'api-only' | 'auto';\n\nexport interface CLIAuthStatus {\n  authenticated: boolean;\n  user?: {\n    id?: string;\n    email?: string;\n    name?: string;\n    [key: string]: unknown;\n  };\n  scopes?: string[];\n  expiresAt?: string;\n  [key: string]: unknown;\n}\n\nexport interface CLIMCPStatus {\n  connected: boolean;\n  channel?: string;\n  endpoint?: string;\n  details?: Record<string, unknown>;\n  [key: string]: unknown;\n}\n\nexport interface CLIMCPTool {\n  name: string;\n  title?: string;\n  description?: string;\n  [key: string]: unknown;\n}\n\n/**\n * CLI Detection and Integration Service\n */\nexport class CLIIntegration {\n  private cliInfo: CLIInfo | null = null;\n  private detectionPromise: Promise<CLIInfo> | null = null;\n\n  /**\n   * Detect if CLI is available and get its capabilities\n   */\n  async detectCLI(): Promise<CLIInfo> {\n    // Return cached result if already detected\n    if (this.cliInfo) {\n      return this.cliInfo;\n    }\n\n    // Return existing promise if detection is in progress\n    if (this.detectionPromise) {\n      return this.detectionPromise;\n    }\n\n    // Start new detection\n    this.detectionPromise = this.performDetection();\n    this.cliInfo = await this.detectionPromise;\n    return this.cliInfo;\n  }\n\n  private async performDetection(): Promise<CLIInfo> {\n    try {\n      // Check if onasis/lanonasis CLI is available\n      let versionOutput = '';\n      try {\n        const { stdout } = await execAsync('onasis --version 2>/dev/null', { timeout: 5000 });\n        versionOutput = stdout;\n      } catch {\n        // Try lanonasis if onasis fails\n        const { stdout } = await execAsync('lanonasis --version 2>/dev/null', { timeout: 5000 });\n        versionOutput = stdout;\n      }\n\n      const version = versionOutput.trim();\n\n      // Verify it's v1.5.2 or higher for Golden Contract support\n      const versionMatch = version.match(/(\\d+)\\.(\\d+)\\.(\\d+)/);\n      if (!versionMatch) {\n        return { available: false };\n      }\n\n      const [, major, minor, patch] = versionMatch.map(Number);\n      const isCompatible = major > 1 || (major === 1 && minor > 5) || (major === 1 && minor === 5 && patch >= 2);\n\n      if (!isCompatible) {\n        return {\n          available: true,\n          version,\n          mcpAvailable: false,\n          authenticated: false\n        };\n      }\n\n      // Check MCP availability\n      let mcpAvailable = false;\n      try {\n        await execAsync('onasis mcp status --output json 2>/dev/null || lanonasis mcp status --output json 2>/dev/null', {\n          timeout: 3000\n        });\n        mcpAvailable = true;\n      } catch {\n        // MCP not available or not configured\n      }\n\n      // Check authentication status\n      let authenticated = false;\n      try {\n        const { stdout: authOutput } = await execAsync('onasis auth status --output json 2>/dev/null || lanonasis auth status --output json 2>/dev/null', {\n          timeout: 3000\n        });\n\n        const parseResult = safeJsonParse<{ authenticated?: boolean }>(authOutput);\n        if (parseResult.success) {\n          authenticated = parseResult.data.authenticated === true;\n        }\n      } catch {\n        // Authentication check failed\n      }\n\n      return {\n        available: true,\n        version,\n        mcpAvailable,\n        authenticated\n      };\n\n    } catch {\n      return { available: false };\n    }\n  }\n\n  /**\n   * Execute CLI command and return parsed JSON result\n   */\n  async executeCLICommand<T = unknown>(command: string, options: CLIExecutionOptions = {}): Promise<ApiResponse<T>> {\n    const cliInfo = await this.detectCLI();\n\n    if (!cliInfo.available) {\n      return { error: createErrorResponse('CLI not available', 'API_ERROR') };\n    }\n\n    if (!cliInfo.authenticated) {\n      return { error: createErrorResponse('CLI not authenticated. Run: onasis login', 'AUTH_ERROR', 401) };\n    }\n\n    try {\n      const timeout = options.timeout || 30000;\n      const outputFormat = options.outputFormat || 'json';\n      const verbose = options.verbose ? '--verbose' : '';\n\n      // Determine which CLI command to use (prefer onasis for Golden Contract)\n      const cliCmd = await this.getPreferredCLICommand();\n\n      const fullCommand = `${cliCmd} ${command} --output ${outputFormat} ${verbose}`.trim();\n\n      const { stdout, stderr } = await execAsync(fullCommand, {\n        timeout,\n        maxBuffer: 1024 * 1024 // 1MB buffer\n      });\n\n      if (stderr && stderr.trim()) {\n        console.warn('CLI warning:', stderr);\n      }\n\n      if (outputFormat === 'json') {\n        const parseResult = safeJsonParse<T>(stdout);\n        if (parseResult.success) {\n          return { data: parseResult.data };\n        }\n        return { error: createErrorResponse(parseResult.error, 'VALIDATION_ERROR', 400) };\n      }\n\n      return { data: stdout as unknown as T };\n\n    } catch (error) {\n      if (error instanceof Error && error.message.includes('timeout')) {\n        return { error: createErrorResponse('CLI command timeout', 'TIMEOUT_ERROR', 408) };\n      }\n\n      return {\n        error: createErrorResponse(\n          error instanceof Error ? error.message : 'CLI command failed',\n          'API_ERROR'\n        )\n      };\n    }\n  }\n\n  /**\n   * Get preferred CLI command (onasis for Golden Contract, fallback to lanonasis)\n   */\n  private async getPreferredCLICommand(): Promise<string> {\n    try {\n      execSync('which onasis', { stdio: 'ignore', timeout: 1000 });\n      return 'onasis';\n    } catch {\n      return 'lanonasis';\n    }\n  }\n\n  /**\n   * Memory operations via CLI\n   */\n  async createMemoryViaCLI(title: string, content: string, options: {\n    memoryType?: string;\n    tags?: string[];\n    topicId?: string;\n  } = {}): Promise<ApiResponse<MemoryEntry>> {\n    const { memoryType = 'context', tags = [], topicId } = options;\n\n    let command = `memory create --title \"${title}\" --content \"${content}\" --memory-type ${memoryType}`;\n\n    if (tags.length > 0) {\n      command += ` --tags \"${tags.join(',')}\"`;\n    }\n\n    if (topicId) {\n      command += ` --topic-id \"${topicId}\"`;\n    }\n\n    return this.executeCLICommand<MemoryEntry>(command);\n  }\n\n  async listMemoriesViaCLI(options: {\n    limit?: number;\n    memoryType?: string;\n    tags?: string[];\n    sortBy?: string;\n  } = {}): Promise<ApiResponse<PaginatedResponse<MemoryEntry>>> {\n    let command = 'memory list';\n\n    if (options.limit) {\n      command += ` --limit ${options.limit}`;\n    }\n\n    if (options.memoryType) {\n      command += ` --memory-type ${options.memoryType}`;\n    }\n\n    if (options.tags && options.tags.length > 0) {\n      command += ` --tags \"${options.tags.join(',')}\"`;\n    }\n\n    if (options.sortBy) {\n      command += ` --sort-by ${options.sortBy}`;\n    }\n\n    return this.executeCLICommand<PaginatedResponse<MemoryEntry>>(command);\n  }\n\n  async searchMemoriesViaCLI(query: string, options: {\n    limit?: number;\n    memoryTypes?: string[];\n  } = {}): Promise<ApiResponse<{\n    results: MemorySearchResult[];\n    total_results: number;\n    search_time_ms: number;\n  }>> {\n    let command = `memory search \"${query}\"`;\n\n    if (options.limit) {\n      command += ` --limit ${options.limit}`;\n    }\n\n    if (options.memoryTypes && options.memoryTypes.length > 0) {\n      command += ` --memory-types \"${options.memoryTypes.join(',')}\"`;\n    }\n\n    return this.executeCLICommand<{\n      results: MemorySearchResult[];\n      total_results: number;\n      search_time_ms: number;\n    }>(command);\n  }\n\n  /**\n   * Health check via CLI\n   */\n  async healthCheckViaCLI(): Promise<ApiResponse<{ status: string; timestamp: string }>> {\n    return this.executeCLICommand<{ status: string; timestamp: string }>('health');\n  }\n\n  /**\n   * MCP-specific operations\n   */\n  async getMCPStatus(): Promise<ApiResponse<CLIMCPStatus>> {\n    const cliInfo = await this.detectCLI();\n\n    if (!cliInfo.mcpAvailable) {\n      return { error: createErrorResponse('MCP not available via CLI', 'API_ERROR') };\n    }\n\n    return this.executeCLICommand<CLIMCPStatus>('mcp status');\n  }\n\n  async listMCPTools(): Promise<ApiResponse<{ tools: CLIMCPTool[] }>> {\n    const cliInfo = await this.detectCLI();\n\n    if (!cliInfo.mcpAvailable) {\n      return { error: createErrorResponse('MCP not available via CLI', 'API_ERROR') };\n    }\n\n    return this.executeCLICommand<{ tools: CLIMCPTool[] }>('mcp tools');\n  }\n\n  /**\n   * Authentication operations\n   */\n  async getAuthStatus(): Promise<ApiResponse<CLIAuthStatus>> {\n    return this.executeCLICommand<CLIAuthStatus>('auth status');\n  }\n\n  /**\n   * Check if specific CLI features are available\n   */\n  async getCapabilities(): Promise<{\n    cliAvailable: boolean;\n    version?: string;\n    mcpSupport: boolean;\n    authenticated: boolean;\n    goldenContract: boolean;\n  }> {\n    const cliInfo = await this.detectCLI();\n\n    return {\n      cliAvailable: cliInfo.available,\n      version: cliInfo.version,\n      mcpSupport: cliInfo.mcpAvailable || false,\n      authenticated: cliInfo.authenticated || false,\n      goldenContract: cliInfo.available && this.isGoldenContractCompliant(cliInfo.version)\n    };\n  }\n\n  private isGoldenContractCompliant(version?: string): boolean {\n    if (!version) return false;\n\n    const versionMatch = version.match(/(\\d+)\\.(\\d+)\\.(\\d+)/);\n    if (!versionMatch) return false;\n\n    const [, major, minor, patch] = versionMatch.map(Number);\n    return major > 1 || (major === 1 && minor > 5) || (major === 1 && minor === 5 && patch >= 2);\n  }\n\n  /**\n   * Force refresh CLI detection\n   */\n  async refresh(): Promise<CLIInfo> {\n    this.cliInfo = null;\n    this.detectionPromise = null;\n    return this.detectCLI();\n  }\n\n  /**\n   * Get cached CLI info without re-detection\n   */\n  getCachedInfo(): CLIInfo | null {\n    return this.cliInfo;\n  }\n}\n\n// Singleton instance for convenient access\nexport const cliIntegration = new CLIIntegration();\n","/**\n * Enhanced Memory Client with CLI Integration\n *\n * Intelligently routes requests through CLI v1.5.2+ when available,\n * with fallback to direct API for maximum compatibility and performance\n *\n * IMPORTANT: This file uses Node.js-specific features (process.env) and should only be used in Node.js environments\n */\n\nimport { CoreMemoryClient, type CoreMemoryClientConfig, type ApiResponse, type PaginatedResponse } from '../core/client';\nimport { CLIIntegration, type CLIAuthStatus, type CLIMCPStatus } from './cli-integration';\nimport type { ApiErrorResponse } from '../core/errors';\nimport { createErrorResponse } from '../core/utils';\nimport type {\n  MemoryEntry,\n  MemoryTopic,\n  CreateMemoryRequest,\n  UpdateMemoryRequest,\n  SearchMemoryRequest,\n  MemorySearchResult,\n  UserMemoryStats,\n  CreateTopicRequest\n} from '../core/types';\n\nexport interface EnhancedMemoryClientConfig extends CoreMemoryClientConfig {\n  /** Prefer CLI when available (default: true) */\n  preferCLI?: boolean;\n  /** Enable MCP channels when available (default: true) */\n  enableMCP?: boolean;\n  /** CLI detection timeout in ms (default: 5000) */\n  cliDetectionTimeout?: number;\n  /** Fallback to direct API on CLI failure (default: true) */\n  fallbackToAPI?: boolean;\n  /** Minimum CLI version required for Golden Contract compliance (default: 1.5.2) */\n  minCLIVersion?: string;\n  /** Enable verbose logging for troubleshooting (default: false) */\n  verbose?: boolean;\n}\n\nexport interface OperationResult<T> {\n  data?: T;\n  error?: ApiErrorResponse;\n  source: 'cli' | 'api';\n  mcpUsed?: boolean;\n}\n\n/**\n * Enhanced Memory Client with intelligent CLI/API routing\n */\nexport class EnhancedMemoryClient {\n  private directClient: CoreMemoryClient;\n  private cliIntegration: CLIIntegration;\n  private config: Required<EnhancedMemoryClientConfig>;\n  private capabilities: Awaited<ReturnType<CLIIntegration['getCapabilities']>> | null = null;\n\n  private createDefaultCapabilities(): Awaited<ReturnType<CLIIntegration['getCapabilities']>> {\n    return {\n      cliAvailable: false,\n      mcpSupport: false,\n      authenticated: false,\n      goldenContract: false\n    };\n  }\n\n  constructor(config: EnhancedMemoryClientConfig) {\n    // Merge config with defaults, ensuring all required fields are present\n    // Spread config first, then apply defaults only for undefined values\n    const mergedConfig: EnhancedMemoryClientConfig = {\n      ...config,\n      preferCLI: config.preferCLI ?? true,\n      enableMCP: config.enableMCP ?? true,\n      cliDetectionTimeout: config.cliDetectionTimeout ?? 5000,\n      fallbackToAPI: config.fallbackToAPI ?? true,\n      minCLIVersion: config.minCLIVersion ?? '1.5.2',\n      verbose: config.verbose ?? false,\n      timeout: config.timeout ?? 30000,\n      apiUrl: config.apiUrl || 'https://api.lanonasis.com',\n      apiKey: config.apiKey || process.env.LANONASIS_API_KEY || '',\n      authToken: config.authToken || '',\n      headers: config.headers || {}\n    };\n    \n    this.config = mergedConfig as Required<EnhancedMemoryClientConfig>;\n\n    this.directClient = new CoreMemoryClient(config);\n    this.cliIntegration = new CLIIntegration();\n  }\n\n  /**\n   * Initialize the client and detect capabilities\n   */\n  async initialize(): Promise<void> {\n    try {\n      const detectionPromise = this.cliIntegration.getCapabilities();\n      const capabilities = this.config.cliDetectionTimeout > 0\n        ? await Promise.race([\n            detectionPromise,\n            new Promise<null>((resolve) => {\n              setTimeout(() => resolve(null), this.config.cliDetectionTimeout);\n            })\n          ])\n        : await detectionPromise;\n\n      if (capabilities) {\n        this.capabilities = capabilities;\n\n        if (this.config.verbose && capabilities.cliAvailable && !capabilities.authenticated) {\n          const suggestedCommand = capabilities.goldenContract ? 'onasis login' : 'lanonasis login';\n          console.warn(\n            `CLI detected but not authenticated. Run '${suggestedCommand}' to enable enhanced SDK features.`\n          );\n        }\n      } else {\n        this.capabilities = this.createDefaultCapabilities();\n        if (this.config.verbose) {\n          console.warn(\n            `CLI detection timed out after ${this.config.cliDetectionTimeout}ms. Falling back to API mode.`\n          );\n        }\n      }\n    } catch (error) {\n      if (this.config.verbose) {\n        console.warn('CLI detection failed:', error);\n      }\n      this.capabilities = this.createDefaultCapabilities();\n    }\n  }\n\n  /**\n   * Get current capabilities\n   */\n  async getCapabilities(): Promise<Awaited<ReturnType<CLIIntegration['getCapabilities']>>> {\n    if (!this.capabilities) {\n      await this.initialize();\n    }\n    if (!this.capabilities) {\n      this.capabilities = this.createDefaultCapabilities();\n    }\n    return this.capabilities;\n  }\n\n  /**\n   * Determine if operation should use CLI\n   */\n  private async shouldUseCLI(): Promise<boolean> {\n    const capabilities = await this.getCapabilities();\n\n    return (\n      this.config.preferCLI &&\n      capabilities.cliAvailable &&\n      capabilities.authenticated &&\n      capabilities.goldenContract\n    );\n  }\n\n  /**\n   * Execute operation with intelligent routing\n   */\n  private async executeOperation<T>(\n    operation: string,\n    cliOperation: () => Promise<ApiResponse<T>>,\n    apiOperation: () => Promise<ApiResponse<T>>\n  ): Promise<OperationResult<T>> {\n    const useCLI = await this.shouldUseCLI();\n    const capabilities = await this.getCapabilities();\n\n    if (useCLI) {\n      try {\n        const result = await cliOperation();\n\n        if (result.error && this.config.fallbackToAPI) {\n          console.warn(`CLI ${operation} failed, falling back to API:`, result.error);\n          const apiResult = await apiOperation();\n          return {\n            ...apiResult,\n            source: 'api',\n            mcpUsed: false\n          };\n        }\n\n        return {\n          ...result,\n          source: 'cli',\n          mcpUsed: capabilities.mcpSupport\n        };\n      } catch (error) {\n        if (this.config.fallbackToAPI) {\n          console.warn(`CLI ${operation} error, falling back to API:`, error);\n          const apiResult = await apiOperation();\n          return {\n            ...apiResult,\n            source: 'api',\n            mcpUsed: false\n          };\n        }\n\n        return {\n          error: createErrorResponse(\n            error instanceof Error ? error.message : `CLI ${operation} failed`,\n            'API_ERROR'\n          ),\n          source: 'cli',\n          mcpUsed: false\n        };\n      }\n    } else {\n      const result = await apiOperation();\n      return {\n        ...result,\n        source: 'api',\n        mcpUsed: false\n      };\n    }\n  }\n\n  // Enhanced API Methods\n\n  /**\n   * Health check with intelligent routing\n   */\n  async healthCheck(): Promise<OperationResult<{ status: string; timestamp: string }>> {\n    return this.executeOperation(\n      'health check',\n      () => this.cliIntegration.healthCheckViaCLI(),\n      () => this.directClient.healthCheck()\n    );\n  }\n\n  /**\n   * Create memory with CLI/API routing\n   */\n  async createMemory(memory: CreateMemoryRequest): Promise<OperationResult<MemoryEntry>> {\n    return this.executeOperation(\n      'create memory',\n      () => this.cliIntegration.createMemoryViaCLI(\n        memory.title,\n        memory.content,\n        {\n          memoryType: memory.memory_type,\n          tags: memory.tags,\n          topicId: memory.topic_id\n        }\n      ),\n      () => this.directClient.createMemory(memory)\n    );\n  }\n\n  /**\n   * List memories with intelligent routing\n   */\n  async listMemories(options: {\n    page?: number;\n    limit?: number;\n    memory_type?: string;\n    topic_id?: string;\n    project_ref?: string;\n    status?: string;\n    tags?: string[];\n    sort?: string;\n    order?: 'asc' | 'desc';\n  } = {}): Promise<OperationResult<PaginatedResponse<MemoryEntry>>> {\n    return this.executeOperation(\n      'list memories',\n      () => this.cliIntegration.listMemoriesViaCLI({\n        limit: options.limit,\n        memoryType: options.memory_type,\n        tags: options.tags,\n        sortBy: options.sort\n      }),\n      () => this.directClient.listMemories(options)\n    );\n  }\n\n  /**\n   * Search memories with MCP enhancement when available\n   */\n  async searchMemories(request: SearchMemoryRequest): Promise<OperationResult<{\n    results: MemorySearchResult[];\n    total_results: number;\n    search_time_ms: number;\n  }>> {\n    return this.executeOperation(\n      'search memories',\n      () => this.cliIntegration.searchMemoriesViaCLI(\n        request.query,\n        {\n          limit: request.limit,\n          memoryTypes: request.memory_types\n        }\n      ),\n      () => this.directClient.searchMemories(request)\n    );\n  }\n\n  /**\n   * Get memory by ID (API only for now)\n   */\n  async getMemory(id: string): Promise<OperationResult<MemoryEntry>> {\n    // CLI doesn't have get by ID yet, use API\n    const result = await this.directClient.getMemory(id);\n    return {\n      ...result,\n      source: 'api',\n      mcpUsed: false\n    };\n  }\n\n  /**\n   * Update memory (API only for now)\n   */\n  async updateMemory(id: string, updates: UpdateMemoryRequest): Promise<OperationResult<MemoryEntry>> {\n    // CLI doesn't have update yet, use API\n    const result = await this.directClient.updateMemory(id, updates);\n    return {\n      ...result,\n      source: 'api',\n      mcpUsed: false\n    };\n  }\n\n  /**\n   * Delete memory (API only for now)\n   */\n  async deleteMemory(id: string): Promise<OperationResult<void>> {\n    // CLI doesn't have delete yet, use API\n    const result = await this.directClient.deleteMemory(id);\n    return {\n      ...result,\n      source: 'api',\n      mcpUsed: false\n    };\n  }\n\n  // Topic Operations (API only for now)\n\n  async createTopic(topic: CreateTopicRequest): Promise<OperationResult<MemoryTopic>> {\n    const result = await this.directClient.createTopic(topic);\n    return { ...result, source: 'api', mcpUsed: false };\n  }\n\n  async getTopics(): Promise<OperationResult<MemoryTopic[]>> {\n    const result = await this.directClient.getTopics();\n    return { ...result, source: 'api', mcpUsed: false };\n  }\n\n  async getTopic(id: string): Promise<OperationResult<MemoryTopic>> {\n    const result = await this.directClient.getTopic(id);\n    return { ...result, source: 'api', mcpUsed: false };\n  }\n\n  async updateTopic(id: string, updates: Partial<CreateTopicRequest>): Promise<OperationResult<MemoryTopic>> {\n    const result = await this.directClient.updateTopic(id, updates);\n    return { ...result, source: 'api', mcpUsed: false };\n  }\n\n  async deleteTopic(id: string): Promise<OperationResult<void>> {\n    const result = await this.directClient.deleteTopic(id);\n    return { ...result, source: 'api', mcpUsed: false };\n  }\n\n  /**\n   * Get memory statistics\n   */\n  async getMemoryStats(): Promise<OperationResult<UserMemoryStats>> {\n    const result = await this.directClient.getMemoryStats();\n    return { ...result, source: 'api', mcpUsed: false };\n  }\n\n  // Utility Methods\n\n  /**\n   * Force CLI re-detection\n   */\n  async refreshCLIDetection(): Promise<void> {\n    this.capabilities = null;\n    await this.cliIntegration.refresh();\n    await this.initialize();\n  }\n\n  /**\n   * Get authentication status from CLI\n   */\n  async getAuthStatus(): Promise<OperationResult<CLIAuthStatus>> {\n    try {\n      const result = await this.cliIntegration.getAuthStatus();\n      return { ...result, source: 'cli', mcpUsed: false };\n    } catch (error) {\n      return {\n        error: createErrorResponse(\n          error instanceof Error ? error.message : 'Auth status check failed',\n          'API_ERROR'\n        ),\n        source: 'cli',\n        mcpUsed: false\n      };\n    }\n  }\n\n  /**\n   * Get MCP status when available\n   */\n  async getMCPStatus(): Promise<OperationResult<CLIMCPStatus>> {\n    const capabilities = await this.getCapabilities();\n\n    if (!capabilities.mcpSupport) {\n      return {\n        error: createErrorResponse('MCP not available', 'API_ERROR'),\n        source: 'cli',\n        mcpUsed: false\n      };\n    }\n\n    try {\n      const result = await this.cliIntegration.getMCPStatus();\n      return { ...result, source: 'cli', mcpUsed: true };\n    } catch (error) {\n      return {\n        error: createErrorResponse(\n          error instanceof Error ? error.message : 'MCP status check failed',\n          'API_ERROR'\n        ),\n        source: 'cli',\n        mcpUsed: false\n      };\n    }\n  }\n\n  /**\n   * Update authentication for both CLI and API client\n   */\n  setAuthToken(token: string): void {\n    this.directClient.setAuthToken(token);\n  }\n\n  setApiKey(apiKey: string): void {\n    this.directClient.setApiKey(apiKey);\n  }\n\n  clearAuth(): void {\n    this.directClient.clearAuth();\n  }\n\n  /**\n   * Update configuration\n   */\n  updateConfig(updates: Partial<EnhancedMemoryClientConfig>): void {\n    this.config = { ...this.config, ...updates };\n    this.directClient.updateConfig(updates);\n  }\n\n  /**\n   * Get configuration summary\n   */\n  getConfigSummary(): {\n    apiUrl: string;\n    preferCLI: boolean;\n    enableMCP: boolean;\n    capabilities?: Awaited<ReturnType<CLIIntegration['getCapabilities']>>;\n  } {\n    return {\n      apiUrl: this.config.apiUrl,\n      preferCLI: this.config.preferCLI,\n      enableMCP: this.config.enableMCP,\n      capabilities: this.capabilities || undefined\n    };\n  }\n}\n\n/**\n * Factory function to create an enhanced memory client\n */\nexport async function createNodeMemoryClient(config: EnhancedMemoryClientConfig): Promise<EnhancedMemoryClient> {\n  const client = new EnhancedMemoryClient(config);\n  await client.initialize();\n  return client;\n}\n\n/**\n * Synchronous factory function (initialization happens on first API call)\n */\nexport function createEnhancedMemoryClient(config: EnhancedMemoryClientConfig): EnhancedMemoryClient {\n  return new EnhancedMemoryClient(config);\n}\n","/**\n * @lanonasis/memory-client/node\n *\n * Node.js-enhanced client with CLI integration\n * ONLY import this in Node.js environments\n *\n * Provides intelligent CLI detection and MCP channel utilization\n * when @lanonasis/cli v1.5.2+ is available\n */\n\n// Enhanced client with CLI support\nexport {\n  EnhancedMemoryClient,\n  createNodeMemoryClient,\n  createEnhancedMemoryClient\n} from './enhanced-client';\n\nexport type {\n  EnhancedMemoryClientConfig,\n  OperationResult\n} from './enhanced-client';\n\n// CLI integration utilities\nexport {\n  CLIIntegration,\n  cliIntegration\n} from './cli-integration';\n\nexport type {\n  CLIInfo,\n  CLICommand,\n  MCPChannel,\n  CLICapabilities,\n  RoutingStrategy,\n  CLIAuthStatus,\n  CLIMCPStatus,\n  CLIMCPTool,\n  CLIExecutionOptions\n} from './cli-integration';\n\n// Re-export core types for convenience\nexport type {\n  MemoryEntry,\n  MemoryTopic,\n  CreateMemoryRequest,\n  UpdateMemoryRequest,\n  SearchMemoryRequest,\n  CreateTopicRequest,\n  MemorySearchResult,\n  UserMemoryStats,\n  MemoryType,\n  MemoryStatus\n} from '../core/types';\n\nexport type {\n  ApiResponse,\n  PaginatedResponse\n} from '../core/client';\n\nexport type { ApiErrorResponse, ErrorCode } from '../core/errors';\n"],"names":["z","_createMemoryClient","promisify","exec","execSync"],"mappings":";;;;;;AAEA;;AAEG;AACI,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU;AAGnG;;AAEG;AACI,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS;AAoNxE;;AAEG;AAEI,MAAM,kBAAkB,GAAGA,KAAC,CAAC,MAAM,CAAC;AACzC,IAAA,KAAK,EAAEA,KAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,C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