dsh-deepseek-whale 0.17.3 → 0.17.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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.17.4 — 2026-11-25
4
+
5
+ - 修复 DSH 桌面端启用失败:`tools`/`agents` 改为可选注入,宿主没有 tools 服务时插件也能启动
6
+ - `balance_whale` 在 tools 服务可用时自动注册;agents 可用时自动接上回复回传/朗读
7
+
3
8
  ## 0.17.3 — 2026-11-25
4
9
 
5
10
  - 新增页面内快捷键设置:菜单 / 设置里的「快捷键设置…」,可改语音输入 / 刷新余额 / 停止动作 / 打开菜单 / 打开设置 / 用量记录
package/README.md CHANGED
@@ -89,7 +89,7 @@
89
89
 
90
90
  ```bash
91
91
  npx --yes @deepseek-ai/dsh@0.2.1-rc.2 plugin --profile web add "D:/src/dsh-deepseek-whale"
92
- # 或已打包:npx --yes @deepseek-ai/dsh@0.2.1-rc.2 plugin --profile web add "D:/src/dsh-deepseek-whale/dsh-deepseek-whale-0.17.3.tgz"
92
+ # 或已打包:npx --yes @deepseek-ai/dsh@0.2.1-rc.2 plugin --profile web add "D:/src/dsh-deepseek-whale/dsh-deepseek-whale-0.17.4.tgz"
93
93
  ```
94
94
 
95
95
  安装后必须重启 `dsh web` 进程,再在浏览器 Ctrl+F5;只刷新页面不会重新加载 bundle。
@@ -97,13 +97,13 @@ npx --yes @deepseek-ai/dsh@0.2.1-rc.2 plugin --profile web add "D:/src/dsh-deeps
97
97
  ### DeepSeek Harness 桌面端
98
98
 
99
99
  桌面端的 profile 由客户端独占管理,CLI 不允许写入。请通过客户端的插件管理器安装本地包
100
- `D:\src\dsh-deepseek-whale\dsh-deepseek-whale-0.17.3.tgz`(或源目录),版本不匹配时由主人本人确认风险。
100
+ `D:\src\dsh-deepseek-whale\dsh-deepseek-whale-0.17.4.tgz`(或源目录),版本不匹配时由主人本人确认风险。
101
101
  装完完全退出客户端再打开。
102
102
 
103
103
  ## 更新
104
104
 
105
- - **Web(link 安装)**:直接改 `D:/src/dsh-deepseek-whale` 源码,重启 `dsh web` 宿主进程,再 Ctrl+F5。当前版本 **0.17.3**。
106
- - **桌面端**:用新版 tgz(`dsh-deepseek-whale-0.17.3.tgz`)在插件管理器里重新安装 / 更新,包名不变会覆盖旧版本;完全退出客户端再打开。
105
+ - **Web(link 安装)**:直接改 `D:/src/dsh-deepseek-whale` 源码,重启 `dsh web` 宿主进程,再 Ctrl+F5。当前版本 **0.17.4**。
106
+ - **桌面端**:用新版 tgz(`dsh-deepseek-whale-0.17.4.tgz`)在插件管理器里重新安装 / 更新,包名不变会覆盖旧版本;完全退出客户端再打开。
107
107
 
108
108
  ## 与现有插件的关系
109
109
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-deepseek-whale",
3
- "version": "0.17.3",
3
+ "version": "0.17.4",
4
4
  "description": "余额鲸 — whale-girl balance / usage companion for DeepSeek Harness",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -82,7 +82,7 @@ function serveFile(res, file, type) {
82
82
  }
83
83
 
84
84
  export const name = 'deepseek-whale'
85
- export const inject = ['webServer', 'credentials', 'tools', 'agents']
85
+ export const inject = ['webServer', 'credentials']
86
86
 
