DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

Xxsttb /

Xxsttb/dsh-input-optimizer

Verified

DeepSeek Harness plugin: a four-pointed-star button left of the composer's model selector that rewrites your draft before you send it — fixing grammar, ambiguity and execution order — plus a dedicated settings page. AI-generated.

★ 0 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@9c43bb8e

dsh-input-optimizer

A DeepSeek Harness plugin that puts a four-pointed-star button left of the composer's model selector. Press it, and the draft you have typed — but not yet sent — is rewritten before it goes out: grammar and wording fixed, and ordering problems that would quietly weaken the result restructured.

It is not a summarizer and not an answer generator. It never replies to your request and never adds facts. It hands back the same request, written better.

[ star ] [ model selector ] [ send ]
   ^
   the button lives here

Everything is configurable on the plugin's own settings page: the rewrite instruction, whether to follow the conversation's model, the provider and model to pin instead, and how hard the model thinks.

Note on authorship. The code, the comments, the icon, the locale files and this document were all generated by an AI assistant, at a user's request. See AI-generated.


What it does

Press the star beside the model selector. The Host half sends your draft to the model the current conversation has selected — at low reasoning effort by default — and puts the rewritten text back into the composer, so you can read it before you send.

The rewrite targets five goals, in priority order:

# Goal What it means in practice
1 Preserve intent Adds nothing you did not write. No answers, no opinions, no examples, no preamble.
2 Fix language Grammar, spelling, punctuation, wrong word choice, ambiguous pronouns, broken agreement, machine-translated phrasing. Your language and register are kept.
3 Fix execution order Steps written out of order, prerequisites after the action needing them, a goal buried under background, constraints split from what they constrain, two unrelated asks tangled in one sentence.
4 Surface a clear implication If you list steps that obviously must run in sequence, it may say so. It never invents a requirement.
5 Tighten Removes filler, duplication and empty hedging.

Hard rules the instruction enforces: code, commands, file paths, identifiers, numbers, units, URLs, error messages and quoted text are preserved byte-for-byte; existing Markdown structure and list markers survive; the original language (including a deliberate mix) is kept; text that is already clear comes back unchanged; and the reply contains only the rewritten text — no Rewritten: heading, no surrounding quotes, no notes.

Behaviour you should know about

  • Your edits win. If you keep typing while a rewrite is in flight, the result is not applied and the button reports that the draft changed. The model's output never silently clobbers newer typing.
  • The whole draft is replaced. The result is written back as one edit, so a single undo restores what you had.
  • Empty drafts are refused before a provider is contacted.
  • The rewrite is a side call. It carries no session id and no purpose, so it never enters a conversation log and never trips the listeners that watch llm/stream for agent-loop traffic.

Requirements

  • DeepSeek Harness 0.2.0-rc.2 or newer (dsh.engines.dsh in package.json).
  • A profile whose composition includes the Harness web UI and the settings service — i.e. any normal desktop or web profile. The settings page needs @deepseek-ai/dsh-settings plus @deepseek-ai/dsh-config-editor, which the stock desktop and web profiles already carry.
  • At least one usable LLM provider. The plugin calls ctx.llm.stream(), so whatever the Harness itself can talk to will work.

Install

From a checkout of this repository:

dsh plugin --profile <profile> add /absolute/path/to/dsh-input-optimizer

A packed tarball works the same way and is the shape the profile stores:

pnpm pack
dsh plugin --profile <profile> add ./dsh-input-optimizer-1.0.0.tgz

Then reload the app (or just wait — Harness reconciles a changed dsh.profile.bundles list on the fly) and confirm:

curl http://127.0.0.1:19387/plugins/input-optimizer/models

{"ok":true,"providers":[…]} means the Host half is live. The star button appears on the next page load.

Uninstall

dsh plugin --profile <profile> remove dsh-input-optimizer

Settings saved on the plugin's page live in the profile's cordis.patch.yml under an input-optimizer entry; removing the plugin leaves that entry behind, and you can delete it by hand if you want the file clean.

Do not install with link: and then replace it with a tarball. A pnpm link: (junction) install points the profile at your working copy; replacing it deletes the junction and pnpm follows the reparse point, wiping the source directory. Development checkouts are better installed as tarballs, or tested on a throwaway profile.

Do not install by hand. Adding the package to the profile's package.json and node_modules yourself leaves the running process holding a stale module-resolution table, and the plugin will load as a dead row with no visible error. Let dsh plugin add do it. If you have already hand-edited, restart the app once.


Settings

Open Settings → Input optimizer. The page reads and writes this plugin's config through the Harness settings service, so edits are saved to the profile's cordis.patch.yml and survive restarts.

Field Default Purpose
Rewrite instruction the shipped prompt The system prompt sent with every rewrite. Clear the field and save to restore the default.
Follow the conversation's model on On: rewrite with whichever model the current conversation has selected. Off: always use the pinned model below.
Provider (empty) Used when following is off — or as a fallback when the followed model is unavailable.
Model (empty) Same.
Reasoning effort low How hard the model thinks. none sends no effort field at all. The list is read from the chosen model's own advertised efforts, so you cannot pick one a model does not support.
Max output tokens 4096 Ceiling for one rewrite.
Timeout 60000 ms Wall-clock ceiling for one rewrite.

