dsh-plugin-manager-plus 1.3.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 new-256 (chenglong)
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 ADDED
@@ -0,0 +1,149 @@
1
+ # dsh-plugin-manager-plus · DSH 插件管理器
2
+
3
+ [English](#english) | 中文
4
+
5
+ DeepSeek Harness (DSH) Desktop 宿主插件:把「插件市场」与「插件管理」装进 Web GUI 的 **设置 → 插件** 面板 —— 搜索并一键安装 npm 社区插件,启停/卸载已安装插件(含你自研的),所有变更持久化、热生效。
6
+
7
+ 零 npm 依赖 · 纯 Node 内置模块 + 原生 React · 中文/英文双语界面
8
+
9
+ ## 📐 适配版本
10
+
11
+ | 项 | 值 |
12
+ |---|---|
13
+ | DSH CLI(`@deepseek-ai/dsh`) | `>=0.1.1-rc.2`(声明于 `peerDependencies` 与 `dsh.compatibility`) |
14
+ | 实测通过 | `0.1.1-rc.2`、`0.1.2-alpha.5`、`0.1.3-alpha.2` |
15
+ | DSH Desktop | `>=0.3.15`(实测 0.3.15) |
16
+ | Node | `>=20`(`engines`) |
17
+
18
+ - **标准分发形态(npm)**:patch 层只需**一条裸包名行** —— 包 `main`(`lib/index.mjs`)加载宿主半,`dsh.client` 声明让 client-modules 自动把 `lib/client.js` 纳入浏览器花名册(combo URL 分发);再写一条裸包名 client 行反而会触发「同包双 Loader 源」组合错误(DSH 0.1.2-alpha.x 起)。
19
+ - **DSH 0.1.1-rc.x(旧版)**:除 host 行外还需第二条裸包名 client 行(旧版靠 `require.resolve` 扫描花名册)。
20
+ - 安装后包内 `cordis.patch.yml`(`dsh.bundle.patch`)自动挂载为 profile 的 bundle 层。
21
+ - `GET /plugin-manager/api/version` 同时上报插件版本、宿主 DSH 版本与兼容性声明,便于核对。
22
+
23
+ ---
24
+
25
+ ## ✨ 功能
26
+
27
+ ### 🛒 插件市场(标签页)
28
+
29
+ - 实时检索 npm 上的 DSH 社区插件(npmmirror 主源 + npmjs 兜底,大陆网络友好)
30
+ - 展示包名 / 版本 / 描述 / 发布日期,已安装的包自动标记
31
+ - 一键安装:`dsh plugin --profile web add`(pnpm 官方路径,npm 兜底)→ 自动在家级补丁层登记 → **watchUserPatches 热重载,无需重启后端**
32
+
33
+ ### 🗂 插件管理(标签页)
34
+
35
+ 聚合 Cordis Loader 运行时与家级补丁账本(`$DSH_HOME/cordis.patch.yml`),**三维度筛选 + 搜索交集过滤**:
36
+
37
+ | 维度 | 选项 |
38
+ |---|---|
39
+ | **来源** | 全部 · 社区插件(npm 安装)· 核心插件(官方 bundle)· 用户插件(自研 file:///junction) |
40
+ | **用途** | 全部 · 编程开发 · 会话聊天 · 模型智能 · 界面增强 · 网络接入 · 系统底层 · 其他(规则引擎自动归类) |
41
+ | **状态** | 全部 · 已启用 · 已停用 |
42
+
43
+ 每张卡片:模块短名 / Loader entry id / 挂载状态点(绿=已挂载,红=失败,灰=未挂载)/ 来源标签,以及——
44
+
45
+ - **启用 / 停用**:写入家级补丁层的 `disabled`(内置行自动生成覆盖块),热重载即时生效
46
+ - **卸载**(仅用户层插件):
47
+ - npm 社区插件 → 删补丁行 + `pnpm remove`
48
+ - 自研 junction 插件 → 删补丁行 + 清理三处 junction
49
+ - 本地 `file://` 插件 → 仅删补丁行(源码保留)
50
+ - 官方内置插件受保护,只能停用
51
+
52
+ ### 🛡 安全
53
+
54
+ - **Loopback 校验**:仅 127.0.0.1 / ::1 可访问 API
55
+ - **Host 端口比对** + **CSRF 防护**(Sec-Fetch-Site / Origin)
56
+ - 补丁文件编辑 **fail-safe**:块级文本操作保留全部注释与格式,解析失败绝不落盘;每次写入前滚动备份 `cordis.patch.yml.bak-pm`
57
+ - 补丁写入带 **mtime 乐观锁**:与其他会话/手工编辑并发冲突时自动重读重试(3 次),多次冲突才报错,不覆盖他人修改
58
+ - 安装/卸载任务**串行队列**,带超时与进程清理
59
+ - UI 层防自锁:停用插件管理器自身前强警告(停用后需手改补丁文件恢复)
60
+
61
+ ---
62
+
63
+ ## 📦 安装
64
+
65
+ ### 方式一:npm 标准安装(推荐)
66
+
67
+ 插件已发布到 npm,用 DSH 官方插件命令直接安装(转发 pnpm,跨设备可重复):
68
+
69
+ ```powershell
70
+ dsh plugin --profile web add dsh-plugin-manager-plus
71
+ ```
72
+
73
+ 安装后包内 `cordis.patch.yml`(`dsh.bundle.patch`)自动作为 profile 的 bundle 层挂载通用默认行(host 半裸包名解析,client 半自动进浏览器花名册),刷新浏览器即可在「设置 → 插件」看到两个新标签页。**无需任何手动接线**。
74
+
75
+ > 需要手动写家级补丁行时(如为了用户层覆写/持久化),追加:
76
+ > ```yaml
77
+ > - insert:
78
+ > - id: plugin-manager
79
+ > name: dsh-plugin-manager-plus
80
+ > ```
81
+
82
+ ### 方式二:git clone + 接线脚本(本地开发)
83
+
84
+ ```powershell
85
+ git clone https://github.com/new-256/dsh-plugin-manager.git
86
+ cd dsh-plugin-manager
87
+ pwsh -File install.ps1
88
+ ```
89
+
90
+ 脚本会:① 建立三处 junction(`$DSH_HOME/node_modules`、`$DSH_HOME/profiles/node_modules`、`$DSH_HOME/profiles/web/node_modules`);② 检查/提示家级补丁层 `$DSH_HOME\cordis.patch.yml` 的裸包名行。
91
+
92
+ ### 方式三:从其他插件市场安装
93
+
94
+ 在 DSH 的任意插件市场里搜索 `dsh-plugin-manager-plus` 安装(npmmirror 已同步)。
95
+
96
+ ### 生效
97
+
98
+ - 家级补丁层写入并保存后,dsh 后端的 `watchUserPatches` 会自动热重载(约几秒)
99
+ - 浏览器**刷新页面**后即可在「设置 → 插件」看到「插件管理」「插件市场」两个新标签页
100
+
101
+ ---
102
+
103
+ ## 🧩 包结构
104
+
105
+ ```
106
+ dsh-plugin-manager/
107
+ ├── package.json # dsh.client 声明(花名册入口)+ dsh.bundle.patch + exports
108
+ ├── cordis.patch.yml # bundle 补丁层(安装后自动挂载通用默认行)
109
+ ├── lib/
110
+ │ ├── index.mjs # 宿主半:API 路由、分类引擎、补丁编辑器、任务队列(package main)
111
+ │ └── client.js # 浏览器半:插件管理/插件市场两个 settings.plugins.tab
112
+ ├── install.ps1 # 本地开发接线脚本(junction 三处 + 补丁行检查)
113
+ └── README.md
114
+ ```
115
+
116
+ **宿主半 API**(`/plugin-manager/api/*`,前缀路由挂载于 webServer):
117
+ `version`(含插件版本/宿主 DSH 版本/兼容性声明)· `status` · `inventory`(含 category/funcCategory/enabled)· `search` · `install` · `toggle` · `uninstall`
118
+
119
+ **接线原理(标准形态)**:patch 层只需**一条裸包名行** `name: dsh-plugin-manager-plus` —— loader 按包 `main`(`lib/index.mjs`)加载宿主半;client 半靠 `package.json` 的 `dsh.client` 声明被宿主 client-modules 自动纳入浏览器花名册(combo URL 分发),无需单独一行。包内 `cordis.patch.yml` 经 `dsh.bundle.patch` 在安装后自动挂载为 profile 的 bundle 层。
120
+
121
+ ---
122
+
123
+ ## 🔧 开发与热更新
124
+
125
+ - 改 `lib/client.js` → **刷新浏览器**即生效(client bundle rev 自动变化)
126
+ - 改 `lib/index.mjs` → **重启 DSH Desktop** 生效;或临时把补丁行 `name` 改成 `dsh-plugin-manager-plus?v=N` 触发热重载(N 递增),验证后改回
127
+ - profiles 目录被 DSH Desktop 隔离重建后 junction 会丢 → 重跑 `install.ps1`
128
+ - 用途分类规则在 `lib/index.mjs` 顶部的 `FUNC_RULES`(官方包前缀表)与 `COMMUNITY_FUNC_RULES`(社区包关键词表),可自行增删
129
+
130
+ ## ⚠️ 安全须知
131
+
132
+ 插件以宿主完整权限运行。本管理器只做了安装来源的便利性,**不会**审计第三方插件代码——安装社区插件前请自行确认信任度(同手动 `dsh plugin add` 的信任模型)。
133
+
134
+ ---
135
+
136
+ ## English
137
+
138
+ A DeepSeek Harness (DSH) Desktop host plugin that puts a **Plugin Marketplace** and a **Plugin Manager** into the Web GUI's *Settings → Plugins* panel: search & one-click-install community plugins from npm, toggle/uninstall installed plugins (including your own), with all changes persisted and hot-reloaded.
139
+
140
+ - **Market tab**: live npm search (npmmirror + npmjs fallback), one-click install via the official `dsh plugin add` path, auto-registered into the home-level patch layer, hot-reloaded without backend restart.
141
+ - **Manager tab**: three filter dimensions (source: community/core/user · function: coding/chat/models/UI/network/infra/other · status: enabled/disabled) + search; per-plugin mount state, hot enable/disable, and categorized uninstall (npm package / junction / local file; core rows are protected).
142
+ - **Security**: loopback-only API, host-port & CSRF checks, fail-safe comment-preserving patch editor with rolling backup and mtime optimistic locking (auto re-read/retry on concurrent writers), serialized task queue.
143
+ - Zero npm dependencies; bilingual UI (zh/en).
144
+
145
+ Compatibility: DSH `>=0.1.1-rc.2` (declared in `peerDependencies` and `dsh.compatibility`; tested on `0.1.1-rc.2`, `0.1.2-alpha.5` and `0.1.3-alpha.2`, DSH Desktop 0.3.15, Node >= 20). Standard npm distribution: **one bare-package patch row** — the loader resolves the package `main` (`lib/index.mjs`) for the host half, and client-modules picks up `lib/client.js` from the `dsh.client` declaration automatically (combo-URL roster); a second bare-package client row is a composition error on DSH `0.1.2-alpha.x+`. The in-package `cordis.patch.yml` is mounted automatically as the profile's bundle layer via `dsh.bundle.patch`.
146
+
147
+ Install: `dsh plugin --profile web add dsh-plugin-manager-plus` (npm), or `git clone` + `pwsh -File install.ps1` for local development (creates the three junctions and checks the bare-package row in `$DSH_HOME\cordis.patch.yml`), then refresh the browser.
148
+
149
+ License: MIT
@@ -0,0 +1,17 @@
1
+ # dsh-plugin-manager-plus — bundle 补丁层(标准分发形态)
2
+ #
3
+ # 本文件由 DSH 插件系统在安装后自动作为 profile 的 bundle 层挂载:
4
+ # dsh plugin --profile web add dsh-plugin-manager-plus (npm registry)
5
+ # dsh plugin --profile web add <本地包路径> (本地安装)
6
+ # 声明位置: package.json 的 dsh.bundle.patch。
7
+ #
8
+ # host 半用裸包名解析(package.json main → lib/index.mjs);client 半
9
+ # (浏览器)靠 package.json 的 dsh.client 声明被宿主 client-modules
10
+ # 自动纳入花名册,无需单独一行。
11
+ #
12
+ # 此处只放通用默认值。机器特定配置(如路径类)请写在用户层补丁
13
+ # Windows: %APPDATA%\DSH Desktop\dsh-home\cordis.patch.yml
14
+ # 的同 id 行里 — 用户层后应用,按行 id 整体覆盖本行 config。
15
+ - insert:
16
+ - id: plugin-manager
17
+ name: dsh-plugin-manager-plus