mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-27 18:50:22 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97c8824dff | ||
|
|
16174a5ba2 | ||
|
|
3e4f66f813 | ||
|
|
aedc58833f | ||
|
|
111427b198 | ||
|
|
d4a0bb572f | ||
|
|
426c168fb4 | ||
|
|
a189862d58 | ||
|
|
d3d30a3819 | ||
|
|
78ba6bdef7 | ||
|
|
52d3cf2798 |
No files matched your search
@@ -0,0 +1,55 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: release-${{ github.repository }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
release:
|
||||
if: github.repository == 'YuJunZhiXue/dsh-purge'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Publish GitHub Release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
version="$(node -p "require('./package.json').version")"
|
||||
tag="v${version}"
|
||||
if gh release view "$tag" >/dev/null 2>&1; then
|
||||
echo "already published: $tag"
|
||||
exit 0
|
||||
fi
|
||||
first="$(head -n 1 release-notes.md | tr -d '\r')"
|
||||
if [ "$first" != "# ${version}" ]; then
|
||||
echo "release-notes.md 第一行必须是 # ${version},现在是: ${first}"
|
||||
exit 1
|
||||
fi
|
||||
zip="dsh-purge-${version}.zip"
|
||||
if git rev-parse -q --verify "refs/tags/${tag}^{}" >/dev/null; then
|
||||
commit="$(git rev-parse "refs/tags/${tag}^{}")"
|
||||
git archive --format=zip --prefix="dsh-purge-${version}/" --output="$zip" "$commit"
|
||||
gh release create "$tag" --title "$tag" --notes-file release-notes.md
|
||||
else
|
||||
git archive --format=zip --prefix="dsh-purge-${version}/" --output="$zip" HEAD
|
||||
args=(release create "$tag" --target "$GITHUB_SHA" --title "$tag" --notes-file release-notes.md)
|
||||
case "$version" in
|
||||
*beta*|*alpha*|*rc*) args+=(--prerelease) ;;
|
||||
esac
|
||||
gh "${args[@]}"
|
||||
fi
|
||||
test -s "$zip"
|
||||
gh release upload "$tag" "$zip" --clobber
|
||||
echo "published https://github.com/YuJunZhiXue/dsh-purge/releases/tag/${tag}"
|
||||
@@ -4,10 +4,10 @@
|
||||
|
||||
<h1 align="center">⚔️ DeepSeek Harness cybersecurity red-team tool (dsh-purge)</h1>
|
||||
|
||||
<p align="center"><strong>Version 1.1.14</strong></p>
|
||||
<p align="center"><strong>Version 1.1.16</strong></p>
|
||||
|
||||
<p align="center">
|
||||
<em>Local official DeepSeek Harness cybersecurity red-team plugin: evaluate and harden host safety policy in a controlled local install; swap prompts per model. Default prompt for Chinese models — 小码酱. Please star ⭐</em>
|
||||
<em>Local official DeepSeek Harness cybersecurity red-team plugin. Evaluate and adjust host safety policy on a controlled local install; swap prompts per model. Default prompt for Chinese models — 小码酱. Please star ⭐</em>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
@@ -15,9 +15,9 @@
|
||||
<a href="https://github.com/YuJunZhiXue/dsh-purge/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-65a30d?style=flat" alt="MIT license"></a>
|
||||
<a href="https://awesome-dsh-plugin.com"><img src="https://awesome-dsh-plugin.com/badge.svg" alt="awesome · DSH plugin"></a>
|
||||
<a href="https://deepseek.stream/plugins/dsh-purge"><img src="https://img.shields.io/badge/Hub-dsh--purge-1a73e8" alt="DeepSeek Harness Hub"></a>
|
||||
<a href="https://www.deepseek.com/harness/"><img src="https://img.shields.io/badge/dsh-0.1.5--rc.1-blue" alt="DSH"></a>
|
||||
<a href="https://www.deepseek.com/harness/"><img src="https://img.shields.io/badge/dsh-0.1.7--rc.1-blue" alt="DSH"></a>
|
||||
<br>
|
||||
<img src="https://img.shields.io/badge/Node.js-%3E%3D22-339933?logo=node.js&logoColor=fff" alt="Node.js">
|
||||
<img src="https://img.shields.io/badge/Node.js-%3E%3D18-339933?logo=node.js&logoColor=fff" alt="Node.js">
|
||||
<img src="https://img.shields.io/badge/JavaScript-F7DF1E?logo=javascript&logoColor=000" alt="JavaScript">
|
||||
</p>
|
||||
|
||||
@@ -25,40 +25,43 @@
|
||||
<a href="README.md">English</a> | <a href="README.zh-CN.md">中文</a>
|
||||
</p>
|
||||
|
||||
> 🌐 **Plugin hub:** [DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge) — official and community DeepSeek plugin market | discover and one-click install
|
||||
> **After Apply, you must click Restart or the inject does not take effect.** Apply only writes the prompt and patches to disk. This process is still the old one. When the host has restarted, start a new chat — that is when the inject enters the session. Apply alone looks like nothing was injected.
|
||||
|
||||
> Aligned with **dsh 0.1.5-rc.2** (Node.js **≥18**; Windows no-flash import hooks need **Node ≥22** `registerHooks`, older Node still gets file-level `windowsHide` patches). On other versions, unmatched originals stay pending or skipped. Nothing is rewritten blindly.
|
||||
> Aligned with **dsh 0.1.7-rc.1** (Node.js **≥18**; Windows no-flash import hooks need **Node ≥22** `registerHooks`, older Node still gets file-level `windowsHide` patches). Patterns from older host builds that no longer exist are not applied. On other versions, unmatched originals stay pending or skipped. Nothing is rewritten blindly. Also accepts the 0.1.2 community `dsh-persona text` field and `dsh-mnemon` v0 session `summary`. After install you still need **Apply + restart**.
|
||||
>
|
||||
> Also accepts the 0.1.2 community `dsh-persona text` field and `dsh-mnemon` v0 session `summary`. After install you still need **Apply + restart**.
|
||||
> Hub page is for reading only: [DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge). Do not install via `deepseek.stream/api/plugins/download?...`.
|
||||
|
||||
## Contents
|
||||
|
||||
- [What this is](#what-this-is)
|
||||
- [Install](#install)
|
||||
- [Preview](#preview)
|
||||
- [Usage](#usage)
|
||||
- [How it works](#how-it-works)
|
||||
- [Restore](#restore)
|
||||
- [Releases](#releases)
|
||||
|
||||
---
|
||||
|
||||
## ☕ Sponsor
|
||||
## What this is
|
||||
|
||||
If this project helps you, send it over — I'm out here asking~
|
||||
**dsh-purge** is a cybersecurity red-team plugin for the official [DeepSeek Harness](https://www.deepseek.com/harness/) already installed on your machine.
|
||||
|
||||
| Asset | Address |
|
||||
Harness does more than forward a prompt. It rewrites prompts, approval gates, sandbox policy, and session migration at runtime. Asking only “will the model answer” treats a host-layer block as a model refusal. This plugin separates those two layers on your own install, for controlled evaluation and for seeing which default policy is too tight.
|
||||
|
||||
| You get | What it does |
|
||||
|---|---|
|
||||
| **USDT (TRC20)** | `TV5ajPkRD8RH623Dx9mqvYZVNN8nPGRKid` |
|
||||
| **Solana** | `6x16GhRgLVpKFFXaU1seKNdx2rypspSJTL4dbpt6Xpwk` |
|
||||
| **Ethereum** | `0xB68BD60C0e8c519513B7DF9bB147696815423B3E` |
|
||||
| **Bitcoin** | `bc1qu70yxkrtwnymt8ryluz9x8y8hqzune5340npht` |
|
||||
| **Rules** | Grouped patch status, Apply / Restore / Uninstall, prompt editor, multiple rule sets |
|
||||
| **Host policy** | Default copy, permission policy, and tool limits. Official capabilities stay. No second invented identity |
|
||||
| **On start** | Checks and reapplies. After npm overwrites `node_modules`, you do not hand-edit files |
|
||||
|
||||
<p align="center">
|
||||
<sub>Built by 小杨 · for DeepSeek Harness</sub>
|
||||
</p>
|
||||
No hardcoded drive letters. It looks at `$DSH_HOME`, `.dsh` next to the dsh launcher, then `~/.dsh`. It does not patch the Harness source tree. **Apply** on the settings page is what writes the changes. Identity comes only from your `prompt-inject.md`.
|
||||
|
||||
It only touches the official `@deepseek-ai` packages and local config on the user's machine. It is not a public scanner and not an attack kit for third-party sites. The repo does not ship malware, unauthorized-exploit scripts, or payloads aimed at the public internet.
|
||||
|
||||
---
|
||||
|
||||
## 🛡️ Why cybersecurity red-teaming matters
|
||||
|
||||
As generative AI and large language models move into production, robustness, adversarial defense, and alignment safety are core cybersecurity research problems. A local Agent / Harness also rewrites prompts, approval gates, sandbox policy, and session migration at runtime. Asking “will the model answer” is not enough if the host layer kills a lawful eval request first.
|
||||
|
||||
1. **Map the defense boundary, then harden the guardrail.** Professional cybersecurity red-teaming on a controlled local official DeepSeek Harness install is how teams find guardrail failures, prompt-injection, and unexpected-behavior gaps — then feed those findings back into fine-tuning, input guardrails, and the system safety layer.
|
||||
2. **Build an offense–defense eval loop.** Defense without a controlled red-team suite is guesswork. Reversible patches on the installed official `@deepseek-ai/*` packages show which refusals come from the model and which come from default copy, approval ladders, or session-format checks — a reproducible ruler for labs and auditors.
|
||||
3. **Advance native model-security research.** The project aims to give academia and security engineering a transparent, local, reproducible baseline. Keep official capabilities; only adjust over-refusal policy for controlled security eval. No second invented identity, and official optimizations stay.
|
||||
|
||||
This is a **local official DeepSeek Harness cybersecurity red-team plugin**. It only touches **your** installed official `@deepseek-ai` packages and local config. It is **not** a public scanner, **not** an attack kit for third-party sites, and the repo does **not** ship malware, unauthorized-exploit scripts, or payloads aimed at the public internet.
|
||||
## 📌 非盈利公益项目,严禁任何主体用于商业售卖、付费倒卖或黑灰产牟利,仅供技术参考。
|
||||
|
||||
---
|
||||
|
||||
@@ -98,27 +101,33 @@ This is a **local official DeepSeek Harness cybersecurity red-team plugin**. It
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Install
|
||||
## Install
|
||||
|
||||
Web and Desktop are **installed and security-eval patched separately**. They do not touch each other.
|
||||
Web, community Desktop, and the official desktop EXE are **installed and patched separately**. Install only the host you have open.
|
||||
|
||||
| Host | Profile | Default install |
|
||||
| What you run | Profile | Go to |
|
||||
|---|---|---|
|
||||
| **Web** (official `dsh web`) | `web` | Official `dsh` on PATH |
|
||||
| **Desktop** (community [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop)) | `desktop` | `dsh` inside the app’s built-in terminal (not official `dsh` on PATH) |
|
||||
| Official Harness desktop EXE | `default` | Official `dsh`, or `dsh://` below |
|
||||
| Official `dsh web` | `web` | [Web](#web) |
|
||||
| Community [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) | `desktop` | [Community Desktop](#desktop) |
|
||||
| Official Harness desktop EXE | `default` | [Official desktop EXE](#official-exe) |
|
||||
|
||||
After install:
|
||||
If `dsh` is not on PATH, or you do not want a remote install, use [Manual install](#manual).
|
||||
|
||||
1. Fully quit and restart **the host you just installed into** (stop `dsh web`, or quit the Desktop tray and open `DSH Desktop.exe`)
|
||||
2. When **Rules** appears on that host’s Settings page, click **Apply** (adding the bundle does not patch `@deepseek-ai` by itself)
|
||||
3. On start the plugin auto-applies the current host and uses the built-in default prompt unless the user has saved a different one
|
||||
### After the command: three steps
|
||||
|
||||
Web **Apply / Restart / Uninstall** affect Web only. Desktop **Apply / Restart / Uninstall** affect the desktop app only — they do not launch `dsh web`.
|
||||
Adding the plugin to a profile does **not** patch `@deepseek-ai` by itself.
|
||||
|
||||
> 🌐 **Plugin hub:** [DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge) (docs only — **do not** install via `deepseek.stream/api/plugins/download?...`)
|
||||
1. **Quit and reopen** the host you just installed into. Stop `dsh web` and start it again, or quit the Desktop tray and open that app's exe.
|
||||
2. On **that host's** Settings page, wait until **Rules** appears, then click **Apply**. Ctrl+F5 if the page is cached.
|
||||
3. **Restart once more** when prompted. Patched files load on that next start. Restart happens only when you click it.
|
||||
|
||||
### Web (default)
|
||||
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.
|
||||
|
||||
<a id="web"></a>
|
||||
|
||||
### Web
|
||||
|
||||
Official `dsh` must be on PATH. If it is not, install the official CLI or use manual install.
|
||||
|
||||
```sh
|
||||
dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
|
||||
@@ -130,21 +139,28 @@ If this directory is already a clone:
|
||||
dsh plugin --profile web add .
|
||||
```
|
||||
|
||||
Then stop `dsh web`, start it again, and **Apply** on the Web Settings page. If `dsh` is not on PATH, install the official CLI or use **Manual install** below.
|
||||
Then follow the three steps above and click **Apply** on the **Web** Settings page.
|
||||
|
||||
### Desktop (default)
|
||||
<a id="desktop"></a>
|
||||
|
||||
Open community [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) and run this in the **built-in terminal** (`dsh` is the desktop wrapper; default profile is `desktop`):
|
||||
### Community Desktop
|
||||
|
||||
Open [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) and run this in the **built-in terminal**. That `dsh` is the desktop wrapper; its default profile is `desktop`.
|
||||
|
||||
```sh
|
||||
dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
|
||||
```
|
||||
|
||||
Do not use official `dsh plugin --profile desktop` on PATH (it is rejected). Do not use `dsh://` (that is the official EXE).
|
||||
Do not use official `dsh plugin --profile desktop` on PATH (it is rejected). Do not use `dsh://` (that protocol belongs to the official EXE).
|
||||
|
||||
Then quit the tray, reopen `DSH Desktop.exe`, and **Apply** on the **desktop** Settings page.
|
||||
Then quit the tray, reopen `DSH Desktop.exe`, and click **Apply** on the **desktop** Settings page.
|
||||
|
||||
From a system terminal, use the app’s own CLI. Locate `DSH Desktop.exe` from the running process or the default install locations:
|
||||
For a custom install folder, set `$exe` in the script to `DSH Desktop.exe` in that folder. The tarball URL is the source so a local path with spaces cannot split the command.
|
||||
|
||||
<details>
|
||||
<summary><strong>Install from system PowerShell</strong></summary>
|
||||
|
||||
Find `DSH Desktop.exe` from the running process or the default locations below. Do not scan the whole disk.
|
||||
|
||||
```powershell
|
||||
$zip = "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz"
|
||||
@@ -166,13 +182,93 @@ $env:DSH_DESKTOP_DEFAULT_PROFILE = "desktop"
|
||||
& $exe --expose-internals $cli plugin add $zip
|
||||
```
|
||||
|
||||
For a custom install folder, set `$exe` to `DSH Desktop.exe` in that folder. The tarball URL is the default source so a local path with spaces cannot split the command.
|
||||
</details>
|
||||
|
||||
### Hand this to an AI (install only)
|
||||
<a id="official-exe"></a>
|
||||
|
||||
Paste the block below to a local coding assistant and ask it to install the plugin.
|
||||
### Official desktop EXE
|
||||
|
||||
<details open>
|
||||
If the **official DeepSeek Harness desktop client** is installed, use the command or the button (`dsh://`). Community DSH Desktop does **not** handle that protocol — use the previous section.
|
||||
|
||||
```sh
|
||||
dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
|
||||
```
|
||||
|
||||
<p align="center">
|
||||
<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.16&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>
|
||||
|
||||
🔗 **Raw protocol URL:**
|
||||
|
||||
```
|
||||
dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.16&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>
|
||||
<summary><strong>Protocol parameters and web trigger</strong></summary>
|
||||
|
||||
**Web trigger example:**
|
||||
|
||||
```js
|
||||
/**
|
||||
* Open the DeepSeek Harness desktop client to install dsh-purge
|
||||
*/
|
||||
export function installDshPurgeToDesktop() {
|
||||
const params = new URLSearchParams({
|
||||
id: 'dsh-purge',
|
||||
name: 'dsh-purge',
|
||||
version: '1.1.16',
|
||||
repo: 'YuJunZhiXue/dsh-purge',
|
||||
permissions: '系统提示词注入, 本机补丁, 设置页',
|
||||
downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz',
|
||||
});
|
||||
|
||||
const deepLink = `dsh://plugin/install?${params.toString()}`;
|
||||
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.style.display = 'none';
|
||||
iframe.src = deepLink;
|
||||
document.body.appendChild(iframe);
|
||||
setTimeout(() => document.body.removeChild(iframe), 2000);
|
||||
}
|
||||
```
|
||||
|
||||
**HTML link:**
|
||||
|
||||
```html
|
||||
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.16&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
|
||||
</a>
|
||||
```
|
||||
|
||||
**`dsh://plugin/install` parameters:**
|
||||
|
||||
| Param | Value / example | Meaning |
|
||||
|---|---|---|
|
||||
| id | `dsh-purge` | Plugin id |
|
||||
| name | `dsh-purge` | Display name |
|
||||
| version | `1.1.16` | Semver |
|
||||
| repo | `YuJunZhiXue/dsh-purge` | GitHub repo |
|
||||
| permissions | `系统提示词注入, 本机补丁, 设置页` | Requested permissions |
|
||||
| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub source archive |
|
||||
|
||||
</details>
|
||||
|
||||
Then fully quit the official client, including the tray, open it again, and click **Apply** on its Settings page.
|
||||
|
||||
### How to tell it installed
|
||||
|
||||
- Settings shows the **Rules** card
|
||||
- `/purge status` in chat prints `DSH_HOME` and the patch list; the path should be the home you are actually running
|
||||
- Optional packages that are not installed (liangshen, `dsh-web-fetch-http`) show as skipped and do not block Apply
|
||||
|
||||
### Hand this to an assistant
|
||||
|
||||
Paste the block below to a local assistant. It should only run the install command: no full-disk scan, no other file edits, no Apply, no restart.
|
||||
|
||||
<details>
|
||||
<summary><strong>For AI assistants (install only)</strong></summary>
|
||||
|
||||
<!-- AI-AGENT-START -->
|
||||
@@ -233,76 +329,11 @@ After the command finishes, tell the user to fully quit and restart the host the
|
||||
|
||||
</details>
|
||||
|
||||
### Official desktop EXE (`dsh://`)
|
||||
|
||||
If the **official DeepSeek Harness desktop client (EXE)** is installed, the button below opens a system URI. Community [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) does **not** handle `dsh://` — use **Desktop (default)** above.
|
||||
|
||||
CLI equivalent:
|
||||
|
||||
```sh
|
||||
dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
|
||||
```
|
||||
|
||||
<p align="center">
|
||||
<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.14&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>
|
||||
|
||||
🔗 **Raw protocol URL:**
|
||||
|
||||
```
|
||||
dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.14&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
|
||||
```
|
||||
|
||||
**Web trigger example:**
|
||||
|
||||
```js
|
||||
/**
|
||||
* Open the DeepSeek Harness desktop client to install dsh-purge
|
||||
*/
|
||||
export function installDshPurgeToDesktop() {
|
||||
const params = new URLSearchParams({
|
||||
id: 'dsh-purge',
|
||||
name: 'dsh-purge',
|
||||
version: '1.1.14',
|
||||
repo: 'YuJunZhiXue/dsh-purge',
|
||||
permissions: '系统提示词注入, 本机补丁, 设置页',
|
||||
downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz',
|
||||
});
|
||||
|
||||
const deepLink = `dsh://plugin/install?${params.toString()}`;
|
||||
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.style.display = 'none';
|
||||
iframe.src = deepLink;
|
||||
document.body.appendChild(iframe);
|
||||
setTimeout(() => document.body.removeChild(iframe), 2000);
|
||||
}
|
||||
```
|
||||
|
||||
**HTML link:**
|
||||
|
||||
```html
|
||||
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.14&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
|
||||
</a>
|
||||
```
|
||||
|
||||
**`dsh://plugin/install` parameters:**
|
||||
|
||||
| Param | Value / example | Meaning |
|
||||
|---|---|---|
|
||||
| id | `dsh-purge` | Plugin id |
|
||||
| name | `dsh-purge` | Display name |
|
||||
| version | `1.1.14` | Semver |
|
||||
| repo | `YuJunZhiXue/dsh-purge` | GitHub repo |
|
||||
| permissions | `系统提示词注入, 本机补丁, 设置页` | Requested permissions |
|
||||
| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub source archive |
|
||||
<a id="manual"></a>
|
||||
|
||||
### Manual install
|
||||
|
||||
Use this when `dsh` is not on `PATH`, official `dsh plugin add` fails, or you do not want a remote install. Edit **only the profile for the host you are using**. Do **not** delete existing bundles. Do not edit Web and Desktop in the same pass.
|
||||
Use this when the command fails, `dsh` is not on `PATH`, or you do not want a remote install. Edit **only the profile for the host you are using**. Do **not** delete existing bundles. Do not edit Web and Desktop in the same pass.
|
||||
|
||||
**0. Pick one host, one profile**
|
||||
|
||||
@@ -465,7 +496,7 @@ Notes:
|
||||
|
||||
**4. Run `pnpm install` only in the profile you just edited**
|
||||
|
||||
`pnpm` must be available (official `dsh` usually ships it). `cd` into **that profile directory**, not the repo root and not `$DSH_HOME` itself.
|
||||
`pnpm` must be available (official `dsh` usually ships it). `cd` into **that profile directory**, not the repo root and not `$DSH_HOME` itself. Run only the block for your host. Do not run all three.
|
||||
|
||||
```sh
|
||||
cd "$DSH_HOME/profiles/web"
|
||||
@@ -544,32 +575,6 @@ Plugin config lives in `cordis.patch.yml`:
|
||||
|
||||
---
|
||||
|
||||
## What this is
|
||||
|
||||
**dsh-purge** is a settings plugin for [DeepSeek Harness](https://www.deepseek.com/harness/):
|
||||
|
||||
- Updates default copy, permission policy, and tool limits in the installed `@deepseek-ai/*` packages
|
||||
- Adds a **Rules** card: grouped patches, Apply / Restore / Uninstall, session override editor, multiple rule sets
|
||||
- Re-applies on start after an npm upgrade overwrites `node_modules`
|
||||
- No hardcoded drive letters: `$DSH_HOME`, `.dsh` next to the dsh launcher, then `~/.dsh`
|
||||
|
||||
It does not patch the Harness source tree. Use **Apply** on the settings page. Identity comes only from your `prompt-inject.md` — the plugin does not author a second identity card.
|
||||
|
||||
---
|
||||
|
||||
## 0.1.5 notes
|
||||
|
||||
| Symptom | Patch | What it does |
|
||||
|---|---|---|
|
||||
| Picking a workspace / new chat wipes to empty | `#4` `#28` `#39` | 0.1.5 `dsh-persona` requires `prefix`; old presets still send `text`. Alias `text` → `prefix` so 0.1.2 presets (liangshen) can mount |
|
||||
| History: `summary requires notice form` | `#40` | `dsh-session-format-v0-to-v1` allows mnemon `instructions` / `recall` sources to carry `summary` |
|
||||
| “Who are you” falls back to DeepSeek assistant | inject file | No second identity. The `dsh-purge` section is verbatim `prompt-inject.md` |
|
||||
| Liangshen turn 1 looks uninjected | `#29` | phase-1 keeps persona / persona-prefix / persona-suffix plus inject; official tool catalog stays isolated |
|
||||
|
||||
`#20` / `#21` / `#28` / `#29` remain optional plugin rows: skip if those packages are absent.
|
||||
|
||||
---
|
||||
|
||||
## Preview
|
||||
|
||||
The **Rules** card appears on the dsh web settings page. Switch **Light / Ink**. Patches are grouped; the count only includes items that actually applied. Rule sets sit in a list above the editor, with Enable and Delete on each row.
|
||||
@@ -628,17 +633,6 @@ Runtime user files: `$DSH_HOME/prompt-inject.md`, `$DSH_HOME/rules/`, `$DSH_HOME
|
||||
|
||||
---
|
||||
|
||||
## Verify
|
||||
|
||||
- After restart, the **Rules** card is on the settings page. Hard-refresh (Ctrl+F5) if the client bundle is cached.
|
||||
- Click **Apply**, then **Restart** when prompted. Optional packages (liangshen / web-fetch) show as missing/skipped and do not block complete → restart.
|
||||
- Until the user saves a different prompt, `prompt-inject.md` stays the built-in default.
|
||||
- `/purge status` prints `DSH_HOME` and the patch list.
|
||||
- On 0.1.5, selecting an existing workspace should restore the session — not wipe to an empty workspace.
|
||||
- Skipped items are expected when a target file is absent (for example #20 / #21 without `dsh-web-fetch-http`).
|
||||
|
||||
---
|
||||
|
||||
## Usage
|
||||
|
||||
```sh
|
||||
@@ -680,38 +674,37 @@ node --check client.js
|
||||
|
||||
## How it works
|
||||
|
||||
**Apply (on start or by hand):**
|
||||
Apply, on start or when you click Apply:
|
||||
|
||||
```
|
||||
patch not applied? ──no──> skip
|
||||
│yes
|
||||
├─> backup <file>.dshpurge.bak (Desktop host-commands backups stay under `$DSH_HOME/dsh-purge/shim-backups` only)
|
||||
├─> apply matching replacements
|
||||
├─> override shim (dsh.cmd / dsh.ps1 / unix dsh; **skip Desktop sealed host-commands bins**)
|
||||
├─> scrub illegal sibling `*.dshpurge.bak` inside sealed bins (Desktop validates before plugins load)
|
||||
├─> Windows: pin hide-console + child_process import hook; patch subprocess-local / doctor / market / liangshen bash
|
||||
└─> if the user has not replaced the prompt, write/refresh the built-in default
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A["Start or click Apply"] --> B{"Patch already in place?"}
|
||||
B -->|yes| C["Skip"]
|
||||
B -->|no| D["Back up the original as .dshpurge.bak"]
|
||||
D --> E["Replace the matched files"]
|
||||
E --> F["Override the shim"]
|
||||
F --> G{"User edited the prompt?"}
|
||||
G -->|no| H["Write the built-in default prompt"]
|
||||
G -->|yes| I["Keep the current prompt-inject.md"]
|
||||
```
|
||||
|
||||
**Override (each session):**
|
||||
Override on each session:
|
||||
|
||||
```
|
||||
prompt-inject.md has content? ──yes──> write it verbatim as the dsh-purge systemPrompt section
|
||||
│no
|
||||
└─> no override section
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A["New session"] --> B{"prompt-inject.md has text?"}
|
||||
B -->|yes| C["Write it verbatim into the dsh-purge systemPrompt section"]
|
||||
B -->|no| D["Do not write an override section"]
|
||||
```
|
||||
|
||||
**Skills (official catalog, not injected):** Settings import (zip or folder) or `/skills import` writes only to official `$DSH_HOME/skills/<id>/SKILL.md` (companion files in that folder are kept). Official `dsh-skill-filesystem` watches that directory; the model loads via the `skill` tool or `/id`. Uninstalling the plugin does not delete user skills.
|
||||
Skills stay out of the inject section:
|
||||
|
||||
**Identity (1.3.6):** the plugin does not invent an “operator / LCS” second persona. Official Harness identity lines are stripped; `prompt-inject.md` is the identity. On 0.1.5 the inject is folded into `persona-prefix` so liangshen phase-1 cannot drop it.
|
||||
|
||||
**Windows CMD silence:** on Node 24, `import { spawn } from "node:child_process"` is not a live binding. `registerHooks` redirects `node:child_process` to a `windowsHide` facade; `@deepseek-ai/dsh-subprocess-local` also gets `windowsHide: true`. Doctor relaunch uses `node + bin.js` and does not leave a noop `supervisor.cmd`.
|
||||
|
||||
**Liangshen phase-1:** the default preset strips non-persona system-prompt sections. Apply / startup keeps persona, persona-prefix, persona-suffix, and inject (tool quarantine unchanged).
|
||||
|
||||
**DSH Desktop (anywhere-labs/dsh-desktop, issue #9):** `host-commands/<profile>/bin` is sealed — no sibling extras (including `dsh.cmd.dshpurge.bak`). This plugin scrubs only (no inject, no bak writes).
|
||||
|
||||
**Prompt security eval:** over-refusal and anti-eval-persona wording in `minimal`, official `standard` / `ptc` / `cordis`, and liangshen personas is rewritten so controlled security evaluations can complete. No fixed role name is locked in.
|
||||
```mermaid
|
||||
flowchart LR
|
||||
A["Settings import or /skills import"] --> B["Write into the official skills directory"]
|
||||
B --> C["DSH loads it"]
|
||||
C --> D["Uninstall does not delete user skills"]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -751,109 +744,9 @@ If nothing is found, set `DSH_BASE` / `DSH_DESKTOP_INSTALL`. No files are change
|
||||
|
||||
---
|
||||
|
||||
## Changelog
|
||||
## Releases
|
||||
|
||||
### 1.1.14
|
||||
|
||||
- Rewind waits for `updateQueue` to finish. A queue item that is already gone no longer becomes an unhandled rejection that can take down the host.
|
||||
- The fallback rewind button records this rewind’s timestamp. The 1.2s poll does not open and refill the same rewind a second time.
|
||||
- When the text being restored belongs to a turn that is still open, the fork point is the last closed turn. The previous completed turn is no longer dropped. If that turn is still running and does not close within 8 seconds, rewind still fails instead of cutting an incomplete log.
|
||||
- The bash timeout patch is now one whole-line regular expression, and values that grew extra zeros are pulled back to 10 minutes. Startup no longer appends another zero (#22, #31).
|
||||
- Patch replacement accepts regular expressions, and `$1` expands. A finished bundle-layout clean matches `persona: ""`, so the panel does not stay on pending. #39 is optional. The skipped hint now says the patch is not needed for this version, or the component is not installed.
|
||||
- Beta versions already covered by the current stable release are hidden from the version list. When the commit does not match, 「当前」follows the local version number.
|
||||
- Phase-1 no longer clears runtime context or the message allowlist. 梁神 and official plugin messages stay as they are.
|
||||
|
||||
### 1.1.13
|
||||
|
||||
- In-plugin updates rewrite `github:` and `git+https` to the GitHub `master.tar.gz` archive, so a reinstall does not need a local git (#30).
|
||||
- A first install from the plugin hub still uses `git+https`. Without git, use the `master.tar.gz` URL above.
|
||||
|
||||
### 1.1.12
|
||||
|
||||
- **Beta is now the stable release.** Settings and `/skills` import a zip or folder into official `$DSH_HOME/skills`. DSH still owns match and load.
|
||||
- Includes the 1.1.11 system-prompt fix: do not pin the previous full prompt (#29). The version list marks「当前」by commit. Local routes reject cross-origin requests. Patch #41 no longer keeps `dsh-purge:committed`.
|
||||
|
||||
### 1.1.11
|
||||
|
||||
- Settings splits Stable / Beta into two columns, each with its own list, switch, and rollback. 1.1.10 can reach this by Check update.
|
||||
- **No Skill import in this release.** Skill joins stable in 1.1.12.
|
||||
- **#29:** Stop pinning the previous full system prompt. That pin was meant to stop a new「系统提示词」card each step, but presets that append a section every assemble (梁神 `workspace-instructions`) turned it into “last full prompt + this step’s block”, so the prompt grew every step and prefix cache missed. Later turns only fold `prompt-inject` into persona, and do not fold a second copy when it is already there.
|
||||
- The version list marks「当前」by commit. An older tag with the same 1.1.11 version is no longer current next to `master`.
|
||||
- Local routes reject cross-origin requests, and updates only accept a known ref. Another webpage cannot apply, revert, uninstall, or switch.
|
||||
- Patch #41 no longer keeps the `dsh-purge:committed` shortcut. Hosts that already applied the old patch need one more Apply to remove it.
|
||||
|
||||
### 1.1.10
|
||||
|
||||
- Saving or applying with both the prompt and the rule set empty is blocked and shows a dialog
|
||||
- First-turn inject is complete; later turns no longer pin the previous full system prompt
|
||||
- Settings / `/skills` can import a zip or folder into official `$DSH_HOME/skills`; DSH still owns match and load
|
||||
- Settings can switch Stable / Beta and roll back to a published version; a rollback is pinned and will not auto-follow
|
||||
|
||||
### 1.1.9
|
||||
|
||||
- Removed the default prompt from the repository
|
||||
|
||||
<details>
|
||||
<summary>Earlier versions</summary>
|
||||
|
||||
### 1.1.8
|
||||
|
||||
- Until the user saves a different prompt, the built-in default is used. Settings can restore the default.
|
||||
|
||||
### 1.1.7
|
||||
|
||||
- **#25:** After the first turn, do not pin the previous full system prompt. Inject `prompt-inject.md` once; later turns leave this turn’s other sections as assembled.
|
||||
- **#26:** `dsh plugin add` / in-app update use GitHub `master.tar.gz`. A `.zip` URL is not a pnpm tarball (`ERR_PNPM_TARBALL_DECODE_GZIP`). Local overlay still downloads the zip for `tar` / Expand-Archive.
|
||||
- Install docs split **Web / Desktop** defaults: Web uses official `dsh --profile web`; Desktop uses the built-in terminal `dsh plugin add <tar.gz>`.
|
||||
- Desktop Apply / Restart / Uninstall only touch the running desktop install tree, not official Web / npm-global.
|
||||
- Desktop package root follows the running `DSH Desktop.exe` (default or custom install folder).
|
||||
|
||||
### 1.1.6
|
||||
|
||||
- Settings **Uninstall** asks for confirmation, restores applied patches, then removes the plugin and restarts.
|
||||
- The AI-assistant install block is install-only: no disk scan, no apply.
|
||||
- Separate install commands for official Web / official EXE / community DSH Desktop. Desktop **Restart / Uninstall** relaunch `DSH Desktop.exe`.
|
||||
|
||||
### 1.1.5
|
||||
|
||||
- Manual Update: if `git pull --ff-only` fails, fetch + reset to `origin/master`, then zip overlay.
|
||||
|
||||
### 1.1.4
|
||||
|
||||
- Update check reads `package.json` at the GitHub commit SHA, instead of the stale jsDelivr `@master` cache or falling back to the local version.
|
||||
|
||||
### 1.1.3
|
||||
|
||||
- Prompt inject once on the first turn; later turns pin the committed system prompt instead of appending a second copy.
|
||||
- Strip bundled `dsh-mnemon` context rows by default.
|
||||
- Switching back from a subagent no longer puts the last sent message into the composer.
|
||||
- Export a Cordis `{ apply }` default so the plugin tree can load.
|
||||
|
||||
### 1.1.2
|
||||
|
||||
- Custom OpenAI-compatible APIs no longer 400 on `developer` role: `#42` remaps it back to `system`.
|
||||
- Settings rule sets: read / delete / save go through one POST so the browser no longer fails with `Failed to fetch`.
|
||||
|
||||
### 1.1.1
|
||||
|
||||
- Composer **Undo** / `/rewind`: main agent can rewind once or the last round (drop this round’s subagents); a subagent rewinds once.
|
||||
- After rewind, the input box keeps the last user sentence, but sending again is a new turn — leftover inbox is cleared so the old prompt is not auto-sent.
|
||||
- Optional unmatched patches count as skipped, not failed.
|
||||
|
||||
### 1.1.0
|
||||
|
||||
- Check update and download share one button: after a check, it becomes **Update** and the pill shows the remote version.
|
||||
- Startup auto-checks GitHub `master` and downloads. `dsh plugin add` (zip / github) uses the official CLI; machines without git overlay `master.zip`. Uncommitted files in a git checkout are not auto-overwritten.
|
||||
- **#16:** `#26` no longer applies bare identity replacements to YAML; apply rewrites `prefix`/`text` fold indent so the cordis preset mounts.
|
||||
- **#15:** If there is text but it never reaches the model, 0.1.5 `complete:true` was dropping every section after assemble; `#41` folds inject back into the complete prompt.
|
||||
- **#14:** Hub `api/plugins/download` is not a tarball; install from GitHub `master.zip` only.
|
||||
|
||||
### 1.0.0
|
||||
|
||||
- Version numbering reset.
|
||||
- Settings: **Check update** reads GitHub `master`.
|
||||
|
||||
</details>
|
||||
What changed, and the zip, are on [Releases](https://github.com/YuJunZhiXue/dsh-purge/releases). To publish, bump the version in `package.json`, write Chinese and English notes in `release-notes.md`, and push `master`. Pushing the same version again does not publish another package.
|
||||
|
||||
## Notes
|
||||
|
||||
|
||||
+178
-280
@@ -4,10 +4,10 @@
|
||||
|
||||
<h1 align="center">⚔️ DeepSeek Harness 网络安全红队工具(dsh-purge)</h1>
|
||||
|
||||
<p align="center"><strong>Version 1.1.14</strong></p>
|
||||
<p align="center"><strong>Version 1.1.16</strong></p>
|
||||
|
||||
<p align="center">
|
||||
<em>本机官方 DeepSeek Harness 网络安全红队评测插件:在受控本机环境评测并加固宿主安全策略,不同模型可换不同提示词。默认提示词面向国模「小码酱」。求 Star 收藏 ⭐</em>
|
||||
<em>本机官方 DeepSeek Harness 网络安全红队评测插件。在受控本机里评测并调整宿主安全策略,不同模型可换不同提示词。默认提示词面向国模「小码酱」。求 Star 收藏 ⭐</em>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
@@ -15,47 +15,53 @@
|
||||
<a href="https://github.com/YuJunZhiXue/dsh-purge/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-65a30d?style=flat" alt="MIT license"></a>
|
||||
<a href="https://awesome-dsh-plugin.com"><img src="https://awesome-dsh-plugin.com/badge.svg" alt="awesome · DSH plugin"></a>
|
||||
<a href="https://deepseek.stream/plugins/dsh-purge"><img src="https://img.shields.io/badge/Hub-dsh--purge-1a73e8" alt="DeepSeek Harness Hub"></a>
|
||||
<a href="https://www.deepseek.com/harness/"><img src="https://img.shields.io/badge/dsh-0.1.5--rc.1-blue" alt="DSH"></a>
|
||||
<a href="https://www.deepseek.com/harness/"><img src="https://img.shields.io/badge/dsh-0.1.7--rc.1-blue" alt="DSH"></a>
|
||||
<br>
|
||||
<img src="https://img.shields.io/badge/Node.js-%3E%3D18-339933?logo=node.js&logoColor=fff" alt="Node.js">
|
||||
<img src="https://img.shields.io/badge/JavaScript-F7DF1E?logo=javascript&logoColor=000" alt="JavaScript">
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="README.md">English</a> | <a href="README.zh-CN.md">中文</a>
|
||||
</p>
|
||||
|
||||
> 🌐 **插件生态市场**:[DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge) — DeepSeek 官方与开源生态市场 | 插件发现与一键安装
|
||||
> **点「应用」之后,必须再点「重启」,注入才会生效。** 「应用」只把提示词和补丁写进文件,当前这个进程还是旧的。重启完成、宿主重新打开后,新开一轮对话,注入才进当前会话。只点应用、不重启,看起来就像没注入。
|
||||
|
||||
> 对准 **dsh 0.1.5-rc.1**(Node.js **≥18**;Windows 无感路径依赖 **Node ≥22** 的 `registerHooks`,更低版本仍靠文件级 `windowsHide` 补丁)。其它版本原文对不上时会显示待应用 / 跳过,不会乱改文件。
|
||||
> 对准 **dsh 0.1.7-rc.1**(Node.js **≥18**;Windows 无闪窗需要 **Node ≥22** 的 `registerHooks`,更低版本仍用文件级 `windowsHide`)。旧宿主里已经不存在的条文不再打。其它版本对不上的原文会显示待应用或跳过,不会乱改文件。兼容 0.1.2 社区预设的 `text` 字段,以及 `dsh-mnemon` 旧会话的 v0 `summary`。装完必须 **应用 + 重启**。
|
||||
>
|
||||
> 兼容 0.1.2 社区预设的 `dsh-persona text` 字段,以及 `dsh-mnemon` 历史会话的 v0 `summary`。装完必须 **应用 + 重启**。
|
||||
> 插件市场只看介绍:[DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge)。不要用 `deepseek.stream/api/plugins/download?...` 安装。
|
||||
|
||||
## 目录
|
||||
|
||||
- [介绍](#介绍)
|
||||
- [安装](#安装)
|
||||
- [界面](#界面预览)
|
||||
- [使用](#使用)
|
||||
- [工作原理](#工作原理)
|
||||
- [还原](#还原)
|
||||
- [更新](#更新)
|
||||
|
||||
---
|
||||
|
||||
## ☕ 赞赏支持
|
||||
## 介绍
|
||||
|
||||
如果这个项目对你有帮助,请给我转,我是讨口子~
|
||||
**dsh-purge** 是装在本机官方 [DeepSeek Harness](https://www.deepseek.com/harness/) 上的网络安全红队评测插件。
|
||||
|
||||
| 币种 | 地址 |
|
||||
Harness 不只是把问题交给模型。它还会在运行时改提示词、审批门、沙箱和会话格式。只看「模型答不答」,会把宿主拦截误当成模型拒绝。这个插件在你自己的安装里把这两层分开,用来做受控评测,也用来看默认策略该不该收紧。
|
||||
|
||||
| 你会用到 | 它做什么 |
|
||||
|---|---|
|
||||
| **USDT(TRC20)** | `TV5ajPkRD8RH623Dx9mqvYZVNN8nPGRKid` |
|
||||
| **Solana** | `6x16GhRgLVpKFFXaU1seKNdx2rypspSJTL4dbpt6Xpwk` |
|
||||
| **Ethereum** | `0xB68BD60C0e8c519513B7DF9bB147696815423B3E` |
|
||||
| **Bitcoin** | `bc1qu70yxkrtwnymt8ryluz9x8y8hqzune5340npht` |
|
||||
| **规则设定** | 分组查看补丁,应用、还原、卸载;编辑提示词和多套规则 |
|
||||
| **宿主策略** | 调整默认文案、权限策略和工具上限。官方能力保留,不另写一套身份 |
|
||||
| **启动时** | 自动再检查并应用。npm 升级盖掉 `node_modules` 之后不用手改文件 |
|
||||
|
||||
<p align="center">
|
||||
<sub>小杨制作 · 面向 DeepSeek Harness</sub>
|
||||
</p>
|
||||
不写死盘符。按 `$DSH_HOME`、dsh 启动器旁边的 `.dsh`,再退回 `~/.dsh`。不改 Harness 源码仓库,设置页点「应用」才写入。身份只来自你的 `prompt-inject.md`。
|
||||
|
||||
本插件只处理使用者本机已安装的官方 `@deepseek-ai` 包和本机配置。它不是公网扫描器,也不是针对第三方站点的攻击套件。仓库内不含木马、未授权渗透脚本或对外攻击载荷。
|
||||
|
||||
---
|
||||
|
||||
## 🛡️ 网络安全红队基准评测的必要性
|
||||
|
||||
在生成式人工智能与大语言模型(LLM)向各行业深度融合的背景下,模型的鲁棒性、对抗防御能力与系统对齐安全性已成为网络空间安全的核心研究课题。本地 Agent / Harness 还会在运行时改写提示词、审批门、沙箱和会话迁移,只测「模型会不会答」不够,还要看宿主层有没有把合法安全评测请求拦截掉。
|
||||
|
||||
1. **暴露防御边界,反哺安全护栏**:只有通过专业的网络安全红队对抗模拟(Red-Teaming),在受控本机环境深入探查官方 DeepSeek Harness 的防护失效、提示词注入与非预期行为,才能帮助安全团队精确定位防护盲区,从而在模型微调、输入过滤网关(Guardrails)与系统安全层实现前置加固。
|
||||
2. **构建攻防一体化防御体系**:缺乏受控红队评测用例的防御如同纸上谈兵。对本机已安装的官方 `@deepseek-ai/*` 包做可回滚安全评测补丁,才能分清哪些拒绝来自模型,哪些来自 Harness 默认文案、审批阶梯或会话格式校验,为企业与安全审计提供可复现的标尺。
|
||||
3. **推动大模型原生安全学术发展**:本项目旨在为学术界与安全工程领域提供透明、可复现的本机基准测试基线,共同推动 AI 基础设施抗对抗攻击、对齐与形式化验证技术演进。保住官方能力,只调整过度拒绝策略以便受控评测;不另造第二套身份,不删官方优化。
|
||||
|
||||
本项目是**本机官方 DeepSeek Harness 网络安全红队评测插件**:只改使用者自己安装的官方 `@deepseek-ai` 包与本机配置,**不是**公网扫描器,**不是**对第三方站点的攻击套件,仓库内**不含**木马、未授权渗透脚本或针对外网的攻击载荷。
|
||||
## 📌 非盈利公益项目,严禁任何主体用于商业售卖、付费倒卖或黑灰产牟利,仅供技术参考。
|
||||
|
||||
---
|
||||
|
||||
@@ -95,53 +101,66 @@
|
||||
|
||||
---
|
||||
|
||||
## ⚡ 安装方式
|
||||
## 安装
|
||||
|
||||
Web 端和桌面端**分开安装、分开做安全评测补丁**,互不影响。
|
||||
Web、社区桌面端、官方桌面 EXE **分开装、分开应用**。只装你正在打开的那一个。
|
||||
|
||||
| 宿主 | profile | 默认怎么装 |
|
||||
| 你正在用 | profile | 安装 |
|
||||
|---|---|---|
|
||||
| **Web 端**(官方 `dsh web`) | `web` | PATH 上的官方 `dsh` |
|
||||
| **桌面端**(社区 [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop)) | `desktop` | 桌面应用自带终端里的 `dsh`(不要用 PATH 上的官方 `dsh`) |
|
||||
| 官方 Harness 桌面 EXE | `default` | 官方 `dsh`,或下面的 `dsh://` |
|
||||
| 官方 `dsh web` | `web` | [Web](#web) |
|
||||
| 社区 [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) | `desktop` | [社区桌面端](#desktop) |
|
||||
| 官方 Harness 桌面 EXE | `default` | [官方桌面 EXE](#official-exe) |
|
||||
|
||||
装完后都要:
|
||||
`dsh` 不在 PATH、或不想走远程安装时,用 [手动安装](#manual)。
|
||||
|
||||
1. 完全退出并重启**刚装的那个宿主**(Web 关 `dsh web`;桌面端退出托盘再打开 `DSH Desktop.exe`)
|
||||
2. 在**这个宿主**的设置页出现「规则设定」后点「应用」(只写入 profile 还不会改 `@deepseek-ai`)
|
||||
3. 启动后会自动对当前宿主应用安全评测补丁;未自行改过提示词时使用插件内置默认,只有用户自己保存过不同内容才保留
|
||||
### 装完都要做完这三步
|
||||
|
||||
Web 的「应用 / 重启 / 卸载」只动 Web。桌面端的「应用 / 重启 / 卸载」只动桌面应用,不会去拉 `dsh web`。
|
||||
只把插件写进 profile **还不会**改 `@deepseek-ai`。
|
||||
|
||||
> 🌐 **插件生态市场**:[DeepSeek Harness Hub](https://deepseek.stream/plugins/dsh-purge)(只看介绍;**不要**用 `deepseek.stream/api/plugins/download?...` 安装)
|
||||
1. **退出并重新打开**刚装的那个宿主。Web 关掉 `dsh web` 再开;桌面端退出托盘,再打开对应的 exe。
|
||||
2. 在**这个宿主**的设置页看到「规则设定」,点 **「应用」**。有缓存就先 Ctrl+F5。
|
||||
3. 按提示 **再重启一次**。补丁这时才进入当前进程。点「重启」才会重启,不会装完自动重启。
|
||||
|
||||
### Web 端(默认)
|
||||
Web 的「应用 / 重启 / 卸载」只动 Web。桌面端的只动桌面应用,不会去拉 `dsh web`。不要在 Web 里点桌面端的应用,也不要反过来。
|
||||
|
||||
<a id="web"></a>
|
||||
|
||||
### Web
|
||||
|
||||
官方 `dsh` 需要在 PATH 上。没有就先装官方 CLI,或改走手动安装。
|
||||
|
||||
```sh
|
||||
dsh plugin --profile web add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
|
||||
```
|
||||
|
||||
当前目录已是本仓库时:
|
||||
当前目录已经是本仓库时:
|
||||
|
||||
```sh
|
||||
dsh plugin --profile web add .
|
||||
```
|
||||
|
||||
然后关掉 `dsh web` 再开,在 Web 设置页点「应用」。`dsh` 不在 PATH 就先装好官方 CLI,或走下面「手动配置」。
|
||||
然后按上面三步,在 **Web** 设置页点「应用」。
|
||||
|
||||
### 桌面端(默认)
|
||||
<a id="desktop"></a>
|
||||
|
||||
打开社区 [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop),在**自带终端**里执行(这里的 `dsh` 是桌面包装脚本,默认 profile 就是 `desktop`):
|
||||
### 社区桌面端
|
||||
|
||||
打开 [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop),在 **自带终端** 里执行。这里的 `dsh` 是桌面包装脚本,默认 profile 就是 `desktop`。
|
||||
|
||||
```sh
|
||||
dsh plugin add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
|
||||
```
|
||||
|
||||
不要用 PATH 上的官方 `dsh plugin --profile desktop`(会被拒绝)。不要用 `dsh://`(那是官方 EXE)。
|
||||
不要用 PATH 上的官方 `dsh plugin --profile desktop`,这条会被拒绝。不要用 `dsh://`,那是官方 EXE 的协议。
|
||||
|
||||
然后退出托盘,重新打开 `DSH Desktop.exe`,在**桌面端**设置页点「应用」。
|
||||
然后退出托盘,重新打开 `DSH Desktop.exe`,在 **桌面端** 设置页点「应用」。
|
||||
|
||||
从系统终端安装时,用桌面端自带 CLI。按正在运行的进程、默认安装位置定位 `DSH Desktop.exe`:
|
||||
自定义安装目录时,把脚本里的 `$exe` 换成该目录下的 `DSH Desktop.exe`。源用 tar.gz 地址,避免本地路径里的空格把命令拆开。
|
||||
|
||||
<details>
|
||||
<summary><strong>从系统 PowerShell 安装</strong></summary>
|
||||
|
||||
按正在运行的进程,或下面三个默认位置找 `DSH Desktop.exe`。不要全盘搜索。
|
||||
|
||||
```powershell
|
||||
$zip = "https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz"
|
||||
@@ -163,13 +182,93 @@ $env:DSH_DESKTOP_DEFAULT_PROFILE = "desktop"
|
||||
& $exe --expose-internals $cli plugin add $zip
|
||||
```
|
||||
|
||||
自定义安装目录时,把 `$exe` 换成该目录下的 `DSH Desktop.exe`。默认用 tar.gz 地址,避免本地路径空格把命令拆开。
|
||||
</details>
|
||||
|
||||
### 交给 AI 安装(只装插件)
|
||||
<a id="official-exe"></a>
|
||||
|
||||
把下面这一块发给本机助手,让它只执行安装命令。
|
||||
### 官方桌面 EXE
|
||||
|
||||
<details open>
|
||||
已经安装 **DeepSeek Harness 官方桌面客户端** 时,用下面的命令,或点按钮走 `dsh://`。社区 DSH Desktop **不认** 这个协议,请回到上一节。
|
||||
|
||||
```sh
|
||||
dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
|
||||
```
|
||||
|
||||
<p align="center">
|
||||
<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.16&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>
|
||||
|
||||
🔗 **原生协议链接:**
|
||||
|
||||
```
|
||||
dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.16&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>
|
||||
<summary><strong>协议参数和网页触发代码</strong></summary>
|
||||
|
||||
**网页端(前端)触发代码示例:**
|
||||
|
||||
```js
|
||||
/**
|
||||
* 唤起 DeepSeek Harness 桌面客户端一键安装 dsh-purge
|
||||
*/
|
||||
export function installDshPurgeToDesktop() {
|
||||
const params = new URLSearchParams({
|
||||
id: 'dsh-purge',
|
||||
name: 'dsh-purge',
|
||||
version: '1.1.16',
|
||||
repo: 'YuJunZhiXue/dsh-purge',
|
||||
permissions: '系统提示词注入, 本机补丁, 设置页',
|
||||
downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz',
|
||||
});
|
||||
|
||||
const deepLink = `dsh://plugin/install?${params.toString()}`;
|
||||
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.style.display = 'none';
|
||||
iframe.src = deepLink;
|
||||
document.body.appendChild(iframe);
|
||||
setTimeout(() => document.body.removeChild(iframe), 2000);
|
||||
}
|
||||
```
|
||||
|
||||
**HTML 静态链接方式:**
|
||||
|
||||
```html
|
||||
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.16&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>
|
||||
```
|
||||
|
||||
**协议参数配置(dsh://plugin/install):**
|
||||
|
||||
| 参数名 | 值 / 示例 | 说明 |
|
||||
|---|---|---|
|
||||
| id | `dsh-purge` | 插件唯一标识符 |
|
||||
| name | `dsh-purge` | 插件展示名称 |
|
||||
| version | `1.1.16` | 语义化版本号 |
|
||||
| repo | `YuJunZhiXue/dsh-purge` | GitHub 仓库 |
|
||||
| permissions | `系统提示词注入, 本机补丁, 设置页` | 申请权限 |
|
||||
| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub 源码包地址 |
|
||||
|
||||
</details>
|
||||
|
||||
然后完全退出官方客户端(含托盘),再打开,在它自己的设置页点「应用」。
|
||||
|
||||
### 怎样算装上了
|
||||
|
||||
- 设置页有「规则设定」
|
||||
- 聊天里 `/purge status` 能打出 `DSH_HOME` 和补丁列表,路径应是你正在用的那一份
|
||||
- 没装的可选包(例如梁神、`dsh-web-fetch-http`)显示跳过,不挡住应用完成
|
||||
|
||||
### 交给助手安装
|
||||
|
||||
把下面整段发给本机助手。它只执行安装命令:不要全盘搜索,不要改其它文件,不要代点「应用」,也不要重启。
|
||||
|
||||
<details>
|
||||
<summary><strong>给 AI 助手(只安装)</strong></summary>
|
||||
|
||||
<!-- AI-AGENT-START -->
|
||||
@@ -230,76 +329,11 @@ dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archiv
|
||||
|
||||
</details>
|
||||
|
||||
### 官方桌面 EXE(`dsh://`)
|
||||
<a id="manual"></a>
|
||||
|
||||
已安装 **DeepSeek Harness 官方桌面客户端(EXE)** 时,点下方按钮走系统 URI。社区 [DSH Desktop](https://github.com/anywhere-labs/dsh-desktop) **不认** `dsh://`,走上面「桌面端」默认命令。
|
||||
### 手动安装
|
||||
|
||||
命令行等价:
|
||||
|
||||
```sh
|
||||
dsh plugin --profile default add https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz
|
||||
```
|
||||
|
||||
<p align="center">
|
||||
<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.14&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>
|
||||
|
||||
🔗 **原生协议链接:**
|
||||
|
||||
```
|
||||
dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.14&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
|
||||
```
|
||||
|
||||
**网页端(前端)触发代码示例:**
|
||||
|
||||
```js
|
||||
/**
|
||||
* 唤起 DeepSeek Harness 桌面客户端一键安装 dsh-purge
|
||||
*/
|
||||
export function installDshPurgeToDesktop() {
|
||||
const params = new URLSearchParams({
|
||||
id: 'dsh-purge',
|
||||
name: 'dsh-purge',
|
||||
version: '1.1.14',
|
||||
repo: 'YuJunZhiXue/dsh-purge',
|
||||
permissions: '系统提示词注入, 本机补丁, 设置页',
|
||||
downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz',
|
||||
});
|
||||
|
||||
const deepLink = `dsh://plugin/install?${params.toString()}`;
|
||||
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.style.display = 'none';
|
||||
iframe.src = deepLink;
|
||||
document.body.appendChild(iframe);
|
||||
setTimeout(() => document.body.removeChild(iframe), 2000);
|
||||
}
|
||||
```
|
||||
|
||||
**HTML 静态链接方式:**
|
||||
|
||||
```html
|
||||
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.1.14&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>
|
||||
```
|
||||
|
||||
**协议参数配置(dsh://plugin/install):**
|
||||
|
||||
| 参数名 | 值 / 示例 | 说明 |
|
||||
|---|---|---|
|
||||
| id | `dsh-purge` | 插件唯一标识符 |
|
||||
| name | `dsh-purge` | 插件展示名称 |
|
||||
| version | `1.1.14` | 语义化版本号 |
|
||||
| repo | `YuJunZhiXue/dsh-purge` | GitHub 仓库 |
|
||||
| permissions | `系统提示词注入, 本机补丁, 设置页` | 申请权限 |
|
||||
| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.tar.gz` | GitHub 源码包地址 |
|
||||
|
||||
### 手动配置安装
|
||||
|
||||
`dsh` 不在 PATH、官方 `dsh plugin add` 失败、或不想走远程安装时,按下面手工写入。只改**正在用的那个宿主**对应的 profile,不要删原有 bundle,不要同时改 Web 和桌面端。
|
||||
命令行装不上、官方 `dsh plugin add` 失败、或不想走远程包时,按下面做。只改**正在用的那个宿主**对应的 profile,不要删原有 bundle,不要同时改 Web 和桌面端。
|
||||
|
||||
**0. 先确认宿主,只动一个 profile**
|
||||
|
||||
@@ -462,7 +496,7 @@ Rename-Item $src "dsh-purge"
|
||||
|
||||
**4. 只在刚改的那个 profile 目录装依赖**
|
||||
|
||||
本机要有 `pnpm`(官方 dsh 一般自带)。进入**上一步改过的那个** profile 目录再执行,不要在仓库根目录、也不要在 `$DSH_HOME` 根目录执行。
|
||||
本机要有 `pnpm`(官方 dsh 一般自带)。进入**上一步改过的那个** profile 目录再执行,不要在仓库根目录、也不要在 `$DSH_HOME` 根目录执行。下面三条命令只跑和你宿主对应的一条,不要三个连着跑。
|
||||
|
||||
```sh
|
||||
cd "$DSH_HOME/profiles/web" # Web
|
||||
@@ -541,32 +575,6 @@ dsh-purge --uninstall
|
||||
|
||||
---
|
||||
|
||||
## 这是什么
|
||||
|
||||
**dsh-purge** 是 [DeepSeek Harness](https://www.deepseek.com/harness/) 的设置插件:
|
||||
|
||||
- 改本机已安装的 `@deepseek-ai/*` 包:默认文案、权限策略、工具上限;
|
||||
- 设置页「规则设定」:分组查看补丁、应用 / 还原 / 卸载、编辑会话覆盖、多套规则;
|
||||
- 启动时自动检查并重新应用(npm 升级覆盖 `node_modules` 之后不必手搓);
|
||||
- 不写死盘符:按 `$DSH_HOME`、dsh 启动器旁边的 `.dsh`、系统默认 `~/.dsh` 探测本机位置。
|
||||
|
||||
不改 Harness 源码仓库。设置页点「应用」即可。身份只来自你自己的 `prompt-inject.md`,插件不再另写一张身份卡。
|
||||
|
||||
---
|
||||
|
||||
## 0.1.5 适配要点
|
||||
|
||||
| 现象 | 补丁 | 处理 |
|
||||
|---|---|---|
|
||||
| 选工作区 / 开新对话被清空 | `#4` `#28` `#39` | 0.1.5 的 `dsh-persona` 只要 `prefix`;旧预设仍写 `text`。补丁把 `text` 收成 `prefix` 别名,梁神等 0.1.2 预设才能挂上 |
|
||||
| 历史会话 `summary requires notice form` | `#40` | `dsh-session-format-v0-to-v1` 允许 mnemon 的 `instructions` / `recall` 带着 `summary` |
|
||||
| 「你是谁」回到 DeepSeek 助手 | 注入文件 | 不发明第二套身份;`dsh-purge` 段只贴 `prompt-inject.md` 原文 |
|
||||
| 梁神第一轮像没注入 | `#29` | phase-1 保留 persona / persona-prefix / persona-suffix 与 inject,不扒官方工具目录 |
|
||||
|
||||
`#20` / `#21` / `#28` / `#29` 仍是可选插件项:没装对应包就跳过。
|
||||
|
||||
---
|
||||
|
||||
## 界面预览
|
||||
|
||||
设置页会出现「规则设定」。白 / 墨可切换。补丁按组展开,进度只计真正已应用的项。规则集在上方列表启用或删除,下方编辑正文。
|
||||
@@ -625,17 +633,6 @@ dsh-purge/
|
||||
|
||||
---
|
||||
|
||||
## 生效验证
|
||||
|
||||
- 重启后设置页出现「规则设定」卡片(客户端半体加载成功)。有缓存时 Ctrl+F5。
|
||||
- 点「应用」,进度里已应用项增加;再按提示重启,补丁进入当前进程。缺可选包(如梁神、web-fetch)时对应项显示跳过/缺失,不影响「完成 → 重启」。
|
||||
- 未自行改过时,`prompt-inject.md` 使用插件内置默认提示词。设置页保存不同内容后才换成用户自己的。
|
||||
- 聊天里 `/purge status` 能打出 `DSH_HOME` 和补丁列表。
|
||||
- 0.1.5 上选已有工作区应能恢复会话,不应被清空成空工作区。
|
||||
- 个别项显示跳过是正常的:例如没装 `dsh-web-fetch-http` 时 #20 / #21 会跳过。
|
||||
|
||||
---
|
||||
|
||||
## 使用
|
||||
|
||||
```sh
|
||||
@@ -676,37 +673,37 @@ node --check client.js
|
||||
|
||||
## 工作原理
|
||||
|
||||
**应用(启动时 / 手动):**
|
||||
应用,启动时或手动点「应用」:
|
||||
|
||||
```
|
||||
补丁未应用? ──否──> 跳过
|
||||
│是
|
||||
├─> 备份原件 <文件>.dshpurge.bak(Desktop host-commands 的 shim 备份外置到 `$DSH_HOME/dsh-purge/shim-backups`)
|
||||
├─> 按补丁列表替换对应文件
|
||||
├─> 覆盖 shim(dsh.cmd / dsh.ps1 / unix dsh;**跳过 Desktop host-commands 密封目录**)
|
||||
├─> 清掉密封目录里误放的 sibling `*.dshpurge.bak`(Desktop 启动前校验,残留会进恢复模式)
|
||||
├─> Windows:钉 hide-console + child_process 导入钩子,并修补 subprocess-local / doctor / market / 梁神 bash
|
||||
└─> 未自行改过则写入/刷新内置默认提示词
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A["启动或点应用"] --> B{"补丁已经生效?"}
|
||||
B -->|是| C["跳过"]
|
||||
B -->|否| D["备份原件为 .dshpurge.bak"]
|
||||
D --> E["按补丁列表替换对应文件"]
|
||||
E --> F["覆盖 shim"]
|
||||
F --> G{"用户改过提示词?"}
|
||||
G -->|没有| H["写入内置默认提示词"]
|
||||
G -->|改过| I["保留现有 prompt-inject.md"]
|
||||
```
|
||||
|
||||
**覆盖(每次会话):**
|
||||
每次会话的覆盖:
|
||||
|
||||
```
|
||||
prompt-inject.md 有内容? ──是──> 原样写入 dsh-purge systemPrompt 段
|
||||
│否
|
||||
└─> 不写入覆盖段
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A["新会话"] --> B{"prompt-inject.md 有内容?"}
|
||||
B -->|有| C["原样写入 dsh-purge systemPrompt 段"]
|
||||
B -->|没有| D["不写入覆盖段"]
|
||||
```
|
||||
|
||||
**Skill(官方目录,不注入):** 设置页导入压缩包/文件夹,或 `/skills import`,只把内容写到官方 `$DSH_HOME/skills/<id>/SKILL.md`(可带同目录脚本等资源)。官方 `dsh-skill-filesystem` 监视该目录;模型用 `skill` 工具或 `/id` 加载。卸载插件不删用户 Skill。
|
||||
|
||||
**身份(1.3.6):** 插件不发明「操作员 / LCS」第二套人设。官方 Harness 身份句剥掉;`prompt-inject.md` 原文就是身份。0.1.5 把 inject 折进 `persona-prefix`,避免被梁神 phase-1 滤掉。
|
||||
|
||||
**Windows CMD 无感:** Node 24 上 `import { spawn } from "node:child_process"` 不是实时绑定。`registerHooks` 把 `node:child_process` 指到带 `windowsHide` 的封装层,并直接给 `@deepseek-ai/dsh-subprocess-local` 加 `windowsHide: true`。doctor 重启走 `node + bin.js`,不写空操作 `supervisor.cmd`。
|
||||
|
||||
**梁神 phase-1:** 默认预设会扒掉非 persona 的 system-prompt 段。应用 / 启动时保留 persona、persona-prefix、persona-suffix 与 inject(工具目录仍按梁神隔离)。
|
||||
|
||||
**DSH Desktop(anywhere-labs/dsh-desktop,issue #9):** `host-commands/<profile>/bin` 是密封目录,禁止 sibling 额外文件(含 `dsh.cmd.dshpurge.bak`)。本插件对密封目录只清理、不注入、不写 bak。
|
||||
Skill 不进注入段:
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
A["设置页导入或 /skills import"] --> B["写到官方 skills 目录"]
|
||||
B --> C["由 DSH 加载"]
|
||||
C --> D["卸载插件不删用户 Skill"]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -738,108 +735,9 @@ prompt-inject.md 有内容? ──是──> 原样写入 dsh-purge systemPrompt
|
||||
|
||||
---
|
||||
|
||||
## 更新记录
|
||||
## 更新
|
||||
|
||||
### 1.1.14
|
||||
|
||||
- 回退清队列时会等 `updateQueue` 结束。条目已经不在时不再变成未处理的拒绝,避免把宿主带崩。
|
||||
- 兜底回退按钮成功后会记下这次的时间。1.2 秒后的轮询不会把同一次回退再打开、再回填一遍。
|
||||
- 回填的是还没结束的那一句时,切点改到最后一个已闭合回合。不再多丢上一整轮。回合还在进行、8 秒内等不到结束时,仍然直接失败,不会按不完整日志去切。
|
||||
- bash 超时补丁改成整行正则,并把已经多写出来的 0 收回到 10 分钟。每次启动不再给超时再补一个 0(#22,#31)。
|
||||
- 补丁替换支持正则,`$1` 会展开。bundle 布局清洗完成后能认出 `persona: ""`,面板不再一直显示待应用。#39 改为可选。跳过说明改为「当前版本不需要或组件未安装」。
|
||||
- 正式版已经追上的测试版不再出现在版本列表里。提交号对不上时,按本机版本号标「当前」。
|
||||
- phase-1 不再清空 runtime context,也不改消息白名单。梁神和官方插件的消息照旧保留。
|
||||
|
||||
### 1.1.13
|
||||
|
||||
- 插件自己更新时,`github:` 和 `git+https` 改走 GitHub `master.tar.gz`,没装 git 也能重装(#30)。
|
||||
- 第一次从插件市场安装仍会走 `git+https`。没装 git 时,直接用上面的 `master.tar.gz` 地址。
|
||||
|
||||
### 1.1.12
|
||||
|
||||
- **测试版转为正式版。** 设置页和 `/skills` 可把压缩包或文件夹导入官方 `$DSH_HOME/skills`。命中和加载仍由 DSH 负责。
|
||||
- 带上 1.1.11 的系统提示修复:不再钉上一轮全文(#29)。版本列表按提交号标「当前」。本机接口拒绝跨站请求。补丁 #41 不再保留 `dsh-purge:committed`。
|
||||
|
||||
### 1.1.11
|
||||
|
||||
- 设置页把正式版和测试版左右分开,各自选版本、各自切换和回退。还在 1.1.10 的点「检测更新」就能升到这一版。
|
||||
- **当时没有 Skill 导入。** Skill 从 1.1.12 起进入正式版。
|
||||
- **#29:** 去掉「钉住上一条系统提示全文」。起初为了避免每步追加「系统提示词」,把上一轮全文钉回去;和每轮追加 section 的预设(梁神的 `workspace-instructions`)叠在一起后,系统提示每步变长,前缀缓存整段失效。现在每轮只把 `prompt-inject` 折进 persona,已经折过就不再折第二份。
|
||||
- 版本列表按提交号标「当前」。同为 1.1.11 的旧标签不再和 `master` 一起显示当前。
|
||||
- 本机接口拒绝跨站请求,更新只接受已知版本。任意网页不能再调用应用、还原、卸载或切换。
|
||||
- 补丁 #41 去掉 `dsh-purge:committed` 短路。已经打过旧补丁的,再点一次「应用」才会从宿主文件里删掉。
|
||||
|
||||
### 1.1.10
|
||||
|
||||
- 提示词和规则集都空时不能保存或应用,弹窗要求先添加提示词
|
||||
- 第一轮完整注入;不再钉上一轮整篇系统提示,避免来回追加
|
||||
- 设置页 / `/skills` 可把压缩包或文件夹导入官方 `$DSH_HOME/skills`;命中与加载仍由 DSH 负责
|
||||
- 设置页可切换正式版 / 测试版,并从历史版本回退;回退后会固定,不再自动跟上
|
||||
|
||||
### 1.1.9
|
||||
|
||||
- 将提示词从仓库中下线
|
||||
|
||||
<details>
|
||||
<summary>更早版本</summary>
|
||||
|
||||
### 1.1.8
|
||||
|
||||
- 未自行改过提示词时使用内置默认;设置页保存不同内容后才换成用户自己的,可「恢复默认」。
|
||||
|
||||
### 1.1.7
|
||||
|
||||
- **#25:** 第一轮注入 `prompt-inject.md` 之后不再把上一轮整段系统提示钉回去;后续只保留本轮组装结果。
|
||||
- **#26:** `dsh plugin add` / 插件内更新改用 GitHub `master.tar.gz`。`.zip` 不是 pnpm 能解的压缩包,会报 `ERR_PNPM_TARBALL_DECODE_GZIP`。本地覆盖安装仍下载 zip 给 `tar` / Expand-Archive。
|
||||
- 安装文档按 **Web 端 / 桌面端** 分开写默认命令:Web 用官方 `dsh --profile web`;桌面端默认在自带终端 `dsh plugin add <zip>`。
|
||||
- 桌面端安全评测补丁、重启、卸载只针对当前桌面进程的安装树,不碰官方 Web / npm-global。
|
||||
- 桌面端安装目录按运行中的 `DSH Desktop.exe` 定位,默认位置或自定义目录都可以。
|
||||
|
||||
### 1.1.6
|
||||
|
||||
- 设置页「卸载」会弹窗确认;若已应用补丁则先还原回原版,再清除插件并重启。
|
||||
- 给 AI 的安装块只跑官方 `dsh plugin add`,不扫盘、不应用。
|
||||
|
||||
### 1.1.5
|
||||
|
||||
- 点「更新」时:git 快进失败会 `fetch + reset`,再不行改用 zip 覆盖,不再整次失败。
|
||||
|
||||
### 1.1.4
|
||||
|
||||
- 检测更新按 GitHub 提交号读 `package.json`,不再误用 jsDelivr `@master` 缓存,也不会在读不到远端版本时显示成「有新版本 1.1.2,当前 1.1.2」。
|
||||
|
||||
### 1.1.3
|
||||
|
||||
- 系统提示词只在每个会话第一轮注入一份;后续轮次钉住已提交的系统提示词,不再追加第二份。
|
||||
- 默认剥掉套件自带的 `dsh-mnemon` 上下文注入。
|
||||
- 从子代理点回主代理时,不再把上一句已发送的内容填回输入框。
|
||||
- 补上 Cordis 需要的 `{ apply }` 默认导出,避免插件树加载失败导致后端退出。
|
||||
|
||||
### 1.1.2
|
||||
|
||||
- 自定义 OpenAI 兼容接口不再因 `developer` 角色 400:`#42` 改回 `system`。
|
||||
- 设置页规则集:读 / 删 / 存走同一个 POST,不再报 `Failed to fetch`。
|
||||
|
||||
### 1.1.1
|
||||
|
||||
- 输入框旁「回退」/ `/rewind`:主代理可选回退一次或上一轮(丢掉本轮子代理);子代理直接回退一次。
|
||||
- 回退后输入框仍是上一句用户内容,再次发送是全新一轮:清掉待发送队列,不会把旧提示再自动发出去。
|
||||
- 可选补丁对不上时记为跳过,不再算失败。
|
||||
|
||||
### 1.1.0
|
||||
|
||||
- 检测更新与下载分开:先查,有新版本按钮变成「更新」,版本号显示远端。
|
||||
- 开机自动对照 GitHub `master` 并下载。`dsh plugin add`(zip / github)走官方 CLI;没 git 下 `master.zip` 覆盖。git 仓库本地有未提交改动时不自动覆盖。
|
||||
- **#16**:`#26` 不再对 YAML 用无缩进 identity 替换;apply 重写 `prefix`/`text` 缩进,cordis 预设能挂载。
|
||||
- **#15**:有内容却进不了会话,是 0.1.5 `complete:true` 丢掉 section;`#41` 把注入补回 complete 段。
|
||||
- **#14**:Hub `api/plugins/download` 不是 tar,安装只用 GitHub `master.zip`。
|
||||
|
||||
### 1.0.0
|
||||
|
||||
- 版本号从头计数。
|
||||
- 设置页增加 **检测更新**:对照 GitHub `master`。
|
||||
|
||||
</details>
|
||||
每一版改了什么、安装包在 [Releases](https://github.com/YuJunZhiXue/dsh-purge/releases)。发新版时把 `package.json` 的版本号改掉,中英文说明写进 `release-notes.md`,推到 `master` 就会自动打包。同一版本再推送不会重复发包。
|
||||
|
||||
## 说明
|
||||
|
||||
|
||||
@@ -129,11 +129,11 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
|
||||
|
||||
const TARGETS = ["AGENTS.md", "CLAUDE.md"];
|
||||
const PATCH_GROUPS = [
|
||||
{ key: "prompt", ids: [1, 2, 3, 4, 5, 26, 27, 28, 29, 33] },
|
||||
{ key: "prompt", ids: [1, 2, 3, 4, 5, 25, 26, 27, 28, 32] },
|
||||
{ key: "code", ids: [6, 7, 8] },
|
||||
{ key: "engine", ids: [9, 10, 11, 12, 13, 14, 15, 16, 36] },
|
||||
{ key: "tools", ids: [17, 18, 19, 20, 21, 22, 23, 24, 25, 30, 31, 32, 34, 35, 37, 38] },
|
||||
{ key: "compat", ids: [39, 40, 41] },
|
||||
{ key: "engine", ids: [9, 10, 11, 12, 13, 14, 15, 16, 35] },
|
||||
{ key: "tools", ids: [17, 18, 19, 20, 21, 22, 23, 24, 29, 30, 31, 33, 34, 36, 37] },
|
||||
{ key: "compat", ids: [38, 39, 40] },
|
||||
];
|
||||
|
||||
const zh = {
|
||||
@@ -299,28 +299,27 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
|
||||
"patch.17": "观察策略读写放行",
|
||||
"patch.18": "重复调用守卫禁用",
|
||||
"patch.19": "工具结果修剪禁用",
|
||||
"patch.20": "dsh-web-fetch-http:启用 fetch + provider",
|
||||
"patch.21": "dsh-web-fetch-http:base 写入依赖",
|
||||
"patch.22": "bash 超时 60s → 10min",
|
||||
"patch.23": "read 上限放宽",
|
||||
"patch.24": "子代理深度 3 → 10",
|
||||
"patch.25": "preset fetch 启用",
|
||||
"patch.26": "去掉官方默认身份(功能提示词不动)",
|
||||
"patch.27": "minimal:去掉默认身份并打开 inject",
|
||||
"patch.28": "dsh-liangshen(梁神):去掉默认身份(可选)",
|
||||
"patch.29": "dsh-liangshen(梁神):phase-1 保留注入段",
|
||||
"patch.30": "dsh-tool-web:外部 untrusted 拦截→可执行",
|
||||
"patch.31": "dsh-hooks-claude-code:deny→allow",
|
||||
"patch.32": "dsh-hooks-codex:deny→allow",
|
||||
"patch.33": "Web 表面身份中性化",
|
||||
"patch.34": "Shell 拒绝提示 → 可执行",
|
||||
"patch.35": "沙箱提示中性化",
|
||||
"patch.36": "升级 never 不拒",
|
||||
"patch.37": "文件系统升级 schema 放行",
|
||||
"patch.38": "子代理 scope lock 中性化",
|
||||
"patch.39": "persona text→prefix(0.1.2 预设)",
|
||||
"patch.40": "会话 v0 plugin summary(mnemon)",
|
||||
"patch.41": "complete 预设仍保留注入",
|
||||
"patch.20": "dsh-web-fetch-http:base 写入依赖",
|
||||
"patch.21": "bash 超时 60s → 10min",
|
||||
"patch.22": "read 上限放宽",
|
||||
"patch.23": "子代理深度 3 → 10",
|
||||
"patch.24": "preset fetch 启用",
|
||||
"patch.25": "去掉官方默认身份(功能提示词不动)",
|
||||
"patch.26": "minimal:去掉默认身份并打开 inject",
|
||||
"patch.27": "dsh-liangshen(梁神):去掉默认身份(可选)",
|
||||
"patch.28": "dsh-liangshen(梁神):phase-1 保留注入段",
|
||||
"patch.29": "dsh-tool-web:外部 untrusted 拦截→可执行",
|
||||
"patch.30": "dsh-hooks-claude-code:deny→allow",
|
||||
"patch.31": "dsh-hooks-codex:deny→allow",
|
||||
"patch.32": "Web 表面身份中性化",
|
||||
"patch.33": "Shell 拒绝提示 → 可执行",
|
||||
"patch.34": "沙箱提示中性化",
|
||||
"patch.35": "升级 never 不拒",
|
||||
"patch.36": "文件系统升级 schema 放行",
|
||||
"patch.37": "子代理 scope lock 中性化",
|
||||
"patch.38": "persona text→prefix(0.1.2 预设)",
|
||||
"patch.39": "会话 v0 plugin summary(mnemon)",
|
||||
"patch.40": "complete 预设仍保留注入",
|
||||
"rewind.label": "回退",
|
||||
"rewind.aria": "回退",
|
||||
"rewind.busy": "回退中…",
|
||||
@@ -509,28 +508,27 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
|
||||
"patch.17": "Observation policy allow R/W",
|
||||
"patch.18": "Repeat-call guard off",
|
||||
"patch.19": "Tool-result pruner off",
|
||||
"patch.20": "dsh-web-fetch-http: enable fetch + provider",
|
||||
"patch.21": "dsh-web-fetch-http: pin base dependency",
|
||||
"patch.22": "bash timeout 60s → 10min",
|
||||
"patch.23": "read cap raised",
|
||||
"patch.24": "subagent depth 3 → 10",
|
||||
"patch.25": "preset fetch on",
|
||||
"patch.26": "Strip official default identity (keep feature prompts)",
|
||||
"patch.27": "minimal: strip identity, open inject",
|
||||
"patch.28": "dsh-liangshen: strip default identity (optional)",
|
||||
"patch.29": "dsh-liangshen: keep inject in phase-1",
|
||||
"patch.30": "dsh-tool-web: untrusted framing → usable data",
|
||||
"patch.31": "dsh-hooks-claude-code: deny→allow",
|
||||
"patch.32": "dsh-hooks-codex: deny→allow",
|
||||
"patch.33": "Web surface identity neutral",
|
||||
"patch.34": "Shell denial prompt → executable",
|
||||
"patch.35": "Sandbox hint neutralized",
|
||||
"patch.36": "Escalation never-reject",
|
||||
"patch.37": "FS escalation schema opened",
|
||||
"patch.38": "Subagent scope lock neutralized",
|
||||
"patch.39": "persona text→prefix (0.1.2 presets)",
|
||||
"patch.40": "session v0 plugin summary (mnemon)",
|
||||
"patch.41": "Keep inject when a complete prompt is set",
|
||||
"patch.20": "dsh-web-fetch-http: pin base dependency",
|
||||
"patch.21": "bash timeout 60s → 10min",
|
||||
"patch.22": "read cap raised",
|
||||
"patch.23": "subagent depth 3 → 10",
|
||||
"patch.24": "preset fetch on",
|
||||
"patch.25": "Strip official default identity (keep feature prompts)",
|
||||
"patch.26": "minimal: strip identity, open inject",
|
||||
"patch.27": "dsh-liangshen: strip default identity (optional)",
|
||||
"patch.28": "dsh-liangshen: keep inject in phase-1",
|
||||
"patch.29": "dsh-tool-web: untrusted framing → usable data",
|
||||
"patch.30": "dsh-hooks-claude-code: deny→allow",
|
||||
"patch.31": "dsh-hooks-codex: deny→allow",
|
||||
"patch.32": "Web surface identity neutral",
|
||||
"patch.33": "Shell denial prompt → executable",
|
||||
"patch.34": "Sandbox hint neutralized",
|
||||
"patch.35": "Escalation never-reject",
|
||||
"patch.36": "FS escalation schema opened",
|
||||
"patch.37": "Subagent scope lock neutralized",
|
||||
"patch.38": "persona text→prefix (0.1.2 presets)",
|
||||
"patch.39": "session v0 plugin summary (mnemon)",
|
||||
"patch.40": "Keep inject when a complete prompt is set",
|
||||
"rewind.label": "Undo",
|
||||
"rewind.aria": "Undo",
|
||||
"rewind.busy": "Undoing…",
|
||||
@@ -2131,7 +2129,7 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
|
||||
.dshp-rewind:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.12));color:var(--dsw-alias-label-primary,currentColor)}
|
||||
.dshp-rewind:disabled{opacity:.4;cursor:default}
|
||||
.dshp-rewind svg{display:block}
|
||||
.dshp-rewind-menu{position:absolute;right:0;bottom:calc(100% + 6px);z-index:100;box-sizing:border-box;min-width:196px;padding:4px;border:0;border-radius:12px;background:var(--dsw-specific-menu,#fff);color:var(--dsw-alias-label-primary,#1a1a1a);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent,0 8px 24px rgba(0,0,0,.16))}
|
||||
.dshp-rewind-menu{position:absolute;right:0;bottom:calc(100% + 6px);z-index:1200;box-sizing:border-box;min-width:196px;padding:4px;border:0;border-radius:12px;background:var(--dsw-specific-menu,#fff);color:var(--dsw-alias-label-primary,#1a1a1a);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent,0 8px 24px rgba(0,0,0,.16))}
|
||||
body[data-ds-dark-theme] .dshp-rewind-menu{background:var(--dsw-specific-menu,#32312d);color:var(--dsw-alias-label-primary,#e6e2db);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1,#3f3d38);box-shadow:var(--dsw-elevation-prominent,0 10px 28px rgba(0,0,0,.45))}
|
||||
.dshp-rewind-item{display:flex;flex-direction:column;gap:2px;width:100%;padding:8px 10px;border:0;border-radius:8px;background:transparent;color:inherit;text-align:left;cursor:pointer;font:12px/1.3 var(--ds-font-sans,system-ui,sans-serif)}
|
||||
.dshp-rewind-item:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.12))}
|
||||
@@ -2146,11 +2144,13 @@ body[data-ds-dark-theme] .dshp-rewind-item span{color:var(--dsw-alias-label-tert
|
||||
`;
|
||||
const DRAFT_KEY = "dshp-rewind-draft:";
|
||||
const ARM_KEY = "dshp-rewind-arm:";
|
||||
const FILL_DELAYS = [0, 50, 180];
|
||||
const FILL_DELAYS = [0, 50, 180, 400, 800];
|
||||
const ARM_TTL_MS = 45 * 1000;
|
||||
let rewindSeenAt = 0;
|
||||
let rewindSessions = null;
|
||||
let rewindHost = null;
|
||||
let rewindWorkspace = null;
|
||||
let rewindConversation = null;
|
||||
let pendingComposer = { sessionId: "", text: "", at: 0 };
|
||||
let armedFill = { sessionId: "", text: "", at: 0 };
|
||||
|
||||
@@ -2165,7 +2165,29 @@ body[data-ds-dark-theme] .dshp-rewind-item span{color:var(--dsw-alias-label-tert
|
||||
}
|
||||
|
||||
function currentSessionId(sessions) {
|
||||
try { return sessions?.list?.getSnapshot?.()?.current || ""; } catch { return ""; }
|
||||
try {
|
||||
const selected = rewindWorkspace?.selection?.getSnapshot?.()?.sessionId;
|
||||
if (typeof selected === "string" && selected) return selected;
|
||||
} catch { /* ignore */ }
|
||||
try {
|
||||
const snap = sessions?.list?.getSnapshot?.();
|
||||
if (typeof snap?.current === "string" && snap.current) return snap.current;
|
||||
} catch { /* ignore */ }
|
||||
return "";
|
||||
}
|
||||
|
||||
function sessionKnown(sessions, sessionId) {
|
||||
try {
|
||||
const snap = sessions?.list?.getSnapshot?.();
|
||||
if (!snap || !sessionId) return false;
|
||||
if (snap.byId && Object.prototype.hasOwnProperty.call(snap.byId, sessionId)) return true;
|
||||
if (Array.isArray(snap.ids) && snap.ids.includes(sessionId)) return true;
|
||||
} catch { /* ignore */ }
|
||||
return false;
|
||||
}
|
||||
|
||||
function waitMs(ms) {
|
||||
return new Promise((resolve) => window.setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
function isPluginDraft(text) {
|
||||
@@ -2224,14 +2246,27 @@ body[data-ds-dark-theme] .dshp-rewind-item span{color:var(--dsw-alias-label-tert
|
||||
return text;
|
||||
}
|
||||
|
||||
function conversationFace() {
|
||||
if (rewindConversation) return rewindConversation;
|
||||
const host = rewindHost;
|
||||
if (host?.conversation) return host.conversation;
|
||||
if (typeof host?.get === "function") {
|
||||
try { return host.get("conversation"); } catch { return undefined; }
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function conversationInput(sessionId) {
|
||||
try {
|
||||
const host = rewindHost;
|
||||
const conversation = host?.conversation || (typeof host?.get === "function" ? host.get("conversation") : undefined);
|
||||
const sessions = host?.sessions || rewindSessions;
|
||||
const input = conversationFace()?.input;
|
||||
if (!input || !sessionId) return null;
|
||||
if (typeof input.shell === "function") {
|
||||
try { return input.shell(sessionId); } catch { /* session not retained yet */ }
|
||||
}
|
||||
const sessions = rewindHost?.sessions || rewindSessions;
|
||||
const actx = typeof sessions?.scope === "function" ? sessions.scope(sessionId) : undefined;
|
||||
if (conversation?.input?.for && actx) return conversation.input.for(actx);
|
||||
return conversation?.input || null;
|
||||
if (typeof input.for === "function" && actx) return input.for(actx);
|
||||
return null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
@@ -2333,14 +2368,36 @@ body[data-ds-dark-theme] .dshp-rewind-item span{color:var(--dsw-alias-label-tert
|
||||
}
|
||||
|
||||
async function openRewoundSession(sessions, sessionId) {
|
||||
if (!sessions || !sessionId) return;
|
||||
try { await sessions.refresh?.(); } catch { /* ignore */ }
|
||||
try { sessions.open(sessionId); } catch { /* ignore */ }
|
||||
await dropInheritedQueue(sessions, sessionId);
|
||||
window.setTimeout(() => {
|
||||
try { sessions.open(sessionId); } catch { /* ignore */ }
|
||||
dropInheritedQueue(sessions, sessionId);
|
||||
}, 250);
|
||||
if (!sessionId) return;
|
||||
const workspace = rewindWorkspace;
|
||||
let lastError = null;
|
||||
for (let attempt = 0; attempt < 25; attempt += 1) {
|
||||
if (sessions && typeof sessions.refresh === "function" && !sessionKnown(sessions, sessionId)) {
|
||||
try { await sessions.refresh(); } catch (error) { lastError = error; }
|
||||
}
|
||||
const known = sessionKnown(sessions, sessionId);
|
||||
if (known || typeof sessions?.open === "function") {
|
||||
try {
|
||||
if (workspace && typeof workspace.openSession === "function") {
|
||||
workspace.openSession(sessionId);
|
||||
} else if (typeof sessions?.open === "function") {
|
||||
sessions.open(sessionId);
|
||||
} else {
|
||||
throw new Error("无法打开回退后的会话");
|
||||
}
|
||||
const selected = workspace?.selection?.getSnapshot?.()?.sessionId;
|
||||
if (!workspace || selected === sessionId) {
|
||||
await dropInheritedQueue(sessions, sessionId);
|
||||
window.setTimeout(() => { dropInheritedQueue(sessions, sessionId); }, 250);
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
}
|
||||
}
|
||||
await waitMs(120);
|
||||
}
|
||||
throw new Error((lastError && lastError.message) || "回退后的会话没有打开");
|
||||
}
|
||||
|
||||
class RewindSafe extends Component {
|
||||
@@ -2566,7 +2623,12 @@ body[data-ds-dark-theme] .dshp-rewind-item span{color:var(--dsw-alias-label-tert
|
||||
}
|
||||
};
|
||||
|
||||
const label = busy ? rewindText(t, "rewind.busy", "回退中…") : rewindText(t, "rewind.label", "回退");
|
||||
const failLabel = notice
|
||||
? (notice.length > 18 ? notice.slice(0, 18) + "…" : notice)
|
||||
: "";
|
||||
const label = busy
|
||||
? rewindText(t, "rewind.busy", "回退中…")
|
||||
: (failLabel || rewindText(t, "rewind.label", "回退"));
|
||||
const title = notice || rewindText(t, "rewind.aria", "回退");
|
||||
return h("div", { className: "dshp-rewind-wrap", ref: wrapRef },
|
||||
h("style", null, REWIND_CSS),
|
||||
@@ -2634,6 +2696,8 @@ body[data-ds-dark-theme] .dshp-rewind-item span{color:var(--dsw-alias-label-tert
|
||||
function installRewindUi(ctx) {
|
||||
rewindHost = ctx;
|
||||
rewindSessions = ctx.sessions;
|
||||
rewindWorkspace = ctx.uiWorkspace || null;
|
||||
rewindConversation = ctx.conversation || null;
|
||||
ctx.slots.inject("conversation.input.right", () => ctx.slots.register({
|
||||
name: "conversation.input.right",
|
||||
id: "dsh-purge-rewind",
|
||||
@@ -2669,7 +2733,7 @@ body[data-ds-dark-theme] .dshp-rewind-item span{color:var(--dsw-alias-label-tert
|
||||
}, SettingsRoot));
|
||||
try {
|
||||
if (typeof ctx.inject === "function") {
|
||||
ctx.inject(["sessions"], (host) => installRewindUi(host));
|
||||
ctx.inject(["sessions", "uiWorkspace", "conversation"], (host) => installRewindUi(host));
|
||||
} else if (ctx.sessions) {
|
||||
installRewindUi(ctx);
|
||||
}
|
||||
|
||||
+380
-692
File diff suppressed because it is too large.
Load diff
+3
-2
@@ -268,8 +268,9 @@ export function rewritePromptAssembly(assembled, fallbackInject = "", options =
|
||||
|
||||
const injectText = collectInjectText(purge, opts.fallbackInject);
|
||||
// #29: 不要把上一条 system/message 全文钉回 sections。
|
||||
// 「历史里已有完整注入就不再折一份」由 foldInjectIntoPersona 的 includes 幂等满足。
|
||||
const folded = foldInjectIntoPersona(rest, injectText);
|
||||
// 默认留下 dsh-purge 段。0.1.5 在 waterfall 之后若 complete:true,只认这段把注入抄进最终提示词;
|
||||
// 提前折进 persona 再删掉本段,重启加载该逻辑后注入会丢。
|
||||
const folded = opts.dropPurgeAfterFold ? foldInjectIntoPersona(rest, injectText) : rest;
|
||||
const extras = opts.dropPurgeAfterFold
|
||||
? purge.filter((section) => section.name !== "dsh-purge")
|
||||
: purge;
|
||||
|
||||
+26
-8
@@ -219,23 +219,38 @@ function installMnemonMessageStrip(ctx, config = {}) {
|
||||
setTimeout(late, 1500);
|
||||
}
|
||||
|
||||
function rewriteLiveAssembly(config, assembled, context) {
|
||||
const enabled = config.enabled !== false;
|
||||
const inject = enabled ? readInjectFallback() : "";
|
||||
return rewritePromptAssembly(assembled, {
|
||||
fallbackInject: inject,
|
||||
dropMnemon: config.stripMnemon !== false,
|
||||
dropPurgeAfterFold: false,
|
||||
context,
|
||||
});
|
||||
}
|
||||
|
||||
function installIdentityOverride(ctx, config = {}) {
|
||||
if (typeof ctx.on !== "function") return;
|
||||
if (ctx.__dshPurgeAssembleHook) return;
|
||||
ctx.__dshPurgeAssembleHook = true;
|
||||
const hook = async (_assembly, context, next) => {
|
||||
const assembled = typeof next === "function" ? await next() : _assembly;
|
||||
const enabled = config.enabled !== false;
|
||||
const inject = enabled ? readInjectFallback() : "";
|
||||
return rewritePromptAssembly(assembled, {
|
||||
fallbackInject: inject,
|
||||
dropMnemon: config.stripMnemon !== false,
|
||||
dropPurgeAfterFold: true,
|
||||
context,
|
||||
});
|
||||
return rewriteLiveAssembly(config, assembled, context);
|
||||
};
|
||||
// 只挂一次。不改 contexts,不改 pre-step 白名单,梁神 phase-1 和其它插件的消息原样保留。
|
||||
ctx.on("system-prompt/assemble", hook, { global: true, prepend: true });
|
||||
// 0.1.5 起 complete:true 在 waterfall 之后用调用前的快照盖掉 sections。
|
||||
// 换宿主版本时文件补丁还没写上,或换插件版本时旧钩子把 dsh-purge 段删掉,注入都会丢。
|
||||
// 包住 assemble 的返回值,按 prompt-inject.md 再补回。
|
||||
const prompt = ctx.systemPrompt;
|
||||
if (!prompt || typeof prompt.assemble !== "function" || prompt.__dshPurgeAssembleWrapped) return;
|
||||
const orig = prompt.assemble;
|
||||
prompt.assemble = async function (...args) {
|
||||
const assembled = await orig.apply(this, args);
|
||||
return rewriteLiveAssembly(config, assembled, args[0]);
|
||||
};
|
||||
prompt.__dshPurgeAssembleWrapped = true;
|
||||
}
|
||||
|
||||
function shimNeedsPatch(state) {
|
||||
@@ -1110,6 +1125,9 @@ function installWebServer(ctx, cfg) {
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (typeof body?.content === "string") {
|
||||
await core.saveOverrideContent(state.dsh_home, body.content);
|
||||
}
|
||||
await core.backupAll(state.ai_base);
|
||||
const report = await core.applyPatches(state.ai_base);
|
||||
const override = await core.readOverrideForUi(state.dsh_home);
|
||||
|
||||
+3
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dsh-purge",
|
||||
"version": "1.1.14",
|
||||
"version": "1.1.16",
|
||||
"description": "DeepSeek Harness 网络安全红队工具:本机官方 Harness 受控评测与清洗,不同模型可换不同提示词;默认提示词面向国模「小码酱」。求 Star ⭐",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
@@ -29,6 +29,7 @@
|
||||
"scripts": {
|
||||
"embed-prompt": "node scripts/embed-default-prompt.mjs",
|
||||
"test:identity": "node scripts/test-identity-assembly.mjs",
|
||||
"test:yaml": "node scripts/test-yaml-comment.mjs",
|
||||
"test:update": "node scripts/test-update-guards.mjs",
|
||||
"test:rewind": "node scripts/test-rewind-plan.mjs"
|
||||
},
|
||||
@@ -77,5 +78,5 @@
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"dshTarget": "0.1.5-rc.2"
|
||||
"dshTarget": "0.1.7-rc.1"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
# 1.1.16
|
||||
|
||||
## 中文
|
||||
|
||||
- 对准 **dsh 0.1.7-rc.1**。工作区说明常量改名为 `AGENT_INSTRUCTIONS_INTRO`,句子没变,补丁跟着改。
|
||||
- 沙箱 `confine()` 已是 `async confine(argv, policy, signal)`,补丁按新函数写。直通行为与上一版相同。
|
||||
- 子代理深度改到 `dsh-subagent`,默认从 1 提到 10。深度检查还在。
|
||||
- 设置服务补回旧的 `register` / `get`。`dsh-mnemon`、`dsh-better-reasoning-effort` 这类还在调旧接口的插件可以继续用。官方 `describe` / `update` 不动。补丁只打一次,不会在启动时重复插入。
|
||||
- 删掉 0.1.7 里已经对不上的旧条文,包括单独给 `dsh-base` 补 `dsh-web-fetch-http` 依赖的那条。官方包已经自带。
|
||||
- Web 四个内置预设(standard、ptc、cordis、minimal)只清空身份句。工作目录、工具列表、`ptc` 模式,以及 minimal 的 `complete: true` 和 `includeRuntimeContext: false` 不动。
|
||||
- `complete: true` 时,`prompt-inject.md` 仍接在这段前面。换宿主版本或旧钩子删段之后,注入不会丢。点「应用」之后仍要再点「重启」,新开一轮对话才进当前会话。
|
||||
- `dsh-compaction-instant` 网页端从已删除的 `settingsScope` 改到 `configForms`,页面不再停在 Failed to load plugins。
|
||||
- 回退在 0.1.7 上会建出新会话,但界面仍停在旧对话,看起来像没反应。0.1.7 已没有 `sessions.open`。现在改用 `uiWorkspace.openSession` 切到新会话,并把上一句填回输入框。失败原因显示在按钮上。
|
||||
- README 的赞赏区换成非盈利声明:严禁商业售卖、付费倒卖或黑灰产牟利,仅供技术参考。
|
||||
|
||||
## English
|
||||
|
||||
- Aligned with **dsh 0.1.7-rc.1**. The workspace-instruction constant is now `AGENT_INSTRUCTIONS_INTRO`. The sentence is unchanged, and the patch follows it.
|
||||
- Sandbox `confine()` is now `async confine(argv, policy, signal)`, and the patch matches that function. Passthrough behavior is the same as the previous release.
|
||||
- Subagent depth lives on `dsh-subagent`. The default moves from 1 to 10. The depth check remains.
|
||||
- The settings service again exposes the old `register` / `get` methods, so plugins such as `dsh-mnemon` and `dsh-better-reasoning-effort` keep working. Official `describe` / `update` stay. The patch applies once and does not insert itself again on startup.
|
||||
- Patch text that no longer exists in 0.1.7 is removed, including the extra `dsh-web-fetch-http` dependency on `dsh-base`. The official package already depends on it.
|
||||
- The four built-in Web presets (standard, ptc, cordis, minimal) lose only the identity sentence. The working-directory suffix, tool lists, `ptc` mode, and minimal's `complete: true` plus `includeRuntimeContext: false` stay.
|
||||
- When `complete: true`, `prompt-inject.md` is still prepended to that section. A host upgrade or an older hook that drops the section does not drop the inject. After Apply you still click Restart and start a new chat before it enters the session.
|
||||
- The `dsh-compaction-instant` web client uses `configForms` instead of the removed `settingsScope`, so the page no longer stops on Failed to load plugins.
|
||||
- Rewind on 0.1.7 created the new session and left the UI on the old chat, so the click looked dead. 0.1.7 has no `sessions.open`. The button now opens the new session with `uiWorkspace.openSession` and puts the previous user line back in the composer. A failure shows on the button.
|
||||
- The README sponsor block is now a non-profit notice: no commercial resale and no gray-market profit; technical reference only.
|
||||
@@ -102,4 +102,17 @@ const again = rewritePromptAssembly(
|
||||
);
|
||||
assert.equal((render(again).match(/Little Code Sauce/g) || []).length, 1);
|
||||
|
||||
const kept = rewritePromptAssembly(
|
||||
{
|
||||
sections: [
|
||||
{ name: "deployment:persona-prefix", text: persona },
|
||||
],
|
||||
},
|
||||
{ fallbackInject: inject, dropPurgeAfterFold: false },
|
||||
);
|
||||
const purge = (kept.sections || []).filter((section) => section.name === "dsh-purge");
|
||||
assert.equal(purge.length, 1);
|
||||
assert.match(purge[0].text, /Little Code Sauce/);
|
||||
assert.equal((render(kept).match(/Little Code Sauce/g) || []).length, 1);
|
||||
|
||||
console.log("ok: #29 pin snowball is gone");
|
||||
@@ -0,0 +1,84 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { ALL_PATCHES, applyReplacementsToText, yamlJsCommentsToHash } from "../lib/core.js";
|
||||
|
||||
const bash = ALL_PATCHES.find((patch) => patch.id === 21);
|
||||
assert.equal(bash.name, "BASH_TIMEOUT_RAISED");
|
||||
assert.equal(bash.replacements[0].replace.includes("//"), false);
|
||||
assert.match(bash.markers[0], /timeoutMs: 600000 # \[dsh-purge\]/);
|
||||
|
||||
const head =
|
||||
"- id: bash-sandbox\n" +
|
||||
" name: '@deepseek-ai/dsh-bash-sandbox'\n" +
|
||||
" config:\n";
|
||||
const indent = " ".repeat(8);
|
||||
|
||||
const fresh = applyReplacementsToText(
|
||||
`${head}${indent}timeoutMs: 60000\n`,
|
||||
bash,
|
||||
"cordis.patch.yml",
|
||||
);
|
||||
assert.equal(fresh.changed, true);
|
||||
assert.match(fresh.text, /timeoutMs: 600000 # \[dsh-purge\] bash timeout raised/);
|
||||
assert.equal(fresh.text.includes("//"), false);
|
||||
|
||||
const broken = applyReplacementsToText(
|
||||
`${head}${indent}timeoutMs: 600000 // [dsh-purge] bash timeout raised\n`,
|
||||
bash,
|
||||
"cordis.patch.yml",
|
||||
);
|
||||
assert.equal(broken.changed, true);
|
||||
assert.equal(broken.text, fresh.text);
|
||||
|
||||
const healed = applyReplacementsToText(fresh.text, bash, "cordis.patch.yml");
|
||||
assert.equal(healed.changed, false);
|
||||
assert.equal(healed.text, fresh.text);
|
||||
|
||||
const jsKept = applyReplacementsToText(
|
||||
'text: "You are an AI agent powered by DeepSeek Harness."\n',
|
||||
{
|
||||
replacements: [{
|
||||
pattern: 'text: "You are an AI agent powered by DeepSeek Harness."',
|
||||
replace: 'text: "" // [dsh-purge] identity stripped',
|
||||
}],
|
||||
},
|
||||
"lib/index.js",
|
||||
);
|
||||
assert.match(jsKept.text, /text: "" \/\/ \[dsh-purge\] identity stripped/);
|
||||
|
||||
const yamlFixed = applyReplacementsToText(
|
||||
'text: "You are an AI agent powered by DeepSeek Harness."\n',
|
||||
{
|
||||
replacements: [{
|
||||
pattern: 'text: "You are an AI agent powered by DeepSeek Harness."',
|
||||
replace: 'text: "" // [dsh-purge] identity stripped',
|
||||
}],
|
||||
},
|
||||
"agent.cordis.yml",
|
||||
);
|
||||
assert.match(yamlFixed.text, /text: "" # \[dsh-purge\] identity stripped/);
|
||||
assert.equal(yamlFixed.text.includes("//"), false);
|
||||
|
||||
assert.equal(
|
||||
yamlJsCommentsToHash("mode: !!js process.env.X ?? 'https://example.com' // keep"),
|
||||
"mode: !!js process.env.X ?? 'https://example.com' // keep",
|
||||
);
|
||||
assert.equal(yamlJsCommentsToHash("url: https://example.com"), "url: https://example.com");
|
||||
assert.equal(
|
||||
yamlJsCommentsToHash('note: "keep // inside"'),
|
||||
'note: "keep // inside"',
|
||||
);
|
||||
|
||||
const yamlPatches = ALL_PATCHES.filter((patch) => {
|
||||
const keys = Array.isArray(patch.file) ? patch.file : [patch.file];
|
||||
return keys.some((key) => /preset|web-app|headless|base$|agent-preset/.test(key));
|
||||
});
|
||||
for (const patch of yamlPatches) {
|
||||
const reps = patch.replacements || (patch.patterns || []).map((pattern) => ({ pattern, replace: patch.replace }));
|
||||
for (const rep of reps) {
|
||||
if (typeof rep.replace !== "string" || !rep.replace.includes("//")) continue;
|
||||
const safe = yamlJsCommentsToHash(rep.replace);
|
||||
assert.equal(safe.includes(" //"), false, `${patch.name} still writes a JS comment into YAML`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log("ok: yaml comments");
|
||||
Reference in new issue
Block a user