dsh-any-deepseek 0.0.36 → 0.0.37

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.
Files changed (2) hide show
  1. package/lib/client.js +29 -3
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -225,6 +225,29 @@ window.__ModuleLoader__.load({
225
225
  }
226
226
  }
227
227
  /**
228
+ * Load the channel list, but let a FAILURE be a failure.
229
+ *
230
+ * 🔴 Why this exists next to {@link fetchChannels} (2026-11-18): that one answers a dead route with
231
+ * an empty list, which is the right shape for the PANEL — an empty table is a truthful rendering of
232
+ * a deployment whose HTTP surface did not come up, and the user is looking right at it.
233
+ *
234
+ * For the sidebar's provider line it is the wrong shape. An empty response has no `current`, so
235
+ * `currentProviderLabel` returns `undefined` and the line DISAPPEARS. At the old 5-minute cadence
236
+ * that was a rare blink; the line now polls every 15 seconds, so silently accepting "no current"
237
+ * would turn one transient failure into the line vanishing ~5760 times a day — a 20× increase in
238
+ * exactly the defect this release is fixing (a line that misdescribes the live supplier).
239
+ *
240
+ * ⇒ Same route, opposite contract: this one rejects, so the caller can KEEP the last known name
241
+ * instead of replacing a true fact with silence.
242
+ * @returns the response, with `current` guaranteed present in the JSON shape we validate.
243
+ * @throws when the route is unreachable, non-200, or answers something that is not a channel list.
244
+ */
245
+ async function fetchChannelsStrict() {
246
+ const response = await fetch(`${BASE}/channels`, { headers: { accept: "application/json" } });
247
+ if (!response.ok) throw new Error(`/channels answered ${response.status}`);
248
+ return await response.json();
249
+ }
250
+ /**
228
251
  * Load aggregates.
229
252
  * @param group - `channel` for the per-relay table, `day` for the timeline.
230
253
  * @param from - inclusive ISO lower bound.
@@ -1683,8 +1706,11 @@ window.__ModuleLoader__.load({
1683
1706
  * and that is exactly how the sidebar came to name a supplier that had already been switched away
1684
1707
  * from: the selection is instantaneous, the usage figure is a daily cumulative.
1685
1708
  *
1686
- * ⚠️ Its failure is swallowed on purpose: a missing channel list must not blank the usage figure
1687
- * that did arrive (and vice versa — the two never overwrite each other's state).
1709
+ * ⚠️ **A failure keeps the last known name; it does not blank the line.** This is why the loader
1710
+ * is strict (`fetchChannelsStrict`) rather than the lenient `fetchChannels` the panel uses: that
1711
+ * one answers a dead route with an EMPTY list, which has no `current`, which renders as nothing.
1712
+ * At a 15-second cadence the lenient shape would make the line disappear thousands of times a day
1713
+ * — turning the fix into the same class of defect it was written to remove.
1688
1714
  */
1689
1715
  const readProvider = (0, react.useCallback)(async () => {
1690
1716
  try {
@@ -1817,7 +1843,7 @@ window.__ModuleLoader__.load({
1817
1843
  start.setHours(0, 0, 0, 0);
1818
1844
  return fetchStats("day", start.toISOString());
1819
1845
  },
1820
- loadChannels: () => fetchChannels()
1846
+ loadChannels: () => fetchChannelsStrict()
1821
1847
  })
1822
1848
  }, UsageBadge);
1823
1849
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-any-deepseek",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "description": "One DeepSeek V4.1 Flash provider for DeepSeek Harness: paste a key per channel, switch channels manually, token usage booked per real upstream.",
5
5
  "license": "MIT",
6
6
  "repository": {