dsh-wtq-pool 1.0.1 → 1.0.2

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/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
@@ -1,339 +0,0 @@
1
- /*
2
- * Demo data for the panel preview page (docs/index.html).
3
- *
4
- * Synthetic only - accounts, credits and model ids here are illustrative and
5
- * belong to nobody. The shapes follow what renderer/panel.js actually reads, so
6
- * the preview exercises the real component.
7
- */
8
- (function () {
9
- const iso = (days) => new Date(Date.now() + days * 86400000).toISOString()
10
- const ms = (days) => Date.now() + days * 86400000
11
-
12
- const state = {
13
- sources: { workbuddy: true, trae: true, qoder: true },
14
- disabledRegions: [],
15
- pluginVersion: '1.0.1',
16
- unpublishedDeclarations: [],
17
- modelCap: 64,
18
- distribution: 'priority',
19
- showComposerPoints: true,
20
- autoCheckin: {
21
- enabled: true,
22
- hours: [9],
23
- last: {
24
- slot: '2026-10-10T09',
25
- claimed: 3,
26
- at: iso(-0.2),
27
- travel: { departed: 2, claimed: 2, adopted: 1 },
28
- growth: { streak: 1, tasks: 2, credit: 400, failed: 0 },
29
- qoder: { claimed: 1, skipped: 0, failed: 0 },
30
- trae: { claimed: 1, skipped: 0, failed: 0 },
31
- },
32
- },
33
- preferredAccountIds: { cn: 'wb-cn-1', global: '' },
34
- removedAccounts: [],
35
- declaration: { ok: true, changed: false, providerCount: 6 },
36
- addressDrift: false,
37
- shims: {
38
- cn: { running: true, baseUrl: 'http://127.0.0.1:42831/v1' },
39
- global: { running: true, baseUrl: 'http://127.0.0.1:42841/v1' },
40
- },
41
- warnings: {},
42
- staleSelectionRegions: [],
43
- refreshing: false,
44
-
45
- accounts: [
46
- {
47
- id: 'wb-cn-1',
48
- label: 'lin.cn@example.com',
49
- region: 'cn',
50
- domain: 'codebuddy.cn',
51
- expiresAt: iso(0.02),
52
- cooling: false,
53
- rateLimitHits: 0,
54
- active: true,
55
- preferred: true,
56
- disabled: false,
57
- creditReserve: 2000,
58
- credits: {
59
- total: 18320,
60
- expiringSoon: 1200,
61
- nearestExpiryMs: ms(2),
62
- packages: [
63
- { nameKey: 'credits.planQuota', remain: 14200, size: 20000, monthly: true, refreshAtMs: ms(21) },
64
- { nameKey: 'credits.addOnQuota', remain: 3200, size: 3200, roundExpiresAtMs: ms(2) },
65
- ],
66
- },
67
- checkin: {
68
- active: true,
69
- todayCheckedIn: false,
70
- streakDays: 12,
71
- dailyCredit: 20,
72
- todayCredit: 0,
73
- isStreakDay: false,
74
- nextStreakDay: 14,
75
- streakBonusCredit: 100,
76
- },
77
- },
78
- {
79
- id: 'wb-cn-2',
80
- label: 'du.cn@example.com',
81
- region: 'cn',
82
- domain: 'codebuddy.cn',
83
- expiresAt: iso(4),
84
- cooling: false,
85
- rateLimitHits: 1,
86
- active: false,
87
- preferred: false,
88
- disabled: false,
89
- credits: {
90
- total: 4100,
91
- packages: [
92
- { nameKey: 'credits.planQuota', remain: 4100, size: 8000, monthly: true, refreshAtMs: ms(12) },
93
- ],
94
- },
95
- checkin: { active: true, todayCheckedIn: true, todayCredit: 20, streakDays: 5, dailyCredit: 20 },
96
- },
97
- {
98
- id: 'wb-cn-3',
99
- label: 'wu.cn@example.com',
100
- region: 'cn',
101
- domain: 'codebuddy.cn',
102
- expiresAt: iso(6),
103
- cooling: true,
104
- cooldownUntil: new Date(Date.now() + 9 * 60000).toISOString(),
105
- modelCooldowns: [{ modelId: 'claude-sonnet-4.5', until: new Date(Date.now() + 5 * 60000).toISOString() }],
106
- rateLimitHits: 4,
107
- active: false,
108
- preferred: false,
109
- disabled: false,
110
- credits: { total: 980, packages: [{ packageName: 'Top-up', remain: 980, size: 1000, validDays: 30 }] },
111
- checkin: { active: true, todayCheckedIn: false, streakDays: 3, dailyCredit: 20, todayCredit: 0 },
112
- },
113
- {
114
- id: 'wb-global-1',
115
- label: 'lin.intl@example.com',
116
- region: 'global',
117
- domain: 'workbuddy.ai',
118
- expiresAt: iso(9),
119
- cooling: false,
120
- rateLimitHits: 0,
121
- active: true,
122
- preferred: false,
123
- disabled: false,
124
- credits: {
125
- total: 6400,
126
- packages: [{ nameKey: 'credits.planQuota', remain: 6400, size: 10000, monthly: true, refreshAtMs: ms(17) }],
127
- },
128
- checkin: { active: true, todayCheckedIn: false, streakDays: 2, dailyCredit: 20, todayCredit: 0 },
129
- },
130
- ],
131
-
132
- models: [
133
- {
134
- id: 'claude-sonnet-4.5', name: 'Claude Sonnet 4.5', alias: 'sonnet', region: 'cn', multiplier: 1,
135
- supportsImages: true, contextWindow: 200000, maxOutputTokens: 32000,
136
- nativeContextWindow: 200000, nativeMaxOutputTokens: 32000, nativeSupportsImages: true,
137
- nativeThinkingLevels: ['off', 'low', 'medium', 'high'], advanced: true,
138
- },
139
- {
140
- id: 'gemini-2.5-pro', name: 'Gemini 2.5 Pro', alias: 'gemini', region: 'cn', multiplier: 0.5,
141
- supportsImages: true, contextWindow: 1000000, maxOutputTokens: 64000,
142
- nativeContextWindow: 1000000, nativeMaxOutputTokens: 64000, nativeSupportsImages: true,
143
- nativeThinkingLevels: ['off', 'low', 'medium', 'high'], advanced: false,
144
- },
145
- {
146
- id: 'gpt-5.1-codex', name: 'GPT-5.1 Codex', region: 'cn', multiplier: 0,
147
- promo: { kind: 'night', untilHour: 6 },
148
- supportsImages: false, contextWindow: 400000, maxOutputTokens: 128000,
149
- nativeContextWindow: 400000, nativeMaxOutputTokens: 128000, nativeSupportsImages: false,
150
- nativeThinkingLevels: ['off', 'minimal', 'low', 'medium', 'high', 'xhigh'], advanced: false,
151
- },
152
- {
153
- id: 'kimi-k2-thinking', name: 'Kimi K2 Thinking', alias: 'kimi', region: 'cn', multiplier: 0.2,
154
- supportsImages: false, contextWindow: 256000, maxOutputTokens: 32000,
155
- nativeContextWindow: 256000, nativeMaxOutputTokens: 32000, nativeSupportsImages: false,
156
- nativeThinkingLevels: ['off', 'low', 'medium', 'high'], advanced: true,
157
- },
158
- {
159
- id: 'deepseek-v3.2', name: 'DeepSeek V3.2', region: 'cn', multiplier: 0.15,
160
- supportsImages: false, contextWindow: 128000, maxOutputTokens: 16000,
161
- nativeContextWindow: 128000, nativeMaxOutputTokens: 16000, nativeSupportsImages: false,
162
- nativeThinkingLevels: [], advanced: false,
163
- },
164
- {
165
- id: 'glm-4.6', name: 'GLM-4.6', region: 'cn', multiplier: 0,
166
- promo: { kind: 'night-later', nextHour: 22 },
167
- supportsImages: true, contextWindow: 200000, maxOutputTokens: 32000,
168
- nativeContextWindow: 200000, nativeMaxOutputTokens: 32000, nativeSupportsImages: true,
169
- nativeThinkingLevels: ['off', 'low', 'medium', 'high'], advanced: false,
170
- },
171
- {
172
- id: 'claude-opus-4.1', name: 'Claude Opus 4.1', region: 'global', multiplier: 3,
173
- supportsImages: true, contextWindow: 200000, maxOutputTokens: 32000,
174
- nativeContextWindow: 200000, nativeMaxOutputTokens: 32000, nativeSupportsImages: true,
175
- nativeThinkingLevels: ['off', 'low', 'medium', 'high'], advanced: false,
176
- },
177
- {
178
- id: 'gpt-5.1', name: 'GPT-5.1', alias: 'gpt', region: 'global', multiplier: 1,
179
- supportsImages: true, contextWindow: 400000, maxOutputTokens: 128000,
180
- nativeContextWindow: 400000, nativeMaxOutputTokens: 128000, nativeSupportsImages: true,
181
- nativeThinkingLevels: ['off', 'minimal', 'low', 'medium', 'high', 'xhigh'], advanced: false,
182
- },
183
- ],
184
-
185
- selectionByRegion: {
186
- cn: {
187
- enabledModelIds: ['claude-sonnet-4.5', 'gemini-2.5-pro', 'gpt-5.1-codex', 'kimi-k2-thinking', 'glm-4.6'],
188
- overrides: {
189
- 'claude-sonnet-4.5': {
190
- alias: 'sonnet', contextWindow: 312000, maxOutputTokens: 32000, supportsImages: true,
191
- thinkingLevels: ['off', 'medium', 'high'], defaultThinkingLevel: 'medium',
192
- },
193
- 'gemini-2.5-pro': { alias: 'gemini' },
194
- },
195
- },
196
- global: {
197
- enabledModelIds: ['gpt-5.1'],
198
- overrides: {},
199
- },
200
- },
201
-
202
- trae: {
203
- distribution: 'round-robin',
204
- preferred: { cn: '', ai: '' },
205
- accounts: [
206
- {
207
- label: 'Trae CN', region: 'cn', app: 'Trae CN', email: 'lin.cn@example.com',
208
- expiresAt: ms(3), expired: false,
209
- usage: {
210
- credits: {
211
- total: 1200, nearestExpiryMs: ms(2),
212
- packages: [
213
- { packageName: 'daily', remain: 200, size: 200, roundExpiresAtMs: ms(2) },
214
- { packageName: 'monthly', remain: 1000, size: 5000, monthly: true, refreshAtMs: ms(15) },
215
- ],
216
- },
217
- },
218
- checkin: { active: true, todayCheckedIn: false, deviceCheckedIn: false, amount: 100, unit: 'credits' },
219
- },
220
- {
221
- label: 'Trae International', region: 'ai', app: 'Trae', email: 'lin.intl@example.com',
222
- expiresAt: ms(8), expired: false,
223
- usage: { plan: { name: 'Pro', inTrial: false } },
224
- checkin: { active: false, todayCheckedIn: false, deviceCheckedIn: false },
225
- },
226
- ],
227
- gateways: [
228
- {
229
- region: 'cn', port: 42851, models: 2, portFallback: false, lastError: '',
230
- roster: [
231
- { id: 'deepseek-v3.2', name: 'DeepSeek V3.2', alias: '', nativeContextWindow: 128000,
232
- nativeMaxOutputTokens: 16000, nativeSupportsImages: false, nativeThinkingLevels: [], advanced: false },
233
- { id: 'doubao-seed-1.6', name: 'Doubao Seed 1.6', alias: 'doubao', nativeContextWindow: 256000,
234
- nativeMaxOutputTokens: 32000, nativeSupportsImages: true, nativeThinkingLevels: ['off', 'low', 'medium', 'high'], advanced: true },
235
- { id: 'kimi-k2-thinking', name: 'Kimi K2 Thinking', alias: '', nativeContextWindow: 256000,
236
- nativeMaxOutputTokens: 32000, nativeSupportsImages: false, nativeThinkingLevels: ['off', 'low', 'medium', 'high'], advanced: false },
237
- ],
238
- selection: { enabledModelIds: ['deepseek-v3.2', 'doubao-seed-1.6'], overrides: { 'doubao-seed-1.6': { alias: 'doubao' } } },
239
- },
240
- {
241
- region: 'ai', port: 42861, models: 1, portFallback: false, lastError: '',
242
- roster: [
243
- { id: 'gpt-5.1', name: 'GPT-5.1', alias: '', nativeContextWindow: 400000,
244
- nativeMaxOutputTokens: 128000, nativeSupportsImages: true, nativeThinkingLevels: [], advanced: false },
245
- ],
246
- selection: { enabledModelIds: ['gpt-5.1'], overrides: {} },
247
- },
248
- ],
249
- },
250
-
251
- qoder: {
252
- distribution: 'expiry',
253
- preferred: { cn: '', global: '' },
254
- accounts: [
255
- {
256
- label: 'Qoder CN', region: 'cn', expiresAt: ms(11), expired: false,
257
- usage: {
258
- credits: {
259
- total: 500,
260
- packages: [
261
- { nameKey: 'credits.planQuota', remain: 500, size: 500, neverExpires: true },
262
- { nameKey: 'credits.addOnQuota', remain: 0, size: 0, validDays: 30 },
263
- ],
264
- },
265
- },
266
- checkin: { active: true, todayCheckedIn: true, amount: 50, unit: 'credits' },
267
- },
268
- {
269
- label: 'Qoder Global', region: 'global', expiresAt: ms(5), expired: false,
270
- usage: { plan: { name: 'Trial', inTrial: true } },
271
- checkin: { active: true, todayCheckedIn: false, opensAtHour: 10, amount: 50, unit: 'credits' },
272
- },
273
- ],
274
- gateways: [
275
- {
276
- region: 'cn', port: 42871, models: 1, portFallback: false, lastError: '',
277
- roster: [
278
- { id: 'qwen3-coder-plus', name: 'Qwen3 Coder Plus', alias: '', nativeContextWindow: 128000,
279
- nativeMaxOutputTokens: 32000, nativeSupportsImages: false, nativeThinkingLevels: [], advanced: false },
280
- { id: 'claude-sonnet-4.5', name: 'Claude Sonnet 4.5', alias: '', nativeContextWindow: 200000,
281
- nativeMaxOutputTokens: 32000, nativeSupportsImages: true, nativeThinkingLevels: ['off', 'low', 'medium', 'high'], advanced: false },
282
- ],
283
- selection: { enabledModelIds: ['qwen3-coder-plus'], overrides: {} },
284
- },
285
- {
286
- region: 'global', port: 42881, models: 1, portFallback: false, lastError: '',
287
- roster: [
288
- { id: 'gpt-5.1', name: 'GPT-5.1', alias: '', nativeContextWindow: 400000,
289
- nativeMaxOutputTokens: 128000, nativeSupportsImages: true, nativeThinkingLevels: [], advanced: false },
290
- ],
291
- selection: { enabledModelIds: ['gpt-5.1'], overrides: {} },
292
- },
293
- ],
294
- },
295
- }
296
-
297
- // The check view fills only from `xd.doctor`, never from `xd.state`.
298
- const doctor = {
299
- ok: true,
300
- // Every id and detail below is the shape `doctor()` emits: the provider
301
- // label comes from PROVIDER_NAME_BY_REGION, and each count is the number
302
- // this file's own `models`/`selection` data would actually declare.
303
- findings: [
304
- { id: 'plugin-enabled', ok: true, detail: 'enabled' },
305
- { id: 'source-workbuddy', ok: true, detail: 'on' },
306
- { id: 'source-trae', ok: true, detail: 'on; 2 account(s) (cn x1, ai x1); serving cn: 2 model(s), ai: 1 model(s)' },
307
- { id: 'source-qoder', ok: true, detail: 'on; 2 account(s) (cn x1, global x1); serving cn: 1 model(s), global: 1 model(s)' },
308
- { id: 'accounts', ok: true, detail: '4 account(s): lin.cn@example.com, du.cn@example.com, wu.cn@example.com, lin.intl@example.com' },
309
- { id: 'rotation', ok: true, detail: '3 of 4 account(s) can serve a request now' },
310
- { id: 'host-registered-providers', ok: true, detail: 'the host is serving every provider this plugin declares' },
311
- { id: 'WTQ Pool (CN): endpoint', ok: true, detail: 'listening on http://127.0.0.1:42831/v1' },
312
- { id: 'WTQ Pool (CN): models', ok: true, detail: '6 model(s) in the catalog' },
313
- { id: 'WTQ Pool (CN): declared', ok: true, detail: 'registered with the running host' },
314
- { id: 'WTQ Pool (Global): endpoint', ok: true, detail: 'listening on http://127.0.0.1:42841/v1' },
315
- { id: 'WTQ Pool (Global): models', ok: true, detail: '2 model(s) in the catalog' },
316
- { id: 'WTQ Pool (Global): declared', ok: true, detail: 'registered with the running host' },
317
- { id: 'WTQ Pool (CN): published address', ok: true, detail: 'matches the endpoint this gateway bound (http://127.0.0.1:42831/v1)' },
318
- { id: 'WTQ Pool (Global): published address', ok: true, detail: 'matches the endpoint this gateway bound (http://127.0.0.1:42841/v1)' },
319
- { id: 'WTQ Pool Trae (CN): published address', ok: true, detail: 'matches the endpoint this gateway bound (http://127.0.0.1:42851/v1)' },
320
- { id: 'WTQ Pool Trae (Global): published address', ok: true, detail: 'matches the endpoint this gateway bound (http://127.0.0.1:42861/v1)' },
321
- { id: 'WTQ Pool Qoder (CN): published address', ok: true, detail: 'matches the endpoint this gateway bound (http://127.0.0.1:42871/v1)' },
322
- { id: 'WTQ Pool Qoder (Global): published address', ok: true, detail: 'matches the endpoint this gateway bound (http://127.0.0.1:42881/v1)' },
323
- { id: 'declaration-written', ok: true, detail: 'up to date' },
324
- ],
325
- }
326
-
327
- doctor.report = [
328
- 'WTQ Pool doctor',
329
- new Date().toISOString(),
330
- 'overall: PASS',
331
- '',
332
- ...doctor.findings.map((f) => (f.ok ? 'PASS ' : 'FAIL ') + f.id + ' - ' + f.detail),
333
- '',
334
- ].join('\n')
335
-
336
- const api = { state, doctor }
337
- if (typeof module !== 'undefined' && module.exports) module.exports = api
338
- if (typeof window !== 'undefined') window.__previewData = api
339
- })();
Binary file
Binary file
@@ -1,95 +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 Pool panel preview</title>
7
- <!--
8
- dsh frames this panel inside the Plugins page and gives it no window chrome
9
- of its own, so panel.css already defaults --xd-titlebar to 0 and no override
10
- is needed here.
11
- -->
12
- </head>
13
- <body>
14
- <script src="./preview-data.js"></script>
15
- <script>
16
- /*
17
- * Stand-in for the host: the panel asks `window.pluginBridge` for everything
18
- * it shows, so answering those calls is the whole of a host.
19
- *
20
- * The panel is fetched from renderer/ below and mounted as-is, so this
21
- * preview never drifts from what ships.
22
- */
23
- (function () {
24
- "use strict";
25
- var data = window.__previewData;
26
- var appearance = { base: "light", locale: "zh-CN" };
27
- var handlers = {};
28
- function copy(value) { return JSON.parse(JSON.stringify(value)); }
29
-
30
- window.pluginBridge = {
31
- invoke: function (channel, payload) {
32
- if (channel === "xd.state") return Promise.resolve(copy(data.state));
33
- if (channel === "xd.doctor") return Promise.resolve(copy(data.doctor));
34
- if (channel === "app.getAppearance") {
35
- return Promise.resolve({ base: appearance.base, locale: appearance.locale });
36
- }
37
- if (channel === "xd.checkin") {
38
- return Promise.resolve({ state: copy(data.state), result: { credit: 20 } });
39
- }
40
- if (channel === "xd.checkinAll") {
41
- return Promise.resolve({ state: copy(data.state), claimed: 0 });
42
- }
43
- if (channel === "xd.copyReport") return Promise.resolve({ ok: true });
44
- if (channel === "shell.openExternal") {
45
- window.open(payload.url, "_blank", "noopener,noreferrer");
46
- return Promise.resolve();
47
- }
48
- // Every other channel is a write, and a write answers with the whole
49
- // status document - which is what the panel redraws from.
50
- return Promise.resolve(copy(data.state));
51
- },
52
- on: function (channel, handler) { handlers[channel] = handler; },
53
- };
54
-
55
- // Called by the hosting page's theme buttons.
56
- window.__previewSetAppearance = function (base) {
57
- if (base !== "light" && base !== "dark") return;
58
- appearance.base = base;
59
- if (handlers["appearance:changed"]) {
60
- handlers["appearance:changed"]({ base: base, locale: appearance.locale });
61
- }
62
- };
63
- })();
64
-
65
- (function () {
66
- "use strict";
67
- var css = document.createElement("link");
68
- css.rel = "stylesheet";
69
- css.href = "../renderer/panel.css";
70
- document.head.appendChild(css);
71
-
72
- fetch("../renderer/index.html").then(function (response) {
73
- return response.text();
74
- }).then(function (html) {
75
- var parsed = new DOMParser().parseFromString(html, "text/html");
76
- // The panel names its stylesheet and script as siblings. Both are
77
- // re-attached below with the paths this page needs, so the markup comes
78
- // straight from the real file.
79
- var owned = parsed.querySelectorAll("link[rel=stylesheet], script");
80
- for (var i = 0; i < owned.length; i += 1) owned[i].remove();
81
- document.body.innerHTML = parsed.body.innerHTML;
82
-
83
- var js = document.createElement("script");
84
- js.src = "../renderer/panel.js";
85
- document.body.appendChild(js);
86
- }).catch(function (error) {
87
- // Opening this file straight from disk is the likely cause, so the
88
- // message names the command that works.
89
- document.body.textContent = "panel failed to load (" + error + "). " +
90
- "Open the page through the local server instead: node docs/serve.cjs";
91
- });
92
- })();
93
- </script>
94
- </body>
95
- </html>
Binary file