DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

904915452 /

dsh-keyboard-shortcuts

Verified

DeepSeek Harness 插件:可配置键盘快捷键(输入历史 + 审批/计划快捷键)

★ 0 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@f55e9a1f

@zhangqingyu/dsh-keyboard-shortcuts

DeepSeek Harness 插件:可配置的键盘快捷键管理器。

在 Harness 的设置 → 键盘快捷键里,自己给不同事件绑定快捷键,配置持久化(localStorage), 同时内置了输入历史(↑/↓)和审批/计划快捷键。

可配置的事件(默认值)

事件 默认快捷键 作用
上一条输入 ArrowUp 回填上一次提交的内容
下一条输入 ArrowDown 向后翻 / 回到正在编辑的草稿
允许权限升级 Mod+Enter 审批弹窗「允许一次」
拒绝权限升级 Escape 审批弹窗「拒绝」
批准计划 Mod+Enter 计划审批「确认执行」
计划转聊天(取消) Escape 计划审批「去聊天里说」

Mod = macOS 的 Cmd,或 Windows/Linux 的 Ctrl。组合键写法:Mod+Shift+P、Ctrl+Enter、 Alt+ArrowUp 等;点行尾按钮后按新快捷键即可录制,点「清除」可禁用该事件。

结构

dsh-keyboard-shortcuts/
├── cordis.patch.yml
├── lib/index.js          # host 半部(空插件)
└── lib/client.js         # browser 半部:设置 UI + keydown 绑定 + 动作

工作原理

lib/client.js(纯 client 插件):

  • 在 settings.section 注册「键盘快捷键」页,列出事件并录制绑定,写 localStorage。
  • 在 conversation.input.dock 注册一个隐形桥(InputBridge),通过 slot 标准 props 拿 useInput((s) => s) + inputActions + useSession:输入历史直接读会话里已落库的用户消息 (useSession 的 chat.order / chat.nodes)重建,回填走 inputActions.setDraft——不再用 「草稿变空即算发送」的启发式推断(那会把「手动清空草稿」也误当成一条历史)。
  • 在 document 挂一个捕获阶段 keydown,按当前绑定匹配事件并分发: 输入历史走 inputActions.setDraft;审批/计划直接点对应弹窗的按钮([data-approval-key] / [data-plan-review-key])。
  • 不拦截 复制/剪切/粘贴:composer 自己的 onCopy/onCut/onPaste 和消息上的「复制」按钮已经 负责剪贴板;全局捕获阶段的 fallback 会 preventDefault() 原生路径反而弄坏它。macOS 壳里的 Cmd+C/V/X/A 走原生 Edit 菜单修复(见 dsh-macos-app)。

安装

# 任选一个镜像仓库克隆
git clone https://gitee.com/zqy-904915452/dsh-keyboard-shortcuts.git
# git clone https://github.com/904915452/dsh-keyboard-shortcuts.git
cd dsh-keyboard-shortcuts
dsh plugin --profile web add "file:$(pwd)"

file: 后要写 clone 下来的绝对路径;如果你用的是自定义 profile,把 web 换成你的 profile 名。 也可以直接用仓库地址装:dsh plugin --profile web add git+https://gitee.com/zqy-904915452/dsh-keyboard-shortcuts.git (或 GitHub 镜像 git+https://github.com/904915452/dsh-keyboard-shortcuts.git)。

安装后重启 app 并刷新页面,进「设置」即可看到「键盘快捷键」页。

本插件取代之前的 dsh-input-history 和 dsh-approval-shortcuts(两者已合并进来,且修复了 useInput 缺少选择器导致方向键失效的 bug)。

边界

  • 审批/计划按钮依赖当前版本弹窗的 DOM 结构(拒绝/讨论在前、允许/确认在后);应用升级若改结构需同步调整。
  • 输入历史只在空闲态(phase === "plain")且光标位于首行(↑)/末行(↓)、且没有打开的 [role="listbox"](/ 候选菜单)时触发,避免抢占多行编辑与 /、@ 菜单的方向键。
  • 多个事件可共享同一快捷键(Mod+Enter 同时是「允许权限升级」和「批准计划」;Escape 同理): 匹配到第一个事件但没找到对应弹窗时,会继续尝试下一个,而不是直接放弃。
—/ 5

No ratings yet

Verified DSH bundle

Commit f55e9a1fa8f0

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout