dsh-connect-workbuddy 5.24.1 → 5.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,60 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.24.2 (2026-11-14)
4
+
5
+ > 版本号是 **patch**:修一处「某些模型完全不可用」的请求字节问题,无新增配置项、无接口变化。
6
+ > 来自 issue #253。
7
+
8
+ ### 修复:`deepseek-v4.1-flash` 等 8 个模型在 agent 模式下必定 400
9
+
10
+ 报告者的现象是:选 `deepseek-v4.1-flash` 发**一句普通消息**(不提工具)就必报
11
+ `400 / code 11129 / 工具的参数结构不符合当前模型要求`,换账号、重连、重装都不变;同账号换
12
+ `hy3`、`deepseek-v4-pro` 之外的模型又正常。
13
+
14
+ 根因不在插件丢没丢 `tools`,也不在 `$ref`——**这两条都是排查过程中的错误结论,已各自被实测推翻**:
15
+
16
+ - 「插件从不处理 tools」不成立:`normalizeToolChoice` 早就会在 `tool_choice: none` 时删掉 `tools`;
17
+ - 「上游不认 `$ref`」也不成立:宿主 `docs/tool-catalog.md` 里 `stagehand_extract` 那份**递归
18
+ `$defs`** schema 实测 200,宿主的**全部 75 个工具**一起发也 200。
19
+
20
+ 真正被拒的是 DSH 宿主(zod 生成)与手写 MCP schema 会带出的 **draft-4 遗留写法**,逐条实测如下:
21
+
22
+ | 写法 | 上游怎么答 | 改写后 |
23
+ | --- | --- | --- |
24
+ | `items` 写成**元组数组**(draft-4)`items: [{type:'string'}]` | 11129(DeepSeek)/ 11133(GLM、Kimi、MiMo) | `prefixItems: […]` + `items: {}` |
25
+ | `exclusiveMinimum` / `exclusiveMaximum` 写成**布尔**(draft-4) | 11129 | 由同级的 `minimum` / `maximum` 推出的**数值**形式 |
26
+ | `required` 写成**字符串** | 11129 | 单元素数组 |
27
+ | `required` 数组含**重复项** | 11129 | 去重 |
28
+ | **外部** `$ref`(`https://…`、`//host/…`) | 11129 | 删掉该引用 |
29
+
30
+ `prepareChatBody` 现在会在发出去之前递归改写这五种写法。用同一份请求体逐模型验证(2026-11-14,
31
+ CN 网关,本构建自己的凭据):
32
+
33
+ | 模型 | 修复前 | 修复后 |
34
+ | --- | --- | --- |
35
+ | `deepseek-v4.1-flash`、`deepseek-v4-pro` | ❌ 11129 | ✅ 200 |
36
+ | `glm-5.3`、`glm-5.3-flash`、`kimi-k3.1-pro`、`kimi-k3-1`、`kimi-k2.8-preview`、`mimo-v2.6-pro` | ❌ 11133 | ✅ 200 |
37
+ | `hy3`、`hy4free`、`hy4std`、`hy3-x`、`glm-5.2`、`space-bunny`、`minimax-m3.1-flash`、`step-5-preview` | ✅ 200(原本就通过) | ✅ 200(未被误伤) |
38
+
39
+ ### 刻意**没有**改的四处,理由都在代码注释里
40
+
41
+ - **内部 `$ref`(`#/…`)保留**:实测被接受,展开递归 schema 是一处大得多、且没有任何实测证据支撑的改动。
42
+ - **布尔 `exclusiveMinimum` 没有同级界时直接删掉,不硬造一个 `0`**:硬造等于**发明一个调用方从未写过的约束**,
43
+ 而上游会照收——一个语义错误的 schema 比一个明确失败的请求更糟。
44
+ - **11129 不单独成类**:它继续落在 `client`(该类本来就不换号、不重试)。改类别会动到重试与换账号行为,
45
+ 证据不足以支撑那么大的主张;这次只改**建议文案**。
46
+ - **探针不加工具**:探针结果会直接让账号出池,往里塞工具 schema 会让「某个工具定义有问题」被记成
47
+ 「这个账号坏了」。
48
+
49
+ ### 说明:报错现在会指向工具定义
50
+
51
+ 原来 11129 的回复照抄上游的 `displayTips`——「工具的参数结构不符合当前模型要求,被服务端拒绝。请新建任务,
52
+ 或换个模型。」这两条建议都**不会**让请求变好(换模型只是绕开,新建任务什么也没改),报告者因此在
53
+ 换账号、重登、重装里耗了一天。现在这一族会被单独识别,回复改成:点名是**工具定义**被拒、列出插件已经
54
+ 改写过的四种写法、并给出最快验证路径(关掉提供该工具的浏览器自动化 / MCP server / 第三方插件后重发)。
55
+
56
+ 修复本身不依赖这条文案:即使某个未知写法仍然被拒,至少不会再让人去换账号。
57
+
3
58
  ## 5.24.1 (2026-11-14)
