DSH Plugins Marketplace

DSH Plugins

Plugins

/

UI & Experience

/

dsh-prompt-optimizer-button

d

dsh-prompt-optimizer-button

Identified

Prompt optimizer inside the DSH composer. One click rewrites the current draft with the model you already selected: it classifies the scenario (paper / agent task / daily question / English writing),

dsh-prompt-optimizer-button

prompt-optimizer-button icon

Codex / ?? agent ???skill?

Codex ? agent ?? DSH ??? composer ???????????? skill ???skills/prompt-optimizer/SKILL.md?????????????????????????????????? + ???? + ?????????????????????

???? skills/prompt-optimizer/ ??????????????

  • Codex?~/.codex/skills/prompt-optimizer/?? ~/.agents/skills/prompt-optimizer/?DSH ? Codex ??????
  • DSH??????????~/.dsh/skills/prompt-optimizer/ ??? .dsh/skills/prompt-optimizer/

???Codex ????????????????? $prompt-optimizer?DSH ?? /prompt-optimizer????? $// ????

Codex ????????????????? UserPromptSubmit hook ???????????? Codex hooks???????????????????????????????????????????????

??

composer with scenario badge and optimize button
????????? + ?????????????????

diagnosis panel
???????????? chips???????????????

optimizing state
??????????????????

给 DSH 输入框加一个「优化提示词」小图标(sparkle)按钮,并在它旁边加一个场景徽标:位置在 模型选择框与发送按钮之间(麦克风/发送按钮左侧)。

点一下图标,插件会把当前草稿发给宿主侧的一小段服务,用当前选中的模型跑一次普通的模型调用,把改写后的提示词直接替换回输入框:

  • 不发送、不新增对话轮次,你先看、先改,再按 Enter;
  • 使用输入框里当前选的 provider/model(含 reasoning effort),不另配密钥;
  • 草稿为空时按钮置灰;请求进行中图标呼吸闪烁、按钮不可再点;失败时图标变红并自动打开面板说明原因;
  • 徽标显示模型这次判断出的场景(自动 / 论文 / 派活 / 日常 / 英文),点徽标可打开面板、手动钉住下一次要用的场景。

场景徽标与诊断面板

一次调用同时返回三样东西:改写后的提示词(写回输入框)、判断出的场景、以及结构化诊断。诊断不进输入框,只显示在弹出面板里:

  • 面板标题行右侧显示模型识别到的场景,正文依次是:功能提示、场景选择 chips(自动/论文/派活/日常/英文,点一下即钉住)、诊断(任务类型、要支撑的决策)与三条自检(✓ 通过 / ! 未通过,各带一句理由)、失败原因(仅失败时);
  • 面板用 position: fixed 挂在按钮上方(空间不足自动翻到下方),水平居中并夹在视口内;外部点击、Escape、关闭按钮都能收起;role="dialog";
  • 视觉为深色半透明 + 背景模糊 + 圆角 14 + 投影,徽标是圆点 + 文字的胶囊;按钮禁用态用 aria-disabled(原生 disabled 会让 Chromium 不派发指针事件),点击守卫仍在 onClick 里。

结构

