dsh-connect-workbuddy 5.20.2 → 5.20.32

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.
@@ -2974,6 +2974,156 @@ function attachPromos(models, promos) {
2974
2974
  };
2975
2975
  });
2976
2976
  }
2977
+ /**
2978
+ * Minutes since local midnight in `timeZone` at `nowMs`.
2979
+ *
2980
+ * `Intl` does the zone maths, because the upstream's windows are written in
2981
+ * the zone IT names (Asia/Shanghai for the CN feed) and the user's own clock
2982
+ * is not necessarily in that zone. An unusable zone falls back to UTC rather
2983
+ * than throwing: a badge that cannot be placed is a missing badge, not a
2984
+ * broken card.
2985
+ */
2986
+ function zonedMinutes(nowMs, timeZone) {
2987
+ const zone = timeZone ?? "UTC";
2988
+ try {
2989
+ const parts = new Intl.DateTimeFormat("en-US", {
2990
+ timeZone: zone,
2991
+ hour: "2-digit",
2992
+ minute: "2-digit",
2993
+ hourCycle: "h23"
2994
+ }).formatToParts(new Date(nowMs));
2995
+ const hour = Number(parts.find((part) => part.type === "hour")?.value ?? "0");
2996
+ const minute = Number(parts.find((part) => part.type === "minute")?.value ?? "0");
2997
+ if (!Number.isFinite(hour) || !Number.isFinite(minute)) return 0;
2998
+ return hour * 60 + minute;
2999
+ } catch {
3000
+ return 0;
3001
+ }
3002
+ }
3003
+ /** Whether `nowMinutes` falls inside one of the daily windows. */
3004
+ function withinDailyWindows(windows, nowMinutes) {
3005
+ return windows.some((window) => {
3006
+ const start = minutesOfClock(window.start);
3007
+ const end = minutesOfClock(window.end);
3008
+ if (start === void 0 || end === void 0) return false;
3009
+ if (start === end) return true;
3010
+ if (end > start) return nowMinutes >= start && nowMinutes < end;
3011
+ return nowMinutes >= start || nowMinutes < end;
3012
+ });
3013
+ }
3014
+ /**
3015
+ * Whether the promotion's ABSOLUTE window holds now.
3016
+ *
3017
+ * The absolute window (`validFrom` / `validUntil`) is the promotion's own
3018
+ * lifetime. It gates the badge on its own: a promotion whose lifetime has
3019
+ * ended must not keep advertising itself, whatever its daily hours say.
3020
+ */
3021
+ function promoWithinAbsoluteWindow(promo, nowMs) {
3022
+ const schedule = promo.schedule;
3023
+ if (schedule === void 0) return true;
3024
+ if (schedule.validFrom !== void 0 && nowMs < schedule.validFrom) return false;
3025
+ if (schedule.validUntil !== void 0 && nowMs >= schedule.validUntil) return false;
3026
+ return true;
3027
+ }
3028
+ /**
3029
+ * Whether the promotion's DAILY window holds now.
3030
+ *
3031
+ * The daily window is the discount's own hours — it is what makes a
3032
+ * promotion a "night discount" — and a promotion without one is running
3033
+ * whenever its absolute window holds.
3034
+ *
3035
+ * A schedule whose `daily` was published but could not be evaluated
3036
+ * ({@link WorkBuddyPromoSchedule.dailyUnusable}) is NOT running: the upstream
3037
+ * did say the campaign has hours, we just cannot read them, and assuming
3038
+ * "always" is the one guess that overstates the offer.
3039
+ */
3040
+ function promoWithinDailyWindow(promo, nowMs) {
3041
+ const schedule = promo.schedule;
3042
+ if (schedule === void 0) return true;
3043
+ if (schedule.dailyUnusable === true) return false;
3044
+ if (schedule.daily === void 0 || schedule.daily.length === 0) return true;
3045
+ return withinDailyWindows(schedule.daily, zonedMinutes(nowMs, schedule.timezone));
3046
+ }
3047
+ /**
3048
+ * Whether the promotion is running right now: its absolute window AND its
3049
+ * daily hours both hold.
3050
+ */
3051
+ function promoActiveAt(promo, nowMs) {
3052
+ return promoWithinAbsoluteWindow(promo, nowMs) && promoWithinDailyWindow(promo, nowMs);
3053
+ }
3054
+ /**
3055
+ * Whether the promotion carries ANY temporal statement of its own.
3056
+ *
3057
+ * A tier badge ("Pro Only") has no `schedule` at all: it describes the model
3058
+ * unconditionally, so `promoActiveAt` is trivially true for it. That is
3059
+ * correct on its own, but it made such a badge eligible for step 1, where it
3060
+ * could shadow a lower-priority campaign whose window really is open.
3061
+ * "Running" should mean "this entry says it runs now", and an entry with no
3062
+ * schedule never does — it only ever "stands". Entries WITH a schedule (a
3063
+ * lifetime, hours, or both) are the ones that can be running.
3064
+ */
3065
+ function hasSchedule(promo) {
3066
+ return promo.schedule !== void 0;
3067
+ }
3068
+ function selectPromoBadge(promos, nowMs) {
3069
+ if (promos === void 0 || promos.length === 0) return void 0;
3070
+ const sorted = [...promos].sort((a, b) => b.priority - a.priority || (a.source === b.source ? 0 : a.source === "promotion" ? -1 : 1));
3071
+ const running = sorted.find((promo) => hasSchedule(promo) && promoActiveAt(promo, nowMs));
3072
+ if (running !== void 0) return running;
3073
+ return sorted.find((promo) => promo.badge.display !== "activeOnly" && promoWithinAbsoluteWindow(promo, nowMs) && promo.schedule?.dailyUnusable !== true);
3074
+ }
3075
+ /**
3076
+ * The chip's colour, when the upstream published a usable one.
3077
+ *
3078
+ * Only a hex colour is accepted: the value reaches an inline style, and the
3079
+ * upstream's feed publishes hex (`#009273`, `#FF0000`). Anything else is
3080
+ * refused rather than passed through, and the card falls back to its own
3081
+ * brand colour.
3082
+ */
3083
+ function promoBadgeColor(promo) {
3084
+ const color = promo.badge.color;
3085
+ if (color === void 0) return void 0;
3086
+ return /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(color) ? color : void 0;
3087
+ }
3088
+ /**
3089
+ * The host's own badge tone for a promotion, for the 0.2.2+ `model.badge` field.
3090
+ *
3091
+ * WHY A TONE AND NOT A COLOUR. From 0.2.2 the host's model directory accepts a
3092
+ * per-model `badge` (`LlmModelBadge = { text, tone }`) and draws it itself, in
3093
+ * the same place and shape as the picker's own labels. `tone` is one of four
3094
+ * semantic slots (`neutral | info | success | warning`), NOT an arbitrary
3095
+ * colour: the shell paints it from theme tokens so it stays legible in every
3096
+ * theme, which an upstream hex value cannot guarantee.
3097
+ *
3098
+ * The upstream's hex colour is therefore mapped onto the CLOSEST tone rather
3099
+ * than passed through. Green — the value every CN promotion here uses for "free
3100
+ * for now" — reads as `success`; blues as `info`; amber/red as `warning`;
3101
+ * anything else stays `neutral` rather than inventing a meaning.
3102
+ *
3103
+ * WHY IT LIVES IN THIS MODULE, not in `client/promo-badge.ts` beside the other
3104
+ * chip helpers. The consumer that needs it is `src/adapter.ts` — the HOST half,
3105
+ * which fills `LlmModelInfo.badge` and cannot import from `src/client/` (that
3106
+ * directory is a separate build, and the host bundle never reaches it). This
3107
+ * module is the one place both halves already share, and it stays DOM-free so
3108
+ * the host can load it. `client/promo-badge.ts` re-exports it for the card.
3109
+ *
3110
+ * @param promo - The resolved promotion.
3111
+ * @returns The host tone to stamp on `model.badge`.
3112
+ */
3113
+ function promoBadgeTone(promo) {
3114
+ const color = promoBadgeColor(promo);
3115
+ if (color === void 0) return "neutral";
3116
+ const hex = color.replace("#", "");
3117
+ if (hex.length !== 6) return "neutral";
3118
+ const r = Number.parseInt(hex.slice(0, 2), 16);
3119
+ const g = Number.parseInt(hex.slice(2, 4), 16);
3120
+ const b = Number.parseInt(hex.slice(4, 6), 16);
3121
+ if (!Number.isFinite(r) || !Number.isFinite(g) || !Number.isFinite(b)) return "neutral";
3122
+ if (g > r + 24 && g > b + 24) return "success";
3123
+ if (b > r + 24 && b > g + 8) return "info";
3124
+ if (r > b + 24) return "warning";
3125
+ return "neutral";
3126
+ }
2977
3127
  //#endregion
