dsh-connect-workbuddy 5.22.0 → 5.23.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,129 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.23.1 (2026-11-13)
4
+
5
+ > 版本号是 **patch**:修一个明确的 bug,无新增配置项、无接口变化。
6
+
7
+ ### 修复:Hy4 正式版选上后仍然无法识别图片(issue #255)
8
+
9
+ 用户报告选了 hy4 之后贴图无效。**不是模型不行,是能力表漏了一代模型。**
10
+
11
+ 插件有一张「模型原生多模态能力」表(`src/native-modality.ts`),按**精确 id** 记录每个模型能不能读图;
12
+ 刷新模型目录时,只有被标为 `multimodal` 的才会默认勾选图片框。而实时名册里 Hy4 正式版的 id 是
13
+ `hy4free`(免费档)和 `hy4std`(付费档),**两个都不在表里** —— 于是判为 `unknown`、不预勾选,
14
+ 宿主按「这个模型不支持图片」处理。
15
+
16
+ **实测**(CN 网关,本构建自己的凭据,2026-11-13):一张 512×512 纯红 PNG 问「主色是什么」,
17
+ 两个 id 都答 `Red`,且答案在 `content` 而不只是推理过程。上游目录也写着
18
+ `"Latest Flagship Model: Agentic and Multimodal Expertise"`。
19
+
20
+ **为什么不能靠族关系或沿用旧键**:表里原本有一条 `hy4-preview: 'text'`,那是**预览版**,模型卡写的是
21
+ `pipeline_tag: text-generation`,确实读不了图;正式版(2026-11-04 发布)才引入视觉理解。所以:
22
+
23
+ - 按前缀 / 族匹配会把预览版的 `text` 结论传给正式版,正好复现这个 bug;
24
+ - 保留 `hy4-preview` 那个键也不对 —— 它已不在实时名册里,留着等于继续断言「这个家族是纯文本」。
25
+
26
+ 该键已移除,由实测结论取代。两个正式版 id 都显式列出,因为匹配用的是精确 id:只勾一个档位会让另一个
27
+ 继续拒图,且用户看不出原因。
28
+
29
+ `docs/DESIGN.md` 的核验表同步更新(A 档由 5 条增至 7 条,CN 预勾选数 21 个里 7 → 9)。
30
+
31
+ ### 说明:这个坑藏得比较深
32
+
33
+ 第一轮排查时我拿 `hy4-preview` 测,看到上游回 `unsupported_image_format` 就下了「hy4 不支持图片」的
34
+ 结论 —— 那是错的,预览版和正式版是两代模型。把它写进 CHANGELOG 是因为同类误判还会再犯:
35
+ **模型 id 换代而显示名不变时,能力表里那一行会静默过期**,而症状是「用户以为是自己没设置对」。
36
+
37
+ ## 5.23.0 (2026-11-13)
38
+
39
+ > 版本号是 **minor**:开发依赖栈整体换代到 DSH `0.2.2-rc.2` 线,结清上一轮复核留下的
40
+ > 两项技术债,并让测试与用户实际拿到的 pi-ai 对齐。**不改任何用户可见行为。**
41
+
42
+ ### 修复:升到 0.2.2 依赖线时的两处类型错误
43
+
44
+ 这两条在 0.2.2-rc.1 就已存在,只是开发依赖当时还钉在 0.1.7,类型里没有这些声明,所以看不见。
45
+
46
+ - 模型徽章的本地类型声明 `LlmModelBadge.text` 写成了 `string | Record<string, string>`,而宿主的
47
+ `LocalizedText` 要求表里必须有 `en`。这不只是迁就编译器:`en` 缺失时宿主的解析器返回
48
+ `undefined`,徽章直接不显示——**那本来就是本插件依赖的不变量**,只是原来的写法无法表达它。
49
+ 收窄成 `string | ({ en: string } & Record<string, string>)` 之后,编译器开始替我们看守这条规则。
50
+ - 适配器的图片预算补上 `maxRequestImages` / `imageOffloadCountQuantum`(宿主 0.2.2 起在 profile 类型上
51
+ 必填)。**值刻意不照抄宿主的 50**:本插件的路由从来没有图片张数上限,填 50 等于借一次依赖升级
52
+ 悄悄收紧行为,症状会是图片多的会话突然报 `IMAGE_OFFLOAD_REQUIRED`。两个值都取了一个明显高于任何
53
+ 真实请求的数,并在常量旁写明这是「满足类型、保留今天的行为」,以及将来若测到网关真实上限该改哪里。
54
+
55
+ ### 修复:真实组合下 5 条测试的前提已经不成立
56
+
57
+ 宿主随包的 `@earendil-works/pi-ai` 是 **1.3.0**,而 1.3 起它处理「不属于当前模型的思考块」的方式变了:
58
+ ≤1.2 会把它**改写成正文**(这正是 issue #147/#163 那个缺陷),1.3 起**直接丢弃**。本插件的修复在
59
+ 1.3 上因此变成无操作,而那 5 条「前提测试」断言的还是旧行为,在真实组合上必然失败。
60
+
61
+ 处理方式不是把测试改宽,也不是给修复加版本开关:
62
+
63
+ - 新增一个测试助手,**用真实的 transform 实测一次**「这块思考最终成了正文还是消失了」,而不是比较
64
+ 版本号。版本号是库内部规则的第二个副本,第一次 1.x 改主意却不改大版本时它就会骗人——而这次
65
+ 正是那种情况。
66
+ - 5 条用例改成按实测结果断言。**被检验的腿没有变松**:`isSameModel` 的 provider / api / model
67
+ 三条腿仍是每条用例真正在证明的东西。
68
+ - **修复保持无条件运行**。pi-ai 是**按进程**解析的,嵌套副本会遮蔽宿主的(issue #24 实证),所以
69
+ 插件不能假设用户手上是哪一代。「别的模型的思考永远不进这次请求」是本 bundle 自己的保证,比推断
70
+ 「装的是哪份库」便宜。
71
+ - 源码里那些以「会被摊平成正文」为前提的注释按代际修正,并把已经漂移的行号引用改成符号名。
72
+
73
+ ### 修复:`stateOf` 迁移到 `snapshot`(0.2.2 起已被宿主弃用)
74
+
75
+ CLI 桥读当前工作目录的投影,改用 `snapshot(session, [key]).values[key]`,并**保留**旧读面作为回退:
76
+
77
+ - 旧 API 仍然正确,只是每个 key 每进程打一条弃用告警;但把「宿主可能比弃用更旧」这件事硬编码掉,
78
+ 会让旧宿主上这个探测静默变空,阶梯随后回落到**会话 header**——也就是 `/cd` 之前那个陈旧目录,
79
+ 正是这套机制存在的理由。
80
+ - 读取逻辑抽成导出的纯函数,于是「到底调了哪个读面」可以被测试钉住:优先新读面且**完全不碰**旧读面、
81
+ 没有新读面时回退、两个读面对「没记录」都答 `undefined`。
82
+ - 没有改用 `workingDirectory.get(session)`:那个服务在「没有提交过目录」时回落到**宿主进程的 cwd**,
83
+ 会把「不知道」变成「用这个」。
84
+
85
+ ### 变更:开发依赖栈与 CI 矩阵
86
+
87
+ - `dsh-*` 依赖线由 `0.1.7-rc.1` 升到 `0.2.2-rc.2`,`cordis` 4.0.2 → 4.1.0,`schemastery`
88
+ 3.18.4 → 3.19.0,`@earendil-works/pi-ai` 0.85.1 → 1.3.0。
89
+ - **pi-ai 必须跟着一起升,这不是可选项**:0.2.2 的 `dsh-llm-pi-ai` 依赖 `^1.3.0`,而 0.85.1 的
90
+ `providers/all` 里没有 `getAllBuiltinModels`。把 dsh 包升上去而 pi-ai 留在旧代,是**加载期
91
+ `SyntaxError`、启动失败**,不是类型错误(已实测复现)。
92
+ - CI 的 pi-ai 矩阵由单腿扩到 `1.1.0` + `1.3.0`:前者是「摊平」那一代,本插件修复自身的回归保护靠它;
93
+ 后者是宿主随包的那一代,也是现在的依赖 pin。两条都本地实跑过。
94
+ - 顺带的好处:开发机不再跑在一条用户不会遇到的代际上(此前 `doctor` 报 `legacy 0.85.1`,因为本地
95
+ 副本遮蔽了宿主那份;现在报 `modern 1.3.0`,与市场安装一致)。
96
+
97
+ ### 文档
98
+
99
+ - 新增 `docs/DSH-0.2.2-RC2-FOLLOWUP.md`:rc.2 的逐面复核、两处类型错误的成因、pi-ai 代际行为改变
100
+ 的来龙去脉,以及每项改动的变异验证记录。
101
+ - 两份 README 的「受支持的宿主范围」补记 `0.2.2-rc.1` / `0.2.2-rc.2` 的实测结论,并说明它与
102
+ 「裸 semver 判定」是两个不同的问题。
103
+ - `RELEASING.md` 的宿主范围核对加入三条:devDeps 与 peer 范围必须逐条相等、overrides 必须整块指向
104
+ 同一条线、pi-ai 必须与宿主同批升级,以及 CI 至少覆盖两种「异模型思考」处置方式。
105
+
106
+ ## 5.22.1 (2026-11-12)
107
+
108
+ > 版本号是 **patch**:只改一个控件的位置,不动任何配置键与行为。
109
+
110
+ ### 修复:生图模型选择器被排在了视频那一组里
111
+
112
+ 上一版把「生图模型(水印)」下拉框渲染在「视频工具」开关与视频模型钉选行之间,于是它读起来
113
+ 是视频组的一部分——用户报的原话是「怎么跑到视频的选项了」。这个控件配置的是生图,逻辑没错,
114
+ 位置错了。
115
+
116
+ 现在是同构的配对:每个工具开关下面紧跟它自己的选择器。
117
+
118
+ | 开关 | 紧随其后的选择器 |
119
+ | --- | --- |
120
+ | 生图工具 | 生图模型(水印) |
121
+ | 视频工具 | 视频模型钉选(文生视频 / 图生视频) |
122
+
123
+ 漏出去的原因值得记一笔:这个控件原有的七条测试全部在问「选择器画出来了没有」,而它确实画出来
124
+ 了,只是画错了地方。已补一条按 DOM 顺序断言的用例,钉住「每个开关拥有配置它的那个选择器」这条
125
+ 规则,而不是钉像素位置;变异验证是把顺序改回上一版的排法,用例立刻变红。
126
+
3
127
  ## 5.22.0 (2026-11-12)
4
128
 
5
129
  > 版本号是 **minor**:新增两项用户可见的功能(选号顺序的两态开关、生图模型选择),另修一处缓存行为缺陷。
package/README.en.md CHANGED
@@ -226,6 +226,11 @@ 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
232
+ > above still describes **bare semver** evaluation, which is a different question from "does it run" — see the next note.
233
+
229
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**.
230
235
  > npm semver admits a prerelease only when a comparator carries a prerelease on the **same `major.minor.patch` tuple**.
231
236
  > The declared `>=0.1.7-rc.1 <0.3.0-0` opens only `0.1.7-x`, while `<0.3.0-0` excludes the `0.3.0` tuple — so versions such as
package/README.md CHANGED
@@ -243,6 +243,11 @@ 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
+ > 的判定,与「能不能跑」是两件事,原因见下条。
250
+
246
251
  > **关于 `0.2.x` 预发布(v4.7.0 更正)**:此前本表把 `0.2.0-rc.1` 写作「✅ 支持」,那是**错的**。
247
252
  > npm semver 规定:预发布版本只有当一个比较器**在同一条 `major.minor.patch` 元组上**带预发布标签时才被放行。
248
253
  > 现声明 `>=0.1.7-rc.1 <0.3.0-0` 只对 `0.1.7-x` 开口,`<0.3.0-0` 又排除了 `0.3.0` 元组,因此
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-CYnq7iGq.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-BfSlXO19.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
  };
@@ -12075,8 +12076,8 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
12075
12076
  cliBridgePreference,
12076
12077
  cliBridgeSwitchedOn() ? cliBridgePickers : null,
12077
12078
  imageToolPreference,
12078
- videoToolPreference,
12079
12079
  imageModelPreference,
12080
+ videoToolPreference,
12080
12081
  videoModelPreference,
12081
12082
  mediaModelsPreference,
12082
12083
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
@@ -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.22.0";
10605
+ const WORKBUDDY_CONNECT_VERSION = "5.23.1";
10605
10606
  //#endregion
10606
10607
  //#region src/host-heartbeat.ts
10607
10608
  /**
package/lib/index.d.ts CHANGED
@@ -2873,12 +2873,21 @@ declare function workBuddyThinkingLevelMap(info: WorkBuddyModelInfo): WorkBuddyT
2873
2873
  *
2874
2874
  * - `flattened`: `stopReason` is a normal completion, so `transform-messages`
2875
2875
  * turns the block into `{type:'text', text: thinking}` — the whole reasoning
2876
- * body lands in the visible answer.
2876
+ * body lands in the visible answer. This is the disposition up to pi-ai 1.2;
2877
+ * see the note on the field below for what 1.3+ does with it.
2877
2878
  * - `dropped`: `stopReason` is `error`/`aborted`, so the entire message is
2878
2879
  * skipped; nothing reaches the wire and nothing reaches the user. It is
2879
2880
  * reported anyway, because it still costs context: the model's answer to
2880
2881
  * "why did my last turn say nothing" is this line, and a caller cannot see it
2881
2882
  * from the transcript.
2883
+ *
2884
+ * ⚠️ On pi-ai 1.3+ the `flattened` label is historical, not predictive: the
2885
+ * library discards a foreign block instead of rewriting it, so the "prose
2886
+ * leak" this name describes can no longer happen there. The label is kept
2887
+ * because it is what the CALLER asks about ("was this reasoning about to
2888
+ * become my answer?") and because the repair — which is this plugin's own
2889
+ * guarantee, independent of whichever pi-ai a user resolves — is still the
2890
+ * thing that decides.
2882
2891
  */
2883
2892
  interface ForeignThinkingBlock {
2884
2893
  /** Index of the message in the context's `messages`. */
@@ -6085,10 +6094,13 @@ interface Config {
6085
6094
  *
6086
6095
  * When a session moves between providers, `dsh-llm-pi-ai` rebuilds the other
6087
6096
  * provider's assistant turns with `api: 'dsh-foreign'`, and pi-ai's
6088
- * `isSameModel` then fails — so it does not DROP their `thinking` blocks, it
6089
- * rewrites each one to plain `text` (`transform-messages.js:87–90`). The
6090
- * other model's working notes therefore arrive as this turn's answer, and the
6091
- * model copies that shape on every later turn.
6097
+ * `isSameModel` then fails — so up to pi-ai 1.2 it did not DROP their
6098
+ * `thinking` blocks, it rewrote each one to plain `text`. The other model's
6099
+ * working notes therefore arrived as this turn's answer, and the model copied
6100
+ * that shape on every later turn. (pi-ai 1.3 discards such a block instead,
6101
+ * which is the same outcome this switch produces — see the note on
6102
+ * `dropForeignThinking` in `adapter.ts` for why the repair still runs
6103
+ * unconditionally.)
6092
6104
  *
6093
6105
  * On, those blocks are removed from the request instead: they carry no
6094
6106
  * `thinkingSignature` (the host builds them without one), so they could never
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-CYnq7iGq.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-BfSlXO19.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";
@@ -1287,13 +1287,18 @@ const WORKBUDDY_PROVIDERS = {
1287
1287
  *
1288
1288
  * pi-ai keeps a historical thinking block as `thinking` only when the message
1289
1289
  * that carried it names the SAME provider, api and model id as the request in
1290
- * flight (`transform-messages.js:68`); every other block is downgraded to plain
1291
- * `text` (`:88–96`) — downgraded, not dropped, which is why no byte count ever
1292
- * explained the 1.94× regional jump. The two gateways are two provider STRINGS
1293
- * for ONE model, so a transcript recorded in one region was replayed as text in
1294
- * the other, and issue #59's reporter measured exactly that: 708K → 1.374M on
1295
- * byte-identical history, and a compression request that could then never fit
1296
- * the window it was computed for.
1290
+ * flight (`transform-messages.js`, `isSameModel`); every other block is
1291
+ * downgraded to plain `text` — downgraded, not dropped, which is why no byte
1292
+ * count ever explained the 1.94× regional jump. The two gateways are two
1293
+ * provider STRINGS for ONE model, so a transcript recorded in one region was
1294
+ * replayed as text in the other, and issue #59's reporter measured exactly
1295
+ * that: 708K → 1.374M on byte-identical history, and a compression request
1296
+ * that could then never fit the window it was computed for.
1297
+ *
1298
+ * (pi-ai 1.3 changed the second half: a foreign block is now DISCARDED rather
1299
+ * than rewritten as text. The identity stamp is unaffected — it is what makes
1300
+ * the block count as same-model in the first place, and that comparison is
1301
+ * unchanged in every generation this plugin declares.)
1297
1302
  *
1298
1303
  * The stamp is NOT inert, and reading it as inert is what broke issue #75.
1299
1304
  * `provider` is the KEY pi-ai dispatches on: `requireProvider` resolves
@@ -1371,10 +1376,42 @@ const WORKBUDDY_PROVIDER_DISPLAY_NAMES = {
1371
1376
  /** Provider idle ceiling while one stream read is outstanding. */
1372
1377
  const WORKBUDDY_STREAM_IDLE_TIMEOUT_MS = 3e5;
1373
1378
  /**
1374
- * Image-request budgets at the dsh-llm-pi-ai defaults; the profile type made
1375
- * them required in 0.1.1-rc.2.
1379
+ * Image-request budgets for the route's `ResolvedPiAiProviderProfile`.
1380
+ *
1381
+ * The three byte/pixel budgets are the dsh-llm-pi-ai defaults (`0.1.1-rc.2`
1382
+ * made them required on the resolved profile).
1383
+ *
1384
+ * The two COUNT fields arrived with DSH 0.2.2 (`0.2.2-rc.1`), where
1385
+ * `dsh-llm-pi-ai` began enforcing a per-request image OCCURRENCE limit
1386
+ * (`maxRequestImages`, its own default 50) and the offload step that trims it
1387
+ * (`imageOffloadCountQuantum`, default `min(10, maxRequestImages)`). Both are
1388
+ * REQUIRED on the resolved profile, so this route must state a value; the
1389
+ * value is the plugin's decision, not a copy of the host's.
1390
+ *
1391
+ * WHY NOT 50. Until 0.2.2 this route had NO occurrence limit at all: the
1392
+ * adapter only ever passed the byte budget down (`toPiContextWithImages`
1393
+ * spreads `maxImages` only when it is defined), so a long session could carry
1394
+ * any number of images as long as the base64 payload fit. Adopting the host's
1395
+ * default would therefore NARROW this plugin's behaviour as a silent side
1396
+ * effect of a dependency bump — the kind of change that shows up as a user's
1397
+ * image-heavy session suddenly failing with `IMAGE_OFFLOAD_REQUIRED`.
1398
+ *
1399
+ * So both values are deliberately pinned far above any real request: they are
1400
+ * a TYPE requirement satisfied with "no practical limit", which keeps today's
1401
+ * behaviour byte-identical. `maxRequestImages` is a count of image
1402
+ * occurrences and the upstream gateway caps a request far below this on its
1403
+ * own; `imageOffloadCountQuantum` must not exceed `maxRequestImages`
1404
+ * (`dsh-llm-pi-ai` validates exactly that), so it is pinned to the same
1405
+ * giant value rather than to 10.
1406
+ *
1407
+ * If the gateway's real per-request image cap ever gets measured, THAT is the
1408
+ * number to put in `maxRequestImages` — with a comment saying where it came
1409
+ * from. Do not "borrow" the host's 50: it belongs to the host's own pi-ai
1410
+ * routes, not to WorkBuddy.
1376
1411
  */
1377
1412
  const REQUEST_IMAGE_BUDGETS = {
1413
+ maxRequestImages: 1e6,
1414
+ imageOffloadCountQuantum: 1e6,
1378
1415
  maxRequestImageBytes: 20971520,
1379
1416
  requestImagePixelBudget: 4194304,
1380
1417
  requestImageMaxBytes: 1048576
@@ -1736,7 +1773,8 @@ function transcript(context) {
1736
1773
  * ISSUE #102. pi-ai replays a thinking block as `thinking` only when the message
1737
1774
  * that produced it names the same `provider` / `api` / `model` as the request in
1738
1775
  * flight (`utils/transform-messages.js`, the `isSameModel` branch); everything
1739
- * else is flattened to `{type:'text', text: thinking}`.
1776
+ * else is flattened to `{type:'text', text: thinking}` — or, since pi-ai 1.3,
1777
+ * discarded outright. Either way the block stops being reasoning.
1740
1778
  *
1741
1779
  * The durable transcript the HOST hands back does not carry the identity. The
1742
1780
  * agent loop writes `source.provider = request.provider`, and `request.provider`
@@ -1831,8 +1869,8 @@ function blocksOf$1(message) {
1831
1869
  *
1832
1870
  * `requestModelId` closes the THIRD leg of pi-ai's own predicate. `isSameModel`
1833
1871
  * is `provider === … && api === … && model === model.id`
1834
- * (`transform-messages.js:68–70`); this function used to compare only the first
1835
- * two. The consequence was a blind spot the size of one whole route: a session
1872
+ * (`transform-messages.js`, and its line numbers move between releases, so this
1873
+ * file names the symbol); this function used to compare only the first two. The consequence was a blind spot the size of one whole route: a session
1836
1874
  * that switches MODELS inside one region — `hy3` → `deepseek-v4.1-flash`, both
1837
1875
  * served by this bundle, both stamped `provider: workbuddy` — keeps the provider
1838
1876
  * and api legs equal, so nothing here noticed, while pi-ai flattened every
@@ -1891,12 +1929,12 @@ function isCrossProviderAssistant(message, identity, ownedRoutes) {
1891
1929
  * Every foreign thinking block pi-ai would turn into visible prose (issue #147).
1892
1930
  *
1893
1931
  * THE DEFECT. pi-ai keeps a historical `thinking` block only while
1894
- * `isSameModel` holds — provider AND api AND model id all equal to the request
1895
- * (`transform-messages.js:68`). For everything else it does NOT drop the block:
1896
- * `:87–90` rewrites it to `{type:'text', text: thinking}`, which is the answer
1897
- * channel. A session that moved between providers therefore arrives with its
1898
- * other provider's working notes already spelled as prose, and the model reads
1899
- * that shape and copies it.
1932
+ * `isSameModel` holds — provider AND api AND model id all equal to the request.
1933
+ * For everything else, up to pi-ai 1.2, it did NOT drop the block: it rewrote
1934
+ * it to `{type:'text', text: thinking}`, which is the answer channel. A session
1935
+ * that moved between providers therefore arrives with the other provider's
1936
+ * working notes already spelled as prose, and the model reads that shape and
1937
+ * copies it.
1900
1938
  *
1901
1939
  * Issue #147 measured the consequence on a real 80-step turn: 56 assistant
1902
1940
  * messages carried an answer while their own `reasoning` was ≤ 1 character,
@@ -1910,6 +1948,14 @@ function isCrossProviderAssistant(message, identity, ownedRoutes) {
1910
1948
  * {@link dropForeignThinking} does, and the split keeps the DIAGNOSIS available
1911
1949
  * to surfaces that must not change bytes (the card, the reply notice).
1912
1950
  *
1951
+ * WHY IT STILL RUNS ON pi-ai 1.3+. That library now discards a foreign block
1952
+ * itself, so on paper this repair has nothing left to do. It stays because the
1953
+ * resolved pi-ai is a PER-PROCESS fact, not a package-level one: a nested copy
1954
+ * shadows the host's (issue #24 proved it), so the plugin cannot assume any
1955
+ * particular generation for the user in front of it. The repair is this
1956
+ * bundle's own guarantee — "another model's reasoning never reaches this
1957
+ * request" — and it is cheaper than reasoning about which copy is loaded.
1958
+ *
1913
1959
  * @param context - a pi-ai context, before or after `alignAssistantIdentities`.
1914
1960
  * @param identity - the identity this adapter stamps on its own models.
1915
1961
  * @param requestModelId - model id the request is addressed to, so the model
@@ -1971,7 +2017,9 @@ function foreignThinkingOf(context, identity = WORKBUDDY_MODEL_IDENTITY, request
1971
2017
  * - a block with NO signature is never emitted at all - it is dropped from the
1972
2018
  * request, not turned into prose;
1973
2019
  * - a block whose message fails `isSameModel` IS flattened into assistant prose
1974
- * (`transform-messages.js:88-96`), and that is the only real 'flattened' case.
2020
+ * (`transform-messages.js`, the `isSameModel` else-branch), and that is the
2021
+ * only real 'flattened' case — up to pi-ai 1.2. From 1.3 such a block is
2022
+ * discarded instead, which moves it into the second bullet's outcome.
1975
2023
  *
1976
2024
  * So the field is deliberately not surfaced to the user: `variant` reaches
1977
2025
  * nothing but the diagnostic callback, and a label that is wrong for two of the
@@ -2948,16 +2996,19 @@ function installChannelContinue(mount) {
2948
2996
  * history was labelled differently on the two sides.
2949
2997
  *
2950
2998
  * The labelling is pi-ai's replay — which assistant messages it lets survive as
2951
- * thinking at all. `transform-messages.js:68` (1.1.0, the version the host
2952
- * bundles) computes
2999
+ * thinking at all. `transform-messages.js` (1.1.0, the version the host bundled
3000
+ * when this report was written) computes
2953
3001
  *
2954
3002
  * isSameModel = assistantMsg.provider === model.provider
2955
3003
  * && assistantMsg.api === model.api
2956
3004
  * && assistantMsg.model === model.id;
2957
3005
  *
2958
- * and for a message that fails it, `:88–96` returns the surviving thinking as
2959
- * `{ type: "text", text: block.thinking }` — downgraded, not dropped — while
2960
- * `:76` drops redacted thinking and `:103` strips tool-call `thoughtSignature`.
3006
+ * and for a message that fails it, it returned the surviving thinking as
3007
+ * `{ type: "text", text: block.thinking }` — downgraded, not dropped — while it
3008
+ * dropped redacted thinking and stripped tool-call `thoughtSignature`. The
3009
+ * comparison is what this report explains and it is unchanged in every pi-ai
3010
+ * generation this plugin declares; only the ELSE branch moved, and pi-ai 1.3
3011
+ * now discards the block instead of rewriting it.
2961
3012
  * `buildParams` runs that transform at `openai-completions.js:896`, before
2962
3013
  * anything is assembled, so a thinking block only stays a thinking block when
2963
3014
  * its message was recorded under the same provider AND the same model id as the
@@ -9351,6 +9402,26 @@ function mountCommandSurface(runtime, commands) {
9351
9402
  return mountCodebuddyCommand(commands, runtime.deps);
9352
9403
  }
9353
9404
  //#endregion
9405
+ //#region src/cli-bridge/services.ts
9406
+ /**
9407
+ * Read one projection key through whichever face the Host offers.
9408
+ *
9409
+ * Extracted from the `ctx.inject(['sessionProjections'])` closure so the
9410
+ * PREFERENCE is testable: on a current Host `snapshot` must answer and
9411
+ * `stateOf` must never be called (it prints a deprecation warning the first
9412
+ * time it is), while an older Host that has only `stateOf` must still answer
9413
+ * instead of silently reporting "no directory".
9414
+ *
9415
+ * `undefined` means "the Host recorded nothing", which is the same signal both
9416
+ * faces give, and the ladder above treats it as such — it must NOT be confused
9417
+ * with a failure, or the header fallback would disappear. A throw is the
9418
+ * caller's to catch (the inject closure does).
9419
+ */
9420
+ function readProjectedState(reader, session, key) {
9421
+ if (typeof reader.snapshot === "function") return reader.snapshot(session, [key])?.values?.[key];
9422
+ return reader.stateOf?.(session, key);
9423
+ }
9424
+ //#endregion
9354
9425
  //#region src/probe.ts
9355
9426
  /**
9356
9427
  * How long to bench a MODEL that answered 14003 with no stated time.
@@ -14184,7 +14255,7 @@ function apply(ctx, config) {
14184
14255
  });
14185
14256
  ctx.inject(["sessionProjections"], (projectionCtx) => {
14186
14257
  const reader = projectionCtx.sessionProjections;
14187
- if (reader === void 0 || typeof reader.stateOf !== "function") return;
14258
+ if (reader === void 0 || typeof reader.snapshot !== "function" && typeof reader.stateOf !== "function") return;
14188
14259
  /**
14189
14260
  * The one place the projection key is spelled out.
14190
14261
  *
@@ -14206,7 +14277,7 @@ function apply(ctx, config) {
14206
14277
  cliDirectoryOf = (session) => {
14207
14278
  let state;
14208
14279
  try {
14209
- state = reader.stateOf(session, WORKING_DIRECTORY_PROJECTION_KEY);
14280
+ state = readProjectedState(reader, session, WORKING_DIRECTORY_PROJECTION_KEY);
14210
14281
  } catch {
14211
14282
  return null;
14212
14283
  }
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.22.0",
5
+ "version": "5.23.1",
6
6
  "author": "dingminhua",
7
7
  "copyright": "Copyright (c) 2026 LaoDing",
8
8
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "./package.json": "./package.json"
36
36
  },
37
37
  "dependencies": {
38
- "@deepseek-ai/schemastery": "3.18.4"
38
+ "@deepseek-ai/schemastery": "3.19.0"
39
39
  },
40
40
  "files": [
41
41
  "lib",