🤯 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(working-panel): redesign the overview panel around a single row grammar (#19175)
Arvin Xue885aabf06fb
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.jsonindex 34b465576b8..1333513a663 100644--- a/locales/en-US/chat.json+++ b/locales/en-US/chat.json@@ -109,12 +109,6 @@"cliAuthGuide.errorDetails": "Error details","cliAuthGuide.runCommand": "Run this in Terminal","cliAuthGuide.title": "Sign in to {{name}}",- "cliDetectionTimeoutGuide.actions.openSystemTools": "Open System Tools",- "cliDetectionTimeoutGuide.actions.retry": "Detect again",- "cliDetectionTimeoutGuide.desc": "LobeHub took too long to locate `{{command}}` from your login shell environment.",- "cliDetectionTimeoutGuide.errorDetails": "Technical details",- "cliDetectionTimeoutGuide.hint": "This is often caused by a slow shell startup script. Try again, or open System Tools to check the detected command path.",- "cliDetectionTimeoutGuide.title": "Detection timed out for {{name}}","cliOverloadedGuide.actions.retry": "Retry","cliOverloadedGuide.autoRetry.actions.cancel": "Stop auto-retry","cliOverloadedGuide.autoRetry.actions.retryNow": "Retry now",@@ -402,7 +396,7 @@"goalAcceptance.gateHint": "The final goal acceptance checks each of these","goalAcceptance.judgePrefix": "How to judge: ","goalAcceptance.remove": "Remove",- "goalAcceptance.removeConfirm.content": "\"{{title}}\" will no longer gate this goal’s final acceptance.",+ "goalAcceptance.removeConfirm.content": "\"{{title}}\" will no longer gate this goal's final acceptance.","goalAcceptance.removeConfirm.title": "Remove this criterion?","goalAcceptance.title": "Acceptance standard","goalChat.newTopic": "New conversation",@@ -439,10 +433,8 @@"goalDetail.notFoundTitle": "Goal not found","goalDetail.openExecution": "Open execution task","goalDetail.subtasks": "Subtasks",- "goalDetail.taskResult": "Task result","goalDetail.taskStatus": "Execution status","goalDetail.unnamedRun": "Untitled run",- "goalDetail.viewOriginalTask": "View task","goalDetail.viewPlan": "View execution plan","goalEmpty.create": "Create your first goal","goalEmpty.examples.backlog.requirement": "Tag each item with a type and priority, dedupe into one table, and list the 10 most frequent issues.",@@ -530,10 +522,6 @@"goalProcess.attempts.retired": "Retired","goalProcess.attempts.running": "Running","goalProcess.attempts.title": "Previous attempts",- "goalProcess.deliverables.empty": "Nothing delivered yet. Documents, generated files and linked resources a task persists show up here — anything left only on a local path does not.",- "goalProcess.deliverables.from": "From “{{title}}”",- "goalProcess.deliverables.title": "Deliverables",- "goalProcess.deliverables.untitled": "Untitled","goalProcess.edge.contradicts": "contradicts","goalProcess.edge.investigates": "investigates","goalProcess.edge.leadsTo": "leads to",@@ -743,6 +731,9 @@"heteroAgent.apiMode.defaultProviderConfigMissing": "LobeHub requires a compatible model. Open the agent profile to select one.","heteroAgent.apiMode.endpointMissing": "The provider \"{{providerId}}\" requires a base URL for this agent.","heteroAgent.apiMode.endpointUnsupported": "The provider \"{{providerId}}\" has an unsupported base URL.",+ "heteroAgent.apiMode.labDisabled.action": "Enable in Labs",+ "heteroAgent.apiMode.labDisabled.desc": "Turn it on in Settings → Labs, or switch this agent to Subscription authentication.",+ "heteroAgent.apiMode.labDisabled.title": "Provider binding is a Labs experiment","heteroAgent.apiMode.localOnly.desc": "Switch the execution environment to Local device, or use Subscription authentication.","heteroAgent.apiMode.localOnly.title": "API mode requires Desktop local execution","heteroAgent.apiMode.modelUnavailable": "The model \"{{providerId}}/{{model}}\" is disabled or no longer available.",@@ -1011,8 +1002,6 @@"input.warpWithKey": "Press <key/> to insert a line break","inputQueue.delete": "Delete","inputQueue.edit": "Edit",- "inputQueue.enqueueRejected": "Queue is full. Try again after the current run finishes.",- "inputQueue.queuedHint": "Queued — will steer the next turn","inputQueue.sendNow": "Send now (interrupts current run)","intentUnderstanding.title": "Understanding your intent...","internalLink.agent.open": "Open agent",@@ -1663,7 +1652,6 @@"taskDetail.runFollowUp": "Ask a follow-up","taskDetail.runFollowUpPlaceholder": "Ask a follow-up about this run...","taskDetail.runNow": "Run now",- "taskDetail.runResults": "Run results","taskDetail.runTask": "Run","taskDetail.runTrigger.goal": "Goal loop","taskDetail.runTrigger.heartbeat": "Heartbeat",@@ -1804,7 +1792,6 @@"taskList.scheduled.title": "Scheduled tasks","taskList.subtaskProgress.loadFailed": "Couldn't load sub-tasks. Click the progress badge to retry.","taskList.title": "Tasks",- "taskList.truncated": "Showing the first {{loaded}} of {{total}} tasks","taskList.unassigned": "Unassigned","taskList.unassignedAgentHint": "Lobe AI will run this task when no agent is selected","taskList.view.board": "Board",@@ -2391,22 +2378,19 @@"workingPanel.openMenu.title": "Open workspace panel","workingPanel.openMenu.tools": "Tools","workingPanel.openMenu.workspace": "Workspace",- "workingPanel.overview.branch": "Branch","workingPanel.overview.branch.detached": "Detached HEAD","workingPanel.overview.changes": "Changes",- "workingPanel.overview.changes.clean": "No working tree changes",- "workingPanel.overview.changes.files_one": "{{count}} file modified",- "workingPanel.overview.changes.files_other": "{{count}} files modified",- "workingPanel.overview.documents.desc": "Documents available to this agent",+ "workingPanel.overview.changes.none": "No changes",+ "workingPanel.overview.ci.failure": "Checks failed",+ "workingPanel.overview.ci.pending": "Checks running","workingPanel.overview.empty": "Workspace activity and outputs will appear here as the agent works.","workingPanel.overview.emptyTitle": "Ready to work",- "workingPanel.overview.environment": "Environment","workingPanel.overview.environmentError": "Could not load the repository status","workingPanel.overview.execution.device": "Connected device","workingPanel.overview.execution.local": "This device","workingPanel.overview.outputs": "Outputs",- "workingPanel.overview.resources": "Resources",- "workingPanel.overview.skills.desc": "Skills available to this agent",+ "workingPanel.overview.sync.pull": "Pull incoming commits",+ "workingPanel.overview.sync.push": "Push unpushed commits","workingPanel.overview.title": "Overview","workingPanel.overview.viewAll": "View all","workingPanel.overview.workspace.empty": "No workspace selected",diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.jsonindex 1ac5990d183..61a3bc172b3 100644--- a/locales/zh-CN/chat.json+++ b/locales/zh-CN/chat.json@@ -109,12 +109,6 @@"cliAuthGuide.errorDetails": "错误详情","cliAuthGuide.runCommand": "在终端执行","cliAuthGuide.title": "登录 {{name}}",- "cliDetectionTimeoutGuide.actions.openSystemTools": "打开系统工具",- "cliDetectionTimeoutGuide.actions.retry": "重新检测",- "cliDetectionTimeoutGuide.desc": "LobeHub 从登录 Shell 环境中查找 `{{command}}` 命令时超时。",- "cliDetectionTimeoutGuide.errorDetails": "技术详情",- "cliDetectionTimeoutGuide.hint": "这通常是 Shell 启动脚本耗时过长导致的。你可以重新检测,或前往系统工具检查识别到的命令路径。",- "cliDetectionTimeoutGuide.title": "检测 {{name}} 超时","cliOverloadedGuide.actions.retry": "重试","cliOverloadedGuide.autoRetry.actions.cancel": "停止自动重试","cliOverloadedGuide.autoRetry.actions.retryNow": "立即重试",@@ -439,10 +433,8 @@"goalDetail.notFoundTitle": "找不到目标","goalDetail.openExecution": "打开执行任务","goalDetail.subtasks": "子任务",- "goalDetail.taskResult": "任务结果","goalDetail.taskStatus": "执行状态","goalDetail.unnamedRun": "未命名运行",- "goalDetail.viewOriginalTask": "查看原始任务","goalDetail.viewPlan": "查看执行计划","goalEmpty.create": "创建第一个目标","goalEmpty.examples.backlog.requirement": "逐条标注类型与优先级,去重后汇总成一张表,并附出现最多的 10 个问题。",@@ -530,10 +522,6 @@"goalProcess.attempts.retired": "已放弃","goalProcess.attempts.running": "进行中","goalProcess.attempts.title": "之前的尝试",- "goalProcess.deliverables.empty": "还没有交付物。任务写入产品的文档、生成的文件和关联资源会出现在这里——只留在本地路径上的产物不会。",- "goalProcess.deliverables.from": "来自「{{title}}」",- "goalProcess.deliverables.title": "交付物",- "goalProcess.deliverables.untitled": "未命名","goalProcess.edge.contradicts": "反驳","goalProcess.edge.investigates": "调查","goalProcess.edge.leadsTo": "导向",@@ -743,6 +731,9 @@"heteroAgent.apiMode.defaultProviderConfigMissing": "LobeHub 需要选择兼容模型,请前往 Agent 资料完成配置。","heteroAgent.apiMode.endpointMissing": "此 Agent 要求服务商「{{providerId}}」配置 Base URL。","heteroAgent.apiMode.endpointUnsupported": "服务商「{{providerId}}」的 Base URL 不受支持。",+ "heteroAgent.apiMode.labDisabled.action": "前往实验室开启",+ "heteroAgent.apiMode.labDisabled.desc": "请在「设置 → 实验室」中开启,或将此 Agent 切换回订阅认证。",+ "heteroAgent.apiMode.labDisabled.title": "服务商绑定是实验室功能","heteroAgent.apiMode.localOnly.desc": "请将执行环境切换为本地设备,或改用订阅认证。","heteroAgent.apiMode.localOnly.title": "API 模式仅支持桌面端本地执行","heteroAgent.apiMode.modelUnavailable": "模型「{{providerId}}/{{model}}」已禁用或不再可用。",@@ -1011,8 +1002,6 @@"input.warpWithKey": "按 <key/> 换行","inputQueue.delete": "删除","inputQueue.edit": "编辑",- "inputQueue.enqueueRejected": "队列已满。请在当前运行结束后再试。",- "inputQueue.queuedHint": "已排队 — 将引导下一步操作","inputQueue.sendNow": "立即发送(中断当前运行)","intentUnderstanding.title": "正在理解你的意图…","internalLink.agent.open": "打开助理",@@ -1663,7 +1652,6 @@"taskDetail.runFollowUp": "追问","taskDetail.runFollowUpPlaceholder": "对这次运行追问...","taskDetail.runNow": "立即运行",- "taskDetail.runResults": "运行结果","taskDetail.runTask": "运行","taskDetail.runTrigger.goal": "目标驱动","taskDetail.runTrigger.heartbeat": "心跳触发",@@ -1804,7 +1792,6 @@"taskList.scheduled.title": "定时任务","taskList.subtaskProgress.loadFailed": "无法加载子任务,请点击进度标签重试。","taskList.title": "任务",- "taskList.truncated": "仅显示前 {{loaded}} 个任务,共 {{total}} 个","taskList.unassigned": "未分配","taskList.unassignedAgentHint": "未选择助理时将由 Lobe AI 执行该任务","taskList.view.board": "看板",@@ -2391,22 +2378,19 @@"workingPanel.openMenu.title": "打开工作区面板","workingPanel.openMenu.tools": "工具","workingPanel.openMenu.workspace": "工作区",- "workingPanel.overview.branch": "分支","workingPanel.overview.branch.detached": "游离 HEAD","workingPanel.overview.changes": "变更",- "workingPanel.overview.changes.clean": "工作树没有变更",- "workingPanel.overview.changes.files_one": "已修改 {{count}} 个文件",- "workingPanel.overview.changes.files_other": "已修改 {{count}} 个文件",- "workingPanel.overview.documents.desc": "此 Agent 可用的文档",+ "workingPanel.overview.changes.none": "无改动",+ "workingPanel.overview.ci.failure": "检查失败",+ "workingPanel.overview.ci.pending": "检查中","workingPanel.overview.empty": "Agent 开始工作后,工作区活动和产物会显示在这里。","workingPanel.overview.emptyTitle": "准备就绪",- "workingPanel.overview.environment": "环境","workingPanel.overview.environmentError": "无法加载仓库状态","workingPanel.overview.execution.device": "已连接设备","workingPanel.overview.execution.local": "此设备","workingPanel.overview.outputs": "产物",- "workingPanel.overview.resources": "资源",- "workingPanel.overview.skills.desc": "此 Agent 可用的技能",+ "workingPanel.overview.sync.pull": "拉取落后的提交",+ "workingPanel.overview.sync.push": "推送未上传的提交","workingPanel.overview.title": "概览","workingPanel.overview.viewAll": "查看全部","workingPanel.overview.workspace.empty": "尚未选择工作区",diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.tsindex fd4cd795747..d061c5c4c7a 100644--- a/packages/locales/src/default/chat.ts+++ b/packages/locales/src/default/chat.ts@@ -542,6 +542,10 @@ export default {'The provider "{{providerId}}" requires a base URL for this agent.','heteroAgent.apiMode.endpointUnsupported':'The provider "{{providerId}}" has an unsupported base URL.',+ 'heteroAgent.apiMode.labDisabled.action': 'Enable in Labs',+ 'heteroAgent.apiMode.labDisabled.desc':+ 'Turn it on in Settings → Labs, or switch this agent to Subscription authentication.',+ 'heteroAgent.apiMode.labDisabled.title': 'Provider binding is a Labs experiment','heteroAgent.apiMode.localOnly.desc':'Switch the execution environment to Local device, or use Subscription authentication.','heteroAgent.apiMode.localOnly.title': 'API mode requires Desktop local execution',@@ -864,14 +868,6 @@ export default {'cliAuthGuide.errorDetails': 'Error details','cliAuthGuide.runCommand': 'Run this in Terminal','cliAuthGuide.title': 'Sign in to {{name}}',- 'cliDetectionTimeoutGuide.actions.openSystemTools': 'Open System Tools',- 'cliDetectionTimeoutGuide.actions.retry': 'Detect again',- 'cliDetectionTimeoutGuide.desc':- 'LobeHub took too long to locate `{{command}}` from your login shell environment.',- 'cliDetectionTimeoutGuide.errorDetails': 'Technical details',- 'cliDetectionTimeoutGuide.hint':- 'This is often caused by a slow shell startup script. Try again, or open System Tools to check the detected command path.',- 'cliDetectionTimeoutGuide.title': 'Detection timed out for {{name}}','cliOverloadedGuide.actions.retry': 'Retry','cliOverloadedGuide.autoRetry.actions.cancel': 'Stop auto-retry','cliOverloadedGuide.autoRetry.actions.retryNow': 'Retry now',@@ -1514,7 +1510,6 @@ export default {'taskDetail.goalTimeline.rounds': '{{count}} rounds','taskDetail.goalTimeline.title': 'Round progress','taskDetail.activities': 'Activities',- 'taskDetail.runResults': 'Run results','taskDetail.activitiesEmpty': 'No activity yet','taskDetail.artifacts': 'Artifacts','taskDetail.untitled': 'Untitled',@@ -1865,9 +1860,7 @@ export default {'goalDetail.openExecution': 'Open execution task','goalDetail.subtasks': 'Subtasks','goalDetail.taskStatus': 'Execution status',- 'goalDetail.taskResult': 'Task result','goalDetail.unnamedRun': 'Untitled run',- 'goalDetail.viewOriginalTask': 'View task','goalDetail.viewPlan': 'View execution plan','goalProcess.frontier.title': 'Current tasks','goalProcess.frontier.add': 'Add task',@@ -2018,11 +2011,6 @@ export default {'goalProcess.node.artifactsTooltip':'{{count}} work versions registered. Opening them needs a server read that does not exist yet.','goalProcess.node.humanTouched': 'You took part in this task',- 'goalProcess.deliverables.title': 'Deliverables',- 'goalProcess.deliverables.empty':- 'Nothing delivered yet. Documents, generated files and linked resources a task persists show up here — anything left only on a local path does not.',- 'goalProcess.deliverables.from': 'From “{{title}}”',- 'goalProcess.deliverables.untitled': 'Untitled','goalProcess.findings.title': 'Findings','goalProcess.findings.empty': 'No findings yet.','goalProcess.findings.answers': 'Answers “{{title}}”',@@ -2102,7 +2090,6 @@ export default {'taskList.subtaskProgress.loadFailed':"Couldn't load sub-tasks. Click the progress badge to retry.",'taskList.title': 'Tasks',- 'taskList.truncated': 'Showing the first {{loaded}} of {{total}} tasks','taskList.unassigned': 'Unassigned','taskList.unassignedAgentHint': 'Lobe AI will run this task when no agent is selected','taskList.assignTo': 'Assign to',@@ -2547,23 +2534,20 @@ export default {'workingPanel.openMenu.title': 'Open workspace panel','workingPanel.openMenu.tools': 'Tools','workingPanel.openMenu.workspace': 'Workspace',- 'workingPanel.overview.branch': 'Branch','workingPanel.overview.branch.detached': 'Detached HEAD','workingPanel.overview.changes': 'Changes',- 'workingPanel.overview.changes.clean': 'No working tree changes',- 'workingPanel.overview.changes.files_one': '{{count}} file modified',- 'workingPanel.overview.changes.files_other': '{{count}} files modified',+ 'workingPanel.overview.changes.none': 'No changes',+ 'workingPanel.overview.ci.failure': 'Checks failed',+ 'workingPanel.overview.ci.pending': 'Checks running','workingPanel.overview.empty':'Workspace activity and outputs will appear here as the agent works.','workingPanel.overview.emptyTitle': 'Ready to work',- 'workingPanel.overview.environment': 'Environment','workingPanel.overview.environmentError': 'Could not load the repository status','workingPanel.overview.execution.device': 'Connected device',- 'workingPanel.overview.documents.desc': 'Documents available to this agent','workingPanel.overview.execution.local': 'This device','workingPanel.overview.outputs': 'Outputs',- 'workingPanel.overview.resources': 'Resources',- 'workingPanel.overview.skills.desc': 'Skills available to this agent',+ 'workingPanel.overview.sync.pull': 'Pull incoming commits',+ 'workingPanel.overview.sync.push': 'Push unpushed commits','workingPanel.overview.title': 'Overview','workingPanel.overview.viewAll': 'View all','workingPanel.overview.workspace.empty': 'No workspace selected',diff --git a/src/features/ChatInput/ControlBar/BranchSwitcher.tsx b/src/features/ChatInput/ControlBar/BranchSwitcher.tsxindex f4d68608993..728d8d31831 100644--- a/src/features/ChatInput/ControlBar/BranchSwitcher.tsx+++ b/src/features/ChatInput/ControlBar/BranchSwitcher.tsx@@ -55,6 +55,16 @@ const styles = createStaticStyles(({ css }) => ({display: inline-flex;flex: none;`,+ /* See WorktreeSwitcher.triggerFill — keeps a full-row custom trigger's hover+ background aligned with the popup-open background. */+ triggerFill: css`+ display: flex;+ width: 100%;++ > * {+ flex: 1;+ }+ `,container: css`display: flex;flex-direction: column;@@ -233,6 +243,8 @@ interface BranchSwitcherProps {onOptimisticCheckout?: (branch: string) => void;open: boolean;path: string;+ /** Dropdown placement — the runtime bar opens upward, embedding panels open downward. */+ placement?: 'topLeft' | 'bottomLeft' | 'bottomRight';/** The repo the conversation is anchored to (worktrees hang off it). */sourcePath: string;/** Used to route a checkout into the worktree that already holds the branch. */@@ -251,6 +263,7 @@ const BranchSwitcher = memo<BranchSwitcherProps>(onAfterCheckout,onExternalRefresh,onOptimisticCheckout,+ placement = 'topLeft',sourcePath,worktrees,children,@@ -475,10 +488,10 @@ const BranchSwitcher = memo<BranchSwitcherProps>(return (<DropdownMenuRoot open={open} onOpenChange={onOpenChange}><DropdownMenuTrigger className={styles.triggerAnchor}>- <div>{children}</div>+ <div className={styles.triggerFill}>{children}</div></DropdownMenuTrigger><DropdownMenuPortal>- <DropdownMenuPositioner placement="topLeft" sideOffset={8}>+ <DropdownMenuPositioner placement={placement} sideOffset={8}><DropdownMenuPopup><div className={styles.container}><div className={styles.searchBar}>diff --git a/src/features/ChatInput/ControlBar/WorktreeSwitcher.tsx b/src/features/ChatInput/ControlBar/WorktreeSwitcher.tsxindex 23ee2e42f41..d9eda7259f4 100644--- a/src/features/ChatInput/ControlBar/WorktreeSwitcher.tsx+++ b/src/features/ChatInput/ControlBar/WorktreeSwitcher.tsx@@ -21,7 +21,16 @@ import {SearchIcon,Trash2Icon,} from 'lucide-react';-import { memo, type MouseEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react';+import {+ memo,+ type MouseEvent,+ type ReactElement,+ useCallback,+ useEffect,+ useMemo,+ useRef,+ useState,+} from 'react';import { useTranslation } from 'react-i18next';import { gitService } from '@/services/git';@@ -321,6 +330,16 @@ const styles = createStaticStyles(({ css }) => ({display: inline-flex;flex: none;`,+ /* Custom row triggers (overview panel) must fill the stretched trigger, or the+ popup-open background paints wider than the row's own hover background. */+ triggerFill: css`+ display: flex;+ width: 100%;++ > * {+ flex: 1;+ }+ `,}));const TEMP_PATH_PREFIXES = ['/tmp', '/var/tmp', '/private/tmp'];@@ -411,12 +430,16 @@ DirtyStat.displayName = 'DirtyStat';interface WorktreeSwitcherProps {agentId: string;+ /** Custom trigger element; the default is the compact branch/fork icon chip. */+ children?: ReactElement;currentBranch: string;detached?: boolean;deviceId?: string;isGithub: boolean;onWorktreesChange?: () => Promise<unknown> | unknown;path: string;+ /** Dropdown placement — the runtime bar opens upward, embedding panels open downward. */+ placement?: 'topLeft' | 'bottomLeft' | 'bottomRight';sourcePath: string;worktrees: DeviceGitWorktreeListItem[];}@@ -424,12 +447,14 @@ interface WorktreeSwitcherProps {const WorktreeSwitcher = memo<WorktreeSwitcherProps>(({agentId,+ children,currentBranch,detached,deviceId,isGithub,onWorktreesChange,path,+ placement = 'topLeft',sourcePath,worktrees,}) => {@@ -608,7 +633,7 @@ const WorktreeSwitcher = memo<WorktreeSwitcherProps>(normalizeDisplayPath(currentPath) !== normalizeDisplayPath(mainWorktree.path));const triggerIcon = isLinkedWorktree ? GitForkIcon : GitBranchIcon;- const trigger = (+ const trigger = children ?? (<divaria-label={t('workingDirectory.worktreesHeading')}className={styles.trigger}@@ -621,10 +646,12 @@ const WorktreeSwitcher = memo<WorktreeSwitcherProps>(return (<DropdownMenuRoot open={open} onOpenChange={setOpen}><DropdownMenuTrigger className={styles.triggerAnchor}>- <div>{open ? trigger : <Tooltip title={triggerTitle}>{trigger}</Tooltip>}</div>+ <div className={children ? styles.triggerFill : undefined}>+ {open ? trigger : <Tooltip title={triggerTitle}>{trigger}</Tooltip>}+ </div></DropdownMenuTrigger><DropdownMenuPortal>- <DropdownMenuPositioner placement="topLeft" sideOffset={8}>+ <DropdownMenuPositioner placement={placement} sideOffset={8}><DropdownMenuPopup><div className={styles.container}><div className={styles.searchBar}>diff --git a/src/features/Conversation/WorkingSidebar/Overview/__tests__/overviewData.test.ts b/src/features/Conversation/WorkingSidebar/Overview/__tests__/overviewData.test.tsnew file mode 100644index 00000000000..cc7683331b5--- /dev/null+++ b/src/features/Conversation/WorkingSidebar/Overview/__tests__/overviewData.test.ts@@ -0,0 +1,70 @@+import { describe, expect, it } from 'vitest';++import { collectChangeStats, isLinkedWorktreeCheckout, shouldShowCiLabel } from '../overviewData';++describe('collectChangeStats', () => {+ it('sums additions/deletions across repo and submodule patches', () => {+ expect(+ collectChangeStats({+ patches: [+ { additions: 200, deletions: 10, path: 'a.ts' },+ { additions: 10, deletions: 1, path: 'b.ts' },+ ],+ submodules: [{ patches: [{ additions: 5, deletions: 2, path: 'sub/c.ts' }] }],+ } as never),+ ).toEqual({ additions: 215, deletions: 13, files: 3 });+ });++ it('returns zeros for an undefined or empty working tree', () => {+ expect(collectChangeStats(undefined)).toEqual({ additions: 0, deletions: 0, files: 0 });+ expect(collectChangeStats({ patches: [] } as never)).toEqual({+ additions: 0,+ deletions: 0,+ files: 0,+ });+ });+});++describe('isLinkedWorktreeCheckout', () => {+ const main = { current: false, path: '/repo' } as never;+ const linked = { current: true, path: '/repo-wt' } as never;++ it('is false when the checkout IS the main worktree', () => {+ expect(isLinkedWorktreeCheckout('/repo', [main, linked])).toBe(false);+ });++ it('is true when the checkout differs from the main worktree', () => {+ expect(isLinkedWorktreeCheckout('/repo-wt', [main, linked])).toBe(true);+ });++ it('is true for every checkout of a bare repo', () => {+ expect(+ isLinkedWorktreeCheckout('/repo', [+ { bare: true, current: false, path: '/repo.git' },+ ] as never[]),+ ).toBe(true);+ });++ it('is false when the only difference is the macOS /private/tmp alias', () => {+ expect(+ isLinkedWorktreeCheckout('/tmp/scratch', [+ { current: true, path: '/private/tmp/scratch' },+ ] as never[]),+ ).toBe(false);+ });++ it('is false without a directory or without worktree data', () => {+ expect(isLinkedWorktreeCheckout(undefined, [main])).toBe(false);+ expect(isLinkedWorktreeCheckout('/repo-wt', [])).toBe(false);+ });+});++describe('shouldShowCiLabel', () => {+ it('labels only failing or running rollups — passing stays icon-only', () => {+ expect(shouldShowCiLabel('failure')).toBe(true);+ expect(shouldShowCiLabel('pending')).toBe(true);+ expect(shouldShowCiLabel('success')).toBe(false);+ expect(shouldShowCiLabel('unknown')).toBe(false);+ expect(shouldShowCiLabel(undefined)).toBe(false);+ });+});diff --git a/src/features/Conversation/WorkingSidebar/Overview/index.tsx b/src/features/Conversation/WorkingSidebar/Overview/index.tsxindex f6a07420dab..d57b35142aa 100644--- a/src/features/Conversation/WorkingSidebar/Overview/index.tsx+++ b/src/features/Conversation/WorkingSidebar/Overview/index.tsx@@ -1,60 +1,86 @@'use client';-import { Center, Empty, Flexbox, Icon, type IconProps } from '@lobehub/ui';-import { Button, Skeleton, Tag, Text } from '@lobehub/ui/base-ui';+import { Empty, Flexbox, Icon, type IconProps, Tooltip } from '@lobehub/ui';+import { ActionIcon, Button, Skeleton, toast } from '@lobehub/ui/base-ui';import { SkillsIcon } from '@lobehub/ui/icons';import { createStaticStyles, cssVar, cx } from 'antd-style';import {+ ArrowDownIcon,+ ArrowUpIcon,BoxesIcon,+ ChevronDownIcon,ClipboardListIcon,FileTextIcon,- FolderGit2Icon,GitBranchIcon,+ GitForkIcon,LaptopIcon,RefreshCwIcon,} from 'lucide-react';-import { memo, type ReactNode, useMemo } from 'react';+import { memo, type ReactNode, useCallback, useMemo, useState } from 'react';import { useTranslation } from 'react-i18next';+import RingLoadingIcon from '@/components/RingLoading';+import {+ getCiVisual,+ getPullRequestState,+ PR_STATE_VISUAL,+} from '@/features/AgentSidebar/Topic/List/Item/metaCardData';+import BranchSwitcher from '@/features/ChatInput/ControlBar/BranchSwitcher';+import DirIcon from '@/features/ChatInput/ControlBar/DirIcon';+import WorktreeSwitcher from '@/features/ChatInput/ControlBar/WorktreeSwitcher';import { getAllWorkSummaries } from '@/features/Conversation/store/slices/data/workSummaries';import WorkSummaryCard from '@/features/Work/WorkSummaryCard';+import { electronSystemService } from '@/services/electron/system';+import { gitService } from '@/services/git';import { useAgentStore } from '@/store/agent';import { agentSelectors } from '@/store/agent/selectors';import { useChatStore } from '@/store/chat';import { dbMessageSelectors } from '@/store/chat/selectors';-import { useFetchGitAheadBehind, useFetchGitBranch, useReviewPatches } from '@/store/device';+import {+ useFetchGitAheadBehind,+ useFetchGitBranch,+ useFetchGitLinkedPR,+ useFetchGitWorktrees,+ useReviewPatches,+} from '@/store/device';import ProgressSection from '../ProgressSection';+import { collectChangeStats, isLinkedWorktreeCheckout, shouldShowCiLabel } from './overviewData';const styles = createStaticStyles(({ css, cssVar }) => ({body: css`overflow-y: auto;- padding-block: 8px 12px;- padding-inline: 8px 12px;+ padding-block: 4px 10px;+ padding-inline: 8px;`,changeAdditions: css`- font-family: ${cssVar.fontFamilyCode};- font-size: 12px;+ font-variant-numeric: tabular-nums;color: ${cssVar.colorSuccess};`,changeDeletions: css`- font-family: ${cssVar.fontFamilyCode};- font-size: 12px;+ font-variant-numeric: tabular-nums;color: ${cssVar.colorError};`,- error: css`- min-height: 112px;+ divider: css`+ flex-shrink: 0;++ height: 1px;+ margin-block: 6px;+ margin-inline: 8px;++ background: ${cssVar.colorBorderSecondary};`,icon: css`flex-shrink: 0;- margin-block-start: 1px;- color: ${cssVar.colorTextSecondary};+ color: ${cssVar.colorTextTertiary};`,row: css`cursor: pointer;- min-height: 40px;- padding-block: 8px;+ flex-shrink: 0;++ min-height: 32px;+ padding-block: 5px;padding-inline: 8px;border-radius: 6px;@@ -64,16 +90,38 @@ const styles = createStaticStyles(({ css, cssVar }) => ({background: ${cssVar.colorFillTertiary};}`,- rowStatus: css`+ rowStatic: css`cursor: default;&:hover {background: transparent;}`,- rowStatusPrimary: css`- font-weight: 400 !important;- color: ${cssVar.colorTextSecondary} !important;+ rowTrailing: css`+ display: flex;+ flex-shrink: 0;+ gap: 6px;+ align-items: center;++ font-size: 12px;+ font-variant-numeric: tabular-nums;+ line-height: 18px;+ color: ${cssVar.colorTextTertiary};+ `,+ rowValue: css`+ overflow: hidden;+ flex: 1;++ min-width: 0;++ font-size: 13px;+ line-height: 20px;+ color: ${cssVar.colorText};+ text-overflow: ellipsis;+ white-space: nowrap;+ `,+ rowValueDanger: css`+ color: ${cssVar.colorError};`,sectionHeader: css`padding-block: 4px 6px;@@ -90,32 +138,109 @@ const styles = createStaticStyles(({ css, cssVar }) => ({padding-block: 4px;padding-inline: 10px;`,- stats: css`+ weakLabel: css`+ font-size: 12px;+ line-height: 18px;+ `,+ weakRow: css`+ cursor: pointer;+flex-shrink: 0;++ min-height: 28px;+ padding-block: 3px;+ padding-inline: 8px;+ border-radius: 6px;++ color: ${cssVar.colorTextSecondary};++ transition: background-color 0.12s ease;++ &:hover {+ color: ${cssVar.colorText};+ background: ${cssVar.colorFillTertiary};+ }`,}));interface OverviewProps {active: boolean;+ /** Enables the branch / worktree switchers; without it those rows are read-only. */+ agentId?: string;deviceId?: string;environmentAvailable: boolean;onOpenTab: (tab: string) => void;repoType?: string;+ /** The repo the conversation is anchored to (worktrees hang off it). */+ sourcePath?: string;workingDirectory?: string;}const pathBasename = (path: string) => path.replaceAll('\\', '/').split('/').findLast(Boolean);-const OverviewRowLead = ({ children, icon }: { children: ReactNode; icon: IconProps['icon'] }) => (- <Flexbox horizontal align={'flex-start'} flex={1} gap={10} style={{ minWidth: 0 }}>- <Icon className={styles.icon} icon={icon} size={17} />- {children}- </Flexbox>+interface OverviewRowProps {+ danger?: boolean;+ icon?: IconProps['icon'];+ iconColor?: string;+ /** Pre-rendered leading node (e.g. DirIcon) used instead of a lucide `icon`. */+ iconNode?: ReactNode;+ /** Row LOOKS clickable but the click is handled by a wrapping dropdown trigger. */+ interactive?: boolean;+ onClick?: () => void;+ title?: string;+ trailing?: ReactNode;+ value: ReactNode;+}++/**+ * The panel's single row grammar: `icon + value + trailing`. The value column is+ * the fact itself (branch name, PR title), never a noun label describing it; the+ * trailing column holds exactly one of a number, a status, or a chevron.+ */+const OverviewRow = memo<OverviewRowProps>(+ ({ danger, icon, iconColor, iconNode, interactive, onClick, title, trailing, value }) => (+ <Flexbox+ horizontal+ align={'center'}+ className={cx(styles.row, !onClick && !interactive && styles.rowStatic)}+ gap={10}+ role={onClick || interactive ? 'button' : undefined}+ onClick={onClick}+ >+ {iconNode ?? (+ <Icon+ className={styles.icon}+ icon={icon!}+ size={16}+ style={iconColor ? { color: iconColor } : undefined}+ />+ )}+ <span className={cx(styles.rowValue, danger && styles.rowValueDanger)} title={title}>+ {value}+ </span>+ {trailing ? <span className={styles.rowTrailing}>{trailing}</span> : null}+ </Flexbox>+ ),);+OverviewRow.displayName = 'OverviewRow';++const Chevron = () => <Icon icon={ChevronDownIcon} size={14} style={{ opacity: 0.6 }} />;+const Overview = memo<OverviewProps>(- ({ active, deviceId, environmentAvailable, onOpenTab, repoType, workingDirectory }) => {+ ({+ active,+ agentId,+ deviceId,+ environmentAvailable,+ onOpenTab,+ repoType,+ sourcePath,+ workingDirectory,+ }) => {const { t } = useTranslation('chat');+ const { t: tDevice } = useTranslation('device');+ const { t: tCommon } = useTranslation('common');const isHetero = useAgentStore(agentSelectors.isCurrentAgentHeterogeneous);const topicId = useChatStore((s) => s.activeTopicId);const threadId = useChatStore((s) => s.activeThreadId);@@ -124,12 +249,15 @@ const Overview = memo<OverviewProps>();const gitPath = active && repoType ? workingDirectory : undefined;+ const isGithub = repoType === 'github';const {data: branchData,error: branchError,isLoading: branchLoading,mutate: mutateBranch,} = useFetchGitBranch(deviceId, gitPath);+ const branch = branchData?.branch;+ const detached = branchData?.detached;const {data: aheadBehind,error: aheadBehindError,@@ -141,130 +269,274 @@ const Overview = memo<OverviewProps>(isLoading: reviewLoading,mutate: mutateReview,} = useReviewPatches(gitPath, 'unstaged', undefined, deviceId, active);+ const { data: worktrees = [], mutate: mutateWorktrees } = useFetchGitWorktrees(+ deviceId,+ gitPath,+ );+ const { data: prData, mutate: mutatePR } = useFetchGitLinkedPR(+ deviceId,+ gitPath,+ branch,+ isGithub,+ );++ const [switcherOpen, setSwitcherOpen] = useState(false);+ const [pulling, setPulling] = useState(false);+ const [pushing, setPushing] = useState(false);- const changeStats = useMemo(() => {- const patches = [- ...(reviewData?.patches ?? []),- ...(reviewData?.submodules ?? []).flatMap((submodule) => submodule.patches),- ];-- return patches.reduce(- (stats, patch) => ({- additions: stats.additions + (patch.additions ?? 0),- deletions: stats.deletions + (patch.deletions ?? 0),- files: stats.files + 1,- }),- { additions: 0, deletions: 0, files: 0 },- );- }, [reviewData]);+ const changeStats = useMemo(() => collectChangeStats(reviewData), [reviewData]);const gitError = branchError || aheadBehindError || reviewError;const isGitLoading = branchLoading || reviewLoading;const visibleWorks = works.slice(0, 3);const directoryName = workingDirectory ? pathBasename(workingDirectory) : undefined;- const retryGit = async () => {- await Promise.all([mutateBranch(), mutateAheadBehind(), mutateReview()]);- };+ const isLinkedWorktree = isLinkedWorktreeCheckout(workingDirectory, worktrees);++ const refreshGit = useCallback(async () => {+ await Promise.all([+ mutateBranch(),+ mutateAheadBehind(),+ mutateReview(),+ mutateWorktrees(),+ mutatePR(),+ ]);+ }, [mutateBranch, mutateAheadBehind, mutateReview, mutateWorktrees, mutatePR]);++ // Flip the displayed branch instantly on checkout; the switcher's+ // onAfterCheckout reconciles once the checkout lands (same as GitStatus).+ const handleOptimisticCheckout = useCallback(+ (nextBranch: string) => {+ void mutateBranch({ branch: nextBranch, detached: false }, { revalidate: false });+ },+ [mutateBranch],+ );++ const syncBusy = pulling || pushing;++ const handlePull = useCallback(async () => {+ if (syncBusy || !workingDirectory) return;+ setPulling(true);+ try {+ const result = await gitService.pullGitBranch({ deviceId, path: workingDirectory });+ if (result.success) {+ if (result.noop) {+ toast.info(tDevice('workingDirectory.pullNoop'));+ } else {+ toast.success(tDevice('workingDirectory.pullSuccess'));+ }+ await refreshGit();+ } else {+ toast.error(result.error || tDevice('workingDirectory.pullFailed'));+ }+ } finally {+ setPulling(false);+ }+ }, [deviceId, refreshGit, syncBusy, tDevice, workingDirectory]);++ const handlePush = useCallback(async () => {+ if (syncBusy || !workingDirectory) return;+ setPushing(true);+ try {+ const result = await gitService.pushGitBranch({ deviceId, path: workingDirectory });+ if (result.success) {+ if (result.noop) {+ toast.info(tDevice('workingDirectory.pushNoop'));+ } else {+ toast.success(tDevice('workingDirectory.pushSuccess'));+ }+ await refreshGit();+ } else {+ toast.error(result.error || tDevice('workingDirectory.pushFailed'));+ }+ } finally {+ setPushing(false);+ }+ }, [deviceId, refreshGit, syncBusy, tDevice, workingDirectory]);++ const pullRequest = prData?.pullRequest;+ const ciStatus = pullRequest?.ciStatus;+ const ci = pullRequest ? getCiVisual(ciStatus) : undefined;+ const prVisual = pullRequest ? PR_STATE_VISUAL[getPullRequestState(pullRequest)] : undefined;++ const showAhead = !!aheadBehind?.hasUpstream && aheadBehind.ahead > 0;+ const showBehind = !!aheadBehind?.hasUpstream && aheadBehind.behind > 0;++ const branchRow = (+ <OverviewRow+ icon={GitBranchIcon}+ interactive={!detached && !!agentId && !!workingDirectory}+ title={detached ? tDevice('workingDirectory.detachedHead', { sha: branch ?? '' }) : branch}+ trailing={!detached && agentId ? <Chevron /> : undefined}+ value={branch}+ />+ );++ const gitRows = (+ <>+ {/* Branch: the value owns the main column; switching happens in place. */}+ {branch &&+ (!detached && agentId && workingDirectory ? (+ <BranchSwitcher+ agentId={agentId}+ currentBranch={branch}+ deviceId={deviceId}+ isGithub={isGithub}+ open={switcherOpen}+ path={workingDirectory}+ placement={'bottomLeft'}+ sourcePath={sourcePath ?? workingDirectory}+ worktrees={worktrees}+ onAfterCheckout={() => void refreshGit()}+ onExternalRefresh={refreshGit}+ onOpenChange={setSwitcherOpen}+ onOptimisticCheckout={handleOptimisticCheckout}+ >+ {branchRow}+ </BranchSwitcher>+ ) : (+ branchRow+ ))}++ {/* Worktree: only when the checkout actually is a linked worktree. */}+ {isLinkedWorktree && branch && workingDirectory && agentId && (+ <WorktreeSwitcher+ agentId={agentId}+ currentBranch={branch}+ detached={detached}+ deviceId={deviceId}+ isGithub={isGithub}+ path={workingDirectory}+ placement={'bottomLeft'}+ sourcePath={sourcePath ?? workingDirectory}+ worktrees={worktrees}+ onWorktreesChange={mutateWorktrees}+ >+ <OverviewRow+ interactive+ icon={GitForkIcon}+ title={workingDirectory}+ trailing={<Chevron />}+ value={pathBasename(workingDirectory)}+ />+ </WorktreeSwitcher>+ )}++ {/* Changes: the ±N numbers are the value — no sentence about them. */}+ <OverviewRow+ icon={ClipboardListIcon}+ value={t('workingPanel.overview.changes')}+ trailing={+ changeStats.files > 0 ? (+ <>+ <span className={styles.changeAdditions}>+{changeStats.additions}</span>+ <span className={styles.changeDeletions}>−{changeStats.deletions}</span>+ </>+ ) : (+ t('workingPanel.overview.changes.none')+ )+ }+ onClick={() => onOpenTab('review')}+ />++ {/* Sync: the row is the action, one action per row. */}+ {showBehind && (+ <OverviewRow+ icon={ArrowDownIcon}+ iconColor={cssVar.colorError}+ trailing={pulling ? <RingLoadingIcon size={12} /> : aheadBehind!.behind}+ value={t('workingPanel.overview.sync.pull')}+ onClick={syncBusy ? undefined : handlePull}+ />+ )}+ {showAhead && (+ <OverviewRow+ icon={ArrowUpIcon}+ iconColor={cssVar.colorInfo}+ trailing={pushing ? <RingLoadingIcon size={12} /> : aheadBehind!.ahead}+ value={t('workingPanel.overview.sync.push')}+ onClick={syncBusy ? undefined : handlePush}+ />+ )}++ {/* Linked PR with its CI rollup as trailing status — passing is the+ steady state, so only failure / pending earn a text label. */}+ {pullRequest && prVisual && ci && (+ <Tooltip title={`#${pullRequest.number} ${pullRequest.title}`}>+ <div>+ <OverviewRow+ icon={prVisual.icon}+ iconColor={prVisual.color}+ value={`#${pullRequest.number} ${pullRequest.title}`}+ trailing={+ <>+ <Icon icon={ci.icon} size={14} style={{ color: ci.color }} />+ {shouldShowCiLabel(ciStatus)+ ? t(+ `workingPanel.overview.ci.${ciStatus as 'failure' | 'pending'}` as 'workingPanel.overview.ci.failure',+ )+ : null}+ </>+ }+ onClick={+ pullRequest.url+ ? () => void electronSystemService.openExternalLink(pullRequest.url)+ : undefined+ }+ />+ </div>+ </Tooltip>+ )}+ </>+ );return (- <Flexbox className={styles.body} gap={14}>+ <Flexbox className={styles.body} gap={10}>{environmentAvailable && (<Flexbox>- <Flexbox- horizontal- align={'center'}- className={styles.sectionHeader}- justify={'space-between'}- >- <span className={styles.sectionTitle}>{t('workingPanel.overview.environment')}</span>- {workingDirectory && (- <Tag size={'small'}>- {deviceId- ? t('workingPanel.overview.execution.device')- : t('workingPanel.overview.execution.local')}- </Tag>- )}- </Flexbox>-- <Flexbox- horizontal- align={'flex-start'}- className={styles.row}- gap={10}+ <OverviewRow+ icon={workingDirectory ? undefined : LaptopIcon}+ title={workingDirectory}+ value={directoryName || t('workingPanel.overview.workspace.empty')}+ iconNode={+ workingDirectory ? (+ <DirIcon repoType={isGithub ? 'github' : repoType ? 'git' : undefined} />+ ) : undefined+ }+ trailing={+ workingDirectory+ ? t(+ deviceId+ ? 'workingPanel.overview.execution.device'+ : 'workingPanel.overview.execution.local',+ )+ : undefined+ }onClick={workingDirectory ? () => onOpenTab('files') : undefined}- >- <OverviewRowLead icon={workingDirectory ? FolderGit2Icon : LaptopIcon}>- <Flexbox flex={1} style={{ minWidth: 0 }}>- <Text ellipsis weight={500}>- {directoryName || t('workingPanel.overview.workspace.empty')}- </Text>- <Text ellipsis color={cssVar.colorTextTertiary} fontSize={12}>- {workingDirectory || t('workingPanel.overview.workspace.emptyDesc')}- </Text>- </Flexbox>- </OverviewRowLead>- </Flexbox>+ />{repoType && workingDirectory && isGitLoading ? (<div className={styles.skeleton}><Skeleton.Text rows={2} /></div>) : gitError ? (- <Center className={styles.error} gap={8}>- <Text type={'danger'}>{t('workingPanel.overview.environmentError')}</Text>- <Button icon={RefreshCwIcon} size={'small'} onClick={retryGit}>- {t('retry', { ns: 'common' })}- </Button>- </Center>+ // A failed probe is one row, not a panel-bending error block.+ <OverviewRow+ danger+ icon={GitBranchIcon}+ iconColor={cssVar.colorError}+ value={t('workingPanel.overview.environmentError')}+ trailing={+ <ActionIcon+ icon={RefreshCwIcon}+ size={'small'}+ title={tCommon('retry')}+ onClick={() => void refreshGit()}+ />+ }+ />) : repoType && workingDirectory ? (- <>- <Flexbox- horizontal- align={'flex-start'}- className={cx(styles.row, styles.rowStatus)}- gap={10}- >- <OverviewRowLead icon={GitBranchIcon}>- <Flexbox flex={1}>- <Text className={styles.rowStatusPrimary}>- {t('workingPanel.overview.branch')}- </Text>- </Flexbox>- </OverviewRowLead>- <Flexbox horizontal align={'center'} className={styles.stats} gap={6}>- <Text ellipsis fontSize={12} style={{ maxWidth: 128 }}>- {branchData?.branch || t('workingPanel.overview.branch.detached')}- </Text>- {!!aheadBehind?.ahead && <Tag size={'small'}>↑{aheadBehind.ahead}</Tag>}- {!!aheadBehind?.behind && <Tag size={'small'}>↓{aheadBehind.behind}</Tag>}- </Flexbox>- </Flexbox>- <Flexbox- horizontal- align={'flex-start'}- className={styles.row}- gap={10}- onClick={() => onOpenTab('review')}- >- <OverviewRowLead icon={ClipboardListIcon}>- <Flexbox flex={1} style={{ minWidth: 0 }}>- <Text weight={500}>{t('workingPanel.overview.changes')}</Text>- <Text color={cssVar.colorTextTertiary} fontSize={12}>- {changeStats.files- ? t('workingPanel.overview.changes.files', { count: changeStats.files })- : t('workingPanel.overview.changes.clean')}- </Text>- </Flexbox>- </OverviewRowLead>- {changeStats.files > 0 && (- <Flexbox horizontal className={styles.stats} gap={8}>- <span className={styles.changeAdditions}>+{changeStats.additions}</span>- <span className={styles.changeDeletions}>−{changeStats.deletions}</span>- </Flexbox>- )}- </Flexbox>- </>+ gitRows) : null}</Flexbox>)}@@ -290,47 +562,33 @@ const Overview = memo<OverviewProps>(</Flexbox>)}+ {/* Resource entries: kept, but demoted — same row grammar, lower weight. */}<Flexbox>+ {environmentAvailable && <div className={styles.divider} />}<Flexboxhorizontalalign={'center'}- className={styles.sectionHeader}- justify={'space-between'}- >- <span className={styles.sectionTitle}>{t('workingPanel.overview.resources')}</span>- </Flexbox>- <Flexbox- horizontal- align={'flex-start'}- className={styles.row}+ className={styles.weakRow}gap={10}+ role={'button'}onClick={() => onOpenTab('skills')}>- <OverviewRowLead icon={SkillsIcon}>- <Flexbox flex={1}>- <Text weight={500}>{t('workingPanel.resources.filter.skills')}</Text>- <Text color={cssVar.colorTextTertiary} fontSize={12}>- {t('workingPanel.overview.skills.desc')}- </Text>- </Flexbox>- </OverviewRowLead>+ <Icon className={styles.icon} icon={SkillsIcon} size={14} />+ <span className={styles.weakLabel}>{t('workingPanel.resources.filter.skills')}</span></Flexbox>{!isHetero && (<Flexboxhorizontal- align={'flex-start'}- className={styles.row}+ align={'center'}+ className={styles.weakRow}gap={10}+ role={'button'}onClick={() => onOpenTab('documents')}>- <OverviewRowLead icon={FileTextIcon}>- <Flexbox flex={1}>- <Text weight={500}>{t('workingPanel.resources.filter.documents')}</Text>- <Text color={cssVar.colorTextTertiary} fontSize={12}>- {t('workingPanel.overview.documents.desc')}- </Text>- </Flexbox>- </OverviewRowLead>+ <Icon className={styles.icon} icon={FileTextIcon} size={14} />+ <span className={styles.weakLabel}>+ {t('workingPanel.resources.filter.documents')}+ </span></Flexbox>)}</Flexbox>diff --git a/src/features/Conversation/WorkingSidebar/Overview/overviewData.ts b/src/features/Conversation/WorkingSidebar/Overview/overviewData.tsnew file mode 100644index 00000000000..5207b60c61b--- /dev/null+++ b/src/features/Conversation/WorkingSidebar/Overview/overviewData.ts@@ -0,0 +1,59 @@+import type { GitWorkingTreePatches } from '@lobechat/electron-client-ipc';+import type { DeviceGitPullRequestCiStatus, DeviceGitWorktreeListItem } from '@lobechat/types';++import { normalizeDisplayPath } from '@/features/ChatInput/ControlBar/worktreeHelpers';++/** macOS aliases `/tmp` & `/var` onto `/private/...`; git reports the real path+ * while the picked working directory keeps the alias, so strip the prefix+ * before comparing or a main-worktree checkout under /tmp reads as linked. */+const stripPrivateAlias = (path: string) => path.replace(/^\/private(?=\/(?:tmp|var)\/)/, '');++export interface OverviewChangeStats {+ additions: number;+ deletions: number;+ files: number;+}++/** Aggregate the working-tree ± counts across the repo and its submodules. */+export const collectChangeStats = (reviewData?: GitWorkingTreePatches): OverviewChangeStats => {+ const patches = [+ ...(reviewData?.patches ?? []),+ ...(reviewData?.submodules ?? []).flatMap((submodule) => submodule.patches),+ ];++ return patches.reduce(+ (stats, patch) => ({+ additions: stats.additions + (patch.additions ?? 0),+ deletions: stats.deletions + (patch.deletions ?? 0),+ files: stats.files + 1,+ }),+ { additions: 0, deletions: 0, files: 0 },+ );+};++/**+ * Whether the current checkout is a LINKED worktree. `git worktree list` always+ * emits the main worktree first (a bare repo has none, so every checkout is+ * linked) — compare against it rather than any sourcePath, which is itself a+ * linked worktree whenever the user picked one directly (see WorktreeSwitcher).+ */+export const isLinkedWorktreeCheckout = (+ workingDirectory: string | undefined,+ worktrees: DeviceGitWorktreeListItem[],+): boolean => {+ const [mainWorktree] = worktrees;+ return (+ !!workingDirectory &&+ !!mainWorktree &&+ (!!mainWorktree.bare ||+ stripPrivateAlias(normalizeDisplayPath(workingDirectory)) !==+ stripPrivateAlias(normalizeDisplayPath(mainWorktree.path)))+ );+};++/**+ * Passing checks are the steady state and stay icon-only; only a failing or+ * still-running rollup earns a text label next to the PR row.+ */+export const shouldShowCiLabel = (status?: DeviceGitPullRequestCiStatus): boolean =>+ status === 'failure' || status === 'pending';diff --git a/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx b/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsxindex e6d55c5fddc..f3f9f881bb2 100644--- a/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx+++ b/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx@@ -94,6 +94,8 @@ const chatStore = vi.hoisted(() => ({portalStack: [] as Array<{ startMessageId?: string; threadId?: string; type: string }>,showPortal: false,threadMaps: {} as Record<string, any[]>,+ // read by the real topicSelectors.currentTopicMetadata (sourcePath resolution)+ topicDataMap: {} as Record<string, unknown>,}));const globalStore = vi.hoisted(() => ({diff --git a/src/features/Conversation/WorkingSidebar/index.tsx b/src/features/Conversation/WorkingSidebar/index.tsxindex 42be390fe53..f7cae61a5d9 100644--- a/src/features/Conversation/WorkingSidebar/index.tsx+++ b/src/features/Conversation/WorkingSidebar/index.tsx@@ -1,4 +1,5 @@import type { SFSymbol } from '@lobechat/electron-client-ipc';+import { getWorkingDirEffectivePath } from '@lobechat/types';import { nanoid } from '@lobechat/utils';import { Flexbox, Icon, type IconProps } from '@lobehub/ui';import { ActionIcon, type DropdownItem, DropdownMenu, Skeleton } from '@lobehub/ui/base-ui';@@ -48,6 +49,7 @@ import RightPanel from '@/features/RightPanel';import { resolveTargetDeviceId } from '@/helpers/agentWorkingDirectory';import { resolveExecutionTarget } from '@/helpers/executionTarget';import { useIsGatewayModeEnabled } from '@/helpers/gatewayMode';+import { getWorkingDirectoryPathString } from '@/helpers/workingDirectoryPath';import { useDeferredMount } from '@/hooks/useDeferredMount';import { useEffectiveAgencyConfig } from '@/hooks/useEffectiveAgencyConfig';import { useEffectiveWorkingDirectory } from '@/hooks/useEffectiveWorkingDirectory';@@ -56,9 +58,10 @@ import type { NativeContextMenuItem } from '@/libs/contextMenu/types';import { useAgentStore } from '@/store/agent';import { agentSelectors, chatConfigByIdSelectors } from '@/store/agent/selectors';import { useChatStore } from '@/store/chat';-import { chatPortalSelectors, portalThreadSelectors } from '@/store/chat/selectors';+import { chatPortalSelectors, portalThreadSelectors, topicSelectors } from '@/store/chat/selectors';import { PortalViewType } from '@/store/chat/slices/portal/initialState';import { messageMapKey } from '@/store/chat/utils/messageMapKey';+import { deviceSelectors, useDeviceStore } from '@/store/device';import { useElectronStore } from '@/store/electron';import { useGlobalStore } from '@/store/global';import { systemStatusSelectors } from '@/store/global/selectors';@@ -310,6 +313,31 @@ const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth })workspaceScoped,});const repoType = useRepoType(workingDirectory, targetDeviceId);+ // The SOURCE repo, not the checkout — same fallback chain as+ // WorkingDirectorySection: a persisted-worktree topic has no matching+ // `workingDirs` entry, and committing the worktree path as sourcePath would+ // rewrite the topic's repo source (see that component's comment).+ const topicWorkingDirectoryConfig = useChatStore(+ (s) => topicSelectors.currentTopicMetadata(s)?.workingDirectoryConfig,+ );+ const deviceDirs = useDeviceStore(deviceSelectors.getDeviceWorkingDirs(targetDeviceId));+ const sourceWorkingDirectory = useMemo(() => {+ if (!workingDirectory) return undefined;+ const currentEntry = deviceDirs.find(+ (entry) =>+ (getWorkingDirectoryPathString(entry.git?.activeWorktree) ??+ getWorkingDirectoryPathString(entry.path)) === workingDirectory,+ );+ const persistedConfig =+ getWorkingDirEffectivePath(topicWorkingDirectoryConfig) === workingDirectory+ ? topicWorkingDirectoryConfig+ : undefined;+ return (+ getWorkingDirectoryPathString(currentEntry?.path) ??+ getWorkingDirectoryPathString(persistedConfig?.path) ??+ workingDirectory+ );+ }, [deviceDirs, topicWorkingDirectoryConfig, workingDirectory]);const deviceRoutingAvailable = useIsGatewayModeEnabled(activeAgentId);const effectiveTarget = resolveExecutionTarget(agencyConfig, {clientExecutionAvailable: isDesktop,@@ -905,9 +933,11 @@ const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth }){contentReady && (<Overviewactive+ agentId={activeAgentId}deviceId={remoteDeviceId}environmentAvailable={filesystemEnvironmentAvailable}repoType={environmentRepoType}+ sourcePath={sourceWorkingDirectory}workingDirectory={environmentWorkingDirectory}onOpenTab={openTab}/>