@lmzhen/dsh-evolution-plan-validator 0.3.24 → 0.3.25

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 +16 -4
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -40,8 +40,20 @@ function validateEvolutionPlan(plan, context) {
40
40
  skillOps,
41
41
  ...plan.summary === void 0 ? {} : { summary: plan.summary }
42
42
  };
43
- const allOps = (plan.memoryOps?.length ?? 0) + (plan.skillOps?.length ?? 0);
44
- if (allOps === 0) {
43
+ const rawMemoryOps = Array.isArray(plan.memoryOps) ? plan.memoryOps : void 0;
44
+ const rawSkillOps = Array.isArray(plan.skillOps) ? plan.skillOps : void 0;
45
+ const allOps = (rawMemoryOps?.length ?? 0) + (rawSkillOps?.length ?? 0);
46
+ if (plan.memoryOps !== void 0 && !Array.isArray(plan.memoryOps)) rejected.push({
47
+ index: 0,
48
+ kind: "memory",
49
+ reason: "memoryOps: must be an array"
50
+ });
51
+ if (plan.skillOps !== void 0 && !Array.isArray(plan.skillOps)) rejected.push({
52
+ index: 0,
53
+ kind: "skill",
54
+ reason: "skillOps: must be an array"
55
+ });
56
+ if (allOps === 0 && rejected.length === 0) {
45
57
  rejected.push({
46
58
  index: 0,
47
59
  kind: "memory",
@@ -65,7 +77,7 @@ function validateEvolutionPlan(plan, context) {
65
77
  ok: false
66
78
  };
67
79
  }
68
- for (const [index, rawOp] of (plan.memoryOps ?? []).entries()) {
80
+ for (const [index, rawOp] of (rawMemoryOps ?? []).entries()) {
69
81
  if (rawOp === null || typeof rawOp !== "object" || Array.isArray(rawOp)) {
70
82
  rejected.push({
71
83
  index,
@@ -83,7 +95,7 @@ function validateEvolutionPlan(plan, context) {
83
95
  });
84
96
  else memoryOps.push(op);
85
97
  }
86
- for (const [index, rawOp] of (plan.skillOps ?? []).entries()) {
98
+ for (const [index, rawOp] of (rawSkillOps ?? []).entries()) {
87
99
  if (rawOp === null || typeof rawOp !== "object" || Array.isArray(rawOp)) {
88
100
  rejected.push({
89
101
  index,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-plan-validator",
3
3
  "description": "Deterministic validator for model-produced evolution plans (community build)",
4
- "version": "0.3.24",
4
+ "version": "0.3.25",
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.24"
34
+ "@lmzhen/dsh-evolution-core": "^0.3.25"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",