2978
3128
  //#region src/busy.ts
2979
3129
  /** The upstream's enum, in the order its own bundle declares it. */
@@ -3188,6 +3338,49 @@ const CLIENT_UA = "CLI/2.63.2 CodeBuddy/2.63.2";
3188
3338
  */
3189
3339
  const PRODUCT_UA = "WorkBuddy/5.8.3 WorkBuddy/5.8.3 CLI/2.161.0";
3190
3340
  /**
3341
+ * The GLOBAL gateway's app channel: `WorkBuddy/<version>` with no CLI segment.
3342
+ *
3343
+ * This exists because the paragraph above is only true for the CN gateway.
3344
+ * Measured on the global gateway on 2026-11-06, same token, same URL, only
3345
+ * this header differing, each shape read 3–30 times with identical results:
3346
+ *
3347
+ * | User-Agent | global `/v3/config` answer |
3348
+ * | --- | --- |
3349
+ * | `WorkBuddy/5.8.3` | 23 models, 1 agent (`cli` roster of 21), |
3350
+ * | | `hy-image-3.5` + `kling-video-v3`, |
3351
+ * | | `max-model` / `hy4free` / `hy4std` present |
3352
+ * | `WorkBuddy/5.8.3 WorkBuddy/5.8.3 CLI/2.161.0` | 39 models, 14 agents, NO `cli` roster, |
3353
+ * | | `hy-image-3.5` GONE, |
3354
+ * | | `max-model` / `hy4free` / `hy4std` GONE |
3355
+ * | `CLI/2.63.2 CodeBuddy/2.63.2` | 28 models, 16 agents (`cli` roster of 26), |
3356
+ * | | `deepseek-v4.1-flash` at `x0.00` |
3357
+ *
3358
+ * So on the global gateway a trailing `CLI/…` segment selects a THIRD
3359
+ * document — the poorest of the three — while on the CN gateway that same
3360
+ * composite string is the richest one (62 models + 8 promos). The two
3361
+ * gateways genuinely disagree, which is why {@link PRODUCT_UA} must NOT be
3362
+ * "fixed" globally: doing so collapses CN from 61 models + a 17-row `cli`
3363
+ * roster down to 39 models with no roster at all (measured, same token).
3364
+ */
3365
+ const APP_CHANNEL_UA = "WorkBuddy/5.8.3";
3366
+ /**
3367
+ * The CLI channel's product identity, used to read the SECOND global document.
3368
+ *
3369
+ * Deliberately not a reference to {@link CLIENT_UA} even though the strings are
3370
+ * equal today: that constant is a CHAT contract pinned to the versions the
3371
+ * conversation-identity triple was verified against, while this one only
3372
+ * selects a catalog. A future chat-contract bump must not silently move the
3373
+ * discovery channel with it.
3374
+ *
3375
+ * Why read it at all: the plugin CHATS as the CLI agent, and the global CLI
3376
+ * document publishes eight chat models the app document does not mention —
3377
+ * `fast-model`, `balanced-model`, `primary-model`, `deepseek-v4.1-flash`,
3378
+ * `hy4-preview`, `gpt-5.5`, `gpt-5.4`, `glm-5.2`. Reading only the app
3379
+ * document hid the CLI's own `x0.00` DeepSeek row while that row answered
3380
+ * HTTP 200 over the plugin's own chat channel. See {@link mergeModelRosters}.
3381
+ */
3382
+ const CATALOG_CLI_UA = "CLI/2.63.2 CodeBuddy/2.63.2";
3383
+ /**
3191
3384
  * The app version inside {@link PRODUCT_UA}, for headers that need it alone.
3192
3385
  *
3193
3386
  * Derived from the UA instead of repeated as a literal: the `X-IDE-Version`
@@ -5797,6 +5990,72 @@ function selectCliModels(rawModels, agents, keepIds = []) {
5797
5990
  return resolved;
5798
5991
  }
5799
5992
  /**
5993
+ * Merge two rosters by model id, keeping the PRIMARY entry for every id both
5994
+ * documents publish.
5995
+ *
5996
+ * Exists because the global `/v3/config` answers a different roster per client
5997
+ * channel and NEITHER channel is a superset of the other — measured on a real
5998
+ * global account 2026-11-06:
5999
+ *
6000
+ * - desktop-only: `max-model`, `hy4free`, `hy4std`
6001
+ * - CLI-only: `fast-model`, `balanced-model`, `primary-model`,
6002
+ * `deepseek-v4.1-flash`, `hy4-preview`, `gpt-5.5`, `gpt-5.4`,
6003
+ * `glm-5.2`
6004
+ * - common (20): `deepseek-v4.1-flash-sg` is priced differently per channel
6005
+ * (desktop `x0.11`, CLI `x0.03`); the other 18 agree.
6006
+ *
6007
+ * The caller passes the CLI roster as PRIMARY because the plugin chats as the
6008
+ * CLI agent, so the CLI document is the one whose prices are actually settled
6009
+ * when a request is made. Rows only the app document carries are appended, so
6010
+ * the desktop-only `hy4free`/`hy4std` keep working — both answer HTTP 200 over
6011
+ * the CLI chat channel.
6012
+ *
6013
+ * `max-model` is appended too even though the provider rejects it for personal
6014
+ * accounts (`11133`): that veto belongs to the upstream at request time, and
6015
+ * hiding a row the user can see in the app is the defect this merge fixes.
6016
+ */
6017
+ function mergeModelRosters(primary, secondary) {
6018
+ const byId = /* @__PURE__ */ new Map();
6019
+ for (const model of primary) byId.set(model.id, model);
6020
+ const merged = [...primary];
6021
+ for (const model of secondary) {
6022
+ const existing = byId.get(model.id);
6023
+ if (existing === void 0) {
6024
+ byId.set(model.id, model);
6025
+ merged.push(model);
6026
+ continue;
6027
+ }
6028
+ /**
6029
+ * THE ID COLLIDED — and a plain id-dedup here silently deleted badges.
6030
+ *
6031
+ * `attachPromos` hangs a promotion on the MODEL OBJECT, so for a row both
6032
+ * documents publish, "which one survived" decides "does this row have a
6033
+ * badge". The two global documents are read through DIFFERENT client
6034
+ * channels: the app channel publishes `modelPromotions` / `modelTiers`, the
6035
+ * CLI channel publishes NEITHER (see the `fetchModels` docblock — reading
6036
+ * `/v3/config` as the CLI channel is the documented cause of an
6037
+ * entirely badge-less card). The caller passes the CLI roster as PRIMARY
6038
+ * because its PRICES are the settled ones, so keeping the primary row —
6039
+ * correct for prices — was also throwing away every badge the app document
6040
+ * carried for those 20 shared ids.
6041
+ *
6042
+ * So: keep the primary's fields (prices stay the CLI's) and graft on the
6043
+ * secondary's promotions when the primary has none. Merging is not
6044
+ * "pick a winner for the whole row"; these two facts are independent.
6045
+ */
6046
+ if ((existing.promos === void 0 || existing.promos.length === 0) && model.promos !== void 0 && model.promos.length > 0) {
6047
+ const index = merged.indexOf(existing);
6048
+ const grafted = {
6049
+ ...existing,
6050
+ promos: model.promos
6051
+ };
6052
+ if (index !== -1) merged[index] = grafted;
6053
+ byId.set(model.id, grafted);
6054
+ }
6055
+ }
6056
+ return merged;
6057
+ }
6058
+ /**
5800
6059
  * The roster plus the promotion badges the SAME document carries.
5801
6060
  *
5802
6061
  * `data.modelPromotions` and `data.modelTiers` sit beside `data.models` in
@@ -6138,23 +6397,59 @@ var WorkBuddyUpstreamClient = class {
6138
6397
  async fetchModels(credential, signal, keepModelIds = []) {
6139
6398
  const timeout = signal ?? AbortSignal.timeout(JSON_TIMEOUT_MS);
6140
6399
  if (regionOf(credential.domain) === "global") {
6141
- const response = await fetch(`${globalBase(credential.domain)}${GLOBAL_CONFIG_PATH}`, {
6142
- headers: {
6143
- "Authorization": `Bearer ${credential.accessToken}`,
6144
- "Accept": "application/json",
6145
- ...credential.uid === "" ? {} : { "X-User-Id": credential.uid },
6146
- ...credential.domain === "" ? {} : { "X-Domain": credential.domain },
6147
- "X-Product": "SaaS",
6148
- "X-Requested-With": "XMLHttpRequest",
6149
- "Connection": "close",
6150
- "User-Agent": PRODUCT_UA
6151
- },
6152
- signal: timeout
6153
- });
6154
- const envelope = await readEnvelope(response);
6155
- if (!response.ok || envelope.code !== 0) throw envelopeError(response.status, envelope);
6156
- const data = typeof envelope.data === "object" && envelope.data !== null ? envelope.data : {};
6157
- return withPromos(selectCliModels(data["models"], data["agents"], keepModelIds), data);
6400
+ /**
6401
+ * Read the global product configuration ONCE per client channel, then
6402
+ * merge. Both reads are the same endpoint and differ ONLY in
6403
+ * `User-Agent`, which is the header that selects the channel; both are
6404
+ * read-only GETs that spend no credits.
6405
+ *
6406
+ * Neither document is a superset of the other (see
6407
+ * {@link mergeModelRosters}), so reading one of them is what left the
6408
+ * CLI's own free `deepseek-v4.1-flash` row invisible while it was
6409
+ * perfectly usable through this plugin's chat path.
6410
+ */
6411
+ const readChannel = async (userAgent) => {
6412
+ const response = await fetch(`${globalBase(credential.domain)}${GLOBAL_CONFIG_PATH}`, {
6413
+ headers: {
6414
+ "Authorization": `Bearer ${credential.accessToken}`,
6415
+ "Accept": "application/json",
6416
+ ...credential.uid === "" ? {} : { "X-User-Id": credential.uid },
6417
+ ...credential.domain === "" ? {} : { "X-Domain": credential.domain },
6418
+ "X-Product": "SaaS",
6419
+ "X-Requested-With": "XMLHttpRequest",
6420
+ "Connection": "close",
6421
+ "User-Agent": userAgent
6422
+ },
6423
+ signal: timeout
6424
+ });
6425
+ const envelope = await readEnvelope(response);
6426
+ if (!response.ok || envelope.code !== 0) throw envelopeError(response.status, envelope);
6427
+ const data = typeof envelope.data === "object" && envelope.data !== null ? envelope.data : {};
6428
+ return withPromos(selectCliModels(data["models"], data["agents"], keepModelIds), data);
6429
+ };
6430
+ /**
6431
+ * Fail-soft in ONE direction only. If the CLI read fails the app document
6432
+ * alone is still a usable roster, so fall back to it rather than
6433
+ * disarming the provider. If the APP read fails the CLI roster is already
6434
+ * a complete answer and is returned as-is — reported through
6435
+ * `onFallback` rather than swallowed, because the desktop-only rows then
6436
+ * disappear from the picker and that is worth a log line.
6437
+ */
6438
+ let cliRoster;
6439
+ try {
6440
+ cliRoster = await readChannel(CATALOG_CLI_UA);
6441
+ } catch (error) {
6442
+ this.onFallback?.(`global CLI catalog ${GLOBAL_CONFIG_PATH} failed; using the app document only: ` + (error instanceof Error ? error.message : String(error)));
6443
+ return await readChannel(APP_CHANNEL_UA);
6444
+ }
6445
+ let appRoster;
6446
+ try {
6447
+ appRoster = await readChannel(APP_CHANNEL_UA);
6448
+ } catch (error) {
6449
+ this.onFallback?.(`global app catalog ${GLOBAL_CONFIG_PATH} failed; using the CLI document only: ` + (error instanceof Error ? error.message : String(error)));
6450
+ return cliRoster;
6451
+ }
6452
+ return mergeModelRosters(cliRoster, appRoster);
6158
6453
  }
