vesper-memory 0.5.2 → 0.5.3

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 (82) hide show
  1. package/README.md +41 -10
  2. package/config/claude-rules/memory-discipline.md +39 -0
  3. package/config/claude-rules/vesper.md +218 -0
  4. package/dist/cli.js +59 -0
  5. package/dist/cli.js.map +1 -1
  6. package/package.json +1 -2
  7. package/dist/cli 2.js +0 -583
  8. package/dist/cli.d 2.ts +0 -8
  9. package/dist/cli.d.ts 2.map +0 -1
  10. package/dist/cli.js 2.map +0 -1
  11. package/dist/config 2/rate-limits.d.ts +0 -76
  12. package/dist/config 2/rate-limits.d.ts.map +0 -1
  13. package/dist/config 2/rate-limits.js +0 -161
  14. package/dist/config 2/rate-limits.js.map +0 -1
  15. package/dist/consolidation 2/pipeline.d.ts +0 -52
  16. package/dist/consolidation 2/pipeline.d.ts.map +0 -1
  17. package/dist/consolidation 2/pipeline.js +0 -193
  18. package/dist/consolidation 2/pipeline.js.map +0 -1
  19. package/dist/embeddings 2/client.d.ts +0 -94
  20. package/dist/embeddings 2/client.d.ts.map +0 -1
  21. package/dist/embeddings 2/client.js +0 -144
  22. package/dist/embeddings 2/client.js.map +0 -1
  23. package/dist/memory-layers 2/semantic-memory.d.ts +0 -33
  24. package/dist/memory-layers 2/semantic-memory.d.ts.map +0 -1
  25. package/dist/memory-layers 2/semantic-memory.js +0 -114
  26. package/dist/memory-layers 2/semantic-memory.js.map +0 -1
  27. package/dist/memory-layers 2/skill-library.d.ts +0 -25
  28. package/dist/memory-layers 2/skill-library.d.ts.map +0 -1
  29. package/dist/memory-layers 2/skill-library.js +0 -54
  30. package/dist/memory-layers 2/skill-library.js.map +0 -1
  31. package/dist/memory-layers 2/working-memory.d.ts +0 -57
  32. package/dist/memory-layers 2/working-memory.d.ts.map +0 -1
  33. package/dist/memory-layers 2/working-memory.js +0 -153
  34. package/dist/memory-layers 2/working-memory.js.map +0 -1
  35. package/dist/middleware 2/auth.d.ts +0 -287
  36. package/dist/middleware 2/auth.d.ts.map +0 -1
  37. package/dist/middleware 2/auth.js +0 -610
  38. package/dist/middleware 2/auth.js.map +0 -1
  39. package/dist/monitoring 2/health.d.ts +0 -241
  40. package/dist/monitoring 2/health.d.ts.map +0 -1
  41. package/dist/monitoring 2/health.js +0 -649
  42. package/dist/monitoring 2/health.js.map +0 -1
  43. package/dist/monitoring 2/metrics.d.ts +0 -153
  44. package/dist/monitoring 2/metrics.d.ts.map +0 -1
  45. package/dist/monitoring 2/metrics.js +0 -349
  46. package/dist/monitoring 2/metrics.js.map +0 -1
  47. package/dist/retrieval 2/hybrid-search.d.ts +0 -186
  48. package/dist/retrieval 2/hybrid-search.d.ts.map +0 -1
  49. package/dist/retrieval 2/hybrid-search.js +0 -327
  50. package/dist/retrieval 2/hybrid-search.js.map +0 -1
  51. package/dist/router 2/smart-router.d.ts +0 -111
  52. package/dist/router 2/smart-router.d.ts.map +0 -1
  53. package/dist/router 2/smart-router.js +0 -383
  54. package/dist/router 2/smart-router.js.map +0 -1
  55. package/dist/security 2/rate-limit-middleware.d.ts +0 -119
  56. package/dist/security 2/rate-limit-middleware.d.ts.map +0 -1
  57. package/dist/security 2/rate-limit-middleware.js +0 -193
  58. package/dist/security 2/rate-limit-middleware.js.map +0 -1
  59. package/dist/server 2.js +0 -861
  60. package/dist/server-wrapper 2.js +0 -170
  61. package/dist/server-wrapper.d 2.ts +0 -12
  62. package/dist/server-wrapper.d.ts 2.map +0 -1
  63. package/dist/server-wrapper.js 2.map +0 -1
  64. package/dist/server.d 2.ts +0 -14
  65. package/dist/server.d.ts 2.map +0 -1
  66. package/dist/server.js 2.map +0 -1
  67. package/dist/synthesis 2/conflict-detector.d.ts +0 -43
  68. package/dist/synthesis 2/conflict-detector.d.ts.map +0 -1
  69. package/dist/synthesis 2/conflict-detector.js +0 -125
  70. package/dist/synthesis 2/conflict-detector.js.map +0 -1
  71. package/dist/utils 2/monitoring.d.ts +0 -25
  72. package/dist/utils 2/monitoring.d.ts.map +0 -1
  73. package/dist/utils 2/monitoring.js +0 -41
  74. package/dist/utils 2/monitoring.js.map +0 -1
  75. package/dist/utils 2/rate-limiter.d.ts +0 -97
  76. package/dist/utils 2/rate-limiter.d.ts.map +0 -1
  77. package/dist/utils 2/rate-limiter.js +0 -166
  78. package/dist/utils 2/rate-limiter.js.map +0 -1
  79. package/dist/utils 2/validation.d.ts +0 -139
  80. package/dist/utils 2/validation.d.ts.map +0 -1
  81. package/dist/utils 2/validation.js +0 -195
  82. package/dist/utils 2/validation.js.map +0 -1
