DSH Custom Enhancements

August 27, 2026 ยท View on GitHub

๐Ÿ“– ไธญๆ–‡็‰ˆ

Adds three practical features to the DeepSeek Harness (DSH) Web GUI that are not yet provided officially: โ‘  Composer โ†‘/โ†“ key send history, โ‘ก Edit last message and regenerate (Codex-style), and โ‘ข Archived session recovery.

What this is / isn't: This is a set of compiled-artifact patches, not an official plugin, not a source fork. It uses diff/patch to directly modify DSH's installed npm package files (compiled JS in node_modules), adding three features that DSH doesn't have yet. Any npm reinstall / DSH upgrade will overwrite these patches โ€” re-apply after each upgrade.


โœจ Features

1. Composer Arrow-Up/Down History (terminal-like)

  • Press โ†‘ in the composer to recall the last sent message; keep pressing โ†‘ to go further back; โ†“ to go forward
  • History position auto-resets when editing input text
  • Compatible with Chinese IME (no accidental trigger during pinyin composition), multi-line text (trigger only at first/last line), and consecutive duplicate dedup

2. Edit Last Message and Regenerate (Codex-style)

  • Hover over the last user message to see an โœ๏ธ Edit button
  • Click to turn the message into an editable text box (pre-filled with original text)
  • After editing, click "Save & regenerate": the new text replaces the original, discards all AI replies / tool calls after it, and AI regenerates from the new content
  • Earlier messages are preserved as read-only; editing is blocked while AI is working (conflict prevention)
  • Click Cancel to restore original

How it works: Editing uses DSH session layer's surface replace (append-only log + shadow replacement) โ€” history is preserved, but the model and UI only see the replaced sequence.

3. Archived Session Recovery

  • DSH officially supports archiving sessions (hide from sidebar), but provides no UI to view or restore them โ€” archived sessions are "visible nowhere"
  • This patch adds an "Archived Sessions" section in Settings (below "Right Panel Workspace")
  • Lists all archived sessions with their titles
  • Click a session title to open it
  • Click "Restore" to unarchive โ€” the session reappears in the sidebar session list
  • Works by adding unarchiveSession API end-to-end: host workspace registry โ†’ apiproxy route + schema โ†’ client runtime + connection RPC โ†’ settings UI

โš ๏ธ Platform & Prerequisites

The install script is written in bash and depends on Unix command-line tools:

PlatformSupportedNotes
macOSโœ… NativeBuilt-in bash/patch (pgrep also built-in)
Linuxโœ… Nativepatch built-in; some minimal distros need sudo apt install patch
Windowsโœ… After Git for WindowsGit for Windows includes bash, diff, patch, and git. The only pgrep usage is in the restart command; Windows uses taskkill instead (see below). The install scripts now locate DSH via npm root -g first (cross-platform), then fall back to common global dirs including %APPDATA%\npm โ€” no NODE_PATH needed

Universal prerequisites (any platform):

  • Node.js (with npm) installed
  • @deepseek-ai/dsh installed globally via npm (currently targeting 0.1.1-rc.2; users on older rc.7 / rc.8 do NOT need to upgrade โ€” pass your version to the install script, see "Older DSH Versions" below); or built from source (see "Source Build (monorepo) Users" below)

