dsh-workbuddy-helper 0.0.0-stage → 0.4.8
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/LICENSE +21 -0
- package/README.md +285 -3
- package/cordis.patch.yml +12 -0
- package/docs/INSTALLATION-AND-TEST-REPORT.md +580 -0
- package/docs/dsh-workbuddy-helper-design.md +1166 -0
- package/docs/ui-13-assistant-panel.png +0 -0
- package/docs/ui-14-connector-market.png +0 -0
- package/docs/ui-15-skill-market.png +0 -0
- package/docs/ui-16-armory-market.png +0 -0
- package/lib/auth.js +202 -0
- package/lib/bundle.js +396 -0
- package/lib/client.js +1481 -0
- package/lib/connector.js +155 -0
- package/lib/connectors.js +376 -0
- package/lib/index.js +372 -0
- package/lib/market.js +371 -0
- package/lib/portal.js +393 -0
- package/lib/session-plugin.js +97 -0
- package/lib/session.js +369 -0
- package/lib/skill-providers.js +156 -0
- package/lib/util.js +79 -0
- package/lib/webui.js +589 -0
- package/package.json +68 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 awswt
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,285 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# dsh-workbuddy-helper
|
|
2
|
+
|
|
3
|
+
DeepSeek Harness 插件:在当前会话内选择、切换、移除专家与技能,并把 WorkBuddy connector 的账号状态接入插件。
|
|
4
|
+
|
|
5
|
+
- 专家来源:WorkBuddy 在线市场(需要账号)+ 公开快照(离线兜底)+ 本机已安装专家
|
|
6
|
+
- 技能:专家自带技能 + 当前全局技能,按会话启用/停用
|
|
7
|
+
- 隔离:每个会话通过 `agent.ctx` 独立挂载,销毁即回滚;不写全局配置、不改技能文件
|
|
8
|
+
- 身份:默认 `auto`,优先复用 `dsh-connect-workbuddy` 的账号池访问在线市场;没有账号时退回公开快照
|
|
9
|
+
- 界面:输入框左侧「会话辅助」按钮 + 可视化面板(专家 / 技能 / 连接器三个页签,支持搜索与开关)
|
|
10
|
+
|
|
11
|
+
## 输入区面板
|
|
12
|
+
|
|
13
|
+
安装并重启后,对话输入框左侧是「会话辅助」按钮(选中专家后会在按钮上显示当前专家名)。
|
|
14
|
+
点击打开面板,三个页签相互独立:
|
|
15
|
+
|
|
16
|
+
**专家**:搜索 WorkBuddy 专家市场(10,000 位)与本机已安装专家;按分类筛选;一键切换或移除。
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
**技能**:搜索时先匹配本机已安装技能,再搜索 WorkBuddy 技能市场(需要登录 WorkBuddy 连接器);专家自带技能仅在未搜索时展示,不参与搜索。
|
|
21
|
+
|
|
22
|
+

|
|
23
|
+
|
|
24
|
+
**连接器**:上半区是本机连接器插件(如 dsh-windows-mcp),开关只影响当前会话的工具;下半区「连接器市场」从 WorkBuddy 连接器市场拉取(支持名称/描述搜索),显示来源图标与「已连接」状态,操作按钮为「复制 ID」(精确复制连接器 ID,不再误跳 GitHub);未登录时退回本地快照。市场连接器的授权由 WorkBuddy 客户端管理,已连接后其工具即可在本会话使用。
|
|
25
|
+
|
|
26
|
+

|
|
27
|
+
|
|
28
|
+
若本机安装了 **dsh-armory**,连接器市场直接复用它的 `remote.mcpManager` 服务:卡片网格、状态徽标、筛选、详情、安装与 OAuth 授权弹层(`wbOAuthBegin/Open/Poll/Cancel`)与军械库一致,凭据由军械库保存;未安装时回退 WorkBuddy 市场 + 复制 ID。
|
|
29
|
+
|
|
30
|
+
深色模式:主按钮等控件使用单色反色方案,两个主题都可读。
|
|
31
|
+
|
|
32
|
+
> 更新插件后请**完全重启 DSH**(不是只关闭会话)。插件热更新时若旧 webServer 路由未释放,会出现 `cannot get required service "agents" in inactive context`、专家切换无响应、技能市场 404。v0.4.6 起路由会随插件上下文释放,但当前进程里已残留的旧路由只有重启能清除。
|
|
33
|
+
|
|
34
|
+
面板由同源的 `/dsh-workbuddy-helper/*` JSON 路由驱动,不启动额外端口,也不把 token 暴露给浏览器。
|
|
35
|
+
|
|
36
|
+
## 两个市场入口(重要)
|
|
37
|
+
|
|
38
|
+
WorkBuddy 有两条完全不同的数据源,条数差异很大:
|
|
39
|
+
|
|
40
|
+
| 入口 | 地址 | 规模 | 是否需要登录 |
|
|
41
|
+
|---|---|---|---|
|
|
42
|
+
| 在线市场(App 实际使用) | `POST https://www.workbuddy.cn/portal/operation-platform/market/expert/list` | `total_count = 10000`,16 个分类 | 需要账号 token |
|
|
43
|
+
| 公开快照(CDN 静态清单) | `https://acc-1258344699.cos.accelerate.myqcloud.com/workbuddy/expert-marketplace/expert_center.json` | 429 个专家,15 个分类,`lastUpdated=2026-08-18` | 匿名可读 |
|
|
44
|
+
|
|
45
|
+
在线市场才是 App 里看到的列表。公开快照只是周期性发布的子集:本机已安装的
|
|
46
|
+
`rea-reverse-engineer`(REA 逆向功能分析专家 / 软件逆向分析工程师)和
|
|
47
|
+
`senior-fullstack-engineer`(高级全栈工程师)都能在线市场按 ID 查到,但都不在 429 条快照里。
|
|
48
|
+
|
|
49
|
+
插件默认 `marketMode: auto`:先查在线市场,失败或没有账号时退回快照,并在结果里返回
|
|
50
|
+
`source: portal|cos` 与 `warning`,不会再把快照条数当成市场总量。
|
|
51
|
+
|
|
52
|
+
## 安装
|
|
53
|
+
|
|
54
|
+
### 标准安装(npm)
|
|
55
|
+
|
|
56
|
+
插件发布到 npm 后,其他人使用:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
dsh plugin --profile <profile> add dsh-workbuddy-helper
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
当前环境没有 npm 发布凭据,尚未执行 `npm publish`;仓库已补齐 `files`、`publishConfig` 与打包验证。维护者发布:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm login
|
|
66
|
+
npm publish
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
发布后即可用上面的一行命令安装,不依赖 GitHub、SSH key 或 Git。
|
|
70
|
+
|
|
71
|
+
### 离线 tarball 安装(当前可用)
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm pack
|
|
75
|
+
dsh plugin --profile <profile> add /absolute/path/to/dsh-workbuddy-helper-0.2.7.tgz
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
也可以把 tarball 放到任意 HTTPS 静态地址,再用 URL 安装:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
dsh plugin --profile <profile> add https://your-cdn.example.com/dsh-workbuddy-helper-0.2.7.tgz
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 从 GitHub 安装(仅开发调试)
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
dsh plugin --profile <profile> add git+ssh://git@github.com/awswt/dsh-workbuddy-helper.git
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
这条命令可用,但不建议给最终用户:需要本机配置 GitHub SSH、Git 和 pnpm 的 Git 构建链,版本也不如 npm semver 直观。它适合开发者拉最新源码,不是标准分发方式。
|
|
91
|
+
|
|
92
|
+
### 本机开发安装
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
dsh plugin --profile <profile> add /absolute/path/to/dsh-workbuddy-helper
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
安装后重启对应 profile。插件会写入 profile 的 `dsh.profile.bundles`,不需要手动改 `cordis.patch.yml`。
|
|
99
|
+
|
|
100
|
+
## 使用
|
|
101
|
+
|
|
102
|
+
### 模型工具
|
|
103
|
+
|
|
104
|
+
工具名:`workbuddy_helper`
|
|
105
|
+
|
|
106
|
+
| action | 作用 |
|
|
107
|
+
|---|---|
|
|
108
|
+
| `status` | 当前会话的专家、技能、应用状态、connector 与认证状态 |
|
|
109
|
+
| `expert` | 选择专家,参数 `expertId` 可填专家 id、plugin slug 或 agentName |
|
|
110
|
+
| `off` | 移除当前会话的专家,恢复全部全局技能 |
|
|
111
|
+
| `skills` | 列出全局技能与专家技能,以及当前启用状态 |
|
|
112
|
+
| `set-skills` | 调整技能开关:`mode=all\|selected`、`names=a,b`、`expertNames=c,d` |
|
|
113
|
+
| `connector` | WorkBuddy connector 检测结果、账号数量、可用账号数(不含 token) |
|
|
114
|
+
| `market` | 搜索在线市场 + 本机已安装专家;结果带 `source=portal\|cos\|local`、`installed`、`marketTotal`,参数 `query` |
|
|
115
|
+
| `categories` | 在线市场的 16 个分类(快照兜底时为快照分类) |
|
|
116
|
+
|
|
117
|
+
示例:
|
|
118
|
+
|
|
119
|
+
```text
|
|
120
|
+
workbuddy_helper(action="connector")
|
|
121
|
+
workbuddy_helper(action="market", query="软件逆向分析工程师")
|
|
122
|
+
workbuddy_helper(action="market", query="逆向")
|
|
123
|
+
workbuddy_helper(action="expert", expertId="ex_QvM298ih8T8g")
|
|
124
|
+
workbuddy_helper(action="expert", expertId="rea-reverse-engineer")
|
|
125
|
+
workbuddy_helper(action="skills")
|
|
126
|
+
workbuddy_helper(action="off")
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 斜杠命令
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
/workbuddy-helper status
|
|
133
|
+
/workbuddy-helper market 内容
|
|
134
|
+
/workbuddy-helper expert ai-agent-engineer
|
|
135
|
+
/workbuddy-helper skills
|
|
136
|
+
/workbuddy-helper off
|
|
137
|
+
/workbuddy-helper connector
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
命令与工具都只作用于“发起调用的会话”,不需要 sessionId 参数,也不会影响其他会话。
|
|
141
|
+
|
|
142
|
+
## 配置
|
|
143
|
+
|
|
144
|
+
```yaml
|
|
145
|
+
- insert:
|
|
146
|
+
- id: workbuddy-helper
|
|
147
|
+
name: dsh-workbuddy-helper
|
|
148
|
+
config:
|
|
149
|
+
enabled: true
|
|
150
|
+
marketMode: auto
|
|
151
|
+
authMode: auto
|
|
152
|
+
portalBaseUrl: https://www.workbuddy.cn
|
|
153
|
+
portalPrefix: /portal
|
|
154
|
+
marketBaseUrl: https://acc-1258344699.cos.accelerate.myqcloud.com/workbuddy/expert-marketplace
|
|
155
|
+
manifestPath: /expert_center.json
|
|
156
|
+
timeoutMs: 20000
|
|
157
|
+
retries: 1
|
|
158
|
+
cacheTtlMs: 21600000
|
|
159
|
+
staleWhileErrorMs: 604800000
|
|
160
|
+
maxPromptChars: 60000
|
|
161
|
+
maxSelectedSkills: 64
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
| 字段 | 默认 | 说明 |
|
|
165
|
+
|---|---|---|
|
|
166
|
+
| `enabled` | `true` | 总开关 |
|
|
167
|
+
| `marketMode` | `auto` | `auto`(在线优先,快照兜底) / `portal`(只在线) / `cos`(只快照) |
|
|
168
|
+
| `authMode` | `auto` | `auto`(有 connector token 就用)/ `none` / `bearer` / `header` / `cookie` / `workbuddy-connector` |
|
|
169
|
+
| `credentialRef` | `WB_EXPERT_TOKEN` | DSH 凭据服务中的键名,仅 `bearer/header/cookie` 使用 |
|
|
170
|
+
| `headerName` | `Authorization` | 认证头名 |
|
|
171
|
+
| `headerPrefix` | `Bearer ` | 认证头前缀 |
|
|
172
|
+
| `connectorRegion` | 自动 | `cn / global`,仅 connector 模式使用 |
|
|
173
|
+
| `portalBaseUrl` | `https://www.workbuddy.cn` | 在线市场基址;账号记录里的 `domain` 会覆盖它 |
|
|
174
|
+
| `portalPrefix` | `/portal` | 在线市场路由前缀 |
|
|
175
|
+
| `marketBaseUrl` | 公开快照基址 | 必须是 HTTPS,且在 `allowHosts` 内 |
|
|
176
|
+
| `allowHosts` | 快照 + `www.workbuddy.cn` / `www.workbuddy.ai` / `openplatform-cdn.codebuddy.cn` | 允许接收凭据或下载的 host |
|
|
177
|
+
| `allowInsecureLoopback` | `false` | 仅本地测试使用 |
|
|
178
|
+
| `allowPublicMarketAuth` | `false` | 允许把 connector token 发到公开快照 host;默认拒绝,防止误配泄露 |
|
|
179
|
+
| `maxPromptChars` | `60000` | 专家提示词截断上限 |
|
|
180
|
+
| `maxSelectedSkills` | `64` | 单会话技能上限 |
|
|
181
|
+
| `dataDir` | `$DSH_HOME/workbuddy-helper` | sidecar 与缓存目录 |
|
|
182
|
+
| `localRoots` | 两个 WorkBuddy 目录 | 本地专家来源,只读 |
|
|
183
|
+
|
|
184
|
+
## WorkBuddy connector 接入
|
|
185
|
+
|
|
186
|
+
插件只读 `dsh-connect-workbuddy` 的账号库:
|
|
187
|
+
|
|
188
|
+
```text
|
|
189
|
+
$DSH_HOME/workbuddy-vault/<region>/<accountId>.json
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
行为:
|
|
193
|
+
|
|
194
|
+
- `connector` 动作返回 `installed / profile / version / accountCount / usableAccountCount / accounts`;
|
|
195
|
+
- 账号 id 与昵称做掩码,token 永远不出现在 `status()`;
|
|
196
|
+
- 不刷新 token、不写 vault、不解密;
|
|
197
|
+
- `authMode: auto`(默认)时,在线市场请求使用第一个未过期账号的 `accessToken`,基址取该账号的 `auth.domain`;
|
|
198
|
+
- `authMode: workbuddy-connector` 是它的严格版本:没有可用 token 就报错,不会退回快照;
|
|
199
|
+
- token 只会发往 `allowHosts` 内的 host,且只发给在线市场 API;签名 CDN 下载 URL 不带 Authorization 头。
|
|
200
|
+
|
|
201
|
+
企业网关或需要鉴权的市场:
|
|
202
|
+
|
|
203
|
+
```yaml
|
|
204
|
+
authMode: workbuddy-connector
|
|
205
|
+
allowHosts:
|
|
206
|
+
- your-enterprise-gateway.example.com
|
|
207
|
+
marketBaseUrl: https://your-enterprise-gateway.example.com/workbuddy/expert-marketplace
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
或使用 DSH 凭据服务:
|
|
211
|
+
|
|
212
|
+
```yaml
|
|
213
|
+
authMode: bearer
|
|
214
|
+
credentialRef: WB_EXPERT_TOKEN
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
凭据通过 DSH 的 credentials 服务写入,配置里只出现键名。
|
|
218
|
+
|
|
219
|
+
## 会话隔离
|
|
220
|
+
|
|
221
|
+
- 选择专家时,插件在 `agent.ctx` 下挂载一个子插件:`systemPrompt.section` + 两个技能 provider。
|
|
222
|
+
- `workbuddy-helper-expert-<gen>`(rank 200)提供专家自带技能。
|
|
223
|
+
- `workbuddy-helper-filter-<gen>`(rank 1000)影子化全局技能,未选中的设为不可调用。
|
|
224
|
+
- 新 fiber 挂载成功后才销毁旧 fiber;失败时旧人格保留。
|
|
225
|
+
- 状态写入 `$DSH_HOME/workbuddy-helper/sessions/<sha256(sessionId)>.json`,`agent/created` 时恢复。
|
|
226
|
+
- 子代理与 fork 默认不继承;它们有独立的 Agent/Session。
|
|
227
|
+
|
|
228
|
+
## 安全
|
|
229
|
+
|
|
230
|
+
- 专家包是数据,不是代码:只读 markdown/资源,不执行脚本,不 `npm install`。
|
|
231
|
+
- 解包拒绝绝对路径、`..`、符号链接/硬链接,限制条目数与解压体积;在线市场的 ZIP 与快照的 tar.gz 都走同一套白名单。
|
|
232
|
+
- 专家提示词以 `<expert_selection>` 包裹,转义闭合标签,并声明不得覆盖安全规则、工具权限与危险操作确认。
|
|
233
|
+
- 凭据只发往 allow-list 的 HTTPS host;重定向逐跳校验;错误与日志不包含 token。
|
|
234
|
+
- 市场内容仍可能包含提示注入,权限系统与用户确认仍是最后防线,不承诺 100% 免疫。
|
|
235
|
+
|
|
236
|
+
## 数据与缓存
|
|
237
|
+
|
|
238
|
+
```text
|
|
239
|
+
$DSH_HOME/workbuddy-helper/
|
|
240
|
+
├─ cache/
|
|
241
|
+
│ ├─ manifest.json
|
|
242
|
+
│ ├─ manifest.meta.json
|
|
243
|
+
│ ├─ bundles/
|
|
244
|
+
│ └─ downloads/
|
|
245
|
+
└─ sessions/
|
|
246
|
+
└─ <sha256(sessionId)>.json
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
清理缓存不会影响会话选择;下次使用会重新下载。
|
|
250
|
+
|
|
251
|
+
## 开发与测试
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
npm install
|
|
255
|
+
npm test
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
当前测试覆盖:提示词转义、HTTPS/host 允许列表、内联密钥拒绝、WorkBuddy connector 只读解析、在线市场接口与 Bearer 头、在线优先/快照兜底、ZIP 与 tar 解包、路径穿越、本机专家解析、输入区面板的同源路由与跨源拒绝。
|
|
259
|
+
|
|
260
|
+
UI 冒烟(需要 Playwright + 本机 Edge):
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
dsh --profile <web-profile> --no-open --port 3131
|
|
264
|
+
node .workbuddy/tmp/ui-smoke3.mjs # 三页签:专家/技能(搜索)/连接器
|
|
265
|
+
# 可选:装一个真实连接器验证开关
|
|
266
|
+
# dsh plugin --profile <web-profile> add dsh-windows-mcp
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### 手工端到端测试(假模型)
|
|
270
|
+
|
|
271
|
+
`test/fake-model-e2e.mjs` 与 `test/fake-model-expert-e2e.mjs` 会启动一个本地 Messages 兼容 SSE 服务,冒充模型返回 `workbuddy_helper` 工具调用,用来验证真实 DSH 宿主里的工具执行、专家提示段与技能目录注入。需要先安装到测试 profile,并设置:
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
DSH_APP_EXE="D:/Program Files/deepseek harness/DeepSeek Harness.exe" DSH_BIN="D:/Program Files/deepseek harness/resources/app.asar/dsh/node_modules/@deepseek-ai/dsh/lib/bin.js" DSH_TEST_PROFILE=workbuddy-helper-gh node test/fake-model-expert-e2e.mjs
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
脚本不会访问真实模型,也不会消耗 token;假 token 只发给本地 127.0.0.1 服务。
|
|
278
|
+
|
|
279
|
+
设计文档:[docs/dsh-workbuddy-helper-design.md](docs/dsh-workbuddy-helper-design.md)
|
|
280
|
+
|
|
281
|
+
安装与测试报告:[docs/INSTALLATION-AND-TEST-REPORT.md](docs/INSTALLATION-AND-TEST-REPORT.md)
|
|
282
|
+
|
|
283
|
+
## License
|
|
284
|
+
|
|
285
|
+
MIT
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# dsh-workbuddy-helper bundle patch.
|
|
2
|
+
# `dsh plugin --profile <name> add <package>` appends this bundle to
|
|
3
|
+
# dsh.profile.bundles and applies this layer, so the host half mounts without
|
|
4
|
+
# editing the profile patch by hand.
|
|
5
|
+
- insert:
|
|
6
|
+
- id: workbuddy-helper
|
|
7
|
+
name: dsh-workbuddy-helper
|
|
8
|
+
config:
|
|
9
|
+
enabled: true
|
|
10
|
+
marketMode: auto
|
|
11
|
+
authMode: auto
|
|
12
|
+
portalBaseUrl: https://www.workbuddy.cn
|