@lmzhen/dsh-evolution-plan-validator 0.3.26 → 0.3.28
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/lib/index.js +18 -0
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -30,7 +30,25 @@ function hasValidEvidence(evidence, sessionSeq) {
|
|
|
30
30
|
return Number.isInteger(seq) && seq >= 0 && seq <= sessionSeq;
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
+
/** Object root guard (V4-23, symmetric with the maintain validator): null,
|
|
34
|
+
* primitives and arrays are not a plan record and must be rejected with an
|
|
35
|
+
* explicit message, never a raw TypeError from `.memoryOps`/`.summary`. */
|
|
36
|
+
function isRecord(value) {
|
|
37
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
38
|
+
}
|
|
33
39
|
function validateEvolutionPlan(plan, context) {
|
|
40
|
+
if (!isRecord(plan)) return {
|
|
41
|
+
accepted: {
|
|
42
|
+
memoryOps: [],
|
|
43
|
+
skillOps: []
|
|
44
|
+
},
|
|
45
|
+
rejected: [{
|
|
46
|
+
index: 0,
|
|
47
|
+
kind: "memory",
|
|
48
|
+
reason: "plan root: must be an object"
|
|
49
|
+
}],
|
|
50
|
+
ok: false
|
|
51
|
+
};
|
|
34
52
|
const maxOps = context.maxOpsPerPlan ?? DEFAULT_MAX_OPS_PER_PLAN;
|
|
35
53
|
const rejected = [];
|
|
36
54
|
const memoryOps = [];
|
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.
|
|
4
|
+
"version": "0.3.28",
|
|
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.
|
|
34
|
+
"@lmzhen/dsh-evolution-core": "^0.3.28"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|