@yamo/memory-mesh 3.0.0 → 3.0.2

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.
Files changed (108) hide show
  1. package/README.md +9 -3
  2. package/bin/memory_mesh.js +95 -8
  3. package/lib/llm/client.d.ts +23 -48
  4. package/lib/llm/client.js +1 -0
  5. package/lib/llm/client.ts +298 -377
  6. package/lib/llm/index.js +1 -0
  7. package/lib/llm/index.ts +1 -2
  8. package/lib/memory/adapters/client.d.ts +22 -85
  9. package/lib/memory/adapters/client.js +1 -0
  10. package/lib/memory/adapters/client.ts +474 -633
  11. package/lib/memory/adapters/config.d.ts +82 -89
  12. package/lib/memory/adapters/config.js +1 -0
  13. package/lib/memory/adapters/config.ts +156 -225
  14. package/lib/memory/adapters/errors.d.ts +28 -20
  15. package/lib/memory/adapters/errors.js +1 -0
  16. package/lib/memory/adapters/errors.ts +83 -120
  17. package/lib/memory/context-manager.d.ts +15 -18
  18. package/lib/memory/context-manager.js +1 -0
  19. package/lib/memory/context-manager.ts +314 -401
  20. package/lib/memory/embeddings/factory.d.ts +18 -20
  21. package/lib/memory/embeddings/factory.js +1 -0
  22. package/lib/memory/embeddings/factory.ts +130 -173
  23. package/lib/memory/embeddings/index.js +1 -0
  24. package/lib/memory/embeddings/index.ts +1 -0
  25. package/lib/memory/embeddings/service.d.ts +36 -66
  26. package/lib/memory/embeddings/service.js +1 -0
  27. package/lib/memory/embeddings/service.ts +479 -616
  28. package/lib/memory/index.d.ts +2 -2
  29. package/lib/memory/index.js +1 -0
  30. package/lib/memory/index.ts +3 -13
  31. package/lib/memory/memory-mesh.d.ts +151 -93
  32. package/lib/memory/memory-mesh.js +1 -0
  33. package/lib/memory/memory-mesh.ts +1406 -1692
  34. package/lib/memory/memory-translator.d.ts +1 -6
  35. package/lib/memory/memory-translator.js +1 -0
  36. package/lib/memory/memory-translator.ts +96 -128
  37. package/lib/memory/schema.d.ts +29 -10
  38. package/lib/memory/schema.js +1 -0
  39. package/lib/memory/schema.ts +102 -185
  40. package/lib/memory/scorer.d.ts +3 -4
  41. package/lib/memory/scorer.js +1 -0
  42. package/lib/memory/scorer.ts +69 -86
  43. package/lib/memory/search/index.js +1 -0
  44. package/lib/memory/search/index.ts +1 -0
  45. package/lib/memory/search/keyword-search.d.ts +10 -26
  46. package/lib/memory/search/keyword-search.js +1 -0
  47. package/lib/memory/search/keyword-search.ts +123 -161
  48. package/lib/scrubber/config/defaults.d.ts +39 -46
  49. package/lib/scrubber/config/defaults.js +1 -0
  50. package/lib/scrubber/config/defaults.ts +50 -112
  51. package/lib/scrubber/errors/scrubber-error.d.ts +22 -0
  52. package/lib/scrubber/errors/scrubber-error.js +39 -0
  53. package/lib/scrubber/errors/scrubber-error.ts +44 -0
  54. package/lib/scrubber/index.d.ts +0 -1
  55. package/lib/scrubber/index.js +1 -0
  56. package/lib/scrubber/index.ts +1 -2
  57. package/lib/scrubber/scrubber.d.ts +14 -31
  58. package/lib/scrubber/scrubber.js +1 -0
  59. package/lib/scrubber/scrubber.ts +93 -152
  60. package/lib/scrubber/stages/chunker.d.ts +22 -10
  61. package/lib/scrubber/stages/chunker.js +86 -0
  62. package/lib/scrubber/stages/chunker.ts +104 -0
  63. package/lib/scrubber/stages/metadata-annotator.d.ts +14 -15
  64. package/lib/scrubber/stages/metadata-annotator.js +64 -0
  65. package/lib/scrubber/stages/metadata-annotator.ts +75 -0
  66. package/lib/scrubber/stages/normalizer.d.ts +13 -10
  67. package/lib/scrubber/stages/normalizer.js +51 -0
  68. package/lib/scrubber/stages/normalizer.ts +60 -0
  69. package/lib/scrubber/stages/semantic-filter.d.ts +13 -10
  70. package/lib/scrubber/stages/semantic-filter.js +51 -0
  71. package/lib/scrubber/stages/semantic-filter.ts +62 -0
  72. package/lib/scrubber/stages/structural-cleaner.d.ts +15 -10
  73. package/lib/scrubber/stages/structural-cleaner.js +73 -0
  74. package/lib/scrubber/stages/structural-cleaner.ts +83 -0
  75. package/lib/scrubber/stages/validator.d.ts +14 -15
  76. package/lib/scrubber/stages/validator.js +56 -0
  77. package/lib/scrubber/stages/validator.ts +67 -0
  78. package/lib/scrubber/telemetry.d.ts +20 -27
  79. package/lib/scrubber/telemetry.js +1 -0
  80. package/lib/scrubber/telemetry.ts +53 -90
  81. package/lib/scrubber/utils/hash.d.ts +14 -0
  82. package/lib/scrubber/utils/hash.js +37 -0
  83. package/lib/scrubber/utils/hash.ts +40 -0
  84. package/lib/scrubber/utils/html-parser.d.ts +14 -0
  85. package/lib/scrubber/utils/html-parser.js +38 -0
  86. package/lib/scrubber/utils/html-parser.ts +46 -0
  87. package/lib/scrubber/utils/pattern-matcher.d.ts +12 -0
  88. package/lib/scrubber/utils/pattern-matcher.js +54 -0
  89. package/lib/scrubber/utils/pattern-matcher.ts +64 -0
  90. package/lib/scrubber/utils/token-counter.d.ts +18 -0
  91. package/lib/scrubber/utils/token-counter.js +30 -0
  92. package/lib/scrubber/utils/token-counter.ts +32 -0
  93. package/lib/utils/logger.d.ts +1 -11
  94. package/lib/utils/logger.js +1 -0
  95. package/lib/utils/logger.ts +43 -63
  96. package/lib/utils/skill-metadata.d.ts +6 -14
  97. package/lib/utils/skill-metadata.js +1 -0
  98. package/lib/utils/skill-metadata.ts +89 -103
  99. package/lib/yamo/emitter.d.ts +8 -35
  100. package/lib/yamo/emitter.js +1 -0
  101. package/lib/yamo/emitter.ts +77 -155
  102. package/lib/yamo/index.d.ts +14 -0
  103. package/lib/yamo/index.js +14 -0
  104. package/lib/yamo/index.ts +16 -0
  105. package/lib/yamo/schema.d.ts +8 -10
  106. package/lib/yamo/schema.js +1 -0
  107. package/lib/yamo/schema.ts +82 -114
  108. package/package.json +5 -2
