Improve the current chat draft before sending with a confirm-before-apply comparison.
Install
# from npm (prebuilt)
dsh plugin --profile web add @joe0001/dsh-prompt-optimizer
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:LHF198/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
This plugin publishes its README in Chinese only.
Improve the current chat draft before sending. One click optimizes the draft with the session's currently selected model, then shows an original-vs-result comparison so you decide before anything is applied.
在发送前优化当前聊天输入。一键用当前对话选中的模型优化草稿,并以 原文 / 优化结果对比 的方式呈现,由你确认后再采用。
Features
- Official entry points — the UI is mounted through official
slots(no DOM hacking, no replacement of shipped UI):- a button in the composer tool row (
conversation.input.left); - an action in the session header (
conversation.session.header.actions); - an
/optimizeslash command (inputTriggers, when available).
- a button in the composer tool row (
- Confirm before apply — the result opens in an inline comparison bar
mounted in
conversation.input.dock, showing 原始输入 / 优化结果 side by side; choose 采用优化结果 or 放弃. Narrow windows stack the columns vertically. - Never overwrites your typing — if you keep editing while the request is in flight, the bar warns you and disables "use optimized", so a late result can never clobber new content.
- Cancellable — the button becomes 取消 while the request runs; cancelling discards the late result.
- Uses your current model — optimization goes through the official
llmservice with the session's default model selection (agentDefaultModel). No extra credentials, no separate provider config. - Privacy by construction — only the text you actively submit from the composer is sent to the model; nothing is stored, no session history is read, no third-party service is called, and the HTTP route is loopback-only.
- Accessible & localized — aria-labels, keyboard-operable buttons, Esc / 放弃 to close; UI text follows the DSH locale (zh / en).
- Safe degradation — missing model, model error, empty result and request failure all surface a friendly message and never lose your draft.
- Shared state machine — every entry point (button, header action, slash command, comparison bar) reads one module-level state singleton, so all controls stay in sync (running spinner, error banner, cancelled toast).
Install
From the DSH market (once listed), npm, or a Git URL:
# npm / pnpm
npm install @joe0001/dsh-prompt-optimizer
# or from source
git clone https://github.com/LHF198/dsh-prompt-optimizer.git
cd dsh-prompt-optimizer
Then add the loader row (or use the market's install flow):
plugins:
- id: dsh-prompt-optimizer
name: '@joe0001/dsh-prompt-optimizer'
config: {}
After enabling, reload the Web GUI. A 优化 / Optimize action appears at the left
end of the composer tool row, in the session header, and as /optimize.
工程化说明:当前包为手写 bundle、无编译步骤——缺省情况下克隆即用,本地校验 用 package 的三个脚本:
npm run lint(对lib/index.js与lib/client.js做node --check)、npm run build(lint 后确认lib/client.js存在,并非真正的转译/打包)、npm run test(运行node test/verify.js)。pnpm 下等价为pnpm run <script>。 (当前仓库 URL 已指向LHF198;创建远程仓库并推送后,即可按docs/release.md发布。)
Usage
- Type a draft in the chat composer.
- Click 优化 (or the 取消 button while it runs).
- Review 原始输入 vs 优化结果.
- Click 采用优化结果 to replace the draft, or 放弃 to keep your text.
You can also press /optimize in the composer, or use the header action.
Compatibility
- Requires a DSH release that mounts the host services
webServer,llmandagentDefaultModel, the client servicesslots,localeandtimer, and the client slotsconversation.input.left,conversation.session.header.actionsandconversation.input.dock. The/optimizecommand additionally needs the optionalinputTriggersservice (the plugin degrades gracefully without it). Verified against DSH0.1.1-rc.2, cordis4.0.1. @deepseek-ai/*core packages are peerDependencies only — the plugin never ships its own copy and never shadows the host version.- The client bundle is a standard
window.__ModuleLoader__loader entry with an explicitdsh.client.injectlist (slots,locale,timer); no install-time build scripts. - The host route is loopback-only and fenced like other DSH web plugins.
- Local dev toolchain (for contributors): Node.js ≥ 20 (ESM host; verified on
Node v26.3.0) and pnpm (recommended; no
packageManagerpin yet).
Privacy
- Only the submitted draft text is processed.
- The optimization prompt is fixed and public (see
lib/index.js). - No content is persisted, logged as a session event, or sent anywhere other
than the currently selected model through DSH's own
llmservice.
Development
The package ships a hand-built bundle (lib/client.js) and a hand-written host
entry (lib/index.js); there is no compile step — the build script does not
transpile, it only validates that both halves are syntactically valid and that
the client bundle exists. Cloning and enabling is all that is needed to try it.
Validate and verify with the package scripts (run with npm or pnpm):
npm run lint # node --check lib/index.js && node --check lib/client.js
npm run build # lint + confirm lib/client.js exists
npm run test # node test/verify.js
Keep the client bundle free of JSX/TypeScript/import and always register UI
through the official slots API. When changing the client, bump the loader
entry revision so running pages pick up the new bundle.
See CONTRIBUTING.md for the contribution workflow, commit conventions and testing requirements. Architecture decisions are recorded under docs/adr (start at the index).
License
Apache-2.0 — see LICENSE.
Links
More in this category
zhu1090093659/dsh-web#packages/dsh-task-board★ 8670
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★ 8670
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.
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 4631
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.
ccch1mneyyy/dsh-TUI★ 4484
Claude Code-style full-screen terminal UI: pixel-whale header, live status line, and streaming thought expansion.
omdsh-dev/DSH-better-sidebar★ 4133
Full sidebar workbench with file rendering and editing, terminal, Git, and subagents; third-party plugins can register new tabs.
Devin-AXIS/deepseek-design#deepseek-idesign★ 1453
Visual design studio for websites, app prototypes, posters, cards, reports, and magazines, with templates, direct element editing, selection-aware AI draft handoff, and export.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.