dsh-connect-workbuddy 5.30.0 → 5.31.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 +39 -0
- package/lib/bin.js +1 -1
- package/lib/client.js +2897 -2821
- package/lib/{host-heartbeat-BzYVKa0r.js → host-heartbeat-AVovVGqY.js} +126 -9
- package/lib/index.d.ts +160 -4
- package/lib/index.js +8898 -8803
- package/package.json +1 -1
|
@@ -6679,6 +6679,41 @@ function parseEnterpriseInstant(value) {
|
|
|
6679
6679
|
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
6680
6680
|
}
|
|
6681
6681
|
/**
|
|
6682
|
+
* An upstream failure that carries the upstream's OWN words.
|
|
6683
|
+
*
|
|
6684
|
+
* The summary an error message carries is truncated to 160 characters, which
|
|
6685
|
+
* is right for a log line and wrong for the one caller that needs the whole
|
|
6686
|
+
* sentence: the upstream states its recovery time in prose, and that sentence
|
|
6687
|
+
* must reach the card intact (see {@link WorkBuddyCatalogDegradation}).
|
|
6688
|
+
*
|
|
6689
|
+
* So the full body travels beside the summary rather than inside it.
|
|
6690
|
+
*/
|
|
6691
|
+
var WorkBuddyUpstreamError = class extends Error {
|
|
6692
|
+
/** HTTP status the upstream answered with. */
|
|
6693
|
+
status;
|
|
6694
|
+
/** The upstream's own words, untruncated. */
|
|
6695
|
+
body;
|
|
6696
|
+
constructor(status, body, summary) {
|
|
6697
|
+
super(summary);
|
|
6698
|
+
this.name = "WorkBuddyUpstreamError";
|
|
6699
|
+
this.status = status;
|
|
6700
|
+
this.body = body;
|
|
6701
|
+
}
|
|
6702
|
+
};
|
|
6703
|
+
/**
|
|
6704
|
+
* The upstream's own words for a failed read, or the error's message when the
|
|
6705
|
+
* failure was not an upstream answer (a transport error, a roster that
|
|
6706
|
+
* resolved to nothing).
|
|
6707
|
+
*
|
|
6708
|
+
* The fallback reader needs the raw body for the recovery sentence; the log
|
|
6709
|
+
* line needs the summary. Both come from here, so the two can never disagree
|
|
6710
|
+
* about which failure this was.
|
|
6711
|
+
*/
|
|
6712
|
+
function upstreamBodyOf(error) {
|
|
6713
|
+
if (error instanceof WorkBuddyUpstreamError) return error.body;
|
|
6714
|
+
return error instanceof Error ? error.message : String(error);
|
|
6715
|
+
}
|
|
6716
|
+
/**
|
|
6682
6717
|
* Fail an envelope whose business code is non-zero, classified like HTTP errors.
|
|
6683
6718
|
*
|
|
6684
6719
|
* A JSON body on a 401/403 is still a credential refusal: the edge answered in
|
|
@@ -6699,7 +6734,7 @@ function parseEnterpriseInstant(value) {
|
|
|
6699
6734
|
function envelopeError(status, envelope) {
|
|
6700
6735
|
if (status === 401 || status === 403) return new WorkBuddyCredentialRejectedError(status);
|
|
6701
6736
|
const kind = classifyUpstreamError(status, `{"code":${envelope.code},"msg":${JSON.stringify(envelope.msg)}}`);
|
|
6702
|
-
return
|
|
6737
|
+
return new WorkBuddyUpstreamError(status, envelope.msg, `workbuddy upstream ${kind} (http ${status}): ${envelope.msg.slice(0, 160)}`);
|
|
6703
6738
|
}
|
|
6704
6739
|
/**
|
|
6705
6740
|
* Parse the upstream's `credits` string into a multiplier.
|
|
@@ -7257,6 +7292,14 @@ var WorkBuddyUpstreamClient = class {
|
|
|
7257
7292
|
* document still publishes stays in the roster, so reading the directory
|
|
7258
7293
|
* never withdraws a model the user is running (issue #32's failure mode,
|
|
7259
7294
|
* one step upstream of it).
|
|
7295
|
+
*
|
|
7296
|
+
* THE ANSWER IS A {@link WorkBuddyCatalogRead}, not a bare roster, because a
|
|
7297
|
+
* FALLBACK read is a partial answer and the caller has to be able to tell
|
|
7298
|
+
* (issue #288). The international region reads two documents that publish
|
|
7299
|
+
* different rosters, so "the CLI read was refused and the app document
|
|
7300
|
+
* answered" is a downgrade the user must be told about — and a roster that
|
|
7301
|
+
* silently lost the CLI-only rows would otherwise look like the user's own
|
|
7302
|
+
* selection had shrunk.
|
|
7260
7303
|
*/
|
|
7261
7304
|
async fetchModels(credential, signal, keepModelIds = []) {
|
|
7262
7305
|
const timeout = signal ?? AbortSignal.timeout(JSON_TIMEOUT_MS);
|
|
@@ -7298,22 +7341,51 @@ var WorkBuddyUpstreamClient = class {
|
|
|
7298
7341
|
* a complete answer and is returned as-is — reported through
|
|
7299
7342
|
* `onFallback` rather than swallowed, because the desktop-only rows then
|
|
7300
7343
|
* disappear from the picker and that is worth a log line.
|
|
7344
|
+
*
|
|
7345
|
+
* ⚠️ A FALLBACK IS A DOWNGRADE, AND IT SAYS SO (issue #288). The two
|
|
7346
|
+
* documents publish different rosters, so the answer built from the
|
|
7347
|
+
* surviving one is missing every row the refused one published — the
|
|
7348
|
+
* CLI-only rows (`fast-model`, `balanced-model`, `primary-model`,
|
|
7349
|
+
* `deepseek-v4.1-flash`, `hy4-preview`, …) are exactly what the app
|
|
7350
|
+
* document does not carry. That roster was then filtered by the user's
|
|
7351
|
+
* own selection, so a rate limit could empty the model picker down to
|
|
7352
|
+
* one or two rows, with the profile still holding the full directory and
|
|
7353
|
+
* nothing on screen to explain the difference.
|
|
7354
|
+
*
|
|
7355
|
+
* So the answer now carries WHICH document was refused and what the
|
|
7356
|
+
* upstream said, and the caller keeps the saved directory's rows beside
|
|
7357
|
+
* the surviving ones. The log line stays; it is just no longer the ONLY
|
|
7358
|
+
* place the fact exists.
|
|
7301
7359
|
*/
|
|
7302
7360
|
let cliRoster;
|
|
7303
7361
|
try {
|
|
7304
7362
|
cliRoster = await readChannel(CATALOG_CLI_UA);
|
|
7305
7363
|
} catch (error) {
|
|
7306
7364
|
this.onFallback?.(`global CLI catalog ${GLOBAL_CONFIG_PATH} failed; using the app document only: ` + (error instanceof Error ? error.message : String(error)));
|
|
7307
|
-
return
|
|
7365
|
+
return {
|
|
7366
|
+
models: await readChannel(APP_CHANNEL_UA),
|
|
7367
|
+
degraded: {
|
|
7368
|
+
missing: "cli",
|
|
7369
|
+
used: "app",
|
|
7370
|
+
body: upstreamBodyOf(error)
|
|
7371
|
+
}
|
|
7372
|
+
};
|
|
7308
7373
|
}
|
|
7309
7374
|
let appRoster;
|
|
7310
7375
|
try {
|
|
7311
7376
|
appRoster = await readChannel(APP_CHANNEL_UA);
|
|
7312
7377
|
} catch (error) {
|
|
7313
7378
|
this.onFallback?.(`global app catalog ${GLOBAL_CONFIG_PATH} failed; using the CLI document only: ` + (error instanceof Error ? error.message : String(error)));
|
|
7314
|
-
return
|
|
7379
|
+
return {
|
|
7380
|
+
models: cliRoster,
|
|
7381
|
+
degraded: {
|
|
7382
|
+
missing: "app",
|
|
7383
|
+
used: "cli",
|
|
7384
|
+
body: upstreamBodyOf(error)
|
|
7385
|
+
}
|
|
7386
|
+
};
|
|
7315
7387
|
}
|
|
7316
|
-
return mergeModelRosters(cliRoster, appRoster);
|
|
7388
|
+
return { models: mergeModelRosters(cliRoster, appRoster) };
|
|
7317
7389
|
}
|
|
7318
7390
|
const readCatalog = async (path) => {
|
|
7319
7391
|
const response = await fetch(`${chatBase(credential, this.cnBaseOf())}${path}`, {
|
|
@@ -7332,10 +7404,17 @@ var WorkBuddyUpstreamClient = class {
|
|
|
7332
7404
|
return withPromos(selectCliModels(data["models"], data["agents"], keepModelIds), data);
|
|
7333
7405
|
};
|
|
7334
7406
|
try {
|
|
7335
|
-
return await readCatalog(GLOBAL_CONFIG_PATH);
|
|
7407
|
+
return { models: await readCatalog(GLOBAL_CONFIG_PATH) };
|
|
7336
7408
|
} catch (error) {
|
|
7337
7409
|
this.onFallback?.(`CN model catalog ${GLOBAL_CONFIG_PATH} failed; falling back to ${MODELS_CATALOG_PATH}: ` + (error instanceof Error ? error.message : String(error)));
|
|
7338
|
-
return
|
|
7410
|
+
return {
|
|
7411
|
+
models: await readCatalog(MODELS_CATALOG_PATH),
|
|
7412
|
+
degraded: {
|
|
7413
|
+
missing: "app",
|
|
7414
|
+
used: "legacy",
|
|
7415
|
+
body: upstreamBodyOf(error)
|
|
7416
|
+
}
|
|
7417
|
+
};
|
|
7339
7418
|
}
|
|
7340
7419
|
}
|
|
7341
7420
|
/**
|
|
@@ -10024,6 +10103,26 @@ var WorkBuddyCatalog = class {
|
|
|
10024
10103
|
*/
|
|
10025
10104
|
enabled = true;
|
|
10026
10105
|
/**
|
|
10106
|
+
* Why the current roster is a PARTIAL answer, when it is one.
|
|
10107
|
+
*
|
|
10108
|
+
* ISSUE #288. The international region reads two product documents that
|
|
10109
|
+
* publish different rosters, so a refused read is answered from the other
|
|
10110
|
+
* one and the answer is missing rows the upstream does publish. That roster
|
|
10111
|
+
* used to be presented as if it were the whole truth — filtered by the
|
|
10112
|
+
* user's own selection, so a rate limit could leave the model picker with
|
|
10113
|
+
* one row and no explanation.
|
|
10114
|
+
*
|
|
10115
|
+
* The flag is what lets the card say "the directory is degraded, this part is
|
|
10116
|
+
* the saved snapshot" instead of leaving the user to guess. It is process
|
|
10117
|
+
* state, like the load level: a fact about this minute, never persisted.
|
|
10118
|
+
*
|
|
10119
|
+
* CLEARED by a fresh upstream read that was NOT degraded, and KEPT by a
|
|
10120
|
+
* derivation (`origin: 'derived'`), because a roster derived from a degraded
|
|
10121
|
+
* read is still degraded — re-deriving it on a settings change must not
|
|
10122
|
+
* quietly promote a partial answer into a complete one.
|
|
10123
|
+
*/
|
|
10124
|
+
degraded;
|
|
10125
|
+
/**
|
|
10027
10126
|
* @param region Seeds the static fallback for this region; each region's
|
|
10028
10127
|
* provider must never serve the other region's roster before its first
|
|
10029
10128
|
* live refresh lands.
|
|
@@ -10114,14 +10213,32 @@ var WorkBuddyCatalog = class {
|
|
|
10114
10213
|
* landed — and the list it passes then is the static fallback. Letting that
|
|
10115
10214
|
* count as live is what re-opened issue #32 (see {@link hasLiveRoster}).
|
|
10116
10215
|
*
|
|
10216
|
+
* `degraded` says the upstream answer was a PARTIAL one (issue #288) — a
|
|
10217
|
+
* refused product document, answered from the other one. It is accepted
|
|
10218
|
+
* ONLY on an `upstream` write: a derivation inherits the degradation it was
|
|
10219
|
+
* derived from, so it cannot clear it and cannot invent one.
|
|
10220
|
+
*
|
|
10117
10221
|
* The default is `'upstream'` so every pre-existing call site keeps meaning
|
|
10118
10222
|
* what it meant; only the re-derivation path opts into `'derived'`.
|
|
10119
10223
|
*/
|
|
10120
|
-
set(models, origin = "upstream") {
|
|
10224
|
+
set(models, origin = "upstream", degraded) {
|
|
10121
10225
|
if (models.length === 0) throw new Error("workbuddy model catalog cannot be empty");
|
|
10122
|
-
if (origin === "upstream")
|
|
10226
|
+
if (origin === "upstream") {
|
|
10227
|
+
this.live = true;
|
|
10228
|
+
this.degraded = degraded;
|
|
10229
|
+
}
|
|
10123
10230
|
this.models = models.map((model) => ({ ...model }));
|
|
10124
10231
|
}
|
|
10232
|
+
/**
|
|
10233
|
+
* Why the current roster is partial, when it is.
|
|
10234
|
+
*
|
|
10235
|
+
* Absent means "the roster is the upstream's whole offer" — which is the
|
|
10236
|
+
* answer to "can I tell the user the list is complete?", not a claim that
|
|
10237
|
+
* the upstream was reachable at this very moment.
|
|
10238
|
+
*/
|
|
10239
|
+
degradation() {
|
|
10240
|
+
return this.degraded;
|
|
10241
|
+
}
|
|
10125
10242
|
};
|
|
10126
10243
|
/** 文件名,带前导点,与 `.workbuddy-device.json` 同一约定。 */
|
|
10127
10244
|
const DEVICE_PROFILE_FILE_NAME = ".workbuddy-device-profiles.json";
|
|
@@ -11490,7 +11607,7 @@ function describeRosterSeenPayload(raw) {
|
|
|
11490
11607
|
//#endregion
|
|
11491
11608
|
//#region src/version.ts
|
|
11492
11609
|
/** The npm package version this build was produced from. */
|
|
11493
|
-
const WORKBUDDY_CONNECT_VERSION = "5.
|
|
11610
|
+
const WORKBUDDY_CONNECT_VERSION = "5.31.0";
|
|
11494
11611
|
//#endregion
|
|
11495
11612
|
//#region src/host-heartbeat.ts
|
|
11496
11613
|
/**
|
package/lib/index.d.ts
CHANGED
|
@@ -1911,6 +1911,66 @@ declare function parseCreditMultiplier(value: unknown): number | undefined;
|
|
|
1911
1911
|
declare function parseReasoning(value: unknown): WorkBuddyReasoning | undefined;
|
|
1912
1912
|
/** Parse one catalog entry; entries without usable token limits are dropped. */
|
|
1913
1913
|
declare function parseUpstreamModel(value: unknown): WorkBuddyUpstreamModel | undefined;
|
|
1914
|
+
/**
|
|
1915
|
+
* Which document a model directory was read from.
|
|
1916
|
+
*
|
|
1917
|
+
* THE THREE SOURCES, and why a reader needs to name them.
|
|
1918
|
+
*
|
|
1919
|
+
* - `app`: the `/v3/config` product document read as the APP's identity. Both
|
|
1920
|
+
* regions read it; the CN region reads nothing else.
|
|
1921
|
+
* - `cli`: the SAME document read as the CLI channel's identity. The
|
|
1922
|
+
* international region reads both, because neither document is a superset of
|
|
1923
|
+
* the other (see {@link mergeModelRosters}).
|
|
1924
|
+
* - `legacy`: the CN region's legacy catalog path, the fallback for a gateway
|
|
1925
|
+
* that stops serving the modern document.
|
|
1926
|
+
*
|
|
1927
|
+
* A reader that fell back from one to another is answering with a PARTIAL
|
|
1928
|
+
* directory, and the user has to be told which part is missing — see
|
|
1929
|
+
* {@link WorkBuddyCatalogDegradation}.
|
|
1930
|
+
*/
|
|
1931
|
+
type WorkBuddyCatalogSource = 'app' | 'cli' | 'legacy';
|
|
1932
|
+
/**
|
|
1933
|
+
* A model directory that came from a FALLBACK document.
|
|
1934
|
+
*
|
|
1935
|
+
* ISSUE #288. The international region reads `/v3/config` twice, as the CLI
|
|
1936
|
+
* channel and as the app channel, and the two documents publish DIFFERENT
|
|
1937
|
+
* rosters: the CLI one carries `fast-model` / `balanced-model` /
|
|
1938
|
+
* `primary-model` / `deepseek-v4.1-flash` / `hy4-preview` / `gpt-5.5` /
|
|
1939
|
+
* `gpt-5.4` / `glm-5.2`, the app one carries `max-model` / `hy4free` /
|
|
1940
|
+
* `hy4std` (measured on a real account 2026-11-06).
|
|
1941
|
+
*
|
|
1942
|
+
* So when one read fails — a rate limit (`soft_rate` / `quota_exceeded`), a
|
|
1943
|
+
* transport error — the fallback to the OTHER document is a downgrade, not a
|
|
1944
|
+
* convenience: every row the refused document published is missing from the
|
|
1945
|
+
* answer. The fallback used to be reported only in the log, and the roster it
|
|
1946
|
+
* produced was then filtered by the user's selection — so a rate limit could
|
|
1947
|
+
* collapse the model picker down to the handful of rows the surviving document
|
|
1948
|
+
* happened to carry, with nothing on screen saying why.
|
|
1949
|
+
*
|
|
1950
|
+
* `body` is the upstream's OWN words (untruncated), because the upstream states
|
|
1951
|
+
* its recovery time in prose — 「将在 2026-09-30 02:30:30 UTC+8 重置」 — and that
|
|
1952
|
+
* sentence is the one thing worth showing the user.
|
|
1953
|
+
*/
|
|
1954
|
+
interface WorkBuddyCatalogDegradation {
|
|
1955
|
+
/** The document that was NOT read. */
|
|
1956
|
+
readonly missing: WorkBuddyCatalogSource;
|
|
1957
|
+
/** The document the answer came from instead. */
|
|
1958
|
+
readonly used: WorkBuddyCatalogSource;
|
|
1959
|
+
/** The upstream's own words, untruncated. */
|
|
1960
|
+
readonly body: string;
|
|
1961
|
+
}
|
|
1962
|
+
/**
|
|
1963
|
+
* One model-directory read: the roster, and whether it is the whole truth.
|
|
1964
|
+
*
|
|
1965
|
+
* `degraded` absent means the read was COMPLETE — every document the region
|
|
1966
|
+
* reads answered, so the roster is the upstream's current offer. Present means
|
|
1967
|
+
* one document was refused and the answer came from the other, so the roster is
|
|
1968
|
+
* missing rows the upstream does publish.
|
|
1969
|
+
*/
|
|
1970
|
+
interface WorkBuddyCatalogRead {
|
|
1971
|
+
readonly models: readonly WorkBuddyUpstreamModel[];
|
|
1972
|
+
readonly degraded?: WorkBuddyCatalogDegradation;
|
|
1973
|
+
}
|
|
1914
1974
|
/**
|
|
1915
1975
|
* Upstream HTTP client. One instance serves the whole plugin; requests take
|
|
1916
1976
|
* the credential explicitly so token refreshes apply on the next call.
|
|
@@ -2043,8 +2103,16 @@ declare class WorkBuddyUpstreamClient {
|
|
|
2043
2103
|
* document still publishes stays in the roster, so reading the directory
|
|
2044
2104
|
* never withdraws a model the user is running (issue #32's failure mode,
|
|
2045
2105
|
* one step upstream of it).
|
|
2106
|
+
*
|
|
2107
|
+
* THE ANSWER IS A {@link WorkBuddyCatalogRead}, not a bare roster, because a
|
|
2108
|
+
* FALLBACK read is a partial answer and the caller has to be able to tell
|
|
2109
|
+
* (issue #288). The international region reads two documents that publish
|
|
2110
|
+
* different rosters, so "the CLI read was refused and the app document
|
|
2111
|
+
* answered" is a downgrade the user must be told about — and a roster that
|
|
2112
|
+
* silently lost the CLI-only rows would otherwise look like the user's own
|
|
2113
|
+
* selection had shrunk.
|
|
2046
2114
|
*/
|
|
2047
|
-
fetchModels(credential: WorkBuddyCredential, signal?: AbortSignal, keepModelIds?: readonly string[]): Promise<
|
|
2115
|
+
fetchModels(credential: WorkBuddyCredential, signal?: AbortSignal, keepModelIds?: readonly string[]): Promise<WorkBuddyCatalogRead>;
|
|
2048
2116
|
/**
|
|
2049
2117
|
* Read how busy each model is right now, from the upstream's own probe.
|
|
2050
2118
|
*
|
|
@@ -2361,6 +2429,26 @@ declare class WorkBuddyCatalog {
|
|
|
2361
2429
|
* accounts, and model picks intact and reappears the moment they re-check it.
|
|
2362
2430
|
*/
|
|
2363
2431
|
private enabled;
|
|
2432
|
+
/**
|
|
2433
|
+
* Why the current roster is a PARTIAL answer, when it is one.
|
|
2434
|
+
*
|
|
2435
|
+
* ISSUE #288. The international region reads two product documents that
|
|
2436
|
+
* publish different rosters, so a refused read is answered from the other
|
|
2437
|
+
* one and the answer is missing rows the upstream does publish. That roster
|
|
2438
|
+
* used to be presented as if it were the whole truth — filtered by the
|
|
2439
|
+
* user's own selection, so a rate limit could leave the model picker with
|
|
2440
|
+
* one row and no explanation.
|
|
2441
|
+
*
|
|
2442
|
+
* The flag is what lets the card say "the directory is degraded, this part is
|
|
2443
|
+
* the saved snapshot" instead of leaving the user to guess. It is process
|
|
2444
|
+
* state, like the load level: a fact about this minute, never persisted.
|
|
2445
|
+
*
|
|
2446
|
+
* CLEARED by a fresh upstream read that was NOT degraded, and KEPT by a
|
|
2447
|
+
* derivation (`origin: 'derived'`), because a roster derived from a degraded
|
|
2448
|
+
* read is still degraded — re-deriving it on a settings change must not
|
|
2449
|
+
* quietly promote a partial answer into a complete one.
|
|
2450
|
+
*/
|
|
2451
|
+
private degraded;
|
|
2364
2452
|
/**
|
|
2365
2453
|
* @param region Seeds the static fallback for this region; each region's
|
|
2366
2454
|
* provider must never serve the other region's roster before its first
|
|
@@ -2434,10 +2522,23 @@ declare class WorkBuddyCatalog {
|
|
|
2434
2522
|
* landed — and the list it passes then is the static fallback. Letting that
|
|
2435
2523
|
* count as live is what re-opened issue #32 (see {@link hasLiveRoster}).
|
|
2436
2524
|
*
|
|
2525
|
+
* `degraded` says the upstream answer was a PARTIAL one (issue #288) — a
|
|
2526
|
+
* refused product document, answered from the other one. It is accepted
|
|
2527
|
+
* ONLY on an `upstream` write: a derivation inherits the degradation it was
|
|
2528
|
+
* derived from, so it cannot clear it and cannot invent one.
|
|
2529
|
+
*
|
|
2437
2530
|
* The default is `'upstream'` so every pre-existing call site keeps meaning
|
|
2438
2531
|
* what it meant; only the re-derivation path opts into `'derived'`.
|
|
2439
2532
|
*/
|
|
2440
|
-
set(models: readonly WorkBuddyModelInfo[], origin?: 'upstream' | 'derived'): void;
|
|
2533
|
+
set(models: readonly WorkBuddyModelInfo[], origin?: 'upstream' | 'derived', degraded?: WorkBuddyCatalogDegradation): void;
|
|
2534
|
+
/**
|
|
2535
|
+
* Why the current roster is partial, when it is.
|
|
2536
|
+
*
|
|
2537
|
+
* Absent means "the roster is the upstream's whole offer" — which is the
|
|
2538
|
+
* answer to "can I tell the user the list is complete?", not a claim that
|
|
2539
|
+
* the upstream was reachable at this very moment.
|
|
2540
|
+
*/
|
|
2541
|
+
degradation(): WorkBuddyCatalogDegradation | undefined;
|
|
2441
2542
|
}
|
|
2442
2543
|
//#endregion
|
|
2443
2544
|
//#region src/cli-bridge/mount.d.ts
|
|
@@ -4285,6 +4386,43 @@ interface WorkBuddyWebSearchPath {
|
|
|
4285
4386
|
* The card uses this to read and write the matching per-region model slot.
|
|
4286
4387
|
*/
|
|
4287
4388
|
type WorkBuddyWebRegion = 'cn' | 'global';
|
|
4389
|
+
/**
|
|
4390
|
+
* This region's model directory is a PARTIAL answer (issue #288).
|
|
4391
|
+
*
|
|
4392
|
+
* The international region reads two product documents that publish different
|
|
4393
|
+
* rosters, and the CN region falls back to a legacy document when the modern
|
|
4394
|
+
* one stops answering. Either way a refused read is answered from the other
|
|
4395
|
+
* document — and the answer is missing rows the upstream does publish.
|
|
4396
|
+
*
|
|
4397
|
+
* The card needs this to tell TWO apart that look identical on screen:
|
|
4398
|
+
*
|
|
4399
|
+
* - "the directory only has one model" (the user's own selection), and
|
|
4400
|
+
* - "the directory could not be read, so this is what survived" (a rate
|
|
4401
|
+
* limit, a transport error).
|
|
4402
|
+
*
|
|
4403
|
+
* Without it the second case was silent, and the user could not tell that the
|
|
4404
|
+
* list they were looking at was a fallback rather than the upstream's offer.
|
|
4405
|
+
*/
|
|
4406
|
+
interface WorkBuddyWebCatalogDegradation {
|
|
4407
|
+
/** The document that was NOT read. */
|
|
4408
|
+
missing: 'app' | 'cli' | 'legacy';
|
|
4409
|
+
/** The document the answer came from instead. */
|
|
4410
|
+
used: 'app' | 'cli' | 'legacy';
|
|
4411
|
+
/**
|
|
4412
|
+
* The upstream's own words about the failure, redacted and truncated.
|
|
4413
|
+
*
|
|
4414
|
+
* The upstream states its recovery time in prose, so this sentence is worth
|
|
4415
|
+
* showing verbatim — it is the only place the user learns when the limit
|
|
4416
|
+
* lifts.
|
|
4417
|
+
*/
|
|
4418
|
+
reason: string;
|
|
4419
|
+
/**
|
|
4420
|
+
* The recovery time the upstream stated, in epoch ms.
|
|
4421
|
+
*
|
|
4422
|
+
* ABSENT means "the upstream named no time" — never "now" and never a guess.
|
|
4423
|
+
*/
|
|
4424
|
+
resetAtMs?: number;
|
|
4425
|
+
}
|
|
4288
4426
|
/** The JSON document the plugin card renders. */
|
|
4289
4427
|
type WorkBuddyWebUsage =
|
|
4290
4428
|
/**
|
|
@@ -4630,6 +4768,15 @@ type WorkBuddyWebUsage =
|
|
|
4630
4768
|
models: readonly WorkBuddyWebModel[];
|
|
4631
4769
|
enabledModelIds: readonly string[];
|
|
4632
4770
|
imageModelIds: readonly string[];
|
|
4771
|
+
/**
|
|
4772
|
+
* This region's model directory is a PARTIAL answer (issue #288).
|
|
4773
|
+
*
|
|
4774
|
+
* ABSENT means "the directory is the upstream's whole offer" — the two
|
|
4775
|
+
* states are different facts and the card says different things about
|
|
4776
|
+
* them, so the field is absent rather than false when there is nothing to
|
|
4777
|
+
* report.
|
|
4778
|
+
*/
|
|
4779
|
+
catalogDegraded?: WorkBuddyWebCatalogDegradation;
|
|
4633
4780
|
/**
|
|
4634
4781
|
* Model ids whose `off` thinking level is offered (issue #34): the saved
|
|
4635
4782
|
* selection, seeded from the built-in rule the first time it is read.
|
|
@@ -5202,7 +5349,7 @@ interface WorkBuddyStatusRouteOptions {
|
|
|
5202
5349
|
*/
|
|
5203
5350
|
defaultThinkingEfforts?(region: WorkBuddyRegion): Readonly<Record<string, string | undefined>>;
|
|
5204
5351
|
/** Re-read the live catalog of one region from the upstream. */
|
|
5205
|
-
discoverModels?(region: WorkBuddyRegion, signal?: AbortSignal): Promise<
|
|
5352
|
+
discoverModels?(region: WorkBuddyRegion, signal?: AbortSignal): Promise<WorkBuddyCatalogRead>;
|
|
5206
5353
|
/**
|
|
5207
5354
|
* Record what a refresh just read, so the directory — and therefore every
|
|
5208
5355
|
* price on it — stops being a snapshot of an older day (issue #214).
|
|
@@ -5227,7 +5374,16 @@ interface WorkBuddyStatusRouteOptions {
|
|
|
5227
5374
|
* paints its draft from the ANSWER, so a 503 leaves the draft untouched and
|
|
5228
5375
|
* the user sees a real error instead of a stale list that looks refreshed.
|
|
5229
5376
|
*/
|
|
5230
|
-
persistModels?(region: WorkBuddyRegion,
|
|
5377
|
+
persistModels?(region: WorkBuddyRegion, read: WorkBuddyCatalogRead): Promise<void>;
|
|
5378
|
+
/**
|
|
5379
|
+
* Whether the requested region's model directory is a PARTIAL answer
|
|
5380
|
+
* (issue #288) — one product document was refused and the other one
|
|
5381
|
+
* answered, so the list is missing rows the upstream does publish.
|
|
5382
|
+
*
|
|
5383
|
+
* Optional: absent means the Host does not track the fact, and the card
|
|
5384
|
+
* shows no notice rather than inventing one.
|
|
5385
|
+
*/
|
|
5386
|
+
catalogDegradation?(region: WorkBuddyRegion): WorkBuddyCatalogDegradation | undefined;
|
|
5231
5387
|
/**
|
|
5232
5388
|
* Which ids of the requested region's roster THIS machine first saw inside the
|
|
5233
5389
|
* new-model window (the "· N 新模型" segment), plus a note when the on-disk
|