dsh-xdpool 3.0.6 → 3.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +22 -0
- package/lib/bin.js +88 -4
- package/lib/client.js +76 -65
- package/lib/index.d.ts +13 -1
- package/lib/index.js +533 -294
- package/package.json +1 -1
- package/vendor/channel-pack/pack.js +14 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
本项目的所有重要变更都会记录在此文件。
|
|
3
3
|
版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
|
|
4
|
+
## 3.0.7 — UI 错位修复、一键更新真正生效、代际守卫
|
|
5
|
+
|
|
6
|
+
### UI 错位:账号卡回到正确的列
|
|
7
|
+
|
|
8
|
+
3.0.4 起插件池账号卡被挂成了 `.app` 的网格子项。`.app` 是「功能栏 | 渠道列表 | 详情」三列,
|
|
9
|
+
而 `display:contents` 容器让新增的 `section` 直接参与网格排列,把渠道列表和详情挤到第二行、
|
|
10
|
+
被 `overflow:hidden` 裁掉 —— 账号池页整页错乱。
|
|
11
|
+
|
|
12
|
+
现在账号卡由 `ChannelPoolSection` 渲染进**详情列的 `.mbody`**(和提示条同一条通路),
|
|
13
|
+
并且只在选中 WorkBuddy 国内版 / 国际版时显示;选 CodeArts 等其它渠道、或未选渠道时不显示。
|
|
14
|
+
结构复用设计稿的 `.sec / .sec-head / .accts / .acct*` 类名,没有新造一套样式。
|
|
15
|
+
|
|
16
|
+
### 一键更新:之前从来没有真正生效过
|
|
17
|
+
|
|
18
|
+
更新接口原来只改 profile 的 `package.json`,不碰 `pnpm-lock.yaml`。DSH 下次启动按 lockfile
|
|
19
|
+
安装(或 frozen-lockfile 校验失败后从快照恢复),spec 被打回旧版本 —— 用户看到的就是
|
|
20
|
+
「点了一键更新,版本号一直没变」。现在写完后调用 pnpm 同步 **package.json / lockfile /
|
|
21
|
+
node_modules** 三处;同步失败会回滚 manifest,宁可这次没更新,也不留下半更新的 profile。
|
|
22
|
+
|
|
23
|
+
### pi-ai 代际守卫不再空转
|
|
24
|
+
|
|
25
|
+
宿主模块路径原来多拼了一层 `node_modules`(`…/node_modules/node_modules/…`),
|
|
26
|
+
守卫永远返回 `unknown` 且日志里和「对齐」一样静默 —— 真正撞上 0.82 / 1.5 代际错配时
|
|
27
|
+
(切到 xdpool 系模型第一条就报 PI_AI_ERROR)没有任何线索。现在先用 `createRequire` 解析
|
|
28
|
+
宿主包,失败再退回少一层的相对路径;`unknown` / `aligned` / `mismatch` 都会写 startup.log。
|
|
29
|
+
README 补了「profile 需 `pnpm.overrides` 把 pi-ai 钉到宿主代」的说明。
|
|
30
|
+
|
|
4
31
|
## 3.0.6 — 账号卡重做,撤掉没用的关闭按钮
|
|
5
32
|
|
|
6
33
|
3.0.4 把账号卡挂回账号池页时,直接用了 2.x 的 `AccountBlock`:它的根元素是渠道行的类名
|
package/README.md
CHANGED
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
## 更新公告
|
|
11
11
|
|
|
12
|
+
**3.0.7** — UI 错位修复、一键更新真正生效、代际守卫不再空转。
|
|
13
|
+
|
|
14
|
+
- 修复账号池页整页错乱:账号卡回到详情列里,只在选中 WorkBuddy 国内版/国际版时显示
|
|
15
|
+
- 修复一键更新「更新了但版本号一直没变」:现在会同步 lockfile 和 node_modules,不再被 DSH 启动时装回旧版
|
|
16
|
+
- pi-ai 代际守卫修正宿主路径,mismatch / aligned / unknown 都会写进启动日志,切 xdpool 模型崩溃时不再毫无线索
|
|
17
|
+
|
|
12
18
|
**3.0.6** — 账号卡重做。
|
|
13
19
|
|
|
14
20
|
- 账号池页的账号卡重画成自包含的卡片:昵称、状态徽章(当前使用 / 已停用 / 冷却中)、令牌到期、积分、以及优先/停用/签到/移出池子一排按钮
|
|
@@ -300,6 +306,22 @@ xdpool:
|
|
|
300
306
|
- **构建**
|
|
301
307
|
`tsdown` 产出 `lib/index.js`(宿主入口)+ `lib/index.d.ts`(类型)+ `lib/bin.js`(CLI)+ `lib/client.js`(CJS,用 `window.__ModuleLoader__.load` 包起来的浏览器 bundle)。四个产物都随仓库提交,所以安装时不需要任何构建脚本。
|
|
302
308
|
|
|
309
|
+
## π-ai 代际对齐(重要)
|
|
310
|
+
|
|
311
|
+
本插件在宿主里用 pi-ai 组装 provider,宿主适配器用**它自己**那份 pi-ai 消费事件流。
|
|
312
|
+
两份大版本不一致时(典型:插件侧 0.82.x、宿主侧 1.5.x),第一次请求就会崩在适配器接缝,
|
|
313
|
+
宿主把它归成不可重试的 `PI_AI_ERROR` —— 现象是「切到 xdpool 系模型,第一条就没内容」。
|
|
314
|
+
|
|
315
|
+
如何确认:重启 DSH 后看 `~/.dsh/.xdpool/startup.log`,会写 `pi-ai generation: aligned at …`
|
|
316
|
+
或 `mismatch`。一旦看到 mismatch,在 profile 的 `package.json` 里钉到宿主代:
|
|
317
|
+
|
|
318
|
+
```json
|
|
319
|
+
{ "pnpm": { "overrides": { "@earendil-works/pi-ai": "<宿主版本>" } } }
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
然后重装依赖并重启。日志里写 `unknown` 表示两侧只读到一份(比如宿主把它打进了 bundle),
|
|
323
|
+
插件会继续工作,但代际无法自动核对。
|
|
324
|
+
|
|
303
325
|
## 已知限制
|
|
304
326
|
|
|
305
327
|
- **WorkBuddy 主账号的登录仍走桌面 App**:XD Pool 可以为插件自己的二十多家登录渠道发起登录,但 WorkBuddy 本体的 token 由桌面 App 的腾讯 SSO 铸造并和设备绑定,池不会替你登录 WorkBuddy。加号 = 在桌面 App 里登录 / 切换,XD Pool 自动吸收。
|
package/lib/bin.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
1
2
|
import { createDecipheriv, createHash, randomUUID } from "node:crypto";
|
|
2
3
|
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, writeFileSync } from "node:fs";
|
|
3
4
|
import { chmod, copyFile, mkdir, readFile, readdir, rename, rm, unlink, writeFile, writeFile as writeFile$1 } from "node:fs/promises";
|
|
@@ -190,6 +191,23 @@ const SESSION_DEAD_MARKERS = [
|
|
|
190
191
|
*/
|
|
191
192
|
const ALREADY_CHECKIN_MARKERS = ["已签到", "already"];
|
|
192
193
|
/**
|
|
194
|
+
* 签到相关的业务码。
|
|
195
|
+
*
|
|
196
|
+
* 上游用 `code` 区分三种「不是成功也不是故障」的结果,而我们此前一律当失败抛出:
|
|
197
|
+
* 今天已经领过(1001/10001)会在每次自动领取时记一条失败;活动未开放(1002/1003/
|
|
198
|
+
* 40901/41000)也会,而且永远重试不到结果。它们必须分开对待:
|
|
199
|
+
*
|
|
200
|
+
* 已领 → 幂等成功(今天的分就在账上,不是错)
|
|
201
|
+
* 未开放 → inactive(等下一次,不报错、不重试)
|
|
202
|
+
*/
|
|
203
|
+
const CHECKIN_ALREADY_CODES = /* @__PURE__ */ new Set([1001, 10001]);
|
|
204
|
+
const CHECKIN_INACTIVE_CODES = /* @__PURE__ */ new Set([
|
|
205
|
+
1002,
|
|
206
|
+
1003,
|
|
207
|
+
40901,
|
|
208
|
+
41e3
|
|
209
|
+
]);
|
|
210
|
+
/**
|
|
193
211
|
* Markers for "there is no compensation offer to collect".
|
|
194
212
|
*
|
|
195
213
|
* The offer is seasonal — an outage announcement opens one, and it closes on a
|
|
@@ -575,7 +593,17 @@ function billingHeaders(credential) {
|
|
|
575
593
|
const headers = {
|
|
576
594
|
"Authorization": `Bearer ${credential.accessToken}`,
|
|
577
595
|
"Accept": "application/json",
|
|
578
|
-
"Content-Type": "application/json"
|
|
596
|
+
"Content-Type": "application/json",
|
|
597
|
+
/**
|
|
598
|
+
* 产品身份头 —— 缺了它们,计费/签到端点会把请求当成「不是客户端发的」。
|
|
599
|
+
*
|
|
600
|
+
* 这三个头一直在客户端那边发(网页/IDE 的每个 billing 请求都带),我们只发了
|
|
601
|
+
* Authorization + X-Domain + X-User-Id。上游收紧校验之后,签到就只剩一个笼统的
|
|
602
|
+
* 失败,看不出原因。UA 用本插件已经在别处使用的桌面版本号,不再另造一个。
|
|
603
|
+
*/
|
|
604
|
+
"X-Product": "SaaS",
|
|
605
|
+
"X-Product-Code": "workbuddy",
|
|
606
|
+
"User-Agent": DESKTOP_UA
|
|
579
607
|
};
|
|
580
608
|
if (credential.uid !== "" && credential.uid !== void 0) headers["X-User-Id"] = credential.uid;
|
|
581
609
|
if (credential.enterpriseId !== void 0 && credential.enterpriseId !== "") {
|
|
@@ -1466,6 +1494,17 @@ var WorkBuddyUpstreamClient = class {
|
|
|
1466
1494
|
signal: AbortSignal.timeout(JSON_TIMEOUT_MS)
|
|
1467
1495
|
});
|
|
1468
1496
|
const envelope = await readEnvelope(response);
|
|
1497
|
+
if (response.ok && CHECKIN_INACTIVE_CODES.has(envelope.code)) return {
|
|
1498
|
+
active: false,
|
|
1499
|
+
todayCheckedIn: false,
|
|
1500
|
+
streakDays: 0,
|
|
1501
|
+
dailyCredit: 0,
|
|
1502
|
+
todayCredit: 0,
|
|
1503
|
+
isStreakDay: false,
|
|
1504
|
+
nextStreakDay: 0,
|
|
1505
|
+
streakBonusDays: 0,
|
|
1506
|
+
streakBonusCredit: 0
|
|
1507
|
+
};
|
|
1469
1508
|
if (!response.ok || envelope.code !== 0) throw envelopeError(response.status, envelope);
|
|
1470
1509
|
const data = typeof envelope.data === "object" && envelope.data !== null ? envelope.data : {};
|
|
1471
1510
|
const num = (key) => typeof data[key] === "number" ? data[key] : 0;
|
|
@@ -1491,8 +1530,22 @@ var WorkBuddyUpstreamClient = class {
|
|
|
1491
1530
|
signal: AbortSignal.timeout(JSON_TIMEOUT_MS)
|
|
1492
1531
|
});
|
|
1493
1532
|
const envelope = await readEnvelope(response);
|
|
1533
|
+
const neutral = (data_) => ({
|
|
1534
|
+
credit: 0,
|
|
1535
|
+
streakDays: typeof data_["streak_days"] === "number" ? data_["streak_days"] : 0,
|
|
1536
|
+
isStreakDay: false
|
|
1537
|
+
});
|
|
1538
|
+
const payload = typeof envelope.data === "object" && envelope.data !== null ? envelope.data : {};
|
|
1539
|
+
/**
|
|
1540
|
+
* 已领过(1001/10001)就是成功:今天的分在账上,重复领取不该被记成失败 ——
|
|
1541
|
+
* 自动化每小时跑一次,记成失败会刷出一整片红字。
|
|
1542
|
+
*
|
|
1543
|
+
* 未开放(1002/1003/40901/41000)同样是「今天没有可领的」,不是故障;
|
|
1544
|
+
* 抛错会让调度器一直重试一个永远不会成功的结果。
|
|
1545
|
+
*/
|
|
1546
|
+
if (response.ok && (CHECKIN_ALREADY_CODES.has(envelope.code) || CHECKIN_INACTIVE_CODES.has(envelope.code))) return neutral(payload);
|
|
1494
1547
|
if (!response.ok || envelope.code !== 0) throw envelopeError(response.status, envelope);
|
|
1495
|
-
const data =
|
|
1548
|
+
const data = payload;
|
|
1496
1549
|
const numberField = (key) => typeof data[key] === "number" ? data[key] : 0;
|
|
1497
1550
|
return {
|
|
1498
1551
|
credit: numberField("credit"),
|
|
@@ -4931,6 +4984,22 @@ var WorkBuddyAccountPool = class {
|
|
|
4931
4984
|
* Returns true when the token is known good afterwards (refreshed, or still
|
|
4932
4985
|
* valid), false when the credential was proven dead.
|
|
4933
4986
|
*/
|
|
4987
|
+
/**
|
|
4988
|
+
* 取一个账号「可以用来发一次请求」的凭据:过期就先刷新。
|
|
4989
|
+
*
|
|
4990
|
+
* 签到 / 积分这些端点走的是「按 id 直接找账号」的路径,和选号路径不同 ——
|
|
4991
|
+
* 以前它们直接拿池里的 `account.credential`,凭据过期时上游回 401,界面只能
|
|
4992
|
+
* 说「领取失败」,而同一时刻对话却正常(对话走 `getAvailableAccount`,那里会
|
|
4993
|
+
* 先 `ensureFresh`)。用户反馈的「积分领取全部失败」就是这一处。
|
|
4994
|
+
*
|
|
4995
|
+
* 返回 undefined 表示「刷新失败」:调用方应当直接告诉用户重新登录,
|
|
4996
|
+
* 而不是拿旧 token 再去撞一次 401。
|
|
4997
|
+
*/
|
|
4998
|
+
async freshCredential(id) {
|
|
4999
|
+
const account = this.accounts.find((item) => item.id === id);
|
|
5000
|
+
if (account === void 0) return void 0;
|
|
5001
|
+
return await this.ensureFresh(account) ? account.credential : void 0;
|
|
5002
|
+
}
|
|
4934
5003
|
async ensureFresh(account, force = false) {
|
|
4935
5004
|
if (this.client === void 0) return true;
|
|
4936
5005
|
const credential = account.credential;
|
|
@@ -12643,10 +12712,25 @@ async function writePreferredId(accountId, path = preferredIdPath()) {
|
|
|
12643
12712
|
}
|
|
12644
12713
|
fileURLToPath(new URL("..", import.meta.url));
|
|
12645
12714
|
(() => {
|
|
12715
|
+
/**
|
|
12716
|
+
* issue #208:原来用 `../../node_modules/@deepseek-ai/dsh-llm-pi-ai/`:
|
|
12717
|
+
* `import.meta.url` 是 `<profile>/node_modules/dsh-xdpool/lib/index.js`,`../../`
|
|
12718
|
+
* 已经落到 `<profile>/node_modules/`,再拼 `node_modules/...` 就成了
|
|
12719
|
+
* `<profile>/node_modules/node_modules/...` —— 多一层,永远解析不到,守卫因此
|
|
12720
|
+
* 长期返回 unknown、日志里一个字都不写,而真正的 0.82 / 1.5 代际错配照样崩。
|
|
12721
|
+
*
|
|
12722
|
+
* 现在优先用 createRequire 从插件自身解析宿主包(pnpm / hoisted / 全局安装都
|
|
12723
|
+
* 能覆盖),再退回少一层的相对路径。createRequire 在 ESM bundle 里也可用。
|
|
12724
|
+
*/
|
|
12646
12725
|
try {
|
|
12647
|
-
|
|
12726
|
+
const require_ = createRequire(import.meta.url);
|
|
12727
|
+
return dirname(require_.resolve("@deepseek-ai/dsh-llm-pi-ai/package.json"));
|
|
12648
12728
|
} catch {
|
|
12649
|
-
|
|
12729
|
+
try {
|
|
12730
|
+
return fileURLToPath(new URL("../node_modules/@deepseek-ai/dsh-llm-pi-ai/", import.meta.url));
|
|
12731
|
+
} catch {
|
|
12732
|
+
return "";
|
|
12733
|
+
}
|
|
12650
12734
|
}
|
|
12651
12735
|
})();
|
|
12652
12736
|
/**
|
package/lib/client.js
CHANGED
|
@@ -230,7 +230,7 @@ window.__ModuleLoader__.load({
|
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
232
|
const ACCOUNT_CARD_CSS = `
|
|
233
|
-
.xdp-accts{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:var(--s3)
|
|
233
|
+
.xdp-accts{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:var(--s3)}
|
|
234
234
|
.xdp-acct{display:flex;flex-direction:column;gap:var(--s2);min-width:0;padding:var(--s3);border:1px solid var(--line);border-radius:var(--r-lg);background:var(--surface)}
|
|
235
235
|
.xdp-acct[data-serving="true"]{border-color:var(--accent-line)}
|
|
236
236
|
.xdp-acct .xdp-acct-head{display:block;min-width:0}
|
|
@@ -269,7 +269,7 @@ window.__ModuleLoader__.load({
|
|
|
269
269
|
const POOL_NAV_ICON_MASK_URL = `data:image/svg+xml;utf8,${encodeURIComponent(POOL_NAV_ICON_SVG)}`;
|
|
270
270
|
//#endregion
|
|
271
271
|
//#region src/version.ts
|
|
272
|
-
const POOL_VERSION = "3.0.
|
|
272
|
+
const POOL_VERSION = "3.0.7";
|
|
273
273
|
function compareVersions(left, right) {
|
|
274
274
|
const parse = (value) => {
|
|
275
275
|
const [core, ...rest] = value.trim().replace(/^v/u, "").split("-");
|
|
@@ -10314,7 +10314,7 @@ window.__ModuleLoader__.load({
|
|
|
10314
10314
|
return "签到失败";
|
|
10315
10315
|
}
|
|
10316
10316
|
}
|
|
10317
|
-
function ChannelPoolSection({ t, active, onAddAccount, autoClaim, autoClaimBusy, onAutoClaim, autoClaimRunning, onAutoClaimRun, banner }) {
|
|
10317
|
+
function ChannelPoolSection({ t, active, onAddAccount, autoClaim, autoClaimBusy, onAutoClaim, autoClaimRunning, onAutoClaimRun, banner, regionCards }) {
|
|
10318
10318
|
const [ownActive, setOwnActive] = (0, react.useState)("");
|
|
10319
10319
|
const [loginState, setLoginState] = (0, react.useState)(void 0);
|
|
10320
10320
|
const loginAbort = (0, react.useRef)(void 0);
|
|
@@ -11083,16 +11083,18 @@ window.__ModuleLoader__.load({
|
|
|
11083
11083
|
}
|
|
11084
11084
|
};
|
|
11085
11085
|
if (entries.length === 0 && error === void 0) {
|
|
11086
|
-
if (!
|
|
11087
|
-
|
|
11088
|
-
|
|
11089
|
-
|
|
11090
|
-
|
|
11091
|
-
|
|
11092
|
-
|
|
11093
|
-
|
|
11094
|
-
|
|
11095
|
-
|
|
11086
|
+
if (!(regionCards !== void 0 && !loading)) {
|
|
11087
|
+
if (!loading) return (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
|
|
11088
|
+
return (0, react_jsx_runtime.jsx)("section", {
|
|
11089
|
+
className: "dsm-xdpool-cpool",
|
|
11090
|
+
"aria-label": t?.("channelpool.title") ?? "Channels",
|
|
11091
|
+
children: (0, react_jsx_runtime.jsx)("p", {
|
|
11092
|
+
className: "note",
|
|
11093
|
+
role: "status",
|
|
11094
|
+
children: t?.("channelpool.loading") ?? "Reading scan channels…"
|
|
11095
|
+
})
|
|
11096
|
+
});
|
|
11097
|
+
}
|
|
11096
11098
|
}
|
|
11097
11099
|
const chosenEntry = entries.find((entry) => entry.channel.id === chosen) ?? entries[0];
|
|
11098
11100
|
const totalAccounts = entries.reduce((sum, entry) => sum + entry.accounts.length, 0);
|
|
@@ -11224,19 +11226,23 @@ window.__ModuleLoader__.load({
|
|
|
11224
11226
|
children: (0, react_jsx_runtime.jsxs)("div", {
|
|
11225
11227
|
className: "mbody",
|
|
11226
11228
|
style: { paddingTop: "var(--s5)" },
|
|
11227
|
-
children: [
|
|
11228
|
-
|
|
11229
|
-
|
|
11230
|
-
|
|
11231
|
-
className: "
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
|
|
11229
|
+
children: [
|
|
11230
|
+
banner,
|
|
11231
|
+
regionCards,
|
|
11232
|
+
error === void 0 ? null : (0, react_jsx_runtime.jsxs)("p", {
|
|
11233
|
+
className: "hint",
|
|
11234
|
+
children: [t?.("channelpool.loadError", { message: error }) ?? `Could not load channels: ${error}`, (0, react_jsx_runtime.jsx)("button", {
|
|
11235
|
+
type: "button",
|
|
11236
|
+
className: "tiny",
|
|
11237
|
+
style: { marginLeft: "auto" },
|
|
11238
|
+
onClick: () => {
|
|
11239
|
+
setEnabled(new Map());
|
|
11240
|
+
load();
|
|
11241
|
+
},
|
|
11242
|
+
children: t?.("channelpool.retry") ?? "重试"
|
|
11243
|
+
})]
|
|
11244
|
+
})
|
|
11245
|
+
]
|
|
11240
11246
|
})
|
|
11241
11247
|
})] });
|
|
11242
11248
|
const { channel, accounts, models, facts, balances, statuses, status } = chosenEntry;
|
|
@@ -11343,6 +11349,7 @@ window.__ModuleLoader__.load({
|
|
|
11343
11349
|
className: "mbody",
|
|
11344
11350
|
children: [
|
|
11345
11351
|
banner,
|
|
11352
|
+
regionCards,
|
|
11346
11353
|
loginState !== void 0 && loginState.channelId === channel.id && (loginState.phase === "paste" ? (0, react_jsx_runtime.jsxs)("div", {
|
|
11347
11354
|
className: "banner",
|
|
11348
11355
|
children: [
|
|
@@ -15279,7 +15286,9 @@ window.__ModuleLoader__.load({
|
|
|
15279
15286
|
})]
|
|
15280
15287
|
});
|
|
15281
15288
|
}
|
|
15282
|
-
|
|
15289
|
+
//#endregion
|
|
15290
|
+
//#region src/client/region-card.tsx
|
|
15291
|
+
const REGION_CHANNEL_BY_REGION = Object.freeze({
|
|
15283
15292
|
cn: "buddy",
|
|
15284
15293
|
global: "workbuddy"
|
|
15285
15294
|
});
|
|
@@ -16503,6 +16512,7 @@ window.__ModuleLoader__.load({
|
|
|
16503
16512
|
};
|
|
16504
16513
|
t?.("row.title");
|
|
16505
16514
|
t?.("row.desc");
|
|
16515
|
+
const showPoolAccounts = selectedChannel === REGION_CHANNEL_BY_REGION.cn || selectedChannel === REGION_CHANNEL_BY_REGION.global;
|
|
16506
16516
|
return (0, react_jsx_runtime.jsx)(PoolShell, {
|
|
16507
16517
|
t,
|
|
16508
16518
|
version: POOL_VERSION,
|
|
@@ -16538,46 +16548,47 @@ window.__ModuleLoader__.load({
|
|
|
16538
16548
|
children: page === "aggregate" ? (0, react_jsx_runtime.jsx)(AggregatePage, { t }) : page === "channels" ? (0, react_jsx_runtime.jsx)(ChannelsPage, { t }) : page === "ledger" ? (0, react_jsx_runtime.jsx)(LedgerPage, {
|
|
16539
16549
|
t,
|
|
16540
16550
|
usage
|
|
16541
|
-
}) : page === "routing" ? (0, react_jsx_runtime.jsx)(RoutingPage, { t }) : page === "gateway" ? (0, react_jsx_runtime.jsx)(GatewayPage, { t }) : page === "backup" ? (0, react_jsx_runtime.jsx)(BackupPanel, { t }) : (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: (0, react_jsx_runtime.
|
|
16551
|
+
}) : page === "routing" ? (0, react_jsx_runtime.jsx)(RoutingPage, { t }) : page === "gateway" ? (0, react_jsx_runtime.jsx)(GatewayPage, { t }) : page === "backup" ? (0, react_jsx_runtime.jsx)(BackupPanel, { t }) : (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: (0, react_jsx_runtime.jsx)("div", {
|
|
16542
16552
|
className: "dsm-xdpool-regions dsm-xdpool-region-grid",
|
|
16543
16553
|
style: { display: "contents" },
|
|
16544
|
-
children:
|
|
16545
|
-
const here = statusOf(region);
|
|
16546
|
-
const rows = here?.accounts ?? [];
|
|
16547
|
-
if (rows.length === 0) return null;
|
|
16548
|
-
return (0, react_jsx_runtime.jsxs)("section", {
|
|
16549
|
-
className: "sec",
|
|
16550
|
-
children: [(0, react_jsx_runtime.jsx)("div", {
|
|
16551
|
-
className: "sec-head",
|
|
16552
|
-
children: (0, react_jsx_runtime.jsxs)("span", {
|
|
16553
|
-
className: "sec-title",
|
|
16554
|
-
children: [region === "cn" ? t?.("row.tabCn") ?? "CN" : t?.("row.tabGlobal") ?? "Global", ` · ${String(rows.length)}`]
|
|
16555
|
-
})
|
|
16556
|
-
}), (0, react_jsx_runtime.jsx)("div", {
|
|
16557
|
-
className: "xdp-accts",
|
|
16558
|
-
children: rows.map((account) => (0, react_jsx_runtime.jsx)(AccountCard, {
|
|
16559
|
-
account,
|
|
16560
|
-
t,
|
|
16561
|
-
serving: here?.activeAccountId === account.id,
|
|
16562
|
-
...checkinBusyId === account.id ? { claiming: true } : {},
|
|
16563
|
-
...accountBusyId === account.id ? { busy: true } : {},
|
|
16564
|
-
onClaim: () => {
|
|
16565
|
-
claimCheckin(region, account.id);
|
|
16566
|
-
},
|
|
16567
|
-
onToggle: (disabled) => {
|
|
16568
|
-
toggleAccountDisabled(region, account.id, disabled);
|
|
16569
|
-
},
|
|
16570
|
-
onPrefer: (id) => {
|
|
16571
|
-
setPreferredAccount(region, id);
|
|
16572
|
-
},
|
|
16573
|
-
onIgnore: () => {
|
|
16574
|
-
setAccountIgnored(region, account.id, true);
|
|
16575
|
-
}
|
|
16576
|
-
}, account.id))
|
|
16577
|
-
})]
|
|
16578
|
-
}, region);
|
|
16579
|
-
}), (0, react_jsx_runtime.jsx)(ChannelPoolSection, {
|
|
16554
|
+
children: (0, react_jsx_runtime.jsx)(ChannelPoolSection, {
|
|
16580
16555
|
t,
|
|
16556
|
+
regionCards: showPoolAccounts ? ["cn", "global"].map((region) => {
|
|
16557
|
+
const here = statusOf(region);
|
|
16558
|
+
const rows = here?.accounts ?? [];
|
|
16559
|
+
if (rows.length === 0) return null;
|
|
16560
|
+
return (0, react_jsx_runtime.jsxs)("section", {
|
|
16561
|
+
className: "sec",
|
|
16562
|
+
children: [(0, react_jsx_runtime.jsx)("div", {
|
|
16563
|
+
className: "sec-head",
|
|
16564
|
+
children: (0, react_jsx_runtime.jsxs)("span", {
|
|
16565
|
+
className: "sec-title",
|
|
16566
|
+
children: [region === "cn" ? t?.("row.tabCn") ?? "CN" : t?.("row.tabGlobal") ?? "Global", ` · ${String(rows.length)}`]
|
|
16567
|
+
})
|
|
16568
|
+
}), (0, react_jsx_runtime.jsx)("div", {
|
|
16569
|
+
className: "accts",
|
|
16570
|
+
children: rows.map((account) => (0, react_jsx_runtime.jsx)(AccountCard, {
|
|
16571
|
+
account,
|
|
16572
|
+
t,
|
|
16573
|
+
serving: here?.activeAccountId === account.id,
|
|
16574
|
+
...checkinBusyId === account.id ? { claiming: true } : {},
|
|
16575
|
+
...accountBusyId === account.id ? { busy: true } : {},
|
|
16576
|
+
onClaim: () => {
|
|
16577
|
+
claimCheckin(region, account.id);
|
|
16578
|
+
},
|
|
16579
|
+
onToggle: (disabled) => {
|
|
16580
|
+
toggleAccountDisabled(region, account.id, disabled);
|
|
16581
|
+
},
|
|
16582
|
+
onPrefer: (id) => {
|
|
16583
|
+
setPreferredAccount(region, id);
|
|
16584
|
+
},
|
|
16585
|
+
onIgnore: () => {
|
|
16586
|
+
setAccountIgnored(region, account.id, true);
|
|
16587
|
+
}
|
|
16588
|
+
}, account.id))
|
|
16589
|
+
})]
|
|
16590
|
+
}, region);
|
|
16591
|
+
}) : void 0,
|
|
16581
16592
|
active: selectedChannel,
|
|
16582
16593
|
onAddAccount: () => {
|
|
16583
16594
|
setPage("channels");
|
|
@@ -16598,7 +16609,7 @@ window.__ModuleLoader__.load({
|
|
|
16598
16609
|
className: "hint",
|
|
16599
16610
|
children: t?.("row.error", { message: error }) ?? `Pool status unavailable: ${error}`
|
|
16600
16611
|
})] })
|
|
16601
|
-
})
|
|
16612
|
+
})
|
|
16602
16613
|
}) })
|
|
16603
16614
|
});
|
|
16604
16615
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1716,6 +1716,18 @@ export declare class WorkBuddyAccountPool {
|
|
|
1716
1716
|
* Returns true when the token is known good afterwards (refreshed, or still
|
|
1717
1717
|
* valid), false when the credential was proven dead.
|
|
1718
1718
|
*/
|
|
1719
|
+
/**
|
|
1720
|
+
* 取一个账号「可以用来发一次请求」的凭据:过期就先刷新。
|
|
1721
|
+
*
|
|
1722
|
+
* 签到 / 积分这些端点走的是「按 id 直接找账号」的路径,和选号路径不同 ——
|
|
1723
|
+
* 以前它们直接拿池里的 `account.credential`,凭据过期时上游回 401,界面只能
|
|
1724
|
+
* 说「领取失败」,而同一时刻对话却正常(对话走 `getAvailableAccount`,那里会
|
|
1725
|
+
* 先 `ensureFresh`)。用户反馈的「积分领取全部失败」就是这一处。
|
|
1726
|
+
*
|
|
1727
|
+
* 返回 undefined 表示「刷新失败」:调用方应当直接告诉用户重新登录,
|
|
1728
|
+
* 而不是拿旧 token 再去撞一次 401。
|
|
1729
|
+
*/
|
|
1730
|
+
freshCredential(id: string): Promise<WorkBuddyCredential | undefined>;
|
|
1719
1731
|
private ensureFresh;
|
|
1720
1732
|
/**
|
|
1721
1733
|
* Cool a whole account after the upstream reports its credits are spent.
|
|
@@ -2148,7 +2160,7 @@ interface PoolWebRelayStatus {
|
|
|
2148
2160
|
stats?: {
|
|
2149
2161
|
requests: number;
|
|
2150
2162
|
failed: number;
|
|
2151
|
-
avgLatencyMs?: number;
|
|
2163
|
+
avgLatencyMs?: number | undefined;
|
|
2152
2164
|
inputTokens: number;
|
|
2153
2165
|
outputTokens: number;
|
|
2154
2166
|
} | undefined;
|