heybash-xdpool 1.0.5 → 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/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
@@ -1797,7 +1860,11 @@ window.__ModuleLoader__.load({
1797
1860
  .dsm-xdpool-dot[data-state='empty']{color:color-mix(in srgb, var(--dsw-alias-label-tertiary,#8a90a0) 85%, transparent)}
1798
1861
  .dsm-xdpool-dot:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:3px}
1799
1862
  /* Measured coordinates, not flow: the composer sits at the bottom of the viewport, so a
1800
- panel laid out downward would be clipped. */
1863
+ panel laid out downward would be clipped.
1864
+
1865
+ fixed is required, not incidental: the panel is portaled to document.body, so it has
1866
+ no dot wrapper to anchor to. Placement accounts for visual viewport offsets
1867
+ when a zoomed viewport is smaller than the layout viewport. */
1801
1868
  .dsm-xdpool-dotpanel{position:fixed;z-index:80;box-sizing:border-box;width:max-content;min-width:min(172px,calc(100vw - 16px));max-width:min(280px,calc(100vw - 16px));max-height:calc(100vh - 16px);overflow-y:auto;display:flex;flex-direction:column;gap:7px;padding:10px 12px 11px;border-radius:14px;border:1px solid color-mix(in srgb, var(--dsw-alias-border-l2,#ffffff1f) 92%, transparent);background:var(--dsw-alias-bg-layer-2,#1c1e22);box-shadow:0 18px 48px rgb(0 0 0 / 44%),0 3px 10px rgb(0 0 0 / 24%),inset 0 1px 0 rgb(255 255 255 / 7%);animation:dsm-xdpool-dotpanel-in .16s cubic-bezier(.16,1,.3,1)}
1802
1869
  @keyframes dsm-xdpool-dotpanel-in{from{opacity:0}to{opacity:1}}
1803
1870
  .dsm-xdpool-dotpanel-head{display:flex;align-items:center;gap:8px;min-width:0}
@@ -2233,8 +2300,11 @@ window.__ModuleLoader__.load({
2233
2300
  (0, react.useEffect)(() => {
2234
2301
  if (shared !== void 0) setOwn(shared);
2235
2302
  }, [shared]);
2236
- (0, react.useEffect)(() => () => {
2237
- mounted.current = false;
2303
+ (0, react.useEffect)(() => {
2304
+ mounted.current = true;
2305
+ return () => {
2306
+ mounted.current = false;
2307
+ };
2238
2308
  }, []);
2239
2309
  /**
2240
2310
  * Poll only while this page is mounted.
@@ -2662,7 +2732,16 @@ window.__ModuleLoader__.load({
2662
2732
  * "TRAE" a bare "T", which looks sparse at 40px. CamelCase splitting resolves
2663
2733
  * both: LobsterAI -> LA, Loomy -> L, TRAE -> TR, MiniMax Code -> MM.
2664
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" };
2665
2742
  function channelInitials(name) {
2743
+ const fixed = INITIALS_BY_NAME[name.trim()];
2744
+ if (fixed !== void 0) return fixed;
2666
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 !== "");
2667
2746
  if (segments.length >= 2) return (([...segments[0] ?? ""][0] ?? "") + ([...segments[1] ?? ""][0] ?? "")).toUpperCase();
2668
2747
  return [...segments[0] ?? ""].slice(0, 2).join("").toUpperCase();
@@ -7889,6 +7968,32 @@ window.__ModuleLoader__.load({
7889
7968
  "anthropic-messages": "/messages"
7890
7969
  });
7891
7970
  typeof process === "undefined" || process.platform;
7971
+ // src/member-id.ts
7972
+ /** A login channel member has a colon before any slash in its model id. */
7973
+ function channelMemberOf(id) {
7974
+ const colon = id.indexOf(":");
7975
+ if (colon <= 0) return void 0;
7976
+ const channel = id.slice(0, colon);
7977
+ const model = id.slice(colon + 1);
7978
+ if (!/^[A-Za-z0-9_-]+$/u.test(channel) || model === "" || model.startsWith("//")) return void 0;
7979
+ return {
7980
+ channel,
7981
+ model: id
7982
+ };
7983
+ }
7984
+ /** Remove repeated legacy slash prefixes while preserving canonical colon IDs. */
7985
+ function memberForOwner(owner, model) {
7986
+ if (owner === "workbuddy") return model;
7987
+ while (model.startsWith(`${owner}/`)) model = model.slice(owner.length + 1);
7988
+ while (model.startsWith(`${owner}:${owner}:`)) model = model.slice(owner.length + 1);
7989
+ return model;
7990
+ }
7991
+ /** Flatten one editor member; canonical channel IDs are already complete. */
7992
+ function flattenMember(owner, model) {
7993
+ const value = memberForOwner(owner, model);
7994
+ if (owner === "workbuddy" || channelMemberOf(value)?.channel === owner) return value;
7995
+ return `${owner}/${value}`;
7996
+ }
7892
7997
  Object.freeze({
7893
7998
  "openai-chat": "chat",
7894
7999
  "openai-responses": "responses",
@@ -8200,8 +8305,11 @@ window.__ModuleLoader__.load({
8200
8305
  /** The pair currently being measured, so only one button shows a spinner. */
8201
8306
  const [probing, setProbing] = (0, react.useState)(void 0);
8202
8307
  const mounted = (0, react.useRef)(true);
8203
- (0, react.useEffect)(() => () => {
8204
- mounted.current = false;
8308
+ (0, react.useEffect)(() => {
8309
+ mounted.current = true;
8310
+ return () => {
8311
+ mounted.current = false;
8312
+ };
8205
8313
  }, []);
8206
8314
  /**
8207
8315
  * Ask the host to run one real request against a model, and keep the reading.
@@ -9732,10 +9840,13 @@ window.__ModuleLoader__.load({
9732
9840
  const mounted = (0, react.useRef)(true);
9733
9841
  /** Timers for in-flight logins, keyed by channel id. */
9734
9842
  const timers = (0, react.useRef)(/* @__PURE__ */ new Map());
9735
- (0, react.useEffect)(() => () => {
9736
- mounted.current = false;
9737
- for (const handle of timers.current.values()) window.clearInterval(handle);
9738
- timers.current.clear();
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
+ };
9739
9850
  }, []);
9740
9851
  const load = (0, react.useCallback)(async (signal) => {
9741
9852
  try {
@@ -9962,7 +10073,7 @@ window.__ModuleLoader__.load({
9962
10073
  }
9963
10074
  }, [autoCheckin]);
9964
10075
  const state = status?.state ?? "pending";
9965
- const channels = status?.channels ?? [];
10076
+ const channels = (status?.channels ?? []).filter((channel) => channel.id !== "doubao");
9966
10077
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9967
10078
  className: "dsm-xdpool-channels",
9968
10079
  children: [
@@ -10018,6 +10129,16 @@ window.__ModuleLoader__.load({
10018
10129
  t,
10019
10130
  ui: ui[channel.id] ?? IDLE,
10020
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,
10021
10142
  onSignIn: () => {
10022
10143
  signIn(channel);
10023
10144
  },
@@ -10026,7 +10147,7 @@ window.__ModuleLoader__.load({
10026
10147
  ]
10027
10148
  });
10028
10149
  }
10029
- function ChannelRow({ channel, t, ui, connectedCount, onSignIn, onCancel }) {
10150
+ function ChannelRow({ channel, t, ui, connectedCount, onSignIn, onCancel, ownedElsewhere }) {
10030
10151
  const busy = ui.phase === "signing-in";
10031
10152
  const icon = channelIcon(channel.id);
10032
10153
  const tileMark = icon === void 0 ? { initials: channelInitials(channel.name) } : { icon };
@@ -10081,7 +10202,10 @@ window.__ModuleLoader__.load({
10081
10202
  children: t?.("agg.clear") ?? "Cancel"
10082
10203
  })
10083
10204
  ] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
10084
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
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", {
10085
10209
  type: "button",
10086
10210
  className: "dsm-xdpool-btn",
10087
10211
  onClick: onSignIn,
@@ -10137,17 +10261,11 @@ window.__ModuleLoader__.load({
10137
10261
  * a fallback that never happened. A pool model is its bare id; anything else is
10138
10262
  * `owner/model`, the same composite id the aggregate catalog publishes.
10139
10263
  */
10140
- function bareForOwner(owner, model) {
10141
- if (owner === "workbuddy") return model;
10142
- while (model.startsWith(`${owner}/`) || model.startsWith(`${owner}:`)) model = model.slice(owner.length + 1);
10143
- return model;
10144
- }
10145
10264
  function flattenDraft(platforms) {
10146
10265
  const out = [];
10147
10266
  const seen = /* @__PURE__ */ new Set();
10148
10267
  for (const platform of platforms) for (const model of platform.models) {
10149
- const bare = bareForOwner(platform.owner, model);
10150
- const id = platform.owner === "workbuddy" ? bare : `${platform.owner}/${bare}`;
10268
+ const id = flattenMember(platform.owner, model);
10151
10269
  if (seen.has(id)) continue;
10152
10270
  seen.add(id);
10153
10271
  out.push(id);
@@ -10175,17 +10293,16 @@ window.__ModuleLoader__.load({
10175
10293
  const owner = typeof group.owner === "string" ? group.owner : "workbuddy";
10176
10294
  return {
10177
10295
  owner,
10178
- models: Array.isArray(group.models) ? [...new Set(group.models.filter((model) => typeof model === "string").map((model) => bareForOwner(owner, model)))] : []
10296
+ models: Array.isArray(group.models) ? [...new Set(group.models.filter((model) => typeof model === "string").map((model) => memberForOwner(owner, model)))] : []
10179
10297
  };
10180
10298
  });
10181
10299
  const known = new Set(Array.isArray(combo.models) ? combo.models : []);
10182
10300
  for (const modelId of Array.isArray(combo.missing) ? combo.missing : []) {
10183
10301
  if (known.has(modelId)) continue;
10302
+ const channel = channelMemberOf(modelId);
10184
10303
  const slash = modelId.indexOf("/");
10185
- const colon = modelId.indexOf(":");
10186
- const separator = slash === -1 ? colon : colon === -1 ? slash : Math.min(slash, colon);
10187
- const owner = separator === -1 ? "workbuddy" : modelId.slice(0, separator);
10188
- const model = bareForOwner(owner, separator === -1 ? modelId : modelId.slice(separator + 1));
10304
+ const owner = channel?.channel ?? (slash === -1 ? "workbuddy" : modelId.slice(0, slash));
10305
+ const model = channel?.model ?? memberForOwner(owner, slash === -1 ? modelId : modelId.slice(slash + 1));
10189
10306
  const group = platforms.find((entry) => entry.owner === owner);
10190
10307
  if (group === void 0) platforms.push({
10191
10308
  owner,
@@ -10239,8 +10356,11 @@ window.__ModuleLoader__.load({
10239
10356
  /** True once the drafts were seeded from the server, so later polls don't stomp edits. */
10240
10357
  const seeded = (0, react.useRef)(false);
10241
10358
  const mounted = (0, react.useRef)(true);
10242
- (0, react.useEffect)(() => () => {
10243
- mounted.current = false;
10359
+ (0, react.useEffect)(() => {
10360
+ mounted.current = true;
10361
+ return () => {
10362
+ mounted.current = false;
10363
+ };
10244
10364
  }, []);
10245
10365
  const load = (0, react.useCallback)(async (signal) => {
10246
10366
  try {
@@ -10766,7 +10886,7 @@ window.__ModuleLoader__.load({
10766
10886
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
10767
10887
  className: "dsm-xdpool-rt-members",
10768
10888
  children: platform.models.map((model, modelIndex) => {
10769
- const fullId = platform.owner === "workbuddy" ? model : `${platform.owner}/${model}`;
10889
+ const fullId = flattenMember(platform.owner, model);
10770
10890
  const candidate = candidateById.get(fullId);
10771
10891
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
10772
10892
  className: "dsm-xdpool-rt-member",
@@ -11055,8 +11175,11 @@ window.__ModuleLoader__.load({
11055
11175
  /** True once the server's values were adopted, so polls do not stomp edits. */
11056
11176
  const seeded = (0, react.useRef)(false);
11057
11177
  const mounted = (0, react.useRef)(true);
11058
- (0, react.useEffect)(() => () => {
11059
- mounted.current = false;
11178
+ (0, react.useEffect)(() => {
11179
+ mounted.current = true;
11180
+ return () => {
11181
+ mounted.current = false;
11182
+ };
11060
11183
  }, []);
11061
11184
  const load = (0, react.useCallback)(async (signal) => {
11062
11185
  try {
@@ -11508,6 +11631,265 @@ window.__ModuleLoader__.load({
11508
11631
  ]
11509
11632
  });
11510
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+ARsABQAAAAEAAABGASgAAwAAAAEAAgAAh2kABAAAAAEAAABOAAAAAAAAAJAAAAABAAAAkAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAQKADAAQAAAABAAAAQAAAAACU3PoRAAAACXBIWXMAABYlAAAWJQFJUiTwAAACnmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAgICAgICA8dGlmZjpYUmVzb2x1dGlvbj4xNDQ8L3RpZmY6WFJlc29sdXRpb24+CiAgICAgICAgIDx0aWZmOllSZXNvbHV0aW9uPjE0NDwvdGlmZjpZUmVzb2x1dGlvbj4KICAgICAgICAgPHRpZmY6UmVzb2x1dGlvblVuaXQ+MjwvdGlmZjpSZXNvbHV0aW9uVW5pdD4KICAgICAgICAgPGV4aWY6UGl4ZWxZRGltZW5zaW9uPjEwMjQ8L2V4aWY6UGl4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RDku6+/aBXqGPWFB3oRHuxDL/cBd773Lh576hk8/fJmNLc0YdWypegfiWDrG69jQeMsNB3cB1ftUozk1Rg7I4bj5F68ZcAwKs53sWs9y2/I2rvM1IuEg83Hjhz855u/uvrHrMLIyuDEW/b0pwCg1hozGQyO7AyGgk/RuHU5XI583gtoD1zWvNRcZEDEiVqR50ao7wT6eKjROZzAzpZOvPj+EbSOcu4EKnCYf9vR2j2ClUuW4pl9nZhaXYOdnaMINK6EK6/U2BMbtUvHZbrsfDaXpp/yeZeFlwWLxxPBaCS8iyDf8+yz9377/h/90xbSmo7IRPrEiV382UltBAj/ziG/nl9yTqU9KOblUkwkK1xN327n/v68lZfjrNUXcz7z46gcD8NhD6Vled5RfgaLZITr/gCX1SH6a1FtRyCXO8QEUQaPXZngKvMsSuWNOBY/NnfyTwyCPSeOtzStu/PGZhb188rQpqp/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
+ `;
11511
11893
  // src/client/region-card.tsx
11512
11894
  /**
11513
11895
  * Which login channel each lane IS.
@@ -11853,6 +12235,108 @@ window.__ModuleLoader__.load({
11853
12235
  if (model.multiplier !== 0) return void 0;
11854
12236
  return paidSiblingOf(model, models);
11855
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
+ }
11856
12340
  // src/client/ChannelPoolSection.tsx
11857
12341
  /**
11858
12342
  * Account-pool page, scan-channel section.
@@ -11976,6 +12460,57 @@ window.__ModuleLoader__.load({
11976
12460
  * moment a login lands), so the newest entry wins: it is the one whose
11977
12461
  * credential was written last.
11978
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
+ }
11979
12514
  function dedupeAccounts(accounts) {
11980
12515
  const byNickname = /* @__PURE__ */ new Map();
11981
12516
  const order = [];
@@ -12074,8 +12609,11 @@ window.__ModuleLoader__.load({
12074
12609
  * from painting over a newer wave-1 one.
12075
12610
  */
12076
12611
  const loadSeq = (0, react.useRef)(0);
12077
- (0, react.useEffect)(() => () => {
12078
- mountedRef.current = false;
12612
+ (0, react.useEffect)(() => {
12613
+ mountedRef.current = true;
12614
+ return () => {
12615
+ mountedRef.current = false;
12616
+ };
12079
12617
  }, []);
12080
12618
  const markBusy = (provider, on) => {
12081
12619
  setBusy((previous) => {
@@ -12088,14 +12626,41 @@ window.__ModuleLoader__.load({
12088
12626
  const load = async () => {
12089
12627
  loadSeq.current += 1;
12090
12628
  try {
12091
- 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");
12092
12630
  const statusAnswer = await cachedProviderStatus(channels.map((channel) => channel.id));
12093
12631
  const statuses = providerStatusesFrom(statusAnswer);
12094
- const scanProviders = channels.map((channel) => channel.id).filter((id) => (statuses.get(id)?.accountsTotal ?? 0) > 0);
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);
12095
12642
  const perProvider = await Promise.all(scanProviders.map(async (provider) => {
12096
12643
  const wantBalances = channels.find((channel) => channel.id === provider)?.credits !== void 0;
12097
- const accountsPromise = callPack("account.list", { provider });
12098
- const modelsPromise = callPack("model.list", { provider });
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 });
12099
12664
  const [accounts, models] = await Promise.all([accountsPromise.catch(() => refused("account.list failed")), modelsPromise.catch(() => refused("model.list failed"))]);
12100
12665
  const modelRows = modelsFrom(models.value);
12101
12666
  const modelEmptyBecauseRefused = modelRows.length === 0 && models.ok !== true;
@@ -12331,6 +12896,22 @@ window.__ModuleLoader__.load({
12331
12896
  balancePending: true
12332
12897
  } : entry));
12333
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
+ }
12334
12915
  const envelope = await callPack("credits.balances", force ? {
12335
12916
  provider,
12336
12917
  force: true
@@ -12464,6 +13045,26 @@ window.__ModuleLoader__.load({
12464
13045
  }
12465
13046
  markBusy(provider, true);
12466
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
+ }
12467
13068
  const enabledNow = entries.find((item) => item.channel.id === provider)?.accounts.find((account) => account.id === accountId)?.enabled !== false;
12468
13069
  const envelope = await callPack(action === "refresh" ? "account.refresh" : action === "test" ? "account.test" : action === "delete" ? "account.delete" : "account.update", action === "toggle" ? {
12469
13070
  accountId,
@@ -13295,7 +13896,7 @@ window.__ModuleLoader__.load({
13295
13896
  }
13296
13897
  // src/version.ts
13297
13898
  /** Version embedded in the browser bundle at build time from the package manifest. */
13298
- const POOL_VERSION = "1.0.5";
13899
+ const POOL_VERSION = "1.0.7";
13299
13900
  // src/client/PoolCard.tsx
13300
13901
  /**
13301
13902
  * Heybash card contributed to DSH Plugin configuration.
@@ -13740,7 +14341,7 @@ window.__ModuleLoader__.load({
13740
14341
  * Whether a region's model pane is showing the WHOLE roster.
13741
14342
  *
13742
14343
  * Per region, and default off, because the pane opens on a card the user
13743
- * scrolled to reach: fourteen full rows of mostly-disabled models pushed
14344
+ * scrolled to reach: thirteen full rows of mostly-disabled models pushed
13744
14345
  * everything else a screen and a half further down (the reported "无限往下
13745
14346
  * 续"). The enabled rows are what "my models" means; the rest are one click
13746
14347
  * away and the button says how many there are.
@@ -15209,14 +15810,15 @@ window.__ModuleLoader__.load({
15209
15810
  children: [
15210
15811
  "claimed",
15211
15812
  "already",
15813
+ "uncovered",
15212
15814
  "skipped",
15213
15815
  "failed"
15214
15816
  ].map((status) => {
15215
- const group = job.items?.filter((item) => item.status === status) ?? [];
15817
+ const group = job.items?.filter((item) => automationGroup(item) === status) ?? [];
15216
15818
  if (group.length === 0) return null;
15217
15819
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
15218
- className: `dsm-xdpool-auto-job-item dsm-xdpool-auto-job-item-${status}`,
15219
- 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"),
15220
15822
  children: [
15221
15823
  t?.(`row.autoItem.${status}`) ?? status,
15222
15824
  " ",
@@ -15237,6 +15839,11 @@ window.__ModuleLoader__.load({
15237
15839
  })
15238
15840
  })
15239
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
+ }),
15240
15847
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChannelPoolSection, { t }),
15241
15848
  flash === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
15242
15849
  className: "dsm-xdpool-note",
@@ -15826,12 +16433,14 @@ window.__ModuleLoader__.load({
15826
16433
  /** Position a measured panel above its trigger, flipping and clamping at viewport edges. */
15827
16434
  function creditPanelPosition(anchor, panel, viewport) {
15828
16435
  const margin = 8;
15829
- const left = Math.min(Math.max(margin, anchor.left + anchor.width / 2 - panel.width / 2), Math.max(margin, viewport.width - panel.width - margin));
16436
+ const minLeft = (viewport.left ?? 0) + margin;
16437
+ const minTop = (viewport.top ?? 0) + margin;
16438
+ const left = Math.min(Math.max(minLeft, anchor.left + anchor.width / 2 - panel.width / 2), Math.max(minLeft, (viewport.left ?? 0) + viewport.width - panel.width - margin));
15830
16439
  const above = anchor.top - panel.height - margin;
15831
16440
  const below = anchor.bottom + margin;
15832
- const preferAbove = above >= margin || anchor.top >= viewport.height - anchor.bottom;
16441
+ const preferAbove = above >= minTop || anchor.top - (viewport.top ?? 0) >= (viewport.top ?? 0) + viewport.height - anchor.bottom;
15833
16442
  return {
15834
- top: Math.min(Math.max(margin, preferAbove ? above : below), Math.max(margin, viewport.height - panel.height - margin)),
16443
+ top: Math.min(Math.max(minTop, preferAbove ? above : below), Math.max(minTop, (viewport.top ?? 0) + viewport.height - panel.height - margin)),
15835
16444
  left
15836
16445
  };
15837
16446
  }
@@ -16166,7 +16775,7 @@ window.__ModuleLoader__.load({
16166
16775
  observer.disconnect();
16167
16776
  };
16168
16777
  }, []);
16169
- /** Keep body-relative panel and viewport-relative anchor in the same coordinate space. */
16778
+ /** Keep the anchor and fixed panel in layout-viewport CSS coordinates. */
16170
16779
  (0, react.useLayoutEffect)(() => {
16171
16780
  if (!open) {
16172
16781
  setPos(void 0);
@@ -16178,9 +16787,20 @@ window.__ModuleLoader__.load({
16178
16787
  let frame;
16179
16788
  const update = () => {
16180
16789
  frame = void 0;
16181
- const { left, top } = creditPanelPosition(anchor.getBoundingClientRect(), panel.getBoundingClientRect(), {
16790
+ const box = anchor.getBoundingClientRect();
16791
+ const panelBox = {
16792
+ width: panel.offsetWidth,
16793
+ height: panel.offsetHeight
16794
+ };
16795
+ const vv = window.visualViewport;
16796
+ const { left, top } = creditPanelPosition(box, panelBox, vv === null || vv === void 0 ? {
16182
16797
  width: window.innerWidth,
16183
16798
  height: window.innerHeight
16799
+ } : {
16800
+ width: vv.width,
16801
+ height: vv.height,
16802
+ left: vv.offsetLeft,
16803
+ top: vv.offsetTop
16184
16804
  });
16185
16805
  setPos((current) => current?.top === top && current.left === left ? current : {
16186
16806
  top,
@@ -16196,10 +16816,14 @@ window.__ModuleLoader__.load({
16196
16816
  observer?.observe(panel);
16197
16817
  window.addEventListener("resize", schedule);
16198
16818
  window.addEventListener("scroll", schedule, true);
16819
+ window.visualViewport?.addEventListener("resize", schedule);
16820
+ window.visualViewport?.addEventListener("scroll", schedule);
16199
16821
  return () => {
16200
16822
  observer?.disconnect();
16201
16823
  window.removeEventListener("resize", schedule);
16202
16824
  window.removeEventListener("scroll", schedule, true);
16825
+ window.visualViewport?.removeEventListener("resize", schedule);
16826
+ window.visualViewport?.removeEventListener("scroll", schedule);
16203
16827
  if (frame !== void 0) window.cancelAnimationFrame(frame);
16204
16828
  };
16205
16829
  }, [
@@ -16593,7 +17217,13 @@ window.__ModuleLoader__.load({
16593
17217
  "row.autoItem.claimed": "claimed",
16594
17218
  "row.autoItem.already": "already",
16595
17219
  "row.autoItem.skipped": "not yet",
17220
+ "row.autoItem.uncovered": "manual",
16596
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",
16597
17227
  "row.autoJob_report": "Activity report",
16598
17228
  "row.autoJob_tasks": "Task rewards",
16599
17229
  "row.autoJob_checkin": "Daily check-in",
@@ -16665,6 +17295,14 @@ window.__ModuleLoader__.load({
16665
17295
  "agg.noKeyNeeded": "No key needed",
16666
17296
  "agg.models": "{count} models",
16667
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.",
16668
17306
  "agg.listingYes": "Model list available",
16669
17307
  "agg.saved": "Saved",
16670
17308
  "agg.cleared": "Cleared",
@@ -16766,6 +17404,7 @@ window.__ModuleLoader__.load({
16766
17404
  "chan.pending": "The login channels are still loading…",
16767
17405
  "chan.unavailable": "The login channels could not start on this host.",
16768
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",
16769
17408
  "chan.empty": "No channel is connected yet.",
16770
17409
  "shell.brand": "Heybash",
16771
17410
  "shell.project": "Heybash project",
@@ -16781,6 +17420,7 @@ window.__ModuleLoader__.load({
16781
17420
  "shell.tabRouting": "Routing",
16782
17421
  "shell.subRouting": "Chains that try models in order, so one busy or rate-limited model falls through to the next.",
16783
17422
  "shell.tabGateway": "Gateway",
17423
+ "shell.tabDoubao": "Doubao",
16784
17424
  "shell.tabBackup": "Backup",
16785
17425
  "shell.subGateway": "Open the pool to the other devices on your network.",
16786
17426
  "gw.title": "Gateway",
@@ -17181,7 +17821,13 @@ window.__ModuleLoader__.load({
17181
17821
  "row.autoItem.claimed": "已领",
17182
17822
  "row.autoItem.already": "早已领过",
17183
17823
  "row.autoItem.skipped": "暂不可领",
17824
+ "row.autoItem.uncovered": "需手动完成",
17184
17825
  "row.autoItem.failed": "失败",
17826
+ "row.autoNote.uncovered": "暂不支持自动完成,请手动操作",
17827
+ "row.autoNote.failed": "自动完成失败,请稍后重试",
17828
+ "row.autoNote.unscored": "尚未完成或正在等待计分",
17829
+ "row.autoNote.notAccepted": "尚未领取任务",
17830
+ "row.autoNote.locked": "任务尚未解锁",
17185
17831
  "row.autoJob_report": "活跃上报",
17186
17832
  "row.autoJob_tasks": "任务奖励",
17187
17833
  "row.autoJob_checkin": "每日签到",
@@ -17253,6 +17899,14 @@ window.__ModuleLoader__.load({
17253
17899
  "agg.noKeyNeeded": "无需 key",
17254
17900
  "agg.models": "{count} 个模型",
17255
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。",
17256
17910
  "agg.listingYes": "支持拉取模型列表",
17257
17911
  "agg.saved": "已保存",
17258
17912
  "agg.cleared": "已清除",
@@ -17354,6 +18008,7 @@ window.__ModuleLoader__.load({
17354
18008
  "chan.pending": "扫码登录通道正在加载…",
17355
18009
  "chan.unavailable": "本机上扫码登录通道没能启动。",
17356
18010
  "chan.ownedElsewhere": "这些扫码登录通道已经由另一个插件接管了——同样这十三种登录方式,在它自己的页面上点一下就能用。",
18011
+ "chan.ownedElsewhereRow": "在「我们的免费模型」里登录",
17357
18012
  "chan.empty": "还没有任何渠道连上来。",
17358
18013
  "shell.brand": "Heybash",
17359
18014
  "shell.project": "Heybash 项目",
@@ -17369,6 +18024,7 @@ window.__ModuleLoader__.load({
17369
18024
  "shell.tabRouting": "路由",
17370
18025
  "shell.subRouting": "把几个模型串成一条链,按顺序试;一个忙了或被限流,就自动落到下一个。",
17371
18026
  "shell.tabGateway": "网关",
18027
+ "shell.tabDoubao": "豆包",
17372
18028
  "shell.tabBackup": "备份",
17373
18029
  "shell.subGateway": "把账号池开放给同网络里的其它设备。",
17374
18030
  "gw.title": "网关",