dsh-perm-gate 4.1.3 → 4.2.0-beta.2

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.zh.md CHANGED
@@ -39,7 +39,7 @@
39
39
  > 线上都是 user-approval 服务的**私有**方法,因此通过 `typeof` 探测读取,缺失
40
40
  > 或抛错时降级为「策略未知」。
41
41
 
42
- 版本 **4.1.2** —— 变更见 [Changelog](./CHANGELOG.md)。
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
- ![设置卡片 —— 自动审查档位](assets/setting-head.png)
73
- ![LlmAssist —— Provider / Model / API Key](assets/llms.png)
74
-
75
- **门禁实际加载的规则**——直接读自 `dsh-perm-gate-rules` 设置命名空间;面板按设计只读,改不了它显示的内容:
76
-
77
- ![内置规则(只读)](assets/setting-rules.png)
78
-
79
- **权限审批记录**——本会话每一次裁决,最新在上,附带模型看到的理由:
80
-
81
- ![权限审批记录](assets/permlist.png)
82
-
83
- **裁决条**——自动放行会写明依据(只读工具,或 LLM 判定 `safe`);停摆也绝不静默:
84
-
85
- ![ALLOW 条 —— 只读内置工具](assets/allow1.png)
86
- ![ALLOW 条 —— llm-assist 判定 safe](assets/allow2.png)
87
- ![GATE OFF 条 —— 门禁停摆](assets/gateoff.png)
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` 往那张表里补两项 ——「自动审查」复制 `workspace-write` 的
206
- 盾+铅笔,「自动审查(高权限)」复制 `danger-full-access` 的盾+感叹号,各自对应自己实际共用的
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
- 从各自共用的文件沙箱档位复制而来(`workspace-write` 与 `danger-full-access`)。没有该补丁时,
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". Neither tier is a built-in value, so DSH renders no glyph for either
21
- # — the map is a closed closure variable and its only plugin-facing input is
22
- # {value, name, description} on the option objects, which carries no icon. The
23
- # only way to give a tier an icon is to add an entry to that map.
24
- # `scripts/patch-permission-glyph.mjs` does exactly that, copying the glyph of
25
- # the built-in tier whose file sandbox each of ours shares:
26
- # permissive <- ["workspace-write", (same sandbox: workspace-write)
27
- # permissive-full <- [FULL_ACCESS, (same sandbox: danger-full-access)
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.1.3",
4
+ "version": "4.2.0-beta.2",
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.5-rc.1 <0.1.6-0"
16
+ "dsh": ">=0.1.7-rc.1 <0.1.8-0"
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)。只读——这里改不了任何东西。要改规则,用下面的白名单,或在 settings.yaml 中编辑。",
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.yaml.",
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 — the `settings.plugin.item` face of dsh-perm-gate.
565
+ * Permissive settings card — a `settings.plugins.tab` face of dsh-perm-gate.
566
566
  *
567
- * The card binds the `dsh-perm-gate` settings namespace through the
568
- * `settingsScope` cordis service and renders its fields: the single front switch
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 settings namespace the host half registers (kept in lockstep with src/index.ts). */
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
- "settingsScope"
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.settingsScope.bind({ namespace: PERMISSIVE_NS }) };
3198
+ return { scope: ctx.configForms.get(PERMISSIVE_NS) };
3199
3199
  }
3200
3200
  }, PermissiveCard);
3201
3201
  });