agentic-qe 1.6.1 → 1.8.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/.claude/skills/sherlock-review/SKILL.md +786 -0
- package/CHANGELOG.md +651 -0
- package/README.md +52 -8
- package/dist/agents/BaseAgent.d.ts +30 -10
- package/dist/agents/BaseAgent.d.ts.map +1 -1
- package/dist/agents/BaseAgent.js +115 -43
- package/dist/agents/BaseAgent.js.map +1 -1
- package/dist/agents/CoverageAnalyzerAgent.js +2 -2
- package/dist/agents/CoverageAnalyzerAgent.js.map +1 -1
- package/dist/agents/FleetCommanderAgent.d.ts +16 -0
- package/dist/agents/FleetCommanderAgent.d.ts.map +1 -1
- package/dist/agents/FleetCommanderAgent.js +35 -20
- package/dist/agents/FleetCommanderAgent.js.map +1 -1
- package/dist/agents/LearningAgent.d.ts +2 -2
- package/dist/agents/LearningAgent.d.ts.map +1 -1
- package/dist/agents/LearningAgent.js +4 -4
- package/dist/agents/LearningAgent.js.map +1 -1
- package/dist/agents/TestExecutorAgent.d.ts +9 -0
- package/dist/agents/TestExecutorAgent.d.ts.map +1 -1
- package/dist/agents/TestExecutorAgent.js +60 -0
- package/dist/agents/TestExecutorAgent.js.map +1 -1
- package/dist/agents/examples/batchAnalyze.d.ts +252 -0
- package/dist/agents/examples/batchAnalyze.d.ts.map +1 -0
- package/dist/agents/examples/batchAnalyze.js +259 -0
- package/dist/agents/examples/batchAnalyze.js.map +1 -0
- package/dist/agents/examples/batchGenerate.d.ts +153 -0
- package/dist/agents/examples/batchGenerate.d.ts.map +1 -0
- package/dist/agents/examples/batchGenerate.js +166 -0
- package/dist/agents/examples/batchGenerate.js.map +1 -0
- package/dist/agents/generateWithPII.d.ts +128 -0
- package/dist/agents/generateWithPII.d.ts.map +1 -0
- package/dist/agents/generateWithPII.js +175 -0
- package/dist/agents/generateWithPII.js.map +1 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +0 -2
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/lifecycle/AgentLifecycleManager.d.ts +5 -0
- package/dist/agents/lifecycle/AgentLifecycleManager.d.ts.map +1 -1
- package/dist/agents/lifecycle/AgentLifecycleManager.js +10 -0
- package/dist/agents/lifecycle/AgentLifecycleManager.js.map +1 -1
- package/dist/cli/commands/agentdb/learn.d.ts.map +1 -1
- package/dist/cli/commands/agentdb/learn.js +190 -71
- package/dist/cli/commands/agentdb/learn.js.map +1 -1
- package/dist/cli/commands/debug/agent.d.ts.map +1 -1
- package/dist/cli/commands/debug/agent.js +40 -13
- package/dist/cli/commands/debug/agent.js.map +1 -1
- package/dist/cli/commands/debug/diagnostics.js +38 -11
- package/dist/cli/commands/debug/diagnostics.js.map +1 -1
- package/dist/cli/commands/debug/health-check.js +47 -12
- package/dist/cli/commands/debug/health-check.js.map +1 -1
- package/dist/cli/commands/debug/profile.js +7 -7
- package/dist/cli/commands/debug/profile.js.map +1 -1
- package/dist/cli/commands/debug/trace.js +4 -4
- package/dist/cli/commands/debug/trace.js.map +1 -1
- package/dist/cli/commands/debug/troubleshoot.js +41 -27
- package/dist/cli/commands/debug/troubleshoot.js.map +1 -1
- package/dist/cli/commands/init.d.ts +6 -3
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +71 -54
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/learn/index.d.ts +4 -0
- package/dist/cli/commands/learn/index.d.ts.map +1 -1
- package/dist/cli/commands/learn/index.js +57 -0
- package/dist/cli/commands/learn/index.js.map +1 -1
- package/dist/cli/commands/test/clean.d.ts.map +1 -1
- package/dist/cli/commands/test/clean.js +26 -9
- package/dist/cli/commands/test/clean.js.map +1 -1
- package/dist/cli/commands/test/debug.js +6 -7
- package/dist/cli/commands/test/debug.js.map +1 -1
- package/dist/cli/commands/test/diff.js +4 -37
- package/dist/cli/commands/test/diff.js.map +1 -1
- package/dist/cli/commands/test/profile.js +7 -40
- package/dist/cli/commands/test/profile.js.map +1 -1
- package/dist/cli/commands/test/trace.js +4 -37
- package/dist/cli/commands/test/trace.js.map +1 -1
- package/dist/cli/index.js +14 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/core/ArtifactWorkflow.d.ts +4 -0
- package/dist/core/ArtifactWorkflow.d.ts.map +1 -1
- package/dist/core/ArtifactWorkflow.js +34 -13
- package/dist/core/ArtifactWorkflow.js.map +1 -1
- package/dist/core/coordination/BlackboardCoordination.d.ts +4 -0
- package/dist/core/coordination/BlackboardCoordination.d.ts.map +1 -1
- package/dist/core/coordination/BlackboardCoordination.js +28 -22
- package/dist/core/coordination/BlackboardCoordination.js.map +1 -1
- package/dist/core/coordination/ConsensusGating.d.ts +4 -0
- package/dist/core/coordination/ConsensusGating.d.ts.map +1 -1
- package/dist/core/coordination/ConsensusGating.js +25 -18
- package/dist/core/coordination/ConsensusGating.js.map +1 -1
- package/dist/core/memory/AgentDBManager.d.ts +5 -0
- package/dist/core/memory/AgentDBManager.d.ts.map +1 -1
- package/dist/core/memory/AgentDBManager.js +19 -1
- package/dist/core/memory/AgentDBManager.js.map +1 -1
- package/dist/core/memory/AgentDBService.d.ts.map +1 -1
- package/dist/core/memory/AgentDBService.js +6 -3
- package/dist/core/memory/AgentDBService.js.map +1 -1
- package/dist/core/memory/RealAgentDBAdapter.d.ts +8 -0
- package/dist/core/memory/RealAgentDBAdapter.d.ts.map +1 -1
- package/dist/core/memory/RealAgentDBAdapter.js +74 -17
- package/dist/core/memory/RealAgentDBAdapter.js.map +1 -1
- package/dist/core/memory/ReasoningBankAdapter.d.ts +4 -0
- package/dist/core/memory/ReasoningBankAdapter.d.ts.map +1 -1
- package/dist/core/memory/ReasoningBankAdapter.js +20 -0
- package/dist/core/memory/ReasoningBankAdapter.js.map +1 -1
- package/dist/core/memory/SwarmMemoryManager.d.ts +8 -0
- package/dist/core/memory/SwarmMemoryManager.d.ts.map +1 -1
- package/dist/core/memory/SwarmMemoryManager.js +33 -0
- package/dist/core/memory/SwarmMemoryManager.js.map +1 -1
- package/dist/learning/ImprovementLoop.js +2 -2
- package/dist/learning/ImprovementLoop.js.map +1 -1
- package/dist/learning/LearningEngine.d.ts +11 -7
- package/dist/learning/LearningEngine.d.ts.map +1 -1
- package/dist/learning/LearningEngine.js +157 -73
- package/dist/learning/LearningEngine.js.map +1 -1
- package/dist/learning/StateExtractor.d.ts +1 -1
- package/dist/learning/StateExtractor.d.ts.map +1 -1
- package/dist/learning/StateExtractor.js +62 -13
- package/dist/learning/StateExtractor.js.map +1 -1
- package/dist/mcp/handlers/filtered/coverage-analyzer-filtered.d.ts +83 -0
- package/dist/mcp/handlers/filtered/coverage-analyzer-filtered.d.ts.map +1 -0
- package/dist/mcp/handlers/filtered/coverage-analyzer-filtered.js +130 -0
- package/dist/mcp/handlers/filtered/coverage-analyzer-filtered.js.map +1 -0
- package/dist/mcp/handlers/filtered/flaky-detector-filtered.d.ts +58 -0
- package/dist/mcp/handlers/filtered/flaky-detector-filtered.d.ts.map +1 -0
- package/dist/mcp/handlers/filtered/flaky-detector-filtered.js +84 -0
- package/dist/mcp/handlers/filtered/flaky-detector-filtered.js.map +1 -0
- package/dist/mcp/handlers/filtered/index.d.ts +47 -0
- package/dist/mcp/handlers/filtered/index.d.ts.map +1 -0
- package/dist/mcp/handlers/filtered/index.js +63 -0
- package/dist/mcp/handlers/filtered/index.js.map +1 -0
- package/dist/mcp/handlers/filtered/performance-tester-filtered.d.ts +57 -0
- package/dist/mcp/handlers/filtered/performance-tester-filtered.d.ts.map +1 -0
- package/dist/mcp/handlers/filtered/performance-tester-filtered.js +83 -0
- package/dist/mcp/handlers/filtered/performance-tester-filtered.js.map +1 -0
- package/dist/mcp/handlers/filtered/quality-assessor-filtered.d.ts +57 -0
- package/dist/mcp/handlers/filtered/quality-assessor-filtered.d.ts.map +1 -0
- package/dist/mcp/handlers/filtered/quality-assessor-filtered.js +93 -0
- package/dist/mcp/handlers/filtered/quality-assessor-filtered.js.map +1 -0
- package/dist/mcp/handlers/filtered/security-scanner-filtered.d.ts +54 -0
- package/dist/mcp/handlers/filtered/security-scanner-filtered.d.ts.map +1 -0
- package/dist/mcp/handlers/filtered/security-scanner-filtered.js +73 -0
- package/dist/mcp/handlers/filtered/security-scanner-filtered.js.map +1 -0
- package/dist/mcp/handlers/filtered/test-executor-filtered.d.ts +61 -0
- package/dist/mcp/handlers/filtered/test-executor-filtered.d.ts.map +1 -0
- package/dist/mcp/handlers/filtered/test-executor-filtered.js +117 -0
- package/dist/mcp/handlers/filtered/test-executor-filtered.js.map +1 -0
- package/dist/mcp/handlers/phase2/Phase2Tools.js +2 -2
- package/dist/mcp/handlers/phase2/Phase2Tools.js.map +1 -1
- package/dist/mcp/tools/deprecated.d.ts +8 -8
- package/dist/scripts/backup-helper.d.ts +64 -0
- package/dist/scripts/backup-helper.d.ts.map +1 -0
- package/dist/scripts/backup-helper.js +251 -0
- package/dist/scripts/backup-helper.js.map +1 -0
- package/dist/scripts/migrate-with-backup.d.ts +15 -0
- package/dist/scripts/migrate-with-backup.d.ts.map +1 -0
- package/dist/scripts/migrate-with-backup.js +194 -0
- package/dist/scripts/migrate-with-backup.js.map +1 -0
- package/dist/security/pii-tokenization.d.ts +216 -0
- package/dist/security/pii-tokenization.d.ts.map +1 -0
- package/dist/security/pii-tokenization.js +325 -0
- package/dist/security/pii-tokenization.js.map +1 -0
- package/dist/utils/Config.d.ts.map +1 -1
- package/dist/utils/Config.js +14 -5
- package/dist/utils/Config.js.map +1 -1
- package/dist/utils/Database.d.ts.map +1 -1
- package/dist/utils/Database.js +5 -2
- package/dist/utils/Database.js.map +1 -1
- package/dist/utils/EmbeddingGenerator.d.ts +35 -0
- package/dist/utils/EmbeddingGenerator.d.ts.map +1 -0
- package/dist/utils/EmbeddingGenerator.js +72 -0
- package/dist/utils/EmbeddingGenerator.js.map +1 -0
- package/dist/utils/Logger.d.ts +1 -1
- package/dist/utils/Logger.d.ts.map +1 -1
- package/dist/utils/Logger.js +4 -4
- package/dist/utils/Logger.js.map +1 -1
- package/dist/utils/SecurityScanner.js +1 -1
- package/dist/utils/SecurityScanner.js.map +1 -1
- package/dist/utils/batch-operations.d.ts +215 -0
- package/dist/utils/batch-operations.d.ts.map +1 -0
- package/dist/utils/batch-operations.js +266 -0
- package/dist/utils/batch-operations.js.map +1 -0
- package/dist/utils/filtering.d.ts +180 -0
- package/dist/utils/filtering.d.ts.map +1 -0
- package/dist/utils/filtering.js +288 -0
- package/dist/utils/filtering.js.map +1 -0
- package/dist/utils/prompt-cache-examples.d.ts +111 -0
- package/dist/utils/prompt-cache-examples.d.ts.map +1 -0
- package/dist/utils/prompt-cache-examples.js +416 -0
- package/dist/utils/prompt-cache-examples.js.map +1 -0
- package/dist/utils/prompt-cache.d.ts +305 -0
- package/dist/utils/prompt-cache.d.ts.map +1 -0
- package/dist/utils/prompt-cache.js +448 -0
- package/dist/utils/prompt-cache.js.map +1 -0
- package/package.json +6 -3
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Client-Side Data Filtering Layer (QW-1)
|
|
4
|
+
*
|
|
5
|
+
* Processes full datasets locally and returns only top-N items + summary statistics.
|
|
6
|
+
* Reduces output tokens by 95%+ while maintaining complete data analysis.
|
|
7
|
+
*
|
|
8
|
+
* **Performance Impact:**
|
|
9
|
+
* - Coverage analysis: 50,000 → 500 tokens (99% reduction)
|
|
10
|
+
* - Test execution: 30,000 → 800 tokens (97.3% reduction)
|
|
11
|
+
* - Quality assessment: 20,000 → 500 tokens (97.5% reduction)
|
|
12
|
+
*
|
|
13
|
+
* @version 1.0.0
|
|
14
|
+
* @author Agentic QE Team
|
|
15
|
+
* @see docs/planning/mcp-improvement-plan-revised.md (QW-1 section)
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.filterLargeDataset = filterLargeDataset;
|
|
19
|
+
exports.countByPriority = countByPriority;
|
|
20
|
+
exports.calculateMetrics = calculateMetrics;
|
|
21
|
+
exports.calculateCoveragePriority = calculateCoveragePriority;
|
|
22
|
+
exports.calculatePerformancePriority = calculatePerformancePriority;
|
|
23
|
+
exports.calculateQualityPriority = calculateQualityPriority;
|
|
24
|
+
exports.calculateSecurityPriority = calculateSecurityPriority;
|
|
25
|
+
exports.calculateFlakyPriority = calculateFlakyPriority;
|
|
26
|
+
exports.createFilterSummary = createFilterSummary;
|
|
27
|
+
/**
|
|
28
|
+
* Generic function to filter large datasets with priority-based sorting
|
|
29
|
+
*
|
|
30
|
+
* **Algorithm Complexity:** O(n log n) where n = dataset size
|
|
31
|
+
* - Priority filtering: O(n)
|
|
32
|
+
* - Sorting: O(n log n)
|
|
33
|
+
* - Slicing: O(1)
|
|
34
|
+
* - Metrics calculation: O(n)
|
|
35
|
+
*
|
|
36
|
+
* @template T - Type of items in the dataset
|
|
37
|
+
* @param data - Full dataset to filter
|
|
38
|
+
* @param config - Filter configuration
|
|
39
|
+
* @param priorityFn - Function to determine priority level for each item
|
|
40
|
+
* @param sortFn - Optional custom sort function (default: priority-based)
|
|
41
|
+
* @param valueFn - Optional function to extract numeric value for metrics
|
|
42
|
+
* @returns Filtered result with summary, top items, and metrics
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* // Filter coverage gaps by lowest coverage first
|
|
47
|
+
* const result = filterLargeDataset(
|
|
48
|
+
* coverageFiles,
|
|
49
|
+
* { threshold: 80, topN: 10, priorities: ['high', 'medium'] },
|
|
50
|
+
* (file) => file.coverage < 60 ? 'high' : file.coverage < 80 ? 'medium' : 'low',
|
|
51
|
+
* (a, b) => a.coverage - b.coverage, // Sort by worst coverage first
|
|
52
|
+
* (file) => file.coverage
|
|
53
|
+
* );
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
function filterLargeDataset(data, config, priorityFn, sortFn, valueFn) {
|
|
57
|
+
// Input validation
|
|
58
|
+
if (!Array.isArray(data)) {
|
|
59
|
+
throw new Error('Data must be an array');
|
|
60
|
+
}
|
|
61
|
+
if (!priorityFn || typeof priorityFn !== 'function') {
|
|
62
|
+
throw new Error('priorityFn must be a function');
|
|
63
|
+
}
|
|
64
|
+
const topN = config.topN ?? 10;
|
|
65
|
+
const includeMetrics = config.includeMetrics ?? true;
|
|
66
|
+
// Original dataset size
|
|
67
|
+
const originalSize = data.length;
|
|
68
|
+
// Step 1: Priority filtering
|
|
69
|
+
const priorityFiltered = config.priorities
|
|
70
|
+
? data.filter(item => {
|
|
71
|
+
const priority = priorityFn(item);
|
|
72
|
+
return config.priorities.includes(priority);
|
|
73
|
+
})
|
|
74
|
+
: data;
|
|
75
|
+
const filteredSize = priorityFiltered.length;
|
|
76
|
+
// Step 2: Sorting
|
|
77
|
+
const sorted = sortFn
|
|
78
|
+
? [...priorityFiltered].sort(sortFn)
|
|
79
|
+
: [...priorityFiltered].sort((a, b) => {
|
|
80
|
+
// Default priority-based sorting (critical > high > medium > low)
|
|
81
|
+
const priorityOrder = {
|
|
82
|
+
critical: 0,
|
|
83
|
+
high: 1,
|
|
84
|
+
medium: 2,
|
|
85
|
+
low: 3
|
|
86
|
+
};
|
|
87
|
+
return priorityOrder[priorityFn(a)] - priorityOrder[priorityFn(b)];
|
|
88
|
+
});
|
|
89
|
+
// Step 3: Limiting to topN
|
|
90
|
+
const topItems = sorted.slice(0, topN);
|
|
91
|
+
const returnedSize = topItems.length;
|
|
92
|
+
// Step 4: Calculate reduction percentage
|
|
93
|
+
// Assume average item size is 500 tokens, topN items + summary = ~200 tokens
|
|
94
|
+
const estimatedOriginalTokens = originalSize * 500;
|
|
95
|
+
const estimatedReturnedTokens = returnedSize * 50 + 200; // Reduced item size + summary
|
|
96
|
+
const reductionPercent = originalSize > 0
|
|
97
|
+
? ((estimatedOriginalTokens - estimatedReturnedTokens) / estimatedOriginalTokens) * 100
|
|
98
|
+
: 0;
|
|
99
|
+
// Step 5: Metrics aggregation (if enabled)
|
|
100
|
+
const metrics = includeMetrics
|
|
101
|
+
? calculateMetrics(priorityFiltered, priorityFn, valueFn)
|
|
102
|
+
: {
|
|
103
|
+
priorityDistribution: countByPriority(priorityFiltered, priorityFn)
|
|
104
|
+
};
|
|
105
|
+
return {
|
|
106
|
+
summary: {
|
|
107
|
+
total: originalSize,
|
|
108
|
+
filtered: filteredSize,
|
|
109
|
+
returned: returnedSize,
|
|
110
|
+
reductionPercent: Math.round(reductionPercent * 100) / 100
|
|
111
|
+
},
|
|
112
|
+
topItems,
|
|
113
|
+
metrics
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Count items by priority level
|
|
118
|
+
*
|
|
119
|
+
* @param data - Dataset to count
|
|
120
|
+
* @param priorityFn - Function to determine priority level
|
|
121
|
+
* @returns Distribution of items by priority
|
|
122
|
+
*/
|
|
123
|
+
function countByPriority(data, priorityFn) {
|
|
124
|
+
const distribution = {
|
|
125
|
+
critical: 0,
|
|
126
|
+
high: 0,
|
|
127
|
+
medium: 0,
|
|
128
|
+
low: 0
|
|
129
|
+
};
|
|
130
|
+
for (const item of data) {
|
|
131
|
+
const priority = priorityFn(item);
|
|
132
|
+
distribution[priority]++;
|
|
133
|
+
}
|
|
134
|
+
return distribution;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Calculate aggregate statistics from dataset
|
|
138
|
+
*
|
|
139
|
+
* @param data - Dataset to analyze
|
|
140
|
+
* @param priorityFn - Function to determine priority level
|
|
141
|
+
* @param valueFn - Optional function to extract numeric value
|
|
142
|
+
* @returns Aggregated metrics including distribution, average, std dev, min, max
|
|
143
|
+
*/
|
|
144
|
+
function calculateMetrics(data, priorityFn, valueFn) {
|
|
145
|
+
const priorityDistribution = countByPriority(data, priorityFn);
|
|
146
|
+
// If no value function provided, return only distribution
|
|
147
|
+
if (!valueFn) {
|
|
148
|
+
return { priorityDistribution };
|
|
149
|
+
}
|
|
150
|
+
// Calculate numeric statistics
|
|
151
|
+
const values = data.map(valueFn).filter(v => typeof v === 'number' && !isNaN(v));
|
|
152
|
+
if (values.length === 0) {
|
|
153
|
+
return {
|
|
154
|
+
priorityDistribution,
|
|
155
|
+
avgValue: undefined,
|
|
156
|
+
stdDev: undefined,
|
|
157
|
+
min: undefined,
|
|
158
|
+
max: undefined
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
const min = Math.min(...values);
|
|
162
|
+
const max = Math.max(...values);
|
|
163
|
+
const avgValue = values.reduce((sum, val) => sum + val, 0) / values.length;
|
|
164
|
+
// Calculate standard deviation
|
|
165
|
+
const squaredDiffs = values.map(val => Math.pow(val - avgValue, 2));
|
|
166
|
+
const variance = squaredDiffs.reduce((sum, val) => sum + val, 0) / values.length;
|
|
167
|
+
const stdDev = Math.sqrt(variance);
|
|
168
|
+
return {
|
|
169
|
+
priorityDistribution,
|
|
170
|
+
avgValue: Math.round(avgValue * 100) / 100,
|
|
171
|
+
stdDev: Math.round(stdDev * 100) / 100,
|
|
172
|
+
min: Math.round(min * 100) / 100,
|
|
173
|
+
max: Math.round(max * 100) / 100
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Calculate priority level for coverage data
|
|
178
|
+
*
|
|
179
|
+
* @param coverage - Coverage percentage (0-100)
|
|
180
|
+
* @param threshold - Coverage threshold (default: 80)
|
|
181
|
+
* @returns Priority level based on coverage
|
|
182
|
+
*/
|
|
183
|
+
function calculateCoveragePriority(coverage, threshold = 80) {
|
|
184
|
+
if (coverage < threshold * 0.5)
|
|
185
|
+
return 'critical';
|
|
186
|
+
if (coverage < threshold * 0.75)
|
|
187
|
+
return 'high';
|
|
188
|
+
if (coverage < threshold)
|
|
189
|
+
return 'medium';
|
|
190
|
+
return 'low';
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Calculate priority level for performance metrics
|
|
194
|
+
*
|
|
195
|
+
* @param responseTime - Response time in milliseconds
|
|
196
|
+
* @param threshold - Maximum acceptable response time (default: 200ms)
|
|
197
|
+
* @returns Priority level based on response time
|
|
198
|
+
*/
|
|
199
|
+
function calculatePerformancePriority(responseTime, threshold = 200) {
|
|
200
|
+
if (responseTime > threshold * 5)
|
|
201
|
+
return 'critical';
|
|
202
|
+
if (responseTime > threshold * 2.5)
|
|
203
|
+
return 'high';
|
|
204
|
+
if (responseTime > threshold)
|
|
205
|
+
return 'medium';
|
|
206
|
+
return 'low';
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Calculate priority level for quality scores
|
|
210
|
+
*
|
|
211
|
+
* @param score - Quality score (0-100)
|
|
212
|
+
* @param threshold - Minimum acceptable score (default: 70)
|
|
213
|
+
* @returns Priority level based on quality score
|
|
214
|
+
*/
|
|
215
|
+
function calculateQualityPriority(score, threshold = 70) {
|
|
216
|
+
if (score < threshold * 0.5)
|
|
217
|
+
return 'critical';
|
|
218
|
+
if (score < threshold * 0.75)
|
|
219
|
+
return 'high';
|
|
220
|
+
if (score < threshold)
|
|
221
|
+
return 'medium';
|
|
222
|
+
return 'low';
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Calculate priority level for security vulnerabilities
|
|
226
|
+
*
|
|
227
|
+
* @param severity - Vulnerability severity (critical, high, medium, low)
|
|
228
|
+
* @returns Priority level matching severity
|
|
229
|
+
*/
|
|
230
|
+
function calculateSecurityPriority(severity) {
|
|
231
|
+
const normalized = severity.toLowerCase();
|
|
232
|
+
if (normalized === 'critical')
|
|
233
|
+
return 'critical';
|
|
234
|
+
if (normalized === 'high')
|
|
235
|
+
return 'high';
|
|
236
|
+
if (normalized === 'medium')
|
|
237
|
+
return 'medium';
|
|
238
|
+
return 'low';
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Calculate priority level for flaky tests
|
|
242
|
+
*
|
|
243
|
+
* @param flakyRate - Flaky test rate percentage (0-100)
|
|
244
|
+
* @returns Priority level based on flakiness
|
|
245
|
+
*/
|
|
246
|
+
function calculateFlakyPriority(flakyRate) {
|
|
247
|
+
if (flakyRate > 50)
|
|
248
|
+
return 'critical';
|
|
249
|
+
if (flakyRate > 25)
|
|
250
|
+
return 'high';
|
|
251
|
+
if (flakyRate > 10)
|
|
252
|
+
return 'medium';
|
|
253
|
+
return 'low';
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Create a summary string for filtered results
|
|
257
|
+
*
|
|
258
|
+
* @param result - Filter result
|
|
259
|
+
* @param entityName - Name of the entity type (e.g., 'files', 'tests', 'issues')
|
|
260
|
+
* @returns Human-readable summary
|
|
261
|
+
*/
|
|
262
|
+
function createFilterSummary(result, entityName = 'items') {
|
|
263
|
+
const { summary, metrics } = result;
|
|
264
|
+
const { total, filtered, returned, reductionPercent } = summary;
|
|
265
|
+
const lines = [
|
|
266
|
+
`Analyzed ${total} ${entityName}`,
|
|
267
|
+
`Filtered to ${filtered} ${entityName} matching criteria`,
|
|
268
|
+
`Returned top ${returned} ${entityName}`,
|
|
269
|
+
`Token reduction: ${reductionPercent.toFixed(1)}%`
|
|
270
|
+
];
|
|
271
|
+
// Add priority distribution
|
|
272
|
+
const { priorityDistribution } = metrics;
|
|
273
|
+
const priorityCounts = [
|
|
274
|
+
priorityDistribution.critical > 0 ? `${priorityDistribution.critical} critical` : null,
|
|
275
|
+
priorityDistribution.high > 0 ? `${priorityDistribution.high} high` : null,
|
|
276
|
+
priorityDistribution.medium > 0 ? `${priorityDistribution.medium} medium` : null,
|
|
277
|
+
priorityDistribution.low > 0 ? `${priorityDistribution.low} low` : null
|
|
278
|
+
].filter(Boolean);
|
|
279
|
+
if (priorityCounts.length > 0) {
|
|
280
|
+
lines.push(`Priority distribution: ${priorityCounts.join(', ')}`);
|
|
281
|
+
}
|
|
282
|
+
// Add numeric metrics if available
|
|
283
|
+
if (metrics.avgValue !== undefined) {
|
|
284
|
+
lines.push(`Average: ${metrics.avgValue.toFixed(2)}, StdDev: ${metrics.stdDev?.toFixed(2)}, Range: ${metrics.min?.toFixed(2)}-${metrics.max?.toFixed(2)}`);
|
|
285
|
+
}
|
|
286
|
+
return lines.join('\n');
|
|
287
|
+
}
|
|
288
|
+
//# sourceMappingURL=filtering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filtering.js","sourceRoot":"","sources":["../../src/utils/filtering.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AA+GH,gDA2EC;AASD,0CAiBC;AAUD,4CAyCC;AASD,8DAKC;AASD,oEAKC;AASD,4DAKC;AAQD,8DAMC;AAQD,wDAKC;AASD,kDA8BC;AAjSD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,SAAgB,kBAAkB,CAChC,IAAS,EACT,MAAoB,EACpB,UAAsC,EACtC,MAA+B,EAC/B,OAA6B;IAE7B,mBAAmB;IACnB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,CAAC,UAAU,IAAI,OAAO,UAAU,KAAK,UAAU,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;IAC/B,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,IAAI,CAAC;IAErD,wBAAwB;IACxB,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;IAEjC,6BAA6B;IAC7B,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU;QACxC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YACjB,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;YAClC,OAAO,MAAM,CAAC,UAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC/C,CAAC,CAAC;QACJ,CAAC,CAAC,IAAI,CAAC;IAET,MAAM,YAAY,GAAG,gBAAgB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AO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,YAAY,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,YAAY,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC7J,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt Cache Integration Examples (CO-1)
|
|
3
|
+
*
|
|
4
|
+
* Demonstrates how to integrate PromptCacheManager with QE agents:
|
|
5
|
+
* - qe-test-generator
|
|
6
|
+
* - qe-coverage-analyzer
|
|
7
|
+
* - qe-security-scanner
|
|
8
|
+
*
|
|
9
|
+
* These examples show:
|
|
10
|
+
* - Proper system prompt caching
|
|
11
|
+
* - Project context caching
|
|
12
|
+
* - Cache statistics tracking
|
|
13
|
+
* - Cost savings monitoring
|
|
14
|
+
*
|
|
15
|
+
* @module utils/prompt-cache-examples
|
|
16
|
+
*/
|
|
17
|
+
import { PromptCacheManager } from './prompt-cache';
|
|
18
|
+
/**
|
|
19
|
+
* Example: Test Generator with Prompt Caching
|
|
20
|
+
*
|
|
21
|
+
* Demonstrates caching system prompt and project context for test generation.
|
|
22
|
+
*/
|
|
23
|
+
export declare function generateTestsWithCache(params: {
|
|
24
|
+
apiKey: string;
|
|
25
|
+
sourceFile: string;
|
|
26
|
+
sourceCode: string;
|
|
27
|
+
framework: 'jest' | 'vitest';
|
|
28
|
+
projectStructure: any;
|
|
29
|
+
guidelines: string;
|
|
30
|
+
}): Promise<{
|
|
31
|
+
testCode: string;
|
|
32
|
+
cacheStats: any;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Example: Coverage Analyzer with Prompt Caching
|
|
36
|
+
*
|
|
37
|
+
* Demonstrates caching for coverage analysis with large coverage reports.
|
|
38
|
+
*/
|
|
39
|
+
export declare function analyzeCoverageWithCache(params: {
|
|
40
|
+
apiKey: string;
|
|
41
|
+
coverageData: any;
|
|
42
|
+
projectMetadata: {
|
|
43
|
+
name: string;
|
|
44
|
+
threshold: number;
|
|
45
|
+
criticalPaths: string[];
|
|
46
|
+
};
|
|
47
|
+
}): Promise<{
|
|
48
|
+
analysis: any;
|
|
49
|
+
cacheStats: any;
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Example: Security Scanner with Prompt Caching
|
|
53
|
+
*
|
|
54
|
+
* Demonstrates caching for security scans with vulnerability patterns.
|
|
55
|
+
*/
|
|
56
|
+
export declare function scanSecurityWithCache(params: {
|
|
57
|
+
apiKey: string;
|
|
58
|
+
sourceCode: string;
|
|
59
|
+
fileName: string;
|
|
60
|
+
securityRules: string[];
|
|
61
|
+
}): Promise<{
|
|
62
|
+
findings: any;
|
|
63
|
+
cacheStats: any;
|
|
64
|
+
}>;
|
|
65
|
+
/**
|
|
66
|
+
* Example: Batch Test Generation with Cache Monitoring
|
|
67
|
+
*
|
|
68
|
+
* Demonstrates how cache performance improves over multiple calls.
|
|
69
|
+
*/
|
|
70
|
+
export declare function batchGenerateTestsWithCacheMonitoring(params: {
|
|
71
|
+
apiKey: string;
|
|
72
|
+
files: Array<{
|
|
73
|
+
path: string;
|
|
74
|
+
content: string;
|
|
75
|
+
}>;
|
|
76
|
+
framework: 'jest' | 'vitest';
|
|
77
|
+
projectContext: any;
|
|
78
|
+
}): Promise<{
|
|
79
|
+
results: Array<{
|
|
80
|
+
file: string;
|
|
81
|
+
testCode: string;
|
|
82
|
+
}>;
|
|
83
|
+
finalStats: {
|
|
84
|
+
hitRate: string;
|
|
85
|
+
costSavings: string;
|
|
86
|
+
totalHits: number;
|
|
87
|
+
totalMisses: number;
|
|
88
|
+
breakEvenAnalysis: {
|
|
89
|
+
hitsNeeded: number;
|
|
90
|
+
actualHits: number;
|
|
91
|
+
metBreakEven: boolean;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* Example: Periodic Cache Maintenance
|
|
97
|
+
*
|
|
98
|
+
* Demonstrates how to set up periodic cache pruning in a long-running service.
|
|
99
|
+
*/
|
|
100
|
+
export declare function setupCacheMaintenance(cacheManager: PromptCacheManager): {
|
|
101
|
+
stop: () => void;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Example: Daily Statistics Reset
|
|
105
|
+
*
|
|
106
|
+
* Demonstrates how to reset statistics at the start of each day for daily reporting.
|
|
107
|
+
*/
|
|
108
|
+
export declare function setupDailyStatsReset(cacheManager: PromptCacheManager): {
|
|
109
|
+
stop: () => void;
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=prompt-cache-examples.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-cache-examples.d.ts","sourceRoot":"","sources":["../../src/utils/prompt-cache-examples.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAuGpD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC7B,gBAAgB,EAAE,GAAG,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,GAAG,CAAC;CACjB,CAAC,CA2DD;AAED;;;;GAIG;AACH,wBAAsB,wBAAwB,CAAC,MAAM,EAAE;IACrD,MAAM,EAAE,M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