dsh-connect-trae 2.0.2 → 2.0.4

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,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.4 (2026-09-16)
4
+
5
+ ### Fixes
6
+
7
+ - **修复「某个区域没有实时模型目录时,该区域的 provider 整个加载失败」**(issue #8:未安装国际版的用户看到 `Trae Global 加载失败:adapter returned invalid context metadata for provider "trae-global" model "gemini-3.1-pro"`):
8
+ - **根因**:两个区域的内置兜底目录里,每个模型都缺少 `contextWindow`。DSH 要求它必须是正整数(`INVALID_MODEL_CONTEXT`),而 `dsh-llm-pi-ai` 的回退链是 `entry.contextWindow → 已安装 catalog → request.defaultContextWindow`——本插件既没传 `defaultContextWindow`,兜底模型也不在已安装 catalog 里,三条全空,于是校验失败。
9
+ - **失败粒度是 provider 级**:不是丢单个模型,而是**整个区域不可用**。触发场景包括未安装该区客户端、未登录、目录拉取失败(该端点有已知的间歇性 401)、以及首次安装尚未刷新过目录。因此这不是「没装国际版拖累国内版」,而是**两个区域各自独立地有这个缺陷**。
10
+ - **修复**:(1) 兜底目录补上实测 `contextWindow`——国际版依据 2026-09-15 实测目录(`gemini-3.1-pro`/`gemini-3-flash-solo`/`minimax-m3`/`minimax-m2.7`/`kimi-k2.5` = 200000,`gpt-5.4`/`gpt-5.2` = 272000),国内版依据 SOLO 通道实测(200000);(2) adapter 传 `defaultContextWindow` 作为最终防线,将来任何来源的条目不慎缺字段时降级为「一个保守尺寸的模型」而非「整区不可用」。
11
+ - 新增不变量测试:**两个区域的兜底行都必须带正整数 `contextWindow`**。原先有一条测试断言「兜底条目没有 `contextWindow`」——它固化的正是这个 bug,已改正。
12
+
13
+ ## 2.0.3 (2026-09-16)
14
+
15
+ ### Fixes
16
+
17
+ - **修复内置兜底目录里存在「不可调用模型」的问题**——插件在首次实时刷新落地前会先提供一份内置兜底模型列表,且这份列表**故意不经过「死 config_name」过滤**(过滤依赖实时目录,会把兜底本身误删)。因此它的 id 必须在源头就是正确的 `llm_utils_chat` config_name,而它此前不是:
18
+ - `auto` 不是任何 Trae 的 config_name,选中后会以 `4001` 失败——已移除。该条目会在「尚未刷新目录」时(未登录 / 网络抖动 / 卡片未刷新)被真正提供给用户,因此并非理论问题。
19
+ - `DeepSeek-V4-Flash` / `DeepSeek-V4-Pro` 缺少 `-Official` 后缀,不是真实 wire id——已更正为 `DeepSeek-V4-Flash-Official` / `DeepSeek-V4-Pro-Official`(依据 2026-09-15 实测目录,`docs/DS41_CALLABILITY.md`)。
20
+ - 新增回归测试锁定三条不变量:兜底 id 必须是真实 config_name(显式禁 `auto` 与裸名)、两个区域的兜底都不得出现 TraeCode 独占模型、`mergeTraeModelSources` 确实丢弃无 wire 匹配的目录行。
21
+
22
+ ### Docs
23
+
24
+ - **README 新增「模型覆盖范围」一节(中英同步)**——说明插件提供的是 Trae SOLO 通道的模型,而 TraeCode 通道的 4 个模型(`deepseek-v4.1-flash`、`glm-5.3-flash`、`kimi-k2.8-preview`、`qwen3.8-flash`)尚未开放到 SOLO 通道,因此暂不支持,**需要等官方开放到 SOLO 后才能支持**;并区分了 `GLM-5.3`(支持)与 `glm-5.3-flash`(不支持)。
25
+ - 新增 TraeCode / agent-task 通道与 TraeCLI 的可行性取证(`docs/CODEC_CHANNEL_FEASIBILITY.md`、`docs/TRAECLI_FEASIBILITY.md`、`docs/TRAE_ECOSYSTEM_RESEARCH.md`):四条路径逐一实测均不通,且阻塞原因互相独立(协议 / 配额 / 同机 / 登录态与 agent 归属),据此确认这批模型属上游授权边界而非插件可绕过的技术问题。
26
+
3
27
  ## 2.0.2 (2026-09-15)
4
28
 
5
29
  ### Fixes
package/README.en.md CHANGED
@@ -10,6 +10,7 @@
10
10
  <a href="README.md">中文</a> ·
11
11
  <a href="#install">Install</a> ·
12
12
  <a href="#how-it-works">How it works</a> ·
13
+ <a href="#model-coverage">Model coverage</a> ·
13
14
  <a href="CHANGELOG.md">Changelog</a> ·
14
15
  <a href="https://github.com/dingminhua/dsh-connect-trae/issues">Issues</a>
15
16
  </p>
@@ -56,6 +57,25 @@ Usage overview hits the read-only `https://api.trae.cn/trae/api/v2/pay/*` and `/
56
57
 
57
58
  > See `docs/IMPLEMENTATION_PLAN.md`, `docs/SOLO_ROUTE_DECISION.md`, `docs/USAGE_API_RESEARCH.md`.
58
59
 
60
+ ## Model coverage
61
+
62
+ This plugin serves models from Trae's **SOLO channel** (`DeepSeek-V4-Flash-Official`, `DeepSeek-V4-Pro-Official`, `GLM-5.3`, `GLM-5.2`, `Kimi-K3`, `MiniMax-M3`, `Qwen3.8-Max`, `Doubao-Seed-*`, …), for both the domestic and international sides.
63
+
64
+ The following four models currently come from the **TraeCode (Trae IDE) channel** and have **not** been opened up to the SOLO channel, so this plugin does **not** support them yet:
65
+
66
+ | Model |
67
+ | --- |
68
+ | `deepseek-v4.1-flash` |
69
+ | `glm-5.3-flash` |
70
+ | `kimi-k2.8-preview` |
71
+ | `qwen3.8-flash` |
72
+
73
+ These four are reachable only inside the Trae IDE client; there is no callable channel for them on the plugin side. **They can only be supported once Trae officially opens them up to the SOLO channel.**
74
+
75
+ > Note the distinction: **`GLM-5.3` is supported** (it goes through the SOLO channel), but **`glm-5.3-flash` is not** — they are different models.
76
+
77
+ To use these four models today, use the **Trae IDE itself**.
78
+
59
79
  ## Install
60
80
 
61
81
  ```sh
package/README.md CHANGED
@@ -10,6 +10,7 @@
10
10
  <a href="README.en.md">English</a> ·
11
11
  <a href="#安装">安装</a> ·
12
12
  <a href="#工作原理">工作原理</a> ·
13
+ <a href="#模型覆盖范围">模型覆盖范围</a> ·
13
14
  <a href="CHANGELOG.md">更新日志</a> ·
14
15
  <a href="https://github.com/dingminhua/dsh-connect-trae/issues">问题反馈</a>
15
16
  </p>
@@ -56,6 +57,25 @@ DSH PiAiAdapter(每个 provider 一套)
56
57
 
57
58
  > 详见 `docs/IMPLEMENTATION_PLAN.md`、`docs/SOLO_ROUTE_DECISION.md`、`docs/USAGE_API_RESEARCH.md`。
58
59
 
60
+ ## 模型覆盖范围
61
+
62
+ 插件提供的是 Trae **SOLO 通道**的模型(`DeepSeek-V4-Flash-Official`、`DeepSeek-V4-Pro-Official`、`GLM-5.3`、`GLM-5.2`、`Kimi-K3`、`MiniMax-M3`、`Qwen3.8-Max`、`Doubao-Seed-*` 等),国内版与国际版均走这条通道。
63
+
64
+ 以下 4 个模型目前来自 **TraeCode(Trae IDE)通道**,尚未开放到 SOLO 通道,因此本插件**暂不支持**:
65
+
66
+ | 模型 |
67
+ | --- |
68
+ | `deepseek-v4.1-flash` |
69
+ | `glm-5.3-flash` |
70
+ | `kimi-k2.8-preview` |
71
+ | `qwen3.8-flash` |
72
+
73
+ 这 4 个模型只在 Trae IDE 客户端内可用,插件侧没有可调用的通道。**需要等官方把它们开放到 SOLO 通道后,插件才能支持。**
74
+
75
+ > 注意区分:**`GLM-5.3` 是支持的**(走 SOLO 通道),但 **`glm-5.3-flash` 不支持**——两者是不同的模型。
76
+
77
+ 如果你现在就要用这 4 个模型,请直接在 **Trae IDE 本体**中使用。
78
+
59
79
  ## 安装
60
80
 
61
81
  推荐使用 DSH 插件命令安装 npm 已发布版本:
package/lib/index.d.ts CHANGED
@@ -112,7 +112,29 @@ interface TraeModelInfo {
112
112
  /** The directory function this model must be called through (see {@link TraeWireModel.function}). */
113
113
  wireFunction?: string;
114
114
  }
115
- /** Bootstrap catalog: identity only where current Trae metadata has not been fetched yet. */
115
+ /**
116
+ * Bootstrap catalog: identity only where current Trae metadata has not been
117
+ * fetched yet.
118
+ *
119
+ * Every id here must be a `config_name` that `llm_utils_chat` actually accepts,
120
+ * because this list is served verbatim before the first live refresh lands and
121
+ * it is NOT filtered against the wire map (the wire map can only confirm ids it
122
+ * happens to know, so filtering would delete the safety net exactly when it is
123
+ * needed — see `fallbackModels` in index.ts). The current CN roster was
124
+ * verified against the live remote directory on 2026-09-15
125
+ * (docs/DS41_CALLABILITY.md): `DeepSeek-V4-Flash-Official` and
126
+ * `DeepSeek-V4-Pro-Official` carry the `-Official` suffix, and there is no
127
+ * `auto` config_name — an `auto` row was previously served here and would have
128
+ * failed on selection.
129
+ *
130
+ * Every row MUST also carry a positive-integer `contextWindow`. DSH rejects an
131
+ * adapter whose model has no usable context (`INVALID_MODEL_CONTEXT`), and that
132
+ * failure is per-provider — one bad row takes the whole region offline. These
133
+ * rows are exactly the ones served when no live directory is available (no
134
+ * install for that region, signed out, or a failed refresh), which is precisely
135
+ * when the fallback is doing its job, so a missing field here is fatal rather
136
+ * than cosmetic. See docs/ISSUE8_DIAGNOSIS.md.
137
+ */
116
138
  declare const FALLBACK_TRAE_MODELS: readonly TraeModelInfo[];
117
139
  /**
118
140
  * Bootstrap catalog for the international (ai) region, captured from the
@@ -121,6 +143,10 @@ declare const FALLBACK_TRAE_MODELS: readonly TraeModelInfo[];
121
143
  * has no Gemini/GPT/MiniMax entries), so an international account must never
122
144
  * be seeded with the CN list. Like the CN fallback it is replaced by the live
123
145
  * refresh; image input stays the user's explicit opt-in (`imageModelIds`).
146
+ *
147
+ * The `contextWindow` values are the measured ones from that same capture
148
+ * (`docs/INTL_SG_EVIDENCE.md` §3) and are required for the same reason as the
149
+ * CN fallback: without them the whole `trae-global` provider fails to load.
124
150
  */
125
151
  declare const FALLBACK_TRAE_MODELS_AI: readonly TraeModelInfo[];
126
152
  /**
@@ -174,8 +200,8 @@ interface TraeWireModel {
174
200
  *
175
201
  * Joining is two-tier, in priority order:
176
202
  * 1. `wire.id` (the `config_name`) equals the remote id — the model's display
177
- * id is already its wire id (the common case: glm-5.2, DeepSeek-V4-Flash,
178
- * kimi-k3, …).
203
+ * id is already its wire id (the common case: glm-5.2,
204
+ * DeepSeek-V4-Flash-Official, kimi-k3, …).
179
205
  * 2. `wire.name` (the `display_name`) equals the remote display name — for
180
206
  * models whose display id differs from the wire id across Trae versions.
181
207
  * When the matched wire `config_name` differs from the remote id it is recorded
package/lib/index.js CHANGED
@@ -15,27 +15,49 @@ import { Readable } from "node:stream";
15
15
  import { execFile } from "node:child_process";
16
16
  import { promisify } from "node:util";
17
17
  //#region src/catalog.ts
18
- /** Bootstrap catalog: identity only where current Trae metadata has not been fetched yet. */
18
+ /**
19
+ * Bootstrap catalog: identity only where current Trae metadata has not been
20
+ * fetched yet.
21
+ *
22
+ * Every id here must be a `config_name` that `llm_utils_chat` actually accepts,
23
+ * because this list is served verbatim before the first live refresh lands and
24
+ * it is NOT filtered against the wire map (the wire map can only confirm ids it
25
+ * happens to know, so filtering would delete the safety net exactly when it is
26
+ * needed — see `fallbackModels` in index.ts). The current CN roster was
27
+ * verified against the live remote directory on 2026-09-15
28
+ * (docs/DS41_CALLABILITY.md): `DeepSeek-V4-Flash-Official` and
29
+ * `DeepSeek-V4-Pro-Official` carry the `-Official` suffix, and there is no
30
+ * `auto` config_name — an `auto` row was previously served here and would have
31
+ * failed on selection.
32
+ *
33
+ * Every row MUST also carry a positive-integer `contextWindow`. DSH rejects an
34
+ * adapter whose model has no usable context (`INVALID_MODEL_CONTEXT`), and that
35
+ * failure is per-provider — one bad row takes the whole region offline. These
36
+ * rows are exactly the ones served when no live directory is available (no
37
+ * install for that region, signed out, or a failed refresh), which is precisely
38
+ * when the fallback is doing its job, so a missing field here is fatal rather
39
+ * than cosmetic. See docs/ISSUE8_DIAGNOSIS.md.
40
+ */
19
41
  const FALLBACK_TRAE_MODELS = [
20
42
  {
21
- id: "auto",
22
- name: "Auto"
43
+ id: "DeepSeek-V4-Flash-Official",
44
+ name: "DeepSeek-V4-Flash",
45
+ contextWindow: 2e5
23
46
  },
24
47
  {
25
- id: "DeepSeek-V4-Flash",
26
- name: "DeepSeek-V4-Flash"
27
- },
28
- {
29
- id: "DeepSeek-V4-Pro",
30
- name: "DeepSeek-V4-Pro"
48
+ id: "DeepSeek-V4-Pro-Official",
49
+ name: "DeepSeek-V4-Pro",
50
+ contextWindow: 2e5
31
51
  },
32
52
  {
33
53
  id: "glm-5.2",
34
- name: "GLM-5.2"
54
+ name: "GLM-5.2",
55
+ contextWindow: 2e5
35
56
  },
36
57
  {
37
58
  id: "kimi-k2.6",
38
- name: "Kimi-K2.6"
59
+ name: "Kimi-K2.6",
60
+ contextWindow: 2e5
39
61
  }
40
62
  ];
41
63
  /**
@@ -45,35 +67,46 @@ const FALLBACK_TRAE_MODELS = [
45
67
  * has no Gemini/GPT/MiniMax entries), so an international account must never
46
68
  * be seeded with the CN list. Like the CN fallback it is replaced by the live
47
69
  * refresh; image input stays the user's explicit opt-in (`imageModelIds`).
70
+ *
71
+ * The `contextWindow` values are the measured ones from that same capture
72
+ * (`docs/INTL_SG_EVIDENCE.md` §3) and are required for the same reason as the
73
+ * CN fallback: without them the whole `trae-global` provider fails to load.
48
74
  */
49
75
  const FALLBACK_TRAE_MODELS_AI = [
50
76
  {
51
77
  id: "gemini-3.1-pro",
52
- name: "Gemini-3.1-Pro-Preview"
78
+ name: "Gemini-3.1-Pro-Preview",
79
+ contextWindow: 2e5
53
80
  },
54
81
  {
55
82
  id: "gemini-3-flash-solo",
56
- name: "Gemini-3-Flash-Preview"
83
+ name: "Gemini-3-Flash-Preview",
84
+ contextWindow: 2e5
57
85
  },
58
86
  {
59
87
  id: "minimax-m3",
60
- name: "MiniMax-M3"
88
+ name: "MiniMax-M3",
89
+ contextWindow: 2e5
61
90
  },
62
91
  {
63
92
  id: "minimax-m2.7",
64
- name: "MiniMax-M2.7"
93
+ name: "MiniMax-M2.7",
94
+ contextWindow: 2e5
65
95
  },
66
96
  {
67
97
  id: "kimi-k2.5",
68
- name: "Kimi-K2.5"
98
+ name: "Kimi-K2.5",
99
+ contextWindow: 2e5
69
100
  },
70
101
  {
71
102
  id: "gpt-5.4",
72
- name: "GPT-5.4"
103
+ name: "GPT-5.4",
104
+ contextWindow: 272e3
73
105
  },
74
106
  {
75
107
  id: "gpt-5.2",
76
- name: "GPT-5.2"
108
+ name: "GPT-5.2",
109
+ contextWindow: 272e3
77
110
  }
78
111
  ];
79
112
  /**
@@ -126,8 +159,8 @@ function displayKey(name) {
126
159
  *
127
160
  * Joining is two-tier, in priority order:
128
161
  * 1. `wire.id` (the `config_name`) equals the remote id — the model's display
129
- * id is already its wire id (the common case: glm-5.2, DeepSeek-V4-Flash,
130
- * kimi-k3, …).
162
+ * id is already its wire id (the common case: glm-5.2,
163
+ * DeepSeek-V4-Flash-Official, kimi-k3, …).
131
164
  * 2. `wire.name` (the `display_name`) equals the remote display name — for
132
165
  * models whose display id differs from the wire id across Trae versions.
133
166
  * When the matched wire `config_name` differs from the remote id it is recorded
@@ -282,6 +315,13 @@ const REQUEST_IMAGE_BUDGETS = {
282
315
  requestImagePixelBudget: 4194304,
283
316
  requestImageMaxBytes: 1048576
284
317
  };
318
+ /**
319
+ * Conservative context capacity used only when a served model row carries no
320
+ * window of its own. Every fallback row and every live Trae row is expected to
321
+ * state its real window; this is the backstop that keeps one unsized row from
322
+ * failing the entire provider route (`INVALID_MODEL_CONTEXT`).
323
+ */
324
+ const FALLBACK_CONTEXT_WINDOW = 2e5;
285
325
  function toPiModel(info, baseUrl, providerId) {
286
326
  return {
287
327
  id: info.id,
@@ -341,6 +381,7 @@ function createTraeAdapter(options) {
341
381
  retryPolicy: resolveRetryPolicy(void 0, "dsh-connect-trae retryPolicy"),
342
382
  configuredMaxTokens: /* @__PURE__ */ new Map(),
343
383
  modelErrors: /* @__PURE__ */ new Map(),
384
+ defaultContextWindow: FALLBACK_CONTEXT_WINDOW,
344
385
  ...REQUEST_IMAGE_BUDGETS,
345
386
  piProvider: provider
346
387
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "dsh-connect-trae",
3
3
  "displayName": "DSH Connect Trae",
4
4
  "description": "Connect locally signed-in Trae models to DeepSeek Harness, plus a read-only usage/credits summary.",
5
- "version": "2.0.2",
5
+ "version": "2.0.4",
6
6
  "author": "dingminhua",
7
7
  "copyright": "Copyright (c) 2026 LaoDing",
8
8
  "license": "MIT",