Adds an Optimize button to the composer. One click rewrites the current draft with the model you already selected, using the "basic optimization" prompt from linshenkx/prompt-optimizer (41.5k stars) verbatim, and writes the result straight back into the input box without adding a chat turn. A running rewrite can be cancelled by clicking again; requests time out after 150 seconds and the previous draft stays one click away. English and Chinese copy, no runtime dependencies, no stored credentials, no port of its own: the route rides DSH's authenticated /api mount.
Install
# from npm (prebuilt)
dsh plugin --profile web add @lklkuu/dsh-prompt-optimizer
# from a prebuilt release tarball
dsh plugin --profile web add "https://github.com/lklkuu/dsh-prompt-optimizer/releases/latest/download/dsh-prompt-optimizer.tgz"
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:lklkuu/dsh-prompt-optimizer
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
English | 简体中文
Adds an Optimize button to the DeepSeek Harness composer: it hands the current draft to the model you already selected, rewrites it with the "basic optimization" prompt from prompt-optimizer, and writes the result straight back into the input box.
No prompt-optimizer runtime, no Docker, no Bun, no browser extension, and no extra API key — it uses the model you have already picked inside DSH.
Where it came from
The core prompt is quoted verbatim from
linshenkx/prompt-optimizer (⭐ 41.5k), template
user-optimize/user-prompt-basic (v2.0.0). The plugin skeleton and slot wiring follow published DSH
plugins such as seven282/oss-prompt-optimizer
(⭐ 30, MIT) and @max-null/dsh-draft-polish
(MIT).
Code, tests, copy and icon are written for this repository. Upstream contributed prompt text and API usage only — no code was copied.
Install
dsh plugin --profile desktop add @lklkuu/dsh-prompt-optimizer
Or from the tarball attached to the latest Release:
dsh plugin --profile desktop add https://github.com/lklkuu/dsh-prompt-optimizer/releases/latest/download/dsh-prompt-optimizer.tgz
Restart DSH (or reload the page) so the client module loads.
Usage
- Type something into the composer — the button stays greyed out while the draft is empty.
- Click Optimize. It turns into "Optimizing…"; click again to cancel.
- The result replaces the draft and a "Optimized · Undo" affordance appears next to it — one click puts the original back.
Requests are canceled automatically after 150 seconds.
How it works
| Step | Implementation |
|---|---|
| Button location | conversation.input.right slot, order: 12 (between image provider 10 and Codex quota 15) |
| Read the draft | Standard slot prop useInput(s => s.draft) |
| Call the model | Host half POST /api/prompt-optimizer/optimize → ctx.get('llm').stream() |
| Pick the model | agentDefaultModel.currentSelection() — whatever the current conversation uses |
| Write back | inputActions.setDraft(text) + persistDraft() |
The call is out of band: it does not enter the transcript, does not consume a conversation turn and
does not touch session files. The route rides DSH's own authenticated /api mount, reusing the host's
same-origin/login fence — the plugin opens no port, stores no credential and talks to nothing but the
host.
The prompt is prompt-optimizer's original text. The only change: the Mustache
{{#helpers.toJson}}{{{originalPrompt}}}{{/helpers.toJson}} placeholder becomes a local
JSON.stringify(draft) — same effect, no template engine.
Configuration
None. To try a more aggressive rewrite (analytical, structured, output-format oriented, …), edit
SYSTEM_PROMPT and renderUserPrompt in index.js; upstream ships 144 templates to choose from.
Development
npm test
Three layers, fully offline — no installs, no network:
- Pure functions: prompt rendering, code-fence stripping, model route resolution, six failure modes.
- Host wiring: route registration, 405/415/400 guards, success and error envelopes.
- Browser half: fake
window.__ModuleLoader__/ React loading the realclient.js, asserting the module id, theinjectdeclaration, and that the button really registers intoconversation.input.right.
Known limits
- Only works in profiles that serve a browser UI (desktop / web). Under headless, tui and sdk the
host half still loads, but the
/apiroute is not registered and the front end never gets the button. - Depends on the host
llm,agentDefaultModelandconnectionservices. If any is missing the button is not rendered or the call errors out — it never fails silently. inputActions.setDraftreplaces the whole draft, so the caret position is not preserved.- 24000 characters per request, 150 second timeout.
Uninstall
dsh plugin --profile desktop remove @lklkuu/dsh-prompt-optimizer
License
MIT, see LICENSE.
The prompt template text comes from linshenkx/prompt-optimizer (AGPL-3.0) and is quoted here as prompt text, credited in the source comments and in this file. This repository contains none of its program code.
Links
More in this category
zhu1090093659/dsh-web#packages/dsh-task-board★ 10458
Task board for the dsh web GUI: a sidebar multi-column kanban whose cards run in real DSH agent sessions and can also be scheduled with cron expressions, executed host-side even with the browser closed.
zhu1090093659/dsh-web#packages/dsh-web-all★ 10458
Plugin and skin collection for the DSH Web UI: task board, Git graph, right-side panel, remote mobile UI, pet, live token stats, and a skin center.
ccch1mneyyy/dsh-TUI★ 7797
Claude Code-style full-screen terminal UI: pixel-whale header, live status line, and streaming thought expansion.
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 7271
A fixed-corner whale widget for the DSH web GUI — balance, today's usage and per-turn cost with peak/off-peak pricing, editable balance-alert and daily-budget bubbles, a module-based custom bubble queue with A/B weighted choices and random lines or images, 30+ vendor templates (OpenAI, OpenRouter, Kimi, SiliconFlow, Ark, Zhipu, MiniMax and more) with per-model balance and subscription quota, plus task-end sound, imported audio, custom roles and a resource manager. Local-only, no telemetry.
omdsh-dev/DSH-better-sidebar★ 5191
Full sidebar workbench with file rendering and editing, terminal, Git, and subagents; third-party plugins can register new tabs.
omdsh-dev/dsh-genui★ 1007
Interactive UI components rendered inline in replies: layout, charts, forms, quizzes, mermaid, 3D scenes, and an action event loop back to the model.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.