@lmzhen/dsh-evolution-capability 0.3.23 → 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 +14 -6
  2. package/package.json +12 -11
package/lib/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Service } from "@deepseek-ai/cordis";
2
2
  import z from "@deepseek-ai/schemastery";
3
+ import { clampedNumber } from "@lmzhen/dsh-evolution-core";
3
4
  //#region lib/types/index.js
4
5
  /**
5
6
  * Explicit, non-automatic capability evolution adapter.
@@ -15,18 +16,25 @@ const CAPABILITY_NAME_RE = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
15
16
  var EvolutionCapability = class extends Service {
16
17
  static inject = ["evolutionApproval", "evolutionState"];
17
18
  static Config = z.object({
18
- maxNameLength: z.number().default(64),
19
- maxPurposeLength: z.number().default(200),
20
- maxCodeChars: z.number().default(65536)
19
+ maxNameLength: z.number().min(1).default(64),
20
+ maxPurposeLength: z.number().min(1).default(200),
21
+ maxCodeChars: z.number().min(1).default(65536)
21
22
  });
22
23
  limits;
23
24
  constructor(ctx, config = {}) {
24
25
  super(ctx, "evolutionCapability");
26
+ const clamped = [];
27
+ const field = (name, value, fallback) => {
28
+ const result = clampedNumber(value, fallback, { min: 1 });
29
+ if (value !== void 0 && result !== value) clamped.push(name);
30
+ return result;
31
+ };
25
32
  this.limits = {
26
- maxNameLength: config.maxNameLength ?? 64,
27
- maxPurposeLength: config.maxPurposeLength ?? 200,
28
- maxCodeChars: config.maxCodeChars ?? 65536
33
+ maxNameLength: field("maxNameLength", config.maxNameLength, 64),
34
+ maxPurposeLength: field("maxPurposeLength", config.maxPurposeLength, 200),
35
+ maxCodeChars: field("maxCodeChars", config.maxCodeChars, 65536)
29
36
  };
37
+ if (clamped.length > 0) ctx.logger.warn(`evolution-capability: ${clamped.join(", ")} provided an invalid value; falling back to the default`);
30
38
  }
31
39
  validate(pkg) {
32
40
  return validateCapabilityPackage(pkg, this.limits);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-capability",
3
3
  "description": "Explicit staged governance adapter for Creator-mode capability packages (community build)",
4
- "version": "0.3.23",
4
+ "version": "0.3.25",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -30,22 +30,23 @@
30
30
  ],
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
- "@deepseek-ai/schemastery": "^3.18.1"
33
+ "@deepseek-ai/schemastery": "^3.18.1",
34
+ "@lmzhen/dsh-evolution-core": "^0.3.25"
34
35
  },
35
36
  "peerDependencies": {
36
37
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
37
38
  "@deepseek-ai/cordis": "^4.0.1",
38
- "@lmzhen/dsh-evolution-approval": "^0.3.23",
39
- "@lmzhen/dsh-evolution-state": "^0.3.23",
40
- "@lmzhen/dsh-evolution-state-storage": "^0.3.23"
39
+ "@lmzhen/dsh-evolution-approval": "^0.3.25",
40
+ "@lmzhen/dsh-evolution-state": "^0.3.25",
41
+ "@lmzhen/dsh-evolution-state-storage": "^0.3.25"
41
42
  },
42
43
  "devDependencies": {
43
44
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
44
- "@lmzhen/dsh-evolution-approval": "^0.3.23",
45
- "@lmzhen/dsh-evolution-state": "^0.3.23",
46
- "@lmzhen/dsh-evolution-state-storage": "^0.3.23",
47
- "@lmzhen/dsh-evolution-io": "^0.3.23",
48
- "@lmzhen/dsh-evolution-io-node": "^0.3.23",
49
- "@lmzhen/dsh-evolution-state-json": "^0.3.23"
45
+ "@lmzhen/dsh-evolution-approval": "^0.3.25",
46
+ "@lmzhen/dsh-evolution-state": "^0.3.25",
47
+ "@lmzhen/dsh-evolution-state-storage": "^0.3.25",
48
+ "@lmzhen/dsh-evolution-io": "^0.3.25",
49
+ "@lmzhen/dsh-evolution-io-node": "^0.3.25",
50
+ "@lmzhen/dsh-evolution-state-json": "^0.3.25"
50
51
  }
51
52
  }