dsh-connect-trae 1.1.2 → 1.3.0
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 +16 -0
- package/README.en.md +2 -1
- package/README.md +2 -1
- package/lib/client.js +1 -5
- package/lib/index.d.ts +19 -2
- package/lib/index.js +35 -9
- package/package.json +18 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.0 (2026-09-08)
|
|
4
|
+
|
|
5
|
+
### Changes
|
|
6
|
+
|
|
7
|
+
- 模型名称内嵌积分倍率,与 Trae 自身模型菜单的显示格式一致(如 `GLM-5.2 · x0.79`):DSH 模型选择器中由本插件注册的模型名在 Trae 公布 `consumption_rate` 时带上 `· x倍率` 后缀,倍率随目录刷新更新,未公布倍率的模型保持原名;模型 id 与内部目录仍用原始名称(不影响 wire 解析与已保存的选择)。插件设置卡片模型行的倍率同步改为 `· x0.79` 内联显示;`lastCatalog` 设置模式新增 `creditMultiplier` 字段声明,保证倍率跨重启持久化。
|
|
8
|
+
|
|
9
|
+
## 1.2.0 (2026-09-04)
|
|
10
|
+
|
|
11
|
+
### Changes
|
|
12
|
+
|
|
13
|
+
- 适配 DSH v0.1.2-rc.1 上游重构(`dsh-plugin-desktop` 2.0.5),同一份构建继续兼容 0.1.1 宿主:
|
|
14
|
+
- `@deepseek-ai/dsh-settings` 在 0.1.2 的 npm 包中移除了 `settingsNamespace` / `installSettingsSection` 自由函数(桌面宿主内置兼容垫片,npm 安装没有;缺失导出会在 ESM 链接期直接报错)。设置接线改为双轨:从模块命名空间读取旧自由函数,存在则使用(0.1.1 宿主与带垫片的 0.1.2 桌面宿主),否则回退 `settings` 服务的 `installSection` 方法(无垫片的 0.1.2 npm 环境);`TRAE_SETTINGS_NS` 改为字面量 `'trae'`。
|
|
15
|
+
- `@deepseek-ai/dsh-client-runtime` 包在上游被拆分删除:客户端入口的 `ClientContext` 类型改从 `@deepseek-ai/cordis` 导入,`slots` / `settingsScope` / `locale` 服务类型分别通过 `dsh-client-ui-renderer/client`、`dsh-client-ui-settings/client`、`dsh-client-locale/client` 的类型增广获得;`package.json` 的 `dsh.client.inject` 相应把 `@deepseek-ai/dsh-client-runtime` 替换为 `@deepseek-ai/dsh-client-ui-renderer`(0.1.2 中 `slots` 服务的提供方,该包在 0.1.1 中同样存在)。
|
|
16
|
+
- `llm.registerModelDiscovery` 的取消信号从 `request.signal` 移到回调第二个参数:发现回调改用 `(request, signal)` 签名并透传给 Trae 发现请求,修复 0.1.2 宿主下取消不再传播的问题;0.1.1 宿主回退读取 `request.signal`。
|
|
17
|
+
- devDependencies 升级至 `@deepseek-ai/dsh-*@0.1.2-rc.1`、`cordis@^4.0.2`、`schemastery@3.18.2`、`pi-ai@0.84.2`(新增 `dsh-client-ui-renderer`、`dsh-client-ui-settings`,移除已删除的 `dsh-client-runtime`),`pnpm run check` 现在直接面向 0.1.2 类型与运行时验证;`peerDependencies` 维持 `>=0.1.2-0 <0.2.0-0` 不变。
|
|
18
|
+
|
|
3
19
|
## 1.1.2 (2026-08-31)
|
|
4
20
|
|
|
5
21
|
### Fixes
|
package/README.en.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
<p align="center">
|
|
18
18
|
<a href="https://www.npmjs.com/package/dsh-connect-trae"><img src="https://img.shields.io/npm/v/dsh-connect-trae?style=flat-square&label=npm&color=cb3837" alt="npm version"></a>
|
|
19
|
-
<a href="https://www.npmjs.com/package/dsh-connect-trae"><img src="https://img.shields.io/npm/
|
|
19
|
+
<a href="https://www.npmjs.com/package/dsh-connect-trae"><img src="https://img.shields.io/npm/d18m/dsh-connect-trae?style=flat-square&label=downloads&color=cb3837" alt="npm downloads"></a>
|
|
20
20
|
<a href="https://github.com/dingminhua/dsh-connect-trae/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/dingminhua/dsh-connect-trae/ci.yml?branch=main&style=flat-square&label=tests" alt="test status"></a>
|
|
21
21
|
<a href="LICENSE"><img src="https://img.shields.io/github/license/dingminhua/dsh-connect-trae?style=flat-square" alt="MIT license"></a>
|
|
22
22
|
<a href="https://github.com/dingminhua/dsh-connect-trae/stargazers"><img src="https://img.shields.io/github/stars/dingminhua/dsh-connect-trae?style=flat-square" alt="GitHub stars"></a>
|
|
@@ -28,6 +28,7 @@ A [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) bund
|
|
|
28
28
|
## Features
|
|
29
29
|
|
|
30
30
|
- **Trae model provider** — registers locally signed-in Trae models as the `trae` provider (e.g. `DeepSeek-V4-Flash`, `DeepSeek-V4-Pro`).
|
|
31
|
+
- **Multiplier in the model name** — model names show the credit multiplier in Trae's own menu format (e.g. `GLM-5.2 · x0.79`), updated with each directory refresh.
|
|
31
32
|
- **DSH local tool loop** — gets pending structured `tool_calls` from Trae `llm_utils_chat`, lets DSH execute its own local tools, then returns tool results to the model.
|
|
32
33
|
- **Trae CN account switching** — detects local Trae CN and TRAE SOLO CN sign-ins, refreshes the token list, and lets users select an account without storing tokens in DSH settings.
|
|
33
34
|
- **Read-only credits and model management** — shows Work credits separately from the general credits usable by DSH, and manages which Trae models are enabled. Read-only queries do not consume credits.
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
<p align="center">
|
|
18
18
|
<a href="https://www.npmjs.com/package/dsh-connect-trae"><img src="https://img.shields.io/npm/v/dsh-connect-trae?style=flat-square&label=npm&color=cb3837" alt="npm version"></a>
|
|
19
|
-
<a href="https://www.npmjs.com/package/dsh-connect-trae"><img src="https://img.shields.io/npm/
|
|
19
|
+
<a href="https://www.npmjs.com/package/dsh-connect-trae"><img src="https://img.shields.io/npm/d18m/dsh-connect-trae?style=flat-square&label=downloads&color=cb3837" alt="npm downloads"></a>
|
|
20
20
|
<a href="https://github.com/dingminhua/dsh-connect-trae/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/dingminhua/dsh-connect-trae/ci.yml?branch=main&style=flat-square&label=tests" alt="test status"></a>
|
|
21
21
|
<a href="LICENSE"><img src="https://img.shields.io/github/license/dingminhua/dsh-connect-trae?style=flat-square" alt="MIT license"></a>
|
|
22
22
|
<a href="https://github.com/dingminhua/dsh-connect-trae/stargazers"><img src="https://img.shields.io/github/stars/dingminhua/dsh-connect-trae?style=flat-square" alt="GitHub stars"></a>
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
## 功能特性
|
|
29
29
|
|
|
30
30
|
- **Trae 模型接入** —— 把本机登录的 Trae 模型注册为 DSH 的 `trae` provider,模型选择器出现 `DeepSeek-V4-Flash`、`DeepSeek-V4-Pro` 等。
|
|
31
|
+
- **倍率内嵌模型名** —— 模型名称按 Trae 自身菜单的格式显示积分倍率(如 `GLM-5.2 · x0.79`),倍率随目录刷新更新。
|
|
31
32
|
- **DSH 本地工具循环** —— 通过 Trae `llm_utils_chat` 获取待执行的结构化 `tool_calls`,交由 DSH 自带的本地工具执行,再将工具结果回传模型。
|
|
32
33
|
- **中国区多账号切换** —— 自动发现 Trae CN 与 TRAE SOLO CN 本地登录账号,支持重新读取 Token 列表并选择账号;Token 不写入 DSH 设置。
|
|
33
34
|
- **只读积分与模型管理** —— 插件设置面板可分别查看 Work 积分与 DSH 可使用的通用积分,并刷新/启用 Trae 模型;只读查询不消耗积分。
|
package/lib/client.js
CHANGED
|
@@ -532,11 +532,7 @@ window.__ModuleLoader__.load({
|
|
|
532
532
|
className: "dsm-trae-model-name",
|
|
533
533
|
children: [model.name, model.creditMultiplier === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
534
534
|
className: "dsm-trae-model-name-rate",
|
|
535
|
-
children: [
|
|
536
|
-
"(",
|
|
537
|
-
model.creditMultiplier.toFixed(2),
|
|
538
|
-
"x)"
|
|
539
|
-
]
|
|
535
|
+
children: ["· x", model.creditMultiplier.toFixed(2)]
|
|
540
536
|
})]
|
|
541
537
|
})
|
|
542
538
|
})]
|
package/lib/index.d.ts
CHANGED
|
@@ -58,6 +58,15 @@ interface TraeModelInfo {
|
|
|
58
58
|
declare const FALLBACK_TRAE_MODELS: readonly TraeModelInfo[];
|
|
59
59
|
/** Exact DSH modalities for one catalog entry; absent metadata is text-only. */
|
|
60
60
|
declare function traeInputModalities(model: Pick<TraeModelInfo, 'input'>): TraeInputModality[];
|
|
61
|
+
/**
|
|
62
|
+
* Compose the DSH-facing model name: Trae's own model picker renders each
|
|
63
|
+
* entry as `Name · x<rate>`, so the credit multiplier is shown inside the
|
|
64
|
+
* name. `TraeModelInfo.name` keeps the pure Trae display name — every join
|
|
65
|
+
* (wire resolution, callable-key filtering) must keep matching the
|
|
66
|
+
* undecorated name; only the model rows handed to DSH (adapter catalog and
|
|
67
|
+
* model discovery) use this decorated name.
|
|
68
|
+
*/
|
|
69
|
+
declare function traeModelDisplayName(model: Pick<TraeModelInfo, 'name' | 'creditMultiplier'>): string;
|
|
61
70
|
/** Apply the user's explicit image opt-ins; upstream and saved row hints are ignored. */
|
|
62
71
|
declare function applyImageSelection(models: readonly TraeModelInfo[], selected: ReadonlySet<string>): TraeModelInfo[];
|
|
63
72
|
/** One row from `get_detail_param`: the authoritative llm_utils_chat wire id + display name. */
|
|
@@ -1020,7 +1029,15 @@ declare function registerTraeUsageRoute(ctx: Context, deps: TraeUsageRouteOption
|
|
|
1020
1029
|
//#region src/index.d.ts
|
|
1021
1030
|
declare const name = "dsh-connect-trae";
|
|
1022
1031
|
declare const inject: string[];
|
|
1023
|
-
|
|
1032
|
+
/**
|
|
1033
|
+
* Settings namespace, as a plain lowercase literal. DSH 0.1.2 removed the
|
|
1034
|
+
* `settingsNamespace` brand constructor from the npm package (the Desktop
|
|
1035
|
+
* host still ships it as a legacy shim), and every consumer of this constant —
|
|
1036
|
+
* `registerModelDiscovery`, `registerConfigurableProviders`,
|
|
1037
|
+
* `settings.installSection`, the settings test — takes it as a kebab string,
|
|
1038
|
+
* so no branding is needed for either host generation.
|
|
1039
|
+
*/
|
|
1040
|
+
declare const TRAE_SETTINGS_NS = "trae";
|
|
1024
1041
|
interface Config {
|
|
1025
1042
|
authFile?: string;
|
|
1026
1043
|
edition?: 'auto' | 'cn' | 'sg' | 'solo' | 'solo-sg';
|
|
@@ -1040,4 +1057,4 @@ interface Config {
|
|
|
1040
1057
|
declare const Config: z<Config>;
|
|
1041
1058
|
declare function apply(ctx: Context, config: Config): void;
|
|
1042
1059
|
//#endregion
|
|
1043
|
-
export { Config, FALLBACK_TRAE_MODELS, type RawChatDelta, type RawChatMessage, type RawChatTool, SseDecoder, type SseEvent, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_PAY_BASE, TRAE_PROVIDER, TRAE_RAW_CHAT_V1_PATH, TRAE_RAW_CHAT_V2_PATH, TRAE_REASONING_EFFORTS, 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 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 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, hashTraeRawChatArg, identityHeaders, inject, mergeTraeModelSources, name, normalizeTraeCredential, normalizeTraeVersionCode, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeRawChatBehaviorConfig, parseTraeRemoteModel, parseTraeStorageDocument, pickTraeStorageIdentity, prepareSoloBody, probeTraeRawChatCapability, rawCapabilityDiagnostic, rawCapabilityFingerprint, readTraeCachedModel, readTraeIdentity, refreshTraeCredential, registerTraeUsageRoute, resolveTraeRawRuntime, sanitizeCatalog, traeEndpoint, traeInputModalities, traeOwnAuthPath, traeRawChatExtraInfo, traeStorageCandidates, traeWebUsage };
|
|
1060
|
+
export { Config, FALLBACK_TRAE_MODELS, type RawChatDelta, type RawChatMessage, type RawChatTool, SseDecoder, type SseEvent, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_PAY_BASE, TRAE_PROVIDER, TRAE_RAW_CHAT_V1_PATH, TRAE_RAW_CHAT_V2_PATH, TRAE_REASONING_EFFORTS, 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 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 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, hashTraeRawChatArg, identityHeaders, inject, mergeTraeModelSources, name, normalizeTraeCredential, normalizeTraeVersionCode, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeRawChatBehaviorConfig, parseTraeRemoteModel, parseTraeStorageDocument, pickTraeStorageIdentity, prepareSoloBody, probeTraeRawChatCapability, rawCapabilityDiagnostic, rawCapabilityFingerprint, readTraeCachedModel, readTraeIdentity, refreshTraeCredential, registerTraeUsageRoute, resolveTraeRawRuntime, sanitizeCatalog, traeEndpoint, traeInputModalities, traeModelDisplayName, traeOwnAuthPath, traeRawChatExtraInfo, traeStorageCandidates, traeWebUsage };
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
|
-
import
|
|
2
|
+
import * as dshSettings from "@deepseek-ai/dsh-settings";
|
|
3
3
|
import { createProvider } from "@earendil-works/pi-ai";
|
|
4
4
|
import { openAICompletionsApi } from "@earendil-works/pi-ai/api/openai-completions.lazy";
|
|
5
5
|
import { resolveRetryPolicy } from "@deepseek-ai/dsh-llm";
|
|
@@ -42,6 +42,17 @@ const FALLBACK_TRAE_MODELS = [
|
|
|
42
42
|
function traeInputModalities(model) {
|
|
43
43
|
return [...model.input ?? ["text"]];
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Compose the DSH-facing model name: Trae's own model picker renders each
|
|
47
|
+
* entry as `Name · x<rate>`, so the credit multiplier is shown inside the
|
|
48
|
+
* name. `TraeModelInfo.name` keeps the pure Trae display name — every join
|
|
49
|
+
* (wire resolution, callable-key filtering) must keep matching the
|
|
50
|
+
* undecorated name; only the model rows handed to DSH (adapter catalog and
|
|
51
|
+
* model discovery) use this decorated name.
|
|
52
|
+
*/
|
|
53
|
+
function traeModelDisplayName(model) {
|
|
54
|
+
return model.creditMultiplier === void 0 ? model.name : `${model.name} · x${model.creditMultiplier.toFixed(2)}`;
|
|
55
|
+
}
|
|
45
56
|
/** Apply the user's explicit image opt-ins; upstream and saved row hints are ignored. */
|
|
46
57
|
function applyImageSelection(models, selected) {
|
|
47
58
|
return models.map((model) => ({
|
|
@@ -198,7 +209,7 @@ const REQUEST_IMAGE_BUDGETS = {
|
|
|
198
209
|
function toPiModel(info, baseUrl) {
|
|
199
210
|
return {
|
|
200
211
|
id: info.id,
|
|
201
|
-
name: info
|
|
212
|
+
name: traeModelDisplayName(info),
|
|
202
213
|
api: "openai-completions",
|
|
203
214
|
provider: TRAE_PROVIDER,
|
|
204
215
|
baseUrl,
|
|
@@ -2734,13 +2745,22 @@ var UnconfiguredTraeUpstreamClient = class {
|
|
|
2734
2745
|
//#region src/index.ts
|
|
2735
2746
|
const name = "dsh-connect-trae";
|
|
2736
2747
|
const inject = ["llm"];
|
|
2737
|
-
|
|
2748
|
+
/**
|
|
2749
|
+
* Settings namespace, as a plain lowercase literal. DSH 0.1.2 removed the
|
|
2750
|
+
* `settingsNamespace` brand constructor from the npm package (the Desktop
|
|
2751
|
+
* host still ships it as a legacy shim), and every consumer of this constant —
|
|
2752
|
+
* `registerModelDiscovery`, `registerConfigurableProviders`,
|
|
2753
|
+
* `settings.installSection`, the settings test — takes it as a kebab string,
|
|
2754
|
+
* so no branding is needed for either host generation.
|
|
2755
|
+
*/
|
|
2756
|
+
const TRAE_SETTINGS_NS = "trae";
|
|
2738
2757
|
const modelConfig = z.object({
|
|
2739
2758
|
id: z.string().required(),
|
|
2740
2759
|
name: z.string().required(),
|
|
2741
2760
|
contextWindow: z.number().step(1).min(1),
|
|
2742
2761
|
maxTokens: z.number().step(1).min(1),
|
|
2743
|
-
input: z.array(z.union(["text", "image"]))
|
|
2762
|
+
input: z.array(z.union(["text", "image"])),
|
|
2763
|
+
creditMultiplier: z.number()
|
|
2744
2764
|
});
|
|
2745
2765
|
const Config = z.object({
|
|
2746
2766
|
authFile: z.string().description("Optional Trae storage.json path override"),
|
|
@@ -2867,7 +2887,7 @@ function apply(ctx, config) {
|
|
|
2867
2887
|
discoverModels,
|
|
2868
2888
|
rawDiagnostic: () => rawDiagnostic()
|
|
2869
2889
|
}));
|
|
2870
|
-
|
|
2890
|
+
const sectionHooks = {
|
|
2871
2891
|
setSource(source) {
|
|
2872
2892
|
current = source;
|
|
2873
2893
|
},
|
|
@@ -2877,6 +2897,11 @@ function apply(ctx, config) {
|
|
|
2877
2897
|
catalog.set(configuredModels(next));
|
|
2878
2898
|
invalidateAdapter();
|
|
2879
2899
|
}
|
|
2900
|
+
};
|
|
2901
|
+
const legacyInstallSettingsSection = dshSettings.installSettingsSection;
|
|
2902
|
+
if (typeof legacyInstallSettingsSection === "function") legacyInstallSettingsSection(ctx, TRAE_SETTINGS_NS, Config, config, sectionHooks);
|
|
2903
|
+
else ctx.inject(["settings"], (settingsCtx) => {
|
|
2904
|
+
settingsCtx.settings.installSection(ctx, TRAE_SETTINGS_NS, Config, config, sectionHooks);
|
|
2880
2905
|
});
|
|
2881
2906
|
let stopped = false;
|
|
2882
2907
|
ctx.effect(() => () => {
|
|
@@ -2903,11 +2928,12 @@ function apply(ctx, config) {
|
|
|
2903
2928
|
let releaseDirectory;
|
|
2904
2929
|
try {
|
|
2905
2930
|
releaseAdapter = ctx.llm.registerAdapter([TRAE_PROVIDER], trae.adapter);
|
|
2906
|
-
ctx.llm.registerModelDiscovery(TRAE_SETTINGS_NS, async (request) => {
|
|
2931
|
+
ctx.llm.registerModelDiscovery(TRAE_SETTINGS_NS, async (request, signal) => {
|
|
2907
2932
|
if (request.provider !== "trae") return [];
|
|
2908
|
-
|
|
2933
|
+
const cancellation = signal ?? request.signal;
|
|
2934
|
+
return applyImageSelection(await discoverModels(cancellation), imageSet(current())).map((model) => ({
|
|
2909
2935
|
id: model.id,
|
|
2910
|
-
name: model
|
|
2936
|
+
name: traeModelDisplayName(model),
|
|
2911
2937
|
...model.contextWindow === void 0 ? {} : { contextWindow: model.contextWindow },
|
|
2912
2938
|
...model.maxTokens === void 0 ? {} : { maxTokens: model.maxTokens },
|
|
2913
2939
|
inputModalities: traeInputModalities(model)
|
|
@@ -2940,4 +2966,4 @@ function apply(ctx, config) {
|
|
|
2940
2966
|
});
|
|
2941
2967
|
}
|
|
2942
2968
|
//#endregion
|
|
2943
|
-
export { Config, FALLBACK_TRAE_MODELS, SseDecoder, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_PAY_BASE, TRAE_PROVIDER, TRAE_RAW_CHAT_V1_PATH, TRAE_RAW_CHAT_V2_PATH, TRAE_REASONING_EFFORTS, 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, hashTraeRawChatArg, identityHeaders, inject, mergeTraeModelSources, name, normalizeTraeCredential, normalizeTraeVersionCode, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeRawChatBehaviorConfig, parseTraeRemoteModel, parseTraeStorageDocument, pickTraeStorageIdentity, prepareSoloBody, probeTraeRawChatCapability, rawCapabilityDiagnostic, rawCapabilityFingerprint, readTraeCachedModel, readTraeIdentity, refreshTraeCredential, registerTraeUsageRoute, resolveTraeRawRuntime, sanitizeCatalog, traeEndpoint, traeInputModalities, traeOwnAuthPath, traeRawChatExtraInfo, traeStorageCandidates, traeWebUsage };
|
|
2969
|
+
export { Config, FALLBACK_TRAE_MODELS, SseDecoder, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_PAY_BASE, TRAE_PROVIDER, TRAE_RAW_CHAT_V1_PATH, TRAE_RAW_CHAT_V2_PATH, TRAE_REASONING_EFFORTS, 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, hashTraeRawChatArg, identityHeaders, inject, mergeTraeModelSources, name, normalizeTraeCredential, normalizeTraeVersionCode, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeRawChatBehaviorConfig, parseTraeRemoteModel, parseTraeStorageDocument, pickTraeStorageIdentity, prepareSoloBody, probeTraeRawChatCapability, rawCapabilityDiagnostic, rawCapabilityFingerprint, readTraeCachedModel, readTraeIdentity, refreshTraeCredential, registerTraeUsageRoute, resolveTraeRawRuntime, sanitizeCatalog, traeEndpoint, traeInputModalities, traeModelDisplayName, traeOwnAuthPath, traeRawChatExtraInfo, traeStorageCandidates, traeWebUsage };
|
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": "1.
|
|
5
|
+
"version": "1.3.0",
|
|
6
6
|
"author": "dingminhua",
|
|
7
7
|
"copyright": "Copyright (c) 2026 LaoDing",
|
|
8
8
|
"license": "MIT",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"client": {
|
|
55
55
|
"inject": [
|
|
56
|
-
"@deepseek-ai/dsh-client-
|
|
56
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
57
57
|
"@deepseek-ai/dsh-client-ui-settings",
|
|
58
58
|
"@deepseek-ai/dsh-client-ui-slots",
|
|
59
59
|
"@deepseek-ai/dsh-client-ui-settings-plugins",
|
|
@@ -86,21 +86,22 @@
|
|
|
86
86
|
"react": "^18.2.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
90
|
-
"@deepseek-ai/dsh-atomic-write": "^0.1.
|
|
91
|
-
"@deepseek-ai/dsh-attachment": "^0.1.
|
|
92
|
-
"@deepseek-ai/dsh-client-locale": "0.1.
|
|
93
|
-
"@deepseek-ai/dsh-client-
|
|
94
|
-
"@deepseek-ai/dsh-client-ui-settings
|
|
95
|
-
"@deepseek-ai/dsh-client-ui-
|
|
96
|
-
"@deepseek-ai/dsh-client-ui-
|
|
97
|
-
"@deepseek-ai/dsh-
|
|
98
|
-
"@deepseek-ai/dsh-
|
|
99
|
-
"@deepseek-ai/dsh-
|
|
100
|
-
"@deepseek-ai/dsh-llm
|
|
101
|
-
"@deepseek-ai/dsh-
|
|
102
|
-
"@deepseek-ai/
|
|
103
|
-
"@
|
|
89
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
90
|
+
"@deepseek-ai/dsh-atomic-write": "^0.1.2-rc.1",
|
|
91
|
+
"@deepseek-ai/dsh-attachment": "^0.1.2-rc.1",
|
|
92
|
+
"@deepseek-ai/dsh-client-locale": "0.1.2-rc.1",
|
|
93
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.1.2-rc.1",
|
|
94
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.1.2-rc.1",
|
|
95
|
+
"@deepseek-ai/dsh-client-ui-settings-plugins": "0.1.2-rc.1",
|
|
96
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.1.2-rc.1",
|
|
97
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.1.2-rc.1",
|
|
98
|
+
"@deepseek-ai/dsh-home-paths": "^0.1.2-rc.1",
|
|
99
|
+
"@deepseek-ai/dsh-host-webserver": "0.1.2-rc.1",
|
|
100
|
+
"@deepseek-ai/dsh-llm": "^0.1.2-rc.1",
|
|
101
|
+
"@deepseek-ai/dsh-llm-pi-ai": "^0.1.2-rc.1",
|
|
102
|
+
"@deepseek-ai/dsh-settings": "^0.1.2-rc.1",
|
|
103
|
+
"@deepseek-ai/schemastery": "3.18.2",
|
|
104
|
+
"@earendil-works/pi-ai": "0.84.2",
|
|
104
105
|
"@types/node": "^22.20.0",
|
|
105
106
|
"@types/react": "~18.3.31",
|
|
106
107
|
"react": "^18.3.1",
|