@@ -2,8 +2,8 @@
2
2
  * YAMO Brain Module
3
3
  * Semantic memory mesh with vector search capabilities
4
4
  */
5
- export { MemoryMesh, run, type MemoryMeshOptions, type MemoryEntry, type SearchResult, type CacheEntry, } from "./memory-mesh.js";
5
+ export { MemoryMesh, run, } from "./memory-mesh.js";
6
6
  export { MemoryContextManager } from "./context-manager.js";
7
- export { LanceDBClient, type LanceDBDriver } from "./adapters/client.js";
7
+ export { LanceDBClient } from "./adapters/client.js";
8
8
  export * from "./embeddings/index.js";
9
9
  export * from "./search/index.js";
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * YAMO Brain Module
3
4
  * Semantic memory mesh with vector search capabilities
@@ -1,20 +1,10 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * YAMO Brain Module
3
4
  * Semantic memory mesh with vector search capabilities
4
5
  */
5
-
6
- export {
7
- MemoryMesh,
8
- run,
9
- type MemoryMeshOptions,
10
- type MemoryEntry,
11
- type SearchResult,
12
- type CacheEntry,
13
- } from "./memory-mesh.js";
14
-
6
+ export { MemoryMesh, run, } from "./memory-mesh.js";
15
7
  export { MemoryContextManager } from "./context-manager.js";
16
-
17
- export { LanceDBClient, type LanceDBDriver } from "./adapters/client.js";
18
-
8
+ export { LanceDBClient } from "./adapters/client.js";
19
9
  export * from "./embeddings/index.js";
