@lmzhen/dsh-evolution-replay 0.3.62 → 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 +6 -5
  2. package/package.json +3 -3
package/lib/index.js CHANGED
@@ -96,7 +96,8 @@ var EvolutionReplayDriver = class {
96
96
  }
97
97
  }
98
98
  record(plan) {
99
- const count = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
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;
100
101
  const memoryApplied = count(plan.memoryApplied);
101
102
  const skillApplied = count(plan.skillApplied);
102
103
  this.plans.push({
@@ -105,9 +106,9 @@ var EvolutionReplayDriver = class {
105
106
  rejectedOps: count(plan.rejectedOps),
106
107
  memoryOps: memoryApplied,
107
108
  skillOps: skillApplied,
108
- evidenceQuotes: typeof plan.evidenceQuotes === "number" ? plan.evidenceQuotes : memoryApplied + skillApplied,
109
- estimatedInputChars: typeof plan.estimatedInputChars === "number" ? plan.estimatedInputChars : 0,
110
- executionFailures: typeof plan.executionFailures === "number" ? plan.executionFailures : 0,
109
+ evidenceQuotes: countOr(plan.evidenceQuotes, memoryApplied + skillApplied),
110
+ estimatedInputChars: count(plan.estimatedInputChars),
111
+ executionFailures: count(plan.executionFailures),
111
112
  ...typeof plan.executionError === "string" ? { executionError: plan.executionError } : {}
112
113
  });
113
114
  if (this.plans.length > this.maxPlans) this.plans.shift();
@@ -123,7 +124,7 @@ var EvolutionReplayDriver = class {
123
124
  return [...this.plans];
124
125
  }
125
126
  compare(weights = this.weights) {
126
- return comparePlans(this.plans, weights);
127
+ return comparePlans([...this.plans], weights);
127
128
  }
128
129
  };
129
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.62",
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.62"
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.62"
42
+ "@lmzhen/dsh-evolution-core": "^0.3.63"
43
43
  }
44
44
  }