DSH 输入框轻量助手:空输入按 ↑ 召回上一条发送过的消息,✨ 用当前会话模型把草稿改写成结构化提示词,📋 面板按光标插入常用模板——不发送,也不覆盖已写内容。
安装
# Release 预构建包
dsh plugin --profile web add -w "https://github.com/16bh/dsh-prompt-history-lite/releases/latest/download/dsh-prompt-history-lite.tgz"
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:16bh/dsh-prompt-history-lite
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
A deliberately small prompt helper for the DeepSeek Harness composer: recall your last message, rewrite a draft into a structured prompt, drop in a reusable template — three everyday things and nothing else.

The community plugin dsh-prompt-history does much more than this, and it keeps a lot of machinery resident in the composer, which shows up as typing lag. This plugin re-implements the three parts that get used every day and drops the rest: no clipboard history, no inline autocomplete, no ghost text, no feedback panel.
What it does
1. ↑ on an empty composer recalls your last message
Typing nothing, press ↑ and the most recent message you sent in this session appears in the composer. Press ↑ again to walk back through older messages, ↓ to walk forward, and ↓ past the newest one restores the draft you started with. Esc leaves browsing at any time. Nothing is ever sent automatically.
The history is read from the session on the host the first time you press ↑, then kept for that browsing pass only — it is dropped as soon as you edit the draft or send.
2. ✨ rewrites the draft into a structured prompt
The ✨ button in the composer action row sends the current draft to the session's own model and shows the result next to the original:

- The rewrite targets role and goal, context and constraints, executable steps, output format, acceptance criteria, and edge cases — and only the sections the draft actually needs, aiming for roughly 1–3× the original length instead of padding every heading.
- You get apply, copy, retry and close. Applying replaces the draft and offers one undo; nothing is written into the composer until you say so, and a result that arrives after you have kept typing is discarded rather than overwriting your text.
- The call is streamed, so text appears as it is generated, and it is cancelled when you close the panel.
- The draft is sent inside
<draft>…</draft>and treated as data, not as instructions.
3. 📋 reusable prompt templates
The 📋 button opens a panel of templates. Clicking a row inserts its body at the caret, without sending and without replacing what you have already written.

Five starting templates ship built in — code review, explain code, write tests, find edge cases, refactor suggestions — and you can add, edit and delete your own. Deleting offers an undo. Drag a row by the grip on its left to reorder the list; the order is saved to the file.
The templates live in ~/.dsh/prompt-history-lite/templates.json, a plain JSON array on the host, and that file is the only source of truth. The prompt_templates agent tool reads and writes the same file, so you can also ask the model to add, rewrite or prune templates for you, and the panel shows the change the next time you open it. The five starting templates are served only while the file does not exist; once anything has been saved — including an empty list — the file wins and deleted templates stay deleted. Templates from the old localStorage store are migrated into the file the first time the panel opens, and the old key is removed once the write succeeds.
The panel follows the host theme, light or dark:

Settings
Settings → Prompt history lite has two switches, both on by default: prompt enhancement and prompt templates. ↑ recall has no switch; it is the reason the plugin exists.
Install
dsh plugin --profile <your profile> add github:16bh/dsh-prompt-history-lite
From a local checkout, point the profile at the directory with link::
git clone https://github.com/16bh/dsh-prompt-history-lite.git
dsh plugin --profile <your profile> add link:$PWD/dsh-prompt-history-lite
The browser half is picked up on page reload; the host half registers its four routes at startup, so restart DSH once after installing.
Implementation notes
- No build step. Plain ESM, no bundler, no dependencies.
index.jsis the host half,client.jsthe browser half, loaded through the host's module loader. - Four routes, all under
/api/prompt-history-lite/:history(the session's sent messages),enhance(one-shot),enhance/stream(NDJSON, one frame per line) andtemplates(GET/PUT the template store as a whole). Requests are admitted through the host connection service, the same check the host applies to its own API. - History is computed on demand. The host folds the session's events into a list of sent message bodies when asked, instead of watching the DOM or subscribing to every event on the client.
- One resident listener. A single captured
keydownondocument, removed on unmount, handles↑/↓/Escand only while the composer is empty. NoMutationObserver, no timers, no polling, noselectionchange/scroll/resizehandlers. - The model route follows the session. The enhancement runs on whatever provider, model and reasoning effort the current session resolved to, at the lowest reasoning effort the model offers — rewriting is generation, not deliberation.
- Panels are plain DOM. The client loader hands the plugin React, and React owns the two buttons in the action row; the panels and the toast are built with
document.createElementand mounted next todocument.body, which keeps them out of the composer's re-render path. - Colours come from host theme tokens (
--dsw-alias-*), so light and dark mode both follow the host without a hard-coded palette. - Templates have a single source of truth:
~/.dsh/prompt-history-lite/templates.json, at most 200 entries, 8000 characters per body. Writes go to a temp file and are renamed into place; the panel and theprompt_templatestool share one serialized read-modify-write chain, so they cannot overwrite each other.localStorageis only a fallback for hosts without the route, and the place the old templates are migrated from.
Development
node --check index.js
node --check client.js
node --test test/host.test.mjs
The tests cover the host-side helpers: event folding, history extraction, request admission, length limits and the NDJSON framing.
License
MIT. The idea for the plugin comes from dsh-prompt-history; no code is copied from it — this is a smaller implementation written from scratch.
中文说明
给 DeepSeek Harness 输入框用的轻量提示词工具,只保留三件每天都会用的事:召回上一条消息、把草稿改写成结构化提示词、插入常用模板。

社区插件 dsh-prompt-history 功能更全,但它在输入框旁边常驻了不少东西(全局事件、观察器、定时器),表现出来就是打字卡顿。这个插件只重写了最常用的三块,其余一概不做:没有剪贴板历史、没有行内补全、没有 ghost 文字、没有反馈面板。
功能
一、空输入时按 ↑ 召回上一条消息
输入框为空时按 ↑,本会话最近一条发过的消息出现在草稿里;继续 ↑ 往前翻,↓ 往回退,退过最新一条之后恢复你原本的草稿;Esc 随时退出浏览。整个过程不会发送任何东西。
历史是第一次按 ↑ 时从宿主侧现算一次,只在这一次浏览里复用;一旦你改动草稿或发送,缓存即失效。
二、✨ 把草稿改写成结构化提示词
点输入框动作行的 ✨,当前草稿会交给当前会话使用的模型改写,结果和原文并排显示:

- 改写覆盖角色与目标、上下文与约束、可执行步骤、输出格式、验收标准、边界情况,并且只写草稿真正需要的小节,目标长度约为原文 1–3 倍,不硬凑标题。
- 面板提供应用 / 复制 / 重试 / 关闭。应用会写入草稿并给一次撤销;在你点应用之前不会动草稿,改写结果回来时如果你已经继续打字,它会丢弃结果而不是覆盖你新写的内容。
- 调用是流式的,字出着就显示;关掉面板会中断在途请求。
- 草稿包在
<draft>…</draft>里发送,按数据处理,不按指令处理。
三、📋 常用提示词模板
点 📋 打开模板面板,点一行就把正文按光标位置插进草稿——不发送,也不覆盖你已经写的内容。

装好就有 5 条起步模板(代码审查 / 解释代码 / 写测试 / 找边界情况 / 重构建议),可以自己新增、编辑、删除,删除有撤销。鼠标移到行上,左边会出现拖动把手,按住拖动即可调整顺序,顺序会写进文件。
模板存在宿主上的 ~/.dsh/prompt-history-lite/templates.json(一个纯 JSON 数组),这份文件是唯一数据源。agent 工具 prompt_templates 读写的是同一个文件,所以也可以直接让模型帮你加、改、删模板,下次打开面板就能看到。只有文件还不存在时才给 5 条起步模板;一旦保存过(哪怕保存的是空列表)就以文件为准,删掉的模板不会自己长回来。老版本存在 localStorage 里的模板会在第一次打开面板时自动迁移到文件里,写成功后再删掉旧 key。
面板跟随宿主深浅色主题:

设置
设置页「提示词历史 Lite」有两个开关,默认都开:提示词增强、提示词模板。↑ 召回没有开关,它就是本插件存在的理由。
安装
dsh plugin --profile <你的 profile> add github:16bh/dsh-prompt-history-lite
本地目录用 link::
git clone https://github.com/16bh/dsh-prompt-history-lite.git
dsh plugin --profile <你的 profile> add link:$PWD/dsh-prompt-history-lite
前端半区刷新页面即生效;宿主半区在启动时注册四条路由,装完重启一次 DSH。
实现要点
- 无构建:纯 ESM,无打包器、无依赖。
index.js是宿主半区,client.js是浏览器半区,走宿主的模块加载器。 - 四条路由,都在
/api/prompt-history-lite/下:history(本会话发过的消息)、enhance(一次性)、enhance/stream(NDJSON,一行一帧)、templates(GET/PUT 整表读写模板库)。请求走宿主连接服务的准入校验。 - 历史按需计算:宿主在你按
↑时才折叠会话事件,客户端不监听 DOM、不订阅事件流。 - 只有一个常驻监听:
document捕获阶段的一个keydown,卸载时移除,只在草稿为空时接管↑/↓/Esc。没有MutationObserver、没有定时器、没有轮询、没有selectionchange/scroll/resize。 - 模型跟随会话:用当前会话解析到的 provider / model,并把推理强度降到该模型最省的一档——改写是生成,不是思考。
- 面板用原生 DOM:动作行的两个按钮是 React 组件,面板和 toast 用
document.createElement挂到document.body旁边,不进入输入框的重渲染链路。 - 配色全走宿主主题令牌(
--dsw-alias-*),深浅色都不写死颜色。 - 模板只有一个数据源:
~/.dsh/prompt-history-lite/templates.json,最多 200 条,单条正文上限 8000 字。写入先落临时文件再 rename;面板和prompt_templates工具共用同一条串行读改写链,不会互相覆盖。localStorage只作为没有该路由的老宿主的兜底,以及老数据的迁移来源。
开发
node --check index.js
node --check client.js
node --test test/host.test.mjs
测试覆盖宿主侧的纯函数:事件折叠、历史提取、请求准入、长度上限、NDJSON 分帧。
许可
MIT。插件思路来自 dsh-prompt-history,未复制其代码,本实现是重写的更小版本。
链接
同类插件
zhu1090093659/dsh-web#packages/dsh-task-board★ 10715
侧边栏多列任务看板:卡片交给真实 DSH 智能体会话执行,支持 cron 定时(Host 侧到点执行,关浏览器也生效)。
zhu1090093659/dsh-web#packages/dsh-web-all★ 10715
DSH Web UI 插件与皮肤合集:任务看板、git 图、右侧面板、远程移动端 UI、桌宠、实时 token 统计与皮肤中心。
ccch1mneyyy/dsh-TUI★ 8617
Claude Code 风格全屏终端 UI:像素鲸鱼顶栏、实时工作状态行、思考流式展开。
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 7532
右下角常驻的小鲸鱼挂件:余额、今日已用与每轮对话消耗(含峰谷价),余额预警与今日预算的泡泡内容都可编辑;泡泡点击序列模块化自定义,支持并列加权 A/B、随机台词与随机图片;内置 30+ 厂商模板(OpenAI / OpenRouter / Kimi / 硅基流动 / 方舟 / 智谱 / MiniMax 等),按模型查余额与订阅额度;另有任务结束音效、导入音频、自定义角色与资源管理。数据全在本机,无遥测。
omdsh-dev/DSH-better-sidebar★ 5410
侧边栏完整工作台:内置文件渲染编辑、终端、Git 与子代理,支持三方插件注册新 Tab。
omdsh-dev/dsh-genui★ 1099
助手回复内渲染交互式 UI 组件:布局、图表、表单、测验、mermaid、3D 场景与回传事件循环。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。