dsh-perm-gate 4.1.2 → 4.2.0-beta.1
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/CHANGELOG.ja.md +0 -26
- package/CHANGELOG.ko.md +0 -24
- package/CHANGELOG.md +0 -26
- package/INSTALL.ja.md +14 -28
- package/INSTALL.ko.md +11 -23
- package/INSTALL.md +16 -32
- package/INSTALL.zh.md +11 -22
- package/README.ja.md +7 -34
- package/README.ko.md +7 -34
- package/README.md +7 -34
- package/README.zh.md +7 -29
- package/cordis.patch.yml +8 -11
- package/dsh.plugin.json +2 -2
- package/lib/client.js +8 -8
- package/lib/client.js.map +1 -1
- package/lib/config.d.ts +120 -1
- package/lib/config.js +71 -35
- package/lib/index.js +42 -77
- package/package.json +21 -19
- package/scripts/patch-permission-glyph.mjs +42 -225
package/README.zh.md
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
> 线上都是 user-approval 服务的**私有**方法,因此通过 `typeof` 探测读取,缺失
|
|
40
40
|
> 或抛错时降级为「策略未知」。
|
|
41
41
|
|
|
42
|
-
版本 **4.1
|
|
42
|
+
版本 **2.4.1** —— 变更见 [Changelog](./CHANGELOG.md)。
|
|
43
43
|
|
|
44
44
|
一个**单一自足、确定性优先、fail-closed** 的 DeepSeek Harness 权限门插件。
|
|
45
45
|
|
|
@@ -65,27 +65,6 @@
|
|
|
65
65
|
- **自动审查档位**(机器值 `permissive`)——一个**独立审批模式**(区别于只读、完全权限与白名单档),既不是"自动审批",也不授予泛化权限。前端只暴露**一个开关**(`permissive`),后台四个审批策略**可组合**、由插件设置决定——仍对 P0 保持 fail-closed。权限下拉框与设置行都按产品名「自动审查」显示;图标见下文(内置档自带,插件档需补丁)。
|
|
66
66
|
- **沙箱提权自动答复**(`trustEscalation`)— 沙箱提权是从 shell / pwsh / edit 工具**体内部**(`tools/pre-execute` 之后)发出的,所以门禁从未见过它,一个它自动放行的调用仍会弹出确认。开启后,门禁以 `callId` 精确匹配已放行调用并直接答复。
|
|
67
67
|
|
|
68
|
-
## 界面预览
|
|
69
|
-
|
|
70
|
-
**设置卡片 —— 自动审查档位**:前端只暴露一个开关,后台四个策略可组合;`LlmAssist` 可跟随会话当前模型,也可钉住 Provider / Model,并自带健康测试与裁决学习:
|
|
71
|
-
|
|
72
|
-

|
|
73
|
-

|
|
74
|
-
|
|
75
|
-
**门禁实际加载的规则**——直接读自 `dsh-perm-gate-rules` 设置命名空间;面板按设计只读,改不了它显示的内容:
|
|
76
|
-
|
|
77
|
-

|
|
78
|
-
|
|
79
|
-
**权限审批记录**——本会话每一次裁决,最新在上,附带模型看到的理由:
|
|
80
|
-
|
|
81
|
-

|
|
82
|
-
|
|
83
|
-
**裁决条**——自动放行会写明依据(只读工具,或 LLM 判定 `safe`);停摆也绝不静默:
|
|
84
|
-
|
|
85
|
-

|
|
86
|
-

|
|
87
|
-

