@lmzhen/dsh-evolution-plan-validator 0.22.0 → 0.24.0

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 +5 -11
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { DEFAULT_MAX_OPS_PER_PLAN, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_USER_CHAR_LIMIT, FORBIDDEN_CONTROL_KEYS, MAX_RESTRUCTURE_MOVES, SKILL_ACTION_REQUIRED_FIELDS, payloadText, validateRestructureTarget } from "@lmzhen/dsh-evolution-core";
1
+ import { DEFAULT_MAX_OPS_PER_PLAN, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_USER_CHAR_LIMIT, FORBIDDEN_CONTROL_KEYS, MAX_RESTRUCTURE_MOVES, SKILL_ACTION_REQUIRED_FIELDS, isRecord, payloadText, validateRestructureTarget } from "@lmzhen/dsh-evolution-core";
2
2
  //#region lib/types/index.js
3
3
  /**
4
4
  * Deterministic validator for model-produced evolution plans.
@@ -291,12 +291,6 @@ function runPlanRules(rules, op, context, index, kind, reports) {
291
291
  }
292
292
  return null;
293
293
  }
294
- /** Object root guard (V4-23, symmetric with the maintain validator): null,
295
- * primitives and arrays are not a plan record and must be rejected with an
296
- * explicit message, never a raw TypeError from `.memoryOps`/`.summary`. */
297
- function isRecord(value) {
298
- return typeof value === "object" && value !== null && !Array.isArray(value);
299
- }
300
294
  function validateEvolutionPlan(plan, context) {
301
295
  const reports = [];
302
296
  if (!isRecord(plan)) return {
@@ -307,7 +301,7 @@ function validateEvolutionPlan(plan, context) {
307
301
  rejected: [{
308
302
  index: 0,
309
303
  kind: "memory",
310
- reason: "plan root: must be an object"
304
+ reason: "plan 根节点:必须是对象"
311
305
  }],
312
306
  reports,
313
307
  ok: false
@@ -327,18 +321,18 @@ function validateEvolutionPlan(plan, context) {
327
321
  if (plan.memoryOps !== void 0 && !Array.isArray(plan.memoryOps)) rejected.push({
328
322
  index: 0,
329
323
  kind: "memory",
330
- reason: "memoryOps: must be an array"
324
+ reason: "memoryOps:必须是数组"
331
325
  });
332
326
  if (plan.skillOps !== void 0 && !Array.isArray(plan.skillOps)) rejected.push({
333
327
  index: 0,
334
328
  kind: "skill",
335
- reason: "skillOps: must be an array"
329
+ reason: "skillOps:必须是数组"
336
330
  });
337
331
  if (allOps === 0 && rejected.length === 0) {
338
332
  rejected.push({
339
333
  index: 0,
340
334
  kind: "memory",
341
- reason: "plan contains no operations"
335
+ reason: "plan 不含任何操作"
342
336
  });
343
337
  return {
344
338
  accepted,
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.22.0",
4
+ "version": "0.24.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -26,6 +26,6 @@
26
26
  ],
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
- "@lmzhen/dsh-evolution-core": "^0.22.0"
29
+ "@lmzhen/dsh-evolution-core": "^0.24.0"
30
30
  }
31
31
  }