@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.
- package/CHANGELOG.md +95 -0
- package/agent/milestones/milestone-12-comment-system.md +239 -0
- package/agent/tasks/task-55-add-comment-fields-to-schema.md +171 -0
- package/agent/tasks/task-56-update-search-space-for-comments.md +192 -0
- package/agent/tasks/task-57-update-query-space-for-comments.md +167 -0
- package/agent/tasks/task-58-add-comment-unit-tests.md +255 -0
- package/agent/tasks/task-59-update-documentation-for-comments.md +324 -0
- package/agent/tasks/task-60-standardize-structured-logging.md +300 -0
- package/agent/tasks/task-70-draft.md +13 -0
- package/dist/server-factory.js +342 -141
- package/dist/server.js +385 -158
- package/dist/tools/query-space.d.ts +1 -0
- package/dist/tools/search-space.d.ts +1 -0
- package/package.json +1 -1
- package/src/config.ts +8 -1
- package/src/firestore/init.ts +21 -6
- package/src/services/confirmation-token.service.ts +42 -23
- package/src/tools/confirm.ts +46 -15
- package/src/tools/publish.ts +34 -9
- package/src/tools/query-space.ts +23 -6
- package/src/tools/search-space.ts +14 -1
- package/src/weaviate/client.ts +29 -7
- package/src/weaviate/schema.ts +34 -4
- package/src/weaviate/space-schema.ts +28 -3
package/src/weaviate/client.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
90
|
+
logger.info('Weaviate connection test successful', {
|
|
91
|
+
module: 'weaviate-client',
|
|
92
|
+
isReady,
|
|
93
|
+
});
|
|
81
94
|
return isReady;
|
|
82
95
|
} catch (error) {
|
|
83
|
-
|
|
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
|
-
|
|
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
|
-
|
|
167
|
+
logger.info('Weaviate client closed', {
|
|
168
|
+
module: 'weaviate-client',
|
|
169
|
+
});
|
|
148
170
|
}
|
|
149
171
|
}
|
package/src/weaviate/schema.ts
CHANGED
|
@@ -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
|
-
|
|
29
|
+
logger.debug('Collection already exists', {
|
|
30
|
+
module: 'weaviate-schema',
|
|
31
|
+
collectionName,
|
|
32
|
+
});
|
|
29
33
|
return;
|
|
30
34
|
}
|
|
31
35
|
|
|
32
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
279
|
+
logger.info('Space collection created successfully', {
|
|
280
|
+
module: 'weaviate-space-schema',
|
|
281
|
+
collectionName,
|
|
282
|
+
});
|
|
258
283
|
}
|
|
259
284
|
|
|
260
285
|
/**
|