dsh-wtq-pool 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +60 -49
- package/README.en.md +53 -22
- package/README.md +57 -25
- package/cordis.patch.yml +2 -0
- package/lib/client.js +47 -1
- package/lib/index.d.ts +18 -21
- package/lib/index.js +3909 -1289
- package/package.json +7 -26
- package/renderer/panel.js +152 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,63 +1,74 @@
|
|
|
1
1
|
# 更新说明
|
|
2
2
|
|
|
3
|
-
## [1.0.
|
|
3
|
+
## [1.0.4]
|
|
4
|
+
|
|
5
|
+
- Trae、Qoder 的流式回复改为单循环推送:宿主不再反复回调读取,回复不会中途停住;网关先发出响应头,再从桥接流直接泵出,不再读 `Response` 的 body,也不再经过 `Readable.fromWeb`。
|
|
6
|
+
- Qoder 在结束帧后最多等 1 秒:没有后续帧就补上 `[DONE]` 并关闭,用量帧到达则立即收尾,回复写完不再一直显示未完成(上一版的一秒宽限只取消了上游读取,没有关闭转发流)。
|
|
7
|
+
- WorkBuddy 网关同样先发出响应头;其余行为不变。
|
|
8
|
+
- 面板的签到汇总按三家合计显示领取账号数,不再只算 WorkBuddy。
|
|
9
|
+
- 网关拒绝跨站请求(`Sec-Fetch-Site: cross-site`),面板的 `/invoke` 只接受 JSON;本机客户端与面板自身不受影响。
|
|
10
|
+
- 面板的签到日志持续轮询到结束,模型勾选与自动签到时间的未保存草稿不再被轮询覆盖,日志不再强制滚到底部,账号名单读取失败后可以重试。
|
|
11
|
+
- 客户端提前断开时桥接流一并取消,泵送不再向已关闭的响应写入,释放读锁不再抛出。
|
|
4
12
|
|
|
5
|
-
|
|
13
|
+
## [1.0.3]
|
|
6
14
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
15
|
+
- WorkBuddy 国际版补齐会话头族与版本 UA,不再被渠道校验回 400 / 11128;不带会话标记的 401(含网关返回的 HTML 拒绝页)按登录失效分类并换号。
|
|
16
|
+
- WorkBuddy 拿不到本机密钥、或刷新令牌过期但访问令牌仍有效时账号不再从账号池消失;刷新到的新令牌不再被下一次扫描换回磁盘上的旧值,余额重新读到积分时释放扣留。
|
|
17
|
+
- 额度用尽与登录失效退出轮换,直到余额重新读到或重新登录;400 / 422 提到额度、429 响应体里的额度文案都不再被读成余额耗尽。
|
|
18
|
+
- 上游主机不可达(DNS、连接重置、TLS、30x 重定向)时换下一个登录重试,不再直接给客户端 502;调用方挂断(含首字节前的 peek 阶段)不算上游故障,不冷却健康账号。
|
|
19
|
+
- 上游只在 `Retry-After` 响应头给出等待时按它冷却并透传给客户端(截到两小时);响应头超时只覆盖等响应头,流中途的静默交给空闲看门狗。
|
|
20
|
+
- 调用方挂断后上游请求真正被拆掉,错误响应体在挂断或超限时立即取消;WorkBuddy 流中途失败改为发出带内错误帧、终止帧与 `[DONE]`。
|
|
21
|
+
- 超过 64 MiB 的请求体先排空再关闭并回 413;peek 期间连接中断不再绕过故障转移。
|
|
22
|
+
- Trae、Qoder 的第一个登录不可用时自动换下一个,模型目录也换号读,不再整个网关答 503;Trae 的登录拒绝与流内拒绝(订阅门槛、队列帧等)按真实状态码应答。
|
|
23
|
+
- Qoder 的失败帧(空 choices、字符串 `error`/`details`、`errcode` 拼写、嵌套确认码)都按真实编码换号或冷却。
|
|
24
|
+
- Qoder 的一轮在结束帧后即向客户端收尾,只留一秒等尾随的用量帧,不再等上游关闭连接。
|
|
25
|
+
- Trae 的每个存储文件只在第一个认领它的版本下探一次;一台安装登录多个账号时明确报告设备号是回退值。
|
|
26
|
+
- Qoder 发布目录给出的最大上下文窗口,不再在 200K 处截断;数字时间戳的到期时间不再被当成永不过期。
|
|
27
|
+
- Trae、Qoder 的登录发现按 30 秒缓存,Qoder 不再每个请求 spawn PowerShell 解密钥;目录读取失败进入 30 秒退避。
|
|
28
|
+
- Trae 与 Qoder 的 SSE 解码支持单独 CR 行分隔与 64 MiB 单行上限,`data:` 数组不再一直涨;中继按客户端消费速度读上游,慢客户端不再把整份回复缓存在网关里。
|
|
29
|
+
- 模型名册只有真读到的那份才算数:读取超时留下的兜底列表不再被拿来判定「已下线」;进入面板会自动重新拉一次名册,读取失败或账号扫描尚未完成时按 15 秒重试,保存的模型选择因此能正确生效,不再每次启动都显示全部、也不再挂着提示。
|
|
30
|
+
- 模型页保存的思考等级与上游声明的 `defaultEffort` 都生效,不再显示「高级」却发布兜底等级。
|
|
31
|
+
- 设置文档与面板保存共用同一组边界(积分保底、模型 id 长度、覆写表大小、token 预算、模型 id 条数);`enabledModelIds: []` 对 Trae 与 Qoder 也禁用全部模型;只由标点组成的别名不再把模型移除;旧版 `imageModelIds` 与 `contextBudgets` 折进模型覆写。
|
|
32
|
+
- provider 行只在网关预热时保留,退出登录后不再常驻;网关启动失败不再被当成「还在预热」,模型组摘掉、连接检查报出原因。
|
|
33
|
+
- 账号池刷新:强制刷新不再放行式交接;`authFile` 改指后补一次扫描且旧目录不写回;宿主设置变更只在来源开关时重置缓存;全部冷却时面板继续轮询,停用账号退出探测;某个 region 启动失败只记警告并继续。
|
|
34
|
+
- 面板与命令:`/invoke` 等待期间关闭面板不再让插件子进程死亡;补上内容安全策略、框架祖先限制与 `nosniff`;输入框积分浮层在功能关闭后停止轮询并区分两种未知;两条命令同时运行时各自汇报自己的结果;被其他操作清掉的顶部警告会重新出现,放弃轮询时「检测中」会收尾。
|
|
35
|
+
- 签到与领取:Trae 签到响应缺省 `enable` 时不再被当成未开通;Qoder 的领取读完整响应体(不再按错误体的 300 字节截断),带 `grantId`/金额的已发放响应不再被报成「跳过」,200 里的业务错误码按失败上报并带上游原话;拒绝里带「already」不再算当天已领,连登奖励不再空转,重启不重跑整天、时段落盘保留三天,停启后各类签到重新起跑,报告不再出现空行;Trae 返回 9074 时在失败原因里说明设备号来源。
|
|
36
|
+
- 签到一次只跑一轮:单账号签到与整批签到互斥,面板的整批签到也记下当次时段,定时任务不再一分钟后再跑一遍;旅行的失败进入计数;Qoder 活动列表读取失败与「该账号无签到活动」分开显示;面板不再把签到失败显示成「今天都已签到」,失败会带原因说出来。
|
|
37
|
+
- 上游响应体无论是否为 JSON 都先脱敏再转给客户端;手写签到时段里的空值不再被当成 00:00。
|
|
38
|
+
- 连接检查自身抛错会写进报告,超时后的回退读取受剩余预算约束;at-rest 的可执行文件候选只收文件,注册表扫描结果按进程缓存。
|
|
39
|
+
- 同伴依赖收紧到 `@deepseek-ai/*` 0.2.0 线与 `@earendil-works/pi-ai` `>=0.82.1 <0.88.0`,pi-ai 代际在激活时校验;新增 `prepare` 脚本,按仓库地址安装时从源码构建;旧版 schemastery 上 volatile 字段降级时给出告警。
|
|
11
40
|
|
|
12
|
-
|
|
41
|
+
## [1.0.2]
|
|
13
42
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
43
|
+
- 输入框积分弹层的「刷新」按宿主中继的时限留出余量作答,不再超时并连累弹层其他按钮;未完成的探测仍在后台写入缓存。
|
|
44
|
+
- 设置保存里越界的 token 预算在保存前挡下,不再让整批改动被拒收。
|
|
45
|
+
- 签到开关在小时框留有无效文本时仍可关闭,不再把计时器留在运行状态;签到结束后重新拉取日志,手动结果即时可见。
|
|
46
|
+
- 面板框在文档就位、内容尚未到达的瞬间不再读到空对象;标题栏警告随问题消失而清除。
|
|
47
|
+
- 账号卡与设置卡单列堆叠、间距收紧,多数窗口不必滚动即可看全;签到日志框限高可滚动,新结果自动滚到可见处。
|
|
48
|
+
- 输入框积分弹层宽度随内容变化并对齐触发器右侧,高度上限连内边距一起计算;账号名过长时在列内截断并保留悬停提示;切换账号后积分不再短暂显示「—」。
|
|
19
49
|
|
|
20
50
|
## [1.0.1]
|
|
21
51
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
- Trae 拒绝回包中途断开时保留上游真实状态码,429 保留软限流分类;Qoder 登录过期帧不再被嵌套对象覆盖,每日限额的等待时长在消息内携带时也能读到。
|
|
34
|
-
- 修复国内 Trae、Qoder 的有效登录被误判为已过期,账号池因此为空、对应网关不可用的问题;没有过期时间的登录不再被当成已过期。
|
|
35
|
-
- Trae、Qoder 的轮流使用只在对话请求上换号,刷新模型列表和健康检查不再拨动游标;首选来源账号改名后,轮询与到期排序不再因旧标签永久停用;连登奖励只兑换已解锁的档位,签到程序关闭时不再被计为已领取。
|
|
36
|
-
- 输入框积分框切换账号时会报告结果:切到当前不能服务的账号时说明选择已保存、恢复后自动生效;刷新后账号已被停用则明确报无法切换,而不是假装已切过去。
|
|
37
|
-
- 模型 id 为 `__proto__` 时按普通 id 保存与读回;provider 注册失败时清空发现缓存,不再返回已释放的模型;到期时间或令牌刷新返回异常时长时按默认有效期记录,面板照常打开。
|
|
38
|
-
- 面板配色统一为同一组低饱和色相,四个语义色在暗色与亮色下协调一致,亮色下警告色与输入框积分圆点的对比度、模型页选中项的悬停配色一并修正。
|
|
39
|
-
- 显示名、包名与仓库名统一为 **WTQ Pool** / `dsh-wtq-pool`(WorkBuddy / Trae / Qoder 三个来源的首字母),插件卡片、模型选择器与面板标题一致;命令 id 与设置命名空间不变,升级后原有配置照常生效。
|
|
40
|
-
- Trae 模型目录自带的倍率传到面板,模型行显示 `x0.79` 这样的费率标签,模型选择器里的名称带上同一后缀,未给出费率的模型保持不标注;面板右下角的入口收成一排 GitHub、npm、文档与许可四个链接,标签跟随界面语言。
|
|
41
|
-
- 中英文文档明确 WorkBuddy 故障转移、Trae/Qoder 分发限制、主题重载与本地安装方式;报错指引与日志中的平台残留已清理,网关拒绝凭据的提示改为指向连接检查。
|
|
52
|
+
- 设置保存改用插件条目的实际命名空间,来源开关、区域开关、签到与模型选择都能存下来;宿主设置读取失败时保留上一次读到的设置。
|
|
53
|
+
- 面板路由挂载早于引擎就绪的窗口期不再报 500;某条路由注册失败时释放已注册的部分,不再让面板卡在半挂载。
|
|
54
|
+
- 「重新检测账号」与加载期把账号扫描和网关启动纳入整段预算,按时应答,未完成的部分由后台刷新补齐;重新检测会移除登录文件已不在的 WorkBuddy 账号。
|
|
55
|
+
- 输入框积分弹窗的「刷新」按总预算逐账号补读,多账号机器上不再逐个等满;首次读取 WorkBuddy 积分自动触发后台探测,冷启动与换号后的未知余额按 5 秒重读。
|
|
56
|
+
- 快速关闭再开启某来源时新网关等待旧网关释放端口;首选端口被占用时改用实际绑定的端口,不再造成地址漂移。
|
|
57
|
+
- 插件重载后重新计算当天的签到时段;手动「立即运行」与命令面板签到记入当前已到点的时段;Qoder 当日轮次晚于签到时点开出时在开出时刻补收。
|
|
58
|
+
- WorkBuddy、Trae、Qoder 收到上游终止标记即完成响应,不再等待 TCP 连接关闭;上游开始输出后才失败时改为发出带内错误帧、终止帧与 `[DONE]`。
|
|
59
|
+
- 上游回显的凭据不再原样出现在错误信息里(含 `Cosy-Key`、`X-Cloudide-Token`、`X-Ide-Token` 这类写法);Trae 拒绝回包中途断开时保留真实状态码;修复国内 Trae、Qoder 的有效登录被误判为已过期。
|
|
60
|
+
- 轮流使用只在对话请求上换号,刷新模型列表与健康检查不再拨动游标;首选来源账号改名后不再永久停用;连登奖励只兑换已解锁的档位;模型 id 为 `__proto__` 时按普通 id 保存与读回。
|
|
61
|
+
- 面板配色统一为一组低饱和色相;显示名、包名与仓库名统一为 **WTQ Pool** / `dsh-wtq-pool`,命令 id 与设置命名空间不变;Trae 模型倍率以 `x0.79` 标签显示;面板右下角收成一排 GitHub、npm、文档与许可链接。
|
|
62
|
+
- 中英文文档明确故障转移、Trae/Qoder 分发限制与本地安装方式;网关拒绝凭据的提示改为指向连接检查。
|
|
42
63
|
|
|
43
64
|
## [1.0.0]
|
|
44
65
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
### 功能
|
|
48
|
-
|
|
49
|
-
- 只读本机 WorkBuddy、Trae、Qoder 桌面 App 的登录文件,不发起独立的 OAuth 流程。
|
|
50
|
-
- 按 region 把账号合成模型池并注册成 provider:WorkBuddy 国内/国际、Trae 国内/国际、Qoder 国内/国际;没有账号的 region 不注册。
|
|
51
|
-
- WorkBuddy 被限流或额度用尽时自动换号,支持优先使用、轮询、临期积分优先和会话固定;Trae、Qoder 按请求分发,支持轮询与临期积分优先。
|
|
52
|
-
- 后台积分自动化:每日签到、任务奖励领取、连登解锁。到点和「立即运行」执行同一轮,顺带领取 WorkBuddy 国内账号已解锁的连登档位和已完成的任务奖励。
|
|
53
|
-
- 会话积分展开框带刷新按钮,重读当前模型这一组账号的积分。
|
|
54
|
-
- 插件页提供 **WTQ Pool** 配置卡片:账号池、模型勾选、连接检查三屏,覆盖三个来源。
|
|
55
|
-
- `xdpool.open` / `xdpool.rescan` / `xdpool.resetCooldowns` / `xdpool.doctor` / `xdpool.checkin` 命令。
|
|
56
|
-
|
|
57
|
-
### 说明
|
|
66
|
+
首个版本。把本机 WorkBuddy、Trae、Qoder 三家的桌面登录接进 DeepSeek Harness:每家成为一个 OpenAI 兼容的本地端点,模型选择器里直接可用。
|
|
58
67
|
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
68
|
+
- 只读本机三家桌面 App 的登录文件,不发起独立的 OAuth 流程。
|
|
69
|
+
- 按 region 合成模型池并注册成 provider,没有账号的 region 不注册;每个网关只绑 `127.0.0.1`,首选端口 42831–42881,占用时用临时端口。
|
|
70
|
+
- WorkBuddy 支持优先使用、轮询、临期积分优先和会话固定,被限流或额度用尽时自动换号;Trae、Qoder 按请求分发,支持轮询与临期积分优先。
|
|
71
|
+
- 后台积分自动化:每日签到、任务奖励领取、连登解锁,「立即运行」与到点执行同一轮。
|
|
72
|
+
- 插件页提供 **WTQ Pool** 配置卡片(账号池、模型、连接检查),以及 `xdpool.open` / `rescan` / `resetCooldowns` / `doctor` / `checkin` 命令。
|
|
62
73
|
- 会话输入框左侧显示当前模型的账号积分,点开可切换账号。
|
|
63
|
-
-
|
|
74
|
+
- provider 通过运行时注册接入,不改写宿主 provider 配置;插件设置由宿主持久化至 profile;对 `@earendil-works/pi-ai` 按实际解析到的版本适配请求上下文。
|
package/README.en.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
<h1 align="center">WTQ Pool</h1>
|
|
10
10
|
|
|
11
|
+
<p align="center"><sub>For DeepSeek Harness · <a href="https://github.com/chengzhi-c/pi-desktop-wtq-pool">PI-Desktop edition</a></sub></p>
|
|
12
|
+
|
|
11
13
|
<p align="center"><b>Use local WorkBuddy, Trae and Qoder sign-ins in DeepSeek Harness, with automatic failover when an account is rate-limited or out of quota.</b></p>
|
|
12
14
|
|
|
13
15
|
<p align="center">
|
|
@@ -16,6 +18,7 @@
|
|
|
16
18
|
|
|
17
19
|
<p align="center">
|
|
18
20
|
<a href="#install">Install</a> ·
|
|
21
|
+
<a href="#usage">Usage</a> ·
|
|
19
22
|
<a href="#features">Features</a> ·
|
|
20
23
|
<a href="#settings">Settings</a> ·
|
|
21
24
|
<a href="CHANGELOG.md">Changelog</a> ·
|
|
@@ -30,7 +33,7 @@
|
|
|
30
33
|
<a href="https://github.com/chengzhi-c/dsh-wtq-pool/stargazers"><img src="https://img.shields.io/github/stars/chengzhi-c/dsh-wtq-pool?style=flat-square" alt="GitHub stars"></a>
|
|
31
34
|
</p>
|
|
32
35
|
|
|
33
|
-
Use local WorkBuddy, Trae and Qoder desktop sign-ins in DeepSeek Harness. WorkBuddy fails over when an account is rate-limited or out of quota; Trae and Qoder select an account per request and
|
|
36
|
+
Use local WorkBuddy, Trae and Qoder desktop sign-ins in DeepSeek Harness. WorkBuddy fails over when an account is rate-limited or out of quota; Trae and Qoder select an account per request and move on to the next sign-in on an authentication failure, a rate limit or exhausted quota, while a problem with the request itself (an unknown model, a malformed body) is answered as the upstream answered it. Each source has its own switch, with domestic and international accounts grouped separately.
|
|
34
37
|
|
|
35
38
|
## Preview
|
|
36
39
|
|
|
@@ -38,7 +41,7 @@ The settings panel, in its default light theme:
|
|
|
38
41
|
|
|
39
42
|

