dsh-connect-trae 2.0.0 → 2.0.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 +23 -0
- package/lib/index.d.ts +72 -5
- package/lib/index.js +211 -47
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.2 (2026-09-15)
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- **修复「Trae 目录里有、插件列表里没有」的整类问题**(issue #7:GLM-5.3 缺失)——根因是**模型调用的 `function` 选错了**,不是目录读取有误:
|
|
8
|
+
- Trae 把可调用目录**分散在多个 SOLO 模式 function 下**,且一个模型**只能通过列出它的那个 function 调用**。插件此前固定用 `solo_work_lite` 取目录与发请求,而 `glm-5.3` 只存在于 **`solo_work_remote`**:用前者调用会被上游拒绝(`4001 param is invalid`),用后者则正常流式返回(2026-09-15 受控实测,同一份请求体,仅 function 不同)。
|
|
9
|
+
- **目录发现改为多 function 并集**:CN 依序请求 `solo_work_remote` → `solo_work_lite`,国际请求 `solo_agent` → `solo_work_remote` → `solo_work_lite`;同一个 config 由**先列出的 function 拥有**(顺序即优先级)。某个 function 失败不再影响其它 function 的目录。
|
|
10
|
+
- **聊天请求按模型回放其来源 function**:每个模型随目录记下 `wireFunction`(并纳入设置 schema 持久化,重启后仍生效),调用时写回请求体——`glm-5.3` 因而会走 `solo_work_remote`。
|
|
11
|
+
- 顺带确认:CN 的两个登录(Trae CN IDE 与 TRAE SOLO CN)在同一 function 下拿到**完全相同**的列表,因此该修复对两者一致生效;国际版覆盖最全的仍是 `solo_agent`。
|
|
12
|
+
- 新增 4 个回归测试(多 function 并集、来源 function 标记、优先级归属、显式 function 覆盖默认值),230/230 全绿。
|
|
13
|
+
- **目录拉取失败时重试一次**——Trae 的目录端点存在间歇性 401/限流(实测同一凭证数秒前 200、随后 401)。启动时若恰好撞上,live 目录会拉取失败并**静默回退到上次保存的快照**,从而丢掉自那次保存以来的所有新模型(本版要放出的 glm-5.3 就在其中,实测复现)。现在合并骨架(remote 目录)失败会先重试一次(800ms 间隔)再降级。
|
|
14
|
+
|
|
15
|
+
## 2.0.1 (2026-09-15)
|
|
16
|
+
|
|
17
|
+
### Fixes
|
|
18
|
+
|
|
19
|
+
- **修复纯 CLI 环境(WSL2 等)下「账号已识别但模型目录拉不出来、聊天也全部失败」**(issue #5 后续反馈)——1.4.2 让凭据层认得了 `traecli` 的裸 JWT,但**身份层只认桌面版 `storage.json`**:只装 CLI 的机器上没有任何桌面安装,`x-machine-id` / `x-device-id` 的来源解析直接抛「Trae storage was not found」,而目录查询与聊天请求的构造都需要它,于是模型目录永远停在兜底列表、选中模型也无法对话。现在身份解析在「桌面安装全部不存在」时降级到 **CLI 家目录自身的持久化标识**:
|
|
20
|
+
- `~/.trae-cn/argv.json` 的 `crash-reporter-id`(CLI 首次运行时写入的稳定 UUID)作为设备 ID;
|
|
21
|
+
- `~/.trae-cn/builtin/ide_version.json` 的 `version` 作为 `x-app-version`;
|
|
22
|
+
- 由设备 ID + 主机名 + 用户名做 SHA-256 得到 64 字符 `x-machine-id`(与官方客户端形态一致)。
|
|
23
|
+
全部取自 CLI 自己写下的稳定值,**不是每次请求随机生成**(延续本项目既有红线);有桌面安装时仍优先使用桌面 `machineid` / `telemetry.machineId`。文件存在但内容损坏时依旧暴露真实解析错误,不被降级掩盖。
|
|
24
|
+
- 修复 CI 在 ubuntu-latest 上的测试失败:`auth.spec.ts` 的 edition 收窄用例断言了候选数量为 1,而 Linux 会对每个 edition 并列探测多个目录拼写(`trae-solo` / `TRAE SOLO`),候选数为 2 —— 该多候选是 1.4.2 为 Linux 特意加的设计。测试改为断言收窄语义本身(候选数 > 0 且全部属于该 edition 的桌面安装),并已对 darwin / linux / win32 三平台逐一验证。
|
|
25
|
+
|
|
3
26
|
## 2.0.0 (2026-09-15)
|
|
4
27
|
|
|
5
28
|
### Breaking Changes
|
package/lib/index.d.ts
CHANGED
|
@@ -109,6 +109,8 @@ interface TraeModelInfo {
|
|
|
109
109
|
maxContextWindow?: number;
|
|
110
110
|
/** The `config_name` `llm_utils_chat` accepts; absent means `id` is already the wire id. */
|
|
111
111
|
wireConfigName?: string;
|
|
112
|
+
/** The directory function this model must be called through (see {@link TraeWireModel.function}). */
|
|
113
|
+
wireFunction?: string;
|
|
112
114
|
}
|
|
113
115
|
/** Bootstrap catalog: identity only where current Trae metadata has not been fetched yet. */
|
|
114
116
|
declare const FALLBACK_TRAE_MODELS: readonly TraeModelInfo[];
|
|
@@ -147,6 +149,14 @@ interface TraeWireModel {
|
|
|
147
149
|
contextWindow?: number;
|
|
148
150
|
maxTokens?: number;
|
|
149
151
|
reasoning?: TraeReasoningCapability;
|
|
152
|
+
/**
|
|
153
|
+
* The `get_detail_param` function this config_name came from. Trae splits its
|
|
154
|
+
* callable roster across several functions (SOLO modes), and a model is only
|
|
155
|
+
* callable through the function that actually lists it — glm-5.3 answers
|
|
156
|
+
* `solo_work_remote` but rejects `solo_work_lite` with 4001. The chat call
|
|
157
|
+
* therefore has to replay the directory's own function.
|
|
158
|
+
*/
|
|
159
|
+
function?: string;
|
|
150
160
|
}
|
|
151
161
|
/**
|
|
152
162
|
* Merge the two Trae model sources into one authoritative catalog.
|
|
@@ -477,6 +487,37 @@ declare function readTraeIdentity(candidate: TraeStorageCandidate, options?: Tra
|
|
|
477
487
|
* a candidate that exists but fails to parse still surfaces its own error.
|
|
478
488
|
*/
|
|
479
489
|
declare function pickTraeStorageIdentity(candidates: readonly TraeStorageCandidate[], options?: TraeIdentityReadOptions): Promise<TraeIdentity>;
|
|
490
|
+
/**
|
|
491
|
+
* Deterministic identity for a machine that only has the Trae CLI (`traecli`).
|
|
492
|
+
*
|
|
493
|
+
* A CLI-only machine has no desktop `storage.json`, so the desktop identity
|
|
494
|
+
* reader has nothing to read — yet the request headers still need stable
|
|
495
|
+
* machine/device ids. Everything here comes from identifiers the CLI itself
|
|
496
|
+
* persists (never a per-request random value):
|
|
497
|
+
*
|
|
498
|
+
* - `argv.json`'s `crash-reporter-id` — a stable per-install UUID the CLI
|
|
499
|
+
* writes on first run; used directly as the device id.
|
|
500
|
+
* - `builtin/ide_version.json`'s `version` — the CLI build, sent as
|
|
501
|
+
* `x-app-version` (the desktop reader gets this from `product.json`).
|
|
502
|
+
* - a SHA-256 over the device id, host name and user name for `machineId`,
|
|
503
|
+
* matching the 64-char hex shape the official clients send.
|
|
504
|
+
*
|
|
505
|
+
* When `crash-reporter-id` is absent the device id falls back to the same
|
|
506
|
+
* hash (still deterministic). A machine with no CLI home at all keeps failing
|
|
507
|
+
* loudly — a fabricated identity is worse than a visible "not signed in".
|
|
508
|
+
*/
|
|
509
|
+
declare function readTraeCliIdentity(edition: TraeEdition, options?: TraeIdentityReadOptions): Promise<TraeIdentity>;
|
|
510
|
+
/**
|
|
511
|
+
* Resolve the request identity for one region: the desktop storage identity
|
|
512
|
+
* when any desktop install exists, otherwise the CLI home's deterministic
|
|
513
|
+
* identity (see {@link readTraeCliIdentity}).
|
|
514
|
+
*
|
|
515
|
+
* This is the seam the WSL2 / CLI-only case needs: `traecli` writes its token
|
|
516
|
+
* to `~/.trae-cn/trae-jwt-token` and no `storage.json` exists anywhere, so
|
|
517
|
+
* desktop-only resolution used to fail every directory refresh and chat
|
|
518
|
+
* request even though the account itself was found.
|
|
519
|
+
*/
|
|
520
|
+
declare function resolveTraeIdentity(candidates: readonly TraeStorageCandidate[], edition: TraeEdition, options?: TraeIdentityReadOptions): Promise<TraeIdentity>;
|
|
480
521
|
/** Headers derived from actual persisted identity, never a new random identity per request. */
|
|
481
522
|
declare function identityHeaders(identity: TraeIdentity): Record<string, string>;
|
|
482
523
|
//#endregion
|
|
@@ -965,13 +1006,15 @@ declare function decodeTraeEvent(event: SseEvent): TraeStreamEvent;
|
|
|
965
1006
|
declare const TRAE_SOLO_FUNCTION = "solo_work_lite";
|
|
966
1007
|
declare const TRAE_SOLO_CHAT_PATH = "/api/agent/v3/llm_utils_chat";
|
|
967
1008
|
declare const TRAE_SOLO_MODELS_PATH = "/api/ide/v1/get_detail_param";
|
|
968
|
-
declare function prepareSoloBody(source: string, defaultModel?: string): string;
|
|
1009
|
+
declare function prepareSoloBody(source: string, defaultModel?: string, functionName?: string): string;
|
|
969
1010
|
interface TraeSoloModel {
|
|
970
1011
|
id: string;
|
|
971
1012
|
name: string;
|
|
972
1013
|
contextWindow?: number;
|
|
973
1014
|
maxTokens?: number;
|
|
974
1015
|
reasoning?: TraeReasoningCapability;
|
|
1016
|
+
/** The directory function that listed this config (replayed when calling it). */
|
|
1017
|
+
function?: string;
|
|
975
1018
|
}
|
|
976
1019
|
interface TraeSoloClientOptions {
|
|
977
1020
|
credential(): Promise<TraeCredential>;
|
|
@@ -984,15 +1027,39 @@ declare class TraeSoloUpstreamClient {
|
|
|
984
1027
|
private readonly options;
|
|
985
1028
|
private readonly fetchImpl;
|
|
986
1029
|
constructor(options: TraeSoloClientOptions);
|
|
1030
|
+
/**
|
|
1031
|
+
* Read the callable roster for this credential's region.
|
|
1032
|
+
*
|
|
1033
|
+
* Every function in {@link TRAE_DIRECTORY_FUNCTIONS} is asked, in order, and
|
|
1034
|
+
* their answers are unioned: the first function to list a `config_name` owns
|
|
1035
|
+
* it. Trae splits its roster across SOLO modes, and a model is only callable
|
|
1036
|
+
* through the function that lists it (glm-5.3 exists solely under
|
|
1037
|
+
* `solo_work_remote` on the CN gateway). Asking one function therefore
|
|
1038
|
+
* silently hides models that the other one serves. The remote directory
|
|
1039
|
+
* remains the merge skeleton, so agent-internal entries (search_agent_*,
|
|
1040
|
+
* paygo variants) never surface even though they appear here.
|
|
1041
|
+
*/
|
|
987
1042
|
fetchModels(signal?: AbortSignal): Promise<TraeSoloModel[]>;
|
|
988
|
-
|
|
1043
|
+
/** Merge one function's config list into the shared catalogue (first wins). */
|
|
1044
|
+
private collectModels;
|
|
1045
|
+
chatStream(bodyJson: string, signal?: AbortSignal, functionName?: string): Promise<TraeChatResult>;
|
|
989
1046
|
}
|
|
990
1047
|
//#endregion
|
|
991
1048
|
//#region src/solo-bridge.d.ts
|
|
992
1049
|
/** Convert Trae's named SSE events into OpenAI chat-completion SSE chunks. */
|
|
993
1050
|
declare function bridgeTraeSoloStream(response: Response, model: string): Response;
|
|
994
|
-
/**
|
|
995
|
-
|
|
1051
|
+
/**
|
|
1052
|
+
* One resolved wire target: the `config_name` `llm_utils_chat` accepts, plus
|
|
1053
|
+
* the directory function that listed it. Trae's roster is split across several
|
|
1054
|
+
* SOLO-mode functions and a model is only callable through the one listing it
|
|
1055
|
+
* (glm-5.3 answers only under `solo_work_remote`), so the chat call replays it.
|
|
1056
|
+
*/
|
|
1057
|
+
interface TraeWireTarget {
|
|
1058
|
+
configName: string;
|
|
1059
|
+
function?: string;
|
|
1060
|
+
}
|
|
1061
|
+
/** Resolves a display model id to its wire target (config_name + function). */
|
|
1062
|
+
type TraeWireResolver = (displayId: string) => TraeWireTarget | undefined;
|
|
996
1063
|
/** Native SOLO client wrapper used by the loopback OpenAI adapter. */
|
|
997
1064
|
declare class TraeSoloBridge implements TraeUpstreamClient {
|
|
998
1065
|
private readonly upstream;
|
|
@@ -1390,4 +1457,4 @@ declare function regionStateOf(config: Config, region: TraeRegion): TraeRegionSt
|
|
|
1390
1457
|
declare const Config: z<Config>;
|
|
1391
1458
|
declare function apply(ctx: Context, config: Config): void;
|
|
1392
1459
|
//#endregion
|
|
1393
|
-
export { Config, FALLBACK_TRAE_MODELS, FALLBACK_TRAE_MODELS_AI, REGION_GATEWAYS, type RawChatDelta, type RawChatMessage, type RawChatTool, SseDecoder, type SseEvent, TRAE_AI_PROVIDER, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_PAY_BASE, TRAE_PROVIDER, TRAE_PROVIDERS, TRAE_PROVIDER_DISPLAY_NAMES, 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_STREAM_IDLE_TIMEOUT_MS, TRAE_USAGE_PATH, TRAE_VERSION_CODE_FALLBACK, type TraeActivityRule, type TraeAdapter, type TraeCachedModelConfig, TraeCatalog, type TraeChatResult, type TraeCheckinStatus, type TraeContextBudget, type TraeCredential, TraeCredentialStore, TraeDelegatingUpstreamClient, type TraeDiscoveredModel, type TraeDiscoveredReasoning, type TraeEdition, TraeFallbackUpstreamClient, type TraeFallbackUpstreamOptions, type TraeFusionRawChatEnvelope, TraeGatedUpstreamClient, type TraeGatedUpstreamOptions, type TraeIdentity, type TraeInputModality, type TraeModelDetailRequest, type TraeModelInfo, type TraeObservedModelConfig, 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 TraeWebActivity, type TraeWebCheckin, type TraeWebCredits, type TraeWebUsage, type TraeWireModel, UnconfiguredTraeUpstreamClient, apply, applyContextBudgets, applyImageSelection, applyReasoningEffort, bridgeTraeSoloStream, buildTraeAgentTaskBody, buildTraeCnHeaders, buildTraeFusionRawChatEnvelope, buildTraeModelDetailRequest, buildTraeRawChatDraft, buildTraeRawChatRuntimeConfig, classifyTraeRawChatFailure, createTraeAdapter, createTraeRawGateway, createTraeShim, decodeRawChatChunk, decodeTraeEvent, decryptTraeStorageValue, deriveCatalog, discoveredCatalog, fallbackModelsFor, hashTraeRawChatArg, identityHeaders, inject, legacyTraeOwnAuthPath, mergeTraeModelSources, name, normalizeTraeCredential, normalizeTraeVersionCode, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeRawChatBehaviorConfig, parseTraeRemoteModel, parseTraeStorageDocument, pickTraeStorageIdentity, prepareSoloBody, probeTraeRawChatCapability, rawCapabilityDiagnostic, rawCapabilityFingerprint, readTraeCachedModel, readTraeIdentity, refreshTraeCredential, regionOfCredential, regionOfEdition, regionOfHost, regionOfTraeProvider, regionOfTraeStatusUrl, regionOfUserRegion, regionStateOf, registerTraeUsageRoute, resolveTraeRawRuntime, sanitizeCatalog, traeEndpoint, traeInputModalities, traeModelDisplayName, traeOwnAuthPath, traeRawChatExtraInfo, traeStorageCandidates, traeWebUsage, withTraeRegion };
|
|
1460
|
+
export { Config, FALLBACK_TRAE_MODELS, FALLBACK_TRAE_MODELS_AI, REGION_GATEWAYS, type RawChatDelta, type RawChatMessage, type RawChatTool, SseDecoder, type SseEvent, TRAE_AI_PROVIDER, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_PAY_BASE, TRAE_PROVIDER, TRAE_PROVIDERS, TRAE_PROVIDER_DISPLAY_NAMES, 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_STREAM_IDLE_TIMEOUT_MS, TRAE_USAGE_PATH, TRAE_VERSION_CODE_FALLBACK, type TraeActivityRule, type TraeAdapter, type TraeCachedModelConfig, TraeCatalog, type TraeChatResult, type TraeCheckinStatus, type TraeContextBudget, type TraeCredential, TraeCredentialStore, TraeDelegatingUpstreamClient, type TraeDiscoveredModel, type TraeDiscoveredReasoning, type TraeEdition, TraeFallbackUpstreamClient, type TraeFallbackUpstreamOptions, type TraeFusionRawChatEnvelope, TraeGatedUpstreamClient, type TraeGatedUpstreamOptions, type TraeIdentity, type TraeInputModality, type TraeModelDetailRequest, type TraeModelInfo, type TraeObservedModelConfig, 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 TraeWebActivity, type TraeWebCheckin, type TraeWebCredits, type TraeWebUsage, type TraeWireModel, UnconfiguredTraeUpstreamClient, apply, applyContextBudgets, applyImageSelection, applyReasoningEffort, bridgeTraeSoloStream, buildTraeAgentTaskBody, buildTraeCnHeaders, buildTraeFusionRawChatEnvelope, buildTraeModelDetailRequest, buildTraeRawChatDraft, buildTraeRawChatRuntimeConfig, classifyTraeRawChatFailure, createTraeAdapter, createTraeRawGateway, createTraeShim, decodeRawChatChunk, decodeTraeEvent, decryptTraeStorageValue, deriveCatalog, discoveredCatalog, fallbackModelsFor, hashTraeRawChatArg, identityHeaders, inject, legacyTraeOwnAuthPath, mergeTraeModelSources, name, normalizeTraeCredential, normalizeTraeVersionCode, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeRawChatBehaviorConfig, parseTraeRemoteModel, parseTraeStorageDocument, pickTraeStorageIdentity, prepareSoloBody, probeTraeRawChatCapability, rawCapabilityDiagnostic, rawCapabilityFingerprint, readTraeCachedModel, readTraeCliIdentity, readTraeIdentity, refreshTraeCredential, regionOfCredential, regionOfEdition, regionOfHost, regionOfTraeProvider, regionOfTraeStatusUrl, regionOfUserRegion, regionStateOf, registerTraeUsageRoute, resolveTraeIdentity, resolveTraeRawRuntime, sanitizeCatalog, traeEndpoint, traeInputModalities, traeModelDisplayName, traeOwnAuthPath, traeRawChatExtraInfo, traeStorageCandidates, traeWebUsage, withTraeRegion };
|
package/lib/index.js
CHANGED
|
@@ -156,7 +156,8 @@ function mergeTraeModelSources(remote, wire) {
|
|
|
156
156
|
reasoning: model.reasoning,
|
|
157
157
|
reasoningEfforts: Object.fromEntries(model.reasoning.supported.map((effort) => [effort, effort === "low" ? "light" : effort === "xhigh" ? "extra_high" : "high"]))
|
|
158
158
|
},
|
|
159
|
-
...wireModel.id !== "" && wireModel.id !== model.id ? { wireConfigName: wireModel.id } : {}
|
|
159
|
+
...wireModel.id !== "" && wireModel.id !== model.id ? { wireConfigName: wireModel.id } : {},
|
|
160
|
+
...wireModel.function === void 0 ? {} : { wireFunction: wireModel.function }
|
|
160
161
|
});
|
|
161
162
|
}
|
|
162
163
|
return result;
|
|
@@ -1381,6 +1382,8 @@ async function readTraeIdentity(candidate, options = {}) {
|
|
|
1381
1382
|
function isFileMissing(error) {
|
|
1382
1383
|
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
1383
1384
|
}
|
|
1385
|
+
/** Prefix of the "no candidate exists on disk" error; see {@link resolveTraeIdentity}. */
|
|
1386
|
+
const STORAGE_MISSING_PREFIX = "Trae storage was not found";
|
|
1384
1387
|
/**
|
|
1385
1388
|
* Try candidates in order and return the first that yields a valid identity;
|
|
1386
1389
|
* fail hard only when none do. Mirrors the credential store's skip-missing
|
|
@@ -1399,9 +1402,96 @@ async function pickTraeStorageIdentity(candidates, options = {}) {
|
|
|
1399
1402
|
if (!isFileMissing(error)) anyPresent = true;
|
|
1400
1403
|
}
|
|
1401
1404
|
const tried = candidates.map((item) => item.path).join(" or ");
|
|
1402
|
-
if (!anyPresent) throw new Error(
|
|
1405
|
+
if (!anyPresent) throw new Error(`${STORAGE_MISSING_PREFIX} (${tried})`);
|
|
1403
1406
|
throw lastError instanceof Error ? lastError : /* @__PURE__ */ new Error(`Trae identity could not be resolved (${tried})`);
|
|
1404
1407
|
}
|
|
1408
|
+
/** CLI dotfile home per edition; the CLI keeps its own home, not an Application Support entry. */
|
|
1409
|
+
const CLI_HOME_BY_EDITION = {
|
|
1410
|
+
cn: ".trae-cn",
|
|
1411
|
+
solo: ".trae-cn",
|
|
1412
|
+
sg: ".trae",
|
|
1413
|
+
"solo-sg": ".trae"
|
|
1414
|
+
};
|
|
1415
|
+
/**
|
|
1416
|
+
* Deterministic identity for a machine that only has the Trae CLI (`traecli`).
|
|
1417
|
+
*
|
|
1418
|
+
* A CLI-only machine has no desktop `storage.json`, so the desktop identity
|
|
1419
|
+
* reader has nothing to read — yet the request headers still need stable
|
|
1420
|
+
* machine/device ids. Everything here comes from identifiers the CLI itself
|
|
1421
|
+
* persists (never a per-request random value):
|
|
1422
|
+
*
|
|
1423
|
+
* - `argv.json`'s `crash-reporter-id` — a stable per-install UUID the CLI
|
|
1424
|
+
* writes on first run; used directly as the device id.
|
|
1425
|
+
* - `builtin/ide_version.json`'s `version` — the CLI build, sent as
|
|
1426
|
+
* `x-app-version` (the desktop reader gets this from `product.json`).
|
|
1427
|
+
* - a SHA-256 over the device id, host name and user name for `machineId`,
|
|
1428
|
+
* matching the 64-char hex shape the official clients send.
|
|
1429
|
+
*
|
|
1430
|
+
* When `crash-reporter-id` is absent the device id falls back to the same
|
|
1431
|
+
* hash (still deterministic). A machine with no CLI home at all keeps failing
|
|
1432
|
+
* loudly — a fabricated identity is worse than a visible "not signed in".
|
|
1433
|
+
*/
|
|
1434
|
+
async function readTraeCliIdentity(edition, options = {}) {
|
|
1435
|
+
const platform = options.platform ?? process.platform;
|
|
1436
|
+
const home = options.home ?? homedir();
|
|
1437
|
+
const env = options.env ?? process.env;
|
|
1438
|
+
const cliHome = join(home, CLI_HOME_BY_EDITION[edition]);
|
|
1439
|
+
const argv = await readJsonFile(join(cliHome, "argv.json"));
|
|
1440
|
+
const version = await readJsonFile(join(cliHome, "builtin", "ide_version.json"));
|
|
1441
|
+
const crashReporterId = nonEmpty(argv?.["crash-reporter-id"]);
|
|
1442
|
+
const host = nonEmpty(env["HOSTNAME"]) ?? await readHostname() ?? "unknown-host";
|
|
1443
|
+
const user = nonEmpty(env["USER"]) ?? nonEmpty(env["USERNAME"]) ?? "unknown-user";
|
|
1444
|
+
const deviceId = crashReporterId ?? createHash("sha256").update(`trae-cli\0${host}\0${user}`).digest("hex").slice(0, 32);
|
|
1445
|
+
const machineId = createHash("sha256").update(`trae-cli-machine\0${deviceId}\0${host}`).digest("hex");
|
|
1446
|
+
const appVersion = nonEmpty(version?.["version"]);
|
|
1447
|
+
const deviceCpu = cpus()[0]?.model.split(" ")[0];
|
|
1448
|
+
const osVersion = `${platform === "darwin" ? "macOS" : platform === "win32" ? "Windows" : platform} ${release()}`;
|
|
1449
|
+
return {
|
|
1450
|
+
edition,
|
|
1451
|
+
machineId,
|
|
1452
|
+
deviceId,
|
|
1453
|
+
...appVersion === void 0 ? {} : { appVersion },
|
|
1454
|
+
...deviceCpu === void 0 ? {} : { deviceCpu },
|
|
1455
|
+
osVersion,
|
|
1456
|
+
platform
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
/** Read and parse a JSON file, tolerating absence and malformed content. */
|
|
1460
|
+
async function readJsonFile(path) {
|
|
1461
|
+
try {
|
|
1462
|
+
const parsed = JSON.parse(await readFile(path, "utf8"));
|
|
1463
|
+
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : void 0;
|
|
1464
|
+
} catch {
|
|
1465
|
+
return;
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
/** OS host name, or undefined when unavailable. */
|
|
1469
|
+
async function readHostname() {
|
|
1470
|
+
try {
|
|
1471
|
+
const { hostname } = await import("node:os");
|
|
1472
|
+
return nonEmpty(hostname());
|
|
1473
|
+
} catch {
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
/**
|
|
1478
|
+
* Resolve the request identity for one region: the desktop storage identity
|
|
1479
|
+
* when any desktop install exists, otherwise the CLI home's deterministic
|
|
1480
|
+
* identity (see {@link readTraeCliIdentity}).
|
|
1481
|
+
*
|
|
1482
|
+
* This is the seam the WSL2 / CLI-only case needs: `traecli` writes its token
|
|
1483
|
+
* to `~/.trae-cn/trae-jwt-token` and no `storage.json` exists anywhere, so
|
|
1484
|
+
* desktop-only resolution used to fail every directory refresh and chat
|
|
1485
|
+
* request even though the account itself was found.
|
|
1486
|
+
*/
|
|
1487
|
+
async function resolveTraeIdentity(candidates, edition, options = {}) {
|
|
1488
|
+
try {
|
|
1489
|
+
return await pickTraeStorageIdentity(candidates, options);
|
|
1490
|
+
} catch (error) {
|
|
1491
|
+
if (!(error instanceof Error) || !error.message.startsWith(STORAGE_MISSING_PREFIX)) throw error;
|
|
1492
|
+
return readTraeCliIdentity(edition, options);
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1405
1495
|
/** Headers derived from actual persisted identity, never a new random identity per request. */
|
|
1406
1496
|
function identityHeaders(identity) {
|
|
1407
1497
|
return {
|
|
@@ -1729,6 +1819,25 @@ function applyReasoningEffort(body, effort, capability) {
|
|
|
1729
1819
|
//#endregion
|
|
1730
1820
|
//#region src/solo.ts
|
|
1731
1821
|
const TRAE_SOLO_FUNCTION = "solo_work_lite";
|
|
1822
|
+
/**
|
|
1823
|
+
* Directory functions to union per region, in priority order.
|
|
1824
|
+
*
|
|
1825
|
+
* Trae spreads its callable roster across several SOLO-mode functions, and a
|
|
1826
|
+
* model is only usable through the one that lists it: `glm-5.3` is absent from
|
|
1827
|
+
* `solo_work_lite` but present in `solo_work_remote` (verified 2026-09-15 —
|
|
1828
|
+
* calling it through the former answers `4001 param is invalid`, through the
|
|
1829
|
+
* latter streams normally). Rather than betting on a single function, the
|
|
1830
|
+
* directory unions them; the first function to provide a config wins, so the
|
|
1831
|
+
* order below decides which wire name a model is called with.
|
|
1832
|
+
*/
|
|
1833
|
+
const TRAE_DIRECTORY_FUNCTIONS = {
|
|
1834
|
+
cn: ["solo_work_remote", TRAE_SOLO_FUNCTION],
|
|
1835
|
+
ai: [
|
|
1836
|
+
"solo_agent",
|
|
1837
|
+
"solo_work_remote",
|
|
1838
|
+
TRAE_SOLO_FUNCTION
|
|
1839
|
+
]
|
|
1840
|
+
};
|
|
1732
1841
|
const TRAE_SOLO_CHAT_PATH = "/api/agent/v3/llm_utils_chat";
|
|
1733
1842
|
const TRAE_SOLO_MODELS_PATH = "/api/ide/v1/get_detail_param";
|
|
1734
1843
|
function classify(status) {
|
|
@@ -1742,14 +1851,14 @@ function classify(status) {
|
|
|
1742
1851
|
function finitePositive$1(value) {
|
|
1743
1852
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
|
|
1744
1853
|
}
|
|
1745
|
-
function prepareSoloBody(source, defaultModel = "glm-5.2") {
|
|
1854
|
+
function prepareSoloBody(source, defaultModel = "glm-5.2", functionName) {
|
|
1746
1855
|
const input = JSON.parse(source);
|
|
1747
1856
|
const model = typeof input["model"] === "string" && input["model"].trim() !== "" ? input["model"].trim() : defaultModel;
|
|
1748
1857
|
const body = {
|
|
1749
1858
|
...Array.isArray(input["messages"]) ? { messages: input["messages"] } : {},
|
|
1750
1859
|
model,
|
|
1751
1860
|
config_name: model,
|
|
1752
|
-
function:
|
|
1861
|
+
function: typeof input["function"] === "string" && input["function"] !== "" ? input["function"] : functionName ?? "solo_work_lite",
|
|
1753
1862
|
stream: true,
|
|
1754
1863
|
...Array.isArray(input["tools"]) ? { tools: input["tools"] } : {},
|
|
1755
1864
|
...typeof input["reasoning_effort"] === "string" ? { reasoning_effort: input["reasoning_effort"] } : {}
|
|
@@ -1791,32 +1900,60 @@ var TraeSoloUpstreamClient = class {
|
|
|
1791
1900
|
this.options = options;
|
|
1792
1901
|
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
1793
1902
|
}
|
|
1903
|
+
/**
|
|
1904
|
+
* Read the callable roster for this credential's region.
|
|
1905
|
+
*
|
|
1906
|
+
* Every function in {@link TRAE_DIRECTORY_FUNCTIONS} is asked, in order, and
|
|
1907
|
+
* their answers are unioned: the first function to list a `config_name` owns
|
|
1908
|
+
* it. Trae splits its roster across SOLO modes, and a model is only callable
|
|
1909
|
+
* through the function that lists it (glm-5.3 exists solely under
|
|
1910
|
+
* `solo_work_remote` on the CN gateway). Asking one function therefore
|
|
1911
|
+
* silently hides models that the other one serves. The remote directory
|
|
1912
|
+
* remains the merge skeleton, so agent-internal entries (search_agent_*,
|
|
1913
|
+
* paygo variants) never surface even though they appear here.
|
|
1914
|
+
*/
|
|
1794
1915
|
async fetchModels(signal) {
|
|
1795
1916
|
const [credential, identity] = await Promise.all([this.options.credential(), this.options.identity()]);
|
|
1796
1917
|
const region = regionOfCredential(credential);
|
|
1797
1918
|
const base = this.options.baseUrl ?? REGION_GATEWAYS[region].chat;
|
|
1798
|
-
const
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1919
|
+
const headers = {
|
|
1920
|
+
...buildTraeCnHeaders(credential, identity),
|
|
1921
|
+
Accept: "application/json"
|
|
1922
|
+
};
|
|
1923
|
+
const byId = /* @__PURE__ */ new Map();
|
|
1924
|
+
const failures = [];
|
|
1925
|
+
for (const directoryFunction of TRAE_DIRECTORY_FUNCTIONS[region]) {
|
|
1926
|
+
let list;
|
|
1927
|
+
try {
|
|
1928
|
+
const response = await this.fetchImpl(traeEndpoint(base, TRAE_SOLO_MODELS_PATH), {
|
|
1929
|
+
method: "POST",
|
|
1930
|
+
headers,
|
|
1931
|
+
body: JSON.stringify({
|
|
1932
|
+
function: directoryFunction,
|
|
1933
|
+
config_names: null,
|
|
1934
|
+
need_prompt: false,
|
|
1935
|
+
current_config_info: null,
|
|
1936
|
+
poly_prompt: true,
|
|
1937
|
+
mode_type: null,
|
|
1938
|
+
agent_type: null
|
|
1939
|
+
}),
|
|
1940
|
+
signal: signal ?? AbortSignal.timeout(3e4)
|
|
1941
|
+
});
|
|
1942
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
1943
|
+
const document = await response.json();
|
|
1944
|
+
list = Array.isArray(document["config_info_list"]) ? document["config_info_list"] : [];
|
|
1945
|
+
} catch (error) {
|
|
1946
|
+
failures.push(`${directoryFunction}: ${String(error).slice(0, 80)}`);
|
|
1947
|
+
continue;
|
|
1948
|
+
}
|
|
1949
|
+
this.collectModels(list, directoryFunction, byId);
|
|
1950
|
+
}
|
|
1951
|
+
const models = [...byId.values()];
|
|
1952
|
+
if (models.length === 0) throw new Error(`Trae SOLO models response contained no models (${failures.join("; ") || "empty directory"})`);
|
|
1953
|
+
return models;
|
|
1954
|
+
}
|
|
1955
|
+
/** Merge one function's config list into the shared catalogue (first wins). */
|
|
1956
|
+
collectModels(list, directoryFunction, byId) {
|
|
1820
1957
|
for (const raw of list) {
|
|
1821
1958
|
if (typeof raw !== "object" || raw === null) continue;
|
|
1822
1959
|
const config = raw;
|
|
@@ -1834,21 +1971,21 @@ var TraeSoloUpstreamClient = class {
|
|
|
1834
1971
|
...config,
|
|
1835
1972
|
...detail
|
|
1836
1973
|
});
|
|
1837
|
-
|
|
1974
|
+
if (byId.has(id)) continue;
|
|
1975
|
+
byId.set(id, {
|
|
1838
1976
|
id,
|
|
1839
1977
|
name: typeof display["display_name"] === "string" && display["display_name"] !== "" ? display["display_name"] : id,
|
|
1840
1978
|
...contextWindow === void 0 ? {} : { contextWindow },
|
|
1841
1979
|
...maxTokens === void 0 ? {} : { maxTokens },
|
|
1842
|
-
...reasoning === void 0 ? {} : { reasoning }
|
|
1980
|
+
...reasoning === void 0 ? {} : { reasoning },
|
|
1981
|
+
function: directoryFunction
|
|
1843
1982
|
});
|
|
1844
1983
|
}
|
|
1845
|
-
if (models.length === 0) throw new Error("Trae SOLO models response contained no models");
|
|
1846
|
-
return models;
|
|
1847
1984
|
}
|
|
1848
|
-
async chatStream(bodyJson, signal) {
|
|
1985
|
+
async chatStream(bodyJson, signal, functionName) {
|
|
1849
1986
|
let prepared;
|
|
1850
1987
|
try {
|
|
1851
|
-
prepared = prepareSoloBody(bodyJson);
|
|
1988
|
+
prepared = prepareSoloBody(bodyJson, void 0, functionName);
|
|
1852
1989
|
} catch {
|
|
1853
1990
|
return {
|
|
1854
1991
|
ok: false,
|
|
@@ -2141,11 +2278,17 @@ var TraeSoloBridge = class {
|
|
|
2141
2278
|
const input = JSON.parse(bodyJson);
|
|
2142
2279
|
if (typeof input["model"] === "string" && input["model"] !== "") model = input["model"];
|
|
2143
2280
|
const entry = this.catalog?.current().find((item) => item.id === model);
|
|
2144
|
-
const
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2281
|
+
const fromCatalog = entry?.wireConfigName === void 0 ? void 0 : {
|
|
2282
|
+
configName: entry.wireConfigName,
|
|
2283
|
+
...entry.wireFunction === void 0 ? {} : { function: entry.wireFunction }
|
|
2284
|
+
};
|
|
2285
|
+
const fromResolver = this.wireResolver?.(model) ?? this.wireResolver?.(entry?.name ?? "");
|
|
2286
|
+
const target = fromCatalog ?? fromResolver;
|
|
2287
|
+
const wireModel = target?.configName ?? model;
|
|
2288
|
+
const wireFunction = target?.function ?? entry?.wireFunction;
|
|
2289
|
+
if (wireModel !== input["model"]) input["model"] = wireModel;
|
|
2290
|
+
if (wireFunction !== void 0 && input["function"] !== wireFunction) input["function"] = wireFunction;
|
|
2291
|
+
if (wireModel !== JSON.parse(bodyJson)["model"] || wireFunction !== void 0) prepared = JSON.stringify(input);
|
|
2149
2292
|
if (typeof input["reasoning_effort"] === "string") {
|
|
2150
2293
|
const efforts = entry?.reasoningEfforts;
|
|
2151
2294
|
const requested = input["reasoning_effort"];
|
|
@@ -3378,7 +3521,8 @@ const modelConfig = z.object({
|
|
|
3378
3521
|
contextWindow: z.number().step(1).min(1),
|
|
3379
3522
|
maxTokens: z.number().step(1).min(1),
|
|
3380
3523
|
input: z.array(z.union(["text", "image"])),
|
|
3381
|
-
creditMultiplier: z.number()
|
|
3524
|
+
creditMultiplier: z.number(),
|
|
3525
|
+
wireFunction: z.string()
|
|
3382
3526
|
});
|
|
3383
3527
|
const regionStateConfig = z.object({
|
|
3384
3528
|
lastCatalog: z.array(modelConfig).default([]),
|
|
@@ -3464,6 +3608,25 @@ function apply(ctx, config) {
|
|
|
3464
3608
|
if (explicit !== void 0) return explicit;
|
|
3465
3609
|
return legacyAccountRegion === region ? value.accountId : void 0;
|
|
3466
3610
|
};
|
|
3611
|
+
/**
|
|
3612
|
+
* Retry a directory read once. The gateways answer an intermittent 401 for a
|
|
3613
|
+
* credential that works moments later (observed 2026-09-15), and a failed
|
|
3614
|
+
* skeleton read would otherwise drop the runtime catalog back to the saved
|
|
3615
|
+
* snapshot — hiding every model added since that save (issue #7's glm-5.3
|
|
3616
|
+
* among them).
|
|
3617
|
+
*/
|
|
3618
|
+
async function withDirectoryRetry(read) {
|
|
3619
|
+
try {
|
|
3620
|
+
return await read();
|
|
3621
|
+
} catch (first) {
|
|
3622
|
+
await new Promise((resolve) => setTimeout(resolve, 800));
|
|
3623
|
+
try {
|
|
3624
|
+
return await read();
|
|
3625
|
+
} catch {
|
|
3626
|
+
throw first;
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
}
|
|
3467
3630
|
const stacks = {};
|
|
3468
3631
|
for (const region of REGION_KEYS) {
|
|
3469
3632
|
const catalog = new TraeCatalog(region);
|
|
@@ -3483,13 +3646,11 @@ function apply(ctx, config) {
|
|
|
3483
3646
|
preferred = (await store.current())?.edition;
|
|
3484
3647
|
} catch {}
|
|
3485
3648
|
const hint = (config.edition !== void 0 && config.edition !== "auto" ? config.edition : void 0) ?? preferred;
|
|
3486
|
-
|
|
3649
|
+
return resolveTraeIdentity(config.authFile === void 0 ? traeStorageCandidates().filter((item) => item.source === "desktop" && (hint !== void 0 ? item.edition === hint : regionOfEdition(item.edition) === region)) : [{
|
|
3487
3650
|
edition: hint ?? (region === "ai" ? "sg" : "solo"),
|
|
3488
3651
|
path: config.authFile,
|
|
3489
3652
|
source: "desktop"
|
|
3490
|
-
}];
|
|
3491
|
-
if (candidates.length === 0) throw new Error("Trae storage was not found");
|
|
3492
|
-
return pickTraeStorageIdentity(candidates);
|
|
3653
|
+
}], hint ?? (region === "ai" ? "solo-sg" : "cn"));
|
|
3493
3654
|
};
|
|
3494
3655
|
/**
|
|
3495
3656
|
* Resolution failures degrade to omitting DeviceInfo (its being required
|
|
@@ -3567,8 +3728,7 @@ function apply(ctx, config) {
|
|
|
3567
3728
|
delegating,
|
|
3568
3729
|
usageClient: new TraeUsageClient({ credential: () => store.resolve() }),
|
|
3569
3730
|
discoverModels: async (signal) => {
|
|
3570
|
-
const
|
|
3571
|
-
const merged = mergeTraeModelSources(remote, wireModels);
|
|
3731
|
+
const merged = mergeTraeModelSources(await withDirectoryRetry(() => remoteCatalog.fetchModels(signal)), await solo.fetchModels(signal));
|
|
3572
3732
|
wire.callableKeys.clear();
|
|
3573
3733
|
for (const model of merged) {
|
|
3574
3734
|
wire.callableKeys.add(model.id.trim().toLowerCase());
|
|
@@ -3578,8 +3738,12 @@ function apply(ctx, config) {
|
|
|
3578
3738
|
wire.byId.clear();
|
|
3579
3739
|
wire.byName.clear();
|
|
3580
3740
|
for (const model of merged) if (model.wireConfigName !== void 0) {
|
|
3581
|
-
|
|
3582
|
-
|
|
3741
|
+
const target = {
|
|
3742
|
+
configName: model.wireConfigName,
|
|
3743
|
+
...model.wireFunction === void 0 ? {} : { function: model.wireFunction }
|
|
3744
|
+
};
|
|
3745
|
+
wire.byId.set(model.id, target);
|
|
3746
|
+
wire.byName.set(model.name.trim().toLowerCase(), target);
|
|
3583
3747
|
}
|
|
3584
3748
|
return merged;
|
|
3585
3749
|
},
|
|
@@ -3709,4 +3873,4 @@ function apply(ctx, config) {
|
|
|
3709
3873
|
});
|
|
3710
3874
|
}
|
|
3711
3875
|
//#endregion
|
|
3712
|
-
export { Config, FALLBACK_TRAE_MODELS, FALLBACK_TRAE_MODELS_AI, REGION_GATEWAYS, SseDecoder, TRAE_AI_PROVIDER, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_PAY_BASE, TRAE_PROVIDER, TRAE_PROVIDERS, TRAE_PROVIDER_DISPLAY_NAMES, 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_STREAM_IDLE_TIMEOUT_MS, TRAE_USAGE_PATH, TRAE_VERSION_CODE_FALLBACK, TraeCatalog, TraeCredentialStore, TraeDelegatingUpstreamClient, TraeFallbackUpstreamClient, TraeGatedUpstreamClient, TraeRawCapabilityController, TraeRawCapabilityState, TraeRawChatUpstreamClient, TraeSoloBridge, TraeSoloRemoteCatalogClient, TraeSoloUpstreamClient, TraeUsageClient, UnconfiguredTraeUpstreamClient, apply, applyContextBudgets, applyImageSelection, applyReasoningEffort, bridgeTraeSoloStream, buildTraeAgentTaskBody, buildTraeCnHeaders, buildTraeFusionRawChatEnvelope, buildTraeModelDetailRequest, buildTraeRawChatDraft, buildTraeRawChatRuntimeConfig, classifyTraeRawChatFailure, createTraeAdapter, createTraeRawGateway, createTraeShim, decodeRawChatChunk, decodeTraeEvent, decryptTraeStorageValue, deriveCatalog, discoveredCatalog, fallbackModelsFor, hashTraeRawChatArg, identityHeaders, inject, legacyTraeOwnAuthPath, mergeTraeModelSources, name, normalizeTraeCredential, normalizeTraeVersionCode, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeRawChatBehaviorConfig, parseTraeRemoteModel, parseTraeStorageDocument, pickTraeStorageIdentity, prepareSoloBody, probeTraeRawChatCapability, rawCapabilityDiagnostic, rawCapabilityFingerprint, readTraeCachedModel, readTraeIdentity, refreshTraeCredential, regionOfCredential, regionOfEdition, regionOfHost, regionOfTraeProvider, regionOfTraeStatusUrl, regionOfUserRegion, regionStateOf, registerTraeUsageRoute, resolveTraeRawRuntime, sanitizeCatalog, traeEndpoint, traeInputModalities, traeModelDisplayName, traeOwnAuthPath, traeRawChatExtraInfo, traeStorageCandidates, traeWebUsage, withTraeRegion };
|
|
3876
|
+
export { Config, FALLBACK_TRAE_MODELS, FALLBACK_TRAE_MODELS_AI, REGION_GATEWAYS, SseDecoder, TRAE_AI_PROVIDER, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_PAY_BASE, TRAE_PROVIDER, TRAE_PROVIDERS, TRAE_PROVIDER_DISPLAY_NAMES, 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_STREAM_IDLE_TIMEOUT_MS, TRAE_USAGE_PATH, TRAE_VERSION_CODE_FALLBACK, TraeCatalog, TraeCredentialStore, TraeDelegatingUpstreamClient, TraeFallbackUpstreamClient, TraeGatedUpstreamClient, TraeRawCapabilityController, TraeRawCapabilityState, TraeRawChatUpstreamClient, TraeSoloBridge, TraeSoloRemoteCatalogClient, TraeSoloUpstreamClient, TraeUsageClient, UnconfiguredTraeUpstreamClient, apply, applyContextBudgets, applyImageSelection, applyReasoningEffort, bridgeTraeSoloStream, buildTraeAgentTaskBody, buildTraeCnHeaders, buildTraeFusionRawChatEnvelope, buildTraeModelDetailRequest, buildTraeRawChatDraft, buildTraeRawChatRuntimeConfig, classifyTraeRawChatFailure, createTraeAdapter, createTraeRawGateway, createTraeShim, decodeRawChatChunk, decodeTraeEvent, decryptTraeStorageValue, deriveCatalog, discoveredCatalog, fallbackModelsFor, hashTraeRawChatArg, identityHeaders, inject, legacyTraeOwnAuthPath, mergeTraeModelSources, name, normalizeTraeCredential, normalizeTraeVersionCode, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeRawChatBehaviorConfig, parseTraeRemoteModel, parseTraeStorageDocument, pickTraeStorageIdentity, prepareSoloBody, probeTraeRawChatCapability, rawCapabilityDiagnostic, rawCapabilityFingerprint, readTraeCachedModel, readTraeCliIdentity, readTraeIdentity, refreshTraeCredential, regionOfCredential, regionOfEdition, regionOfHost, regionOfTraeProvider, regionOfTraeStatusUrl, regionOfUserRegion, regionStateOf, registerTraeUsageRoute, resolveTraeIdentity, resolveTraeRawRuntime, sanitizeCatalog, traeEndpoint, traeInputModalities, traeModelDisplayName, traeOwnAuthPath, traeRawChatExtraInfo, traeStorageCandidates, traeWebUsage, withTraeRegion };
|
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.
|
|
5
|
+
"version": "2.0.2",
|
|
6
6
|
"author": "dingminhua",
|
|
7
7
|
"copyright": "Copyright (c) 2026 LaoDing",
|
|
8
8
|
"license": "MIT",
|