dsh-cookie-cleaner 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/CHANGELOG.md +39 -1
- package/README.md +117 -27
- package/dsh.plugin.json +2 -2
- package/locale/de.json +6 -0
- package/locale/en.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/it.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/ko.json +6 -0
- package/locale/ru.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +12 -3
- package/scripts/gen-locales.mjs +82 -0
- package/scripts/sync-hosts.mjs +10 -1
- package/src/cli.js +68 -30
- package/src/core.js +132 -46
- package/src/i18n.js +139 -0
- package/src/index.js +8 -2
- package/src/locales-advise-owner.js +39 -0
- package/src/locales-dict.js +216 -0
- package/src/locales-dict2.js +210 -0
- package/src/report.js +40 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,49 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.2 (2026-11-04)
|
|
4
|
+
|
|
5
|
+
装载身份与兼容性闸门修复(为后续 client 面板做准备)。
|
|
6
|
+
|
|
7
|
+
- `dsh.plugin.json#id`:`dsh-external/dsh-cookie-cleaner` → `dsh-cookie-cleaner`(= 包名)。
|
|
8
|
+
挂载 id 不等于包名时 client 半从不加载(VD-017-020-06),不修则以后加面板必定白做。
|
|
9
|
+
- `peerDependencies` 补 `@deepseek-ai/dsh-client-ui-renderer`(optional)。兼容性闸门
|
|
10
|
+
**只读 `@deepseek-ai/dsh`/`dsh-*` 前缀的 peer range**,不读 `engines.dsh`:0.1.0/0.1.1 一个
|
|
11
|
+
`dsh*` peer 都没有 → 对所有宿主线恒判兼容,宿主换代时不会干净拒载,而是装载后
|
|
12
|
+
运行期报错。现由 `scripts/sync-hosts.mjs` 从 `scripts/hosts.mjs` 单源下发,与 `engines.dsh` 逐串相同。
|
|
13
|
+
- 门禁:双清单校验加入 renderer peer 一项;新测试钉住「manifest.id = 包名」与
|
|
14
|
+
「至少有一个 `@deepseek-ai/dsh*` peer,且 renderer peer 与 engines.dsh 同串」。
|
|
15
|
+
|
|
16
|
+
## 0.1.1 (2026-11-04)
|
|
17
|
+
|
|
18
|
+
跨平台支持(macOS / Linux)与 9 语分发。
|
|
19
|
+
|
|
20
|
+
- **失败归因重写**:实测 `node:sqlite` 在 POSIX 权限不足时只报
|
|
21
|
+
`ERR_SQLITE_ERROR: unable to open database file`,**不给 EACCES**——原先按错误码分档
|
|
22
|
+
的实现永远走不到权限档,会把「读不了」误报成「客户端在跑」。改为主动探测四档:
|
|
23
|
+
`missing`(文件不在)/ `unreadable`(读不了)/ `not-owned`(属别人)/ `busy`(真占用),
|
|
24
|
+
每档给各自的处置文案,`classifyOpenFailure` 导出且可注入以便测试。
|
|
25
|
+
- **POSIX 平台分叉**:路径推导按目标平台选 `path.win32`/`path.posix`(此前在 Windows 上
|
|
26
|
+
会把 posix 路径写成反斜杠);macOS 走 `~/Library/Application Support`,Linux 尊重
|
|
27
|
+
`XDG_CONFIG_HOME`/`HOME`;`DSH_COOKIE_DB` 直接当首选候选,不再拆根重组;
|
|
28
|
+
退出指引按平台出文案(Linux/mac 不再提「托盘」)。
|
|
29
|
+
- **备份带走 WAL**:POSIX 上 Chromium 用 WAL,只拷主文件是个残副本;现在把
|
|
30
|
+
`-wal`/`-shm`/`-journal` 一并复制并在输出里注明。sidecar 拷不上只记为跳过(`-shm`
|
|
31
|
+
只是可再生的一致性索引),不再让单个 sidecar 被锁导致整单清理失败。
|
|
32
|
+
- **退出码改黑名单**:此前 `missing` 档会退出 0(把失败报成成功);现在只有真读到内容
|
|
33
|
+
的档位才返回 0。
|
|
34
|
+
- **9 语分发**:`locale/<lang>.json`(en 为锚,宿主市场卡)+ 运行时文案字典
|
|
35
|
+
(zh 为键集真理源,`registerDictionary` 装载时机械核对缺键/多键/占位符);
|
|
36
|
+
语言优先级 `--lang` > `DSH_COOKIE_LANG`/`DSH_LANG` > `LC_ALL`/`LANG` > 系统 locale > zh,
|
|
37
|
+
`C.UTF-8`/`POSIX` 中性 locale 判为英文。新增 `lang` 设置项。
|
|
38
|
+
- 测试:`gate` 增 `gen-locales --check`;POSIX `chmod 000` 归因用例在 Windows 自动 skip,
|
|
39
|
+
已在 WSL(node 24)59/59 跑绿;CLI 用例钉死语言,不再随宿主 locale 漂移。
|
|
40
|
+
|
|
3
41
|
## 0.1.0 (2026-11-04)
|
|
4
42
|
|
|
5
43
|
- 首版:只读播报 + 包内独立清理脚本。
|
|
6
44
|
- `src/core.js`:cookie 库定位(win/mac/linux 惯例 + `DSH_USER_DATA` / `DSH_COOKIE_DB` / `--db` 覆盖)、
|
|
7
45
|
只读统计(条数/过期数/host_key 分布/过期跨度)、`BEGIN IMMEDIATE` 独占写锁闸、
|
|
8
|
-
`.bak` 备份 +
|
|
46
|
+
`.bak` 备份 + 原子事务删除 + VACUUM,表结构自检不过即拒绝写入。
|
|
9
47
|
- `src/cli.js`(npm bin `dsh-cookie-cleaner`):`--clean` / `--expired-only` / `--dry-run` / `--no-backup` / `--no-vacuum` / `--db`。
|
|
10
48
|
- `src/index.js`:`/cookie-cleaner` 命令(只读,输出可直接复制的清理命令)+ 三代设置 waist + `volatile` 配置面。
|
|
11
49
|
- 关键事实入档:客户端运行期该库被 Chromium 独占,宿主插件无法在启动时清理;
|
package/README.md
CHANGED
|
@@ -1,38 +1,63 @@
|
|
|
1
1
|
# dsh-cookie-cleaner
|
|
2
2
|
|
|
3
3
|
清理 DSH(DeepSeek Harness)**桌面客户端** cookie 库里堆积的本地登录凭据 cookie(`dsh-auth-*`),
|
|
4
|
-
|
|
4
|
+
并把「为什么只能在客户端关闭时清理」讲清楚——不用每次再去问一遍 AI。
|
|
5
|
+
|
|
6
|
+
输出支持 9 种语言(zh / en / ja / ko / fr / de / it / ru / es),跟随系统 locale。
|
|
5
7
|
|
|
6
8
|
## 它是什么 / 为什么长这样
|
|
7
9
|
|
|
8
|
-
桌面客户端每次启动都会在 Electron 的 cookie
|
|
9
|
-
|
|
10
|
+
桌面客户端每次启动都会在 Electron 的 cookie 库里留下一条
|
|
11
|
+
`dsh-auth-<base64url(sha256(host:port))>`。名字按 **host:port** 哈希,端口一变就多一条,
|
|
10
12
|
各带 30 天有效期,于是历史记录长期堆积。
|
|
11
13
|
|
|
12
14
|
这些记录**不影响登录**,也**不涉及账号凭据**:
|
|
13
15
|
|
|
14
|
-
- 主窗口的 HTTP/WS
|
|
16
|
+
- 主窗口的 HTTP/WS 请求走内存态凭据(宿主换发后由桌面层直接注入请求头),不经 cookie jar;
|
|
15
17
|
- 鉴权只按当前 authority 派生的**那一个名字**取值,其余同名前缀条目本就永远读不到;
|
|
16
18
|
- 每次启动都会用 launch token 重新换发。
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
也无法在运行期打开该库(只读打开都会失败)。所以:
|
|
20
|
+
**关键约束(Windows 与 Linux 双端实测)**:这个库在客户端运行期间被 Chromium 独占,
|
|
21
|
+
而宿主插件跑在 Electron 的纯 Node 模式子进程里,拿不到 `session.cookies`。所以:
|
|
21
22
|
|
|
22
23
|
> 清理动作不可能由「插件在启动时」完成——它只能发生在客户端已完全退出的时间窗里,
|
|
23
24
|
> 而那个时刻宿主插件本身并不存在。因此本仓库把执行体做成**包内独立脚本**,
|
|
24
25
|
> 插件半只做只读播报和命令指引,**永不写库**。
|
|
25
26
|
|
|
27
|
+
## 各平台的库位置与退出方式
|
|
28
|
+
|
|
29
|
+
| 平台 | cookie 库默认位置 | 完全退出客户端的方式 |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| **Windows** | `%APPDATA%\@deepseek-ai\dsh-desktop\Network\Cookies` | 托盘图标 → 退出;确认任务管理器里没有 `DeepSeek Harness` |
|
|
32
|
+
| **macOS** | `~/Library/Application Support/@deepseek-ai/dsh-desktop/Network/Cookies` | `Cmd+Q` 或菜单 → Quit;Dock 图标消失**不等于**已退出,用 `ps aux \| grep -i deepseek` 确认 |
|
|
33
|
+
| **Linux** | `~/.config/@deepseek-ai/dsh-desktop/Network/Cookies`(`XDG_CONFIG_HOME` 优先) | 关闭主窗口后用 `pgrep -af 'DeepSeek Harness\|dsh-desktop'` 确认没有残留 |
|
|
34
|
+
|
|
35
|
+
更早的 Chromium 布局把库直接放在 `<userData>/Cookies`(不带 `Network/`),工具两种都会试。
|
|
36
|
+
位置不对时用 `--db=<完整路径>`,或设 `DSH_USER_DATA` / `DSH_COOKIE_DB` 环境变量。
|
|
37
|
+
flatpak / snap 安装的客户端路径在常规位置之外,通常需要 `--db` 手动指。
|
|
38
|
+
|
|
26
39
|
## 安装
|
|
27
40
|
|
|
28
41
|
```shell
|
|
29
42
|
# 作为 DSH 插件(提供 /cookie-cleaner 只读播报)
|
|
30
|
-
dsh plugin add dsh-cookie-cleaner
|
|
43
|
+
dsh --profile desktop plugin add dsh-cookie-cleaner
|
|
31
44
|
|
|
32
|
-
#
|
|
33
|
-
npm i -g dsh-cookie-cleaner
|
|
34
|
-
|
|
35
|
-
|
|
45
|
+
# 清理工具随包分发;装完即可用 profile 里的别名,或全局安装后直接敲命令
|
|
46
|
+
npm i -g dsh-cookie-cleaner
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
> desktop profile 由客户端自己管理,命令行 `dsh plugin add` 可能被拒
|
|
50
|
+
> (`profile "desktop" is managed exclusively by the Electron application`)——
|
|
51
|
+
> 那种情况下在客户端的插件管理界面里装;**清理脚本本身是独立的**,
|
|
52
|
+
> 全局 npm 安装或 `node <包目录>/src/cli.js` 都能跑,不依赖宿主装载。
|
|
53
|
+
|
|
54
|
+
别名路径(装进 profile 后):
|
|
55
|
+
|
|
56
|
+
```shell
|
|
57
|
+
# Windows
|
|
58
|
+
%USERPROFILE%\.dsh\profiles\desktop\node_modules\.bin\dsh-cookie-cleaner.cmd
|
|
59
|
+
# macOS / Linux
|
|
60
|
+
~/.dsh/profiles/desktop/node_modules/.bin/dsh-cookie-cleaner
|
|
36
61
|
```
|
|
37
62
|
|
|
38
63
|
## 用法
|
|
@@ -43,31 +68,90 @@ dsh-cookie-cleaner --clean 删除回环域(127.0.0.1/localhost/[:
|
|
|
43
68
|
dsh-cookie-cleaner --clean --expired-only 保守档:只删已过期的
|
|
44
69
|
dsh-cookie-cleaner --clean --dry-run 只看会删几条,不写盘
|
|
45
70
|
dsh-cookie-cleaner --db=<完整路径> 手动指定 cookie 库
|
|
71
|
+
dsh-cookie-cleaner --lang=de 指定输出语言(缺省跟随系统 locale)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
退出码:`0` 成功;`1` 失败(被占用 / 无权限 / 找不到 / 参数非法)。
|
|
75
|
+
|
|
76
|
+
### Windows
|
|
77
|
+
|
|
78
|
+
```powershell
|
|
79
|
+
# 1) 先退出客户端(托盘 → 退出),确认没有残留进程
|
|
80
|
+
Get-Process | Where-Object { $_.ProcessName -match 'DeepSeek|dsh' }
|
|
81
|
+
|
|
82
|
+
# 2) 试跑再实删
|
|
83
|
+
dsh-cookie-cleaner --clean --dry-run
|
|
84
|
+
dsh-cookie-cleaner --clean
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### macOS
|
|
88
|
+
|
|
89
|
+
```shell
|
|
90
|
+
# 1) Cmd+Q 退出后确认
|
|
91
|
+
ps aux | grep -i '[D]eepSeek Harness'
|
|
92
|
+
|
|
93
|
+
# 2) 试跑再实删
|
|
94
|
+
dsh-cookie-cleaner --clean --dry-run
|
|
95
|
+
dsh-cookie-cleaner --clean
|
|
96
|
+
|
|
97
|
+
# 没装全局命令时:
|
|
98
|
+
node ~/.dsh/profiles/desktop/node_modules/dsh-cookie-cleaner/src/cli.js --clean
|
|
46
99
|
```
|
|
47
100
|
|
|
48
|
-
|
|
49
|
-
|
|
101
|
+
### Linux
|
|
102
|
+
|
|
103
|
+
```shell
|
|
104
|
+
# 1) 关闭主窗口后确认
|
|
105
|
+
pgrep -af 'DeepSeek Harness|dsh-desktop'
|
|
50
106
|
|
|
51
|
-
|
|
107
|
+
# 2) 试跑再实删
|
|
108
|
+
dsh-cookie-cleaner --clean --dry-run
|
|
109
|
+
dsh-cookie-cleaner --clean
|
|
52
110
|
|
|
53
|
-
|
|
54
|
-
-
|
|
111
|
+
# 只删已过期的:
|
|
112
|
+
dsh-cookie-cleaner --clean --expired-only
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 成功输出长这样
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
Deleted 3 dsh-auth-* entries (all)
|
|
119
|
+
Database: ~/.config/@deepseek-ai/dsh-desktop/Network/Cookies 20480 B → 8192 B
|
|
120
|
+
Backup: ~/.config/@deepseek-ai/dsh-desktop/Network/Cookies.bak-20261104-061512 (incl. -wal, -shm)
|
|
121
|
+
Account credentials, sessions and plugin configuration were not touched; the local cookie is re-issued on next start.
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 安全设计
|
|
125
|
+
|
|
126
|
+
- **独占写锁即闸门**——`BEGIN IMMEDIATE` 拿不到就拒绝执行并给出对应档位的处置文案;
|
|
127
|
+
- **失败归因不猜错误码**:实测 `node:sqlite` 在 POSIX 权限不足时只报
|
|
128
|
+
`unable to open database file`(不给 EACCES),所以工具自己探文件——
|
|
129
|
+
不存在 / 读不了 / 属于别人 / 被占用,四档各说各话,不会一律让你「去关客户端」;
|
|
130
|
+
- 写盘前先拷 `.bak-<时间戳>`,**主库副本失败即整单放弃**(全有或全无);
|
|
131
|
+
`-wal`/`-shm`/`-journal` sidecar 一并带走(POSIX 用 WAL,只拷主文件是个残副本),
|
|
132
|
+
但 sidecar 拷不上只记为跳过,不拦停清理;
|
|
55
133
|
- 删除语句只由 `host_key` 白名单 + 名称前缀构成,两者都过字符校验,时间戳走 BigInt 绑定参数;
|
|
56
134
|
- 表结构自检:库里没有 `cookies` 表或缺关键列,一律拒绝,绝不对未知库执行写语句。
|
|
57
135
|
|
|
58
|
-
Node ≥ 22.19(用到 `node:sqlite
|
|
59
|
-
|
|
136
|
+
Node ≥ 22.19(用到 `node:sqlite`;Electron 44 内置的 Node 24 亦可)。
|
|
137
|
+
Node 22 上会有一条 `ExperimentalWarning: SQLite`,可用 `node --no-warnings` 消掉。
|
|
138
|
+
|
|
139
|
+
## 语言
|
|
140
|
+
|
|
141
|
+
优先级:`--lang` > `DSH_COOKIE_LANG` / `DSH_LANG` > `LC_ALL` / `LC_MESSAGES` / `LANG` > 系统 locale > `zh`。
|
|
142
|
+
`LANG=C.UTF-8` / `POSIX` 这类中性 locale 判为英文(Linux 上很常见,不该给你看中文)。
|
|
143
|
+
认不出的语言落 `zh`,不会因此报错。插件侧同一套字典,可用设置项 `lang` 钉住。
|
|
60
144
|
|
|
61
145
|
## 插件面
|
|
62
146
|
|
|
63
147
|
- 命令 `/cookie-cleaner` `[status|clean]`:**只读**。输出当前统计 + 可直接复制执行的清理命令。
|
|
64
|
-
- 设置 `cookie-cleaner`:`userDataRoot`(覆盖 Electron userData
|
|
65
|
-
`
|
|
66
|
-
- 没有 client
|
|
148
|
+
- 设置 `cookie-cleaner`:`userDataRoot`(覆盖 Electron userData 根)、`expiredOnly`(保守档措辞)、
|
|
149
|
+
`lang`(钉住输出语言,留空=自动探测)。
|
|
150
|
+
- 没有 client 卡片:这是运维工具,界面交给终端;`locale/<lang>.json` 供宿主市场卡显示。
|
|
67
151
|
|
|
68
152
|
## 想让残留自动消失(不用手动清)
|
|
69
153
|
|
|
70
|
-
|
|
154
|
+
宿主内置寿命闸:把 `@deepseek-ai/dsh-client-connection` 的 `cookieMaxAgeDays`(默认 30,最小 1)
|
|
71
155
|
调到 1,Chromium 便会在启动时自行清掉过期行,历史条目不再堆积。代价是最后一次领取的 cookie
|
|
72
156
|
只有 1 天有效期,重启即续期。在 profile 的 `cordis.patch.yml` 追加:
|
|
73
157
|
|
|
@@ -78,11 +162,17 @@ Node ≥ 22.19(用到 `node:sqlite`,Electron 44 内置的 Node 24 亦可)
|
|
|
78
162
|
cookieMaxAgeDays: 1
|
|
79
163
|
```
|
|
80
164
|
|
|
81
|
-
##
|
|
165
|
+
## 开发与发版
|
|
166
|
+
|
|
167
|
+
```shell
|
|
168
|
+
npm run sync-hosts # 把 scripts/hosts.mjs 的宿主线刷进双清单
|
|
169
|
+
npm run gen-locales # 由 scripts/gen-locales.mjs 的表生成 locale/*.json(9 语)
|
|
170
|
+
npm run gate # 双清单 check + locale check + eslint + 全部测试
|
|
171
|
+
npm run prepack # 发布前自动跑 gate
|
|
172
|
+
```
|
|
82
173
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
`prepack` 会以 `--check` 拦截不一致。
|
|
174
|
+
跨平台验证:测试套件同时要求在 Windows 与 Linux(含 `chmod 000` 归因用例,
|
|
175
|
+
在 Windows 上自动 skip)跑绿;POSIX 语义在 WSL/原生 Linux 实测过。
|
|
86
176
|
|
|
87
177
|
## License
|
|
88
178
|
|
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "dsh-
|
|
3
|
-
"version": "0.1.
|
|
2
|
+
"id": "dsh-cookie-cleaner",
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"description": "Cookie 清理器:只读播报桌面客户端 cookie 库里残留的本地登录凭据(dsh-auth-*),并随包分发「客户端完全退出后」可执行的清理命令(独占写锁 + .bak 备份,账号凭据/会话/插件配置不受影响)。",
|
|
6
6
|
"engines": {
|
package/locale/de.json
ADDED
package/locale/en.json
ADDED
package/locale/es.json
ADDED
package/locale/fr.json
ADDED
package/locale/it.json
ADDED
package/locale/ja.json
ADDED
package/locale/ko.json
ADDED
package/locale/ru.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cookie-cleaner",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Cookie cleaner for DeepSeek Harness: reports the local dsh-auth-* entries left in the desktop client's Chromium cookie store and ships a standalone command that purges them once the client is fully closed (backup + atomic transaction, credentials/sessions/plugin config untouched).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"exports": {
|
|
21
21
|
".": "./src/index.js",
|
|
22
22
|
"./core": "./src/core.js",
|
|
23
|
+
"./locale/*.json": "./locale/*.json",
|
|
23
24
|
"./package.json": "./package.json"
|
|
24
25
|
},
|
|
25
26
|
"dsh": {
|
|
@@ -53,16 +54,23 @@
|
|
|
53
54
|
},
|
|
54
55
|
"scripts": {
|
|
55
56
|
"sync-hosts": "node scripts/sync-hosts.mjs",
|
|
57
|
+
"gen-locales": "node scripts/gen-locales.mjs",
|
|
56
58
|
"test": "node --test \"tests/*.test.js\"",
|
|
57
59
|
"lint": "eslint .",
|
|
58
|
-
"gate": "node scripts/sync-hosts.mjs --check && npm run lint && npm test",
|
|
60
|
+
"gate": "node scripts/sync-hosts.mjs --check && node scripts/gen-locales.mjs --check && npm run lint && npm test",
|
|
59
61
|
"prepack": "npm run gate"
|
|
60
62
|
},
|
|
61
63
|
"dependencies": {
|
|
62
64
|
"@deepseek-ai/schemastery": "^3.18.4"
|
|
63
65
|
},
|
|
64
66
|
"peerDependencies": {
|
|
65
|
-
"@deepseek-ai/cordis": ">=4.0.1 <5"
|
|
67
|
+
"@deepseek-ai/cordis": ">=4.0.1 <5",
|
|
68
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5"
|
|
69
|
+
},
|
|
70
|
+
"peerDependenciesMeta": {
|
|
71
|
+
"@deepseek-ai/dsh-client-ui-renderer": {
|
|
72
|
+
"optional": true
|
|
73
|
+
}
|
|
66
74
|
},
|
|
67
75
|
"devDependencies": {
|
|
68
76
|
"@eslint/js": "^10.0.1",
|
|
@@ -72,6 +80,7 @@
|
|
|
72
80
|
"files": [
|
|
73
81
|
"src",
|
|
74
82
|
"scripts",
|
|
83
|
+
"locale",
|
|
75
84
|
"cordis.patch.yml",
|
|
76
85
|
"dsh.plugin.json",
|
|
77
86
|
"README.md",
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/gen-locales.mjs — 生成 locale/<lang>.json(9 语包元数据)。
|
|
3
|
+
*
|
|
4
|
+
* 单一真源就是本文件的 TABLE;`--check` 模式只校验磁盘与表一致(prepack 门禁挂它),
|
|
5
|
+
* 避免「手改了 json 没同步表」或反之。宿主以 en.json 为锚,缺锚则整个 locale/ 被忽略。
|
|
6
|
+
*/
|
|
7
|
+
import fs from 'node:fs'
|
|
8
|
+
import path from 'node:path'
|
|
9
|
+
import { fileURLToPath } from 'node:url'
|
|
10
|
+
|
|
11
|
+
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
|
12
|
+
const OUT = path.join(ROOT, 'locale')
|
|
13
|
+
|
|
14
|
+
const TABLE = {
|
|
15
|
+
zh: {
|
|
16
|
+
title: 'Cookie 清理器',
|
|
17
|
+
description: '只读播报桌面客户端 cookie 库里残留的 dsh-auth-* 本地登录凭据,并随包分发「客户端完全退出后」可执行的清理命令。',
|
|
18
|
+
},
|
|
19
|
+
en: {
|
|
20
|
+
title: 'Cookie Cleaner',
|
|
21
|
+
description: "Reports leftover dsh-auth-* entries in the desktop client's cookie store and ships a command that purges them once the client is fully closed.",
|
|
22
|
+
},
|
|
23
|
+
ja: {
|
|
24
|
+
title: 'Cookie クリーナー',
|
|
25
|
+
description: 'デスクトップクライアントの cookie ストアに残った dsh-auth-* を読み取り専用で報告し、クライアントを完全終了後に消去するコマンドを同梱します。',
|
|
26
|
+
},
|
|
27
|
+
ko: {
|
|
28
|
+
title: 'Cookie 정리 도구',
|
|
29
|
+
description: '데스크톱 클라이언트 cookie 저장소에 남은 dsh-auth-*를 읽기 전용으로 보고하고, 클라이언트를 완전히 종료한 뒤 지우는 명령을 함께 배포합니다.',
|
|
30
|
+
},
|
|
31
|
+
fr: {
|
|
32
|
+
title: 'Nettoyeur de cookies',
|
|
33
|
+
description: "Signale les entrées dsh-auth-* restantes dans la base de cookies du client desktop et fournit une commande qui les purger une fois le client entièrement fermé.",
|
|
34
|
+
},
|
|
35
|
+
de: {
|
|
36
|
+
title: 'Cookie-Räumer',
|
|
37
|
+
description: 'Meldet übrig gebliebene dsh-auth-* Einträge im Cookie-Speicher des Desktop-Clients und liefert einen Befehl, der sie nach vollständigem Beenden des Clients räumt.',
|
|
38
|
+
},
|
|
39
|
+
it: {
|
|
40
|
+
title: 'Pulitore di cookie',
|
|
41
|
+
description: "Segnala le voci dsh-auth-* residue nell'archivio cookie del client desktop e fornisce un comando che le elimina dopo aver chiuso completamente il client.",
|
|
42
|
+
},
|
|
43
|
+
ru: {
|
|
44
|
+
title: 'Очистка cookie',
|
|
45
|
+
description: 'Отчитывается об остатках dsh-auth-* в хранилище cookie десктопного клиента и поставляет команду очистки, применимую только после полного выхода из клиента.',
|
|
46
|
+
},
|
|
47
|
+
es: {
|
|
48
|
+
title: 'Limpiador de cookies',
|
|
49
|
+
description: 'Informa de las entradas dsh-auth-* residuales en el almacén de cookies del cliente de escritorio y ofrece un comando que las purga tras cerrar del todo el cliente.',
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const langs = Object.keys(TABLE)
|
|
54
|
+
if (langs.length !== 9) throw new Error('locale 必须正好 9 语,当前 ' + langs.length)
|
|
55
|
+
if (!langs.includes('en')) throw new Error('缺 en 锚,宿主会忽略整个 locale/ 目录')
|
|
56
|
+
|
|
57
|
+
const check = process.argv.includes('--check')
|
|
58
|
+
const drift = []
|
|
59
|
+
fs.mkdirSync(OUT, { recursive: true })
|
|
60
|
+
|
|
61
|
+
for (const lang of langs) {
|
|
62
|
+
const expected = JSON.stringify({ meta: TABLE[lang] }, null, 2) + '\n'
|
|
63
|
+
const file = path.join(OUT, `${lang}.json`)
|
|
64
|
+
if (check) {
|
|
65
|
+
const actual = fs.existsSync(file) ? fs.readFileSync(file, 'utf8') : null
|
|
66
|
+
if (actual === null) drift.push(`${lang}.json 缺失`)
|
|
67
|
+
else if (actual !== expected) drift.push(`${lang}.json 与表不一致`)
|
|
68
|
+
} else {
|
|
69
|
+
fs.writeFileSync(file, expected, 'utf8')
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (check) {
|
|
74
|
+
if (drift.length > 0) {
|
|
75
|
+
process.stderr.write('locale 漂移:\n - ' + drift.join('\n - ') + '\n运行 `node scripts/gen-locales.mjs` 修复。\n')
|
|
76
|
+
process.exitCode = 1
|
|
77
|
+
} else {
|
|
78
|
+
process.stdout.write(`locale 9 语与表一致(锚 en 在位)\n`)
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
process.stdout.write(`已生成 ${langs.length} 份 locale/<lang>.json\n`)
|
|
82
|
+
}
|
package/scripts/sync-hosts.mjs
CHANGED
|
@@ -17,6 +17,7 @@ const failures = []
|
|
|
17
17
|
|
|
18
18
|
const pkgPath = path.join(ROOT, 'package.json')
|
|
19
19
|
const manifestPath = path.join(ROOT, 'dsh.plugin.json')
|
|
20
|
+
const RENDERER = '@deepseek-ai/dsh-client-ui-renderer'
|
|
20
21
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))
|
|
21
22
|
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
|
|
22
23
|
|
|
@@ -30,6 +31,9 @@ compare('package.json#engines.dsh', pkg.engines?.dsh, range)
|
|
|
30
31
|
compare('package.json#dsh.compatibility.dshReleases', pkg.dsh?.compatibility?.dshReleases, releases)
|
|
31
32
|
compare('dsh.plugin.json#engines.dsh', manifest.engines?.dsh, range)
|
|
32
33
|
compare('dsh.plugin.json#version', manifest.version, pkg.version)
|
|
34
|
+
// 兼容性闸门只读 @deepseek-ai/dsh* 前缀的 peer range(不读 engines.dsh),
|
|
35
|
+
// 所以这张卡漏不得:少了它宿主换代时不会拒载,而是装载后运行期报错。
|
|
36
|
+
compare('package.json#peerDependencies[renderer]', pkg.peerDependencies?.[RENDERER], range)
|
|
33
37
|
|
|
34
38
|
if (check) {
|
|
35
39
|
if (failures.length > 0) {
|
|
@@ -39,10 +43,15 @@ if (check) {
|
|
|
39
43
|
process.stdout.write(`双清单一致(${HOSTS.length} 条宿主线)\n`)
|
|
40
44
|
}
|
|
41
45
|
} else if (failures.length > 0) {
|
|
46
|
+
// 版本号以 package.json 为源,把同号刷进 dsh.plugin.json(不然改版本必遗漏一处,V1 闸抓不到)
|
|
42
47
|
pkg.engines = { ...pkg.engines, dsh: range }
|
|
43
48
|
pkg.dsh = { ...pkg.dsh, compatibility: { ...pkg.dsh?.compatibility, dshReleases: releases } }
|
|
49
|
+
pkg.peerDependencies = { ...pkg.peerDependencies, [RENDERER]: range }
|
|
44
50
|
manifest.engines = { ...manifest.engines, dsh: range }
|
|
45
|
-
manifest.version
|
|
51
|
+
if (manifest.version !== pkg.version) {
|
|
52
|
+
manifest.version = pkg.version
|
|
53
|
+
process.stdout.write(`dsh.plugin.json#version 同步为 ${pkg.version}\n`)
|
|
54
|
+
}
|
|
46
55
|
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf8')
|
|
47
56
|
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n', 'utf8')
|
|
48
57
|
process.stdout.write(`已同步 ${HOSTS.length} 条宿主线到 package.json / dsh.plugin.json\n`)
|