@lmzhen/dsh-evolution-threat 0.3.33 → 0.3.35

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/README.md CHANGED
@@ -18,6 +18,15 @@ Zero direct token effect from this package; consumers add any model-visible toke
18
18
 
19
19
  Independent of request-prefix construction. This package does not alter the assembled prompt or tool list.
20
20
 
21
+ ## Config
22
+
23
+ - `maxScanChars` (default 65536): the scan window size in normalized characters.
24
+ Legal range is `>= 4097` — a smaller window cannot guarantee full-coverage
25
+ scanning (the overlap floor is `PATTERN_OVERLAP + 1` in evolution-core), so
26
+ the schema rejects it at load and the assembly clamp falls back to the
27
+ default. The whole text is always scanned in overlapping windows; this value
28
+ is not a total cap.
29
+
21
30
  ## Known Limitations and Deferred Work
22
31
 
23
32
 
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import z from "@deepseek-ai/schemastery";
2
- import { EVOLUTION_WRITE_TOOLS, clampedNumber, scanContentThreats, scanMemoryThreats } from "@lmzhen/dsh-evolution-core";
2
+ import { EVOLUTION_WRITE_TOOLS, PATTERN_OVERLAP, clampedNumber, scanContentThreats, scanMemoryThreats } from "@lmzhen/dsh-evolution-core";
3
3
  //#region lib/types/index.js
4
4
  /**
5
5
  * Write-time threat guard for evolution tools.
@@ -9,7 +9,7 @@ const name = "evolution-threat";
9
9
  const inject = ["tools"];
10
10
  const Config = z.object({
11
11
  enabled: z.boolean().default(true),
12
- maxScanChars: z.number().min(1).default(65536)
12
+ maxScanChars: z.number().min(PATTERN_OVERLAP + 1).default(65536)
13
13
  });
14
14
  function asRecord(value) {
15
15
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
@@ -44,10 +44,12 @@ function scanToolArgs(toolName, args, maxScanChars) {
44
44
  return null;
45
45
  }
46
46
  /** Resolve the effective `maxScanChars`, clamping invalid values to the
47
- * default (G3.1: 0/negative/NaN/±Infinity → 65_536). Exported so the clamp is
48
- * directly testable; `apply` warns when a user-supplied value was corrected. */
47
+ * default (G3.1: 0/negative/NaN/±Infinity → 65_536; V6-05: a value below
48
+ * PATTERN_OVERLAP + 1 is out of the coverage-guarantee domain default).
49
+ * Exported so the clamp is directly testable; `apply` warns when a
50
+ * user-supplied value was corrected. */
49
51
  function resolveMaxScanChars(config) {
50
- return clampedNumber(config.maxScanChars ?? 65536, 65536, { min: 1 });
52
+ return clampedNumber(config.maxScanChars ?? 65536, 65536, { min: PATTERN_OVERLAP + 1 });
51
53
  }
52
54
  function apply(ctx, rawConfig = {}) {
53
55
  if (!(rawConfig.enabled ?? true)) return;
@@ -16,8 +16,10 @@ export declare const Config: z<Config>;
16
16
  * guard contract is testable directly (0.3.17). */
17
17
  export declare function scanToolArgs(toolName: string, args: unknown, maxScanChars: number): string | null;
18
18
  /** Resolve the effective `maxScanChars`, clamping invalid values to the
19
- * default (G3.1: 0/negative/NaN/±Infinity → 65_536). Exported so the clamp is
20
- * directly testable; `apply` warns when a user-supplied value was corrected. */
19
+ * default (G3.1: 0/negative/NaN/±Infinity → 65_536; V6-05: a value below
20
+ * PATTERN_OVERLAP + 1 is out of the coverage-guarantee domain default).
21
+ * Exported so the clamp is directly testable; `apply` warns when a
22
+ * user-supplied value was corrected. */
21
23
  export declare function resolveMaxScanChars(config: Config): number;
22
24
  export declare function apply(ctx: Context, rawConfig?: Config): void;
23
25
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-threat",
3
3
  "description": "Write-time threat guard for evolution tools (community build)",
4
- "version": "0.3.33",
4
+ "version": "0.3.35",
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.33"
34
+ "@lmzhen/dsh-evolution-core": "^0.3.35"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@deepseek-ai/cordis": "^4.0.1",
@@ -42,6 +42,6 @@
42
42
  "@deepseek-ai/dsh-agent-loop-testkit": "^0.1.1-rc.2",
43
43
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
44
44
  "@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
45
- "@lmzhen/dsh-evolution-core": "^0.3.33"
45
+ "@lmzhen/dsh-evolution-core": "^0.3.35"
46
46
  }
47
47
  }