DSH Plugins Marketplace

DSH Plugins

Plugins

/

dsh-prompt-enhancer

Y

dsh-prompt-enhancer

Manifest valid

The "Enhance Prompt" button in DeepSeek Harness: a single auxiliary LLM call rewrites the draft into a structured prompt, supporting loading state, failure retry, and one-click rollback. Prompt enhancer button for DeepSeek Harness.

UI (client)hasBundlePatchMachine translated

dsh-prompt-enhancer

verify license: MIT node

DeepSeek Harness 的「增强提示词」按钮:输入框工具行加一个四角星,一次辅助 LLM 调用把当前草稿改写成结构化提示词,支持加载态、失败提示与一键回退。

A composer toolbar button for DeepSeek Harness that rewrites the current draft into a structured prompt via one auxiliary LLM call, with one-click revert.

行为与提示词逆向自 CodeBuddy CN 4.12.2 的「增强提示词」,细节见 docs/REVERSE-ENGINEERING.md。

快速开始

前置:Node.js ≥ 22、npm i -g @deepseek-ai/dsh(dsh --version 可用)。

从 GitHub 安装(推荐)

dsh plugin --profile web add github:YiKangMo/dsh-prompt-enhancer
# 钉住版本(建议)
dsh plugin --profile web add github:YiKangMo/dsh-prompt-enhancer#v1.0.0

dsh plugin 会把参数转发给 profile 目录里的 pnpm。装完确认插件已进入 profile 的 bundles 列表:

(Get-Content "$HOME\.dsh\profiles\web\package.json" -Raw | ConvertFrom-Json).dsh.profile.bundles

列表里出现 dsh-prompt-enhancer 后重启 dsh web 生效;若只是装进了 node_modules 而 bundles 里没有它,把包名追加进 dsh.profile.bundles 再重启。

从本地目录安装

git clone https://github.com/YiKangMo/dsh-prompt-enhancer
cd dsh-prompt-enhancer
pwsh -File install.ps1              # 默认装进 web,可加 -Profile tui
# 没装 PowerShell 7 的机器用自带 Windows PowerShell:
# powershell -NoProfile -ExecutionPolicy Bypass -File install.ps1

等价手动命令:

dsh plugin --profile web add "<插件目录绝对路径>"

生效自检

# Harness 需正在运行
Invoke-WebRequest http://127.0.0.1:3080/prompt-enhancer/health -UseBasicParsing
# {"ok":true,"plugin":"dsh-prompt-enhancer"}

卸载

dsh plugin --profile web remove dsh-prompt-enhancer

使用

输入框工具行左侧(权限 / 计划 chip 之后、模型选择器之前)会出现一个四角星按钮:

状态图标点击行为
草稿为空四角星(半透明禁用)无
有草稿四角星调 LLM 增强,结果写回编辑器
增强完成逆时针箭头 ↶回退到增强前的原文
请求中旋转圆弧无
请求失败四角星(变红)重试;悬停可见错误原因

增强后若继续手动编辑,回退能力自动放弃,避免覆盖新输入。

工作方式

sequenceDiagram
    participant U as 用户
    participant C as 浏览器半边 client/client.js
    participant H as 宿主半边 lib/index.js
    participant M as ctx.llm.stream()
    U->>C: 点击四角星
    C->>H: POST /prompt-enhancer/enhance { draft }
    H->>M: 辅助模型调用(system + user 模板)
    M-->>H: text-delta 流
    H-->>C: { text, provider, model }
    C->>U: 写回编辑器,按钮变 ↶ 可回退

为什么是 dual-face 包

DSH 的客户端 Remote 面(ctx.remote.*)只暴露 llm/discoverModels、llm/listConfigurableProviders、llm/listProviders,没有补全入口;ctx.llm.stream() 只存在于宿主进程。所以插件必须两半协作:浏览器负责 UI 与草稿读写,宿主负责真实模型调用。

