dsh-wtq-pool 1.0.2 → 1.0.3

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 CHANGED
@@ -1,63 +1,64 @@
1
1
  # 更新说明
2
2
 
3
- ## [1.0.2]
4
-
5
- ### 修复
3
+ ## [1.0.3]
6
4
 
7
- - 输入框积分弹层的「刷新」不再与读端自己的时限等长:该通道按面板整段 20 秒预算执行,慢速凭据读取会让点击以超时收场。现在按留出序列化余量的预算作答,未完成的探测仍写入缓存,下一次轮询即可读到。
8
- - 设置保存里越界的 token 预算不再丢掉整批改动:字段自带与后端一致的上限,超限值在保存前被挡下,不再等到整份选择载荷被拒收后只报一句 `invalid selection payload`。
9
- - 签到开关在小时框留有无效文本时仍可关闭,不再提示错误却把计时器留在运行状态。
10
- - 面板框在加载过程中不再产生一次读取错误:读取若落在面板文档就位、内容尚未到达的瞬间,此前会取到空对象。
5
+ - WorkBuddy 国际版补齐会话头族与版本 UA,不再被渠道校验回 400 / 11128;不带会话标记的 401(含网关返回的 HTML 拒绝页)按登录失效分类并换号。
6
+ - WorkBuddy 拿不到本机密钥、或刷新令牌过期但访问令牌仍有效时账号不再从账号池消失;刷新到的新令牌不再被下一次扫描换回磁盘上的旧值,余额重新读到积分时释放扣留。
7
+ - 额度用尽与登录失效退出轮换,直到余额重新读到或重新登录;400 / 422 提到额度、429 响应体里的额度文案都不再被读成余额耗尽。
8
+ - 上游主机不可达(DNS、连接重置、TLS、30x 重定向)时换下一个登录重试,不再直接给客户端 502;调用方挂断(含首字节前的 peek 阶段)不算上游故障,不冷却健康账号。
9
+ - 上游只在 `Retry-After` 响应头给出等待时按它冷却并透传给客户端(截到两小时);响应头超时只覆盖等响应头,流中途的静默交给空闲看门狗。
10
+ - 调用方挂断后上游请求真正被拆掉,错误响应体在挂断或超限时立即取消;WorkBuddy 流中途失败改为发出带内错误帧、终止帧与 `[DONE]`。
11
+ - 超过 64 MiB 的请求体先排空再关闭并回 413;peek 期间连接中断不再绕过故障转移。
12
+ - Trae、Qoder 的第一个登录不可用时自动换下一个,模型目录也换号读,不再整个网关答 503;Trae 的登录拒绝与流内拒绝(订阅门槛、队列帧等)按真实状态码应答。
13
+ - Qoder 的失败帧(空 choices、字符串 `error`/`details`、`errcode` 拼写、嵌套确认码)都按真实编码换号或冷却。
14
+ - Qoder 的一轮在结束帧后即向客户端收尾,只留一秒等尾随的用量帧,不再等上游关闭连接。
15
+ - Trae 的每个存储文件只在第一个认领它的版本下探一次;一台安装登录多个账号时明确报告设备号是回退值。
16
+ - Qoder 发布目录给出的最大上下文窗口,不再在 200K 处截断;数字时间戳的到期时间不再被当成永不过期。
17
+ - Trae、Qoder 的登录发现按 30 秒缓存,Qoder 不再每个请求 spawn PowerShell 解密钥;目录读取失败进入 30 秒退避。
18
+ - Trae 与 Qoder 的 SSE 解码支持单独 CR 行分隔与 64 MiB 单行上限,`data:` 数组不再一直涨;中继按客户端消费速度读上游,慢客户端不再把整份回复缓存在网关里。
19
+ - 模型名册只有真读到的那份才算数:读取超时留下的兜底列表不再被拿来判定「已下线」;进入面板会自动重新拉一次名册,读取失败或账号扫描尚未完成时按 15 秒重试,保存的模型选择因此能正确生效,不再每次启动都显示全部、也不再挂着提示。
20
+ - 模型页保存的思考等级与上游声明的 `defaultEffort` 都生效,不再显示「高级」却发布兜底等级。
21
+ - 设置文档与面板保存共用同一组边界(积分保底、模型 id 长度、覆写表大小、token 预算、模型 id 条数);`enabledModelIds: []` 对 Trae 与 Qoder 也禁用全部模型;只由标点组成的别名不再把模型移除;旧版 `imageModelIds` 与 `contextBudgets` 折进模型覆写。
22
+ - provider 行只在网关预热时保留,退出登录后不再常驻;网关启动失败不再被当成「还在预热」,模型组摘掉、连接检查报出原因。
23
+ - 账号池刷新:强制刷新不再放行式交接;`authFile` 改指后补一次扫描且旧目录不写回;宿主设置变更只在来源开关时重置缓存;全部冷却时面板继续轮询,停用账号退出探测;某个 region 启动失败只记警告并继续。
24
+ - 面板与命令:`/invoke` 等待期间关闭面板不再让插件子进程死亡;补上内容安全策略、框架祖先限制与 `nosniff`;输入框积分浮层在功能关闭后停止轮询并区分两种未知;两条命令同时运行时各自汇报自己的结果;被其他操作清掉的顶部警告会重新出现,放弃轮询时「检测中」会收尾。
25
+ - 签到与领取:Trae 签到响应缺省 `enable` 时不再被当成未开通;Qoder 的领取读完整响应体(不再按错误体的 300 字节截断),带 `grantId`/金额的已发放响应不再被报成「跳过」,200 里的业务错误码按失败上报并带上游原话;拒绝里带「already」不再算当天已领,连登奖励不再空转,重启不重跑整天、时段落盘保留三天,停启后各类签到重新起跑,报告不再出现空行;Trae 返回 9074 时在失败原因里说明设备号来源。
26
+ - 签到一次只跑一轮:单账号签到与整批签到互斥,面板的整批签到也记下当次时段,定时任务不再一分钟后再跑一遍;旅行的失败进入计数;Qoder 活动列表读取失败与「该账号无签到活动」分开显示;面板不再把签到失败显示成「今天都已签到」,失败会带原因说出来。
27
+ - 上游响应体无论是否为 JSON 都先脱敏再转给客户端;手写签到时段里的空值不再被当成 00:00。
28
+ - 连接检查自身抛错会写进报告,超时后的回退读取受剩余预算约束;at-rest 的可执行文件候选只收文件,注册表扫描结果按进程缓存。
29
+ - 同伴依赖收紧到 `@deepseek-ai/*` 0.2.0 线与 `@earendil-works/pi-ai` `>=0.82.1 <0.88.0`,pi-ai 代际在激活时校验;新增 `prepare` 脚本,按仓库地址安装时从源码构建;旧版 schemastery 上 volatile 字段降级时给出告警。
11
30
 
