@prmichaelsen/remember-mcp 3.0.0 → 3.12.0

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.
Files changed (208) hide show
  1. package/AGENT.md +296 -250
  2. package/CHANGELOG.md +338 -0
  3. package/README.md +68 -45
  4. package/agent/commands/acp.clarification-create.md +382 -0
  5. package/agent/commands/acp.project-info.md +309 -0
  6. package/agent/commands/acp.project-remove.md +379 -0
  7. package/agent/commands/acp.project-update.md +296 -0
  8. package/agent/commands/acp.task-create.md +17 -9
  9. package/agent/commands/git.commit.md +13 -1
  10. package/agent/design/comment-memory-type.md +2 -2
  11. package/agent/design/local.collaborative-memory-sync.md +265 -0
  12. package/agent/design/local.content-flags.md +210 -0
  13. package/agent/design/local.ghost-persona-system.md +273 -0
  14. package/agent/design/local.group-acl-integration.md +338 -0
  15. package/agent/design/local.memory-acl-schema.md +352 -0
  16. package/agent/design/local.memory-collection-pattern-v2.md +348 -0
  17. package/agent/design/local.moderation-and-space-config.md +257 -0
  18. package/agent/design/local.v2-api-reference.md +621 -0
  19. package/agent/design/local.v2-migration-guide.md +191 -0
  20. package/agent/design/local.v2-usage-examples.md +265 -0
  21. package/agent/design/permissions-storage-architecture.md +11 -3
  22. package/agent/design/trust-escalation-prevention.md +9 -2
  23. package/agent/design/trust-system-implementation.md +12 -3
  24. package/agent/milestones/milestone-14-memory-collection-v2.md +182 -0
  25. package/agent/milestones/milestone-15-moderation-space-config.md +126 -0
  26. package/agent/progress.yaml +628 -49
  27. package/agent/scripts/acp.common.sh +2 -0
  28. package/agent/scripts/acp.install.sh +11 -1
  29. package/agent/scripts/acp.package-install-optimized.sh +454 -0
  30. package/agent/scripts/acp.package-install.sh +247 -300
  31. package/agent/scripts/acp.project-info.sh +218 -0
  32. package/agent/scripts/acp.project-remove.sh +302 -0
  33. package/agent/scripts/acp.project-update.sh +296 -0
  34. package/agent/scripts/acp.yaml-parser.sh +128 -10
  35. package/agent/tasks/milestone-14-memory-collection-v2/task-165-core-infrastructure-setup.md +171 -0
  36. package/agent/tasks/milestone-14-memory-collection-v2/task-166-update-remember-publish.md +191 -0
  37. package/agent/tasks/milestone-14-memory-collection-v2/task-167-update-remember-retract.md +186 -0
  38. package/agent/tasks/milestone-14-memory-collection-v2/task-168-implement-remember-revise.md +184 -0
  39. package/agent/tasks/milestone-14-memory-collection-v2/task-169-update-remember-search-space.md +179 -0
  40. package/agent/tasks/milestone-14-memory-collection-v2/task-170-update-remember-create-update.md +139 -0
  41. package/agent/tasks/milestone-14-memory-collection-v2/task-172-performance-testing-optimization.md +161 -0
  42. package/agent/tasks/milestone-14-memory-collection-v2/task-173-documentation-examples.md +258 -0
  43. package/agent/tasks/milestone-15-moderation-space-config/task-174-add-moderation-schema-fields.md +57 -0
  44. package/agent/tasks/milestone-15-moderation-space-config/task-175-create-space-config-service.md +64 -0
  45. package/agent/tasks/milestone-15-moderation-space-config/task-176-wire-moderation-publish-flow.md +45 -0
  46. package/agent/tasks/milestone-15-moderation-space-config/task-177-add-moderation-search-filters.md +70 -0
  47. package/agent/tasks/milestone-15-moderation-space-config/task-178-create-remember-moderate-tool.md +69 -0
  48. package/agent/tasks/milestone-15-moderation-space-config/task-179-documentation-integration-tests.md +58 -0
  49. package/agent/tasks/milestone-16-ghost-system/task-187-ghost-config-firestore.md +41 -0
  50. package/agent/tasks/milestone-16-ghost-system/task-188-trust-filter-integration.md +44 -0
  51. package/agent/tasks/milestone-16-ghost-system/task-189-ghost-memory-filtering.md +43 -0
  52. package/agent/tasks/milestone-16-ghost-system/task-190-ghost-config-tools.md +45 -0
  53. package/agent/tasks/milestone-16-ghost-system/task-191-escalation-firestore.md +38 -0
  54. package/agent/tasks/milestone-16-ghost-system/task-192-documentation-verification.md +39 -0
  55. package/agent/tasks/milestone-7-trust-permissions/task-180-access-result-permission-types.md +69 -0
  56. package/agent/tasks/milestone-7-trust-permissions/task-181-firestore-permissions-access-logs.md +56 -0
  57. package/agent/tasks/milestone-7-trust-permissions/task-182-trust-enforcement-service.md +68 -0
  58. package/agent/tasks/milestone-7-trust-permissions/task-183-access-control-service.md +70 -0
  59. package/agent/tasks/milestone-7-trust-permissions/task-184-permission-tools.md +79 -0
  60. package/agent/tasks/milestone-7-trust-permissions/task-185-wire-trust-into-search-query.md +55 -0
  61. package/agent/tasks/milestone-7-trust-permissions/task-186-documentation-verification.md +56 -0
  62. package/agent/tasks/task-76-fix-indexnullstate-schema-bug.md +197 -0
  63. package/dist/collections/composite-ids.d.ts +106 -0
  64. package/dist/collections/core-infrastructure.spec.d.ts +11 -0
  65. package/dist/collections/dot-notation.d.ts +106 -0
  66. package/dist/collections/tracking-arrays.d.ts +176 -0
  67. package/dist/constants/content-types.d.ts +1 -0
  68. package/dist/schema/v2-collections-comments.spec.d.ts +8 -0
  69. package/dist/schema/v2-collections.d.ts +210 -0
  70. package/dist/server-factory.d.ts +15 -0
  71. package/dist/server-factory.js +2798 -1029
  72. package/dist/server.js +2526 -1012
  73. package/dist/services/access-control.d.ts +103 -0
  74. package/dist/services/access-control.spec.d.ts +2 -0
  75. package/dist/services/credentials-provider.d.ts +24 -0
  76. package/dist/services/credentials-provider.spec.d.ts +2 -0
  77. package/dist/services/escalation.service.d.ts +22 -0
  78. package/dist/services/escalation.service.spec.d.ts +2 -0
  79. package/dist/services/ghost-config.service.d.ts +55 -0
  80. package/dist/services/ghost-config.service.spec.d.ts +2 -0
  81. package/dist/services/space-config.service.d.ts +23 -0
  82. package/dist/services/space-config.service.spec.d.ts +2 -0
  83. package/dist/services/trust-enforcement.d.ts +83 -0
  84. package/dist/services/trust-enforcement.spec.d.ts +2 -0
  85. package/dist/services/trust-validator.d.ts +43 -0
  86. package/dist/services/trust-validator.spec.d.ts +2 -0
  87. package/dist/tools/confirm-publish-moderation.spec.d.ts +8 -0
  88. package/dist/tools/confirm.d.ts +8 -1
  89. package/dist/tools/create-memory.d.ts +2 -1
  90. package/dist/tools/create-memory.spec.d.ts +10 -0
  91. package/dist/tools/create-relationship.d.ts +2 -1
  92. package/dist/tools/delete-memory.d.ts +2 -1
  93. package/dist/tools/delete-relationship.d.ts +2 -1
  94. package/dist/tools/deny.d.ts +2 -1
  95. package/dist/tools/find-similar.d.ts +2 -1
  96. package/dist/tools/get-preferences.d.ts +2 -1
  97. package/dist/tools/ghost-config.d.ts +27 -0
  98. package/dist/tools/ghost-config.spec.d.ts +2 -0
  99. package/dist/tools/moderate.d.ts +20 -0
  100. package/dist/tools/moderate.spec.d.ts +5 -0
  101. package/dist/tools/publish.d.ts +11 -3
  102. package/dist/tools/query-memory.d.ts +3 -1
  103. package/dist/tools/query-space.d.ts +4 -1
  104. package/dist/tools/retract.d.ts +29 -0
  105. package/dist/tools/revise.d.ts +45 -0
  106. package/dist/tools/revise.spec.d.ts +8 -0
  107. package/dist/tools/search-memory.d.ts +2 -1
  108. package/dist/tools/search-relationship.d.ts +2 -1
  109. package/dist/tools/search-space.d.ts +25 -5
  110. package/dist/tools/search-space.spec.d.ts +9 -0
  111. package/dist/tools/set-preference.d.ts +2 -1
  112. package/dist/tools/update-memory.d.ts +2 -1
  113. package/dist/tools/update-relationship.d.ts +2 -1
  114. package/dist/types/access-result.d.ts +48 -0
  115. package/dist/types/access-result.spec.d.ts +2 -0
  116. package/dist/types/auth.d.ts +46 -0
  117. package/dist/types/ghost-config.d.ts +36 -0
  118. package/dist/types/memory.d.ts +3 -1
  119. package/dist/types/preferences.d.ts +1 -1
  120. package/dist/utils/auth-helpers.d.ts +14 -0
  121. package/dist/utils/auth-helpers.spec.d.ts +2 -0
  122. package/dist/utils/test-data-generator.d.ts +124 -0
  123. package/dist/utils/test-data-generator.spec.d.ts +12 -0
  124. package/dist/v2-performance.e2e.d.ts +17 -0
  125. package/dist/v2-smoke.e2e.d.ts +14 -0
  126. package/dist/weaviate/client.d.ts +5 -8
  127. package/dist/weaviate/space-schema.d.ts +2 -2
  128. package/docs/performance/v2-benchmarks.md +80 -0
  129. package/jest.e2e.config.js +14 -3
  130. package/package.json +1 -1
  131. package/scripts/.collection-recreation-state.yaml +16 -0
  132. package/scripts/.gitkeep +5 -0
  133. package/scripts/README-collection-recreation.md +224 -0
  134. package/scripts/README.md +51 -0
  135. package/scripts/backup-collections.ts +543 -0
  136. package/scripts/delete-collection.ts +137 -0
  137. package/scripts/migrate-recreate-collections.ts +578 -0
  138. package/scripts/migrate-v1-to-v2.ts +1094 -0
  139. package/scripts/package-lock.json +1113 -0
  140. package/scripts/package.json +27 -0
  141. package/src/collections/composite-ids.ts +193 -0
  142. package/src/collections/core-infrastructure.spec.ts +353 -0
  143. package/src/collections/dot-notation.ts +212 -0
  144. package/src/collections/tracking-arrays.ts +298 -0
  145. package/src/constants/content-types.ts +20 -0
  146. package/src/schema/v2-collections-comments.spec.ts +141 -0
  147. package/src/schema/v2-collections.ts +433 -0
  148. package/src/server-factory.ts +89 -20
  149. package/src/server.ts +45 -17
  150. package/src/services/access-control.spec.ts +383 -0
  151. package/src/services/access-control.ts +291 -0
  152. package/src/services/credentials-provider.spec.ts +22 -0
  153. package/src/services/credentials-provider.ts +34 -0
  154. package/src/services/escalation.service.spec.ts +183 -0
  155. package/src/services/escalation.service.ts +150 -0
  156. package/src/services/ghost-config.service.spec.ts +339 -0
  157. package/src/services/ghost-config.service.ts +219 -0
  158. package/src/services/space-config.service.spec.ts +102 -0
  159. package/src/services/space-config.service.ts +79 -0
  160. package/src/services/trust-enforcement.spec.ts +309 -0
  161. package/src/services/trust-enforcement.ts +197 -0
  162. package/src/services/trust-validator.spec.ts +108 -0
  163. package/src/services/trust-validator.ts +105 -0
  164. package/src/tools/confirm-publish-moderation.spec.ts +240 -0
  165. package/src/tools/confirm.ts +869 -135
  166. package/src/tools/create-memory.spec.ts +126 -0
  167. package/src/tools/create-memory.ts +20 -27
  168. package/src/tools/create-relationship.ts +17 -8
  169. package/src/tools/delete-memory.ts +13 -6
  170. package/src/tools/delete-relationship.ts +15 -6
  171. package/src/tools/deny.ts +8 -1
  172. package/src/tools/find-similar.ts +21 -8
  173. package/src/tools/get-preferences.ts +10 -1
  174. package/src/tools/ghost-config.spec.ts +180 -0
  175. package/src/tools/ghost-config.ts +230 -0
  176. package/src/tools/moderate.spec.ts +277 -0
  177. package/src/tools/moderate.ts +219 -0
  178. package/src/tools/publish.ts +99 -41
  179. package/src/tools/query-memory.ts +28 -6
  180. package/src/tools/query-space.ts +39 -4
  181. package/src/tools/retract.ts +292 -0
  182. package/src/tools/revise.spec.ts +146 -0
  183. package/src/tools/revise.ts +283 -0
  184. package/src/tools/search-memory.ts +30 -7
  185. package/src/tools/search-relationship.ts +11 -2
  186. package/src/tools/search-space.spec.ts +341 -0
  187. package/src/tools/search-space.ts +323 -99
  188. package/src/tools/set-preference.ts +10 -1
  189. package/src/tools/update-memory.ts +16 -5
  190. package/src/tools/update-relationship.ts +10 -1
  191. package/src/types/access-result.spec.ts +193 -0
  192. package/src/types/access-result.ts +62 -0
  193. package/src/types/auth.ts +52 -0
  194. package/src/types/ghost-config.ts +46 -0
  195. package/src/types/memory.ts +9 -1
  196. package/src/types/preferences.ts +2 -2
  197. package/src/utils/auth-helpers.spec.ts +75 -0
  198. package/src/utils/auth-helpers.ts +25 -0
  199. package/src/utils/test-data-generator.spec.ts +317 -0
  200. package/src/utils/test-data-generator.ts +292 -0
  201. package/src/utils/weaviate-filters.ts +4 -4
  202. package/src/v2-performance.e2e.ts +173 -0
  203. package/src/v2-smoke.e2e.ts +401 -0
  204. package/src/weaviate/client.spec.ts +5 -5
  205. package/src/weaviate/client.ts +51 -36
  206. package/src/weaviate/schema.ts +11 -256
  207. package/src/weaviate/space-schema.spec.ts +24 -24
  208. package/src/weaviate/space-schema.ts +18 -6