The shipped rewrite instruction is the five-goal prompt in What it does. It is written by an AI, it is editable, and replacing it is the intended way to re-aim the optimizer.

On/off settings use a capsule switch rather than a checkbox, matching the Harness's own switch: the visual state keys off aria-checked, so what is drawn and what assistive technology reports cannot disagree. The plugin draws its own control because a client plugin may not require the Harness's client packages.

Model resolution

Each rewrite resolves a route in this order, and reports which one it used in the response:

  1. session — the model the current conversation has selected, when Follow the conversation's model is on and that model still resolves.
  2. config — the provider/model pinned on this page.
  3. Failure — a NO_MODEL error telling you to pick a model for the conversation or name one in the settings.

The effort is validated against the resolved model's advertised efforts. If a model does not support the requested effort, the request goes out without one rather than failing.


HTTP surface

The Client half talks to the Host half over three routes under /plugins/input-optimizer. They are same-origin only.

Route Method Body / query Result
/optimize POST { text, session?: { provider, model } } { ok, text, provider, model, routeSource, reasoningEffort, truncated }
/models GET — { ok, providers: [{ id, name, models: [{ id, name }] }] }
/models/efforts GET ?provider=&model= The efforts that model advertises

Errors are JSON: { ok: false, error: { code, message } }. Codes you may see:

Code HTTP Meaning
BAD_JSON 400 The body was not valid JSON.
EMPTY_INPUT 400 The draft was empty or whitespace.
CROSS_ORIGIN 403 The request did not come from the Harness UI.
BODY_TOO_LARGE 413 Body over 512 KiB.
INPUT_TOO_LARGE 413 Draft over 200,000 characters.
NO_MODEL 400 No usable model — see Model resolution.
TIMEOUT 504 The rewrite exceeded the configured timeout.
LLM_ERROR 502 The provider refused. Carries the provider's own llmCode.
MAX_TOKENS 502 The reply hit the output ceiling before finishing.
EMPTY_RESPONSE 502 The model returned nothing usable.

Layout

dsh-input-optimizer/
├── package.json         manifest: exports, dsh.bundle, dsh.client, engines
├── cordis.patch.yml     the insert row; its `id` is the settings namespace
├── icon.svg             the four-pointed star, used in plugin listings
├── locale/
│   ├── en.json          plugin title/description for the plugin list
│   └── zh.json
└── lib/
    ├── index.js         Host half: Config schema, HTTP routes, the LLM call
    └── client.js        Client half: the star button, the settings page

lib/index.js is the Host half: it declares the configurable fields with schemastery, opens the three routes, and runs the rewrite through ctx.llm.stream(). lib/client.js is the Client half: it registers the star into the conversation.input.right slot — the seat immediately left of conversation.input.model — and the settings page into settings.section, and it loads no Harness package as a module, per the client rules.

The id in cordis.patch.yml (input-optimizer) is load-bearing. The Harness settings service addresses a plugin's volatile fields by its profile entry id, so the Client half hard-codes the same literal rather than importing the Host half to learn it.


Development

The plugin is a plain two-half Harness bundle. Its Host half imports @deepseek-ai/schemastery and @deepseek-ai/dsh-llm as peer dependencies; a profile supplies those. To exercise the Host half outside a profile, point a local node_modules/@deepseek-ai/ at the Harness installation's own copies.

# syntax check both halves, using the Harness runtime as the Node executable
ELECTRON_RUN_AS_NODE=1 "$DSH_INSTALL/DeepSeek Harness.exe" --check lib/index.js
ELECTRON_RUN_AS_NODE=1 "$DSH_INSTALL/DeepSeek Harness.exe" --check lib/client.js

# build the tarball a profile installs
pnpm pack

The Client half is loaded by the Harness browser loader, not by Node: it wraps itself in window.__ModuleLoader__.load({ id, factory }) and may require only react and react/jsx-runtime.


AI-generated

Every part of this repository was produced by an AI assistant in response to a user's request:

  • lib/index.js, lib/client.js — implementation, including all comments;
  • icon.svg — the four-pointed star;
  • locale/en.json, locale/zh.json — plugin listing text;
  • cordis.patch.yml, package.json — the bundle wiring;
  • README.md — this document.

The AI did not copy from an existing plugin. It read the Harness's published skill for plugin authors, the slot and settings contracts shipped in the installation, and the source of installed third-party plugins to learn the conventions, then wrote this. Facts about Harness internals quoted here were verified against the running installation.

Review it before you rely on it. It was written against Harness 0.2.0-rc.2, and nothing guarantees it tracks later releases.

License

MIT © 2026 dsh-input-optimizer contributors

—/ 5

No ratings yet

Verified DSH bundle

Commit 9c43bb8eefd0

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout