openclaw-aegis 1.6.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -171,6 +171,13 @@ var aegisConfigSchema = import_zod.z.object({
171
171
  latencyDeviationThreshold: import_zod.z.number().min(1).default(3),
172
172
  confirmationCount: import_zod.z.number().int().min(1).default(3),
173
173
  alertCooldownMs: import_zod.z.number().int().min(6e4).default(9e5)
174
+ }).default({}),
175
+ predictive: import_zod.z.object({
176
+ enabled: import_zod.z.boolean().default(true),
177
+ minDataPoints: import_zod.z.number().int().min(10).default(120),
178
+ trendWindowMs: import_zod.z.number().int().min(6e4).default(72e5),
179
+ warningHorizonMs: import_zod.z.number().int().min(6e4).default(36e5),
180
+ alertCooldownMs: import_zod.z.number().int().min(6e4).default(18e5)
174
181
  }).default({})
175
182
  }).default({}),
176
183
  api: import_zod.z.object({
@@ -2596,6 +2603,9 @@ var AegisApiServer = class {
2596
2603
  this.route("GET", "/traces/:traceId", this.handleTraceById.bind(this));
2597
2604
  this.route("GET", "/anomalies", this.handleAnomalies.bind(this));
2598
2605
  this.route("GET", "/anomalies/baselines", this.handleBaselines.bind(this));
2606
+ this.route("GET", "/predictions", this.handlePredictions.bind(this));
2607
+ this.route("GET", "/rca", this.handleRca.bind(this));
2608
+ this.route("GET", "/rca/:incidentId", this.handleRcaByIncident.bind(this));
2599
2609
  }
2600
2610
  route(method, path7, handler) {
2601
2611
  const paramNames = [];
@@ -3069,6 +3079,64 @@ var AegisApiServer = class {
3069
3079
  }
3070
3080
  return { status: 200, body: this.deps.anomalyDetector.getBaselines() };
3071
3081
  }
3082
+ handleRca() {
3083
+ if (!this.deps.rootCauseAnalyzer) {
3084
+ return { status: 501, body: { error: "Root cause analysis not available" } };
3085
+ }
3086
+ const results = this.deps.rootCauseAnalyzer.analyze();
3087
+ return {
3088
+ status: 200,
3089
+ body: {
3090
+ candidates: results.map((r) => ({
3091
+ rootCause: r.rootCause,
3092
+ confidence: (r.confidence * 100).toFixed(0) + "%",
3093
+ evidence: r.evidence,
3094
+ suggestion: r.suggestion,
3095
+ correlatedProbes: r.correlatedProbes
3096
+ })),
3097
+ count: results.length
3098
+ }
3099
+ };
3100
+ }
3101
+ handleRcaByIncident(params) {
3102
+ if (!this.deps.rootCauseAnalyzer) {
3103
+ return { status: 501, body: { error: "Root cause analysis not available" } };
3104
+ }
3105
+ const results = this.deps.rootCauseAnalyzer.analyzeIncident(params.incidentId);
3106
+ if (results.length === 0) {
3107
+ return { status: 404, body: { error: `No RCA results for incident '${params.incidentId}'` } };
3108
+ }
3109
+ return {
3110
+ status: 200,
3111
+ body: {
3112
+ incidentId: params.incidentId,
3113
+ candidates: results.map((r) => ({
3114
+ rootCause: r.rootCause,
3115
+ confidence: (r.confidence * 100).toFixed(0) + "%",
3116
+ evidence: r.evidence,
3117
+ suggestion: r.suggestion,
3118
+ correlatedProbes: r.correlatedProbes
3119
+ })),
3120
+ count: results.length
3121
+ }
3122
+ };
3123
+ }
3124
+ handlePredictions() {
3125
+ if (!this.deps.predictiveAlerter) {
3126
+ return { status: 501, body: { error: "Predictive alerts not available" } };
3127
+ }
3128
+ const predictions = this.deps.predictiveAlerter.getPredictions();
3129
+ return {
3130
+ status: 200,
3131
+ body: {
3132
+ predictions: predictions.map((p) => ({
3133
+ ...p,
3134
+ estimatedTimeToThresholdHours: (p.estimatedTimeToThresholdMs / 36e5).toFixed(1)
3135
+ })),
3136
+ count: predictions.length
3137
+ }
3138
+ };
3139
+ }
3072
3140
  // --- Server lifecycle ---
3073
3141
  recordAlertResult(result) {
3074
3142
  this.alertHistory.push({