@agent-e/core 1.1.1 → 1.1.3
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/README.md +136 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -2463,6 +2463,10 @@ var ALL_PRINCIPLES = [
|
|
|
2463
2463
|
var Simulator = class {
|
|
2464
2464
|
constructor() {
|
|
2465
2465
|
this.diagnoser = new Diagnoser(ALL_PRINCIPLES);
|
|
2466
|
+
// Cache beforeViolations for the *current* tick only (one entry max).
|
|
2467
|
+
// Using a Map here is intentional but the cache must be bounded — we only
|
|
2468
|
+
// care about the tick that is currently being evaluated, so we evict any
|
|
2469
|
+
// entries whose key differs from the incoming tick.
|
|
2466
2470
|
this.beforeViolationsCache = /* @__PURE__ */ new Map();
|
|
2467
2471
|
}
|
|
2468
2472
|
/**
|
|
@@ -2487,6 +2491,9 @@ var Simulator = class {
|
|
|
2487
2491
|
const mean = this.averageMetrics(outcomes);
|
|
2488
2492
|
const netImprovement = this.checkImprovement(currentMetrics, p50, action);
|
|
2489
2493
|
const tick = currentMetrics.tick;
|
|
2494
|
+
if (this.beforeViolationsCache.size > 0 && !this.beforeViolationsCache.has(tick)) {
|
|
2495
|
+
this.beforeViolationsCache.clear();
|
|
2496
|
+
}
|
|
2490
2497
|
let beforeViolations = this.beforeViolationsCache.get(tick);
|
|
2491
2498
|
if (!beforeViolations) {
|
|
2492
2499
|
beforeViolations = new Set(
|