DeepSeek Harness plugin

dsh-word-complete

Word auto-completion in the Web composer: prefix-matched suggestions sorted by closeness, arrow-key selection and Enter to confirm.

Jump to install

Source facts

Repository
tuogusa/dsh-word-complete
Latest update
Aug 20, 2026
Category
UI Enhancements
GitHub stars
0

Install

Start with a prompt that asks an agent to read the source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to read the page and repository first.

Do not install anything yet. Read this DeepSeek Harness plugin and explain what it does, which files, networks, or credentials it can access, and how to install and remove it.

Plugin page: https://deepseekplugins.org/plugins/tuogusa/dsh-word-complete
GitHub: https://github.com/tuogusa/dsh-word-complete
Plugin: dsh-word-complete
Author: tuogusa
Install command: dsh plugin --profile web add github:tuogusa/dsh-word-complete

Do not run the install command until I confirm.

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer3 files
README.mdSource · read only

dsh-word-complete

DeepSeek Harness Web 对话输入框的词自动补全插件(Notepad++ Word Completion 风格,host + client 一体包):输入时从当前会话出现过的词中弹出补全建议,键盘 ↑/↓ 选择、回车确认。

效果

  • 在输入框输入词前缀时(英文 ≥ 2 个字符、中文/日文/韩文 ≥ 1 个字符),光标上方弹出最多 8 条建议词;建议以当前输入内容开头(前缀匹配),并按接近程度升序排列:完全匹配(当前输入词本身)最前,其次附加字符更少(更接近),再词频更高。例如输入 ds 会联想 dshdsh_workspacedsh-word-complete,而不会出现 addscardswords 这类输入在后面的词;
  • 建议词来源:当前会话中用户与助手消息里出现过的词(英文/数字/下划线序列、中文、日文、韩文分词,过滤纯数字与超短词);
  • 键盘交互:↑/↓ 循环选择、回车确认插入、ESC 关闭;鼠标悬停高亮、点击确认;
  • 确认后光标自动移到插入词末尾;回车确认后按 Backspace 会立即重新弹出(编辑刚插入的词);空格键完全放行,不影响正常输入;
  • 弹出窗口跟随光标逐字移动,出现在"当前输入的字符上方";上方空间不足时自动翻转到光标下方。

行为细节

场景行为
词前紧邻 /\不弹出(可能是斜杠命令、文件路径或 URL)
建议相关性只出现以当前输入内容开头的词;adds/cards/words 这类输入在后面的词不显示
英文前缀不足 2 字符不弹出(避免干扰)
中文 1 字即弹出
输入法组合(composition)期间不弹出,组合结束恢复
确认/ESC 后窗口关闭,直到输入新的可打印字符或 Backspace/Delete 才重新激活
选中词与当前前缀完全相同(已输完整词)视为"确认当前词":直接关闭窗口,光标保持在词尾
词表为空(新会话)回退到本地持久化索引(历史会话累计词表),冷启动也有建议

架构与技术要点

  • host 端lib/index.js):监听会话事件增量统计词频(user/messageassistant/message),内存缓存 + 增量持久化到 $DSH_HOME/word-complete.json(最近 30 个会话),通过 webServer 提供 GET /api/word-complete/words?sessionId=
  • client 端lib/client.js,手写 bundle):注册到官方 slot conversation.input.overlay(slash 菜单同款弹层槽位),session scope 注入 useInput
  • 插入走官方事件actx.bail("slash/input-insert-text", { text, span })——带 draftRev CAS 校验与撤销支持,不 hack 任何内部状态;
  • 光标位置测量:用 Range API 在官方 auto-grow 镜像 [data-input-mirror] 的文本节点上定位 caret 偏移——镜像与 textarea 共享完全相同的排版规则(font-family DshChipCell、padding、pre-wrap)并随滚动容器一起移动,测量结果即真实视口坐标,无需复制样式、无需滚动修正;
  • 窗口定位createPortal 渲染到 document.body + position: fixed,脱离 slot 锚点与 transform 祖先的干扰;随输入/光标/滚动/窗口尺寸实时重测。

安装

dsh plugin --profile web add github:tuogusa/dsh-word-complete

兼容 Profile:web(DSH Web GUI)。安装后重启 DSH 并 Ctrl+Shift+R 强刷浏览器。

更新

# 方式一:CLI 更新(推荐)
dsh plugin --profile web update dsh-word-complete

# 方式二:重新从 GitHub 源安装/更新
dsh plugin --profile web add github:tuogusa/dsh-word-complete

> 说明:dsh plugin 是 pnpm 的前置转发器,update 会按当前依赖声明重新解析该包;通过 github:tuogusa/dsh-word-complete 安装时,会更新到仓库默认分支的最新提交。

验证

仓库自带离线验证脚本(33 项断言:分词、词频合并、持久化、bundle 形状、插入事件、前缀检测、前缀匹配排序):

node verify.mjs

结构

cordis.patch.yml     bundle patch(loader 行)
lib/index.js         host 端:词频统计 + 持久化 + REST API
lib/client.js        client 端:补全 UI + 键盘交互 + 光标定位
docs/DESIGN.md       设计说明(架构、测量与交互决策依据)
verify.mjs           离线验证脚本

License

MIT