Introduction

After starting the service using DSH’s web profile, there are several issues encountered almost daily:

  • Some OpenAI-compatible APIs do not have an independent reasoning_content channel; the Chain of Thought (CoT) is mixed directly into the content stream. DSH renders the entire paragraph as plain text, burying the answer within a large block of thinking.
  • After a single turn completes, thinking lines, tool call lines, and intermediate explanations fill the screen, leaving only the final reply as what needs to be seen.
  • Manually clicking Stop or encountering a session error requires manually reorganizing the input to continue running.
  • When the model outputs mermaid charts, the interface only displays a block of code text.

dsh-assistant-optimization handles these issues together. The following introduces them in the order of features, installation, and configuration.

What is this

dsh-assistant-optimization is a DSH web profile plugin maintained by qianshe, current version 1.8.0, MIT License, with a total of seven capabilities, ready to use out of the box. It does not replace any official rendering: the plugin intercepts DSH components using the Shadow DOM method and then delegates the rendering back, keeping Markdown, tool cards, images, and tables unchanged.

Core Features

Reasoning fold: Folding incorrectly rendered reasoning content

Some providers write the Chain of Thought directly into the normal text stream, like this:

The user wants to know about X, I should explain Y first...
</thinking>

Here is the answer to your question...

The plugin splits content at configurable delimiters, folding the thinking part into the native “Think” collapse block, keeping only the answer visible. The delimiter defaults to ["</thinking>"], supports multiple delimiters, and is managed in Settings → General → Thinking Tag Markers.

Mermaid chart inline rendering

mermaid code blocks are rendered inline as interactive SVGs. Toolbar buttons provide zoom and reset, the scroll wheel zooms, and mouse or touch drag pans.

Tool-call grouping: Merging tool call lines

Continuous tool call lines are folded into a single line # bash · N tools header. Reasoning lines between calls do not break the grouping; they are merged into it: collapsed groups hide reasoning lines along with everything else, while expanded groups display them indented like members.

Prompt enhance: One-click polish draft

To the left of the Send button is a ✨ button. Clicking it uses the model currently selected in the input box to rewrite the draft into clearer instructions. It sends only a standard chat request—without creating a session or logging it—then replaces the draft in place, with Ctrl/Cmd+Z to undo.

While running, it shows a spinning arc and “Enhancing”; success shows a green checkmark; on failure, the icon flashes red and the reason is placed in a tooltip, and the draft is not cleared. The tooltip also reports the actual context length received in the last call—check this first if the rewrite effect is unsatisfactory.

Resume-from-breakpoint: Continue from interruption

After the session stops abnormally—user clicked Stop or a session error occurred—the Send button becomes a ▶ Play key. Hovering shows a “Resume from Breakpoint” tooltip, with the same style as the native DSH button tooltip. Clicking it sends a resume signal via the host router, and the agent continues running from the breakpoint using the model currently selected in the input box.

A few details:

  • The gating logic reads the turn/end reason of the last closed turn in session.chat.timeline; only aborted (user stopped) and error (session error) trigger the play key; normal completion and max-tokens do not trigger it.
  • Typing anything into the draft, or the agent starting to run, immediately reverts the button to the normal Send/Stop key; it will not get stuck on the play icon.
  • When the resume marker enters the record, the plugin replaces the empty bubble and copy button with a “Continued from interruption” hint line.
  • Implementation-wise, it uses a CSS overlay: hiding the official button’s SVG via the data-dsao-resume attribute and placing a Play SVG next to it, without interfering with React’s re-rendering cycle.

Turn folding: Auto-fold process on turn end

Everything is kept visible while a turn is running; the native “Deep diving…” status and clock serve as running indicators. At the moment a turn completes (the final answer is delivered), the process content of that turn—thinking lines, tool calls, intermediate text—is folded into a single line “Completed · Duration” header; error or stopped turns display “Error”/”Stopped”. Running interjections are folded along with the turn, and the header displays a count of “· N interjections”.

Always visible are: your question, the final summary reply, and its action row (copy, etc.). Clicking the header expands the full process, and clicking again collapses it. The expand/collapse choice exists only in memory and re-collapses after refreshing the page.

Two implementation notes:

  • The folding scheme is calculated entirely from the session snapshot: group turns using chat.locations, determine completion status using the turn’s turn/end reason, locate the summary reply using the official turn-tail node’s closing pointer, and calculate duration using the turn’s start and end timestamps (using the same numbers as the native clock).
  • dsh 0.1.2+ has built-in turn folding (Settings → Conversation display → Compact). This plugin takes over that setting: when Turn Folding is enabled, it forces the built-in mode to Normal to avoid double folding; when disabled, it hands control back to the built-in Compact. Switching either side keeps them aligned.

The toggle is at Settings → General → Turn Folding, enabled by default.

context_search: Semantic search for code location

A host-side tool targeted at fuzzy or unclear searches: it accepts a natural language description and returns matching files, line ranges, and code. It runs an agentic search loop based on the fast-context method, driven by the Windsurf key.

The key gating is a design focus: the tool and its one-line prompt guide are only registered when the Windsurf key is parsed successfully; without a key, nothing is registered, and the model is not informed of a tool it cannot call.

The key is parsed in the following order, stopping upon a match:

  1. WINDSURF_API_KEY environment variable;
  2. Manually filled in at Settings → General → Windsurf API Key, stored in ~/.dsh/dsao-windsurf-key, permissions 0600;
  3. Automatically reads state.vscdb from a logged-in Windsurf/Devin editor; set DSAO_FC_AUTO_KEY=0 to disable automatic reading.

See lib/fast-context/NOTICE.md for non-official protocol details.

Installation and Enablement

dsh plugin --profile web add github:qianshe/dsh-assistant-optimization
dsh web

Open http://127.0.0.1:3080, and the plugin activates automatically. A restart is required after installing, updating, or uninstalling.

Other management commands:

# Install from local source
dsh plugin --profile web add .
# Update
dsh plugin --profile web update dsh-assistant-optimization
# Uninstall
dsh plugin --profile web remove dsh-assistant-optimization

Configuration

The plugin has three configuration items:

Config Item Default Description
Thinking Tag Markers ["</thinking>"] Strings to separate thinking from content; supports multiple, edit in Settings → General
Turn Folding Enabled Fold process into a single line header after turn completion, edit in Settings → General
Windsurf API Key Credentials for context_search; without a key, the tool is not registered

Usage Scenarios and Notes

Suitable for developers who chat and run agent tasks daily via the DSH web profile and want a cleaner interface. Notes before use:

  • Requires DSH with a web profile;
  • The plugin only accesses the network via the mermaid.js CDN when charts appear and does not connect to the network at other times;
  • The Edit diff counts module has been retired in v1.8.0: dsh 0.1.2+ natively renders diff statistics for Write/Edit lines, this module is kept only for older host versions and does not register anything on the current version;
  • context_search relies on external Windsurf credentials; the behavior of automatically reading the editor database can be disabled with DSAO_FC_AUTO_KEY=0;
  • The plugin runs with the permissions of the current dsh process; it is recommended to check the source code and license (MIT) before installing.

Conclusion

dsh-assistant-optimization aims to supplement output folding, chart rendering, and a few interactions without replacing official rendering, making the DSH web interface more usable while keeping the native look and feel. If you use the DSH web profile daily, it is worth trying.

  • Community directory page (independent site, no official affiliation with DeepSeek or High-Flyer): https://www.skillhub.cn/plugins/qianshe/dsh-assistant-optimization
  • GitHub: https://github.com/qianshe/dsh-assistant-optimization