xiaoshengliang2002/dsh-prompt-boost-pro0

dsh-prompt-boost-pro

在输入框中提供提示词重写与对比预览

AI 分析

适合希望在发送前优化草稿、对比原始与增强版提示词效果的用户。

包名
dsh-prompt-boost-pro
版本
0.1.1
许可证
MIT
最近更新
2026年9月12日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:xiaoshengliang2002/dsh-prompt-boost-pro

dsh-prompt-boost-pro — enhance the draft before you send it

English | 中文

A sparkle button in the DeepSeek Harness (DSH) composer tool row. Click it, pick a mode, and the model rewrites your draft into a better prompt — shown as an original-versus-enhanced preview that you accept, re-run in the other mode, or discard. Nothing touches your draft until you accept.

Inspired by Trae CN's "optimize input": type a rough idea, get a directly executable instruction. Unlike a one-shot rewrite, this plugin keeps you in control — you always see both versions first, and after accepting, the same button becomes an undo until you change or send the text.

Features

  • Two modes, picked per useStructured reorganises the draft for the task at hand (goal, constraints, expected output, acceptance), Light only disambiguates, fixes wording and tightens; both keep your intent and your language, and neither invents requirements you did not write.
  • It never interrogates you. The prompt policy forbids handing back information the agent can look up itself (repo layout, stack, scope, previous conclusions). At most one [待补充: …] placeholder survives, and only for a decision that is genuinely yours.
  • Comparison preview, never a silent overwrite — original and enhanced side by side; accept, re-run in the other mode, copy, or discard. If you edited the draft while the preview was open, it says so and makes the overwrite explicit.
  • Undo that knows when it is over — after accepting, the button reads "undo" only while the draft still equals the enhanced text; sending or editing the draft returns it to normal instead of offering an undo that cannot work.
  • Truncation is surfaced, not swallowed — output budget adapts to the draft (4000 → 8192 tokens) and a capped answer is still returned, flagged, with a hint instead of an error.
  • Model route resolved four ways — plugin config → the model currently shown in the picker → the session's last request → the deployment default. A brand-new session works on the first click.
  • Dismissals everywhere — click the icon again, click anywhere outside, or press Esc; the preview also closes with Esc. The button stays clickable while its menu is open, so the menu can never trap you.
  • Bilingual UI (zh / en), theme-native (real DSH design tokens), no tracking, no config files written.

Requirements

  • DSH web GUI (dsh web), harness 0.1.2-alpha.1 or newer; the current line (0.1.5-rc.x) is tested.
  • Node ^22.19.0 || >=24.0.0 (the host half runs inside the harness process).
  • A session whose model is routable — the default model counts, so no setup is needed.

Install

# from the profile that runs your web GUI (usually "web")
dsh plugin --profile web add github:xiaoshengliang2002/dsh-prompt-boost-pro

# or from a released tarball
dsh plugin --profile web add https://github.com/xiaoshengliang2002/dsh-prompt-boost-pro/releases/latest/download/dsh-prompt-boost-pro.tgz

# or from a local checkout (symlinked; rebuild shows up without reinstalling)
dsh plugin --profile web add link:/path/to/dsh-prompt-boost-pro

Then restart dsh web and reload the page. The lib/ bundles are committed, so installing from source needs no build step and no pnpm build approval.

Uninstall: dsh plugin --profile web remove dsh-prompt-boost-pro.

Where the button lives

+ | permission control | ✨ enhance | summon-expert entry | … | model | context meter | send

It registers conversation.input.left with order: -10, so it sits immediately after the permission control. Move it after the summon-expert entry by changing order to 20 in src/client/index.ts.

How it works

HalfRole
Host (lib/index.js)Registers POST /api/prompt-boost-pro/enhance on the shared API channel (same-origin, cookie-authenticated), resolves the model route, calls ctx.llm.stream() once, cleans the text and answers JSON.
Browser (lib/client.js)Registers two slots: the tool-row button with its mode menu, and the preview dialog in the composer overlay. Keeps one state machine per session and writes the draft through inputActions.setDraft only on accept.

Wire contract, error codes and the prompt policy are documented in docs/design.md; the awesome-dsh-plugin checklist is in docs/awesome-dsh-plugin-checklist.md.

Development

The repository is a normal npm package; lib/ is build output that is committed on purpose (so source installs are build-free).

npm run typecheck      # tsc --noEmit, 0 errors
npm run build          # esbuild → lib/index.js + lib/client.js
npm test               # 4 offline suites: host 28, client 28, UI dismissal/undo 40, prompt policy 27
npm run release:pack   # sync docs + build + npm pack
npm run release:verify # unpack the tarball and assert 31 contract/listing conditions

No network is required: node scripts/link-dsh.mjs links the packages of a local DSH checkout into node_modules (esbuild, typescript, react, @types) so the build and tests run offline.

preview/index.html is a clickable preview of the composer UI built from DSH's real design tokens and this plugin's real stylesheet; preview/shot-preview.cjs renders the state screenshots into preview/shots/ (declared for the storefront via screenshots.json).

Version history

  • 0.1.1 — upgrade-window compatibility. The host registers the legacy POST /api/prompt-boost/enhance path alongside the current one, and the client falls back to it when the current path answers 404/405 — so a half-updated pair (page refreshed but server not restarted, or the reverse) keeps working instead of failing with "unexpected response (HTTP 404)".
  • 0.1.0 — first release. Two enhancement modes (structured / light); original-versus-enhanced preview before applying; undo that expires with the draft; click-outside/Esc dismissal; adaptive output budget with a truncated flag instead of dropping a capped answer; four-level model route resolution so a brand-new session works on the first click; bilingual UI and a custom sparkle icon. 123 offline assertions plus 34 packaging checks. Wire path: POST /api/prompt-boost-pro/enhance; the button sits after the permission control.

License

MIT