dsh-connect-workbuddy 5.8.4 → 5.9.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
@@ -2129,8 +2129,27 @@ window.__ModuleLoader__.load({
2129
2129
  *
2130
2130
  * Any other malformed value is left to the caller to drop — a wrong window
2131
2131
  * would hide a live promotion, and guessing is not this parser's job.
2132
+ *
2133
+ * THE TYPE GUARD IS LOAD-BEARING, NOT DEFENSIVE DECORATION (issue #139). The
2134
+ * upstream feeds a string, and `parseDaily`'s own `text()` would already have
2135
+ * dropped a number — but the SAVED `lastCatalog` is a second, independent
2136
+ * entrance to this function, and nothing on that path type-checks. A promotion
2137
+ * object rides through `toPersistedWorkBuddyModel` untouched (the settings
2138
+ * schema keeps unknown keys), survives `resolveRoster`, and reaches the
2139
+ * renderer's `selectPromoBadge`. A numeric `start` there used to throw
2140
+ * `value.trim is not a function` DURING RENDER, which the host's slot error
2141
+ * boundary turned into a blank configuration section — the page looked as if
2142
+ * the plugin had never installed.
2143
+ *
2144
+ * Refusing a non-string is the same answer the parser already gives every
2145
+ * other unreadable shape: drop the window rather than guess. Interpreting a
2146
+ * number as "minutes since midnight" was considered and rejected — `1380`
2147
+ * happens to mean 23:00, but no upstream has ever published that shape, and
2148
+ * inventing hours for a promotion the upstream never described is exactly the
2149
+ * overstatement this module exists to prevent.
2132
2150
  */
2133
2151
  function minutesOfClock(value) {
2152
+ if (typeof value !== "string") return void 0;
2134
2153
  const match = /^(\d{1,2}):(\d{2})$/.exec(value.trim());
2135
2154
  if (match === null) return void 0;
2136
2155
  const hours = Number(match[1]);
@@ -6306,8 +6325,82 @@ window.__ModuleLoader__.load({
6306
6325
  };
6307
6326
  }
6308
6327
  }
6309
- /** Render WorkBuddy sign-in state, credits, and model selection as one card. */
6310
- function WorkBuddyCard({ t, settingsScope, view }) {
6328
+ /**
6329
+ * The configuration area's own crash face (issue #139).
6330
+ *
6331
+ * WHY THIS EXISTS. The host wraps every slot entry in its own
6332
+ * `SlotErrorBoundary`, and that boundary's failure face is an EMPTY
6333
+ * `<div data-slot-error>` (`dsh-client-ui-renderer`). So a render-time throw
6334
+ * anywhere inside this card does not look like an error — it looks like the
6335
+ * plugin never installed: the header stays, the whole configuration area
6336
+ * vanishes, and the only trace is one `console.error` line. That is precisely
6337
+ * how issue #139 was reported ("配置区整块消失"), and it is why the reporter
6338
+ * could not tell a real crash from a missing card.
6339
+ *
6340
+ * WHAT IT BUYS. The same catch, with a face that says what happened: the
6341
+ * message goes on screen, so a report can quote it without opening devtools.
6342
+ * It does NOT hide the error — `componentDidCatch` still logs it, so the
6343
+ * console keeps the full stack the host would have printed anyway.
6344
+ *
6345
+ * SCOPE: the BODY only, never the header. A user whose configuration crashed
6346
+ * must still be able to collapse and re-expand the card, and the header is
6347
+ * pure static markup — it cannot be the thing that threw.
6348
+ *
6349
+ * LIMITS, stated so nobody expects more than React gives: a boundary catches
6350
+ * errors thrown during RENDER, in lifecycle methods, and in constructors. It
6351
+ * does NOT catch throws from event handlers, timers, or promise callbacks —
6352
+ * so an async failure still surfaces the way it did before (inline error text
6353
+ * or the console), which is the correct behaviour for those paths.
6354
+ */
6355
+ var CardBodyBoundary = class extends react.Component {
6356
+ state = {
6357
+ failed: false,
6358
+ message: void 0
6359
+ };
6360
+ static getDerivedStateFromError(error) {
6361
+ if (error instanceof Error && error.name === "SlotAssemblyError") throw error;
6362
+ return {
6363
+ failed: true,
6364
+ message: error instanceof Error ? error.message : String(error)
6365
+ };
6366
+ }
6367
+ componentDidCatch(error, info) {
6368
+ try {
6369
+ console.error("[dsh-connect-workbuddy] configuration area failed to render:", error, info.componentStack);
6370
+ } catch {}
6371
+ }
6372
+ render() {
6373
+ if (!this.state.failed) return this.props.children;
6374
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6375
+ className: "dsm-workbuddy-usage",
6376
+ children: [
6377
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
6378
+ className: "dsm-workbuddy-usage-error",
6379
+ children: this.props.t("row.cardCrashed")
6380
+ }),
6381
+ this.state.message === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
6382
+ className: "dsm-workbuddy-usage-error dsm-workbuddy-diag-mono",
6383
+ children: this.state.message
6384
+ }),
6385
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
6386
+ className: "dsm-workbuddy-diag-hint",
6387
+ children: this.props.t("row.cardCrashedHint")
6388
+ })
6389
+ ]
6390
+ });
6391
+ }
6392
+ };
6393
+ /**
6394
+ * Render WorkBuddy sign-in state, credits, and model selection as one card.
6395
+ *
6396
+ * The body is wrapped in {@link CardBodyBoundary} INSIDE the render, not here:
6397
+ * the header must keep working when the body throws (see that class).
6398
+ */
6399
+ function WorkBuddyCard(props) {
6400
+ if (props.t === void 0) throw new Error("WorkBuddy plugin card requires its translation function");
6401
+ return (0, react.createElement)(WorkBuddyCardBody, props);
6402
+ }
6403
+ function WorkBuddyCardBody({ t, settingsScope, view }) {
6311
6404
  if (t === void 0) throw new Error("WorkBuddy plugin card requires its translation function");
6312
6405
  const [open, setOpen] = (0, react.useState)(view === "page");
6313
6406
  /** The region whose tab is on screen; each tab is its own provider stack. */
@@ -7852,627 +7945,632 @@ window.__ModuleLoader__.load({
7852
7945
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7853
7946
  className: "dsm-plugin-card-body",
7854
7947
  hidden: !open,
7855
- children: open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7856
- className: "dsm-workbuddy-usage",
7857
- children: [
7858
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7859
- className: "dsm-workbuddy-tabs",
7860
- role: "tablist",
7861
- "aria-label": title,
7862
- children: WORKBUDDY_REGIONS.map((region) => {
7863
- const regionStatus = statusByRegion[region];
7864
- const regionOnState = regionOn(region);
7865
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7866
- className: "dsm-workbuddy-tab-cell",
7867
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
7948
+ children: open ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardBodyBoundary, {
7949
+ t,
7950
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7951
+ className: "dsm-workbuddy-usage",
7952
+ children: [
7953
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7954
+ className: "dsm-workbuddy-tabs",
7955
+ role: "tablist",
7956
+ "aria-label": title,
7957
+ children: WORKBUDDY_REGIONS.map((region) => {
7958
+ const regionStatus = statusByRegion[region];
7959
+ const regionOnState = regionOn(region);
7960
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7961
+ className: "dsm-workbuddy-tab-cell",
7962
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
7963
+ type: "button",
7964
+ role: "tab",
7965
+ "aria-selected": region === activeRegion,
7966
+ className: `dsm-workbuddy-tab${region === activeRegion ? " dsm-workbuddy-tab-active" : ""}${regionOnState ? "" : " dsm-workbuddy-tab-off"}`,
7967
+ onClick: () => {
7968
+ setActiveRegion(region);
7969
+ setAccountError(void 0);
7970
+ },
7971
+ children: [regionStatus === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7972
+ "aria-hidden": "true",
7973
+ className: "dsm-workbuddy-tab-dot",
7974
+ style: dotStyle(regionStatus.status)
7975
+ }), region === "cn" ? t("row.tabCn") : t("row.tabGlobal")]
7976
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
7977
+ className: "dsm-workbuddy-tab-switch",
7978
+ title: t("row.tabSwitchHint"),
7979
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
7980
+ type: "checkbox",
7981
+ checked: regionOnState,
7982
+ disabled: togglingRegion === region || !canWrite || saving || poolBusy,
7983
+ "aria-label": t("row.tabSwitchAria", { region: region === "cn" ? t("row.tabCn") : t("row.tabGlobal") }),
7984
+ onChange: (event) => {
7985
+ toggleRegion(region, event.target.checked);
7986
+ }
7987
+ })
7988
+ })]
7989
+ }, region);
7990
+ })
7991
+ }),
7992
+ signedIn ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7993
+ className: "dsm-workbuddy-panels",
7994
+ role: "tablist",
7995
+ "aria-label": t("row.panelAria"),
7996
+ children: [
7997
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
7868
7998
  type: "button",
7869
7999
  role: "tab",
7870
- "aria-selected": region === activeRegion,
7871
- className: `dsm-workbuddy-tab${region === activeRegion ? " dsm-workbuddy-tab-active" : ""}${regionOnState ? "" : " dsm-workbuddy-tab-off"}`,
8000
+ id: "dsm-workbuddy-tab-accounts",
8001
+ "aria-controls": "dsm-workbuddy-panel-accounts",
8002
+ "aria-selected": panel === "accounts",
8003
+ className: `dsm-workbuddy-panel-tab${panel === "accounts" ? " dsm-workbuddy-panel-tab-active" : ""}`,
7872
8004
  onClick: () => {
7873
- setActiveRegion(region);
7874
- setAccountError(void 0);
8005
+ setPanel("accounts");
7875
8006
  },
7876
- children: [regionStatus === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7877
- "aria-hidden": "true",
7878
- className: "dsm-workbuddy-tab-dot",
7879
- style: dotStyle(regionStatus.status)
7880
- }), region === "cn" ? t("row.tabCn") : t("row.tabGlobal")]
7881
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
7882
- className: "dsm-workbuddy-tab-switch",
7883
- title: t("row.tabSwitchHint"),
7884
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
7885
- type: "checkbox",
7886
- checked: regionOnState,
7887
- disabled: togglingRegion === region || !canWrite || saving || poolBusy,
7888
- "aria-label": t("row.tabSwitchAria", { region: region === "cn" ? t("row.tabCn") : t("row.tabGlobal") }),
7889
- onChange: (event) => {
7890
- toggleRegion(region, event.target.checked);
7891
- }
7892
- })
7893
- })]
7894
- }, region);
7895
- })
7896
- }),
7897
- signedIn ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7898
- className: "dsm-workbuddy-panels",
7899
- role: "tablist",
7900
- "aria-label": t("row.panelAria"),
7901
- children: [
7902
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
7903
- type: "button",
7904
- role: "tab",
7905
- id: "dsm-workbuddy-tab-accounts",
7906
- "aria-controls": "dsm-workbuddy-panel-accounts",
7907
- "aria-selected": panel === "accounts",
7908
- className: `dsm-workbuddy-panel-tab${panel === "accounts" ? " dsm-workbuddy-panel-tab-active" : ""}`,
7909
- onClick: () => {
7910
- setPanel("accounts");
7911
- },
7912
- children: t("row.panelAccounts")
7913
- }),
7914
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
7915
- type: "button",
7916
- role: "tab",
7917
- id: "dsm-workbuddy-tab-models",
7918
- "aria-controls": "dsm-workbuddy-panel-models",
7919
- "aria-selected": panel === "models",
7920
- className: `dsm-workbuddy-panel-tab${panel === "models" ? " dsm-workbuddy-panel-tab-active" : ""}`,
7921
- onClick: () => {
7922
- setPanel("models");
7923
- },
7924
- children: t("row.panelModels")
7925
- }),
7926
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
7927
- type: "button",
7928
- role: "tab",
7929
- id: "dsm-workbuddy-tab-capabilities",
7930
- "aria-controls": "dsm-workbuddy-panel-capabilities",
7931
- "aria-selected": panel === "capabilities",
7932
- className: `dsm-workbuddy-panel-tab${panel === "capabilities" ? " dsm-workbuddy-panel-tab-active" : ""}`,
7933
- onClick: () => {
7934
- setPanel("capabilities");
7935
- },
7936
- children: t("row.panelCapabilities")
7937
- }),
7938
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
7939
- type: "button",
7940
- role: "tab",
7941
- id: "dsm-workbuddy-tab-diag",
7942
- "aria-controls": "dsm-workbuddy-panel-diag",
7943
- "aria-selected": panel === "diag",
7944
- className: `dsm-workbuddy-panel-tab${panel === "diag" ? " dsm-workbuddy-panel-tab-active" : ""}`,
7945
- onClick: () => {
7946
- setPanel("diag");
7947
- },
7948
- children: t("row.panelDiag")
7949
- })
7950
- ]
7951
- }) : null,
7952
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7953
- className: "dsm-workbuddy-panel",
7954
- role: "tabpanel",
7955
- id: "dsm-workbuddy-panel-accounts",
7956
- "aria-labelledby": "dsm-workbuddy-tab-accounts",
7957
- hidden: signedIn && panel !== "accounts",
7958
- children: [
7959
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
7960
- className: "dsm-workbuddy-models-summary",
7961
- children: t("row.tabHint")
7962
- }),
7963
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
7964
- className: "dsm-workbuddy-models-summary dsm-workbuddy-free-quota-warn",
7965
- children: t("row.tabFreeQuotaWarn")
7966
- }),
7967
- !activeRegionOn ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
7968
- className: "dsm-workbuddy-tab-off-notice",
7969
- children: t("row.tabOffNotice")
7970
- }) : null,
7971
- status.status === "error" || status.status === "signed-in" && status.creditsError !== void 0 ? status.status === "signed-in" && status.credentialRejected === true ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
7972
- className: "dsm-workbuddy-usage-hint",
7973
- children: t("row.reloginHint")
7974
- }) : null,
7975
- accountError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
7976
- className: "dsm-workbuddy-account-error",
7977
- role: "alert",
7978
- children: accountError
7979
- }),
7980
- selectionLost ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
7981
- className: "dsm-workbuddy-usage-hint",
7982
- children: t("row.selectionLostHint")
7983
- }) : null,
7984
- status.status === "signed-in" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
7985
- status.credentialRejected === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
7986
- className: "dsm-workbuddy-usage-error",
7987
- role: "alert",
7988
- children: [
7989
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("row.credentialRejectedTitle") }),
7990
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("row.credentialRejectedIntro", { accountName: nameOf(status.accountName) }) }),
7991
- status.recovery?.usableAccount !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("row.credentialRejectedSwitch", { accountName: nameOf(status.recovery.usableAccount.accountName) }) }) : status.recovery?.reloginRequired === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("row.credentialRejectedRelogin") }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("row.credentialRejectedChoose") }),
7992
- status.recovery?.usableAccount === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
7993
- type: "button",
7994
- className: "dsm-btn dsm-btn-outline",
7995
- disabled: switchingAccount || !canWrite,
7996
- onClick: () => {
7997
- const target = status.recovery?.usableAccount;
7998
- if (target !== void 0) switchAccount(target.accountId);
7999
- },
8000
- children: switchingAccount ? t("row.accountsScanning") : t("row.credentialRejectedSwitchAction", { accountName: nameOf(status.recovery.usableAccount.accountName) })
8001
- })
8002
- ]
8003
- }) : null,
8004
- status.creditsError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8005
- className: "dsm-workbuddy-usage-error",
8006
- children: t("row.creditsError", { message: status.creditsError })
8007
+ children: t("row.panelAccounts")
8007
8008
  }),