No CLI tools needed: The easiest path is to send this repo link (https://github.com/cslht11/dsh-custom-patches) to your AI assistant and let it follow the "Quick Start" section to install and configure on your machine โ€” it will handle Windows taskkill differences automatically.


๐Ÿš€ Quick Start (all platforms)

Four steps total, HTTPS clone recommended (no SSH key needed). You can paste this whole block to an AI assistant:

# 1) Install matching DSH version (skip if already installed and correct version)
npm install -g @deepseek-ai/dsh@0.1.1-rc.2
dsh --version          # should output 0.1.1-rc.2

# 2) Clone this repo (HTTPS, works for everyone)
git clone https://github.com/cslht11/dsh-custom-patches.git
cd dsh-custom-patches

# 3) One-click install (-y skips interactive confirm; script auto-locates DSH, validates version, detects built-ins, backs up, and applies)
bash install-dsh-custom.sh -y

# 4) Restart DSH (macOS / Linux)
kill $(pgrep -f 'dsh web') 2>/dev/null && sleep 1; dsh web

Windows restart: replace step 4 with taskkill //F //IM node.exe (or kill the node process) then dsh web. pgrep is only used in the restart command. Source build (monorepo) users: replace step 3 with DSH_SOURCE=/path/to/deepseek-harness bash install-dsh-custom.sh -y, then rebuild/restart your dev server (see "Source Build (monorepo) Users" below).

Then hard-refresh the browser page (Cmd+Shift+R / Ctrl+Shift+R):

  • Press โ†‘ in the composer to recall history
  • Hover over the last user message to see the โœ๏ธ Edit button

You can also send this repo link https://github.com/cslht11/dsh-custom-patches directly to your AI assistant and let it follow the "Quick Start" steps to configure on your machine; all commands in this document are directly executable.


๐Ÿงฉ Older DSH Versions (0.1.0-rc.7 / 0.1.0-rc.8)

Still on an older DSH version? No upgrade needed โ€” just pass your version to the install script. The repo keeps patches for rc.7 / rc.8 / 0.1.1-rc.2 (version tracking in versions.md):

Your DSH VersionOne-click Command
0.1.1-rc.2 (latest)bash install-dsh-custom.sh -y (default)
0.1.0-rc.8bash install-dsh-custom.sh -y 0.1.0-rc.8
0.1.0-rc.7bash install-dsh-custom.sh -y 0.1.0-rc.7
0.1.0-rc.6 and earlierโŒ No standalone patches (repo started publishing at rc.7); please upgrade DSH first

The base script also supports: bash apply-dsh-patches.sh 0.1.0-rc.8.

Why cross-version works: Official changes mainly touch dsh-client-ui-conversation layout, so only that one patch needs version switching (.rc7 / .rc8 / .rc2 files are all kept under patches/); the other 4 patches (host-apiproxy / agent-loop / client-runtime / client-connection) are identical across rc.7 โ†’ rc.8 โ†’ rc.2 and apply universally.

Don't want to remember versions? Just run bash install-dsh-custom.sh -y; if your local version doesn't match the default target, the script will explicitly error and tell you which parameter to retry with โ€” it won't mis-patch.


๐Ÿ›  Step-by-Step Details

Step 1: Confirm DSH Version

npm install -g @deepseek-ai/dsh@0.1.1-rc.2   # install matching version
dsh --version                                 # confirm it's 0.1.1-rc.2

Step 2: Clone the Repo

HTTPS (recommended, works everywhere):

git clone https://github.com/cslht11/dsh-custom-patches.git
cd dsh-custom-patches

SSH (optional, requires GitHub SSH key configured):

git clone git@github.com:cslht11/dsh-custom-patches.git
cd dsh-custom-patches

Step 3: Run the Install Script

Recommended: the one-click script with version diagnosis and built-in detection:

bash install-dsh-custom.sh -y

The script will automatically:

  1. Locate DSH install dir (probes both system-level and user-level global paths)
  2. Read local version and query npm for latest, giving a version diagnosis
  3. Validate version (default expects 0.1.1-rc.2; older version users add version arg, e.g. bash install-dsh-custom.sh -y 0.1.0-rc.8; mismatch aborts with correct usage hint)
  4. Detect if official already has the feature โ€” if the target file already contains feature markers (e.g. official bundled them), automatically skip that patch
  5. For patches that need applying: backup each file (.bak) and apply
  6. Summary report + restart hint

Alternative: bash apply-dsh-patches.sh (same functionality, but no version diagnosis or built-in detection; both apply the same patch set). Older version users also add version arg: bash apply-dsh-patches.sh 0.1.0-rc.8.

Step 4: Restart DSH

kill $(pgrep -f 'dsh web') 2>/dev/null; sleep 1; dsh web

Step 5: Verify (confirm installation success)

After refreshing the page, check these observable signals โ€” all met means success:

  • Pressing โ†‘ in the composer recalls the previous message
  • Hovering over the last user message shows the โœ๏ธ Edit button
  • Clicking edit โ†’ changing content โ†’ "Save & regenerate" replaces and regenerates

Self-diagnosis via script: run bash install-dsh-custom.sh -y again; if it outputs "All features already present (built-in or applied). Nothing to do." then all features are in place.


๐Ÿงฉ Source Build (monorepo) Users

If you don't use npm install -g for DSH but instead cloned the source (e.g. official deepseek-harness pnpm monorepo, built with pnpm + tsdown, and serve packages directly), you can still apply these patches โ€” patches are fully portable, only target file paths differ, and the script supports this layout.

Step 1: Confirm Two Things

  • You have the DSH source repo root (a directory containing packages/ and pnpm-workspace.yaml), e.g. /path/to/deepseek-harness
  • Each plugin package has been built (produced lib/ artifacts; if only src/ exists, there's nothing to patch)

Step 2: Set DSH_SOURCE and Run the One-click Script

export DSH_SOURCE=/path/to/deepseek-harness          # point to source repo root
bash install-dsh-custom.sh -y

When the script detects DSH_SOURCE, it automatically switches to source layout:

  • Locates target files under <DSH_SOURCE>/packages/**/lib/, backs up, and applies
  • Skips npm version validation (source doesn't have 0.1.1-rc.2 version strings), but please ensure your source checkout matches rc.2-era code
  • After applying, rebuild/restart your DSH dev server (same as your usual restart flow), then hard-refresh the browser

Source Layout Target File Mapping

npm PackageSource Package DirPatch Target File (built)
@deepseek-ai/dsh-host-apiproxypackages/host/apiproxylib/index.js
@deepseek-ai/dsh-agent-looppackages/core/agent-looplib/index.js
@deepseek-ai/dsh-client-connectionpackages/client/connectionlib/client.js
@deepseek-ai/dsh-client-runtimepackages/client/runtimelib/client.js
@deepseek-ai/dsh-client-ui-conversationpackages/client/ui-conversationlib/client.js

In other words: a patch path like dsh-xxx/lib/file.js maps to <DSH_SOURCE>/packages/<corresponding-dir>/lib/file.js in source layout โ€” same content, different root. That's why source-build users can use the exact same patch set.

How to Restore (source layout)

for e in \
  host/apiproxy/lib/index.js \
  core/agent-loop/lib/index.js \
  client/connection/lib/client.js \
  client/runtime/lib/client.js \
  client/ui-conversation/lib/client.js; do
  cp "$DSH_SOURCE/packages/$e.bak" "$DSH_SOURCE/packages/$e"
done

For more source-layout details or how to re-adapt a broken patch, see ADAPTING.md.


โ†ฉ๏ธ How to Restore Original (uninstall patches)

The install script backs up each modified file as .bak. To restore, copy those backups back (path is dynamically obtained via npm root -g, works with any global install layout):

PLUGIN="$(npm root -g)/@deepseek-ai/dsh/node_modules/@deepseek-ai"
for e in \
  dsh-host-apiproxy/lib/index.js \
  dsh-agent-loop/lib/index.js \
  dsh-client-connection/lib/client.js \
  dsh-client-runtime/lib/client.js \
  dsh-client-ui-conversation/lib/client.js; do
  cp "$PLUGIN/$e.bak" "$PLUGIN/$e"
done

๐Ÿ”„ Keeping Up with Official Updates

Official upgrades overwrite these patches (because they modify node_modules compiled artifacts). Recommended workflow:

# 1) Check for new official version (auto-compares local/latest/targeted; can specify version: bash check-update.sh 0.1.0-rc.8)
bash check-update.sh

# 2) Upgrade official
npm install -g @deepseek-ai/dsh@<new-version>

# 3) Re-apply (includes built-in detection; succeeds directly if official didn't change much)
bash install-dsh-custom.sh -y
  • Did official already bundle our features? The one-click script auto-detects and skips built-in patches; you can also manually confirm using the grep method in versions.md.
  • Patches broke? Follow ADAPTING.md to re-adapt and append a new version row in versions.md.

โš ๏ธ If patch errors after upgrade, the new version changed the relevant code โ€” re-adapt per ADAPTING.md.


๐Ÿ“ฆ Project Structure

dsh-custom-patches/
โ”œโ”€โ”€ install-dsh-custom.sh   # One-click install (recommended)
โ”œโ”€โ”€ apply-dsh-patches.sh    # Basic install (supports older version args)
โ”œโ”€โ”€ check-update.sh         # Check if official has a new version
โ”œโ”€โ”€ versions.md             # Version tracking table
โ”œโ”€โ”€ ADAPTING.md             # How to adapt to new official versions
โ”œโ”€โ”€ patches/                # Patch files (organized by package)
โ””โ”€โ”€ LICENSE                 # MIT

๐Ÿ“„ License

MIT โ€” see LICENSE.