@yamo/memory-mesh 2.3.2 → 3.0.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.
Files changed (102) hide show
  1. package/bin/memory_mesh.js +1 -1
  2. package/lib/llm/client.d.ts +111 -0
  3. package/lib/llm/client.js +299 -357
  4. package/lib/llm/client.ts +413 -0
  5. package/lib/llm/index.d.ts +17 -0
  6. package/lib/llm/index.js +15 -8
  7. package/lib/llm/index.ts +19 -0
  8. package/lib/memory/adapters/client.d.ts +183 -0
  9. package/lib/memory/adapters/client.js +518 -0
  10. package/lib/memory/adapters/client.ts +678 -0
  11. package/lib/memory/adapters/config.d.ts +137 -0
  12. package/lib/memory/adapters/config.js +189 -0
  13. package/lib/memory/adapters/config.ts +259 -0
  14. package/lib/memory/adapters/errors.d.ts +76 -0
  15. package/lib/memory/adapters/errors.js +128 -0
  16. package/lib/memory/adapters/errors.ts +166 -0
  17. package/lib/memory/context-manager.d.ts +44 -0
  18. package/lib/memory/context-manager.js +344 -0
  19. package/lib/memory/context-manager.ts +432 -0
  20. package/lib/memory/embeddings/factory.d.ts +59 -0
  21. package/lib/memory/embeddings/factory.js +148 -0
  22. package/lib/{embeddings/factory.js → memory/embeddings/factory.ts} +69 -28
  23. package/lib/memory/embeddings/index.d.ts +2 -0
  24. package/lib/memory/embeddings/index.js +2 -0
  25. package/lib/memory/embeddings/index.ts +2 -0
  26. package/lib/memory/embeddings/service.d.ts +164 -0
  27. package/lib/memory/embeddings/service.js +515 -0
  28. package/lib/{embeddings/service.js → memory/embeddings/service.ts} +223 -156
  29. package/lib/memory/index.d.ts +9 -0
  30. package/lib/memory/index.js +9 -1
  31. package/lib/memory/index.ts +20 -0
  32. package/lib/memory/memory-mesh.d.ts +274 -0
  33. package/lib/memory/memory-mesh.js +1469 -678
  34. package/lib/memory/memory-mesh.ts +1803 -0
  35. package/lib/memory/memory-translator.d.ts +19 -0
  36. package/lib/memory/memory-translator.js +125 -0
  37. package/lib/memory/memory-translator.ts +158 -0
  38. package/lib/memory/schema.d.ts +111 -0
  39. package/lib/memory/schema.js +183 -0
  40. package/lib/memory/schema.ts +267 -0
  41. package/lib/memory/scorer.d.ts +26 -0
  42. package/lib/memory/scorer.js +77 -0
  43. package/lib/memory/scorer.ts +95 -0
  44. package/lib/memory/search/index.d.ts +1 -0
  45. package/lib/memory/search/index.js +1 -0
  46. package/lib/memory/search/index.ts +1 -0
  47. package/lib/memory/search/keyword-search.d.ts +62 -0
  48. package/lib/memory/search/keyword-search.js +135 -0
  49. package/lib/{search/keyword-search.js → memory/search/keyword-search.ts} +66 -36
  50. package/lib/scrubber/config/defaults.d.ts +53 -0
  51. package/lib/scrubber/config/defaults.js +49 -57
  52. package/lib/scrubber/config/defaults.ts +117 -0
  53. package/lib/scrubber/index.d.ts +6 -0
  54. package/lib/scrubber/index.js +3 -23
  55. package/lib/scrubber/index.ts +7 -0
  56. package/lib/scrubber/scrubber.d.ts +61 -0
  57. package/lib/scrubber/scrubber.js +99 -121
  58. package/lib/scrubber/scrubber.ts +168 -0
  59. package/lib/scrubber/stages/chunker.d.ts +13 -0
  60. package/lib/scrubber/stages/metadata-annotator.d.ts +18 -0
  61. package/lib/scrubber/stages/normalizer.d.ts +13 -0
  62. package/lib/scrubber/stages/semantic-filter.d.ts +13 -0
  63. package/lib/scrubber/stages/structural-cleaner.d.ts +13 -0
  64. package/lib/scrubber/stages/validator.d.ts +18 -0
  65. package/lib/scrubber/telemetry.d.ts +36 -0
  66. package/lib/scrubber/telemetry.js +53 -58
  67. package/lib/scrubber/telemetry.ts +99 -0
  68. package/lib/utils/logger.d.ts +29 -0
  69. package/lib/utils/logger.js +64 -0
  70. package/lib/utils/logger.ts +85 -0
  71. package/lib/utils/skill-metadata.d.ts +32 -0
  72. package/lib/utils/skill-metadata.js +132 -0
  73. package/lib/utils/skill-metadata.ts +147 -0
  74. package/lib/yamo/emitter.d.ts +73 -0
  75. package/lib/yamo/emitter.js +78 -143
  76. package/lib/yamo/emitter.ts +249 -0
  77. package/lib/yamo/schema.d.ts +58 -0
  78. package/lib/yamo/schema.js +81 -108
  79. package/lib/yamo/schema.ts +165 -0
  80. package/package.json +11 -8
  81. package/index.d.ts +0 -111
  82. package/lib/embeddings/index.js +0 -2
  83. package/lib/index.js +0 -6
  84. package/lib/lancedb/client.js +0 -633
  85. package/lib/lancedb/config.js +0 -215
  86. package/lib/lancedb/errors.js +0 -144
  87. package/lib/lancedb/index.js +0 -4
  88. package/lib/lancedb/schema.js +0 -217
  89. package/lib/scrubber/errors/scrubber-error.js +0 -43
  90. package/lib/scrubber/stages/chunker.js +0 -103
  91. package/lib/scrubber/stages/metadata-annotator.js +0 -74
  92. package/lib/scrubber/stages/normalizer.js +0 -59
  93. package/lib/scrubber/stages/semantic-filter.js +0 -61
  94. package/lib/scrubber/stages/structural-cleaner.js +0 -82
  95. package/lib/scrubber/stages/validator.js +0 -66
  96. package/lib/scrubber/utils/hash.js +0 -39
  97. package/lib/scrubber/utils/html-parser.js +0 -45
  98. package/lib/scrubber/utils/pattern-matcher.js +0 -63
  99. package/lib/scrubber/utils/token-counter.js +0 -31
  100. package/lib/search/index.js +0 -1
  101. package/lib/utils/index.js +0 -1
  102. package/lib/yamo/index.js +0 -15
