dsh-wtq-pool 1.0.1 → 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/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。WorkBuddy 被限流时自动换号。三家各有开关,国内与国际各自成组。",
5
- "version": "1.0.1",
5
+ "version": "1.0.3",
6
6
  "license": "MIT",
7
7
  "author": "chengzhi-c",
8
8
  "homepage": "https://github.com/chengzhi-c/dsh-wtq-pool#readme",
@@ -26,7 +26,7 @@
26
26
  "type": "module",
27
27
  "engines": {
28
28
  "node": "^22.19.0 || >=24.0.0",
29
- "dsh": ">=0.1.7-rc.1 <0.3.0"
29
+ "dsh": ">=0.2.0-rc.1 <0.2.1"
30
30
  },
31
31
  "main": "lib/index.js",
32
32
  "types": "lib/index.d.ts",
@@ -42,7 +42,6 @@
42
42
  "files": [
43
43
  "lib",
44
44
  "renderer",
45
- "docs",
46
45
  "cordis.patch.yml",
47
46
  "README.md",
48
47
  "README.en.md",
@@ -51,6 +50,7 @@
51
50
  ],
52
51
  "scripts": {
53
52
  "build": "tsdown",
53
+ "prepare": "pnpm run build",
54
54
  "prepack": "tsdown",
55
55
  "prepublishOnly": "tsdown",
56
56
  "typecheck": "tsc -p tsconfig.json --noEmit",
@@ -74,11 +74,6 @@
74
74
  },
75
75
  "devDependencies": {
76
76
  "@deepseek-ai/cordis": "^4.0.4",
77
- "@deepseek-ai/dsh-client-locale": "0.2.0-rc.2",
78
- "@deepseek-ai/dsh-client-ui-primitives": "0.2.0-rc.2",
79
- "@deepseek-ai/dsh-client-ui-settings": "0.2.0-rc.2",
80
- "@deepseek-ai/dsh-client-ui-settings-plugins": "0.2.0-rc.2",
81
- "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
82
77
  "@deepseek-ai/dsh-host-webserver": "0.2.0-rc.2",
83
78
  "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
84
79
  "@deepseek-ai/dsh-llm-pi-ai": "0.2.0-rc.2",
@@ -93,30 +88,15 @@
93
88
  },
94
89
  "peerDependencies": {
95
90
  "@deepseek-ai/cordis": ">=4.0.4 <5.0.0",
96
- "@deepseek-ai/dsh-llm": ">=0.2.0-rc.1 <0.3.0",
97
- "@deepseek-ai/dsh-llm-pi-ai": ">=0.2.0-rc.1 <0.3.0",
98
- "@deepseek-ai/dsh-settings": ">=0.2.0-rc.1 <0.3.0",
91
+ "@deepseek-ai/dsh-llm": ">=0.2.0-rc.1 <0.2.1",
92
+ "@deepseek-ai/dsh-llm-pi-ai": ">=0.2.0-rc.1 <0.2.1",
93
+ "@deepseek-ai/dsh-settings": ">=0.2.0-rc.1 <0.2.1",
99
94
  "@deepseek-ai/schemastery": "^3.18.4",
100
- "@earendil-works/pi-ai": ">=0.87.1 <0.88.0"
95
+ "@earendil-works/pi-ai": ">=0.82.1 <0.88.0"
101
96
  },
102
97
  "peerDependenciesMeta": {
103
- "@deepseek-ai/cordis": {
104
- "optional": true
105
- },
106
- "@deepseek-ai/dsh-llm": {
107
- "optional": true
108
- },
109
- "@deepseek-ai/dsh-llm-pi-ai": {
110
- "optional": true
111
- },
112
98
  "@deepseek-ai/dsh-settings": {
113
99
  "optional": true
114
- },
115
- "@deepseek-ai/schemastery": {
116
- "optional": true
117
- },
118
- "@earendil-works/pi-ai": {
119
- "optional": true
120
100
  }
121
101
  }
122
102
  }
