dsh-workbuddy-bridge 0.5.8 → 0.5.9

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/lib/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { C as variantFor, D as WorkBuddyUpstreamClient, Q as resolveAppVersion, S as WORKBUDDY_VARIANTS, a as readHostHeartbeat, c as WORKBUDDY_BRIDGE_VERSION, l as FALLBACK_WORKBUDDY_AI_MODELS, m as WorkBuddyCredentialStore, o as workbuddyHostHeartbeatPath, r as isHeartbeatProcessAlive, u as FALLBACK_WORKBUDDY_MODELS, x as CN_VARIANT } from "./heartbeat-CaRoYefq.js";
2
+ import { C as variantFor, D as WorkBuddyUpstreamClient, Q as resolveAppVersion, S as WORKBUDDY_VARIANTS, a as readHostHeartbeat, c as WORKBUDDY_BRIDGE_VERSION, l as FALLBACK_WORKBUDDY_AI_MODELS, m as WorkBuddyCredentialStore, o as workbuddyHostHeartbeatPath, r as isHeartbeatProcessAlive, u as FALLBACK_WORKBUDDY_MODELS, x as CN_VARIANT } from "./heartbeat-36zt0_g0.js";
3
3
  import { realpathSync } from "node:fs";
4
4
  import { fileURLToPath } from "node:url";
5
5
  //#region src/cli/bin.ts
@@ -2070,25 +2070,33 @@ const WORKBUDDY_ELECTRON_BIN_ENV = "WORKBUDDY_ELECTRON_BIN";
2070
2070
  /** Platform-default Electron binary, confirmed only on macOS (5.6.2). */
2071
2071
  const MACOS_ELECTRON_PATH = "/Applications/WorkBuddy.app/Contents/MacOS/Electron";
2072
2072
  /**
2073
- * The Windows install locations probed in order, confirmed on WorkBuddy 5.6.2.
2073
+ * The Electron runtime each Windows installer ships, keyed by product.
2074
2074
  *
2075
- * The app ships the Electron runtime as `WorkBuddy.exe` beside its `resources/`
2076
- * and `locales/` directories — there is no `Electron.exe`, and the launcher is
2077
- * the runtime itself (it honours `ELECTRON_RUN_AS_NODE`, which is what the key
2078
- * helper relies on).
2075
+ * Both are the runtime itself — there is no `Electron.exe`, and the launcher is
2076
+ * the runtime (it honours `ELECTRON_RUN_AS_NODE`, which is what the key helper
2077
+ * relies on).
2079
2078
  *
2080
- * The default location is `%LOCALAPPDATA%\Programs\WorkBuddy`, but the 5.6.2
2081
- * installer here put it at the drive root (`E:\WorkBuddy`), so the registry's
2082
- * `DisplayIcon` is consulted as well — see {@link windowsElectronCandidates}.
2079
+ * The Global app is `WorkBuddyAI.exe` inside `Programs\\WorkBuddyAI` — no space,
2080
+ * and *not* `Programs\\WorkBuddy`, which is the CN layout. Verified against
2081
+ * WorkBuddy AI 5.11.4; the CN name is the 5.6.2 one.
2083
2082
  */
2084
- /** The Electron runtime as the Windows installer ships it — there is no `Electron.exe`. */
2085
- const WINDOWS_ELECTRON_FILENAME = "WorkBuddy.exe";
2086
- /** Where the 5.6.2 installer puts the app unless the user picks another drive. */
2087
- const WINDOWS_LOCAL_PROGRAM_SUFFIX = [
2088
- "Programs",
2089
- "WorkBuddy",
2090
- WINDOWS_ELECTRON_FILENAME
2091
- ];
2083
+ const WINDOWS_ELECTRON_FILENAME = {
2084
+ cn: "WorkBuddy.exe",
2085
+ ai: "WorkBuddyAI.exe"
2086
+ };
2087
+ /** Where each Windows installer puts the app unless the user picks another drive. */
2088
+ const WINDOWS_LOCAL_PROGRAM_SUFFIX = {
2089
+ cn: [
2090
+ "Programs",
2091
+ "WorkBuddy",
2092
+ "WorkBuddy.exe"
2093
+ ],
2094
+ ai: [
2095
+ "Programs",
2096
+ "WorkBuddyAI",
2097
+ "WorkBuddyAI.exe"
2098
+ ]
2099
+ };
2092
2100
  /**
2093
2101
  * The Electron binary one discovery strategy expects at its default location, or
2094
2102
  * `undefined` where that strategy has no verified layout on this platform.
@@ -2103,11 +2111,11 @@ const WINDOWS_LOCAL_PROGRAM_SUFFIX = [
2103
2111
  * {@link WORKBUDDY_ELECTRON_BIN_ENV} explicitly — guessing would spawn the wrong
2104
2112
  * app's binary.
2105
2113
  */