8008
- status.refreshError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8009
- className: "dsm-workbuddy-usage-error",
8010
- role: "alert",
8011
- children: t("row.requestFailedHint", { message: status.refreshError })
8009
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8010
+ type: "button",
8011
+ role: "tab",
8012
+ id: "dsm-workbuddy-tab-models",
8013
+ "aria-controls": "dsm-workbuddy-panel-models",
8014
+ "aria-selected": panel === "models",
8015
+ className: `dsm-workbuddy-panel-tab${panel === "models" ? " dsm-workbuddy-panel-tab-active" : ""}`,
8016
+ onClick: () => {
8017
+ setPanel("models");
8018
+ },
8019
+ children: t("row.panelModels")
8012
8020
  }),
8013
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AccountPool, {
8014
- t,
8015
- region: activeRegion,
8016
- ...status.pool === void 0 ? {} : { pool: status.pool },
8017
- ...settingsScope === void 0 ? {} : { settingsScope },
8018
- onRescan: () => {
8019
- rescanAccounts();
8021
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8022
+ type: "button",
8023
+ role: "tab",
8024
+ id: "dsm-workbuddy-tab-capabilities",
8025
+ "aria-controls": "dsm-workbuddy-panel-capabilities",
8026
+ "aria-selected": panel === "capabilities",
8027
+ className: `dsm-workbuddy-panel-tab${panel === "capabilities" ? " dsm-workbuddy-panel-tab-active" : ""}`,
8028
+ onClick: () => {
8029
+ setPanel("capabilities");
8020
8030
  },
8021
- rescanning: busy,
8022
- onSelectAccount: (accountId) => {
8023
- switchAccount(accountId);
8031
+ children: t("row.panelCapabilities")
8032
+ }),
8033
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8034
+ type: "button",
8035
+ role: "tab",
8036
+ id: "dsm-workbuddy-tab-diag",
8037
+ "aria-controls": "dsm-workbuddy-panel-diag",
8038
+ "aria-selected": panel === "diag",
8039
+ className: `dsm-workbuddy-panel-tab${panel === "diag" ? " dsm-workbuddy-panel-tab-active" : ""}`,
8040
+ onClick: () => {
8041
+ setPanel("diag");
8024
8042
  },
8025
- selectingAccount: switchingAccount,
8026
- accountTools,
8027
- siblingBusy: saving || togglingRegion !== void 0,
8028
- onBusyChange: setPoolBusy,
8029
- onSaved: async () => await refreshUsage(activeRegion) !== void 0,
8030
- onRefresh: () => refreshUsage(activeRegion)
8043
+ children: t("row.panelDiag")
8031
8044
  })
