dsh-connect-workbuddy 5.20.2 → 5.20.32

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/README.en.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src="docs/assets/dsh-connect-workbuddy-usage-card.png" width="640" alt="dsh-connect-workbuddy settings card: model directory with multipliers, image and off-thinking switches, promo badges (account names redacted)" />
2
+ <img src="docs/assets/dsh-connect-workbuddy-usage-card.png" width="640" alt="dsh-connect-workbuddy settings card: model directory with multipliers, image and off-thinking switches, promo badges (this view carries no account data)" />
3
3
  </p>
4
4
 
5
5
  <h1 align="center">dsh-connect-workbuddy</h1>
@@ -19,6 +19,11 @@
19
19
 
20
20
  A [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) bundle plugin that connects locally signed-in WorkBuddy models to the DSH model picker — **both the CN app and the international WorkBuddy AI app are supported** — with an account pool, selectable model management, and a set of read-only capabilities built around credits: **every catalog refresh reads each model's credit multiplier from upstream** (the `x0.79` figure comes entirely from the upstream catalog; the plugin neither hard-codes it nor guesses), image input is toggled per model, multiple accounts can be switched or fail over automatically through the pool, and daily check-in plus read-only credit overviews shown as compact pills on the card and in the composer. **The CN and international sides are two parallel providers (`workbuddy` / `workbuddy-global`) that can be used at the same time**; the settings page separates them with tabs for convenient management. All it needs is a WorkBuddy sign-in on this machine — or **one sign-in from the browser**.
21
21
 
22
+ ### Icon style
23
+
24
+ At the bottom of the **Capabilities** tab in Settings, choose an icon style. The default is this plugin's own icon; the alternative skin follows the theme's text colour. The sidebar, page header and panel update immediately, and the choice is stored in the current browser — other browsers keep their own.
25
+
26
+
22
27
  ## Risk notice
23
28
 
24
29
  > **WorkBuddy has begun restricting requests from unofficial clients. This project does not promise that these endpoints will keep working; the day upstream tightens its rules, the plugin may stop working. Read the [Disclaimer](#disclaimer) at the end of this file and judge the account risk for yourself. Using the official WorkBuddy client is always the safest choice.**
@@ -50,7 +55,7 @@ It depends on the WorkBuddy client's own endpoints (not a public API), so the pl
50
55
  - **Local account switching** — discovers the multiple sign-in credentials WorkBuddy's desktop app leaves behind and lets you switch per region. Tokens are never written to DSH settings.
51
56
  - **Credit readout in the composer toolbar (follows the selected model, per region)** — a clickable readout sits at the left of the composer toolbar (e.g. `WB CN · 1,072`) and **switches region automatically with the model this session is using**: pick a WB CN model and it shows the domestic balance, pick a WB AI model and it shows the international one; with any other provider's model it does not appear at all. It refreshes every 5 minutes and can also be refreshed by hand. Clicking it opens a panel: a **table of balances per account**, where clicking a row switches to that account (the same setting the card's account picker writes), and an account that cannot serve right now is **labelled in its row** (e.g. rate-limited, out of credits) using the same wording as the account-pool table. The per-account figures are fetched only while the panel is open, so the 5-minute background refresh never multiplies by the account count. To turn a side off, untick “Show credits in the composer toolbar” under that region's tab on the card; while a region's provider is switched off, the readout disappears and its switch is disabled. The same block carries a “Position” line: by default the readout sits in the composer toolbar (the row with the model picker); choosing “below the input box” moves it to the turn/step/token stats row instead — useful when another plugin has taken the toolbar seat.
52
57
 