12
- ### 改进
31
+ ## [1.0.2]
13
32
 
14
- - 账号卡与设置卡维持单列堆叠,间距收紧,多数窗口不必滚动即可看全;签到日志框限高可滚动,新结果自动滚到可见处。
15
- - 输入框积分弹层宽度随内容变化并对齐触发器右侧,高度上限连内边距一起计算;账号名过长时在列内截断并保留悬停提示。
16
- - 在输入框弹层里切换账号后积分不再短暂显示成「—」,保存的账号选择不再被当成宿主的设置改动。
17
- - 输入框弹层里选中账号那一行的压暗程度与账号前的圆点颜色写进插件自己的样式,不再取自宿主。
18
- - 插件页承载面板的框高度改为跟随面板内容,最长约四个账号,账号更多时由面板自身滚动,不再固定成一个视口高度。
33
+ - 输入框积分弹层的「刷新」按宿主中继的时限留出余量作答,不再超时并连累弹层其他按钮;未完成的探测仍在后台写入缓存。
34
+ - 设置保存里越界的 token 预算在保存前挡下,不再让整批改动被拒收。
35
+ - 签到开关在小时框留有无效文本时仍可关闭,不再把计时器留在运行状态;签到结束后重新拉取日志,手动结果即时可见。
36
+ - 面板框在文档就位、内容尚未到达的瞬间不再读到空对象;标题栏警告随问题消失而清除。
37
+ - 账号卡与设置卡单列堆叠、间距收紧,多数窗口不必滚动即可看全;签到日志框限高可滚动,新结果自动滚到可见处。
38
+ - 输入框积分弹层宽度随内容变化并对齐触发器右侧,高度上限连内边距一起计算;账号名过长时在列内截断并保留悬停提示;切换账号后积分不再短暂显示「—」。
19
39
 
20
40
  ## [1.0.1]
21
41
 
