@lmzhen/dsh-evolution-replay 0.3.61 → 0.3.63

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.
Files changed (2) hide show
  1. package/lib/index.js +12 -8
  2. package/package.json +3 -3
package/lib/index.js CHANGED
@@ -96,15 +96,19 @@ var EvolutionReplayDriver = class {
96
96
  }
97
97
  }
98
98
  record(plan) {
99
+ const count = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : 0;
100
+ const countOr = (value, fallback) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : fallback;
101
+ const memoryApplied = count(plan.memoryApplied);
102
+ const skillApplied = count(plan.skillApplied);
99
103
  this.plans.push({
100
104
  policyId: typeof plan.policyFingerprint === "string" && plan.policyFingerprint.length > 0 ? plan.policyFingerprint : plan.planId,
101
- acceptedOps: plan.memoryApplied + plan.skillApplied,
102
- rejectedOps: plan.rejectedOps,
103
- memoryOps: plan.memoryApplied,
104
- skillOps: plan.skillApplied,
105
- evidenceQuotes: typeof plan.evidenceQuotes === "number" ? plan.evidenceQuotes : plan.memoryApplied + plan.skillApplied,
106
- estimatedInputChars: typeof plan.estimatedInputChars === "number" ? plan.estimatedInputChars : 0,
107
- executionFailures: typeof plan.executionFailures === "number" ? plan.executionFailures : 0,
105
+ acceptedOps: memoryApplied + skillApplied,
106
+ rejectedOps: count(plan.rejectedOps),
107
+ memoryOps: memoryApplied,
108
+ skillOps: skillApplied,
109
+ evidenceQuotes: countOr(plan.evidenceQuotes, memoryApplied + skillApplied),
110
+ estimatedInputChars: count(plan.estimatedInputChars),
111
+ executionFailures: count(plan.executionFailures),
108
112
  ...typeof plan.executionError === "string" ? { executionError: plan.executionError } : {}
109
113
  });
110
114
  if (this.plans.length > this.maxPlans) this.plans.shift();
@@ -120,7 +124,7 @@ var EvolutionReplayDriver = class {
120
124
  return [...this.plans];
121
125
  }
122
126
  compare(weights = this.weights) {
123
- return comparePlans(this.plans, weights);
127
+ return comparePlans([...this.plans], weights);
124
128
  }
125
129
  };
126
130
  const name = "evolution-replay";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-replay",
3
3
  "description": "Replay/A-B evaluation primitives for evolution plans (community build)",
4
- "version": "0.3.61",
4
+ "version": "0.3.63",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -31,7 +31,7 @@
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
33
  "@deepseek-ai/schemastery": "^3.18.1",
34
- "@lmzhen/dsh-evolution-core": "^0.3.61"
34
+ "@lmzhen/dsh-evolution-core": "^0.3.63"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@deepseek-ai/cordis": "^4.0.1",
@@ -39,6 +39,6 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
42
- "@lmzhen/dsh-evolution-core": "^0.3.61"
42
+ "@lmzhen/dsh-evolution-core": "^0.3.63"
43
43
  }
44
44
  }