dsh-modpack-kit 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,75 @@
1
+ # PolyForm Noncommercial License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
4
+
5
+ Required Notice: Copyright (c) 2026 Vesna-Strivozha-cn (DSH 也要整合包)
6
+
7
+ ## Acceptance
8
+
9
+ In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
14
+
15
+ ## Distribution License
16
+
17
+ The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
18
+
19
+ ## Notices
20
+
21
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
22
+
23
+ > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
24
+
25
+ ## Changes and New Works License
26
+
27
+ The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
28
+
29
+ ## Patent License
30
+
31
+ The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
32
+
33
+ ## Noncommercial Purposes
34
+
35
+ Any noncommercial purpose is a permitted purpose.
36
+
37
+ ## Personal Uses
38
+
39
+ Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
40
+
41
+ ## Noncommercial Organizations
42
+
43
+ Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
44
+
45
+ ## Fair Use
46
+
47
+ You may have "fair use" rights for the software under the law. These terms do not limit them.
48
+
49
+ ## No Other Rights
50
+
51
+ These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
52
+
53
+ ## Patent Defense
54
+
55
+ If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
56
+
57
+ ## Violations
58
+
59
+ The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
60
+
61
+ ## No Liability
62
+
63
+ As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
64
+
65
+ ## Definitions
66
+
67
+ The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
68
+
69
+ **You** refers to the individual or entity agreeing to these terms.
70
+
71
+ **Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
72
+
73
+ **Your licenses** are all the licenses granted to you for the software under these terms.
74
+
75
+ **Use** means anything you do with the software requiring one of your licenses.
package/README.md CHANGED
@@ -1,3 +1,192 @@
1
- # Temporary Holding Version
1
+ # dsh-modpack-kit(DSH 也要整合包)
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
+ 把多个 DSH 插件打成一个 `.dshpack`,一次装好。换台机器、少个插件、版本对不上时,不用再一个个搜、一个个装。
4
+
5
+ - **两种包**:完整版自带插件本体(对方没装本插件,照包内 `README.txt` 手工也能装);轻量版只记名字与版本,安装时按记录取包,体积小。
6
+ - **逐插件模式**:每个插件单独选「基础配置」(上游原版 + 默认配置)或「本地改动」(你本机的代码、配置、数据快照)。
7
+ - **安全**:打包前**强制**检测敏感信息与风险代码,命中只留掩码、原文不落盘;安装前再校验 sha256 完整性、兼容性与许可证。它不替代杀毒软件,也不证明某个插件安全。
8
+ - **装完能收尾**:按条目回填包内配置(只动目标那条),可选「装好先不启用」——只装文件,不登记 bundle,重启也不加载。
9
+ - **跟插件市场同源**:分类是市场那 23 个分区,首屏只列你已装的,搜索与分页走市场目录;同名插件行末有「(切换市场版)」。
10
+ - **三处入口**:设置页、侧边栏、插件页内各一个独立开关,改完立即生效;至少留一处,最后一个不能再关。
11
+
12
+ > **建议先装插件市场(`dshmarket`)再用它,但不是必须。** 不装也能打包、装包、检测、回填配置;差别只在「发现类」能力(分类胶囊、搜索、市场版版本对比、切换市场版、轻量包按版本取包),详见下面「与插件市场:联动,以及没有它时差在哪」。
13
+
14
+ ## 安装
15
+
16
+ 在已装 DSH 的机器上:
17
+
18
+ ```bash
19
+ dsh plugin --profile desktop add dsh-modpack-kit
20
+ ```
21
+
22
+ 或本地开发目录(本项目就在 `D:\桌面\蛆\整合包`):
23
+
24
+ ```bash
25
+ dsh plugin --profile desktop add "file:D:/桌面/蛆/整合包"
26
+ ```
27
+
28
+ 装完重启 DSH,左侧栏出现「整合包」。
29
+
30
+ ## 与插件市场:联动,以及没有它时差在哪
31
+
32
+ **建议先装插件市场(`dshmarket`),但本插件不依赖它。** 装不装都能用,区别只落在「发现与取包」这一层。
33
+
34
+ **联动的地方**
35
+ - 目录同源:直接读插件市场自己的目录包 `dsh-plugin-catalog`(先走 CDN 的 `index.json`,取不到退回 npm tarball),23 个分区、条目数、排序规则都跟市场一致;市场没装也能用,只是少了它的界面。
36
+ - 安装同路:都走 `dsh plugin --profile <p> add`,两边装的插件互相可见,不需要各记一份状态。
37
+ - 已装插件会用目录补齐描述与分区,标出「市场版 vX」以及是否有更新;同名条目行末出现「(切换市场版)」。
38
+ - 三处入口里「插件页内」那一栏,跟市场的 Discover 栏并排,互不占位。
39
+
40
+ **有市场 / 没市场对照**
41
+
42
+ | 能力 | 装了插件市场 | 没装插件市场 |
43
+ | --- | --- | --- |
44
+ | 打包(完整版 / 轻量版)、强制安全检测 | ✅ | ✅ 完全一样,全在本地跑 |
45
+ | 装包、完整性校验、兼容检测、许可证检查 | ✅ | ✅ 一样 |
46
+ | 配置回填、装好先不启用 | ✅ | ✅ 一样 |
47
+ | 侧边栏 / 设置里 / 插件页内三处入口 | ✅ | ✅ 一样(这些槽位是 DSH 核心声明的,不是市场插件) |
48
+ | 分类胶囊、搜索、服务端分页 | ✅ | ✅ 只要建过一次目录索引就行(5~30 秒,看网络) |
49
+ | 已装插件补齐描述、分区、市场版版本 | ✅ | ✅ 建过索引后一样 |
50
+ | 「(切换市场版)」按上游原版打包 | ✅ | ✅ 建过索引后一样 |
51
+ | 轻量包安装时按版本取包 | ✅ | ✅ 只要有 npm registry 网络 |
52
+ | 市场 Discover 栏、市场自己的更新入口 | ✅ | ❌ 没有(用本插件或 `dsh plugin` 装同一个包即可) |
53
+
54
+ **没索引、也没网时会怎样**(这种情况页面会明说,不会静默装错)
55
+ - 首屏照旧只列本机已装插件,打包与安装不受影响。
56
+ - 分类胶囊只剩「全部」,已装行的分类退回内置兜底规则,与市场 23 类的 id 不完全对得上——按 theme / memory 之类筛会漏几条。点「建立目录索引」跑一次就恢复。
57
+ - 搜索、市场版版本对比、「(切换市场版)」按钮不出来。
58
+ - 轻量包装不了(它不带源码,必须联网按清单里的版本取包);完整版照装。
59
+
60
+ ## 分类、搜索与分页
61
+
62
+ - 分类就是插件市场的 23 个分区(全部 / AGI 架构探索 / UI 增强 / 用量与计费 / 主题与外观 / 模型与账号接入 / 身份与通信 / 会话与消息 / 记忆 / 工具与能力 / WSL 与 Windows 互操作 / 浏览器与网页 / 视觉与多模态 / 语音与音频 / 文档与渲染 / 技能包 / 工作流与自动化 / Git 与代码评审 / 通知与集成 / 开发与运行时 / 安全与权限 / 远程与移动端 / 插件市场与管理 / 娱乐),名字和条目数都从市场目录里读。
63
+ - **首屏只列本机已装的插件**,不联网、不卡顿。输入关键词或点分类才去目录里搜,结果是服务端分页,一页 20 条(设置里可改),底部「加载更多」再取下一页。
64
+ - 排序照抄市场的规则:**已装优先**,再按相关度(整字段命中 > 包含 > 其它词;包名权重最高,其次所有者、仓库,描述与分类最低),同分保持目录原序。本机独有、目录里没有的插件也能被搜到。
65
+ - 本机已装的插件如果目录里有同名条目,行末会有小字「(切换市场版)」:点一下改用上游原版代码 + 默认配置打包,装出来和你从插件市场装一样;再点一次「(切回本机版)」回到本机快照。同名不代表一定是同一个插件,所以它只是**选项**,默认仍打本机那份。
66
+
67
+ ## 显示位置(三处独立开关)
68
+
69
+ 设置页底部三个开关,各自独立,改了立刻生效,不用重启:
70
+
71
+ | 开关 | 显示在哪 |
72
+ |---|---|
73
+ | 在设置里显示 | 设置页内一栏「整合包」(含插件的插件设置 tab) |
74
+ | 在侧边栏显示 | 左侧栏「整合包」入口 |
75
+ | 在插件页内显示 | 插件的插件页里,跟插件市场同一位置,单开一栏「整合包」 |
76
+
77
+ 三个全关会被拒绝(`POST /settings` 返回 400)——否则就再没有入口能把它关回来了;只关侧边栏是允许的,那时从设置页进。
78
+
79
+ ## 逐插件:基础配置 / 本地改动
80
+
81
+ 打包时每个插件可以单独选:
82
+
83
+ - **基础配置**:上游原版代码 + 插件默认配置,不带你的改动(会按版本从 registry 重下并校验 sha512)。
84
+ - **本地改动**:你本机现在的代码、配置条目、数据快照一起打进去。
85
+
86
+ 顶部的「默认打包本机修改」只是勾选时的默认值,勾上后仍可逐个改;结果里会标明每个插件用了哪种。
87
+
88
+ ## 两种包
89
+
90
+ | 版本 | 内容 | 适用 |
91
+ | --- | --- | --- |
92
+ | 完整版 `full` | 清单 + 插件文件 + 配置 + 检测报告 | 对方没装本插件也能按 README 手工装;离线可用 |
93
+ | 轻量版 `lite` | 清单 + 配置 + 检测报告 | 体积小,安装时联网按版本取包 |
94
+
95
+ 两者都带 `integrity.json`(sha256)、`security/report.txt` 与不依赖本插件的手工安装说明。
96
+
97
+ ## 开发
98
+
99
+ ```bash
100
+ EXE="/d/大肥鱼/DeepSeek Harness.exe"
101
+ # 单测 / 宿主路由 / 联网烟测
102
+ ELECTRON_RUN_AS_NODE=1 "$EXE" test/run.mjs
103
+ ELECTRON_RUN_AS_NODE=1 "$EXE" test/host-smoke.mjs
104
+ ELECTRON_RUN_AS_NODE=1 "$EXE" test/live.mjs
105
+ # 改完源码:同步到 profile 副本(file: 依赖是硬链接拷贝,cp 会 EBUSY)并校验
106
+ ELECTRON_RUN_AS_NODE=1 "$EXE" dev/tools/sync.cjs
107
+ ELECTRON_RUN_AS_NODE=1 "$EXE" dev/tools/verify.cjs
108
+ ```
109
+
110
+ 本机没有独立的 node:用 `ELECTRON_RUN_AS_NODE=1` 借 DSH 自带的 Node 跑脚本。
111
+
112
+ `dev/tools/sandbox-e2e.mjs` 是端到端演练:从本机挑一个真插件打成包 → 读回校验 → 装进临时 profile `modpack-sandbox-tmp`(先不启用)→ 断言依赖写入、`bundles` 仍为空、desktop profile 一字未动 → 最后删掉临时 profile 与临时目录。它不碰你的 desktop profile。
113
+
114
+ `dev/dsh-refs/` 是官方插件文档的本地参考副本,不参与发布(`files` 里没有 `dev`)。`dev/tools/check-categories.mjs` 只读核对分类分布与「哪些已装插件在市场里有同名条目」。
115
+
116
+ ## 安全检测
117
+
118
+ - **打包前是强制的,关不掉**:设置与包选项里的开关照常显示,但点它只会弹一行红字「你想干什么」,五秒后自己消失;就算直接调 API 写 `scanBeforePack: false`,服务端也会拉回 `true`,`buildPack` 里根本没有不扫的分支。
119
+ - 安装前各一次,静态读文本,不执行任何代码(安装前扫描仍可在设置里关,但默认开)。
120
+ - 规则覆盖:私钥、云厂商/代码托管 token、模型 key、Cookie 与会话字段、邮箱/手机号/身份证、内网 IP、本机路径;`curl|sh`、`powershell -enc`、`eval`、可疑长 base64、关闭证书校验、安装脚本等。
121
+ - 命中原文不落盘:报告只留规则名、文件、行号与掩码;同一文件同一行同一规则只记一条(一个文件里反复出现的 `exec(` 不会刷成几十行)。
122
+ - 高风险默认拒绝(只有显式 `force` 才继续,且写进清单 `security.approvedRisk`);完整版与轻量版一视同仁。
123
+ - 轻量包在「下载完、真正安装前」还会对本机刚解出来的代码补扫一遍,高危同样阻断(不是只信清单里那份报告)。
124
+ - 包内 `integrity.json` 缺失或清单对不上,一律阻断(要显式 `force`)。
125
+ - 解压有体积、压缩比与条目数上限,解压时还按声明长度卡输出(防 zip bomb),拒绝路径逃逸、符号链接、加密条目。
126
+ - 只允许 https 与白名单域名下载,逐跳校验重定向。
127
+
128
+ ## 安装与「先不启用」
129
+
130
+ - 安装走官方 `dsh plugin add`(和插件市场同一条链路):优先直接起宿主 exe + 内置 `cli.js`,参数不经 `cmd`,所以中文用户名、带空格路径都不会被引号吃掉;找不到才退回 `.cmd`。
131
+ - 勾「装好先不启用」时,插件文件与依赖照装,但装完会把 `dsh.profile.bundles` 精确撤回原样 —— 重启也不会加载,想启用再手动加回来。
132
+ - 解包前会先清掉 `vendor/<包>/` 里的旧目录,避免上一版残留文件混进新版本。
133
+
134
+ **它不是杀毒软件**:静态检测会漏也会误报,装第三方插件前仍应自己看来源。
135
+
136
+ ## 配置同步
137
+
138
+ 包内 `configs/<name>.json` 保存打包时 profile 补丁层里的条目。安装时按条目 `upsert` 回 `cordis.patch.yml`:只动目标插件那一条,其它字节保留;已有本地配置且开启「保留本地修改」时跳过。
139
+
140
+ ## 目录
141
+
142
+ ```
143
+ index.js Host 侧:/dsh-modpack-kit/api/*
144
+ client.js 侧栏页面
145
+ lib/zip.mjs 自实现 zip 读写(校验、上限、防逃逸)
146
+ lib/tar.mjs npm tarball 读取
147
+ lib/scan.mjs 敏感信息与风险代码规则
148
+ lib/semver.mjs 版本比较与范围匹配
149
+ lib/yamlish.mjs cordis.patch.yml 子集解析与保留原样的 upsert
150
+ lib/profile.mjs profile 读取、bundle 登记、dsh CLI 调用
151
+ lib/registry.mjs https 受限抓取、npm 元数据、取包
152
+ lib/manifest.mjs 清单规范与 README 生成
153
+ lib/classify.mjs 没被市场目录覆盖时的兜底分类(纯字符串,无网络)
154
+ lib/market-catalog.mjs 市场目录同步、索引、分类映射、搜索与分页
155
+ lib/compat.mjs 兼容性检查
156
+ lib/pack.mjs 收集、扫描、出包
157
+ lib/install.mjs 解包、校验、安装、配置回填
158
+ docs/DETAIL.md 插件详情页
159
+ test/ 自测脚本(node --test 风格,无依赖)
160
+ ```
161
+
162
+ ## 二次开发
163
+
164
+ - `lib/` 下每个模块都可单独 import:`zip`/`tar` 是通用读写器,`scan` 可接 `extraRules`,`yamlish` 只服务 `cordis.patch.yml`。
165
+ - 清单里的 `extensions` 字段打包时原样写入、安装时原样保留,可放自定义数据。
166
+ - 设置项 `extraScanRules` 会把额外规则并进扫描器。
167
+ - 页面只消费 `/dsh-modpack-kit/api/*`,换 UI 不必改后端。
168
+
169
+ ## 合规与边界
170
+
171
+ - 只打包你有权再分发的插件;许可证缺失或不在允许列表时需显式确认,最终责任在打包的人。
172
+ - 不要把含他人凭证的包传到公开位置;检测会拦明显的,但静态检测不是杀毒软件。
173
+ - 不提供绕过任何平台限制或法律限制的能力;下载走 https 白名单,逐跳校验重定向。
174
+ - 遵守所在地区法律法规与各平台条款。
175
+
176
+ 状态目录:`<DSH_HOME>/dsh-modpack/`(`settings.json`、`history.json`、`modpack.log`、`packs/`、`vendor/`)。
177
+
178
+ ## 许可
179
+
180
+ **PolyForm Noncommercial License 1.0.0(仅限非商业用途)** —— 全文见 [LICENSE](LICENSE)。
181
+
182
+ - 可以:个人学习、研究、实验、私人娱乐、业余项目、非商业组织内部使用;可以改、可以分发(需带上许可证与上面的 Required Notice)。
183
+ - 不可以:任何商业用途(含把本插件或其修改版用于收费产品、付费服务、商业部署),也不能转授权。
184
+ - 商业授权请联系仓库作者。
185
+
186
+ ## 声明
187
+
188
+ - 本插件与 DeepSeek、DeepSeek Harness 官方无隶属关系,也不是官方作品;"DeepSeek Harness" 等名称归其权利人所有。
189
+ - 它只做本地打包、检测与调用官方 `dsh plugin` 安装命令,不上传你的代码、配置或凭证到任何服务器。
190
+ - 打包与安装时的检测是**静态启发式**,会漏也会误报,**不构成安全担保,也不替代杀毒软件**。
191
+ - 打包他人插件时请遵守**对方**的许可证;不要把含他人凭证或私有数据的整合包公开分发。
192
+ - 使用者应遵守所在地区法律法规与相关平台条款;作者不对因使用本插件产生的后果承担责任(见许可证 No Liability 条)。