heybash-xdpool 1.0.7 → 1.0.9

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,5 +1,17 @@
1
1
  # Heybash
2
2
 
3
+ ## 1.0.9 — 豆包模型选择与渠道稳定性
4
+
5
+ - 同步上游豆包模型选择,支持在账号池选择模型并保留 DSH 工具调用;工作任务模型使用豆包工作额度。
6
+ - WorkBuddy 遇到风控时暂时冷却账号并切换,减少请求失败。
7
+ - 修复 TRAE 账号冷却时模型目录回退,以及 Qoder 长会话超过请求容量时的处理。
8
+ - 聚合渠道的模型倍率单独展示,方便比较用量。
9
+
10
+ ## 1.0.8 — 桌面启动修复
11
+
12
+ - 修复 1.0.7 前端包误引入 Node 模块,导致 DeepSeek Harness 桌面端启动失败。
13
+ - 增加实际执行浏览器模块工厂的回归测试,防止类似错误再次发布。
14
+
3
15
  ## 1.0.7 — 豆包直连与积分自动化
4
16
 
5
17
  - 接入豆包浏览器登录、直接对话模型及工具调用,账号池显示连接和可用额度;首次登录需要浏览器。
package/lib/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createDecipheriv, createHash, randomUUID } from "node:crypto";
2
- import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, writeFileSync } from "node:fs";
2
+ import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";
3
3
  import { chmod, copyFile, mkdir, readFile, readdir, rename, rm, unlink, writeFile, writeFile as writeFile$1 } from "node:fs/promises";
4
4
  import { homedir, platform } from "node:os";
5
5
  import { basename, dirname, join, resolve } from "node:path";
@@ -737,8 +737,20 @@ function contentOfFrame(frame) {
737
737
  * Body markers win over status, because the upstream reuses 400/200 for
738
738
  * several distinct conditions.
739
739
  */
740
+ /** Business codes the gateway uses for "this account is risk-flagged". */
741
+ const RISK_BLOCK_CODES = ["11140", "11141"];
740
742
  function classifyUpstreamError(status, body) {
741
743
  if (status === 402) return "hard_credit";
744
+ /**
745
+ * Risk control first, and only for a 403.
746
+ *
747
+ * `11140` is what the gateway returns when the ACCOUNT is flagged. It arrives with 403, so
748
+ * the blanket rule below swallowed it into `session_dead` and the card told the user their
749
+ * key was invalid — several times, since re-signing in changes nothing about a flag.
750
+ */
751
+ if (status === 403) {
752
+ for (const code of RISK_BLOCK_CODES) if (new RegExp(`"code"\\s*:\\s*"?${code}"?(?=\\s*[,}])`, "u").test(body)) return "risk_blocked";
753
+ }
742
754
  if (status === 401 || status === 403) return "session_dead";
743
755
  const lower = body.toLowerCase();
744
756
  for (const code of HARD_CREDIT_CODES) if (body.includes(`"code":${code}`) || body.includes(`"code": ${code}`) || body.includes(`"code":"${code}"`)) return "hard_credit";
@@ -5072,15 +5084,6 @@ ${new Date(until).toISOString()}
5072
5084
  };
5073
5085
  // src/doubao-catalog.ts
5074
5086
  /**
5075
- * DSH-side alias for "generate an image".
5076
- *
5077
- * NOT a Doubao `model_item_key` — Doubao has no model by this name. Selecting it
5078
- * makes the shim send an ordinary chat turn with `input_skill: imageGen`, and
5079
- * Doubao answers with Seedream. Keeping it in the catalog is what puts 生图 in
5080
- * DSH's model picker without inventing a second UI.
5081
- */
5082
- const DOUBAO_IMAGE_MODEL_ID = "image-gen";
5083
- /**
5084
5087
  * IMAGEGEN_LABEL_OVERLAY: 生图版本名以插件根目录的 image-models.json 为准,
5085
5088
  * 该文件由 doubao_imagemodels.py --sync 从服务端 get_item_conf 生成。
5086
5089
  */
@@ -5093,70 +5096,118 @@ function imageModelLabelFromOverlay() {
5093
5096
  return;
5094
5097
  }
5095
5098
  }
