dsh-connect-workbuddy 2.0.2 → 2.0.3
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 { T as WorkBuddyUpstreamClient, a as readHostHeartbeat, c as WORKBUDDY_CONNECT_VERSION, g as WorkBuddyCredentialStore, h as WORKBUDDY_AUTH_FILE_ENV, l as FALLBACK_WORKBUDDY_MODELS, o as workbuddyHostHeartbeatPath, r as isHeartbeatProcessAlive, u as FALLBACK_WORKBUDDY_MODELS_GLOBAL, v as defaultDesktopAuthCandidates, w as workbuddyOwnAuthPath, x as legacyWorkbuddyOwnAuthPath, y as defaultDesktopAuthDirs } from "./host-heartbeat-
|
|
2
|
+
import { T as WorkBuddyUpstreamClient, a as readHostHeartbeat, c as WORKBUDDY_CONNECT_VERSION, g as WorkBuddyCredentialStore, h as WORKBUDDY_AUTH_FILE_ENV, l as FALLBACK_WORKBUDDY_MODELS, o as workbuddyHostHeartbeatPath, r as isHeartbeatProcessAlive, u as FALLBACK_WORKBUDDY_MODELS_GLOBAL, v as defaultDesktopAuthCandidates, w as workbuddyOwnAuthPath, x as legacyWorkbuddyOwnAuthPath, y as defaultDesktopAuthDirs } from "./host-heartbeat-CYeVuoJE.js";
|
|
3
3
|
import { realpathSync } from "node:fs";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
//#region src/bin.ts
|
|
@@ -271,13 +271,56 @@ function parseCreditMultiplier(value) {
|
|
|
271
271
|
const parsed = Number(match[1]);
|
|
272
272
|
return Number.isFinite(parsed) && parsed >= 0 ? parsed : void 0;
|
|
273
273
|
}
|
|
274
|
-
/**
|
|
274
|
+
/**
|
|
275
|
+
* The effort vocabulary the upstream's plural-form payloads declare across both
|
|
276
|
+
* gateways (live union of every `supportedEfforts` list seen; `minimal` has
|
|
277
|
+
* never appeared). Both gateways also accept every level in it on
|
|
278
|
+
* singular-form models — medium/xhigh fold into high, low/max answer with
|
|
279
|
+
* their own budgets — so the singular `effort` value is a DEFAULT, never the
|
|
280
|
+
* model's only level.
|
|
281
|
+
*/
|
|
282
|
+
const SINGULAR_EFFORT_LADDER = [
|
|
283
|
+
"low",
|
|
284
|
+
"medium",
|
|
285
|
+
"high",
|
|
286
|
+
"xhigh",
|
|
287
|
+
"max"
|
|
288
|
+
];
|
|
289
|
+
/**
|
|
290
|
+
* The singular spelling of reasoning metadata: `effort` (plus the ignored
|
|
291
|
+
* `summary`) and none of the plural-form fields. Observed on CN
|
|
292
|
+
* `deepseek-v4.1-flash`/`kimi-k3-1`/`glm-5.2`… and global
|
|
293
|
+
* `deepseek-v4.1-flash`/`kimi-k3`/`gemini-3.5-flash`… (issue #7).
|
|
294
|
+
*/
|
|
295
|
+
function isSingularEffortForm(raw) {
|
|
296
|
+
return typeof raw["effort"] === "string" && !Array.isArray(raw["supportedEfforts"]) && typeof raw["defaultEffort"] !== "string" && typeof raw["canDisableThinking"] !== "boolean";
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Fold a singular-form `effort` into the plural shape the rest of the plugin
|
|
300
|
+
* already understands. Live probes on both gateways (issue #7) show these
|
|
301
|
+
* models answer with distinct `reasoning_content` across the whole ladder —
|
|
302
|
+
* and think NOT AT ALL when no `reasoning_effort` is sent — so the fold
|
|
303
|
+
* widens `supportedEfforts` and carries the declared value into
|
|
304
|
+
* `defaultEffort`. An unrecognized `effort` value passes through as the lone
|
|
305
|
+
* level, leaving its fate to the adapter's known-level filter.
|
|
306
|
+
*/
|
|
307
|
+
function singularEffortLadder(raw) {
|
|
308
|
+
const effort = typeof raw["effort"] === "string" ? raw["effort"] : void 0;
|
|
309
|
+
if (effort === void 0) return void 0;
|
|
310
|
+
return SINGULAR_EFFORT_LADDER.includes(effort) ? [...SINGULAR_EFFORT_LADDER] : [effort];
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Parse the upstream's `reasoning` object; unknown shapes degrade to `{}`.
|
|
314
|
+
* Both spellings normalize here: the plural form passes through as declared,
|
|
315
|
+
* and the singular `effort` form folds via {@link singularEffortLadder}.
|
|
316
|
+
*/
|
|
275
317
|
function parseReasoning(value) {
|
|
276
318
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
277
319
|
const raw = value;
|
|
278
|
-
const
|
|
279
|
-
const
|
|
280
|
-
const
|
|
320
|
+
const effort = typeof raw["effort"] === "string" ? raw["effort"] : void 0;
|
|
321
|
+
const supportedEfforts = Array.isArray(raw["supportedEfforts"]) ? raw["supportedEfforts"].filter((entry) => typeof entry === "string") : singularEffortLadder(raw);
|
|
322
|
+
const defaultEffort = typeof raw["defaultEffort"] === "string" ? raw["defaultEffort"] : effort;
|
|
323
|
+
const canDisableThinking = typeof raw["canDisableThinking"] === "boolean" ? raw["canDisableThinking"] : isSingularEffortForm(raw) ? true : void 0;
|
|
281
324
|
if (supportedEfforts === void 0 && defaultEffort === void 0 && canDisableThinking === void 0) return;
|
|
282
325
|
return {
|
|
283
326
|
...supportedEfforts === void 0 || supportedEfforts.length === 0 ? {} : { supportedEfforts },
|
|
@@ -1370,7 +1413,7 @@ var WorkBuddyCatalog = class {
|
|
|
1370
1413
|
//#endregion
|
|
1371
1414
|
//#region src/version.ts
|
|
1372
1415
|
/** The npm package version this build was produced from. */
|
|
1373
|
-
const WORKBUDDY_CONNECT_VERSION = "2.0.
|
|
1416
|
+
const WORKBUDDY_CONNECT_VERSION = "2.0.3";
|
|
1374
1417
|
//#endregion
|
|
1375
1418
|
//#region src/host-heartbeat.ts
|
|
1376
1419
|
/**
|
package/lib/index.d.ts
CHANGED
|
@@ -360,7 +360,11 @@ declare function prepareChatBody(source: string): string;
|
|
|
360
360
|
* card simply omits the rate instead of displaying a fabricated one.
|
|
361
361
|
*/
|
|
362
362
|
declare function parseCreditMultiplier(value: unknown): number | undefined;
|
|
363
|
-
/**
|
|
363
|
+
/**
|
|
364
|
+
* Parse the upstream's `reasoning` object; unknown shapes degrade to `{}`.
|
|
365
|
+
* Both spellings normalize here: the plural form passes through as declared,
|
|
366
|
+
* and the singular `effort` form folds via {@link singularEffortLadder}.
|
|
367
|
+
*/
|
|
364
368
|
declare function parseReasoning(value: unknown): WorkBuddyReasoning | undefined;
|
|
365
369
|
/** Parse one catalog entry; entries without usable token limits are dropped. */
|
|
366
370
|
declare function parseUpstreamModel(value: unknown): WorkBuddyUpstreamModel | undefined;
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as prepareChatBody, C as workbuddyAccountId, D as parseCreditMultiplier, E as classifyUpstreamError, O as parseReasoning, S as parseWorkBuddyAuth, T as WorkBuddyUpstreamClient, _ as authFileName, a as readHostHeartbeat, b as defaultDesktopAuthPath, c as WORKBUDDY_CONNECT_VERSION, d as WorkBuddyCatalog, f as deriveCatalog, g as WorkBuddyCredentialStore, h as WORKBUDDY_AUTH_FILE_ENV, i as processStartTimeMs, j as regionOf, k as parseUpstreamModel, l as FALLBACK_WORKBUDDY_MODELS, m as WORKBUDDY_AUTH_FILENAME, n as clearHostHeartbeat, o as workbuddyHostHeartbeatPath, p as fallbackModelsFor, r as isHeartbeatProcessAlive, s as writeHostHeartbeat, t as WORKBUDDY_HOST_HEARTBEAT_FILENAME, u as FALLBACK_WORKBUDDY_MODELS_GLOBAL, v as defaultDesktopAuthCandidates, w as workbuddyOwnAuthPath, x as legacyWorkbuddyOwnAuthPath, y as defaultDesktopAuthDirs } from "./host-heartbeat-
|
|
1
|
+
import { A as prepareChatBody, C as workbuddyAccountId, D as parseCreditMultiplier, E as classifyUpstreamError, O as parseReasoning, S as parseWorkBuddyAuth, T as WorkBuddyUpstreamClient, _ as authFileName, a as readHostHeartbeat, b as defaultDesktopAuthPath, c as WORKBUDDY_CONNECT_VERSION, d as WorkBuddyCatalog, f as deriveCatalog, g as WorkBuddyCredentialStore, h as WORKBUDDY_AUTH_FILE_ENV, i as processStartTimeMs, j as regionOf, k as parseUpstreamModel, l as FALLBACK_WORKBUDDY_MODELS, m as WORKBUDDY_AUTH_FILENAME, n as clearHostHeartbeat, o as workbuddyHostHeartbeatPath, p as fallbackModelsFor, r as isHeartbeatProcessAlive, s as writeHostHeartbeat, t as WORKBUDDY_HOST_HEARTBEAT_FILENAME, u as FALLBACK_WORKBUDDY_MODELS_GLOBAL, v as defaultDesktopAuthCandidates, w as workbuddyOwnAuthPath, x as legacyWorkbuddyOwnAuthPath, y as defaultDesktopAuthDirs } from "./host-heartbeat-CYeVuoJE.js";
|
|
2
2
|
import z from "@deepseek-ai/schemastery";
|
|
3
3
|
import { randomBytes, timingSafeEqual } from "node:crypto";
|
|
4
4
|
import { createProvider } from "@earendil-works/pi-ai";
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "dsh-connect-workbuddy",
|
|
3
3
|
"displayName": "DSH Connect WorkBuddy",
|
|
4
4
|
"description": "Connect locally signed-in WorkBuddy models to DeepSeek Harness with a read-only credits overview and model management.",
|
|
5
|
-
"version": "2.0.
|
|
5
|
+
"version": "2.0.3",
|
|
6
6
|
"author": "dingminhua",
|
|
7
7
|
"copyright": "Copyright (c) 2026 LaoDing",
|
|
8
8
|
"license": "MIT",
|