dsh-wtq-pool 1.0.51 → 1.2.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/renderer/panel.js CHANGED
@@ -50,10 +50,13 @@ var EN = {
50
50
  "region.parkedShort": "disabled",
51
51
  "region.global": "Global",
52
52
  "region.cnShort": "CN",
53
- "region.globalShort": "Global",
54
53
  "pool.summary": "{count} account(s) · {cooling} cooling",
55
54
  "pool.healthy": "Rate limits automatically switch to another available account.",
56
55
  "pool.allCooling": "Every account is rate-limited right now; requests pause until a cooldown lifts.",
56
+ "pool.refused": "{count} need a new sign-in",
57
+ "pool.allRefused": "Every account's sign-in was refused by the upstream; add one with Add account and the pool starts working again.",
58
+ "pool.restricted": "{count} restricted by the upstream",
59
+ "pool.allRestricted": "Every account was restricted by the upstream; appeal the restriction in the WorkBuddy console, or add another account.",
57
60
  "pool.checkinAll": "Check in every account",
58
61
  "pool.checkinAllHint": "Collect every account's daily check-in. The streak bonus is collected with it.",
59
62
  "pool.checkinAllBusy": "Checking in…",
@@ -106,6 +109,7 @@ var EN = {
106
109
  "qoder.fallback": "preferred port {port} is taken; this session serves a spare port, which the provider row follows",
107
110
  "badge.next": "next up",
108
111
  "badge.cooling": "cooling",
112
+ "badge.revoked": "re-login needed",
109
113
  "badge.healthy": "healthy",
110
114
  "acct.token": "token {time}",
111
115
  "acct.tokenExpiring": "token expires in {min} min",
@@ -114,13 +118,18 @@ var EN = {
114
118
  "time.days": "{count} d",
115
119
  "acct.noExpiry": "no token expiry reported",
116
120
  "acct.coolUntil": "cooling until {time}",
121
+ "acct.holdUntil": "held until {time}",
122
+ "acct.restrictedUntil": "restricted by the upstream until {time}",
123
+ "acct.restrictedHint": "The upstream restricted this account (11140: unusual activity). The pool leaves it out of rotation six hours at a time and retries afterwards; appeal it in the WorkBuddy console.",
124
+ "badge.restricted": "restricted",
125
+ "acct.signInRefused": "The upstream no longer accepts this account's sign-in, and its refresh token is spent. Add the account again from the panel: that sign-in is the plugin's own copy.",
117
126
  "acct.hits": "{hits} rate-limit hit(s)",
118
127
  "acct.choose": "Use credits from",
119
128
  "acct.automatic": "Automatic (follow account usage)",
120
129
  "acct.choiceHint": "The picked account goes first; a rate limit switches account until the cooldown lifts. Automatic follows the usage mode.",
121
130
  "acct.unavailable": "Selected account unavailable (automatic fallback)",
122
131
  "acct.expired": "sign-in expired",
123
- "acct.archivedHint": "The global client keeps one sign-in file, so switching accounts overwrites this one. The token was saved: the account keeps serving until it expires. Sign in again in WorkBuddy to renew it.",
132
+ "acct.archivedHint": "No desktop sign-in file holds this account any more: the token the pool kept is what serves it, until that token expires. Signing the account in again in WorkBuddy renews it.",
124
133
  "acct.choiceCredits": "{label} · {credits} credits",
125
134
  "badge.preferred": "selected",
126
135
  "acct.on": "Enabled",
@@ -128,17 +137,16 @@ var EN = {
128
137
  "acct.switchOn": "Use this account again",
129
138
  "acct.inPool": "In the rotation",
130
139
  "acct.switchOff": "Keep this account out of the pool for now",
131
- "acct.offHint": "Switched off: requests never use this account until you switch it back on.",
132
140
  "acct.remove": "Remove",
133
141
  "acct.removeHint": "Takes the account out of the pool. Restore it under “Removed accounts”.",
134
142
  "acct.delete": "Delete",
135
- "acct.deleteHint": "Deletes the sign-in file this plugin wrote. The account is gone for good and cannot be restored.",
136
- "acct.deleteConfirm": "Delete {name}? The sign-in file is removed and the account cannot be brought back.",
143
+ "acct.deleteHint": "Takes the account out of the pool and deletes the plugin's saved sign-in and archive; signing the account in again restores it.",
144
+ "acct.deleteConfirm": "Delete {name}? It leaves the pool and deletes the plugin's saved sign-in and archive; a rescan will not bring it back. Signing the account in again restores it.",
137
145
  "acct.deleteConfirmAgain": "Press delete again to confirm",
138
146
  "acct.stateError": "Could not change this account: {message}",
139
147
  "pool.switchedOff": "{count} switched off",
140
148
  "removed.title": "Removed accounts",
141
- "removed.hint": "These accounts are never used, and detecting accounts again will not bring them back.",
149
+ "removed.hint": "Out of the pool; restore one here and it rejoins rotation.",
142
150
  "removed.restore": "Restore",
143
151
  "acct.modelCool": "{model} cooling until {time}",
144
152
  "credits.title": "Credits",
@@ -243,16 +251,16 @@ var EN = {
243
251
  "keepAlive.runNow": "Refresh now",
244
252
  "keepAlive.running": "Refreshing…",
245
253
  "keepAlive.label": "Token keep-alive",
246
- "keepAlive.hint": "Renews sign-in tokens that are close to expiry, on demand. An account you rarely use then does not hit an expired token on the turn that needed it. Tokens with plenty of time left are left alone.",
254
+ "keepAlive.hint": "Renews sign-in tokens on demand: plugin-owned copies refresh once six hours old or close to expiry, and the result is written back into the file the plugin owns, so a refused sign-in shows up the same day. The desktop app renews the sign-in it is using.",
247
255
  "growth.title": "Growth centre",
248
256
  "growth.ready": "WorkBuddy",
249
257
  "growth.running": "Running…",
250
258
  "growth.read": "Read state",
251
259
  "growth.reading": "Reading…",
252
- "growth.readHint": "Reads what the centre holds without claiming anything.",
260
+ "growth.readHint": "Reads the current tiers and what is due; Run now claims them.",
253
261
  "growth.run": "Run now",
254
- "growth.runHint": "Runs the growth half of the scheduled check-in on its own, and reports each step.",
255
- "growth.hint": "Four steps: the make-up card, the gift and compensation, the activity report, and the streak tiers with their draws. A run consumes the make-up card and the draws; the rest are idempotent and pay nothing a second time.",
262
+ "growth.runHint": "Runs the growth stage of the scheduled check-in on its own, and reports each step.",
263
+ "growth.hint": "Four steps: the make-up card, the gift and compensation, the activity report, and the streak tiers with their draws. A run consumes the make-up card and the draws; the rest can run again without paying twice.",
256
264
  "growth.stateNone": "No state read yet",
257
265
  "growth.stateStale": "The last run made this stale; read the state again",
258
266
  "growth.stateSummary": "{accounts} account(s) · {tiers} tier(s) to redeem · {cards} make-up card(s) · {chances} draw(s)",
@@ -267,7 +275,7 @@ var EN = {
267
275
  "growth.tierLocked": "locked",
268
276
  "growth.rowNothing": "Nothing to collect here",
269
277
  "growth.rowFailed": "This account could not be read",
270
- "growth.onlyWorkbuddy": "The growth centre belongs to WorkBuddy.",
278
+ "growth.onlyWorkbuddy": "The growth centre applies to WorkBuddy accounts.",
271
279
  "growth.runNone": "Nothing to collect on this pass",
272
280
  "growth.runLine": "{when}: make-up {makeup} · gift +{gift} · compensation +{compensation} · activity {activity} · tiers {streak} · draws {lottery} · +{credit} credits",
273
281
  "growth.runFailed": "{when}: {failed} step(s) failed",
@@ -279,13 +287,6 @@ var EN = {
279
287
  "composer.hint": "When the selected model belongs to this plugin, its account's credits appear on the left of the composer. Click to switch accounts.",
280
288
  "composer.show": "Show credits",
281
289
  "composer.hide": "Hide credits",
282
- "rewrite.title": "Client name",
283
- "rewrite.on": "On",
284
- "rewrite.off": "Off",
285
- "rewrite.label": "Rename the client in the prompt the domestic host receives",
286
- "rewrite.hint": "The domestic WorkBuddy host refuses a request whose prompt names DeepSeek Harness as the client (channel check 11128). Turned on, every occurrence of that name is sent as DeepSeek; turned off, the original wording is sent.",
287
- "rewrite.show": "Rename client",
288
- "rewrite.hide": "Stop renaming",
289
290
  "check.title": "Connection check",
290
291
  "check.empty": "Run the check to see whether a chat can reach WorkBuddy, Trae or Qoder.",
291
292
  "check.pass": "PASS",
@@ -299,6 +300,7 @@ var EN = {
299
300
  "foot.license": "License",
300
301
  "err.bridge": "The panel bridge is unavailable.",
301
302
  "err.busy": "The panel is busy with another action; try again in a moment.",
303
+ "err.stale": "The plugin was reloading; the list below is the last document before the reload. Refresh again.",
302
304
  "tag.free": "free",
303
305
  "tag.rate": "x{rate}",
304
306
  "tag.promoNight": "free until {hour}",
@@ -336,10 +338,13 @@ var ZH = {
336
338
  "region.parkedShort": "已停用",
337
339
  "region.global": "国际版",
338
340
  "region.cnShort": "国内版",
339
- "region.globalShort": "国际版",
340
341
  "pool.summary": "{count} 个账号 · {cooling} 个冷却中",
341
342
  "pool.healthy": "限流时会自动切换到其他可用账号。",
342
343
  "pool.allCooling": "所有账号当前都被限流,请求会等到有账号冷却结束。",
344
+ "pool.refused": "{count} 个需重新登录",
345
+ "pool.allRefused": "所有账号的登录都已被上游拒绝,用「添加账号」重新登录一个,号池就能继续用。",
346
+ "pool.restricted": "{count} 个被上游限制",
347
+ "pool.allRestricted": "所有账号都被上游限制了;请到 WorkBuddy 官方后台申诉,或换一个账号。",
343
348
  "pool.checkinAll": "全部签到",
344
349
  "pool.checkinAllHint": "一次领完所有账号今天的签到,连登奖励也随这一轮领取。",
345
350
  "pool.checkinAllBusy": "签到中…",
@@ -350,7 +355,7 @@ var ZH = {
350
355
  "pool.emptyHint": "请在该版本的 WorkBuddy 桌面 App 里登录,再点「重新检测账号」。",
351
356
  "pool.sourceOff": "WorkBuddy 来源已在插件设置里关闭。",
352
357
  "login.add": "添加账号",
353
- "login.addHint": "在浏览器里登录 WorkBuddy。浏览器登完,这个账号就进池子了。",
358
+ "login.addHint": "在浏览器里登录 WorkBuddy,完成后该账号即加入账号池。",
354
359
  "login.openAgain": "再打开一次链接",
355
360
  "login.waiting": "在浏览器里完成登录即可,面板会自己把这个账号收进来。",
356
361
  "login.timeout": "登录没有完成。重新开始一次拿新链接。",
@@ -392,6 +397,7 @@ var ZH = {
392
397
  "badge.next": "下一个",
393
398
  "source.claimableAt": "{time} 后可签到",
394
399
  "badge.cooling": "冷却中",
400
+ "badge.revoked": "需重新登录",
395
401
  "badge.healthy": "可用",
396
402
  "acct.token": "令牌 {time}",
397
403
  "acct.tokenExpiring": "令牌将在 {min} 分钟后过期",
@@ -400,13 +406,18 @@ var ZH = {
400
406
  "time.days": "{count} 天",
401
407
  "acct.noExpiry": "令牌没有报告有效期",
402
408
  "acct.coolUntil": "冷却至 {time}",
409
+ "acct.holdUntil": "暂停至 {time}",
410
+ "acct.restrictedUntil": "被上游限制,直至 {time}",
411
+ "acct.restrictedHint": "上游限制了这个账号(11140:账号存在异常行为)。号池每六小时重试一次;请到 WorkBuddy 官方后台提交申诉。",
412
+ "badge.restricted": "已限制",
413
+ "acct.signInRefused": "该账号的登录已被上游拒绝,刷新令牌同样失效。在面板上「添加账号」重新登录一次:这份登录由插件自己保管。",
403
414
  "acct.hits": "已触发 {hits} 次限流",
404
415
  "acct.choose": "使用哪个账号的额度",
405
416
  "acct.automatic": "自动选择(按使用方式)",
406
417
  "acct.choiceHint": "优先用所选账号,限流时临时换号;自动选择则按使用方式分配。",
407
418
  "acct.unavailable": "所选账号暂不可用(自动换号)",
408
419
  "acct.expired": "登录已过期",
409
- "acct.archivedHint": "国际版只保留一个登录文件,切号时本账号的登录被覆盖。令牌已留存,账号可用到令牌到期。在 WorkBuddy 里重新登录可续期。",
420
+ "acct.archivedHint": "桌面端已经没有文件持有这个账号:面板上的这份令牌就是它在用的,到期为止。在 WorkBuddy 里重新登录该账号可续期。",
410
421
  "acct.choiceCredits": "{label} · {credits} 积分",
411
422
  "badge.preferred": "已选",
412
423
  "acct.on": "启用中",
@@ -414,17 +425,16 @@ var ZH = {
414
425
  "acct.switchOn": "重新使用该账号",
415
426
  "acct.inPool": "参与轮换",
416
427
  "acct.switchOff": "暂时不使用该账号",
417
- "acct.offHint": "已停用:在重新启用之前,请求不会使用该账号。",
418
428
  "acct.remove": "移除",
419
429
  "acct.removeHint": "把账号移出账号池;可在「已移除的账号」里恢复。",
420
430
  "acct.delete": "删除",
421
- "acct.deleteHint": "删掉这个插件自己写下的登录文件。账号就此没有了,不能恢复。",
422
- "acct.deleteConfirm": "要删除 {name} 吗?登录文件会被删掉,这个账号再也回不来。",
431
+ "acct.deleteHint": "移出账号池,并删除插件保存的登录与留档;重新登录该账号即可恢复。",
432
+ "acct.deleteConfirm": "要删除 {name} 吗?它会退出账号池,插件保存的登录与留档一并删除;重新扫描不会再带回,重新登录该账号即可恢复。",
423
433
  "acct.deleteConfirmAgain": "再按一次确认删除",
424
434
  "acct.stateError": "账号设置失败:{message}",
425
435
  "pool.switchedOff": "{count} 个已停用",
426
436
  "removed.title": "已移除的账号",
427
- "removed.hint": "这些账号不会被使用,重新检测也不会回到池中。",
437
+ "removed.hint": "已退出账号池;在此恢复后重新参与分发。",
428
438
  "removed.restore": "恢复",
429
439
  "acct.modelCool": "{model} 冷却至 {time}",
430
440
  "credits.title": "积分",
@@ -510,24 +520,17 @@ var ZH = {
510
520
  "composer.hint": "开启后,选中本插件的模型时,输入框左侧显示正在使用的账号积分。点开可以换号。",
511
521
  "composer.show": "显示积分",
512
522
  "composer.hide": "隐藏积分",
513
- "rewrite.title": "客户端名称",
514
- "rewrite.on": "已开启",
515
- "rewrite.off": "已关闭",
516
- "rewrite.label": "改写发往国内版的提示词里的客户端名称",
517
- "rewrite.hint": "WorkBuddy 国内版会拒绝提示词里把自己称作 DeepSeek Harness 的对话请求(渠道校验 11128)。开启后,提示词里这个名称的每一处都改为 DeepSeek;关闭后恢复原名。",
518
- "rewrite.show": "改写名称",
519
- "rewrite.hide": "恢复原名",
520
523
  "growth.title": "成长中心",
521
524
  "growth.ready": "WorkBuddy",
522
525
  "growth.running": "运行中…",
523
526
  "growth.read": "读取状态",
524
527
  "growth.reading": "读取中…",
525
- "growth.readHint": "只读成长中心现在有什么,不领。",
528
+ "growth.readHint": "读取当前档位与可领取项;领取动作在「立即执行」。",
526
529
  "growth.run": "立即执行",
527
- "growth.runHint": "单独执行定时签到里那段成长链路,并按步骤报告结果。",
528
- "growth.hint": "四项:补签卡、礼包与补偿、活跃上报、连登档位与抽奖。补签卡与抽奖次数在执行后扣减,其余分项可重复执行,不会二次到账。",
530
+ "growth.runHint": "单独执行定时签到里的成长环节,并按步骤报告结果。",
531
+ "growth.hint": "四项:补签卡、礼包与补偿、活跃上报、连登档位与抽奖。补签卡与抽奖次数在执行后扣减,其余分项可重复执行,只到账一次。",
529
532
  "growth.stateNone": "还没有读过状态",
530
- "growth.stateStale": "跑过一趟之后状态就旧了,点「读取状态」更新",
533
+ "growth.stateStale": "执行后读数已过期,请重新读取",
531
534
  "growth.stateSummary": "{accounts} 个账号 · 可兑换 {tiers} 档 · 补签卡 {cards} 张 · 抽奖 {chances} 次",
532
535
  "growth.groupCount": "{count} 个账号",
533
536
  "growth.stateFailed": "{failed} 个账号读不出来",
@@ -540,8 +543,8 @@ var ZH = {
540
543
  "growth.tierLocked": "未解锁",
541
544
  "growth.rowNothing": "这里没有可领的",
542
545
  "growth.rowFailed": "这个账号读不出来",
543
- "growth.onlyWorkbuddy": "成长中心只跟 WorkBuddy 有关。",
544
- "growth.runNone": "这一趟没有可领的",
546
+ "growth.onlyWorkbuddy": "成长中心对 WorkBuddy 账号生效。",
547
+ "growth.runNone": "本次没有可领取的项",
545
548
  "growth.runLine": "{when}:补签 {makeup} · 礼包 +{gift} · 补偿 +{compensation} · 活跃上报 {activity} · 档位 {streak} · 抽奖 {lottery} · 共 +{credit} 积分",
546
549
  "growth.runFailed": "{when}:{failed} 个步骤失败",
547
550
  "growth.busy": "签到正在跑,等它跑完",
@@ -561,13 +564,13 @@ var ZH = {
561
564
  "auto.rowTrae": "Trae",
562
565
  "auto.rowCounts": "{label}:领取 {claimed} · 跳过 {skipped} · 失败 {failed}",
563
566
  "auto.rowGrowth": "连登:{streak} 档 · +{credit} 积分 · 失败 {failed}",
564
- "auto.rowKeepAlive": "令牌保活 {when}:刷新 {refreshed} 个 · 无需处理 {fresh} 个 · 失败 {failed} 个 · 无刷新令牌 {noToken} 个",
567
+ "auto.rowKeepAlive": "令牌保活 {when}:刷新 {refreshed} 个 · 已是最新 {fresh} 个 · 失败 {failed} 个 · 无刷新令牌 {noToken} 个",
565
568
  "auto.rowTravelCounts": "{label}:派出 {departed} · 领奖 {claimed} · 领养 {adopted}",
566
569
  "auto.hint": "时间到后一次性领取三家(WorkBuddy / Trae / Qoder)的签到奖励、WorkBuddy 国内账号的连登奖励,并顺带完成猫猫旅行;今天已领过的时段跳过。当天错过的时段在下次启动时补领。",
567
570
  "keepAlive.runNow": "立即刷新",
568
571
  "keepAlive.running": "刷新中…",
569
572
  "keepAlive.label": "登录令牌保活",
570
- "keepAlive.hint": "按需续上快到期的登录令牌,久未使用的账号因此不会在下一趟对话上撞到已过期的令牌。有效期还长的令牌不发请求。",
573
+ "keepAlive.hint": "按需续期登录令牌:插件自管的副本满 6 小时或临近到期即刷新,结果写回插件自己的登录文件,登录被上游拒绝时当天即可发现。桌面端正在使用的登录由桌面端续期。",
571
574
  "auto.badHours": "时间请填 0–23 的整数小时,例如 9 或 9,21。",
572
575
  "check.title": "连接检查",
573
576
  "check.empty": "运行检查可以看到对话能否连上 WorkBuddy、Trae 或 Qoder。",
@@ -582,6 +585,7 @@ var ZH = {
582
585
  "foot.license": "许可",
583
586
  "err.bridge": "面板桥不可用。",
584
587
  "err.busy": "面板正在处理其他操作,请稍候再试。",
588
+ "err.stale": "插件刚刚重载,当前列表还是重载前的状态,请再刷新一次。",
585
589
  "tag.free": "免费",
586
590
  "tag.rate": "x{rate}",
587
591
  "tag.promoNight": "夜间免费 · 到 {hour}",
@@ -838,7 +842,7 @@ var reserveDrafts = {};
838
842
  // ----------------------------------------------------------------- render
839
843
 
840
844
  function regionLabel(region, short) {
841
- if (region === "global") return t(short ? "region.globalShort" : "region.global");
845
+ if (region === "global") return t("region.global");
842
846
  return t(short ? "region.cnShort" : "region.cn");
843
847
  }
844
848
 
@@ -846,6 +850,18 @@ function accountsOf(region) {
846
850
  return (state && state.accounts ? state.accounts : []).filter(function (a) { return a.region === region; });
847
851
  }
848
852
 
853
+ /**
854
+ * A rate limit, as opposed to a hold the pool decided on its own.
855
+ *
856
+ * `cooling` is set for all three states, so a summary that counts it directly
857
+ * tells the user to wait out a window that does not exist: a refused sign-in
858
+ * needs a fresh login and a vendor restriction needs an appeal. Three summary
859
+ * lines counted it directly and each read "cooling" over a parked account.
860
+ */
861
+ function isCooling(account) {
862
+ return account.cooling === true && account.hold !== "session" && account.hold !== "restricted";
863
+ }
864
+
849
865
 
850
866
 
851
867
  function modelsOf(region) {
@@ -854,8 +870,18 @@ function modelsOf(region) {
854
870
 
855
871
  function renderHeader() {
856
872
  var accounts = state ? state.accounts || [] : [];
857
- var cooling = accounts.filter(function (a) { return a.cooling; }).length;
858
- var healthy = accounts.length > 0 && cooling < accounts.length;
873
+ // A held sign-in is not a rate limit: counting it as cooling understated how
874
+ // many accounts the pool had actually lost, and the summary read "0 cooling"
875
+ // over a pool where half the rows could not answer.
876
+ // Three states, three counts: a refused sign-in, a vendor restriction and a
877
+ // rate limit all read as `cooling` upstream, and lumping them together told
878
+ // the user to wait out a window that does not exist.
879
+ var cooling = accounts.filter(isCooling).length;
880
+ var refused = accounts.filter(function (a) { return a.hold === "session"; }).length;
881
+ var restricted = accounts.filter(function (a) { return a.hold === "restricted"; }).length;
882
+ // A pool whose every account is refused has nobody to serve a turn, so the
883
+ // dot must not read healthy just because a refused sign-in is not cooling.
884
+ var healthy = accounts.length > 0 && cooling + refused + restricted < accounts.length;
859
885
  var refreshing = state !== null && state.refreshing === true;
860
886
  var dot = $("healthDot");
861
887
  dot.className = "dot " + (state === null ? "idle" : (healthy ? "ok" : "idle")) + (refreshing ? " busy" : "");
@@ -866,7 +892,9 @@ function renderHeader() {
866
892
  $("barTitle").textContent = "WTQ Pool";
867
893
  var sub = state === null
868
894
  ? t("state.loading")
869
- : t("pool.summary", { count: accounts.length, cooling: cooling });
895
+ : t("pool.summary", { count: accounts.length, cooling: cooling })
896
+ + (refused > 0 ? " · " + t("pool.refused", { count: refused }) : "")
897
+ + (restricted > 0 ? " · " + t("pool.restricted", { count: restricted }) : "");
870
898
  // The first paint comes from cache while detection runs behind it, so say so
871
899
  // instead of leaving the user to wonder why the numbers are not final yet.
872
900
  if (state && state.refreshing === true) sub = sub + " · " + t("state.refreshing");
@@ -927,6 +955,10 @@ function renderSourceTabs() {
927
955
  for (var j = 0; j < groups.length; j += 1) {
928
956
  groups[j].hidden = groups[j].getAttribute("data-source") !== activeSource;
929
957
  }
958
+ // The keep-alive renews WorkBuddy sign-ins only; leaving the card on Trae or
959
+ // Qoder made it look as if "Refresh now" would touch that source's tokens.
960
+ var keepAliveCard = $("keepAliveCard");
961
+ if (keepAliveCard) keepAliveCard.hidden = activeSource !== "workbuddy";
930
962
  // The source tab owns the models view too, and a source tab click does not
931
963
  // run the whole render, so the model page and the footer - which names the
932
964
  // endpoint of the source on screen - are repainted from here.
@@ -1129,7 +1161,7 @@ function renderWorkbuddyHead() {
1129
1161
  clear(host);
1130
1162
  if (state === null) return;
1131
1163
  var accounts = state.accounts || [];
1132
- var cooling = accounts.filter(function (account) { return account.cooling; }).length;
1164
+ var cooling = accounts.filter(isCooling).length;
1133
1165
  var off = accounts.filter(function (account) { return account.disabled === true; }).length;
1134
1166
  host.appendChild(el("strong", null, t("workbuddy.title")));
1135
1167
  host.appendChild(el("span", "muted", t("pool.summary", { count: accounts.length, cooling: cooling })));
@@ -1171,18 +1203,24 @@ function renderPoolStrip() {
1171
1203
  var strip = $("poolStrip");
1172
1204
  clear(strip);
1173
1205
  var accounts = accountsOf(activeRegion);
1174
- var cooling = accounts.filter(function (a) { return a.disabled !== true && a.cooling; }).length;
1206
+ var refused = accounts.filter(function (a) { return a.hold === "session"; }).length;
1207
+ var restricted = accounts.filter(function (a) { return a.hold === "restricted"; }).length;
1175
1208
  var off = accounts.filter(function (a) { return a.disabled === true; }).length;
1176
- // Only the accounts that can serve are counted: a switched-off account is not
1177
- // rate-limited, so counting it here would read "every account is rate-limited"
1178
- // over a row that also said "1 switched off". A pool whose serving accounts are
1179
- // all cooling really does pause, and one with nothing switched on says so on
1180
- // the line below rather than here.
1181
- var serving = accounts.length - off;
1209
+ // Only the accounts that can serve a turn right now are counted. A
1210
+ // switched-off account is not rate-limited, and a refused sign-in is parked,
1211
+ // so counting either would read "every account is rate-limited" over a row
1212
+ // that also said "1 switched off". A pool whose serving accounts are all
1213
+ // cooling really does pause, and one with nothing switched on says so on the
1214
+ // line below rather than here.
1215
+ var usable = accounts.filter(function (a) { return a.disabled !== true && !a.cooling; }).length;
1182
1216
  var noteText = accounts.length === 0
1183
1217
  ? ""
1184
- : (serving > 0 && cooling >= serving ? t("pool.allCooling") : t("pool.healthy"));
1218
+ : usable <= 0
1219
+ ? (restricted > 0 && refused === 0 ? t("pool.allRestricted") : refused > 0 ? t("pool.allRefused") : t("pool.allCooling"))
1220
+ : t("pool.healthy");
1185
1221
  if (noteText) strip.appendChild(el("span", "muted", noteText));
1222
+ if (refused > 0) strip.appendChild(el("span", "finding-fail", t("pool.refused", { count: refused })));
1223
+ if (restricted > 0) strip.appendChild(el("span", "finding-fail", t("pool.restricted", { count: restricted })));
1186
1224
  if (off > 0) strip.appendChild(el("span", "muted", t("pool.switchedOff", { count: off })));
1187
1225
  }
1188
1226
 
@@ -1725,16 +1763,19 @@ function renderAutoCheckin() {
1725
1763
  run.disabled = busy !== null;
1726
1764
 
1727
1765
  // The keep-alive row: one button, run by hand. It is a static node, so the
1728
- // handler lives in `bind`.
1766
+ // handler lives in `bind`. Its own card, its own log: it renews tokens rather
1767
+ // than collecting rewards and has no hour to set, so it shares nothing with
1768
+ // the schedule beside the accounts both walk. The head carries no second
1769
+ // reading of the last run - the row below already says when, and two labels
1770
+ // for one fact is how one of them ends up stale.
1729
1771
  var keepAliveRun = $("tokenKeepAliveRun");
1730
1772
  keepAliveRun.textContent = busy === "keepAlive" ? t("keepAlive.running") : t("keepAlive.runNow");
1731
1773
  keepAliveRun.disabled = busy !== null;
1732
- $("keepAliveText").textContent = t("keepAlive.label");
1774
+ $("keepAliveTitle").textContent = t("keepAlive.label");
1733
1775
  $("keepAliveHint").textContent = t("keepAlive.hint");
1734
1776
  $("autoHint").textContent = t("auto.hint");
1735
- // The keep-alive is a sibling of the schedule in the document rather than a
1736
- // field of it, so the log's reader is handed the two halves it needs.
1737
- paintAutoNote($("autoNote"), { last: auto.last, keepAlive: state && state.keepAlive });
1777
+ paintAutoNote($("autoNote"), { last: auto.last });
1778
+ paintKeepAliveNote($("keepAliveNote"), state && state.keepAlive);
1738
1779
  }
1739
1780
 
1740
1781
  /**
@@ -1761,26 +1802,6 @@ function renderComposerPoints() {
1761
1802
  $("composerPointsHint").textContent = t("composer.hint");
1762
1803
  }
1763
1804
 
1764
- /**
1765
- * The client-name switch.
1766
- *
1767
- * Same shape as the credits switch above, and for the same reason: the label says
1768
- * what pressing it will do and which way it currently stands. Off by default -
1769
- * turning it on is the user's decision, because it changes what the prompt tells
1770
- * the upstream about the client.
1771
- */
1772
- function renderRewriteClientName() {
1773
- var renamed = state !== null && typeof state.replacedClientName === "string";
1774
- $("rewriteTitle").textContent = t("rewrite.title");
1775
- $("rewriteState").textContent = renamed ? t("rewrite.on") : t("rewrite.off");
1776
- var button = $("rewriteClientName");
1777
- button.textContent = t(renamed ? "rewrite.hide" : "rewrite.show");
1778
- button.className = "small" + (renamed ? " on" : "");
1779
- button.disabled = busy !== null;
1780
- $("rewriteText").textContent = t("rewrite.label");
1781
- $("rewriteHint").textContent = t("rewrite.hint");
1782
- }
1783
-
1784
1805
  /**
1785
1806
  * The check-in log: one row per source, each with a state dot.
1786
1807
  *
@@ -1794,38 +1815,14 @@ function renderRewriteClientName() {
1794
1815
  */
1795
1816
  function autoNoteRows(auto) {
1796
1817
  var last = auto.last;
1797
- // The keep-alive is a duty of its own rather than a stage of the pass, so it
1798
- // reports on its own line and says when it last ran - on every path, including
1799
- // the ones that have nothing to say about a check-in pass. Its record is the
1800
- // only proof the button did anything, and a restart clears the pass log without
1801
- // touching it.
1802
- var keepAliveRow = null;
1803
- if (auto.keepAlive) {
1804
- keepAliveRow = {
1805
- text: t("auto.rowKeepAlive", {
1806
- when: formatStamp(auto.keepAlive.at),
1807
- refreshed: Number(auto.keepAlive.refreshed) || 0,
1808
- fresh: Number(auto.keepAlive.fresh) || 0,
1809
- failed: Number(auto.keepAlive.failed) || 0,
1810
- noToken: Number(auto.keepAlive.noToken) || 0,
1811
- }),
1812
- tone: Number(auto.keepAlive.failed) > 0 || Number(auto.keepAlive.noToken) > 0 ? "fail"
1813
- : Number(auto.keepAlive.refreshed) > 0 ? "ok" : "",
1814
- };
1815
- }
1816
- // What the pass log has to say, with the keep-alive line kept on the end.
1817
- var finish = function (rows) {
1818
- if (keepAliveRow !== null) rows.push(keepAliveRow);
1819
- return rows;
1820
- };
1821
- if (!last) return finish([{ text: t("auto.neverRun"), tone: "" }]);
1818
+ if (!last) return [{ text: t("auto.neverRun"), tone: "" }];
1822
1819
  // Opening stub: sources have not answered yet. A finished "0 accounts" row
1823
1820
  // here is what "run now" painted and then never replaced.
1824
1821
  if (last.pending === true && last.travel == null && last.qoder == null && last.trae == null) {
1825
- return finish([{ text: t("auto.running"), tone: "" }]);
1822
+ return [{ text: t("auto.running"), tone: "" }];
1826
1823
  }
1827
1824
  var slot = String(last.slot).replace("T", " ");
1828
- if (last.error) return finish([{ text: t("auto.lastFailedAt", { slot: slot, message: last.error }), tone: "fail" }]);
1825
+ if (last.error) return [{ text: t("auto.lastFailedAt", { slot: slot, message: last.error }), tone: "fail" }];
1829
1826
  var rows = [];
1830
1827
  if (last.pending === true) rows.push({ text: t("auto.running"), tone: "" });
1831
1828
  // The head count is every source's claimed accounts, matching the rows
@@ -1867,7 +1864,10 @@ function autoNoteRows(auto) {
1867
1864
  tone: claimed > 0 || adopted > 0 ? "ok" : "",
1868
1865
  });
1869
1866
  };
1870
- push(t("auto.rowWorkbuddy"), { claimed: last.claimed, skipped: last.skipped, failed: last.failed });
1867
+ if (last.workbuddy !== false
1868
+ && (last.claimed !== undefined || last.skipped !== undefined || last.failed !== undefined)) {
1869
+ push(t("auto.rowWorkbuddy"), { claimed: last.claimed, skipped: last.skipped, failed: last.failed });
1870
+ }
1871
1871
  pushTravel(last.travel);
1872
1872
  if (last.growth) {
1873
1873
  var growth = last.growth;
@@ -1883,7 +1883,50 @@ function autoNoteRows(auto) {
1883
1883
  }
1884
1884
  push(t("auto.rowQoder"), last.qoder);
1885
1885
  push(t("auto.rowTrae"), last.trae);
1886
- return finish(rows);
1886
+ return rows;
1887
+ }
1888
+
1889
+ /**
1890
+ * The keep-alive's own line: what its last run did, and when.
1891
+ *
1892
+ * A duty of its own rather than a stage of the check-in pass, so it reports on
1893
+ * its own card and says when it last ran - on every path, including the ones
1894
+ * that have nothing to say about a check-in pass. Its record is the only proof
1895
+ * the button did anything, and a restart clears the pass log without touching
1896
+ * it.
1897
+ */
1898
+ function keepAliveNoteRow(keepAlive) {
1899
+ if (!keepAlive) return null;
1900
+ return {
1901
+ text: t("auto.rowKeepAlive", {
1902
+ when: formatStamp(keepAlive.at),
1903
+ refreshed: Number(keepAlive.refreshed) || 0,
1904
+ fresh: Number(keepAlive.fresh) || 0,
1905
+ failed: Number(keepAlive.failed) || 0,
1906
+ noToken: Number(keepAlive.noToken) || 0,
1907
+ }),
1908
+ tone: Number(keepAlive.failed) > 0 || Number(keepAlive.noToken) > 0 ? "fail"
1909
+ : Number(keepAlive.refreshed) > 0 ? "ok" : "",
1910
+ };
1911
+ }
1912
+
1913
+ /** Paint the keep-alive log as rows, so the caller does not build markup inline. */
1914
+ function paintKeepAliveNote(host, keepAlive) {
1915
+ var atBottom = host.scrollTop + host.clientHeight >= host.scrollHeight - 4;
1916
+ var rowCount = host.childElementCount;
1917
+ clear(host);
1918
+ var row = keepAliveNoteRow(keepAlive);
1919
+ // No run yet leaves the box out of the card rather than drawing an empty
1920
+ // frame: the card head already says it has not run, and an empty bordered box
1921
+ // reads as a log that failed to load.
1922
+ host.hidden = row === null;
1923
+ if (row !== null) {
1924
+ var line = el("div", "log-line" + (row.tone ? " " + row.tone : ""));
1925
+ line.appendChild(el("span", "log-dot"));
1926
+ line.appendChild(el("span", "log-text", row.text));
1927
+ host.appendChild(line);
1928
+ }
1929
+ if (host.childElementCount !== rowCount || atBottom) host.scrollTop = host.scrollHeight;
1887
1930
  }
1888
1931
 
1889
1932
  /** Paint the check-in log as rows, so the caller does not build markup inline. */
@@ -2179,7 +2222,7 @@ function runGrowth() {
2179
2222
  });
2180
2223
  }).catch(function (error) {
2181
2224
  var message = String(error && error.message ? error.message : error);
2182
- note(/BUSY/.test(message) ? t("growth.busy") : message);
2225
+ note(/BUSY|already running/i.test(message) ? t("growth.busy") : message);
2183
2226
  });
2184
2227
  }
2185
2228
  function renderAccounts() {
@@ -2297,6 +2340,11 @@ function renderRemoved(host) {
2297
2340
 
2298
2341
  function accountCard(account) {
2299
2342
  var off = account.disabled === true;
2343
+ // The upstream refused this sign-in and a forced refresh could not save it.
2344
+ // The row says so in its own words: the account is not waiting out a window,
2345
+ // and only a new sign-in brings it back.
2346
+ var refused = account.hold === "session";
2347
+ var restricted = account.hold === "restricted";
2300
2348
 
2301
2349
  // Listed but out of rotation: the app overwrote this account's sign-in with
2302
2350
  // the next one, so the card stays readable but says why it is not picked.
@@ -2312,8 +2360,8 @@ function accountCard(account) {
2312
2360
  if (account.preferred) head.appendChild(el("span", "badge next", t("badge.preferred")));
2313
2361
  // An archived account keeps serving, so its badge reports the same health as
2314
2362
  // any other; the note below the head says where its sign-in now comes from.
2315
- head.appendChild(el("span", "badge " + (off ? "off" : account.cooling ? "cool" : "ok"),
2316
- off ? t("acct.off") : account.cooling ? t("badge.cooling") : t("badge.healthy")));
2363
+ head.appendChild(el("span", "badge " + (off ? "off" : refused ? "dead" : restricted || account.cooling ? "cool" : "ok"),
2364
+ off ? t("acct.off") : refused ? t("badge.revoked") : restricted ? t("badge.restricted") : account.cooling ? t("badge.cooling") : t("badge.healthy")));
2317
2365
 
2318
2366
  // "Not right now" and "not mine any more" are different decisions, so they
2319
2367
  // stay separate controls: a switch the user flips, and a plain remove button.
@@ -2415,15 +2463,18 @@ function accountCard(account) {
2415
2463
  card.appendChild(head);
2416
2464
 
2417
2465
  if (archived) card.appendChild(el("div", "hint muted", t("acct.archivedHint")));
2418
- if (off) card.appendChild(el("div", "hint muted", t("acct.offHint")));
2466
+ if (refused) card.appendChild(el("div", "hint finding-fail", t("acct.signInRefused")));
2467
+ if (restricted) card.appendChild(el("div", "hint finding-fail", t("acct.restrictedHint")));
2419
2468
 
2420
2469
  var meta = el("div", "model-meta");
2421
2470
  // Not beside a badge that already says the token is expired.
2422
2471
  if (account.expired !== true) meta.appendChild(tokenChip(account.expiresAt));
2423
2472
  if (account.cooling && account.cooldownUntil) {
2424
- meta.appendChild(el("span", "finding-fail", t("acct.coolUntil", { time: formatStamp(account.cooldownUntil) })));
2473
+ // A hold is not a rate limit: it names the moment the pool stops waiting,
2474
+ // not a window the upstream set.
2475
+ meta.appendChild(el("span", "finding-fail", t(refused ? "acct.holdUntil" : restricted ? "acct.restrictedUntil" : "acct.coolUntil", { time: formatStamp(account.cooldownUntil) })));
2425
2476
  }
2426
- if (num(account.rateLimitHits, 0) > 0) {
2477
+ if (num(account.rateLimitHits, 0) > 0 && !refused && !restricted) {
2427
2478
  meta.appendChild(el("span", null, t("acct.hits", { hits: account.rateLimitHits })));
2428
2479
  }
2429
2480
  card.appendChild(meta);
@@ -2436,6 +2487,9 @@ function accountCard(account) {
2436
2487
  // account's billing data yet, so say so instead of showing nothing.
2437
2488
  if (account.probePending === true) {
2438
2489
  card.appendChild(el("div", "hint muted", t("probe.pending")));
2490
+ } else if (refused) {
2491
+ // No read was spent on this account, so there is no credits figure and no
2492
+ // upstream error to show: the hold above is the whole story.
2439
2493
  } else if (account.creditsError) {
2440
2494
  card.appendChild(el("div", "hint finding-fail", t("credits.unavailable") + ": " + account.creditsError));
2441
2495
  } else if (account.credits) {
@@ -2636,7 +2690,9 @@ function checkinBlock(account) {
2636
2690
  var wrap = el("div", "checkin");
2637
2691
  wrap.appendChild(el("span", "card-title", t("checkin.title")));
2638
2692
 
2639
- if (account.checkinError) {
2693
+ // A held sign-in is not read at all, so an error here would be the previous
2694
+ // read's; the account card already carries the hold and its remedy.
2695
+ if (account.checkinError && account.hold !== "session") {
2640
2696
  wrap.appendChild(el("span", "hint finding-fail", account.checkinError));
2641
2697
  return wrap;
2642
2698
  }
@@ -3874,7 +3930,6 @@ function render() {
3874
3930
  renderAutoCheckin();
3875
3931
  renderGrowth();
3876
3932
  renderComposerPoints();
3877
- renderRewriteClientName();
3878
3933
  renderHostHint();
3879
3934
  renderRegionTabs();
3880
3935
  renderModelRegionTabs();
@@ -3960,8 +4015,17 @@ function runBusy(id, work) {
3960
4015
  render();
3961
4016
  return work().then(function (result) {
3962
4017
  busy = null;
3963
- if (result && result.accounts) adopt(result);
3964
- note(null);
4018
+ // A host answer may still be detecting behind the click. Adopt it through
4019
+ // the same polling path the initial open uses, but only when it actually
4020
+ // reports that state: most settings/reset answers omit `refreshing`, and
4021
+ // adopting those here must not cancel a poll already running.
4022
+ if (result && result.accounts && typeof result.refreshing === "boolean") {
4023
+ adoptAndMaybePoll(result, 0);
4024
+ } else if (result && result.accounts) {
4025
+ adopt(result);
4026
+ }
4027
+ if (result && result.stale === true) note(t("err.stale"), "warn");
4028
+ else note(null);
3965
4029
  render();
3966
4030
  pollCheckinLog(0);
3967
4031
  return result;
@@ -4133,7 +4197,7 @@ function rescan() {
4133
4197
  return runBusy("rescan", function () { return invoke("xd.rescan"); })
4134
4198
  .then(function (next) { announce(t("pool.summary", {
4135
4199
  count: (next.accounts || []).length,
4136
- cooling: (next.accounts || []).filter(function (a) { return a.cooling; }).length,
4200
+ cooling: (next.accounts || []).filter(isCooling).length,
4137
4201
  })); })
4138
4202
  .catch(function () {});
4139
4203
  }
@@ -4193,12 +4257,6 @@ function setComposerPoints(enabled) {
4193
4257
  }).catch(function () {});
4194
4258
  }
4195
4259
 
4196
- function setRewriteClientName(enabled) {
4197
- return runBusy("rewrite", function () {
4198
- return invoke("xd.setRewriteClientName", { enabled: enabled === true });
4199
- }).catch(function () {});
4200
- }
4201
-
4202
4260
  /** Switch one source (workbuddy / trae / qoder) on or off; the answer is the refreshed document. */
4203
4261
  function setSource(source, enabled) {
4204
4262
  return runBusy("source", function () {
@@ -4412,6 +4470,12 @@ function saveModels() {
4412
4470
  invoke("xd.saveModels", {
4413
4471
  gateway: page.key,
4414
4472
  selection: { enabledModelIds: enabledModelIds, overrides: overrides },
4473
+ // The models this page actually showed. A roster read can be partial (the
4474
+ // static fallback while the live list is still unread, or a directory that
4475
+ // answered with fewer rows), and the host keeps the stored entries for the
4476
+ // ids this page could not display instead of reading their absence as a
4477
+ // deliberate removal.
4478
+ knownModelIds: page.list.map(function (model) { return model.id; }),
4415
4479
  }).then(function (next) {
4416
4480
  busy = null;
4417
4481
  adopt(next);
@@ -4566,14 +4630,6 @@ function bind() {
4566
4630
  setComposerPoints(state === null || state.showComposerPoints !== true);
4567
4631
  });
4568
4632
  }
4569
- // Same shape: a static node, so the listener is bound once and the state is
4570
- // read at click time rather than captured from the render that drew the label.
4571
- var rewriteToggle = $("rewriteClientName");
4572
- if (rewriteToggle) {
4573
- rewriteToggle.addEventListener("click", function () {
4574
- setRewriteClientName(state === null || typeof state.replacedClientName !== "string");
4575
- });
4576
- }
4577
4633
  // Bound once, with the state read at click time: this is a static node, so the
4578
4634
  // handler cannot live in the render pass that redraws it.
4579
4635
  $("autoHours").addEventListener("input", function () {