@@ -8,40 +8,23 @@
8
8
  *
9
9
  * Reference: Hindsight project's yamo_integration.py
10
10
  */
11
-
12
11
  /**
13
12
  * YamoEmitter class for building YAMO protocol blocks
14
13
  * YAMO (Yet Another Multi-agent Orchestration) blocks provide
15
14
  * structured reasoning traces for AI agent operations.
16
15
  */
17
16
  export class YamoEmitter {
18
- /**
19
- * Build a YAMO block for reflect operation
20
- * Reflect operations synthesize insights from existing memories
21
- *
22
- * @param {Object} params - Block parameters
23
- * @param {string} [params.topic] - Topic of reflection
24
- * @param {number} params.memoryCount - Number of memories considered
25
- * @param {string} [params.agentId='default'] - Agent identifier
26
- * @param {string} params.reflection - Generated reflection text
27
- * @param {number} [params.confidence=0.8] - Confidence score (0-1)
28
- * @returns {string} Formatted YAMO block
29
- */
30
- static buildReflectBlock(params) {
31
- const {
32
- topic,
33
- memoryCount,
34
- agentId = 'default',
35
- reflection,
36
- confidence = 0.8
37
- } = params;
38
-
39
- const timestamp = new Date().toISOString();
40
-
41
- return `agent: MemoryMesh_${agentId};
17
+ /**
18
+ * Build a YAMO block for reflect operation
19
+ * Reflect operations synthesize insights from existing memories
20
+ */
21
+ static buildReflectBlock(params) {
22
+ const { topic, memoryCount, agentId = "default", reflection, confidence = 0.8, } = params;
23
+ const timestamp = new Date().toISOString();
24
+ return `agent: MemoryMesh_${agentId};
42
25
  intent: synthesize_insights_from_context;
43
26
  context:
44
- topic;${topic || 'general'};
27
+ topic;${topic || "general"};
45
28
  memory_count;${memoryCount};
46
29
  timestamp;${timestamp};
47
30
  constraints:
@@ -57,38 +40,18 @@ meta:
57
40
  log: reflection_generated;timestamp;${timestamp};memories;${memoryCount};
58
41
  handoff: End;
59
42
  `;
60
- }
61
-
62
- /**
63
- * Build a YAMO block for retain (add) operation
64
- * Retain operations store new memories into the system
65
- *
66
- * @param {Object} params - Block parameters
67
- * @param {string} params.content - Memory content
68
- * @param {Object} [params.metadata={}] - Memory metadata
69
- * @param {string} params.id - Memory ID
70
- * @param {string} [params.agentId='default'] - Agent identifier
71
- * @param {string} [params.memoryType='event'] - Type of memory
72
- * @returns {string} Formatted YAMO block
73
- */
74
- static buildRetainBlock(params) {
75
- const {
76
- content,
77
- metadata = {},
78
- id,
79
- agentId = 'default',
80
- memoryType = 'event'
81
- } = params;
82
-
83
- const timestamp = new Date().toISOString();
84
- const contentPreview = content.length > 100
85
- ? content.substring(0, 100) + '...'
86
- : content;
87
-
88
- // Escape semicolons in content for YAMO format
89
- const escapedContent = contentPreview.replace(/;/g, ',');
90
-
91
- return `agent: MemoryMesh_${agentId};
43
+ }
44
+ /**
45
+ * Build a YAMO block for retain (add) operation
46
+ * Retain operations store new memories into the system
47
+ */
48
+ static buildRetainBlock(params) {
49
+ const { content, metadata: _metadata = {}, id, agentId = "default", memoryType = "event", } = params;
50
+ const timestamp = new Date().toISOString();
51
+ const contentPreview = content.length > 100 ? `${content.substring(0, 100)}...` : content;
52
+ // Escape semicolons in content for YAMO format
53
+ const escapedContent = contentPreview.replace(/;/g, ",");
54
+ return `agent: MemoryMesh_${agentId};
92
55
  intent: store_memory_for_future_retrieval;
93
56
  context:
94
57
  memory_id;${id};
@@ -108,33 +71,16 @@ meta:
108
71
  log: memory_retained;timestamp;${timestamp};id;${id};type;${memoryType};
109
72
  handoff: End;
110
73
  `;
111
- }
112
-
113
- /**
114
- * Build a YAMO block for recall (search) operation
115
- * Recall operations retrieve memories based on semantic similarity
116
- *
117
- * @param {Object} params - Block parameters
118
- * @param {string} params.query - Search query
119
- * @param {number} params.resultCount - Number of results returned
120
- * @param {number} [params.limit=10] - Maximum requested results
121
- * @param {string} [params.agentId='default'] - Agent identifier
122
- * @param {string} [params.searchType='semantic'] - Type of search
123
- * @returns {string} Formatted YAMO block
124
- */
125
- static buildRecallBlock(params) {
126
- const {
127
- query,
128
- resultCount,
129
- limit = 10,
130
- agentId = 'default',
131
- searchType = 'semantic'
132
- } = params;
133
-
134
- const timestamp = new Date().toISOString();
135
- const recallRatio = resultCount > 0 ? (resultCount / limit).toFixed(2) : '0.00';
136
-
137
- return `agent: MemoryMesh_${agentId};
74
+ }
75
+ /**
76
+ * Build a YAMO block for recall (search) operation
77
+ * Recall operations retrieve memories based on semantic similarity
78
+ */
79
+ static buildRecallBlock(params) {
80
+ const { query, resultCount, limit = 10, agentId = "default", searchType = "semantic", } = params;
81
+ const timestamp = new Date().toISOString();
82
+ const recallRatio = resultCount > 0 ? (resultCount / limit).toFixed(2) : "0.00";
83
+ return `agent: MemoryMesh_${agentId};
138
84
  intent: retrieve_relevant_memories;
139
85
  context:
140
86
  query;${query};
@@ -150,32 +96,19 @@ output:
150
96
  meta:
151
97
  rationale;Semantic search finds similar content by vector similarity;
152
98
  observation;${resultCount} memories found matching query;
153
- confidence;${resultCount > 0 ? '0.9' : '0.5'};
99
+ confidence;${resultCount > 0 ? "0.9" : "0.5"};
154
100
  log: memory_recalled;timestamp;${timestamp};results;${resultCount};query;${query};
155
101
  handoff: End;
156
102
  `;
157
- }
158
-
159
- /**
160
- * Build a YAMO block for delete operation (optional)
161
- * Delete operations remove memories from the system
162
- *
163
- * @param {Object} params - Block parameters
164
- * @param {string} params.id - Memory ID being deleted
165
- * @param {string} [params.agentId='default'] - Agent identifier
166
- * @param {string} [params.reason='user_request'] - Reason for deletion
167
- * @returns {string} Formatted YAMO block
168
- */
169
- static buildDeleteBlock(params) {
170
- const {
171
- id,
172
- agentId = 'default',
173
- reason = 'user_request'
174
- } = params;
175
-
176
- const timestamp = new Date().toISOString();
177
-
178
- return `agent: MemoryMesh_${agentId};
103
+ }
104
+ /**
105
+ * Build a YAMO block for delete operation (optional)
106
+ * Delete operations remove memories from the system
107
+ */
108
+ static buildDeleteBlock(params) {
109
+ const { id, agentId = "default", reason = "user_request" } = params;
110
+ const timestamp = new Date().toISOString();
111
+ return `agent: MemoryMesh_${agentId};
179
112
  intent: remove_memory_from_storage;
180
113
  context:
181
114
  memory_id;${id};
@@ -193,43 +126,45 @@ meta:
193
126
  log: memory_deleted;timestamp;${timestamp};id;${id};
194
127
  handoff: End;
195
128
  `;
196
- }
197
-
198
- /**
199
- * Validate a YAMO block structure
200
- * Checks for required sections and proper formatting
201
- *
202
- * @param {string} yamoBlock - YAMO block to validate
203
- * @returns {Object} Validation result { valid, errors }
204
- */
205
- static validateBlock(yamoBlock) {
206
- const errors = [];
207
-
208
- // Check for required sections
209
- const requiredSections = ['agent:', 'intent:', 'context:', 'output:', 'log:'];
210
- for (const section of requiredSections) {
211
- if (!yamoBlock.includes(section)) {
212
- errors.push(`Missing required section: ${section}`);
213
- }
214
129
  }
215
-
216
- // Check for semicolon termination
217
- const lines = yamoBlock.split('\n');
218
- for (const line of lines) {
219
- const trimmed = line.trim();
220
- if (trimmed.length > 0 && !trimmed.startsWith('//') && !trimmed.endsWith(';')) {
221
- // Allow empty lines and comments
222
- if (trimmed && !trimmed.startsWith('agent:') && !trimmed.startsWith('handoff:')) {
223
- errors.push(`Line not semicolon-terminated: ${trimmed.substring(0, 50)}`);
130
+ /**
131
+ * Validate a YAMO block structure
132
+ * Checks for required sections and proper formatting
133
+ */
134
+ static validateBlock(yamoBlock) {
135
+ const errors = [];
136
+ // Check for required sections
137
+ const requiredSections = [
138
+ "agent:",
139
+ "intent:",
140
+ "context:",
141
+ "output:",
142
+ "log:",
143
+ ];
144
+ for (const section of requiredSections) {
145
+ if (!yamoBlock.includes(section)) {
146
+ errors.push(`Missing required section: ${section}`);
147
+ }
148
+ }
149
+ // Check for semicolon termination
150
+ const lines = yamoBlock.split("\n");
151
+ for (const line of lines) {
152
+ const trimmed = line.trim();
153
+ if (trimmed.length > 0 &&
154
+ !trimmed.startsWith("//") &&
155
+ !trimmed.endsWith(";")) {
156
+ // Allow empty lines and comments
157
+ if (trimmed &&
158
+ !trimmed.startsWith("agent:") &&
159
+ !trimmed.startsWith("handoff:")) {
160
+ errors.push(`Line not semicolon-terminated: ${trimmed.substring(0, 50)}`);
161
+ }
162
+ }
224
163
  }
225
- }
164
+ return {
165
+ valid: errors.length === 0,
166
+ errors,
167
+ };
226
168
  }
227
-
228
- return {
229
- valid: errors.length === 0,
230
- errors
231
- };
232
- }
233
169
  }
234
-
235
170
  export default YamoEmitter;
@@ -0,0 +1,249 @@
1
+ /**
2
+ * YAMO Emitter - Constructs structured YAMO blocks for auditability
3
+ *
4
+ * Based on YAMO Protocol specification:
5
+ * - Semicolon-terminated key-value pairs
6
+ * - Agent/Intent/Context/Constraints/Meta/Output structure
7
+ * - Supports reflect, retain, recall operations
8
+ *
9
+ * Reference: Hindsight project's yamo_integration.py
10
+ */
11
+
12
+ export interface ReflectBlockParams {
13
+ topic?: string;
14
+ memoryCount: number;
15
+ agentId?: string;
16
+ reflection: string;
17
+ confidence?: number;
18
+ }
19
+
20
+ export interface RetainBlockParams {
21
+ content: string;
22
+ metadata?: any;
23
+ id: string;
24
+ agentId?: string;
25
+ memoryType?: string;
26
+ }
27
+
28
+ export interface RecallBlockParams {
29
+ query: string;
30
+ resultCount: number;
31
+ limit?: number;
32
+ agentId?: string;
33
+ searchType?: string;
34
+ }
35
+
36
+ export interface DeleteBlockParams {
37
+ id: string;
38
+ agentId?: string;
39
+ reason?: string;
40
+ }
41
+
42
+ export interface ValidationResult {
43
+ valid: boolean;
44
+ errors: string[];
45
+ }
46
+
47
+ /**
48
+ * YamoEmitter class for building YAMO protocol blocks
49
+ * YAMO (Yet Another Multi-agent Orchestration) blocks provide
50
+ * structured reasoning traces for AI agent operations.
51
+ */
52
+ export class YamoEmitter {
53
+ /**
54
+ * Build a YAMO block for reflect operation
55
+ * Reflect operations synthesize insights from existing memories
56
+ */
57
+ static buildReflectBlock(params: ReflectBlockParams): string {
58
+ const {
59
+ topic,
60
+ memoryCount,
61
+ agentId = "default",
62
+ reflection,
63
+ confidence = 0.8,
64
+ } = params;
65
+
66
+ const timestamp = new Date().toISOString();
67
+
68
+ return `agent: MemoryMesh_${agentId};
69
+ intent: synthesize_insights_from_context;
70
+ context:
71
+ topic;${topic || "general"};
72
+ memory_count;${memoryCount};
73
+ timestamp;${timestamp};
74
+ constraints:
75
+ hypothesis;Reflection generates new insights from existing facts;
76
+ priority: high;
77
+ output:
78
+ reflection;${reflection};
79
+ confidence;${confidence};
80
+ meta:
81
+ rationale;Synthesized from ${memoryCount} relevant memories;
82
+ observation;High-level belief formed from pattern recognition;
83
+ confidence;${confidence};
84
+ log: reflection_generated;timestamp;${timestamp};memories;${memoryCount};
85
+ handoff: End;
86
+ `;
87
+ }
88
+
89
+ /**
90
+ * Build a YAMO block for retain (add) operation
91
+ * Retain operations store new memories into the system
92
+ */
93
+ static buildRetainBlock(params: RetainBlockParams): string {
94
+ const {
95
+ content,
96
+ metadata: _metadata = {},
97
+ id,
98
+ agentId = "default",
99
+ memoryType = "event",
100
+ } = params;
101
+
102
+ const timestamp = new Date().toISOString();
103
+ const contentPreview =
104
+ content.length > 100 ? `${content.substring(0, 100)}...` : content;
105
+
106
+ // Escape semicolons in content for YAMO format
107
+ const escapedContent = contentPreview.replace(/;/g, ",");
108
+
109
+ return `agent: MemoryMesh_${agentId};
110
+ intent: store_memory_for_future_retrieval;
111
+ context:
112
+ memory_id;${id};
113
+ memory_type;${memoryType};
114
+ timestamp;${timestamp};
115
+ content_length;${content.length};
116
+ constraints:
117
+ hypothesis;New information should be integrated into world model;
118
+ priority: medium;
119
+ output:
120
+ memory_stored;${id};
121
+ content_preview;${escapedContent};
122
+ meta:
123
+ rationale;Memory persisted for semantic search and retrieval;
124
+ observation;Content vectorized and stored in LanceDB;
125
+ confidence;1.0;
126
+ log: memory_retained;timestamp;${timestamp};id;${id};type;${memoryType};
127
+ handoff: End;
128
+ `;
129
+ }
130
+
131
+ /**
132
+ * Build a YAMO block for recall (search) operation
133
+ * Recall operations retrieve memories based on semantic similarity
134
+ */
135
+ static buildRecallBlock(params: RecallBlockParams): string {
136
+ const {
137
+ query,
138
+ resultCount,
139
+ limit = 10,
140
+ agentId = "default",
141
+ searchType = "semantic",
142
+ } = params;
143
+
144
+ const timestamp = new Date().toISOString();
145
+ const recallRatio =
146
+ resultCount > 0 ? (resultCount / limit).toFixed(2) : "0.00";
147
+
148
+ return `agent: MemoryMesh_${agentId};
149
+ intent: retrieve_relevant_memories;
150
+ context:
151
+ query;${query};
152
+ search_type;${searchType};
153
+ requested_limit;${limit};
154
+ timestamp;${timestamp};
155
+ constraints:
156
+ hypothesis;Relevant memories retrieved based on query;
157
+ priority: high;
158
+ output:
159
+ results_count;${resultCount};
160
+ recall_ratio;${recallRatio};
161
+ meta:
162
+ rationale;Semantic search finds similar content by vector similarity;
163
+ observation;${resultCount} memories found matching query;
164
+ confidence;${resultCount > 0 ? "0.9" : "0.5"};
165
+ log: memory_recalled;timestamp;${timestamp};results;${resultCount};query;${query};
166
+ handoff: End;
167
+ `;
168
+ }
169
+
170
+ /**
171
+ * Build a YAMO block for delete operation (optional)
172
+ * Delete operations remove memories from the system
173
+ */
174
+ static buildDeleteBlock(params: DeleteBlockParams): string {
175
+ const { id, agentId = "default", reason = "user_request" } = params;
176
+
177
+ const timestamp = new Date().toISOString();
178
+
179
+ return `agent: MemoryMesh_${agentId};
180
+ intent: remove_memory_from_storage;
181
+ context:
182
+ memory_id;${id};
183
+ reason;${reason};
184
+ timestamp;${timestamp};
185
+ constraints:
186
+ hypothesis;Memory removal should be traceable for audit;
187
+ priority: low;
188
+ output:
189
+ deleted;${id};
190
+ meta:
191
+ rationale;Memory removed from vector store;
192
+ observation;Deletion recorded for provenance;
193
+ confidence;1.0;
194
+ log: memory_deleted;timestamp;${timestamp};id;${id};
195
+ handoff: End;
196
+ `;
197
+ }
198
+
199
+ /**
200
+ * Validate a YAMO block structure
201
+ * Checks for required sections and proper formatting
202
+ */
203
+ static validateBlock(yamoBlock: string): ValidationResult {
204
+ const errors: string[] = [];
205
+
206
+ // Check for required sections
207
+ const requiredSections = [
208
+ "agent:",
209
+ "intent:",
210
+ "context:",
211
+ "output:",
212
+ "log:",
213
+ ];
214
+ for (const section of requiredSections) {
215
+ if (!yamoBlock.includes(section)) {
216
+ errors.push(`Missing required section: ${section}`);
217
+ }
218
+ }
219
+
220
+ // Check for semicolon termination
221
+ const lines = yamoBlock.split("\n");
222
+ for (const line of lines) {
223
+ const trimmed = line.trim();
224
+ if (
225
+ trimmed.length > 0 &&
226
+ !trimmed.startsWith("//") &&
227
+ !trimmed.endsWith(";")
228
+ ) {
229
+ // Allow empty lines and comments
230
+ if (
231
+ trimmed &&
232
+ !trimmed.startsWith("agent:") &&
233
+ !trimmed.startsWith("handoff:")
234
+ ) {
235
+ errors.push(
236
+ `Line not semicolon-terminated: ${trimmed.substring(0, 50)}`,
237
+ );
238
+ }
239
+ }
240
+ }
241
+
242
+ return {
243
+ valid: errors.length === 0,
244
+ errors,
245
+ };
246
+ }
247
+ }
248
+
249
+ export default YamoEmitter;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * YAMO Block Schema Definitions for yamo-memory-mesh
3
+ * Uses Apache Arrow Schema format for LanceDB JavaScript SDK
4
+ *
5
+ * Provides schema and table creation for YAMO block persistence.
6
+ * YAMO blocks provide audit trail for all memory operations.
7
+ */
8
+ import * as arrow from "apache-arrow";
9
+ import * as lancedb from "@lancedb/lancedb";
10
+ /**
11
+ * Create YAMO blocks table schema
12
+ * Defines the structure for storing YAMO protocol blocks
13
+ * @returns {arrow.Schema} Arrow schema for YAMO blocks
14
+ */
15
+ export declare function createYamoSchema(): arrow.Schema;
16
+ /**
17
+ * Create YAMO blocks table in LanceDB
18
+ * Creates the table if it doesn't exist, opens it if it does
19
+ *
20
+ * @param {lancedb.Connection} db - LanceDB connection
21
+ * @param {string} [tableName='yamo_blocks'] - Name of the table
22
+ * @returns {Promise<lancedb.Table>} The created or opened table
23
+ * @throws {Error} If table creation fails
24
+ */
25
+ export declare function createYamoTable(db: lancedb.Connection, tableName?: string): Promise<lancedb.Table>;
26
+ export interface YamoRecordValidationResult {
27
+ valid: boolean;
28
+ errors: string[];
29
+ }
30
+ /**
31
+ * Validate a YAMO block record before insertion
32
+ * Checks for required fields and valid values
33
+ */
34
+ export declare function validateYamoRecord(record: any): YamoRecordValidationResult;
35
+ /**
36
+ * Generate a YAMO block ID
37
+ * Creates a unique ID for a YAMO block
38
+ *
39
+ * @param {string} operationType - Type of operation
40
+ * @returns {string} Generated YAMO block ID
41
+ */
42
+ export declare function generateYamoId(operationType: string): string;
43
+ /**
44
+ * Check if a table uses YAMO schema
45
+ * Detects if a table has the YAMO block schema structure
46
+ *
47
+ * @param {arrow.Schema} schema - Table schema to check
48
+ * @returns {boolean} True if YAMO schema detected
49
+ */
50
+ export declare function isYamoSchema(schema: arrow.Schema): boolean;
51
+ declare const _default: {
52
+ createYamoSchema: typeof createYamoSchema;
53
+ createYamoTable: typeof createYamoTable;
54
+ validateYamoRecord: typeof validateYamoRecord;
55
+ generateYamoId: typeof generateYamoId;
56
+ isYamoSchema: typeof isYamoSchema;
57
+ };
58
+ export default _default;