53
- <img src="docs/assets/dsh-connect-workbuddy-composer-credits.png" width="360" alt="Composer credit panel: a per-account balance table for the domestic region, with a one-click test button and a last-refreshed time (account names redacted)" />
58
+ <img src="docs/assets/dsh-connect-workbuddy-composer-credits.png" width="360" alt="Composer credit panel: a per-account balance table for the domestic region, with a one-click test button and a last-refreshed time (account names covered by solid blocks)" />
54
59
  - **Account pool: batch actions across several accounts, plus automatic failover** — tick the accounts you want into a pool and you get **one-click check-in for every account**, **one-click testing of every account against a model you choose** (defaulting to the region's zero-multiplier free model), and with **Enable the account pool** switched on, **automatic failover**: a request that fails upstream is retried against the pool's other usable accounts, in order, until one serves it or none is left. Membership starts **empty and is an explicit opt-in**: "signed in on this machine" is not the same as "spend this account's credits and claim its rewards". The pool's **ranking decides who serves every request** (usable first, then expiring-credits-first, higher credits, freshest credential), and on a failure the next usable member is tried. It **never writes back your saved selection** — switch the pool off and your own account applies again immediately. **The switch only decides whether the PLUGIN chooses** — with it off, the plugin stops picking and switching accounts for you, but check-in and testing stay available (they are manual actions). Testing reuses the model rows' real-volume probe, so it **does cost real credits**; **automatic check-in is deliberately not offered** — a check-in claims real rewards, so it only ever runs when you press the button. See [Account pool](#account-pool).
55
60
  - **Enterprise / education accounts: check-in and Claim do not apply** — a seat carrying an `enterpriseId` shows **no check-in column, no benefit campaigns, and no Claim request** in the pool (5.8.0, issue #129): upstream refuses the personal-entitlement **write** endpoints for such members (measured `10001`), while its **read** endpoint still lists the campaigns as unclaimed — so "the read said available" can never be the reason to write. Their credits live in a different book too (enterprise usage = limit − used), and the personal credit table simply returns an empty list. The flag now reaches the pool rows (`localPoolMembers`, `poolMembersOf`, `otherAccounts`) and the web account rows, and it is attached the moment an account enters the pool rather than after a click discovers it is unsupported. It is deliberately **not** on the usage page's top-level `account` object (that one was fixed for the display **name** only, via `preferredAccountName`) and not on the composer pill, which renders neither button.
56
61
  - **Optional: make the usage page record these calls like the official client's (5.8.0, issue #132, OFF by default)** — with `usageIdentity` on, chat requests carry `X-IDE-Name: WorkBuddy` (plus `X-IDE-Type: CLI` and a version taken from the existing product UA, not a second hard-coded number), so the usage page's client column is no longer blank, and the conversation-identity triple becomes the official **32-character lower-case hex UUIDv7** with `X-Request-ID` alongside it — the gateway echoes that id as the SSE `id` and writes it into the usage page, so hyphenated v4 ids made one account's rows look like two different clients — while "fresh per request, all distinct" has not been relaxed. **`User-Agent` is untouched under either setting**: billing and rate limits recognise the CLI channel. The image endpoint does not follow this switch; it keeps the shape measured on 2026-10-21. It is off by default because the shape fixes nothing on its own (the three `11128` doors read message openings, a missing conversation id, and whether the first message is a system prompt — no header moves any of them) and the only measurement is a reporter's on an older build, so a purely cosmetic alignment does not get to put every account at risk first. There is also an opt-in `keepPromptLast` (**off by default**): the usage page takes the request text from the LAST `user` message, and the host appends its time samples, runtime context and `<system-reminder>` blocks AFTER what you actually typed, so that column recorded injected text; when enabled it moves those injected blocks **above the real prompt** — order only, except that the recorded prompt's own leading `<acp …>mNNNNN</acp>` marker is stripped (leave it and that column still opens with a marker, i.e. nothing was fixed); earlier messages **keep** theirs, because the model cites history by those ids and the only id that can never matter is the message being answered now. It stays off by default because the order is something the upstream counts and a few leading characters are removed from the real prompt. The move matches only the host's own injected prefixes, and a conversation with no injected tail is untouched byte for byte — marker included — pinned by tests written for both.
@@ -107,7 +112,7 @@ Only **https** is accepted, on a subdomain of `copilot.tencent.com`, `tencentbud
107
112
  ## Account pool
108
113
 
109
114
  <p align="center">
110
- <img src="docs/assets/dsh-connect-workbuddy-account-pool.png" width="900" alt="dsh-connect-workbuddy account pool: check in the checked accounts, test the checked accounts, manual ordering and check-in state (account names redacted)" />
115
+ <img src="docs/assets/dsh-connect-workbuddy-account-pool.png" width="900" alt="dsh-connect-workbuddy account pool: check in the checked accounts, test the checked accounts, manual ordering and check-in state (account names covered by solid blocks)" />
111
116
  </p>
112
117
 
113
118
  A machine usually carries more than one WorkBuddy sign-in. The **account pool** turns that into a single click: tick the accounts you want into the pool, then press **Check in selected** or **Test selected**; switch on **Enable the account pool** and the plugin will carry on through a failure by itself.
@@ -533,7 +538,7 @@ pnpm run check # typecheck + test + build
533
538
  Local dev via a `link:` install to the desktop profile (restart DSH Desktop after editing):
534
539
 
535
540
  ```sh
536
- dsh plugin --profile desktop add /Users/dmh2002/DshProject/dsh-connect-workbuddy
541
+ dsh plugin --profile desktop add /Users/<you>/DshProject/dsh-connect-workbuddy
537
542
  ```
538
543
 
539
544
  #### A `link:` install must be built first, or DSH refuses to load it
@@ -601,6 +606,24 @@ Marketplace screenshots and GitHub README badges are two separate mechanisms:
601
606
 
602
607
  **The title and description on the plugin card are not rendered by this plugin** — they are **package metadata** the DSH plugin manager reads: it takes its words from `meta.title` / `meta.description` in `locale/<lang>.json` (`locale/en.json` is the anchor, so without it `zh.json` is never read; without the `"./locale/*.json"` wildcard in `exports` the whole directory is skipped **silently**), and falls back to `package.json`'s `description` for English. The same sentence therefore lives in three places in this repository, and [`tests/locale-meta.spec.ts`](tests/locale-meta.spec.ts) pins them together: the card dictionary (`locale/en.json` / `locale/zh.json`), the English fallback (`package.json.description`) and the listing draft (`description.en` / `description.zh` in `awesome-dsh-plugin-submission/dingminhua__dsh-connect-workbuddy.yml`). **Edit one, edit all three.**
603
608
 
609
+ ## Privacy and redaction
610
+
611
+ The plugin has **no telemetry and no analytics, and sends nothing to the author of this repository or to any third-party server**. Credentials stay on your machine under `$DSH_HOME/workbuddy-vault/`, and tokens only ever reach the loopback shim in process memory. **The only thing that leaves your machine is the request to the WorkBuddy upstream gateway itself** — that is the plugin's entire purpose — going to `copilot.tencent.com` (domestic) or `www.workbuddy.ai` / `www.codebuddy.ai` (global) for the account you configured; the image/video tools additionally read **the URLs you explicitly hand them**. There are no other outbound connections.
612
+
613
+ **This section is about a different thing — the repository must not keep anything that points back to a specific account, machine or session**: account names in screenshots, phone numbers and uins in prose, home paths in pasted logs.
614
+
615
+ This is not politeness. **A screenshot that was never redacted, or one real account number pasted into the CHANGELOG, cannot be taken back once it reaches GitHub or the npm tarball** — old npm tarballs stay downloadable forever and anyone can clone the git history. So it is enforced as a process, not a habit:
616
+
617
+ ```bash
618
+ node scripts/check-pii.mjs # non-zero exit blocks the release
619
+ ```
620
+
621
+ - The full rules live in **[`docs/PRIVACY.md`](docs/PRIVACY.md)** (**shipped in the package**, because it is a promise to users). It lists the five surfaces, requires solid fills rather than mosaic/blur in screenshots, and spells out why "cropped is not redacted".
622
+ - The script is wired into both `prepack` and `pnpm run check`, so **npm runs it before packing** and stops on a hit.
623
+ - `tests/privacy-gate.spec.ts` pins that wiring (`prepack` / `check` / the `files` whitelist), and `tests/check-pii-script.spec.ts` feeds in counter-examples to prove the scanner **still bites** — a scanner that only ever prints "clean" is worse than none.
624
+
625
+ **Automated scanning only recognises the shapes it knows.** The first time you screenshot developer tools or paste a real device log, the rules will not cover it — look at it yourself, and add the new pattern to the rule table.
626
+
604
627
  ## Known limitations
605
628
 
606
629
  - The plugin depends on WorkBuddy client endpoints (not an official public API), so a WorkBuddy update may require adjustments.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src="docs/assets/dsh-connect-workbuddy-usage-card.png" width="640" alt="dsh-connect-workbuddy 设置卡:模型目录与倍率、图片与可关闭思考开关、活动标签(账号名已打码)" />
2
+ <img src="docs/assets/dsh-connect-workbuddy-usage-card.png" width="640" alt="dsh-connect-workbuddy 设置卡:模型目录与倍率、图片与可关闭思考开关、活动标签(本页不含任何账号信息)" />
3
3
  </p>
4
4
 
5
5
  <h1 align="center">dsh-connect-workbuddy</h1>
@@ -26,6 +26,11 @@
26
26
 
27
27
  一个独立的 [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) bundle 插件。它把本机已登录的 WorkBuddy 账号(**国内版与国际版 WorkBuddy AI 均支持**)接到 DSH 的模型选择器,同时提供账号池、可勾选的模型管理,以及一套围绕积分的只读能力:**每次刷新按上游目录自动读取每个模型的积分倍率**(`x0.79` 这种,倍率完全由上游给出,插件不写死也不猜)、逐模型开关图片输入、多账号切换与账号池自动换号、每日签到、以及卡片与输入框里胶囊式的只读积分读数。**国内版与国际版是两个并行的供应商(`workbuddy` / `workbuddy-global`),可同时使用**;插件设置页以 tab 区分两者,方便统一管理。只需本机 WorkBuddy 的登录态,**或在浏览器里登录一次**即可。
28
28
 
29
+ ### 图标样式
30
+
31
+ 在设置页的「能力」tab 最下方选择图标样式。默认是本插件自己的图标;另一个皮肤跟随主题的文字颜色。选择会立即应用到侧边栏、页头和面板,并保存在当前浏览器中;其他浏览器需要单独设置。
32
+
33
+
29
34
  ## 风险提示
30
35
 
31
36
  > **WorkBuddy 已开始限制非官方客户端请求。本项目不保证相关接口长期可用,上游一旦收紧限制,插件可能失效。请先阅读文末[「免责声明」](#免责声明),自行评估账号风险。使用官方 WorkBuddy 客户端始终是最安全的选择。**
@@ -60,7 +65,7 @@
60
65
  - **本机账号切换** —— 自动发现 WorkBuddy 桌面端留下的多个登录凭据,可按区域切换账号;Token 不写入 DSH 设置。
61
66
  - **对话输入框积分读数(国内版 / 国际版自动切换)** —— 对话输入框左侧工具栏常驻一行可点击的读数(如 `WB CN · 1,072`),**按本会话当前选中的模型自动切换区域**:选中 WB CN 的模型就显示国内版余额,选中 WB AI 的模型就显示国际版余额;用其它 provider 的模型时该读数完全不出现。每 5 分钟自动刷新,也可点开手动刷新。点击读数弹出面板:**按账号列出的余额表格**,点某一行即可切换到该账号(与卡片上的账号选择是同一个设置);**当前不能用的账号会在行内标出原因**(如「被限流」「积分耗尽」),标注口径与账号池表格一致。面板里的余额只在打开时才去查,因此不会让 5 分钟的后台刷新按账号数翻倍。要关掉某一边,就在卡片对应区域的 tab 下取消勾选「在输入框工具栏显示积分读数」;该区域的供应商被关闭时,读数不显示、开关也置灰。同一个开关下面还有「显示位置」这一行:默认在输入框工具栏(与模型选择同一行,位于模型选择器左侧、与权限切换器隔开),改成「输入框下方」后读数落到轮次/步数/token 统计那一行——装了别的插件把工具栏座位占掉时用得上。
62
67
 
63
- <img src="docs/assets/dsh-connect-workbuddy-composer-credits.png" width="360" alt="对话输入框积分面板:国内版账号余额表格、一键测试按钮与最近刷新时间(账号名已打码)" />
68
+ <img src="docs/assets/dsh-connect-workbuddy-composer-credits.png" width="360" alt="对话输入框积分面板:国内版账号余额表格、一键测试按钮与最近刷新时间(账号名已用实心块覆盖)" />
64
69
  - **账号池:多账号批量操作与自动换号** —— 把要用的账号勾进池子,即可**签到勾选的账号**、**测试勾选的账号 × 你指定的模型**(默认挑该区域倍率为 0 的免费模型);开启**启用账号池**即同时打开**自动换号**——某个请求在上游失败时,插件会依次用池内其他可用账号重试,直到有一个接手、或全部不可用为止,然后才把错误报给你。成员**默认一个都不含**、必须显式勾选(「本机有登录」不等于「要拿它去签到和花积分」);**开启后由池子的排序决定每一次请求用谁**(可用优先,其次快过期先花、积分高、凭据更新的);失败时依次用池内其他可用账号重试。排序**从不写回你保存的选择**——关掉开关,你选定的账号立刻完全生效。只有请求本身不合法(HTTP 400)不换号:同一个请求体换谁都是 400,重试只会白等。**这个开关只管「插件要不要自己决定」**:关掉它,插件不再替你选账号、也不再替你换号,但**签到与测试仍然可用**(它们是手动动作)。测试走的是与模型行同一套真实体积探测,因此**有真实成本**;**不提供自动签到**——签到会真实领取奖励,只在你点按钮时执行。详见[账号池](#账号池)。
65
70
  - **企业版 / 教育版账号:签到与「领取」不适用** —— 带 `enterpriseId` 的席位(企业版或教育版)在池子里**不显示签到列、不显示福利活动,也不会发出领取请求**(5.8.0,issue #129):上游对这类成员的个人权益**写**接口一律拒绝(实测 `10001`),而它的**读**接口照样把活动列出来、标着「未领」——所以「读到了」绝不能当成「可以领」。积分也在另一本账上(企业用量 = 上限 − 已用),个人积分表对这种账号返回空列表。这个判断贯穿池卡片、输入框胶囊与 Web 状态页,并且在账号进入池子的那一刻就带上标记,而不是等用户点了按钮才发现不支持。
66
71
  - **可选:让上游用量页把这笔记成官方客户端发的那笔(5.8.0,issue #132,默认关闭)** —— 开 `usageIdentity` 后 chat 请求带上 `X-IDE-Name: WorkBuddy`(连同 `X-IDE-Type: CLI` 与版本号;版本号取自现有的产品 UA,不留第二个硬编码数字),用量页的「使用端」由此不再空白;会话身份三件套同时改成官方客户端那种 **32 位十六进制 UUIDv7** 并补上 `X-Request-ID`——网关把这个 id 回显成 SSE 的 `id` 并写进用量页,此前带连字符的 v4 与官方记录摆在同一页上像两种客户端;**每请求现生成、互不相同**这条没有放松。**`User-Agent` 在两种取值下都一字未动**——账单与限流认的是 CLI 通道;生图路径也不跟着这个开关变,它保持自己 2026-10-21 实测过的形状。**默认关**的理由:形状本身不修任何东西(`11128` 的三道门读的是消息开头、会话 id 有没有、首条是不是 system,头改不动其中任何一条),而实测证据来自报告者的账号与旧版本、本插件未在真机复现——一次纯显示对齐不该让所有账号先承担风险。另有可选的 `keepPromptLast`(**默认关闭**):用量页的「请求」列取自 body 里**最后一条** `user` 消息,而宿主把时间采样、运行时上下文、`<system-reminder>` 追加在你真正输入的那句**之后**,那一列于是常年记的是注入块;开启后把这些注入块**搬到真实输入之前**(只变顺序;另外会剥掉**被记录那一条**真实输入前面的 `<acp …>mNNNNN</acp>` 标记,否则那一列仍然以标记开头而等于没修,更早的消息一律保留自己的标记,因为模型靠它们引用历史)。默认关的理由是它会改变上游会数到的消息顺序、并删掉真实输入的几个前导字符;搬移只匹配宿主自己的注入前缀,而普通对话在没有注入尾块时逐字节不变(连标记也不剥)——这两点各有专门测试钉住。
@@ -124,7 +129,7 @@ DSH PiAiAdapter(每个 provider 一套)
124
129
  ## 账号池
125
130
 
126
131
  <p align="center">
127
- <img src="docs/assets/dsh-connect-workbuddy-account-pool.png" width="900" alt="dsh-connect-workbuddy 账号池:签到勾选的账号、测试勾选的账号、成员排序与签到状态(账号名已打码)" />
132
+ <img src="docs/assets/dsh-connect-workbuddy-account-pool.png" width="900" alt="dsh-connect-workbuddy 账号池:签到勾选的账号、测试勾选的账号、成员排序与签到状态(账号名已用实心块覆盖)" />
128
133
  </p>
129
134
 
130
135
  一台机器上往往登录过多个 WorkBuddy 账号。**账号池**把这件事收成一次点击:把要用的账号勾进池子,然后「签到勾选的账号」或「测试勾选的账号」;再打开**启用账号池**,插件就会在请求失败时自动换号接着跑。
@@ -625,7 +630,7 @@ pnpm run check # typecheck + test + build
625
630
  本地开发用 `link:` 安装到 desktop profile(改码后重启 DSH Desktop 生效):
626
631
 
627
632
  ```sh
628
- dsh plugin --profile desktop add /Users/dmh2002/DshProject/dsh-connect-workbuddy
633
+ dsh plugin --profile desktop add /Users/<you>/DshProject/dsh-connect-workbuddy
629
634
  ```
630
635
 
631
636
  #### `link:` 安装必须先构建,否则 DSH 会拒绝加载
@@ -692,6 +697,24 @@ else { await envelope.response.text() /* 或者按 SSE 消费 */ }
692
697
 
693
698
  **插件卡上那句标题与简介不是本插件渲染的**——那是 DSH 插件管理器读的**包元数据**:它按 `locale/<lang>.json` 的 `meta.title` / `meta.description` 取词(`locale/en.json` 是锚点,缺了它 `zh.json` 永远不会被读;`exports` 里缺 `"./locale/*.json"` 通配则整个目录被**静默**跳过),英文回退到 `package.json` 的 `description`。因此同一句话在本仓库写在三处,并由 [`tests/locale-meta.spec.ts`](tests/locale-meta.spec.ts) 钉死:卡面字典(`locale/en.json` / `locale/zh.json`)、英文回退(`package.json.description`)、市场条目草稿(`awesome-dsh-plugin-submission/dingminhua__dsh-connect-workbuddy.yml` 的 `description.en` / `description.zh`)。**改一处就要同改三处。**
694
699
 
700
+ ## 隐私与脱敏
701
+
702
+ 本插件**没有遥测、没有统计上报,也不向本仓库作者或任何第三方服务器发送数据**。凭据只落在本机的 `$DSH_HOME/workbuddy-vault/`,token 只在进程内存里交给 loopback shim。**唯一离开这台机器的东西,就是发往 WorkBuddy 上游网关的请求本身**——那是插件的全部功能,发给你自己账号所属的 `copilot.tencent.com`(国内版)或 `www.workbuddy.ai` / `www.codebuddy.ai`(国际版);生图/视频工具还会去读取你**显式传给它的**图片 URL。除此之外没有别的出站连接。
703
+
704
+ **这一节说的是另一件事——仓库自己不许留下能反查到具体账号、机器或会话的痕迹**(截图里的账号名、文档里的手机号与 uin、日志里的本机路径)。
705
+
706
+ 这条规则并非可有可无的礼貌:**一张没打码的截图、一行粘进 CHANGELOG 的真机号码,一旦推上 GitHub 或被 `npm publish` 打包,就再也收不回来了**(npm 的旧 tarball 永久可下载,git 历史任何人都能 clone)。所以它被写成了流程,而不是习惯:
707
+
708
+ ```bash
709
+ node scripts/check-pii.mjs # 退出码非 0 就不许发布
710
+ ```
711
+
712
+ - 规则全文见 **[`docs/PRIVACY.md`](docs/PRIVACY.md)**(**随包发布**,因为它是对使用者的承诺)。它列了五类暴露面、截图必须用实心块覆盖而不能用马赛克/模糊、以及「被裁切不等于被脱敏」这条容易踩的坑。
713
+ - 该脚本已接进 `prepack` 与 `pnpm run check`,**npm 打包前会先跑一遍**,命中即中止发布。
714
+ - `tests/privacy-gate.spec.ts` 钉住这三处接线(`prepack` / `check` / `files` 白名单),`tests/check-pii-script.spec.ts` 则用反例证明扫描器**真的会报错**——只会输出「干净」的扫描器比没有扫描器更糟。
715
+
716
+ **自动扫描只认它认识的那些形状。** 第一次截图开发者工具、第一次贴真机日志时,规则是盖不住的——那种时候必须人工再看一遍,并把新规律补进规则表。
717
+
695
718
  ## 已知限制
696
719
 
697
720
  - 依赖 WorkBuddy 客户端接口(非官方开放 API),WorkBuddy 更新后插件可能需要随之调整。
@@ -0,0 +1,196 @@
1
+ # 隐私与脱敏(Privacy)
2
+
3
+ > 本文档是 `dsh-connect-workbuddy` 的**唯一权威隐私规则**。改截图、写文档、写 issue 回复、发布新版本前都读一遍。
4
+ >
5
+ > **不违反它比修一个新 bug 更重要**:代码缺陷可以打补丁再发一版;一张没打码的截图一旦推上 GitHub 或被 `npm publish` 打包,
6
+ > 就再也收不回来了(npm 的旧 tarball 永久可下载,git 历史可被任何人 clone)。
7
+ >
8
+ > 本文档**随包发布**(在 `package.json` 的 `files` 白名单内),因为它是给下游使用者的承诺,不只是维护者备忘。
9
+
10
+ ## 0. 一句话规则
11
+
12
+ **凡是「真实账号、真实机器、真实会话」留下的痕迹,都不许进仓库,也不许进发布包。**
13
+
14
+ 判据只有一条:**这段内容能不能被反向还原到一个具体的人、账号、设备或会话?** 能,就必须脱敏或删掉。
15
+
16
+ ## 1. 受管的内容面
17
+
18
+ 本项目的隐私暴露面分五类,**每一类都要单独检查**(只查其中一类是过去漏掉的直接原因):
19
+
20
+ | 类别 | 典型载体 | 是否进发布包 |
21
+ | --- | --- | --- |
22
+ | **截图** | `docs/assets/*.png`、`docs/pr188-mac-shots/*.png` | `docs/assets` 进;`pr188-mac-shots` 不进但仍在公网仓库 |
23
+ | **文档正文** | `README*.md`、`CHANGELOG.md`、`docs/**.md`、issue 回复草稿 | 部分进 |
24
+ | **设计稿 / 演示页** | `docs/*.html`、`docs/assets/*.html` | 不进发布包,但**在公网仓库里** |
25
+ | **测试固件** | `tests/*.spec.ts` 里的 `uin` / `nickname` / 邮箱 | 不进发布包,但在公网仓库 |
26
+ | **构建产物** | `lib/*.js`(打包会把源码字符串带进去) | **进** |
27
+
28
+ > ⚠️ **「不进发布包」不等于「不暴露」**。`docs/pool-header-redesign.html` 不在 `files` 白名单里,
29
+ > 但它躺在公开仓库的 `main` 分支上,任何人 `git clone` 就能读到。**判断标准是「公网可读」,
30
+ > 不是「在 npm 包里」。**
31
+
32
+ ## 2. 绝对禁止出现在仓库任何地方的内容
33
+
34
+ 下面每一条都是**无条件禁止**,没有「这次例外」:
35
+
36
+ - **完整手机号**。任何 11 位中国大陆手机号,无论是否加引号、是否在代码块里、是否在 `docs/`、`docs/audit/`、
37
+ 测试固件、HTML 演示页、CHANGELOG 引用里。**这是本项目历史上真实发生过的一类泄露。**
38
+ - **完整邮箱**。维护者本人的邮箱也不行——GitHub commit 的 `Author` 已经公开的是既成事实,
39
+ 但**正文、测试固件、注释里不许再出现任何完整邮箱**。需要举例时写成 `someone@example.com`。
40
+ - **真实 uin / uid / enterpriseId**。WorkBuddy 的 `uin` 是账号级持久标识符(一串 9–12 位数字)。
41
+ 写测试用 `1`、`100000000001` 这种显然的假值;**永远不要**把真机日志里的数字粘进来。
42
+ - **access token / refresh token / cookie / `X-Device-Token`**。哪怕是「已经过期」的、哪怕是「只截了一部分」的。
43
+ 需要举例时写 `at-fixture`、`token-alpha-old` 这类明显的假值。
44
+ - **本机绝对路径里的用户名**。macOS 的 `/Users/<用户名>/…`、Windows 的 `C:\Users\<用户名>\…` 都不行。
45
+ 写文档时一律用占位:`/Users/<you>/...`、`C:\Users\<you>\...`、`<repo>`。
46
+ - **会话 id / 设备 id / 指纹**。`session-<uuid>`、设备指纹产物。需要说明时用 `<session-id>` 占位。
47
+ - **真实昵称**。上游返回的账号显示名(中文昵称形如「老+姓」,英文形如 `Lao` 前缀的拼写,
48
+ 以及「用户 + 一长串数字」这种自动生成名)出现在截图或文档里,等于公开「哪个账号在给这个插件做测试」。
49
+ 版权行里的 `Copyright (c) 2026 LaoDing` 是**许可证主体**,不受此条约束(见 §5)。
50
+
51
+ ## 3. 截图规则(过去翻车最多的一类)
52
+
53
+ ### 3.1 打码必须「不可逆」
54
+
55
+ - ✅ **不透明纯色块覆盖**。最简单、最安全,也最容易被读者看出「这里被脱敏了」。
56
+ - ✅ **裁掉整个区域**。账号列、余额列可以整列裁掉,只要截图仍能说明问题。
57
+ - ❌ **马赛克 / 像素化**。小色块(≈4–10px)在马赛克边缘仍可能残留字形轮廓;而且本项目历史上用过
58
+ **半透明**的马赛克(最暗处 199/255,不是黑),意味着下方原始像素参与了混合——**理论上存在被复原的风险**。
59
+ 以后一律不再使用马赛克。
60
+ - ❌ **高斯模糊**。小半径模糊是可以被反卷积攻击的;而且看不清的字形仍可能泄露字符数、词长。
61
+ - ❌ **半透明遮罩**(`opacity < 1` 的方块、带 alpha 的 PNG 矩形)。
62
+
63
+ ### 3.2 打码之前先看画布边缘
64
+
65
+ **被裁切不等于被脱敏。** 常见的一种事故是:截图的**画板顶边**残留了一行账号号码——
66
+ 它被上边缘切掉了一半,但上半截字形完好可读,而图片的 `alt` 文案却写着「无账号信息」。
67
+
68
+ 规则:
69
+
70
+ - 截图前把**画板上边缘、下边缘、左右边缘各留 8px 空**,不要让任何内容贴在边上。
71
+ - 出图后**逐边检查**:把图放大到 400%,看四条边上有没有被切掉一半的文字。
72
+ - 一次截图里如果包含了账号表格,**默认整块不要**,而不是「先截下来再打码」——后者迟早漏一行。
73
+
74
+ ### 3.3 打码之后要复核
75
+
76
+ 改完图必须**重新读一遍成品**(不是看源文件、不是看命令行输出),确认:
77
+
78
+ - [ ] 所有真实账号名、手机号(含掩码形式 `1XX****XXXX`)、uin、昵称都不可读
79
+ - [ ] 没有残留的「半截字」贴在画布边缘
80
+ - [ ] 图片的 `alt` 文案与图里**实际**有没有账号信息**一致**(写着「无账号信息」就必须真的没有)
81
+ - [ ] 图片元数据干净(见 §4)
82
+
83
+ > ### ⚠️ 最容易漏的一处:整窗截图的**左下角**
84
+ >
85
+ > 最容易漏掉的就是这里:账号表格已经盖住了,但 DSH 侧栏**左下角那个头像 + 昵称**
86
+ > 原样留在画面上。**它不是账号表格的一部分,所以「我盖了账号列」的自查会直接跳过它。**
87
+ >
88
+ > 整窗截图(DSH 界面、任何 Electron 应用)必须先扫这四处再动手:
89
+ >
90
+ > | 位置 | 里面有什么 | 处理 |
91
+ > | --- | --- | --- |
92
+ > | **左下角** | 登录用户的头像与昵称 | **必须盖**——这是账号身份 |
93
+ > | **左栏工作区列表** | 你的项目目录名 | **必须盖**——除非截图本身就在说明「左侧有哪些行」 |
94
+ > | **左栏会话标题** | 你历史对话的标题(会暴露你在做什么) | **必须盖**——同上 |
95
+ > | **窗口标题栏 / 顶栏** | 有时带用户名或主机名 | 必须盖 |
96
+ >
97
+ > **`scripts/check-pii.mjs` 看不见这些**——它们是像素,不是文本。这一条只能靠人眼。
98
+ >
99
+ > **一处明知故留**:`docs/pr188-mac-shots/` 那五张截图保留了左栏的工作区名与会话标题。
100
+ > 它们是**那几张截图要说明的东西**(「侧边栏那一行有没有 WorkBuddy」只能靠对照左栏看出来),
101
+ > 盖掉之后截图就证明不了任何事。这是一次**显式的、被记录的取舍**,不是遗漏;
102
+ > 同类取舍必须写进 CHANGELOG,不能默默做过。
103
+
104
+ > **掩码形式要不要打?要。** `1XX****XXXX` 虽然只有 3+4 位可见,但它与 `tests/` 里的固件、
105
+ > CHANGELOG 里的引用一交叉就能定位到具体账号;而且截图里的掩码旁边往往还有余额、过期时间构成的指纹。
106
+ > **一律打成实心块。**
107
+
108
+ ## 4. 图片元数据
109
+
110
+ PNG 的 `tEXt` / `iTXt` / `zTXt`、JPEG 的 EXIF / XMP 都可能带上拍摄设备、用户名、绝对路径。
111
+ 本项目目前所有截图元数据是干净的(已逐张核对),但**每次新增图片都要查**:
112
+
113
+ ```bash
114
+ node scripts/check-pii.mjs # 会列出每张图的元数据块
115
+ ```
116
+
117
+ 含 `tEXt` / `EXIF` / `XMP` 的截图必须先用工具剥离元数据再入库。
118
+
119
+ ## 5. 允许存在的「本人信息」
120
+
121
+ 下面这些是**有意公开**的,不算泄露,不要「顺手清理」掉:
122
+
123
+ | 内容 | 出现位置 | 为什么允许 |
124
+ | --- | --- | --- |
125
+ | `Copyright (c) 2026 LaoDing` | `LICENSE`、README、`package.json` 的 `copyright` 字段 | MIT 许可证主体,是法律声明 |
126
+ | GitHub 账号 `dingminhua` | 仓库地址、徽章 URL、issue 链接 | 项目公开身份,本来就在 URL 里 |
127
+ | npm 包名 `@dmh2002/dsh-connect-qoder` 等**其他包**名 | CHANGELOG 引用 | 是包名不是账号凭据 |
128
+ | `someone@example.com`、`/Users/<you>` 等占位 | 文档示例 | 显然是占位 |
129
+
130
+ > 区别在于:**「签名 / 署名 / 包名」是有意公开的身份;「账号凭据、手机号、uin、会话 id」是意外泄露的痕迹。**
131
+
132
+ ## 5.1 三条需要拍板的边界(已定,写下来避免反复摇摆)
133
+
134
+ 规则没写清的地方,下一次加规则的人就会来回改。以下三条是**明确的决定**:
135
+
136
+ **① 维护者本人的昵称可以与余额同现。** `CHANGELOG` 里有 `老丁 1360.13` 这样的记录——
137
+ 昵称加金额,恰好是 §3.3 警告的指纹化形态。但它记的人是维护者自己,且那个名字本来就是
138
+ 许可证主体。**决定:允许,仅限维护者本人;任何其他账号的昵称都不许与金额同现。**
139
+
140
+ **② 反例固件不许写成可复制的真值。** 扫描器需要「能证明规则会响」的样本,而样本一旦
141
+ 写成真的账号号码,它本身就是泄露。**决定:测试里的反例一律在运行时拼接**
142
+ (`['138', '1234', '5678'].join('')`),`allow` 里只放行结构上不可能是真号的值。
143
+
144
+ **③ 扫描器自身的注释可以用假值举例。** 它必须能描述泄露长什么样。
145
+ **决定:可以,但用全零尾或单调数字这类明显假值,且不为它开任何文件级豁免。**
146
+
147
+ ## 6. 发布前的强制核对
148
+ **这一步是发布流程的一部分,写在 [`RELEASING.md`](../RELEASING.md) 第 2.7 步,不得跳过。**
149
+
150
+ ```bash
151
+ node scripts/check-pii.mjs
152
+ git log --format=%B origin/main..HEAD | node scripts/check-pii.mjs --stdin # 提交信息
153
+ ```
154
+
155
+ 脚本退出码非 0 就不许发布。它检查:
156
+
157
+ 1. 发布包内的每个文本文件(`files` 白名单)
158
+ 2. **仓库内全部文本文件,隐藏文件包含在内**(`.env`、`.npmrc`、`.vscode/` 正是手滑提交通道),
159
+ 按 BOM 自动解码 UTF-16
160
+ 3. **PNG 与 JPEG 的元数据块**(`tEXt`/`iTXt`/`zTXt`/`eXIf`、EXIF/XMP/COM)
161
+ 4. **每个文件的名字**——`1XX****XXXX-shot.png` 这种命名本身就是泄露
162
+ 5. `screenshots.json` 的登记
163
+
164
+ 匹配前会先做归一化(全角转半角、去零宽字符),所以带连字符的、带 `+86` 前缀的、
165
+ 全角数字的与裸写的一视同仁——**同一串号码换件衣服,不再等于换了一个号码。**
166
+
167
+ **它挡不住的东西,必须由人补上:**
168
+
169
+ - **像素**。截图里可读的号码,扫描器永远看不见——那是 §3.3 的人工复核。
170
+ - **新出现的形态**。规则是按已知事故写的,第一次遇到某类内容时它不会响。
171
+ - **超过一周的提交信息**。扫描器不回头读 `git log`,所以用上面第二条命令补,且只在
172
+ 推送前那一刻有效。
173
+
174
+ 命中时如果是**误报**,正确出路只有两条:把值换成明显假值,或在 `allow` 里精确放行
175
+ **并同时加一条反例测试**。直接把规则删掉或放宽,是这套东西失效的唯一方式。
176
+
177
+ ## 7. 漏了怎么办
178
+
179
+ 1. **立刻改正文件并提交**——公网仓库的 `main` 是最先要修的地方。
180
+ 2. **发一个新补丁版本**——npm 上旧的 tarball 永久可下载,只有新版本能覆盖「最新版」这个入口;
181
+ 要发新版本必须在 `CHANGELOG.md` 里**如实写明泄露了什么**(不要含糊成「若干文档修正」)。
182
+ 3. **不要试图悄悄抹掉**。历史提交(`git log -p`)仍然能查到;如果确实需要清理,
183
+ 用 `git filter-repo` 重写并强推,同时**在 CHANGELOG 与 Release 里说明这次重写**——
184
+ 否则下一个 clone 的人会以为仓库一直很干净,重复同样的错误。
185
+ 4. **不需要恐慌性轮换 token**:本插件**从不把 token 写进仓库**(`$DSH_HOME/workbuddy-vault/` 与
186
+ `~/.dsh/.workbuddy-auth.*.json` 都在 gitignore 之外的用户目录)。泄露的是**显示名与号码**,不是凭据。
187
+ 但如果确实有 token 进过仓库,那必须轮换,且优先级高于本文档所有其它条目。
188
+
189
+ ## 8. 写给 AI 助手
190
+
191
+ 用 AI 代跑发布或代写文档时,**它默认不会主动检查隐私**——它会把真机日志、真实截图路径、完整号码
192
+ 原样写进文档。所以:
193
+
194
+ - 让 AI 写任何含「真机」「实测」「截图」的内容时,**明确要求它只写占位符**。
195
+ - AI 生成的文档入库前,**自己跑一遍 `node scripts/check-pii.mjs`**,不要只信它的自我描述。
196
+ - AI 代跑发布时,[`RELEASING.md`](../RELEASING.md) 第 2.7 步**必须**由人确认结果,不能只看它的「已完成」。
package/lib/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { $ as DEFAULT_WIRE_PROFILE, $t as WORKBUDDY_DEVICE_TOKEN_FILE_ENV, F as WorkBuddyCredentialStore, J as workbuddyOwnAuthPath, N as WORKBUDDY_AUTH_FILE_ENV, P as WORKBUDDY_VAULT_DIRNAME, R as defaultDesktopAuthCandidates, Sn as resolveDshHome, T as FALLBACK_WORKBUDDY_MODELS_GLOBAL, W as legacyWorkbuddyOwnAuthPath, X as APP_VERSION, Y as workbuddyVaultDir, a as readHostHeartbeat, an as inspectCredentialDirectory, b as readDeviceSettings, c as WORKBUDDY_CONNECT_VERSION, d as rosterSeenPath, en as readDeviceTokenFile, f as WORKBUDDY_CN_BASE_ENV, g as createTuringSdk, m as piAiRuntimeInfo, nn as readDeviceSalt, nt as WorkBuddyUpstreamClient, o as workbuddyHostHeartbeatPath, on as protectCredentialDirectory, ot as describeRequestHeaderNames, p as resolveCnGateway, pn as findWorkbuddyAppExecutableWithSource, r as isHeartbeatProcessAlive, rn as deriveDeviceId, sn as WORKBUDDY_APP_EXECUTABLE_ENV, tn as ensureDeviceSalt, u as describeRosterSeenPayload, w as FALLBACK_WORKBUDDY_MODELS, xn as hostPeersInfo, z as defaultDesktopAuthDirs } from "./host-heartbeat-CQ3ot5-F.js";
2
+ import { $ as DEFAULT_WIRE_PROFILE, Cn as hostPeersInfo, F as WorkBuddyCredentialStore, J as workbuddyOwnAuthPath, N as WORKBUDDY_AUTH_FILE_ENV, P as WORKBUDDY_VAULT_DIRNAME, R as defaultDesktopAuthCandidates, T as FALLBACK_WORKBUDDY_MODELS_GLOBAL, W as legacyWorkbuddyOwnAuthPath, X as APP_VERSION, Y as workbuddyVaultDir, a as readHostHeartbeat, an as deriveDeviceId, b as readDeviceSettings, c as WORKBUDDY_CONNECT_VERSION, cn as protectCredentialDirectory, d as rosterSeenPath, f as WORKBUDDY_CN_BASE_ENV, g as createTuringSdk, hn as findWorkbuddyAppExecutableWithSource, in as readDeviceSalt, ln as WORKBUDDY_APP_EXECUTABLE_ENV, m as piAiRuntimeInfo, nn as readDeviceTokenFile, nt as WorkBuddyUpstreamClient, o as workbuddyHostHeartbeatPath, ot as describeRequestHeaderNames, p as resolveCnGateway, r as isHeartbeatProcessAlive, rn as ensureDeviceSalt, sn as inspectCredentialDirectory, tn as WORKBUDDY_DEVICE_TOKEN_FILE_ENV, u as describeRosterSeenPayload, w as FALLBACK_WORKBUDDY_MODELS, wn as resolveDshHome, z as defaultDesktopAuthDirs } from "./host-heartbeat-DekAOmo0.js";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { dirname, join } from "node:path";
5
5
  import { realpathSync } from "node:fs";