4
59
 
5
60
  > 版本号是 **patch**:修一处宿主状态回执的清理归属,不动配置键、路由语义与请求字节。
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-DeelaI9b.js";
2
+ import { $ as DEFAULT_WIRE_PROFILE, An as resolveDshHome, F as WorkBuddyCredentialStore, J as workbuddyOwnAuthPath, N as WORKBUDDY_AUTH_FILE_ENV, P as WORKBUDDY_VAULT_DIRNAME, R as defaultDesktopAuthCandidates, T as FALLBACK_WORKBUDDY_MODELS_GLOBAL, W as legacyWorkbuddyOwnAuthPath, X as APP_VERSION, Y as workbuddyVaultDir, a as readHostHeartbeat, b as readDeviceSettings, c as WORKBUDDY_CONNECT_VERSION, cn as readDeviceTokenFile, d as rosterSeenPath, dn as deriveDeviceId, f as WORKBUDDY_CN_BASE_ENV, g as createTuringSdk, hn as WORKBUDDY_APP_EXECUTABLE_ENV, kn as hostPeersInfo, ln as ensureDeviceSalt, m as piAiRuntimeInfo, mn as protectCredentialDirectory, nt as WorkBuddyUpstreamClient, o as workbuddyHostHeartbeatPath, ot as describeRequestHeaderNames, p as resolveCnGateway, pn as inspectCredentialDirectory, r as isHeartbeatProcessAlive, sn as WORKBUDDY_DEVICE_TOKEN_FILE_ENV, u as describeRosterSeenPayload, un as readDeviceSalt, w as FALLBACK_WORKBUDDY_MODELS, xn as findWorkbuddyAppExecutableWithSource, z as defaultDesktopAuthDirs } from "./host-heartbeat-Q85k2yEL.js";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { dirname, join } from "node:path";
5
5
  import { realpathSync } from "node:fs";
@@ -3904,6 +3904,56 @@ const CONTEXT_TOO_LONG_CODE = /"code"\s*:\s*11115(?!\d)|code\s+11115(?!\d)/u;
3904
3904
  function isContextTooLongBody(body) {
3905
3905
  return CONTEXT_TOO_LONG_CODE.test(body);
3906
3906
  }