6159
6454
  const readCatalog = async (path) => {
6160
6455
  const response = await fetch(`${chatBase(credential, this.cnBaseOf())}${path}`, {
@@ -6234,6 +6529,18 @@ var WorkBuddyUpstreamClient = class {
6234
6529
  * `/v3`,聊天目录会降级而这里不能变成一个原始异常。
6235
6530
  */
6236
6531
  async fetchMediaModels(credential, signal) {
6532
+ /**
6533
+ * The media roster is read from the APP document, so it must use that
6534
+ * document's own channel per region.
6535
+ *
6536
+ * This was a single constant, and the global read silently lost
6537
+ * `hy-image-3.5` as a result: on the global gateway {@link PRODUCT_UA}
6538
+ * answers the 39-model third document, which carries `kling-video-v3` but
6539
+ * NOT the image model — so the image tool reported "this gateway publishes
6540
+ * no image model" for an account whose app offers one. CN keeps
6541
+ * {@link PRODUCT_UA} untouched; there it is the correct app channel.
6542
+ */
6543
+ const mediaChannelUA = regionOf(credential.domain) === "global" ? APP_CHANNEL_UA : PRODUCT_UA;
6237
6544
  const readMedia = async (path) => {
6238
6545
  const response = await fetch(`${chatBase(credential, this.cnBaseOf())}${path}`, {
6239
6546
  headers: {
@@ -6241,7 +6548,7 @@ var WorkBuddyUpstreamClient = class {
6241
6548
  "Accept": "application/json",
6242
6549
  "Origin": originReferer(credential),
6243
6550
  "Referer": `${originReferer(credential)}/`,
6244
- "User-Agent": PRODUCT_UA
6551
+ "User-Agent": mediaChannelUA
6245
6552
  },
6246
6553
  signal: signal ?? AbortSignal.timeout(JSON_TIMEOUT_MS)
6247
6554
  });
@@ -10220,7 +10527,7 @@ function describeRosterSeenPayload(raw) {
10220
10527
  //#endregion
10221
10528
  //#region src/version.ts
10222
10529
  /** The npm package version this build was produced from. */
10223
- const WORKBUDDY_CONNECT_VERSION = "5.20.2";
10530
+ const WORKBUDDY_CONNECT_VERSION = "5.20.32";
10224
10531
  //#endregion
10225
10532
  //#region src/host-heartbeat.ts
10226
10533
  /**
@@ -10431,4 +10738,4 @@ async function clearHostHeartbeat() {
10431
10738
  await rm(workbuddyHostHeartbeatPath(), { force: true });
10432
10739
  }
10433
10740
  //#endregion
10434
- export { DEFAULT_WIRE_PROFILE as $, WORKBUDDY_DEVICE_TOKEN_FILE_ENV as $t, withoutRouters as A, withEffectiveOff as At, defaultDesktopAuthPath as B, WorkBuddyImageError as Bt, setDeviceMode as C, withFileLock as Cn, attachBusyLevels as Ct, applyContextBudgets as D, offDefaultFor as Dt, WorkBuddyCatalog as E, lastRefusalFor as Et, WorkBuddyCredentialStore as F, pickVideoModel as Ft, parseWorkBuddyAuth as G, pickMediaModel as Gt, isEncryptedCredentialError as H, imageMimeForPath as Ht, WorkBuddyEncryptedCredentialError as I, resolveVideoParams as It, workbuddyOwnAuthPath as J, queueNoticeText as Jt, preferredAccountName as K, sniffImageMime as Kt, authFileName as L, IMAGE_TAG_IMAGE_TO_IMAGE as Lt, WORKBUDDY_AUTH_FILENAME as M, VIDEO_TAG_TEXT_TO_VIDEO as Mt, WORKBUDDY_AUTH_FILE_ENV as N, WorkBuddyVideoError as Nt, deriveCatalog as O, offRefused as Ot, WORKBUDDY_VAULT_DIRNAME as P, parseSupportedSecondsRange as Pt, CREDENTIAL_REJECTED_CODE as Q, nativeModalityOf as Qt, defaultDesktopAuthCandidates as R, IMAGE_TAG_TEXT_TO_IMAGE as Rt, saveDeviceSdkSettings as S, resolveDshHome as Sn, rewriteSessionTitleModel as St, FALLBACK_WORKBUDDY_MODELS_GLOBAL as T, defaultOffModelIds as Tt, isVaultAccountId as U, isBareBase64Image as Ut, hasEncryptedCredentialFields as V, imageDataUrl as Vt, legacyWorkbuddyOwnAuthPath as W, parseImageDataUrl as Wt, APP_VERSION as X, NATIVE_MODALITY_BY_MODEL_ID as Xt, workbuddyVaultDir as Y, pruneTempDir as Yt, CONTEXT_OVERFLOW_MARKER as Z, imageDefaultFor as Zt, createDeviceProfileLookup as _, macosNestedAppBundles as _n, parseUpstreamModel as _t, readHostHeartbeat as a, inspectCredentialDirectory as an, declaredTools as at, readDeviceSettings as b, workbuddyAppExecutableCandidates as bn, regionOf as bt, WORKBUDDY_CONNECT_VERSION as c, clearAtRestKeyCache as cn, isContextTooLongBody as ct, rosterSeenPath as d, fetchAtRestKeyPayload as dn, isFirstMessageGateBody as dt, readDeviceTokenFile as en, WORKBUDDY_FALLBACK_SYSTEM_PROMPT as et, WORKBUDDY_CN_BASE_ENV as f, findWorkbuddyAppExecutable as fn, knownRegionOf as ft, createTuringSdk as g, macosBundleExecutable as gn, parseReasoning as gt, createDeviceSdkPort as h, isWorkbuddyBundle as hn, parseCreditMultiplier as ht, processStartTimeMs as i, isDeviceId as in, classifyUpstreamError as it, ENCRYPTED_CREDENTIAL_CODE as j, VIDEO_TAG_IMAGE_TO_VIDEO as jt, fallbackModelsFor as k, recordRefusal as kt, createFileRosterSeenStore as l, deriveAtRestKey as ln, isConversationIdGateBody as lt, piAiRuntimeInfo as m, isEncryptedFieldWrapper as mn, openingEvidenceOfBody as mt, clearHostHeartbeat as n, readDeviceSalt as nn, WorkBuddyUpstreamClient as nt, workbuddyHostHeartbeatPath as o, protectCredentialDirectory as on, describeRequestHeaderNames as ot, resolveCnGateway as p, findWorkbuddyAppExecutableWithSource as pn, modelIdOfBody as pt, workbuddyAccountId as q, parseQueueAnswer as qt, isHeartbeatProcessAlive as r, deriveDeviceId as rn, channelGateMemberOf as rt, writeHostHeartbeat as s, WORKBUDDY_APP_EXECUTABLE_ENV as sn, forceNeutralHead as st, WORKBUDDY_HOST_HEARTBEAT_FILENAME as t, ensureDeviceSalt as tn, WorkBuddyCredentialRejectedError as tt, describeRosterSeenPayload as u, deriveAtRestKeyId as un, isCredentialRejectedError as ut, describeDerivedDevices as v, openEncryptedField as vn, perturbChannelFingerprints as vt, FALLBACK_WORKBUDDY_MODELS as w, writeFileAtomic as wn, REFUSES_OFF_MODEL_IDS as wt, saveDeviceProfile as x, hostPeersInfo as xn, requestEvidenceOf as xt, isDeviceMode as y, readAtRestKey as yn, prepareChatBody as yt, defaultDesktopAuthDirs as z, MAX_INPUT_IMAGE_BYTES as zt };
10741
+ export { DEFAULT_WIRE_PROFILE as $, imageDefaultFor as $t, withoutRouters as A, offRefused as At, defaultDesktopAuthPath as B, IMAGE_TAG_TEXT_TO_IMAGE as Bt, setDeviceMode as C, hostPeersInfo as Cn, attachBusyLevels as Ct, applyContextBudgets as D, defaultOffModelIds as Dt, WorkBuddyCatalog as E, writeFileAtomic as En, REFUSES_OFF_MODEL_IDS as Et, WorkBuddyCredentialStore as F, WorkBuddyVideoError as Ft, parseWorkBuddyAuth as G, isBareBase64Image as Gt, isEncryptedCredentialError as H, WorkBuddyImageError as Ht, WorkBuddyEncryptedCredentialError as I, parseSupportedSecondsRange as It, workbuddyOwnAuthPath as J, sniffImageMime as Jt, preferredAccountName as K, parseImageDataUrl as Kt, authFileName as L, pickVideoModel as Lt, WORKBUDDY_AUTH_FILENAME as M, withEffectiveOff as Mt, WORKBUDDY_AUTH_FILE_ENV as N, VIDEO_TAG_IMAGE_TO_VIDEO as Nt, deriveCatalog as O, lastRefusalFor as Ot, WORKBUDDY_VAULT_DIRNAME as P, VIDEO_TAG_TEXT_TO_VIDEO as Pt, CREDENTIAL_REJECTED_CODE as Q, NATIVE_MODALITY_BY_MODEL_ID as Qt, defaultDesktopAuthCandidates as R, resolveVideoParams as Rt, saveDeviceSdkSettings as S, workbuddyAppExecutableCandidates as Sn, rewriteSessionTitleModel as St, FALLBACK_WORKBUDDY_MODELS_GLOBAL as T, withFileLock as Tn, selectPromoBadge as Tt, isVaultAccountId as U, imageDataUrl as Ut, hasEncryptedCredentialFields as V, MAX_INPUT_IMAGE_BYTES as Vt, legacyWorkbuddyOwnAuthPath as W, imageMimeForPath as Wt, APP_VERSION as X, queueNoticeText as Xt, workbuddyVaultDir as Y, parseQueueAnswer as Yt, CONTEXT_OVERFLOW_MARKER as Z, pruneTempDir as Zt, createDeviceProfileLookup as _, isWorkbuddyBundle as _n, parseUpstreamModel as _t, readHostHeartbeat as a, deriveDeviceId as an, declaredTools as at, readDeviceSettings as b, openEncryptedField as bn, regionOf as bt, WORKBUDDY_CONNECT_VERSION as c, protectCredentialDirectory as cn, isContextTooLongBody as ct, rosterSeenPath as d, deriveAtRestKey as dn, isFirstMessageGateBody as dt, nativeModalityOf as en, WORKBUDDY_FALLBACK_SYSTEM_PROMPT as et, WORKBUDDY_CN_BASE_ENV as f, deriveAtRestKeyId as fn, knownRegionOf as ft, createTuringSdk as g, isEncryptedFieldWrapper as gn, parseReasoning as gt, createDeviceSdkPort as h, findWorkbuddyAppExecutableWithSource as hn, parseCreditMultiplier as ht, processStartTimeMs as i, readDeviceSalt as in, classifyUpstreamError as it, ENCRYPTED_CREDENTIAL_CODE as j, recordRefusal as jt, fallbackModelsFor as k, offDefaultFor as kt, createFileRosterSeenStore as l, WORKBUDDY_APP_EXECUTABLE_ENV as ln, isConversationIdGateBody as lt, piAiRuntimeInfo as m, findWorkbuddyAppExecutable as mn, openingEvidenceOfBody as mt, clearHostHeartbeat as n, readDeviceTokenFile as nn, WorkBuddyUpstreamClient as nt, workbuddyHostHeartbeatPath as o, isDeviceId as on, describeRequestHeaderNames as ot, resolveCnGateway as p, fetchAtRestKeyPayload as pn, modelIdOfBody as pt, workbuddyAccountId as q, pickMediaModel as qt, isHeartbeatProcessAlive as r, ensureDeviceSalt as rn, channelGateMemberOf as rt, writeHostHeartbeat as s, inspectCredentialDirectory as sn, forceNeutralHead as st, WORKBUDDY_HOST_HEARTBEAT_FILENAME as t, WORKBUDDY_DEVICE_TOKEN_FILE_ENV as tn, WorkBuddyCredentialRejectedError as tt, describeRosterSeenPayload as u, clearAtRestKeyCache as un, isCredentialRejectedError as ut, describeDerivedDevices as v, macosBundleExecutable as vn, perturbChannelFingerprints as vt, FALLBACK_WORKBUDDY_MODELS as w, resolveDshHome as wn, promoBadgeTone as wt, saveDeviceProfile as x, readAtRestKey as xn, requestEvidenceOf as xt, isDeviceMode as y, macosNestedAppBundles as yn, prepareChatBody as yt, defaultDesktopAuthDirs as z, IMAGE_TAG_IMAGE_TO_IMAGE as zt };
package/lib/index.d.ts CHANGED
@@ -2779,6 +2779,18 @@ interface WorkBuddyAdapterOptions {
2779
2779
  * normally.
2780
2780
  */
2781
2781
  dropForeignThinking?: () => boolean;
2782
+ /**
2783
+ * Strip EVERY historical thinking block before the request goes out (issue #213).
2784
+ *
2785
+ * OFF by default, and this one is not a styling choice: the model loses its own
2786
+ * earlier reasoning from context, which is exactly what it was doing, so a user
2787
+ * should turn this on deliberately — typically AFTER seeing a 11128 they can match
2788
+ * to reasoning text. The reporter's evidence for that match is in #213.
2789
+ *
2790
+ * Read LIVE for the same reason `dropForeignThinking` is: the switch has to work
2791
+ * on the next turn of the session that just failed, without a reload.
2792
+ */
2793
+ dropAllThinking?: () => boolean;
2782
2794
  /**
2783
2795
  * Told which foreign thinking blocks a request dropped, so the reply can name
2784
2796
  * the condition instead of leaving the user to conclude the model broke
@@ -4130,6 +4142,7 @@ type WorkBuddyWebUsage =
4130
4142
  * "关闭不了" report.
4131
4143
  */
4132
4144
  showCreditsInMainUi?: boolean;
4145
+ showNewModelsInMainUi?: boolean;
4133
4146
  /**
4134
4147
  * Whether the model may call the image-generation tool here (opt-in).
4135
4148
  *
@@ -4283,6 +4296,12 @@ type WorkBuddyWebUsage =
4283
4296
  * settings mirror.
4284
4297
  */
4285
4298
  showCreditsInMainUi?: boolean;
4299
+ /**
4300
+ * Whether this region's composer pill shows its "· N 新模型" segment
4301
+ * (opt-IN; absent means off). See the signed-out variant above for why
4302
+ * this travels on the Host's answer rather than the settings mirror.
4303
+ */
4304
+ showNewModelsInMainUi?: boolean;
4286
4305
  /**
4287
4306
  * Whether the model may call the image-generation tool here (opt-in).
4288
4307
  *
@@ -5002,6 +5021,14 @@ interface WorkBuddyStatusRouteOptions {
5002
5021
  * absent reads as ON, matching the schema's `default(true)`.
5003
5022
  */
5004
5023
  showCreditsInMainUi?(region: WorkBuddyRegion): boolean;
5024
+ /**
5025
+ * Whether the composer pill shows its "· N 新模型" segment (opt-IN).
5026
+ *
5027
+ * Optional, and ABSENT reads as OFF — the opposite of the two switches above,
5028
+ * and deliberately so: this one is opt-in, so a Host too old to answer must
5029
+ * not be read as consent. Same reasoning as `imageToolEnabled`.
5030
+ */
5031
+ showNewModelsInMainUi?(region: WorkBuddyRegion): boolean;
5005
5032
  /**
5006
5033
  * WHERE this region's credit readout sits (issue #62).
5007
5034
  *
@@ -5091,6 +5118,14 @@ interface WorkBuddyStatusRouteOptions {
5091
5118
  * so a Host that cannot answer must not be read as consent.
5092
5119
  */
5093
5120
  dropForeignThinking?(): boolean;
5121
+ /**
5122
+ * Whether the request path redacts EVERY historical thinking block (issue #213).
5123
+ *
5124
+ * Optional, absent reads as OFF for the same reason as the switch above: this
5125
+ * removes text the model would otherwise see about its own earlier work, so a
5126
+ * Host that cannot answer must not be read as consent.
5127
+ */
5128
+ dropAllThinking?(): boolean;
5094
5129
  /**
5095
5130
  * What the LAST request had to drop, for the card's explanation of a turn that
5096
5131
  * arrived looking like working notes (issue #147).
@@ -5585,6 +5620,13 @@ interface WorkBuddyRegionState {
5585
5620
  * written before this switch existed keeps whatever the default was.
5586
5621
  */
5587
5622
  showCreditsInMainUi?: boolean;
5623
+ /**
5624
+ * Whether the composer pill shows its "· N 新模型" segment (opt-IN).
5625
+ *
5626
+ * Absent means OFF: "new" means first seen by this machine, so on a fresh
5627
+ * install the whole roster qualifies and the number means nothing.
5628
+ */
5629
+ showNewModelsInMainUi?: boolean;
5588
5630
  /**
5589
5631
  * Whether the model may call the image-generation tool here (opt-IN).
5590
5632
  *
@@ -5974,6 +6016,15 @@ interface Config {
5974
6016
  * opt-in on the same rule as {@link Config.usageIdentity}.
5975
6017
  */
5976
6018
  dropForeignThinking?: boolean;
6019
+ /**
6020
+ * Strip every historical thinking block from the request (issue #213).
6021
+ *
6022
+ * A reasoning REDACTION rather than a repair: the channel gate scans the text
6023
+ * we send, and past reasoning rides along as `reasoning_content` whenever a
6024
+ * block carries a signature. Costs the model its own earlier reasoning, so it
6025
+ * is off unless the user says otherwise.
6026
+ */
6027
+ dropAllThinking?: boolean;
5977
6028
  /**
5978
6029
  * Move the host's session-title request onto the hidden lightweight model
5979
6030
  * (issues #132/#133). Off by default: it is a real upstream request either