Adds a Compact context button and a New session button to the context meter panel; compact submits /compact through the same command channel, and new session starts a fresh session in the same workspace.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:shyuan-hub/dsh-compact-button
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
📑 Table of Contents
- ✨ Features
- 🚀 Install
- 🖥️ Desktop app
- 🖱️ Using the buttons
- 🔧 How it works
- 🛠️ Development & build
- ⚠️ Known limitations
✨ Features
- 🔘 One-click compact — long chats keep eating the context window and you used to type
/compactby hand; now the icon sits in the dock row right under your cursor - 🔁 Same command channel — goes through exactly the same path as typing
/compact(session.command('/compact')); the result shows up in the chat as a command row, no special behaviour - 🎯 Icon-only with hover tooltip — the buttons carry no text and match the context ring's look; hovering for 200ms raises the platform's native Tooltip, which then reports the outcome of your last click
- 🎨 Colour carries state — pulsing while submitting, business blue when submitted, error red on failure — readable without a label, resets after 4s
- 🌏 Multilingual — follows the DSH locale setting, switching between Chinese and English live
- 🆕 New session — starts a fresh session in the same workspace and navigates to it; the agent preset and permission policy follow the deployment default (see Known limitations for what that implies)
- 🪶 Zero patch, zero intrusion — registers into
conversation.composer.dock, a slot the platform declares and renders itself. No platform file is modified — neither the npm platform bundle nor the desktop app'sapp.asar
🚀 Install
Prerequisites: DSH installed (dsh web runs), Node.js ≥ 20, pnpm ≥ 10.
Option 1: from npm (recommended)
dsh plugin --profile web add dsh-compact-button@latest
# 1. Build and pack
git clone https://github.com/shyuan-hub/dsh-compact-button.git && cd dsh-compact-button
pnpm install && pnpm build
pnpm pack # produces dsh-compact-button-<version>.tgz
# 2. Install through dsh plugin (file: channel)
dsh plugin --profile web add "file:<your-local-dir>/dsh-compact-button-<version>.tgz"
After installing, restart dsh web and hard-refresh the browser (Cmd/Ctrl+Shift+R).
✅ No manual edits to the profile's
package.json: this package declaresdsh.bundle.patch, sodsh plugin addappends it todsh.profile.bundlesautomatically.🔧 For local iteration you can use the link channel instead:
dsh plugin --profile web add "link:<absolute path to your clone>", thenpnpm build+ restartdsh web.🔄 Updating:
dsh plugin --profile web add dsh-compact-button@latest, then restartdsh weband hard-refresh.
📦 The plugin ships its own bundle patch (
cordis.patch.yml): once installed into a profile it inserts this plugin's mount entry at boot, so you never edit the profile'scordis.patch.ymlby hand; if an aggregate bundle already mounts this plugin the entry stands down, avoiding a double mount. Note this is the cordis bundle-mount declaration layer only — it does not rewrite any platform code.
| Symptom | Cause and fix |
|---|---|
| No icons in the row | Check that dsh-compact-button is in the profile's dsh.profile.bundles and that you restarted dsh web. The icons register into conversation.composer.dock, which the platform declares and renders, so it is normally always present. |
| Tooltip says "Command not matched" after clicking | The current composer has no session that can accept a command. Switch to a page with an active session and retry. |
| Install / changes don't take effect | This plugin needs a dsh web restart (a browser hard-refresh alone is not enough); restart, then hard-refresh. |
🖥️ Desktop app
The desktop app takes exactly the same path as the web version — install the plugin into the desktop profile. You do not touch app.asar.
# The desktop profile is owned exclusively by the Electron app.
# Fully quit DeepSeek Harness → relaunch.
⚠️ The
dshCLI cannot manage the desktop profile (it reportsprofile "desktop" is managed exclusively by the Electron application). Plugin install/uninstall for the desktop app goes through the app's own plugin management UI.
Because the icons register into an official platform slot, the desktop app bundling the platform inside resources/app.asar is no longer an obstacle: the plugin code is read from the profile, and the slot is declared and rendered by the platform code in the archive. Neither side needs modifying.
🔄 No extra step after a desktop self-update. The update replaces
app.asar, which was never modified in the first place, and the plugin in the profile is untouched by it.
🖱️ Using the buttons
The dock row below the composer holds two icons side by side, to the left of the context ring: Compact (left) and New Session (right). The icons carry no text; purpose and state come from the Tooltip plus icon colour.
Compact context (left icon)
| State | Tooltip (zh / EN) | Icon |
|---|---|---|
| Idle | 压缩上下文 / Compact context | Normal (same tertiary label colour as the ring) |
| Submitting | 压缩中… / Compacting… | Pulsing (1s loop), button disabled against double-submit |
| Submitted | 已提交压缩 / Compaction submitted | Business blue |
| Not matched | 命令未匹配 / Command not matched | Normal |
| Failed | 提交失败 / Submission failed | Error red |
The state resets to idle after 4 seconds. Hovering at any time shows the result of the last click.
New session (right icon)
Clicking starts a new session in the current session's workspace and navigates to it (uiWorkspace.startSession()). The button locks for about 1.5 seconds after a click to absorb double-clicks. The new session uses the deployment's default agent preset and permission settings — if the current session uses a non-default preset, the new session will not inherit it (see Known limitations).
🔧 How it works
- Platform extension point:
@deepseek-ai/dsh-client-ui-conversationdeclares and rendersconversation.composer.dockitself — alist-kind official slot, a centered flex container in the row below the composer sharing the line withContextMeter(justify-content:center,gap:12px). The officialdsh-client-ui-chatactivityandusagepills register here too. - Client half: uses
slots.injectto wait for the declaration, then registers a side-by-side container (ContextActionRow) atorder: 10, after the official pills (activityatorder: 0,usageatorder: 1). Inside it,CompactButtonon the left andNewSessionButtonon the right:CompactButtoncallssession.command('/compact')— the same channel as a typed/compact(admission semantics belong to the Host's command-compact plugin; the result renders as a command row in the chat).NewSessionButtoncallsuiWorkspace.startSession()— opens a new session in the current session's workspace and navigates to it; locks for ~1.5s against double-clicks.- Both icons use the platform
Tooltipprimitive (side="top",delayMs={200}), matching the context ring's trigger behaviour.
- Visibility: the whole row returns
nulluntil the session has model activity, on the same criterion as the official pills (sessionStats.steps === 0; falls back totokenUsagewhendsh-session-statsis not composed). On a blank session there is no history to compact and the current session already is the new one. - Host half: inert.
apply()is an empty implementation, called once becausecordis.patch.ymlmounts the module onto the Node tree. The feature lives entirely client-side; there is nothing to do on the Node side. - i18n: dictionaries register under the
compactButtonnamespace (zh/en) and follow the DSH locale live.
Artifacts
| File | Channel |
|---|---|
lib/index.js |
Host half (inert apply(), keeps the bundle-mount contract) |
lib/client.js |
Official profile channel (bundle id = package name dsh-compact-button) |
lib/client-registry.js |
Plugin-registry channel (bundle id = manifest id dsh-external/dsh-compact-button) |
🛠️ Development & build
pnpm install
pnpm typecheck # tsc --noEmit
pnpm test # vitest run
pnpm build # rm -rf lib && tsdown → lib/index.js + lib/client.js + lib/client-registry.js
pnpm watch # tsdown --watch
Architecture: a single npm package with a host/client split — the host (src/index.ts) is an inert empty apply; the client (src/client/index.tsx) registers ContextActionRow into the official dock slot and handles state transitions and i18n. The plugin follows the official DSH conventions (no default export, dual client bundles) and does not depend on npm or a checkout at runtime.
Version-compatibility strategy (why no code change is needed per DSH release)
- No DSH peer dependencies. The plugin never imports a value from a platform package at runtime — the client bundle only
require("react"),require("react/jsx-runtime")andrequire("@deepseek-ai/dsh-client-ui-primitives")(all three are externals in the platform module table; seeCLIENT_EXTERNALSintsdown.config.ts), and services arrive through cordis injection. Sopackage.jsoncarries no@deepseek-ai/dsh-*peer/dev version range — a package manager can never pull out a second copy of the renderer to satisfy a range (a second slot-registry instance breaks slot registration outright). @deepseek-ai/dsh-client-ui-primitivesis typed by a local ambient declaration rather than a dependency. The version published to the registry is out of sync with what actually gets installed, so a devDependency would pin a range that cannot be resolved;src/client/primitives.d.tsmirrors the realTooltip.d.tssignature, giving types without a dependency. If the real signature grows, extra props are simply ignored.- Compatibility is decided by the official slot, not by patch anchors.
conversation.composer.dockis a public extension point the platform declares and renders. The plugin depends on neitherContextMeter's internals nor on build-output formatting, so there is no format drift to tolerate. As long as the slot exists, the plugin works. - Graceful degradation. If the slot were ever removed,
slots.injectwould never resolve and the result is simply "icons not rendered" — no throw, no effect on the rest of the platform.
⚠️ Known limitations
- Depends on the official
conversation.composer.dockslot, which the platform declares and renders. If upstream removes it or changes its semantics, the icons stop rendering (slots.injectnever resolves; silent degradation). - The dock is a centered flex row; the official
dsh-client-ui-chatalready occupiesorder: 0(activity) andorder: 1(usage). This plugin usesorder: 10to sit after them, leaving headroom so new official occupants need no change here. - The compact button only submits
/compact; admission and execution semantics belong to the Host-side command-compact plugin. - The state hint resets after 4 seconds; no compaction progress is shown.
- The new-session button opens a session in the same workspace but uses the deployment's default agent preset and permission settings; a non-default preset on the current session is not inherited (client-side
uiWorkspace.startSessionexposes no preset/permission selection).
Links
More in this category
zhu1090093659/dsh-web#packages/dsh-task-board★ 10597
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★ 10597
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.
ccch1mneyyy/dsh-TUI★ 8118
Claude Code-style full-screen terminal UI: pixel-whale header, live status line, and streaming thought expansion.
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 7427
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.
omdsh-dev/DSH-better-sidebar★ 5287
Full sidebar workbench with file rendering and editing, terminal, Git, and subagents; third-party plugins can register new tabs.
omdsh-dev/dsh-genui★ 1046
Interactive UI components rendered inline in replies: layout, charts, forms, quizzes, mermaid, 3D scenes, and an action event loop back to the model.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.