dsh-workbuddy-free 0.0.0-stage → 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/README.md CHANGED
@@ -1,3 +1,67 @@
1
- # Temporary Holding Version
1
+ # dsh-workbuddy-free
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **WorkBuddy Free** — 用你的 WorkBuddy 桌面版账号, 在 [DeepSeek Harness](https://deepseek.com) 里直接使用腾讯混元 / 小米 MiMo / GLM / Kimi / DeepSeek 等 14 个模型。零外部 API key, 零额外费用。
4
+
5
+ **Use your WorkBuddy desktop account inside DeepSeek Harness: 14 chat models (Hunyuan Hy4, Xiaomi MiMo, GLM, Kimi, DeepSeek, MiniMax...). No external API keys.**
6
+
7
+ ## 功能
8
+
9
+ - **模型选择器分组** — 14 个与 WorkBuddy 应用完全一致的模型, 直接在 DSH 里选用
10
+ - **登录一次, 持续可用** — 从破甲版 WorkBuddy 自动捕获 JWT, 或手动粘贴; 28 天有效
11
+ - **真流式思考** — `reasoning_content` 实时渲染到思考面板, 不是攒完再显示
12
+ - **完整工具调用** — 工具定义转发、tool_calls 流式增量、tool 结果回传, 全链路实测
13
+ - **额度显示** — 设置页显示剩余额度百分比、重置时间、共享模型
14
+ - **指纹改写器** — 自动改写触发网关渠道校验(11128)的外部提示词指纹
15
+
16
+ ## 模型列表
17
+
18
+ | 模型 | 计费 | NSFW 实测 |
19
+ |---|---|---|
20
+ | Hy4 flash (`hy4flash-free`) | 免费 | ✗ |
21
+ | Hy4 (`hy4std`) | x0.29 | ✗ |
22
+ | Xiaomi MiMo-V2.6-Pro | x0.13 | ✓ 最佳 |
23
+ | MiniMax-M3.1-Flash | x0.08 | ✓ |
24
+ | DeepSeek-V4-Pro | x0.51 | 随机 |
25
+ | DeepSeek-V4.1-Flash | x0.11 | 随机 |
26
+ | GLM-5.3 / 5.3-Flash / 5.2 | x0.08-0.79 | ✗ |
27
+ | Kimi-K3.1-Pro / K3 / K2.8-Preview | x0.77-1.62 | ✗ |
28
+ | Step-5-Preview | x0.33 | 随机 |
29
+ | Space-Bunny | x0.08 | ✗ |
30
+
31
+ ## 安装
32
+
33
+ ```bash
34
+ # 在 DeepSeek Harness 里安装
35
+ # 设置 → 插件 → 安装 bundle → 选择本包目录
36
+ ```
37
+
38
+ 或使用 plugin_manager:
39
+
40
+ ```
41
+ install_bundle(target: "<本包目录的绝对路径>")
42
+ ```
43
+
44
+ ## 前置条件
45
+
46
+ 需要一台运行 **WorkBuddy 桌面版**(CodeBuddy 分支)的电脑。首次登录:
47
+
48
+ 1. DSH 设置 → WorkBuddy Free → 点「浏览器登录」— 自动打开登录页, 登录后 token 自动保存
49
+ 2. 完成。
50
+ JWT 有效期 28 天, 带 refresh_token 可静默续期
51
+
52
+
53
+ ## 工作原理
54
+
55
+ 插件内嵌了一个与 WorkBuddy 网关之间的转换层:
56
+
57
+ 1. **剥离服务端注入的内容政策**(DSH 侧不做审查)
58
+ 2. **改写竞品提示词指纹** — 触发网关渠道校验 11128 的根因是外部 harness 的系统提示词片段被网关指纹识别
59
+ 3. **每请求全新 ULID 请求 ID** — 防重放判定
60
+ 4. **附加完整官方客户端头** — 设备令牌等, 来自 `%TEMP%\wb-hook-dump.json`
61
+ 5. **模型名透传 + 429 自动重试** — 队列满时 3 次/15s 退避
62
+
63
+ ## 免责声明
64
+
65
+ - 本插件调用的是腾讯 WorkBuddy 的官方网关, 使用你自己的账号额度
66
+ - 破甲/越狱功能仅用于安全研究用途; 请遵守当地法律与服务条款
67
+ - 作者不对滥用行为负责
package/client.js ADDED
@@ -0,0 +1,279 @@
1
+ /**
2
+ * WorkBuddy Free — browser half.
3
+ *
4
+ * Contributes a settings section (settings.section id workbuddy-free) with:
5
+ * 1. login card (paste JWT / refresh from app / status)
6
+ * 2. keepalive switch + log
7
+ * 3. model roster (with NSFW verdicts + credits)
8
+ * 4. generation defaults (effort / context / max output / sanitizer)
9
+ * 5. probe (test gateway connection)
10
+ *
11
+ * Same-origin /api/workbuddy-free/* routes served by the Host half.
12
+ *
13
+ * Hand-written ModuleLoader bundle: no build step, no dependency beyond
14
+ * the react the shell already provides.
15
+ */
16
+ window.__ModuleLoader__.load({
17
+ id: 'dsh-workbuddy-free',
18
+ factory: require => {
19
+ const module = { exports: {} }
20
+ const exports = module.exports
21
+ const React = require('react')
22
+ const { createElement: h, Fragment, useState, useEffect, useMemo, useRef, useCallback } = React
23
+
24
+ const inject = ['slots', 'locale']
25
+ const name = 'workbuddy-free'
26
+ const NS = 'settings.workbuddyFree'
27
+
28
+ const EN = {
29
+ meta: { title: 'WorkBuddy Free' },
30
+ nav: 'WorkBuddy Free',
31
+ 'auth.title': 'Login',
32
+ 'auth.desc': 'Use your WorkBuddy desktop account. Run the patched WorkBuddy and send one message to capture the token automatically, or paste the JWT below.',
33
+ 'auth.pastePlaceholder': 'eyJhbGci...',
34
+ 'auth.pasteBtn': 'Save token',
35
+ 'auth.status': 'Status',
36
+ 'auth.active': 'Active',
37
+ 'auth.expired': 'Expired',
38
+ 'auth.none': 'Not logged in',
39
+ 'auth.account': 'Account',
40
+ 'auth.expiresAt': 'Expires',
41
+ 'auth.refresh': 'Refresh from app',
42
+ 'auth.clear': 'Clear',
43
+ 'auth.how': 'Open the patched WorkBuddy, send any chat message — the hook writes the fresh JWT to %TEMP%\\wb-auth.json. Click Refresh to import.',
44
+ 'keepalive.title': 'Auto keepalive',
45
+ 'keepalive.desc': 'Periodically sends a tiny request to keep the JWT fresh and the free quota warm.',
46
+ 'keepalive.enable': 'Enable',
47
+ 'keepalive.interval': 'Interval (min)',
48
+ 'keepalive.running': 'Running',
49
+ 'keepalive.stopped': 'Stopped',
50
+ 'models.title': 'Models',
51
+ 'models.desc': 'All models on your WorkBuddy account. NSFW column is from live tests.',
52
+ 'models.credits': 'Cost',
53
+ 'models.refresh': 'Re-scan',
54
+ 'models.nsfwY': 'Yes',
55
+ 'models.nsfwR': 'Random',
56
+ 'models.nsfwN': 'No',
57
+ 'gen.title': 'Generation',
58
+ 'gen.desc': 'Defaults for every turn on this provider.',
59
+ 'gen.effort': 'Reasoning effort',
60
+ 'gen.effortOff': 'Off',
61
+ 'gen.effortLight': 'Light (2K)',
62
+ 'gen.effortBalanced': 'Balanced (8K)',
63
+ 'gen.effortDeep': 'Deep (full)',
64
+ 'gen.effortHint': 'The gateway enforces effort as a token ceiling shared by thinking and answer.',
65
+ 'gen.ctx': 'Context window',
66
+ 'gen.maxOut': 'Max output',
67
+ 'gen.nsfwMode': 'Fingerprint sanitizer',
68
+ 'gen.nsfwHint': 'Rewrites competitor-prompt fingerprints that trigger gateway channel check 11128.',
69
+ 'status.title': 'Connection test',
70
+ 'status.probe': 'Test now',
71
+ 'status.probeOk': 'Gateway reachable',
72
+ 'status.probeFail': 'Gateway unreachable',
73
+ 'status.lastAnswer': 'Answer',
74
+ 'status.saved': 'Saved',
75
+ 'status.tokenSaved': 'Token saved',
76
+ 'status.tokenBad': 'Invalid JWT',
77
+ }
78
+ const ZH = {
79
+ 'meta.title': 'WorkBuddy Free',
80
+ 'nav': 'WorkBuddy Free',
81
+ 'auth.title': '登录',
82
+ 'auth.desc': '使用 WorkBuddy 桌面版账号。运行破甲版 WorkBuddy 并随便发一条消息即可自动捕获 token,或在下方手动粘贴 JWT。',
83
+ 'auth.pastePlaceholder': 'eyJhbGci...',
84
+ 'auth.pasteBtn': '保存 token',
85
+ 'auth.status': '状态',
86
+ 'auth.active': '已登录',
87
+ 'auth.expired': '已过期',
88
+ 'auth.none': '未登录',
89
+ 'auth.account': '账号',
90
+ 'auth.expiresAt': '过期时间',
91
+ 'auth.refresh': '从应用刷新',
92
+ 'auth.clear': '清除',
93
+ 'auth.how': '打开破甲版 WorkBuddy 随便发一条消息 — hook 自动把最新 JWT 写入 %TEMP%\\wb-auth.json。点「从应用刷新」导入。',
94
+ 'models.title': '模型列表',
95
+ 'models.desc': '账号可用的全部模型。NSFW 列来自实测。',
96
+ 'models.credits': '计费',
97
+ 'models.refresh': '重新扫描',
98
+ 'models.nsfwY': '支持',
99
+ 'models.nsfwR': '随机',
100
+ 'models.nsfwN': '不支持',
101
+ 'status.title': '连接测试',
102
+ 'status.probe': '测试',
103
+ 'status.probeOk': '网关可达',
104
+ 'status.probeFail': '网关不可达',
105
+ 'status.lastAnswer': '回答',
106
+ 'status.saved': '已保存',
107
+ 'status.tokenSaved': 'Token 已保存',
108
+ 'status.tokenBad': 'JWT 无效',
109
+ }
110
+
111
+ const CSS = `
112
+ .wbf_root{padding:16px;max-width:720px;font-size:13px;color:var(--dsw-alias-label-primary)}
113
+ .wbf_card{border:1px solid var(--dsw-alias-border-l2);border-radius:12px;padding:14px;margin-bottom:12px;background:var(--dsw-alias-bg-l1)}
114
+ .wbf_title{font-size:14px;font-weight:680;margin:0 0 4px}
115
+ .wbf_desc{font-size:12px;color:var(--dsw-alias-label-secondary);margin:0 0 10px;line-height:1.5}
116
+ .wbf_row{display:flex;align-items:center;gap:8px;margin:8px 0;flex-wrap:wrap}
117
+ .wbf_label{min-width:110px;font-size:12px;color:var(--dsw-alias-label-secondary)}
118
+ .wbf_input{flex:1;min-width:200px;padding:6px 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-l2);color:var(--dsw-alias-label-primary);font-size:12px;font-family:monospace}
119
+ .wbf_select{padding:6px 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-l2);color:var(--dsw-alias-label-primary);font-size:12px}
120
+ .wbf_btn{padding:6px 14px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-l2);color:var(--dsw-alias-label-primary);font-size:12px;cursor:pointer}
121
+ .wbf_btn:hover{background:var(--dsw-alias-bg-l3)}
122
+ .wbf_btn.primary{background:var(--dsw-alias-accent-bg,#3b82f6);color:#fff;border-color:transparent}
123
+ .wbf_badge{display:inline-block;padding:2px 8px;border-radius:10px;font-size:11px;font-weight:600}
124
+ .wbf_badge.ok{background:#10b98122;color:#10b981}
125
+ .wbf_badge.bad{background:#ef444422;color:#ef4444}
126
+ .wbf_badge.warn{background:#f59e0b22;color:#f59e0b}
127
+ .wbf_table{width:100%;border-collapse:collapse;font-size:12px}
128
+ .wbf_table th{text-align:left;padding:6px 8px;border-bottom:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);font-weight:600}
129
+ .wbf_table td{padding:6px 8px;border-bottom:1px solid var(--dsw-alias-border-l3)}
130
+ .wbf_log{font-size:11px;font-family:monospace;max-height:140px;overflow-y:auto;background:var(--dsw-alias-bg-l2);border-radius:8px;padding:8px}
131
+ .wbf_log_line{margin:2px 0;color:var(--dsw-alias-label-secondary)}
132
+ .wbf_toggle{position:relative;width:36px;height:20px;border-radius:10px;background:var(--dsw-alias-border-l2);cursor:pointer;transition:background .2s;flex-shrink:0}
133
+ .wbf_toggle.on{background:#10b981}
134
+ .wbf_toggle::after{content:'';position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:left .2s}
135
+ .wbf_toggle.on::after{left:18px}
136
+ .wbf_hint{font-size:11px;color:var(--dsw-alias-label-tertiary);margin-top:4px;line-height:1.4;flex:1;min-width:200px}
137
+ `
138
+
139
+ function Toggle({ on, onChange }) {
140
+ return h('div', { className: 'wbf_toggle' + (on ? ' on' : ''), onClick: () => onChange(!on) })
141
+ }
142
+
143
+ function App({ t, localeTag, ctx }) {
144
+ const [status, setStatus] = useState(null)
145
+ const [toast, setToast] = useState('')
146
+ const [probing, setProbing] = useState(false)
147
+ const [probeResult, setProbeResult] = useState(null)
148
+
149
+ const api = async (method, sub, body) => {
150
+ const res = await fetch(`/api/workbuddy-free${sub}`, {
151
+ method,
152
+ headers: { 'content-type': 'application/json' },
153
+ body: body ? JSON.stringify(body) : undefined,
154
+ })
155
+ return res.json()
156
+ }
157
+
158
+ const refresh = async () => setStatus(await api('GET', '/status'))
159
+ useEffect(() => { refresh() }, [])
160
+
161
+ const showToast = msg => { setToast(msg); setTimeout(() => setToast(''), 3000) }
162
+
163
+ if (!status) return h('div', { className: 'wbf_root' }, t('status.title') + '...')
164
+
165
+ const ts = status.token || {}
166
+ const st = status.settings || {}
167
+
168
+ return h('div', { className: 'wbf_root' },
169
+ h('style', null, CSS),
170
+ toast && h('div', { className: 'wbf_card', style: { borderColor: '#10b981' } }, toast),
171
+
172
+ // ---- login (browser login only) ----
173
+ h('div', { className: 'wbf_card' },
174
+ h('h3', { className: 'wbf_title' }, t('auth.title')),
175
+ h('p', { className: 'wbf_desc' }, t('auth.desc')),
176
+ h('div', { className: 'wbf_row' },
177
+ h('span', { className: 'wbf_label' }, t('auth.status')),
178
+ ts.state === 'active'
179
+ ? h('span', { className: 'wbf_badge ok' }, t('auth.active'))
180
+ : ts.state === 'expired'
181
+ ? h('span', { className: 'wbf_badge bad' }, t('auth.expired'))
182
+ : h('span', { className: 'wbf_badge warn' }, t('auth.none')),
183
+ ts.account && h('span', { className: 'wbf_label' }, t('auth.account') + ': ' + ts.account),
184
+ ts.expiresAt && h('span', { className: 'wbf_label' }, t('auth.expiresAt') + ': ' + new Date(ts.expiresAt).toLocaleString()),
185
+ ),
186
+ status.lastQuota && h('div', { className: 'wbf_row' },
187
+ h('span', { className: 'wbf_label' }, '额度'),
188
+ h('span', { className: 'wbf_badge ' + (status.lastQuota.percent >= 90 ? 'bad' : status.lastQuota.percent >= 70 ? 'warn' : 'ok') },
189
+ (100 - status.lastQuota.percent) + '% 可用'),
190
+ h('span', { className: 'wbf_label' },
191
+ '重置: ' + new Date(Number(status.lastQuota.reset_at) * 1000).toLocaleString() +
192
+ (status.lastQuota.shared_models?.length ? ' · 共享: ' + status.lastQuota.shared_models.join(', ') : '')),
193
+ ),
194
+ h('div', { className: 'wbf_row' },
195
+ h('button', {
196
+ className: 'wbf_btn primary',
197
+ onClick: async () => {
198
+ const r = await api('POST', '/login')
199
+ if (!r.ok || !r.session?.authUrl) { showToast('启动登录失败: ' + (r.session?.error || '?')); return }
200
+ window.open(r.session.authUrl, '_blank')
201
+ showToast('浏览器已打开, 登录后自动完成…')
202
+ const poll = setInterval(async () => {
203
+ const s = await api('GET', '/login')
204
+ if (!s.ok || !s.session) { clearInterval(poll); return }
205
+ if (s.session.status === 'ok') {
206
+ clearInterval(poll)
207
+ showToast('登录成功! Token 已保存')
208
+ refresh()
209
+ } else if (s.session.status === 'failed' || s.session.status === 'expired' || s.session.status === 'cancelled') {
210
+ clearInterval(poll)
211
+ showToast('登录未完成: ' + (s.session.error || s.session.status))
212
+ }
213
+ }, 1500)
214
+ },
215
+ }, '浏览器登录'),
216
+ ),
217
+ h('div', { className: 'wbf_hint' }, '点击按钮会在浏览器打开 WorkBuddy 登录页, 登录成功后 token 自动保存。无需手动粘贴。'),
218
+ ),
219
+ // ---- probe ----
220
+ h('div', { className: 'wbf_card' },
221
+ h('h3', { className: 'wbf_title' }, t('status.title')),
222
+ h('div', { className: 'wbf_row' },
223
+ h('button', {
224
+ className: 'wbf_btn primary', disabled: probing,
225
+ onClick: async () => {
226
+ setProbing(true); setProbeResult(null)
227
+ try { setProbeResult(await api('POST', '/probe')) } catch (e) { setProbeResult({ ok: false, error: e.message }) }
228
+ setProbing(false)
229
+ },
230
+ }, probing ? '...' : t('status.probe')),
231
+ probeResult && h('span', { className: 'wbf_badge ' + (probeResult.ok ? 'ok' : 'bad') },
232
+ probeResult.ok ? t('status.probeOk') : (probeResult.error || t('status.probeFail'))),
233
+ ),
234
+ probeResult?.answer && h('div', { className: 'wbf_hint' }, t('status.lastAnswer') + ': ' + probeResult.answer),
235
+ ),
236
+ )
237
+ }
238
+
239
+ function apply(ctx, config) {
240
+ // dictionaries
241
+ ctx.locale?.register?.(NS, { zh: ZH, en: EN })
242
+ // The shell binds t() to the namespace: it reads the active locale from the
243
+ // locale service and picks the right dictionary per call (survives switches).
244
+ const bound = typeof ctx.locale?.bind === 'function' ? ctx.locale.bind(NS) : null
245
+ const localeTag = () => {
246
+ try {
247
+ const snapshot = typeof ctx.locale?.getLocale === 'function' ? ctx.locale.getLocale() : ctx.locale?.getSnapshot?.()
248
+ const value = snapshot?.active ?? ctx.locale?.locale
249
+ return typeof value === 'string' ? value : document.documentElement.lang || 'en'
250
+ } catch { return 'en' }
251
+ }
252
+ const t = key => {
253
+ // bound t() handles dictionary lookup + fallback natively
254
+ if (bound) {
255
+ const v = bound(key)
256
+ if (v !== undefined && v !== key) return v
257
+ }
258
+ const dict = localeTag(ctx).startsWith('zh') ? ZH : EN
259
+ return key.split('.').reduce((o, k) => o?.[k], dict) ?? key
260
+ }
261
+
262
+ ctx.slots.inject('settings.section', () => ctx.slots.register({
263
+ name: 'settings.section',
264
+ id: 'workbuddy-free',
265
+ order: 36,
266
+ label: () => t('nav'),
267
+ locale: NS,
268
+ }, props => h(App, { ...props, t, localeTag: () => localeTag(ctx), ctx })))
269
+ }
270
+
271
+ exports.apply = apply
272
+ exports.inject = inject
273
+ exports.name = name
274
+
275
+ return module.exports
276
+ },
277
+ })
278
+
279
+
@@ -0,0 +1,5 @@
1
+ # dsh-workbuddy-free bundle patch.
2
+ - insert:
3
+ - id: workbuddy-free
4
+ name: 'dsh-workbuddy-free'
5
+ config: {}
package/docs/DETAIL.md ADDED
@@ -0,0 +1,3 @@
1
+ # WorkBuddy Free
2
+
3
+ 用 WorkBuddy 桌面版账号, 在 DSH 直接调用腾讯全部模型。
package/icon.svg ADDED
@@ -0,0 +1,11 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
2
+ <defs>
3
+ <linearGradient id="g" x1="0" y1="0" x2="1" y2="1">
4
+ <stop offset="0" stop-color="#1466f0"/>
5
+ <stop offset="1" stop-color="#8b5cf6"/>
6
+ </linearGradient>
7
+ </defs>
8
+ <rect x="4" y="4" width="56" height="56" rx="14" fill="url(#g)"/>
9
+ <path d="M20 22 L32 40 L44 22" stroke="#fff" stroke-width="5" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
10
+ <circle cx="32" cy="46" r="3" fill="#fff"/>
11
+ </svg>