dsh-connect-workbuddy 5.23.0 → 5.24.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 CHANGED
@@ -1,5 +1,164 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.24.1 (2026-11-14)
4
+
5
+ > 版本号是 **patch**:修一处宿主状态回执的清理归属,不动配置键、路由语义与请求字节。
6
+ > 来自 PR #256(vb2250158 / 秋雨之忆)。
7
+
8
+ ### 修复:失败的启动、或已被替换的旧实例,会删掉当前宿主的心跳回执
9
+
10
+ `doctor` 判断「宿主在不在」靠的是 `$DSH_HOME/.workbuddy-host-heartbeat.json` 这份回执,
11
+ 而它的清理此前是**无条件删除**:
12
+
13
+ ```ts
14
+ export async function clearHostHeartbeat(): Promise<void> {
15
+ await rm(workbuddyHostHeartbeatPath(), { force: true })
16
+ }
17
+ ```
18
+
19
+ 三条路径因此都会误删**别人写的**回执:
20
+
21
+ - **注册抛错的启动**:这类启动根本没有写过自己的回执,却照样在 dispose 时执行清理——
22
+ 删掉的是另一个仍在运行的宿主的文件。用户看到的是「明明开着 DSH,`doctor` 却说宿主没运行」。
23
+ - **两个宿主先后写同一个文件**:后写的那个先退出时,旧实例一删,新宿主的回执就没了。
24
+ - **写入是异步的**:`void writeHostHeartbeat()` 之后的 dispose 可能跑在落盘**之前**,
25
+ 于是清理删了个空,过一会儿旧记录又冒出来,状态查询继续报陈旧信息。
26
+
27
+ 修法是**归属**:`writeHostHeartbeat()` 现在返回它这次写入的 `{ path, contents }`,
28
+ 清理只删仍然与它逐字节相同的那一份。
29
+
30
+ ```ts
31
+ const owner = await writeHostHeartbeat()
32
+ await clearHostHeartbeat(owner) // 文件已改、已消失、或 owner 为空 → 什么都不做
33
+ ```
34
+
35
+ 细节与理由:
36
+
37
+ - **路径在写入时捕获**,所以之后改 `DSH_HOME` 不会把清理重定向到别的目录;
38
+ - 读取失败里**只有 `ENOENT` 算正常**,别的错误照常抛给调用方(例如把回执路径做成目录,
39
+ 那种情况不该被当成「没有回执」轻轻放过);
40
+ - 每次写入带一个 `registrationId`(UUID),区分**同 PID、同一毫秒内**的两次注册。
41
+ 它是**只写不读**的字段:`readHostHeartbeat()` 的 v2 字段集合与版本判定都没有变,
42
+ 所以旧构建写下的回执仍读得回来;
43
+ - 真实 disposer 改为 `async`:先 `await` 尚未完成的写入再清理;写入失败只记一条 error 日志,
44
+ 实例随后**不带 owner** 退出,下次 dispose 不会误删。
45
+
46
+ **边界(这一版没做):跨进程原子互斥。** 「读 → 比对 → 删」之间仍有一个很窄的窗口,
47
+ 外部进程可以在这个窗口里替换文件。本次保证的是**实例归属**,不是互斥;要彻底关掉这个窗口
48
+ 需要另设计一套跨进程锁。写成这里而不是只写在 PR 描述里,是因为它决定了这个修复能承诺什么、
49
+ 不能承诺什么。
50
+
51
+ ### 测试:写侧此前没有任何一条用例,本轮补上
52
+
53
+ 这不是文案问题,是覆盖缺口:`tests/host-heartbeat.spec.ts` 里所有用例都是**手工构造**一个
54
+ heartbeat 对象喂给 `isHeartbeatProcessAlive`,也就是说——如果 `writeHostHeartbeat()` 写出
55
+ `readHostHeartbeat()` 拒收的文档,**整个套件依然全绿**,症状只会在真实 `doctor` 上报成
56
+ 「没有心跳」。合并时补了两条往返用例(写 → 读回 → 断言字段与存活判定;并钉住
57
+ `owner.contents` 与磁盘字节完全相同、`registrationId` 不出现在读取结果里)与一个独立夹具,
58
+ 后者用两个**真实子进程**覆盖跨进程互斥不到的那部分场景。
59
+
60
+ 变异验证(各自单独还原,最后 16 条心跳用例全绿):返回字节与磁盘分叉 → 红 2 条;
61
+ 把 `registrationId` 泄漏进读取结果 → 红 1 条;恢复无条件清理 → 红 3 条;
62
+ 去掉 UUID → 红 1 条;disposer 不 await 未完成写入 → 红 1 条。
63
+
64
+ ### 说明:5.24.0 没有发布到 npm
65
+
66
+ 5.24.0 是**开发依赖栈跟随到 `0.2.2-rc.3`** 的那一版(不改任何用户可见行为),有 CHANGELOG 记录、
67
+ 有 `package.json` 里的版本号,但**没有打 tag、也没有发到 npm**——registry 上 `5.23.1` 之后直接是
68
+ `5.24.1`。这与 5.21.5 的处置一致(那一版同样只有版本号与 CHANGELOG,没有 `v5.21.5` tag):
69
+ 中间态保留记录,以免读者从 registry 的版本序列反推出一段「不存在的空档」。
70
+
71
+ ## 5.24.0 (2026-11-14)
72
+
73
+ > 版本号是 **minor**:开发依赖栈跟随宿主换到 DSH `0.2.2-rc.3` 线,并按惯例留下一份复核档案。
74
+ > **不改任何用户可见行为** —— 本轮一行源码都没动。**这一版没有发布到 npm**,见 5.24.1 的最后一节。
75
+
76
+ ### 变更:依赖栈跟随到 0.2.2-rc.3
77
+
78
+ 桌面宿主已升到 `0.2.2-rc.3`。逐包比对(37 个包的 npm tarball 逐个文件 sha1)的结论是
79
+ **本插件不需要任何适配**:
80
+
81
+ - **31 个包的 `lib/` 与 rc.2 逐字节相同**,只有 `package.json` 的版本号不同 —— 其中包含本插件
82
+ import 的 13 个包里的 12 个,以及 `dsh-app-boot`(兼容闸门没动);
83
+ - 有代码变化的 6 个包中,**只有 1 个是本插件依赖的**:`dsh-client-ui-primitives` 新增了两个
84
+ `upload-outline` 图标导出,**纯加法**(本插件本来就刻意不依赖这个包);
85
+ - 另外 5 个是 `dsh-client-ui-sidebar`(新增 `hoc` 槽 `sidebar.session.action`)、
86
+ `dsh-client-ui-workspace`(新增 `workspace.picker` Factory)、`dsh-client-ui-plugin-manager`
87
+ (名单里加了一个实验包)、`dsh-client-modules`(只改了内嵌 commit 哈希)、`dsh-web-frontend`
88
+ (前端重建)。**本插件一个都不碰。**
89
+
90
+ 随包升级指南的最新一节仍是 `## v0.2.2-rc.1`,rc.3 没有自己的破坏性清单。闸门实算:
91
+ `0.2.2-rc.3` ADMITTED,`0.3.0-rc.1` 仍被 `<0.3.0-0` 挡住(10 条 `dsh-*` peer 全部不满足)。
92
+
93
+ `package.json` 的 devDeps 写的是范围而非精确版本,所以这一跳**只动 `pnpm-workspace.yaml`**
94
+ (overrides 整块换线),装完实测 `dsh-*` 全部 `0.2.2-rc.3`、`cordis` 4.1.0、`schemastery`
95
+ 3.19.0、`pi-ai` 1.3.0,lockfile 中 `0.2.2-rc.2` 残留为 0 条。
96
+
97
+ ### 修复:删掉一条锁着「从未发布版本」的死 override
98
+
99
+ 整块换线时顺带发现 `@deepseek-ai/dsh-invariants` 这条 override 有两个问题叠在一起:
100
+
101
+ 1. 上游已在 **0.2.1-rc.3 把这个包从捆绑集里删除**;
102
+ 2. 本仓库这条一直跟着整块换线走,被推到了 `0.2.2-rc.2` —— 而 **npm 上从来没有发布过那个版本**
103
+ (该包 0.2.x 线只有 `0.2.0-rc.2`,`rc.1`/`rc.2`/`rc.3` 全部 404)。
104
+
105
+ 它一年多没被发现,是因为**已经没有包再依赖它**,pnpm 根本不去解析:既不在 lockfile 里,也不在
106
+ `node_modules` 里。也就是说这条 override 一直在清单里**声称一份并不存在的依赖**。它与
107
+ `dsh-client-runtime` 那条同类,处置一致:删除。**不改变任何行为**(本来就没装)。
108
+
109
+ `RELEASING.md` §2.6 因此新增一条核对项:**overrides 每一条都要真的能解析**
110
+ (`pnpm why <pkg>` 无输出且 lockfile 里也没有它 = 死条目)。
111
+
112
+ ### 文档
113
+
114
+ - 新增 [`docs/DSH-0.2.2-RC3-FOLLOWUP.md`](docs/DSH-0.2.2-RC3-FOLLOWUP.md):rc.3 的逐面复核,
115
+ 含 37 包比对表、闸门实算、槽位账本、16 条路由探针,以及两个只有这一轮才看得见的结论
116
+ (`hoc` 槽种本插件刻意不识别;死 override 的识别方法)。配套新增一条 POLICY 守卫用例。
117
+ - 两条 README 的实测表把 `0.2.2-rc.3` 加进去(`rc.1` / `rc.2` / `rc.3`),并把「本仓库套件在
118
+ `0.2.2-rc.2` + pi-ai `1.3.0` 上全绿」更新为 rc.3。
119
+
120
+ ### 说明:一条既有的偶发失败,本轮未修
121
+
122
+ `tests/pool-e2e.spec.ts` 的「claims an account the status read reports as not checked in」在
123
+ **全量并行**时偶发超时(`waitFor` 的 10 秒预算),本轮 8 次全量运行里失败 2 次。**它不是本轮
124
+ 引入的**:其中一次发生在源码完全未改动时(只换了依赖)。单跑该文件连跑 5 次全过。
125
+ 本轮**没有**改它——没有稳定可复现的失败,改宽预算再跑绿什么都证明不了。已记进
126
+ [`docs/DSH-0.2.2-RC3-FOLLOWUP.md`](docs/DSH-0.2.2-RC3-FOLLOWUP.md) §5.1 留待下一轮处理。
127
+
128
+ ## 5.23.1 (2026-11-13)
129
+
130
+ > 版本号是 **patch**:修一个明确的 bug,无新增配置项、无接口变化。
131
+
132
+ ### 修复:Hy4 正式版选上后仍然无法识别图片(issue #255)
133
+
134
+ 用户报告选了 hy4 之后贴图无效。**不是模型不行,是能力表漏了一代模型。**
135
+
136
+ 插件有一张「模型原生多模态能力」表(`src/native-modality.ts`),按**精确 id** 记录每个模型能不能读图;
137
+ 刷新模型目录时,只有被标为 `multimodal` 的才会默认勾选图片框。而实时名册里 Hy4 正式版的 id 是
138
+ `hy4free`(免费档)和 `hy4std`(付费档),**两个都不在表里** —— 于是判为 `unknown`、不预勾选,
139
+ 宿主按「这个模型不支持图片」处理。
140
+
141
+ **实测**(CN 网关,本构建自己的凭据,2026-11-13):一张 512×512 纯红 PNG 问「主色是什么」,
142
+ 两个 id 都答 `Red`,且答案在 `content` 而不只是推理过程。上游目录也写着
143
+ `"Latest Flagship Model: Agentic and Multimodal Expertise"`。
144
+
145
+ **为什么不能靠族关系或沿用旧键**:表里原本有一条 `hy4-preview: 'text'`,那是**预览版**,模型卡写的是
146
+ `pipeline_tag: text-generation`,确实读不了图;正式版(2026-11-04 发布)才引入视觉理解。所以:
147
+
148
+ - 按前缀 / 族匹配会把预览版的 `text` 结论传给正式版,正好复现这个 bug;
149
+ - 保留 `hy4-preview` 那个键也不对 —— 它已不在实时名册里,留着等于继续断言「这个家族是纯文本」。
150
+
151
+ 该键已移除,由实测结论取代。两个正式版 id 都显式列出,因为匹配用的是精确 id:只勾一个档位会让另一个
152
+ 继续拒图,且用户看不出原因。
153
+
154
+ `docs/DESIGN.md` 的核验表同步更新(A 档由 5 条增至 7 条,CN 预勾选数 21 个里 7 → 9)。
155
+
156
+ ### 说明:这个坑藏得比较深
157
+
158
+ 第一轮排查时我拿 `hy4-preview` 测,看到上游回 `unsupported_image_format` 就下了「hy4 不支持图片」的
159
+ 结论 —— 那是错的,预览版和正式版是两代模型。把它写进 CHANGELOG 是因为同类误判还会再犯:
160
+ **模型 id 换代而显示名不变时,能力表里那一行会静默过期**,而症状是「用户以为是自己没设置对」。
161
+
3
162
  ## 5.23.0 (2026-11-13)