8032
- ] }) : null
8033
- ]
8034
- }),
8035
- signedIn ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8036
- className: "dsm-workbuddy-panel",
8037
- role: "tabpanel",
8038
- id: "dsm-workbuddy-panel-models",
8039
- "aria-labelledby": "dsm-workbuddy-tab-models",
8040
- hidden: panel !== "models",
8041
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
8042
- className: "dsm-workbuddy-models",
8043
- "aria-label": t("row.modelsTitle"),
8044
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8045
- className: "dsm-workbuddy-models-fold",
8046
- children: [
8047
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8048
- className: "dsm-workbuddy-models-head",
8049
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8050
- className: "dsm-workbuddy-models-title-row",
8051
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h3", {
8052
- className: "dsm-workbuddy-models-title",
8053
- children: [t("row.modelsTitle"), dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8054
- className: "dsm-workbuddy-models-dirty",
8055
- children: t("row.modelsDirty")
8056
- }) : null]
8045
+ ]
8046
+ }) : null,
8047
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8048
+ className: "dsm-workbuddy-panel",
8049
+ role: "tabpanel",
8050
+ id: "dsm-workbuddy-panel-accounts",
8051
+ "aria-labelledby": "dsm-workbuddy-tab-accounts",
8052
+ hidden: signedIn && panel !== "accounts",
8053
+ children: [
8054
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8055
+ className: "dsm-workbuddy-models-summary",
8056
+ children: t("row.tabHint")
8057
+ }),
8058
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8059
+ className: "dsm-workbuddy-models-summary dsm-workbuddy-free-quota-warn",
8060
+ children: t("row.tabFreeQuotaWarn")
8061
+ }),
8062
+ !activeRegionOn ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8063
+ className: "dsm-workbuddy-tab-off-notice",
8064
+ children: t("row.tabOffNotice")
8065
+ }) : null,
8066
+ status.status === "error" || status.status === "signed-in" && status.creditsError !== void 0 ? status.status === "signed-in" && status.credentialRejected === true ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8067
+ className: "dsm-workbuddy-usage-hint",
8068
+ children: t("row.reloginHint")
8069
+ }) : null,
8070
+ accountError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8071
+ className: "dsm-workbuddy-account-error",
8072
+ role: "alert",
8073
+ children: accountError
8074
+ }),
8075
+ selectionLost ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8076
+ className: "dsm-workbuddy-usage-hint",
8077
+ children: t("row.selectionLostHint")
8078
+ }) : null,
8079
+ status.status === "signed-in" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
8080
+ status.credentialRejected === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
8081
+ className: "dsm-workbuddy-usage-error",
8082
+ role: "alert",
8083
+ children: [
8084
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("row.credentialRejectedTitle") }),
8085
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("row.credentialRejectedIntro", { accountName: nameOf(status.accountName) }) }),
8086
+ status.recovery?.usableAccount !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("row.credentialRejectedSwitch", { accountName: nameOf(status.recovery.usableAccount.accountName) }) }) : status.recovery?.reloginRequired === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("row.credentialRejectedRelogin") }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("row.credentialRejectedChoose") }),
8087
+ status.recovery?.usableAccount === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8088
+ type: "button",
8089
+ className: "dsm-btn dsm-btn-outline",
8090
+ disabled: switchingAccount || !canWrite,
8091
+ onClick: () => {
8092
+ const target = status.recovery?.usableAccount;
8093
+ if (target !== void 0) switchAccount(target.accountId);
8094
+ },
8095
+ children: switchingAccount ? t("row.accountsScanning") : t("row.credentialRejectedSwitchAction", { accountName: nameOf(status.recovery.usableAccount.accountName) })
8057
8096
  })
8058
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8059
- className: "dsm-workbuddy-models-summary",
8060
- children: t("row.modelsSummary", { count: activeEnabledIds.size })
8061
- })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8062
- className: "dsm-workbuddy-models-head-actions",
8063
- children: [
8064
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8065
- type: "button",
8066
- className: "dsm-btn dsm-btn-outline",
8067
- disabled: busy,
8068
- onClick: () => {
8069
- refreshModels();
8070
- },
8071
- children: busy ? t("row.modelsRefreshing") : t("row.modelsRefresh")
8072
- }),
8073
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8074
- type: "button",
8075
- className: "dsm-btn dsm-btn-outline dsm-workbuddy-models-sweep",
8076
- disabled: busy || sweeping !== void 0 || activeEnabledIds.size === 0,
8077
- title: t("row.modelsTestEnabledHint"),
8078
- onClick: sweepEnabledModels,
8079
- children: sweeping === void 0 ? t("row.modelsTestEnabled") : t("row.modelsTesting", {
8080
- done: sweeping.done,
8081
- total: sweeping.total
8082
- })
8083
- }),
8084
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8085
- type: "button",
8086
- className: "dsm-btn dsm-btn-outline dsm-workbuddy-models-sweep",
8087
- disabled: busy || sweeping !== void 0 || visibleModels.length === 0,
8088
- title: t("row.modelsTestAllHint"),
8089
- onClick: sweepAllModels,
8090
- children: sweeping === void 0 ? t("row.modelsTestAll") : t("row.modelsTesting", {
8091
- done: sweeping.done,
8092
- total: sweeping.total
8093
- })
8094
- }),
8095
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8096
- type: "button",
8097
- className: "dsm-btn dsm-btn-outline dsm-workbuddy-models-sweep",
8098
- disabled: busy || tpsSweeping !== void 0 || tpsBusy || activeEnabledIds.size === 0,
8099
- title: t("row.tpsSweepEnabledHint"),
8100
- onClick: sweepTpsEnabledModels,
8101
- children: tpsSweeping === void 0 ? t("row.tpsSweepEnabled") : t("row.tpsTesting", {
8102
- done: tpsSweeping.done,
8103
- total: tpsSweeping.total
8104
- })
8105
- })
8106
- ]
8107
- })]
8097
+ ]
8098
+ }) : null,
8099
+ status.creditsError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8100
+ className: "dsm-workbuddy-usage-error",
8101
+ children: t("row.creditsError", { message: status.creditsError })
8108
8102
  }),
8109
- probeError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8110
- className: "dsm-workbuddy-model-probe-result dsm-workbuddy-model-probe-result-bad",
8103
+ status.refreshError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8104
+ className: "dsm-workbuddy-usage-error",
8111
8105
  role: "alert",
8112
- children: t("row.probeError", { message: probeError })
8113
- }),
8114
- sweepSummary === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8115
- className: "dsm-workbuddy-models-sweep-summary",
8116
- role: "status",
8117
- children: sweepSummary
8106
+ children: t("row.requestFailedHint", { message: status.refreshError })
8118
8107
  }),
8119
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8120
- className: "dsm-workbuddy-model-list",
8121
- children: visibleModels.map((model) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8122
- className: `dsm-workbuddy-model${activeEnabledIds.has(model.id) ? "" : " dsm-workbuddy-model-disabled"}`,
8123
- children: [
8124
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8125
- className: "dsm-workbuddy-model-head",
8126
- children: [
8127
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
8128
- className: "dsm-workbuddy-model-enabled",
8129
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8130
- type: "checkbox",
8131
- checked: activeEnabledIds.has(model.id),
8132
- disabled: !canWrite || saving,
8133
- onChange: () => {
8134
- toggleModel(model.id);
8135
- }
8136
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
8137
- className: "dsm-workbuddy-model-copy",
8138
- children: [
8139
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
8140
- className: "dsm-workbuddy-model-name",
8141
- children: [model.name, effectiveRate(model) === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
8142
- className: "dsm-workbuddy-model-name-rate",
8143
- children: ["x", effectiveRate(model).toFixed(2)]
8144
- })]
8145
- }),
8146
- promoChip(model),
8147
- busyIcon(busyLevels[model.id], uiLanguage())
8148
- ]
8149
- })]
8150
- }),
8151
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
8152
- className: "dsm-workbuddy-model-image",
8153
- title: imageCheckboxHint(model, t),
8154
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8155
- type: "checkbox",
8156
- checked: activeImageIds.has(model.id),
8157
- disabled: !canWrite || saving,
8158
- onChange: () => {
8159
- toggleImage(model.id);
8160
- }
8161
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("row.modelImage") })]
8162
- }),
8163
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
8164
- className: `dsm-workbuddy-model-off${offBlocked(model) ? " dsm-workbuddy-model-off-blocked" : ""}`,
8165
- title: offBlocked(model) ? t("row.modelOffRefusedHint") : t("row.modelOffHint"),
8166
- children: [
8167
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8108
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AccountPool, {
8109
+ t,
8110
+ region: activeRegion,
8111
+ ...status.pool === void 0 ? {} : { pool: status.pool },
8112
+ ...settingsScope === void 0 ? {} : { settingsScope },
8113
+ onRescan: () => {
8114
+ rescanAccounts();
8115
+ },
8116
+ rescanning: busy,
8117
+ onSelectAccount: (accountId) => {
8118
+ switchAccount(accountId);
8119
+ },
8120
+ selectingAccount: switchingAccount,
8121
+ accountTools,
8122
+ siblingBusy: saving || togglingRegion !== void 0,
8123
+ onBusyChange: setPoolBusy,
8124
+ onSaved: async () => await refreshUsage(activeRegion) !== void 0,
8125
+ onRefresh: () => refreshUsage(activeRegion)
8126
+ })
8127
+ ] }) : null
8128
+ ]
8129
+ }),
8130
+ signedIn ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8131
+ className: "dsm-workbuddy-panel",
8132
+ role: "tabpanel",
8133
+ id: "dsm-workbuddy-panel-models",
8134
+ "aria-labelledby": "dsm-workbuddy-tab-models",
8135
+ hidden: panel !== "models",
8136
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
8137
+ className: "dsm-workbuddy-models",
8138
+ "aria-label": t("row.modelsTitle"),
8139
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8140
+ className: "dsm-workbuddy-models-fold",
8141
+ children: [
8142
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8143
+ className: "dsm-workbuddy-models-head",
8144
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8145
+ className: "dsm-workbuddy-models-title-row",
8146
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h3", {
8147
+ className: "dsm-workbuddy-models-title",
8148
+ children: [t("row.modelsTitle"), dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8149
+ className: "dsm-workbuddy-models-dirty",
8150
+ children: t("row.modelsDirty")
8151
+ }) : null]
8152
+ })
8153
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8154
+ className: "dsm-workbuddy-models-summary",
8155
+ children: t("row.modelsSummary", { count: activeEnabledIds.size })
8156
+ })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8157
+ className: "dsm-workbuddy-models-head-actions",
8158
+ children: [
8159
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8160
+ type: "button",
8161
+ className: "dsm-btn dsm-btn-outline",
8162
+ disabled: busy,
8163
+ onClick: () => {
8164
+ refreshModels();
8165
+ },
8166
+ children: busy ? t("row.modelsRefreshing") : t("row.modelsRefresh")
8167
+ }),
8168
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8169
+ type: "button",
8170
+ className: "dsm-btn dsm-btn-outline dsm-workbuddy-models-sweep",
8171
+ disabled: busy || sweeping !== void 0 || activeEnabledIds.size === 0,
8172
+ title: t("row.modelsTestEnabledHint"),
8173
+ onClick: sweepEnabledModels,
8174
+ children: sweeping === void 0 ? t("row.modelsTestEnabled") : t("row.modelsTesting", {
8175
+ done: sweeping.done,
8176
+ total: sweeping.total
8177
+ })
8178
+ }),
8179
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8180
+ type: "button",
8181
+ className: "dsm-btn dsm-btn-outline dsm-workbuddy-models-sweep",
8182
+ disabled: busy || sweeping !== void 0 || visibleModels.length === 0,
8183
+ title: t("row.modelsTestAllHint"),
8184
+ onClick: sweepAllModels,
8185
+ children: sweeping === void 0 ? t("row.modelsTestAll") : t("row.modelsTesting", {
8186
+ done: sweeping.done,
8187
+ total: sweeping.total
8188
+ })
8189
+ }),
8190
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8191
+ type: "button",
8192
+ className: "dsm-btn dsm-btn-outline dsm-workbuddy-models-sweep",
8193
+ disabled: busy || tpsSweeping !== void 0 || tpsBusy || activeEnabledIds.size === 0,
8194
+ title: t("row.tpsSweepEnabledHint"),
8195
+ onClick: sweepTpsEnabledModels,
8196
+ children: tpsSweeping === void 0 ? t("row.tpsSweepEnabled") : t("row.tpsTesting", {
8197
+ done: tpsSweeping.done,
8198
+ total: tpsSweeping.total
8199
+ })
8200
+ })
8201
+ ]
8202
+ })]
8203
+ }),
8204
+ probeError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8205
+ className: "dsm-workbuddy-model-probe-result dsm-workbuddy-model-probe-result-bad",
8206
+ role: "alert",
8207
+ children: t("row.probeError", { message: probeError })
8208
+ }),
8209
+ sweepSummary === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8210
+ className: "dsm-workbuddy-models-sweep-summary",
8211
+ role: "status",
8212
+ children: sweepSummary
8213
+ }),
8214
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8215
+ className: "dsm-workbuddy-model-list",
8216
+ children: visibleModels.map((model) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8217
+ className: `dsm-workbuddy-model${activeEnabledIds.has(model.id) ? "" : " dsm-workbuddy-model-disabled"}`,
8218
+ children: [
8219
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8220
+ className: "dsm-workbuddy-model-head",
8221
+ children: [
8222
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
8223
+ className: "dsm-workbuddy-model-enabled",
8224
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8168
8225
  type: "checkbox",
8169
- checked: activeOffIds.has(model.id),
8170
- disabled: !canWrite || saving || offBlocked(model),
8171
- onChange: () => {
8172
- toggleOff(model.id);
8173
- }
8174
- }),
8175
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("row.modelOff") }),
8176
- offBlocked(model) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8177
- className: "dsm-workbuddy-model-off-flag",
8178
- children: t("row.modelOffRefused")
8179
- }) : null
8180
- ]
8181
- }),
8182
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
8183
- className: "dsm-workbuddy-context-budget",
8184
- "aria-label": t("row.contextBudget"),
8185
- children: [
8186
- model.nativeContextWindow > 2e5 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8187
- type: "radio",
8188
- name: `context-${model.id}`,
8189
- checked: (activeContextBudgets[model.id] ?? 2e5) === 2e5,
8226
+ checked: activeEnabledIds.has(model.id),
8190
8227
  disabled: !canWrite || saving,
8191
8228
  onChange: () => {
8192
- setContextBudget(model.id, 2e5);
8229
+ toggleModel(model.id);
8193
8230
  }
8194
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "200K" })] }) : null,
8195
- model.nativeContextWindow > 5e5 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8196
- type: "radio",
8197
- name: `context-${model.id}`,
8198
- checked: activeContextBudgets[model.id] === 5e5,
8231
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
8232
+ className: "dsm-workbuddy-model-copy",
8233
+ children: [
8234
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
8235
+ className: "dsm-workbuddy-model-name",
8236
+ children: [model.name, effectiveRate(model) === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
8237
+ className: "dsm-workbuddy-model-name-rate",
8238
+ children: ["x", effectiveRate(model).toFixed(2)]
8239
+ })]
8240
+ }),
8241
+ promoChip(model),
8242
+ busyIcon(busyLevels[model.id], uiLanguage())
8243
+ ]
8244
+ })]
8245
+ }),
8246
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
8247
+ className: "dsm-workbuddy-model-image",
8248
+ title: imageCheckboxHint(model, t),
8249
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8250
+ type: "checkbox",
8251
+ checked: activeImageIds.has(model.id),
8199
8252
  disabled: !canWrite || saving,
8200
8253
  onChange: () => {
8201
- setContextBudget(model.id, 5e5);
8202
- }
8203
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "500K" })] }) : null,
8204
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8205
- type: "radio",
8206
- name: `context-${model.id}`,
8207
- checked: model.nativeContextWindow <= 2e5 || activeContextBudgets[model.id] === model.nativeContextWindow,
8208
- disabled: model.nativeContextWindow <= 2e5 || !canWrite || saving,
8209
- onChange: () => {
8210
- setContextBudget(model.id, model.nativeContextWindow);
8254
+ toggleImage(model.id);
8211
8255
  }
8212
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: formatCapacity(model.nativeContextWindow, t("row.modelUnknown")) })] })
8256
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("row.modelImage") })]
8257
+ }),
8258
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
8259
+ className: `dsm-workbuddy-model-off${offBlocked(model) ? " dsm-workbuddy-model-off-blocked" : ""}`,
8260
+ title: offBlocked(model) ? t("row.modelOffRefusedHint") : t("row.modelOffHint"),
8261
+ children: [
8262
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8263
+ type: "checkbox",
8264
+ checked: activeOffIds.has(model.id),
8265
+ disabled: !canWrite || saving || offBlocked(model),
8266
+ onChange: () => {
8267
+ toggleOff(model.id);
8268
+ }
8269
+ }),
8270
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("row.modelOff") }),
8271
+ offBlocked(model) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8272
+ className: "dsm-workbuddy-model-off-flag",
8273
+ children: t("row.modelOffRefused")
8274
+ }) : null
8275
+ ]
8276
+ }),
8277
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
8278
+ className: "dsm-workbuddy-context-budget",
8279
+ "aria-label": t("row.contextBudget"),
8280
+ children: [
8281
+ model.nativeContextWindow > 2e5 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8282
+ type: "radio",
8283
+ name: `context-${model.id}`,
8284
+ checked: (activeContextBudgets[model.id] ?? 2e5) === 2e5,
8285
+ disabled: !canWrite || saving,
8286
+ onChange: () => {
8287
+ setContextBudget(model.id, 2e5);
8288
+ }
8289
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "200K" })] }) : null,
8290
+ model.nativeContextWindow > 5e5 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8291
+ type: "radio",
8292
+ name: `context-${model.id}`,
8293
+ checked: activeContextBudgets[model.id] === 5e5,
8294
+ disabled: !canWrite || saving,
8295
+ onChange: () => {
8296
+ setContextBudget(model.id, 5e5);
8297
+ }
8298
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "500K" })] }) : null,
8299
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8300
+ type: "radio",
8301
+ name: `context-${model.id}`,
8302
+ checked: model.nativeContextWindow <= 2e5 || activeContextBudgets[model.id] === model.nativeContextWindow,
8303
+ disabled: model.nativeContextWindow <= 2e5 || !canWrite || saving,
8304
+ onChange: () => {
8305
+ setContextBudget(model.id, model.nativeContextWindow);
8306
+ }
8307
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: formatCapacity(model.nativeContextWindow, t("row.modelUnknown")) })] })
8308
+ ]
8309
+ }),
8310
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8311
+ className: "dsm-workbuddy-model-actions-buttons",
8312
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8313
+ type: "button",
8314
+ className: "dsm-btn dsm-btn-outline dsm-workbuddy-model-probe",
8315
+ disabled: probing[model.id] === true || status.status !== "signed-in",
8316
+ title: t("row.probeHint"),
8317
+ onClick: () => {
8318
+ probeModels([model.id]);
8319
+ },
8320
+ children: probing[model.id] === true ? t("row.probing") : t("row.probe")
8321
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8322
+ type: "button",
8323
+ className: "dsm-btn dsm-btn-outline dsm-workbuddy-model-probe",
8324
+ disabled: tpsProbing[model.id] === true || status.status !== "signed-in",
8325
+ title: t("row.tpsHint"),
8326
+ onClick: () => {
8327
+ measureTpsFor([model.id]);
8328
+ },
8329
+ children: tpsProbing[model.id] === true ? t("row.tpsMeasuring") : t("row.tpsMeasure")
8330
+ })]
8331
+ })
8332
+ ]
8333
+ }),
8334
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8335
+ className: "dsm-workbuddy-model-details",
8336
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8337
+ className: "dsm-workbuddy-model-meta",
8338
+ children: [
8339
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("row.modelContext", { context: formatCapacity(model.nativeContextWindow, t("row.modelUnknown")) }) }),
8340
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("row.modelOutput", { output: formatCapacity(model.maxTokens, t("row.modelUnknown")) }) }),
8341
+ model.reasoning === void 0 || model.reasoning.supportedEfforts === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("row.modelReasoning", { efforts: model.reasoning.supportedEfforts.join(" / ") }) })
8213
8342
  ]