宿主半边 lib/index.js

  • 注册两条 exact 路由:/prompt-enhancer/enhance(POST)与 /prompt-enhancer/health(GET)。
  • 模型路由解析沿用 CodeBuddy 的优先级:请求显式指定 > ctx.agentDefaultModel.currentSelection()。
  • 手工聚合 ctx.llm.stream() 的 text-delta,并识别 finish 原因(stop / max-tokens / tool-calls / aborted / error)转成可读错误。
  • 结果 trim 后剥掉首尾成对引号(含中英文弯引号)。
  • 只接受回环 Host;非回环返回 403,防 DNS rebinding。
  • 120 秒超时,AbortController 中止。
  • 每个 webServer.register 各包一层 host.effect,服务替换或 fiber 卸载时按序撤销。

浏览器半边 client/client.js

手写 bundle,免构建——契约不要求 tsdown:

window.__ModuleLoader__.load({
  id: "dsh-prompt-enhancer",
  factory: (require) => { /* ... */ return module.exports },
})
  • id 必须等于包名;factory(require) 返回 exports。
  • require 只允许平台基线表:react、react/jsx-runtime、react-dom、react-dom/client、@deepseek-ai/cordis、dsh-client-store、dsh-client-ui-slots、dsh-client-ui-primitives、dsh-client-ui-dockkit。本插件只用 react。
  • 导出的 Cordis 插件面:inject = ['slots', 'locale'] 与 apply(ctx)。
  • CSS 用官方同款形态内联为字符串,在 factory 里注入 <style data-plugin-css=...>。

UI 落点

conversation.input.left —— composer 工具行左侧的 list 槽,定义在 dsh-client-ui-conversation/lib/types/client/contract/slots.d.ts:

/** Compact controls at the left of the composer tool row. */
'conversation.input.left': { kind: 'list'; scope: 'session' };

该槽 replaceRisk: "none",可安全追加。组件从 slot 框架获得 session 标准套件:useInput(InputState 选择器)、inputActions(setDraft 等),外加 locale 声明带来的 t。

验证

三层离线契约测试 + 一层真机端到端,共 52 项断言,零运行时依赖(只用 node 内建模块):

npm test                     # host 7 + client 28 + manifest 17
node test/host.spec.mjs      # 宿主半边:路由、拒绝路径、终止原因
node test/client.spec.mjs    # 浏览器半边:注册、渲染、增强、回退、失败
node test/manifest.spec.mjs  # 清单契约:dsh 声明、bundle 落盘、require 基线
node test/e2e.spec.mjs       # 真机端到端,需要 dsh web 正在运行

CI 在 ubuntu / windows × node 22 / 24 上跑前三个(见 .github/workflows/ci.yml)。

已验证的真实行为

  • GET /prompt-enhancer/health → {"ok":true,"plugin":"dsh-prompt-enhancer"}
  • POST /prompt-enhancer/enhance → 真实 LLM 返回增强文本
  • bundle 经 /plugins 路由真实服务(combo URL + rev 元数据哈希),已进入 window.__DSH_BOOT__ entries
  • 实机浏览器:按钮渲染在 conversation.input.left,空草稿 disabled;填入草稿点击后进入 正在增强… 加载态并自禁用,编辑器内容被替换后按钮变为回退箭头

语言一致性

提示词把语言匹配列为最高优先级。实测三种输入:

输入输出语言结果
帮我整理一下上周的会议纪要全中文✓
summarize this function全英文✓
这段代码有bug,can you help me fix it?中英混合✓

提示词出处

两块模板逐字取自 CodeBuddy CN 4.12.2:

  • DEFAULT_ENHANCE_PROMPT_SYSTEM_TEMPLATE(genie 扩展 out/extension/index.js 模块 599240)
  • DEFAULT_ENHANCE_PROMPT_USER_TEMPLATE(同模块,{input} 由草稿替换)

调用链:EnhancePromptServiceImpl.generate() → agentDispatcher.dispatch({ agent: 'enhance prompt' }) → EnhancePromptInvokableAgent.call() → TencentChatModel.stream(),headers 带 AGENT_INTENT: enhance-prompt。