|
|
88
|
-
|
|
89
68
|
## 安装
|
|
90
69
|
|
|
91
70
|
需要先安装 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)。
|
|
@@ -201,10 +180,9 @@ MSYS2/Cygwin 的 `sh.exe`、ConPTY 都会以 `Win32 error 5` / `couldn't create
|
|
|
201
180
|
标签,因此 `cordis.patch.yml` 直接写中文名,对所有会话一致。
|
|
202
181
|
|
|
203
182
|
**图标是另一回事。** 输入栏的图标表是闭合的,表自己的注释写明了规则:*host-configured names
|
|
204
|
-
outside the design set get none
|
|
205
|
-
`npx dsh-perm-gate-patch-glyph`
|
|
206
|
-
|
|
207
|
-
文件沙箱。该补丁改的是**宿主**包,每次 DSH 升级都会丢 —— 见
|
|
183
|
+
outside the design set get none*。`permissive` 是内置值,所以「自动审查」本来就有盾+眼图标;
|
|
184
|
+
「自动审查(高权限)」能拿到同一个图标,靠的是 `npx dsh-perm-gate-patch-glyph` 往那张表里
|
|
185
|
+
加了一项。该补丁改的是**宿主**包,每次 DSH 升级都会丢 —— 见
|
|
208
186
|
[DSH 升级后:重打输入区图标补丁](./INSTALL.zh.md)。
|
|
209
187
|
|
|
210
188
|
`cordis.yml`:
|
|
@@ -297,9 +275,9 @@ LLM 评定为 `safe` 且门禁自动放行的调用因此仍会弹出确认。
|
|
|
297
275
|
调用文本命中任一关键词(大小写不敏感子串)即直接拒绝,且先于白名单 / 授权 / LLM。黑名单在设置
|
|
298
276
|
卡片中按列表查看与增删(预置条目带标签,可一键恢复预置);未设置或为空时应用预置列表——黑名单
|
|
299
277
|
不会静默关闭。
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
278
|
+
「自动审查」与「自动审查(高权限)」在选择器里都画盾+眼图标 —— 前者来自 DSH 内置表,后者来自
|
|
279
|
+
安装指南里描述的那次宿主补丁。没有该补丁时,第二个档位在所有界面上都是纯文字;它的标签与门禁
|
|
280
|
+
不受影响。
|
|
303
281
|
|
|
304
282
|
|
|
305
283
|
## CLI(独立 dry-run)
|
package/cordis.patch.yml
CHANGED
|
@@ -17,17 +17,14 @@
|
|
|
17
17
|
# The composer's permission picker draws an icon per preset from a CLOSED map
|
|
18
18
|
# inside @deepseek-ai/dsh-client-ui-conversation (`permissionGlyphs`), whose
|
|
19
19
|
# source states the rule: "host-configured names outside the design set get
|
|
20
|
-
# none".
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
# The source key is RESOLVED, not assumed (0.1.2 keyed a `permissive` glyph that
|
|
29
|
-
# 0.1.5 dropped, so a literal anchor died with "anchor not found"). It patches a
|
|
30
|
-
# HOST package, so it must be re-run after any DSH upgrade or reinstall.
|
|
20
|
+
# none". DSH ships a shield+eye glyph for `permissive`, so 自动审查 has an icon,
|
|
21
|
+
# but a second plugin tier has none — it falls back to text in the trigger. The
|
|
22
|
+
# map is a closure variable with no plugin-facing seam (the option objects the
|
|
23
|
+
# host supplies carry only {value, name, description}), so the only way to give
|
|
24
|
+
# BOTH tiers the same glyph is to extend that map.
|
|
25
|
+
# `scripts/patch-permission-glyph.mjs` does exactly that, duplicating the
|
|
26
|
+
# `permissive` entry under `permissive-full`. It patches a HOST package, so it
|
|
27
|
+
# must be re-run after any DSH upgrade or reinstall.
|
|
31
28
|
#
|
|
32
29
|
# The DSH bundle patch REPLACES the whole `permission.config.presets` map (it
|
|
33
30
|
# does not merge per key), so this file MUST restate every tier that should
|
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
|
+
"version": "2.6.0",
|
|
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 否决、其余一律放行,规则未知或非法时直接报错,绝不静默失效。"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"engines": {
|
|
16
|
-
"dsh": ">=0.1.
|
|
16
|
+
"dsh": ">=0.1.2-alpha.1"
|
|
17
17
|
},
|
|
18
18
|
"components": {
|
|
19
19
|
"host": "lib/index.js",
|
package/lib/client.js
CHANGED
|
@@ -148,7 +148,7 @@ window.__ModuleLoader__.load({
|
|
|
148
148
|
"card.dryRunFail": "测试失败:",
|
|
149
149
|
"card.dryRunStale": "路由不存在(插件未重启?)",
|
|
150
150
|
"card.rules": "Settings 内置规则",
|
|
151
|
-
"card.rulesHint": "门禁此刻实际加载的规则(来自 settings 命名空间 dsh-perm-gate-rules
|
|
151
|
+
"card.rulesHint": "门禁此刻实际加载的规则(来自 settings 命名空间 dsh-perm-gate-rules)。只读——这里改不了任何东西。要改规则,用下面的白名单,或在设置页中编辑。",
|
|
152
152
|
"card.rulesRefresh": "刷新",
|
|
153
153
|
"card.rulesLoading": "读取中…",
|
|
154
154
|
"card.rulesPath": "来源",
|
|
@@ -300,7 +300,7 @@ window.__ModuleLoader__.load({
|
|
|
300
300
|
"card.dryRunFail": "Test failed: ",
|
|
301
301
|
"card.dryRunStale": "route missing (plugin not restarted?)",
|
|
302
302
|
"card.rules": "Settings Built-in Rules",
|
|
303
|
-
"card.rulesHint": "The rules the gate is loading right now (from the dsh-perm-gate-rules settings namespace). Read-only — nothing here can change them. To change rules, use the allowlist below or edit settings.
|
|
303
|
+
"card.rulesHint": "The rules the gate is loading right now (from the dsh-perm-gate-rules settings namespace). Read-only — nothing here can change them. To change rules, use the allowlist below or edit them on the settings page.",
|
|
304
304
|
"card.rulesRefresh": "Refresh",
|
|
305
305
|
"card.rulesLoading": "Reading…",
|
|
306
306
|
"card.rulesPath": "Source",
|
|
@@ -562,10 +562,10 @@ window.__ModuleLoader__.load({
|
|
|
562
562
|
//#endregion
|
|
563
563
|
//#region src/client/card.tsx
|
|
564
564
|
/**
|
|
565
|
-
* Permissive settings card —
|
|
565
|
+
* Permissive settings card — a `settings.plugins.tab` face of dsh-perm-gate.
|
|
566
566
|
*
|
|
567
|
-
* The card binds the `dsh-perm-gate`
|
|
568
|
-
* `
|
|
567
|
+
* The card binds the plugin's profile entry (`dsh-perm-gate`) through the
|
|
568
|
+
* `configForms` cordis service and renders its fields: the single front switch
|
|
569
569
|
* (`permissive`) plus the three combinable backend strategies
|
|
570
570
|
* (`trustAutoAllow` / `alwaysConfirm` / `llmAssist`). Every change commits
|
|
571
571
|
* immediately through the scope (no staged form); the host reads the namespace
|
|
@@ -3150,13 +3150,13 @@ window.__ModuleLoader__.load({
|
|
|
3150
3150
|
}
|
|
3151
3151
|
//#endregion
|
|
3152
3152
|
//#region src/client/index.ts
|
|
3153
|
-
/** The
|
|
3153
|
+
/** The profile entry id of this plugin — the `configForms` key (kept in lockstep with cordis.patch.yml). */
|
|
3154
3154
|
const PERMISSIVE_NS = "dsh-perm-gate";
|
|
3155
3155
|
/** Services required by the browser half. */
|
|
3156
3156
|
const inject = [
|
|
3157
3157
|
"slots",
|
|
3158
3158
|
"locale",
|
|
3159
|
-
"
|
|
3159
|
+
"configForms"
|
|
3160
3160
|
];
|
|
3161
3161
|
/**
|
|
3162
3162
|
* Client plugin body: dictionaries plus the settings page registration.
|
|
@@ -3195,7 +3195,7 @@ window.__ModuleLoader__.load({
|
|
|
3195
3195
|
label: () => t("card.title"),
|
|
3196
3196
|
locale: NS,
|
|
3197
3197
|
inject: () => {
|
|
3198
|
-
return { scope: ctx.
|
|
3198
|
+
return { scope: ctx.configForms.get(PERMISSIVE_NS) };
|
|
3199
3199
|
}
|
|
3200
3200
|
}, PermissiveCard);
|
|
3201
3201
|
});
|