@prmichaelsen/remember-mcp 2.3.0 → 2.3.4
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 +114 -3
- package/CHANGELOG.md +27 -0
- package/agent/commands/acp.commit.md +511 -0
- package/agent/commands/acp.package-install.md +347 -0
- package/agent/commands/acp.report.md +392 -0
- package/agent/commands/acp.sync.md +323 -0
- package/agent/commands/acp.update.md +301 -0
- package/agent/commands/acp.validate.md +385 -0
- package/agent/design/comment-memory-type.md +556 -0
- package/agent/design/unified-public-collection.md +545 -0
- package/agent/progress.yaml +26 -0
- package/agent/scripts/install.sh +25 -1
- package/agent/scripts/update.sh +37 -0
- package/agent/tasks/task-44-implement-remember-retract.md +263 -0
- package/agent/tasks/task-45-fix-publish-false-success-bug.md +230 -0
- package/dist/server-factory.js +93 -7
- package/dist/server.js +93 -7
- package/package.json +1 -1
- package/src/services/confirmation-token.service.ts +33 -0
- package/src/tools/confirm.ts +49 -4
- package/src/tools/create-memory.ts +7 -0
- package/src/tools/publish.ts +26 -3
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
# Task 44: Implement remember_retract Tool
|
|
2
|
+
|
|
3
|
+
**Milestone**: M11 - Shared Spaces Enhancements (Future)
|
|
4
|
+
**Estimated Time**: 3 hours
|
|
5
|
+
**Dependencies**: M10 (Shared Spaces complete)
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Implement the `remember_retract` tool that allows users to unpublish (remove) their memories from shared spaces. Uses the same token-based confirmation pattern as `remember_publish`.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Steps
|
|
17
|
+
|
|
18
|
+
### 1. Create Tool File
|
|
19
|
+
|
|
20
|
+
Create `src/tools/retract.ts` with tool definition and handler.
|
|
21
|
+
|
|
22
|
+
**Actions**:
|
|
23
|
+
- Import required dependencies (token service, Weaviate client, types)
|
|
24
|
+
- Define tool schema with MCP Tool interface
|
|
25
|
+
- Create handler function signature
|
|
26
|
+
- Export both tool definition and handler
|
|
27
|
+
|
|
28
|
+
**Expected Outcome**: Tool file structure created
|
|
29
|
+
|
|
30
|
+
### 2. Define Tool Schema
|
|
31
|
+
|
|
32
|
+
Create MCP tool definition for remember_retract.
|
|
33
|
+
|
|
34
|
+
**Actions**:
|
|
35
|
+
- Set tool name: `remember_retract`
|
|
36
|
+
- Write clear description for LLM
|
|
37
|
+
- Define input schema with properties:
|
|
38
|
+
- `space_memory_id` (required): ID of memory in shared space
|
|
39
|
+
- `space` (required): Space ID (enum: ['the_void'])
|
|
40
|
+
- Add helpful descriptions
|
|
41
|
+
|
|
42
|
+
**Expected Outcome**: Tool schema complete
|
|
43
|
+
|
|
44
|
+
### 3. Implement Memory Validation
|
|
45
|
+
|
|
46
|
+
Verify the space memory exists and user is the author.
|
|
47
|
+
|
|
48
|
+
**Actions**:
|
|
49
|
+
- Get space Weaviate collection
|
|
50
|
+
- Fetch space memory by ID
|
|
51
|
+
- Check if memory exists
|
|
52
|
+
- Verify `author_id` matches userId (not space_id)
|
|
53
|
+
- Return detailed error if validation fails
|
|
54
|
+
- Include context in error response
|
|
55
|
+
|
|
56
|
+
**Expected Outcome**: Memory ownership verified
|
|
57
|
+
|
|
58
|
+
### 4. Create Confirmation Payload
|
|
59
|
+
|
|
60
|
+
Build the payload to store with the token.
|
|
61
|
+
|
|
62
|
+
**Actions**:
|
|
63
|
+
- Extract space_memory_id from args
|
|
64
|
+
- Extract space from args
|
|
65
|
+
- Store only IDs (not full content)
|
|
66
|
+
- Keep payload minimal
|
|
67
|
+
|
|
68
|
+
**Expected Outcome**: Payload structure defined
|
|
69
|
+
|
|
70
|
+
### 5. Generate Confirmation Token
|
|
71
|
+
|
|
72
|
+
Use token service to create confirmation request.
|
|
73
|
+
|
|
74
|
+
**Actions**:
|
|
75
|
+
- Call `confirmationTokenService.createRequest()`
|
|
76
|
+
- Pass userId, action='retract_memory', payload, space
|
|
77
|
+
- Receive requestId and token
|
|
78
|
+
- Handle any errors from token service
|
|
79
|
+
|
|
80
|
+
**Expected Outcome**: Token generated successfully
|
|
81
|
+
|
|
82
|
+
### 6. Format Success Response
|
|
83
|
+
|
|
84
|
+
Return token to agent (minimal response).
|
|
85
|
+
|
|
86
|
+
**Actions**:
|
|
87
|
+
- Create response object with success flag
|
|
88
|
+
- Include token
|
|
89
|
+
- Keep response minimal (agent already knows memory details)
|
|
90
|
+
- Format as JSON string
|
|
91
|
+
|
|
92
|
+
**Expected Outcome**: Clear response format
|
|
93
|
+
|
|
94
|
+
### 7. Update handleConfirm
|
|
95
|
+
|
|
96
|
+
Add retract action executor to confirm tool.
|
|
97
|
+
|
|
98
|
+
**Actions**:
|
|
99
|
+
- Open `src/tools/confirm.ts`
|
|
100
|
+
- Add `executeRetractMemory` function
|
|
101
|
+
- Validate token and fetch space memory
|
|
102
|
+
- Verify author_id matches userId
|
|
103
|
+
- Delete memory from space collection
|
|
104
|
+
- Return success with minimal response
|
|
105
|
+
|
|
106
|
+
**Expected Outcome**: Retract action can be executed
|
|
107
|
+
|
|
108
|
+
### 8. Implement Error Handling
|
|
109
|
+
|
|
110
|
+
Handle all error cases gracefully.
|
|
111
|
+
|
|
112
|
+
**Actions**:
|
|
113
|
+
- Memory not found error
|
|
114
|
+
- Permission denied error (not the author)
|
|
115
|
+
- Invalid space ID error
|
|
116
|
+
- Token service errors
|
|
117
|
+
- Weaviate connection errors
|
|
118
|
+
- Use `handleToolError` utility
|
|
119
|
+
- Include context in all errors
|
|
120
|
+
|
|
121
|
+
**Expected Outcome**: Comprehensive error handling
|
|
122
|
+
|
|
123
|
+
### 9. Add Tool to Server
|
|
124
|
+
|
|
125
|
+
Register tool in both server files.
|
|
126
|
+
|
|
127
|
+
**Actions**:
|
|
128
|
+
- Import tool in `src/server.ts`
|
|
129
|
+
- Add to tools list in ListToolsRequestSchema handler
|
|
130
|
+
- Add to CallToolRequestSchema handler
|
|
131
|
+
- Repeat for `src/server-factory.ts`
|
|
132
|
+
- Test tool registration
|
|
133
|
+
|
|
134
|
+
**Expected Outcome**: Tool available in MCP server
|
|
135
|
+
|
|
136
|
+
### 10. Create Unit Tests
|
|
137
|
+
|
|
138
|
+
Test the retract tool thoroughly.
|
|
139
|
+
|
|
140
|
+
**Actions**:
|
|
141
|
+
- Create `src/tools/retract.spec.ts`
|
|
142
|
+
- Test successful token generation
|
|
143
|
+
- Test memory not found error
|
|
144
|
+
- Test permission denied error (wrong author)
|
|
145
|
+
- Test invalid space ID
|
|
146
|
+
- Mock Weaviate and token service
|
|
147
|
+
- Verify response format
|
|
148
|
+
|
|
149
|
+
**Expected Outcome**: All tests passing
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Verification
|
|
154
|
+
|
|
155
|
+
- [ ] `src/tools/retract.ts` created
|
|
156
|
+
- [ ] Tool schema defined with correct parameters
|
|
157
|
+
- [ ] Memory validation implemented (checks author_id)
|
|
158
|
+
- [ ] Token generation working
|
|
159
|
+
- [ ] Success response formatted correctly
|
|
160
|
+
- [ ] executeRetractMemory added to confirm.ts
|
|
161
|
+
- [ ] Error handling comprehensive
|
|
162
|
+
- [ ] Tool registered in server.ts
|
|
163
|
+
- [ ] Tool registered in server-factory.ts
|
|
164
|
+
- [ ] Unit tests created and passing
|
|
165
|
+
- [ ] TypeScript compiles without errors
|
|
166
|
+
- [ ] Build successful
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Tool Schema
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
export const retractTool = {
|
|
174
|
+
name: 'remember_retract',
|
|
175
|
+
description: 'Unpublish a memory from a shared space. The memory will be REMOVED from the shared collection. Generates a confirmation token. Use remember_confirm to execute.',
|
|
176
|
+
inputSchema: {
|
|
177
|
+
type: 'object',
|
|
178
|
+
properties: {
|
|
179
|
+
space_memory_id: {
|
|
180
|
+
type: 'string',
|
|
181
|
+
description: 'ID of the memory in the shared space to retract'
|
|
182
|
+
},
|
|
183
|
+
space: {
|
|
184
|
+
type: 'string',
|
|
185
|
+
description: 'Which space to retract from (snake_case ID)',
|
|
186
|
+
enum: ['the_void'],
|
|
187
|
+
default: 'the_void'
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
required: ['space_memory_id', 'space']
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Response Format
|
|
198
|
+
|
|
199
|
+
```json
|
|
200
|
+
{
|
|
201
|
+
"success": true,
|
|
202
|
+
"token": "550e8400-e29b-41d4-a716-446655440000"
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## executeRetractMemory Implementation
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
async function executeRetractMemory(
|
|
212
|
+
request: ConfirmationRequest & { request_id: string },
|
|
213
|
+
userId: string
|
|
214
|
+
): Promise<string> {
|
|
215
|
+
// Fetch space memory
|
|
216
|
+
const weaviateClient = getWeaviateClient();
|
|
217
|
+
const spaceCollection = await ensureSpaceCollection(
|
|
218
|
+
weaviateClient,
|
|
219
|
+
request.target_collection || 'the_void'
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
const spaceMemory = await spaceCollection.query.fetchObjectById(
|
|
223
|
+
request.payload.space_memory_id
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
if (!spaceMemory) {
|
|
227
|
+
return JSON.stringify({
|
|
228
|
+
success: false,
|
|
229
|
+
error: 'Memory not found',
|
|
230
|
+
message: `Space memory ${request.payload.space_memory_id} no longer exists`,
|
|
231
|
+
}, null, 2);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Verify user is the author
|
|
235
|
+
if (spaceMemory.properties.author_id !== userId) {
|
|
236
|
+
return JSON.stringify({
|
|
237
|
+
success: false,
|
|
238
|
+
error: 'Permission denied',
|
|
239
|
+
message: 'You can only retract your own published memories',
|
|
240
|
+
}, null, 2);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Delete from space collection
|
|
244
|
+
await spaceCollection.data.deleteById(request.payload.space_memory_id);
|
|
245
|
+
|
|
246
|
+
return JSON.stringify({
|
|
247
|
+
success: true,
|
|
248
|
+
}, null, 2);
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Related Files
|
|
255
|
+
|
|
256
|
+
- Design: [`agent/design/publish-tools-confirmation-flow.md`](../design/publish-tools-confirmation-flow.md)
|
|
257
|
+
- Token Service: [`src/services/confirmation-token.service.ts`](../../src/services/confirmation-token.service.ts)
|
|
258
|
+
- Confirm Tool: [`src/tools/confirm.ts`](../../src/tools/confirm.ts)
|
|
259
|
+
- Space Schema: [`src/weaviate/space-schema.ts`](../../src/weaviate/space-schema.ts)
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
**Next Task**: TBD - Part of future milestone for shared spaces enhancements
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
# Task 45: Fix remember_publish False Success Bug
|
|
2
|
+
|
|
3
|
+
**Milestone**: M10 - Shared Spaces & Confirmation Flow (Bug Fix)
|
|
4
|
+
**Estimated Time**: 2 hours
|
|
5
|
+
**Dependencies**: M10 (Tasks 34-40)
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
**Priority**: HIGH - Critical bug, false positive
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Fix the `remember_publish` and `remember_confirm` tools which report `success: true` but do not actually publish memories to The Void. The operation is completely non-functional - no write occurs, no duplication, no error thrown.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Problem Statement
|
|
18
|
+
|
|
19
|
+
### Symptoms
|
|
20
|
+
- `remember_confirm` returns `success: true`
|
|
21
|
+
- Database shows `Memory_the_void` collection has 0 objects
|
|
22
|
+
- Memory only exists in personal collection (not copied)
|
|
23
|
+
- No error is thrown
|
|
24
|
+
- False positive misleads users and agents
|
|
25
|
+
|
|
26
|
+
### Impact
|
|
27
|
+
- Core feature completely non-functional
|
|
28
|
+
- False success responses worse than errors (misleading)
|
|
29
|
+
- Breaks agent reliability and user trust
|
|
30
|
+
- No workaround available
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Steps
|
|
35
|
+
|
|
36
|
+
### 1. Verify Collection Exists
|
|
37
|
+
|
|
38
|
+
Check if `Memory_the_void` collection exists in Weaviate.
|
|
39
|
+
|
|
40
|
+
**Actions**:
|
|
41
|
+
- Query Weaviate for collection list
|
|
42
|
+
- Check if `Memory_the_void` exists
|
|
43
|
+
- Verify collection schema if it exists
|
|
44
|
+
- Check write permissions
|
|
45
|
+
|
|
46
|
+
**Expected Outcome**: Collection status determined
|
|
47
|
+
|
|
48
|
+
### 2. Review executePublishMemory Function
|
|
49
|
+
|
|
50
|
+
Examine the publish execution logic in confirm.ts.
|
|
51
|
+
|
|
52
|
+
**Actions**:
|
|
53
|
+
- Open [`src/tools/confirm.ts`](../../src/tools/confirm.ts)
|
|
54
|
+
- Review `executePublishMemory` function
|
|
55
|
+
- Check if `targetCollection.data.insert()` is called
|
|
56
|
+
- Verify result is returned correctly
|
|
57
|
+
- Check error handling
|
|
58
|
+
|
|
59
|
+
**Expected Outcome**: Code logic understood
|
|
60
|
+
|
|
61
|
+
### 3. Add Debug Logging
|
|
62
|
+
|
|
63
|
+
Add logging to track execution flow.
|
|
64
|
+
|
|
65
|
+
**Actions**:
|
|
66
|
+
- Add log before collection fetch
|
|
67
|
+
- Add log before memory fetch
|
|
68
|
+
- Add log before insert operation
|
|
69
|
+
- Add log after insert with result
|
|
70
|
+
- Log any caught errors
|
|
71
|
+
|
|
72
|
+
**Expected Outcome**: Execution flow visible
|
|
73
|
+
|
|
74
|
+
### 4. Test Locally
|
|
75
|
+
|
|
76
|
+
Run publish workflow with logging enabled.
|
|
77
|
+
|
|
78
|
+
**Actions**:
|
|
79
|
+
- Create test memory
|
|
80
|
+
- Call remember_publish
|
|
81
|
+
- Call remember_confirm with token
|
|
82
|
+
- Check logs for execution flow
|
|
83
|
+
- Verify if insert is called
|
|
84
|
+
- Check Weaviate for result
|
|
85
|
+
|
|
86
|
+
**Expected Outcome**: Root cause identified
|
|
87
|
+
|
|
88
|
+
### 5. Fix the Bug
|
|
89
|
+
|
|
90
|
+
Implement the fix based on root cause.
|
|
91
|
+
|
|
92
|
+
**Possible Fixes**:
|
|
93
|
+
- **If collection doesn't exist**: Ensure `ensureSpaceCollection()` creates it
|
|
94
|
+
- **If insert not called**: Fix logic flow to reach insert
|
|
95
|
+
- **If insert fails silently**: Add proper error handling
|
|
96
|
+
- **If permissions issue**: Fix Weaviate configuration
|
|
97
|
+
- **If wrong collection**: Fix collection name generation
|
|
98
|
+
|
|
99
|
+
**Expected Outcome**: Bug fixed
|
|
100
|
+
|
|
101
|
+
### 6. Verify Fix
|
|
102
|
+
|
|
103
|
+
Test that publish actually works.
|
|
104
|
+
|
|
105
|
+
**Actions**:
|
|
106
|
+
- Create test memory
|
|
107
|
+
- Publish to The Void
|
|
108
|
+
- Confirm publication
|
|
109
|
+
- Query `Memory_the_void` collection
|
|
110
|
+
- Verify memory exists in space
|
|
111
|
+
- Verify original memory unchanged
|
|
112
|
+
- Test search_space finds it
|
|
113
|
+
|
|
114
|
+
**Expected Outcome**: Publish works correctly
|
|
115
|
+
|
|
116
|
+
### 7. Add Integration Test
|
|
117
|
+
|
|
118
|
+
Create test for full publish workflow.
|
|
119
|
+
|
|
120
|
+
**Actions**:
|
|
121
|
+
- Create integration test file
|
|
122
|
+
- Test: create → publish → confirm → verify in space
|
|
123
|
+
- Test: search_space finds published memory
|
|
124
|
+
- Test: original memory still in personal collection
|
|
125
|
+
- Requires live Weaviate instance
|
|
126
|
+
|
|
127
|
+
**Expected Outcome**: Integration test passing
|
|
128
|
+
|
|
129
|
+
### 8. Update Error Handling
|
|
130
|
+
|
|
131
|
+
Ensure errors are caught and reported.
|
|
132
|
+
|
|
133
|
+
**Actions**:
|
|
134
|
+
- Add try-catch around insert operation
|
|
135
|
+
- Return detailed error if insert fails
|
|
136
|
+
- Include Weaviate error details
|
|
137
|
+
- Test error scenarios
|
|
138
|
+
|
|
139
|
+
**Expected Outcome**: Errors reported accurately
|
|
140
|
+
|
|
141
|
+
### 9. Test Edge Cases
|
|
142
|
+
|
|
143
|
+
Verify fix handles edge cases.
|
|
144
|
+
|
|
145
|
+
**Actions**:
|
|
146
|
+
- Test with large memory
|
|
147
|
+
- Test with memory that has relationships
|
|
148
|
+
- Test with memory that has special characters
|
|
149
|
+
- Test concurrent publishes
|
|
150
|
+
- Test expired token
|
|
151
|
+
|
|
152
|
+
**Expected Outcome**: All edge cases handled
|
|
153
|
+
|
|
154
|
+
### 10. Update Documentation
|
|
155
|
+
|
|
156
|
+
Document the fix.
|
|
157
|
+
|
|
158
|
+
**Actions**:
|
|
159
|
+
- Add to CHANGELOG (patch version)
|
|
160
|
+
- Update any affected documentation
|
|
161
|
+
- Note in progress.yaml
|
|
162
|
+
- Document root cause for future reference
|
|
163
|
+
|
|
164
|
+
**Expected Outcome**: Fix documented
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Verification
|
|
169
|
+
|
|
170
|
+
- [ ] Root cause identified
|
|
171
|
+
- [ ] Bug fixed in code
|
|
172
|
+
- [ ] Memory actually written to `Memory_the_void`
|
|
173
|
+
- [ ] Published memory discoverable via search_space
|
|
174
|
+
- [ ] Original memory unchanged in personal collection
|
|
175
|
+
- [ ] Error handling accurate (no false positives)
|
|
176
|
+
- [ ] Integration test created
|
|
177
|
+
- [ ] All tests passing
|
|
178
|
+
- [ ] TypeScript compiles
|
|
179
|
+
- [ ] Build successful
|
|
180
|
+
- [ ] Changes committed and pushed
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Investigation Checklist
|
|
185
|
+
|
|
186
|
+
- [ ] Check if `Memory_the_void` collection exists
|
|
187
|
+
- [ ] Verify `ensureSpaceCollection()` is called
|
|
188
|
+
- [ ] Verify `targetCollection.data.insert()` is called
|
|
189
|
+
- [ ] Check if insert returns a result
|
|
190
|
+
- [ ] Verify result is used in response
|
|
191
|
+
- [ ] Check server logs for errors
|
|
192
|
+
- [ ] Test with actual Weaviate instance
|
|
193
|
+
- [ ] Verify Weaviate write permissions
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Expected Fix
|
|
198
|
+
|
|
199
|
+
The bug is likely in [`src/tools/confirm.ts`](../../src/tools/confirm.ts) in the `executePublishMemory` function. The insert operation may not be executing or may be failing silently.
|
|
200
|
+
|
|
201
|
+
**Likely Issue**: Missing await, incorrect API usage, or silent error
|
|
202
|
+
|
|
203
|
+
**Expected Code**:
|
|
204
|
+
```typescript
|
|
205
|
+
const result = await targetCollection.data.insert({
|
|
206
|
+
properties: publishedMemory as any,
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// Verify result
|
|
210
|
+
if (!result) {
|
|
211
|
+
throw new Error('Failed to insert memory into space collection');
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return JSON.stringify({
|
|
215
|
+
success: true,
|
|
216
|
+
space_memory_id: result,
|
|
217
|
+
}, null, 2);
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Related Files
|
|
223
|
+
|
|
224
|
+
- Confirm Tool: [`src/tools/confirm.ts`](../../src/tools/confirm.ts)
|
|
225
|
+
- Space Schema: [`src/weaviate/space-schema.ts`](../../src/weaviate/space-schema.ts)
|
|
226
|
+
- Design: [`agent/design/publish-tools-confirmation-flow.md`](../design/publish-tools-confirmation-flow.md)
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
**Next Task**: Investigate and fix immediately - blocks shared spaces feature
|
package/dist/server-factory.js
CHANGED
|
@@ -1211,6 +1211,13 @@ var createMemoryTool = {
|
|
|
1211
1211
|
Each memory has a weight (significance 0-1) and trust level (access control 0-1).
|
|
1212
1212
|
Location and context are automatically captured from the request.
|
|
1213
1213
|
|
|
1214
|
+
**IMPORTANT - Content vs Summary**:
|
|
1215
|
+
- **content**: MUST be EXACT user-provided text. DO NOT paraphrase or modify.
|
|
1216
|
+
- **summary**: Use for AI-generated summaries or interpretations.
|
|
1217
|
+
- Example: User says "Remember: Meeting at 3pm tomorrow"
|
|
1218
|
+
\u2192 content: "Meeting at 3pm tomorrow" (EXACT)
|
|
1219
|
+
\u2192 summary: "User has meeting on 2026-02-17 at 15:00" (AI interpretation)
|
|
1220
|
+
|
|
1214
1221
|
Examples:
|
|
1215
1222
|
- "Remember that I met Sarah at the conference"
|
|
1216
1223
|
- "Save this recipe for chocolate chip cookies"
|
|
@@ -3248,7 +3255,18 @@ var ConfirmationTokenService = class {
|
|
|
3248
3255
|
status: "pending"
|
|
3249
3256
|
};
|
|
3250
3257
|
const collectionPath = `users/${userId}/requests`;
|
|
3258
|
+
console.log("[ConfirmationTokenService] Creating request:", {
|
|
3259
|
+
userId,
|
|
3260
|
+
action,
|
|
3261
|
+
targetCollection,
|
|
3262
|
+
collectionPath
|
|
3263
|
+
});
|
|
3251
3264
|
const docRef = await addDocument(collectionPath, request);
|
|
3265
|
+
console.log("[ConfirmationTokenService] Request created:", {
|
|
3266
|
+
requestId: docRef.id,
|
|
3267
|
+
token,
|
|
3268
|
+
expiresAt: request.expires_at
|
|
3269
|
+
});
|
|
3252
3270
|
return { requestId: docRef.id, token };
|
|
3253
3271
|
}
|
|
3254
3272
|
/**
|
|
@@ -3260,6 +3278,11 @@ var ConfirmationTokenService = class {
|
|
|
3260
3278
|
*/
|
|
3261
3279
|
async validateToken(userId, token) {
|
|
3262
3280
|
const collectionPath = `users/${userId}/requests`;
|
|
3281
|
+
console.log("[ConfirmationTokenService] Validating token:", {
|
|
3282
|
+
userId,
|
|
3283
|
+
token,
|
|
3284
|
+
collectionPath
|
|
3285
|
+
});
|
|
3263
3286
|
const queryOptions = {
|
|
3264
3287
|
where: [
|
|
3265
3288
|
{ field: "token", op: "==", value: token },
|
|
@@ -3268,13 +3291,25 @@ var ConfirmationTokenService = class {
|
|
|
3268
3291
|
limit: 1
|
|
3269
3292
|
};
|
|
3270
3293
|
const results = await queryDocuments(collectionPath, queryOptions);
|
|
3294
|
+
console.log("[ConfirmationTokenService] Query results:", {
|
|
3295
|
+
resultsFound: results.length,
|
|
3296
|
+
hasResults: results.length > 0
|
|
3297
|
+
});
|
|
3271
3298
|
if (results.length === 0) {
|
|
3299
|
+
console.log("[ConfirmationTokenService] Token not found or not pending");
|
|
3272
3300
|
return null;
|
|
3273
3301
|
}
|
|
3274
3302
|
const doc = results[0];
|
|
3275
3303
|
const request = doc.data;
|
|
3304
|
+
console.log("[ConfirmationTokenService] Request found:", {
|
|
3305
|
+
requestId: doc.id,
|
|
3306
|
+
action: request.action,
|
|
3307
|
+
status: request.status,
|
|
3308
|
+
expiresAt: request.expires_at
|
|
3309
|
+
});
|
|
3276
3310
|
const expiresAt = new Date(request.expires_at);
|
|
3277
3311
|
if (expiresAt.getTime() < Date.now()) {
|
|
3312
|
+
console.log("[ConfirmationTokenService] Token expired");
|
|
3278
3313
|
await this.updateStatus(userId, doc.id, "expired");
|
|
3279
3314
|
return null;
|
|
3280
3315
|
}
|
|
@@ -3573,7 +3608,14 @@ var publishTool = {
|
|
|
3573
3608
|
};
|
|
3574
3609
|
async function handlePublish(args, userId) {
|
|
3575
3610
|
try {
|
|
3611
|
+
console.log("[remember_publish] Starting publish request:", {
|
|
3612
|
+
userId,
|
|
3613
|
+
memoryId: args.memory_id,
|
|
3614
|
+
target: args.target,
|
|
3615
|
+
additionalTags: args.additional_tags?.length || 0
|
|
3616
|
+
});
|
|
3576
3617
|
if (!isValidSpaceId(args.target)) {
|
|
3618
|
+
console.log("[remember_publish] Invalid space ID:", args.target);
|
|
3577
3619
|
return JSON.stringify(
|
|
3578
3620
|
{
|
|
3579
3621
|
success: false,
|
|
@@ -3589,11 +3631,16 @@ async function handlePublish(args, userId) {
|
|
|
3589
3631
|
);
|
|
3590
3632
|
}
|
|
3591
3633
|
const weaviateClient = getWeaviateClient();
|
|
3592
|
-
const
|
|
3593
|
-
|
|
3594
|
-
);
|
|
3634
|
+
const collectionName = getMemoryCollectionName(userId);
|
|
3635
|
+
console.log("[remember_publish] Fetching memory from collection:", collectionName);
|
|
3636
|
+
const userCollection = weaviateClient.collections.get(collectionName);
|
|
3595
3637
|
const memory = await userCollection.query.fetchObjectById(args.memory_id);
|
|
3638
|
+
console.log("[remember_publish] Memory fetch result:", {
|
|
3639
|
+
found: !!memory,
|
|
3640
|
+
memoryId: args.memory_id
|
|
3641
|
+
});
|
|
3596
3642
|
if (!memory) {
|
|
3643
|
+
console.log("[remember_publish] Memory not found");
|
|
3597
3644
|
return JSON.stringify(
|
|
3598
3645
|
{
|
|
3599
3646
|
success: false,
|
|
@@ -3643,12 +3690,18 @@ async function handlePublish(args, userId) {
|
|
|
3643
3690
|
memory_id: args.memory_id,
|
|
3644
3691
|
additional_tags: args.additional_tags || []
|
|
3645
3692
|
};
|
|
3693
|
+
console.log("[remember_publish] Generating confirmation token");
|
|
3646
3694
|
const { requestId, token } = await confirmationTokenService.createRequest(
|
|
3647
3695
|
userId,
|
|
3648
3696
|
"publish_memory",
|
|
3649
3697
|
payload,
|
|
3650
3698
|
args.target
|
|
3651
3699
|
);
|
|
3700
|
+
console.log("[remember_publish] Token generated:", {
|
|
3701
|
+
requestId,
|
|
3702
|
+
token,
|
|
3703
|
+
action: "publish_memory"
|
|
3704
|
+
});
|
|
3652
3705
|
return JSON.stringify(
|
|
3653
3706
|
{
|
|
3654
3707
|
success: true,
|
|
@@ -3685,8 +3738,17 @@ var confirmTool = {
|
|
|
3685
3738
|
};
|
|
3686
3739
|
async function handleConfirm(args, userId) {
|
|
3687
3740
|
try {
|
|
3741
|
+
console.log("[remember_confirm] Starting confirmation:", {
|
|
3742
|
+
userId,
|
|
3743
|
+
token: args.token
|
|
3744
|
+
});
|
|
3688
3745
|
const request = await confirmationTokenService.confirmRequest(userId, args.token);
|
|
3746
|
+
console.log("[remember_confirm] Token validation result:", {
|
|
3747
|
+
requestFound: !!request,
|
|
3748
|
+
action: request?.action
|
|
3749
|
+
});
|
|
3689
3750
|
if (!request) {
|
|
3751
|
+
console.log("[remember_confirm] Token invalid or expired");
|
|
3690
3752
|
return JSON.stringify(
|
|
3691
3753
|
{
|
|
3692
3754
|
success: false,
|
|
@@ -3697,6 +3759,7 @@ async function handleConfirm(args, userId) {
|
|
|
3697
3759
|
2
|
|
3698
3760
|
);
|
|
3699
3761
|
}
|
|
3762
|
+
console.log("[remember_confirm] Executing action:", request.action);
|
|
3700
3763
|
if (request.action === "publish_memory") {
|
|
3701
3764
|
return await executePublishMemory(request, userId);
|
|
3702
3765
|
}
|
|
@@ -3712,14 +3775,25 @@ async function handleConfirm(args, userId) {
|
|
|
3712
3775
|
}
|
|
3713
3776
|
async function executePublishMemory(request, userId) {
|
|
3714
3777
|
try {
|
|
3778
|
+
console.log("[executePublishMemory] Starting execution:", {
|
|
3779
|
+
userId,
|
|
3780
|
+
memoryId: request.payload.memory_id,
|
|
3781
|
+
targetSpace: request.target_collection
|
|
3782
|
+
});
|
|
3715
3783
|
const weaviateClient = getWeaviateClient();
|
|
3716
3784
|
const userCollection = weaviateClient.collections.get(
|
|
3717
3785
|
getMemoryCollectionName(userId)
|
|
3718
3786
|
);
|
|
3787
|
+
console.log("[executePublishMemory] Fetching original memory from:", getMemoryCollectionName(userId));
|
|
3719
3788
|
const originalMemory = await userCollection.query.fetchObjectById(
|
|
3720
3789
|
request.payload.memory_id
|
|
3721
3790
|
);
|
|
3791
|
+
console.log("[executePublishMemory] Original memory fetch result:", {
|
|
3792
|
+
found: !!originalMemory,
|
|
3793
|
+
memoryId: request.payload.memory_id
|
|
3794
|
+
});
|
|
3722
3795
|
if (!originalMemory) {
|
|
3796
|
+
console.log("[executePublishMemory] Memory not found");
|
|
3723
3797
|
return JSON.stringify(
|
|
3724
3798
|
{
|
|
3725
3799
|
success: false,
|
|
@@ -3731,6 +3805,7 @@ async function executePublishMemory(request, userId) {
|
|
|
3731
3805
|
);
|
|
3732
3806
|
}
|
|
3733
3807
|
if (originalMemory.properties.user_id !== userId) {
|
|
3808
|
+
console.log("[executePublishMemory] Permission denied - wrong owner");
|
|
3734
3809
|
return JSON.stringify(
|
|
3735
3810
|
{
|
|
3736
3811
|
success: false,
|
|
@@ -3741,18 +3816,20 @@ async function executePublishMemory(request, userId) {
|
|
|
3741
3816
|
2
|
|
3742
3817
|
);
|
|
3743
3818
|
}
|
|
3819
|
+
console.log("[executePublishMemory] Ensuring space collection:", request.target_collection || "the_void");
|
|
3744
3820
|
const targetCollection = await ensureSpaceCollection(
|
|
3745
3821
|
weaviateClient,
|
|
3746
3822
|
request.target_collection || "the_void"
|
|
3747
3823
|
);
|
|
3824
|
+
console.log("[executePublishMemory] Space collection ready");
|
|
3748
3825
|
const originalTags = Array.isArray(originalMemory.properties.tags) ? originalMemory.properties.tags : [];
|
|
3749
3826
|
const additionalTags = Array.isArray(request.payload.additional_tags) ? request.payload.additional_tags : [];
|
|
3750
3827
|
const publishedMemory = {
|
|
3751
3828
|
...originalMemory.properties,
|
|
3752
|
-
//
|
|
3829
|
+
// Add space-specific fields
|
|
3753
3830
|
space_id: request.target_collection || "the_void",
|
|
3754
3831
|
author_id: userId,
|
|
3755
|
-
//
|
|
3832
|
+
// Track original author
|
|
3756
3833
|
published_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3757
3834
|
discovery_count: 0,
|
|
3758
3835
|
doc_type: "space_memory",
|
|
@@ -3764,8 +3841,17 @@ async function executePublishMemory(request, userId) {
|
|
|
3764
3841
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3765
3842
|
version: 1
|
|
3766
3843
|
};
|
|
3767
|
-
|
|
3768
|
-
|
|
3844
|
+
console.log("[executePublishMemory] Inserting into space collection:", {
|
|
3845
|
+
spaceId: request.target_collection || "the_void",
|
|
3846
|
+
memoryId: request.payload.memory_id,
|
|
3847
|
+
hasUserId: !!publishedMemory.user_id,
|
|
3848
|
+
hasAuthorId: !!publishedMemory.author_id,
|
|
3849
|
+
hasSpaceId: !!publishedMemory.space_id
|
|
3850
|
+
});
|
|
3851
|
+
const result = await targetCollection.data.insert(publishedMemory);
|
|
3852
|
+
console.log("[executePublishMemory] Insert result:", {
|
|
3853
|
+
success: !!result,
|
|
3854
|
+
spaceMemoryId: result
|
|
3769
3855
|
});
|
|
3770
3856
|
return JSON.stringify(
|
|
3771
3857
|
{
|