dsh-compass
huodian4/dsh-compass
在输入框旁加一个自检按钮:用一次独立模型调用总结当前会话在做什么、有没有跑偏、遇到什么问题,并可把纠正建议填进输入框。
安装
dsh plugin --profile web add github:huodian4/dsh-compassREADME
Compass
Sample data. The panel is drawn with the plugin's own CSS; the chat around it is a mock-up.
A side-channel self-check for DeepSeek Harness (DSH): one click asks a second model call what the running session is doing right now — what it is working on, how far it got, whether it looks off track, and what problems it hit — without touching the work in progress.
Long agent runs are opaque. You do not want to interrupt the model to ask "what are you doing?", and you do not want to wait for a turn to end to find out it went the wrong way ten tool calls ago.
Compass reads the session log and asks a separate model call to summarise it. The main turn is never touched: no session event is appended, no turn starts, nothing is cancelled. The summary appears in a small floating panel you can drag anywhere, close, refresh, or copy.
Use it
- With a session open, click the pulse icon at the right of the composer tool row. A green dot marks a session that is currently running.
- The panel shows the answer plus a few facts read from the log: running state, turn, tool calls, failures, the model used, elapsed time, and when the check was produced.
- When the observer is not satisfied it adds a fifth block, 纠正建议 / Correction. Its button inserts that text into the composer at the caret — nothing is sent until you send it yourself.
- Drag the title bar to move the panel (the position is remembered per browser). Double-click the title bar to snap it back to the top-right.
- The icon colour follows the last verdict: green on track, amber risky, red off track.
- The gear in the title bar opens settings: the model used for the check, the answer language,
the observer prompt, the answer sections (add, rename, delete, mark which one fills the composer),
and an optional automatic check interval typed in minutes (empty = off; it runs only while the
session is running and skips the call when nothing new was recorded). Settings live in this
browser; config
promptandsectionsset the defaults for everyone.
Each check costs one extra model request (input: a tail of the transcript, capped; output: at most
maxOutputTokens). The panel is display-only: nothing is written to the workspace or the session log.
The interface itself is bilingual: it follows the DSH UI language, so a Chinese DSH shows Chinese labels with no separate build — and the answer language is a per-browser setting (auto / 中文 / English).
Install
git clone https://github.com/huodian4/dsh-compass.git
Then either:
- Plugins → Add plugin → pick the cloned directory, or
- let the agent run
plugin_manager install_bundlewith its absolute path.
Installing the directory links it, so edits take effect after a plugin restart. No build step, no
dependencies. Tested on DeepSeek Harness 0.2.2-rc.5 (Node 24).
Configuration
Optional fields on the compass row in the profile's cordis.patch.yml:
- id: compass
name: dsh-compass
config:
# Model route for the observer call. Omit both to reuse the session's own route.
# provider: deepseek-account
# model: deepseek-flash
language: auto # auto | zh | en
prompt: '' # default instruction body; the panel editor overrides it per browser
instructions: '' # extra requirement appended after the generated contract
# sections: # replace the built-in five; mark the one that fills the composer
# - { id: status, title: 状态, hint: 一句话说清现在在干什么 }
# - { id: fix, title: 下一步, hint: 给出可直接执行的下一步, insertable: true }
# reasoningEffort: low # default: the lowest effort the model advertises
maxInputBytes: 40000 # transcript budget, UTF-8 bytes
maxOutputTokens: 2000 # output cap for one check
timeoutMs: 60000 # end-to-end deadline
tailEvents: 60 # number of readable log events taken from the tail
How it works
| Half | File | Responsibility |
|---|---|---|
| Host | index.js | Registers POST /api/dsh-compass/summarize and GET /api/dsh-compass/settings through ctx.connection.fetch, reads the live session log (or the persisted log for a cold session), renders a compact transcript, makes one ctx.llm.stream call, and parses the five answer sections. |
| Client | client.js | A button in conversation.input.right (session identity arrives through the slot registration's inject, composer insertion through inputActions) and a draggable panel with settings in shell.overlay. |
The observer call passes no sessionId, so it is not attributed to the session, and the plugin never
calls session.append. The summary is another model's inference over an excerpt: treat "是否跑偏"
as a hint, not a verdict.
Limitations
- The observer reads the committed log, so the last few seconds of a streaming step may be missing; the panel reports the read position instead of pretending otherwise.
- The panel lives in the current page: it disappears on reload. Only the position and your custom
prompt are remembered (in
localStorage). - There is no per-session history of past checks.
- Host behaviour can hide the whole composer tool row while an
activityoccupant (such as voice input) is active; the button goes with it.
Development
node test/host-smoke.mjs
The harness mounts the Host half against a fake context and checks the request envelope, the transcript rendering, both languages, and the custom-instruction merge. It needs no network.
License
MIT