dsh-prompt-dock: Input Draft Rewriting and Template Insertion

Preface

When writing prompts in DeepSeek Harness (DSH), a common practice is to draft in the input box first, then copy to an external editor to polish, or repeatedly hand-edit the same sentence. The DSH community plugin dsh-prompt-dock (maintainer wnei-f) attaches rewriting and template insertion to the input box toolbar, on the same row as the official model selector. Rewriting goes through the host’s llm streaming interface, with undo, session context, and several safety boundaries. Below we introduce what it is, how to install it, how to use it, and what to watch out for.

What is this

dsh-prompt-dock is a model inference plugin for DSH (current version 1.1.0, MIT license). It registers at the conversation.input.right slot (to the left of the model selector), providing for the current input box draft:

  • AI Rewriting: styles such as more concise, more detailed, structured, translate to English, custom, etc.; SSE streaming output, cancellable, undoable after writing, optionally with recent conversation context.
  • Template insertion: commonly used prompt templates can be appended to the draft in one click, without going through the rewriting pipeline.

The settings entry is in the DSH sidebar Plugins → dsh-prompt-dock page, no longer crowded on the toolbar. Directory page: skillhub.cn/plugins/wnei-f/dsh-prompt-dock; source code: github.com/wnei-f/dsh-prompt-dock.

Core Features

Toolbar layout and interaction

The toolbar from left to right consists of three independent controls: “Style / Template / Rewrite”. “Rewrite” is the rightmost, adjacent to the model selector; during processing it shows a spinner and the number of characters received, and after completion the same position becomes “↩ Undo”.

It auto-degrades based on container width (the default full-layout threshold compactThreshold is 320px): full controls are shown on wide screens; when narrowed, style and template can show only icons; when even narrower, they are merged into a two-level menu. When showStyleEntry or showTemplateEntry is set to never in the config, it directly enters the merged layout.

Default shortcuts (can be modified in the plugin configuration’s “Shortcuts” group, and combinations with modifier keys are supported when triggered inside the input box):

Action Default Shortcut
Open style Alt+M
Open template Alt+T
Execute rewrite Alt+R

When an overlay is open, arrow keys can still be used to navigate options, and Enter selects without sending the input box content; the style and template overlays can be switched between using Alt+M / Alt+T. When an overlay is open, Alt+R is intercepted to avoid accidental rewrite triggering.

AI Rewriting

Rewriting is performed through the host’s semi-call ctx.llm.stream; the plugin itself does not declare external-network fetch/socket permissions. The model defaults to following DSH’s global default (agentDefaultModel), and can also be fixed via rewriteProvider / rewriteModel in the config.

The built-in rewriting discipline emphasizes that “the rewriter is not a requirement generator”: for confirmations and chitchat-type short sentences, they can be kept as-is or only grammar errors fixed; for task-type drafts, process according to style constraints while trying to preserve code, paths, @references, /commands, numbers, and Markdown structure. Rewrite results are AI-assisted generation and need to be verified by yourself.

Optional useContext and contextRounds (1–20) attach recent conversations. The timeout timeoutMs defaults to 90000, with a range of 5000–300000.

Template insertion

Template body text is inserted directly into the input box and does not enter the rewriting system prompt. Built-in examples include code review, explaining code, writing tests, etc. They can be added, deleted, or modified in the config’s “Template library” (a single library supports up to 100 entries; field lengths have limits, and saving over the limit will truncate).

Security and boundaries

  • Chip protection: when the draft contains @file / /command reference chips (based on the host’s InputState.occurrences), “Rewrite” is greyed out and shows a prompt.
  • Loopback fence: /api/prompt-dock/* only accepts local origins; it is not recommended to rely on this fence alone when exposing DSH Web behind a reverse proxy.
  • Rate limiting: within the same host process, the concurrent rewrite limit is 2, and the limit of successful calls per minute is 10.
  • Change detection: if the draft is modified during rewriting, the result will not be written back.
  • Privacy: drafts are neither logged nor written to disk; the plugin does not read API keys.

Installation and Activation

Install from GitHub (the repo has committed lib/ build artifacts, so no local build is needed):

dsh plugin --profile web add github:wnei-f/dsh-prompt-dock
# 重启 dsh web 后生效

It can also be installed in the GUI plugin management. The README notes: after modifying plugin code, you must restart DSH; refreshing the page alone cannot load the new client bundle.

Compatibility range (see package.json): dsh is >=0.2.0-rc.2 <0.3.0 or >=0.2.1-0 <0.3.0, and has been marked as compatible on versions such as 0.2.1-rc.2.

When upgrading from the old ~/.dsh/prompt-dock/settings.json, on first startup it will automatically migrate to the official cordis.patch.yml config, and the old file will be renamed to settings.json.migrated.

Typical Usage

  1. After installing and restarting DSH Web, confirm that “Style / Template / Rewrite” appears on the conversation input box toolbar.
  2. Write the draft in the input box; if it contains @ or / chips, you need to remove the chips before rewriting, or only use templates to append.
  3. Select a style (e.g., “more concise”) and then click “Rewrite”, or press Alt+R; it can be cancelled during streaming; after completion, “↩ Undo” or the toast prompt can be used to restore.
  4. When fixed wording is needed, open “Template” and select one; the content will be appended to the current draft.
  5. Adjust the model, context rounds, style library, template library, toolbar display, and shortcuts in the sidebar Plugins → dsh-prompt-dock. Changes affect rewrite behavior without needing a restart.

The configuration is written to the config section of dsh-prompt-dock in the current profile’s cordis.patch.yml; example fields are as follows (full description in the repo README):

- id: dsh-prompt-dock
  name: dsh-prompt-dock
  config:
    rewriteProvider: deepseek-official   # 空串 = 跟随全局默认
    rewriteModel: deepseek-chat
    timeoutMs: 90000
    useContext: true
    contextRounds: 6
    showStyleEntry: auto
    showTemplateEntry: auto
    compactThreshold: 320
    shortcutStyle: Alt+M
    shortcutTemplate: Alt+T
    shortcutRewrite: Alt+R

Use Cases and Notes

Suitable for: developers who frequently polish prompts in the DSH input box, want to use the same discipline for “concise / structured / translate to English” rewrites, or need an editable template library for one-click insertion.

Notes:

  • The plugin runs with the permissions of the current DSH process; before installing, it is recommended to read the source code and LICENSE to confirm that the permission declarations (e.g., process.child_process is only used to open cordis.patch.yml under the profile) match your environment.
  • Rewriting will send the current draft to the model you configured in DSH; the first time you click “Rewrite” there will be a notification, and after closing it will no longer prompt.
  • The community directory SkillHub has no official affiliation with DeepSeek / High-Flyer; the DSH ecosystem philosophy is “everything is a plugin”, and this plugin is a community-maintained independent component.

Conclusion

dsh-prompt-dock brings prompt rewriting and template insertion into the input box toolbar. Streaming rewrite, undo, context and chip protection, the loopback interface, and rate limiting are all clearly documented in the README with behavior boundaries. If you are using DSH 0.2.x for agent or conversation development, you can install it using the command above, adjust the model and style library in the plugin page, and then iterate directly on drafts.

  • Directory page: https://www.skillhub.cn/plugins/wnei-f/dsh-prompt-dock
  • GitHub: https://github.com/wnei-f/dsh-prompt-dock
羽毛球分组比赛记分
小程序二维码

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

Xiaoye