@prmichaelsen/remember-mcp 2.6.11 → 2.6.13
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 +36 -0
- package/dist/server-factory.js +118 -25
- package/dist/server.js +118 -25
- package/package.json +1 -1
- package/src/tools/confirm.ts +11 -9
- package/src/tools/update-memory.ts +14 -0
- package/src/weaviate/space-schema.ts +102 -15
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,42 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.6.13] - 2026-02-17
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **Enhanced Logging for `remember_update_memory`**: Added detailed Weaviate update logging
|
|
13
|
+
- Logs update fields and values before calling Weaviate
|
|
14
|
+
- Logs confirmation after Weaviate update completes
|
|
15
|
+
- Helps diagnose if updates are being called but not persisting
|
|
16
|
+
- Shows exact values being sent to Weaviate
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## [2.6.12] - 2026-02-17
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- **CRITICAL: Memory_public Schema Mismatch**: Fixed property names to match user memory schema
|
|
25
|
+
- Changed `location_gps_latitude` → `location_gps_lat`
|
|
26
|
+
- Changed `location_gps_longitude` → `location_gps_lng`
|
|
27
|
+
- Changed `location_address_formatted` → `location_address`
|
|
28
|
+
- Changed `location_address_city` → `location_city`
|
|
29
|
+
- Changed `location_address_country` → `location_country`
|
|
30
|
+
- Added missing `location_source` field
|
|
31
|
+
- Changed `context_platform` → `context_summary` and `context_timestamp`
|
|
32
|
+
- Added missing `locale_language` and `locale_timezone` fields
|
|
33
|
+
- Changed `related_memory_ids` → `relationships`
|
|
34
|
+
- Added missing fields: `references`, `template_id`, `access_count`, `last_accessed_at`
|
|
35
|
+
- Added relationship fields: `memory_ids`, `relationship_type`, `observation`, `strength`
|
|
36
|
+
- Added computed fields: `base_weight`, `computed_weight`
|
|
37
|
+
- Added `user_id` field for backwards compatibility
|
|
38
|
+
- Schema now matches user memory schema exactly, allowing spread operator to work
|
|
39
|
+
- Fixes issue where Weaviate rejected all properties due to name mismatches
|
|
40
|
+
- Published memories now store all content correctly
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
8
44
|
## [2.6.11] - 2026-02-17
|
|
9
45
|
|
|
10
46
|
### Changed
|
package/dist/server-factory.js
CHANGED
|
@@ -2034,11 +2034,23 @@ async function handleUpdateMemory(args, userId) {
|
|
|
2034
2034
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2035
2035
|
updates.updated_at = now;
|
|
2036
2036
|
updates.version = existingMemory.properties.version + 1;
|
|
2037
|
+
logger.info("Calling Weaviate update", {
|
|
2038
|
+
userId,
|
|
2039
|
+
memoryId: args.memory_id,
|
|
2040
|
+
updateFields: Object.keys(updates),
|
|
2041
|
+
updateValues: updates,
|
|
2042
|
+
collectionName: `Memory_${userId}`
|
|
2043
|
+
});
|
|
2037
2044
|
try {
|
|
2038
2045
|
await collection.data.update({
|
|
2039
2046
|
id: args.memory_id,
|
|
2040
2047
|
properties: updates
|
|
2041
2048
|
});
|
|
2049
|
+
logger.info("Weaviate update completed (no error thrown)", {
|
|
2050
|
+
userId,
|
|
2051
|
+
memoryId: args.memory_id,
|
|
2052
|
+
updatedFields: Object.keys(updates)
|
|
2053
|
+
});
|
|
2042
2054
|
} catch (updateError) {
|
|
2043
2055
|
const updateErrorMsg = updateError instanceof Error ? updateError.message : String(updateError);
|
|
2044
2056
|
logger.error("Failed to perform Weaviate update:", {
|
|
@@ -3774,53 +3786,134 @@ async function createSpaceCollection(client2, spaceId) {
|
|
|
3774
3786
|
dataType: "number",
|
|
3775
3787
|
description: "System confidence in accuracy (0-1)"
|
|
3776
3788
|
},
|
|
3777
|
-
// Location fields (flattened)
|
|
3789
|
+
// Location fields (flattened) - MUST match user memory schema exactly
|
|
3778
3790
|
{
|
|
3779
|
-
name: "
|
|
3791
|
+
name: "location_gps_lat",
|
|
3780
3792
|
dataType: "number",
|
|
3781
3793
|
description: "GPS latitude"
|
|
3782
3794
|
},
|
|
3783
3795
|
{
|
|
3784
|
-
name: "
|
|
3796
|
+
name: "location_gps_lng",
|
|
3785
3797
|
dataType: "number",
|
|
3786
3798
|
description: "GPS longitude"
|
|
3787
3799
|
},
|
|
3788
3800
|
{
|
|
3789
|
-
name: "
|
|
3801
|
+
name: "location_address",
|
|
3790
3802
|
dataType: "text",
|
|
3791
3803
|
description: "Formatted address"
|
|
3792
3804
|
},
|
|
3793
3805
|
{
|
|
3794
|
-
name: "
|
|
3806
|
+
name: "location_city",
|
|
3807
|
+
dataType: "text",
|
|
3808
|
+
description: "City name"
|
|
3809
|
+
},
|
|
3810
|
+
{
|
|
3811
|
+
name: "location_country",
|
|
3795
3812
|
dataType: "text",
|
|
3796
|
-
description: "
|
|
3813
|
+
description: "Country name"
|
|
3797
3814
|
},
|
|
3798
3815
|
{
|
|
3799
|
-
name: "
|
|
3816
|
+
name: "location_source",
|
|
3800
3817
|
dataType: "text",
|
|
3801
|
-
description: "
|
|
3818
|
+
description: "Location source (gps, ip, manual, etc.)"
|
|
3802
3819
|
},
|
|
3803
|
-
// Context fields (flattened)
|
|
3820
|
+
// Context fields (flattened) - MUST match user memory schema exactly
|
|
3804
3821
|
{
|
|
3805
3822
|
name: "context_conversation_id",
|
|
3806
3823
|
dataType: "text",
|
|
3807
3824
|
description: "Conversation ID"
|
|
3808
3825
|
},
|
|
3809
3826
|
{
|
|
3810
|
-
name: "
|
|
3827
|
+
name: "context_summary",
|
|
3811
3828
|
dataType: "text",
|
|
3812
|
-
description: "
|
|
3829
|
+
description: "Brief context summary"
|
|
3830
|
+
},
|
|
3831
|
+
{
|
|
3832
|
+
name: "context_timestamp",
|
|
3833
|
+
dataType: "date",
|
|
3834
|
+
description: "Context timestamp"
|
|
3835
|
+
},
|
|
3836
|
+
// Locale fields - MUST match user memory schema exactly
|
|
3837
|
+
{
|
|
3838
|
+
name: "locale_language",
|
|
3839
|
+
dataType: "text",
|
|
3840
|
+
description: "Language code (e.g., en, es, fr)"
|
|
3841
|
+
},
|
|
3842
|
+
{
|
|
3843
|
+
name: "locale_timezone",
|
|
3844
|
+
dataType: "text",
|
|
3845
|
+
description: "Timezone (e.g., America/Los_Angeles)"
|
|
3846
|
+
},
|
|
3847
|
+
// Relationships - MUST match user memory schema exactly
|
|
3848
|
+
{
|
|
3849
|
+
name: "relationships",
|
|
3850
|
+
dataType: "text[]",
|
|
3851
|
+
description: "Array of relationship IDs"
|
|
3852
|
+
},
|
|
3853
|
+
// Access tracking - MUST match user memory schema exactly
|
|
3854
|
+
{
|
|
3855
|
+
name: "access_count",
|
|
3856
|
+
dataType: "number",
|
|
3857
|
+
description: "Total times accessed"
|
|
3858
|
+
},
|
|
3859
|
+
{
|
|
3860
|
+
name: "last_accessed_at",
|
|
3861
|
+
dataType: "date",
|
|
3862
|
+
description: "Most recent access timestamp"
|
|
3813
3863
|
},
|
|
3814
|
-
//
|
|
3864
|
+
// Metadata - MUST match user memory schema exactly
|
|
3815
3865
|
{
|
|
3816
3866
|
name: "tags",
|
|
3817
3867
|
dataType: "text[]",
|
|
3818
|
-
description: "Tags for
|
|
3868
|
+
description: "Tags for organization"
|
|
3869
|
+
},
|
|
3870
|
+
{
|
|
3871
|
+
name: "references",
|
|
3872
|
+
dataType: "text[]",
|
|
3873
|
+
description: "Source URLs"
|
|
3874
|
+
},
|
|
3875
|
+
{
|
|
3876
|
+
name: "template_id",
|
|
3877
|
+
dataType: "text",
|
|
3878
|
+
description: "Template ID if using template"
|
|
3819
3879
|
},
|
|
3880
|
+
// Relationship-specific fields (for relationships in public space)
|
|
3820
3881
|
{
|
|
3821
|
-
name: "
|
|
3882
|
+
name: "memory_ids",
|
|
3822
3883
|
dataType: "text[]",
|
|
3823
|
-
description: "IDs
|
|
3884
|
+
description: "Connected memory IDs (for relationships)"
|
|
3885
|
+
},
|
|
3886
|
+
{
|
|
3887
|
+
name: "relationship_type",
|
|
3888
|
+
dataType: "text",
|
|
3889
|
+
description: "Relationship type (for relationships)"
|
|
3890
|
+
},
|
|
3891
|
+
{
|
|
3892
|
+
name: "observation",
|
|
3893
|
+
dataType: "text",
|
|
3894
|
+
description: "Relationship observation (vectorized)"
|
|
3895
|
+
},
|
|
3896
|
+
{
|
|
3897
|
+
name: "strength",
|
|
3898
|
+
dataType: "number",
|
|
3899
|
+
description: "Relationship strength (0-1)"
|
|
3900
|
+
},
|
|
3901
|
+
// Computed fields - MUST match user memory schema exactly
|
|
3902
|
+
{
|
|
3903
|
+
name: "base_weight",
|
|
3904
|
+
dataType: "number",
|
|
3905
|
+
description: "User-specified weight"
|
|
3906
|
+
},
|
|
3907
|
+
{
|
|
3908
|
+
name: "computed_weight",
|
|
3909
|
+
dataType: "number",
|
|
3910
|
+
description: "Calculated effective weight"
|
|
3911
|
+
},
|
|
3912
|
+
// User ID field (for backwards compatibility with spread operator)
|
|
3913
|
+
{
|
|
3914
|
+
name: "user_id",
|
|
3915
|
+
dataType: "text",
|
|
3916
|
+
description: "User ID (copied from original memory, same as author_id)"
|
|
3824
3917
|
},
|
|
3825
3918
|
// Timestamps
|
|
3826
3919
|
{
|
|
@@ -4215,23 +4308,23 @@ async function executePublishMemory(request, userId) {
|
|
|
4215
4308
|
});
|
|
4216
4309
|
const originalTags = Array.isArray(originalMemory.properties.tags) ? originalMemory.properties.tags : [];
|
|
4217
4310
|
const additionalTags = Array.isArray(request.payload.additional_tags) ? request.payload.additional_tags : [];
|
|
4311
|
+
if (!request.payload.spaces || !Array.isArray(request.payload.spaces) || request.payload.spaces.length === 0) {
|
|
4312
|
+
throw new Error("Payload missing required field: spaces");
|
|
4313
|
+
}
|
|
4218
4314
|
const publishedMemory = {
|
|
4219
4315
|
...originalMemory.properties,
|
|
4220
|
-
// Add space-specific fields
|
|
4221
|
-
spaces: request.payload.spaces
|
|
4222
|
-
//
|
|
4316
|
+
// Add space-specific fields (don't overwrite existing properties)
|
|
4317
|
+
spaces: request.payload.spaces,
|
|
4318
|
+
// Required field (validated above)
|
|
4223
4319
|
author_id: userId,
|
|
4224
4320
|
// Track original author
|
|
4225
4321
|
published_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4226
4322
|
discovery_count: 0,
|
|
4227
|
-
doc_type: "space_memory",
|
|
4228
4323
|
attribution: "user",
|
|
4229
|
-
// Merge additional tags
|
|
4230
|
-
tags: [...originalTags, ...additionalTags]
|
|
4231
|
-
//
|
|
4232
|
-
|
|
4233
|
-
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4234
|
-
version: 1
|
|
4324
|
+
// Merge additional tags with original tags
|
|
4325
|
+
tags: [...originalTags, ...additionalTags]
|
|
4326
|
+
// Keep doc_type as 'memory' (don't change to 'space_memory')
|
|
4327
|
+
// Keep original created_at, updated_at, version (don't overwrite)
|
|
4235
4328
|
};
|
|
4236
4329
|
logger.info("Inserting memory into Memory_public", {
|
|
4237
4330
|
function: "executePublishMemory",
|
package/dist/server.js
CHANGED
|
@@ -2102,11 +2102,23 @@ async function handleUpdateMemory(args, userId) {
|
|
|
2102
2102
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2103
2103
|
updates.updated_at = now;
|
|
2104
2104
|
updates.version = existingMemory.properties.version + 1;
|
|
2105
|
+
logger.info("Calling Weaviate update", {
|
|
2106
|
+
userId,
|
|
2107
|
+
memoryId: args.memory_id,
|
|
2108
|
+
updateFields: Object.keys(updates),
|
|
2109
|
+
updateValues: updates,
|
|
2110
|
+
collectionName: `Memory_${userId}`
|
|
2111
|
+
});
|
|
2105
2112
|
try {
|
|
2106
2113
|
await collection.data.update({
|
|
2107
2114
|
id: args.memory_id,
|
|
2108
2115
|
properties: updates
|
|
2109
2116
|
});
|
|
2117
|
+
logger.info("Weaviate update completed (no error thrown)", {
|
|
2118
|
+
userId,
|
|
2119
|
+
memoryId: args.memory_id,
|
|
2120
|
+
updatedFields: Object.keys(updates)
|
|
2121
|
+
});
|
|
2110
2122
|
} catch (updateError) {
|
|
2111
2123
|
const updateErrorMsg = updateError instanceof Error ? updateError.message : String(updateError);
|
|
2112
2124
|
logger.error("Failed to perform Weaviate update:", {
|
|
@@ -3842,53 +3854,134 @@ async function createSpaceCollection(client2, spaceId) {
|
|
|
3842
3854
|
dataType: "number",
|
|
3843
3855
|
description: "System confidence in accuracy (0-1)"
|
|
3844
3856
|
},
|
|
3845
|
-
// Location fields (flattened)
|
|
3857
|
+
// Location fields (flattened) - MUST match user memory schema exactly
|
|
3846
3858
|
{
|
|
3847
|
-
name: "
|
|
3859
|
+
name: "location_gps_lat",
|
|
3848
3860
|
dataType: "number",
|
|
3849
3861
|
description: "GPS latitude"
|
|
3850
3862
|
},
|
|
3851
3863
|
{
|
|
3852
|
-
name: "
|
|
3864
|
+
name: "location_gps_lng",
|
|
3853
3865
|
dataType: "number",
|
|
3854
3866
|
description: "GPS longitude"
|
|
3855
3867
|
},
|
|
3856
3868
|
{
|
|
3857
|
-
name: "
|
|
3869
|
+
name: "location_address",
|
|
3858
3870
|
dataType: "text",
|
|
3859
3871
|
description: "Formatted address"
|
|
3860
3872
|
},
|
|
3861
3873
|
{
|
|
3862
|
-
name: "
|
|
3874
|
+
name: "location_city",
|
|
3875
|
+
dataType: "text",
|
|
3876
|
+
description: "City name"
|
|
3877
|
+
},
|
|
3878
|
+
{
|
|
3879
|
+
name: "location_country",
|
|
3863
3880
|
dataType: "text",
|
|
3864
|
-
description: "
|
|
3881
|
+
description: "Country name"
|
|
3865
3882
|
},
|
|
3866
3883
|
{
|
|
3867
|
-
name: "
|
|
3884
|
+
name: "location_source",
|
|
3868
3885
|
dataType: "text",
|
|
3869
|
-
description: "
|
|
3886
|
+
description: "Location source (gps, ip, manual, etc.)"
|
|
3870
3887
|
},
|
|
3871
|
-
// Context fields (flattened)
|
|
3888
|
+
// Context fields (flattened) - MUST match user memory schema exactly
|
|
3872
3889
|
{
|
|
3873
3890
|
name: "context_conversation_id",
|
|
3874
3891
|
dataType: "text",
|
|
3875
3892
|
description: "Conversation ID"
|
|
3876
3893
|
},
|
|
3877
3894
|
{
|
|
3878
|
-
name: "
|
|
3895
|
+
name: "context_summary",
|
|
3879
3896
|
dataType: "text",
|
|
3880
|
-
description: "
|
|
3897
|
+
description: "Brief context summary"
|
|
3898
|
+
},
|
|
3899
|
+
{
|
|
3900
|
+
name: "context_timestamp",
|
|
3901
|
+
dataType: "date",
|
|
3902
|
+
description: "Context timestamp"
|
|
3903
|
+
},
|
|
3904
|
+
// Locale fields - MUST match user memory schema exactly
|
|
3905
|
+
{
|
|
3906
|
+
name: "locale_language",
|
|
3907
|
+
dataType: "text",
|
|
3908
|
+
description: "Language code (e.g., en, es, fr)"
|
|
3909
|
+
},
|
|
3910
|
+
{
|
|
3911
|
+
name: "locale_timezone",
|
|
3912
|
+
dataType: "text",
|
|
3913
|
+
description: "Timezone (e.g., America/Los_Angeles)"
|
|
3914
|
+
},
|
|
3915
|
+
// Relationships - MUST match user memory schema exactly
|
|
3916
|
+
{
|
|
3917
|
+
name: "relationships",
|
|
3918
|
+
dataType: "text[]",
|
|
3919
|
+
description: "Array of relationship IDs"
|
|
3920
|
+
},
|
|
3921
|
+
// Access tracking - MUST match user memory schema exactly
|
|
3922
|
+
{
|
|
3923
|
+
name: "access_count",
|
|
3924
|
+
dataType: "number",
|
|
3925
|
+
description: "Total times accessed"
|
|
3926
|
+
},
|
|
3927
|
+
{
|
|
3928
|
+
name: "last_accessed_at",
|
|
3929
|
+
dataType: "date",
|
|
3930
|
+
description: "Most recent access timestamp"
|
|
3881
3931
|
},
|
|
3882
|
-
//
|
|
3932
|
+
// Metadata - MUST match user memory schema exactly
|
|
3883
3933
|
{
|
|
3884
3934
|
name: "tags",
|
|
3885
3935
|
dataType: "text[]",
|
|
3886
|
-
description: "Tags for
|
|
3936
|
+
description: "Tags for organization"
|
|
3937
|
+
},
|
|
3938
|
+
{
|
|
3939
|
+
name: "references",
|
|
3940
|
+
dataType: "text[]",
|
|
3941
|
+
description: "Source URLs"
|
|
3942
|
+
},
|
|
3943
|
+
{
|
|
3944
|
+
name: "template_id",
|
|
3945
|
+
dataType: "text",
|
|
3946
|
+
description: "Template ID if using template"
|
|
3887
3947
|
},
|
|
3948
|
+
// Relationship-specific fields (for relationships in public space)
|
|
3888
3949
|
{
|
|
3889
|
-
name: "
|
|
3950
|
+
name: "memory_ids",
|
|
3890
3951
|
dataType: "text[]",
|
|
3891
|
-
description: "IDs
|
|
3952
|
+
description: "Connected memory IDs (for relationships)"
|
|
3953
|
+
},
|
|
3954
|
+
{
|
|
3955
|
+
name: "relationship_type",
|
|
3956
|
+
dataType: "text",
|
|
3957
|
+
description: "Relationship type (for relationships)"
|
|
3958
|
+
},
|
|
3959
|
+
{
|
|
3960
|
+
name: "observation",
|
|
3961
|
+
dataType: "text",
|
|
3962
|
+
description: "Relationship observation (vectorized)"
|
|
3963
|
+
},
|
|
3964
|
+
{
|
|
3965
|
+
name: "strength",
|
|
3966
|
+
dataType: "number",
|
|
3967
|
+
description: "Relationship strength (0-1)"
|
|
3968
|
+
},
|
|
3969
|
+
// Computed fields - MUST match user memory schema exactly
|
|
3970
|
+
{
|
|
3971
|
+
name: "base_weight",
|
|
3972
|
+
dataType: "number",
|
|
3973
|
+
description: "User-specified weight"
|
|
3974
|
+
},
|
|
3975
|
+
{
|
|
3976
|
+
name: "computed_weight",
|
|
3977
|
+
dataType: "number",
|
|
3978
|
+
description: "Calculated effective weight"
|
|
3979
|
+
},
|
|
3980
|
+
// User ID field (for backwards compatibility with spread operator)
|
|
3981
|
+
{
|
|
3982
|
+
name: "user_id",
|
|
3983
|
+
dataType: "text",
|
|
3984
|
+
description: "User ID (copied from original memory, same as author_id)"
|
|
3892
3985
|
},
|
|
3893
3986
|
// Timestamps
|
|
3894
3987
|
{
|
|
@@ -4283,23 +4376,23 @@ async function executePublishMemory(request, userId) {
|
|
|
4283
4376
|
});
|
|
4284
4377
|
const originalTags = Array.isArray(originalMemory.properties.tags) ? originalMemory.properties.tags : [];
|
|
4285
4378
|
const additionalTags = Array.isArray(request.payload.additional_tags) ? request.payload.additional_tags : [];
|
|
4379
|
+
if (!request.payload.spaces || !Array.isArray(request.payload.spaces) || request.payload.spaces.length === 0) {
|
|
4380
|
+
throw new Error("Payload missing required field: spaces");
|
|
4381
|
+
}
|
|
4286
4382
|
const publishedMemory = {
|
|
4287
4383
|
...originalMemory.properties,
|
|
4288
|
-
// Add space-specific fields
|
|
4289
|
-
spaces: request.payload.spaces
|
|
4290
|
-
//
|
|
4384
|
+
// Add space-specific fields (don't overwrite existing properties)
|
|
4385
|
+
spaces: request.payload.spaces,
|
|
4386
|
+
// Required field (validated above)
|
|
4291
4387
|
author_id: userId,
|
|
4292
4388
|
// Track original author
|
|
4293
4389
|
published_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4294
4390
|
discovery_count: 0,
|
|
4295
|
-
doc_type: "space_memory",
|
|
4296
4391
|
attribution: "user",
|
|
4297
|
-
// Merge additional tags
|
|
4298
|
-
tags: [...originalTags, ...additionalTags]
|
|
4299
|
-
//
|
|
4300
|
-
|
|
4301
|
-
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4302
|
-
version: 1
|
|
4392
|
+
// Merge additional tags with original tags
|
|
4393
|
+
tags: [...originalTags, ...additionalTags]
|
|
4394
|
+
// Keep doc_type as 'memory' (don't change to 'space_memory')
|
|
4395
|
+
// Keep original created_at, updated_at, version (don't overwrite)
|
|
4303
4396
|
};
|
|
4304
4397
|
logger.info("Inserting memory into Memory_public", {
|
|
4305
4398
|
function: "executePublishMemory",
|
package/package.json
CHANGED
package/src/tools/confirm.ts
CHANGED
|
@@ -227,22 +227,24 @@ async function executePublishMemory(
|
|
|
227
227
|
? request.payload.additional_tags
|
|
228
228
|
: [];
|
|
229
229
|
|
|
230
|
-
//
|
|
230
|
+
// Validate payload has required fields
|
|
231
|
+
if (!request.payload.spaces || !Array.isArray(request.payload.spaces) || request.payload.spaces.length === 0) {
|
|
232
|
+
throw new Error('Payload missing required field: spaces');
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Create published memory - preserve ALL original properties
|
|
231
236
|
const publishedMemory = {
|
|
232
237
|
...originalMemory.properties,
|
|
233
|
-
// Add space-specific fields
|
|
234
|
-
spaces: request.payload.spaces
|
|
238
|
+
// Add space-specific fields (don't overwrite existing properties)
|
|
239
|
+
spaces: request.payload.spaces, // Required field (validated above)
|
|
235
240
|
author_id: userId, // Track original author
|
|
236
241
|
published_at: new Date().toISOString(),
|
|
237
242
|
discovery_count: 0,
|
|
238
|
-
doc_type: 'space_memory',
|
|
239
243
|
attribution: 'user' as const,
|
|
240
|
-
// Merge additional tags
|
|
244
|
+
// Merge additional tags with original tags
|
|
241
245
|
tags: [...originalTags, ...additionalTags],
|
|
242
|
-
//
|
|
243
|
-
created_at
|
|
244
|
-
updated_at: new Date().toISOString(),
|
|
245
|
-
version: 1,
|
|
246
|
+
// Keep doc_type as 'memory' (don't change to 'space_memory')
|
|
247
|
+
// Keep original created_at, updated_at, version (don't overwrite)
|
|
246
248
|
};
|
|
247
249
|
|
|
248
250
|
logger.info('Inserting memory into Memory_public', {
|
|
@@ -250,11 +250,25 @@ export async function handleUpdateMemory(
|
|
|
250
250
|
updates.version = (existingMemory.properties.version as number) + 1;
|
|
251
251
|
|
|
252
252
|
// Perform update in Weaviate
|
|
253
|
+
logger.info('Calling Weaviate update', {
|
|
254
|
+
userId,
|
|
255
|
+
memoryId: args.memory_id,
|
|
256
|
+
updateFields: Object.keys(updates),
|
|
257
|
+
updateValues: updates,
|
|
258
|
+
collectionName: `Memory_${userId}`,
|
|
259
|
+
});
|
|
260
|
+
|
|
253
261
|
try {
|
|
254
262
|
await collection.data.update({
|
|
255
263
|
id: args.memory_id,
|
|
256
264
|
properties: updates,
|
|
257
265
|
});
|
|
266
|
+
|
|
267
|
+
logger.info('Weaviate update completed (no error thrown)', {
|
|
268
|
+
userId,
|
|
269
|
+
memoryId: args.memory_id,
|
|
270
|
+
updatedFields: Object.keys(updates),
|
|
271
|
+
});
|
|
258
272
|
} catch (updateError) {
|
|
259
273
|
const updateErrorMsg = updateError instanceof Error ? updateError.message : String(updateError);
|
|
260
274
|
logger.error('Failed to perform Weaviate update:', {
|
|
@@ -187,55 +187,142 @@ async function createSpaceCollection(
|
|
|
187
187
|
description: 'System confidence in accuracy (0-1)',
|
|
188
188
|
},
|
|
189
189
|
|
|
190
|
-
// Location fields (flattened)
|
|
190
|
+
// Location fields (flattened) - MUST match user memory schema exactly
|
|
191
191
|
{
|
|
192
|
-
name: '
|
|
192
|
+
name: 'location_gps_lat',
|
|
193
193
|
dataType: 'number' as any,
|
|
194
194
|
description: 'GPS latitude',
|
|
195
195
|
},
|
|
196
196
|
{
|
|
197
|
-
name: '
|
|
197
|
+
name: 'location_gps_lng',
|
|
198
198
|
dataType: 'number' as any,
|
|
199
199
|
description: 'GPS longitude',
|
|
200
200
|
},
|
|
201
201
|
{
|
|
202
|
-
name: '
|
|
202
|
+
name: 'location_address',
|
|
203
203
|
dataType: 'text' as any,
|
|
204
204
|
description: 'Formatted address',
|
|
205
205
|
},
|
|
206
206
|
{
|
|
207
|
-
name: '
|
|
207
|
+
name: 'location_city',
|
|
208
208
|
dataType: 'text' as any,
|
|
209
|
-
description: 'City',
|
|
209
|
+
description: 'City name',
|
|
210
210
|
},
|
|
211
211
|
{
|
|
212
|
-
name: '
|
|
212
|
+
name: 'location_country',
|
|
213
213
|
dataType: 'text' as any,
|
|
214
|
-
description: 'Country',
|
|
214
|
+
description: 'Country name',
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: 'location_source',
|
|
218
|
+
dataType: 'text' as any,
|
|
219
|
+
description: 'Location source (gps, ip, manual, etc.)',
|
|
215
220
|
},
|
|
216
221
|
|
|
217
|
-
// Context fields (flattened)
|
|
222
|
+
// Context fields (flattened) - MUST match user memory schema exactly
|
|
218
223
|
{
|
|
219
224
|
name: 'context_conversation_id',
|
|
220
225
|
dataType: 'text' as any,
|
|
221
226
|
description: 'Conversation ID',
|
|
222
227
|
},
|
|
223
228
|
{
|
|
224
|
-
name: '
|
|
229
|
+
name: 'context_summary',
|
|
225
230
|
dataType: 'text' as any,
|
|
226
|
-
description: '
|
|
231
|
+
description: 'Brief context summary',
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: 'context_timestamp',
|
|
235
|
+
dataType: 'date' as any,
|
|
236
|
+
description: 'Context timestamp',
|
|
227
237
|
},
|
|
228
238
|
|
|
229
|
-
//
|
|
239
|
+
// Locale fields - MUST match user memory schema exactly
|
|
240
|
+
{
|
|
241
|
+
name: 'locale_language',
|
|
242
|
+
dataType: 'text' as any,
|
|
243
|
+
description: 'Language code (e.g., en, es, fr)',
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: 'locale_timezone',
|
|
247
|
+
dataType: 'text' as any,
|
|
248
|
+
description: 'Timezone (e.g., America/Los_Angeles)',
|
|
249
|
+
},
|
|
250
|
+
|
|
251
|
+
// Relationships - MUST match user memory schema exactly
|
|
252
|
+
{
|
|
253
|
+
name: 'relationships',
|
|
254
|
+
dataType: 'text[]' as any,
|
|
255
|
+
description: 'Array of relationship IDs',
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
// Access tracking - MUST match user memory schema exactly
|
|
259
|
+
{
|
|
260
|
+
name: 'access_count',
|
|
261
|
+
dataType: 'number' as any,
|
|
262
|
+
description: 'Total times accessed',
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
name: 'last_accessed_at',
|
|
266
|
+
dataType: 'date' as any,
|
|
267
|
+
description: 'Most recent access timestamp',
|
|
268
|
+
},
|
|
269
|
+
|
|
270
|
+
// Metadata - MUST match user memory schema exactly
|
|
230
271
|
{
|
|
231
272
|
name: 'tags',
|
|
232
273
|
dataType: 'text[]' as any,
|
|
233
|
-
description: 'Tags for
|
|
274
|
+
description: 'Tags for organization',
|
|
234
275
|
},
|
|
235
276
|
{
|
|
236
|
-
name: '
|
|
277
|
+
name: 'references',
|
|
237
278
|
dataType: 'text[]' as any,
|
|
238
|
-
description: '
|
|
279
|
+
description: 'Source URLs',
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: 'template_id',
|
|
283
|
+
dataType: 'text' as any,
|
|
284
|
+
description: 'Template ID if using template',
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
// Relationship-specific fields (for relationships in public space)
|
|
288
|
+
{
|
|
289
|
+
name: 'memory_ids',
|
|
290
|
+
dataType: 'text[]' as any,
|
|
291
|
+
description: 'Connected memory IDs (for relationships)',
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: 'relationship_type',
|
|
295
|
+
dataType: 'text' as any,
|
|
296
|
+
description: 'Relationship type (for relationships)',
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: 'observation',
|
|
300
|
+
dataType: 'text' as any,
|
|
301
|
+
description: 'Relationship observation (vectorized)',
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
name: 'strength',
|
|
305
|
+
dataType: 'number' as any,
|
|
306
|
+
description: 'Relationship strength (0-1)',
|
|
307
|
+
},
|
|
308
|
+
|
|
309
|
+
// Computed fields - MUST match user memory schema exactly
|
|
310
|
+
{
|
|
311
|
+
name: 'base_weight',
|
|
312
|
+
dataType: 'number' as any,
|
|
313
|
+
description: 'User-specified weight',
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
name: 'computed_weight',
|
|
317
|
+
dataType: 'number' as any,
|
|
318
|
+
description: 'Calculated effective weight',
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
// User ID field (for backwards compatibility with spread operator)
|
|
322
|
+
{
|
|
323
|
+
name: 'user_id',
|
|
324
|
+
dataType: 'text' as any,
|
|
325
|
+
description: 'User ID (copied from original memory, same as author_id)',
|
|
239
326
|
},
|
|
240
327
|
|
|
241
328
|
// Timestamps
|