@prmichaelsen/remember-mcp 2.3.4 → 2.5.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/AGENT.md +2 -2
- package/CHANGELOG.md +63 -0
- package/README.md +50 -5
- package/agent/commands/git.commit.md +511 -0
- package/agent/commands/git.init.md +513 -0
- package/agent/milestones/milestone-11-unified-public-collection.md +205 -0
- package/agent/scripts/install.sh +31 -16
- package/agent/scripts/update.sh +32 -17
- package/agent/tasks/task-45-fix-publish-false-success-bug.md +114 -181
- package/agent/tasks/task-46-update-spacememory-types.md +94 -0
- package/agent/tasks/task-47-update-space-schema.md +102 -0
- package/agent/tasks/task-48-create-memory-public-collection.md +96 -0
- package/agent/tasks/task-49-update-remember-publish.md +153 -0
- package/agent/tasks/task-50-update-remember-confirm.md +111 -0
- package/agent/tasks/task-51-update-remember-search-space.md +154 -0
- package/agent/tasks/task-52-update-remember-query-space.md +142 -0
- package/agent/tasks/task-53-add-multispace-tests.md +193 -0
- package/agent/tasks/task-54-update-documentation-multispace.md +191 -0
- package/dist/server-factory.js +203 -107
- package/dist/server.js +203 -107
- package/dist/tools/publish.d.ts +1 -1
- package/dist/tools/query-space.d.ts +1 -1
- package/dist/tools/search-space.d.ts +1 -1
- package/dist/types/space-memory.d.ts +5 -3
- package/dist/weaviate/space-schema.d.ts +16 -0
- package/package.json +1 -1
- package/src/services/confirmation-token.service.ts +74 -30
- package/src/tools/confirm.ts +15 -16
- package/src/tools/publish.ts +42 -20
- package/src/tools/query-space.ts +38 -24
- package/src/tools/search-space.ts +51 -28
- package/src/types/space-memory.ts +5 -3
- package/src/weaviate/space-schema.spec.ts +55 -0
- package/src/weaviate/space-schema.ts +45 -6
|
@@ -14,10 +14,12 @@ import type { Memory, SearchOptions, SearchResult } from './memory.js';
|
|
|
14
14
|
*/
|
|
15
15
|
export interface SpaceMemory extends Omit<Memory, 'user_id' | 'doc_type'> {
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
* Examples: 'the_void', '
|
|
17
|
+
* Spaces this memory is published to (snake_case array)
|
|
18
|
+
* Examples: ['the_void'], ['dogs', 'cats'], ['the_void', 'dogs']
|
|
19
|
+
*
|
|
20
|
+
* A memory can belong to multiple spaces simultaneously.
|
|
19
21
|
*/
|
|
20
|
-
|
|
22
|
+
spaces: string[];
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
25
|
* Original author's user_id (for permissions)
|
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
getSpaceDisplayName,
|
|
9
9
|
isValidSpaceId,
|
|
10
10
|
ensureSpaceCollection,
|
|
11
|
+
ensurePublicCollection,
|
|
12
|
+
PUBLIC_COLLECTION_NAME,
|
|
11
13
|
} from './space-schema';
|
|
12
14
|
import type { WeaviateClient } from 'weaviate-client';
|
|
13
15
|
|
|
@@ -120,6 +122,7 @@ describe('Space Schema Utilities', () => {
|
|
|
120
122
|
|
|
121
123
|
// Check for space-specific properties
|
|
122
124
|
const propertyNames = createCall.properties.map((p: any) => p.name);
|
|
125
|
+
expect(propertyNames).toContain('spaces'); // ✅ New array field
|
|
123
126
|
expect(propertyNames).toContain('space_id');
|
|
124
127
|
expect(propertyNames).toContain('author_id');
|
|
125
128
|
expect(propertyNames).toContain('ghost_id');
|
|
@@ -128,4 +131,56 @@ describe('Space Schema Utilities', () => {
|
|
|
128
131
|
expect(propertyNames).toContain('attribution');
|
|
129
132
|
});
|
|
130
133
|
});
|
|
134
|
+
|
|
135
|
+
describe('Unified Public Collection', () => {
|
|
136
|
+
it('should create Memory_public collection', async () => {
|
|
137
|
+
const mockCollection = { name: 'Memory_public' };
|
|
138
|
+
(mockWeaviateClient.collections.exists as jest.Mock).mockResolvedValue(false);
|
|
139
|
+
(mockWeaviateClient.collections.create as jest.Mock).mockResolvedValue(undefined);
|
|
140
|
+
(mockWeaviateClient.collections.get as jest.Mock).mockReturnValue(mockCollection);
|
|
141
|
+
|
|
142
|
+
const result = await ensurePublicCollection(mockWeaviateClient);
|
|
143
|
+
|
|
144
|
+
expect(result).toBe(mockCollection);
|
|
145
|
+
expect(mockWeaviateClient.collections.exists).toHaveBeenCalledWith('Memory_public');
|
|
146
|
+
expect(mockWeaviateClient.collections.create).toHaveBeenCalled();
|
|
147
|
+
expect(mockWeaviateClient.collections.get).toHaveBeenCalledWith('Memory_public');
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it('should return existing Memory_public if it exists', async () => {
|
|
151
|
+
const mockCollection = { name: 'Memory_public' };
|
|
152
|
+
(mockWeaviateClient.collections.exists as jest.Mock).mockResolvedValue(true);
|
|
153
|
+
(mockWeaviateClient.collections.get as jest.Mock).mockReturnValue(mockCollection);
|
|
154
|
+
|
|
155
|
+
const result = await ensurePublicCollection(mockWeaviateClient);
|
|
156
|
+
|
|
157
|
+
expect(result).toBe(mockCollection);
|
|
158
|
+
expect(mockWeaviateClient.collections.exists).toHaveBeenCalledWith('Memory_public');
|
|
159
|
+
expect(mockWeaviateClient.collections.get).toHaveBeenCalledWith('Memory_public');
|
|
160
|
+
expect(mockWeaviateClient.collections.create).not.toHaveBeenCalled();
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('should have spaces array field in schema', async () => {
|
|
164
|
+
(mockWeaviateClient.collections.exists as jest.Mock).mockResolvedValue(false);
|
|
165
|
+
(mockWeaviateClient.collections.create as jest.Mock).mockResolvedValue(undefined);
|
|
166
|
+
(mockWeaviateClient.collections.get as jest.Mock).mockReturnValue({});
|
|
167
|
+
|
|
168
|
+
await ensurePublicCollection(mockWeaviateClient);
|
|
169
|
+
|
|
170
|
+
const createCall = (mockWeaviateClient.collections.create as jest.Mock).mock.calls[0][0];
|
|
171
|
+
const propertyNames = createCall.properties.map((p: any) => p.name);
|
|
172
|
+
|
|
173
|
+
// Verify spaces array field exists
|
|
174
|
+
expect(propertyNames).toContain('spaces');
|
|
175
|
+
|
|
176
|
+
// Find spaces property and verify it's an array
|
|
177
|
+
const spacesProperty = createCall.properties.find((p: any) => p.name === 'spaces');
|
|
178
|
+
expect(spacesProperty).toBeDefined();
|
|
179
|
+
expect(spacesProperty.dataType).toBe('text[]');
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it('should verify PUBLIC_COLLECTION_NAME constant', () => {
|
|
183
|
+
expect(PUBLIC_COLLECTION_NAME).toBe('Memory_public');
|
|
184
|
+
});
|
|
185
|
+
});
|
|
131
186
|
});
|
|
@@ -9,12 +9,18 @@ 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
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Unified public collection name for all public spaces
|
|
14
|
+
*/
|
|
15
|
+
export const PUBLIC_COLLECTION_NAME = 'Memory_public';
|
|
16
|
+
|
|
12
17
|
/**
|
|
13
18
|
* Get collection name for a space
|
|
14
|
-
*
|
|
19
|
+
*
|
|
20
|
+
* @deprecated Use PUBLIC_COLLECTION_NAME instead. Will be removed in v3.0.0.
|
|
15
21
|
* @param spaceId - Space identifier (snake_case)
|
|
16
22
|
* @returns Collection name in format Memory_{space_id}
|
|
17
|
-
*
|
|
23
|
+
*
|
|
18
24
|
* @example
|
|
19
25
|
* getSpaceCollectionName('the_void') // Returns 'Memory_the_void'
|
|
20
26
|
*/
|
|
@@ -72,7 +78,10 @@ async function createSpaceCollection(
|
|
|
72
78
|
client: WeaviateClient,
|
|
73
79
|
spaceId: string
|
|
74
80
|
): Promise<void> {
|
|
75
|
-
|
|
81
|
+
// Handle 'public' as special case for unified collection
|
|
82
|
+
const collectionName = spaceId === 'public'
|
|
83
|
+
? PUBLIC_COLLECTION_NAME
|
|
84
|
+
: getSpaceCollectionName(spaceId);
|
|
76
85
|
|
|
77
86
|
console.log(`[Weaviate] Creating space collection ${collectionName}...`);
|
|
78
87
|
|
|
@@ -96,10 +105,15 @@ async function createSpaceCollection(
|
|
|
96
105
|
},
|
|
97
106
|
|
|
98
107
|
// Space identity
|
|
108
|
+
{
|
|
109
|
+
name: 'spaces',
|
|
110
|
+
dataType: 'text[]' as any,
|
|
111
|
+
description: 'Spaces this memory is published to (e.g., ["the_void", "dogs"])',
|
|
112
|
+
},
|
|
99
113
|
{
|
|
100
114
|
name: 'space_id',
|
|
101
115
|
dataType: 'text' as any,
|
|
102
|
-
description: '
|
|
116
|
+
description: 'DEPRECATED: Use spaces array instead. Will be removed in v3.0.0.',
|
|
103
117
|
},
|
|
104
118
|
{
|
|
105
119
|
name: 'author_id',
|
|
@@ -243,13 +257,38 @@ async function createSpaceCollection(
|
|
|
243
257
|
console.log(`[Weaviate] Space collection ${collectionName} created successfully`);
|
|
244
258
|
}
|
|
245
259
|
|
|
260
|
+
/**
|
|
261
|
+
* Ensure the unified public collection exists, creating it if needed
|
|
262
|
+
*
|
|
263
|
+
* @param client - Weaviate client
|
|
264
|
+
* @returns Collection reference to Memory_public
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* const collection = await ensurePublicCollection(client);
|
|
268
|
+
*/
|
|
269
|
+
export async function ensurePublicCollection(
|
|
270
|
+
client: WeaviateClient
|
|
271
|
+
): Promise<Collection<any>> {
|
|
272
|
+
const collectionName = PUBLIC_COLLECTION_NAME;
|
|
273
|
+
|
|
274
|
+
// Check if collection exists
|
|
275
|
+
const exists = await client.collections.exists(collectionName);
|
|
276
|
+
|
|
277
|
+
if (!exists) {
|
|
278
|
+
await createSpaceCollection(client, 'public');
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return client.collections.get(collectionName);
|
|
282
|
+
}
|
|
283
|
+
|
|
246
284
|
/**
|
|
247
285
|
* Ensure a space collection exists, creating it if needed
|
|
248
|
-
*
|
|
286
|
+
*
|
|
287
|
+
* @deprecated Use ensurePublicCollection() instead. Will be removed in v3.0.0.
|
|
249
288
|
* @param client - Weaviate client
|
|
250
289
|
* @param spaceId - Space identifier
|
|
251
290
|
* @returns Collection reference
|
|
252
|
-
*
|
|
291
|
+
*
|
|
253
292
|
* @example
|
|
254
293
|
* const collection = await ensureSpaceCollection(client, 'the_void');
|
|
255
294
|
*/
|