mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 12:50:23 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11daeabb7c | ||
|
|
148d6218d8 | ||
|
|
94a7cf814e |
No files matched your search
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<h1 align="center">⚔️ DeepSeek Harness cybersecurity red-team tool (dsh-purge)</h1>
|
<h1 align="center">⚔️ DeepSeek Harness cybersecurity red-team tool (dsh-purge)</h1>
|
||||||
|
|
||||||
<p align="center"><strong>Version 1.1.48</strong></p>
|
<p align="center"><strong>Version 1.1.51</strong></p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<em>Local official DeepSeek Harness cybersecurity red-team plugin. Clean host policy, and ship a built-in drill console. Swap prompts per model. Default prompt for Chinese models — 小码酱. Please star ⭐</em>
|
<em>Local official DeepSeek Harness cybersecurity red-team plugin. Clean host policy, and ship a built-in drill console. Swap prompts per model. Default prompt for Chinese models — 小码酱. Please star ⭐</em>
|
||||||
@@ -118,7 +118,7 @@ This release supports **DeepSeek Harness 0.2** only (official desktop **0.2.0-rc
|
|||||||
| Official Harness 0.1.x | Not supported |
|
| Official Harness 0.1.x | Not supported |
|
||||||
| Any other version | Unmatched patches stay pending or skipped; do not expect them to work |
|
| Any other version | Unmatched patches stay pending or skipped; do not expect them to work |
|
||||||
|
|
||||||
The plugin version is **1.1.48**. 1.1.45 is skipped; it has bugs.
|
The plugin version is **1.1.51**. 1.1.45 is skipped; it has bugs.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -144,6 +144,8 @@ Adding the plugin to a profile does **not** patch `@deepseek-ai` by itself.
|
|||||||
|
|
||||||
Web **Apply / Restart / Uninstall** affect Web only. Desktop controls affect the desktop app only and do not launch `dsh web`. Do not Apply one host from the other.
|
Web **Apply / Restart / Uninstall** affect Web only. Desktop controls affect the desktop app only and do not launch `dsh web`. Do not Apply one host from the other.
|
||||||
|
|
||||||
|
> **macOS official desktop:** Apply unpacks `app.asar`. This plugin patches the official `dsh` CLI entry (asar / `app/` fallback) and adds an `app/runtime` link. If you still see `MODULE_NOT_FOUND ... app.asar/.../cli.js`, Apply once more or reinstall Harness.
|
||||||
|
|
||||||
<a id="web"></a>
|
<a id="web"></a>
|
||||||
|
|
||||||
### Web
|
### Web
|
||||||
@@ -218,13 +220,13 @@ dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archiv
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://deepseek.stream/plugins/dsh-purge"><strong>🌐 Open Hub page</strong></a>
|
<a href="https://deepseek.stream/plugins/dsh-purge"><strong>🌐 Open Hub page</strong></a>
|
||||||
·
|
·
|
||||||
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.48&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz"><strong>🚀 Install in desktop client</strong></a>
|
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.51&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz"><strong>🚀 Install in desktop client</strong></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
🔗 **Raw protocol URL:**
|
🔗 **Raw protocol URL:**
|
||||||
|
|
||||||
```
|
```
|
||||||
dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.48&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz
|
dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.51&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz
|
||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
@@ -240,7 +242,7 @@ export function installDshPurgeToDesktop() {
|
|||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
id: 'dsh-purge',
|
id: 'dsh-purge',
|
||||||
name: 'dsh-purge',
|
name: 'dsh-purge',
|
||||||
version: '1.1.48',
|
version: '1.1.51',
|
||||||
repo: 'YuJunZhiXue/dsh-purge',
|
repo: 'YuJunZhiXue/dsh-purge',
|
||||||
permissions: '系统提示词注入, 本机补丁, 设置页',
|
permissions: '系统提示词注入, 本机补丁, 设置页',
|
||||||
downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz',
|
downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz',
|
||||||
@@ -259,7 +261,7 @@ export function installDshPurgeToDesktop() {
|
|||||||
**HTML link:**
|
**HTML link:**
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.48&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz">
|
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.51&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz">
|
||||||
🚀 Install in desktop client
|
🚀 Install in desktop client
|
||||||
</a>
|
</a>
|
||||||
```
|
```
|
||||||
@@ -270,7 +272,7 @@ export function installDshPurgeToDesktop() {
|
|||||||
|---|---|---|
|
|---|---|---|
|
||||||
| id | `dsh-purge` | Plugin id |
|
| id | `dsh-purge` | Plugin id |
|
||||||
| name | `dsh-purge` | Display name |
|
| name | `dsh-purge` | Display name |
|
||||||
| version | `1.1.48` | Semver |
|
| version | `1.1.51` | Semver |
|
||||||
| repo | `YuJunZhiXue/dsh-purge` | GitHub repo |
|
| repo | `YuJunZhiXue/dsh-purge` | GitHub repo |
|
||||||
| permissions | `系统提示词注入, 本机补丁, 设置页` | Requested permissions |
|
| permissions | `系统提示词注入, 本机补丁, 设置页` | Requested permissions |
|
||||||
| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub source archive |
|
| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub source archive |
|
||||||
|
|||||||
+9
-7
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<h1 align="center">⚔️ DeepSeek Harness 网络安全红队工具(dsh-purge)</h1>
|
<h1 align="center">⚔️ DeepSeek Harness 网络安全红队工具(dsh-purge)</h1>
|
||||||
|
|
||||||
<p align="center"><strong>Version 1.1.48</strong></p>
|
<p align="center"><strong>Version 1.1.51</strong></p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<em>本机官方 DeepSeek Harness 网络安全红队评测插件。清洗宿主策略,并带内嵌演练台。不同模型可换不同提示词。默认提示词面向国模「小码酱」。求 Star 收藏 ⭐</em>
|
<em>本机官方 DeepSeek Harness 网络安全红队评测插件。清洗宿主策略,并带内嵌演练台。不同模型可换不同提示词。默认提示词面向国模「小码酱」。求 Star 收藏 ⭐</em>
|
||||||
@@ -118,7 +118,7 @@ Harness 不只是把问题交给模型。它还会在运行时改提示词、审
|
|||||||
| 官方 Harness 0.1.x | 不支持 |
|
| 官方 Harness 0.1.x | 不支持 |
|
||||||
| 其它未列出版本 | 对不上的补丁会显示待应用或跳过,不要指望能用 |
|
| 其它未列出版本 | 对不上的补丁会显示待应用或跳过,不要指望能用 |
|
||||||
|
|
||||||
插件版本是 **1.1.48**。1.1.45 有问题,略过。
|
插件版本是 **1.1.51**。1.1.45 有问题,略过。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -142,6 +142,8 @@ Web、社区桌面端、官方桌面 EXE **分开装、分开应用**。只装
|
|||||||
2. 点会话标题旁的 **dsh-purge**,在右侧栏的 **清洗** 里点 **「应用」**。宿主的设置页里没有这个条目。
|
2. 点会话标题旁的 **dsh-purge**,在右侧栏的 **清洗** 里点 **「应用」**。宿主的设置页里没有这个条目。
|
||||||
3. 按提示 **再重启一次**。补丁这时才进入当前进程。点「重启」才会重启,不会装完自动重启。
|
3. 按提示 **再重启一次**。补丁这时才进入当前进程。点「重启」才会重启,不会装完自动重启。
|
||||||
|
|
||||||
|
> **macOS 官方桌面**:点「应用」会解开 `app.asar`。本插件会自动修补官方 `dsh` CLI 入口(asar / `app/` 双向兼容)并补上 `app/runtime` 链接;若你仍看到 `MODULE_NOT_FOUND ... app.asar/.../cli.js`,再点一次「应用」,或重装 Harness。
|
||||||
|
|
||||||
Web 的「应用 / 重启 / 卸载」只动 Web。桌面端的只动桌面应用,不会去拉 `dsh web`。不要在 Web 里点桌面端的应用,也不要反过来。
|
Web 的「应用 / 重启 / 卸载」只动 Web。桌面端的只动桌面应用,不会去拉 `dsh web`。不要在 Web 里点桌面端的应用,也不要反过来。
|
||||||
|
|
||||||
<a id="web"></a>
|
<a id="web"></a>
|
||||||
@@ -218,13 +220,13 @@ dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archiv
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://deepseek.stream/plugins/dsh-purge"><strong>🌐 打开插件市场页</strong></a>
|
<a href="https://deepseek.stream/plugins/dsh-purge"><strong>🌐 打开插件市场页</strong></a>
|
||||||
·
|
·
|
||||||
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.48&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz"><strong>🚀 唤起客户端一键安装</strong></a>
|
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.51&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz"><strong>🚀 唤起客户端一键安装</strong></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
🔗 **原生协议链接:**
|
🔗 **原生协议链接:**
|
||||||
|
|
||||||
```
|
```
|
||||||
dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.48&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz
|
dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.51&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz
|
||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
@@ -240,7 +242,7 @@ export function installDshPurgeToDesktop() {
|
|||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
id: 'dsh-purge',
|
id: 'dsh-purge',
|
||||||
name: 'dsh-purge',
|
name: 'dsh-purge',
|
||||||
version: '1.1.48',
|
version: '1.1.51',
|
||||||
repo: 'YuJunZhiXue/dsh-purge',
|
repo: 'YuJunZhiXue/dsh-purge',
|
||||||
permissions: '系统提示词注入, 本机补丁, 设置页',
|
permissions: '系统提示词注入, 本机补丁, 设置页',
|
||||||
downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz',
|
downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz',
|
||||||
@@ -259,7 +261,7 @@ export function installDshPurgeToDesktop() {
|
|||||||
**HTML 静态链接方式:**
|
**HTML 静态链接方式:**
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.48&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz">
|
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.51&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.tar.gz">
|
||||||
🚀 唤起客户端一键安装
|
🚀 唤起客户端一键安装
|
||||||
</a>
|
</a>
|
||||||
```
|
```
|
||||||
@@ -270,7 +272,7 @@ export function installDshPurgeToDesktop() {
|
|||||||
|---|---|---|
|
|---|---|---|
|
||||||
| id | `dsh-purge` | 插件唯一标识符 |
|
| id | `dsh-purge` | 插件唯一标识符 |
|
||||||
| name | `dsh-purge` | 插件展示名称 |
|
| name | `dsh-purge` | 插件展示名称 |
|
||||||
| version | `1.1.48` | 语义化版本号 |
|
| version | `1.1.51` | 语义化版本号 |
|
||||||
| repo | `YuJunZhiXue/dsh-purge` | GitHub 仓库 |
|
| repo | `YuJunZhiXue/dsh-purge` | GitHub 仓库 |
|
||||||
| permissions | `系统提示词注入, 本机补丁, 设置页` | 申请权限 |
|
| permissions | `系统提示词注入, 本机补丁, 设置页` | 申请权限 |
|
||||||
| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub 源码包地址 |
|
| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub 源码包地址 |
|
||||||
|
|||||||
@@ -94,8 +94,9 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
|
|||||||
return Boolean(active && active.size > 0);
|
return Boolean(active && active.size > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function bothInjectEmpty(overrideText) {
|
async function bothInjectEmpty(overrideText, defaultText) {
|
||||||
if (!promptBoxEmpty(overrideText)) return false;
|
if (!promptBoxEmpty(overrideText)) return false;
|
||||||
|
if (!promptBoxEmpty(defaultText)) return false;
|
||||||
try {
|
try {
|
||||||
return !activeRuleHasBody(await rulesApi("status"));
|
return !activeRuleHasBody(await rulesApi("status"));
|
||||||
} catch {
|
} catch {
|
||||||
@@ -195,6 +196,7 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
|
|||||||
"metric.purged.skip": "已就绪,其中 {n} 项本机不需要",
|
"metric.purged.skip": "已就绪,其中 {n} 项本机不需要",
|
||||||
"metric.unlocated.count": "—",
|
"metric.unlocated.count": "—",
|
||||||
"metric.shim": "shim",
|
"metric.shim": "shim",
|
||||||
|
"metric.shim.na": "本端不需要",
|
||||||
"metric.bak.yes": "有备份",
|
"metric.bak.yes": "有备份",
|
||||||
"metric.bak.no": "无备份",
|
"metric.bak.no": "无备份",
|
||||||
"metric.bak.hint": "备份",
|
"metric.bak.hint": "备份",
|
||||||
@@ -487,6 +489,7 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
|
|||||||
"metric.purged.skip": "Ready, {n} not needed here",
|
"metric.purged.skip": "Ready, {n} not needed here",
|
||||||
"metric.unlocated.count": "—",
|
"metric.unlocated.count": "—",
|
||||||
"metric.shim": "shim",
|
"metric.shim": "shim",
|
||||||
|
"metric.shim.na": "Not needed here",
|
||||||
"metric.bak.yes": "Backup",
|
"metric.bak.yes": "Backup",
|
||||||
"metric.bak.no": "No backup",
|
"metric.bak.no": "No backup",
|
||||||
"metric.bak.hint": "Backup",
|
"metric.bak.hint": "Backup",
|
||||||
@@ -1016,9 +1019,9 @@ body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-card,body .dshp-dock[dat
|
|||||||
}
|
}
|
||||||
|
|
||||||
function shimKind(v) {
|
function shimKind(v) {
|
||||||
if (v === "patched") return "ok";
|
if (v === "patched" || v === "n/a") return "ok";
|
||||||
if (v === "original") return "wait";
|
if (v === "original") return "wait";
|
||||||
if (v === "missing" || v === "n/a" || !v) return "miss";
|
if (v === "missing" || !v) return "miss";
|
||||||
return "bad";
|
return "bad";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1498,7 +1501,7 @@ body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-card,body .dshp-dock[dat
|
|||||||
run();
|
run();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bothInjectEmpty(overrideRef.current).then((empty) => {
|
bothInjectEmpty(overrideRef.current, defaultOverrideRef.current).then((empty) => {
|
||||||
if (ticket !== actionTicket.current) return;
|
if (ticket !== actionTicket.current) return;
|
||||||
if (empty) {
|
if (empty) {
|
||||||
rejectNeedPrompt(tr);
|
rejectNeedPrompt(tr);
|
||||||
@@ -1538,7 +1541,7 @@ body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-card,body .dshp-dock[dat
|
|||||||
if (ticket === actionTicket.current) setPatchBusy(false);
|
if (ticket === actionTicket.current) setPatchBusy(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
bothInjectEmpty(overrideRef.current).then((empty) => {
|
bothInjectEmpty(overrideRef.current, defaultOverrideRef.current).then((empty) => {
|
||||||
if (ticket !== actionTicket.current) return;
|
if (ticket !== actionTicket.current) return;
|
||||||
if (empty) {
|
if (empty) {
|
||||||
rejectNeedPrompt(tr);
|
rejectNeedPrompt(tr);
|
||||||
@@ -1714,7 +1717,7 @@ body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-card,body .dshp-dock[dat
|
|||||||
" ",
|
" ",
|
||||||
h("span", { className: "dshp-pill is-" + shimKind(s.shim_bin || "missing") }, "unix"),
|
h("span", { className: "dshp-pill is-" + shimKind(s.shim_bin || "missing") }, "unix"),
|
||||||
),
|
),
|
||||||
h("span", null, t("metric.shim")),
|
h("span", null, (s.shim_cmd === "n/a" && s.shim_ps1 === "n/a" && (s.shim_bin === "n/a" || !s.shim_bin)) ? t("metric.shim.na") : t("metric.shim")),
|
||||||
),
|
),
|
||||||
h("div", { className: "dshp-metric" },
|
h("div", { className: "dshp-metric" },
|
||||||
h("b", null, s.has_backup ? t("metric.bak.yes") : t("metric.bak.no")),
|
h("b", null, s.has_backup ? t("metric.bak.yes") : t("metric.bak.no")),
|
||||||
@@ -2462,7 +2465,7 @@ body .dshp-dock[data-theme="white"] .dshp-dock-body .rt-card,body .dshp-dock[dat
|
|||||||
if (!d.ok) throw new Error(d.error || "restart failed");
|
if (!d.ok) throw new Error(d.error || "restart failed");
|
||||||
const next = (d && d.surface) || surf;
|
const next = (d && d.surface) || surf;
|
||||||
if ((next === "desktop" || d.fullApp) && d.restarting === false) {
|
if ((next === "desktop" || d.fullApp) && d.restarting === false) {
|
||||||
setNotice({ kind: "error", text: t("restart.fail", { error: d.note || "not started" }) });
|
setNotice({ kind: "error", text: t("restart.fail", { error: d.error || "not started" }) });
|
||||||
setBusy(false);
|
setBusy(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+95
-15
@@ -1744,10 +1744,23 @@ export async function openSealedDesktopHost(options = {}) {
|
|||||||
restoreUnusableExtract(appDir, prev);
|
restoreUnusableExtract(appDir, prev);
|
||||||
throw new Error(`已解开 ${handoff.asar},但 ${appDir} 下没有 @deepseek-ai`);
|
throw new Error(`已解开 ${handoff.asar},但 ${appDir} 下没有 @deepseek-ai`);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
desktop.repairOfficialCliAfterUnpack(handoff.exe);
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("[dsh-purge] repair official CLI after unpack failed:", e);
|
||||||
|
}
|
||||||
resetPathMemo();
|
resetPathMemo();
|
||||||
return { aiBase, swapAsar: true, exe: handoff.exe, asar: handoff.asar, extracted, prev, appDir, archive: extracted ? archive : null };
|
return { aiBase, swapAsar: true, exe: handoff.exe, asar: handoff.asar, extracted, prev, appDir, archive: extracted ? archive : null };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function repairOfficialCliAfterUnpack(exe) {
|
||||||
|
try {
|
||||||
|
return desktop.repairOfficialCliAfterUnpack(exe);
|
||||||
|
} catch (e) {
|
||||||
|
return { ok: false, error: String(e && e.message ? e.message : e) };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function restoreSealedExtract(appDir, prev) {
|
export function restoreSealedExtract(appDir, prev) {
|
||||||
const saved = prev || newestPreservedDir(appDir);
|
const saved = prev || newestPreservedDir(appDir);
|
||||||
return restoreExtractedDir(appDir, saved);
|
return restoreExtractedDir(appDir, saved);
|
||||||
@@ -3484,6 +3497,8 @@ const NEW_TOOL_PATCHES = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
markers: ["Proceed with operator-requested paths."],
|
markers: ["Proceed with operator-requested paths."],
|
||||||
|
// 上游已删谨慎句时无残留 pattern,按软完成计(#48)。
|
||||||
|
softSettle: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 49,
|
id: 49,
|
||||||
@@ -3581,6 +3596,11 @@ const NEW_TOOL_PATCHES = [
|
|||||||
pattern: "enabled: z.boolean().default(true).volatile(),",
|
pattern: "enabled: z.boolean().default(true).volatile(),",
|
||||||
replace: "enabled: z.boolean().default(false).volatile(), // [dsh-purge] session log upload off",
|
replace: "enabled: z.boolean().default(false).volatile(), // [dsh-purge] session log upload off",
|
||||||
},
|
},
|
||||||
|
// 0.1.7-rc.2 / 0.2 起去掉 .volatile();限定在本补丁两个文件内各只命中一次。
|
||||||
|
{
|
||||||
|
pattern: "enabled: z.boolean().default(true),",
|
||||||
|
replace: "enabled: z.boolean().default(false), // [dsh-purge] session log upload off",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
markers: ["[dsh-purge] session log upload off"],
|
markers: ["[dsh-purge] session log upload off"],
|
||||||
},
|
},
|
||||||
@@ -4037,7 +4057,7 @@ const NEW_TOOL_PATCHES = [
|
|||||||
layer: "代码",
|
layer: "代码",
|
||||||
layer_en: "Code",
|
layer_en: "Code",
|
||||||
desc: "deepseek.com 的系统提示词固定走 system,思维链不动 / keep deepseek.com instructions on system",
|
desc: "deepseek.com 的系统提示词固定走 system,思维链不动 / keep deepseek.com instructions on system",
|
||||||
file: ["pi-ai-completions"],
|
file: ["pi-ai-completions", "pi-ai-responses-shared"],
|
||||||
optional: true,
|
optional: true,
|
||||||
skipIfMarked: true,
|
skipIfMarked: true,
|
||||||
replacements: [
|
replacements: [
|
||||||
@@ -4045,6 +4065,16 @@ const NEW_TOOL_PATCHES = [
|
|||||||
pattern: 'const instructionRole = model.reasoning && compat.supportsDeveloperRole ? "developer" : "system";',
|
pattern: 'const instructionRole = model.reasoning && compat.supportsDeveloperRole ? "developer" : "system";',
|
||||||
replace: 'const instructionRole = model.reasoning && compat.supportsDeveloperRole && !String(model.baseUrl || "").toLowerCase().includes("deepseek.com") ? "developer" : "system"; // [dsh-purge] deepseek.com keeps system role',
|
replace: 'const instructionRole = model.reasoning && compat.supportsDeveloperRole && !String(model.baseUrl || "").toLowerCase().includes("deepseek.com") ? "developer" : "system"; // [dsh-purge] deepseek.com keeps system role',
|
||||||
},
|
},
|
||||||
|
// 0.1.7+ / 0.2:改写为 useDeveloperRole。
|
||||||
|
{
|
||||||
|
pattern: "const useDeveloperRole = model.reasoning && compat.supportsDeveloperRole;",
|
||||||
|
replace: 'const useDeveloperRole = model.reasoning && compat.supportsDeveloperRole && !String(model.baseUrl || "").toLowerCase().includes("deepseek.com"); // [dsh-purge] deepseek.com keeps system role',
|
||||||
|
},
|
||||||
|
// responses 通路(悬空键 pi-ai-responses-shared 接上)。
|
||||||
|
{
|
||||||
|
pattern: 'const role = model.reasoning && compat?.supportsDeveloperRole !== false ? "developer" : "system";',
|
||||||
|
replace: 'const role = model.reasoning && compat?.supportsDeveloperRole !== false && !String(model.baseUrl || "").toLowerCase().includes("deepseek.com") ? "developer" : "system"; // [dsh-purge] deepseek.com keeps system role',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
markers: ["[dsh-purge] deepseek.com keeps system role"],
|
markers: ["[dsh-purge] deepseek.com keeps system role"],
|
||||||
},
|
},
|
||||||
@@ -4977,7 +5007,7 @@ function isApprovalSentencePatch(patch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isLayoutSoftPatch(patch) {
|
function isLayoutSoftPatch(patch) {
|
||||||
return isIdentityLayoutPatch(patch) || isApprovalSentencePatch(patch);
|
return isIdentityLayoutPatch(patch) || isApprovalSentencePatch(patch) || Boolean(patch?.softSettle);
|
||||||
}
|
}
|
||||||
|
|
||||||
function filePatchSettled(text, patch, fp = "") {
|
function filePatchSettled(text, patch, fp = "") {
|
||||||
@@ -5749,7 +5779,10 @@ export async function readOverrideForUi(dshHome) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const customized = await isUserCustomizedOverride(dshHome);
|
const customized = await isUserCustomizedOverride(dshHome);
|
||||||
const show = normalizeOverride(disk) ? disk : defaultContent;
|
// 未改过:界面始终显示内置默认(1.1.30 前行为)。已改过:显示磁盘正文,空则回退默认。
|
||||||
|
const show = customized
|
||||||
|
? (normalizeOverride(disk) ? disk : defaultContent)
|
||||||
|
: defaultContent;
|
||||||
return {
|
return {
|
||||||
path: fp,
|
path: fp,
|
||||||
exists,
|
exists,
|
||||||
@@ -5775,42 +5808,84 @@ export function seedOverrideSync(dshHome) {
|
|||||||
const bundled = defaultOverrideText();
|
const bundled = defaultOverrideText();
|
||||||
if (!normalizeOverride(bundled)) return fs.existsSync(fp) ? "empty" : "missing";
|
if (!normalizeOverride(bundled)) return fs.existsSync(fp) ? "empty" : "missing";
|
||||||
fs.writeFileSync(fp, bundled, "utf8");
|
fs.writeFileSync(fp, bundled, "utf8");
|
||||||
|
try {
|
||||||
|
const state = readOverrideStateSync(dshHome);
|
||||||
|
if (state.customized !== true) {
|
||||||
|
fs.mkdirSync(path.dirname(overrideStatePath(dshHome)), { recursive: true });
|
||||||
|
fs.writeFileSync(
|
||||||
|
overrideStatePath(dshHome),
|
||||||
|
`${JSON.stringify({
|
||||||
|
customized: false,
|
||||||
|
hash: hashOverride(bundled),
|
||||||
|
seedHash: defaultOverrideHash(),
|
||||||
|
updatedAt: new Date().toISOString(),
|
||||||
|
}, null, 2)}\n`,
|
||||||
|
"utf8",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// 状态写失败不挡注入文件
|
||||||
|
}
|
||||||
return "wrote";
|
return "wrote";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未自行改过时始终把内置默认写回磁盘(与 1.1.30 前一致)。
|
||||||
|
* 只点「应用」不点「保存」也要有可注入正文;空文件或仍是旧默认种子时都补齐。
|
||||||
|
*/
|
||||||
export async function installOverride(dshHome, force = false) {
|
export async function installOverride(dshHome, force = false) {
|
||||||
const fp = findOverrideFile(dshHome);
|
const fp = findOverrideFile(dshHome);
|
||||||
await fsp.mkdir(dshHome, { recursive: true });
|
await fsp.mkdir(dshHome, { recursive: true });
|
||||||
if (!force && await isUserCustomizedOverride(dshHome)) return "exists";
|
if (!force && await isUserCustomizedOverride(dshHome)) return "exists";
|
||||||
|
const bundled = defaultOverrideText();
|
||||||
|
if (!normalizeOverride(bundled)) return fs.existsSync(fp) ? "empty" : "missing";
|
||||||
|
let disk = "";
|
||||||
if (!force && fs.existsSync(fp)) {
|
if (!force && fs.existsSync(fp)) {
|
||||||
let disk = "";
|
|
||||||
try {
|
try {
|
||||||
disk = await loadText(fp);
|
disk = await loadText(fp);
|
||||||
} catch {
|
} catch {
|
||||||
disk = "";
|
disk = "";
|
||||||
}
|
}
|
||||||
const bundled = defaultOverrideText();
|
|
||||||
if (normalizeOverride(disk) && normalizeOverride(disk) !== normalizeOverride(bundled)) {
|
|
||||||
await markOverrideCustomized(dshHome, true, disk);
|
|
||||||
return "exists";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const bundled = defaultOverrideText();
|
// 磁盘已是同一份默认则只刷新标记,避免无意义重写。
|
||||||
if (!normalizeOverride(bundled)) return fs.existsSync(fp) ? "empty" : "missing";
|
if (!force && normalizeOverride(disk) && normalizeOverride(disk) === normalizeOverride(bundled)) {
|
||||||
|
await markOverrideCustomized(dshHome, false, bundled);
|
||||||
|
return "exists";
|
||||||
|
}
|
||||||
await fsp.writeFile(fp, bundled, "utf8");
|
await fsp.writeFile(fp, bundled, "utf8");
|
||||||
await markOverrideCustomized(dshHome, false, bundled);
|
await markOverrideCustomized(dshHome, false, bundled);
|
||||||
return "wrote";
|
return "wrote";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 应用/启动时解析最终要落盘并注入的正文:框里有就用框,否则内置默认。 */
|
||||||
|
export function resolveApplyOverrideText(dshHome, incoming) {
|
||||||
|
const bundled = defaultOverrideText();
|
||||||
|
if (normalizeOverride(incoming)) return String(incoming);
|
||||||
|
const disk = overrideFileTextSafe(dshHome);
|
||||||
|
if (normalizeOverride(disk)) return disk;
|
||||||
|
return bundled;
|
||||||
|
}
|
||||||
|
|
||||||
|
function overrideFileTextSafe(dshHome) {
|
||||||
|
const fp = findOverrideFile(dshHome);
|
||||||
|
try {
|
||||||
|
if (!fp || !fs.existsSync(fp)) return "";
|
||||||
|
return fs.readFileSync(fp, "utf8");
|
||||||
|
} catch {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export async function saveOverrideContent(dshHome, content) {
|
export async function saveOverrideContent(dshHome, content) {
|
||||||
const bundled = defaultOverrideText();
|
const bundled = defaultOverrideText();
|
||||||
const incoming = typeof content === "string" ? content : "";
|
const incoming = typeof content === "string" ? content : "";
|
||||||
const customized = normalizeOverride(incoming) !== normalizeOverride(bundled);
|
const resolved = normalizeOverride(incoming) ? incoming : bundled;
|
||||||
|
const customized = normalizeOverride(resolved) !== normalizeOverride(bundled);
|
||||||
const fp = findOverrideFile(dshHome);
|
const fp = findOverrideFile(dshHome);
|
||||||
await fsp.mkdir(dshHome, { recursive: true });
|
await fsp.mkdir(dshHome, { recursive: true });
|
||||||
await fsp.writeFile(fp, incoming, "utf8");
|
await fsp.writeFile(fp, resolved, "utf8");
|
||||||
await markOverrideCustomized(dshHome, customized, incoming);
|
await markOverrideCustomized(dshHome, customized, resolved);
|
||||||
return { path: fp, customized, content: incoming, defaultContent: bundled };
|
return { path: fp, customized, content: resolved, defaultContent: bundled };
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function ensureOverrideContent(dshHome, force = false) {
|
export async function ensureOverrideContent(dshHome, force = false) {
|
||||||
@@ -5880,6 +5955,11 @@ export async function gatherState() {
|
|||||||
shim_cmd = shimFileStatus(path.join(shimDir, "dsh.cmd"));
|
shim_cmd = shimFileStatus(path.join(shimDir, "dsh.cmd"));
|
||||||
shim_ps1 = shimFileStatus(path.join(shimDir, "dsh.ps1"));
|
shim_ps1 = shimFileStatus(path.join(shimDir, "dsh.ps1"));
|
||||||
shim_bin = shimFileStatus(path.join(shimDir, "dsh"));
|
shim_bin = shimFileStatus(path.join(shimDir, "dsh"));
|
||||||
|
} else if (adapterFor(detectSurface()) === "desktop") {
|
||||||
|
// 桌面宿主不 patch CLI shim;缺目录不是失败。
|
||||||
|
shim_cmd = "n/a";
|
||||||
|
shim_ps1 = "n/a";
|
||||||
|
shim_bin = "n/a";
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
surface: detectSurface(),
|
surface: detectSurface(),
|
||||||
|
|||||||
+142
-3
@@ -910,6 +910,7 @@ const ASAR_RENAME_WHEN_IDLE_SH = [
|
|||||||
"lock=$3",
|
"lock=$3",
|
||||||
"deadline=$(($(date +%s) + 1800))",
|
"deadline=$(($(date +%s) + 1800))",
|
||||||
"relaunch() {",
|
"relaunch() {",
|
||||||
|
" unset ELECTRON_RUN_AS_NODE",
|
||||||
" case \"$(uname -s)\" in",
|
" case \"$(uname -s)\" in",
|
||||||
" Darwin)",
|
" Darwin)",
|
||||||
" case \"$exe\" in",
|
" case \"$exe\" in",
|
||||||
@@ -921,7 +922,6 @@ const ASAR_RENAME_WHEN_IDLE_SH = [
|
|||||||
" esac",
|
" esac",
|
||||||
" ;;",
|
" ;;",
|
||||||
" esac",
|
" esac",
|
||||||
" unset ELECTRON_RUN_AS_NODE",
|
|
||||||
" nohup \"$exe\" >/dev/null 2>&1 &",
|
" nohup \"$exe\" >/dev/null 2>&1 &",
|
||||||
"}",
|
"}",
|
||||||
"while [ \"$(date +%s)\" -lt \"$deadline\" ]; do",
|
"while [ \"$(date +%s)\" -lt \"$deadline\" ]; do",
|
||||||
@@ -991,6 +991,12 @@ export function scheduleAsarRenameWhenIdle({ exe, asar } = {}) {
|
|||||||
/** 等当前桌面进程退出后把 app.asar 挪走,再启动 exe。解开后的 resources\\app 才会被加载。 */
|
/** 等当前桌面进程退出后把 app.asar 挪走,再启动 exe。解开后的 resources\\app 才会被加载。 */
|
||||||
export function scheduleAsarSwapRestart({ exe, asar, waitPid = process.pid, exit = false } = {}) {
|
export function scheduleAsarSwapRestart({ exe, asar, waitPid = process.pid, exit = false } = {}) {
|
||||||
if (!exe || !asar) throw new Error("缺少桌面 exe 或 app.asar,无法重启");
|
if (!exe || !asar) throw new Error("缺少桌面 exe 或 app.asar,无法重启");
|
||||||
|
if (process.platform === "darwin") {
|
||||||
|
const helper = fileURLToPath(new URL("./restart-desktop.js", import.meta.url));
|
||||||
|
spawnHelper(helper, { respawn: true, killApp: true, asar, waitPid }, { exit: false });
|
||||||
|
if (exit !== false) setTimeout(() => process.exit(0), 800);
|
||||||
|
return { scheduled: true };
|
||||||
|
}
|
||||||
if (process.platform !== "win32") return scheduleAsarRenameWhenIdle({ exe, asar });
|
if (process.platform !== "win32") return scheduleAsarRenameWhenIdle({ exe, asar });
|
||||||
const script = path.join(os.tmpdir(), `dsh-purge-asar-swap-${process.pid}.ps1`);
|
const script = path.join(os.tmpdir(), `dsh-purge-asar-swap-${process.pid}.ps1`);
|
||||||
fs.writeFileSync(script, ASAR_SWAP_PS1, "utf8");
|
fs.writeFileSync(script, ASAR_SWAP_PS1, "utf8");
|
||||||
@@ -1058,10 +1064,11 @@ export function scheduleRestart(request, ctx) {
|
|||||||
Promise.resolve(runtime.requestRestart()).catch((err) => {
|
Promise.resolve(runtime.requestRestart()).catch((err) => {
|
||||||
console.warn("[dsh-purge] desktop requestRestart failed:", err);
|
console.warn("[dsh-purge] desktop requestRestart failed:", err);
|
||||||
});
|
});
|
||||||
return;
|
return { restarting: true };
|
||||||
}
|
}
|
||||||
const helper = fileURLToPath(new URL("./restart-desktop.js", import.meta.url));
|
const helper = fileURLToPath(new URL("./restart-desktop.js", import.meta.url));
|
||||||
spawnHelper(helper, { respawn: true, killApp: true }, { exit: false });
|
spawnHelper(helper, { respawn: true, killApp: true }, { exit: false });
|
||||||
|
return { restarting: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
function jsString(value) {
|
function jsString(value) {
|
||||||
@@ -1198,7 +1205,139 @@ export function scheduleCleanupRestart({ cleanup = [], ctx } = {}) {
|
|||||||
Promise.resolve(runtime.requestRestart()).catch((err) => {
|
Promise.resolve(runtime.requestRestart()).catch((err) => {
|
||||||
console.warn("[dsh-purge] desktop uninstall restart failed:", err);
|
console.warn("[dsh-purge] desktop uninstall restart failed:", err);
|
||||||
});
|
});
|
||||||
return;
|
return { restarting: true };
|
||||||
}
|
}
|
||||||
spawnHelper(dest, { cleanup, helper: dest, respawn: true, killApp: true }, { exit: false });
|
spawnHelper(dest, { cleanup, helper: dest, respawn: true, killApp: true }, { exit: false });
|
||||||
|
return { restarting: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
const CLI_ENTRY_BEGIN = "# dsh-purge cli entry begin";
|
||||||
|
const CLI_ENTRY_END = "# dsh-purge cli entry end";
|
||||||
|
const CLI_ASAR_ENTRY = "app.asar/dsh/node_modules/@deepseek-ai/dsh-desktop-host/lib/cli.js";
|
||||||
|
const CLI_DIR_ENTRY = "app/dsh/node_modules/@deepseek-ai/dsh-desktop-host/lib/cli.js";
|
||||||
|
|
||||||
|
function ensureAppRuntimeSymlink(resources) {
|
||||||
|
const appDir = path.join(resources, "app");
|
||||||
|
const runtime = path.join(resources, "runtime");
|
||||||
|
const link = path.join(appDir, "runtime");
|
||||||
|
if (!isDir(appDir) || !isDir(runtime)) return { ok: false, reason: "missing" };
|
||||||
|
try {
|
||||||
|
if (fs.existsSync(link)) {
|
||||||
|
const st = fs.lstatSync(link);
|
||||||
|
if (st.isSymbolicLink() || st.isDirectory()) return { ok: true, already: true };
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// create below
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
try {
|
||||||
|
fs.rmSync(link, { recursive: true, force: true });
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
if (process.platform === "win32") {
|
||||||
|
fs.symlinkSync("..\\runtime", link, "junction");
|
||||||
|
return { ok: true, created: true, type: "junction" };
|
||||||
|
}
|
||||||
|
fs.symlinkSync("../runtime", link, "dir");
|
||||||
|
return { ok: true, created: true, type: "dir" };
|
||||||
|
} catch (e) {
|
||||||
|
return { ok: false, error: String(e && e.message ? e.message : e) };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function patchOfficialCliShimText(text) {
|
||||||
|
if (!text || !text.includes(CLI_ASAR_ENTRY)) return { changed: false, text };
|
||||||
|
if (text.includes(CLI_ENTRY_BEGIN) && text.includes('"$entry"')) {
|
||||||
|
return { changed: false, text, already: true };
|
||||||
|
}
|
||||||
|
const block = [
|
||||||
|
CLI_ENTRY_BEGIN,
|
||||||
|
`entry="$resources/${CLI_ASAR_ENTRY}"`,
|
||||||
|
'if [ ! -f "$entry" ]; then',
|
||||||
|
` entry="$resources/${CLI_DIR_ENTRY}"`,
|
||||||
|
"fi",
|
||||||
|
CLI_ENTRY_END,
|
||||||
|
"",
|
||||||
|
].join("\n");
|
||||||
|
let next = text;
|
||||||
|
if (!next.includes(CLI_ENTRY_BEGIN)) {
|
||||||
|
const insertAt = next.search(/ELECTRON_RUN_AS_NODE=1/);
|
||||||
|
if (insertAt >= 0) next = `${next.slice(0, insertAt)}${block}${next.slice(insertAt)}`;
|
||||||
|
else next = `${block}${next}`;
|
||||||
|
}
|
||||||
|
next = next.replace(
|
||||||
|
/"\$resources\/app\.asar\/dsh\/node_modules\/@deepseek-ai\/dsh-desktop-host\/lib\/cli\.js"/g,
|
||||||
|
'"$entry"',
|
||||||
|
);
|
||||||
|
next = next.replace(
|
||||||
|
/\$resources\/app\.asar\/dsh\/node_modules\/@deepseek-ai\/dsh-desktop-host\/lib\/cli\.js/g,
|
||||||
|
'"$entry"',
|
||||||
|
);
|
||||||
|
return { changed: next !== text, text: next };
|
||||||
|
}
|
||||||
|
|
||||||
|
function patchOfficialCliCmdText(text) {
|
||||||
|
if (!text) return { changed: false, text };
|
||||||
|
const hasAsar =
|
||||||
|
text.toLowerCase().includes("app.asar\\dsh\\node_modules\\@deepseek-ai\\dsh-desktop-host\\lib\\cli.js") ||
|
||||||
|
text.includes(CLI_ASAR_ENTRY);
|
||||||
|
if (!hasAsar) return { changed: false, text };
|
||||||
|
if (text.includes("dsh-purge cli entry begin")) return { changed: false, text, already: true };
|
||||||
|
const asarWin = "%resources%\\app.asar\\dsh\\node_modules\\@deepseek-ai\\dsh-desktop-host\\lib\\cli.js";
|
||||||
|
const dirWin = "%resources%\\app\\dsh\\node_modules\\@deepseek-ai\\dsh-desktop-host\\lib\\cli.js";
|
||||||
|
let next = text;
|
||||||
|
const block = [
|
||||||
|
"REM dsh-purge cli entry begin",
|
||||||
|
`set "entry=${asarWin}"`,
|
||||||
|
`if not exist "%entry%" set "entry=${dirWin}"`,
|
||||||
|
"REM dsh-purge cli entry end",
|
||||||
|
"",
|
||||||
|
].join("\r\n");
|
||||||
|
if (!next.includes("dsh-purge cli entry begin")) next = block + next;
|
||||||
|
next = next.replace(
|
||||||
|
/%resources%\\app\.asar\\dsh\\node_modules\\@deepseek-ai\\dsh-desktop-host\\lib\\cli\.js/gi,
|
||||||
|
"%entry%",
|
||||||
|
);
|
||||||
|
return { changed: next !== text, text: next };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 解包 app.asar 后修补官方 CLI:入口回退到 app/,并补 app/runtime → ../runtime。 */
|
||||||
|
export function repairOfficialCliAfterUnpack(exe = findDesktopAppExecutable()) {
|
||||||
|
if (!exe || !isOfficialHarnessExecutable(exe)) return { ok: false, reason: "not_official" };
|
||||||
|
const resources = resourcesDirForExecutable(exe);
|
||||||
|
if (!resources || !isDir(resources)) return { ok: false, reason: "no_resources" };
|
||||||
|
const report = { ok: true, resources, symlink: null, shims: [] };
|
||||||
|
report.symlink = ensureAppRuntimeSymlink(resources);
|
||||||
|
const shimPaths = [
|
||||||
|
path.join(resources, "runtime", "cli", "bin", "dsh"),
|
||||||
|
path.join(resources, "runtime", "cli", "bin", "dsh.cmd"),
|
||||||
|
];
|
||||||
|
for (const fp of shimPaths) {
|
||||||
|
if (!isFile(fp)) {
|
||||||
|
report.shims.push({ path: fp, status: "missing" });
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let text = "";
|
||||||
|
try {
|
||||||
|
text = fs.readFileSync(fp, "utf8");
|
||||||
|
} catch (e) {
|
||||||
|
report.shims.push({ path: fp, status: "read_error", error: String(e && e.message ? e.message : e) });
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const patched = fp.toLowerCase().endsWith(".cmd")
|
||||||
|
? patchOfficialCliCmdText(text)
|
||||||
|
: patchOfficialCliShimText(text);
|
||||||
|
if (!patched.changed) {
|
||||||
|
report.shims.push({ path: fp, status: patched.already ? "already" : "skipped" });
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
fs.writeFileSync(fp, patched.text, "utf8");
|
||||||
|
report.shims.push({ path: fp, status: "patched" });
|
||||||
|
} catch (e) {
|
||||||
|
report.shims.push({ path: fp, status: "write_error", error: String(e && e.message ? e.message : e) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return report;
|
||||||
}
|
}
|
||||||
+57
-18
@@ -109,7 +109,15 @@ function watchWebTreeReady(ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function fsExists(fp) {
|
function fsExists(fp) {
|
||||||
return fsFor(fp).existsSync(fp);
|
const list = Array.isArray(fp) ? fp : [fp];
|
||||||
|
return list.some((p) => {
|
||||||
|
if (!p || typeof p !== "string") return false;
|
||||||
|
try {
|
||||||
|
return fsFor(p).existsSync(p);
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function line(title, value, ok = null) {
|
function line(title, value, ok = null) {
|
||||||
@@ -126,7 +134,9 @@ function renderStatus(state) {
|
|||||||
if (state.ai_base) {
|
if (state.ai_base) {
|
||||||
out.push(line("插件根 / plugin root", state.ai_base));
|
out.push(line("插件根 / plugin root", state.ai_base));
|
||||||
for (const [key, fp] of Object.entries(state.files)) {
|
for (const [key, fp] of Object.entries(state.files)) {
|
||||||
out.push(` ${fsExists(fp) ? "✓" : "✗"} ${key.padEnd(22)} ${fp}`);
|
const list = Array.isArray(fp) ? fp : [fp];
|
||||||
|
const shown = list.length <= 1 ? String(list[0] || "") : `${list[0]} (+${list.length - 1})`;
|
||||||
|
out.push(` ${fsExists(fp) ? "✓" : "✗"} ${key.padEnd(22)} ${shown}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
out.push(line("插件根 / plugin root", core.missingAiBaseMessage(), false));
|
out.push(line("插件根 / plugin root", core.missingAiBaseMessage(), false));
|
||||||
@@ -354,14 +364,22 @@ function installIdentityOverride(ctx, config = {}) {
|
|||||||
// 0.1.5 起 complete:true 在 waterfall 之后用调用前的快照盖掉 sections。
|
// 0.1.5 起 complete:true 在 waterfall 之后用调用前的快照盖掉 sections。
|
||||||
// 换宿主版本时文件补丁还没写上,或换插件版本时旧钩子把 dsh-purge 段删掉,注入都会丢。
|
// 换宿主版本时文件补丁还没写上,或换插件版本时旧钩子把 dsh-purge 段删掉,注入都会丢。
|
||||||
// 包住 assemble 的返回值,按 prompt-inject.md 再补回。
|
// 包住 assemble 的返回值,按 prompt-inject.md 再补回。
|
||||||
const prompt = ctx.systemPrompt;
|
const wrapAssemble = () => {
|
||||||
if (!prompt || typeof prompt.assemble !== "function" || prompt.__dshPurgeAssembleWrapped) return;
|
const prompt = ctx.systemPrompt;
|
||||||
const orig = prompt.assemble;
|
if (!prompt || typeof prompt.assemble !== "function" || prompt.__dshPurgeAssembleWrapped) return false;
|
||||||
prompt.assemble = async function (...args) {
|
const orig = prompt.assemble;
|
||||||
const assembled = await orig.apply(this, args);
|
prompt.assemble = async function (...args) {
|
||||||
return rewriteLiveAssembly(config, assembled, args[0]);
|
const assembled = await orig.apply(this, args);
|
||||||
|
return rewriteLiveAssembly(config, assembled, args[0]);
|
||||||
|
};
|
||||||
|
prompt.__dshPurgeAssembleWrapped = true;
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
prompt.__dshPurgeAssembleWrapped = true;
|
if (!wrapAssemble()) {
|
||||||
|
queueMicrotask(wrapAssemble);
|
||||||
|
setTimeout(wrapAssemble, 500);
|
||||||
|
setTimeout(wrapAssemble, 2000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function shimNeedsPatch(state) {
|
function shimNeedsPatch(state) {
|
||||||
@@ -505,6 +523,10 @@ async function handlePurgeCommand(rawInput, config) {
|
|||||||
await core.ensureOverrideContent(state.dsh_home, false);
|
await core.ensureOverrideContent(state.dsh_home, false);
|
||||||
const blocked = rejectIfNeedPrompt(state.dsh_home);
|
const blocked = rejectIfNeedPrompt(state.dsh_home);
|
||||||
if (blocked) return { kind: "error", text: blocked.error };
|
if (blocked) return { kind: "error", text: blocked.error };
|
||||||
|
await core.saveOverrideContent(
|
||||||
|
state.dsh_home,
|
||||||
|
core.resolveApplyOverrideText(state.dsh_home, ""),
|
||||||
|
);
|
||||||
await core.backupAll(state.ai_base);
|
await core.backupAll(state.ai_base);
|
||||||
const report = await core.applyPatches(state.ai_base);
|
const report = await core.applyPatches(state.ai_base);
|
||||||
const shimResult = await core.patchAllShims();
|
const shimResult = await core.patchAllShims();
|
||||||
@@ -844,6 +866,10 @@ export function apply(ctx, config) {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn("[dsh-purge] seed override error:", String(e));
|
console.warn("[dsh-purge] seed override error:", String(e));
|
||||||
}
|
}
|
||||||
|
// 与 1.1.30 前一致:启动就落盘默认提示词,不依赖用户先点保存。
|
||||||
|
core.installOverride(core.findDshHome(), false).catch((e) => {
|
||||||
|
console.warn("[dsh-purge] install override error:", String(e));
|
||||||
|
});
|
||||||
installIdentityOverride(ctx, cfg);
|
installIdentityOverride(ctx, cfg);
|
||||||
installRegionGate(ctx);
|
installRegionGate(ctx);
|
||||||
try {
|
try {
|
||||||
@@ -975,6 +1001,10 @@ export function apply(ctx, config) {
|
|||||||
await core.ensureOverrideContent(state.dsh_home, false);
|
await core.ensureOverrideContent(state.dsh_home, false);
|
||||||
const blocked = rejectIfNeedPrompt(state.dsh_home);
|
const blocked = rejectIfNeedPrompt(state.dsh_home);
|
||||||
if (blocked) return { text: "ERROR: " + blocked.error };
|
if (blocked) return { text: "ERROR: " + blocked.error };
|
||||||
|
await core.saveOverrideContent(
|
||||||
|
state.dsh_home,
|
||||||
|
core.resolveApplyOverrideText(state.dsh_home, ""),
|
||||||
|
);
|
||||||
await core.backupAll(state.ai_base);
|
await core.backupAll(state.ai_base);
|
||||||
const report = await core.applyPatches(state.ai_base);
|
const report = await core.applyPatches(state.ai_base);
|
||||||
await core.patchAllShims();
|
await core.patchAllShims();
|
||||||
@@ -1102,6 +1132,7 @@ function installWebServer(ctx, cfg) {
|
|||||||
patches_applied: state.patches_applied,
|
patches_applied: state.patches_applied,
|
||||||
patches_pending: state.patches_pending,
|
patches_pending: state.patches_pending,
|
||||||
patches_skipped: state.patches_skipped || 0,
|
patches_skipped: state.patches_skipped || 0,
|
||||||
|
patches_ready: state.patches_ready || 0,
|
||||||
patches_na: state.patches_na || 0,
|
patches_na: state.patches_na || 0,
|
||||||
patches_total: state.patches_total || core.ALL_PATCHES.length,
|
patches_total: state.patches_total || core.ALL_PATCHES.length,
|
||||||
patch_status: state.patch_status,
|
patch_status: state.patch_status,
|
||||||
@@ -1331,9 +1362,11 @@ function installWebServer(ctx, cfg) {
|
|||||||
await core.ensureOverrideContent(state.dsh_home, false);
|
await core.ensureOverrideContent(state.dsh_home, false);
|
||||||
const ui = await core.readOverrideForUi(state.dsh_home);
|
const ui = await core.readOverrideForUi(state.dsh_home);
|
||||||
const incoming = typeof body?.content === "string" ? body.content : "";
|
const incoming = typeof body?.content === "string" ? body.content : "";
|
||||||
const boxText = core.normalizeOverride(incoming)
|
// 框空时用内置默认,与 1.1.30 前「应用即带默认注入」一致,不必先点保存。
|
||||||
? incoming
|
const boxText = core.resolveApplyOverrideText(state.dsh_home, incoming)
|
||||||
: (ui.content || ui.defaultContent || "");
|
|| ui.content
|
||||||
|
|| ui.defaultContent
|
||||||
|
|| "";
|
||||||
const blocked = rejectIfNeedPrompt(state.dsh_home, boxText);
|
const blocked = rejectIfNeedPrompt(state.dsh_home, boxText);
|
||||||
if (blocked) {
|
if (blocked) {
|
||||||
sendJson(response, 400, {
|
sendJson(response, 400, {
|
||||||
@@ -1345,13 +1378,17 @@ function installWebServer(ctx, cfg) {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (core.normalizeOverride(boxText)) {
|
await core.saveOverrideContent(state.dsh_home, boxText);
|
||||||
await core.saveOverrideContent(state.dsh_home, boxText);
|
|
||||||
}
|
|
||||||
await core.backupAll(state.ai_base);
|
await core.backupAll(state.ai_base);
|
||||||
const report = await core.applyPatches(state.ai_base);
|
const report = await core.applyPatches(state.ai_base);
|
||||||
const override = await core.readOverrideForUi(state.dsh_home);
|
const override = await core.readOverrideForUi(state.dsh_home);
|
||||||
const shim = await core.patchAllShims();
|
const shim = await core.patchAllShims();
|
||||||
|
let cliRepair = null;
|
||||||
|
try {
|
||||||
|
cliRepair = core.repairOfficialCliAfterUnpack();
|
||||||
|
} catch (e) {
|
||||||
|
cliRepair = { ok: false, error: String(e && e.message ? e.message : e) };
|
||||||
|
}
|
||||||
const flash = core.silenceCmdFlash(state.ai_base);
|
const flash = core.silenceCmdFlash(state.ai_base);
|
||||||
const summary = core.summarizeApplyReport(report);
|
const summary = core.summarizeApplyReport(report);
|
||||||
const complete = summary.failed.length === 0 && flash.ok === true;
|
const complete = summary.failed.length === 0 && flash.ok === true;
|
||||||
@@ -1396,6 +1433,7 @@ function installWebServer(ctx, cfg) {
|
|||||||
override_installed: override.installed,
|
override_installed: override.installed,
|
||||||
shim,
|
shim,
|
||||||
desktop_scrubbed: scrubbed,
|
desktop_scrubbed: scrubbed,
|
||||||
|
cli_repair: cliRepair,
|
||||||
cmd_flash: flash,
|
cmd_flash: flash,
|
||||||
});
|
});
|
||||||
if (shouldRestart && handoff && core.desktopAsarStillSealed()) {
|
if (shouldRestart && handoff && core.desktopAsarStillSealed()) {
|
||||||
@@ -1488,16 +1526,17 @@ function installWebServer(ctx, cfg) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const home = core.findDshHome();
|
const home = core.findDshHome();
|
||||||
const blocked = rejectIfNeedPrompt(home, content);
|
const resolved = core.resolveApplyOverrideText(home, content);
|
||||||
|
const blocked = rejectIfNeedPrompt(home, resolved);
|
||||||
if (blocked) {
|
if (blocked) {
|
||||||
sendJson(response, 400, {
|
sendJson(response, 400, {
|
||||||
ok: false,
|
ok: false,
|
||||||
content,
|
content: resolved,
|
||||||
...blocked,
|
...blocked,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const saved = await core.saveOverrideContent(home, content);
|
const saved = await core.saveOverrideContent(home, resolved);
|
||||||
sendJson(response, 200, { ok: true, ...saved, ...injectSnapshot(home) });
|
sendJson(response, 200, { ok: true, ...saved, ...injectSnapshot(home) });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
sendJson(response, 500, { ok: false, error: String(e) });
|
sendJson(response, 500, { ok: false, error: String(e) });
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ export function pendingOfficialUpdate(exe) {
|
|||||||
const cache = updaterCacheDir();
|
const cache = updaterCacheDir();
|
||||||
let installer = path.join(cache, "installer.exe");
|
let installer = path.join(cache, "installer.exe");
|
||||||
let fileName = "installer.exe";
|
let fileName = "installer.exe";
|
||||||
|
let infoVersion = "";
|
||||||
try {
|
try {
|
||||||
const info = JSON.parse(fs.readFileSync(path.join(cache, "pending", "update-info.json"), "utf8"));
|
const info = JSON.parse(fs.readFileSync(path.join(cache, "pending", "update-info.json"), "utf8"));
|
||||||
const pendingName = String(info.fileName || "");
|
const pendingName = String(info.fileName || "");
|
||||||
@@ -99,13 +100,16 @@ export function pendingOfficialUpdate(exe) {
|
|||||||
installer = pending;
|
installer = pending;
|
||||||
fileName = pendingName;
|
fileName = pendingName;
|
||||||
}
|
}
|
||||||
|
infoVersion = String(info.version || info.fileVersion || info.toVersion || "").trim();
|
||||||
} catch {
|
} catch {
|
||||||
// 没有 update-info 时只认已经复制出来的 installer.exe。
|
// 没有 update-info 时只认已经复制出来的 installer.exe。
|
||||||
}
|
}
|
||||||
if (!fs.existsSync(installer)) return null;
|
if (!fs.existsSync(installer)) return null;
|
||||||
const version = versionFromInstallerName(fileName);
|
// installer.exe 无版本号时绝不能当「待更新」(#56:同版本缓存会劫持重启解包)。
|
||||||
|
const version = versionFromInstallerName(fileName) || (parseSemver(infoVersion) ? infoVersion : "");
|
||||||
|
if (!version || !parseSemver(version)) return null;
|
||||||
const installed = readInstalledVersion(exe);
|
const installed = readInstalledVersion(exe);
|
||||||
if (version && installed && compareSemver(version, installed) <= 0) return null;
|
if (installed && compareSemver(version, installed) <= 0) return null;
|
||||||
if (!installed) {
|
if (!installed) {
|
||||||
try {
|
try {
|
||||||
const exeTime = fs.statSync(exe).mtimeMs;
|
const exeTime = fs.statSync(exe).mtimeMs;
|
||||||
|
|||||||
@@ -67,8 +67,14 @@ if (!ok) {
|
|||||||
if (copiedAsar && fso.FileExists(asar)) {
|
if (copiedAsar && fso.FileExists(asar)) {
|
||||||
try { fso.DeleteFile(asar, true); log('rehid-asar'); } catch (hideErr) { log('rehid-asar ' + hideErr); }
|
try { fso.DeleteFile(asar, true); log('rehid-asar'); } catch (hideErr) { log('rehid-asar ' + hideErr); }
|
||||||
}
|
}
|
||||||
if (movedApp && prev && fso.FolderExists(prev) && !fso.FolderExists(appDir)) {
|
// 并发解包 helper 可能已重建 resources\app;更新失败时仍要把打过补丁的目录搬回来。
|
||||||
try { fso.MoveFolder(prev, appDir); log('restored-app'); } catch (backErr) { log('restored-app ' + backErr); }
|
if (movedApp && prev && fso.FolderExists(prev)) {
|
||||||
|
if (fso.FolderExists(appDir)) {
|
||||||
|
try { fso.DeleteFolder(appDir, true); log('cleared-recreated-app'); } catch (clearErr) { log('cleared-recreated-app ' + clearErr); }
|
||||||
|
}
|
||||||
|
if (!fso.FolderExists(appDir)) {
|
||||||
|
try { fso.MoveFolder(prev, appDir); log('restored-app'); } catch (backErr) { log('restored-app ' + backErr); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try { sh.Environment('PROCESS').Remove('ELECTRON_RUN_AS_NODE'); } catch (ignore) {}
|
try { sh.Environment('PROCESS').Remove('ELECTRON_RUN_AS_NODE'); } catch (ignore) {}
|
||||||
sh.Run('"' + exe + '"', 1, false);
|
sh.Run('"' + exe + '"', 1, false);
|
||||||
|
|||||||
+3
-1
@@ -46,7 +46,9 @@ function sameRev(a, b) {
|
|||||||
/** 当前插件版本和已写入补丁的版本一致时,启动不必再还原重打。 */
|
/** 当前插件版本和已写入补丁的版本一致时,启动不必再还原重打。 */
|
||||||
export function stampMatches(stamp, version, rev) {
|
export function stampMatches(stamp, version, rev) {
|
||||||
if (!stamp || !stamp.version || stamp.version !== version) return false;
|
if (!stamp || !stamp.version || stamp.version !== version) return false;
|
||||||
if (rev && stamp.sha && !sameRev(rev, stamp.sha)) return false;
|
// sha 为空表示 stamp 不完整(曾误写空串),不能当作已对齐(#56)。
|
||||||
|
if (!stamp.sha) return false;
|
||||||
|
if (rev && !sameRev(rev, stamp.sha)) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-2
@@ -22,7 +22,7 @@ import { dispatch, dispatchAsync } from './store-core.js'
|
|||||||
import { checkSkill, summarizeSkills } from './skill-availability.js'
|
import { checkSkill, summarizeSkills } from './skill-availability.js'
|
||||||
import { maxAgentsOf, maxAgentsSourceOf, saveMaxAgents, DEFAULT_MAX_AGENTS, MAX_AGENTS_LIMIT } from './settings.js'
|
import { maxAgentsOf, maxAgentsSourceOf, saveMaxAgents, DEFAULT_MAX_AGENTS, MAX_AGENTS_LIMIT } from './settings.js'
|
||||||
import {
|
import {
|
||||||
loadPlatformConfig, mergeConfigEnv, redteamRoot, envAdaptStatus,
|
loadPlatformConfig, mergeConfigEnv, redteamRoot, envAdaptStatus, markEnvAdaptSkip,
|
||||||
platformSummary, savePlatformConfig, assignToolkitFolder,
|
platformSummary, savePlatformConfig, assignToolkitFolder,
|
||||||
} from './platform-config.js'
|
} from './platform-config.js'
|
||||||
|
|
||||||
@@ -155,10 +155,16 @@ function profileDirOf(ctx) {
|
|||||||
*/
|
*/
|
||||||
function handlePlatformOp(store, request) {
|
function handlePlatformOp(store, request) {
|
||||||
const op = request && request.op
|
const op = request && request.op
|
||||||
if (op !== 'platformConfigGet' && op !== 'platformConfigSave' && op !== 'platformAssignToolkit') {
|
if (op !== 'platformConfigGet' && op !== 'platformConfigSave' && op !== 'platformAssignToolkit'
|
||||||
|
&& op !== 'platformEnvAdaptStatus' && op !== 'platformEnvAdaptSkip') {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
const root = (store && store.root) || redteamRoot()
|
const root = (store && store.root) || redteamRoot()
|
||||||
|
// EnvAdaptSendGate 轮询就绪 / 「暂不配置」;缺分支时前端永远拿不到 ready。
|
||||||
|
if (op === 'platformEnvAdaptStatus') return Object.assign({ ok: true }, envAdaptStatus(root))
|
||||||
|
if (op === 'platformEnvAdaptSkip') {
|
||||||
|
return Object.assign({ ok: true }, markEnvAdaptSkip(root, request.skip === undefined ? true : !!request.skip))
|
||||||
|
}
|
||||||
if (op === 'platformConfigGet') return platformSummary(root)
|
if (op === 'platformConfigGet') return platformSummary(root)
|
||||||
if (op === 'platformConfigSave') {
|
if (op === 'platformConfigSave') {
|
||||||
savePlatformConfig(request.config || {}, root)
|
savePlatformConfig(request.config || {}, root)
|
||||||
|
|||||||
+214
-23
@@ -1,4 +1,5 @@
|
|||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
|
import path from "node:path";
|
||||||
import { execFileSync, spawn } from "node:child_process";
|
import { execFileSync, spawn } from "node:child_process";
|
||||||
|
|
||||||
const encoded = process.env.DSH_PURGE_RESTART;
|
const encoded = process.env.DSH_PURGE_RESTART;
|
||||||
@@ -12,6 +13,18 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cleanup = Array.isArray(info.cleanup) ? info.cleanup : [];
|
const cleanup = Array.isArray(info.cleanup) ? info.cleanup : [];
|
||||||
|
const logPath = path.join(
|
||||||
|
process.env.TEMP || process.env.TMPDIR || "/tmp",
|
||||||
|
"dsh-purge-restart-desktop.log",
|
||||||
|
);
|
||||||
|
|
||||||
|
function log(msg) {
|
||||||
|
try {
|
||||||
|
fs.appendFileSync(logPath, `${new Date().toISOString()} ${msg}\n`);
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function spawnEnv() {
|
function spawnEnv() {
|
||||||
const env = { ...process.env };
|
const env = { ...process.env };
|
||||||
@@ -23,6 +36,10 @@ function spawnEnv() {
|
|||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sleep(ms) {
|
||||||
|
return new Promise((r) => setTimeout(r, ms));
|
||||||
|
}
|
||||||
|
|
||||||
function pidAlive(pid) {
|
function pidAlive(pid) {
|
||||||
const n = Number(pid);
|
const n = Number(pid);
|
||||||
if (!n) return false;
|
if (!n) return false;
|
||||||
@@ -36,12 +53,12 @@ function pidAlive(pid) {
|
|||||||
|
|
||||||
async function waitPidGone(pid) {
|
async function waitPidGone(pid) {
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
await new Promise((r) => setTimeout(r, 400));
|
await sleep(400);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (let i = 0; i < 80; i++) {
|
for (let i = 0; i < 80; i++) {
|
||||||
if (!pidAlive(pid)) return true;
|
if (!pidAlive(pid)) return true;
|
||||||
await new Promise((r) => setTimeout(r, 120));
|
await sleep(120);
|
||||||
}
|
}
|
||||||
return !pidAlive(pid);
|
return !pidAlive(pid);
|
||||||
}
|
}
|
||||||
@@ -70,7 +87,66 @@ function pidsForImage(image) {
|
|||||||
return pids;
|
return pids;
|
||||||
}
|
}
|
||||||
|
|
||||||
function listDesktopPids() {
|
function darwinBundleOf(exe) {
|
||||||
|
const n = String(exe || "").replace(/\\/g, "/");
|
||||||
|
const m = n.match(/^(.*\.app)\/Contents\/MacOS\//i);
|
||||||
|
return m ? m[1] : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function darwinBundleName(bundle) {
|
||||||
|
if (!bundle) return "";
|
||||||
|
const infoPlist = path.join(bundle, "Contents", "Info.plist");
|
||||||
|
try {
|
||||||
|
return execFileSync("defaults", ["read", path.join(bundle, "Contents", "Info"), "CFBundleName"], {
|
||||||
|
encoding: "utf8",
|
||||||
|
timeout: 5000,
|
||||||
|
}).trim();
|
||||||
|
} catch {
|
||||||
|
// fall through
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return execFileSync("plutil", ["-extract", "CFBundleName", "raw", infoPlist], {
|
||||||
|
encoding: "utf8",
|
||||||
|
timeout: 5000,
|
||||||
|
}).trim();
|
||||||
|
} catch {
|
||||||
|
return path.basename(bundle, ".app");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function listDarwinPids(exe) {
|
||||||
|
const bundle = darwinBundleOf(exe);
|
||||||
|
if (!exe || !bundle) return [];
|
||||||
|
let out = "";
|
||||||
|
try {
|
||||||
|
out = execFileSync("ps", ["-Ao", "pid=,command="], {
|
||||||
|
encoding: "utf8",
|
||||||
|
timeout: 8000,
|
||||||
|
});
|
||||||
|
} catch {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
const frameworks = `${bundle}/Contents/Frameworks/`;
|
||||||
|
const pids = [];
|
||||||
|
for (const line of String(out || "").split(/\n/)) {
|
||||||
|
const trimmed = line.trim();
|
||||||
|
if (!trimmed) continue;
|
||||||
|
const sp = trimmed.search(/\s/);
|
||||||
|
if (sp < 0) continue;
|
||||||
|
const pid = Number(trimmed.slice(0, sp).trim());
|
||||||
|
const cmd = trimmed.slice(sp + 1).trim();
|
||||||
|
if (!pid) continue;
|
||||||
|
// CLI 独立宿主(dsh web / plugin 等),不占桌面单实例锁,不能一起杀。
|
||||||
|
if (cmd.includes("/dsh-desktop-host/lib/cli.js")) continue;
|
||||||
|
if (cmd === exe || cmd.startsWith(`${exe} `) || cmd.startsWith(frameworks)) {
|
||||||
|
pids.push(pid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [...new Set(pids)];
|
||||||
|
}
|
||||||
|
|
||||||
|
function listDesktopPids(exe = info.execPath) {
|
||||||
|
if (process.platform === "darwin") return listDarwinPids(exe);
|
||||||
if (process.platform !== "win32") return [];
|
if (process.platform !== "win32") return [];
|
||||||
const images = ["DeepSeek Harness.exe", "DSH Desktop.exe"];
|
const images = ["DeepSeek Harness.exe", "DSH Desktop.exe"];
|
||||||
const pids = [];
|
const pids = [];
|
||||||
@@ -84,32 +160,156 @@ function listDesktopPids() {
|
|||||||
return pids;
|
return pids;
|
||||||
}
|
}
|
||||||
|
|
||||||
function killOtherDesktopProcesses(keepPid) {
|
function signalPids(pids, signal) {
|
||||||
for (const pid of listDesktopPids()) {
|
for (const pid of pids) {
|
||||||
if (pid === keepPid || pid === process.pid) continue;
|
if (pid === process.pid) continue;
|
||||||
try {
|
try {
|
||||||
process.kill(pid);
|
process.kill(pid, signal);
|
||||||
} catch {
|
} catch {
|
||||||
// 已经退了
|
// 已经退了
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function waitDesktopGone(exe, timeoutMs = 8000) {
|
||||||
|
const deadline = Date.now() + timeoutMs;
|
||||||
|
while (Date.now() < deadline) {
|
||||||
|
const left = listDesktopPids(exe).filter((pid) => pid !== process.pid);
|
||||||
|
if (left.length === 0) return true;
|
||||||
|
await sleep(200);
|
||||||
|
}
|
||||||
|
return listDesktopPids(exe).filter((pid) => pid !== process.pid).length === 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function quitDarwinDesktop(exe) {
|
||||||
|
const bundle = darwinBundleOf(exe);
|
||||||
|
const name = darwinBundleName(bundle);
|
||||||
|
if (name) {
|
||||||
|
try {
|
||||||
|
execFileSync(
|
||||||
|
"osascript",
|
||||||
|
["-e", `if application "${name}" is running then tell application "${name}" to quit`],
|
||||||
|
{ timeout: 15000 },
|
||||||
|
);
|
||||||
|
log("osascript quit sent");
|
||||||
|
} catch (e) {
|
||||||
|
log(`osascript quit failed: ${e && e.message ? e.message : e}`);
|
||||||
|
}
|
||||||
|
if (await waitDesktopGone(exe, 8000)) {
|
||||||
|
log("quit by apple event");
|
||||||
|
return "apple-event";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
signalPids(listDesktopPids(exe), "SIGTERM");
|
||||||
|
if (await waitDesktopGone(exe, 5000)) {
|
||||||
|
log("quit by SIGTERM");
|
||||||
|
return "SIGTERM";
|
||||||
|
}
|
||||||
|
signalPids(listDesktopPids(exe), "SIGKILL");
|
||||||
|
await waitDesktopGone(exe, 2000);
|
||||||
|
log("quit by SIGKILL");
|
||||||
|
return "SIGKILL";
|
||||||
|
}
|
||||||
|
|
||||||
|
function killOtherDesktopProcesses(keepPid, exe = info.execPath) {
|
||||||
|
for (const pid of listDesktopPids(exe)) {
|
||||||
|
if (pid === keepPid || pid === process.pid) continue;
|
||||||
|
try {
|
||||||
|
process.kill(pid, process.platform === "darwin" ? "SIGTERM" : undefined);
|
||||||
|
} catch {
|
||||||
|
// 已经退了
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function moveAsarAsideAsync(asar) {
|
||||||
|
if (!asar) return false;
|
||||||
|
try {
|
||||||
|
if (!fs.existsSync(asar) || !fs.statSync(asar).isFile()) return true;
|
||||||
|
} catch {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const bak = `${asar}.bak`;
|
||||||
|
try {
|
||||||
|
if (fs.existsSync(bak)) fs.rmSync(bak, { force: true });
|
||||||
|
} catch {
|
||||||
|
// keep going
|
||||||
|
}
|
||||||
|
for (let i = 0; i < 40; i++) {
|
||||||
|
try {
|
||||||
|
fs.renameSync(asar, bak);
|
||||||
|
log(`asar moved to ${bak}`);
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
await sleep(200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log("asar move failed after retries");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function relaunchDesktop() {
|
||||||
|
if (!info.execPath) {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
const env = spawnEnv();
|
||||||
|
if (process.platform === "darwin") {
|
||||||
|
const bundle = darwinBundleOf(info.execPath);
|
||||||
|
if (bundle) {
|
||||||
|
const child = spawn("open", [bundle], {
|
||||||
|
detached: true,
|
||||||
|
stdio: "ignore",
|
||||||
|
env,
|
||||||
|
shell: false,
|
||||||
|
});
|
||||||
|
child.on("error", () => process.exit(1));
|
||||||
|
child.unref();
|
||||||
|
log("relaunched via open");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const child = spawn(info.execPath, Array.isArray(info.argv) ? info.argv : [], {
|
||||||
|
detached: true,
|
||||||
|
stdio: "ignore",
|
||||||
|
cwd: info.cwd || process.cwd(),
|
||||||
|
env,
|
||||||
|
windowsHide: true,
|
||||||
|
shell: false,
|
||||||
|
});
|
||||||
|
child.on("error", () => process.exit(1));
|
||||||
|
child.unref();
|
||||||
|
log("relaunched via execPath");
|
||||||
|
}
|
||||||
|
|
||||||
if (info.killApp) {
|
if (info.killApp) {
|
||||||
await new Promise((r) => setTimeout(r, 400));
|
await sleep(400);
|
||||||
for (const dir of cleanup) rmTree(dir);
|
for (const dir of cleanup) rmTree(dir);
|
||||||
if (info.helper) {
|
if (info.helper) {
|
||||||
try { fs.unlinkSync(info.helper); } catch { /* ignore */ }
|
try {
|
||||||
|
fs.unlinkSync(info.helper);
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
killOtherDesktopProcesses(process.pid);
|
if (process.platform === "darwin") {
|
||||||
await new Promise((r) => setTimeout(r, 500));
|
await quitDarwinDesktop(info.execPath);
|
||||||
|
} else {
|
||||||
|
killOtherDesktopProcesses(process.pid);
|
||||||
|
await sleep(500);
|
||||||
|
}
|
||||||
|
if (info.asar) await moveAsarAsideAsync(info.asar);
|
||||||
} else {
|
} else {
|
||||||
const gone = await waitPidGone(info.pid);
|
const gone = await waitPidGone(info.pid);
|
||||||
if (!gone) process.exit(1);
|
if (!gone) process.exit(1);
|
||||||
for (const dir of cleanup) rmTree(dir);
|
for (const dir of cleanup) rmTree(dir);
|
||||||
if (info.helper) {
|
if (info.helper) {
|
||||||
try { fs.unlinkSync(info.helper); } catch { /* ignore */ }
|
try {
|
||||||
|
fs.unlinkSync(info.helper);
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (info.asar) await moveAsarAsideAsync(info.asar);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.respawn === false) {
|
if (info.respawn === false) {
|
||||||
@@ -118,15 +318,6 @@ if (info.respawn === false) {
|
|||||||
|
|
||||||
if (!info.execPath) process.exit(1);
|
if (!info.execPath) process.exit(1);
|
||||||
|
|
||||||
const child = spawn(info.execPath, Array.isArray(info.argv) ? info.argv : [], {
|
relaunchDesktop();
|
||||||
detached: true,
|
await sleep(400);
|
||||||
stdio: "ignore",
|
|
||||||
cwd: info.cwd || process.cwd(),
|
|
||||||
env: spawnEnv(),
|
|
||||||
windowsHide: true,
|
|
||||||
shell: false,
|
|
||||||
});
|
|
||||||
child.on("error", () => process.exit(1));
|
|
||||||
child.unref();
|
|
||||||
await new Promise((r) => setTimeout(r, 400));
|
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
+59
-7
@@ -67,6 +67,23 @@ function assertInside(root, target) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 源与 $DSH_HOME/skills 重叠时先删后拷会把自己删空(#54)。 */
|
||||||
|
function pathsOverlap(a, b) {
|
||||||
|
const left = path.resolve(String(a || ""));
|
||||||
|
const right = path.resolve(String(b || ""));
|
||||||
|
if (!left || !right) return false;
|
||||||
|
if (left === right) return true;
|
||||||
|
const leftPrefix = left.endsWith(path.sep) ? left : left + path.sep;
|
||||||
|
const rightPrefix = right.endsWith(path.sep) ? right : right + path.sep;
|
||||||
|
return left.startsWith(rightPrefix) || right.startsWith(leftPrefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertImportSourceOutsideSkills(dshHome, srcPath) {
|
||||||
|
const root = skillsDir(dshHome);
|
||||||
|
if (!pathsOverlap(srcPath, root)) return;
|
||||||
|
throw new Error("不能从 $DSH_HOME/skills 自身(或其子目录)导入,请换一个源目录");
|
||||||
|
}
|
||||||
|
|
||||||
function yamlScalar(value) {
|
function yamlScalar(value) {
|
||||||
const text = String(value ?? "").trim();
|
const text = String(value ?? "").trim();
|
||||||
if (!text) return '""';
|
if (!text) return '""';
|
||||||
@@ -483,7 +500,30 @@ export async function findSkillRoots(root) {
|
|||||||
return { dirs, flats };
|
return { dirs, flats };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function restoreSkillFromBackup(dshHome, id, backup) {
|
||||||
|
if (!backup) return;
|
||||||
|
const root = skillsDir(dshHome);
|
||||||
|
const bundleSrc = path.join(backup, id);
|
||||||
|
const flatSrc = path.join(backup, `${id}.md`);
|
||||||
|
try {
|
||||||
|
if (await pathExists(bundleSrc)) {
|
||||||
|
const dest = skillBundleDir(dshHome, id);
|
||||||
|
assertInside(root, dest);
|
||||||
|
await fsp.rm(dest, { recursive: true, force: true }).catch(() => {});
|
||||||
|
await copyDir(bundleSrc, dest);
|
||||||
|
}
|
||||||
|
if (await pathExists(flatSrc)) {
|
||||||
|
const dest = skillFlatFile(dshHome, id);
|
||||||
|
assertInside(root, dest);
|
||||||
|
await fsp.copyFile(flatSrc, dest);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// 回滚失败时保留 backup 路径给调用方。
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function installBundleDir(dshHome, srcDir, fallbackId) {
|
async function installBundleDir(dshHome, srcDir, fallbackId) {
|
||||||
|
assertImportSourceOutsideSkills(dshHome, srcDir);
|
||||||
const mdPath = path.join(srcDir, "SKILL.md");
|
const mdPath = path.join(srcDir, "SKILL.md");
|
||||||
const raw = await fsp.readFile(mdPath, "utf8");
|
const raw = await fsp.readFile(mdPath, "utf8");
|
||||||
const parsed = parseSkillDocument(raw);
|
const parsed = parseSkillDocument(raw);
|
||||||
@@ -491,19 +531,30 @@ async function installBundleDir(dshHome, srcDir, fallbackId) {
|
|||||||
if (!validSkillName(id)) throw new Error("压缩包/文件夹里没有合法的 Skill 名称");
|
if (!validSkillName(id)) throw new Error("压缩包/文件夹里没有合法的 Skill 名称");
|
||||||
const dest = skillBundleDir(dshHome, id);
|
const dest = skillBundleDir(dshHome, id);
|
||||||
assertInside(skillsDir(dshHome), dest);
|
assertInside(skillsDir(dshHome), dest);
|
||||||
|
if (pathsOverlap(srcDir, dest)) {
|
||||||
|
throw new Error("不能从目标技能目录自身导入,请换一个源目录");
|
||||||
|
}
|
||||||
const backup = await backupExisting(dshHome, id);
|
const backup = await backupExisting(dshHome, id);
|
||||||
await removeOfficialSkill(dshHome, id);
|
await removeOfficialSkill(dshHome, id);
|
||||||
await copyDir(srcDir, dest);
|
try {
|
||||||
const destMd = path.join(dest, "SKILL.md");
|
await copyDir(srcDir, dest);
|
||||||
if (parsed.ok && parsed.name !== id) {
|
const destMd = path.join(dest, "SKILL.md");
|
||||||
await fsp.writeFile(destMd, mergeSkillDocument(id, parsed.description, raw), "utf8");
|
if (!(await pathExists(destMd))) throw new Error("导入后缺少 SKILL.md");
|
||||||
} else if (!parsed.ok && !String(raw).replace(/^\uFEFF/, "").startsWith("---")) {
|
if (parsed.ok && parsed.name !== id) {
|
||||||
await fsp.writeFile(destMd, renderSkillDocument(id, id, raw), "utf8");
|
await fsp.writeFile(destMd, mergeSkillDocument(id, parsed.description, raw), "utf8");
|
||||||
|
} else if (!parsed.ok && !String(raw).replace(/^\uFEFF/, "").startsWith("---")) {
|
||||||
|
await fsp.writeFile(destMd, renderSkillDocument(id, id, raw), "utf8");
|
||||||
|
}
|
||||||
|
return { id, path: destMd, backup, description: parsed.ok ? parsed.description : id };
|
||||||
|
} catch (err) {
|
||||||
|
await fsp.rm(dest, { recursive: true, force: true }).catch(() => {});
|
||||||
|
await restoreSkillFromBackup(dshHome, id, backup);
|
||||||
|
throw err;
|
||||||
}
|
}
|
||||||
return { id, path: destMd, backup, description: parsed.ok ? parsed.description : id };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function installFlatFile(dshHome, srcFile, fallbackId) {
|
async function installFlatFile(dshHome, srcFile, fallbackId) {
|
||||||
|
assertImportSourceOutsideSkills(dshHome, srcFile);
|
||||||
const raw = await fsp.readFile(srcFile, "utf8");
|
const raw = await fsp.readFile(srcFile, "utf8");
|
||||||
const parsed = parseSkillDocument(raw);
|
const parsed = parseSkillDocument(raw);
|
||||||
const id = parsed.ok ? parsed.name : kebabFromLabel(fallbackId || path.basename(srcFile, ".md"));
|
const id = parsed.ok ? parsed.name : kebabFromLabel(fallbackId || path.basename(srcFile, ".md"));
|
||||||
@@ -512,6 +563,7 @@ async function installFlatFile(dshHome, srcFile, fallbackId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function installFoundSkills(dshHome, root, fallbackId) {
|
async function installFoundSkills(dshHome, root, fallbackId) {
|
||||||
|
assertImportSourceOutsideSkills(dshHome, root);
|
||||||
const found = await findSkillRoots(root);
|
const found = await findSkillRoots(root);
|
||||||
const imported = [];
|
const imported = [];
|
||||||
for (const dir of found.dirs) {
|
for (const dir of found.dirs) {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dsh-purge",
|
"name": "dsh-purge",
|
||||||
"version": "1.1.48",
|
"version": "1.1.51",
|
||||||
"description": "DeepSeek Harness 网络安全红队工具:本机官方 Harness 受控评测与清洗,内嵌演练台;不同模型可换不同提示词;默认提示词面向国模「小码酱」。求 Star ⭐",
|
"description": "DeepSeek Harness 网络安全红队工具:本机官方 Harness 受控评测与清洗,内嵌演练台;不同模型可换不同提示词;默认提示词面向国模「小码酱」。求 Star ⭐",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
|
|||||||
@@ -1,3 +1,53 @@
|
|||||||
|
# 1.1.51
|
||||||
|
|
||||||
|
## 中文
|
||||||
|
|
||||||
|
- 版本升级到 1.1.51。
|
||||||
|
- 修复 `/skills import` 对 `$DSH_HOME/skills` 自身导入时先删后拷把技能删空(#54)。
|
||||||
|
- 补齐 `platformEnvAdaptStatus` / `platformEnvAdaptSkip`,发送门禁不再误报「环境还没配好」(#55)。
|
||||||
|
- 修复官方桌面:无版本/同版本 `installer.exe` 被当成待更新劫持重启;更新失败时恢复 `resources/app`;空 sha 的 applied stamp 不再跳过 reapply(#56,0.1.7/0.2 同路径)。
|
||||||
|
- 补丁 #52 兼容无 `.volatile()` 写法;#57 跟到 `useDeveloperRole` 并覆盖 responses 通路;#48 上游已删句按软完成;状态导出 `patches_ready`;桌面端 shim 显示「本端不需要」。
|
||||||
|
|
||||||
|
## English
|
||||||
|
|
||||||
|
- Version 1.1.51.
|
||||||
|
- Reject `/skills import` when source overlaps `$DSH_HOME/skills` so delete-then-copy cannot wipe skills (#54).
|
||||||
|
- Implement `platformEnvAdaptStatus` / `platformEnvAdaptSkip` so the send gate no longer false-blocks ready environments (#55).
|
||||||
|
- Official desktop: ignore unversioned/same-version `installer.exe` pending updates; restore `resources/app` if update handoff fails; empty applied stamp sha no longer skips reapply (#56, same path on 0.1.7 and 0.2).
|
||||||
|
- Patch #52 matches non-`.volatile()` defaults; #57 follows `useDeveloperRole` and covers responses; #48 soft-settles when upstream removed the caution text; export `patches_ready`; desktop shim shows not-needed-here.
|
||||||
|
|
||||||
|
# 1.1.50
|
||||||
|
|
||||||
|
## 中文
|
||||||
|
|
||||||
|
- 版本升级到 1.1.50。
|
||||||
|
- 修复 macOS 官方桌面:点「应用」假失败「失败: 正在重启。」、解包后 `dsh` CLI 失效、status 误标 ✗(#53)。
|
||||||
|
- 修复点「应用」重启后默认提示词不注入:未改过时自动落盘内置默认,不必先点保存。
|
||||||
|
|
||||||
|
## English
|
||||||
|
|
||||||
|
- Version 1.1.50.
|
||||||
|
- Fix macOS official desktop: Apply false "Failed: Restarting.", broken `dsh` CLI after asar unpack, and status ✗ false negatives (#53).
|
||||||
|
- Fix default prompt not injecting after Apply + restart; bundled default is written without requiring Save first.
|
||||||
|
|
||||||
|
# 1.1.49-beta.1
|
||||||
|
|
||||||
|
## 中文
|
||||||
|
|
||||||
|
- 版本升级到 1.1.49-beta.1(#53 测试版)。
|
||||||
|
- 修复 macOS 官方桌面点「应用」后假失败「失败: 正在重启。」:`scheduleRestart` helper/runtime 分支补回 `restarting: true`;Darwin 重启改为 osascript 优雅退出 + SIGTERM/SIGKILL,排除 CLI 进程后再 `open` 重开(剥掉 ELECTRON_RUN_AS_NODE)。
|
||||||
|
- 解包 app.asar 后自动修补官方 `dsh` CLI 入口(asar/`app/` 回退)并补 `app/runtime -> ../runtime`,避免 `dsh web` 等全部 MODULE_NOT_FOUND。
|
||||||
|
- `/purge status` 对多路径文件清单按数组逐项判断,不再把已打补丁文件标成 ✗。
|
||||||
|
- 前端重启失败文案不再把成功分支的 note 当成 error。
|
||||||
|
|
||||||
|
## English
|
||||||
|
|
||||||
|
- Version 1.1.49-beta.1 (prerelease for #53).
|
||||||
|
- Fix macOS official desktop Apply false failure "Failed: Restarting.": helper/runtime branches of scheduleRestart return restarting:true; Darwin restart uses osascript quit then SIGTERM/SIGKILL, skips CLI processes, relaunches via open without ELECTRON_RUN_AS_NODE.
|
||||||
|
- After unpacking app.asar, auto-patch the official dsh CLI entry (asar/app fallback) and add app/runtime -> ../runtime so dsh web and other subcommands keep working.
|
||||||
|
- /purge status treats multi-path file lists correctly instead of marking patched files as missing.
|
||||||
|
- Restart failure UI no longer uses the success note as the error detail.
|
||||||
|
|
||||||
# 1.1.48
|
# 1.1.48
|
||||||
|
|
||||||
## 中文
|
## 中文
|
||||||
|
|||||||
Reference in new issue
Block a user