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 ADDED
@@ -0,0 +1,32 @@
1
+ ## 0.5.0
2
+
3
+ - npm 包名改为 `dsh-plugins-scope`(`dsh-plugin-scope` 被占用);GitHub 仓库仍为 `ikun250501/dsh-plugin-scope`。
4
+ - 兼容旧名:profile 解析与保护名单同时识别 `dsh-plugin-scope`。
5
+
6
+ # Changelog
7
+
8
+ ## 0.3.1
9
+
10
+ - 新增技能(skills)按作用域过滤:关闭的插件随包技能不再出现在该会话。
11
+ - 新增调试动作 `plugin_scope { action: "skills" }`。
12
+ - 文档补充技能与请求拦截的关闭语义。
13
+
14
+ ## 0.3.0
15
+
16
+ - 表格列序调整为「插件 | 本层状态 | 开关」,开关放在最右。
17
+ - 移除“当前生效”列,避免与本层开关重复。
18
+ - 基础插件(base / web-app / web-ui-all / 本插件)强制为仅全局,不参与会话/工作区开关。
19
+ - 移除托管(compose)界面,保留过滤式作用域。
20
+
21
+ ## 0.2.0
22
+
23
+ - 新增 `systemPrompt.context` 上下文过滤。
24
+ - 新增 `llm/stream` 请求拦截按作用域跳过(billion-context 这类插件)。
25
+ - 新增插件图标、详情页、中英文 locale。
26
+ - 类型判定改为读取插件描述,不再依赖“是否注册工具”。
27
+
28
+ ## 0.1.0
29
+
30
+ - 首次可用版本:全局 / 工作区 / 会话三级继承。
31
+ - 工具(`ToolsService.resolve`)与提示词段(`SystemPrompt.assemble`)按作用域过滤。
32
+ - 插件管理页签、工作区与会话菜单、新建会话入口。
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 dsh-plugins-scope contributors
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.md CHANGED
@@ -1,3 +1,84 @@
1
- # Temporary Holding Version
1
+ # 插件作用域 / dsh-plugins-scope
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 按 **全局 / 工作区 / 会话** 三级管理第三方插件是否生效。每一层只有 **开 / 关 / 继承**,默认继承;官方插件和基础 UI 不参与。
4
+
5
+ ![三级继承示意](docs/preview.svg)
6
+
7
+ ## 功能
8
+
9
+ - **三级继承**:会话覆盖工作区,工作区覆盖全局;没设过的层自动跟随上一层。
10
+ - **自动分类**:读取插件包描述,区分“会话级”(工具、模型、提示词、技能、代理等)与“仅全局”(壁纸、主题、界面、管理器等)。
11
+ - **五个真实出口**:关闭后,工具从模型工具表消失、提示词段与上下文不再注入、随包技能不再出现、`llm/stream` 请求拦截被跳过;不是只把界面上的字改掉。
12
+ - **三处入口**:插件管理 → **作用域** 页签;工作区 “…” 菜单 → **插件作用域…**;会话 “…” 菜单 / 新建会话行 → **插件作用域**。
13
+
14
+ ## 关闭的语义
15
+
16
+ | 类型 | 关闭后 |
17
+ | --- | --- |
18
+ | 工具 | 下一次模型请求起从 schema 消失,硬调用会失败 |
19
+ | 提示词段 / 上下文 | 下一次请求起不再注入 |
20
+ | 技能 | 下一次请求起该会话看不到、也读不到 |
21
+ | `llm/stream` 拦截 | 该会话的下一次请求跳过该插件的监听 |
22
+ | 纯 UI / 全局服务 | 只提供全局开关;切换 profile bundle 并提示重启,重启后不再加载 |
23
+
24
+ 限制:分叉会话只按工作区计算,不继承父会话的覆盖;纯客户端 UI 一次 web 启动只加载一遍;插件的后台定时器/自有服务不因“关”而停止。本插件是作用域管理,不是沙箱。
25
+
26
+ ## 安装
27
+
28
+ 要求:DSH `0.2.2-rc.x`,Node.js `>= 24.9`。
29
+
30
+ ```bash
31
+ # 从 GitHub
32
+ dsh plugin --profile <profile> add github:ikun250501/dsh-plugins-scope
33
+
34
+ # 本地开发
35
+ dsh plugin --profile <profile> add dsh-plugins-scope
36
+ ```
37
+
38
+ 桌面客户端也可用插件管理器安装:`plugin_manager install_bundle target=<包目录或包名>`。安装后若提示重启,重启对应实例。
39
+
40
+ ## 使用
41
+
42
+ 1. 打开 **插件管理 → 作用域**:设置每个第三方插件的全局默认。
43
+ 2. 工作区 “…” → **插件作用域…**:只改这个工作区。
44
+ 3. 会话 “…” 或新建会话行:只改这个会话;改动在下一步生效。
45
+
46
+ ## 兼容性
47
+
48
+ 本插件通过 patch DSH 内部服务实现过滤:
49
+
50
+ - `ToolsService.resolve`
51
+ - `SystemPrompt.assemble` / `SystemPrompt.context`
52
+ - `SkillsService.list` / `get`
53
+ - `EventsService.waterfall`(仅 `llm/stream`)
54
+
55
+ 这些是内部实现,不是公开稳定 API;DSH 升级后可能失效。升级 DSH 后请先在一个临时会话里验证“关掉后工具/提示词确实消失”。
56
+
57
+ ## 卸载
58
+
59
+ 1. 在插件管理器里移除 `dsh-plugins-scope`(或 `plugin_manager remove_bundle`)。
60
+ 2. 确认 profile 的 `package.json` 依赖与 `dsh.profile.bundles` 里不再有它。
61
+ 3. 存储可保留,也可删除 `storages/plugin-scopes/<profile>.json`。
62
+
63
+ ## 开发
64
+
65
+ ```bash
66
+ npm run check # node --check index.js && node --check client.js
67
+ ```
68
+
69
+ 目录:
70
+
71
+ - `index.js`:宿主端;存储、解析、分类、五个出口的过滤。
72
+ - `client.js`:设置页签、工作区/会话菜单、新建会话入口。
73
+ - `cordis.patch.yml`:bundle 入口(`plugin-scopes`)。
74
+ - `docs/DETAIL.md`:完整行为与边界。
75
+
76
+ ## License
77
+
78
+ MIT。
79
+
80
+ ---
81
+
82
+ # dsh-plugins-scope (English)
83
+
84
+ Scope manager for third-party DSH plugins across **global / workspace / session**, with tri-state inheritance. It filters tools, prompt sections, contexts, skills and `llm/stream` hooks per agent; pure UI plugins only get a global toggle. Requires DSH `0.2.2-rc.x` and Node.js `>= 24.9`. It patches DSH internals, so re-verify after DSH upgrades. MIT licensed.