vesper-memory 0.3.2 â 0.5.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.
- package/.env.example +8 -4
- package/CHANGELOG.md +129 -3
- package/LICENSE +59 -0
- package/README.md +422 -24
- package/config/migrations/001_add_skill_summary.sql +75 -0
- package/config/migrations/001_rollback_skill_summary.sql +60 -0
- package/config/sqlite-schema.sql +68 -4
- package/dist/benchmark/types.d.ts +4 -4
- package/dist/cli.js +204 -10
- package/dist/cli.js.map +1 -1
- package/dist/consolidation/pipeline.d.ts +6 -1
- package/dist/consolidation/pipeline.d.ts.map +1 -1
- package/dist/consolidation/pipeline.js +53 -35
- package/dist/consolidation/pipeline.js.map +1 -1
- package/dist/memory-layers/semantic-memory.d.ts +9 -19
- package/dist/memory-layers/semantic-memory.d.ts.map +1 -1
- package/dist/memory-layers/semantic-memory.js +31 -54
- package/dist/memory-layers/semantic-memory.js.map +1 -1
- package/dist/memory-layers/skill-lazy-loading.d.ts +160 -0
- package/dist/memory-layers/skill-lazy-loading.d.ts.map +1 -0
- package/dist/memory-layers/skill-lazy-loading.js +247 -0
- package/dist/memory-layers/skill-lazy-loading.js.map +1 -0
- package/dist/memory-layers/skill-library.d.ts +133 -4
- package/dist/memory-layers/skill-library.d.ts.map +1 -1
- package/dist/memory-layers/skill-library.js +427 -8
- package/dist/memory-layers/skill-library.js.map +1 -1
- package/dist/memory-layers/working-memory.d.ts +35 -14
- package/dist/memory-layers/working-memory.d.ts.map +1 -1
- package/dist/memory-layers/working-memory.js +114 -36
- package/dist/memory-layers/working-memory.js.map +1 -1
- package/dist/retrieval/hybrid-search.d.ts +2 -2
- package/dist/retrieval/hybrid-search.d.ts.map +1 -1
- package/dist/retrieval/hybrid-search.js +4 -3
- package/dist/retrieval/hybrid-search.js.map +1 -1
- package/dist/router/smart-router.d.ts +25 -0
- package/dist/router/smart-router.d.ts.map +1 -1
- package/dist/router/smart-router.js +90 -10
- package/dist/router/smart-router.js.map +1 -1
- package/dist/scheduler/consolidation-scheduler.d.ts +129 -0
- package/dist/scheduler/consolidation-scheduler.d.ts.map +1 -0
- package/dist/scheduler/consolidation-scheduler.js +179 -0
- package/dist/scheduler/consolidation-scheduler.js.map +1 -0
- package/dist/scheduler/index.d.ts +7 -0
- package/dist/scheduler/index.d.ts.map +1 -0
- package/dist/scheduler/index.js +7 -0
- package/dist/scheduler/index.js.map +1 -0
- package/dist/server-wrapper.js +0 -0
- package/dist/server.js +892 -30
- package/dist/server.js.map +1 -1
- package/dist/synthesis/conflict-detector.d.ts +4 -6
- package/dist/synthesis/conflict-detector.d.ts.map +1 -1
- package/dist/synthesis/conflict-detector.js +19 -21
- package/dist/synthesis/conflict-detector.js.map +1 -1
- package/dist/utils/paths.d.ts +72 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +160 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/validation.d.ts +123 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +146 -7
- package/dist/utils/validation.js.map +1 -1
- package/docker-compose.yml +11 -13
- package/embedding-service/README.md +8 -0
- package/package.json +6 -3
- package/scripts/FRESH_INSTALL.md +1 -1
- package/scripts/ensure-infrastructure.sh +86 -15
- package/scripts/health-check.sh +2 -1
- package/scripts/stop-infrastructure.sh +23 -0
- package/scripts/test-mcp-server.sh +2 -1
|
@@ -12,13 +12,40 @@
|
|
|
12
12
|
* - Collection name sanitization (injection prevention)
|
|
13
13
|
*/
|
|
14
14
|
import { z } from 'zod';
|
|
15
|
+
/**
|
|
16
|
+
* Namespace schema for multi-agent isolation
|
|
17
|
+
*
|
|
18
|
+
* Alphanumeric with hyphens/underscores, defaults to "default".
|
|
19
|
+
* Used across all tools to scope memory operations.
|
|
20
|
+
*/
|
|
21
|
+
export declare const NamespaceSchema: z.ZodDefault<z.ZodString>;
|
|
22
|
+
/**
|
|
23
|
+
* Memory type enum including decision type for v0.5.0
|
|
24
|
+
*/
|
|
25
|
+
export declare const MemoryTypeEnum: z.ZodEnum<{
|
|
26
|
+
episodic: "episodic";
|
|
27
|
+
semantic: "semantic";
|
|
28
|
+
procedural: "procedural";
|
|
29
|
+
decision: "decision";
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Memory type enum for filtering (retrieve/list operations)
|
|
33
|
+
*/
|
|
34
|
+
export declare const MemoryTypeFilterEnum: z.ZodEnum<{
|
|
35
|
+
episodic: "episodic";
|
|
36
|
+
semantic: "semantic";
|
|
37
|
+
procedural: "procedural";
|
|
38
|
+
decision: "decision";
|
|
39
|
+
}>;
|
|
15
40
|
/**
|
|
16
41
|
* Schema for store_memory tool input
|
|
17
42
|
*
|
|
18
43
|
* Enforces:
|
|
19
44
|
* - Content between 1 and 100,000 characters (100KB limit)
|
|
20
|
-
* - Memory type must be one of: episodic, semantic, procedural
|
|
45
|
+
* - Memory type must be one of: episodic, semantic, procedural, decision
|
|
21
46
|
* - Metadata object optional, max 50 keys
|
|
47
|
+
* - Namespace for multi-agent isolation
|
|
48
|
+
* - Agent attribution fields (agent_id, agent_role, task_id)
|
|
22
49
|
*/
|
|
23
50
|
export declare const StoreMemoryInputSchema: z.ZodObject<{
|
|
24
51
|
content: z.ZodString;
|
|
@@ -26,8 +53,13 @@ export declare const StoreMemoryInputSchema: z.ZodObject<{
|
|
|
26
53
|
episodic: "episodic";
|
|
27
54
|
semantic: "semantic";
|
|
28
55
|
procedural: "procedural";
|
|
56
|
+
decision: "decision";
|
|
29
57
|
}>;
|
|
30
58
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
59
|
+
namespace: z.ZodDefault<z.ZodOptional<z.ZodDefault<z.ZodString>>>;
|
|
60
|
+
agent_id: z.ZodOptional<z.ZodString>;
|
|
61
|
+
agent_role: z.ZodOptional<z.ZodString>;
|
|
62
|
+
task_id: z.ZodOptional<z.ZodString>;
|
|
31
63
|
}, z.core.$strip>;
|
|
32
64
|
export type StoreMemoryInput = z.infer<typeof StoreMemoryInputSchema>;
|
|
33
65
|
/**
|
|
@@ -37,6 +69,8 @@ export type StoreMemoryInput = z.infer<typeof StoreMemoryInputSchema>;
|
|
|
37
69
|
* - Query between 1 and 10,000 characters (10KB limit)
|
|
38
70
|
* - Memory types array max 10 items
|
|
39
71
|
* - Max results between 1 and 100
|
|
72
|
+
* - Namespace for multi-agent isolation
|
|
73
|
+
* - Agent/task filtering
|
|
40
74
|
*/
|
|
41
75
|
export declare const RetrieveMemoryInputSchema: z.ZodObject<{
|
|
42
76
|
query: z.ZodString;
|
|
@@ -44,6 +78,7 @@ export declare const RetrieveMemoryInputSchema: z.ZodObject<{
|
|
|
44
78
|
episodic: "episodic";
|
|
45
79
|
semantic: "semantic";
|
|
46
80
|
procedural: "procedural";
|
|
81
|
+
decision: "decision";
|
|
47
82
|
}>>>;
|
|
48
83
|
max_results: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
49
84
|
routing_strategy: z.ZodOptional<z.ZodEnum<{
|
|
@@ -52,6 +87,10 @@ export declare const RetrieveMemoryInputSchema: z.ZodObject<{
|
|
|
52
87
|
full_text: "full_text";
|
|
53
88
|
graph: "graph";
|
|
54
89
|
}>>;
|
|
90
|
+
namespace: z.ZodDefault<z.ZodOptional<z.ZodDefault<z.ZodString>>>;
|
|
91
|
+
agent_id: z.ZodOptional<z.ZodString>;
|
|
92
|
+
task_id: z.ZodOptional<z.ZodString>;
|
|
93
|
+
exclude_agent: z.ZodOptional<z.ZodString>;
|
|
55
94
|
}, z.core.$strip>;
|
|
56
95
|
export type RetrieveMemoryInput = z.infer<typeof RetrieveMemoryInputSchema>;
|
|
57
96
|
/**
|
|
@@ -63,7 +102,9 @@ export declare const ListRecentInputSchema: z.ZodObject<{
|
|
|
63
102
|
episodic: "episodic";
|
|
64
103
|
semantic: "semantic";
|
|
65
104
|
procedural: "procedural";
|
|
105
|
+
decision: "decision";
|
|
66
106
|
}>>;
|
|
107
|
+
namespace: z.ZodDefault<z.ZodOptional<z.ZodDefault<z.ZodString>>>;
|
|
67
108
|
}, z.core.$strip>;
|
|
68
109
|
export type ListRecentInput = z.infer<typeof ListRecentInputSchema>;
|
|
69
110
|
/**
|
|
@@ -71,8 +112,89 @@ export type ListRecentInput = z.infer<typeof ListRecentInputSchema>;
|
|
|
71
112
|
*/
|
|
72
113
|
export declare const GetStatsInputSchema: z.ZodObject<{
|
|
73
114
|
detailed: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
115
|
+
namespace: z.ZodDefault<z.ZodOptional<z.ZodDefault<z.ZodString>>>;
|
|
74
116
|
}, z.core.$strip>;
|
|
75
117
|
export type GetStatsInput = z.infer<typeof GetStatsInputSchema>;
|
|
118
|
+
/**
|
|
119
|
+
* Schema for record_skill_outcome tool input
|
|
120
|
+
*
|
|
121
|
+
* Records success or failure feedback for a skill execution.
|
|
122
|
+
* Used to improve skill ranking over time.
|
|
123
|
+
*
|
|
124
|
+
* Enforces:
|
|
125
|
+
* - skill_id is required
|
|
126
|
+
* - outcome must be 'success' or 'failure'
|
|
127
|
+
* - satisfaction is required for success (0-1 range)
|
|
128
|
+
*/
|
|
129
|
+
export declare const RecordSkillOutcomeInputSchema: z.ZodObject<{
|
|
130
|
+
skill_id: z.ZodString;
|
|
131
|
+
outcome: z.ZodEnum<{
|
|
132
|
+
success: "success";
|
|
133
|
+
failure: "failure";
|
|
134
|
+
}>;
|
|
135
|
+
satisfaction: z.ZodOptional<z.ZodNumber>;
|
|
136
|
+
namespace: z.ZodDefault<z.ZodOptional<z.ZodDefault<z.ZodString>>>;
|
|
137
|
+
}, z.core.$strip>;
|
|
138
|
+
export type RecordSkillOutcomeInput = z.infer<typeof RecordSkillOutcomeInputSchema>;
|
|
139
|
+
/**
|
|
140
|
+
* Schema for load_skill tool input
|
|
141
|
+
*
|
|
142
|
+
* Loads full skill implementation on-demand for execution.
|
|
143
|
+
* Part of lazy loading system to reduce token usage.
|
|
144
|
+
*
|
|
145
|
+
* Enforces:
|
|
146
|
+
* - skill_id is required and non-empty
|
|
147
|
+
* - skill_id must match expected format (skill_*)
|
|
148
|
+
*/
|
|
149
|
+
export declare const LoadSkillInputSchema: z.ZodObject<{
|
|
150
|
+
skill_id: z.ZodString;
|
|
151
|
+
namespace: z.ZodDefault<z.ZodOptional<z.ZodDefault<z.ZodString>>>;
|
|
152
|
+
}, z.core.$strip>;
|
|
153
|
+
export type LoadSkillInput = z.infer<typeof LoadSkillInputSchema>;
|
|
154
|
+
/**
|
|
155
|
+
* Schema for share_context tool input
|
|
156
|
+
*
|
|
157
|
+
* Shares context (memories, skills, entities) from one namespace to another.
|
|
158
|
+
* Used for agent handoffs and context sharing in multi-agent workflows.
|
|
159
|
+
*/
|
|
160
|
+
export declare const ShareContextInputSchema: z.ZodObject<{
|
|
161
|
+
source_namespace: z.ZodDefault<z.ZodString>;
|
|
162
|
+
target_namespace: z.ZodDefault<z.ZodString>;
|
|
163
|
+
task_id: z.ZodOptional<z.ZodString>;
|
|
164
|
+
query: z.ZodOptional<z.ZodString>;
|
|
165
|
+
max_items: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
166
|
+
include_skills: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
167
|
+
include_entities: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
168
|
+
}, z.core.$strip>;
|
|
169
|
+
export type ShareContextInput = z.infer<typeof ShareContextInputSchema>;
|
|
170
|
+
/**
|
|
171
|
+
* Schema for store_decision tool input
|
|
172
|
+
*
|
|
173
|
+
* Stores a decision with reduced decay factor and automatic conflict detection.
|
|
174
|
+
* Decisions are stored as memory_type='decision' with decay_factor: 0.25.
|
|
175
|
+
*/
|
|
176
|
+
export declare const StoreDecisionInputSchema: z.ZodObject<{
|
|
177
|
+
content: z.ZodString;
|
|
178
|
+
namespace: z.ZodDefault<z.ZodOptional<z.ZodDefault<z.ZodString>>>;
|
|
179
|
+
agent_id: z.ZodOptional<z.ZodString>;
|
|
180
|
+
agent_role: z.ZodOptional<z.ZodString>;
|
|
181
|
+
task_id: z.ZodOptional<z.ZodString>;
|
|
182
|
+
supersedes: z.ZodOptional<z.ZodString>;
|
|
183
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
184
|
+
}, z.core.$strip>;
|
|
185
|
+
export type StoreDecisionInput = z.infer<typeof StoreDecisionInputSchema>;
|
|
186
|
+
/**
|
|
187
|
+
* Schema for list_namespaces tool input
|
|
188
|
+
*/
|
|
189
|
+
export declare const ListNamespacesInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
190
|
+
export type ListNamespacesInput = z.infer<typeof ListNamespacesInputSchema>;
|
|
191
|
+
/**
|
|
192
|
+
* Schema for namespace_stats tool input
|
|
193
|
+
*/
|
|
194
|
+
export declare const NamespaceStatsInputSchema: z.ZodObject<{
|
|
195
|
+
namespace: z.ZodDefault<z.ZodString>;
|
|
196
|
+
}, z.core.$strip>;
|
|
197
|
+
export type NamespaceStatsInput = z.infer<typeof NamespaceStatsInputSchema>;
|
|
76
198
|
/**
|
|
77
199
|
* Vector validation schema
|
|
78
200
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;;;;GAKG;AACH,eAAO,MAAM,eAAe,2BAIP,CAAC;AAEtB;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;EAEzB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;EAA6D,CAAC;AAM/F;;;;;;;;;GASG;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e,CAAC;AAEtD,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,yBAAyB;;iBAEpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAM5E;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,yBAItB,CAAC;AAEJ;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,aAM9B,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,YAAY,aAMtB,CAAC;AAMJ;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,CAY1E;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAc3E;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAS3D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQpD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQrD"}
|
package/dist/utils/validation.js
CHANGED
|
@@ -14,6 +14,30 @@
|
|
|
14
14
|
import { z } from 'zod';
|
|
15
15
|
import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
16
16
|
// ============================================================================
|
|
17
|
+
// Reusable Schemas
|
|
18
|
+
// ============================================================================
|
|
19
|
+
/**
|
|
20
|
+
* Namespace schema for multi-agent isolation
|
|
21
|
+
*
|
|
22
|
+
* Alphanumeric with hyphens/underscores, defaults to "default".
|
|
23
|
+
* Used across all tools to scope memory operations.
|
|
24
|
+
*/
|
|
25
|
+
export const NamespaceSchema = z.string()
|
|
26
|
+
.regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/, "Namespace must start with a letter and contain only alphanumeric characters, underscores, or hyphens")
|
|
27
|
+
.min(1, "Namespace cannot be empty")
|
|
28
|
+
.max(100, "Namespace cannot exceed 100 characters")
|
|
29
|
+
.default("default");
|
|
30
|
+
/**
|
|
31
|
+
* Memory type enum including decision type for v0.5.0
|
|
32
|
+
*/
|
|
33
|
+
export const MemoryTypeEnum = z.enum(["episodic", "semantic", "procedural", "decision"], {
|
|
34
|
+
message: "Invalid memory type. Must be episodic, semantic, procedural, or decision"
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* Memory type enum for filtering (retrieve/list operations)
|
|
38
|
+
*/
|
|
39
|
+
export const MemoryTypeFilterEnum = z.enum(["episodic", "semantic", "procedural", "decision"]);
|
|
40
|
+
// ============================================================================
|
|
17
41
|
// MCP Tool Input Schemas
|
|
18
42
|
// ============================================================================
|
|
19
43
|
/**
|
|
@@ -21,20 +45,24 @@ import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
|
21
45
|
*
|
|
22
46
|
* Enforces:
|
|
23
47
|
* - Content between 1 and 100,000 characters (100KB limit)
|
|
24
|
-
* - Memory type must be one of: episodic, semantic, procedural
|
|
48
|
+
* - Memory type must be one of: episodic, semantic, procedural, decision
|
|
25
49
|
* - Metadata object optional, max 50 keys
|
|
50
|
+
* - Namespace for multi-agent isolation
|
|
51
|
+
* - Agent attribution fields (agent_id, agent_role, task_id)
|
|
26
52
|
*/
|
|
27
53
|
export const StoreMemoryInputSchema = z.object({
|
|
28
54
|
content: z.string()
|
|
29
55
|
.min(1, "Content cannot be empty")
|
|
30
56
|
.max(100000, "Content exceeds 100KB limit"),
|
|
31
|
-
memory_type:
|
|
32
|
-
message: "Invalid memory type. Must be episodic, semantic, or procedural"
|
|
33
|
-
}),
|
|
57
|
+
memory_type: MemoryTypeEnum,
|
|
34
58
|
metadata: z.record(z.string(), z.unknown())
|
|
35
59
|
.optional()
|
|
36
60
|
.refine((val) => !val || Object.keys(val).length <= 50, "Metadata cannot exceed 50 keys")
|
|
37
61
|
.refine((val) => !val || JSON.stringify(val).length <= 10000, "Metadata size exceeds 10KB limit"),
|
|
62
|
+
namespace: NamespaceSchema.optional().default("default"),
|
|
63
|
+
agent_id: z.string().max(255).optional(),
|
|
64
|
+
agent_role: z.string().max(255).optional(),
|
|
65
|
+
task_id: z.string().max(255).optional(),
|
|
38
66
|
});
|
|
39
67
|
/**
|
|
40
68
|
* Schema for retrieve_memory tool input
|
|
@@ -43,12 +71,14 @@ export const StoreMemoryInputSchema = z.object({
|
|
|
43
71
|
* - Query between 1 and 10,000 characters (10KB limit)
|
|
44
72
|
* - Memory types array max 10 items
|
|
45
73
|
* - Max results between 1 and 100
|
|
74
|
+
* - Namespace for multi-agent isolation
|
|
75
|
+
* - Agent/task filtering
|
|
46
76
|
*/
|
|
47
77
|
export const RetrieveMemoryInputSchema = z.object({
|
|
48
78
|
query: z.string()
|
|
49
79
|
.min(1, "Query cannot be empty")
|
|
50
80
|
.max(10000, "Query exceeds 10KB limit"),
|
|
51
|
-
memory_types: z.array(
|
|
81
|
+
memory_types: z.array(MemoryTypeFilterEnum)
|
|
52
82
|
.max(10, "Cannot filter by more than 10 memory types")
|
|
53
83
|
.optional(),
|
|
54
84
|
max_results: z.number()
|
|
@@ -59,6 +89,10 @@ export const RetrieveMemoryInputSchema = z.object({
|
|
|
59
89
|
.default(5),
|
|
60
90
|
routing_strategy: z.enum(["fast_path", "semantic", "full_text", "graph"])
|
|
61
91
|
.optional(),
|
|
92
|
+
namespace: NamespaceSchema.optional().default("default"),
|
|
93
|
+
agent_id: z.string().max(255).optional(),
|
|
94
|
+
task_id: z.string().max(255).optional(),
|
|
95
|
+
exclude_agent: z.string().max(255).optional(),
|
|
62
96
|
});
|
|
63
97
|
/**
|
|
64
98
|
* Schema for list_recent tool input
|
|
@@ -70,8 +104,8 @@ export const ListRecentInputSchema = z.object({
|
|
|
70
104
|
.max(100, "limit cannot exceed 100")
|
|
71
105
|
.optional()
|
|
72
106
|
.default(5),
|
|
73
|
-
memory_type:
|
|
74
|
-
|
|
107
|
+
memory_type: MemoryTypeFilterEnum.optional(),
|
|
108
|
+
namespace: NamespaceSchema.optional().default("default"),
|
|
75
109
|
});
|
|
76
110
|
/**
|
|
77
111
|
* Schema for get_stats tool input
|
|
@@ -80,6 +114,111 @@ export const GetStatsInputSchema = z.object({
|
|
|
80
114
|
detailed: z.boolean()
|
|
81
115
|
.optional()
|
|
82
116
|
.default(false),
|
|
117
|
+
namespace: NamespaceSchema.optional().default("default"),
|
|
118
|
+
});
|
|
119
|
+
/**
|
|
120
|
+
* Schema for record_skill_outcome tool input
|
|
121
|
+
*
|
|
122
|
+
* Records success or failure feedback for a skill execution.
|
|
123
|
+
* Used to improve skill ranking over time.
|
|
124
|
+
*
|
|
125
|
+
* Enforces:
|
|
126
|
+
* - skill_id is required
|
|
127
|
+
* - outcome must be 'success' or 'failure'
|
|
128
|
+
* - satisfaction is required for success (0-1 range)
|
|
129
|
+
*/
|
|
130
|
+
export const RecordSkillOutcomeInputSchema = z.object({
|
|
131
|
+
skill_id: z.string()
|
|
132
|
+
.min(1, "skill_id cannot be empty"),
|
|
133
|
+
outcome: z.enum(["success", "failure"], {
|
|
134
|
+
message: "outcome must be 'success' or 'failure'"
|
|
135
|
+
}),
|
|
136
|
+
satisfaction: z.number()
|
|
137
|
+
.min(0, "satisfaction must be at least 0")
|
|
138
|
+
.max(1, "satisfaction cannot exceed 1")
|
|
139
|
+
.optional(),
|
|
140
|
+
namespace: NamespaceSchema.optional().default("default"),
|
|
141
|
+
}).refine((data) => {
|
|
142
|
+
// satisfaction is required for success outcome
|
|
143
|
+
if (data.outcome === 'success' && data.satisfaction === undefined) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
return true;
|
|
147
|
+
}, {
|
|
148
|
+
message: "satisfaction is required when outcome is 'success'",
|
|
149
|
+
path: ["satisfaction"]
|
|
150
|
+
});
|
|
151
|
+
/**
|
|
152
|
+
* Schema for load_skill tool input
|
|
153
|
+
*
|
|
154
|
+
* Loads full skill implementation on-demand for execution.
|
|
155
|
+
* Part of lazy loading system to reduce token usage.
|
|
156
|
+
*
|
|
157
|
+
* Enforces:
|
|
158
|
+
* - skill_id is required and non-empty
|
|
159
|
+
* - skill_id must match expected format (skill_*)
|
|
160
|
+
*/
|
|
161
|
+
export const LoadSkillInputSchema = z.object({
|
|
162
|
+
skill_id: z.string()
|
|
163
|
+
.min(1, "skill_id cannot be empty")
|
|
164
|
+
.max(255, "skill_id cannot exceed 255 characters")
|
|
165
|
+
.regex(/^skill_[a-z0-9_]+$/i, "Invalid skill_id format (must be skill_*)"),
|
|
166
|
+
namespace: NamespaceSchema.optional().default("default"),
|
|
167
|
+
});
|
|
168
|
+
// ============================================================================
|
|
169
|
+
// New Tool Schemas for v0.5.0
|
|
170
|
+
// ============================================================================
|
|
171
|
+
/**
|
|
172
|
+
* Schema for share_context tool input
|
|
173
|
+
*
|
|
174
|
+
* Shares context (memories, skills, entities) from one namespace to another.
|
|
175
|
+
* Used for agent handoffs and context sharing in multi-agent workflows.
|
|
176
|
+
*/
|
|
177
|
+
export const ShareContextInputSchema = z.object({
|
|
178
|
+
source_namespace: NamespaceSchema,
|
|
179
|
+
target_namespace: NamespaceSchema,
|
|
180
|
+
task_id: z.string().max(255).optional(),
|
|
181
|
+
query: z.string()
|
|
182
|
+
.min(1, "Query cannot be empty")
|
|
183
|
+
.max(10000, "Query exceeds 10KB limit")
|
|
184
|
+
.optional(),
|
|
185
|
+
max_items: z.number()
|
|
186
|
+
.int()
|
|
187
|
+
.min(1)
|
|
188
|
+
.max(50)
|
|
189
|
+
.optional()
|
|
190
|
+
.default(10),
|
|
191
|
+
include_skills: z.boolean().optional().default(false),
|
|
192
|
+
include_entities: z.boolean().optional().default(true),
|
|
193
|
+
});
|
|
194
|
+
/**
|
|
195
|
+
* Schema for store_decision tool input
|
|
196
|
+
*
|
|
197
|
+
* Stores a decision with reduced decay factor and automatic conflict detection.
|
|
198
|
+
* Decisions are stored as memory_type='decision' with decay_factor: 0.25.
|
|
199
|
+
*/
|
|
200
|
+
export const StoreDecisionInputSchema = z.object({
|
|
201
|
+
content: z.string()
|
|
202
|
+
.min(1, "Content cannot be empty")
|
|
203
|
+
.max(100000, "Content exceeds 100KB limit"),
|
|
204
|
+
namespace: NamespaceSchema.optional().default("default"),
|
|
205
|
+
agent_id: z.string().max(255).optional(),
|
|
206
|
+
agent_role: z.string().max(255).optional(),
|
|
207
|
+
task_id: z.string().max(255).optional(),
|
|
208
|
+
supersedes: z.string().max(255).optional(),
|
|
209
|
+
metadata: z.record(z.string(), z.unknown())
|
|
210
|
+
.optional()
|
|
211
|
+
.refine((val) => !val || Object.keys(val).length <= 50, "Metadata cannot exceed 50 keys"),
|
|
212
|
+
});
|
|
213
|
+
/**
|
|
214
|
+
* Schema for list_namespaces tool input
|
|
215
|
+
*/
|
|
216
|
+
export const ListNamespacesInputSchema = z.object({});
|
|
217
|
+
/**
|
|
218
|
+
* Schema for namespace_stats tool input
|
|
219
|
+
*/
|
|
220
|
+
export const NamespaceStatsInputSchema = z.object({
|
|
221
|
+
namespace: NamespaceSchema,
|
|
83
222
|
});
|
|
84
223
|
// ============================================================================
|
|
85
224
|
// Internal Data Type Schemas
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAEzE,+EAA+E;AAC/E,
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG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AAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,oBAAoB;IACpB,IAAI,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAEzC,kBAAkB;IAClB,SAAS,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;IAE7B,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAE9C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
|
package/docker-compose.yml
CHANGED
|
@@ -2,11 +2,11 @@ services:
|
|
|
2
2
|
# Vector Database for embeddings and semantic search
|
|
3
3
|
qdrant:
|
|
4
4
|
image: qdrant/qdrant:v1.7.4
|
|
5
|
-
container_name: vesper-qdrant
|
|
5
|
+
container_name: ${VESPER_PREFIX:-vesper}-qdrant
|
|
6
6
|
ports:
|
|
7
|
-
- "6333:6333"
|
|
7
|
+
- "${QDRANT_PORT:-6333}:6333"
|
|
8
8
|
volumes:
|
|
9
|
-
-
|
|
9
|
+
- ${VESPER_HOME:-~/.vesper}/docker-data/qdrant:/qdrant/storage
|
|
10
10
|
restart: unless-stopped
|
|
11
11
|
networks:
|
|
12
12
|
- vesper-network
|
|
@@ -20,11 +20,11 @@ services:
|
|
|
20
20
|
# Cache layer and working memory
|
|
21
21
|
redis:
|
|
22
22
|
image: redis:7-alpine
|
|
23
|
-
container_name: vesper-redis
|
|
23
|
+
container_name: ${VESPER_PREFIX:-vesper}-redis
|
|
24
24
|
ports:
|
|
25
|
-
- "6379:6379"
|
|
25
|
+
- "${REDIS_PORT:-6379}:6379"
|
|
26
26
|
volumes:
|
|
27
|
-
-
|
|
27
|
+
- ${VESPER_HOME:-~/.vesper}/docker-data/redis:/data
|
|
28
28
|
command: redis-server --appendonly yes
|
|
29
29
|
restart: unless-stopped
|
|
30
30
|
networks:
|
|
@@ -41,9 +41,9 @@ services:
|
|
|
41
41
|
build:
|
|
42
42
|
context: ./embedding-service
|
|
43
43
|
dockerfile: Dockerfile
|
|
44
|
-
container_name: vesper-embedding
|
|
44
|
+
container_name: ${VESPER_PREFIX:-vesper}-embedding
|
|
45
45
|
ports:
|
|
46
|
-
- "8000:8000"
|
|
46
|
+
- "${EMBEDDING_PORT:-8000}:8000"
|
|
47
47
|
restart: unless-stopped
|
|
48
48
|
networks:
|
|
49
49
|
- vesper-network
|
|
@@ -58,8 +58,6 @@ networks:
|
|
|
58
58
|
vesper-network:
|
|
59
59
|
driver: bridge
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
redis_storage:
|
|
65
|
-
driver: local
|
|
61
|
+
# Note: Volume mounts use ${VESPER_HOME:-~/.vesper}/docker-data/
|
|
62
|
+
# to persist data in user-level storage instead of Docker named volumes.
|
|
63
|
+
# This enables data portability and easier backup.
|
|
@@ -66,3 +66,11 @@ async function getEmbedding(text: string): Promise<number[]> {
|
|
|
66
66
|
- **Dimensions**: 1024
|
|
67
67
|
- **Throughput**: ~100-200 embeddings/sec (CPU), ~1000+/sec (GPU)
|
|
68
68
|
- **Latency**: ~10-50ms per text (CPU), ~1-5ms (GPU)
|
|
69
|
+
|
|
70
|
+
## Credits
|
|
71
|
+
|
|
72
|
+
This service uses [BAAI/bge-large-en-v1.5](https://huggingface.co/BAAI/bge-large-en-v1.5), an open-source embedding model developed by the Beijing Academy of Artificial Intelligence (BAAI).
|
|
73
|
+
|
|
74
|
+
**Model Repository**: [FlagEmbedding](https://github.com/FlagOpen/FlagEmbedding)
|
|
75
|
+
|
|
76
|
+
BGE (BAAI General Embedding) models are trained using RetroMAE and contrastive learning on large-scale pairs data, achieving state-of-the-art performance on semantic retrieval tasks.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vesper-memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "AI memory system for Claude Code - Three-layer architecture with semantic search, knowledge graphs, and intelligent retrieval",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"url": "https://github.com/fitz2882/vesper-memory.git"
|
|
48
48
|
},
|
|
49
49
|
"bugs": {
|
|
50
|
-
"url": "https://github.com/fitz2882/vesper/issues"
|
|
50
|
+
"url": "https://github.com/fitz2882/vesper-memory/issues"
|
|
51
51
|
},
|
|
52
52
|
"homepage": "https://github.com/fitz2882/vesper-memory#readme",
|
|
53
53
|
"license": "MIT",
|
|
@@ -55,6 +55,8 @@
|
|
|
55
55
|
"postinstall": "node scripts/postinstall.js",
|
|
56
56
|
"dev": "node --loader ts-node/esm src/server.ts",
|
|
57
57
|
"build": "tsc",
|
|
58
|
+
"build:global": "npm run build && npm install -g .",
|
|
59
|
+
"reinstall": "npm install -g .",
|
|
58
60
|
"test": "vitest",
|
|
59
61
|
"test:ui": "vitest --ui",
|
|
60
62
|
"benchmark": "vitest run tests/benchmarks/memory-performance.test.ts",
|
|
@@ -87,6 +89,7 @@
|
|
|
87
89
|
"prettier": "^3.1.1",
|
|
88
90
|
"ts-node": "^10.9.2",
|
|
89
91
|
"typescript": "^5.3.3",
|
|
90
|
-
"vitest": "^4.0.18"
|
|
92
|
+
"vitest": "^4.0.18",
|
|
93
|
+
"yaml": "^2.8.2"
|
|
91
94
|
}
|
|
92
95
|
}
|
package/scripts/FRESH_INSTALL.md
CHANGED
|
@@ -277,4 +277,4 @@ If you encounter issues:
|
|
|
277
277
|
1. Check the troubleshooting section above
|
|
278
278
|
2. Review logs: `docker-compose logs -f`
|
|
279
279
|
3. Check Docker status: `make status`
|
|
280
|
-
4. File an issue: https://github.com/fitz2882/vesper/issues
|
|
280
|
+
4. File an issue: https://github.com/fitz2882/vesper-memory/issues
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# Ensures Docker services are running for
|
|
2
|
+
# Ensures Docker services are running for enabled Vesper MCP servers
|
|
3
|
+
# Starts services for vesper-personal and/or vesper-dev based on MCP config
|
|
3
4
|
|
|
4
5
|
# Dynamically determine installation directory
|
|
5
6
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
@@ -12,20 +13,90 @@ if ! docker info >/dev/null 2>&1; then
|
|
|
12
13
|
exit 0 # Exit gracefully - don't block Claude startup
|
|
13
14
|
fi
|
|
14
15
|
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
echo "
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
# Detect which MCP servers are configured
|
|
17
|
+
# Check local project config first, then fall back to global config
|
|
18
|
+
LOCAL_MCP_CONFIG="$PROJECT_DIR/.claude/mcp_config.json"
|
|
19
|
+
GLOBAL_MCP_CONFIG="$HOME/.claude/mcp_config.json"
|
|
20
|
+
|
|
21
|
+
START_PERSONAL=false
|
|
22
|
+
START_DEV=false
|
|
23
|
+
|
|
24
|
+
# Use local config if it exists, otherwise use global
|
|
25
|
+
if [ -f "$LOCAL_MCP_CONFIG" ]; then
|
|
26
|
+
MCP_CONFIG="$LOCAL_MCP_CONFIG"
|
|
27
|
+
echo "Using local MCP config: $LOCAL_MCP_CONFIG"
|
|
28
|
+
elif [ -f "$GLOBAL_MCP_CONFIG" ]; then
|
|
29
|
+
MCP_CONFIG="$GLOBAL_MCP_CONFIG"
|
|
30
|
+
echo "Using global MCP config: $GLOBAL_MCP_CONFIG"
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
if [ -f "$MCP_CONFIG" ]; then
|
|
34
|
+
if grep -q '"vesper-personal"' "$MCP_CONFIG"; then
|
|
35
|
+
START_PERSONAL=true
|
|
36
|
+
fi
|
|
37
|
+
if grep -q '"vesper-dev"' "$MCP_CONFIG"; then
|
|
38
|
+
START_DEV=true
|
|
39
|
+
fi
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# Function to start services for a specific instance
|
|
43
|
+
start_instance() {
|
|
44
|
+
local PROJECT_NAME=$1
|
|
45
|
+
local INSTANCE=$2
|
|
46
|
+
local VESPER_HOME=$3
|
|
47
|
+
local REDIS_PORT=$4
|
|
48
|
+
local QDRANT_PORT=$5
|
|
49
|
+
local EMBEDDING_PORT=$6
|
|
50
|
+
|
|
51
|
+
# Create required directories
|
|
52
|
+
mkdir -p "$VESPER_HOME/data"
|
|
53
|
+
mkdir -p "$VESPER_HOME/docker-data/qdrant"
|
|
54
|
+
mkdir -p "$VESPER_HOME/docker-data/redis"
|
|
55
|
+
mkdir -p "$VESPER_HOME/logs"
|
|
56
|
+
|
|
57
|
+
# Check if services are already healthy
|
|
58
|
+
local REDIS_HEALTHY=$(docker ps --filter "name=${INSTANCE}-redis" --filter "health=healthy" --format "{{.Names}}" | wc -l | tr -d ' ')
|
|
59
|
+
local QDRANT_HEALTHY=$(docker ps --filter "name=${INSTANCE}-qdrant" --filter "health=healthy" --format "{{.Names}}" | wc -l | tr -d ' ')
|
|
60
|
+
local EMBEDDING_HEALTHY=$(docker ps --filter "name=${INSTANCE}-embedding" --filter "health=healthy" --format "{{.Names}}" | wc -l | tr -d ' ')
|
|
61
|
+
|
|
62
|
+
if [ "$REDIS_HEALTHY" = "0" ] || [ "$QDRANT_HEALTHY" = "0" ] || [ "$EMBEDDING_HEALTHY" = "0" ]; then
|
|
63
|
+
echo "đ Starting $INSTANCE infrastructure..."
|
|
64
|
+
|
|
65
|
+
# Export environment variables for docker-compose
|
|
66
|
+
export VESPER_PREFIX="$INSTANCE"
|
|
67
|
+
export VESPER_HOME="$VESPER_HOME"
|
|
68
|
+
export REDIS_PORT="$REDIS_PORT"
|
|
69
|
+
export QDRANT_PORT="$QDRANT_PORT"
|
|
70
|
+
export EMBEDDING_PORT="$EMBEDDING_PORT"
|
|
71
|
+
|
|
72
|
+
# Try to start existing containers first (fast path)
|
|
73
|
+
docker-compose -p "$PROJECT_NAME" start 2>/dev/null
|
|
74
|
+
|
|
75
|
+
# If that failed (no containers exist), create them
|
|
76
|
+
if [ $? -ne 0 ]; then
|
|
77
|
+
docker-compose -p "$PROJECT_NAME" up -d 2>&1 | grep -v "is not set. Defaulting" | grep -v "level=warning" | grep -v "internal" || true
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
echo "â
$INSTANCE infrastructure started"
|
|
81
|
+
else
|
|
82
|
+
echo "â
$INSTANCE infrastructure already running"
|
|
83
|
+
fi
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
# Start vesper-personal if configured
|
|
87
|
+
if [ "$START_PERSONAL" = true ]; then
|
|
88
|
+
start_instance "vesper-personal" "vesper" "$HOME/.vesper" "6379" "6333" "8000"
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
# Start vesper-dev if configured
|
|
92
|
+
if [ "$START_DEV" = true ]; then
|
|
93
|
+
start_instance "vesper-dev" "vesper-dev" "$HOME/.vesper-dev" "6380" "6334" "8001"
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
# If neither configured, default to vesper-personal
|
|
97
|
+
if [ "$START_PERSONAL" = false ] && [ "$START_DEV" = false ]; then
|
|
98
|
+
echo "âšī¸ No Vesper MCP servers found in config, starting vesper-personal by default"
|
|
99
|
+
start_instance "vesper-personal" "vesper" "$HOME/.vesper" "6379" "6333" "8000"
|
|
29
100
|
fi
|
|
30
101
|
|
|
31
102
|
# Verify build artifacts exist
|
package/scripts/health-check.sh
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
set -e
|
|
5
5
|
|
|
6
|
-
PROJECT_DIR
|
|
6
|
+
# Dynamically detect project directory (script is in PROJECT_DIR/scripts/)
|
|
7
|
+
PROJECT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
7
8
|
|
|
8
9
|
echo "đ Memory System Health Check"
|
|
9
10
|
echo "=============================="
|