aether-core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/retrieval/strategies/semantic.strategy.ts","../src/retrieval/strategies/temporal.strategy.ts","../src/retrieval/strategies/relational.strategy.ts","../src/retrieval/strategies/hybrid.strategy.ts","../src/retrieval/retrieval-engine.ts","../src/utils/id-generator.ts","../src/aether.ts","../src/utils/math.ts","../src/storage/in-memory.adapter.ts","../src/embeddings/mock.provider.ts","../src/embeddings/voyage.provider.ts"],"sourcesContent":["import type { RetrievalStrategy, RetrievalContext } from './strategy.interface.js';\nimport type { ScoredMemoryEvent, RetrievalOptions } from '../../types/index.js';\n\n/**\n * Semantic retrieval strategy.\n * Finds memories that are semantically similar to the query using vector search.\n */\nexport class SemanticStrategy implements RetrievalStrategy {\n readonly type = 'semantic' as const;\n\n async retrieve(\n query: string,\n context: RetrievalContext,\n options: RetrievalOptions\n ): Promise<ScoredMemoryEvent[]> {\n // Generate embedding for the query\n const queryEmbedding = await context.embeddings.embed(query);\n\n // Build filters from options\n const filters: Record<string, unknown> = {};\n if (options.actor) {\n filters['actor'] = options.actor;\n }\n if (options.contextFilters) {\n Object.assign(filters, options.contextFilters);\n }\n\n // Search by vector similarity\n const results = await context.storage.searchByVector(queryEmbedding, {\n limit: options.limit ?? 10,\n threshold: options.threshold ?? 0.5,\n filters: Object.keys(filters).length > 0 ? filters : undefined,\n });\n\n return results;\n }\n}\n","import type { RetrievalStrategy, RetrievalContext } from './strategy.interface.js';\nimport type { ScoredMemoryEvent, RetrievalOptions } from '../../types/index.js';\n\n/**\n * Temporal retrieval strategy.\n * Retrieves recent memories for an actor, scoring by recency.\n */\nexport class TemporalStrategy implements RetrievalStrategy {\n readonly type = 'temporal' as const;\n\n /** Decay rate for recency scoring (higher = faster decay) */\n private readonly decayRate: number;\n\n constructor(decayRate: number = 0.0001) {\n this.decayRate = decayRate;\n }\n\n async retrieve(\n _query: string,\n context: RetrievalContext,\n options: RetrievalOptions\n ): Promise<ScoredMemoryEvent[]> {\n // Temporal retrieval requires an actor\n if (!options.actor) {\n return [];\n }\n\n // Get recent events for this actor\n const events = await context.storage.queryByActor(options.actor, {\n limit: options.limit ?? 20,\n order: 'desc', // Most recent first\n });\n\n // Score by recency using exponential decay\n const now = Date.now();\n const scored: ScoredMemoryEvent[] = events.map((event) => {\n const eventTime = new Date(event.timestamp).getTime();\n const age = now - eventTime;\n // Exponential decay: score = e^(-decay_rate * age)\n const score = Math.exp(-this.decayRate * age);\n return { ...event, score };\n });\n\n return scored;\n }\n}\n","import type { RetrievalStrategy, RetrievalContext } from './strategy.interface.js';\nimport type { ScoredMemoryEvent, RetrievalOptions } from '../../types/index.js';\n\n/**\n * Interface for entity extraction from text.\n * Implement this to create custom entity extractors (regex, NLP, LLM-based, etc.)\n */\nexport interface EntityExtractor {\n /**\n * Extract entities from query text.\n * @param query The query text to extract entities from\n * @returns Object with entity key-value pairs (e.g., { userId: '123', productId: 'abc' })\n */\n extract(query: string): Record<string, unknown> | Promise<Record<string, unknown>>;\n}\n\n/**\n * Configuration for pattern-based entity extraction.\n */\nexport interface EntityPattern {\n /** The context key to store the extracted value under */\n key: string;\n /** Regex pattern with a capture group for the value */\n pattern: RegExp;\n}\n\n/**\n * Default entity patterns for common use cases.\n * These can be extended or replaced entirely.\n */\nexport const DEFAULT_ENTITY_PATTERNS: EntityPattern[] = [\n { key: 'cartId', pattern: /cart[_\\s-]?id[:\\s=]+[\"']?(\\w+)[\"']?/i },\n { key: 'orderId', pattern: /order[_\\s-]?id[:\\s=]+[\"']?(\\w+)[\"']?/i },\n { key: 'userId', pattern: /user[_\\s-]?id[:\\s=]+[\"']?(\\w+)[\"']?/i },\n { key: 'productId', pattern: /product[_\\s-]?id[:\\s=]+[\"']?(\\w+)[\"']?/i },\n { key: 'sessionId', pattern: /session[_\\s-]?id[:\\s=]+[\"']?(\\w+)[\"']?/i },\n { key: 'transactionId', pattern: /transaction[_\\s-]?id[:\\s=]+[\"']?(\\w+)[\"']?/i },\n { key: 'customerId', pattern: /customer[_\\s-]?id[:\\s=]+[\"']?(\\w+)[\"']?/i },\n { key: 'invoiceId', pattern: /invoice[_\\s-]?id[:\\s=]+[\"']?(\\w+)[\"']?/i },\n { key: 'ticketId', pattern: /ticket[_\\s-]?id[:\\s=]+[\"']?(\\w+)[\"']?/i },\n { key: 'email', pattern: /([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,})/i },\n];\n\n/**\n * Pattern-based entity extractor.\n * Uses regex patterns to extract entities from text.\n */\nexport class PatternEntityExtractor implements EntityExtractor {\n private patterns: EntityPattern[];\n\n constructor(patterns?: EntityPattern[]) {\n this.patterns = patterns ?? DEFAULT_ENTITY_PATTERNS;\n }\n\n /**\n * Add a new pattern.\n */\n addPattern(key: string, pattern: RegExp): void {\n this.patterns.push({ key, pattern });\n }\n\n /**\n * Add multiple patterns at once.\n */\n addPatterns(patterns: EntityPattern[]): void {\n this.patterns.push(...patterns);\n }\n\n /**\n * Remove a pattern by key.\n */\n removePattern(key: string): void {\n this.patterns = this.patterns.filter((p) => p.key !== key);\n }\n\n /**\n * Clear all patterns.\n */\n clearPatterns(): void {\n this.patterns = [];\n }\n\n /**\n * Get current patterns.\n */\n getPatterns(): EntityPattern[] {\n return [...this.patterns];\n }\n\n extract(query: string): Record<string, unknown> {\n const extracted: Record<string, unknown> = {};\n\n for (const { key, pattern } of this.patterns) {\n const match = query.match(pattern);\n if (match?.[1]) {\n extracted[key] = match[1];\n }\n }\n\n return extracted;\n }\n}\n\n/**\n * Composite entity extractor that combines multiple extractors.\n * Useful for combining pattern-based extraction with LLM-based extraction.\n */\nexport class CompositeEntityExtractor implements EntityExtractor {\n private extractors: EntityExtractor[];\n\n constructor(extractors: EntityExtractor[] = []) {\n this.extractors = extractors;\n }\n\n addExtractor(extractor: EntityExtractor): void {\n this.extractors.push(extractor);\n }\n\n async extract(query: string): Promise<Record<string, unknown>> {\n const results: Record<string, unknown> = {};\n\n for (const extractor of this.extractors) {\n const extracted = await extractor.extract(query);\n Object.assign(results, extracted);\n }\n\n return results;\n }\n}\n\n/**\n * Configuration for the RelationalStrategy.\n */\nexport interface RelationalStrategyConfig {\n /** Custom entity extractor (defaults to PatternEntityExtractor) */\n entityExtractor?: EntityExtractor;\n /** Custom patterns for PatternEntityExtractor (ignored if entityExtractor is provided) */\n patterns?: EntityPattern[];\n /** Whether to include default patterns when providing custom patterns */\n includeDefaultPatterns?: boolean;\n}\n\n/**\n * Relational retrieval strategy.\n * Finds memories related to specific entities mentioned in the query.\n *\n * Entity extraction is pluggable - you can:\n * 1. Use the default pattern-based extractor\n * 2. Provide custom regex patterns\n * 3. Implement a custom EntityExtractor (e.g., using NLP or LLM)\n *\n * @example Default usage\n * ```typescript\n * const strategy = new RelationalStrategy();\n * ```\n *\n * @example Custom patterns\n * ```typescript\n * const strategy = new RelationalStrategy({\n * patterns: [\n * { key: 'sku', pattern: /SKU[:\\s]+([A-Z0-9-]+)/i },\n * { key: 'barcode', pattern: /barcode[:\\s]+(\\d+)/i },\n * ],\n * includeDefaultPatterns: true, // Also include default patterns\n * });\n * ```\n *\n * @example Custom extractor\n * ```typescript\n * class LLMEntityExtractor implements EntityExtractor {\n * async extract(query: string): Promise<Record<string, unknown>> {\n * // Call LLM to extract entities\n * const entities = await llm.extractEntities(query);\n * return entities;\n * }\n * }\n *\n * const strategy = new RelationalStrategy({\n * entityExtractor: new LLMEntityExtractor(),\n * });\n * ```\n */\nexport class RelationalStrategy implements RetrievalStrategy {\n readonly type = 'relational' as const;\n\n private entityExtractor: EntityExtractor;\n\n constructor(config?: RelationalStrategyConfig) {\n if (config?.entityExtractor) {\n this.entityExtractor = config.entityExtractor;\n } else {\n // Build pattern-based extractor\n let patterns: EntityPattern[];\n\n if (config?.patterns) {\n if (config.includeDefaultPatterns) {\n patterns = [...DEFAULT_ENTITY_PATTERNS, ...config.patterns];\n } else {\n patterns = config.patterns;\n }\n } else {\n patterns = DEFAULT_ENTITY_PATTERNS;\n }\n\n this.entityExtractor = new PatternEntityExtractor(patterns);\n }\n }\n\n /**\n * Get the entity extractor (for testing or modification).\n */\n getEntityExtractor(): EntityExtractor {\n return this.entityExtractor;\n }\n\n async retrieve(\n query: string,\n context: RetrievalContext,\n options: RetrievalOptions\n ): Promise<ScoredMemoryEvent[]> {\n // Build filters from context filters or extract from query\n const filters = await this.buildFilters(query, options.contextFilters);\n\n if (Object.keys(filters).length === 0) {\n return [];\n }\n\n // Query by context\n const events = await context.storage.queryByContext(filters, {\n limit: options.limit ?? 20,\n });\n\n // Score based on number of matching context fields\n const totalFilters = Object.keys(filters).length;\n const scored: ScoredMemoryEvent[] = events.map((event) => {\n let matchCount = 0;\n for (const [key, value] of Object.entries(filters)) {\n if (event.context[key] === value) {\n matchCount++;\n }\n }\n // Score is proportion of filters matched\n const score = matchCount / totalFilters;\n return { ...event, score };\n });\n\n // Sort by score (highest first)\n scored.sort((a, b) => b.score - a.score);\n\n return scored;\n }\n\n /**\n * Build filters from explicit context filters or by extracting entities from query.\n */\n private async buildFilters(\n query: string,\n contextFilters?: Record<string, unknown>\n ): Promise<Record<string, unknown>> {\n // If explicit filters provided, use them\n if (contextFilters && Object.keys(contextFilters).length > 0) {\n return contextFilters;\n }\n\n // Otherwise, extract entities from query\n return this.entityExtractor.extract(query);\n }\n}\n","import type { RetrievalStrategy, RetrievalContext } from './strategy.interface.js';\nimport type { ScoredMemoryEvent, RetrievalOptions } from '../../types/index.js';\nimport { SemanticStrategy } from './semantic.strategy.js';\nimport { TemporalStrategy } from './temporal.strategy.js';\nimport { RelationalStrategy } from './relational.strategy.js';\n\n/**\n * Weights for combining different retrieval strategies.\n */\nexport interface HybridWeights {\n semantic: number;\n temporal: number;\n relational: number;\n}\n\nconst DEFAULT_WEIGHTS: HybridWeights = {\n semantic: 0.5,\n temporal: 0.3,\n relational: 0.2,\n};\n\n/**\n * Hybrid retrieval strategy.\n * Combines semantic, temporal, and relational strategies with configurable weights.\n */\nexport class HybridStrategy implements RetrievalStrategy {\n readonly type = 'hybrid' as const;\n\n private readonly semanticStrategy: SemanticStrategy;\n private readonly temporalStrategy: TemporalStrategy;\n private readonly relationalStrategy: RelationalStrategy;\n private readonly weights: HybridWeights;\n\n constructor(weights?: Partial<HybridWeights>) {\n this.semanticStrategy = new SemanticStrategy();\n this.temporalStrategy = new TemporalStrategy();\n this.relationalStrategy = new RelationalStrategy();\n this.weights = { ...DEFAULT_WEIGHTS, ...weights };\n\n // Normalize weights to sum to 1\n const total = this.weights.semantic + this.weights.temporal + this.weights.relational;\n if (total > 0) {\n this.weights.semantic /= total;\n this.weights.temporal /= total;\n this.weights.relational /= total;\n }\n }\n\n async retrieve(\n query: string,\n context: RetrievalContext,\n options: RetrievalOptions\n ): Promise<ScoredMemoryEvent[]> {\n // Execute all strategies in parallel\n const [semanticResults, temporalResults, relationalResults] = await Promise.all([\n this.semanticStrategy.retrieve(query, context, options),\n // Only run temporal if actor is specified\n options.actor\n ? this.temporalStrategy.retrieve(query, context, options)\n : Promise.resolve([]),\n this.relationalStrategy.retrieve(query, context, options),\n ]);\n\n // Combine results with weighted scores\n const combinedMap = new Map<string, ScoredMemoryEvent>();\n\n // Add semantic results\n for (const event of semanticResults) {\n const weightedScore = event.score * this.weights.semantic;\n combinedMap.set(event.id, { ...event, score: weightedScore });\n }\n\n // Add temporal results\n for (const event of temporalResults) {\n const weightedScore = event.score * this.weights.temporal;\n const existing = combinedMap.get(event.id);\n if (existing) {\n existing.score += weightedScore;\n } else {\n combinedMap.set(event.id, { ...event, score: weightedScore });\n }\n }\n\n // Add relational results\n for (const event of relationalResults) {\n const weightedScore = event.score * this.weights.relational;\n const existing = combinedMap.get(event.id);\n if (existing) {\n existing.score += weightedScore;\n } else {\n combinedMap.set(event.id, { ...event, score: weightedScore });\n }\n }\n\n // Sort by combined score (highest first) and apply limit\n const results = Array.from(combinedMap.values())\n .sort((a, b) => b.score - a.score)\n .slice(0, options.limit ?? 10);\n\n return results;\n }\n}\n","import type { StorageAdapter } from '../storage/adapter.interface.js';\nimport type { EmbeddingProvider } from '../embeddings/provider.interface.js';\nimport type {\n MemoryEvent,\n ScoredMemoryEvent,\n RetrievalOptions,\n RetrievalType,\n RetrievalConfig,\n} from '../types/index.js';\nimport type { RetrievalStrategy, RetrievalContext } from './strategies/strategy.interface.js';\nimport { SemanticStrategy } from './strategies/semantic.strategy.js';\nimport { TemporalStrategy } from './strategies/temporal.strategy.js';\nimport { RelationalStrategy } from './strategies/relational.strategy.js';\nimport { HybridStrategy } from './strategies/hybrid.strategy.js';\n\n/**\n * The retrieval engine orchestrates multi-modal memory retrieval.\n * It manages different strategies and combines their results.\n */\nexport class RetrievalEngine {\n private readonly storage: StorageAdapter;\n private readonly embeddings: EmbeddingProvider;\n private readonly config: RetrievalConfig;\n private readonly strategies: Map<RetrievalType, RetrievalStrategy>;\n\n constructor(\n storage: StorageAdapter,\n embeddings: EmbeddingProvider,\n config: RetrievalConfig = {}\n ) {\n this.storage = storage;\n this.embeddings = embeddings;\n this.config = {\n defaultLimit: config.defaultLimit ?? 10,\n defaultType: config.defaultType ?? 'hybrid',\n hybridWeights: config.hybridWeights ?? {\n semantic: 0.5,\n temporal: 0.3,\n relational: 0.2,\n },\n ...config,\n };\n\n // Initialize strategies\n this.strategies = new Map();\n this.strategies.set('semantic', new SemanticStrategy());\n this.strategies.set('temporal', new TemporalStrategy());\n this.strategies.set('relational', new RelationalStrategy());\n this.strategies.set('hybrid', new HybridStrategy(this.config.hybridWeights));\n }\n\n /**\n * Retrieve relevant memories based on a query.\n * @param query The search query\n * @param options Retrieval options\n * @returns Array of relevant memory events\n */\n async retrieve(query: string, options: RetrievalOptions = {}): Promise<MemoryEvent[]> {\n const type = options.retrievalType ?? this.config.defaultType ?? 'hybrid';\n const limit = options.limit ?? this.config.defaultLimit ?? 10;\n\n const strategy = this.strategies.get(type);\n if (!strategy) {\n throw new Error(`Unknown retrieval type: ${type}`);\n }\n\n const context: RetrievalContext = {\n storage: this.storage,\n embeddings: this.embeddings,\n };\n\n const mergedOptions: RetrievalOptions = {\n ...options,\n limit,\n };\n\n const results = await strategy.retrieve(query, context, mergedOptions);\n\n // Optionally apply reranking\n if (this.config.reranker?.enabled) {\n return this.rerank(query, results, this.config.reranker.topK ?? limit);\n }\n\n // Strip scores unless embeddings are requested\n if (!options.includeEmbeddings) {\n return results.map(({ score: _, embedding: __, ...event }) => event as MemoryEvent);\n }\n\n return results.map(({ score: _, ...event }) => event as MemoryEvent);\n }\n\n /**\n * Get a specific retrieval strategy.\n */\n getStrategy(type: RetrievalType): RetrievalStrategy | undefined {\n return this.strategies.get(type);\n }\n\n /**\n * Register a custom retrieval strategy.\n */\n registerStrategy(type: string, strategy: RetrievalStrategy): void {\n this.strategies.set(type as RetrievalType, strategy);\n }\n\n /**\n * Rerank results (placeholder - can be extended with cross-encoder models).\n */\n private async rerank(\n _query: string,\n results: ScoredMemoryEvent[],\n topK: number\n ): Promise<MemoryEvent[]> {\n // For now, just return top-K by score\n // This can be extended to use a cross-encoder model for more accurate ranking\n return results\n .sort((a, b) => b.score - a.score)\n .slice(0, topK)\n .map(({ score: _, ...event }) => event as MemoryEvent);\n }\n}\n","import { ulid } from 'ulid';\n\n/**\n * Generate a unique, sortable ID using ULID.\n * ULIDs are lexicographically sortable by creation time.\n */\nexport function generateId(): string {\n return ulid();\n}\n\n/**\n * Get the timestamp from a ULID.\n * @param id The ULID\n * @returns The timestamp in milliseconds\n */\nexport function getTimestampFromId(id: string): number {\n const ENCODING = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';\n const TIME_LEN = 10;\n\n let time = 0;\n for (let i = 0; i < TIME_LEN; i++) {\n const char = id.charAt(i).toUpperCase();\n const index = ENCODING.indexOf(char);\n if (index === -1) {\n throw new Error(`Invalid ULID character: ${char}`);\n }\n time = time * 32 + index;\n }\n return time;\n}\n","import type {\n MemoryEvent,\n MemoryEventInput,\n RetrievalOptions,\n AdvancedSearchOptions,\n AetherConfig,\n MemoryStats,\n} from './types/index.js';\nimport type { StorageAdapter } from './storage/adapter.interface.js';\nimport type { EmbeddingProvider } from './embeddings/provider.interface.js';\nimport { RetrievalEngine } from './retrieval/retrieval-engine.js';\nimport { generateId } from './utils/id-generator.js';\n\n/**\n * Type for unsubscribe function returned by subscribe.\n */\nexport type Unsubscribe = () => void;\n\n/**\n * Event listener callback type.\n */\nexport type EventListener = (event: MemoryEvent) => void;\n\n/**\n * Aether - Event-driven memory framework for LLM/AI agents.\n *\n * Provides a simple, intuitive API for recording and retrieving memories,\n * moving beyond the limitations of pure vector-based RAG.\n *\n * @example\n * ```typescript\n * const aether = new Aether({\n * storage: { adapter: new InMemoryStorageAdapter() },\n * embeddings: { provider: new VoyageProvider({ apiKey: '...' }) },\n * });\n *\n * // Add a memory\n * await aether.add('User selected product XYZ', { productId: 'xyz' });\n *\n * // Retrieve relevant memories\n * const memories = await aether.retrieve('What did the user look at?');\n * ```\n */\nexport class Aether {\n private readonly storage: StorageAdapter;\n private readonly embeddings: EmbeddingProvider;\n private readonly retrieval: RetrievalEngine;\n private readonly config: AetherConfig;\n private readonly listeners: Set<EventListener> = new Set();\n private initialized = false;\n\n constructor(config: AetherConfig) {\n this.config = config;\n this.storage = config.storage.adapter;\n this.embeddings = config.embeddings.provider;\n this.retrieval = new RetrievalEngine(this.storage, this.embeddings, config.retrieval);\n }\n\n /**\n * Initialize the memory system.\n * Called automatically on first operation if not called explicitly.\n */\n async initialize(): Promise<void> {\n if (this.initialized) return;\n await this.storage.initialize();\n this.initialized = true;\n }\n\n /**\n * Add a memory event.\n *\n * @example Simple string input\n * ```typescript\n * await aether.add('User clicked the buy button');\n * ```\n *\n * @example With context\n * ```typescript\n * await aether.add('User added item to cart', { cartId: '123', itemId: 'xyz' });\n * ```\n *\n * @example Structured input\n * ```typescript\n * await aether.add({\n * actor: 'user123',\n * action: 'purchase',\n * content: 'Purchased premium subscription',\n * context: { planId: 'premium', amount: 99.99 }\n * });\n * ```\n */\n async add(content: string, context?: Record<string, unknown>): Promise<MemoryEvent>;\n async add(event: MemoryEventInput): Promise<MemoryEvent>;\n async add(\n contentOrEvent: string | MemoryEventInput,\n context?: Record<string, unknown>\n ): Promise<MemoryEvent> {\n await this.initialize();\n\n // Parse input\n const input: MemoryEventInput =\n typeof contentOrEvent === 'string'\n ? { content: contentOrEvent, context }\n : contentOrEvent;\n\n // Generate embedding for the content\n const embedding = await this.embeddings.embed(input.content);\n\n // Build the full event\n const event: MemoryEvent = {\n id: generateId(),\n timestamp: new Date().toISOString(),\n actor: input.actor ?? 'unknown',\n action: input.action ?? this.inferAction(input.content),\n content: input.content,\n context: input.context ?? {},\n embedding,\n relations: input.relations,\n };\n\n // Store the event\n const stored = await this.storage.store(event);\n\n // Notify listeners\n this.notifyListeners(stored);\n\n return stored;\n }\n\n /**\n * Add multiple memory events in a batch.\n * More efficient than calling add() multiple times.\n */\n async addBatch(events: MemoryEventInput[]): Promise<MemoryEvent[]> {\n await this.initialize();\n\n // Generate embeddings in batch\n const contents = events.map((e) => e.content);\n const embeddings = await this.embeddings.embedBatch(contents);\n\n // Build full events\n const fullEvents: MemoryEvent[] = events.map((input, i) => ({\n id: generateId(),\n timestamp: new Date().toISOString(),\n actor: input.actor ?? 'unknown',\n action: input.action ?? this.inferAction(input.content),\n content: input.content,\n context: input.context ?? {},\n embedding: embeddings[i],\n relations: input.relations,\n }));\n\n // Store all events\n const stored = await this.storage.storeBatch(fullEvents);\n\n // Notify listeners\n for (const event of stored) {\n this.notifyListeners(event);\n }\n\n return stored;\n }\n\n /**\n * Retrieve relevant memories based on a query.\n * Uses multi-modal retrieval (semantic, temporal, relational).\n *\n * @example Basic retrieval\n * ```typescript\n * const memories = await aether.retrieve('What products did the user view?');\n * ```\n *\n * @example With options\n * ```typescript\n * const memories = await aether.retrieve('recent actions', {\n * actor: 'user123',\n * retrievalType: 'temporal',\n * limit: 10\n * });\n * ```\n */\n async retrieve(query: string, options?: RetrievalOptions): Promise<MemoryEvent[]> {\n await this.initialize();\n return this.retrieval.retrieve(query, options);\n }\n\n /**\n * Get the history of events for a specific actor.\n * Events are returned in reverse chronological order (most recent first).\n */\n async getHistory(actor: string, limit?: number): Promise<MemoryEvent[]> {\n await this.initialize();\n return this.storage.queryByActor(actor, {\n limit: limit ?? 20,\n order: 'desc',\n });\n }\n\n /**\n * Get a specific event by ID.\n */\n async get(id: string): Promise<MemoryEvent | null> {\n await this.initialize();\n return this.storage.getById(id);\n }\n\n /**\n * Delete a specific event by ID.\n */\n async delete(id: string): Promise<boolean> {\n await this.initialize();\n return this.storage.delete(id);\n }\n\n /**\n * Advanced multi-modal search with fine-grained control.\n */\n async search(options: AdvancedSearchOptions): Promise<MemoryEvent[]> {\n await this.initialize();\n\n // Build retrieval options from advanced search options\n const retrievalOptions: RetrievalOptions = {\n limit: options.limit ?? 10,\n retrievalType: 'hybrid',\n };\n\n // Use semantic query if provided\n const query = options.semantic?.query ?? '';\n\n // Add actor for temporal if provided\n if (options.temporal?.actor) {\n retrievalOptions.actor = options.temporal.actor;\n }\n\n // Add context filters for relational if provided\n if (options.relational?.contextKeys && options.relational?.values) {\n retrievalOptions.contextFilters = {};\n for (let i = 0; i < options.relational.contextKeys.length; i++) {\n const key = options.relational.contextKeys[i];\n const value = options.relational.values[i];\n if (key !== undefined) {\n retrievalOptions.contextFilters[key] = value;\n }\n }\n }\n\n return this.retrieval.retrieve(query, retrievalOptions);\n }\n\n /**\n * Get events related to a specific event.\n * Follows the relations defined on the event.\n */\n async getRelated(eventId: string, depth: number = 1): Promise<MemoryEvent[]> {\n await this.initialize();\n\n const visited = new Set<string>();\n const related: MemoryEvent[] = [];\n\n const traverse = async (id: string, currentDepth: number): Promise<void> => {\n if (currentDepth > depth || visited.has(id)) return;\n visited.add(id);\n\n const event = await this.storage.getById(id);\n if (!event) return;\n\n if (id !== eventId) {\n related.push(event);\n }\n\n // Follow relations\n if (event.relations) {\n for (const relation of event.relations) {\n await traverse(relation.targetEventId, currentDepth + 1);\n }\n }\n };\n\n await traverse(eventId, 0);\n return related;\n }\n\n /**\n * Subscribe to new memory events.\n * Returns an unsubscribe function.\n */\n subscribe(callback: EventListener): Unsubscribe {\n this.listeners.add(callback);\n return () => {\n this.listeners.delete(callback);\n };\n }\n\n /**\n * Get statistics about the memory store.\n */\n async stats(): Promise<MemoryStats> {\n await this.initialize();\n\n const actors = await this.storage.getActors();\n const count = await this.storage.count();\n\n // Get oldest and newest events\n let oldestEvent: string | undefined;\n let newestEvent: string | undefined;\n\n if (count > 0 && actors.length > 0) {\n // Get first actor's history to find oldest/newest\n const allEvents = await this.storage.queryByActor(actors[0]!, { limit: 1, order: 'asc' });\n if (allEvents.length > 0) {\n oldestEvent = allEvents[0]!.timestamp;\n }\n\n const recentEvents = await this.storage.queryByActor(actors[0]!, { limit: 1, order: 'desc' });\n if (recentEvents.length > 0) {\n newestEvent = recentEvents[0]!.timestamp;\n }\n }\n\n return {\n totalEvents: count,\n uniqueActors: actors.length,\n oldestEvent,\n newestEvent,\n storageAdapter: this.storage.name,\n embeddingProvider: this.embeddings.name,\n };\n }\n\n /**\n * Close the memory system and release resources.\n */\n async close(): Promise<void> {\n await this.storage.close();\n this.listeners.clear();\n this.initialized = false;\n }\n\n /**\n * Clear all stored memories.\n * Use with caution!\n */\n async clear(): Promise<void> {\n await this.initialize();\n await this.storage.clear();\n }\n\n /**\n * Infer an action type from content.\n */\n private inferAction(content: string): string {\n const lowerContent = content.toLowerCase();\n\n const actionPatterns: Array<[RegExp, string]> = [\n [/\\b(clicked|click|pressed|tapped)\\b/, 'click'],\n [/\\b(viewed|view|looked|saw|opened)\\b/, 'view'],\n [/\\b(searched|search|queried|query)\\b/, 'search'],\n [/\\b(purchased|bought|ordered|paid)\\b/, 'purchase'],\n [/\\b(added|add)\\b.*\\b(cart|basket)\\b/, 'add_to_cart'],\n [/\\b(removed|remove)\\b.*\\b(cart|basket)\\b/, 'remove_from_cart'],\n [/\\b(selected|chose|picked)\\b/, 'select'],\n [/\\b(submitted|submit|sent|send)\\b/, 'submit'],\n [/\\b(logged|login|signed)\\s*(in|on)\\b/, 'login'],\n [/\\b(logged|signed)\\s*(out|off)\\b/, 'logout'],\n [/\\b(created|create|made|new)\\b/, 'create'],\n [/\\b(updated|update|changed|modified)\\b/, 'update'],\n [/\\b(deleted|delete|removed)\\b/, 'delete'],\n [/\\b(said|asked|responded|replied|wrote)\\b/, 'message'],\n ];\n\n for (const [pattern, action] of actionPatterns) {\n if (pattern.test(lowerContent)) {\n return action;\n }\n }\n\n return 'event';\n }\n\n /**\n * Notify all listeners of a new event.\n */\n private notifyListeners(event: MemoryEvent): void {\n for (const listener of this.listeners) {\n try {\n listener(event);\n } catch (error) {\n // Log but don't throw - listeners shouldn't break the main flow\n console.error('Error in event listener:', error);\n }\n }\n }\n}\n","/**\n * Calculate the dot product of two vectors.\n */\nexport function dotProduct(a: number[], b: number[]): number {\n if (a.length !== b.length) {\n throw new Error(`Vector dimension mismatch: ${a.length} vs ${b.length}`);\n }\n\n let sum = 0;\n for (let i = 0; i < a.length; i++) {\n sum += a[i]! * b[i]!;\n }\n return sum;\n}\n\n/**\n * Calculate the magnitude (L2 norm) of a vector.\n */\nexport function magnitude(v: number[]): number {\n let sum = 0;\n for (let i = 0; i < v.length; i++) {\n sum += v[i]! * v[i]!;\n }\n return Math.sqrt(sum);\n}\n\n/**\n * Normalize a vector to unit length.\n */\nexport function normalize(v: number[]): number[] {\n const mag = magnitude(v);\n if (mag === 0) {\n return v.map(() => 0);\n }\n return v.map((x) => x / mag);\n}\n\n/**\n * Calculate cosine similarity between two vectors.\n * Returns a value between -1 and 1 (1 = identical, 0 = orthogonal, -1 = opposite).\n * For normalized vectors, this is equivalent to the dot product.\n */\nexport function cosineSimilarity(a: number[], b: number[]): number {\n const dot = dotProduct(a, b);\n const magA = magnitude(a);\n const magB = magnitude(b);\n\n if (magA === 0 || magB === 0) {\n return 0;\n }\n\n return dot / (magA * magB);\n}\n\n/**\n * Calculate Euclidean distance between two vectors.\n */\nexport function euclideanDistance(a: number[], b: number[]): number {\n if (a.length !== b.length) {\n throw new Error(`Vector dimension mismatch: ${a.length} vs ${b.length}`);\n }\n\n let sum = 0;\n for (let i = 0; i < a.length; i++) {\n const diff = a[i]! - b[i]!;\n sum += diff * diff;\n }\n return Math.sqrt(sum);\n}\n","import type { StorageAdapter } from './adapter.interface.js';\nimport type {\n MemoryEvent,\n ScoredMemoryEvent,\n TimeRange,\n TemporalQueryOptions,\n QueryOptions,\n VectorSearchOptions,\n} from '../types/index.js';\nimport { cosineSimilarity } from '../utils/math.js';\n\n/**\n * In-memory storage adapter for development and testing.\n * Uses Maps for O(1) lookups and maintains indexes for efficient queries.\n */\nexport class InMemoryStorageAdapter implements StorageAdapter {\n readonly name = 'in-memory';\n\n /** Primary storage: id -> event */\n private events: Map<string, MemoryEvent> = new Map();\n\n /** Actor index: actor -> Set<event ids> */\n private actorIndex: Map<string, Set<string>> = new Map();\n\n /** Context index: context key -> value -> Set<event ids> */\n private contextIndex: Map<string, Map<unknown, Set<string>>> = new Map();\n\n /** Timestamp index: sorted list of [timestamp, id] for range queries */\n private timestampIndex: Array<{ timestamp: number; id: string }> = [];\n\n async initialize(): Promise<void> {\n // No initialization needed for in-memory storage\n }\n\n async store(event: MemoryEvent): Promise<MemoryEvent> {\n // Store the event\n this.events.set(event.id, event);\n\n // Update actor index\n if (!this.actorIndex.has(event.actor)) {\n this.actorIndex.set(event.actor, new Set());\n }\n this.actorIndex.get(event.actor)!.add(event.id);\n\n // Update context index\n for (const [key, value] of Object.entries(event.context)) {\n if (!this.contextIndex.has(key)) {\n this.contextIndex.set(key, new Map());\n }\n const valueMap = this.contextIndex.get(key)!;\n if (!valueMap.has(value)) {\n valueMap.set(value, new Set());\n }\n valueMap.get(value)!.add(event.id);\n }\n\n // Update timestamp index (maintain sorted order)\n const ts = new Date(event.timestamp).getTime();\n const insertIdx = this.binarySearchInsert(ts);\n this.timestampIndex.splice(insertIdx, 0, { timestamp: ts, id: event.id });\n\n return event;\n }\n\n async storeBatch(events: MemoryEvent[]): Promise<MemoryEvent[]> {\n const results: MemoryEvent[] = [];\n for (const event of events) {\n results.push(await this.store(event));\n }\n return results;\n }\n\n async getById(id: string): Promise<MemoryEvent | null> {\n return this.events.get(id) ?? null;\n }\n\n async getByIds(ids: string[]): Promise<MemoryEvent[]> {\n const results: MemoryEvent[] = [];\n for (const id of ids) {\n const event = this.events.get(id);\n if (event) {\n results.push(event);\n }\n }\n return results;\n }\n\n async queryByActor(actor: string, options?: TemporalQueryOptions): Promise<MemoryEvent[]> {\n const eventIds = this.actorIndex.get(actor);\n if (!eventIds || eventIds.size === 0) {\n return [];\n }\n\n // Get all events for this actor\n let events: MemoryEvent[] = [];\n for (const id of eventIds) {\n const event = this.events.get(id);\n if (event) {\n events.push(event);\n }\n }\n\n // Sort by timestamp\n const order = options?.order ?? 'desc';\n events.sort((a, b) => {\n const timeA = new Date(a.timestamp).getTime();\n const timeB = new Date(b.timestamp).getTime();\n return order === 'asc' ? timeA - timeB : timeB - timeA;\n });\n\n // Apply offset and limit\n const offset = options?.offset ?? 0;\n const limit = options?.limit ?? events.length;\n return events.slice(offset, offset + limit);\n }\n\n async queryByContext(\n filters: Record<string, unknown>,\n options?: QueryOptions\n ): Promise<MemoryEvent[]> {\n const filterEntries = Object.entries(filters);\n if (filterEntries.length === 0) {\n return [];\n }\n\n // Find events that match ALL filters (intersection)\n let matchingIds: Set<string> | null = null;\n\n for (const [key, value] of filterEntries) {\n const keyIndex = this.contextIndex.get(key);\n if (!keyIndex) {\n return []; // Key doesn't exist, no matches possible\n }\n\n const valueIds = keyIndex.get(value);\n if (!valueIds) {\n return []; // Value doesn't exist for this key\n }\n\n if (matchingIds === null) {\n matchingIds = new Set(valueIds);\n } else {\n // Intersection\n const newSet = new Set<string>();\n for (const id of matchingIds) {\n if (valueIds.has(id)) {\n newSet.add(id);\n }\n }\n matchingIds = newSet;\n }\n\n if (matchingIds.size === 0) {\n return [];\n }\n }\n\n if (!matchingIds) {\n return [];\n }\n\n // Get events and sort by timestamp (newest first)\n const events: MemoryEvent[] = [];\n for (const id of matchingIds) {\n const event = this.events.get(id);\n if (event) {\n events.push(event);\n }\n }\n\n events.sort((a, b) => {\n return new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime();\n });\n\n // Apply offset and limit\n const offset = options?.offset ?? 0;\n const limit = options?.limit ?? events.length;\n return events.slice(offset, offset + limit);\n }\n\n async queryByTimeRange(range: TimeRange, options?: QueryOptions): Promise<MemoryEvent[]> {\n const startTs = new Date(range.start).getTime();\n const endTs = new Date(range.end).getTime();\n\n // Binary search for start position\n let left = 0;\n let right = this.timestampIndex.length;\n while (left < right) {\n const mid = Math.floor((left + right) / 2);\n if (this.timestampIndex[mid]!.timestamp < startTs) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }\n\n // Collect events in range\n const events: MemoryEvent[] = [];\n for (let i = left; i < this.timestampIndex.length; i++) {\n const entry = this.timestampIndex[i]!;\n if (entry.timestamp > endTs) {\n break;\n }\n const event = this.events.get(entry.id);\n if (event) {\n events.push(event);\n }\n }\n\n // Apply offset and limit\n const offset = options?.offset ?? 0;\n const limit = options?.limit ?? events.length;\n return events.slice(offset, offset + limit);\n }\n\n async searchByVector(\n vector: number[],\n options?: VectorSearchOptions\n ): Promise<ScoredMemoryEvent[]> {\n const results: ScoredMemoryEvent[] = [];\n const threshold = options?.threshold ?? 0;\n\n for (const event of this.events.values()) {\n // Skip events without embeddings\n if (!event.embedding) {\n continue;\n }\n\n // Apply filters if specified\n if (options?.filters) {\n let matches = true;\n for (const [key, value] of Object.entries(options.filters)) {\n if (event.context[key] !== value) {\n matches = false;\n break;\n }\n }\n if (!matches) {\n continue;\n }\n }\n\n // Calculate similarity\n const score = cosineSimilarity(vector, event.embedding);\n\n // Apply threshold\n if (score >= threshold) {\n results.push({ ...event, score });\n }\n }\n\n // Sort by score (highest first)\n results.sort((a, b) => b.score - a.score);\n\n // Apply limit\n const limit = options?.limit ?? results.length;\n return results.slice(0, limit);\n }\n\n async delete(id: string): Promise<boolean> {\n const event = this.events.get(id);\n if (!event) {\n return false;\n }\n\n // Remove from primary storage\n this.events.delete(id);\n\n // Remove from actor index\n const actorIds = this.actorIndex.get(event.actor);\n if (actorIds) {\n actorIds.delete(id);\n if (actorIds.size === 0) {\n this.actorIndex.delete(event.actor);\n }\n }\n\n // Remove from context index\n for (const [key, value] of Object.entries(event.context)) {\n const keyIndex = this.contextIndex.get(key);\n if (keyIndex) {\n const valueIds = keyIndex.get(value);\n if (valueIds) {\n valueIds.delete(id);\n if (valueIds.size === 0) {\n keyIndex.delete(value);\n }\n }\n if (keyIndex.size === 0) {\n this.contextIndex.delete(key);\n }\n }\n }\n\n // Remove from timestamp index\n const ts = new Date(event.timestamp).getTime();\n const idx = this.timestampIndex.findIndex((e) => e.id === id && e.timestamp === ts);\n if (idx !== -1) {\n this.timestampIndex.splice(idx, 1);\n }\n\n return true;\n }\n\n async deleteBatch(ids: string[]): Promise<number> {\n let count = 0;\n for (const id of ids) {\n if (await this.delete(id)) {\n count++;\n }\n }\n return count;\n }\n\n async clear(): Promise<void> {\n this.events.clear();\n this.actorIndex.clear();\n this.contextIndex.clear();\n this.timestampIndex = [];\n }\n\n async count(filters?: Record<string, unknown>): Promise<number> {\n if (!filters || Object.keys(filters).length === 0) {\n return this.events.size;\n }\n\n const events = await this.queryByContext(filters);\n return events.length;\n }\n\n async getActors(): Promise<string[]> {\n return Array.from(this.actorIndex.keys());\n }\n\n async close(): Promise<void> {\n // No cleanup needed for in-memory storage\n await this.clear();\n }\n\n /**\n * Binary search to find insertion point for a timestamp.\n */\n private binarySearchInsert(timestamp: number): number {\n let left = 0;\n let right = this.timestampIndex.length;\n\n while (left < right) {\n const mid = Math.floor((left + right) / 2);\n if (this.timestampIndex[mid]!.timestamp < timestamp) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }\n\n return left;\n }\n}\n","import type { EmbeddingProvider } from './provider.interface.js';\nimport { cosineSimilarity, normalize } from '../utils/math.js';\n\n/**\n * Mock embedding provider for testing and development.\n * Generates deterministic pseudo-random embeddings based on text hash.\n */\nexport class MockEmbeddingProvider implements EmbeddingProvider {\n readonly name = 'mock';\n readonly dimensions: number;\n\n constructor(dimensions: number = 384) {\n this.dimensions = dimensions;\n }\n\n async embed(text: string): Promise<number[]> {\n return this.hashToVector(text);\n }\n\n async embedBatch(texts: string[]): Promise<number[][]> {\n return texts.map((t) => this.hashToVector(t));\n }\n\n similarity(a: number[], b: number[]): number {\n return cosineSimilarity(a, b);\n }\n\n /**\n * Generate a deterministic vector from text hash.\n * Same text always produces the same vector.\n */\n private hashToVector(text: string): number[] {\n const hash = this.simpleHash(text);\n const vector: number[] = [];\n\n // Use linear congruential generator seeded with hash\n let seed = hash;\n for (let i = 0; i < this.dimensions; i++) {\n seed = (seed * 1103515245 + 12345) & 0x7fffffff;\n // Generate value in [-1, 1]\n vector.push((seed / 0x7fffffff) * 2 - 1);\n }\n\n return normalize(vector);\n }\n\n /**\n * Simple string hash function.\n */\n private simpleHash(str: string): number {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash = hash & hash; // Convert to 32-bit integer\n }\n return Math.abs(hash);\n }\n}\n","import type { EmbeddingProvider } from './provider.interface.js';\nimport { cosineSimilarity } from '../utils/math.js';\n\n/**\n * VoyageAI embedding response structure.\n */\ninterface VoyageEmbeddingResponse {\n object: string;\n data: Array<{\n object: string;\n embedding: number[];\n index: number;\n }>;\n model: string;\n usage: {\n total_tokens: number;\n };\n}\n\n/**\n * VoyageAI provider configuration.\n */\nexport interface VoyageProviderConfig {\n /** VoyageAI API key */\n apiKey: string;\n /** Model to use (default: 'voyage-2') */\n model?: VoyageModel;\n /** Base URL (default: 'https://api.voyageai.com/v1') */\n baseUrl?: string;\n /** Maximum texts per batch (default: 128) */\n batchSize?: number;\n /** Request timeout in ms (default: 30000) */\n timeout?: number;\n /** Maximum retries on failure (default: 3) */\n maxRetries?: number;\n}\n\n/**\n * Available VoyageAI models with their dimensions.\n */\nexport type VoyageModel =\n | 'voyage-3'\n | 'voyage-3-lite'\n | 'voyage-code-3'\n | 'voyage-finance-2'\n | 'voyage-law-2'\n | 'voyage-code-2'\n | 'voyage-2'\n | 'voyage-large-2'\n | 'voyage-large-2-instruct';\n\nconst MODEL_DIMENSIONS: Record<VoyageModel, number> = {\n 'voyage-3': 1024,\n 'voyage-3-lite': 512,\n 'voyage-code-3': 1024,\n 'voyage-finance-2': 1024,\n 'voyage-law-2': 1024,\n 'voyage-code-2': 1536,\n 'voyage-2': 1024,\n 'voyage-large-2': 1536,\n 'voyage-large-2-instruct': 1024,\n};\n\n/**\n * VoyageAI embedding provider.\n * Uses VoyageAI's API for generating high-quality embeddings.\n */\nexport class VoyageProvider implements EmbeddingProvider {\n readonly name = 'voyage';\n readonly dimensions: number;\n\n private readonly apiKey: string;\n private readonly model: VoyageModel;\n private readonly baseUrl: string;\n private readonly batchSize: number;\n private readonly timeout: number;\n private readonly maxRetries: number;\n\n constructor(config: VoyageProviderConfig) {\n if (!config.apiKey) {\n throw new Error('VoyageAI API key is required');\n }\n\n this.apiKey = config.apiKey;\n this.model = config.model ?? 'voyage-2';\n this.baseUrl = config.baseUrl ?? 'https://api.voyageai.com/v1';\n this.batchSize = config.batchSize ?? 128;\n this.timeout = config.timeout ?? 30000;\n this.maxRetries = config.maxRetries ?? 3;\n this.dimensions = MODEL_DIMENSIONS[this.model] ?? 1024;\n }\n\n async embed(text: string): Promise<number[]> {\n const results = await this.embedBatch([text]);\n return results[0]!;\n }\n\n async embedBatch(texts: string[]): Promise<number[][]> {\n if (texts.length === 0) {\n return [];\n }\n\n const results: number[][] = [];\n\n // Process in batches\n for (let i = 0; i < texts.length; i += this.batchSize) {\n const batch = texts.slice(i, i + this.batchSize);\n const batchResults = await this.embedWithRetry(batch);\n results.push(...batchResults);\n }\n\n return results;\n }\n\n similarity(a: number[], b: number[]): number {\n return cosineSimilarity(a, b);\n }\n\n /**\n * Embed a batch of texts with retry logic.\n */\n private async embedWithRetry(texts: string[]): Promise<number[][]> {\n let lastError: Error | null = null;\n\n for (let attempt = 0; attempt < this.maxRetries; attempt++) {\n try {\n return await this.callApi(texts);\n } catch (error) {\n lastError = error as Error;\n\n // Don't retry on client errors (4xx)\n if (error instanceof Error && error.message.includes('4')) {\n throw error;\n }\n\n // Exponential backoff\n const delay = Math.pow(2, attempt) * 1000;\n await this.sleep(delay);\n }\n }\n\n throw lastError ?? new Error('Failed to embed texts');\n }\n\n /**\n * Call the VoyageAI API.\n */\n private async callApi(texts: string[]): Promise<number[][]> {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.timeout);\n\n try {\n const response = await fetch(`${this.baseUrl}/embeddings`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${this.apiKey}`,\n },\n body: JSON.stringify({\n input: texts,\n model: this.model,\n }),\n signal: controller.signal,\n });\n\n if (!response.ok) {\n const errorText = await response.text();\n throw new Error(`VoyageAI API error (${response.status}): ${errorText}`);\n }\n\n const data = (await response.json()) as VoyageEmbeddingResponse;\n\n // Sort by index to ensure correct order\n const sorted = data.data.sort((a, b) => a.index - b.index);\n return sorted.map((item) => item.embedding);\n } finally {\n clearTimeout(timeoutId);\n }\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n}\n"],"mappings":";AAOO,IAAM,mBAAN,MAAoD;AAAA,EAChD,OAAO;AAAA,EAEhB,MAAM,SACJ,OACA,SACA,SAC8B;AAE9B,UAAM,iBAAiB,MAAM,QAAQ,WAAW,MAAM,KAAK;AAG3D,UAAM,UAAmC,CAAC;AAC1C,QAAI,QAAQ,OAAO;AACjB,cAAQ,OAAO,IAAI,QAAQ;AAAA,IAC7B;AACA,QAAI,QAAQ,gBAAgB;AAC1B,aAAO,OAAO,SAAS,QAAQ,cAAc;AAAA,IAC/C;AAGA,UA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ACA,MAAM,KAAK,UAAU;AAAA,UACnB,OAAO;AAAA,UACP,OAAO,KAAK;AAAA,QACd,CAAC;AAAA,QACD,QAAQ,WAAW;AAAA,MACrB,CAAC;AAED,UAAI,CAAC,SAAS,IAAI;AAChB,cAAM,YAAY,MAAM,SAAS,KAAK;AACtC,cAAM,IAAI,MAAM,uBAAuB,SAAS,MAAM,MAAM,SAAS,EAAE;AAAA,MACzE;AAEA,YAAM,OAAQ,MAAM,SAAS,KAAK;AAGlC,YAAM,SAAS,KAAK,KAAK,KAAK,CAAC,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK;AACzD,aAAO,OAAO,IAAI,CAAC,SAAS,KAAK,SAAS;AAAA,IAC5C,UAAE;AACA,mBAAa,SAAS;AAAA,IACxB;AAAA,EACF;AAAA,EAEQ,MAAM,IAA2B;AACvC,WAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AAAA,EACzD;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "aether-core",
3
+ "version": "0.1.0",
4
+ "description": "Core memory framework for LLM/AI agents",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "dependencies": {
19
+ "ulid": "^2.3.0"
20
+ },
21
+ "devDependencies": {
22
+ "@types/node": "^20.10.0",
23
+ "tsup": "^8.0.0",
24
+ "typescript": "^5.3.0",
25
+ "vitest": "^1.0.0"
26
+ },
27
+ "peerDependencies": {},
28
+ "engines": {
29
+ "node": ">=18.0.0"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "keywords": [
35
+ "llm",
36
+ "ai",
37
+ "memory",
38
+ "rag",
39
+ "agents",
40
+ "embeddings",
41
+ "vector-search"
42
+ ],
43
+ "license": "MIT",
44
+ "scripts": {
45
+ "build": "tsup",
46
+ "dev": "tsup --watch",
47
+ "test": "vitest run",
48
+ "test:watch": "vitest",
49
+ "test:coverage": "vitest run --coverage",
50
+ "typecheck": "tsc --noEmit",
51
+ "clean": "rm -rf dist .turbo"
52
+ }
53
+ }