@huanlin/dsh-plugin-merge-tool-calls 0.1.1 → 0.2.1

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,6 +1,6 @@
1
- [![dshfind](https://dshfind.com/api/badge/huanlinoto/dsh-merge-tool-calls?lang=zh)](https://dshfind.com/zh/plugins/huanlinoto/dsh-merge-tool-calls?ref=badge)
2
-
3
- > 📌 本插件已收录于 [dshfind](https://dshfind.com/zh) 插件超市,点击上方徽章直达主页。
1
+ <p align="center">
2
+ <a href="https://dshfind.com/zh/plugins/huanlinoto/dsh-plugin-merge-tool-calls"><img src="https://dshfind.com/api/card/huanlinoto/dsh-plugin-merge-tool-calls?lang=zh" alt="dsh-plugin-merge-tool-calls card"></a>
3
+ </p>
4
4
 
5
5
  # dsh-plugin-merge-tool-calls
6
6
 
@@ -8,11 +8,14 @@
8
8
 
9
9
  ```
10
10
  合并前: 合并后:
11
- [Read] foo ▸ 内容 [Read] foo 内容(主卡片,行为同现状)
12
- [Read] bar ▸ 内容 └ bar(子行,点击展开 bar 的内容)
13
- [Read] baz ▸ 内容 └ baz(子行,点击展开 baz 的内容)
11
+ [Read] foo ▸ 内容 [Read] · 3 Files ▸(点击展开子行)
12
+ [Read] bar ▸ 内容 └ foo(子行,点击展开 foo 的内容)
13
+ [Read] baz ▸ 内容 └ bar(子行,点击展开 bar 的内容)
14
+ └ baz(子行,点击展开 baz 的内容)
14
15
  ```
15
16
 
17
+ 主行只显示数量摘要(`Read · 3 Files`),具体文件路径全部下沉到子行;子行默认折叠,点击主行以动画展开/收起。单次调用(无合并)保持原行为(主行直接显示路径并展开内容)。
18
+
16
19
  纯展示层合并:会话日志、模型可见数据、详情面板均不受影响;回放确定(合并结果是聊天快照的纯函数)。
17
20
 
18
21
  ## 工作原理
@@ -23,8 +26,9 @@
23
26
  `[data-chat-flow-kind="tool-call"]:has([data-slot="tool.call.toolview"]:empty) { display: none; }`
24
27
  将其从流中收起(与内置 `.flowItem:empty` 语义一致;渲染器为每个 toolview 包一层
25
28
  `data-slot` 容器,故以该容器判空)。
26
- - 主卡片镜像内置 ToolRow 的行面:按 variant 渲染标题/图标(Read/Search/Bash/Write/Edit/Code/`Tool call`,工具自定义标题如 `Pwsh`/`Inspect` 优先)、args 摘要(读→路径、搜索→query、bash→description/command、未知工具带 `工具名 ·` 前缀)、read/search/diff/terminal/web 卡片或 IN/OUT 文本;`read`/`write`/`edit` 的摘要是可点击文件链接。行状态、错误首行、bash 失败退出码转红点均与内置一致。
27
- - 子行紧凑(20px 高),结构为主行的尾部(`sep 点 + 路径`)。对齐**运行时自动测量**:组件挂载后量取主行 sep 点相对卡片的偏移(并用 ResizeObserver 跟随字体/布局变化),以 `--mtc-sep-left` 自定义属性设置子行缩进——sep 点与主行 sep 点同列、路径与主行摘要同列,不依赖任何手工字体宽度常量,任意工具名均自动对齐。展开的子行卡片以负向 `calc` 抵消该缩进,左边缘与主卡片内容区对齐(占满卡片宽度,左侧不留白)。无可展开内容(如运行中的 read)的子行渲染为静态行。
29
+ - 主卡片镜像内置 ToolRow 的行面:按 variant 渲染标题/图标(Read/Search/Bash/Write/Edit/Code/`Tool call`,工具自定义标题如 `Pwsh`/`Inspect` 优先)。**合并组的主行摘要改为数量**(`Read · 5 Files` / `Search · 3 Queries` / `Bash · 4 Commands` 等,按 variant 选名词),不再显示首个调用的路径;单次调用(无合并)仍显示 args 摘要(读→路径、搜索→query、bash→description/command、未知工具带 `工具名 ·` 前缀),`read`/`write`/`edit` 单行的摘要是可点击文件链接。行状态、错误首行、bash 失败退出码转红点均与内置一致。
30
+ - 子行紧凑(20px 高),结构为主行的尾部(`sep 点 + 路径`)。合并组内**所有调用(含首个)**均渲染为子行,所以每个文件路径都在子行上。对齐**运行时自动测量**:组件挂载后量取主行 sep 点相对卡片的偏移(并用 ResizeObserver 跟随字体/布局变化),以 `--mtc-sep-left` 自定义属性设置子行缩进——sep 点与主行 sep 点同列、路径与主行摘要同列,不依赖任何手工字体宽度常量,任意工具名均自动对齐。展开的子行卡片以负向 `calc` 抵消该缩进,左边缘与主卡片内容区对齐(占满卡片宽度,左侧不留白)。无可展开内容(如运行中的 read)的子行渲染为静态行。
31
+ - 子行**默认折叠**:主行点击展开时,子行块以 `grid-template-rows: 0fr → 1fr` + 透明度过渡动画滑出(200ms),收起时反向滑回;折叠期间子行仍在 DOM 中(grid 0fr + `overflow: hidden` 收起,不卸载),所以动画平滑无闪烁。每个子行仍可独立点击展开其内容卡片。
28
32
 
29
33
  ## 配置
30
34
 
@@ -59,13 +63,13 @@ profile 无需额外解析。
59
63
  开发热更新(本地 clone,改源码重建 `lib/` 即生效):
60
64
 
61
65
  ```sh
62
- dsh plugin --profile web add link:D:\Projects\deepseek-harness\dsh-merge-tool-calls
66
+ dsh plugin --profile web add link:D:\Projects\deepseek-harness\dsh-plugin-merge-tool-calls
63
67
  ```
64
68
 
65
69
  分发安装(二选一):
66
70
 
67
71
  ```sh
68
- dsh plugin --profile web add "github:huanlinoto/dsh-merge-tool-calls" # 源码分发
72
+ dsh plugin --profile web add "github:huanlinoto/dsh-plugin-merge-tool-calls" # 源码分发
69
73
  dsh plugin --profile web add "@huanlin/dsh-plugin-merge-tool-calls" # npm registry 分发
70
74
  ```
71
75
 
@@ -75,15 +79,15 @@ dsh plugin --profile web add "@huanlin/dsh-plugin-merge-tool-calls" # npm re
75
79
 
76
80
  - `pnpm run typecheck && pnpm test && pnpm run build` 全绿;
77
81
  - `git -C <dsh checkout> status` 干净(零源码 patch);
78
- - 浏览器验证:连续 3 个 `read` 显示为一个主卡片 + 两个 `└` 子行,点击子行展开内容;
82
+ - 浏览器验证:连续 3 个 `read` 主行显示 `Read · 3 Files`,点击主行以动画展开 3 个 `└` 子行(foo/bar/baz 各一行),再点击子行展开内容;
79
83
  `grep`/`glob` 同理;`write`/`edit` 子行展开显示 diff 卡片、`bash`/`pwsh` 显示终端卡片、
80
84
  路径子行可点击在侧边栏预览;中间隔了其他节点的调用保持单卡片。
81
85
 
82
86
  ## 边界行为
83
87
 
84
- - 组内运行中(running)调用只显示 args 摘要路径,结果到达后原地更新。
85
- - error / interrupted 调用按内置语义着色(错误首行 / 警告状态点);bash 非零退出码按内置语义转为红色错误点。
86
- - `read`/`write`/`edit` 家族的主行/子行摘要是可点击文件链接(与内置行为一致);grep/glob 的 `path` 参数是搜索目录而非文件,摘要保持纯文本,不会误开目录。
88
+ - 组内运行中(running)调用:主行显示数量摘要(如 `Read · 3 Files`),子行折叠时不可见,展开后各子行显示对应调用的 args 摘要路径;结果到达后原地更新。
89
+ - error / interrupted 调用按内置语义着色(错误首行 / 警告状态点);bash 非零退出码按内置语义转为红色错误点。主行错误时摘要回退为错误首行(不显示数量)。
90
+ - `read`/`write`/`edit` 家族的子行摘要是可点击文件链接(与内置行为一致,打开侧边栏预览);grep/glob 的 `path` 参数是搜索目录而非文件,摘要保持纯文本,不会误开目录。单次调用(无合并)的主行摘要是文件链接。
87
91
  - 组被任何其他节点打断即断开;超过 `maxGroupSize` 的部分另起新组(不丢调用)。
88
92
  - 非聊天节点场景(如被 dispatch 为子调用)回退为普通单行,绝不空白。
89
93
  - 带自定义行卡片的工具(`skill`、`cordis_define`、`cordis_run`/`cordis_stop`/`cordis_undefine`,以及摘要格式特殊的 `todo_write`/`ask_user_question`)**不**默认接管,保持内置行;如需合并,用 `tools` 白名单显式加入(合并行按通用行面渲染)。