4
163
 
5
164
  > 版本号是 **minor**:开发依赖栈整体换代到 DSH `0.2.2-rc.2` 线,结清上一轮复核留下的
package/README.en.md CHANGED
@@ -226,9 +226,9 @@ DSH's shipped gate (`evaluatePluginCompatibility` in `packages/boot/app-boot/src
226
226
  | `0.3.0-0` and above | ❌ explicitly refused (that line is unverified) |
227
227
  | `0.1.6` and earlier | ❌ explicitly refused (0.1.5 users should stay on v2.0.15) |
228
228
 
229
- > **`0.2.2-rc.1` / `0.2.2-rc.2` are verified working** (5.23.0): both hosts' shipped gates evaluate the declared range as
230
- > ADMITTED, the plugin loads completely on a running host (16 routes, 6 of 8 slots, all client modules registered), and this
231
- > repository's suite is green on the real `0.2.2-rc.2` + pi-ai `1.3.0` combination. The "⚠️ outside the declared range" row
229
+ > **`0.2.2-rc.1` / `0.2.2-rc.2` / `0.2.2-rc.3` are verified working** (5.24.0): all three hosts' shipped gates evaluate the declared
230
+ > range as ADMITTED, the plugin loads completely on a running host (16 routes, 6 of 8 slots, all client modules registered), and this
231
+ > repository's suite is green on the real `0.2.2-rc.3` + pi-ai `1.3.0` combination. The "⚠️ outside the declared range" row
232
232
  > above still describes **bare semver** evaluation, which is a different question from "does it run" — see the next note.
233
233
 
