dsh-connect-trae 2.7.1 → 2.7.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,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.7.2 (2026-10-05)
4
+
5
+ > **补完 #23 的确定性**:2.7.1 修好了 Max 档随机丢失,但**在 max 相等时仍保留了先到者**,于是 **dev 基础窗口**还会随货架顺序漂移。报告人 JiewiW 在 Windows 复测时发现并给了修法(`glm-5.2`:`chat_v3` 的 dev=116000 与 `solo_agent_remote` 的 dev=200000 都带 max=1000000,谁先到就取谁)。
6
+
7
+ ### Bug Fixes
8
+
9
+ - **择强规则改为逐级比较到底(字典序),不再在「max 相等」处停止**(`preferStrongerRow`):
10
+ - ① 带 Max 的行优先 → ② Max 更大者胜 → ③ **max 相等(或都无 Max)时比 dev,取更宽者** → ④ 完全相等才保留先到者。
11
+ - **为什么第 ③ 步不是多余的**:2.7.1 在 max 相等时直接保留先到者,导致**未配置预算的模型**其默认窗口仍是一次抛硬币——本机 CN 30 个模型里有 9 个如此(`glm-5.2` 就是其一)。配了 1M 预算时最终仍恒为 1M,所以用户不易察觉;但「默认窗口」决定 DSH 的显示与压缩基准,正是 #23 要消除的同一类缺陷。
12
+ - **实测(本机 CN,连刷 8 次)**:修复后**整目录指纹 8/8 完全一致**(含每个模型的 dev 与 max,30 个模型);`glm-5.2` 稳定为 `dev=200000 / max=1000000`。修复前同一份数据的两种货架顺序分别得到 dev=116000 与 dev=200000。
13
+
14
+ ### Tests
15
+
16
+ - **全仓 417 → 419**:新增 2 例(max 相等时按 dev 取宽、且与顺序无关;带 Max 的行仍胜过 dev 更宽的无 Max 行)。同时把原有的「6 种货架排列」用例的**数据改成「max 相等但 dev 不等」**——正是报告人指出的形态,断言全部排列落到同一个 dev;这条用例此前只覆盖了 dev 相同的情形,所以没能发现该问题。
17
+ - **变异验证 2 次全部被抓**:把规则退回「max 相等即保留先到者」→ 2 例失败;去掉「带 Max 优先于 dev 更宽」→ 2 例失败。
18
+
19
+ ### 致谢
20
+
21
+ 报告人 **JiewiW** 在 Windows 上完成了三项预期验证,并额外指出 `preferStrongerRow` 在 max 相等时的残留不确定性,连修法(「在 max 相等时继续落到 dev 取更宽」)一并给出——本版照此实现。
22
+
3
23
  ## 2.7.1 (2026-10-05)
4
24
 
5
25
  > **修复「Max 档随机丢失、同一模型上下文窗口在多次刷新间漂移」**([#23](https://github.com/dingminhua/dsh-connect-trae/issues/23),报告人 JiewiW)。
package/lib/index.js CHANGED
@@ -2856,25 +2856,32 @@ const TRAE_REMOTE_DIRECTORY_FUNCTIONS = {
2856
2856
  *
2857
2857
  * The gateway groups its directory by function and reports a model's capacity
2858
2858
  * per group, with the group order varying between calls. Keeping the strongest
2859
- * row makes the published window deterministic:
2859
+ * row makes the published window deterministic. The comparison is
2860
+ * LEXICOGRAPHIC and must be applied all the way down, or ordering leaks back in
2861
+ * at the next field:
2860
2862
  *
2861
2863
  * 1. a row with a Max tier beats one without (`maxContextWindow` is only set
2862
2864
  * when the group reported `max_mode: true` with a positive max);
2863
2865
  * 2. two Max rows: the larger max wins;
2864
- * 3. no Max on either side: the wider dev window wins.
2866
+ * 3. max equal (or absent on both): the WIDER dev window wins;
2867
+ * 4. both equal: keep the incumbent, so the model order stays the gateway's.
2865
2868
  *
2866
- * Ties keep the incumbent, so the first row seen still decides equal cases and
2867
- * the model order stays the one the gateway sent.
2869
+ * Step 3 is not an afterthought. With equal `max` the first version of this
2870
+ * function stopped and kept the incumbent, which left the dev window decided by
2871
+ * arrival order — measured 2026-10-05: `glm-5.2` came back as `dev=116000` when
2872
+ * `chat_v3` won and `dev=200000` when `solo_agent_remote` did, both with
2873
+ * `max=1000000` (9 of 30 CN models behaved that way, reported by JiewiW on
2874
+ * Windows). A budgeted model still resolved to 1M either way, but the DEFAULT
2875
+ * window of an unbudgeted model — what DSH shows and compresses against — was
2876
+ * a coin flip, which is the same defect this function exists to remove.
2868
2877
  */
2869
2878
  function preferStrongerRow(candidate, incumbent) {
2870
2879
  if (incumbent === void 0) return candidate;
2871
2880
  const candidateMax = candidate.maxContextWindow;
2872
2881
  const incumbentMax = incumbent.maxContextWindow;
2873
- if (candidateMax !== void 0 || incumbentMax !== void 0) {
2874
- if (incumbentMax === void 0) return candidate;
2875
- if (candidateMax === void 0) return incumbent;
2876
- return candidateMax > incumbentMax ? candidate : incumbent;
2877
- }
2882
+ if (candidateMax !== void 0 && incumbentMax === void 0) return candidate;
2883
+ if (candidateMax === void 0 && incumbentMax !== void 0) return incumbent;
2884
+ if (candidateMax !== void 0 && incumbentMax !== void 0 && candidateMax !== incumbentMax) return candidateMax > incumbentMax ? candidate : incumbent;
2878
2885
  return (candidate.contextWindow ?? 0) > (incumbent.contextWindow ?? 0) ? candidate : incumbent;
2879
2886
  }
2880
2887
  /**
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "dsh-connect-trae",
3
3
  "displayName": "DSH Connect Trae",
4
4
  "description": "把本机登录的 Trae 模型接入 DeepSeek Harness:国内版与国际版双供应商并行,提供用量/积分概览与每日签到领取。",
5
- "version": "2.7.1",
5
+ "version": "2.7.2",
6
6
  "author": "dingminhua",
7
7
  "copyright": "Copyright (c) 2026 LaoDing",
8
8
  "license": "MIT",