dsh-wtq-pool 1.1.0 → 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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "dsh-wtq-pool",
3
3
  "displayName": "WTQ Pool",
4
4
  "description": "把本机 WorkBuddy、Trae、Qoder 的桌面登录接入 DeepSeek Harness。限流或额度用尽时自动换号,三家各自开关,国内与国际账号分别成组。",
5
- "version": "1.1.0",
5
+ "version": "1.2.0",
6
6
  "license": "MIT",
7
7
  "author": "chengzhi-c",
8
8
  "homepage": "https://github.com/chengzhi-c/dsh-wtq-pool#readme",
@@ -48,16 +48,6 @@
48
48
  "CHANGELOG.md",
49
49
  "LICENSE"
50
50
  ],
51
- "scripts": {
52
- "build": "tsdown",
53
- "prepare": "pnpm run build",
54
- "prepack": "tsdown",
55
- "prepublishOnly": "tsdown",
56
- "typecheck": "tsc -p tsconfig.json --noEmit",
57
- "typecheck:client": "tsc -p tsconfig.client.json --noEmit",
58
- "pretest": "tsdown",
59
- "test": "node --test --test-timeout=60000 \"tests/*.test.cjs\""
60
- },
61
51
  "dsh": {
62
52
  "bundle": {
63
53
  "patch": "./cordis.patch.yml"
@@ -99,5 +89,12 @@
99
89
  "@deepseek-ai/dsh-settings": {
100
90
  "optional": true
101
91
  }
92
+ },
93
+ "scripts": {
94
+ "build": "tsdown",
95
+ "typecheck": "tsc -p tsconfig.json --noEmit",
96
+ "typecheck:client": "tsc -p tsconfig.client.json --noEmit",
97
+ "pretest": "tsdown",
98
+ "test": "node --test --test-timeout=60000 \"tests/*.test.cjs\""
102
99
  }
103
- }
100
+ }
@@ -80,19 +80,6 @@
80
80
  </span>
81
81
  </div>
82
82
  </div>
83
- <div class="card">
84
- <div class="card-head">
85
- <span class="card-title" id="rewriteTitle"></span>
86
- <span class="muted" id="rewriteState"></span>
87
- </div>
88
- <div class="switch-row">
89
- <button type="button" class="small" id="rewriteClientName"></button>
90
- <span class="switch-copy">
91
- <span class="switch-lead" id="rewriteText"></span>
92
- <span class="hint" id="rewriteHint"></span>
93
- </span>
94
- </div>
95
- </div>
96
83
  <div class="card">
97
84
  <div class="card-head">
98
85
  <span class="card-title" id="autoTitle"></span>
@@ -114,7 +101,7 @@
114
101
  <!-- A card of its own: the keep-alive renews tokens rather than collecting
115
102
  rewards and has no hour to set, so sharing the check-in card made both
116
103
  harder to read. -->
117
- <div class="card">
104
+ <div class="card" id="keepAliveCard">
118
105
  <div class="card-head">
119
106
  <span class="card-title" id="keepAliveTitle"></span>
120
107
  </div>