87
87
  export function apply(ctx) {
88
88
  fs.mkdirSync(DATA_DIR, { recursive: true })
@@ -135,6 +135,7 @@ export function apply(ctx) {
135
135
  const pendingReplies = new Map()
136
136
  const activeAttempts = new Map()
137
137
  let lastSay = null
138
+ let agentsService = null
138
139
 
139
140
  function cleanReply(value) {
140
141
  return String(value || '')
@@ -174,42 +175,47 @@ export function apply(ctx) {
174
175
  broadcast({ type: 'reply', text, agent: agentId, at: Date.now() })
175
176
  }
176
177
 
177
- const offStream = ctx.on?.('agent/assistant-stream', ({ agent, frame } = {}) => {
178
- if (!agent || !frame) return
179
- const pending = pendingReplies.get(agent.id)
180
- if (!pending || !pending.armed) return
181
- if (frame.type === 'start') {
182
- pending.started = true
183
- activeAttempts.set(agent.id, { id: frame.attemptId, text: '' })
184
- } else if (frame.type === 'chunk') {
185
- const attempt = activeAttempts.get(agent.id)
186
- if (!attempt || attempt.id !== frame.attemptId) return
187
- if (frame.chunk?.type === 'text-delta') attempt.text += frame.chunk.text || ''
188
- } else if (frame.type === 'end') {
189
- const attempt = activeAttempts.get(agent.id)
190
- if (!attempt || attempt.id !== frame.attemptId) return
191
- if (attempt.text.trim()) pending.lastText = attempt.text
192
- activeAttempts.delete(agent.id)
193
- }
194
- })
195
- const offClaimed = ctx.on?.('agent/inbox/claimed', ({ agent, message } = {}) => {
196
- if (!agent || !message) return
197
- const pending = pendingReplies.get(agent.id)
198
- if (pending && pending.messageId === message.id) pending.armed = true
199
- })
200
- const offStatus = ctx.on?.('agent/status', ({ agent, status } = {}) => {
201
- if (!agent || status !== 'idle') return
202
- const pending = pendingReplies.get(agent.id)
203
- if (pending?.started) finishPending(agent.id)
204
- })
205
- ctx.effect(() => () => {
206
- try { offStream?.() } catch {}
207
- try { offClaimed?.() } catch {}
208
- try { offStatus?.() } catch {}
209
- for (const pending of pendingReplies.values()) clearTimeout(pending.timer)
210
- pendingReplies.clear()
211
- activeAttempts.clear()
212
- })
178
+ function registerAgentBridge(agentCtx) {
179
+ agentsService = agentCtx.agents
180
+ const offStream = agentCtx.on?.('agent/assistant-stream', ({ agent, frame } = {}) => {
181
+ if (!agent || !frame) return
182
+ const pending = pendingReplies.get(agent.id)
183
+ if (!pending || !pending.armed) return
184
+ if (frame.type === 'start') {
185
+ pending.started = true
186
+ activeAttempts.set(agent.id, { id: frame.attemptId, text: '' })
187
+ } else if (frame.type === 'chunk') {
188
+ const attempt = activeAttempts.get(agent.id)
189
+ if (!attempt || attempt.id !== frame.attemptId) return
190
+ if (frame.chunk?.type === 'text-delta') attempt.text += frame.chunk.text || ''
191
+ } else if (frame.type === 'end') {
192
+ const attempt = activeAttempts.get(agent.id)
193
+ if (!attempt || attempt.id !== frame.attemptId) return
194
+ if (attempt.text.trim()) pending.lastText = attempt.text
195
+ activeAttempts.delete(agent.id)
196
+ }
197
+ })
198
+ const offClaimed = agentCtx.on?.('agent/inbox/claimed', ({ agent, message } = {}) => {
199
+ if (!agent || !message) return
200
+ const pending = pendingReplies.get(agent.id)
201
+ if (pending && pending.messageId === message.id) pending.armed = true
202
+ })
203
+ const offStatus = agentCtx.on?.('agent/status', ({ agent, status } = {}) => {
204
+ if (!agent || status !== 'idle') return
205
+ const pending = pendingReplies.get(agent.id)
206
+ if (pending?.started) finishPending(agent.id)
207
+ })
208
+ agentCtx.effect(() => () => {
209
+ agentsService = null
210
+ try { offStream?.() } catch {}
211
+ try { offClaimed?.() } catch {}
212
+ try { offStatus?.() } catch {}
213
+ for (const pending of pendingReplies.values()) clearTimeout(pending.timer)
214
+ pendingReplies.clear()
215
+ activeAttempts.clear()
216
+ })
217
+ }
218
+ ctx.inject(['agents'], registerAgentBridge)
213
219
 
214
220
  let ledger = null
215
221
  try {
@@ -350,7 +356,7 @@ export function apply(ctx) {
350
356
  const WHALE_PANELS = new Set(['usage', 'memories', 'providers', 'settings', 'bubble_editor', 'sound_settings', 'characters', 'pet_menu', 'snap_settings'])
351
357
 
352
358
  function pickAgent(sessionId) {
353
- const registry = ctx.agents
359
+ const registry = agentsService
354
360
  if (!registry || typeof registry.list !== 'function') return null
355
361
  let list = []
356
362
  try { list = registry.list() || [] } catch { return null }
@@ -388,7 +394,8 @@ export function apply(ctx) {
388
394
  }
389
395
  }
390
396
 
391
- const offWhaleTool = ctx.tools.register(defineTool({
397
+ function registerWhaleTool(toolCtx) {
398
+ const offWhaleTool = toolCtx.tools.register(defineTool({
392
399
  name: 'balance_whale',
393
400
  description: 'Control the 余额鲸 desktop whale widget in DeepSeek Harness. Use it to read the whale balance / usage status, make the whale say a line, play an animation, open a whale panel, refresh balances, resize it, toggle its bubbles, or hide it. The whale name, personality, and speaking style are configured by the user on the DeepSeek / DSH side; this tool only controls the widget and returns local status. Compose say text in the current assistant persona.',
394
401
  parameters: {
@@ -498,7 +505,9 @@ export function apply(ctx) {
498
505
  return { ok: true, action, delivered, detail }
499
506
  },
500
507
  }))
501
- ctx.effect(() => () => { try { offWhaleTool?.() } catch {} })
508
+ toolCtx.effect(() => () => { try { offWhaleTool?.() } catch {} })
509
+ }
510
+ ctx.inject(['tools'], registerWhaleTool)
502
511
 
503
512
  async function buildState(force = false) {
504
513
  const balance = await getBalance(force)