3907
+ /** The tool-schema refusal (issue #253). */
3908
+ const TOOL_SCHEMA_REJECT_CODE = 11129;
3909
+ /**
3910
+ * Whether this body is the upstream refusing a TOOL DEFINITION (issue #253).
3911
+ *
3912
+ * `11129` arrives as `{"code":11129,"msg":"invalid function call parameters"}`
3913
+ * with `extError.code: "invalid_function_parameters"`. Its `param` field is an
3914
+ * EMPTY STRING — the upstream knows the definition is wrong but never says
3915
+ * which tool or which keyword — so the plugin is the only party that can turn
3916
+ * this into an actionable sentence.
3917
+ *
3918
+ * Read by CODE rather than by the wording, for the reason every other code
3919
+ * reader in this module does it: the same `msg` is short and generic enough that
3920
+ * a request id or a prompt could contain the phrase, while `11129` has so far
3921
+ * only ever meant this. Recognising it changes ADVICE ONLY — the kind stays
3922
+ * `client`, which already means "refused on parameters, no account can help" and
3923
+ * already skips failover. Giving it a kind of its own would move it out of that
3924
+ * bucket and silently change retry behaviour, which is a much larger claim than
3925
+ * the evidence supports.
3926
+ */
3927
+ function isToolSchemaRejectBody(body) {
3928
+ return statesBusinessCode(body, TOOL_SCHEMA_REJECT_CODE);
3929
+ }
3930
+ /**
3931
+ * Which schema keywords the rewrite in {@link normalizeToolSchemas} can fix,
3932
+ * for the reply's advice (issue #253).
3933
+ *
3934
+ * Deliberately a FIXED LIST rather than a parse of the offending body: the
3935
+ * upstream never names the keyword, and the plugin has already rewritten every
3936
+ * one of these on the way out. If a request still gets `11129` after that
3937
+ * rewrite, the cause is a keyword this build does not know — so the advice has to
3938
+ * say "something else", not repeat the four shapes it already handled.
3939
+ */
3940
+ const TOOL_SCHEMA_REWRITTEN_KEYWORDS = "元组式 `items`、布尔 `exclusiveMinimum`/`exclusiveMaximum`、`required` 非数组或含重复项、外部 `$ref`";
3941
+ /**
3942
+ * One actionable sentence for a `11129` refusal, naming what was already fixed
3943
+ * and what the user can still do.
3944
+ *
3945
+ * WHY THE PLUGIN MUST SPEAK HERE. The upstream's own advice is "请新建任务,或换
3946
+ * 个模型" — and issue #253's reporter spent a day on account swaps, re-logins and
3947
+ * a reinstall because nothing in that sentence points at a TOOL DEFINITION. The
3948
+ * plugin rewrites the four known shapes automatically, so a surviving `11129`
3949
+ * means either (a) the offending definition is one of a further shape this build
3950
+ * does not know, or (b) a tool supplied by a third-party bundle/MCP server is
3951
+ * sending something the gateway will not take. Both are actionable, and neither
3952
+ * is "switch accounts".
3953
+ */
3954
+ function toolSchemaRejectAdvice() {
3955
+ return `这次是工具定义被拒,与账号、积分、额度、网络都无关,换账号或重试都不会改变结果。插件已自动改写过这些上游不接受的写法:${TOOL_SCHEMA_REWRITTEN_KEYWORDS};仍被拒说明还有别的写法。最快的验证是关掉提供该工具的能力(例如浏览器自动化、某个 MCP server 或第三方插件)后重发同一句话——能通过就说明是那个工具的定义有问题,把它的参数结构贴到 issue 里即可定位`;
3956
+ }
3907
3957
  /**
3908
3958
  * An English clause the HOST's overflow detector recognises, for issue #101.
3909
3959
  *
@@ -5596,6 +5646,7 @@ function prepareChatBody(source, options) {
5596
5646
  rewriteChannelFingerprintPhrasesInBody(obj);
5597
5647
  neutralizeChannelFingerprints(obj);
5598
5648
  normalizeToolChoice(obj);
5649
+ normalizeToolSchemas(obj);
5599
5650
  dropRefusedReasoning(obj);
5600
5651
  return JSON.stringify(obj);
5601
5652
  }
@@ -5744,6 +5795,217 @@ function normalizeToolChoice(obj) {
5744
5795
  delete obj["tool_choice"];
5745
5796
  }
5746
5797
  /**
5798
+ * Rewrite JSON Schema spellings the CN gateway REFUSES inside `tools[].function.parameters`
5799
+ * (issue #253, business code 11129 / 11133).
5800
+ *
5801
+ * WHY THIS EXISTS. The host builds tool schemas with zod and ships whatever the
5802
+ * library emits; `prepareChatBody` forwarded `tools` untouched. Four shapes
5803
+ * measured on 2026-11-14 as refused by the upstream, each with the same body
5804
+ * answering 200 once rewritten:
5805
+ *
5806
+ * | shape | refused as | rewritten to |
5807
+ * | --- | --- | --- |
5808
+ * | `items` as a TUPLE ARRAY (draft-4 tuple form) | 11129 (DeepSeek) / 11133 (GLM, Kimi, MiMo) | `prefixItems: [...]` + `items: {}` |
5809
+ * | `exclusiveMinimum` / `exclusiveMaximum` as a BOOLEAN (draft-4) | 11129 | the numeric form, derived from the sibling `minimum` / `maximum` |
5810
+ * | `required` as a STRING instead of an array | 11129 | one-element array |
5811
+ * | `required` containing DUPLICATES | 11129 | de-duplicated |
5812
+ * | an EXTERNAL `$ref` (`https://…`, `//host/…`) | 11129 | the reference object removed |
5813
+ *
5814
+ * WHAT IS DELIBERATELY NOT TOUCHED.
5815
+ *
5816
+ * - **Internal `$ref` (`#/…`) stays.** Measured: the recursive
5817
+ * `$defs`/`additionalProperties` schema of `stagehand_extract` — the shape
5818
+ * issue #253 originally blamed — answers 200 on every model tested, as does
5819
+ * the host's whole 75-tool catalog sent at once. Only the EXTERNAL form is
5820
+ * refused. Rewriting internal references would be a large, riskier change
5821
+ * bought with no measured evidence.
5822
+ * - **The boolean `exclusiveMinimum` rewrite is only made when it is safe.** A
5823
+ * draft-4 boolean means "minimum is exclusive"; with no sibling bound there is
5824
+ * nothing to derive, so the key is dropped rather than guessed. Silently
5825
+ * turning `exclusiveMinimum: true` into `exclusiveMinimum: 0` would INVENT a
5826
+ * constraint — a wrong schema that the upstream accepts is worse than a
5827
+ * request that fails loudly.
5828
+ * - **Nothing outside `tools` / `functions` is examined.** `tool_choice`,
5829
+ * messages, and every other body byte keep their existing treatment; a
5830
+ * session-title body or a plain conversation cannot be changed by this.
5831
+ *
5832
+ * Order matters only in that this runs AFTER {@link normalizeToolChoice}: a
5833
+ * suppressed `tools` (from `tool_choice: 'none'`) is already gone, and
5834
+ * normalizing an array that is about to be deleted would be wasted work.
5835
+ */
5836
+ function normalizeToolSchemas(obj) {
5837
+ normalizeToolArray(obj["tools"]);
5838
+ normalizeToolArray(obj["functions"]);
5839
+ }
5840
+ /** Walk the entries of a `tools` / `functions` array, rewriting each schema. */
5841
+ function normalizeToolArray(value) {
5842
+ if (!Array.isArray(value)) return;
5843
+ for (const entry of value) {
5844
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry)) continue;
5845
+ const tool = entry;
5846
+ const fn = tool["function"];
5847
+ if (typeof fn === "object" && fn !== null && !Array.isArray(fn)) normalizeSchemaNode(fn["parameters"]);
5848
+ if (tool["function"] === void 0) normalizeSchemaNode(tool["parameters"]);
5849
+ }
5850
+ }
5851
+ /**
5852
+ * Recursively rewrite ONE schema node in place.
5853
+ *
5854
+ * Recursion is required, not decorative: every one of the measured refusals can
5855
+ * appear at any depth (a tuple `items` inside `properties.a.items`, a bad
5856
+ * `required` inside a nested object). The walk is depth-limited because the
5857
+ * input is arbitrary JSON from a third party — a malformed or pathological
5858
+ * document must not be able to hang a request.
5859
+ */
5860
+ function normalizeSchemaNode(node, depth = 0) {
5861
+ if (typeof node !== "object" || node === null || Array.isArray(node)) return;
5862
+ if (depth > MAX_SCHEMA_DEPTH) return;
5863
+ const schema = node;
5864
+ normalizeItems(schema);
5865
+ normalizeExclusiveBound(schema, "exclusiveMinimum", "minimum");
5866
+ normalizeExclusiveBound(schema, "exclusiveMaximum", "maximum");
5867
+ normalizeRequired(schema);
5868
+ dropExternalRef(schema);
5869
+ for (const key of SCHEMA_CHILD_MAPS) {
5870
+ const child = schema[key];
5871
+ if (typeof child !== "object" || child === null || Array.isArray(child)) continue;
5872
+ for (const nested of Object.values(child)) normalizeSchemaNode(nested, depth + 1);
5873
+ }
5874
+ for (const key of SCHEMA_CHILD_LISTS) {
5875
+ const list = schema[key];
5876
+ if (!Array.isArray(list)) continue;
5877
+ for (const nested of list) normalizeSchemaNode(nested, depth + 1);
5878
+ }
5879
+ for (const key of SCHEMA_CHILD_SINGLE) normalizeSchemaNode(schema[key], depth + 1);
5880
+ }
5881
+ /**
5882
+ * Bound the recursion.
5883
+ *
5884
+ * The host's own schemas nest a handful of levels. 64 is far past anything real
5885
+ * and still terminates on a hostile document; the value is a guard against a
5886
+ * hang, not a format rule.
5887
+ */
5888
+ const MAX_SCHEMA_DEPTH = 64;
5889
+ /** Keywords whose value is a MAP of schemas (each value walked). */
5890
+ const SCHEMA_CHILD_MAPS = [
5891
+ "properties",
5892
+ "patternProperties",
5893
+ "dependentSchemas",
5894
+ "$defs",
5895
+ "definitions"
5896
+ ];
5897
+ /** Keywords whose value is a LIST of schemas (each entry walked). */
5898
+ const SCHEMA_CHILD_LISTS = [
5899
+ "allOf",
5900
+ "anyOf",
5901
+ "oneOf",
5902
+ "prefixItems"
5903
+ ];
5904
+ /** Keywords whose value is a SINGLE schema (walked directly). */
5905
+ const SCHEMA_CHILD_SINGLE = [
5906
+ "items",
5907
+ "additionalProperties",
5908
+ "not",
5909
+ "contains",
5910
+ "if",
5911
+ "then",
5912
+ "else",
5913
+ "propertyNames"
5914
+ ];
5915
+ /**
5916
+ * Convert draft-4's tuple `items` into the 2020-12 spelling.
5917
+ *
5918
+ * A tuple `items` is a LIST; the modern spec splits it into `prefixItems` (the
5919
+ * per-position schemas, same order) plus `items` (the schema for everything
5920
+ * past the end). Emitting `items: {}` for the tail is the faithful reading of a
5921
+ * draft-4 tuple: draft-4 said nothing about additional items, so "anything" is
5922
+ * correct — inventing `false` would FORBID extra elements, which the original
5923
+ * never said.
5924
+ *
5925
+ * Measured: `prefixItems` + `items: {}` answers 200 on `deepseek-v4.1-flash`,
5926
+ * `deepseek-v4-pro`, `glm-5.3`, `kimi-k3.1-pro` and `mimo-v2.6-pro` — the five
5927
+ * strictest models in the catalog — and on every model that accepted the tuple
5928
+ * form already.
5929
+ */
5930
+ function normalizeItems(schema) {
5931
+ const items = schema["items"];
5932
+ if (!Array.isArray(items)) return;
5933
+ if (schema["prefixItems"] === void 0) schema["prefixItems"] = items;
5934
+ schema["items"] = {};
5935
+ }
5936
+ /**
5937
+ * Rewrite a draft-4 BOOLEAN exclusive bound into the numeric form.
5938
+ *
5939
+ * Draft-4: `{minimum: 0, exclusiveMinimum: true}` means "greater than 0".
5940
+ * 2020-12: `{exclusiveMinimum: 0}` means the same. The value is therefore
5941
+ * DERIVED from the sibling bound — and when that sibling is absent or not a
5942
+ * finite number there is nothing to derive, so the key is dropped.
5943
+ *
5944
+ * Dropping is the safe direction: it WEAKENS a constraint the upstream already
5945
+ * could not read, and every request that fails today fails on the shape, not on
5946
+ * the constraint. Inventing `0` would attach a bound the caller never wrote.
5947
+ */
5948
+ function normalizeExclusiveBound(schema, exclusiveKey, boundKey) {
5949
+ if (schema[exclusiveKey] !== true) {
5950
+ if (schema[exclusiveKey] === false) delete schema[exclusiveKey];
5951
+ return;
5952
+ }
5953
+ const bound = schema[boundKey];
5954
+ if (typeof bound === "number" && Number.isFinite(bound)) {
5955
+ schema[exclusiveKey] = bound;
5956
+ delete schema[boundKey];
5957
+ return;
5958
+ }
5959
+ delete schema[exclusiveKey];
5960
+ }
5961
+ /**
5962
+ * Force `required` into the de-duplicated string array the upstream accepts.
5963
+ *
5964
+ * A non-array `required` is not JSON Schema at all, so there is no "faithful"
5965
+ * conversion for it: a string is read as one property name, and anything else
5966
+ * (a number, `null`) carries no names and is dropped. Duplicates are removed
5967
+ * because the upstream refuses them (measured) and they never meant anything:
5968
+ * `required` is a set.
5969
+ */
5970
+ function normalizeRequired(schema) {
5971
+ const required = schema["required"];
5972
+ if (required === void 0) return;
5973
+ if (typeof required === "string") {
5974
+ schema["required"] = required === "" ? [] : [required];
5975
+ return;
5976
+ }
5977
+ if (!Array.isArray(required)) {
5978
+ delete schema["required"];
5979
+ return;
5980
+ }
5981
+ const names = [];
5982
+ for (const entry of required) {
5983
+ if (typeof entry !== "string" || names.includes(entry)) continue;
5984
+ names.push(entry);
5985
+ }
5986
+ if (names.length === required.length) return;
5987
+ schema["required"] = names;
5988
+ }
5989
+ /**
5990
+ * Remove an EXTERNAL `$ref`, which the upstream refuses, while leaving internal
5991
+ * ones alone.
5992
+ *
5993
+ * `#/…` is a reference into the same document and is accepted (measured on the
5994
+ * recursive `$defs` shape of `stagehand_extract`, and on the host's whole
5995
+ * catalog). Anything with a URI part is not resolvable by the upstream at all,
5996
+ * so the pointer is deleted in place: the object degrades to "any value", which
5997
+ * accepts more than the original said rather than rejecting a valid call.
5998
+ *
5999
+ * A sibling `description` / `title` / `default` is kept — deleting the whole
6000
+ * object would throw away author documentation along with the reference.
6001
+ */
6002
+ function dropExternalRef(schema) {
6003
+ const ref = schema["$ref"];
6004
+ if (typeof ref !== "string" || ref === "") return;
6005
+ if (ref.startsWith("#")) return;
6006
+ delete schema["$ref"];
6007
+ }
6008
+ /**
5747
6009
  * What a PREPARED request body declares, as the input to DSML recovery.
5748
6010
  *
5749
6011
  * This exists so the recovery path can answer the one question its gates turn
@@ -10602,7 +10864,7 @@ function describeRosterSeenPayload(raw) {
10602
10864
  //#endregion
10603
10865
  //#region src/version.ts
10604
10866
  /** The npm package version this build was produced from. */
