@hao0311/dsh-toolbox 0.5.3 → 0.5.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # 更新记录
2
2
 
3
+ ## 0.5.5 (2026-11-24)
4
+
5
+ - README.md 改为中英双语:英文整段并入默认 README(npm 页面、GitHub 首页、插件目录都能直接读到英文),README.en.md 保留为独立单语文件。
6
+
7
+ ## 0.5.4 (2026-11-24)
8
+
9
+ - README 增加「你可能正卡在这几件事上 / 装上之后」两节(中英文)。
10
+
3
11
  ## 0.5.3 (2026-11-24)
4
12
 
5
13
  - 新增英文 README(README.en.md),随包一起发布。
package/README.en.md CHANGED
@@ -4,6 +4,18 @@ A toolbox inside the DSH Web GUI: one more row in the left navigation (inside th
4
4
 
5
5
  On desktop the main page **makes room**: the drawer takes width, the chat content shifts left instead of being covered. In narrow windows (content under ~640 px after shifting) the left navigation also collapses into an icon rail, and restores when the panel closes. The drawer width adapts between 424 px and 340 px.
6
6
 
7
+ ## The friction this removes
8
+
9
+ - When the model says "the network is slow", you cannot tell whether it is the model, a proxy, or your Wi-Fi — so you guess.
10
+ - Verifying means opening a speed-test site and a packet tool in another tab, then pasting the conclusion back into the chat.
11
+
12
+ ## After installing
13
+
14
+ - One sidebar row: connection type (LAN / Tailscale / public, Wi-Fi band, channel, rate, signal), one-click health check, speed test and quality monitor in a single drawer.
15
+ - Speed tests are server-timed with four concurrent streams; closing the drawer does not stop them, and the chart is there when you return.
16
+ - Results are summarised and copied into the conversation in one click, so the model no longer has to guess which hop is slow.
17
+ - On desktop the page makes room instead of being covered; on phones the drawer is full screen.
18
+
7
19
  ## Features
8
20
 
9
21
  | Area | What it does |
package/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # dsh-toolbox
2
2
 
3
- > English: [README.en.md](README.en.md)
4
-
3
+ > 英文版在本文末尾([English](#english)),也可单独看 [README.en.md](README.en.md)。
5
4
  DSH Web GUI 里的工具箱:左侧导航(手机上在抽屉里)多一行「工具箱」,点开是一个右侧抽屉
6
5
  (手机端全屏,可随时退出、任务在后台继续)。
7
6
 
@@ -9,6 +8,18 @@ DSH Web GUI 里的工具箱:左侧导航(手机上在抽屉里)多一行
9
8
  窗口较窄(让位后主内容不足约 640px)时会顺手把左侧导航收成图标轨,关面板后自动恢复。
10
9
  面板宽度随窗口自适应:424px ~ 340px。
11
10
 
11
+ ## 你可能正卡在这几件事上
12
+
13
+ - 模型说「网络慢」的时候,你分不清是模型慢、代理慢还是 Wi-Fi 差,只能靠猜。
14
+ - 想验证就得另开测速站、抓包工具,再把结论手动贴回对话。
15
+
16
+ ## 装上之后
17
+
18
+ - 侧栏一行「工具箱」:连接状态(局域网 / Tailscale / 外网、Wi-Fi 频段信道速率信号)、一键体检、测速、质量监控都在一个抽屉里。
19
+ - 测速由服务端计时、四路并发,关掉面板任务继续跑,回来还能看曲线。
20
+ - 结果一键生成中文总结复制进对话,模型不用再猜「到底哪一段慢」。
21
+ - 桌面端打开时主页面自动让位,不压住聊天;手机端全屏。
22
+
12
23
  ## 功能
13
24
 
14
25
  | 功能区 | 做什么 |
@@ -86,3 +97,95 @@ window.DSHToolbox.register({
86
97
  - 直接请求 `/api/toolbox/net/info`,应返回 `{ ok: true, ip, host, ... }`。
87
98
  - 本地验证脚本:`.cdp-verify/cdp-toolbox.js`(桌面/手机截图)、
88
99
  `.cdp-verify/cdp-toolbox-func.js`(点按钮、跑体检/测速/监控、验证后台继续)。
100
+
101
+ ---
102
+
103
+ # English
104
+
105
+ > Also available as a standalone file: [README.en.md](README.en.md).
106
+
107
+ A toolbox inside the DSH Web GUI: one more row in the left navigation (inside the drawer on phones) that opens a right-side drawer — full screen on phones, closable at any time, with measurements continuing in the background.
108
+
109
+ On desktop the main page **makes room**: the drawer takes width, the chat content shifts left instead of being covered. In narrow windows (content under ~640 px after shifting) the left navigation also collapses into an icon rail, and restores when the panel closes. The drawer width adapts between 424 px and 340 px.
110
+
111
+ ## The friction this removes
112
+
113
+ - When the model says "the network is slow", you cannot tell whether it is the model, a proxy, or your Wi-Fi — so you guess.
114
+ - Verifying means opening a speed-test site and a packet tool in another tab, then pasting the conclusion back into the chat.
115
+
116
+ ## After installing
117
+
118
+ - One sidebar row: connection type (LAN / Tailscale / public, Wi-Fi band, channel, rate, signal), one-click health check, speed test and quality monitor in a single drawer.
119
+ - Speed tests are server-timed with four concurrent streams; closing the drawer does not stop them, and the chart is there when you return.
120
+ - Results are summarised and copied into the conversation in one click, so the model no longer has to guess which hop is slow.
121
+ - On desktop the page makes room instead of being covered; on phones the drawer is full screen.
122
+
123
+ ## Features
124
+
125
+ | Area | What it does |
126
+ |---|---|
127
+ | Connection | Refreshed on open: LAN / loopback / Tailscale / public, client IP, local address, public egress, Wi-Fi band, channel, rate and signal |
128
+ | One-click check | Opening the panel runs a **light** check (~1–2 s, small requests only); the button runs a **full** check (gateway ping, DNS, public egress) and grades it good / fair / poor with suggestions |
129
+ | Speed test | Quick 20 MB / standard 100 MB / extreme 500 MB / 30 s continuous / custom (download, upload, duration). Server-side timing, 4 concurrent streams, live chart — keeps running after you close the panel |
130
+ | Quality monitor | 30 s / 1 min / 3 min low-traffic sampling (a small request every 0.3 s) producing a latency chart, packet loss and stall spikes — for "it feels laggy", not for bandwidth |
131
+ | History | Checks, speed tests and monitors are stored locally (localStorage, last 40), and each speed test is compared with the previous one |
132
+ | Auto patrol | While the page is open, 3 light probes every 3/5/10 minutes; a red dot on the nav entry and an in-panel hint when the network degrades |
133
+ | Share / report | Builds a short summary (connection type, check result, speed, monitor, advice) with one-click copy |
134
+
135
+ ## Implementation
136
+
137
+ - **Host `index.js`** registers `/api/toolbox/net/*` through `ctx.connection.fetch.register` (download stream, upload stream, info, diagnostics, server timing, status) and inlines `client.css` / `client.js` into `index.html` via the official `webserver/index-inject` hook. The host reads this file once at startup; CSS and JS are read on every page load, so UI changes need no restart.
138
+ - **Client `client.js`** is pure DOM injection — no React dependency, no layout changes to DSH. The measurement engine is decoupled from the panel: close the panel and the job keeps running; reopen it and you see live state. A dot on the nav row and a 2 px progress line at the top indicate a background job.
139
+ - **Auth**: routes live under `/api` and inherit the connection layer's Host/Origin + cookie checks.
140
+
141
+ ## How measurement works
142
+
143
+ | Item | Method |
144
+ |---|---|
145
+ | Download | `GET /api/toolbox/net/download?mb=N` streams N × 1 MiB of random data; the client counts as it reads, and the number is **server-timed** |
146
+ | Upload | `POST /api/toolbox/net/upload`; the browser posts a random Blob, the server counts bytes and returns first-byte → last-byte duration |
147
+ | Latency / jitter / loss | Repeated small requests to `/api/toolbox/net/info`; timeouts count as loss |
148
+
149
+ > Running it on the same machine goes over loopback, where numbers inflate to GB/s levels — the panel labels that case as "local loopback".
150
+
151
+ ## Install / update
152
+
153
+ ```sh
154
+ dsh plugin --profile web add github:Hao0311/dsh-toolbox
155
+ ```
156
+
157
+ > npm hosts a **different, same-named** package `dsh-toolbox` (stock tracking + novel reader). `dsh plugin add dsh-toolbox` installs the wrong one; use the `github:` source above, or the scoped npm name `@hao0311/dsh-toolbox`.
158
+
159
+ For development, this directory ships a sync script that copies it into `~/.dsh/profiles/web/node_modules/dsh-toolbox/` and adds an `insert:` entry inside a marker block of `cordis.patch.yml` (idempotent):
160
+
161
+ ```powershell
162
+ powershell -NoProfile -File D:\Workspaces\DSH\plugins\dsh-toolbox\install.ps1
163
+ ```
164
+
165
+ - **Only `client.js` / `client.css` changed**: run install.ps1 and reload the page — no DSH restart.
166
+ - **`index.js` changed**: restart DSH (plugins load at startup).
167
+
168
+ ## Adding your own tool
169
+
170
+ ```js
171
+ window.DSHToolbox.register({
172
+ id: 'my-tool', // unique
173
+ title: 'My tool',
174
+ hint: 'one line', // optional
175
+ render(container) { // draw into a plain DOM node
176
+ container.textContent = 'hello';
177
+ },
178
+ });
179
+ ```
180
+
181
+ Registration order is the order shown under "more tools" at the bottom of the panel.
182
+
183
+ ## Self-check
184
+
185
+ - Search the page source for `__DSH_TOOLBOX__` (the host-injected global reporting injected lines and route status).
186
+ - Request `/api/toolbox/net/info` directly; it should return `{ ok: true, ip, host, ... }`.
187
+ - Local verification scripts: `.cdp-verify/cdp-toolbox.js` (desktop/mobile screenshots) and `.cdp-verify/cdp-toolbox-func.js` (click through checks, speed test, monitor, background continuation).
188
+
189
+ ## License
190
+
191
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hao0311/dsh-toolbox",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {