dsh-ui-tweaks 0.16.2 → 0.16.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 dsh-ui-tweaks contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-ui-tweaks contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md CHANGED
@@ -1,135 +1,127 @@
1
- # dsh-ui-tweaks
2
-
3
- > **Dependency**: currently targets **DSH v0.1.5-alpha.2**.
4
-
5
- A [DeepSeek Harness](https://deepseek-harness.github.io/deepseek-harness/) (DSH) web plugin that live-tunes the conversation UI from the Settings panel.
6
-
7
- ## Preview
8
-
9
- | | |
10
- |---|---|
11
- | ![Settings panel](assets/settings.png) | ![Branch panel](assets/git.png) |
12
- | **Settings panel**: code font size / neon-poster theme / two-decimal cache hit / web search / timeline / GitBar toggles, with dedicated **Archive**, **MCP** and **Search** pages in the left nav | **Branch panel**: pops down from the branch chip in the session header — local / remote branch lists, click to switch; pull button (fast-forward only) in the header, new-branch field at the bottom, plus a **commit graph** dialog (colored SVG fork/merge lanes) and **Tag** management |
13
- | ![Diff panel](assets/gitdiff.png) | ![Terminal panel](assets/terminal.png) |
14
- | **Code diff**: the code-diff tab in the right sidebar — file list (per-file checkboxes for partial commits) + per-file diff (changed hunks only by default, "Full file" toggle at the top right), with a commit area at the bottom for the message, an optional Tag, and Commit / Commit & push | **Terminal**: a real PTY terminal in the sidebar (xterm.js over WebSocket) — full interactivity |
15
- | ![Archive manager](assets/archive.png) | ![MCP manager](assets/mcp.png) |
16
- | **Archive manager**: an Archive page in the Settings dialog listing archived sessions (title / workspace / relative time) with per-row Restore / Delete and batch Restore all / Delete all | **MCP manager**: an MCP page in the Settings dialog listing configured MCP servers with live status and tool counts, plus full management (Add / Edit / Enable / Disable / Delete / Restart) |
17
-
18
- ## Features
19
-
20
- - **Code font size (px)** — absolute 8–32px, default 13 (DSH's stock code-block size at a 16px body); applies to code blocks, with inline code following proportionally. The legacy percentage (`codeFontScale`) stays compatible and is overridden once a px value is set. Message text keeps DSH's stock sizing.
21
- - **Theme (single choice in Layout, stock look by default)** — choose `Default` or **Neon poster**: a two-scheme poster skin — paper-white with ink-black hairlines in light mode, near-black with light hairlines in dark mode, both with lime highlights and an Anthropic-red action accent (buttons, links and selections follow the theme tokens automatically; code blocks and the composer card get hard offset shadows), applied live. Future skins will be added as further options the same way.
22
- - **Timeline (single choice in Features)** — one switch, two options:
23
- - **Native (default)** — DSH's built-in turn rail (the row of small dots beside the messages), the stock behavior.
24
- - **Web (classic)** — the v0.11 classic right-side navigation rail, restored: vertically centered on the message area's right edge, a thin line strip when collapsed, a 240px panel on hover (message previews + current-position highlight), a per-item detail bubble with timestamp, and **click to jump** (deep history pages in automatically before landing, with a landing self-check); wheel over the rail scrubs clipped items into reach. Data comes from the server-side `dshChatTimeline` session projection (every user message, independent of the browser's loaded window); sessions with fewer than two user messages hide it. On the web option the native turn rail is hidden with one theme-independent CSS rule (matching its `--turn-natural-height` inline variable), so the two never appear together.
25
- - **GitBar (toggleable, off by default)** — the standard trio for git-repo sessions: a **branch chip** in the session header, plus **terminal** and **code diff** tabs in the native right sidebar (next to Files, opened from the sidebar guide; uncommitted changes put a dot on the code diff tab):
26
- - **Branch chip** — beside the session title; shows the current branch and opens a downward branch panel (local / remote lists, `git switch` on click, new-branch field). A **pull** button sits beside the current branch in the panel header (`git pull --ff-only` — fast-forward only: a diverged branch aborts with git's own error instead of silently merging; hidden when the branch has no upstream), so what gets pulled is always the branch in the header. The panel's **Graph** entry opens the **commit graph** dialog: the latest 150 commits (`git log --date-order --all`) are laid out into lanes and rendered as a colored SVG fork/merge graph — dots are commits, curves are forks/merges, each branch line keeps its own color and merge arcs adopt the color of the lane they join; rows highlight on hover, refresh in the header.
27
- - **Terminal** — a real PTY terminal in the sidebar (xterm.js over a WebSocket to a persistent shell in the session cwd) with theme-following colors. Leaving the tab only drops the frontend connection; the host shell stays alive and replays its transcript, so you come back to the same session.
28
- - **Code diff** — changed-file list + per-file diff (changed hunks only by default, "Full file" toggle at the top right). The file-list / diff / commit sections split with draggable horizontal dividers (double-click resets; the message box stretches, Shift+Enter for new lines). The **commit band stays at the foot** (Commit / Commit & push, message required). Without a git repo the page shows a note instead of hiding.
29
- - Opening the project in external apps is DSH's own open-in-app header button, so this plugin no longer ships one; every git op runs server-side through `execFile('git', …)` (no shell, timeouts).
30
- - **Archive manager (toggleable, off by default)** — an **Archive** page in the Settings dialog listing archived sessions (title / workspace / relative time) with per-row **Restore** and **Delete** actions plus batch **Restore all** / **Delete all** buttons.
31
- - **Restore** removes a session from the archive set (its log and workspace slot are kept, so the conversation returns to the normal sidebar list).
32
- - **Delete** PERMANENTLY deletes the session — the server removes its JSONL log from disk, detaches it from workspace accounting and the archive set, and clears its projection cache (irreversible). Only genuinely **running** sessions are refused; opened-but-idle sessions are also removed from the in-memory store, so the row disappears live.
33
- - The list refreshes live via the `host/archived-sessions-changed` event and a session-list re-pull, with no page reload.
34
- - **MCP manager (toggleable, off by default)** — an **MCP** page in the Settings dialog listing every configured MCP server (`@deepseek-ai/dsh-mcp-client` loader entries) with its live status, command/url, env vars and registered tools, plus full management: **Add / Edit** (a structured form — instance id, name, stdio or HTTP type, timeout ms, command, args, env — OR raw YAML, both validated), **Enable / Disable / Delete**, and **Restart** (runtime-only). Changes persist to the profile's `cordis.patch.yml` and DSH's built-in patch watcher hot-reloads just that server.
35
- - **`/init` slash command (toggleable, off by default)** — type `/init` in the composer (the slash menu shows "Analyze this project and generate an AGENTS.md"), pick a prompt language from the popup (**Chinese / English**), and a complete AGENTS.md bootstrap prompt is submitted into the current session: the agent explores the project on its own (README, manifests, build scripts, key directories), then writes or improves a root `AGENTS.md` addressed to future AI coding agents (overview, common commands, conventions, directory guide, gotchas; existing files are improved in place). Pure client-side contribution; enable it in the UI Tweaks settings section.
36
- - **Task alerts (toggleable, off by default)** — call you back while the tab sits in the background. Watches **all sessions** (background included) for two event kinds: **finish** (the `running` flag drops, or the host's green `completed` reminder rises; a host projection of the logged `turn/end` reason tells **completed / interrupted / failed** apart, and failure alerts carry a truncated error summary) and **interaction** (the session starts waiting for your approval / plan review / answer — the same `pendingInteraction` source as the sidebar amber dot). Three independent channels:
37
- - **Tab title flash** — blinks an unread counter `(2) 🔔 …` into the tab title until you come back, then restores it;
38
- - **System notifications** (Web Notifications API) — desktop-level; **click one to jump straight to that session**; permission is requested from the settings toggle's click gesture; the OS bark and the chime are mutually exclusive so they never double-ring;
39
- - **Chime** — a two-note WebAudio motif synthesized in-process (rising = done, falling = needs you); no audio assets.
40
- - "Only when hidden" defaults on (no nagging while you watch the page); the first snapshot only arms the baseline (a page reload never fires a burst); events fire on transitions with a 2s per-session+kind cooldown (reconnect flicker absorbed); subagent child rows are skipped (the parent carries the turn). A **Test** button in Settings previews permission and channels in one click.
41
- - **Precise cache hit (toggleable, off by default)** — DSH's stats line shows the cache-hit share as a bare integer ("Cache hit 96%"). When enabled, the figure is rewritten to two decimals ("Cache hit 96.35%") and computed from the raw token buckets — cache reads ÷ billed input (uncached input + cache reads + cache writes) — the same source as the stock number, just unrounded; a full hit shows 100.00%, and with no billed input the group is absent anyway. The toggle lives in the Layout settings group; turning it off restores the stock figure.
42
-
43
- All changes apply **live** — no reload needed. The same values can be hand-edited in the settings document:
44
-
45
- ```yaml
46
- ui-tweaks:
47
- timelineStyle: web # defaults to native (DSH's built-in turn rail); web is the classic web timeline
48
- themeStyle: neon-lime # defaults to default (DSH's stock look); neon-lime is the neon-poster skin
49
- gitBarEnabled: true # defaults to false (off); set true to enable GitBar
50
- archiveManagerEnabled: true # defaults to false (off); set true to show the Archive page
51
- initCommandEnabled: true # defaults to false (off); set true to register the /init slash command
52
- preciseCacheHitEnabled: true # defaults to false (off); set true to enable the two-decimal cache-hit figure
53
- notificationsEnabled: true # defaults to false (off); set true to enable task alerts (event filters & channels are per-item toggles in Settings)
54
- ```
55
-
56
- Settings entry: **Settings → UI Tweaks**.
57
-
58
- ## Install
59
-
60
- ```bash
61
- # from npm (recommended, prebuilt)
62
- npx -y @deepseek-ai/dsh plugin --profile web add dsh-ui-tweaks
63
-
64
- # from GitHub (source; runs the self-contained prepare build)
65
- npx -y @deepseek-ai/dsh plugin --profile web add github:wlj521/dsh-ui-tweaks
66
- ```
67
-
68
- The package spec after `add` is forwarded to pnpm verbatim, so versions can be
69
- pinned — `@version` for the npm package, `#tag` for the GitHub source:
70
-
71
- ```bash
72
- npx -y @deepseek-ai/dsh plugin --profile web add dsh-ui-tweaks@0.12.0 # pin the npm version
73
- npx -y @deepseek-ai/dsh plugin --profile web add github:wlj521/dsh-ui-tweaks#v0.12.0 # pin a git tag
74
- ```
75
-
76
- For GitHub installs, pnpm may ask you to approve the package's build script —
77
- add the exact key it prints to the profile's `pnpm-workspace.yaml`:
78
-
79
- ```yaml
80
- allowBuilds:
81
- dsh-ui-tweaks: true
82
- ```
83
-
84
- …then run `add` again. Restart DSH web once after installing (bundle plugins
85
- are scanned at process start).
86
-
87
- > If pnpm reports symlink/hoist errors, set `nodeLinker: hoisted` in the
88
- > profile's `pnpm-workspace.yaml`.
89
-
90
- ## Development
91
-
92
- ```bash
93
- pnpm install
94
- pnpm build # tsc (server) + tsc (client) + bundle lib/client.js
95
- pnpm typecheck
96
- ```
97
-
98
- Load against a running DSH with an overlay, or install as a bundle:
99
-
100
- ```bash
101
- npx -y @deepseek-ai/dsh web --patch ./cordis.patch.yml # dev overlay
102
- npx -y @deepseek-ai/dsh plugin --profile web add . # bundle install from this checkout
103
- ```
104
-
105
- ## How it works
106
-
107
- - **Server** (`src/index.ts`) registers the `ui-tweaks` settings namespace and
108
- mounts a same-origin route (`/_dsh/ui-tweaks/settings`) the Web settings
109
- RPC only exposes a fixed allowlist of namespaces since rc.6, so a custom route
110
- is how a plugin owns a configuration page.
111
- - **Browser** (`src/client/index.tsx`) reads/writes that route, renders the
112
- Settings section, and applies the values live via a runtime `<style>` element
113
- that overrides stable DSH anchors (`body` markdown code-font tokens, markdown
114
- tables inside `[data-slot="conversation.chat.node"]`).
115
- - **Precise cache hit** (`src/client/cachehit.tsx`) mounts a null-rendering
116
- seat in the `conversation.composer.dock` slot (the band hosting the stock
117
- stats line) and reads the session's token usage through the framework's
118
- fifth standard hook, `useProjection('tokenUsage')` the disjoint
119
- uncached-input / cache-read / cache-write / output buckets. It computes
120
- `cache reads ÷ (uncached input + cache reads + cache writes)`, formats it
121
- with `.toFixed(2)`, and rewrites the stats line's "Cache hit N%" /
122
- 「缓存命中 N%」text in place newer DSH renders the figure as a bare text
123
- node after a separator inside the usage pill (its button `aria-label` and
124
- the matching row of the click-open usage dialog are rewritten too; the
125
- per-turn dialog uses its own denominator and is left alone) — layout,
126
- truncation and tooltip behavior stay DSH's own. A MutationObserver on the
127
- document re-applies whenever React repaints the line or opens the dialog
128
- (writes are idempotent, so the loop settles immediately); toggling
129
- off or switching sessions restores the original texts. Registration follows
130
- the /init command's on-demand choreography: mounted only while
131
- `preciseCacheHitEnabled` is on.
132
-
133
- ## License
134
-
135
- MIT
1
+ # dsh-ui-tweaks
2
+
3
+ > **Dependency**: currently targets **DSH v0.1.5-rc.2**.
4
+
5
+ A [DeepSeek Harness](https://deepseek-harness.github.io/deepseek-harness/) (DSH) web plugin that live-tunes the conversation UI from the Settings panel.
6
+
7
+ ## Preview
8
+
9
+ | | |
10
+ |---|---|
11
+ | ![Settings panel](assets/settings.png) | ![Branch panel](assets/git.png) |
12
+ | **Settings panel**: code font size / neon-poster theme / two-decimal cache hit / web search / timeline / GitBar toggles, with dedicated **Archive**, **MCP** and **Search** pages in the left nav | **Branch panel**: pops down from the branch chip in the session header — local / remote branch lists, click to switch; pull button (fast-forward only) in the header, new-branch field at the bottom, plus a **commit graph** dialog (colored SVG fork/merge lanes) and **Tag** management |
13
+ | ![Diff panel](assets/gitdiff.png) | ![Terminal panel](assets/terminal.png) |
14
+ | **Code diff**: the code-diff tab in the right sidebar — file list (per-file checkboxes for partial commits) + per-file diff (changed hunks only by default, "Full file" toggle at the top right), with a commit area at the bottom for the message, an optional Tag, and Commit / Commit & push | **Terminal**: a real PTY terminal in the sidebar (xterm.js over WebSocket) — full interactivity |
15
+ | ![Archive manager](assets/archive.png) | ![MCP manager](assets/mcp.png) |
16
+ | **Archive manager**: an Archive page in the Settings dialog listing archived sessions (title / workspace / relative time) with per-row Restore / Delete and batch Restore all / Delete all | **MCP manager**: an MCP page in the Settings dialog listing configured MCP servers with live status and tool counts, plus full management (Add / Edit / Enable / Disable / Delete / Restart) |
17
+
18
+ ## Features
19
+
20
+ - **Code font size (px)** — absolute 8–32px, default 13 (DSH's stock code-block size at a 16px body); applies to code blocks, with inline code following proportionally. The legacy percentage (`codeFontScale`) stays compatible and is overridden once a px value is set. Message text keeps DSH's stock sizing.
21
+ - **Theme (single choice in Layout, stock look by default)** — choose `Default` or **Neon poster**: a two-scheme poster skin — paper-white with ink-black hairlines in light mode, near-black with light hairlines in dark mode, both with lime highlights and an Anthropic-red action accent (buttons, links and selections follow the theme tokens automatically; code blocks and the composer card get hard offset shadows), and the composer's reasoning-effort label is tinted by intensity (green / amber / blue / violet, with a same-hue wash sweeping option rows on hover), applied live. Future skins will be added as further options the same way.
22
+ - **Timeline (single choice in Features)** — one switch, two options:
23
+ - **Native (default)** — DSH's built-in turn rail (the row of small dots beside the messages), the stock behavior.
24
+ - **Web (classic)** — the v0.11 classic right-side navigation rail, restored: vertically centered on the message area's right edge, a thin line strip when collapsed, a 240px panel on hover (message previews + current-position highlight), a per-item detail bubble with timestamp, and **click to jump** (deep history pages in automatically before landing, with a landing self-check); wheel over the rail scrubs clipped items into reach. Data comes from the server-side `dshChatTimeline` session projection (every user message, independent of the browser's loaded window); sessions with fewer than two user messages hide it. On the web option the native turn rail is hidden with one theme-independent CSS rule (matching its `--turn-natural-height` inline variable), so the two never appear together.
25
+ - **GitBar (toggleable, off by default)** — the standard trio for git-repo sessions: a **branch chip** in the session header, plus **terminal** and **code diff** tabs in the native right sidebar (next to Files, opened from the sidebar guide; uncommitted changes put a dot on the code diff tab):
26
+ - **Branch chip** — beside the session title; shows the current branch and opens a downward branch panel (local / remote lists, `git switch` on click, new-branch field). A **pull** button sits beside the current branch in the panel header (`git pull --ff-only` — fast-forward only: a diverged branch aborts with git's own error instead of silently merging; hidden when the branch has no upstream), so what gets pulled is always the branch in the header. The panel's **Graph** entry opens the **commit graph** dialog: the latest 150 commits (`git log --date-order --all`) are laid out into lanes and rendered as a colored SVG fork/merge graph — dots are commits, curves are forks/merges, each branch line keeps its own color and merge arcs adopt the color of the lane they join; rows highlight on hover, refresh in the header.
27
+ - **Terminal** — a real PTY terminal in the sidebar (xterm.js over a WebSocket to a persistent shell in the session cwd) with theme-following colors. Leaving the tab only drops the frontend connection; the host shell stays alive and replays its transcript, so you come back to the same session.
28
+ - **Code diff** — changed-file list + per-file diff (changed hunks only by default, "Full file" toggle at the top right). The file-list / diff / commit sections split with draggable horizontal dividers (double-click resets; the message box stretches, Shift+Enter for new lines). The **commit band stays at the foot** (Commit / Commit & push, message required). Without a git repo the page shows a note instead of hiding.
29
+ - Opening the project in external apps is DSH's own open-in-app header button, so this plugin no longer ships one; every git op runs server-side through `execFile('git', …)` (no shell, timeouts).
30
+ - **Archive manager (toggleable, off by default)** — an **Archive** page in the Settings dialog listing archived sessions (title / workspace / relative time) with per-row **Restore** and **Delete** actions plus batch **Restore all** / **Delete all** buttons.
31
+ - **Restore** removes a session from the archive set (its log and workspace slot are kept, so the conversation returns to the normal sidebar list).
32
+ - **Delete** PERMANENTLY deletes the session — the server removes its JSONL log from disk, detaches it from workspace accounting and the archive set, and clears its projection cache (irreversible). Only genuinely **running** sessions are refused; opened-but-idle sessions are also removed from the in-memory store, so the row disappears live.
33
+ - The list refreshes live via the `host/archived-sessions-changed` event and a session-list re-pull, with no page reload.
34
+ - **MCP manager (toggleable, off by default)** — an **MCP** page in the Settings dialog listing every configured MCP server (`@deepseek-ai/dsh-mcp-client` loader entries) with its live status, command/url, env vars and registered tools, plus full management: **Add / Edit** (a structured form — instance id, name, stdio or HTTP type, timeout ms, command, args, env — OR raw YAML, both validated), **Enable / Disable / Delete**, and **Restart** (runtime-only). Changes persist to the profile's `cordis.patch.yml` and DSH's built-in patch watcher hot-reloads just that server.
35
+ - **`/init` slash command (toggleable, off by default)** — type `/init` in the composer (the slash menu shows "Analyze this project and generate an AGENTS.md"), pick a prompt language from the popup (**Chinese / English**), and a complete AGENTS.md bootstrap prompt is submitted into the current session: the agent explores the project on its own (README, manifests, build scripts, key directories), then writes or improves a root `AGENTS.md` addressed to future AI coding agents (overview, common commands, conventions, directory guide, gotchas; existing files are improved in place). Pure client-side contribution; enable it in the UI Tweaks settings section.
36
+ - **Task alerts (toggleable, off by default)** — call you back while the tab sits in the background. Watches **all sessions** (background included) for two event kinds: **finish** (the `running` flag drops, or the host's green `completed` reminder rises; a host projection of the logged `turn/end` reason tells **completed / interrupted / failed** apart, and failure alerts carry a truncated error summary) and **interaction** (the session starts waiting for your approval / plan review / answer — the same `pendingInteraction` source as the sidebar amber dot). Three independent channels:
37
+ - **Tab title flash** — blinks an unread counter `(2) 🔔 …` into the tab title until you come back, then restores it;
38
+ - **System notifications** (Web Notifications API) — desktop-level; **click one to jump straight to that session**; permission is requested from the settings toggle's click gesture; the OS bark and the chime are mutually exclusive so they never double-ring;
39
+ - **Chime** — a two-note WebAudio motif synthesized in-process (rising = done, falling = needs you); no audio assets.
40
+ - "Only when hidden" defaults on (no nagging while you watch the page); the first snapshot only arms the baseline (a page reload never fires a burst); events fire on transitions with a 2s per-session+kind cooldown (reconnect flicker absorbed); subagent child rows are skipped (the parent carries the turn). A **Test** button in Settings previews permission and channels in one click.
41
+ - **Precise cache hit (toggleable, off by default)** — DSH's stats line shows the cache-hit share as a bare integer ("Cache hit 96%"). When enabled, the figure is rewritten to two decimals ("Cache hit 96.35%") and computed from the raw token buckets — cache reads ÷ billed input (uncached input + cache reads + cache writes) — the same source as the stock number, just unrounded; a full hit shows 100.00%, and with no billed input the group is absent anyway. The toggle lives in the Layout settings group; turning it off restores the stock figure.
42
+
43
+ All changes apply **live** — no reload needed. The same values can be hand-edited in the settings document:
44
+
45
+ ```yaml
46
+ ui-tweaks:
47
+ timelineStyle: web # defaults to native (DSH's built-in turn rail); web is the classic web timeline
48
+ themeStyle: neon-lime # defaults to default (DSH's stock look); neon-lime is the neon-poster skin
49
+ gitBarEnabled: true # defaults to false (off); set true to enable GitBar
50
+ archiveManagerEnabled: true # defaults to false (off); set true to show the Archive page
51
+ initCommandEnabled: true # defaults to false (off); set true to register the /init slash command
52
+ preciseCacheHitEnabled: true # defaults to false (off); set true to enable the two-decimal cache-hit figure
53
+ notificationsEnabled: true # defaults to false (off); set true to enable task alerts (event filters & channels are per-item toggles in Settings)
54
+ ```
55
+
56
+ Settings entry: **Settings → UI Tweaks**.
57
+
58
+ ## Install
59
+
60
+ ```bash
61
+ # from npm (recommended, prebuilt)
62
+ npx -y @deepseek-ai/dsh plugin --profile web add dsh-ui-tweaks
63
+
64
+ # from GitHub (source with prebuilt artifacts; no local build needed)
65
+ npx -y @deepseek-ai/dsh plugin --profile web add github:wlj521/dsh-ui-tweaks
66
+ ```
67
+
68
+ The package spec after `add` is forwarded to pnpm verbatim, so versions can be
69
+ pinned — `@version` for the npm package, `#tag` for the GitHub source:
70
+
71
+ ```bash
72
+ npx -y @deepseek-ai/dsh plugin --profile web add dsh-ui-tweaks@0.12.0 # pin the npm version
73
+ npx -y @deepseek-ai/dsh plugin --profile web add github:wlj521/dsh-ui-tweaks#v0.12.0 # pin a git tag
74
+ ```
75
+
76
+ Restart DSH web once after installing (bundle plugins
77
+ are scanned at process start).
78
+
79
+ > If pnpm reports symlink/hoist errors, set `nodeLinker: hoisted` in the
80
+ > profile's `pnpm-workspace.yaml`.
81
+
82
+ ## Development
83
+
84
+ ```bash
85
+ pnpm install
86
+ pnpm build # tsc (server) + tsc (client) + bundle lib/client.js
87
+ pnpm typecheck
88
+ ```
89
+
90
+ Load against a running DSH with an overlay, or install as a bundle:
91
+
92
+ ```bash
93
+ npx -y @deepseek-ai/dsh web --patch ./cordis.patch.yml # dev overlay
94
+ npx -y @deepseek-ai/dsh plugin --profile web add . # bundle install from this checkout
95
+ ```
96
+
97
+ ## How it works
98
+
99
+ - **Server** (`src/index.ts`) registers the `ui-tweaks` settings namespace and
100
+ mounts a same-origin route (`/_dsh/ui-tweaks/settings`) — the Web settings
101
+ RPC only exposes a fixed allowlist of namespaces since rc.6, so a custom route
102
+ is how a plugin owns a configuration page.
103
+ - **Browser** (`src/client/index.tsx`) reads/writes that route, renders the
104
+ Settings section, and applies the values live via a runtime `<style>` element
105
+ that overrides stable DSH anchors (`body` markdown code-font tokens, markdown
106
+ tables inside `[data-slot="conversation.chat.node"]`).
107
+ - **Precise cache hit** (`src/client/cachehit.tsx`) mounts a null-rendering
108
+ seat in the `conversation.composer.dock` slot (the band hosting the stock
109
+ stats line) and reads the session's token usage through the framework's
110
+ fifth standard hook, `useProjection('tokenUsage')` the disjoint
111
+ uncached-input / cache-read / cache-write / output buckets. It computes
112
+ `cache reads ÷ (uncached input + cache reads + cache writes)`, formats it
113
+ with `.toFixed(2)`, and rewrites the stats line's "Cache hit N%" /
114
+ 「缓存命中 N%」text in place — newer DSH renders the figure as a bare text
115
+ node after a separator inside the usage pill (its button `aria-label` and
116
+ the matching row of the click-open usage dialog are rewritten too; the
117
+ per-turn dialog uses its own denominator and is left alone) — layout,
118
+ truncation and tooltip behavior stay DSH's own. A MutationObserver on the
119
+ document re-applies whenever React repaints the line or opens the dialog
120
+ (writes are idempotent, so the loop settles immediately); toggling
121
+ off or switching sessions restores the original texts. Registration follows
122
+ the /init command's on-demand choreography: mounted only while
123
+ `preciseCacheHitEnabled` is on.
124
+
125
+ ## License
126
+
127
+ MIT