@alexpeng/dsh-custom-plugin 0.1.0 → 0.1.2

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
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright [yyyy] [name of copyright owner]
189
+ Copyright 2026 AlexPeng
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
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: 28399b52bad61a07d8a943751972d5dc202320ec
7
- README.zh.md: 833a310d825c35941114181fda189aca2d034a4b
6
+ README.md: 7fe262ab802df3a0fc0735b31df49152cde95ae6
7
+ README.zh.md: eeb32e94b8ec23a6816a11ec391c34ba2af933cf
package/README.md CHANGED
@@ -1,10 +1,39 @@
1
1
  # dsh-custom-plugin
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/%40alexpeng%2Fdsh-custom-plugin?style=flat-square)](https://www.npmjs.com/package/@alexpeng/dsh-custom-plugin)
4
+ [![license](https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square)](LICENSE)
5
+ [![Node](https://img.shields.io/badge/node-%3E%3D22-339933?style=flat-square)](#install)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.7-3178C6?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org)
7
+ [![CI](https://github.com/AlexPeng07/dsh-custom-plugin/actions/workflows/ci.yml/badge.svg)](https://github.com/AlexPeng07/dsh-custom-plugin/actions/workflows/ci.yml)
8
+
3
9
  English | [中文](README.zh.md)
4
10
 
5
11
  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 DeepSeek balance / daily token usage.
6
12
 
7
- 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 nine official slots and talks to the host over same-origin fetch. Mounted through the official profile mechanism — no DSH source changes.
13
+ 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.
14
+
15
+ ## Selected screenshots
16
+
17
+ <table>
18
+ <tr>
19
+ <td width="50%" valign="top"><b>Settings → 个性化: the full-page appearance config</b><br><img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/settings-appearance.png" alt="Settings → 个性化 full appearance page" width="100%"></td>
20
+ <td width="50%" valign="top"><b>The same panel as a popover from the session header (light theme)</b><br><img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/personalization-panel.png" alt="Personalization popover" width="100%"></td>
21
+ </tr>
22
+ <tr>
23
+ <td width="50%" valign="top"><b>Liquid glass (displacement refraction on Custom surfaces)</b><br><img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/liquid-glass.png" alt="Liquid glass" width="100%"></td>
24
+ <td width="50%" valign="top"><b>Timeline rail with hover preview</b><br><img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/timeline.png" alt="Timeline rail" width="100%"></td>
25
+ </tr>
26
+ <tr>
27
+ <td width="50%" valign="top" align="center"><b>Balance and today's per-model usage</b><br><img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/balance-usage.png" alt="Balance and usage panel" width="100%"></td>
28
+ <td width="50%" valign="top" align="center"><b>Rain — three depth layers</b><br><img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/weather-rain.gif" alt="Rain FX" width="100%"></td>
29
+ </tr>
30
+ <tr>
31
+ <td width="50%" valign="top" align="center"><b>Sakura petals</b><br><img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/weather-sakura.gif" alt="Sakura FX" width="100%"></td>
32
+ <td width="50%" valign="top" align="center"><b>Snow</b><br><img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/weather-snow.gif" alt="Snow FX" width="100%"></td>
33
+ </tr>
34
+ </table>
35
+
36
+ Weather FX is shown in dark mode, where only "no color" and "aurora" backgrounds are selectable.
8
37
 
9
38
  ## What it does
10
39
 
@@ -45,7 +74,7 @@ Tool rows carry the tool name and an argument digest (resolved from the paired t
45
74
 
46
75
  ### Mermaid
47
76
 
48
- When a message contains a ```mermaid block, a render chip appears under it; the modal renders the diagram with the host-fetched Mermaid 11 engine (jsdelivr / fastly / unpkg mirror fallback, cached for the host process lifetime, preloadable from the Mermaid tab), plus a mermaid.live fallback link (DEFLATE-compressed `#pako:` format that restores the diagram on open).
77
+ ```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.
49
78
 
50
79
  ### Efficiency tools
51
80
 
@@ -59,7 +88,7 @@ When a message contains a ```mermaid block, a render chip appears under it; the
59
88
  A balance badge sits in the session header (clickable to pin); the balance panel provides:
60
89
 
61
90
  - **Balance**: the official `https://api.deepseek.com/user/balance` endpoint, CNY preferred, granted and topped-up balances listed separately, with the account availability flag.
62
- - **Key resolution order**: pasted in the panel (stored only in the local state file) → environment variables `DEEPSEEK_API_KEY` / `DEEPSEEK_KEY` / `DEEPSEEK_TOKEN` → the DSH credentials file `$DSH_HOME/.credentials.yaml` (reuses the DeepSeek key already configured in DSH — no duplicate setup).
91
+ - **Key resolution order**: pasted in the panel (stored only in the local state file) → environment variables `DEEPSEEK_API_KEY` / `DEEPSEEK_KEY` / `DEEPSEEK_TOKEN` (values must start with `sk-`) → the DSH credentials file `$DSH_HOME/.credentials.yaml` (reuses the DeepSeek key already configured in DSH — no duplicate setup).
63
92
  - **Today's usage**: per-model input / output / cache token counters and call counts, folded live from `session/event` records.
64
93
  - **Cost estimate**: DeepSeek's official peak/off-peak table (effective 2026-08-17) — peak hours (Beijing 09:00–12:00 / 14:00–18:00) at full price, off-peak at half: `deepseek-v4-flash` ¥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.
65
94
  - **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.
@@ -85,6 +114,15 @@ dsh plugin --profile web add @alexpeng/dsh-custom-plugin
85
114
 
86
115
  The registry tarball ships prebuilt output — no source build on the installing machine.
87
116
 
117
+ ### From GitHub (source install)
118
+
119
+ ```sh
120
+ dsh plugin --profile web add github:AlexPeng07/dsh-custom-plugin
121
+ # restart dsh web
122
+ ```
123
+
124
+ Git installs pull sources; the `prepare` script builds `lib/` on the installing machine. pnpm ≥10 asks you to approve that build once — copy the exact package key it prints into the profile's `pnpm-workspace.yaml` under `allowBuilds`, then re-run the add. The npm route above skips the build-approval step.
125
+
88
126
  ### Local link (development)
89
127
 
90
128
  ```sh
@@ -117,7 +155,7 @@ Appearance and feature toggles (the `cfg` field, all with defaults):
117
155
  | `starsOnly` | `false` | show only starred nodes |
118
156
  | `quote` | `true` | selection quote reply |
119
157
  | `antiScroll` | `false` | anti auto-scroll |
120
- | `mermaid` | `true` | Mermaid render chips |
158
+ | `mermaid` | `true` | automatic in-place Mermaid rendering (plus render chips) |
121
159
  | `formula` | `true` | LaTeX / MathML copy chips |
122
160
 
123
161
  ## Security model
@@ -128,7 +166,7 @@ Appearance and feature toggles (the `cfg` field, all with defaults):
128
166
 
129
167
  ## Known limitations
130
168
 
131
- - Mermaid rendering needs a reachable CDN on first use (the host caches the engine for its lifetime).
169
+ - 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).
132
170
  - The usage ledger folds token counts from live `session/event` records; a manual "scan" re-reads today's session logs when live events were missed.
133
171
  - Cost estimates use DeepSeek's official peak/off-peak list prices and are indicative only.
134
172
  - Dark-mode background restriction is deliberate: only "no color" and "aurora" are selectable in dark mode.
package/README.zh.md CHANGED
@@ -1,10 +1,39 @@
1
1
  # dsh-custom-plugin
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/%40alexpeng%2Fdsh-custom-plugin?style=flat-square)](https://www.npmjs.com/package/@alexpeng/dsh-custom-plugin)
4
+ [![license](https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square)](LICENSE)
5
+ [![Node](https://img.shields.io/badge/node-%3E%3D22-339933?style=flat-square)](#安装)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.7-3178C6?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org)
7
+ [![CI](https://github.com/AlexPeng07/dsh-custom-plugin/actions/workflows/ci.yml/badge.svg)](https://github.com/AlexPeng07/dsh-custom-plugin/actions/workflows/ci.yml)
8
+
3
9
  [English](README.md) | 中文
4
10
 
5
11
  DeepSeek Harness(DSH)Web GUI 的 Custom 便利套件:个性化外观、天气特效、玻璃效果、按用户消息的时间线导航、项目文件夹、提示词库、会话导出、Mermaid 渲染、引用回复,以及 DeepSeek 额度与今日 token 用量。
6
12
 
7
- 插件为双半区架构:宿主半区(`src/`)持有状态文档、注册 `/api/custom-plugin` 路由与 `custom_plugin_status` 智能体工具;浏览器半区(`src/client/`)通过 9 个官方 slot 注入 UI,以同源 fetch 与宿主通信。经官方 profile 机制挂载,不改 DSH 源码。
13
+ 插件为双半区架构:宿主半区(`src/`)持有状态文档、注册 `/api/custom-plugin` 路由与 `custom_plugin_status` 智能体工具;浏览器半区(`src/client/`)通过 7 个官方 slot 的 8 处注入挂载 UI,以同源 fetch 与宿主通信。经官方 profile 机制挂载,不改 DSH 源码。
14
+
15
+ ## 部分界面展示
16
+
17
+ <table>
18
+ <tr>
19
+ <td width="50%" valign="top"><b>「设置 → 个性化」整页外观配置</b><br><img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/settings-appearance.png" alt="设置 → 个性化 整页外观配置" width="100%"></td>
20
+ <td width="50%" valign="top"><b>会话头部弹出的同一套面板(浅色主题)</b><br><img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/personalization-panel.png" alt="个性化弹窗面板" width="100%"></td>
21
+ </tr>
22
+ <tr>
23
+ <td width="50%" valign="top"><b>液态玻璃(Custom 面板位移折射)</b><br><img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/liquid-glass.png" alt="液态玻璃" width="100%"></td>
24
+ <td width="50%" valign="top"><b>时间线轨道与悬停预览</b><br><img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/timeline.png" alt="时间线轨道" width="100%"></td>
25
+ </tr>
26
+ <tr>
27
+ <td width="50%" valign="top" align="center"><b>余额与今日分模型用量</b><br><img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/balance-usage.png" alt="余额与用量面板" width="100%"></td>
28
+ <td width="50%" valign="top" align="center"><b>雨(三层景深)</b><br><img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/weather-rain.gif" alt="下雨特效" width="100%"></td>
29
+ </tr>
30
+ <tr>
31
+ <td width="50%" valign="top" align="center"><b>樱花</b><br><img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/weather-sakura.gif" alt="樱花特效" width="100%"></td>
32
+ <td width="50%" valign="top" align="center"><b>飘雪</b><br><img src="https://github.com/AlexPeng07/dsh-custom-plugin/raw/main/docs/weather-snow.gif" alt="飘雪特效" width="100%"></td>
33
+ </tr>
34
+ </table>
35
+
36
+ 天气特效截自深色模式(深色下仅「无颜色」与「极光」背景可选)。
8
37
 
9
38
  ## 功能
10
39
 
@@ -45,7 +74,7 @@ DeepSeek Harness(DSH)Web GUI 的 Custom 便利套件:个性化外观、天
45
74
 
46
75
  ### Mermaid 渲染
47
76
 
48
- 消息中出现 ```mermaid 代码块时,下方显示渲染按钮:模态窗口内用宿主拉取的 Mermaid 11 引擎渲染(jsdelivr / fastly / unpkg 三镜像回退,引擎在宿主进程内缓存,可在 Mermaid 页预加载);另附 mermaid.live 兜底链接(DEFLATE 压缩的 `#pako:` 格式,打开即还原图表)。
77
+ 聊天中的 ```mermaid 代码块(含助手回复,思维导图 / 流程图 / 时序图等)自动就地渲染为图表:代码块上方出现「图表 / 代码」切换工具条与 mermaid.live 兜底链接,流式输出期间内容完整后即预览,跟随 GUI 明暗主题重绘,渲染失败时保留原代码。检测依据代码块语言标签;无标签(流式中)时按内容启发式判断(关键字前缀 + 完整度检查,语言明确的代码块不会误触)。引擎优先读取随插件安装的本地 Mermaid 11 依赖(离线可用),缺失时回退 jsdelivr / fastly / unpkg 三镜像拉取并在宿主进程内缓存;用户消息下方的渲染按钮与模态窗口(多图切换)保持不变,mermaid.live 链接为 DEFLATE 压缩的 `#pako:` 格式,打开即还原图表。
49
78
 
50
79
  ### 效率工具
51
80
 
@@ -59,7 +88,7 @@ DeepSeek Harness(DSH)Web GUI 的 Custom 便利套件:个性化外观、天
59
88
  会话头部常驻额度徽标(可点击固定),额度面板提供:
60
89
 
61
90
  - **余额**:调用官方 `https://api.deepseek.com/user/balance` 接口,优先显示 CNY,赠送与充值余额分列,并显示账户可用状态。
62
- - **Key 解析顺序**:面板粘贴(仅存本机状态文件)→ 环境变量 `DEEPSEEK_API_KEY` / `DEEPSEEK_KEY` / `DEEPSEEK_TOKEN` → DSH 凭据文件 `$DSH_HOME/.credentials.yaml`(自动复用 DSH 已配置的 DeepSeek key,无需重复填写)。
91
+ - **Key 解析顺序**:面板粘贴(仅存本机状态文件)→ 环境变量 `DEEPSEEK_API_KEY` / `DEEPSEEK_KEY` / `DEEPSEEK_TOKEN`(取值需以 `sk-` 开头)→ DSH 凭据文件 `$DSH_HOME/.credentials.yaml`(自动复用 DSH 已配置的 DeepSeek key,无需重复填写)。
63
92
  - **今日用量**:按模型统计输入 / 输出 / 缓存 token 与调用次数,实时折叠自 `session/event` 事件。
64
93
  - **费用估算**:按 DeepSeek 官方峰谷价目(2026-08-17 生效)估算——高峰时段(北京时间 9–12 / 14–18 时)全价,空闲时段半价:`deepseek-v4-flash` ¥3 / ¥9,`deepseek-v4-pro` ¥9 / ¥27(每百万 tokens 输入 / 输出,缓存写入 ¥0.1 / ¥0.3;已停用的 `deepseek-chat` / `deepseek-reasoner` 按 v4-flash 计),仅供参考。
65
94
  - **扫描**:「扫描今日会话日志」重放全部会话、按事件自身时间戳归入今日(跨午夜会话不丢量),完成后显示扫描到的活跃会话数。
@@ -85,6 +114,15 @@ dsh plugin --profile web add @alexpeng/dsh-custom-plugin
85
114
 
86
115
  registry 上是预构建产物,安装端无需从源码构建。
87
116
 
117
+ ### 从 GitHub 安装(源码安装)
118
+
119
+ ```sh
120
+ dsh plugin --profile web add github:AlexPeng07/dsh-custom-plugin
121
+ # 重启 dsh web
122
+ ```
123
+
124
+ git 安装拉取的是源码,`prepare` 脚本会在安装端构建 `lib/`。pnpm ≥10 需要一次性授权该构建——把 pnpm 提示的确切包键复制进 profile 的 `pnpm-workspace.yaml` 的 `allowBuilds` 下,再重新执行 add。走上方 npm 路线可免去构建授权。
125
+
88
126
  ### 本地链接(开发)
89
127
 
90
128
  ```sh
@@ -117,7 +155,7 @@ dsh plugin --profile web add link:F:/dsh-plugin-dev
117
155
  | `starsOnly` | `false` | 只显示星标节点 |
118
156
  | `quote` | `true` | 划词引用回复 |
119
157
  | `antiScroll` | `false` | 防自动跳底 |
120
- | `mermaid` | `true` | Mermaid 渲染按钮 |
158
+ | `mermaid` | `true` | Mermaid 图表自动就地渲染(含消息下方渲染按钮) |
121
159
  | `formula` | `true` | LaTeX / MathML 复制按钮 |
122
160
 
123
161
  ## 安全模型
@@ -128,7 +166,7 @@ dsh plugin --profile web add link:F:/dsh-plugin-dev
128
166
 
129
167
  ## 已知限制
130
168
 
131
- - Mermaid 首次渲染需要能访问 CDN(宿主在进程生命周期内缓存引擎)。
169
+ - Mermaid 引擎来自随插件安装的本地依赖,离线可用;仅当依赖缺失时回退 CDN 拉取(宿主在进程生命周期内缓存)。
132
170
  - 用量账本折叠自实时 `session/event` 记录;错过实时事件时可手动「扫描」重读今日会话日志。
133
171
  - 费用按 DeepSeek 官方峰谷单价估算,仅供参考。
134
172
  - 深色模式下背景限制是刻意设计:仅「无颜色」与「极光」可选。
package/cordis.patch.yml CHANGED
@@ -1,13 +1,13 @@
1
1
  # dsh-custom-plugin bundle patch: inserts the dual-face plugin row into the web
2
2
  # profile roster. Applied as a profile bundle layer (the `dsh.bundle.patch`
3
3
  # manifest field) over dsh-base; activate with
4
- # `dsh plugin --profile <name> add link:~/code/dsh-custom-plugin`.
4
+ # `dsh plugin --profile <name> add github:AlexPeng07/dsh-custom-plugin`.
5
5
  #
6
6
  # The row is a bare plugin by package name: the node half (exports ".") runs
7
7
  # in the host process (state store, /api/custom-plugin routes, the
8
8
  # custom_plugin_status agent tool), and the `dsh.client` declaration in
9
9
  # package.json makes the browser half (exports "./client", served at
10
- # /plugins/custom-plugin/client.js) load in the web GUI.
10
+ # /plugins/@alexpeng/dsh-custom-plugin/client.js) load in the web GUI.
11
11
  - insert:
12
12
  - id: custom-plugin
13
13
  name: '@alexpeng/dsh-custom-plugin'