@amaster.ai/dsh-policy 0.1.38 → 0.1.40
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 +1 -1
- package/lib/rule.js +4 -3
- package/package.json +22 -21
package/README.md
CHANGED
|
@@ -111,7 +111,7 @@ A policy plugin is advisory gating, not containment: deny rules keep a well-beha
|
|
|
111
111
|
|
|
112
112
|
| @amaster.ai/dsh-policy | dsh | cordis |
|
|
113
113
|
| --- | --- | --- |
|
|
114
|
-
| 0.1.x | `>=0.1.5-rc.1 || >=0.1.6-alpha.1 || >=0.1.7-alpha.1 || >=0.2.0-rc.1 || >=0.2.1-rc.1` (tested `0.2.
|
|
114
|
+
| 0.1.x | `>=0.1.5-rc.1 || >=0.1.6-alpha.1 || >=0.1.7-alpha.1 || >=0.2.0-rc.1 || >=0.2.1-rc.1 || >=0.2.2-rc.1` (tested `0.2.2-rc.1`) | `^4.0.1` (tested `4.1.0`) |
|
|
115
115
|
|
|
116
116
|
Peer dependency: `@deepseek-ai/dsh-tools` (the `tools/pre-execute` gate). The approval seam (`@deepseek-ai/dsh-user-approval`) is optional and only involved in `ask` decisions.
|
|
117
117
|
|
package/lib/rule.js
CHANGED
|
@@ -114,6 +114,9 @@ export function evaluate(rules, toolName, args, commandKeys) {
|
|
|
114
114
|
if (candidates.length === 0)
|
|
115
115
|
return undefined;
|
|
116
116
|
const argsJson = JSON.stringify(args ?? null);
|
|
117
|
+
const matching = candidates.filter((rule) => argsMatch(rule, args, argsJson));
|
|
118
|
+
if (matching.length === 0)
|
|
119
|
+
return undefined;
|
|
117
120
|
const command = extractCommand(args, commandKeys);
|
|
118
121
|
// A call without a shell command is one virtual whole-call segment — only
|
|
119
122
|
// rules without command conditions can match it.
|
|
@@ -123,9 +126,7 @@ export function evaluate(rules, toolName, args, commandKeys) {
|
|
|
123
126
|
const best = {};
|
|
124
127
|
for (const segment of segments) {
|
|
125
128
|
let winner;
|
|
126
|
-
for (const rule of
|
|
127
|
-
if (!argsMatch(rule, args, argsJson))
|
|
128
|
-
continue;
|
|
129
|
+
for (const rule of matching) {
|
|
129
130
|
if (!matchesSegment(rule, segment, dialect))
|
|
130
131
|
continue;
|
|
131
132
|
winner = winner === undefined ? rule : prefer(winner, rule);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amaster.ai/dsh-policy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.40",
|
|
4
4
|
"description": "Declarative tool-call policy for DeepSeek Harness: config-driven allow/deny/ask rules (tool name, args pattern, shell command prefix/regex, priority) on the tools/pre-execute gate — Gemini CLI-style policy files expressed as plain plugin config.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -36,30 +36,31 @@
|
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
39
|
-
"@deepseek-ai/dsh-tools": ">=0.1.5-rc.1 || >=0.1.6-alpha.1 || >=0.1.7-alpha.1 || >=0.2.0-rc.1 || >=0.2.1-rc.1"
|
|
39
|
+
"@deepseek-ai/dsh-tools": ">=0.1.5-rc.1 || >=0.1.6-alpha.1 || >=0.1.7-alpha.1 || >=0.2.0-rc.1 || >=0.2.1-rc.1 || >=0.2.2-rc.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@deepseek-ai/cordis": "4.0
|
|
43
|
-
"@deepseek-ai/dsh-agent": "0.2.
|
|
44
|
-
"@deepseek-ai/dsh-home-paths": "0.2.
|
|
45
|
-
"@deepseek-ai/dsh-http-proxy": "0.2.
|
|
46
|
-
"@deepseek-ai/dsh-jobs": "0.2.
|
|
47
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
48
|
-
"@deepseek-ai/dsh-ptc-runtime": "0.2.
|
|
49
|
-
"@deepseek-ai/dsh-sandbox": "0.2.
|
|
50
|
-
"@deepseek-ai/dsh-sandbox-policy": "0.2.
|
|
51
|
-
"@deepseek-ai/dsh-scope": "0.2.
|
|
52
|
-
"@deepseek-ai/dsh-session-projection": "0.2.
|
|
53
|
-
"@deepseek-ai/dsh-shell": "0.2.
|
|
54
|
-
"@deepseek-ai/dsh-shell-env": "0.2.
|
|
55
|
-
"@deepseek-ai/dsh-subprocess": "0.2.
|
|
56
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.
|
|
57
|
-
"@deepseek-ai/dsh-tool-bash": "0.2.
|
|
58
|
-
"@deepseek-ai/dsh-tools": "0.2.
|
|
59
|
-
"@deepseek-ai/dsh-user-approval": "0.2.
|
|
42
|
+
"@deepseek-ai/cordis": "4.1.0",
|
|
43
|
+
"@deepseek-ai/dsh-agent": "0.2.2-rc.1",
|
|
44
|
+
"@deepseek-ai/dsh-home-paths": "0.2.2-rc.1",
|
|
45
|
+
"@deepseek-ai/dsh-http-proxy": "0.2.2-rc.1",
|
|
46
|
+
"@deepseek-ai/dsh-jobs": "0.2.2-rc.1",
|
|
47
|
+
"@deepseek-ai/dsh-llm": "0.2.2-rc.1",
|
|
48
|
+
"@deepseek-ai/dsh-ptc-runtime": "0.2.2-rc.1",
|
|
49
|
+
"@deepseek-ai/dsh-sandbox": "0.2.2-rc.1",
|
|
50
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.2-rc.1",
|
|
51
|
+
"@deepseek-ai/dsh-scope": "0.2.2-rc.1",
|
|
52
|
+
"@deepseek-ai/dsh-session-projection": "0.2.2-rc.1",
|
|
53
|
+
"@deepseek-ai/dsh-shell": "0.2.2-rc.1",
|
|
54
|
+
"@deepseek-ai/dsh-shell-env": "0.2.2-rc.1",
|
|
55
|
+
"@deepseek-ai/dsh-subprocess": "0.2.2-rc.1",
|
|
56
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.2-rc.1",
|
|
57
|
+
"@deepseek-ai/dsh-tool-bash": "0.2.2-rc.1",
|
|
58
|
+
"@deepseek-ai/dsh-tools": "0.2.2-rc.1",
|
|
59
|
+
"@deepseek-ai/dsh-user-approval": "0.2.2-rc.1",
|
|
60
60
|
"@types/node": "^22.0.0",
|
|
61
61
|
"typescript": "^5.6.3",
|
|
62
|
-
"vitest": "^4.1.11"
|
|
62
|
+
"vitest": "^4.1.11",
|
|
63
|
+
"@deepseek-ai/dsh-tool-executor-native": "0.2.2-rc.1"
|
|
63
64
|
},
|
|
64
65
|
"engines": {
|
|
65
66
|
"node": "^20.19 || ^22.12 || >=24.0"
|