dsh-workbuddy-connect 0.2.3 → 0.2.4

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/README.en.md CHANGED
@@ -56,7 +56,7 @@ After installing, switch to a WorkBuddy model in the model picker of the interfa
56
56
 
57
57
  ## Known limitations
58
58
 
59
- - Verified on macOS with the DSH Web / Desktop / TUI profile (`0.1.1-rc.2`+, Node 22+). The default credential paths on Windows / Linux are unverified — point the `WORKBUDDY_AUTH_FILE` environment variable at the actual location if needed.
59
+ - Verified on macOS with the DSH Web / Desktop / TUI profile (`0.1.1-rc.2`+, Node 22+). Windows probes Local and Roaming AppData in order; WSL first reads credentials from the mounted Windows user profile. If the Windows and Linux user names differ and Windows environment variables are not forwarded into WSL, point `WORKBUDDY_AUTH_FILE` at the actual file.
60
60
  - Relies on WorkBuddy client interfaces (not a public API); the plugin may need updates as WorkBuddy changes.
61
61
 
62
62
  ## Disclaimer
package/README.md CHANGED
@@ -62,7 +62,7 @@ dsh --profile dsh-tui
62
62
 
63
63
  ## 已知限制
64
64
 
65
- - 在 macOS 的 DSH Web / Desktop / TUI profile(`0.1.1-rc.2`+、Node 22+)下验证通过;Windows / Linux 的凭据默认路径未经验证,必要时可通过环境变量 `WORKBUDDY_AUTH_FILE` 指定实际位置。
65
+ - 在 macOS 的 DSH Web / Desktop / TUI profile(`0.1.1-rc.2`+、Node 22+)下验证通过。Windows 会依次探测 Local 与 Roaming AppData;WSL 会优先从挂载的 Windows 用户目录读取登录凭据。若 Windows 与 Linux 用户名不同且 Windows 环境变量未传入 WSL,请通过 `WORKBUDDY_AUTH_FILE` 指定实际位置。
66
66
  - 依赖 WorkBuddy 客户端接口(非官方开放 API),WorkBuddy 更新后插件可能需要随之调整。
67
67
 
68
68
  ## 免责声明
package/lib/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { _ as WorkBuddyCredentialStore, a as readHostHeartbeat, c as WORKBUDDY_CONNECT_VERSION, l as WorkBuddyUpstreamClient, o as workbuddyHostHeartbeatPath, p as FALLBACK_WORKBUDDY_MODELS, r as isHeartbeatProcessAlive, x as workbuddyOwnAuthPath } from "./host-heartbeat-C80jXKyk.js";
2
+ import { _ as WorkBuddyCredentialStore, a as readHostHeartbeat, c as WORKBUDDY_CONNECT_VERSION, l as WorkBuddyUpstreamClient, o as workbuddyHostHeartbeatPath, p as FALLBACK_WORKBUDDY_MODELS, r as isHeartbeatProcessAlive, x as workbuddyOwnAuthPath } from "./host-heartbeat-okrdovCF.js";
3
3
  import { realpathSync } from "node:fs";
4
4
  import { fileURLToPath } from "node:url";
5
5
  //#region src/bin.ts
@@ -1,6 +1,6 @@
1
1
  import { readFile, rm, stat, writeFile } from "node:fs/promises";
2
- import { homedir } from "node:os";
3
- import { join } from "node:path";
2
+ import { homedir, release } from "node:os";
3
+ import { basename, join } from "node:path";
4
4
  import { withFileLock, writeFileAtomic } from "@deepseek-ai/dsh-atomic-write";
5
5
  import { resolveDshHome } from "@deepseek-ai/dsh-home-paths";
6
6
  import { execFileSync } from "node:child_process";
@@ -24,17 +24,50 @@ const OWN_FORMAT_VERSION = 1;
24
24
  function workbuddyOwnAuthPath() {
25
25
  return join(resolveDshHome(), WORKBUDDY_AUTH_FILENAME);
26
26
  }
27
+ const DESKTOP_AUTH_RELATIVE_PATH = [
28
+ "CodeBuddyExtension",
29
+ "Data",
30
+ "Public",
31
+ "auth",
32
+ "workbuddy-desktop.info"
33
+ ];
34
+ /** Whether this Linux process is running inside Windows Subsystem for Linux. */
35
+ function isWsl() {
36
+ if (process.platform !== "linux") return false;
37
+ if (process.env["WSL_DISTRO_NAME"] !== void 0 || process.env["WSL_INTEROP"] !== void 0) return true;
38
+ return release().toLowerCase().includes("microsoft");
39
+ }
40
+ /** Convert a Windows drive path to WSL's conventional `/mnt/<drive>` form. */
41
+ function windowsPathForWsl(value) {
42
+ const path = value?.trim();
43
+ if (!path) return void 0;
44
+ if (path.startsWith("/")) return path;
45
+ const drivePath = /^([a-z]):[\\/](.*)$/iu.exec(path);
46
+ if (drivePath === null) return void 0;
47
+ return join("/mnt", drivePath[1].toLowerCase(), ...drivePath[2].split(/[\\/]+/u));
48
+ }
49
+ /** Windows desktop credential candidates visible from a WSL process. */
50
+ function wslDesktopAuthCandidates(home) {
51
+ const profile = windowsPathForWsl(process.env["USERPROFILE"]) ?? join("/mnt/c/Users", basename(home));
52
+ const localAppData = windowsPathForWsl(process.env["LOCALAPPDATA"]) ?? join(profile, "AppData", "Local");
53
+ const roamingAppData = windowsPathForWsl(process.env["APPDATA"]) ?? join(profile, "AppData", "Roaming");
54
+ return [join(localAppData, ...DESKTOP_AUTH_RELATIVE_PATH), join(roamingAppData, ...DESKTOP_AUTH_RELATIVE_PATH)];
55
+ }
27
56
  /**
28
57
  * Platform-default candidates for the WorkBuddy desktop app's auth file, in
29
58
  * probe order. Windows probes both AppData roots: current builds write under
30
- * `%LOCALAPPDATA%` (Local), older ones under `%APPDATA%` (Roaming). macOS and
31
- * Linux have a single well-known location.
59
+ * `%LOCALAPPDATA%` (Local), older ones under `%APPDATA%` (Roaming). WSL probes
60
+ * those same Windows locations through its mounted Windows profile before the
61
+ * native Linux location.
32
62
  */
