HuanLinOTO/dsh-plugin-merge-tool-calls

HuanLinOTO★ 0TypeScriptLast synced: 2026-08-16

Open on GitHub

把 WebUI 会话流中连续相邻的同工具调用合并为「主卡片+紧凑子行」树状展示,默认覆盖所有内置通用行工具 | Merges consecutive same-tool calls in the WebUI chat flow into a main-card + compact-child-rows tree view, all built-in generic tools by default

README excerpt

dsh-plugin-merge-tool-calls 把 WebUI 会话流中 连续相邻 的同工具调用合并为一个「主卡片 + 紧凑子行」的树状展示,减少连续读文件/搜索/编辑/执行命令时多条卡片对流的占据。默认覆盖所有内置通用行工具( read / grep / glob / edit / write / bash / pwsh / web search / web fetch / run code / cordis package inspect / cordis runtime inspect ),也可配置白名单。 主行只显示数量摘要( Read · 3 Files ),具体文件路径全部下沉到子行;子行默认折叠,点击主行以动画展开/收起。单次调用(无合并)保持原行为(主行直接显示路径并展开内容)。 纯展示层合并:会话日志、模型可见数据、详情面板均不受影响;回放确定(合并结果是聊天快照的纯函数)。 工作原理 - 通过 keyed slot tool.call.toolview 的 shadow 机制( priority: -1 ,最低者渲染)接管工具的卡片; tools: [] 时接管全部内置通用行工具(见 src/client/tool-names.ts ),非空列表为显式白名单(任意 wire 名均可)。 - 组件经 useSession 读取聊天快照,用 conversationContextKey('tool-call', callId) 定位自身节点,在 chat.order 上前后扫描连续调用,按 maxGroupSize 分组。一组只合并 同名或同家族 调用:同名必合;已知家族( grep + glob 、 bash + pwsh 、 read + web fetch )跨名合;未知工具名(variant others )仅与自身合,不相关的工具不会混进同一张卡。 - 组首座位渲染合并卡片;组内其余座位渲染 null ,由注入的样式规则 [data-chat-flow-kind="tool-call"]:has([data-slot="tool.call.toolview"]:empty) { display: none; } 将其从流中收起(与内置 .flowItem:empty 语义一致;渲染器为每个 toolview 包一层 data-slot 容器,故以该容器判空)。 - 主卡片镜像内置 ToolRow 的行面:按 variant 渲染标题/图标(Read/Search/Bash/Write/Edit/Code/ Tool call ,工具自定义标题如 Pwsh / Inspect 优先)。 合并组的主行摘要改为数量 ( Read · 5 Files / Search · 3 Queries / Bash · 4 Commands …

View full README on GitHub →
Tools / Devdsh-pluginsearch

Category