22
- ### 修复
23
-
24
- - 设置保存改用插件条目的实际命名空间,不再因为名字对不上而失败,面板里的来源开关、区域开关、签到与模型选择都受影响;宿主设置读取失败时保留上一次读到的设置,不清空停用账号、移除记录、积分保底和模型覆盖,补丁按顶层键替换。
25
- - 面板路由挂载早于引擎就绪的窗口期内请求不再报 500;某条路由注册失败时释放已注册的部分,不再让面板卡在半挂载。
26
- - 「重新检测账号」与加载期把账号扫描和网关启动纳入整段预算,按时应答,未完成的部分由后台刷新补齐;重新检测会移除登录文件已不在的 WorkBuddy 账号,目录暂时读不到时保留原账号与冷却。
27
- - 输入框积分弹窗的「刷新」按总预算逐账号补读,多账号机器上不再逐个等满;面板通道调用带客户端超时;首次读取 WorkBuddy 积分时自动触发后台探测,冷启动和换号后的未知余额按 5 秒重读。
28
- - 快速关闭再开启某来源时,新网关等待旧网关释放端口;首选端口被占用时改用实际绑定的端口,不再造成地址漂移。
29
- - 插件重载后重新计算当天的签到时段,不再漏掉未领的时段,旧一轮仍在收尾时也不会并发第二轮;手动「立即运行」与命令面板签到记入当前已到点的时段,Qoder 当日轮次晚于签到时点开出时会在开出时刻补收。
30
- - WorkBuddy、Trae、Qoder 收到上游终止标记即完成响应,不再等待 TCP 连接关闭;覆盖空终止回复、跨分块标记和 Trae 终止事件中的正文,加载期取消的请求也不再创建上游请求。
31
- - 上游开始输出后才失败时,流不再裸断开:改为发出带内错误帧、终止帧与 `[DONE]`,客户端能正常收尾;取消或断开导致的连接中断不再被记为上游流失败。
32
- - 上游回显的凭据不再原样出现在错误信息里,JSON 字段形式与 `Cosy-Key`、`X-Cloudide-Token`、`X-Ide-Token` 这类厂商写法一并覆盖,带内错误帧同样脱敏;凭据后面的字段不再被连带抹掉。
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 分发限制、主题重载与本地安装方式;报错指引与日志中的平台残留已清理,网关拒绝凭据的提示改为指向连接检查。
42
+ - 设置保存改用插件条目的实际命名空间,来源开关、区域开关、签到与模型选择都能存下来;宿主设置读取失败时保留上一次读到的设置。
43
+ - 面板路由挂载早于引擎就绪的窗口期不再报 500;某条路由注册失败时释放已注册的部分,不再让面板卡在半挂载。
44
+ - 「重新检测账号」与加载期把账号扫描和网关启动纳入整段预算,按时应答,未完成的部分由后台刷新补齐;重新检测会移除登录文件已不在的 WorkBuddy 账号。
45
+ - 输入框积分弹窗的「刷新」按总预算逐账号补读,多账号机器上不再逐个等满;首次读取 WorkBuddy 积分自动触发后台探测,冷启动与换号后的未知余额按 5 秒重读。
46
+ - 快速关闭再开启某来源时新网关等待旧网关释放端口;首选端口被占用时改用实际绑定的端口,不再造成地址漂移。
47
+ - 插件重载后重新计算当天的签到时段;手动「立即运行」与命令面板签到记入当前已到点的时段;Qoder 当日轮次晚于签到时点开出时在开出时刻补收。
48
+ - WorkBuddy、Trae、Qoder 收到上游终止标记即完成响应,不再等待 TCP 连接关闭;上游开始输出后才失败时改为发出带内错误帧、终止帧与 `[DONE]`。
49
+ - 上游回显的凭据不再原样出现在错误信息里(含 `Cosy-Key`、`X-Cloudide-Token`、`X-Ide-Token` 这类写法);Trae 拒绝回包中途断开时保留真实状态码;修复国内 Trae、Qoder 的有效登录被误判为已过期。
50
+ - 轮流使用只在对话请求上换号,刷新模型列表与健康检查不再拨动游标;首选来源账号改名后不再永久停用;连登奖励只兑换已解锁的档位;模型 id 为 `__proto__` 时按普通 id 保存与读回。
51
+ - 面板配色统一为一组低饱和色相;显示名、包名与仓库名统一为 **WTQ Pool** / `dsh-wtq-pool`,命令 id 与设置命名空间不变;Trae 模型倍率以 `x0.79` 标签显示;面板右下角收成一排 GitHub、npm、文档与许可链接。
52
+ - 中英文文档明确故障转移、Trae/Qoder 分发限制与本地安装方式;网关拒绝凭据的提示改为指向连接检查。
42
53
 
43
54
  ## [1.0.0]
44
55
 
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
- ### 说明
56
+ 首个版本。把本机 WorkBuddy、Trae、Qoder 三家的桌面登录接进 DeepSeek Harness:每家成为一个 OpenAI 兼容的本地端点,模型选择器里直接可用。
58
57
 
59
- - provider 通过运行时注册接入(`ctx.llm.registerAdapter` + `ctx.llm.registerConfigurableProviders`),不改写宿主 provider 配置;插件设置由宿主持久化至 profile。
60
- - 每个网关只绑 `127.0.0.1`,首选端口为 `42831`–`42881`,占用时使用临时端口;面板只接受实际回环对端。
61
- - 对 `@earendil-works/pi-ai` 按实际解析到的版本适配请求上下文:新旧两代对 system 提示的承载方式不同,插件按当前解析结果选择形态,因此宿主换代或 profile 提升旧版都不会打断发消息。
58
+ - 只读本机三家桌面 App 的登录文件,不发起独立的 OAuth 流程。
59
+ - 按 region 合成模型池并注册成 provider,没有账号的 region 不注册;每个网关只绑 `127.0.0.1`,首选端口 42831–42881,占用时用临时端口。
60
+ - WorkBuddy 支持优先使用、轮询、临期积分优先和会话固定,被限流或额度用尽时自动换号;Trae、Qoder 按请求分发,支持轮询与临期积分优先。
61
+ - 后台积分自动化:每日签到、任务奖励领取、连登解锁,「立即运行」与到点执行同一轮。
62
+ - 插件页提供 **WTQ Pool** 配置卡片(账号池、模型、连接检查),以及 `xdpool.open` / `rescan` / `resetCooldowns` / `doctor` / `checkin` 命令。
62
63
  - 会话输入框左侧显示当前模型的账号积分,点开可切换账号。
