@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
@@ -5,121 +5,99 @@
5
5
  * Provides schema and table creation for YAMO block persistence.
6
6
  * YAMO blocks provide audit trail for all memory operations.
7
7
  */
8
-
9
8
  import * as arrow from "apache-arrow";
10
-
11
9
  /**
12
10
  * Create YAMO blocks table schema
13
11
  * Defines the structure for storing YAMO protocol blocks
14
- *
15
- * Schema includes:
16
- * - Core identifiers (id, agent_id)
17
- * - Operation tracking (operation_type, yamo_text)
18
- * - Temporal data (timestamp)
19
- * - Blockchain fields (block_hash, prev_hash) - nullable for future use
20
- * - Metadata (JSON string for flexibility)
21
- *
22
- * @returns {import('apache-arrow').Schema} Arrow schema for YAMO blocks
12
+ * @returns {arrow.Schema} Arrow schema for YAMO blocks
23
13
  */
24
14
  export function createYamoSchema() {
25
- return new arrow.Schema([
26
- // Core identifiers
27
- new arrow.Field('id', new arrow.Utf8(), false),
28
- new arrow.Field('agent_id', new arrow.Utf8(), true),
29
-
30
- // Operation tracking
31
- new arrow.Field('operation_type', new arrow.Utf8(), false), // 'retain', 'recall', 'reflect'
32
- new arrow.Field('yamo_text', new arrow.Utf8(), false), // Full YAMO block content
33
-
34
- // Temporal
35
- new arrow.Field('timestamp', new arrow.Timestamp(arrow.TimeUnit.MILLISECOND), false),
36
-
37
- // Blockchain fields (optional, nullable) - for future anchoring
38
- new arrow.Field('block_hash', new arrow.Utf8(), true), // Hash of this block
39
- new arrow.Field('prev_hash', new arrow.Utf8(), true), // Hash of previous block (for chain)
40
-
41
- // Metadata (JSON string for flexibility)
42
- new arrow.Field('metadata', new arrow.Utf8(), true), // Additional metadata as JSON
43
- ]);
15
+ return new arrow.Schema([
16
+ // Core identifiers
17
+ new arrow.Field("id", new arrow.Utf8(), false),
18
+ new arrow.Field("agent_id", new arrow.Utf8(), true),
19
+ // Operation tracking
20
+ new arrow.Field("operation_type", new arrow.Utf8(), false), // 'retain', 'recall', 'reflect'
21
+ new arrow.Field("yamo_text", new arrow.Utf8(), false), // Full YAMO block content
22
+ // Temporal
23
+ new arrow.Field("timestamp", new arrow.Timestamp(arrow.TimeUnit.MILLISECOND), false),
24
+ // Blockchain fields (optional, nullable) - for future anchoring
25
+ new arrow.Field("block_hash", new arrow.Utf8(), true), // Hash of this block
26
+ new arrow.Field("prev_hash", new arrow.Utf8(), true), // Hash of previous block (for chain)
27
+ // Metadata (JSON string for flexibility)
28
+ new arrow.Field("metadata", new arrow.Utf8(), true), // Additional metadata as JSON
29
+ ]);
44
30
  }
45
-
46
31
  /**
47
32
  * Create YAMO blocks table in LanceDB
48
33
  * Creates the table if it doesn't exist, opens it if it does
49
34
  *
50
- * @param {import('@lancedb/lancedb').Connection} db - LanceDB connection
35
+ * @param {lancedb.Connection} db - LanceDB connection
51
36
  * @param {string} [tableName='yamo_blocks'] - Name of the table
52
- * @returns {Promise<import('@lancedb/lancedb').Table>} The created or opened table
37
+ * @returns {Promise<lancedb.Table>} The created or opened table
53
38
  * @throws {Error} If table creation fails
54
39
  */