20
10
  export * from "./search/index.js";
@@ -1,85 +1,35 @@
1
- /**
2
- * Memory Mesh - Vector Memory Storage with LanceDB
3
- * Provides persistent semantic memory for YAMO OS using LanceDB backend
4
- *
5
- * CLI Interface:
6
- * node tools/memory_mesh.js ingest '{"content": "...", "metadata": {...}}'
7
- * node tools/memory_mesh.js search '{"query": "...", "limit": 10}'
8
- * node tools/memory_mesh.js get '{"id": "..."}'
9
- * node tools/memory_mesh.js delete '{"id": "..."}'
10
- * node tools/memory_mesh.js stats '{}'
11
- *
12
- * Also supports STDIN input for YAMO skill compatibility:
13
- * echo '{"action": "ingest", "content": "..."}' | node tools/memory_mesh.js
14
- */
15
- import { LanceDBClient } from "./adapters/client.js";
16
- import { Config } from "./adapters/config.js";
17
- import EmbeddingFactory from "./embeddings/factory.js";
18
- import { Scrubber } from "../scrubber/scrubber.js";
19
- import { KeywordSearch } from "./search/keyword-search.js";
20
- import { LLMClient } from "../llm/client.js";
21
- import * as lancedb from "@lancedb/lancedb";
22
- export interface MemoryMeshOptions {
23
- enableYamo?: boolean;
24
- enableLLM?: boolean;
25
- enableMemory?: boolean;
26
- agentId?: string;
27
- llmProvider?: string;
28
- llmApiKey?: string;
29
- llmModel?: string;
30
- llmMaxTokens?: number;
31
- skill_directories?: string | string[];
32
- dbDir?: string;
33
- }
34
- export interface MemoryEntry {
35
- id: string;
36
- content: string;
37
- vector: number[];
38
- metadata: string;
39
- }
40
- export interface SearchResult extends MemoryEntry {
41
- score: number;
42
- [key: string]: any;
43
- }
44
- export interface CacheEntry {
45
- result: SearchResult[];
46
- timestamp: number;
47
- }
48
1
  /**
49
2
  * MemoryMesh class for managing vector memory storage
50
3
  */