5096
- /**
5097
- * The entries DSH may offer.
5098
- *
5099
- * WHY THESE ENTRIES. Doubao groups models by MODE, and the model list is per-mode:
5100
- *
5101
- * 对话 → 豆包 快速 (0), 豆包 2.1 Turbo·专家 (3)
5102
- * 工作任务 → 自动 (9), 2.1 Lite (seed-lite-7b), 2.1 Pro (5), Turbo (3)
5103
- *
5104
- * The 「工作任务」 group (`seed-lite-7b`, `5`, `9`) runs through `Agent-GeneralTask`
5105
- * (`mode_id: "3"`, `agent_mode: 1`) and is accompanied by an HTTP `tool_local`
5106
- * workspace responder (`msg/ack` -> `upload_command_result` -> `msg/complete`)
5107
- * so external turns complete without `710010702`.
5108
- *
5109
- * MEASURED, 2026-10-22: `model_item_key` is forwarded verbatim (the server stores
5110
- * it on the message), but in 对话 mode it does NOT change what answers —
5111
- * 0 / 3 / 5 / seed-lite-7b AND a deliberately bogus key all returned answers of
5112
- * indistinguishable length and latency (12.3–14.0 s). So this list is honest
5113
- * about what the PICKER can offer; it does not claim per-key routing.
5114
- *
5115
- * 「豆包 快速」 leads because it is the app's own chat-mode default, so an
5116
- * unconfigured install reproduces the app rather than something that merely
5117
- * happens to work.
5118
- */
5119
- const DOUBAO_MODELS = [
5099
+ imageModelLabelFromOverlay();
5100
+ randomUUID();
5101
+ // src/doubao-local-models.ts
5102
+ /** Read the model menu saved by Doubao Work. Menu presence does not prove routing. */
5103
+ const record = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
5104
+ /** Parse only the documented menu path; never return other profile contents. */
5105
+ function parseDoubaoModelPreferences(raw) {
5106
+ try {
5107
+ const prefs = record(JSON.parse(raw));
5108
+ const saman = record(prefs?.["saman"]);
5109
+ const cached = record(saman?.["local_storage_for_web"])?.["frontend-request-cache"];
5110
+ if (typeof cached !== "string") return [];
5111
+ const root = record(JSON.parse(cached));
5112
+ const entry = record(root?.["_DesktopActionBarBriefListRequestCacheDataV1"]);
5113
+ const data = record(entry?.["data"]);
5114
+ const mode = record(data?.["modeSelectData"]);
5115
+ const menu = record(mode?.["menuConfV2"]);
5116
+ const list = record(menu?.["model_list"])?.["item_list"];
5117
+ if (!Array.isArray(list)) return [];
5118
+ const out = [];
5119
+ const seen = /* @__PURE__ */ new Set();
5120
+ for (const value of list) {
5121
+ const row = record(value);
5122
+ const id = row?.["model_item_key"];
5123
+ const name = row?.["name"];
5124
+ if (typeof id !== "string" || !/^[\w.-]{1,64}$/u.test(id) || typeof name !== "string" || name.trim() === "" || name.length > 100 || seen.has(id)) continue;
5125
+ seen.add(id);
5126
+ const sourceMode = row?.["default_mode"];
5127
+ const modeValue = sourceMode === "1" ? "chat" : sourceMode === "3" ? "work" : "unknown";
5128
+ const tags = row?.["tag_list"];
5129
+ const rate = Array.isArray(tags) ? tags.map((tag) => record(tag)?.["text"]).find((text) => typeof text === "string" && text.trim() !== "") : void 0;
5130
+ const opts = record(row?.["reasoning_effort_config"])?.["option_list"];
5131
+ const levels = [];
5132
+ if (Array.isArray(opts)) for (const candidate of opts) {
5133
+ const option = record(candidate), level = option?.["level"], label = option?.["name"];
5134
+ if (typeof level === "number" && Number.isSafeInteger(level) && typeof label === "string" && label.trim() !== "" && !levels.some((item) => item.level === level)) levels.push({
5135
+ level,
5136
+ name: label
5137
+ });
5138
+ }
5139
+ out.push({
5140
+ id,
5141
+ name,
5142
+ mode: modeValue,
5143
+ ...typeof rate === "string" ? { rate } : {},
5144
+ ...levels.length ? { reasoning: levels } : {}
5145
+ });
5146
+ }
5147
+ return out;
5148
+ } catch {
5149
+ return [];
5150
+ }
5151
+ }
5152
+ /** Read a local client menu as an optional hint; never access cookies or session files. */
5153
+ function discoverDoubaoLocalModels(options = {}) {
5154
+ const local = process.env["LOCALAPPDATA"], roaming = process.env["APPDATA"];
5155
+ const dirs = options.paths ?? [
5156
+ join(homedir(), "Library", "Application Support", "DoubaoWork", "Default", "Preferences"),
5157
+ join(homedir(), "Library", "Application Support", "Doubao", "Default", "Preferences"),
5158
+ ...local ? [join(local, "Doubao", "User Data", "Default", "Preferences"), join(local, "DoubaoWork", "User Data", "Default", "Preferences")] : [],
5159
+ ...roaming ? [join(roaming, "Doubao", "Default", "Preferences"), join(roaming, "DoubaoWork", "Default", "Preferences")] : []
5160
+ ];
5161
+ for (const path of dirs) try {
5162
+ if (statSync(path).size > 16777216) continue;
5163
+ const models = parseDoubaoModelPreferences(readFileSync(path, "utf8"));
5164
+ if (models.length > 0) return models;
5165
+ } catch {}
5166
+ return [];
5167
+ }
5168
+ // src/doubao-model-store.ts
5169
+ const fallback = [
5120
5170
  {
5121
5171
  id: "0",
5122
5172
  name: "豆包 快速",
5123
- reasoning: false
5173
+ mode: "chat"
5124
5174
  },
5125
5175
  {
5126
5176
  id: "3",
5127
5177
  name: "豆包 2.1 Turbo",
5128
- badge: "专家",
5129
- reasoning: true
5178
+ mode: "chat"
5130
5179
  },
5131
5180
  {
5132
5181
  id: "seed-lite-7b",
5133
5182
  name: "豆包 2.1 Lite",
5134
- badge: "工作任务",
5135
- reasoning: true,
5136
- taskMode: true
5183
+ mode: "work"
5137
5184
  },
5138
5185
  {
5139
5186
  id: "5",
5140
5187
  name: "豆包 2.1 Pro",
5141
- badge: "工作任务",
5142
- reasoning: true,
5143
- taskMode: true
5188
+ mode: "work"
5144
5189
  },
5145
5190
  {
5146
5191
  id: "9",
5147
5192
  name: "自动",
5148
- badge: "工作任务",
5149
- reasoning: true,
5150
- taskMode: true
5193
+ mode: "work"
5151
5194
  },
5152
5195
  {
5153
- id: DOUBAO_IMAGE_MODEL_ID,
5154
- name: imageModelLabelFromOverlay() ?? "豆包 生图(Seedream 5.5)",
5155
- reasoning: true
5196
+ id: "image-gen",
5197
+ name: "豆包 生图",
5198
+ mode: "chat"
5156
5199
  }
5157
5200
  ];
5158
- randomUUID();
5159
- DOUBAO_MODELS.filter((model) => model.id === "0" || model.id === "3");
5201
+ /** Never merge unknown-mode entries: their actual routing is not known. */
5202
+ function doubaoModelCatalog(local = discoverDoubaoLocalModels()) {
5203
+ const entries = new Map(fallback.map((model) => [model.id, model]));
5204
+ for (const model of local) {
5205
+ if (model.mode === "unknown") continue;
5206
+ entries.set(model.id, model);
5207
+ }
5208
+ return [...entries.values()];
5209
+ }
5210
+ doubaoModelCatalog([]).filter((model) => model.id === "0" || model.id === "3");
5160
5211
  Object.freeze([
5161
5212
  "priority",
5162
5213
  "round-robin",
package/lib/client.js CHANGED
@@ -4,32 +4,8 @@ window.__ModuleLoader__.load({
4
4
  var module = { exports: {} };
5
5
  var exports = module.exports;
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
- // \0rolldown/runtime.js
8
- var __create = Object.create;
9
- var __defProp = Object.defineProperty;
10
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
- var __getOwnPropNames = Object.getOwnPropertyNames;
12
- var __getProtoOf = Object.getPrototypeOf;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
16
- key = keys[i];
17
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
- get: ((k) => from[k]).bind(null, key),
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- return to;
23
- };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
25
- value: mod,
26
- enumerable: true
27
- }) : target, mod));
28
7
  let react = require("react");
