dsh-plugins-scope 0.5.0 → 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 CHANGED
@@ -1,10 +1,14 @@
1
+ # Changelog
2
+
3
+ ## 0.5.1
4
+
5
+ - 工作区/会话右键菜单的「插件作用域…」增加与重命名、删除同级的 SVG 图标。
6
+
1
7
  ## 0.5.0
2
8
 
3
9
  - npm 包名改为 `dsh-plugins-scope`(`dsh-plugin-scope` 被占用);GitHub 仓库仍为 `ikun250501/dsh-plugin-scope`。
4
10
  - 兼容旧名:profile 解析与保护名单同时识别 `dsh-plugin-scope`。
5
11
 
6
- # Changelog
7
-
8
12
  ## 0.3.1
9
13
 
10
14
  - 新增技能(skills)按作用域过滤:关闭的插件随包技能不再出现在该会话。
package/README.en.md ADDED
@@ -0,0 +1,89 @@
1
+ # dsh-plugins-scope
2
+
3
+ [中文](README.md) | English
4
+
5
+ [![npm](https://img.shields.io/npm/v/dsh-plugins-scope)](https://www.npmjs.com/package/dsh-plugins-scope)
6
+ [![license](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
7
+ [![DSH](https://img.shields.io/badge/DSH-0.2.2--rc.x-6f42c1)](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
+ ![tri-state inheritance](docs/preview.svg)
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,6 +1,14 @@
1
- # 插件作用域 / dsh-plugins-scope
1
+ # dsh-plugins-scope
2
2
 
3
- 按 **全局 / 工作区 / 会话** 三级管理第三方插件是否生效。每一层只有 **开 / 关 / 继承**,默认继承;官方插件和基础 UI 不参与。
3
+ [English](README.en.md) | 中文
4
+
5
+ [![npm](https://img.shields.io/npm/v/dsh-plugins-scope)](https://www.npmjs.com/package/dsh-plugins-scope)
6
+ [![license](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
7
+ [![DSH](https://img.shields.io/badge/DSH-0.2.2--rc.x-6f42c1)](https://github.com/deepseek-ai/deepseek-harness)
8
+
9
+ > **DeepSeek Harness(DSH)插件**:按 **全局 / 工作区 / 会话** 三级管理第三方插件是否生效。
10
+ >
11
+ > 每一层只有 **开 / 关 / 继承**,默认继承;官方插件和基础 UI 不参与。
4
12
 
5
13
  ![三级继承示意](docs/preview.svg)
6
14
 
@@ -9,7 +17,7 @@
9
17
  - **三级继承**:会话覆盖工作区,工作区覆盖全局;没设过的层自动跟随上一层。
10
18
  - **自动分类**:读取插件包描述,区分“会话级”(工具、模型、提示词、技能、代理等)与“仅全局”(壁纸、主题、界面、管理器等)。
11
19
  - **五个真实出口**:关闭后,工具从模型工具表消失、提示词段与上下文不再注入、随包技能不再出现、`llm/stream` 请求拦截被跳过;不是只把界面上的字改掉。
12
- - **三处入口**:插件管理 → **作用域** 页签;工作区 “…” 菜单 → **插件作用域…**;会话 “…” 菜单 / 新建会话行 → **插件作用域**。
20
+ - **三处入口**:插件管理 → **作用域** 页签;工作区 “…” 菜单 → **插件作用域…**;会话 “…” 菜单 / 新建会话行 → **插件作用域**。工作区/会话菜单项带独立 SVG 图标,与重命名、删除同级。
13
21
 
14
22
  ## 关闭的语义
15
23
 
@@ -28,11 +36,14 @@
28
36
  要求:DSH `0.2.2-rc.x`,Node.js `>= 24.9`。
29
37
 
30
38
  ```bash
31
- # 从 GitHub
39
+ # 从 npm
40
+ dsh plugin --profile <profile> add dsh-plugins-scope
41
+
42
+ # 从 GitHub(npm 尚未发布对应版本时)
32
43
  dsh plugin --profile <profile> add github:ikun250501/dsh-plugins-scope
33
44
 
34
- # 本地开发
35
- dsh plugin --profile <profile> add dsh-plugins-scope
45
+ # 本地开发(<本地包目录> 指向含 dsh.bundle.patch 的目录)
46
+ dsh plugin --profile <profile> add <本地包目录>
36
47
  ```
37
48
 
38
49
  桌面客户端也可用插件管理器安装:`plugin_manager install_bundle target=<包目录或包名>`。安装后若提示重启,重启对应实例。
@@ -51,6 +62,7 @@ dsh plugin --profile <profile> add dsh-plugins-scope
51
62
  - `SystemPrompt.assemble` / `SystemPrompt.context`
52
63
  - `SkillsService.list` / `get`
53
64
  - `EventsService.waterfall`(仅 `llm/stream`)
65
+ - `AgentLoop.initializeAgent`(仅在启用托管加载时)
54
66
 
55
67
  这些是内部实现,不是公开稳定 API;DSH 升级后可能失效。升级 DSH 后请先在一个临时会话里验证“关掉后工具/提示词确实消失”。
56
68
 
@@ -79,6 +91,4 @@ MIT。
79
91
 
80
92
  ---
81
93
 
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.
94
+ English README: [README.en.md](README.en.md)
package/client.js CHANGED
@@ -607,6 +607,17 @@ window.__ModuleLoader__.load({
607
607
  }, '插件作用域');
608
608
  }
609
609
 
610
+ function IconScope() {
611
+ return h('svg', {
612
+ width: 16, height: 16, viewBox: '0 0 16 16', fill: 'none',
613
+ stroke: 'currentColor', strokeWidth: 1.2, strokeLinejoin: 'round', 'aria-hidden': 'true',
614
+ },
615
+ h('rect', { x: 2.25, y: 2.25, width: 11.5, height: 3.1, rx: 1.1 }),
616
+ h('rect', { x: 2.25, y: 6.45, width: 8.5, height: 3.1, rx: 1.1 }),
617
+ h('rect', { x: 2.25, y: 10.65, width: 5.4, height: 3.1, rx: 1.1 }),
618
+ )
619
+ }
620
+
610
621
  function workspaceMenu(ctx) {
611
622
  return ctx.effect(() => ctx.contextMenus.register({
612
623
  id: 'dsh-plugins-scope:workspace',
@@ -617,6 +628,7 @@ window.__ModuleLoader__.load({
617
628
  return [{
618
629
  id: 'plugin-scopes:open',
619
630
  label: '插件作用域…',
631
+ icon: { key: 'plugin-scope' },
620
632
  run: () => openDialog({
621
633
  level: 'workspace',
622
634
  id: workspaceId,
@@ -637,6 +649,7 @@ window.__ModuleLoader__.load({
637
649
  return [{
638
650
  id: 'plugin-scopes:open',
639
651
  label: '插件作用域…',
652
+ icon: { key: 'plugin-scope' },
640
653
  run: () => openDialog({
641
654
  level: 'session',
642
655
  id: sessionId,
@@ -668,6 +681,10 @@ window.__ModuleLoader__.load({
668
681
  order: 800,
669
682
  label: '插件作用域窗口',
670
683
  }, OverlayHost));
684
+ ctx.slots.inject('contextMenu.icon', () => ctx.slots.register({
685
+ name: 'contextMenu.icon',
686
+ key: 'plugin-scope',
687
+ }, IconScope));
671
688
  workspaceMenu(ctx);
672
689
  sessionMenu(ctx);
673
690
  },
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "dsh-plugins-scope",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "type": "module",
5
- "description": "第三方插件作用域管理:全局 / 工作区 / 会话三级继承;工具、提示词、上下文、技能与 llm/stream 拦截按作用域真实隐藏。",
5
+ "description": "DeepSeek Harness 插件:按全局 / 工作区 / 会话三级管理第三方插件是否生效,真实隐藏工具、提示词、上下文、技能与 llm/stream 拦截。",
6
6
  "license": "MIT",
7
7
  "author": "ikun250501",
8
8
  "repository": {
@@ -20,11 +20,14 @@
20
20
  "check": "node --check index.js && node --check client.js"
21
21
  },
22
22
  "keywords": [
23
+ "deepseek-harness",
23
24
  "dsh",
25
+ "dsh-plugin",
24
26
  "plugin",
25
27
  "scope",
26
28
  "session",
27
- "workspace"
29
+ "workspace",
30
+ "plugin-manager"
28
31
  ],
29
32
  "exports": {
30
33
  ".": "./index.js",
@@ -40,6 +43,7 @@
40
43
  "docs",
41
44
  "icon.svg",
42
45
  "README.md",
46
+ "README.en.md",
43
47
  "CHANGELOG.md",
44
48
  "LICENSE"
45
49
  ],