dsh-connect-workbuddy 1.3.0 → 2.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 +72 -0
- package/README.en.md +14 -10
- package/README.md +14 -10
- package/lib/bin.d.ts +3 -1
- package/lib/bin.js +103 -69
- package/lib/client.js +199 -69
- package/lib/{host-heartbeat-UlZjd09_.js → host-heartbeat-sqjxgXkW.js} +1192 -884
- package/lib/index.d.ts +209 -37
- package/lib/index.js +248 -90
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -33,8 +33,22 @@ interface WorkBuddyAuthStatus {
|
|
|
33
33
|
interface WorkBuddyStoreOptions {
|
|
34
34
|
/** Explicit desktop auth-file path, overriding env and platform defaults. */
|
|
35
35
|
desktopPath?: string;
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Explicit plugin-owned copy path, overriding the per-region default.
|
|
38
|
+
* Injectable so the copy/refresh cycle is testable without a real machine.
|
|
39
|
+
*/
|
|
37
40
|
ownPath?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Region this store serves. When set, only credentials whose login domain
|
|
43
|
+
* maps to this region are discovered, selected, or refreshed — the two
|
|
44
|
+
* regions' stores run side by side without seeing each other's accounts.
|
|
45
|
+
*/
|
|
46
|
+
region?: WorkBuddyRegion;
|
|
47
|
+
/**
|
|
48
|
+
* Legacy single-copy path read as a migration source; defaults to the
|
|
49
|
+
* pre-dual-provider location. Injectable for tests.
|
|
50
|
+
*/
|
|
51
|
+
legacyOwnPath?: string;
|
|
38
52
|
/**
|
|
39
53
|
* Auth directories to scan, overriding the platform defaults. Injectable so
|
|
40
54
|
* the multi-account scan is testable without touching a real machine.
|
|
@@ -58,12 +72,22 @@ interface WorkBuddyAccountChoice {
|
|
|
58
72
|
filePath: string;
|
|
59
73
|
selected: boolean;
|
|
60
74
|
}
|
|
61
|
-
/**
|
|
75
|
+
/** Legacy single-copy basename (pre-dual-provider); kept as migration source. */
|
|
62
76
|
declare const WORKBUDDY_AUTH_FILENAME = ".workbuddy-auth.json";
|
|
63
77
|
/** Env variable that overrides the desktop auth-file location. */
|
|
64
78
|
declare const WORKBUDDY_AUTH_FILE_ENV = "WORKBUDDY_AUTH_FILE";
|
|
65
|
-
/**
|
|
66
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Plugin-owned copy path for one region inside the Harness home. Each
|
|
81
|
+
* region's store refreshes into its own file so two simultaneously signed-in
|
|
82
|
+
* regions never overwrite each other's refreshed token.
|
|
83
|
+
*/
|
|
84
|
+
declare function workbuddyOwnAuthPath(region: WorkBuddyRegion): string;
|
|
85
|
+
/**
|
|
86
|
+
* Pre-dual-provider single-copy path. Still read as a migration source (a
|
|
87
|
+
* legacy credential serves the region it belongs to until that region's own
|
|
88
|
+
* first refresh writes the per-region file), and removed by `logout`.
|
|
89
|
+
*/
|
|
90
|
+
declare function legacyWorkbuddyOwnAuthPath(): string;
|
|
67
91
|
/**
|
|
68
92
|
* Platform-default directories holding the WorkBuddy desktop app's auth file.
|
|
69
93
|
*
|
|
@@ -110,12 +134,34 @@ declare function workbuddyAccountId(credential: Pick<WorkBuddyCredential, 'uin'
|
|
|
110
134
|
declare class WorkBuddyCredentialStore {
|
|
111
135
|
private readonly refresh;
|
|
112
136
|
private readonly refreshMarginMs;
|
|
113
|
-
private readonly
|
|
137
|
+
private readonly region;
|
|
138
|
+
private readonly ownPathExplicit;
|
|
139
|
+
private readonly legacyOwnPath;
|
|
140
|
+
private readonly legacyOwnPathExplicit;
|
|
114
141
|
private readonly authDirs;
|
|
115
142
|
private desktopPathOverride;
|
|
116
143
|
private accountId;
|
|
117
144
|
private inflight;
|
|
118
145
|
constructor(options: WorkBuddyStoreOptions);
|
|
146
|
+
/** Whether a credential's login domain belongs to this store's region. */
|
|
147
|
+
private matchesRegion;
|
|
148
|
+
/**
|
|
149
|
+
* The path this store refreshes into: the per-region file for a
|
|
150
|
+
* region-scoped store, the legacy single file otherwise, or an explicitly
|
|
151
|
+
* injected path in tests.
|
|
152
|
+
*/
|
|
153
|
+
ownAuthPath(): string;
|
|
154
|
+
/**
|
|
155
|
+
* Every plugin-owned copy to read, most preferred first. A region-scoped
|
|
156
|
+
* store reads the legacy single copy as its migration source (readAll's
|
|
157
|
+
* region filter drops it when it carries the other region's credential); an
|
|
158
|
+
* unscoped store reads everything so diagnostics see both regions.
|
|
159
|
+
*
|
|
160
|
+
* With an explicitly injected own path the legacy source is read ONLY when
|
|
161
|
+
* it was injected too — a test that pins one file must not accidentally see
|
|
162
|
+
* the real machine's legacy copy.
|
|
163
|
+
*/
|
|
164
|
+
private ownCandidates;
|
|
119
165
|
/** Repoint the desktop file or directory; applies on the next read. */
|
|
120
166
|
setDesktopPath(path: string | undefined): void;
|
|
121
167
|
/** Select an account by id; tokens stay outside settings. */
|
|
@@ -126,8 +172,6 @@ declare class WorkBuddyCredentialStore {
|
|
|
126
172
|
private resolveDesktopCandidates;
|
|
127
173
|
/** The resolved desktop auth-file path, for diagnostics. */
|
|
128
174
|
desktopAuthPath(): string | undefined;
|
|
129
|
-
/** The plugin-owned copy path, for diagnostics. */
|
|
130
|
-
ownAuthPath(): string;
|
|
131
175
|
/**
|
|
132
176
|
* Every auth file to scan: the live file plus the timestamped backups
|
|
133
177
|
* WorkBuddy leaves beside it.
|
|
@@ -146,6 +190,10 @@ declare class WorkBuddyCredentialStore {
|
|
|
146
190
|
/**
|
|
147
191
|
* Read every local credential, deduplicated by account id. Files are
|
|
148
192
|
* probed newest-first, so the first entry for an account is its freshest.
|
|
193
|
+
*
|
|
194
|
+
* A region-scoped store sees only its own region's credentials: the other
|
|
195
|
+
* region's accounts are invisible to selection, refresh, and status alike,
|
|
196
|
+
* which is what keeps the two regions' providers from cross-billing.
|
|
149
197
|
*/
|
|
150
198
|
private readAll;
|
|
151
199
|
/**
|
|
@@ -164,12 +212,22 @@ declare class WorkBuddyCredentialStore {
|
|
|
164
212
|
resolve(): Promise<WorkBuddyCredential>;
|
|
165
213
|
/** Read-only sign-in summary; never refreshes and never throws. */
|
|
166
214
|
status(): Promise<WorkBuddyAuthStatus>;
|
|
167
|
-
/**
|
|
215
|
+
/**
|
|
216
|
+
* Remove every plugin-owned copy this store could read (per-region file,
|
|
217
|
+
* legacy single file, and their lock siblings); the desktop files are
|
|
218
|
+
* untouched. A region store's logout therefore also clears the legacy
|
|
219
|
+
* migration source — deliberate: `logout` is the user's "forget what the
|
|
220
|
+
* plugin stored" action, not a per-account toggle.
|
|
221
|
+
*/
|
|
168
222
|
logout(): Promise<void>;
|
|
169
223
|
private needsRefresh;
|
|
170
224
|
private refreshNow;
|
|
171
225
|
private saveOwn;
|
|
172
|
-
|
|
226
|
+
/**
|
|
227
|
+
* Every readable plugin-owned copy, in candidate order; absent or corrupt
|
|
228
|
+
* files are skipped rather than propagated.
|
|
229
|
+
*/
|
|
230
|
+
private readOwns;
|
|
173
231
|
/** Whether any candidate file exists as a regular file; diagnostics only. */
|
|
174
232
|
desktopFilePresent(): Promise<boolean>;
|
|
175
233
|
}
|
|
@@ -294,8 +352,15 @@ declare class WorkBuddyUpstreamClient {
|
|
|
294
352
|
/** POST the token-refresh endpoint; the caller merges the outcome. */
|
|
295
353
|
refreshToken(credential: WorkBuddyCredential): Promise<WorkBuddyRefreshOutcome>;
|
|
296
354
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
355
|
+
* Read the model directory for the credential's region.
|
|
356
|
+
*
|
|
357
|
+
* The two regions expose their chat roster through different documents:
|
|
358
|
+
* CN answers `/v2/enterprises/personal/models`, while the global gateway's
|
|
359
|
+
* personal-models path returns HTTP 500 and the CLI channel's `/v3/config`
|
|
360
|
+
* omits chat-usable models — so global reads `/v3/config` as the desktop
|
|
361
|
+
* channel (see {@link DESKTOP_UA}). Both documents share the entry shape, so
|
|
362
|
+
* one parser serves them. No user-side toggle is involved: the region comes
|
|
363
|
+
* from the credential's `domain`.
|
|
299
364
|
*/
|
|
300
365
|
fetchModels(credential: WorkBuddyCredential, signal?: AbortSignal): Promise<readonly WorkBuddyUpstreamModel[]>;
|
|
301
366
|
/** Query today's check-in status without changing account state. */
|
|
@@ -320,6 +385,21 @@ type WorkBuddyModelInfo = WorkBuddyUpstreamModel;
|
|
|
320
385
|
* with a usable catalog even while the first fetch is in flight or offline.
|
|
321
386
|
*/
|
|
322
387
|
declare const FALLBACK_WORKBUDDY_MODELS: readonly WorkBuddyModelInfo[];
|
|
388
|
+
/**
|
|
389
|
+
* Static CLI models captured from the INTERNATIONAL gateway's desktop-channel
|
|
390
|
+
* product config (`www.workbuddy.ai/v3/config`, 2026-09-11). The two regions
|
|
391
|
+
* expose different rosters — the CN list has no `gpt-*`/`gemini-*` entries —
|
|
392
|
+
* so a global account must never be seeded with the CN list. Like the CN
|
|
393
|
+
* fallback this is replaced by the live refresh; it only keeps the provider
|
|
394
|
+
* usable before the first fetch lands. Order and rates mirror the upstream.
|
|
395
|
+
*/
|
|
396
|
+
declare const FALLBACK_WORKBUDDY_MODELS_GLOBAL: readonly WorkBuddyModelInfo[];
|
|
397
|
+
/**
|
|
398
|
+
* Static fallback directory for a region. Each region keeps its own model
|
|
399
|
+
* slot in settings; the fallback must match the region so an account never
|
|
400
|
+
* shows the other region's roster.
|
|
401
|
+
*/
|
|
402
|
+
declare function fallbackModelsFor(region: 'cn' | 'global'): readonly WorkBuddyModelInfo[];
|
|
323
403
|
/**
|
|
324
404
|
* Derive the runtime catalog from the last-refreshed directory plus the
|
|
325
405
|
* user's selection. This is the single source of truth for what DSH exposes,
|
|
@@ -333,6 +413,12 @@ declare function deriveCatalog(catalog: readonly WorkBuddyModelInfo[], enabled:
|
|
|
333
413
|
/** Mutable catalog shared by the shim's `/v1/models` and the adapter. */
|
|
334
414
|
declare class WorkBuddyCatalog {
|
|
335
415
|
private models;
|
|
416
|
+
/**
|
|
417
|
+
* @param region Seeds the static fallback for this region; each region's
|
|
418
|
+
* provider must never serve the other region's roster before its first
|
|
419
|
+
* live refresh lands.
|
|
420
|
+
*/
|
|
421
|
+
constructor(region?: 'cn' | 'global');
|
|
336
422
|
/** Current entries; the fallback list until the upstream answer lands. */
|
|
337
423
|
current(): readonly WorkBuddyModelInfo[];
|
|
338
424
|
/** Replace the list; callers invalidate their adapter snapshot after this. */
|
|
@@ -375,8 +461,16 @@ interface WorkBuddyShimOptions {
|
|
|
375
461
|
declare function createWorkBuddyShim(options: WorkBuddyShimOptions): WorkBuddyShim;
|
|
376
462
|
//#endregion
|
|
377
463
|
//#region src/adapter.d.ts
|
|
378
|
-
/** Provider route this bundle owns. */
|
|
464
|
+
/** Provider route this bundle owns for the domestic (CN) gateway. */
|
|
379
465
|
declare const WORKBUDDY_PROVIDER = "workbuddy";
|
|
466
|
+
/** Provider route this bundle owns for the international gateway. */
|
|
467
|
+
declare const WORKBUDDY_GLOBAL_PROVIDER = "workbuddy-global";
|
|
468
|
+
/** The provider id each region registers as. */
|
|
469
|
+
declare const WORKBUDDY_PROVIDERS: Readonly<Record<WorkBuddyRegion, string>>;
|
|
470
|
+
/** Region a provider route id belongs to. */
|
|
471
|
+
declare function regionOfProvider(provider: string): WorkBuddyRegion | undefined;
|
|
472
|
+
/** Human-readable provider name, shown in the DSH model picker. */
|
|
473
|
+
declare const WORKBUDDY_PROVIDER_DISPLAY_NAMES: Readonly<Record<WorkBuddyRegion, string>>;
|
|
380
474
|
/** Provider idle ceiling while one stream read is outstanding. */
|
|
381
475
|
declare const WORKBUDDY_STREAM_IDLE_TIMEOUT_MS = 300000;
|
|
382
476
|
/** Constructor dependencies. */
|
|
@@ -384,6 +478,10 @@ interface WorkBuddyAdapterOptions {
|
|
|
384
478
|
shim: WorkBuddyShim;
|
|
385
479
|
store: WorkBuddyCredentialStore;
|
|
386
480
|
catalog: WorkBuddyCatalog;
|
|
481
|
+
/** Provider route id this instance serves; defaults to the CN route. */
|
|
482
|
+
provider?: string;
|
|
483
|
+
/** pi-ai provider name and profile display name; defaults to the CN name. */
|
|
484
|
+
displayName?: string;
|
|
387
485
|
/** Resolve the durable attachment service at request time, when present. */
|
|
388
486
|
resolveAttachments?: () => AttachmentStore | undefined;
|
|
389
487
|
}
|
|
@@ -507,6 +605,21 @@ declare const WORKBUDDY_MODELS_REFRESH_PATH = "/plugins/dsh-connect-workbuddy/mo
|
|
|
507
605
|
declare const WORKBUDDY_ACCOUNTS_REFRESH_PATH = "/plugins/dsh-connect-workbuddy/accounts/refresh";
|
|
508
606
|
/** Plugin-owned daily check-in action endpoint. */
|
|
509
607
|
declare const WORKBUDDY_CHECKIN_PATH = "/plugins/dsh-connect-workbuddy/checkin";
|
|
608
|
+
/** Query parameter naming the region a card request addresses. */
|
|
609
|
+
declare const WORKBUDDY_REGION_PARAM = "region";
|
|
610
|
+
/** Every region, in card tab order. */
|
|
611
|
+
declare const WORKBUDDY_REGIONS: readonly WorkBuddyWebRegion[];
|
|
612
|
+
/**
|
|
613
|
+
* Address one region's status route. The two regions are separate provider
|
|
614
|
+
* stacks; every card request carries the region whose tab the user is on.
|
|
615
|
+
*/
|
|
616
|
+
declare function withWorkBuddyRegion(path: string, region: WorkBuddyWebRegion): string;
|
|
617
|
+
/**
|
|
618
|
+
* Read the region parameter off a status-route URL. Absent means the domestic
|
|
619
|
+
* tab (`cn`); a present-but-unknown value returns undefined so the route can
|
|
620
|
+
* answer 400 instead of guessing.
|
|
621
|
+
*/
|
|
622
|
+
declare function regionOfStatusUrl(url: string): WorkBuddyWebRegion | undefined;
|
|
510
623
|
/** One credit package as the upstream returns it, node-free. */
|
|
511
624
|
interface WorkBuddyWebCreditPackage {
|
|
512
625
|
packageName: string;
|
|
@@ -579,6 +692,12 @@ interface WorkBuddyWebAccount {
|
|
|
579
692
|
selected: boolean;
|
|
580
693
|
}
|
|
581
694
|
type WorkBuddyWebPackage = WorkBuddyWebCreditPackage;
|
|
695
|
+
/**
|
|
696
|
+
* Region of the signed-in credential: the CN app (`codebuddy.cn` /
|
|
697
|
+
* `workbuddy.cn`) or the international WorkBuddy AI app (`workbuddy.ai`).
|
|
698
|
+
* The card uses this to read and write the matching per-region model slot.
|
|
699
|
+
*/
|
|
700
|
+
type WorkBuddyWebRegion = 'cn' | 'global';
|
|
582
701
|
/** The JSON document the plugin card renders. */
|
|
583
702
|
type WorkBuddyWebUsage = {
|
|
584
703
|
status: 'signed-out';
|
|
@@ -590,6 +709,8 @@ type WorkBuddyWebUsage = {
|
|
|
590
709
|
accountName: string;
|
|
591
710
|
uin?: string;
|
|
592
711
|
domain?: string;
|
|
712
|
+
/** Which per-region model directory and selection this account owns. */
|
|
713
|
+
region: WorkBuddyWebRegion;
|
|
593
714
|
source?: 'desktop' | 'dsh';
|
|
594
715
|
tokenExpiresAtMs: number;
|
|
595
716
|
accounts: readonly WorkBuddyWebAccount[];
|
|
@@ -608,25 +729,33 @@ type WorkBuddyWebUsage = {
|
|
|
608
729
|
//#region src/web-status.d.ts
|
|
609
730
|
/** Constructor dependencies. */
|
|
610
731
|
interface WorkBuddyStatusRouteOptions {
|
|
611
|
-
store
|
|
732
|
+
/** The region-scoped credential store backing each region's requests. */
|
|
733
|
+
store(region: WorkBuddyRegion): WorkBuddyCredentialStore;
|
|
612
734
|
client: Pick<WorkBuddyUpstreamClient, 'fetchCredits' | 'fetchCheckinStatus' | 'claimDailyCheckin'>;
|
|
613
|
-
/**
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
735
|
+
/**
|
|
736
|
+
* The requested region's last-refreshed model directory (unfiltered) for
|
|
737
|
+
* card display. Region-scoped because the CN and international apps expose
|
|
738
|
+
* different rosters; showing one region's directory on the other account is
|
|
739
|
+
* the bug this parameter exists to prevent.
|
|
740
|
+
*/
|
|
741
|
+
displayModels(region: WorkBuddyRegion): readonly WorkBuddyModelInfo[];
|
|
742
|
+
/** The requested region's selection, stored as model ids. */
|
|
743
|
+
enabledModelIds(region: WorkBuddyRegion): readonly string[];
|
|
744
|
+
/** Model ids the user opted into image input, for the requested region. */
|
|
745
|
+
imageModelIds(region: WorkBuddyRegion): readonly string[];
|
|
746
|
+
/** Saved local DSH context budgets by model id, for the requested region. */
|
|
747
|
+
contextBudgets(region: WorkBuddyRegion): Readonly<Record<string, number | undefined>>;
|
|
748
|
+
/** Re-read the live catalog of one region from the upstream. */
|
|
749
|
+
discoverModels?(region: WorkBuddyRegion, signal?: AbortSignal): Promise<readonly WorkBuddyModelInfo[]>;
|
|
623
750
|
}
|
|
624
751
|
/**
|
|
625
|
-
* Assemble
|
|
626
|
-
*
|
|
627
|
-
*
|
|
752
|
+
* Assemble one region's card document. `region` is the tab the card is on;
|
|
753
|
+
* the region-scoped store already answers with only that region's accounts,
|
|
754
|
+
* so the document's model slots and account list are that region's by
|
|
755
|
+
* construction. Sign-in state is read-only; credit is a live billing answer
|
|
756
|
+
* whose failure degrades to `creditsError` rather than failing the document.
|
|
628
757
|
*/
|
|
629
|
-
declare function workBuddyWebStatus(deps: WorkBuddyStatusRouteOptions): Promise<WorkBuddyWebUsage>;
|
|
758
|
+
declare function workBuddyWebStatus(deps: WorkBuddyStatusRouteOptions, region: WorkBuddyRegion): Promise<WorkBuddyWebUsage>;
|
|
630
759
|
/**
|
|
631
760
|
* Mount the read-only routes on a context where `webServer` is available.
|
|
632
761
|
* The caller uses `ctx.inject(['webServer'], ...)`, so Desktop startup order
|
|
@@ -641,28 +770,71 @@ declare const name = "dsh-connect-workbuddy";
|
|
|
641
770
|
declare const inject: string[];
|
|
642
771
|
/** Settings namespace for the plugin configuration card. */
|
|
643
772
|
declare const WORKBUDDY_SETTINGS_NS: SettingsNamespace;
|
|
773
|
+
/** One region's model directory and the user's selection within it. */
|
|
774
|
+
interface WorkBuddyRegionState {
|
|
775
|
+
/** The last-refreshed directory for this region; what the card displays. */
|
|
776
|
+
lastCatalog?: WorkBuddyModelInfo[];
|
|
777
|
+
/** The user's selection in this region, as model ids. */
|
|
778
|
+
enabledModelIds?: string[];
|
|
779
|
+
/** Model ids the user explicitly opted into image input. */
|
|
780
|
+
imageModelIds?: string[];
|
|
781
|
+
/** Local DSH context budget per model in this region. */
|
|
782
|
+
contextBudgets?: Record<string, WorkBuddyContextBudget>;
|
|
783
|
+
}
|
|
644
784
|
/** Plugin configuration. */
|
|
645
785
|
interface Config {
|
|
646
786
|
/** Explicit WorkBuddy desktop auth-file path, overriding env and platform defaults. */
|
|
647
787
|
authFile?: string;
|
|
648
|
-
/**
|
|
788
|
+
/**
|
|
789
|
+
* @deprecated Legacy single-slot account selector from before the dual
|
|
790
|
+
* provider split. It is attributed to whichever region the account actually
|
|
791
|
+
* belongs to (resolved once at startup from the local account scan); new
|
|
792
|
+
* writes go to {@link Config.accounts}.
|
|
793
|
+
*/
|
|
649
794
|
accountId?: string;
|
|
650
|
-
/**
|
|
795
|
+
/**
|
|
796
|
+
* Per-region account selections, keyed `cn` | `global`. Each region's tab
|
|
797
|
+
* writes its own slot; tokens remain outside settings.
|
|
798
|
+
*/
|
|
799
|
+
accounts?: Partial<Record<WorkBuddyRegion, string>>;
|
|
800
|
+
/**
|
|
801
|
+
* Per-region model state, keyed `cn` | `global`. The CN app and the
|
|
802
|
+
* international WorkBuddy AI app expose different rosters, so each keeps its
|
|
803
|
+
* own directory and selection and switching accounts never drops the other
|
|
804
|
+
* region's picks.
|
|
805
|
+
*/
|
|
806
|
+
regions?: Partial<Record<WorkBuddyRegion, WorkBuddyRegionState>>;
|
|
807
|
+
/**
|
|
808
|
+
* @deprecated Legacy single-slot fields from before the region split. They
|
|
809
|
+
* predate international support and are read as the CN region's state when
|
|
810
|
+
* `regions.cn` is absent; new writes go to `regions`.
|
|
811
|
+
*/
|
|
651
812
|
lastCatalog?: WorkBuddyModelInfo[];
|
|
652
|
-
/**
|
|
813
|
+
/** @deprecated See {@link Config.lastCatalog}. */
|
|
653
814
|
enabledModelIds?: string[];
|
|
654
|
-
/**
|
|
815
|
+
/** @deprecated See {@link Config.lastCatalog}. */
|
|
655
816
|
imageModelIds?: string[];
|
|
656
|
-
/**
|
|
817
|
+
/** @deprecated See {@link Config.lastCatalog}. */
|
|
657
818
|
contextBudgets?: Record<string, WorkBuddyContextBudget>;
|
|
658
819
|
}
|
|
659
820
|
declare const Config: z<Config>;
|
|
660
821
|
/**
|
|
661
|
-
*
|
|
662
|
-
*
|
|
663
|
-
*
|
|
664
|
-
*
|
|
822
|
+
* One region's saved model state. A config written before the region split has
|
|
823
|
+
* only the flat fields: those were always captured from the CN endpoint (the
|
|
824
|
+
* plugin had no international support), so they are read as the CN state and
|
|
825
|
+
* only when no explicit CN slot exists. The global region never inherits them —
|
|
826
|
+
* that inheritance is exactly the bug where a stale CN directory was
|
|
827
|
+
* intersected with the international catalog and silently dropped the user's
|
|
828
|
+
* picks.
|
|
829
|
+
*/
|
|
830
|
+
declare function regionStateOf(config: Config, region: WorkBuddyRegion): WorkBuddyRegionState;
|
|
831
|
+
/**
|
|
832
|
+
* Start both regions' loopback endpoints, register the `workbuddy` (CN) and
|
|
833
|
+
* `workbuddy-global` (international) providers, and refresh each region's
|
|
834
|
+
* model catalog from the upstream once that region's credentials allow it.
|
|
835
|
+
* The static fallback catalogs serve from the first moment, so an offline
|
|
836
|
+
* upstream never leaves a provider empty.
|
|
665
837
|
*/
|
|
666
838
|
declare function apply(ctx: Context, config: Config): void;
|
|
667
839
|
//#endregion
|
|
668
|
-
export { Config, FALLBACK_WORKBUDDY_MODELS, type UpstreamErrorKind, WORKBUDDY_ACCOUNTS_REFRESH_PATH, WORKBUDDY_AUTH_FILENAME, WORKBUDDY_AUTH_FILE_ENV, WORKBUDDY_CHECKIN_PATH, WORKBUDDY_CONNECT_VERSION, WORKBUDDY_HOST_HEARTBEAT_FILENAME, WORKBUDDY_MODELS_REFRESH_PATH, WORKBUDDY_PROVIDER, WORKBUDDY_SETTINGS_NS, WORKBUDDY_STREAM_IDLE_TIMEOUT_MS, WORKBUDDY_USAGE_PATH, type WorkBuddyAccountChoice, type WorkBuddyAdapter, type WorkBuddyAuthStatus, WorkBuddyCatalog, type WorkBuddyChatResult, type WorkBuddyCredential, WorkBuddyCredentialStore, type WorkBuddyCreditPackage, type WorkBuddyCredits, type WorkBuddyHostHeartbeat, type WorkBuddyModelInfo, type WorkBuddyReasoning, type WorkBuddyRefreshOutcome, type WorkBuddyShim, type WorkBuddyStatusRouteOptions, type WorkBuddyStoreOptions, WorkBuddyUpstreamClient, type WorkBuddyUpstreamModel, type WorkBuddyWebAccount, type WorkBuddyWebCheckin, type WorkBuddyWebCredits, type WorkBuddyWebModel, type WorkBuddyWebPackage, type WorkBuddyWebUsage, apply, authFileName, classifyUpstreamError, clearHostHeartbeat, createWorkBuddyAdapter, createWorkBuddyShim, defaultDesktopAuthCandidates, defaultDesktopAuthDirs, defaultDesktopAuthPath, deriveCatalog, inject, isHeartbeatProcessAlive, name, parseCreditMultiplier, parseReasoning, parseUpstreamModel, parseWorkBuddyAuth, prepareChatBody, processStartTimeMs, readHostHeartbeat, regionOf, registerWorkBuddyStatusRoute, toPersistedWorkBuddyModel, workBuddyDisplayName, workBuddyModelInput, workBuddyThinkingLevelMap, workBuddyWebStatus, workbuddyAccountId, workbuddyHostHeartbeatPath, workbuddyOwnAuthPath, writeHostHeartbeat };
|
|
840
|
+
export { Config, FALLBACK_WORKBUDDY_MODELS, FALLBACK_WORKBUDDY_MODELS_GLOBAL, type UpstreamErrorKind, WORKBUDDY_ACCOUNTS_REFRESH_PATH, 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_PROVIDER, WORKBUDDY_PROVIDERS, WORKBUDDY_PROVIDER_DISPLAY_NAMES, WORKBUDDY_REGIONS, WORKBUDDY_REGION_PARAM, WORKBUDDY_SETTINGS_NS, WORKBUDDY_STREAM_IDLE_TIMEOUT_MS, WORKBUDDY_USAGE_PATH, type WorkBuddyAccountChoice, type WorkBuddyAdapter, type WorkBuddyAuthStatus, WorkBuddyCatalog, type WorkBuddyChatResult, type WorkBuddyCredential, WorkBuddyCredentialStore, type WorkBuddyCreditPackage, type WorkBuddyCredits, type WorkBuddyHostHeartbeat, type WorkBuddyModelInfo, type WorkBuddyReasoning, type WorkBuddyRefreshOutcome, WorkBuddyRegionState, type WorkBuddyShim, type WorkBuddyStatusRouteOptions, type WorkBuddyStoreOptions, WorkBuddyUpstreamClient, type WorkBuddyUpstreamModel, type WorkBuddyWebAccount, type WorkBuddyWebCheckin, type WorkBuddyWebCredits, type WorkBuddyWebModel, type WorkBuddyWebPackage, type WorkBuddyWebRegion, type WorkBuddyWebUsage, apply, authFileName, classifyUpstreamError, clearHostHeartbeat, createWorkBuddyAdapter, createWorkBuddyShim, defaultDesktopAuthCandidates, defaultDesktopAuthDirs, defaultDesktopAuthPath, deriveCatalog, fallbackModelsFor, inject, isHeartbeatProcessAlive, legacyWorkbuddyOwnAuthPath, name, parseCreditMultiplier, parseReasoning, parseUpstreamModel, parseWorkBuddyAuth, prepareChatBody, processStartTimeMs, readHostHeartbeat, regionOf, regionOfProvider, regionOfStatusUrl, regionStateOf, registerWorkBuddyStatusRoute, toPersistedWorkBuddyModel, withWorkBuddyRegion, workBuddyDisplayName, workBuddyModelInput, workBuddyThinkingLevelMap, workBuddyWebStatus, workbuddyAccountId, workbuddyHostHeartbeatPath, workbuddyOwnAuthPath, writeHostHeartbeat };
|