@agent-e/core 1.5.13 → 1.6.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/index.mjs CHANGED
@@ -3257,6 +3257,16 @@ var DecisionLog = class {
3257
3257
  return true;
3258
3258
  });
3259
3259
  }
3260
+ getById(id) {
3261
+ return this.entries.find((e) => e.id === id);
3262
+ }
3263
+ updateResult(id, newResult, reasoning) {
3264
+ const entry = this.entries.find((e) => e.id === id);
3265
+ if (!entry) return false;
3266
+ entry.result = newResult;
3267
+ if (reasoning !== void 0) entry.reasoning = reasoning;
3268
+ return true;
3269
+ }
3260
3270
  latest(n = 30) {
3261
3271
  return this.entries.slice(-n).reverse();
3262
3272
  }
@@ -3409,6 +3419,35 @@ var MetricStore = class {
3409
3419
  }));
3410
3420
  return { metric: q.metric, resolution, points };
3411
3421
  }
3422
+ /** Summarized recent history for dashboard charts */
3423
+ recentHistory(count = 100) {
3424
+ const all = this.fine.toArray();
3425
+ const slice = all.slice(-count);
3426
+ return slice.map((m) => {
3427
+ let health = 100;
3428
+ if (m.avgSatisfaction < 65) health -= 15;
3429
+ if (m.avgSatisfaction < 50) health -= 10;
3430
+ if (m.giniCoefficient > 0.45) health -= 15;
3431
+ if (m.giniCoefficient > 0.6) health -= 10;
3432
+ if (Math.abs(m.netFlow) > 10) health -= 15;
3433
+ if (Math.abs(m.netFlow) > 20) health -= 10;
3434
+ if (m.churnRate > 0.05) health -= 15;
3435
+ health = Math.max(0, Math.min(100, health));
3436
+ return {
3437
+ tick: m.tick,
3438
+ health,
3439
+ giniCoefficient: m.giniCoefficient,
3440
+ totalSupply: m.totalSupply,
3441
+ netFlow: m.netFlow,
3442
+ velocity: m.velocity,
3443
+ inflationRate: m.inflationRate,
3444
+ avgSatisfaction: m.avgSatisfaction,
3445
+ churnRate: m.churnRate,
3446
+ totalAgents: m.totalAgents,
3447
+ priceIndex: m.priceIndex
3448
+ };
3449
+ });
3450
+ }
3412
3451
  /** Check if fine and coarse resolution metrics diverge significantly */
3413
3452
  divergenceDetected() {
3414
3453
  const f = this.fine.last();