@stackmemoryai/stackmemory 0.5.61 → 0.5.62
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/dist/scripts/initialize.js +68 -1
- package/dist/scripts/initialize.js.map +2 -2
- package/dist/src/core/retrieval/index.js +2 -0
- package/dist/src/core/retrieval/index.js.map +2 -2
- package/dist/src/core/retrieval/privacy-filter.js +129 -0
- package/dist/src/core/retrieval/privacy-filter.js.map +7 -0
- package/dist/src/core/retrieval/unified-context-assembler.js +273 -0
- package/dist/src/core/retrieval/unified-context-assembler.js.map +7 -0
- package/dist/src/hooks/diffmem-hooks.js +377 -0
- package/dist/src/hooks/diffmem-hooks.js.map +7 -0
- package/dist/src/integrations/diffmem/client.js +209 -0
- package/dist/src/integrations/diffmem/client.js.map +7 -0
- package/dist/src/integrations/diffmem/config.js +15 -0
- package/dist/src/integrations/diffmem/config.js.map +7 -0
- package/dist/src/integrations/diffmem/index.js +12 -0
- package/dist/src/integrations/diffmem/index.js.map +7 -0
- package/dist/src/integrations/diffmem/types.js +5 -0
- package/dist/src/integrations/diffmem/types.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/diffmem-handlers.js +456 -0
- package/dist/src/integrations/mcp/handlers/diffmem-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/server.js +121 -0
- package/dist/src/integrations/mcp/server.js.map +2 -2
- package/package.json +3 -1
- package/scripts/initialize.ts +83 -1
|
@@ -27,6 +27,7 @@ import { BrowserMCPIntegration } from "../../features/browser/browser-mcp.js";
|
|
|
27
27
|
import { TraceDetector } from "../../core/trace/trace-detector.js";
|
|
28
28
|
import { LLMContextRetrieval } from "../../core/retrieval/index.js";
|
|
29
29
|
import { DiscoveryHandlers } from "./handlers/discovery-handlers.js";
|
|
30
|
+
import { DiffMemHandlers } from "./handlers/diffmem-handlers.js";
|
|
30
31
|
import { v4 as uuidv4 } from "uuid";
|
|
31
32
|
function getEnv(key, defaultValue) {
|
|
32
33
|
const value = process.env[key];
|
|
@@ -53,6 +54,7 @@ class LocalStackMemoryMCP {
|
|
|
53
54
|
traceDetector;
|
|
54
55
|
contextRetrieval;
|
|
55
56
|
discoveryHandlers;
|
|
57
|
+
diffMemHandlers;
|
|
56
58
|
constructor() {
|
|
57
59
|
this.projectRoot = this.findProjectRoot();
|
|
58
60
|
this.projectId = this.getProjectId();
|
|
@@ -92,6 +94,7 @@ class LocalStackMemoryMCP {
|
|
|
92
94
|
db: this.db,
|
|
93
95
|
projectRoot: this.projectRoot
|
|
94
96
|
});
|
|
97
|
+
this.diffMemHandlers = new DiffMemHandlers();
|
|
95
98
|
this.setupHandlers();
|
|
96
99
|
this.loadInitialContext();
|
|
97
100
|
this.browserMCP.initialize(this.server).catch((error) => {
|
|
@@ -740,6 +743,111 @@ ${summary}...`, 0.8);
|
|
|
740
743
|
},
|
|
741
744
|
required: ["query"]
|
|
742
745
|
}
|
|
746
|
+
},
|
|
747
|
+
// DiffMem tools for user memory management
|
|
748
|
+
{
|
|
749
|
+
name: "diffmem_get_user_context",
|
|
750
|
+
description: "Fetch user knowledge and preferences from memory. Use to personalize responses based on learned user patterns.",
|
|
751
|
+
inputSchema: {
|
|
752
|
+
type: "object",
|
|
753
|
+
properties: {
|
|
754
|
+
categories: {
|
|
755
|
+
type: "array",
|
|
756
|
+
items: {
|
|
757
|
+
type: "string",
|
|
758
|
+
enum: [
|
|
759
|
+
"preference",
|
|
760
|
+
"expertise",
|
|
761
|
+
"project_knowledge",
|
|
762
|
+
"pattern",
|
|
763
|
+
"correction"
|
|
764
|
+
]
|
|
765
|
+
},
|
|
766
|
+
description: "Filter by memory categories"
|
|
767
|
+
},
|
|
768
|
+
limit: {
|
|
769
|
+
type: "number",
|
|
770
|
+
default: 10,
|
|
771
|
+
description: "Maximum memories to return"
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
name: "diffmem_store_learning",
|
|
778
|
+
description: "Store a new insight about the user (preference, expertise, pattern, or correction)",
|
|
779
|
+
inputSchema: {
|
|
780
|
+
type: "object",
|
|
781
|
+
properties: {
|
|
782
|
+
content: {
|
|
783
|
+
type: "string",
|
|
784
|
+
description: "The insight to store"
|
|
785
|
+
},
|
|
786
|
+
category: {
|
|
787
|
+
type: "string",
|
|
788
|
+
enum: [
|
|
789
|
+
"preference",
|
|
790
|
+
"expertise",
|
|
791
|
+
"project_knowledge",
|
|
792
|
+
"pattern",
|
|
793
|
+
"correction"
|
|
794
|
+
],
|
|
795
|
+
description: "Category of the insight"
|
|
796
|
+
},
|
|
797
|
+
confidence: {
|
|
798
|
+
type: "number",
|
|
799
|
+
minimum: 0,
|
|
800
|
+
maximum: 1,
|
|
801
|
+
default: 0.7,
|
|
802
|
+
description: "Confidence level (0-1)"
|
|
803
|
+
},
|
|
804
|
+
context: {
|
|
805
|
+
type: "object",
|
|
806
|
+
description: "Additional context for the insight"
|
|
807
|
+
}
|
|
808
|
+
},
|
|
809
|
+
required: ["content", "category"]
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
name: "diffmem_search",
|
|
814
|
+
description: "Semantic search across user memories. Find relevant past insights and preferences.",
|
|
815
|
+
inputSchema: {
|
|
816
|
+
type: "object",
|
|
817
|
+
properties: {
|
|
818
|
+
query: {
|
|
819
|
+
type: "string",
|
|
820
|
+
description: "Search query"
|
|
821
|
+
},
|
|
822
|
+
timeRange: {
|
|
823
|
+
type: "string",
|
|
824
|
+
enum: ["day", "week", "month", "all"],
|
|
825
|
+
default: "all",
|
|
826
|
+
description: "Time range filter"
|
|
827
|
+
},
|
|
828
|
+
minConfidence: {
|
|
829
|
+
type: "number",
|
|
830
|
+
minimum: 0,
|
|
831
|
+
maximum: 1,
|
|
832
|
+
default: 0.5,
|
|
833
|
+
description: "Minimum confidence threshold"
|
|
834
|
+
},
|
|
835
|
+
limit: {
|
|
836
|
+
type: "number",
|
|
837
|
+
default: 10,
|
|
838
|
+
description: "Maximum results"
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
required: ["query"]
|
|
842
|
+
}
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
name: "diffmem_status",
|
|
846
|
+
description: "Check DiffMem connection status and memory statistics",
|
|
847
|
+
inputSchema: {
|
|
848
|
+
type: "object",
|
|
849
|
+
properties: {}
|
|
850
|
+
}
|
|
743
851
|
}
|
|
744
852
|
]
|
|
745
853
|
};
|
|
@@ -851,6 +959,19 @@ ${summary}...`, 0.8);
|
|
|
851
959
|
case "sm_search":
|
|
852
960
|
result = await this.handleSmSearch(args);
|
|
853
961
|
break;
|
|
962
|
+
// DiffMem handlers
|
|
963
|
+
case "diffmem_get_user_context":
|
|
964
|
+
result = await this.diffMemHandlers.handleGetUserContext(args);
|
|
965
|
+
break;
|
|
966
|
+
case "diffmem_store_learning":
|
|
967
|
+
result = await this.diffMemHandlers.handleStoreLearning(args);
|
|
968
|
+
break;
|
|
969
|
+
case "diffmem_search":
|
|
970
|
+
result = await this.diffMemHandlers.handleSearch(args);
|
|
971
|
+
break;
|
|
972
|
+
case "diffmem_status":
|
|
973
|
+
result = await this.diffMemHandlers.handleStatus();
|
|
974
|
+
break;
|
|
854
975
|
default:
|
|
855
976
|
throw new Error(`Unknown tool: ${name}`);
|
|
856
977
|
}
|