dsh-connect-workbuddy 5.25.2 → 5.30.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 +229 -0
- package/lib/bin.js +1 -1
- package/lib/client.js +222 -31
- package/lib/{host-heartbeat-BDwQzVNn.js → host-heartbeat-BzYVKa0r.js} +109 -2
- package/lib/index.d.ts +130 -3
- package/lib/index.js +812 -96
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -1613,8 +1613,13 @@ window.__ModuleLoader__.load({
|
|
|
1613
1613
|
memberAccountIds: preferences.memberAccountIds,
|
|
1614
1614
|
orderAccountIds: preferences.orderAccountIds
|
|
1615
1615
|
};
|
|
1616
|
+
const currentPool = scope.getSnapshot().value?.regions?.[region]?.pool;
|
|
1617
|
+
if (preferences.growthRedeem === void 0 && typeof currentPool?.["growthRedeem"] === "boolean") slot["growthRedeem"] = currentPool["growthRedeem"];
|
|
1618
|
+
if (preferences.growthActivity === void 0 && typeof currentPool?.["growthActivity"] === "boolean") slot["growthActivity"] = currentPool["growthActivity"];
|
|
1616
1619
|
if (preferences.probeInputTokens !== void 0) slot["probeInputTokens"] = preferences.probeInputTokens;
|
|
1617
1620
|
if (preferences.autoCheckin !== void 0) slot["autoCheckin"] = preferences.autoCheckin;
|
|
1621
|
+
if (preferences.growthRedeem !== void 0) slot["growthRedeem"] = preferences.growthRedeem;
|
|
1622
|
+
if (preferences.growthActivity !== void 0) slot["growthActivity"] = preferences.growthActivity;
|
|
1618
1623
|
const next = nextRegionPool(scope.getSnapshot().value, region, slot)[region];
|
|
1619
1624
|
await writeField(scope, "regions", region, next, (readBack) => {
|
|
1620
1625
|
const pool = readBack?.pool;
|
|
@@ -1629,6 +1634,8 @@ window.__ModuleLoader__.load({
|
|
|
1629
1634
|
const storedOrder = pool["orderAccountIds"];
|
|
1630
1635
|
if (!Array.isArray(storedOrder) || storedOrder.length !== preferences.orderAccountIds.length) return false;
|
|
1631
1636
|
if (!storedOrder.every((id, index) => id === preferences.orderAccountIds[index])) return false;
|
|
1637
|
+
if (preferences.growthRedeem !== void 0 && pool["growthRedeem"] !== preferences.growthRedeem) return false;
|
|
1638
|
+
if (preferences.growthActivity !== void 0 && pool["growthActivity"] !== preferences.growthActivity) return false;
|
|
1632
1639
|
return true;
|
|
1633
1640
|
});
|
|
1634
1641
|
}
|
|
@@ -3612,6 +3619,35 @@ window.__ModuleLoader__.load({
|
|
|
3612
3619
|
function formatNumber$1(value) {
|
|
3613
3620
|
return formatCredits(value);
|
|
3614
3621
|
}
|
|
3622
|
+
/**
|
|
3623
|
+
* One small line-icon for a day-state stamp (issue #286): check = checked in,
|
|
3624
|
+
* gift = tier redeemed, bolt = active today. Drawn inline with `currentColor`
|
|
3625
|
+
* so the green CSS token carries through; `aria-hidden` because the wrapping
|
|
3626
|
+
* span already carries role=img + aria-label + title tooltip.
|
|
3627
|
+
*/
|
|
3628
|
+
function dayStateIcon(kind) {
|
|
3629
|
+
const shared = {
|
|
3630
|
+
width: 12,
|
|
3631
|
+
height: 12,
|
|
3632
|
+
viewBox: "0 0 16 16",
|
|
3633
|
+
fill: "none",
|
|
3634
|
+
stroke: "currentColor",
|
|
3635
|
+
strokeWidth: 1.6,
|
|
3636
|
+
strokeLinecap: "round",
|
|
3637
|
+
strokeLinejoin: "round",
|
|
3638
|
+
"aria-hidden": true,
|
|
3639
|
+
focusable: "false"
|
|
3640
|
+
};
|
|
3641
|
+
if (kind === "check") return (0, react.createElement)("svg", shared, (0, react.createElement)("path", { d: "M3 8.5l3.2 3.2L13 5" }));
|
|
3642
|
+
if (kind === "gift") return (0, react.createElement)("svg", shared, (0, react.createElement)("rect", {
|
|
3643
|
+
x: 2.5,
|
|
3644
|
+
y: 6.5,
|
|
3645
|
+
width: 11,
|
|
3646
|
+
height: 7,
|
|
3647
|
+
rx: 1
|
|
3648
|
+
}), (0, react.createElement)("path", { d: "M2 6.5h12M8 6.5V13.5" }), (0, react.createElement)("path", { d: "M8 6.5C6 6.5 5 6 5 4.8c0-.9.9-1.5 1.8-1.2C8 4 8 6.5 8 6.5zM8 6.5c2 0 3-.5 3-1.7 0-.9-.9-1.5-1.8-1.2C8 4 8 6.5 8 6.5z" }));
|
|
3649
|
+
return (0, react.createElement)("svg", shared, (0, react.createElement)("path", { d: "M9 2L4 9h3.2L6.5 14 12 7H8.8L9 2z" }));
|
|
3650
|
+
}
|
|
3615
3651
|
function formatClock$1(value) {
|
|
3616
3652
|
return new Intl.DateTimeFormat(void 0, {
|
|
3617
3653
|
hour: "2-digit",
|
|
@@ -3674,7 +3710,9 @@ window.__ModuleLoader__.load({
|
|
|
3674
3710
|
probeInputTokens: pool?.probeInputTokens ?? 0,
|
|
3675
3711
|
memberAccountIds: pool?.memberAccountIds ?? [],
|
|
3676
3712
|
orderAccountIds: pool?.orderAccountIds ?? [],
|
|
3677
|
-
autoCheckin: pool?.autoCheckin === true
|
|
3713
|
+
autoCheckin: pool?.autoCheckin === true,
|
|
3714
|
+
growthRedeem: pool?.growthRedeem === true,
|
|
3715
|
+
growthActivity: pool?.growthActivity === true
|
|
3678
3716
|
};
|
|
3679
3717
|
const active = draftRegion === region && draft !== null ? draft : saved;
|
|
3680
3718
|
/**
|
|
@@ -3695,7 +3733,7 @@ window.__ModuleLoader__.load({
|
|
|
3695
3733
|
* the pending edit.
|
|
3696
3734
|
*/
|
|
3697
3735
|
const poolRunning = saved.enabled;
|
|
3698
|
-
const dirty = draftRegion === region && draft !== null && (draft.enabled !== saved.enabled || draft.targetModelId !== saved.targetModelId || draft.probeInputTokens !== saved.probeInputTokens || !sameIds(draft.memberAccountIds, saved.memberAccountIds) || !sameOrder(draft.orderAccountIds, saved.orderAccountIds) || draft.autoCheckin !== saved.autoCheckin);
|
|
3736
|
+
const dirty = draftRegion === region && draft !== null && (draft.enabled !== saved.enabled || draft.targetModelId !== saved.targetModelId || draft.probeInputTokens !== saved.probeInputTokens || !sameIds(draft.memberAccountIds, saved.memberAccountIds) || !sameOrder(draft.orderAccountIds, saved.orderAccountIds) || draft.autoCheckin !== saved.autoCheckin || draft.growthRedeem !== saved.growthRedeem || draft.growthActivity !== saved.growthActivity);
|
|
3699
3737
|
/**
|
|
3700
3738
|
* The automatic check-in's progress line, or nothing.
|
|
3701
3739
|
*
|
|
@@ -3953,7 +3991,7 @@ window.__ModuleLoader__.load({
|
|
|
3953
3991
|
savedEffective: pool?.effectiveMemberAccountIds,
|
|
3954
3992
|
savedMembers: pool?.memberAccountIds ?? []
|
|
3955
3993
|
});
|
|
3956
|
-
appendLog(action === "checkin" ? t("row.poolLogCheckinStart", { count: memberCount }) : t("row.poolLogTestStart", {
|
|
3994
|
+
appendLog(action === "checkin" ? t("row.poolLogCheckinStart", { count: memberCount }) : action === "growth-redeem" ? t("row.poolLogGrowthRedeemStart", { count: memberCount }) : action === "growth-activity" ? t("row.poolLogGrowthActivityStart", { count: memberCount }) : t("row.poolLogTestStart", {
|
|
3957
3995
|
count: memberCount,
|
|
3958
3996
|
model: pool?.targetModelId ?? ""
|
|
3959
3997
|
}), "info");
|
|
@@ -4018,7 +4056,22 @@ window.__ModuleLoader__.load({
|
|
|
4018
4056
|
bodyUnreadable: body === void 0
|
|
4019
4057
|
}));
|
|
4020
4058
|
if (!mounted.current) return;
|
|
4021
|
-
if (action === "
|
|
4059
|
+
if (action === "growth-redeem" || action === "growth-activity") {
|
|
4060
|
+
for (const row of body?.rows ?? []) {
|
|
4061
|
+
const name = row.accountName === "" || row.accountName === void 0 ? t("row.accountUnnamed") : row.accountName;
|
|
4062
|
+
if (row.status === "claimed") appendLog(t(action === "growth-redeem" ? "row.poolLogGrowthRedeemDone" : "row.poolLogGrowthActivityDone", {
|
|
4063
|
+
accountName: name,
|
|
4064
|
+
credit: row.credit === void 0 ? "" : ` +${row.credit}`
|
|
4065
|
+
}), "ok");
|
|
4066
|
+
else if (row.status === "already") appendLog(t("row.poolLogGrowthAlready", { accountName: name }), "info");
|
|
4067
|
+
else if (row.status === "skipped") appendLog(t("row.poolLogGrowthSkipped", { accountName: name }), "info");
|
|
4068
|
+
else appendLog(t("row.poolLogGrowthFailed", {
|
|
4069
|
+
accountName: name,
|
|
4070
|
+
message: row.message ?? t("row.requestFailed")
|
|
4071
|
+
}), "error");
|
|
4072
|
+
}
|
|
4073
|
+
appendLog(t(action === "growth-redeem" ? "row.poolLogGrowthRedeemBatchDone" : "row.poolLogGrowthActivityBatchDone"), "ok");
|
|
4074
|
+
} else if (action === "checkin") {
|
|
4022
4075
|
for (const row of body?.rows ?? []) if (row.status === "claimed") appendLog(t("row.poolLogCheckinClaimed", {
|
|
4023
4076
|
accountName: row.accountName === "" ? t("row.accountUnnamed") : row.accountName,
|
|
4024
4077
|
credit: String(row.credit ?? 0)
|
|
@@ -4418,7 +4471,29 @@ window.__ModuleLoader__.load({
|
|
|
4418
4471
|
autoCheckin: next
|
|
4419
4472
|
}));
|
|
4420
4473
|
}
|
|
4421
|
-
}), (0, react.createElement)("span", { className: "sw-track" })), (0, react.createElement)("b", { className: "dsm-workbuddy-pool-modebar-label" }, t("row.poolAutoCheckin"))), (0, react.createElement)("p", { className: "dsm-workbuddy-pool-note" }, t("row.poolAutoCheckinHint")), autoCheckinStatus) : null
|
|
4474
|
+
}), (0, react.createElement)("span", { className: "sw-track" })), (0, react.createElement)("b", { className: "dsm-workbuddy-pool-modebar-label" }, t("row.poolAutoCheckin"))), (0, react.createElement)("p", { className: "dsm-workbuddy-pool-note" }, t("row.poolAutoCheckinHint")), autoCheckinStatus) : null, (0, react.createElement)("div", { className: "dsm-workbuddy-pool-auto-checkin" }, (0, react.createElement)("div", { className: "dsm-workbuddy-pool-switchrow" }, (0, react.createElement)("label", { className: "sw" }, (0, react.createElement)("input", {
|
|
4475
|
+
type: "checkbox",
|
|
4476
|
+
checked: active.growthRedeem,
|
|
4477
|
+
disabled: !canEditPool,
|
|
4478
|
+
onChange: (event) => {
|
|
4479
|
+
const next = event.currentTarget.checked;
|
|
4480
|
+
editDraft((current) => ({
|
|
4481
|
+
...current,
|
|
4482
|
+
growthRedeem: next
|
|
4483
|
+
}));
|
|
4484
|
+
}
|
|
4485
|
+
}), (0, react.createElement)("span", { className: "sw-track" })), (0, react.createElement)("b", { className: "dsm-workbuddy-pool-modebar-label" }, t("row.poolGrowthRedeem"))), (0, react.createElement)("p", { className: "dsm-workbuddy-pool-note" }, t("row.poolGrowthRedeemHint")), (0, react.createElement)("div", { className: "dsm-workbuddy-pool-switchrow" }, (0, react.createElement)("label", { className: "sw" }, (0, react.createElement)("input", {
|
|
4486
|
+
type: "checkbox",
|
|
4487
|
+
checked: active.growthActivity,
|
|
4488
|
+
disabled: !canEditPool,
|
|
4489
|
+
onChange: (event) => {
|
|
4490
|
+
const next = event.currentTarget.checked;
|
|
4491
|
+
editDraft((current) => ({
|
|
4492
|
+
...current,
|
|
4493
|
+
growthActivity: next
|
|
4494
|
+
}));
|
|
4495
|
+
}
|
|
4496
|
+
}), (0, react.createElement)("span", { className: "sw-track" })), (0, react.createElement)("b", { className: "dsm-workbuddy-pool-modebar-label" }, t("row.poolGrowthActivity"))), (0, react.createElement)("p", { className: "dsm-workbuddy-pool-note" }, t("row.poolGrowthActivityHint")))), poolRunning && currentAccount !== void 0 && !effectiveMembers.includes(currentAccount.accountId) ? (0, react.createElement)("p", { className: "dsm-workbuddy-pool-note dsm-workbuddy-pool-serving-note" }, t("row.poolServingOutside", { account: currentName ?? "" })) : null, poolRunning && effectiveMembers.length > 0 && usable.length === 0 ? allMembersBlockedByModel(pool?.accounts ?? [], effectiveMembers, active.memberAccountIds) ? (0, react.createElement)("p", {
|
|
4422
4497
|
className: "dsm-workbuddy-pool-warn",
|
|
4423
4498
|
role: "status"
|
|
4424
4499
|
}, `${t("row.poolModelWideBusy")} ${t("row.poolModelWideBusyHint")}`) : (0, react.createElement)("p", {
|
|
@@ -4482,6 +4557,22 @@ window.__ModuleLoader__.load({
|
|
|
4482
4557
|
runAction("checkin");
|
|
4483
4558
|
}
|
|
4484
4559
|
}, busy === "checkin" ? t("row.poolCheckingIn") : t("row.poolCheckinAll")) : null, (0, react.createElement)("button", {
|
|
4560
|
+
type: "button",
|
|
4561
|
+
className: "dsm-btn dsm-btn-outline",
|
|
4562
|
+
disabled: busy !== void 0 || effectiveMembers.length === 0,
|
|
4563
|
+
title: t("row.poolGrowthRedeemRunHint"),
|
|
4564
|
+
onClick: () => {
|
|
4565
|
+
runAction("growth-redeem");
|
|
4566
|
+
}
|
|
4567
|
+
}, busy === "growth-redeem" ? t("row.poolGrowthRedeemRunning") : t("row.poolGrowthRedeemRun")), (0, react.createElement)("button", {
|
|
4568
|
+
type: "button",
|
|
4569
|
+
className: "dsm-btn dsm-btn-outline",
|
|
4570
|
+
disabled: busy !== void 0 || effectiveMembers.length === 0,
|
|
4571
|
+
title: t("row.poolGrowthActivityRunHint"),
|
|
4572
|
+
onClick: () => {
|
|
4573
|
+
runAction("growth-activity");
|
|
4574
|
+
}
|
|
4575
|
+
}, busy === "growth-activity" ? t("row.poolGrowthActivityRunning") : t("row.poolGrowthActivityRun")), (0, react.createElement)("button", {
|
|
4485
4576
|
type: "button",
|
|
4486
4577
|
className: "dsm-btn dsm-btn-outline",
|
|
4487
4578
|
disabled: busy !== void 0 || effectiveMembers.length === 0 || pool.targetModelSource === "none" || pool.targetModelSource === "stale",
|
|
@@ -4726,7 +4817,22 @@ window.__ModuleLoader__.load({
|
|
|
4726
4817
|
"aria-label": t("row.poolMoveDownAria", { accountName: name }),
|
|
4727
4818
|
disabled: moveDownDisabled,
|
|
4728
4819
|
onClick: onMoveDown
|
|
4729
|
-
}, "↓")) : null) : null, account.current ? (0, react.createElement)("span", { className: "dsm-workbuddy-pool-current-tag" }, t("row.poolCurrentBadge")) : null, checked ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-not-member" }, t("row.poolNotMember")))), (0, react.createElement)("span", { className: "dsm-workbuddy-pool-credits" }, account.credits === void 0 ? (0, react.createElement)("span", null, "—") : (0, react.createElement)("b", null, formatNumber$1(account.credits)), account.expiringSoon !== void 0 && account.expiringSoon > 0 ? (0, react.createElement)("span", { className: "dsm-workbuddy-pool-soon" }, t("row.poolCreditSoon", { count: formatNumber$1(account.expiringSoon) })) : null, account.
|
|
4820
|
+
}, "↓")) : null) : null, account.current ? (0, react.createElement)("span", { className: "dsm-workbuddy-pool-current-tag" }, t("row.poolCurrentBadge")) : null, checked ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-not-member" }, t("row.poolNotMember")))), (0, react.createElement)("span", { className: "dsm-workbuddy-pool-credits" }, account.credits === void 0 ? (0, react.createElement)("span", null, "—") : (0, react.createElement)("b", null, formatNumber$1(account.credits)), account.expiringSoon !== void 0 && account.expiringSoon > 0 ? (0, react.createElement)("span", { className: "dsm-workbuddy-pool-soon" }, t("row.poolCreditSoon", { count: formatNumber$1(account.expiringSoon) })) : null, account.checkedInToday === true || account.growthRedeemedToday === true || account.growthActiveToday === true ? (0, react.createElement)("span", { className: "dsm-workbuddy-pool-daystamps" }, account.checkedInToday === true ? (0, react.createElement)("span", {
|
|
4821
|
+
className: "dsm-workbuddy-pool-daystamp",
|
|
4822
|
+
title: t("row.poolCheckedIn"),
|
|
4823
|
+
role: "img",
|
|
4824
|
+
"aria-label": t("row.poolCheckedIn")
|
|
4825
|
+
}, dayStateIcon("check")) : null, account.growthRedeemedToday === true ? (0, react.createElement)("span", {
|
|
4826
|
+
className: "dsm-workbuddy-pool-daystamp",
|
|
4827
|
+
title: t("row.poolGrowthRedeemed"),
|
|
4828
|
+
role: "img",
|
|
4829
|
+
"aria-label": t("row.poolGrowthRedeemed")
|
|
4830
|
+
}, dayStateIcon("gift")) : null, account.growthActiveToday === true ? (0, react.createElement)("span", {
|
|
4831
|
+
className: "dsm-workbuddy-pool-daystamp",
|
|
4832
|
+
title: t("row.poolGrowthActive"),
|
|
4833
|
+
role: "img",
|
|
4834
|
+
"aria-label": t("row.poolGrowthActive")
|
|
4835
|
+
}, dayStateIcon("bolt")) : null) : null, account.enterprise === true || account.benefits === void 0 || account.benefits.length === 0 ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-benefits" }, account.benefits.map((benefit, index) => (0, react.createElement)("span", {
|
|
4730
4836
|
key: benefit.kind,
|
|
4731
4837
|
className: benefit.urgent ? "dsm-workbuddy-pool-benefit dsm-workbuddy-pool-benefit-urgent" : "dsm-workbuddy-pool-benefit"
|
|
4732
4838
|
}, index === 0 ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-prov-sep" }, "·"), (0, react.createElement)("span", { className: "dsm-workbuddy-pool-benefit-tag" }, benefit.urgent ? benefit.daysLeft === void 0 || benefit.daysLeft === 0 ? t("row.poolBenefitDueToday", {
|
|
@@ -4761,7 +4867,7 @@ window.__ModuleLoader__.load({
|
|
|
4761
4867
|
}, probe.modelId === void 0 ? t("row.poolProbeModelUnknown") : t("row.poolProbeModel", { model: probe.modelId }))] : null)), checkinSupported ? (0, react.createElement)("span", { className: "dsm-workbuddy-pool-checkin" }, account.enterprise === true ? (0, react.createElement)("span", { className: "dsm-workbuddy-pool-unknown" }, t("row.poolCheckinEnterprise")) : account.checkedInToday === void 0 ? (0, react.createElement)("span", {
|
|
4762
4868
|
className: "dsm-workbuddy-pool-unknown",
|
|
4763
4869
|
title: t("row.poolNeverTested")
|
|
4764
|
-
}, t("row.poolCheckinUnknown")) : account.checkedInToday ?
|
|
4870
|
+
}, t("row.poolCheckinUnknown")) : account.checkedInToday ? null : t("row.poolNotCheckedIn")) : null, (0, react.createElement)("span", { className: "dsm-workbuddy-pool-row-actions" }, onEditDevice === void 0 ? null : (0, react.createElement)("button", {
|
|
4765
4871
|
type: "button",
|
|
4766
4872
|
className: `dsm-btn dsm-btn-outline dsm-workbuddy-pool-small-btn dsm-workbuddy-device-gear${deviceGearBlocked ? " dsm-workbuddy-device-gear-off" : ""}`,
|
|
4767
4873
|
"aria-disabled": deviceGearBlocked ? true : void 0,
|
|
@@ -8017,6 +8123,12 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
8017
8123
|
* is a seasonal campaign, so the row keeps its honest wrap instead. */
|
|
8018
8124
|
.dsm-workbuddy-pool-credits{grid-area:credits;display:flex;flex-direction:row;flex-wrap:wrap;align-items:baseline;justify-content:flex-end;gap:0 6px;min-width:0;justify-self:end;text-align:right;font-variant-numeric:tabular-nums}
|
|
8019
8125
|
.dsm-workbuddy-pool-credits b{color:var(--dsw-alias-label-primary,#e6e6e6);font-weight:600}
|
|
8126
|
+
/* All three day-state stamps (已签到/已兑换/已点亮) sit together beside the
|
|
8127
|
+
credits. Smaller than the row text (11px) and quiet-success green — they are
|
|
8128
|
+
confirmations, not the facts the row is about. The group wraps on narrow cards
|
|
8129
|
+
rather than pushing the credits figure off the right edge. */
|
|
8130
|
+
.dsm-workbuddy-pool-daystamps{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px;font-size:11px;line-height:16px;color:var(--dsw-alias-state-success-primary,#22a06b)}
|
|
8131
|
+
.dsm-workbuddy-pool-daystamp{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:5px;background:rgba(34,160,107,.14);cursor:help}
|
|
8020
8132
|
.dsm-workbuddy-pool-soon{font-size:11px;line-height:16px;color:var(--dsw-alias-state-warn-primary,#f59e0b)}
|
|
8021
8133
|
/* Claimable benefits (issue #79). A quiet line by default — it is an opportunity, not a fault — and loud only when the window is about to close. */
|
|
8022
8134
|
.dsm-workbuddy-pool-benefits{display:flex;flex-wrap:wrap;align-items:center;gap:6px;font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary,#999);min-width:0}
|
|
@@ -9144,6 +9256,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
9144
9256
|
*/
|
|
9145
9257
|
function signedOutNotice(input) {
|
|
9146
9258
|
if (input.selectionLost) return { key: "row.selectionLostMessage" };
|
|
9259
|
+
if (input.credentialRejected === true) return { key: "row.credentialRejectedNotice" };
|
|
9147
9260
|
if (input.searched.some((item) => item.reason === "encrypted")) return { key: "row.signedOutEncrypted" };
|
|
9148
9261
|
if (input.searched.some((item) => item.reason === "wrong-region")) return { key: "row.signedOutWrongRegion" };
|
|
9149
9262
|
if (input.searched.length > 0) return { key: "row.signedOutHint" };
|
|
@@ -11266,10 +11379,41 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
11266
11379
|
const notice = signedOutNotice({
|
|
11267
11380
|
selectionLost,
|
|
11268
11381
|
message: status.status === "signed-out" ? status.message : void 0,
|
|
11269
|
-
searched
|
|
11382
|
+
searched,
|
|
11383
|
+
credentialRejected: status.status === "signed-out" && status.credentialRejected === true
|
|
11270
11384
|
});
|
|
11271
11385
|
status.status === "error" || status.selectionExplicit;
|
|
11272
11386
|
/**
|
|
11387
|
+
* The credential-refused advice, shared by the signed-in and signed-out
|
|
11388
|
+
* branches (issue #285). A token can be refused either on a credits read of
|
|
11389
|
+
* an otherwise usable credential, or during `resolve()`'s refresh — the two
|
|
11390
|
+
* land on different `status` values but need the SAME remedy. Keeping one
|
|
11391
|
+
* JSX node is what stops the signed-out copy from drifting back to the
|
|
11392
|
+
* misleading "sign in once" while the signed-in copy says "switch account".
|
|
11393
|
+
*/
|
|
11394
|
+
const credentialRejected = status.status !== "error" && status.credentialRejected === true;
|
|
11395
|
+
const rejectedAccountName = status.status === "signed-in" ? status.accountName : status.status === "signed-out" ? nameOf(status.accounts.find((account) => account.selected)?.accountName ?? "") : "";
|
|
11396
|
+
const recovery = status.status === "error" ? void 0 : status.recovery;
|
|
11397
|
+
const credentialRefusedBlock = !credentialRejected ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
11398
|
+
className: "dsm-workbuddy-usage-error",
|
|
11399
|
+
role: "alert",
|
|
11400
|
+
children: [
|
|
11401
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("row.credentialRejectedTitle") }),
|
|
11402
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("row.credentialRejectedIntro", { accountName: nameOf(rejectedAccountName) }) }),
|
|
11403
|
+
recovery?.usableAccount !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("row.credentialRejectedSwitch", { accountName: nameOf(recovery.usableAccount.accountName) }) }) : recovery?.reloginRequired === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("row.credentialRejectedRelogin") }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("row.credentialRejectedChoose") }),
|
|
11404
|
+
recovery?.usableAccount === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
11405
|
+
type: "button",
|
|
11406
|
+
className: "dsm-btn dsm-btn-outline",
|
|
11407
|
+
disabled: switchingAccount || !canWrite,
|
|
11408
|
+
onClick: () => {
|
|
11409
|
+
const target = recovery.usableAccount;
|
|
11410
|
+
if (target !== void 0) switchAccount(target.accountId);
|
|
11411
|
+
},
|
|
11412
|
+
children: switchingAccount ? t("row.accountsScanning") : t("row.credentialRejectedSwitchAction", { accountName: nameOf(recovery.usableAccount.accountName) })
|
|
11413
|
+
})
|
|
11414
|
+
]
|
|
11415
|
+
});
|
|
11416
|
+
/**
|
|
11273
11417
|
* Account-adding and account-migration controls, defined ONCE and rendered
|
|
11274
11418
|
* in both sign-in states: inside the pool settings block when an account
|
|
11275
11419
|
* exists, and in the signed-out branch when it does not (the pool section is
|
|
@@ -12386,25 +12530,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
12386
12530
|
children: t("row.vaultUnreadableHint", { message: vaultUnreadable })
|
|
12387
12531
|
}) : null,
|
|
12388
12532
|
status.status === "signed-in" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
12389
|
-
|
|
12390
|
-
className: "dsm-workbuddy-usage-error",
|
|
12391
|
-
role: "alert",
|
|
12392
|
-
children: [
|
|
12393
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("row.credentialRejectedTitle") }),
|
|
12394
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("row.credentialRejectedIntro", { accountName: nameOf(status.accountName) }) }),
|
|
12395
|
-
status.recovery?.usableAccount !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("row.credentialRejectedSwitch", { accountName: nameOf(status.recovery.usableAccount.accountName) }) }) : status.recovery?.reloginRequired === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("row.credentialRejectedRelogin") }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("row.credentialRejectedChoose") }),
|
|
12396
|
-
status.recovery?.usableAccount === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
12397
|
-
type: "button",
|
|
12398
|
-
className: "dsm-btn dsm-btn-outline",
|
|
12399
|
-
disabled: switchingAccount || !canWrite,
|
|
12400
|
-
onClick: () => {
|
|
12401
|
-
const target = status.recovery?.usableAccount;
|
|
12402
|
-
if (target !== void 0) switchAccount(target.accountId);
|
|
12403
|
-
},
|
|
12404
|
-
children: switchingAccount ? t("row.accountsScanning") : t("row.credentialRejectedSwitchAction", { accountName: nameOf(status.recovery.usableAccount.accountName) })
|
|
12405
|
-
})
|
|
12406
|
-
]
|
|
12407
|
-
}) : null,
|
|
12533
|
+
credentialRefusedBlock,
|
|
12408
12534
|
status.creditsError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12409
12535
|
className: "dsm-workbuddy-usage-error",
|
|
12410
12536
|
children: t("row.creditsError", { message: status.creditsError })
|
|
@@ -12917,6 +13043,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
12917
13043
|
className: "dsm-workbuddy-usage-text",
|
|
12918
13044
|
children: signedOutText(notice, t)
|
|
12919
13045
|
}),
|
|
13046
|
+
credentialRefusedBlock,
|
|
12920
13047
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12921
13048
|
className: "dsm-workbuddy-usage-account-actions",
|
|
12922
13049
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
@@ -13807,7 +13934,9 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
13807
13934
|
if (hostCreditsShownOf(usage) === false) return null;
|
|
13808
13935
|
const signedIn = usage?.status === "signed-in" ? usage : void 0;
|
|
13809
13936
|
const total = signedIn === void 0 ? void 0 : creditsOf(signedIn);
|
|
13810
|
-
const
|
|
13937
|
+
const signedOutDocument = usage !== void 0 && usage.status === "signed-out" ? usage : void 0;
|
|
13938
|
+
const credentialRejected = signedOutDocument?.credentialRejected === true;
|
|
13939
|
+
const signedOut = signedOutDocument !== void 0 && !credentialRejected;
|
|
13811
13940
|
const valueText = total === void 0 ? "—" : formatCredits(total);
|
|
13812
13941
|
const label = t(activeRegion === "cn" ? "composer.pointsCn" : "composer.pointsGlobal");
|
|
13813
13942
|
const newModelsShown = hostNewModelsShownOf(usage);
|
|
@@ -13823,7 +13952,8 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
13823
13952
|
* than a spinner the user has to wait on.
|
|
13824
13953
|
*/
|
|
13825
13954
|
const selectedId = accountCredits?.find((account) => account.selected)?.id ?? (signedIn === void 0 ? void 0 : signedIn.accountId);
|
|
13826
|
-
const
|
|
13955
|
+
const documentAccounts = signedIn?.accounts ?? signedOutDocument?.accounts ?? [];
|
|
13956
|
+
const rows = (accountCredits ?? (documentAccounts.length === 0 ? [] : documentAccounts.map((account) => ({
|
|
13827
13957
|
id: account.id,
|
|
13828
13958
|
accountName: account.accountName,
|
|
13829
13959
|
selected: account.selected
|
|
@@ -13971,7 +14101,10 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
13971
14101
|
}) : rows.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
13972
14102
|
className: "dsm-workbuddy-composer-panel-empty",
|
|
13973
14103
|
children: t("composer.noAccounts")
|
|
13974
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("
|
|
14104
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [credentialRejected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14105
|
+
className: "dsm-workbuddy-composer-panel-empty",
|
|
14106
|
+
children: signedOutDocument?.recovery?.usableAccount === void 0 ? t("composer.credentialRejectedReLogin") : t("composer.credentialRejectedSwitch", { accountName: signedOutDocument.recovery.usableAccount.accountName })
|
|
14107
|
+
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
|
|
13975
14108
|
className: "dsm-workbuddy-composer-panel-table",
|
|
13976
14109
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
13977
14110
|
scope: "col",
|
|
@@ -14041,7 +14174,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
14041
14174
|
})]
|
|
14042
14175
|
}, row.id);
|
|
14043
14176
|
}) })]
|
|
14044
|
-
}),
|
|
14177
|
+
})] }),
|
|
14045
14178
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
14046
14179
|
className: "dsm-workbuddy-composer-panel-foot",
|
|
14047
14180
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
@@ -15230,6 +15363,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
15230
15363
|
"row.reloginHint": "If errors occur, sign back in to the WorkBuddy app.",
|
|
15231
15364
|
"row.rescanHidesKept": "The accounts you removed are still hidden: the plugin could not update its own list file. On Windows this is usually a file lock — close antivirus or sync tools that may be holding files in the DSH profile, then try again.",
|
|
15232
15365
|
"row.credentialRejectedTitle": "WorkBuddy refused this account's token",
|
|
15366
|
+
"row.credentialRejectedNotice": "The signed-in token was refused by WorkBuddy, but your local accounts are still present — see the recovery options below.",
|
|
15233
15367
|
"row.credentialRejectedIntro": "The token for \"{accountName}\" is no longer accepted by the upstream, so credits and check-in are unavailable. Signing in again only helps if the problem is the token itself — here is what actually applies:",
|
|
15234
15368
|
"row.credentialRejectedSwitch": "Another sign-in on this machine answered the upstream: \"{accountName}\". Switching to it fixes this — no need to sign in again.",
|
|
15235
15369
|
"row.credentialRejectedSwitchAction": "Switch to \"{accountName}\"",
|
|
@@ -15485,6 +15619,32 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
15485
15619
|
"row.poolDirty": "● Unsaved changes",
|
|
15486
15620
|
"row.poolAutoCheckin": "Check in automatically each day",
|
|
15487
15621
|
"row.poolAutoCheckinHint": "On: the plugin claims the daily check-in for the accounts checked into this pool, once a day, in the background. It reads first and never re-claims an account already checked in, so a restart cannot double-claim. Off: nothing runs until you press the button. A missed day resets the streak.",
|
|
15622
|
+
"row.poolGrowthRedeem": "Redeem growth rewards automatically",
|
|
15623
|
+
"row.poolGrowthRedeemHint": "On: once a day the plugin redeems any streak tier the gateway marks available, for each pooled account. Locked tiers are skipped, so repeat runs write nothing. Available in both regions.",
|
|
15624
|
+
"row.poolGrowthArmed": "Enabled — the first run will start shortly; progress shows here.",
|
|
15625
|
+
"row.poolGrowthRedeemToday": "Redeemed: {done} of {total} today",
|
|
15626
|
+
"row.poolGrowthRedeemDone": "Redeemed: all {total} today",
|
|
15627
|
+
"row.poolGrowthActivity": "Light up \"active today\" automatically",
|
|
15628
|
+
"row.poolGrowthActivityHint": "On: once a day the plugin sends ONE short chat turn per pooled account through the console session, which lights up \"active today\". This spends a little credit. Accounts already active get no turn. Available in both regions.",
|
|
15629
|
+
"row.poolGrowthActivityToday": "Active today: {done} of {total}",
|
|
15630
|
+
"row.poolGrowthActivityDone": "Active today: all {total}",
|
|
15631
|
+
"row.poolGrowthRedeemed": "Redeemed",
|
|
15632
|
+
"row.poolGrowthActive": "Activated",
|
|
15633
|
+
"row.poolGrowthRedeemRun": "Redeem selected accounts",
|
|
15634
|
+
"row.poolGrowthRedeemRunning": "Redeeming…",
|
|
15635
|
+
"row.poolGrowthRedeemRunHint": "Redeem available streak tiers for every checked account now, regardless of the automatic switch.",
|
|
15636
|
+
"row.poolGrowthActivityRun": "Activate selected accounts",
|
|
15637
|
+
"row.poolGrowthActivityRunning": "Activating…",
|
|
15638
|
+
"row.poolGrowthActivityRunHint": "Light up \"active today\" for every checked account now. Sends one short chat turn per active account and spends a little credit.",
|
|
15639
|
+
"row.poolLogGrowthRedeemStart": "Redeeming growth tiers for {count} account(s)…",
|
|
15640
|
+
"row.poolLogGrowthActivityStart": "Lighting up \"active today\" for {count} account(s)…",
|
|
15641
|
+
"row.poolLogGrowthRedeemDone": "{accountName}: redeemed{credit}",
|
|
15642
|
+
"row.poolLogGrowthActivityDone": "{accountName}: active today",
|
|
15643
|
+
"row.poolLogGrowthAlready": "{accountName}: already done, skipped",
|
|
15644
|
+
"row.poolLogGrowthSkipped": "{accountName}: nothing to do, skipped",
|
|
15645
|
+
"row.poolLogGrowthFailed": "{accountName}: failed — {message}",
|
|
15646
|
+
"row.poolLogGrowthRedeemBatchDone": "Growth redeem finished",
|
|
15647
|
+
"row.poolLogGrowthActivityBatchDone": "Active-today run finished",
|
|
15488
15648
|
"row.poolAutoCheckinToday": "Today: {done} of {total} checked in",
|
|
15489
15649
|
"row.poolAutoCheckinDone": "Today: all {total} checked in",
|
|
15490
15650
|
"row.poolAutoCheckinPending": "{count} still to retry",
|
|
@@ -15733,6 +15893,8 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
15733
15893
|
"composer.creditSoonHint": "Earliest expiry: {time}",
|
|
15734
15894
|
"composer.noAccounts": "No account in this region",
|
|
15735
15895
|
"composer.signedOut": "Not signed in",
|
|
15896
|
+
"composer.credentialRejectedReLogin": "The signed-in token was refused by WorkBuddy. Sign in again in the desktop app.",
|
|
15897
|
+
"composer.credentialRejectedSwitch": "The signed-in token was refused by WorkBuddy. Switch to \"{accountName}\" below to recover.",
|
|
15736
15898
|
"composer.openSettings": "Settings",
|
|
15737
15899
|
"composer.openSettingsHint": "Open this plugin's full page (accounts, models, switches)",
|
|
15738
15900
|
"composer.openSettingsFailed": "This host offers no route to the plugin page",
|
|
@@ -15800,6 +15962,7 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
15800
15962
|
"row.reloginHint": "出现错误,重新登录 WorkBuddy APP 即可。",
|
|
15801
15963
|
"row.rescanHidesKept": "已删除的账号仍是隐藏状态:插件没能更新自己的名单文件。Windows 上通常是文件被占用——请关闭可能正在占用 DSH 配置目录的杀毒/同步工具后重试。",
|
|
15802
15964
|
"row.credentialRejectedTitle": "WorkBuddy 拒绝了这个账号的 token",
|
|
15965
|
+
"row.credentialRejectedNotice": "当前登录的 token 被 WorkBuddy 拒绝,但本机账号仍在——请按下方的恢复提示处理。",
|
|
15803
15966
|
"row.credentialRejectedIntro": "「{accountName}」的 token 已不被上游接受,所以积分与签到都用不了。重新登录只在「确实是 token 的问题」时才有用——当前实际适用的是下面这一条:",
|
|
15804
15967
|
"row.credentialRejectedSwitch": "本机另一个账号「{accountName}」刚刚实测可用,切换到它即可恢复,不必重新登录。",
|
|
15805
15968
|
"row.credentialRejectedSwitchAction": "切换到「{accountName}」",
|
|
@@ -16055,6 +16218,32 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
16055
16218
|
"row.poolDirty": "● 有未保存的修改",
|
|
16056
16219
|
"row.poolAutoCheckin": "每天自动签到",
|
|
16057
16220
|
"row.poolAutoCheckinHint": "开启:插件在后台为勾选进池的账号领取每日签到,一天一次。它先读状态、已签到的不重复领取,所以重启也不会多领。关闭:不点按钮就什么都不会发生。漏一天会断连签。",
|
|
16221
|
+
"row.poolGrowthRedeem": "自动兑换成长奖励",
|
|
16222
|
+
"row.poolGrowthRedeemHint": "开启:插件每天为池内每个账号兑换上游标记为可领的连签档位,已锁的档位跳过,因此重复运行不会重复写。国内版与国际版均可用。",
|
|
16223
|
+
"row.poolGrowthArmed": "已开启——即将首次运行,进度会显示在这里。",
|
|
16224
|
+
"row.poolGrowthRedeemToday": "已兑换 {done} / {total}",
|
|
16225
|
+
"row.poolGrowthRedeemDone": "已兑换 全部 {total}",
|
|
16226
|
+
"row.poolGrowthActivity": "自动点亮「今日活跃」",
|
|
16227
|
+
"row.poolGrowthActivityHint": "开启:插件每天通过控制台会话为池内每个账号发一条简短对话,点亮「今日活跃」。这会消耗少量积分;今日已活跃的账号不会发。国内版与国际版均可用。",
|
|
16228
|
+
"row.poolGrowthActivityToday": "已点亮 {done} / {total}",
|
|
16229
|
+
"row.poolGrowthActivityDone": "已点亮 全部 {total}",
|
|
16230
|
+
"row.poolGrowthRedeemed": "已兑换",
|
|
16231
|
+
"row.poolGrowthActive": "已点亮",
|
|
16232
|
+
"row.poolGrowthRedeemRun": "兑换勾选的账号",
|
|
16233
|
+
"row.poolGrowthRedeemRunning": "兑换中…",
|
|
16234
|
+
"row.poolGrowthRedeemRunHint": "立即为勾选的每个账号兑换可领的连签档位,不受自动开关影响。",
|
|
16235
|
+
"row.poolGrowthActivityRun": "点亮勾选的账号",
|
|
16236
|
+
"row.poolGrowthActivityRunning": "点亮中…",
|
|
16237
|
+
"row.poolGrowthActivityRunHint": "立即为勾选的账号点亮「今日活跃」,每个账号发一条简短对话,消耗少量积分。",
|
|
16238
|
+
"row.poolLogGrowthRedeemStart": "正在为 {count} 个账号兑换成长档位…",
|
|
16239
|
+
"row.poolLogGrowthActivityStart": "正在为 {count} 个账号点亮「今日活跃」…",
|
|
16240
|
+
"row.poolLogGrowthRedeemDone": "{accountName}:已兑换{credit}",
|
|
16241
|
+
"row.poolLogGrowthActivityDone": "{accountName}:今日已活跃",
|
|
16242
|
+
"row.poolLogGrowthAlready": "{accountName}:今日已处理,跳过",
|
|
16243
|
+
"row.poolLogGrowthSkipped": "{accountName}:无可处理项,跳过",
|
|
16244
|
+
"row.poolLogGrowthFailed": "{accountName}:失败 — {message}",
|
|
16245
|
+
"row.poolLogGrowthRedeemBatchDone": "成长档位兑换完成",
|
|
16246
|
+
"row.poolLogGrowthActivityBatchDone": "今日活跃点亮完成",
|
|
16058
16247
|
"row.poolAutoCheckinToday": "今日:已签 {done} / {total}",
|
|
16059
16248
|
"row.poolAutoCheckinDone": "今日:{total} 个全部已签",
|
|
16060
16249
|
"row.poolAutoCheckinPending": "待重试 {count} 个",
|
|
@@ -16303,6 +16492,8 @@ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
|
|
|
16303
16492
|
"composer.creditSoonHint": "最早到期:{time}",
|
|
16304
16493
|
"composer.noAccounts": "该区域暂无账号",
|
|
16305
16494
|
"composer.signedOut": "未登录",
|
|
16495
|
+
"composer.credentialRejectedReLogin": "当前登录的 token 被 WorkBuddy 拒绝,请在桌面端重新登录。",
|
|
16496
|
+
"composer.credentialRejectedSwitch": "当前登录的 token 被 WorkBuddy 拒绝,可在下方切换到「{accountName}」恢复。",
|
|
16306
16497
|
"composer.openSettings": "设置",
|
|
16307
16498
|
"composer.openSettingsHint": "打开本插件的完整页面(账号、模型、各项开关)",
|
|
16308
16499
|
"composer.openSettingsFailed": "这台宿主没有通往插件页面的入口",
|
|
@@ -4391,6 +4391,14 @@ function billingBase(credential, cnBase) {
|
|
|
4391
4391
|
if (regionOf(credential.domain) === "global") return globalBase(credential.domain);
|
|
4392
4392
|
return cnBase === void 0 || cnBase === "" ? CN_BILLING_BASE : cnBase;
|
|
4393
4393
|
}
|
|
4394
|
+
/**
|
|
4395
|
+
* Console/growth host for a credential — the SAME host `billingBase` resolves
|
|
4396
|
+
* to (issue #286). Exported so the ACP layer can address the console API
|
|
4397
|
+
* without re-deriving the region from the domain itself.
|
|
4398
|
+
*/
|
|
4399
|
+
function growthHostOf(credential, cnBase) {
|
|
4400
|
+
return billingBase(credential, cnBase);
|
|
4401
|
+
}
|
|
4394
4402
|
function originReferer(credential) {
|
|
4395
4403
|
return regionOf(credential.domain) === "global" ? globalBase(credential.domain) : CN_BILLING_BASE;
|
|
4396
4404
|
}
|
|
@@ -7723,6 +7731,104 @@ var WorkBuddyUpstreamClient = class {
|
|
|
7723
7731
|
};
|
|
7724
7732
|
}
|
|
7725
7733
|
/**
|
|
7734
|
+
* GET one growth-center path, trying `/v2` then the bare form.
|
|
7735
|
+
*
|
|
7736
|
+
* The attachment disagrees with itself on whether growth paths carry `/v2`
|
|
7737
|
+
* (see the endpoint note above). Rather than pin one spelling and be wrong on
|
|
7738
|
+
* half the deployments, a 404 on the first form retries the second. Only a
|
|
7739
|
+
* clean `code: 0` envelope is accepted; a business error is returned as-is.
|
|
7740
|
+
* Returns `undefined` when NEITHER shape answered successfully.
|
|
7741
|
+
*/
|
|
7742
|
+
async readGrowthData(credential, barePath) {
|
|
7743
|
+
const base = billingBase(credential, this.cnBaseOf());
|
|
7744
|
+
for (const path of [`/v2${barePath}`, barePath]) {
|
|
7745
|
+
let response;
|
|
7746
|
+
try {
|
|
7747
|
+
response = await fetch(`${base}${path}`, {
|
|
7748
|
+
method: "GET",
|
|
7749
|
+
headers: billingHeaders(credential, await this.wireIdentity(credential)),
|
|
7750
|
+
signal: AbortSignal.timeout(JSON_TIMEOUT_MS)
|
|
7751
|
+
});
|
|
7752
|
+
} catch {
|
|
7753
|
+
continue;
|
|
7754
|
+
}
|
|
7755
|
+
if (!response.ok) {
|
|
7756
|
+
if (response.status === 404) continue;
|
|
7757
|
+
return;
|
|
7758
|
+
}
|
|
7759
|
+
let envelope;
|
|
7760
|
+
try {
|
|
7761
|
+
envelope = await readEnvelope(response);
|
|
7762
|
+
} catch {
|
|
7763
|
+
return;
|
|
7764
|
+
}
|
|
7765
|
+
if (envelope.code !== 0) return void 0;
|
|
7766
|
+
return typeof envelope.data === "object" && envelope.data !== null ? envelope.data : {};
|
|
7767
|
+
}
|
|
7768
|
+
}
|
|
7769
|
+
/** Today's heatmap cell, or undefined when the gateway gave no usable answer. */
|
|
7770
|
+
async fetchGrowthToday(credential) {
|
|
7771
|
+
const data = await this.readGrowthData(credential, "/activity/growth/heatmap");
|
|
7772
|
+
if (data === void 0) return void 0;
|
|
7773
|
+
const today = typeof data["today"] === "object" && data["today"] !== null ? data["today"] : void 0;
|
|
7774
|
+
if (today === void 0) return void 0;
|
|
7775
|
+
const numberField = (key) => typeof today[key] === "number" ? today[key] : 0;
|
|
7776
|
+
return {
|
|
7777
|
+
date: typeof today["date"] === "string" ? today["date"] : "",
|
|
7778
|
+
isActive: today["is_active"] === true,
|
|
7779
|
+
score: numberField("score"),
|
|
7780
|
+
...typeof today["status_text"] === "string" && today["status_text"] !== "" ? { statusText: today["status_text"] } : {}
|
|
7781
|
+
};
|
|
7782
|
+
}
|
|
7783
|
+
/** Streak + redemption snapshot, or undefined when unreadable. */
|
|
7784
|
+
async fetchGrowthStreak(credential) {
|
|
7785
|
+
const data = await this.readGrowthData(credential, "/activity/growth/streak");
|
|
7786
|
+
if (data === void 0) return void 0;
|
|
7787
|
+
const streak = typeof data["streak"] === "object" && data["streak"] !== null ? data["streak"] : {};
|
|
7788
|
+
const redemption = typeof data["redemption_status"] === "object" && data["redemption_status"] !== null ? data["redemption_status"] : {};
|
|
7789
|
+
const cards = typeof data["makeup_cards"] === "object" && data["makeup_cards"] !== null ? data["makeup_cards"] : {};
|
|
7790
|
+
const num = (obj, key) => typeof obj[key] === "number" ? obj[key] : 0;
|
|
7791
|
+
const availableTiers = [];
|
|
7792
|
+
for (const tier of [
|
|
7793
|
+
"7d",
|
|
7794
|
+
"14d",
|
|
7795
|
+
"28d"
|
|
7796
|
+
]) if (redemption[`tier_${tier}_status`] === "available") availableTiers.push(tier);
|
|
7797
|
+
return {
|
|
7798
|
+
days: num(streak, "days"),
|
|
7799
|
+
monthTotalDays: num(streak, "month_total_days"),
|
|
7800
|
+
monthConsumedDays: num(streak, "month_consumed_days"),
|
|
7801
|
+
...typeof streak["next_tier"] === "string" && streak["next_tier"] !== "" ? { nextTier: streak["next_tier"] } : {},
|
|
7802
|
+
nextTierRemaining: num(streak, "next_tier_remaining"),
|
|
7803
|
+
availableTiers,
|
|
7804
|
+
makeupCardBalance: num(cards, "balance")
|
|
7805
|
+
};
|
|
7806
|
+
}
|
|
7807
|
+
/**
|
|
7808
|
+
* Redeem one streak tier. The CALLER must only pass a tier the gateway marked
|
|
7809
|
+
* `available`; this method does not re-check, so the decision stays in the
|
|
7810
|
+
* batch runner where it can be reported and tested. The browser/host route
|
|
7811
|
+
* guards this mutation with POST + loopback like every other write.
|
|
7812
|
+
*/
|
|
7813
|
+
async redeemGrowthTier(credential, tier) {
|
|
7814
|
+
const response = await fetch(`${billingBase(credential, this.cnBaseOf())}/activity/growth/redeem`, {
|
|
7815
|
+
method: "POST",
|
|
7816
|
+
headers: billingHeaders(credential, await this.wireIdentity(credential)),
|
|
7817
|
+
body: JSON.stringify({ tier }),
|
|
7818
|
+
signal: AbortSignal.timeout(JSON_TIMEOUT_MS)
|
|
7819
|
+
});
|
|
7820
|
+
const envelope = await readEnvelope(response);
|
|
7821
|
+
if (!response.ok || envelope.code !== 0) throw envelopeError(response.status, envelope);
|
|
7822
|
+
const data = typeof envelope.data === "object" && envelope.data !== null ? envelope.data : {};
|
|
7823
|
+
const num = (key) => typeof data[key] === "number" ? data[key] : 0;
|
|
7824
|
+
return {
|
|
7825
|
+
tier,
|
|
7826
|
+
credit: num("credit"),
|
|
7827
|
+
...typeof data["energy"] === "number" ? { energy: data["energy"] } : {},
|
|
7828
|
+
...data["already_claimed"] === true ? { alreadyClaimed: true } : {}
|
|
7829
|
+
};
|
|
7830
|
+
}
|
|
7831
|
+
/**
|
|
7726
7832
|
* The ENTERPRISE credit table (issue #124).
|
|
7727
7833
|
*
|
|
7728
7834
|
* `/v2/billing/meter/get-user-resource` answers an enterprise member with
|
|
@@ -9436,6 +9542,7 @@ var WorkBuddyCredentialStore = class {
|
|
|
9436
9542
|
return refreshed;
|
|
9437
9543
|
} catch (error) {
|
|
9438
9544
|
if (credential.expiresAtMs > Date.now() + 3e4) return credential;
|
|
9545
|
+
if (isCredentialRejectedError(error)) throw error;
|
|
9439
9546
|
throw new Error(`workbuddy: token refresh failed and the access token is expired (${String(error)}); open the WorkBuddy desktop app once to sign in again`);
|
|
9440
9547
|
}
|
|
9441
9548
|
}
|
|
@@ -11383,7 +11490,7 @@ function describeRosterSeenPayload(raw) {
|
|
|
11383
11490
|
//#endregion
|
|
11384
11491
|
//#region src/version.ts
|
|
11385
11492
|
/** The npm package version this build was produced from. */
|
|
11386
|
-
const WORKBUDDY_CONNECT_VERSION = "5.
|
|
11493
|
+
const WORKBUDDY_CONNECT_VERSION = "5.30.0";
|
|
11387
11494
|
//#endregion
|
|
11388
11495
|
//#region src/host-heartbeat.ts
|
|
11389
11496
|
/**
|
|
@@ -11617,4 +11724,4 @@ async function clearHostHeartbeat(owner) {
|
|
|
11617
11724
|
if (current === owner.contents) await rm(owner.path, { force: true });
|
|
11618
11725
|
}
|
|
11619
11726
|
//#endregion
|
|
11620
|
-
export { CREDENTIAL_REJECTED_CODE as $,
|
|
11727
|
+
export { CREDENTIAL_REJECTED_CODE as $, imageModelChoices as $t, withoutRouters as A, macosBundleExecutable as An, attachBusyLevels as At, defaultDesktopAuthPath as B, VIDEO_TAG_IMAGE_TO_VIDEO as Bt, setDeviceMode as C, deriveAtRestKey as Cn, parseUpstreamModel as Ct, applyContextBudgets as D, findWorkbuddyAppExecutableWithSource as Dn, requestEvidenceOf as Dt, WorkBuddyCatalog as E, findWorkbuddyAppExecutable as En, regionOf as Et, WorkBuddyCredentialStore as F, hostPeersInfo as Fn, lastRefusalFor as Ft, parseWorkBuddyAuth as G, resolveVideoParams as Gt, isEncryptedCredentialError as H, WorkBuddyVideoError as Ht, WorkBuddyEncryptedCredentialError as I, resolveDshHome as In, offDefaultFor as It, workbuddyOwnAuthPath as J, IMAGE_TAG_TEXT_TO_IMAGE as Jt, preferredAccountName as K, IMAGE_SIZE_LIMITS_WIDE as Kt, authFileName as L, withFileLock as Ln, offRefused as Lt, WORKBUDDY_AUTH_FILENAME as M, openEncryptedField as Mn, selectPromoBadge as Mt, WORKBUDDY_AUTH_FILE_ENV as N, readAtRestKey as Nn, REFUSES_OFF_MODEL_IDS as Nt, deriveCatalog as O, isEncryptedFieldWrapper as On, rewriteSessionTitleModel as Ot, WORKBUDDY_VAULT_DIRNAME as P, workbuddyAppExecutableCandidates as Pn, defaultOffModelIds as Pt, CONTEXT_OVERFLOW_MARKER as Q, imageMimeForPath as Qt, defaultDesktopAuthCandidates as R, writeFileAtomic as Rn, recordRefusal as Rt, saveDeviceSdkSettings as S, clearAtRestKeyCache as Sn, parseReasoning as St, FALLBACK_WORKBUDDY_MODELS_GLOBAL as T, fetchAtRestKeyPayload as Tn, prepareChatBody as Tt, isVaultAccountId as U, parseSupportedSecondsRange as Ut, hasEncryptedCredentialFields as V, VIDEO_TAG_TEXT_TO_VIDEO as Vt, legacyWorkbuddyOwnAuthPath as W, pickVideoModel as Wt, APP_VERSION as X, WorkBuddyImageError as Xt, workbuddyVaultDir as Y, MAX_INPUT_IMAGE_BYTES as Yt, BODY_OVERSIZE_MARKER as Z, imageDataUrl as Zt, createDeviceProfileLookup as _, deriveDeviceId as _n, isToolSchemaRejectBody as _t, readHostHeartbeat as a, sniffImageMime as an, classifyUpstreamError as at, readDeviceSettings as b, protectCredentialDirectory as bn, openingEvidenceOfBody as bt, WORKBUDDY_CONNECT_VERSION as c, pruneTempDir as cn, deriveStableConversationId as ct, rosterSeenPath as d, isRouterModelId as dn, growthHostOf as dt, imageSizeLimitsOf as en, DEFAULT_WIRE_PROFILE as et, WORKBUDDY_CN_BASE_ENV as f, nativeModalityOf as fn, isBodyOversizeRefusal as ft, createTuringSdk as g, readDeviceSalt as gn, isFirstMessageGateBody as gt, createDeviceSdkPort as h, ensureDeviceSalt as hn, isCredentialRejectedError as ht, processStartTimeMs as i, pickMediaModel as in, channelGateMemberOf as it, ENCRYPTED_CREDENTIAL_CODE as j, macosNestedAppBundles as jn, promoBadgeTone as jt, fallbackModelsFor as k, isWorkbuddyBundle as kn, toolSchemaRejectAdvice as kt, createFileRosterSeenStore as l, NATIVE_MODALITY_BY_MODEL_ID as ln, describeRequestHeaderNames as lt, piAiRuntimeInfo as m, readDeviceTokenFile as mn, isConversationIdGateBody as mt, clearHostHeartbeat as n, isWatermarkFreeImageModel as nn, WorkBuddyCredentialRejectedError as nt, workbuddyHostHeartbeatPath as o, parseQueueAnswer as on, conversationIdFromSessionId as ot, resolveCnGateway as p, WORKBUDDY_DEVICE_TOKEN_FILE_ENV as pn, isContextTooLongBody as pt, workbuddyAccountId as q, IMAGE_TAG_IMAGE_TO_IMAGE as qt, isHeartbeatProcessAlive as r, parseImageDataUrl as rn, WorkBuddyUpstreamClient as rt, writeHostHeartbeat as s, queueNoticeText as sn, declaredTools as st, WORKBUDDY_HOST_HEARTBEAT_FILENAME as t, isBareBase64Image as tn, WORKBUDDY_FALLBACK_SYSTEM_PROMPT as tt, describeRosterSeenPayload as u, imageDefaultFor as un, forceNeutralHead as ut, describeDerivedDevices as v, isDeviceId as vn, knownRegionOf as vt, FALLBACK_WORKBUDDY_MODELS as w, deriveAtRestKeyId as wn, perturbChannelFingerprints as wt, saveDeviceProfile as x, WORKBUDDY_APP_EXECUTABLE_ENV as xn, parseCreditMultiplier as xt, isDeviceMode as y, inspectCredentialDirectory as yn, modelIdOfBody as yt, defaultDesktopAuthDirs as z, withEffectiveOff as zt };
|