
Security News
Deno Goes the Way of the Dinosaur
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.
dsh-prompt-optimizer
Advanced tools
DSH 输入框 prompt 优化插件:一键把草稿润色为更清晰、更结构化的高质量 prompt。默认使用当前会话模型(零配置,SSE 流式 + 推理过程实时可见),也支持自配 OpenAI 兼容 API。
English | 中文
One-click prompt polishing for the DSH composer: select nothing, just type a draft and press ✨ (or Alt+O) — the plugin rewrites it into a clearer, better-structured prompt. Zero-config by default: it follows the current session's model through the harness host services, so no API key is needed. A self-configured OpenAI-compatible endpoint is supported as an alternative.
Alt+O while the composer is focused does the samewebServer: every text-delta from llm.stream is pushed immediately and rendered token by token; reasoning is streamed first, so you watch the model think while it worksagentDefaultModel + llm services), no API key required/chat/completions endpoint (base URL + key + model)~/.dsh/prompt-optimizer-config.json via a loopback RPC channel, independent of the host settings registry
web or desktop profile^22.19.0 or >=24.0.0 (only needed to build from source)The bundle entry (
id: prompt-optimizer) is self-declared by this package'scordis.patch.yml— no manual patch file is needed.
dsh plugin --profile desktop add dsh-prompt-optimizer
For a web profile, use --profile web. Restart DSH (quit fully and reopen), then a ✨ button appears to the right of the composer.
git clone https://github.com/winditer/dsh-prompt-optimizer.git && cd dsh-prompt-optimizer
npm install
npm run build # produces dist/client.js
dsh plugin --profile desktop add . # links the workspace into the profile by package name
Or install by hand: in the target profile's package.json (e.g. ~/.dsh/profiles/desktop/package.json):
{
"dependencies": {
"dsh-prompt-optimizer": "link:/absolute/path/to/dsh-prompt-optimizer"
// ...
},
"dsh": {
"profile": {
"bundles": [ /* ... */, "dsh-prompt-optimizer" ]
}
}
}
then pnpm install inside the profile directory and restart DSH.
Remove dsh-prompt-optimizer from the profile's dependencies and dsh.profile.bundles, clean up the installed package, and delete the config file ~/.dsh/prompt-optimizer-config.json if you no longer need it.
Alt+O) — the preview card appears over the composerOpen 设置 → 通用设置 → Prompt 优化:
| Setting | Default | Meaning |
|---|---|---|
| 使用当前会话模型 | on | Follow the session/agent default model (zero-config). Off: enable the fields below |
| 接口地址 (base URL) | https://api.deepseek.com | Any OpenAI-compatible /chat/completions endpoint |
| API Key | — | Your key for the custom route (ignored in follow mode) |
| 模型名 | deepseek-v4-flash | Model name (ignored in follow mode) |
Settings are saved in ~/.dsh/prompt-optimizer-config.json (same directory as other DSH config; removed with the plugin).
Custom endpoints must support CORS and SSE streaming (official DeepSeek, OneAPI-style gateways work).
Two halves, one package:
lib/index.js. Persists config over a loopback RPC channel (/dsh-prompt-optimizer, get/set), and registers an HTTP JSON API at /dsh-prompt-optimizer/api through the harness webServer service. Runs the session-default optimization via llm.stream; background streams live in an in-memory Map cleared on unload.src/*.ts, bundled to dist/client.js (esbuild, wrapped in __ModuleLoader__.load({ id: "dsh-prompt-optimizer", … }); the id must equal the installed package name). Renders into the conversation.input.right button, conversation.input.overlay preview card and settings.general.item row; talks to the host with fetch POSTs.All endpoints are POST /dsh-prompt-optimizer/api/<method>; every response is { ok: true, value } or { ok: false, error }.
| Method | Body | Returns |
|---|---|---|
sessionModel | {} | { provider, model, reasoningEffort? } — the session's default model |
optimize.stream | { provider, model, text, system?, reasoningEffort? } | text/event-stream — event: reasoning frames first, then event: delta per token, event: done at the end |
optimize.start | { provider, model, text, system?, reasoningEffort? } | { taskId } — background accumulation (fallback path) |
optimize.poll | { taskId } | { done, text, error? } — accumulated text while streaming |
optimize.abort | { taskId } | { ok } |
Protocol details: only POST is accepted (405 otherwise); the body is JSON with a 1 MB cap; unknown methods return 404.
~/.dsh/prompt-optimizer-config.json), and only goes to the endpoint you configured.npm run build # esbuild: src/index.ts → dist/client.js (__ModuleLoader__ bundle)
npm test # node runner over tests/entry.ts (state machines, channels, SSE parser)
src/index.ts Client entry — slot wiring, RPC/config glue, host probes
src/OptimizeButton.tsx / PreviewCard.tsx / SettingsRow.tsx
src/optimizer.ts Config defaults, system prompts, OpenAI-compatible fetch/SSE client
src/session-optimizer.ts Host channel: sessionModel + SSE stream + fallback poll
src/preview-state.ts Preview card state machine (pure reducer)
src/preview-bus.ts Module-level event bus shared by button / card / orchestration
lib/index.js Host half — config persistence + HTTP JSON API (makeHandler + createApiRoute)
dist/client.js Built client bundle (__ModuleLoader__ format, load id = dsh-prompt-optimizer)
cordis.patch.yml Bundle entry declaration (insert: { id: prompt-optimizer, name: dsh-prompt-optimizer })
scripts/build.mjs Build script (esbuild + bundle wrapper)
tests/entry.ts Unit + integration tests (61)
assets/ Screenshot
Bundle id must equal the package name — arrive() throws bundle loaded without registering <id> otherwise. scripts/build.mjs hardcodes the correct id.
Profile bundles don't get the cordis timer service — use plain browser setInterval/setTimeout (disposed in React effect cleanup), exactly like the sibling dsh-elf bundle.
Do not use session.create/fork for generation — a background session never executes (the renderer's fabricated ids are silently rejected, forked sub-sessions don't trigger the model), which manifested as "optimizing forever". Drive the model from the host half via llm.stream instead.
Do not run the streaming protocol over connection.rpc.call — on desktop the renderer's rpc.call hangs on the second call within one flow (verified: sessionModel ok, next call never arrives). Host channels go over HTTP (webServer).
Prefer link: over file: when installing a workspace copy — file: copies files, so edits/rebuilds go stale.
Client changes go live on page refresh; host changes require a full DSH restart.
A broken build script silently keeps the old bundle — npm run build must print ✓ Built; if it only prints a Node version banner, the script is failing (a past regression left a stale dist/client.js that looked "current").
Fresh publishes can trip the profile's minimumReleaseAge policy — if the profile enforces pnpm's release-age supply-chain check, a version published less than ~24 h ago fails dsh plugin … add <pkg> with ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION. Add the exact name@version to minimumReleaseAgeExclude in the profile's pnpm-workspace.yaml (and keep the entry current when you release a new version):
minimumReleaseAgeExclude:
- dsh-prompt-optimizer@2.0.0
FAQs
DSH 输入框 prompt 优化插件:一键把草稿润色为更清晰、更结构化的高质量 prompt。默认使用当前会话模型(零配置,SSE 流式 + 推理过程实时可见),也支持自配 OpenAI 兼容 API。
The npm package dsh-prompt-optimizer receives a total of 205 weekly downloads. As such, dsh-prompt-optimizer popularity was classified as not popular.
We found that dsh-prompt-optimizer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.

Security News
Anthropic’s free OSS Scanner uses Mythos and other Claude models to find open source vulnerabilities and send maintainers reports with proposed fixes.

Security News
On Front Lines’ Early Adopters: CISO podcast, Andrew Becherer shares lessons from Datadog, weighs the long-term costs of AI-built tools, and explains how founders can actually gain a CISO’s trust.