8214
- }),
8215
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8216
- className: "dsm-workbuddy-model-actions-buttons",
8217
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8218
- type: "button",
8219
- className: "dsm-btn dsm-btn-outline dsm-workbuddy-model-probe",
8220
- disabled: probing[model.id] === true || status.status !== "signed-in",
8221
- title: t("row.probeHint"),
8222
- onClick: () => {
8223
- probeModels([model.id]);
8224
- },
8225
- children: probing[model.id] === true ? t("row.probing") : t("row.probe")
8226
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8227
- type: "button",
8228
- className: "dsm-btn dsm-btn-outline dsm-workbuddy-model-probe",
8229
- disabled: tpsProbing[model.id] === true || status.status !== "signed-in",
8230
- title: t("row.tpsHint"),
8231
- onClick: () => {
8232
- measureTpsFor([model.id]);
8233
- },
8234
- children: tpsProbing[model.id] === true ? t("row.tpsMeasuring") : t("row.tpsMeasure")
8235
- })]
8236
8343
  })
8237
- ]
8344
+ }),
8345
+ (() => {
8346
+ const result = probes[activeRegion]?.[model.id];
8347
+ if (result === void 0) return null;
8348
+ const view = probeResultView(result, t);
8349
+ const reason = inlineProbeReason(result.outcome, result.message);
8350
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
8351
+ className: `dsm-workbuddy-model-probe-result dsm-workbuddy-model-probe-result-${view.tone}`,
8352
+ role: "status",
8353
+ ...result.message === void 0 ? {} : { title: result.message },
8354
+ children: [view.text, reason === void 0 ? null : " · " + reason]
8355
+ });
8356
+ })(),
8357
+ (() => {
8358
+ const measured = tpsResults[model.id];
8359
+ if (measured === void 0) return null;
8360
+ const view = tpsResultView(measured, t, tpsMeasuredAt[model.id]);
8361
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8362
+ className: `dsm-workbuddy-model-probe-result dsm-workbuddy-model-probe-result-${view.tone}`,
8363
+ role: "status",
8364
+ children: view.text
8365
+ });
8366
+ })()
8367
+ ]
8368
+ }, model.id))
8369
+ }),
8370
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8371
+ className: "dsm-workbuddy-model-capability-note",
8372
+ children: t("row.modelCapabilityPending")
8373
+ }),
8374
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8375
+ className: "dsm-workbuddy-model-actions",
8376
+ children: [
8377
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
8378
+ className: "dsm-workbuddy-usage-cheer",
8379
+ href: WORKBUDDY_GITHUB_URL,
8380
+ target: "_blank",
8381
+ rel: "noopener noreferrer",
8382
+ children: [t("row.cheer"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8383
+ className: "dsm-workbuddy-usage-cheer-star",
8384
+ "aria-hidden": "true",
8385
+ children: "★"
8386
+ })]
8238
8387
  }),
8239
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8240
- className: "dsm-workbuddy-model-details",
8241
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8242
- className: "dsm-workbuddy-model-meta",
8243
- children: [
8244
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("row.modelContext", { context: formatCapacity(model.nativeContextWindow, t("row.modelUnknown")) }) }),
8245
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("row.modelOutput", { output: formatCapacity(model.maxTokens, t("row.modelUnknown")) }) }),
8246
- model.reasoning === void 0 || model.reasoning.supportedEfforts === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("row.modelReasoning", { efforts: model.reasoning.supportedEfforts.join(" / ") }) })
8247
- ]
8248
- })
8388
+ saveError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8389
+ className: "dsm-workbuddy-model-save-error",
8390
+ children: t("row.saveError", { message: saveError })
8249
8391
  }),
8250
- (() => {
8251
- const result = probes[activeRegion]?.[model.id];
8252
- if (result === void 0) return null;
8253
- const view = probeResultView(result, t);
8254
- const reason = inlineProbeReason(result.outcome, result.message);
8255
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
8256
- className: `dsm-workbuddy-model-probe-result dsm-workbuddy-model-probe-result-${view.tone}`,
8257
- role: "status",
8258
- ...result.message === void 0 ? {} : { title: result.message },
8259
- children: [view.text, reason === void 0 ? null : " · " + reason]
8260
- });
8261
- })(),
8262
- (() => {
8263
- const measured = tpsResults[model.id];
8264
- if (measured === void 0) return null;
8265
- const view = tpsResultView(measured, t, tpsMeasuredAt[model.id]);
8266
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8267
- className: `dsm-workbuddy-model-probe-result dsm-workbuddy-model-probe-result-${view.tone}`,
8268
- role: "status",
8269
- children: view.text
8270
- });
8271
- })()
8392
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8393
+ className: "dsm-workbuddy-model-actions-buttons",
8394
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8395
+ type: "button",
8396
+ className: "dsm-btn dsm-btn-outline",
8397
+ disabled: !dirty || saving || poolBusy || togglingRegion !== void 0,
8398
+ onClick: discardModels,
8399
+ children: t("row.discard")
8400
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8401
+ type: "button",
8402
+ className: "dsm-btn dsm-btn-primary",
8403
+ disabled: !dirty || saving || poolBusy || togglingRegion !== void 0 || activeEnabledIds.size === 0,
8404
+ onClick: () => {
8405
+ saveModels();
8406
+ },
8407
+ children: saving ? t("row.saving") : t("row.save")
8408
+ })]
8409
+ })
8272
8410
  ]
8273
- }, model.id))
8411
+ })
8412
+ ]
8413
+ })
8414
+ })
8415
+ }) : null,
8416
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8417
+ className: "dsm-workbuddy-panel",
8418
+ role: "tabpanel",
8419
+ id: "dsm-workbuddy-panel-capabilities",
8420
+ "aria-labelledby": "dsm-workbuddy-tab-capabilities",
8421
+ hidden: signedIn && panel !== "capabilities",
8422
+ children: [
8423
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8424
+ className: "dsm-workbuddy-panel-note",
8425
+ children: t("row.panelCapabilitiesHint")
8426
+ }),
8427
+ creditPreferences,
8428
+ upstreamSwitches
8429
+ ]
8430
+ }),
8431
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8432
+ className: "dsm-workbuddy-panel",
8433
+ role: "tabpanel",
8434
+ id: "dsm-workbuddy-panel-diag",
8435
+ "aria-labelledby": "dsm-workbuddy-tab-diag",
8436
+ hidden: !signedIn || panel !== "diag",
8437
+ children: status.status !== "signed-in" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8438
+ className: "dsm-workbuddy-diag",
8439
+ children: [
8440
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8441
+ className: "dsm-workbuddy-diag-row",
8442
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8443
+ className: "dsm-workbuddy-diag-label",
8444
+ children: t("row.diagRegion")
8445
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8446
+ className: "dsm-workbuddy-diag-value",
8447
+ children: status.region === "cn" ? t("row.tabCn") : t("row.tabGlobal")
8448
+ })]
8274
8449
  }),
8275
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8276
- className: "dsm-workbuddy-model-capability-note",
8277
- children: t("row.modelCapabilityPending")
8450
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8451
+ className: "dsm-workbuddy-diag-row",
8452
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8453
+ className: "dsm-workbuddy-diag-label",
8454
+ children: t("row.diagDomain")
8455
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8456
+ className: "dsm-workbuddy-diag-value dsm-workbuddy-diag-mono",
8457
+ children: status.domain === void 0 || status.domain === "" ? t("row.modelUnknown") : status.domain
8458
+ })]
8278
8459
  }),
