agentic-qe 3.6.19 → 3.7.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/skills-manifest.json +1 -1
- package/README.md +29 -1
- package/package.json +2 -1
- package/scripts/rvf-baseline-benchmark.ts +843 -0
- package/v3/CHANGELOG.md +30 -0
- package/v3/dist/audit/witness-chain.d.ts +148 -0
- package/v3/dist/audit/witness-chain.d.ts.map +1 -0
- package/v3/dist/audit/witness-chain.js +269 -0
- package/v3/dist/audit/witness-chain.js.map +1 -0
- package/v3/dist/cli/brain-commands.d.ts +39 -0
- package/v3/dist/cli/brain-commands.d.ts.map +1 -0
- package/v3/dist/cli/brain-commands.js +60 -0
- package/v3/dist/cli/brain-commands.js.map +1 -0
- package/v3/dist/cli/bundle.js +4509 -2452
- package/v3/dist/cli/command-registry.d.ts.map +1 -1
- package/v3/dist/cli/command-registry.js +3 -1
- package/v3/dist/cli/command-registry.js.map +1 -1
- package/v3/dist/cli/handlers/brain-handler.d.ts +22 -0
- package/v3/dist/cli/handlers/brain-handler.d.ts.map +1 -0
- package/v3/dist/cli/handlers/brain-handler.js +148 -0
- package/v3/dist/cli/handlers/brain-handler.js.map +1 -0
- package/v3/dist/cli/handlers/index.d.ts +1 -0
- package/v3/dist/cli/handlers/index.d.ts.map +1 -1
- package/v3/dist/cli/handlers/index.js +1 -0
- package/v3/dist/cli/handlers/index.js.map +1 -1
- package/v3/dist/domains/coverage-analysis/services/hnsw-index.d.ts +31 -44
- package/v3/dist/domains/coverage-analysis/services/hnsw-index.d.ts.map +1 -1
- package/v3/dist/domains/coverage-analysis/services/hnsw-index.js +73 -178
- package/v3/dist/domains/coverage-analysis/services/hnsw-index.js.map +1 -1
- package/v3/dist/domains/quality-assessment/coordinator.d.ts.map +1 -1
- package/v3/dist/domains/quality-assessment/coordinator.js +8 -0
- package/v3/dist/domains/quality-assessment/coordinator.js.map +1 -1
- package/v3/dist/domains/test-execution/coordinator.d.ts +14 -0
- package/v3/dist/domains/test-execution/coordinator.d.ts.map +1 -1
- package/v3/dist/domains/test-execution/coordinator.js +18 -0
- package/v3/dist/domains/test-execution/coordinator.js.map +1 -1
- package/v3/dist/domains/test-execution/services/index.d.ts +1 -0
- package/v3/dist/domains/test-execution/services/index.d.ts.map +1 -1
- package/v3/dist/domains/test-execution/services/index.js +1 -0
- package/v3/dist/domains/test-execution/services/index.js.map +1 -1
- package/v3/dist/domains/test-execution/services/mincut-test-optimizer.d.ts +118 -0
- package/v3/dist/domains/test-execution/services/mincut-test-optimizer.d.ts.map +1 -0
- package/v3/dist/domains/test-execution/services/mincut-test-optimizer.js +358 -0
- package/v3/dist/domains/test-execution/services/mincut-test-optimizer.js.map +1 -0
- package/v3/dist/integrations/ruvector/brain-exporter.d.ts +66 -0
- package/v3/dist/integrations/ruvector/brain-exporter.d.ts.map +1 -0
- package/v3/dist/integrations/ruvector/brain-exporter.js +537 -0
- package/v3/dist/integrations/ruvector/brain-exporter.js.map +1 -0
- package/v3/dist/integrations/ruvector/index.d.ts +4 -0
- package/v3/dist/integrations/ruvector/index.d.ts.map +1 -1
- package/v3/dist/integrations/ruvector/index.js +5 -0
- package/v3/dist/integrations/ruvector/index.js.map +1 -1
- package/v3/dist/integrations/ruvector/mincut-wrapper.d.ts +204 -0
- package/v3/dist/integrations/ruvector/mincut-wrapper.d.ts.map +1 -0
- package/v3/dist/integrations/ruvector/mincut-wrapper.js +310 -0
- package/v3/dist/integrations/ruvector/mincut-wrapper.js.map +1 -0
- package/v3/dist/integrations/ruvector/rvf-dual-writer.d.ts +141 -0
- package/v3/dist/integrations/ruvector/rvf-dual-writer.d.ts.map +1 -0
- package/v3/dist/integrations/ruvector/rvf-dual-writer.js +367 -0
- package/v3/dist/integrations/ruvector/rvf-dual-writer.js.map +1 -0
- package/v3/dist/integrations/ruvector/rvf-native-adapter.d.ts +60 -0
- package/v3/dist/integrations/ruvector/rvf-native-adapter.d.ts.map +1 -0
- package/v3/dist/integrations/ruvector/rvf-native-adapter.js +240 -0
- package/v3/dist/integrations/ruvector/rvf-native-adapter.js.map +1 -0
- package/v3/dist/kernel/hnsw-adapter.d.ts +99 -0
- package/v3/dist/kernel/hnsw-adapter.d.ts.map +1 -0
- package/v3/dist/kernel/hnsw-adapter.js +218 -0
- package/v3/dist/kernel/hnsw-adapter.js.map +1 -0
- package/v3/dist/kernel/hnsw-index-provider.d.ts +90 -0
- package/v3/dist/kernel/hnsw-index-provider.d.ts.map +1 -0
- package/v3/dist/kernel/hnsw-index-provider.js +23 -0
- package/v3/dist/kernel/hnsw-index-provider.js.map +1 -0
- package/v3/dist/kernel/progressive-hnsw-backend.d.ts +67 -0
- package/v3/dist/kernel/progressive-hnsw-backend.d.ts.map +1 -0
- package/v3/dist/kernel/progressive-hnsw-backend.js +266 -0
- package/v3/dist/kernel/progressive-hnsw-backend.js.map +1 -0
- package/v3/dist/kernel/unified-memory-hnsw.d.ts +71 -0
- package/v3/dist/kernel/unified-memory-hnsw.d.ts.map +1 -1
- package/v3/dist/kernel/unified-memory-hnsw.js +87 -0
- package/v3/dist/kernel/unified-memory-hnsw.js.map +1 -1
- package/v3/dist/kernel/unified-memory-schemas.d.ts +1 -0
- package/v3/dist/kernel/unified-memory-schemas.d.ts.map +1 -1
- package/v3/dist/kernel/unified-memory-schemas.js +16 -0
- package/v3/dist/kernel/unified-memory-schemas.js.map +1 -1
- package/v3/dist/learning/dream/dream-engine.d.ts +16 -0
- package/v3/dist/learning/dream/dream-engine.d.ts.map +1 -1
- package/v3/dist/learning/dream/dream-engine.js +70 -0
- package/v3/dist/learning/dream/dream-engine.js.map +1 -1
- package/v3/dist/learning/dream/index.d.ts +2 -0
- package/v3/dist/learning/dream/index.d.ts.map +1 -1
- package/v3/dist/learning/dream/index.js +8 -0
- package/v3/dist/learning/dream/index.js.map +1 -1
- package/v3/dist/learning/dream/rvcow-branch-manager.d.ts +170 -0
- package/v3/dist/learning/dream/rvcow-branch-manager.d.ts.map +1 -0
- package/v3/dist/learning/dream/rvcow-branch-manager.js +263 -0
- package/v3/dist/learning/dream/rvcow-branch-manager.js.map +1 -0
- package/v3/dist/learning/dream/speculative-dreamer.d.ts +129 -0
- package/v3/dist/learning/dream/speculative-dreamer.d.ts.map +1 -0
- package/v3/dist/learning/dream/speculative-dreamer.js +214 -0
- package/v3/dist/learning/dream/speculative-dreamer.js.map +1 -0
- package/v3/dist/learning/qe-reasoning-bank.d.ts +9 -0
- package/v3/dist/learning/qe-reasoning-bank.d.ts.map +1 -1
- package/v3/dist/learning/qe-reasoning-bank.js +50 -1
- package/v3/dist/learning/qe-reasoning-bank.js.map +1 -1
- package/v3/dist/mcp/bundle.js +8900 -7163
- package/v3/dist/mcp/services/mincut-routing-service.d.ts +148 -0
- package/v3/dist/mcp/services/mincut-routing-service.d.ts.map +1 -0
- package/v3/dist/mcp/services/mincut-routing-service.js +198 -0
- package/v3/dist/mcp/services/mincut-routing-service.js.map +1 -0
- package/v3/dist/mcp/services/task-router.d.ts +4 -0
- package/v3/dist/mcp/services/task-router.d.ts.map +1 -1
- package/v3/dist/mcp/services/task-router.js +57 -15
- package/v3/dist/mcp/services/task-router.js.map +1 -1
- package/v3/dist/monitoring/structural-health.d.ts +142 -0
- package/v3/dist/monitoring/structural-health.d.ts.map +1 -0
- package/v3/dist/monitoring/structural-health.js +201 -0
- package/v3/dist/monitoring/structural-health.js.map +1 -0
- package/v3/package.json +1 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Structural Health Monitor
|
|
3
|
+
* ADR-068: Mincut-Gated Model Routing
|
|
4
|
+
*
|
|
5
|
+
* Computes structural health of the agent fleet using mincut lambda.
|
|
6
|
+
* Low lambda = fragile fleet topology, high lambda = robust.
|
|
7
|
+
*
|
|
8
|
+
* @module monitoring/structural-health
|
|
9
|
+
*/
|
|
10
|
+
import { QEMinCutService, type AgentNode, type TaskGraph } from '../integrations/ruvector/mincut-wrapper.js';
|
|
11
|
+
/**
|
|
12
|
+
* Fleet health result
|
|
13
|
+
*/
|
|
14
|
+
export interface FleetHealthResult {
|
|
15
|
+
/** Raw mincut lambda value */
|
|
16
|
+
readonly lambda: number;
|
|
17
|
+
/** Whether the fleet is structurally healthy */
|
|
18
|
+
readonly healthy: boolean;
|
|
19
|
+
/** Weak points in the fleet topology (agent IDs) */
|
|
20
|
+
readonly weakPoints: string[];
|
|
21
|
+
/** Normalized lambda (0-1, higher = healthier) */
|
|
22
|
+
readonly normalizedLambda: number;
|
|
23
|
+
/** Risk score (0-1, higher = riskier) */
|
|
24
|
+
readonly riskScore: number;
|
|
25
|
+
/** Human-readable status */
|
|
26
|
+
readonly status: 'healthy' | 'warning' | 'critical' | 'empty';
|
|
27
|
+
/** Suggestions for improving fleet health */
|
|
28
|
+
readonly suggestions: string[];
|
|
29
|
+
/** Timestamp of measurement */
|
|
30
|
+
readonly measuredAt: Date;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* History entry for tracking health over time
|
|
34
|
+
*/
|
|
35
|
+
export interface HealthHistoryEntry {
|
|
36
|
+
/** Lambda value at measurement time */
|
|
37
|
+
readonly lambda: number;
|
|
38
|
+
/** Whether fleet was healthy */
|
|
39
|
+
readonly healthy: boolean;
|
|
40
|
+
/** Number of weak points */
|
|
41
|
+
readonly weakPointCount: number;
|
|
42
|
+
/** Agent count at measurement time */
|
|
43
|
+
readonly agentCount: number;
|
|
44
|
+
/** Timestamp */
|
|
45
|
+
readonly timestamp: Date;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Configuration for the Structural Health Monitor
|
|
49
|
+
*/
|
|
50
|
+
export interface StructuralHealthConfig {
|
|
51
|
+
/** Lambda threshold for healthy status (default: 0.4) */
|
|
52
|
+
readonly healthyThreshold: number;
|
|
53
|
+
/** Lambda threshold for warning vs critical (default: 0.2) */
|
|
54
|
+
readonly warningThreshold: number;
|
|
55
|
+
/** Maximum history entries to retain (default: 100) */
|
|
56
|
+
readonly maxHistoryEntries: number;
|
|
57
|
+
/** Whether to log health checks to stderr (default: false) */
|
|
58
|
+
readonly enableLogging: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Default configuration
|
|
62
|
+
*/
|
|
63
|
+
export declare const DEFAULT_STRUCTURAL_HEALTH_CONFIG: StructuralHealthConfig;
|
|
64
|
+
/**
|
|
65
|
+
* Structural Health Monitor
|
|
66
|
+
*
|
|
67
|
+
* Monitors the structural health of the agent fleet by computing
|
|
68
|
+
* mincut lambda values. Tracks health history over time and identifies
|
|
69
|
+
* trends.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const monitor = new StructuralHealthMonitor();
|
|
74
|
+
* const health = monitor.computeFleetHealth(agents);
|
|
75
|
+
* if (!health.healthy) {
|
|
76
|
+
* console.warn(`Fleet fragile: ${health.weakPoints.join(', ')}`);
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare class StructuralHealthMonitor {
|
|
81
|
+
private readonly config;
|
|
82
|
+
private readonly minCutService;
|
|
83
|
+
private readonly history;
|
|
84
|
+
constructor(config?: Partial<StructuralHealthConfig>);
|
|
85
|
+
/**
|
|
86
|
+
* Compute fleet health from an array of agent nodes
|
|
87
|
+
*
|
|
88
|
+
* @param agents - Current agent fleet
|
|
89
|
+
* @returns Fleet health result
|
|
90
|
+
*/
|
|
91
|
+
computeFleetHealth(agents: AgentNode[]): FleetHealthResult;
|
|
92
|
+
/**
|
|
93
|
+
* Compute fleet health from a pre-built task graph
|
|
94
|
+
*
|
|
95
|
+
* @param graph - Task graph representing the fleet
|
|
96
|
+
* @param agentCount - Number of agents (for history tracking)
|
|
97
|
+
* @returns Fleet health result
|
|
98
|
+
*/
|
|
99
|
+
computeFleetHealthFromGraph(graph: TaskGraph, agentCount?: number): FleetHealthResult;
|
|
100
|
+
/**
|
|
101
|
+
* Get health trend from history
|
|
102
|
+
*
|
|
103
|
+
* @returns 'improving', 'stable', or 'degrading'
|
|
104
|
+
*/
|
|
105
|
+
getTrend(): 'improving' | 'stable' | 'degrading';
|
|
106
|
+
/**
|
|
107
|
+
* Get health history
|
|
108
|
+
*
|
|
109
|
+
* @param limit - Maximum entries to return
|
|
110
|
+
* @returns Array of history entries, most recent last
|
|
111
|
+
*/
|
|
112
|
+
getHistory(limit?: number): HealthHistoryEntry[];
|
|
113
|
+
/**
|
|
114
|
+
* Clear health history
|
|
115
|
+
*/
|
|
116
|
+
clearHistory(): void;
|
|
117
|
+
/**
|
|
118
|
+
* Get the underlying QEMinCutService
|
|
119
|
+
*/
|
|
120
|
+
getMinCutService(): QEMinCutService;
|
|
121
|
+
/**
|
|
122
|
+
* Determine status string from normalized lambda
|
|
123
|
+
*/
|
|
124
|
+
private determineStatus;
|
|
125
|
+
/**
|
|
126
|
+
* Add an entry to the history, trimming if over limit
|
|
127
|
+
*/
|
|
128
|
+
private addHistoryEntry;
|
|
129
|
+
/**
|
|
130
|
+
* Create result for empty fleet
|
|
131
|
+
*/
|
|
132
|
+
private emptyFleetResult;
|
|
133
|
+
/**
|
|
134
|
+
* Log health check result to stderr
|
|
135
|
+
*/
|
|
136
|
+
private logHealth;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Create a StructuralHealthMonitor instance
|
|
140
|
+
*/
|
|
141
|
+
export declare function createStructuralHealthMonitor(config?: Partial<StructuralHealthConfig>): StructuralHealthMonitor;
|
|
142
|
+
//# sourceMappingURL=structural-health.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structural-health.d.ts","sourceRoot":"","sources":["../../src/monitoring/structural-health.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,eAAe,EAEf,KAAK,SAAS,EACd,KAAK,SAAS,EAEf,MAAM,4CAA4C,CAAC;AAMpD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,8BAA8B;IAC9B,QAAQ,CAAC,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OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyB;IAChD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkB;IAChD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;gBAExC,MAAM,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC;IAKpD;;;;;OAKG;IACH,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,iBAAiB;IAU1D;;;;;;OAMG;IACH,2BAA2B,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,iBAAiB;IAmCrF;;;;OAIG;IACH,QAAQ,IAAI,WAAW,GAAG,QAAQ,GAAG,WAAW;IAoBhD;;;;;OAKG;IACH,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAQhD;;OAEG;IACH,YAAY,IAAI,IAAI;IAIpB;;OAEG;IACH,gBAAgB,IAAI,eAAe;IAQnC;;OAEG;IACH,OAAO,CAAC,eAAe;IAYvB;;OAEG;IACH,OAAO,CAAC,eAAe;IAOvB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAaxB;;OAEG;IACH,OAAO,CAAC,SAAS;CAQlB;AAMD;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,GACvC,uBAAuB,CAEzB"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Structural Health Monitor
|
|
3
|
+
* ADR-068: Mincut-Gated Model Routing
|
|
4
|
+
*
|
|
5
|
+
* Computes structural health of the agent fleet using mincut lambda.
|
|
6
|
+
* Low lambda = fragile fleet topology, high lambda = robust.
|
|
7
|
+
*
|
|
8
|
+
* @module monitoring/structural-health
|
|
9
|
+
*/
|
|
10
|
+
import { createQEMinCutService, } from '../integrations/ruvector/mincut-wrapper.js';
|
|
11
|
+
/**
|
|
12
|
+
* Default configuration
|
|
13
|
+
*/
|
|
14
|
+
export const DEFAULT_STRUCTURAL_HEALTH_CONFIG = {
|
|
15
|
+
healthyThreshold: 0.4,
|
|
16
|
+
warningThreshold: 0.2,
|
|
17
|
+
maxHistoryEntries: 100,
|
|
18
|
+
enableLogging: false,
|
|
19
|
+
};
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// StructuralHealthMonitor
|
|
22
|
+
// ============================================================================
|
|
23
|
+
/**
|
|
24
|
+
* Structural Health Monitor
|
|
25
|
+
*
|
|
26
|
+
* Monitors the structural health of the agent fleet by computing
|
|
27
|
+
* mincut lambda values. Tracks health history over time and identifies
|
|
28
|
+
* trends.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const monitor = new StructuralHealthMonitor();
|
|
33
|
+
* const health = monitor.computeFleetHealth(agents);
|
|
34
|
+
* if (!health.healthy) {
|
|
35
|
+
* console.warn(`Fleet fragile: ${health.weakPoints.join(', ')}`);
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export class StructuralHealthMonitor {
|
|
40
|
+
config;
|
|
41
|
+
minCutService;
|
|
42
|
+
history = [];
|
|
43
|
+
constructor(config) {
|
|
44
|
+
this.config = { ...DEFAULT_STRUCTURAL_HEALTH_CONFIG, ...config };
|
|
45
|
+
this.minCutService = createQEMinCutService();
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Compute fleet health from an array of agent nodes
|
|
49
|
+
*
|
|
50
|
+
* @param agents - Current agent fleet
|
|
51
|
+
* @returns Fleet health result
|
|
52
|
+
*/
|
|
53
|
+
computeFleetHealth(agents) {
|
|
54
|
+
if (agents.length === 0) {
|
|
55
|
+
return this.emptyFleetResult();
|
|
56
|
+
}
|
|
57
|
+
// Build a task graph and analyze structural health
|
|
58
|
+
const graph = this.minCutService.buildTaskGraphFromTopology(agents);
|
|
59
|
+
return this.computeFleetHealthFromGraph(graph, agents.length);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Compute fleet health from a pre-built task graph
|
|
63
|
+
*
|
|
64
|
+
* @param graph - Task graph representing the fleet
|
|
65
|
+
* @param agentCount - Number of agents (for history tracking)
|
|
66
|
+
* @returns Fleet health result
|
|
67
|
+
*/
|
|
68
|
+
computeFleetHealthFromGraph(graph, agentCount) {
|
|
69
|
+
if (graph.nodes.length === 0) {
|
|
70
|
+
return this.emptyFleetResult();
|
|
71
|
+
}
|
|
72
|
+
const healthReport = this.minCutService.getStructuralHealth(graph);
|
|
73
|
+
const status = this.determineStatus(healthReport.normalizedLambda);
|
|
74
|
+
const result = {
|
|
75
|
+
lambda: healthReport.lambda,
|
|
76
|
+
healthy: healthReport.healthy,
|
|
77
|
+
weakPoints: healthReport.weakPoints,
|
|
78
|
+
normalizedLambda: healthReport.normalizedLambda,
|
|
79
|
+
riskScore: healthReport.riskScore,
|
|
80
|
+
status,
|
|
81
|
+
suggestions: healthReport.suggestions,
|
|
82
|
+
measuredAt: new Date(),
|
|
83
|
+
};
|
|
84
|
+
// Record history
|
|
85
|
+
this.addHistoryEntry({
|
|
86
|
+
lambda: healthReport.lambda,
|
|
87
|
+
healthy: healthReport.healthy,
|
|
88
|
+
weakPointCount: healthReport.weakPoints.length,
|
|
89
|
+
agentCount: agentCount ?? graph.nodes.length,
|
|
90
|
+
timestamp: result.measuredAt,
|
|
91
|
+
});
|
|
92
|
+
if (this.config.enableLogging) {
|
|
93
|
+
this.logHealth(result);
|
|
94
|
+
}
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get health trend from history
|
|
99
|
+
*
|
|
100
|
+
* @returns 'improving', 'stable', or 'degrading'
|
|
101
|
+
*/
|
|
102
|
+
getTrend() {
|
|
103
|
+
if (this.history.length < 2) {
|
|
104
|
+
return 'stable';
|
|
105
|
+
}
|
|
106
|
+
// Compare last 5 entries (or fewer if not enough history)
|
|
107
|
+
const recentCount = Math.min(5, this.history.length);
|
|
108
|
+
const recent = this.history.slice(-recentCount);
|
|
109
|
+
const firstLambda = recent[0].lambda;
|
|
110
|
+
const lastLambda = recent[recent.length - 1].lambda;
|
|
111
|
+
const delta = lastLambda - firstLambda;
|
|
112
|
+
// Tolerance of 0.05 for "stable"
|
|
113
|
+
if (Math.abs(delta) < 0.05) {
|
|
114
|
+
return 'stable';
|
|
115
|
+
}
|
|
116
|
+
return delta > 0 ? 'improving' : 'degrading';
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get health history
|
|
120
|
+
*
|
|
121
|
+
* @param limit - Maximum entries to return
|
|
122
|
+
* @returns Array of history entries, most recent last
|
|
123
|
+
*/
|
|
124
|
+
getHistory(limit) {
|
|
125
|
+
const entries = [...this.history];
|
|
126
|
+
if (limit !== undefined && limit < entries.length) {
|
|
127
|
+
return entries.slice(-limit);
|
|
128
|
+
}
|
|
129
|
+
return entries;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Clear health history
|
|
133
|
+
*/
|
|
134
|
+
clearHistory() {
|
|
135
|
+
this.history.length = 0;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Get the underlying QEMinCutService
|
|
139
|
+
*/
|
|
140
|
+
getMinCutService() {
|
|
141
|
+
return this.minCutService;
|
|
142
|
+
}
|
|
143
|
+
// ==========================================================================
|
|
144
|
+
// Private Helpers
|
|
145
|
+
// ==========================================================================
|
|
146
|
+
/**
|
|
147
|
+
* Determine status string from normalized lambda
|
|
148
|
+
*/
|
|
149
|
+
determineStatus(normalizedLambda) {
|
|
150
|
+
if (normalizedLambda >= this.config.healthyThreshold) {
|
|
151
|
+
return 'healthy';
|
|
152
|
+
}
|
|
153
|
+
if (normalizedLambda >= this.config.warningThreshold) {
|
|
154
|
+
return 'warning';
|
|
155
|
+
}
|
|
156
|
+
return 'critical';
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Add an entry to the history, trimming if over limit
|
|
160
|
+
*/
|
|
161
|
+
addHistoryEntry(entry) {
|
|
162
|
+
this.history.push(entry);
|
|
163
|
+
if (this.history.length > this.config.maxHistoryEntries) {
|
|
164
|
+
this.history.splice(0, this.history.length - this.config.maxHistoryEntries);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Create result for empty fleet
|
|
169
|
+
*/
|
|
170
|
+
emptyFleetResult() {
|
|
171
|
+
return {
|
|
172
|
+
lambda: 0,
|
|
173
|
+
healthy: false,
|
|
174
|
+
weakPoints: [],
|
|
175
|
+
normalizedLambda: 0,
|
|
176
|
+
riskScore: 1.0,
|
|
177
|
+
status: 'empty',
|
|
178
|
+
suggestions: ['No agents in fleet. Spawn agents to build a topology.'],
|
|
179
|
+
measuredAt: new Date(),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Log health check result to stderr
|
|
184
|
+
*/
|
|
185
|
+
logHealth(result) {
|
|
186
|
+
console.error(`[StructuralHealth] Status: ${result.status} | ` +
|
|
187
|
+
`Lambda: ${result.normalizedLambda.toFixed(3)} | ` +
|
|
188
|
+
`Weak points: ${result.weakPoints.length} | ` +
|
|
189
|
+
`Risk: ${(result.riskScore * 100).toFixed(0)}%`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// ============================================================================
|
|
193
|
+
// Factory
|
|
194
|
+
// ============================================================================
|
|
195
|
+
/**
|
|
196
|
+
* Create a StructuralHealthMonitor instance
|
|
197
|
+
*/
|
|
198
|
+
export function createStructuralHealthMonitor(config) {
|
|
199
|
+
return new StructuralHealthMonitor(config);
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=structural-health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structural-health.js","sourceRoot":"","sources":["../../src/monitoring/structural-health.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEL,qBAAqB,GAItB,MAAM,4CAA4C,CAAC;AAwEpD;;GAEG;AACH,MAAM,CAAC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,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAC9E,CAAC;IACH,CAAC;IAED;;OAEG;IACK,gBAAgB;QACtB,OAAO;YACL,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,KAAK;YACd,UAAU,EAAE,EAAE;YACd,gBAAgB,EAAE,CAAC;YACnB,SAAS,EAAE,GAAG;YACd,MAAM,EAAE,OAAO;YACf,WAAW,EAAE,CAAC,uDAAuD,CAAC;YACtE,UAAU,EAAE,IAAI,IAAI,EAAE;SACvB,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,SAAS,CAAC,MAAyB;QACzC,OAAO,CAAC,KAAK,CACX,8BAA8B,MAAM,CAAC,MAAM,KAAK;YAChD,WAAW,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK;YAClD,gBAAgB,MAAM,CAAC,UAAU,CAAC,MAAM,KAAK;YAC7C,SAAS,CAAC,MAAM,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAChD,CAAC;IACJ,CAAC;CACF;AAED,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,MAAwC;IAExC,OAAO,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC"}
|
package/v3/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentic-qe/v3",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "Agentic QE v3 - Domain-Driven Design Architecture with 13 Bounded Contexts, O(log n) coverage analysis, ReasoningBank learning, 59 specialized QE agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|