dsh-xdpool 2.7.5 → 3.0.1
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 +146 -0
- package/README.md +31 -17
- package/assets/account-credits.png +0 -0
- package/assets/account-pool.png +0 -0
- package/assets/aggregate-channels.png +0 -0
- package/assets/automation-panel.png +0 -0
- package/assets/dashboard.png +0 -0
- package/assets/login-channels.png +0 -0
- package/assets/model-picker.png +0 -0
- package/lib/bin.js +434 -12
- package/lib/client.js +16190 -14443
- package/lib/index.d.ts +166 -4
- package/lib/index.js +11830 -1201
- package/package.json +6 -3
- package/screenshots.json +2 -1
- package/scripts/extract-design-css.mjs +322 -0
- package/scripts/link-host-peers.mjs +3 -3
- package/scripts/make-rail-icons.mjs +46 -0
- package/scripts/probe-channels.mjs +142 -0
- package/vendor/channel-pack/pack.js +15 -1
- package/assets/region-tabs.png +0 -0
package/lib/index.d.ts
CHANGED
|
@@ -910,7 +910,16 @@ export declare const WORKBUDDY_AUTH_FILE_ENV = "WORKBUDDY_AUTH_FILE";
|
|
|
910
910
|
*/
|
|
911
911
|
interface WorkBuddySkippedFile {
|
|
912
912
|
path: string;
|
|
913
|
-
|
|
913
|
+
/**
|
|
914
|
+
* `key-rotated` is separated from `encrypted` on purpose (#178).
|
|
915
|
+
*
|
|
916
|
+
* Both mean "this file is sealed and we cannot open it", but the FIX differs: an
|
|
917
|
+
* `encrypted` file opens once the desktop app has run and handed over its key, while a
|
|
918
|
+
* file sealed under a keyId no installed build produces will NEVER open that way — the
|
|
919
|
+
* vendor rotated the at-rest key and the old envelope is orphaned. Reporting both as
|
|
920
|
+
* 「启动一次 WorkBuddy」 sent the user to do something that could not work.
|
|
921
|
+
*/
|
|
922
|
+
reason: 'encrypted' | 'key-rotated' | 'expired' | 'unreadable' | 'malformed';
|
|
914
923
|
}
|
|
915
924
|
interface WorkBuddyCredential {
|
|
916
925
|
accessToken: string;
|
|
@@ -1069,6 +1078,14 @@ interface AccountPoolOptions {
|
|
|
1069
1078
|
export declare class WorkBuddyAccountPool {
|
|
1070
1079
|
private readonly logger;
|
|
1071
1080
|
private authDirs;
|
|
1081
|
+
/**
|
|
1082
|
+
* The directories the CALLER named, or undefined when the plugin guessed them.
|
|
1083
|
+
*
|
|
1084
|
+
* Only an explicit list is scanned now: the default pointed at the desktop app's credential
|
|
1085
|
+
* store, which no account arrives from any more. Keeping the distinction means the import
|
|
1086
|
+
* path and the tests can still point the pool at a directory.
|
|
1087
|
+
*/
|
|
1088
|
+
private readonly explicitAuthDirs;
|
|
1072
1089
|
private cooldownMs;
|
|
1073
1090
|
/**
|
|
1074
1091
|
* How long an account stays out of rotation after the upstream reports its
|
|
@@ -1905,6 +1922,19 @@ interface PoolWebAggregateProvider {
|
|
|
1905
1922
|
* vocabulary so both kinds of card present one idea one way.
|
|
1906
1923
|
*/
|
|
1907
1924
|
distribution?: string;
|
|
1925
|
+
/**
|
|
1926
|
+
* 注册表里写明的模型信息(显示名 / 识图 / 推理),按模型 id 索引。
|
|
1927
|
+
*
|
|
1928
|
+
* 只含注册表声明过的模型;「发现模型」拉回来的 id 不在这里,卡片对它们只显示 id。
|
|
1929
|
+
* 聚合页的模型行和「选择模型」浮层用它显示模型名和标签。
|
|
1930
|
+
*/
|
|
1931
|
+
modelMeta?: Readonly<Record<string, PoolWebAggregateModelMeta>>;
|
|
1932
|
+
}
|
|
1933
|
+
/** 一个注册表模型的显示信息。字段缺省表示注册表没写。 */
|
|
1934
|
+
interface PoolWebAggregateModelMeta {
|
|
1935
|
+
name: string;
|
|
1936
|
+
vision?: boolean;
|
|
1937
|
+
reasoning?: boolean;
|
|
1908
1938
|
}
|
|
1909
1939
|
/** The document {@link POOL_AGGREGATE_PATH} answers with. */
|
|
1910
1940
|
interface PoolWebAggregateStatus {
|
|
@@ -1966,7 +1996,7 @@ interface PoolWebChannel {
|
|
|
1966
1996
|
*/
|
|
1967
1997
|
smsHint?: boolean;
|
|
1968
1998
|
/** A sentence shown beside the button, for a login that needs explaining. */
|
|
1969
|
-
loginHint?: 'doubao';
|
|
1999
|
+
loginHint?: 'doubao' | 'marvis' | 'astudio' | 'magicrew' | 'accio' | 'qiniu' | 'monkeycode' | 'baizhi' | 'autoclaw';
|
|
1970
2000
|
/**
|
|
1971
2001
|
* What the pack can report about this vendor's credits, when it can report
|
|
1972
2002
|
* something at all.
|
|
@@ -2079,6 +2109,8 @@ interface PoolWebRelayPatch {
|
|
|
2079
2109
|
* leaves the gateway open.
|
|
2080
2110
|
*/
|
|
2081
2111
|
models?: string[];
|
|
2112
|
+
/** 模型共享方式:'pool' 按账号池启用列表,'custom' 只放行 models。 */
|
|
2113
|
+
modelsMode?: 'pool' | 'custom';
|
|
2082
2114
|
}
|
|
2083
2115
|
/**
|
|
2084
2116
|
* What {@link POOL_RELAY_PATH} answers with.
|
|
@@ -2105,6 +2137,21 @@ interface PoolWebRelayStatus {
|
|
|
2105
2137
|
key: string;
|
|
2106
2138
|
/** Why nothing is bound; '' when there is nothing to explain. */
|
|
2107
2139
|
error: string;
|
|
2140
|
+
/** 当前的模型共享方式;旧后端不返回这个字段。 */
|
|
2141
|
+
modelsMode?: 'pool' | 'custom';
|
|
2142
|
+
/**
|
|
2143
|
+
* 网关转发了什么。
|
|
2144
|
+
*
|
|
2145
|
+
* 只统计真正转发出去的请求:被拒的(没开、密钥不对、路径不认)不计入。
|
|
2146
|
+
* 这是这个进程自己的记账,重启归零 —— 界面上要写清,不然会被当成历史总量。
|
|
2147
|
+
*/
|
|
2148
|
+
stats?: {
|
|
2149
|
+
requests: number;
|
|
2150
|
+
failed: number;
|
|
2151
|
+
avgLatencyMs?: number;
|
|
2152
|
+
inputTokens: number;
|
|
2153
|
+
outputTokens: number;
|
|
2154
|
+
} | undefined;
|
|
2108
2155
|
/**
|
|
2109
2156
|
* Every model the gateway could serve, with the name a human reads.
|
|
2110
2157
|
*
|
|
@@ -2441,7 +2488,12 @@ interface PoolWebStatus {
|
|
|
2441
2488
|
interface PoolWebSkippedFile {
|
|
2442
2489
|
/** Basename only; the full path lives in the desktop app's auth directory. */
|
|
2443
2490
|
file: string;
|
|
2444
|
-
|
|
2491
|
+
/**
|
|
2492
|
+
* `key-rotated` means the file is sealed under a key id no installed build produces
|
|
2493
|
+
* (#178) — the vendor rotated the at-rest key. Starting the desktop app cannot fix it,
|
|
2494
|
+
* which is why it is not folded into `encrypted`.
|
|
2495
|
+
*/
|
|
2496
|
+
reason: 'encrypted' | 'key-rotated' | 'expired' | 'unreadable' | 'malformed';
|
|
2445
2497
|
}
|
|
2446
2498
|
/** How a region's model list was obtained. */
|
|
2447
2499
|
type PoolWebCatalogSource = 'live' | 'fallback';
|
|
@@ -2915,6 +2967,23 @@ interface ComboModelRow {
|
|
|
2915
2967
|
*/
|
|
2916
2968
|
combo: true;
|
|
2917
2969
|
}
|
|
2970
|
+
/**
|
|
2971
|
+
* One model served by a 扫码登录 channel, as the route editor sees it.
|
|
2972
|
+
*
|
|
2973
|
+
* These are the channels the vendored pack registers with the HOST (`trae`,
|
|
2974
|
+
* `qoder`, `codebuddy`…). They are in neither catalog above: the pool catalog
|
|
2975
|
+
* describes the WorkBuddy account lanes, and the aggregate catalog describes the
|
|
2976
|
+
* vendors in this plugin's own registry. A chain could not name them at all, which
|
|
2977
|
+
* is why the routing page offered exactly ONE platform — the pool — while the login
|
|
2978
|
+
* page happily showed thirteen.
|
|
2979
|
+
*/
|
|
2980
|
+
interface HostModelRow {
|
|
2981
|
+
/** `<channel>:<modelId>` — the id the shim already resolves to its fifth lane. */
|
|
2982
|
+
id: string;
|
|
2983
|
+
channel: string;
|
|
2984
|
+
modelId: string;
|
|
2985
|
+
name: string;
|
|
2986
|
+
}
|
|
2918
2987
|
//#endregion
|
|
2919
2988
|
//#region src/store.d.ts
|
|
2920
2989
|
/**
|
|
@@ -2963,6 +3032,12 @@ interface RelaySetting {
|
|
|
2963
3032
|
* an id — including the login channels, whose quota is this account's.
|
|
2964
3033
|
*/
|
|
2965
3034
|
models?: string[];
|
|
3035
|
+
/**
|
|
3036
|
+
* 模型共享方式。'pool' = 按账号池启用列表(models 保留但不生效);
|
|
3037
|
+
* 'custom' = 只放行 models。旧配置没有这个字段时按 models 是否存在推断,
|
|
3038
|
+
* 这样升级前存过列表的网关行为不变。
|
|
3039
|
+
*/
|
|
3040
|
+
modelsMode?: 'pool' | 'custom';
|
|
2966
3041
|
}
|
|
2967
3042
|
//#endregion
|
|
2968
3043
|
//#region src/stats.d.ts
|
|
@@ -3246,6 +3321,19 @@ interface AggregateModelRow {
|
|
|
3246
3321
|
declare class AggregateCatalog {
|
|
3247
3322
|
private readonly read;
|
|
3248
3323
|
private readonly poolRows;
|
|
3324
|
+
/**
|
|
3325
|
+
* The scan-login channel rows, when the caller has them — issue #177.
|
|
3326
|
+
*
|
|
3327
|
+
* A chain member may name a channel model (`trae:deepseek-v4.1-flash`), and resolving one
|
|
3328
|
+
* needs this list. Without it `resolveComboMember` answered undefined for every channel
|
|
3329
|
+
* member, so a chain made entirely of them resolved to zero members and was skipped
|
|
3330
|
+
* outright: it never reached the picker, and the gateway answered `combo_missing` for a
|
|
3331
|
+
* chain the routing page showed as valid.
|
|
3332
|
+
*
|
|
3333
|
+
* Injected rather than fetched because the lane is async and this constructor is not; a
|
|
3334
|
+
* caller that has no channel lane passes nothing and gets the old behaviour.
|
|
3335
|
+
*/
|
|
3336
|
+
private readonly hostRows;
|
|
3249
3337
|
private rows;
|
|
3250
3338
|
private chainRows;
|
|
3251
3339
|
/**
|
|
@@ -3254,7 +3342,20 @@ declare class AggregateCatalog {
|
|
|
3254
3342
|
* that names a WorkBuddy model. A chain may mix pool models with aggregate
|
|
3255
3343
|
* ones, so without this a perfectly valid chain would lose its pool half.
|
|
3256
3344
|
*/
|
|
3257
|
-
constructor(read: () => AggregateStore | Promise<AggregateStore>, poolRows?: () => readonly WorkBuddyModelInfo[]
|
|
3345
|
+
constructor(read: () => AggregateStore | Promise<AggregateStore>, poolRows?: () => readonly WorkBuddyModelInfo[],
|
|
3346
|
+
/**
|
|
3347
|
+
* The scan-login channel rows, when the caller has them — issue #177.
|
|
3348
|
+
*
|
|
3349
|
+
* A chain member may name a channel model (`trae:deepseek-v4.1-flash`), and resolving one
|
|
3350
|
+
* needs this list. Without it `resolveComboMember` answered undefined for every channel
|
|
3351
|
+
* member, so a chain made entirely of them resolved to zero members and was skipped
|
|
3352
|
+
* outright: it never reached the picker, and the gateway answered `combo_missing` for a
|
|
3353
|
+
* chain the routing page showed as valid.
|
|
3354
|
+
*
|
|
3355
|
+
* Injected rather than fetched because the lane is async and this constructor is not; a
|
|
3356
|
+
* caller that has no channel lane passes nothing and gets the old behaviour.
|
|
3357
|
+
*/
|
|
3358
|
+
hostRows?: () => Promise<readonly HostModelRow[]>);
|
|
3258
3359
|
/**
|
|
3259
3360
|
* Every row this catalog offers: third-party rows first, then chain rows.
|
|
3260
3361
|
*
|
|
@@ -3297,6 +3398,21 @@ type ChannelLaneEvent = {
|
|
|
3297
3398
|
} | {
|
|
3298
3399
|
kind: 'done';
|
|
3299
3400
|
finishReason: string;
|
|
3401
|
+
} |
|
|
3402
|
+
/**
|
|
3403
|
+
* The turn ended in a failure the host reported — issue #195.
|
|
3404
|
+
*
|
|
3405
|
+
* Without this, `mapFinishReason` folded `kind:'error'` into `'stop'`, the
|
|
3406
|
+
* gateway answered `finish_reason:"stop"` with empty content, and the host read
|
|
3407
|
+
* that as `EMPTY_RESPONSE` — a *retryable* code. A genuine upstream failure
|
|
3408
|
+
* therefore looked like a flaky model: the client retried until backoff ran
|
|
3409
|
+
* out and the user never saw the reason. `message` carries the host's own text
|
|
3410
|
+
* (the status included) so it can reach the client verbatim.
|
|
3411
|
+
*/
|
|
3412
|
+
{
|
|
3413
|
+
kind: 'failed';
|
|
3414
|
+
message: string;
|
|
3415
|
+
status: number | undefined;
|
|
3300
3416
|
};
|
|
3301
3417
|
interface ChannelLane {
|
|
3302
3418
|
rows: () => Promise<readonly ChannelLaneRow[]>;
|
|
@@ -3416,6 +3532,18 @@ interface WorkBuddyShimOptions {
|
|
|
3416
3532
|
* threading an argument nobody reads.
|
|
3417
3533
|
*/
|
|
3418
3534
|
usageRecorder?: UsageRecorder;
|
|
3535
|
+
/**
|
|
3536
|
+
* The scan-login channel rows, for chain members that name one — issue #177.
|
|
3537
|
+
*
|
|
3538
|
+
* A chain may mix pool models, aggregate models and channel models. Without this the channel
|
|
3539
|
+
* half resolved to undefined and was silently dropped, so a chain of only channel members
|
|
3540
|
+
* reached the executor with zero members and answered `combo_missing` — while the routing page
|
|
3541
|
+
* showed the same chain as valid.
|
|
3542
|
+
*
|
|
3543
|
+
* Injected rather than imported: the lane is async and owns its own 60s cache, and this shim
|
|
3544
|
+
* must not build one.
|
|
3545
|
+
*/
|
|
3546
|
+
hostRows?: () => Promise<readonly HostModelRow[]>;
|
|
3419
3547
|
/**
|
|
3420
3548
|
* The second lane: providers the user holds a key for.
|
|
3421
3549
|
*
|
|
@@ -4519,6 +4647,18 @@ interface PoolStatusRouteOptions {
|
|
|
4519
4647
|
* the one conclusion the user cannot verify for themselves.
|
|
4520
4648
|
*/
|
|
4521
4649
|
channelsDocument?: () => PoolWebChannelsStatus;
|
|
4650
|
+
/**
|
|
4651
|
+
* How each channel picks its account, and the pool-wide default.
|
|
4652
|
+
*
|
|
4653
|
+
* Read from the plugin's own file rather than the host's settings document: the host's write
|
|
4654
|
+
* path for a plugin section accepts only its own toggle, so the per-channel overrides live where
|
|
4655
|
+
* this plugin already keeps state.
|
|
4656
|
+
*/
|
|
4657
|
+
channelUsage?: () => {
|
|
4658
|
+
pool: string;
|
|
4659
|
+
channels: Record<string, string>;
|
|
4660
|
+
};
|
|
4661
|
+
setChannelUsage?: (channel: string, strategy: string | undefined) => Promise<void>;
|
|
4522
4662
|
/**
|
|
4523
4663
|
* The chains plus the roster their members are drawn from, built host-side.
|
|
4524
4664
|
*
|
|
@@ -4614,6 +4754,13 @@ export interface Config {
|
|
|
4614
4754
|
* Absent reads as `priority`.
|
|
4615
4755
|
*/
|
|
4616
4756
|
distribution?: 'priority' | 'round-robin' | 'balanced' | 'sticky' | 'expiry';
|
|
4757
|
+
/**
|
|
4758
|
+
* Per-channel usage order, overriding `distribution` for that channel alone.
|
|
4759
|
+
*
|
|
4760
|
+
* A channel with no entry follows `distribution`, so an install that never opened the channel
|
|
4761
|
+
* page behaves exactly as before.
|
|
4762
|
+
*/
|
|
4763
|
+
channelDistribution?: Readonly<Record<string, 'priority' | 'round-robin' | 'balanced' | 'sticky' | 'expiry'>>;
|
|
4617
4764
|
/**
|
|
4618
4765
|
* Account ids switched off on the card. A disabled account is never picked
|
|
4619
4766
|
* to serve a request, but it stays in the pool and on the card so it can be
|
|
@@ -4675,6 +4822,21 @@ export interface Config {
|
|
|
4675
4822
|
* (the aggregate switch does not govern it — it is not an aggregate provider).
|
|
4676
4823
|
*/
|
|
4677
4824
|
freeLane?: boolean;
|
|
4825
|
+
/**
|
|
4826
|
+
* Doubao model ids the user switched OFF on the card — issue #196.
|
|
4827
|
+
*
|
|
4828
|
+
* A DISABLE list, not an allow list, and the direction is the fix. The card
|
|
4829
|
+
* keeps its ticks in the browser's localStorage, which this process cannot
|
|
4830
|
+
* read, so `DoubaoHostAdapter.listModels` published the whole live roster
|
|
4831
|
+
* while the card showed "4/16". The card mirrors the result here.
|
|
4832
|
+
*
|
|
4833
|
+
* An empty list means "nothing switched off" — which is also what every
|
|
4834
|
+
* install starts as, because a settings array nobody has written yet reads as
|
|
4835
|
+
* `[]`. Storing the complement instead would make a fresh install publish an
|
|
4836
|
+
* empty group until the card was opened once: exactly the trap #122 documented
|
|
4837
|
+
* for `enabledModelIds`, and it is avoided by keeping the polarity.
|
|
4838
|
+
*/
|
|
4839
|
+
doubaoDisabledModels?: string[];
|
|
4678
4840
|
}
|
|
4679
4841
|
/** One region's saved model selection. */
|
|
4680
4842
|
export interface ModelSelectionConfig {
|