dsh-connect-workbuddy 5.20.2 → 5.21.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/lib/client.js CHANGED
@@ -600,6 +600,29 @@ window.__ModuleLoader__.load({
600
600
  });
601
601
  }
602
602
  /**
603
+ * Build the next `regions` settings value for the new-model-segment opt-in.
604
+ *
605
+ * Same merge rule as everything else here: ONLY the target region's flag
606
+ * changes, so the directory, the model selection, the credit switches and the
607
+ * sibling region all survive the write.
608
+ */
609
+ function nextRegionNewModelsShown(value, region, shown) {
610
+ return nextRegionSlots(regionsMapOf(value), region, {
611
+ ...regionSlotOf(value, region),
612
+ showNewModelsInMainUi: shown
613
+ });
614
+ }
615
+ /**
616
+ * Read the new-model-segment opt-in: ON only when explicitly `true`.
617
+ *
618
+ * The mirror image of {@link regionCreditsShownOf}, and deliberately so. That
619
+ * one is opt-OUT (`!== false`), this one is opt-IN (`=== true`), because
620
+ * announcing "N new models" on a fresh install announces the entire roster.
621
+ */
622
+ function regionNewModelsShownOf(value, region) {
623
+ return regionSlotOf(value, region)["showNewModelsInMainUi"] === true;
624
+ }
625
+ /**
603
626
  * Build the next `regions` settings value for the image-tool opt-in.
604
627
  *
605
628
  * Same merge rule: ONLY the target region's flag changes, so the directory,
@@ -969,7 +992,7 @@ window.__ModuleLoader__.load({
969
992
  }
970
993
  if (delivered) {
971
994
  const after = scope.getSnapshot().value;
972
- if (field === "usageIdentity" || field === "keepPromptLast" ? upstreamSwitchOf(after, field) === value : field === "sessionTitle" ? JSON.stringify(sessionTitleOf(after)) === JSON.stringify(value) : field === "channelRejectContinue" ? JSON.stringify(channelRejectContinueOf(after)) === JSON.stringify(value) : JSON.stringify(extraInjectedPrefixesOf(after)) === JSON.stringify([...value])) return;
995
+ if (field === "usageIdentity" || field === "keepPromptLast" || field === "dropAllThinking" ? upstreamSwitchOf(after, field) === value : field === "sessionTitle" ? JSON.stringify(sessionTitleOf(after)) === JSON.stringify(value) : field === "channelRejectContinue" ? JSON.stringify(channelRejectContinueOf(after)) === JSON.stringify(value) : JSON.stringify(extraInjectedPrefixesOf(after)) === JSON.stringify([...value])) return;
973
996
  }
974
997
  throw hostError instanceof Error ? hostError : new WorkBuddySettingsWriteError(field, "neither the Host save endpoint nor the settings scope persisted the value");
975
998
  }
@@ -1410,6 +1433,19 @@ window.__ModuleLoader__.load({
1410
1433
  });
1411
1434
  }
1412
1435
  /**
1436
+ * Write one region's new-model-segment opt-in, verifying it landed.
1437
+ *
1438
+ * Sibling of {@link writeRegionCreditsShown}: same whole-slot merge, same
1439
+ * landed check. The landed check reads `=== shown`, so an explicit `false`
1440
+ * (the default) verifies just as strictly as a `true`.
1441
+ */
1442
+ async function writeRegionNewModelsShown(scope, region, shown, slot) {
1443
+ await writeField(scope, "regions", region, slot, (readBack) => {
1444
+ const stored = readBack;
1445
+ return stored !== null && stored !== void 0 && stored["showNewModelsInMainUi"] === shown;
1446
+ });
1447
+ }
1448
+ /**
1413
1449
  * Write one region's credit SEAT (issue #62), verifying it landed.
1414
1450
  *
1415
1451
  * Sibling of {@link writeRegionCreditsShown}: same whole-slot merge, same
@@ -2024,13 +2060,18 @@ window.__ModuleLoader__.load({
2024
2060
  * measurement and no exclusion is simply unknown, and inventing "可用" for it
2025
2061
  * would be a claim nobody made.
2026
2062
  *
2027
- * The retry wording has three states, matching the card's three:
2028
- * - a stated instant → "被限流 · 10/19 01:32 之后可再用"
2029
- * - no instant but a timed → "被限流 · 未提供恢复时间"
2063
+ * The retry wording has four states, matching the card's four:
2064
+ * - a stated instant still ahead → "被限流 · 10/19 01:32 之后可再用 · 约 6 小时后"
2065
+ * - a stated instant ALREADY past, on a WAIT-AND-SEE cooldown (rate-limited,
2066
+ * model-busy) → NOTHING at all: no verdict (it has expired), no instant (it is
2067
+ * behind us), and no chore for the reader. The dot already answers the
2068
+ * question, and the card re-tests that one account by itself. Other outcomes
2069
+ * that happen to carry a past instant keep their verdict and drop the instant
2070
+ * - no instant but a timed → "被限流 · 未提供恢复时间"
2030
2071
  * exclusion
2031
- * - any other outcome → the bare outcome ("连不上上游")
2072
+ * - any other outcome → the bare outcome ("连不上上游")
2032
2073
  *
2033
- * That third case is deliberate: "未提供恢复时间" beside a credential rejection
2074
+ * That last case is deliberate: "未提供恢复时间" beside a credential rejection
2034
2075
  * would imply waiting helps, when the only fix is signing in again.
2035
2076
  */
