agentic-qe 3.8.11 → 3.8.12
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/skills-manifest.json +1 -1
- package/CHANGELOG.md +24 -0
- package/dist/cli/bundle.js +1141 -1045
- package/dist/cli/commands/ruvector-commands.js +17 -0
- package/dist/domains/code-intelligence/coordinator-gnn.d.ts +21 -0
- package/dist/domains/code-intelligence/coordinator-gnn.js +102 -0
- package/dist/domains/contract-testing/coordinator.js +13 -0
- package/dist/domains/coverage-analysis/coordinator.js +5 -0
- package/dist/domains/defect-intelligence/coordinator.d.ts +1 -0
- package/dist/domains/defect-intelligence/coordinator.js +43 -0
- package/dist/domains/quality-assessment/coordinator.js +26 -0
- package/dist/domains/test-generation/coordinator.js +14 -0
- package/dist/integrations/agentic-flow/reasoning-bank/experience-replay.d.ts +11 -0
- package/dist/integrations/agentic-flow/reasoning-bank/experience-replay.js +44 -1
- package/dist/integrations/rl-suite/algorithms/eprop.d.ts +79 -0
- package/dist/integrations/rl-suite/algorithms/eprop.js +284 -0
- package/dist/integrations/rl-suite/algorithms/index.d.ts +2 -1
- package/dist/integrations/rl-suite/algorithms/index.js +2 -1
- package/dist/integrations/rl-suite/index.d.ts +2 -2
- package/dist/integrations/rl-suite/index.js +2 -2
- package/dist/integrations/rl-suite/interfaces.d.ts +3 -3
- package/dist/integrations/rl-suite/interfaces.js +1 -1
- package/dist/integrations/rl-suite/orchestrator.d.ts +2 -2
- package/dist/integrations/rl-suite/orchestrator.js +3 -2
- package/dist/integrations/rl-suite/reward-signals.d.ts +1 -1
- package/dist/integrations/rl-suite/reward-signals.js +1 -1
- package/dist/integrations/ruvector/coherence-gate-cohomology.d.ts +41 -0
- package/dist/integrations/ruvector/coherence-gate-cohomology.js +47 -0
- package/dist/integrations/ruvector/coherence-gate-core.d.ts +200 -0
- package/dist/integrations/ruvector/coherence-gate-core.js +294 -0
- package/dist/integrations/ruvector/coherence-gate-energy.d.ts +136 -0
- package/dist/integrations/ruvector/coherence-gate-energy.js +373 -0
- package/dist/integrations/ruvector/coherence-gate-vector.d.ts +38 -0
- package/dist/integrations/ruvector/coherence-gate-vector.js +76 -0
- package/dist/integrations/ruvector/coherence-gate.d.ts +10 -311
- package/dist/integrations/ruvector/coherence-gate.js +10 -652
- package/dist/integrations/ruvector/cold-tier-trainer.d.ts +103 -0
- package/dist/integrations/ruvector/cold-tier-trainer.js +377 -0
- package/dist/integrations/ruvector/cusum-detector.d.ts +70 -0
- package/dist/integrations/ruvector/cusum-detector.js +142 -0
- package/dist/integrations/ruvector/delta-tracker.d.ts +122 -0
- package/dist/integrations/ruvector/delta-tracker.js +311 -0
- package/dist/integrations/ruvector/domain-transfer.d.ts +79 -1
- package/dist/integrations/ruvector/domain-transfer.js +158 -2
- package/dist/integrations/ruvector/eprop-learner.d.ts +135 -0
- package/dist/integrations/ruvector/eprop-learner.js +351 -0
- package/dist/integrations/ruvector/feature-flags.d.ts +177 -0
- package/dist/integrations/ruvector/feature-flags.js +145 -0
- package/dist/integrations/ruvector/graphmae-encoder.d.ts +88 -0
- package/dist/integrations/ruvector/graphmae-encoder.js +360 -0
- package/dist/integrations/ruvector/hdc-fingerprint.d.ts +127 -0
- package/dist/integrations/ruvector/hdc-fingerprint.js +222 -0
- package/dist/integrations/ruvector/hopfield-memory.d.ts +97 -0
- package/dist/integrations/ruvector/hopfield-memory.js +238 -0
- package/dist/integrations/ruvector/index.d.ts +13 -2
- package/dist/integrations/ruvector/index.js +46 -2
- package/dist/integrations/ruvector/mincut-wrapper.d.ts +7 -0
- package/dist/integrations/ruvector/mincut-wrapper.js +54 -2
- package/dist/integrations/ruvector/reservoir-replay.d.ts +172 -0
- package/dist/integrations/ruvector/reservoir-replay.js +335 -0
- package/dist/integrations/ruvector/solver-adapter.d.ts +93 -0
- package/dist/integrations/ruvector/solver-adapter.js +299 -0
- package/dist/integrations/ruvector/sona-persistence.d.ts +33 -0
- package/dist/integrations/ruvector/sona-persistence.js +47 -0
- package/dist/integrations/ruvector/spectral-sparsifier.d.ts +154 -0
- package/dist/integrations/ruvector/spectral-sparsifier.js +389 -0
- package/dist/integrations/ruvector/temporal-causality.d.ts +63 -0
- package/dist/integrations/ruvector/temporal-causality.js +317 -0
- package/dist/learning/pattern-promotion.d.ts +63 -0
- package/dist/learning/pattern-promotion.js +235 -1
- package/dist/learning/pattern-store.d.ts +2 -0
- package/dist/learning/pattern-store.js +187 -1
- package/dist/learning/sqlite-persistence.d.ts +2 -0
- package/dist/learning/sqlite-persistence.js +4 -0
- package/dist/mcp/bundle.js +506 -427
- package/dist/shared/utils/index.d.ts +1 -0
- package/dist/shared/utils/index.js +1 -0
- package/dist/shared/utils/xorshift128.d.ts +24 -0
- package/dist/shared/utils/xorshift128.js +50 -0
- package/package.json +1 -1
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - E-prop Online Learning Algorithm (ADR-087 Milestone 4)
|
|
3
|
+
*
|
|
4
|
+
* RL algorithm #10: Eligibility propagation for online learning.
|
|
5
|
+
* Uses 12 bytes/synapse with no backprop required.
|
|
6
|
+
*
|
|
7
|
+
* Application: Online adaptive test strategies — learns in real time
|
|
8
|
+
* from test execution feedback without storing replay buffers.
|
|
9
|
+
*/
|
|
10
|
+
import { BaseRLAlgorithm } from '../base-algorithm';
|
|
11
|
+
import { TEST_EXECUTION_REWARDS } from '../interfaces';
|
|
12
|
+
import { createEpropNetwork, } from '../../ruvector/eprop-learner.js';
|
|
13
|
+
import { getRuVectorFeatureFlags } from '../../ruvector/feature-flags.js';
|
|
14
|
+
const DEFAULT_EPROP_ALGORITHM_CONFIG = {
|
|
15
|
+
stateSize: 10,
|
|
16
|
+
hiddenSize: 50,
|
|
17
|
+
actionSize: 4,
|
|
18
|
+
epropLearningRate: 0.01,
|
|
19
|
+
eligibilityDecay: 0.95,
|
|
20
|
+
feedbackAlignment: true,
|
|
21
|
+
};
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// E-prop RL Algorithm
|
|
24
|
+
// ============================================================================
|
|
25
|
+
/**
|
|
26
|
+
* E-prop online learning algorithm for adaptive test strategies.
|
|
27
|
+
*
|
|
28
|
+
* Unlike batch RL algorithms, E-prop learns from each experience
|
|
29
|
+
* immediately using eligibility traces — no replay buffer needed.
|
|
30
|
+
*
|
|
31
|
+
* Key advantages:
|
|
32
|
+
* - Online: updates weights after every step
|
|
33
|
+
* - Memory-efficient: 12 bytes/synapse (vs kilobytes for replay-based)
|
|
34
|
+
* - Biologically plausible: no weight transport (feedback alignment)
|
|
35
|
+
* - Fast: no backward pass through the full network
|
|
36
|
+
*/
|
|
37
|
+
export class EpropAlgorithm extends BaseRLAlgorithm {
|
|
38
|
+
network;
|
|
39
|
+
epropConfig;
|
|
40
|
+
actions;
|
|
41
|
+
constructor(config = {}, rewardSignals = TEST_EXECUTION_REWARDS) {
|
|
42
|
+
super('eprop', 'online-learning', {}, rewardSignals);
|
|
43
|
+
this.epropConfig = { ...DEFAULT_EPROP_ALGORITHM_CONFIG, ...config };
|
|
44
|
+
// Create the underlying E-prop network
|
|
45
|
+
this.network = createEpropNetwork({
|
|
46
|
+
inputSize: this.epropConfig.stateSize,
|
|
47
|
+
hiddenSize: this.epropConfig.hiddenSize,
|
|
48
|
+
outputSize: this.epropConfig.actionSize,
|
|
49
|
+
learningRate: this.epropConfig.epropLearningRate,
|
|
50
|
+
eligibilityDecay: this.epropConfig.eligibilityDecay,
|
|
51
|
+
feedbackAlignment: this.epropConfig.feedbackAlignment,
|
|
52
|
+
});
|
|
53
|
+
// Default action space for test execution
|
|
54
|
+
this.actions = [
|
|
55
|
+
{ type: 'execute', value: 'standard' },
|
|
56
|
+
{ type: 'prioritize', value: 'high' },
|
|
57
|
+
{ type: 'retry', value: 'adaptive' },
|
|
58
|
+
{ type: 'skip', value: 0 },
|
|
59
|
+
];
|
|
60
|
+
// Trim or pad action space to match config
|
|
61
|
+
while (this.actions.length < this.epropConfig.actionSize) {
|
|
62
|
+
this.actions.push({ type: 'explore', value: this.actions.length });
|
|
63
|
+
}
|
|
64
|
+
this.actions = this.actions.slice(0, this.epropConfig.actionSize);
|
|
65
|
+
}
|
|
66
|
+
// ==========================================================================
|
|
67
|
+
// RLAlgorithm Interface
|
|
68
|
+
// ==========================================================================
|
|
69
|
+
/**
|
|
70
|
+
* Predict best action for a given state.
|
|
71
|
+
* Runs the E-prop network forward pass and selects the action
|
|
72
|
+
* with highest output activation.
|
|
73
|
+
*/
|
|
74
|
+
async predict(state) {
|
|
75
|
+
if (!getRuVectorFeatureFlags().useEpropOnlineLearning) {
|
|
76
|
+
// Feature flag disabled — return default action with zero confidence
|
|
77
|
+
return {
|
|
78
|
+
action: { type: this.actions[0]?.type ?? 'test-action', value: this.actions[0]?.value ?? 'default' },
|
|
79
|
+
confidence: 0,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if (!this.initialized) {
|
|
83
|
+
await this.initialize();
|
|
84
|
+
}
|
|
85
|
+
const stateFeatures = this.prepareState(state);
|
|
86
|
+
const output = this.network.forward(stateFeatures);
|
|
87
|
+
// Select action with highest activation
|
|
88
|
+
const actionIndex = this.argmax(output);
|
|
89
|
+
const action = this.actions[actionIndex];
|
|
90
|
+
const confidence = this.calculateConfidence(output);
|
|
91
|
+
return {
|
|
92
|
+
action: { type: action.type, value: action.value },
|
|
93
|
+
confidence,
|
|
94
|
+
value: output[actionIndex],
|
|
95
|
+
reasoning: this.generateReasoning(action, output[actionIndex], confidence),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Train with a single experience — the core online learning step.
|
|
100
|
+
*
|
|
101
|
+
* Unlike batch algorithms, E-prop processes each experience immediately:
|
|
102
|
+
* 1. Forward pass (already done during predict)
|
|
103
|
+
* 2. Online update: dw = eta * eligibility * reward
|
|
104
|
+
*/
|
|
105
|
+
async train(experience) {
|
|
106
|
+
if (!this.initialized) {
|
|
107
|
+
await this.initialize();
|
|
108
|
+
}
|
|
109
|
+
const startTime = Date.now();
|
|
110
|
+
// Run forward pass on the state to update eligibility traces
|
|
111
|
+
const stateFeatures = this.prepareState(experience.state);
|
|
112
|
+
this.network.forward(stateFeatures);
|
|
113
|
+
// Apply online update with reward signal
|
|
114
|
+
this.network.updateOnline(experience.reward);
|
|
115
|
+
// Reset traces if episode ended
|
|
116
|
+
if (experience.done) {
|
|
117
|
+
this.network.resetTraces();
|
|
118
|
+
}
|
|
119
|
+
// Track stats
|
|
120
|
+
this.episodeCount++;
|
|
121
|
+
this.totalReward += experience.reward;
|
|
122
|
+
this.rewardHistory.push(experience.reward);
|
|
123
|
+
if (this.rewardHistory.length > 1000) {
|
|
124
|
+
this.rewardHistory.shift();
|
|
125
|
+
}
|
|
126
|
+
const avgReward = this.rewardHistory.reduce((a, b) => a + b, 0) / this.rewardHistory.length;
|
|
127
|
+
this.stats = {
|
|
128
|
+
episode: this.episodeCount,
|
|
129
|
+
totalReward: this.totalReward,
|
|
130
|
+
averageReward: avgReward,
|
|
131
|
+
trainingTimeMs: Date.now() - startTime,
|
|
132
|
+
timestamp: new Date(),
|
|
133
|
+
explorationRate: this.config.explorationRate,
|
|
134
|
+
};
|
|
135
|
+
return this.stats;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Core training logic for batch experiences.
|
|
139
|
+
* E-prop processes each experience online (sequentially).
|
|
140
|
+
*/
|
|
141
|
+
async trainCore(experiences) {
|
|
142
|
+
for (const exp of experiences) {
|
|
143
|
+
const stateFeatures = this.prepareState(exp.state);
|
|
144
|
+
this.network.forward(stateFeatures);
|
|
145
|
+
this.network.updateOnline(exp.reward);
|
|
146
|
+
if (exp.done) {
|
|
147
|
+
this.network.resetTraces();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const avgReward = this.rewardHistory.length > 0
|
|
151
|
+
? this.rewardHistory.reduce((a, b) => a + b, 0) / this.rewardHistory.length
|
|
152
|
+
: 0;
|
|
153
|
+
return {
|
|
154
|
+
episode: this.episodeCount,
|
|
155
|
+
totalReward: this.totalReward,
|
|
156
|
+
averageReward: avgReward,
|
|
157
|
+
trainingTimeMs: 0,
|
|
158
|
+
timestamp: new Date(),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Get algorithm-specific info.
|
|
163
|
+
*/
|
|
164
|
+
getAlgorithmInfo() {
|
|
165
|
+
const networkStats = this.network.getStats();
|
|
166
|
+
return {
|
|
167
|
+
type: 'eprop',
|
|
168
|
+
category: 'online-learning',
|
|
169
|
+
version: '1.0.0',
|
|
170
|
+
description: 'E-prop Online Learning for Adaptive Test Strategies',
|
|
171
|
+
capabilities: [
|
|
172
|
+
'Online learning (no replay buffer)',
|
|
173
|
+
'Eligibility trace propagation',
|
|
174
|
+
'Feedback alignment (no weight transport)',
|
|
175
|
+
'12 bytes/synapse memory budget',
|
|
176
|
+
'Real-time adaptation to test results',
|
|
177
|
+
],
|
|
178
|
+
hyperparameters: {
|
|
179
|
+
stateSize: this.epropConfig.stateSize,
|
|
180
|
+
hiddenSize: this.epropConfig.hiddenSize,
|
|
181
|
+
actionSize: this.epropConfig.actionSize,
|
|
182
|
+
learningRate: this.epropConfig.epropLearningRate,
|
|
183
|
+
eligibilityDecay: this.epropConfig.eligibilityDecay,
|
|
184
|
+
feedbackAlignment: String(this.epropConfig.feedbackAlignment),
|
|
185
|
+
synapsCount: networkStats.synapsCount,
|
|
186
|
+
memoryBytes: networkStats.memoryBytes,
|
|
187
|
+
},
|
|
188
|
+
stats: this.stats,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
// ==========================================================================
|
|
192
|
+
// Export / Import
|
|
193
|
+
// ==========================================================================
|
|
194
|
+
async exportCustomData() {
|
|
195
|
+
const weights = this.network.exportWeights();
|
|
196
|
+
return {
|
|
197
|
+
inputHidden: Array.from(weights.inputHidden),
|
|
198
|
+
hiddenOutput: Array.from(weights.hiddenOutput),
|
|
199
|
+
epropConfig: this.epropConfig,
|
|
200
|
+
networkStats: this.network.getStats(),
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
async importCustomData(data) {
|
|
204
|
+
if (data.epropConfig) {
|
|
205
|
+
this.epropConfig = { ...this.epropConfig, ...data.epropConfig };
|
|
206
|
+
}
|
|
207
|
+
if (data.inputHidden && data.hiddenOutput) {
|
|
208
|
+
this.network.importWeights({
|
|
209
|
+
inputHidden: new Float32Array(data.inputHidden),
|
|
210
|
+
hiddenOutput: new Float32Array(data.hiddenOutput),
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
this.initialized = true;
|
|
214
|
+
}
|
|
215
|
+
async resetAlgorithm() {
|
|
216
|
+
this.network = createEpropNetwork({
|
|
217
|
+
inputSize: this.epropConfig.stateSize,
|
|
218
|
+
hiddenSize: this.epropConfig.hiddenSize,
|
|
219
|
+
outputSize: this.epropConfig.actionSize,
|
|
220
|
+
learningRate: this.epropConfig.epropLearningRate,
|
|
221
|
+
eligibilityDecay: this.epropConfig.eligibilityDecay,
|
|
222
|
+
feedbackAlignment: this.epropConfig.feedbackAlignment,
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
// ==========================================================================
|
|
226
|
+
// Private Helpers
|
|
227
|
+
// ==========================================================================
|
|
228
|
+
prepareState(state) {
|
|
229
|
+
const features = state.features.slice(0, this.epropConfig.stateSize);
|
|
230
|
+
// Pad with zeros if needed
|
|
231
|
+
while (features.length < this.epropConfig.stateSize) {
|
|
232
|
+
features.push(0);
|
|
233
|
+
}
|
|
234
|
+
// Normalize to [-1, 1]
|
|
235
|
+
const max = Math.max(...features.map(Math.abs));
|
|
236
|
+
if (max > 0) {
|
|
237
|
+
for (let i = 0; i < features.length; i++) {
|
|
238
|
+
features[i] = features[i] / max;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return new Float32Array(features);
|
|
242
|
+
}
|
|
243
|
+
argmax(array) {
|
|
244
|
+
let maxIndex = 0;
|
|
245
|
+
let maxValue = array[0];
|
|
246
|
+
for (let i = 1; i < array.length; i++) {
|
|
247
|
+
if (array[i] > maxValue) {
|
|
248
|
+
maxValue = array[i];
|
|
249
|
+
maxIndex = i;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return maxIndex;
|
|
253
|
+
}
|
|
254
|
+
calculateConfidence(output) {
|
|
255
|
+
const arr = Array.from(output);
|
|
256
|
+
const max = Math.max(...arr);
|
|
257
|
+
const min = Math.min(...arr);
|
|
258
|
+
if (max === min)
|
|
259
|
+
return 0.5;
|
|
260
|
+
const spread = max - min;
|
|
261
|
+
return Math.min(1, 0.3 + spread * 2);
|
|
262
|
+
}
|
|
263
|
+
generateReasoning(action, value, confidence) {
|
|
264
|
+
const stats = this.network.getStats();
|
|
265
|
+
if (stats.totalSteps < 10) {
|
|
266
|
+
return `E-prop exploration phase (step ${stats.totalSteps}): ${action.type} action`;
|
|
267
|
+
}
|
|
268
|
+
if (confidence > 0.8) {
|
|
269
|
+
return (`High-confidence E-prop decision (${confidence.toFixed(2)}): ${action.type} ` +
|
|
270
|
+
`with value ${value.toFixed(3)} after ${stats.totalSteps} online updates`);
|
|
271
|
+
}
|
|
272
|
+
return `E-prop online learning: ${action.type} with confidence ${confidence.toFixed(2)}`;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
// ============================================================================
|
|
276
|
+
// Factory
|
|
277
|
+
// ============================================================================
|
|
278
|
+
/**
|
|
279
|
+
* Create a new E-prop RL algorithm instance.
|
|
280
|
+
*/
|
|
281
|
+
export function createEpropAlgorithm(config, rewardSignals) {
|
|
282
|
+
return new EpropAlgorithm(config, rewardSignals);
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=eprop.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agentic QE v3 - RL Algorithms Index
|
|
3
3
|
*
|
|
4
|
-
* Exports all
|
|
4
|
+
* Exports all 10 RL algorithms for QE applications.
|
|
5
5
|
*/
|
|
6
6
|
export { QLearningAlgorithm } from './q-learning';
|
|
7
7
|
export { DecisionTransformerAlgorithm } from './decision-transformer';
|
|
@@ -12,4 +12,5 @@ export { DQNAlgorithm } from './dqn';
|
|
|
12
12
|
export { PPOAlgorithm } from './ppo';
|
|
13
13
|
export { A2CAlgorithm } from './a2c';
|
|
14
14
|
export { DDPGAlgorithm } from './ddpg';
|
|
15
|
+
export { EpropAlgorithm, createEpropAlgorithm } from './eprop';
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agentic QE v3 - RL Algorithms Index
|
|
3
3
|
*
|
|
4
|
-
* Exports all
|
|
4
|
+
* Exports all 10 RL algorithms for QE applications.
|
|
5
5
|
*/
|
|
6
6
|
export { QLearningAlgorithm } from './q-learning';
|
|
7
7
|
export { DecisionTransformerAlgorithm } from './decision-transformer';
|
|
@@ -12,4 +12,5 @@ export { DQNAlgorithm } from './dqn';
|
|
|
12
12
|
export { PPOAlgorithm } from './ppo';
|
|
13
13
|
export { A2CAlgorithm } from './a2c';
|
|
14
14
|
export { DDPGAlgorithm } from './ddpg';
|
|
15
|
+
export { EpropAlgorithm, createEpropAlgorithm } from './eprop';
|
|
15
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agentic QE v3 - RL Suite Main Export
|
|
3
3
|
*
|
|
4
|
-
* Complete RL Suite for Quality Engineering with
|
|
4
|
+
* Complete RL Suite for Quality Engineering with 10 algorithms.
|
|
5
5
|
* Per ADR-040, provides reinforcement learning for QE decision-making.
|
|
6
6
|
*/
|
|
7
7
|
import type { DomainName } from '../../shared/types';
|
|
@@ -10,7 +10,7 @@ import type { QERLSuite } from './orchestrator';
|
|
|
10
10
|
export { QERLSuite, createQERLSuite } from './orchestrator';
|
|
11
11
|
export type { RLSuiteStats } from './orchestrator';
|
|
12
12
|
export { BaseRLAlgorithm } from './base-algorithm';
|
|
13
|
-
export { QLearningAlgorithm, DecisionTransformerAlgorithm, SARSAAlgorithm, ActorCriticAlgorithm, PolicyGradientAlgorithm, DQNAlgorithm, PPOAlgorithm, A2CAlgorithm, DDPGAlgorithm, } from './algorithms';
|
|
13
|
+
export { QLearningAlgorithm, DecisionTransformerAlgorithm, SARSAAlgorithm, ActorCriticAlgorithm, PolicyGradientAlgorithm, DQNAlgorithm, PPOAlgorithm, A2CAlgorithm, DDPGAlgorithm, EpropAlgorithm, createEpropAlgorithm, } from './algorithms';
|
|
14
14
|
export type { RLAlgorithmType, RLAlgorithmCategory, QEDomainApplication, RLState, RLAction, RLExperience, RLPrediction, RLTrainingStats, RLTrainingConfig, RLAlgorithmInfo, TestExecutionState, TestExecutionAction, CoverageAnalysisState, CoverageOptimizationAction, QualityGateState, QualityGateAction, ResourceAllocationState, ResourceAllocationAction, RewardSignal, RewardContext, RewardCalculation, AlgorithmDomainMapping, RLSuiteConfig, ALGORITHM_DOMAIN_MAPPINGS, RLAlgorithmError, RLTrainingError, RLPredictionError, RLConfigError, } from './interfaces';
|
|
15
15
|
export { SONA, SONAIndex, SONAOptimizer, SONAPatternCache, createSONA, createDomainSONA, } from './sona';
|
|
16
16
|
export type { SONAPattern, SONAPatternType, SONAAdaptationResult, SONAStats, SONAConfig, } from './sona';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agentic QE v3 - RL Suite Main Export
|
|
3
3
|
*
|
|
4
|
-
* Complete RL Suite for Quality Engineering with
|
|
4
|
+
* Complete RL Suite for Quality Engineering with 10 algorithms.
|
|
5
5
|
* Per ADR-040, provides reinforcement learning for QE decision-making.
|
|
6
6
|
*/
|
|
7
7
|
// ============================================================================
|
|
@@ -15,7 +15,7 @@ export { BaseRLAlgorithm } from './base-algorithm';
|
|
|
15
15
|
// ============================================================================
|
|
16
16
|
// Algorithms
|
|
17
17
|
// ============================================================================
|
|
18
|
-
export { QLearningAlgorithm, DecisionTransformerAlgorithm, SARSAAlgorithm, ActorCriticAlgorithm, PolicyGradientAlgorithm, DQNAlgorithm, PPOAlgorithm, A2CAlgorithm, DDPGAlgorithm, } from './algorithms';
|
|
18
|
+
export { QLearningAlgorithm, DecisionTransformerAlgorithm, SARSAAlgorithm, ActorCriticAlgorithm, PolicyGradientAlgorithm, DQNAlgorithm, PPOAlgorithm, A2CAlgorithm, DDPGAlgorithm, EpropAlgorithm, createEpropAlgorithm, } from './algorithms';
|
|
19
19
|
// ============================================================================
|
|
20
20
|
// SONA (Self-Optimizing Neural Architecture)
|
|
21
21
|
// ============================================================================
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
* Agentic QE v3 - RL Suite Interfaces
|
|
3
3
|
*
|
|
4
4
|
* Reinforcement Learning algorithms for Quality Engineering.
|
|
5
|
-
* Per ADR-040, implements
|
|
5
|
+
* Per ADR-040 + ADR-087 R11, implements 10 RL algorithms for QE-specific applications.
|
|
6
6
|
*/
|
|
7
7
|
import type { DomainName, Priority, AgentType } from '../../shared/types';
|
|
8
8
|
export type { DomainName } from '../../shared/types';
|
|
9
9
|
/**
|
|
10
10
|
* All supported RL algorithms
|
|
11
11
|
*/
|
|
12
|
-
export type RLAlgorithmType = 'decision-transformer' | 'q-learning' | 'sarsa' | 'actor-critic' | 'policy-gradient' | 'dqn' | 'ppo' | 'a2c' | 'ddpg';
|
|
12
|
+
export type RLAlgorithmType = 'decision-transformer' | 'q-learning' | 'sarsa' | 'actor-critic' | 'policy-gradient' | 'dqn' | 'ppo' | 'a2c' | 'ddpg' | 'eprop';
|
|
13
13
|
/**
|
|
14
14
|
* RL algorithm categories
|
|
15
15
|
*/
|
|
16
|
-
export type RLAlgorithmCategory = 'value-based' | 'policy-based' | 'actor-critic' | 'offline-rl' | 'deterministic-policy';
|
|
16
|
+
export type RLAlgorithmCategory = 'value-based' | 'policy-based' | 'actor-critic' | 'offline-rl' | 'deterministic-policy' | 'online-learning';
|
|
17
17
|
/**
|
|
18
18
|
* QE domain application for RL algorithms
|
|
19
19
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Agentic QE v3 - RL Suite Interfaces
|
|
3
3
|
*
|
|
4
4
|
* Reinforcement Learning algorithms for Quality Engineering.
|
|
5
|
-
* Per ADR-040, implements
|
|
5
|
+
* Per ADR-040 + ADR-087 R11, implements 10 RL algorithms for QE-specific applications.
|
|
6
6
|
*/
|
|
7
7
|
// ============================================================================
|
|
8
8
|
// QE Reward Signal Presets
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agentic QE v3 - QE RL Suite Orchestrator
|
|
3
3
|
*
|
|
4
|
-
* Main orchestrator for all
|
|
4
|
+
* Main orchestrator for all 10 RL algorithms in QE.
|
|
5
5
|
* Provides unified interface for algorithm selection, training, and inference.
|
|
6
6
|
*/
|
|
7
7
|
import type { RLAlgorithm, RLAlgorithmType, RLState, RLAction, RLPrediction, RLExperience, RLTrainingStats, RLSuiteConfig, DomainName, RewardContext, RewardCalculation } from './interfaces';
|
|
@@ -16,7 +16,7 @@ export interface RLSuiteStats {
|
|
|
16
16
|
/**
|
|
17
17
|
* Main orchestrator for QE RL Suite
|
|
18
18
|
*
|
|
19
|
-
* Manages all
|
|
19
|
+
* Manages all 10 RL algorithms and provides:
|
|
20
20
|
* - Algorithm selection based on domain/task
|
|
21
21
|
* - Unified training interface
|
|
22
22
|
* - Prediction with automatic algorithm routing
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agentic QE v3 - QE RL Suite Orchestrator
|
|
3
3
|
*
|
|
4
|
-
* Main orchestrator for all
|
|
4
|
+
* Main orchestrator for all 10 RL algorithms in QE.
|
|
5
5
|
* Provides unified interface for algorithm selection, training, and inference.
|
|
6
6
|
*/
|
|
7
7
|
import { QLearningAlgorithm } from './algorithms/q-learning';
|
|
@@ -21,7 +21,7 @@ import { getRewardSignalsForDomain, calculateReward } from './reward-signals';
|
|
|
21
21
|
/**
|
|
22
22
|
* Main orchestrator for QE RL Suite
|
|
23
23
|
*
|
|
24
|
-
* Manages all
|
|
24
|
+
* Manages all 10 RL algorithms and provides:
|
|
25
25
|
* - Algorithm selection based on domain/task
|
|
26
26
|
* - Unified training interface
|
|
27
27
|
* - Prediction with automatic algorithm routing
|
|
@@ -347,6 +347,7 @@ export class QERLSuite {
|
|
|
347
347
|
'ppo': 0,
|
|
348
348
|
'a2c': 0,
|
|
349
349
|
'ddpg': 0,
|
|
350
|
+
'eprop': 0,
|
|
350
351
|
},
|
|
351
352
|
domainUsage: {},
|
|
352
353
|
lastUpdated: new Date(),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Agentic QE v3 - QE-Specific Reward Signals
|
|
3
3
|
*
|
|
4
4
|
* Domain-specific reward functions for RL algorithms in QE.
|
|
5
|
-
* Per ADR-040, implements reward signals for all
|
|
5
|
+
* Per ADR-040, implements reward signals for all 10 algorithms.
|
|
6
6
|
*/
|
|
7
7
|
import type { RewardSignal, RewardContext, RewardCalculation, DomainName } from './interfaces';
|
|
8
8
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Agentic QE v3 - QE-Specific Reward Signals
|
|
3
3
|
*
|
|
4
4
|
* Domain-specific reward functions for RL algorithms in QE.
|
|
5
|
-
* Per ADR-040, implements reward signals for all
|
|
5
|
+
* Per ADR-040, implements reward signals for all 10 algorithms.
|
|
6
6
|
*/
|
|
7
7
|
// ============================================================================
|
|
8
8
|
// Test Execution Rewards (for Decision Transformer, DQN, PPO)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coherence Gate - CohomologyEngine WASM Lazy Loader
|
|
3
|
+
*
|
|
4
|
+
* Lazily loads the CohomologyEngine from prime-radiant-advanced-wasm.
|
|
5
|
+
* Returns null when the WASM module is unavailable, allowing fallback
|
|
6
|
+
* to word-frequency cosine similarity.
|
|
7
|
+
*
|
|
8
|
+
* @module integrations/ruvector/coherence-gate-cohomology
|
|
9
|
+
* @see ADR-083-coherence-gated-agent-actions.md
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Minimal interface for the CohomologyEngine from prime-radiant-advanced-wasm.
|
|
13
|
+
*/
|
|
14
|
+
export interface ICohomologyEngine {
|
|
15
|
+
consistencyEnergy(graph: {
|
|
16
|
+
nodes: Array<{
|
|
17
|
+
id: number;
|
|
18
|
+
label: string;
|
|
19
|
+
section: number[];
|
|
20
|
+
weight: number;
|
|
21
|
+
}>;
|
|
22
|
+
edges: Array<{
|
|
23
|
+
source: number;
|
|
24
|
+
target: number;
|
|
25
|
+
weight: number;
|
|
26
|
+
restriction_map: number[];
|
|
27
|
+
source_dim: number;
|
|
28
|
+
target_dim: number;
|
|
29
|
+
}>;
|
|
30
|
+
}): number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Lazily load the CohomologyEngine from prime-radiant-advanced-wasm.
|
|
34
|
+
* Returns null if the WASM module is unavailable.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getCohomologyEngine(): ICohomologyEngine | null;
|
|
37
|
+
/**
|
|
38
|
+
* Reset the CohomologyEngine loader state (for testing).
|
|
39
|
+
*/
|
|
40
|
+
export declare function resetCohomologyEngineLoader(): void;
|
|
41
|
+
//# sourceMappingURL=coherence-gate-cohomology.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coherence Gate - CohomologyEngine WASM Lazy Loader
|
|
3
|
+
*
|
|
4
|
+
* Lazily loads the CohomologyEngine from prime-radiant-advanced-wasm.
|
|
5
|
+
* Returns null when the WASM module is unavailable, allowing fallback
|
|
6
|
+
* to word-frequency cosine similarity.
|
|
7
|
+
*
|
|
8
|
+
* @module integrations/ruvector/coherence-gate-cohomology
|
|
9
|
+
* @see ADR-083-coherence-gated-agent-actions.md
|
|
10
|
+
*/
|
|
11
|
+
import { createRequire } from 'module';
|
|
12
|
+
import { LoggerFactory } from '../../logging/index.js';
|
|
13
|
+
const esmRequire = createRequire(import.meta.url);
|
|
14
|
+
const logger = LoggerFactory.create('coherence-gate-cohomology');
|
|
15
|
+
let cohomologyEngine = null;
|
|
16
|
+
let cohomologyLoadAttempted = false;
|
|
17
|
+
/**
|
|
18
|
+
* Lazily load the CohomologyEngine from prime-radiant-advanced-wasm.
|
|
19
|
+
* Returns null if the WASM module is unavailable.
|
|
20
|
+
*/
|
|
21
|
+
export function getCohomologyEngine() {
|
|
22
|
+
if (cohomologyLoadAttempted)
|
|
23
|
+
return cohomologyEngine;
|
|
24
|
+
cohomologyLoadAttempted = true;
|
|
25
|
+
try {
|
|
26
|
+
const pr = esmRequire('prime-radiant-advanced-wasm');
|
|
27
|
+
const fs = esmRequire('fs');
|
|
28
|
+
const path = esmRequire('path');
|
|
29
|
+
const wasmPath = path.join(path.dirname(require.resolve('prime-radiant-advanced-wasm')), 'prime_radiant_advanced_wasm_bg.wasm');
|
|
30
|
+
pr.initSync({ module: fs.readFileSync(wasmPath) });
|
|
31
|
+
cohomologyEngine = new pr.CohomologyEngine();
|
|
32
|
+
logger.info('CohomologyEngine loaded from prime-radiant-advanced-wasm');
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
logger.debug('CohomologyEngine unavailable, using word-frequency fallback', { error: String(err) });
|
|
36
|
+
cohomologyEngine = null;
|
|
37
|
+
}
|
|
38
|
+
return cohomologyEngine;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Reset the CohomologyEngine loader state (for testing).
|
|
42
|
+
*/
|
|
43
|
+
export function resetCohomologyEngineLoader() {
|
|
44
|
+
cohomologyEngine = null;
|
|
45
|
+
cohomologyLoadAttempted = false;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=coherence-gate-cohomology.js.map
|