dsh-xdpool 3.0.4 → 3.0.5
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 +17 -0
- package/README.md +5 -5
- package/lib/client.js +1 -1
- package/lib/index.d.ts +10 -0
- package/lib/index.js +25 -3
- package/package.json +1 -1
- package/vendor/channel-pack/pack.js +24 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
本项目的所有重要变更都会记录在此文件。
|
|
3
3
|
版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
|
|
4
|
+
## 3.0.5 — 没登录不再显示模型,账号表不会被空快照抹掉
|
|
5
|
+
|
|
6
|
+
### 没登录就不发布模型
|
|
7
|
+
|
|
8
|
+
池里没有某个区域的账号时,这个区域的 provider 以前照样发布内置目录 —— 没登录的人也
|
|
9
|
+
看到一整组 WorkBuddy 模型,点任何一个都只会失败(issue #204)。现在按区域判断:一个
|
|
10
|
+
账号都没有就返回空目录,分组不出现。豆包与 pack 的各渠道早就是这个规矩,这两条 lane
|
|
11
|
+
只是漏了。
|
|
12
|
+
|
|
13
|
+
### 账号表不会被空快照覆盖
|
|
14
|
+
|
|
15
|
+
升级/重装过程中出现过「账号表被写成空、磁盘上没有可恢复旧版本」的报告,用户的账号在
|
|
16
|
+
界面上消失(issue #200)。现在写账号表时比对进程内旧表:**用空表覆盖一张非空表**会被
|
|
17
|
+
拒绝并留下日志 —— 那条路径几乎总是故障(读失败、并发写、装包时的空状态),不是用户
|
|
18
|
+
意图。逐个删除账号走的是 `removeAccount`,它显式允许清空,行为不变;真要一次性重置可以
|
|
19
|
+
设 `DSH_XDPOOL_ALLOW_EMPTY_ACCOUNTS=1`。
|
|
20
|
+
|
|
4
21
|
## 3.0.4 — 账号卡回来了,签到回来了,重复分组没了
|
|
5
22
|
|
|
6
23
|
> 3.0 重构砍掉的三块界面与两处数据源,这一版接回来。
|
package/README.md
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
## 更新公告
|
|
11
11
|
|
|
12
|
-
**3.0.
|
|
12
|
+
**3.0.5** — 没登录不再显示模型,账号表不会被空快照抹掉。
|
|
13
13
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
- 某个区域一个账号都没有时,选择器里不再出现这一组(点了也只会失败的模型)
|
|
15
|
+
- 写账号表前比对旧表:空表覆盖非空表会被拒绝,升级/重装不再可能把账号抹掉
|
|
16
|
+
|
|
17
|
+
**3.0.4** — 账号池重新显示账号卡(余额、积分明细、每日签到、停用/忽略/首选)、卡上标出「正在使用」、模型选择器不再出现两份、登录通道页算上插件池账号。
|
|
18
18
|
|
|
19
19
|
**3.0.3** — 豆包每个模型用自己的思考档位、全关真的会空、积分自动化「立即执行」、右上角关闭按钮。
|
|
20
20
|
|
package/lib/client.js
CHANGED
|
@@ -140,7 +140,7 @@ window.__ModuleLoader__.load({
|
|
|
140
140
|
const POOL_NAV_ICON_MASK_URL = `data:image/svg+xml;utf8,${encodeURIComponent(POOL_NAV_ICON_SVG)}`;
|
|
141
141
|
//#endregion
|
|
142
142
|
//#region src/version.ts
|
|
143
|
-
const POOL_VERSION = "3.0.
|
|
143
|
+
const POOL_VERSION = "3.0.5";
|
|
144
144
|
function compareVersions(left, right) {
|
|
145
145
|
const parse = (value) => {
|
|
146
146
|
const [core, ...rest] = value.trim().replace(/^v/u, "").split("-");
|
package/lib/index.d.ts
CHANGED
|
@@ -3661,6 +3661,16 @@ interface WorkBuddyAdapterOptions {
|
|
|
3661
3661
|
* without a restart.
|
|
3662
3662
|
*/
|
|
3663
3663
|
extraRows?: (() => readonly FreeModelRow[]) | undefined;
|
|
3664
|
+
/**
|
|
3665
|
+
* Whether this region's pool holds at least one account — issue #204.
|
|
3666
|
+
*
|
|
3667
|
+
* Without it the provider published the built-in roster even on a machine with
|
|
3668
|
+
* nobody signed in: the picker showed a full WorkBuddy group whose every call
|
|
3669
|
+
* could only fail. Both other adapters answer "no catalogue" when they have no
|
|
3670
|
+
* credential (`providerCatalogVisible` in the pack, and the Doubao adapter
|
|
3671
|
+
* since #169), and this one is no different.
|
|
3672
|
+
*/
|
|
3673
|
+
hasAccounts?: (() => boolean) | undefined;
|
|
3664
3674
|
}
|
|
3665
3675
|
/** What {@link createWorkBuddyAdapter} hands back. */
|
|
3666
3676
|
interface WorkBuddyAdapter {
|
package/lib/index.js
CHANGED
|
@@ -26954,6 +26954,12 @@ function createWorkBuddyAdapter(options) {
|
|
|
26954
26954
|
const aggregateCatalog = isAggregateCatalog(catalog);
|
|
26955
26955
|
const extraRows = options.extraRows;
|
|
26956
26956
|
const buildModels = () => {
|
|
26957
|
+
/**
|
|
26958
|
+
* No account, no catalogue — issue #204. Answered before anything else so a
|
|
26959
|
+
* machine that never signed in shows no group at all rather than a list of
|
|
26960
|
+
* models that cannot answer.
|
|
26961
|
+
*/
|
|
26962
|
+
if (options.hasAccounts?.() === false) return [];
|
|
26957
26963
|
const baseUrl = `${shim.baseUrl()}/v1`;
|
|
26958
26964
|
if (extraRows !== void 0) return (extraRows() ?? []).map((row) => toExtraLaneModel(row, baseUrl, providerId));
|
|
26959
26965
|
if (aggregateCatalog) return [...catalog.providerRows().map((row) => toAggregateModel(row, baseUrl, providerId)), ...catalog.comboRows().map((row) => toComboModel(row, baseUrl, providerId))];
|
|
@@ -29306,7 +29312,7 @@ function parseBody(body) {
|
|
|
29306
29312
|
*
|
|
29307
29313
|
* @module dsh-xdpool/version
|
|
29308
29314
|
*/
|
|
29309
|
-
const POOL_VERSION = "3.0.
|
|
29315
|
+
const POOL_VERSION = "3.0.5";
|
|
29310
29316
|
//#endregion
|
|
29311
29317
|
//#region src/update-check.ts
|
|
29312
29318
|
/**
|
|
@@ -38962,14 +38968,30 @@ function apply(ctx, config = {}) {
|
|
|
38962
38968
|
shim: shims.cn,
|
|
38963
38969
|
catalog: core.catalogs.cn,
|
|
38964
38970
|
providerId: POOL_PROVIDER_BY_REGION.cn,
|
|
38965
|
-
displayName: POOL_NAME_BY_REGION.cn
|
|
38971
|
+
displayName: POOL_NAME_BY_REGION.cn,
|
|
38972
|
+
/**
|
|
38973
|
+
* 池里没有这个区域的账号时,不发布任何模型 —— issue #204。
|
|
38974
|
+
*
|
|
38975
|
+
* 之前会照发内置目录,于是没登录的人也看到一整组 WorkBuddy 模型,
|
|
38976
|
+
* 点任何一个都只会失败。区域按账号自己的 domain 判定,和池子的
|
|
38977
|
+
* 选号逻辑用同一个函数。
|
|
38978
|
+
*/
|
|
38979
|
+
hasAccounts: () => core.pool.list("cn").length > 0
|
|
38966
38980
|
}),
|
|
38967
38981
|
global: createWorkBuddyAdapter({
|
|
38968
38982
|
ctx,
|
|
38969
38983
|
shim: shims.global,
|
|
38970
38984
|
catalog: core.catalogs.global,
|
|
38971
38985
|
providerId: POOL_PROVIDER_BY_REGION.global,
|
|
38972
|
-
displayName: POOL_NAME_BY_REGION.global
|
|
38986
|
+
displayName: POOL_NAME_BY_REGION.global,
|
|
38987
|
+
/**
|
|
38988
|
+
* 池里没有这个区域的账号时,不发布任何模型 —— issue #204。
|
|
38989
|
+
*
|
|
38990
|
+
* 之前会照发内置目录,于是没登录的人也看到一整组 WorkBuddy 模型,
|
|
38991
|
+
* 点任何一个都只会失败。区域按账号自己的 domain 判定,和池子的
|
|
38992
|
+
* 选号逻辑用同一个函数。
|
|
38993
|
+
*/
|
|
38994
|
+
hasAccounts: () => core.pool.list("global").length > 0
|
|
38973
38995
|
}),
|
|
38974
38996
|
aggregate: createWorkBuddyAdapter({
|
|
38975
38997
|
ctx,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "dsh-xdpool",
|
|
3
3
|
"displayName": "DSH XD Pool",
|
|
4
4
|
"description": "One DSH model pool for every free quota you have: merge all locally signed-in WorkBuddy accounts with auto-failover, sign in to 22 vendors by QR/web, aggregate 77 external vendors' keys, plus a usage dashboard, model routing, a local OpenAI-compatible gateway and a points-automation suite.",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.5",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "XDTrees",
|
|
8
8
|
"homepage": "https://github.com/XDTrees/dsh-xdpool#readme",
|
|
@@ -30199,7 +30199,28 @@ var AccountPool = class {
|
|
|
30199
30199
|
* **必须连同黑名单一起写回**:两种后端都是整体写入,
|
|
30200
30200
|
* 只写 `{ accounts }` 会把同一文档里的 `disabledModels` 抹掉。
|
|
30201
30201
|
*/
|
|
30202
|
-
async writeAccounts(accounts) {
|
|
30202
|
+
async writeAccounts(accounts, options = {}) {
|
|
30203
|
+
/**
|
|
30204
|
+
* [xdpool-local] 空表保护 —— issue #200。
|
|
30205
|
+
*
|
|
30206
|
+
* 升级/重装过程中出现过「账号表被写成空、且没有 .bak」的报告:用户的 5 个
|
|
30207
|
+
* 账号在界面上消失,磁盘上也没有可恢复的旧版本。一条空快照覆盖一张非空表
|
|
30208
|
+
* 几乎总是故障(读失败、并发写、装包时的空状态),而不是用户意图 —— 逐个
|
|
30209
|
+
* 删除账号走的是 `removeAccount`,那条路径显式传 `allowEmpty`。
|
|
30210
|
+
*
|
|
30211
|
+
* 拒绝时保留内存与磁盘上的旧表,并留下可查的日志;真要一次性清空(迁移、
|
|
30212
|
+
* 重置)可以设 `DSH_XDPOOL_ALLOW_EMPTY_ACCOUNTS=1`。
|
|
30213
|
+
*/
|
|
30214
|
+
const empty = Array.isArray(accounts) && accounts.length === 0
|
|
30215
|
+
const hadRows = Array.isArray(this.cache) && this.cache.length > 0
|
|
30216
|
+
const forced = typeof process !== 'undefined' && process.env.DSH_XDPOOL_ALLOW_EMPTY_ACCOUNTS === '1'
|
|
30217
|
+
if (empty && hadRows && options.allowEmpty !== true && !forced) {
|
|
30218
|
+
this.ctx.logger?.warn?.(
|
|
30219
|
+
`[channel-pack] 拒绝用空账号表覆盖现有 ${this.cache.length} 个账号(疑似升级/重装时的空快照);`
|
|
30220
|
+
+ '确需清空请逐个删除,或设 DSH_XDPOOL_ALLOW_EMPTY_ACCOUNTS=1'
|
|
30221
|
+
)
|
|
30222
|
+
return
|
|
30223
|
+
}
|
|
30203
30224
|
this.cache = accounts;
|
|
30204
30225
|
this.loaded = true;
|
|
30205
30226
|
if (this.store.kind === "memory") {
|
|
@@ -30664,7 +30685,8 @@ var AccountPool = class {
|
|
|
30664
30685
|
await this.ctx.credentials.unset(credentialRef(entry.credentialRef));
|
|
30665
30686
|
} catch {
|
|
30666
30687
|
}
|
|
30667
|
-
|
|
30688
|
+
// 显式删除:删到空也要写进去,所以带上 allowEmpty。
|
|
30689
|
+
await this.writeAccounts(this.readAccounts().filter((a) => a.id !== id), { allowEmpty: true });
|
|
30668
30690
|
}
|
|
30669
30691
|
/**
|
|
30670
30692
|
* 重排某 provider 下账号的顺序(Channel Pack 拖拽排序)。
|