dsh-prompt-optimizer-button/
├─ package.json        # dsh.bundle.patch + dsh.client
├─ cordis.patch.yml    # 往 profile 组合里插入 host 行
├─ index.js            # 宿主侧:POST /prompt-optimizer/rewrite(ctx.llm 一次调用)
├─ client.js           # 浏览器侧:▸__ModuleLoader__ bundle,按钮 + portal 定位 + fetch
├─ assets/icon-*.png   # 商店/README 图标(512/256/180)
├─ publish/            # 商店上架草稿:awesome-entry.yml、CHECKLIST.md、PR_BODY.md
└─ README.md
  • 浏览器侧注册 conversation.input.right 单元格,用 ReactDOM.createPortal 把徽标与按钮插到 composer trailing 行的 standardControls(模型选择器块)之后;诊断面板再 portal 到 document.body,用按钮矩形算固定定位坐标。

  • 宿主侧注册一条同源路由 POST /prompt-optimizer/rewrite: { text, provider, model, reasoningEffort?, scenario? } → { ok: true, text, scenario, diagnosis }。 text 是改写后的提示词(唯一写回输入框的内容),scenario / diagnosis 只给面板用。 桌面版页面 origin 是 dsh-app://app,主进程会把非本地资源的 fetch 转发到宿主 Web 服务器(带认证 cookie),所以相对路径 fetch('prompt-optimizer/rewrite') 在桌面与网页版都能用。

  • 模型答案用行标记解析(SCENARIO: / DIAGNOSIS: / PROMPT:),长提示词正文不塞进 JSON 字符串,避免换行与引号导致解析失败;解析失败时回退为「整段当提示词」。

  • 宿主侧不 import 任何 @deepseek-ai/* 包(profile 里并没有 dsh-llm),只通过 ctx.get('llm') / ctx.inject(['webServer']) 拿运行时服务,避免插件拖慢或拖垮启动握手。

依赖

  • 运行中的 DSH(0.2.2 级别)自带 llm、webServer 服务即可,无需额外包。
  • 不再依赖 prompt-optimizer 技能:优化规则写在 index.js 的 system prompt 里(技能仍是给对话用的,两者不冲突)。

安装

本机已通过 plugin_manager 的 install_bundle 以 link: 方式装到 desktop profile。手动安装等价于:

  1. 在 profile(如 %USERPROFILE%\.dsh\profiles\desktop\package.json)的 dependencies 加 "dsh-prompt-optimizer-button": "link:<本目录绝对路径>";
  2. 把 dsh-prompt-optimizer-button 加进 dsh.profile.bundles;
  3. 让 profile 重新组装(plugin_manager 的 set/install,或重启 DSH),页面刷新后生效。

卸载

  • plugin_manager 里禁用/移除 prompt-optimizer-button 行,或
  • dsh plugin --profile desktop remove dsh-prompt-optimizer-button。

已知限制

  • DSH 0.2.2 的 composer 内部 DOM 不是公开 API;升级后若 [data-composer-card] / standardControls 结构变化,按钮定位会失效(有「发送按钮前」的兜底定位)。
  • 按钮只在会话输入框出现(欢迎 hero 态没有该单元格)。
  • 宿主路由不做额外鉴权,依赖 Web 服务器本身只在 loopback 暴露;若要对外暴露需自行加策略。
  • 单次请求上限:输入 20k 字符、输出 4000 tokens、超时 90 秒;输出被 max tokens 截断时直接报错(提示缩短草稿),不会把半截提示词写回草稿。
  • 目前不自动发送;要「点完直接发送」改 client.js 的 onClick,在 setDraft 后调用 inputActions.submit()。

Comments

Loading…

Similar plugins

dsh-prompt-optimizer

Optimize 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.

UI & ExperienceManifest valid

★ 0

↓ 185/wk

dsh plugin --profile web add dsh-prompt-optimizer

One-button prompt optimizer: rewrites the composer draft via a configurable strategy, with an editable template, few-shot examples, pinned models and reasoning effort.

UI & ExperienceManifest valid

★ 0

dsh plugin --profile web add @panando/dsh-prompt-optimizer

by du-u-uck

Adds a one-click prompt optimization button to the DSH composer, with undo and an optional dedicated optimizer model.

UI & ExperienceTerminal & ClientsManifest valid

★ 0

MIT

TypeScript

Sep 13, 2026

dsh plugin --profile web add dsh-prompt-optimization

by wmengxiang

Adds an icon button to the composer that optimizes the current draft prompt through the active model.

UI & ExperienceManifest valid

★ 3

↓ 411/wk

MIT

JavaScript

Oct 29, 2026

dsh plugin --profile web add dsh-prompt-optimizer

by EmotionG

Prompt optimizer for the DeepSeek Harness composer: a normal/optimize mode toggle in conversation.input.right that optimizes the draft with the session's current model and writes it back to the composer.

Terminal & ClientsManifest valid

★ 0

MIT

TypeScript

Sep 17, 2026

dsh plugin --profile web add dsh-prompt-optimizer

One-click prompt refinement for the DSH composer: the ✦ button next to Send rewrites the draft into an agent-ready prompt in Standard or Light mode, with Revert and Retry; asks follow-up questions thr

UI & ExperienceTerminal & ClientsManifest valid

★ 0

dsh plugin --profile web add dsh-smart-prompt