heybash-xdpool 1.0.6 → 1.0.7
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/README.md +3 -1
- package/assets/licenses/dsh-connect-doubao-MIT.txt +21 -0
- package/lib/bin.js +396 -48
- package/lib/client.js +642 -26
- package/lib/index.d.ts +25 -2
- package/lib/index.js +4868 -1914
- package/package.json +1 -1
- package/vendor/channel-pack/pack.js +17 -2
package/lib/client.js
CHANGED
|
@@ -4,8 +4,32 @@ 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));
|
|
7
28
|
let react = require("react");
|
|
8
29
|
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");
|
|
9
33
|
let react_dom = require("react-dom");
|
|
10
34
|
// src/client/sidebar-row.ts
|
|
11
35
|
/**
|
|
@@ -71,6 +95,22 @@ window.__ModuleLoader__.load({
|
|
|
71
95
|
if (option === "expiry") return at?.("row.distExpiryHint") ?? "";
|
|
72
96
|
return at?.("row.distRoundRobinHint") ?? "";
|
|
73
97
|
}
|
|
98
|
+
// src/client/automation-note.ts
|
|
99
|
+
/** Localize known scheduler reasons; preserve upstream error details verbatim. */
|
|
100
|
+
function automationNote(note, t) {
|
|
101
|
+
const key = {
|
|
102
|
+
"not covered by automation": "row.autoNote.uncovered",
|
|
103
|
+
"automatic completion failed": "row.autoNote.failed",
|
|
104
|
+
"not scored yet": "row.autoNote.unscored",
|
|
105
|
+
"not accepted": "row.autoNote.notAccepted",
|
|
106
|
+
locked: "row.autoNote.locked"
|
|
107
|
+
}[note];
|
|
108
|
+
return key === void 0 ? note : t?.(key) ?? note;
|
|
109
|
+
}
|
|
110
|
+
/** Show unsupported tasks separately from supported tasks awaiting scoring. */
|
|
111
|
+
function automationGroup(item) {
|
|
112
|
+
return item.status === "skipped" && item.note === "not covered by automation" ? "uncovered" : item.status;
|
|
113
|
+
}
|
|
74
114
|
// src/status-paths.ts
|
|
75
115
|
/**
|
|
76
116
|
* Node-free constants and types shared by the Host and browser halves of the
|
|
@@ -209,6 +249,29 @@ window.__ModuleLoader__.load({
|
|
|
209
249
|
*/
|
|
210
250
|
const POOL_CHANNELS_PATH = "/plugins/dsh-xdpool/channels";
|
|
211
251
|
/**
|
|
252
|
+
* The Doubao lane's session.
|
|
253
|
+
*
|
|
254
|
+
* POST starts an interactive browser sign-in and answers once it lands;
|
|
255
|
+
* GET reports whether a session is stored; DELETE forgets it.
|
|
256
|
+
*/
|
|
257
|
+
const POOL_DOUBAO_SESSION_PATH = "/plugins/dsh-xdpool/doubao/session";
|
|
258
|
+
/** The Doubao quota: the windows the account has, with their reset countdowns. */
|
|
259
|
+
const POOL_DOUBAO_QUOTA_PATH = "/plugins/dsh-xdpool/doubao/quota";
|
|
260
|
+
/**
|
|
261
|
+
* The `reason` the channel document carries when the login-channel route is
|
|
262
|
+
* already owned by another plugin.
|
|
263
|
+
*
|
|
264
|
+
* The pack we vendor is byte-identical to the one the sibling login-channel
|
|
265
|
+
* build mounts, and both claim the same fetch route; the host has no query for
|
|
266
|
+
* what is already registered, so the loser of that race can only tell it lost.
|
|
267
|
+
* Both halves need the same string — the host to say it, the card to choose
|
|
268
|
+
* between "this host cannot run the channels" and "another plugin already runs
|
|
269
|
+
* them", which are opposite sentences — so it is declared with the other wire
|
|
270
|
+
* constants rather than in `channels.ts`, which the browser bundle may not
|
|
271
|
+
* import for value.
|
|
272
|
+
*/
|
|
273
|
+
const ROUTE_OWNED_ELSEWHERE = "already-mounted-elsewhere";
|
|
274
|
+
/**
|
|
212
275
|
* The routing chains, and the whole model roster a member may name.
|
|
213
276
|
*
|
|
214
277
|
* One route for both because the editor cannot be drawn without the roster: a
|
|
@@ -2237,8 +2300,11 @@ window.__ModuleLoader__.load({
|
|
|
2237
2300
|
(0, react.useEffect)(() => {
|
|
2238
2301
|
if (shared !== void 0) setOwn(shared);
|
|
2239
2302
|
}, [shared]);
|
|
2240
|
-
(0, react.useEffect)(() =>
|
|
2241
|
-
mounted.current =
|
|
2303
|
+
(0, react.useEffect)(() => {
|
|
2304
|
+
mounted.current = true;
|
|
2305
|
+
return () => {
|
|
2306
|
+
mounted.current = false;
|
|
2307
|
+
};
|
|
2242
2308
|
}, []);
|
|
2243
2309
|
/**
|
|
2244
2310
|
* Poll only while this page is mounted.
|
|
@@ -2666,7 +2732,16 @@ window.__ModuleLoader__.load({
|
|
|
2666
2732
|
* "TRAE" a bare "T", which looks sparse at 40px. CamelCase splitting resolves
|
|
2667
2733
|
* both: LobsterAI -> LA, Loomy -> L, TRAE -> TR, MiniMax Code -> MM.
|
|
2668
2734
|
*/
|
|
2735
|
+
/**
|
|
2736
|
+
* Initials for a name the generic rule cannot letter.
|
|
2737
|
+
*
|
|
2738
|
+
* A Chinese display name has no ASCII letters to take, so the rule below returns an empty
|
|
2739
|
+
* mark — a channel with a blank tile. Doubao is the first such name.
|
|
2740
|
+
*/
|
|
2741
|
+
const INITIALS_BY_NAME = { 豆包: "DB" };
|
|
2669
2742
|
function channelInitials(name) {
|
|
2743
|
+
const fixed = INITIALS_BY_NAME[name.trim()];
|
|
2744
|
+
if (fixed !== void 0) return fixed;
|
|
2670
2745
|
const segments = name.split(/\s+/u).flatMap((word) => word.replace(/([a-z0-9])([A-Z])/gu, "$1 $2").split(" ")).map((segment) => [...segment].filter((character) => /[0-9A-Za-z]/u.test(character)).join("")).filter((segment) => segment !== "");
|
|
2671
2746
|
if (segments.length >= 2) return (([...segments[0] ?? ""][0] ?? "") + ([...segments[1] ?? ""][0] ?? "")).toUpperCase();
|
|
2672
2747
|
return [...segments[0] ?? ""].slice(0, 2).join("").toUpperCase();
|
|
@@ -8230,8 +8305,11 @@ window.__ModuleLoader__.load({
|
|
|
8230
8305
|
/** The pair currently being measured, so only one button shows a spinner. */
|
|
8231
8306
|
const [probing, setProbing] = (0, react.useState)(void 0);
|
|
8232
8307
|
const mounted = (0, react.useRef)(true);
|
|
8233
|
-
(0, react.useEffect)(() =>
|
|
8234
|
-
mounted.current =
|
|
8308
|
+
(0, react.useEffect)(() => {
|
|
8309
|
+
mounted.current = true;
|
|
8310
|
+
return () => {
|
|
8311
|
+
mounted.current = false;
|
|
8312
|
+
};
|
|
8235
8313
|
}, []);
|
|
8236
8314
|
/**
|
|
8237
8315
|
* Ask the host to run one real request against a model, and keep the reading.
|
|
@@ -9762,10 +9840,13 @@ window.__ModuleLoader__.load({
|
|
|
9762
9840
|
const mounted = (0, react.useRef)(true);
|
|
9763
9841
|
/** Timers for in-flight logins, keyed by channel id. */
|
|
9764
9842
|
const timers = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
9765
|
-
(0, react.useEffect)(() =>
|
|
9766
|
-
mounted.current =
|
|
9767
|
-
|
|
9768
|
-
|
|
9843
|
+
(0, react.useEffect)(() => {
|
|
9844
|
+
mounted.current = true;
|
|
9845
|
+
return () => {
|
|
9846
|
+
mounted.current = false;
|
|
9847
|
+
for (const handle of timers.current.values()) window.clearInterval(handle);
|
|
9848
|
+
timers.current.clear();
|
|
9849
|
+
};
|
|
9769
9850
|
}, []);
|
|
9770
9851
|
const load = (0, react.useCallback)(async (signal) => {
|
|
9771
9852
|
try {
|
|
@@ -9992,7 +10073,7 @@ window.__ModuleLoader__.load({
|
|
|
9992
10073
|
}
|
|
9993
10074
|
}, [autoCheckin]);
|
|
9994
10075
|
const state = status?.state ?? "pending";
|
|
9995
|
-
const channels = status?.channels ?? [];
|
|
10076
|
+
const channels = (status?.channels ?? []).filter((channel) => channel.id !== "doubao");
|
|
9996
10077
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
9997
10078
|
className: "dsm-xdpool-channels",
|
|
9998
10079
|
children: [
|
|
@@ -10048,6 +10129,16 @@ window.__ModuleLoader__.load({
|
|
|
10048
10129
|
t,
|
|
10049
10130
|
ui: ui[channel.id] ?? IDLE,
|
|
10050
10131
|
connectedCount: connectedFor(channel).length,
|
|
10132
|
+
/**
|
|
10133
|
+
* When the pack is mounted ELSEWHERE, this page cannot log anybody in.
|
|
10134
|
+
*
|
|
10135
|
+
* `account.create` is answered by the pack, and the pack that owns it lives in
|
|
10136
|
+
* another plugin — so pressing the button produced the host's "not supported"
|
|
10137
|
+
* line for a channel that works perfectly well, on a page the user was told to
|
|
10138
|
+
* use. The row says where the sign-in actually is instead of offering a button
|
|
10139
|
+
* that cannot work.
|
|
10140
|
+
*/
|
|
10141
|
+
ownedElsewhere: status?.reason === ROUTE_OWNED_ELSEWHERE,
|
|
10051
10142
|
onSignIn: () => {
|
|
10052
10143
|
signIn(channel);
|
|
10053
10144
|
},
|
|
@@ -10056,7 +10147,7 @@ window.__ModuleLoader__.load({
|
|
|
10056
10147
|
]
|
|
10057
10148
|
});
|
|
10058
10149
|
}
|
|
10059
|
-
function ChannelRow({ channel, t, ui, connectedCount, onSignIn, onCancel }) {
|
|
10150
|
+
function ChannelRow({ channel, t, ui, connectedCount, onSignIn, onCancel, ownedElsewhere }) {
|
|
10060
10151
|
const busy = ui.phase === "signing-in";
|
|
10061
10152
|
const icon = channelIcon(channel.id);
|
|
10062
10153
|
const tileMark = icon === void 0 ? { initials: channelInitials(channel.name) } : { icon };
|
|
@@ -10111,7 +10202,10 @@ window.__ModuleLoader__.load({
|
|
|
10111
10202
|
children: t?.("agg.clear") ?? "Cancel"
|
|
10112
10203
|
})
|
|
10113
10204
|
] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
10114
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
10205
|
+
ownedElsewhere === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10206
|
+
className: "dsm-xdpool-channel-hint",
|
|
10207
|
+
children: t?.("chan.ownedElsewhereRow") ?? "在「我们的免费模型」里登录"
|
|
10208
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
10115
10209
|
type: "button",
|
|
10116
10210
|
className: "dsm-xdpool-btn",
|
|
10117
10211
|
onClick: onSignIn,
|
|
@@ -10262,8 +10356,11 @@ window.__ModuleLoader__.load({
|
|
|
10262
10356
|
/** True once the drafts were seeded from the server, so later polls don't stomp edits. */
|
|
10263
10357
|
const seeded = (0, react.useRef)(false);
|
|
10264
10358
|
const mounted = (0, react.useRef)(true);
|
|
10265
|
-
(0, react.useEffect)(() =>
|
|
10266
|
-
mounted.current =
|
|
10359
|
+
(0, react.useEffect)(() => {
|
|
10360
|
+
mounted.current = true;
|
|
10361
|
+
return () => {
|
|
10362
|
+
mounted.current = false;
|
|
10363
|
+
};
|
|
10267
10364
|
}, []);
|
|
10268
10365
|
const load = (0, react.useCallback)(async (signal) => {
|
|
10269
10366
|
try {
|
|
@@ -11078,8 +11175,11 @@ window.__ModuleLoader__.load({
|
|
|
11078
11175
|
/** True once the server's values were adopted, so polls do not stomp edits. */
|
|
11079
11176
|
const seeded = (0, react.useRef)(false);
|
|
11080
11177
|
const mounted = (0, react.useRef)(true);
|
|
11081
|
-
(0, react.useEffect)(() =>
|
|
11082
|
-
mounted.current =
|
|
11178
|
+
(0, react.useEffect)(() => {
|
|
11179
|
+
mounted.current = true;
|
|
11180
|
+
return () => {
|
|
11181
|
+
mounted.current = false;
|
|
11182
|
+
};
|
|
11083
11183
|
}, []);
|
|
11084
11184
|
const load = (0, react.useCallback)(async (signal) => {
|
|
11085
11185
|
try {
|
|
@@ -11531,6 +11631,265 @@ window.__ModuleLoader__.load({
|
|
|
11531
11631
|
]
|
|
11532
11632
|
});
|
|
11533
11633
|
}
|
|
11634
|
+
// src/client/doubao-work-icon.ts
|
|
11635
|
+
/** Artwork from the installed Doubao Work desktop application. */
|
|
11636
|
+
const DOUBAO_WORK_ICON = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAeGVYSWZNTQAqAAAACAAEARoABQAAAAEAAAA+ARsABQAAAAEAAABGASgAAwAAAAEAAgAAh2kABAAAAAEAAABOAAAAAAAAAJAAAAABAAAAkAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAQKADAAQAAAABAAAAQAAAAACU3PoRAAAACXBIWXMAABYlAAAWJQFJUiTwAAACnmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0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p/9fSXgPfXIur/Ei1/LR7P9HsGgTMInEHgfx+B/wLm3zGy2Haa+AAAAABJRU5ErkJggg==";
|
|
11637
|
+
// src/client/DoubaoPage.tsx
|
|
11638
|
+
/**
|
|
11639
|
+
* The Doubao card: sign in, then read the quota.
|
|
11640
|
+
*
|
|
11641
|
+
* WHAT THIS SURFACE IS FOR
|
|
11642
|
+
*
|
|
11643
|
+
* Doubao's models already appear in the picker (the channel lane serves them), so this card
|
|
11644
|
+
* is not a second model list. It is the two things that have no other home:
|
|
11645
|
+
*
|
|
11646
|
+
* - the SIGN-IN, because Doubao's QR entrance is closed and the only door left is a
|
|
11647
|
+
* browser window this plugin starts;
|
|
11648
|
+
* - the QUOTA, because Doubao reports promotional windows with reset countdowns and
|
|
11649
|
+
* nothing else in the plugin knows how to read them.
|
|
11650
|
+
*
|
|
11651
|
+
* THE COPY SAYS WHAT ACTUALLY HAPPENS
|
|
11652
|
+
*
|
|
11653
|
+
* The button opens a Chromium window and waits. A user who is told "sign in" and sees a blank
|
|
11654
|
+
* panel for a minute concludes the feature is broken, so the waiting states name the step
|
|
11655
|
+
* they are on and the window stays open for the whole budget.
|
|
11656
|
+
*
|
|
11657
|
+
* @module dsh-xdpool/client/DoubaoPage
|
|
11658
|
+
*/
|
|
11659
|
+
/** How the card describes one window. */
|
|
11660
|
+
function windowLabel(window) {
|
|
11661
|
+
if (typeof window.label === "string" && window.label !== "") return window.label;
|
|
11662
|
+
if (window.type === "five_hour") return "5 小时限额";
|
|
11663
|
+
if (window.type === "weekly") return "周额度";
|
|
11664
|
+
if (window.type === "incentive") return "活动赠送额度";
|
|
11665
|
+
return "额度";
|
|
11666
|
+
}
|
|
11667
|
+
/** A countdown, or a plain statement when the window has no reset. */
|
|
11668
|
+
function resetText(window) {
|
|
11669
|
+
if (window.resetUnknown === true || window.resetsAt === void 0 || window.resetsAt <= 0) return "用后开始计算";
|
|
11670
|
+
const left = window.resetsAt - Date.now();
|
|
11671
|
+
if (left <= 0) return "已重置";
|
|
11672
|
+
const hours = Math.floor(left / 36e5);
|
|
11673
|
+
const days = Math.floor(hours / 24);
|
|
11674
|
+
if (days > 0) return `${String(days)} 天 ${String(hours % 24)} 小时后重置`;
|
|
11675
|
+
const minutes = Math.floor(left % 36e5 / 6e4);
|
|
11676
|
+
return `${String(hours)} 小时 ${String(minutes)} 分后重置`;
|
|
11677
|
+
}
|
|
11678
|
+
function DoubaoPage({ t }) {
|
|
11679
|
+
const [signedIn, setSignedIn] = (0, react.useState)(false);
|
|
11680
|
+
const [busy, setBusy] = (0, react.useState)(false);
|
|
11681
|
+
const [message, setMessage] = (0, react.useState)(void 0);
|
|
11682
|
+
const [error, setError] = (0, react.useState)(void 0);
|
|
11683
|
+
const [windows, setWindows] = (0, react.useState)([]);
|
|
11684
|
+
const [exhausted, setExhausted] = (0, react.useState)(false);
|
|
11685
|
+
const mounted = (0, react.useRef)(true);
|
|
11686
|
+
const poll = (0, react.useRef)(void 0);
|
|
11687
|
+
(0, react.useEffect)(() => {
|
|
11688
|
+
mounted.current = true;
|
|
11689
|
+
return () => {
|
|
11690
|
+
mounted.current = false;
|
|
11691
|
+
if (poll.current !== void 0) window.clearTimeout(poll.current);
|
|
11692
|
+
};
|
|
11693
|
+
}, []);
|
|
11694
|
+
/** Read the session and, when there is one, the quota. */
|
|
11695
|
+
const load = (0, react.useCallback)(async () => {
|
|
11696
|
+
try {
|
|
11697
|
+
const body = await (await fetch(POOL_DOUBAO_SESSION_PATH, { credentials: "same-origin" })).json().catch(() => void 0);
|
|
11698
|
+
if (!mounted.current) return;
|
|
11699
|
+
const signed = body?.signedIn === true;
|
|
11700
|
+
setSignedIn(signed);
|
|
11701
|
+
if (!signed) {
|
|
11702
|
+
setWindows([]);
|
|
11703
|
+
return;
|
|
11704
|
+
}
|
|
11705
|
+
const quota = await (await fetch(POOL_DOUBAO_QUOTA_PATH, { credentials: "same-origin" })).json().catch(() => void 0);
|
|
11706
|
+
if (!mounted.current) return;
|
|
11707
|
+
setWindows(Array.isArray(quota?.windows) ? quota.windows : []);
|
|
11708
|
+
setExhausted(quota?.exhausted === true);
|
|
11709
|
+
if (typeof quota?.error === "string" && quota.error !== "") setError(quota.error);
|
|
11710
|
+
} catch (cause) {
|
|
11711
|
+
if (mounted.current) setError(cause instanceof Error ? cause.message : String(cause));
|
|
11712
|
+
}
|
|
11713
|
+
}, []);
|
|
11714
|
+
/** Open the sign-in browser and wait for it. */
|
|
11715
|
+
const signIn = (0, react.useCallback)(async () => {
|
|
11716
|
+
setError(void 0);
|
|
11717
|
+
setMessage("已打开浏览器,请在弹出的窗口里扫码或短信登录…");
|
|
11718
|
+
setBusy(true);
|
|
11719
|
+
try {
|
|
11720
|
+
const body = await (await fetch(POOL_DOUBAO_SESSION_PATH, {
|
|
11721
|
+
method: "POST",
|
|
11722
|
+
credentials: "same-origin"
|
|
11723
|
+
})).json().catch(() => void 0);
|
|
11724
|
+
if (!mounted.current) return;
|
|
11725
|
+
if (body?.signedIn === true) {
|
|
11726
|
+
setMessage(body.message ?? "登录成功");
|
|
11727
|
+
load();
|
|
11728
|
+
return;
|
|
11729
|
+
}
|
|
11730
|
+
setMessage(body?.message ?? "没有等到登录完成,可以再试一次");
|
|
11731
|
+
} catch (cause) {
|
|
11732
|
+
if (mounted.current) setError(cause instanceof Error ? cause.message : String(cause));
|
|
11733
|
+
} finally {
|
|
11734
|
+
if (mounted.current) setBusy(false);
|
|
11735
|
+
}
|
|
11736
|
+
}, [load]);
|
|
11737
|
+
/** Forget the session. */
|
|
11738
|
+
const signOut = (0, react.useCallback)(async () => {
|
|
11739
|
+
setError(void 0);
|
|
11740
|
+
setMessage(void 0);
|
|
11741
|
+
setBusy(true);
|
|
11742
|
+
try {
|
|
11743
|
+
await fetch(POOL_DOUBAO_SESSION_PATH, {
|
|
11744
|
+
method: "DELETE",
|
|
11745
|
+
credentials: "same-origin"
|
|
11746
|
+
});
|
|
11747
|
+
if (!mounted.current) return;
|
|
11748
|
+
setSignedIn(false);
|
|
11749
|
+
setWindows([]);
|
|
11750
|
+
setMessage("已退出登录");
|
|
11751
|
+
} catch (cause) {
|
|
11752
|
+
if (mounted.current) setError(cause instanceof Error ? cause.message : String(cause));
|
|
11753
|
+
} finally {
|
|
11754
|
+
if (mounted.current) setBusy(false);
|
|
11755
|
+
}
|
|
11756
|
+
}, []);
|
|
11757
|
+
(0, react.useEffect)(() => {
|
|
11758
|
+
load();
|
|
11759
|
+
}, [load]);
|
|
11760
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11761
|
+
className: "dsm-xdpool-doubao",
|
|
11762
|
+
children: [
|
|
11763
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: DOUBAO_CSS }),
|
|
11764
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11765
|
+
className: "dsm-xdpool-doubao-head",
|
|
11766
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11767
|
+
className: "dsm-xdpool-doubao-id",
|
|
11768
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
11769
|
+
className: "dsm-xdpool-doubao-mark",
|
|
11770
|
+
src: DOUBAO_WORK_ICON,
|
|
11771
|
+
alt: ""
|
|
11772
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11773
|
+
className: "dsm-xdpool-doubao-title",
|
|
11774
|
+
children: "豆包 · 字节跳动"
|
|
11775
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11776
|
+
className: "dsm-xdpool-doubao-sub",
|
|
11777
|
+
children: signedIn ? t?.("doubao.ready") ?? "已登录,会话保存在本机" : t?.("doubao.sub") ?? "浏览器登录后使用豆包直接对话模型"
|
|
11778
|
+
})] })]
|
|
11779
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11780
|
+
className: "dsm-xdpool-doubao-acts",
|
|
11781
|
+
children: signedIn ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
11782
|
+
type: "button",
|
|
11783
|
+
className: "dsm-xdpool-doubao-btn",
|
|
11784
|
+
disabled: busy,
|
|
11785
|
+
onClick: () => {
|
|
11786
|
+
load();
|
|
11787
|
+
},
|
|
11788
|
+
children: t?.("doubao.refresh") ?? "刷新额度"
|
|
11789
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
11790
|
+
type: "button",
|
|
11791
|
+
className: "dsm-xdpool-doubao-btn",
|
|
11792
|
+
disabled: busy,
|
|
11793
|
+
onClick: () => {
|
|
11794
|
+
signOut();
|
|
11795
|
+
},
|
|
11796
|
+
children: t?.("doubao.signOut") ?? "退出登录"
|
|
11797
|
+
})] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
11798
|
+
type: "button",
|
|
11799
|
+
className: "dsm-xdpool-doubao-btn",
|
|
11800
|
+
"data-tone": "primary",
|
|
11801
|
+
disabled: busy,
|
|
11802
|
+
onClick: () => {
|
|
11803
|
+
signIn();
|
|
11804
|
+
},
|
|
11805
|
+
children: busy ? t?.("doubao.waiting") ?? "等待登录…" : t?.("doubao.signIn") ?? "扫码登录"
|
|
11806
|
+
})
|
|
11807
|
+
})]
|
|
11808
|
+
}),
|
|
11809
|
+
message === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11810
|
+
className: "dsm-xdpool-doubao-note",
|
|
11811
|
+
children: message
|
|
11812
|
+
}),
|
|
11813
|
+
error === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11814
|
+
className: "dsm-xdpool-doubao-error",
|
|
11815
|
+
children: error
|
|
11816
|
+
}),
|
|
11817
|
+
signedIn ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
11818
|
+
exhausted ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11819
|
+
className: "dsm-xdpool-doubao-error",
|
|
11820
|
+
children: "额度已用完,等待窗口重置。"
|
|
11821
|
+
}) : null,
|
|
11822
|
+
windows.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11823
|
+
className: "dsm-xdpool-doubao-hint",
|
|
11824
|
+
children: "这个账号暂时没有可显示的额度窗口。"
|
|
11825
|
+
}) : windows.map((window, index) => {
|
|
11826
|
+
const percent = typeof window.usedPercent === "number" ? window.usedPercent : 0;
|
|
11827
|
+
const used = typeof window.usedAmount === "number" ? window.usedAmount : void 0;
|
|
11828
|
+
const total = typeof window.totalAmount === "number" ? window.totalAmount : void 0;
|
|
11829
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11830
|
+
className: "dsm-xdpool-doubao-window",
|
|
11831
|
+
children: [
|
|
11832
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11833
|
+
className: "dsm-xdpool-doubao-window-head",
|
|
11834
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11835
|
+
className: "dsm-xdpool-doubao-window-name",
|
|
11836
|
+
children: windowLabel(window)
|
|
11837
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11838
|
+
className: "dsm-xdpool-doubao-window-reset",
|
|
11839
|
+
children: resetText(window)
|
|
11840
|
+
})]
|
|
11841
|
+
}),
|
|
11842
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11843
|
+
className: "dsm-xdpool-doubao-bar",
|
|
11844
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11845
|
+
className: "dsm-xdpool-doubao-bar-fill",
|
|
11846
|
+
"data-exhausted": percent >= 100 ? "true" : "false",
|
|
11847
|
+
style: { width: `${String(Math.min(100, Math.max(0, percent)))}%` }
|
|
11848
|
+
})
|
|
11849
|
+
}),
|
|
11850
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11851
|
+
className: "dsm-xdpool-doubao-window-foot",
|
|
11852
|
+
children: used === void 0 || total === void 0 ? `已用 ${String(Math.round(percent))}%` : `已用 ${String(used)} / ${String(total)}`
|
|
11853
|
+
})
|
|
11854
|
+
]
|
|
11855
|
+
}, `${window.type ?? "w"}-${String(index)}`);
|
|
11856
|
+
}),
|
|
11857
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11858
|
+
className: "dsm-xdpool-doubao-hint",
|
|
11859
|
+
children: t?.("doubao.modelsNote") ?? "模型在对话的模型选择器里:豆包 快速 / 2.1 Turbo。"
|
|
11860
|
+
})
|
|
11861
|
+
] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11862
|
+
className: "dsm-xdpool-doubao-hint",
|
|
11863
|
+
children: t?.("doubao.why") ?? "豆包已关闭第三方扫码入口(服务端返回 2035),所以这里拉起一个浏览器窗口:在窗口里扫码或填手机号,登录成功后会话自动取回并保存在本机。"
|
|
11864
|
+
})
|
|
11865
|
+
]
|
|
11866
|
+
});
|
|
11867
|
+
}
|
|
11868
|
+
/** The card's own stylesheet, travelling with the component. */
|
|
11869
|
+
const DOUBAO_CSS = `
|
|
11870
|
+
.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)}
|
|
11871
|
+
.dsm-xdpool-doubao-head{display:flex;align-items:flex-start;gap:12px;flex-wrap:wrap}
|
|
11872
|
+
.dsm-xdpool-doubao-id{display:flex;align-items:center;gap:10px;min-width:0}
|
|
11873
|
+
.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}
|
|
11874
|
+
.dsm-xdpool-doubao-title{font-size:13.5px;font-weight:650;color:var(--dsw-alias-label-primary,#e8eaf0)}
|
|
11875
|
+
.dsm-xdpool-doubao-sub{margin-top:2px;font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary,#8a90a0)}
|
|
11876
|
+
.dsm-xdpool-doubao-acts{margin-left:auto;display:flex;gap:8px;flex:none}
|
|
11877
|
+
.dsm-xdpool-doubao-btn{appearance:none;-webkit-appearance:none;padding:5px 13px;border-radius:8px;cursor:pointer;font:inherit;font-size:12px;line-height:18px;border:1px solid color-mix(in srgb, var(--dsw-alias-border-l2,#ffffff1f) 95%, transparent);background:transparent;color:var(--dsw-alias-label-secondary,#b9bfcc);white-space:nowrap}
|
|
11878
|
+
.dsm-xdpool-doubao-btn:hover:not(:disabled){border-color:color-mix(in srgb, #3B6FD4 55%, transparent);color:var(--dsw-alias-label-primary,#e8eaf0)}
|
|
11879
|
+
.dsm-xdpool-doubao-btn:disabled{opacity:.5;cursor:not-allowed}
|
|
11880
|
+
.dsm-xdpool-doubao-btn[data-tone='primary']{border-color:color-mix(in srgb, #3B6FD4 62%, transparent);background:color-mix(in srgb, #3B6FD4 16%, transparent);color:#6E9AF0;font-weight:600}
|
|
11881
|
+
.dsm-xdpool-doubao-note{margin:0;font-size:11.5px;line-height:17px;color:var(--dsw-alias-state-success-primary,#22a06b)}
|
|
11882
|
+
.dsm-xdpool-doubao-error{margin:0;font-size:11.5px;line-height:17px;color:var(--dsw-alias-state-error-primary,#e5534b)}
|
|
11883
|
+
.dsm-xdpool-doubao-hint{margin:0;font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary,#8a90a0)}
|
|
11884
|
+
.dsm-xdpool-doubao-window{display:flex;flex-direction:column;gap:6px;padding:10px 12px;border-radius:10px;background:color-mix(in srgb, #3B6FD4 8%, transparent);border:1px solid color-mix(in srgb, #3B6FD4 24%, transparent)}
|
|
11885
|
+
.dsm-xdpool-doubao-window-head{display:flex;align-items:baseline;gap:10px}
|
|
11886
|
+
.dsm-xdpool-doubao-window-name{font-size:12px;font-weight:600;color:var(--dsw-alias-label-primary,#e8eaf0)}
|
|
11887
|
+
.dsm-xdpool-doubao-window-reset{margin-left:auto;font-size:10.5px;color:var(--dsw-alias-label-tertiary,#8a90a0)}
|
|
11888
|
+
.dsm-xdpool-doubao-bar{height:6px;border-radius:999px;background:color-mix(in srgb, var(--dsw-alias-label-primary,#e8eaf0) 10%, transparent);overflow:hidden}
|
|
11889
|
+
.dsm-xdpool-doubao-bar-fill{display:block;height:100%;border-radius:999px;background:#3B6FD4;transition:width .2s ease}
|
|
11890
|
+
.dsm-xdpool-doubao-bar-fill[data-exhausted='true']{background:#e5534b}
|
|
11891
|
+
.dsm-xdpool-doubao-window-foot{font-size:10.5px;color:var(--dsw-alias-label-secondary,#b9bfcc);font-variant-numeric:tabular-nums}
|
|
11892
|
+
`;
|
|
11534
11893
|
// src/client/region-card.tsx
|
|
11535
11894
|
/**
|
|
11536
11895
|
* Which login channel each lane IS.
|
|
@@ -11876,6 +12235,108 @@ window.__ModuleLoader__.load({
|
|
|
11876
12235
|
if (model.multiplier !== 0) return void 0;
|
|
11877
12236
|
return paidSiblingOf(model, models);
|
|
11878
12237
|
}
|
|
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
|
+
}
|
|
11879
12340
|
// src/client/ChannelPoolSection.tsx
|
|
11880
12341
|
/**
|
|
11881
12342
|
* Account-pool page, scan-channel section.
|
|
@@ -11999,6 +12460,57 @@ window.__ModuleLoader__.load({
|
|
|
11999
12460
|
* moment a login lands), so the newest entry wins: it is the one whose
|
|
12000
12461
|
* credential was written last.
|
|
12001
12462
|
*/
|
|
12463
|
+
/**
|
|
12464
|
+
* Doubao's account, described in the pack's account shape.
|
|
12465
|
+
*
|
|
12466
|
+
* The lane is the plugin's own, so this reads its session route and translates the answer
|
|
12467
|
+
* into the row the rest of this page already knows how to draw. `undefined` means "no
|
|
12468
|
+
* session", which is the ordinary state before a sign-in.
|
|
12469
|
+
*/
|
|
12470
|
+
async function readDoubaoAccount() {
|
|
12471
|
+
try {
|
|
12472
|
+
const body = await (await fetch(POOL_DOUBAO_SESSION_PATH, { credentials: "same-origin" })).json().catch(() => void 0);
|
|
12473
|
+
if (body?.signedIn !== true) return void 0;
|
|
12474
|
+
return {
|
|
12475
|
+
id: "doubao:session",
|
|
12476
|
+
provider: "doubao",
|
|
12477
|
+
nickname: body.savedAt === void 0 ? "豆包账号" : `豆包(${String(body.savedAt).slice(0, 10)} 登录)`,
|
|
12478
|
+
enabled: true
|
|
12479
|
+
};
|
|
12480
|
+
} catch {
|
|
12481
|
+
return;
|
|
12482
|
+
}
|
|
12483
|
+
}
|
|
12484
|
+
/**
|
|
12485
|
+
* Doubao's quota, in the pack's balance row shape.
|
|
12486
|
+
*
|
|
12487
|
+
* The card prints one number per account, so it is the NARROWEST window: that is the one
|
|
12488
|
+
* that stops the next request, and reporting the widest would overstate what is left.
|
|
12489
|
+
*/
|
|
12490
|
+
async function readDoubaoBalance() {
|
|
12491
|
+
try {
|
|
12492
|
+
const body = await (await fetch(POOL_DOUBAO_QUOTA_PATH, { credentials: "same-origin" })).json().catch(() => void 0);
|
|
12493
|
+
if (body?.signedIn !== true) return [];
|
|
12494
|
+
const windows = Array.isArray(body.windows) ? body.windows : [];
|
|
12495
|
+
if (windows.length === 0) return [{
|
|
12496
|
+
accountId: "doubao:session",
|
|
12497
|
+
nickname: "豆包账号",
|
|
12498
|
+
...typeof body.error === "string" && body.error !== "" ? { error: body.error } : {}
|
|
12499
|
+
}];
|
|
12500
|
+
const lowest = windows.reduce((low, window) => {
|
|
12501
|
+
const used = typeof window.usedPercent === "number" ? window.usedPercent : 0;
|
|
12502
|
+
return Math.min(low, Math.max(0, 100 - used));
|
|
12503
|
+
}, 100);
|
|
12504
|
+
return [{
|
|
12505
|
+
accountId: "doubao:session",
|
|
12506
|
+
nickname: "豆包账号",
|
|
12507
|
+
balance: Math.round(lowest),
|
|
12508
|
+
extra: { unit: "%" }
|
|
12509
|
+
}];
|
|
12510
|
+
} catch {
|
|
12511
|
+
return [];
|
|
12512
|
+
}
|
|
12513
|
+
}
|
|
12002
12514
|
function dedupeAccounts(accounts) {
|
|
12003
12515
|
const byNickname = /* @__PURE__ */ new Map();
|
|
12004
12516
|
const order = [];
|
|
@@ -12097,8 +12609,11 @@ window.__ModuleLoader__.load({
|
|
|
12097
12609
|
* from painting over a newer wave-1 one.
|
|
12098
12610
|
*/
|
|
12099
12611
|
const loadSeq = (0, react.useRef)(0);
|
|
12100
|
-
(0, react.useEffect)(() =>
|
|
12101
|
-
mountedRef.current =
|
|
12612
|
+
(0, react.useEffect)(() => {
|
|
12613
|
+
mountedRef.current = true;
|
|
12614
|
+
return () => {
|
|
12615
|
+
mountedRef.current = false;
|
|
12616
|
+
};
|
|
12102
12617
|
}, []);
|
|
12103
12618
|
const markBusy = (provider, on) => {
|
|
12104
12619
|
setBusy((previous) => {
|
|
@@ -12111,14 +12626,41 @@ window.__ModuleLoader__.load({
|
|
|
12111
12626
|
const load = async () => {
|
|
12112
12627
|
loadSeq.current += 1;
|
|
12113
12628
|
try {
|
|
12114
|
-
const channels = (await fetchChannels()).filter((channel) => !REGION_OWNED_CHANNELS.has(channel.id));
|
|
12629
|
+
const channels = (await fetchChannels()).filter((channel) => !REGION_OWNED_CHANNELS.has(channel.id) && channel.id !== "doubao");
|
|
12115
12630
|
const statusAnswer = await cachedProviderStatus(channels.map((channel) => channel.id));
|
|
12116
12631
|
const statuses = providerStatusesFrom(statusAnswer);
|
|
12117
|
-
|
|
12632
|
+
/**
|
|
12633
|
+
* Doubao is added to the scan list by hand.
|
|
12634
|
+
*
|
|
12635
|
+
* `provider.status` counts accounts by walking the PACK's pools, and Doubao has no pack
|
|
12636
|
+
* adapter — so its count is always zero, and a filter keyed on that count drops the
|
|
12637
|
+
* channel before anything can be drawn. A signed-in Doubao session would then exist,
|
|
12638
|
+
* work, and appear nowhere on this page.
|
|
12639
|
+
*/
|
|
12640
|
+
const doubaoAccount = await readDoubaoAccount();
|
|
12641
|
+
const scanProviders = channels.map((channel) => channel.id).filter((id) => (statuses.get(id)?.accountsTotal ?? 0) > 0 || id === "doubao" && doubaoAccount !== void 0);
|
|
12118
12642
|
const perProvider = await Promise.all(scanProviders.map(async (provider) => {
|
|
12119
12643
|
const wantBalances = channels.find((channel) => channel.id === provider)?.credits !== void 0;
|
|
12120
|
-
|
|
12121
|
-
|
|
12644
|
+
/**
|
|
12645
|
+
* Doubao answers from THIS plugin's routes, not from the pack.
|
|
12646
|
+
*
|
|
12647
|
+
* `account.list` and `model.list` are pack RPCs, and the pack has no Doubao adapter —
|
|
12648
|
+
* both answer "unknown provider". Calling them anyway would draw a card reading
|
|
12649
|
+
* "0 accounts, 0 models" for a lane that has one session and six models, and the
|
|
12650
|
+
* empty numbers would look like a failed sign-in.
|
|
12651
|
+
*/
|
|
12652
|
+
const accountsPromise = provider === "doubao" ? Promise.resolve({
|
|
12653
|
+
ok: true,
|
|
12654
|
+
value: { accounts: doubaoAccount === void 0 ? [] : [doubaoAccount] }
|
|
12655
|
+
}) : callPack("account.list", { provider });
|
|
12656
|
+
const modelsPromise = provider === "doubao" ? Promise.resolve({
|
|
12657
|
+
ok: true,
|
|
12658
|
+
value: { models: doubaoListing().map((model) => ({
|
|
12659
|
+
id: model.id,
|
|
12660
|
+
name: model.name,
|
|
12661
|
+
...model.description === void 0 ? {} : { description: model.description }
|
|
12662
|
+
})) }
|
|
12663
|
+
}) : callPack("model.list", { provider });
|
|
12122
12664
|
const [accounts, models] = await Promise.all([accountsPromise.catch(() => refused("account.list failed")), modelsPromise.catch(() => refused("model.list failed"))]);
|
|
12123
12665
|
const modelRows = modelsFrom(models.value);
|
|
12124
12666
|
const modelEmptyBecauseRefused = modelRows.length === 0 && models.ok !== true;
|
|
@@ -12354,6 +12896,22 @@ window.__ModuleLoader__.load({
|
|
|
12354
12896
|
balancePending: true
|
|
12355
12897
|
} : entry));
|
|
12356
12898
|
try {
|
|
12899
|
+
/**
|
|
12900
|
+
* Doubao reports its own balance, from its quota route.
|
|
12901
|
+
*
|
|
12902
|
+
* `credits.balances` is a pack RPC with no Doubao adapter, so it answers "unsupported
|
|
12903
|
+
* provider" and the card printed "no balance reported" under a signed-in account.
|
|
12904
|
+
*/
|
|
12905
|
+
if (provider === "doubao") {
|
|
12906
|
+
const rows = await readDoubaoBalance();
|
|
12907
|
+
setEntries((previous) => previous.map((entry) => entry.channel.id === provider ? {
|
|
12908
|
+
...entry,
|
|
12909
|
+
balancePending: false,
|
|
12910
|
+
balanceError: void 0,
|
|
12911
|
+
balances: rows
|
|
12912
|
+
} : entry));
|
|
12913
|
+
return;
|
|
12914
|
+
}
|
|
12357
12915
|
const envelope = await callPack("credits.balances", force ? {
|
|
12358
12916
|
provider,
|
|
12359
12917
|
force: true
|
|
@@ -12487,6 +13045,26 @@ window.__ModuleLoader__.load({
|
|
|
12487
13045
|
}
|
|
12488
13046
|
markBusy(provider, true);
|
|
12489
13047
|
try {
|
|
13048
|
+
/**
|
|
13049
|
+
* Doubao's account IS the session, so its actions are the session's.
|
|
13050
|
+
*
|
|
13051
|
+
* `account.delete` / `test` / `refresh` are pack RPCs addressed to the pack's credential
|
|
13052
|
+
* store, and Doubao has no entry there — every one of them answered "unsupported
|
|
13053
|
+
* provider", so the buttons did nothing and the row could not be removed.
|
|
13054
|
+
*/
|
|
13055
|
+
if (provider === "doubao") {
|
|
13056
|
+
if (action === "delete") await fetch(POOL_DOUBAO_SESSION_PATH, {
|
|
13057
|
+
method: "DELETE",
|
|
13058
|
+
credentials: "same-origin"
|
|
13059
|
+
});
|
|
13060
|
+
else if (action === "refresh") await fetch(POOL_DOUBAO_QUOTA_PATH, { credentials: "same-origin" });
|
|
13061
|
+
else if (action === "test") await fetch(POOL_DOUBAO_SESSION_PATH, { credentials: "same-origin" });
|
|
13062
|
+
if (!mountedRef.current) return;
|
|
13063
|
+
invalidatePoolSnapshot();
|
|
13064
|
+
await load();
|
|
13065
|
+
setNotice(action === "delete" ? "已删除豆包会话" : "已刷新");
|
|
13066
|
+
return;
|
|
13067
|
+
}
|
|
12490
13068
|
const enabledNow = entries.find((item) => item.channel.id === provider)?.accounts.find((account) => account.id === accountId)?.enabled !== false;
|
|
12491
13069
|
const envelope = await callPack(action === "refresh" ? "account.refresh" : action === "test" ? "account.test" : action === "delete" ? "account.delete" : "account.update", action === "toggle" ? {
|
|
12492
13070
|
accountId,
|
|
@@ -13318,7 +13896,7 @@ window.__ModuleLoader__.load({
|
|
|
13318
13896
|
}
|
|
13319
13897
|
// src/version.ts
|
|
13320
13898
|
/** Version embedded in the browser bundle at build time from the package manifest. */
|
|
13321
|
-
const POOL_VERSION = "1.0.
|
|
13899
|
+
const POOL_VERSION = "1.0.7";
|
|
13322
13900
|
// src/client/PoolCard.tsx
|
|
13323
13901
|
/**
|
|
13324
13902
|
* Heybash card contributed to DSH Plugin configuration.
|
|
@@ -13763,7 +14341,7 @@ window.__ModuleLoader__.load({
|
|
|
13763
14341
|
* Whether a region's model pane is showing the WHOLE roster.
|
|
13764
14342
|
*
|
|
13765
14343
|
* Per region, and default off, because the pane opens on a card the user
|
|
13766
|
-
* scrolled to reach:
|
|
14344
|
+
* scrolled to reach: thirteen full rows of mostly-disabled models pushed
|
|
13767
14345
|
* everything else a screen and a half further down (the reported "无限往下
|
|
13768
14346
|
* 续"). The enabled rows are what "my models" means; the rest are one click
|
|
13769
14347
|
* away and the button says how many there are.
|
|
@@ -15232,14 +15810,15 @@ window.__ModuleLoader__.load({
|
|
|
15232
15810
|
children: [
|
|
15233
15811
|
"claimed",
|
|
15234
15812
|
"already",
|
|
15813
|
+
"uncovered",
|
|
15235
15814
|
"skipped",
|
|
15236
15815
|
"failed"
|
|
15237
15816
|
].map((status) => {
|
|
15238
|
-
const group = job.items?.filter((item) => item
|
|
15817
|
+
const group = job.items?.filter((item) => automationGroup(item) === status) ?? [];
|
|
15239
15818
|
if (group.length === 0) return null;
|
|
15240
15819
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
15241
|
-
className: `dsm-xdpool-auto-job-item dsm-xdpool-auto-job-item-${status}`,
|
|
15242
|
-
title: group.map((item) => item.title + (item.note === void 0 ? "" : ` (${item.note})`)).join("\n"),
|
|
15820
|
+
className: `dsm-xdpool-auto-job-item dsm-xdpool-auto-job-item-${status === "uncovered" ? "skipped" : status}`,
|
|
15821
|
+
title: group.map((item) => item.title + (item.note === void 0 ? "" : ` (${automationNote(item.note, t)})`)).join("\n"),
|
|
15243
15822
|
children: [
|
|
15244
15823
|
t?.(`row.autoItem.${status}`) ?? status,
|
|
15245
15824
|
" ",
|
|
@@ -15260,6 +15839,11 @@ window.__ModuleLoader__.load({
|
|
|
15260
15839
|
})
|
|
15261
15840
|
})
|
|
15262
15841
|
}),
|
|
15842
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
15843
|
+
className: "dsm-xdpool-cpool",
|
|
15844
|
+
"aria-label": "豆包账号",
|
|
15845
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DoubaoPage, { t })
|
|
15846
|
+
}),
|
|
15263
15847
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChannelPoolSection, { t }),
|
|
15264
15848
|
flash === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
15265
15849
|
className: "dsm-xdpool-note",
|
|
@@ -16633,7 +17217,13 @@ window.__ModuleLoader__.load({
|
|
|
16633
17217
|
"row.autoItem.claimed": "claimed",
|
|
16634
17218
|
"row.autoItem.already": "already",
|
|
16635
17219
|
"row.autoItem.skipped": "not yet",
|
|
17220
|
+
"row.autoItem.uncovered": "manual",
|
|
16636
17221
|
"row.autoItem.failed": "failed",
|
|
17222
|
+
"row.autoNote.uncovered": "Not supported by automation; complete manually",
|
|
17223
|
+
"row.autoNote.failed": "Automatic completion failed; retry later",
|
|
17224
|
+
"row.autoNote.unscored": "Not completed or awaiting scoring",
|
|
17225
|
+
"row.autoNote.notAccepted": "Task not accepted",
|
|
17226
|
+
"row.autoNote.locked": "Task locked",
|
|
16637
17227
|
"row.autoJob_report": "Activity report",
|
|
16638
17228
|
"row.autoJob_tasks": "Task rewards",
|
|
16639
17229
|
"row.autoJob_checkin": "Daily check-in",
|
|
@@ -16705,6 +17295,14 @@ window.__ModuleLoader__.load({
|
|
|
16705
17295
|
"agg.noKeyNeeded": "No key needed",
|
|
16706
17296
|
"agg.models": "{count} models",
|
|
16707
17297
|
"agg.unsupported": "This vendor signs in via OAuth/ADC, which this lane cannot drive.",
|
|
17298
|
+
"doubao.ready": "Signed in; the session is stored locally",
|
|
17299
|
+
"doubao.sub": "Sign in with a browser to use direct chat models",
|
|
17300
|
+
"doubao.signIn": "Sign in with a browser",
|
|
17301
|
+
"doubao.signOut": "Sign out",
|
|
17302
|
+
"doubao.waiting": "Waiting for sign-in…",
|
|
17303
|
+
"doubao.refresh": "Refresh quota",
|
|
17304
|
+
"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.",
|
|
16708
17306
|
"agg.listingYes": "Model list available",
|
|
16709
17307
|
"agg.saved": "Saved",
|
|
16710
17308
|
"agg.cleared": "Cleared",
|
|
@@ -16806,6 +17404,7 @@ window.__ModuleLoader__.load({
|
|
|
16806
17404
|
"chan.pending": "The login channels are still loading…",
|
|
16807
17405
|
"chan.unavailable": "The login channels could not start on this host.",
|
|
16808
17406
|
"chan.ownedElsewhere": "These login channels are already served by another plugin — the same thirteen sign-in methods are one click away on that build’s own page.",
|
|
17407
|
+
"chan.ownedElsewhereRow": "Sign in on the “Our Free Model” page",
|
|
16809
17408
|
"chan.empty": "No channel is connected yet.",
|
|
16810
17409
|
"shell.brand": "Heybash",
|
|
16811
17410
|
"shell.project": "Heybash project",
|
|
@@ -16821,6 +17420,7 @@ window.__ModuleLoader__.load({
|
|
|
16821
17420
|
"shell.tabRouting": "Routing",
|
|
16822
17421
|
"shell.subRouting": "Chains that try models in order, so one busy or rate-limited model falls through to the next.",
|
|
16823
17422
|
"shell.tabGateway": "Gateway",
|
|
17423
|
+
"shell.tabDoubao": "Doubao",
|
|
16824
17424
|
"shell.tabBackup": "Backup",
|
|
16825
17425
|
"shell.subGateway": "Open the pool to the other devices on your network.",
|
|
16826
17426
|
"gw.title": "Gateway",
|
|
@@ -17221,7 +17821,13 @@ window.__ModuleLoader__.load({
|
|
|
17221
17821
|
"row.autoItem.claimed": "已领",
|
|
17222
17822
|
"row.autoItem.already": "早已领过",
|
|
17223
17823
|
"row.autoItem.skipped": "暂不可领",
|
|
17824
|
+
"row.autoItem.uncovered": "需手动完成",
|
|
17224
17825
|
"row.autoItem.failed": "失败",
|
|
17826
|
+
"row.autoNote.uncovered": "暂不支持自动完成,请手动操作",
|
|
17827
|
+
"row.autoNote.failed": "自动完成失败,请稍后重试",
|
|
17828
|
+
"row.autoNote.unscored": "尚未完成或正在等待计分",
|
|
17829
|
+
"row.autoNote.notAccepted": "尚未领取任务",
|
|
17830
|
+
"row.autoNote.locked": "任务尚未解锁",
|
|
17225
17831
|
"row.autoJob_report": "活跃上报",
|
|
17226
17832
|
"row.autoJob_tasks": "任务奖励",
|
|
17227
17833
|
"row.autoJob_checkin": "每日签到",
|
|
@@ -17293,6 +17899,14 @@ window.__ModuleLoader__.load({
|
|
|
17293
17899
|
"agg.noKeyNeeded": "无需 key",
|
|
17294
17900
|
"agg.models": "{count} 个模型",
|
|
17295
17901
|
"agg.unsupported": "该厂商需要 OAuth/ADC 授权,这条通道暂时接不了。",
|
|
17902
|
+
"doubao.ready": "已登录,会话保存在本机",
|
|
17903
|
+
"doubao.sub": "浏览器登录后使用豆包直接对话模型",
|
|
17904
|
+
"doubao.signIn": "扫码登录",
|
|
17905
|
+
"doubao.signOut": "退出登录",
|
|
17906
|
+
"doubao.waiting": "等待登录…",
|
|
17907
|
+
"doubao.refresh": "刷新额度",
|
|
17908
|
+
"doubao.why": "豆包已关闭第三方扫码入口(服务端返回 2035),所以这里拉起一个浏览器窗口:在窗口里扫码或填手机号,登录成功后会话自动取回并保存在本机。",
|
|
17909
|
+
"doubao.modelsNote": "模型在对话的模型选择器里:豆包 快速 / 2.1 Turbo。",
|
|
17296
17910
|
"agg.listingYes": "支持拉取模型列表",
|
|
17297
17911
|
"agg.saved": "已保存",
|
|
17298
17912
|
"agg.cleared": "已清除",
|
|
@@ -17394,6 +18008,7 @@ window.__ModuleLoader__.load({
|
|
|
17394
18008
|
"chan.pending": "扫码登录通道正在加载…",
|
|
17395
18009
|
"chan.unavailable": "本机上扫码登录通道没能启动。",
|
|
17396
18010
|
"chan.ownedElsewhere": "这些扫码登录通道已经由另一个插件接管了——同样这十三种登录方式,在它自己的页面上点一下就能用。",
|
|
18011
|
+
"chan.ownedElsewhereRow": "在「我们的免费模型」里登录",
|
|
17397
18012
|
"chan.empty": "还没有任何渠道连上来。",
|
|
17398
18013
|
"shell.brand": "Heybash",
|
|
17399
18014
|
"shell.project": "Heybash 项目",
|
|
@@ -17409,6 +18024,7 @@ window.__ModuleLoader__.load({
|
|
|
17409
18024
|
"shell.tabRouting": "路由",
|
|
17410
18025
|
"shell.subRouting": "把几个模型串成一条链,按顺序试;一个忙了或被限流,就自动落到下一个。",
|
|
17411
18026
|
"shell.tabGateway": "网关",
|
|
18027
|
+
"shell.tabDoubao": "豆包",
|
|
17412
18028
|
"shell.tabBackup": "备份",
|
|
17413
18029
|
"shell.subGateway": "把账号池开放给同网络里的其它设备。",
|
|
17414
18030
|
"gw.title": "网关",
|