dsh-xdpool 3.0.1 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,49 @@
1
1
  # Changelog
2
2
  本项目的所有重要变更都会记录在此文件。
3
3
  版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
4
+ ## 3.0.3 — 豆包档位、全关、立即执行、关闭按钮
5
+
6
+ > 四件事,都是能用眼睛立刻验的。
7
+
8
+ ### 豆包每个模型用自己的档位
9
+
10
+ 选择器以前给所有模型同一个「低/中/高」。豆包客户端本来就按模型发布不同长度的档位表
11
+ (Qwen 4 Max 低/高/极高三段,DeepSeek / Kimi 五段含「最高」),这些档位一直在解析,
12
+ 只是没走到选择器:合并时被丢掉、`describe()` 又写死了三档,发请求时还被白名单降级成「中」。
13
+ 现在三处都通了:**按位置**取最低/中间/最高(所以没有「最高」的模型也不会少一档),
14
+ 选中什么就发什么。
15
+
16
+ ### 「全关」真的会空
17
+
18
+ 卡片上把豆包模型全关之后,选择器仍然列出全部。原因是「全关」被存成一张禁用 id 列表:
19
+ 清单没加载完时存下来就是空,回读成「什么都没关」;存成「所有 id」又会在上游新增模型时漏掉。
20
+ 现在多一个显式开关,全关就是全关。
21
+
22
+ ### 积分自动化:立即执行
23
+
24
+ 自动化开着只代表「到点会跑」。渠道卡片的自动化一行加了「立即执行」,随时跑一轮领取,
25
+ 按钮自己转圈到跑完,今日已领的数字跟着变。
26
+
27
+ ### 右上角关闭
28
+
29
+ 插件的页面撑满设置对话框,退出得去找宿主的按钮。现在右上角有一个 ×,
30
+ 点击关掉承载插件的对话框。
31
+
32
+ ## 3.0.2 — 自动更新不再把自己变成「本地开发」
33
+
34
+ > 3.0.1 的自动更新把一个临时 tgz 路径写进了 profile,装完会变成「本地开发插件」,版本号还可能对不上。
35
+
36
+ ### 修掉的问题
37
+
38
+ | 反馈 | 原因 | 现在 |
39
+ | --- | --- | --- |
40
+ | 插件市场把它显示成「本地开发」 | 更新把依赖写成 `file:<系统临时目录>/dsh-xdpool-3.0.1.tgz`,市场按 `link:`/`file:` 判定为本地开发,于是不再提供线上更新 | 依赖写成版本号 `3.0.2`,来源仍是 registry |
41
+ | 市场显示「3.0.1.tgz」但版本号是 3.0.0 | 市场读的是 spec 里的文件名,界面上的版本号来自已加载的 bundle,两者可以不一致 | 两者都来自同一个版本号,不会再分叉 |
42
+ | 重启后版本号还是旧的 | 安装指向的那个 tgz 里就是旧 bundle,重启加载的还是它 | 重启时按版本号从 registry 装真正的新版 |
43
+ | 更新后过一段时间插件加载失败 | `file:` 指向系统临时目录,被清理后文件就没了 | 不再依赖临时目录;pnpm store 保留已安装的包,重启不需要网络 |
44
+
45
+ 下载与 gzip 校验仍然保留,作用变成「写之前先证明 registry 可达、包完好」,失败就中止且不碰 `package.json`。
46
+
4
47
  ## 3.0.1 — 亮色模式与五条反馈
5
48
 
6
49
  > 3.0.0 之后收到的反馈,一次收完。默认外观不变,没人会被迫换配色。
package/README.md CHANGED
@@ -9,15 +9,15 @@
9
9
 
10
10
  ## 更新公告
11
11
 
12
- **3.0.1** — 亮色模式来了,五条反馈一次收完。
13
-
14
- - 新增护眼绿亮色模式:左栏一键切换,默认仍是暗色,选择会记住
15
- - 豆包渠道:卡片上的勾选状态同步进模型选择器,取消勾选即消失
16
- - 账号池:取消勾选的模型保存后立刻从选择器消失,不用再重启 DSH
17
- - 账号使用方式(优先/轮换/均衡/粘住/按到期)点了没反应、提示 HTTP 405 —— 已修
18
- - CodeArts 积分耗尽后不再被反复命中:识别 TM.00001050,冷却并换下一个账号
19
- - 渠道车道多轮对话第二轮必空响应 —— 已修,失败也会把上游原话透出来
20
- - 护眼绿配色与各处字面色校正来自 @Refeain 的 PR #198,豆包勾选的思路来自 #197
12
+ **3.0.3** — 豆包档位、全关、立即执行、右上角关闭。
13
+
14
+ - 豆包每个模型用自己发布的思考档位(含「极高 / 最高」),选中什么就发什么
15
+ - 豆包「全关」之后模型选择器里真的会空,不再残留全部模型
16
+ - 积分自动化一行加了「立即执行」,随时跑一轮领取
17
+ - 右上角加了关闭按钮,点一下关掉设置对话框
18
+ - 其余反馈(账号池账号卡、登录通道账号数、模型重复分组等)正在按 issue 逐条处理
19
+
20
+ **3.0.2 / 3.0.1** — 自动更新不再变成「本地开发」;护眼绿亮色模式与五条反馈(明细见 CHANGELOG)。
21
21
 
22
22
  ## 先加群
23
23
 
