dsh-ui-tweaks 0.10.2 → 0.11.0

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
@@ -42,6 +42,7 @@ A [DeepSeek Harness](https://deepseek-harness.github.io/deepseek-harness/) (DSH)
42
42
  - **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;
43
43
  - **Chime** — a two-note WebAudio motif synthesized in-process (rising = done, falling = needs you); no audio assets.
44
44
  - "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.
45
+ - **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.
45
46
 
46
47
  All changes apply **live** — no reload needed. The same values can be hand-edited in the settings document:
47
48
 
@@ -55,6 +56,7 @@ ui-tweaks:
55
56
  archiveManagerEnabled: true # defaults to false (off); set true to show the Archive page
56
57
  initCommandEnabled: true # defaults to false (off); set true to register the /init slash command
57
58
  whaleIndicatorEnabled: true # defaults to false (off); set true to enable the whale indicator
59
+ preciseCacheHitEnabled: true # defaults to false (off); set true to enable the two-decimal cache-hit figure
58
60
  notificationsEnabled: true # defaults to false (off); set true to enable task alerts (event filters & channels are per-item toggles in Settings)
59
61
  ```
60
62
 
@@ -120,6 +122,19 @@ npx -y @deepseek-ai/dsh plugin --profile web add . # bundle install from
120
122
  column grid and any right-sidebar layout push (`#root` margin-right);
121
123
  colors ride DSH theme tokens (`--dsw-alias-*`) for correct light/dark
122
124
  rendering.
125
+ - **Precise cache hit** (`src/client/cachehit.tsx`) mounts a null-rendering
126
+ seat in the `conversation.composer.dock` slot (the band hosting the stock
127
+ stats line) and reads the session's token usage through the framework's
128
+ fifth standard hook, `useProjection('tokenUsage')` — the disjoint
129
+ uncached-input / cache-read / cache-write / output buckets. It computes
130
+ `cache reads ÷ (uncached input + cache reads + cache writes)`, formats it
131
+ with `.toFixed(2)`, and rewrites the stats line's "Cache hit N%" /
132
+ 「缓存命中 N%」span in place — layout, truncation and tooltip behavior stay
133
+ DSH's own. A MutationObserver on the band re-applies whenever React repaints
134
+ the line (writes are idempotent, so the loop settles immediately); toggling
135
+ off or switching sessions restores the original texts. Registration follows
136
+ the whale's on-demand choreography: mounted only while
137
+ `preciseCacheHitEnabled` is on.
123
138
 
124
139
  ## License
125
140
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # dsh-ui-tweaks
2
2
 
3
- [DeepSeek Harness](https://deepseek-harness.github.io/deepseek-harness/)(DSH)Web UI 插件:在设置面板中实时调整对话界面——字体大小、表格样式、对话框宽度、可开关的对话时间线、**GitBar**(输入框工具行内的 git 状态胶囊:分支在权限旁、差异在模型前),可开关的**归档管理**(设置中的「归档」页面:查看、恢复或彻底删除已归档会话),以及可开关的**任务提醒**(会话完成或需要交互时,通过标签页标题闪烁 / 系统通知 / 提示音把你唤回来)。
3
+ [DeepSeek Harness](https://deepseek-harness.github.io/deepseek-harness/)(DSH)Web UI 插件:在设置面板中实时调整对话界面——字体大小、表格样式、对话框宽度、可开关的对话时间线、**GitBar**(输入框工具行内的 git 状态胶囊:分支在权限旁、差异在模型前),可开关的**归档管理**(设置中的「归档」页面:查看、恢复或彻底删除已归档会话),可开关的**任务提醒**(会话完成或需要交互时,通过标签页标题闪烁 / 系统通知 / 提示音把你唤回来),以及**缓存命中率两位小数**(把输入框下方统计条的缓存命中百分比改写为精确值)。
4
4
 
5
5
  ## 预览
6
6
 
@@ -45,6 +45,7 @@
45
45
  - **系统通知**(Web Notifications API):桌面级通知,**点击直达对应会话**;权限申请挂在设置开关的点击手势上;系统响铃与自有提示音互斥,绝不双重响;
46
46
  - **提示音**:WebAudio 现场合成的双音动机——上行=完成、下行=需要你处理,无音频资源文件。
47
47
  - 「仅页面不可见时」默认开启(正盯着页面时不打扰);首帧快照只武装不触发(刷新页面不刷屏);只在跳变沿触发 + 同会话同类事件 2 秒冷却(防重连抖动);子代理子会话不计(父会话承载整轮)。设置里有「测试」按钮,一键预览权限申请与通道效果。
48
+ - **缓存命中率两位小数(可开关,默认关闭)**:DSH 原生统计条里的缓存命中只显示整数百分比(如「缓存命中 96%」)。开启后改写为两位小数(如「缓存命中 96.35%」),且**直接用原始 token 数计算**——缓存读取 ÷ 计费输入(未缓存输入 + 缓存读取 + 缓存写入),与原生数字同源、但不再取整;完全命中显示 100.00%,无计费输入时该组本就不显示。开关位于设置的「布局」区,关闭即恢复原样。
48
49
 
49
50
  所有修改**即时生效**,无需刷新。同一份配置也可以直接在设置文档里手改:
50
51
 
@@ -58,6 +59,7 @@ ui-tweaks:
58
59
  archiveManagerEnabled: true # 默认 false(关闭),设为 true 开启「归档」页面
59
60
  initCommandEnabled: true # 默认 false(关闭),设为 true 开启 /init 斜杠命令
60
61
  whaleIndicatorEnabled: true # 默认 false(关闭),设为 true 开启鲸鱼指示器
62
+ preciseCacheHitEnabled: true # 默认 false(关闭),设为 true 开启缓存命中率两位小数
61
63
  notificationsEnabled: true # 默认 false(关闭),设为 true 开启任务提醒(事件过滤与三个通道在设置里逐项开关)
62
64
  # suggestModel: 'provider:model' # 可选:指定生成提交说明的模型
63
65
  ```
@@ -111,6 +113,7 @@ npx -y @deepseek-ai/dsh plugin --profile web add . # 从本目录作为 b
111
113
  - **MCP 管理**(服务端 `src/mcp.ts` + 浏览器端 `src/client/mcp.tsx`):同源路由 `/_dsh/ui-tweaks/mcp`。**列表**枚举 `ctx.loader.entries()` 中 `@deepseek-ai/dsh-mcp-client` 实例(id / config / fiber 状态:active=2、failed=3 等)并按 `mcp__<serverName>__` 前缀从工具注册表统计工具。**重启**调用 `entry.fiber.restart()`(仅运行时)。**添加 / 编辑 / 删除 / 启用停用**通过 `yaml`(eemeli)的 Document API 直接编辑 profile 的 `cordis.patch.yml`(保留注释与未知补丁结构,原子写 tmp+rename),随后由 DSH 内置的 `watchUserPatches` 热重载监视器重新应用补丁——`cordis-plugin-include` 对根组做**增量** `root.update`,因此只有被改动的 MCP 实例会重启,其它不受影响;环境变量值返回给同源浏览器(本机配置编辑需要),YAML 模式在服务端用 `yaml.parse` + 白名单校验。
112
114
  - **鲸鱼指示器**(`src/client/whale.tsx`):挂在 `conversation.input.dock`(输入框卡片上方的整行插槽)。dock 行本身比卡片宽(卡片被 InputBar root 以 `--dsh-composer-card-max-width` 封顶居中、两侧留 `--dsh-composer-side-clearance`),因此鲸鱼行**复刻卡片的几何**——同 max-width、同样居中、同样侧留白——再右对齐 + 6px `translateY`,鲸鱼恰好「骑」在卡片右上角(Claude Desktop 小螃蟹位置),自定义对话框宽度时也自动跟随。开关走与 /init 相同的「按需注册」编排——`whaleIndicatorEnabled` 打开时才注册插槽与样式,关闭即卸载。工作状态 = 会话列表 feed 中当前会话的 `running`(`useSyncExternalStore` 直订)∪ 输入机 `phase` 的 claimed/submitting;鲸鱼 SVG 路径内置为常量,挂载时以 `[class*="brandMark"]` 从侧边栏实时徽标尝试刷新(class 前缀是构建哈希,按后缀匹配以抗版本变化),取不到则回退内置几何。
113
115
  - **任务提醒**(`src/client/notifier.ts`):纯逻辑模块(无 React),在 `ctx.effect` 中直订 `ctx.sessions.list` 快照流(鲸鱼同款数据源),对全部非空、非子代理会话做前后对比:`running` true→false 且无挂起交互 → 完成事件;`pendingInteraction`('approval' / 'plan-review' / 'question',即侧边栏黄点分类)出现 → 交互事件;后台会话的宿主 `completed` 绿点升沿同样计为完成。三通道各自静默降级——标题闪烁用 `setInterval` 交替写 `document.title`,`focus`/`visibilitychange` 时恢复;系统通知带 `tag` 去重、`onclick` 里 `window.focus()` + `sessionsService.open(id)` 直达会话、`silent` 跟随提示音开关避免双重响铃;提示音由 WebAudio 振荡器现场合成双音包络。防打扰:首帧只武装基线、只在跳变沿触发、同会话同类 2s 冷却;「仅页面不可见时」等开关经 `readState` 每拍重读实时生效,改动无需重装监视器。
116
+ - **缓存命中率两位小数**(`src/client/cachehit.tsx`):挂在 `conversation.composer.dock`(输入框卡片下方承载原生统计条的横条)的**空渲染座位**——组件本身不画任何东西,只通过框架第五标准 hook `useProjection('tokenUsage')` 读取会话的 token 用量投影(未缓存输入 / 缓存读取 / 缓存写入 / 输出四个不相交桶),按 `缓存读取 ÷ (未缓存输入 + 缓存读取 + 缓存写入)` 算出精确占比后 `.toFixed(2)`,再把统计条里匹配「缓存命中 N%」/ "Cache hit N%" 的 span 原地改写为两位小数——布局、截断省略与 tooltip 行为全部保留 DSH 原样。一个 MutationObserver 监听统计条子树,React 重绘统计行时自动重打(写入幂等,改写一次后即收敛);开关关闭或会话切换时恢复原始文本并断开监听。注册编排与鲸鱼一致:`preciseCacheHitEnabled` 打开才挂载,关闭即卸载。
114
117
 
115
118
  ## 协议
116
119
 
package/cordis.patch.yml CHANGED
@@ -1,12 +1,12 @@
1
- # dsh-ui-tweaks bundle patch
2
- #
3
- # Declared by `dsh.bundle.patch` in package.json: when the plugin is installed
4
- # through the official CLI —
5
- #
6
- # dsh plugin --profile <name> add dsh-ui-tweaks
7
- #
8
- # — the command appends `dsh-ui-tweaks` to the profile's bundle stack and this
9
- # patch mounts the server-side plugin row.
10
- - insert:
11
- - id: ui-tweaks
12
- name: 'dsh-ui-tweaks'
1
+ # dsh-ui-tweaks bundle patch
2
+ #
3
+ # Declared by `dsh.bundle.patch` in package.json: when the plugin is installed
4
+ # through the official CLI —
5
+ #
6
+ # dsh plugin --profile <name> add dsh-ui-tweaks
7
+ #
8
+ # — the command appends `dsh-ui-tweaks` to the profile's bundle stack and this
9
+ # patch mounts the server-side plugin row.
10
+ - insert:
11
+ - id: ui-tweaks
12
+ name: 'dsh-ui-tweaks'