29
8
  let react_jsx_runtime = require("react/jsx-runtime");
30
- let node_crypto = require("node:crypto");
31
- node_crypto = __toESM(node_crypto, 1);
32
- let node_fs = require("node:fs");
33
9
  let react_dom = require("react-dom");
34
10
  // src/client/sidebar-row.ts
35
11
  /**
@@ -257,6 +233,8 @@ window.__ModuleLoader__.load({
257
233
  const POOL_DOUBAO_SESSION_PATH = "/plugins/dsh-xdpool/doubao/session";
258
234
  /** The Doubao quota: the windows the account has, with their reset countdowns. */
259
235
  const POOL_DOUBAO_QUOTA_PATH = "/plugins/dsh-xdpool/doubao/quota";
236
+ /** Model menu and persisted selection. */
237
+ const POOL_DOUBAO_MODELS_PATH = "/plugins/dsh-xdpool/doubao/models";
260
238
  /**
261
239
  * The `reason` the channel document carries when the login-channel route is
262
240
  * already owned by another plugin.
@@ -827,6 +805,7 @@ window.__ModuleLoader__.load({
827
805
  .dsm-xdpool-cpool-modelname{user-select:none;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
828
806
  .dsm-xdpool-cpool-tag{font-size:10px;padding:1px 6px;border-radius:8px;border:1px solid var(--dsw-alias-border-l2,#36373b);color:var(--dsw-alias-label-tertiary,#9aa0a8);flex:none}
829
807
  .dsm-xdpool-cpool-tag[data-tone=free]{border-color:color-mix(in srgb, #2fbf7f 45%, transparent);color:#2fbf7f}
808
+ .dsm-xdpool-cpool-tag[data-tone=price]{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-secondary,#c6c9d0)}
830
809
  .dsm-xdpool-cpool-tag[data-tone=dead]{border-color:color-mix(in srgb, #e5484d 45%, transparent);color:#ff8a8f}
831
810
  /* One line under an empty or fully-filtered list. Both cases print it, because
832
811
  "nothing published" and "nothing matched your search" must not look alike. */
