dsh-connect-workbuddy 5.17.0 → 5.18.2
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 +1454 -0
- package/README.en.md +18 -6
- package/README.md +88 -9
- package/docs/WINDOWS.md +4 -3
- package/lib/bin.js +12 -4
- package/lib/client.js +1788 -802
- package/lib/{host-heartbeat-09tOJATV.js → host-heartbeat-DFqDsnte.js} +485 -90
- package/lib/index.d.ts +333 -7
- package/lib/index.js +1436 -110
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -196,6 +196,15 @@ declare function workbuddyOwnAuthPath(region: WorkBuddyRegion): string;
|
|
|
196
196
|
* first refresh writes the per-region file), and removed by `logout`.
|
|
197
197
|
*/
|
|
198
198
|
declare function legacyWorkbuddyOwnAuthPath(): string;
|
|
199
|
+
/**
|
|
200
|
+
* 平台名,**比 `NodeJS.Platform` 宽**。
|
|
201
|
+
*
|
|
202
|
+
* DSHM(端侧形态)内嵌的 Node 在鸿蒙上把 `process.platform` 报成
|
|
203
|
+
* `'openharmony'`,而 @types/node 的 `NodeJS.Platform` 里没有这个字面量
|
|
204
|
+
* (issue #190)。用 `| (string & {})` 而不是 `| string`:前者保留联合类型的
|
|
205
|
+
* 自动补全,同时允许这些运行时才出现的值。
|
|
206
|
+
*/
|
|
207
|
+
type DesktopAuthPlatform = NodeJS.Platform | (string & {});
|
|
199
208
|
/**
|
|
200
209
|
* Platform-default directories holding the WorkBuddy desktop app's auth file.
|
|
201
210
|
*
|
|
@@ -204,10 +213,13 @@ declare function legacyWorkbuddyOwnAuthPath(): string;
|
|
|
204
213
|
* folder backup, enterprise policy) still resolves. macOS has no equivalent
|
|
205
214
|
* env variable; the single Application Support path is used as-is.
|
|
206
215
|
*
|
|
216
|
+
* 鸿蒙(issue #190)没有 `homedir()` 可用——它返回应用沙箱,所以那条分支用
|
|
217
|
+
* 系统固定挂载点。Linux 会同时看 XDG 的 data 与 config 两套目录。
|
|
218
|
+
*
|
|
207
219
|
* `platform`, `home`, and `env` are injectable so the platform branches are
|
|
208
220
|
* testable on any host without touching a real machine.
|
|
209
221
|
*/
|
|
210
|
-
declare function defaultDesktopAuthDirs(platform?:
|
|
222
|
+
declare function defaultDesktopAuthDirs(platform?: DesktopAuthPlatform, home?: string, env?: NodeJS.ProcessEnv): string[];
|
|
211
223
|
/**
|
|
212
224
|
* The live auth file's platform candidates, in probe order.
|
|
213
225
|
*
|
|
@@ -467,6 +479,26 @@ declare class WorkBuddyCredentialStore {
|
|
|
467
479
|
* available at all, that hint IS accurate and this returns false.
|
|
468
480
|
*/
|
|
469
481
|
selectionLost(): Promise<boolean>;
|
|
482
|
+
/**
|
|
483
|
+
* Why the vault could not be read, when it could not (issue #199).
|
|
484
|
+
*
|
|
485
|
+
* `syncVault` deliberately swallows a failed `readVaultEntries` so account
|
|
486
|
+
* discovery stays up — the right call for availability, the wrong call for
|
|
487
|
+
* honesty: the user then sees the SAVED account reported as "no longer on
|
|
488
|
+
* this machine" when the truth is "this process may not read the directory".
|
|
489
|
+
* The issue #199 lockout (foreign owner + `/inheritance:r`) produces exactly
|
|
490
|
+
* that shape: readdir EPERM while per-path readFile still works, so nothing
|
|
491
|
+
* else in the diagnostics reports the directory either.
|
|
492
|
+
*
|
|
493
|
+
* A dedicated readdir probe rather than a field recorded during the scan:
|
|
494
|
+
* the scan is shared/cached (`scanInflight`), its failure is transient by
|
|
495
|
+
* design, and a probe here is one cheap readdir on a path that is already
|
|
496
|
+
* failing — the error string is the fact the card needs.
|
|
497
|
+
*
|
|
498
|
+
* Returns the raw error message, or `undefined` when the directory reads
|
|
499
|
+
* (including the absent case, which is normal before the first OAuth add).
|
|
500
|
+
*/
|
|
501
|
+
vaultReadError(): Promise<string | undefined>;
|
|
470
502
|
/** The freshest stored credential for the current selection, no refresh. */
|
|
471
503
|
current(): Promise<WorkBuddyCredential | undefined>;
|
|
472
504
|
/**
|
|
@@ -673,6 +705,18 @@ interface WorkBuddyDeviceSettings {
|
|
|
673
705
|
* 前者是"本机没有设备盐",后者是"这些账号没有 uid"。
|
|
674
706
|
*/
|
|
675
707
|
derived?: Readonly<Record<string, WorkBuddyDeviceDerived>>;
|
|
708
|
+
/**
|
|
709
|
+
* 「真实值」档在这台机器上到底能不能用(由 Host 判定,界面不猜平台)。
|
|
710
|
+
*
|
|
711
|
+
* 见 `index.ts` 的 `REAL_TIER_AVAILABILITY`:macOS 上 SDK 能被发现、`probe` 也答
|
|
712
|
+
* `ready`,但取 token 那一环会 `dispatch_sync` 死锁,所以那一档永远只能降级。
|
|
713
|
+
* 界面据此禁用档位按钮并说明原因——一个"能点、点了没用、只能靠降级兜底"的选项
|
|
714
|
+
* 比不提供更差。
|
|
715
|
+
*/
|
|
716
|
+
realTier?: {
|
|
717
|
+
state: 'available' | 'broken' | 'unavailable';
|
|
718
|
+
platform: string;
|
|
719
|
+
};
|
|
676
720
|
/**
|
|
677
721
|
* 用户在「SDK」分区手填的 SDK 目录;空串 = 走自动发现链。
|
|
678
722
|
*
|
|
@@ -740,8 +784,16 @@ interface WorkBuddyDeviceProfileLookup {
|
|
|
740
784
|
//#region src/turing-sdk.d.ts
|
|
741
785
|
/** What one `probe` established about the SDK on THIS machine. */
|
|
742
786
|
interface TuringSdkInfo {
|
|
743
|
-
/**
|
|
744
|
-
|
|
787
|
+
/**
|
|
788
|
+
* `ready` = 能加载且自称支持;`unsupported` = 平台不支持;`missing` = 没发现本机
|
|
789
|
+
* 装有桌面端 SDK;`error` = 目录在但加载不了;
|
|
790
|
+
* `disabled` = 用户把总开关关了(`deviceSdkEnabled: false`)。
|
|
791
|
+
*
|
|
792
|
+
* `disabled` 与 `missing` 必须分开:前者是"我不要",后者是"这台机器上没有"。
|
|
793
|
+
* 合并成一个会让关掉开关的用户每次打开面板都看到一条"装个桌面端就好"的建议,
|
|
794
|
+
* 而那正是他明确拒绝去做的事。
|
|
795
|
+
*/
|
|
796
|
+
state: 'ready' | 'unsupported' | 'missing' | 'error' | 'disabled';
|
|
745
797
|
/** `win32-x64` 之类的主机三元组;只用于展示与排障,不再决定目录。 */
|
|
746
798
|
bundle: string;
|
|
747
799
|
/** 本机桌面端里的 SDK 目录(或 `WORKBUDDY_TURING_SDK_DIR` 指向的目录);空串 = 没找到。 */
|
|
@@ -796,6 +848,18 @@ interface WorkBuddyDeviceSdkPort {
|
|
|
796
848
|
refresh(): Promise<WorkBuddyDeviceSdkReport>;
|
|
797
849
|
/** 完整 token;没有可用值时为 `undefined`。只在显式点击后调用。 */
|
|
798
850
|
reveal(): Promise<string | undefined>;
|
|
851
|
+
/**
|
|
852
|
+
* SDK 总开关(`Config.deviceSdkEnabled`)的读写。
|
|
853
|
+
*
|
|
854
|
+
* 与 `read` 分开两个方法,而不是并进上面那份快照:开关是**配置**,快照是
|
|
855
|
+
* **测量**。混在一起会让"读一次快照"变成一次可能失败的配置读,而这一页最该
|
|
856
|
+
* 做到的事就是"打不开也能告诉你是谁坏了"。
|
|
857
|
+
*
|
|
858
|
+
* `write` 返回 `false` 表示这个宿主没有 settings 服务(老宿主),卡片据此把
|
|
859
|
+
* 开关置灰,而不是显示一个点了没反应的勾选框。
|
|
860
|
+
*/
|
|
861
|
+
readEnabled(): Promise<boolean | undefined>;
|
|
862
|
+
writeEnabled(enabled: boolean): Promise<boolean>;
|
|
799
863
|
}
|
|
800
864
|
//#endregion
|
|
801
865
|
//#region src/image-gen.d.ts
|
|
@@ -2077,7 +2141,28 @@ declare const FALLBACK_WORKBUDDY_MODELS: readonly WorkBuddyModelInfo[];
|
|
|
2077
2141
|
* expose different rosters — the CN list has no `gpt-*`/`gemini-*` entries —
|
|
2078
2142
|
* so a global account must never be seeded with the CN list. Like the CN
|
|
2079
2143
|
* fallback this is replaced by the live refresh; it only keeps the provider
|
|
2080
|
-
* usable before the first fetch lands. Order
|
|
2144
|
+
* usable before the first fetch lands. Order mirrors the upstream.
|
|
2145
|
+
*
|
|
2146
|
+
* ⚠️ IT CARRIES NO `creditMultiplier`, AND THAT IS THE FIX FOR ISSUE #214.
|
|
2147
|
+
* This list used to hardcode one rate per model, captured on 2026-09-11. The
|
|
2148
|
+
* upstream moves those rates — the reporter measured `glm-5.3` at x0.69 and
|
|
2149
|
+
* `hy4-preview` at x0.29 on 2026-11-04 against the x0.79 / x0.00 written
|
|
2150
|
+
* here — so every captured rate aged into a WRONG PRICE. Worse, the overlay
|
|
2151
|
+
* rule (`overlayLiveCapabilities`: the live side owns `creditMultiplier`)
|
|
2152
|
+
* meant this table WON over the user's saved directory whenever the catalog
|
|
2153
|
+
* still held it, which is exactly the reported symptom: the card showed the
|
|
2154
|
+
* built-in table's figures, not the saved ones and not the upstream's.
|
|
2155
|
+
*
|
|
2156
|
+
* A price is a FACT ABOUT NOW, and this module never learns "now": it is the
|
|
2157
|
+
* offline placeholder, written once and never refreshed. So it must not
|
|
2158
|
+
* assert a price at all. An absent multiplier renders as "no rate" — the
|
|
2159
|
+
* honest answer — and `pickFreeModel` deliberately treats absence as NOT
|
|
2160
|
+
* free, so the account pool can never probe a paid model by mistake. The CN
|
|
2161
|
+
* table has always been shaped this way for the same reason.
|
|
2162
|
+
*
|
|
2163
|
+
* The ROSTER (ids, names, windows) stays: that is what keeps the provider
|
|
2164
|
+
* non-empty while the first fetch is in flight, and an id list ages far
|
|
2165
|
+
* more slowly than a price list.
|
|
2081
2166
|
*/
|
|
2082
2167
|
declare const FALLBACK_WORKBUDDY_MODELS_GLOBAL: readonly WorkBuddyModelInfo[];
|
|
2083
2168
|
/**
|
|
@@ -2121,6 +2206,13 @@ declare function deriveCatalog(catalog: readonly WorkBuddyModelInfo[], enabled:
|
|
|
2121
2206
|
*/
|
|
2122
2207
|
declare class WorkBuddyCatalog {
|
|
2123
2208
|
private models;
|
|
2209
|
+
/**
|
|
2210
|
+
* Whether {@link models} came from the upstream at least once.
|
|
2211
|
+
*
|
|
2212
|
+
* Starts `false`: the constructor seeds the static fallback, and that list
|
|
2213
|
+
* must never be mistaken for a live answer (see {@link hasLiveRoster}).
|
|
2214
|
+
*/
|
|
2215
|
+
private live;
|
|
2124
2216
|
/**
|
|
2125
2217
|
* Whether this region has any local sign-in. Defaults to `true` — the
|
|
2126
2218
|
* permissive direction — so a scan that has not run yet (or failed) keeps
|
|
@@ -2157,6 +2249,26 @@ declare class WorkBuddyCatalog {
|
|
|
2157
2249
|
* "no account" gate (issue #12), `enabled` is the user's explicit on/off.
|
|
2158
2250
|
*/
|
|
2159
2251
|
current(): readonly WorkBuddyModelInfo[];
|
|
2252
|
+
/**
|
|
2253
|
+
* Whether {@link current} is an UPSTREAM answer rather than the built-in
|
|
2254
|
+
* fallback it was constructed with.
|
|
2255
|
+
*
|
|
2256
|
+
* This distinction is what keeps issue #32 fixed. `applySelection` passes
|
|
2257
|
+
* `current()` into `configuredModels` as the live roster to fall back to, so
|
|
2258
|
+
* a partial saved slot demotes to the live directory instead of the static
|
|
2259
|
+
* list. But before the first refresh lands, `current()` IS the static list
|
|
2260
|
+
* (the constructor seeds it), and `resolveRoster` cannot tell the two apart
|
|
2261
|
+
* because it only sees a non-empty array. The result was the exact bug #32
|
|
2262
|
+
* describes, reached from the other direction: a settings write arriving
|
|
2263
|
+
* before the first catalog refresh let the STATIC roster masquerade as live,
|
|
2264
|
+
* and `set()` then committed it — so a model that only exists upstream
|
|
2265
|
+
* (`space-bunny`) vanished from the picker while the runtime still served it.
|
|
2266
|
+
*
|
|
2267
|
+
* Callers that use `current()` as a *live* answer must check this first. A
|
|
2268
|
+
* caller that only wants "what would we advertise right now" does not need
|
|
2269
|
+
* to: the fallback is the honest answer to that question.
|
|
2270
|
+
*/
|
|
2271
|
+
hasLiveRoster(): boolean;
|
|
2160
2272
|
/** Whether this region currently advertises any model. */
|
|
2161
2273
|
isRegionUsable(): boolean;
|
|
2162
2274
|
/** Whether the user has this region's provider switched on. */
|
|
@@ -2183,8 +2295,19 @@ declare class WorkBuddyCatalog {
|
|
|
2183
2295
|
* disagree. Returns whether the value changed.
|
|
2184
2296
|
*/
|
|
2185
2297
|
setRegionEnabled(enabled: boolean): boolean;
|
|
2186
|
-
/**
|
|
2187
|
-
|
|
2298
|
+
/**
|
|
2299
|
+
* Replace the list; callers invalidate their adapter snapshot after this.
|
|
2300
|
+
*
|
|
2301
|
+
* `origin` says where the list came from, and it is not cosmetic: only an
|
|
2302
|
+
* `upstream` answer may mark the catalog live. `applySelection` also calls
|
|
2303
|
+
* this on every settings write — including before the first refresh has
|
|
2304
|
+
* landed — and the list it passes then is the static fallback. Letting that
|
|
2305
|
+
* count as live is what re-opened issue #32 (see {@link hasLiveRoster}).
|
|
2306
|
+
*
|
|
2307
|
+
* The default is `'upstream'` so every pre-existing call site keeps meaning
|
|
2308
|
+
* what it meant; only the re-derivation path opts into `'derived'`.
|
|
2309
|
+
*/
|
|
2310
|
+
set(models: readonly WorkBuddyModelInfo[], origin?: 'upstream' | 'derived'): void;
|
|
2188
2311
|
}
|
|
2189
2312
|
//#endregion
|
|
2190
2313
|
//#region src/cli-bridge/mount.d.ts
|
|
@@ -4026,6 +4149,16 @@ type WorkBuddyWebUsage =
|
|
|
4026
4149
|
* must not be read as consent.
|
|
4027
4150
|
*/
|
|
4028
4151
|
cliBridgeEnabled?: boolean;
|
|
4152
|
+
/**
|
|
4153
|
+
* Whether the OPTIONAL DSH sidebar panel is switched on (PR #188).
|
|
4154
|
+
*
|
|
4155
|
+
* GLOBAL, not per region — one nav row, one page, no region axis — so the
|
|
4156
|
+
* same value rides on every region's answer and the card reads it off the
|
|
4157
|
+
* active tab. Absent reads as OFF, matching the schema's `default(false)`:
|
|
4158
|
+
* the row claims a `sidebar.panellist` seat every bundle shares, so a Host
|
|
4159
|
+
* that cannot answer must not be read as consent.
|
|
4160
|
+
*/
|
|
4161
|
+
sidebarPanelEnabled?: boolean;
|
|
4029
4162
|
/**
|
|
4030
4163
|
* The model the OPTIONAL CodeBuddy CLI route runs on, or `''` for
|
|
4031
4164
|
* "nothing is pinned, the CLI uses its own default".
|
|
@@ -4088,6 +4221,20 @@ type WorkBuddyWebUsage =
|
|
|
4088
4221
|
message?: string;
|
|
4089
4222
|
/** The persisted account id matches no local account. */
|
|
4090
4223
|
selectionLost?: boolean;
|
|
4224
|
+
/**
|
|
4225
|
+
* The vault directory exists but could not be READ (issue #199).
|
|
4226
|
+
*
|
|
4227
|
+
* A directory whose DACL excludes the current user (the issue #199 lockout:
|
|
4228
|
+
* owner = Administrators + `/inheritance:r`) makes every vault entry
|
|
4229
|
+
* invisible while the desktop scan still finds its own accounts — the card
|
|
4230
|
+
* then reports the SAVED choice as "no longer on this machine", which sends
|
|
4231
|
+
* the user re-signing-in when the tokens are fine on disk. Carrying the raw
|
|
4232
|
+
* readdir error lets the card say "the vault is unreadable" — a statement
|
|
4233
|
+
* about PERMISSIONS, with a takeown recovery — instead of a false claim
|
|
4234
|
+
* about the accounts. Absent means the vault read either succeeded or the
|
|
4235
|
+
* directory is genuinely absent (nothing added yet).
|
|
4236
|
+
*/
|
|
4237
|
+
vaultUnreadable?: string;
|
|
4091
4238
|
/** A saved per-region choice is in effect (false = following the app). */
|
|
4092
4239
|
selectionExplicit: boolean;
|
|
4093
4240
|
/**
|
|
@@ -4149,6 +4296,16 @@ type WorkBuddyWebUsage =
|
|
|
4149
4296
|
* must not be read as consent.
|
|
4150
4297
|
*/
|
|
4151
4298
|
cliBridgeEnabled?: boolean;
|
|
4299
|
+
/**
|
|
4300
|
+
* Whether the OPTIONAL DSH sidebar panel is switched on (PR #188).
|
|
4301
|
+
*
|
|
4302
|
+
* GLOBAL, not per region — one nav row, one page, no region axis — so the
|
|
4303
|
+
* same value rides on every region's answer and the card reads it off the
|
|
4304
|
+
* active tab. Absent reads as OFF, matching the schema's `default(false)`:
|
|
4305
|
+
* the row claims a `sidebar.panellist` seat every bundle shares, so a Host
|
|
4306
|
+
* that cannot answer must not be read as consent.
|
|
4307
|
+
*/
|
|
4308
|
+
sidebarPanelEnabled?: boolean;
|
|
4152
4309
|
/**
|
|
4153
4310
|
* The model the OPTIONAL CodeBuddy CLI route runs on, or `''` for
|
|
4154
4311
|
* "nothing is pinned, the CLI uses its own default".
|
|
@@ -4550,6 +4707,24 @@ interface WorkBuddyWebPoolAccount {
|
|
|
4550
4707
|
* card must render it as "no free model" rather than silently substituting a
|
|
4551
4708
|
* paid one.
|
|
4552
4709
|
*/
|
|
4710
|
+
/**
|
|
4711
|
+
* What the automatic check-in has settled today (issue #191).
|
|
4712
|
+
*
|
|
4713
|
+
* Deliberately COUNTS rather than a sentence: both locales render it, and the
|
|
4714
|
+
* card decides where it goes. `pending` is the number of accounts still owed an
|
|
4715
|
+
* attempt, which is what distinguishes "done for today" (0) from "retrying" —
|
|
4716
|
+
* the two states a user watching a background job actually cares about.
|
|
4717
|
+
*/
|
|
4718
|
+
interface WorkBuddyWebAutoCheckinToday {
|
|
4719
|
+
/** Accounts confirmed claimed or already-checked-in today. */
|
|
4720
|
+
done: number;
|
|
4721
|
+
/** Accounts in scope today (pool members minus enterprise members). */
|
|
4722
|
+
total: number;
|
|
4723
|
+
/** Accounts still owed an attempt; 0 means the day is finished. */
|
|
4724
|
+
pending: number;
|
|
4725
|
+
/** Why the last attempt failed, when it did. */
|
|
4726
|
+
lastError?: string;
|
|
4727
|
+
}
|
|
4553
4728
|
interface WorkBuddyWebPool {
|
|
4554
4729
|
enabled: boolean;
|
|
4555
4730
|
/**
|
|
@@ -4559,6 +4734,25 @@ interface WorkBuddyWebPool {
|
|
|
4559
4734
|
* button whose only outcome is a refusal.
|
|
4560
4735
|
*/
|
|
4561
4736
|
checkinSupported: boolean;
|
|
4737
|
+
/**
|
|
4738
|
+
* Whether the user asked the plugin to claim the daily check-in by itself
|
|
4739
|
+
* (issue #191). Absent means OFF.
|
|
4740
|
+
*
|
|
4741
|
+
* The SAVED value, not the running one: the card's switch edits this field,
|
|
4742
|
+
* and a draft-and-save cycle must show what is stored rather than what the
|
|
4743
|
+
* runner happens to be doing with the previous value.
|
|
4744
|
+
*/
|
|
4745
|
+
autoCheckin?: boolean;
|
|
4746
|
+
/**
|
|
4747
|
+
* What the automatic check-in has done today, when it is switched on.
|
|
4748
|
+
*
|
|
4749
|
+
* Absent when the switch is off or the runner has not started — never an
|
|
4750
|
+
* object full of zeroes, so the card can tell "nothing has run" apart from
|
|
4751
|
+
* "ran and found nothing to do". Read from the runner's own memory rather
|
|
4752
|
+
* than recomputed: the card cannot know which accounts the batch already
|
|
4753
|
+
* settled, and asking it to guess is how the count would drift from the truth.
|
|
4754
|
+
*/
|
|
4755
|
+
autoCheckinToday?: WorkBuddyWebAutoCheckinToday;
|
|
4562
4756
|
/** The model a test would use right now; absent when none can be resolved. */
|
|
4563
4757
|
targetModelId?: string;
|
|
4564
4758
|
/**
|
|
@@ -4720,6 +4914,31 @@ interface WorkBuddyStatusRouteOptions {
|
|
|
4720
4914
|
defaultThinkingEfforts?(region: WorkBuddyRegion): Readonly<Record<string, string | undefined>>;
|
|
4721
4915
|
/** Re-read the live catalog of one region from the upstream. */
|
|
4722
4916
|
discoverModels?(region: WorkBuddyRegion, signal?: AbortSignal): Promise<readonly WorkBuddyModelInfo[]>;
|
|
4917
|
+
/**
|
|
4918
|
+
* Record what a refresh just read, so the directory — and therefore every
|
|
4919
|
+
* price on it — stops being a snapshot of an older day (issue #214).
|
|
4920
|
+
*
|
|
4921
|
+
* WHY THE REFRESH ROUTE NEEDS THIS. The button used to answer with the fresh
|
|
4922
|
+
* rows and write nothing, so the same press produced two different answers on
|
|
4923
|
+
* one host: `POST /models/refresh` said `glm-5.3` is x0.69 while `GET /usage`
|
|
4924
|
+
* kept saying x0.79 and `cordis.patch.yml` never changed. The reporter's
|
|
4925
|
+
* words: 「对用户来说『刷新』是个无效按钮」. A refresh whose answer is
|
|
4926
|
+
* discarded is not a refresh.
|
|
4927
|
+
*
|
|
4928
|
+
* WHAT IT WRITES, AND WHAT IT MUST NOT. Only the DIRECTORY (`lastCatalog`)
|
|
4929
|
+
* and only through the Host's merge (`writeRegionCatalog`), which preserves
|
|
4930
|
+
* every sibling field of the region slot. It does NOT write the user's
|
|
4931
|
+
* selection: `enabledModelIds` / `imageModelIds` / `contextBudgets` are the
|
|
4932
|
+
* card's DRAFT until the user presses Save, and the reporter's own card shows
|
|
4933
|
+
* unticked models in that draft. Writing them here would silently commit
|
|
4934
|
+
* edits the user was still making.
|
|
4935
|
+
*
|
|
4936
|
+
* Optional: the route answers 503 for a Host that cannot persist, rather than
|
|
4937
|
+
* half-performing the operation. The card relies on this — `refreshModels`
|
|
4938
|
+
* paints its draft from the ANSWER, so a 503 leaves the draft untouched and
|
|
4939
|
+
* the user sees a real error instead of a stale list that looks refreshed.
|
|
4940
|
+
*/
|
|
4941
|
+
persistModels?(region: WorkBuddyRegion, models: readonly WorkBuddyModelInfo[]): Promise<void>;
|
|
4723
4942
|
/**
|
|
4724
4943
|
* Which ids of the requested region's roster THIS machine first saw inside the
|
|
4725
4944
|
* new-model window (the "· N 新模型" segment), plus a note when the on-disk
|
|
@@ -4810,6 +5029,19 @@ interface WorkBuddyStatusRouteOptions {
|
|
|
4810
5029
|
* deployments, and a stale `true` here would claim a spending capability is on.
|
|
4811
5030
|
*/
|
|
4812
5031
|
cliBridgeEnabled?(): boolean;
|
|
5032
|
+
/**
|
|
5033
|
+
* Whether the OPTIONAL DSH sidebar panel is switched on (PR #188).
|
|
5034
|
+
*
|
|
5035
|
+
* GLOBAL rather than per region — one nav row and one page, no region axis —
|
|
5036
|
+
* so it takes no argument. Optional, and absent reads as OFF, matching the
|
|
5037
|
+
* schema's `default(false)`: the row claims a `sidebar.panellist` seat and a
|
|
5038
|
+
* `main` page that every installed bundle shares, and an upgrade must never
|
|
5039
|
+
* re-arrange a sidebar nobody asked to change. Carried on the Host's answer
|
|
5040
|
+
* for the same measured reason as `cliBridgeEnabled`: the browser's settings
|
|
5041
|
+
* mirror is stale for this namespace on the affected 0.1.7 deployments, and a
|
|
5042
|
+
* stale `true` here would draw a row the Host does not honour.
|
|
5043
|
+
*/
|
|
5044
|
+
sidebarPanelEnabled?(): boolean;
|
|
4813
5045
|
/**
|
|
4814
5046
|
* The model the OPTIONAL CodeBuddy CLI route runs on, or `''` for "the CLI's
|
|
4815
5047
|
* own default".
|
|
@@ -5073,6 +5305,14 @@ interface WorkBuddyPoolDeps {
|
|
|
5073
5305
|
* ranking simply ignores it.
|
|
5074
5306
|
*/
|
|
5075
5307
|
orderAccountIds?: readonly string[];
|
|
5308
|
+
/**
|
|
5309
|
+
* Whether the user asked for the automatic daily check-in (issue #191).
|
|
5310
|
+
*
|
|
5311
|
+
* Optional so a Host that predates the setting still satisfies this
|
|
5312
|
+
* interface — its absence then reads as OFF, which is the truth for every
|
|
5313
|
+
* profile until someone ticks it.
|
|
5314
|
+
*/
|
|
5315
|
+
autoCheckin?: boolean;
|
|
5076
5316
|
};
|
|
5077
5317
|
/** One region's CHECKED accounts, plus their credits and last measurements. */
|
|
5078
5318
|
members(region: WorkBuddyRegion): Promise<readonly WorkBuddyPoolMember[]>;
|
|
@@ -5210,6 +5450,20 @@ interface WorkBuddyPoolDeps {
|
|
|
5210
5450
|
* reports "unavailable" instead of appearing to succeed.
|
|
5211
5451
|
*/
|
|
5212
5452
|
checkin?(region: WorkBuddyRegion): Promise<readonly WorkBuddyPoolCheckinRow[]>;
|
|
5453
|
+
/**
|
|
5454
|
+
* What the automatic check-in has settled today, when it is switched on
|
|
5455
|
+
* (issue #191).
|
|
5456
|
+
*
|
|
5457
|
+
* Optional so a Host that predates the feature still satisfies this
|
|
5458
|
+
* interface: its absence then reads as "the switch is off", which is the
|
|
5459
|
+
* truth for every profile until someone ticks it.
|
|
5460
|
+
*
|
|
5461
|
+
* Answers from the runner's own memory rather than recomputing: only the
|
|
5462
|
+
* runner knows which accounts a previous tick already settled, and asking the
|
|
5463
|
+
* route to guess is how the card's count would drift from what actually
|
|
5464
|
+
* happened.
|
|
5465
|
+
*/
|
|
5466
|
+
autoCheckinToday?(region: WorkBuddyRegion): WorkBuddyWebAutoCheckinToday | undefined;
|
|
5213
5467
|
/**
|
|
5214
5468
|
* Test every account of one region against the resolved target model.
|
|
5215
5469
|
*
|
|
@@ -5497,6 +5751,19 @@ interface WorkBuddyPoolPreferences {
|
|
|
5497
5751
|
* silently merged into membership.
|
|
5498
5752
|
*/
|
|
5499
5753
|
orderAccountIds?: string[];
|
|
5754
|
+
/**
|
|
5755
|
+
* Whether the plugin claims the daily check-in by itself (issue #191).
|
|
5756
|
+
*
|
|
5757
|
+
* OFF by default. Claiming a daily reward is a real WRITE on the user's
|
|
5758
|
+
* account, and this plugin deliberately shipped without an automatic
|
|
5759
|
+
* check-in so it would never make that decision on someone's behalf. The
|
|
5760
|
+
* reasoning still holds — what changed is that the user can now make that
|
|
5761
|
+
* decision once and have it honoured.
|
|
5762
|
+
*
|
|
5763
|
+
* Only the CN region has a check-in, so the card hides the switch elsewhere
|
|
5764
|
+
* and the runner refuses to start there.
|
|
5765
|
+
*/
|
|
5766
|
+
autoCheckin?: boolean;
|
|
5500
5767
|
}
|
|
5501
5768
|
/** Plugin configuration. */
|
|
5502
5769
|
interface Config {
|
|
@@ -5542,6 +5809,20 @@ interface Config {
|
|
|
5542
5809
|
* client-fingerprint workaround, not an account one — see `cli-bridge/runner`.
|
|
5543
5810
|
*/
|
|
5544
5811
|
cliBridge?: CliBridgeSettings;
|
|
5812
|
+
/**
|
|
5813
|
+
* Put the WorkBuddy panel in the DSH sidebar (opt-IN, PR #188).
|
|
5814
|
+
*
|
|
5815
|
+
* OFF by default, like every other optional surface this plugin adds: the
|
|
5816
|
+
* panel claims a GLOBAL seat (`sidebar.panellist` row + `main` page) that
|
|
5817
|
+
* every bundle shares, so switching it on is a decision about the user's
|
|
5818
|
+
* whole sidebar rather than a preference about this card. An absent value
|
|
5819
|
+
* therefore reads as off, and an upgrade must never re-arrange a sidebar
|
|
5820
|
+
* nobody asked to change.
|
|
5821
|
+
*
|
|
5822
|
+
* The settings card is unaffected either way: this only adds a second door to
|
|
5823
|
+
* the same content, and the Plugins page keeps the first one.
|
|
5824
|
+
*/
|
|
5825
|
+
sidebarPanel?: boolean;
|
|
5545
5826
|
/**
|
|
5546
5827
|
* When scanned messages are perturbed with invisible characters.
|
|
5547
5828
|
*
|
|
@@ -5567,6 +5848,21 @@ interface Config {
|
|
|
5567
5848
|
* 而不必先回滚一个版本。
|
|
5568
5849
|
*/
|
|
5569
5850
|
wireProfile?: 'conservative' | 'balanced';
|
|
5851
|
+
/**
|
|
5852
|
+
* SDK 功能的**总开关**(默认开)。
|
|
5853
|
+
*
|
|
5854
|
+
* 关掉之后:不发现 SDK 目录、不起取 token 的子进程、不后台预热——真实值档因此
|
|
5855
|
+
* 永远取不到 token。这是"我根本不想让这个插件碰桌面端的原生模块"的那条退路:
|
|
5856
|
+
* 在此之前这项能力是无条件启动的,一个只想用虚拟值档的人也照样每 10 分钟付一次
|
|
5857
|
+
* 子进程与一次风控取数。
|
|
5858
|
+
*
|
|
5859
|
+
* 与「取不到真实设备时退回虚拟值」不是一回事:那个管**取不到时怎么办**(落在设备
|
|
5860
|
+
* 设置文件里),这个管**要不要去取**。两者都关时真实值档零设备头;总开关关而回退
|
|
5861
|
+
* 开时,退到虚拟值。
|
|
5862
|
+
*
|
|
5863
|
+
* 关掉不影响虚拟值档:派生值全靠本机盐,与 SDK 无关。
|
|
5864
|
+
*/
|
|
5865
|
+
deviceSdkEnabled?: boolean;
|
|
5570
5866
|
/**
|
|
5571
5867
|
* 外部设备 token(`docs/DEVICE-IDENTITY-AUDIT.md` 的 P2)。
|
|
5572
5868
|
*
|
|
@@ -5728,6 +6024,36 @@ declare function regionStateOf(config: Config, region: WorkBuddyRegion): WorkBud
|
|
|
5728
6024
|
* about a region's state.
|
|
5729
6025
|
*/
|
|
5730
6026
|
declare function regionEnabled(config: Config, region: WorkBuddyRegion): boolean;
|
|
6027
|
+
/**
|
|
6028
|
+
* 「真实值」档在这台机器上能不能真的工作,以及为什么不能。
|
|
6029
|
+
*
|
|
6030
|
+
* ## 为什么不让界面自己判断平台
|
|
6031
|
+
*
|
|
6032
|
+
* 客户端能拿到 `sdk.platform`,但**平台不是判据**。macOS 上 SDK 能被发现、
|
|
6033
|
+
* `probe` 也答 `ready`,真正坏掉的是取 token 那一环:SDK 向 dispatch 主队列
|
|
6034
|
+
* `dispatch_sync`,而纯 libuv 子进程永不排空那个队列(`sample` 栈实测,见
|
|
6035
|
+
* CHANGELOG 的「macOS 现状如实记录」)。于是「darwin → 禁用」会把一台**没装**
|
|
6036
|
+
* 桌面端的 mac 和一台装了的 mac 说成同一件事,而它们的用户该做的事完全不同。
|
|
6037
|
+
*
|
|
6038
|
+
* ## 为什么现在还写死
|
|
6039
|
+
*
|
|
6040
|
+
* 这是一个**已知的、非本平台的**缺陷,不是运行时可以测出来的:真去测就要起子进程
|
|
6041
|
+
* 等 15 秒超时,而这一页每次打开都会拉一次设置。写成常量意味着它是可以被人替换
|
|
6042
|
+
* 的显式声明,而不是散在三个组件里的 `if (platform === 'darwin')`。
|
|
6043
|
+
*
|
|
6044
|
+
* ⚠️ 修好 `dispatch_sync` 那条路之后,**这里必须跟着改**,否则界面会继续劝退一个
|
|
6045
|
+
* 已经能用的功能。修法不在本次范围(需要一个排空主队列的伴生原生模块)。
|
|
6046
|
+
*
|
|
6047
|
+
* `state`:
|
|
6048
|
+
* - `available` —— 能取到 token,切成「真实值」就能用;
|
|
6049
|
+
* - `broken` —— 这套 SDK 在本平台取不到 token,切过去只会降级,界面上应禁用
|
|
6050
|
+
* 并说明原因;
|
|
6051
|
+
* - `unavailable` —— 本平台没有这条取链(不预期出现,留作兜底)。
|
|
6052
|
+
*/
|
|
6053
|
+
declare function realTierAvailabilityFor(platform: string): {
|
|
6054
|
+
state: 'available' | 'broken' | 'unavailable';
|
|
6055
|
+
platform: string;
|
|
6056
|
+
};
|
|
5731
6057
|
/**
|
|
5732
6058
|
* The region that owns the image tool right now, or `undefined` when no region
|
|
5733
6059
|
* has it switched on.
|
|
@@ -5803,4 +6129,4 @@ declare function legacyAttributionRegion(value: Config, accountsFor: (region: Wo
|
|
|
5803
6129
|
*/
|
|
5804
6130
|
declare function apply(ctx: Context, config: Config): void;
|
|
5805
6131
|
//#endregion
|
|
5806
|
-
export { CREDENTIAL_REJECTED_CODE, Config, DEFAULT_PROBE_INPUT_TOKENS, ENCRYPTED_CREDENTIAL_CODE, FALLBACK_WORKBUDDY_MODELS, FALLBACK_WORKBUDDY_MODELS_GLOBAL, NATIVE_MODALITY_BY_MODEL_ID, PROBE_INPUT_TOKEN_CHOICES, PROBE_MAX_TOKENS, PROBE_SYSTEM_PROMPT, REFUSES_OFF_MODEL_IDS, type UpstreamErrorKind, WORKBUDDY_ACCOUNTS_REFRESH_PATH, WORKBUDDY_APP_EXECUTABLE_ENV, WORKBUDDY_AUTH_FILENAME, WORKBUDDY_AUTH_FILE_ENV, WORKBUDDY_CHECKIN_PATH, WORKBUDDY_CONNECT_VERSION, WORKBUDDY_GLOBAL_PROVIDER, WORKBUDDY_HOST_HEARTBEAT_FILENAME, WORKBUDDY_MODELS_REFRESH_PATH, WORKBUDDY_PROBE_PATH, WORKBUDDY_PROVIDER, WORKBUDDY_PROVIDERS, WORKBUDDY_PROVIDER_DISPLAY_NAMES, WORKBUDDY_REGIONS, WORKBUDDY_REGION_PARAM, WORKBUDDY_SETTINGS_NS, WORKBUDDY_STREAM_IDLE_TIMEOUT_MS, WORKBUDDY_TPS_PATH, WORKBUDDY_USAGE_PATH, type WorkBuddyAccountChoice, type WorkBuddyAdapter, type WorkBuddyAuthStatus, type WorkBuddyCandidateFailure, WorkBuddyCatalog, type WorkBuddyChatResult, type WorkBuddyCredential, type WorkBuddyCredentialRecovery, WorkBuddyCredentialRejectedError, WorkBuddyCredentialStore, type WorkBuddyCreditPackage, type WorkBuddyCredits, WorkBuddyEncryptedCredentialError, type WorkBuddyEncryptedField, type WorkBuddyHostHeartbeat, type WorkBuddyModelInfo, type WorkBuddyNativeModality, WorkBuddyPoolPreferences, type WorkBuddyProbeClient, type WorkBuddyProbeOutcome, type WorkBuddyProbeResult, type WorkBuddyProbeStore, type WorkBuddyReasoning, type WorkBuddyRecoveryCandidate, type WorkBuddyRefreshOutcome, WorkBuddyRegionState, type WorkBuddyShim, type WorkBuddyStatusRouteOptions, type WorkBuddyStoreOptions, WorkBuddyUpstreamClient, type WorkBuddyUpstreamModel, type WorkBuddyUsabilityProbeOptions, apply, asVolatile, authFileName, classifyUpstreamError, clearAtRestKeyCache, clearHostHeartbeat, cooldownOf, createAccountUsabilityProbe, createWorkBuddyAdapter, createWorkBuddyShim, creditOfStream, defaultDesktopAuthCandidates, defaultDesktopAuthDirs, defaultDesktopAuthPath, defaultOffModelIds, deriveAtRestKey, deriveAtRestKeyId, deriveCatalog, fallbackModelsFor, fetchAtRestKeyPayload, findWorkbuddyAppExecutable, hasEncryptedCredentialFields, imageDefaultFor, imageToolRegionOf, inject, isCredentialRejectedError, isEncryptedCredentialError, isEncryptedFieldWrapper, isHeartbeatProcessAlive, isWorkbuddyBundle, knownRegionOf, legacyAttributionRegion, legacyWorkbuddyOwnAuthPath, macosBundleExecutable, macosNestedAppBundles, modelIdOfBody, name, nativeModalityOf, nextRegionEnabled, nextRegionSlots, offDefaultFor, openEncryptedField, outcomeOfFailure, parseCreditMultiplier, parseReasoning, parseRetryAfter, parseUpstreamModel, parseWorkBuddyAuth, prepareChatBody, probeModel, probeRequestBody, probeSucceeded, processStartTimeMs, readAtRestKey, readHostHeartbeat, regionCleared, regionEnabled, regionEnabledOf, regionOf, regionOfProvider, regionOfStatusUrl, regionStateOf, regionsFieldIsCorrupt, regionsMapOf, registerWorkBuddyStatusRoute, resolveCredentialRecovery, selectAccountFor, settingsNamespaceOf, toPersistedWorkBuddyModel, unwrapVolatileDeep, videoToolRegionOf, withEffectiveOff, withWorkBuddyRegion, workBuddyDisplayName, workBuddyModelInput, workBuddyThinkingLevelMap, workBuddyWebStatus, workbuddyAccountId, workbuddyAppExecutableCandidates, workbuddyHostHeartbeatPath, workbuddyOwnAuthPath, writeHostHeartbeat };
|
|
6132
|
+
export { CREDENTIAL_REJECTED_CODE, Config, DEFAULT_PROBE_INPUT_TOKENS, ENCRYPTED_CREDENTIAL_CODE, FALLBACK_WORKBUDDY_MODELS, FALLBACK_WORKBUDDY_MODELS_GLOBAL, NATIVE_MODALITY_BY_MODEL_ID, PROBE_INPUT_TOKEN_CHOICES, PROBE_MAX_TOKENS, PROBE_SYSTEM_PROMPT, REFUSES_OFF_MODEL_IDS, type UpstreamErrorKind, WORKBUDDY_ACCOUNTS_REFRESH_PATH, WORKBUDDY_APP_EXECUTABLE_ENV, WORKBUDDY_AUTH_FILENAME, WORKBUDDY_AUTH_FILE_ENV, WORKBUDDY_CHECKIN_PATH, WORKBUDDY_CONNECT_VERSION, WORKBUDDY_GLOBAL_PROVIDER, WORKBUDDY_HOST_HEARTBEAT_FILENAME, WORKBUDDY_MODELS_REFRESH_PATH, WORKBUDDY_PROBE_PATH, WORKBUDDY_PROVIDER, WORKBUDDY_PROVIDERS, WORKBUDDY_PROVIDER_DISPLAY_NAMES, WORKBUDDY_REGIONS, WORKBUDDY_REGION_PARAM, WORKBUDDY_SETTINGS_NS, WORKBUDDY_STREAM_IDLE_TIMEOUT_MS, WORKBUDDY_TPS_PATH, WORKBUDDY_USAGE_PATH, type WorkBuddyAccountChoice, type WorkBuddyAdapter, type WorkBuddyAuthStatus, type WorkBuddyCandidateFailure, WorkBuddyCatalog, type WorkBuddyChatResult, type WorkBuddyCredential, type WorkBuddyCredentialRecovery, WorkBuddyCredentialRejectedError, WorkBuddyCredentialStore, type WorkBuddyCreditPackage, type WorkBuddyCredits, WorkBuddyEncryptedCredentialError, type WorkBuddyEncryptedField, type WorkBuddyHostHeartbeat, type WorkBuddyModelInfo, type WorkBuddyNativeModality, WorkBuddyPoolPreferences, type WorkBuddyProbeClient, type WorkBuddyProbeOutcome, type WorkBuddyProbeResult, type WorkBuddyProbeStore, type WorkBuddyReasoning, type WorkBuddyRecoveryCandidate, type WorkBuddyRefreshOutcome, WorkBuddyRegionState, type WorkBuddyShim, type WorkBuddyStatusRouteOptions, type WorkBuddyStoreOptions, WorkBuddyUpstreamClient, type WorkBuddyUpstreamModel, type WorkBuddyUsabilityProbeOptions, apply, asVolatile, authFileName, classifyUpstreamError, clearAtRestKeyCache, clearHostHeartbeat, cooldownOf, createAccountUsabilityProbe, createWorkBuddyAdapter, createWorkBuddyShim, creditOfStream, defaultDesktopAuthCandidates, defaultDesktopAuthDirs, defaultDesktopAuthPath, defaultOffModelIds, deriveAtRestKey, deriveAtRestKeyId, deriveCatalog, fallbackModelsFor, fetchAtRestKeyPayload, findWorkbuddyAppExecutable, hasEncryptedCredentialFields, imageDefaultFor, imageToolRegionOf, inject, isCredentialRejectedError, isEncryptedCredentialError, isEncryptedFieldWrapper, isHeartbeatProcessAlive, isWorkbuddyBundle, knownRegionOf, legacyAttributionRegion, legacyWorkbuddyOwnAuthPath, macosBundleExecutable, macosNestedAppBundles, modelIdOfBody, name, nativeModalityOf, nextRegionEnabled, nextRegionSlots, offDefaultFor, openEncryptedField, outcomeOfFailure, parseCreditMultiplier, parseReasoning, parseRetryAfter, parseUpstreamModel, parseWorkBuddyAuth, prepareChatBody, probeModel, probeRequestBody, probeSucceeded, processStartTimeMs, readAtRestKey, readHostHeartbeat, realTierAvailabilityFor, regionCleared, regionEnabled, regionEnabledOf, regionOf, regionOfProvider, regionOfStatusUrl, regionStateOf, regionsFieldIsCorrupt, regionsMapOf, registerWorkBuddyStatusRoute, resolveCredentialRecovery, selectAccountFor, settingsNamespaceOf, toPersistedWorkBuddyModel, unwrapVolatileDeep, videoToolRegionOf, withEffectiveOff, withWorkBuddyRegion, workBuddyDisplayName, workBuddyModelInput, workBuddyThinkingLevelMap, workBuddyWebStatus, workbuddyAccountId, workbuddyAppExecutableCandidates, workbuddyHostHeartbeatPath, workbuddyOwnAuthPath, writeHostHeartbeat };
|