dsh-connect-trae 4.4.0 → 4.4.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 +105 -0
- package/lib/index.d.ts +33 -2
- package/lib/index.js +196 -90
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,110 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.4.2 (2026-10-23)
|
|
4
|
+
|
|
5
|
+
> **带工具的对话在 deepseek-v4.1-flash 上整轮 400/4027 拒绝。这个版本在两个工具出口
|
|
6
|
+
> 把 draft-3 风格的 `required: true` 归一化为 draft-4。**
|
|
7
|
+
>
|
|
8
|
+
> 接 issue #48 的后续证据(issue #49):上游校验**分后端**。同一凭证、同一 SOLO 出口、
|
|
9
|
+
> 同一工具 schema,`glm-5.2`(智谱后端)放行属性内的 `required: true`,而
|
|
10
|
+
> `deepseek-v4.1-flash` 按 JSON Schema draft-4+ 严校验,直接回
|
|
11
|
+
> `4027 … tools.N.function.parameters/properties/X/required: invalid JSON Schema` ——
|
|
12
|
+
> 且 `tools.N` 是**按批校验**,一个不合格即全挂,所以「带工具必 400」。
|
|
13
|
+
> 之前 #48 判「上游已放行」是因为只在宽松的智谱后端上试过。
|
|
14
|
+
|
|
15
|
+
### 修复
|
|
16
|
+
|
|
17
|
+
- **工具 schema 出口统一归一化为 draft-4**(`fix(protocol)`,issue #49)。
|
|
18
|
+
DSH schemastery 生成的工具参数是 draft-3 风格 —— `required: true` 写在属性**内部**:
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{ "type": "object", "properties": { "tool": { "type": "string", "required": true } } }
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
JSON Schema draft-4 起已把 per-property boolean `required` 移除,改为父级字符串数组
|
|
25
|
+
`{ "required": ["tool"] }`。deepseek-v4.1-flash 这类严校验后端对前者直接判
|
|
26
|
+
`invalid JSON Schema`,整请求被拒。由于模型路由到哪个后端由上游决定、随 config 变化,
|
|
27
|
+
凡带工具的请求都必须是 draft-4 干净的,与探针上次试过后端无关。
|
|
28
|
+
- 新增 `normalizeTraeToolSchema` / `normalizeTraeToolSchemas`(`src/raw-chat.ts`):
|
|
29
|
+
递归把属性内 boolean `required` 提升到父级 `required` 数组(与既有数组去重合并)后
|
|
30
|
+
删除 boolean;覆盖 `items` / `anyOf` / `oneOf` / `allOf` 等任意嵌套。**幂等** ——
|
|
31
|
+
已是 draft-4 的 schema 原样返回(同一对象,零拷贝),不改变合法载荷。
|
|
32
|
+
- **两个工具出口都套上归一化**:`prepareSoloBody`(SOLO `llm_utils_chat` 主路径,
|
|
33
|
+
`parameters` 在 `JSON.stringify` 前归一化)与 `buildTraeRawChatDraft`(raw chat 路径,
|
|
34
|
+
`structuredClone` 后的 `tools` 归一化)。纯本地、不碰凭据、不改调用方入参。
|
|
35
|
+
- 归一化后的载荷形态与 issue #49 的 D3 对照实验(draft-4 提升后经
|
|
36
|
+
deepseek-v4.1-flash 后端 200 正常 SSE)一致。
|
|
37
|
+
|
|
38
|
+
### 测试补强
|
|
39
|
+
|
|
40
|
+
- **989 例测试全绿**(`pnpm run test`),新增 **7 例**:draft-3 提升、嵌套
|
|
41
|
+
`items`/`anyOf` 递归、与既有 `required` 数组合并、draft-4 幂等(字节不变)、
|
|
42
|
+
`properties` 之外的 boolean `required` 与 `required: false` 不误伤、调用方 `tools`
|
|
43
|
+
不被原地修改、SOLO 信封 wire 载荷为 draft-4。
|
|
44
|
+
|
|
45
|
+
### 已知边界
|
|
46
|
+
|
|
47
|
+
- 归一化只处理 draft-3 boolean `required` 这一种已实测命中的非法形态;上游若日后
|
|
48
|
+
收紧到拒绝更多 draft-3 残留(如属性内其他 boolean 关键字),需另行取证后处理。
|
|
49
|
+
- 本次修复未经本机真实凭据实测(修复者无 Trae 凭据);上游行为依据 issue #49 报告人
|
|
50
|
+
的三步对照实验(D1 无工具 200 / D2 draft-3 4027 / D3 draft-4 200)。本地验证为
|
|
51
|
+
单测 + 构造载荷核验。
|
|
52
|
+
|
|
53
|
+
## 4.4.1 (2026-10-22)
|
|
54
|
+
|
|
55
|
+
> **4.4.0 的修复自己藏掉了 `kimi-k2-0905`。这个版本把它捞回来,并补上 4.4.0 缺的实测。**
|
|
56
|
+
>
|
|
57
|
+
> 一条自我纠正。4.4.0 发布后作者对提升的模型做了**真实调用**实测,实测把 4.4.0 的
|
|
58
|
+
> 一个缺陷暴露出来:为了防止重名孪生行,4.4.0 加了「显示名已被占用就跳过」的规则 ——
|
|
59
|
+
> 这条规则把 `kimi-k2-0905` 也丢掉了,而它**是另一个真模型**(168K 上下文,实测可调用)。
|
|
60
|
+
> 于是报告人 `yuantao313` 抱怨的那一类「带日期的快照 ID」在 `kimi-k2-0905` 上**依然拿不到** ——
|
|
61
|
+
> 成因从「合并只遍历骨架」换成了「去重按名字判断」,**症状没变**。
|
|
62
|
+
> 详见 [`docs/ISSUE46_DIAGNOSIS.md`](https://github.com/dingminhua/dsh-connect-trae/blob/main/docs/ISSUE46_DIAGNOSIS.md) 第 9 节。
|
|
63
|
+
|
|
64
|
+
### 修复
|
|
65
|
+
|
|
66
|
+
- **重名判断改为「能力测试」而非「名字测试」**(`fix(catalog)`,issue #46)。
|
|
67
|
+
`claimedNames` 记录每个显示名下**最大的**上下文窗口;一个重名行只有在**严格更大于**
|
|
68
|
+
该最大值时才提升,并被追加 id 以便区分(两行都渲染成 `Kimi-K2-0905` 的 picker 是在撒谎)。
|
|
69
|
+
- **实测依据**(2026-10-22,CN 凭据):`kimi-k2` 是 28000 而 `kimi-k2-0905` 是 168000,
|
|
70
|
+
名字相同、能力差 6 倍,且 `kimi-k2-0905` 在 `solo_coder` 与 `chat_v3` 下**都能调用**。
|
|
71
|
+
- 反面对照:`glm-4.7` 与 `glm-4.7-auto` 元数据**完全相同**(100000/16000/`chat_v3`),
|
|
72
|
+
是真重复,仍然只留一行;`glm-5.2_advisor_default`(168000)比 skeleton 的 `glm-5.2`
|
|
73
|
+
(200000)**更小**,是内部改道,仍被排除。
|
|
74
|
+
- **实测结果**:目录 **42 → 46 行**,提升行 7 → 11。新增
|
|
75
|
+
`kimi-k2-0905`、`minimax-m2-auto`、`minimax-m2.1-auto`、`glm-4.6-auto`
|
|
76
|
+
(全部为 168K / `solo_coder`,显示名形如 `MiniMax-M2 (minimax-m2-auto)`)。
|
|
77
|
+
- 比较基准是**最强的占用者**,因此与 wire 名单的顺序无关(有回归测试钉住)。
|
|
78
|
+
|
|
79
|
+
### 测试补强
|
|
80
|
+
|
|
81
|
+
- **982 例测试全绿**(`pnpm run test`),新增 **4 例**:重名但更强者被提升且名字带 id、
|
|
82
|
+
重名且相等/更弱者仍被排除、`-auto` 孪生按能力取舍、比较基准取最强占用者。
|
|
83
|
+
|
|
84
|
+
### 实测记录(4.4.0 遗留边界现已关闭)
|
|
85
|
+
|
|
86
|
+
`4.4.0` 的 CHANGELOG 曾记「新提升的 7 个模型未逐个实测可调用性」。现已实测,**全部通过**
|
|
87
|
+
(真调用,走插件自己的 bridge,每个一次最小 `ping`):
|
|
88
|
+
|
|
89
|
+
| 模型 | function | 结果 |
|
|
90
|
+
| --- | --- | --- |
|
|
91
|
+
| `seed-code-pro-0430` / `glm-5-turbo` | `solo_work_remote` | AVAILABLE |
|
|
92
|
+
| `glm-4.7` / `glm-4.6` / `minimax-m2` / `minimax-m2.1` / `qwen3-coder` | `chat_v3` | AVAILABLE |
|
|
93
|
+
| `kimi-k2` | `inline_chat` · `chat_v3` · `solo_work_remote` | 三个 function 全部 AVAILABLE |
|
|
94
|
+
| 4.4.1 新增的 4 行 | `solo_coder` | 全部 AVAILABLE |
|
|
95
|
+
|
|
96
|
+
合计 21 次真实调用,消耗 **约 11 额度**(约 0.43/次)。
|
|
97
|
+
因此 `4.4.0` 中「`kimi-k2` 归属 `inline_chat`、可调用性尚未取证」这条边界**一并关闭**。
|
|
98
|
+
|
|
99
|
+
### 已知边界
|
|
100
|
+
|
|
101
|
+
- fix A 多问 function 带出的 `doubao_1_8`(`Doubao-Seed-1.8`)**实测 4001 拒绝**:它没有
|
|
102
|
+
`wireFunction`、也没有上下文与输出元数据,是条残缺的骨架行。按 issue #19「全部呈现 +
|
|
103
|
+
如实报错」的策略这是合规行为(选中会得到明确的上游原文错误),但它确实是一条新增的、
|
|
104
|
+
调不通的行 —— 记在这里,不假装它可用。
|
|
105
|
+
- 取证仍在维护者本机的 CN 账号上完成。报告人账号上是否真有
|
|
106
|
+
`deepseek-v4.1-flash-1017` 这一行,仍需他升级后确认(本机 roster 上无此行)。
|
|
107
|
+
|
|
3
108
|
## 4.4.0 (2026-10-22)
|
|
4
109
|
|
|
5
110
|
> **模型表不再系统性排除「带日期的快照配置」;账号池开关不再被模型目录的保存冲掉。**
|
package/lib/index.d.ts
CHANGED
|
@@ -385,7 +385,9 @@ interface TraeWireModel {
|
|
|
385
385
|
* name has nothing to show in the picker.
|
|
386
386
|
*
|
|
387
387
|
* The display-name-collision test lives in the merge itself (it needs the
|
|
388
|
-
* Remote rows to compare against); see {@link mergeTraeModelSources}.
|
|
388
|
+
* Remote rows to compare against); see {@link mergeTraeModelSources}. It is a
|
|
389
|
+
* CAPABILITY test there, not a name test: a collision only suppresses a row
|
|
390
|
+
* when the equally-named row is at least as capable.
|
|
389
391
|
*
|
|
390
392
|
* The survivors are exactly the models a user would recognise and the IDE
|
|
391
393
|
* offers but the plugin hid: `kimi-k2` / `kimi-k2-0905`, `glm-4.6`,
|
|
@@ -2463,6 +2465,35 @@ declare function traeEndpoint(baseUrl: string, path: string): string;
|
|
|
2463
2465
|
//#region src/raw-chat.d.ts
|
|
2464
2466
|
declare const TRAE_RAW_CHAT_V2_PATH = "/api/ide/v2/llm_raw_chat";
|
|
2465
2467
|
declare const TRAE_RAW_CHAT_V1_PATH = "/api/ide/v1/llm_raw_chat";
|
|
2468
|
+
/**
|
|
2469
|
+
* Normalise a tool `parameters` schema from JSON Schema draft-3 style to
|
|
2470
|
+
* draft-4 style (issue #49).
|
|
2471
|
+
*
|
|
2472
|
+
* Draft-3 declared a required property by putting a boolean `required: true`
|
|
2473
|
+
* INSIDE the property schema:
|
|
2474
|
+
*
|
|
2475
|
+
* { "type": "object", "properties": { "tool": { "type": "string", "required": true } } }
|
|
2476
|
+
*
|
|
2477
|
+
* Draft-4 removed the per-property boolean and uses a parent-level string
|
|
2478
|
+
* array instead: `{ "required": ["tool"] }`. The Trae backends disagree on how
|
|
2479
|
+
* strictly they check this: the Zhipu backend (glm-5.2) tolerates draft-3
|
|
2480
|
+
* `required: true`, but the DeepSeek backend (deepseek-v4.1-flash) rejects the
|
|
2481
|
+
* whole request with `4027 … tools.N.function.parameters/properties/X/required:
|
|
2482
|
+
* invalid JSON Schema` whenever ANY tool carries the boolean form — and
|
|
2483
|
+
* `tools.N` are validated as a batch, so one bad schema fails the entire turn
|
|
2484
|
+
* (issue #49, after #48). Since a model's backend is chosen by the upstream
|
|
2485
|
+
* router and can change per config, every tool-carrying request must be
|
|
2486
|
+
* draft-4 clean regardless of which backend the probe last saw.
|
|
2487
|
+
*
|
|
2488
|
+
* The rewrite is local, idempotent, and recursive: it lifts each boolean
|
|
2489
|
+
* `required` up to the enclosing schema's `required` array (merging with any
|
|
2490
|
+
* array already present), then drops the boolean. Non-object property entries
|
|
2491
|
+
* are left untouched — draft-4 forbids boolean schemas anyway, so no boolean
|
|
2492
|
+
* `required` can hide inside them.
|
|
2493
|
+
*/
|
|
2494
|
+
declare function normalizeTraeToolSchema(value: unknown): unknown;
|
|
2495
|
+
/** Issue #49: apply `normalizeTraeToolSchema` to an OpenAI-style tool list. */
|
|
2496
|
+
declare function normalizeTraeToolSchemas<T>(tools: readonly T[]): T[];
|
|
2466
2497
|
type RawChatRole = 'assistant' | 'system' | 'tool' | 'user';
|
|
2467
2498
|
interface RawChatTextContent {
|
|
2468
2499
|
type: 'text';
|
|
@@ -3997,4 +4028,4 @@ declare function asVolatile<S>(schema: S): S;
|
|
|
3997
4028
|
declare const Config: z<Config>;
|
|
3998
4029
|
declare function apply(ctx: Context$1, config: Config): void;
|
|
3999
4030
|
//#endregion
|
|
4000
|
-
export { Config, FALLBACK_TRAE_MODELS, FALLBACK_TRAE_MODELS_AI, MAX_PROBE_INPUT_TOKENS, type PiAiGeneration, type PiAiRuntimeInfo, REGION_GATEWAYS, type RawChatDelta, type RawChatMessage, type RawChatTool, SseDecoder, type SseEvent, TRAE_ACCOUNT_STATUS_PATH, TRAE_AI_PROVIDER, TRAE_CHECKIN_PATH, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_ENTERPRISE_PROVIDER, TRAE_MODELS_TEST_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_PANELS, TRAE_PAY_BASE, TRAE_PROBE_TIMEOUT_MS, TRAE_PROVIDER, TRAE_PROVIDERS, TRAE_PROVIDER_DISPLAY_NAMES, TRAE_PROVIDER_IDS, TRAE_PROVIDER_ID_DISPLAY_NAMES, TRAE_PROVIDER_ROUTES, TRAE_RAW_CHAT_V1_PATH, TRAE_RAW_CHAT_V2_PATH, TRAE_REASONING_EFFORTS, TRAE_REGIONS, TRAE_REGION_PARAM, TRAE_SETTINGS_NS, TRAE_SOLO_CHAT_PATH, TRAE_SOLO_FUNCTION, TRAE_SOLO_MODELS_PATH, TRAE_SOLO_REMOTE_BASE, TRAE_STATE_DB_FILENAME, TRAE_STREAM_IDLE_TIMEOUT_MS, TRAE_USAGE_PATH, TRAE_VERSION_CODE_FALLBACK, type TraeActivityRule, type TraeAdapter, type TraeCachedModelConfig, TraeCatalog, type TraeChatResult, type TraeCheckinClaim, type TraeCheckinStatus, type TraeContextBudget, type TraeCredential, TraeCredentialStore, TraeDelegatingUpstreamClient, type TraeDiscoveredModel, type TraeDiscoveredReasoning, type TraeEdition, type TraeFailure, TraeFallbackUpstreamClient, type TraeFallbackUpstreamOptions, type TraeFusionRawChatEnvelope, TraeGatedUpstreamClient, type TraeGatedUpstreamOptions, type TraeIdentity, type TraeInputModality, type TraeModelDetailRequest, type TraeModelInfo, type TraeModelProbeVerdict, type TraeModelsTestResponse, type TraeObservedModelConfig, type TraePanel, type TraeProbeResult, type TraeProbeVerdict, type TraeProviderRoute, TraeRawCapabilityController, type TraeRawCapabilityControllerOptions, type TraeRawCapabilitySnapshot, TraeRawCapabilityState, type TraeRawChatBehaviorConfig, type TraeRawChatCapability, type TraeRawChatClientOptions, type TraeRawChatConfig, type TraeRawChatFailureReason, type TraeRawChatRuntimeConfig, TraeRawChatUpstreamClient, type TraeRawDiagnostic, type TraeRawDiagnosticState, type TraeRawGateway, type TraeRawGatewayOptions, type TraeRawResolverResult, type TraeReasoningCapability, type TraeReasoningEffort, type TraeRefreshDevice, type TraeRegion, type TraeRegionGateways, TraeRegionState, type TraeShim, TraeSoloBridge, type TraeSoloClientOptions, TraeSoloRemoteCatalogClient, type TraeSoloRemoteCatalogOptions, TraeSoloUpstreamClient, type TraeStorageCandidate, type TraeStreamEvent, type TraeUpstreamClient, TraeUsageClient, type TraeUsageOptions, type TraeUsagePack, type TraeUsageRouteOptions, type TraeUsageSnapshot, type TraeUsageSummary, type TraeUsageView, type TraeWebAccountState, type TraeWebActivity, type TraeWebCheckin, type TraeWebCheckinClaim, type TraeWebCredits, type TraeWebUsage, type TraeWireModel, type TraeWireTarget, UnconfiguredTraeUpstreamClient, adaptLegacyPiAiContext, adaptModernPiAiContext, apply, applyContextBudgets, applyImageSelection, applyReasoningEffort, asVolatile, bridgeTraeSoloStream, buildTraeAgentTaskBody, buildTraeCnHeaders, buildTraeFusionRawChatEnvelope, buildTraeModelDetailRequest, buildTraeRawChatDraft, buildTraeRawChatRuntimeConfig, classifyProbeError, classifyProbeResult, classifyTraeRawChatFailure, configuredAccountsOf, createTraeAdapter, createTraeRawGateway, createTraeShim, creditPosition, decidePiAiGeneration, decodeRawChatChunk, decodeTraeEvent, decryptTraeStorageValue, deriveCatalog, describeIdShape, describeNameShape, describeTraeFailure, discoveredCatalog, displayNameOfTraeProvider, fallbackModelsFor, generationOf, hashTraeRawChatArg, identityHeaders, inject, isEnterpriseAccount, isPromotableWireModel, legacyTraeOwnAuthPath, maskUserPath, mergeTraeModelSources, name, nextRegionCreditPosition, nextRegionEnabled, nextRegionSlots, normalizeTraeCredential, normalizeTraeVersionCode, panelOfKey, panelOfProvider, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeRawChatBehaviorConfig, parseTraeRemoteModel, parseTraeStorageDocument, piAiRuntimeInfo, pickTraeStorageIdentity, prepareSoloBody, probeBody, probeModelsSequentially, probeOneModel, probeTraeRawChatCapability, providerOfPanel, rawCapabilityDiagnostic, rawCapabilityFingerprint, readTraeCachedModel, readTraeCliIdentity, readTraeIdentity, refreshTraeCredential, regionCreditPositionOf, regionEnabled, regionEnabledOf, regionOfCredential, regionOfEdition, regionOfHost, regionOfPanel, regionOfTraeProvider, regionOfTraeStatusUrl, regionOfUserRegion, regionStateOf, registerTraeUsageRoute, resolveTraeIdentity, resolveTraeRawRuntime, routeOfTraeProvider, sanitizeCatalog, settingsNamespaceOf, traeEndpoint, traeInputModalities, traeModelDisplayName, traeOwnAuthPath, traeRawChatExtraInfo, traeStateDatabaseCandidates, traeStorageCandidates, traeWebUsage, traeWindowsAppNames, unwrapVolatile, unwrapVolatileDeep, wireTargetsOf, withContextAdaptation, withTraeRegion };
|
|
4031
|
+
export { Config, FALLBACK_TRAE_MODELS, FALLBACK_TRAE_MODELS_AI, MAX_PROBE_INPUT_TOKENS, type PiAiGeneration, type PiAiRuntimeInfo, REGION_GATEWAYS, type RawChatDelta, type RawChatMessage, type RawChatTool, SseDecoder, type SseEvent, TRAE_ACCOUNT_STATUS_PATH, TRAE_AI_PROVIDER, TRAE_CHECKIN_PATH, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_ENTERPRISE_PROVIDER, TRAE_MODELS_TEST_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_PANELS, TRAE_PAY_BASE, TRAE_PROBE_TIMEOUT_MS, TRAE_PROVIDER, TRAE_PROVIDERS, TRAE_PROVIDER_DISPLAY_NAMES, TRAE_PROVIDER_IDS, TRAE_PROVIDER_ID_DISPLAY_NAMES, TRAE_PROVIDER_ROUTES, TRAE_RAW_CHAT_V1_PATH, TRAE_RAW_CHAT_V2_PATH, TRAE_REASONING_EFFORTS, TRAE_REGIONS, TRAE_REGION_PARAM, TRAE_SETTINGS_NS, TRAE_SOLO_CHAT_PATH, TRAE_SOLO_FUNCTION, TRAE_SOLO_MODELS_PATH, TRAE_SOLO_REMOTE_BASE, TRAE_STATE_DB_FILENAME, TRAE_STREAM_IDLE_TIMEOUT_MS, TRAE_USAGE_PATH, TRAE_VERSION_CODE_FALLBACK, type TraeActivityRule, type TraeAdapter, type TraeCachedModelConfig, TraeCatalog, type TraeChatResult, type TraeCheckinClaim, type TraeCheckinStatus, type TraeContextBudget, type TraeCredential, TraeCredentialStore, TraeDelegatingUpstreamClient, type TraeDiscoveredModel, type TraeDiscoveredReasoning, type TraeEdition, type TraeFailure, TraeFallbackUpstreamClient, type TraeFallbackUpstreamOptions, type TraeFusionRawChatEnvelope, TraeGatedUpstreamClient, type TraeGatedUpstreamOptions, type TraeIdentity, type TraeInputModality, type TraeModelDetailRequest, type TraeModelInfo, type TraeModelProbeVerdict, type TraeModelsTestResponse, type TraeObservedModelConfig, type TraePanel, type TraeProbeResult, type TraeProbeVerdict, type TraeProviderRoute, TraeRawCapabilityController, type TraeRawCapabilityControllerOptions, type TraeRawCapabilitySnapshot, TraeRawCapabilityState, type TraeRawChatBehaviorConfig, type TraeRawChatCapability, type TraeRawChatClientOptions, type TraeRawChatConfig, type TraeRawChatFailureReason, type TraeRawChatRuntimeConfig, TraeRawChatUpstreamClient, type TraeRawDiagnostic, type TraeRawDiagnosticState, type TraeRawGateway, type TraeRawGatewayOptions, type TraeRawResolverResult, type TraeReasoningCapability, type TraeReasoningEffort, type TraeRefreshDevice, type TraeRegion, type TraeRegionGateways, TraeRegionState, type TraeShim, TraeSoloBridge, type TraeSoloClientOptions, TraeSoloRemoteCatalogClient, type TraeSoloRemoteCatalogOptions, TraeSoloUpstreamClient, type TraeStorageCandidate, type TraeStreamEvent, type TraeUpstreamClient, TraeUsageClient, type TraeUsageOptions, type TraeUsagePack, type TraeUsageRouteOptions, type TraeUsageSnapshot, type TraeUsageSummary, type TraeUsageView, type TraeWebAccountState, type TraeWebActivity, type TraeWebCheckin, type TraeWebCheckinClaim, type TraeWebCredits, type TraeWebUsage, type TraeWireModel, type TraeWireTarget, UnconfiguredTraeUpstreamClient, adaptLegacyPiAiContext, adaptModernPiAiContext, apply, applyContextBudgets, applyImageSelection, applyReasoningEffort, asVolatile, bridgeTraeSoloStream, buildTraeAgentTaskBody, buildTraeCnHeaders, buildTraeFusionRawChatEnvelope, buildTraeModelDetailRequest, buildTraeRawChatDraft, buildTraeRawChatRuntimeConfig, classifyProbeError, classifyProbeResult, classifyTraeRawChatFailure, configuredAccountsOf, createTraeAdapter, createTraeRawGateway, createTraeShim, creditPosition, decidePiAiGeneration, decodeRawChatChunk, decodeTraeEvent, decryptTraeStorageValue, deriveCatalog, describeIdShape, describeNameShape, describeTraeFailure, discoveredCatalog, displayNameOfTraeProvider, fallbackModelsFor, generationOf, hashTraeRawChatArg, identityHeaders, inject, isEnterpriseAccount, isPromotableWireModel, legacyTraeOwnAuthPath, maskUserPath, mergeTraeModelSources, name, nextRegionCreditPosition, nextRegionEnabled, nextRegionSlots, normalizeTraeCredential, normalizeTraeToolSchema, normalizeTraeToolSchemas, normalizeTraeVersionCode, panelOfKey, panelOfProvider, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeRawChatBehaviorConfig, parseTraeRemoteModel, parseTraeStorageDocument, piAiRuntimeInfo, pickTraeStorageIdentity, prepareSoloBody, probeBody, probeModelsSequentially, probeOneModel, probeTraeRawChatCapability, providerOfPanel, rawCapabilityDiagnostic, rawCapabilityFingerprint, readTraeCachedModel, readTraeCliIdentity, readTraeIdentity, refreshTraeCredential, regionCreditPositionOf, regionEnabled, regionEnabledOf, regionOfCredential, regionOfEdition, regionOfHost, regionOfPanel, regionOfTraeProvider, regionOfTraeStatusUrl, regionOfUserRegion, regionStateOf, registerTraeUsageRoute, resolveTraeIdentity, resolveTraeRawRuntime, routeOfTraeProvider, sanitizeCatalog, settingsNamespaceOf, traeEndpoint, traeInputModalities, traeModelDisplayName, traeOwnAuthPath, traeRawChatExtraInfo, traeStateDatabaseCandidates, traeStorageCandidates, traeWebUsage, traeWindowsAppNames, unwrapVolatile, unwrapVolatileDeep, wireTargetsOf, withContextAdaptation, withTraeRegion };
|
package/lib/index.js
CHANGED
|
@@ -210,7 +210,9 @@ function applyImageSelection(models, selected) {
|
|
|
210
210
|
* name has nothing to show in the picker.
|
|
211
211
|
*
|
|
212
212
|
* The display-name-collision test lives in the merge itself (it needs the
|
|
213
|
-
* Remote rows to compare against); see {@link mergeTraeModelSources}.
|
|
213
|
+
* Remote rows to compare against); see {@link mergeTraeModelSources}. It is a
|
|
214
|
+
* CAPABILITY test there, not a name test: a collision only suppresses a row
|
|
215
|
+
* when the equally-named row is at least as capable.
|
|
214
216
|
*
|
|
215
217
|
* The survivors are exactly the models a user would recognise and the IDE
|
|
216
218
|
* offers but the plugin hid: `kimi-k2` / `kimi-k2-0905`, `glm-4.6`,
|
|
@@ -316,15 +318,61 @@ function mergeTraeModelSources(remote, wire) {
|
|
|
316
318
|
});
|
|
317
319
|
}
|
|
318
320
|
const remoteIds = new Set(remote.map((model) => displayKey(model.id)));
|
|
319
|
-
|
|
321
|
+
/**
|
|
322
|
+
* Display name -> the LARGEST context window claimed under it.
|
|
323
|
+
*
|
|
324
|
+
* A name collision does NOT by itself mean "alias". Two rows sharing a
|
|
325
|
+
* display name are sometimes genuinely different models, and the only
|
|
326
|
+
* upstream signal that separates them is capability. Measured 2026-10-22 on
|
|
327
|
+
* a live CN credential:
|
|
328
|
+
*
|
|
329
|
+
* - `kimi-k2` (28000) and `kimi-k2-0905` (168000) BOTH display as
|
|
330
|
+
* `Kimi-K2-0905` — and both ANSWER (verified: `kimi-k2-0905` answers
|
|
331
|
+
* under `solo_coder` and `chat_v3`). Dropping the second one hid a real
|
|
332
|
+
* 168k model behind an equally-named 28k one, which is exactly the
|
|
333
|
+
* "dated snapshot the IDE offers, the plugin does not" complaint of
|
|
334
|
+
* issue #46.
|
|
335
|
+
* - `minimax-m2` (100000, `chat_v3`) and `minimax-m2-auto` (168000,
|
|
336
|
+
* `solo_coder`) both display as `MiniMax-M2` — again a bigger config
|
|
337
|
+
* behind an equally-named smaller one.
|
|
338
|
+
* - `glm-4.7` and `glm-4.7-auto` both display as `GLM-4.7` with IDENTICAL
|
|
339
|
+
* metadata (100000/16000/`chat_v3`) — a true duplicate, and promoting it
|
|
340
|
+
* would list one model twice for no gain.
|
|
341
|
+
* - `glm-5.2_advisor_default` (168000) is SMALLER than the skeleton's
|
|
342
|
+
* `glm-5.2` (200000), so it is an internal re-routing of a model the user
|
|
343
|
+
* already has in full — not worth a second row.
|
|
344
|
+
*
|
|
345
|
+
* So the rule is: a collision skips the row UNLESS the new row carries a
|
|
346
|
+
* STRICTLY LARGER context window, in which case the user is being offered
|
|
347
|
+
* capability the equally-named row does not have and hiding it would cost
|
|
348
|
+
* them something real. Names are tracked with their best context so the
|
|
349
|
+
* comparison is always against the strongest claimant, whatever the order.
|
|
350
|
+
*/
|
|
351
|
+
const claimedNames = /* @__PURE__ */ new Map();
|
|
352
|
+
const claim = (name, contextWindow) => {
|
|
353
|
+
const key = displayKey(name);
|
|
354
|
+
if (key === "") return;
|
|
355
|
+
claimedNames.set(key, Math.max(claimedNames.get(key) ?? 0, contextWindow ?? 0));
|
|
356
|
+
};
|
|
357
|
+
for (const model of remote) claim(model.name, model.contextWindow);
|
|
320
358
|
for (const wireModel of wire) {
|
|
321
359
|
if (remoteIds.has(displayKey(wireModel.id))) continue;
|
|
322
360
|
if (!isPromotableWireModel(wireModel)) continue;
|
|
323
|
-
|
|
324
|
-
|
|
361
|
+
const collides = claimedNames.has(displayKey(wireModel.name));
|
|
362
|
+
if (collides && (wireModel.contextWindow ?? 0) <= (claimedNames.get(displayKey(wireModel.name)) ?? 0)) continue;
|
|
363
|
+
/**
|
|
364
|
+
* A surviving collision gets the id appended, because the whole point of
|
|
365
|
+
* promoting it is that the user can TELL IT APART from the equally-named
|
|
366
|
+
* row: two rows rendering as `MiniMax-M2` is a picker that lies about
|
|
367
|
+
* having one model. The id is the `config_name` the bridge sends, so it is
|
|
368
|
+
* also the most actionable disambiguator available.
|
|
369
|
+
*/
|
|
370
|
+
const name = collides ? `${wireModel.name} (${wireModel.id})` : wireModel.name;
|
|
371
|
+
claim(wireModel.name, wireModel.contextWindow);
|
|
372
|
+
claim(name, wireModel.contextWindow);
|
|
325
373
|
result.push({
|
|
326
374
|
id: wireModel.id,
|
|
327
|
-
name
|
|
375
|
+
name,
|
|
328
376
|
...wireModel.contextWindow === void 0 ? {} : { contextWindow: wireModel.contextWindow },
|
|
329
377
|
...wireModel.maxTokens === void 0 ? {} : { maxTokens: wireModel.maxTokens },
|
|
330
378
|
...wireModel.creditMultiplier === void 0 ? {} : { creditMultiplier: wireModel.creditMultiplier },
|
|
@@ -3826,6 +3874,147 @@ function traeEndpoint(baseUrl, path) {
|
|
|
3826
3874
|
return `${baseUrl.replace(/\/$/, "")}/${path.replace(/^\//, "")}`;
|
|
3827
3875
|
}
|
|
3828
3876
|
//#endregion
|
|
3877
|
+
//#region src/raw-chat.ts
|
|
3878
|
+
const TRAE_RAW_CHAT_V2_PATH = "/api/ide/v2/llm_raw_chat";
|
|
3879
|
+
const TRAE_RAW_CHAT_V1_PATH = "/api/ide/v1/llm_raw_chat";
|
|
3880
|
+
/**
|
|
3881
|
+
* Normalise a tool `parameters` schema from JSON Schema draft-3 style to
|
|
3882
|
+
* draft-4 style (issue #49).
|
|
3883
|
+
*
|
|
3884
|
+
* Draft-3 declared a required property by putting a boolean `required: true`
|
|
3885
|
+
* INSIDE the property schema:
|
|
3886
|
+
*
|
|
3887
|
+
* { "type": "object", "properties": { "tool": { "type": "string", "required": true } } }
|
|
3888
|
+
*
|
|
3889
|
+
* Draft-4 removed the per-property boolean and uses a parent-level string
|
|
3890
|
+
* array instead: `{ "required": ["tool"] }`. The Trae backends disagree on how
|
|
3891
|
+
* strictly they check this: the Zhipu backend (glm-5.2) tolerates draft-3
|
|
3892
|
+
* `required: true`, but the DeepSeek backend (deepseek-v4.1-flash) rejects the
|
|
3893
|
+
* whole request with `4027 … tools.N.function.parameters/properties/X/required:
|
|
3894
|
+
* invalid JSON Schema` whenever ANY tool carries the boolean form — and
|
|
3895
|
+
* `tools.N` are validated as a batch, so one bad schema fails the entire turn
|
|
3896
|
+
* (issue #49, after #48). Since a model's backend is chosen by the upstream
|
|
3897
|
+
* router and can change per config, every tool-carrying request must be
|
|
3898
|
+
* draft-4 clean regardless of which backend the probe last saw.
|
|
3899
|
+
*
|
|
3900
|
+
* The rewrite is local, idempotent, and recursive: it lifts each boolean
|
|
3901
|
+
* `required` up to the enclosing schema's `required` array (merging with any
|
|
3902
|
+
* array already present), then drops the boolean. Non-object property entries
|
|
3903
|
+
* are left untouched — draft-4 forbids boolean schemas anyway, so no boolean
|
|
3904
|
+
* `required` can hide inside them.
|
|
3905
|
+
*/
|
|
3906
|
+
function normalizeTraeToolSchema(value) {
|
|
3907
|
+
if (Array.isArray(value)) {
|
|
3908
|
+
let changed = false;
|
|
3909
|
+
const items = value.map((item) => {
|
|
3910
|
+
const next = normalizeTraeToolSchema(item);
|
|
3911
|
+
if (next !== item) changed = true;
|
|
3912
|
+
return next;
|
|
3913
|
+
});
|
|
3914
|
+
return changed ? items : value;
|
|
3915
|
+
}
|
|
3916
|
+
if (typeof value !== "object" || value === null) return value;
|
|
3917
|
+
const source = value;
|
|
3918
|
+
const result = {};
|
|
3919
|
+
for (const [key, entry] of Object.entries(source)) {
|
|
3920
|
+
if (key === "required" && typeof entry === "boolean") continue;
|
|
3921
|
+
result[key] = normalizeTraeToolSchema(entry);
|
|
3922
|
+
}
|
|
3923
|
+
const properties = source["properties"];
|
|
3924
|
+
if (typeof properties === "object" && properties !== null && !Array.isArray(properties)) {
|
|
3925
|
+
const promoted = [];
|
|
3926
|
+
if (Array.isArray(source["required"])) {
|
|
3927
|
+
for (const name of source["required"]) if (typeof name === "string" && !promoted.includes(name)) promoted.push(name);
|
|
3928
|
+
}
|
|
3929
|
+
for (const [name, property] of Object.entries(properties)) if (typeof property === "object" && property !== null && property["required"] === true && !promoted.includes(name)) promoted.push(name);
|
|
3930
|
+
if (promoted.length > 0) result["required"] = promoted;
|
|
3931
|
+
}
|
|
3932
|
+
return JSON.stringify(result) === JSON.stringify(value) ? value : result;
|
|
3933
|
+
}
|
|
3934
|
+
/** Issue #49: apply `normalizeTraeToolSchema` to an OpenAI-style tool list. */
|
|
3935
|
+
function normalizeTraeToolSchemas(tools) {
|
|
3936
|
+
return tools.map((tool) => normalizeTraeToolSchema(tool));
|
|
3937
|
+
}
|
|
3938
|
+
/**
|
|
3939
|
+
* Evidence-bounded OpenAI-like draft inferred from Trae's LLMRaw* DTO symbols.
|
|
3940
|
+
* Pure/offline only: the upstream remains disabled until one controlled probe.
|
|
3941
|
+
*/
|
|
3942
|
+
function buildTraeRawChatDraft(input) {
|
|
3943
|
+
if (input.model.trim() === "") throw new Error("Trae raw chat requires a model");
|
|
3944
|
+
if (input.messages.length === 0) throw new Error("Trae raw chat requires messages");
|
|
3945
|
+
return {
|
|
3946
|
+
model: input.model,
|
|
3947
|
+
messages: structuredClone([...input.messages]),
|
|
3948
|
+
stream: true,
|
|
3949
|
+
...input.tools === void 0 || input.tools.length === 0 ? {} : { tools: normalizeTraeToolSchemas(structuredClone([...input.tools])) },
|
|
3950
|
+
...input.maxTokens === void 0 ? {} : { max_tokens: input.maxTokens },
|
|
3951
|
+
...input.temperature === void 0 ? {} : { temperature: input.temperature },
|
|
3952
|
+
...input.reasoningEffort === void 0 ? {} : { reasoning_effort: input.reasoningEffort },
|
|
3953
|
+
...input.extraInfo === void 0 ? {} : { extra_info: structuredClone(input.extraInfo) }
|
|
3954
|
+
};
|
|
3955
|
+
}
|
|
3956
|
+
/** Decode OpenAI-like raw-chat chunks while preserving unknown structures. */
|
|
3957
|
+
function decodeRawChatChunk(value) {
|
|
3958
|
+
if (value === "[DONE]") return [{
|
|
3959
|
+
type: "done",
|
|
3960
|
+
finishReason: "stop"
|
|
3961
|
+
}];
|
|
3962
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return [{
|
|
3963
|
+
type: "unknown",
|
|
3964
|
+
value
|
|
3965
|
+
}];
|
|
3966
|
+
const record = value;
|
|
3967
|
+
const result = [];
|
|
3968
|
+
const choices = Array.isArray(record["choices"]) ? record["choices"] : [];
|
|
3969
|
+
for (const rawChoice of choices) {
|
|
3970
|
+
if (typeof rawChoice !== "object" || rawChoice === null) continue;
|
|
3971
|
+
const choice = rawChoice;
|
|
3972
|
+
const delta = typeof choice["delta"] === "object" && choice["delta"] !== null ? choice["delta"] : {};
|
|
3973
|
+
if (typeof delta["reasoning_content"] === "string" && delta["reasoning_content"] !== "") result.push({
|
|
3974
|
+
type: "reasoning",
|
|
3975
|
+
text: delta["reasoning_content"]
|
|
3976
|
+
});
|
|
3977
|
+
if (typeof delta["content"] === "string" && delta["content"] !== "") result.push({
|
|
3978
|
+
type: "text",
|
|
3979
|
+
text: delta["content"]
|
|
3980
|
+
});
|
|
3981
|
+
if (Array.isArray(delta["tool_calls"])) for (const rawTool of delta["tool_calls"]) {
|
|
3982
|
+
if (typeof rawTool !== "object" || rawTool === null) continue;
|
|
3983
|
+
const tool = rawTool;
|
|
3984
|
+
const fn = typeof tool["function"] === "object" && tool["function"] !== null ? tool["function"] : {};
|
|
3985
|
+
result.push({
|
|
3986
|
+
type: "tool-call",
|
|
3987
|
+
index: typeof tool["index"] === "number" ? tool["index"] : 0,
|
|
3988
|
+
...typeof tool["id"] === "string" ? { id: tool["id"] } : {},
|
|
3989
|
+
...typeof fn["name"] === "string" ? { name: fn["name"] } : {},
|
|
3990
|
+
...typeof fn["arguments"] === "string" ? { arguments: fn["arguments"] } : {}
|
|
3991
|
+
});
|
|
3992
|
+
}
|
|
3993
|
+
if (typeof choice["finish_reason"] === "string" && choice["finish_reason"] !== "") result.push({
|
|
3994
|
+
type: "done",
|
|
3995
|
+
finishReason: choice["finish_reason"]
|
|
3996
|
+
});
|
|
3997
|
+
}
|
|
3998
|
+
if (typeof record["usage"] === "object" && record["usage"] !== null) {
|
|
3999
|
+
const usage = record["usage"];
|
|
4000
|
+
const details = typeof usage["prompt_tokens_details"] === "object" && usage["prompt_tokens_details"] !== null ? usage["prompt_tokens_details"] : {};
|
|
4001
|
+
const cacheRead = details["cached_tokens"] ?? usage["prompt_cache_hit_tokens"] ?? usage["cached_tokens"];
|
|
4002
|
+
const cacheWrite = details["cache_write_tokens"];
|
|
4003
|
+
result.push({
|
|
4004
|
+
type: "usage",
|
|
4005
|
+
...typeof usage["prompt_tokens"] === "number" ? { inputTokens: usage["prompt_tokens"] } : {},
|
|
4006
|
+
...typeof usage["completion_tokens"] === "number" ? { outputTokens: usage["completion_tokens"] } : {},
|
|
4007
|
+
...typeof usage["total_tokens"] === "number" ? { totalTokens: usage["total_tokens"] } : {},
|
|
4008
|
+
...typeof cacheRead === "number" ? { cacheReadTokens: cacheRead } : {},
|
|
4009
|
+
...typeof cacheWrite === "number" ? { cacheWriteTokens: cacheWrite } : {}
|
|
4010
|
+
});
|
|
4011
|
+
}
|
|
4012
|
+
return result.length === 0 ? [{
|
|
4013
|
+
type: "unknown",
|
|
4014
|
+
value
|
|
4015
|
+
}] : result;
|
|
4016
|
+
}
|
|
4017
|
+
//#endregion
|
|
3829
4018
|
//#region src/promo.ts
|
|
3830
4019
|
function record$1(value) {
|
|
3831
4020
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
@@ -4079,7 +4268,7 @@ function prepareSoloBody(source, defaultModel = "glm-5.2", functionName) {
|
|
|
4079
4268
|
const fn = raw["function"];
|
|
4080
4269
|
if (typeof fn !== "object" || fn === null) continue;
|
|
4081
4270
|
const record = fn;
|
|
4082
|
-
if (typeof record["parameters"] === "object" && record["parameters"] !== null) record["parameters"] = JSON.stringify(record["parameters"]);
|
|
4271
|
+
if (typeof record["parameters"] === "object" && record["parameters"] !== null) record["parameters"] = JSON.stringify(normalizeTraeToolSchema(record["parameters"]));
|
|
4083
4272
|
}
|
|
4084
4273
|
return JSON.stringify(body);
|
|
4085
4274
|
}
|
|
@@ -5540,89 +5729,6 @@ var TraeSoloRemoteCatalogClient = class TraeSoloRemoteCatalogClient {
|
|
|
5540
5729
|
}
|
|
5541
5730
|
};
|
|
5542
5731
|
//#endregion
|
|
5543
|
-
//#region src/raw-chat.ts
|
|
5544
|
-
const TRAE_RAW_CHAT_V2_PATH = "/api/ide/v2/llm_raw_chat";
|
|
5545
|
-
const TRAE_RAW_CHAT_V1_PATH = "/api/ide/v1/llm_raw_chat";
|
|
5546
|
-
/**
|
|
5547
|
-
* Evidence-bounded OpenAI-like draft inferred from Trae's LLMRaw* DTO symbols.
|
|
5548
|
-
* Pure/offline only: the upstream remains disabled until one controlled probe.
|
|
5549
|
-
*/
|
|
5550
|
-
function buildTraeRawChatDraft(input) {
|
|
5551
|
-
if (input.model.trim() === "") throw new Error("Trae raw chat requires a model");
|
|
5552
|
-
if (input.messages.length === 0) throw new Error("Trae raw chat requires messages");
|
|
5553
|
-
return {
|
|
5554
|
-
model: input.model,
|
|
5555
|
-
messages: structuredClone([...input.messages]),
|
|
5556
|
-
stream: true,
|
|
5557
|
-
...input.tools === void 0 || input.tools.length === 0 ? {} : { tools: structuredClone([...input.tools]) },
|
|
5558
|
-
...input.maxTokens === void 0 ? {} : { max_tokens: input.maxTokens },
|
|
5559
|
-
...input.temperature === void 0 ? {} : { temperature: input.temperature },
|
|
5560
|
-
...input.reasoningEffort === void 0 ? {} : { reasoning_effort: input.reasoningEffort },
|
|
5561
|
-
...input.extraInfo === void 0 ? {} : { extra_info: structuredClone(input.extraInfo) }
|
|
5562
|
-
};
|
|
5563
|
-
}
|
|
5564
|
-
/** Decode OpenAI-like raw-chat chunks while preserving unknown structures. */
|
|
5565
|
-
function decodeRawChatChunk(value) {
|
|
5566
|
-
if (value === "[DONE]") return [{
|
|
5567
|
-
type: "done",
|
|
5568
|
-
finishReason: "stop"
|
|
5569
|
-
}];
|
|
5570
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return [{
|
|
5571
|
-
type: "unknown",
|
|
5572
|
-
value
|
|
5573
|
-
}];
|
|
5574
|
-
const record = value;
|
|
5575
|
-
const result = [];
|
|
5576
|
-
const choices = Array.isArray(record["choices"]) ? record["choices"] : [];
|
|
5577
|
-
for (const rawChoice of choices) {
|
|
5578
|
-
if (typeof rawChoice !== "object" || rawChoice === null) continue;
|
|
5579
|
-
const choice = rawChoice;
|
|
5580
|
-
const delta = typeof choice["delta"] === "object" && choice["delta"] !== null ? choice["delta"] : {};
|
|
5581
|
-
if (typeof delta["reasoning_content"] === "string" && delta["reasoning_content"] !== "") result.push({
|
|
5582
|
-
type: "reasoning",
|
|
5583
|
-
text: delta["reasoning_content"]
|
|
5584
|
-
});
|
|
5585
|
-
if (typeof delta["content"] === "string" && delta["content"] !== "") result.push({
|
|
5586
|
-
type: "text",
|
|
5587
|
-
text: delta["content"]
|
|
5588
|
-
});
|
|
5589
|
-
if (Array.isArray(delta["tool_calls"])) for (const rawTool of delta["tool_calls"]) {
|
|
5590
|
-
if (typeof rawTool !== "object" || rawTool === null) continue;
|
|
5591
|
-
const tool = rawTool;
|
|
5592
|
-
const fn = typeof tool["function"] === "object" && tool["function"] !== null ? tool["function"] : {};
|
|
5593
|
-
result.push({
|
|
5594
|
-
type: "tool-call",
|
|
5595
|
-
index: typeof tool["index"] === "number" ? tool["index"] : 0,
|
|
5596
|
-
...typeof tool["id"] === "string" ? { id: tool["id"] } : {},
|
|
5597
|
-
...typeof fn["name"] === "string" ? { name: fn["name"] } : {},
|
|
5598
|
-
...typeof fn["arguments"] === "string" ? { arguments: fn["arguments"] } : {}
|
|
5599
|
-
});
|
|
5600
|
-
}
|
|
5601
|
-
if (typeof choice["finish_reason"] === "string" && choice["finish_reason"] !== "") result.push({
|
|
5602
|
-
type: "done",
|
|
5603
|
-
finishReason: choice["finish_reason"]
|
|
5604
|
-
});
|
|
5605
|
-
}
|
|
5606
|
-
if (typeof record["usage"] === "object" && record["usage"] !== null) {
|
|
5607
|
-
const usage = record["usage"];
|
|
5608
|
-
const details = typeof usage["prompt_tokens_details"] === "object" && usage["prompt_tokens_details"] !== null ? usage["prompt_tokens_details"] : {};
|
|
5609
|
-
const cacheRead = details["cached_tokens"] ?? usage["prompt_cache_hit_tokens"] ?? usage["cached_tokens"];
|
|
5610
|
-
const cacheWrite = details["cache_write_tokens"];
|
|
5611
|
-
result.push({
|
|
5612
|
-
type: "usage",
|
|
5613
|
-
...typeof usage["prompt_tokens"] === "number" ? { inputTokens: usage["prompt_tokens"] } : {},
|
|
5614
|
-
...typeof usage["completion_tokens"] === "number" ? { outputTokens: usage["completion_tokens"] } : {},
|
|
5615
|
-
...typeof usage["total_tokens"] === "number" ? { totalTokens: usage["total_tokens"] } : {},
|
|
5616
|
-
...typeof cacheRead === "number" ? { cacheReadTokens: cacheRead } : {},
|
|
5617
|
-
...typeof cacheWrite === "number" ? { cacheWriteTokens: cacheWrite } : {}
|
|
5618
|
-
});
|
|
5619
|
-
}
|
|
5620
|
-
return result.length === 0 ? [{
|
|
5621
|
-
type: "unknown",
|
|
5622
|
-
value
|
|
5623
|
-
}] : result;
|
|
5624
|
-
}
|
|
5625
|
-
//#endregion
|
|
5626
5732
|
//#region src/raw-runtime-config.ts
|
|
5627
5733
|
/** Merge safe current-cache facts with observed behavior flags; no network credentials enter this object. */
|
|
5628
5734
|
function traeRawChatExtraInfo(config) {
|
|
@@ -10187,4 +10293,4 @@ function apply(ctx, config) {
|
|
|
10187
10293
|
});
|
|
10188
10294
|
}
|
|
10189
10295
|
//#endregion
|
|
10190
|
-
export { Config, FALLBACK_TRAE_MODELS, FALLBACK_TRAE_MODELS_AI, MAX_PROBE_INPUT_TOKENS, REGION_GATEWAYS, SseDecoder, TRAE_ACCOUNT_STATUS_PATH, TRAE_AI_PROVIDER, TRAE_CHECKIN_PATH, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_ENTERPRISE_PROVIDER, TRAE_MODELS_TEST_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_PANELS, TRAE_PAY_BASE, TRAE_PROBE_TIMEOUT_MS, TRAE_PROVIDER, TRAE_PROVIDERS, TRAE_PROVIDER_DISPLAY_NAMES, TRAE_PROVIDER_IDS, TRAE_PROVIDER_ID_DISPLAY_NAMES, TRAE_PROVIDER_ROUTES, TRAE_RAW_CHAT_V1_PATH, TRAE_RAW_CHAT_V2_PATH, TRAE_REASONING_EFFORTS, TRAE_REGIONS, TRAE_REGION_PARAM, TRAE_SETTINGS_NS, TRAE_SOLO_CHAT_PATH, TRAE_SOLO_FUNCTION, TRAE_SOLO_MODELS_PATH, TRAE_SOLO_REMOTE_BASE, TRAE_STATE_DB_FILENAME, TRAE_STREAM_IDLE_TIMEOUT_MS, TRAE_USAGE_PATH, TRAE_VERSION_CODE_FALLBACK, TraeCatalog, TraeCredentialStore, TraeDelegatingUpstreamClient, TraeFallbackUpstreamClient, TraeGatedUpstreamClient, TraeRawCapabilityController, TraeRawCapabilityState, TraeRawChatUpstreamClient, TraeSoloBridge, TraeSoloRemoteCatalogClient, TraeSoloUpstreamClient, TraeUsageClient, UnconfiguredTraeUpstreamClient, adaptLegacyPiAiContext, adaptModernPiAiContext, apply, applyContextBudgets, applyImageSelection, applyReasoningEffort, asVolatile, bridgeTraeSoloStream, buildTraeAgentTaskBody, buildTraeCnHeaders, buildTraeFusionRawChatEnvelope, buildTraeModelDetailRequest, buildTraeRawChatDraft, buildTraeRawChatRuntimeConfig, classifyProbeError, classifyProbeResult, classifyTraeRawChatFailure, configuredAccountsOf, createTraeAdapter, createTraeRawGateway, createTraeShim, creditPosition, decidePiAiGeneration, decodeRawChatChunk, decodeTraeEvent, decryptTraeStorageValue, deriveCatalog, describeIdShape, describeNameShape, describeTraeFailure, discoveredCatalog, displayNameOfTraeProvider, fallbackModelsFor, generationOf, hashTraeRawChatArg, identityHeaders, inject, isEnterpriseAccount, isPromotableWireModel, legacyTraeOwnAuthPath, maskUserPath, mergeTraeModelSources, name, nextRegionCreditPosition, nextRegionEnabled, nextRegionSlots, normalizeTraeCredential, normalizeTraeVersionCode, panelOfKey, panelOfProvider, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeRawChatBehaviorConfig, parseTraeRemoteModel, parseTraeStorageDocument, piAiRuntimeInfo, pickTraeStorageIdentity, prepareSoloBody, probeBody, probeModelsSequentially, probeOneModel, probeTraeRawChatCapability, providerOfPanel, rawCapabilityDiagnostic, rawCapabilityFingerprint, readTraeCachedModel, readTraeCliIdentity, readTraeIdentity, refreshTraeCredential, regionCreditPositionOf, regionEnabled, regionEnabledOf, regionOfCredential, regionOfEdition, regionOfHost, regionOfPanel, regionOfTraeProvider, regionOfTraeStatusUrl, regionOfUserRegion, regionStateOf, registerTraeUsageRoute, resolveTraeIdentity, resolveTraeRawRuntime, routeOfTraeProvider, sanitizeCatalog, settingsNamespaceOf, traeEndpoint, traeInputModalities, traeModelDisplayName, traeOwnAuthPath, traeRawChatExtraInfo, traeStateDatabaseCandidates, traeStorageCandidates, traeWebUsage, traeWindowsAppNames, unwrapVolatile, unwrapVolatileDeep, wireTargetsOf, withContextAdaptation, withTraeRegion };
|
|
10296
|
+
export { Config, FALLBACK_TRAE_MODELS, FALLBACK_TRAE_MODELS_AI, MAX_PROBE_INPUT_TOKENS, REGION_GATEWAYS, SseDecoder, TRAE_ACCOUNT_STATUS_PATH, TRAE_AI_PROVIDER, TRAE_CHECKIN_PATH, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_ENTERPRISE_PROVIDER, TRAE_MODELS_TEST_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_PANELS, TRAE_PAY_BASE, TRAE_PROBE_TIMEOUT_MS, TRAE_PROVIDER, TRAE_PROVIDERS, TRAE_PROVIDER_DISPLAY_NAMES, TRAE_PROVIDER_IDS, TRAE_PROVIDER_ID_DISPLAY_NAMES, TRAE_PROVIDER_ROUTES, TRAE_RAW_CHAT_V1_PATH, TRAE_RAW_CHAT_V2_PATH, TRAE_REASONING_EFFORTS, TRAE_REGIONS, TRAE_REGION_PARAM, TRAE_SETTINGS_NS, TRAE_SOLO_CHAT_PATH, TRAE_SOLO_FUNCTION, TRAE_SOLO_MODELS_PATH, TRAE_SOLO_REMOTE_BASE, TRAE_STATE_DB_FILENAME, TRAE_STREAM_IDLE_TIMEOUT_MS, TRAE_USAGE_PATH, TRAE_VERSION_CODE_FALLBACK, TraeCatalog, TraeCredentialStore, TraeDelegatingUpstreamClient, TraeFallbackUpstreamClient, TraeGatedUpstreamClient, TraeRawCapabilityController, TraeRawCapabilityState, TraeRawChatUpstreamClient, TraeSoloBridge, TraeSoloRemoteCatalogClient, TraeSoloUpstreamClient, TraeUsageClient, UnconfiguredTraeUpstreamClient, adaptLegacyPiAiContext, adaptModernPiAiContext, apply, applyContextBudgets, applyImageSelection, applyReasoningEffort, asVolatile, bridgeTraeSoloStream, buildTraeAgentTaskBody, buildTraeCnHeaders, buildTraeFusionRawChatEnvelope, buildTraeModelDetailRequest, buildTraeRawChatDraft, buildTraeRawChatRuntimeConfig, classifyProbeError, classifyProbeResult, classifyTraeRawChatFailure, configuredAccountsOf, createTraeAdapter, createTraeRawGateway, createTraeShim, creditPosition, decidePiAiGeneration, decodeRawChatChunk, decodeTraeEvent, decryptTraeStorageValue, deriveCatalog, describeIdShape, describeNameShape, describeTraeFailure, discoveredCatalog, displayNameOfTraeProvider, fallbackModelsFor, generationOf, hashTraeRawChatArg, identityHeaders, inject, isEnterpriseAccount, isPromotableWireModel, legacyTraeOwnAuthPath, maskUserPath, mergeTraeModelSources, name, nextRegionCreditPosition, nextRegionEnabled, nextRegionSlots, normalizeTraeCredential, normalizeTraeToolSchema, normalizeTraeToolSchemas, normalizeTraeVersionCode, panelOfKey, panelOfProvider, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeRawChatBehaviorConfig, parseTraeRemoteModel, parseTraeStorageDocument, piAiRuntimeInfo, pickTraeStorageIdentity, prepareSoloBody, probeBody, probeModelsSequentially, probeOneModel, probeTraeRawChatCapability, providerOfPanel, rawCapabilityDiagnostic, rawCapabilityFingerprint, readTraeCachedModel, readTraeCliIdentity, readTraeIdentity, refreshTraeCredential, regionCreditPositionOf, regionEnabled, regionEnabledOf, regionOfCredential, regionOfEdition, regionOfHost, regionOfPanel, regionOfTraeProvider, regionOfTraeStatusUrl, regionOfUserRegion, regionStateOf, registerTraeUsageRoute, resolveTraeIdentity, resolveTraeRawRuntime, routeOfTraeProvider, sanitizeCatalog, settingsNamespaceOf, traeEndpoint, traeInputModalities, traeModelDisplayName, traeOwnAuthPath, traeRawChatExtraInfo, traeStateDatabaseCandidates, traeStorageCandidates, traeWebUsage, traeWindowsAppNames, unwrapVolatile, unwrapVolatileDeep, wireTargetsOf, withContextAdaptation, withTraeRegion };
|
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": "4.4.
|
|
5
|
+
"version": "4.4.2",
|
|
6
6
|
"author": "dingminhua",
|
|
7
7
|
"copyright": "Copyright (c) 2026 LaoDing",
|
|
8
8
|
"license": "MIT",
|