63
- - 面板以同源 `iframe` 嵌在插件页的配置卡片里,样式与宿主页面互不影响。
64
+ - provider 通过运行时注册接入,不改写宿主 provider 配置;插件设置由宿主持久化至 profile;对 `@earendil-works/pi-ai` 按实际解析到的版本适配请求上下文。
package/README.en.md CHANGED
@@ -16,6 +16,7 @@
16
16
 
17
17
  <p align="center">
18
18
  <a href="#install">Install</a> ·
19
+ <a href="#usage">Usage</a> ·
19
20
  <a href="#features">Features</a> ·
20
21
  <a href="#settings">Settings</a> ·
21
22
  <a href="CHANGELOG.md">Changelog</a> ·
@@ -30,7 +31,7 @@
30
31
  <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
32
  </p>
32
33
 
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 do not guarantee retries after failure. Each source has its own switch, with domestic and international accounts grouped separately.
34
+ 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 exactly as the upstream answered it. Each source has its own switch, with domestic and international accounts grouped separately.
34
35
 
35
36
  ## Preview
36
37
 
@@ -38,7 +39,7 @@ The settings panel, in its default light theme:
38
39
 
39
40
  ![Account pool](https://github.com/chengzhi-c/dsh-wtq-pool/raw/main/docs/preview-pool.png)
40
41
 
41
- The panel reads DeepSeek Harness's appearance setting on load. Reload the panel after changing the host theme:
42
+ The panel reads the DeepSeek Harness appearance setting on load. Reload the panel after changing the host theme:
42
43
 
43
44
  ![Dark theme](https://github.com/chengzhi-c/dsh-wtq-pool/raw/main/docs/preview-dark.png)
44
45
 
@@ -48,37 +49,40 @@ The model page edits the display name, context window, output limit, thinking le
48
49
 
49
50
  Live preview: <https://chengzhi-c.github.io/dsh-wtq-pool/>.
50
51
 
51
- `docs/index.html` loads the actual panel code with synthetic demo data. It supports source switching, model settings and theme previews without reading local accounts or tokens.
52
+ `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
53
 
53
54
  ![Preview page](https://github.com/chengzhi-c/dsh-wtq-pool/raw/main/docs/preview-page.png)
54
55
 
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, not a conversation-test screenshot:
56
+ 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
57
 
57
58
  ![Composer credits](https://github.com/chengzhi-c/dsh-wtq-pool/raw/main/docs/preview-composer.png)
58
59
 
59
- Run it locally after cloning the repo: `node docs/serve.cjs`, then 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
+ 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
61
 
61
62
  ## Features
62
63
 
63
64
  - 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
65
  - 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 and task rewards and cat travel.
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 WTQ 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.
66
+ - 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.
67
+ - 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.
68
+ - 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.
69
+ - 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 hold the panel's polling open either.
70
+ - 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
71
 
70
72
  ## Install
71
73
 
72
74
  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
75
 
74
76
  ```powershell
75
- $package = (Resolve-Path .\dist\dsh-wtq-pool-1.0.2.tgz).Path
77
+ $package = (Get-ChildItem .\dist\*.tgz | Sort-Object LastWriteTime | Select-Object -Last 1).FullName
76
78
  dsh plugin --profile desktop add $package
77
79
  ```
78
80
 
79
- 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.
81
+ 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`.
80
82
 
81
- **Where the panel is**: go to **Plugins** in the sidebar and 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.
83
+ 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.
84
+
85
+ **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
86
 
83
87
  ## Usage
84
88
 
@@ -86,25 +90,35 @@ Sign in inside each vendor's desktop app, then click "Detect accounts again". Wo
86
90
 
87
91
  A source is selected at the top level; below it are three screens:
88
92
 
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, or a region can be pinned to prefer one account. WorkBuddy distributes with use one first, round-robin, expiring credits first, or pin one per conversation; Trae and Qoder have round-robin and expiring credits first.
93
+ - **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
94
  - **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.
95
+ - **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
96
 
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 slot is claimed at the next start. Trae's daily check-in is once per device. Qoder's new round opens at 10:00 (Beijing time).
97
+ 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
98
 
95
99
  ## Settings
96
100
 
97
- | Key | Default | Meaning |
101
+ Every key below is declared in the host's settings schema and written back to the profile:
102
+
103
+ | Key | Default (effective) | Meaning |
98
104
  | --- | --- | --- |
99
105
  | `enabled` | `true` | Off: the gateways do not start |
100
106
  | `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 |
107
+ | `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
108
  | `sourceDistributions` | `{}` | Trae/Qoder distribution: `round-robin` / `expiry`; legacy `priority` is accepted |
103
109
  | `cooldownSeconds` | `60` | Rate-limit cooldown. A reset time the upstream reports takes precedence; Beijing time |
110
+ | `creditReserves` | `{}` | Per-account credit floor, keyed by account id; an account below its floor is not distributed to |
104
111
  | `authFile` | `""` | WorkBuddy sign-in file path; every `.info` sign-in in its directory is scanned. Empty discovers it |
105
112
  | `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
113
  | `showComposerPoints` | `false` | Show the active account's credits in the composer |
114
+ | `disabledAccountIds` | `[]` | Account ids switched off in the panel |
115
+ | `disabledRegions` | `[]` | Regions parked on their own, as `source:region` keys |
116
+ | `modelSelection` | `{}` | Which models each gateway publishes, plus the display name, context window and other overrides |
117
+ | `preferredAccountIds` | `{}` | Preferred WorkBuddy account per region |
118
+ | `preferredSourceAccounts` | `{}` | Preferred Trae/Qoder account per region, keyed by `source:region` |
119
+ | `removedAccounts` | `[]` | Accounts removed from the pool for good, with their label and region kept so the panel can offer a restore |
120
+
121
+ 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
122
 
109
123
  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
124
 
@@ -118,11 +132,13 @@ Qoder 42871 / 42881
118
132
 
119
133
  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
134
 
135
+ 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.
136
+
121
137
  ## Data and outbound requests
122
138
 
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.
139
+ 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 beside its target and renamed and kept for three days, and `doctor.txt`, the most recent connection report.
124
140
 
125
- Another process on the same machine can call these loopback endpoints and spend a signed-in account's quota.
141
+ 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
142
 
127
143
  Tokens go only to the hosts below:
128
144
 
@@ -142,11 +158,24 @@ pnpm run typecheck:client
142
158
  pnpm test # Node's own test runner, offline regressions
143
159
  ```
144
160
 
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: the panel and the composer readout.
161
+ `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/`.
162
+
163
+ The host-agnostic core:
164
+
165
+ | Module | Responsibility |
166
+ | --- | --- |
167
+ | `loopback.ts` | The loopback security model (Host/Origin checks, response writing, message redaction) |
168
+ | `accounts.ts` | WorkBuddy sign-in parsing, token encryption, the account pool and its cooldowns |
169
+ | `upstream.ts` | The WorkBuddy upstream client, error classification, rate-limit reset parsing |
170
+ | `catalog.ts` | The model catalog and its static fallback list |
171
+ | `shim.ts` | The WorkBuddy gateway's OpenAI-compatible endpoint |
172
+ | `at-rest.ts` | Unsealing 5.6+ encrypted sign-in fields |
173
+ | `promo.ts` | Promotion window matching |
174
+ | `trae-*.ts` / `qoder-*.ts` | Sign-in discovery, protocol clients, SSE decoding and gateways for both vendors |
146
175
 
147
176
  ## Credits
148
177
 
149
- Several modules are ported from, or reference, the MIT projects below:
178
+ Several modules are ported from or reference the MIT projects below:
150
179
 
151
180
  | Project | Copyright | Used for |
152
181
  | --- | --- | --- |
package/README.md CHANGED
@@ -16,6 +16,7 @@
16
16
 
17
17
  <p align="center">
18
18
  <a href="#安装">安装</a> ·
19
+ <a href="#使用">使用</a> ·
19
20
  <a href="#功能">功能</a> ·
20
21
  <a href="#设置">设置</a> ·
21
22
  <a href="CHANGELOG.md">更新日志</a> ·
@@ -30,7 +31,9 @@
30
31
  <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
32
  </p>
32
33
 
33
- 把本机 WorkBuddy、Trae、Qoder 的桌面登录接入 DeepSeek Harness。WorkBuddy 被限流或额度用尽时自动换号;Trae、Qoder 按请求选择账号,不保证失败后重试。三个来源独立开关,国内与国际账号分别成组。
34
+ 把本机 WorkBuddy、Trae、Qoder 的桌面登录接入 DeepSeek Harness。WorkBuddy 被限流或额度用尽时自动换号;Trae、Qoder 按请求选择账号,认证失败、限流或余额耗尽时换下一个登录重试,模型不存在、请求体非法这类请求自身的问题则按上游原样应答。三个来源独立开关,国内与国际账号分别成组。
35
+
36
+ 限流按上游给出的等待时间冷却,上游只在响应头给出时以它为准;额度用尽与登录失效不会自行恢复,该账号会退出轮换,直到余额重新读到或重新登录。上游主机不可达时换下一个登录重试。
34
37
 
35
38
  ## 预览
36
39
 
@@ -48,11 +51,11 @@
48
51
 
49
52
  在线预览:<https://chengzhi-c.github.io/dsh-wtq-pool/>。
50
53
 
51
- `docs/index.html` 加载实际面板代码并使用虚构演示数据,支持来源切换、模型设置和主题预览,不读取本机账号或令牌。
54
+ `docs/index.html` 用虚构演示数据加载实际面板代码,支持来源切换、模型设置和主题预览,不读取本机账号或令牌。
52
55
 
53
56
  ![预览页](https://github.com/chengzhi-c/dsh-wtq-pool/raw/main/docs/preview-page.png)
54
57
 
55
- 开启 `showComposerPoints` 后,输入区显示当前模型的账号积分,点击可查看该组账号并切换账号。下图由实际输入框扩展离屏渲染,非对话测试截图:
58
+ 开启 `showComposerPoints` 后,输入框工具栏显示当前模型的账号积分,点击可查看该组账号并切换账号。下图由实际输入框扩展离屏渲染:
56
59
 
57
60
  ![输入框积分](https://github.com/chengzhi-c/dsh-wtq-pool/raw/main/docs/preview-composer.png)
58
61
 
@@ -62,23 +65,26 @@
62
65
 
63
66
  - 复用本机登录:只读三家桌面 App 已保存的登录文件,不发起自己的 OAuth,不额外要一次授权。
64
67
  - 按 region 注册模型分组:三家各自的 region 各注册成一个 provider,可以同时开启;没有账号的 region 不注册。
65
- - 账号分发:WorkBuddy 支持优先使用、轮询、临期积分优先和会话固定账号,并在限流或额度用尽时自动换号;Trae、Qoder 支持轮询与临期积分优先。
66
- - 积分自动化:自动签到默认关闭。开启后的定时任务与「立即运行」执行同一轮,包含三家的签到、WorkBuddy 国内账号的连登和任务奖励及猫猫旅行。
67
- - 输入框积分:开启 `showComposerPoints` 后,输入区显示当前模型使用的账号余额,点开可换号。
68
- - 面板:账号状态、池状态、模型勾选、连接检查都在插件页的 WTQ Pool 卡片里。模型目录启动时加载,缓存过期后按需刷新,空闲不轮询。
68
+ - 账号分发:WorkBuddy 支持先用一个账号、轮流使用、临期积分优先和同一对话固定一个账号,并在限流或额度用尽时自动换号;Trae、Qoder 支持轮流使用与临期积分优先,认证失败、限流或余额耗尽时换下一个登录重试。
69
+ - 积分自动化:自动签到默认关闭。开启后的定时任务与「立即运行」执行同一轮,包含三家签到、WorkBuddy 国内账号的连登奖励、任务奖励和猫猫旅行。连登天数由上游按对话推进,该轮在每个国内账号读取连登档位前先补发一次对话活动上报,因此档位到点即可解锁领取,不需要用户自己进 WorkBuddy 聊一句。
70
+ - 输入框积分:开启 `showComposerPoints` 后,输入框工具栏显示当前模型使用的账号余额,点开可换号。功能关闭后浮层停止轮询。
71
+ - 面板:账号状态、池状态、模型勾选、连接检查都在插件页的「账号池」卡片里。模型目录启动时加载,缓存过期后按需刷新,空闲不轮询。停用的账号不参与探测,也不让面板一直显示"检测中"。
72
+ - 连接检查:每条发现都带判定。网关没在听、模型目录读不到、发布的地址与实际绑定的不一致、provider 没被宿主接受,都算失败并给出要改什么;检查自己出错时也作为一条发现写进报告,而不是让整条通道失败。
69
73
 
70
74
  ## 安装
71
75
 
72
76
  本地包:在源码目录执行 `pnpm install && pnpm run build && npm pack --pack-destination dist`,再安装生成的 `.tgz`:
73
77
 
74
78
  ```powershell
75
- $package = (Resolve-Path .\dist\dsh-wtq-pool-1.0.2.tgz).Path
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
- 使用实际 profile 名替换 `desktop`。若 `dsh` 不在 PATH,使用安装目录中的 CLI。也可按 npm 包名 `dsh-wtq-pool` 或仓库地址安装。
83
+ 需要 DeepSeek Harness 0.2.0 线(`package.json` 的 `engines.dsh`:`>=0.2.0-rc.1 <0.2.1`)与 Node `^22.19.0 || >=24.0.0`。
84
+
85
+ 使用实际 profile 名替换 `desktop`。若 `dsh` 不在 PATH,使用安装目录中的 CLI。也可按 npm 包名 `dsh-wtq-pool` 或仓库地址安装;按仓库地址安装时 pnpm 会执行 `prepare` 脚本从源码构建,需要在 profile 的 `pnpm-workspace.yaml` 里写 `allowBuilds: dsh-wtq-pool: true`,并钉在某个 commit 上。
80
86
 
81
- **面板在哪儿**:侧边栏进 **插件**,点 **dsh-wtq-pool** 那张卡片(或它旁边的 **配置**),完整面板嵌在卡片里。模型分组没出现时,按面板顶部的提示重启 dsh。
87
+ **面板在哪儿**:在侧边栏进入 **插件**,点开 **dsh-wtq-pool** 那张卡片(或它旁边的 **配置**),完整面板嵌在卡片里。模型分组没出现时,按面板顶部的提示重启 dsh。
82
88
 
83
89
  ## 使用
84
90
 
@@ -86,25 +92,34 @@ dsh plugin --profile desktop add $package
86
92
 
87
93
  顶层选来源,下面三屏:
88
94
 
89
- - **账号池**:每个号的标签、剩余积分、额度到期时间、冷却状态、签到进度;可单独停用某个号,或指定某个 region 优先用哪个号。WorkBuddy 的分发有优先用一个、轮流使用、优先使用临期积分、同一对话固定;Trae 与 Qoder 有轮流使用和优先使用临期积分。
95
+ - **账号池**:每个号的标签、剩余积分、额度到期时间、冷却状态、签到进度;可单独停用某个号、移除它,或指定某个 region 优先用哪个号。WorkBuddy 的分发有先用一个账号、轮流使用、临期积分优先、同一对话固定一个账号;Trae 与 Qoder 有轮流使用和临期积分优先。
90
96
  - **模型**:勾选这个 region 要暴露的模型,未勾选的不进模型选择器。可改显示名、上下文窗口、输出上限、思考等级和贴图支持。一个模型组最多发布 64 个,超出的标「未发布」,网关仍会服务它们。
91
- - **连接检查**:逐条报出网关在不在听、模型目录读到几个、注册的地址与实际绑定的是否一致、每个 provider 有没有被宿主接受,并可复制整份报告。
92
-
93
- 签到可单账号执行,也可在标题栏一次领完该来源。自动签到默认关闭,开启后默认于 09:00(北京时间)执行,错过时段将在下次启动补领。Trae 的每日签到是一台设备一次,Qoder 的新一轮在每天 10:00(北京时间)开出。
97
+ - **连接检查**:逐条报出网关在不在听、模型目录读到几个、注册的地址与实际绑定的是否一致、每个 provider 有没有被宿主接受,并可复制整份报告。网关启动失败时给出失败原因,面板按地址漂移提示重启。
98
+ 签到可单账号执行,也可在标题栏一次领完该来源。自动签到默认关闭,开启后默认于 09:00(北京时间)执行;当天错过的时段在当天内的下一次启动仍会补领,跨天则不补。Trae 的每日签到每台设备限领一次,Qoder 的新一轮在每天 10:00(北京时间)开出。
94
99
 
95
100
  ## 设置
96
101
 
97
- | 键 | 默认 | 说明 |
102
+ 这些键全部经宿主设置 schema 声明,改动写回 profile 后即生效:
103
+
104
+ | 键 | 默认(生效值) | 说明 |
98
105
  | --- | --- | --- |
99
106
  | `enabled` | `true` | 关闭后网关不启动 |
100
107
  | `sourceWorkbuddy` / `sourceTrae` / `sourceQoder` | `true` | 关闭后该来源不扫描、不发布、不请求 |
101
- | `distribution` | `priority` | WorkBuddy 池的发放方式:`priority` 先用一个,`round-robin` 均摊,`expiry` 优先消耗临期积分,`sticky` 同一对话固定 |
108
+ | `distribution` | `priority` | WorkBuddy 池的发放方式:`priority` 先用一个账号,`round-robin` 均摊,`expiry` 优先消耗临期积分,`sticky` 同一对话固定 |
102
109
  | `sourceDistributions` | `{}` | Trae、Qoder 的分发方式:`round-robin` / `expiry`;兼容旧值 `priority` |
103
110
  | `cooldownSeconds` | `60` | 限流冷却时长。上游报出重置时间时以它为准,按北京时间 |
104
- | `authFile` | `""` | WorkBuddy 登录文件路径;扫描其所在目录的全部 `.info` 登录,留空自动发现 |
105
- | `autoCheckin` | `{"enabled":false,"hours":[9]}` | 自动签到的开关与时点,`hours` 为北京时间整点,留空用 09:00 |
106
111
  | `creditReserves` | `{}` | 按账号 id 设定的积分保底,余额低于它的账号不参与分发 |
107
- | `showComposerPoints` | `false` | 在输入区显示当前账号积分 |
112
+ | `authFile` | `""` | WorkBuddy 登录文件路径;扫描其所在目录的全部 `.info` 登录,留空自动发现 |
113
+ | `autoCheckin` | `{"enabled":false,"hours":[9]}` | 自动签到的开关与时点;`hours` 为北京时间整点,留空用 09:00 |
114
+ | `showComposerPoints` | `false` | 在输入框工具栏显示当前账号积分 |
115
+ | `disabledAccountIds` | `[]` | 面板里停用的账号 id |
116
+ | `disabledRegions` | `[]` | 单独停用的 region,形如 `source:region` |
117
+ | `modelSelection` | `{}` | 每个网关勾选哪些模型,以及显示名、上下文窗口等覆写 |
118
+ | `preferredAccountIds` | `{}` | WorkBuddy 每个 region 的首选账号 |
119
+ | `preferredSourceAccounts` | `{}` | Trae、Qoder 每个 region 的首选账号,键为 `source:region` |
120
+ | `removedAccounts` | `[]` | 从池里移除的账号,标签与 region 一并保留,面板可据此提供恢复 |
121
+
122
+ 默认列是生效值:`autoCheckin.hours` 存为空数组,运行时归一为 `[9]`;`authFile` 未设或留空即自动发现。
108
123
 
109
124
  模型勾选和首选账号由面板保存。命令面板里也可打开面板、重新检测、清除冷却、全部签到、连接检查。
110
125
 
@@ -118,11 +133,13 @@ Qoder 42871 / 42881
118
133
 
119
134
  以上为首选端口。被占用时网关绑定临时端口,运行时 provider 注册使用本次实际地址,面板显示回退结果。国内模型仅使用国内账号。
120
135
 
136
+ 端口在预留与监听之间被别的进程抢走时,该网关本次启动失败:它的模型组会被摘掉,连接检查报出失败原因,面板提示重启宿主。重启后 host 重新读注册表,请求才会落到新地址上。
137
+
121
138
  ## 数据与出网
122
139
 
123
- 只读三家 App 的本机登录文件,不写回登录状态。provider 通过运行时注册接入,不改写宿主 provider 配置;插件设置仍由宿主持久化至 profile。令牌仅在插件进程中使用,并发往对应厂商接口。网关仅监听 `127.0.0.1`;面板资源与 RPC 只接受实际回环对端,不信任代理转发头,因此远程浏览器不能直接使用面板。插件不直接管理或删除宿主会话记录。
140
+ 只读三家 App 的本机登录文件,不写回登录状态。provider 通过运行时注册接入,不改写宿主 provider 配置;插件设置仍由宿主持久化至 profile。令牌仅在插件进程中使用,并发往对应厂商接口。网关仅监听 `127.0.0.1`;面板资源与 RPC 只接受实际回环对端,不信任代理转发头,因此远程浏览器不能直接使用面板。插件不直接管理或删除宿主会话记录。插件自管数据目录 `~/.dsh/dsh-wtq-pool/`(设了 `DSH_HOME` 则用它)里另有两个文件:`checkin-slots.json` 记录已领取的签到时段,先写临时文件再改名,只保留三天;`doctor.txt` 是最近一次连接检查的报告。
124
141
 
125
- 同一台机器上的其他进程可以调用这些回环端点,从而消耗已登录账号的额度。
142
+ 同一台机器上的其他进程可以调用这些回环端点,从而消耗已登录账号的额度。重启后回复缺失时应同时检查插件日志与宿主持久化日志。
126
143
 
127
144
  令牌只会发往以下主机:
128
145
 
@@ -142,11 +159,24 @@ pnpm run typecheck:client
142
159
  pnpm test # Node 自带测试,离线回归
143
160
  ```
144
161
 
145
- `src/host.ts` 是引擎(账号发现、池、网关、面板通道),`src/index.ts` 是 Cordis 入口(设置 schema、provider 注册、面板路由),`src/pi-compat.ts` 把宿主能力适配成引擎已在用的那套调用,`src/client/` 是面板与输入区的 React 半。
162
+ `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/` 后须重建并提交。
163
+
164
+ 与宿主无关的核心模块:
165
+
166
+ | 模块 | 职责 |
167
+ | --- | --- |
168
+ | `loopback.ts` | 回环端点的安全模型(Host/Origin 校验、响应写入、报错脱敏) |
169
+ | `accounts.ts` | WorkBuddy 登录文件解析、令牌加解密、账号池与冷却 |
170
+ | `upstream.ts` | WorkBuddy 上游客户端、错误分类、限流重置解析 |
171
+ | `catalog.ts` | 模型目录与静态兜底列表 |
172
+ | `shim.ts` | WorkBuddy 网关的 OpenAI 兼容端点 |
173
+ | `at-rest.ts` | 5.6+ 密封登录字段的解封 |
174
+ | `promo.ts` | 促销窗口判定 |
175
+ | `trae-*.ts` / `qoder-*.ts` | 两家的登录发现、协议客户端、SSE 解码与网关 |
146
176
 
147
177
  ## 致谢
148
178
 
149
- 若干模块移植或参考自下列 MIT 项目,特此鸣谢:
179
+ 本插件的若干模块移植或参考自下列 MIT 项目:
150
180
 
151
181
  | 项目 | 版权 | 用于 |
152
182
  | --- | --- | --- |
package/cordis.patch.yml CHANGED
@@ -4,3 +4,5 @@
4
4
  - insert:
5
5
  - id: llm-dsh-xdpool
6
6
  name: dsh-wtq-pool
7
+ disabled: false
8
+ inject: [llm, settings]
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
  *