@@ -1,76 +0,0 @@
1
- /**
2
- * Rate Limiting Configuration
3
- *
4
- * Defines tier-based rate limits for MCP tools.
5
- * Configurable via environment variables.
6
- *
7
- * Security: Implements SEC-HIGH-001 from security audit
8
- */
9
- import { RateLimitConfig } from "../utils/rate-limiter.js";
10
- /**
11
- * Available rate limit tiers
12
- *
13
- * Note: "unlimited" is the highest tier (not "enterprise")
14
- * This matches the tier naming in auth.ts and postgres-auth-schema.sql
15
- */
16
- export type TierName = "standard" | "premium" | "unlimited";
17
- /**
18
- * Tier-based rate limits for all MCP operations
19
- *
20
- * Limits are per-minute unless otherwise specified.
21
- *
22
- * | Tier | store_memory | retrieve_memory | list_recent | get_stats |
23
- * |------|-------------|-----------------|-------------|-----------|
24
- * | standard | 100/min | 300/min | 60/min | 30/min |
25
- * | premium | 500/min | 1000/min | 200/min | 100/min |
26
- * | unlimited | no limit | no limit | no limit | no limit |
27
- */
28
- export declare const TIER_LIMITS: Record<TierName, Record<string, RateLimitConfig>>;
29
- /**
30
- * Legacy export for backwards compatibility
31
- */
32
- export declare const RATE_LIMIT_TIERS: Record<TierName, Record<string, RateLimitConfig>>;
33
- /**
34
- * Get rate limits for a specific tier
35
- *
36
- * @param tier - The tier name
37
- * @returns Rate limit configuration for all operations
38
- */
39
- export declare function getTierLimits(tier: TierName): Record<string, RateLimitConfig>;
40
- /**
41
- * Configuration from environment variables
42
- */
43
- export interface RateLimitEnvConfig {
44
- /** Default tier for users without explicit tier assignment */
45
- defaultTier: TierName;
46
- /** Whether to allow requests when Redis is unavailable (default: false - fail closed) */
47
- failOpen: boolean;
48
- /** Custom limits that override tier defaults */
49
- customLimits?: Record<string, number>;
50
- /** Emergency fallback limit when Redis is down (only used with failOpen: false) */
51
- emergencyLimit: number;
52
- }
53
- /**
54
- * Read rate limit configuration from environment variables
55
- *
56
- * Environment variables:
57
- * - RATE_LIMIT_DEFAULT_TIER: Default tier (standard|premium|unlimited)
58
- * - RATE_LIMIT_FAIL_OPEN: Whether to allow requests when Redis is down (true|false)
59
- * - RATE_LIMIT_STORE_MEMORY: Override store_memory limit
60
- * - RATE_LIMIT_RETRIEVE_MEMORY: Override retrieve_memory limit
61
- * - RATE_LIMIT_LIST_RECENT: Override list_recent limit
62
- * - RATE_LIMIT_GET_STATS: Override get_stats limit
63
- * - RATE_LIMIT_EMERGENCY: Emergency in-memory limit when Redis is down
64
- *
65
- * @returns Rate limit configuration
66
- */
67
- export declare function getRateLimitConfigFromEnv(): RateLimitEnvConfig;
68
- /**
69
- * Build rate limit configuration by merging tier defaults with custom limits
70
- *
71
- * @param tier - Base tier
72
- * @param customLimits - Custom limit overrides
73
- * @returns Merged rate limit configuration
74
- */
75
- export declare function buildRateLimitConfig(tier: TierName, customLimits?: Record<string, number>): Record<string, RateLimitConfig>;
76
- //# sourceMappingURL=rate-limits.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rate-limits.d.ts","sourceRoot":"","sources":["../../src/config/rate-limits.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAyDzE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,mDAAc,CAAC;AAE5C;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAE7E;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,8DAA8D;IAC9D,WAAW,EAAE,QAAQ,CAAC;IAEtB,yFAAyF;IACzF,QAAQ,EAAE,OAAO,CAAC;IAElB,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEtC,mFAAmF;IACnF,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,IAAI,kBAAkB,CA0C9D;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,QAAQ,EACd,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAoBjC"}
@@ -1,161 +0,0 @@
1
- /**
2
- * Rate Limiting Configuration
3
- *
4
- * Defines tier-based rate limits for MCP tools.
5
- * Configurable via environment variables.
6
- *
7
- * Security: Implements SEC-HIGH-001 from security audit
8
- */
9
- /**
10
- * Tier-based rate limits for all MCP operations
11
- *
12
- * Limits are per-minute unless otherwise specified.
13
- *
14
- * | Tier | store_memory | retrieve_memory | list_recent | get_stats |
15
- * |------|-------------|-----------------|-------------|-----------|
16
- * | standard | 100/min | 300/min | 60/min | 30/min |
17
- * | premium | 500/min | 1000/min | 200/min | 100/min |
18
- * | unlimited | no limit | no limit | no limit | no limit |
19
- */
20
- export const TIER_LIMITS = {
21
- standard: {
22
- store_memory: {
23
- maxRequests: 100,
24
- windowSeconds: 60,
25
- },
26
- retrieve_memory: {
27
- maxRequests: 300,
28
- windowSeconds: 60,
29
- },
30
- list_recent: {
31
- maxRequests: 60,
32
- windowSeconds: 60,
33
- },
34
- get_stats: {
35
- maxRequests: 30,
36
- windowSeconds: 60,
37
- },
38
- },
39
- premium: {
40
- store_memory: {
41
- maxRequests: 500,
42
- windowSeconds: 60,
43
- },
44
- retrieve_memory: {
45
- maxRequests: 1000,
46
- windowSeconds: 60,
47
- },
48
- list_recent: {
49
- maxRequests: 200,
50
- windowSeconds: 60,
51
- },
52
- get_stats: {
53
- maxRequests: 100,
54
- windowSeconds: 60,
55
- },
56
- },
57
- unlimited: {
58
- // Use very high values (effectively no limit) for unlimited tier
59
- // We avoid actual infinity to prevent edge cases in Redis
60
- store_memory: {
61
- maxRequests: 1000000,
62
- windowSeconds: 60,
63
- },
64
- retrieve_memory: {
65
- maxRequests: 1000000,
66
- windowSeconds: 60,
67
- },
68
- list_recent: {
69
- maxRequests: 1000000,
70
- windowSeconds: 60,
71
- },
72
- get_stats: {
73
- maxRequests: 1000000,
74
- windowSeconds: 60,
75
- },
76
- },
77
- };
78
- /**
79
- * Legacy export for backwards compatibility
80
- */
81
- export const RATE_LIMIT_TIERS = TIER_LIMITS;
82
- /**
83
- * Get rate limits for a specific tier
84
- *
85
- * @param tier - The tier name
86
- * @returns Rate limit configuration for all operations
87
- */
88
- export function getTierLimits(tier) {
89
- return TIER_LIMITS[tier] || TIER_LIMITS.standard;
90
- }
91
- /**
92
- * Read rate limit configuration from environment variables
93
- *
94
- * Environment variables:
95
- * - RATE_LIMIT_DEFAULT_TIER: Default tier (standard|premium|unlimited)
96
- * - RATE_LIMIT_FAIL_OPEN: Whether to allow requests when Redis is down (true|false)
97
- * - RATE_LIMIT_STORE_MEMORY: Override store_memory limit
98
- * - RATE_LIMIT_RETRIEVE_MEMORY: Override retrieve_memory limit
99
- * - RATE_LIMIT_LIST_RECENT: Override list_recent limit
100
- * - RATE_LIMIT_GET_STATS: Override get_stats limit
101
- * - RATE_LIMIT_EMERGENCY: Emergency in-memory limit when Redis is down
102
- *
103
- * @returns Rate limit configuration
104
- */
105
- export function getRateLimitConfigFromEnv() {
106
- const defaultTier = (process.env.RATE_LIMIT_DEFAULT_TIER || "standard");
107
- // Security: Default to fail closed (deny requests when Redis is unavailable)
108
- const failOpenEnv = process.env.RATE_LIMIT_FAIL_OPEN;
109
- const failOpen = failOpenEnv === "true";
110
- // Parse custom limits from environment
111
- const customLimits = {};
112
- const storeMemoryLimit = process.env.RATE_LIMIT_STORE_MEMORY;
113
- if (storeMemoryLimit) {
114
- customLimits.store_memory = parseInt(storeMemoryLimit, 10);
115
- }
116
- const retrieveMemoryLimit = process.env.RATE_LIMIT_RETRIEVE_MEMORY;
117
- if (retrieveMemoryLimit) {
118
- customLimits.retrieve_memory = parseInt(retrieveMemoryLimit, 10);
119
- }
120
- const listRecentLimit = process.env.RATE_LIMIT_LIST_RECENT;
121
- if (listRecentLimit) {
122
- customLimits.list_recent = parseInt(listRecentLimit, 10);
123
- }
124
- const getStatsLimit = process.env.RATE_LIMIT_GET_STATS;
125
- if (getStatsLimit) {
126
- customLimits.get_stats = parseInt(getStatsLimit, 10);
127
- }
128
- // Emergency limit for in-memory fallback (very conservative)
129
- const emergencyLimit = parseInt(process.env.RATE_LIMIT_EMERGENCY || "10", 10);
130
- return {
131
- defaultTier,
132
- failOpen,
133
- customLimits: Object.keys(customLimits).length > 0 ? customLimits : undefined,
134
- emergencyLimit,
135
- };
136
- }
137
- /**
138
- * Build rate limit configuration by merging tier defaults with custom limits
139
- *
140
- * @param tier - Base tier
141
- * @param customLimits - Custom limit overrides
142
- * @returns Merged rate limit configuration
143
- */
144
- export function buildRateLimitConfig(tier, customLimits) {
145
- const tierLimits = getTierLimits(tier);
146
- if (!customLimits) {
147
- return tierLimits;
148
- }
149
- // Merge custom limits with tier defaults
150
- const merged = { ...tierLimits };
151
- for (const [operation, maxRequests] of Object.entries(customLimits)) {
152
- if (merged[operation]) {
153
- merged[operation] = {
154
- ...merged[operation],
155
- maxRequests,
156
- };
157
- }
158
- }
159
- return merged;
160
- }
161
- //# sourceMappingURL=rate-limits.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rate-limits.js","sourceRoot":"","sources":["../../src/config/rate-limits.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,WAAW,GAAsD;IAC5E,QAAQ,EAAE;QACR,YAAY,EAAE;YACZ,WAAW,EAAE,GAAG;YAChB,aAAa,EAAE,EAAE;SAClB;QACD,eAAe,EAAE;YACf,WAAW,EAAE,GAAG;YAChB,aAAa,EAAE,EAAE;SAClB;QACD,WAAW,EAAE;YACX,WAAW,EAAE,EAAE;YACf,aAAa,EAAE,EAAE;SAClB;QACD,SAAS,EAAE;YACT,WAAW,EAAE,EAAE;YACf,aAAa,EAAE,EAAE;SAClB;KACF;IACD,OAAO,EAAE;QACP,YAAY,EAAE;YACZ,WAAW,EAAE,GAAG;YAChB,aAAa,EAAE,EAAE;SAClB;QACD,eAAe,EAAE;YACf,WAAW,EAAE,IAAI;YACjB,aAAa,EAAE,EAAE;SAClB;QACD,WAAW,EAAE;YACX,WAAW,EAAE,GAAG;YAChB,aAAa,EAAE,EAAE;SAClB;QACD,SAAS,EAAE;YACT,WAAW,EAAE,GAAG;YAChB,aAAa,EAAE,EAAE;SAClB;KACF;IACD,SAAS,EAAE;QACT,iEAAiE;QACjE,0DAA0D;QAC1D,YAAY,EAAE;YACZ,WAAW,EAAE,OAAO;YACpB,aAAa,EAAE,EAAE;SAClB;QACD,eAAe,EAAE;YACf,WAAW,EAAE,OAAO;YACpB,aAAa,EAAE,EAAE;SAClB;QACD,WAAW,EAAE;YACX,WAAW,EAAE,OAAO;YACpB,aAAa,EAAE,EAAE;SAClB;QACD,SAAS,EAAE;YACT,WAAW,EAAE,OAAO;YACpB,aAAa,EAAE,EAAE;SAClB;KACF;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,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BAAoB,IAAI,IAAI,EACxC,EAAE,CACH,CAAC;IAEF,OAAO;QACL,WAAW;QACX,QAAQ;QACR,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS;QAC7E,cAAc;KACf,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAc,EACd,YAAqC;IAErC,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IAEvC,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,yCAAyC;IACzC,MAAM,MAAM,GAAoC,EAAE,GAAG,UAAU,EAAE,CAAC;IAElE,KAAK,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QACpE,IAAI,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;YACtB,MAAM,CAAC,SAAS,CAAC,GAAG;gBAClB,GAAG,MAAM,CAAC,SAAS,CAAC;gBACpB,WAAW;aACZ,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,52 +0,0 @@
1
- /**
2
- * Consolidation Pipeline - v3.0 Implementation
3
- *
4
- * Nightly process: working → semantic memory transformation.
5
- * Runs at 3 AM, extracts knowledge, applies decay, detects conflicts.
6
- */
7
- import { WorkingMemoryLayer } from '../memory-layers/working-memory.js';
8
- import { SemanticMemoryLayer } from '../memory-layers/semantic-memory.js';
9
- import { SkillLibrary } from '../memory-layers/skill-library.js';
10
- import Database from 'better-sqlite3';
11
- export interface ConsolidationStats {
12
- memoriesProcessed: number;
13
- entitiesExtracted: number;
14
- relationshipsCreated: number;
15
- conflictsDetected: number;
16
- memoriesPruned: number;
17
- skillsExtracted: number;
18
- duration: number;
19
- }
20
- export declare class ConsolidationPipeline {
21
- private workingMemory;
22
- private semanticMemory;
23
- private skillLibrary;
24
- private db;
25
- constructor(workingMemory: WorkingMemoryLayer, semanticMemory: SemanticMemoryLayer, skillLibrary: SkillLibrary, db: Database.Database);
26
- /**
27
- * Run full consolidation cycle
28
- */
29
- consolidate(): Promise<ConsolidationStats>;
30
- /**
31
- * Extract entities and relationships from memory
32
- * Simple keyword-based extraction (will enhance with LLM later)
33
- */
34
- private extractKnowledge;
35
- /**
36
- * Detect simple conflicts (temporal impossibilities, contradictions)
37
- */
38
- private detectConflicts;
39
- /**
40
- * Prune low-value memories
41
- */
42
- private pruneMemories;
43
- /**
44
- * Extract skills from positive interactions
45
- */
46
- private extractSkills;
47
- /**
48
- * Create backup for rollback capability
49
- */
50
- private createBackup;
51
- }
52
- //# sourceMappingURL=pipeline.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/consolidation/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,MAAM,WAAW,kBAAkB;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,cAAc,CAAsB;IAC5C,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,EAAE,CAAoB;gBAG5B,aAAa,EAAE,kBAAkB,EACjC,cAAc,EAAE,mBAAmB,EACnC,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,QAAQ,CAAC,QAAQ;IAQvB;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,kBAAkB,CAAC;IA8DhD;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAuCxB;;OAEG;IACH,OAAO,CAAC,eAAe;IA+CvB;;OAEG;IACH,OAAO,CAAC,aAAa;IAsBrB;;OAEG;IACH,OAAO,CAAC,aAAa;IAwBrB;;OAEG;IACH,OAAO,CAAC,YAAY;CAcrB"}
@@ -1,193 +0,0 @@
1
- /**
2
- * Consolidation Pipeline - v3.0 Implementation
3
- *
4
- * Nightly process: working → semantic memory transformation.
5
- * Runs at 3 AM, extracts knowledge, applies decay, detects conflicts.
6
- */
7
- export class ConsolidationPipeline {
8
- workingMemory;
9
- semanticMemory;
10
- skillLibrary;
11
- db;
12
- constructor(workingMemory, semanticMemory, skillLibrary, db) {
13
- this.workingMemory = workingMemory;
14
- this.semanticMemory = semanticMemory;
15
- this.skillLibrary = skillLibrary;
16
- this.db = db;
17
- }
18
- /**
19
- * Run full consolidation cycle
20
- */
21
- async consolidate() {
22
- const startTime = Date.now();
23
- console.error('[CONSOLIDATION] Starting consolidation cycle...');
24
- const stats = {
25
- memoriesProcessed: 0,
26
- entitiesExtracted: 0,
27
- relationshipsCreated: 0,
28
- conflictsDetected: 0,
29
- memoriesPruned: 0,
30
- skillsExtracted: 0,
31
- duration: 0,
32
- };
33
- try {
34
- // Step 1: Extract from working memory
35
- const recentMemories = await this.workingMemory.getRecent(100);
36
- stats.memoriesProcessed = recentMemories.length;
37
- for (const memory of recentMemories) {
38
- // Extract entities and relationships
39
- const extracted = this.extractKnowledge(memory);
40
- for (const entity of extracted.entities) {
41
- this.semanticMemory.upsertEntity(entity);
42
- stats.entitiesExtracted++;
43
- }
44
- for (const rel of extracted.relationships) {
45
- this.semanticMemory.upsertRelationship(rel);
46
- stats.relationshipsCreated++;
47
- }
48
- }
49
- // Step 2: Apply temporal decay
50
- this.semanticMemory.applyTemporalDecay();
51
- // Step 3: Detect conflicts
52
- stats.conflictsDetected = this.detectConflicts();
53
- // Step 4: Prune low-value memories
54
- stats.memoriesPruned = this.pruneMemories();
55
- // Step 5: Extract skills (simplified)
56
- stats.skillsExtracted = this.extractSkills(recentMemories);
57
- // Step 6: Create backup
58
- this.createBackup();
59
- stats.duration = Date.now() - startTime;
60
- console.error(`[CONSOLIDATION] Complete! Processed ${stats.memoriesProcessed} memories in ${stats.duration}ms`);
61
- console.error(`[CONSOLIDATION] Extracted ${stats.entitiesExtracted} entities, ${stats.relationshipsCreated} relationships`);
62
- console.error(`[CONSOLIDATION] Detected ${stats.conflictsDetected} conflicts, pruned ${stats.memoriesPruned} memories`);
63
- return stats;
64
- }
65
- catch (error) {
66
- console.error('[CONSOLIDATION] Error:', error);
67
- throw error;
68
- }
69
- }
70
- /**
71
- * Extract entities and relationships from memory
72
- * Simple keyword-based extraction (will enhance with LLM later)
73
- */
74
- extractKnowledge(memory) {
75
- const entities = [];
76
- const relationships = [];
77
- // Use pre-extracted entities if available
78
- if (memory.keyEntities && memory.keyEntities.length > 0) {
79
- for (const entityName of memory.keyEntities) {
80
- entities.push({
81
- name: entityName,
82
- type: 'concept',
83
- confidence: 0.8,
84
- });
85
- }
86
- }
87
- // Extract preferences
88
- const prefPatterns = [
89
- /prefer (\w+)/gi,
90
- /like (\w+)/gi,
91
- /favorite is (\w+)/gi,
92
- ];
93
- for (const pattern of prefPatterns) {
94
- const matches = memory.fullText.matchAll(pattern);
95
- for (const match of matches) {
96
- entities.push({
97
- name: match[1],
98
- type: 'preference',
99
- confidence: 0.9,
100
- });
101
- }
102
- }
103
- return { entities, relationships };
104
- }
105
- /**
106
- * Detect simple conflicts (temporal impossibilities, contradictions)
107
- */
108
- detectConflicts() {
109
- let detected = 0;
110
- // Temporal conflicts: same property, overlapping time ranges, different values
111
- const conflicts = this.db.prepare(`
112
- SELECT f1.id as id1, f2.id as id2, f1.property, f1.value as val1, f2.value as val2
113
- FROM facts f1
114
- JOIN facts f2 ON f1.entity_id = f2.entity_id AND f1.property = f2.property
115
- WHERE f1.id < f2.id
116
- AND f1.value != f2.value
117
- AND f1.valid_until IS NULL
118
- AND f2.valid_until IS NULL
119
- `).all();
120
- for (const conflict of conflicts) {
121
- // Check if already flagged
122
- const existing = this.db.prepare('SELECT * FROM conflicts WHERE fact_id_1 = ? AND fact_id_2 = ?').get(conflict.id1, conflict.id2);
123
- if (!existing) {
124
- const conflictId = 'conflict_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);
125
- this.db.prepare(`
126
- INSERT INTO conflicts (id, fact_id_1, fact_id_2, conflict_type, description, severity, resolution_status)
127
- VALUES (?, ?, ?, ?, ?, ?, ?)
128
- `).run(conflictId, conflict.id1, conflict.id2, 'contradiction', `Conflicting values for ${conflict.property}: "${conflict.val1}" vs "${conflict.val2}"`, 'medium', 'flagged');
129
- // Lower confidence on both facts
130
- this.db.prepare('UPDATE facts SET confidence = 0.5 WHERE id = ?').run(conflict.id1);
131
- this.db.prepare('UPDATE facts SET confidence = 0.5 WHERE id = ?').run(conflict.id2);
132
- detected++;
133
- }
134
- }
135
- return detected;
136
- }
137
- /**
138
- * Prune low-value memories
139
- */
140
- pruneMemories() {
141
- // Find relationships to prune (weak relationships with low-access entities)
142
- const toPrune = this.db.prepare(`
143
- SELECT r.id
144
- FROM relationships r
145
- INNER JOIN entities source ON r.source_id = source.id
146
- INNER JOIN entities target ON r.target_id = target.id
147
- WHERE r.strength < 0.05
148
- AND source.access_count < 3
149
- AND target.access_count < 3
150
- `).all();
151
- // Delete them
152
- let deleted = 0;
153
- for (const row of toPrune) {
154
- this.db.prepare('DELETE FROM relationships WHERE id = ?').run(row.id);
155
- deleted++;
156
- }
157
- return deleted;
158
- }
159
- /**
160
- * Extract skills from positive interactions
161
- */
162
- extractSkills(memories) {
163
- let extracted = 0;
164
- for (const memory of memories) {
165
- // Look for repeated patterns
166
- if (memory.topics && memory.topics.includes('analysis')) {
167
- // Check if skill already exists
168
- const existing = this.skillLibrary.search('data analysis', 1);
169
- if (existing.length === 0) {
170
- this.skillLibrary.addSkill({
171
- name: 'Data Analysis',
172
- description: 'Analyze datasets and provide insights',
173
- category: 'analysis',
174
- triggers: ['analyze', 'data', 'insights'],
175
- });
176
- extracted++;
177
- }
178
- }
179
- }
180
- return extracted;
181
- }
182
- /**
183
- * Create backup for rollback capability
184
- */
185
- createBackup() {
186
- const backupId = 'backup_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);
187
- this.db.prepare(`
188
- INSERT INTO backup_metadata (id, backup_type, backup_path, created_at, expires_at)
189
- VALUES (?, ?, ?, ?, ?)
190
- `).run(backupId, 'consolidation', './backups/' + backupId + '.db', new Date().toISOString(), new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString());
191
- }
192
- }
193
- //# sourceMappingURL=pipeline.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/consolidation/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,MAAM,OAAO,qBAAqB;IACxB,aAAa,CAAqB;IAClC,cAAc,CAAsB;IACpC,YAAY,CAAe;IAC3B,EAAE,CAAoB;IAE9B,YACE,aAAiC,EACjC,cAAmC,EACnC,YAA0B,EAC1B,EAAqB;QAErB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW;QACf,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,OAAO,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;QAEjE,MAAM,KAAK,GAAuB;YAChC,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C1C,CAAC,CAAC;oBACH,SAAS,EAAE,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACK,YAAY;QAClB,MAAM,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAExF,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;;;KAGf,CAAC,CAAC,GAAG,CACJ,QAAQ,EACR,eAAe,EACf,YAAY,GAAG,QAAQ,GAAG,KAAK,EAC/B,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EACxB,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAC7D,CAAC;IACJ,CAAC;CACF"}
@@ -1,94 +0,0 @@
1
- /**
2
- * BGE-large Embedding Client
3
- *
4
- * TypeScript client for the BGE-large embedding service.
5
- * Provides methods for generating 1024-dimensional dense embeddings.
6
- */
7
- /**
8
- * Embedding service response
9
- */
10
- export interface EmbeddingResponse {
11
- embeddings: number[][];
12
- dimensions: number;
13
- count: number;
14
- }
15
- /**
16
- * Health check response
17
- */
18
- export interface HealthResponse {
19
- status: string;
20
- model: string;
21
- dimensions: number;
22
- }
23
- /**
24
- * BGE-large embedding client configuration
25
- */
26
- export interface EmbeddingClientConfig {
27
- /** Embedding service URL (default: http://localhost:8000) */
28
- serviceUrl?: string;
29
- /** Request timeout in milliseconds (default: 30000) */
30
- timeout?: number;
31
- /** Maximum retries on failure (default: 3) */
32
- maxRetries?: number;
33
- }
34
- /**
35
- * BGE-large Embedding Client
36
- *
37
- * Communicates with the Python embedding service to generate
38
- * 1024-dimensional dense embeddings using BGE-large-en-v1.5.
39
- */
40
- export declare class EmbeddingClient {
41
- private serviceUrl;
42
- private timeout;
43
- private maxRetries;
44
- constructor(config?: EmbeddingClientConfig);
45
- /**
46
- * Check if the embedding service is healthy
47
- *
48
- * @returns Health status and model information
49
- */
50
- health(): Promise<HealthResponse>;
51
- /**
52
- * Generate embedding for a single text
53
- *
54
- * @param text - Text to embed
55
- * @param normalize - Whether to normalize the embedding (default: true)
56
- * @returns 1024-dimensional embedding vector
57
- */
58
- embed(text: string, normalize?: boolean): Promise<number[]>;
59
- /**
60
- * Generate embeddings for multiple texts
61
- *
62
- * @param texts - Array of texts to embed
63
- * @param normalize - Whether to normalize embeddings (default: true)
64
- * @returns Array of 1024-dimensional embedding vectors
65
- */
66
- embedBatch(texts: string[], normalize?: boolean): Promise<EmbeddingResponse>;
67
- /**
68
- * Generate embeddings with optimized batching
69
- *
70
- * Automatically splits large batches to avoid memory issues
71
- * and timeouts on the embedding service.
72
- *
73
- * @param texts - Array of texts to embed
74
- * @param batchSize - Number of texts per batch (default: 32)
75
- * @returns Array of 1024-dimensional embedding vectors
76
- */
77
- embedLargeBatch(texts: string[], batchSize?: number): Promise<number[][]>;
78
- /**
79
- * Fetch with automatic retry on failure
80
- *
81
- * @param url - URL to fetch
82
- * @param options - Fetch options
83
- * @returns Response
84
- */
85
- private fetchWithRetry;
86
- }
87
- /**
88
- * Factory function to create an embedding client
89
- *
90
- * @param config - Optional configuration
91
- * @returns Embedding client instance
92
- */
93
- export declare function createEmbeddingClient(config?: EmbeddingClientConfig): EmbeddingClient;
94
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/embeddings/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AA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