33
63
  function defaultDesktopAuthCandidates() {
34
64
  const home = homedir();
35
65
  if (process.platform === "darwin") return [join(home, "Library", "Application Support", "CodeBuddyExtension", "Data", "Public", "auth", "workbuddy-desktop.info")];
36
66
  if (process.platform === "win32") return [join(home, "AppData", "Local", "CodeBuddyExtension", "Data", "Public", "auth", "workbuddy-desktop.info"), join(home, "AppData", "Roaming", "CodeBuddyExtension", "Data", "Public", "auth", "workbuddy-desktop.info")];
37
- if (process.platform === "linux") return [join(home, ".config", "CodeBuddyExtension", "Data", "Public", "auth", "workbuddy-desktop.info")];
67
+ if (process.platform === "linux") {
68
+ const linux = join(home, ".config", ...DESKTOP_AUTH_RELATIVE_PATH);
69
+ return isWsl() ? [...wslDesktopAuthCandidates(home), linux] : [linux];
70
+ }
38
71
  return [];
39
72
  }
40
73
  /** First platform-default candidate; see {@link defaultDesktopAuthCandidates}. */
@@ -701,7 +734,7 @@ var WorkBuddyUpstreamClient = class {
701
734
  };
702
735
  //#endregion
703
736
  //#region src/version.ts
704
- const WORKBUDDY_CONNECT_VERSION = "0.2.3";
737
+ const WORKBUDDY_CONNECT_VERSION = "0.2.4";
705
738
  //#endregion
706
739
  //#region src/host-heartbeat.ts
707
740
  /**
package/lib/index.d.ts CHANGED
@@ -110,8 +110,9 @@ declare function workbuddyOwnAuthPath(): string;
110
110
  /**
111
111
  * Platform-default candidates for the WorkBuddy desktop app's auth file, in
112
112
  * probe order. Windows probes both AppData roots: current builds write under
113
- * `%LOCALAPPDATA%` (Local), older ones under `%APPDATA%` (Roaming). macOS and
114
- * Linux have a single well-known location.
113
+ * `%LOCALAPPDATA%` (Local), older ones under `%APPDATA%` (Roaming). WSL probes
114
+ * those same Windows locations through its mounted Windows profile before the
115
+ * native Linux location.
115
116
  */
116
117
  declare function defaultDesktopAuthCandidates(): string[];
117
118
  /** First platform-default candidate; see {@link defaultDesktopAuthCandidates}. */
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as WorkBuddyCredentialStore, a as readHostHeartbeat, b as parseWorkBuddyAuth, d as prepareChatBody, f as regionOf, g as WORKBUDDY_AUTH_FILE_ENV, h as WORKBUDDY_AUTH_FILENAME, i as processStartTimeMs, l as WorkBuddyUpstreamClient, m as WorkBuddyCatalog, n as clearHostHeartbeat, o as workbuddyHostHeartbeatPath, p as FALLBACK_WORKBUDDY_MODELS, r as isHeartbeatProcessAlive, s as writeHostHeartbeat, t as WORKBUDDY_HOST_HEARTBEAT_FILENAME, u as classifyUpstreamError, v as defaultDesktopAuthCandidates, x as workbuddyOwnAuthPath, y as defaultDesktopAuthPath } from "./host-heartbeat-C80jXKyk.js";
1
+ import { _ as WorkBuddyCredentialStore, a as readHostHeartbeat, b as parseWorkBuddyAuth, d as prepareChatBody, f as regionOf, g as WORKBUDDY_AUTH_FILE_ENV, h as WORKBUDDY_AUTH_FILENAME, i as processStartTimeMs, l as WorkBuddyUpstreamClient, m as WorkBuddyCatalog, n as clearHostHeartbeat, o as workbuddyHostHeartbeatPath, p as FALLBACK_WORKBUDDY_MODELS, r as isHeartbeatProcessAlive, s as writeHostHeartbeat, t as WORKBUDDY_HOST_HEARTBEAT_FILENAME, u as classifyUpstreamError, v as defaultDesktopAuthCandidates, x as workbuddyOwnAuthPath, y as defaultDesktopAuthPath } from "./host-heartbeat-okrdovCF.js";
2
2
  import z from "@deepseek-ai/schemastery";
3
3
  import { installSettingsSection, settingsNamespace } from "@deepseek-ai/dsh-settings";
4
4
  import { createProvider } from "@earendil-works/pi-ai";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "dsh-workbuddy-connect",
3
3
  "displayName": "DSH WorkBuddy Connect",
4
4
  "description": "将 WorkBuddy 桌面 App 包含的模型自动接入 DeepSeek Harness — bring WorkBuddy desktop app models into DeepSeek Harness with zero configuration.",
5
- "version": "0.2.3",
5
+ "version": "0.2.4",
6
6
  "author": "corrinehu",
7
7
  "keywords": [
8
8
  "dsh-plugin",