xyavid/dsh-prompt-polish ↗★ 2

@xyavid/dsh-prompt-polish

dsh Web 插件:在输入框模型名左侧加一个小星星按钮,一键把当前草稿交给模型改写成结构化提示词,可一键撤回。 适合需要快速将草稿改写为结构化提示词并支持一键撤回的Web端用户。

Package
@xyavid/dsh-prompt-polish
Compatibility
Unverified
Harness peer range
^0.1.7-rc.1 || ^0.2.0-rc.1
Cordis peer range
^4.0.2
Version
0.3.1
License
MIT
Last updated
Oct 7, 2026

Install

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:xyavid/dsh-prompt-polish

Usage

Type a draft, then click the sparkle button left of the model name.

The three states

StateIconClick behaviourHover text
Idle✦ sparklestart polishing优化提示词
Running↻ spinner (hover turns red)cancel the in-flight call取消优化
Done↺ undo arrow (accent colour)restore the original draft撤回优化

What happens, step by step

  1. Local guards run first. Empty or whitespace-only drafts, attachment-only drafts (a chip's trailing zero-width space is folded away correctly), drafts over maxInputChars, drafts containing /commands or @references, and a composer in a non-plain phase are refused with a tooltip. Chips are refused because filling text back would destroy them.
  2. The button spins while the host calls the model. Your draft is untouched during the call, so cancelling at any moment leaves exactly what you typed.
  3. On success the result is written back through the official editor API, the native undo stack stays intact (Ctrl+Z works), and the same button becomes the undo arrow.
  4. Undo restores the original draft and returns the button to idle. If you keep typing after the result lands, the undo state retires itself so stale text can never overwrite your newer edits.

Interaction rules worth knowing

  • Pressing send while a polish is running cancels the call and sends your original text.
  • Editing the draft while a polish is running means the result is not written back; the button returns to idle and the hover text explains why.
  • The undo affordance expires after undoWindowMs (default 60 s). The button reads that value through the client settings mirror, and falls back to 60 s when the mirror is unavailable (see Known limitations).
  • Only one polish runs at a time per session, and a late response from a cancelled call is discarded.

Configuration

Everything lives on the prompt-polish composition entry, editable from Settings → 插件配置 or directly in that entry's config block in the profile's cordis.patch.yml. Since 0.1.7 the settings domain writes edits back to the profile patch, and the plugin reads the .volatile() references declared in its schema, so a save takes effect on the next call without a restart or a remount.

Defaults come from two places, in this order: the schema defaults below, overridden by the composition layer's config block in cordis.patch.yml, overridden by your settings section. Out of the box the composition layer pins enabled, temperature, maxOutputTokens, timeoutMs, and maxInputChars, so those five values are the effective defaults even if you never open the settings page.

FieldDefaultAppliesDescription
enabledtrueliveMaster switch; off hides the button and disables the route
strengthbalancednext callconservative — fix and structure only; balanced — also fill in implicit prerequisites; aggressive — rewrite as a full task brief (length ceiling relaxed to ~1500 characters)
temperature0.3next callLower keeps the rewrite more faithful to the original
maxOutputTokens2048next callOutput budget of one call; truncated output is refused, never written back, so raise this when using aggressive with reasoning enabled
maxInputChars12000next callInput cap counted in Unicode code points (an emoji is one character); over-limit drafts are rejected, never truncated
timeoutMs60000next callEnd-to-end deadline of one call; timeout surfaces as a distinct message, not a generic failure
systemPromptemptynext callYour own strategy text; empty uses the built-in strategy
strategyModereplace-defaultnext callreplace-default swaps the built-in strategy out entirely (its hard rules — preserve intent, never fabricate, body-only output, mirror the input language — are not retained automatically); extend-default appends your text after the built-in strategy, keeping those rules in force
undoWindowMs60000liveHow long the undo affordance stays available (0 = forever); the button reads it through the client configForms mirror

"Applies" mirrors the namespace's applies: 'live' registration: every field is re-read on each request, and enabled / undoWindowMs additionally affect what the browser shows without a restart. Only changes to the composition layer itself (a cordis.patch.yml edit) require reloading the profile directory, and patchReload: live profiles pick those up on save too.

The same values can be set from the user patch layer without touching the plugin: