@prmichaelsen/remember-mcp 2.6.7 → 2.6.9
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 +55 -0
- package/agent/progress.yaml +36 -0
- package/agent/tasks/task-65-migrate-old-memories-schema.md +431 -0
- package/agent/tasks/task-66-initialize-comment-fields-in-tools.md +294 -0
- package/agent/tasks/task-67-migrate-memory-public-schema.md +226 -0
- package/dist/constants/content-types.d.ts +1 -1
- package/dist/server-factory.js +53 -2
- package/dist/server.js +53 -2
- package/dist/tools/create-memory.d.ts +19 -0
- package/dist/tools/update-memory.d.ts +18 -0
- package/dist/types/memory.d.ts +4 -1
- package/package.json +1 -1
- package/src/constants/content-types.ts +9 -1
- package/src/tools/create-memory.ts +23 -0
- package/src/tools/update-memory.ts +36 -1
- package/src/types/memory.ts +6 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
# Task 66: Support All Schema Fields in Create/Update Tools
|
|
2
|
+
|
|
3
|
+
**Milestone**: M12 (Comment System / Schema Completeness)
|
|
4
|
+
**Estimated Time**: 2 hours
|
|
5
|
+
**Dependencies**: Task 65 (migration script)
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
**Priority**: High
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Ensure all create and update tools (both personal and space tools) support ALL schema fields in their input schemas and properly initialize/update them. This includes comment fields and any other fields that may be missing from tool schemas.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Context
|
|
18
|
+
|
|
19
|
+
**Current Problem**:
|
|
20
|
+
- New memories created via `remember_create_memory` don't have comment fields
|
|
21
|
+
- Space memories created via `remember_publish` may be missing fields
|
|
22
|
+
- Update tools may not support all schema fields
|
|
23
|
+
- After migration (Task 65), old memories will have these fields
|
|
24
|
+
- This creates inconsistency between old and new memories
|
|
25
|
+
|
|
26
|
+
**Missing Fields**:
|
|
27
|
+
- Comment fields: `parent_id`, `thread_root_id`, `moderation_flags`
|
|
28
|
+
- Potentially other fields not in tool schemas
|
|
29
|
+
|
|
30
|
+
**Affected Tools**:
|
|
31
|
+
- `remember_create_memory` - Personal memory creation
|
|
32
|
+
- `remember_update_memory` - Personal memory updates
|
|
33
|
+
- `remember_publish` / `remember_confirm` - Space memory creation (via executePublishMemory)
|
|
34
|
+
|
|
35
|
+
**Impact**:
|
|
36
|
+
- New memories missing fields
|
|
37
|
+
- Inconsistent schema across memories
|
|
38
|
+
- Potential query/filter issues
|
|
39
|
+
- Space memories may be incomplete
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Steps
|
|
44
|
+
|
|
45
|
+
### 1. Update remember_create_memory Tool Schema
|
|
46
|
+
|
|
47
|
+
Add comment fields to input schema:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// src/tools/create-memory.ts
|
|
51
|
+
|
|
52
|
+
export const createMemoryTool: Tool = {
|
|
53
|
+
name: 'remember_create_memory',
|
|
54
|
+
description: '...',
|
|
55
|
+
inputSchema: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
properties: {
|
|
58
|
+
// ... existing properties ...
|
|
59
|
+
|
|
60
|
+
// Comment/threading fields (optional)
|
|
61
|
+
parent_id: {
|
|
62
|
+
type: 'string',
|
|
63
|
+
description: 'ID of parent memory or comment (for threading). Leave null for top-level memories.',
|
|
64
|
+
},
|
|
65
|
+
thread_root_id: {
|
|
66
|
+
type: 'string',
|
|
67
|
+
description: 'Root memory ID for thread. Leave null for top-level memories.',
|
|
68
|
+
},
|
|
69
|
+
moderation_flags: {
|
|
70
|
+
type: 'array',
|
|
71
|
+
items: { type: 'string' },
|
|
72
|
+
description: 'Per-space moderation flags (format: "{space_id}:{flag_type}"). Usually empty.',
|
|
73
|
+
default: [],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
required: ['type', 'content'], // parent_id, thread_root_id, moderation_flags are optional
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2. Initialize Comment Fields in handleCreateMemory
|
|
82
|
+
|
|
83
|
+
Ensure fields are always initialized:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
// src/tools/create-memory.ts - in handleCreateMemory function
|
|
87
|
+
|
|
88
|
+
const memory: Memory = {
|
|
89
|
+
// ... existing fields ...
|
|
90
|
+
|
|
91
|
+
// Comment/threading fields (initialize to defaults)
|
|
92
|
+
parent_id: args.parent_id || null,
|
|
93
|
+
thread_root_id: args.thread_root_id || null,
|
|
94
|
+
moderation_flags: args.moderation_flags || [],
|
|
95
|
+
|
|
96
|
+
// ... rest of fields ...
|
|
97
|
+
};
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 3. Update remember_update_memory Tool Schema
|
|
101
|
+
|
|
102
|
+
Add comment fields to update schema:
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
// src/tools/update-memory.ts
|
|
106
|
+
|
|
107
|
+
export const updateMemoryTool: Tool = {
|
|
108
|
+
name: 'remember_update_memory',
|
|
109
|
+
description: '...',
|
|
110
|
+
inputSchema: {
|
|
111
|
+
type: 'object',
|
|
112
|
+
properties: {
|
|
113
|
+
// ... existing properties ...
|
|
114
|
+
|
|
115
|
+
// Comment/threading fields (optional)
|
|
116
|
+
parent_id: {
|
|
117
|
+
type: 'string',
|
|
118
|
+
description: 'Update parent ID (for threading)',
|
|
119
|
+
},
|
|
120
|
+
thread_root_id: {
|
|
121
|
+
type: 'string',
|
|
122
|
+
description: 'Update thread root ID',
|
|
123
|
+
},
|
|
124
|
+
moderation_flags: {
|
|
125
|
+
type: 'array',
|
|
126
|
+
items: { type: 'string' },
|
|
127
|
+
description: 'Update moderation flags',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
required: ['memory_id'],
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 4. Support Comment Fields in handleUpdateMemory
|
|
136
|
+
|
|
137
|
+
Allow updating comment fields:
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
// src/tools/update-memory.ts - in handleUpdateMemory function
|
|
141
|
+
|
|
142
|
+
const updates: Partial<Memory> = {};
|
|
143
|
+
|
|
144
|
+
// ... existing field updates ...
|
|
145
|
+
|
|
146
|
+
// Comment/threading fields
|
|
147
|
+
if (args.parent_id !== undefined) {
|
|
148
|
+
updates.parent_id = args.parent_id;
|
|
149
|
+
}
|
|
150
|
+
if (args.thread_root_id !== undefined) {
|
|
151
|
+
updates.thread_root_id = args.thread_root_id;
|
|
152
|
+
}
|
|
153
|
+
if (args.moderation_flags !== undefined) {
|
|
154
|
+
updates.moderation_flags = args.moderation_flags;
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### 5. Update Memory Type Interface
|
|
159
|
+
|
|
160
|
+
Ensure TypeScript types include comment fields:
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
// src/types/memory.ts
|
|
164
|
+
|
|
165
|
+
export interface Memory {
|
|
166
|
+
// ... existing fields ...
|
|
167
|
+
|
|
168
|
+
// Comment/threading fields
|
|
169
|
+
parent_id?: string | null;
|
|
170
|
+
thread_root_id?: string | null;
|
|
171
|
+
moderation_flags?: string[];
|
|
172
|
+
|
|
173
|
+
// ... rest of fields ...
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### 6. Test New Memory Creation
|
|
178
|
+
|
|
179
|
+
Verify new memories have comment fields:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Create a regular memory
|
|
183
|
+
remember_create_memory({
|
|
184
|
+
type: "note",
|
|
185
|
+
content: "Test memory"
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
# Verify it has:
|
|
189
|
+
# - parent_id: null
|
|
190
|
+
# - thread_root_id: null
|
|
191
|
+
# - moderation_flags: []
|
|
192
|
+
|
|
193
|
+
# Create a comment
|
|
194
|
+
remember_create_memory({
|
|
195
|
+
type: "comment",
|
|
196
|
+
content: "Great post!",
|
|
197
|
+
parent_id: "memory123",
|
|
198
|
+
thread_root_id: "memory123"
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
# Verify it has the parent/thread IDs set
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Verification
|
|
207
|
+
|
|
208
|
+
- [ ] `remember_create_memory` input schema includes comment fields
|
|
209
|
+
- [ ] `handleCreateMemory` initializes comment fields to defaults
|
|
210
|
+
- [ ] `remember_update_memory` input schema includes comment fields
|
|
211
|
+
- [ ] `handleUpdateMemory` supports updating comment fields
|
|
212
|
+
- [ ] `Memory` type interface includes comment fields
|
|
213
|
+
- [ ] New memories created with `parent_id: null`
|
|
214
|
+
- [ ] New memories created with `thread_root_id: null`
|
|
215
|
+
- [ ] New memories created with `moderation_flags: []`
|
|
216
|
+
- [ ] Can create comments with parent_id set
|
|
217
|
+
- [ ] TypeScript compiles without errors
|
|
218
|
+
- [ ] Build successful
|
|
219
|
+
- [ ] All tests passing
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Expected Output
|
|
224
|
+
|
|
225
|
+
**New Regular Memory**:
|
|
226
|
+
```json
|
|
227
|
+
{
|
|
228
|
+
"id": "new-memory-id",
|
|
229
|
+
"type": "note",
|
|
230
|
+
"content": "Test content",
|
|
231
|
+
"parent_id": null,
|
|
232
|
+
"thread_root_id": null,
|
|
233
|
+
"moderation_flags": [],
|
|
234
|
+
// ... other fields
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**New Comment**:
|
|
239
|
+
```json
|
|
240
|
+
{
|
|
241
|
+
"id": "comment-id",
|
|
242
|
+
"type": "comment",
|
|
243
|
+
"content": "Great post!",
|
|
244
|
+
"parent_id": "memory123",
|
|
245
|
+
"thread_root_id": "memory123",
|
|
246
|
+
"moderation_flags": [],
|
|
247
|
+
// ... other fields
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Common Issues and Solutions
|
|
254
|
+
|
|
255
|
+
### Issue 1: TypeScript errors about new fields
|
|
256
|
+
|
|
257
|
+
**Cause**: Memory type not updated
|
|
258
|
+
**Solution**: Add fields to Memory interface in src/types/memory.ts
|
|
259
|
+
|
|
260
|
+
### Issue 2: Fields not showing in created memories
|
|
261
|
+
|
|
262
|
+
**Cause**: Not initialized in handleCreateMemory
|
|
263
|
+
**Solution**: Ensure defaults are set (null for IDs, [] for flags)
|
|
264
|
+
|
|
265
|
+
### Issue 3: Can't update comment fields
|
|
266
|
+
|
|
267
|
+
**Cause**: handleUpdateMemory doesn't support them
|
|
268
|
+
**Solution**: Add field update logic
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Resources
|
|
273
|
+
|
|
274
|
+
- [Memory Type Definition](../src/types/memory.ts)
|
|
275
|
+
- [remember_create_memory Tool](../src/tools/create-memory.ts)
|
|
276
|
+
- [remember_update_memory Tool](../src/tools/update-memory.ts)
|
|
277
|
+
- [Comment System Design](../design/comment-memory-type.md)
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## Notes
|
|
282
|
+
|
|
283
|
+
- This ensures consistency between old (migrated) and new memories
|
|
284
|
+
- Comment fields are optional in input schema
|
|
285
|
+
- Defaults: `parent_id: null`, `thread_root_id: null`, `moderation_flags: []`
|
|
286
|
+
- Only comments should have non-null parent_id/thread_root_id
|
|
287
|
+
- Regular memories always have null for these fields
|
|
288
|
+
- This completes the comment system foundation
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
**Status**: Not Started
|
|
293
|
+
**Recommendation**: Implement after Task 65 migration completes
|
|
294
|
+
**Priority**: High - Ensures schema consistency for all new memories
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# Task 67: Migrate Memory_public Collection Schema
|
|
2
|
+
|
|
3
|
+
**Milestone**: M12 (Comment System)
|
|
4
|
+
**Estimated Time**: 1 hour
|
|
5
|
+
**Dependencies**: Task 55, Task 66
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
**Priority**: High
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Update the existing `Memory_public` collection in Weaviate Cloud to include the missing comment fields (`parent_id` and `thread_root_id`). Currently, only `moderation_flags` exists in the production schema.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Problem
|
|
18
|
+
|
|
19
|
+
The `Memory_public` collection was created before comment fields were added to the schema. Weaviate doesn't support adding properties to existing collections, so we need to migrate the data.
|
|
20
|
+
|
|
21
|
+
**Current State** (Production):
|
|
22
|
+
- ✅ `moderation_flags` field exists
|
|
23
|
+
- ❌ `parent_id` field missing
|
|
24
|
+
- ❌ `thread_root_id` field missing
|
|
25
|
+
|
|
26
|
+
**Expected State** (Code):
|
|
27
|
+
- ✅ All three fields defined in `src/weaviate/space-schema.ts` (lines 261-275)
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Impact
|
|
32
|
+
|
|
33
|
+
**Without Migration**:
|
|
34
|
+
- Cannot create comments in shared spaces
|
|
35
|
+
- Cannot thread discussions
|
|
36
|
+
- Published memories missing comment fields
|
|
37
|
+
- Schema mismatch between code and production
|
|
38
|
+
|
|
39
|
+
**With Migration**:
|
|
40
|
+
- Full comment system functionality in shared spaces
|
|
41
|
+
- Threaded discussions work correctly
|
|
42
|
+
- Schema matches code definition
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Migration Options
|
|
47
|
+
|
|
48
|
+
### Option 1: Delete and Recreate (DESTRUCTIVE)
|
|
49
|
+
|
|
50
|
+
**Steps**:
|
|
51
|
+
1. Backup all data from `Memory_public`
|
|
52
|
+
2. Delete `Memory_public` collection
|
|
53
|
+
3. Recreate with updated schema (automatic via `ensurePublicCollection`)
|
|
54
|
+
4. Restore data with new fields initialized
|
|
55
|
+
|
|
56
|
+
**Pros**:
|
|
57
|
+
- Clean schema
|
|
58
|
+
- Simple process
|
|
59
|
+
|
|
60
|
+
**Cons**:
|
|
61
|
+
- ⚠️ **LOSES ALL DATA** if backup fails
|
|
62
|
+
- Downtime during migration
|
|
63
|
+
- Risky for production
|
|
64
|
+
|
|
65
|
+
### Option 2: Create New Collection and Migrate (SAFE)
|
|
66
|
+
|
|
67
|
+
**Steps**:
|
|
68
|
+
1. Create `Memory_public_v2` with updated schema
|
|
69
|
+
2. Copy all data from `Memory_public` to `Memory_public_v2`
|
|
70
|
+
3. Initialize comment fields: `parent_id: null`, `thread_root_id: null`, `moderation_flags: []`
|
|
71
|
+
4. Test `Memory_public_v2` thoroughly
|
|
72
|
+
5. Update code to use `Memory_public_v2`
|
|
73
|
+
6. Delete old `Memory_public` after verification
|
|
74
|
+
|
|
75
|
+
**Pros**:
|
|
76
|
+
- ✅ Zero data loss
|
|
77
|
+
- ✅ Can rollback if issues
|
|
78
|
+
- ✅ Test before switching
|
|
79
|
+
|
|
80
|
+
**Cons**:
|
|
81
|
+
- More complex
|
|
82
|
+
- Temporary storage duplication
|
|
83
|
+
|
|
84
|
+
### Option 3: Live with Current Schema (NOT RECOMMENDED)
|
|
85
|
+
|
|
86
|
+
**Steps**:
|
|
87
|
+
- Do nothing
|
|
88
|
+
- Comment system only works for personal memories
|
|
89
|
+
- Shared spaces don't support comments
|
|
90
|
+
|
|
91
|
+
**Pros**:
|
|
92
|
+
- No migration needed
|
|
93
|
+
|
|
94
|
+
**Cons**:
|
|
95
|
+
- ❌ Incomplete feature
|
|
96
|
+
- ❌ Schema mismatch
|
|
97
|
+
- ❌ Technical debt
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Recommended Approach: Option 2 (Safe Migration)
|
|
102
|
+
|
|
103
|
+
### Step 1: Create Backup Collection
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
// Create Memory_public_v2 with full schema
|
|
107
|
+
const client = getWeaviateClient();
|
|
108
|
+
await client.collections.create({
|
|
109
|
+
name: 'Memory_public_v2',
|
|
110
|
+
// ... full schema from space-schema.ts including comment fields
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Step 2: Migrate Data
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
// Fetch all objects from Memory_public
|
|
118
|
+
const oldCollection = client.collections.get('Memory_public');
|
|
119
|
+
const objects = await oldCollection.query.fetchObjects({ limit: 10000 });
|
|
120
|
+
|
|
121
|
+
// Insert into Memory_public_v2 with comment fields
|
|
122
|
+
const newCollection = client.collections.get('Memory_public_v2');
|
|
123
|
+
for (const obj of objects.objects) {
|
|
124
|
+
await newCollection.data.insert({
|
|
125
|
+
...obj.properties,
|
|
126
|
+
parent_id: null, // Initialize to null
|
|
127
|
+
thread_root_id: null, // Initialize to null
|
|
128
|
+
moderation_flags: obj.properties.moderation_flags || [], // Preserve existing
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Step 3: Update Code
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
// src/weaviate/space-schema.ts
|
|
137
|
+
export const PUBLIC_COLLECTION_NAME = 'Memory_public_v2'; // Changed from 'Memory_public'
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Step 4: Verify and Cleanup
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Test the new collection
|
|
144
|
+
# Verify all data migrated correctly
|
|
145
|
+
# Check comment fields exist
|
|
146
|
+
|
|
147
|
+
# After verification (wait 24-48 hours):
|
|
148
|
+
# Delete old Memory_public collection
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Verification
|
|
154
|
+
|
|
155
|
+
- [ ] `Memory_public_v2` collection created with full schema
|
|
156
|
+
- [ ] All data migrated from `Memory_public`
|
|
157
|
+
- [ ] Comment fields present: `parent_id`, `thread_root_id`, `moderation_flags`
|
|
158
|
+
- [ ] All existing memories have `parent_id: null`, `thread_root_id: null`
|
|
159
|
+
- [ ] `moderation_flags` preserved from original data
|
|
160
|
+
- [ ] Code updated to use `Memory_public_v2`
|
|
161
|
+
- [ ] All tests passing
|
|
162
|
+
- [ ] Can create comments in shared spaces
|
|
163
|
+
- [ ] Can publish memories with comment fields
|
|
164
|
+
- [ ] Old `Memory_public` collection deleted (after verification period)
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Rollback Plan
|
|
169
|
+
|
|
170
|
+
If issues occur:
|
|
171
|
+
|
|
172
|
+
1. **Immediate Rollback**:
|
|
173
|
+
```typescript
|
|
174
|
+
export const PUBLIC_COLLECTION_NAME = 'Memory_public'; // Revert to old
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
2. **Keep Both Collections**:
|
|
178
|
+
- Old collection still exists
|
|
179
|
+
- Can switch back instantly
|
|
180
|
+
- No data loss
|
|
181
|
+
|
|
182
|
+
3. **After Verification**:
|
|
183
|
+
- Only delete old collection after 24-48 hours
|
|
184
|
+
- Ensure new collection works correctly
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Alternative: Manual Schema Update (If Supported)
|
|
189
|
+
|
|
190
|
+
**Note**: Weaviate typically doesn't support adding properties to existing collections. Check Weaviate documentation for your version to see if schema evolution is supported.
|
|
191
|
+
|
|
192
|
+
If supported:
|
|
193
|
+
```bash
|
|
194
|
+
# Use Weaviate API to add properties
|
|
195
|
+
# This is version-dependent and may not be available
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Production Checklist
|
|
201
|
+
|
|
202
|
+
- [ ] Backup current `Memory_public` data
|
|
203
|
+
- [ ] Create `Memory_public_v2` with full schema
|
|
204
|
+
- [ ] Migrate all data with comment fields initialized
|
|
205
|
+
- [ ] Test new collection thoroughly
|
|
206
|
+
- [ ] Update `PUBLIC_COLLECTION_NAME` constant
|
|
207
|
+
- [ ] Deploy updated code
|
|
208
|
+
- [ ] Verify in production
|
|
209
|
+
- [ ] Monitor for 24-48 hours
|
|
210
|
+
- [ ] Delete old `Memory_public` collection
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Notes
|
|
215
|
+
|
|
216
|
+
- This migration is required for comment system to work in shared spaces
|
|
217
|
+
- Personal memory collections (`Memory_{user_id}`) don't need migration if created after Task 55
|
|
218
|
+
- Old personal collections may also need migration (separate task)
|
|
219
|
+
- Consider running migration during low-traffic period
|
|
220
|
+
- Document migration in CHANGELOG.md
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
**Status**: Not Started
|
|
225
|
+
**Recommendation**: Execute Option 2 (safe migration) during next deployment window
|
|
226
|
+
**Priority**: High - Blocks comment system in shared spaces
|
|
@@ -30,7 +30,7 @@ export declare const CONTENT_TYPE_CATEGORIES: {
|
|
|
30
30
|
readonly communication: readonly ["email", "conversation", "meeting", "person"];
|
|
31
31
|
readonly content: readonly ["article", "webpage", "social", "presentation", "spreadsheet", "pdf"];
|
|
32
32
|
readonly media: readonly ["image", "video", "audio", "transcript"];
|
|
33
|
-
readonly creative: readonly ["song", "screenplay", "recipe", "idea", "quote"];
|
|
33
|
+
readonly creative: readonly ["song", "screenplay", "recipe", "idea", "quote", "poetry"];
|
|
34
34
|
readonly personal: readonly ["journal", "memory", "event"];
|
|
35
35
|
readonly organizational: readonly ["bookmark", "form", "location"];
|
|
36
36
|
readonly business: readonly ["invoice", "contract"];
|
package/dist/server-factory.js
CHANGED
|
@@ -981,6 +981,7 @@ var CONTENT_TYPES = [
|
|
|
981
981
|
"recipe",
|
|
982
982
|
"idea",
|
|
983
983
|
"quote",
|
|
984
|
+
"poetry",
|
|
984
985
|
// Personal
|
|
985
986
|
"journal",
|
|
986
987
|
"memory",
|
|
@@ -1197,6 +1198,13 @@ var CONTENT_TYPE_METADATA = {
|
|
|
1197
1198
|
examples: ["Quotes", "Excerpts", "Highlights", "Citations"],
|
|
1198
1199
|
common_fields: ["author", "source"]
|
|
1199
1200
|
},
|
|
1201
|
+
poetry: {
|
|
1202
|
+
name: "poetry",
|
|
1203
|
+
category: "creative",
|
|
1204
|
+
description: "Poems and poetic content",
|
|
1205
|
+
examples: ["Poems", "Verses", "Haiku", "Sonnets", "Free verse"],
|
|
1206
|
+
common_fields: ["author", "form", "theme"]
|
|
1207
|
+
},
|
|
1200
1208
|
// Personal
|
|
1201
1209
|
journal: {
|
|
1202
1210
|
name: "journal",
|
|
@@ -1391,6 +1399,20 @@ var createMemoryTool = {
|
|
|
1391
1399
|
type: "boolean",
|
|
1392
1400
|
description: "Skip automatic template suggestion",
|
|
1393
1401
|
default: false
|
|
1402
|
+
},
|
|
1403
|
+
parent_id: {
|
|
1404
|
+
type: "string",
|
|
1405
|
+
description: "ID of parent memory or comment (for threading). Leave null for top-level memories."
|
|
1406
|
+
},
|
|
1407
|
+
thread_root_id: {
|
|
1408
|
+
type: "string",
|
|
1409
|
+
description: "Root memory ID for thread. Leave null for top-level memories."
|
|
1410
|
+
},
|
|
1411
|
+
moderation_flags: {
|
|
1412
|
+
type: "array",
|
|
1413
|
+
items: { type: "string" },
|
|
1414
|
+
description: 'Per-space moderation flags (format: "{space_id}:{flag_type}"). Usually empty.',
|
|
1415
|
+
default: []
|
|
1394
1416
|
}
|
|
1395
1417
|
},
|
|
1396
1418
|
required: ["content"]
|
|
@@ -1452,7 +1474,11 @@ async function handleCreateMemory(args, userId, context) {
|
|
|
1452
1474
|
structured_content: args.structured_content,
|
|
1453
1475
|
// Computed weight
|
|
1454
1476
|
base_weight: args.weight ?? 0.5,
|
|
1455
|
-
computed_weight: args.weight ?? 0.5
|
|
1477
|
+
computed_weight: args.weight ?? 0.5,
|
|
1478
|
+
// Comment/threading fields (initialize to defaults)
|
|
1479
|
+
parent_id: args.parent_id ?? null,
|
|
1480
|
+
thread_root_id: args.thread_root_id ?? null,
|
|
1481
|
+
moderation_flags: args.moderation_flags ?? []
|
|
1456
1482
|
};
|
|
1457
1483
|
const result = await collection.data.insert({
|
|
1458
1484
|
properties: memory
|
|
@@ -1889,6 +1915,19 @@ var updateMemoryTool = {
|
|
|
1889
1915
|
structured_content: {
|
|
1890
1916
|
type: "object",
|
|
1891
1917
|
description: "Updated structured content"
|
|
1918
|
+
},
|
|
1919
|
+
parent_id: {
|
|
1920
|
+
type: "string",
|
|
1921
|
+
description: "Update parent ID (for threading)"
|
|
1922
|
+
},
|
|
1923
|
+
thread_root_id: {
|
|
1924
|
+
type: "string",
|
|
1925
|
+
description: "Update thread root ID"
|
|
1926
|
+
},
|
|
1927
|
+
moderation_flags: {
|
|
1928
|
+
type: "array",
|
|
1929
|
+
items: { type: "string" },
|
|
1930
|
+
description: "Update moderation flags"
|
|
1892
1931
|
}
|
|
1893
1932
|
},
|
|
1894
1933
|
required: ["memory_id"]
|
|
@@ -1901,7 +1940,7 @@ async function handleUpdateMemory(args, userId) {
|
|
|
1901
1940
|
let existingMemory;
|
|
1902
1941
|
try {
|
|
1903
1942
|
existingMemory = await collection.query.fetchObjectById(args.memory_id, {
|
|
1904
|
-
returnProperties: ["user_id", "doc_type", "version"
|
|
1943
|
+
returnProperties: ["user_id", "doc_type", "version"]
|
|
1905
1944
|
});
|
|
1906
1945
|
} catch (fetchError) {
|
|
1907
1946
|
const fetchErrorMsg = fetchError instanceof Error ? fetchError.message : String(fetchError);
|
|
@@ -1968,6 +2007,18 @@ async function handleUpdateMemory(args, userId) {
|
|
|
1968
2007
|
updates.structured_content = args.structured_content;
|
|
1969
2008
|
updatedFields.push("structured_content");
|
|
1970
2009
|
}
|
|
2010
|
+
if (args.parent_id !== void 0) {
|
|
2011
|
+
updates.parent_id = args.parent_id;
|
|
2012
|
+
updatedFields.push("parent_id");
|
|
2013
|
+
}
|
|
2014
|
+
if (args.thread_root_id !== void 0) {
|
|
2015
|
+
updates.thread_root_id = args.thread_root_id;
|
|
2016
|
+
updatedFields.push("thread_root_id");
|
|
2017
|
+
}
|
|
2018
|
+
if (args.moderation_flags !== void 0) {
|
|
2019
|
+
updates.moderation_flags = args.moderation_flags;
|
|
2020
|
+
updatedFields.push("moderation_flags");
|
|
2021
|
+
}
|
|
1971
2022
|
if (updatedFields.length === 0) {
|
|
1972
2023
|
throw new Error("No fields provided for update. At least one field must be specified.");
|
|
1973
2024
|
}
|