8279
8460
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8280
- className: "dsm-workbuddy-model-actions",
8281
- children: [
8282
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
8283
- className: "dsm-workbuddy-usage-cheer",
8284
- href: WORKBUDDY_GITHUB_URL,
8285
- target: "_blank",
8286
- rel: "noopener noreferrer",
8287
- children: [t("row.cheer"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8288
- className: "dsm-workbuddy-usage-cheer-star",
8289
- "aria-hidden": "true",
8290
- children: "★"
8291
- })]
8292
- }),
8293
- saveError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8294
- className: "dsm-workbuddy-model-save-error",
8295
- children: t("row.saveError", { message: saveError })
8296
- }),
8297
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8298
- className: "dsm-workbuddy-model-actions-buttons",
8299
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8300
- type: "button",
8301
- className: "dsm-btn dsm-btn-outline",
8302
- disabled: !dirty || saving || poolBusy || togglingRegion !== void 0,
8303
- onClick: discardModels,
8304
- children: t("row.discard")
8305
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8306
- type: "button",
8307
- className: "dsm-btn dsm-btn-primary",
8308
- disabled: !dirty || saving || poolBusy || togglingRegion !== void 0 || activeEnabledIds.size === 0,
8309
- onClick: () => {
8310
- saveModels();
8311
- },
8312
- children: saving ? t("row.saving") : t("row.save")
8313
- })]
8314
- })
8315
- ]
8461
+ className: "dsm-workbuddy-diag-row",
8462
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8463
+ className: "dsm-workbuddy-diag-label",
8464
+ children: t("row.diagAccount")
8465
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8466
+ className: "dsm-workbuddy-diag-value",
8467
+ children: nameOf(status.accountName)
8468
+ })]
8469
+ }),
8470
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8471
+ className: "dsm-workbuddy-diag-row",
8472
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8473
+ className: "dsm-workbuddy-diag-label",
8474
+ children: t("row.diagToken")
8475
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8476
+ className: "dsm-workbuddy-diag-value dsm-workbuddy-diag-mono",
8477
+ children: formatDate(status.tokenExpiresAtMs)
8478
+ })]
8479
+ }),
8480
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8481
+ className: "dsm-workbuddy-diag-row",
8482
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8483
+ className: "dsm-workbuddy-diag-label",
8484
+ children: t("row.diagCatalog")
8485
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8486
+ className: "dsm-workbuddy-diag-value",
8487
+ children: formatNumber(status.models.length)
8488
+ })]
8489
+ }),
8490
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8491
+ className: "dsm-workbuddy-diag-row",
8492
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8493
+ className: "dsm-workbuddy-diag-label",
8494
+ children: t("row.diagEnabled")
8495
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8496
+ className: "dsm-workbuddy-diag-value",
8497
+ children: formatNumber(status.enabledModelIds.length)
8498
+ })]
8499
+ }),
8500
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8501
+ className: "dsm-workbuddy-diag-row",
8502
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8503
+ className: "dsm-workbuddy-diag-label",
8504
+ children: t("row.diagPool")
8505
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8506
+ className: "dsm-workbuddy-diag-value",
8507
+ children: status.pool?.enabled === true ? t("row.diagPoolOn", { count: status.pool.accounts.length }) : t("row.diagPoolOff")
8508
+ })]
8509
+ }),
8510
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8511
+ className: "dsm-workbuddy-diag-row",
8512
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8513
+ className: "dsm-workbuddy-diag-label",
8514
+ children: t("row.diagFailures")
8515
+ }), (() => {
8516
+ const failures = [];
8517
+ if (status.credentialRejected === true) failures.push(t("row.credentialRejectedTitle"));
8518
+ if (status.refreshError !== void 0) failures.push(status.refreshError);
8519
+ if (status.creditsError !== void 0) failures.push(status.creditsError);
8520
+ const unreadable = status.models.reduce((count, model) => count + (model.promos ?? []).filter((promo) => promo.schedule?.dailyUnusable === true).length, 0);
8521
+ if (unreadable > 0) failures.push(t("row.diagPromoUnreadable", { count: unreadable }));
8522
+ return failures.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8523
+ className: "dsm-workbuddy-diag-value",
8524
+ children: t("row.diagNoFailures")
8525
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8526
+ className: "dsm-workbuddy-diag-value dsm-workbuddy-diag-bad dsm-workbuddy-diag-mono",
8527
+ children: failures.join(" · ")
8528
+ });
8529
+ })()]
8316
8530
  })
8317
8531
  ]
8318
- })
8319
- })
8320
- }) : null,
8321
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8322
- className: "dsm-workbuddy-panel",
8323
- role: "tabpanel",
8324
- id: "dsm-workbuddy-panel-capabilities",
8325
- "aria-labelledby": "dsm-workbuddy-tab-capabilities",
8326
- hidden: signedIn && panel !== "capabilities",
8327
- children: [
8532
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8533
+ className: "dsm-workbuddy-diag-hint",
8534
+ children: t("row.diagHint")
8535
+ })] })
8536
+ }),
8537
+ status.status === "signed-out" && loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8538
+ className: "dsm-workbuddy-usage-text",
8539
+ role: "status",
8540
+ children: t("row.accountsLoading")
8541
+ }) : null,
8542
+ status.status === "signed-out" && !loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
8328
8543
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8329
- className: "dsm-workbuddy-panel-note",
8330
- children: t("row.panelCapabilitiesHint")
8544
+ className: "dsm-workbuddy-usage-text",
8545
+ children: signedOutText(notice, t)
8331
8546
  }),
8332
- creditPreferences,
8333
- upstreamSwitches
8334
- ]
8335
- }),
8336
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8337
- className: "dsm-workbuddy-panel",
8338
- role: "tabpanel",
8339
- id: "dsm-workbuddy-panel-diag",
8340
- "aria-labelledby": "dsm-workbuddy-tab-diag",
8341
- hidden: !signedIn || panel !== "diag",
8342
- children: status.status !== "signed-in" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8343
- className: "dsm-workbuddy-diag",
8344
- children: [
8345
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8346
- className: "dsm-workbuddy-diag-row",
8347
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8348
- className: "dsm-workbuddy-diag-label",
8349
- children: t("row.diagRegion")
8350
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8351
- className: "dsm-workbuddy-diag-value",
8352
- children: status.region === "cn" ? t("row.tabCn") : t("row.tabGlobal")
8353
- })]
8354
- }),
8355
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8356
- className: "dsm-workbuddy-diag-row",
8357
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8358
- className: "dsm-workbuddy-diag-label",
8359
- children: t("row.diagDomain")
8360
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8361
- className: "dsm-workbuddy-diag-value dsm-workbuddy-diag-mono",
8362
- children: status.domain === void 0 || status.domain === "" ? t("row.modelUnknown") : status.domain
8363
- })]
8364
- }),
8365
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8366
- className: "dsm-workbuddy-diag-row",
8367
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8368
- className: "dsm-workbuddy-diag-label",
8369
- children: t("row.diagAccount")
8370
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8371
- className: "dsm-workbuddy-diag-value",
8372
- children: nameOf(status.accountName)
8373
- })]
8374
- }),
8375
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8376
- className: "dsm-workbuddy-diag-row",
8377
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8378
- className: "dsm-workbuddy-diag-label",
8379
- children: t("row.diagToken")
8380
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8381
- className: "dsm-workbuddy-diag-value dsm-workbuddy-diag-mono",
8382
- children: formatDate(status.tokenExpiresAtMs)
8383
- })]
8384
- }),
8385
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8386
- className: "dsm-workbuddy-diag-row",
8387
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8388
- className: "dsm-workbuddy-diag-label",
8389
- children: t("row.diagCatalog")
8390
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8391
- className: "dsm-workbuddy-diag-value",
8392
- children: formatNumber(status.models.length)
8393
- })]
8394
- }),
8395
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8396
- className: "dsm-workbuddy-diag-row",
8397
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8398
- className: "dsm-workbuddy-diag-label",
8399
- children: t("row.diagEnabled")
8400
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8401
- className: "dsm-workbuddy-diag-value",
8402
- children: formatNumber(status.enabledModelIds.length)
8403
- })]
8404
- }),
8405
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8406
- className: "dsm-workbuddy-diag-row",
8407
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8408
- className: "dsm-workbuddy-diag-label",
8409
- children: t("row.diagPool")
8410
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8411
- className: "dsm-workbuddy-diag-value",
8412
- children: status.pool?.enabled === true ? t("row.diagPoolOn", { count: status.pool.accounts.length }) : t("row.diagPoolOff")
8413
- })]
8414
- }),
8415
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8416
- className: "dsm-workbuddy-diag-row",
8417
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8418
- className: "dsm-workbuddy-diag-label",
8419
- children: t("row.diagFailures")
8420
- }), (() => {
8421
- const failures = [];
8422
- if (status.credentialRejected === true) failures.push(t("row.credentialRejectedTitle"));
8423
- if (status.refreshError !== void 0) failures.push(status.refreshError);
8424
- if (status.creditsError !== void 0) failures.push(status.creditsError);
8425
- return failures.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8426
- className: "dsm-workbuddy-diag-value",
8427
- children: t("row.diagNoFailures")
8428
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8429
- className: "dsm-workbuddy-diag-value dsm-workbuddy-diag-bad dsm-workbuddy-diag-mono",
8430
- children: failures.join(" · ")
8431
- });
8432
- })()]
8547
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8548
+ className: "dsm-workbuddy-usage-account-actions",
8549
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8550
+ type: "button",
8551
+ className: "dsm-btn dsm-btn-outline",
8552
+ disabled: busy,
8553
+ onClick: () => {
8554
+ rescanAccounts();
8555
+ },
8556
+ children: busy ? t("row.accountsScanning") : t("row.accountsRescan")
8433
8557
  })
