DeepSeek Harness plugin

dsh-prompt-optimize

DSH web 插件:输入框右侧 按钮,用 DSH 内置模型或外部 LLM 一键优化提示词,再次点击还原原文(market-prompt-optimize 的 DSH 同款移植)。

Jump to install

Source facts

Repository
mmyddd/dsh-prompt-optimize
Latest update
Aug 15, 2026
Category
Plugin Markets & Managers
GitHub stars
0
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and 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 review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/mmyddd/dsh-prompt-optimize
Plugin: dsh-prompt-optimize
Author: mmyddd

Check the source files

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

File explorer2 files
README.mdSource · read only

dsh-prompt-optimize

![npm version](https://www.npmjs.com/package/dsh-prompt-optimize) ![GitHub](https://github.com/mmyddd/dsh-prompt-optimize)

DSH(DeepSeek Harness)web 插件:在聊天输入框右侧工具行加一个 按钮, 用 LLM 一键优化当前草稿,再次点击还原原文(右键打开设置)。 这是 market-prompt-optimize(Codex 用户脚本)的 DSH 同款移植。

> 来源 / Source:https://raw.githubusercontent.com/BigPizzaV3/CodexPlusPlusScriptMarket/main/scripts/prompt-optimize.js

按钮与行为

  • ✨ 点击:把输入框全文交给 LLM 优化,优化结果直接写回输入框(inputActions.setDraft)。
  • ✨ 再次点击:还原优化前的原文。
  • ⟳ 优化中:按钮旋转;点击取消(忽略迟到的响应)。
  • 右键 ✨:打开设置面板(Esc / 点击遮罩 / 取消 关闭)。
  • 用户手动改动草稿后,按钮自动退出「已优化」状态(不会再误还原)。

模型来源(三种模式)

模式说明
内置(默认)走 DSH 自带 ctx.llm 服务,不需要额外 API Key。模型解析顺序:设置里的 Provider/Model 覆盖 → 当前会话正在用的模型 → 第一个已注册 provider 的默认模型
OpenAI 兼容直接请求 {baseUrl}/chat/completions(需 HTTPS,禁止本机/内网地址)
Anthropic直接请求 {baseUrl}/v1/messages(同上)

三种优化风格(简洁 / 结构化 / 编程)各带可编辑的 system prompt,可一键恢复默认。 外部模式的 API Key / Base URL 只存在浏览器 localStorage,随请求参数一次性传给 host 半(/prompt-optimize/api/optimize),host 侧不落盘。

结构(对应 hello-plugin 教程)

dsh-prompt-optimize/
├── package.json        # 清单:dsh.bundle.patch + dsh.client(bundle 型)
│                       #   exports 必须含 "./client"(客户端 bundle 路径,client-modules 依赖)
│                       #   与 "./package.json"(client-modules 用 require.resolve('<pkg>/package.json') 读元数据)
│                       #   exports 必须含 "./client"(客户端 bundle 路径,client-modules 依赖)
│                       #   与 "./package.json"(client-modules 用 require.resolve('<pkg>/package.json') 读元数据)
├── cordis.patch.yml    # bundle patch:要插入的 loader 行
├── dsh.plugin.json     # 插件注册表清单(client.main = lib/client.js)
├── lib/
│   ├── index.js        # host 半:/prompt-optimize/api/* JSON 路由(LLM 优化)
│   └── client.js       # client 半:✨ 按钮(conversation.input.right 槽位)
└── README.md
  • host 半:导出 name / inject(['webServer','llm']) / apply(ctx) 的 cordis 插件,

ctx.webServer.register({kind:'prefix', path:'/prompt-optimize/api'}) 挂一条 同源 JSON 路由(仅接受带同源 Origin 的 POST,CSRF 防护)。

  • client 半:window.__ModuleLoader__.load({id:'dsh-prompt-optimize', factory})(bundle id 必须等于 package name,client-modules 以包名为条目 id)(bundle id 必须等于 package name,client-modules 以包名为条目 id)

纯 JS bundle;在 conversation.input.right(list / session 作用域)注册 ✨ 按钮, 通过槽位 owner 快照(session / input.draft)与标准 kit(inputActions.setDraft)读写草稿。

挂载(三选一)

# 1. npm 已发布(推荐)
dsh plugin --profile web add dsh-prompt-optimize

# 2. GitHub 源
dsh plugin --profile web add "github:mmyddd/dsh-prompt-optimize#main"

# 3. 手动改 profile(~/.dsh/profiles/web/)
#    package.json dependencies 加 "dsh-prompt-optimize": "^0.1.0"
#    dsh.profile.bundles 追加 "dsh-prompt-optimize"
#    cordis.patch.yml 追加:
#    - insert:
#        - id: prompt-optimize
#          name: 'dsh-prompt-optimize'

挂载后 pnpm install(profile 目录),完全退出并重开 DSH web(bundle 型插件 需要重启加载客户端模块),硬刷新浏览器。

验证

dsh web --dump-config | grep prompt-optimize   # 组合里能看到插件行

重启后在任意会话的输入框右侧应看到 ✨ 按钮;点它即可优化,再点还原。 打开浏览器控制台可查看 window.__ModuleLoader__ 的加载错误(若有)。

开发循环

# 改 lib/index.js / lib/client.js 后(纯 JS,无构建步骤):
# host 半改动 → 重启 dsh web;client 半改动 → 硬刷新浏览器即可