🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
💄 style(chat): lead collapsed tool-call summary with total call count (#16003)
Arvin Xuad4545539cd3
diff --git a/apps/cli/man/man1/lh.1 b/apps/cli/man/man1/lh.1index ef119b37349..dbb93fe7ab9 100644--- a/apps/cli/man/man1/lh.1+++ b/apps/cli/man/man1/lh.1@@ -1,6 +1,6 @@.\" Code generated by `npm run man:generate`; DO NOT EDIT..\" Manual command details come from the Commander command tree.-.TH LH 1 "" "@lobehub/cli 0.0.31" "User Commands"+.TH LH 1 "" "@lobehub/cli 0.0.32" "User Commands".SH NAMElh \- LobeHub CLI \- manage and connect to LobeHub services.SH SYNOPSISdiff --git a/locales/en-US/chat.json b/locales/en-US/chat.jsonindex abeccb53bfa..9c2161dffe4 100644--- a/locales/en-US/chat.json+++ b/locales/en-US/chat.json@@ -935,9 +935,9 @@"workflow.collapse": "Collapse","workflow.expandFull": "Expand fully","workflow.failedSuffix": "(failed)",+ "workflow.summaryAcrossTools": "across {{count}} tools",+ "workflow.summaryCallsLead": "{{count}} calls: {{tools}}","workflow.summaryFailed": "{{count}} failed",- "workflow.summaryMoreTools": "{{count}} tool kinds",- "workflow.summaryTotalCalls": "{{count}} calls total","workflow.thoughtForDuration": "Thought for {{duration}}","workflow.toolDisplayName.activateDevice": "Activated device","workflow.toolDisplayName.activateSkill": "Activated a skill",diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.jsonindex 392d429ee47..576e0394550 100644--- a/locales/zh-CN/chat.json+++ b/locales/zh-CN/chat.json@@ -935,9 +935,9 @@"workflow.collapse": "收起","workflow.expandFull": "全部展开","workflow.failedSuffix": "(失败)",+ "workflow.summaryAcrossTools": "等 {{count}} 种工具",+ "workflow.summaryCallsLead": "{{count}} 次调用:{{tools}}","workflow.summaryFailed": "{{count}} 次失败",- "workflow.summaryMoreTools": "{{count}} 种工具",- "workflow.summaryTotalCalls": "共 {{count}} 次调用","workflow.thoughtForDuration": "思考了 {{duration}}","workflow.toolDisplayName.activateDevice": "激活了设备","workflow.toolDisplayName.activateSkill": "启用了技能",diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.tsindex 850c042de9a..4c5fd4b2bbf 100644--- a/packages/locales/src/default/chat.ts+++ b/packages/locales/src/default/chat.ts@@ -1031,9 +1031,9 @@ export default {'viewSwitcher.page': 'Page','viewSwitcher.task': 'Task','workflow.failedSuffix': '(failed)',+ 'workflow.summaryAcrossTools': 'across {{count}} tools',+ 'workflow.summaryCallsLead': '{{count}} calls: {{tools}}','workflow.summaryFailed': '{{count}} failed',- 'workflow.summaryMoreTools': '{{count}} tool kinds',- 'workflow.summaryTotalCalls': '{{count}} calls total','workflow.thoughtForDuration': 'Thought for {{duration}}','workflow.toolDisplayName.activateDevice': 'Activated device','workflow.toolDisplayName.activateSkill': 'Activated a skill',diff --git a/src/features/Conversation/Messages/AssistantGroup/toolDisplayNames.test.ts b/src/features/Conversation/Messages/AssistantGroup/toolDisplayNames.test.tsindex df15594cbe0..9c9b643f070 100644--- a/src/features/Conversation/Messages/AssistantGroup/toolDisplayNames.test.ts+++ b/src/features/Conversation/Messages/AssistantGroup/toolDisplayNames.test.ts@@ -49,6 +49,39 @@ describe('tool display names', () => {expect(summary).not.toContain('Web_search');});+ it('leads the summary with the total call count and appends the tool-kind count when truncated', () => {+ const tools = [+ ...Array.from({ length: 6 }, (_, i) => ({ apiName: 'a', id: `a-${i}` })),+ ...Array.from({ length: 4 }, (_, i) => ({ apiName: 'b', id: `b-${i}` })),+ ...Array.from({ length: 2 }, (_, i) => ({ apiName: 'c', id: `c-${i}` })),+ { apiName: 'd', id: 'd-0' },+ { apiName: 'e', id: 'e-0', result: { error: { message: 'boom' } } },+ { apiName: 'f', id: 'f-0' },+ ];+ const summary = getWorkflowSummaryText([blk({ id: '0', tools: tools as any })]);++ // total calls (15) leads, "calls total" / "共" wording is gone+ expect(summary.startsWith('15 calls:')).toBe(true);+ expect(summary).not.toContain('calls total');+ // truncated tool list is followed by the kind count, then the failure count+ expect(summary).toContain('across 6 tools');+ expect(summary).toContain('1 failed');+ });++ it('omits the total call count when each tool is called once', () => {+ const summary = getWorkflowSummaryText([+ blk({+ id: '0',+ tools: [+ { apiName: 'a', id: 'a-0' },+ { apiName: 'b', id: 'b-0' },+ ] as any,+ }),+ ]);++ expect(summary).not.toContain('calls:');+ });+it('uses friendly labels for Linear MCP tool names', () => {expect(getToolDisplayName('mcp__claude_ai_Linear__save_issue')).toBe('Linear · Save issue');expect(getToolDisplayName('mcp__linear-server__get_issue')).toBe('Linear · Get issue');diff --git a/src/features/Conversation/Messages/AssistantGroup/toolDisplayNames.ts b/src/features/Conversation/Messages/AssistantGroup/toolDisplayNames.tsindex c891991c8df..6e7763a790c 100644--- a/src/features/Conversation/Messages/AssistantGroup/toolDisplayNames.ts+++ b/src/features/Conversation/Messages/AssistantGroup/toolDisplayNames.ts@@ -418,29 +418,33 @@ export const getWorkflowSummaryText = (blocks: AssistantContentBlock[]): string? entries: [...entries].sort(([, a], [, b]) => b.count - a.count).slice(0, WORKFLOW_SUMMARY_TOP_N);- const segments: string[] = [displayedEntries.map(formatToolPart).join(', ')];+ // The tool list, e.g. "Task Create (5), Edit (4), Read (2)".+ let toolsText = displayedEntries.map(formatToolPart).join(', ');- // Only show "N tool kinds" when the list is truncated — otherwise it duplicates the visible list.+ // Append "across N tools" when the list is truncated — otherwise it duplicates the visible list.if (displayedEntries.length < totalKinds) {- segments.push(- t('workflow.summaryMoreTools', {- count: totalKinds,- defaultValue: '{{count}} tool kinds',- ns: 'chat',- }),- );- }- // Only show total calls when a tool was called more than once — otherwise totalCalls- // equals totalKinds and the suffix duplicates info already in the list.- if (totalKinds > 1 && totalCalls > totalKinds) {- segments.push(- t('workflow.summaryTotalCalls', {- count: totalCalls,- defaultValue: '{{count}} calls total',- ns: 'chat',- }),- );+ toolsText += ` ${t('workflow.summaryAcrossTools', {+ count: totalKinds,+ defaultValue: 'across {{count}} tools',+ ns: 'chat',+ })}`;}++ // Lead with the total call count when a tool was called more than once — it's the most+ // useful signal, so it goes first ("15 calls: …"). When totalCalls equals totalKinds the+ // count is redundant with the list, so we just show the list.+ const segments: string[] =+ totalKinds > 1 && totalCalls > totalKinds+ ? [+ t('workflow.summaryCallsLead', {+ count: totalCalls,+ defaultValue: '{{count}} calls: {{tools}}',+ ns: 'chat',+ tools: toolsText,+ }),+ ]+ : [toolsText];+if (totalErrors > 0) {segments.push(t('workflow.summaryFailed', {