8434
- ]
8435
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8436
- className: "dsm-workbuddy-diag-hint",
8437
- children: t("row.diagHint")
8438
- })] })
8439
- }),
8440
- status.status === "signed-out" && loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8441
- className: "dsm-workbuddy-usage-text",
8442
- role: "status",
8443
- children: t("row.accountsLoading")
8444
- }) : null,
8445
- status.status === "signed-out" && !loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
8446
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8447
- className: "dsm-workbuddy-usage-text",
8448
- children: signedOutText(notice, t)
8449
- }),
8450
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8451
- className: "dsm-workbuddy-usage-account-actions",
8452
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8453
- type: "button",
8454
- className: "dsm-btn dsm-btn-outline",
8455
- disabled: busy,
8456
- onClick: () => {
8457
- rescanAccounts();
8458
- },
8459
- children: busy ? t("row.accountsScanning") : t("row.accountsRescan")
8460
- })
8461
- }),
8462
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8463
- className: "dsm-workbuddy-pool-tools",
8464
- children: accountTools
8465
- }),
8466
- searched.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchedPaths, {
8467
- items: searched,
8468
- t
8558
+ }),
8559
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8560
+ className: "dsm-workbuddy-pool-tools",
8561
+ children: accountTools
8562
+ }),
8563
+ searched.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchedPaths, {
8564
+ items: searched,
8565
+ t
8566
+ }) : null
8567
+ ] }) : null,
8568
+ status.status === "error" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8569
+ className: "dsm-workbuddy-usage-error",
8570
+ children: status.message
8469
8571
  }) : null
8470
- ] }) : null,
8471
- status.status === "error" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8472
- className: "dsm-workbuddy-usage-error",
8473
- children: status.message
8474
- }) : null
8475
- ]
8572
+ ]
8573
+ })
8476
8574
  }) : null
8477
8575
  })]
8478
8576
  });
@@ -9524,8 +9622,18 @@ window.__ModuleLoader__.load({
9524
9622
  *
9525
9623
  * WHY THE HOST STILL OWNS THE NAME. The contract says to keep `model.name` as
9526
9624
  * the text and render the addition beside it, so this component returns the
9527
- * name first — it never replaces it, and it renders nothing at all for a
9528
- * provider that is not ours.
9625
+ * name first and never replaces it.
9626
+ *
9627
+ * FOR A PROVIDER THAT IS NOT OURS IT RENDERS THE PLAIN CATALOG NAME — not
9628
+ * nothing. The distinction is not cosmetic: this slot is `kind: "single"`, so
9629
+ * whatever registers becomes the cell's only occupant, and an occupant that
9630
+ * outputs plain text still occupies it. A previous version of this paragraph
9631
+ * said the component "renders nothing at all" for a foreign provider, which
9632
+ * made the lost-decoration cost look harmless; issue #138 is what that
9633
+ * mis-description looks like from the outside (the host's own 1017 badge
9634
+ * disappears on ITS rows while this plugin holds the cell). Returning `null`
9635
+ * would not free the cell either — occupancy is decided by registration, never
9636
+ * by what the component outputs.
9529
9637
  */
9530
9638
  /** The provider ids this plugin registers, and the region each one serves. */
9531
9639
  const PROVIDER_REGIONS = /* @__PURE__ */ new Map([["workbuddy", "cn"], ["workbuddy-global", "global"]]);
@@ -10219,6 +10327,9 @@ window.__ModuleLoader__.load({
10219
10327
  "row.diagPoolOff": "off",
10220
10328
  "row.diagFailures": "Last failure",
10221
10329
  "row.diagNoFailures": "Nothing reported.",
10330
+ "row.diagPromoUnreadable": "{count} promotion hour(s) unreadable — badge hidden",
10331
+ "row.cardCrashed": "The configuration area failed to render.",
10332
+ "row.cardCrashedHint": "The model provider itself is unaffected — chat and credits keep working. Quote the line above in a bug report.",
10222
10333
  "row.modelsTitle": "Models",
10223
10334
  "row.modelsSummary": "{count} enabled",
10224
10335
  "row.modelsDirty": "unsaved changes",
@@ -10631,6 +10742,9 @@ window.__ModuleLoader__.load({
10631
10742
  "row.diagPoolOff": "关闭",
10632
10743
  "row.diagFailures": "最近一次失败",
10633
10744
  "row.diagNoFailures": "没有报错。",
10745
+ "row.diagPromoUnreadable": "{count} 条活动时段读不懂 —— 徽标已隐藏",
10746
+ "row.cardCrashed": "配置区渲染失败。",
10747
+ "row.cardCrashedHint": "模型服务本身未受影响,对话与积分仍可用。反馈问题时请附上上面这行。",
10634
10748
  "row.modelsTitle": "模型",
10635
10749
  "row.modelsSummary": "已启用 {count} 个",
10636
10750
  "row.modelsDirty": "有未保存的修改",
@@ -11112,7 +11226,16 @@ window.__ModuleLoader__.load({
11112
11226
  *
11113
11227
  * See `MODEL_LABEL_PRIORITY` in `./WorkBuddyModelLabel.tsx` for the full
11114
11228
  * ordering, the measured evidence, and the deliberate absence of any
11115
- * inter-plugin coordination (project invariant, `docs/DESIGN.md` §六).
11229
+ * inter-plugin coordination (project invariant, `docs/DESIGN.md` §零).
11230
+ *
11231
+ * THE COST IS PAID ON ANOTHER PLUGIN'S ROWS, and it is worth stating where
11232
+ * the registration happens: holding this cell means the host's own
11233
+ * `dsh-client-ui-deepseek-model-label-1017` badge is NOT rendered on the
11234
+ * DeepSeek rows it was written for. That is not a defect and not something
11235
+ * to fix by inspecting the slot ledger — it is the price of §零, recorded in
11236
+ * `docs/DESIGN.md` and argued in the 5.8.2 CHANGELOG. Issue #138 is a user
11237
+ * meeting that price for the first time; the disposition is to state it
11238
+ * plainly rather than to coordinate at runtime.
11116
11239
  */
11117
11240
  const registerModelLabel = () => {
11118
11241
  try {