openclaw-aegis 1.5.3 → 1.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/dist/cli/index.js CHANGED
@@ -162,6 +162,24 @@ var aegisConfigSchema = import_zod.z.object({
162
162
  maxTraces: import_zod.z.number().int().min(10).default(100)
163
163
  }).default({})
164
164
  }).default({}),
165
+ intelligence: import_zod.z.object({
166
+ anomaly: import_zod.z.object({
167
+ enabled: import_zod.z.boolean().default(true),
168
+ minBaseline: import_zod.z.number().int().min(10).default(60),
169
+ baselineWindowMs: import_zod.z.number().int().min(6e4).default(36e5),
170
+ scoreDeviationThreshold: import_zod.z.number().min(1).default(2.5),
171
+ latencyDeviationThreshold: import_zod.z.number().min(1).default(3),
172
+ confirmationCount: import_zod.z.number().int().min(1).default(3),
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)
181
+ }).default({})
182
+ }).default({}),
165
183
  api: import_zod.z.object({
166
184
  enabled: import_zod.z.boolean().default(false),
167
185
  port: import_zod.z.number().int().min(1).max(65535).default(3001),
@@ -2583,6 +2601,9 @@ var AegisApiServer = class {
2583
2601
  this.route("GET", "/sla/:period", this.handleSlaPeriod.bind(this));
2584
2602
  this.route("GET", "/traces", this.handleTraces.bind(this));
2585
2603
  this.route("GET", "/traces/:traceId", this.handleTraceById.bind(this));
2604
+ this.route("GET", "/anomalies", this.handleAnomalies.bind(this));
2605
+ this.route("GET", "/anomalies/baselines", this.handleBaselines.bind(this));
2606
+ this.route("GET", "/predictions", this.handlePredictions.bind(this));
2586
2607
  }
2587
2608
  route(method, path7, handler) {
2588
2609
  const paramNames = [];
@@ -3039,6 +3060,39 @@ var AegisApiServer = class {
3039
3060
  }
3040
3061
  };
3041
3062
  }
3063
+ // --- Intelligence (Phase 5) ---
3064
+ handleAnomalies() {
3065
+ if (!this.deps.anomalyDetector) {
3066
+ return { status: 501, body: { error: "Anomaly detection not available" } };
3067
+ }
3068
+ const anomalies = this.deps.anomalyDetector.getAnomalies();
3069
+ return {
3070
+ status: 200,
3071
+ body: { anomalies, count: anomalies.length }
3072
+ };
3073
+ }
3074
+ handleBaselines() {
3075
+ if (!this.deps.anomalyDetector) {
3076
+ return { status: 501, body: { error: "Anomaly detection not available" } };
3077
+ }
3078
+ return { status: 200, body: this.deps.anomalyDetector.getBaselines() };
3079
+ }
3080
+ handlePredictions() {
3081
+ if (!this.deps.predictiveAlerter) {
3082
+ return { status: 501, body: { error: "Predictive alerts not available" } };
3083
+ }
3084
+ const predictions = this.deps.predictiveAlerter.getPredictions();
3085
+ return {
3086
+ status: 200,
3087
+ body: {
3088
+ predictions: predictions.map((p) => ({
3089
+ ...p,
3090
+ estimatedTimeToThresholdHours: (p.estimatedTimeToThresholdMs / 36e5).toFixed(1)
3091
+ })),
3092
+ count: predictions.length
3093
+ }
3094
+ };
3095
+ }
3042
3096
  // --- Server lifecycle ---
3043
3097
  recordAlertResult(result) {
3044
3098
  this.alertHistory.push({