dsh-plugins-scope 0.0.0-stage → 0.5.0
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.md +32 -0
- package/LICENSE +21 -0
- package/README.md +83 -2
- package/client.js +676 -0
- package/cordis.patch.yml +3 -0
- package/docs/DETAIL.en.md +54 -0
- package/docs/DETAIL.md +54 -0
- package/docs/preview.svg +67 -0
- package/icon.svg +8 -0
- package/index.js +1625 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +56 -4
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Plugin Scopes
|
|
2
|
+
|
|
3
|
+
Manage whether third-party plugins are active per session. One inheritance chain: **global default → workspace override → session override**. Each level is only on / off / inherit, and the rightmost column is always the effective result.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## What it solves
|
|
8
|
+
|
|
9
|
+
Some plugins are only wanted for certain work or certain sessions:
|
|
10
|
+
|
|
11
|
+
- Plugins that inject tools or prompt sections (`dsh-ops`, `modlens`, `billion-context`) are not needed in every session; turning them off saves context and avoids accidental calls.
|
|
12
|
+
- Wallpaper, themes, and UI panels are process-wide and need no per-session split.
|
|
13
|
+
- A single global switch is too coarse.
|
|
14
|
+
|
|
15
|
+
After installing, each third-party plugin is decided once per level — no more walking up the chain to see what is actually on.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
1. **Plugin Manager → Scope** tab: global defaults.
|
|
20
|
+
2. A workspace's “…” menu → **Plugin Scopes…**: workspace overrides.
|
|
21
|
+
3. A session's “…” menu, or the **Plugin Scopes** button next to the new-session row: session overrides.
|
|
22
|
+
|
|
23
|
+
The dialog lists **session-level** plugins only; wallpaper/UI/manager plugins appear only on the global page. Each row shows its type, controllable capability count, classification reason, and the effective value.
|
|
24
|
+
|
|
25
|
+
## What “off” means
|
|
26
|
+
|
|
27
|
+
- It never uninstalls, deletes, or rewrites the plugin's config; it only stops being effective at that level.
|
|
28
|
+
- Tools, prompt sections, contexts and skills: from the next model request the tools disappear from the tool list and calls are rejected; prompt sections and contexts are no longer injected; skills disappear from the catalog and cannot be loaded by name. Turning it back on restores them.
|
|
29
|
+
- **Request interceptors** (plugins that rewrite model requests through `llm/stream`, e.g. `billion-context`): turning them off makes that session's model requests skip their listeners immediately. This is a per-session bypass at the `llm/stream` dispatch point; the plugin stays installed.
|
|
30
|
+
- Global-only plugins: removed from / added back to the profile bundle list; a web restart is required.
|
|
31
|
+
- Official plugins are excluded; base UI bundles are protected from this plugin's toggle.
|
|
32
|
+
|
|
33
|
+
## Classification
|
|
34
|
+
|
|
35
|
+
The plugin's own description (`package.json` / `dsh-plugin.json` description; README only when no description exists) is checked:
|
|
36
|
+
|
|
37
|
+
- tools, models, prompts, context, memory, skills, commands, remote, vision, QQ/bot/companion → **session-level**;
|
|
38
|
+
- wallpaper, theme, skin, UI, panel, manager, cleanup, cookie, notification → **global-only**;
|
|
39
|
+
- otherwise fall back to whether it registers tools/prompts, then global-only.
|
|
40
|
+
|
|
41
|
+
There is intentionally no manual type override, so a row can never claim to be session-level without a capability to hide.
|
|
42
|
+
|
|
43
|
+
## Limits
|
|
44
|
+
|
|
45
|
+
- Client-only UI plugins load once per web boot and cannot disappear per session; only the global switch applies.
|
|
46
|
+
- Plugins that register tools dynamically at runtime (e.g. `billion-context` after connecting) keep the tool filter per session; if they also rewrite `llm/stream`, their listeners are skipped per session as well.
|
|
47
|
+
- Forked sessions and subagents inherit the parent session's overrides (not yet fully implemented).
|
|
48
|
+
- Third-party only; official plugins and the built-in manager/install/update/market are untouched.
|
|
49
|
+
|
|
50
|
+
## Install / uninstall
|
|
51
|
+
|
|
52
|
+
Install it like any bundle, or add the package directory to the profile bundle list and restart.
|
|
53
|
+
|
|
54
|
+
Uninstall by removing this bundle. It does not remove managed plugins or their configs; only its own store (`storages/plugin-scopes/<profile>.json`) goes away.
|
package/docs/DETAIL.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# 插件作用域
|
|
2
|
+
|
|
3
|
+
按会话管理第三方插件是否生效。一条继承链:**全局默认 → 工作区覆盖 → 会话覆盖**。每一层只有“开 / 关 / 继承”,最右列始终是真正生效的结果。
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## 它解决什么
|
|
8
|
+
|
|
9
|
+
有些插件只在特定工作或特定会话里需要:
|
|
10
|
+
|
|
11
|
+
- `dsh-ops`、`modlens`、`billion-context` 这类会向模型注入工具或提示词的插件,某些会话不需要,关掉能少占上下文、少误调用;
|
|
12
|
+
- 壁纸、主题、界面面板这类纯全局插件,不需要按会话分;
|
|
13
|
+
- 同一条规则不该在全局一刀切。
|
|
14
|
+
|
|
15
|
+
装上之后,每个第三方插件在每一层只判断一次“这层要不要它”,不需要反复翻上一级。
|
|
16
|
+
|
|
17
|
+
## 怎么用
|
|
18
|
+
|
|
19
|
+
1. 打开 **插件管理 → 作用域** 页签,这里是全局默认;
|
|
20
|
+
2. 工作区的 “…” 菜单 → **插件作用域…**,改本工作区覆盖;
|
|
21
|
+
3. 会话的 “…” 菜单,或新建会话行右侧的 **插件作用域** 按钮,改本会话覆盖。
|
|
22
|
+
|
|
23
|
+
窗口里只列**会话级**插件;壁纸、界面、管理等纯全局插件只出现在全局页。每一行显示类型、可控制的能力数、判定依据,以及当前真正生效的值。
|
|
24
|
+
|
|
25
|
+
## 关闭的含义
|
|
26
|
+
|
|
27
|
+
- **不会卸载、不会删包、不会改配置**,只是在该层不生效;
|
|
28
|
+
- 工具、提示词、上下文与技能类:下一次模型请求起,工具从工具表消失、调用被拒绝,提示词片段与上下文不再注入,技能目录与技能正文也不再可见;打开后立即可用;
|
|
29
|
+
- **请求拦截类**(通过 `llm/stream` 改写模型请求,例如 `billion-context`):关闭后该会话的模型请求会跳过它的监听器,压缩/改写立即停止;这是作用域插件在 `llm/stream` 派发处做的按会话 bypass,不会卸载插件;
|
|
30
|
+
- 纯全局插件:从 profile 的 bundle 列表移除/加回,需要重启 web 端;
|
|
31
|
+
- 官方插件不在此管理范围内;基础 UI 插件有保护,不能从本插件关闭。
|
|
32
|
+
|
|
33
|
+
## 类型怎么判定
|
|
34
|
+
|
|
35
|
+
读取插件自己的描述(`package.json` / `dsh-plugin.json` 的 description,缺失时才看 README 前段):
|
|
36
|
+
|
|
37
|
+
- 提到工具、模型、提示词、上下文、记忆、技能、命令、远程、视觉、QQ/机器人/伙伴等 → **会话级**;
|
|
38
|
+
- 只提到壁纸、主题、皮肤、界面、面板、管理、清理、cookie、通知等 → **仅全局**;
|
|
39
|
+
- 都没提到 → 回退到“是否注册了工具/提示词”,再不行按仅全局。
|
|
40
|
+
|
|
41
|
+
描述写得好,判定就准。类型不提供手动覆盖,避免出现“标了会话级、实际没有能力可关”的假开关。
|
|
42
|
+
|
|
43
|
+
## 边界
|
|
44
|
+
|
|
45
|
+
- 纯客户端界面插件一次 web 启动只加载一遍,无法按会话消失,只能全局开关;
|
|
46
|
+
- 运行时才动态注册工具的插件(例如 `billion-context` 在连上服务后才拉取工具),工具表按会话过滤;若它同时改写 `llm/stream`,还会按会话跳过监听器;
|
|
47
|
+
- 分叉会话与子代理默认继承父会话的覆盖值(待完善);
|
|
48
|
+
- 只管理第三方插件,不动官方插件与自带安装/更新/市场。
|
|
49
|
+
|
|
50
|
+
## 安装与卸载
|
|
51
|
+
|
|
52
|
+
安装:插件管理里安装本包,或把包目录加入 profile 的 bundle 列表后重启。
|
|
53
|
+
|
|
54
|
+
卸载:在插件管理里移除本 bundle。它不会删除被管理插件的包或配置,只移除自己的存储(`storages/plugin-scopes/<profile>.json`)。
|
package/docs/preview.svg
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="720" height="300" viewBox="0 0 720 300" font-family="system-ui, 'Segoe UI', 'Microsoft YaHei', sans-serif">
|
|
2
|
+
<rect width="720" height="300" rx="16" fill="#0b1220"/>
|
|
3
|
+
<text x="36" y="46" fill="#e2e8f0" font-size="18" font-weight="600">插件作用域 · 一条继承链</text>
|
|
4
|
+
<text x="36" y="70" fill="#94a3b8" font-size="12">关闭只影响该层,包和配置都保留,随时打开</text>
|
|
5
|
+
|
|
6
|
+
<g transform="translate(36,104)">
|
|
7
|
+
<rect width="196" height="140" rx="12" fill="#111c31" stroke="#1e293b"/>
|
|
8
|
+
<text x="18" y="30" fill="#cbd5e1" font-size="14" font-weight="600">全局默认</text>
|
|
9
|
+
<text x="18" y="52" fill="#64748b" font-size="11">所有工作区 / 会话的起点</text>
|
|
10
|
+
<g transform="translate(18,72)">
|
|
11
|
+
<rect width="160" height="26" rx="7" fill="#16233a"/>
|
|
12
|
+
<text x="10" y="17.5" fill="#94a3b8" font-size="11">dsh-ops</text>
|
|
13
|
+
<rect x="122" y="6" width="28" height="14" rx="7" fill="#2563eb"/>
|
|
14
|
+
<circle cx="143" cy="13" r="5" fill="#fff"/>
|
|
15
|
+
</g>
|
|
16
|
+
<g transform="translate(18,104)">
|
|
17
|
+
<rect width="160" height="26" rx="7" fill="#16233a"/>
|
|
18
|
+
<text x="10" y="17.5" fill="#94a3b8" font-size="11">wallpaper-engine</text>
|
|
19
|
+
<rect x="122" y="6" width="28" height="14" rx="7" fill="#334155"/>
|
|
20
|
+
<circle cx="129" cy="13" r="5" fill="#94a3b8"/>
|
|
21
|
+
</g>
|
|
22
|
+
</g>
|
|
23
|
+
|
|
24
|
+
<path d="M240 174 H268" stroke="#334155" stroke-width="2"/>
|
|
25
|
+
<path d="M262 168 l8 6 -8 6" fill="none" stroke="#334155" stroke-width="2"/>
|
|
26
|
+
|
|
27
|
+
<g transform="translate(278,104)">
|
|
28
|
+
<rect width="196" height="140" rx="12" fill="#111c31" stroke="#1e293b"/>
|
|
29
|
+
<text x="18" y="30" fill="#cbd5e1" font-size="14" font-weight="600">工作区覆盖</text>
|
|
30
|
+
<text x="18" y="52" fill="#64748b" font-size="11">只影响这个工作区</text>
|
|
31
|
+
<g transform="translate(18,72)">
|
|
32
|
+
<rect width="160" height="26" rx="7" fill="#16233a"/>
|
|
33
|
+
<text x="10" y="17.5" fill="#94a3b8" font-size="11">dsh-ops</text>
|
|
34
|
+
<rect x="94" y="6" width="56" height="14" rx="7" fill="#1d4ed8"/>
|
|
35
|
+
<text x="100" y="16" fill="#dbeafe" font-size="9">跟随 · 开</text>
|
|
36
|
+
</g>
|
|
37
|
+
<g transform="translate(18,104)">
|
|
38
|
+
<rect width="160" height="26" rx="7" fill="#16233a"/>
|
|
39
|
+
<text x="10" y="17.5" fill="#94a3b8" font-size="11">modlens</text>
|
|
40
|
+
<rect x="94" y="6" width="56" height="14" rx="7" fill="#78350f"/>
|
|
41
|
+
<text x="103" y="16" fill="#fde68a" font-size="9">本层 · 关</text>
|
|
42
|
+
</g>
|
|
43
|
+
</g>
|
|
44
|
+
|
|
45
|
+
<path d="M482 174 H510" stroke="#334155" stroke-width="2"/>
|
|
46
|
+
<path d="M504 168 l8 6 -8 6" fill="none" stroke="#334155" stroke-width="2"/>
|
|
47
|
+
|
|
48
|
+
<g transform="translate(520,104)">
|
|
49
|
+
<rect width="164" height="140" rx="12" fill="#111c31" stroke="#1e293b"/>
|
|
50
|
+
<text x="18" y="30" fill="#cbd5e1" font-size="14" font-weight="600">会话覆盖</text>
|
|
51
|
+
<text x="18" y="52" fill="#64748b" font-size="11">只影响当前会话</text>
|
|
52
|
+
<g transform="translate(18,72)">
|
|
53
|
+
<rect width="128" height="26" rx="7" fill="#16233a"/>
|
|
54
|
+
<text x="10" y="17.5" fill="#94a3b8" font-size="11">modlens</text>
|
|
55
|
+
<rect x="96" y="6" width="24" height="14" rx="7" fill="#334155"/>
|
|
56
|
+
<circle cx="103" cy="13" r="5" fill="#94a3b8"/>
|
|
57
|
+
</g>
|
|
58
|
+
<g transform="translate(18,104)">
|
|
59
|
+
<rect width="128" height="26" rx="7" fill="#16233a"/>
|
|
60
|
+
<text x="10" y="17.5" fill="#94a3b8" font-size="11">dsh-ops</text>
|
|
61
|
+
<rect x="96" y="6" width="24" height="14" rx="7" fill="#2563eb"/>
|
|
62
|
+
<circle cx="115" cy="13" r="5" fill="#fff"/>
|
|
63
|
+
</g>
|
|
64
|
+
</g>
|
|
65
|
+
|
|
66
|
+
<text x="36" y="278" fill="#475569" font-size="11">会话级插件随会话变化;壁纸、界面、管理等纯全局插件只在全局层出现。</text>
|
|
67
|
+
</svg>
|
package/icon.svg
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36">
|
|
2
|
+
<rect width="36" height="36" rx="9" fill="#0f172a"/>
|
|
3
|
+
<rect x="8" y="8" width="20" height="6" rx="2" fill="#64748b"/>
|
|
4
|
+
<rect x="9.5" y="15.5" width="17" height="6" rx="2" fill="#38bdf8" opacity="0.85"/>
|
|
5
|
+
<rect x="11" y="23" width="14" height="5.5" rx="2" fill="#f8fafc"/>
|
|
6
|
+
<circle cx="26" cy="25.75" r="3.2" fill="#22c55e" stroke="#0f172a" stroke-width="1.4"/>
|
|
7
|
+
<path d="M24.7 25.8l1 1 1.7-1.9" fill="none" stroke="#0f172a" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
8
|
+
</svg>
|