dsh-perm-gate 4.2.0-beta.3 → 4.2.0-beta.5
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/dsh.plugin.json +1 -1
- package/lib/allowlist.d.ts +7 -0
- package/lib/allowlist.js +17 -0
- package/lib/client.js +4 -4
- package/lib/client.js.map +1 -1
- package/lib/index.js +38 -4
- package/lib/rules-view.d.ts +1 -1
- package/lib/rules-view.js +1 -1
- package/package.json +1 -1
package/dsh.plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-perm-gate",
|
|
3
3
|
"name": "dsh-perm-gate",
|
|
4
|
-
"version": "4.2.0-beta.
|
|
4
|
+
"version": "4.2.0-beta.5",
|
|
5
5
|
"description": {
|
|
6
6
|
"en": "Deterministic-first, fail-closed permission gate for DeepSeek Harness 0.1.2+: a P0 hard-deny -> P1 precise session grant -> P2 static allow/deny rule chain -> P3 optional LLM classifier -> P4 ask pipeline over the tools/pre-execute waterfall, with a standalone CLI dry-run evaluator and an auditable decision log. It only vetoes with deny/ask and always delegates otherwise, and unknown or malformed rules fail loud instead of silently standing the gate down.",
|
|
7
7
|
"zh": "面向 DeepSeek Harness 0.1.2+ 的确定性优先、失败即拒的权限闸门:在 tools/pre-execute 瀑布上串起 P0 硬拒绝 → P1 精确会话授权 → P2 静态 allow/deny 规则链 → P3 可选 LLM 语义分类 → P4 ask,并附带独立 CLI 干跑评估器与可审计的决策日志。只以 deny/ask 否决、其余一律放行,规则未知或非法时直接报错,绝不静默失效。"
|
package/lib/allowlist.d.ts
CHANGED
|
@@ -44,3 +44,10 @@ export declare function listAllowCommands(rulesFile: string): string[];
|
|
|
44
44
|
* @param reason - reason recorded on each generated allow entry.
|
|
45
45
|
*/
|
|
46
46
|
export declare function replaceAllowCommands(rulesFile: string, patterns: readonly string[], reason?: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Parse the rules file into a plain document — the seed for the first
|
|
49
|
+
* settings-backed allowlist write, so migrating a file-defined document into
|
|
50
|
+
* the entry's `rules` config field cannot drop its deny/ask sections.
|
|
51
|
+
* Returns `{}` when the file is absent or unreadable.
|
|
52
|
+
*/
|
|
53
|
+
export declare function readRulesFileDoc(rulesFile: string): unknown;
|
package/lib/allowlist.js
CHANGED
|
@@ -197,3 +197,20 @@ function readFileSafe(p) {
|
|
|
197
197
|
return '';
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Parse the rules file into a plain document — the seed for the first
|
|
202
|
+
* settings-backed allowlist write, so migrating a file-defined document into
|
|
203
|
+
* the entry's `rules` config field cannot drop its deny/ask sections.
|
|
204
|
+
* Returns `{}` when the file is absent or unreadable.
|
|
205
|
+
*/
|
|
206
|
+
export function readRulesFileDoc(rulesFile) {
|
|
207
|
+
const text = readFileSafe(rulesFile);
|
|
208
|
+
if (text === '')
|
|
209
|
+
return {};
|
|
210
|
+
try {
|
|
211
|
+
return parse(text) ?? {};
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
return {};
|
|
215
|
+
}
|
|
216
|
+
}
|
package/lib/client.js
CHANGED
|
@@ -149,7 +149,7 @@ window.__ModuleLoader__.load({
|
|
|
149
149
|
"card.dryRunFail": "测试失败:",
|
|
150
150
|
"card.dryRunStale": "路由不存在(插件未重启?)",
|
|
151
151
|
"card.rules": "Settings 内置规则",
|
|
152
|
-
"card.rulesHint": "
|
|
152
|
+
"card.rulesHint": "门禁此刻实际加载的规则(来自本插件入口的 rules 配置字段;未配置时回退到规则文件)。只读——这里改不了任何东西。要改规则,用下面的白名单,或在设置页中编辑。",
|
|
153
153
|
"card.rulesRefresh": "刷新",
|
|
154
154
|
"card.rulesLoading": "读取中…",
|
|
155
155
|
"card.rulesPath": "来源",
|
|
@@ -161,7 +161,7 @@ window.__ModuleLoader__.load({
|
|
|
161
161
|
"card.rulesTruncated": "规则过大,仅显示前 512 KB。",
|
|
162
162
|
"card.rulesError": "加载失败:",
|
|
163
163
|
"card.rulesStale": "路由不存在(插件未重启?)",
|
|
164
|
-
"card.rulesNote": "
|
|
164
|
+
"card.rulesNote": "此处只读:面板无法修改规则;白名单段与“始终允许”会写回本插件的入口配置。"
|
|
165
165
|
};
|
|
166
166
|
/** English dictionary (keys mirror zh). */
|
|
167
167
|
const en = {
|
|
@@ -302,7 +302,7 @@ window.__ModuleLoader__.load({
|
|
|
302
302
|
"card.dryRunFail": "Test failed: ",
|
|
303
303
|
"card.dryRunStale": "route missing (plugin not restarted?)",
|
|
304
304
|
"card.rules": "Settings Built-in Rules",
|
|
305
|
-
"card.rulesHint": "The rules the gate is loading right now (from the
|
|
305
|
+
"card.rulesHint": "The rules the gate is loading right now (from this plugin entry's `rules` config field; falls back to the rules file when unset). Read-only — nothing here can change them. To change rules, use the allowlist below or edit them on the settings page.",
|
|
306
306
|
"card.rulesRefresh": "Refresh",
|
|
307
307
|
"card.rulesLoading": "Reading…",
|
|
308
308
|
"card.rulesPath": "Source",
|
|
@@ -314,7 +314,7 @@ window.__ModuleLoader__.load({
|
|
|
314
314
|
"card.rulesTruncated": "Rules are large; showing the first 512 KB only.",
|
|
315
315
|
"card.rulesError": "Load failed: ",
|
|
316
316
|
"card.rulesStale": "route missing (plugin not restarted?)",
|
|
317
|
-
"card.rulesNote": "Read-only: this panel cannot modify the rules. The allowlist section
|
|
317
|
+
"card.rulesNote": "Read-only: this panel cannot modify the rules. The allowlist section and \"allow always\" write back to this plugin's entry config."
|
|
318
318
|
};
|
|
319
319
|
//#endregion
|
|
320
320
|
//#region src/deny-defaults.ts
|