@lmzhen/dsh-evolution-threat 0.3.51 → 0.3.53

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 -7
  2. package/package.json +4 -4
package/lib/index.js CHANGED
@@ -55,13 +55,11 @@ function apply(ctx, rawConfig = {}) {
55
55
  if (!(rawConfig.enabled ?? true)) return;
56
56
  const maxScanChars = resolveMaxScanChars(rawConfig);
57
57
  if (maxScanChars !== (rawConfig.maxScanChars ?? 65536)) ctx.logger.warn(`evolution-threat: maxScanChars=${String(rawConfig.maxScanChars)} is invalid; falling back to the default 65_536`);
58
- ctx.on("tools/pre-execute", async (exec, next) => {
59
- const hit = scanToolArgs(exec.name, exec.arguments, maxScanChars);
60
- if (hit) return {
61
- kind: "deny",
62
- reason: hit
63
- };
64
- return next();
58
+ ctx.inject(["tools"], (toolCtx) => {
59
+ const tools = toolCtx.get("tools");
60
+ toolCtx.effect(() => tools.guard((exec) => {
61
+ return scanToolArgs(exec.name, exec.arguments, maxScanChars) ?? void 0;
62
+ }), "evolution-threat.tools-guard");
65
63
  });
66
64
  }
67
65
  //#endregion
package/package.json CHANGED
@@ -1,14 +1,14 @@
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.51",
4
+ "version": "0.3.53",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/lmzhen/dsh-evolution.git",
11
- "directory": "packages/dsh-evolution-threat"
11
+ "directory": "packages/evolution-threat"
12
12
  },
13
13
  "type": "module",
14
14
  "main": "lib/index.js",
@@ -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.51"
34
+ "@lmzhen/dsh-evolution-core": "^0.3.53"
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.51"
45
+ "@lmzhen/dsh-evolution-core": "^0.3.53"
46
46
  }
47
47
  }