10605
- const WORKBUDDY_CONNECT_VERSION = "5.24.1";
10867
+ const WORKBUDDY_CONNECT_VERSION = "5.24.2";
10606
10868
  //#endregion
10607
10869
  //#region src/host-heartbeat.ts
10608
10870
  /**
@@ -10836,4 +11098,4 @@ async function clearHostHeartbeat(owner) {
10836
11098
  if (current === owner.contents) await rm(owner.path, { force: true });
10837
11099
  }
10838
11100
  //#endregion
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 };
11101
+ export { DEFAULT_WIRE_PROFILE as $, pickMediaModel as $t, withoutRouters as A, resolveDshHome as An, lastRefusalFor as At, defaultDesktopAuthPath as B, resolveVideoParams as Bt, setDeviceMode as C, isWorkbuddyBundle as Cn, rewriteSessionTitleModel as Ct, applyContextBudgets as D, readAtRestKey as Dn, selectPromoBadge as Dt, WorkBuddyCatalog as E, openEncryptedField as En, promoBadgeTone as Et, WorkBuddyCredentialStore as F, VIDEO_TAG_IMAGE_TO_VIDEO as Ft, parseWorkBuddyAuth as G, WorkBuddyImageError as Gt, isEncryptedCredentialError as H, IMAGE_TAG_IMAGE_TO_IMAGE as Ht, WorkBuddyEncryptedCredentialError as I, VIDEO_TAG_TEXT_TO_VIDEO as It, workbuddyOwnAuthPath as J, imageModelChoices as Jt, preferredAccountName as K, imageDataUrl as Kt, authFileName as L, WorkBuddyVideoError as Lt, WORKBUDDY_AUTH_FILENAME as M, writeFileAtomic as Mn, offRefused as Mt, WORKBUDDY_AUTH_FILE_ENV as N, recordRefusal as Nt, deriveCatalog as O, workbuddyAppExecutableCandidates as On, REFUSES_OFF_MODEL_IDS as Ot, WORKBUDDY_VAULT_DIRNAME as P, withEffectiveOff as Pt, CREDENTIAL_REJECTED_CODE as Q, parseImageDataUrl as Qt, defaultDesktopAuthCandidates as R, parseSupportedSecondsRange as Rt, saveDeviceSdkSettings as S, isEncryptedFieldWrapper as Sn, requestEvidenceOf as St, FALLBACK_WORKBUDDY_MODELS_GLOBAL as T, macosNestedAppBundles as Tn, attachBusyLevels as Tt, isVaultAccountId as U, IMAGE_TAG_TEXT_TO_IMAGE as Ut, hasEncryptedCredentialFields as V, IMAGE_SIZE_LIMITS_WIDE as Vt, legacyWorkbuddyOwnAuthPath as W, MAX_INPUT_IMAGE_BYTES as Wt, APP_VERSION as X, isBareBase64Image as Xt, workbuddyVaultDir as Y, imageSizeLimitsOf as Yt, CONTEXT_OVERFLOW_MARKER as Z, isWatermarkFreeImageModel as Zt, createDeviceProfileLookup as _, deriveAtRestKey as _n, parseReasoning as _t, readHostHeartbeat as a, imageDefaultFor as an, declaredTools as at, readDeviceSettings as b, findWorkbuddyAppExecutable as bn, prepareChatBody as bt, WORKBUDDY_CONNECT_VERSION as c, readDeviceTokenFile as cn, isContextTooLongBody as ct, rosterSeenPath as d, deriveDeviceId as dn, isFirstMessageGateBody as dt, sniffImageMime as en, WORKBUDDY_FALLBACK_SYSTEM_PROMPT as et, WORKBUDDY_CN_BASE_ENV as f, isDeviceId as fn, isToolSchemaRejectBody as ft, createTuringSdk as g, clearAtRestKeyCache as gn, parseCreditMultiplier as gt, createDeviceSdkPort as h, WORKBUDDY_APP_EXECUTABLE_ENV as hn, openingEvidenceOfBody as ht, processStartTimeMs as i, NATIVE_MODALITY_BY_MODEL_ID as in, classifyUpstreamError as it, ENCRYPTED_CREDENTIAL_CODE as j, withFileLock as jn, offDefaultFor as jt, fallbackModelsFor as k, hostPeersInfo as kn, defaultOffModelIds as kt, createFileRosterSeenStore as l, ensureDeviceSalt as ln, isConversationIdGateBody as lt, piAiRuntimeInfo as m, protectCredentialDirectory as mn, modelIdOfBody as mt, clearHostHeartbeat as n, queueNoticeText as nn, WorkBuddyUpstreamClient as nt, workbuddyHostHeartbeatPath as o, nativeModalityOf as on, describeRequestHeaderNames as ot, resolveCnGateway as p, inspectCredentialDirectory as pn, knownRegionOf as pt, workbuddyAccountId as q, imageMimeForPath as qt, isHeartbeatProcessAlive as r, pruneTempDir as rn, channelGateMemberOf as rt, writeHostHeartbeat as s, WORKBUDDY_DEVICE_TOKEN_FILE_ENV as sn, forceNeutralHead as st, WORKBUDDY_HOST_HEARTBEAT_FILENAME as t, parseQueueAnswer as tn, WorkBuddyCredentialRejectedError as tt, describeRosterSeenPayload as u, readDeviceSalt as un, isCredentialRejectedError as ut, describeDerivedDevices as v, deriveAtRestKeyId as vn, parseUpstreamModel as vt, FALLBACK_WORKBUDDY_MODELS as w, macosBundleExecutable as wn, toolSchemaRejectAdvice as wt, saveDeviceProfile as x, findWorkbuddyAppExecutableWithSource as xn, regionOf as xt, isDeviceMode as y, fetchAtRestKeyPayload as yn, perturbChannelFingerprints as yt, defaultDesktopAuthDirs as z, pickVideoModel as zt };
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-DeelaI9b.js";
1
+ import { $t as pickMediaModel, A as withoutRouters, An as resolveDshHome, At as lastRefusalFor, B as defaultDesktopAuthPath, Bt as resolveVideoParams, C as setDeviceMode, Cn as isWorkbuddyBundle, Ct as rewriteSessionTitleModel, D as applyContextBudgets, Dn as readAtRestKey, Dt as selectPromoBadge, E as WorkBuddyCatalog, En as openEncryptedField, Et as promoBadgeTone, F as WorkBuddyCredentialStore, Ft as VIDEO_TAG_IMAGE_TO_VIDEO, G as parseWorkBuddyAuth, Gt as WorkBuddyImageError, H as isEncryptedCredentialError, Ht as IMAGE_TAG_IMAGE_TO_IMAGE, I as WorkBuddyEncryptedCredentialError, It as VIDEO_TAG_TEXT_TO_VIDEO, J as workbuddyOwnAuthPath, Jt as imageModelChoices, K as preferredAccountName, Kt as imageDataUrl, L as authFileName, Lt as WorkBuddyVideoError, M as WORKBUDDY_AUTH_FILENAME, Mn as writeFileAtomic, Mt as offRefused, N as WORKBUDDY_AUTH_FILE_ENV, Nt as recordRefusal, O as deriveCatalog, On as workbuddyAppExecutableCandidates, Ot as REFUSES_OFF_MODEL_IDS, Pt as withEffectiveOff, Q as CREDENTIAL_REJECTED_CODE, Qt as parseImageDataUrl, R as defaultDesktopAuthCandidates, Rt as parseSupportedSecondsRange, S as saveDeviceSdkSettings, Sn as isEncryptedFieldWrapper, St as requestEvidenceOf, T as FALLBACK_WORKBUDDY_MODELS_GLOBAL, Tn as macosNestedAppBundles, Tt as attachBusyLevels, U as isVaultAccountId, Ut as IMAGE_TAG_TEXT_TO_IMAGE, V as hasEncryptedCredentialFields, Vt as IMAGE_SIZE_LIMITS_WIDE, W as legacyWorkbuddyOwnAuthPath, Wt as MAX_INPUT_IMAGE_BYTES, X as APP_VERSION, Xt as isBareBase64Image, Yt as imageSizeLimitsOf, Z as CONTEXT_OVERFLOW_MARKER, Zt as isWatermarkFreeImageModel, _ as createDeviceProfileLookup, _n as deriveAtRestKey, _t as parseReasoning, a as readHostHeartbeat, an as imageDefaultFor, at as declaredTools, b as readDeviceSettings, bn as findWorkbuddyAppExecutable, bt as prepareChatBody, c as WORKBUDDY_CONNECT_VERSION, ct as isContextTooLongBody, dt as isFirstMessageGateBody, en as sniffImageMime, et as WORKBUDDY_FALLBACK_SYSTEM_PROMPT, fn as isDeviceId, ft as isToolSchemaRejectBody, g as createTuringSdk, gn as clearAtRestKeyCache, gt as parseCreditMultiplier, h as createDeviceSdkPort, hn as WORKBUDDY_APP_EXECUTABLE_ENV, ht as openingEvidenceOfBody, i as processStartTimeMs, in as NATIVE_MODALITY_BY_MODEL_ID, it as classifyUpstreamError, j as ENCRYPTED_CREDENTIAL_CODE, jn as withFileLock, jt as offDefaultFor, k as fallbackModelsFor, kt as defaultOffModelIds, l as createFileRosterSeenStore, lt as isConversationIdGateBody, m as piAiRuntimeInfo, mt as modelIdOfBody, n as clearHostHeartbeat, nn as queueNoticeText, nt as WorkBuddyUpstreamClient, o as workbuddyHostHeartbeatPath, on as nativeModalityOf, p as resolveCnGateway, pt as knownRegionOf, q as workbuddyAccountId, qt as imageMimeForPath, r as isHeartbeatProcessAlive, rn as pruneTempDir, rt as channelGateMemberOf, s as writeHostHeartbeat, st as forceNeutralHead, t as WORKBUDDY_HOST_HEARTBEAT_FILENAME, tn as parseQueueAnswer, tt as WorkBuddyCredentialRejectedError, ut as isCredentialRejectedError, v as describeDerivedDevices, vn as deriveAtRestKeyId, vt as parseUpstreamModel, w as FALLBACK_WORKBUDDY_MODELS, wn as macosBundleExecutable, wt as toolSchemaRejectAdvice, x as saveDeviceProfile, xt as regionOf, y as isDeviceMode, yn as fetchAtRestKeyPayload, yt as perturbChannelFingerprints, z as defaultDesktopAuthDirs, zt as pickVideoModel } from "./host-heartbeat-Q85k2yEL.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";
@@ -6154,8 +6154,9 @@ function createWorkBuddyShim(options) {
6154
6154
  if (detail?.requestId !== void 0) meta.push(`requestId ${detail.requestId}`);
6155
6155
  const stamp = meta.length === 0 ? "" : `(${meta.join(",")})`;
6156
6156
  const refusedTier = reasoningTierRefusal(result);
6157
- const receipt = refusedTier ?? detail?.tips ?? detail?.displayMsg ?? clippedUpstreamText(result.message, 400);
6158
- const advice = refusedTier !== void 0 ? "这不是账号或网络问题:该模型实测拒绝「off」推理档位,请到模型卡片里取消该行的「可关闭思考」勾选后重试" : result.kind === "client" ? "该请求被上游按参数拒绝:与网络、账号、额度都无关,换账号也不会改变结果,请按上面的提示调整后重试" : shortfall === void 0 ? "" : "建议换一个模型继续,或稍后等待该账号的额度恢复";
6157
+ const toolSchemaRefused = result.kind === "client" && isToolSchemaRejectBody(result.message);
6158
+ const receipt = refusedTier ?? (toolSchemaRefused ? toolSchemaRejectAdvice() : void 0) ?? detail?.tips ?? detail?.displayMsg ?? clippedUpstreamText(result.message, 400);
6159
+ const advice = refusedTier !== void 0 ? "这不是账号或网络问题:该模型实测拒绝「off」推理档位,请到模型卡片里取消该行的「可关闭思考」勾选后重试" : toolSchemaRefused ? "按上面列出的写法检查工具定义;换模型只是绕开,不会修好它" : result.kind === "client" ? "该请求被上游按参数拒绝:与网络、账号、额度都无关,换账号也不会改变结果,请按上面的提示调整后重试" : shortfall === void 0 ? "" : "建议换一个模型继续,或稍后等待该账号的额度恢复";
6159
6160
  const body = `${isContextTooLongBody(result.message) ? `${CONTEXT_OVERFLOW_MARKER}。` : ""}${advice === "" ? receipt : `${receipt.replace(/[。.]$/u, "")}。${advice}`}`;
6160
6161
  writeOpenAIError(res, KIND_STATUS[result.kind], result.kind, `workbuddy 上游失败:${failoverReasonText(result)}(http ${result.status})${note}${why}${stamp}。${body}`, hostErrorCode(result.kind));
6161
6162
  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.24.1",
5
+ "version": "5.24.2",
6
6
  "author": "dingminhua",
7
7
  "copyright": "Copyright (c) 2026 LaoDing",
8
8
  "license": "MIT",