Community plugin

hikarioyama / dsh-esc-stop

Esc-to-stop for DeepSeek Harness: press Escape to cancel the running turn, with a General-settings toggle

  • JavaScript
  • MIT
  • 32 stars
  • Sep 29, 2026

About this plugin

Written by the registry from verified metadata, not from the README.

dsh-esc-stop is a DSH plugin published from the dsh-esc-stop package in the hikarioyama/Smart-DSH repository.

  • Listing statusManifest verified
  • Manifest checkedNov 5, 2026
  • Packagedsh-esc-stop
  • Package pathdsh-esc-stop
  • Package version0.1.0
  • Source commit63d6d9c
  • Repository createdSep 6, 2026

Capabilities and topics

dsh-plugin
From the repository README

README

Everything below this line is the repository's own document, cached here. This site did not write or review it.

dsh-esc-stop

Press Escape while the agent is thinking and the running turn is cancelled — the same cancellation the composer's 停止生成 button performs. A settings row turns the gesture on and off; it is ON by default.

Self-contained DeepSeek Harness (DSH) bundle, dual-face like dsh-notify-push: the host half registers one settings namespace, the browser half installs the listener and the settings row.

Status: verified against DSH 0.1.2-rc.1 (unit suite + a browser regression check against a live DSH server).

What counts as "stop the inference"

decideEscapeStop() judges every keydown and refuses unless all of these hold, so nothing is cancelled that the user did not aim at:

GuardWhy
key === "Escape", no Ctrl/Meta/Alt/ShiftModifier chords belong to the browser or OS
not a key repeatHolding Escape must not fire repeatedly
not composing (IME)The input method owns the key
event.defaultPrevented === falseA handler that already consumed Escape wins
the event target is not a native input/textarea/selectThe queue-message editor closes itself on Escape
no [aria-modal="true"] element is openThe Settings panel owns Escape while it is open
no [role="listbox"]/[role="menu"] element is openThe command menu, a popupSelect, and pickers own Escape
the durable toggle is ONThe settings row
one viewed session exists and reports runningNothing to stop otherwise
not removed and not a subagent viewMirrors the composer's own stop affordance

The listener sits on document in the capture phase and defers its judgement by one microtask. Capture is earlier than the composer keymap on the editor root, so inside capture the key's fate is not yet decided; one microtask later a nearer handler has either consumed it (defaultPrevented) or closed its overlay, and both facts are readable exactly once. Reading them any earlier would let Escape close a menu and stop the turn.

The accepted path is the composer's own: the session-scoped conversation service (sessions.scope(id).get("conversation").cancel()), with session.cancel() as the fallback. Failures are logged and the session snapshot's promptError carries the user-visible part, exactly as for the button.

Toggle

Settings → General → Esc で推論を停止 (ON/OFF). The value is the host setting esc-stop.enabled in the user settings document ($DSH_HOME/settings.yaml), so it follows the account across devices and needs no file editing or restart. While the namespace is unavailable the row defaults to ON and its switch stays disabled.

Files

ComponentFileRole
Host halflib/index.jsRegisters the esc-stop settings namespace (one boolean, default true)
Client halflib/client.jsdecideEscapeStop + the document keydown listener, and the General-settings row
Compositioncordis.patch.ymlInserts the bundle into the profile
Unit teststests/*.test.mjsHost registration and the whole client decision/listener/row surface

Everything it needs beyond the built-in client modules (react/jsx-runtime, @deepseek-ai/dsh-client-store) is a service injected from an already-composed plugin: sessions, slots, settingsScope.

Install

# 0. Where to keep the bundle source — any persistent path works; this setup uses
#    ~/.dsh/profiles/web/bundles-src/. Adjust BUNDLE_SRC freely.
BUNDLE_SRC="$HOME/.dsh/profiles/web/bundles-src/dsh-esc-stop"
git clone https://github.com/hikarioyama/Smart-DSH.git /tmp/Smart-DSH
mkdir -p "$(dirname "$BUNDLE_SRC")"
cp -r /tmp/Smart-DSH/dsh-esc-stop "$BUNDLE_SRC"

# 1. Add the dependency to the profile. `-w` is required: the profile is a pnpm
#    workspace root, and without it pnpm 11 refuses with ERR_PNPM_ADDING_TO_ROOT.
cd ~/.dsh/profiles/web
dsh plugin --profile web add "$BUNDLE_SRC" -w

# 2. Register the bundle as a composition layer. `dsh plugin` only forwards to
#    pnpm, so this list is what makes the bundle's cordis.patch.yml apply at boot.
node - <<'NODE'
const fs = require("fs");
const path = process.env.HOME + "/.dsh/profiles/web/package.json";
const manifest = JSON.parse(fs.readFileSync(path, "utf8"));
const bundles = manifest.dsh.profile.bundles;
if (!bundles.includes("dsh-esc-stop")) bundles.push("dsh-esc-stop");
fs.writeFileSync(path, JSON.stringify(manifest, null, 2) + "\n");
NODE

# 3. Verify composition read-only (never touches a running server)
dsh --profile web --dump-config | grep dsh-esc-stop   # expect: "- id: dsh-esc-stop"

# 4. Restart so the profile boots the new bundle
systemctl --user restart dsh-web.service

Restarting dsh-web.service interrupts the session running that command. Run it from a terminal that is not hosting the agent you are talking to. Until that restart the running server keeps its boot-time composition: neither the settings row nor the listener exists yet, and __DSH_BOOT__ does not name dsh-esc-stop.

The bundle has no runtime dependency of its own (@deepseek-ai/schemastery is provided by the host composition), so no extra pnpm add is needed, unlike dsh-notify-push.

Testing

Unit suite (no DSH process, no network):

cd dsh-esc-stop && npm install && npm test
# expect: tests 14 / pass 14 / fail 0

Browser regression check against an already-running DSH server. It injects the shipped listener into a live page and drives real KeyboardEvents against stub sessions, so no real turn is cancelled and no DSH process is started or restarted:

PLAYWRIGHT_MODULE=/path/to/playwright \
DSH_LOGIN_URL_FILE=/path/to/private-login-url.txt \
node scripts/test-esc-stop.cjs

It verifies the composed provider bundles exist, all twelve in-page gestures (stop, idle, toggle off, repeat, modifiers, modal, list overlay, native input, consumed key, repeat press, disposal, named refusal reason) and that the whole shipped bundle parses and registers with the live __ModuleLoader__. The login URL file is private input and is never printed.

Notes and limitations

  • One document-level listener in the capture phase; no upstream file is patched. A DSH upgrade that changes the composer's Escape arbitration only changes what is pre-consumed or which overlay element wraps the open menu, and both are read from the event and the DOM rather than from any internal API.
  • Stop cancels the in-flight turn only; pending queued messages stay and resume in FIFO order, as with the button.
  • A turn is stopped only in the session currently on stage. Pressing Escape while viewing a different session (or a subagent) does nothing.
  • esc-stop.enabled lives in the user settings document, which is machine-local state and is never part of this repository.

Badge

Listed here? Link back with this badge — paste the snippet into your repository README.

Listed on DSH Plugin badge
[![Listed on DSH Plugin](https://dsh-plugin.com/badges/listed.svg)](https://dsh-plugin.com/plugins/hikarioyama/Smart-DSH/dsh-esc-stop)