@prmichaelsen/remember-mcp 2.5.2 → 2.6.1

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.
@@ -1,5 +1,6 @@
1
1
  import weaviate, { WeaviateClient } from 'weaviate-client';
2
2
  import { config } from '../config.js';
3
+ import { logger } from '../utils/logger.js';
3
4
 
4
5
  let client: WeaviateClient | null = null;
5
6
 
@@ -25,7 +26,10 @@ export async function initWeaviateClient(): Promise<WeaviateClient> {
25
26
  // Use appropriate connection method
26
27
  if (!isLocal) {
27
28
  // Use connectToWeaviateCloud() for ALL remote instances (cloud or self-hosted)
28
- console.log('[Weaviate] Connecting to remote Weaviate:', weaviateUrl);
29
+ logger.info('Connecting to remote Weaviate', {
30
+ module: 'weaviate-client',
31
+ url: weaviateUrl,
32
+ });
29
33
  client = await weaviate.connectToWeaviateCloud(weaviateUrl, {
30
34
  authCredentials: config.weaviate.apiKey
31
35
  ? new weaviate.ApiKey(config.weaviate.apiKey)
@@ -36,7 +40,10 @@ export async function initWeaviateClient(): Promise<WeaviateClient> {
36
40
  });
37
41
  } else {
38
42
  // connectToLocal() for localhost only
39
- console.log('[Weaviate] Connecting to local Weaviate:', weaviateUrl);
43
+ logger.info('Connecting to local Weaviate', {
44
+ module: 'weaviate-client',
45
+ url: weaviateUrl,
46
+ });
40
47
  const localConfig: any = {
41
48
  host: weaviateUrl.replace(/^https?:\/\//, '').split(':')[0],
42
49
  port: weaviateUrl.includes(':')
@@ -56,7 +63,10 @@ export async function initWeaviateClient(): Promise<WeaviateClient> {
56
63
  client = await weaviate.connectToLocal(localConfig);
57
64
  }
58
65
 
59
- console.log('[Weaviate] Client initialized successfully');
66
+ logger.info('Weaviate client initialized successfully', {
67
+ module: 'weaviate-client',
68
+ isLocal,
69
+ });
60
70
  return client;
61
71
  }
62
72
 
@@ -77,10 +87,16 @@ export async function testWeaviateConnection(): Promise<boolean> {
77
87
  try {
78
88
  const weaviateClient = getWeaviateClient();
79
89
  const isReady = await weaviateClient.isReady();
80
- console.log('[Weaviate] Connection successful, ready:', isReady);
90
+ logger.info('Weaviate connection test successful', {
91
+ module: 'weaviate-client',
92
+ isReady,
93
+ });
81
94
  return isReady;
82
95
  } catch (error) {
83
- console.error('[Weaviate] Connection failed:', error);
96
+ logger.error('Weaviate connection test failed', {
97
+ module: 'weaviate-client',
98
+ error: error instanceof Error ? error.message : String(error),
99
+ });
84
100
  return false;
85
101
  }
86
102
  }
@@ -132,7 +148,11 @@ export async function collectionExists(collectionName: string): Promise<boolean>
132
148
  const exists = await weaviateClient.collections.exists(collectionName);
133
149
  return exists;
134
150
  } catch (error) {
135
- console.error(`[Weaviate] Error checking collection ${collectionName}:`, error);
151
+ logger.error('Error checking collection existence', {
152
+ module: 'weaviate-client',
153
+ collectionName,
154
+ error: error instanceof Error ? error.message : String(error),
155
+ });
136
156
  return false;
137
157
  }
138
158
  }
@@ -144,6 +164,8 @@ export async function closeWeaviateClient(): Promise<void> {
144
164
  if (client) {
145
165
  // Weaviate client doesn't have explicit close method
146
166
  client = null;
147
- console.log('[Weaviate] Client closed');
167
+ logger.info('Weaviate client closed', {
168
+ module: 'weaviate-client',
169
+ });
148
170
  }
149
171
  }
@@ -6,6 +6,7 @@
6
6
  import weaviate, { WeaviateClient } from 'weaviate-client';
7
7
  import { getWeaviateClient, sanitizeUserId } from './client.js';
8
8
  import { config } from '../config.js';
9
+ import { logger } from '../utils/logger.js';
9
10
 
10
11
  /**
11
12
  * Create Memory collection schema for a user
@@ -25,11 +26,17 @@ export async function createMemoryCollection(userId: string): Promise<void> {
25
26
  // Check if collection already exists
26
27
  const exists = await client.collections.exists(collectionName);
27
28
  if (exists) {
28
- console.log(`[Weaviate] Collection ${collectionName} already exists`);
29
+ logger.debug('Collection already exists', {
30
+ module: 'weaviate-schema',
31
+ collectionName,
32
+ });
29
33
  return;
30
34
  }
31
35
 
32
- console.log(`[Weaviate] Creating collection ${collectionName}...`);
36
+ logger.info('Creating memory collection', {
37
+ module: 'weaviate-schema',
38
+ collectionName,
39
+ });
33
40
 
34
41
  // Create collection with schema
35
42
  await client.collections.create({
@@ -243,10 +250,30 @@ export async function createMemoryCollection(userId: string): Promise<void> {
243
250
  dataType: 'number' as any,
244
251
  description: 'Calculated effective weight',
245
252
  },
253
+
254
+ // Comment/threading fields (for threaded discussions in shared spaces)
255
+ {
256
+ name: 'parent_id',
257
+ dataType: 'text' as any,
258
+ description: 'ID of parent memory or comment (for threading)',
259
+ },
260
+ {
261
+ name: 'thread_root_id',
262
+ dataType: 'text' as any,
263
+ description: 'Root memory ID for fetching entire thread',
264
+ },
265
+ {
266
+ name: 'moderation_flags',
267
+ dataType: 'text[]' as any,
268
+ description: 'Per-space moderation flags (format: "{space_id}:{flag_type}")',
269
+ },
246
270
  ],
247
271
  });
248
272
 
249
- console.log(`[Weaviate] Collection ${collectionName} created successfully`);
273
+ logger.info('Memory collection created successfully', {
274
+ module: 'weaviate-schema',
275
+ collectionName,
276
+ });
250
277
  }
251
278
 
252
279
  /**
@@ -283,6 +310,9 @@ export async function deleteMemoryCollection(userId: string): Promise<void> {
283
310
 
284
311
  if (exists) {
285
312
  await client.collections.delete(collectionName);
286
- console.log(`[Weaviate] Collection ${collectionName} deleted`);
313
+ logger.info('Memory collection deleted', {
314
+ module: 'weaviate-schema',
315
+ collectionName,
316
+ });
287
317
  }
288
318
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Weaviate space collection schema and utilities
3
- *
3
+ *
4
4
  * Manages shared space collections where users can publish memories
5
5
  * for discovery by other users.
6
6
  */
@@ -8,6 +8,7 @@
8
8
  import weaviate, { type WeaviateClient, type Collection } from 'weaviate-client';
9
9
  import { config } from '../config.js';
10
10
  import { SUPPORTED_SPACES, type SpaceId } from '../types/space-memory.js';
11
+ import { logger } from '../utils/logger.js';
11
12
 
12
13
  /**
13
14
  * Unified public collection name for all public spaces
@@ -83,7 +84,11 @@ async function createSpaceCollection(
83
84
  ? PUBLIC_COLLECTION_NAME
84
85
  : getSpaceCollectionName(spaceId);
85
86
 
86
- console.log(`[Weaviate] Creating space collection ${collectionName}...`);
87
+ logger.info('Creating space collection', {
88
+ module: 'weaviate-space-schema',
89
+ collectionName,
90
+ spaceId,
91
+ });
87
92
 
88
93
  // Create collection with schema (same as Memory schema but for spaces)
89
94
  await client.collections.create({
@@ -251,10 +256,30 @@ async function createSpaceCollection(
251
256
  dataType: 'number' as any,
252
257
  description: 'Version number (increments on update)',
253
258
  },
259
+
260
+ // Comment/threading fields (for threaded discussions in shared spaces)
261
+ {
262
+ name: 'parent_id',
263
+ dataType: 'text' as any,
264
+ description: 'ID of parent memory or comment (for threading)',
265
+ },
266
+ {
267
+ name: 'thread_root_id',
268
+ dataType: 'text' as any,
269
+ description: 'Root memory ID for fetching entire thread',
270
+ },
271
+ {
272
+ name: 'moderation_flags',
273
+ dataType: 'text[]' as any,
274
+ description: 'Per-space moderation flags (format: "{space_id}:{flag_type}")',
275
+ },
254
276
  ],
255
277
  });
256
278
 
257
- console.log(`[Weaviate] Space collection ${collectionName} created successfully`);
279
+ logger.info('Space collection created successfully', {
280
+ module: 'weaviate-space-schema',
281
+ collectionName,
282
+ });
258
283
  }
259
284
 
260
285
  /**