Back to home@142475

dsh-esc-stop

DeepSeek Harness web GUI plugin: press Esc to stop conversation generation (same as the stop button).

Stars
1
Language
JavaScript
Created
Aug 19, 2026
Updated
Aug 19, 2026

Introduction

dsh-esc-stop

DeepSeek Harness Web GUI 插件:连续按两次 Esc 停止当前对话的生成——效果与点击 GUI 停止按钮完全一致。

无额外 UI、无需配置、无 host 逻辑。浏览器端捕获 Escape 键,通过 GUI 停止按钮同一条 RPC(session.cancel,经共享的 connection 服务)取消当前回合。两次按键间隔需在 400ms 内,可避免误触。

功能

  • 在会话内任意位置连按两次 Esc(400ms 内)→ 停止正在运行的回合。
  • 与内置停止按钮等价:待处理的 inbox 消息保留,之后按 FIFO 恢复。
  • 按键重复安全(忽略 e.repeat),单次按住不会触发,必须按两次
  • 长按或单击 Esc 不会触发;两次按键间隔超过 400ms 则重新计时。

安装

将包加入 web profile 并注册 bundle:

# 在 profile 目录(如 ~/.dsh/profiles/web)下执行
dsh plugin --profile web add git+https://github.com/142475/dsh-esc-stop.git

然后在 profile 的 package.jsondsh.profile.bundles 数组中加入 "dsh-esc-stop"

{
  "dsh": {
    "profile": {
      "bundles": [
        "dsh-esc-stop"
      ]
    }
  }
}

重启 dsh web 即可生效,无需进一步配置。

工作原理

职责
lib/client.js浏览器端:在会话头部操作区注册隐藏项,安装 window keydown 监听,400ms 内连按两次 Escape 时调用 connection.api.sessions.cancel({ sessionId })
lib/index.jsNode 端:最小 cordis 行,保证 bundle patch 挂载;全部行为在客户端实现。

session.cancel RPC 与 GUI 停止按钮调用的是同一条,因此行为(包括 inbox 保留、子代理 agent-busy 语义)完全一致。

注意

  • 仅 web profile(dsh web);tui/headless profile 有自己的停止键。
  • 会话打开时监听生效;无会话的首屏(hero)无可停止内容。
  • 两次 Esc 间隔超过 400ms 则重新计时,单击不会触发。

License

MIT