2036
2077
  function availabilityLine(t, account, nowMs = Date.now()) {
@@ -2039,8 +2080,9 @@ window.__ModuleLoader__.load({
2039
2080
  if (probe.outcome === "ok") return outcomeText(t, probe.outcome);
2040
2081
  if (probe.retryAtMs !== void 0) {
2041
2082
  const left = remainingText(t, probe.retryAtMs, nowMs);
2083
+ if (left === "") return probe.outcome === "rate-limited" || probe.outcome === "model-busy" ? void 0 : outcomeText(t, probe.outcome);
2042
2084
  const at = t("row.poolRetryAt", { at: formatShortClock(probe.retryAtMs) });
2043
- return `${outcomeText(t, probe.outcome)} · ${at}${left === "" ? "" : ` · ${left}`}`;
2085
+ return `${outcomeText(t, probe.outcome)} · ${at} · ${left}`;
2044
2086
  }
2045
2087
  if (probe.outcome === "rate-limited" || probe.outcome === "model-busy" || probe.outcome === "out-of-credit") return `${outcomeText(t, probe.outcome)} · ${t("row.poolRetryUnknown")}`;
2046
2088
  return outcomeText(t, probe.outcome);
@@ -2068,7 +2110,8 @@ window.__ModuleLoader__.load({
2068
2110
  if (probe.outcome === "ok") return outcomeMarkText(t, probe.outcome);
2069
2111
  if (probe.retryAtMs !== void 0) {
2070
2112
  const left = recoversInText(t, probe.retryAtMs, nowMs);
2071
- return left === "" ? outcomeMarkText(t, probe.outcome) : `${outcomeMarkText(t, probe.outcome)} · ${left}`;
2113
+ if (left !== "") return `${outcomeMarkText(t, probe.outcome)} · ${left}`;
2114
+ return probe.outcome === "rate-limited" || probe.outcome === "model-busy" ? void 0 : outcomeMarkText(t, probe.outcome);
2072
2115
  }
2073
2116
  if (probe.outcome === "rate-limited" || probe.outcome === "model-busy" || probe.outcome === "out-of-credit") return `${outcomeMarkText(t, probe.outcome)} · ${t("row.poolRetryUnknown")}`;
2074
2117
  return outcomeMarkText(t, probe.outcome);
@@ -2102,7 +2145,9 @@ window.__ModuleLoader__.load({
2102
2145
  * `error` is separate from `warn` because the advice differs: one means "wait",
2103
2146
  * the other means "do something".
2104
2147
  */
2105
- function stateTone(account) {
2148
+ function stateTone(account, nowMs = Date.now()) {
2149
+ const probe = account.probe;
2150
+ if (probe !== void 0 && probe.retryAtMs !== void 0 && probe.retryAtMs <= nowMs && (probe.outcome === "rate-limited" || probe.outcome === "model-busy")) return account.excludedBy === void 0 ? "unknown" : "warn";
2106
2151
  if (account.excludedBy !== void 0) return account.excludedBy === "rate-limited" || account.excludedBy === "model-busy" || account.excludedBy === "unavailable" ? "warn" : "error";
2107
2152
  if (account.probe === void 0) return "unknown";
2108
2153
  return outcomeOk(account.probe.outcome) ? "ok" : "warn";
@@ -2115,8 +2160,8 @@ window.__ModuleLoader__.load({
2115
2160
  * edited. The pool table draws a dot from a computed colour, so it needs a value
2116
2161
  * rather than a class name.
2117
2162
  */
2118
- function stateColor(account) {
2119
- switch (stateTone(account)) {
2163
+ function stateColor(account, nowMs = Date.now()) {
2164
+ switch (stateTone(account, nowMs)) {
2120
2165
  case "ok": return "var(--dsw-alias-state-success-primary, #22a06b)";
2121
2166
  case "warn": return "var(--dsw-alias-state-warn-primary, #f59e0b)";
2122
2167
  case "error": return "var(--dsw-alias-state-error-primary, #ef4444)";
@@ -3105,6 +3150,19 @@ window.__ModuleLoader__.load({
3105
3150
  if (running !== void 0) return running;
3106
3151
  return sorted.find((promo) => promo.badge.display !== "activeOnly" && promoWithinAbsoluteWindow(promo, nowMs) && promo.schedule?.dailyUnusable !== true);
3107
3152
  }
3153
+ /**
3154
+ * The chip's colour, when the upstream published a usable one.
3155
+ *
3156
+ * Only a hex colour is accepted: the value reaches an inline style, and the
3157
+ * upstream's feed publishes hex (`#009273`, `#FF0000`). Anything else is
3158
+ * refused rather than passed through, and the card falls back to its own
3159
+ * brand colour.
3160
+ */
3161
+ function promoBadgeColor(promo) {
3162
+ const color = promo.badge.color;
3163
+ if (color === void 0) return void 0;
3164
+ return /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(color) ? color : void 0;
3165
+ }
3108
3166
  "WorkBuddy/5.8.3 WorkBuddy/5.8.3 CLI/2.161.0".match(/WorkBuddy\/([^\s]+)/u)?.[1];
3109
3167
  new RegExp(`^(?:<acp\\b[^>]*>m\\d{1,8}<\\/acp>[ \\t]*\\r?\\n?)*(?:Time sampled while preparing turn \\d+, step \\d+:|Current runtime context\\.|<system-reminder>|\\[Compressed conversation section\\]|This is an efficiency nudge)`, "u");
3110
3168
  //#endregion
@@ -3877,6 +3935,56 @@ window.__ModuleLoader__.load({
3877
3935
  t
3878
3936
  ]);
3879
3937
  /**
3938
+ * RE-TEST THE ONE ACCOUNT WHOSE STATED COOLDOWN HAS RUN OUT — by itself, once.
3939
+ *
3940
+ * The row used to print 「被限流 · 限流时段已过 · 重新测试以确认」: a verdict, a
3941
+ * note that the verdict had expired, and a chore for the reader, in one line
3942
+ * that contradicted itself. The owner's answer was that the plugin should
3943
+ * simply measure that single account rather than write such a sentence, so
3944
+ * this does exactly that: one account, one request, no click.
3945
+ *
3946
+ * WHY AN EFFECT rather than a decision taken while rendering: `runRowTest` is
3947
+ * async and writes state, and a render must never start requests. Running after
3948
+ * the snapshot has been painted means the row first shows the honest
3949
+ * 「恢复时间已到 · 待复核」, which the new measurement then replaces.
3950
+ *
3951
+ * ONCE PER ACCOUNT PER MOUNT. The old record keeps being rendered until the new
3952
+ * one lands, so without `autoRetested` every re-render in that window would
3953
+ * fire another test, and a pool of limited accounts would hammer the upstream.
3954
+ * A FAILED re-test is final too: the row keeps its stale record instead of
3955
+ * looping on a route that is refusing.
3956
+ *
3957
+ * ONE AT A TIME. Any write in flight — a batch, a removal, another row's test —
3958
+ * returns early; the next candidate is picked on the render after the previous
3959
+ * one has flipped its own probe. Firing them together would race the refresh
3960
+ * each of them triggers (the same reason the batch is serialized).
3961
+ */
3962
+ const autoRetested = (0, react.useRef)(/* @__PURE__ */ new Set());
3963
+ (0, react.useEffect)(() => {
3964
+ if (!mounted.current || pool === void 0 || !active.enabled) return;
3965
+ if (rowBusyAccountId !== void 0 || busy !== void 0) return;
3966
+ if (pool.targetModelSource === "none" || pool.targetModelSource === "stale") return;
3967
+ const now = Date.now();
3968
+ for (const account of pool.accounts) {
3969
+ if (!active.memberAccountIds.includes(account.accountId)) continue;
3970
+ const probe = account.probe;
3971
+ if (probe === void 0 || probe.retryAtMs === void 0) continue;
3972
+ if (probe.outcome !== "rate-limited" && probe.outcome !== "model-busy") continue;
3973
+ if (probe.retryAtMs > now) continue;
3974
+ if (autoRetested.current.has(account.accountId)) continue;
3975
+ autoRetested.current.add(account.accountId);
3976
+ runRowTest(account.accountId);
3977
+ return;
3978
+ }
3979
+ }, [
3980
+ active.enabled,
3981
+ active.memberAccountIds,
3982
+ busy,
3983
+ pool,
3984
+ rowBusyAccountId,
3985
+ runRowTest
3986
+ ]);
3987
+ /**
3880
3988
  * Claim ONE benefit on ONE account, from its row (issue #79).
3881
3989
  *
3882
3990
  * Always a single account and a single campaign: there is no batch entry
@@ -4103,7 +4211,7 @@ window.__ModuleLoader__.load({
4103
4211
  visible: true,
4104
4212
  message: t("row.poolSaving"),
4105
4213
  hint: t("row.veilHintList")
4106
- }) : null, (0, react.createElement)("div", { className: "dsm-workbuddy-pool-head" }, (0, react.createElement)("h3", { className: "dsm-workbuddy-pool-title" }, t("row.poolTitle")), manualPicker !== null ? manualPicker : currentName === void 0 ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-current-badge" }, t("row.poolCurrentHeader", { account: currentName }))), (0, react.createElement)("div", { className: "dsm-workbuddy-pool-settings dsm-workbuddy-pool-modebar" }, (0, react.createElement)("div", { className: "dsm-workbuddy-pool-modebar-row" }, (0, react.createElement)("label", { className: "sw" }, (0, react.createElement)("input", {
4214
+ }) : null, (0, react.createElement)("div", { className: "dsm-workbuddy-pool-head" }, (0, react.createElement)("h3", { className: "dsm-workbuddy-pool-title" }, t("row.poolTitle")), (0, react.createElement)("p", { className: "dsm-workbuddy-free-quota-warn" }, t("row.tabFreeQuotaWarn")), manualPicker !== null ? manualPicker : currentName === void 0 ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-current-badge" }, t("row.poolCurrentHeader", { account: currentName }))), (0, react.createElement)("div", { className: "dsm-workbuddy-pool-settings dsm-workbuddy-pool-modebar" }, (0, react.createElement)("div", { className: "dsm-workbuddy-pool-modebar-row" }, (0, react.createElement)("label", { className: "sw" }, (0, react.createElement)("input", {
4107
4215
  type: "checkbox",
4108
4216
  checked: active.enabled,
4109
4217
  disabled: !canEditPool,
@@ -4181,7 +4289,7 @@ window.__ModuleLoader__.load({
4181
4289
  changeDeviceMode(mode);
4182
4290
  }
4183
4291
  }, t(mode === "virtual" ? "row.deviceModeVirtual" : "row.deviceModeReal"));
4184
- })), (0, react.createElement)("span", { className: "dsm-workbuddy-hint" }, modeHintBlocked ? t("row.deviceModeRealUnsupported") : deviceMode === "real" ? t("row.deviceModeHintReal") : t("row.deviceModeHintVirtual"))), (0, react.createElement)("div", { className: `dsm-workbuddy-pool-table${pool.checkinSupported ? " dsm-workbuddy-pool-table-checkin" : ""}` }, (0, react.createElement)("div", { className: "dsm-workbuddy-pool-row dsm-workbuddy-pool-row-head" }, (0, react.createElement)("span", { className: "dsm-workbuddy-pool-col-account" }, t("row.poolColumnAccount")), (0, react.createElement)("span", null, t("row.poolColumnCredits")), (0, react.createElement)("span", null, t("row.poolColumnProbe")), pool.checkinSupported ? (0, react.createElement)("span", null, t("row.poolColumnCheckin")) : null, (0, react.createElement)("span", null)), ...(() => {
4292
+ })), (0, react.createElement)("span", { className: "dsm-workbuddy-hint" }, modeHintBlocked ? t("row.deviceModeRealUnsupported") : deviceMode === "real" ? t("row.deviceModeHintReal") : t("row.deviceModeHintVirtual"))), (0, react.createElement)("div", { className: `dsm-workbuddy-pool-table${pool.checkinSupported ? " dsm-workbuddy-pool-table-checkin" : ""}` }, (0, react.createElement)("div", { className: "dsm-workbuddy-pool-row dsm-workbuddy-pool-row-head" }, (0, react.createElement)("span", { className: "dsm-workbuddy-pool-col-account" }, t("row.poolColumnAccount")), (0, react.createElement)("span", { className: "dsm-workbuddy-pool-col-credits" }, t("row.poolColumnCredits")), (0, react.createElement)("span", { className: "dsm-workbuddy-pool-col-probe" }, t("row.poolColumnProbe")), pool.checkinSupported ? (0, react.createElement)("span", { className: "dsm-workbuddy-pool-col-checkin" }, t("row.poolColumnCheckin")) : null, (0, react.createElement)("span", { className: "dsm-workbuddy-pool-col-actions" })), ...(() => {
4185
4293
  const ordered = sortAccountsByOrder(pool.accounts, orderIds);
4186
4294
  let memberSeen = 0;
4187
4295
  let memberTotal = 0;
@@ -4329,7 +4437,24 @@ window.__ModuleLoader__.load({
4329
4437
  const name = account.accountName === "" ? t("row.accountUnnamed") : account.accountName;
4330
4438
  const excluded = exclusionText(t, account.excludedBy);
4331
4439
  const probe = account.probe;
4332
- const outcomeLine = availabilityLine(t, account) ?? t("row.poolNeverTested");
4440
+ /**
4441
+ * Would the exclusion label say what line two already says?
4442
+ *
4443
+ * Both facts come from the SAME measurement: `excludedBy` is derived from the
4444
+ * probe, so for every outcome that doubles as an exclusion reason (rate-limited,
4445
+ * model-busy, out-of-credit, credential-rejected, account-restricted,
4446
+ * unavailable, not-found, failed) the label is a second copy of the verdict a
4447
+ * few pixels away. Comparing the REASON CODE, not the translated string: the
4448
+ * string comparison this replaces covered only `rate-limited`, so 「模型繁忙 ·
4449
+ * … · 模型繁忙」 and 「积分用尽 · … · 积分用尽」 still printed the verdict twice —
4450
+ * and it would have silently un-fixed itself on the next wording change.
4451
+ *
4452
+ * With no probe at all the label is not duplicated but REUSED: `availabilityLine`
4453
+ * falls back to exactly this text.
4454
+ */
4455
+ const excludedRepeatsVerdict = excluded === void 0 || probe === void 0 || probe.outcome === account.excludedBy;
4456
+ const measuredButSilent = probe !== void 0 && availabilityLine(t, account) === void 0;
4457
+ const outcomeLine = availabilityLine(t, account) ?? (probe === void 0 ? t("row.poolNeverTested") : void 0);
4333
4458
  const reason = probe === void 0 ? void 0 : inlineProbeReason(probe.outcome, probe.message);
4334
4459
  const age = probe === void 0 ? void 0 : probeAgeText(t, probe.atMs, Date.now());
4335
4460
  const probeLabel = probe === void 0 ? void 0 : probe.source === void 0 ? {
@@ -4375,7 +4500,7 @@ window.__ModuleLoader__.load({
4375
4500
  "aria-label": t("row.poolMoveDownAria", { accountName: name }),
4376
4501
  disabled: moveDownDisabled,
4377
4502
  onClick: onMoveDown
4378
- }, "↓")) : 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")), excluded === void 0 ? probe === void 0 ? null : (0, react.createElement)("span", null, t("row.poolTestedAt", { at: formatShortClock(probe.atMs) })) : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-excluded" }, excluded))), (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) })) : account.nearestExpiryMs === void 0 ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-soon-plain" }, t("row.poolCreditNearest", { at: formatShortClock(account.nearestExpiryMs) })), 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", {
4503
+ }, "↓")) : 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.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", {
4379
4504
  key: benefit.kind,
4380
4505
  className: benefit.urgent ? "dsm-workbuddy-pool-benefit dsm-workbuddy-pool-benefit-urgent" : "dsm-workbuddy-pool-benefit"
4381
4506
  }, 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", {
@@ -4401,7 +4526,13 @@ window.__ModuleLoader__.load({
4401
4526
  }, (0, react.createElement)("span", null, claimBusy && rowBusyAction === "claim" ? t("row.poolBenefitClaiming") : t("row.poolBenefitClaim"))))))), (0, react.createElement)("span", {
4402
4527
  className: "dsm-workbuddy-pool-probe",
4403
4528
  ...probe?.message === void 0 ? {} : { title: probe.message }
4404
- }, (0, react.createElement)("span", { className: "dsm-workbuddy-pool-probe-main" }, probeLine), probeLabel === void 0 && age === void 0 ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-probe-prov" }, probeLabel === void 0 ? null : (0, react.createElement)("span", { className: probeLabel.className }, probeLabel.text), probeLabel === void 0 || age === void 0 ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-prov-sep" }, "·"), age === void 0 ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-prov-age" }, age), probe !== void 0 && probe.modelId !== poolModelId ? (0, react.createElement)("span", { className: "dsm-workbuddy-pool-prov-model" }, 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", {
4529
+ }, (0, react.createElement)("span", { className: "dsm-workbuddy-pool-probe-line" }, measuredButSilent ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-probe-main" }, probeLine), excludedRepeatsVerdict || excluded === void 0 ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-probe-sep" }, "·"), excludedRepeatsVerdict ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-excluded" }, excluded), probe === void 0 || measuredButSilent && excludedRepeatsVerdict ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-probe-sep" }, "·"), probe === void 0 ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-tested-at" }, t("row.poolTestedAt", { at: formatShortClock(probe.atMs) }))), probeLabel === void 0 && age === void 0 ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-probe-prov" }, probeLabel === void 0 ? null : (0, react.createElement)("span", { className: probeLabel.className }, probeLabel.text), probeLabel === void 0 || age === void 0 ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-prov-sep" }, "·"), age === void 0 ? null : (0, react.createElement)("span", { className: "dsm-workbuddy-pool-prov-age" }, age), probe !== void 0 && probe.modelId !== poolModelId ? [(0, react.createElement)("span", {
4530
+ key: "sep",
4531
+ className: "dsm-workbuddy-pool-prov-sep"
4532
+ }, "·"), (0, react.createElement)("span", {
4533
+ key: "model",
4534
+ className: "dsm-workbuddy-pool-prov-model"
4535
+ }, 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", {
4405
4536
  className: "dsm-workbuddy-pool-unknown",
4406
4537
  title: t("row.poolNeverTested")
4407
4538
  }, t("row.poolCheckinUnknown")) : account.checkedInToday ? (0, react.createElement)("span", { className: "dsm-workbuddy-pool-checked" }, t("row.poolCheckedIn")) : t("row.poolNotCheckedIn")) : null, (0, react.createElement)("span", { className: "dsm-workbuddy-pool-row-actions" }, onEditDevice === void 0 ? null : (0, react.createElement)("button", {
@@ -5634,6 +5765,27 @@ window.__ModuleLoader__.load({
5634
5765
  });
5635
5766
  }
5636
5767
  };
5768
+ /**
5769
+ * Turn a transport-level failure into something a person can act on.
5770
+ *
5771
+ * `fetch()` rejects with a bare `TypeError: Failed to fetch` whenever no HTTP
5772
+ * response arrives at all — the connection was reset, or the text could not be
5773
+ * posted. Rendered verbatim that reads like a bug in the plugin (issue #229:
5774
+ * the user saw "传输失败:Failed to fetch" and had nothing to go on). The two
5775
+ * causes worth naming are a file too large to upload and a local service that
5776
+ * is not answering; anything else keeps its own message, which is more
5777
+ * informative than a generic one.
5778
+ *
5779
+ * Note this is the CLIENT's guess: the server now answers 413 for an oversized
5780
+ * body, so a size problem usually arrives as a normal error response and never
5781
+ * reaches here. This path is what is left when the request dies before an
5782
+ * answer — which is also what a half-open local port looks like.
5783
+ */
5784
+ const transportMessage = (error, text) => {
5785
+ if (!(error instanceof TypeError)) return error instanceof Error ? error.message : String(error);
5786
+ const kilobytes = Math.round(new Blob([text]).size / 1024);
5787
+ return t("row.transferNoService", { size: String(kilobytes) });
5788
+ };
5637
5789
  const readImportFile = async (file) => {
5638
5790
  setPhase({ kind: "importing" });
5639
5791
  try {
@@ -5663,7 +5815,7 @@ window.__ModuleLoader__.load({
5663
5815
  } catch (error) {
5664
5816
  if (mounted.current) setPhase({
5665
5817
  kind: "error",
5666
- message: error instanceof Error ? error.message : String(error)
5818
+ message: transportMessage(error, importText.current)
5667
5819
  });
5668
5820
  }
5669
5821
  };
@@ -6171,7 +6323,8 @@ window.__ModuleLoader__.load({
6171
6323
  * that run in a plain Node environment, where it does not exist.
6172
6324
  */
6173
6325
  function uiLanguage() {
6174
- return typeof navigator === "undefined" ? "" : navigator.language;
6326
+ if (typeof navigator === "undefined") return "";
6327
+ return navigator.language ?? "";
6175
6328
  }
6176
6329
  /** Whether the given language is an English one. */
6177
6330
  function isEnglish(language) {
@@ -6212,11 +6365,6 @@ window.__ModuleLoader__.load({
6212
6365
  * refused rather than passed through, and the card falls back to its own
6213
6366
  * brand colour.
6214
6367
  */
6215
- function promoBadgeColor(promo) {
6216
- const color = promo.badge.color;
6217
- if (color === void 0) return void 0;
6218
- return /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(color) ? color : void 0;
6219
- }
6220
6368
  /**
6221
6369
  * A calendar day, in the user's own locale — read in the ZONE the upstream
6222
6370
  * wrote the instant in.
@@ -6317,6 +6465,318 @@ window.__ModuleLoader__.load({
6317
6465
  */
6318
6466
  const WORKBUDDY_PLUGIN_ICON = "data:image/png;base64,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";
6319
6467
  //#endregion
6468
+ //#region src/client/plugin-icon.tsx
6469
+ const storageKey = "dsh-connect-workbuddy.icon-style";
6470
+ const changeEvent = storageKey + ".changed";
6471
+ /**
6472
+ * OUR OWN ICON IS THE DEFAULT.
6473
+ *
6474
+ * The visitor who opens the card never asked for a different glyph: the LD mark is
6475
+ * what the sidebar, the page header and the panel drew before this preference
6476
+ * existed, and it is the shape this plugin is recognised by. An alternate skin is
6477
+ * a CHOICE, so it has to be chosen — shipping the alternate as the default would
6478
+ * repaint an identity the user never asked to change, which is the same mistake as
6479
+ * a plugin rewriting another plugin's label.
6480
+ *
6481
+ * `'original'` is therefore also the fallback for a browser that stores nothing
6482
+ * (`getItem` throws behind a blocked-storage policy) and the value the server
6483
+ * snapshot reports, so the first paint and the hydrated paint agree.
6484
+ */
6485
+ const DEFAULT_ICON_STYLE = "original";
6486
+ /** The other one, derived so the default is stated exactly ONCE. */
6487
+ const ALTERNATE_ICON_STYLE = "claude";
6488
+ /**
6489
+ * Appearance is local to this browser; account and provider settings are untouched.
6490
+ *
6491
+ * Everything is derived from {@link DEFAULT_ICON_STYLE} rather than repeating the
6492
+ * literal, and that is not tidiness: an earlier draft compared against the stored
6493
+ * 'claude' and returned 'claude' when storage was empty, so flipping the exported
6494
+ * default changed nothing at all — the constant looked like the decision while the
6495
+ * two literals beside it were. The test that pins the default could not catch it,
6496
+ * which is how the duplicate survived.
6497
+ */
6498
+ function iconStyleSnapshot() {
6499
+ try {
6500
+ return window.localStorage.getItem(storageKey) === ALTERNATE_ICON_STYLE ? ALTERNATE_ICON_STYLE : DEFAULT_ICON_STYLE;
6501
+ } catch {
6502
+ return DEFAULT_ICON_STYLE;
6503
+ }
6504
+ }
6505
+ function subscribe(listener) {
6506
+ const onStorage = (event) => {
6507
+ if (event.key === storageKey || event.key === null) listener();
6508
+ };
6509
+ window.addEventListener(changeEvent, listener);
6510
+ window.addEventListener("storage", onStorage);
6511
+ return () => {
6512
+ window.removeEventListener(changeEvent, listener);
6513
+ window.removeEventListener("storage", onStorage);
6514
+ };
6515
+ }
6516
+ function setIconStyle(value) {
6517
+ window.localStorage.setItem(storageKey, value);
6518
+ window.dispatchEvent(new Event(changeEvent));
6519
+ }
6520
+ function PluginIcon(props) {
6521
+ const saved = (0, react.useSyncExternalStore)(subscribe, iconStyleSnapshot, () => DEFAULT_ICON_STYLE);
6522
+ const variant = props.variant ?? saved;
6523
+ const shared = {
6524
+ className: props.className,
6525
+ width: props.size ?? 16,
6526
+ height: props.size ?? 16,
6527
+ style: {
6528
+ ...props.style,
6529
+ flexShrink: 0
6530
+ },
6531
+ "aria-hidden": true
6532
+ };
6533
+ if (variant === "original") return (0, react.createElement)("img", {
6534
+ ...shared,
6535
+ src: WORKBUDDY_PLUGIN_ICON,
6536
+ alt: ""
6537
+ });
6538
+ return (0, react.createElement)("svg", {
6539
+ ...shared,
6540
+ viewBox: "0 0 24 24",
6541
+ fill: "currentColor",
6542
+ "data-icon-style": "claude",
6543
+ "data-plugin-icon": "workbuddy"
6544
+ }, (0, react.createElement)("path", { d: "M4.5 5.5h3v11h3l3-3v4l-2 2h-7z" }), (0, react.createElement)("path", { d: "M10.5 5.5H15a7 7 0 0 1 0 14h-2v-3h2a4 4 0 0 0 0-8h-1.5v2l-3 3z" }));
6545
+ }
6546
+ /** Each choice previews the real icon and immediately persists its selection. */
6547
+ function IconStylePreference({ t }) {
6548
+ const selected = (0, react.useSyncExternalStore)(subscribe, iconStyleSnapshot, () => DEFAULT_ICON_STYLE);
6549
+ const [error, setError] = (0, react.useState)(false);
6550
+ return (0, react.createElement)("div", { className: "dsm-icon-preference" }, (0, react.createElement)("div", { className: "dsm-icon-preference-copy" }, (0, react.createElement)("b", null, t("row.iconStyleLabel")), (0, react.createElement)("span", null, t("row.iconStyleHint"))), (0, react.createElement)("div", {
6551
+ className: "dsm-icon-choices",
6552
+ role: "radiogroup",
6553
+ "aria-label": t("row.iconStyleLabel")
6554
+ }, ...["original", "claude"].map((variant) => (0, react.createElement)("button", {
6555
+ key: variant,
6556
+ type: "button",
6557
+ role: "radio",
6558
+ "aria-checked": selected === variant,
6559
+ tabIndex: selected === variant ? 0 : -1,
6560
+ onKeyDown: (event) => {
6561
+ if (![
6562
+ "ArrowLeft",
6563
+ "ArrowRight",
6564
+ "ArrowUp",
6565
+ "ArrowDown",
6566
+ "Home",
6567
+ "End"
6568
+ ].includes(event.key)) return;
6569
+ event.preventDefault();
6570
+ const next = event.key === "Home" ? "original" : event.key === "End" ? "claude" : variant === "original" ? "claude" : "original";
6571
+ try {
6572
+ setIconStyle(next);
6573
+ setError(false);
6574
+ (event.currentTarget.parentElement?.querySelectorAll("[role=radio]")[next === "original" ? 0 : 1])?.focus();
6575
+ } catch {
6576
+ setError(true);
6577
+ }
6578
+ },
6579
+ onClick: () => {
6580
+ try {
6581
+ setIconStyle(variant);
6582
+ setError(false);
6583
+ } catch {
6584
+ setError(true);
6585
+ }
6586
+ }
6587
+ }, (0, react.createElement)(PluginIcon, {
6588
+ variant,
6589
+ size: 20
6590
+ }), t(variant === "claude" ? "row.iconStyleClaude" : "row.iconStyleOriginal")))), error ? (0, react.createElement)("p", {
6591
+ role: "alert",
6592
+ className: "dsm-icon-save-error"
6593
+ }, t("row.iconStyleSaveFailed")) : null);
6594
+ }
6595
+ //#endregion
6596
+ //#region src/client/series-layout.ts
6597
+ /** 同系列的公共布局规则。两个桥接插件同步维护此文件,功能专属样式留在 styles.ts。 */
6598
+ function seriesLayoutCss(plugin) {
6599
+ const p = `.dsm-${plugin}`;
6600
+ const u = `${p}-usage`;
6601
+ const members = plugin === "trae" ? `${p}-pool-card` : `${p}-pool-members`;
6602
+ const memberHead = plugin === "trae" ? `${p}-pool-card-head` : `${p}-pool-members-head`;
6603
+ const memberTitle = plugin === "trae" ? `${p}-pool-card-title` : `${p}-pool-members-title`;
6604
+ const memberActions = plugin === "trae" ? `${p}-pool-card-tools` : `${p}-pool-members-actions`;
6605
+ const saveBar = plugin === "trae" ? `${p}-pool-save-row` : `${p}-pool-save-bar`;
6606
+ return `
6607
+ ${p}-page{font-family:inherit;--dsm-series-sticky-top:-28px}
6608
+ /* Doubled selector so this beats the host's own page rule — but NOT at the cost
6609
+ * of the settings surface, which shares the class and overrides its padding to 0
6610
+ * (see styles.ts: the Settings panel column is already padded and already
6611
+ * scrolls, so this page must not add padding of its own).
6612
+ *
6613
+ * The doubled class is (0,2,0) and a bare .dsm-workbuddy-settings is (0,1,0), so
6614
+ * the padding came back and ate 36px off EACH side of the settings column:
6615
+ * measured, the content column went 612px -> 540px, i.e. every card and the
6616
+ * account table were 72px narrower than they should be. The owner saw it before
6617
+ * any test could ("整体宽度变小了"). The :not() keeps the reach of the rule and
6618
+ * gives the settings surface its padding back. */
6619
+ ${p}-page${p}-page:not(${p}-settings){height:calc(100% - 16px);margin-bottom:16px;padding:28px clamp(24px,4vw,48px) 48px;gap:20px}
6620
+ ${u} ${p}-pool-auto-checkin-status{margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#777)}
6621
+ ${p}-page-desc{font-size:13px;line-height:20px;color:var(--dsw-alias-label-tertiary,#999)}
6622
+ ${u} ${p}-pool-auto-checkin{display:flex;flex-direction:column;gap:6px;margin-top:8px}
6623
+ /* 1120px, NOT the 860px the shared series layout shipped with.
6624
+ *
6625
+ * The page's own rule (styles.ts) has always been 1120px, and that is what the
6626
+ * cards, the account table and the settings block were laid out and measured
6627
+ * against. The series file narrowed the container to 860 as part of "unifying
6628
+ * spacing", which does not unify anything for this plugin: it simply made every
6629
+ * block on the page ~23% narrower, took the account table's columns with it, and
6630
+ * the owner saw it immediately ("整体宽度变小了,不行,要用原来的宽度").
6631
+ *
6632
+ * Kept as a SECOND declaration next to the page's own one ON PURPOSE: this file is
6633
+ * loaded after styles.ts (it is concatenated onto the same bundle), so it would
6634
+ * win the cascade. Stating the same 1120 here is what keeps the shared file from
6635
+ * silently re-narrowing the page the next time it is synced from trae. */
6636
+ ${p}-page>*{width:100%;max-width:1120px;min-width:0}
6637
+ ${u}{gap:16px;font-size:13px;line-height:1.5;min-width:0}
6638
+ ${u} .dsm-btn{box-sizing:border-box;font:inherit;font-size:13px;line-height:20px;padding:5px 14px;border-radius:8px;min-height:32px}
6639
+ ${u} .dsm-btn-outline{background:transparent;border-color:var(--dsw-alias-border-l2,#777);color:var(--dsw-alias-label-secondary,#999)}
6640
+ ${u} ${p}-tabs{display:flex;gap:8px}
6641
+ ${u} ${p}-tab-cell{flex:1;min-width:0;padding:8px 12px;border-radius:10px}
6642
+ ${u} ${p}-panels{position:sticky;top:var(--dsm-series-sticky-top,0px);z-index:2;display:flex;gap:2px;margin:0;padding:0;border-bottom:1px solid var(--dsw-alias-border-l1,#777);background:var(--dsw-alias-bg-layer-2,#24262c)}
6643
+ /* 吸顶背景覆盖卡片两侧内边距,顶部偏移抵消滚动容器的顶部内边距。 */
6644
+ ${p}-page-body ${u} ${p}-panels{margin-inline:0;padding:0 0 8px;border:0;border-bottom:1px solid var(--dsw-alias-border-l2,#777);border-radius:0;background:var(--dsw-alias-bg-layer-3,#202126)}
6645
+ ${p}-page[data-tabs-stuck="true"] ${p}-panels{margin-inline:-20px;padding-inline:20px;border-top:1px solid var(--dsw-alias-border-l2,#777);box-shadow:0 3px 6px rgba(0,0,0,.06)}
6646
+ ${u} ${p}-panel-tab{font-size:13px;font-weight:600;line-height:20px;padding:7px 11px}
6647
+ ${u} ${p}-panel{margin-top:0;min-width:0}
6648
+ ${u} ${p}-models-summary,${u} ${p}-panel-note{margin:2px 0 0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,#999)}
6649
+ ${u} ${p}-free-quota-warn{font-weight:600}
6650
+ /* 说明段落的间距由容器统一控制,避免与卡片的纵向 gap 叠加。 */
6651
+ ${u} ${p}-region-summary{display:flex;flex-direction:column;gap:2px}
6652
+ ${u} ${p}-region-summary ${p}-models-summary{margin:0}
6653
+ /* 说明与页签之间保留 8px,抵消外层 16px 间隔中多出的部分。 */
6654
+ ${u} ${p}-region-summary+${p}-panels{margin-top:-8px}
6655
+ /* 页签底边已经分隔账号区,不在账号池顶部重复画线。 */
6656
+ ${u} #dsm-${plugin}-panel-accounts ${p}-pool{border-top:0;padding-top:0}
6657
+
6658
+ ${u} ${p}-pool{display:flex;flex-direction:column;gap:12px;margin:0;padding:14px 0 0;border-top:1px solid var(--dsw-alias-border-l2,#777)}
6659
+ ${u} ${p}-pool-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
6660
+ ${u} ${p}-pool-title{margin:0;font-size:13px;font-weight:600;line-height:18px}
6661
+ ${u} ${plugin === "trae" ? `${p}-pool-current` : `${p}-pool-current-badge`}{margin-left:auto;max-width:100%;overflow-wrap:anywhere;white-space:normal;padding:2px 8px;border-radius:999px;border:1px solid var(--dsw-alias-border-l2,#777);font-size:11px;font-weight:500;line-height:16px;background:var(--dsw-alias-bg-layer-2,#24262c);color:var(--dsw-alias-label-secondary,#999)}
6662
+ ${u} ${p}-pool-settings${p}-pool-modebar{padding:12px 14px;gap:8px;border:1px solid var(--dsw-alias-border-l2,#777);border-radius:12px;background:color-mix(in srgb,var(--dsw-alias-brand-primary,#cf795b) 5%,var(--dsw-alias-bg-layer-2,#24262c))}
6663
+ ${u} ${p}-pool-modebar-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;min-height:20px}
6664
+ ${u} ${p}-pool-modebar-label{font-size:13px;font-weight:600;line-height:20px}
6665
+ ${u} ${p}-pool-modebar-state{padding:1px 9px;font-size:12px;line-height:18px;border-radius:999px;color:var(--dsw-alias-label-secondary,#999);border:1px solid var(--dsw-alias-border-l2,#777);background:var(--dsw-alias-bg-layer-2,#24262c)}
6666
+ ${u} ${p}-pool-note,${u} ${p}-pool-modebar ${p}-pool-note{margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,#999)}
6667
+ ${u} ${members}{display:flex;flex-direction:column;gap:0;min-width:0;border:1px solid var(--dsw-alias-border-l2,#777);border-radius:12px;background:var(--dsw-alias-bg-layer-2,#24262c);overflow:hidden}
6668
+ ${u} ${memberHead}{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;padding:14px 14px 12px}
6669
+ ${u} ${memberTitle}{margin:0;font-size:13px;font-weight:600;line-height:18px;color:var(--dsw-alias-label-primary,#eee)}
6670
+ ${u} ${memberHead} ${p}-pool-note{margin-top:4px}
6671
+ ${u} ${memberActions}{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
6672
+ ${u} ${memberActions} .dsm-btn{padding:5px 14px;font-size:13px;line-height:20px}
6673
+ ${u} ${p}-pool-count,${u} ${memberActions} ${p}-pool-hint{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,#999)}
6674
+ ${u} ${members} ${p}-pool-actions{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;padding:0 14px 12px}
6675
+ ${u} ${p}-pool-actions-end{margin-left:auto}
6676
+ ${u} ${members} ${p}-pool-action-note{margin:0;padding:0 14px 12px;font-size:12px;line-height:18px}
6677
+ ${u} ${members} ${p}-pool-table{border:0;border-top:1px solid var(--dsw-alias-border-l1,#777);border-radius:0}
6678
+ ${u} ${p}-pool-row{padding:10px 14px;align-items:start;font-size:13px;line-height:18px}
6679
+ ${u} ${p}-pool-row-head{padding:8px 14px;font-size:11px;line-height:16px;align-items:center}
6680
+ ${u} ${p}-pool-row-current{background:color-mix(in srgb,var(--dsw-alias-brand-primary,#cf795b) 5%,var(--dsw-alias-bg-layer-2,#24262c));box-shadow:inset 3px 0 0 var(--dsw-alias-brand-primary,#cf795b)}
6681
+ ${u} ${p}-pool-row-actions .dsm-btn{min-height:26px;padding:2px 10px;font-size:12px;line-height:20px}
6682
+ ${u} ${p}-pool-settings-wrap{display:flex;flex-direction:column;gap:10px;border-top:1px solid var(--dsw-alias-border-l2,#777);padding-top:14px}
6683
+ ${u} ${p}-pool-settings{border-radius:12px;gap:0}
6684
+ ${u} ${p}-pool-settings-wrap :is(h3,h4){margin:0;font-size:13px;font-weight:600;line-height:18px;color:var(--dsw-alias-label-primary,#eee)}
6685
+ ${u} ${p}-pool-set-ctl select{box-sizing:border-box;width:240px;min-width:0;max-width:100%}
6686
+ ${u} ${p}-pool-set{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 14px}
6687
+ ${u} ${p}-pool-set-copy{flex:1;min-width:0;gap:3px}
6688
+ ${u} ${p}-pool-set-copy b{font-size:13px;font-weight:500;line-height:18px}
6689
+ ${u} ${p}-pool-set-copy span{font-size:12px;line-height:18px}
6690
+ /* ONCE THE SETTINGS ROW STACKS, THE CONTROL TAKES THE WHOLE LINE.
6691
+ *
6692
+ * Two rules above do the stacking (this file's .pool-set is the flex row, the
6693
+ * plugin's own @container turns it into a column), and both of the things that
6694
+ * finish that move were being overridden here:
6695
+ *
6696
+ * - width:240px on the select — (0,2,1) beats the plugin's (0,1,0) width:100%,
6697
+ * so the dropdown stayed a 240px stub in a 612px column, sitting alone under its
6698
+ * label with ~180px of dead space on each side. The owner's screenshot:
6699
+ * 「这个应该 100%宽度啊」.
6700
+ * - align-items:center on .pool-set — (0,2,0) beats the @container's
6701
+ * align-items:stretch, so even a width:100% child would have been centred
6702
+ * at its intrinsic width rather than filling.
6703
+ *
6704
+ * Restated here rather than narrowed above, because this is the same direction the
6705
+ * plugin already declares and the file that wins the cascade has to say it too.
6706
+ * Specificity matches the base rules above ((0,2,0)/(0,2,1)) and these come later,
6707
+ * so they win by order. */
6708
+ @container (max-width:620px){
6709
+ ${u} ${p}-pool-set{flex-direction:column;align-items:stretch;gap:8px}
6710
+ ${u} ${p}-pool-set-ctl{flex:1 1 auto;justify-content:flex-start;max-width:100%;min-width:0}
6711
+ ${u} ${p}-pool-set-ctl select{width:100%;max-width:none;min-width:0}
6712
+ }
6713
+ ${u} ${p}-models-title{font-size:13px;line-height:18px;font-weight:600}
6714
+ ${u} ${p}-model-list{border-radius:12px}
6715
+ ${u} ${p}-model{padding:12px 14px;gap:8px}
6716
+ ${u} ${p}-model-name{font-size:13px;line-height:20px}
6717
+ ${u} ${p}-model-actions,${u} ${p}-pool-save-row{gap:12px;padding-top:12px}
6718
+ /* 保存栏以整个账号池为粘附范围,避免被更多设置的短父级截住。 */
6719
+ ${u} ${p}-pool-settings-wrap{display:contents}
6720
+ ${u} ${saveBar}{position:sticky;bottom:0;z-index:2;isolation:isolate;padding-bottom:12px;background:var(--dsw-alias-bg-layer-3,#202126)}
6721
+ /* 滚动容器底部的内边距也属于可见区域,负偏移让背景覆盖到视口底边。 */
6722
+ ${p}-page ${saveBar}{bottom:-48px}
6723
+ ${p}-page ${saveBar}[data-save-stuck="true"]{margin-inline:-20px;padding-inline:20px;border-top:1px solid var(--dsw-alias-border-l2,#777);border-bottom:1px solid var(--dsw-alias-border-l2,#777);border-radius:0;box-shadow:0 -3px 6px rgba(0,0,0,.06)}
6724
+
6725
+ ${u} #dsm-${plugin}-panel-capabilities:not([hidden]){display:flex;flex-direction:column;gap:14px}
6726
+ ${u} ${p}-prefs{gap:14px;padding:0}
6727
+ ${u} ${p}-pref{font-size:13px;line-height:18px;gap:10px}
6728
+ ${u} ${p}-pref-hint{font-size:12px;line-height:18px}
6729
+ ${u} ${p}-draw-image{margin:0;gap:10px;font-size:13px;line-height:18px}
6730
+ ${u} ${p}-draw-image>span{display:flex;flex-direction:column;gap:3px}
6731
+ ${u} ${p}-draw-image-hint{font-size:12px;line-height:18px}
6732
+ ${u} ${p}-pool-table{container-type:inline-size}
6733
+ ${u} ${p}-pool-current-tag{border:1px solid var(--dsw-alias-border-l2,#777);background:var(--dsw-alias-bg-layer-2,#24262c);color:var(--dsw-alias-label-secondary,#999)}
6734
+ /* The ≤700px RE-GRID OF THE POOL ROW IS DELIBERATELY ABSENT.
6735
+ *
6736
+ * The shared series layout used to switch the row to display:flex + flex-wrap:wrap,
6737
+ * hide the header and give the actions their own full-width line here. That is the
6738
+ * stacked form workbuddy REMOVED: the row is three lines at every width (identity +
6739
+ * credits / verdict + timestamp + check-in + buttons / provenance), and its narrow
6740
+ * concession is one detail — dropping the absolute timestamp where it cannot sit
6741
+ * beside the verdict — not a second layout.
6742
+ *
6743
+ * Copied over, those four rules cost the row its whole shape: measured in headless
6744
+ * Chrome at the 564px Settings column, the row went from 80px to 118px, the header
6745
+ * disappeared, and the buttons fell onto a line of their own. The two-class selectors
6746
+ * below would have outranked the row's own single-class rule, so nothing warned.
6747
+ *
6748
+ * The series layout keeps everything that is genuinely shared — sticky tabs, the
6749
+ * save bar, the paddings and control metrics — and leaves each plugin row to
6750
+ * itself. trae still ships its own stacked form in its own stylesheet. */
6751
+ /* 自动签到、设备参数和 SDK 是功能差异;沿用公共间距,不移除控件。 */
6752
+ ${u} ${p}-device-mode{margin:0;padding:0 14px 12px}
6753
+ ${u} ${p}-pool .sw{width:36px;height:20px}
6754
+ ${u} ${p}-pool .sw-track::after{top:2px;left:2px;width:16px;height:16px;background:var(--dsw-alias-bg-layer-3,#fff)}
6755
+ ${u} ${p}-pool .sw input:checked+.sw-track::after{transform:translateX(16px)}
6756
+ @media(max-width:600px){
6757
+ ${p}-page${p}-page{padding:20px 16px 32px;--dsm-series-sticky-top:-20px}
6758
+ ${p}-page ${saveBar}{bottom:-32px}
6759
+ ${u} ${memberHead}{align-items:flex-start}
6760
+ ${u} ${memberActions}{flex-wrap:wrap}
6761
+ ${u} ${p}-pool-set{flex-wrap:wrap}
6762
+ ${u} ${p}-pool-set-ctl{max-width:100%;flex-wrap:wrap}
6763
+ ${u} ${p}-pool-set-ctl select{min-width:0;max-width:100%}
6764
+ }
6765
+ `;
6766
+ }
6767
+ /** 根据页签与保存栏的实际吸附位置显示边界。 */
6768
+ function updateStickyTabs(page) {
6769
+ const tabs = page.querySelector("[role=\"tablist\"][class$=\"-panels\"]");
6770
+ const stuck = tabs !== null && page.scrollTop > 0 && tabs.getBoundingClientRect().top <= page.getBoundingClientRect().top + 1;
6771
+ page.dataset.tabsStuck = String(stuck);
6772
+ const viewportBottom = page.getBoundingClientRect().bottom;
6773
+ for (const bar of Array.from(page.querySelectorAll("[class$=\"-pool-save-row\"],[class$=\"-pool-save-bar\"]"))) {
6774
+ const visible = bar.getClientRects().length > 0;
6775
+ const bottom = Number.parseFloat(getComputedStyle(bar).bottom) || 0;
6776
+ bar.dataset.saveStuck = String(visible && Math.abs(bar.getBoundingClientRect().bottom + bottom - viewportBottom) <= 1);
6777
+ }
6778
+ }
6779
+ //#endregion
6320
6780
  //#region src/client/styles.ts
6321
6781
  /**
6322
6782
  * Client styles for the WorkBuddy plugin card.
@@ -6333,6 +6793,16 @@ window.__ModuleLoader__.load({
6333
6793
  * @module dsh-connect-workbuddy/client/styles
6334
6794
  */
6335
6795
  const WORKBUDDY_CARD_CSS = `
6796
+ .dsm-icon-preference{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;padding:12px 0;color:var(--dsw-alias-label-primary,#e6e6e6)}
6797
+ .dsm-icon-preference-copy{display:flex;flex-direction:column;gap:4px;flex:1;min-width:180px;font-size:13px}
6798
+ .dsm-icon-preference-copy>span{font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary,#999)}
6799
+ .dsm-icon-choices{display:flex;flex-wrap:wrap;gap:6px}
6800
+ .dsm-icon-choices>button{appearance:none;display:inline-flex;align-items:center;gap:8px;font:inherit;font-size:12px;line-height:20px;color:inherit;background:transparent;border:1px solid var(--dsw-alias-border-l2,#777);border-radius:8px;padding:7px 10px;cursor:pointer}
6801
+ .dsm-icon-choices>button[aria-checked="true"]{border-color:var(--dsw-alias-brand-primary,#cf795b);background:var(--dsw-alias-bg-layer-2,#25262b)}
6802
+ .dsm-icon-choices>button:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#cf795b);outline-offset:2px}
6803
+ .dsm-icon-save-error{flex-basis:100%;margin:0;color:var(--dsw-alias-state-error-primary,#c33);font-size:12px}
6804
+
6805
+
6336
6806
  .dsm-plugin-card{border:1px solid var(--dsw-alias-border-l2,#36373b);background:var(--dsw-alias-bg-layer-3,#202126);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}
6337
6807
  .dsm-plugin-card:hover{border-color:var(--dsw-alias-label-dimmed,#777)}
6338
6808
  .dsm-plugin-card-open{background:var(--dsw-alias-bg-layer-2,#25262b);border-color:var(--dsw-alias-label-dimmed,#777)}
@@ -6602,7 +7072,7 @@ window.__ModuleLoader__.load({
6602
7072
  .dsm-workbuddy-cnbase-error{margin:0;font-size:12px;line-height:17px;color:var(--dsw-alias-state-error-primary,#ef4444)}
6603
7073
  .dsm-workbuddy-cnbase-notice{margin:0;font-size:12px;line-height:17px;color:var(--dsw-alias-state-success-primary,#22a06b)}
6604
7074
  .dsm-workbuddy-cnbase-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px}
6605
- .dsm-workbuddy-pref-check,.dsm-workbuddy-image-tool-check,.dsm-workbuddy-video-tool-check,.dsm-workbuddy-cli-bridge-check,.dsm-workbuddy-sidebar-panel-check,.dsm-workbuddy-upstream-check,.dsm-workbuddy-channel-continue-check{inline-size:15px;block-size:15px;margin:3px 0 0}
7075
+ .dsm-workbuddy-pref-check,.dsm-workbuddy-image-tool-check,.dsm-workbuddy-video-tool-check,.dsm-workbuddy-cli-bridge-check,.dsm-workbuddy-sidebar-panel-check,.dsm-workbuddy-drop-thinking-check,.dsm-workbuddy-upstream-check,.dsm-workbuddy-channel-continue-check,.dsm-workbuddy-new-models-check{inline-size:15px;block-size:15px;margin:3px 0 0}
6606
7076
  /* The upstream-identity switches are their own group, so they get a divider
6607
7077
  above them instead of relying on spacing alone: they change the request the
6608
7078
  whole plugin sends, not a per-region display choice, and reading them as the
@@ -6776,10 +7246,22 @@ window.__ModuleLoader__.load({
6776
7246
  colour: it has to stand out from the three lines around it WITHOUT reading as
6777
7247
  an error banner, because the fact it states is normal product behaviour
6778
7248
  rather than a failure. Weight is the only signal it needs. */
6779
- /* 这两句现在连在一起读:先说这两个 tab 是什么,再说它们的免费额度有限。
6780
- * 所以两行之间不要段落间距(上一条 .dsm-workbuddy-tab-hint 的下边距已经给
6781
- * 足了),否则会读成两段互不相干的话。 */
6782
- .dsm-workbuddy-free-quota-warn{font-weight:600;margin-top:-10px}
7249
+ /* 这两句仍然连在一起读(先说这两个 tab 是什么,再说额度有限),但不再用负
7250
+ * 外边距把它们压成一坨。
7251
+ *
7252
+ * 上一版是 margin-top:-10px,本意是「不要段落间距」。实测代价是两行底部只隔
7253
+ * 6px,而第二行是加粗的:负外边距把上一行 18px 行高留下的空隙吃掉之后,加粗
7254
+ * 的字面几乎顶到上一行的下缘,读起来像一个被挤住的块,而不是两句话。改成
7255
+ * 4px 的正间距:仍然贴得比普通段落近,但加粗那一行有了自己的呼吸。 */
7256
+ /* Sits ON the pool heading's line now, in the gap between the title and the
7257
+ * serving-account badge. It was a block paragraph (with margins tuned to follow
7258
+ * the region-pair explanation), so it needs a row-appropriate box: no block
7259
+ * margins, and flex:1 so it takes exactly the empty middle and pushes the
7260
+ * badge to the right edge the way the heading row already wanted.
7261
+ *
7262
+ * It may WRAP rather than ellipsize: this is the sentence that stops a ×0 tier
7263
+ * being read as "unlimited", and a truncated caveat is worse than a taller row. */
7264
+ .dsm-workbuddy-free-quota-warn{font-weight:600;flex:1 1 12em;min-width:0;margin:0;color:var(--dsw-alias-label-tertiary,#999);font-size:12px;line-height:18px}
6783
7265
  /* The line that explains the REGION pair, directly under it.
6784
7266
  *
6785
7267
  * It used to be a .dsm-workbuddy-models-summary inside the accounts panel,
@@ -6787,8 +7269,16 @@ window.__ModuleLoader__.load({
6787
7269
  * cells above it, so it gets its own name and its own margin: the summary's
6788
7270
  * margin:2px 0 0 was tuned to sit under a section heading, and here the line
6789
7271
  * follows a row of boxed cells and needs more air, plus it precedes the section
6790
- * tabs whose own top margin would otherwise crowd it. */
6791
- .dsm-workbuddy-tab-hint{margin:10px 0 0;color:var(--dsw-alias-label-tertiary,#999);font-size:12px;line-height:18px}
7272
+ * tabs whose own top margin would otherwise crowd it.
7273
+ *
7274
+ * 最后定成 margin:0,因为这个容器是 flex column 带 gap 的:外边距会**叠在**
7275
+ * gap 之上。10px 时实测空隙 26px(10 + 16),18px 时 34px,而格子的边框让它
7276
+ * 看起来更松。真正需要的只是 gap 本身——这一行本就跟着单元格,属于同一个
7277
+ * 「范围」区块,中间不需要再插一层空气。
7278
+ *
7279
+ * 上一版反过来试过两个极端都算过账:负外边距(压成 6px,加粗那行顶到上一行)、
7280
+ * 18px(34px 的空档)。正解是不加。 */
7281
+ .dsm-workbuddy-tab-hint{margin:0;color:var(--dsw-alias-label-tertiary,#999);font-size:12px;line-height:18px}
6792
7282
  /* Every model is laid out in full — NO inner scroll box.
6793
7283
  *
6794
7284
  * The previous rule capped this at max-height 520px with overflow-y auto, so a
@@ -6825,7 +7315,32 @@ window.__ModuleLoader__.load({
6825
7315
  itself wraps, because its three labels can exceed even a whole narrow line —
6826
7316
  hence the media query below as well, which gives the group the full width on a
6827
7317
  phone so it reads as one deliberate line rather than a scramble. */
7318
+ /* ONE MODEL = TWO LINES (requested; it was three for one release).
7319
+ *
7320
+ * 1. WHAT IT IS + HOW IT BEHAVES — checkbox, name, price, badges, load icon
7321
+ * then the switches and the budget select
7322
+ * 2. WHAT IT COSTS / WHAT YOU CAN DO — window + output + tier, then the buttons
7323
+ *
7324
+ * WHY THE SWITCHES MOVED BACK UP. As three lines the row left the whole right
7325
+ * HALF of line 1 empty — the name is short, and nothing followed it — while
7326
+ * line 2 carried three controls that together are narrower than that empty
7327
+ * space. The row was three lines tall and two-thirds empty per line; two lines
7328
+ * fit the same content in less height, which is what the list is for (reading
7329
+ * a roster, not admiring whitespace).
7330
+ *
7331
+ * Line 1 is a two-part flex: the name label is flex:1 and the switch group is
7332
+ * flex:none, so a long model name shrinks (it already ellipsizes) and the
7333
+ * controls never move. When the column is too narrow for both, the controls
7334
+ * wrap UNDER the name — the same visual as the old three-line layout, decided
7335
+ * by the available width rather than always. */
6828
7336
  .dsm-workbuddy-model-head{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;row-gap:8px;min-width:0}
7337
+ /* Line 1's right half. flex:none so the switches and the select keep their own
7338
+ width and the NAME is the only thing that gives way. */
7339
+ .dsm-workbuddy-model-controls{display:flex;align-items:center;flex-wrap:wrap;gap:12px;row-gap:8px;min-width:0;flex:none}
7340
+ /* Line 2: facts left, actions right. Indented to the name (22px = the
7341
+ checkbox box + its 8px gap) so the two lines read as one block rather than
7342
+ as a checkbox with two toppled fragments beside it. */
7343
+ .dsm-workbuddy-model-details{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0;padding-inline-start:22px}
6829
7344
  .dsm-workbuddy-model-enabled{display:flex;align-items:center;gap:8px;min-width:0;cursor:pointer;flex:1}
6830
7345
  .dsm-workbuddy-model-enabled input{margin:0;accent-color:var(--dsw-alias-brand-primary,#5686fe);flex:none}
6831
7346
  .dsm-workbuddy-model-image{display:inline-flex;align-items:center;gap:5px;flex:none;cursor:pointer;color:var(--dsw-alias-label-secondary,#c6c9d0);font-size:11px;line-height:16px}
@@ -6846,7 +7361,20 @@ window.__ModuleLoader__.load({
6846
7361
  * floor. It may still ellipsize — a name longer than the whole row cannot fit —
6847
7362
  * but it never collapses to a stub while a badge sits whole beside it. */
6848
7363
  .dsm-workbuddy-model-copy{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 8px;min-width:0}
6849
- .dsm-workbuddy-model-copy>.dsm-workbuddy-model-name{flex:1 1 auto;min-width:9em}
7364
+ /* THE NAME MUST NOT CLAIM LEFTOVER WIDTH.
7365
+ *
7366
+ * It was flex:1 1 auto; min-width:9em, which made the name box grow to fill
7367
+ * whatever the row had spare — 117px (9em) for "Hy4", whose text is ~30px. The
7368
+ * promo chip therefore sat at the END of that inflated box, and the gap between
7369
+ * the price and the chip read as a stray blank block: it appears ONLY on rows
7370
+ * that have a chip, because that is the only case where anything follows the
7371
+ * name.
7372
+ *
7373
+ * flex:0 1 auto takes the name's own width and allows SHRINKING (so a long
7374
+ * name still ellipsizes and still cannot push the chip out of view). The floor
7375
+ * is gone with it: a minimum of 9em was what turned "do not collapse" into
7376
+ * "always at least 117px". */
7377
+ .dsm-workbuddy-model-copy>.dsm-workbuddy-model-name{flex:0 1 auto;min-width:0}
6850
7378
  /* Below the panel's own width the floor is too greedy: 9em plus two chips is
6851
7379
  wider than the line, and the NAME would force the wrap it is meant to avoid.
6852
7380
  Give it less and let the chips take the second line. */
@@ -6871,13 +7399,26 @@ window.__ModuleLoader__.load({
6871
7399
  "· N 新模型" segment (label-dimmed), but no chip border and one step smaller,
6872
7400
  so it reads as a side note beside the promotion chip rather than a second
6873
7401
  badge competing with the model name. */
7402
+ /* A badge another PROVIDER published for its own model, reproduced in the
7403
+ host's picker so it survives this plugin holding the cell. Geometry and the
7404
+ no-border rule are copied from the host's own Tag.module.css (0.2.2-rc.1) —
7405
+ the chip must be indistinguishable from one the host drew itself, which is
7406
+ also why there is no max-width here: the host does not truncate, and a chip
7407
+ that turned "限时免费" into "限时免…" at the same row width would be the one
7408
+ visible difference. Colours arrive inline per tone. */
7409
+ .dsm-workbuddy-model-label-host-badge{flex:none;display:inline-flex;align-items:center;border-radius:999px;padding:1px 8px;font-size:11px;line-height:17px;font-weight:500;white-space:nowrap}
7410
+ /* A foreign row reuses .dsm-workbuddy-model-label as its flex wrapper so both
7411
+ branches share ONE alignment model (a bare span put the pill on the text
7412
+ baseline, which rode visibly high). That class carries this plugin's own
7413
+ gap:5px, while the host's fallback uses gap:4px; the one-pixel override
7414
+ keeps the host's metric without giving our own rows a second wrapper. */
7415
+ .dsm-workbuddy-model-label-host-row{gap:4px}
6874
7416
  .dsm-workbuddy-model-label-new{flex:none;display:inline-flex;align-items:center;padding:0 5px;border-radius:999px;font-size:10px;line-height:16px;font-weight:600;white-space:nowrap;color:var(--dsw-alias-label-dimmed,rgba(127,127,127,.6))}
6875
7417
  .dsm-workbuddy-busy{flex:none;display:inline-flex;align-items:center;block-size:12px;color:var(--dsm-workbuddy-busy-color);vertical-align:-2px}
6876
7418
  .dsm-workbuddy-busy svg{display:block;block-size:12px;inline-size:auto}
6877
7419
  .dsm-workbuddy-model-promo{flex:none;display:inline-flex;align-items:center;padding:0 7px;border-radius:999px;font-size:10px;line-height:16px;font-weight:600;white-space:nowrap;color:var(--dsm-workbuddy-promo-color,var(--dsw-alias-brand-primary,#5686fe));background:rgba(255,255,255,.08);background:color-mix(in srgb,var(--dsm-workbuddy-promo-color,var(--dsw-alias-brand-primary,#5686fe)) 16%,transparent);border:1px solid transparent;border-color:color-mix(in srgb,var(--dsm-workbuddy-promo-color,var(--dsw-alias-brand-primary,#5686fe)) 40%,transparent)}
6878
7420
  .dsm-workbuddy-model-id{color:var(--dsw-alias-label-tertiary,#999);font-size:11px;line-height:16px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
6879
7421
  .dsm-workbuddy-model-desc{margin:0;color:var(--dsw-alias-label-tertiary,#9aa0a8);font-size:12px;line-height:18px}
6880
- .dsm-workbuddy-model-details{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0}
6881
7422
  .dsm-workbuddy-model-meta{display:flex;align-items:center;gap:7px 12px;flex-wrap:wrap;color:var(--dsw-alias-label-tertiary,#999);font-size:11px;line-height:16px}
6882
7423
  .dsm-workbuddy-model-meta-tag{padding:1px 7px;border-radius:999px;font-size:11px;line-height:15px;background:rgba(174,179,187,.11);color:var(--dsw-alias-label-secondary,#c6c9d0)}
6883
7424
  /* The per-model default thinking tier (issue #179). It lives INSIDE the meta row
@@ -7036,11 +7577,102 @@ window.__ModuleLoader__.load({
7036
7577
  * viewport, which is where a full-screen overlay belongs. The table itself
7037
7578
  * contains only the header and member rows — no fixed-position descendants. */
7038
7579
  .dsm-workbuddy-pool-table{container-type:inline-size;border:1px solid var(--dsw-alias-border-l2,#3a3d45);border-radius:12px;overflow:hidden;background:var(--dsw-alias-bg-layer-2,#24262c)}
7039
- .dsm-workbuddy-pool-row{display:grid;grid-template-columns:1.6fr 1fr 1.3fr .9fr .8fr;gap:10px;align-items:center;padding:10px 14px;border-top:1px solid var(--dsw-alias-border-l1,#2c2d31);font-size:13px;color:var(--dsw-alias-label-secondary,#c6c9d0)}
7040
- /* No check-in column (the international region): the freed track goes to the actions. */
7041
- .dsm-workbuddy-pool-table:not(.dsm-workbuddy-pool-table-checkin) .dsm-workbuddy-pool-row{grid-template-columns:1.6fr 1fr 1.3fr 1.7fr}
7580
+ /* THREE LINES AT EVERY WIDTH — the shape the row is meant to have.
7581
+ *
7582
+ * The row used to be five columns on one line when the table was wide, and a
7583
+ * different re-grid when it was not, so its SHAPE depended on how wide the box
7584
+ * around it happened to be: the same account read differently in the composer
7585
+ * card, the full page and the Settings column. Named lines fix the shape once,
7586
+ * whatever width it lands in:
7587
+ * line 1: who it is ...................... credits
7588
+ * line 2: what state it is in ... check-in actions
7589
+ * line 3: how it was measured (provenance)
7590
+ *
7591
+ * TWO ROWS OF AREAS, THREE LINES OF TEXT. The provenance line is the PROBE
7592
+ * CELL's own second line (the -probe-line and -probe-prov spans), so the row
7593
+ * grows to three lines without a third grid row, and the verdict line and the
7594
+ * provenance line keep the same left edge and wrap independently.
7595
+ *
7596
+ * What this replaced: the verdict and 「测试于 …」 were separate sub-rows, so
7597
+ * every row with a measured account was FOUR lines — the last one holding
7598
+ * nothing but a timestamp. The owner asked for those two on one line and for the
7599
+ * whole row to be three.
7600
+ *
7601
+ * NAMED AREAS, not five anonymous tracks. Every cell declares where it goes, so
7602
+ * a cell that is absent — the international region renders no check-in — leaves
7603
+ * its area empty instead of pulling the cells after it into the wrong columns.
7604
+ * That failure is not hypothetical: it is what made the international table
7605
+ * stack (5.20.26), where a template naming five cells over four tracks was
7606
+ * discarded wholesale by the browser. Both variants therefore keep the same
7607
+ * three tracks and the same three cells per line; only the areas differ.
7608
+ *
7609
+ * The first track is minmax(0,1fr) and not a bare 1fr on purpose: a bare 1fr
7610
+ * carries an automatic minimum of the item's min-content width, so a long
7611
+ * account name or verdict would push the row wider than its table instead of
7612
+ * ellipsizing. With a zero minimum the flexible track gives way, which is what
7613
+ * lets the same template serve the ~564px Settings column without a breakpoint.
7614
+ *
7615
+ * The LAST track is fixed px, never auto: the header and the rows are separate
7616
+ * grid containers, so an auto track is sized twice against different contents
7617
+ * and the two disagree. Measured at 820px, the actions track came out at 691 in
7618
+ * the header (it holds one empty span) and 615 in the row (it holds three
7619
+ * buttons), which dragged the check-in track beside it out of place by 76px. See
7620
+ * the credits rule below for the A/B numbers.
7621
+ *
7622
+ * The check-in track is minmax(0,auto) — flexible, so it can hold 「不适用(企业
7623
+ * 版)」 (96px) without overflowing, but with a ZERO minimum so it yields to the
7624
+ * account name instead of widening the row. It is also the one auto track the
7625
+ * header drift cannot reach: every cell in it is justify-self:end, so a header
7626
+ * label 24px wide and a value 36px wide still share their RIGHT edge exactly —
7627
+ * an auto track can move a left edge, and that is all it moves.
7628
+ *
7629
+ * The last track is 160px because that is what the button group needs AT REST in
7630
+ * the widest locale, measured in headless Chrome: ⚙ Test Remove is 156px, ⚙ 测试
7631
+ * 删除 134px. At 132px — the value this briefly shipped with — even the Chinese
7632
+ * resting group wrapped, dropping 删除 onto a line of its own and growing every
7633
+ * row by ~24px at every width. The in-flight labels (Testing… / Removing…,
7634
+ * 194-208px) still wrap, and that is exactly what flex-wrap on the group is for:
7635
+ * a momentary second line while a request is in flight beats a track wide enough
7636
+ * to waste ~48px per row at rest. */
7637
+ .dsm-workbuddy-pool-row{
7638
+ display:grid;
7639
+ grid-template-columns:minmax(0,1fr) minmax(0,auto) 160px;
7640
+ grid-template-areas:
7641
+ "account account credits"
7642
+ "probe checkin actions";
7643
+ column-gap:12px;row-gap:4px;align-items:center;padding:10px 14px;
7644
+ border-top:1px solid var(--dsw-alias-border-l1,#2c2d31);
7645
+ font-size:13px;color:var(--dsw-alias-label-secondary,#c6c9d0);
7646
+ }
7647
+ /* WITHOUT the check-in the verdict takes the freed area, so the actions stay in
7648
+ the last track — the same track, and the same right edge, in both variants.
7649
+ Three cells again: the count never changes, only which area a cell owns. */
7650
+ .dsm-workbuddy-pool-table:not(.dsm-workbuddy-pool-table-checkin) .dsm-workbuddy-pool-row{
7651
+ grid-template-areas:
7652
+ "account account credits"
7653
+ "probe probe actions";
7654
+ }
7042
7655
  .dsm-workbuddy-pool-row:first-child{border-top:0}
7043
- .dsm-workbuddy-pool-row-head{padding:8px 14px;background:var(--dsw-alias-bg-layer-3,#2a2c33);color:var(--dsw-alias-label-tertiary,#999);font-size:11px;font-weight:600;letter-spacing:.02em;text-transform:uppercase}
7656
+ .dsm-workbuddy-pool-row-head{padding:8px 14px;row-gap:1px;background:var(--dsw-alias-bg-layer-3,#2a2c33);color:var(--dsw-alias-label-tertiary,#999);font-size:11px;font-weight:600;letter-spacing:.02em;text-transform:uppercase}
7657
+ /* THE HEADER SPEAKS THE SAME TEMPLATE AS THE ROWS.
7658
+ *
7659
+ * It used to be a five-span row against a five-track template, and the narrow
7660
+ * form hid it because its labels pointed at tracks that no longer existed.
7661
+ * Both templates now name the same AREAS, so the labels line up in both
7662
+ * directions — and a label cannot drift away from the value it names, because
7663
+ * there is no second column definition to keep in step.
7664
+ *
7665
+ * The cells are emitted in reading order (line one, then line two) and the
7666
+ * areas decide where each lands, exactly as in the rows.
7667
+ *
7668
+ * The check-in label is ABSENT where the region has none, exactly as its cell
7669
+ * is: an empty area stays empty, and a label over nothing is worse than none.
7670
+ * The actions cell has no text — the buttons speak — but it still has to exist,
7671
+ * or the area named in the template would have no box to fill. */
7672
+ .dsm-workbuddy-pool-row-head .dsm-workbuddy-pool-col-credits{grid-area:credits;justify-self:end;text-align:right}
7673
+ .dsm-workbuddy-pool-row-head .dsm-workbuddy-pool-col-probe{grid-area:probe}
7674
+ .dsm-workbuddy-pool-row-head .dsm-workbuddy-pool-col-checkin{grid-area:checkin;justify-self:end}
7675
+ .dsm-workbuddy-pool-row-head .dsm-workbuddy-pool-col-actions{grid-area:actions}
7044
7676
  /* WHERE THE LABELED COLUMN ACTUALLY STARTS (learned from dsh-connect-trae, which
7045
7677
  carries the same rule for the same reason).
7046
7678
  *
@@ -7052,27 +7684,34 @@ window.__ModuleLoader__.load({
7052
7684
  * 38px is the checkbox (13px) plus the cell's 8px gap plus the vertical
7053
7685
  * centring slack of an 18px glyph in a 20px label; rounded to the value that
7054
7686
  * measured flush rather than derived, because the two cells do not share a
7055
- * box. The narrow form hides the whole header row, so this offset never has to
7056
- * be re-tuned for the stacked layout. */
7057
- .dsm-workbuddy-pool-col-account{padding-inline-start:38px}
7687
+ * box. The offset holds at every width now that the header is no longer hidden:
7688
+ * the cell keeps the same leading checkbox in both forms. */
7689
+ .dsm-workbuddy-pool-col-account{grid-area:account;padding-inline-start:38px}
7058
7690
  .dsm-workbuddy-pool-row-current{background:rgba(86,134,254,.07)}
7059
7691
  /* The serving row, made findable at a glance: a left accent bar plus the tint.
7060
7692
  The bar is what distinguishes it in a long table, where a 7%-opacity wash
7061
7693
  alone reads as an alternating-row stripe. */
7062
7694
  .dsm-workbuddy-pool-row-current{box-shadow:inset 3px 0 0 var(--dsw-alias-brand-primary,#5686fe)}
7063
- .dsm-workbuddy-pool-account{display:flex;align-items:center;gap:8px;min-width:0}
7064
- .dsm-workbuddy-pool-account-name{display:flex;flex-direction:column;gap:1px;min-width:0}
7065
- .dsm-workbuddy-pool-account-name b{font-weight:500;color:var(--dsw-alias-label-primary,#e6e6e6);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
7695
+ .dsm-workbuddy-pool-account{grid-area:account;display:flex;align-items:center;gap:8px;min-width:0}
7696
+ /* The account block WRAPS AMONG ITSELF instead of stacking.
7697
+ *
7698
+ * It was a column — name / rank+arrows / current pill / membership line — which
7699
+ * is what a whole cell per fact needs, but this cell now shares line one with
7700
+ * the credits. Stacked, those four become four lines and the three-line row the
7701
+ * rest of the card promises is a lie on every row. Read as a sentence it is one
7702
+ * line — 「账号A · 第 1 位 · 当前使用」 — so it wraps instead. */
7703
+ .dsm-workbuddy-pool-account-name{display:flex;flex-direction:row;flex-wrap:wrap;align-items:baseline;gap:2px 8px;min-width:0}
7704
+ .dsm-workbuddy-pool-account-name b{font-weight:500;color:var(--dsw-alias-label-primary,#e6e6e6);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;max-width:100%}
7066
7705
  .dsm-workbuddy-pool-account-name span{font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary,#999)}
7067
7706
  /* Declared AFTER the blanket span rule so it wins: the badge must not inherit
7068
7707
  the muted 11px tertiary treatment the membership line uses. */
7069
- .dsm-workbuddy-pool-account-name .dsm-workbuddy-pool-current-tag{align-self:flex-start;margin-top:2px;padding:1px 6px;border-radius:999px;background:var(--dsw-alias-state-success-primary,#22c55e);border:1px solid rgba(34,197,94,.55);color:#fff;font-size:11px;font-weight:600;line-height:16px;white-space:nowrap}
7708
+ .dsm-workbuddy-pool-account-name .dsm-workbuddy-pool-current-tag{align-self:center;padding:1px 6px;border-radius:999px;background:var(--dsw-alias-state-success-primary,#22c55e);border:1px solid rgba(34,197,94,.55);color:#fff;font-size:11px;font-weight:600;line-height:16px;white-space:nowrap}
7070
7709
  /* Manual-priority chrome (order badge + up/down arrows). The rank badge is a SPAN,
7071
7710
  not a button: it only DESCRIBES the current order and must not read as a
7072
7711
  control (nor join the row's button list). The solid vs dashed distinction is
7073
7712
  load-bearing — a numeric rank must NOT appear when the credit policy still
7074
7713
  decides the order, so the -auto modifier is the dashed/grey state. */
7075
- .dsm-workbuddy-pool-account-name .dsm-workbuddy-pool-order{display:flex;align-items:center;gap:6px;margin-top:2px;flex-wrap:wrap}
7714
+ .dsm-workbuddy-pool-account-name .dsm-workbuddy-pool-order{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
7076
7715
  .dsm-workbuddy-pool-account-name .dsm-workbuddy-pool-rank{display:inline-flex;align-items:center;border-radius:999px;border:1px solid rgba(86,134,254,.32);background:rgba(86,134,254,.12);color:var(--dsw-alias-brand-primary,#5686fe);font-size:11px;font-weight:600;line-height:16px;padding:1px 6px;white-space:nowrap;cursor:default;font-variant-numeric:tabular-nums}
7077
7716
  .dsm-workbuddy-pool-account-name .dsm-workbuddy-pool-rank-auto{border:1px dashed var(--dsw-alias-border-l1,#2c2d31);background:var(--dsw-alias-bg-layer-3,#2a2c33);color:var(--dsw-alias-label-secondary,#c6c9d0)}
7078
7717
  .dsm-workbuddy-pool-account-name .dsm-workbuddy-pool-move{display:inline-flex;align-items:center;gap:2px}
@@ -7109,10 +7748,42 @@ window.__ModuleLoader__.load({
7109
7748
  /* The "why expiring credits win" note is the sentence users push back on, so
7110
7749
  it is tinted rather than buried in the same grey as the eight rules. */
7111
7750
  .dsm-workbuddy-pool-order-rules-why{margin:0;padding:8px 10px;border-radius:8px;border-left:3px solid var(--dsw-alias-state-warn-primary,#f59e0b);background:rgba(245,158,11,.10);font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#c6c9d0)}
7112
- .dsm-workbuddy-pool-credits{display:flex;flex-direction:column;gap:1px;min-width:0;font-variant-numeric:tabular-nums}
7751
+ /* THE CREDITS TRACK IS ITS OWN COLUMN, right-aligned against the row's edge.
7752
+ *
7753
+ * This cell is pinned to its right end (justify-self:end) so one right edge
7754
+ * stands under every row, however wide the number is.
7755
+ *
7756
+ * AUTO IS THE THING THAT FAILED HERE, for the track that follows it. The header
7757
+ * and the data rows are two SEPARATE grid containers, so an auto track is
7758
+ * measured twice, each against its own contents — and it is the ACTIONS track
7759
+ * that differs (one empty span in the header, three buttons in the row). Because
7760
+ * the check-in sits immediately before it, a 76px difference there moves the
7761
+ * check-in label 76px away from the value it names: measured in headless Chrome
7762
+ * at 820px, header 691 vs data 615. jsdom does no layout and cannot see it. Fixed
7763
+ * px on the actions track keeps the two containers in step — the same reason
7764
+ * dsh-connect-qoder pins its trailing tracks.
7765
+ *
7766
+ * The cell is a ROW, not a column, and it is ONE track: the fixed 160px the
7767
+ * actions need (see the row rule). The figure and its warning sit side by side
7768
+ * and share that width — 「1,556」 is 38px and 「300 积分 3 天内过期」 103px, so
7769
+ * together they are 122px and never wrap here. Stacked, as they were, the cell
7770
+ * was 35px instead of 18px: line one grew by 17px on EVERY row, and the
7771
+ * warning's baseline landed between the verdict and the provenance line, so the
7772
+ * right side of the row read as detached from the left. flex-wrap is kept as a
7773
+ * last resort (a 3-digit figure plus a longer locale) rather than a clipped
7774
+ * number.
7775
+ *
7776
+ * THE ONE STATE THAT IS NOT THREE LINES: a claimable-benefit entry (issue #79)
7777
+ * also renders in this cell, and its own min-content is 229px — a full label
7778
+ * plus the claim pill — so inside 160px it wraps to two lines and line one
7779
+ * becomes two lines, i.e. a four-line row. That predates the three-line shape
7780
+ * and is deliberate in the benefit rule below (its tag clamps to two lines so an
7781
+ * unexpectedly long upstream title cannot push the row taller than the pill can
7782
+ * travel). Fitting it would mean moving the claim button OFF line one; the pill
7783
+ * is a seasonal campaign, so the row keeps its honest wrap instead. */
7784
+ .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}
7113
7785
  .dsm-workbuddy-pool-credits b{color:var(--dsw-alias-label-primary,#e6e6e6);font-weight:600}
7114
7786
  .dsm-workbuddy-pool-soon{font-size:11px;line-height:16px;color:var(--dsw-alias-state-warn-primary,#f59e0b)}
7115
- .dsm-workbuddy-pool-soon-plain{font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary,#999)}
7116
7787
  /* 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. */
7117
7788
  .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}
7118
7789
  /* One entry = text + pill, and the text wraps rather than being cut.
@@ -7222,8 +7893,33 @@ window.__ModuleLoader__.load({
7222
7893
  box-shadow:none;
7223
7894
  }
7224
7895
  .dsm-workbuddy-pool-probe,.dsm-workbuddy-pool-checkin{font-size:12px;line-height:17px;color:var(--dsw-alias-label-tertiary,#999);min-width:0;overflow-wrap:anywhere}
7225
- .dsm-workbuddy-pool-probe{display:flex;flex-direction:column;gap:4px}
7226
- .dsm-workbuddy-pool-probe-main{color:var(--dsw-alias-label-secondary,#c6c9d0)}
7896
+ /* The verdict cell: LINE TWO of the row, and two lines of its own.
7897
+ *
7898
+ * The -probe-line span holds the verdict together with the moment it was
7899
+ * measured (see the rule below); -probe-prov is line THREE. A 2px gap is what
7900
+ * keeps those two from reading as one wrapped paragraph: at 4px they looked like
7901
+ * a single block of text that happened to break, which is how the four-line row
7902
+ * it replaced looked. */
7903
+ .dsm-workbuddy-pool-probe{grid-area:probe;display:flex;flex-direction:column;gap:2px;min-width:0}
7904
+ /* VERDICT · TESTED-AT, ONE LINE.
7905
+ *
7906
+ * These were two sub-rows, and every measured account was therefore four lines
7907
+ * tall with a timestamp on the last one. They are one sentence — "被限流 · 11/08
7908
+ * 15:44 之后可再用 · 约 15 小时后 · 测试于 11/07 17:36" — so they wrap together
7909
+ * as a unit, and the measured widths say why that matters: the longest verdict
7910
+ * is 260px and 「测试于 11/07 17:36」 another 102, so the pair needs ~380px. It
7911
+ * fits from ~700px up; below that only the verdict fits, and the block further
7912
+ * down drops the timestamp rather than letting the pair wrap onto a line the row
7913
+ * does not have. */
7914
+ .dsm-workbuddy-pool-probe-line{display:flex;flex-wrap:wrap;align-items:baseline;gap:0 6px;min-width:0}
7915
+ .dsm-workbuddy-pool-probe-main{color:var(--dsw-alias-label-secondary,#c6c9d0);min-width:0;overflow-wrap:anywhere}
7916
+ /* The separator belongs to the timestamp it introduces, so a wrapped line can
7917
+ never leave a lone 「·」 hanging at the end of the verdict. */
7918
+ .dsm-workbuddy-pool-probe-sep,.dsm-workbuddy-pool-tested-at{font-size:11px;line-height:15px;color:var(--dsw-alias-label-tertiary,#999);white-space:nowrap}
7919
+ .dsm-workbuddy-pool-probe-sep{color:var(--dsw-alias-label-dimmed,#9aa0a6);opacity:.7}
7920
+ /* WHEN, in the verdict's own sentence but at the weight of a timestamp: at 12px
7921
+ and the verdict's colour it read as a second verdict, and the row looked like
7922
+ two statements fighting for the same line. */
7227
7923
  .dsm-workbuddy-pool-probe-prov{display:flex;align-items:center;gap:5px;font-size:11px;line-height:15px;color:var(--dsw-alias-label-tertiary,#999);min-width:0;flex-wrap:wrap}
7228
7924
  .dsm-workbuddy-pool-prov-tag{padding:1px 6px;border-radius:999px;background:var(--dsw-alias-bg-layer-3,#2a2c33);color:var(--dsw-alias-label-tertiary,#999);font-size:10px;font-weight:600;line-height:15px;white-space:nowrap}
7229
7925
  .dsm-workbuddy-pool-prov-live{background:rgba(245,158,11,.16);color:var(--dsw-alias-state-warn-primary,#f59e0b)}
@@ -7249,6 +7945,15 @@ window.__ModuleLoader__.load({
7249
7945
  .dsm-workbuddy-pool-check input{margin:0;cursor:pointer;accent-color:var(--dsw-alias-brand-primary,#5686fe)}
7250
7946
  .dsm-workbuddy-pool-check input:disabled{cursor:default;opacity:.5}
7251
7947
  .dsm-workbuddy-pool-checked{color:var(--dsw-alias-state-success-primary,#22a06b)}
7948
+ /* Line two, middle: the daily claim. Its own AREA so that a region WITHOUT it
7949
+ leaves that slot empty instead of sliding the actions one track left.
7950
+ *
7951
+ * BASELINE-aligned, not centred: line two is two lines tall (verdict above,
7952
+ * provenance below), and a centred cell floats between them — measured, 「已签到」
7953
+ * sat 8px below the verdict's baseline, which read as belonging to neither line.
7954
+ * Sharing the verdict's baseline puts the state on the same line as the verdict
7955
+ * it belongs to. */
7956
+ .dsm-workbuddy-pool-checkin{grid-area:checkin;justify-self:end;align-self:baseline;white-space:nowrap;min-width:0;overflow-wrap:anywhere}
7252
7957
  .dsm-workbuddy-pool-unknown{color:var(--dsw-alias-label-dimmed,#9aa0a6)}
7253
7958
  .dsm-workbuddy-pool-not-member{color:var(--dsw-alias-label-dimmed,#9aa0a6)}
7254
7959
  /* A section break, not just a gap: below this line the page stops showing what
@@ -7368,13 +8073,28 @@ window.__ModuleLoader__.load({
7368
8073
  .dsm-workbuddy-pool-log-error{color:var(--dsw-alias-state-error-primary,#ef4444)}
7369
8074
  .dsm-workbuddy-pool-log-info{color:var(--dsw-alias-label-secondary,#c6c9d0)}
7370
8075
  .dsm-workbuddy-pool-log-empty{padding:14px;font-size:12px;color:var(--dsw-alias-label-tertiary,#999)}
7371
- /* Per-row actions (test / remove), right side of each pool row. */
7372
- /* Per-row actions (test / remove), right side of each pool row.
7373
- The nowrap is NOT cosmetic: a two-character label (测试) belongs on one line,
7374
- and this row's track is a fraction of the table — in a narrow window it let
7375
- the label break into 测 / 试. Clipping is the right failure for a button
7376
- whose label is fixed and tiny. */
7377
- .dsm-workbuddy-pool-row-actions{display:flex;gap:6px;align-items:center;justify-content:flex-end;flex:none}
8076
+ /* Per-row actions (test / device / remove), closing line two.
8077
+ *
8078
+ * Their third resting place. They have been (1) the row's last grid cell of the
8079
+ * old single-line table, where a separate track put them on a line of their own
8080
+ * below the credits; (2) inside the account cell, pushed right by an auto
8081
+ * margin, which on the re-grid put them at the END OF LINE ONE — before the
8082
+ * reader met the facts they act on; and now (3) the row's last cell again,
8083
+ * which with two named lines means the end of line two, right after the verdict
8084
+ * they respond to. The reading order is the point:
8085
+ * who it is → what state it is in → what you can do about it.
8086
+ *
8087
+ * BASELINE-aligned for the same reason as the check-in beside them: line two is
8088
+ * two lines tall, and a centred button group sits in the gap between the verdict
8089
+ * and the provenance line — measured, the buttons' text baseline was 8px below
8090
+ * the verdict's. Sharing that baseline makes the buttons read as the end of the
8091
+ * sentence they act on.
8092
+ *
8093
+ * The nowrap is NOT cosmetic: a two-character label (测试) belongs on one line,
8094
+ * and clipping is the right failure for a button whose label is fixed and tiny.
8095
+ * flex:none is load-bearing: the name may truncate, the buttons may not, and a
8096
+ * shrunken button is unclickable. */
8097
+ .dsm-workbuddy-pool-row-actions{grid-area:actions;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px;align-items:center;flex:none;justify-self:end;align-self:baseline;max-width:100%}
7378
8098
  .dsm-workbuddy-pool-row-actions .dsm-workbuddy-pool-small-btn{white-space:nowrap}
7379
8099
  .dsm-workbuddy-pool-row-actions .dsm-workbuddy-pool-small-btn{padding:2px 10px;font-size:12px}
7380
8100
  /* The picker's cap, narrowed on a phone. NOTE this @media measures the VIEWPORT,
@@ -7392,75 +8112,45 @@ window.__ModuleLoader__.load({
7392
8112
  /* The settings rows (target model, probe size) are flex with a content column
7393
8113
  * that grows and a control that does not. In the Settings panel the control was
7394
8114
  * squeezed to a sliver: max-width:260px caps it but nothing gives it a floor,
7395
- * and the copy beside it takes everything else. Stacking is the same move the
7396
- * table makes at this width — one fact per line rather than two columns of
7397
- * clipped text. */
8115
+ * and the copy beside it takes everything else. Stacking gives each one a whole
8116
+ * line, which beats two columns of clipped text.
8117
+ *
8118
+ * NOTE: this is NOT the move the pool table makes. The table is three lines at
8119
+ * every width now (see the grid above), so a narrow column no longer changes
8120
+ * its shape — only these two settings rows still switch. */
7398
8121
  @container (max-width:620px){.dsm-workbuddy-pool-set{flex-direction:column;align-items:stretch;gap:8px}
7399
8122
  .dsm-workbuddy-pool-set-ctl{flex:1 1 auto;justify-content:flex-start}
7400
8123
  .dsm-workbuddy-pool-select{max-width:none;width:100%}}
7401
- /* THE TABLE'S NARROW FORM, measured against the table rather than the window.
8124
+ /* THE ONE THING THAT STILL DEPENDS ON WIDTH — and it is a DETAIL, not a shape.
7402
8125
  *
7403
- * Every breakpoint in this file up to here is a @media query, and those
7404
- * measure the VIEWPORT. The same card now renders in the Settings panel's
7405
- * content column (~564px on a 1400px screen), where a media query never fires:
7406
- * a five-column table was laid into 564px and every cell clipped.
8126
+ * The three-line row above is the same shape at every width, so nothing here
8127
+ * re-arranges cells any more: no second track count, no second set of occupied
8128
+ * cells, no display:none on the header. All three existed because the wide and
8129
+ * narrow forms disagreed about where a cell went; both templates now name the
8130
+ * same areas, so the labels describe the rows at every width.
7407
8131
  *
7408
- * ONE threshold, not two. An earlier revision had a 720px band that merely
7409
- * dropped one track, on the theory that "slightly narrower" still wants a grid
7410
- * — but the Settings column lands at ~564px, i.e. INSIDE that band, so the
7411
- * reader got a 2x2 grid whose cells no longer lined up with their headers and
7412
- * whose rows were twice as tall as the wide ones. A table has no "slightly
7413
- * narrower" form worth having: either there is room for the columns or there
7414
- * is not.
8132
+ * What this block DOES drop is 「测试于 11/07 17:36」, and only where it cannot
8133
+ * fit beside the verdict. Measured in headless Chrome: the longest verdict is
8134
+ * 260px and the timestamp 102px, so the verdict line needs ~380px; at the
8135
+ * Settings column's 564px the probe cell has ~330px in the Chinese table (the
8136
+ * check-in and the 160px button track take the rest). Letting the pair wrap there
8137
+ * is what turns three lines into four — the exact shape the owner rejected — and
8138
+ * the timestamp is the fragment to lose, not the verdict: the provenance line
8139
+ * directly below already dates the same measurement, as 「2 小时前」. Nothing is
8140
+ * hidden that is not said again on the next line, and the absolute moment stays
8141
+ * in the activity log the test wrote.
7415
8142
  *
7416
- * Below the threshold each row becomes a STACKED CARD: the same five facts, in
7417
- * the same order they read left to right when wide, now top to bottom. That is
7418
- * what keeps a narrow row legible instead of merely fitting. */
8143
+ * ONE CASE IS STILL FOUR LINES, and it is left that way on purpose: an ENGLISH
8144
+ * enterprise row in the 564px column, whose check-in cell says 「N/A (enterprise)」
8145
+ * (~96px) while the verdict is the 301px English rate-limit sentence. The probe
8146
+ * cell then has ~262px, so the verdict wraps. The alternative — clipping the
8147
+ * verdict, or ellipsizing the check-in — trades a rare extra line for a lie about
8148
+ * whether the account works, which is the one thing this row exists to say. The
8149
+ * Chinese table in the same state fits (262px for a 260px verdict). */
7419
8150
  @container (max-width:700px){
7420
- /* THREE LINES, not five. A plain flex-direction:column stacked every cell
7421
- onto its own line, which doubled the row height and read as a form rather
7422
- than an account. Wrapping is what keeps the row a CARD: the account and the
7423
- actions own a full line each (they are the identify-it and act-on-it ends),
7424
- while the three facts in between share the middle line and wrap among
7425
- themselves only when they genuinely do not fit. */
7426
- .dsm-workbuddy-pool-row{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 12px;padding:10px 12px}
7427
- .dsm-workbuddy-pool-table:not(.dsm-workbuddy-pool-table-checkin) .dsm-workbuddy-pool-row{display:flex;flex-wrap:wrap;align-items:baseline}
7428
- /* The column headers describe tracks that no longer exist. */
7429
- .dsm-workbuddy-pool-row-head{display:none}
7430
- .dsm-workbuddy-pool-account{flex:1 1 100%;align-items:center}
7431
- /* THE ACCOUNT CELL'S OWN COLUMN, collapsed the same way — and this is the
7432
- rule that actually decides the row height (learned from dsh-connect-trae
7433
- 4.9.0, which shipped the outer half of this fix and measured 138px rows).
7434
- *
7435
- * Collapsing only .dsm-workbuddy-pool-account above is NOT enough: that is
7436
- * just a flex wrapper. The cells that stack are one level deeper, inside
7437
- * .dsm-workbuddy-pool-account-name, which declares flex-direction:column so
7438
- * that the name, the rank badge with its ↑/↓ arrows, the 「当前使用」 pill and
7439
- * the 「测试于 …」 line read as a small card when the table is WIDE.
7440
- *
7441
- * In the Settings column they have no reason to keep one line each: measured
7442
- * at 549px, that block was 81px of the row's 157px — five lines (name, rank +
7443
- * arrows, current badge, tested-at), while the three facts beside it sat on
7444
- * one 18px line. The row therefore read as "one tall account block and three
7445
- * strays", and every extra row cost the reader two thirds of a screen.
7446
- *
7447
- * Read as a sentence it is one line — 「用户7520607992 · 第 1 位 ↑↓ · 当前使用 ·
7448
- * 测试于 11/06, 03:57」 — so it wraps among itself instead of stacking. The
7449
- * margins the wide form needs (2px above the badge, 2px above the current pill)
7450
- * go away with the stacking: in a wrapped row they become uneven leading. */
7451
- .dsm-workbuddy-pool-account-name{flex-direction:row;flex-wrap:wrap;align-items:baseline;gap:2px 8px}
7452
- .dsm-workbuddy-pool-account-name .dsm-workbuddy-pool-order{margin-top:0}
7453
- .dsm-workbuddy-pool-account-name .dsm-workbuddy-pool-current-tag{align-self:center;margin-top:0}
7454
- /* The name still has to be allowed to SHRINK. The <b> carries nowrap + ellipsis,
7455
- whose whole point is that a long account name ends in "…" rather than
7456
- pushing the line — but as a flex item it defaults to min-width:auto, i.e.
7457
- its content width, and then the ellipsis can never engage. */
7458
- .dsm-workbuddy-pool-account-name b{min-width:0;max-width:100%}
7459
- /* The three middle facts, laid out as one line of the same sentence. */
7460
- .dsm-workbuddy-pool-credits{flex:0 1 auto;flex-direction:row;flex-wrap:wrap;align-items:baseline;gap:2px 8px}
7461
- .dsm-workbuddy-pool-probe{flex:1 1 auto;flex-direction:row;flex-wrap:wrap;align-items:baseline;gap:2px 8px}
7462
- .dsm-workbuddy-pool-checkin{flex:none}
7463
- .dsm-workbuddy-pool-row-actions{flex:1 1 100%;justify-content:flex-start;padding-top:4px}
8151
+ .dsm-workbuddy-pool-row{column-gap:8px;row-gap:3px;padding:9px 12px}
8152
+ .dsm-workbuddy-pool-row-head{padding:7px 12px}
8153
+ .dsm-workbuddy-pool-probe-sep,.dsm-workbuddy-pool-tested-at{display:none}
7464
8154
  }
7465
8155
 
7466
8156
  /* ISSUE #198, the same breakpoint the pool row already uses. On a phone the model
@@ -7761,7 +8451,7 @@ window.__ModuleLoader__.load({
7761
8451
  border:1px solid var(--dsw-alias-border-l2,#3a3d45);
7762
8452
  }
7763
8453
 
7764
- `;
8454
+ ` + seriesLayoutCss("workbuddy");
7765
8455
  /**
7766
8456
  * Composer credit readout styles, injected by the readout component itself.
7767
8457
  *
@@ -8740,6 +9430,15 @@ window.__ModuleLoader__.load({
8740
9430
  */
8741
9431
  const [togglingCredits, setTogglingCredits] = (0, react.useState)(void 0);
8742
9432
  /**
9433
+ * Which region's new-model-segment flag is being written right now.
9434
+ *
9435
+ * Tracked separately from {@link togglingCredits} for the same reason those
9436
+ * are separate from `togglingRegion`: they are different fields of one region
9437
+ * slot, so one in-flight write must not disable the other control while both
9438
+ * stay serialized against the SAVE writers.
9439
+ */
9440
+ const [togglingNewModels, setTogglingNewModels] = (0, react.useState)(void 0);
9441
+ /**
8743
9442
  * Which video-model pin is being written right now: the tag string, or
8744
9443
  * undefined.
8745
9444
  *
@@ -8806,6 +9505,8 @@ window.__ModuleLoader__.load({
8806
9505
  const [sessionTitleBusy, setSessionTitleBusy] = (0, react.useState)(false);
8807
9506
  const [channelRejectContinueOn, setChannelRejectContinueOn] = (0, react.useState)(void 0);
8808
9507
  const [channelRejectContinueBusy, setChannelRejectContinueBusy] = (0, react.useState)(false);
9508
+ const [dropAllThinkingOn, setDropAllThinkingOn] = (0, react.useState)(void 0);
9509
+ const [dropAllThinkingBusy, setDropAllThinkingBusy] = (0, react.useState)(false);
8809
9510
  /**
8810
9511
  * Probe results, keyed by region then model id.
8811
9512
  *
@@ -9196,6 +9897,20 @@ window.__ModuleLoader__.load({
9196
9897
  return regionCreditsShownOf(settingsScope?.getSnapshot().value, item);
9197
9898
  };
9198
9899
  /**
9900
+ * Whether this region's composer pill may show its "· N 新模型" segment.
9901
+ *
9902
+ * Host answer first, settings mirror second — same measured reason as
9903
+ * {@link creditsShownOn}. Both sources read this flag OPT-IN (`=== true`):
9904
+ * "new" means first seen by THIS machine, so on a fresh install it would
9905
+ * announce the entire roster, and an absent value must not become consent.
9906
+ * See `showNewModelsInMainUi` in the schema.
9907
+ */
9908
+ const newModelsShownOn = (item) => {
9909
+ const usage = statusByRegion[item];
9910
+ if (typeof usage?.showNewModelsInMainUi === "boolean") return usage.showNewModelsInMainUi;
9911
+ return regionNewModelsShownOf(settingsScope?.getSnapshot().value, item);
9912
+ };
9913
+ /**
9199
9914
  * Whether the model may call the image tool in this region.
9200
9915
  *
9201
9916
  * Read off the Host's answer first, like {@link creditsShownOn} and for the
@@ -9310,6 +10025,19 @@ window.__ModuleLoader__.load({
9310
10025
  if (mounted.current) setTogglingCredits(void 0);
9311
10026
  }
9312
10027
  };
10028
+ const toggleNewModels = async (item, shown) => {
10029
+ if (settingsScope === void 0) return;
10030
+ setTogglingNewModels(item);
10031
+ try {
10032
+ const slot = nextRegionNewModelsShown(settingsScope.getSnapshot().value, item, shown)[item];
10033
+ await writeRegionNewModelsShown(settingsScope, item, shown, typeof slot === "object" && slot !== null ? slot : {});
10034
+ await refreshUsage(item);
10035
+ } catch (error) {
10036
+ if (mounted.current) setAccountError(error instanceof Error ? error.message : t("row.requestFailed"));
10037
+ } finally {
10038
+ if (mounted.current) setTogglingNewModels(void 0);
10039
+ }
10040
+ };
9313
10041
  const toggleCredits = async (item, shown) => {
9314
10042
  if (settingsScope === void 0) return;
9315
10043
  setTogglingCredits(item);
@@ -9429,6 +10157,17 @@ window.__ModuleLoader__.load({
9429
10157
  };
9430
10158
  };
9431
10159
  /**
10160
+ * The reasoning-redaction switch (issue #213).
10161
+ *
10162
+ * Same three-level resolution as every other switch: this card's own verified
10163
+ * write, then the committed snapshot. No Host mirror, because this one has no
10164
+ * status-document field — it does not change any number the card displays.
10165
+ */
10166
+ const dropAllThinkingValue = () => {
10167
+ if (dropAllThinkingOn !== void 0) return dropAllThinkingOn;
10168
+ return (settingsScope?.getSnapshot().value)?.["dropAllThinking"] === true;
10169
+ };
10170
+ /**
9432
10171
  * Flip one upstream-identity switch.
9433
10172
  *
9434
10173
  * No `refreshUsage` afterwards, unlike the CLI switch: these change the shape
@@ -9438,8 +10177,8 @@ window.__ModuleLoader__.load({
9438
10177
  */
9439
10178
  const toggleUpstreamSwitch = async (field, enabled) => {
9440
10179
  if (settingsScope === void 0) return;
9441
- const setBusy = field === "usageIdentity" ? setUsageIdentityBusy : field === "keepPromptLast" ? setKeepPromptLastBusy : field === "sessionTitle" ? setSessionTitleBusy : setChannelRejectContinueBusy;
9442
- const setOwn = field === "usageIdentity" ? setUsageIdentityOn : field === "keepPromptLast" ? setKeepPromptLastOn : field === "sessionTitle" ? setSessionTitleOn : setChannelRejectContinueOn;
10180
+ const setBusy = field === "usageIdentity" ? setUsageIdentityBusy : field === "keepPromptLast" ? setKeepPromptLastBusy : field === "sessionTitle" ? setSessionTitleBusy : field === "channelRejectContinue" ? setChannelRejectContinueBusy : setDropAllThinkingBusy;
10181
+ const setOwn = field === "usageIdentity" ? setUsageIdentityOn : field === "keepPromptLast" ? setKeepPromptLastOn : field === "sessionTitle" ? setSessionTitleOn : field === "channelRejectContinue" ? setChannelRejectContinueOn : setDropAllThinkingOn;
9443
10182
  setBusy(true);
9444
10183
  try {
9445
10184
  await writeUpstreamSwitch(settingsScope, field, field === "sessionTitle" ? {
@@ -10071,16 +10810,6 @@ window.__ModuleLoader__.load({
10071
10810
  const sweepTpsEnabledModels = () => {
10072
10811
  measureTpsFor(visibleModels.filter((model) => activeEnabledIds.has(model.id)).map((model) => model.id));
10073
10812
  };
10074
- /**
10075
- * Sweep EVERY model in the region's live catalog, enabled or not.
10076
- *
10077
- * Deliberately the whole VISIBLE catalog and nothing else: those are the ids
10078
- * the host can validate against its own catalog, so this cannot spend credit
10079
- * on an id that only exists in a config file.
10080
- */
10081
- const sweepAllModels = () => {
10082
- sweepModels(visibleModels.map((model) => model.id));
10083
- };
10084
10813
  const saveModels = async () => {
10085
10814
  if (settingsScope === void 0) return;
10086
10815
  if (status.status !== "signed-in") return;
@@ -10836,6 +11565,42 @@ window.__ModuleLoader__.load({
10836
11565
  })]
10837
11566
  })]
10838
11567
  });
11568
+ /**
11569
+ * ISSUE #213: redact past reasoning from the request.
11570
+ *
11571
+ * Its own group rather than a row inside the channel-reject block, because the
11572
+ * two answer different failures: that switch RESENDS after a refusal, this one
11573
+ * removes the text that gets scanned in the first place. Grouping them would
11574
+ * imply they are alternatives of one feature.
11575
+ */
11576
+ const dropAllThinkingPreference = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11577
+ className: "dsm-workbuddy-prefs",
11578
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11579
+ className: "dsm-workbuddy-pref-hint",
11580
+ children: t("row.dropAllThinkingLead")
11581
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
11582
+ className: "dsm-workbuddy-pref dsm-workbuddy-upstream-pref",
11583
+ title: t("row.dropAllThinkingHint"),
11584
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
11585
+ type: "checkbox",
11586
+ className: "dsm-workbuddy-drop-thinking-check",
11587
+ checked: dropAllThinkingValue(),
11588
+ disabled: !canWrite || saving || poolBusy || dropAllThinkingBusy,
11589
+ onChange: (event) => {
11590
+ toggleUpstreamSwitch("dropAllThinking", event.target.checked);
11591
+ }
11592
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
11593
+ className: "dsm-workbuddy-pref-copy",
11594
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11595
+ className: "dsm-workbuddy-pref-label",
11596
+ children: t("row.dropAllThinkingLabel")
11597
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11598
+ className: "dsm-workbuddy-pref-hint",
11599
+ children: t("row.dropAllThinkingHint")
11600
+ })]
11601
+ })]
11602
+ })]
11603
+ });
10839
11604
  const creditPreferences = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10840
11605
  className: "dsm-workbuddy-prefs",
10841
11606
  children: [
@@ -10871,6 +11636,28 @@ window.__ModuleLoader__.load({
10871
11636
  })]
10872
11637
  })]
10873
11638
  }),
11639
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
11640
+ className: "dsm-workbuddy-pref",
11641
+ title: t("row.showNewModelsHint"),
11642
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
11643
+ type: "checkbox",
11644
+ className: "dsm-workbuddy-new-models-check",
11645
+ checked: activeRegionOn ? newModelsShownOn(activeRegion) : false,
11646
+ disabled: !activeRegionOn || togglingNewModels === activeRegion || !canWrite || saving || poolBusy,
11647
+ onChange: (event) => {
11648
+ toggleNewModels(activeRegion, event.target.checked);
11649
+ }
11650
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
11651
+ className: "dsm-workbuddy-pref-copy",
11652
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11653
+ className: "dsm-workbuddy-pref-label",
11654
+ children: t("row.showNewModels")
11655
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11656
+ className: "dsm-workbuddy-pref-hint",
11657
+ children: t("row.showNewModelsHintInline")
11658
+ })]
11659
+ })]
11660
+ }),
10874
11661
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
10875
11662
  className: "dsm-workbuddy-pref dsm-workbuddy-pref-indent",
10876
11663
  title: t("row.creditPositionHint"),
@@ -10921,11 +11708,7 @@ window.__ModuleLoader__.load({
10921
11708
  })
10922
11709
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("nav.back") })]
10923
11710
  }) : null,
10924
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
10925
- className: "dsm-workbuddy-page-icon",
10926
- src: WORKBUDDY_PLUGIN_ICON,
10927
- alt: ""
10928
- }),
11711
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PluginIcon, { className: "dsm-workbuddy-page-icon" }),
10929
11712
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10930
11713
  className: "dsm-workbuddy-page-title",
10931
11714
  children: title
@@ -10984,10 +11767,6 @@ window.__ModuleLoader__.load({
10984
11767
  className: "dsm-workbuddy-models-summary dsm-workbuddy-tab-hint",
10985
11768
  children: t("row.tabHint")
10986
11769
  }),
10987
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
10988
- className: "dsm-workbuddy-models-summary dsm-workbuddy-free-quota-warn",
10989
- children: t("row.tabFreeQuotaWarn")
10990
- }),
10991
11770
  signedIn ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10992
11771
  className: "dsm-workbuddy-panels",
10993
11772
  role: "tablist",
@@ -11157,7 +11936,7 @@ window.__ModuleLoader__.load({
11157
11936
  children: [
11158
11937
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11159
11938
  className: "dsm-workbuddy-models-head",
11160
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
11939
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
11161
11940
  className: "dsm-workbuddy-models-title-row",
11162
11941
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h3", {
11163
11942
  className: "dsm-workbuddy-models-title",
@@ -11166,10 +11945,7 @@ window.__ModuleLoader__.load({
11166
11945
  children: t("row.modelsDirty")
11167
11946
  }) : null]
11168
11947
  })
11169
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
11170
- className: "dsm-workbuddy-models-summary",
11171
- children: t("row.modelsSummary", { count: activeEnabledIds.size })
11172
- })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11948
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11173
11949
  className: "dsm-workbuddy-models-head-actions",
11174
11950
  children: [
11175
11951
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
@@ -11192,17 +11968,6 @@ window.__ModuleLoader__.load({
11192
11968
  total: sweeping.total
11193
11969
  })
11194
11970
  }),
11195
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
11196
- type: "button",
11197
- className: "dsm-btn dsm-btn-outline dsm-workbuddy-models-sweep",
11198
- disabled: busy || sweeping !== void 0 || visibleModels.length === 0,
11199
- title: t("row.modelsTestAllHint"),
11200
- onClick: sweepAllModels,
11201
- children: sweeping === void 0 ? t("row.modelsTestAll") : t("row.modelsTesting", {
11202
- done: sweeping.done,
11203
- total: sweeping.total
11204
- })
11205
- }),
11206
11971
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
11207
11972
  type: "button",
11208
11973
  className: "dsm-btn dsm-btn-outline dsm-workbuddy-models-sweep",
@@ -11234,113 +11999,93 @@ window.__ModuleLoader__.load({
11234
11999
  children: [
11235
12000
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11236
12001
  className: "dsm-workbuddy-model-head",
11237
- children: [
11238
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
11239
- className: "dsm-workbuddy-model-enabled",
11240
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
11241
- type: "checkbox",
11242
- checked: activeEnabledIds.has(model.id),
11243
- disabled: !canWrite || saving,
11244
- onChange: () => {
11245
- toggleModel(model.id);
11246
- }
11247
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
11248
- className: "dsm-workbuddy-model-copy",
11249
- children: [
11250
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
11251
- className: "dsm-workbuddy-model-name",
11252
- children: [model.name, effectiveRate(model) === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
11253
- className: "dsm-workbuddy-model-name-rate",
11254
- children: ["x", effectiveRate(model).toFixed(2)]
11255
- })]
11256
- }),
11257
- promoChip(model),
11258
- busyIcon(busyLevels[model.id], uiLanguage())
11259
- ]
11260
- })]
11261
- }),
11262
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
11263
- className: "dsm-workbuddy-model-image",
11264
- title: imageCheckboxHint(model, t),
11265
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
11266
- type: "checkbox",
11267
- checked: activeImageIds.has(model.id),
11268
- disabled: !canWrite || saving,
11269
- onChange: () => {
11270
- toggleImage(model.id);
11271
- }
11272
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("row.modelImage") })]
11273
- }),
11274
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
11275
- className: `dsm-workbuddy-model-off${offBlocked(model) ? " dsm-workbuddy-model-off-blocked" : ""}`,
11276
- title: offBlocked(model) ? t("row.modelOffRefusedHint") : t("row.modelOffHint"),
12002
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
12003
+ className: "dsm-workbuddy-model-enabled",
12004
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
12005
+ type: "checkbox",
12006
+ checked: activeEnabledIds.has(model.id),
12007
+ disabled: !canWrite || saving,
12008
+ onChange: () => {
12009
+ toggleModel(model.id);
12010
+ }
12011
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
12012
+ className: "dsm-workbuddy-model-copy",
11277
12013
  children: [
11278
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
12014
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
12015
+ className: "dsm-workbuddy-model-name",
12016
+ children: [model.name, effectiveRate(model) === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
12017
+ className: "dsm-workbuddy-model-name-rate",
12018
+ children: ["x", effectiveRate(model).toFixed(2)]
12019
+ })]
12020
+ }),
12021
+ promoChip(model),
12022
+ busyIcon(busyLevels[model.id], uiLanguage())
12023
+ ]
12024
+ })]
12025
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12026
+ className: "dsm-workbuddy-model-controls",
12027
+ children: [
12028
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
12029
+ className: "dsm-workbuddy-model-image",
12030
+ title: imageCheckboxHint(model, t),
12031
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
11279
12032
  type: "checkbox",
11280
- checked: activeOffIds.has(model.id),
11281
- disabled: !canWrite || saving || offBlocked(model),
12033
+ checked: activeImageIds.has(model.id),
12034
+ disabled: !canWrite || saving,
11282
12035
  onChange: () => {
11283
- toggleOff(model.id);
12036
+ toggleImage(model.id);
11284
12037
  }
11285
- }),
11286
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("row.modelOff") }),
11287
- offBlocked(model) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
11288
- className: "dsm-workbuddy-model-off-flag",
11289
- children: t("row.modelOffRefused")
11290
- }) : null
11291
- ]
11292
- }),
11293
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
11294
- className: "dsm-workbuddy-context-budget",
11295
- "aria-label": t("row.contextBudget"),
11296
- value: String(effectiveContextBudget(model.nativeContextWindow, activeContextBudgets[model.id])),
11297
- disabled: !canWrite || saving,
11298
- onChange: (event) => {
11299
- const picked = Number(event.target.value);
11300
- setContextBudget(model.id, picked === model.nativeContextWindow ? void 0 : picked);
11301
- },
11302
- children: [
11303
- model.nativeContextWindow > 2e5 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
11304
- value: 2e5,
11305
- children: "200K"
11306
- }) : null,
11307
- model.nativeContextWindow > 5e5 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
11308
- value: 5e5,
11309
- children: "500K"
11310
- }) : null,
11311
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
11312
- value: model.nativeContextWindow,
11313
- children: formatCapacity(model.nativeContextWindow, t("row.modelUnknown"))
11314
- })
11315
- ]
11316
- }),
11317
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11318
- className: "dsm-workbuddy-model-actions-buttons",
11319
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
11320
- type: "button",
11321
- className: "dsm-btn dsm-btn-outline dsm-workbuddy-model-probe",
11322
- disabled: probing[model.id] === true || status.status !== "signed-in",
11323
- title: t("row.probeHint"),
11324
- onClick: () => {
11325
- probeModels([model.id]);
11326
- },
11327
- children: probing[model.id] === true ? t("row.probing") : t("row.probe")
11328
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
11329
- type: "button",
11330
- className: "dsm-btn dsm-btn-outline dsm-workbuddy-model-probe",
11331
- disabled: tpsProbing[model.id] === true || status.status !== "signed-in",
11332
- title: t("row.tpsHint"),
11333
- onClick: () => {
11334
- measureTpsFor([model.id]);
12038
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("row.modelImage") })]
12039
+ }),
12040
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
12041
+ className: `dsm-workbuddy-model-off${offBlocked(model) ? " dsm-workbuddy-model-off-blocked" : ""}`,
12042
+ title: offBlocked(model) ? t("row.modelOffRefusedHint") : t("row.modelOffHint"),
12043
+ children: [
12044
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
12045
+ type: "checkbox",
12046
+ checked: activeOffIds.has(model.id),
12047
+ disabled: !canWrite || saving || offBlocked(model),
12048
+ onChange: () => {
12049
+ toggleOff(model.id);
12050
+ }
12051
+ }),
12052
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("row.modelOff") }),
12053
+ offBlocked(model) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12054
+ className: "dsm-workbuddy-model-off-flag",
12055
+ children: t("row.modelOffRefused")
12056
+ }) : null
12057
+ ]
12058
+ }),
12059
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
12060
+ className: "dsm-workbuddy-context-budget",
12061
+ "aria-label": t("row.contextBudget"),
12062
+ value: String(effectiveContextBudget(model.nativeContextWindow, activeContextBudgets[model.id])),
12063
+ disabled: !canWrite || saving,
12064
+ onChange: (event) => {
12065
+ const picked = Number(event.target.value);
12066
+ setContextBudget(model.id, picked === model.nativeContextWindow ? void 0 : picked);
11335
12067
  },
11336
- children: tpsProbing[model.id] === true ? t("row.tpsMeasuring") : t("row.tpsMeasure")
11337
- })]
11338
- })
11339
- ]
12068
+ children: [
12069
+ model.nativeContextWindow > 2e5 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
12070
+ value: 2e5,
12071
+ children: "200K"
12072
+ }) : null,
12073
+ model.nativeContextWindow > 5e5 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
12074
+ value: 5e5,
12075
+ children: "500K"
12076
+ }) : null,
12077
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
12078
+ value: model.nativeContextWindow,
12079
+ children: formatCapacity(model.nativeContextWindow, t("row.modelUnknown"))
12080
+ })
12081
+ ]
12082
+ })
12083
+ ]
12084
+ })]
11340
12085
  }),
11341
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12086
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11342
12087
  className: "dsm-workbuddy-model-details",
11343
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12088
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11344
12089
  className: "dsm-workbuddy-model-meta",
11345
12090
  children: [
11346
12091
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("row.modelContext", { context: formatCapacity(model.nativeContextWindow, t("row.modelUnknown")) }) }),
@@ -11374,7 +12119,28 @@ window.__ModuleLoader__.load({
11374
12119
  });
11375
12120
  })()
11376
12121
  ]
11377
- })
12122
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12123
+ className: "dsm-workbuddy-model-actions-buttons",
12124
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
12125
+ type: "button",
12126
+ className: "dsm-btn dsm-btn-outline dsm-workbuddy-model-probe",
12127
+ disabled: probing[model.id] === true || status.status !== "signed-in",
12128
+ title: t("row.probeHint"),
12129
+ onClick: () => {
12130
+ probeModels([model.id]);
12131
+ },
12132
+ children: probing[model.id] === true ? t("row.probing") : t("row.probe")
12133
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
12134
+ type: "button",
12135
+ className: "dsm-btn dsm-btn-outline dsm-workbuddy-model-probe",
12136
+ disabled: tpsProbing[model.id] === true || status.status !== "signed-in",
12137
+ title: t("row.tpsHint"),
12138
+ onClick: () => {
12139
+ measureTpsFor([model.id]);
12140
+ },
12141
+ children: tpsProbing[model.id] === true ? t("row.tpsMeasuring") : t("row.tpsMeasure")
12142
+ })]
12143
+ })]
11378
12144
  }),
11379
12145
  (() => {
11380
12146
  const result = probes[activeRegion]?.[model.id];
@@ -11462,7 +12228,15 @@ window.__ModuleLoader__.load({
11462
12228
  creditPreferences,
11463
12229
  upstreamSwitches,
11464
12230
  channelRejectContinuePreference,
11465
- sidebarPanelPreference
12231
+ dropAllThinkingPreference,
12232
+ sidebarPanelPreference,
12233
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12234
+ className: "dsm-workbuddy-prefs",
12235
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12236
+ className: "dsm-workbuddy-pref-hint",
12237
+ children: t("row.iconStyleLead")
12238
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconStylePreference, { t })]
12239
+ })
11466
12240
  ]
11467
12241
  }),
11468
12242
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -11648,6 +12422,14 @@ window.__ModuleLoader__.load({
11648
12422
  });
11649
12423
  if (pageSurface || settingsSurface) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11650
12424
  className: settingsSurface ? "dsm-workbuddy-page dsm-workbuddy-settings" : "dsm-workbuddy-page",
12425
+ ref: (page) => {
12426
+ if (page !== null) requestAnimationFrame(() => {
12427
+ updateStickyTabs(page);
12428
+ });
12429
+ },
12430
+ onScroll: (event) => {
12431
+ updateStickyTabs(event.currentTarget);
12432
+ },
11651
12433
  children: [pageHead, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
11652
12434
  className: "dsm-workbuddy-page-body",
11653
12435
  children: cardBody
@@ -11664,11 +12446,7 @@ window.__ModuleLoader__.load({
11664
12446
  setCardOpen(!cardOpen);
11665
12447
  },
11666
12448
  children: [
11667
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
11668
- className: "dsm-plugin-card-icon",
11669
- src: WORKBUDDY_PLUGIN_ICON,
11670
- alt: ""
11671
- }),
12449
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PluginIcon, { className: "dsm-plugin-card-icon" }),
11672
12450
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
11673
12451
  className: "dsm-plugin-card-head",
11674
12452
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -11985,6 +12763,22 @@ window.__ModuleLoader__.load({
11985
12763
  return typeof value === "boolean" ? value : void 0;
11986
12764
  }
11987
12765
  /**
12766
+ * Whether this region's usage document allows the "· N 新模型" segment.
12767
+ *
12768
+ * OPT-IN, so this is the mirror image of {@link hostCreditsShownOf}: absent
12769
+ * means NO. "New" means first seen by this machine, not newly listed upstream,
12770
+ * so on a fresh install it would announce the entire roster — a number that is
12771
+ * true by construction and reads as a defect. See `showNewModelsInMainUi` in the
12772
+ * schema for the full argument.
12773
+ *
12774
+ * The `error` variant answers `false` rather than `undefined`: with no document
12775
+ * there is no roster, hence no new models, hence nothing to announce anyway.
12776
+ */
12777
+ function hostNewModelsShownOf(usage) {
12778
+ if (usage === void 0 || usage.status === "error") return false;
12779
+ return usage.showNewModelsInMainUi === true;
12780
+ }
12781
+ /**
11988
12782
  * A same-day instant, as the READER's locale writes it.
11989
12783
  *
11990
12784
  * The locale is `undefined` — the reader's, not a fixed one — so an English UI
@@ -12422,9 +13216,10 @@ window.__ModuleLoader__.load({
12422
13216
  const signedOut = usage !== void 0 && usage.status === "signed-out";
12423
13217
  const valueText = total === void 0 ? "—" : formatCredits(total);
12424
13218
  const label = t(activeRegion === "cn" ? "composer.pointsCn" : "composer.pointsGlobal");
12425
- const newModelNames = newModelIdsOf(usage).map((id) => modelNameOf(signedIn?.models ?? [], id));
13219
+ const newModelsShown = hostNewModelsShownOf(usage);
13220
+ const newModelNames = (newModelsShown ? newModelIdsOf(usage) : []).map((id) => modelNameOf(signedIn?.models ?? [], id));
12426
13221
  const newModelTooltip = newModelNames.length === 0 ? void 0 : `${t("composer.newModelsTitle")}${newModelNames.slice(0, 3).join(t("composer.newModelsSep"))}${newModelNames.length > 3 ? "…" : ""}`;
12427
- const rosterSeenNote = signedIn?.rosterSeenVersionNote;
13222
+ const rosterSeenNote = newModelsShown ? signedIn?.rosterSeenVersionNote : void 0;
12428
13223
  /**
12429
13224
  * The table's rows: every account in this region, with its balance.
12430
13225
  *
@@ -12844,20 +13639,39 @@ window.__ModuleLoader__.load({
12844
13639
  * the text and render the addition beside it, so this component returns the
12845
13640
  * name first and never replaces it.
12846
13641
  *
12847
- * FOR A PROVIDER THAT IS NOT OURS IT RENDERS THE PLAIN CATALOG NAME — not
12848
- * nothing. The distinction is not cosmetic: this slot is `kind: "single"`, so
12849
- * whatever registers becomes the cell's only occupant, and an occupant that
12850
- * outputs plain text still occupies it. A previous version of this paragraph
12851
- * said the component "renders nothing at all" for a foreign provider, which
12852
- * made the lost-decoration cost look harmless; issue #138 is what that
12853
- * mis-description looks like from the outside (the host's own 1017 badge
12854
- * disappears on ITS rows while this plugin holds the cell). Returning `null`
12855
- * would not free the cell either — occupancy is decided by registration, never
12856
- * by what the component outputs.
13642
+ * FOR A PROVIDER THAT IS NOT OURS IT RENDERS THE CATALOG NAME PLUS THAT MODEL'S
13643
+ * OWN `badge` — never another plugin's component. The name half is not
13644
+ * cosmetic: this slot is `kind: "single"`, so whatever registers becomes the
13645
+ * cell's only occupant, and an occupant that outputs plain text still occupies
13646
+ * it. A previous version of this paragraph said the component "renders nothing
13647
+ * at all" for a foreign provider, which made the lost-decoration cost look
13648
+ * harmless; issue #138 is what that mis-description looks like from the outside
13649
+ * (the host's own 1017 badge disappears on ITS rows while this plugin holds the
13650
+ * cell). Returning `null` would not free the cell either — occupancy is decided
13651
+ * by registration, never by what the component outputs.
13652
+ *
13653
+ * THE `badge` HALF IS WHAT MAKES SIBLING CHIPS SURVIVE. The host runs its own
13654
+ * badge fallback only when the cell has NO occupant, so once this plugin wins the
13655
+ * cell it must draw a sibling's badge itself or that badge is never drawn
13656
+ * anywhere. The data is `props.model.badge` — the host's catalog field, which
13657
+ * arrives here regardless of who published it — so this is not the coordination
13658
+ * `docs/DESIGN.md` §零 rules out: no ledger is read, no foreign component is
13659
+ * rendered, and the output does not change based on which plugins are installed.
13660
+ * See `HostBadgeChip` and `docs/MODEL-LABEL-SPEC.md`.
12857
13661
  */
12858
13662
  /** The provider ids this plugin registers, and the region each one serves. */
12859
13663
  const PROVIDER_REGIONS = /* @__PURE__ */ new Map([["workbuddy", "cn"], ["workbuddy-global", "global"]]);
12860
13664
  /**
13665
+ * Every provider id this plugin owns, as a list.
13666
+ *
13667
+ * Exported because on a `keyed` host the label seat is one registration PER
13668
+ * provider id — the registration side needs the same list the component uses to
13669
+ * decide "is this row mine", and two copies of it would drift. Order is
13670
+ * irrelevant to the registry (each id is its own cell); it is stable so the
13671
+ * diagnostics line reads the same on every boot.
13672
+ */
13673
+ const WORKBUDDY_PROVIDER_IDS = [...PROVIDER_REGIONS.keys()];
13674
+ /**
12861
13675
  * The region a provider id serves, or `undefined` for a provider that is not
12862
13676
  * this plugin's.
12863
13677
  *
@@ -12891,6 +13705,7 @@ window.__ModuleLoader__.load({
12891
13705
  });
12892
13706
  if (!response.ok) return void 0;
12893
13707
  const body = await response.json();
13708
+ const showNewModels = body.showNewModelsInMainUi === true;
12894
13709
  const promos = {};
12895
13710
  const rates = {};
12896
13711
  for (const model of body.models ?? []) {
@@ -12901,7 +13716,7 @@ window.__ModuleLoader__.load({
12901
13716
  levels: body.busyLevels ?? {},
12902
13717
  promos,
12903
13718
  rates,
12904
- newModelIds: normalizeNewModelIds(body.newModelIds)
13719
+ newModelIds: showNewModels ? normalizeNewModelIds(body.newModelIds) : []
12905
13720
  };
12906
13721
  caches.set(region, {
12907
13722
  snapshot,
@@ -12991,6 +13806,120 @@ window.__ModuleLoader__.load({
12991
13806
  });
12992
13807
  }
12993
13808
  /**
13809
+ * The one line a foreign badge shows, in the reader's language.
13810
+ *
13811
+ * Mirrors the host's own resolver (`ctx.locale.resolveText`): a plain string is
13812
+ * used verbatim; a table is looked up by the full lowercase tag, then its base
13813
+ * tag (`de-DE` → `de`), then `en`, which the contract requires. The host treats
13814
+ * an EMPTY string as a translation that exists, so this function deliberately
13815
+ * goes one step further and treats it as absent — a blank chip is a decoration
13816
+ * that says nothing, and this component would rather draw the bare name.
13817
+ *
13818
+ * @param text - The badge's literal or its translation table.
13819
+ * @returns The line to draw, or `undefined` when nothing readable is left.
13820
+ */
13821
+ function resolveHostBadgeText(text) {
13822
+ if (typeof text === "string") return text.trim() === "" ? void 0 : text;
13823
+ if (text === null || typeof text !== "object") return void 0;
13824
+ const language = uiLanguage().toLowerCase();
13825
+ const base = language.split("-")[0] ?? "";
13826
+ const picked = text[language] ?? (base === "" ? void 0 : text[base]) ?? text.en;
13827
+ if (typeof picked !== "string" || picked.trim() === "") return void 0;
13828
+ return picked;
13829
+ }
13830
+ /**
13831
+ * The tone palette, mapped onto the tokens the host's own `Tag` paints.
13832
+ *
13833
+ * WHY THESE EXACT TOKENS. They are read off the host's `Tag.module.css`
13834
+ * (0.2.2-rc.1), not invented: `info` rides `state-business-primary` (NOT
13835
+ * `brand-primary`) and `warning` rides `state-warn-primary` (NOT
13836
+ * `state-warn-secondary`). Getting either wrong leaves two chips in one row
13837
+ * that are supposed to look identical and do not.
13838
+ *
13839
+ * `neutral` is the fallback for an unknown tone: the host's `Tag` would render
13840
+ * such a chip unstyled, which reads as a rendering bug next to a real one.
13841
+ */
13842
+ const HOST_BADGE_TONES = {
13843
+ neutral: {
13844
+ color: "var(--dsw-alias-label-secondary)",
13845
+ background: "var(--dsw-alias-bg-module-platform)"
13846
+ },
13847
+ info: {
13848
+ color: "var(--dsw-alias-state-business-primary)",
13849
+ background: "color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent)"
13850
+ },
13851
+ success: {
13852
+ color: "var(--dsw-alias-state-success-primary)",
13853
+ background: "color-mix(in srgb, var(--dsw-alias-state-success-primary) 10%, transparent)"
13854
+ },
13855
+ warning: {
13856
+ color: "var(--dsw-alias-state-warn-primary)",
13857
+ background: "color-mix(in srgb, var(--dsw-alias-state-warn-primary) 12%, transparent)"
13858
+ }
13859
+ };
13860
+ /**
13861
+ * A badge another provider published for its own model, drawn where the host's
13862
+ * own fallback would have drawn it.
13863
+ *
13864
+ * WHY THIS PLUGIN DRAWS IT AT ALL. `conversation.input.model.label` is a
13865
+ * `single` slot, so this component is called for EVERY provider's rows, not just
13866
+ * its own. The host only runs its own badge fallback when the cell has no
13867
+ * occupant at all, so without this branch a sibling plugin's badge would never
13868
+ * appear anywhere while this plugin holds the cell.
13869
+ *
13870
+ * WHY IT IS NOT INTER-PLUGIN COORDINATION (`docs/DESIGN.md` §零). The data is
13871
+ * `props.model.badge` — the host's catalog field, handed to every occupant of
13872
+ * the cell. This component does not know which plugin filled it, does not read
13873
+ * the slot ledger, does not render another plugin's component, and its output is
13874
+ * identical whether or not any sibling is installed. Data flows one way through
13875
+ * the host; there is no channel between plugins. That is the difference between
13876
+ * this and §零's rejected "copy the host's 1017 badge", which hard-codes one
13877
+ * specific plugin's conditions and styles.
13878
+ *
13879
+ * NOT A FETCH, NOT A TIMER. A picker can show twenty foreign rows at once, so
13880
+ * this must stay a pure function of its props.
13881
+ *
13882
+ * NO `placement` PARAMETER, DELIBERATELY. The chip is always drawn AFTER the
13883
+ * name now, so where it goes is the caller's one-line decision, not something
13884
+ * this function needs to know. It used to take `placement` and ignore it, which
13885
+ * read as though a placement-dependent rule existed inside the chip.
13886
+ *
13887
+ * @param props - The badge to draw.
13888
+ * @returns The chip, or `undefined` when there is nothing readable to draw.
13889
+ */
13890
+ function HostBadgeChip(props) {
13891
+ const badge = props.badge;
13892
+ if (badge === null || typeof badge !== "object") return void 0;
13893
+ const label = resolveHostBadgeText(badge.text);
13894
+ if (label === void 0) return void 0;
13895
+ const tone = Object.hasOwn(HOST_BADGE_TONES, badge.tone) ? HOST_BADGE_TONES[badge.tone] : HOST_BADGE_TONES.neutral;
13896
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
13897
+ className: "dsm-workbuddy-model-label-host-badge",
13898
+ title: label,
13899
+ style: {
13900
+ color: tone.color,
13901
+ background: tone.background
13902
+ },
13903
+ children: label
13904
+ });
13905
+ }
13906
+ /**
13907
+ * Whether a model's badge will actually draw something.
13908
+ *
13909
+ * The caller needs this BEFORE it decides on the separator: `<HostBadgeChip/>`
13910
+ * is always an element, so rendering `{chip} {name}` and then finding the chip
13911
+ * empty leaves a trailing space on the row. Deciding from the text is the only
13912
+ * way to know, which is why the resolution is exported rather than duplicated.
13913
+ *
13914
+ * @param badge - The catalog badge, if any.
13915
+ * @returns Whether a chip will be drawn.
13916
+ */
13917
+ function hasDrawableBadge(badge) {
13918
+ const candidate = badge;
13919
+ if (candidate === null || typeof candidate !== "object") return false;
13920
+ return resolveHostBadgeText(candidate.text) !== void 0;
13921
+ }
13922
+ /**
12994
13923
  * The priority this plugin registers the model-label slot at.
12995
13924
  *
12996
13925
  * WHY A DISTINCT PRIORITY AT ALL. `conversation.input.model.label` is a
@@ -13010,24 +13939,83 @@ window.__ModuleLoader__.load({
13010
13939
  * WHY NOT `-1`. That is `dsh-connect-qoder`'s slot priority, and two plugins on
13011
13940
  * one priority collide for exactly the same reason `0` did.
13012
13941
  *
13013
- * WHY `-0.5` IS SAFE AND SELF-CONTAINED. The value only has to be distinct from
13014
- * whatever else claims the cell; `-0.5` is legal, sorts without collision
13015
- * against both `-1` and `0`, and requires knowing nothing about the other
13016
- * plugins. See the "不做插件联动" invariant in `docs/DESIGN.md`.
13942
+ * WHY `-0.5` WAS TOO HIGH — the measured defect. `-0.5` is legal and collides
13943
+ * with nothing, but "distinct from everyone" is NOT the same as "wins", and this
13944
+ * cell only renders its LOWEST priority. `-0.5` sits ABOVE two contributors that
13945
+ * were present in the same profile:
13946
+ *
13947
+ * dsh-connect-qoder -1
13948
+ * dsh-connect-trae -0.25
13949
+ * this plugin -0.5 ← lost to qoder, so this component never ran
13950
+ *
13951
+ * Losing is silent by construction: the winner renders, the loser is simply not
13952
+ * called. The symptom is exactly "the picker shows no badges", with correct
13953
+ * data, a correct component and no error anywhere — which is what made this cost
13954
+ * several rounds to find. The rows still showed `Hy4 · x0.00` because that
13955
+ * string is the catalog `model.name` the WINNER drew, not our label.
13956
+ *
13957
+ * WHY `-105`. The value has to be BELOW every plausible claimant, not merely
13958
+ * different from the ones visible today. That is the whole lesson: `-0.5` was
13959
+ * chosen to be DISTINCT, was distinct, and still lost. Contributors already
13960
+ * shipped at `-10` (`dsh-model-picker-brand`, a label decorator) and `-1`
13961
+ * (`dsh-connect-qoder`), so anything in the single digits is a value someone
13962
+ * else can step under. `-105` is an ordinary number to the sort (no range is
13963
+ * reserved) and makes the ordering a decision of this plugin rather than a race
13964
+ * it keeps losing.
13965
+ *
13966
+ * WHY NOT `-100` — MEASURED, TWICE. `-100` won for a while, then two other
13967
+ * connectors moved underneath it in the same profile:
13968
+ *
13969
+ * dsh-connect-qoder -1 → -101
13970
+ * dsh-connect-trae -0.25 → -102
13971
+ * this plugin -100 → lost to both
13972
+ *
13973
+ * Both of them wrote THIS constant into their own source comments while doing
13974
+ * it, which is the clearest evidence that the cell is a contest and not a
13975
+ * composed surface: each new connector reads the others' shipped values and
13976
+ * steps under the lowest one. `-105` keeps a small gap below `-102` rather than
13977
+ * a huge one, so the next connector that wants the cell has to say so
13978
+ * explicitly too.
13979
+ *
13980
+ * THE COST, STATED PLAINLY. Winning here is not free: in `single` semantics the
13981
+ * winner draws EVERY row, so trae's and qoder's chips would disappear from the
13982
+ * picker exactly as ours did. What closes that gap is NOT a priority choice — it
13983
+ * is `HostBadgeChip` below: a sibling plugin publishes its badge in ITS
13984
+ * `adapter.listModels()`, the host carries it in the catalog, and this component
13985
+ * reproduces it on that plugin's rows. Every connector that adopts that channel
13986
+ * keeps its chip whichever of them wins the cell (`docs/MODEL-LABEL-SPEC.md`).
13987
+ * This value is still chosen so the users of THIS plugin see its full surface,
13988
+ * not because the arrangement is fair.
13989
+ *
13990
+ * A low priority is also the CORRECT semantic here: this label shows more than
13991
+ * any other contributor (name + price + promotion + load + new-model mark), so
13992
+ * it should be the one that takes the cell when several want it.
13993
+ *
13994
+ * WHAT CHANGES WHEN THE HOST KEYS THE SLOT — and why the number stays. On a host
13995
+ * that declares this slot `keyed`, the seat is registered once per provider id
13996
+ * (see `modelLabelSeats` in `./model-label-seat.ts`), each `key` is its own
13997
+ * cell, and priority stops deciding WHO IS VISIBLE: qoder's `-101` and trae's
13998
+ * `-102` no longer share a cell with this `-105`, so none of the three can
13999
+ * shadow another. Priority keeps exactly one meaning inside a cell — the
14000
+ * tie-breaker between two registrations that claim the SAME provider id, where
14001
+ * an equal value throws and the lowest renders. The value is therefore not
14002
+ * lowered to keep winning an auction that no longer happens; it is kept because
14003
+ * it is this plugin's rank for its own rows.
13017
14004
  *
13018
14005
  * WHAT THIS PLUGIN DELIBERATELY DOES NOT DO. It does not read the slot ledger,
13019
14006
  * does not look for another plugin's registration, and does not render another
13020
- * plugin's component. Foreign rows get the plain catalog name, which is exactly
13021
- * the slot's documented minimum. Inter-plugin chaining is out of scope by
14007
+ * plugin's component. Foreign rows get the plain catalog name PLUS the model's
14008
+ * own `badge`, when the host's catalog carries one — that badge is host data
14009
+ * (`props.model.badge`), not another plugin's component, and this component
14010
+ * cannot tell which provider wrote it. Inter-plugin chaining is out of scope by
13022
14011
  * project policy (`docs/DESIGN.md` §零) — and that policy is NOT stricter than
13023
14012
  * the Host's own: the shipped `dsh-client-ui-deepseek-model-label-1017` README
13024
14013
  * lists, under "Known Limitations and Deferred Work", that "another model-label
13025
14014
  * plugin at the same priority conflicts; the two presentations do not compose
13026
14015
  * automatically", and the remedy it documents is DISABLING it in the profile
13027
- * patch — a configuration decision, not a runtime negotiation. A consequence is
13028
- * that when this plugin wins the cell, another contributor's decoration on ITS
13029
- * rows is not composed; that is an accepted, documented trade-off rather than
13030
- * something to work around at runtime.
14016
+ * patch — a configuration decision, not a runtime negotiation. Reproducing a
14017
+ * catalog badge is neither of those: nothing here branches on another plugin
14018
+ * being present.
13031
14019
  *
13032
14020
  * WHY WINNING IS THE RIGHT SIDE OF THAT TRADE. 1017 is a TEMPORARY marker
13033
14021
  * (its own package description: "Temporary 1017 release badge …"; its README
@@ -13041,22 +14029,44 @@ window.__ModuleLoader__.load({
13041
14029
  * Exported so the test asserts against the value that actually ships rather
13042
14030
  * than a copy of it.
13043
14031
  */
13044
- const MODEL_LABEL_PRIORITY = -.5;
14032
+ const MODEL_LABEL_PRIORITY = -105;
13045
14033
  /**
13046
14034
  * The label for one model row in the host's picker.
13047
14035
  *
13048
14036
  * Self-contained by design: a model this plugin owns gets the full label, and
13049
- * anything else gets the plain catalog name. There is no forwarding and no
13050
- * consultation of other plugins' registrations — see `MODEL_LABEL_PRIORITY`.
14037
+ * anything else gets the catalog name plus that model's own `badge`, if its
14038
+ * provider published one. There is no forwarding and no consultation of other
14039
+ * plugins' registrations — see `MODEL_LABEL_PRIORITY`.
14040
+ *
14041
+ * WHY THE FOREIGN BRANCH STILL EXISTS ON A KEYED HOST. It is unreachable there —
14042
+ * each seat is registered under one provider id, the owner dispatches with
14043
+ * `entryKey: provider.id`, so a lookup only ever finds the entry whose key
14044
+ * matches the row it is drawing. But ONE build serves both contracts
14045
+ * (`./model-label-seat.ts` derives the seats from the host's declaration), and
14046
+ * on a `single` host this branch is not just reachable, it is the whole row:
14047
+ * that host renders one winner for every provider. Deleting it would fix the
14048
+ * keyed case by breaking the single one.
14049
+ *
14050
+ * Its continued presence is therefore also the cheapest possible check that the
14051
+ * seat keys are right: on a keyed host, reaching this branch with a WorkBuddy
14052
+ * provider id means a seat was registered under the wrong key, and the row has
14053
+ * silently degraded to the host's fallback — visible as a missing load badge on
14054
+ * exactly those rows, nowhere else.
13051
14055
  *
13052
14056
  * @param props - The host's model identity and the placement of this label.
13053
- * @returns The catalog name, the promotion chip when one holds, and the load
13054
- * badge when the probe reported one.
14057
+ * @returns The catalog name, the promotion chip when one holds, the load badge
14058
+ * when the probe reported one, or a sibling's badge on a foreign row.
13055
14059
  */
13056
14060
  function WorkBuddyModelLabel(props) {
13057
14061
  const { provider, model, placement } = props;
13058
14062
  const region = regionOfProvider(provider.id);
13059
- if (region === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: model.name });
14063
+ if (region === void 0) {
14064
+ if (!hasDrawableBadge(model.badge)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: model.name });
14065
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
14066
+ className: "dsm-workbuddy-model-label dsm-workbuddy-model-label-host-row",
14067
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: model.name }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HostBadgeChip, { badge: model.badge })]
14068
+ });
14069
+ }
13060
14070
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WorkBuddyModelLabelInner, {
13061
14071
  modelId: model.id,
13062
14072
  name: model.name,
@@ -13132,6 +14142,114 @@ window.__ModuleLoader__.load({
13132
14142
  };
13133
14143
  }
13134
14144
  //#endregion
14145
+ //#region src/client/model-label-seat.ts
14146
+ /**
14147
+ * Read the declared kind of a slot, or `undefined` when it is not declared yet.
14148
+ *
14149
+ * `spec()` is the documented read-only accessor (`SlotRegistry.spec`), present
14150
+ * on 0.1.7 and on 0.2.2. It is also the only way to learn the kind: the
14151
+ * declaration lives in the host package, and a plugin's own `SlotMap`
14152
+ * augmentation says what this plugin HOPES the slot is, not what the running
14153
+ * host declared.
14154
+ *
14155
+ * Anything unexpected — no `spec` method on an older line, a throw from a
14156
+ * service that is not ready, a kind this build does not know — returns
14157
+ * `undefined`, and the caller falls back to the single-cell shape. That is the
14158
+ * conservative direction: it is what every released version of this plugin
14159
+ * already does.
14160
+ *
14161
+ * @param slots - The `slots` service (typed loosely: the accessor is optional).
14162
+ * @param key - The slot key to inspect.
14163
+ * @returns The declared kind, or `undefined`.
14164
+ */
14165
+ function declaredSlotKind(slots, key) {
14166
+ const face = slots;
14167
+ if (face === void 0 || typeof face.spec !== "function") return void 0;
14168
+ let spec;
14169
+ try {
14170
+ spec = face.spec(key);
14171
+ } catch {
14172
+ return;
14173
+ }
14174
+ const kind = spec?.kind;
14175
+ if (kind === "single" || kind === "list" || kind === "keyed" || kind === "chain") return kind;
14176
+ }
14177
+ /**
14178
+ * The registrations this plugin should make for the model-label seat.
14179
+ *
14180
+ * `keyed` yields ONE seat per provider id: each is its own cell, each renders
14181
+ * only the rows whose owner props carry that provider id, and a provider this
14182
+ * plugin does not own falls through to the owner's own fallback (the catalog
14183
+ * name, plus that model's `badge` on hosts that have one).
14184
+ *
14185
+ * Every other kind — including `undefined`, i.e. a host that cannot be
14186
+ * inspected — yields the single historical seat. That is not a degraded mode:
14187
+ * it is what `single` requires, and on a not-yet-declared slot it is what the
14188
+ * inject callback is about to find.
14189
+ *
14190
+ * An empty provider list under `keyed` would silently disable the label, so it
14191
+ * falls back to the single seat instead: a wrong-shaped registration that still
14192
+ * draws something beats a correct-shaped registration that draws nothing.
14193
+ *
14194
+ * @param params - Slot key, declared kind, this plugin's provider ids, priority.
14195
+ * @returns One or more `register()` option objects, in registration order.
14196
+ */
14197
+ function modelLabelSeats(params) {
14198
+ const { name, kind, providerIds, priority } = params;
14199
+ if (kind === "list" || kind === "chain") return [];
14200
+ if (kind === "keyed" && providerIds.length > 0) return providerIds.map((id) => ({
14201
+ name,
14202
+ key: id,
14203
+ priority
14204
+ }));
14205
+ return [{
14206
+ name,
14207
+ priority
14208
+ }];
14209
+ }
14210
+ /**
14211
+ * Claim every planned seat, atomically, and hand back ONE disposer.
14212
+ *
14213
+ * WHY ATOMIC. The seat list is 2-3 entries on a `keyed` host, and `register()`
14214
+ * can throw on any ONE of them — a rival plugin claiming the same provider id at
14215
+ * the same priority, or the declaration collapsing mid-loop. A plain `.map()`
14216
+ * would then leave the earlier seats landed on the ledger with their disposers
14217
+ * unreachable (they were only ever held by the array that the throw discarded),
14218
+ * which is worse than failing outright: the component stays mounted, the caller
14219
+ * believes registration failed, and nothing will ever release those cells. On a
14220
+ * `single` host it also means the identity keeps a live entry that the next
14221
+ * `inject` re-run cannot displace without a priority clash.
14222
+ *
14223
+ * So a partial failure is rolled back in reverse order before the error is
14224
+ * rethrown, exactly as if it had never been attempted. The rethrow is important:
14225
+ * each caller already has a catch that logs, and swallowing here would hide the
14226
+ * refusal from the diagnostics that exist to explain it.
14227
+ *
14228
+ * A disposal that itself throws must not mask the original error, hence the
14229
+ * inner catch — the registry treats a second dispose as a no-op, and a broken
14230
+ * one must not turn one failure into a crash.
14231
+ *
14232
+ * @param seats - The plan from {@link modelLabelSeats}, in registration order.
14233
+ * @param register - Claims one seat and returns its disposer.
14234
+ * @returns One disposer that releases every seat, in reverse registration order.
14235
+ */
14236
+ function registerModelLabelSeats(seats, register) {
14237
+ const claimed = [];
14238
+ try {
14239
+ for (const seat of seats) claimed.push(register(seat));
14240
+ } catch (error) {
14241
+ for (const dispose of [...claimed].reverse()) try {
14242
+ dispose();
14243
+ } catch {}
14244
+ throw error;
14245
+ }
14246
+ return () => {
14247
+ for (const dispose of [...claimed].reverse()) try {
14248
+ dispose();
14249
+ } catch {}
14250
+ };
14251
+ }
14252
+ //#endregion
13135
14253
  //#region src/client/CodebuddyLive.tsx
13136
14254
  /**
13137
14255
  * The composer pill that says what the CodeBuddy CLI route is doing RIGHT NOW.
@@ -13476,6 +14594,12 @@ window.__ModuleLoader__.load({
13476
14594
  */
13477
14595
  const en = {
13478
14596
  "nav.panel": "WorkBuddy",
14597
+ "row.iconStyleLead": "Appearance — what the plugin looks like, not what it may do.",
14598
+ "row.iconStyleLabel": "Icon style",
14599
+ "row.iconStyleHint": "Takes effect on the click in the sidebar, the page header and the panel. The default is this plugin's own icon; the alternative skin follows the theme's text colour. The choice is stored in this browser only.",
14600
+ "row.iconStyleClaude": "Claude style",
14601
+ "row.iconStyleOriginal": "Default icon",
14602
+ "row.iconStyleSaveFailed": "The icon choice could not be saved. Check browser storage permissions.",
13479
14603
  "nav.back": "Back to conversation",
13480
14604
  "row.title": "WorkBuddy credits & models (dsh-connect-workbuddy)",
13481
14605
  "row.desc": "Use WorkBuddy models in DSH: each refresh reads every model's credit multiplier from the upstream catalog, image input is toggled per model, several accounts can be switched or failed over automatically, and daily check-in plus your remaining credits are one click away. The domestic and international sides are two independent providers, each with its own account — use both at the same time.",
@@ -13556,7 +14680,6 @@ window.__ModuleLoader__.load({
13556
14680
  "row.cardCrashed": "The configuration area failed to render.",
13557
14681
  "row.cardCrashedHint": "The model provider itself is unaffected — chat and credits keep working. Quote the line above in a bug report.",
13558
14682
  "row.modelsTitle": "Models",
13559
- "row.modelsSummary": "{count} enabled",
13560
14683
  "row.modelsDirty": "unsaved changes",
13561
14684
  "row.modelsRefresh": "Refresh from WorkBuddy",
13562
14685
  "row.modelsRefreshing": "Refreshing models…",
@@ -13585,12 +14708,9 @@ window.__ModuleLoader__.load({
13585
14708
  "row.modelUnknown": "Unknown",
13586
14709
  "row.modelCapabilityPending": "Only capabilities advertised by WorkBuddy are shown.",
13587
14710
  "row.modelsTestEnabled": "Test enabled models",
13588
- "row.modelsTestAll": "Test all models",
13589
14711
  "row.modelsTesting": "Testing {done}/{total}…",
13590
14712
  "row.modelsTestEnabledHint": "Tests every model you have ENABLED, one request each — each probe sends a real-volume request, so this spends real credit (about 0.01 per model at the default 25000-token size). Rows show their verdict as it lands. Stops early if the credential is rejected.",
13591
- "row.modelsTestAllHint": "Tests EVERY model in this region's catalog, including the ones you have NOT enabled — so it costs noticeably more than \"test enabled models\". Same per-probe cost, same early stop on a rejected credential.",
13592
14713
  "row.tpsSweepEnabled": "Measure speed (enabled)",
13593
- "row.tpsSweepAll": "Measure speed (all)",
13594
14714
  "row.tpsSweepEnabledHint": "Measures OUTPUT SPEED for every model you have ENABLED: three runs each, taking the median. Unlike the availability probes above, this sends a tiny prompt and asks for 256 output tokens back, so it costs far less per model (measured 0.01–0.15 credit against 0.72), because this gateway prices by input. Speed matters because DSH dispatches models as parallel sub-agents, so a slow model costs wall-clock time across the whole run.",
13595
14715
  "row.tpsTesting": "Measuring {done}/{total}…",
13596
14716
  "row.tpsMeasure": "Speed",
@@ -13664,6 +14784,7 @@ window.__ModuleLoader__.load({
13664
14784
  "row.transferNoToken": "no token in this record",
13665
14785
  "row.transferCancel": "Cancel",
13666
14786
  "row.transferError": "Transfer failed: {message}",
14787
+ "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.",
13667
14788
  "row.poolTitle": "Account pool",
13668
14789
  "row.poolNoCandidate": "No account in this pool can be used right now.",
13669
14790
  "row.poolNoCandidateHint": "Members are rate-limited, out of credits, rejected, or unreachable. Rate limits, drained quotas and transient failures return to the pool on their own — at the time the upstream states, or after a 30-minute fallback. Only a rejected credential needs a new sign-in.",
@@ -13708,7 +14829,6 @@ window.__ModuleLoader__.load({
13708
14829
  "row.poolLogBenefitFailed": "{accountName} claim failed: {message}",
13709
14830
  "row.poolBenefitHint": "Claim it on the plans page: {url}",
13710
14831
  "row.poolCreditSoon": "{count} expiring within 3 days",
13711
- "row.poolCreditNearest": "Nearest package expires {at}",
13712
14832
  "row.poolExcludedRateLimited": "Rate limited",
13713
14833
  "row.poolExcludedModelBusy": "Model busy",
13714
14834
  "row.poolExcludedOutOfCredit": "Out of credits",
@@ -13909,6 +15029,9 @@ window.__ModuleLoader__.load({
13909
15029
  "row.channelRejectContinueHint": "LAST RESORT, not a fix for 11128. When the gateway answers 400 with code 11128 (「被网关的渠道校验拦截」), the turn just fails: the plugin never retries it in place and never swaps accounts, because the gate matches the message contents and every account sends the same ones. Fixed system fingerprints are byte-identical every turn, so resending only pays for the same 400 again; since 5.13.1 `prepareChatBody` rewrites known phrases instead. The narrow case this can help is content that changes between turns. It sends the text below as a NEW turn and spends a real request each time. Stops after N CONSECUTIVE sends (default 1); one successful turn, or one message you type yourself, resets the count. Subagent sessions are never touched. Off by default. Takes effect immediately, no reload.",
13910
15030
  "row.channelRejectContinueLimit": "Max consecutive sends:",
13911
15031
  "row.channelRejectContinueText": "Text sent:",
15032
+ "row.dropAllThinkingLead": "Reasoning redaction — when the gateway refuses what we send.",
15033
+ "row.dropAllThinkingLabel": "Strip past thinking from requests (for 11128)",
15034
+ "row.dropAllThinkingHint": "LAST RESORT for 「被网关的渠道校验拦截」(400 / code 11128), and not a fix. The gateway scans the text of every request, and this plugin sends the model its own earlier reasoning as `reasoning_content` whenever a thinking block carries a signature — so past reasoning is one of the things being scanned. On, ALL thinking blocks are removed from the request: your messages, the tool calls and the answers are untouched, but the model no longer sees its own earlier reasoning, and that loss is real (it is the model working memory, not decoration). Off by default. Turn it on when the openings named in a 11128 can be matched to reasoning text in that session, which is what issue #213 measured. Takes effect on the next turn, no reload.",
13912
15035
  "row.cliBridgeLabel": "Let the local CodeBuddy CLI do the work",
13913
15036
  "row.cliBridgeHint": "Adds the codebuddy_ask tool and the /codebuddy command. Each call spends CodeBuddy quota. injectResult only affects /codebuddy — its result is injected back into the session, costing one DSH turn when the session is idle; tool calls never read it. Rate-limited: 6 turns per session per hour, 20 per process per hour, one turn at a time. Off by default.",
13914
15037
  "row.cnBaseLabel": "CN gateway host",
@@ -13966,6 +15089,9 @@ window.__ModuleLoader__.load({
13966
15089
  "row.creditPositionHintInline": "Where the readout sits. \"composer toolbar\" is the default — the row with the model picker.",
13967
15090
  "row.creditPositionDisabledHint": "Unavailable while the switch above is off: tick \"Show credits in the composer toolbar\" first.",
13968
15091
  "row.showCreditsHintInline": "The balance for the account currently serving this tab. Click for per-account balances; it also refreshes every 5 minutes.",
15092
+ "row.showNewModels": "Show newly seen models",
15093
+ "row.showNewModelsHint": "Adds a \"· N new models\" segment beside the credit readout, and a \"new\" mark on those rows in the model picker. \"New\" means this machine recorded the model id for the first time — it says nothing about when the upstream listed it. Off by default: on a new install the whole roster is \"new\".",
15094
+ "row.showNewModelsHintInline": "First seen by this machine, not newly listed upstream. Off by default — on a new install the whole roster counts as new.",
13969
15095
  "quotaNotice.fallbackHead": "The quota for this request is exhausted",
13970
15096
  "quotaNotice.supplement": " (some models also have a daily limit that is unrelated to your credits)",
13971
15097
  "row.creditPositionHint": "Where the credit readout sits. \"composer toolbar\" is the default (the row with the model picker). Choose \"below the input box\" — the row carrying the round / step / token statistics — if another plugin occupies the composer toolbar and the readout does not appear.",
@@ -14013,6 +15139,12 @@ window.__ModuleLoader__.load({
14013
15139
  };
14014
15140
  const zh = {
14015
15141
  "nav.panel": "WorkBuddy",
15142
+ "row.iconStyleLead": "外观 —— 插件长什么样,不是它能做什么。",
15143
+ "row.iconStyleLabel": "图标样式",
15144
+ "row.iconStyleHint": "点一下立即应用到侧边栏、页头与面板。默认是本插件自己的图标;另一个皮肤跟随主题的文字颜色。选择只存在当前浏览器里。",
15145
+ "row.iconStyleClaude": "Claude 风格",
15146
+ "row.iconStyleOriginal": "默认图标",
15147
+ "row.iconStyleSaveFailed": "图标选择保存失败,请检查浏览器存储权限。",
14016
15148
  "nav.back": "返回会话",
14017
15149
  "row.title": "接入使用 WorkBuddy 积分与模型(dsh-connect-workbuddy)",
14018
15150
  "row.desc": "在 DSH 中使用 WorkBuddy 模型:每次刷新都按上游目录读取每个模型的积分倍率,图片输入可逐模型开关,多个账号可切换或由账号池自动换号,每日签到与剩余积分一键可查。国内版与国际版是两个独立供应商,各有自己的账号,可同时使用。",
@@ -14093,7 +15225,6 @@ window.__ModuleLoader__.load({
14093
15225
  "row.cardCrashed": "配置区渲染失败。",
14094
15226
  "row.cardCrashedHint": "模型服务本身未受影响,对话与积分仍可用。反馈问题时请附上上面这行。",
14095
15227
  "row.modelsTitle": "模型",
14096
- "row.modelsSummary": "已启用 {count} 个",
14097
15228
  "row.modelsDirty": "有未保存的修改",
14098
15229
  "row.modelsRefresh": "从 WorkBuddy 刷新",
14099
15230
  "row.modelsRefreshing": "正在刷新模型…",
@@ -14121,13 +15252,10 @@ window.__ModuleLoader__.load({
14121
15252
  "row.modelEffortFollowNamed": "默认({effort})",
14122
15253
  "row.modelUnknown": "未知",
14123
15254
  "row.modelCapabilityPending": "仅展示 WorkBuddy 接口明确公布的模型能力。",
14124
- "row.modelsTestEnabled": "一键测试启用模型",
14125
- "row.modelsTestAll": "一键测试所有模型",
15255
+ "row.modelsTestEnabled": "测试启用模型",
14126
15256
  "row.modelsTesting": "测试中 {done}/{total}…",
14127
15257
  "row.modelsTestEnabledHint": "逐个测试你**已启用**的模型,一个模型一次请求 —— 每次探测都发真实体积的请求,真花积分(默认 25000 token 体积下约 0.01/个)。每行的结果一出来就显示。凭据被拒时提前停止。",
14128
- "row.modelsTestAllHint": "测试本区域目录里的**每一个**模型,含**未启用**的 —— 所以比「仅测试启用模型」明显更贵。单次探测成本相同,凭据被拒时同样提前停止。",
14129
- "row.tpsSweepEnabled": "一键测速启用模型",
14130
- "row.tpsSweepAll": "一键测速所有模型",
15258
+ "row.tpsSweepEnabled": "测速启用模型",
14131
15259
  "row.tpsSweepEnabledHint": "测**已启用**模型的**输出速度**:每个模型跑 3 次取中位数。和上面的可用性探测不同,它只发一个极小的提示、要求返回 256 个输出 token —— 这个网关按**输入**计价,所以单模型成本低得多(实测 0.01–0.15 积分,可用性探测是 0.72)。速度之所以重要:DSH 会把模型当子代理并行派发,慢模型拖的是整个任务的实际耗时。",
14132
15260
  "row.tpsTesting": "测速中 {done}/{total}…",
14133
15261
  "row.tpsMeasure": "测速",
@@ -14201,6 +15329,7 @@ window.__ModuleLoader__.load({
14201
15329
  "row.transferNoToken": "此记录没有 token",
14202
15330
  "row.transferCancel": "取消",
14203
15331
  "row.transferError": "传输失败:{message}",
15332
+ "row.transferNoService": "与本地插件服务通信失败(本次发送 {size} KiB)。可能是文件过大,或服务正在重启——请重试;若持续失败,请精简文件后再导入。",
14204
15333
  "row.poolTitle": "账号池",
14205
15334
  "row.poolNoCandidate": "账号池里目前没有可用的账号。",
14206
15335
  "row.poolNoCandidateHint": "成员要么在限流冷却中、要么积分耗尽、要么凭据被拒、要么上游无响应。限流、积分耗尽与瞬时故障都会自动回池——按上游给出的恢复时间,没给时间就按 30 分钟兜底,不需要你操作;只有「凭据被拒」需要重新登录。",
@@ -14245,7 +15374,6 @@ window.__ModuleLoader__.load({
14245
15374
  "row.poolLogBenefitFailed": "{accountName} 领取失败:{message}",
14246
15375
  "row.poolBenefitHint": "去套餐与积分页领取:{url}",
14247
15376
  "row.poolCreditSoon": "{count} 积分 3 天内过期",
14248
- "row.poolCreditNearest": "最近积分包 {at} 过期",
14249
15377
  "row.poolExcludedRateLimited": "被限流",
14250
15378
  "row.poolExcludedModelBusy": "模型繁忙",
14251
15379
  "row.poolExcludedOutOfCredit": "积分耗尽",
@@ -14446,6 +15574,9 @@ window.__ModuleLoader__.load({
14446
15574
  "row.channelRejectContinueHint": "最后兜底,不是 11128 的修复。上游用 400 + code 11128(「被网关的渠道校验拦截」)拒绝时,这一轮就直接失败了:插件不会在原地重试,也不会换号——网关匹配的是消息内容,每个账号发出去都一样。固定 system 指纹每一轮逐字节相同,重发只会再付一次同一个 400;5.13.1 起由 `prepareChatBody` 按句改词处理。只有被拒内容刚好随轮次变化的窄情况才可能靠新回合碰过去。它会把下面这句作为新回合发出,每次真实消耗一次请求;默认只发 1 次、默认关闭;连续计数,成功一轮或你自己发一条消息即清零。子代理会话一律不碰,改完立即生效,不必重载插件。",
14447
15575
  "row.channelRejectContinueLimit": "连续发送上限:",
14448
15576
  "row.channelRejectContinueText": "发送的文本:",
15577
+ "row.dropAllThinkingLead": "思考剥离 —— 网关拒收我们发出去的内容时。",
15578
+ "row.dropAllThinkingLabel": "把历史思考从请求里剥掉(针对 11128)",
15579
+ "row.dropAllThinkingHint": "「被网关的渠道校验拦截」(400 + code 11128)的最后兜底,不是修复。网关会扫描每一份请求的文本,而本插件会把模型过去的思考作为 reasoning_content 发出去(thinking 块带 signature 时就会),所以历史思考也是被扫的内容之一。开启后请求里的 thinking 块会被全部移除——你的消息、工具调用和回答不受影响,但模型看不到自己之前的思考,而这个代价是真的(那是它的工作记忆,不是装饰)。默认关闭。适用情形:这次 11128 报出的那几个开头,能与该会话里的 reasoning 文本逐字对上——#213 里被证实的就是这种情况。改完下一轮生效,不必重载插件。",
14449
15580
  "row.cliBridgeLabel": "允许调用本机 CodeBuddy CLI 干活",
14450
15581
  "row.cliBridgeHint": "开启后多出 codebuddy_ask 工具与 /codebuddy 指令;每次调用花 CodeBuddy 配额。injectResult 只影响 /codebuddy:其结果回注会话,会话空闲时多花一次 DSH 回合;工具调用不读它。限流:每会话每小时 6 回合、每进程每小时 20 回合、同时只跑一个回合。默认关闭。",
14451
15582
  "row.cnBaseLabel": "CN 网关主机",
@@ -14503,6 +15634,9 @@ window.__ModuleLoader__.load({
14503
15634
  "row.creditPositionHintInline": "读数显示在哪里。「输入框工具栏」是默认位置,与模型选择同一行。",
14504
15635
  "row.creditPositionDisabledHint": "主开关关闭时不可调整:先勾选上方「在输入框工具栏显示积分读数」。",
14505
15636
  "row.showCreditsHintInline": "当前为本 tab 服务的那个账号的余额。点一下能看各账号明细,另外每 5 分钟自动刷新一次。",
15637
+ "row.showNewModels": "显示新出现的模型",
15638
+ "row.showNewModelsHint": "在积分读数旁多加一段「· N 新模型」,并在模型选择器里给这些行标一个「新」。这里的「新」指**本机首次记到这个模型 id**,与上游何时上架无关。默认关闭:全新安装时整个目录都算「新」,那个数字说明不了任何事。",
15639
+ "row.showNewModelsHintInline": "指本机首次见到,不是上游新上架。默认关闭——全新安装时整个目录都算新。",
14506
15640
  "quotaNotice.fallbackHead": "当前请求的额度已用尽",
14507
15641
  "quotaNotice.supplement": "(部分模型另有每日额度,与积分无关)",
14508
15642
  "row.creditPositionHint": "积分显示在哪里。「输入框工具栏」是默认位置(与模型选择同一行)。如果装了别的插件后读数不显示,改成「输入框下方」—— 那是「轮次 / 步数 / token」统计所在的那一行。",
@@ -14551,23 +15685,77 @@ window.__ModuleLoader__.load({
14551
15685
  //#endregion
14552
15686
  //#region src/client/settings-jump.ts
14553
15687
  /**
14554
- * Best-effort jump to this plugin's **Settings section** (设置 → WorkBuddy).
14555
- *
14556
- * ## Why a DOM walk rather than a service call
14557
- *
14558
- * The host gives a third-party plugin NO public way to open one of its
14559
- * `settings.section`s. The shell keeps the selected section in its own store
14560
- * (`ui-settings-general`'s `createSettingsShellStore().activeId`), and the only
14561
- * `openSection(id)` it hands out goes to `settings.onboarding` registrants —
14562
- * that is the first-run guidance seat, not a configuration entry. Nothing else
14563
- * in `@deepseek-ai/dsh-client-ui-settings`' client contract exposes a
14564
- * `openSection` / `selectedSection` service.
14565
- *
14566
- * This is not a WorkBuddy-specific finding: `dsh-connect-qoder`, `dsh-context`
14567
- * and `dsh-better-sidebar` all document the same gap and all drive the real
14568
- * chrome instead.
14569
- *
14570
- * ## What "driving the chrome" means here
15688
+ * The route from this plugin's UI to its **Settings section** (设置 → WorkBuddy).
15689
+ *
15690
+ * ## Two routes, best first
15691
+ *
15692
+ * 1. **The settings shell's store seat** — one call, exact, no timing:
15693
+ * `slots.entries('sidebar.settings')[0].store.create().actions.openSection(id)`.
15694
+ * 2. **Driving the chrome** — click the sidebar's settings trigger, wait for the
15695
+ * panel, click this plugin's nav row by label.
15696
+ *
15697
+ * Route 1 is what the owner asked for ("clicking the button should open Settings
15698
+ * already on this plugin") and it is available on the shell this plugin targets;
15699
+ * route 2 stays as the fallback for a host whose shell predates the seat. Route 1
15700
+ * is strictly better where it exists: `openSection(id)` sets `activeId` AND
15701
+ * `open` in one action, so there is no retry window in which the dialog is open
15702
+ * on the wrong section, and no dependency on the nav row's localized label.
15703
+ *
15704
+ * ## Why the seat is legitimately public (verified, not assumed)
15705
+ *
15706
+ * Read from the shipped host (0.1.7-rc.1), not from a sibling README:
15707
+ *
15708
+ * ctx.remoteAccess.whenAccess('settings/describe', () => ctx.slots.inject('sidebar.settings', () => {
15709
+ * const shellHandle = createSettingsShellStore()
15710
+ * const shellInstance = shellHandle.create()
15711
+ * const shellStore = { ...shellHandle, create: () => shellInstance }
15712
+ * …
15713
+ * ctx.slots.register({ name: 'sidebar.settings', store: shellStore, … })
15714
+ * }))
15715
+ *
15716
+ * and the store itself:
15717
+ *
15718
+ * defineStore({
15719
+ * init: () => ({ open: false, activeId: void 0 }),
15720
+ * actions: {
15721
+ * open: (d) => { d.open = true },
15722
+ * close: (d) => { d.open = false; d.activeId = void 0 },
15723
+ * select: (d, id) => { d.activeId = id },
15724
+ * openSection: (d, id) => { d.activeId = id; d.open = true },
15725
+ * },
15726
+ * })
15727
+ *
15728
+ * Three things follow, and all three are load-bearing:
15729
+ *
15730
+ * - `create: () => shellInstance` PINS the seat to the shell's one live
15731
+ * instance. A bare handle would mint a fresh private copy per `create()`,
15732
+ * and `openSection` on that copy would move a dialog nobody renders.
15733
+ * - `store` is a declared registration field ("Declared store seat; instance
15734
+ * resolution and lifecycle live with the host machinery"), and
15735
+ * `slots.entries(key)` is a public service method — the harness's own client
15736
+ * tests read this exact seat the same way.
15737
+ * - **Only `openSection` answers this need.** The published contract gives a
15738
+ * `settings.section` registrant just `close`; `settings.launcher` gets
15739
+ * `openSettings` with no id; `openSection(id)` is otherwise handed only to
15740
+ * `settings.onboarding` steps. Registering a fake first-run step to reach it
15741
+ * would be far more intrusive than reading a seat the shell published.
15742
+ *
15743
+ * ## Why the probe happens per PRESS, not during `apply`
15744
+ *
15745
+ * The seat belongs to ANOTHER bundle whose apply order is not ours to assume.
15746
+ * Probing once during `apply` would capture `undefined` on a host whose sidebar
15747
+ * applied later, leaving the button dead for the whole session. `entries()`
15748
+ * answers `[]` for an undeclared slot, so a per-press probe is stateless and
15749
+ * always current — the same reason the popover button is built around `softGet`.
15750
+ *
15751
+ * ## Route 2, and why it is kept rather than deleted
15752
+ *
15753
+ * The host range this plugin declares spans shell lines that may predate the
15754
+ * seat. When the seat is absent, the old route still lands the user on this
15755
+ * plugin's page, so deleting it would trade a working fallback for nothing. It
15756
+ * is now the SECOND choice, which also means its known weakness (the nav row is
15757
+ * found by its localized label, so a language we did not ship cannot match) can
15758
+ * no longer affect a host that has the seat.
14571
15759
  *
14572
15760
  * 1. click the shell's settings trigger (`aria-haspopup="dialog"` +
14573
15761
  * `aria-expanded`) — unless the panel is already open, in which case
@@ -14576,22 +15764,12 @@ window.__ModuleLoader__.load({
14576
15764
  * 2. wait for the panel to mount (it renders on demand into `body`);
14577
15765
  * 3. find this plugin's nav row by its LABEL and click it.
14578
15766
  *
14579
- * ## Why the label and not the id
14580
- *
14581
- * The shell renders each nav row's `row.label` — an already-localized string —
14582
- * and writes no `data-section-id` or similar stable anchor; `aria-current` only
14583
- * appears on the row that is already selected. The label comes from this
14584
- * plugin's own `section.label` (`t('nav.panel')`), so both languages live in
14585
- * this repository and "the one we found" cannot drift from "the one we
14586
- * registered".
14587
- *
14588
15767
  * ## Why it never throws
14589
15768
  *
14590
- * Every step is called from a RENDER path (a click handler in the credits
14591
- * popover). A throw here would take out the whole readout rather than one
14592
- * button, so each stage swallows its own failure and the whole jump degrades to
14593
- * a silent no-op when the shell has a different shape (an older host, a hidden
14594
- * sidebar, a language we did not ship).
15769
+ * Every step runs from a RENDER path (a click handler in the credits popover). A
15770
+ * throw here would take out the whole readout rather than one button, so each
15771
+ * stage swallows its own failure and the whole jump degrades to a silent no-op
15772
+ * when the shell has a different shape.
14595
15773
  *
14596
15774
  * @module dsh-connect-workbuddy/client/settings-jump
14597
15775
  */
@@ -14605,6 +15783,8 @@ window.__ModuleLoader__.load({
14605
15783
  const SETTINGS_PANEL_SELECTOR = "[data-shortcut-modal=\"settings\"]";
14606
15784
  /** The sidebar's settings trigger: dialog semantics plus an expanded state. */
14607
15785
  const TRIGGER_SELECTOR = "button[aria-haspopup=\"dialog\"][aria-expanded]";
15786
+ /** The shipped slot whose store seat is the settings shell's state handle. */
15787
+ const SETTINGS_SLOT = "sidebar.settings";
14608
15788
  /**
14609
15789
  * Budget for "panel mounted + nav row rendered".
14610
15790
  *
@@ -14637,14 +15817,62 @@ window.__ModuleLoader__.load({
14637
15817
  return buttonsIn(scope).find((button) => (button.textContent ?? "").trim() === want);
14638
15818
  }
14639
15819
  /**
15820
+ * Open Settings on this plugin's section through the shell's store seat.
15821
+ *
15822
+ * @returns `'opened'` when the dialog is on the right section (done), `'shell'`
15823
+ * when the dialog was opened but not preselected (route 2 can still click the
15824
+ * row), and `undefined` when the seat is absent or unusable.
15825
+ */
15826
+ function openThroughStoreSeat(get, sectionId) {
15827
+ let slots;
15828
+ try {
15829
+ slots = get("slots");
15830
+ } catch {
15831
+ return;
15832
+ }
15833
+ if (slots === void 0 || typeof slots.entries !== "function") return void 0;
15834
+ let seat;
15835
+ try {
15836
+ seat = slots.entries(SETTINGS_SLOT)[0]?.store;
15837
+ } catch {
15838
+ return;
15839
+ }
15840
+ if (seat === null || typeof seat !== "object") return void 0;
15841
+ const handle = seat;
15842
+ if (typeof handle.create !== "function") return void 0;
15843
+ try {
15844
+ const instance = handle.create();
15845
+ const openSection = instance?.actions?.openSection;
15846
+ if (typeof openSection === "function") {
15847
+ openSection(sectionId);
15848
+ return "opened";
15849
+ }
15850
+ const open = instance?.actions?.open;
15851
+ if (typeof open === "function") {
15852
+ open();
15853
+ return "shell";
15854
+ }
15855
+ } catch {}
15856
+ }
15857
+ /**
14640
15858
  * Open the settings panel and select this plugin's section.
14641
15859
  *
14642
- * @returns whether the trigger was driven at all (`false` = the panel is not on
14643
- * this host, so nothing was attempted and `onGiveUp` already ran).
15860
+ * @returns whether any route was taken (`false` = no route could be attempted,
15861
+ * so the shell is unrecognisable and `onGiveUp` already ran).
14644
15862
  */
14645
15863
  function openWorkBuddySettingsSection(options) {
14646
15864
  const { doc = document, label } = options;
14647
15865
  const schedule = options.schedule ?? defaultSchedule;
15866
+ const sectionId = options.sectionId ?? "dsh-connect-workbuddy";
15867
+ if (options.get !== void 0) {
15868
+ let seatResult;
15869
+ try {
15870
+ seatResult = openThroughStoreSeat(options.get, sectionId);
15871
+ } catch {
15872
+ seatResult = void 0;
15873
+ }
15874
+ if (seatResult === "opened") return true;
15875
+ }
14648
15876
  try {
14649
15877
  if (doc.querySelector(SETTINGS_PANEL_SELECTOR) === null) {
14650
15878
  const collapsed = Array.from(doc.querySelectorAll(TRIGGER_SELECTOR)).find((button) => button.getAttribute("aria-expanded") !== "true");
@@ -14717,6 +15945,95 @@ window.__ModuleLoader__.load({
14717
15945
  */
14718
15946
  const inject = ["slots", "locale"];
14719
15947
  /** Register card copy and the WorkBuddy card under Plugin configuration. */
15948
+ /**
15949
+ * Report whether the model-picker label slot landed.
15950
+ *
15951
+ * The slot is a `single` cell declared as a CHILD of `conversation.input.model`,
15952
+ * so the host calls our inject callback only once that parent entry mounts. Two
15953
+ * failures follow, and neither is visible on the page:
15954
+ *
15955
+ * 1. `register()` threw — another claim at the same priority.
15956
+ * 2. The callback never ran — the parent never mounted. Nothing throws, the
15957
+ * disposer list is simply one shorter, and the picker shows no badges.
15958
+ *
15959
+ * Case 2 is why this exists: it produced NO trace of any kind. The state is
15960
+ * published on `window` (so a person can inspect it without reproducing the
15961
+ * symptom) and a failure is warned about exactly once per rebind. A healthy
15962
+ * load stays silent — a warning that fires when nothing is wrong stops being
15963
+ * read.
15964
+ *
15965
+ * Exported for the test. Called from `rebindSlots` (once, before the inject
15966
+ * callback exists) and again from inside the inject callback (the only place
15967
+ * that can observe a DEFERRED refusal or a late-arriving `slotKind`). Two
15968
+ * callers, one state object: the later call always supersedes the earlier, and
15969
+ * the warning is deduplicated so one failure still produces one line.
15970
+ *
15971
+ * @param state - What the registration path recorded.
15972
+ * @param target - Where to publish; defaults to the global object.
15973
+ * @returns The published view, or `undefined` when there is no global to
15974
+ * publish onto (server rendering, a bare test).
15975
+ */
15976
+ /**
15977
+ * One word for the state of the model-label registration.
15978
+ *
15979
+ * The four outcomes need DIFFERENT fixes, and three of them look identical from
15980
+ * the picker (no badges):
15981
+ *
15982
+ * not-reached the client half never reached registration — a boot or
15983
+ * composition problem, nothing to do with the slot.
15984
+ * parent-not-mounted we asked, the host never called back: the parent entry
15985
+ * (`conversation.input.model`) is not mounted, so the child
15986
+ * cell does not exist yet.
15987
+ * failed `register()` threw (a same-priority claim).
15988
+ * claimed it landed; if badges are still missing the cause is
15989
+ * downstream (render or CSS), not here.
15990
+ *
15991
+ * @param state - What the registration path recorded.
15992
+ * @returns The verdict word.
15993
+ */
15994
+ function modelLabelVerdictOf(state) {
15995
+ if (state.failure !== void 0) return "failed";
15996
+ if (state.injectRanAt !== void 0) return "claimed";
15997
+ if (state.askedAt === void 0) return "not-reached";
15998
+ return "parent-not-mounted";
15999
+ }
16000
+ function publishModelLabelState(state, target = globalThis) {
16001
+ const view = {
16002
+ verdict: modelLabelVerdictOf(state),
16003
+ injectRanAt: state.injectRanAt,
16004
+ askedAt: state.askedAt,
16005
+ rebinds: state.rebinds,
16006
+ failure: state.failure,
16007
+ claimed: state.dispose !== void 0,
16008
+ /**
16009
+ * Which shape the host's declaration allowed, and how many seats were
16010
+ * claimed for it.
16011
+ *
16012
+ * Without these two the picker has ONE symptom ("no badges") for two very
16013
+ * different situations: a `single` host where an equal-priority rival won
16014
+ * the cell, and a `keyed` host where a provider id was missed. `slotKind`
16015
+ * says which contract was in force; `seats` says what this plugin did with
16016
+ * it. `<provider count>` on a keyed host and `1` on a single host are the
16017
+ * only healthy pairs.
16018
+ */
16019
+ slotKind: state.slotKind,
16020
+ seats: state.seats,
16021
+ at: Date.now()
16022
+ };
16023
+ try {
16024
+ target["__dshWorkBuddyModelLabel__"] = view;
16025
+ } catch {
16026
+ return;
16027
+ }
16028
+ if (state.failure !== void 0) {
16029
+ const warned = target;
16030
+ if (warned.__dshWorkBuddyModelLabelWarned__ !== state.failure) try {
16031
+ target.warn?.("[dsh-connect-workbuddy] the model-picker badges could not be registered: " + state.failure);
16032
+ warned.__dshWorkBuddyModelLabelWarned__ = state.failure;
16033
+ } catch {}
16034
+ }
16035
+ return view;
16036
+ }
14720
16037
  function apply(ctx) {
14721
16038
  try {
14722
16039
  const namespace = "settings.workbuddy";
@@ -14729,9 +16046,9 @@ window.__ModuleLoader__.load({
14729
16046
  /**
14730
16047
  * The credits popover's header button: open 设置 → WorkBuddy.
14731
16048
  *
14732
- * ALWAYS A FUNCTION, never `undefined`. It drives the shell's real chrome
14733
- * (see `settings-jump.ts`) rather than asking a host service, so it has a
14734
- * definite value from the moment `apply` runs. That matters because the
16049
+ * ALWAYS A FUNCTION, never `undefined`, and it takes no route value at
16050
+ * creation time: it reads the store seat per press and otherwise drives the
16051
+ * shell's real chrome (see `settings-jump.ts`). That matters because the
14735
16052
  * readout only renders the button when this is present, and the first
14736
16053
  * `registerAllSlots()` happens before most of `apply` has finished — a
14737
16054
  * route captured from `ctx.get('layout')` at that moment is `undefined` on
@@ -14743,6 +16060,7 @@ window.__ModuleLoader__.load({
14743
16060
  */
14744
16061
  const openSettingsSection = () => openWorkBuddySettingsSection({
14745
16062
  label: () => t("nav.panel"),
16063
+ get: softGet,
14746
16064
  onGiveUp: () => {
14747
16065
  const navigation = softGet("pluginNavigation");
14748
16066
  if (navigation !== void 0 && typeof navigation.openBundle === "function") try {
@@ -14806,18 +16124,12 @@ window.__ModuleLoader__.load({
14806
16124
  locale: namespace
14807
16125
  }, (iconProps) => {
14808
16126
  const edge = typeof iconProps?.size === "number" ? iconProps.size : 16;
14809
- return (0, react.createElement)("img", {
14810
- src: WORKBUDDY_PLUGIN_ICON,
14811
- alt: "",
14812
- width: edge,
14813
- height: edge,
16127
+ return (0, react.createElement)(PluginIcon, {
16128
+ size: edge,
14814
16129
  className: "dsm-workbuddy-nav-icon",
14815
16130
  style: {
14816
- width: `${edge}px`,
14817
- height: `${edge}px`,
14818
16131
  borderRadius: "4px",
14819
16132
  display: "block",
14820
- objectFit: "contain",
14821
16133
  opacity: iconProps?.active === false ? .75 : 1
14822
16134
  }
14823
16135
  });
@@ -14918,6 +16230,18 @@ window.__ModuleLoader__.load({
14918
16230
  * ordering, the measured evidence, and the deliberate absence of any
14919
16231
  * inter-plugin coordination (project invariant, `docs/DESIGN.md` §零).
14920
16232
  *
16233
+ * HOW MANY SEATS, AND WHY THAT IS READ AT MOUNT. `single` holds one cell, so
16234
+ * exactly one registration is legal there. A `keyed` host gives each
16235
+ * `options.key` its own cell, and one cell per provider id is what this
16236
+ * plugin actually wants: it then draws its OWN rows and nothing else, qoder
16237
+ * and trae stop sharing a cell with it, and a provider with no contribution
16238
+ * falls through to the host's own fallback. Which of the two shapes is
16239
+ * legal is the HOST's declaration, not this plugin's choice, so the kind is
16240
+ * read from `ctx.slots.spec(...)` at mount and the seat list is derived from
16241
+ * it (`./model-label-seat.ts`). One build therefore serves both lines — and
16242
+ * a host that cannot be inspected gets the single seat, which is what every
16243
+ * released version of this plugin already does.
16244
+ *
14921
16245
  * THE COST IS PAID ON ANOTHER PLUGIN'S ROWS, and it is worth stating where
14922
16246
  * the registration happens: holding this cell means the host's own
14923
16247
  * `dsh-client-ui-deepseek-model-label-1017` badge is NOT rendered on the
@@ -14925,17 +16249,75 @@ window.__ModuleLoader__.load({
14925
16249
  * to fix by inspecting the slot ledger — it is the price of §零, recorded in
14926
16250
  * `docs/DESIGN.md` and argued in the 5.8.2 CHANGELOG. Issue #138 is a user
14927
16251
  * meeting that price for the first time; the disposition is to state it
14928
- * plainly rather than to coordinate at runtime.
16252
+ * plainly rather than to coordinate at runtime. On a `keyed` host that price
16253
+ * is not paid at all: each provider keeps its own cell, so 1017's badge
16254
+ * returns to the DeepSeek rows without anyone negotiating.
16255
+ */
16256
+ /**
16257
+ * WHY THIS RECORDS AN OUTCOME, not just a disposer.
16258
+ *
16259
+ * Claiming the cell can fail in two DIFFERENT ways and both are silent:
16260
+ *
16261
+ * 1. `register()` throws — a `single` slot with another claim at the same
16262
+ * priority. The catch logs, the page looks fine, the badges are gone.
16263
+ * 2. `inject()` never runs — the slot is declared as a child of
16264
+ * `conversation.input.model`, so the host only calls back once THAT
16265
+ * entry mounts. If it never mounts (a session-less surface, an older
16266
+ * host, a renamed parent), nothing throws at all: the callback simply
16267
+ * does not happen and the disposer list stays one shorter.
16268
+ *
16269
+ * Case 2 left no trace of any kind, which is why this plugin could look
16270
+ * healthy while the picker showed no badges. Recording the timestamp of the
16271
+ * callback and the reason for a failure turns "did it land?" from a guess
16272
+ * into a fact the diagnostics row can print.
14929
16273
  */
16274
+ const modelLabelState = {};
16275
+ /** The verdict for the console line (see `modelLabelVerdictOf`). */
16276
+ const modelLabelVerdict = () => modelLabelVerdictOf(modelLabelState);
14930
16277
  const registerModelLabel = () => {
16278
+ modelLabelState.askedAt = Date.now();
16279
+ /**
16280
+ * The refusal path, shared by the eager and the deferred call.
16281
+ *
16282
+ * REPUBLISHES, and that is not cosmetic. `rebindSlots` publishes once, and
16283
+ * on the normal boot it publishes BEFORE this callback exists: `inject()`
16284
+ * defers the callback until `conversation.input.model` mounts, so the
16285
+ * published view is a snapshot of a registration that has not happened
16286
+ * yet. Without this line the failure lands in a state object that nothing
16287
+ * reads again, and `window.__dshWorkBuddyModelLabel__` keeps
16288
+ * `failure: undefined` with verdict `parent-not-mounted` — the exact
16289
+ * opposite of the truth, in the surface built to state it.
16290
+ */
16291
+ const refuse = (error) => {
16292
+ const message = error instanceof Error ? error.message : String(error);
16293
+ modelLabelState.failure = message;
16294
+ console.error("[dsh-connect-workbuddy] model label slot failed to register (host provider unaffected):", error);
16295
+ publishModelLabelState(modelLabelState);
16296
+ };
14931
16297
  try {
14932
- return ctx.slots.inject("conversation.input.model.label", () => ctx.slots.register({
14933
- name: "conversation.input.model.label",
14934
- priority: MODEL_LABEL_PRIORITY
14935
- }, WorkBuddyModelLabel));
16298
+ return ctx.slots.inject("conversation.input.model.label", () => {
16299
+ modelLabelState.injectRanAt = Date.now();
16300
+ const kind = declaredSlotKind(ctx.slots, "conversation.input.model.label");
16301
+ const seats = modelLabelSeats({
16302
+ name: "conversation.input.model.label",
16303
+ kind,
16304
+ providerIds: WORKBUDDY_PROVIDER_IDS,
16305
+ priority: MODEL_LABEL_PRIORITY
16306
+ });
16307
+ const registry = ctx.slots;
16308
+ try {
16309
+ const dispose = registerModelLabelSeats(seats, (seat) => registry.register(seat, WorkBuddyModelLabel));
16310
+ modelLabelState.slotKind = kind ?? "unknown";
16311
+ modelLabelState.seats = seats.length;
16312
+ publishModelLabelState(modelLabelState);
16313
+ return dispose;
16314
+ } catch (error) {
16315
+ refuse(error);
16316
+ return () => {};
16317
+ }
16318
+ });
14936
16319
  } catch (error) {
14937
- console.error("[dsh-connect-workbuddy] model label slot failed to register (host provider unaffected):", error);
14938
- return;
16320
+ return refuse(error);
14939
16321
  }
14940
16322
  };
14941
16323
  /**
@@ -14948,13 +16330,9 @@ window.__ModuleLoader__.load({
14948
16330
  */
14949
16331
  function WorkBuddyPanelIcon(props) {
14950
16332
  const edge = typeof props.size === "number" && props.size > 0 ? props.size : 16;
14951
- return (0, react.createElement)("img", {
16333
+ return (0, react.createElement)(PluginIcon, {
14952
16334
  className: "dsm-workbuddy-panel-icon",
14953
- src: WORKBUDDY_PLUGIN_ICON,
14954
- alt: "",
14955
- width: edge,
14956
- height: edge,
14957
- "aria-hidden": "true"
16335
+ size: edge
14958
16336
  });
14959
16337
  }
14960
16338
  /**
@@ -15212,7 +16590,11 @@ window.__ModuleLoader__.load({
15212
16590
  registerStatsCredits(),
15213
16591
  registerCliLive(),
15214
16592
  registerQuotaNotice(),
15215
- registerModelLabel(),
16593
+ (() => {
16594
+ const dispose = registerModelLabel();
16595
+ modelLabelState.dispose = dispose;
16596
+ return dispose;
16597
+ })(),
15216
16598
  registerMainPage()
15217
16599
  ].filter((disposer) => disposer !== void 0);
15218
16600
  /**
@@ -15243,9 +16625,11 @@ window.__ModuleLoader__.load({
15243
16625
  dispose();
15244
16626
  } catch {}
15245
16627
  liveDisposers = [];
16628
+ modelLabelState.rebinds = (modelLabelState.rebinds ?? 0) + 1;
15246
16629
  liveDisposers = registerAllSlots();
16630
+ publishModelLabelState(modelLabelState);
15247
16631
  try {
15248
- console.info(`[dsh-connect-workbuddy] registered ${String(liveDisposers.length)} slots (settings form: ${settingsScope === void 0 ? "none — page is read-only" : "bound"}, sidebar panel: ${sidebarPanelWanted() ? "on" : "off"})`);
16632
+ console.info(`[dsh-connect-workbuddy] registered ${String(liveDisposers.length)} slots (settings form: ${settingsScope === void 0 ? "none — page is read-only" : "bound"}, sidebar panel: ${sidebarPanelWanted() ? "on" : "off"}, model label: ${modelLabelVerdict()}${modelLabelState.failure === void 0 ? "" : ` (${modelLabelState.failure})`})`);
15249
16633
  } catch {}
15250
16634
  syncPanelRegistration();
15251
16635
  };
@@ -15341,7 +16725,9 @@ window.__ModuleLoader__.load({
15341
16725
  //#endregion
15342
16726
  exports.apply = apply;
15343
16727
  exports.inject = inject;
16728
+ exports.modelLabelVerdictOf = modelLabelVerdictOf;
15344
16729
  exports.name = name;
16730
+ exports.publishModelLabelState = publishModelLabelState;
15345
16731
  return module.exports;
15346
16732
  }
15347
16733
  });