agentic-qe 3.3.1 → 3.3.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/package.json +1 -1
- package/v3/CHANGELOG.md +46 -0
- package/v3/dist/cli/bundle.js +3675 -342
- package/v3/dist/coordination/queen-coordinator.d.ts +13 -1
- package/v3/dist/coordination/queen-coordinator.d.ts.map +1 -1
- package/v3/dist/coordination/queen-coordinator.js +91 -3
- package/v3/dist/coordination/queen-coordinator.js.map +1 -1
- package/v3/dist/domains/coverage-analysis/plugin.d.ts +6 -1
- package/v3/dist/domains/coverage-analysis/plugin.d.ts.map +1 -1
- package/v3/dist/domains/coverage-analysis/plugin.js +73 -0
- package/v3/dist/domains/coverage-analysis/plugin.js.map +1 -1
- package/v3/dist/domains/domain-interface.d.ts +39 -2
- package/v3/dist/domains/domain-interface.d.ts.map +1 -1
- package/v3/dist/domains/domain-interface.js +99 -0
- package/v3/dist/domains/domain-interface.js.map +1 -1
- package/v3/dist/domains/learning-optimization/coordinator.d.ts +83 -0
- package/v3/dist/domains/learning-optimization/coordinator.d.ts.map +1 -1
- package/v3/dist/domains/learning-optimization/coordinator.js +174 -0
- package/v3/dist/domains/learning-optimization/coordinator.js.map +1 -1
- package/v3/dist/domains/learning-optimization/interfaces.d.ts +14 -0
- package/v3/dist/domains/learning-optimization/interfaces.d.ts.map +1 -1
- package/v3/dist/domains/quality-assessment/coordinator.d.ts +23 -0
- package/v3/dist/domains/quality-assessment/coordinator.d.ts.map +1 -1
- package/v3/dist/domains/quality-assessment/coordinator.js +139 -1
- package/v3/dist/domains/quality-assessment/coordinator.js.map +1 -1
- package/v3/dist/domains/quality-assessment/plugin.d.ts +6 -1
- package/v3/dist/domains/quality-assessment/plugin.d.ts.map +1 -1
- package/v3/dist/domains/quality-assessment/plugin.js +67 -0
- package/v3/dist/domains/quality-assessment/plugin.js.map +1 -1
- package/v3/dist/domains/test-execution/plugin.d.ts +6 -1
- package/v3/dist/domains/test-execution/plugin.d.ts.map +1 -1
- package/v3/dist/domains/test-execution/plugin.js +77 -0
- package/v3/dist/domains/test-execution/plugin.js.map +1 -1
- package/v3/dist/domains/test-generation/coordinator.d.ts +40 -0
- package/v3/dist/domains/test-generation/coordinator.d.ts.map +1 -1
- package/v3/dist/domains/test-generation/coordinator.js +184 -1
- package/v3/dist/domains/test-generation/coordinator.js.map +1 -1
- package/v3/dist/domains/test-generation/plugin.d.ts +6 -1
- package/v3/dist/domains/test-generation/plugin.d.ts.map +1 -1
- package/v3/dist/domains/test-generation/plugin.js +84 -0
- package/v3/dist/domains/test-generation/plugin.js.map +1 -1
- package/v3/dist/kernel/interfaces.d.ts +54 -1
- package/v3/dist/kernel/interfaces.d.ts.map +1 -1
- package/v3/dist/learning/dream/dream-scheduler.d.ts +302 -0
- package/v3/dist/learning/dream/dream-scheduler.d.ts.map +1 -0
- package/v3/dist/learning/dream/dream-scheduler.js +551 -0
- package/v3/dist/learning/dream/dream-scheduler.js.map +1 -0
- package/v3/dist/learning/dream/index.d.ts +1 -0
- package/v3/dist/learning/dream/index.d.ts.map +1 -1
- package/v3/dist/learning/dream/index.js +4 -0
- package/v3/dist/learning/dream/index.js.map +1 -1
- package/v3/dist/mcp/bundle.js +66391 -60131
- package/v3/dist/mcp/handlers/core-handlers.d.ts.map +1 -1
- package/v3/dist/mcp/handlers/core-handlers.js +16 -2
- package/v3/dist/mcp/handlers/core-handlers.js.map +1 -1
- package/v3/dist/mcp/handlers/task-handlers.d.ts +1 -0
- package/v3/dist/mcp/handlers/task-handlers.d.ts.map +1 -1
- package/v3/dist/mcp/handlers/task-handlers.js +46 -12
- package/v3/dist/mcp/handlers/task-handlers.js.map +1 -1
- package/v3/dist/mcp/services/reasoning-bank-service.d.ts +87 -13
- package/v3/dist/mcp/services/reasoning-bank-service.d.ts.map +1 -1
- package/v3/dist/mcp/services/reasoning-bank-service.js +291 -31
- package/v3/dist/mcp/services/reasoning-bank-service.js.map +1 -1
- package/v3/dist/routing/qe-agent-registry.d.ts +27 -0
- package/v3/dist/routing/qe-agent-registry.d.ts.map +1 -1
- package/v3/dist/routing/qe-agent-registry.js +96 -0
- package/v3/dist/routing/qe-agent-registry.js.map +1 -1
- package/v3/dist/shared/events/domain-events.d.ts +27 -0
- package/v3/dist/shared/events/domain-events.d.ts.map +1 -1
- package/v3/dist/shared/events/domain-events.js +1 -0
- package/v3/dist/shared/events/domain-events.js.map +1 -1
- package/v3/package.json +1 -1
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DreamScheduler - Automated Dream Cycle Scheduling
|
|
3
|
+
* ADR-021: QE ReasoningBank - Dream Cycle Integration
|
|
4
|
+
*
|
|
5
|
+
* The DreamScheduler provides automated triggering of dream cycles based on:
|
|
6
|
+
* - Time-based scheduling (periodic dreams)
|
|
7
|
+
* - Experience accumulation thresholds
|
|
8
|
+
* - Event-based triggers (quality gate failures, domain milestones)
|
|
9
|
+
*
|
|
10
|
+
* It coordinates with the DreamEngine to run actual dream cycles and
|
|
11
|
+
* can automatically apply high-confidence insights.
|
|
12
|
+
*
|
|
13
|
+
* @module v3/learning/dream/dream-scheduler
|
|
14
|
+
*/
|
|
15
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
16
|
+
/**
|
|
17
|
+
* Default DreamScheduler configuration
|
|
18
|
+
*/
|
|
19
|
+
export const DEFAULT_DREAM_SCHEDULER_CONFIG = {
|
|
20
|
+
// Time-based scheduling
|
|
21
|
+
autoScheduleIntervalMs: 3600000, // 1 hour
|
|
22
|
+
minTimeBetweenDreamsMs: 300000, // 5 minutes
|
|
23
|
+
// Experience-based triggers
|
|
24
|
+
experienceThreshold: 20,
|
|
25
|
+
enableExperienceTrigger: true,
|
|
26
|
+
// Event-based triggers
|
|
27
|
+
enableQualityGateFailureTrigger: true,
|
|
28
|
+
enableDomainMilestoneTrigger: false,
|
|
29
|
+
// Dream configuration
|
|
30
|
+
defaultDreamDurationMs: 10000, // 10 seconds
|
|
31
|
+
quickDreamDurationMs: 5000, // 5 seconds
|
|
32
|
+
fullDreamDurationMs: 30000, // 30 seconds
|
|
33
|
+
// Insight handling
|
|
34
|
+
autoApplyHighConfidenceInsights: false,
|
|
35
|
+
insightConfidenceThreshold: 0.8,
|
|
36
|
+
};
|
|
37
|
+
// ============================================================================
|
|
38
|
+
// DreamScheduler Implementation
|
|
39
|
+
// ============================================================================
|
|
40
|
+
/**
|
|
41
|
+
* DreamScheduler manages automatic triggering of dream cycles.
|
|
42
|
+
*
|
|
43
|
+
* It follows the dependency injection pattern - all required dependencies
|
|
44
|
+
* (DreamEngine, EventBus) must be provided via the constructor.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const scheduler = new DreamScheduler({
|
|
49
|
+
* dreamEngine,
|
|
50
|
+
* eventBus,
|
|
51
|
+
* memoryBackend, // optional
|
|
52
|
+
* });
|
|
53
|
+
*
|
|
54
|
+
* await scheduler.initialize();
|
|
55
|
+
* scheduler.start();
|
|
56
|
+
*
|
|
57
|
+
* // Record experiences as they happen
|
|
58
|
+
* scheduler.recordExperience({
|
|
59
|
+
* id: 'exp-1',
|
|
60
|
+
* agentType: 'tester',
|
|
61
|
+
* domain: 'test-execution',
|
|
62
|
+
* taskType: 'run-tests',
|
|
63
|
+
* success: true,
|
|
64
|
+
* duration: 5000,
|
|
65
|
+
* timestamp: new Date(),
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
68
|
+
* // Manually trigger a dream
|
|
69
|
+
* const result = await scheduler.triggerDream();
|
|
70
|
+
*
|
|
71
|
+
* // Stop and cleanup
|
|
72
|
+
* scheduler.stop();
|
|
73
|
+
* await scheduler.dispose();
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export class DreamScheduler {
|
|
77
|
+
config;
|
|
78
|
+
dreamEngine;
|
|
79
|
+
eventBus;
|
|
80
|
+
memoryBackend;
|
|
81
|
+
// State
|
|
82
|
+
initialized = false;
|
|
83
|
+
running = false;
|
|
84
|
+
dreaming = false;
|
|
85
|
+
// Experience buffer
|
|
86
|
+
experienceBuffer = [];
|
|
87
|
+
// Timing
|
|
88
|
+
lastDreamTime = null;
|
|
89
|
+
scheduledDreamTimer = null;
|
|
90
|
+
totalDreamsCompleted = 0;
|
|
91
|
+
// Event subscriptions
|
|
92
|
+
subscriptions = [];
|
|
93
|
+
// Last result
|
|
94
|
+
lastDreamResult = null;
|
|
95
|
+
/**
|
|
96
|
+
* Create a new DreamScheduler instance.
|
|
97
|
+
*
|
|
98
|
+
* @param dependencies - Required dependencies (dreamEngine, eventBus, memoryBackend)
|
|
99
|
+
* @param config - Optional configuration overrides
|
|
100
|
+
* @throws {Error} If required dependencies are missing
|
|
101
|
+
*/
|
|
102
|
+
constructor(dependencies, config) {
|
|
103
|
+
// Validate required dependencies (Integration Prevention Pattern)
|
|
104
|
+
if (!dependencies.dreamEngine) {
|
|
105
|
+
throw new Error('DreamScheduler requires dreamEngine dependency');
|
|
106
|
+
}
|
|
107
|
+
if (!dependencies.eventBus) {
|
|
108
|
+
throw new Error('DreamScheduler requires eventBus dependency');
|
|
109
|
+
}
|
|
110
|
+
this.dreamEngine = dependencies.dreamEngine;
|
|
111
|
+
this.eventBus = dependencies.eventBus;
|
|
112
|
+
this.memoryBackend = dependencies.memoryBackend;
|
|
113
|
+
this.config = { ...DEFAULT_DREAM_SCHEDULER_CONFIG, ...config };
|
|
114
|
+
}
|
|
115
|
+
// ==========================================================================
|
|
116
|
+
// Lifecycle Methods
|
|
117
|
+
// ==========================================================================
|
|
118
|
+
/**
|
|
119
|
+
* Initialize the scheduler.
|
|
120
|
+
*
|
|
121
|
+
* Sets up event subscriptions and restores state from memory if available.
|
|
122
|
+
*/
|
|
123
|
+
async initialize() {
|
|
124
|
+
if (this.initialized)
|
|
125
|
+
return;
|
|
126
|
+
// Subscribe to quality gate failure events
|
|
127
|
+
if (this.config.enableQualityGateFailureTrigger) {
|
|
128
|
+
const qualitySubscription = this.eventBus.subscribe('quality-assessment:gate:completed', this.handleQualityGateEvent.bind(this));
|
|
129
|
+
this.subscriptions.push(qualitySubscription);
|
|
130
|
+
}
|
|
131
|
+
// Subscribe to domain milestone events
|
|
132
|
+
if (this.config.enableDomainMilestoneTrigger) {
|
|
133
|
+
const milestoneSubscription = this.eventBus.subscribe('coordination:milestone:reached', this.handleDomainMilestoneEvent.bind(this));
|
|
134
|
+
this.subscriptions.push(milestoneSubscription);
|
|
135
|
+
}
|
|
136
|
+
// Restore state from memory if available
|
|
137
|
+
await this.restoreState();
|
|
138
|
+
this.initialized = true;
|
|
139
|
+
console.log('[DreamScheduler] Initialized');
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Start the scheduler.
|
|
143
|
+
*
|
|
144
|
+
* Begins automatic dream scheduling based on the configured interval.
|
|
145
|
+
*/
|
|
146
|
+
start() {
|
|
147
|
+
this.ensureInitialized();
|
|
148
|
+
if (this.running)
|
|
149
|
+
return;
|
|
150
|
+
this.running = true;
|
|
151
|
+
this.scheduleNextDream();
|
|
152
|
+
console.log('[DreamScheduler] Started');
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Stop the scheduler.
|
|
156
|
+
*
|
|
157
|
+
* Stops automatic scheduling but does not dispose resources.
|
|
158
|
+
*/
|
|
159
|
+
stop() {
|
|
160
|
+
if (!this.running)
|
|
161
|
+
return;
|
|
162
|
+
this.running = false;
|
|
163
|
+
this.clearScheduledDream();
|
|
164
|
+
console.log('[DreamScheduler] Stopped');
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Dispose of all resources.
|
|
168
|
+
*
|
|
169
|
+
* Stops scheduling, unsubscribes from events, and saves state.
|
|
170
|
+
*/
|
|
171
|
+
async dispose() {
|
|
172
|
+
this.stop();
|
|
173
|
+
// Unsubscribe from all events
|
|
174
|
+
for (const subscription of this.subscriptions) {
|
|
175
|
+
subscription.unsubscribe();
|
|
176
|
+
}
|
|
177
|
+
this.subscriptions = [];
|
|
178
|
+
// Save state before disposing
|
|
179
|
+
await this.saveState();
|
|
180
|
+
this.initialized = false;
|
|
181
|
+
console.log('[DreamScheduler] Disposed');
|
|
182
|
+
}
|
|
183
|
+
// ==========================================================================
|
|
184
|
+
// Manual Dream Triggers
|
|
185
|
+
// ==========================================================================
|
|
186
|
+
/**
|
|
187
|
+
* Manually trigger a dream cycle.
|
|
188
|
+
*
|
|
189
|
+
* @param duration - Optional duration override in ms
|
|
190
|
+
* @returns Result of the dream cycle
|
|
191
|
+
*/
|
|
192
|
+
async triggerDream(duration) {
|
|
193
|
+
this.ensureInitialized();
|
|
194
|
+
// Check minimum time between dreams
|
|
195
|
+
if (!this.canDream()) {
|
|
196
|
+
const waitTime = this.getTimeUntilCanDream();
|
|
197
|
+
throw new Error(`Cannot start dream: minimum interval not met. Wait ${Math.ceil(waitTime / 1000)}s.`);
|
|
198
|
+
}
|
|
199
|
+
return this.executeDream(duration ?? this.config.defaultDreamDurationMs);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Trigger a quick dream (shorter duration).
|
|
203
|
+
*
|
|
204
|
+
* @returns Result of the dream cycle
|
|
205
|
+
*/
|
|
206
|
+
async triggerQuickDream() {
|
|
207
|
+
return this.triggerDream(this.config.quickDreamDurationMs);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Trigger a full dream (longer duration).
|
|
211
|
+
*
|
|
212
|
+
* @returns Result of the dream cycle
|
|
213
|
+
*/
|
|
214
|
+
async triggerFullDream() {
|
|
215
|
+
return this.triggerDream(this.config.fullDreamDurationMs);
|
|
216
|
+
}
|
|
217
|
+
// ==========================================================================
|
|
218
|
+
// Experience Recording
|
|
219
|
+
// ==========================================================================
|
|
220
|
+
/**
|
|
221
|
+
* Record a task experience for future dream processing.
|
|
222
|
+
*
|
|
223
|
+
* If experience threshold is reached and enabled, triggers a dream.
|
|
224
|
+
*
|
|
225
|
+
* @param experience - The experience to record
|
|
226
|
+
*/
|
|
227
|
+
recordExperience(experience) {
|
|
228
|
+
this.experienceBuffer.push(experience);
|
|
229
|
+
// Check if we should trigger an experience-based dream
|
|
230
|
+
if (this.config.enableExperienceTrigger &&
|
|
231
|
+
this.experienceBuffer.length >= this.config.experienceThreshold &&
|
|
232
|
+
this.canDream() &&
|
|
233
|
+
!this.dreaming) {
|
|
234
|
+
console.log(`[DreamScheduler] Experience threshold (${this.config.experienceThreshold}) reached, triggering dream`);
|
|
235
|
+
// Fire and forget - don't block the caller
|
|
236
|
+
this.executeDream(this.config.defaultDreamDurationMs).catch((err) => {
|
|
237
|
+
console.error('[DreamScheduler] Experience-triggered dream failed:', err);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Get the current experience buffer.
|
|
243
|
+
*
|
|
244
|
+
* @returns Copy of the experience buffer
|
|
245
|
+
*/
|
|
246
|
+
getExperienceBuffer() {
|
|
247
|
+
return [...this.experienceBuffer];
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Clear the experience buffer.
|
|
251
|
+
*/
|
|
252
|
+
clearExperienceBuffer() {
|
|
253
|
+
this.experienceBuffer = [];
|
|
254
|
+
}
|
|
255
|
+
// ==========================================================================
|
|
256
|
+
// Status Methods
|
|
257
|
+
// ==========================================================================
|
|
258
|
+
/**
|
|
259
|
+
* Get the current scheduler status.
|
|
260
|
+
*
|
|
261
|
+
* @returns Current status object
|
|
262
|
+
*/
|
|
263
|
+
getStatus() {
|
|
264
|
+
const timeUntilNext = this.scheduledDreamTimer
|
|
265
|
+
? this.getTimeUntilScheduledDream()
|
|
266
|
+
: null;
|
|
267
|
+
return {
|
|
268
|
+
initialized: this.initialized,
|
|
269
|
+
running: this.running,
|
|
270
|
+
dreaming: this.dreaming,
|
|
271
|
+
experienceCount: this.experienceBuffer.length,
|
|
272
|
+
experienceThreshold: this.config.experienceThreshold,
|
|
273
|
+
timeUntilNextDream: timeUntilNext,
|
|
274
|
+
totalDreamsCompleted: this.totalDreamsCompleted,
|
|
275
|
+
lastDreamTime: this.lastDreamTime,
|
|
276
|
+
autoSchedulingEnabled: this.running,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Get the result of the last completed dream.
|
|
281
|
+
*
|
|
282
|
+
* @returns Last dream result or null
|
|
283
|
+
*/
|
|
284
|
+
getLastDreamResult() {
|
|
285
|
+
return this.lastDreamResult;
|
|
286
|
+
}
|
|
287
|
+
// ==========================================================================
|
|
288
|
+
// Private: Dream Execution
|
|
289
|
+
// ==========================================================================
|
|
290
|
+
/**
|
|
291
|
+
* Execute a dream cycle with the specified duration.
|
|
292
|
+
*/
|
|
293
|
+
async executeDream(durationMs) {
|
|
294
|
+
if (this.dreaming) {
|
|
295
|
+
throw new Error('A dream is already in progress');
|
|
296
|
+
}
|
|
297
|
+
this.dreaming = true;
|
|
298
|
+
console.log(`[DreamScheduler] Starting dream cycle (${durationMs}ms)`);
|
|
299
|
+
try {
|
|
300
|
+
// Run the dream
|
|
301
|
+
const result = await this.dreamEngine.dream(durationMs);
|
|
302
|
+
// Update state
|
|
303
|
+
this.lastDreamTime = new Date();
|
|
304
|
+
this.lastDreamResult = result;
|
|
305
|
+
this.totalDreamsCompleted++;
|
|
306
|
+
// Clear experience buffer after successful dream
|
|
307
|
+
this.clearExperienceBuffer();
|
|
308
|
+
// Auto-apply high-confidence insights if enabled
|
|
309
|
+
if (this.config.autoApplyHighConfidenceInsights) {
|
|
310
|
+
await this.autoApplyInsights(result);
|
|
311
|
+
}
|
|
312
|
+
// Publish dream completed event
|
|
313
|
+
await this.publishDreamCompletedEvent(result);
|
|
314
|
+
// Reschedule next dream if running
|
|
315
|
+
if (this.running) {
|
|
316
|
+
this.scheduleNextDream();
|
|
317
|
+
}
|
|
318
|
+
console.log(`[DreamScheduler] Dream completed: ${result.insights.length} insights generated`);
|
|
319
|
+
return result;
|
|
320
|
+
}
|
|
321
|
+
finally {
|
|
322
|
+
this.dreaming = false;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Auto-apply insights that meet the confidence threshold.
|
|
327
|
+
*/
|
|
328
|
+
async autoApplyInsights(result) {
|
|
329
|
+
const highConfidenceInsights = result.insights.filter((insight) => insight.actionable &&
|
|
330
|
+
insight.confidenceScore >= this.config.insightConfidenceThreshold);
|
|
331
|
+
for (const insight of highConfidenceInsights) {
|
|
332
|
+
try {
|
|
333
|
+
const applyResult = await this.dreamEngine.applyInsight(insight.id);
|
|
334
|
+
if (applyResult.success) {
|
|
335
|
+
console.log(`[DreamScheduler] Auto-applied insight ${insight.id}: ${applyResult.patternId}`);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
catch (err) {
|
|
339
|
+
console.error(`[DreamScheduler] Failed to auto-apply insight ${insight.id}:`, err);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
// ==========================================================================
|
|
344
|
+
// Private: Scheduling
|
|
345
|
+
// ==========================================================================
|
|
346
|
+
/**
|
|
347
|
+
* Schedule the next automatic dream.
|
|
348
|
+
*/
|
|
349
|
+
scheduleNextDream() {
|
|
350
|
+
this.clearScheduledDream();
|
|
351
|
+
if (!this.running)
|
|
352
|
+
return;
|
|
353
|
+
const nextDreamDelay = this.calculateNextDreamDelay();
|
|
354
|
+
this.scheduledDreamTimer = setTimeout(async () => {
|
|
355
|
+
if (!this.running || this.dreaming)
|
|
356
|
+
return;
|
|
357
|
+
try {
|
|
358
|
+
await this.executeDream(this.config.defaultDreamDurationMs);
|
|
359
|
+
}
|
|
360
|
+
catch (err) {
|
|
361
|
+
console.error('[DreamScheduler] Scheduled dream failed:', err);
|
|
362
|
+
// Reschedule even on failure
|
|
363
|
+
if (this.running) {
|
|
364
|
+
this.scheduleNextDream();
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}, nextDreamDelay);
|
|
368
|
+
console.log(`[DreamScheduler] Next dream scheduled in ${Math.ceil(nextDreamDelay / 1000)}s`);
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Clear any scheduled dream timer.
|
|
372
|
+
*/
|
|
373
|
+
clearScheduledDream() {
|
|
374
|
+
if (this.scheduledDreamTimer) {
|
|
375
|
+
clearTimeout(this.scheduledDreamTimer);
|
|
376
|
+
this.scheduledDreamTimer = null;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Calculate delay until next scheduled dream.
|
|
381
|
+
*/
|
|
382
|
+
calculateNextDreamDelay() {
|
|
383
|
+
if (!this.lastDreamTime) {
|
|
384
|
+
// First dream - wait full interval
|
|
385
|
+
return this.config.autoScheduleIntervalMs;
|
|
386
|
+
}
|
|
387
|
+
const timeSinceLastDream = Date.now() - this.lastDreamTime.getTime();
|
|
388
|
+
const remainingTime = this.config.autoScheduleIntervalMs - timeSinceLastDream;
|
|
389
|
+
// Ensure minimum delay
|
|
390
|
+
return Math.max(remainingTime, this.config.minTimeBetweenDreamsMs);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Get time until the currently scheduled dream.
|
|
394
|
+
*/
|
|
395
|
+
getTimeUntilScheduledDream() {
|
|
396
|
+
// Approximate - we track when we scheduled, not the exact timer
|
|
397
|
+
return this.calculateNextDreamDelay();
|
|
398
|
+
}
|
|
399
|
+
// ==========================================================================
|
|
400
|
+
// Private: Dream Timing Checks
|
|
401
|
+
// ==========================================================================
|
|
402
|
+
/**
|
|
403
|
+
* Check if enough time has passed since the last dream.
|
|
404
|
+
*/
|
|
405
|
+
canDream() {
|
|
406
|
+
if (!this.lastDreamTime)
|
|
407
|
+
return true;
|
|
408
|
+
const timeSinceLastDream = Date.now() - this.lastDreamTime.getTime();
|
|
409
|
+
return timeSinceLastDream >= this.config.minTimeBetweenDreamsMs;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Get time until we can start a dream.
|
|
413
|
+
*/
|
|
414
|
+
getTimeUntilCanDream() {
|
|
415
|
+
if (!this.lastDreamTime)
|
|
416
|
+
return 0;
|
|
417
|
+
const timeSinceLastDream = Date.now() - this.lastDreamTime.getTime();
|
|
418
|
+
return Math.max(0, this.config.minTimeBetweenDreamsMs - timeSinceLastDream);
|
|
419
|
+
}
|
|
420
|
+
// ==========================================================================
|
|
421
|
+
// Private: Event Handlers
|
|
422
|
+
// ==========================================================================
|
|
423
|
+
/**
|
|
424
|
+
* Handle quality gate completion events.
|
|
425
|
+
* Triggers a dream when a gate fails to analyze what went wrong.
|
|
426
|
+
*/
|
|
427
|
+
async handleQualityGateEvent(event) {
|
|
428
|
+
if (event.payload.passed)
|
|
429
|
+
return; // Only trigger on failures
|
|
430
|
+
if (!this.canDream() || this.dreaming) {
|
|
431
|
+
console.log('[DreamScheduler] Quality gate failed but cannot start dream yet');
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
console.log('[DreamScheduler] Quality gate failed, triggering analysis dream');
|
|
435
|
+
try {
|
|
436
|
+
await this.executeDream(this.config.quickDreamDurationMs);
|
|
437
|
+
}
|
|
438
|
+
catch (err) {
|
|
439
|
+
console.error('[DreamScheduler] Quality gate triggered dream failed:', err);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Handle domain milestone events.
|
|
444
|
+
* Triggers a dream to consolidate learnings after significant progress.
|
|
445
|
+
*/
|
|
446
|
+
async handleDomainMilestoneEvent(event) {
|
|
447
|
+
if (!this.canDream() || this.dreaming) {
|
|
448
|
+
console.log('[DreamScheduler] Milestone reached but cannot start dream yet');
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
console.log('[DreamScheduler] Domain milestone reached, triggering consolidation dream');
|
|
452
|
+
try {
|
|
453
|
+
await this.executeDream(this.config.defaultDreamDurationMs);
|
|
454
|
+
}
|
|
455
|
+
catch (err) {
|
|
456
|
+
console.error('[DreamScheduler] Milestone triggered dream failed:', err);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
// ==========================================================================
|
|
460
|
+
// Private: Event Publishing
|
|
461
|
+
// ==========================================================================
|
|
462
|
+
/**
|
|
463
|
+
* Publish a dream completed event.
|
|
464
|
+
*/
|
|
465
|
+
async publishDreamCompletedEvent(result) {
|
|
466
|
+
try {
|
|
467
|
+
await this.eventBus.publish({
|
|
468
|
+
id: uuidv4(),
|
|
469
|
+
type: 'learning-optimization:dream:completed',
|
|
470
|
+
timestamp: new Date(),
|
|
471
|
+
source: 'learning-optimization',
|
|
472
|
+
payload: {
|
|
473
|
+
cycleId: result.cycle.id,
|
|
474
|
+
insightsGenerated: result.insights.length,
|
|
475
|
+
patternsCreated: result.patternsCreated,
|
|
476
|
+
duration: result.cycle.durationMs,
|
|
477
|
+
},
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
catch (err) {
|
|
481
|
+
console.error('[DreamScheduler] Failed to publish dream completed event:', err);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
// ==========================================================================
|
|
485
|
+
// Private: State Persistence
|
|
486
|
+
// ==========================================================================
|
|
487
|
+
/**
|
|
488
|
+
* Save scheduler state to memory backend.
|
|
489
|
+
*/
|
|
490
|
+
async saveState() {
|
|
491
|
+
if (!this.memoryBackend)
|
|
492
|
+
return;
|
|
493
|
+
try {
|
|
494
|
+
await this.memoryBackend.set('dream-scheduler:state', {
|
|
495
|
+
lastDreamTime: this.lastDreamTime?.toISOString() ?? null,
|
|
496
|
+
totalDreamsCompleted: this.totalDreamsCompleted,
|
|
497
|
+
experienceBuffer: this.experienceBuffer,
|
|
498
|
+
}, { namespace: 'learning-optimization', persist: true });
|
|
499
|
+
}
|
|
500
|
+
catch (err) {
|
|
501
|
+
console.error('[DreamScheduler] Failed to save state:', err);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Restore scheduler state from memory backend.
|
|
506
|
+
*/
|
|
507
|
+
async restoreState() {
|
|
508
|
+
if (!this.memoryBackend)
|
|
509
|
+
return;
|
|
510
|
+
try {
|
|
511
|
+
const state = await this.memoryBackend.get('dream-scheduler:state');
|
|
512
|
+
if (state) {
|
|
513
|
+
this.lastDreamTime = state.lastDreamTime
|
|
514
|
+
? new Date(state.lastDreamTime)
|
|
515
|
+
: null;
|
|
516
|
+
this.totalDreamsCompleted = state.totalDreamsCompleted ?? 0;
|
|
517
|
+
this.experienceBuffer = state.experienceBuffer ?? [];
|
|
518
|
+
console.log(`[DreamScheduler] Restored state: ${this.totalDreamsCompleted} dreams, ${this.experienceBuffer.length} experiences`);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
catch (err) {
|
|
522
|
+
console.error('[DreamScheduler] Failed to restore state:', err);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
// ==========================================================================
|
|
526
|
+
// Private: Validation
|
|
527
|
+
// ==========================================================================
|
|
528
|
+
/**
|
|
529
|
+
* Ensure the scheduler is initialized.
|
|
530
|
+
*/
|
|
531
|
+
ensureInitialized() {
|
|
532
|
+
if (!this.initialized) {
|
|
533
|
+
throw new Error('DreamScheduler not initialized. Call initialize() first.');
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
// ============================================================================
|
|
538
|
+
// Factory Function
|
|
539
|
+
// ============================================================================
|
|
540
|
+
/**
|
|
541
|
+
* Create a new DreamScheduler instance.
|
|
542
|
+
*
|
|
543
|
+
* @param dependencies - Required dependencies
|
|
544
|
+
* @param config - Optional configuration overrides
|
|
545
|
+
* @returns New DreamScheduler instance
|
|
546
|
+
*/
|
|
547
|
+
export function createDreamScheduler(dependencies, config) {
|
|
548
|
+
return new DreamScheduler(dependencies, config);
|
|
549
|
+
}
|
|
550
|
+
export default DreamScheduler;
|
|
551
|
+
//# sourceMappingURL=dream-scheduler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dream-scheduler.js","sourceRoot":"","sources":["../../../src/learning/dream/dream-scheduler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OA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KAAK,CAAC,aAAa,CAAC;oBAC/B,CAAC,CAAC,IAAI,CAAC;gBACT,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC,oBAAoB,IAAI,CAAC,CAAC;gBAC5D,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,IAAI,EAAE,CAAC;gBACrD,OAAO,CAAC,GAAG,CACT,oCAAoC,IAAI,CAAC,oBAAoB,YAAY,IAAI,CAAC,gBAAgB,CAAC,MAAM,cAAc,CACpH,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,2CAA2C,EAAE,GAAG,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IAED,6EAA6E;IAC7E,sBAAsB;IACtB,6EAA6E;IAE7E;;OAEG;IACK,iBAAiB;QACvB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAC9E,CAAC;IACH,CAAC;CACF;AAED,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,YAAwC,EACxC,MAAsC;IAEtC,OAAO,IAAI,cAAc,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -54,5 +54,6 @@ export { ConceptGraph, createConceptGraph } from './concept-graph.js';
|
|
|
54
54
|
export { SpreadingActivation, type ActivationConfig, type ActivationResult, DEFAULT_ACTIVATION_CONFIG, } from './spreading-activation.js';
|
|
55
55
|
export { InsightGenerator, type InsightConfig, type DreamInsight as GeneratedInsight, type PatternTemplate, DEFAULT_INSIGHT_CONFIG, } from './insight-generator.js';
|
|
56
56
|
export { DreamEngine, createDreamEngine, type DreamConfig, type DreamCycleResult as EngineResult, type ApplyInsightResult, DEFAULT_DREAM_CONFIG, } from './dream-engine.js';
|
|
57
|
+
export { DreamScheduler, createDreamScheduler, type DreamSchedulerConfig, type DreamSchedulerDependencies, type DreamSchedulerStatus, type TaskExperience, DEFAULT_DREAM_SCHEDULER_CONFIG, } from './dream-scheduler.js';
|
|
57
58
|
export { default } from './dream-engine.js';
|
|
58
59
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/learning/dream/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAMH,YAAY,EAEV,WAAW,EACX,QAAQ,EACR,WAAW,EACX,gBAAgB,EAGhB,WAAW,EACX,sBAAsB,EAGtB,WAAW,EACX,eAAe,EAGf,UAAU,EAGV,YAAY,EAGZ,iBAAiB,EAGjB,kBAAkB,EAGlB,iBAAiB,EACjB,cAAc,EAGd,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAM1D,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAMtE,OAAO,EACL,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AAMnC,OAAO,EACL,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,YAAY,IAAI,gBAAgB,EACrC,KAAK,eAAe,EACpB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,IAAI,YAAY,EACrC,KAAK,kBAAkB,EACvB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/learning/dream/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAMH,YAAY,EAEV,WAAW,EACX,QAAQ,EACR,WAAW,EACX,gBAAgB,EAGhB,WAAW,EACX,sBAAsB,EAGtB,WAAW,EACX,eAAe,EAGf,UAAU,EAGV,YAAY,EAGZ,iBAAiB,EAGjB,kBAAkB,EAGlB,iBAAiB,EACjB,cAAc,EAGd,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAM1D,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAMtE,OAAO,EACL,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AAMnC,OAAO,EACL,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,YAAY,IAAI,gBAAgB,EACrC,KAAK,eAAe,EACpB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,IAAI,YAAY,EACrC,KAAK,kBAAkB,EACvB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -66,6 +66,10 @@ export { InsightGenerator, DEFAULT_INSIGHT_CONFIG, } from './insight-generator.j
|
|
|
66
66
|
// ============================================================================
|
|
67
67
|
export { DreamEngine, createDreamEngine, DEFAULT_DREAM_CONFIG, } from './dream-engine.js';
|
|
68
68
|
// ============================================================================
|
|
69
|
+
// DreamScheduler
|
|
70
|
+
// ============================================================================
|
|
71
|
+
export { DreamScheduler, createDreamScheduler, DEFAULT_DREAM_SCHEDULER_CONFIG, } from './dream-scheduler.js';
|
|
72
|
+
// ============================================================================
|
|
69
73
|
// Default Export
|
|
70
74
|
// ============================================================================
|
|
71
75
|
export { default } from './dream-engine.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/learning/dream/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AA0CH,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAE1D,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEtE,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E,OAAO,EACL,mBAAmB,EAGnB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AAEnC,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,OAAO,EACL,gBAAgB,EAIhB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAEhC,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,OAAO,EACL,WAAW,EACX,iBAAiB,EAIjB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAE3B,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/learning/dream/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AA0CH,OAAO,EAAE,4BAA4B,EAAE,MAAM,Y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