Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): keep chrome hit area after left pane collapse
DavidShenaf61e49d5a85
diff --git a/apps/desktop/src/renderer/components/layout/MainLayout.tsx b/apps/desktop/src/renderer/components/layout/MainLayout.tsxindex 820ea75897..4cebbd123e 100644--- a/apps/desktop/src/renderer/components/layout/MainLayout.tsx+++ b/apps/desktop/src/renderer/components/layout/MainLayout.tsx@@ -1843,7 +1843,12 @@ export function MainLayout() {{/* 面板稳态宽度由 LayoutRoot 输出 CSS 百分比/clamp,BrowserWindow live resize不再逐像素回灌 React;设置页接管时非 chat 面板统一歇业。 */}<TabGroupHostProvider value={tabGroupHost}>- <LayoutRoot suppressNonChatPanels={isSettingsRoute} />+ <LayoutRoot+ suppressNonChatPanels={isSettingsRoute}+ rightTabsCollapsed={+ !rightSidebarMounted || isRightSidebarCollapsed || rightSidebarForceCollapsed+ }+ /></TabGroupHostProvider></BuiltinPanelBridgeProvider>{/* 拖面板换位(B3 转正;M3 起 mac 同步开闸——mac 顶栏全部保留窗口拖拽,diff --git a/apps/desktop/src/renderer/layout/LayoutRoot.tsx b/apps/desktop/src/renderer/layout/LayoutRoot.tsxindex c6f5921b7f..e97ec2525e 100644--- a/apps/desktop/src/renderer/layout/LayoutRoot.tsx+++ b/apps/desktop/src/renderer/layout/LayoutRoot.tsx@@ -847,9 +847,14 @@ interface LayoutRootProps {* 统一开关(2026-07-08 Lizi 实测:设置页右缘冒出意识面板)。*/suppressNonChatPanels?: boolean;+ /** right-tabs 可保留挂载但不占宽度;窗口左边缘应归其后第一个实际在场的面板。 */+ rightTabsCollapsed?: boolean;}-export function LayoutRoot({ suppressNonChatPanels = false }: LayoutRootProps = {}): ReactNode {+export function LayoutRoot({+ suppressNonChatPanels = false,+ rightTabsCollapsed = false,+}: LayoutRootProps = {}): ReactNode {// 幂等注册内置面板 —— 放组件体而非模块副作用:HMR / 测试 reset 后再渲染也能自愈。registerBuiltinPanels();// 已装意识的面板首帧前同步注册:与内置面板同帧就位;未装意识的存档残留@@ -947,6 +952,9 @@ export function LayoutRoot({ suppressNonChatPanels = false }: LayoutRootProps =// 容器的 flex 子项。接管态只留 chat-main(见 LayoutRootProps)。const ledger = activeSplitLedger(content.children);const visible = ledger.entries.filter((e) => !suppressNonChatPanels || containsChat(e.node));+ const leftmostIndex = visible.findIndex(+ ({ node }) => !(rightTabsCollapsed && node.type === 'pane' && node.panelKind === 'right-tabs'),+ );// 撑满态:目标 pane 独占一行(自身经 PanelMaximizeContext 切成 flex-1),// 兄弟收成 0 宽裁切 —— 保持挂载不动 display:webview 卸载丢 webContents,// display:none 对 webview 也不友好;分割线整组不画。树账本(fraction/顺序)@@ -1048,7 +1056,7 @@ export function LayoutRoot({ suppressNonChatPanels = false }: LayoutRootProps =<NodeViewnode={entry.node}fillPane- atWindowLeft={i === 0}+ atWindowLeft={i === leftmostIndex}liveFractions={liveFractions}maximizedKind={null}chatOnly={suppressNonChatPanels}@@ -1062,7 +1070,7 @@ export function LayoutRoot({ suppressNonChatPanels = false }: LayoutRootProps =<NodeViewkey={entry.node.id}node={entry.node}- atWindowLeft={i === 0}+ atWindowLeft={i === leftmostIndex}liveFractions={liveFractions}maximizedKind={null}onLive={setLiveFractions}diff --git a/apps/desktop/src/renderer/layout/__tests__/LayoutRoot.test.tsx b/apps/desktop/src/renderer/layout/__tests__/LayoutRoot.test.tsxindex 1f8b208d9f..aecfdcb402 100644--- a/apps/desktop/src/renderer/layout/__tests__/LayoutRoot.test.tsx+++ b/apps/desktop/src/renderer/layout/__tests__/LayoutRoot.test.tsx@@ -307,6 +307,64 @@ describe('LayoutRoot · 树驱动的顺序与在场', () => {expect(screen.getAllByTestId('layout-divider')).toHaveLength(3);});+ // Bug:左置 right-tabs 收起后仍挂载,曾遮蔽聊天列的窗口左边缘标记,导致上方页签组+ // 不给 ChromeActions 留 no-drag 命中洞。现有测试只有展开布局;最小输入为零宽 right-tabs+ // + 带上方页签组的聊天列。经真实 LayoutRoot 验证面板消费的边缘合同及展开恢复;tier:unit。+ it('左置 right-tabs 收起时将窗口左边缘交给聊天列,重新展开后收回', () => {+ registerPanelKind({+ kind: 'tab-group:top',+ Component: () => (+ <div+ data-testid="p-top"+ data-window-left={String(usePaneAtWindowLeft())}+ data-window-top={String(usePaneAtWindowTop())}+ />+ ),+ collapseMemory: 'none',+ });+ currentLayout = {+ ...createDefaultLayout(),+ content: {+ type: 'split',+ id: 'root',+ direction: 'row',+ children: [+ { fraction: 0.3, node: { type: 'pane', id: 'right', panelKind: 'right-tabs' } },+ {+ fraction: 0.7,+ node: {+ type: 'split',+ id: 'chat-column',+ direction: 'column',+ children: [+ { fraction: 0.35, node: { type: 'pane', id: 'top', panelKind: 'tab-group:top' } },+ { fraction: 0.65, node: { type: 'pane', id: 'chat', panelKind: 'chat-main', minWidth: 400 } },+ ],+ },+ },+ ],+ },+ };+ const view = (collapsed: boolean) => (+ <BuiltinPanelBridgeProvider value={bridge}>+ <LayoutRoot rightTabsCollapsed={collapsed} />+ </BuiltinPanelBridgeProvider>+ );+ const rendered = render(view(false));+ const retainedRight = screen.getByTestId('p-right');+ expect(screen.getByTestId('p-top').getAttribute('data-window-left')).toBe('false');++ rendered.rerender(view(true));+ expect(screen.getByTestId('p-top').getAttribute('data-window-left')).toBe('true');+ expect(screen.getByTestId('p-top').getAttribute('data-window-top')).toBe('true');+ expect(screen.getByTestId('p-right')).toBe(retainedRight);++ rendered.rerender(view(false));+ expect(screen.getByTestId('p-top').getAttribute('data-window-left')).toBe('false');+ expect(screen.getByTestId('p-right')).toBe(retainedRight);+ expect(setLayoutMock).not.toHaveBeenCalled();+ });+// 测试价值// - 生产入口与可观察结果:LayoutRoot 渲染「聊天列」(chat-main 与上下页签组同在一层// column split);可观察的是聊天列作为根级弹性区域(flex-1、不吃像素宽)、列内有横缝、