234
234
  > **On `0.2.x` prereleases (corrected in v4.7.0)**: this table previously listed `0.2.0-rc.1` as "✅ supported". That was **wrong**.
@@ -580,6 +580,32 @@ node scripts/verify-entry-artifacts.mjs <installed dir> # a specific installe
580
580
  > Installing from npm (`dsh plugin add dsh-connect-workbuddy`) needs none of this: the published
581
581
  > tarball already contains `lib/`, and `prepack` only regenerates it.
582
582
 
583
+ ### Host heartbeat: cleanup belongs to the instance that **wrote** it
584
+
585
+ `writeHostHeartbeat()` writes a Host receipt to `$DSH_HOME/.workbuddy-host-heartbeat.json`, and `doctor` reads it to decide whether a Host is alive. Disposal no longer deletes that file unconditionally — it removes only the exact write it made.
586
+
587
+ Three real failures all came from "anyone may delete it":
588
+
589
+ - **A failed startup still cleaned up.** Registration threw, so there was no receipt of its own to remove — what it deleted belonged to **another Host still running**.
590
+ - **Two Hosts write the same file.** The newer one exits first; the older instance's cleanup removed its receipt and `doctor` then reported "host not running".
591
+ - **The write is asynchronous.** A disposal that finished before the write landed deleted nothing, and the stale record reappeared a moment later.
592
+
593
+ So:
594
+
595
+ ```ts
596
+ const owner = await writeHostHeartbeat() // returns { path, contents }
597
+ // …while the plugin is alive…
598
+ await clearHostHeartbeat(owner) // removes only this one; no-op if absent, replaced, or undefined
599
+ ```
600
+
601
+ - The path is captured **at write time**, so a later `DSH_HOME` change cannot redirect cleanup into another directory.
602
+ - If the bytes no longer match (another instance overwrote the file), the **current file is kept** — that is the whole of "a new Host is not deleted by an old instance".
603
+ - Of the read failures only `ENOENT` is treated as normal; everything else rejects to the caller.
604
+ - Each write carries a `registrationId` (a UUID) that distinguishes two registrations landing in the same millisecond under the same PID. It is **write-only**: `readHostHeartbeat()`'s v2 fields and its version rule are unchanged.
605
+ - The real disposer awaits a pending write before cleaning up; a failed write is logged once as an error and the instance then exits owning nothing.
606
+
607
+ **Known limit: cross-process atomic exclusion is not implemented.** A narrow window remains between read, compare and unlink, in which an external process could replace the file. What this change guarantees is **instance ownership**, not mutual exclusion; closing that window needs a separate cross-process lock design and is out of scope here.
608
+
583
609
  ### Calling `chatStream()` from a script: it returns an **envelope**, not a stream
584
610
 
585
611
  ```ts
package/README.md CHANGED
@@ -243,10 +243,10 @@ DSH 的随包门禁(`packages/boot/app-boot/src/plugin-compatibility.ts` 的 `
243
243
  | `0.3.0-0` 及以上 | ❌ 明确拒绝(该线尚未验证) |
244
244
  | `0.1.6` 及更早 | ❌ 明确拒绝(0.1.5 线请停留在 v2.0.15) |
245
245
 
246
- > **`0.2.2-rc.1` / `0.2.2-rc.2` 已实测可用**(5.23.0):两版的随包门禁都把现声明判为 ADMITTED,插件在
247
- > 运行中的宿主上完整加载(16 条路由、8 个槽位里的 6 处、客户端模块全部注册),本仓库套件也在
248
- > `0.2.2-rc.2` + pi-ai `1.3.0` 的真实组合上全绿。上表那行「⚠️ 不落在声明范围内」描述的仍是**裸 semver**
249
- > 的判定,与「能不能跑」是两件事,原因见下条。
246
+ > **`0.2.2-rc.1` / `0.2.2-rc.2` / `0.2.2-rc.3` 已实测可用**(5.24.0):三版的随包门禁都把现声明判为
247
+ > ADMITTED,插件在运行中的宿主上完整加载(16 条路由、8 个槽位里的 6 处、客户端模块全部注册),
248
+ > 本仓库套件也在 `0.2.2-rc.3` + pi-ai `1.3.0` 的真实组合上全绿。上表那行「⚠️ 不落在声明范围内」
249
+ > 描述的仍是**裸 semver** 的判定,与「能不能跑」是两件事,原因见下条。
250
250
 
251
251
  > **关于 `0.2.x` 预发布(v4.7.0 更正)**:此前本表把 `0.2.0-rc.1` 写作「✅ 支持」,那是**错的**。
252
252
  > npm semver 规定:预发布版本只有当一个比较器**在同一条 `major.minor.patch` 元组上**带预发布标签时才被放行。
@@ -670,6 +670,32 @@ node scripts/verify-entry-artifacts.mjs <已安装的目录> # 具体某个
670
670
  > 从 npm 安装(`dsh plugin add dsh-connect-workbuddy`)不需要这一步:发布包里 `lib/` 已经在,
671
671
  > `prepack` 也只负责把它重新生成一遍。
672
672
 
673
+ ### 宿主心跳:清理由**写入它的那个实例**负责
674
+
675
+ `writeHostHeartbeat()` 在 `$DSH_HOME/.workbuddy-host-heartbeat.json` 写一份宿主回执,`doctor` 据此判断宿主是否活着。它的 `dispose` **不再无条件删除这个文件**,而是只删自己那次成功写入的那一份。
676
+
677
+ 原因是三类真实故障都出自「谁都能删」:
678
+
679
+ - **启动失败也要清理**:注册抛错时没有回执可清,删掉的是**另一个仍在运行的宿主**写的文件;
680
+ - **两个宿主先后写同一文件**:后写的那个先退出,旧实例一删,新宿主的回执就没了,`doctor` 报「宿主未运行」;
681
+ - **写入是异步的**:`dispose` 在写入落盘之前就完成时,清理反而删不到东西,过一会儿旧记录又出现。
682
+
683
+ 所以:
684
+
685
+ ```ts
686
+ const owner = await writeHostHeartbeat() // 返回 { path, contents }
687
+ // …插件存活期间…
688
+ await clearHostHeartbeat(owner) // 只删这份;文件已变、已消失或 owner 为空时什么都不做
689
+ ```
690
+
691
+ - 文件路径在**写入时**捕获,所以之后改 `DSH_HOME` 不会把清理重定向到别的目录;
692
+ - 字节比对不通过(别的实例已覆盖)就**保留当前文件**,这就是「新宿主不会被旧实例删掉」的全部实现;
693
+ - 读取失败里只有 `ENOENT` 被视为正常,其他错误照常抛给调用方;
694
+ - 每次写入带一个 `registrationId`(UUID),用来区分同 PID、同一毫秒内的两次注册。它是**只写不读**的字段:`readHostHeartbeat()` 的 v2 字段与版本判定都没变;
695
+ - 真实 disposer 会先 `await` 未完成的写入再清理,写入失败只记一条 error 日志,实例随后不带 owner 退出。
696
+
697
+ **已知边界:跨进程原子互斥没有做。** 「读 → 比对 → 删」之间仍有一个很窄的窗口,外部进程可以在这个窗口里替换文件。本改动保证的是**实例归属**,不是互斥;要彻底消除这个窗口得另设计一套跨进程锁,不在这一版的范围里。
698
+
673
699
  ### 写脚本调用 `chatStream()` 时注意:它返回的是**信封**,不是可迭代流
674
700
 