@@ -0,0 +1,197 @@
1
+ # Task 76: Fix indexNullState Schema Configuration Bug
2
+
3
+ **Milestone**: M13 (Soft Delete System)
4
+ **Estimated Time**: 1 hour
5
+ **Dependencies**: Task 70 (Soft Delete Schema Fields)
6
+ **Status**: Completed
7
+ **Priority**: Critical
8
+
9
+ ---
10
+
11
+ ## Objective
12
+
13
+ Fix critical Weaviate schema configuration bug where `deleted_at` field filtering fails because `indexNullState: true` was not configured in the inverted index. This prevents filtering on null values, which is required for the soft delete system's default behavior (exclude deleted memories).
14
+
15
+ ---
16
+
17
+ ## Problem
18
+
19
+ **Error Message**:
20
+ ```
21
+ WeaviateQueryError: Query call with protocol gRPC failed with message:
22
+ /weaviate.v1.Weaviate/Search UNKNOWN: object search at index memory_mnoyiarhz5b8n06tstovm582nsg2:
23
+ local shard object search memory_mnoyiarhz5b8n06tstovm582nsg2_12vqVNds7o70:
24
+ resolve doc ids for prop/value pair: nested AND/OR query: nested child 0:
25
+ Nullstate must be indexed to be filterable!
26
+ Add `indexNullState: true` to the invertedIndexConfig
27
+ ```
28
+
29
+ **Root Cause**:
30
+ - Soft delete system (v3.0.0) added `deleted_at` field to schema
31
+ - Default filter uses `deleted_at IS NULL` to exclude deleted memories
32
+ - Weaviate requires `indexNullState: true` to filter on null values
33
+ - Schema was created without this configuration
34
+
35
+ **Impact**:
36
+ - 🚨 **CRITICAL**: All memory searches fail with gRPC error
37
+ - Affects all users attempting to search memories
38
+ - Soft delete system completely non-functional
39
+ - Production service down
40
+
41
+ ---
42
+
43
+ ## Solution
44
+
45
+ Add `invertedIndex` configuration with `indexNullState: true` to both schema files.
46
+
47
+ **Note**: Existing collections must be recreated - this configuration cannot be updated on existing collections.
48
+
49
+ ---
50
+
51
+ ## Steps
52
+
53
+ ### 1. Fix Memory Schema ([`src/weaviate/schema.ts`](../../src/weaviate/schema.ts))
54
+
55
+ Add inverted index configuration:
56
+
57
+ ```typescript
58
+ await client.collections.create({
59
+ name: collectionName,
60
+
61
+ // Vectorizer configuration
62
+ vectorizers: weaviate.configure.vectorizer.text2VecOpenAI({
63
+ model: 'text-embedding-3-small',
64
+ sourceProperties: ['content', 'title', 'summary', 'observation'],
65
+ }),
66
+
67
+ // Inverted index configuration
68
+ // indexNullState: true is required for filtering on null values (e.g., deleted_at IS NULL)
69
+ invertedIndex: weaviate.configure.invertedIndex({
70
+ indexNullState: true,
71
+ }),
72
+
73
+ properties: [
74
+ // ... existing properties
75
+ ]
76
+ });
77
+ ```
78
+
79
+ ### 2. Fix Space Schema ([`src/weaviate/space-schema.ts`](../../src/weaviate/space-schema.ts))
80
+
81
+ Add same configuration to public collection:
82
+
83
+ ```typescript
84
+ await client.collections.create({
85
+ name: collectionName,
86
+
87
+ // Vectorizer configuration
88
+ vectorizers: weaviate.configure.vectorizer.text2VecOpenAI({
89
+ model: 'text-embedding-3-small',
90
+ sourceProperties: ['content', 'title', 'summary', 'observation'],
91
+ }),
92
+
93
+ // Inverted index configuration
94
+ // indexNullState: true is required for filtering on null values (e.g., deleted_at IS NULL)
95
+ invertedIndex: weaviate.configure.invertedIndex({
96
+ indexNullState: true,
97
+ }),
98
+
99
+ properties: [
100
+ // ... existing properties
101
+ ]
102
+ });
103
+ ```
104
+
105
+ ### 3. Build and Test
106
+
107
+ ```bash
108
+ npm run build
109
+ npm test
110
+ ```
111
+
112
+ **Expected**: All tests passing, TypeScript compiles without errors
113
+
114
+ ---
115
+
116
+ ## Verification
117
+
118
+ - [x] Added `invertedIndex` configuration to [`src/weaviate/schema.ts`](../../src/weaviate/schema.ts)
119
+ - [x] Added `invertedIndex` configuration to [`src/weaviate/space-schema.ts`](../../src/weaviate/space-schema.ts)
120
+ - [x] Used correct API: `weaviate.configure.invertedIndex()` (not `invertedIndexConfig`)
121
+ - [x] TypeScript compiles without errors
122
+ - [x] Build successful
123
+ - [x] All 93 tests passing
124
+
125
+ ---
126
+
127
+ ## Migration Notes
128
+
129
+ **For Existing Collections**:
130
+
131
+ ⚠️ **CRITICAL**: Existing Weaviate collections must be recreated to apply this configuration change.
132
+
133
+ **Migration Steps**:
134
+ 1. Export existing data from old collections
135
+ 2. Delete old collections
136
+ 3. Restart server (creates new collections with correct config)
137
+ 4. Re-import data
138
+
139
+ **Alternative**: If no production data exists, simply delete collections and let them be recreated.
140
+
141
+ **Command to delete collection** (use with caution):
142
+ ```typescript
143
+ await client.collections.delete('Memory_{user_id}');
144
+ await client.collections.delete('Memory_public');
145
+ ```
146
+
147
+ ---
148
+
149
+ ## Technical Details
150
+
151
+ **Weaviate v3 API**:
152
+ - Configuration uses `weaviate.configure.invertedIndex()` helper
153
+ - Property is `invertedIndex` (not `invertedIndexConfig`)
154
+ - `indexNullState: true` enables filtering on null values
155
+ - Cannot be updated on existing collections (requires recreation)
156
+
157
+ **Why This is Required**:
158
+ - Soft delete uses `deleted_at IS NULL` filter to exclude deleted memories
159
+ - Without `indexNullState: true`, Weaviate cannot filter on null values
160
+ - Results in gRPC error: "Nullstate must be indexed to be filterable"
161
+
162
+ **Performance Impact**:
163
+ - Minimal - indexing null state adds small overhead
164
+ - Required for soft delete functionality
165
+ - Trade-off is acceptable for data safety
166
+
167
+ ---
168
+
169
+ ## Files Modified
170
+
171
+ - [`src/weaviate/schema.ts`](../../src/weaviate/schema.ts) - Added invertedIndex config (line 55-58)
172
+ - [`src/weaviate/space-schema.ts`](../../src/weaviate/space-schema.ts) - Added invertedIndex config (line 107-110)
173
+
174
+ ---
175
+
176
+ ## Related Issues
177
+
178
+ **User Feedback**: "worked but gave this new error on next memory search"
179
+
180
+ **Root Cause**: Task 70 added `deleted_at` field but didn't configure null state indexing
181
+
182
+ **Prevention**: Always add `indexNullState: true` when creating nullable fields that will be filtered
183
+
184
+ ---
185
+
186
+ ## Next Steps
187
+
188
+ 1. Document this in CHANGELOG as patch release (v3.0.1)
189
+ 2. Notify users they need to recreate collections
190
+ 3. Add migration guide to README
191
+ 4. Consider adding collection recreation utility
192
+
193
+ ---
194
+
195
+ **Status**: Completed (2026-02-25)
196
+ **Version**: v3.0.1 (patch release)
197
+ **Impact**: Critical bug fix - restores search functionality
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Composite ID Utilities
3
+ *
4
+ * Provides utilities for working with composite IDs in Memory Collection Pattern v2.
5
+ * Composite IDs preserve the source reference when memories are published to spaces or groups.
6
+ *
7
+ * Format: {userId}.{memoryId}
8
+ * Example: "user123.my-recipe"
9
+ */
10
+ /**
11
+ * Components of a composite ID
12
+ */
13
+ export interface CompositeIdComponents {
14
+ userId: string;
15
+ memoryId: string;
16
+ }
17
+ /**
18
+ * Error thrown when composite ID is invalid
19
+ */
20
+ export declare class InvalidCompositeIdError extends Error {
21
+ constructor(message: string);
22
+ }
23
+ /**
24
+ * Generate a composite ID from user ID and memory ID
25
+ *
26
+ * @param userId - User ID (must not contain dots)
27
+ * @param memoryId - Memory ID (must not contain dots)
28
+ * @returns Composite ID in format {userId}.{memoryId}
29
+ * @throws {InvalidCompositeIdError} If userId or memoryId contains dots
30
+ *
31
+ * @example
32
+ * generateCompositeId('user123', 'my-recipe')
33
+ * // Returns: 'user123.my-recipe'
34
+ */
35
+ export declare function generateCompositeId(userId: string, memoryId: string): string;
36
+ /**
37
+ * Parse a composite ID into its components
38
+ *
39
+ * @param compositeId - Composite ID to parse
40
+ * @returns Object with userId and memoryId
41
+ * @throws {InvalidCompositeIdError} If composite ID format is invalid
42
+ *
43
+ * @example
44
+ * parseCompositeId('user123.my-recipe')
45
+ * // Returns: { userId: 'user123', memoryId: 'my-recipe' }
46
+ */
47
+ export declare function parseCompositeId(compositeId: string): CompositeIdComponents;
48
+ /**
49
+ * Check if a string is a composite ID
50
+ *
51
+ * @param id - String to check
52
+ * @returns true if valid composite ID, false otherwise
53
+ *
54
+ * @example
55
+ * isCompositeId('user123.my-recipe') // true
56
+ * isCompositeId('simple-id') // false
57
+ * isCompositeId('too.many.dots') // false
58
+ */
59
+ export declare function isCompositeId(id: string): boolean;
60
+ /**
61
+ * Validate a composite ID (returns true on valid, throws on invalid)
62
+ *
63
+ * @param id - Composite ID to validate
64
+ * @returns true if valid
65
+ * @throws {InvalidCompositeIdError} If composite ID is invalid
66
+ *
67
+ * @example
68
+ * validateCompositeId('user123.my-recipe') // Returns true
69
+ * validateCompositeId('invalid') // Throws InvalidCompositeIdError
70
+ */
71
+ export declare function validateCompositeId(id: string): true;
72
+ /**
73
+ * Extract user ID from a composite ID
74
+ *
75
+ * @param compositeId - Composite ID
76
+ * @returns User ID component
77
+ *
78
+ * @example
79
+ * getUserIdFromComposite('user123.my-recipe')
80
+ * // Returns: 'user123'
81
+ */
82
+ export declare function getUserIdFromComposite(compositeId: string): string;
83
+ /**
84
+ * Extract memory ID from a composite ID
85
+ *
86
+ * @param compositeId - Composite ID
87
+ * @returns Memory ID component
88
+ *
89
+ * @example
90
+ * getMemoryIdFromComposite('user123.my-recipe')
91
+ * // Returns: 'my-recipe'
92
+ */
93
+ export declare function getMemoryIdFromComposite(compositeId: string): string;
94
+ /**
95
+ * Check if an ID belongs to a specific user
96
+ *
97
+ * @param compositeId - Composite ID to check
98
+ * @param userId - User ID to match
99
+ * @returns true if composite ID belongs to user, false otherwise
100
+ *
101
+ * @example
102
+ * belongsToUser('user123.my-recipe', 'user123') // true
103
+ * belongsToUser('user123.my-recipe', 'user456') // false
104
+ */
105
+ export declare function belongsToUser(compositeId: string, userId: string): boolean;
106
+ //# sourceMappingURL=composite-ids.d.ts.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Unit tests for Memory Collection Pattern v2 Core Infrastructure
3
+ *
4
+ * Tests core functionality of:
5
+ * - Dot notation collection utilities
6
+ * - Composite ID utilities
7
+ * - Tracking array management
8
+ * - Schema definitions
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=core-infrastructure.spec.d.ts.map
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Dot Notation Collection Utilities
3
+ *
4
+ * Provides utilities for working with Memory Collection Pattern v2's
5
+ * dot notation collection naming scheme.
6
+ *
7
+ * Collection Types:
8
+ * - USERS: Memory_users_{userId} - Private user memories
9
+ * - SPACES: Memory_spaces_public - All public space memories
10
+ * - GROUPS: Memory_groups_{groupId} - Group memories
11
+ */
12
+ /**
13
+ * Collection type enum for Memory Collection Pattern v2
14
+ */
15
+ export declare enum CollectionType {
16
+ USERS = "USERS",
17
+ SPACES = "SPACES",
18
+ GROUPS = "GROUPS"
19
+ }
20
+ /**
21
+ * Metadata about a parsed collection
22
+ */
23
+ export interface CollectionMetadata {
24
+ type: CollectionType;
25
+ id?: string;
26
+ name: string;
27
+ }
28
+ /**
29
+ * Error thrown when collection name is invalid
30
+ */
31
+ export declare class InvalidCollectionNameError extends Error {
32
+ constructor(message: string);
33
+ }
34
+ /**
35
+ * Get the Weaviate collection name for a given type and optional ID
36
+ *
37
+ * @param type - Collection type (USERS, SPACES, or GROUPS)
38
+ * @param id - Optional ID (required for USERS and GROUPS, not used for SPACES)
39
+ * @returns Weaviate collection name
40
+ *
41
+ * @example
42
+ * getCollectionName(CollectionType.USERS, 'user123')
43
+ * // Returns: 'Memory_users_user123'
44
+ *
45
+ * @example
46
+ * getCollectionName(CollectionType.SPACES)
47
+ * // Returns: 'Memory_spaces_public'
48
+ *
49
+ * @example
50
+ * getCollectionName(CollectionType.GROUPS, 'group456')
51
+ * // Returns: 'Memory_groups_group456'
52
+ */
53
+ export declare function getCollectionName(type: CollectionType, id?: string): string;
54
+ /**
55
+ * Parse a collection name into its components
56
+ *
57
+ * @param name - Weaviate collection name
58
+ * @returns Collection metadata with type, optional ID, and name
59
+ *
60
+ * @example
61
+ * parseCollectionName('Memory_users_user123')
62
+ * // Returns: { type: CollectionType.USERS, id: 'user123', name: 'Memory_users_user123' }
63
+ *
64
+ * @example
65
+ * parseCollectionName('Memory_spaces_public')
66
+ * // Returns: { type: CollectionType.SPACES, id: undefined, name: 'Memory_spaces_public' }
67
+ *
68
+ * @example
69
+ * parseCollectionName('Memory_groups_group456')
70
+ * // Returns: { type: CollectionType.GROUPS, id: 'group456', name: 'Memory_groups_group456' }
71
+ */
72
+ export declare function parseCollectionName(name: string): CollectionMetadata;
73
+ /**
74
+ * Validate a collection name
75
+ *
76
+ * @param name - Collection name to validate
77
+ * @returns true if valid, false otherwise
78
+ *
79
+ * @example
80
+ * validateCollectionName('Memory_users_user123') // true
81
+ * validateCollectionName('Memory_spaces_public') // true
82
+ * validateCollectionName('Invalid_name') // false
83
+ */
84
+ export declare function validateCollectionName(name: string): boolean;
85
+ /**
86
+ * Check if a collection name is a user collection
87
+ *
88
+ * @param name - Collection name to check
89
+ * @returns true if user collection, false otherwise
90
+ */
91
+ export declare function isUserCollection(name: string): boolean;
92
+ /**
93
+ * Check if a collection name is the spaces collection
94
+ *
95
+ * @param name - Collection name to check
96
+ * @returns true if spaces collection, false otherwise
97
+ */
98
+ export declare function isSpacesCollection(name: string): boolean;
99
+ /**
100
+ * Check if a collection name is a group collection
101
+ *
102
+ * @param name - Collection name to check
103
+ * @returns true if group collection, false otherwise
104
+ */
105
+ export declare function isGroupCollection(name: string): boolean;
106
+ //# sourceMappingURL=dot-notation.d.ts.map
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Tracking Array Management
3
+ *
4
+ * Provides utilities for managing space_ids and group_ids tracking arrays
5
+ * in Memory Collection Pattern v2. These arrays track where memories have
6
+ * been published.
7
+ */
8
+ /**
9
+ * Memory with tracking arrays
10
+ */
11
+ export interface MemoryWithTracking {
12
+ space_ids: string[];
13
+ group_ids: string[];
14
+ [key: string]: any;
15
+ }
16
+ /**
17
+ * Published locations summary
18
+ */
19
+ export interface PublishedLocations {
20
+ spaces: string[];
21
+ groups: string[];
22
+ }
23
+ /**
24
+ * Add a space ID to the space_ids array (immutable)
25
+ *
26
+ * @param memory - Memory object with tracking arrays
27
+ * @param spaceId - Space ID to add
28
+ * @returns New memory object with updated space_ids
29
+ *
30
+ * @example
31
+ * const memory = { space_ids: ['cooking'], group_ids: [] }
32
+ * addToSpaceIds(memory, 'recipes')
33
+ * // Returns: { space_ids: ['cooking', 'recipes'], group_ids: [] }
34
+ */
35
+ export declare function addToSpaceIds<T extends MemoryWithTracking>(memory: T, spaceId: string): T;
36
+ /**
37
+ * Remove a space ID from the space_ids array (immutable)
38
+ *
39
+ * @param memory - Memory object with tracking arrays
40
+ * @param spaceId - Space ID to remove
41
+ * @returns New memory object with updated space_ids
42
+ *
43
+ * @example
44
+ * const memory = { space_ids: ['cooking', 'recipes'], group_ids: [] }
45
+ * removeFromSpaceIds(memory, 'cooking')
46
+ * // Returns: { space_ids: ['recipes'], group_ids: [] }
47
+ */
48
+ export declare function removeFromSpaceIds<T extends MemoryWithTracking>(memory: T, spaceId: string): T;
49
+ /**
50
+ * Add a group ID to the group_ids array (immutable)
51
+ *
52
+ * @param memory - Memory object with tracking arrays
53
+ * @param groupId - Group ID to add
54
+ * @returns New memory object with updated group_ids
55
+ *
56
+ * @example
57
+ * const memory = { space_ids: [], group_ids: ['family'] }
58
+ * addToGroupIds(memory, 'friends')
59
+ * // Returns: { space_ids: [], group_ids: ['family', 'friends'] }
60
+ */
61
+ export declare function addToGroupIds<T extends MemoryWithTracking>(memory: T, groupId: string): T;
62
+ /**
63
+ * Remove a group ID from the group_ids array (immutable)
64
+ *
65
+ * @param memory - Memory object with tracking arrays
66
+ * @param groupId - Group ID to remove
67
+ * @returns New memory object with updated group_ids
68
+ *
69
+ * @example
70
+ * const memory = { space_ids: [], group_ids: ['family', 'friends'] }
71
+ * removeFromGroupIds(memory, 'family')
72
+ * // Returns: { space_ids: [], group_ids: ['friends'] }
73
+ */
74
+ export declare function removeFromGroupIds<T extends MemoryWithTracking>(memory: T, groupId: string): T;
75
+ /**
76
+ * Check if memory is published to a specific space
77
+ *
78
+ * @param memory - Memory object with tracking arrays
79
+ * @param spaceId - Space ID to check
80
+ * @returns true if published to space, false otherwise
81
+ *
82
+ * @example
83
+ * const memory = { space_ids: ['cooking'], group_ids: [] }
84
+ * isPublishedToSpace(memory, 'cooking') // true
85
+ * isPublishedToSpace(memory, 'recipes') // false
86
+ */
87
+ export declare function isPublishedToSpace(memory: MemoryWithTracking, spaceId: string): boolean;
88
+ /**
89
+ * Check if memory is published to a specific group
90
+ *
91
+ * @param memory - Memory object with tracking arrays
92
+ * @param groupId - Group ID to check
93
+ * @returns true if published to group, false otherwise
94
+ *
95
+ * @example
96
+ * const memory = { space_ids: [], group_ids: ['family'] }
97
+ * isPublishedToGroup(memory, 'family') // true
98
+ * isPublishedToGroup(memory, 'friends') // false
99
+ */
100
+ export declare function isPublishedToGroup(memory: MemoryWithTracking, groupId: string): boolean;
101
+ /**
102
+ * Get all published locations for a memory
103
+ *
104
+ * @param memory - Memory object with tracking arrays
105
+ * @returns Object with spaces and groups arrays
106
+ *
107
+ * @example
108
+ * const memory = { space_ids: ['cooking', 'recipes'], group_ids: ['family'] }
109
+ * getPublishedLocations(memory)
110
+ * // Returns: { spaces: ['cooking', 'recipes'], groups: ['family'] }
111
+ */
112
+ export declare function getPublishedLocations(memory: MemoryWithTracking): PublishedLocations;
113
+ /**
114
+ * Check if memory is published anywhere
115
+ *
116
+ * @param memory - Memory object with tracking arrays
117
+ * @returns true if published to any space or group, false otherwise
118
+ *
119
+ * @example
120
+ * const memory = { space_ids: ['cooking'], group_ids: [] }
121
+ * isPublished(memory) // true
122
+ *
123
+ * const unpublished = { space_ids: [], group_ids: [] }
124
+ * isPublished(unpublished) // false
125
+ */
126
+ export declare function isPublished(memory: MemoryWithTracking): boolean;
127
+ /**
128
+ * Get count of published locations
129
+ *
130
+ * @param memory - Memory object with tracking arrays
131
+ * @returns Total number of spaces and groups memory is published to
132
+ *
133
+ * @example
134
+ * const memory = { space_ids: ['cooking', 'recipes'], group_ids: ['family'] }
135
+ * getPublishedCount(memory) // 3
136
+ */
137
+ export declare function getPublishedCount(memory: MemoryWithTracking): number;
138
+ /**
139
+ * Initialize tracking arrays on a memory object (immutable)
140
+ *
141
+ * @param memory - Memory object (may not have tracking arrays)
142
+ * @returns New memory object with initialized tracking arrays
143
+ *
144
+ * @example
145
+ * const memory = { id: '123', content: 'test' }
146
+ * initializeTracking(memory)
147
+ * // Returns: { id: '123', content: 'test', space_ids: [], group_ids: [] }
148
+ */
149
+ export declare function initializeTracking<T extends Record<string, any>>(memory: T): T & MemoryWithTracking;
150
+ /**
151
+ * Add multiple space IDs at once (immutable)
152
+ *
153
+ * @param memory - Memory object with tracking arrays
154
+ * @param spaceIds - Array of space IDs to add
155
+ * @returns New memory object with updated space_ids
156
+ *
157
+ * @example
158
+ * const memory = { space_ids: ['cooking'], group_ids: [] }
159
+ * addMultipleSpaceIds(memory, ['recipes', 'baking'])
160
+ * // Returns: { space_ids: ['cooking', 'recipes', 'baking'], group_ids: [] }
161
+ */
162
+ export declare function addMultipleSpaceIds<T extends MemoryWithTracking>(memory: T, spaceIds: string[]): T;
163
+ /**
164
+ * Add multiple group IDs at once (immutable)
165
+ *
166
+ * @param memory - Memory object with tracking arrays
167
+ * @param groupIds - Array of group IDs to add
168
+ * @returns New memory object with updated group_ids
169
+ *
170
+ * @example
171
+ * const memory = { space_ids: [], group_ids: ['family'] }
172
+ * addMultipleGroupIds(memory, ['friends', 'coworkers'])
173
+ * // Returns: { space_ids: [], group_ids: ['family', 'friends', 'coworkers'] }
174
+ */
175
+ export declare function addMultipleGroupIds<T extends MemoryWithTracking>(memory: T, groupIds: string[]): T;
176
+ //# sourceMappingURL=tracking-arrays.d.ts.map
@@ -35,6 +35,7 @@ export declare const CONTENT_TYPE_CATEGORIES: {
35
35
  readonly organizational: readonly ["bookmark", "form", "location"];
36
36
  readonly business: readonly ["invoice", "contract"];
37
37
  readonly system: readonly ["system", "action", "audit", "history"];
38
+ readonly cross_user: readonly ["ghost", "comment"];
38
39
  };
39
40
  /**
40
41
  * Get content type metadata
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Tests for comment-related schema fields in v2 collections.
3
+ *
4
+ * Verifies that parent_id, thread_root_id, and moderation_flags
5
+ * are present in both user and published collection schemas.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=v2-collections-comments.spec.d.ts.map