dsh-plugins-scope 0.0.0-stage → 0.5.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.md +36 -0
- package/LICENSE +21 -0
- package/README.en.md +89 -0
- package/README.md +93 -2
- package/client.js +693 -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 +60 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.5.1
|
|
4
|
+
|
|
5
|
+
- 工作区/会话右键菜单的「插件作用域…」增加与重命名、删除同级的 SVG 图标。
|
|
6
|
+
|
|
7
|
+
## 0.5.0
|
|
8
|
+
|
|
9
|
+
- npm 包名改为 `dsh-plugins-scope`(`dsh-plugin-scope` 被占用);GitHub 仓库仍为 `ikun250501/dsh-plugin-scope`。
|
|
10
|
+
- 兼容旧名:profile 解析与保护名单同时识别 `dsh-plugin-scope`。
|
|
11
|
+
|
|
12
|
+
## 0.3.1
|
|
13
|
+
|
|
14
|
+
- 新增技能(skills)按作用域过滤:关闭的插件随包技能不再出现在该会话。
|
|
15
|
+
- 新增调试动作 `plugin_scope { action: "skills" }`。
|
|
16
|
+
- 文档补充技能与请求拦截的关闭语义。
|
|
17
|
+
|
|
18
|
+
## 0.3.0
|
|
19
|
+
|
|
20
|
+
- 表格列序调整为「插件 | 本层状态 | 开关」,开关放在最右。
|
|
21
|
+
- 移除“当前生效”列,避免与本层开关重复。
|
|
22
|
+
- 基础插件(base / web-app / web-ui-all / 本插件)强制为仅全局,不参与会话/工作区开关。
|
|
23
|
+
- 移除托管(compose)界面,保留过滤式作用域。
|
|
24
|
+
|
|
25
|
+
## 0.2.0
|
|
26
|
+
|
|
27
|
+
- 新增 `systemPrompt.context` 上下文过滤。
|
|
28
|
+
- 新增 `llm/stream` 请求拦截按作用域跳过(billion-context 这类插件)。
|
|
29
|
+
- 新增插件图标、详情页、中英文 locale。
|
|
30
|
+
- 类型判定改为读取插件描述,不再依赖“是否注册工具”。
|
|
31
|
+
|
|
32
|
+
## 0.1.0
|
|
33
|
+
|
|
34
|
+
- 首次可用版本:全局 / 工作区 / 会话三级继承。
|
|
35
|
+
- 工具(`ToolsService.resolve`)与提示词段(`SystemPrompt.assemble`)按作用域过滤。
|
|
36
|
+
- 插件管理页签、工作区与会话菜单、新建会话入口。
|
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.en.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# dsh-plugins-scope
|
|
2
|
+
|
|
3
|
+
[中文](README.md) | English
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/dsh-plugins-scope)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
8
|
+
|
|
9
|
+
> A **DeepSeek Harness (DSH)** plugin that scopes third-party plugins across **global / workspace / session**, with tri-state inheritance.
|
|
10
|
+
>
|
|
11
|
+
> Each layer is simply **on / off / inherit**. Inherit is the default. Official plugins and base UI do not participate.
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- **Tri-state inheritance** — a session inherits its workspace, a workspace inherits global; any layer that was never changed follows its parent.
|
|
18
|
+
- **Automatic classification** — reads each package description to separate “session-scoped” plugins (tools, models, prompts, skills, agents) from “global-only” plugins (wallpapers, themes, UI, managers).
|
|
19
|
+
- **Five real enforcement points** — turning a plugin off removes its tools from the model schema, stops its prompt sections and contexts from being injected, hides its skills, and skips its `llm/stream` hooks. It is not a UI-only switch.
|
|
20
|
+
- **Three entry points** — Plugin Manager → **Scope** tab; Workspace “…” menu → **Plugin scope…**; Session “…” menu / New Session row → **Plugin scope**. The workspace/session menu items carry their own SVG icon, alongside Rename and Delete.
|
|
21
|
+
|
|
22
|
+
## What "off" means
|
|
23
|
+
|
|
24
|
+
| Kind | After turning off |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| Tools | Gone from the schema on the next model request; direct calls fail |
|
|
27
|
+
| Prompt sections / contexts | Not injected on the next request |
|
|
28
|
+
| Skills | Invisible and unreadable in that session on the next request |
|
|
29
|
+
| `llm/stream` hooks | That session skips the plugin's listeners on the next request |
|
|
30
|
+
| Pure UI / global services | Global toggle only; flips the profile bundle and asks for a restart |
|
|
31
|
+
|
|
32
|
+
Limitations: forked sessions follow the workspace only (they do not inherit the parent session's overrides); pure client UI is loaded once per web boot; a plugin's own timers/background services are not stopped by “off”. This plugin is a scope manager, not a sandbox.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
Requirements: DSH `0.2.2-rc.x`, Node.js `>= 24.9`.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# From npm
|
|
40
|
+
dsh plugin --profile <profile> add dsh-plugins-scope
|
|
41
|
+
|
|
42
|
+
# From GitHub
|
|
43
|
+
dsh plugin --profile <profile> add github:ikun250501/dsh-plugins-scope
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
In the desktop client you can also use the plugin manager: `plugin_manager install_bundle target=<package>`.
|
|
47
|
+
Restart the instance if it asks you to.
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
1. **Plugin Manager → Scope** — set the global default for every third-party plugin.
|
|
52
|
+
2. **Workspace “…” → Plugin scope…** — override for that workspace only.
|
|
53
|
+
3. **Session “…” or the New Session row** — override for that session only; changes apply on the next step.
|
|
54
|
+
|
|
55
|
+
## Compatibility
|
|
56
|
+
|
|
57
|
+
The plugin patches DSH internals:
|
|
58
|
+
|
|
59
|
+
- `ToolsService.resolve`
|
|
60
|
+
- `SystemPrompt.assemble` / `SystemPrompt.context`
|
|
61
|
+
- `SkillsService.list` / `get`
|
|
62
|
+
- `EventsService.waterfall` (only `llm/stream`)
|
|
63
|
+
- `AgentLoop.initializeAgent` (only when managed loading is enabled)
|
|
64
|
+
- `agentLoop.initializeAgent` (managed composition only)
|
|
65
|
+
|
|
66
|
+
These are internal implementations, not a stable public API. A DSH upgrade may break them. After upgrading DSH, verify in a throwaway session that turning a plugin off really removes its tools/prompts.
|
|
67
|
+
|
|
68
|
+
## Uninstall
|
|
69
|
+
|
|
70
|
+
1. Remove `dsh-plugins-scope` in the plugin manager (or run `plugin_manager remove_bundle`).
|
|
71
|
+
2. Confirm it is gone from the profile `package.json` dependencies and `dsh.profile.bundles`.
|
|
72
|
+
3. Optionally delete `storages/plugin-scopes/<profile>.json` to remove saved scopes.
|
|
73
|
+
|
|
74
|
+
## Development
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm run check # node --check index.js && node --check client.js
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Layout:
|
|
81
|
+
|
|
82
|
+
- `index.js` — host side: storage, resolution, classification, the five enforcement points.
|
|
83
|
+
- `client.js` — scope tab, workspace/session menus, new-session entry.
|
|
84
|
+
- `cordis.patch.yml` — bundle entry (`plugin-scopes`).
|
|
85
|
+
- `docs/DETAIL.md` — full behavior and boundaries.
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
MIT.
|
package/README.md
CHANGED
|
@@ -1,3 +1,94 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-plugins-scope
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](README.en.md) | 中文
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/dsh-plugins-scope)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
8
|
+
|
|
9
|
+
> **DeepSeek Harness(DSH)插件**:按 **全局 / 工作区 / 会话** 三级管理第三方插件是否生效。
|
|
10
|
+
>
|
|
11
|
+
> 每一层只有 **开 / 关 / 继承**,默认继承;官方插件和基础 UI 不参与。
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
## 功能
|
|
16
|
+
|
|
17
|
+
- **三级继承**:会话覆盖工作区,工作区覆盖全局;没设过的层自动跟随上一层。
|
|
18
|
+
- **自动分类**:读取插件包描述,区分“会话级”(工具、模型、提示词、技能、代理等)与“仅全局”(壁纸、主题、界面、管理器等)。
|
|
19
|
+
- **五个真实出口**:关闭后,工具从模型工具表消失、提示词段与上下文不再注入、随包技能不再出现、`llm/stream` 请求拦截被跳过;不是只把界面上的字改掉。
|
|
20
|
+
- **三处入口**:插件管理 → **作用域** 页签;工作区 “…” 菜单 → **插件作用域…**;会话 “…” 菜单 / 新建会话行 → **插件作用域**。工作区/会话菜单项带独立 SVG 图标,与重命名、删除同级。
|
|
21
|
+
|
|
22
|
+
## 关闭的语义
|
|
23
|
+
|
|
24
|
+
| 类型 | 关闭后 |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| 工具 | 下一次模型请求起从 schema 消失,硬调用会失败 |
|
|
27
|
+
| 提示词段 / 上下文 | 下一次请求起不再注入 |
|
|
28
|
+
| 技能 | 下一次请求起该会话看不到、也读不到 |
|
|
29
|
+
| `llm/stream` 拦截 | 该会话的下一次请求跳过该插件的监听 |
|
|
30
|
+
| 纯 UI / 全局服务 | 只提供全局开关;切换 profile bundle 并提示重启,重启后不再加载 |
|
|
31
|
+
|
|
32
|
+
限制:分叉会话只按工作区计算,不继承父会话的覆盖;纯客户端 UI 一次 web 启动只加载一遍;插件的后台定时器/自有服务不因“关”而停止。本插件是作用域管理,不是沙箱。
|
|
33
|
+
|
|
34
|
+
## 安装
|
|
35
|
+
|
|
36
|
+
要求:DSH `0.2.2-rc.x`,Node.js `>= 24.9`。
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# 从 npm
|
|
40
|
+
dsh plugin --profile <profile> add dsh-plugins-scope
|
|
41
|
+
|
|
42
|
+
# 从 GitHub(npm 尚未发布对应版本时)
|
|
43
|
+
dsh plugin --profile <profile> add github:ikun250501/dsh-plugins-scope
|
|
44
|
+
|
|
45
|
+
# 本地开发(<本地包目录> 指向含 dsh.bundle.patch 的目录)
|
|
46
|
+
dsh plugin --profile <profile> add <本地包目录>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
桌面客户端也可用插件管理器安装:`plugin_manager install_bundle target=<包目录或包名>`。安装后若提示重启,重启对应实例。
|
|
50
|
+
|
|
51
|
+
## 使用
|
|
52
|
+
|
|
53
|
+
1. 打开 **插件管理 → 作用域**:设置每个第三方插件的全局默认。
|
|
54
|
+
2. 工作区 “…” → **插件作用域…**:只改这个工作区。
|
|
55
|
+
3. 会话 “…” 或新建会话行:只改这个会话;改动在下一步生效。
|
|
56
|
+
|
|
57
|
+
## 兼容性
|
|
58
|
+
|
|
59
|
+
本插件通过 patch DSH 内部服务实现过滤:
|
|
60
|
+
|
|
61
|
+
- `ToolsService.resolve`
|
|
62
|
+
- `SystemPrompt.assemble` / `SystemPrompt.context`
|
|
63
|
+
- `SkillsService.list` / `get`
|
|
64
|
+
- `EventsService.waterfall`(仅 `llm/stream`)
|
|
65
|
+
- `AgentLoop.initializeAgent`(仅在启用托管加载时)
|
|
66
|
+
|
|
67
|
+
这些是内部实现,不是公开稳定 API;DSH 升级后可能失效。升级 DSH 后请先在一个临时会话里验证“关掉后工具/提示词确实消失”。
|
|
68
|
+
|
|
69
|
+
## 卸载
|
|
70
|
+
|
|
71
|
+
1. 在插件管理器里移除 `dsh-plugins-scope`(或 `plugin_manager remove_bundle`)。
|
|
72
|
+
2. 确认 profile 的 `package.json` 依赖与 `dsh.profile.bundles` 里不再有它。
|
|
73
|
+
3. 存储可保留,也可删除 `storages/plugin-scopes/<profile>.json`。
|
|
74
|
+
|
|
75
|
+
## 开发
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm run check # node --check index.js && node --check client.js
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
目录:
|
|
82
|
+
|
|
83
|
+
- `index.js`:宿主端;存储、解析、分类、五个出口的过滤。
|
|
84
|
+
- `client.js`:设置页签、工作区/会话菜单、新建会话入口。
|
|
85
|
+
- `cordis.patch.yml`:bundle 入口(`plugin-scopes`)。
|
|
86
|
+
- `docs/DETAIL.md`:完整行为与边界。
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
MIT。
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
English README: [README.en.md](README.en.md)
|