dsh-task-mascot 2.1.0 → 2.1.2

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
@@ -9,12 +9,25 @@
9
9
 
10
10
  ## 安装
11
11
 
12
+ > 已验证:**DSH 0.2.2-rc.2**(npm `next`,2026-11-12,Linux · `dsh web`;此前 2.1.1 已在 0.2.2-rc.1 验证安装路径)。要求 dsh ≥ 0.2.0-rc.2、Node ≥ 22.19。
13
+
14
+ **`dsh web`(命令行)**
15
+
12
16
  ```bash
13
- dsh plugin --profile web add github:sherconan/dsh-task-mascot
17
+ dsh plugin --profile web add github:sherconan/dsh-task-mascot # 或 npm 包:dsh-task-mascot
14
18
  ```
15
19
 
16
- 然后重启 `dsh web`。安装后会自动加入 web profile 的 bundles;设置入口:Settings → **任务角色 Mascot**。
17
- 要求 dsh ≥ 0.2.0-rc.2、Node ≥ 22.19。
20
+ 然后重启 `dsh web`。安装会自动把插件加进 web profile 的 bundles,不用手改配置。
21
+
22
+ **`dsh web`(界面里装)**:左侧栏 **Plugins(插件)** → **Add plugin(添加插件)** → 输入 `dsh-task-mascot` → **Install(安装)** → 打开插件卡片右侧的开关(启用),刷新页面即可。
23
+
24
+ **DSH Desktop(桌面版)**:Desktop 用自己独占的 `desktop` profile,上面 `--profile web` 的命令装进的是 web profile,**Desktop 里看不到**;npm 装的 `dsh` 也不能改 Desktop 的 profile。请在 Desktop 里按同样步骤 **Plugins → Add plugin → `dsh-task-mascot`** 安装并启用;或者用 Desktop 自带的 dsh 命令(应用菜单「管理 dsh 命令…」安装),先完全退出 Desktop,再运行 `dsh plugin --profile desktop add dsh-task-mascot`,重新打开即可。(以上 Desktop 步骤依据 [官方 Desktop 文档](https://github.com/deepseek-ai/deepseek-harness/blob/master/apps/desktop/README.zh.md#bundled-command-runtime),尚未在 Desktop 实机验证,遇到问题欢迎提 issue。)
25
+
26
+ **设置入口**(0.2.1 起没有独立的 Settings 页面):左下角 **More(更多)→ Settings(设置)→ 任务角色 Mascot**。插件页里 dsh-task-mascot 的卡片只有启用开关和说明页,配置项不在卡片上。
27
+
28
+ ![DSH 0.2.2-rc.1 里的设置入口](docs/screenshot-settings-dsh-0.2.2.png)
29
+
30
+ 旧版本:0.2.0 及更早的设置入口在 Settings 页面里,同样找「任务角色 Mascot」(本次没有在旧版重测)。
18
31
 
19
32
  ## 特点
20
33
 
@@ -32,12 +45,12 @@ dsh plugin --profile web add github:sherconan/dsh-task-mascot
32
45
  | 映射 | 写死 | 设置里可编辑 **工具 → 动画** 映射规则(正则) |
33
46
  | 体积 | — | 两个角色包合计约 18 MB(VP9 透明 webm + Safari 用 WebP 兜底) |
34
47
 
35
- 其他细节:每步至少停留 600 ms 排队播放不丢步;流式参数只显示已闭合的值不闪烁;三种展示面(内联卡片 / 输入框上方 Dock 条 / 悬浮宠物)可任意组合;宠物可拖动、双击归位;可选提示音(默认关)。
48
+ 其他细节:每步至少停留 600 ms 排队播放不丢步;流式参数只显示已闭合的值不闪烁;三种展示面(内联卡片 / 输入框上方 Dock 条 / 悬浮宠物)可任意组合,默认内联卡片在视野里时不再重复显示 Dock 条,卡片滚出视野才出现(设置里「状态条何时显示」可改成「总是」);宠物可拖动、双击归位;可选提示音(默认关)。
36
49
 
37
50
  ![search](docs/screenshot-search.png)
38
51
  ![approval](docs/screenshot-approval.png)
39
52
 
40
- - **大肥鱼图鉴(2.1.0)**:31 格收集卡,Agent 第一次触发某种动作(写代码、搜索、跑测试、出错……)时点亮一格并弹出「新解锁!」动画。设置页「打开图鉴」或右键悬浮角色查看;进度只存在本地 localStorage。
53
+ - **大肥鱼图鉴(2.1.0)**:31 格收集卡,Agent 第一次触发某种动作(写代码、搜索、跑测试、出错……)时点亮一格,右上角弹出一张不挡对话的「新解锁」小提示(短时间内连续解锁会合并成一张,点它打开图鉴)。设置页「打开图鉴」或右键悬浮角色查看;进度只存在本地 localStorage。
41
54
 
42
55
  ## 工具 → 动画映射 / Tool → state mapping
43
56
 
@@ -48,16 +61,18 @@ First match wins (`tool`/`ext` are regexes; `ext` = target file extension). Edit
48
61
 
49
62
  | dsh 工具 / tools | 状态 / state | 大肥鱼实际动画 |
50
63
  |---|---|---|
51
- | `write` / `edit` / `str_replace_editor` 且目标是 md/txt/rst/doc/tex | `writingdoc` 写文档 | editing(回退)|
64
+ | `write` / `edit` / `str_replace_editor` / `apply_patch` 且目标是 md/txt/rst/doc/tex | `writingdoc` 写文档 | editing(回退)|
52
65
  | `write` | `coding` 写代码 | coding |
53
- | `edit`, `str_replace_editor` | `editing` 改代码 | editing |
54
- | `read`, `read_image`, `read_mcp_resource`, `lsp` | `reading` 读文件 | reading |
66
+ | `edit`, `str_replace_editor`, `apply_patch` | `editing` 改代码 | editing |
67
+ | `read`, `read_image`, `read_mcp_resource`, `lsp`, `user_terminal_list`, `user_terminal_read` | `reading` 读文件 | reading |
55
68
  | `glob`, `grep`, `session_*`, `web_search`, `web_fetch`, `stagehand_*` | `search` 搜索 | search |
56
69
  | `bash`, `pwsh`, `terminal_*`, `job_*` | `cmd` 跑命令 | cmd |
57
- | `run_code`, `workflow` | `data` 跑数据 | reading(回退)|
70
+ | `run_code`, `workflow`, `office_recalculate` | `data` 跑数据 | reading(回退)|
71
+ | `office_convert`, `office_render` | `writingdoc` 写文档 | editing(回退)|
58
72
  | `todo_write`, `exit_plan_mode`, `*_goal`, `schedule_*` | `planning` 做计划 | planning |
59
- | `subagent`, `send_message`, `list_agents`, `interrupt_agent`, `spawn_teammate`, `team_task_*`, `ralph` | `subagents` 派子代理 | subagents |
60
- | `ask_user_question` | `waiting` 等你 | waiting |
73
+ | `subagent`, `subagent_fork`, `subagent_oar`, `send_message`, `list_agents`, `interrupt_agent`, `spawn_teammate`, `wait_agent`, `team_task_*`, `ralph` | `subagents` 派子代理 | subagents |
74
+ | `ask_user_question`, `propose_action` | `waiting` 等你确认 | waiting |
75
+ | `list_mcp_resources`, `list_mcp_resource_templates`, `mcp__*` | `mcp` 调用 MCP | tools(回退)|
61
76
  | `present` | `summary` 总结 | thinking(回退)|
62
77
  | 其它 (MCP 等) / anything else | `tools` | cmd(回退)|
63
78
 
@@ -152,6 +167,10 @@ E2E 脚本在 `test/e2e/`(Playwright),截图输出到 `qa/`(已 gitignor
152
167
  - Swappable character packs (ships Whale Girl 大肥鱼 and Claude娘) and an editable tool→animation mapping. ~13 MB.
153
168
  - Runs fully locally; makes no external network calls.
154
169
 
155
- Install: `dsh plugin --profile web add github:sherconan/dsh-task-mascot`, then restart `dsh web`.
170
+ Install (verified on **DSH 0.2.2-rc.2**, Linux, `dsh web`; 2.1.1 was verified on 0.2.2-rc.1; requires dsh ≥ 0.2.0-rc.2, Node ≥ 22.19):
171
+
172
+ - `dsh web`: `dsh plugin --profile web add github:sherconan/dsh-task-mascot` (or the npm package `dsh-task-mascot`), then restart `dsh web`. Or in the UI: **Plugins → Add plugin → `dsh-task-mascot` → Install**, turn on the switch on its card, and refresh.
173
+ - DSH Desktop: Desktop owns its own `desktop` profile, so a `--profile web` install does **not** show up there. Install from Desktop's **Plugins → Add plugin**, or quit Desktop and run its bundled `dsh plugin --profile desktop add dsh-task-mascot`. (Per the [official Desktop docs](https://github.com/deepseek-ai/deepseek-harness/blob/master/apps/desktop/README.md#bundled-command-runtime); not yet tested on Desktop.)
174
+ - Settings: from 0.2.1 there is no standalone Settings page. Open **More (bottom-left) → Settings → 任务角色 Mascot**. The plugin's card on the Plugins page only has the enable switch and the readme. On 0.2.0 and older, look for the same section in Settings.
156
175
 
157
176
  Code MIT © metsh. Artwork: 大肥鱼 CC BY-NC-SA 4.0 (「溟月」 by 上善无形 → ZipZipPipe → community 大肥鱼; via TreapGoGo/deepseek-whale-girl), Claude娘 CC BY-SA 4.0 — see ART_LICENSE.md. Unofficial; not affiliated with DeepSeek or Anthropic.
package/lib/client.js CHANGED
@@ -19,21 +19,22 @@ window.__ModuleLoader__.load({
19
19
  { tool: '^(bash|pwsh)$', cmd: '(^|[;&|]\\s*)(sudo\\s+)?((npm|pnpm|yarn|bun)\\s+(i|install|add|ci)|pip3?\\s+install|uv\\s+(add|pip\\s+install|sync)|apt(-get)?\\s+install|brew\\s+install|cargo\\s+(add|install)|go\\s+get|gem\\s+install|Install-Module)\\b', state: 'install' },
20
20
  { tool: '^(bash|pwsh)$', cmd: '(^|[;&|]\\s*)(curl|wget|aria2c|Invoke-WebRequest|iwr|scp|rsync)\\b', state: 'download' },
21
21
  { tool: '^(bash|pwsh)$', cmd: '(^|[;&|]\\s*)(sudo\\s+)?(rm|rmdir|unlink|del|Remove-Item|shred)\\b', state: 'delete' },
22
- { tool: '^(write|edit|str_replace_editor)$', ext: '^(md|mdx|txt|rst|adoc|docx?|tex)$', state: 'writingdoc' },
22
+ { tool: '^(write|edit|str_replace_editor|apply_patch)$', ext: '^(md|mdx|txt|rst|adoc|docx?|tex)$', state: 'writingdoc' },
23
23
  { tool: '^write$', state: 'coding' },
24
- { tool: '^(edit|str_replace_editor)$', state: 'editing' },
24
+ { tool: '^(edit|str_replace_editor|apply_patch)$', state: 'editing' },
25
25
  { tool: '^read_image$', state: 'media' },
26
- { tool: '^(mcp__.*|mcp[_-].*|list_mcp_resources|read_mcp_resource)$', state: 'mcp' },
27
- { tool: '^(read|lsp|cordis_inspect_.*)$', state: 'reading' },
26
+ { tool: '^(mcp__.*|mcp[_-].*|list_mcp_resources|read_mcp_resource|list_mcp_resource_templates)$', state: 'mcp' },
27
+ { tool: '^(read|lsp|cordis_inspect_.*|user_terminal_list|user_terminal_read)$', state: 'reading' },
28
28
  { tool: '^session_.*$', state: 'memory' },
29
29
  { tool: '^(glob|grep)$', state: 'search' },
30
30
  { tool: '^(web_search|web_fetch|stagehand_.*)$', state: 'web' },
31
31
  { tool: '^(create_worktree|load_workspace_dependencies)$', state: 'git' },
32
32
  { tool: '^(bash|pwsh|terminal_.*|job_.*)$', state: 'cmd' },
33
- { tool: '^(run_code|workflow)$', state: 'data' },
33
+ { tool: '^(run_code|workflow|office_recalculate)$', state: 'data' },
34
+ { tool: '^(office_convert|office_render)$', state: 'writingdoc' },
34
35
  { tool: '^(todo_write|exit_plan_mode|create_goal|get_goal|update_goal|schedule_.*)$', state: 'planning' },
35
- { tool: '^(subagent|list_subagent_models|send_message|list_agents|interrupt_agent|spawn_teammate|team_task_.*|ralph)$', state: 'subagents' },
36
- { tool: '^ask_user_question$', state: 'waiting' },
36
+ { tool: '^(subagent|subagent_fork|subagent_oar|list_subagent_models|send_message|list_agents|interrupt_agent|spawn_teammate|wait_agent|team_task_.*|ralph)$', state: 'subagents' },
37
+ { tool: '^(ask_user_question|propose_action)$', state: 'waiting' },
37
38
  { tool: '^present$', state: 'summary' },
38
39
  { tool: '^(skill|plugin_manager|plugin_market|working_directory)$', state: 'tools' },
39
40
  { tool: '.*', state: 'tools' },
@@ -162,12 +163,21 @@ window.__ModuleLoader__.load({
162
163
  const clip = (s, n) => { s = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); n = n || 48; return s.length > n ? s.slice(0, n - 1) + '…' : s; };
163
164
  const shortPath = (p) => String(p || '').split(/[\\/]/).filter(Boolean).slice(-2).join('/');
164
165
  const extOf = (p) => { const m = /\.([A-Za-z0-9]+)$/.exec(String(p || '')); return m ? m[1].toLowerCase() : undefined; };
166
+ /** Path from write/edit-style args, or from an apply_patch patch body. */
167
+ function toolPath(a) {
168
+ if (!a || typeof a !== 'object') return '';
169
+ const direct = a.file_path || a.path || a.notebook_path;
170
+ if (direct) return String(direct);
171
+ const raw = a.patch || a.input || a.diff || '';
172
+ const m = /\*\*\*\s+(?:Add|Update|Delete|Rename)\s+File:\s+(\S+)/.exec(String(raw));
173
+ return m ? m[1] : '';
174
+ }
165
175
  /** Parse possibly-incomplete streamed JSON arguments; falls back to regex-extracting known string fields. */
166
176
  function partialArgs(raw) {
167
177
  if (raw && typeof raw === 'object') return raw;
168
178
  try { const v = JSON.parse(raw); if (v && typeof v === 'object') return v; } catch (_e) { /* partial */ }
169
179
  const o = {}; const src = String(raw || '');
170
- for (const k of ['file_path', 'path', 'pattern', 'command', 'description', 'query', 'url', 'prompt', 'name', 'server', 'tool']) {
180
+ for (const k of ['file_path', 'path', 'pattern', 'command', 'description', 'query', 'url', 'prompt', 'name', 'server', 'tool', 'patch', 'input', 'uri', 'terminal']) {
171
181
  const m = new RegExp('"' + k + '"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)"').exec(src);
172
182
  if (m) { let v; try { v = JSON.parse('"' + m[1] + '"'); } catch (_e) { v = m[1].replace(/\\(["\\/])/g, '$1').replace(/\\[nrt]/g, ' '); } o[k] = v; }
173
183
  }
@@ -176,13 +186,13 @@ window.__ModuleLoader__.load({
176
186
  }
177
187
  /** Chinese one-line description of what a tool call is doing (args stay in the browser). */
178
188
  function actionText(tool, a) {
179
- a = a || {}; const t = String(tool || ''); const f = shortPath(a.file_path || a.path || a.notebook_path);
189
+ a = a || {}; const t = String(tool || ''); const f = shortPath(toolPath(a));
180
190
  if (!t) return '准备调用工具…';
181
191
  if (/^(mcp__|mcp[_-])/i.test(t)) { const parts = t.replace(/^mcp(__|[_-])/i, '').split(/__|\//); return '调用 MCP: ' + clip(parts.join(' · '), 40); }
182
192
  switch (t) {
183
193
  case 'read': case 'read_image': return '正在读 ' + (f || '文件');
184
194
  case 'write': return '正在写 ' + (f || '文件');
185
- case 'edit': case 'str_replace_editor': return '正在改 ' + (f || '文件');
195
+ case 'edit': case 'str_replace_editor': case 'apply_patch': return '正在改 ' + (f || '文件');
186
196
  case 'grep': return '正在搜索 "' + clip(a.pattern, 30) + '"' + (a.path && a.path !== '.' ? ' @ ' + shortPath(a.path) : '');
187
197
  case 'glob': return '正在查找文件 ' + clip(a.pattern, 36);
188
198
  case 'web_search': return '正在联网搜索 "' + clip((a.queries && a.queries[0]) || a.query, 30) + '"';
@@ -190,13 +200,20 @@ window.__ModuleLoader__.load({
190
200
  case 'bash': case 'pwsh': return a.command ? '运行 ' + clip(a.command, 44) : '准备运行命令…';
191
201
  case 'session_search': case 'session_read': case 'session_list': return '翻看历史会话' + (a.query ? ' "' + clip(a.query, 24) + '"' : '');
192
202
  case 'list_mcp_resources': return '列出 MCP 资源';
203
+ case 'list_mcp_resource_templates': return '列出 MCP 资源模板';
193
204
  case 'read_mcp_resource': return '读取 MCP 资源 ' + clip(a.uri || a.server, 30);
194
205
  case 'create_worktree': return '新建 Git worktree';
195
206
  case 'wait_agent': return '等子代理回来';
196
207
  case 'todo_write': return '正在更新待办' + (Array.isArray(a.todos) ? '(' + a.todos.length + ' 项)' : '');
197
- case 'subagent': case 'spawn_teammate': return '派出子代理:' + clip(a.description || a.prompt, 36);
208
+ case 'subagent': case 'subagent_fork': case 'subagent_oar': case 'spawn_teammate': return '派出子代理:' + clip(a.description || a.prompt, 36);
198
209
  case 'send_message': return '给子代理发消息';
199
210
  case 'ask_user_question': return '正在向你提问';
211
+ case 'propose_action': return '正在等你确认';
212
+ case 'user_terminal_list': return '正在查看终端列表';
213
+ case 'user_terminal_read': return '正在读终端输出' + (a.terminal || a.name ? ' ' + clip(a.terminal || a.name, 24) : '');
214
+ case 'office_convert': return '正在转换文档' + (f ? ' ' + f : '');
215
+ case 'office_recalculate': return '正在重算表格' + (f ? ' ' + f : '');
216
+ case 'office_render': return '正在渲染文档' + (f ? ' ' + f : '');
200
217
  case 'job_output': return '查看后台任务输出';
201
218
  case 'present': return '正在展示交付物';
202
219
  case 'lsp': return '查询代码索引';
@@ -208,6 +225,7 @@ window.__ModuleLoader__.load({
208
225
  function shellFailed(st, m) {
209
226
  if (!/^(bash|pwsh|powershell|shell)$/.test(st.tool)) return false;
210
227
  const c = m.content; const txt = typeof c === 'string' ? c : Array.isArray(c) ? c.map((x) => (x && x.text) || '').join('\n') : '';
228
+ if (/\[sandbox: file access denied/i.test(txt)) return true;
211
229
  const mm = /\[exit code: (\d+)\]\s*$/.exec(txt); if (!mm || mm[1] === '0') return false;
212
230
  return !/^\s*(git\s+diff|diff|cmp|grep|rg|test|\[)\b/.test(String(st.args.command || ''));
213
231
  }
@@ -260,7 +278,7 @@ function resultBrief(message) {
260
278
  return [st, created];
261
279
  }
262
280
  function finishStep(st) {
263
- const path = st.args.file_path || st.args.path;
281
+ const path = toolPath(st.args);
264
282
  let state = stateForTool(st.tool, { ext: extOf(path), command: st.args.command }, compiled);
265
283
  // write to a path this session has never read/edited/written -> "create" (decided once, when the path is first known)
266
284
  if (st.tool === 'write' && path && st.isNew === undefined) st.isNew = !S.seenPaths.has(path);
@@ -326,7 +344,7 @@ function resultBrief(message) {
326
344
  const failed = !!m.isError || shellFailed(st, m);
327
345
  st.status = failed ? 'error' : 'ok'; st.endAt = ctx.time; st.result = resultBrief(m) || (failed ? '失败' : '完成');
328
346
  S.afterResult = true;
329
- const path = st.args.file_path || st.args.path; if (path && /^(read|write|edit|str_replace_editor)$/.test(st.tool)) S.seenPaths.add(path);
347
+ const path = toolPath(st.args); if (path && /^(read|write|edit|str_replace_editor|apply_patch)$/.test(st.tool)) S.seenPaths.add(path);
330
348
  if (failed) {
331
349
  S.failStreak++; S.lastFail = { sig: sig(st), retry: st.retry || 0 };
332
350
  const worried = S.failStreak >= o.worriedN;
@@ -334,7 +352,7 @@ function resultBrief(message) {
334
352
  } else {
335
353
  S.failStreak = 0; if (S.lastFail && S.lastFail.sig === sig(st)) S.lastFail = null;
336
354
  let sub = null;
337
- if (/^(subagent|spawn_teammate|wait_agent|team_task_(complete|done|update))$/.test(st.tool)) sub = '子任务完成:' + clip(st.args.description || st.args.prompt || st.result, 30);
355
+ if (/^(subagent|subagent_fork|subagent_oar|spawn_teammate|wait_agent|team_task_(complete|done|update))$/.test(st.tool)) sub = '子任务完成:' + clip(st.args.description || st.args.prompt || st.result, 30);
338
356
  else if (st.tool === 'todo_write' && Array.isArray(st.args.todos)) {
339
357
  const done = st.args.todos.filter((x) => x && /^(completed|done)$/i.test(x.status || '')).length;
340
358
  if (done > S.todoDone) sub = '完成一项待办(' + done + '/' + st.args.todos.length + ')';
@@ -395,7 +413,7 @@ function resultBrief(message) {
395
413
 
396
414
  // ---------------------------------------------------------------- settings store (shared by every surface)
397
415
  const LS_KEY2 = 'dsh-task-mascot:settings:v2';
398
- const DEFAULT_SETTINGS = { inline: true, dock: true, pet: false, pack: 'dafeiyu', size: 160, cardSize: 96, corner: 'bottom-right', pos: null, rules: null, showChip: true, opacity: 1, dwellMs: 600, sound: false, avoid: true, variants: 'alternate', stepSlowSec: 20, loopLongSec: 120, dex: true, dexPopup: true };
416
+ const DEFAULT_SETTINGS = { inline: true, dock: true, pet: false, pack: 'dafeiyu', size: 160, cardSize: 96, corner: 'bottom-right', pos: null, rules: null, showChip: true, opacity: 1, dwellMs: 600, sound: false, avoid: true, variants: 'alternate', stepSlowSec: 20, loopLongSec: 120, dex: true, dexPopup: true, dockMode: 'auto' };
399
417
  function loadSettings() {
400
418
  try {
401
419
  const v2 = localStorage.getItem(LS_KEY2);
@@ -609,6 +627,33 @@ function resultBrief(message) {
609
627
  const w = bar && bar.getBoundingClientRect().width;
610
628
  if (w > 200) { el.style.maxWidth = Math.round(w) + 'px'; el.style.marginLeft = 'auto'; el.style.marginRight = 'auto'; el.style.boxSizing = 'border-box'; }
611
629
  }
630
+ /**
631
+ * Dock bar vs inline card: both show the same live step, so by default ('auto') the dock bar only appears
632
+ * when the inline card is off, missing, or scrolled out of view. 'always' restores the old both-at-once behaviour.
633
+ */
634
+ function dockShouldShow(o) {
635
+ if (!o.dock || !o.live) return false;
636
+ if (o.dockMode === 'always' || !o.inline) return true;
637
+ return !o.inlineInView;
638
+ }
639
+ const inlineVis = { m: new Map(), subs: new Set() };
640
+ function setInlineInView(sid, val) { if (!!inlineVis.m.get(sid) === !!val) return; inlineVis.m.set(sid, !!val); inlineVis.subs.forEach((f) => f()); }
641
+ function useInlineInView(sid) {
642
+ const [, force] = React.useState(0);
643
+ React.useEffect(() => { const f = () => force((n) => n + 1); inlineVis.subs.add(f); return () => inlineVis.subs.delete(f); }, []);
644
+ return !!inlineVis.m.get(sid);
645
+ }
646
+ /** Fallback when IntersectionObserver is unavailable: is `el` inside the viewport and every clipping ancestor? */
647
+ function rectInView(el) {
648
+ if (!el || !el.isConnected) return false;
649
+ let r = el.getBoundingClientRect(); if (r.height < 2) return false;
650
+ let top = Math.max(r.top, 0), bottom = Math.min(r.bottom, window.innerHeight);
651
+ for (let n = el.parentElement; n && n !== document.body; n = n.parentElement) {
652
+ const ov = getComputedStyle(n).overflowY; if (!/(auto|scroll|hidden|clip)/.test(ov)) continue;
653
+ const a = n.getBoundingClientRect(); top = Math.max(top, a.top); bottom = Math.min(bottom, a.bottom);
654
+ }
655
+ return bottom - top >= Math.min(32, r.height * 0.5);
656
+ }
612
657
  const showLive = (v) => !!v && (v.active || v.queued > 0 || (v.turnEnd && Date.now() - v.turnEnd < 4500) || (v.frame && v.frame.shownAt && Date.now() - v.frame.shownAt < 600));
613
658
  /** Inline card: portalled into the chat column right after the last row, i.e. at the active step. */
614
659
  function InlineCard({ sid }) {
@@ -624,17 +669,23 @@ function resultBrief(message) {
624
669
  if (box.parentNode !== tail.parentNode || box.previousSibling !== tail) tail.parentNode.insertBefore(box, tail.nextSibling);
625
670
  fitToColumn(box, sid);
626
671
  };
627
- place(); setEl(box); const iv = setInterval(place, 500);
628
- return () => { clearInterval(iv); box.remove(); setEl(null); };
672
+ let io = null;
673
+ if (typeof IntersectionObserver === 'function') {
674
+ io = new IntersectionObserver((ents) => { const e = ents[ents.length - 1]; setInlineInView(sid, !!(e && e.isIntersecting && e.intersectionRect.height >= Math.min(32, e.boundingClientRect.height * 0.5))); }, { threshold: [0, 0.1, 0.25, 0.5, 0.75, 1] });
675
+ io.observe(box);
676
+ }
677
+ place(); setEl(box); const iv = setInterval(() => { place(); if (!io) setInlineInView(sid, rectInView(box)); }, 500);
678
+ if (!io) setInlineInView(sid, rectInView(box));
679
+ return () => { clearInterval(iv); if (io) io.disconnect(); box.remove(); setEl(null); setInlineInView(sid, false); };
629
680
  }, [visible, sid]);
630
681
  if (!visible || !el || !v) return null;
631
682
  return ReactDOM.createPortal(h(CardBody, { v, size: s.cardSize || 96, manifest, pack: s.pack, surface: 'inline' }), el);
632
683
  }
633
684
  function DockBar({ sid }) {
634
685
  const s = useSettings(); const tr = useTracker(sid); const v = useView(tr); const manifest = usePackManifest(s.pack);
635
- const ref = React.useRef(null);
686
+ const ref = React.useRef(null); const inlineInView = useInlineInView(sid);
636
687
  React.useLayoutEffect(() => { fitToColumn(ref.current, sid); });
637
- if (!s.dock || !showLive(v)) return null;
688
+ if (!dockShouldShow({ dock: s.dock, inline: s.inline, dockMode: s.dockMode, live: showLive(v), inlineInView })) return null;
638
689
  return h('div', { ref, 'data-mascot-dock': sid, style: { padding: '0 0 6px' } }, h(CardBody, { v, size: 40, compact: true, manifest, pack: s.pack, surface: 'dock' }));
639
690
  }
640
691
  function SessionSurfaces(props) {
@@ -723,8 +774,8 @@ function resultBrief(message) {
723
774
  // ---------------------------------------------------------------- 图鉴 Dex (大肥鱼 public set)
724
775
  // Each logical state the mascot enters lights one card; first unlock pops a "新解锁!" animation.
725
776
  const DEX_KEY = 'dsh-mascot-dex:public'; const DEX_PACK = 'dafeiyu';
726
- const DEX_CSS = ".mdx-ov{position:fixed;inset:0;pointer-events:none;display:flex;align-items:center;justify-content:center;background:rgba(18,22,40,.35);animation:mdxk-ovIn .35s ease-out both;z-index:2147483600}.mdx-ov.mdx-out{animation:mdxk-ovOut .35s ease-in both}@keyframes mdxk-ovIn{from{opacity:0}}@keyframes mdxk-ovOut{to{opacity:0}}.mdx-stage{position:relative;pointer-events:auto;cursor:pointer;width:420px;height:520px;display:flex;flex-direction:column;align-items:center}.mdx-rays{position:absolute;left:50%;top:44%;width:760px;height:760px;margin:-380px 0 0 -380px;border-radius:50%; background:repeating-conic-gradient(from 0deg,var(--c2) 0 8deg,transparent 8deg 22deg);mask:radial-gradient(circle,#000 18%,transparent 62%);-webkit-mask:radial-gradient(circle,#000 18%,transparent 62%); opacity:0;animation:mdxk-rayIn .6s .45s ease-out forwards,mdxk-spin 14s .45s linear infinite}@keyframes mdxk-rayIn{to{opacity:.55}}@keyframes mdxk-spin{to{transform:rotate(360deg)}}.mdx-ring{position:absolute;left:50%;top:44%;width:40px;height:40px;margin:-20px;border-radius:50%;border:6px solid var(--c1);opacity:0;animation:mdxk-ring .9s .55s cubic-bezier(.1,.7,.3,1) forwards}@keyframes mdxk-ring{0%{opacity:.9;transform:scale(1)}100%{opacity:0;transform:scale(11)}}.mdx-ribbon{position:relative;z-index:2;margin-bottom:14px;padding:8px 26px;border-radius:999px;background:linear-gradient(90deg,var(--c1),var(--c2));color:#fff;font-weight:900;font-size:22px;letter-spacing:4px;box-shadow:0 8px 24px rgba(0,0,0,.25); opacity:0;animation:mdxk-ribbon .55s .75s cubic-bezier(.2,1.6,.4,1) forwards}@keyframes mdxk-ribbon{from{opacity:0;transform:translateY(-24px) scale(.6)}to{opacity:1;transform:none}}.mdx-flip{position:relative;z-index:2;width:240px;height:312px;perspective:900px;animation:mdxk-drop .5s cubic-bezier(.2,1.4,.4,1) both}@keyframes mdxk-drop{from{transform:translateY(60px) scale(.5);opacity:0}}.mdx-flip .mdx-in{position:absolute;inset:0;transform-style:preserve-3d;animation:mdxk-flip .7s .4s cubic-bezier(.5,0,.2,1.2) both}@keyframes mdxk-flip{from{transform:rotateY(0)}to{transform:rotateY(180deg)}}.mdx-flip img,.mdx-flip .mdx-front{position:absolute;inset:0;width:100%;height:100%;backface-visibility:hidden}.mdx-flip .mdx-front{transform:rotateY(180deg)}.mdx-flip .mdx-front img{position:absolute;inset:0}.mdx-flip video{position:absolute;left:50%;top:30px;width:190px;height:190px;margin-left:-95px;opacity:0;animation:mdxk-fadeV .4s 1.2s forwards}@keyframes mdxk-fadeV{to{opacity:1}}.mdx-flip .mdx-shine{position:absolute;inset:6px 6px 14px;border-radius:24px;overflow:hidden;pointer-events:none}.mdx-flip .mdx-shine:after{content:\"\";position:absolute;top:-50%;left:-80%;width:50%;height:200%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.85),transparent);transform:rotate(12deg);animation:mdxk-shine 1s 1.15s ease-in-out forwards}@keyframes mdxk-shine{to{left:150%}}.mdx-cap{position:relative;z-index:2;margin-top:16px;color:#fff;text-align:center;opacity:0;animation:mdxk-capIn .5s 1.1s ease-out forwards}.mdx-cap b{font-size:20px}.mdx-cap small{display:block;opacity:.8;margin-top:4px;font-size:13px}@keyframes mdxk-capIn{from{opacity:0;transform:translateY(10px)}to{opacity:1}}.mdx-spark{position:absolute;left:50%;top:44%;width:10px;height:10px;margin:-5px;border-radius:2px;background:var(--c);opacity:0;z-index:3;animation:mdxk-spark 1.1s var(--d) cubic-bezier(.1,.8,.3,1) forwards}@keyframes mdxk-spark{0%{opacity:1;transform:translate(0,0) rotate(0) scale(1)}100%{opacity:0;transform:translate(var(--x),var(--y)) rotate(var(--r)) scale(.4)}}@media (prefers-reduced-motion:reduce){.mdx-ov *{animation-duration:.01s!important;animation-delay:0s!important}}.mdx-grid-ov{position:fixed;inset:0;z-index:2147483500;background:rgba(18,22,40,.55);display:flex;align-items:center;justify-content:center}.mdx-panel{background:#F7F8FB;color:#1F2A44;border-radius:16px;width:min(1100px,94vw);max-height:90vh;overflow:auto;padding:18px 22px;font:14px system-ui,sans-serif}.mdx-head{display:flex;gap:14px;align-items:center;margin-bottom:12px}.mdx-head b{font-size:20px}.mdx-bar{flex:1;max-width:300px;height:8px;border-radius:5px;background:#E3E6EE;overflow:hidden}.mdx-bar i{display:block;height:100%;background:linear-gradient(90deg,#7C5CFF,#2F7BFF,#0FA3A3)}.mdx-head button{border:0;border-radius:8px;padding:6px 12px;background:#1F2A44;color:#fff;cursor:pointer}.mdx-grid{display:grid;grid-template-columns:repeat(auto-fill,120px);gap:10px;justify-content:center}.mdx-grid img{width:120px;height:156px;display:block}.mdx-grid img.on{cursor:pointer}.mdx-foot{margin-top:10px;font-size:11px;opacity:.6;text-align:center}";
727
- const dex = { m: null, p: null, lit: null, subs: new Set(), q: [], showing: false };
777
+ const DEX_CSS = ".mdx-ov{position:fixed;inset:0;pointer-events:none;display:flex;align-items:center;justify-content:center;background:rgba(18,22,40,.35);animation:mdxk-ovIn .35s ease-out both;z-index:2147483600}.mdx-ov.mdx-out{animation:mdxk-ovOut .35s ease-in both}@keyframes mdxk-ovIn{from{opacity:0}}@keyframes mdxk-ovOut{to{opacity:0}}.mdx-stage{position:relative;pointer-events:auto;cursor:pointer;width:420px;height:520px;display:flex;flex-direction:column;align-items:center}.mdx-rays{position:absolute;left:50%;top:44%;width:760px;height:760px;margin:-380px 0 0 -380px;border-radius:50%; background:repeating-conic-gradient(from 0deg,var(--c2) 0 8deg,transparent 8deg 22deg);mask:radial-gradient(circle,#000 18%,transparent 62%);-webkit-mask:radial-gradient(circle,#000 18%,transparent 62%); opacity:0;animation:mdxk-rayIn .6s .45s ease-out forwards,mdxk-spin 14s .45s linear infinite}@keyframes mdxk-rayIn{to{opacity:.55}}@keyframes mdxk-spin{to{transform:rotate(360deg)}}.mdx-ring{position:absolute;left:50%;top:44%;width:40px;height:40px;margin:-20px;border-radius:50%;border:6px solid var(--c1);opacity:0;animation:mdxk-ring .9s .55s cubic-bezier(.1,.7,.3,1) forwards}@keyframes mdxk-ring{0%{opacity:.9;transform:scale(1)}100%{opacity:0;transform:scale(11)}}.mdx-ribbon{position:relative;z-index:2;margin-bottom:14px;padding:8px 26px;border-radius:999px;background:linear-gradient(90deg,var(--c1),var(--c2));color:#fff;font-weight:900;font-size:22px;letter-spacing:4px;box-shadow:0 8px 24px rgba(0,0,0,.25); opacity:0;animation:mdxk-ribbon .55s .75s cubic-bezier(.2,1.6,.4,1) forwards}@keyframes mdxk-ribbon{from{opacity:0;transform:translateY(-24px) scale(.6)}to{opacity:1;transform:none}}.mdx-flip{position:relative;z-index:2;width:240px;height:312px;perspective:900px;animation:mdxk-drop .5s cubic-bezier(.2,1.4,.4,1) both}@keyframes mdxk-drop{from{transform:translateY(60px) scale(.5);opacity:0}}.mdx-flip .mdx-in{position:absolute;inset:0;transform-style:preserve-3d;animation:mdxk-flip .7s .4s cubic-bezier(.5,0,.2,1.2) both}@keyframes mdxk-flip{from{transform:rotateY(0)}to{transform:rotateY(180deg)}}.mdx-flip img,.mdx-flip .mdx-front{position:absolute;inset:0;width:100%;height:100%;backface-visibility:hidden}.mdx-flip .mdx-front{transform:rotateY(180deg)}.mdx-flip .mdx-front img{position:absolute;inset:0}.mdx-flip video{position:absolute;left:50%;top:30px;width:190px;height:190px;margin-left:-95px;opacity:0;animation:mdxk-fadeV .4s 1.2s forwards}@keyframes mdxk-fadeV{to{opacity:1}}.mdx-flip .mdx-shine{position:absolute;inset:6px 6px 14px;border-radius:24px;overflow:hidden;pointer-events:none}.mdx-flip .mdx-shine:after{content:\"\";position:absolute;top:-50%;left:-80%;width:50%;height:200%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.85),transparent);transform:rotate(12deg);animation:mdxk-shine 1s 1.15s ease-in-out forwards}@keyframes mdxk-shine{to{left:150%}}.mdx-cap{position:relative;z-index:2;margin-top:16px;color:#fff;text-align:center;opacity:0;animation:mdxk-capIn .5s 1.1s ease-out forwards}.mdx-cap b{font-size:20px}.mdx-cap small{display:block;opacity:.8;margin-top:4px;font-size:13px}@keyframes mdxk-capIn{from{opacity:0;transform:translateY(10px)}to{opacity:1}}.mdx-spark{position:absolute;left:50%;top:44%;width:10px;height:10px;margin:-5px;border-radius:2px;background:var(--c);opacity:0;z-index:3;animation:mdxk-spark 1.1s var(--d) cubic-bezier(.1,.8,.3,1) forwards}@keyframes mdxk-spark{0%{opacity:1;transform:translate(0,0) rotate(0) scale(1)}100%{opacity:0;transform:translate(var(--x),var(--y)) rotate(var(--r)) scale(.4)}}@media (prefers-reduced-motion:reduce){.mdx-ov *{animation-duration:.01s!important;animation-delay:0s!important}}.mdx-grid-ov{position:fixed;inset:0;z-index:2147483500;background:rgba(18,22,40,.55);display:flex;align-items:center;justify-content:center}.mdx-panel{background:#F7F8FB;color:#1F2A44;border-radius:16px;width:min(1100px,94vw);max-height:90vh;overflow:auto;padding:18px 22px;font:14px system-ui,sans-serif}.mdx-head{display:flex;gap:14px;align-items:center;margin-bottom:12px}.mdx-head b{font-size:20px}.mdx-bar{flex:1;max-width:300px;height:8px;border-radius:5px;background:#E3E6EE;overflow:hidden}.mdx-bar i{display:block;height:100%;background:linear-gradient(90deg,#7C5CFF,#2F7BFF,#0FA3A3)}.mdx-head button{border:0;border-radius:8px;padding:6px 12px;background:#1F2A44;color:#fff;cursor:pointer}.mdx-grid{display:grid;grid-template-columns:repeat(auto-fill,120px);gap:10px;justify-content:center}.mdx-grid img{width:120px;height:156px;display:block}.mdx-grid img.on{cursor:pointer}.mdx-foot{margin-top:10px;font-size:11px;opacity:.6;text-align:center}.mdx-toast{position:fixed;top:64px;right:24px;z-index:2147483400;display:flex;gap:10px;align-items:center;max-width:340px;padding:8px 12px 8px 8px;border-radius:14px;background:rgba(255,255,255,.96);color:#1F2A44;box-shadow:0 6px 24px rgba(0,0,0,.18);font:13px/1.4 system-ui,sans-serif;cursor:pointer;animation:mdxk-tIn .3s ease-out both}.mdx-toast.mdx-out{animation:mdxk-tOut .3s ease-in both}@keyframes mdxk-tIn{from{opacity:0;transform:translateY(-10px)}}@keyframes mdxk-tOut{to{opacity:0;transform:translateY(-10px)}}.mdx-toast .mdx-th{display:flex;flex:none}.mdx-toast .mdx-th img{width:40px;height:52px;margin-left:-14px;filter:drop-shadow(0 1px 2px rgba(0,0,0,.2))}.mdx-toast .mdx-th img:first-child{margin-left:0}.mdx-toast b{display:block;font-size:13px}.mdx-toast span{display:block;font-size:12px;opacity:.75;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:220px}@media (prefers-reduced-motion:reduce){.mdx-toast{animation:none}}";
778
+ const dex = { m: null, p: null, lit: null, subs: new Set(), toast: null };
728
779
  function dexLit() { if (!dex.lit) { try { dex.lit = new Set(JSON.parse(localStorage.getItem(DEX_KEY) || '[]')); } catch (_e) { dex.lit = new Set(); } } return dex.lit; }
729
780
  function dexSave() { try { localStorage.setItem(DEX_KEY, JSON.stringify([...dexLit()])); } catch (_e) { /* ignore */ } dex.subs.forEach((f) => f()); }
730
781
  function dexLoad() { dex.p = dex.p || fetch(assetUrl(DEX_PACK, 'dex/manifest.json')).then((r) => r.json()).then((m) => { dex.m = m; return m; }).catch(() => null); return dex.p; }
@@ -740,16 +791,35 @@ function resultBrief(message) {
740
791
  '<div class="mdx-flip"><div class="mdx-in"><img src="' + dexImg(e['locked@2x']) + '"><div class="mdx-front"><img src="' + dexImg(e['lit@2x']) + '"><video src="' + assetUrl(DEX_PACK, e.id + '.webm') + '" autoplay loop muted playsinline onerror="this.remove()"></video><div class="mdx-shine"></div></div></div></div>' +
741
792
  '<div class="mdx-cap"><b>#' + String(e.index).padStart(2, '0') + ' ' + esc(e.label) + '</b><small>' + esc(e.trigger) + '</small></div></div>';
742
793
  document.body.appendChild(ov);
743
- return new Promise((res) => { let done = false; const close = () => { if (done) return; done = true; ov.classList.add('mdx-out'); setTimeout(() => { ov.remove(); res(); }, 350); }; const st = ov.querySelector('.mdx-stage'); if (st) st.onclick = close; setTimeout(close, dex.q.length ? 1800 : 3400); });
794
+ return new Promise((res) => { let done = false; const close = () => { if (done) return; done = true; ov.classList.add('mdx-out'); setTimeout(() => { ov.remove(); res(); }, 350); }; const st = ov.querySelector('.mdx-stage'); if (st) st.onclick = close; setTimeout(close, 3400); });
795
+ }
796
+ /** Toast copy for one or more unlocks that arrived close together (merged into a single toast). */
797
+ function dexToastText(items) {
798
+ const labels = items.map((e) => e.label);
799
+ return { title: items.length > 1 ? '新解锁 ×' + items.length : '新解锁!#' + String(items[0].index).padStart(2, '0'), line: labels.length > 4 ? labels.slice(0, 4).join('、') + ' 等' : labels.join('、') };
800
+ }
801
+ /** Automatic unlocks: one small corner toast, no backdrop; unlocks while it is showing merge into it. Click opens the dex. */
802
+ function dexToast(e) {
803
+ dexCss(); let t = dex.toast;
804
+ if (!t || !t.el.isConnected) {
805
+ const el = document.createElement('div'); el.className = 'mdx-toast'; el.setAttribute('data-mascot-dex-toast', ''); el.title = '点击查看大肥鱼图鉴';
806
+ t = dex.toast = { el, items: [], timer: 0, born: Date.now() };
807
+ el.onclick = () => { dexOpen(); closeToast(t); };
808
+ document.body.appendChild(el);
809
+ }
810
+ t.items.push(e); const tx = dexToastText(t.items);
811
+ t.el.setAttribute('data-count', String(t.items.length));
812
+ t.el.innerHTML = '<div class="mdx-th">' + t.items.slice(-3).map((x) => '<img alt="" src="' + dexImg(x.lit) + '" srcset="' + dexImg(x.lit) + ' 1x, ' + dexImg(x['lit@2x']) + ' 2x">').join('') + '</div><div><b>' + esc(tx.title) + '</b><span>' + esc(tx.line) + '</span></div>';
813
+ clearTimeout(t.timer); t.timer = setTimeout(() => closeToast(t), Math.max(800, Math.min(3500, t.born + 8000 - Date.now()))); // merged, but never lingers past ~8s
744
814
  }
745
- async function dexDrain() { if (dex.showing) return; dex.showing = true; while (dex.q.length) { await dexPopup(dex.q.shift(), false); } dex.showing = false; }
746
- /** Light a card. Returns true on first unlock (and queues the popup unless settings.dexPopup is off). */
815
+ function closeToast(t) { if (!t || t.closing) return; t.closing = true; clearTimeout(t.timer); if (dex.toast === t) dex.toast = null; t.el.classList.add('mdx-out'); setTimeout(() => t.el.remove(), 300); }
816
+ /** Light a card. Returns true on first unlock (and shows/merges the corner toast unless settings.dexPopup is off). */
747
817
  function dexUnlock(id, opts) {
748
818
  if (!id || dexLit().has(id)) return false;
749
819
  if (!dex.m) { dexLoad().then((m) => { if (m) dexUnlock(id, opts); }); return false; }
750
820
  const e = (dex.m.entries || []).find((x) => x.id === id); if (!e) return false;
751
821
  dexLit().add(id); dexSave();
752
- if (!(opts && opts.silent) && store.value.dexPopup !== false && typeof document !== 'undefined') { dex.q.push(e); dexDrain(); }
822
+ if (!(opts && opts.silent) && store.value.dexPopup !== false && typeof document !== 'undefined') dexToast(e);
753
823
  return true;
754
824
  }
755
825
  async function dexOpen() {
@@ -782,9 +852,10 @@ function resultBrief(message) {
782
852
  const cb = (k) => h('input', { type: 'checkbox', 'data-setting': k, checked: !!s[k], onChange: (e) => setSettings({ [k]: e.target.checked }) });
783
853
  return h('div', { 'data-mascot-settings': '', style: { maxWidth: 640 } },
784
854
  h('h2', { style: { fontSize: 18, margin: '0 0 8px' } }, '任务状态角色 / Task Mascot'),
785
- h('p', { style: { fontSize: 12, opacity: 0.7, margin: '0 0 8px' } }, '角色动画实时跟随 Agent 的每一步(工具调用、思考、审批、出错、完成)。三种展示位置可任意组合。'),
855
+ h('p', { style: { fontSize: 12, opacity: 0.7, margin: '0 0 8px' } }, '角色动画实时跟随 Agent 的每一步(工具调用、思考、审批、出错、完成)。三种展示位置可任意组合;默认对话内卡片在视野里时不再重复显示状态条。'),
786
856
  row('对话内卡片 Inline card(当前步骤处)', cb('inline')),
787
857
  row('输入框上方状态条 Input dock bar', cb('dock')),
858
+ row('状态条何时显示 Dock bar mode', h('select', { 'data-setting': 'dockMode', value: s.dockMode || 'auto', onChange: (e) => setSettings({ dockMode: e.target.value }) }, [['auto', '自动:对话内卡片看不到时 auto'], ['always', '总是 always']].map(([k, l]) => h('option', { key: k, value: k }, l)))),
788
859
  row('悬浮角色 Floating pet', cb('pet')),
789
860
  row('角色包 Pack', h('select', { value: s.pack, onChange: (e) => setSettings({ pack: e.target.value }) }, packs.map((p) => h('option', { key: p.id, value: p.id }, p.title || p.id)))),
790
861
  row('卡片动画大小 Card size: ' + s.cardSize + 'px', h('input', { type: 'range', min: 48, max: 200, step: 8, value: s.cardSize, onChange: (e) => setSettings({ cardSize: +e.target.value }) })),
@@ -798,7 +869,7 @@ function resultBrief(message) {
798
869
  row('悬浮角色自动避让按钮/审批框 Pet avoids buttons', cb('avoid')),
799
870
  row('提示音(审批/完成/出错)Sound cues', cb('sound')),
800
871
  row('图鉴收集 Dex(新动作首次出现时点亮)', cb('dex')),
801
- row('新解锁弹窗 Unlock popup', cb('dexPopup')),
872
+ row('新解锁提示(角落小卡片)Unlock toast', cb('dexPopup')),
802
873
  row('大肥鱼图鉴 Collection', h('button', { type: 'button', 'data-dex-open': '', onClick: () => dexOpen() }, '打开图鉴 Open')),
803
874
  row('悬浮不透明度 Pet opacity', h('input', { type: 'range', min: 0.3, max: 1, step: 0.05, value: s.opacity, onChange: (e) => setSettings({ opacity: +e.target.value }) })),
804
875
  h('details', { style: { marginTop: 12 } },
@@ -822,7 +893,7 @@ function resultBrief(message) {
822
893
  }
823
894
  exports.apply = apply;
824
895
  exports.inject = inject;
825
- exports.__internals = { DEFAULT_RULES, ALL_STATES, compileRules, stateForTool, resolveState, pickVariant, displayState, createMachine, createTracker, actionText, partialArgs, resultBrief, GLOBAL_FALLBACK, STATE_ZH, STATE_ICON, dexUnlock, dexLit, dexLoad, dex };
896
+ exports.__internals = { DEFAULT_RULES, ALL_STATES, compileRules, stateForTool, resolveState, pickVariant, displayState, createMachine, createTracker, actionText, partialArgs, resultBrief, toolPath, shellFailed, GLOBAL_FALLBACK, STATE_ZH, STATE_ICON, dexUnlock, dexLit, dexLoad, dex, dockShouldShow, dexToastText, DEFAULT_SETTINGS };
826
897
  return module.exports;
827
898
  },
828
899
  });
package/lib/index.js CHANGED
@@ -71,7 +71,12 @@ function summarizeArgs(a) {
71
71
  if (a == null) return undefined;
72
72
  if (typeof a === 'string') { try { a = JSON.parse(a); } catch { return undefined; } }
73
73
  if (typeof a !== 'object') return undefined;
74
- const p = a.path ?? a.file_path ?? a.filePath ?? a.target;
74
+ let p = a.path ?? a.file_path ?? a.filePath ?? a.target;
75
+ if (typeof p !== 'string') {
76
+ const raw = a.patch || a.input || a.diff || '';
77
+ const mm = /\*\*\*\s+(?:Add|Update|Delete|Rename)\s+File:\s+(\S+)/.exec(String(raw));
78
+ p = mm ? mm[1] : undefined;
79
+ }
75
80
  if (typeof p !== 'string') return undefined;
76
81
  const m = /\.([A-Za-z0-9]{1,8})$/.exec(p);
77
82
  return m ? { ext: m[1].toLowerCase() } : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-task-mascot",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "metsh · Task Mascot — 真跟着 Agent 每一步工具调用在动。A DeepSeek Harness Web plugin whose mascot acts out every live tool call (read / write / edit / search / run / plan / sub-agent / wait / error) with step cards in chat. Swappable character packs (大肥鱼, Claude娘).",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",