唯一改动:输出长度上限从「约 800 字符」放宽到「约 1200 字符」,因为 DSH 会话常含路径与代码标识符。其余(五条禁令、语言一致性六条、两个 few-shot 示例)保持原样。模板内联在 lib/index.js 顶部,可直接编辑。

目录结构

dsh-prompt-enhancer/
├── package.json            dsh.bundle.patch + dsh.client.platform=web
├── cordis.patch.yml        - insert: 把自身挂进 profile 层栈
├── install.ps1             一键安装脚本(无绝对路径假设)
├── lib/index.js            宿主半边:HTTP 路由 + ctx.llm.stream()
├── client/client.js        浏览器半边:手写 bundle,注册 composer 按钮
├── docs/                   逆向报告、CodeBuddy 提示词原文、迁移说明
├── test/                   三层离线契约 + 真机端到端
├── .github/workflows/      CI
└── README.md

发布到 npm(可选)

当前 package.json 保留 "private": true,防止误发布;dsh plugin add github:... 不受影响。要发 npm 时:

# 删掉 package.json 的 "private": true,然后
npm login
npm publish --access public

发布后安装命令变为 dsh plugin --profile web add dsh-prompt-enhancer。

维护者:发布流程

# 必须在你自己的交互式终端里跑(首次推送会弹 Git Credential Manager 登录窗口)
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\publish.ps1 -Release

脚本会:校验本地仓库 → 对齐 origin → 检查远端仓库是否存在(缺失时用 gh 建仓,没装 gh 就打开建仓页面)→ 推送分支与 tag → 用 gh 发 Release 并上传 zip。远端仓库已存在且 gh 已登录时可全程无人值守。

参与

  • 改动前先跑 npm test,提交需保持 52 项断言全绿。
  • 新增 UI 行为请同时补 test/client.spec.mjs 的断言。
  • 客户端半边只用基线 require 表里的模块,否则页面加载会失败。

License

MIT © 2026 YG

Comments

Loading…

Similar plugins

dsh-prompt-forge

by 2861292267

WorkBuddy's 增强提示词 (Enhance Prompt) as a DeepSeek Harness plugin: rewrite the composer draft into a stronger prompt with one click.

Terminal & ClientsSessions & MessagesManifest valid

★ 4

MIT

JavaScript

Oct 17, 2026

dsh plugin --profile web add @local/dsh-prompt-forge

by rongxingda

Prompt enhancement plugin for the DeepSeek Harness web GUI: one-click rewrite of the composer draft into a structured prompt, with preview, fill-back, and undo.

UI & ExperienceManifest valid

★ 27

↓ 1.2k/wk

Apache-2.0

TypeScript

Oct 22, 2026

dsh plugin --profile web add dsh-prompt-enhance

by saibei404

DeepSeek Harness 提示词优化插件:输入框旁一键把草稿改写成清晰可执行的提示词(DeepSeek V4.1 Flash)

Manifest valid

★ 0

JavaScript

Oct 24, 2026

dsh plugin --profile web add dsh-prompt-polish

by sunzhentao

DeepSeek Harness提示词增强插件

Tools & CapabilitiesDevelopment & InfrastructureModels & ProvidersManifest valid

★ 6

↓ 230/wk

Apache-2.0

JavaScript

Oct 10, 2026

dsh plugin --profile web add @lidaxi/prompt-enhance

by 2861292267

WorkBuddy's 增强提示词 (Enhance Prompt) as a DeepSeek Harness plugin: rewrite the composer draft into a stronger prompt with one click.

Sessions & MessagesManifest valid

★ 3

MIT

JavaScript

Oct 13, 2026

dsh plugin --profile web add @local/dsh-prompt-enhancer

by Fishsb

DeepSeek Harness (DSH) 插件:✨ 提示词一键增强 + 💬 语音识别(说完自动停·云端/本地双引擎)· 附 🔁 服务异常一键重启

Tools & CapabilitiesManifest valid

★ 112

↓ 1.3k/wk

Unknown

JavaScript

Oct 22, 2026

dsh plugin --profile web add dsh-prompt-enhancer