dsh-prompt-spark: One-click draft rewriting in DSH input box

Preface

People writing prompts in DSH (DeepSeek Harness) often have two repetitive actions: making a loose draft clearer, or just changing one sentence while keeping the rest the same. The traditional way is to paste the whole paragraph into the model, get the result, and manually compare it back to the original box, worrying about breaking it in the middle with no way to revert.

The plugin introduced below, dsh-prompt-spark, targets this exact pain point. It isn’t in the sidebar or settings page; instead, it hangs directly next to the DSH input toolbar. According to the README, it is “no settings page, no config file, options hidden in gestures.”

What is it

dsh-prompt-spark is maintained by mihoojj, hosted on GitHub, and distributed via npm as the dsh-prompt-spark package. One-sentence positioning: Click the sparkle button next to the input box, use the current session’s model route to rewrite the draft into a clearer version, and support instant undo.

It belongs to model inference plugins, reusing the existing session’s model and keys, and does not introduce new provider configurations. The license is MIT.

Core Features

  1. Rewrite: Click the sparkle button to rewrite the draft into a clearer version based on the current session’s modeling route. The rewrite result directly replaces the content in the input box.

  2. Undo: After rewriting, the button becomes undo. Undo is only available if the draft still exactly matches the rewrite result; once manually edited, the button reverts to sparkle, and the undo window closes.

  3. Style Presets: Long press or right-click the button to pop up four fixed presets – Clearer, Shorter, More formal, More casual. Once selected, it is remembered, and the next single click will use that style.

  4. Selection Rewrite: Select a part of the draft first, then click the button to rewrite only the selected segment; surrounding text is sent as context to ensure the result flows smoothly.

  5. Shortcuts: In DSH Desktop, it is Ctrl+Shift+O (macOS is Cmd+Shift+O); for the Web build, it is Ctrl+Alt+Shift+O. Both can be remapped in the built-in Keyboard shortcuts panel. The Web version adds an Alt because Ctrl+Shift+O is occupied by the official “Open in app” function.

  6. Display Control: The control automatically hides when the draft is empty or contains only whitespace, or when the input box is in the adjudicating / submitting state. On rewrite failure, the draft remains unchanged, and the button tooltip reports the error code.

Installation and Enablement

The README provides two installation methods, the package name is dsh-prompt-spark, not github:mihoojj/dsh-prompt-spark.

The first way, operating within DSH Desktop: Open Plugins, select Add plugin, enter the package name or the absolute path to the repository, and then enable:

dsh-prompt-spark

The second way, installing for a specific profile from the terminal:

dsh plugin --profile <profile> add dsh-prompt-spark

Modifying client.js (browser side) only requires a page refresh. Modifying index.js (host side) requires restarting the application.

Typical Usage

First, input a rough draft, for example, a description mixing the target, constraints, and output format. Then click the sparkle button next to the toolbar, and the text inside is replaced by the rewrite result. If not satisfied, as long as the text hasn’t been edited again, simply click undo to return to the original text.

If you only want to adjust a single sentence, select it and click sparkle; the selected segment is replaced, while the rest is preserved based on context. If you want to change the tone at the beginning and end, long press the button to choose between Clearer / Shorter / More formal / More casual; the next single click will apply that style.

Internal Structure

The plugin is split into host and browser halves, with independent entry points for each; this division determines whether an application restart is needed during debugging.

File Role
package.json npm bundle: dsh.bundle.patch points to cordis.patch.yml, dsh.client.platform is web, corresponding to client.js
cordis.patch.yml Contains only one line insert, with name being the package name
index.js Host side. inject is ['webServer','connection'], registers a precise POST /dsh-prompt-spark/rewrite, falling after the Connection trust fence, with body size limits, internally calling llm.stream
client.js Browser side. Registered via window.__ModuleLoader__.load({ id, factory }), returns { inject: ['slots','locale'], apply(ctx) }
locale/*.json Display metadata for the plugin page

The browser uses new URL('dsh-prompt-spark/rewrite', document.baseURI) to resolve the route relative to the document, so scenarios involving mounting prefixes also work. The host does not touch provider keys or endpoints but forwards along the combined llm service stream, using the session’s own provider/model and falling back to configured defaults on failure. Styles are fixed instruction suffixes; there is no configuration interface.

Development and Verification

npm test          # node test/host.test.mjs && node test/client.test.mjs
npm run check     # node --check index.js && node --check client.js
npm run pack:check     # npm pack --dry-run

test/host.test.mjs covers routing boundaries, method and body limits, style and selection request encapsulation, and various results of the LLM stream. test/client.test.mjs uses a small React framework to drive the component, covering visibility rules, rewrite/undo lifecycle, style menu, long press, selection replacement, failure tooltips, and registration structure.

Scenarios and Notes

Suitable for daily prompt writing in the DSH input box for those who want to rewrite wording nearby without leaving the interface. It relies on the model route already available in the current session, so its behavior is consistent with that session, and style switching will not change the underlying model selection.

Two points need attention. First, this plugin runs with the permissions of the current dsh process; you should review the source code and license (marked as MIT in README) yourself before installing. Second, the plugin directory page belongs to a third-party community site and has no official affiliation with DeepSeek / Huafan; the installation channel is based on the package name.

Summary

dsh-prompt-spark condenses rewriting into a button, one undo, and four styles, without introducing a configuration interface or interrupting the current session’s model context. For users who wish to reduce manual round trips, this is a small tool ready to use.

Directory page: https://www.skillhub.cn/plugins/mihoojj/dsh-prompt-spark
Source code and readme: https://github.com/mihoojj/dsh-prompt-spark

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye