dsh-connect-workbuddy 1.0.0 → 1.1.0
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/CHANGELOG.md +23 -1
- package/README.en.md +10 -3
- package/README.md +10 -3
- package/lib/bin.js +1 -1
- package/lib/client.js +21 -11
- package/lib/{host-heartbeat-DHfQtrSf.js → host-heartbeat-C9s6A0pP.js} +11 -24
- package/lib/index.d.ts +5 -11
- package/lib/index.js +1 -29
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 1.1.0 (2026-08-31)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- **切换账号出错提示**:切换账号后出现错误(如所选账号凭据失效返回 401)时,插件卡片账号信息区(令牌行下方)显示一行小字「出现错误,重新登录 WorkBuddy APP 即可」,提示用户通过重新登录恢复。
|
|
8
|
+
|
|
9
|
+
### Docs
|
|
10
|
+
|
|
11
|
+
- 市场收录对齐当前约定:正式提交 PR [#3812](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/pull/3812) 仅保留 `data/plugins/dingminhua__dsh-connect-workbuddy.yml` 与生成的 README;**移除**对注册表 `data/screenshots.json` 的改动(该文件是旧约定回退,新约定为插件自己仓库根目录声明 `screenshots.json`)。
|
|
12
|
+
- README 与 README.en.md 市场章节补充「收录目录规范」(contributing.md 要点:单文件命名、url 一致、category、描述引号规则、`dsh.bundle` manifest、topic、CI 门槛、README 由脚本生成、每 PR ≤ 3 条)。
|
|
13
|
+
- 新增 `awesome-dsh-plugin-submission/README.md`:市场收录目录的操作说明与当前状态;删除已废弃的 `screenshots-entry.json` 草稿(对应旧约定往注册表加键的做法)。
|
|
14
|
+
|
|
15
|
+
## 1.0.1 (2026-08-30)
|
|
16
|
+
|
|
17
|
+
### Fixes
|
|
18
|
+
|
|
19
|
+
- 账号选择改为严格绑定用户显式选择:删除启动时按积分自动挑选账号的逻辑,未选号时跟随 App 当前登录(live 文件);账号失效时不再静默切换到其他账号,而是报「未登录」让用户重新选择,避免账单落到用户未选择的账号上。
|
|
20
|
+
|
|
21
|
+
### Docs
|
|
22
|
+
|
|
23
|
+
- `docs/DESIGN.md` 对齐当前进度:图片输入改为手动勾选说明;补充 `reasoning.effort`(固定档位)形态与推理强度两态已知问题;积分展示补充月度周期套餐与每日签到;scripts 探针数量更新。
|
|
24
|
+
- README 与 README.en.md 功能特性更新:图片输入改为按模型手动勾选。
|
|
25
|
+
- 新增 `docs/reasoning-investigation.md`:记录推理强度调查结论(上游两态数据、DSH 链路、实测档位、待决策修复方向)。仅记录,未改代码。
|
|
4
26
|
|
|
5
27
|
## 1.0.0 (2026-08-30)
|
|
6
28
|
|
package/README.en.md
CHANGED
|
@@ -22,7 +22,7 @@ A [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) bund
|
|
|
22
22
|
## Features
|
|
23
23
|
|
|
24
24
|
- **WorkBuddy model provider** — registers locally signed-in WorkBuddy models as the `workbuddy` provider (e.g. `GLM-5.3`, `DeepSeek-V4-Pro`, `Kimi-K3`, `MiniMax-M3`, `Hy3`).
|
|
25
|
-
- **Model management** — refresh the full catalog from upstream and enable or disable each model individually; refresh is a draft operation that only takes effect on save. Upstream also reports credit multiplier, context/output limits, reasoning efforts
|
|
25
|
+
- **Model management** — refresh the full catalog from upstream and enable or disable each model individually; refresh is a draft operation that only takes effect on save. Upstream also reports credit multiplier, context/output limits, and reasoning efforts; image input is opted in per model manually (off by default).
|
|
26
26
|
- **Local account switching** — discovers the multiple sign-in credentials WorkBuddy's desktop app leaves behind and lets you switch between them. Tokens are never written to DSH settings.
|
|
27
27
|
- **Read-only credits overview** — remaining credit aggregated per package, plus each model's credit multiplier. Queries consume no credits.
|
|
28
28
|
- **Multi-candidate credential paths** — probes the platform defaults for macOS / Windows / Linux in turn, overridable by environment variable or directly in the card.
|
|
@@ -92,12 +92,19 @@ dsh plugin --profile desktop add /Users/dmh2002/DshProject/dsh-connect-workbuddy
|
|
|
92
92
|
|
|
93
93
|
## Marketplace listing
|
|
94
94
|
|
|
95
|
-
The plugin ships an installable `dsh.bundle` manifest and is published to npm. Community marketplaces generally sync entries from the [Awesome DSH Plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) registry; the submission draft lives at [`awesome-dsh-plugin-submission/dingminhua__dsh-connect-workbuddy.yml`](awesome-dsh-plugin-submission/dingminhua__dsh-connect-workbuddy.yml).
|
|
95
|
+
The plugin ships an installable `dsh.bundle` manifest and is published to npm. Community marketplaces generally sync entries from the [Awesome DSH Plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) registry; the submission draft lives at [`awesome-dsh-plugin-submission/dingminhua__dsh-connect-workbuddy.yml`](awesome-dsh-plugin-submission/dingminhua__dsh-connect-workbuddy.yml), and the formal submission is PR [#3812](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/pull/3812) (`data/plugins/dingminhua__dsh-connect-workbuddy.yml`, CI and Submission gate green, awaiting maintainer merge).
|
|
96
|
+
|
|
97
|
+
**Listing directory rules** (per [contributing.md](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/blob/main/contributing.md)):
|
|
98
|
+
|
|
99
|
+
- One YAML per plugin: `data/plugins/<owner>__<repo>.yml` with `url` (exactly matching the repo), `name` (`owner/repo`), `category` (one of the valid values; this project uses `model`), and `description.en` (required, ending with a period) / `description.zh` (optional); a description containing `: ` must be quoted.
|
|
100
|
+
- The repo must declare a `dsh.bundle` manifest (here `dsh.bundle.patch: ./cordis.patch.yml`) and carry the `dsh-plugin` topic; the ≥ 10 commits and ≥ 1 day age are checked automatically by CI.
|
|
101
|
+
- Both READMEs (`README.md` / `README.zh.md`) are generated — never edit by hand; after changing the YAML, regenerate with `node scripts/generate-readme.mjs`.
|
|
102
|
+
- At most 3 entries per PR; change only your own entry, never touch other plugins.
|
|
96
103
|
|
|
97
104
|
Marketplace screenshots and GitHub README badges are two separate mechanisms:
|
|
98
105
|
|
|
99
106
|
- **GitHub badges** are produced by the Shields/dshfind image links at the top of this README.
|
|
100
|
-
- **Marketplace screenshots** are
|
|
107
|
+
- **Marketplace screenshots** follow the current convention and are declared in the plugin's own root [`screenshots.json`](screenshots.json) (this project declares its usage-card screenshot there). The registry's `data/screenshots.json` is a legacy fallback and **no longer accepts new keys** (this project removed its edit before submitting).
|
|
101
108
|
- **Marketplace icons/placeholders** follow each marketplace's own display rules; they are not a generic npm `package.json` field nor a README badge.
|
|
102
109
|
|
|
103
110
|
## Known limitations
|
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
## 功能特性
|
|
29
29
|
|
|
30
30
|
- **WorkBuddy 模型接入** —— 把本机登录的 WorkBuddy 模型注册为 DSH 的 `workbuddy` provider,模型选择器出现 `GLM-5.3`、`DeepSeek-V4-Pro`、`Kimi-K3`、`MiniMax-M3`、`Hy3` 等。
|
|
31
|
-
- **模型管理** ——
|
|
31
|
+
- **模型管理** —— 从上游刷新完整模型目录,逐项勾选启用或禁用;刷新是草稿操作,点保存才生效。上游同时给出积分倍率、上下文/输出上限与推理档位;图片输入按模型手动勾选(默认不勾选)。
|
|
32
32
|
- **本机账号切换** —— 自动发现 WorkBuddy 桌面端留下的多个登录凭据,可切换账号;Token 不写入 DSH 设置。
|
|
33
33
|
- **只读积分概览** —— 按套餐聚合展示剩余积分,并列出每个模型的积分倍率。查询不消耗积分。
|
|
34
34
|
- **凭据路径多候选** —— macOS / Windows / Linux 逐一探测默认位置,也支持环境变量与卡片内直接指定。
|
|
@@ -100,12 +100,19 @@ dsh plugin --profile desktop add /Users/dmh2002/DshProject/dsh-connect-workbuddy
|
|
|
100
100
|
|
|
101
101
|
## 市场收录与展示
|
|
102
102
|
|
|
103
|
-
插件已包含可安装的 `dsh.bundle` manifest,并发布到 npm。社区市场通常从 [Awesome DSH Plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) 注册表同步条目;仓库内的提交草稿位于 [`awesome-dsh-plugin-submission/dingminhua__dsh-connect-workbuddy.yml`](awesome-dsh-plugin-submission/dingminhua__dsh-connect-workbuddy.yml)
|
|
103
|
+
插件已包含可安装的 `dsh.bundle` manifest,并发布到 npm。社区市场通常从 [Awesome DSH Plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) 注册表同步条目;仓库内的提交草稿位于 [`awesome-dsh-plugin-submission/dingminhua__dsh-connect-workbuddy.yml`](awesome-dsh-plugin-submission/dingminhua__dsh-connect-workbuddy.yml),正式提交为 PR [#3812](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/pull/3812)(`data/plugins/dingminhua__dsh-connect-workbuddy.yml`,已通过 CI 与 Submission gate,等待维护者合并)。
|
|
104
|
+
|
|
105
|
+
**收录目录规范**(依据 [contributing.md](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/blob/main/contributing.md)):
|
|
106
|
+
|
|
107
|
+
- 每个插件一个 YAML:`data/plugins/<owner>__<repo>.yml`,字段为 `url`(与仓库地址完全一致)、`name`(`owner/repo`)、`category`(有效值之一,本项目为 `model`)、`description.en`(必填,以句号结尾)/ `description.zh`(可选);描述中含 `: ` 必须加引号。
|
|
108
|
+
- 仓库必须声明 `dsh.bundle` manifest(本项目 `dsh.bundle.patch: ./cordis.patch.yml`),且被 `dsh-plugin` topic 标记;提交数 ≥ 10、仓库满 1 天由 CI 自动检查。
|
|
109
|
+
- 两个 README(`README.md` / `README.zh.md`)由脚本生成,不得手工编辑;修改 YAML 后执行 `node scripts/generate-readme.mjs` 重新生成。
|
|
110
|
+
- 一个 PR 最多收录 3 条;只改自己的条目,不动其他插件。
|
|
104
111
|
|
|
105
112
|
市场卡片中的截图与 GitHub README 徽章是两套机制:
|
|
106
113
|
|
|
107
114
|
- **GitHub 徽章**由本 README 顶部的 Shields/dshfind 图片链接生成。
|
|
108
|
-
-
|
|
115
|
+
- **市场截图**按当前约定由**插件自己仓库根目录的 `screenshots.json`** 声明(本项目声明了 [screenshots.json](screenshots.json),含使用界面截图),注册表 `data/screenshots.json` 是旧约定下的回退,**不再添加新键**(本项目已在提交前撤销该文件的改动)。
|
|
109
116
|
- **市场图标/占位图**由具体市场的展示规则决定,并不是 npm `package.json` 的通用字段,也不是 README 徽章。
|
|
110
117
|
|
|
111
118
|
## 已知限制
|
package/lib/bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as defaultDesktopAuthCandidates, O as workbuddyOwnAuthPath, a as readHostHeartbeat, b as WORKBUDDY_AUTH_FILE_ENV, c as WORKBUDDY_CONNECT_VERSION, g as FALLBACK_WORKBUDDY_MODELS, l as WorkBuddyUpstreamClient, o as workbuddyHostHeartbeatPath, r as isHeartbeatProcessAlive, w as defaultDesktopAuthDirs, x as WorkBuddyCredentialStore } from "./host-heartbeat-
|
|
2
|
+
import { C as defaultDesktopAuthCandidates, O as workbuddyOwnAuthPath, a as readHostHeartbeat, b as WORKBUDDY_AUTH_FILE_ENV, c as WORKBUDDY_CONNECT_VERSION, g as FALLBACK_WORKBUDDY_MODELS, l as WorkBuddyUpstreamClient, o as workbuddyHostHeartbeatPath, r as isHeartbeatProcessAlive, w as defaultDesktopAuthDirs, x as WorkBuddyCredentialStore } from "./host-heartbeat-C9s6A0pP.js";
|
|
3
3
|
import { realpathSync } from "node:fs";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
//#region src/bin.ts
|
package/lib/client.js
CHANGED
|
@@ -82,6 +82,7 @@ window.__ModuleLoader__.load({
|
|
|
82
82
|
.dsm-workbuddy-usage-account{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;border:1px solid var(--dsw-alias-border-l2,#3a3d45);border-radius:14px;background:var(--dsw-alias-bg-layer-2,#24262c)}
|
|
83
83
|
.dsm-workbuddy-usage-account-copy{display:flex;flex-direction:column;gap:3px;min-width:0}
|
|
84
84
|
.dsm-workbuddy-usage-expiry{padding-left:19px;color:var(--dsw-alias-label-tertiary,#9aa0a8);font-size:12px;line-height:18px}
|
|
85
|
+
.dsm-workbuddy-usage-hint{padding-left:19px;color:var(--dsw-alias-label-tertiary,#9aa0a8);font-size:12px;line-height:18px}
|
|
85
86
|
.dsm-workbuddy-account-picker{display:block}
|
|
86
87
|
.dsm-workbuddy-usage-select-wrap{position:relative}
|
|
87
88
|
.dsm-workbuddy-usage-select{appearance:none;width:100%;font:inherit;padding:10px 34px 10px 12px;border:1px solid var(--dsw-alias-border-l2,#3a3d45);border-radius:10px;color:var(--dsw-alias-label-primary,#e6e6e6);background:var(--dsw-alias-bg-layer-3,#2a2c33);cursor:pointer;transition:border-color .15s,box-shadow .15s}
|
|
@@ -463,17 +464,24 @@ window.__ModuleLoader__.load({
|
|
|
463
464
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
464
465
|
className: "dsm-workbuddy-usage-account-copy",
|
|
465
466
|
role: "status",
|
|
466
|
-
children: [
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
467
|
+
children: [
|
|
468
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
469
|
+
className: "dsm-workbuddy-usage-status",
|
|
470
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
471
|
+
"aria-hidden": "true",
|
|
472
|
+
className: "dsm-workbuddy-usage-dot",
|
|
473
|
+
style: dotStyle(status.status)
|
|
474
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: label })]
|
|
475
|
+
}),
|
|
476
|
+
status.status === "signed-in" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
477
|
+
className: "dsm-workbuddy-usage-expiry",
|
|
478
|
+
children: t("row.tokenExpiry", { expiresAt: formatDateTime(status.tokenExpiresAtMs) })
|
|
479
|
+
}) : null,
|
|
480
|
+
status.status === "error" || status.status === "signed-in" && status.creditsError !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
481
|
+
className: "dsm-workbuddy-usage-hint",
|
|
482
|
+
children: t("row.reloginHint")
|
|
483
|
+
}) : null
|
|
484
|
+
]
|
|
477
485
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
478
486
|
type: "button",
|
|
479
487
|
className: "dsm-btn dsm-btn-outline",
|
|
@@ -753,6 +761,7 @@ window.__ModuleLoader__.load({
|
|
|
753
761
|
"row.signedOutHint": "Sign in once in the WorkBuddy desktop app; this plugin follows that sign-in automatically.",
|
|
754
762
|
"row.signedIn": "Signed in: {accountName}",
|
|
755
763
|
"row.tokenExpiry": "Access token expires {expiresAt} (auto-renewal)",
|
|
764
|
+
"row.reloginHint": "If errors occur, sign back in to the WorkBuddy app.",
|
|
756
765
|
"row.requestFailed": "Request failed",
|
|
757
766
|
"row.creditsTotalLabel": "Total remaining credits",
|
|
758
767
|
"row.creditsMonthlyRemain": "Remaining {remain} / {size} · Refreshes {at}",
|
|
@@ -796,6 +805,7 @@ window.__ModuleLoader__.load({
|
|
|
796
805
|
"row.signedOutHint": "在 WorkBuddy 桌面 App 里登录一次即可,插件会自动跟随当前登录的账号。",
|
|
797
806
|
"row.signedIn": "已登录:{accountName}",
|
|
798
807
|
"row.tokenExpiry": "访问令牌 {expiresAt} 过期(自动续期)",
|
|
808
|
+
"row.reloginHint": "出现错误,重新登录 WorkBuddy APP 即可。",
|
|
799
809
|
"row.requestFailed": "请求失败",
|
|
800
810
|
"row.creditsTotalLabel": "总剩余积分",
|
|
801
811
|
"row.creditsMonthlyRemain": "剩余 {remain} / {size} · {at} 刷新",
|
|
@@ -15,10 +15,10 @@ import { execFileSync } from "node:child_process";
|
|
|
15
15
|
* 未过期则继续沿用旧 token。这些机制已在该项目验证,此处沿用。
|
|
16
16
|
* 改动:原版只解析单个 `workbuddy-desktop.info`。WorkBuddy 桌面端在
|
|
17
17
|
* 同一 auth 目录留下带时间戳的备份文件(`workbuddy-desktop.<stamp>.info`),
|
|
18
|
-
* 实测这些文件各自持有不同账号的可用凭据(本机 6 个文件 → 2
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* 实测这些文件各自持有不同账号的可用凭据(本机 6 个文件 → 2 个账号)。
|
|
19
|
+
* 本实现改为扫描整个 auth 目录,按 uin 去重为多个可选账号。跟随 App
|
|
20
|
+
* 当前登录(live 文件)仍是默认行为;用户显式选择的账号被严格绑定,
|
|
21
|
+
* 不因积分多少而切换,失效时也不会静默改选其他账号。
|
|
22
22
|
*
|
|
23
23
|
* @module dsh-connect-workbuddy/auth
|
|
24
24
|
*/
|
|
@@ -209,8 +209,6 @@ var WorkBuddyCredentialStore = class {
|
|
|
209
209
|
authDirs;
|
|
210
210
|
desktopPathOverride;
|
|
211
211
|
accountId;
|
|
212
|
-
/** Account ids with usable credit, tried first when nothing is selected. */
|
|
213
|
-
preferIds = [];
|
|
214
212
|
inflight;
|
|
215
213
|
constructor(options) {
|
|
216
214
|
this.refresh = options.refresh;
|
|
@@ -233,15 +231,6 @@ var WorkBuddyCredentialStore = class {
|
|
|
233
231
|
selectedAccountId() {
|
|
234
232
|
return this.accountId;
|
|
235
233
|
}
|
|
236
|
-
/**
|
|
237
|
-
* Preferred account ordering used when no account is explicitly selected.
|
|
238
|
-
* An account with zero credit fails every chat request, so accounts with
|
|
239
|
-
* usable credit must win the default.
|
|
240
|
-
*/
|
|
241
|
-
setPreferAccountIds(ids) {
|
|
242
|
-
this.preferIds = [...ids];
|
|
243
|
-
this.inflight = void 0;
|
|
244
|
-
}
|
|
245
234
|
/** The auth-file path candidates, in probe order. */
|
|
246
235
|
resolveDesktopCandidates() {
|
|
247
236
|
const fromEnv = process.env[WORKBUDDY_AUTH_FILE_ENV];
|
|
@@ -322,16 +311,14 @@ var WorkBuddyCredentialStore = class {
|
|
|
322
311
|
return [...byId.values()];
|
|
323
312
|
}
|
|
324
313
|
/**
|
|
325
|
-
*
|
|
326
|
-
* credential. Following the app's current sign-in is the documented
|
|
327
|
-
* behaviour; the backups exist so the user can switch explicitly.
|
|
314
|
+
* Default when no account is explicitly selected: the live sign-in, else the
|
|
315
|
+
* freshest credential. Following the app's current sign-in is the documented
|
|
316
|
+
* default behaviour; the backups exist so the user can switch explicitly.
|
|
317
|
+
* This is NOT credit-seeking — it never reorders accounts to find one with
|
|
318
|
+
* remaining credit.
|
|
328
319
|
*/
|
|
329
320
|
preferred(credentials) {
|
|
330
321
|
if (credentials.length === 0) return void 0;
|
|
331
|
-
for (const id of this.preferIds) {
|
|
332
|
-
const match = credentials.find((credential) => workbuddyAccountId(credential) === id);
|
|
333
|
-
if (match !== void 0) return match;
|
|
334
|
-
}
|
|
335
322
|
return credentials.reduce((best, credential) => {
|
|
336
323
|
if (fileRank(credential.filePath) < fileRank(best.filePath)) return credential;
|
|
337
324
|
if (fileRank(credential.filePath) === fileRank(best.filePath) && credential.expiresAtMs > best.expiresAtMs) return credential;
|
|
@@ -362,7 +349,7 @@ var WorkBuddyCredentialStore = class {
|
|
|
362
349
|
async current() {
|
|
363
350
|
const credentials = await this.readAll();
|
|
364
351
|
if (this.accountId === void 0) return this.preferred(credentials);
|
|
365
|
-
return credentials.find((credential) => workbuddyAccountId(credential) === this.accountId)
|
|
352
|
+
return credentials.find((credential) => workbuddyAccountId(credential) === this.accountId);
|
|
366
353
|
}
|
|
367
354
|
/** The credential to send upstream: {@link current}, refreshed on demand. */
|
|
368
355
|
async resolve() {
|
|
@@ -1009,7 +996,7 @@ var WorkBuddyUpstreamClient = class {
|
|
|
1009
996
|
//#endregion
|
|
1010
997
|
//#region src/version.ts
|
|
1011
998
|
/** The npm package version this build was produced from. */
|
|
1012
|
-
const WORKBUDDY_CONNECT_VERSION = "1.
|
|
999
|
+
const WORKBUDDY_CONNECT_VERSION = "1.1.0";
|
|
1013
1000
|
//#endregion
|
|
1014
1001
|
//#region src/host-heartbeat.ts
|
|
1015
1002
|
/**
|
package/lib/index.d.ts
CHANGED
|
@@ -113,8 +113,6 @@ declare class WorkBuddyCredentialStore {
|
|
|
113
113
|
private readonly authDirs;
|
|
114
114
|
private desktopPathOverride;
|
|
115
115
|
private accountId;
|
|
116
|
-
/** Account ids with usable credit, tried first when nothing is selected. */
|
|
117
|
-
private preferIds;
|
|
118
116
|
private inflight;
|
|
119
117
|
constructor(options: WorkBuddyStoreOptions);
|
|
120
118
|
/** Repoint the desktop file or directory; applies on the next read. */
|
|
@@ -123,12 +121,6 @@ declare class WorkBuddyCredentialStore {
|
|
|
123
121
|
selectAccount(accountId: string | undefined): void;
|
|
124
122
|
/** Selected account id, for diagnostics and route assembly. */
|
|
125
123
|
selectedAccountId(): string | undefined;
|
|
126
|
-
/**
|
|
127
|
-
* Preferred account ordering used when no account is explicitly selected.
|
|
128
|
-
* An account with zero credit fails every chat request, so accounts with
|
|
129
|
-
* usable credit must win the default.
|
|
130
|
-
*/
|
|
131
|
-
setPreferAccountIds(ids: readonly string[]): void;
|
|
132
124
|
/** The auth-file path candidates, in probe order. */
|
|
133
125
|
private resolveDesktopCandidates;
|
|
134
126
|
/** The resolved desktop auth-file path, for diagnostics. */
|
|
@@ -156,9 +148,11 @@ declare class WorkBuddyCredentialStore {
|
|
|
156
148
|
*/
|
|
157
149
|
private readAll;
|
|
158
150
|
/**
|
|
159
|
-
*
|
|
160
|
-
* credential. Following the app's current sign-in is the documented
|
|
161
|
-
* behaviour; the backups exist so the user can switch explicitly.
|
|
151
|
+
* Default when no account is explicitly selected: the live sign-in, else the
|
|
152
|
+
* freshest credential. Following the app's current sign-in is the documented
|
|
153
|
+
* default behaviour; the backups exist so the user can switch explicitly.
|
|
154
|
+
* This is NOT credit-seeking — it never reorders accounts to find one with
|
|
155
|
+
* remaining credit.
|
|
162
156
|
*/
|
|
163
157
|
private preferred;
|
|
164
158
|
/** Token-free account list for the plugin card. */
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as defaultDesktopAuthCandidates, D as workbuddyAccountId, E as parseWorkBuddyAuth, O as workbuddyOwnAuthPath, S as authFileName, T as defaultDesktopAuthPath, _ as WorkBuddyCatalog, a as readHostHeartbeat, b as WORKBUDDY_AUTH_FILE_ENV, c as WORKBUDDY_CONNECT_VERSION, d as parseCreditMultiplier, f as parseReasoning, g as FALLBACK_WORKBUDDY_MODELS, h as regionOf, i as processStartTimeMs, l as WorkBuddyUpstreamClient, m as prepareChatBody, n as clearHostHeartbeat, o as workbuddyHostHeartbeatPath, p as parseUpstreamModel, r as isHeartbeatProcessAlive, s as writeHostHeartbeat, t as WORKBUDDY_HOST_HEARTBEAT_FILENAME, u as classifyUpstreamError, v as deriveCatalog, w as defaultDesktopAuthDirs, x as WorkBuddyCredentialStore, y as WORKBUDDY_AUTH_FILENAME } from "./host-heartbeat-
|
|
1
|
+
import { C as defaultDesktopAuthCandidates, D as workbuddyAccountId, E as parseWorkBuddyAuth, O as workbuddyOwnAuthPath, S as authFileName, T as defaultDesktopAuthPath, _ as WorkBuddyCatalog, a as readHostHeartbeat, b as WORKBUDDY_AUTH_FILE_ENV, c as WORKBUDDY_CONNECT_VERSION, d as parseCreditMultiplier, f as parseReasoning, g as FALLBACK_WORKBUDDY_MODELS, h as regionOf, i as processStartTimeMs, l as WorkBuddyUpstreamClient, m as prepareChatBody, n as clearHostHeartbeat, o as workbuddyHostHeartbeatPath, p as parseUpstreamModel, r as isHeartbeatProcessAlive, s as writeHostHeartbeat, t as WORKBUDDY_HOST_HEARTBEAT_FILENAME, u as classifyUpstreamError, v as deriveCatalog, w as defaultDesktopAuthDirs, x as WorkBuddyCredentialStore, y as WORKBUDDY_AUTH_FILENAME } from "./host-heartbeat-C9s6A0pP.js";
|
|
2
2
|
import z from "@deepseek-ai/schemastery";
|
|
3
3
|
import { installSettingsSection, settingsNamespace } from "@deepseek-ai/dsh-settings";
|
|
4
4
|
import { randomBytes, timingSafeEqual } from "node:crypto";
|
|
@@ -688,33 +688,6 @@ function apply(ctx, config) {
|
|
|
688
688
|
shim.close();
|
|
689
689
|
clearHostHeartbeat();
|
|
690
690
|
});
|
|
691
|
-
/**
|
|
692
|
-
* Prefer an account with usable credit. Every account yields the same
|
|
693
|
-
* catalog, but an account at zero credit fails each chat request, so the
|
|
694
|
-
* default must not land there.
|
|
695
|
-
*/
|
|
696
|
-
const selectPreferredCreditAccount = async () => {
|
|
697
|
-
try {
|
|
698
|
-
const accounts = await store.accounts();
|
|
699
|
-
const scored = [];
|
|
700
|
-
for (const account of accounts) try {
|
|
701
|
-
store.selectAccount(account.id);
|
|
702
|
-
const credential = await store.resolve();
|
|
703
|
-
const credits = await client.fetchCredits(credential);
|
|
704
|
-
scored.push({
|
|
705
|
-
id: account.id,
|
|
706
|
-
credits: credits.total
|
|
707
|
-
});
|
|
708
|
-
} catch (error) {
|
|
709
|
-
ctx.logger.warn(`dsh-connect-workbuddy: account ${account.id} unavailable for default selection`, error);
|
|
710
|
-
}
|
|
711
|
-
scored.sort((a, b) => b.credits - a.credits);
|
|
712
|
-
store.setPreferAccountIds(scored.filter((item) => item.credits > 0).map((item) => item.id));
|
|
713
|
-
store.selectAccount(current().accountId);
|
|
714
|
-
} catch (error) {
|
|
715
|
-
ctx.logger.warn("dsh-connect-workbuddy: default account selection failed; continuing", error);
|
|
716
|
-
}
|
|
717
|
-
};
|
|
718
691
|
shim.ready.then(async () => {
|
|
719
692
|
if (stopped) return;
|
|
720
693
|
let invalidate;
|
|
@@ -770,7 +743,6 @@ function apply(ctx, config) {
|
|
|
770
743
|
ctx.logger.error("dsh-connect-workbuddy: provider registration failed", error);
|
|
771
744
|
return;
|
|
772
745
|
}
|
|
773
|
-
await selectPreferredCreditAccount();
|
|
774
746
|
if (stopped) return;
|
|
775
747
|
(async () => {
|
|
776
748
|
try {
|
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": "1.
|
|
5
|
+
"version": "1.1.0",
|
|
6
6
|
"author": "dingminhua",
|
|
7
7
|
"copyright": "Copyright (c) 2026 LaoDing",
|
|
8
8
|
"license": "MIT",
|