55
- export async function createYamoTable(db, tableName = 'yamo_blocks') {
56
- try {
57
- // Check if table already exists
58
- const existingTables = await db.tableNames();
59
-
60
- if (existingTables.includes(tableName)) {
61
- // Table exists, open it
62
- return await db.openTable(tableName);
40
+ export async function createYamoTable(db, tableName = "yamo_blocks") {
41
+ try {
42
+ // Check if table already exists
43
+ const existingTables = await db.tableNames();
44
+ if (existingTables.includes(tableName)) {
45
+ // Table exists, open it
46
+ return await db.openTable(tableName);
47
+ }
48
+ // Create new table with YAMO schema
49
+ const schema = createYamoSchema();
50
+ const table = await db.createTable(tableName, [], { schema });
51
+ return table;
52
+ }
53
+ catch (error) {
54
+ const message = error instanceof Error ? error.message : String(error);
55
+ throw new Error(`Failed to create YAMO table '${tableName}': ${message}`);
63
56
  }
64
-
65
- // Create new table with YAMO schema
66
- const schema = createYamoSchema();
67
- const table = await db.createTable(tableName, [], { schema });
68
-
69
- return table;
70
-
71
- } catch (error) {
72
- const message = error instanceof Error ? error.message : String(error);
73
- throw new Error(`Failed to create YAMO table '${tableName}': ${message}`);
74
- }
75
57
  }
76
-
77
58
  /**
78
59
  * Validate a YAMO block record before insertion
79
60
  * Checks for required fields and valid values
80
- *
81
- * @param {Object} record - Record to validate
82
- * @param {string} record.id - Block ID
83
- * @param {string} record.operation_type - Operation type
84
- * @param {string} record.yamo_text - YAMO block text
85
- * @returns {Object} Validation result { valid, errors }
86
61
  */
87
62
  export function validateYamoRecord(record) {
88
- const errors = [];
89
-
90
- // Check required fields
91
- if (!record.id) {
92
- errors.push('Missing required field: id');
93
- }
94
-
95
- if (!record.operation_type) {
96
- errors.push('Missing required field: operation_type');
97
- } else {
98
- // Validate operation_type is one of the allowed values
99
- const validTypes = ['retain', 'recall', 'reflect'];
100
- if (!validTypes.includes(record.operation_type)) {
101
- errors.push(`Invalid operation_type: ${record.operation_type}. Must be one of: ${validTypes.join(', ')}`);
63
+ const errors = [];
64
+ // Check required fields
65
+ if (!record.id) {
66
+ errors.push("Missing required field: id");
67
+ }
68
+ if (!record.operation_type) {
69
+ errors.push("Missing required field: operation_type");
70
+ }
71
+ else {
72
+ // Validate operation_type is one of the allowed values
73
+ const validTypes = ["retain", "recall", "reflect"];
74
+ if (!validTypes.includes(record.operation_type)) {
75
+ errors.push(`Invalid operation_type: ${record.operation_type}. Must be one of: ${validTypes.join(", ")}`);
76
+ }
77
+ }
78
+ if (!record.yamo_text) {
79
+ errors.push("Missing required field: yamo_text");
102
80
  }
103
- }
104
-
105
- if (!record.yamo_text) {
106
- errors.push('Missing required field: yamo_text');
107
- } else {
108
- // Validate YAMO block format
109
- const requiredSections = ['agent:', 'intent:', 'context:', 'output:', 'log:'];
110
- for (const section of requiredSections) {
111
- if (!record.yamo_text.includes(section)) {
112
- errors.push(`YAMO block missing required section: ${section}`);
113
- }
81
+ else {
82
+ // Validate YAMO block format
83
+ const requiredSections = [
84
+ "agent:",
85
+ "intent:",
86
+ "context:",
87
+ "output:",
88
+ "log:",
89
+ ];
90
+ for (const section of requiredSections) {
91
+ if (!record.yamo_text.includes(section)) {
92
+ errors.push(`YAMO block missing required section: ${section}`);
93
+ }
94
+ }
114
95
  }
115
- }
116
-
117
- return {
118
- valid: errors.length === 0,
119
- errors
120
- };
96
+ return {
97
+ valid: errors.length === 0,
98
+ errors,
99
+ };
121
100
  }
122
-
123
101
  /**
124
102
  * Generate a YAMO block ID
125
103
  * Creates a unique ID for a YAMO block
@@ -128,32 +106,27 @@ export function validateYamoRecord(record) {
128
106
  * @returns {string} Generated YAMO block ID
129
107
  */
130
108
  export function generateYamoId(operationType) {
131
- const timestamp = Date.now();
132
- const random = Math.random().toString(36).substring(2, 10);
133
- return `yamo_${operationType}_${timestamp}_${random}`;
109
+ const timestamp = Date.now();
110
+ const random = Math.random().toString(36).substring(2, 10);
111
+ return `yamo_${operationType}_${timestamp}_${random}`;
134
112
  }
135
-
136
113
  /**
137
114
  * Check if a table uses YAMO schema
138
115
  * Detects if a table has the YAMO block schema structure
139
116
  *
140
- * @param {import('apache-arrow').Schema} schema - Table schema to check
117
+ * @param {arrow.Schema} schema - Table schema to check
141
118
  * @returns {boolean} True if YAMO schema detected
142
119
  */
143
120
  export function isYamoSchema(schema) {
144
- // Check for unique YAMO fields
145
- const hasYamoFields = schema.fields.some(f =>
146
- f.name === 'operation_type' || f.name === 'yamo_text'
147
- );
148
-
149
- return hasYamoFields;
121
+ // Check for unique YAMO fields
122
+ const hasYamoFields = schema.fields.some((f) => f.name === "operation_type" || f.name === "yamo_text");
123
+ return hasYamoFields;
150
124
  }
151
-
152
125
  // Export schema function as default for consistency with lancedb/schema.js
153
126
  export default {
154
- createYamoSchema,
155
- createYamoTable,
156
- validateYamoRecord,
157
- generateYamoId,
158
- isYamoSchema
127
+ createYamoSchema,
128
+ createYamoTable,
129
+ validateYamoRecord,
130
+ generateYamoId,
131
+ isYamoSchema,
159
132
  };
@@ -0,0 +1,165 @@
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
+
9
+ import * as arrow from "apache-arrow";
10
+ import * as lancedb from "@lancedb/lancedb";
11
+
12
+ /**
13
+ * Create YAMO blocks table schema
14
+ * Defines the structure for storing YAMO protocol blocks
15
+ * @returns {arrow.Schema} Arrow schema for YAMO blocks
16
+ */
17
+ export function createYamoSchema(): arrow.Schema {
18
+ return new arrow.Schema([
19
+ // Core identifiers
20
+ new arrow.Field("id", new arrow.Utf8(), false),
21
+ new arrow.Field("agent_id", new arrow.Utf8(), true),
22
+
23
+ // Operation tracking
24
+ new arrow.Field("operation_type", new arrow.Utf8(), false), // 'retain', 'recall', 'reflect'
25
+ new arrow.Field("yamo_text", new arrow.Utf8(), false), // Full YAMO block content
26
+
27
+ // Temporal
28
+ new arrow.Field(
29
+ "timestamp",
30
+ new arrow.Timestamp(arrow.TimeUnit.MILLISECOND),
31
+ false,
32
+ ),
33
+
34
+ // Blockchain fields (optional, nullable) - for future anchoring
35
+ new arrow.Field("block_hash", new arrow.Utf8(), true), // Hash of this block
36
+ new arrow.Field("prev_hash", new arrow.Utf8(), true), // Hash of previous block (for chain)
37
+
38
+ // Metadata (JSON string for flexibility)
39
+ new arrow.Field("metadata", new arrow.Utf8(), true), // Additional metadata as JSON
40
+ ]);
41
+ }
42
+
43
+ /**
44
+ * Create YAMO blocks table in LanceDB
45
+ * Creates the table if it doesn't exist, opens it if it does
46
+ *
47
+ * @param {lancedb.Connection} db - LanceDB connection
48
+ * @param {string} [tableName='yamo_blocks'] - Name of the table
49
+ * @returns {Promise<lancedb.Table>} The created or opened table
50
+ * @throws {Error} If table creation fails
51
+ */
52
+ export async function createYamoTable(
53
+ db: lancedb.Connection,
54
+ tableName: string = "yamo_blocks",
55
+ ): Promise<lancedb.Table> {
56
+ try {
57
+ // Check if table already exists
58
+ const existingTables = await db.tableNames();
59
+
60
+ if (existingTables.includes(tableName)) {
61
+ // Table exists, open it
62
+ return await db.openTable(tableName);
63
+ }
64
+
65
+ // Create new table with YAMO schema
66
+ const schema = createYamoSchema();
67
+ const table = await db.createTable(tableName, [], { schema } as any);
68
+
69
+ return table;
70
+ } catch (error) {
71
+ const message = error instanceof Error ? error.message : String(error);
72
+ throw new Error(`Failed to create YAMO table '${tableName}': ${message}`);
73
+ }
74
+ }
75
+
76
+ export interface YamoRecordValidationResult {
77
+ valid: boolean;
78
+ errors: string[];
79
+ }
80
+
81
+ /**
82
+ * Validate a YAMO block record before insertion
83
+ * Checks for required fields and valid values
84
+ */
85
+ export function validateYamoRecord(record: any): YamoRecordValidationResult {
86
+ const errors: string[] = [];
87
+
88
+ // Check required fields
89
+ if (!record.id) {
90
+ errors.push("Missing required field: id");
91
+ }
92
+
93
+ if (!record.operation_type) {
94
+ errors.push("Missing required field: operation_type");
95
+ } else {
96
+ // Validate operation_type is one of the allowed values
97
+ const validTypes = ["retain", "recall", "reflect"];
98
+ if (!validTypes.includes(record.operation_type)) {
99
+ errors.push(
100
+ `Invalid operation_type: ${record.operation_type}. Must be one of: ${validTypes.join(", ")}`,
101
+ );
102
+ }
103
+ }
104
+
105
+ if (!record.yamo_text) {
106
+ errors.push("Missing required field: yamo_text");
107
+ } else {
108
+ // Validate YAMO block format
109
+ const requiredSections = [
110
+ "agent:",
111
+ "intent:",
112
+ "context:",
113
+ "output:",
114
+ "log:",
115
+ ];
116
+ for (const section of requiredSections) {
117
+ if (!record.yamo_text.includes(section)) {
118
+ errors.push(`YAMO block missing required section: ${section}`);
119
+ }
120
+ }
121
+ }
122
+
123
+ return {
124
+ valid: errors.length === 0,
125
+ errors,
126
+ };
127
+ }
128
+
129
+ /**
130
+ * Generate a YAMO block ID
131
+ * Creates a unique ID for a YAMO block
132
+ *
133
+ * @param {string} operationType - Type of operation
134
+ * @returns {string} Generated YAMO block ID
135
+ */
136
+ export function generateYamoId(operationType: string): string {
137
+ const timestamp = Date.now();
138
+ const random = Math.random().toString(36).substring(2, 10);
139
+ return `yamo_${operationType}_${timestamp}_${random}`;
140
+ }
141
+
142
+ /**
143
+ * Check if a table uses YAMO schema
144
+ * Detects if a table has the YAMO block schema structure
145
+ *
146
+ * @param {arrow.Schema} schema - Table schema to check
147
+ * @returns {boolean} True if YAMO schema detected
148
+ */
149
+ export function isYamoSchema(schema: arrow.Schema): boolean {
150
+ // Check for unique YAMO fields
151
+ const hasYamoFields = schema.fields.some(
152
+ (f) => f.name === "operation_type" || f.name === "yamo_text",
153
+ );
154
+
155
+ return hasYamoFields;
156
+ }
157
+
158
+ // Export schema function as default for consistency with lancedb/schema.js
159
+ export default {
160
+ createYamoSchema,
161
+ createYamoTable,
162
+ validateYamoRecord,
163
+ generateYamoId,
164
+ isYamoSchema,
165
+ };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@yamo/memory-mesh",
3
- "version": "2.3.2",
4
- "description": "Portable semantic memory system with Layer 0 Scrubber for YAMO agents",
3
+ "version": "3.0.0",
4
+ "description": "Portable semantic memory system with Layer 0 Scrubber for YAMO agents (v3 Singularity Edition)",
5
5
  "type": "module",
6
6
  "main": "lib/memory/index.js",
7
- "types": "index.d.ts",
7
+ "types": "lib/memory/index.d.ts",
8
8
  "bin": {
9
9
  "memory-mesh": "./bin/memory_mesh.js",
10
10
  "memory-mesh-setup": "./bin/setup.js"
@@ -12,18 +12,21 @@
12
12
  "files": [
13
13
  "lib/",
14
14
  "bin/",
15
- "skills/",
16
- "index.d.ts"
15
+ "skills/"
17
16
  ],
18
17
  "scripts": {
19
- "test": "npm run type-check && node --test test/*.test.js",
20
- "type-check": "tsc --noEmit"
18
+ "build": "tsc",
19
+ "test": "npm run build && node --test test/*.test.js",
20
+ "type-check": "tsc --noEmit",
21
+ "prepublishOnly": "npm run build"
21
22
  },
22
23
  "dependencies": {
23
24
  "@lancedb/lancedb": "^0.23.0",
24
25
  "@xenova/transformers": "^2.17.0",
25
26
  "apache-arrow": "^17.0.0",
26
- "onnxruntime-node": "^1.18.0"
27
+ "onnxruntime-node": "^1.18.0",
28
+ "pino": "^10.3.1",
29
+ "pino-pretty": "^13.1.3"
27
30
  },
28
31
  "author": "Soverane Labs",
29
32
  "license": "MIT",
package/index.d.ts DELETED
@@ -1,111 +0,0 @@
1
- export declare class MemoryMesh {
2
- constructor();
3
- init(): Promise<void>;
4
- add(content: string, metadata?: Record<string, any>): Promise<{
5
- id: string;
6
- content: string;
7
- metadata: Record<string, any>;
8
- created_at: string;
9
- }>;
10
- addBatch(entries: Array<{
11
- content: string;
12
- metadata?: Record<string, any>;
13
- }>): Promise<{
14
- count: number;
15
- success: boolean;
16
- ids: string[];
17
- }>;
18
- search(query: string, options?: {
19
- limit?: number;
20
- filter?: string;
21
- useCache?: boolean;
22
- }): Promise<Array<{
23
- id: string;
24
- content: string;
25
- metadata: Record<string, any>;
26
- score: number;
27
- created_at: string;
28
- }>>;
29
- get(id: string): Promise<{
30
- id: string;
31
- content: string;
32
- metadata: Record<string, any>;
33
- created_at: string;
34
- updated_at: string;
35
- } | null>;
36
- getAll(options?: {
37
- limit?: number;
38
- }): Promise<Array<any>>;
39
- update(id: string, content: string, metadata?: Record<string, any>): Promise<{
40
- id: string;
41
- content: string;
42
- success: boolean;
43
- }>;
44
- delete(id: string): Promise<{
45
- deleted: string;
46
- success: boolean;
47
- }>;
48
- stats(): Promise<{
49
- count: number;
50
- tableName: string;
51
- uri: string;
52
- isConnected: boolean;
53
- embedding: any;
54
- }>;
55
- healthCheck(): Promise<{
56
- status: string;
57
- timestamp: string;
58
- checks: Record<string, any>;
59
- }>;
60
- }
61
-
62
- export declare class Scrubber {
63
- constructor(config?: ScrubberConfig);
64
- process(document: {
65
- content: string;
66
- source: string;
67
- type: 'html' | 'md' | 'txt';
68
- }): Promise<ScrubberResult>;
69
- }
70
-
71
- export interface ScrubberConfig {
72
- enabled?: boolean;
73
- structural?: {
74
- stripHTML?: boolean;
75
- normalizeMarkdown?: boolean;
76
- collapseWhitespace?: boolean;
77
- removeScripts?: boolean;
78
- removeStyles?: boolean;
79
- };
80
- semantic?: {
81
- removeDuplicates?: boolean;
82
- removeBoilerplate?: boolean;
83
- minSignalRatio?: number;
84
- };
85
- chunking?: {
86
- maxTokens?: number;
87
- minTokens?: number;
88
- splitOnHeadings?: boolean;
89
- };
90
- validation?: {
91
- enforceMinLength?: boolean;
92
- };
93
- }
94
-
95
- export interface ScrubberResult {
96
- chunks: Array<{
97
- text: string;
98
- metadata: Record<string, any>;
99
- }>;
100
- metadata: {
101
- source: string;
102
- type: string;
103
- processingTimestamp: string;
104
- };
105
- telemetry: {
106
- totalDuration: number;
107
- stages: Record<string, any>;
108
- };
109
- success: boolean;
110
- error?: string;
111
- }
@@ -1,2 +0,0 @@
1
- export { default as EmbeddingService } from './service.js';
2
- export { default as EmbeddingFactory } from './factory.js';
package/lib/index.js DELETED
@@ -1,6 +0,0 @@
1
- // Core module exports
2
- export * from './lancedb/index.js';
3
- export * from './embeddings/index.js';
4
- export * from './search/index.js';
5
- export * from './memory/index.js';
6
- export * from './scrubber/index.js';