dsh-capability-trimmer 0.0.0-stage → 1.0.3
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/LICENSE +21 -0
- package/README.en.md +37 -0
- package/README.md +36 -2
- package/client.js +1067 -0
- package/cordis.patch.yml +3 -0
- package/core.mjs +284 -0
- package/icon.svg +8 -0
- package/index.js +1071 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +56 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 yangfengshan2
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Capability Trimmer (dsh-capability-trimmer)
|
|
2
|
+
|
|
3
|
+
Adds a "Capability Trimmer" panel to the DSH conversation view: everything the model can "see" — skills and MCP tools — becomes an **auditable, trimmable, reversible** list.
|
|
4
|
+
|
|
5
|
+
## The Problem It Solves
|
|
6
|
+
|
|
7
|
+
Every capability sitting in the model's view (skills, MCP tools) costs you two taxes:
|
|
8
|
+
|
|
9
|
+
1. **Token tax** — each capability's description lands in the system prompt. As more get mounted, your context budget is quietly eaten away;
|
|
10
|
+
2. **Mistake tax** — once capabilities overlap or descriptions turn vague, the model picks the wrong tool: wrong calls, retries, wasted turns, sometimes silently going off track.
|
|
11
|
+
|
|
12
|
+
And that "model's view" is normally a black box: how much the current preset actually mounts, which features overlap, which ones nobody uses — you can't see it, and there's been no place to act on it.
|
|
13
|
+
|
|
14
|
+
## What It Can Do
|
|
15
|
+
|
|
16
|
+
- **See everything at once**: all MCP tools, skills, and plugins mounted in the current preset, with counts and search;
|
|
17
|
+
- **Overlap detection**: reuses the capability-audit algorithm (description TF-IDF cosine + trigger words + name + shared terms), and for each pair recommends which one to keep, with reasons;
|
|
18
|
+
- **Registry-level actions**: keep one, disable the other — skills are shadowed by a same-name entry at the registry layer (the directory stays untouched, so the syncer restoring it is harmless); MCP tools are removed from the model's view entirely with a "use instead" note recorded. Takes effect immediately, reversible anytime;
|
|
19
|
+
- **False positives have an exit**: mark a pair as "not overlapping · ignore" (restorable anytime); if a skill's description is what's unclear, edit the SKILL.md right in the details dialog — overlap scores recompute after saving;
|
|
20
|
+
- **Impact check before disabling**: the upstream/downstream graph shows which skills mention it in their bodies and how strongly (must / often / optional), so the blast radius is obvious at a glance;
|
|
21
|
+
- **Bilingual UI**: Chinese and English copy follow the "Interface language" setting.
|
|
22
|
+
|
|
23
|
+
## One Sentence
|
|
24
|
+
|
|
25
|
+
> A manager for the model's capability view: you can see it, you can trim it, and you can undo your trims.
|
|
26
|
+
|
|
27
|
+
## Boundaries
|
|
28
|
+
|
|
29
|
+
- Plugin rows are read-only: preset plugin compositions have no per-row runtime toggle, so the panel only displays them;
|
|
30
|
+
- MCP tool descriptions are served by the MCP server and cannot be edited locally — only disable + "use instead";
|
|
31
|
+
- Upstream/downstream references come from scanning skill bodies for mentions, not from runtime call graphs.
|
|
32
|
+
|
|
33
|
+
## Security
|
|
34
|
+
|
|
35
|
+
- The panel routes accept same-origin requests only: `Host` must be loopback (or the listener's own address), an `Origin` must match, and `sec-fetch-site: cross-site` is refused;
|
|
36
|
+
- When the host provides `connection`, DSH's own `connection.admit()` (browser login) runs on top, so an unauthenticated request is answered 401;
|
|
37
|
+
- State stays local (`~/.dsh/capability-trimmer.json` plus skill shadows), nothing is uploaded, and the plugin makes no external network requests.
|
package/README.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 能力裁剪台(dsh-capability-trimmer)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
在 DSH 对话页加一个「能力裁剪」面板:把模型能"看到"的技能与 MCP 工具,变成一张**可审计、可裁剪、可撤销**的清单。
|
|
4
|
+
|
|
5
|
+
## 它解决什么问题
|
|
6
|
+
|
|
7
|
+
模型视野里的能力(技能、MCP 工具)每多一个,就多交两笔税:
|
|
8
|
+
|
|
9
|
+
1. **Token 税** —— 每个能力的描述都要进系统提示词,能力越挂越多,上下文预算被悄悄吃掉;
|
|
10
|
+
2. **犯错税** —— 能力一重合、描述一含糊,模型就会挑错工具:调错、重试、浪费轮次,甚至静默走偏。
|
|
11
|
+
|
|
12
|
+
而这份"模型视野"平时是个黑盒:当前模式到底塞了多少能力、哪些功能重了、哪些从没人用,用户既看不见,也没有一个能下手的地方。
|
|
13
|
+
|
|
14
|
+
## 它能干什么
|
|
15
|
+
|
|
16
|
+
- **一次扫清**:当前模式挂载的 MCP 工具、技能、插件全部列出,带计数与搜索;
|
|
17
|
+
- **重合检测**:复用 capability-audit 算法(描述 TF-IDF 余弦 + 触发词 + 名称 + 共享术语),逐组给出"保留哪个"的建议与理由;
|
|
18
|
+
- **注册表层处置**:保留一个、关掉另一个——技能用同名影子压制(目录不动,同步器恢复也无妨),MCP 工具从模型视野整体移除并登记"改用";即时生效、随时恢复;
|
|
19
|
+
- **误报有出口**:判定"不是重合"可忽略(可随时恢复检查);描述不清的技能可直接在详情里改写 SKILL.md,改完重合分重算;
|
|
20
|
+
- **关前看影响**:上下游引用图展示哪些技能在正文里点名了它、引用强度多大(必须/常用/可有可无),影响面一目了然;
|
|
21
|
+
- **双语界面**:中英文案跟随「界面语言」设置。
|
|
22
|
+
|
|
23
|
+
## 一句话
|
|
24
|
+
|
|
25
|
+
> 给模型的"能力视野"装一个管理员:看得见、删得动、删错能后悔。
|
|
26
|
+
|
|
27
|
+
## 边界
|
|
28
|
+
|
|
29
|
+
- 插件行只读:预设的插件组合没有逐行开关的运行时入口,面板只展示;
|
|
30
|
+
- MCP 工具的描述由服务端下发,本地改不了,只能禁用 + 登记"改用";
|
|
31
|
+
- 上下游引用是文本扫描结果(技能正文点名),不是运行时调用链。
|
|
32
|
+
|
|
33
|
+
## 安全
|
|
34
|
+
|
|
35
|
+
- 面板路由只接受同源请求:`Host` 必须是 loopback(或监听地址本身)、`Origin` 必须同源、`sec-fetch-site: cross-site` 一律拒绝;
|
|
36
|
+
- 宿主提供 `connection` 服务时,还会叠加 DSH 自己的 `connection.admit()`(浏览器登录校验),无凭据的请求直接 401;
|
|
37
|
+
- 状态只写本机:`~/.dsh/capability-trimmer.json` 与技能影子登记,不上传任何数据,也没有任何外部网络请求。
|