2106
- function defaultWorkBuddyElectronPath(discovery = "none") {
2114
+ function defaultWorkBuddyElectronPath(discovery = "none", product = "cn") {
2107
2115
  if (discovery === "macos-workbuddy" && process.platform === "darwin") return MACOS_ELECTRON_PATH;
2108
2116
  if (discovery === "windows-workbuddy" && process.platform === "win32") {
2109
2117
  const localAppData = process.env["LOCALAPPDATA"]?.trim();
2110
- if (localAppData !== void 0 && localAppData !== "") return join(localAppData, ...WINDOWS_LOCAL_PROGRAM_SUFFIX);
2118
+ if (localAppData !== void 0 && localAppData !== "") return join(localAppData, ...WINDOWS_LOCAL_PROGRAM_SUFFIX[product]);
2111
2119
  }
2112
2120
  }
2113
2121
  /** Distinct key ids across the wrapped fields, in field order. */
@@ -2302,6 +2310,21 @@ function cnAppDiscovery() {
2302
2310
  if (process.platform === "win32") return "windows-workbuddy";
2303
2311
  return "none";
2304
2312
  }
2313
+ /**
2314
+ * The strategy the Global (WorkBuddy AI) app may use on this platform.
2315
+ *
2316
+ * Windows only, and deliberately narrower than {@link cnAppDiscovery}: the
2317
+ * Uninstall registration names the product, so a Global search can prove it is
2318
+ * looking at the Global install instead of borrowing the CN one. The macOS
2319
+ * lookup is a Spotlight search for the *CN* bundle id, which has no verified
2320
+ * Global counterpart — a Global provider keeps `'none'` there rather than
2321
+ * executing the other product's binary. An explicit `WORKBUDDY_ELECTRON_BIN`
2322
+ * still works on every platform.
2323
+ */
2324
+ function aiAppDiscovery() {
2325
+ if (process.platform === "win32") return "windows-workbuddy";
2326
+ return "none";
2327
+ }
2305
2328
  /** The CN app's bundle id; the only one this round resolves by discovery. */
2306
2329
  const WORKBUDDY_CN_BUNDLE_ID = "com.tencent.workbuddy.mac";
2307
2330
  /** Absolute tool paths: never resolved through PATH, which a user can change. */
@@ -2329,6 +2352,25 @@ const WINDOWS_UNINSTALL_HIVES = [
2329
2352
  /** Three hives' worth of matching entries is far smaller than this. */
2330
2353
  const WINDOWS_REGISTRY_MAX_OUTPUT_BYTES = 262144;
2331
2354
  /**
2355
+ * Whether a registration's `DisplayName` belongs to the product being searched.
2356
+ *
2357
+ * The two products register as `WorkBuddy <version>` and `WorkBuddy AI <version>`
2358
+ * on the same machine, so the CN prefix match would also accept the Global entry
2359
+ * — and then `join(root, 'WorkBuddy.exe')` would simply miss, turning a
2360
+ * *decidable* "wrong product" into a misleading "not installed". Matching the
2361
+ * product exactly keeps each variant's answer about its own app.
2362
+ *
2363
+ * A name that carries a trailing qualifier is not the app: "WorkBuddy AI Helper"
2364
+ * and "WorkBuddyUninstall" both fail the version/end boundary, so a component of
2365
+ * the product can never be read as the product itself.
2366
+ */
2367
+ function matchesProduct(displayName, product) {
2368
+ const appName = product === "ai" ? "WorkBuddy AI" : "WorkBuddy";
2369
+ if (!displayName.startsWith(appName)) return false;
2370
+ const rest = displayName.slice(appName.length);
2371
+ return rest === "" || /^\s+\d/u.test(rest);
2372
+ }
2373
+ /**
2332
2374
  * Install directories named by one `reg query` dump, in listing order.
2333
2375
  *
2334
2376
  * `reg query <hive> /s /f WorkBuddy` prints one block per matching key: a
@@ -2346,13 +2388,13 @@ const WINDOWS_REGISTRY_MAX_OUTPUT_BYTES = 262144;
2346
2388
  * Exported for tests: the flow's whole decision surface is here, so it can be
2347
2389
  * exercised without running `reg.exe`.
2348
2390
  */
2349
- function windowsInstallsFromRegistry(output) {
2391
+ function windowsInstallsFromRegistry(output, product = "cn") {
2350
2392
  const roots = [];
2351
2393
  let name;
2352
2394
  let icon;
2353
2395
  let location;
2354
2396
  const flush = () => {
2355
- if (name !== void 0 && /^WorkBuddy\b/u.test(name)) {
2397
+ if (name !== void 0 && matchesProduct(name, product)) {
2356
2398
  const root = iconRootOf(icon) ?? locationRootOf(location);
2357
2399
  if (root !== void 0 && !roots.includes(root)) roots.push(root);
2358
2400
  }
@@ -2422,7 +2464,7 @@ function locationRootOf(value) {
2422
2464
  * read as "not installed". A hive that simply holds no WorkBuddy entry is a
2423
2465
  * normal empty result: `reg` reports that with exit code 1 and empty stdout.
2424
2466
  */
2425
- function workBuddyWindowsDiscoveryTools() {
2467
+ function workBuddyWindowsDiscoveryTools(product = "cn") {
2426
2468
  return { findInstallRoots: async (signal) => {
2427
2469
  const found = [];
2428
2470
  for (const hive of WINDOWS_UNINSTALL_HIVES) {
@@ -2450,7 +2492,7 @@ function workBuddyWindowsDiscoveryTools() {
2450
2492
  reject(new DiscoveryIncompleteError(`the Windows registry query for ${hive} could not complete (${error.killed === true ? "timed out" : String(error.code)})`));
2451
2493
  });
2452
2494
  });
2453
- found.push(...windowsInstallsFromRegistry(output));
2495
+ found.push(...windowsInstallsFromRegistry(output, product));
2454
2496
  }
2455
2497
  return found;
2456
2498
  } };
@@ -2540,6 +2582,7 @@ function workBuddyDiscoveryTools() {
2540
2582
  explicitPath;
2541
2583
  defaultPath;
2542
2584
  discovery;
2585
+ product;
2543
2586
  tools;
2544
2587
  /** Explicit `tools` means the caller owns the platform question (tests, custom hosts). */
2545
2588
  toolsAreInjected;
@@ -2563,10 +2606,11 @@ function workBuddyDiscoveryTools() {
2563
2606
  const envPath = fromEnv === void 0 || fromEnv === "" ? void 0 : fromEnv;
2564
2607
  this.explicitPath = options.electronPath ?? envPath;
2565
2608
  this.discovery = options.discovery ?? "none";
2566
- this.defaultPath = options.defaultElectronPath === void 0 ? defaultWorkBuddyElectronPath(this.discovery) : options.defaultElectronPath ?? void 0;
2609
+ this.product = options.product ?? "cn";
2610
+ this.defaultPath = options.defaultElectronPath === void 0 ? defaultWorkBuddyElectronPath(this.discovery, this.product) : options.defaultElectronPath ?? void 0;
2567
2611
  this.tools = options.tools ?? workBuddyDiscoveryTools();
2568
2612
  this.toolsAreInjected = options.tools !== void 0;
2569
- this.windowsTools = options.windowsTools ?? workBuddyWindowsDiscoveryTools();
2613
+ this.windowsTools = options.windowsTools ?? workBuddyWindowsDiscoveryTools(this.product);
2570
2614
  this.windowsToolsAreInjected = options.windowsTools !== void 0;
2571
2615
  this.discoveryBudgetMs = options.discoveryBudgetMs ?? 1e4;
2572
2616
  this.timeoutMs = options.timeoutMs ?? 1e4;
@@ -2710,14 +2754,19 @@ function workBuddyDiscoveryTools() {
2710
2754
  }
2711
2755
  }
2712
2756
  /**
2713
- * Resolve the CN app from its Windows registration.
2757
+ * Resolve this provider's product from its Windows registration.
2714
2758
  *
2715
2759
  * There is no second identity check as on macOS: the registration *is* the
2716
2760
  * identity — {@link windowsInstallsFromRegistry} only accepts blocks whose
2717
- * `DisplayName` starts with `WorkBuddy` — and the executable is a fixed name
2761
+ * `DisplayName` names this product — and the executable is a fixed name
2718
2762
  * inside the registered directory. A registered directory that no longer holds
2719
2763
  * an executable is a decidable exclusion, the same way a Spotlight row for a
2720
2764
  * deleted app is.
2765
+ *
2766
+ * Both products may be installed side by side and register under the same
2767
+ * `WorkBuddy` stem, so the registry query results are filtered by product
2768
+ * before the executable is looked for: otherwise the Global app's directory
2769
+ * would be probed for a CN executable and read as "not installed".
2721
2770
  */
2722
2771
  async discoverWindowsApp() {
2723
2772
  if (process.platform !== "win32" && !this.windowsToolsAreInjected) throw new WorkBuddyElectronPathError("electron-binary-unavailable", `no WorkBuddy Electron binary is configured for this platform; set ${WORKBUDDY_ELECTRON_BIN_ENV} to the app's Electron binary`);
@@ -2732,7 +2781,7 @@ function workBuddyDiscoveryTools() {
2732
2781
  }
2733
2782
  const seen = /* @__PURE__ */ new Map();
2734
2783
  for (const root of roots) {
2735
- const electronPath = join(root, WINDOWS_ELECTRON_FILENAME);
2784
+ const electronPath = join(root, WINDOWS_ELECTRON_FILENAME[this.product]);
2736
2785
  if (!isExecutable(electronPath)) continue;
2737
2786
  let identity;
2738
2787
  try {
@@ -3118,24 +3167,40 @@ function isENOENT(error) {
3118
3167
  * (2026-10-03, found by the release checklist). The store knows its variant, so
3119
3168
  * the choice belongs here.
3120
3169
  *
3121
- * Why the difference is deliberate:
3170
+ * Why the two products are treated differently:
3122
3171
  *
3123
- * - Only the CN WorkBuddy install has been verified to hold the key its envelopes
3124
- * name, and only its macOS/Windows layout is known, so CN may look for the app.
3125
- * - A Global (WorkBuddy AI) encrypted credential has never been seen live, so that
3126
- * variant runs at `'none'` — no default path and no app search. A Global unlock
3127
- * must not silently execute the *CN* app's Electron. An explicit
3128
- * `WORKBUDDY_ELECTRON_BIN` still works for Global.
3172
+ * - CN may use every verified strategy: its macOS bundle id and its Windows
3173
+ * Uninstall registration are both known.
3174
+ * - Global (WorkBuddy AI) gets `aiAppDiscovery()`: Windows only, because the
3175
+ * Uninstall registration names the product and can therefore prove it found
3176
+ * the Global install. Its credential *is* the same encrypted-envelope format —
3177
+ * verified against WorkBuddy AI 5.11.4, whose envelopes name the same key id
3178
+ * the CN install resolves to — so it must be openable, but the search must
3179
+ * still be answerable per product. The macOS Spotlight lookup is a CN bundle-id
3180
+ * search with no verified Global counterpart, so it stays `'none'` there: a
3181
+ * Global unlock must not silently execute the *CN* app's Electron.
3129
3182
  *
3130
3183
  * **No variant** means the CN product's own default file —
3131
3184
  * `defaultDesktopAuthCandidates()` is the `workbuddy-desktop.info` path, never the
3132
3185
  * AI one — so it gets the same discovery CN does.
3133
3186
  *
3187
+ * An explicit `WORKBUDDY_ELECTRON_BIN` still overrides every strategy.
3188
+ *
3134
3189
  * A keyId mismatch is still reported as a diagnosis rather than a wrong open, and
3135
3190
  * the helper only runs if an encrypted credential is actually read.
3136
3191
  */
3137
3192
  function atRestDiscoveryFor(variant) {
3138
- return variant === void 0 || variant.id === CN_VARIANT.id ? cnAppDiscovery() : "none";
3193
+ if (variant === void 0 || variant.id === CN_VARIANT.id) return cnAppDiscovery();
3194
+ return aiAppDiscovery();
3195
+ }
3196
+ /**
3197
+ * Which product a variant's key discovery must look for on Windows.
3198
+ *
3199
+ * Everything unknown is read as CN: that is the product whose default auth file
3200
+ * `defaultDesktopAuthCandidates()` already names, so the two answers agree.
3201
+ */
3202
+ function atRestProductFor(variant) {
3203
+ return variant !== void 0 && variant.id === AI_VARIANT.id ? "ai" : "cn";
3139
3204
  }
3140
3205
  /**
3141
3206
  * Read-only credential store with demand-driven refresh.
@@ -3159,7 +3224,10 @@ var WorkBuddyCredentialStore = class {
3159
3224
  this.refresh = options.refresh;
3160
3225
  this.refreshMarginMs = options.refreshMarginMs ?? 3e5;
3161
3226
  this.ownPath = options.ownPath ?? (options.variant ? join(resolveDshHome(), options.variant.ownFilename) : workbuddyOwnAuthPath());
3162
- this.keyProvider = options.keyProvider ?? new WorkBuddyAtRestKeyProvider({ discovery: atRestDiscoveryFor(options.variant) });
3227
+ this.keyProvider = options.keyProvider ?? new WorkBuddyAtRestKeyProvider({
3228
+ discovery: atRestDiscoveryFor(options.variant),
3229
+ product: atRestProductFor(options.variant)
3230
+ });
3163
3231
  this.desktopPathOverride = options.desktopPath;
3164
3232
  }
3165
3233
  /**
@@ -4165,7 +4233,7 @@ var WorkBuddyCatalog = class {
4165
4233
  };
4166
4234
  //#endregion
4167
4235
  //#region src/version.ts
4168
- const WORKBUDDY_BRIDGE_VERSION = "0.5.8";
4236
+ const WORKBUDDY_BRIDGE_VERSION = "0.5.9";
4169
4237
  //#endregion
4170
4238
  //#region src/web/heartbeat.ts
4171
4239
  /**
package/lib/index.d.ts CHANGED
@@ -75,6 +75,27 @@ type WorkBuddySignedOutReasonCode =
75
75
  //#region src/credential/at-rest.d.ts
76
76
  /** The four states a desktop auth document can be read as. */
77
77
  type DesktopAuthFormat = 'absent' | 'plaintext' | 'encrypted' | 'unrecognized';
78
+ /**
79
+ * The Windows install locations probed in order, confirmed on WorkBuddy 5.6.2.
80
+ *
81
+ * The app ships the Electron runtime as `WorkBuddy.exe` beside its `resources/`
82
+ * and `locales/` directories — there is no `Electron.exe`, and the launcher is
83
+ * the runtime itself (it honours `ELECTRON_RUN_AS_NODE`, which is what the key
84
+ * helper relies on).
85
+ *
86
+ * The default location is `%LOCALAPPDATA%\Programs\WorkBuddy`, but the 5.6.2
87
+ * installer here put it at the drive root (`E:\WorkBuddy`), so the registry's
88
+ * `DisplayIcon` is consulted as well — see {@link windowsElectronCandidates}.
89
+ */
90
+ /**
91
+ * Which WorkBuddy product a Windows discovery pass is looking for.
92
+ *
93
+ * The two products are separate installs with separate directory names and
94
+ * separate executable names, so "the WorkBuddy app" is ambiguous on a machine
95
+ * that has both. Discovery therefore runs *per product*: it never falls back
96
+ * from one to the other, because a CN binary can only answer for CN envelopes.
97
+ */
98
+ type WorkBuddyElectronProduct = 'cn' | 'ai';
78
99
  /** The spawned helper. Separated from the provider so tests can stand it in. */
79
100
  type WorkBuddyKeyPayloadSource = () => Promise<string>;
80
101
  /**
@@ -133,6 +154,14 @@ interface WorkBuddyAtRestKeyProviderOptions {
133
154
  * composition root, never inferred from the environment.
134
155
  */
135
156
  discovery?: WorkBuddyElectronDiscovery;
157
+ /**
158
+ * Which product this provider serves, for the Windows layout and registry
159
+ * identity. Defaults to `'cn'` — the product every earlier release served —
160
+ * so an existing caller that says nothing keeps its behaviour. A Global
161
+ * (WorkBuddy AI) provider must pass `'ai'`: the two installs have different
162
+ * directory and executable names, and the CN executable cannot stand in.
163
+ */
164
+ product?: WorkBuddyElectronProduct;
136
165
  /**
137
166
  * Platform default binary, consulted only when `discovery` is enabled and no
138
167
  * explicit path is configured. Injectable so tests can force the fallback
@@ -174,6 +203,7 @@ interface WorkBuddyWindowsDiscoveryTools {
174
203
  private readonly explicitPath;
175
204
  private readonly defaultPath;
176
205
  private readonly discovery;
206
+ private readonly product;
177
207
  private readonly tools;
178
208
  /** Explicit `tools` means the caller owns the platform question (tests, custom hosts). */
179
209
  private readonly toolsAreInjected;
@@ -230,14 +260,19 @@ interface WorkBuddyWindowsDiscoveryTools {
230
260
  */
231
261
  private discoverMacosApp;
232
262
  /**
233
- * Resolve the CN app from its Windows registration.
263
+ * Resolve this provider's product from its Windows registration.
234
264
  *
235
265
  * There is no second identity check as on macOS: the registration *is* the
236
266
  * identity — {@link windowsInstallsFromRegistry} only accepts blocks whose
237
- * `DisplayName` starts with `WorkBuddy` — and the executable is a fixed name
267
+ * `DisplayName` names this product — and the executable is a fixed name
238
268
  * inside the registered directory. A registered directory that no longer holds
239
269
  * an executable is a decidable exclusion, the same way a Spotlight row for a
240
270
  * deleted app is.
271
+ *
272
+ * Both products may be installed side by side and register under the same
273
+ * `WorkBuddy` stem, so the registry query results are filtered by product
274
+ * before the executable is looked for: otherwise the Global app's directory
275
+ * would be probed for a CN executable and read as "not installed".
241
276
  */
242
277
  private discoverWindowsApp;
243
278
  private spawnPayload;
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as validAppVersion, A as modelWithCurrentPromotion, B as upstreamDisplayMessage, C as variantFor, D as WorkBuddyUpstreamClient, F as regionOf, G as readCliVersion, H as FALLBACK_CN_APP_VERSION, I as PROBE_EFFORT_CANDIDATES, J as WORKBUDDY_APP_VERSION_FILENAME, K as resolveChatIdentity, L as probeModel, M as parseModelCatalog, N as prepareChatBody, O as isChannelGateBody, P as prepareInternationalChatBody, Q as resolveAppVersion, R as randomSentinel, S as WORKBUDDY_VARIANTS, U as chatUserAgent, V as CN_APP_VERSION_FILENAME, W as fallbackChatIdentity, X as installedAppVersion, Y as appUserAgent, Z as readBundleVersion, _ as desktopAuthCandidatesFor, a as readHostHeartbeat, b as AI_VARIANT, c as WORKBUDDY_BRIDGE_VERSION, d as WorkBuddyCatalog, f as WORKBUDDY_AUTH_FILENAME, g as defaultDesktopAuthPath, h as defaultDesktopAuthCandidates, i as processStartTimeMs, j as normalizeCredits, k as isPlanLimitBody, l as FALLBACK_WORKBUDDY_AI_MODELS, m as WorkBuddyCredentialStore, n as clearHostHeartbeat, o as workbuddyHostHeartbeatPath, p as WORKBUDDY_AUTH_FILE_ENV, q as validCliVersion, r as isHeartbeatProcessAlive, s as writeHostHeartbeat, t as WORKBUDDY_HOST_HEARTBEAT_FILENAME, u as FALLBACK_WORKBUDDY_MODELS, v as parseWorkBuddyAuth, w as WORKBUDDY_CREDIT_PATH, x as CN_VARIANT, y as workbuddyOwnAuthPath, z as classifyUpstreamError } from "./heartbeat-CaRoYefq.js";
1
+ import { $ as validAppVersion, A as modelWithCurrentPromotion, B as upstreamDisplayMessage, C as variantFor, D as WorkBuddyUpstreamClient, F as regionOf, G as readCliVersion, H as FALLBACK_CN_APP_VERSION, I as PROBE_EFFORT_CANDIDATES, J as WORKBUDDY_APP_VERSION_FILENAME, K as resolveChatIdentity, L as probeModel, M as parseModelCatalog, N as prepareChatBody, O as isChannelGateBody, P as prepareInternationalChatBody, Q as resolveAppVersion, R as randomSentinel, S as WORKBUDDY_VARIANTS, U as chatUserAgent, V as CN_APP_VERSION_FILENAME, W as fallbackChatIdentity, X as installedAppVersion, Y as appUserAgent, Z as readBundleVersion, _ as desktopAuthCandidatesFor, a as readHostHeartbeat, b as AI_VARIANT, c as WORKBUDDY_BRIDGE_VERSION, d as WorkBuddyCatalog, f as WORKBUDDY_AUTH_FILENAME, g as defaultDesktopAuthPath, h as defaultDesktopAuthCandidates, i as processStartTimeMs, j as normalizeCredits, k as isPlanLimitBody, l as FALLBACK_WORKBUDDY_AI_MODELS, m as WorkBuddyCredentialStore, n as clearHostHeartbeat, o as workbuddyHostHeartbeatPath, p as WORKBUDDY_AUTH_FILE_ENV, q as validCliVersion, r as isHeartbeatProcessAlive, s as writeHostHeartbeat, t as WORKBUDDY_HOST_HEARTBEAT_FILENAME, u as FALLBACK_WORKBUDDY_MODELS, v as parseWorkBuddyAuth, w as WORKBUDDY_CREDIT_PATH, x as CN_VARIANT, y as workbuddyOwnAuthPath, z as classifyUpstreamError } from "./heartbeat-36zt0_g0.js";
2
2
  import z from "@deepseek-ai/schemastery";
3
3
  import { dirname, join, resolve } from "node:path";
4
4
  import { resolveDshHome } from "@deepseek-ai/dsh-home-paths";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "dsh-workbuddy-bridge",
3
3
  "displayName": "DSH WorkBuddy Bridge",
4
4
  "description": "将 WorkBuddy 桌面 App 包含的模型自动接入 DeepSeek Harness — bring WorkBuddy desktop app models into DeepSeek Harness with zero configuration.",
5
- "version": "0.5.8",
5
+ "version": "0.5.9",
6
6
  "author": "zlZayn",
7
7
  "keywords": [
8
8
  "dsh",
@@ -11,12 +11,14 @@
11
11
  "workbuddy",
12
12
  "models",
13
13
  "llm",
14
- "bridge"
14
+ "bridge",
15
+ "model-provider",
16
+ "gateway"
15
17
  ],
16
18
  "type": "module",
17
19
  "engines": {
18
20
  "node": "^22.19.0 || >=24.0.0",
19
- "dsh": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1"
21
+ "dsh": "^0.2.2-rc.3"
20
22
  },
21
23
  "icon": "./icon.svg",
22
24
  "main": "lib/index.js",
@@ -74,54 +76,54 @@
74
76
  }
75
77
  },
76
78
  "peerDependencies": {
77
- "@deepseek-ai/cordis": "^4.0.4",
78
- "@deepseek-ai/dsh-api-remotes": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
79
- "@deepseek-ai/dsh-atomic-write": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
80
- "@deepseek-ai/dsh-attachment": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
81
- "@deepseek-ai/dsh-client-locale": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
82
- "@deepseek-ai/dsh-client-store": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
83
- "@deepseek-ai/dsh-client-ui-chat": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
84
- "@deepseek-ai/dsh-client-ui-plugin-manager": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
85
- "@deepseek-ai/dsh-client-ui-primitives": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
86
- "@deepseek-ai/dsh-client-ui-renderer": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
87
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
88
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
89
- "@deepseek-ai/dsh-home-paths": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
90
- "@deepseek-ai/dsh-host-webserver": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
91
- "@deepseek-ai/dsh-llm": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
92
- "@deepseek-ai/dsh-llm-pi-ai": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
93
- "@deepseek-ai/dsh-session": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
94
- "@deepseek-ai/dsh-settings": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
95
- "@deepseek-ai/schemastery": "^3.18.4",
79
+ "@deepseek-ai/cordis": "^4.1.0",
80
+ "@deepseek-ai/dsh-api-remotes": "^0.2.2-rc.3",
81
+ "@deepseek-ai/dsh-atomic-write": "^0.2.2-rc.3",
82
+ "@deepseek-ai/dsh-attachment": "^0.2.2-rc.3",
83
+ "@deepseek-ai/dsh-client-locale": "^0.2.2-rc.3",
84
+ "@deepseek-ai/dsh-client-store": "^0.2.2-rc.3",
85
+ "@deepseek-ai/dsh-client-ui-chat": "^0.2.2-rc.3",
86
+ "@deepseek-ai/dsh-client-ui-plugin-manager": "^0.2.2-rc.3",
87
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.2.2-rc.3",
88
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.3",
89
+ "@deepseek-ai/dsh-client-ui-settings": "^0.2.2-rc.3",
90
+ "@deepseek-ai/dsh-client-ui-slots": "^0.2.2-rc.3",
91
+ "@deepseek-ai/dsh-home-paths": "^0.2.2-rc.3",
92
+ "@deepseek-ai/dsh-host-webserver": "^0.2.2-rc.3",
93
+ "@deepseek-ai/dsh-llm": "^0.2.2-rc.3",
94
+ "@deepseek-ai/dsh-llm-pi-ai": "^0.2.2-rc.3",
95
+ "@deepseek-ai/dsh-session": "^0.2.2-rc.3",
96
+ "@deepseek-ai/dsh-settings": "^0.2.2-rc.3",
97
+ "@deepseek-ai/schemastery": "^3.19.0",
96
98
  "@earendil-works/pi-ai": "^1.1.0",
97
99
  "react": "^18.2.0",
98
100
  "react-dom": "^18.2.0"
99
101
  },
100
102
  "devDependencies": {
101
- "@deepseek-ai/cordis": "^4.0.4",
102
- "@deepseek-ai/dsh-api-remotes": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
103
- "@deepseek-ai/dsh-atomic-write": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
104
- "@deepseek-ai/dsh-attachment": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
105
- "@deepseek-ai/dsh-client-locale": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
106
- "@deepseek-ai/dsh-client-store": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
107
- "@deepseek-ai/dsh-client-ui-chat": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
108
- "@deepseek-ai/dsh-client-ui-conversation": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
109
- "@deepseek-ai/dsh-client-ui-model-selection": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
110
- "@deepseek-ai/dsh-client-ui-plugin-manager": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
111
- "@deepseek-ai/dsh-client-ui-primitives": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
112
- "@deepseek-ai/dsh-client-ui-renderer": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
113
- "@deepseek-ai/dsh-client-ui-session": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
114
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
115
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
116
- "@deepseek-ai/dsh-home-paths": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
117
- "@deepseek-ai/dsh-host-webserver": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
118
- "@deepseek-ai/dsh-llm": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
119
- "@deepseek-ai/dsh-llm-pi-ai": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
120
- "@deepseek-ai/dsh-session": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
121
- "@deepseek-ai/dsh-settings": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
122
- "@deepseek-ai/dsh-util-code-language": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
123
- "@deepseek-ai/dsh-util-workspace-path": "^0.1.7-rc.1 || ^0.2.0-rc.1 || ^0.2.1-rc.1 || ^0.2.2-rc.1",
124
- "@deepseek-ai/schemastery": "^3.18.4",
103
+ "@deepseek-ai/cordis": "^4.1.0",
104
+ "@deepseek-ai/dsh-api-remotes": "^0.2.2-rc.3",
105
+ "@deepseek-ai/dsh-atomic-write": "^0.2.2-rc.3",
106
+ "@deepseek-ai/dsh-attachment": "^0.2.2-rc.3",
107
+ "@deepseek-ai/dsh-client-locale": "^0.2.2-rc.3",
108
+ "@deepseek-ai/dsh-client-store": "^0.2.2-rc.3",
109
+ "@deepseek-ai/dsh-client-ui-chat": "^0.2.2-rc.3",
110
+ "@deepseek-ai/dsh-client-ui-conversation": "^0.2.2-rc.3",
111
+ "@deepseek-ai/dsh-client-ui-model-selection": "^0.2.2-rc.3",
112
+ "@deepseek-ai/dsh-client-ui-plugin-manager": "^0.2.2-rc.3",
113
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.2.2-rc.3",
114
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.3",
115
+ "@deepseek-ai/dsh-client-ui-session": "^0.2.2-rc.3",
116
+ "@deepseek-ai/dsh-client-ui-settings": "^0.2.2-rc.3",
117
+ "@deepseek-ai/dsh-client-ui-slots": "^0.2.2-rc.3",
118
+ "@deepseek-ai/dsh-home-paths": "^0.2.2-rc.3",
119
+ "@deepseek-ai/dsh-host-webserver": "^0.2.2-rc.3",
120
+ "@deepseek-ai/dsh-llm": "^0.2.2-rc.3",
121
+ "@deepseek-ai/dsh-llm-pi-ai": "^0.2.2-rc.3",
122
+ "@deepseek-ai/dsh-session": "^0.2.2-rc.3",
123
+ "@deepseek-ai/dsh-settings": "^0.2.2-rc.3",
124
+ "@deepseek-ai/dsh-util-code-language": "^0.2.2-rc.3",
125
+ "@deepseek-ai/dsh-util-workspace-path": "^0.2.2-rc.3",
126
+ "@deepseek-ai/schemastery": "^3.19.0",
125
127
  "@earendil-works/pi-ai": "^1.1.0",
126
128
  "@eslint/js": "^10.0.1",
127
129
  "@shikijs/langs": "^4.4.3",
@@ -137,7 +139,7 @@
137
139
  "eslint-config-prettier": "^10.1.8",
138
140
  "globals": "^17.12.0",
139
141
  "immer": "^11.1.18",
140
- "katex": "^0.18.2",
142
+ "katex": "^0.19.0",
141
143
  "lightningcss": "^1.33.0",
142
144
  "mdast-util-from-markdown": "^2.0.3",
143
145
  "mdast-util-gfm": "^3.1.0",
@@ -161,6 +163,7 @@
161
163
  "typescript-eslint": "^8.70.1",
162
164
  "unrun": "^0.3.1",
163
165
  "vitest": "^4.1.12",
166
+ "yaml": "^2.9.1",
164
167
  "zustand": "^5.0.15"
165
168
  },
166
169
  "scripts": {
@@ -171,6 +174,6 @@
171
174
  "format:check": "prettier --check .",
172
175
  "typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.client.json",
173
176
  "check:release": "node scripts/check-release.mjs",
174
- "check": "pnpm run typecheck && pnpm run build && pnpm run test"
177
+ "check": "pnpm run typecheck && pnpm run build && pnpm run test && pnpm run lint && pnpm run format:check && pnpm run check:release"
175
178
  }
176
179
  }