heybash-xdpool 1.0.8 → 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 +7 -0
- package/lib/bin.js +102 -51
- package/lib/client.js +133 -10
- package/lib/index.d.ts +15 -6
- package/lib/index.js +1149 -884
- package/package.json +1 -1
- package/vendor/channel-pack/pack.js +28 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Heybash
|
|
2
2
|
|
|
3
|
+
## 1.0.9 — 豆包模型选择与渠道稳定性
|
|
4
|
+
|
|
5
|
+
- 同步上游豆包模型选择,支持在账号池选择模型并保留 DSH 工具调用;工作任务模型使用豆包工作额度。
|
|
6
|
+
- WorkBuddy 遇到风控时暂时冷却账号并切换,减少请求失败。
|
|
7
|
+
- 修复 TRAE 账号冷却时模型目录回退,以及 Qoder 长会话超过请求容量时的处理。
|
|
8
|
+
- 聚合渠道的模型倍率单独展示,方便比较用量。
|
|
9
|
+
|
|
3
10
|
## 1.0.8 — 桌面启动修复
|
|
4
11
|
|
|
5
12
|
- 修复 1.0.7 前端包误引入 Node 模块,导致 DeepSeek Harness 桌面端启动失败。
|
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
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
const
|
|
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
|
-
|
|
5173
|
+
mode: "chat"
|
|
5124
5174
|
},
|
|
5125
5175
|
{
|
|
5126
5176
|
id: "3",
|
|
5127
5177
|
name: "豆包 2.1 Turbo",
|
|
5128
|
-
|
|
5129
|
-
reasoning: true
|
|
5178
|
+
mode: "chat"
|
|
5130
5179
|
},
|
|
5131
5180
|
{
|
|
5132
5181
|
id: "seed-lite-7b",
|
|
5133
5182
|
name: "豆包 2.1 Lite",
|
|
5134
|
-
|
|
5135
|
-
reasoning: true,
|
|
5136
|
-
taskMode: true
|
|
5183
|
+
mode: "work"
|
|
5137
5184
|
},
|
|
5138
5185
|
{
|
|
5139
5186
|
id: "5",
|
|
5140
5187
|
name: "豆包 2.1 Pro",
|
|
5141
|
-
|
|
5142
|
-
reasoning: true,
|
|
5143
|
-
taskMode: true
|
|
5188
|
+
mode: "work"
|
|
5144
5189
|
},
|
|
5145
5190
|
{
|
|
5146
5191
|
id: "9",
|
|
5147
5192
|
name: "自动",
|
|
5148
|
-
|
|
5149
|
-
reasoning: true,
|
|
5150
|
-
taskMode: true
|
|
5193
|
+
mode: "work"
|
|
5151
5194
|
},
|
|
5152
5195
|
{
|
|
5153
|
-
id:
|
|
5154
|
-
name:
|
|
5155
|
-
|
|
5196
|
+
id: "image-gen",
|
|
5197
|
+
name: "豆包 生图",
|
|
5198
|
+
mode: "chat"
|
|
5156
5199
|
}
|
|
5157
5200
|
];
|
|
5158
|
-
|
|
5159
|
-
|
|
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
|
@@ -233,6 +233,8 @@ window.__ModuleLoader__.load({
|
|
|
233
233
|
const POOL_DOUBAO_SESSION_PATH = "/plugins/dsh-xdpool/doubao/session";
|
|
234
234
|
/** The Doubao quota: the windows the account has, with their reset countdowns. */
|
|
235
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";
|
|
236
238
|
/**
|
|
237
239
|
* The `reason` the channel document carries when the login-channel route is
|
|
238
240
|
* already owned by another plugin.
|
|
@@ -803,6 +805,7 @@ window.__ModuleLoader__.load({
|
|
|
803
805
|
.dsm-xdpool-cpool-modelname{user-select:none;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
804
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}
|
|
805
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)}
|
|
806
809
|
.dsm-xdpool-cpool-tag[data-tone=dead]{border-color:color-mix(in srgb, #e5484d 45%, transparent);color:#ff8a8f}
|
|
807
810
|
/* One line under an empty or fully-filtered list. Both cases print it, because
|
|
808
811
|
"nothing published" and "nothing matched your search" must not look alike. */
|
|
@@ -2903,6 +2906,30 @@ window.__ModuleLoader__.load({
|
|
|
2903
2906
|
if (facts.supportedEfforts !== void 0) out.efforts = facts.supportedEfforts.join(" / ");
|
|
2904
2907
|
return out;
|
|
2905
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
|
+
}
|
|
2906
2933
|
// src/client/model-facts-row.tsx
|
|
2907
2934
|
/** One labelled figure, omitted entirely when the value is unknown. */
|
|
2908
2935
|
function Figure({ label, value, title }) {
|
|
@@ -11658,6 +11685,9 @@ window.__ModuleLoader__.load({
|
|
|
11658
11685
|
const [error, setError] = (0, react.useState)(void 0);
|
|
11659
11686
|
const [windows, setWindows] = (0, react.useState)([]);
|
|
11660
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);
|
|
11661
11691
|
const mounted = (0, react.useRef)(true);
|
|
11662
11692
|
const poll = (0, react.useRef)(void 0);
|
|
11663
11693
|
(0, react.useEffect)(() => {
|
|
@@ -11667,6 +11697,37 @@ window.__ModuleLoader__.load({
|
|
|
11667
11697
|
if (poll.current !== void 0) window.clearTimeout(poll.current);
|
|
11668
11698
|
};
|
|
11669
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
|
+
}, []);
|
|
11670
11731
|
/** Read the session and, when there is one, the quota. */
|
|
11671
11732
|
const load = (0, react.useCallback)(async () => {
|
|
11672
11733
|
try {
|
|
@@ -11676,8 +11737,10 @@ window.__ModuleLoader__.load({
|
|
|
11676
11737
|
setSignedIn(signed);
|
|
11677
11738
|
if (!signed) {
|
|
11678
11739
|
setWindows([]);
|
|
11740
|
+
setModels([]);
|
|
11679
11741
|
return;
|
|
11680
11742
|
}
|
|
11743
|
+
await loadModels();
|
|
11681
11744
|
const quota = await (await fetch(POOL_DOUBAO_QUOTA_PATH, { credentials: "same-origin" })).json().catch(() => void 0);
|
|
11682
11745
|
if (!mounted.current) return;
|
|
11683
11746
|
setWindows(Array.isArray(quota?.windows) ? quota.windows : []);
|
|
@@ -11686,7 +11749,7 @@ window.__ModuleLoader__.load({
|
|
|
11686
11749
|
} catch (cause) {
|
|
11687
11750
|
if (mounted.current) setError(cause instanceof Error ? cause.message : String(cause));
|
|
11688
11751
|
}
|
|
11689
|
-
}, []);
|
|
11752
|
+
}, [loadModels]);
|
|
11690
11753
|
/** Open the sign-in browser and wait for it. */
|
|
11691
11754
|
const signIn = (0, react.useCallback)(async () => {
|
|
11692
11755
|
setError(void 0);
|
|
@@ -11723,6 +11786,7 @@ window.__ModuleLoader__.load({
|
|
|
11723
11786
|
if (!mounted.current) return;
|
|
11724
11787
|
setSignedIn(false);
|
|
11725
11788
|
setWindows([]);
|
|
11789
|
+
setModels([]);
|
|
11726
11790
|
setMessage("已退出登录");
|
|
11727
11791
|
} catch (cause) {
|
|
11728
11792
|
if (mounted.current) setError(cause instanceof Error ? cause.message : String(cause));
|
|
@@ -11830,9 +11894,49 @@ window.__ModuleLoader__.load({
|
|
|
11830
11894
|
]
|
|
11831
11895
|
}, `${window.type ?? "w"}-${String(index)}`);
|
|
11832
11896
|
}),
|
|
11833
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
11834
|
-
className: "dsm-xdpool-doubao-
|
|
11835
|
-
children:
|
|
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
|
+
]
|
|
11836
11940
|
})
|
|
11837
11941
|
] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11838
11942
|
className: "dsm-xdpool-doubao-hint",
|
|
@@ -11844,6 +11948,10 @@ window.__ModuleLoader__.load({
|
|
|
11844
11948
|
/** The card's own stylesheet, travelling with the component. */
|
|
11845
11949
|
const DOUBAO_CSS = `
|
|
11846
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)}
|
|
11847
11955
|
.dsm-xdpool-doubao-head{display:flex;align-items:flex-start;gap:12px;flex-wrap:wrap}
|
|
11848
11956
|
.dsm-xdpool-doubao-id{display:flex;align-items:center;gap:10px;min-width:0}
|
|
11849
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}
|
|
@@ -13290,7 +13398,12 @@ window.__ModuleLoader__.load({
|
|
|
13290
13398
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
13291
13399
|
className: "dsm-xdpool-cpool-modelname",
|
|
13292
13400
|
title: model.id,
|
|
13293
|
-
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)
|
|
13294
13407
|
}),
|
|
13295
13408
|
model.isFree === true && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
13296
13409
|
className: "dsm-xdpool-cpool-tag",
|
|
@@ -13777,7 +13890,7 @@ window.__ModuleLoader__.load({
|
|
|
13777
13890
|
}
|
|
13778
13891
|
// src/version.ts
|
|
13779
13892
|
/** Version embedded in the browser bundle at build time from the package manifest. */
|
|
13780
|
-
const POOL_VERSION = "1.0.
|
|
13893
|
+
const POOL_VERSION = "1.0.9";
|
|
13781
13894
|
// src/client/PoolCard.tsx
|
|
13782
13895
|
/**
|
|
13783
13896
|
* Heybash card contributed to DSH Plugin configuration.
|
|
@@ -17177,13 +17290,18 @@ window.__ModuleLoader__.load({
|
|
|
17177
17290
|
"agg.models": "{count} models",
|
|
17178
17291
|
"agg.unsupported": "This vendor signs in via OAuth/ADC, which this lane cannot drive.",
|
|
17179
17292
|
"doubao.ready": "Signed in; the session is stored locally",
|
|
17180
|
-
"doubao.sub": "Sign in with a browser to use
|
|
17293
|
+
"doubao.sub": "Sign in with a browser to use Doubao models",
|
|
17181
17294
|
"doubao.signIn": "Sign in with a browser",
|
|
17182
17295
|
"doubao.signOut": "Sign out",
|
|
17183
17296
|
"doubao.waiting": "Waiting for sign-in…",
|
|
17184
17297
|
"doubao.refresh": "Refresh quota",
|
|
17185
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.",
|
|
17186
|
-
"doubao.modelsNote": "The models are in the conversation picker
|
|
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.",
|
|
17187
17305
|
"agg.listingYes": "Model list available",
|
|
17188
17306
|
"agg.saved": "Saved",
|
|
17189
17307
|
"agg.cleared": "Cleared",
|
|
@@ -17781,13 +17899,18 @@ window.__ModuleLoader__.load({
|
|
|
17781
17899
|
"agg.models": "{count} 个模型",
|
|
17782
17900
|
"agg.unsupported": "该厂商需要 OAuth/ADC 授权,这条通道暂时接不了。",
|
|
17783
17901
|
"doubao.ready": "已登录,会话保存在本机",
|
|
17784
|
-
"doubao.sub": "
|
|
17902
|
+
"doubao.sub": "浏览器登录后使用豆包模型",
|
|
17785
17903
|
"doubao.signIn": "扫码登录",
|
|
17786
17904
|
"doubao.signOut": "退出登录",
|
|
17787
17905
|
"doubao.waiting": "等待登录…",
|
|
17788
17906
|
"doubao.refresh": "刷新额度",
|
|
17789
17907
|
"doubao.why": "豆包已关闭第三方扫码入口(服务端返回 2035),所以这里拉起一个浏览器窗口:在窗口里扫码或填手机号,登录成功后会话自动取回并保存在本机。",
|
|
17790
|
-
"doubao.modelsNote": "
|
|
17908
|
+
"doubao.modelsNote": "模型在对话的模型选择器里。",
|
|
17909
|
+
"doubao.modelsTitle": "模型选择",
|
|
17910
|
+
"doubao.enableAll": "全部开启",
|
|
17911
|
+
"doubao.disableAll": "全部关闭",
|
|
17912
|
+
"doubao.workMode": "工作任务",
|
|
17913
|
+
"doubao.modelsHint": "勾选的模型会出现在对话模型选择器中;工作任务模型使用豆包工作额度。",
|
|
17791
17914
|
"agg.listingYes": "支持拉取模型列表",
|
|
17792
17915
|
"agg.saved": "已保存",
|
|
17793
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' |
|
|
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;
|