@lmzhen/dsh-evolution-replay 0.3.27 → 0.3.29

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 +13 -1
  2. package/package.json +3 -4
package/lib/index.js CHANGED
@@ -19,6 +19,13 @@ const DEFAULT_WEIGHTS = {
19
19
  evidence: 2,
20
20
  cost: .001
21
21
  };
22
+ /** The four clampable weight fields, in report order (V4-40 warn). */
23
+ const WEIGHT_FIELDS = [
24
+ "accepted",
25
+ "rejectedPenalty",
26
+ "evidence",
27
+ "cost"
28
+ ];
22
29
  const Config = z.object({
23
30
  maxPlans: z.number().min(1).default(50),
24
31
  weights: z.object({
@@ -81,7 +88,12 @@ var EvolutionReplayDriver = class {
81
88
  const maxPlans = clampedNumber(config.maxPlans ?? 50, 50, { min: 1 });
82
89
  this.maxPlans = maxPlans;
83
90
  if (config.maxPlans !== void 0 && maxPlans !== config.maxPlans) warn(`evolution-replay: maxPlans=${String(config.maxPlans)} is invalid; falling back to the default 50`);
84
- this.weights = clampReplayWeights(config.weights);
91
+ const rawWeights = config.weights;
92
+ this.weights = clampReplayWeights(rawWeights);
93
+ if (rawWeights !== void 0) {
94
+ const clampedFields = WEIGHT_FIELDS.filter((field) => field in rawWeights && this.weights[field] !== rawWeights[field]);
95
+ if (clampedFields.length > 0) warn(`evolution-replay: weights ${clampedFields.join(", ")} provided an invalid value; falling back to the default`);
96
+ }
85
97
  }
86
98
  record(plan) {
87
99
  this.plans.push({
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.27",
4
+ "version": "0.3.29",
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.27"
34
+ "@lmzhen/dsh-evolution-core": "^0.3.29"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@deepseek-ai/cordis": "^4.0.1",
@@ -39,7 +39,6 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
42
- "@deepseek-ai/dsh-session": "^0.1.1-rc.2",
43
- "@lmzhen/dsh-evolution-core": "^0.3.27"
42
+ "@lmzhen/dsh-evolution-core": "^0.3.29"
44
43
  }
45
44
  }