dsh-connect-workbuddy 5.24.15 → 5.24.16

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,42 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.24.16 (2026-11-19)
4
+
5
+ > 版本号是 **patch**:只在 `isBodyOversizeRefusal`(长会话 422 救援的第一层入口判定)里补两种
6
+ > 语义措辞,不改折叠目标、不改池子选号、不改任何开关语义或出站头;无破坏性改动。来自 issue #278。
7
+
8
+ ### 修复:长会话 422 仍进不了救援——入口判定漏认 bili 当前实际的拒绝措辞
9
+
10
+ 承接 #258。#258 把「请求体字节超限」接进了历史折叠链:第一层认出字节超限后在回复里插入
11
+ `prompt is too long (request body exceeded the local byte limit)`,第二层 `rescueCauseOf` 据此
12
+ 按 `body-bytes`(当前测量 × 0.9)折叠。方向是对的,但 #278 在 5.24.15 上实测发现**第一层
13
+ 一次都没命中**,于是第二层永远不执行,长会话仍稳定 422、永久卡死。
14
+
15
+ 两处漏认:
16
+
17
+ 1. **#258 的测试喂的是日志行,不是响应体。** `8,401,132 B > 8,388,608 B` 这串只出现在
18
+ bili 的 `logHostEvent` 日志里,宿主拿到的 422 body 里根本没有字节比较。报告者照着日志写
19
+ 了正例,测试全绿,真实链路上一次都匹配不上。「修好的目标从没被够到」。
20
+ 2. **匹配器要的短语和实际报文差一点。** 它认 `byte limit` + `refused locally`;bili 0.1.216
21
+ 实际写的是 `byte ceiling` + `refused this request locally`——两个词都差一截,双否。
22
+
23
+ 改法:不写死任何组件标识符(`docs/DESIGN.md` §零 第 4 条——写死别人的标识符属于「随代码走」,
24
+ 对方改名或消失后代码还留着),只补两条语义判断:`byte ceiling` 与 `byte limit` 是同一件事的
25
+ 两种英文说法;`silent-direct` + `refus` 描述的是「这条请求因为不能直连发送而被本地拒绝」,
26
+ 与谁生成的无关。同步把函数注释里「每条真实拒绝都带字节比较」的过时说法改成事实:数值比较在
27
+ 日志里、不在响应体里。
28
+
29
+ **边界(如实说明)**:0.1.216 已把这族报文的 token 口径变体("priced over the model's
30
+ context window")刻意留在匹配之外——它没有 `byte`、也没有 `silent-direct`,继续交给
31
+ `isContextOverflow` 处理,避免两个权威竞争同一个失败。这部分属于 bili 侧(其 PR #6546
32
+ 尚未合入 0.1.216),本插件不越界。折叠后重发的 body 是否确实低于 8 MiB 仍未验证——8 MiB 是
33
+ bili 的内部常量,不在本仓库手里;能证明的只有入口判定会命中、会进救援、目标一定低于当前测量。
34
+
35
+ 守护测试(`tests/issue258-body-oversize-rescue.spec.ts`):三条真实 422 body 正例(含把整条
36
+ 报文送进 `rescueCauseOf` 的第二层验证)、四条反例(token 口径 / proxy 挂掉 / 429 / 普通
37
+ 400),双向变异验证——摘掉 `byte ceiling` 红 1 条,摘掉 `silent-direct + refus` 红 1 条,
38
+ 把判定放宽成任意 `refus` 红 1 条(反例咬住),全部恢复后 20 条全绿。
39
+
3
40
  ## 5.24.15 (2026-11-18)
4
41
 
5
42
  > 版本号是 **patch**:两处改动——`package.json` 的一处 peer 元数据声明(#277),以及把
package/lib/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { F as WorkBuddyCredentialStore, J as workbuddyOwnAuthPath, N as WORKBUDDY_AUTH_FILE_ENV, Nn as hostPeersInfo, P as WORKBUDDY_VAULT_DIRNAME, Pn as resolveDshHome, R as defaultDesktopAuthCandidates, T as FALLBACK_WORKBUDDY_MODELS_GLOBAL, Tn as findWorkbuddyAppExecutableWithSource, W as legacyWorkbuddyOwnAuthPath, X as APP_VERSION, Y as workbuddyVaultDir, _n as inspectCredentialDirectory, a as readHostHeartbeat, b as readDeviceSettings, c as WORKBUDDY_CONNECT_VERSION, d as rosterSeenPath, dn as WORKBUDDY_DEVICE_TOKEN_FILE_ENV, et as DEFAULT_WIRE_PROFILE, f as WORKBUDDY_CN_BASE_ENV, fn as readDeviceTokenFile, g as createTuringSdk, hn as deriveDeviceId, lt as describeRequestHeaderNames, m as piAiRuntimeInfo, mn as readDeviceSalt, o as workbuddyHostHeartbeatPath, p as resolveCnGateway, pn as ensureDeviceSalt, r as isHeartbeatProcessAlive, rt as WorkBuddyUpstreamClient, u as describeRosterSeenPayload, vn as protectCredentialDirectory, w as FALLBACK_WORKBUDDY_MODELS, yn as WORKBUDDY_APP_EXECUTABLE_ENV, z as defaultDesktopAuthDirs } from "./host-heartbeat-BqK7yBp2.js";
2
+ import { F as WorkBuddyCredentialStore, J as workbuddyOwnAuthPath, N as WORKBUDDY_AUTH_FILE_ENV, Nn as hostPeersInfo, P as WORKBUDDY_VAULT_DIRNAME, Pn as resolveDshHome, R as defaultDesktopAuthCandidates, T as FALLBACK_WORKBUDDY_MODELS_GLOBAL, Tn as findWorkbuddyAppExecutableWithSource, W as legacyWorkbuddyOwnAuthPath, X as APP_VERSION, Y as workbuddyVaultDir, _n as inspectCredentialDirectory, a as readHostHeartbeat, b as readDeviceSettings, c as WORKBUDDY_CONNECT_VERSION, d as rosterSeenPath, dn as WORKBUDDY_DEVICE_TOKEN_FILE_ENV, et as DEFAULT_WIRE_PROFILE, f as WORKBUDDY_CN_BASE_ENV, fn as readDeviceTokenFile, g as createTuringSdk, hn as deriveDeviceId, lt as describeRequestHeaderNames, m as piAiRuntimeInfo, mn as readDeviceSalt, o as workbuddyHostHeartbeatPath, p as resolveCnGateway, pn as ensureDeviceSalt, r as isHeartbeatProcessAlive, rt as WorkBuddyUpstreamClient, u as describeRosterSeenPayload, vn as protectCredentialDirectory, w as FALLBACK_WORKBUDDY_MODELS, yn as WORKBUDDY_APP_EXECUTABLE_ENV, z as defaultDesktopAuthDirs } from "./host-heartbeat-Ceo9o82d.js";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { dirname, join } from "node:path";
5
5
  import { realpathSync } from "node:fs";
@@ -3995,11 +3995,16 @@ const BODY_OVERSIZE_MARKER = "prompt is too long (request body exceeded the loca
3995
3995
  *
3996
3996
  * A local proxy/gateway in front of the provider may refuse a request whose
3997
3997
  * serialized body exceeds some byte ceiling it enforces. Measured shapes, from
3998
- * a real report:
3998
+ * real reports:
3999
3999
  *
4000
- * bili_gate_oversize_refusal_unattributed_bytes
4001
- * (8,401,132 B > 8,388,608 B)
4000
+ * "8,401,132 B > 8,388,608 B" (LOG line, not the body)
4002
4001
  * "unattributed oversized model request refused locally with a 422"
4002
+ * "its body is larger than the silent-direct byte ceiling" (422 body)
4003
+ *
4004
+ * The number comparison above is a LOG line, not the text returned to the
4005
+ * host: a real 422 body may carry NO byte comparison at all (issue #278). That
4006
+ * is why the phrase-level checks below matter — measuring only against the log
4007
+ * line left the trigger passing its tests yet dead on the real chain.
4003
4008
  *
4004
4009
  * MATCHED BY MEANING, NOT BY NAME. That is the crux of the design decision
4005
4010
  * here: matching a plugin's identifier would be the "special-case another
@@ -4008,11 +4013,18 @@ const BODY_OVERSIZE_MARKER = "prompt is too long (request body exceeded the loca
4008
4013
  * module. A refusal that only says `oversize`/`too large` in BYTES is the class;
4009
4014
  * which component produced it is not this plugin's business, and a future
4010
4015
  * component with different wording that still says so is covered for free.
4016
+ * `byte ceiling` and `byte limit` are two English spellings of the same thing;
4017
+ * `silent-direct` + `refus` describes a request refused locally because it
4018
+ * cannot be sent straight through — no component name is involved in either.
4011
4019
  *
4012
4020
  * What is deliberately NOT matched: `too_many_tokens`, `context length
4013
4021
  * exceeded`, `11115` and friends. Those are TOKEN overflow, which the host
4014
4022
  * already recovers from on its own; treating them here would make two
4015
- * authorities compete over the same failure.
4023
+ * authorities compete over the same failure. For the same reason a refusal
4024
+ * that has moved to TOKEN wording ("priced over the model's context window")
4025
+ * is left to `isContextOverflow` even if a local gateway emitted it — widening
4026
+ * this matcher into token territory would claim a failure that is not about
4027
+ * BYTES any more.
4016
4028
  */
4017
4029
  function isBodyOversizeRefusal(text) {
4018
4030
  if (text === "") return false;
@@ -4022,8 +4034,9 @@ function isBodyOversizeRefusal(text) {
4022
4034
  const oversize = lower.includes("oversize");
4023
4035
  const localByte = lower.includes("byte limit");
4024
4036
  const localRefusal = lower.includes("refused locally");
4025
- if (localByte) return true;
4026
- return oversize && localRefusal;
4037
+ if (localByte || lower.includes("byte ceiling")) return true;
4038
+ if (oversize && localRefusal) return true;
4039
+ return lower.includes("silent-direct") && lower.includes("refus");
4027
4040
  }
4028
4041
  /**
4029
4042
  * Wording that identifies the CHANNEL half of `11128` (the other halves being
@@ -11325,7 +11338,7 @@ function describeRosterSeenPayload(raw) {
11325
11338
  //#endregion
11326
11339
  //#region src/version.ts
11327
11340
  /** The npm package version this build was produced from. */
11328
- const WORKBUDDY_CONNECT_VERSION = "5.24.15";
11341
+ const WORKBUDDY_CONNECT_VERSION = "5.24.16";
11329
11342
  //#endregion
11330
11343
  //#region src/host-heartbeat.ts
11331
11344
  /**
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as CREDENTIAL_REJECTED_CODE, $t as imageSizeLimitsOf, A as withoutRouters, An as openEncryptedField, At as promoBadgeTone, B as defaultDesktopAuthPath, Bt as VIDEO_TAG_TEXT_TO_VIDEO, C as setDeviceMode, Cn as fetchAtRestKeyPayload, Ct as perturbChannelFingerprints, D as applyContextBudgets, Dn as isWorkbuddyBundle, Dt as rewriteSessionTitleModel, E as WorkBuddyCatalog, En as isEncryptedFieldWrapper, Et as requestEvidenceOf, F as WorkBuddyCredentialStore, Fn as withFileLock, Ft as offDefaultFor, G as parseWorkBuddyAuth, Gt as IMAGE_SIZE_LIMITS_WIDE, H as isEncryptedCredentialError, Ht as parseSupportedSecondsRange, I as WorkBuddyEncryptedCredentialError, In as writeFileAtomic, It as offRefused, J as workbuddyOwnAuthPath, Jt as MAX_INPUT_IMAGE_BYTES, K as preferredAccountName, Kt as IMAGE_TAG_IMAGE_TO_IMAGE, L as authFileName, Lt as recordRefusal, M as WORKBUDDY_AUTH_FILENAME, Mn as workbuddyAppExecutableCandidates, Mt as REFUSES_OFF_MODEL_IDS, N as WORKBUDDY_AUTH_FILE_ENV, Nt as defaultOffModelIds, O as deriveCatalog, On as macosBundleExecutable, Ot as toolSchemaRejectAdvice, Pn as resolveDshHome, Pt as lastRefusalFor, Q as CONTEXT_OVERFLOW_MARKER, Qt as imageModelChoices, R as defaultDesktopAuthCandidates, Rt as withEffectiveOff, S as saveDeviceSdkSettings, Sn as deriveAtRestKeyId, St as parseUpstreamModel, T as FALLBACK_WORKBUDDY_MODELS_GLOBAL, Tt as regionOf, U as isVaultAccountId, Ut as pickVideoModel, V as hasEncryptedCredentialFields, Vt as WorkBuddyVideoError, W as legacyWorkbuddyOwnAuthPath, Wt as resolveVideoParams, X as APP_VERSION, Xt as imageDataUrl, Yt as WorkBuddyImageError, Z as BODY_OVERSIZE_MARKER, Zt as imageMimeForPath, _ as createDeviceProfileLookup, _t as knownRegionOf, a as readHostHeartbeat, an as parseQueueAnswer, at as classifyUpstreamError, b as readDeviceSettings, bn as clearAtRestKeyCache, bt as parseCreditMultiplier, c as WORKBUDDY_CONNECT_VERSION, cn as NATIVE_MODALITY_BY_MODEL_ID, ct as deriveStableConversationId, dt as isBodyOversizeRefusal, en as isBareBase64Image, ft as isContextTooLongBody, g as createTuringSdk, gn as isDeviceId, gt as isToolSchemaRejectBody, h as createDeviceSdkPort, ht as isFirstMessageGateBody, i as processStartTimeMs, in as sniffImageMime, it as channelGateMemberOf, j as ENCRYPTED_CREDENTIAL_CODE, jn as readAtRestKey, jt as selectPromoBadge, k as fallbackModelsFor, kn as macosNestedAppBundles, kt as attachBusyLevels, l as createFileRosterSeenStore, ln as imageDefaultFor, m as piAiRuntimeInfo, mt as isCredentialRejectedError, n as clearHostHeartbeat, nn as parseImageDataUrl, nt as WorkBuddyCredentialRejectedError, o as workbuddyHostHeartbeatPath, on as queueNoticeText, ot as conversationIdFromSessionId, p as resolveCnGateway, pt as isConversationIdGateBody, q as workbuddyAccountId, qt as IMAGE_TAG_TEXT_TO_IMAGE, r as isHeartbeatProcessAlive, rn as pickMediaModel, rt as WorkBuddyUpstreamClient, s as writeHostHeartbeat, sn as pruneTempDir, st as declaredTools, t as WORKBUDDY_HOST_HEARTBEAT_FILENAME, tn as isWatermarkFreeImageModel, tt as WORKBUDDY_FALLBACK_SYSTEM_PROMPT, un as nativeModalityOf, ut as forceNeutralHead, v as describeDerivedDevices, vt as modelIdOfBody, w as FALLBACK_WORKBUDDY_MODELS, wn as findWorkbuddyAppExecutable, wt as prepareChatBody, x as saveDeviceProfile, xn as deriveAtRestKey, xt as parseReasoning, y as isDeviceMode, yn as WORKBUDDY_APP_EXECUTABLE_ENV, yt as openingEvidenceOfBody, z as defaultDesktopAuthDirs, zt as VIDEO_TAG_IMAGE_TO_VIDEO } from "./host-heartbeat-BqK7yBp2.js";
1
+ import { $ as CREDENTIAL_REJECTED_CODE, $t as imageSizeLimitsOf, A as withoutRouters, An as openEncryptedField, At as promoBadgeTone, B as defaultDesktopAuthPath, Bt as VIDEO_TAG_TEXT_TO_VIDEO, C as setDeviceMode, Cn as fetchAtRestKeyPayload, Ct as perturbChannelFingerprints, D as applyContextBudgets, Dn as isWorkbuddyBundle, Dt as rewriteSessionTitleModel, E as WorkBuddyCatalog, En as isEncryptedFieldWrapper, Et as requestEvidenceOf, F as WorkBuddyCredentialStore, Fn as withFileLock, Ft as offDefaultFor, G as parseWorkBuddyAuth, Gt as IMAGE_SIZE_LIMITS_WIDE, H as isEncryptedCredentialError, Ht as parseSupportedSecondsRange, I as WorkBuddyEncryptedCredentialError, In as writeFileAtomic, It as offRefused, J as workbuddyOwnAuthPath, Jt as MAX_INPUT_IMAGE_BYTES, K as preferredAccountName, Kt as IMAGE_TAG_IMAGE_TO_IMAGE, L as authFileName, Lt as recordRefusal, M as WORKBUDDY_AUTH_FILENAME, Mn as workbuddyAppExecutableCandidates, Mt as REFUSES_OFF_MODEL_IDS, N as WORKBUDDY_AUTH_FILE_ENV, Nt as defaultOffModelIds, O as deriveCatalog, On as macosBundleExecutable, Ot as toolSchemaRejectAdvice, Pn as resolveDshHome, Pt as lastRefusalFor, Q as CONTEXT_OVERFLOW_MARKER, Qt as imageModelChoices, R as defaultDesktopAuthCandidates, Rt as withEffectiveOff, S as saveDeviceSdkSettings, Sn as deriveAtRestKeyId, St as parseUpstreamModel, T as FALLBACK_WORKBUDDY_MODELS_GLOBAL, Tt as regionOf, U as isVaultAccountId, Ut as pickVideoModel, V as hasEncryptedCredentialFields, Vt as WorkBuddyVideoError, W as legacyWorkbuddyOwnAuthPath, Wt as resolveVideoParams, X as APP_VERSION, Xt as imageDataUrl, Yt as WorkBuddyImageError, Z as BODY_OVERSIZE_MARKER, Zt as imageMimeForPath, _ as createDeviceProfileLookup, _t as knownRegionOf, a as readHostHeartbeat, an as parseQueueAnswer, at as classifyUpstreamError, b as readDeviceSettings, bn as clearAtRestKeyCache, bt as parseCreditMultiplier, c as WORKBUDDY_CONNECT_VERSION, cn as NATIVE_MODALITY_BY_MODEL_ID, ct as deriveStableConversationId, dt as isBodyOversizeRefusal, en as isBareBase64Image, ft as isContextTooLongBody, g as createTuringSdk, gn as isDeviceId, gt as isToolSchemaRejectBody, h as createDeviceSdkPort, ht as isFirstMessageGateBody, i as processStartTimeMs, in as sniffImageMime, it as channelGateMemberOf, j as ENCRYPTED_CREDENTIAL_CODE, jn as readAtRestKey, jt as selectPromoBadge, k as fallbackModelsFor, kn as macosNestedAppBundles, kt as attachBusyLevels, l as createFileRosterSeenStore, ln as imageDefaultFor, m as piAiRuntimeInfo, mt as isCredentialRejectedError, n as clearHostHeartbeat, nn as parseImageDataUrl, nt as WorkBuddyCredentialRejectedError, o as workbuddyHostHeartbeatPath, on as queueNoticeText, ot as conversationIdFromSessionId, p as resolveCnGateway, pt as isConversationIdGateBody, q as workbuddyAccountId, qt as IMAGE_TAG_TEXT_TO_IMAGE, r as isHeartbeatProcessAlive, rn as pickMediaModel, rt as WorkBuddyUpstreamClient, s as writeHostHeartbeat, sn as pruneTempDir, st as declaredTools, t as WORKBUDDY_HOST_HEARTBEAT_FILENAME, tn as isWatermarkFreeImageModel, tt as WORKBUDDY_FALLBACK_SYSTEM_PROMPT, un as nativeModalityOf, ut as forceNeutralHead, v as describeDerivedDevices, vt as modelIdOfBody, w as FALLBACK_WORKBUDDY_MODELS, wn as findWorkbuddyAppExecutable, wt as prepareChatBody, x as saveDeviceProfile, xn as deriveAtRestKey, xt as parseReasoning, y as isDeviceMode, yn as WORKBUDDY_APP_EXECUTABLE_ENV, yt as openingEvidenceOfBody, z as defaultDesktopAuthDirs, zt as VIDEO_TAG_IMAGE_TO_VIDEO } from "./host-heartbeat-Ceo9o82d.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";
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.24.15",
5
+ "version": "5.24.16",
6
6
  "author": "dingminhua",
7
7
  "copyright": "Copyright (c) 2026 LaoDing",
8
8
  "license": "MIT",