package/lib/bin.js CHANGED
@@ -12752,7 +12752,9 @@ z.object({
12752
12752
  * card needs (client writes, host reads without a restart); it is also why the
12753
12753
  * polarity matters — the default `[]` has to be the harmless answer.
12754
12754
  */
12755
- doubaoDisabledModels: asVolatile(z.array(z.string()).default([]).description("Doubao model ids switched off in the picker (mirrored from the Doubao card; empty shows the whole roster)"))
12755
+ doubaoDisabledModels: asVolatile(z.array(z.string()).default([]).description("Doubao model ids switched off in the picker (mirrored from the Doubao card; empty shows the whole roster)")),
12756
+ /** The card's 「全关」, mirrored so the picker can empty the group (see the Config doc). */
12757
+ doubaoHideAllModels: asVolatile(z.boolean().default(false).description("Hide every Doubao model in the picker (the card's 全关 switch)"))
12756
12758
  });
12757
12759
  /** Assemble the runtime objects without registering anything. */
12758
12760
  /**
package/lib/client.js CHANGED
@@ -41,6 +41,7 @@ window.__ModuleLoader__.load({
41
41
  //#region src/status-paths.ts
42
42
  const POOL_STATUS_PATH = "/plugins/dsh-xdpool/status";
43
43
  const POOL_CATALOG_REFRESH_PATH = "/plugins/dsh-xdpool/models/refresh";
44
+ const POOL_AUTOMATION_RUN_PATH = "/plugins/dsh-xdpool/automation/run";
44
45
  const POOL_UPDATE_CHECK_PATH = "/plugins/dsh-xdpool/update";
45
46
  const POOL_MARVIS_SESSION_PATH = "/plugins/dsh-xdpool/marvis/session";
46
47
  const POOL_MARVIS_LOGIN_PATH = "/plugins/dsh-xdpool/marvis/login";
@@ -135,7 +136,7 @@ window.__ModuleLoader__.load({
135
136
  const POOL_NAV_ICON_MASK_URL = `data:image/svg+xml;utf8,${encodeURIComponent(POOL_NAV_ICON_SVG)}`;
136
137
  //#endregion
137
138
  //#region src/version.ts
138
- const POOL_VERSION = "3.0.1";
139
+ const POOL_VERSION = "3.0.3";
139
140
  function compareVersions(left, right) {
140
141
  const parse = (value) => {
141
142
  const [core, ...rest] = value.trim().replace(/^v/u, "").split("-");
@@ -929,6 +930,18 @@ window.__ModuleLoader__.load({
929
930
  select,
930
931
  tabs
931
932
  ]);
933
+ const closeHostDialog = (0, react.useCallback)(() => {
934
+ if (typeof document === "undefined") return;
935
+ const candidate = document.querySelector("[role=\"dialog\"]")?.querySelector("[aria-label*=\"lose\" i], [aria-label*=\"关闭\"], [aria-label*=\"ismiss\" i], [data-dismiss]");
936
+ if (candidate !== void 0 && candidate !== null) {
937
+ candidate.click();
938
+ return;
939
+ }
940
+ window.dispatchEvent(new KeyboardEvent("keydown", {
941
+ key: "Escape",
942
+ bubbles: true
943
+ }));
944
+ }, []);
932
945
  return (0, react_jsx_runtime.jsxs)("div", {
933
946
  ref: appRef,
934
947
  className: wide ? "app app-wide" : "app",
@@ -991,6 +1004,23 @@ window.__ModuleLoader__.load({
991
1004
  })
992
1005
  ]
993
1006
  }),
1007
+ (0, react_jsx_runtime.jsx)("button", {
1008
+ type: "button",
1009
+ className: "app-close",
1010
+ "data-testid": "xdpool-close",
1011
+ title: t?.("shell.close") ?? "关闭",
1012
+ "aria-label": t?.("shell.close") ?? "关闭",
1013
+ onClick: closeHostDialog,
1014
+ children: (0, react_jsx_runtime.jsx)("svg", {
1015
+ viewBox: "0 0 24 24",
1016
+ fill: "none",
1017
+ stroke: "currentColor",
1018
+ strokeWidth: "1.8",
1019
+ strokeLinecap: "round",
1020
+ "aria-hidden": "true",
1021
+ children: (0, react_jsx_runtime.jsx)("path", { d: "M6 6l12 12M18 6L6 18" })
1022
+ })
1023
+ }),
994
1024
  pop !== "update" ? null : (0, react_jsx_runtime.jsxs)("div", {
995
1025
  ref: popRef,
996
1026
  className: "pop",
@@ -9634,6 +9664,20 @@ window.__ModuleLoader__.load({
9634
9664
  let poolSnapshot;
9635
9665
  const COUNTS_STORE_KEY = "dsh-xdpool.channel-counts.v1";
9636
9666
  const DOUBAO_SKIP_KEY = "dsh-xdpool.doubao-skipped-models.v1";
9667
+ const DOUBAO_HIDE_ALL_KEY = "dsh-xdpool.doubao-hide-all.v1";
9668
+ function readDoubaoHideAll() {
9669
+ try {
9670
+ return globalThis.localStorage?.getItem(DOUBAO_HIDE_ALL_KEY) === "true";
9671
+ } catch {
9672
+ return false;
9673
+ }
9674
+ }
9675
+ function saveDoubaoHideAll(hidden) {
9676
+ try {
9677
+ if (hidden) globalThis.localStorage?.setItem(DOUBAO_HIDE_ALL_KEY, "true");
9678
+ else globalThis.localStorage?.removeItem(DOUBAO_HIDE_ALL_KEY);
9679
+ } catch {}
9680
+ }
9637
9681
  function readDoubaoSkipped() {
9638
9682
  try {
9639
9683
  const raw = globalThis.localStorage?.getItem(DOUBAO_SKIP_KEY);
@@ -9655,16 +9699,20 @@ window.__ModuleLoader__.load({
9655
9699
  let lastMirroredDoubaoDisabled;
9656
9700
  async function mirrorDoubaoDisabled() {
9657
9701
  const skipped = readDoubaoSkipped();
9658
- if (skipped === void 0) return;
9659
- const ids = [...skipped];
9660
- const fingerprint = JSON.stringify([...ids].sort());
9702
+ const hideAll = readDoubaoHideAll();
9703
+ if (skipped === void 0 && !hideAll) return;
9704
+ const ids = [...skipped ?? []];
9705
+ const fingerprint = JSON.stringify([[...ids].sort(), hideAll]);
9661
9706
  if (fingerprint === lastMirroredDoubaoDisabled) return;
9662
9707
  try {
9663
9708
  if (!(await fetch("/plugins/dsh-xdpool/doubao/models", {
9664
9709
  method: "POST",
9665
9710
  headers: { "content-type": "application/json" },
9666
9711
  credentials: "same-origin",
9667
- body: JSON.stringify({ disabledModelIds: ids })
9712
+ body: JSON.stringify({
9713
+ disabledModelIds: ids,
9714
+ hideAll
9715
+ })
9668
9716
  })).ok) return;
9669
9717
  lastMirroredDoubaoDisabled = fingerprint;
9670
9718
  } catch {}
@@ -10162,7 +10210,7 @@ window.__ModuleLoader__.load({
10162
10210
  return "签到失败";
10163
10211
  }
10164
10212
  }
10165
- function ChannelPoolSection({ t, active, onAddAccount, autoClaim, autoClaimBusy, onAutoClaim, banner }) {
10213
+ function ChannelPoolSection({ t, active, onAddAccount, autoClaim, autoClaimBusy, onAutoClaim, autoClaimRunning, onAutoClaimRun, banner }) {
10166
10214
  const [ownActive, setOwnActive] = (0, react.useState)("");
10167
10215
  const [loginState, setLoginState] = (0, react.useState)(void 0);
10168
10216
  const loginAbort = (0, react.useRef)(void 0);
@@ -10484,6 +10532,7 @@ window.__ModuleLoader__.load({
10484
10532
  try {
10485
10533
  if (provider === "doubao") {
10486
10534
  await saveDoubaoSkipped(modelId, !on);
10535
+ saveDoubaoHideAll(false);
10487
10536
  await mirrorDoubaoDisabled();
10488
10537
  } else {
10489
10538
  const envelope = await callPack("model.setDisabled", {
@@ -10540,6 +10589,7 @@ window.__ModuleLoader__.load({
10540
10589
  if (provider === "doubao") {
10541
10590
  const skipped = on ? [] : entry.models.map((model) => model.id);
10542
10591
  globalThis.localStorage?.setItem(DOUBAO_SKIP_KEY, JSON.stringify(skipped));
10592
+ saveDoubaoHideAll(!on);
10543
10593
  await mirrorDoubaoDisabled();
10544
10594
  } else await callPack("model.setAllDisabled", {
10545
10595
  provider,
@@ -11451,17 +11501,30 @@ window.__ModuleLoader__.load({
11451
11501
  }),
11452
11502
  (0, react_jsx_runtime.jsxs)("div", {
11453
11503
  className: "policy-v",
11454
- children: [(0, react_jsx_runtime.jsx)("button", {
11455
- type: "button",
11456
- role: "switch",
11457
- className: "sw",
11458
- "aria-checked": autoClaim === true,
11459
- "aria-label": t?.("channelpool.autoClaim") ?? "积分自动化",
11460
- disabled: autoClaimBusy === true,
11461
- onClick: () => {
11462
- onAutoClaim?.(autoClaim !== true);
11463
- }
11464
- }), (0, react_jsx_runtime.jsx)("span", { children: `${t?.("channelpool.claimedToday") ?? "今日已领"} ${String(claimedToday)}/${String(enabledAccounts.length)}` })]
11504
+ children: [
11505
+ (0, react_jsx_runtime.jsx)("button", {
11506
+ type: "button",
11507
+ role: "switch",
11508
+ className: "sw",
11509
+ "aria-checked": autoClaim === true,
11510
+ "aria-label": t?.("channelpool.autoClaim") ?? "积分自动化",
11511
+ disabled: autoClaimBusy === true,
11512
+ onClick: () => {
11513
+ onAutoClaim?.(autoClaim !== true);
11514
+ }
11515
+ }),
11516
+ (0, react_jsx_runtime.jsx)("span", { children: `${t?.("channelpool.claimedToday") ?? "今日已领"} ${String(claimedToday)}/${String(enabledAccounts.length)}` }),
11517
+ (0, react_jsx_runtime.jsx)("button", {
11518
+ type: "button",
11519
+ className: "tiny",
11520
+ disabled: autoClaimRunning === true,
11521
+ title: t?.("channelpool.autoClaimRunHint") ?? "立刻跑一轮领取,不用等到预定时间",
11522
+ onClick: () => {
11523
+ onAutoClaimRun?.();
11524
+ },
11525
+ children: autoClaimRunning === true ? t?.("channelpool.autoClaimRunning") ?? "领取中…" : t?.("channelpool.autoClaimRun") ?? "立即执行"
11526
+ })
11527
+ ]
11465
11528
  }),
11466
11529
  (0, react_jsx_runtime.jsx)("span", {
11467
11530
  className: "policy-hint",
@@ -15940,6 +16003,8 @@ window.__ModuleLoader__.load({
15940
16003
  //#endregion
15941
16004
  //#region src/client/PoolCard.tsx
15942
16005
  const POLL_INTERVAL_MS = 3e4;
16006
+ const AUTOMATION_POLL_MS = 2e3;
16007
+ const AUTOMATION_POLL_ATTEMPTS = 90;
15943
16008
  function hoursOrDefault(configured, fallback) {
15944
16009
  return configured !== void 0 && configured.length > 0 ? [...configured] : [...fallback];
15945
16010
  }
@@ -16180,6 +16245,45 @@ window.__ModuleLoader__.load({
16180
16245
  if (mounted.current) setAutomationBusyRegion(void 0);
16181
16246
  }
16182
16247
  };
16248
+ const runAutomationJob = async (region) => {
16249
+ setAutomationRun("all");
16250
+ setAutomationRunRegion(region);
16251
+ setFlash(void 0);
16252
+ try {
16253
+ const response = await fetch(POOL_AUTOMATION_RUN_PATH, {
16254
+ method: "POST",
16255
+ headers: {
16256
+ "accept": "application/json",
16257
+ "content-type": "application/json"
16258
+ },
16259
+ credentials: "same-origin",
16260
+ body: JSON.stringify({ job: "all" })
16261
+ });
16262
+ const body = await response.json();
16263
+ if (!response.ok) throw new Error(body.error ?? `HTTP ${response.status}`);
16264
+ if (body.started === false) {
16265
+ if (mounted.current) setFlash(t?.("row.autoAlreadyRunning") ?? "A run is already in progress");
16266
+ }
16267
+ let settled = false;
16268
+ for (let attempt = 0; attempt < AUTOMATION_POLL_ATTEMPTS; attempt += 1) {
16269
+ await new Promise((resolve) => setTimeout(resolve, AUTOMATION_POLL_MS));
16270
+ if (!mounted.current) return;
16271
+ if ((await refresh(region))?.automation?.runInProgress === false) {
16272
+ settled = true;
16273
+ break;
16274
+ }
16275
+ }
16276
+ await refresh(region);
16277
+ if (mounted.current) setFlash(settled ? t?.("row.autoRunDone") ?? "Automation pass finished" : t?.("row.autoRunTimeout") ?? "Still running; check back in a moment");
16278
+ } catch (cause) {
16279
+ if (mounted.current) setError(cause instanceof Error ? cause.message : String(cause));
16280
+ } finally {
16281
+ if (mounted.current) {
16282
+ setAutomationRun(void 0);
16283
+ setAutomationRunRegion(void 0);
16284
+ }
16285
+ }
16286
+ };
16183
16287
  t?.("row.title");
16184
16288
  t?.("row.desc");
16185
16289
  return (0, react_jsx_runtime.jsx)(PoolShell, {
@@ -16231,6 +16335,10 @@ window.__ModuleLoader__.load({
16231
16335
  onAutoClaim: (on) => {
16232
16336
  setAutomationEnabled("cn", on);
16233
16337
  },
16338
+ autoClaimRunning: automationRun !== void 0,
16339
+ onAutoClaimRun: () => {
16340
+ runAutomationJob("cn");
16341
+ },
16234
16342
  banner: flash === void 0 && error === void 0 ? void 0 : (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [flash === void 0 ? null : (0, react_jsx_runtime.jsx)("p", {
16235
16343
  className: "note",
16236
16344
  children: flash
@@ -19272,6 +19380,26 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
19272
19380
  .app[data-w="phone"] .sec-actions{margin-left:0;width:100%}
19273
19381
  .app[data-w="phone"] .vendors{grid-template-columns:minmax(0,1fr)}
19274
19382
  .app[data-w="phone"] .kpis .kpi:last-child:nth-child(odd){grid-column:1 / -1}
19383
+ /* ============================================================
19384
+ 插件自己加的:右上角关闭
19385
+ ------------------------------------------------------------
19386
+ 不属于设计稿。设置对话框撑满整个插件页面,宿主的关闭按钮在它自己的
19387
+ 标题栏里、位置随宿主管;这里给一个就地入口,点击的落点见 shell.tsx
19388
+ 的 closeHostDialog。样式跟随设计变量,两套主题都不用另写。
19389
+ ============================================================ */
19390
+ .app-close{
19391
+ position:absolute;top:8px;right:8px;z-index:70;
19392
+ width:28px;height:28px;display:grid;place-items:center;
19393
+ border:1px solid var(--line-2);border-radius:var(--r-sm);
19394
+ background:color-mix(in oklch, var(--surface) 88%, transparent);
19395
+ color:var(--muted);cursor:pointer;
19396
+ transition:color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
19397
+ }
19398
+ .app-close svg{width:14px;height:14px}
19399
+ .app-close:hover{color:var(--text);background:var(--surface-2);border-color:var(--line-3)}
19400
+ .app-close:active{transform:translateY(1px)}
19401
+ .app[data-w="phone"] .app-close{top:6px;right:6px;width:24px;height:24px}
19402
+
19275
19403
  `;
19276
19404
  //#endregion
19277
19405
  //#region src/client/credit-dot-css.ts
@@ -19891,6 +20019,7 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
19891
20019
  "chan.ownedElsewhereRow": "Sign in on the “Our Free Model” page",
19892
20020
  "chan.empty": "No channel is connected yet.",
19893
20021
  "shell.brand": "XD Pool",
20022
+ "shell.close": "Close",
19894
20023
  "shell.themeLight": "Eye-care green",
19895
20024
  "shell.themeDark": "Dark",
19896
20025
  "shell.themeToLight": "Switch to the eye-care green (light) theme",
@@ -20160,6 +20289,9 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
20160
20289
  "channelpool.usageMode": "Account usage",
20161
20290
  "channelpool.autoClaim": "Credit automation",
20162
20291
  "channelpool.autoClaimHint": "When on, daily credits are collected in the background.",
20292
+ "channelpool.autoClaimRun": "Run now",
20293
+ "channelpool.autoClaimRunning": "Running…",
20294
+ "channelpool.autoClaimRunHint": "Run one collection pass now instead of waiting for the scheduled hour",
20163
20295
  "channelpool.modePrefer": "Priority",
20164
20296
  "channelpool.modePreferHint": "Priority: always use the first account until it is rate-limited.",
20165
20297
  "channelpool.modeRoundRobin": "Round robin",
@@ -20611,6 +20743,7 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
20611
20743
  "chan.ownedElsewhereRow": "在「我们的免费模型」里登录",
20612
20744
  "chan.empty": "还没有任何渠道连上来。",
20613
20745
  "shell.brand": "XD Pool",
20746
+ "shell.close": "关闭",
20614
20747
  "shell.themeLight": "护眼绿",
20615
20748
  "shell.themeDark": "暗色",
20616
20749
  "shell.themeToLight": "切换到护眼绿(亮色)主题",
@@ -20921,6 +21054,9 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
20921
21054
  "channelpool.usageMode": "账号使用方式",
20922
21055
  "channelpool.autoClaim": "积分自动化",
20923
21056
  "channelpool.autoClaimHint": "开着就会在后台领每天的积分,不用手动点。",
21057
+ "channelpool.autoClaimRun": "立即执行",
21058
+ "channelpool.autoClaimRunning": "领取中…",
21059
+ "channelpool.autoClaimRunHint": "马上跑一轮领取,不用等到预定时间",
20924
21060
  "channelpool.modePrefer": "优先",
20925
21061
  "channelpool.modePreferHint": "优先:总用排在前面的账号,它限流了才换下一个。",
20926
21062
  "channelpool.modeRoundRobin": "轮换",
package/lib/index.d.ts CHANGED
@@ -4837,6 +4837,15 @@ export interface Config {
4837
4837
  * for `enabledModelIds`, and it is avoided by keeping the polarity.
4838
4838
  */
4839
4839
  doubaoDisabledModels?: string[];
4840
+ /**
4841
+ * The card's 「全关」 — issue: 「豆包模型全关了但选择器还在」.
4842
+ *
4843
+ * The disable-list alone cannot carry this: an all-off that stored `[]` (the
4844
+ * card's roster had not loaded yet) reads back as "nothing disabled", and an
4845
+ * all-off that stored every id stops working the moment a NEW model appears
4846
+ * upstream. One explicit flag says exactly what the user pressed.
4847
+ */
4848
+ doubaoHideAllModels?: boolean;
4840
4849
  }
4841
4850
  /** One region's saved model selection. */
4842
4851
  export interface ModelSelectionConfig {
package/lib/index.js CHANGED
@@ -1188,7 +1188,7 @@ let cached$4;
1188
1188
  /** The reasoning ladder's numeric levels, as the vendor names them. */
1189
1189
  const LEVEL_NAMES = {
1190
1190
  3: "low",
1191
- 4: "medium",
1191
+ 4: "mid",
1192
1192
  5: "high",
1193
1193
  6: "xhigh",
1194
1194
  7: "max",
@@ -1497,11 +1497,23 @@ async function fetchLiveModels(session, options = {}) {
1497
1497
  for (const model of DOUBAO_MODELS) byId.set(model.id, model);
1498
1498
  for (const model of discovered) {
1499
1499
  if (byId.has(model.id)) {
1500
+ /**
1501
+ * Keep the known-good name; add what the SERVER published, if it has any.
1502
+ *
1503
+ * The effort ladder has to survive this merge — issue #207. Before, only
1504
+ * `badge` was copied, so every model already present in the static table
1505
+ * threw away the 低/中/高/极高/最高 it had just been handed, and the picker
1506
+ * fell back to three fixed levels. Only overwrite when the server really
1507
+ * said something: the IndexedDB-cache path carries no ladder, and an empty
1508
+ * value there must not wipe one that is already known.
1509
+ */
1500
1510
  const known = byId.get(model.id);
1501
- if (known !== void 0 && known.badge === void 0 && model.badge !== void 0) byId.set(model.id, {
1502
- ...known,
1503
- badge: model.badge
1504
- });
1511
+ if (known !== void 0) {
1512
+ const next = { ...known };
1513
+ if (known.badge === void 0 && model.badge !== void 0) next.badge = model.badge;
1514
+ if (model.efforts !== void 0 && model.efforts.length > 0) next.efforts = model.efforts;
1515
+ if (next.badge !== known.badge || next.efforts !== known.efforts) byId.set(model.id, next);
1516
+ }
1505
1517
  continue;
1506
1518
  }
1507
1519
  byId.set(model.id, model);
@@ -4452,7 +4464,8 @@ function registerDoubaoRoutes(ctx, deps) {
4452
4464
  */
4453
4465
  if (req.method === "POST") {
4454
4466
  if (deps.saveDoubaoSelection === void 0) return json$9(res, 503, { error: "settings service unavailable; doubao selection cannot be saved" });
4455
- const raw = (await readJson$1(req))["disabledModelIds"];
4467
+ const body = await readJson$1(req);
4468
+ const raw = body["disabledModelIds"];
4456
4469
  if (!Array.isArray(raw)) return json$9(res, 400, { error: "disabledModelIds must be an array" });
4457
4470
  const ids = [];
4458
4471
  for (const entry of raw) {
@@ -4460,10 +4473,19 @@ function registerDoubaoRoutes(ctx, deps) {
4460
4473
  if (!ids.includes(entry)) ids.push(entry);
4461
4474
  }
4462
4475
  try {
4463
- await deps.saveDoubaoSelection(ids);
4476
+ /**
4477
+ * `hideAll` is the card's 「全关」 button.
4478
+ *
4479
+ * It travels separately from the id list because the list cannot say
4480
+ * it: an all-off stored as `[]` (the card's roster had not loaded)
4481
+ * reads back as "nothing disabled", and one stored as "every id"
4482
+ * breaks the moment upstream adds a model.
4483
+ */
4484
+ await deps.saveDoubaoSelection(ids, body["hideAll"] === true);
4464
4485
  return json$9(res, 200, {
4465
4486
  ok: true,
4466
- disabledModelIds: ids
4487
+ disabledModelIds: ids,
4488
+ hideAll: body["hideAll"] === true
4467
4489
  });
4468
4490
  } catch (error) {
4469
4491
  return json$9(res, 500, { error: error instanceof Error ? error.message : String(error) });
@@ -4880,6 +4902,51 @@ const DOUBAO_PROVIDER_NAME = "豆包";
4880
4902
  * model, which reads as a broken channel.
4881
4903
  */
4882
4904
  const CONTEXT_WINDOW = 256e3;
4905
+ /** The ladder's display names, in the vendor's own words for this language. */
4906
+ const EFFORT_LABELS$6 = {
4907
+ low: "低",
4908
+ mid: "中",
4909
+ medium: "中",
4910
+ high: "高",
4911
+ xhigh: "极高",
4912
+ max: "最高",
4913
+ auto: "自动"
4914
+ };
4915
+ /**
4916
+ * What a model falls back to when the listing carried no ladder of its own.
4917
+ *
4918
+ * The five static rows have no `efforts`, and the picker has always shown
4919
+ * 低/中/高 for them — keeping that is what makes this change invisible to
4920
+ * anyone whose account does not publish ladders (issue #207).
4921
+ */
4922
+ const FALLBACK_EFFORTS = [
4923
+ "low",
4924
+ "mid",
4925
+ "high"
4926
+ ];
4927
+ /**
4928
+ * Three levels that sit at the same POSITIONS on whatever ladder a model has.
4929
+ *
4930
+ * Not "filter by name": Qwen 4 Max publishes 低/高/极高 (three levels, no 最高 at
4931
+ * all), so a `['low','high','max']` filter left it with two — fewer than the
4932
+ * client itself offers. Taking the first, the middle and the last gives every
4933
+ * model three levels, and the top one is always the top one it really publishes.
4934
+ */
4935
+ function collapseLadder(efforts) {
4936
+ const ladder = (efforts ?? []).filter((level) => typeof level === "string" && level !== "");
4937
+ if (ladder.length === 0) return FALLBACK_EFFORTS;
4938
+ if (ladder.length <= 3) return ladder;
4939
+ const middle = ladder[Math.floor((ladder.length - 1) / 2)];
4940
+ return [
4941
+ ladder[0],
4942
+ middle,
4943
+ ladder[ladder.length - 1]
4944
+ ];
4945
+ }
4946
+ /** The label for one level id, falling back to the id itself. */
4947
+ function effortLabel(level) {
4948
+ return EFFORT_LABELS$6[level] ?? level;
4949
+ }
4883
4950
  /** The output ceiling the lane requests. */
4884
4951
  const MAX_OUTPUT_TOKENS$1 = 65536;
4885
4952
  /**
@@ -4936,6 +5003,15 @@ var DoubaoHostAdapter = class extends LlmAdapter {
4936
5003
  };
4937
5004
  }
4938
5005
  async listModels(_provider) {
5006
+ /**
5007
+ * 「全关」 is an explicit state, not a very long disable-list — see the
5008
+ * `hideAll` option. Answered before the session read so it holds even when
5009
+ * the listing itself cannot be fetched.
5010
+ */
5011
+ if (this.options.hideAll?.() === true) {
5012
+ this.cached = void 0;
5013
+ return [];
5014
+ }
4939
5015
  const session = this.options.session();
4940
5016
  /**
4941
5017
  * No session, no models — issue #169.
@@ -5001,11 +5077,15 @@ var DoubaoHostAdapter = class extends LlmAdapter {
5001
5077
  const prompt = system === "" ? body : `${system}\n\n${body}`;
5002
5078
  if (prompt === "") throw new LlmError("这条请求没有可发送的文字", "invalid");
5003
5079
  const requested = options["reasoningEffort"];
5004
- const level = typeof requested === "string" && [
5005
- "low",
5006
- "mid",
5007
- "high"
5008
- ].includes(requested) ? requested : "mid";
5080
+ /**
5081
+ * Accept every level the vendor publishes — issue #207.
5082
+ *
5083
+ * The whitelist used to be the literal `['low','mid','high']`, so a picker
5084
+ * showing 极高/最高 still had them silently downgraded to 中 on the way out:
5085
+ * the display and the wire disagreed. `DOUBAO_REASONING_LEVELS` is the same
5086
+ * table the picker's labels come from, so the two cannot drift.
5087
+ */
5088
+ const level = typeof requested === "string" && DOUBAO_REASONING_LEVELS.some((entry) => entry.id === requested) ? requested : "mid";
5009
5089
  const signal = options["signal"] instanceof AbortSignal ? options["signal"] : new AbortController().signal;
5010
5090
  const textQueue = [];
5011
5091
  const reasoningQueue = [];
@@ -5073,23 +5153,29 @@ var DoubaoHostAdapter = class extends LlmAdapter {
5073
5153
  inputModalities: ["text", "image"],
5074
5154
  defaultMaxTokens: MAX_OUTPUT_TOKENS$1,
5075
5155
  context: { contextWindow: model.contextWindow ?? CONTEXT_WINDOW },
5076
- reasoning: {
5077
- efforts: [
5078
- {
5079
- id: ReasoningEffortId("low"),
5080
- name: "低"
5081
- },
5082
- {
5083
- id: ReasoningEffortId("mid"),
5084
- name: "中"
5085
- },
5086
- {
5087
- id: ReasoningEffortId("high"),
5088
- name: "高"
5089
- }
5090
- ],
5091
- defaultEffort: ReasoningEffortId("mid")
5092
- },
5156
+ /**
5157
+ * The ladder each model actually publishes — issue #207.
5158
+ *
5159
+ * This used to be a hard-coded 低/中/高 for every row, so Kimi's 最高 and
5160
+ * Qwen's 极高 were unreachable from the picker even though the client's own
5161
+ * menu had been parsed into `efforts` all along. `collapseLadder` keeps
5162
+ * three levels for the picker but takes them from the model's real list.
5163
+ *
5164
+ * `reasoning: false` (豆包快速) carries no ladder at all: offering a
5165
+ * thinking control for a model that does not think is worse than offering
5166
+ * none.
5167
+ */
5168
+ ...model.reasoning === false ? {} : (() => {
5169
+ const levels = collapseLadder(model.efforts);
5170
+ const middle = levels[Math.floor((levels.length - 1) / 2)];
5171
+ return {
5172
+ efforts: levels.map((level) => ({
5173
+ id: ReasoningEffortId(level),
5174
+ name: effortLabel(level)
5175
+ })),
5176
+ defaultEffort: ReasoningEffortId(middle)
5177
+ };
5178
+ })(),
5093
5179
  ...rate === void 0 ? {} : { tags: [{
5094
5180
  text: rate,
5095
5181
  tone: free ? "free" : "price"
@@ -29220,7 +29306,7 @@ function parseBody(body) {
29220
29306
  *
29221
29307
  * @module dsh-xdpool/version
29222
29308
  */
29223
- const POOL_VERSION = "3.0.1";
29309
+ const POOL_VERSION = "3.0.3";
29224
29310
  //#endregion
29225
29311
  //#region src/update-check.ts
29226
29312
  /**
@@ -31597,28 +31683,50 @@ function pruneOldBackups(root, keep = 5, keepPath) {
31597
31683
  *
31598
31684
  * WHAT THIS DOES
31599
31685
  *
31600
- * A newer version is downloaded from the npm registry to a local file, and the profile's
31601
- * dependency is pointed at it with a `file:` spec. On the next start the host installs from that
31602
- * file. Nothing is written outside the profile's own directory, and nothing is changed if the
31603
- * download fails — a half-applied update is worse than an unapplied one.
31686
+ * A newer version is downloaded from the npm registry and checked, and then the
31687
+ * profile's dependency is set to that VERSION NUMBER — the ordinary registry
31688
+ * spec, not a path. On the next start the host installs that version. Nothing is
31689
+ * written outside the profile's own directory, and nothing is changed if the
31690
+ * download or the check fails — a half-applied update is worse than an
31691
+ * unapplied one.
31604
31692
  *
31605
31693
  * 更新前自动备份:改 package.json 之前,插件的全部数据(账号池、API Key、路由链、各渠道会话、
31606
31694
  * channel-pack 状态、宿主 settings 文档)先复制到 `<插件数据目录>/pre-update/<旧版本>-<时间>/`,
31607
31695
  * 原 spec 写进那里的 restore.json,只保留最近 5 份。复制失败就中止更新,package.json 不动。
31608
31696
  * 回退见 `pre-update-backup.ts` 的 rollbackPackageSpec 和备份目录里的「回退说明.txt」。
31609
31697
  *
31610
- * WHY `file:` AND NOT THE PUBLISHED VERSION
31611
- *
31612
- * Naming the version (`"dsh-xdpool": "2.7.5"`) makes the host fetch from the registry on every
31613
- * start, which fails on a machine whose registry is proxied or slow — and the failure mode is a
31614
- * plugin that does not load. Pinning the tarball that was just verified to download keeps the
31615
- * update as local as the install it replaces.
31698
+ * WHY THE VERSION NUMBER AND NOT A `file:` PATH (it used to be the other way)
31699
+ *
31700
+ * This used to point the profile at the tarball it had just downloaded
31701
+ * (`"dsh-xdpool": "file:C:/Users/…/Temp/dsh-xdpool-3.0.1.tgz"`), on the theory
31702
+ * that a registry spec makes the host re-fetch on every start and a slow or
31703
+ * proxied registry would leave the plugin unloadable. Three things went wrong
31704
+ * with that, all of them reported by users:
31705
+ *
31706
+ * 1. **The plugin market read it as a local development install.** Its rule is
31707
+ * `link:`/`file:` ⇒ "locally developed", and a locally developed plugin does
31708
+ * not update from the registry — so the entry showed 「本地开发」 and the
31709
+ * next update had nothing to update against.
31710
+ * 2. **The path was in the OS temp directory.** A cleanup deleted the tarball
31711
+ * and the profile then pointed at a file that no longer existed: a plugin
31712
+ * that fails to load on the next start, with no obvious cause.
31713
+ * 3. **The version shown kept disagreeing with the package.** The market read
31714
+ * the spec's file name while the loaded bundle reported its own constant,
31715
+ * so 「3.0.1.tgz 但是版本号 3.0.0」 was a reachable state.
31716
+ *
31717
+ * The original worry is handled by pnpm itself: once the version is installed,
31718
+ * its store holds the tarball, so a restart does not need the network at all.
31719
+ * The download below is therefore a PRE-CHECK — it proves the registry is
31720
+ * reachable and the package is a real gzip before anything is written — rather
31721
+ * than the thing being installed.
31616
31722
  *
31617
31723
  * A RESTART IS REQUIRED, AND SAYS SO
31618
31724
  *
31619
- * Modules already loaded cannot be swapped in place. The panel reports `restartRequired` and the
31620
- * user restarts when convenient — claiming the update took effect immediately would be a lie the
31621
- * user discovers on the next crash.
31725
+ * Modules already loaded cannot be swapped in place. The panel reports
31726
+ * `restartRequired` and the user restarts when convenient — claiming the update
31727
+ * took effect immediately would be a lie the user discovers on the next crash.
31728
+ * (The host does reload plugin code between sessions; a running window keeps the
31729
+ * modules it started with.)
31622
31730
  *
31623
31731
  * @module dsh-xdpool/update-install
31624
31732
  */
@@ -31748,7 +31856,19 @@ async function installVersion(version) {
31748
31856
  });
31749
31857
  return failed(chineseFailure("校验安装包失败", error));
31750
31858
  }
31751
- const newSpec = `file:${target.replaceAll("\\", "/")}`;
31859
+ /**
31860
+ * The spec the profile gets: the plain version number.
31861
+ *
31862
+ * NOT `file:<the tarball we just downloaded>`. That made the market treat this
31863
+ * as a locally developed plugin (so it stopped offering updates), pointed the
31864
+ * profile at the OS temp directory (so a cleaner broke the next start), and let
31865
+ * the displayed version drift from the running bundle. See the module note.
31866
+ *
31867
+ * The download above already proved the registry is reachable and the package
31868
+ * is intact; after installing, pnpm's store holds the tarball, so a restart
31869
+ * does not go back to the network.
31870
+ */
31871
+ const newSpec = version;
31752
31872
  const pkgPath = join(profile, "package.json");
31753
31873
  const read = readProfilePackage(pkgPath);
31754
31874
  if ("error" in read) {
@@ -37810,7 +37930,9 @@ const Config = z.object({
37810
37930
  * card needs (client writes, host reads without a restart); it is also why the
37811
37931
  * polarity matters — the default `[]` has to be the harmless answer.
37812
37932
  */
37813
- doubaoDisabledModels: asVolatile(z.array(z.string()).default([]).description("Doubao model ids switched off in the picker (mirrored from the Doubao card; empty shows the whole roster)"))
37933
+ doubaoDisabledModels: asVolatile(z.array(z.string()).default([]).description("Doubao model ids switched off in the picker (mirrored from the Doubao card; empty shows the whole roster)")),
37934
+ /** The card's 「全关」, mirrored so the picker can empty the group (see the Config doc). */
37935
+ doubaoHideAllModels: asVolatile(z.boolean().default(false).description("Hide every Doubao model in the picker (the card's 全关 switch)"))
37814
37936
  });
37815
37937
  /** Live API, published for the CLI. */
37816
37938
  let api;
@@ -38508,9 +38630,10 @@ function apply(ctx, config = {}) {
38508
38630
  * `setSetting` re-reads and throws when the document did not change, so a
38509
38631
  * refused write reaches the card as a 500 instead of looking saved.
38510
38632
  */
38511
- saveDoubaoSelection: async (ids) => {
38633
+ saveDoubaoSelection: async (ids, hideAll) => {
38512
38634
  const payload = [...ids];
38513
38635
  await setSetting("doubaoDisabledModels", payload, payload);
38636
+ await setSetting("doubaoHideAllModels", hideAll === true, hideAll === true);
38514
38637
  }
38515
38638
  });
38516
38639
  /**
@@ -38920,7 +39043,9 @@ function apply(ctx, config = {}) {
38920
39043
  * settings change is visible without re-registering anything —
38921
39044
  * unlike the pi-ai lanes, which need `invalidateCatalog`.
38922
39045
  */
38923
- disabled: () => current().doubaoDisabledModels
39046
+ disabled: () => current().doubaoDisabledModels,
39047
+ /** 「全关」 — an explicit state, not a long disable-list. */
39048
+ hideAll: () => current().doubaoHideAllModels === true
38924
39049
  }));
38925
39050
  /**
38926
39051
  * Marvis, the fifteenth channel.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "dsh-xdpool",
3
3
  "displayName": "DSH XD Pool",
4
4
  "description": "One DSH model pool for every free quota you have: merge all locally signed-in WorkBuddy accounts with auto-failover, sign in to 22 vendors by QR/web, aggregate 77 external vendors' keys, plus a usage dashboard, model routing, a local OpenAI-compatible gateway and a points-automation suite.",
5
- "version": "3.0.1",
5
+ "version": "3.0.3",
6
6
  "license": "MIT",
7
7
  "author": "XDTrees",
8
8
  "homepage": "https://github.com/XDTrees/dsh-xdpool#readme",