package/renderer/panel.js CHANGED
@@ -287,13 +287,6 @@ var EN = {
287
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.",
288
288
  "composer.show": "Show credits",
289
289
  "composer.hide": "Hide credits",
290
- "rewrite.title": "Client name",
291
- "rewrite.on": "On",
292
- "rewrite.off": "Off",
293
- "rewrite.label": "Rename the client in the prompt the domestic host receives",
294
- "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.",
295
- "rewrite.show": "Rename client",
296
- "rewrite.hide": "Stop renaming",
297
290
  "check.title": "Connection check",
298
291
  "check.empty": "Run the check to see whether a chat can reach WorkBuddy, Trae or Qoder.",
299
292
  "check.pass": "PASS",
@@ -527,13 +520,6 @@ var ZH = {
527
520
  "composer.hint": "开启后,选中本插件的模型时,输入框左侧显示正在使用的账号积分。点开可以换号。",
528
521
  "composer.show": "显示积分",
529
522
  "composer.hide": "隐藏积分",
530
- "rewrite.title": "客户端名称",
531
- "rewrite.on": "已开启",
532
- "rewrite.off": "已关闭",
533
- "rewrite.label": "改写发往国内版的提示词里的客户端名称",
534
- "rewrite.hint": "WorkBuddy 国内版会拒绝提示词里把客户端名称写成 DeepSeek Harness 的对话请求(渠道校验 11128)。开启后,提示词里这个名称的每一处都改为 DeepSeek;关闭后恢复原名。",
535
- "rewrite.show": "改写名称",
536
- "rewrite.hide": "恢复原名",
537
523
  "growth.title": "成长中心",
538
524
  "growth.ready": "WorkBuddy",
539
525
  "growth.running": "运行中…",
@@ -969,6 +955,10 @@ function renderSourceTabs() {
969
955
  for (var j = 0; j < groups.length; j += 1) {
970
956
  groups[j].hidden = groups[j].getAttribute("data-source") !== activeSource;
971
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";
972
962
  // The source tab owns the models view too, and a source tab click does not
973
963
  // run the whole render, so the model page and the footer - which names the
974
964
  // endpoint of the source on screen - are repainted from here.
@@ -1812,26 +1802,6 @@ function renderComposerPoints() {
1812
1802
  $("composerPointsHint").textContent = t("composer.hint");
1813
1803
  }
1814
1804
 
1815
- /**
1816
- * The client-name switch.
1817
- *
1818
- * Same shape as the credits switch above, and for the same reason: the label says
1819
- * what pressing it will do and which way it currently stands. Off by default -
1820
- * turning it on is the user's decision, because it changes what the prompt tells
1821
- * the upstream about the client.
1822
- */
1823
- function renderRewriteClientName() {
1824
- var renamed = state !== null && typeof state.replacedClientName === "string";
1825
- $("rewriteTitle").textContent = t("rewrite.title");
1826
- $("rewriteState").textContent = renamed ? t("rewrite.on") : t("rewrite.off");
1827
- var button = $("rewriteClientName");
1828
- button.textContent = t(renamed ? "rewrite.hide" : "rewrite.show");
1829
- button.className = "small" + (renamed ? " on" : "");
1830
- button.disabled = busy !== null;
1831
- $("rewriteText").textContent = t("rewrite.label");
1832
- $("rewriteHint").textContent = t("rewrite.hint");
1833
- }
1834
-
1835
1805
  /**
1836
1806
  * The check-in log: one row per source, each with a state dot.
1837
1807
  *
@@ -1894,7 +1864,10 @@ function autoNoteRows(auto) {
1894
1864
  tone: claimed > 0 || adopted > 0 ? "ok" : "",
1895
1865
  });
1896
1866
  };
1897
- 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
+ }
1898
1871
  pushTravel(last.travel);
1899
1872
  if (last.growth) {
1900
1873
  var growth = last.growth;
@@ -3957,7 +3930,6 @@ function render() {
3957
3930
  renderAutoCheckin();
3958
3931
  renderGrowth();
3959
3932
  renderComposerPoints();
3960
- renderRewriteClientName();
3961
3933
  renderHostHint();
3962
3934
  renderRegionTabs();
3963
3935
  renderModelRegionTabs();
@@ -4043,7 +4015,15 @@ function runBusy(id, work) {
4043
4015
  render();
4044
4016
  return work().then(function (result) {
4045
4017
  busy = null;
4046
- if (result && result.accounts) adopt(result);
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
+ }
4047
4027
  if (result && result.stale === true) note(t("err.stale"), "warn");
4048
4028
  else note(null);
4049
4029
  render();
@@ -4277,12 +4257,6 @@ function setComposerPoints(enabled) {
4277
4257
  }).catch(function () {});
4278
4258
  }
4279
4259
 
4280
- function setRewriteClientName(enabled) {
4281
- return runBusy("rewrite", function () {
4282
- return invoke("xd.setRewriteClientName", { enabled: enabled === true });
4283
- }).catch(function () {});
4284
- }
4285
-
4286
4260
  /** Switch one source (workbuddy / trae / qoder) on or off; the answer is the refreshed document. */
4287
4261
  function setSource(source, enabled) {
4288
4262
  return runBusy("source", function () {
@@ -4496,6 +4470,12 @@ function saveModels() {
4496
4470
  invoke("xd.saveModels", {
4497
4471
  gateway: page.key,
4498
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; }),
4499
4479
  }).then(function (next) {
4500
4480
  busy = null;
4501
4481
  adopt(next);
@@ -4650,14 +4630,6 @@ function bind() {
4650
4630
  setComposerPoints(state === null || state.showComposerPoints !== true);
4651
4631
  });
4652
4632
  }
4653
- // Same shape: a static node, so the listener is bound once and the state is
4654
- // read at click time rather than captured from the render that drew the label.
4655
- var rewriteToggle = $("rewriteClientName");
4656
- if (rewriteToggle) {
4657
- rewriteToggle.addEventListener("click", function () {
4658
- setRewriteClientName(state === null || typeof state.replacedClientName !== "string");
4659
- });
4660
- }
4661
4633
  // Bound once, with the state read at click time: this is a static node, so the
4662
4634
  // handler cannot live in the render pass that redraws it.
4663
4635
  $("autoHours").addEventListener("input", function () {