@@ -2927,6 +2906,30 @@ window.__ModuleLoader__.load({
2927
2906
  if (facts.supportedEfforts !== void 0) out.efforts = facts.supportedEfforts.join(" / ");
2928
2907
  return out;
2929
2908
  }
2909
+ /**
2910
+ * The model name without the trailing price.
2911
+ *
2912
+ * Vendor names are `Name · x0.11` (or `· 免费`, or a range `· x0.12→x0.06`). The price is
2913
+ * rendered as its own badge, so it is removed here rather than printed twice.
2914
+ */
2915
+ function baseName(name) {
2916
+ return name.replace(/\s*[·・]\s*(?:x\s*[\d.]+(?:\s*→\s*x?[\d.]+)?|免费|限时免费|正式版.*)$/iu, "").trim();
2917
+ }
2918
+ /**
2919
+ * The multiplier text, or undefined when the vendor published none.
2920
+ *
2921
+ * Returning the raw string rather than a number is deliberate: `x0.12→x0.06` is a promotion in
2922
+ * progress and `免费` is not a multiplier at all, and flattening either into a number would state
2923
+ * something the vendor did not.
2924
+ */
2925
+ function multiplierOf(name) {
2926
+ if (name === void 0) return void 0;
2927
+ return /[·・]\s*(x\s*[\d.]+(?:\s*→\s*x?[\d.]+)?|免费|限时免费)/iu.exec(name)?.[1]?.trim();
2928
+ }
2929
+ /** How a multiplier reads at a glance: free is its own colour, everything else stays quiet. */
2930
+ function multiplierTone(text) {
2931
+ return /免费/u.test(text) || /^x\s*0*\.?0+$/iu.test(text) ? "free" : "price";
2932
+ }
2930
2933
  // src/client/model-facts-row.tsx
2931
2934
  /** One labelled figure, omitted entirely when the value is unknown. */
2932
2935
  function Figure({ label, value, title }) {
@@ -11682,6 +11685,9 @@ window.__ModuleLoader__.load({
11682
11685
  const [error, setError] = (0, react.useState)(void 0);
11683
11686
  const [windows, setWindows] = (0, react.useState)([]);
11684
11687
  const [exhausted, setExhausted] = (0, react.useState)(false);
11688
+ const [models, setModels] = (0, react.useState)([]);
11689
+ const [disabledIds, setDisabledIds] = (0, react.useState)([]);
11690
+ const [modelBusy, setModelBusy] = (0, react.useState)(false);
11685
11691
  const mounted = (0, react.useRef)(true);
11686
11692
  const poll = (0, react.useRef)(void 0);
11687
11693
  (0, react.useEffect)(() => {
@@ -11691,6 +11697,37 @@ window.__ModuleLoader__.load({
11691
11697
  if (poll.current !== void 0) window.clearTimeout(poll.current);
11692
11698
  };
11693
11699
  }, []);
11700
+ const loadModels = (0, react.useCallback)(async () => {
11701
+ const response = await fetch(POOL_DOUBAO_MODELS_PATH, { credentials: "same-origin" });
11702
+ const value = await response.json();
11703
+ if (!response.ok || value.ok !== true) throw new Error(value.error ?? "读取豆包模型失败");
11704
+ if (mounted.current) {
11705
+ setModels(Array.isArray(value.models) ? value.models : []);
11706
+ setDisabledIds(Array.isArray(value.disabledIds) ? value.disabledIds : []);
11707
+ }
11708
+ }, []);
11709
+ const saveModels = (0, react.useCallback)(async (next) => {
11710
+ setModelBusy(true);
11711
+ setError(void 0);
11712
+ try {
11713
+ const response = await fetch(POOL_DOUBAO_MODELS_PATH, {
11714
+ method: "PUT",
11715
+ credentials: "same-origin",
11716
+ headers: { "content-type": "application/json" },
11717
+ body: JSON.stringify({ disabled: next })
11718
+ });
11719
+ const value = await response.json();
11720
+ if (!response.ok || value.ok !== true) throw new Error(value.error ?? "保存豆包模型失败");
11721
+ if (mounted.current) {
11722
+ setModels(Array.isArray(value.models) ? value.models : []);
11723
+ setDisabledIds(Array.isArray(value.disabledIds) ? value.disabledIds : []);
11724
+ }
11725
+ } catch (cause) {
11726
+ if (mounted.current) setError(cause instanceof Error ? cause.message : String(cause));
11727
+ } finally {
11728
+ if (mounted.current) setModelBusy(false);
11729
+ }
11730
+ }, []);
11694
11731
  /** Read the session and, when there is one, the quota. */
11695
11732
  const load = (0, react.useCallback)(async () => {
11696
11733
  try {
@@ -11700,8 +11737,10 @@ window.__ModuleLoader__.load({
11700
11737
  setSignedIn(signed);
11701
11738
  if (!signed) {
11702
11739
  setWindows([]);
11740
+ setModels([]);
11703
11741
  return;
11704
11742
  }
11743
+ await loadModels();
11705
11744
  const quota = await (await fetch(POOL_DOUBAO_QUOTA_PATH, { credentials: "same-origin" })).json().catch(() => void 0);
11706
11745
  if (!mounted.current) return;
11707
11746
  setWindows(Array.isArray(quota?.windows) ? quota.windows : []);
@@ -11710,7 +11749,7 @@ window.__ModuleLoader__.load({
11710
11749
  } catch (cause) {
11711
11750
  if (mounted.current) setError(cause instanceof Error ? cause.message : String(cause));
11712
11751
  }
11713
- }, []);
11752
+ }, [loadModels]);
11714
11753
  /** Open the sign-in browser and wait for it. */
11715
11754
  const signIn = (0, react.useCallback)(async () => {
11716
11755
  setError(void 0);
@@ -11747,6 +11786,7 @@ window.__ModuleLoader__.load({
11747
11786
  if (!mounted.current) return;
11748
11787
  setSignedIn(false);
11749
11788
  setWindows([]);
11789
+ setModels([]);
11750
11790
  setMessage("已退出登录");
11751
11791
  } catch (cause) {
11752
11792
  if (mounted.current) setError(cause instanceof Error ? cause.message : String(cause));
@@ -11854,9 +11894,49 @@ window.__ModuleLoader__.load({
11854
11894
  ]
11855
11895
  }, `${window.type ?? "w"}-${String(index)}`);
11856
11896
  }),
11857
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
11858
- className: "dsm-xdpool-doubao-hint",
11859
- children: t?.("doubao.modelsNote") ?? "模型在对话的模型选择器里:豆包 快速 / 2.1 Turbo。"
11897
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11898
+ className: "dsm-xdpool-doubao-models",
11899
+ children: [
11900
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11901
+ className: "dsm-xdpool-doubao-models-head",
11902
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t?.("doubao.modelsTitle") ?? "模型选择" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
11903
+ type: "button",
11904
+ className: "dsm-xdpool-doubao-btn",
11905
+ disabled: modelBusy || models.length === 0,
11906
+ onClick: () => {
11907
+ const allEnabled = models.every((model) => model.enabled);
11908
+ const next = new Set(disabledIds);
11909
+ for (const model of models) if (allEnabled) next.add(model.id);
11910
+ else next.delete(model.id);
11911
+ saveModels([...next]);
11912
+ },
11913
+ children: models.length > 0 && models.every((model) => model.enabled) ? t?.("doubao.disableAll") ?? "全部关闭" : t?.("doubao.enableAll") ?? "全部开启"
11914
+ })]
11915
+ }),
11916
+ models.map((model) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
11917
+ className: "dsm-xdpool-doubao-model",
11918
+ children: [
11919
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
11920
+ type: "checkbox",
11921
+ checked: model.enabled,
11922
+ disabled: modelBusy,
11923
+ onChange: (event) => {
11924
+ const next = new Set(disabledIds);
11925
+ if (event.currentTarget.checked) next.delete(model.id);
11926
+ else next.add(model.id);
11927
+ saveModels([...next]);
11928
+ }
11929
+ }),
11930
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: model.name }),
11931
+ model.mode === "work" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: t?.("doubao.workMode") ?? "工作任务" }) : null,
11932
+ model.rate ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: model.rate }) : null
11933
+ ]
11934
+ }, model.id)),
11935
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
11936
+ className: "dsm-xdpool-doubao-hint",
11937
+ children: t?.("doubao.modelsHint") ?? "勾选的模型会出现在对话模型选择器中;工作任务模型使用豆包工作额度。"
11938
+ })
11939
+ ]
11860
11940
  })
