rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
Relethe/dsh-thinking-effort-autoswitcher
DSH thinking-effort auto-switcher: Scores the turn by how far the conversation has drifted from the main objective and by the number of failures, picks the thinking effort from that score, and labels every finished turn with the effort it sent.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:Relethe/dsh-thinking-effort-autoswitcher
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
English | 简体中文


A DSH plugin that turns the composer model selector into a compact
model + thinking-effort picker, adds an Auto level, and shows the effort each
turn actually used.
Version 0.1.0. Scope and limitations are listed below.
conversation.input.model slot. The
menu lists models grouped by provider, then the current model's real effort
levels (off / low / high / max, whatever the provider exposes) and an
Auto entry.← decreases, → increases. The ladder is
[real levels…, Auto]: → from the highest level lands on Auto, ← from
Auto returns to the highest level. There is no wrap-around.localStorage['thinking-effort:caret-priority'] = '1' and reload to give the
caret priority again.Auto is on, each completed turn shows the
effort that turn actually sent (read from request/header events, not
from the current picker state). Turns without a recorded header show
default.localStorage['thinking-effort:no-replace'] = '1' and reload: a compact
effort chip in conversation.input.left takes over.Link the plugin into the profile's dependencies and list it in
dsh.profile.bundles; the bundle's own cordis.patch.yml inserts the loader
row, so the profile patch needs no extra entry.
// ~/.dsh/profiles/<profile>/package.json
{
"dependencies": { "dsh-thinking-effort-autoswitcher": "link:C:/path/to/thinking-effort-plugin" },
"dsh": { "profile": { "bundles": ["...", "dsh-thinking-effort-autoswitcher"] } }
}
Then fully restart DSH (the Host half only loads at startup).
The Host exposes two same-origin JSON routes:
| Route | Purpose |
|---|---|
POST /thinking-effort/evaluate |
score the current turn and return a target level; apply: true applies it |
POST /thinking-effort/turns |
return the effort each turn actually sent (from request/header) |
failure (0–5, deterministic) — only the latest turn. A tool call
failing ≥2 times with the same name and arguments is one repeat group worth
2; a turn/end with reason.kind === 'error' adds 2; capped at 5.
importance (0–10, judged) — one small model call comparing the latest
user message against an anchor. The anchor is the active goal objective
when a goal is running, otherwise the first user message. Closer to the
anchor and larger blast radius score higher; peripheral exploration scores
lower. The judge uses the model's lowest level (preferring off); if the
reply cannot be parsed the score falls back to 5 and importanceRaw is
returned for debugging.
mapping:
total = wI * importance + wA * failure
maximum = wI * 10 + wA * 5
interval = maximum / levelCount
index = floor(total / interval) // clamped to 0 … levelCount-1
Weights live in the plugin's patch row and only their ratio matters:
- insert:
- id: thinking-effort
name: 'dsh-thinking-effort-autoswitcher'
config:
weights: { importance: 1, failure: 1 }
Auto evaluates immediately (cold start lands on the middle
level first);/thinking-effort/turns groups request/header events between turn/start
and turn/end:
{"ok":true,"turns":[{"turn":1,"effort":"low","seq":18,"endSeq":100}]}
The Client caches the answer per session, matches each turn-tail entry by its
closing seq (then by the last endSeq <= seq, then by turn number), and
shows that recorded effort; only when the route is unavailable does it fall
back to the live selection.
The Host half loads only when:
node_modules;index.js exports export const inject = ['webServer'].Point 3 bit this plugin once: without a declared dependency, apply can run
before the HTTP carrier exists, ctx.get('webServer') is undefined, the code
silently returns, and the plugin still reports fiberPhase: active while every
request falls through to the SPA fallback (405 with allow: GET, HEAD).
Self-check:
curl.exe -s -X POST "http://127.0.0.1:<port>/thinking-effort/evaluate" `
-H "content-type: application/json" -H "sec-fetch-site: same-origin" `
-d '{"sessionId":"probe"}'
A structured JSON answer (for example {"ok":false,"error":"session-not-live"})
means the route is live; 405 means it is not.
request/header effort; it falls back
to the current selection only when the route is unavailable. Turns with no
recorded header (for example a cancelled turn) show default.conversation.input.model.label contributions from other plugins are not
forwarded.conversation.input.model.options (the menu's extra rows, added in DSH
0.2.2-rc.3) is declared so other plugins can still register into it, but it is
only rendered when the host passes a renderSlot helper into the seat; without
that helper the rows are silently absent.selectModel may be refused while an agent is running; the response carries
applied: false with applyError, and the UI keeps the manual choice.MIT — see LICENSE.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。