dsh-xdpool 2.7.5 → 3.0.0
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 +113 -0
- package/assets/dashboard.png +0 -0
- package/lib/bin.js +425 -11
- package/lib/client.js +16328 -14897
- package/lib/index.d.ts +136 -4
- package/lib/index.js +11535 -1232
- package/package.json +6 -3
- 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/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
|
*
|
|
@@ -3416,6 +3517,18 @@ interface WorkBuddyShimOptions {
|
|
|
3416
3517
|
* threading an argument nobody reads.
|
|
3417
3518
|
*/
|
|
3418
3519
|
usageRecorder?: UsageRecorder;
|
|
3520
|
+
/**
|
|
3521
|
+
* The scan-login channel rows, for chain members that name one — issue #177.
|
|
3522
|
+
*
|
|
3523
|
+
* A chain may mix pool models, aggregate models and channel models. Without this the channel
|
|
3524
|
+
* half resolved to undefined and was silently dropped, so a chain of only channel members
|
|
3525
|
+
* reached the executor with zero members and answered `combo_missing` — while the routing page
|
|
3526
|
+
* showed the same chain as valid.
|
|
3527
|
+
*
|
|
3528
|
+
* Injected rather than imported: the lane is async and owns its own 60s cache, and this shim
|
|
3529
|
+
* must not build one.
|
|
3530
|
+
*/
|
|
3531
|
+
hostRows?: () => Promise<readonly HostModelRow[]>;
|
|
3419
3532
|
/**
|
|
3420
3533
|
* The second lane: providers the user holds a key for.
|
|
3421
3534
|
*
|
|
@@ -4519,6 +4632,18 @@ interface PoolStatusRouteOptions {
|
|
|
4519
4632
|
* the one conclusion the user cannot verify for themselves.
|
|
4520
4633
|
*/
|
|
4521
4634
|
channelsDocument?: () => PoolWebChannelsStatus;
|
|
4635
|
+
/**
|
|
4636
|
+
* How each channel picks its account, and the pool-wide default.
|
|
4637
|
+
*
|
|
4638
|
+
* Read from the plugin's own file rather than the host's settings document: the host's write
|
|
4639
|
+
* path for a plugin section accepts only its own toggle, so the per-channel overrides live where
|
|
4640
|
+
* this plugin already keeps state.
|
|
4641
|
+
*/
|
|
4642
|
+
channelUsage?: () => {
|
|
4643
|
+
pool: string;
|
|
4644
|
+
channels: Record<string, string>;
|
|
4645
|
+
};
|
|
4646
|
+
setChannelUsage?: (channel: string, strategy: string | undefined) => Promise<void>;
|
|
4522
4647
|
/**
|
|
4523
4648
|
* The chains plus the roster their members are drawn from, built host-side.
|
|
4524
4649
|
*
|
|
@@ -4614,6 +4739,13 @@ export interface Config {
|
|
|
4614
4739
|
* Absent reads as `priority`.
|
|
4615
4740
|
*/
|
|
4616
4741
|
distribution?: 'priority' | 'round-robin' | 'balanced' | 'sticky' | 'expiry';
|
|
4742
|
+
/**
|
|
4743
|
+
* Per-channel usage order, overriding `distribution` for that channel alone.
|
|
4744
|
+
*
|
|
4745
|
+
* A channel with no entry follows `distribution`, so an install that never opened the channel
|
|
4746
|
+
* page behaves exactly as before.
|
|
4747
|
+
*/
|
|
4748
|
+
channelDistribution?: Readonly<Record<string, 'priority' | 'round-robin' | 'balanced' | 'sticky' | 'expiry'>>;
|
|
4617
4749
|
/**
|
|
4618
4750
|
* Account ids switched off on the card. A disabled account is never picked
|
|
4619
4751
|
* to serve a request, but it stays in the pool and on the card so it can be
|