@@ -219,12 +219,18 @@ html::-webkit-scrollbar-thumb { border-radius: 4px; background: color-mix(in srg
219
219
  caption. The same quiet surface the panel uses elsewhere, so it reads as part
220
220
  of the card without competing with the controls above it. */
221
221
  .log-box {
222
- margin: 10px 0 0;
223
- padding: 8px 10px;
222
+ margin: 8px 0 0;
223
+ padding: 7px 10px;
224
224
  border: 1px solid var(--xd-line);
225
225
  border-radius: var(--xd-radius-small);
226
226
  background: var(--xd-softer);
227
227
  font-size: 12.5px;
228
+ /* A pass over three sources plus their retries is a long list, and an
229
+ unbounded log pushed everything below it off the page. The box scrolls on
230
+ its own instead. Five rows exactly: a cap that falls inside a line would
231
+ leave half a sentence showing. */
232
+ max-height: 120px;
233
+ overflow-y: auto;
228
234
  }
229
235
  /* One source per line, so a pass over three of them reads down the box instead
230
236
  of across it. */
@@ -464,20 +470,19 @@ button.park:hover:not(:disabled) { filter: brightness(1.08); background: var(--x
464
470
 
465
471
  /* A non-pool source's own section: its own accounts, quota, and check-in pool,
466
472
  stacked the way the pool's cards are — a titled block, not one crowded line. */
467
- .source-group { margin-bottom: 12px; }
473
+ .source-group { margin-bottom: 10px; }
468
474
  .source-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
469
475
  .source-head strong { font-variant-numeric: tabular-nums; }
470
476
  .source-head .checkin-all { margin-left: auto; }
471
477
  .source-accounts .card { margin-bottom: 8px; }
472
478
  .source-foot { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; margin-top: 4px; }
473
479
 
474
-
475
480
  .card {
476
481
  border: 1px solid var(--xd-border);
477
482
  border-radius: var(--xd-radius);
478
483
  background: var(--xd-card);
479
- padding: 14px 16px;
480
- margin-bottom: 12px;
484
+ padding: 12px 14px;
485
+ margin-bottom: 10px;
481
486
  }
482
487
 
483
488
  .card-head {
@@ -595,7 +600,7 @@ button.park:hover:not(:disabled) { filter: brightness(1.08); background: var(--x
595
600
  .credits:not(.open) .credits-head .caret { transform: rotate(0deg); }
596
601
 
597
602
  .credit-total {
598
- font-size: 24px;
603
+ font-size: 20px;
599
604
  font-weight: 700;
600
605
  color: var(--xd-fg);
601
606
  font-variant-numeric: tabular-nums;
package/renderer/panel.js CHANGED
@@ -57,6 +57,7 @@ var EN = {
57
57
  "pool.checkinAllBusy": "Checking in…",
58
58
  "pool.checkinAllDone": "Checked in {count} account(s)",
59
59
  "pool.checkinAllNone": "Every account is already checked in today",
60
+ "pool.checkinAllFailed": "Checked in {count}, {failed} failed",
60
61
  "pool.emptyRegion": "No {region} account is signed in yet.",
61
62
  "pool.emptyHint": "Sign in to that edition in the WorkBuddy desktop app, then press “Detect accounts again”.",
62
63
  "pool.sourceOff": "The WorkBuddy source is switched off in plugin settings.",
@@ -90,6 +91,7 @@ var EN = {
90
91
  "source.checkedIn": "Checked in today",
91
92
  "source.claimable": "Can claim today",
92
93
  "source.noCampaign": "no daily check-in",
94
+ "source.campaignUnknown": "check-in state unavailable",
93
95
  "source.claimableAt": "Can claim after {time}",
94
96
  "source.deviceCheckedIn": "This device checked in today",
95
97
  "qoder.fallback": "using a spare port; the provider row still names {port}",
@@ -237,6 +239,7 @@ var EN = {
237
239
  "foot.docs": "Docs",
238
240
  "foot.license": "License",
239
241
  "err.bridge": "The panel bridge is unavailable.",
242
+ "err.busy": "The panel is busy with another action; try again in a moment.",
240
243
  "tag.free": "free",
241
244
  "tag.rate": "x{rate}",
242
245
  "tag.promoNight": "free until {hour}",
@@ -281,6 +284,7 @@ var ZH = {
281
284
  "pool.checkinAllBusy": "签到中…",
282
285
  "pool.checkinAllDone": "已签到 {count} 个账号",
283
286
  "pool.checkinAllNone": "所有账号今天都已签到",
287
+ "pool.checkinAllFailed": "已签到 {count} 个,{failed} 个失败",
284
288
  "pool.emptyRegion": "{region}这一侧还没有登录的账号。",
285
289
  "pool.emptyHint": "请在该版本的 WorkBuddy 桌面 App 里登录,再点「重新检测账号」。",
286
290
  "pool.sourceOff": "WorkBuddy 来源已在插件设置里关闭。",
@@ -314,6 +318,7 @@ var ZH = {
314
318
  "source.claimable": "今日可签到",
315
319
  "source.noAccounts": "未找到本机登录",
316
320
  "source.noCampaign": "该账号无签到活动",
321
+ "source.campaignUnknown": "签到状态读取失败",
317
322
  "source.deviceCheckedIn": "本机今日已签到",
318
323
  "qoder.fallback": "用的是备用端口;供应商行仍指向 {port}",
319
324
  "badge.next": "下一个",
@@ -461,6 +466,7 @@ var ZH = {
461
466
  "foot.docs": "文档",
462
467
  "foot.license": "许可",
463
468
  "err.bridge": "面板桥不可用。",
469
+ "err.busy": "面板正在处理其他操作,请稍候再试。",
464
470
  "tag.free": "免费",
465
471
  "tag.rate": "x{rate}",
466
472
  "tag.promoNight": "夜间免费 · 到 {hour}",
@@ -589,6 +595,12 @@ function clockHour(hour) {
589
595
  return (value < 10 ? "0" : "") + value + ":00";
590
596
  }
591
597
 
598
+ /**
599
+ * The banner text currently shown, so a later pass can tell its own message
600
+ * from one another action put up (or cleared).
601
+ */
602
+ var bannerText = "";
603
+
592
604
  /**
593
605
  * Show the banner. A failure reaching the panel arrives wrapped in whatever
594
606
  * envelope the bridge used; the reason itself is what the user needs, so the
@@ -596,10 +608,11 @@ function clockHour(hour) {
596
608
  */
597
609
  function note(message, kind) {
598
610
  var banner = $("banner");
599
- if (!message) { show(banner, false); banner.textContent = ""; return; }
611
+ if (!message) { show(banner, false); banner.textContent = ""; bannerText = ""; return; }
600
612
  banner.textContent = String(message)
601
613
  .replace(/^Error invoking remote method '[^']*':\s*/, "")
602
614
  .replace(/^Error:\s*/, "");
615
+ bannerText = banner.textContent;
603
616
  banner.className = kind === "warn" ? "banner warn" : "banner";
604
617
  show(banner, true);
605
618
  }
@@ -711,7 +724,7 @@ function renderHeader() {
711
724
  // away would keep naming a problem the state document no longer reports. Only
712
725
  // the banner this pass itself last showed is cleared, so a message another
713
726
  // action put up is not wiped by the poll landing behind it.
714
- if (warning !== headerWarning) {
727
+ if (warning !== headerWarning || (warning !== "" && bannerText === "")) {
715
728
  headerWarning = warning;
716
729
  note(warning === "" ? null : warning, "warn");
717
730
  }
@@ -1063,7 +1076,8 @@ function sourceAccountCard(account, kind) {
1063
1076
  ? t("source.checkedIn")
1064
1077
  : deviceDone ? t("source.deviceCheckedIn")
1065
1078
  : opensLabel !== "" ? opensLabel
1066
- : checkin.active ? t("source.claimable") : t("source.noCampaign")));
1079
+ : checkin.campaignsUnavailable === true ? t("source.campaignUnknown")
1080
+ : checkin.active ? t("source.claimable") : t("source.noCampaign")));
1067
1081
  if (!doneToday && checkin.active && checkin.amount > 0) {
1068
1082
  row.appendChild(el("span", "muted", checkin.amount + " "
1069
1083
  + (checkin.unit === undefined || checkin.unit === "credits" ? t("credits.keepUnit") : checkin.unit)));
@@ -1265,7 +1279,15 @@ function claimSourceCheckins(source) {
1265
1279
  }
1266
1280
  var counts = payload ? payload[source] : null;
1267
1281
  var claimed = counts && typeof counts.claimed === "number" ? counts.claimed : 0;
1268
- announce(claimed > 0 ? t("pool.checkinAllDone", { count: claimed }) : t("pool.checkinAllNone"));
1282
+ var failed = counts && typeof counts.failed === "number" ? counts.failed : 0;
1283
+ // A round that failed used to read as "every account is already checked in
1284
+ // today": the counts carry `failed` (and the reason), a source whose round
1285
+ // threw carries none of its own, and the panel read the missing number as
1286
+ // "nothing to collect". The user was told the day was done while nothing
1287
+ // had been collected.
1288
+ announce(failed > 0
1289
+ ? checkinFailureText(claimed, failed, counts && counts.reason)
1290
+ : claimed > 0 ? t("pool.checkinAllDone", { count: claimed }) : t("pool.checkinAllNone"));
1269
1291
  }).catch(function (error) {
1270
1292
  checkinBusy = null;
1271
1293
  note(String(error && error.message ? error.message : error));
@@ -1273,6 +1295,17 @@ function claimSourceCheckins(source) {
1273
1295
  });
1274
1296
  }
1275
1297
 
1298
+ /**
1299
+ * What to say when a check-in round reports failures.
1300
+ *
1301
+ * The counts alone cannot name the cause, and the upstream's own words are
1302
+ * worth more than "failed": the reason is appended when the host has one.
1303
+ */
1304
+ function checkinFailureText(claimed, failed, reason) {
1305
+ var text = t("pool.checkinAllFailed", { count: claimed, failed: failed });
1306
+ return typeof reason === "string" && reason !== "" ? text + " · " + reason : text;
1307
+ }
1308
+
1276
1309
  /** The busy key of one source account row: source, region and label together. */
1277
1310
  function sourceCheckinKey(source, account) {
1278
1311
  return source + ":" + account.region + ":" + account.label;
@@ -1512,6 +1545,10 @@ function paintAutoNote(host, auto) {
1512
1545
  line.appendChild(el("span", "log-text", row.text));
1513
1546
  host.appendChild(line);
1514
1547
  });
1548
+ // The log is a scroll region capped at a few rows, so a fresh pass would
1549
+ // otherwise leave the newest line - the one the user just waited for - below
1550
+ // the fold.
1551
+ host.scrollTop = host.scrollHeight;
1515
1552
  }
1516
1553
  function renderAccounts() {
1517
1554
  var host = $("accounts");
@@ -2505,8 +2542,9 @@ function modelSheetBody(model, entry) {
2505
2542
  body.appendChild(pair);
2506
2543
 
2507
2544
  // Thinking levels: only a model whose catalog offers a reason menu gets the
2508
- // control. Trae and Qoder report no levels at all, so a menu there could
2509
- // never take effect.
2545
+ // control. WorkBuddy reports its own table, and Trae and Qoder advertise
2546
+ // theirs through the gateway, so the menu appears wherever the upstream
2547
+ // actually offers levels and the save reaches the declaration.
2510
2548
  var levels = effectiveLevels(model, entry);
2511
2549
  if (levels.length > 0) {
2512
2550
  var levelsWrap = el("div", "field");
@@ -2579,16 +2617,25 @@ function modelSheetBody(model, entry) {
2579
2617
  }
2580
2618
 
2581
2619
 
2620
+ /**
2621
+ * The ceiling the host enforces on a token budget (`MAX_TOKEN_BUDGET`).
2622
+ *
2623
+ * A number past it invalidates the whole selection payload there, so the save
2624
+ * drops every edit in this pass rather than clamping one field. Keeping the
2625
+ * bound in the browser means the field itself refuses the value.
2626
+ */
2627
+ var MAX_TOKEN_BUDGET = 0xffffffff;
2582
2628
  function numberInput(value, onChange) {
2583
2629
  var input = document.createElement("input");
2584
2630
  input.type = "number";
2585
2631
  input.className = "num-input";
2632
+ input.max = String(MAX_TOKEN_BUDGET);
2586
2633
  input.min = "1";
2587
2634
  input.step = "1000";
2588
2635
  input.value = String(value);
2589
2636
  input.addEventListener("change", function () {
2590
2637
  var next = Number(input.value);
2591
- if (!Number.isFinite(next) || next <= 0) {
2638
+ if (!Number.isFinite(next) || next <= 0 || next > MAX_TOKEN_BUDGET) {
2592
2639
  input.value = String(value);
2593
2640
  return;
2594
2641
  }
@@ -2781,7 +2828,14 @@ function adopt(next) {
2781
2828
  }
2782
2829
 
2783
2830
  function runBusy(id, work) {
2784
- if (busy !== null) return Promise.reject(new Error("panel is busy"));
2831
+ // A second action while one is running used to reject here and nowhere else:
2832
+ // every caller answers with its own `.catch(function () {})`, so the click did
2833
+ // nothing and said nothing. The banner is raised here, once, so a busy panel
2834
+ // answers every control the same way.
2835
+ if (busy !== null) {
2836
+ note(t("err.busy"), "warn");
2837
+ return Promise.reject(new Error("panel is busy"));
2838
+ }
2785
2839
  notePress(document.activeElement);
2786
2840
  busy = id;
2787
2841
  render();
@@ -2827,7 +2881,15 @@ function adoptAndMaybePoll(next, attempts) {
2827
2881
  adopt(next);
2828
2882
  render();
2829
2883
  if (!next || next.refreshing !== true) { stopPolling(); return; }
2830
- if (attempts >= 15) { stopPolling(); return; }
2884
+ if (attempts >= 15) {
2885
+ // Giving up on the pass, not on the document. Leaving `refreshing` set here
2886
+ // left the header saying "detecting…" for good: nothing else comes back for
2887
+ // it, so the flag had to be cleared by the one who stopped watching.
2888
+ stopPolling();
2889
+ adopt(next && typeof next === "object" ? Object.assign({}, next, { refreshing: false }) : next);
2890
+ render();
2891
+ return;
2892
+ }
2831
2893
  stopPolling();
2832
2894
  refreshPoll = window.setTimeout(function () {
2833
2895
  refreshPoll = null;
@@ -2973,8 +3035,15 @@ function parseCheckinHours(text) {
2973
3035
  /** Switch the daily automatic check-in, or move its hours, in one request. */
2974
3036
  function setAutoCheckin(enabled, hours) {
2975
3037
  if (hours === null) {
2976
- note(t("auto.badHours"));
2977
- return Promise.resolve();
3038
+ // Only switching ON needs a readable hour list. Switching OFF must not: the
3039
+ // box can hold stale invalid text from an earlier edit, and bailing out there
3040
+ // leaves the timer running while the panel reports the schedule as off.
3041
+ if (enabled === true) {
3042
+ note(t("auto.badHours"));
3043
+ return Promise.resolve();
3044
+ }
3045
+ var current = state && state.autoCheckin && state.autoCheckin.hours;
3046
+ hours = Array.isArray(current) ? current : [];
2978
3047
  }
2979
3048
  return runBusy("autoCheckin", function () {
2980
3049
  return invoke("xd.setAutoCheckin", { enabled: enabled === true, hours: hours });
@@ -3016,7 +3085,10 @@ function claimAllCheckins() {
3016
3085
  return;
3017
3086
  }
3018
3087
  var claimed = payload && typeof payload.claimed === "number" ? payload.claimed : 0;
3019
- announce(claimed > 0 ? t("pool.checkinAllDone", { count: claimed }) : t("pool.checkinAllNone"));
3088
+ var failed = payload && typeof payload.failed === "number" ? payload.failed : 0;
3089
+ announce(failed > 0
3090
+ ? checkinFailureText(claimed, failed, payload && payload.reason)
3091
+ : claimed > 0 ? t("pool.checkinAllDone", { count: claimed }) : t("pool.checkinAllNone"));
3020
3092
  }).catch(function (error) {
3021
3093
  checkinBusy = null;
3022
3094
  note(String(error && error.message ? error.message : error));
@@ -3061,6 +3133,24 @@ function toggleAllVisible() {
3061
3133
  function fetchModelList() {
3062
3134
  return runBusy("fetch", function () { return invoke("xd.rescan"); }).catch(function () {});
3063
3135
  }
3136
+
3137
+ /**
3138
+ * Ask the plugin for a live model roster, silently, once per panel.
3139
+ *
3140
+ * Opening the panel is when the list has to be right: a roster read that timed
3141
+ * out while the host was starting leaves the plugin's static fallback in force,
3142
+ * and the model page then listed the fallback's own models and reported the
3143
+ * user's saved choice as retired - on every start, until a manual fetch. The
3144
+ * model page keeps its own "fetch list" button for a deliberate re-read.
3145
+ */
3146
+ var modelRosterRequested = false;
3147
+ function requestModelRoster() {
3148
+ if (modelRosterRequested || bridge === null) return;
3149
+ modelRosterRequested = true;
3150
+ invoke("xd.fetchModels").then(function (next) {
3151
+ adoptAndMaybePoll(next, 0);
3152
+ }).catch(function () {});
3153
+ }
3064
3154
  function discardDraft() {
3065
3155
  // Only the page in view: another page's unsaved edits are not this button's to
3066
3156
  // throw away.
@@ -3183,6 +3273,9 @@ function selectTab(name) {
3183
3273
  tabs[i].setAttribute("aria-selected", isActive ? "true" : "false");
3184
3274
  }
3185
3275
  if (name === "check" && doctorResult === null) runDoctor();
3276
+ // The model page shows a roster, so entering it is the moment to make sure
3277
+ // that roster is the vendor's and not this plugin's own fallback.
3278
+ if (name === "models") requestModelRoster();
3186
3279
  }
3187
3280
 
3188
3281
  function labelTabs() {
@@ -3303,6 +3396,9 @@ function boot() {
3303
3396
  invoke("xd.state").then(function (next) {
3304
3397
  adoptAndMaybePoll(next, 0);
3305
3398
  pollCheckinLog(0);
3399
+ // After the first document, so a panel opened while the plugin process is
3400
+ // still starting does not burn its one roster request on a dead bridge.
3401
+ requestModelRoster();
3306
3402
  }).catch(function (error) {
3307
3403
  bootAttempts += 1;
3308
3404
  if (bootAttempts < 4) {
package/docs/index.html DELETED
@@ -1,181 +0,0 @@
1
- <!doctype html>
2
- <html lang="zh-CN">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>WTQ账号池 · 预览</title>
7
- <!--
8
- Preview page for the plugin panel.
9
-
10
- The iframe mounts the repository's own renderer/index.html, panel.css and
11
- panel.js against a stubbed host bridge, so what you click is the shipping
12
- component. Screenshots for the README are taken from this same page.
13
-
14
- Run it: node docs/serve.cjs then open the printed address.
15
- -->
16
- <style>
17
- /* Palette mirrors renderer/panel.css so the wrapper reads as part of the
18
- plugin. Same design language: borders and spacing carry the hierarchy,
19
- no shadows. */
20
- :root {
21
- color-scheme: light;
22
- --bg: #f4f5f7;
23
- --panel: #ffffff;
24
- --card: #ffffff;
25
- --fg: #1b1d21;
26
- --muted: #6b7280;
27
- --border: #e3e5ea;
28
- --accent: #2e706a;
29
- --on-accent: #ffffff;
30
- }
31
- :root[data-base="dark"] {
32
- color-scheme: dark;
33
- --bg: #101216;
34
- --panel: #16181d;
35
- --card: #1c1f25;
36
- --fg: #e8eaee;
37
- --muted: #9aa1ad;
38
- --border: #2c3038;
39
- --accent: #67c1b8;
40
- --on-accent: #163633;
41
- }
42
- * { box-sizing: border-box; }
43
- body {
44
- margin: 0;
45
- background: var(--bg);
46
- color: var(--fg);
47
- font: 14px/1.6 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
48
- }
49
- a { color: var(--accent); }
50
-
51
- .wrap { max-width: 1180px; margin: 0 auto; padding: 28px 20px 56px; }
52
-
53
- header.top {
54
- display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px;
55
- padding-bottom: 16px; border-bottom: 1px solid var(--border);
56
- }
57
- header.top h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
58
- header.top .tag {
59
- font-size: 12px; color: var(--muted);
60
- border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px;
61
- }
62
- header.top .spacer { flex: 1 1 auto; }
63
- header.top .links { display: flex; gap: 14px; font-size: 13px; }
64
-
65
- .lede { margin: 18px 0 22px; max-width: 70ch; color: var(--fg); }
66
- .lede p { margin: 0 0 8px; }
67
- .lede .muted { color: var(--muted); font-size: 13px; }
68
-
69
- .toolbar {
70
- display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
71
- margin: 0 0 12px;
72
- }
73
- .toolbar .label { font-size: 12px; color: var(--muted); margin-right: 2px; }
74
- .seg { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
75
- .seg button {
76
- appearance: none; border: 0; background: transparent; color: var(--muted);
77
- font: inherit; font-size: 13px; padding: 5px 12px; cursor: pointer;
78
- }
79
- .seg button + button { border-left: 1px solid var(--border); }
80
- .seg button:hover { color: var(--fg); }
81
- .seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
82
-
83
- .stage {
84
- border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
85
- background: var(--panel);
86
- }
87
- .stage .caption {
88
- display: flex; align-items: center; gap: 8px;
89
- padding: 9px 14px; font-size: 12px; color: var(--muted);
90
- border-bottom: 1px solid var(--border);
91
- }
92
- .stage .caption .dot {
93
- width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
94
- }
95
- iframe { display: block; width: 100%; height: 820px; border: 0; background: var(--panel); }
96
-
97
- footer.foot {
98
- margin-top: 18px; font-size: 12px; color: var(--muted);
99
- display: flex; flex-wrap: wrap; gap: 6px 16px;
100
- }
101
- @media (max-width: 720px) { iframe { height: 720px; } }
102
- </style>
103
- </head>
104
- <body>
105
- <div class="wrap">
106
- <header class="top">
107
- <h1>WTQ账号池</h1>
108
- <span class="tag">MIT</span>
109
- <span class="spacer"></span>
110
- <nav class="links">
111
- <a href="https://github.com/chengzhi-c/dsh-wtq-pool#readme">README</a>
112
- <a href="https://github.com/chengzhi-c/dsh-wtq-pool">GitHub</a>
113
- </nav>
114
- </header>
115
-
116
- <div class="lede">
117
- <p>把本机 WorkBuddy、Trae、Qoder 的桌面登录接入 DeepSeek Harness。WorkBuddy 支持限流换号,Trae、Qoder 按请求分发。</p>
118
- <p class="muted">
119
- 下面加载实际面板代码,使用虚构演示数据,支持来源切换、模型设置和主题预览,不读取本机账号或令牌。
120
- </p>
121
- </div>
122
-
123
- <div class="toolbar">
124
- <span class="label">主题</span>
125
- <div class="seg" id="segBase">
126
- <button type="button" data-base="light" aria-pressed="true">亮色</button>
127
- <button type="button" data-base="dark" aria-pressed="false">暗色</button>
128
- </div>
129
- </div>
130
-
131
- <div class="stage">
132
- <div class="caption"><span class="dot"></span>实际面板代码 · 演示数据</div>
133
- <iframe id="panel" src="./preview-panel.html" title="WTQ Pool 面板预览"></iframe>
134
- </div>
135
-
136
- <footer class="foot">
137
- <span>演示数据为虚构,不含任何真实账号或令牌。</span>
138
- <span>本地运行:<code>node docs/serve.cjs</code></span>
139
- </footer>
140
- </div>
141
-
142
- <script>
143
- (function () {
144
- "use strict";
145
- var frame = document.getElementById("panel");
146
- var root = document.documentElement;
147
- var base = "light";
148
-
149
- function press(segId, attr, value) {
150
- var buttons = document.getElementById(segId).querySelectorAll("button");
151
- for (var i = 0; i < buttons.length; i += 1) {
152
- buttons[i].setAttribute("aria-pressed", String(buttons[i].getAttribute(attr) === value));
153
- }
154
- }
155
-
156
- /* The panel ships its own source and view tabs, so the wrapper only has to
157
- hand it the theme. The frame is same-origin, hence the direct call. */
158
- function apply() {
159
- if (frame.contentWindow.__previewSetAppearance) {
160
- frame.contentWindow.__previewSetAppearance(base);
161
- }
162
- }
163
-
164
- function onSegment(segId, attr, pick) {
165
- document.getElementById(segId).addEventListener("click", function (event) {
166
- var button = event.target.closest("button[" + attr + "]");
167
- if (!button) return;
168
- pick(button.getAttribute(attr));
169
- press(segId, attr, button.getAttribute(attr));
170
- apply();
171
- });
172
- }
173
- onSegment("segBase", "data-base", function (v) { base = v; root.dataset.base = v; });
174
-
175
- root.dataset.base = base;
176
- // The panel boots asynchronously after the frame fetches its markup.
177
- frame.addEventListener("load", function () { setTimeout(apply, 400); });
178
- })();
179
- </script>
180
- </body>
181
- </html>
Binary file
Binary file