@alexpeng/dsh-custom-plugin 0.1.6 → 0.4.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/CHANGELOG.md +33 -0
- package/README.i18n.yaml +2 -2
- package/README.md +18 -5
- package/README.zh.md +18 -5
- package/lib/client.js +1062 -94
- package/lib/client.js.map +1 -1
- package/lib/index.js +641 -27
- package/lib/types/backup.d.ts +9 -0
- package/lib/types/client/api.d.ts +22 -1
- package/lib/types/client/styles.d.ts +1 -1
- package/lib/types/host-service.d.ts +31 -2
- package/lib/types/index.d.ts +1 -1
- package/lib/types/productivity.d.ts +30 -0
- package/lib/types/protocol.d.ts +47 -0
- package/lib/types/routes.d.ts +1 -1
- package/lib/types/state.d.ts +3 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,39 @@ All notable changes to this project are documented here. The format loosely
|
|
|
4
4
|
follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions
|
|
5
5
|
follow [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## 0.4.0 — 2026-09-03
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- 7 / 30 / 90-day usage trends, per-model summaries, CSV export, and local monthly CNY budget warnings.
|
|
12
|
+
- Versioned, secret-free state backup with previewed merge/replace import and automatic recovery copies.
|
|
13
|
+
- Editable, tagged, sortable favorite prompts with usage recency, `{{variable}}` templates, and JSON / Markdown portability.
|
|
14
|
+
- Indexed current-session search and a Ctrl/Cmd+K command palette backed by DSH's official search APIs.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Batch archive skips running sessions and reports separate success and failure counts.
|
|
19
|
+
- Existing prompt and config documents are normalized for the new optional fields.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- State-dependent routes now wait for the initial local state load; usage events
|
|
24
|
+
arriving during an import, edit, or usage scan are queued and persisted instead
|
|
25
|
+
of racing a stale snapshot.
|
|
26
|
+
- Backup imports reject malformed counters/configuration, honor imported folder
|
|
27
|
+
parents and sibling order, and keep the 5 MiB document boundary distinct from
|
|
28
|
+
the JSON request envelope.
|
|
29
|
+
- Search hits carry their session id and archive batches retain per-item errors;
|
|
30
|
+
stale cross-session clicks and swallowed archive failures now surface clearly.
|
|
31
|
+
- Malformed persisted peak counters, invalid calendar buckets, failed usage
|
|
32
|
+
rebuilds, and partial state edits are handled without presenting or keeping
|
|
33
|
+
a misleading snapshot; backup requests now validate their envelope fields.
|
|
34
|
+
|
|
35
|
+
### Security
|
|
36
|
+
|
|
37
|
+
- Backups exclude API keys and credential metadata; imports preserve the active credential.
|
|
38
|
+
- Archive restore remains deferred until DSH exposes an official API.
|
|
39
|
+
|
|
7
40
|
## 0.1.6 — 2026-09-02
|
|
8
41
|
|
|
9
42
|
### Fixed
|
package/README.i18n.yaml
CHANGED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
# after editing either side, bring the other along and re-record the hashes:
|
|
4
4
|
# git hash-object --path README.md README.md
|
|
5
5
|
# git hash-object --path README.zh.md README.zh.md
|
|
6
|
-
README.md:
|
|
7
|
-
README.zh.md:
|
|
6
|
+
README.md: 8c5a4e55a1e687f1b6875d8d51f982416672ab14
|
|
7
|
+
README.zh.md: 1cb41d78b883bc294d60e64cb68d43653653ae17
|
package/README.md
CHANGED
|
@@ -9,10 +9,14 @@
|
|
|
9
9
|
|
|
10
10
|
English | [中文](README.zh.md)
|
|
11
11
|
|
|
12
|
-
Custom convenience suite for the DeepSeek Harness (DSH) Web GUI: personalization, weather FX, glass effects, a per-user-message timeline rail, project folders, prompts, conversation export, Mermaid rendering, quote reply, and
|
|
12
|
+
Custom convenience suite for the DeepSeek Harness (DSH) Web GUI: personalization, weather FX, glass effects, a per-user-message timeline rail, project folders, enhanced prompts, conversation export/search, Mermaid rendering, quote reply, 7/30/90-day usage analytics, budget and key-free local backups, plus a Ctrl/Cmd+K command palette.
|
|
13
13
|
|
|
14
14
|
The plugin is dual-face: the host half (`src/`) owns the state document, registers the `/api/custom-plugin` routes and the `custom_plugin_status` agent tool; the browser half (`src/client/`) injects its UI through eight injections into seven official slots and talks to the host over same-origin fetch. Mounted through the official profile mechanism — no DSH source changes.
|
|
15
15
|
|
|
16
|
+
<p align="center">
|
|
17
|
+
<img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/overview.png" alt="dsh-custom-plugin overview" width="100%">
|
|
18
|
+
</p>
|
|
19
|
+
|
|
16
20
|
## Selected screenshots
|
|
17
21
|
|
|
18
22
|
<table>
|
|
@@ -38,7 +42,7 @@ The plugin is dual-face: the host half (`src/`) owns the state document, registe
|
|
|
38
42
|
</tr>
|
|
39
43
|
</table>
|
|
40
44
|
|
|
41
|
-
Weather FX is shown in dark mode, where only "no color" and "aurora" backgrounds are selectable.
|
|
45
|
+
Weather FX is shown in dark mode, where only "no color" and "aurora" backgrounds are selectable. Usage history, backup-import previews, session search, and the command palette are dynamic views of the same panel; open them inside DSH to inspect the live UI — no additional fixed screenshots are included.
|
|
42
46
|
|
|
43
47
|
## What it does
|
|
44
48
|
|
|
@@ -65,7 +69,7 @@ A multi-level folder tree persisted in the `$DSH_HOME` state file, shared across
|
|
|
65
69
|
|
|
66
70
|
### Prompts
|
|
67
71
|
|
|
68
|
-
A prompt library with add / copy / delete, search,
|
|
72
|
+
A prompt library with add / edit / copy / delete, search, favorites, tags, drag sorting, recency and use counts. `{{variable}}` placeholders open a fill-in form before insertion. The library supports versioned JSON and heading-based Markdown import/export.
|
|
69
73
|
|
|
70
74
|
### Conversation export
|
|
71
75
|
|
|
@@ -77,6 +81,8 @@ Export the current session in three formats (file names carry a date stamp):
|
|
|
77
81
|
|
|
78
82
|
Tool rows carry the tool name and an argument digest (resolved from the paired tool/call events).
|
|
79
83
|
|
|
84
|
+
Plugin state can be exported as a versioned JSON backup containing appearance, folders, prompts, stars, usage, and budget settings. API keys and credential metadata are excluded. Imports show a conflict preview, support merge or non-secret replacement, and create a recovery copy first.
|
|
85
|
+
|
|
80
86
|
### Mermaid
|
|
81
87
|
|
|
82
88
|
```mermaid blocks anywhere in the chat — assistant replies included (mindmaps, flowcharts, sequence diagrams, …) — render in place automatically: a diagram/code toggle bar with a mermaid.live fallback link appears above the block, streaming blocks preview once their content is complete, diagrams re-render on GUI theme flips, and a failed render keeps the raw code. Detection keys off the fence language label; with a blank label (mid-stream) a content heuristic decides (keyword prefix + completeness checks, so blocks labeled with a real language are never touched). The engine loads from the mermaid 11 dependency installed with the plugin (works offline), falling back to jsdelivr / fastly / unpkg mirrors and caching in the host process; the render chips under user messages and the multi-diagram modal stay, and the mermaid.live link uses the DEFLATE-compressed `#pako:` format that restores the diagram on open.
|
|
@@ -86,7 +92,10 @@ Tool rows carry the tool name and an argument digest (resolved from the paired t
|
|
|
86
92
|
- **Quote reply**: select text in the conversation and a "quote reply" button inserts it as a blockquote into the input box;
|
|
87
93
|
- **Anti auto-scroll**: force `scroll-behavior: auto` so sends never yank the view to the bottom (off by default);
|
|
88
94
|
- **Formula copy**: LaTeX / MathML copy chips under matching messages (MathML pastes into Word);
|
|
89
|
-
- **Batch archive**: select sessions and archive them in bulk
|
|
95
|
+
- **Batch archive**: select sessions and archive them in bulk; running sessions are unavailable and completion reports separate success/failure counts. DSH exposes no restore API yet, so the plugin provides no restore entry point.
|
|
96
|
+
- **Session search**: search current-session user, assistant, and tool content through DSH's official index and jump to the containing turn; superseded requests are cancelled.
|
|
97
|
+
- **Command palette**: press `Ctrl+K` / `Cmd+K` outside editors to search sessions, workspaces, prompts, and common actions; cross-session content search uses DSH's official API.
|
|
98
|
+
- **Reliable archive**: running sessions are unavailable by default and batch completion reports separate success and failure counts.
|
|
90
99
|
|
|
91
100
|
### Balance and usage
|
|
92
101
|
|
|
@@ -97,6 +106,7 @@ A balance badge sits in the session header (clickable to pin); the balance panel
|
|
|
97
106
|
- **Today's usage**: per-model input / output / cache token counters and call counts, folded live from `session/event` records.
|
|
98
107
|
- **Cost estimate**: DeepSeek's current official peak/off-peak table — peak hours are Beijing Monday–Friday 09:00–12:00 / 14:00–18:00; all other hours, including weekends, are off-peak at half price: `deepseek-v4-flash` / `deepseek-v4-flash-vision-exp` ¥3 / ¥9, `deepseek-v4-pro` ¥9 / ¥27 (CNY per 1M tokens in / out, cache writes ¥0.1 / ¥0.3; the retired `deepseek-chat` / `deepseek-reasoner` price as v4-flash). Indicative only.
|
|
99
108
|
- **Scan**: "scan today's session logs" replays every session and buckets usage events by their own timestamp (cross-midnight sessions keep contributing today's usage), reporting how many active sessions were scanned.
|
|
109
|
+
- **History and budget**: inspect 7 / 30 / 90-day trends and per-model totals, export UTF-8 CSV, and set a local monthly CNY budget with an in-plugin warning threshold.
|
|
100
110
|
|
|
101
111
|
### Settings entry
|
|
102
112
|
|
|
@@ -162,6 +172,8 @@ Appearance and feature toggles (the `cfg` field, all with defaults):
|
|
|
162
172
|
| `antiScroll` | `false` | anti auto-scroll |
|
|
163
173
|
| `mermaid` | `true` | automatic in-place Mermaid rendering (plus render chips) |
|
|
164
174
|
| `formula` | `true` | LaTeX / MathML copy chips |
|
|
175
|
+
| `monthlyBudgetCny` | `0` | Monthly CNY budget; `0` disables warnings |
|
|
176
|
+
| `budgetWarningPercent` | `80` | Monthly warning threshold (1–100) |
|
|
165
177
|
|
|
166
178
|
## Security model
|
|
167
179
|
|
|
@@ -174,10 +186,11 @@ Appearance and feature toggles (the `cfg` field, all with defaults):
|
|
|
174
186
|
|
|
175
187
|
- The Mermaid engine comes from the dependency installed with the plugin and works offline; only a missing dependency falls back to a CDN fetch (cached for the host process lifetime).
|
|
176
188
|
- The usage ledger folds token counts from live `session/event` records, retains 90 Beijing calendar days, and a manual "scan" re-reads today's session logs with four concurrent reads when live events were missed.
|
|
177
|
-
- The balance panel shows the peak/off-peak token and cost split plus a link to the official pricing page; legacy rows without peak counters are
|
|
189
|
+
- The balance panel shows the peak/off-peak token and cost split plus a link to the official pricing page; legacy rows without peak counters are marked inexact and excluded from cost totals until rescanned.
|
|
178
190
|
- OS credential storage depends on the optional `keytar` backend; when it cannot be loaded, the compatibility state-file fallback is used.
|
|
179
191
|
- Cost estimates use DeepSeek's official peak/off-peak list prices and are indicative only.
|
|
180
192
|
- Dark-mode background restriction is deliberate: only "no color" and "aurora" are selectable in dark mode.
|
|
193
|
+
- DSH currently exposes no archive-restore API; the plugin does not bypass that boundary by editing the underlying registry.
|
|
181
194
|
|
|
182
195
|
## Development
|
|
183
196
|
|
package/README.zh.md
CHANGED
|
@@ -9,10 +9,14 @@
|
|
|
9
9
|
|
|
10
10
|
[English](README.md) | 中文
|
|
11
11
|
|
|
12
|
-
DeepSeek Harness(DSH)Web GUI 的 Custom
|
|
12
|
+
DeepSeek Harness(DSH)Web GUI 的 Custom 便利套件:个性化外观、天气特效、玻璃效果、按用户消息的时间线导航、项目文件夹、增强提示词库、会话导出与会话搜索、Mermaid 渲染、引用回复、7/30/90 天用量分析、预算与无密钥本地备份,以及 Ctrl/Cmd+K 快捷面板。
|
|
13
13
|
|
|
14
14
|
插件为双半区架构:宿主半区(`src/`)持有状态文档、注册 `/api/custom-plugin` 路由与 `custom_plugin_status` 智能体工具;浏览器半区(`src/client/`)通过 7 个官方 slot 的 8 处注入挂载 UI,以同源 fetch 与宿主通信。经官方 profile 机制挂载,不改 DSH 源码。
|
|
15
15
|
|
|
16
|
+
<p align="center">
|
|
17
|
+
<img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/overview.png" alt="dsh-custom-plugin 总览" width="100%">
|
|
18
|
+
</p>
|
|
19
|
+
|
|
16
20
|
## 部分界面展示
|
|
17
21
|
|
|
18
22
|
<table>
|
|
@@ -38,7 +42,7 @@ DeepSeek Harness(DSH)Web GUI 的 Custom 便利套件:个性化外观、天
|
|
|
38
42
|
</tr>
|
|
39
43
|
</table>
|
|
40
44
|
|
|
41
|
-
|
|
45
|
+
天气特效截自深色模式(深色下仅「无颜色」与「极光」背景可选)。额度历史、备份导入预览、会话搜索与快捷面板属于同一套动态面板,需在 DSH 内打开对应页查看;仓库未另附固定截图。
|
|
42
46
|
|
|
43
47
|
## 功能
|
|
44
48
|
|
|
@@ -65,7 +69,7 @@ DeepSeek Harness(DSH)Web GUI 的 Custom 便利套件:个性化外观、天
|
|
|
65
69
|
|
|
66
70
|
### 提示词库
|
|
67
71
|
|
|
68
|
-
|
|
72
|
+
提示词支持新增、编辑、复制、删除、搜索、收藏、标签和拖拽排序,并记录最近使用与使用次数。正文可使用 `{{变量名}}`;插入前会弹出变量表单。提示词库可用版本化 JSON 或以二级标题分段的 Markdown 导入导出。
|
|
69
73
|
|
|
70
74
|
### 会话导出
|
|
71
75
|
|
|
@@ -77,6 +81,8 @@ DeepSeek Harness(DSH)Web GUI 的 Custom 便利套件:个性化外观、天
|
|
|
77
81
|
|
|
78
82
|
工具调用行携带工具名与参数摘要(从配对的 tool/call 事件解析)。
|
|
79
83
|
|
|
84
|
+
插件状态可导出为版本化 JSON 备份,包含外观、文件夹、提示词、星标、用量和预算,不包含 API Key 或凭据元数据。导入前显示冲突预览,支持合并或覆盖非敏感状态,并自动保留恢复副本。
|
|
85
|
+
|
|
80
86
|
### Mermaid 渲染
|
|
81
87
|
|
|
82
88
|
聊天中的 ```mermaid 代码块(含助手回复,思维导图 / 流程图 / 时序图等)自动就地渲染为图表:代码块上方出现「图表 / 代码」切换工具条与 mermaid.live 兜底链接,流式输出期间内容完整后即预览,跟随 GUI 明暗主题重绘,渲染失败时保留原代码。检测依据代码块语言标签;无标签(流式中)时按内容启发式判断(关键字前缀 + 完整度检查,语言明确的代码块不会误触)。引擎优先读取随插件安装的本地 Mermaid 11 依赖(离线可用),缺失时回退 jsdelivr / fastly / unpkg 三镜像拉取并在宿主进程内缓存;用户消息下方的渲染按钮与模态窗口(多图切换)保持不变,mermaid.live 链接为 DEFLATE 压缩的 `#pako:` 格式,打开即还原图表。
|
|
@@ -86,7 +92,10 @@ DeepSeek Harness(DSH)Web GUI 的 Custom 便利套件:个性化外观、天
|
|
|
86
92
|
- **引用回复**:选中对话文本后出现「引用回复」按钮,以引用块插入输入框;
|
|
87
93
|
- **防自动跳转**:强制 `scroll-behavior: auto`,发送消息不再把视图拽到底部(默认关闭);
|
|
88
94
|
- **公式复制**:含公式的消息下方显示 LaTeX / MathML 复制按钮(MathML 可直接粘贴进 Word);
|
|
89
|
-
-
|
|
95
|
+
- **批量归档**:勾选多个会话批量归档,运行中会话默认不可选,并分别报告成功与失败数量;DSH 尚未公开恢复接口,插件不提供恢复入口。
|
|
96
|
+
- **会话搜索**:通过 DSH 官方索引搜索当前会话的用户、助手和工具内容,点击结果跳转到所属轮次。
|
|
97
|
+
- **快捷面板**:在非编辑状态按 `Ctrl+K` / `Cmd+K`,统一搜索会话、工作区、提示词和常用功能。
|
|
98
|
+
- **可靠归档**:运行中的会话默认不可选,批量操作分别报告成功与失败数量。
|
|
90
99
|
|
|
91
100
|
### 额度与用量
|
|
92
101
|
|
|
@@ -97,6 +106,7 @@ DeepSeek Harness(DSH)Web GUI 的 Custom 便利套件:个性化外观、天
|
|
|
97
106
|
- **今日用量**:按模型统计输入 / 输出 / 缓存 token 与调用次数,实时折叠自 `session/event` 事件。
|
|
98
107
|
- **费用估算**:按 DeepSeek 当前官方峰谷价目估算——高峰为北京时间周一至周五 9–12、14–18 时;其余时间(含周末)均为空闲时段,按半价计:`deepseek-v4-flash` / `deepseek-v4-flash-vision-exp` ¥3 / ¥9,`deepseek-v4-pro` ¥9 / ¥27(每百万 tokens 输入 / 输出,缓存写入 ¥0.1 / ¥0.3;已停用的 `deepseek-chat` / `deepseek-reasoner` 按 v4-flash 计),仅供参考。
|
|
99
108
|
- **扫描**:「扫描今日会话日志」重放全部会话、按事件自身时间戳归入今日(跨午夜会话不丢量),完成后显示扫描到的活跃会话数。
|
|
109
|
+
- **历史与预算**:查看 7 / 30 / 90 天趋势和按模型汇总,导出 UTF-8 CSV;可设置人民币月预算与预警比例。
|
|
100
110
|
|
|
101
111
|
### 设置入口
|
|
102
112
|
|
|
@@ -162,6 +172,8 @@ dsh plugin --profile web add link:F:/dsh-plugin-dev
|
|
|
162
172
|
| `antiScroll` | `false` | 防自动跳底 |
|
|
163
173
|
| `mermaid` | `true` | Mermaid 图表自动就地渲染(含消息下方渲染按钮) |
|
|
164
174
|
| `formula` | `true` | LaTeX / MathML 复制按钮 |
|
|
175
|
+
| `monthlyBudgetCny` | `0` | 人民币月预算;`0` 表示关闭提醒 |
|
|
176
|
+
| `budgetWarningPercent` | `80` | 月预算预警百分比(1–100) |
|
|
165
177
|
|
|
166
178
|
## 安全模型
|
|
167
179
|
|
|
@@ -174,10 +186,11 @@ dsh plugin --profile web add link:F:/dsh-plugin-dev
|
|
|
174
186
|
|
|
175
187
|
- Mermaid 引擎来自随插件安装的本地依赖,离线可用;仅当依赖缺失时回退 CDN 拉取(宿主在进程生命周期内缓存)。
|
|
176
188
|
- 用量账本折叠自实时 `session/event` 记录,只保留最近 90 个北京时间日;错过实时事件时可手动「扫描」,扫描最多并发读取 4 个会话日志。
|
|
177
|
-
- 额度面板会显示峰/闲 token
|
|
189
|
+
- 额度面板会显示峰/闲 token 与费用分布,并提供官方价目链接;没有峰时字段的历史行会标记为“不精确”,不计入费用总额,重新扫描后可更新。
|
|
178
190
|
- 系统凭据存储依赖可选的 `keytar` 后端;无法加载时使用兼容的状态文件回退。
|
|
179
191
|
- 费用按 DeepSeek 官方峰谷单价估算,仅供参考。
|
|
180
192
|
- 深色模式下背景限制是刻意设计:仅「无颜色」与「极光」可选。
|
|
193
|
+
- DSH 当前没有公开的归档恢复接口;插件不会绕过官方边界修改底层注册表。
|
|
181
194
|
|
|
182
195
|
## 开发
|
|
183
196
|
|