@alexpeng/dsh-custom-plugin 0.4.0 → 0.4.1
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 +19 -0
- package/README.i18n.yaml +3 -3
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/lib/client.js +17 -14
- package/lib/client.js.map +1 -1
- package/lib/types/client/index.d.ts +6 -6
- package/package.json +2 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@ 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.1 — 2026-09-09
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **Fresh installs show nothing after a "successful" install.** `keytar` (a
|
|
12
|
+
native optional dependency) tripped pnpm 11's strict build-script gate, so
|
|
13
|
+
`dsh plugin add` exited non-zero and the harness never reconciled the bundle
|
|
14
|
+
layer — the package sat inert in `dependencies` with no host half and no
|
|
15
|
+
browser half. `keytar` is no longer a dependency: the OS-keyring adapter
|
|
16
|
+
still detects a `keytar` module present in the profile's `node_modules`, and
|
|
17
|
+
users who want the OS keyring can add it themselves
|
|
18
|
+
(`dsh plugin --profile web add keytar`).
|
|
19
|
+
- The browser half now waits for the `slots` service (a child fiber) before
|
|
20
|
+
mounting its surfaces instead of reading it synchronously: newer dsh builds
|
|
21
|
+
activate the slots provider after this plugin's entry, and the synchronous
|
|
22
|
+
read lost that race every time, logging "slots service unavailable" and
|
|
23
|
+
skipping all UI. The mount stays fail-soft — the GUI boots even when the
|
|
24
|
+
service never appears.
|
|
25
|
+
|
|
7
26
|
## 0.4.0 — 2026-09-03
|
|
8
27
|
|
|
9
28
|
### Added
|
package/README.i18n.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
# Bilingual-pair consistency record: the git blob hash of each README as of
|
|
2
2
|
# the last confirmed-consistent state. Both languages carry equal authority;
|
|
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: eb2b863638b101a7b1a768233e687218ec913549
|
|
7
|
+
README.zh.md: ec3625b6ef3a95adc4ce9519a6cda7c775e51f97
|
package/README.md
CHANGED
|
@@ -178,7 +178,7 @@ Appearance and feature toggles (the `cfg` field, all with defaults):
|
|
|
178
178
|
## Security model
|
|
179
179
|
|
|
180
180
|
- The browser talks to the host only through loopback `/api/custom-plugin` routes; every route checks a loopback socket address, a loopback Host header, and browser same-origin markers (`sec-fetch-site` / `Origin`). `X-Forwarded-For` is never trusted.
|
|
181
|
-
- The browser never receives the saved DeepSeek API key. New panel keys use the
|
|
181
|
+
- The browser never receives the saved DeepSeek API key. New panel keys use the OS credential store through `keytar` when it is present; older plaintext state keys are migrated on startup when that store is available. `keytar` ships as no dependency of this plugin (a native module would trip pnpm 11's strict build gate and silently keep the whole bundle from activating); users who want the OS keyring can add it to the profile themselves: `dsh plugin --profile web add keytar`.
|
|
182
182
|
- If the OS credential store is unavailable, the plugin keeps a compatibility fallback in `$DSH_HOME/custom-plugin-state.json`; protect `$DSH_HOME` accordingly. DSH's own `$DSH_HOME/.credentials.yaml` remains a supported plaintext fallback.
|
|
183
183
|
- Conversation exports and timeline data stay on the local host.
|
|
184
184
|
|
|
@@ -187,7 +187,7 @@ Appearance and feature toggles (the `cfg` field, all with defaults):
|
|
|
187
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).
|
|
188
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.
|
|
189
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.
|
|
190
|
-
- OS credential storage
|
|
190
|
+
- OS credential storage detects a `keytar` module present in the profile's `node_modules` when the host starts; when it cannot be loaded, the compatibility state-file fallback is used.
|
|
191
191
|
- Cost estimates use DeepSeek's official peak/off-peak list prices and are indicative only.
|
|
192
192
|
- Dark-mode background restriction is deliberate: only "no color" and "aurora" are selectable in dark mode.
|
|
193
193
|
- DSH currently exposes no archive-restore API; the plugin does not bypass that boundary by editing the underlying registry.
|
package/README.zh.md
CHANGED
|
@@ -178,7 +178,7 @@ dsh plugin --profile web add link:F:/dsh-plugin-dev
|
|
|
178
178
|
## 安全模型
|
|
179
179
|
|
|
180
180
|
- 浏览器仅通过回环地址上的 `/api/custom-plugin` 路由与宿主通信;每条路由同时校验回环 socket 地址、回环 Host 头与浏览器同源标记(`sec-fetch-site` / `Origin`),`X-Forwarded-For` 永不信任。
|
|
181
|
-
- 浏览器永远不会收到已保存的 DeepSeek API Key。面板新输入的 Key
|
|
181
|
+
- 浏览器永远不会收到已保存的 DeepSeek API Key。面板新输入的 Key 在 `keytar` 存在时优先写入系统凭据存储;旧版状态文件中的明文 Key 会在系统存储可用时启动迁移。`keytar` 不再作为本插件的依赖发布(原生模块会触发 pnpm 11 的严格构建门禁,导致整个插件包安装后无法激活);需要系统钥匙串的用户可自行加入 profile:`dsh plugin --profile web add keytar`。
|
|
182
182
|
- 如果系统凭据存储不可用,插件会兼容回退到 `$DSH_HOME/custom-plugin-state.json`;请相应保护 `$DSH_HOME` 目录。DSH 自身的 `$DSH_HOME/.credentials.yaml` 明文凭据仍可复用。
|
|
183
183
|
- 会话导出与时间线数据全部停留在本机。
|
|
184
184
|
|
|
@@ -187,7 +187,7 @@ dsh plugin --profile web add link:F:/dsh-plugin-dev
|
|
|
187
187
|
- Mermaid 引擎来自随插件安装的本地依赖,离线可用;仅当依赖缺失时回退 CDN 拉取(宿主在进程生命周期内缓存)。
|
|
188
188
|
- 用量账本折叠自实时 `session/event` 记录,只保留最近 90 个北京时间日;错过实时事件时可手动「扫描」,扫描最多并发读取 4 个会话日志。
|
|
189
189
|
- 额度面板会显示峰/闲 token 与费用分布,并提供官方价目链接;没有峰时字段的历史行会标记为“不精确”,不计入费用总额,重新扫描后可更新。
|
|
190
|
-
-
|
|
190
|
+
- 系统凭据存储会在宿主启动时检测 profile `node_modules` 中的 `keytar` 模块;无法加载时使用兼容的状态文件回退。
|
|
191
191
|
- 费用按 DeepSeek 官方峰谷单价估算,仅供参考。
|
|
192
192
|
- 深色模式下背景限制是刻意设计:仅「无颜色」与「极光」可选。
|
|
193
193
|
- DSH 当前没有公开的归档恢复接口;插件不会绕过官方边界修改底层注册表。
|
package/lib/client.js
CHANGED
|
@@ -6025,27 +6025,30 @@ window.__ModuleLoader__.load({
|
|
|
6025
6025
|
//#endregion
|
|
6026
6026
|
//#region src/client/index.ts
|
|
6027
6027
|
/**
|
|
6028
|
-
* Required services. Deliberately empty:
|
|
6029
|
-
* (
|
|
6030
|
-
* (waiting for services)" — a fiber that waits
|
|
6031
|
-
* runtime never provides would block the whole
|
|
6032
|
-
* "Loading plugins…" gate forever.
|
|
6028
|
+
* Required services. Deliberately empty: the mount waits on `slots` inside
|
|
6029
|
+
* `apply` (a child fiber) instead of declaring it here, so this entry can
|
|
6030
|
+
* never sit "pending (waiting for services)" — a top-level fiber that waits
|
|
6031
|
+
* on a service name the client runtime never provides would block the whole
|
|
6032
|
+
* web boot behind the "Loading plugins…" gate forever.
|
|
6033
6033
|
*/
|
|
6034
6034
|
const inject = [];
|
|
6035
6035
|
/**
|
|
6036
|
-
* Mount the Custom suite.
|
|
6036
|
+
* Mount the Custom suite once the slots service is available.
|
|
6037
6037
|
* @param ctx - client root context.
|
|
6038
6038
|
*/
|
|
6039
6039
|
function apply(ctx) {
|
|
6040
6040
|
ctx.effect(() => {
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6041
|
+
ctx.inject(["slots"], (slotCtx) => {
|
|
6042
|
+
try {
|
|
6043
|
+
return installCustomPlugin(slotCtx, apiDiagReport);
|
|
6044
|
+
} catch (error) {
|
|
6045
|
+
const message = `install failed: ${String(error?.message ?? error)}`;
|
|
6046
|
+
console.error(`[custom-plugin] ${message}`);
|
|
6047
|
+
apiDiagReport(message);
|
|
6048
|
+
return () => {};
|
|
6049
|
+
}
|
|
6050
|
+
});
|
|
6051
|
+
return () => {};
|
|
6049
6052
|
}, "custom-plugin: surfaces");
|
|
6050
6053
|
}
|
|
6051
6054
|
//#endregion
|