dsh-any-deepseek 0.0.34 โ 0.0.36
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/adapter.d.ts +7 -7
- package/lib/client.js +90 -59
- package/lib/failover.d.ts +69 -82
- package/lib/http.d.ts +20 -11
- package/lib/index.js +126 -151
- package/lib/route.d.ts +20 -22
- package/package.json +1 -1
package/lib/adapter.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ import { type Api, type AssistantMessage, type AssistantMessageEvent, type Conte
|
|
|
30
30
|
import { openAICompletionsApi } from '@earendil-works/pi-ai/api/openai-completions.lazy';
|
|
31
31
|
import { type ChannelModality } from './presets.js';
|
|
32
32
|
import type { ResolvedChannel } from './channels.js';
|
|
33
|
-
import {
|
|
33
|
+
import { SupplyStatus } from './failover.js';
|
|
34
34
|
import type { LedgerEntry } from './usage-ledger.js';
|
|
35
35
|
/** The single provider route this plugin owns. */
|
|
36
36
|
export declare const PROVIDER_ID = "any-deepseek";
|
|
@@ -126,16 +126,16 @@ export interface AdapterDeps {
|
|
|
126
126
|
/** The configured selection: a channel id, or {@link SUPPLY_GROUP_ID}. */
|
|
127
127
|
current: () => string | undefined;
|
|
128
128
|
/**
|
|
129
|
-
* The supply group and
|
|
129
|
+
* The supply group: its ordered members and the display-only status recorder.
|
|
130
130
|
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
131
|
+
* ๐ด **`status` never feeds routing.** The owner's rule is "always start at member 1", so the
|
|
132
|
+
* status object only records what happened (who served, what switched) for the panel to explain.
|
|
133
|
+
* It is passed here rather than read from the group because the group's member list is the only
|
|
134
|
+
* input a routing decision is allowed to depend on.
|
|
135
135
|
*/
|
|
136
136
|
supply: () => {
|
|
137
137
|
members: readonly string[];
|
|
138
|
-
|
|
138
|
+
status: SupplyStatus;
|
|
139
139
|
};
|
|
140
140
|
/**
|
|
141
141
|
* Resolve a credential REFERENCE name to its value; undefined when unconfigured.
|
package/lib/client.js
CHANGED
|
@@ -30,7 +30,9 @@ window.__ModuleLoader__.load({
|
|
|
30
30
|
*
|
|
31
31
|
* Four states, kept distinct for the same reason the balance row does it:
|
|
32
32
|
* ยท `ไพๅบ็ป ยท ๅๅญ` when the group serves and its current member resolves;
|
|
33
|
-
* ยท
|
|
33
|
+
* ยท `ไพๅบ็ป ยท ๅ
จ้จไธๅฏ็จ` when the last request exhausted the list โ ๐ด a SEPARATE state, because
|
|
34
|
+
* without it the panel printed ใๆญฃๅจไฝฟ็จ๏ผCใ while nobody was serving;
|
|
35
|
+
* ยท `ไพๅบ็ป` alone when the group is selected but nothing has served yet;
|
|
34
36
|
* ยท a label when a channel is selected and found;
|
|
35
37
|
* ยท `undefined` when nothing is selected โ the caller renders nothing, because "no provider" is
|
|
36
38
|
* already visible as the model picker being unset and a red line here would be noise;
|
|
@@ -44,7 +46,9 @@ window.__ModuleLoader__.load({
|
|
|
44
46
|
const id = response.current;
|
|
45
47
|
if (id === void 0 || id === "") return void 0;
|
|
46
48
|
if (id === "__group__") {
|
|
47
|
-
const
|
|
49
|
+
const supply = response.supply;
|
|
50
|
+
if (supply?.exhausted === true) return "ไพๅบ็ป ยท ๅ
จ้จไธๅฏ็จ";
|
|
51
|
+
const serving = supply?.serving;
|
|
48
52
|
if (serving === void 0) return "ไพๅบ็ป";
|
|
49
53
|
const channel = response.channels.find((candidate) => candidate.id === serving);
|
|
50
54
|
return channel === void 0 ? "ไพๅบ็ป" : `ไพๅบ็ป ยท ${channel.label}`;
|
|
@@ -260,21 +264,6 @@ window.__ModuleLoader__.load({
|
|
|
260
264
|
}
|
|
261
265
|
}
|
|
262
266
|
/**
|
|
263
|
-
* Return the supply group to its first member.
|
|
264
|
-
*
|
|
265
|
-
* ๐ด The sticky cursor lives in the host's memory, so topping up the first relay is not enough to
|
|
266
|
-
* get back onto it โ this is the button that does it. POST because it mutates state that outlives
|
|
267
|
-
* the request (a prefetched GET would silently undo a fallback the user was relying on).
|
|
268
|
-
* @returns true when the host accepted the reset.
|
|
269
|
-
*/
|
|
270
|
-
async function resetSupplyGroup() {
|
|
271
|
-
try {
|
|
272
|
-
return (await fetch(`${BASE}/supply/reset`, { method: "POST" })).ok;
|
|
273
|
-
} catch {
|
|
274
|
-
return false;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
267
|
* Spend one real request to check a channel.
|
|
279
268
|
*
|
|
280
269
|
* This is the only panel action that costs tokens, which is why it is a button rather than
|
|
@@ -353,7 +342,7 @@ window.__ModuleLoader__.load({
|
|
|
353
342
|
}
|
|
354
343
|
//#endregion
|
|
355
344
|
//#region \0ad-css:src/client/SettingsPage
|
|
356
|
-
const css$1 = "/* Panel styles.\n *\n * ๐ด There are NO `--dsw-alias-*` design tokens on this host (measured 2026-10-21: the document\n * declares 29 custom properties and not one is a colour). This file used to reference a dozen of\n * them, every one falling back to a hardcoded LIGHT value (`rgba(0,0,0,0.12)` and friends) โ so\n * on the dark theme the borders and dividers were effectively invisible.\n *\n * โ Derive everything from `currentColor`, which the host sets per theme. `color-mix` gives the\n * low-contrast borders and fills that a token would have provided, and it follows the theme\n * automatically instead of assuming one palette.\n */\n\n.ad-page {\n display: flex;\n flex-direction: column;\n gap: 20px;\n padding: 4px 2px 12px;\n}\n\n/* One place to change the two theme-derived values the whole panel uses. */\n.ad-page {\n --ad-line: color-mix(in srgb, currentColor 18%, transparent);\n --ad-line-strong: color-mix(in srgb, currentColor 32%, transparent);\n --ad-fill-subtle: color-mix(in srgb, currentColor 7%, transparent);\n /*\n * ๐ด The ACTIVE channel is green (owner request 2026-10-25: ใๆฟๆดป็ๆ ทๅผ็จ็ปฟ่ฒใ).\n *\n * It used to be derived from `currentColor`, which made the live row look like every other\n * \"slightly emphasised\" row โ the same neutral tint as a hover or a selected input. Green says\n * \"this one is ON\" in a way a grey tint cannot, and it matches the key-configured dot and the\n * ๅฏ้ฅๅทฒ้
็ฝฎ text that were already green, so the panel now uses one colour for one meaning:\n * green = working / live. Red stays reserved for destructive and for failures.\n *\n * Kept as one token so the mark (border + bar + fill + badge) can never drift apart between\n * the four places it is applied.\n */\n --ad-active: #2f855a;\n --ad-active-fill: color-mix(in srgb, var(--ad-active) 12%, transparent);\n --ad-danger: #e5534b;\n}\n\n.ad-head {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.ad-title {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n}\n\n.ad-intro {\n margin: 0;\n font-size: 12px;\n line-height: 1.6;\n opacity: 0.72;\n}\n\n.ad-error {\n border: 1px solid var(--ad-danger);\n border-radius: 6px;\n padding: 8px 10px;\n font-size: 12px;\n}\n\n.ad-section {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n.ad-sectionTitle {\n margin: 0;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 0.04em;\n text-transform: uppercase;\n opacity: 0.6;\n}\n\n.ad-rows {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n/*\n * ๐ด Compact rows (owner request 2026-10-24: ใๆฏไธชๆธ ้้ซๅบฆๅธๆๅฐไธไบ๏ผ็ดงๅไบใ).\n *\n * The row used to be a four-line stack โ title / modelยทapiยทbaseURL / key line / balance โ and\n * with five channels that is most of the panel spent on air. The fix is layout, not information:\n * everything stays on screen, but the secondary facts move BESIDE the name instead of under it.\n *\n * What changed and why:\n * ยท padding 10pxโ7px and gap 6pxโ4px: the row now reads as one line of text plus a hairline of\n * metadata, instead of a card with its own interior spacing;\n * ยท `ad-rowMain` became a ROW (was a column): the title line and the meta line share one axis,\n * so the row is two text lines tall at most, not four;\n * ยท the meta line keeps `flex-wrap` โ on a narrow panel it may wrap, and that is the correct\n * trade: a row that stays readable beats one that clips the endpoint URL.\n */\n.ad-row {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n border: 1px solid var(--ad-line);\n border-radius: 8px;\n padding: 7px 10px;\n /*\n * The left edge is reserved on EVERY row so the current one does not shift its content when\n * selected โ a row that reindents on click makes the list feel like it moved.\n */\n border-left: 3px solid transparent;\n}\n\n/*\n * ๐ด The narrow-viewport layout: the action buttons get their own line.\n *\n * Measured on the owner's phone (2026-11-06 screenshot): 390px viewport, ~340px of content. Four\n * buttons at min-width 56px + 8px gaps need ~272px; together with a name column that cannot be\n * narrower than one word, they do not fit side by side. Below ~520px they now wrap below the\n * name instead of squeezing it into a vertical strip.\n *\n * Chosen as a media query rather than left to flex alone: without an explicit basis the group\n * wraps only when its CONTENT overflows, which leaves the name column at min-content width for a\n * long stretch before that happens โ the exact state the screenshot was taken in.\n */\n@media (max-width: 520px) {\n .ad-rowActions {\n flex-basis: 100%;\n }\n .ad-btn {\n flex: 1 1 auto;\n min-width: 0;\n }\n}\n\n/*\n * ๐ด The current channel is marked in GREEN (owner 2026-10-25: ใๆฟๆดป็ๆ ทๅผ็จ็ปฟ่ฒใ).\n *\n * Previously the marks were derived from `currentColor` โ a neutral bar, a stronger border and a\n * grey tint. All three were so low-contrast that the live row read as \"merely hovered\", which is\n * exactly what the owner was reacting to.\n *\n * Green is also the coherent choice: the key dot and ๅฏ้ฅๅทฒ้
็ฝฎ text were already green, so the\n * panel now uses ONE colour for ONE meaning (green = working / live), and red stays reserved for\n * destructive actions and failures.\n *\n * Four marks read from the same token so they cannot drift apart: left bar, border, fill, badge.\n */\n.ad-row-current {\n border-color: var(--ad-active);\n border-left-color: var(--ad-active);\n background: var(--ad-active-fill);\n}\n\n/* The ๅฝๅ badge is the textual confirmation, for when colour alone is not enough (colour-blind\n readers, screenshots, forced-colours mode). */\n.ad-row-current .ad-badge {\n border-color: var(--ad-active);\n color: var(--ad-active);\n opacity: 1;\n font-weight: 600;\n}\n\n/* The live row's NAME goes green too: the name is where the eye lands first, so marking only the\n border leaves the reader to connect two separate cues. */\n.ad-row-current .ad-rowTitle {\n color: var(--ad-active);\n}\n\n/*\n * The row's content is a COLUMN of at most two lines: (1) name + status, (2) everything else.\n * It was a four-line stack before the compactness pass โ see the note on `.ad-row`.\n */\n.ad-rowMain {\n display: flex;\n flex-direction: column;\n gap: 2px;\n min-width: 0;\n flex: 1 1 auto;\n}\n\n.ad-rowTitleLine {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 13px;\n font-weight: 500;\n min-width: 0;\n}\n\n.ad-rowTitle {\n white-space: nowrap;\n}\n\n.ad-badge {\n font-size: 10px;\n padding: 1px 6px;\n border-radius: 999px;\n border: 1px solid currentColor;\n opacity: 0.8;\n}\n\n.ad-warn {\n color: #b7791f;\n cursor: help;\n}\n\n/*\n * The live-state line under a channel's name: probe verdict and/or balance, nothing else.\n *\n * ๐ด It shrank twice at the owner's request, and the history matters:\n * 2026-10-24 ใ็ดงๅไบใ โ four stacked lines (endpoint identity / key state / verdict / balance)\n * became one wrapping line;\n * 2026-10-25 ใ่ฟ้จๅไธ่ฆไบใ โ endpoint identity and key state were removed outright. What\n * remains is only what changes at runtime: did the probe pass, what is\n * the balance. Those two cannot be derived from anything else on screen,\n * which is why they survived while model/api/baseURL did not.\n *\n * The element is rendered ONLY when one of them exists, so an unprobed, unpriced channel shows a\n * single-line row with no orphan gap.\n */\n.ad-rowDetail {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n column-gap: 6px;\n row-gap: 2px;\n font-size: 11px;\n opacity: 0.66;\n min-width: 0;\n}\n\n.ad-mono {\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n word-break: break-all;\n}\n\n.ad-sep {\n opacity: 0.5;\n}\n\n/*\n * ๐ด Every control that acts on a channel lives here โ and it MUST be allowed to shrink/wrap.\n *\n * This block is what made the panel unusable on a phone (owner 2026-11-06, screenshot from a\n * 390px-wide viewport). The row itself was already `flex-wrap: wrap`, so the actions SHOULD have\n * dropped to their own line; `flex-shrink: 0` here kept the group at its full intrinsic width\n * (~4 buttons โ 272px) inside a ~340px content box, and `.ad-rowMain` โ which then had only about\n * 60px left โ collapsed to its min-content width, printing `deepseek-v4.1-flash` and the balance\n * one fragment per line. Every control stayed on screen; none of them was readable.\n *\n * Three properties, each doing a different job:\n * ยท flex-basis 100% + the wrap rule below โ the group takes its own line on narrow screens;\n * ยท flex-wrap + no flex-shrink:0 โ it may wrap again rather than overflow if the width shrinks\n * further, and on a wide panel it stays on the title line exactly as before;\n * ยท it keeps `margin-left: auto` so that, once wrapped, the buttons stay right-aligned under the\n * row instead of drifting back under the name.\n */\n.ad-rowActions {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n margin-left: auto;\n min-width: 0;\n}\n\n/*\n * โโ the supply group row (owner 2026-11-12) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n *\n * ๐ด The group is a MEMBER OF THE CHANNEL RADIO GROUP that happens to be a container, and the\n * styling has to say both things at once:\n *\n * ยท it must read as a CHOICE (the same radio, the same current-row marks) โ owner's requirement\n * was ใ็ป็จๆทไพๅบ็ปๆฏไธ็ง้ๆฉ็ๆ่งใ, and the browser's radio semantics then guarantee the\n * thing he actually asked for: selecting the group unselects every channel below it;\n * ยท it must also read as a CONTAINER, because its members are edited and ordered here.\n *\n * Hence: same border/background language as `.ad-row`, but stacked (the member editor sits under\n * the title line) and with a muted \"explainer\" line so an unused feature still explains itself.\n */\n.ad-groupRow {\n /* A container, not a one-line row: the picker stays on top, the editor stacks beneath it. */\n flex-wrap: wrap;\n align-items: flex-start;\n}\n\n/* The member editor spans the full width under the picker, so member rows never wrap awkwardly. */\n.ad-groupEditor {\n flex-basis: 100%;\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding-top: 6px;\n margin-top: 2px;\n border-top: 1px dashed var(--ad-line);\n}\n\n.ad-groupCount {\n font-size: 11px;\n opacity: 0.6;\n}\n\n/* The live cursor and the last switch are state, not decoration โ they get the full-opacity\n treatment the balance row reserves for facts the reader cannot derive. */\n.ad-groupLive,\n.ad-groupSwitch {\n opacity: 1;\n font-size: 11px;\n}\n\n.ad-groupSwitch {\n color: #b7791f;\n}\n\n.ad-groupDangling {\n color: #c53030;\n opacity: 1;\n font-size: 11px;\n}\n\n.ad-groupMembers {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n/*\n * One member line: rank ยท name ยท โ โ ็งปๅบ.\n *\n * `min-width: 0` + `flex: 1` on the name is the same lesson as `.ad-rowMain`: without it a long\n * label refuses to shrink and pushes the buttons out of the panel (decision 82).\n */\n.ad-groupMember {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 4px 8px;\n border: 1px solid var(--ad-line);\n border-radius: 6px;\n border-left: 3px solid transparent;\n font-size: 12px;\n}\n\n/* The member currently serving gets the same green left bar as the live channel row, so \"which\n one is talking to the relay\" is one colour in one place. */\n.ad-groupMemberLive {\n border-left-color: var(--ad-active);\n}\n\n.ad-groupRank {\n flex: none;\n width: 18px;\n text-align: center;\n opacity: 0.55;\n font-variant-numeric: tabular-nums;\n}\n\n.ad-groupName {\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.ad-groupAdd {\n display: flex;\n align-items: center;\n gap: 6px;\n flex-wrap: wrap;\n}\n\n/* The select shares the panel's input look; it must be allowed to shrink on a narrow screen. */\n.ad-groupAdd .ad-input {\n flex: 1 1 120px;\n min-width: 0;\n}\n\n/*\n * Buttons: sized to be hit, not guessed at.\n *\n * The previous 4px/10px padding made a 22px-tall target, which is below the comfortable\n * threshold and made the row actions (ๆต่ฏ / ็งป้ค) look like text rather than controls. 6px/12px\n * with a minimum width gives each one a real box while keeping the row compact โ a row action is\n * secondary, so it should be easy to hit and easy to ignore.\n */\n.ad-btn {\n font-size: 11px;\n font-family: inherit;\n line-height: 1.5;\n padding: 5px 12px;\n min-width: 56px;\n min-height: 26px;\n border-radius: 6px;\n border: 1px solid var(--ad-line);\n background: transparent;\n color: inherit;\n cursor: pointer;\n transition: background-color 120ms ease, border-color 120ms ease, opacity 120ms ease;\n}\n\n.ad-btn:hover:not(:disabled) {\n border-color: var(--ad-line-strong);\n background: var(--ad-fill-subtle);\n}\n\n.ad-btn:disabled {\n opacity: 0.45;\n cursor: default;\n}\n\n.ad-btn-quiet {\n opacity: 0.85;\n}\n\n.ad-probe {\n font-size: 11px;\n padding-top: 2px;\n}\n\n.ad-probe-ok {\n color: #2f855a;\n}\n\n.ad-probe-bad {\n color: #c53030;\n word-break: break-word;\n}\n\n.ad-hint,\n.ad-empty,\n.ad-note {\n margin: 0;\n font-size: 11px;\n line-height: 1.6;\n opacity: 0.66;\n}\n\n.ad-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n flex-shrink: 0;\n display: inline-block;\n}\n\n.ad-dot-on {\n background: #2f855a;\n}\n\n.ad-dot-off {\n border: 1px solid currentColor;\n opacity: 0.5;\n}\n\n.ad-dot-unknown {\n background: linear-gradient(90deg, currentColor 50%, transparent 50%);\n opacity: 0.5;\n}\n\n/* The channel row is a radio \"pick\" zone: the whole left side is clickable, and the radio sits\n at the start of the line so \"which one is live\" is readable down a single column. */\n.ad-rowPick {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n flex: 1;\n min-width: 0;\n cursor: pointer;\n}\n\n.ad-rowPick input[type='radio'] {\n flex: none;\n /* Optically centred against the first text line rather than the row box. */\n margin-top: 3px;\n accent-color: var(--ad-line-strong);\n cursor: pointer;\n}\n\n/* The switch is gone: selection is the only axis (see `channels.ts`). Keeping the rules would\n invite someone to bring the second axis back. */\n\n/* โโ top-level tabs (ๆธ ้ / ็จ้) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */\n\n/*\n * The panel answers two questions asked at different moments: \"which relay serves me and does\n * its key work\" and \"what has each relay cost\". They used to be stacked on one scroll, so\n * reading the cost table meant scrolling past every channel row. As tabs, each answer gets the\n * whole panel and the reader never scrolls to reach the second one.\n *\n * The selected tab is marked by a bottom rule plus full opacity โ not by colour alone, because\n * this host ships no colour tokens and a colour-only cue would vary with the theme.\n */\n.ad-tabs {\n display: flex;\n gap: 4px;\n border-bottom: 1px solid var(--ad-line);\n}\n\n.ad-tab {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n /* Comfortable click target: 28px tall is enough to hit without aiming, and still compact\n enough that two tabs do not dominate the panel. */\n padding: 6px 14px;\n font-size: 12px;\n font-family: inherit;\n border: none;\n border-bottom: 2px solid transparent;\n /* Pulled down over the container's rule so the selected tab's underline replaces it. */\n margin-bottom: -1px;\n background: transparent;\n color: inherit;\n opacity: 0.62;\n cursor: pointer;\n}\n\n.ad-tab:hover {\n opacity: 0.85;\n}\n\n.ad-tab-on {\n opacity: 1;\n font-weight: 600;\n border-bottom-color: currentColor;\n}\n\n/* A count on the channel tab, so \"how many do I have\" is answered without opening it. */\n.ad-tabCount {\n font-size: 10px;\n font-weight: 500;\n min-width: 16px;\n padding: 0 4px;\n border-radius: 999px;\n text-align: center;\n background: var(--ad-fill-subtle);\n opacity: 0.8;\n}\n\n/* โโ segmented control (ๆๆธ ้ / ๆๅคฉ / ๅทๆฐ) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */\n\n/*\n * A segmented control rather than free-floating pill buttons: these three share one meaning\n * (\"how the table below is grouped, and re-read it\"), so they are drawn as one object. The\n * borders collapse to avoid double lines between neighbours.\n */\n.ad-segmented {\n display: inline-flex;\n align-items: stretch;\n border: 1px solid var(--ad-line);\n border-radius: 7px;\n overflow: hidden;\n}\n\n.ad-seg {\n padding: 4px 11px;\n font-size: 11px;\n font-family: inherit;\n border: none;\n border-right: 1px solid var(--ad-line);\n background: transparent;\n color: inherit;\n opacity: 0.7;\n cursor: pointer;\n}\n\n.ad-seg:last-child {\n border-right: none;\n}\n\n.ad-seg:hover:not(:disabled) {\n opacity: 1;\n background: var(--ad-fill-subtle);\n}\n\n.ad-seg-on {\n opacity: 1;\n font-weight: 600;\n background: var(--ad-fill-subtle);\n}\n\n/* Refresh is an action, not a grouping โ a gap separates it from the choice it refreshes. */\n.ad-seg-refresh {\n border-left: 1px solid var(--ad-line);\n}\n\n.ad-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 11px;\n}\n\n.ad-table th,\n.ad-table td {\n padding: 5px 8px;\n border-bottom: 1px solid var(--ad-line);\n text-align: left;\n}\n\n.ad-table th {\n font-weight: 500;\n opacity: 0.6;\n}\n\n.ad-num {\n text-align: right;\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n}\n\n.ad-total td {\n font-weight: 600;\n border-bottom: none;\n}\n\n/* โโ add-channel form โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */\n\n.ad-addForm {\n display: flex;\n flex-direction: column;\n gap: 14px;\n border: 1px dashed var(--ad-line);\n border-radius: 8px;\n padding: 14px;\n}\n\n.ad-field {\n display: flex;\n flex-direction: column;\n gap: 5px;\n font-size: 11px;\n}\n\n/* The label row: the field name, plus a required/optional marker that says which is which. */\n.ad-field > span:first-child {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 12px;\n font-weight: 500;\n opacity: 0.9;\n}\n\n/*\n * ๅฟ
้ / ๅฏ็ฉบ as a small marker rather than a sentence.\n *\n * The add form used to leave the reader guessing which fields could be skipped โ and the one\n * field that could not be skipped (the key) looked exactly like the two that could. The marker\n * is text, not colour, so it survives both themes and any colour-blindness.\n */\n.ad-req,\n.ad-opt {\n font-style: normal;\n font-size: 10px;\n font-weight: 400;\n padding: 1px 5px;\n border-radius: 4px;\n opacity: 0.7;\n}\n\n.ad-req {\n border: 1px solid var(--ad-line-strong);\n}\n\n.ad-opt {\n border: 1px dotted var(--ad-line);\n}\n\n/* Why this field exists, in one line โ printed under the control, not hidden in a tooltip. */\n.ad-fieldHelp {\n font-size: 11px;\n line-height: 1.55;\n opacity: 0.6;\n}\n\n.ad-input {\n font-size: 12px;\n font-family: inherit;\n /* 6px/9px keeps the control the same height as a `.ad-btn` (26px), so a field and its button\n on one line align without a per-case override. */\n padding: 5px 9px;\n min-height: 26px;\n border-radius: 6px;\n border: 1px solid var(--ad-line);\n background: transparent;\n color: inherit;\n}\n\n.ad-input:focus-visible {\n outline: 2px solid var(--ad-line-strong);\n outline-offset: 1px;\n border-color: var(--ad-line-strong);\n}\n\n/*\n * ๐ด A native `<select>` cannot be themed by leaving the background transparent.\n *\n * The popup list is drawn by the browser, not by the closed control's box: the options inherit\n * nothing from it, so `background: transparent` made them render in the platform default (light)\n * palette against this dark theme โ reported by the owner and measured on the real host.\n *\n * ๐ด SECOND correction (measured 2026-10-21): this file used `var(--dsw-alias-color-*, #fallback)`\n * throughout, and **none of those variables exist**. The host declares only 29 custom properties\n * in total and not one is a colour token, so every `var()` here was falling back โ and a fallback\n * that happens to be set inside a shorthand can be silently dropped (the select's background\n * computed to `rgba(0,0,0,0)`, i.e. still transparent, which is exactly the bug).\n *\n * โ Use only values this file controls, derived from `currentColor` (the host sets a light text\n * colour on both themes) plus explicit translucent layers. No host token is assumed.\n */\nselect.ad-input {\n /* Tells the engine which palette to use for the popup. This part DID work. */\n color-scheme: dark light;\n /*\n * Paint the closed box with a layer that follows the surrounding text colour, so it matches\n * whichever theme is active instead of hardcoding a dark value into a light theme.\n */\n background-color: color-mix(in srgb, currentColor 8%, transparent);\n color: inherit;\n cursor: pointer;\n padding-right: 22px;\n /* Room for the chevron drawn below, so text never runs under it. */\n appearance: none;\n background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),\n linear-gradient(135deg, currentColor 50%, transparent 50%);\n background-position: calc(100% - 12px) calc(50% + 1px), calc(100% - 8px) calc(50% + 1px);\n background-size: 4px 4px, 4px 4px;\n background-repeat: no-repeat;\n}\n\nselect.ad-input:hover:not(:disabled) {\n background-color: color-mix(in srgb, currentColor 14%, transparent);\n}\n\nselect.ad-input:focus-visible {\n outline: 2px solid currentColor;\n outline-offset: 1px;\n}\n\n/*\n * The popup itself follows `color-scheme`; these keep the option rows explicit for engines that\n * honour per-option colours. `color-scheme: dark` above is what actually stops the light-on-dark\n * list, because the popup is native chrome rather than a styled element.\n */\nselect.ad-input option {\n background-color: Canvas;\n color: CanvasText;\n}\n\n.ad-fieldError {\n margin: 0;\n font-size: 11px;\n color: #c53030;\n}\n\n/* โโ balance โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */\n\n/*\n * Remaining balance.\n *\n * A fact about this channel, not a control. The subtle fill marks it as a measurement rather than\n * a warning: the words themselves say whether it is fine (\"72.50 USD\") or not (\"๏ผไฝ้ขไธ่ถณ๏ผ\").\n */\n.ad-balance {\n font-variant-numeric: tabular-nums;\n font-size: 11px;\n padding: 1px 6px;\n border-radius: 4px;\n background: var(--ad-fill-subtle);\n}\n\n/* A section heading with one action on its right (currently: ๆฅ่ฏขไฝ้ข). */\n.ad-sectionBar {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 8px;\n}\n\n/* The reference name, not a secret: monospace so it lines up and misreads as a name, not a value. */\n.ad-keyName {\n font-size: 10px;\n padding: 1px 5px;\n border-radius: 4px;\n background: var(--ad-fill-subtle);\n opacity: 0.8;\n}\n\n/* A text-shaped action. Styled as a link because it opens an inline editor, not a dialog. */\n.ad-link {\n font-size: 11px;\n padding: 0;\n border: none;\n background: none;\n color: inherit;\n text-decoration: underline;\n text-underline-offset: 2px;\n opacity: 0.75;\n cursor: pointer;\n}\n\n.ad-link:hover {\n opacity: 1;\n}\n\n/* The inline key editor: one masked field and one button, on the same line as the fact above. */\n.ad-keyForm {\n display: flex;\n align-items: center;\n gap: 6px;\n padding-top: 4px;\n}\n\n.ad-keyForm .ad-input {\n flex: 1;\n min-width: 0;\n}\n\n/* A destructive action is quiet until hovered: it should be findable, not inviting. */\n.ad-btn-danger {\n opacity: 0.6;\n}\n\n.ad-btn-danger:hover:not(:disabled) {\n opacity: 1;\n border-color: var(--ad-danger);\n color: var(--ad-danger);\n}\n\n/*\n * The one hint that must not be skimmed past: where the key ends up.\n *\n * It carries a left rule and slightly higher opacity than an ordinary hint, because a reader who\n * skips it has been told something false by omission โ the key IS in the profile document.\n */\n.ad-hint-warn {\n padding: 8px 10px;\n border-left: 3px solid var(--ad-line-strong);\n background: var(--ad-fill-subtle);\n border-radius: 0 6px 6px 0;\n opacity: 0.82;\n}\n\n/*\n * The table can be wider than a narrow settings pane (ten columns of numbers). Scrolling it\n * inside its own box keeps the tab strip and the channel list reachable, instead of pushing the\n * whole panel sideways.\n */\n.ad-tableWrap {\n overflow-x: auto;\n /* A hint that there is more to the right, without a scrollbar competing with the borders. */\n scrollbar-width: thin;\n}\n\n.ad-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 11px;\n}\n\n/* The first column is a name, not a number: keep it from being squeezed by the numeric columns. */\n.ad-table th:first-child,\n.ad-table td:first-child {\n white-space: nowrap;\n padding-right: 14px;\n}\n\n/* โโ footer โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */\n\n/*\n * States what this thing is (MIT, open, improvable) and where it lives. A user deciding whether\n * to fork it or add a relay should not have to search for the source.\n */\n.ad-foot {\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n gap: 8px;\n padding-top: 10px;\n border-top: 1px solid var(--ad-line);\n font-size: 11px;\n opacity: 0.6;\n}\n\n.ad-footLink {\n color: inherit;\n text-decoration: underline;\n text-underline-offset: 2px;\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n font-size: 10px;\n}\n\n.ad-footLink:hover {\n opacity: 0.9;\n}\n";
|
|
345
|
+
const css$1 = "/* Panel styles.\n *\n * ๐ด There are NO `--dsw-alias-*` design tokens on this host (measured 2026-10-21: the document\n * declares 29 custom properties and not one is a colour). This file used to reference a dozen of\n * them, every one falling back to a hardcoded LIGHT value (`rgba(0,0,0,0.12)` and friends) โ so\n * on the dark theme the borders and dividers were effectively invisible.\n *\n * โ Derive everything from `currentColor`, which the host sets per theme. `color-mix` gives the\n * low-contrast borders and fills that a token would have provided, and it follows the theme\n * automatically instead of assuming one palette.\n */\n\n.ad-page {\n display: flex;\n flex-direction: column;\n gap: 20px;\n padding: 4px 2px 12px;\n}\n\n/* One place to change the two theme-derived values the whole panel uses. */\n.ad-page {\n --ad-line: color-mix(in srgb, currentColor 18%, transparent);\n --ad-line-strong: color-mix(in srgb, currentColor 32%, transparent);\n --ad-fill-subtle: color-mix(in srgb, currentColor 7%, transparent);\n /*\n * ๐ด The ACTIVE channel is green (owner request 2026-10-25: ใๆฟๆดป็ๆ ทๅผ็จ็ปฟ่ฒใ).\n *\n * It used to be derived from `currentColor`, which made the live row look like every other\n * \"slightly emphasised\" row โ the same neutral tint as a hover or a selected input. Green says\n * \"this one is ON\" in a way a grey tint cannot, and it matches the key-configured dot and the\n * ๅฏ้ฅๅทฒ้
็ฝฎ text that were already green, so the panel now uses one colour for one meaning:\n * green = working / live. Red stays reserved for destructive and for failures.\n *\n * Kept as one token so the mark (border + bar + fill + badge) can never drift apart between\n * the four places it is applied.\n */\n --ad-active: #2f855a;\n --ad-active-fill: color-mix(in srgb, var(--ad-active) 12%, transparent);\n --ad-danger: #e5534b;\n}\n\n.ad-head {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.ad-title {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n}\n\n.ad-intro {\n margin: 0;\n font-size: 12px;\n line-height: 1.6;\n opacity: 0.72;\n}\n\n.ad-error {\n border: 1px solid var(--ad-danger);\n border-radius: 6px;\n padding: 8px 10px;\n font-size: 12px;\n}\n\n.ad-section {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n.ad-sectionTitle {\n margin: 0;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 0.04em;\n text-transform: uppercase;\n opacity: 0.6;\n}\n\n.ad-rows {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n/*\n * ๐ด Compact rows (owner request 2026-10-24: ใๆฏไธชๆธ ้้ซๅบฆๅธๆๅฐไธไบ๏ผ็ดงๅไบใ).\n *\n * The row used to be a four-line stack โ title / modelยทapiยทbaseURL / key line / balance โ and\n * with five channels that is most of the panel spent on air. The fix is layout, not information:\n * everything stays on screen, but the secondary facts move BESIDE the name instead of under it.\n *\n * What changed and why:\n * ยท padding 10pxโ7px and gap 6pxโ4px: the row now reads as one line of text plus a hairline of\n * metadata, instead of a card with its own interior spacing;\n * ยท `ad-rowMain` became a ROW (was a column): the title line and the meta line share one axis,\n * so the row is two text lines tall at most, not four;\n * ยท the meta line keeps `flex-wrap` โ on a narrow panel it may wrap, and that is the correct\n * trade: a row that stays readable beats one that clips the endpoint URL.\n */\n.ad-row {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n border: 1px solid var(--ad-line);\n border-radius: 8px;\n padding: 7px 10px;\n /*\n * The left edge is reserved on EVERY row so the current one does not shift its content when\n * selected โ a row that reindents on click makes the list feel like it moved.\n */\n border-left: 3px solid transparent;\n}\n\n/*\n * ๐ด The narrow-viewport layout: the action buttons get their own line.\n *\n * Measured on the owner's phone (2026-11-06 screenshot): 390px viewport, ~340px of content. Four\n * buttons at min-width 56px + 8px gaps need ~272px; together with a name column that cannot be\n * narrower than one word, they do not fit side by side. Below ~520px they now wrap below the\n * name instead of squeezing it into a vertical strip.\n *\n * Chosen as a media query rather than left to flex alone: without an explicit basis the group\n * wraps only when its CONTENT overflows, which leaves the name column at min-content width for a\n * long stretch before that happens โ the exact state the screenshot was taken in.\n */\n@media (max-width: 520px) {\n .ad-rowActions {\n flex-basis: 100%;\n }\n .ad-btn {\n flex: 1 1 auto;\n min-width: 0;\n }\n}\n\n/*\n * ๐ด The current channel is marked in GREEN (owner 2026-10-25: ใๆฟๆดป็ๆ ทๅผ็จ็ปฟ่ฒใ).\n *\n * Previously the marks were derived from `currentColor` โ a neutral bar, a stronger border and a\n * grey tint. All three were so low-contrast that the live row read as \"merely hovered\", which is\n * exactly what the owner was reacting to.\n *\n * Green is also the coherent choice: the key dot and ๅฏ้ฅๅทฒ้
็ฝฎ text were already green, so the\n * panel now uses ONE colour for ONE meaning (green = working / live), and red stays reserved for\n * destructive actions and failures.\n *\n * Four marks read from the same token so they cannot drift apart: left bar, border, fill, badge.\n */\n.ad-row-current {\n border-color: var(--ad-active);\n border-left-color: var(--ad-active);\n background: var(--ad-active-fill);\n}\n\n/* The ๅฝๅ badge is the textual confirmation, for when colour alone is not enough (colour-blind\n readers, screenshots, forced-colours mode). */\n.ad-row-current .ad-badge {\n border-color: var(--ad-active);\n color: var(--ad-active);\n opacity: 1;\n font-weight: 600;\n}\n\n/* The live row's NAME goes green too: the name is where the eye lands first, so marking only the\n border leaves the reader to connect two separate cues. */\n.ad-row-current .ad-rowTitle {\n color: var(--ad-active);\n}\n\n/*\n * The row's content is a COLUMN of at most two lines: (1) name + status, (2) everything else.\n * It was a four-line stack before the compactness pass โ see the note on `.ad-row`.\n */\n.ad-rowMain {\n display: flex;\n flex-direction: column;\n gap: 2px;\n min-width: 0;\n flex: 1 1 auto;\n}\n\n.ad-rowTitleLine {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 13px;\n font-weight: 500;\n min-width: 0;\n}\n\n.ad-rowTitle {\n white-space: nowrap;\n}\n\n.ad-badge {\n font-size: 10px;\n padding: 1px 6px;\n border-radius: 999px;\n border: 1px solid currentColor;\n opacity: 0.8;\n}\n\n.ad-warn {\n color: #b7791f;\n cursor: help;\n}\n\n/*\n * The live-state line under a channel's name: probe verdict and/or balance, nothing else.\n *\n * ๐ด It shrank twice at the owner's request, and the history matters:\n * 2026-10-24 ใ็ดงๅไบใ โ four stacked lines (endpoint identity / key state / verdict / balance)\n * became one wrapping line;\n * 2026-10-25 ใ่ฟ้จๅไธ่ฆไบใ โ endpoint identity and key state were removed outright. What\n * remains is only what changes at runtime: did the probe pass, what is\n * the balance. Those two cannot be derived from anything else on screen,\n * which is why they survived while model/api/baseURL did not.\n *\n * The element is rendered ONLY when one of them exists, so an unprobed, unpriced channel shows a\n * single-line row with no orphan gap.\n */\n.ad-rowDetail {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n column-gap: 6px;\n row-gap: 2px;\n font-size: 11px;\n opacity: 0.66;\n min-width: 0;\n}\n\n.ad-mono {\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n word-break: break-all;\n}\n\n.ad-sep {\n opacity: 0.5;\n}\n\n/*\n * ๐ด Every control that acts on a channel lives here โ and it MUST be allowed to shrink/wrap.\n *\n * This block is what made the panel unusable on a phone (owner 2026-11-06, screenshot from a\n * 390px-wide viewport). The row itself was already `flex-wrap: wrap`, so the actions SHOULD have\n * dropped to their own line; `flex-shrink: 0` here kept the group at its full intrinsic width\n * (~4 buttons โ 272px) inside a ~340px content box, and `.ad-rowMain` โ which then had only about\n * 60px left โ collapsed to its min-content width, printing `deepseek-v4.1-flash` and the balance\n * one fragment per line. Every control stayed on screen; none of them was readable.\n *\n * Three properties, each doing a different job:\n * ยท flex-basis 100% + the wrap rule below โ the group takes its own line on narrow screens;\n * ยท flex-wrap + no flex-shrink:0 โ it may wrap again rather than overflow if the width shrinks\n * further, and on a wide panel it stays on the title line exactly as before;\n * ยท it keeps `margin-left: auto` so that, once wrapped, the buttons stay right-aligned under the\n * row instead of drifting back under the name.\n */\n.ad-rowActions {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n margin-left: auto;\n min-width: 0;\n}\n\n/*\n * โโ the supply group row (owner 2026-11-12) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n *\n * ๐ด The group is a MEMBER OF THE CHANNEL RADIO GROUP that happens to be a container, and the\n * styling has to say both things at once:\n *\n * ยท it must read as a CHOICE (the same radio, the same current-row marks) โ owner's requirement\n * was ใ็ป็จๆทไพๅบ็ปๆฏไธ็ง้ๆฉ็ๆ่งใ, and the browser's radio semantics then guarantee the\n * thing he actually asked for: selecting the group unselects every channel below it;\n * ยท it must also read as a CONTAINER, because its members are edited and ordered here.\n *\n * Hence: same border/background language as `.ad-row`, but stacked (the member editor sits under\n * the title line) and with a muted \"explainer\" line so an unused feature still explains itself.\n */\n.ad-groupRow {\n /* A container, not a one-line row: the picker stays on top, the editor stacks beneath it. */\n flex-wrap: wrap;\n align-items: flex-start;\n}\n\n/* The member editor spans the full width under the picker, so member rows never wrap awkwardly. */\n.ad-groupEditor {\n flex-basis: 100%;\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding-top: 6px;\n margin-top: 2px;\n border-top: 1px dashed var(--ad-line);\n}\n\n.ad-groupCount {\n font-size: 11px;\n opacity: 0.6;\n}\n\n/* The live reading and the last switch are state, not decoration โ they get the full-opacity\n treatment the balance row reserves for facts the reader cannot derive. */\n.ad-groupLive,\n.ad-groupSwitch {\n opacity: 1;\n font-size: 11px;\n}\n\n/* ๐ด ใๅ
จ็ปๅไธๅฏ็จใ must look like the failure it is, not like a status line. The balance table\n made the same distinction: a fact the reader must act on cannot share the muted styling of a\n fact they can ignore. */\n.ad-groupLiveBad {\n color: #c53030;\n}\n\n.ad-groupSwitch {\n color: #b7791f;\n}\n\n.ad-groupDangling {\n color: #c53030;\n opacity: 1;\n font-size: 11px;\n}\n\n.ad-groupMembers {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n/*\n * One member line: rank ยท name ยท โ โ ็งปๅบ.\n *\n * `min-width: 0` + `flex: 1` on the name is the same lesson as `.ad-rowMain`: without it a long\n * label refuses to shrink and pushes the buttons out of the panel (decision 82).\n */\n.ad-groupMember {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 4px 8px;\n border: 1px solid var(--ad-line);\n border-radius: 6px;\n border-left: 3px solid transparent;\n font-size: 12px;\n}\n\n/* The member currently serving gets the same green left bar as the live channel row, so \"which\n one is talking to the relay\" is one colour in one place. */\n.ad-groupMemberLive {\n border-left-color: var(--ad-active);\n}\n\n.ad-groupRank {\n flex: none;\n width: 18px;\n text-align: center;\n opacity: 0.55;\n font-variant-numeric: tabular-nums;\n}\n\n.ad-groupName {\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.ad-groupAdd {\n display: flex;\n align-items: center;\n gap: 6px;\n flex-wrap: wrap;\n}\n\n/* The select shares the panel's input look; it must be allowed to shrink on a narrow screen. */\n.ad-groupAdd .ad-input {\n flex: 1 1 120px;\n min-width: 0;\n}\n\n/*\n * Buttons: sized to be hit, not guessed at.\n *\n * The previous 4px/10px padding made a 22px-tall target, which is below the comfortable\n * threshold and made the row actions (ๆต่ฏ / ็งป้ค) look like text rather than controls. 6px/12px\n * with a minimum width gives each one a real box while keeping the row compact โ a row action is\n * secondary, so it should be easy to hit and easy to ignore.\n */\n.ad-btn {\n font-size: 11px;\n font-family: inherit;\n line-height: 1.5;\n padding: 5px 12px;\n min-width: 56px;\n min-height: 26px;\n border-radius: 6px;\n border: 1px solid var(--ad-line);\n background: transparent;\n color: inherit;\n cursor: pointer;\n transition: background-color 120ms ease, border-color 120ms ease, opacity 120ms ease;\n}\n\n.ad-btn:hover:not(:disabled) {\n border-color: var(--ad-line-strong);\n background: var(--ad-fill-subtle);\n}\n\n.ad-btn:disabled {\n opacity: 0.45;\n cursor: default;\n}\n\n.ad-btn-quiet {\n opacity: 0.85;\n}\n\n.ad-probe {\n font-size: 11px;\n padding-top: 2px;\n}\n\n.ad-probe-ok {\n color: #2f855a;\n}\n\n.ad-probe-bad {\n color: #c53030;\n word-break: break-word;\n}\n\n.ad-hint,\n.ad-empty,\n.ad-note {\n margin: 0;\n font-size: 11px;\n line-height: 1.6;\n opacity: 0.66;\n}\n\n.ad-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n flex-shrink: 0;\n display: inline-block;\n}\n\n.ad-dot-on {\n background: #2f855a;\n}\n\n.ad-dot-off {\n border: 1px solid currentColor;\n opacity: 0.5;\n}\n\n.ad-dot-unknown {\n background: linear-gradient(90deg, currentColor 50%, transparent 50%);\n opacity: 0.5;\n}\n\n/* The channel row is a radio \"pick\" zone: the whole left side is clickable, and the radio sits\n at the start of the line so \"which one is live\" is readable down a single column. */\n.ad-rowPick {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n flex: 1;\n min-width: 0;\n cursor: pointer;\n}\n\n.ad-rowPick input[type='radio'] {\n flex: none;\n /* Optically centred against the first text line rather than the row box. */\n margin-top: 3px;\n accent-color: var(--ad-line-strong);\n cursor: pointer;\n}\n\n/* The switch is gone: selection is the only axis (see `channels.ts`). Keeping the rules would\n invite someone to bring the second axis back. */\n\n/* โโ top-level tabs (ๆธ ้ / ็จ้) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */\n\n/*\n * The panel answers two questions asked at different moments: \"which relay serves me and does\n * its key work\" and \"what has each relay cost\". They used to be stacked on one scroll, so\n * reading the cost table meant scrolling past every channel row. As tabs, each answer gets the\n * whole panel and the reader never scrolls to reach the second one.\n *\n * The selected tab is marked by a bottom rule plus full opacity โ not by colour alone, because\n * this host ships no colour tokens and a colour-only cue would vary with the theme.\n */\n.ad-tabs {\n display: flex;\n gap: 4px;\n border-bottom: 1px solid var(--ad-line);\n}\n\n.ad-tab {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n /* Comfortable click target: 28px tall is enough to hit without aiming, and still compact\n enough that two tabs do not dominate the panel. */\n padding: 6px 14px;\n font-size: 12px;\n font-family: inherit;\n border: none;\n border-bottom: 2px solid transparent;\n /* Pulled down over the container's rule so the selected tab's underline replaces it. */\n margin-bottom: -1px;\n background: transparent;\n color: inherit;\n opacity: 0.62;\n cursor: pointer;\n}\n\n.ad-tab:hover {\n opacity: 0.85;\n}\n\n.ad-tab-on {\n opacity: 1;\n font-weight: 600;\n border-bottom-color: currentColor;\n}\n\n/* A count on the channel tab, so \"how many do I have\" is answered without opening it. */\n.ad-tabCount {\n font-size: 10px;\n font-weight: 500;\n min-width: 16px;\n padding: 0 4px;\n border-radius: 999px;\n text-align: center;\n background: var(--ad-fill-subtle);\n opacity: 0.8;\n}\n\n/* โโ segmented control (ๆๆธ ้ / ๆๅคฉ / ๅทๆฐ) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */\n\n/*\n * A segmented control rather than free-floating pill buttons: these three share one meaning\n * (\"how the table below is grouped, and re-read it\"), so they are drawn as one object. The\n * borders collapse to avoid double lines between neighbours.\n */\n.ad-segmented {\n display: inline-flex;\n align-items: stretch;\n border: 1px solid var(--ad-line);\n border-radius: 7px;\n overflow: hidden;\n}\n\n.ad-seg {\n padding: 4px 11px;\n font-size: 11px;\n font-family: inherit;\n border: none;\n border-right: 1px solid var(--ad-line);\n background: transparent;\n color: inherit;\n opacity: 0.7;\n cursor: pointer;\n}\n\n.ad-seg:last-child {\n border-right: none;\n}\n\n.ad-seg:hover:not(:disabled) {\n opacity: 1;\n background: var(--ad-fill-subtle);\n}\n\n.ad-seg-on {\n opacity: 1;\n font-weight: 600;\n background: var(--ad-fill-subtle);\n}\n\n/* Refresh is an action, not a grouping โ a gap separates it from the choice it refreshes. */\n.ad-seg-refresh {\n border-left: 1px solid var(--ad-line);\n}\n\n.ad-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 11px;\n}\n\n.ad-table th,\n.ad-table td {\n padding: 5px 8px;\n border-bottom: 1px solid var(--ad-line);\n text-align: left;\n}\n\n.ad-table th {\n font-weight: 500;\n opacity: 0.6;\n}\n\n.ad-num {\n text-align: right;\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n}\n\n.ad-total td {\n font-weight: 600;\n border-bottom: none;\n}\n\n/* โโ add-channel form โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */\n\n.ad-addForm {\n display: flex;\n flex-direction: column;\n gap: 14px;\n border: 1px dashed var(--ad-line);\n border-radius: 8px;\n padding: 14px;\n}\n\n.ad-field {\n display: flex;\n flex-direction: column;\n gap: 5px;\n font-size: 11px;\n}\n\n/* The label row: the field name, plus a required/optional marker that says which is which. */\n.ad-field > span:first-child {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 12px;\n font-weight: 500;\n opacity: 0.9;\n}\n\n/*\n * ๅฟ
้ / ๅฏ็ฉบ as a small marker rather than a sentence.\n *\n * The add form used to leave the reader guessing which fields could be skipped โ and the one\n * field that could not be skipped (the key) looked exactly like the two that could. The marker\n * is text, not colour, so it survives both themes and any colour-blindness.\n */\n.ad-req,\n.ad-opt {\n font-style: normal;\n font-size: 10px;\n font-weight: 400;\n padding: 1px 5px;\n border-radius: 4px;\n opacity: 0.7;\n}\n\n.ad-req {\n border: 1px solid var(--ad-line-strong);\n}\n\n.ad-opt {\n border: 1px dotted var(--ad-line);\n}\n\n/* Why this field exists, in one line โ printed under the control, not hidden in a tooltip. */\n.ad-fieldHelp {\n font-size: 11px;\n line-height: 1.55;\n opacity: 0.6;\n}\n\n.ad-input {\n font-size: 12px;\n font-family: inherit;\n /* 6px/9px keeps the control the same height as a `.ad-btn` (26px), so a field and its button\n on one line align without a per-case override. */\n padding: 5px 9px;\n min-height: 26px;\n border-radius: 6px;\n border: 1px solid var(--ad-line);\n background: transparent;\n color: inherit;\n}\n\n.ad-input:focus-visible {\n outline: 2px solid var(--ad-line-strong);\n outline-offset: 1px;\n border-color: var(--ad-line-strong);\n}\n\n/*\n * ๐ด A native `<select>` cannot be themed by leaving the background transparent.\n *\n * The popup list is drawn by the browser, not by the closed control's box: the options inherit\n * nothing from it, so `background: transparent` made them render in the platform default (light)\n * palette against this dark theme โ reported by the owner and measured on the real host.\n *\n * ๐ด SECOND correction (measured 2026-10-21): this file used `var(--dsw-alias-color-*, #fallback)`\n * throughout, and **none of those variables exist**. The host declares only 29 custom properties\n * in total and not one is a colour token, so every `var()` here was falling back โ and a fallback\n * that happens to be set inside a shorthand can be silently dropped (the select's background\n * computed to `rgba(0,0,0,0)`, i.e. still transparent, which is exactly the bug).\n *\n * โ Use only values this file controls, derived from `currentColor` (the host sets a light text\n * colour on both themes) plus explicit translucent layers. No host token is assumed.\n */\nselect.ad-input {\n /* Tells the engine which palette to use for the popup. This part DID work. */\n color-scheme: dark light;\n /*\n * Paint the closed box with a layer that follows the surrounding text colour, so it matches\n * whichever theme is active instead of hardcoding a dark value into a light theme.\n */\n background-color: color-mix(in srgb, currentColor 8%, transparent);\n color: inherit;\n cursor: pointer;\n padding-right: 22px;\n /* Room for the chevron drawn below, so text never runs under it. */\n appearance: none;\n background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),\n linear-gradient(135deg, currentColor 50%, transparent 50%);\n background-position: calc(100% - 12px) calc(50% + 1px), calc(100% - 8px) calc(50% + 1px);\n background-size: 4px 4px, 4px 4px;\n background-repeat: no-repeat;\n}\n\nselect.ad-input:hover:not(:disabled) {\n background-color: color-mix(in srgb, currentColor 14%, transparent);\n}\n\nselect.ad-input:focus-visible {\n outline: 2px solid currentColor;\n outline-offset: 1px;\n}\n\n/*\n * The popup itself follows `color-scheme`; these keep the option rows explicit for engines that\n * honour per-option colours. `color-scheme: dark` above is what actually stops the light-on-dark\n * list, because the popup is native chrome rather than a styled element.\n */\nselect.ad-input option {\n background-color: Canvas;\n color: CanvasText;\n}\n\n.ad-fieldError {\n margin: 0;\n font-size: 11px;\n color: #c53030;\n}\n\n/* โโ balance โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */\n\n/*\n * Remaining balance.\n *\n * A fact about this channel, not a control. The subtle fill marks it as a measurement rather than\n * a warning: the words themselves say whether it is fine (\"72.50 USD\") or not (\"๏ผไฝ้ขไธ่ถณ๏ผ\").\n */\n.ad-balance {\n font-variant-numeric: tabular-nums;\n font-size: 11px;\n padding: 1px 6px;\n border-radius: 4px;\n background: var(--ad-fill-subtle);\n}\n\n/* A section heading with one action on its right (currently: ๆฅ่ฏขไฝ้ข). */\n.ad-sectionBar {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 8px;\n}\n\n/* The reference name, not a secret: monospace so it lines up and misreads as a name, not a value. */\n.ad-keyName {\n font-size: 10px;\n padding: 1px 5px;\n border-radius: 4px;\n background: var(--ad-fill-subtle);\n opacity: 0.8;\n}\n\n/* A text-shaped action. Styled as a link because it opens an inline editor, not a dialog. */\n.ad-link {\n font-size: 11px;\n padding: 0;\n border: none;\n background: none;\n color: inherit;\n text-decoration: underline;\n text-underline-offset: 2px;\n opacity: 0.75;\n cursor: pointer;\n}\n\n.ad-link:hover {\n opacity: 1;\n}\n\n/* The inline key editor: one masked field and one button, on the same line as the fact above. */\n.ad-keyForm {\n display: flex;\n align-items: center;\n gap: 6px;\n padding-top: 4px;\n}\n\n.ad-keyForm .ad-input {\n flex: 1;\n min-width: 0;\n}\n\n/* A destructive action is quiet until hovered: it should be findable, not inviting. */\n.ad-btn-danger {\n opacity: 0.6;\n}\n\n.ad-btn-danger:hover:not(:disabled) {\n opacity: 1;\n border-color: var(--ad-danger);\n color: var(--ad-danger);\n}\n\n/*\n * The one hint that must not be skimmed past: where the key ends up.\n *\n * It carries a left rule and slightly higher opacity than an ordinary hint, because a reader who\n * skips it has been told something false by omission โ the key IS in the profile document.\n */\n.ad-hint-warn {\n padding: 8px 10px;\n border-left: 3px solid var(--ad-line-strong);\n background: var(--ad-fill-subtle);\n border-radius: 0 6px 6px 0;\n opacity: 0.82;\n}\n\n/*\n * The table can be wider than a narrow settings pane (ten columns of numbers). Scrolling it\n * inside its own box keeps the tab strip and the channel list reachable, instead of pushing the\n * whole panel sideways.\n */\n.ad-tableWrap {\n overflow-x: auto;\n /* A hint that there is more to the right, without a scrollbar competing with the borders. */\n scrollbar-width: thin;\n}\n\n.ad-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 11px;\n}\n\n/* The first column is a name, not a number: keep it from being squeezed by the numeric columns. */\n.ad-table th:first-child,\n.ad-table td:first-child {\n white-space: nowrap;\n padding-right: 14px;\n}\n\n/* โโ footer โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */\n\n/*\n * States what this thing is (MIT, open, improvable) and where it lives. A user deciding whether\n * to fork it or add a relay should not have to search for the source.\n */\n.ad-foot {\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n gap: 8px;\n padding-top: 10px;\n border-top: 1px solid var(--ad-line);\n font-size: 11px;\n opacity: 0.6;\n}\n\n.ad-footLink {\n color: inherit;\n text-decoration: underline;\n text-underline-offset: 2px;\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n font-size: 10px;\n}\n\n.ad-footLink:hover {\n opacity: 0.9;\n}\n";
|
|
357
346
|
if (typeof document !== "undefined" && document.querySelector("style[data-ad-css=\"SettingsPage\"]") === null) {
|
|
358
347
|
const tag = document.createElement("style");
|
|
359
348
|
tag.setAttribute("data-ad-css", "SettingsPage");
|
|
@@ -455,17 +444,18 @@ window.__ModuleLoader__.load({
|
|
|
455
444
|
const [verdict, setVerdict] = (0, react.useState)({});
|
|
456
445
|
const [error, setError] = (0, react.useState)(null);
|
|
457
446
|
/**
|
|
458
|
-
* The supply group's live state from `/channels` (members,
|
|
447
|
+
* The supply group's live state from `/channels` (members, who served last, last switch).
|
|
459
448
|
*
|
|
460
449
|
* ๐ด Kept SEPARATE from `rows` and from the settings document on purpose. `rows` is "what
|
|
461
450
|
* channels exist"; `supplyGroup.members` in the settings document is "what the user configured";
|
|
462
451
|
* this is "what the router is actually doing". The panel needs all three to explain a fallback
|
|
463
452
|
* ("member 1 ran out of quota, so requests now go to member 2") โ merge any two and the third
|
|
464
453
|
* question becomes unanswerable.
|
|
454
|
+
*
|
|
455
|
+
* โ ๏ธ There is no cursor and therefore no reset: every request starts at member 1 (owner rule
|
|
456
|
+
* 2026-11-12), so a position is derived from the priority list and never remembered.
|
|
465
457
|
*/
|
|
466
458
|
const [supply, setSupply] = (0, react.useState)(void 0);
|
|
467
|
-
/** Whether the balance-less "reset to first member" request is in flight. */
|
|
468
|
-
const [supplyResetting, setSupplyResetting] = (0, react.useState)(false);
|
|
469
459
|
/** Which channel id the group editor is offering to append (empty = picker closed). */
|
|
470
460
|
const [addingMember, setAddingMember] = (0, react.useState)("");
|
|
471
461
|
/** The "add a channel" form. Collapsed until asked for โ an empty panel is not a form. */
|
|
@@ -577,22 +567,6 @@ window.__ModuleLoader__.load({
|
|
|
577
567
|
const selectGroup = () => {
|
|
578
568
|
write(() => setField(["current"], SUPPLY_GROUP_ID), "ๅฏ็จไพๅบ็ปๅคฑ่ดฅ");
|
|
579
569
|
};
|
|
580
|
-
/** Clear the sticky cursor so the group starts from its first member again. */
|
|
581
|
-
const resetGroupCursor = async () => {
|
|
582
|
-
setSupplyResetting(true);
|
|
583
|
-
try {
|
|
584
|
-
if (!await resetSupplyGroup()) {
|
|
585
|
-
setError("้็ฝฎไพๅบ็ปๅคฑ่ดฅ๏ผๅฎฟไธปๆ็ปไบ่ฟไธช่ฏทๆฑ");
|
|
586
|
-
return;
|
|
587
|
-
}
|
|
588
|
-
setError(null);
|
|
589
|
-
await refresh();
|
|
590
|
-
} catch (cause) {
|
|
591
|
-
setError(`้็ฝฎไพๅบ็ปๅคฑ่ดฅ๏ผ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
592
|
-
} finally {
|
|
593
|
-
setSupplyResetting(false);
|
|
594
|
-
}
|
|
595
|
-
};
|
|
596
570
|
/**
|
|
597
571
|
* Run one settings write and surface a refusal.
|
|
598
572
|
*
|
|
@@ -851,9 +825,17 @@ window.__ModuleLoader__.load({
|
|
|
851
825
|
}),
|
|
852
826
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
853
827
|
className: "ad-rowDetail",
|
|
854
|
-
children: "
|
|
828
|
+
children: "ๆไธ้ข็้กบๅบไฝฟ็จ๏ผๆฏๆฌก่ฏทๆฑ้ฝไป็ฌฌ 1 ไฝๅผๅง่ฏ๏ผ้ๅฐไฝ้ขไธ่ถณๆๅฏ้ฅๅคฑๆๆๆขไธไธไฝ"
|
|
855
829
|
}),
|
|
856
|
-
groupSelected && supply
|
|
830
|
+
groupSelected && supply?.exhausted === true && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
831
|
+
className: "ad-rowDetail ad-groupLive ad-groupLiveBad",
|
|
832
|
+
children: [
|
|
833
|
+
"ๅ
จ็ปๅไธๅฏ็จ๏ผๆๅไธไธช่ฏ็ๆฏ",
|
|
834
|
+
supply.lastTried === void 0 ? "โ" : rows.find((row) => row.id === supply.lastTried)?.label ?? supply.lastTried,
|
|
835
|
+
"๏ผ"
|
|
836
|
+
]
|
|
837
|
+
}),
|
|
838
|
+
groupSelected && supply?.exhausted !== true && supply?.serving !== void 0 && supply.position >= 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
857
839
|
className: "ad-rowDetail ad-groupLive",
|
|
858
840
|
children: [
|
|
859
841
|
"ๆญฃๅจไฝฟ็จ๏ผ",
|
|
@@ -965,17 +947,7 @@ window.__ModuleLoader__.load({
|
|
|
965
947
|
children: "ๅ ่ฟๆฅ"
|
|
966
948
|
})]
|
|
967
949
|
});
|
|
968
|
-
})()
|
|
969
|
-
groupSelected && members.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
970
|
-
type: "button",
|
|
971
|
-
className: "ad-link",
|
|
972
|
-
disabled: supplyResetting,
|
|
973
|
-
title: "ๆไธไธไธช่ฏทๆฑ้ๆฐไป็ฌฌ 1 ไฝๅผๅง๏ผๅ
ๅผๅๆณ้ฉฌไธ็จๅ็ฌฌไธไธชๆถๆๆไน๏ผ",
|
|
974
|
-
onClick: () => {
|
|
975
|
-
resetGroupCursor();
|
|
976
|
-
},
|
|
977
|
-
children: supplyResetting ? "้็ฝฎไธญโฆ" : "ไป็ฌฌ 1 ไฝ้ๆฐๅผๅง"
|
|
978
|
-
})
|
|
950
|
+
})()
|
|
979
951
|
]
|
|
980
952
|
})]
|
|
981
953
|
}), rows.map((row) => {
|
|
@@ -1601,6 +1573,26 @@ window.__ModuleLoader__.load({
|
|
|
1601
1573
|
*/
|
|
1602
1574
|
const USAGE_BADGE_REFRESH_MS = 3e5;
|
|
1603
1575
|
/**
|
|
1576
|
+
* Refresh cadence for the PROVIDER line: **fifteen seconds**.
|
|
1577
|
+
*
|
|
1578
|
+
* ๐ด Owner report (2026-11-18): ใๆ่ฎพๅฎไธ็จไพๅบ็ปไธ็ๆไบๅฅฝๅใ โ the switch HAD taken effect (the ledger
|
|
1579
|
+
* proved it: within a minute the requests were all on the newly chosen channel), but this line still
|
|
1580
|
+
* named the old supplier, because it shares the 5-minute refresh above.
|
|
1581
|
+
*
|
|
1582
|
+
* โ ๏ธ **Why the two facts cannot share one cadence, stated as the reason the numbers differ**: the
|
|
1583
|
+
* usage figure is expensive โ `/stats` reads the whole month's ledger files โ and it is a DAILY
|
|
1584
|
+
* cumulative, so a five-minute lag changes it by a rounding error. The provider name is cheap โ one
|
|
1585
|
+
* `/channels` read, no ledger โ and it is instantaneous: the moment it is wrong, the reader believes
|
|
1586
|
+
* their selection did not apply, which is exactly what happened.
|
|
1587
|
+
*
|
|
1588
|
+
* โ Two facts, two costs, two cadences. Coupling them was the bug; unifying them would only move it.
|
|
1589
|
+
*
|
|
1590
|
+
* ๐ **Residual staleness: up to 15 seconds, and it is real.** Not "instant": say what is true. A
|
|
1591
|
+
* focus / tab-switch also triggers an immediate read, which covers the common "I just changed it,
|
|
1592
|
+
* let me look at the corner" path.
|
|
1593
|
+
*/
|
|
1594
|
+
const PROVIDER_REFRESH_MS = 15e3;
|
|
1595
|
+
/**
|
|
1604
1596
|
* The visible label, in words, so the number is not ambiguous.
|
|
1605
1597
|
*
|
|
1606
1598
|
* ๐ด Owner asked for this on 2026-11-01 ("ๆพ็คบ็ๅ
ๅฎนๅคๅ ไธชๅญ๏ผๆณจๆๆฏไปๆฅ token ๆถ่"): a bare
|
|
@@ -1664,12 +1656,9 @@ window.__ModuleLoader__.load({
|
|
|
1664
1656
|
const [day, setDay] = (0, react.useState)(() => localDayKey());
|
|
1665
1657
|
const [channels, setChannels] = (0, react.useState)(void 0);
|
|
1666
1658
|
const alive = (0, react.useRef)(true);
|
|
1667
|
-
/** One read of
|
|
1659
|
+
/** One read of the usage figure. Failures land in `failed`, never in `value`. */
|
|
1668
1660
|
const read = (0, react.useCallback)(async () => {
|
|
1669
1661
|
const today = localDayKey();
|
|
1670
|
-
loadChannels().then((response) => {
|
|
1671
|
-
if (alive.current) setChannels(response);
|
|
1672
|
-
}).catch(() => void 0);
|
|
1673
1662
|
try {
|
|
1674
1663
|
const stats = await loadToday();
|
|
1675
1664
|
if (!alive.current) return;
|
|
@@ -1686,18 +1675,60 @@ window.__ModuleLoader__.load({
|
|
|
1686
1675
|
if (!alive.current) return;
|
|
1687
1676
|
setFailed(true);
|
|
1688
1677
|
}
|
|
1689
|
-
}, [loadToday
|
|
1678
|
+
}, [loadToday]);
|
|
1679
|
+
/**
|
|
1680
|
+
* One read of the PROVIDER line, on its own faster cadence.
|
|
1681
|
+
*
|
|
1682
|
+
* ๐ด Split from {@link read} on 2026-11-18 (owner report). The two facts used to share one timer
|
|
1683
|
+
* and that is exactly how the sidebar came to name a supplier that had already been switched away
|
|
1684
|
+
* from: the selection is instantaneous, the usage figure is a daily cumulative.
|
|
1685
|
+
*
|
|
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).
|
|
1688
|
+
*/
|
|
1689
|
+
const readProvider = (0, react.useCallback)(async () => {
|
|
1690
|
+
try {
|
|
1691
|
+
const response = await loadChannels();
|
|
1692
|
+
if (alive.current) setChannels(response);
|
|
1693
|
+
} catch {}
|
|
1694
|
+
}, [loadChannels]);
|
|
1690
1695
|
(0, react.useEffect)(() => {
|
|
1691
1696
|
alive.current = true;
|
|
1692
1697
|
read();
|
|
1693
|
-
|
|
1698
|
+
readProvider();
|
|
1699
|
+
const usageTimer = setInterval(() => {
|
|
1694
1700
|
read();
|
|
1695
1701
|
}, USAGE_BADGE_REFRESH_MS);
|
|
1702
|
+
const providerTimer = setInterval(() => {
|
|
1703
|
+
readProvider();
|
|
1704
|
+
}, PROVIDER_REFRESH_MS);
|
|
1696
1705
|
return () => {
|
|
1697
1706
|
alive.current = false;
|
|
1698
|
-
clearInterval(
|
|
1707
|
+
clearInterval(usageTimer);
|
|
1708
|
+
clearInterval(providerTimer);
|
|
1709
|
+
};
|
|
1710
|
+
}, [read, readProvider]);
|
|
1711
|
+
/**
|
|
1712
|
+
* Re-read the provider the moment the tab regains attention.
|
|
1713
|
+
*
|
|
1714
|
+
* ๐ This is the path that actually covers the owner's workflow: switch the channel in Settings,
|
|
1715
|
+
* come back to the conversation, glance at the corner. Waiting up to 15 seconds for a timer would
|
|
1716
|
+
* still look like "the switch did not take" โ the same misreading, just shorter.
|
|
1717
|
+
*
|
|
1718
|
+
* โ ๏ธ It refreshes the PROVIDER only. Re-reading the ledger on every focus would turn a cosmetic
|
|
1719
|
+
* seat into a file-reading poll driven by the user's tab switching.
|
|
1720
|
+
*/
|
|
1721
|
+
(0, react.useEffect)(() => {
|
|
1722
|
+
const onVisible = () => {
|
|
1723
|
+
if (document.visibilityState === "visible") readProvider();
|
|
1724
|
+
};
|
|
1725
|
+
document.addEventListener("visibilitychange", onVisible);
|
|
1726
|
+
window.addEventListener("focus", onVisible);
|
|
1727
|
+
return () => {
|
|
1728
|
+
document.removeEventListener("visibilitychange", onVisible);
|
|
1729
|
+
window.removeEventListener("focus", onVisible);
|
|
1699
1730
|
};
|
|
1700
|
-
}, [
|
|
1731
|
+
}, [readProvider]);
|
|
1701
1732
|
const state = badgeState(value, failed);
|
|
1702
1733
|
/**
|
|
1703
1734
|
* The provider line, or nothing.
|
|
@@ -1735,7 +1766,7 @@ window.__ModuleLoader__.load({
|
|
|
1735
1766
|
]
|
|
1736
1767
|
}), provider === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1737
1768
|
className: "ad-usageRow ad-providerRow",
|
|
1738
|
-
title: "
|
|
1769
|
+
title: "ๅฝๅไพๅบๅ๏ผ่ฏทๆฑๆญฃๅจ่ตฐ็้ฃไธชๆธ ้๏ผใๆๅค 15 ็งๅปถ่ฟ๏ผๅๆขๆธ ้ๅๅๅฐๆฌ็ชๅฃไผ็ซๅป้่ฏปใ",
|
|
1739
1770
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1740
1771
|
className: "ad-usageDot ad-providerDot",
|
|
1741
1772
|
"aria-hidden": "true"
|
package/lib/failover.d.ts
CHANGED
|
@@ -1,47 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* failover.ts โ when the supply group moves
|
|
2
|
+
* failover.ts โ when the supply group moves on, and what it remembers.
|
|
3
3
|
*
|
|
4
|
-
* ## The
|
|
4
|
+
* ## The routing rule is deliberately the simplest one that works
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* dispatch loop where it would be invisible and untestable in isolation.
|
|
6
|
+
* Owner decision 2026-11-12 (revising the first cut, which used a sticky cursor):
|
|
7
|
+
* ใไพๅบ็ป้็ๅฐฑๆไผๅ
็บงๆฅ๏ผๆฏๆฌกๅๆข้ฝไป 1~n ่ฟไธ้ไฝฟ็จ้ฆไธช่ฝ็จ็ใ.
|
|
9
8
|
*
|
|
10
|
-
*
|
|
9
|
+
* โ **Every request starts at member 1 and walks 1โฆn, using the first that works.** Position is
|
|
10
|
+
* never remembered for routing; the configured order IS the priority, with no exceptions and no
|
|
11
|
+
* hidden state to reason about.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
* **cold prompt cache** for the conversation. Switching for a transient fault therefore makes
|
|
14
|
-
* things worse, because the retry layer (`providerRetryPolicy`, 100 attempts) is already the right
|
|
15
|
-
* instrument for "this attempt happened to fail".
|
|
13
|
+
* ## What that costs, stated plainly
|
|
16
14
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* While member 1 is out of quota, every request pays one wasted round-trip to it before reaching
|
|
16
|
+
* the first usable member. The first cut avoided that with a sticky cursor, and the trade was
|
|
17
|
+
* rejected on purpose: a cursor makes "which member serves?" depend on history, so topping up
|
|
18
|
+
* member 1 did not put it back into use until something reset the cursor โ and the recovery was
|
|
19
|
+
* invisible. One fast 402 per call is a cheaper price than a priority order that silently stops
|
|
20
|
+
* being the priority order.
|
|
19
21
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* | `QUOTA`, `ACCOUNT_QUOTA` | โ
| the balance is gone; every later attempt fails identically |
|
|
23
|
-
* | `AUTH` | โ
| the key was rejected; it will be rejected again |
|
|
24
|
-
* | `INVALID_CREDENTIAL` | โ
| malformed key, structurally unfixable at request time |
|
|
25
|
-
* | `MISSING_CREDENTIAL` | โ
| this channel has no key at all โ it cannot serve, ever |
|
|
26
|
-
* | `RATE_LIMIT` | โ | transient by definition; retry is the correct instrument |
|
|
27
|
-
* | `SERVER`, `TIMEOUT`, `TRANSPORT`, `STREAM_CLOSED` | โ | transient; see above |
|
|
28
|
-
* | `CONTEXT_WINDOW_EXCEEDED` | โ **never** | see the note below |
|
|
29
|
-
* | `ABORTED` | โ | the caller cancelled; switching would ignore their intent |
|
|
22
|
+
* โ ๏ธ Measured scale of that cost: a quota refusal returns without generating, so it costs no
|
|
23
|
+
* tokens and is bounded by one HTTP round-trip. It is not a re-prompt of the conversation.
|
|
30
24
|
*
|
|
31
|
-
*
|
|
32
|
-
* exclusion.** Two independent reasons:
|
|
25
|
+
* ## What is still remembered โ for DISPLAY only
|
|
33
26
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* 2. **It is dangerous.** The harness treats that code as proof of a real overflow and answers
|
|
38
|
-
* with the destructive recovery path (`compactIfNeeded(โฆ, 'context-overflow')`, whole range,
|
|
39
|
-
* retain=0, threshold skipped โ the 0.0.32 incident). Switching on it turns one error into
|
|
40
|
-
* repeated trips through a path that deletes conversation history.
|
|
41
|
-
*
|
|
42
|
-
* Anything not listed is treated as non-switching, which is the safe default: an unknown code is
|
|
43
|
-
* an unknown cause, and guessing "this relay is broken" on an unknown cause is how a healthy
|
|
44
|
-
* supplier gets cycled out during a blip.
|
|
27
|
+
* The panel still needs to answer ใ็ฐๅจๅจ็จ่ฐ๏ผๅๆๆขไบ่ฐ๏ผไธบไปไนๆขใ, and those are facts about what
|
|
28
|
+
* happened, not inputs to what happens next. They live in {@link SupplyStatus}, which the routing
|
|
29
|
+
* path writes and never reads.
|
|
45
30
|
*/
|
|
46
31
|
/**
|
|
47
32
|
* Whether a failed attempt justifies moving to the next group member.
|
|
@@ -80,60 +65,62 @@ export interface SwitchDecisionInput {
|
|
|
80
65
|
* @returns true only when a switch is both useful and safe.
|
|
81
66
|
*/
|
|
82
67
|
export declare function canSwitchAttempt(input: SwitchDecisionInput): boolean;
|
|
68
|
+
/** The most recent switch, for the panel to explain what happened. */
|
|
69
|
+
export interface SupplySwitch {
|
|
70
|
+
from: string;
|
|
71
|
+
to: string;
|
|
72
|
+
code: string;
|
|
73
|
+
atMs: number;
|
|
74
|
+
}
|
|
83
75
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* ## Why sticky rather than "always start at member 0"
|
|
87
|
-
*
|
|
88
|
-
* The group exists because a member runs out of balance. Once that happens, member 0 stays
|
|
89
|
-
* exhausted for hours or days โ so re-trying it before every single request costs one wasted
|
|
90
|
-
* round-trip and one cache invalidation per request, forever. The cursor records "we already know
|
|
91
|
-
* member 0 is dead" and starts after it.
|
|
92
|
-
*
|
|
93
|
-
* ## Why it lives in memory and is NOT persisted
|
|
76
|
+
* What the last request did, for the panel only.
|
|
94
77
|
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* the
|
|
99
|
-
*
|
|
100
|
-
* ## What invalidates it
|
|
101
|
-
*
|
|
102
|
-
* The member list itself. If the user adds, removes or reorders members, the old index no longer
|
|
103
|
-
* refers to the same channel, so it is reset to 0. This is keyed on the member list's identity
|
|
104
|
-
* (joined string), not on a counter โ the cursor cannot silently point at a different channel.
|
|
78
|
+
* ๐ด **Nothing here is an input to routing.** The owner's rule is "always start at 1", so a value
|
|
79
|
+
* in this class can never change which member serves the next request โ that is the whole point of
|
|
80
|
+
* replacing the sticky cursor. If a future edit starts reading `serving` to choose a starting
|
|
81
|
+
* index, the priority order has quietly become history-dependent again.
|
|
105
82
|
*/
|
|
106
|
-
export declare class
|
|
107
|
-
/** The member
|
|
83
|
+
export declare class SupplyStatus {
|
|
84
|
+
/** The member that last served successfully. */
|
|
85
|
+
private servedId;
|
|
86
|
+
/** The last switch, if any since the process started (or since the group was re-read). */
|
|
87
|
+
private switchRecord;
|
|
88
|
+
/** Whether the most recent request found no usable member at all. */
|
|
89
|
+
private exhausted;
|
|
90
|
+
/** The member the most recent failed request gave up on. */
|
|
91
|
+
private lastTriedId;
|
|
92
|
+
/** The member list these readings belong to; a change discards them. */
|
|
108
93
|
private signature;
|
|
109
|
-
/** Zero-based index of the member to start from. */
|
|
110
|
-
private position;
|
|
111
|
-
/** The last switch, for the panel to explain what happened. */
|
|
112
|
-
private lastSwitch;
|
|
113
94
|
/**
|
|
114
|
-
*
|
|
95
|
+
* Bind the readings to one member list, discarding them when the list changes.
|
|
96
|
+
*
|
|
97
|
+
* Keyed on the list's content, not on a counter: after the user adds, removes or reorders
|
|
98
|
+
* members, "the member that last served" may no longer exist, and a stale name in the panel is
|
|
99
|
+
* worse than a blank line.
|
|
115
100
|
* @param members - the configured ordered member ids.
|
|
116
|
-
* @returns the zero-based starting index.
|
|
117
101
|
*/
|
|
118
|
-
|
|
102
|
+
bind(members: readonly string[]): void;
|
|
103
|
+
/** Record that `id` served this request successfully. */
|
|
104
|
+
noteServed(id: string): void;
|
|
105
|
+
/** Record one move from a member that could not serve to the one tried next. */
|
|
106
|
+
noteSwitch(from: string, to: string, code: string, atMs: number): void;
|
|
119
107
|
/**
|
|
120
|
-
* Record that
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
108
|
+
* Record that a request ended without a serving member.
|
|
109
|
+
*
|
|
110
|
+
* ๐ด `exhausted` is NOT the same as "the request failed". A request that fails on member 1 of 4
|
|
111
|
+
* with an error the group cannot switch on (a mid-stream error, a SERVER error) has failed, but
|
|
112
|
+
* the group is not out of members โ rendering ใๅ
จ็ปๅไธๅฏ็จใ then would be a false alarm that
|
|
113
|
+
* hides a healthy member 2..4. Only walking off the END of the list earns the exhausted flag.
|
|
114
|
+
* @param lastTried - the final member attempted, so the panel can name it.
|
|
115
|
+
* @param exhausted - whether the list ran out (true) or the request failed with members left.
|
|
126
116
|
*/
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
|
|
130
|
-
/** The most recent switch, or undefined when
|
|
131
|
-
get
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
} | undefined;
|
|
137
|
-
/** The current zero-based position, for the panel's readout. */
|
|
138
|
-
get index(): number;
|
|
117
|
+
noteFailure(lastTried: string | undefined, exhausted: boolean): void;
|
|
118
|
+
/** The member that last served, or undefined when nothing has served yet / the last request failed. */
|
|
119
|
+
get serving(): string | undefined;
|
|
120
|
+
/** The most recent switch, or undefined when none has happened. */
|
|
121
|
+
get lastSwitch(): SupplySwitch | undefined;
|
|
122
|
+
/** Whether the most recent request found no usable member. */
|
|
123
|
+
get isExhausted(): boolean;
|
|
124
|
+
/** The member the last failed request gave up on; undefined when that request succeeded. */
|
|
125
|
+
get lastTried(): string | undefined;
|
|
139
126
|
}
|
package/lib/http.d.ts
CHANGED
|
@@ -53,12 +53,15 @@ export interface RouteDeps {
|
|
|
53
53
|
*/
|
|
54
54
|
current?: () => string | undefined;
|
|
55
55
|
/**
|
|
56
|
-
* The supply group
|
|
56
|
+
* The supply group, as the panel needs it.
|
|
57
57
|
*
|
|
58
|
-
* ๐ด Read from the RUNTIME, not from the settings document. `members` exists in both, but
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
58
|
+
* ๐ด Read from the RUNTIME, not from the settings document. `members` exists in both, but
|
|
59
|
+
* `serving` / `lastSwitch` / `exhausted` describe what the ROUTER has actually done โ the panel
|
|
60
|
+
* needs them to say ใ็ฐๅจๅจ็จ่ฐ๏ผๅๆๆขไบ่ฐ๏ผไธบไปไนๆขใ.
|
|
61
|
+
*
|
|
62
|
+
* โ ๏ธ **None of these is routing input.** The owner's rule is ใๆฏๆฌกๅๆข้ฝไป 1~n ่ฟไธ้ไฝฟ็จ้ฆไธช่ฝ็จ็ใ,
|
|
63
|
+
* so a position is never remembered. `serving` is where the last successful request landed, and
|
|
64
|
+
* `position` is that member's place in the PRIORITY list โ derived from the order, not stored.
|
|
62
65
|
*
|
|
63
66
|
* โ ๏ธ Optional for the same reason {@link current} is: a caller that predates the group must keep
|
|
64
67
|
* working, and its absence means "this build has no supply group", not an error.
|
|
@@ -68,11 +71,19 @@ export interface RouteDeps {
|
|
|
68
71
|
members: readonly string[];
|
|
69
72
|
/** Ids in `members` that no configured channel matches; the panel lists these for removal. */
|
|
70
73
|
dangling: readonly string[];
|
|
71
|
-
/** The member the
|
|
72
|
-
serving
|
|
73
|
-
/** Zero-based position of {@link serving} within the
|
|
74
|
+
/** The member that served the last SUCCESSFUL request; absent when none has, or it failed. */
|
|
75
|
+
serving?: string;
|
|
76
|
+
/** Zero-based position of {@link serving} within the priority list; `-1` when no one is serving. */
|
|
74
77
|
position: number;
|
|
75
|
-
/**
|
|
78
|
+
/** Whether the most recent request walked the whole list without finding a usable member. */
|
|
79
|
+
exhausted: boolean;
|
|
80
|
+
/** The member the last FAILED request gave up on; absent when that request succeeded. */
|
|
81
|
+
lastTried?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The most recent switch, since the process started or since the member list changed.
|
|
84
|
+
*
|
|
85
|
+
* โ ๏ธ There is nothing to reset: every request starts at member 1, so no cursor exists to clear.
|
|
86
|
+
*/
|
|
76
87
|
lastSwitch?: {
|
|
77
88
|
from: string;
|
|
78
89
|
to: string;
|
|
@@ -80,8 +91,6 @@ export interface RouteDeps {
|
|
|
80
91
|
atMs: number;
|
|
81
92
|
};
|
|
82
93
|
};
|
|
83
|
-
/** Return the supply group to its first member (owner-facing ใ้็ฝฎๅฐ็ฌฌไธไธชใ). */
|
|
84
|
-
resetSupply?: () => void;
|
|
85
94
|
/** Describe a credential reference (never its value). */
|
|
86
95
|
describeKey: (ref: string) => Promise<{
|
|
87
96
|
configured: boolean;
|
package/lib/index.js
CHANGED
|
@@ -704,13 +704,15 @@ function allChannels(resolution) {
|
|
|
704
704
|
* setup problem, an unset `current` is a choice not yet made, and an empty group is a choice made
|
|
705
705
|
* but not finished. Reporting them separately keeps the panel's guidance accurate.
|
|
706
706
|
*
|
|
707
|
+
* ๐ด **There is no `cursor` parameter any more.** The owner's rule is "always start at member 1",
|
|
708
|
+
* and the most reliable way to guarantee that is for the function to have no way to express
|
|
709
|
+
* anything else โ a parameter the caller could pass would invite the behaviour back.
|
|
707
710
|
* @param channels - every resolved channel, in configuration order.
|
|
708
711
|
* @param current - the configured selection (a channel id, or {@link SUPPLY_GROUP_ID}).
|
|
709
712
|
* @param groupMembers - the supply group's ordered member ids.
|
|
710
|
-
* @param cursor - zero-based index of the member to start from (the sticky position).
|
|
711
713
|
* @returns the selected channel plus its ordered alternates, or the reason there is none.
|
|
712
714
|
*/
|
|
713
|
-
function selectChannel(channels, current, groupMembers = []
|
|
715
|
+
function selectChannel(channels, current, groupMembers = []) {
|
|
714
716
|
if (channels.length === 0) return {
|
|
715
717
|
ok: false,
|
|
716
718
|
failure: {
|
|
@@ -726,7 +728,7 @@ function selectChannel(channels, current, groupMembers = [], cursor = 0) {
|
|
|
726
728
|
detail: "no supplier is selected; pick a channel or the supply group in Settings โ Any DeepSeek"
|
|
727
729
|
}
|
|
728
730
|
};
|
|
729
|
-
if (wanted === "__group__") return selectFromGroup(channels, groupMembers
|
|
731
|
+
if (wanted === "__group__") return selectFromGroup(channels, groupMembers);
|
|
730
732
|
const found = channels.find((channel) => channel.id === wanted);
|
|
731
733
|
if (found !== void 0) return {
|
|
732
734
|
ok: true,
|
|
@@ -746,24 +748,22 @@ function selectChannel(channels, current, groupMembers = [], cursor = 0) {
|
|
|
746
748
|
};
|
|
747
749
|
}
|
|
748
750
|
/**
|
|
749
|
-
* Resolve the supply group into an ordered candidate list.
|
|
751
|
+
* Resolve the supply group into an ordered candidate list, highest priority first.
|
|
750
752
|
*
|
|
751
753
|
* ## Why dangling members are SKIPPED rather than fatal
|
|
752
754
|
*
|
|
753
755
|
* A member id that no longer resolves (renamed id, half-written entry, deleted channel whose id
|
|
754
756
|
* stayed in the list) is a repairable inconsistency. Failing the whole route would take the
|
|
755
757
|
* provider offline over one stale string, which is the opposite of what a supply group is FOR.
|
|
756
|
-
* The skip is not silent:
|
|
757
|
-
* dangling ones, and the panel shows them so the user can remove them.
|
|
758
|
+
* The skip is not silent: `/channels` reports the dangling ids and the panel lists them.
|
|
758
759
|
*
|
|
759
760
|
* Empty-after-resolution IS fatal (`GROUP_EMPTY`): a group with nothing usable cannot serve, and
|
|
760
761
|
* answering with a made-up fallback would hide a configuration the user must fix.
|
|
761
762
|
* @param channels - every resolved channel.
|
|
762
|
-
* @param members - the configured ordered member ids.
|
|
763
|
-
* @
|
|
764
|
-
* @returns the ordered candidates from `cursor` onward, or a failure.
|
|
763
|
+
* @param members - the configured ordered member ids; index 0 is the highest priority.
|
|
764
|
+
* @returns the ordered candidates, or a failure.
|
|
765
765
|
*/
|
|
766
|
-
function selectFromGroup(channels, members
|
|
766
|
+
function selectFromGroup(channels, members) {
|
|
767
767
|
const byId = new Map(channels.map((channel) => [channel.id, channel]));
|
|
768
768
|
const resolvable = members.filter((id) => byId.has(id));
|
|
769
769
|
if (resolvable.length === 0) return {
|
|
@@ -773,8 +773,7 @@ function selectFromGroup(channels, members, cursor) {
|
|
|
773
773
|
detail: members.length === 0 ? "the supply group has no members; add channels to it in Settings โ Any DeepSeek" : `the supply group names no channel that exists (${members.join(", ")}); fix it in Settings โ Any DeepSeek`
|
|
774
774
|
}
|
|
775
775
|
};
|
|
776
|
-
const
|
|
777
|
-
const [head, ...rest] = [...resolvable.slice(start), ...resolvable.slice(0, start)];
|
|
776
|
+
const [head, ...rest] = resolvable;
|
|
778
777
|
const headChannel = byId.get(head);
|
|
779
778
|
if (headChannel === void 0) return {
|
|
780
779
|
ok: false,
|
|
@@ -788,9 +787,8 @@ function selectFromGroup(channels, members, cursor) {
|
|
|
788
787
|
channel: headChannel,
|
|
789
788
|
source: {
|
|
790
789
|
kind: "group",
|
|
791
|
-
index:
|
|
792
|
-
of: resolvable.length
|
|
793
|
-
cursorAdvanced: start > 0
|
|
790
|
+
index: 0,
|
|
791
|
+
of: resolvable.length
|
|
794
792
|
},
|
|
795
793
|
alternates: rest.flatMap((id) => byId.get(id) ?? [])
|
|
796
794
|
};
|
|
@@ -798,49 +796,34 @@ function selectFromGroup(channels, members, cursor) {
|
|
|
798
796
|
//#endregion
|
|
799
797
|
//#region src/failover.ts
|
|
800
798
|
/**
|
|
801
|
-
* failover.ts โ when the supply group moves
|
|
799
|
+
* failover.ts โ when the supply group moves on, and what it remembers.
|
|
802
800
|
*
|
|
803
|
-
* ## The
|
|
801
|
+
* ## The routing rule is deliberately the simplest one that works
|
|
804
802
|
*
|
|
805
|
-
*
|
|
806
|
-
*
|
|
807
|
-
* dispatch loop where it would be invisible and untestable in isolation.
|
|
803
|
+
* Owner decision 2026-11-12 (revising the first cut, which used a sticky cursor):
|
|
804
|
+
* ใไพๅบ็ป้็ๅฐฑๆไผๅ
็บงๆฅ๏ผๆฏๆฌกๅๆข้ฝไป 1~n ่ฟไธ้ไฝฟ็จ้ฆไธช่ฝ็จ็ใ.
|
|
808
805
|
*
|
|
809
|
-
*
|
|
806
|
+
* โ **Every request starts at member 1 and walks 1โฆn, using the first that works.** Position is
|
|
807
|
+
* never remembered for routing; the configured order IS the priority, with no exceptions and no
|
|
808
|
+
* hidden state to reason about.
|
|
810
809
|
*
|
|
811
|
-
*
|
|
812
|
-
* **cold prompt cache** for the conversation. Switching for a transient fault therefore makes
|
|
813
|
-
* things worse, because the retry layer (`providerRetryPolicy`, 100 attempts) is already the right
|
|
814
|
-
* instrument for "this attempt happened to fail".
|
|
810
|
+
* ## What that costs, stated plainly
|
|
815
811
|
*
|
|
816
|
-
*
|
|
817
|
-
*
|
|
812
|
+
* While member 1 is out of quota, every request pays one wasted round-trip to it before reaching
|
|
813
|
+
* the first usable member. The first cut avoided that with a sticky cursor, and the trade was
|
|
814
|
+
* rejected on purpose: a cursor makes "which member serves?" depend on history, so topping up
|
|
815
|
+
* member 1 did not put it back into use until something reset the cursor โ and the recovery was
|
|
816
|
+
* invisible. One fast 402 per call is a cheaper price than a priority order that silently stops
|
|
817
|
+
* being the priority order.
|
|
818
818
|
*
|
|
819
|
-
*
|
|
820
|
-
*
|
|
821
|
-
* | `QUOTA`, `ACCOUNT_QUOTA` | โ
| the balance is gone; every later attempt fails identically |
|
|
822
|
-
* | `AUTH` | โ
| the key was rejected; it will be rejected again |
|
|
823
|
-
* | `INVALID_CREDENTIAL` | โ
| malformed key, structurally unfixable at request time |
|
|
824
|
-
* | `MISSING_CREDENTIAL` | โ
| this channel has no key at all โ it cannot serve, ever |
|
|
825
|
-
* | `RATE_LIMIT` | โ | transient by definition; retry is the correct instrument |
|
|
826
|
-
* | `SERVER`, `TIMEOUT`, `TRANSPORT`, `STREAM_CLOSED` | โ | transient; see above |
|
|
827
|
-
* | `CONTEXT_WINDOW_EXCEEDED` | โ **never** | see the note below |
|
|
828
|
-
* | `ABORTED` | โ | the caller cancelled; switching would ignore their intent |
|
|
819
|
+
* โ ๏ธ Measured scale of that cost: a quota refusal returns without generating, so it costs no
|
|
820
|
+
* tokens and is bounded by one HTTP round-trip. It is not a re-prompt of the conversation.
|
|
829
821
|
*
|
|
830
|
-
*
|
|
831
|
-
* exclusion.** Two independent reasons:
|
|
822
|
+
* ## What is still remembered โ for DISPLAY only
|
|
832
823
|
*
|
|
833
|
-
*
|
|
834
|
-
*
|
|
835
|
-
*
|
|
836
|
-
* 2. **It is dangerous.** The harness treats that code as proof of a real overflow and answers
|
|
837
|
-
* with the destructive recovery path (`compactIfNeeded(โฆ, 'context-overflow')`, whole range,
|
|
838
|
-
* retain=0, threshold skipped โ the 0.0.32 incident). Switching on it turns one error into
|
|
839
|
-
* repeated trips through a path that deletes conversation history.
|
|
840
|
-
*
|
|
841
|
-
* Anything not listed is treated as non-switching, which is the safe default: an unknown code is
|
|
842
|
-
* an unknown cause, and guessing "this relay is broken" on an unknown cause is how a healthy
|
|
843
|
-
* supplier gets cycled out during a blip.
|
|
824
|
+
* The panel still needs to answer ใ็ฐๅจๅจ็จ่ฐ๏ผๅๆๆขไบ่ฐ๏ผไธบไปไนๆขใ, and those are facts about what
|
|
825
|
+
* happened, not inputs to what happens next. They live in {@link SupplyStatus}, which the routing
|
|
826
|
+
* path writes and never reads.
|
|
844
827
|
*/
|
|
845
828
|
/** Codes that mean "this channel cannot serve", as opposed to "this attempt failed". */
|
|
846
829
|
const CHANNEL_UNUSABLE_CODES = /* @__PURE__ */ new Set([
|
|
@@ -878,78 +861,86 @@ function canSwitchAttempt(input) {
|
|
|
878
861
|
return !input.emitted && input.hasNext && shouldFailover(input.code);
|
|
879
862
|
}
|
|
880
863
|
/**
|
|
881
|
-
*
|
|
882
|
-
*
|
|
883
|
-
* ## Why sticky rather than "always start at member 0"
|
|
884
|
-
*
|
|
885
|
-
* The group exists because a member runs out of balance. Once that happens, member 0 stays
|
|
886
|
-
* exhausted for hours or days โ so re-trying it before every single request costs one wasted
|
|
887
|
-
* round-trip and one cache invalidation per request, forever. The cursor records "we already know
|
|
888
|
-
* member 0 is dead" and starts after it.
|
|
889
|
-
*
|
|
890
|
-
* ## Why it lives in memory and is NOT persisted
|
|
864
|
+
* What the last request did, for the panel only.
|
|
891
865
|
*
|
|
892
|
-
*
|
|
893
|
-
*
|
|
894
|
-
*
|
|
895
|
-
* the
|
|
896
|
-
*
|
|
897
|
-
* ## What invalidates it
|
|
898
|
-
*
|
|
899
|
-
* The member list itself. If the user adds, removes or reorders members, the old index no longer
|
|
900
|
-
* refers to the same channel, so it is reset to 0. This is keyed on the member list's identity
|
|
901
|
-
* (joined string), not on a counter โ the cursor cannot silently point at a different channel.
|
|
866
|
+
* ๐ด **Nothing here is an input to routing.** The owner's rule is "always start at 1", so a value
|
|
867
|
+
* in this class can never change which member serves the next request โ that is the whole point of
|
|
868
|
+
* replacing the sticky cursor. If a future edit starts reading `serving` to choose a starting
|
|
869
|
+
* index, the priority order has quietly become history-dependent again.
|
|
902
870
|
*/
|
|
903
|
-
var
|
|
904
|
-
/** The member
|
|
871
|
+
var SupplyStatus = class {
|
|
872
|
+
/** The member that last served successfully. */
|
|
873
|
+
servedId;
|
|
874
|
+
/** The last switch, if any since the process started (or since the group was re-read). */
|
|
875
|
+
switchRecord;
|
|
876
|
+
/** Whether the most recent request found no usable member at all. */
|
|
877
|
+
exhausted = false;
|
|
878
|
+
/** The member the most recent failed request gave up on. */
|
|
879
|
+
lastTriedId;
|
|
880
|
+
/** The member list these readings belong to; a change discards them. */
|
|
905
881
|
signature = "";
|
|
906
|
-
/** Zero-based index of the member to start from. */
|
|
907
|
-
position = 0;
|
|
908
|
-
/** The last switch, for the panel to explain what happened. */
|
|
909
|
-
lastSwitch;
|
|
910
882
|
/**
|
|
911
|
-
*
|
|
883
|
+
* Bind the readings to one member list, discarding them when the list changes.
|
|
884
|
+
*
|
|
885
|
+
* Keyed on the list's content, not on a counter: after the user adds, removes or reorders
|
|
886
|
+
* members, "the member that last served" may no longer exist, and a stale name in the panel is
|
|
887
|
+
* worse than a blank line.
|
|
912
888
|
* @param members - the configured ordered member ids.
|
|
913
|
-
* @returns the zero-based starting index.
|
|
914
889
|
*/
|
|
915
|
-
|
|
890
|
+
bind(members) {
|
|
916
891
|
const signature = members.join("\0");
|
|
917
|
-
if (signature
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
892
|
+
if (signature === this.signature) return;
|
|
893
|
+
this.signature = signature;
|
|
894
|
+
this.servedId = void 0;
|
|
895
|
+
this.switchRecord = void 0;
|
|
896
|
+
this.exhausted = false;
|
|
897
|
+
this.lastTriedId = void 0;
|
|
923
898
|
}
|
|
924
|
-
/**
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
this.position = nextIndex;
|
|
934
|
-
this.lastSwitch = {
|
|
899
|
+
/** Record that `id` served this request successfully. */
|
|
900
|
+
noteServed(id) {
|
|
901
|
+
this.servedId = id;
|
|
902
|
+
this.exhausted = false;
|
|
903
|
+
this.lastTriedId = void 0;
|
|
904
|
+
}
|
|
905
|
+
/** Record one move from a member that could not serve to the one tried next. */
|
|
906
|
+
noteSwitch(from, to, code, atMs) {
|
|
907
|
+
this.switchRecord = {
|
|
935
908
|
from,
|
|
936
909
|
to,
|
|
937
910
|
code,
|
|
938
911
|
atMs
|
|
939
912
|
};
|
|
940
913
|
}
|
|
941
|
-
/**
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
914
|
+
/**
|
|
915
|
+
* Record that a request ended without a serving member.
|
|
916
|
+
*
|
|
917
|
+
* ๐ด `exhausted` is NOT the same as "the request failed". A request that fails on member 1 of 4
|
|
918
|
+
* with an error the group cannot switch on (a mid-stream error, a SERVER error) has failed, but
|
|
919
|
+
* the group is not out of members โ rendering ใๅ
จ็ปๅไธๅฏ็จใ then would be a false alarm that
|
|
920
|
+
* hides a healthy member 2..4. Only walking off the END of the list earns the exhausted flag.
|
|
921
|
+
* @param lastTried - the final member attempted, so the panel can name it.
|
|
922
|
+
* @param exhausted - whether the list ran out (true) or the request failed with members left.
|
|
923
|
+
*/
|
|
924
|
+
noteFailure(lastTried, exhausted) {
|
|
925
|
+
this.servedId = void 0;
|
|
926
|
+
this.exhausted = exhausted;
|
|
927
|
+
this.lastTriedId = lastTried;
|
|
928
|
+
}
|
|
929
|
+
/** The member that last served, or undefined when nothing has served yet / the last request failed. */
|
|
930
|
+
get serving() {
|
|
931
|
+
return this.servedId;
|
|
932
|
+
}
|
|
933
|
+
/** The most recent switch, or undefined when none has happened. */
|
|
934
|
+
get lastSwitch() {
|
|
935
|
+
return this.switchRecord;
|
|
945
936
|
}
|
|
946
|
-
/**
|
|
947
|
-
get
|
|
948
|
-
return this.
|
|
937
|
+
/** Whether the most recent request found no usable member. */
|
|
938
|
+
get isExhausted() {
|
|
939
|
+
return this.exhausted;
|
|
949
940
|
}
|
|
950
|
-
/** The
|
|
951
|
-
get
|
|
952
|
-
return this.
|
|
941
|
+
/** The member the last failed request gave up on; undefined when that request succeeded. */
|
|
942
|
+
get lastTried() {
|
|
943
|
+
return this.lastTriedId;
|
|
953
944
|
}
|
|
954
945
|
};
|
|
955
946
|
//#endregion
|
|
@@ -1713,14 +1704,14 @@ var AnyDeepSeekAdapter = class extends LlmAdapter {
|
|
|
1713
1704
|
*/
|
|
1714
1705
|
async *stream(options) {
|
|
1715
1706
|
const supply = this.deps.supply();
|
|
1716
|
-
|
|
1707
|
+
supply.status.bind(supply.members);
|
|
1708
|
+
const selection = selectChannel(this.deps.channels(), this.deps.current(), supply.members);
|
|
1717
1709
|
if (!selection.ok) {
|
|
1718
1710
|
yield failureChunk(selection.failure);
|
|
1719
1711
|
return;
|
|
1720
1712
|
}
|
|
1721
1713
|
const candidates = [selection.channel, ...selection.alternates];
|
|
1722
|
-
const
|
|
1723
|
-
const groupSize = selection.source.kind === "group" ? selection.source.of : 0;
|
|
1714
|
+
const fromGroup = selection.source.kind === "group";
|
|
1724
1715
|
/** Every attempt this request made, for the message on total failure. */
|
|
1725
1716
|
const tried = [];
|
|
1726
1717
|
for (let position = 0; position < candidates.length; position++) {
|
|
@@ -1842,7 +1833,10 @@ var AnyDeepSeekAdapter = class extends LlmAdapter {
|
|
|
1842
1833
|
}
|
|
1843
1834
|
}
|
|
1844
1835
|
await record();
|
|
1845
|
-
if (failure === void 0)
|
|
1836
|
+
if (failure === void 0) {
|
|
1837
|
+
if (fromGroup) supply.status.noteServed(channel.id);
|
|
1838
|
+
return;
|
|
1839
|
+
}
|
|
1846
1840
|
const code = failure.code;
|
|
1847
1841
|
tried.push({
|
|
1848
1842
|
id: channel.id,
|
|
@@ -1854,10 +1848,10 @@ var AnyDeepSeekAdapter = class extends LlmAdapter {
|
|
|
1854
1848
|
emitted,
|
|
1855
1849
|
hasNext: position + 1 < candidates.length
|
|
1856
1850
|
})) {
|
|
1857
|
-
|
|
1858
|
-
if (headIndex >= 0 && groupSize > 0) supply.cursor.advance(channel.id, next.id, code, this.deps.now().getTime(), (headIndex + position + 1) % groupSize);
|
|
1851
|
+
if (fromGroup) supply.status.noteSwitch(channel.id, candidates[position + 1].id, code, this.deps.now().getTime());
|
|
1859
1852
|
continue;
|
|
1860
1853
|
}
|
|
1854
|
+
if (fromGroup) supply.status.noteFailure(channel.id, position + 1 >= candidates.length);
|
|
1861
1855
|
yield {
|
|
1862
1856
|
type: "finish",
|
|
1863
1857
|
reason: {
|
|
@@ -1874,7 +1868,7 @@ var AnyDeepSeekAdapter = class extends LlmAdapter {
|
|
|
1874
1868
|
/** The channel that will serve the next request, if any (used for model metadata). */
|
|
1875
1869
|
selected() {
|
|
1876
1870
|
const supply = this.deps.supply();
|
|
1877
|
-
const selection = selectChannel(this.deps.channels(), this.deps.current(), supply.members
|
|
1871
|
+
const selection = selectChannel(this.deps.channels(), this.deps.current(), supply.members);
|
|
1878
1872
|
return selection.ok ? selection.channel : void 0;
|
|
1879
1873
|
}
|
|
1880
1874
|
};
|
|
@@ -2899,29 +2893,6 @@ function registerStatsRoutes(ctx, webServer, deps) {
|
|
|
2899
2893
|
});
|
|
2900
2894
|
}
|
|
2901
2895
|
},
|
|
2902
|
-
{
|
|
2903
|
-
/**
|
|
2904
|
-
* Return the supply group to its first member.
|
|
2905
|
-
*
|
|
2906
|
-
* ๐ด POST, not GET, and deliberately so: this mutates router state that outlives the request
|
|
2907
|
-
* (the sticky cursor). A GET would be cacheable/prefetchable, and a prefetched "reset" would
|
|
2908
|
-
* silently undo a fallback the user was relying on.
|
|
2909
|
-
*
|
|
2910
|
-
* Why the button exists at all: the cursor is sticky, so after a member runs out of quota
|
|
2911
|
-
* the group stays on the later member until something invalidates it. Topping up a relay
|
|
2912
|
-
* should not require a host restart to get back onto it.
|
|
2913
|
-
*/
|
|
2914
|
-
kind: "exact",
|
|
2915
|
-
path: `${ROUTE_PREFIX}/supply/reset`,
|
|
2916
|
-
handler: async (req, res) => {
|
|
2917
|
-
if (req.method !== "POST") {
|
|
2918
|
-
json(res, 405, { error: "POST required" });
|
|
2919
|
-
return;
|
|
2920
|
-
}
|
|
2921
|
-
deps.resetSupply?.();
|
|
2922
|
-
json(res, 200, { ok: true });
|
|
2923
|
-
}
|
|
2924
|
-
},
|
|
2925
2896
|
{
|
|
2926
2897
|
kind: "exact",
|
|
2927
2898
|
path: `${ROUTE_PREFIX}/stats`,
|
|
@@ -3152,24 +3123,25 @@ function apply(ctx, config) {
|
|
|
3152
3123
|
return typeof value === "string" ? value : void 0;
|
|
3153
3124
|
};
|
|
3154
3125
|
/**
|
|
3155
|
-
* The one supply
|
|
3126
|
+
* The one supply status recorder for this plugin instance.
|
|
3156
3127
|
*
|
|
3157
|
-
* ๐ด Created ONCE, outside the request path, because its
|
|
3158
|
-
*
|
|
3128
|
+
* ๐ด Created ONCE, outside the request path, because its job is to describe what happened across
|
|
3129
|
+
* requests (who served last, what switched). It is **display-only**: nothing reads it back to
|
|
3130
|
+
* choose which member serves next โ the owner's rule is "always start at member 1" (see
|
|
3131
|
+
* `route.ts`), and this object must never become a routing input.
|
|
3159
3132
|
*/
|
|
3160
|
-
const
|
|
3133
|
+
const supplyStatus = new SupplyStatus();
|
|
3161
3134
|
/**
|
|
3162
|
-
* The supply group
|
|
3135
|
+
* The supply group, read fresh each request.
|
|
3163
3136
|
*
|
|
3164
3137
|
* `members` is read from the live config (not captured at apply time) for the same reason
|
|
3165
|
-
* `channels` is: the panel edits it while the plugin runs.
|
|
3166
|
-
* the member list changes, so a stale index can never point at a different channel.
|
|
3138
|
+
* `channels` is: the panel edits it while the plugin runs.
|
|
3167
3139
|
*/
|
|
3168
3140
|
const supply = () => {
|
|
3169
3141
|
const group = unwrap((ctx.fiber?.config ?? config).supplyGroup);
|
|
3170
3142
|
return {
|
|
3171
3143
|
members: Array.isArray(group?.members) ? group.members.filter((id) => typeof id === "string") : [],
|
|
3172
|
-
|
|
3144
|
+
status: supplyStatus
|
|
3173
3145
|
};
|
|
3174
3146
|
};
|
|
3175
3147
|
/**
|
|
@@ -3242,22 +3214,25 @@ function apply(ctx, config) {
|
|
|
3242
3214
|
}),
|
|
3243
3215
|
current,
|
|
3244
3216
|
supply: () => {
|
|
3245
|
-
const { members,
|
|
3217
|
+
const { members, status } = supply();
|
|
3218
|
+
status.bind(members);
|
|
3246
3219
|
const live = channels();
|
|
3247
3220
|
const known = new Set(live.map((channel) => channel.id));
|
|
3248
|
-
const
|
|
3249
|
-
const
|
|
3250
|
-
const
|
|
3251
|
-
const last =
|
|
3221
|
+
const order = members.filter((id) => known.has(id));
|
|
3222
|
+
const serving = status.serving;
|
|
3223
|
+
const position = serving === void 0 ? -1 : order.indexOf(serving);
|
|
3224
|
+
const last = status.lastSwitch;
|
|
3225
|
+
const lastTried = status.lastTried;
|
|
3252
3226
|
return {
|
|
3253
3227
|
members,
|
|
3254
3228
|
dangling: members.filter((id) => !known.has(id)),
|
|
3255
|
-
serving,
|
|
3229
|
+
...serving === void 0 ? {} : { serving },
|
|
3256
3230
|
position,
|
|
3231
|
+
exhausted: status.isExhausted,
|
|
3232
|
+
...lastTried === void 0 ? {} : { lastTried },
|
|
3257
3233
|
...last === void 0 ? {} : { lastSwitch: last }
|
|
3258
3234
|
};
|
|
3259
3235
|
},
|
|
3260
|
-
resetSupply: () => supplyCursor.reset(),
|
|
3261
3236
|
describeKey: async (ref) => {
|
|
3262
3237
|
const seam = credentials();
|
|
3263
3238
|
if (seam?.describe === void 0) return {
|
package/lib/route.d.ts
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* route.ts โ which channel serves the next request.
|
|
3
3
|
*
|
|
4
|
-
* ## History:
|
|
4
|
+
* ## History: manual โ sticky group โ priority order
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* - **2026-10-19 (decision 7)**: select one channel by name, no failover. Cost stated then: a dead
|
|
7
|
+
* relay means the user switches by hand.
|
|
8
|
+
* - **2026-11-12 (first cut of the group)**: a sticky cursor remembered the last position, so an
|
|
9
|
+
* outage cost one wasted attempt in total rather than one per request.
|
|
10
|
+
* - **2026-11-12 (owner revision, current)**: ใไพๅบ็ป้็ๅฐฑๆไผๅ
็บงๆฅ๏ผๆฏๆฌกๅๆข้ฝไป 1~n ่ฟไธ้ไฝฟ็จ้ฆไธช
|
|
11
|
+
* ่ฝ็จ็ใ โ **every request starts at member 1**. The cursor is gone from the routing path.
|
|
7
12
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* ็ปๅ
ไธไธชไพๅบๅ๏ผ็กฎไฟไพๅบไธไธญๆญใ). Both old costs are now ACCEPTED, and each is contained rather
|
|
13
|
-
* than ignored:
|
|
14
|
-
*
|
|
15
|
-
* - silent re-routing โ the panel names the group as the live supplier and shows the last switch
|
|
16
|
-
* with its reason (`groupState` in `/channels`), so a reroute is visible after the fact;
|
|
17
|
-
* - cache churn โ the sticky cursor means the switch happens ONCE per outage, not once per
|
|
18
|
-
* request. A group that re-tried from member 0 every time would burn a wasted 402 on the dead
|
|
19
|
-
* relay before every single request, and invalidate the cache each time.
|
|
13
|
+
* The revision is deliberate, not a simplification for its own sake: a cursor makes "who serves?"
|
|
14
|
+
* depend on history, so topping up member 1 did not put it back to work until something reset the
|
|
15
|
+
* cursor โ and nothing did. A priority order that silently stops being the priority order is worse
|
|
16
|
+
* than one wasted quota refusal per call (which costs no tokens).
|
|
20
17
|
*
|
|
21
18
|
* ## The one selection axis
|
|
22
19
|
*
|
|
@@ -39,11 +36,11 @@ export type RouteFailure = {
|
|
|
39
36
|
detail: string;
|
|
40
37
|
};
|
|
41
38
|
/**
|
|
42
|
-
*
|
|
39
|
+
* Where a selection came from.
|
|
43
40
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
41
|
+
* The group arm carries the ordinary membership facts so a caller can report "member 2 of 3"
|
|
42
|
+
* without re-deriving them โ but โ nothing here describes a remembered position, because none is
|
|
43
|
+
* remembered.
|
|
47
44
|
*/
|
|
48
45
|
export type RouteCandidateSource =
|
|
49
46
|
/** `current` names this channel directly. */
|
|
@@ -51,12 +48,11 @@ export type RouteCandidateSource =
|
|
|
51
48
|
kind: 'channel';
|
|
52
49
|
index: number;
|
|
53
50
|
}
|
|
54
|
-
/** The supply group serves this request; `index` is
|
|
51
|
+
/** The supply group serves this request; `index` is the ALWAYS-ZERO starting position. */
|
|
55
52
|
| {
|
|
56
53
|
kind: 'group';
|
|
57
54
|
index: number;
|
|
58
55
|
of: number;
|
|
59
|
-
cursorAdvanced: boolean;
|
|
60
56
|
};
|
|
61
57
|
/** Selection outcome: exactly one of the two arms is present. */
|
|
62
58
|
export type RouteResult = {
|
|
@@ -77,13 +73,15 @@ export type RouteResult = {
|
|
|
77
73
|
* setup problem, an unset `current` is a choice not yet made, and an empty group is a choice made
|
|
78
74
|
* but not finished. Reporting them separately keeps the panel's guidance accurate.
|
|
79
75
|
*
|
|
76
|
+
* ๐ด **There is no `cursor` parameter any more.** The owner's rule is "always start at member 1",
|
|
77
|
+
* and the most reliable way to guarantee that is for the function to have no way to express
|
|
78
|
+
* anything else โ a parameter the caller could pass would invite the behaviour back.
|
|
80
79
|
* @param channels - every resolved channel, in configuration order.
|
|
81
80
|
* @param current - the configured selection (a channel id, or {@link SUPPLY_GROUP_ID}).
|
|
82
81
|
* @param groupMembers - the supply group's ordered member ids.
|
|
83
|
-
* @param cursor - zero-based index of the member to start from (the sticky position).
|
|
84
82
|
* @returns the selected channel plus its ordered alternates, or the reason there is none.
|
|
85
83
|
*/
|
|
86
|
-
export declare function selectChannel(channels: readonly ResolvedChannel[], current: string | undefined, groupMembers?: readonly string[]
|
|
84
|
+
export declare function selectChannel(channels: readonly ResolvedChannel[], current: string | undefined, groupMembers?: readonly string[]): RouteResult;
|
|
87
85
|
/**
|
|
88
86
|
* Whether `current` names a channel that exists at all.
|
|
89
87
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-any-deepseek",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36",
|
|
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": {
|