675
701
  ```ts
package/lib/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { $ as DEFAULT_WIRE_PROFILE, Dn as hostPeersInfo, F as WorkBuddyCredentialStore, J as workbuddyOwnAuthPath, N as WORKBUDDY_AUTH_FILE_ENV, On as resolveDshHome, 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 WORKBUDDY_DEVICE_TOKEN_FILE_ENV, b as readDeviceSettings, c as WORKBUDDY_CONNECT_VERSION, cn as readDeviceSalt, d as rosterSeenPath, dn as inspectCredentialDirectory, f as WORKBUDDY_CN_BASE_ENV, fn as protectCredentialDirectory, g as createTuringSdk, ln as deriveDeviceId, m as piAiRuntimeInfo, nt as WorkBuddyUpstreamClient, o as workbuddyHostHeartbeatPath, on as readDeviceTokenFile, ot as describeRequestHeaderNames, p as resolveCnGateway, pn as WORKBUDDY_APP_EXECUTABLE_ENV, r as isHeartbeatProcessAlive, sn as ensureDeviceSalt, u as describeRosterSeenPayload, w as FALLBACK_WORKBUDDY_MODELS, yn as findWorkbuddyAppExecutableWithSource, z as defaultDesktopAuthDirs } from "./host-heartbeat-CRS-1LBA.js";
2
+ import { $ as DEFAULT_WIRE_PROFILE, Dn as hostPeersInfo, F as WorkBuddyCredentialStore, J as workbuddyOwnAuthPath, N as WORKBUDDY_AUTH_FILE_ENV, On as resolveDshHome, 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 WORKBUDDY_DEVICE_TOKEN_FILE_ENV, b as readDeviceSettings, c as WORKBUDDY_CONNECT_VERSION, cn as readDeviceSalt, d as rosterSeenPath, dn as inspectCredentialDirectory, f as WORKBUDDY_CN_BASE_ENV, fn as protectCredentialDirectory, g as createTuringSdk, ln as deriveDeviceId, m as piAiRuntimeInfo, nt as WorkBuddyUpstreamClient, o as workbuddyHostHeartbeatPath, on as readDeviceTokenFile, ot as describeRequestHeaderNames, p as resolveCnGateway, pn as WORKBUDDY_APP_EXECUTABLE_ENV, r as isHeartbeatProcessAlive, sn as ensureDeviceSalt, u as describeRosterSeenPayload, w as FALLBACK_WORKBUDDY_MODELS, yn as findWorkbuddyAppExecutableWithSource, z as defaultDesktopAuthDirs } from "./host-heartbeat-DeelaI9b.js";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { dirname, join } from "node:path";
5
5
  import { realpathSync } from "node:fs";
package/lib/client.js CHANGED
@@ -3023,7 +3023,6 @@ window.__ModuleLoader__.load({
3023
3023
  "glm-5.2": "text",
3024
3024
  "glm-5.3": "text",
3025
3025
  "hy3": "text",
3026
- "hy4-preview": "text",
3027
3026
  "deepseek-v4.1-flash": "multimodal",
3028
3027
  "glm-5.3-flash": "multimodal",
3029
3028
  "glm-5v-turbo": "multimodal",
@@ -3031,6 +3030,8 @@ window.__ModuleLoader__.load({
3031
3030
  "kimi-k2.7": "multimodal",
3032
3031
  "kimi-k3-1": "multimodal",
3033
3032
  "minimax-m3": "multimodal",
3033
+ "hy4free": "multimodal",
3034
+ "hy4std": "multimodal",
3034
3035
  "minimax-m3.1-flash": "multimodal",
3035
3036
  "space-bunny": "multimodal"
3036
3037
  };
@@ -1744,7 +1744,6 @@ const NATIVE_MODALITY_BY_MODEL_ID = {
1744
1744
  "glm-5.2": "text",
1745
1745
  "glm-5.3": "text",
1746
1746
  "hy3": "text",
1747
- "hy4-preview": "text",
1748
1747
  "deepseek-v4.1-flash": "multimodal",
1749
1748
  "glm-5.3-flash": "multimodal",
1750
1749
  "glm-5v-turbo": "multimodal",
@@ -1752,6 +1751,8 @@ const NATIVE_MODALITY_BY_MODEL_ID = {
1752
1751
  "kimi-k2.7": "multimodal",
1753
1752
  "kimi-k3-1": "multimodal",
1754
1753
  "minimax-m3": "multimodal",
1754
+ "hy4free": "multimodal",
1755
+ "hy4std": "multimodal",
1755
1756
  "minimax-m3.1-flash": "multimodal",
1756
1757
  "space-bunny": "multimodal"
1757
1758
  };
@@ -10601,7 +10602,7 @@ function describeRosterSeenPayload(raw) {
10601
10602
  //#endregion
10602
10603
  //#region src/version.ts
10603
10604
  /** The npm package version this build was produced from. */
10604
- const WORKBUDDY_CONNECT_VERSION = "5.23.0";
10605
+ const WORKBUDDY_CONNECT_VERSION = "5.24.1";
10605
10606
  //#endregion
10606
10607
  //#region src/host-heartbeat.ts
10607
10608
  /**
@@ -10613,7 +10614,7 @@ const WORKBUDDY_CONNECT_VERSION = "5.23.0";
10613
10614
  * — 该机制由其设计:浏览器端无法写文件,其健康只能靠 console.error 上报,
10614
10615
  * 因此由宿主写心跳文件,缺失即代表宿主从未启动;崩溃后的陈旧心跳
10615
10616
  * 通过 PID 存活检查识别。
10616
- * 改动:无。机制本身已完备,原样沿用。
10617
+ * 改动:清理由成功写入该记录的插件实例负责,避免失败启动删除另一宿主的回执。
10617
10618
  *
10618
10619
  * @module dsh-connect-workbuddy/host-heartbeat
10619
10620
  */
@@ -10796,6 +10797,7 @@ async function readHostHeartbeat() {
10796
10797
  * moment this function is exercised from a child process.
10797
10798
  */
10798
10799
  async function writeHostHeartbeat() {
10800
+ const path = workbuddyHostHeartbeatPath();
10799
10801
  const hostStartedAt = processStartTimeMs(process.pid);
10800
10802
  const heartbeat = {
10801
10803
  version: HEARTBEAT_FORMAT_VERSION,
@@ -10805,11 +10807,33 @@ async function writeHostHeartbeat() {
10805
10807
  pid: process.pid,
10806
10808
  ...hostStartedAt === void 0 ? {} : { hostStartedAt }
10807
10809
  };
10808
- await writeFile(workbuddyHostHeartbeatPath(), `${JSON.stringify(heartbeat, null, 2)}\n`, { mode: 384 });
10810
+ const contents = `${JSON.stringify({
10811
+ ...heartbeat,
10812
+ registrationId: randomUUID()
10813
+ }, null, 2)}\n`;
10814
+ await writeFile(path, contents, { mode: 384 });
10815
+ return {
10816
+ path,
10817
+ contents
10818
+ };
10809
10819
  }
10810
- /** Remove the heartbeat; called when the plugin is disposed. */
10811
- async function clearHostHeartbeat() {
10812
- await rm(workbuddyHostHeartbeatPath(), { force: true });
10820
+ /**
10821
+ * Remove only this instance's successful write, if it is still current.
10822
+ *
10823
+ * A failed startup has no owner. The captured path also keeps a later DSH_HOME
10824
+ * change from redirecting cleanup. Missing/replaced records are left alone;
10825
+ * unexpected read/removal errors reject so the disposer can report them.
10826
+ */
10827
+ async function clearHostHeartbeat(owner) {
10828
+ if (owner === void 0) return;
10829
+ let current;
10830
+ try {
10831
+ current = await readFile(owner.path, "utf8");
10832
+ } catch (error) {
10833
+ if (error.code === "ENOENT") return;
10834
+ throw error;
10835
+ }
10836
+ if (current === owner.contents) await rm(owner.path, { force: true });
10813
10837
  }
10814
10838
  //#endregion
10815
10839
  export { DEFAULT_WIRE_PROFILE as $, parseQueueAnswer as $t, withoutRouters as A, writeFileAtomic as An, offRefused as At, defaultDesktopAuthPath as B, IMAGE_TAG_IMAGE_TO_IMAGE as Bt, setDeviceMode as C, macosNestedAppBundles as Cn, attachBusyLevels as Ct, applyContextBudgets as D, hostPeersInfo as Dn, defaultOffModelIds as Dt, WorkBuddyCatalog as E, workbuddyAppExecutableCandidates as En, REFUSES_OFF_MODEL_IDS as Et, WorkBuddyCredentialStore as F, WorkBuddyVideoError as Ft, parseWorkBuddyAuth as G, imageMimeForPath as Gt, isEncryptedCredentialError as H, MAX_INPUT_IMAGE_BYTES as Ht, WorkBuddyEncryptedCredentialError as I, parseSupportedSecondsRange as It, workbuddyOwnAuthPath as J, isBareBase64Image as Jt, preferredAccountName as K, imageModelChoices as Kt, authFileName as L, pickVideoModel as Lt, WORKBUDDY_AUTH_FILENAME as M, withEffectiveOff as Mt, WORKBUDDY_AUTH_FILE_ENV as N, VIDEO_TAG_IMAGE_TO_VIDEO as Nt, deriveCatalog as O, resolveDshHome as On, lastRefusalFor as Ot, WORKBUDDY_VAULT_DIRNAME as P, VIDEO_TAG_TEXT_TO_VIDEO as Pt, CREDENTIAL_REJECTED_CODE as Q, sniffImageMime as Qt, defaultDesktopAuthCandidates as R, resolveVideoParams as Rt, saveDeviceSdkSettings as S, macosBundleExecutable as Sn, rewriteSessionTitleModel as St, FALLBACK_WORKBUDDY_MODELS_GLOBAL as T, readAtRestKey as Tn, selectPromoBadge as Tt, isVaultAccountId as U, WorkBuddyImageError as Ut, hasEncryptedCredentialFields as V, IMAGE_TAG_TEXT_TO_IMAGE as Vt, legacyWorkbuddyOwnAuthPath as W, imageDataUrl as Wt, APP_VERSION as X, parseImageDataUrl as Xt, workbuddyVaultDir as Y, isWatermarkFreeImageModel as Yt, CONTEXT_OVERFLOW_MARKER as Z, pickMediaModel as Zt, createDeviceProfileLookup as _, fetchAtRestKeyPayload as _n, parseUpstreamModel as _t, readHostHeartbeat as a, WORKBUDDY_DEVICE_TOKEN_FILE_ENV as an, declaredTools as at, readDeviceSettings as b, isEncryptedFieldWrapper as bn, regionOf as bt, WORKBUDDY_CONNECT_VERSION as c, readDeviceSalt as cn, isContextTooLongBody as ct, rosterSeenPath as d, inspectCredentialDirectory as dn, isFirstMessageGateBody as dt, queueNoticeText as en, WORKBUDDY_FALLBACK_SYSTEM_PROMPT as et, WORKBUDDY_CN_BASE_ENV as f, protectCredentialDirectory as fn, knownRegionOf as ft, createTuringSdk as g, deriveAtRestKeyId as gn, parseReasoning as gt, createDeviceSdkPort as h, deriveAtRestKey as hn, parseCreditMultiplier as ht, processStartTimeMs as i, nativeModalityOf as in, classifyUpstreamError as it, ENCRYPTED_CREDENTIAL_CODE as j, recordRefusal as jt, fallbackModelsFor as k, withFileLock as kn, offDefaultFor as kt, createFileRosterSeenStore as l, deriveDeviceId as ln, isConversationIdGateBody as lt, piAiRuntimeInfo as m, clearAtRestKeyCache as mn, openingEvidenceOfBody as mt, clearHostHeartbeat as n, NATIVE_MODALITY_BY_MODEL_ID as nn, WorkBuddyUpstreamClient as nt, workbuddyHostHeartbeatPath as o, readDeviceTokenFile as on, describeRequestHeaderNames as ot, resolveCnGateway as p, WORKBUDDY_APP_EXECUTABLE_ENV as pn, modelIdOfBody as pt, workbuddyAccountId as q, imageSizeLimitsOf as qt, isHeartbeatProcessAlive as r, imageDefaultFor as rn, channelGateMemberOf as rt, writeHostHeartbeat as s, ensureDeviceSalt as sn, forceNeutralHead as st, WORKBUDDY_HOST_HEARTBEAT_FILENAME as t, pruneTempDir as tn, WorkBuddyCredentialRejectedError as tt, describeRosterSeenPayload as u, isDeviceId as un, isCredentialRejectedError as ut, describeDerivedDevices as v, findWorkbuddyAppExecutable as vn, perturbChannelFingerprints as vt, FALLBACK_WORKBUDDY_MODELS as w, openEncryptedField as wn, promoBadgeTone as wt, saveDeviceProfile as x, isWorkbuddyBundle as xn, requestEvidenceOf as xt, isDeviceMode as y, findWorkbuddyAppExecutableWithSource as yn, prepareChatBody as yt, defaultDesktopAuthDirs as z, IMAGE_SIZE_LIMITS_WIDE as zt };
package/lib/index.d.ts CHANGED
@@ -3200,7 +3200,7 @@ declare function resolveCredentialRecovery(options: {
3200
3200
  * — 该机制由其设计:浏览器端无法写文件,其健康只能靠 console.error 上报,
3201
3201
  * 因此由宿主写心跳文件,缺失即代表宿主从未启动;崩溃后的陈旧心跳
3202
3202
  * 通过 PID 存活检查识别。
3203
- * 改动:无。机制本身已完备,原样沿用。
3203
+ * 改动:清理由成功写入该记录的插件实例负责,避免失败启动删除另一宿主的回执。
3204
3204
  *
3205
3205
  * @module dsh-connect-workbuddy/host-heartbeat
3206
3206
  */
@@ -3232,6 +3232,11 @@ interface WorkBuddyHostHeartbeat {
3232
3232
  */
3233
3233
  hostStartedAt?: number;
3234
3234
  }
3235
+ /** A successful write's exact location and bytes, retained by its plugin instance. */
3236
+ interface WorkBuddyHostHeartbeatOwner {
3237
+ readonly path: string;
3238
+ readonly contents: string;
3239
+ }
3235
3240
  /** Absolute path of the host heartbeat file. */
3236
3241
  declare function workbuddyHostHeartbeatPath(): string;
3237
3242
  /**
@@ -3271,9 +3276,15 @@ declare function readHostHeartbeat(): Promise<WorkBuddyHostHeartbeat | undefined
3271
3276
  * than cached: the value is cheap, and a module-level cache would be wrong the
3272
3277
  * moment this function is exercised from a child process.
3273
3278
  */
3274
- declare function writeHostHeartbeat(): Promise<void>;
3275
- /** Remove the heartbeat; called when the plugin is disposed. */
3276
- declare function clearHostHeartbeat(): Promise<void>;
3279
+ declare function writeHostHeartbeat(): Promise<WorkBuddyHostHeartbeatOwner>;
3280
+ /**
3281
+ * Remove only this instance's successful write, if it is still current.
3282
+ *
3283
+ * A failed startup has no owner. The captured path also keeps a later DSH_HOME
3284
+ * change from redirecting cleanup. Missing/replaced records are left alone;
3285
+ * unexpected read/removal errors reject so the disposer can report them.
3286
+ */
3287
+ declare function clearHostHeartbeat(owner?: WorkBuddyHostHeartbeatOwner): Promise<void>;
3277
3288
  //#endregion
3278
3289
  //#region src/version.d.ts
3279
3290
  /**
@@ -6315,4 +6326,4 @@ declare function legacyAttributionRegion(value: Config, accountsFor: (region: Wo
6315
6326
  */
6316
6327
  declare function apply(ctx: Context, config: Config): void;
6317
6328
  //#endregion
6318
- export { CREDENTIAL_REJECTED_CODE, Config, DEFAULT_PROBE_INPUT_TOKENS, ENCRYPTED_CREDENTIAL_CODE, FALLBACK_WORKBUDDY_MODELS, FALLBACK_WORKBUDDY_MODELS_GLOBAL, NATIVE_MODALITY_BY_MODEL_ID, PROBE_INPUT_TOKEN_CHOICES, PROBE_MAX_TOKENS, PROBE_SYSTEM_PROMPT, REFUSES_OFF_MODEL_IDS, type UpstreamErrorKind, WORKBUDDY_ACCOUNTS_REFRESH_PATH, WORKBUDDY_APP_EXECUTABLE_ENV, WORKBUDDY_AUTH_FILENAME, WORKBUDDY_AUTH_FILE_ENV, WORKBUDDY_CHECKIN_PATH, WORKBUDDY_CONNECT_VERSION, WORKBUDDY_GLOBAL_PROVIDER, WORKBUDDY_HOST_HEARTBEAT_FILENAME, WORKBUDDY_MODELS_REFRESH_PATH, WORKBUDDY_PROBE_PATH, WORKBUDDY_PROVIDER, WORKBUDDY_PROVIDERS, WORKBUDDY_PROVIDER_DISPLAY_NAMES, WORKBUDDY_REGIONS, WORKBUDDY_REGION_PARAM, WORKBUDDY_SETTINGS_NS, WORKBUDDY_STREAM_IDLE_TIMEOUT_MS, WORKBUDDY_TPS_PATH, WORKBUDDY_USAGE_PATH, type WorkBuddyAccountChoice, type WorkBuddyAdapter, type WorkBuddyAuthStatus, type WorkBuddyCandidateFailure, WorkBuddyCatalog, type WorkBuddyChatResult, type WorkBuddyCredential, type WorkBuddyCredentialRecovery, WorkBuddyCredentialRejectedError, WorkBuddyCredentialStore, type WorkBuddyCreditPackage, type WorkBuddyCredits, WorkBuddyEncryptedCredentialError, type WorkBuddyEncryptedField, type WorkBuddyHostHeartbeat, type WorkBuddyModelInfo, type WorkBuddyNativeModality, WorkBuddyPoolPreferences, type WorkBuddyProbeClient, type WorkBuddyProbeOutcome, type WorkBuddyProbeResult, type WorkBuddyProbeStore, type WorkBuddyReasoning, type WorkBuddyRecoveryCandidate, type WorkBuddyRefreshOutcome, WorkBuddyRegionState, type WorkBuddyShim, type WorkBuddyStatusRouteOptions, type WorkBuddyStoreOptions, WorkBuddyUpstreamClient, type WorkBuddyUpstreamModel, type WorkBuddyUsabilityProbeOptions, apply, asVolatile, authFileName, classifyUpstreamError, clearAtRestKeyCache, clearHostHeartbeat, cooldownOf, createAccountUsabilityProbe, createWorkBuddyAdapter, createWorkBuddyShim, creditOfStream, defaultDesktopAuthCandidates, defaultDesktopAuthDirs, defaultDesktopAuthPath, defaultOffModelIds, deriveAtRestKey, deriveAtRestKeyId, deriveCatalog, fallbackModelsFor, fetchAtRestKeyPayload, findWorkbuddyAppExecutable, hasEncryptedCredentialFields, imageDefaultFor, imageToolRegionOf, inject, isCredentialRejectedError, isEncryptedCredentialError, isEncryptedFieldWrapper, isHeartbeatProcessAlive, isWorkbuddyBundle, knownRegionOf, legacyAttributionRegion, legacyWorkbuddyOwnAuthPath, macosBundleExecutable, macosNestedAppBundles, modelIdOfBody, name, nativeModalityOf, nextRegionEnabled, nextRegionSlots, offDefaultFor, openEncryptedField, outcomeOfFailure, parseCreditMultiplier, parseReasoning, parseRetryAfter, parseUpstreamModel, parseWorkBuddyAuth, prepareChatBody, probeModel, probeRequestBody, probeSucceeded, processStartTimeMs, readAtRestKey, readHostHeartbeat, realTierAvailabilityFor, regionCleared, regionEnabled, regionEnabledOf, regionOf, regionOfProvider, regionOfStatusUrl, regionStateOf, regionsFieldIsCorrupt, regionsMapOf, registerWorkBuddyStatusRoute, resolveCredentialRecovery, selectAccountFor, settingsNamespaceOf, toPersistedWorkBuddyModel, unwrapVolatileDeep, videoToolRegionOf, withEffectiveOff, withWorkBuddyRegion, workBuddyDisplayName, workBuddyModelInput, workBuddyThinkingLevelMap, workBuddyWebStatus, workbuddyAccountId, workbuddyAppExecutableCandidates, workbuddyHostHeartbeatPath, workbuddyOwnAuthPath, writeHostHeartbeat };
6329
+ export { CREDENTIAL_REJECTED_CODE, Config, DEFAULT_PROBE_INPUT_TOKENS, ENCRYPTED_CREDENTIAL_CODE, FALLBACK_WORKBUDDY_MODELS, FALLBACK_WORKBUDDY_MODELS_GLOBAL, NATIVE_MODALITY_BY_MODEL_ID, PROBE_INPUT_TOKEN_CHOICES, PROBE_MAX_TOKENS, PROBE_SYSTEM_PROMPT, REFUSES_OFF_MODEL_IDS, type UpstreamErrorKind, WORKBUDDY_ACCOUNTS_REFRESH_PATH, WORKBUDDY_APP_EXECUTABLE_ENV, WORKBUDDY_AUTH_FILENAME, WORKBUDDY_AUTH_FILE_ENV, WORKBUDDY_CHECKIN_PATH, WORKBUDDY_CONNECT_VERSION, WORKBUDDY_GLOBAL_PROVIDER, WORKBUDDY_HOST_HEARTBEAT_FILENAME, WORKBUDDY_MODELS_REFRESH_PATH, WORKBUDDY_PROBE_PATH, WORKBUDDY_PROVIDER, WORKBUDDY_PROVIDERS, WORKBUDDY_PROVIDER_DISPLAY_NAMES, WORKBUDDY_REGIONS, WORKBUDDY_REGION_PARAM, WORKBUDDY_SETTINGS_NS, WORKBUDDY_STREAM_IDLE_TIMEOUT_MS, WORKBUDDY_TPS_PATH, WORKBUDDY_USAGE_PATH, type WorkBuddyAccountChoice, type WorkBuddyAdapter, type WorkBuddyAuthStatus, type WorkBuddyCandidateFailure, WorkBuddyCatalog, type WorkBuddyChatResult, type WorkBuddyCredential, type WorkBuddyCredentialRecovery, WorkBuddyCredentialRejectedError, WorkBuddyCredentialStore, type WorkBuddyCreditPackage, type WorkBuddyCredits, WorkBuddyEncryptedCredentialError, type WorkBuddyEncryptedField, type WorkBuddyHostHeartbeat, type WorkBuddyHostHeartbeatOwner, type WorkBuddyModelInfo, type WorkBuddyNativeModality, WorkBuddyPoolPreferences, type WorkBuddyProbeClient, type WorkBuddyProbeOutcome, type WorkBuddyProbeResult, type WorkBuddyProbeStore, type WorkBuddyReasoning, type WorkBuddyRecoveryCandidate, type WorkBuddyRefreshOutcome, WorkBuddyRegionState, type WorkBuddyShim, type WorkBuddyStatusRouteOptions, type WorkBuddyStoreOptions, WorkBuddyUpstreamClient, type WorkBuddyUpstreamModel, type WorkBuddyUsabilityProbeOptions, apply, asVolatile, authFileName, classifyUpstreamError, clearAtRestKeyCache, clearHostHeartbeat, cooldownOf, createAccountUsabilityProbe, createWorkBuddyAdapter, createWorkBuddyShim, creditOfStream, defaultDesktopAuthCandidates, defaultDesktopAuthDirs, defaultDesktopAuthPath, defaultOffModelIds, deriveAtRestKey, deriveAtRestKeyId, deriveCatalog, fallbackModelsFor, fetchAtRestKeyPayload, findWorkbuddyAppExecutable, hasEncryptedCredentialFields, imageDefaultFor, imageToolRegionOf, inject, isCredentialRejectedError, isEncryptedCredentialError, isEncryptedFieldWrapper, isHeartbeatProcessAlive, isWorkbuddyBundle, knownRegionOf, legacyAttributionRegion, legacyWorkbuddyOwnAuthPath, macosBundleExecutable, macosNestedAppBundles, modelIdOfBody, name, nativeModalityOf, nextRegionEnabled, nextRegionSlots, offDefaultFor, openEncryptedField, outcomeOfFailure, parseCreditMultiplier, parseReasoning, parseRetryAfter, parseUpstreamModel, parseWorkBuddyAuth, prepareChatBody, probeModel, probeRequestBody, probeSucceeded, processStartTimeMs, readAtRestKey, readHostHeartbeat, realTierAvailabilityFor, regionCleared, regionEnabled, regionEnabledOf, regionOf, regionOfProvider, regionOfStatusUrl, regionStateOf, regionsFieldIsCorrupt, regionsMapOf, registerWorkBuddyStatusRoute, resolveCredentialRecovery, selectAccountFor, settingsNamespaceOf, toPersistedWorkBuddyModel, unwrapVolatileDeep, videoToolRegionOf, withEffectiveOff, withWorkBuddyRegion, workBuddyDisplayName, workBuddyModelInput, workBuddyThinkingLevelMap, workBuddyWebStatus, workbuddyAccountId, workbuddyAppExecutableCandidates, workbuddyHostHeartbeatPath, workbuddyOwnAuthPath, writeHostHeartbeat };
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $t as parseQueueAnswer, A as withoutRouters, An as writeFileAtomic, At as offRefused, B as defaultDesktopAuthPath, Bt as IMAGE_TAG_IMAGE_TO_IMAGE, C as setDeviceMode, Cn as macosNestedAppBundles, Ct as attachBusyLevels, D as applyContextBudgets, Dt as defaultOffModelIds, E as WorkBuddyCatalog, En as workbuddyAppExecutableCandidates, Et as REFUSES_OFF_MODEL_IDS, F as WorkBuddyCredentialStore, Ft as WorkBuddyVideoError, G as parseWorkBuddyAuth, Gt as imageMimeForPath, H as isEncryptedCredentialError, Ht as MAX_INPUT_IMAGE_BYTES, I as WorkBuddyEncryptedCredentialError, It as parseSupportedSecondsRange, J as workbuddyOwnAuthPath, Jt as isBareBase64Image, K as preferredAccountName, Kt as imageModelChoices, L as authFileName, Lt as pickVideoModel, M as WORKBUDDY_AUTH_FILENAME, Mt as withEffectiveOff, N as WORKBUDDY_AUTH_FILE_ENV, Nt as VIDEO_TAG_IMAGE_TO_VIDEO, O as deriveCatalog, On as resolveDshHome, Ot as lastRefusalFor, Pt as VIDEO_TAG_TEXT_TO_VIDEO, Q as CREDENTIAL_REJECTED_CODE, Qt as sniffImageMime, R as defaultDesktopAuthCandidates, Rt as resolveVideoParams, S as saveDeviceSdkSettings, Sn as macosBundleExecutable, St as rewriteSessionTitleModel, T as FALLBACK_WORKBUDDY_MODELS_GLOBAL, Tn as readAtRestKey, Tt as selectPromoBadge, U as isVaultAccountId, Ut as WorkBuddyImageError, V as hasEncryptedCredentialFields, Vt as IMAGE_TAG_TEXT_TO_IMAGE, W as legacyWorkbuddyOwnAuthPath, Wt as imageDataUrl, X as APP_VERSION, Xt as parseImageDataUrl, Yt as isWatermarkFreeImageModel, Z as CONTEXT_OVERFLOW_MARKER, Zt as pickMediaModel, _ as createDeviceProfileLookup, _n as fetchAtRestKeyPayload, _t as parseUpstreamModel, a as readHostHeartbeat, at as declaredTools, b as readDeviceSettings, bn as isEncryptedFieldWrapper, bt as regionOf, c as WORKBUDDY_CONNECT_VERSION, ct as isContextTooLongBody, dt as isFirstMessageGateBody, en as queueNoticeText, et as WORKBUDDY_FALLBACK_SYSTEM_PROMPT, ft as knownRegionOf, g as createTuringSdk, gn as deriveAtRestKeyId, gt as parseReasoning, h as createDeviceSdkPort, hn as deriveAtRestKey, ht as parseCreditMultiplier, i as processStartTimeMs, in as nativeModalityOf, it as classifyUpstreamError, j as ENCRYPTED_CREDENTIAL_CODE, jt as recordRefusal, k as fallbackModelsFor, kn as withFileLock, kt as offDefaultFor, l as createFileRosterSeenStore, lt as isConversationIdGateBody, m as piAiRuntimeInfo, mn as clearAtRestKeyCache, mt as openingEvidenceOfBody, n as clearHostHeartbeat, nn as NATIVE_MODALITY_BY_MODEL_ID, nt as WorkBuddyUpstreamClient, o as workbuddyHostHeartbeatPath, p as resolveCnGateway, pn as WORKBUDDY_APP_EXECUTABLE_ENV, pt as modelIdOfBody, q as workbuddyAccountId, qt as imageSizeLimitsOf, r as isHeartbeatProcessAlive, rn as imageDefaultFor, rt as channelGateMemberOf, s as writeHostHeartbeat, st as forceNeutralHead, t as WORKBUDDY_HOST_HEARTBEAT_FILENAME, tn as pruneTempDir, tt as WorkBuddyCredentialRejectedError, un as isDeviceId, ut as isCredentialRejectedError, v as describeDerivedDevices, vn as findWorkbuddyAppExecutable, vt as perturbChannelFingerprints, w as FALLBACK_WORKBUDDY_MODELS, wn as openEncryptedField, wt as promoBadgeTone, x as saveDeviceProfile, xn as isWorkbuddyBundle, xt as requestEvidenceOf, y as isDeviceMode, yt as prepareChatBody, z as defaultDesktopAuthDirs, zt as IMAGE_SIZE_LIMITS_WIDE } from "./host-heartbeat-CRS-1LBA.js";
1
+ import { $t as parseQueueAnswer, A as withoutRouters, An as writeFileAtomic, At as offRefused, B as defaultDesktopAuthPath, Bt as IMAGE_TAG_IMAGE_TO_IMAGE, C as setDeviceMode, Cn as macosNestedAppBundles, Ct as attachBusyLevels, D as applyContextBudgets, Dt as defaultOffModelIds, E as WorkBuddyCatalog, En as workbuddyAppExecutableCandidates, Et as REFUSES_OFF_MODEL_IDS, F as WorkBuddyCredentialStore, Ft as WorkBuddyVideoError, G as parseWorkBuddyAuth, Gt as imageMimeForPath, H as isEncryptedCredentialError, Ht as MAX_INPUT_IMAGE_BYTES, I as WorkBuddyEncryptedCredentialError, It as parseSupportedSecondsRange, J as workbuddyOwnAuthPath, Jt as isBareBase64Image, K as preferredAccountName, Kt as imageModelChoices, L as authFileName, Lt as pickVideoModel, M as WORKBUDDY_AUTH_FILENAME, Mt as withEffectiveOff, N as WORKBUDDY_AUTH_FILE_ENV, Nt as VIDEO_TAG_IMAGE_TO_VIDEO, O as deriveCatalog, On as resolveDshHome, Ot as lastRefusalFor, Pt as VIDEO_TAG_TEXT_TO_VIDEO, Q as CREDENTIAL_REJECTED_CODE, Qt as sniffImageMime, R as defaultDesktopAuthCandidates, Rt as resolveVideoParams, S as saveDeviceSdkSettings, Sn as macosBundleExecutable, St as rewriteSessionTitleModel, T as FALLBACK_WORKBUDDY_MODELS_GLOBAL, Tn as readAtRestKey, Tt as selectPromoBadge, U as isVaultAccountId, Ut as WorkBuddyImageError, V as hasEncryptedCredentialFields, Vt as IMAGE_TAG_TEXT_TO_IMAGE, W as legacyWorkbuddyOwnAuthPath, Wt as imageDataUrl, X as APP_VERSION, Xt as parseImageDataUrl, Yt as isWatermarkFreeImageModel, Z as CONTEXT_OVERFLOW_MARKER, Zt as pickMediaModel, _ as createDeviceProfileLookup, _n as fetchAtRestKeyPayload, _t as parseUpstreamModel, a as readHostHeartbeat, at as declaredTools, b as readDeviceSettings, bn as isEncryptedFieldWrapper, bt as regionOf, c as WORKBUDDY_CONNECT_VERSION, ct as isContextTooLongBody, dt as isFirstMessageGateBody, en as queueNoticeText, et as WORKBUDDY_FALLBACK_SYSTEM_PROMPT, ft as knownRegionOf, g as createTuringSdk, gn as deriveAtRestKeyId, gt as parseReasoning, h as createDeviceSdkPort, hn as deriveAtRestKey, ht as parseCreditMultiplier, i as processStartTimeMs, in as nativeModalityOf, it as classifyUpstreamError, j as ENCRYPTED_CREDENTIAL_CODE, jt as recordRefusal, k as fallbackModelsFor, kn as withFileLock, kt as offDefaultFor, l as createFileRosterSeenStore, lt as isConversationIdGateBody, m as piAiRuntimeInfo, mn as clearAtRestKeyCache, mt as openingEvidenceOfBody, n as clearHostHeartbeat, nn as NATIVE_MODALITY_BY_MODEL_ID, nt as WorkBuddyUpstreamClient, o as workbuddyHostHeartbeatPath, p as resolveCnGateway, pn as WORKBUDDY_APP_EXECUTABLE_ENV, pt as modelIdOfBody, q as workbuddyAccountId, qt as imageSizeLimitsOf, r as isHeartbeatProcessAlive, rn as imageDefaultFor, rt as channelGateMemberOf, s as writeHostHeartbeat, st as forceNeutralHead, t as WORKBUDDY_HOST_HEARTBEAT_FILENAME, tn as pruneTempDir, tt as WorkBuddyCredentialRejectedError, un as isDeviceId, ut as isCredentialRejectedError, v as describeDerivedDevices, vn as findWorkbuddyAppExecutable, vt as perturbChannelFingerprints, w as FALLBACK_WORKBUDDY_MODELS, wn as openEncryptedField, wt as promoBadgeTone, x as saveDeviceProfile, xn as isWorkbuddyBundle, xt as requestEvidenceOf, y as isDeviceMode, yt as prepareChatBody, z as defaultDesktopAuthDirs, zt as IMAGE_SIZE_LIMITS_WIDE } from "./host-heartbeat-DeelaI9b.js";
2
2
  import z from "@deepseek-ai/schemastery";
3
3
  import { appendFile, mkdir, open, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
4
4
  import { randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
@@ -15650,10 +15650,12 @@ function apply(ctx, config) {
15650
15650
  } catch {}
15651
15651
  })();
15652
15652
  let stopped = false;
15653
- ctx.effect(() => () => {
15653
+ let heartbeatWrite;
15654
+ ctx.effect(() => async () => {
15654
15655
  stopped = true;
15655
15656
  for (const region of REGION_KEYS) stacks[region].shim.close();
15656
- clearHostHeartbeat();
15657
+ const owner = await heartbeatWrite;
15658
+ if (owner !== void 0) await clearHostHeartbeat(owner);
15657
15659
  });
15658
15660
  Promise.all(REGION_KEYS.map((region) => stacks[region].shim.ready)).then(async () => {
15659
15661
  if (stopped) return;
@@ -15754,7 +15756,10 @@ function apply(ctx, config) {
15754
15756
  inputModalities: workBuddyModelInput(model)
15755
15757
  }));
15756
15758
  });
15757
- writeHostHeartbeat();
15759
+ const logger = ctx.logger;
15760
+ heartbeatWrite = writeHostHeartbeat().catch((error) => {
15761
+ logger.error("dsh-connect-workbuddy: host heartbeat write failed", error);
15762
+ });
15758
15763
  } catch (error) {
15759
15764
  ctx.logger.error("dsh-connect-workbuddy: provider registration failed", error);
15760
15765
  return;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "dsh-connect-workbuddy",
3
3
  "displayName": "DSH Connect WorkBuddy",
4
4
  "description": "把本机登录的 WorkBuddy 模型(国内版与国际版)接入 DeepSeek Harness:每次刷新按上游目录自动读取每个模型的积分倍率,支持逐模型图片输入开关、多账号切换与账号池自动换号,并提供每日签到、卡片与输入框里的胶囊积分读数等只读积分概览。",
5
- "version": "5.23.0",
5
+ "version": "5.24.1",
6
6
  "author": "dingminhua",
7
7
  "copyright": "Copyright (c) 2026 LaoDing",
8
8
  "license": "MIT",