51
4
  export declare class MemoryMesh {
52
- client: LanceDBClient | null;
53
- config: Config | null;
54
- embeddingFactory: EmbeddingFactory;
55
- keywordSearch: KeywordSearch;
56
- isInitialized: boolean;
57
- vectorDimension: number;
58
- enableYamo: boolean;
59
- enableLLM: boolean;
60
- enableMemory: boolean;
61
- agentId: string;
62
- yamoTable: lancedb.Table | null;
63
- skillTable: lancedb.Table | null;
64
- llmClient: LLMClient | null;
65
- scrubber: Scrubber;
66
- queryCache: Map<string, CacheEntry>;
67
- cacheConfig: {
68
- maxSize: number;
69
- ttlMs: number;
70
- };
71
- skillDirectories: string[];
72
- dbDir?: string;
5
+ client: any;
6
+ config: any;
7
+ embeddingFactory: any;
8
+ keywordSearch: any;
9
+ isInitialized: any;
10
+ vectorDimension: any;
11
+ enableYamo: any;
12
+ enableLLM: any;
13
+ enableMemory: any;
14
+ agentId: any;
15
+ yamoTable: any;
16
+ skillTable: any;
17
+ llmClient: any;
18
+ scrubber: any;
19
+ queryCache: any;
20
+ cacheConfig: any;
21
+ skillDirectories: any;
22
+ dbDir: any;
73
23
  /**
74
24
  * Create a new MemoryMesh instance
75
25
  * @param {Object} [options={}]
76
26
  */
77
- constructor(options?: MemoryMeshOptions);
27
+ constructor(options?: {});
78
28
  /**
79
29
  * Generate a cache key from query and options
80
30
  * @private
81
31
  */
82
- _generateCacheKey(query: string, options?: any): string;
32
+ _generateCacheKey(query: any, options?: {}): string;
83
33
  /**
84
34
  * Get cached result if valid
85
35
  * @private
@@ -88,12 +38,12 @@ export declare class MemoryMesh {
88
38
  * where another operation could observe the key as missing. We use a try-finally
89
39
  * pattern to ensure atomicity at the application level.
90
40
  */
91
- _getCachedResult(key: string): SearchResult[] | null;
41
+ _getCachedResult(key: any): any;
92
42
  /**
93
43
  * Cache a search result
94
44
  * @private
95
45
  */
96
- _cacheResult(key: string, result: SearchResult[]): void;
46
+ _cacheResult(key: any, result: any): void;
97
47
  /**
98
48
  * Clear all cached results
99
49
  */
@@ -101,17 +51,21 @@ export declare class MemoryMesh {
101
51
  /**
102
52
  * Get cache statistics
103
53
  */
104
- getCacheStats(): any;
54
+ getCacheStats(): {
55
+ size: any;
56
+ maxSize: any;
57
+ ttlMs: any;
58
+ };
105
59
  /**
106
60
  * Validate and sanitize metadata to prevent prototype pollution
107
61
  * @private
108
62
  */
109
- _validateMetadata(metadata: any): Record<string, any>;
63
+ _validateMetadata(metadata: any): {};
110
64
  /**
111
65
  * Sanitize and validate content before storage
112
66
  * @private
113
67
  */
114
- _sanitizeContent(content: string): string;
68
+ _sanitizeContent(content: any): string;
115
69
  /**
116
70
  * Initialize the LanceDB client
117
71
  */
@@ -145,46 +99,116 @@ export declare class MemoryMesh {
145
99
  * @throws {Error} If embedding generation fails
146
100
  * @throws {Error} If database client is not initialized
147
101
  */
148
- add(content: string, metadata?: any): Promise<any>;
102
+ add(content: any, metadata?: {}): Promise<{
103
+ id: any;
104
+ content: string;
105
+ metadata: {};
106
+ created_at: string;
107
+ }>;
149
108
  /**
150
109
  * Reflect on recent memories
151
110
  */
152
- reflect(options?: any): Promise<any>;
111
+ reflect(options?: {}): Promise<{
112
+ topic: any;
113
+ count: number;
114
+ context: {
115
+ content: any;
116
+ type: any;
117
+ id: any;
118
+ }[];
119
+ prompt: string;
120
+ id?: undefined;
121
+ reflection?: undefined;
122
+ confidence?: undefined;
123
+ sourceMemoryCount?: undefined;
124
+ yamoBlock?: undefined;
125
+ createdAt?: undefined;
126
+ } | {
127
+ id: string;
128
+ topic: any;
129
+ reflection: string;
130
+ confidence: number;
131
+ sourceMemoryCount: number;
132
+ yamoBlock: any;
133
+ createdAt: string;
134
+ count?: undefined;
135
+ context?: undefined;
136
+ prompt?: undefined;
137
+ }>;
153
138
  /**
154
139
  * Ingest synthesized skill
155
140
  * @param sourceFilePath - If provided, skip file write (file already exists)
156
141
  */
157
- ingestSkill(yamoText: string, metadata?: any, sourceFilePath?: string): Promise<any>;
142
+ ingestSkill(yamoText: any, metadata: {}, sourceFilePath: any): Promise<{
143
+ id: string;
144
+ name: any;
145
+ intent: any;
146
+ }>;
158
147
  /**
159
148
  * Recursive Skill Synthesis
160
149
  */
161
- synthesize(options?: any): Promise<any>;
150
+ synthesize(options?: {}): Promise<{
151
+ status: string;
152
+ analysis: string;
153
+ skill_id: string;
154
+ skill_name: any;
155
+ yamo_text: string;
156
+ error?: undefined;
157
+ } | {
158
+ status: string;
159
+ analysis: string;
160
+ skill_name: any;
161
+ skill_id?: undefined;
162
+ yamo_text?: undefined;
163
+ error?: undefined;
164
+ } | {
165
+ status: string;
166
+ error: any;
167
+ analysis: string;
168
+ skill_id?: undefined;
169
+ skill_name?: undefined;
170
+ yamo_text?: undefined;
171
+ } | {
172
+ status: string;
173
+ analysis: string;
174
+ skill_id?: undefined;
175
+ skill_name?: undefined;
176
+ yamo_text?: undefined;
177
+ error?: undefined;
178
+ }>;
162
179
  /**
163
180
  * Update reliability
164
181
  */
165
- updateSkillReliability(id: string, success: boolean): Promise<any>;
182
+ updateSkillReliability(id: any, success: any): Promise<{
183
+ id: any;
184
+ reliability: any;
185
+ use_count: any;
186
+ }>;
166
187
  /**
167
188
  * Prune skills
168
189
  */
169
- pruneSkills(threshold?: number): Promise<any>;
190
+ pruneSkills(threshold?: number): Promise<{
191
+ pruned_count: number;
192
+ total_remaining: number;
193
+ }>;
170
194
  /**
171
195
  * List all synthesized skills
172
196
  * @param {Object} [options={}] - Search options
173
197
  * @returns {Promise<Array>} Normalized skill results
174
198
  */
175
- listSkills(options?: any): Promise<any[]>;
199
+ listSkills(options?: {}): Promise<any>;
176
200
  /**
177
201
  * Search for synthesized skills by semantic intent
178
202
  * @param {string} query - Search query (intent description)
179
203
  * @param {Object} [options={}] - Search options
180
204
  * @returns {Promise<Array>} Normalized skill results
181
205
  */
182
- searchSkills(query: string, options?: any): Promise<any[]>;
206
+ searchSkills(query: any, options?: {}): Promise<any>;
183
207
  /**
184
208
  * Get recent YAMO logs for the heartbeat
185
209
  * @param {Object} options
186
210
  */
187
- getYamoLog(options?: any): Promise<any[]>;
211
+ getYamoLog(options?: {}): Promise<any>;
188
212
  /**
189
213
  * Emit a YAMO block to the YAMO blocks table
190
214
  * @private
@@ -192,7 +216,7 @@ export declare class MemoryMesh {
192
216
  * Note: YAMO emission is non-critical - failures are logged but don't throw
193
217
  * to prevent disrupting the main operation.
194
218
  */
195
- _emitYamoBlock(operationType: string, memoryId: string | undefined, yamoText: string): Promise<void>;
219
+ _emitYamoBlock(operationType: any, memoryId: any, yamoText: any): Promise<void>;
196
220
  /**
197
221
  * Search memory using hybrid vector + keyword search with Reciprocal Rank Fusion (RRF).
198
222
  *
@@ -232,19 +256,53 @@ export declare class MemoryMesh {
232
256
  * @throws {Error} If embedding generation fails
233
257
  * @throws {Error} If database client is not initialized
234
258
  */
235
- search(query: string, options?: any): Promise<SearchResult[]>;
236
- _normalizeScores(results: SearchResult[]): SearchResult[];
259
+ search(query: any, options?: {}): Promise<any>;
260
+ _normalizeScores(results: any): any;
237
261
  /**
238
262
  * Tokenize query for keyword matching (private helper for searchSkills)
239
263
  * Converts text to lowercase tokens, filtering out short tokens and punctuation.
240
264
  * Handles camelCase/PascalCase by splitting on uppercase letters.
241
265
  */
242
- private _tokenizeQuery;
243
- formatResults(results: SearchResult[]): string;
244
- get(id: string): Promise<any>;
245
- getAll(options?: any): Promise<any>;
246
- stats(): Promise<any>;
247
- _parseEmbeddingConfig(): any[];
266
+ _tokenizeQuery(text: any): any;
267
+ formatResults(results: any): string;
268
+ get(id: any): Promise<{
269
+ id: any;
270
+ content: any;
271
+ metadata: any;
272
+ created_at: any;
273
+ updated_at: any;
274
+ }>;
275
+ getAll(options?: {}): Promise<any>;
276
+ stats(): Promise<{
277
+ count: number;
278
+ totalMemories: number;
279
+ totalSkills: number;
280
+ tableName: string;
281
+ uri: string;
282
+ isConnected: boolean;
283
+ embedding: {
284
+ configured: boolean;
285
+ primary: any;
286
+ fallbacks: any[];
287
+ };
288
+ status: string;
289
+ } | {
290
+ count: any;
291
+ totalMemories: any;
292
+ totalSkills: number;
293
+ tableName: any;
294
+ uri: any;
295
+ isConnected: any;
296
+ embedding: any;
297
+ status?: undefined;
298
+ }>;
299
+ _parseEmbeddingConfig(): {
300
+ modelType: string;
301
+ modelName: string;
302
+ dimension: number;
303
+ priority: number;
304
+ apiKey: string;
305
+ }[];
248
306
  /**
249
307
  * Close database connections and release resources
250
308
  *
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Memory Mesh - Vector Memory Storage with LanceDB
3
4
  * Provides persistent semantic memory for YAMO OS using LanceDB backend