agentic-qe 2.5.9 → 2.5.10
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 +75 -0
- package/README.md +2 -2
- package/dist/agents/BaseAgent.d.ts +119 -0
- package/dist/agents/BaseAgent.d.ts.map +1 -1
- package/dist/agents/BaseAgent.js +288 -0
- package/dist/agents/BaseAgent.js.map +1 -1
- package/dist/agents/FlakyTestHunterAgent.d.ts +15 -0
- package/dist/agents/FlakyTestHunterAgent.d.ts.map +1 -1
- package/dist/agents/FlakyTestHunterAgent.js +93 -0
- package/dist/agents/FlakyTestHunterAgent.js.map +1 -1
- package/dist/agents/SecurityScannerAgent.d.ts +19 -0
- package/dist/agents/SecurityScannerAgent.d.ts.map +1 -1
- package/dist/agents/SecurityScannerAgent.js +137 -0
- package/dist/agents/SecurityScannerAgent.js.map +1 -1
- package/dist/cli/commands/ruvector/index.d.ts +13 -0
- package/dist/cli/commands/ruvector/index.d.ts.map +1 -0
- package/dist/cli/commands/ruvector/index.js +308 -0
- package/dist/cli/commands/ruvector/index.js.map +1 -0
- package/dist/cli/index.js +5 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/index.d.ts.map +1 -1
- package/dist/cli/init/index.js +11 -0
- package/dist/cli/init/index.js.map +1 -1
- package/dist/core/memory/HNSWVectorMemory.js +1 -1
- package/dist/core/memory/HNSWVectorMemory.js.map +1 -1
- package/dist/mcp/server-instructions.d.ts +1 -1
- package/dist/mcp/server-instructions.d.ts.map +1 -1
- package/dist/mcp/server-instructions.js +1 -1
- package/dist/mcp/server-instructions.js.map +1 -1
- package/dist/memory/RuVectorPatternStore.d.ts +258 -0
- package/dist/memory/RuVectorPatternStore.d.ts.map +1 -0
- package/dist/memory/RuVectorPatternStore.js +525 -0
- package/dist/memory/RuVectorPatternStore.js.map +1 -0
- package/dist/providers/RuVectorPostgresAdapter.d.ts +134 -0
- package/dist/providers/RuVectorPostgresAdapter.d.ts.map +1 -0
- package/dist/providers/RuVectorPostgresAdapter.js +504 -0
- package/dist/providers/RuVectorPostgresAdapter.js.map +1 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +7 -1
- package/dist/providers/index.js.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RuVector Pattern Store - Migration layer for AgentDB to HNSW transition
|
|
3
|
+
*
|
|
4
|
+
* Phase 0 M0.5.5: Dual-write migration strategy with validation
|
|
5
|
+
*
|
|
6
|
+
* Migration phases:
|
|
7
|
+
* 1. DUAL_WRITE: Write to both HNSW (new) and legacy storage
|
|
8
|
+
* 2. DUAL_READ: Read from HNSW but compare with legacy for validation
|
|
9
|
+
* 3. HNSW_ONLY: Read from HNSW only (legacy deprecated)
|
|
10
|
+
*
|
|
11
|
+
* Performance targets:
|
|
12
|
+
* - HNSW search: <1ms p95 (100x+ faster than legacy)
|
|
13
|
+
* - Zero data loss during migration
|
|
14
|
+
* - Reversible at any phase
|
|
15
|
+
*
|
|
16
|
+
* @deprecated AgentDB storage (v2.2.0) - migrate to HNSW
|
|
17
|
+
*/
|
|
18
|
+
import { HNSWPatternStore, QEPattern, IPatternStore, HNSWPatternStoreConfig } from './HNSWPatternStore';
|
|
19
|
+
/**
|
|
20
|
+
* Migration phase configuration
|
|
21
|
+
*/
|
|
22
|
+
export declare enum MigrationPhase {
|
|
23
|
+
/** Write to both stores, read from legacy */
|
|
24
|
+
DUAL_WRITE = "dual_write",
|
|
25
|
+
/** Write to both stores, read from HNSW with comparison */
|
|
26
|
+
DUAL_READ = "dual_read",
|
|
27
|
+
/** Write to HNSW only, read from HNSW only */
|
|
28
|
+
HNSW_ONLY = "hnsw_only"
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Comparison result for validation
|
|
32
|
+
*/
|
|
33
|
+
export interface ComparisonResult {
|
|
34
|
+
timestamp: Date;
|
|
35
|
+
queryEmbedding: number[];
|
|
36
|
+
k: number;
|
|
37
|
+
hnswResults: string[];
|
|
38
|
+
legacyResults: string[];
|
|
39
|
+
hnswLatencyMs: number;
|
|
40
|
+
legacyLatencyMs: number;
|
|
41
|
+
speedupFactor: number;
|
|
42
|
+
overlap: number;
|
|
43
|
+
hnswOnly: string[];
|
|
44
|
+
legacyOnly: string[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Migration metrics for monitoring
|
|
48
|
+
*/
|
|
49
|
+
export interface MigrationMetrics {
|
|
50
|
+
phase: MigrationPhase;
|
|
51
|
+
totalPatterns: number;
|
|
52
|
+
hnswPatterns: number;
|
|
53
|
+
legacyPatterns: number;
|
|
54
|
+
syncedPatterns: number;
|
|
55
|
+
divergedPatterns: number;
|
|
56
|
+
comparisons: number;
|
|
57
|
+
avgSpeedupFactor: number;
|
|
58
|
+
avgOverlap: number;
|
|
59
|
+
errors: number;
|
|
60
|
+
lastComparison?: ComparisonResult;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* RuVector pattern store configuration
|
|
64
|
+
*/
|
|
65
|
+
export interface RuVectorPatternStoreConfig extends HNSWPatternStoreConfig {
|
|
66
|
+
/** Migration phase (default: DUAL_WRITE) */
|
|
67
|
+
migrationPhase?: MigrationPhase;
|
|
68
|
+
/** Legacy storage path for SwarmMemoryManager */
|
|
69
|
+
legacyDbPath?: string;
|
|
70
|
+
/** Enable detailed comparison logging (default: true) */
|
|
71
|
+
enableComparisonLogging?: boolean;
|
|
72
|
+
/** Maximum comparisons to store (default: 100) */
|
|
73
|
+
maxComparisons?: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Pattern store with dual-write migration support
|
|
77
|
+
*
|
|
78
|
+
* Enables gradual migration from legacy SwarmMemoryManager to HNSW-based storage
|
|
79
|
+
* with validation, comparison logging, and rollback capabilities.
|
|
80
|
+
*
|
|
81
|
+
* Usage:
|
|
82
|
+
* ```typescript
|
|
83
|
+
* // Phase 1: Start dual-write
|
|
84
|
+
* const store = new RuVectorPatternStore({
|
|
85
|
+
* migrationPhase: MigrationPhase.DUAL_WRITE,
|
|
86
|
+
* storagePath: './data/hnsw',
|
|
87
|
+
* legacyDbPath: './data/legacy.db'
|
|
88
|
+
* });
|
|
89
|
+
*
|
|
90
|
+
* // Phase 2: Enable dual-read for validation
|
|
91
|
+
* store.setMigrationPhase(MigrationPhase.DUAL_READ);
|
|
92
|
+
* // Monitor metrics: store.getMigrationMetrics()
|
|
93
|
+
*
|
|
94
|
+
* // Phase 3: Switch to HNSW only after validation
|
|
95
|
+
* store.setMigrationPhase(MigrationPhase.HNSW_ONLY);
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare class RuVectorPatternStore implements IPatternStore {
|
|
99
|
+
private hnswStore;
|
|
100
|
+
private legacyStore;
|
|
101
|
+
private migrationPhase;
|
|
102
|
+
private enableComparisonLogging;
|
|
103
|
+
private maxComparisons;
|
|
104
|
+
private comparisons;
|
|
105
|
+
private metrics;
|
|
106
|
+
constructor(config?: RuVectorPatternStoreConfig);
|
|
107
|
+
/**
|
|
108
|
+
* Check if we're in dual-write or dual-read mode
|
|
109
|
+
*/
|
|
110
|
+
private isDualMode;
|
|
111
|
+
/**
|
|
112
|
+
* Store a pattern with dual-write support
|
|
113
|
+
*
|
|
114
|
+
* Behavior by phase:
|
|
115
|
+
* - DUAL_WRITE/DUAL_READ: Write to both HNSW and legacy
|
|
116
|
+
* - HNSW_ONLY: Write to HNSW only
|
|
117
|
+
*
|
|
118
|
+
* @param pattern Pattern to store
|
|
119
|
+
*/
|
|
120
|
+
store(pattern: QEPattern): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Store pattern in legacy SwarmMemoryManager
|
|
123
|
+
*/
|
|
124
|
+
private storeLegacy;
|
|
125
|
+
/**
|
|
126
|
+
* Search for similar patterns with migration support
|
|
127
|
+
*
|
|
128
|
+
* Behavior by phase:
|
|
129
|
+
* - DUAL_WRITE: Read from legacy (safe fallback)
|
|
130
|
+
* - DUAL_READ: Read from HNSW + compare with legacy
|
|
131
|
+
* - HNSW_ONLY: Read from HNSW only
|
|
132
|
+
*
|
|
133
|
+
* @param embedding Query embedding vector
|
|
134
|
+
* @param k Number of nearest neighbors
|
|
135
|
+
* @returns Top-k most similar patterns
|
|
136
|
+
*/
|
|
137
|
+
search(embedding: number[], k: number): Promise<QEPattern[]>;
|
|
138
|
+
/**
|
|
139
|
+
* Search from legacy store (brute-force O(n) comparison)
|
|
140
|
+
*
|
|
141
|
+
* This is the deprecated path - used only during early migration
|
|
142
|
+
*/
|
|
143
|
+
private searchLegacy;
|
|
144
|
+
/**
|
|
145
|
+
* Search with dual-read comparison for validation
|
|
146
|
+
*
|
|
147
|
+
* Reads from HNSW (new) and compares with legacy to validate migration
|
|
148
|
+
*/
|
|
149
|
+
private searchWithComparison;
|
|
150
|
+
/**
|
|
151
|
+
* Log comparison between HNSW and legacy search results
|
|
152
|
+
*/
|
|
153
|
+
private logComparison;
|
|
154
|
+
/**
|
|
155
|
+
* Delete a pattern from both stores during dual-write
|
|
156
|
+
*/
|
|
157
|
+
delete(id: string): Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Get total pattern count
|
|
160
|
+
*/
|
|
161
|
+
count(): Promise<number>;
|
|
162
|
+
/**
|
|
163
|
+
* Clear all patterns from both stores
|
|
164
|
+
*/
|
|
165
|
+
clear(): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Get migration metrics for monitoring
|
|
168
|
+
*
|
|
169
|
+
* @returns Current migration status and performance comparison
|
|
170
|
+
*/
|
|
171
|
+
getMigrationMetrics(): Promise<MigrationMetrics>;
|
|
172
|
+
/**
|
|
173
|
+
* Set migration phase (with validation)
|
|
174
|
+
*
|
|
175
|
+
* Safe transitions:
|
|
176
|
+
* - DUAL_WRITE -> DUAL_READ (start validation)
|
|
177
|
+
* - DUAL_READ -> HNSW_ONLY (complete migration)
|
|
178
|
+
* - DUAL_READ -> DUAL_WRITE (rollback if issues found)
|
|
179
|
+
* - HNSW_ONLY -> DUAL_READ (rollback migration)
|
|
180
|
+
*
|
|
181
|
+
* @param phase New migration phase
|
|
182
|
+
*/
|
|
183
|
+
setMigrationPhase(phase: MigrationPhase): void;
|
|
184
|
+
/**
|
|
185
|
+
* Get current migration phase
|
|
186
|
+
*/
|
|
187
|
+
getMigrationPhase(): MigrationPhase;
|
|
188
|
+
/**
|
|
189
|
+
* Get recent comparisons for analysis
|
|
190
|
+
*/
|
|
191
|
+
getRecentComparisons(limit?: number): ComparisonResult[];
|
|
192
|
+
/**
|
|
193
|
+
* Export comparison data for external analysis
|
|
194
|
+
*/
|
|
195
|
+
exportComparisonData(): ComparisonResult[];
|
|
196
|
+
/**
|
|
197
|
+
* Batch store patterns (delegates to HNSW)
|
|
198
|
+
*/
|
|
199
|
+
storeBatch(patterns: QEPattern[]): Promise<void>;
|
|
200
|
+
/**
|
|
201
|
+
* Get underlying HNSW store (for advanced operations)
|
|
202
|
+
*/
|
|
203
|
+
getHNSWStore(): HNSWPatternStore;
|
|
204
|
+
/**
|
|
205
|
+
* Get statistics from HNSW store
|
|
206
|
+
*/
|
|
207
|
+
getStats(): Promise<{
|
|
208
|
+
totalPatterns: number;
|
|
209
|
+
dimension: number;
|
|
210
|
+
distanceMetric: string;
|
|
211
|
+
memoryEstimateMB: number;
|
|
212
|
+
migrationPhase: MigrationPhase;
|
|
213
|
+
}>;
|
|
214
|
+
/**
|
|
215
|
+
* Save both HNSW and legacy stores to disk
|
|
216
|
+
*/
|
|
217
|
+
save(): Promise<void>;
|
|
218
|
+
/**
|
|
219
|
+
* Load both HNSW and legacy stores from disk
|
|
220
|
+
*/
|
|
221
|
+
load(): Promise<void>;
|
|
222
|
+
/**
|
|
223
|
+
* Verify data integrity between stores
|
|
224
|
+
*
|
|
225
|
+
* Runs a comprehensive check to ensure HNSW and legacy stores are in sync
|
|
226
|
+
* Useful before switching from DUAL_READ to HNSW_ONLY
|
|
227
|
+
*/
|
|
228
|
+
verifyIntegrity(): Promise<{
|
|
229
|
+
inSync: boolean;
|
|
230
|
+
hnswCount: number;
|
|
231
|
+
legacyCount: number;
|
|
232
|
+
sampleChecks: number;
|
|
233
|
+
sampleMatches: number;
|
|
234
|
+
recommendations: string[];
|
|
235
|
+
}>;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Factory function to create pattern store with migration support
|
|
239
|
+
*/
|
|
240
|
+
export declare function createMigrationPatternStore(config?: RuVectorPatternStoreConfig): RuVectorPatternStore;
|
|
241
|
+
/**
|
|
242
|
+
* Migration presets for common scenarios
|
|
243
|
+
*/
|
|
244
|
+
export declare const MigrationPresets: {
|
|
245
|
+
/**
|
|
246
|
+
* Start fresh migration (Phase 1)
|
|
247
|
+
*/
|
|
248
|
+
startMigration: (storagePath: string, legacyDbPath: string) => RuVectorPatternStore;
|
|
249
|
+
/**
|
|
250
|
+
* Enable validation (Phase 2)
|
|
251
|
+
*/
|
|
252
|
+
enableValidation: (storagePath: string, legacyDbPath: string) => RuVectorPatternStore;
|
|
253
|
+
/**
|
|
254
|
+
* Complete migration (Phase 3)
|
|
255
|
+
*/
|
|
256
|
+
completeMigration: (storagePath: string) => RuVectorPatternStore;
|
|
257
|
+
};
|
|
258
|
+
//# sourceMappingURL=RuVectorPatternStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuVectorPatternStore.d.ts","sourceRoot":"","sources":["../../src/memory/RuVectorPatternStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAI5B;;GAEG;AACH,oBAAY,cAAc;IACxB,6CAA6C;IAC7C,UAAU,eAAe;IACzB,2DAA2D;IAC3D,SAAS,cAAc;IACvB,8CAA8C;IAC9C,SAAS,cAAc;CACxB;AAED;;GAEG;AACH,MAAM,W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