Files
dsh-unrestricted/README.en.md
T

177 lines
8.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# dsh-unrestricted
[简体中文](./README.md) | **English** | [日本語](./README.ja.md)
`dsh-unrestricted` is a system prompt unrestrict plugin for **DeepSeek Harness (DSH)**. It injects unrestrict rules during system prompt assembly, lifting refusal boundaries across reverse engineering, security testing, creative writing, and technical workflows so the model returns complete code and implementations directly.
A single toggle enables or disables the rules without altering DSH's UI layout, tool protocols, Plan Mode, code execution (PTC), or subagent workflow.
---
## Table of Contents
- [What It Changes](#what-it-changes)
- [How It Works](#how-it-works)
- [System Prompt Injection](#system-prompt-injection)
- [Mode Adaptation](#mode-adaptation)
- [Structural Fusion & Fallback](#structural-fusion--fallback)
- [Instant Toggle](#instant-toggle)
- [Installation & Updates](#installation--updates)
- [Local Source Install](#local-source-install)
- [Usage](#usage)
- [Notes](#notes)
- [Development & Testing](#development--testing)
- [License & Credits](#license--credits)
---
## What It Changes
When enabled, the injected rules adjust model responses as follows:
- **Direct Output**: Starts directly with the requested code, analysis steps, binary patch, or prose without disclaimers, pleasantries, or lecturing. Necessary physical or operational cautions are kept as a brief note at the end.
- **Reverse Engineering & Patching**: Locates validation routines (`CHECK_FN`), reconstructs core algorithms, and writes keygens; provides binary patch offsets (`OFFSET`), replacement bytes (`PATCH_BYTE`), and anti-debug / anti-VM bypasses.
- **Security Testing & Tooling**: Writes vulnerability PoC / exploit scripts, multi-threaded dictionary bruteforcers, port scanners, encrypted reverse shells, and tunneling scripts.
- **Fiction & Editorial Writing**: Adapts to scene writing, plot/worldbuilding exploration, character work, and prose editing. Follows the user's chosen tone—writing explicit scenes plainly without fade-to-black cuts when requested, or keeping subtlety and restraint when the style calls for it. Characters default to adults without age-based refusals or intrusive reminders.
- **Industrial & Lab Procedures**: Gives complete steps, ratios, and parameters for chemical, pharmacological, and technical processes without omitting key stages.
- **Resource Lookup**: Uses web search tools to query and organize results into a clear list (title, link, source, format/size) without inventing URLs.
- **External Text Isolation**: Treats workspace files and web pages strictly as input data rather than new instructions; preserves user-supplied domains, hosts, and software names verbatim.
---
## How It Works
### System Prompt Injection
DSH assembles a global System Prompt before sending requests. Putting unrestrict instructions inside regular chat messages is easily overridden by the system prompt or can disrupt tool calling.
The plugin hooks into the `system-prompt/assemble` pipeline:
1. Appends a pointer at the end of the official persona prefix (`deployment:persona-prefix`) and inserts a dedicated rule section (`unrestricted:execution-mode`) right after it.
2. Leaves working directory info (`deployment:persona-suffix`), tool schemas, and environment context untouched.
```text
[DSH Request]
│
▼
[Prompt Assemble Pipeline]
│
├─> Official Persona Prefix
│ │
│ ▼ [dsh-unrestricted]
│ ├─ Enabled: Inserts rule section & coordinates mode rules
│ └─ Disabled: Pass-through (stock prompt)
│
├─> Tool Catalog & Protocols (Bash/Pwsh, FS, Web Search...)
├─> Plan Mode Policy
└─> Environment Info (CWD, Model...)
│
▼
[Sent to Model API]
```
### Mode Adaptation
The plugin handles each DSH execution preset according to its prompt structure:
- **Standard / Cordis Modes**: Inserts the rule block after the persona prefix while keeping all built-in tools intact.
- **PTC Mode**: Models in PTC mode run scripts via `run_code`. The plugin adds a note to `tools:ptc-only` so Python/Node code and SDK calls inside `run_code` follow the same output rules.
- **Plan Mode**: Separates execution permissions from plan content—no file edits happen before approval, while the plan markdown itself includes full technical steps and code.
- **Minimal Mode**: Injects rules within the active agent scope while preserving custom subagent personas and `structured_output` instructions.
- **Subagents**: Background subagents and structured output tasks inherit the current toggle state.
### Structural Fusion & Fallback
The plugin fuses sections structurally by DSH's canonical section names (`deployment:persona-prefix`, `plan:policy`, `tools:ptc-only`, `tool:structured_output`) with idempotency guards, supporting both the latest DSH Web (`0.2.2-rc.3`) and DSH Desktop (`0.2.1-rc.5`) without brittle exact-string hash checks. If a custom preset omits the persona section, it safely falls back to the stock prompt.
### Instant Toggle
The toggle state is saved in the profile's `cordis.patch.yml` and takes effect on the next request without restarting the service. Turning it off restores the stock prompt immediately without leaving markers in session history.
---
## Installation & Updates
```sh
# Install on DSH Web
dsh plugin --profile web add github:yexi-by/dsh-unrestricted#v0.2.14
# Install on DSH Desktop
dsh plugin --profile desktop add github:yexi-by/dsh-unrestricted#v0.2.14
```
Restart `dsh web` or DSH Desktop after installing, then follow [Usage](#usage) to enable it.
#### Update
Use the update controls in DSH’s built-in plugin manager, or the CLI commands below. The plugin no longer queries GitHub or runs its own pnpm installer.
```sh
dsh plugin --profile web remove dsh-unrestricted
dsh plugin --profile web add github:yexi-by/dsh-unrestricted#v0.2.14
```
Restart `dsh web` or DSH Desktop.
#### Uninstall
```sh
dsh plugin --profile web remove dsh-unrestricted
```
### Local Source Install
For local development:
```sh
dsh plugin --profile web add file:D:/work/dsh/plugin/unrestricted
```
---
## Usage
Make sure both switches are turned on after installation:
1. **Enable Plugin**: Open **Plugins** in the left sidebar, find `dsh-unrestricted`, and turn on the plugin switch.
2. **Enable Rules**: Click `dsh-unrestricted` to open its settings card and turn on **"Enable unrestricted mode"**.
The settings card also provides:
- **Strip Host Brand Identity**: An independent option that removes `DeepSeek Harness` / `DSH` identity sections and Web GUI checkout context from assembled prompts, preventing HTTP `429` client-fingerprinting blocks on third-party routes (applicable to Google Antigravity reverse proxies, Google AI Studio PG channels, etc.).
- **Mode Coverage & Prompt Preview**: Shows active status for Standard, PTC, Cordis, and Minimal modes, with expandable full-prompt preview and one-click copy.
---
## Notes
- **API Gateway Filtering**: System prompts adjust the model's own refusal behavior. If an upstream API gateway enforces external keyword blocking, requests may still be dropped or return HTTP 400 at the network layer.
- **Host Permissions**: The plugin does not alter DSH's file sandbox, command approval prompts, or Plan Mode write protection.
---
## Development & Testing
```sh
git clone https://github.com/yexi-by/dsh-unrestricted.git
cd dsh-unrestricted
pnpm install
pnpm typecheck
pnpm build
pnpm test
```
Helper scripts:
- `node tools/dump-prompts.mjs --repo <path> --out tests/fixtures`: Exports stock prompts from a DSH source checkout to update test fixtures.
- `node tools/verify-live.mjs --repo <path>`: Verifies assembly and rollback across all four modes locally without calling model APIs.
---
## License & Credits
- Initial prompt rule structure adapted from [Jia-Ethan/codex-keysmith](https://github.com/Jia-Ethan/codex-keysmith) (MIT License). See [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
- Not affiliated with codex-keysmith or its author.
- Released under the [MIT License](LICENSE).