11861
11941
  ] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
11862
11942
  className: "dsm-xdpool-doubao-hint",
@@ -11868,6 +11948,10 @@ window.__ModuleLoader__.load({
11868
11948
  /** The card's own stylesheet, travelling with the component. */
11869
11949
  const DOUBAO_CSS = `
11870
11950
  .dsm-xdpool-doubao{display:flex;flex-direction:column;gap:11px;padding:14px 16px 16px;border-radius:14px;border:1px solid color-mix(in srgb, var(--dsw-alias-border-l2,#ffffff1f) 82%, transparent);background:color-mix(in srgb, var(--dsw-alias-bg-layer-2,#1c1e22) 70%, transparent)}
11951
+ .dsm-xdpool-doubao-models{display:flex;flex-direction:column;gap:8px;margin-top:6px}
11952
+ .dsm-xdpool-doubao-models-head{display:flex;align-items:center;justify-content:space-between}
11953
+ .dsm-xdpool-doubao-model{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--dsw-alias-label-primary,#e8eaf0)}
11954
+ .dsm-xdpool-doubao-model small{color:var(--dsw-alias-label-tertiary,#8a90a0)}
11871
11955
  .dsm-xdpool-doubao-head{display:flex;align-items:flex-start;gap:12px;flex-wrap:wrap}
11872
11956
  .dsm-xdpool-doubao-id{display:flex;align-items:center;gap:10px;min-width:0}
11873
11957
  .dsm-xdpool-doubao-mark{width:34px;height:34px;border-radius:9px;display:grid;place-items:center;font-size:12px;font-weight:700;letter-spacing:.02em;color:#fff;background:linear-gradient(135deg,#4B7BF5,#2E5BD8);flex:none}
@@ -12235,108 +12319,6 @@ window.__ModuleLoader__.load({
12235
12319
  if (model.multiplier !== 0) return void 0;
12236
12320
  return paidSiblingOf(model, models);
12237
12321
  }
12238
- // src/doubao-catalog.ts
12239
- /**
12240
- * DSH-side alias for "generate an image".
12241
- *
12242
- * NOT a Doubao `model_item_key` — Doubao has no model by this name. Selecting it
12243
- * makes the shim send an ordinary chat turn with `input_skill: imageGen`, and
12244
- * Doubao answers with Seedream. Keeping it in the catalog is what puts 生图 in
12245
- * DSH's model picker without inventing a second UI.
12246
- */
12247
- const DOUBAO_IMAGE_MODEL_ID = "image-gen";
12248
- /**
12249
- * IMAGEGEN_LABEL_OVERLAY: 生图版本名以插件根目录的 image-models.json 为准,
12250
- * 该文件由 doubao_imagemodels.py --sync 从服务端 get_item_conf 生成。
12251
- */
12252
- function imageModelLabelFromOverlay() {
12253
- try {
12254
- const url = new URL("../image-models.json", require("url").pathToFileURL(__filename).href);
12255
- const parsed = JSON.parse((0, node_fs.readFileSync)(url, "utf8"));
12256
- return typeof parsed.label === "string" && parsed.label !== "" ? parsed.label : void 0;
12257
- } catch {
12258
- return;
12259
- }
12260
- }
12261
- /**
12262
- * The entries DSH may offer.
12263
- *
12264
- * WHY THESE ENTRIES. Doubao groups models by MODE, and the model list is per-mode:
12265
- *
12266
- * 对话 → 豆包 快速 (0), 豆包 2.1 Turbo·专家 (3)
12267
- * 工作任务 → 自动 (9), 2.1 Lite (seed-lite-7b), 2.1 Pro (5), Turbo (3)
12268
- *
12269
- * The 「工作任务」 group (`seed-lite-7b`, `5`, `9`) runs through `Agent-GeneralTask`
12270
- * (`mode_id: "3"`, `agent_mode: 1`) and is accompanied by an HTTP `tool_local`
12271
- * workspace responder (`msg/ack` -> `upload_command_result` -> `msg/complete`)
12272
- * so external turns complete without `710010702`.
12273
- *
12274
- * MEASURED, 2026-10-22: `model_item_key` is forwarded verbatim (the server stores
12275
- * it on the message), but in 对话 mode it does NOT change what answers —
12276
- * 0 / 3 / 5 / seed-lite-7b AND a deliberately bogus key all returned answers of
12277
- * indistinguishable length and latency (12.3–14.0 s). So this list is honest
12278
- * about what the PICKER can offer; it does not claim per-key routing.
12279
- *
12280
- * 「豆包 快速」 leads because it is the app's own chat-mode default, so an
12281
- * unconfigured install reproduces the app rather than something that merely
12282
- * happens to work.
12283
- */
12284
- const DOUBAO_MODELS = [
12285
- {
12286
- id: "0",
12287
- name: "豆包 快速",
12288
- reasoning: false
12289
- },
12290
- {
12291
- id: "3",
12292
- name: "豆包 2.1 Turbo",
12293
- badge: "专家",
12294
- reasoning: true
12295
- },
12296
- {
12297
- id: "seed-lite-7b",
12298
- name: "豆包 2.1 Lite",
12299
- badge: "工作任务",
12300
- reasoning: true,
12301
- taskMode: true
12302
- },
12303
- {
12304
- id: "5",
12305
- name: "豆包 2.1 Pro",
12306
- badge: "工作任务",
12307
- reasoning: true,
12308
- taskMode: true
12309
- },
12310
- {
12311
- id: "9",
12312
- name: "自动",
12313
- badge: "工作任务",
12314
- reasoning: true,
12315
- taskMode: true
12316
- },
12317
- {
12318
- id: DOUBAO_IMAGE_MODEL_ID,
12319
- name: imageModelLabelFromOverlay() ?? "豆包 生图(Seedream 5.5)",
12320
- reasoning: true
12321
- }
12322
- ];
12323
- (0, node_crypto.randomUUID)();
12324
- // src/doubao-llm.ts
12325
- /** The listings, derived from the catalog the reference implementation measured. */
12326
- function doubaoListing() {
12327
- const rows = [];
12328
- for (const model of DOUBAO_MODELS) {
12329
- const parts = [];
12330
- if (typeof model.badge === "string" && model.badge !== "") parts.push(model.badge);
12331
- if (model.reasoning === true) parts.push("推理");
12332
- rows.push({
12333
- id: model.id,
12334
- name: model.name,
12335
- ...parts.length === 0 ? {} : { description: parts.join(" · ") }
12336
- });
12337
- }
12338
- return rows;
12339
- }
12340
12322
  // src/client/ChannelPoolSection.tsx
12341
12323
  /**
12342
12324
  * Account-pool page, scan-channel section.
@@ -12366,6 +12348,13 @@ window.__ModuleLoader__.load({
12366
12348
  *
12367
12349
  * @module dsh-xdpool/client/ChannelPoolSection
12368
12350
  */
12351
+ const doubaoListing = () => [{
12352
+ id: "0",
12353
+ name: "豆包 快速"
12354
+ }, {
12355
+ id: "3",
12356
+ name: "豆包 2.1 Turbo"
12357
+ }];
12369
12358
  let poolSnapshot;
12370
12359
  /**
12371
12360
  * `provider.status` answered recently, kept across unmounts.
@@ -13409,7 +13398,12 @@ window.__ModuleLoader__.load({
13409
13398
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
13410
13399
  className: "dsm-xdpool-cpool-modelname",
13411
13400
  title: model.id,
13412
- children: model.name ?? model.id
13401
+ children: baseName(model.name ?? model.id)
13402
+ }),
13403
+ multiplierOf(model.name) === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
13404
+ className: "dsm-xdpool-cpool-tag",
13405
+ "data-tone": multiplierTone(multiplierOf(model.name) ?? ""),
13406
+ children: multiplierOf(model.name)
13413
13407
  }),
13414
13408
  model.isFree === true && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
13415
13409
  className: "dsm-xdpool-cpool-tag",
@@ -13896,7 +13890,7 @@ window.__ModuleLoader__.load({
13896
13890
  }
13897
13891
  // src/version.ts
13898
13892
  /** Version embedded in the browser bundle at build time from the package manifest. */
13899
- const POOL_VERSION = "1.0.7";
13893
+ const POOL_VERSION = "1.0.9";
13900
13894
  // src/client/PoolCard.tsx
13901
13895
  /**
13902
13896
  * Heybash card contributed to DSH Plugin configuration.
@@ -17296,13 +17290,18 @@ window.__ModuleLoader__.load({
17296
17290
  "agg.models": "{count} models",
17297
17291
  "agg.unsupported": "This vendor signs in via OAuth/ADC, which this lane cannot drive.",
17298
17292
  "doubao.ready": "Signed in; the session is stored locally",
17299
- "doubao.sub": "Sign in with a browser to use direct chat models",
17293
+ "doubao.sub": "Sign in with a browser to use Doubao models",
17300
17294
  "doubao.signIn": "Sign in with a browser",
17301
17295
  "doubao.signOut": "Sign out",
17302
17296
  "doubao.waiting": "Waiting for sign-in…",
17303
17297
  "doubao.refresh": "Refresh quota",
17304
17298
  "doubao.why": "Doubao has closed third-party QR login (the server answers 2035), so this opens a browser window: scan or enter a phone number there, and the session is taken back and stored on this machine.",
17305
- "doubao.modelsNote": "The models are in the conversation picker: Doubao Quick / 2.1 Turbo.",
17299
+ "doubao.modelsNote": "The models are in the conversation picker.",
17300
+ "doubao.modelsTitle": "Models",
17301
+ "doubao.enableAll": "Enable all",
17302
+ "doubao.disableAll": "Disable all",
17303
+ "doubao.workMode": "Work task",
17304
+ "doubao.modelsHint": "Enabled models appear in the conversation picker; work-task models use Doubao Work quota.",
17306
17305
  "agg.listingYes": "Model list available",
17307
17306
  "agg.saved": "Saved",
17308
17307
  "agg.cleared": "Cleared",
@@ -17900,13 +17899,18 @@ window.__ModuleLoader__.load({
17900
17899
  "agg.models": "{count} 个模型",
17901
17900
  "agg.unsupported": "该厂商需要 OAuth/ADC 授权,这条通道暂时接不了。",
17902
17901
  "doubao.ready": "已登录,会话保存在本机",
17903
- "doubao.sub": "浏览器登录后使用豆包直接对话模型",
17902
+ "doubao.sub": "浏览器登录后使用豆包模型",
17904
17903
  "doubao.signIn": "扫码登录",
17905
17904
  "doubao.signOut": "退出登录",
17906
17905
  "doubao.waiting": "等待登录…",
17907
17906
  "doubao.refresh": "刷新额度",
17908
17907
  "doubao.why": "豆包已关闭第三方扫码入口(服务端返回 2035),所以这里拉起一个浏览器窗口:在窗口里扫码或填手机号,登录成功后会话自动取回并保存在本机。",
17909
- "doubao.modelsNote": "模型在对话的模型选择器里:豆包 快速 / 2.1 Turbo。",
17908
+ "doubao.modelsNote": "模型在对话的模型选择器里。",
17909
+ "doubao.modelsTitle": "模型选择",
17910
+ "doubao.enableAll": "全部开启",
17911
+ "doubao.disableAll": "全部关闭",
17912
+ "doubao.workMode": "工作任务",
17913
+ "doubao.modelsHint": "勾选的模型会出现在对话模型选择器中;工作任务模型使用豆包工作额度。",
17910
17914
  "agg.listingYes": "支持拉取模型列表",
17911
17915
  "agg.saved": "已保存",
17912
17916
  "agg.cleared": "已清除",
package/lib/index.d.ts CHANGED
@@ -189,7 +189,20 @@ interface ChatMessage {
189
189
  [key: string]: unknown;
190
190
  }
191
191
  /** Upstream failure classes the shim maps onto distinct HTTP answers. */
192
- type UpstreamErrorKind = 'hard_credit' | 'soft_rate' | 'session_dead' | 'not_found' | 'server' | 'client';
192
+ type UpstreamErrorKind = 'hard_credit' | 'soft_rate' | 'session_dead' |
193
+ /**
194
+ * The account is blocked by the vendor's risk control — issue #127.
195
+ *
196
+ * A 403 whose body carries `code 11140` means "this account is flagged", not "this
197
+ * credential is invalid". The two were merged into `session_dead`, so the card printed
198
+ * "API 密钥无效" and the user was sent to re-authenticate over and over for a problem that
199
+ * re-authentication cannot fix — the sign-in succeeds, the flag remains.
200
+ *
201
+ * Separated because the remedy differs: a dead session wants a refresh, a flagged account
202
+ * wants the other accounts in the pool and, if all of them are flagged, a word with the
203
+ * vendor.
204
+ */
205
+ 'risk_blocked' | 'not_found' | 'server' | 'client';
193
206
  /** Token-refresh answer; fields the upstream omits stay absent. */
194
207
  interface WorkBuddyRefreshOutcome {
195
208
  accessToken: string;
@@ -319,11 +332,6 @@ interface UpstreamClientOptions {
319
332
  /** Region for a login domain; an empty domain means CN (matching upstream tooling). */
320
333
  /** The two gateways WorkBuddy serves: the domestic one and the international one. */
321
334
  type WorkBuddyRegion = 'cn' | 'global';
322
- /**
323
- * Classify an upstream failure from its HTTP status and body excerpt.
324
- * Body markers win over status, because the upstream reuses 400/200 for
325
- * several distinct conditions.
326
- */
327
335
  export declare function classifyUpstreamError(status: number, body: string): UpstreamErrorKind;
328
336
  /**
329
337
  * Parse the reset time the upstream reports for a rate limit, when present.
@@ -3311,6 +3319,7 @@ type ChannelLaneEvent = {
3311
3319
  finishReason: string;
3312
3320
  };
3313
3321
  interface ChannelLane {
3322
+ invalidate: (channel: string) => void;
3314
3323
  rows: () => Promise<readonly ChannelLaneRow[]>;
3315
3324
  resolve: (id: string) => {
3316
3325
  channel: string;