dsh-workbuddy-bridge 0.5.3 → 0.5.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/lib/bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as variantFor, D as WorkBuddyUpstreamClient, S as WORKBUDDY_VARIANTS, X as resolveAppVersion, 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-
|
|
2
|
+
import { C as variantFor, D as WorkBuddyUpstreamClient, S as WORKBUDDY_VARIANTS, X as resolveAppVersion, 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-CKHC_c0-.js";
|
|
3
3
|
import { realpathSync } from "node:fs";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
//#region src/cli/bin.ts
|
|
@@ -839,6 +839,37 @@ function commonHeaders(credential) {
|
|
|
839
839
|
};
|
|
840
840
|
}
|
|
841
841
|
/**
|
|
842
|
+
* Per-request channel identity headers the international gateway verifies.
|
|
843
|
+
*
|
|
844
|
+
* Measured 2026-10-23 against `www.workbuddy.ai/v2/chat/completions`: the same
|
|
845
|
+
* account, credential, UA and body answer `400` / `11128` ("request illegal",
|
|
846
|
+
* channel verification) without these headers, and `200` SSE with them. The
|
|
847
|
+
* official desktop app sends this trace/conversation quintet on every chat
|
|
848
|
+
* request; the CN gateway accepts requests without it, so the injection stays
|
|
849
|
+
* global-region-only to keep the CN wire byte-identical to what passes today.
|
|
850
|
+
*
|
|
851
|
+
* `X-Trace-ID` carries a bare 32-hex id (the OTel trace-id form the app uses);
|
|
852
|
+
* the other four are UUIDs minted per request, exactly like the app does.
|
|
853
|
+
*/
|
|
854
|
+
function channelIdentityHeaders() {
|
|
855
|
+
const uuid = () => {
|
|
856
|
+
const b = randomBytes(16);
|
|
857
|
+
const b6 = b[6] ?? 0;
|
|
858
|
+
const b8 = b[8] ?? 0;
|
|
859
|
+
b[6] = b6 & 15 | 64;
|
|
860
|
+
b[8] = b8 & 63 | 128;
|
|
861
|
+
const h = b.toString("hex");
|
|
862
|
+
return `${h.slice(0, 8)}-${h.slice(8, 12)}-${h.slice(12, 16)}-${h.slice(16, 20)}-${h.slice(20)}`;
|
|
863
|
+
};
|
|
864
|
+
return {
|
|
865
|
+
"X-Trace-ID": randomBytes(16).toString("hex"),
|
|
866
|
+
"X-Request-ID": uuid(),
|
|
867
|
+
"X-Conversation-ID": uuid(),
|
|
868
|
+
"X-Conversation-Request-ID": uuid(),
|
|
869
|
+
"X-Conversation-Message-ID": uuid()
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
842
873
|
* Chat request headers, including the X-No-* conventions the official CLI uses.
|
|
843
874
|
*
|
|
844
875
|
* `userAgent` carries the desktop identity for chat and probe requests; when
|
|
@@ -853,7 +884,8 @@ function chatHeaders(credential, userAgent) {
|
|
|
853
884
|
...credential.uid === "" ? { "X-No-User-Id": "1" } : { "X-User-Id": credential.uid },
|
|
854
885
|
...credential.enterpriseId === void 0 || credential.enterpriseId === "" ? { "X-No-Enterprise-Id": "1" } : { "X-Enterprise-Id": credential.enterpriseId },
|
|
855
886
|
...credential.domain === "" ? { "X-No-Department-Info": "1" } : { "X-Domain": credential.domain },
|
|
856
|
-
"X-Product": "SaaS"
|
|
887
|
+
"X-Product": "SaaS",
|
|
888
|
+
...regionOf(credential.domain) === "global" ? channelIdentityHeaders() : {}
|
|
857
889
|
};
|
|
858
890
|
}
|
|
859
891
|
/** Refresh-endpoint headers; X-Refresh-Token appears here and nowhere else. */
|
|
@@ -3917,7 +3949,7 @@ var WorkBuddyCatalog = class {
|
|
|
3917
3949
|
};
|
|
3918
3950
|
//#endregion
|
|
3919
3951
|
//#region src/version.ts
|
|
3920
|
-
const WORKBUDDY_BRIDGE_VERSION = "0.5.
|
|
3952
|
+
const WORKBUDDY_BRIDGE_VERSION = "0.5.4";
|
|
3921
3953
|
//#endregion
|
|
3922
3954
|
//#region src/web/heartbeat.ts
|
|
3923
3955
|
/**
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as parseModelCatalog, B as FALLBACK_CN_APP_VERSION, C as variantFor, D as WorkBuddyUpstreamClient, F as probeModel, G as validCliVersion, H as fallbackChatIdentity, I as randomSentinel, J as installedAppVersion, K as WORKBUDDY_APP_VERSION_FILENAME, L as classifyUpstreamError, M as prepareInternationalChatBody, N as regionOf, O as modelWithCurrentPromotion, P as PROBE_EFFORT_CANDIDATES, R as upstreamDisplayMessage, S as WORKBUDDY_VARIANTS, U as readCliVersion, V as chatUserAgent, W as resolveChatIdentity, X as resolveAppVersion, Y as readBundleVersion, Z as validAppVersion, _ 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 prepareChatBody, k as normalizeCredits, l as FALLBACK_WORKBUDDY_AI_MODELS, m as WorkBuddyCredentialStore, n as clearHostHeartbeat, o as workbuddyHostHeartbeatPath, p as WORKBUDDY_AUTH_FILE_ENV, q as appUserAgent, 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 CN_APP_VERSION_FILENAME } from "./heartbeat-
|
|
1
|
+
import { A as parseModelCatalog, B as FALLBACK_CN_APP_VERSION, C as variantFor, D as WorkBuddyUpstreamClient, F as probeModel, G as validCliVersion, H as fallbackChatIdentity, I as randomSentinel, J as installedAppVersion, K as WORKBUDDY_APP_VERSION_FILENAME, L as classifyUpstreamError, M as prepareInternationalChatBody, N as regionOf, O as modelWithCurrentPromotion, P as PROBE_EFFORT_CANDIDATES, R as upstreamDisplayMessage, S as WORKBUDDY_VARIANTS, U as readCliVersion, V as chatUserAgent, W as resolveChatIdentity, X as resolveAppVersion, Y as readBundleVersion, Z as validAppVersion, _ 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 prepareChatBody, k as normalizeCredits, l as FALLBACK_WORKBUDDY_AI_MODELS, m as WorkBuddyCredentialStore, n as clearHostHeartbeat, o as workbuddyHostHeartbeatPath, p as WORKBUDDY_AUTH_FILE_ENV, q as appUserAgent, 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 CN_APP_VERSION_FILENAME } from "./heartbeat-CKHC_c0-.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.
|
|
5
|
+
"version": "0.5.4",
|
|
6
6
|
"author": "zlZayn",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"dsh",
|