@agent-e/core 1.5.13 → 1.6.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/dist/index.d.mts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -243,7 +243,7 @@ interface SimulationResult {
|
|
|
243
243
|
estimatedEffectTick: number;
|
|
244
244
|
overshootRisk: number;
|
|
245
245
|
}
|
|
246
|
-
type DecisionResult = 'applied' | 'skipped_cooldown' | 'skipped_simulation_failed' | 'skipped_locked' | 'skipped_override' | 'rolled_back';
|
|
246
|
+
type DecisionResult = 'applied' | 'skipped_cooldown' | 'skipped_simulation_failed' | 'skipped_locked' | 'skipped_override' | 'rolled_back' | 'rejected';
|
|
247
247
|
interface DecisionEntry {
|
|
248
248
|
id: string;
|
|
249
249
|
tick: number;
|
|
@@ -413,6 +413,8 @@ declare class DecisionLog {
|
|
|
413
413
|
parameter?: string;
|
|
414
414
|
result?: DecisionResult;
|
|
415
415
|
}): DecisionEntry[];
|
|
416
|
+
getById(id: string): DecisionEntry | undefined;
|
|
417
|
+
updateResult(id: string, newResult: DecisionResult, reasoning?: string): boolean;
|
|
416
418
|
latest(n?: number): DecisionEntry[];
|
|
417
419
|
export(format?: 'json' | 'text'): string;
|
|
418
420
|
private buildReasoning;
|
|
@@ -436,6 +438,20 @@ declare class MetricStore {
|
|
|
436
438
|
record(metrics: EconomyMetrics): void;
|
|
437
439
|
latest(resolution?: MetricResolution): EconomyMetrics;
|
|
438
440
|
query(q: MetricQuery): MetricQueryResult;
|
|
441
|
+
/** Summarized recent history for dashboard charts */
|
|
442
|
+
recentHistory(count?: number): Array<{
|
|
443
|
+
tick: number;
|
|
444
|
+
health: number;
|
|
445
|
+
giniCoefficient: number;
|
|
446
|
+
totalSupply: number;
|
|
447
|
+
netFlow: number;
|
|
448
|
+
velocity: number;
|
|
449
|
+
inflationRate: number;
|
|
450
|
+
avgSatisfaction: number;
|
|
451
|
+
churnRate: number;
|
|
452
|
+
totalAgents: number;
|
|
453
|
+
priceIndex: number;
|
|
454
|
+
}>;
|
|
439
455
|
/** Check if fine and coarse resolution metrics diverge significantly */
|
|
440
456
|
divergenceDetected(): boolean;
|
|
441
457
|
private bufferFor;
|
package/dist/index.d.ts
CHANGED
|
@@ -243,7 +243,7 @@ interface SimulationResult {
|
|
|
243
243
|
estimatedEffectTick: number;
|
|
244
244
|
overshootRisk: number;
|
|
245
245
|
}
|
|
246
|
-
type DecisionResult = 'applied' | 'skipped_cooldown' | 'skipped_simulation_failed' | 'skipped_locked' | 'skipped_override' | 'rolled_back';
|
|
246
|
+
type DecisionResult = 'applied' | 'skipped_cooldown' | 'skipped_simulation_failed' | 'skipped_locked' | 'skipped_override' | 'rolled_back' | 'rejected';
|
|
247
247
|
interface DecisionEntry {
|
|
248
248
|
id: string;
|
|
249
249
|
tick: number;
|
|
@@ -413,6 +413,8 @@ declare class DecisionLog {
|
|
|
413
413
|
parameter?: string;
|
|
414
414
|
result?: DecisionResult;
|
|
415
415
|
}): DecisionEntry[];
|
|
416
|
+
getById(id: string): DecisionEntry | undefined;
|
|
417
|
+
updateResult(id: string, newResult: DecisionResult, reasoning?: string): boolean;
|
|
416
418
|
latest(n?: number): DecisionEntry[];
|
|
417
419
|
export(format?: 'json' | 'text'): string;
|
|
418
420
|
private buildReasoning;
|
|
@@ -436,6 +438,20 @@ declare class MetricStore {
|
|
|
436
438
|
record(metrics: EconomyMetrics): void;
|
|
437
439
|
latest(resolution?: MetricResolution): EconomyMetrics;
|
|
438
440
|
query(q: MetricQuery): MetricQueryResult;
|
|
441
|
+
/** Summarized recent history for dashboard charts */
|
|
442
|
+
recentHistory(count?: number): Array<{
|
|
443
|
+
tick: number;
|
|
444
|
+
health: number;
|
|
445
|
+
giniCoefficient: number;
|
|
446
|
+
totalSupply: number;
|
|
447
|
+
netFlow: number;
|
|
448
|
+
velocity: number;
|
|
449
|
+
inflationRate: number;
|
|
450
|
+
avgSatisfaction: number;
|
|
451
|
+
churnRate: number;
|
|
452
|
+
totalAgents: number;
|
|
453
|
+
priceIndex: number;
|
|
454
|
+
}>;
|
|
439
455
|
/** Check if fine and coarse resolution metrics diverge significantly */
|
|
440
456
|
divergenceDetected(): boolean;
|
|
441
457
|
private bufferFor;
|
package/dist/index.js
CHANGED
|
@@ -3373,6 +3373,16 @@ var DecisionLog = class {
|
|
|
3373
3373
|
return true;
|
|
3374
3374
|
});
|
|
3375
3375
|
}
|
|
3376
|
+
getById(id) {
|
|
3377
|
+
return this.entries.find((e) => e.id === id);
|
|
3378
|
+
}
|
|
3379
|
+
updateResult(id, newResult, reasoning) {
|
|
3380
|
+
const entry = this.entries.find((e) => e.id === id);
|
|
3381
|
+
if (!entry) return false;
|
|
3382
|
+
entry.result = newResult;
|
|
3383
|
+
if (reasoning !== void 0) entry.reasoning = reasoning;
|
|
3384
|
+
return true;
|
|
3385
|
+
}
|
|
3376
3386
|
latest(n = 30) {
|
|
3377
3387
|
return this.entries.slice(-n).reverse();
|
|
3378
3388
|
}
|
|
@@ -3525,6 +3535,35 @@ var MetricStore = class {
|
|
|
3525
3535
|
}));
|
|
3526
3536
|
return { metric: q.metric, resolution, points };
|
|
3527
3537
|
}
|
|
3538
|
+
/** Summarized recent history for dashboard charts */
|
|
3539
|
+
recentHistory(count = 100) {
|
|
3540
|
+
const all = this.fine.toArray();
|
|
3541
|
+
const slice = all.slice(-count);
|
|
3542
|
+
return slice.map((m) => {
|
|
3543
|
+
let health = 100;
|
|
3544
|
+
if (m.avgSatisfaction < 65) health -= 15;
|
|
3545
|
+
if (m.avgSatisfaction < 50) health -= 10;
|
|
3546
|
+
if (m.giniCoefficient > 0.45) health -= 15;
|
|
3547
|
+
if (m.giniCoefficient > 0.6) health -= 10;
|
|
3548
|
+
if (Math.abs(m.netFlow) > 10) health -= 15;
|
|
3549
|
+
if (Math.abs(m.netFlow) > 20) health -= 10;
|
|
3550
|
+
if (m.churnRate > 0.05) health -= 15;
|
|
3551
|
+
health = Math.max(0, Math.min(100, health));
|
|
3552
|
+
return {
|
|
3553
|
+
tick: m.tick,
|
|
3554
|
+
health,
|
|
3555
|
+
giniCoefficient: m.giniCoefficient,
|
|
3556
|
+
totalSupply: m.totalSupply,
|
|
3557
|
+
netFlow: m.netFlow,
|
|
3558
|
+
velocity: m.velocity,
|
|
3559
|
+
inflationRate: m.inflationRate,
|
|
3560
|
+
avgSatisfaction: m.avgSatisfaction,
|
|
3561
|
+
churnRate: m.churnRate,
|
|
3562
|
+
totalAgents: m.totalAgents,
|
|
3563
|
+
priceIndex: m.priceIndex
|
|
3564
|
+
};
|
|
3565
|
+
});
|
|
3566
|
+
}
|
|
3528
3567
|
/** Check if fine and coarse resolution metrics diverge significantly */
|
|
3529
3568
|
divergenceDetected() {
|
|
3530
3569
|
const f = this.fine.last();
|