|
|
40
43
|
|
|
41
|
-
The panel reads DeepSeek Harness
|
|
44
|
+
The panel reads the DeepSeek Harness appearance setting on load. Reload the panel after changing the host theme:
|
|
42
45
|
|
|
43
46
|

|
|
44
47
|
|
|
@@ -48,37 +51,40 @@ The model page edits the display name, context window, output limit, thinking le
|
|
|
48
51
|
|
|
49
52
|
Live preview: <https://chengzhi-c.github.io/dsh-wtq-pool/>.
|
|
50
53
|
|
|
51
|
-
`docs/index.html`
|
|
54
|
+
`docs/index.html` drives the actual panel code with synthetic demo data. It supports source switching, model settings and theme previews without reading local accounts or tokens.
|
|
52
55
|
|
|
53
56
|

|
|
54
57
|
|
|
55
|
-
With `showComposerPoints` enabled, the composer shows the current model's account credits. Click it to inspect the group and switch accounts. The image below is an off-screen render of the actual composer extension
|
|
58
|
+
With `showComposerPoints` enabled, the composer shows the current model's account credits. Click it to inspect the group and switch accounts. The image below is an off-screen render of the actual composer extension:
|
|
56
59
|
|
|
57
60
|

|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
To run it locally, clone the repo, run `node docs/serve.cjs`, and open the address it prints. (`docs/index.html` has to be served over http: a `file://` page cannot read the panel files beside it.)
|
|
60
63
|
|
|
61
64
|
## Features
|
|
62
65
|
|
|
63
66
|
- Reuse the local sign-ins: the plugin only reads the sign-in files the three desktop apps already saved. It starts no OAuth flow of its own and asks for no extra authorization.
|
|
64
67
|
- Register model groups by region: each of the three vendors' regions becomes its own provider, and they can be on at once; a region with no account is not registered.
|
|
65
|
-
- Account distribution: WorkBuddy supports priority, round-robin, expiring credits first and conversation-sticky accounts, with failover on rate limits or exhausted quota. Trae and Qoder support round-robin and expiring credits first.
|
|
66
|
-
- Credit automation: automatic check-in is off by default. The scheduled run and "Run now" perform the same round: vendor check-ins plus domestic WorkBuddy streak
|
|
67
|
-
- Composer credits: with `showComposerPoints` on, the composer shows the balance of the account behind the current model; click it to switch accounts.
|
|
68
|
-
- One panel: account state, pool state, model selection and the connection check all live in the
|
|
68
|
+
- Account distribution: WorkBuddy supports priority, round-robin, expiring credits first and conversation-sticky accounts, with failover on rate limits or exhausted quota. Trae and Qoder support round-robin and expiring credits first, and move on to the next sign-in on an authentication failure, a rate limit or exhausted quota. A rate limit cools for the wait the upstream stated, taking the response header when that is the only place it appears. Exhausted quota and a dead sign-in do not recover on their own, so that account leaves rotation until the balance is read again or the user signs in anew. When the upstream host cannot be reached at all, the next sign-in is tried.
|
|
69
|
+
- Credit automation: automatic check-in is off by default. The scheduled run and "Run now" perform the same round: vendor check-ins, plus the domestic WorkBuddy streak bonus, task rewards and cat travel. The upstream advances the streak on a conversation, so the round reports one chat activity per domestic account before reading the streak tiers; a tier that comes due is unlocked and collected without the user having to open WorkBuddy and send a message.
|
|
70
|
+
- Composer credits: with `showComposerPoints` on, the composer shows the balance of the account behind the current model; click it to switch accounts. Switching the feature off stops the readout's polling.
|
|
71
|
+
- One panel: account state, pool state, model selection and the connection check all live in the Account pool card on the plugin page. The model catalog loads at startup and refreshes on demand once its cache expires; it does not poll while idle. An account switched off in the panel is never probed, so it does not leave the panel reading "detecting" either.
|
|
72
|
+
- Connection check: every finding carries a verdict. A gateway that is not listening, a catalog that could not be read, a published address that differs from the one bound, or a provider the host did not accept all count as failures and say what to change. A gateway whose start failed is reported with the reason and surfaced as address drift. When the check itself throws, the failure becomes a finding rather than taking the whole channel down.
|
|
69
73
|
|
|
70
74
|
## Install
|
|
71
75
|
|
|
72
76
|
For a local package, run `pnpm install && pnpm run build && npm pack --pack-destination dist` in the source directory, then install the generated `.tgz`:
|
|
73
77
|
|
|
74
78
|
```powershell
|
|
75
|
-
$package = (
|
|
79
|
+
$package = (Get-ChildItem .\dist\*.tgz | Sort-Object LastWriteTime | Select-Object -Last 1).FullName
|
|
76
80
|
dsh plugin --profile desktop add $package
|
|
77
81
|
```
|
|
78
82
|
|
|
79
|
-
|
|
83
|
+
Requires DeepSeek Harness on the 0.2.0 line (`engines.dsh` in `package.json`: `>=0.2.0-rc.1 <0.2.1`) and Node `^22.19.0 || >=24.0.0`.
|
|
84
|
+
|
|
85
|
+
Replace `desktop` with your actual profile name. If `dsh` is not on PATH, use the CLI in its installation directory. The npm name `dsh-wtq-pool` and the repository URL work as install sources too; a repository-URL install builds from source through the `prepare` script, which requires `allowBuilds: dsh-wtq-pool: true` in the profile's `pnpm-workspace.yaml` and a pinned commit.
|
|
80
86
|
|
|
81
|
-
**Where the panel is**:
|
|
87
|
+
**Where the panel is**: open **Plugins** in the sidebar, then open the **dsh-wtq-pool** card (or the **Configure** control beside it); the full panel is embedded in that card. If the model groups do not appear, restart dsh as the note at the top of the panel says.
|
|
82
88
|
|
|
83
89
|
## Usage
|
|
84
90
|
|
|
@@ -86,25 +92,35 @@ Sign in inside each vendor's desktop app, then click "Detect accounts again". Wo
|
|
|
86
92
|
|
|
87
93
|
A source is selected at the top level; below it are three screens:
|
|
88
94
|
|
|
89
|
-
- **Account pool**: each account's label, remaining credits, quota expiry, cooldown state and check-in progress. An account can be disabled on its own
|
|
95
|
+
- **Account pool**: each account's label, remaining credits, quota expiry, cooldown state and check-in progress. An account can be disabled on its own or removed, and a region can be pinned to prefer one account. WorkBuddy distributes by using one account first, round-robin, expiring credits first, or one account pinned per conversation; Trae and Qoder offer round-robin and expiring credits first.
|
|
90
96
|
- **Models**: select which models this region exposes; anything unselected stays out of the model picker. The display name, context window, output limit, thinking levels and image support are editable. A model group publishes at most 64 models; any beyond that are marked "not published" while the gateway still serves them.
|
|
91
|
-
- **Connection check**: reports one line at a time whether each gateway is listening, how many models its catalog returned, whether the published address matches the one actually bound, and whether the host accepted each provider, and can copy the whole report.
|
|
97
|
+
- **Connection check**: reports one line at a time whether each gateway is listening, how many models its catalog returned, whether the published address matches the one actually bound, and whether the host accepted each provider, and can copy the whole report. A gateway whose start failed is reported with its reason, and the panel surfaces it as address drift.
|
|
92
98
|
|
|
93
|
-
Check-in runs per account, or for a whole source from the title bar. Automatic check-in is off by default; when on it claims at 09:00 (Beijing time), and a missed
|
|
99
|
+
Check-in runs per account, or for a whole source from the title bar. Automatic check-in is off by default; when on it claims at 09:00 (Beijing time), and a slot missed earlier the same day is still claimed at the next start, while one from a previous day is not. Trae's daily check-in is once per device. Qoder's new round opens at 10:00 (Beijing time).
|
|
94
100
|
|
|
95
101
|
## Settings
|
|
96
102
|
|
|
97
|
-
|
|
103
|
+
Every key below is declared in the host's settings schema and written back to the profile:
|
|
104
|
+
|
|
105
|
+
| Key | Default (effective) | Meaning |
|
|
98
106
|
| --- | --- | --- |
|
|
99
107
|
| `enabled` | `true` | Off: the gateways do not start |
|
|
100
108
|
| `sourceWorkbuddy` / `sourceTrae` / `sourceQoder` | `true` | Off: that source is not scanned, published or requested |
|
|
101
|
-
| `distribution` | `priority` | How the WorkBuddy pool spreads requests: `priority` uses one first, `round-robin` spreads evenly, `expiry` spends expiring credits first, `sticky` pins one account per conversation |
|
|
109
|
+
| `distribution` | `priority` | How the WorkBuddy pool spreads requests: `priority` uses one account first, `round-robin` spreads evenly, `expiry` spends expiring credits first, `sticky` pins one account per conversation |
|
|
102
110
|
| `sourceDistributions` | `{}` | Trae/Qoder distribution: `round-robin` / `expiry`; legacy `priority` is accepted |
|
|
103
111
|
| `cooldownSeconds` | `60` | Rate-limit cooldown. A reset time the upstream reports takes precedence; Beijing time |
|
|
112
|
+
| `creditReserves` | `{}` | Per-account credit floor, keyed by account id; an account below its floor is not distributed to |
|
|
104
113
|
| `authFile` | `""` | WorkBuddy sign-in file path; every `.info` sign-in in its directory is scanned. Empty discovers it |
|
|
105
114
|
| `autoCheckin` | `{"enabled":false,"hours":[9]}` | Automatic check-in switch and times; `hours` are Beijing-time hours, empty means 09:00 |
|
|
106
|
-
| `creditReserves` | `{}` | Per-account credit floor, keyed by account id; an account below its floor is not distributed to |
|
|
107
115
|
| `showComposerPoints` | `false` | Show the active account's credits in the composer |
|
|
116
|
+
| `disabledAccountIds` | `[]` | Account ids switched off in the panel |
|
|
117
|
+
| `disabledRegions` | `[]` | Regions parked on their own, as `source:region` keys |
|
|
118
|
+
| `modelSelection` | `{}` | Which models each gateway publishes, plus the display name, context window and other overrides |
|
|
119
|
+
| `preferredAccountIds` | `{}` | Preferred WorkBuddy account per region |
|
|
120
|
+
| `preferredSourceAccounts` | `{}` | Preferred Trae/Qoder account per region, keyed by `source:region` |
|
|
121
|
+
| `removedAccounts` | `[]` | Accounts removed from the pool for good, with their label and region kept so the panel can offer a restore |
|
|
122
|
+
|
|
123
|
+
The default column lists effective values: `autoCheckin.hours` is stored as an empty array and normalises to `[9]`; an unset or empty `authFile` means auto-discovery.
|
|
108
124
|
|
|
109
125
|
Model selection and preferred accounts are saved by the panel. The command palette also opens the panel, detects accounts again, clears cooldowns, checks in everywhere and runs the connection check.
|
|
110
126
|
|
|
@@ -118,11 +134,13 @@ Qoder 42871 / 42881
|
|
|
118
134
|
|
|
119
135
|
These are preferred ports. If occupied, the gateway binds an ephemeral port and runtime provider registration uses that actual address. The panel reports the fallback. Domestic models only use domestic accounts.
|
|
120
136
|
|
|
137
|
+
When another process takes a port between the reservation and the listen, that gateway's start fails: its model group is dropped, the connection check reports the reason, and the panel surfaces address drift. Requests only reach the new address after the host re-reads the registration, which a restart does.
|
|
138
|
+
|
|
121
139
|
## Data and outbound requests
|
|
122
140
|
|
|
123
|
-
The plugin only reads local vendor sign-in files and does not modify them. Providers are registered at runtime without rewriting host provider configuration; the host still persists plugin settings in the profile. Tokens stay in the plugin process and are sent to the relevant vendor endpoints. Gateways listen on `127.0.0.1`. Panel assets and RPC require an actual loopback peer and ignore forwarded address headers, so remote browsers cannot access the panel directly. The plugin does not directly manage or delete host conversation records.
|
|
141
|
+
The plugin only reads local vendor sign-in files and does not modify them. Providers are registered at runtime without rewriting host provider configuration; the host still persists plugin settings in the profile. Tokens stay in the plugin process and are sent to the relevant vendor endpoints. Gateways listen on `127.0.0.1`. Panel assets and RPC require an actual loopback peer and ignore forwarded address headers, so remote browsers cannot access the panel directly. The plugin does not directly manage or delete host conversation records. Its own data directory, `~/.dsh/dsh-wtq-pool/` (or `$DSH_HOME` when set), also holds two files: `checkin-slots.json`, the check-in slots already collected, written to a temporary file and renamed into place, then kept for three days, and `doctor.txt`, the most recent connection report.
|
|
124
142
|
|
|
125
|
-
Another process on the same machine can call these loopback endpoints and spend a signed-in account's quota.
|
|
143
|
+
Another process on the same machine can call these loopback endpoints and spend a signed-in account's quota. If replies disappear after a restart, check both the plugin logs and the host's persisted logs.
|
|
126
144
|
|
|
127
145
|
Tokens go only to the hosts below:
|
|
128
146
|
|
|
@@ -142,11 +160,24 @@ pnpm run typecheck:client
|
|
|
142
160
|
pnpm test # Node's own test runner, offline regressions
|
|
143
161
|
```
|
|
144
162
|
|
|
145
|
-
`src/host.ts` is the engine (account discovery, the pool, the gateways, the panel channels), `src/index.ts` is the Cordis entry (settings schema, provider registration, panel routes), `src/pi-compat.ts` adapts the host's capabilities to the calls the engine already makes, and `src/client/` is the React half
|
|
163
|
+
`src/host.ts` is the engine (account discovery, the pool, the gateways, the panel channels), `src/index.ts` is the Cordis entry (settings schema, provider registration, panel routes), and `src/pi-compat.ts` adapts the host's capabilities to the calls the engine already makes. `renderer/` is the panel itself: `index.html`, `panel.js` and `panel.css`, plain JavaScript with no build step, mounted by `src/web-panel.ts` on the host's web server and served to the plugin card as a same-origin iframe. `src/client/` is the React half, and holds only the plugin-page card that embeds that iframe (`index.tsx`) and the composer readout (`composer.tsx`). `lib/` is emitted by `tsdown`, is listed in `package.json`'s `files` and is committed, so it must be rebuilt after changing `src/`.
|
|
164
|
+
|
|
165
|
+
The host-agnostic core:
|
|
166
|
+
|
|
167
|
+
| Module | Responsibility |
|
|
168
|
+
| --- | --- |
|
|
169
|
+
| `loopback.ts` | The loopback security model (Host/Origin checks, response writing, relay pumping via pumpToResponse/relayStreamOf, message redaction) |
|
|
170
|
+
| `accounts.ts` | WorkBuddy sign-in parsing, token encryption, the account pool and its cooldowns |
|
|
171
|
+
| `upstream.ts` | The WorkBuddy upstream client, error classification, rate-limit reset parsing |
|
|
172
|
+
| `catalog.ts` | The model catalog and its static fallback list |
|
|
173
|
+
| `shim.ts` | The WorkBuddy gateway's OpenAI-compatible endpoint |
|
|
174
|
+
| `at-rest.ts` | Unsealing 5.6+ encrypted sign-in fields |
|
|
175
|
+
| `promo.ts` | Promotion window matching |
|
|
176
|
+
| `trae-*.ts` / `qoder-*.ts` | Sign-in discovery, protocol clients, SSE decoding and gateways for both vendors |
|
|
146
177
|
|
|
147
178
|
## Credits
|
|
148
179
|
|
|
149
|
-
Several modules are ported from
|
|
180
|
+
Several modules are ported from or reference the MIT projects below:
|
|
150
181
|
|
|
151
182
|
| Project | Copyright | Used for |
|
|
152
183
|
| --- | --- | --- |
|
package/README.md
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
<picture>
|
|
3
3
|
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/chengzhi-c/dsh-wtq-pool/raw/main/docs/logo-dark.png">
|
|
4
4
|
<source media="(prefers-color-scheme: light)" srcset="https://github.com/chengzhi-c/dsh-wtq-pool/raw/main/docs/logo.png">
|
|
5
|
-
<img src="https://github.com/chengzhi-c/dsh-wtq-pool/raw/main/docs/logo.png" width="240" alt="WTQ
|
|
5
|
+
<img src="https://github.com/chengzhi-c/dsh-wtq-pool/raw/main/docs/logo.png" width="240" alt="WTQ Pool">
|
|
6
6
|
</picture>
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
|
-
<h1 align="center">WTQ
|
|
9
|
+
<h1 align="center">WTQ Pool</h1>
|
|
10
|
+
|
|
11
|
+
<p align="center"><sub>DeepSeek Harness 版 · <a href="https://github.com/chengzhi-c/pi-desktop-wtq-pool">PI-Desktop 版</a></sub></p>
|
|
10
12
|
|
|
11
13
|
<p align="center"><b>把本机已登录的 WorkBuddy、Trae、Qoder 账号接入 DeepSeek Harness,限流或额度用尽时自动换号。</b></p>
|
|
12
14
|
|
|
@@ -16,6 +18,7 @@
|
|
|
16
18
|
|
|
17
19
|
<p align="center">
|
|
18
20
|
<a href="#安装">安装</a> ·
|
|
21
|
+
<a href="#使用">使用</a> ·
|
|
19
22
|
<a href="#功能">功能</a> ·
|
|
20
23
|
<a href="#设置">设置</a> ·
|
|
21
24
|
<a href="CHANGELOG.md">更新日志</a> ·
|
|
@@ -30,7 +33,9 @@
|
|
|
30
33
|
<a href="https://github.com/chengzhi-c/dsh-wtq-pool/stargazers"><img src="https://img.shields.io/github/stars/chengzhi-c/dsh-wtq-pool?style=flat-square" alt="GitHub stars"></a>
|
|
31
34
|
</p>
|
|
32
35
|
|
|
33
|
-
把本机 WorkBuddy、Trae、Qoder 的桌面登录接入 DeepSeek Harness。WorkBuddy 被限流或额度用尽时自动换号;Trae、Qoder
|
|
36
|
+
把本机 WorkBuddy、Trae、Qoder 的桌面登录接入 DeepSeek Harness。WorkBuddy 被限流或额度用尽时自动换号;Trae、Qoder 按请求选择账号,认证失败、限流或余额耗尽时换下一个登录重试,模型不存在、请求体非法这类请求自身的问题则按上游原样应答。三个来源独立开关,国内与国际账号分别成组。
|
|
37
|
+
|
|
38
|
+
限流按上游给出的等待时间冷却,上游只在响应头给出时以它为准;额度用尽与登录失效不会自行恢复,该账号会退出轮换,直到余额重新读到或重新登录。上游主机不可达时换下一个登录重试。
|
|
34
39
|
|
|
35
40
|
## 预览
|
|
36
41
|
|
|
@@ -48,11 +53,11 @@
|
|
|
48
53
|
|
|
49
54
|
在线预览:<https://chengzhi-c.github.io/dsh-wtq-pool/>。
|
|
50
55
|
|
|
51
|
-
`docs/index.html`
|
|
56
|
+
`docs/index.html` 用虚构演示数据加载实际面板代码,支持来源切换、模型设置和主题预览,不读取本机账号或令牌。
|
|
52
57
|
|
|
53
58
|

|
|
54
59
|
|
|
55
|
-
开启 `showComposerPoints`
|
|
60
|
+
开启 `showComposerPoints` 后,输入框工具栏显示当前模型的账号积分,点击可查看该组账号并切换账号。下图由实际输入框扩展离屏渲染:
|
|
56
61
|
|
|
57
62
|

|
|
58
63
|
|
|
@@ -62,23 +67,26 @@
|
|
|
62
67
|
|
|
63
68
|
- 复用本机登录:只读三家桌面 App 已保存的登录文件,不发起自己的 OAuth,不额外要一次授权。
|
|
64
69
|
- 按 region 注册模型分组:三家各自的 region 各注册成一个 provider,可以同时开启;没有账号的 region 不注册。
|
|
65
|
-
- 账号分发:WorkBuddy
|
|
66
|
-
-
|
|
67
|
-
- 输入框积分:开启 `showComposerPoints`
|
|
68
|
-
-
|
|
70
|
+
- 账号分发:WorkBuddy 支持先用一个账号、轮流使用、临期积分优先和同一对话固定一个账号,并在限流或额度用尽时自动换号;Trae、Qoder 支持轮流使用与临期积分优先,认证失败、限流或余额耗尽时换下一个登录重试。
|
|
71
|
+
- 积分自动化:自动签到默认关闭。开启后的定时任务与「立即运行」执行同一轮,包含三家签到、WorkBuddy 国内账号的连登奖励、任务奖励和猫猫旅行。连登天数由上游按对话推进,该轮在每个国内账号读取连登档位前先补发一次对话活动上报,因此档位到点即可解锁领取,不需要用户自己进 WorkBuddy 聊一句。
|
|
72
|
+
- 输入框积分:开启 `showComposerPoints` 后,输入框工具栏显示当前模型使用的账号余额,点开可换号。功能关闭后浮层停止轮询。
|
|
73
|
+
- 面板:账号状态、池状态、模型勾选、连接检查都在插件页的「账号池」卡片里。模型目录启动时加载,缓存过期后按需刷新,空闲不轮询。停用的账号不参与探测,也不让面板一直显示「检测中」。
|
|
74
|
+
- 连接检查:每条发现都带判定。网关没在听、模型目录读不到、发布的地址与实际绑定的不一致、provider 没被宿主接受,都算失败并给出要改什么。网关启动失败时给出失败原因,面板按地址漂移提示重启。检查自己出错时也作为一条发现写进报告,而不是让整条通道失败。
|
|
69
75
|
|
|
70
76
|
## 安装
|
|
71
77
|
|
|
72
78
|
本地包:在源码目录执行 `pnpm install && pnpm run build && npm pack --pack-destination dist`,再安装生成的 `.tgz`:
|
|
73
79
|
|
|
74
80
|
```powershell
|
|
75
|
-
$package = (
|
|
81
|
+
$package = (Get-ChildItem .\dist\*.tgz | Sort-Object LastWriteTime | Select-Object -Last 1).FullName
|
|
76
82
|
dsh plugin --profile desktop add $package
|
|
77
83
|
```
|
|
78
84
|
|
|
79
|
-
|
|
85
|
+
需要 DeepSeek Harness 0.2.0 线(`package.json` 的 `engines.dsh`:`>=0.2.0-rc.1 <0.2.1`)与 Node `^22.19.0 || >=24.0.0`。
|
|
86
|
+
|
|
87
|
+
使用实际 profile 名替换 `desktop`。若 `dsh` 不在 PATH,使用安装目录中的 CLI。也可按 npm 包名 `dsh-wtq-pool` 或仓库地址安装;按仓库地址安装时 pnpm 会执行 `prepare` 脚本从源码构建,需要在 profile 的 `pnpm-workspace.yaml` 里写 `allowBuilds: dsh-wtq-pool: true`,并钉在某个 commit 上。
|
|
80
88
|
|
|
81
|
-
|
|
89
|
+
**面板在哪儿**:在侧边栏进入 **插件**,点开 **dsh-wtq-pool** 那张卡片(或它旁边的 **配置**),完整面板嵌在卡片里。模型分组没出现时,按面板顶部的提示重启 dsh。
|
|
82
90
|
|
|
83
91
|
## 使用
|
|
84
92
|
|
|
@@ -86,25 +94,34 @@ dsh plugin --profile desktop add $package
|
|
|
86
94
|
|
|
87
95
|
顶层选来源,下面三屏:
|
|
88
96
|
|
|
89
|
-
-
|
|
97
|
+
- **账号池**:每个号的标签、剩余积分、额度到期时间、冷却状态、签到进度;可单独停用某个号、移除它,或指定某个 region 优先用哪个号。WorkBuddy 的分发有先用一个账号、轮流使用、临期积分优先、同一对话固定一个账号;Trae 与 Qoder 有轮流使用和临期积分优先。
|
|
90
98
|
- **模型**:勾选这个 region 要暴露的模型,未勾选的不进模型选择器。可改显示名、上下文窗口、输出上限、思考等级和贴图支持。一个模型组最多发布 64 个,超出的标「未发布」,网关仍会服务它们。
|
|
91
|
-
- **连接检查**:逐条报出网关在不在听、模型目录读到几个、注册的地址与实际绑定的是否一致、每个 provider
|
|
92
|
-
|
|
93
|
-
签到可单账号执行,也可在标题栏一次领完该来源。自动签到默认关闭,开启后默认于 09:00(北京时间)执行,错过时段将在下次启动补领。Trae 的每日签到是一台设备一次,Qoder 的新一轮在每天 10:00(北京时间)开出。
|
|
99
|
+
- **连接检查**:逐条报出网关在不在听、模型目录读到几个、注册的地址与实际绑定的是否一致、每个 provider 有没有被宿主接受,并可复制整份报告。网关启动失败时给出失败原因,面板按地址漂移提示重启。
|
|
100
|
+
签到可单账号执行,也可在标题栏一次领完该来源。自动签到默认关闭,开启后默认于 09:00(北京时间)执行;当天错过的时段在当天内的下一次启动仍会补领,跨天则不补。Trae 的每日签到每台设备限领一次,Qoder 的新一轮在每天 10:00(北京时间)开出。
|
|
94
101
|
|
|
95
102
|
## 设置
|
|
96
103
|
|
|
97
|
-
|
|
104
|
+
这些键全部经宿主设置 schema 声明,改动写回 profile 后即生效:
|
|
105
|
+
|
|
106
|
+
| 键 | 默认(生效值) | 说明 |
|
|
98
107
|
| --- | --- | --- |
|
|
99
108
|
| `enabled` | `true` | 关闭后网关不启动 |
|
|
100
109
|
| `sourceWorkbuddy` / `sourceTrae` / `sourceQoder` | `true` | 关闭后该来源不扫描、不发布、不请求 |
|
|
101
|
-
| `distribution` | `priority` | WorkBuddy 池的发放方式:`priority`
|
|
110
|
+
| `distribution` | `priority` | WorkBuddy 池的发放方式:`priority` 先用一个账号,`round-robin` 均摊,`expiry` 优先消耗临期积分,`sticky` 同一对话固定 |
|
|
102
111
|
| `sourceDistributions` | `{}` | Trae、Qoder 的分发方式:`round-robin` / `expiry`;兼容旧值 `priority` |
|
|
103
112
|
| `cooldownSeconds` | `60` | 限流冷却时长。上游报出重置时间时以它为准,按北京时间 |
|
|
104
|
-
| `authFile` | `""` | WorkBuddy 登录文件路径;扫描其所在目录的全部 `.info` 登录,留空自动发现 |
|
|
105
|
-
| `autoCheckin` | `{"enabled":false,"hours":[9]}` | 自动签到的开关与时点,`hours` 为北京时间整点,留空用 09:00 |
|
|
106
113
|
| `creditReserves` | `{}` | 按账号 id 设定的积分保底,余额低于它的账号不参与分发 |
|
|
107
|
-
| `
|
|
114
|
+
| `authFile` | `""` | WorkBuddy 登录文件路径;扫描其所在目录的全部 `.info` 登录,留空自动发现 |
|
|
115
|
+
| `autoCheckin` | `{"enabled":false,"hours":[9]}` | 自动签到的开关与时点;`hours` 为北京时间整点,留空用 09:00 |
|
|
116
|
+
| `showComposerPoints` | `false` | 在输入框工具栏显示当前账号积分 |
|
|
117
|
+
| `disabledAccountIds` | `[]` | 面板里停用的账号 id |
|
|
118
|
+
| `disabledRegions` | `[]` | 单独停用的 region,形如 `source:region` |
|
|
119
|
+
| `modelSelection` | `{}` | 每个网关勾选哪些模型,以及显示名、上下文窗口等覆写 |
|
|
120
|
+
| `preferredAccountIds` | `{}` | WorkBuddy 每个 region 的首选账号 |
|
|
121
|
+
| `preferredSourceAccounts` | `{}` | Trae、Qoder 每个 region 的首选账号,键为 `source:region` |
|
|
122
|
+
| `removedAccounts` | `[]` | 从池里移除的账号,标签与 region 一并保留,面板可据此提供恢复 |
|
|
123
|
+
|
|
124
|
+
默认列是生效值:`autoCheckin.hours` 存为空数组,运行时归一为 `[9]`;`authFile` 未设或留空即自动发现。
|
|
108
125
|
|
|
109
126
|
模型勾选和首选账号由面板保存。命令面板里也可打开面板、重新检测、清除冷却、全部签到、连接检查。
|
|
110
127
|
|
|
@@ -118,11 +135,13 @@ Qoder 42871 / 42881
|
|
|
118
135
|
|
|
119
136
|
以上为首选端口。被占用时网关绑定临时端口,运行时 provider 注册使用本次实际地址,面板显示回退结果。国内模型仅使用国内账号。
|
|
120
137
|
|
|
138
|
+
端口在预留与监听之间被别的进程抢走时,该网关本次启动失败:它的模型组会被摘掉,连接检查报出失败原因,面板提示重启宿主。重启后 host 重新读注册表,请求才会落到新地址上。
|
|
139
|
+
|
|
121
140
|
## 数据与出网
|
|
122
141
|
|
|
123
|
-
只读三家 App 的本机登录文件,不写回登录状态。provider 通过运行时注册接入,不改写宿主 provider 配置;插件设置仍由宿主持久化至 profile。令牌仅在插件进程中使用,并发往对应厂商接口。网关仅监听 `127.0.0.1`;面板资源与 RPC
|
|
142
|
+
只读三家 App 的本机登录文件,不写回登录状态。provider 通过运行时注册接入,不改写宿主 provider 配置;插件设置仍由宿主持久化至 profile。令牌仅在插件进程中使用,并发往对应厂商接口。网关仅监听 `127.0.0.1`;面板资源与 RPC 只接受实际回环对端,不信任代理转发头,因此远程浏览器不能直接使用面板。插件不直接管理或删除宿主会话记录。插件自管数据目录 `~/.dsh/dsh-wtq-pool/`(设了 `DSH_HOME` 则用它)里另有两个文件:`checkin-slots.json` 记录已领取的签到时段,先写临时文件再改名,只保留三天;`doctor.txt` 是最近一次连接检查的报告。
|
|
124
143
|
|
|
125
|
-
|
|
144
|
+
同一台机器上的其他进程可以调用这些回环端点,从而消耗已登录账号的额度。重启后回复缺失时应同时检查插件日志与宿主持久化日志。
|
|
126
145
|
|
|
127
146
|
令牌只会发往以下主机:
|
|
128
147
|
|
|
@@ -142,11 +161,24 @@ pnpm run typecheck:client
|
|
|
142
161
|
pnpm test # Node 自带测试,离线回归
|
|
143
162
|
```
|
|
144
163
|
|
|
145
|
-
`src/host.ts` 是引擎(账号发现、池、网关、面板通道),`src/index.ts` 是 Cordis 入口(设置 schema、provider 注册、面板路由),`src/pi-compat.ts`
|
|
164
|
+
`src/host.ts` 是引擎(账号发现、池、网关、面板通道),`src/index.ts` 是 Cordis 入口(设置 schema、provider 注册、面板路由),`src/pi-compat.ts` 把宿主能力适配成引擎已在用的那套调用。`renderer/` 是面板本体:`index.html`、`panel.js`、`panel.css`,原生 JS,无构建步骤,由 `src/web-panel.ts` 挂在宿主 web 服务上,以同源 iframe 提供给插件页卡片;`src/client/` 是 React 半,只有嵌这个 iframe 的插件页卡片(`index.tsx`)和输入框工具栏读数(`composer.tsx`)。`lib/` 由 `tsdown` 产出,`package.json` 的 `files` 与版本库都带着它,修改 `src/` 后须重建并提交。
|
|
165
|
+
|
|
166
|
+
与宿主无关的核心模块:
|
|
167
|
+
|
|
168
|
+
| 模块 | 职责 |
|
|
169
|
+
| --- | --- |
|
|
170
|
+
| `loopback.ts` | 回环端点的安全模型、响应写入、中继泵送(pumpToResponse / relayStreamOf)与报错脱敏 |
|
|
171
|
+
| `accounts.ts` | WorkBuddy 登录文件解析、令牌加解密、账号池与冷却 |
|
|
172
|
+
| `upstream.ts` | WorkBuddy 上游客户端、错误分类、限流重置解析 |
|
|
173
|
+
| `catalog.ts` | 模型目录与静态兜底列表 |
|
|
174
|
+
| `shim.ts` | WorkBuddy 网关的 OpenAI 兼容端点 |
|
|
175
|
+
| `at-rest.ts` | 5.6+ 密封登录字段的解封 |
|
|
176
|
+
| `promo.ts` | 促销窗口判定 |
|
|
177
|
+
| `trae-*.ts` / `qoder-*.ts` | 两家的登录发现、协议客户端、SSE 解码与网关 |
|
|
146
178
|
|
|
147
179
|
## 致谢
|
|
148
180
|
|
|
149
|
-
|
|
181
|
+
本插件的若干模块移植或参考自下列 MIT 项目:
|
|
150
182
|
|
|
151
183
|
| 项目 | 版权 | 用于 |
|
|
152
184
|
| --- | --- | --- |
|
package/cordis.patch.yml
CHANGED
package/lib/client.js
CHANGED
|
@@ -323,6 +323,9 @@ window.__ModuleLoader__.load({
|
|
|
323
323
|
const rootRef = react.useRef(null);
|
|
324
324
|
const panelRef = react.useRef(null);
|
|
325
325
|
const restartPollRef = react.useRef(() => {});
|
|
326
|
+
react.useEffect(() => {
|
|
327
|
+
if (props.useProjection === void 0) console.warn("[dsh-wtq-pool] the composer slot passed no useProjection; the credits readout stays hidden");
|
|
328
|
+
}, []);
|
|
326
329
|
react.useEffect(() => {
|
|
327
330
|
if (provider === "" || model === "") {
|
|
328
331
|
setPoints(null);
|
|
@@ -345,6 +348,11 @@ window.__ModuleLoader__.load({
|
|
|
345
348
|
model
|
|
346
349
|
}).then((next) => {
|
|
347
350
|
if (stopped) return;
|
|
351
|
+
if (next.enabled === false) {
|
|
352
|
+
setPoints(null);
|
|
353
|
+
window.clearTimeout(timer);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
348
356
|
const shown = next.show === true ? next : null;
|
|
349
357
|
setPoints(shown);
|
|
350
358
|
schedule(next);
|
|
@@ -378,11 +386,18 @@ window.__ModuleLoader__.load({
|
|
|
378
386
|
const onKey = (event) => {
|
|
379
387
|
if (event.key === "Escape") setOpen(false);
|
|
380
388
|
};
|
|
389
|
+
const onViewport = () => {
|
|
390
|
+
setOpen(false);
|
|
391
|
+
};
|
|
381
392
|
document.addEventListener("pointerdown", onPointer, true);
|
|
382
393
|
document.addEventListener("keydown", onKey);
|
|
394
|
+
window.addEventListener("scroll", onViewport, true);
|
|
395
|
+
window.addEventListener("resize", onViewport);
|
|
383
396
|
return () => {
|
|
384
397
|
document.removeEventListener("pointerdown", onPointer, true);
|
|
385
398
|
document.removeEventListener("keydown", onKey);
|
|
399
|
+
window.removeEventListener("scroll", onViewport, true);
|
|
400
|
+
window.removeEventListener("resize", onViewport);
|
|
386
401
|
};
|
|
387
402
|
}, [open]);
|
|
388
403
|
react.useEffect(() => {
|
|
@@ -566,6 +581,7 @@ window.__ModuleLoader__.load({
|
|
|
566
581
|
function PanelCard({ t, view }) {
|
|
567
582
|
const [generation, setGeneration] = react.useState(0);
|
|
568
583
|
const [measured, setMeasured] = react.useState(0);
|
|
584
|
+
const [missing, setMissing] = react.useState(false);
|
|
569
585
|
const frameRef = react.useRef(null);
|
|
570
586
|
const appearance = react.useMemo(() => {
|
|
571
587
|
if (typeof document === "undefined") return {
|
|
@@ -578,6 +594,25 @@ window.__ModuleLoader__.load({
|
|
|
578
594
|
lang: root.lang === "" ? "zh-CN" : root.lang
|
|
579
595
|
};
|
|
580
596
|
}, [generation]);
|
|
597
|
+
react.useEffect(() => {
|
|
598
|
+
if (view === "summary") return void 0;
|
|
599
|
+
let live = true;
|
|
600
|
+
setMissing(false);
|
|
601
|
+
const attempts = 3;
|
|
602
|
+
const probe = (remaining) => {
|
|
603
|
+
fetch(`${PANEL_BASE}/panel.css`).then((response) => {
|
|
604
|
+
if (!live) return;
|
|
605
|
+
if (response.ok || remaining <= 1) setMissing(!response.ok);
|
|
606
|
+
else setTimeout(() => probe(remaining - 1), 500);
|
|
607
|
+
}).catch(() => {
|
|
608
|
+
if (live && remaining <= 1) setMissing(true);
|
|
609
|
+
});
|
|
610
|
+
};
|
|
611
|
+
probe(attempts);
|
|
612
|
+
return () => {
|
|
613
|
+
live = false;
|
|
614
|
+
};
|
|
615
|
+
}, [view, generation]);
|
|
581
616
|
react.useEffect(() => {
|
|
582
617
|
if (view === "summary") return void 0;
|
|
583
618
|
const frame = frameRef.current;
|
|
@@ -600,7 +635,7 @@ window.__ModuleLoader__.load({
|
|
|
600
635
|
const frame = frameRef.current;
|
|
601
636
|
if (frame !== null) frame.src = panelUrl(appearance);
|
|
602
637
|
}
|
|
603
|
-
}, t("card.open"))), react.createElement("iframe", {
|
|
638
|
+
}, t("card.open"))), missing ? react.createElement("div", { style: MISSING_STYLE }, t("card.missing")) : react.createElement("iframe", {
|
|
604
639
|
key: generation,
|
|
605
640
|
ref: frameRef,
|
|
606
641
|
title: t("card.frameTitle"),
|
|
@@ -648,6 +683,17 @@ window.__ModuleLoader__.load({
|
|
|
648
683
|
};
|
|
649
684
|
const FRAME_BORDER = 2;
|
|
650
685
|
const FRAME_MAX_HEIGHT = 1900;
|
|
686
|
+
const MISSING_STYLE = {
|
|
687
|
+
...FRAME_PENDING,
|
|
688
|
+
display: "flex",
|
|
689
|
+
alignItems: "center",
|
|
690
|
+
justifyContent: "center",
|
|
691
|
+
margin: 0,
|
|
692
|
+
padding: "0 16px",
|
|
693
|
+
opacity: .75,
|
|
694
|
+
fontSize: 13,
|
|
695
|
+
textAlign: "center"
|
|
696
|
+
};
|
|
651
697
|
/**
|
|
652
698
|
* Register the card on the Plugins page.
|
|
653
699
|
*
|