dsh-quick-prompt
Manifest validAdds a composer button that rewrites the current draft into a precise prompt in place, in one click, with a revert action.
dsh-quick-prompt · 秒提
DSH 已经有 /promptify,流程是「敲指令 → 等模型回完 → 复制 → 粘回输入框」。
这个插件把整条链路压成一个动作:点一下按钮,当前草稿原地变成一条精确、可直接执行的提示词,不满意一键恢复原文。
- 快:一次点击,不打断输入,不用离开输入框
- 稳:改写失败一律不动草稿
- 可退:点「恢复原文」回到增强前,自己动手改过之后入口自动消失
交互
| 状态 | 界面 | 行为 |
|---|---|---|
| 空闲 | 星形图标 + 「增强」字样(hover 提示「增强提示词」) | 点击 → 取当前草稿送去改写 |
| 增强中 | 转圈 + 「增强中…」,按钮禁用 | 期间不重复提交,草稿不动 |
| 成功 | 草稿被替换,左侧出现「恢复原文」 | 用户一旦自己继续编辑,恢复入口自动消失 |
| 失败 | 左侧红字「增强失败」,hover 看具体原因 | 草稿原封不动 |
几个刻意的限制:
- 只改文本:不提交、不发消息、不写会话记录。
- 空输入、
/开头的斜杠命令、@开头的引用都不改写——改写会破坏命令与引用的语义,点了会告诉你原因。 - 传输层抖动自动重试一次;认证/参数类错误不重试(重试也没用,只会让你多等一倍)。
安装
方式一:插件管理
从 DSH 的插件市场/插件管理里安装 dsh-quick-prompt,它会自己写挂载行。
方式二:命令行
# 桌面端由 Electron 独占 profile,先退出桌面端再装
dsh plugin --profile <profile-name> add dsh-quick-prompt
装完确认两处都写了:package.json 的 dependencies,以及 dsh.profile.bundles 里的一项。
方式三:从源码挂载
git clone https://github.com/SouthernSibyl/dsh-quick-prompt.git
然后在 profile 的 node_modules 下建一个指向源码目录的链接(Windows 用 junction,macOS/Linux 用 symlink),
并把包名写进 package.json 的 dependencies 与 dsh.profile.bundles。
链接要删的时候,Windows 上用
(Get-Item $link).Delete(),别用rm -rf——那会删穿到源码目录里。
重启桌面端后生效。改 lib/client.js 同样要重启(客户端 bundle 在启动时加载)。
配置
全部可选项,写在 profile 的 cordis.patch.yml 里同名条目下:
- id: quick-prompt
config:
provider: deepseek-official # 不填 = 跟随 DSH 当前默认模型
model: deepseek-chat
maxTokens: 2400
timeoutMs: 60000
rulesPath: "" # 留空 = $DSH_HOME/skills/promptify/SKILL.md
extraInstruction: "" # 追加到系统提示词末尾
改写规则从哪来
按顺序取第一个可用的:
config.rulesPath指定的文件;$DSH_HOME/skills/promptify/SKILL.md(去掉 YAML frontmatter 后的正文);- 内置的精简规则(结构/语言/内容三条约束)。
每次点击现读,带 mtime 缓存——只改规则内容时立即生效,不用重启。
排查
桌面端跑着的时候:
curl --noproxy '*' http://127.0.0.1:<port>/api/quick-prompt/config
返回当前用的路由、规则来源、长度上限:
{
"ok": true,
"route": { "provider": "deepseek-official", "model": "deepseek-flash" },
"rules": { "source": ".../skills/promptify/SKILL.md", "builtin": false, "chars": 1742 }
}
| 现象 | 原因 |
|---|---|
rules.source 是 builtin | 没读到规则文件(路径不对或文件为空),用的内置规则 |
route 里有 error | 没有可用默认模型,也没配 provider/model |
| 点按钮提示「增强失败」 | 鼠标停在红字上看具体原因;transport failed 一类通常是网络到模型 API 不通 |
实现要点
- 槽位:
conversation.input.right(list,scope=session)。standardProps 里有useInput(InputState选择器)、inputActions(含setDraft(text))、sessionId。 - 读草稿:
InputState.draft就是输入框纯文本(projection.clipboardText)。 - 写草稿:
inputActions.setDraft(text),整份替换并把光标移到末尾。 - 触发方式:composer 里的鼠标 click 不可靠,走
pointerdown → pointerup(位移小于 6px 才算点击),click只处理键盘(event.detail === 0)。 - 一次辅助调用:
ctx.llm.prepareCall({ provider, model, maxTokens }, signal)→call.stream({ ...call.config, messages, system, signal }),只累加text-delta;finish.reason.kind为error/aborted一律当失败,不交付半截文本。 - 路由来源:
ctx.agentDefaultModel.currentSelection(),与界面上的默认模型同源。 - 安全:两条路由都过同源校验(绑定端口)+
application/json限制 + 请求体上限;webServer动态注入,headless 宿主没有它时整块路由自动跳过。
开发
node --test
42 条测试,零依赖、无需构建(Node 22+)。覆盖:规则解析与缓存、配置归一化、规则拼装、输出清理、 路由选择、流式装配与失败终态、错误 cause 摊平、重试策略、同源/JSON 校验、按钮注册契约, 以及用最小 hooks 运行时跑的状态渲染与点击链路。
已知边界
- 只改纯文本,不动附件、引用 chip、命令 chip;草稿里有
@文件引用时按纯文本处理,引用会变成普通文本。 - 一次独立调用,不继承会话上下文(本意如此:不需要把对话历史送去改写)。
- 输出被模型截断(
finish: max-tokens)时仍写回,界面不单独提示——调大maxTokens即可。 - 没有设置界面,可调项都在
cordis.patch.yml里。
License
MIT
Comments
Loading…
Similar plugins
A DSH composer control that reforges a rough draft into a precise prompt, with one-click revert.
★ 0
MIT
JavaScript
dsh plugin --profile web add dsh-prompt-reforgeby xindady
Adds a prompt enhancement button to the composer toolbar that rewrites the draft through a model call, keeps @file references verbatim, and offers one-click undo.
★ 0
MIT
JavaScript
Oct 17, 2026
dsh plugin --profile web add dsh-prompt-enhancerOptimize Prompt button under the composer: one click rewrites your draft into a clearer, more executable prompt, with a before-and-after dialog and one-click replacement.
★ 0
↓ 185/wk
dsh plugin --profile web add dsh-prompt-optimizerby LCQ-1024
Adds a prompt-enhancement button to the DSH composer that rewrites drafts into agent-ready prompts.
★ 3
↓ 1.3k/wk
MIT
JavaScript
Aug 18, 2026
dsh plugin --profile web add dsh-prompt-enhancerby Nihao7-L
One-click prompt rewriting in the DSH composer — keep going for up to 5 rounds, diff every change, and jump back to any version.
★ 0
MIT
JavaScript
Oct 20, 2026
dsh plugin --profile web add dsh-prompt-chainby wmengxiang
Adds an icon button to the composer that optimizes the current draft prompt through the active model.
★ 3
↓ 446/wk
MIT
JavaScript
Sep 11, 2026
dsh plugin --profile web add dsh-prompt-optimizer