DeepSeek Harness plugin

dsh-prompt-optimizer-rayhanlu

DSH web GUI chat-composer plugin: optimize the current prompt before sending (manual trigger + optional auto-optimize before send), with before/after comparison, provider settings compatible with

Jump to install

Source facts

Repository
rayhanlu0519-a11y/dsh-prompt-optimizer
Latest update
Aug 17, 2026
Category
Models & Providers
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/rayhanlu0519-a11y/dsh-prompt-optimizer
Plugin: dsh-prompt-optimizer-rayhanlu
Author: rayhanlu0519-a11y

Check the source files

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

File explorer3 files
README.mdSource · read only

dsh-prompt-optimizer

DSH(DeepSeek Harness)Web GUI 聊天输入框的「提示词优化」插件:在输入卡工具行、模型切换按钮左侧新增优化入口,支持手动优化当前输入草稿与「发送前自动优化」开关;优化结果经前后对比框确认/二次编辑/放弃后决定是否发送,失败自动回退发送原文,对话不中断。

English summary: a DSH web-GUI plugin that adds a prompt-optimizer entry to the composer tool row (directly left of the model switcher), with manual trigger, an optional auto-optimize-before-send switch, a before/after comparison dialog, and fail-safe fallback to the original text.

特性

  • 位置与形态:注册进官方 conversation.input.right 槽位——渲染在输入框底行工具条、模型切换按钮正左侧;配色随 shell 深浅主题(body[data-ds-dark-theme]),不侵入既有聊天布局。
  • 手动触发:点击「✦ 优化」优化当前输入框内容(草稿为空时禁用并提示)。
  • 发送前自动优化:「自动」开关(localStorage 持久化)开启后,以 document 捕获阶段拦截 Enter 键与发送按钮点击(先于 React 根处理器;判定不成立一律放行原生流程,绝不吞发送)。
  • 前后对比:原文只读 / 优化后可编辑双栏弹窗;采用并发送(写入草稿并提交)、仅填入输入框发送原文放弃;Esc/遮罩关闭。
  • 失败回退:优化失败/超时/模型垃圾输出 → 自动模式直接发送原文并提示;手动模式展示错误 + 重试。稳定错误码:bad-request / auth / network / timeout / unsupported / internal
  • 双后端

- dsh(默认,免密钥):复用 harness 的 ctx.llm + 默认模型选择; - openai:OpenAI 兼容 /chat/completions,与 linshenkx/prompt-optimizer 相同的配置方式(baseUrl / apiKey / model / temperature / max_tokens / rounds),内置 DeepSeek / OpenAI / 自定义预设。

  • 安全:API Key 存宿主侧 ~/.dsh/dsh-prompt-optimizer.json(原子写、promise 链互斥),浏览器只见掩码、永不下发原文密钥;路由仅同源、请求体限长、不落盘 prompt 内容。
  • 性能:拦截守卫 O(1)、自动关 = 零开销;client bundle ≈ 55 KB(gzip ≈ 12 KB,平台依赖全外部化);优化异步执行,输入框全程可编辑。

安装

方式 A:注入器流水线(开发/热插拔,本机已有 dsh-super-injector)

# 1. 构建(DSH_CHECKOUT 指向 dsh 源码 checkout;需 pnpm)
pnpm install
DSH_CHECKOUT=/path/to/dsh-checkout npm run build   # build.sh 链接类型依赖 + tsc 双 program + tsdown client bundle
npm run verify                                     # 离线冒烟(纯逻辑断言)

# 2. 注入运行中的 DSH(dev_* 工具,宿主侧执行)
dev_build_plugin <本目录>       # 或手动: bash scripts/build.sh && pnpm build:client
dev_inject_plugin <本目录>
# 3. 刷新 http://127.0.0.1:3080 生效
dev_reload_package dsh-prompt-optimizer   # 迭代热重载
dev_uninject_plugin dsh-prompt-optimizer  # 卸载(全净)

方式 B:作为 bundle 安装(持久化,重启后仍生效)

pnpm pack   # 产出 dsh-prompt-optimizer-0.1.0.tgz
dsh plugin --profile web add ./dsh-prompt-optimizer-0.1.0.tgz
# 重启该 profile 后生效

配置

打开工具行「⚙」设置面板:

字段说明
后端模式DSH 内置路由(免密钥) / OpenAI 兼容供应商
供应商DeepSeek(https://api.deepseek.com/v1)/ OpenAI / 自定义
Base URL / API Key / 模型与 prompt-optimizer 供应商配置同构;API Key 留空保持原值
温度 / 最大输出 / 轮数0–2 / 16–16384 / 1–3(多轮=对上一轮结果再精炼)
测试连通小样本调用验证密钥与端点

Host 路由(JSON envelope)

  • GET /dsh-prompt-optimizer/settings — 掩码后的设置视图
  • POST /dsh-prompt-optimizer/settings — 保存设置
  • POST /dsh-prompt-optimizer/optimize{ prompt }{ optimized }(支持一次性 settings 覆盖;45s 超时)
  • POST /dsh-prompt-optimizer/test — 连通性测试

开发

src/
├── index.ts                    # host 入口(inject: llm / agentDefaultModel / systemPrompt)
├── host/{contract,settings,optimize,pure,routes}.ts
└── client/
    ├── index.ts                # 注册 conversation.input.right 槽位条目
    ├── OptimizerControl.tsx    # 工具行控件(优化按钮/自动开关/设置)
    ├── CompareDialog.tsx       # 前后对比弹窗
    ├── SettingsPopover.tsx     # 供应商设置
    ├── intercept.ts            # 自动模式 document-capture 拦截(纯决策函数)
    ├── optimizer-api.ts        # typed fetch 客户端
    └── locales.ts              # zh/en 文案
  • 双 tsc program(host 排除 src/client,client 用 react-jsx);tsdown.config.ts 复刻官方 clientBundle 协议(window.__ModuleLoader__.load 闭包、CSS Modules 内联、@deepseek-ai 值导入 purity 门)。
  • scripts/verify.mjs 离线冒烟(48 项断言:指令组装、JSON/双 blob 提取、垃圾输出拦截、设置往返、拦截决策表)。
  • 自动拦截依赖 InputBar 的 DOM 契约([data-composer-card]、卡内最后一个 button 为发送键):判定全部防御性判空,失配即放行原生流程。

许可证与合规

  • 本插件:MIT
  • 兼容对象 linshenkx/prompt-optimizer 为 AGPL-3.0:本插件未复制其任何源码或提示词,仅遵循其 OpenAI 兼容协议与配置字段约定;优化指令为本插件自研。