agentic-qe 2.2.0 → 2.2.2
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/agents/qe-security-scanner.md +26 -0
- package/.claude/skills/agentic-quality-engineering/SKILL.md +4 -4
- package/.claude/skills/cicd-pipeline-qe-orchestrator/README.md +14 -11
- package/.claude/skills/skills-manifest.json +2 -2
- package/CHANGELOG.md +75 -0
- package/README.md +92 -214
- package/dist/agents/BaseAgent.d.ts +5 -1
- package/dist/agents/BaseAgent.d.ts.map +1 -1
- package/dist/agents/BaseAgent.js +32 -17
- package/dist/agents/BaseAgent.js.map +1 -1
- package/dist/agents/index.js +3 -3
- package/dist/agents/index.js.map +1 -1
- package/dist/cli/commands/improve/index.d.ts +8 -1
- package/dist/cli/commands/improve/index.d.ts.map +1 -1
- package/dist/cli/commands/improve/index.js +18 -16
- package/dist/cli/commands/improve/index.js.map +1 -1
- package/dist/cli/commands/learn/index.d.ts +10 -2
- package/dist/cli/commands/learn/index.d.ts.map +1 -1
- package/dist/cli/commands/learn/index.js +99 -63
- package/dist/cli/commands/learn/index.js.map +1 -1
- package/dist/cli/commands/patterns/index.d.ts +8 -1
- package/dist/cli/commands/patterns/index.d.ts.map +1 -1
- package/dist/cli/commands/patterns/index.js +79 -45
- package/dist/cli/commands/patterns/index.js.map +1 -1
- package/dist/cli/commands/routing/index.d.ts +5 -0
- package/dist/cli/commands/routing/index.d.ts.map +1 -1
- package/dist/cli/commands/routing/index.js +11 -10
- package/dist/cli/commands/routing/index.js.map +1 -1
- package/dist/cli/init/agents.d.ts +1 -1
- package/dist/cli/init/agents.js +2 -2
- package/dist/cli/init/database-init.d.ts +7 -0
- package/dist/cli/init/database-init.d.ts.map +1 -1
- package/dist/cli/init/database-init.js +29 -48
- package/dist/cli/init/database-init.js.map +1 -1
- package/dist/core/memory/HNSWVectorMemory.d.ts +261 -0
- package/dist/core/memory/HNSWVectorMemory.d.ts.map +1 -0
- package/dist/core/memory/HNSWVectorMemory.js +647 -0
- package/dist/core/memory/HNSWVectorMemory.js.map +1 -0
- package/dist/core/memory/SwarmMemoryManager.d.ts +7 -0
- package/dist/core/memory/SwarmMemoryManager.d.ts.map +1 -1
- package/dist/core/memory/SwarmMemoryManager.js +9 -0
- package/dist/core/memory/SwarmMemoryManager.js.map +1 -1
- package/dist/core/memory/index.d.ts +2 -0
- package/dist/core/memory/index.d.ts.map +1 -1
- package/dist/core/memory/index.js +11 -1
- package/dist/core/memory/index.js.map +1 -1
- package/dist/learning/ExplainableLearning.d.ts +191 -0
- package/dist/learning/ExplainableLearning.d.ts.map +1 -0
- package/dist/learning/ExplainableLearning.js +441 -0
- package/dist/learning/ExplainableLearning.js.map +1 -0
- package/dist/learning/GossipPatternSharingProtocol.d.ts +228 -0
- package/dist/learning/GossipPatternSharingProtocol.d.ts.map +1 -0
- package/dist/learning/GossipPatternSharingProtocol.js +590 -0
- package/dist/learning/GossipPatternSharingProtocol.js.map +1 -0
- package/dist/learning/LearningEngine.d.ts +4 -4
- package/dist/learning/LearningEngine.d.ts.map +1 -1
- package/dist/learning/LearningEngine.js +20 -13
- package/dist/learning/LearningEngine.js.map +1 -1
- package/dist/learning/PerformanceOptimizer.d.ts +268 -0
- package/dist/learning/PerformanceOptimizer.d.ts.map +1 -0
- package/dist/learning/PerformanceOptimizer.js +552 -0
- package/dist/learning/PerformanceOptimizer.js.map +1 -0
- package/dist/learning/PrivacyManager.d.ts +197 -0
- package/dist/learning/PrivacyManager.d.ts.map +1 -0
- package/dist/learning/PrivacyManager.js +551 -0
- package/dist/learning/PrivacyManager.js.map +1 -0
- package/dist/learning/TransferLearningManager.d.ts +212 -0
- package/dist/learning/TransferLearningManager.d.ts.map +1 -0
- package/dist/learning/TransferLearningManager.js +497 -0
- package/dist/learning/TransferLearningManager.js.map +1 -0
- package/dist/learning/algorithms/MAMLMetaLearner.d.ts +218 -0
- package/dist/learning/algorithms/MAMLMetaLearner.d.ts.map +1 -0
- package/dist/learning/algorithms/MAMLMetaLearner.js +532 -0
- package/dist/learning/algorithms/MAMLMetaLearner.js.map +1 -0
- package/dist/learning/algorithms/index.d.ts +4 -1
- package/dist/learning/algorithms/index.d.ts.map +1 -1
- package/dist/learning/algorithms/index.js +7 -1
- package/dist/learning/algorithms/index.js.map +1 -1
- package/dist/learning/index.d.ts +8 -0
- package/dist/learning/index.d.ts.map +1 -1
- package/dist/learning/index.js +17 -1
- package/dist/learning/index.js.map +1 -1
- package/dist/mcp/server-instructions.d.ts +1 -1
- package/dist/mcp/server-instructions.js +1 -1
- package/dist/providers/HybridRouter.d.ts +217 -0
- package/dist/providers/HybridRouter.d.ts.map +1 -0
- package/dist/providers/HybridRouter.js +679 -0
- package/dist/providers/HybridRouter.js.map +1 -0
- package/dist/providers/index.d.ts +1 -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/dist/telemetry/LearningTelemetry.d.ts +190 -0
- package/dist/telemetry/LearningTelemetry.d.ts.map +1 -0
- package/dist/telemetry/LearningTelemetry.js +403 -0
- package/dist/telemetry/LearningTelemetry.js.map +1 -0
- package/dist/telemetry/index.d.ts +1 -0
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +20 -2
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/instrumentation/agent.d.ts +1 -1
- package/dist/telemetry/instrumentation/agent.js +1 -1
- package/dist/telemetry/instrumentation/index.d.ts +1 -1
- package/dist/telemetry/instrumentation/index.js +1 -1
- package/dist/utils/math.d.ts +11 -0
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/math.js +16 -0
- package/dist/utils/math.js.map +1 -0
- package/docs/reference/agents.md +1 -1
- package/docs/reference/skills.md +3 -3
- package/docs/reference/usage.md +4 -4
- package/package.json +14 -1
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ExplainableLearning - Explainable AI for Reinforcement Learning Decisions
|
|
4
|
+
*
|
|
5
|
+
* Provides human-readable explanations for RL agent decisions, tracking:
|
|
6
|
+
* - Action selection rationale (Q-values, exploration vs exploitation)
|
|
7
|
+
* - Confidence scores based on experience history
|
|
8
|
+
* - Contributing experiences that influenced decisions
|
|
9
|
+
* - Decision factors and alternative actions
|
|
10
|
+
*
|
|
11
|
+
* Supports transparency and trust in agent decision-making for issue #118
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.ExplainableLearning = void 0;
|
|
15
|
+
const Logger_1 = require("../utils/Logger");
|
|
16
|
+
/**
|
|
17
|
+
* ExplainableLearning - Generates explanations for RL decisions
|
|
18
|
+
*/
|
|
19
|
+
class ExplainableLearning {
|
|
20
|
+
constructor() {
|
|
21
|
+
this.logger = Logger_1.Logger.getInstance();
|
|
22
|
+
this.logger.info('ExplainableLearning initialized');
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Generate explanation for action selection
|
|
26
|
+
*
|
|
27
|
+
* @param state - Current task state
|
|
28
|
+
* @param selectedAction - The action that was selected
|
|
29
|
+
* @param availableActions - All available actions
|
|
30
|
+
* @param qValues - Q-values for state-action pairs
|
|
31
|
+
* @param explorationRate - Current exploration rate
|
|
32
|
+
* @param experiences - Historical experiences for this agent
|
|
33
|
+
* @param wasExploration - Whether this was an exploration decision
|
|
34
|
+
* @returns Complete action explanation
|
|
35
|
+
*/
|
|
36
|
+
explainAction(state, selectedAction, availableActions, qValues, explorationRate, experiences, wasExploration) {
|
|
37
|
+
const selectedActionKey = this.encodeAction(selectedAction);
|
|
38
|
+
const selectedQValue = qValues.get(selectedActionKey) ?? 0;
|
|
39
|
+
// Determine decision type
|
|
40
|
+
const decisionType = wasExploration ? 'exploration' : 'exploitation';
|
|
41
|
+
// Calculate confidence based on experience
|
|
42
|
+
const confidence = this.calculateConfidence(state, selectedAction, experiences);
|
|
43
|
+
// Generate reasoning
|
|
44
|
+
const reasoning = this.generateReasoning(decisionType, selectedQValue, confidence, explorationRate, availableActions.length, experiences);
|
|
45
|
+
// Identify alternatives
|
|
46
|
+
const alternatives = this.identifyAlternatives(selectedAction, availableActions, qValues, experiences, decisionType);
|
|
47
|
+
// Find contributing experiences
|
|
48
|
+
const contributingExperiences = this.findContributingExperiences(state, selectedAction, experiences);
|
|
49
|
+
// Analyze decision factors
|
|
50
|
+
const decisionFactors = this.analyzeDecisionFactors(state, selectedAction, selectedQValue, explorationRate, confidence, wasExploration);
|
|
51
|
+
return {
|
|
52
|
+
selectedAction,
|
|
53
|
+
decisionType,
|
|
54
|
+
qValue: selectedQValue,
|
|
55
|
+
confidence,
|
|
56
|
+
reasoning,
|
|
57
|
+
alternatives,
|
|
58
|
+
contributingExperiences,
|
|
59
|
+
decisionFactors,
|
|
60
|
+
timestamp: new Date()
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Calculate confidence score based on experience history
|
|
65
|
+
* Higher confidence when:
|
|
66
|
+
* - More experiences with similar states
|
|
67
|
+
* - Higher success rate
|
|
68
|
+
* - More recent positive experiences
|
|
69
|
+
*/
|
|
70
|
+
calculateConfidence(state, action, experiences) {
|
|
71
|
+
const stats = this.getExperienceStats(state, action, experiences);
|
|
72
|
+
if (stats.totalCount === 0) {
|
|
73
|
+
return 0.1; // Low confidence with no experience
|
|
74
|
+
}
|
|
75
|
+
// Base confidence from experience count (logarithmic scale)
|
|
76
|
+
const experienceConfidence = Math.min(0.4, Math.log10(stats.totalCount + 1) / 2);
|
|
77
|
+
// Success rate confidence
|
|
78
|
+
const successConfidence = stats.successCount > 0
|
|
79
|
+
? (stats.successCount / stats.totalCount) * 0.3
|
|
80
|
+
: 0;
|
|
81
|
+
// Recent performance confidence
|
|
82
|
+
const recentConfidence = Math.max(0, stats.recentPerformance) * 0.3;
|
|
83
|
+
return Math.min(0.95, experienceConfidence + successConfidence + recentConfidence);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get experience statistics for state-action pair
|
|
87
|
+
*/
|
|
88
|
+
getExperienceStats(state, action, experiences) {
|
|
89
|
+
const stateKey = this.encodeState(state);
|
|
90
|
+
const actionKey = this.encodeAction(action);
|
|
91
|
+
// Find similar experiences
|
|
92
|
+
const similarExperiences = experiences.filter(exp => {
|
|
93
|
+
const expStateKey = this.encodeState(exp.state);
|
|
94
|
+
const expActionKey = this.encodeAction(exp.action);
|
|
95
|
+
// Exact match for now (could use similarity threshold)
|
|
96
|
+
return expStateKey === stateKey && expActionKey === actionKey;
|
|
97
|
+
});
|
|
98
|
+
const totalCount = similarExperiences.length;
|
|
99
|
+
const successCount = similarExperiences.filter(exp => exp.reward > 0).length;
|
|
100
|
+
const averageReward = totalCount > 0
|
|
101
|
+
? similarExperiences.reduce((sum, exp) => sum + exp.reward, 0) / totalCount
|
|
102
|
+
: 0;
|
|
103
|
+
// Recent performance (last 10 experiences)
|
|
104
|
+
const recentExperiences = similarExperiences.slice(-10);
|
|
105
|
+
const recentPerformance = recentExperiences.length > 0
|
|
106
|
+
? recentExperiences.reduce((sum, exp) => sum + exp.reward, 0) / recentExperiences.length
|
|
107
|
+
: 0;
|
|
108
|
+
return {
|
|
109
|
+
totalCount,
|
|
110
|
+
successCount,
|
|
111
|
+
averageReward,
|
|
112
|
+
recentPerformance
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Generate human-readable reasoning
|
|
117
|
+
*/
|
|
118
|
+
generateReasoning(decisionType, qValue, confidence, explorationRate, numActions, experiences) {
|
|
119
|
+
if (decisionType === 'exploration') {
|
|
120
|
+
const explorationPercent = (explorationRate * 100).toFixed(1);
|
|
121
|
+
return `Explored this action (confidence: ${confidence.toFixed(2)}) to gather more information. ` +
|
|
122
|
+
`Current exploration rate is ${explorationPercent}%, balancing learning with exploitation.`;
|
|
123
|
+
}
|
|
124
|
+
// Exploitation
|
|
125
|
+
const qValueFormatted = qValue.toFixed(3);
|
|
126
|
+
const confidencePercent = (confidence * 100).toFixed(0);
|
|
127
|
+
const experienceCount = experiences.length;
|
|
128
|
+
if (qValue > 0.5) {
|
|
129
|
+
return `Selected action with highest Q-value (${qValueFormatted}) among ${numActions} alternatives. ` +
|
|
130
|
+
`High confidence (${confidencePercent}%) based on ${experienceCount} past experiences with strong positive results.`;
|
|
131
|
+
}
|
|
132
|
+
else if (qValue > 0) {
|
|
133
|
+
return `Selected action with Q-value ${qValueFormatted} (moderate positive expectation). ` +
|
|
134
|
+
`Medium confidence (${confidencePercent}%) from ${experienceCount} experiences. More data will improve decision quality.`;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
return `Selected best available action (Q-value: ${qValueFormatted}) among ${numActions} options. ` +
|
|
138
|
+
`Lower confidence (${confidencePercent}%) suggests limited experience in this state.`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Identify alternative actions and explain why they weren't selected
|
|
143
|
+
*/
|
|
144
|
+
identifyAlternatives(selectedAction, availableActions, qValues, experiences, decisionType) {
|
|
145
|
+
const selectedActionKey = this.encodeAction(selectedAction);
|
|
146
|
+
const alternatives = [];
|
|
147
|
+
for (const action of availableActions) {
|
|
148
|
+
const actionKey = this.encodeAction(action);
|
|
149
|
+
// Skip the selected action
|
|
150
|
+
if (actionKey === selectedActionKey) {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
const qValue = qValues.get(actionKey) ?? 0;
|
|
154
|
+
const confidence = this.calculateConfidence({ taskComplexity: 0, requiredCapabilities: [], contextFeatures: {}, previousAttempts: 0, availableResources: 1 }, action, experiences);
|
|
155
|
+
// Determine why it wasn't selected
|
|
156
|
+
let reason;
|
|
157
|
+
if (decisionType === 'exploration') {
|
|
158
|
+
reason = 'Random exploration selected different action';
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
const selectedQValue = qValues.get(selectedActionKey) ?? 0;
|
|
162
|
+
if (qValue < selectedQValue) {
|
|
163
|
+
reason = `Lower Q-value (${qValue.toFixed(3)} vs ${selectedQValue.toFixed(3)})`;
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
reason = 'Similar Q-value but other action selected during exploitation';
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
alternatives.push({
|
|
170
|
+
action,
|
|
171
|
+
qValue,
|
|
172
|
+
confidence,
|
|
173
|
+
reason
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
// Sort by Q-value descending
|
|
177
|
+
alternatives.sort((a, b) => b.qValue - a.qValue);
|
|
178
|
+
// Return top 3 alternatives
|
|
179
|
+
return alternatives.slice(0, 3);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Find experiences that contributed to this decision
|
|
183
|
+
*/
|
|
184
|
+
findContributingExperiences(state, action, experiences) {
|
|
185
|
+
const stateKey = this.encodeState(state);
|
|
186
|
+
const actionKey = this.encodeAction(action);
|
|
187
|
+
const contributingExps = [];
|
|
188
|
+
for (const exp of experiences) {
|
|
189
|
+
const expStateKey = this.encodeState(exp.state);
|
|
190
|
+
const expActionKey = this.encodeAction(exp.action);
|
|
191
|
+
// Calculate similarity
|
|
192
|
+
const similarity = this.calculateStateSimilarity(state, exp.state);
|
|
193
|
+
// Include if same action and similar state
|
|
194
|
+
if (expActionKey === actionKey && similarity > 0.5) {
|
|
195
|
+
contributingExps.push({
|
|
196
|
+
experienceId: exp.taskId,
|
|
197
|
+
taskType: exp.taskType,
|
|
198
|
+
reward: exp.reward,
|
|
199
|
+
similarity,
|
|
200
|
+
timestamp: exp.timestamp
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// Sort by similarity and recency
|
|
205
|
+
contributingExps.sort((a, b) => {
|
|
206
|
+
const similarityDiff = b.similarity - a.similarity;
|
|
207
|
+
if (Math.abs(similarityDiff) > 0.1) {
|
|
208
|
+
return similarityDiff;
|
|
209
|
+
}
|
|
210
|
+
return b.timestamp.getTime() - a.timestamp.getTime();
|
|
211
|
+
});
|
|
212
|
+
// Return top 5
|
|
213
|
+
return contributingExps.slice(0, 5);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Calculate similarity between two states (0-1)
|
|
217
|
+
*/
|
|
218
|
+
calculateStateSimilarity(state1, state2) {
|
|
219
|
+
let similarity = 0;
|
|
220
|
+
let factors = 0;
|
|
221
|
+
// Task complexity similarity
|
|
222
|
+
similarity += 1 - Math.abs(state1.taskComplexity - state2.taskComplexity);
|
|
223
|
+
factors++;
|
|
224
|
+
// Available resources similarity
|
|
225
|
+
similarity += 1 - Math.abs(state1.availableResources - state2.availableResources);
|
|
226
|
+
factors++;
|
|
227
|
+
// Previous attempts similarity
|
|
228
|
+
const attemptDiff = Math.abs(state1.previousAttempts - state2.previousAttempts);
|
|
229
|
+
similarity += Math.max(0, 1 - attemptDiff / 5);
|
|
230
|
+
factors++;
|
|
231
|
+
// Required capabilities overlap
|
|
232
|
+
const capabilities1 = new Set(state1.requiredCapabilities);
|
|
233
|
+
const capabilities2 = new Set(state2.requiredCapabilities);
|
|
234
|
+
const intersection = new Set([...capabilities1].filter(x => capabilities2.has(x)));
|
|
235
|
+
const union = new Set([...capabilities1, ...capabilities2]);
|
|
236
|
+
if (union.size > 0) {
|
|
237
|
+
similarity += intersection.size / union.size;
|
|
238
|
+
factors++;
|
|
239
|
+
}
|
|
240
|
+
return factors > 0 ? similarity / factors : 0;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Analyze decision factors
|
|
244
|
+
*/
|
|
245
|
+
analyzeDecisionFactors(state, action, qValue, explorationRate, confidence, wasExploration) {
|
|
246
|
+
const factors = [];
|
|
247
|
+
// Q-value factor
|
|
248
|
+
factors.push({
|
|
249
|
+
name: 'Q-Value',
|
|
250
|
+
value: qValue.toFixed(3),
|
|
251
|
+
impact: wasExploration ? 0.3 : 0.9,
|
|
252
|
+
description: 'Expected cumulative reward for this state-action pair'
|
|
253
|
+
});
|
|
254
|
+
// Exploration rate factor
|
|
255
|
+
factors.push({
|
|
256
|
+
name: 'Exploration Rate',
|
|
257
|
+
value: `${(explorationRate * 100).toFixed(1)}%`,
|
|
258
|
+
impact: wasExploration ? 0.9 : 0.1,
|
|
259
|
+
description: 'Probability of selecting random action for exploration'
|
|
260
|
+
});
|
|
261
|
+
// Confidence factor
|
|
262
|
+
factors.push({
|
|
263
|
+
name: 'Confidence',
|
|
264
|
+
value: `${(confidence * 100).toFixed(0)}%`,
|
|
265
|
+
impact: 0.7,
|
|
266
|
+
description: 'Based on number and quality of similar past experiences'
|
|
267
|
+
});
|
|
268
|
+
// Task complexity factor
|
|
269
|
+
factors.push({
|
|
270
|
+
name: 'Task Complexity',
|
|
271
|
+
value: state.taskComplexity.toFixed(2),
|
|
272
|
+
impact: 0.5,
|
|
273
|
+
description: 'Complexity of current task (0=simple, 1=complex)'
|
|
274
|
+
});
|
|
275
|
+
// Resource availability factor
|
|
276
|
+
factors.push({
|
|
277
|
+
name: 'Available Resources',
|
|
278
|
+
value: `${(state.availableResources * 100).toFixed(0)}%`,
|
|
279
|
+
impact: 0.4,
|
|
280
|
+
description: 'Resources available for task execution'
|
|
281
|
+
});
|
|
282
|
+
// Strategy factor
|
|
283
|
+
factors.push({
|
|
284
|
+
name: 'Strategy',
|
|
285
|
+
value: action.strategy,
|
|
286
|
+
impact: 0.8,
|
|
287
|
+
description: 'Selected execution strategy'
|
|
288
|
+
});
|
|
289
|
+
// Parallelization factor
|
|
290
|
+
factors.push({
|
|
291
|
+
name: 'Parallelization',
|
|
292
|
+
value: `${(action.parallelization * 100).toFixed(0)}%`,
|
|
293
|
+
impact: 0.5,
|
|
294
|
+
description: 'Degree of parallel execution'
|
|
295
|
+
});
|
|
296
|
+
// Sort by impact
|
|
297
|
+
factors.sort((a, b) => b.impact - a.impact);
|
|
298
|
+
return factors;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Export explanation in structured format
|
|
302
|
+
*/
|
|
303
|
+
exportStructured(explanation, state, availableActions, explorationRate) {
|
|
304
|
+
return {
|
|
305
|
+
explanation,
|
|
306
|
+
state,
|
|
307
|
+
availableActions,
|
|
308
|
+
explorationRate
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Export explanation in natural language format
|
|
313
|
+
*/
|
|
314
|
+
exportNaturalLanguage(explanation) {
|
|
315
|
+
const summary = this.generateSummary(explanation);
|
|
316
|
+
const details = this.generateDetails(explanation);
|
|
317
|
+
const metrics = this.generateMetrics(explanation);
|
|
318
|
+
const recommendations = this.generateRecommendations(explanation);
|
|
319
|
+
return {
|
|
320
|
+
summary,
|
|
321
|
+
details,
|
|
322
|
+
metrics,
|
|
323
|
+
recommendations
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Generate summary sentence
|
|
328
|
+
*/
|
|
329
|
+
generateSummary(explanation) {
|
|
330
|
+
const action = explanation.selectedAction.strategy;
|
|
331
|
+
const type = explanation.decisionType;
|
|
332
|
+
const confidence = (explanation.confidence * 100).toFixed(0);
|
|
333
|
+
if (type === 'exploration') {
|
|
334
|
+
return `Explored "${action}" strategy with ${confidence}% confidence to gather more experience.`;
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
return `Selected "${action}" strategy with ${confidence}% confidence based on Q-value of ${explanation.qValue.toFixed(3)}.`;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Generate detailed explanation paragraphs
|
|
342
|
+
*/
|
|
343
|
+
generateDetails(explanation) {
|
|
344
|
+
const details = [];
|
|
345
|
+
// Main reasoning
|
|
346
|
+
details.push(explanation.reasoning);
|
|
347
|
+
// Contributing experiences
|
|
348
|
+
if (explanation.contributingExperiences.length > 0) {
|
|
349
|
+
const exp = explanation.contributingExperiences[0];
|
|
350
|
+
const successRate = explanation.contributingExperiences.filter(e => e.reward > 0).length /
|
|
351
|
+
explanation.contributingExperiences.length;
|
|
352
|
+
details.push(`This decision is based on ${explanation.contributingExperiences.length} similar past experiences ` +
|
|
353
|
+
`with a ${(successRate * 100).toFixed(0)}% success rate. The most similar experience was from ` +
|
|
354
|
+
`"${exp.taskType}" which had a reward of ${exp.reward.toFixed(2)}.`);
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
details.push('This decision is based on limited historical data. As the agent gains more experience, ' +
|
|
358
|
+
'decision quality will improve.');
|
|
359
|
+
}
|
|
360
|
+
// Top decision factors
|
|
361
|
+
const topFactors = explanation.decisionFactors.slice(0, 3);
|
|
362
|
+
if (topFactors.length > 0) {
|
|
363
|
+
const factorList = topFactors.map(f => `${f.name} (${f.value})`).join(', ');
|
|
364
|
+
details.push(`Key decision factors: ${factorList}.`);
|
|
365
|
+
}
|
|
366
|
+
// Alternatives
|
|
367
|
+
if (explanation.alternatives.length > 0) {
|
|
368
|
+
const alt = explanation.alternatives[0];
|
|
369
|
+
details.push(`The next best alternative was "${alt.action.strategy}" with Q-value ${alt.qValue.toFixed(3)}. ` +
|
|
370
|
+
`It wasn't selected because: ${alt.reason}.`);
|
|
371
|
+
}
|
|
372
|
+
return details;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Generate key metrics
|
|
376
|
+
*/
|
|
377
|
+
generateMetrics(explanation) {
|
|
378
|
+
const metrics = {};
|
|
379
|
+
metrics['Decision Type'] = explanation.decisionType === 'exploration' ? 'Exploration' : 'Exploitation';
|
|
380
|
+
metrics['Q-Value'] = explanation.qValue.toFixed(3);
|
|
381
|
+
metrics['Confidence'] = `${(explanation.confidence * 100).toFixed(0)}%`;
|
|
382
|
+
metrics['Strategy'] = explanation.selectedAction.strategy;
|
|
383
|
+
metrics['Similar Experiences'] = explanation.contributingExperiences.length.toString();
|
|
384
|
+
if (explanation.contributingExperiences.length > 0) {
|
|
385
|
+
const successCount = explanation.contributingExperiences.filter(e => e.reward > 0).length;
|
|
386
|
+
metrics['Success Rate'] = `${((successCount / explanation.contributingExperiences.length) * 100).toFixed(0)}%`;
|
|
387
|
+
}
|
|
388
|
+
return metrics;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Generate recommendations for user
|
|
392
|
+
*/
|
|
393
|
+
generateRecommendations(explanation) {
|
|
394
|
+
const recommendations = [];
|
|
395
|
+
// Low confidence recommendation
|
|
396
|
+
if (explanation.confidence < 0.3) {
|
|
397
|
+
recommendations.push('Low confidence detected. Consider providing feedback to help the agent learn faster.');
|
|
398
|
+
}
|
|
399
|
+
// Limited experience recommendation
|
|
400
|
+
if (explanation.contributingExperiences.length < 3) {
|
|
401
|
+
recommendations.push('Limited experience in this scenario. The agent will improve with more similar tasks.');
|
|
402
|
+
}
|
|
403
|
+
// Exploration recommendation
|
|
404
|
+
if (explanation.decisionType === 'exploration') {
|
|
405
|
+
recommendations.push('This was an exploratory action. If it performs well, it will be favored in future decisions.');
|
|
406
|
+
}
|
|
407
|
+
// High confidence recommendation
|
|
408
|
+
if (explanation.confidence > 0.8) {
|
|
409
|
+
recommendations.push('High confidence in this decision based on extensive past experience.');
|
|
410
|
+
}
|
|
411
|
+
// Alternative suggestion
|
|
412
|
+
if (explanation.alternatives.length > 0) {
|
|
413
|
+
const alt = explanation.alternatives[0];
|
|
414
|
+
if (Math.abs(alt.qValue - explanation.qValue) < 0.1) {
|
|
415
|
+
recommendations.push(`Alternative strategy "${alt.action.strategy}" has similar expected performance and could also work well.`);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return recommendations;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Encode state to string key (matches LearningEngine encoding)
|
|
422
|
+
*/
|
|
423
|
+
encodeState(state) {
|
|
424
|
+
const features = [
|
|
425
|
+
state.taskComplexity,
|
|
426
|
+
state.requiredCapabilities.length / 10,
|
|
427
|
+
state.previousAttempts / 5,
|
|
428
|
+
state.availableResources,
|
|
429
|
+
state.timeConstraint ? Math.min(state.timeConstraint / 300000, 1) : 1
|
|
430
|
+
];
|
|
431
|
+
return features.map(f => Math.round(f * 10) / 10).join(',');
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Encode action to string key (matches LearningEngine encoding)
|
|
435
|
+
*/
|
|
436
|
+
encodeAction(action) {
|
|
437
|
+
return `${action.strategy}:${action.parallelization.toFixed(1)}:${action.retryPolicy}`;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
exports.ExplainableLearning = ExplainableLearning;
|
|
441
|
+
//# sourceMappingURL=ExplainableLearning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExplainableLearning.js","sourceRoot":"","sources":["../../src/learning/ExplainableLearning.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,4CAAyC;AA0IzC;;GAEG;AACH,MAAa,mBAAmB;IAG9B;QACE,IAAI,CAAC,MAAM,GAAG,eAAM,CAAC,WAAW,EAAE,CAAC;QACnC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;IACtD,CAAC;IAED;;;;;;;;;;;OAWG;IACH,aAAa,CACX,KAAgB,EAChB,cAA2B,EAC3B,gBAA+B,EAC/B,OAA4B,EAC5B,eAAuB,EACvB,WAA6B,EAC7B,cAAuB;QAEvB,MAAM,iBAAiB,GAAG,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;QAC5D,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAE3D,0BAA0B;QAC1B,MAAM,YAAY,GAAiB,cAAc,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC;QAEnF,2CAA2C;QAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,mBAAmB,CACzC,KAAK,EACL,cAAc,EACd,WAAW,CACZ,CAAC;QAEF,qBAAqB;QACrB,MAAM,SAAS,GAAG,IAAI,CAAC,iBAAiB,CACtC,YAAY,EACZ,cAAc,EACd,UAAU,EACV,eAAe,EACf,gBA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