dsh-connect-trae 4.10.0 → 4.15.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 +598 -5
- package/README.en.md +17 -1
- package/README.md +16 -1
- package/docs/assets/dsh-connect-trae-composer-credits.png +0 -0
- package/docs/assets/dsh-connect-trae-sidebar-page.png +0 -0
- package/docs/assets/dsh-connect-trae-usage-card.png +0 -0
- package/lib/client.js +1186 -477
- package/lib/index.d.ts +82 -1
- package/lib/index.js +608 -109
- package/package.json +8 -1
package/README.en.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
<img src="docs/assets/dsh-connect-trae-usage-card.png" width="860" alt="dsh-connect-trae settings panel" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
+
> Account names, balances and timestamps in this document and its screenshots are **demo data** (`demo-*`); no real account information is shown.
|
|
6
|
+
|
|
5
7
|
<h1 align="center">dsh-connect-trae</h1>
|
|
6
8
|
|
|
7
9
|
<p align="center"><b>Connect locally signed-in Trae models to DeepSeek Harness with local DSH tools, a credits overview, and daily check-in claiming.</b></p>
|
|
@@ -32,6 +34,11 @@ A [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) bund
|
|
|
32
34
|
|
|
33
35
|
> **Boundary: this plugin does not interoperate with any other plugin.** Accounts, credentials, the model directory, the account pool and the settings namespace belong to this plugin alone; a `trae` failure never borrows another plugin's account or credit, and vice versa. Why, and what that rules out, is in [Relationship to other plugins](#relationship-to-other-plugins).
|
|
34
36
|
|
|
37
|
+
### Icon style
|
|
38
|
+
|
|
39
|
+
In the account pool, open **More settings** and choose **Claude style** or **Default icon**. The sidebar and page icons update immediately. The choice is stored in the current browser; other browsers keep their own choice.
|
|
40
|
+
|
|
41
|
+
|
|
35
42
|
## Features
|
|
36
43
|
|
|
37
44
|
- **Three parallel providers** — the CN side registers as the `trae` provider (e.g. `DeepSeek-V4-Flash`, `DeepSeek-V4-Pro`), the enterprise side as `trae-enterprise`, and the international side as `trae-global` (the Gemini/GPT/MiniMax roster); **all three rosters appear in the DSH model picker simultaneously**: different sessions can each pick a side without interfering.
|
|
@@ -40,7 +47,7 @@ A [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) bund
|
|
|
40
47
|
- **Tabbed settings card** — the card's top carries a "Domestic / Enterprise / Global" tab bar; each tab holds its own account picker, usage overview, and model management. Account, directory, selection, and unsaved drafts are fully isolated per tab — switching accounts or refreshing models on one tab never touches the other side's runtime catalog or sessions. CN and enterprise share one CN credential pool but keep **separate account bindings and model picks**: the two rosters differ (`DeepSeek-V4.1-Flash` is listed only on the enterprise pool), so picks never overwrite each other.
|
|
41
48
|
- **The card then splits into "Account / Models / Diagnostics"** (learned from the sibling `dsh-connect-workbuddy`). The region row above is the **scope** — which provider this whole card is about — while these are sections of that one card: Account covers who serves, what is left, the check-in and the pool; Models covers which models to tick, image input, the context budget and Save; Diagnostics read-only lists the panel, the provider id, the serving account, both token deadlines, the catalog/enabled model counts, whether the pool and the check-in are offered, and the **verbatim** text of this panel's last reported failure. **As of 4.4.7 the diagnostics section carries one more line, "quarantined copies"**: a credential copy that could not be read — and was therefore renamed aside instead of being erased — is named there, together with how many accounts it still holds. "Where did the account I remember go?" is now answered by the card instead of by browsing `~/.dsh` for a file name; the signed-out screen shows the same notice, because that is the screen a user lands on after an account disappears. The split exists because the two halves **commit differently**: an account change lands on the click, a catalog change is a draft until Save — so a single long column put the save button three screens away from what it saves. Switching sections never refetches, never drops a half-filled model draft, and never rebuilds the pool's log. A signed-out card renders no section strip, so its one screen of instructions cannot be hidden behind a tab the user cannot see. **The Models section lays every model out at once, with no inner scrollbar** — it is not a little window scrolling inside a page that already scrolls; the card's own page is the only scroll.
|
|
42
49
|
- **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.
|
|
43
|
-
- **Promotion badge** — Trae publishes its discount rules in the model directory (`activity_discount`: pay ratio, list price, off-peak windows with their time zone). The plugin judges them against **the clock at render time** and paints one capsule beside the model name (`5 折` / `off-peak 5 折` / `limited 5 折`), with the old price, the new price and the window on hover. Judging at render time is what keeps a night-time discount from still hanging there the next morning; when upstream says nothing is discounted right now no badge is painted, the multiplier is never used to guess a promotion, and no campaign without an end time is labelled "limited". It is information only: no request and no billing changes, and the international region (subscription) has no such data and therefore shows no badge. See [docs/PROMO_BADGE.md](docs/PROMO_BADGE.md).
|
|
50
|
+
- **Promotion badge** — Trae publishes its discount rules in the model directory (`activity_discount`: pay ratio, list price, off-peak windows with their time zone). The plugin judges them against **the clock at render time** and paints one capsule beside the model name (`5 折` / `off-peak 5 折` / `limited 5 折`), with the old price, the new price and the window on hover. Judging at render time is what keeps a night-time discount from still hanging there the next morning; when upstream says nothing is discounted right now no badge is painted, the multiplier is never used to guess a promotion, and no campaign without an end time is labelled "limited". It is information only: no request and no billing changes, and the international region (subscription) has no such data and therefore shows no badge. See [docs/PROMO_BADGE.md](docs/PROMO_BADGE.md). **The same capsule is drawn in DSH's own model picker** (the host's `conversation.input.model.label` slot), where the choice is actually made — a badge you only read in the settings card arrives after you have already picked. In the picker **the multiplier appears exactly once**: the catalog rate embedded in the name is pulled back out and, while a discount runs, replaced by the **discounted** price (same clock, same data as the card), and opening the picker triggers no extra upstream read. **And the plugin also publishes its own selector badge now**: through `LlmModelInfo.badge` it hands over **the promotion running right now** (`5 折` / `off-peak 5 折` / `limited 5 折`), from the same data and the same judgement the card uses. The clock is read where the host rebuilds the catalog (`listModels()`), so a closed window stops appearing, and one instant covers the whole directory. The picker's label slot is `single`, so the plugin that wins it draws every provider's rows; a connector that publishes no badge has bare rows the moment another plugin holds that cell.
|
|
44
51
|
- **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.
|
|
45
52
|
- **Text-to-image (`trae_draw_image`)** — brings the signed-in account's Trae text-to-image service into the conversation: the model draws one image and the plugin **fetches the bytes too**, writes them under the session cwd and shows the picture inline. **Off by default, enabled per panel** — generation really spends credits (measured: ~8.8 for one `1920x1920` on CN personal), so unlike the image-input declaration it only happens when you say so. Protocol, size bounds, the two-step fetch and why the old "fetch" GET is really a second generation are in "Text-to-image" below.
|
|
46
53
|
- **Dual-region detection (CN / international)** — detects local sign-ins across Trae CN, TRAE SOLO CN, Trae, and TRAE SOLO installs. The region is derived from the credential's own `userRegion` claim (host suffix and edition label as fallbacks), with no manual switch. **The US cluster (`userRegion: "US"` / `*.traeapi.us`) is recognized but not served yet**: a US credential is never routed to the Singapore gateways; the account panel names the account and says the region is unsupported, and that signing in again changes nothing (issue #66).
|
|
@@ -66,6 +73,10 @@ A [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) bund
|
|
|
66
73
|
|
|
67
74
|
- **Secure loopback shim** — one random port + in-process random secret per region; the real Trae token is never handed to pi-ai.
|
|
68
75
|
|
|
76
|
+
### Daily automatic check-in
|
|
77
|
+
|
|
78
|
+
The domestic personal account pool offers automatic check-in, disabled by default. Enable and save to check in selected members while DSH runs. Progress survives restarts and failed attempts retry with backoff. This setting is independent of automatic billing selection. Trae limits daily rewards per device, so not every member can receive a reward. Global and enterprise panels do not offer automatic check-in.
|
|
79
|
+
|
|
69
80
|
## How it works
|
|
70
81
|
|
|
71
82
|
```text
|
|
@@ -369,6 +380,11 @@ Local dev via a `link:` install to the desktop profile (restart DSH Desktop afte
|
|
|
369
380
|
dsh plugin --profile desktop add /path/to/dsh-connect-trae
|
|
370
381
|
```
|
|
371
382
|
|
|
383
|
+
**Read [AGENTS.md](AGENTS.md) before you start.** It states the two hard rules for this
|
|
384
|
+
repository: what must never enter the repo or the published package (details in
|
|
385
|
+
[SECURITY.md](SECURITY.md)), and how to prove a change is correct. Read it in particular
|
|
386
|
+
before adding or replacing any screenshot under `docs/assets/` — mosaic is not redaction.
|
|
387
|
+
|
|
372
388
|
## Acknowledgements
|
|
373
389
|
|
|
374
390
|
- [Wang-JQ77/dsh-trae-api](https://github.com/Wang-JQ77/dsh-trae-api) (MIT) — Reference implementation for research into Trae authentication, sessions, and model protocols.
|
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
<img src="docs/assets/dsh-connect-trae-usage-card.png" width="860" alt="dsh-connect-trae settings panel" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
+
> 本文与配图中的账号名、额度与时间**均为演示数据**(`demo-*`),不含任何真实账号信息。
|
|
6
|
+
|
|
5
7
|
<h1 align="center">dsh-connect-trae</h1>
|
|
6
8
|
|
|
7
9
|
<p align="center"><b>把本机登录的 Trae 模型接入 DeepSeek Harness,并提供用量/积分概览与每日签到领取。</b></p>
|
|
@@ -32,6 +34,11 @@
|
|
|
32
34
|
|
|
33
35
|
> **边界:本插件不与任何其它插件联动。** 账号、凭据、模型目录、账号池与设置命名空间都只属于本插件;`trae` 失败不会借用别的插件的账号或额度,反之亦然。理由与具体含义见[与其它插件的关系](#与其它插件的关系)。
|
|
34
36
|
|
|
37
|
+
### 图标样式
|
|
38
|
+
|
|
39
|
+
在账号池的「更多设置」中选择 Claude 风格或默认图标。选择会立即应用到侧边栏和页面,并保存在当前浏览器中;其他浏览器需要单独设置。
|
|
40
|
+
|
|
41
|
+
|
|
35
42
|
## 功能特性
|
|
36
43
|
|
|
37
44
|
- **三供应商并行接入** —— 国内版注册为 DSH 的 `trae` provider(`DeepSeek-V4-Flash`、`DeepSeek-V4-Pro` 等),企业版注册为 `trae-enterprise`,国际版注册为 `trae-global`(Gemini / GPT / MiniMax 阵容),**三边模型同时出现在 DSH 模型选择器里**:不同会话可以各选一边,互不干扰。
|
|
@@ -44,7 +51,7 @@
|
|
|
44
51
|
> 池是**显式选择**:默认关闭。它不会替你在没打开池的情况下换账号——「换账号等于换人计费」,所以这件事只能由你点头。池打开后卡片会明确写出**当前是谁在付费**(Host 报告的是「下一个真正发送请求的账号」,不是保存的那个绑定)。
|
|
45
52
|
|
|
46
53
|
- **倍率内嵌模型名** —— 模型名称按 Trae 自身菜单的格式显示积分倍率(如 `GLM-5.2 · x0.79`),倍率随目录刷新更新。
|
|
47
|
-
- **活动优惠徽标** —— Trae 把促销规则发在目录里(`activity_discount`:折扣比例、原价、闲时时段与时区),插件按**当前时钟**判定后,在模型名旁边画一枚胶囊:`5 折` / `闲时 5 折` / `限时 5 折`,悬停写明原价、现价与时段。判定放在**渲染时刻**而不是解析时刻,所以夜间折扣不会在第二天早上继续挂着;上游说「此刻没打折」就不画,**不从倍率反推**,也不给没有结束时间的活动编「限时」。这是纯提示:不改请求、不改计费,国际区(订阅制)没有这项数据因此不显示。详见 [docs/PROMO_BADGE.md](docs/PROMO_BADGE.md)。**同一枚胶囊也画在 DSH 的模型选择器里**(宿主 `conversation.input.model.label`
|
|
54
|
+
- **活动优惠徽标** —— Trae 把促销规则发在目录里(`activity_discount`:折扣比例、原价、闲时时段与时区),插件按**当前时钟**判定后,在模型名旁边画一枚胶囊:`5 折` / `闲时 5 折` / `限时 5 折`,悬停写明原价、现价与时段。判定放在**渲染时刻**而不是解析时刻,所以夜间折扣不会在第二天早上继续挂着;上游说「此刻没打折」就不画,**不从倍率反推**,也不给没有结束时间的活动编「限时」。这是纯提示:不改请求、不改计费,国际区(订阅制)没有这项数据因此不显示。详见 [docs/PROMO_BADGE.md](docs/PROMO_BADGE.md)。**同一枚胶囊也画在 DSH 的模型选择器里**(宿主 `conversation.input.model.label` 插槽),挑模型时就能看见——毕竟徽标画在设置卡片里时,你已经选完了。选择器里**倍率只出现一次**:名字里已有的目录倍率会被拆出来,有折扣时换成**折后价**(与卡片同一套时钟判定,同一份数据),打开选择器不会额外触发上游读。**现在本插件也发布自己的选择器徽标**:通过 `LlmModelInfo.badge` 把**此刻正在跑的促销**交出去(`5 折` / `闲时 5 折` / `限时 5 折`),与卡片上是同一份数据、同一个判定。时钟在宿主重建目录的那一刻(`listModels()`)读,所以窗口一关就不会再挂在那儿;整个目录只取一次时间。选择器的标签槽是 `single`,赢家替**所有** provider 的行画;插件不发布 `badge`,一旦别的插件占了那格,本插件的行就什么装饰都没有。
|
|
48
55
|
- **DSH 本地工具循环** —— 通过 Trae `llm_utils_chat` 获取待执行的结构化 `tool_calls`,交由 DSH 自带的本地工具执行,再将工具结果回传模型。
|
|
49
56
|
- **文生图(`trae_draw_image`)** —— 把登录账号的 Trae 文生图能力接进会话:模型画一张图,插件把**图片字节一起取回来**、写进会话目录再显示给你。**默认关闭、按面板单独开**——生图真实消耗积分(实测 CN 个人版 `1920x1920` 一张约 8.8),所以它和识图那种「让不让看图」的开关不同,只能由你点头。协议、尺寸边界、取图那两步,以及为什么「取图」那条 GET 其实是又一次生成,见下方「[文生图](#文生图trae_draw_image)」。
|
|
50
57
|
- **国内国际双区域自动识别** —— 自动发现 Trae CN / TRAE SOLO CN / Trae / TRAE SOLO 四个本地安装的登录账号;区域由凭证自带的 `userRegion` 声明自动判定(host 后缀与 edition 标签兜底),无需手动指定。**美国区(`userRegion: "US"` / `*.traeapi.us`)目前「识别但不接入」**:插件不会把 US 凭据当成新加坡区发出去,而会在账号面板明确写「美国区(US)暂不支持」并点名账号,同时说明重新登录不会改变结果(issue #66)。
|
|
@@ -71,6 +78,10 @@
|
|
|
71
78
|
|
|
72
79
|
- **安全 loopback shim** —— 每区域一个随机端口 + 进程内随机 secret,真实 Trae token 不交给 pi-ai。
|
|
73
80
|
|
|
81
|
+
### 每日自动签到
|
|
82
|
+
|
|
83
|
+
国内版账号池支持每日自动签到,默认关闭。开启并保存后,插件在 DSH 运行期间为勾选的个人账号签到,重启后保留当天进度,失败自动重试。此开关独立于账号池的自动挑号开关。Trae 对每台设备的每日奖励设有限制,不能保证每个成员都能领取。国际版与企业版不提供此功能。
|
|
84
|
+
|
|
74
85
|
## 工作原理
|
|
75
86
|
|
|
76
87
|
```text
|
|
@@ -450,6 +461,10 @@ pnpm run check # typecheck + test + build
|
|
|
450
461
|
dsh plugin --profile desktop add /path/to/dsh-connect-trae
|
|
451
462
|
```
|
|
452
463
|
|
|
464
|
+
**动手前先读 [AGENTS.md](AGENTS.md)**:它列了本仓库的两条硬约束——什么不能进入仓库
|
|
465
|
+
与发布物(细节见 [SECURITY.md](SECURITY.md))、以及改完怎么验证。新增或替换
|
|
466
|
+
`docs/assets/` 下的截图前尤其要看,马赛克不算脱敏。
|
|
467
|
+
|
|
453
468
|
## 致谢
|
|
454
469
|
|
|
455
470
|
- [Wang-JQ77/dsh-trae-api](https://github.com/Wang-JQ77/dsh-trae-api)(MIT)— Trae 认证、会话和模型协议研究的参照实现。
|
|
Binary file
|
|
Binary file
|
|
Binary file
|