dsh-connect-workbuddy 5.21.4 → 5.22.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/CHANGELOG.md +67 -0
- package/README.en.md +4 -2
- package/README.md +3 -3
- package/lib/bin.js +1 -1
- package/lib/client.js +417 -80
- package/lib/{host-heartbeat-Dq3ITRhF.js → host-heartbeat-CYnq7iGq.js} +76 -2
- package/lib/index.d.ts +59 -14
- package/lib/index.js +353 -112
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -329,6 +329,7 @@ window.__ModuleLoader__.load({
|
|
|
329
329
|
"enabledModelIds",
|
|
330
330
|
"imageModelIds",
|
|
331
331
|
"imageToolEnabled",
|
|
332
|
+
"preferredImageModel",
|
|
332
333
|
"offModelIds",
|
|
333
334
|
"contextBudgets",
|
|
334
335
|
"defaultThinkingEfforts",
|
|
@@ -379,6 +380,7 @@ window.__ModuleLoader__.load({
|
|
|
379
380
|
if (slot["enabled"] === false) weight += 1;
|
|
380
381
|
if (slot["showCreditsInMainUi"] === false) weight += 1;
|
|
381
382
|
if (slot["imageToolEnabled"] === true) weight += 1;
|
|
383
|
+
if (typeof slot["preferredImageModel"] === "string" && slot["preferredImageModel"] !== "") weight += 1;
|
|
382
384
|
return weight;
|
|
383
385
|
}
|
|
384
386
|
/**
|
|
@@ -580,6 +582,38 @@ window.__ModuleLoader__.load({
|
|
|
580
582
|
return out;
|
|
581
583
|
}
|
|
582
584
|
/**
|
|
585
|
+
* The text-to-image model this region generates with (issue #241), or `''`.
|
|
586
|
+
*
|
|
587
|
+
* Empty means "no choice" — the tool then takes the catalog's first model for the
|
|
588
|
+
* tag, which is the exact behaviour a config written before this field existed
|
|
589
|
+
* had. Deliberately NOT defaulted to the watermark-free model here: that model
|
|
590
|
+
* costs roughly twice as much per image and caps the size at ~1 MP, so choosing
|
|
591
|
+
* it is a spending decision the user makes in the card, not one a schema
|
|
592
|
+
* default can make on their behalf.
|
|
593
|
+
*
|
|
594
|
+
* A stale id is tolerated the same way `regionPreferredVideoModelsOf` tolerates
|
|
595
|
+
* one: the catalog can change, and the tool falls back to the group's first
|
|
596
|
+
* model rather than failing a generation over a remembered choice.
|
|
597
|
+
*/
|
|
598
|
+
function regionPreferredImageModelOf(value, region) {
|
|
599
|
+
const raw = regionSlotOf(value, region)["preferredImageModel"];
|
|
600
|
+
return typeof raw === "string" ? raw : "";
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Build the next `regions` settings value for this region's image model choice.
|
|
604
|
+
*
|
|
605
|
+
* `modelId` of `undefined` or `''` CLEARS the choice, which is why this is a
|
|
606
|
+
* three-state write rather than a boolean: the card's picker has a "follow the
|
|
607
|
+
* catalog" row, and an empty string is what makes that row mean "no opinion"
|
|
608
|
+
* again.
|
|
609
|
+
*/
|
|
610
|
+
function nextRegionPreferredImageModel(value, region, modelId) {
|
|
611
|
+
return nextRegionSlots(regionsMapOf(value), region, {
|
|
612
|
+
...regionSlotOf(value, region),
|
|
613
|
+
preferredImageModel: modelId === void 0 ? "" : modelId
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
583
617
|
* Build the next `regions` settings value for one pinned video model.
|
|
584
618
|
*
|
|
585
619
|
* `modelId` of `undefined` or `''` CLEARS that tag's pin, which is why this is
|
|
@@ -1499,6 +1533,22 @@ window.__ModuleLoader__.load({
|
|
|
1499
1533
|
return modelId === void 0 || modelId === "" ? current === void 0 || current === "" : current === modelId;
|
|
1500
1534
|
});
|
|
1501
1535
|
}
|
|
1536
|
+
/**
|
|
1537
|
+
* Set (or clear) this region's text-to-image model choice, verifying it landed.
|
|
1538
|
+
*
|
|
1539
|
+
* `modelId` of `undefined` / `''` clears it back to "follow the catalog". The
|
|
1540
|
+
* landed check matters here for the same reason as the video pin: a picker that
|
|
1541
|
+
* silently reverted would leave the user believing their images come out
|
|
1542
|
+
* watermark-free when the tool is still using the watermarked model.
|
|
1543
|
+
*/
|
|
1544
|
+
async function writeRegionPreferredImageModel(scope, region, modelId, slot) {
|
|
1545
|
+
await writeField(scope, "regions", region, slot, (readBack) => {
|
|
1546
|
+
const stored = readBack;
|
|
1547
|
+
if (stored === null || stored === void 0) return false;
|
|
1548
|
+
const current = stored["preferredImageModel"];
|
|
1549
|
+
return modelId === void 0 || modelId === "" ? current === void 0 || current === "" : current === modelId;
|
|
1550
|
+
});
|
|
1551
|
+
}
|
|
1502
1552
|
async function writeRegionCreditsShown(scope, region, shown, slot) {
|
|
1503
1553
|
await writeField(scope, "regions", region, slot, (readBack) => {
|
|
1504
1554
|
const stored = readBack;
|
|
@@ -1704,6 +1754,21 @@ window.__ModuleLoader__.load({
|
|
|
1704
1754
|
};
|
|
1705
1755
|
}
|
|
1706
1756
|
//#endregion
|
|
1757
|
+
//#region src/image-gen.ts
|
|
1758
|
+
/**
|
|
1759
|
+
* 无水印模型:`hunyuan-image-v3.0`(issue #241)。
|
|
1760
|
+
*
|
|
1761
|
+
* 2026-11-12 实测:同一个提示词、同一个账号,`hunyuan-image-alpha` 的产物右下角
|
|
1762
|
+
* 固定带「AI生成 WORKBUDD>」水印,而 `hunyuan-image-v3.0` **完全没有**——它不是
|
|
1763
|
+
* 参数开关,是产物落盘路径的差别:带水印的产物落在 COS 的 `aigc-processed/`
|
|
1764
|
+
* 前缀下,v3.0 的不落。所以「关水印」这件事在上游只有一个等价做法:换模型。
|
|
1765
|
+
*
|
|
1766
|
+
* 代价如实体现在两处:单价 6 → 11.1 积分/张,尺寸上限降到
|
|
1767
|
+
* {@link IMAGE_SIZE_LIMITS_V3}。因此它是**用户选的**,不是默认——
|
|
1768
|
+
* 见 `preferredImageModels`。
|
|
1769
|
+
*/
|
|
1770
|
+
const IMAGE_MODEL_NO_WATERMARK = "hunyuan-image-v3.0";
|
|
1771
|
+
//#endregion
|
|
1707
1772
|
//#region src/client/panel-switch.ts
|
|
1708
1773
|
/**
|
|
1709
1774
|
* Whether the OPTIONAL sidebar panel is switched on, as the browser half sees
|
|
@@ -1934,7 +1999,7 @@ window.__ModuleLoader__.load({
|
|
|
1934
1999
|
case "failed": return retryDue(probe, nowMs) ? void 0 : "failed";
|
|
1935
2000
|
case "rate-limited": return retryDue(probe, nowMs) ? void 0 : "rate-limited";
|
|
1936
2001
|
case "model-busy": return retryDue(probe, nowMs, 12e4) ? void 0 : "model-busy";
|
|
1937
|
-
case "out-of-credit": return
|
|
2002
|
+
case "out-of-credit": return "out-of-credit";
|
|
1938
2003
|
case "policy-rejected": return;
|
|
1939
2004
|
case "channel-rejected": return;
|
|
1940
2005
|
default: return "unusable";
|
|
@@ -1943,11 +2008,10 @@ window.__ModuleLoader__.load({
|
|
|
1943
2008
|
/**
|
|
1944
2009
|
* Whether an account's cooldown has elapsed (or was never stated).
|
|
1945
2010
|
*
|
|
1946
|
-
*
|
|
1947
|
-
*
|
|
1948
|
-
*
|
|
1949
|
-
*
|
|
1950
|
-
* an event that said nothing about the account.
|
|
2011
|
+
* Transient failures without a stated retry time use the local short window.
|
|
2012
|
+
* Credit exhaustion is cleared by later positive balance evidence or an explicit
|
|
2013
|
+
* successful pool test; ordinary chat success does not update the probe store.
|
|
2014
|
+
* It does not call this helper.
|
|
1951
2015
|
*
|
|
1952
2016
|
* `fallbackMs` lets one outcome carry a SHORTER clock than the generic one: the
|
|
1953
2017
|
* model-scoped throttle is upstream's own "about a minute", and applying the
|
|
@@ -2062,6 +2126,12 @@ window.__ModuleLoader__.load({
|
|
|
2062
2126
|
}
|
|
2063
2127
|
//#endregion
|
|
2064
2128
|
//#region src/client/account-state.ts
|
|
2129
|
+
/** 积分补充需要实际到账;月度刷新时间不能代表账号必须等待的期限。 */
|
|
2130
|
+
function creditRecoveryLine(t, account) {
|
|
2131
|
+
if (account.probe?.outcome !== "out-of-credit" && account.excludedBy !== "out-of-credit") return void 0;
|
|
2132
|
+
const action = account.checkinSupported === true && account.enterprise !== true ? account.checkedInToday === true ? "row.creditCheckinTomorrow" : account.checkedInToday === false ? "row.creditCheckinRetry" : "row.creditAwaitReplenishment" : "row.creditAwaitReplenishment";
|
|
2133
|
+
return `${t("row.poolExcludedOutOfCredit")} · ${t(action)}`;
|
|
2134
|
+
}
|
|
2065
2135
|
/** Whether a probe outcome means the model answered. */
|
|
2066
2136
|
function outcomeOk(outcome) {
|
|
2067
2137
|
return outcome === "ok";
|
|
@@ -2148,6 +2218,8 @@ window.__ModuleLoader__.load({
|
|
|
2148
2218
|
* would imply waiting helps, when the only fix is signing in again.
|
|
2149
2219
|
*/
|
|
2150
2220
|
function availabilityLine(t, account, nowMs = Date.now()) {
|
|
2221
|
+
const creditLine = creditRecoveryLine(t, account);
|
|
2222
|
+
if (creditLine !== void 0) return creditLine;
|
|
2151
2223
|
const probe = account.probe;
|
|
2152
2224
|
if (probe !== void 0) {
|
|
2153
2225
|
if (probe.outcome === "ok") return outcomeText(t, probe.outcome);
|
|
@@ -2178,6 +2250,8 @@ window.__ModuleLoader__.load({
|
|
|
2178
2250
|
* to lose the wait.
|
|
2179
2251
|
*/
|
|
2180
2252
|
function availabilityMark(t, account, nowMs = Date.now()) {
|
|
2253
|
+
const creditLine = creditRecoveryLine(t, account);
|
|
2254
|
+
if (creditLine !== void 0) return creditLine;
|
|
2181
2255
|
const probe = account.probe;
|
|
2182
2256
|
if (probe !== void 0) {
|
|
2183
2257
|
if (probe.outcome === "ok") return outcomeMarkText(t, probe.outcome);
|
|
@@ -2851,9 +2925,15 @@ window.__ModuleLoader__.load({
|
|
|
2851
2925
|
/**
|
|
2852
2926
|
* Outcomes whose label + stated recovery time ARE the whole story.
|
|
2853
2927
|
*
|
|
2854
|
-
* `rate-limited`
|
|
2855
|
-
*
|
|
2856
|
-
*
|
|
2928
|
+
* `rate-limited` carries a reset instant, which the row prints right beside it;
|
|
2929
|
+
* its body restates that instant and adds a `code`/`requestId` pair nobody
|
|
2930
|
+
* reads.
|
|
2931
|
+
*
|
|
2932
|
+
* `out-of-credit` is here for a DIFFERENT reason than it once was. It no longer
|
|
2933
|
+
* prints an instant at all — the row states what replenishes the balance
|
|
2934
|
+
* (check-in / top-up) instead — and the recorded body's `msg` for the `14018`
|
|
2935
|
+
* family is the same quota envelope, which adds no evidence the label did not
|
|
2936
|
+
* already use. Printing it would bury the one actionable sentence under JSON.
|
|
2857
2937
|
*
|
|
2858
2938
|
* `model-busy` belongs here for the opposite reason: its label states the whole
|
|
2859
2939
|
* finding INCLUDING the remedy ("this model is loaded right now · not your
|
|
@@ -3833,6 +3913,37 @@ window.__ModuleLoader__.load({
|
|
|
3833
3913
|
memberAccountIds: next ? (pool?.accounts ?? []).map((account) => account.accountId) : []
|
|
3834
3914
|
}));
|
|
3835
3915
|
}, [editDraft, pool]);
|
|
3916
|
+
/**
|
|
3917
|
+
* Hand the order back to the credit policy (issue #240).
|
|
3918
|
+
*
|
|
3919
|
+
* WHY THIS MUST EXIST. Once any member is listed in `orderAccountIds`, the
|
|
3920
|
+
* ranking puts the manual order ahead of every credit key, and nothing else
|
|
3921
|
+
* ever clears that list — there was no control that did, so a single stray
|
|
3922
|
+
* click on ↑ pinned the pool to that order forever. The reporter's complaint
|
|
3923
|
+
* ("I can only fix it by hand-sorting") is that state: they wanted the
|
|
3924
|
+
* automatic policy back and the card offered no way to ask for it.
|
|
3925
|
+
*
|
|
3926
|
+
* `[]` rather than deleting the field: the Host treats an empty list and an
|
|
3927
|
+
* absent one identically (`rankPool` reads it as "not listed = sorted last",
|
|
3928
|
+
* and the credit keys then decide everything), and an explicit empty array
|
|
3929
|
+
* round-trips through the settings schema without relying on how a missing
|
|
3930
|
+
* key is merged. Membership is untouched — this clears the ORDER only, which
|
|
3931
|
+
* is the same separation the two fields exist to keep.
|
|
3932
|
+
*/
|
|
3933
|
+
const setSortManual = (0, react.useCallback)((manual) => {
|
|
3934
|
+
editDraft((current) => {
|
|
3935
|
+
const here = current.memberAccountIds.filter((id) => (pool?.accounts ?? []).some((account) => account.accountId === id));
|
|
3936
|
+
if (!manual) return current.orderAccountIds.some((id) => here.includes(id)) ? {
|
|
3937
|
+
...current,
|
|
3938
|
+
orderAccountIds: []
|
|
3939
|
+
} : current;
|
|
3940
|
+
const visible = [...current.orderAccountIds.filter((id) => here.includes(id)), ...here.filter((id) => !current.orderAccountIds.includes(id))];
|
|
3941
|
+
return {
|
|
3942
|
+
...current,
|
|
3943
|
+
orderAccountIds: sameOrder(visible, current.orderAccountIds) ? current.orderAccountIds : visible
|
|
3944
|
+
};
|
|
3945
|
+
});
|
|
3946
|
+
}, [editDraft, pool]);
|
|
3836
3947
|
/** Run one batch action against the Host. */
|
|
3837
3948
|
const runAction = (0, react.useCallback)(async (action) => {
|
|
3838
3949
|
setBusy(action);
|
|
@@ -4312,20 +4423,57 @@ window.__ModuleLoader__.load({
|
|
|
4312
4423
|
}, `${t("row.poolModelWideBusy")} ${t("row.poolModelWideBusyHint")}`) : (0, react.createElement)("p", {
|
|
4313
4424
|
className: "dsm-workbuddy-pool-warn",
|
|
4314
4425
|
role: "status"
|
|
4315
|
-
}, `${t("row.poolNoCandidate")} ${t("row.poolNoCandidateHint")}`) : null, (0, react.createElement)("div", { className: "dsm-workbuddy-pool-members" }, (0, react.createElement)("div", { className: "dsm-workbuddy-pool-members-head" }, (0, react.createElement)("div", null, (0, react.createElement)("h4", { className: "dsm-workbuddy-pool-members-title" }, t("row.poolMembersTitle")), (0, react.createElement)("p", { className: "dsm-workbuddy-pool-note" }, t("row.poolMembersHint"))), (0, react.createElement)(
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4426
|
+
}, `${t("row.poolNoCandidate")} ${t("row.poolNoCandidateHint")}`) : null, (0, react.createElement)("div", { className: "dsm-workbuddy-pool-members" }, (0, react.createElement)("div", { className: "dsm-workbuddy-pool-members-head" }, (0, react.createElement)("div", null, (0, react.createElement)("h4", { className: "dsm-workbuddy-pool-members-title" }, t("row.poolMembersTitle")), (0, react.createElement)("p", { className: "dsm-workbuddy-pool-note" }, t("row.poolMembersHint"))), (0, react.createElement)(
|
|
4427
|
+
"div",
|
|
4428
|
+
{ className: "dsm-workbuddy-pool-members-actions" },
|
|
4429
|
+
(0, react.createElement)("span", { className: "dsm-workbuddy-pool-hint" }, t("row.poolSelectedCount", {
|
|
4430
|
+
count: effectiveMembers.length,
|
|
4431
|
+
total: pool.accounts.length
|
|
4432
|
+
})),
|
|
4433
|
+
(0, react.createElement)("button", {
|
|
4434
|
+
type: "button",
|
|
4435
|
+
className: "dsm-btn dsm-btn-outline dsm-workbuddy-pool-small-btn",
|
|
4436
|
+
disabled: pool.accounts.length === 0 || !canEditPool,
|
|
4437
|
+
onClick: () => selectAll(true)
|
|
4438
|
+
}, t("row.poolSelectAll")),
|
|
4439
|
+
(0, react.createElement)("button", {
|
|
4440
|
+
type: "button",
|
|
4441
|
+
className: "dsm-btn dsm-btn-outline dsm-workbuddy-pool-small-btn",
|
|
4442
|
+
disabled: effectiveMembers.length === 0 || !canEditPool,
|
|
4443
|
+
onClick: () => selectAll(false)
|
|
4444
|
+
}, t("row.poolSelectNone")),
|
|
4445
|
+
/**
|
|
4446
|
+
* HOW THIS POOL ORDERS ITS ACCOUNTS — a two-state switch (issue #240).
|
|
4447
|
+
*
|
|
4448
|
+
* Both states are always rendered, with the active one pressed, because
|
|
4449
|
+
* the pair IS the explanation: "自动排序 / 手动排序" told the user which
|
|
4450
|
+
* mode they were in only after they had already guessed. A single
|
|
4451
|
+
* "reset" button (the first attempt at this) said nothing at all in the
|
|
4452
|
+
* automatic state — it simply vanished, so the card never stated which
|
|
4453
|
+
* of the two policies was in force.
|
|
4454
|
+
*
|
|
4455
|
+
* Choosing 自动排序 clears the manual order; choosing 手动排序 keeps the
|
|
4456
|
+
* order currently on screen and marks the draft manually ordered. That
|
|
4457
|
+
* is why "manual" needs no separate list to seed: the rows the user is
|
|
4458
|
+
* looking at ARE the order they are choosing, and `orderIds` already
|
|
4459
|
+
* derives it from the visible sequence.
|
|
4460
|
+
*/
|
|
4461
|
+
(0, react.createElement)("span", {
|
|
4462
|
+
className: "dsm-workbuddy-pool-sortseg",
|
|
4463
|
+
role: "group",
|
|
4464
|
+
"aria-label": t("row.poolSortModeTitle")
|
|
4465
|
+
}, ...[false, true].map((manual) => (0, react.createElement)("button", {
|
|
4466
|
+
key: manual ? "manual" : "auto",
|
|
4467
|
+
type: "button",
|
|
4468
|
+
className: `dsm-workbuddy-pool-sortseg-btn${orderIsManual === manual ? " dsm-workbuddy-pool-sortseg-on" : ""}`,
|
|
4469
|
+
"aria-pressed": orderIsManual === manual,
|
|
4470
|
+
disabled: !canEditPool || manual && effectiveMembers.length === 0,
|
|
4471
|
+
title: manual ? t("row.poolSortManualTitle") : t("row.poolSortAutoTitle"),
|
|
4472
|
+
onClick: () => {
|
|
4473
|
+
setSortManual(manual);
|
|
4474
|
+
}
|
|
4475
|
+
}, manual ? t("row.poolSortManual") : t("row.poolSortAuto"))))
|
|
4476
|
+
)), (0, react.createElement)("div", { className: "dsm-workbuddy-pool-actions" }, (0, react.createElement)("div", { className: "dsm-workbuddy-pool-actions-group" }, pool.checkinSupported ? (0, react.createElement)("button", {
|
|
4329
4477
|
type: "button",
|
|
4330
4478
|
className: "dsm-btn dsm-btn-primary",
|
|
4331
4479
|
disabled: busy !== void 0 || effectiveMembers.length === 0,
|
|
@@ -4410,7 +4558,7 @@ window.__ModuleLoader__.load({
|
|
|
4410
4558
|
},
|
|
4411
4559
|
orderIndex: isMember && orderIsManual ? left + 1 : void 0,
|
|
4412
4560
|
orderIsManual,
|
|
4413
|
-
moveEnabled: active.enabled && isMember && canEditPool,
|
|
4561
|
+
moveEnabled: active.enabled && isMember && canEditPool && orderIsManual,
|
|
4414
4562
|
onMoveUp: () => {
|
|
4415
4563
|
moveMember(account.accountId, -1);
|
|
4416
4564
|
},
|
|
@@ -4526,8 +4674,12 @@ window.__ModuleLoader__.load({
|
|
|
4526
4674
|
* falls back to exactly this text.
|
|
4527
4675
|
*/
|
|
4528
4676
|
const excludedRepeatsVerdict = excluded === void 0 || probe === void 0 || probe.outcome === account.excludedBy;
|
|
4529
|
-
const
|
|
4530
|
-
|
|
4677
|
+
const availability = {
|
|
4678
|
+
...account,
|
|
4679
|
+
checkinSupported
|
|
4680
|
+
};
|
|
4681
|
+
const measuredButSilent = probe !== void 0 && availabilityLine(t, availability) === void 0;
|
|
4682
|
+
const outcomeLine = availabilityLine(t, availability) ?? (probe === void 0 ? t("row.poolNeverTested") : void 0);
|
|
4531
4683
|
const reason = probe === void 0 ? void 0 : inlineProbeReason(probe.outcome, probe.message);
|
|
4532
4684
|
const age = probe === void 0 ? void 0 : probeAgeText(t, probe.atMs, Date.now());
|
|
4533
4685
|
const probeLabel = probe === void 0 ? void 0 : probe.source === void 0 ? {
|
|
@@ -7184,6 +7336,8 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
7184
7336
|
tag chip and the select sit on one baseline, like a roster row does. */
|
|
7185
7337
|
.dsm-workbuddy-video-model-select{font:inherit;font-size:12px;color:var(--dsw-alias-label-secondary,#b8bcc4);background:var(--dsw-alias-bg-l1,transparent);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;padding:1px 6px;max-width:100%;min-width:0}
|
|
7186
7338
|
.dsm-workbuddy-video-model-select:disabled{opacity:.6}
|
|
7339
|
+
.dsm-workbuddy-image-model-select{font:inherit;font-size:12px;color:var(--dsw-alias-label-secondary,#b8bcc4);background:var(--dsw-alias-bg-l1,transparent);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;padding:1px 6px;max-width:100%;min-width:0}
|
|
7340
|
+
.dsm-workbuddy-image-model-select:disabled{opacity:.6}
|
|
7187
7341
|
.dsm-workbuddy-media-empty,.dsm-workbuddy-media-error{font-size:12px;line-height:17px}
|
|
7188
7342
|
.dsm-workbuddy-media-empty{color:var(--dsw-alias-label-tertiary,#8b8f98)}
|
|
7189
7343
|
.dsm-workbuddy-media-error{color:var(--dsw-alias-label-error,#e5675f)}
|
|
@@ -7992,6 +8146,19 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
7992
8146
|
.dsm-workbuddy-pool-members-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:wrap}
|
|
7993
8147
|
.dsm-workbuddy-pool-members-title{margin:0 0 3px;font-size:13px;font-weight:600;color:var(--dsw-alias-label-primary,#e6e6e6)}
|
|
7994
8148
|
.dsm-workbuddy-pool-members-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
|
|
8149
|
+
/* 选号顺序的两态切换(issue #240)。两个按钮常驻、共享一条边框,当前态用
|
|
8150
|
+
aria-pressed 加底色表达——和一个「重置」按钮的差别在于:自动态下那个按钮会
|
|
8151
|
+
直接消失,于是卡片从不说自己正处于哪种规则;常驻的两格把这句话永远说出来。 */
|
|
8152
|
+
.dsm-workbuddy-pool-sortseg{display:inline-flex;border:1px solid var(--dsw-alias-border-l2,#3a3d45);border-radius:999px;overflow:hidden}
|
|
8153
|
+
.dsm-workbuddy-pool-sortseg-btn{appearance:none;border:0;background:transparent;cursor:pointer;padding:3px 10px;font:inherit;font-size:12px;line-height:16px;color:var(--dsw-alias-label-secondary,#b8bcc4)}
|
|
8154
|
+
/* 悬停排除选中项:否则鼠标划过时选中格会被换成半透明底,看着像「选中被取消」。 */
|
|
8155
|
+
.dsm-workbuddy-pool-sortseg-btn:hover:not(:disabled):not(.dsm-workbuddy-pool-sortseg-on){background:var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.12))}
|
|
8156
|
+
.dsm-workbuddy-pool-sortseg-btn:disabled{opacity:.55;cursor:default}
|
|
8157
|
+
.dsm-workbuddy-pool-sortseg-btn:focus-visible{outline:2px solid rgba(86,134,254,.55);outline-offset:-2px}
|
|
8158
|
+
/* 选中态用「前景色做底、底色做字」这一对反相变量,理由同 device-seg-on:
|
|
8159
|
+
brand-primary 在暗色主题下本身是浅色,白字落上去整格会消失。 */
|
|
8160
|
+
.dsm-workbuddy-pool-sortseg-on{background:var(--dsw-alias-label-primary,#ededed);color:var(--dsw-alias-bg-base,#181818);font-weight:600}
|
|
8161
|
+
|
|
7995
8162
|
/* The 测试/删除 and 全选/全不选 buttons. Shared with the benefit pill, which
|
|
7996
8163
|
* OVERRIDES both properties at higher specificity (see its rule above): a pill is
|
|
7997
8164
|
* a capsule whose height is fixed at 19px, so inheriting this 3px/10px rhythm
|
|
@@ -9237,22 +9404,30 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
9237
9404
|
* The sentence a probe result gets, and how it should be coloured.
|
|
9238
9405
|
*
|
|
9239
9406
|
* The cooldown wording is the part that had to be got right. The upstream names
|
|
9240
|
-
* a "use again" time in
|
|
9241
|
-
* sentence it writes into its own failure BODY (where this
|
|
9242
|
-
* puts it — its 429s carry no rate-limit header at all)
|
|
9243
|
-
*
|
|
9244
|
-
*
|
|
9245
|
-
*
|
|
9246
|
-
* would
|
|
9247
|
-
*
|
|
9407
|
+
* a "use again" time in two situations that describe a WAIT: a `Retry-After`
|
|
9408
|
+
* header, and the reset sentence it writes into its own failure BODY (where this
|
|
9409
|
+
* service actually puts it — its 429s carry no rate-limit header at all). So a
|
|
9410
|
+
* limited result WITHOUT either must say that plainly. Substituting a locally
|
|
9411
|
+
* invented countdown would be the single most misleading thing this feature
|
|
9412
|
+
* could do: it would look like an upstream answer while being a guess, and the
|
|
9413
|
+
* user would wait for a moment that means nothing.
|
|
9414
|
+
*
|
|
9415
|
+
* `out-of-credit` is deliberately NOT in that list any more. The monthly package
|
|
9416
|
+
* refresh point is a fact about the PACKAGE's cycle, not the earliest moment the
|
|
9417
|
+
* account can serve: check-in and top-ups replenish credits whenever they land.
|
|
9418
|
+
* Rendering it as a countdown told users to wait three weeks for credits that
|
|
9419
|
+
* could arrive today, so this row now borrows the pool's replenishment wording
|
|
9420
|
+
* from `availabilityLine` — one rule for the account row and the model row, so
|
|
9421
|
+
* the two cannot print different stories about the same measurement.
|
|
9248
9422
|
*/
|
|
9249
9423
|
/**
|
|
9250
9424
|
* ` · 约 1 小时后` for a future instant, or `''` when there is none.
|
|
9251
9425
|
*
|
|
9252
|
-
* Kept beside {@link probeResultView} rather than inlined
|
|
9253
|
-
*
|
|
9254
|
-
*
|
|
9255
|
-
* own answer, and the relative form is a convenience
|
|
9426
|
+
* Kept beside {@link probeResultView} rather than inlined so the "append only
|
|
9427
|
+
* when non-empty" rule cannot drift between the two outcomes that still carry a
|
|
9428
|
+
* stated WAIT (rate-limited, model-busy). The absolute instant stays the primary
|
|
9429
|
+
* text: it is the upstream's own answer, and the relative form is a convenience
|
|
9430
|
+
* derived from it.
|
|
9256
9431
|
*/
|
|
9257
9432
|
function retrySuffix(t, untilMs, nowMs) {
|
|
9258
9433
|
if (untilMs === void 0) return "";
|
|
@@ -9308,7 +9483,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
9308
9483
|
tone: "warn"
|
|
9309
9484
|
};
|
|
9310
9485
|
case "out-of-credit": return {
|
|
9311
|
-
text:
|
|
9486
|
+
text: `✗ ${availabilityLine(t, { probe: result }, nowMs)}`,
|
|
9312
9487
|
tone: "bad"
|
|
9313
9488
|
};
|
|
9314
9489
|
case "credential-rejected": return {
|
|
@@ -9518,6 +9693,14 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
9518
9693
|
*/
|
|
9519
9694
|
const [pinningVideoModel, setPinningVideoModel] = (0, react.useState)(void 0);
|
|
9520
9695
|
/**
|
|
9696
|
+
* The image-model picker's in-flight marker (issue #241).
|
|
9697
|
+
*
|
|
9698
|
+
* Separate from {@link pinningVideoModel} for the same reason that one is
|
|
9699
|
+
* separate from {@link togglingCredits}: the two write different fields of the
|
|
9700
|
+
* same region slot, so one pending write must not disable the other control.
|
|
9701
|
+
*/
|
|
9702
|
+
const [pinningImageModel, setPinningImageModel] = (0, react.useState)(false);
|
|
9703
|
+
/**
|
|
9521
9704
|
* The OPTIONAL CodeBuddy CLI route switch (global: one switch, one budget).
|
|
9522
9705
|
*
|
|
9523
9706
|
* `undefined` until the first Host answer arrives, so the box renders the
|
|
@@ -10039,6 +10222,20 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
10039
10222
|
return regionPreferredVideoModelsOf(settingsScope?.getSnapshot().value, item)[tag] ?? "";
|
|
10040
10223
|
};
|
|
10041
10224
|
/**
|
|
10225
|
+
* The text-to-image model this region generates with, or `''` for "follow the
|
|
10226
|
+
* catalog" (issue #241).
|
|
10227
|
+
*
|
|
10228
|
+
* Same read order as {@link preferredVideoModelOf} and for the same measured
|
|
10229
|
+
* reason: the Host's answer first, because this namespace's browser mirror is
|
|
10230
|
+
* stale on the affected deployments, and a picker rendering the mirror alone
|
|
10231
|
+
* would show a watermark-free choice the tool does not honour.
|
|
10232
|
+
*/
|
|
10233
|
+
const preferredImageModelOf = (item) => {
|
|
10234
|
+
const usage = statusByRegion[item];
|
|
10235
|
+
if (typeof usage?.preferredImageModel === "string") return usage.preferredImageModel;
|
|
10236
|
+
return regionPreferredImageModelOf(settingsScope?.getSnapshot().value, item);
|
|
10237
|
+
};
|
|
10238
|
+
/**
|
|
10042
10239
|
* Switch one region's provider off or on. The write carries the region's
|
|
10043
10240
|
* whole slot through untouched — only `enabled` changes — so the user's
|
|
10044
10241
|
* directory, model picks, image opt-ins and budgets survive a round trip.
|
|
@@ -10452,6 +10649,28 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
10452
10649
|
}
|
|
10453
10650
|
};
|
|
10454
10651
|
/**
|
|
10652
|
+
* Pick (or clear) this region's text-to-image model (issue #241).
|
|
10653
|
+
*
|
|
10654
|
+
* `undefined` means "follow the catalog": the tool then takes the group's
|
|
10655
|
+
* first model, which is the watermarked-but-cheaper one. Both directions go
|
|
10656
|
+
* through the same landed-checked write as the video pin and then re-read the
|
|
10657
|
+
* Host — a choice that reverted silently would leave the user believing their
|
|
10658
|
+
* images come out watermark-free when the tool still uses the other model.
|
|
10659
|
+
*/
|
|
10660
|
+
const pinImageModel = async (item, modelId) => {
|
|
10661
|
+
if (settingsScope === void 0) return;
|
|
10662
|
+
setPinningImageModel(true);
|
|
10663
|
+
try {
|
|
10664
|
+
const slot = nextRegionPreferredImageModel(settingsScope.getSnapshot().value, item, modelId)[item];
|
|
10665
|
+
await writeRegionPreferredImageModel(settingsScope, item, modelId, typeof slot === "object" && slot !== null ? slot : {});
|
|
10666
|
+
await refreshUsage(item);
|
|
10667
|
+
} catch (error) {
|
|
10668
|
+
if (mounted.current) setAccountError(error instanceof Error ? error.message : t("row.requestFailed"));
|
|
10669
|
+
} finally {
|
|
10670
|
+
if (mounted.current) setPinningImageModel(false);
|
|
10671
|
+
}
|
|
10672
|
+
};
|
|
10673
|
+
/**
|
|
10455
10674
|
* Read the active region's media roster. Read-only and free (the same GET the
|
|
10456
10675
|
* image tool performs), so it is safe to run whenever the capability panel is
|
|
10457
10676
|
* shown; `refresh` bypasses the Host's 5-minute cache for the explicit
|
|
@@ -11178,6 +11397,68 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
11178
11397
|
]
|
|
11179
11398
|
})
|
|
11180
11399
|
});
|
|
11400
|
+
/**
|
|
11401
|
+
* The image-model picker (issue #241).
|
|
11402
|
+
*
|
|
11403
|
+
* Only on the CN tab, and only once the image tool is authorized there: the
|
|
11404
|
+
* watermark-free model has no route on the international gateway (measured
|
|
11405
|
+
* 2026-11-12: `hunyuan-image-v3.0` → 400 / 14401 route config not found), so
|
|
11406
|
+
* offering it there would be a button that can only fail. Showing the picker
|
|
11407
|
+
* where the tool cannot be called at all would invite a decision that changes
|
|
11408
|
+
* nothing, same rule as `videoModelPreference`.
|
|
11409
|
+
*
|
|
11410
|
+
* The watermark-free entry is NOT in this region's catalog — it is the
|
|
11411
|
+
* official CLI's own hard-coded fallback — so it is appended here rather than
|
|
11412
|
+
* read from `activeMedia`. Everything about the cost lives in the hint: a user
|
|
11413
|
+
* who only wants "no watermark" must not have to discover the price tag after
|
|
11414
|
+
* spending 11.1 credits.
|
|
11415
|
+
*/
|
|
11416
|
+
const imageModelPreference = activeRegion !== "cn" || !(activeRegionOn && imageToolOn(activeRegion)) || activeMedia === void 0 ? null : (() => {
|
|
11417
|
+
const picked = preferredImageModelOf(activeRegion);
|
|
11418
|
+
const options = [...activeMedia.filter((model) => model.tags.includes("text-to-image")).map((model) => ({
|
|
11419
|
+
id: model.id,
|
|
11420
|
+
name: model.name
|
|
11421
|
+
})), ...activeMedia.some((model) => model.id === "hunyuan-image-v3.0") ? [] : [{
|
|
11422
|
+
id: IMAGE_MODEL_NO_WATERMARK,
|
|
11423
|
+
name: t("row.imageModelWatermarkFree")
|
|
11424
|
+
}]];
|
|
11425
|
+
if (options.length < 2) return null;
|
|
11426
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11427
|
+
className: "dsm-workbuddy-pref dsm-workbuddy-media",
|
|
11428
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
11429
|
+
className: "dsm-workbuddy-pref-copy",
|
|
11430
|
+
children: [
|
|
11431
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11432
|
+
className: "dsm-workbuddy-pref-label",
|
|
11433
|
+
children: t("row.imageModelLabel")
|
|
11434
|
+
}),
|
|
11435
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11436
|
+
className: "dsm-workbuddy-pref-hint",
|
|
11437
|
+
children: t("row.imageModelHint")
|
|
11438
|
+
}),
|
|
11439
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
11440
|
+
className: "dsm-workbuddy-media-row",
|
|
11441
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
11442
|
+
className: "dsm-workbuddy-image-model-select",
|
|
11443
|
+
value: options.some((option) => option.id === picked) ? picked : "",
|
|
11444
|
+
disabled: !canWrite || saving || poolBusy || pinningImageModel,
|
|
11445
|
+
onChange: (event) => {
|
|
11446
|
+
const next = event.target.value;
|
|
11447
|
+
pinImageModel(activeRegion, next === "" ? void 0 : next);
|
|
11448
|
+
},
|
|
11449
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
11450
|
+
value: "",
|
|
11451
|
+
children: t("row.imageModelDefault")
|
|
11452
|
+
}), options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
11453
|
+
value: option.id,
|
|
11454
|
+
children: option.name
|
|
11455
|
+
}, option.id))]
|
|
11456
|
+
})
|
|
11457
|
+
})
|
|
11458
|
+
]
|
|
11459
|
+
})
|
|
11460
|
+
});
|
|
11461
|
+
})();
|
|
11181
11462
|
const mediaModelsPreference = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11182
11463
|
className: "dsm-workbuddy-pref dsm-workbuddy-media",
|
|
11183
11464
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
@@ -11795,6 +12076,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
11795
12076
|
cliBridgeSwitchedOn() ? cliBridgePickers : null,
|
|
11796
12077
|
imageToolPreference,
|
|
11797
12078
|
videoToolPreference,
|
|
12079
|
+
imageModelPreference,
|
|
11798
12080
|
videoModelPreference,
|
|
11799
12081
|
mediaModelsPreference,
|
|
11800
12082
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
@@ -13014,6 +13296,8 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
13014
13296
|
if (t === void 0) throw new Error("Composer credits readout requires its translation function");
|
|
13015
13297
|
const owned = provider === void 0 ? void 0 : WORKBUDDY_COMPOSER_PROVIDERS[provider];
|
|
13016
13298
|
const activeRegion = region ?? owned;
|
|
13299
|
+
const activeRegionRef = (0, react.useRef)(activeRegion);
|
|
13300
|
+
activeRegionRef.current = activeRegion;
|
|
13017
13301
|
const [usage, setUsage] = (0, react.useState)(void 0);
|
|
13018
13302
|
/**
|
|
13019
13303
|
* The refresh cadence, taken from the SAME document the card polls.
|
|
@@ -13055,7 +13339,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
13055
13339
|
const [settingsFailed, setSettingsFailed] = (0, react.useState)(false);
|
|
13056
13340
|
const [lastRefresh, setLastRefresh] = (0, react.useState)(void 0);
|
|
13057
13341
|
const [open, setOpen] = (0, react.useState)(false);
|
|
13058
|
-
const inFlight = (0, react.useRef)(
|
|
13342
|
+
const inFlight = (0, react.useRef)(void 0);
|
|
13059
13343
|
/** A batch is running; guards a second press that lands before `setTesting`. */
|
|
13060
13344
|
const testingRef = (0, react.useRef)(false);
|
|
13061
13345
|
/** Account-table reads in flight; see `fetchAccountCredits`. */
|
|
@@ -13110,25 +13394,40 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
13110
13394
|
margin: 12
|
|
13111
13395
|
});
|
|
13112
13396
|
useDismissOnOutsidePointer(rootRef, open, setOpen, panelRef);
|
|
13113
|
-
const fetchUsage = (0, react.useCallback)(async (signal) => {
|
|
13114
|
-
if (
|
|
13115
|
-
inFlight.current
|
|
13397
|
+
const fetchUsage = (0, react.useCallback)(async (signal, force = false) => {
|
|
13398
|
+
if (activeRegion === void 0 || signal?.aborted || activeRegionRef.current !== activeRegion) return;
|
|
13399
|
+
while (inFlight.current !== void 0) {
|
|
13400
|
+
const pending = inFlight.current;
|
|
13401
|
+
await pending.task;
|
|
13402
|
+
if (signal?.aborted || activeRegionRef.current !== activeRegion) return;
|
|
13403
|
+
if (!force && pending.region === activeRegion && pending.signal?.aborted !== true) return;
|
|
13404
|
+
}
|
|
13405
|
+
const task = (async () => {
|
|
13406
|
+
try {
|
|
13407
|
+
const response = await fetch(withWorkBuddyRegion(WORKBUDDY_USAGE_PATH, activeRegion), {
|
|
13408
|
+
headers: { accept: "application/json" },
|
|
13409
|
+
credentials: "same-origin",
|
|
13410
|
+
...signal === void 0 ? {} : { signal }
|
|
13411
|
+
});
|
|
13412
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
13413
|
+
const value = await response.json();
|
|
13414
|
+
if (!mounted.current || signal?.aborted === true || activeRegionRef.current !== activeRegion) return;
|
|
13415
|
+
setUsage(value);
|
|
13416
|
+
setLastRefresh(Date.now());
|
|
13417
|
+
setFailed(false);
|
|
13418
|
+
} catch {
|
|
13419
|
+
if (mounted.current && signal?.aborted !== true && activeRegionRef.current === activeRegion) setFailed(true);
|
|
13420
|
+
}
|
|
13421
|
+
})();
|
|
13422
|
+
inFlight.current = {
|
|
13423
|
+
region: activeRegion,
|
|
13424
|
+
signal,
|
|
13425
|
+
task
|
|
13426
|
+
};
|
|
13116
13427
|
try {
|
|
13117
|
-
|
|
13118
|
-
headers: { accept: "application/json" },
|
|
13119
|
-
credentials: "same-origin",
|
|
13120
|
-
...signal === void 0 ? {} : { signal }
|
|
13121
|
-
});
|
|
13122
|
-
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
13123
|
-
const value = await response.json();
|
|
13124
|
-
if (!mounted.current || signal?.aborted === true) return;
|
|
13125
|
-
setUsage(value);
|
|
13126
|
-
setLastRefresh(Date.now());
|
|
13127
|
-
setFailed(false);
|
|
13128
|
-
} catch {
|
|
13129
|
-
if (mounted.current && signal?.aborted !== true) setFailed(true);
|
|
13428
|
+
await task;
|
|
13130
13429
|
} finally {
|
|
13131
|
-
inFlight.current =
|
|
13430
|
+
inFlight.current = void 0;
|
|
13132
13431
|
}
|
|
13133
13432
|
}, [activeRegion]);
|
|
13134
13433
|
/**
|
|
@@ -13155,8 +13454,8 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
13155
13454
|
* which would silently re-draw a mark the press had just cleared.
|
|
13156
13455
|
*/
|
|
13157
13456
|
const fetchAccountCredits = (0, react.useCallback)(async (signal, force) => {
|
|
13158
|
-
if (activeRegion === void 0) return;
|
|
13159
|
-
if (!force && accountsInFlight.current > 0) return;
|
|
13457
|
+
if (activeRegion === void 0 || signal?.aborted || activeRegionRef.current !== activeRegion) return false;
|
|
13458
|
+
if (!force && accountsInFlight.current > 0) return false;
|
|
13160
13459
|
const generation = ++accountsReadGeneration.current;
|
|
13161
13460
|
accountsInFlight.current += 1;
|
|
13162
13461
|
try {
|
|
@@ -13167,19 +13466,22 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
13167
13466
|
});
|
|
13168
13467
|
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
13169
13468
|
const data = await response.json();
|
|
13170
|
-
if (!mounted.current || signal?.aborted === true) return;
|
|
13171
|
-
if (generation !== accountsReadGeneration.current) return;
|
|
13469
|
+
if (!mounted.current || signal?.aborted === true || activeRegionRef.current !== activeRegion) return false;
|
|
13470
|
+
if (generation !== accountsReadGeneration.current) return false;
|
|
13172
13471
|
if (Array.isArray(data.accounts)) {
|
|
13173
13472
|
setAccountCredits(data.accounts);
|
|
13174
13473
|
setLastRefresh(Date.now());
|
|
13175
13474
|
}
|
|
13176
|
-
|
|
13475
|
+
return true;
|
|
13476
|
+
} catch {
|
|
13477
|
+
return true;
|
|
13478
|
+
} finally {
|
|
13177
13479
|
accountsInFlight.current -= 1;
|
|
13178
13480
|
}
|
|
13179
13481
|
}, [activeRegion]);
|
|
13180
13482
|
const hostHidden = hostCreditsShownOf(usage) === false;
|
|
13181
13483
|
(0, react.useEffect)(() => {
|
|
13182
|
-
if (owned === void 0 || hostHidden) return void 0;
|
|
13484
|
+
if (owned === void 0 || hostHidden || open) return void 0;
|
|
13183
13485
|
let cancelled = false;
|
|
13184
13486
|
let timer;
|
|
13185
13487
|
const controller = new AbortController();
|
|
@@ -13197,6 +13499,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
13197
13499
|
}, [
|
|
13198
13500
|
owned,
|
|
13199
13501
|
hostHidden,
|
|
13502
|
+
open,
|
|
13200
13503
|
fetchUsage
|
|
13201
13504
|
]);
|
|
13202
13505
|
/**
|
|
@@ -13221,10 +13524,20 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
13221
13524
|
let cancelled = false;
|
|
13222
13525
|
let timer;
|
|
13223
13526
|
const controller = new AbortController();
|
|
13224
|
-
|
|
13527
|
+
let refreshing = false;
|
|
13528
|
+
const refreshPanel = async (force = false) => {
|
|
13529
|
+
if (refreshing || cancelled) return;
|
|
13530
|
+
refreshing = true;
|
|
13531
|
+
try {
|
|
13532
|
+
if (await fetchAccountCredits(controller.signal, force) && !cancelled) await fetchUsage(controller.signal);
|
|
13533
|
+
} finally {
|
|
13534
|
+
refreshing = false;
|
|
13535
|
+
}
|
|
13536
|
+
};
|
|
13537
|
+
refreshPanel(true).finally(() => {
|
|
13225
13538
|
if (cancelled) return;
|
|
13226
13539
|
timer = window.setInterval(() => {
|
|
13227
|
-
|
|
13540
|
+
refreshPanel();
|
|
13228
13541
|
}, refreshIntervalMs);
|
|
13229
13542
|
});
|
|
13230
13543
|
return () => {
|
|
@@ -13236,6 +13549,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
13236
13549
|
open,
|
|
13237
13550
|
activeRegion,
|
|
13238
13551
|
fetchAccountCredits,
|
|
13552
|
+
fetchUsage,
|
|
13239
13553
|
refreshIntervalMs
|
|
13240
13554
|
]);
|
|
13241
13555
|
(0, react.useEffect)(() => {
|
|
@@ -13265,7 +13579,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
13265
13579
|
setFailed(false);
|
|
13266
13580
|
try {
|
|
13267
13581
|
await writeAccountSlot(settingsScope, activeRegion, accountId);
|
|
13268
|
-
await fetchUsage();
|
|
13582
|
+
await fetchUsage(void 0, true);
|
|
13269
13583
|
await fetchAccountCredits(void 0, true);
|
|
13270
13584
|
} catch {
|
|
13271
13585
|
if (mounted.current) setFailed(true);
|
|
@@ -13342,7 +13656,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
13342
13656
|
} finally {
|
|
13343
13657
|
testingRef.current = false;
|
|
13344
13658
|
if (mounted.current) setTesting(false);
|
|
13345
|
-
await Promise.all([fetchUsage(), fetchAccountCredits(void 0, true)]);
|
|
13659
|
+
await Promise.all([fetchUsage(void 0, true), fetchAccountCredits(void 0, true)]);
|
|
13346
13660
|
}
|
|
13347
13661
|
}, [
|
|
13348
13662
|
activeRegion,
|
|
@@ -13569,9 +13883,12 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
13569
13883
|
const current = row.id === selectedId;
|
|
13570
13884
|
const poolRow = poolById.get(row.id);
|
|
13571
13885
|
const live = poolRow === void 0 ? current : poolRow.current;
|
|
13572
|
-
const availability =
|
|
13573
|
-
|
|
13574
|
-
|
|
13886
|
+
const availability = {
|
|
13887
|
+
...poolRow ?? {
|
|
13888
|
+
excludedBy: row.excludedBy,
|
|
13889
|
+
probe: void 0
|
|
13890
|
+
},
|
|
13891
|
+
checkinSupported: usage?.status === "signed-in" && usage.pool?.checkinSupported === true
|
|
13575
13892
|
};
|
|
13576
13893
|
const usable = stateTone(availability) === "ok";
|
|
13577
13894
|
const currentMark = live ? t("composer.current") : void 0;
|
|
@@ -14914,8 +15231,6 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
14914
15231
|
"row.probeRateLimitedAt": "✗ Rate limited · usable again after {at}",
|
|
14915
15232
|
"row.probeModelBusyUnknown": "✗ This model is loaded right now · not your account — another account will not help; wait about a minute or switch models",
|
|
14916
15233
|
"row.probeModelBusyAt": "✗ This model is loaded right now · not your account; retry after {at}, or switch models",
|
|
14917
|
-
"row.probeOutOfCreditUnknown": "✗ Not enough credits · the upstream gave no time for when it frees up",
|
|
14918
|
-
"row.probeOutOfCreditAt": "✗ Not enough credits · quota refreshes {at}",
|
|
14919
15234
|
"row.probeCredentialRejected": "✗ WorkBuddy refused this account's token — sign in again or pick another account",
|
|
14920
15235
|
"row.probePolicyRejected": "✗ WorkBuddy's server refused this request under its content policy — re-signing in won't help; try the desktop app or another region/account",
|
|
14921
15236
|
"row.probeChannelRejected": "✗ The gateway refused the PROMPT itself, not this account — the opening of a system message matched its third-party-agent filter, so another account or region answers the same way",
|
|
@@ -14966,7 +15281,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
14966
15281
|
"row.transferNoService": "Could not reach the local plugin service ({size} KiB sent). The file may be too large, or the service may be restarting — try again, and if it keeps failing, trim the file and retry.",
|
|
14967
15282
|
"row.poolTitle": "Account pool",
|
|
14968
15283
|
"row.poolNoCandidate": "No account in this pool can be used right now.",
|
|
14969
|
-
"row.poolNoCandidateHint": "Members are rate-limited, out of credits, rejected, or unreachable. Rate limits
|
|
15284
|
+
"row.poolNoCandidateHint": "Members are rate-limited, out of credits, rejected, or unreachable. Rate limits and transient failures return to the pool on their own — at the time the upstream states, or after a 30-minute fallback. An account out of credits returns once a balance read confirms replenishment (check-in or top-up). Only a rejected credential needs a new sign-in.",
|
|
14970
15285
|
"row.poolModelWideBusy": "Every member is blocked on the same model — this is the model, not your accounts.",
|
|
14971
15286
|
"row.poolModelWideBusyHint": "Switching accounts cannot help: the limit follows the model, so a different account hits the same wall. Wait about a minute, or switch to a less busy model in this session.",
|
|
14972
15287
|
"row.poolCheckinAll": "Check in selected",
|
|
@@ -15011,6 +15326,9 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
15011
15326
|
"row.poolExcludedRateLimited": "Rate limited",
|
|
15012
15327
|
"row.poolExcludedModelBusy": "Model busy",
|
|
15013
15328
|
"row.poolExcludedOutOfCredit": "Out of credits",
|
|
15329
|
+
"row.creditCheckinTomorrow": "Retry after tomorrow’s check-in",
|
|
15330
|
+
"row.creditCheckinRetry": "Retry after check-in",
|
|
15331
|
+
"row.creditAwaitReplenishment": "Awaiting credit replenishment",
|
|
15014
15332
|
"row.poolExcludedRejected": "Rejected",
|
|
15015
15333
|
"row.poolExcludedAccountRestricted": "Account restricted upstream",
|
|
15016
15334
|
"row.poolExcludedUnusable": "Unusable",
|
|
@@ -15083,7 +15401,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
15083
15401
|
"row.poolSelectedCount": "{count} of {total} selected",
|
|
15084
15402
|
"row.poolOrderRulesTitle": "How this pool chooses an account",
|
|
15085
15403
|
"row.poolOrderRulesIntro": "The pool always picks the first account that can actually be billed right now. The rules below are checked in order — the first one that separates two accounts decides; later rules only break ties.",
|
|
15086
|
-
"row.poolOrderRuleUsable": "1. Can it be billed right now? Accounts that are rate-limited,
|
|
15404
|
+
"row.poolOrderRuleUsable": "1. Can it be billed right now? Accounts that are rate-limited, credential-rejected, or failing are moved to the back until their cooldown ends; an account out of credit stays out until a balance read confirms replenishment. This outranks everything, including your own order below.",
|
|
15087
15405
|
"row.poolOrderRuleExpiring": "2. Does it have credits expiring within 3 days? Yes goes first. This also outranks your manual order — see the note below.",
|
|
15088
15406
|
"row.poolOrderRuleManual": "3. Your manual order. The position you set with the ↑ / ↓ arrows. Accounts you never ordered are placed after every ordered one.",
|
|
15089
15407
|
"row.poolOrderRuleNearestExpiry": "4. Which expiry comes first? Between accounts that both have credits expiring, the one losing them sooner goes first.",
|
|
@@ -15110,7 +15428,12 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
15110
15428
|
"row.poolRankLabel": "No. {rank}",
|
|
15111
15429
|
"row.poolRankManualTitle": "You placed this account at position {rank} in the pool manually.",
|
|
15112
15430
|
"row.poolRankAuto": "Auto",
|
|
15113
|
-
"row.poolRankAutoTitle": "
|
|
15431
|
+
"row.poolRankAutoTitle": "Automatic: the pool spends expiring credits first, then picks accounts by remaining balance. To set your own order, switch the control above to Manual.",
|
|
15432
|
+
"row.poolSortModeTitle": "Serving order",
|
|
15433
|
+
"row.poolSortAuto": "Automatic",
|
|
15434
|
+
"row.poolSortAutoTitle": "Hand it to the credit policy: spend expiring credits first, then pick by remaining balance. Switching here clears the manual order; checked members are unaffected.",
|
|
15435
|
+
"row.poolSortManual": "Manual",
|
|
15436
|
+
"row.poolSortManualTitle": "Serve in the order you set, top row first. Switching here keeps the order currently on screen; use ↑/↓ to adjust it.",
|
|
15114
15437
|
"row.poolMoveUpTitle": "Move account up in this pool's order",
|
|
15115
15438
|
"row.poolMoveDownTitle": "Move account down in this pool's order",
|
|
15116
15439
|
"row.poolMoveUpAria": "Move {accountName} up in this pool's order",
|
|
@@ -15257,6 +15580,10 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
15257
15580
|
"row.videoModelLabel": "Video model per mode",
|
|
15258
15581
|
"row.videoModelHint": "Pinned separately for text-to-video and image-to-video, from THIS region's own catalog — a model id does not carry across regions. A call that names no model uses the pin; with nothing pinned the tool takes the first model of that group. A pin the catalog no longer carries quietly falls back to the first model instead of failing.",
|
|
15259
15582
|
"row.videoModelDefault": "Default (first in the group)",
|
|
15583
|
+
"row.imageModelLabel": "Image model (watermark)",
|
|
15584
|
+
"row.imageModelHint": "WorkBuddy always stamps \"AI生成 WORKBUDD>\" on hunyuan-image-alpha output — the upstream has no switch to turn it off (issue #241). The only equivalent is a different model: hunyuan-image-v3.0 produces the same request WITHOUT a watermark, but costs about 11.1 credits per image instead of about 6, and caps output at 2048 px per edge / about 1 MP total (so 1024x1536 scales down to 836x1254, same ratio). Leave it on \"default\" to keep the cheaper, watermarked model with the full size range. CN gateway only.",
|
|
15585
|
+
"row.imageModelDefault": "Default (first in the group, watermarked)",
|
|
15586
|
+
"row.imageModelWatermarkFree": "Hunyuan Image v3.0 (no watermark — ~11.1 credits/image, smaller size limit)",
|
|
15260
15587
|
"row.mediaModelsLabel": "Image models in this region",
|
|
15261
15588
|
"row.mediaModelsHint": "Read from this account's product configuration. The draw tools pick their models from here: a prompt without an image uses a text-to-image model, one WITH an image uses an image-to-image model. Image rows are read-only (pass a model to the tool to change it); the VIDEO model is pinnable in the picker above.",
|
|
15262
15589
|
"row.mediaModelsEmpty": "This region publishes no image or video model.",
|
|
@@ -15468,8 +15795,6 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
15468
15795
|
"row.probeRateLimitedAt": "✗ 被限流 · {at} 之后可再用",
|
|
15469
15796
|
"row.probeModelBusyUnknown": "✗ 该模型当前负载较高 · 不是账号被限流——换账号没用,建议等待约 1 分钟或切换模型",
|
|
15470
15797
|
"row.probeModelBusyAt": "✗ 该模型当前负载较高 · 不是账号被限流;{at} 之后可重试,或切换模型",
|
|
15471
|
-
"row.probeOutOfCreditUnknown": "✗ 积分不足 · 上游未给出何时恢复",
|
|
15472
|
-
"row.probeOutOfCreditAt": "✗ 积分不足 · 积分包 {at} 刷新",
|
|
15473
15798
|
"row.probeCredentialRejected": "✗ WorkBuddy 拒绝了这个账号的 token——请重新登录或换一个账号",
|
|
15474
15799
|
"row.probePolicyRejected": "✗ WorkBuddy 服务端按内容策略拒绝了这次请求——重新登录无效;可在桌面端验证或切换区域/账号",
|
|
15475
15800
|
"row.probeChannelRejected": "✗ 网关拦的是提示词本身,不是这个账号——某条 system 消息的开头命中了它的第三方 agent 过滤,换账号或换区域都会得到同一个答案(测试能过、聊天被拒,正是这个原因)",
|
|
@@ -15520,7 +15845,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
15520
15845
|
"row.transferNoService": "与本地插件服务通信失败(本次发送 {size} KiB)。可能是文件过大,或服务正在重启——请重试;若持续失败,请精简文件后再导入。",
|
|
15521
15846
|
"row.poolTitle": "账号池",
|
|
15522
15847
|
"row.poolNoCandidate": "账号池里目前没有可用的账号。",
|
|
15523
|
-
"row.poolNoCandidateHint": "
|
|
15848
|
+
"row.poolNoCandidateHint": "成员要么在限流冷却中、要么积分耗尽、要么凭据被拒、要么上游无响应。限流与瞬时故障会自动回池——按上游给出的恢复时间,没给时间就按 30 分钟兜底;积分耗尽则要等一次余额查询确认到账(签到或充值)后才回池。只有「凭据被拒」需要重新登录。",
|
|
15524
15849
|
"row.poolModelWideBusy": "所有成员都卡在同一个模型上 —— 这是模型的问题,不是你的账号。",
|
|
15525
15850
|
"row.poolModelWideBusyHint": "换账号解决不了:限制跟随模型,换一个账号撞的是同一堵墙。等大约 1 分钟,或把这个会话切到负载较低的模型。",
|
|
15526
15851
|
"row.poolCheckinAll": "签到勾选的账号",
|
|
@@ -15565,6 +15890,9 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
15565
15890
|
"row.poolExcludedRateLimited": "被限流",
|
|
15566
15891
|
"row.poolExcludedModelBusy": "模型繁忙",
|
|
15567
15892
|
"row.poolExcludedOutOfCredit": "积分耗尽",
|
|
15893
|
+
"row.creditCheckinTomorrow": "明日签到后重试",
|
|
15894
|
+
"row.creditCheckinRetry": "签到后重试",
|
|
15895
|
+
"row.creditAwaitReplenishment": "等待积分补充",
|
|
15568
15896
|
"row.poolExcludedRejected": "被拒绝",
|
|
15569
15897
|
"row.poolExcludedAccountRestricted": "账号被上游限制使用",
|
|
15570
15898
|
"row.poolExcludedUnusable": "不可用",
|
|
@@ -15637,7 +15965,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
15637
15965
|
"row.poolSelectedCount": "已选 {count} / {total}",
|
|
15638
15966
|
"row.poolOrderRulesTitle": "本池如何挑选账号",
|
|
15639
15967
|
"row.poolOrderRulesIntro": "池子总是先挑「现在确实能扣费的」账号。下面这些规则按顺序逐条比较,第一条分出胜负就停止,后面的只在平局时才看。",
|
|
15640
|
-
"row.poolOrderRuleUsable": "1.
|
|
15968
|
+
"row.poolOrderRuleUsable": "1. 现在能扣费吗?被限流、凭证被拒或调用失败的账号会被挪到后面,直到冷却结束;积分耗尽的账号则要等一次余额查询确认到账后才回池。这一条优先级最高,压过下面的手动顺序。",
|
|
15641
15969
|
"row.poolOrderRuleExpiring": "2. 有 3 天内会过期的积分吗?有就排前面。这一条同样压过手动顺序,原因见下方说明。",
|
|
15642
15970
|
"row.poolOrderRuleManual": "3. 你排的手动顺序。就是用 ↑ / ↓ 设定的位置。没有手动排过的账号,会排在所有已排序账号之后。",
|
|
15643
15971
|
"row.poolOrderRuleNearestExpiry": "4. 谁先过期?两个都有临期积分时,先到期的排前面。",
|
|
@@ -15664,7 +15992,12 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
15664
15992
|
"row.poolRankLabel": "第 {rank} 位",
|
|
15665
15993
|
"row.poolRankManualTitle": "你在本池中手动把该账号排在第 {rank} 位。",
|
|
15666
15994
|
"row.poolRankAuto": "自动排序",
|
|
15667
|
-
"row.poolRankAutoTitle": "
|
|
15995
|
+
"row.poolRankAutoTitle": "自动排序:池会先花临期积分,再按余额多寡选号。想自己指定顺序,把上面的开关切到「手动排序」。",
|
|
15996
|
+
"row.poolSortModeTitle": "选号顺序",
|
|
15997
|
+
"row.poolSortAuto": "自动排序",
|
|
15998
|
+
"row.poolSortAutoTitle": "交给积分规则:先花临期积分,再按余额多寡选号。切到这里会清空手动顺序,勾选的账号不受影响。",
|
|
15999
|
+
"row.poolSortManual": "手动排序",
|
|
16000
|
+
"row.poolSortManualTitle": "按你排的顺序选号(顶部优先)。切到这里会保留当前屏幕上的顺序,之后用 ↑/↓ 调整。",
|
|
15668
16001
|
"row.poolMoveUpTitle": "在本池顺序中上移该账号",
|
|
15669
16002
|
"row.poolMoveDownTitle": "在本池顺序中下移该账号",
|
|
15670
16003
|
"row.poolMoveUpAria": "在本池顺序中上移 {accountName}",
|
|
@@ -15811,6 +16144,10 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
15811
16144
|
"row.videoModelLabel": "按模式指定视频模型",
|
|
15812
16145
|
"row.videoModelHint": "文生视频与图生视频各钉一个,选项只来自当前这一区自己的目录——模型 id 不跨区。调用时不填 model 就用这里钉的;什么都没钉就用该组第一个模型。钉住的模型如果目录里已经没有了,会安静地回落到第一个,而不是让这次生成失败。",
|
|
15813
16146
|
"row.videoModelDefault": "默认(组内第一个)",
|
|
16147
|
+
"row.imageModelLabel": "生图模型(水印)",
|
|
16148
|
+
"row.imageModelHint": "WorkBuddy 出图固定带「AI生成 WORKBUDD>」水印,上游没有关掉它的开关(issue #241)——唯一的等价做法是换模型:hunyuan-image-v3.0 出同样的图但不带水印。代价是单价约 11.1 积分/张(默认那条约 6),尺寸上限也小得多:边长 2048、总像素约 104 万,所以 1024x1536 会等比缩成 836x1254(比例不变,只是更小)。留在「默认」就是用便宜、带水印、尺寸档位全的那条。仅国内区有效。",
|
|
16149
|
+
"row.imageModelDefault": "默认(组内第一个,带水印)",
|
|
16150
|
+
"row.imageModelWatermarkFree": "Hunyuan Image v3.0(无水印——约 11.1 积分/张,尺寸上限更小)",
|
|
15814
16151
|
"row.mediaModelsLabel": "本区可用的图像模型",
|
|
15815
16152
|
"row.mediaModelsHint": "读自当前账号的产品配置。生图工具就按这里挑模型:不填图片走「文生图」那一组,填了图片走「图生图」那一组。「图像」那几行是只读的(想换就在调用工具时指定模型);「视频」模型可以在上面的选择器里钉住。",
|
|
15816
16153
|
"row.mediaModelsEmpty": "这一区的产品配置里没有图像或视频模型。",
|