Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(work-panel): keep active tab close action visible
vastsa2fb3deb4d392
diff --git a/apps/desktop/src/components/workpanel/WorkPanel.tsx b/apps/desktop/src/components/workpanel/WorkPanel.tsxindex b7a65bea7..1802a1ec9 100644--- a/apps/desktop/src/components/workpanel/WorkPanel.tsx+++ b/apps/desktop/src/components/workpanel/WorkPanel.tsx@@ -243,7 +243,9 @@ function LocalWorkPanel({const tabReorderState = useRef<WorkPanelTabReorderState | null>(null);const tabStripRef = useRef<HTMLDivElement | null>(null);const suppressedTabClickPointerIdsRef = useRef<Set<number>>(new Set());+ const tabWrapperRefs = useRef<Record<string, HTMLDivElement | null>>({});const tabButtonRefs = useRef<Record<string, HTMLButtonElement | null>>({});+ const tabCloseButtonRefs = useRef<Record<string, HTMLButtonElement | null>>({});const newTabButtonRef = useRef<HTMLButtonElement | null>(null);const [draggingTabId, setDraggingTabId] = useState<string | null>(null);const [dropIndicator, setDropIndicator] = useState<{@@ -312,10 +314,18 @@ function LocalWorkPanel({useLayoutEffect(() => {if (!activeTabId) return;+ tabWrapperRefs.current[activeTabId]?.scrollIntoView({+ block: "nearest",+ inline: "nearest",+ });tabButtonRefs.current[activeTabId]?.scrollIntoView({block: "nearest",inline: "nearest",});+ tabCloseButtonRefs.current[activeTabId]?.scrollIntoView({+ block: "nearest",+ inline: "nearest",+ });}, [activeTabId, tabs.length]);const finishTabReorder = useCallback(() => {@@ -850,6 +860,9 @@ function LocalWorkPanel({: TAB_ICONS[tab.kind];return (<div+ ref={(node) => {+ tabWrapperRefs.current[tab.id] = node;+ }}className={cx("work-panel-tab",selected && "active",@@ -889,6 +902,9 @@ function LocalWorkPanel({</button><buttontype="button"+ ref={(node) => {+ tabCloseButtonRefs.current[tab.id] = node;+ }}className="work-panel-tab-close"aria-label={t("panel.closeTab", { name: label })}title={t("panel.closeTab", { name: label })}diff --git a/apps/desktop/test/work-panel.test.mjs b/apps/desktop/test/work-panel.test.mjsindex c0f827cd3..b5e2de9ed 100644--- a/apps/desktop/test/work-panel.test.mjs+++ b/apps/desktop/test/work-panel.test.mjs@@ -42,6 +42,23 @@ test("closing a tab restores focus to its neighbor or the new-tab action", () =>assert.match(panelSource, /else newTabButtonRef\.current\?\.focus\(\)/);});+test("activating an overflowing tab keeps its close action in view", () => {+ const scrollEffectStart = panelSource.indexOf("useLayoutEffect(() => {\n if (!activeTabId) return;");+ const scrollEffectEnd = panelSource.indexOf(" }, [activeTabId, tabs.length]);", scrollEffectStart);+ assert.ok(scrollEffectStart >= 0);+ assert.ok(scrollEffectEnd > scrollEffectStart);+ const scrollEffect = panelSource.slice(scrollEffectStart, scrollEffectEnd);+ assert.match(scrollEffect, /tabWrapperRefs\.current\[activeTabId\]\?\.scrollIntoView/);+ assert.match(scrollEffect, /tabButtonRefs\.current\[activeTabId\]\?\.scrollIntoView/);+ assert.match(scrollEffect, /tabCloseButtonRefs\.current\[activeTabId\]\?\.scrollIntoView/);+ assert.ok(+ scrollEffect.indexOf("tabCloseButtonRefs") > scrollEffect.indexOf("tabButtonRefs"),+ "the close button should be the final scroll target",+ );+ assert.match(panelSource, /tabWrapperRefs\.current\[tab\.id\] = node/);+ assert.match(panelSource, /tabCloseButtonRefs\.current\[tab\.id\] = node/);+});+test("work panel replaces the context panel overlay", async () => {await assert.rejects(access(new URL("../src/components/ContextPanel.tsx", import.meta.url)),diff --git a/docs/spec/04-ux/07-ui-design-system.md b/docs/spec/04-ux/07-ui-design-system.mdindex 3ee249432..fc940e254 100644--- a/docs/spec/04-ux/07-ui-design-system.md+++ b/docs/spec/04-ux/07-ui-design-system.md@@ -547,7 +547,8 @@ pixel remains clickable. Termination is geometric: a region ends where theelement's border box ends, so an element that only pads its content clear ofthe band still covers the controls with its rectangle. The open work-panelheader uses a horizontally scrollable tab strip with a fixed `+` add trigger;-each tab owns its close action and the header does not add a second `×` beside+each tab owns its close action, and activating a tab scrolls its tab and close+action into the visible strip. The header does not add a second `×` besidethe native Windows close control. The bandfloats over the destination pages, so on Windows/Linux a page frame and anyright-edge detail sheet start below it instead of placing their own headerdiff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 5c6cfc16c..73b1fa67d 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -10162,6 +10162,7 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.| Quality | E2E-SETTINGS-inline-capability-imports, E2E-CHAT-long-history-stream-keeps-responsive, E2E-CHAT-running-status-survives-output-pauses, E2E-032, E2E-033, E2E-039, E2E-043, E2E-044, E2E-045, E2E-046, E2E-047, E2E-048, E2E-048A, E2E-049, E2E-050, E2E-053, E2E-055, E2E-056, E2E-057, E2E-058, E2E-059, E2E-060, E2E-061, E2E-062, E2E-063, E2E-064, E2E-065, E2E-066, E2E-067, E2E-068, E2E-069, E2E-070, E2E-071, E2E-072, E2E-073, E2E-074, E2E-075, E2E-076, E2E-077, E2E-078, E2E-079, E2E-080, E2E-081, E2E-082, E2E-083, E2E-084, E2E-085, E2E-086, E2E-092, E2E-093, E2E-094, E2E-095, E2E-096, E2E-097, E2E-098, E2E-099, E2E-100, E2E-101, E2E-102, E2E-102a, E2E-102b, E2E-102c, E2E-102d, E2E-102e, E2E-103, E2E-AGENTS-001, E2E-021a, E2E-024N, E2E-059a, E2E-060b, E2E-060c, E2E-061a, E2E-073a, E2E-111, E2E-114, E2E-117, E2E-118, E2E-119, E2E-120, E2E-122, E2E-123, E2E-142, E2E-143, E2E-144, E2E-145, E2E-146, E2E-147, E2E-148, E2E-150, E2E-151, E2E-153, E2E-155, E2E-158, E2E-159, E2E-160, E2E-161, E2E-162, E2E-163, E2E-168, E2E-172, E2E-173, E2E-174, E2E-011g, E2E-176, E2E-177, E2E-178, E2E-179, E2E-180, E2E-181, E2E-182, E2E-183, E2E-186, E2E-187, E2E-194, E2E-195, E2E-196a, E2E-196b, E2E-196c, E2E-198, E2E-199, E2E-200, E2E-196, E2E-201, E2E-204, E2E-202, E2E-203, E2E-205, E2E-206, E2E-207, E2E-208, E2E-209, E2E-210, E2E-UPDATE-preference-and-once-only-reminder, E2E-218, E2E-259, E2E-219, E2E-250, E2E-252, E2E-102i, E2E-SUBAGENT-settlement-updates-before-parent-poll, E2E-PLUGIN-imported-pi-package-skills, E2E-PLUGIN-fs-root-follows-the-calling-session, E2E-SUBAGENT-resume-a-settled-delegation, E2E-PLUGIN-provider-catalog-add-service || Quality (sidebar menu placement) | E2E-021c || Quality (project ordering) | E2E-253 |+| Quality (work-panel tab close visibility) | E2E-WORK-PANEL-active-tab-close-visibility || C — Conversation & stream (IME slash alias) | E2E-255 || E — Tools & permissions (Skill residency) | E2E-254 || Quality (Skill residency and IME slash alias) | E2E-254, E2E-255 |@@ -16183,6 +16184,27 @@ plugin-form fixtures in an isolated temporary directory at runtime.`scripts/e2e-work-panel-drag.mjs` (`pnpm test:e2e:work-panel-drag`). macOS/Linuxnative dragging remains unqualified.+### E2E-WORK-PANEL-active-tab-close-visibility++- **Preconditions**: Open a desktop session on Windows with the work panel at+ its narrow supported width and create a long-named file or plugin tab so the+ tab wrapper is wider than the visible horizontal strip.+- **Steps**: Activate the overflowing tab, then inspect the tab wrapper and+ its `.work-panel-tab-close` rectangle against the strip's client viewport.+ Repeat after switching between two overflowing tabs and after scrolling the+ strip toward either end.+- **Expected**: Activating a tab scrolls the whole tab wrapper and then its+ close button into the visible strip. The close button is visible and hit+ testable without requiring a middle click, keyboard shortcut, or widening+ the panel.+- **Specs linked**: `04-ux/07-ui-design-system.md` §10, issue #1762+- **Acceptance**: Quality+- **Milestone**: Post-M6 desktop shell maintenance+- **Status**: Renderer source-contract regression covered by+ `apps/desktop/test/work-panel.test.mjs`; the Windows probe in+ `scripts/e2e-work-panel-drag.mjs` also checks the active close-button+ rectangle before its native hit-test stages.+#### E2E-LAYOUT-sidebar-project-group-fold- **Preconditions**: Five retained sidebar project groups, seeded through thediff --git a/docs/zh-CN/spec/04-ux/07-ui-design-system.md b/docs/zh-CN/spec/04-ux/07-ui-design-system.mdindex 4042aad20..269ea04fe 100644--- a/docs/zh-CN/spec/04-ux/07-ui-design-system.md+++ b/docs/zh-CN/spec/04-ux/07-ui-design-system.md@@ -483,8 +483,9 @@ WebKit 与 Chromium 会忽略伪元素,该表面退回为常显的原生滚动Windows/Linux 将身份和侧边栏操作保留在第一位置行并为三个无框窗口控件保留最右边的 112px。每个control 拥有 46px 高保留带的全部份额。展开的工作面板标题使用可横向滚动的-标签条和固定 `+` 入口,每个标签拥有自己的关闭操作,避免在 Windows 原生-关闭控件旁重复第二个 `×`。头部的 `+`、最大化与视口固定的折叠开关共用同一+标签条和固定 `+` 入口,每个标签拥有自己的关闭操作;激活标签时,标签及其关闭+操作都会滚动到可见区域,避免在 Windows 原生关闭控件旁重复第二个 `×`。头部的+`+`、最大化与视口固定的折叠开关共用同一个控制间距(`--ds-work-panel-control-gap`,4px):标签条到动作组、`+` 到最大化,以及动作组到开关的车道预留(`calc(size + inset + gap)`,44px)。动作组不再有自己的分隔线、内缩或外边距,因此这三个按钮读作一组。三者都是共享的diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.mdindex 836ce1eb5..c816acc7c 100644--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md@@ -5780,6 +5780,7 @@ eleven-tool-round desktop paths are verified by| 品质 | E2E-SETTINGS-inline-capability-imports、E2E-CHAT-running-status-survives-output-pauses、E2E-032、E2E-033、E2E-039、E2E-043、E2E-044、E2E-045、E2E-046、E2E-047、E2E-048、E2E-048c、E2E-048A、E2E-049、E2E-050、E2E-053、E2E-055、 E2E-056、E2E-057、E2E-058、E2E-059、E2E-060、E2E-061、E2E-062、E2E-063、E2E-064、E2E-065、E2E-066、E2E-067、E2E-068、E2E-069、 E2E-070、E2E-071、E2E-072、E2E-073、E2E-074、E2E-075、E2E-076、E2E-077、E2E-078、E2E-079、E2E-080、E2E-081、E2E-082、E2E-083、 E2E-084、E2E-085、E2E-086、E2E-092、E2E-093、E2E-094、E2E-095、E2E-096、E2E-097、E2E-098、E2E-099、E2E-100、E2E-101、E2E-102、 E2E-102a、E2E-102b、E2E-103、E2E-AGENTS-001、E2E-024N、E2E-024O、E2E-059a、E2E-060b、E2E-060c、E2E-060d、E2E-061a、E2E-073a、E2E-111、 E2E-114、E2E-117、E2E-118、E2E-119、E2E-120、E2E-122、E2E-123、E2E-142、E2E-143、E2E-144、E2E-145、E2E-146、E2E-147、E2E-148、E2E-150、E2E-151、E2E-153、E2E-194、E2E-195、E2E-199、E2E-200、E2E-201、E2E-202、E2E-203、E2E-204、E2E-209、E2E-210、E2E-UPDATE-preference-and-once-only-reminder、E2E-250、E2E-PLUGIN-imported-pi-package-skills、E2E-SUBAGENT-resume-a-settled-delegation || 品质(侧边栏菜单定位) | E2E-021c || 品质(项目排序) | E2E-253 |+| 品质(工作面板标签关闭按钮可见性) | E2E-WORK-PANEL-active-tab-close-visibility || C — 对话和直播(输入法斜杠别名) | E2E-255 || E——工具和权限(Skill 常驻) | E2E-254 || 品质(Skill 常驻与输入法斜杠别名) | E2E-254、E2E-255 |@@ -8481,6 +8482,16 @@ runner 会在运行时的隔离临时目录中生成六个插件形态 fixture- **验收**:品质- **状态**:Windows 原生回归由 `scripts/e2e-work-panel-drag.mjs`(`pnpm test:e2e:work-panel-drag`)覆盖;macOS/Linux 原生拖动尚未验证。+### E2E-WORK-PANEL-active-tab-close-visibility++- **前提条件**:在 Windows 上打开桌面会话,将工作面板调整到支持的窄宽度,并创建一个名称较长的文件或插件标签,使标签容器宽于可见的横向标签栏。+- **步骤**:激活发生溢出的标签,读取标签容器及其 `.work-panel-tab-close` 矩形与标签栏 client 视口的关系。在两个溢出标签之间切换,并分别将标签栏滚向两端后重复检查。+- **预期**:激活标签时,整个标签容器及其关闭按钮都会滚动到可见标签栏内。关闭按钮无需中键、键盘快捷键或扩大面板即可看见并命中。+- **链接规格**:`04-ux/07-ui-design-system.md` §10,issue #1762+- **验收**:品质+- **里程碑**:M6 之后桌面壳维护+- **状态**:渲染器源契约回归由 `apps/desktop/test/work-panel.test.mjs` 覆盖;`scripts/e2e-work-panel-drag.mjs` 的 Windows 探针也会在原生命中测试阶段前检查激活标签关闭按钮的矩形。+#### E2E-LAYOUT-sidebar-project-group-fold- **前提条件**:通过宿主预置四个保留的侧边栏项目分组:一个横跨四个日期桶共五个会话,一个只有单个会话,一个没有任何会话,一个带十个已固定会话。未设置 `prefers-reduced-motion`。diff --git a/scripts/e2e-work-panel-drag.mjs b/scripts/e2e-work-panel-drag.mjsindex b0ae5abc2..8d708ba6b 100644--- a/scripts/e2e-work-panel-drag.mjs+++ b/scripts/e2e-work-panel-drag.mjs@@ -81,7 +81,7 @@ function electronProbe() {window.showInactive();const handle = window.getNativeWindowHandle();const hwnd = (handle.length === 8 ? handle.readBigUInt64LE() : BigInt(handle.readUInt32LE())).toString();- for (const stage of ["overflow-end", "switch-back", "overflow-start", "keyboard-reorder", "one-tab", "no-tabs"]) {+ for (const stage of ["active-close", "overflow-end", "switch-back", "overflow-start", "keyboard-reorder", "one-tab", "no-tabs"]) {const points = await window.webContents.executeJavaScript("globalThis.workPanelDragProbe(" + JSON.stringify(stage) + ")");await window.webContents.capturePage();const scale = await window.webContents.executeJavaScript("devicePixelRatio");diff --git a/scripts/e2e/work-panel-drag.tsx b/scripts/e2e/work-panel-drag.tsxindex 0a09ca857..2330b95d4 100644--- a/scripts/e2e/work-panel-drag.tsx+++ b/scripts/e2e/work-panel-drag.tsx@@ -52,7 +52,29 @@ async function rendered() {}globalThis.workPanelDragProbe = async (stage) => {- if (stage === "overflow-end") {+ if (stage === "active-close") {+ await ready;+ const longFileTab = {+ id: "file:/workspace/very-long-folder-name/another-folder/README.md",+ kind: "file" as const,+ resource: "/workspace/very-long-folder-name/another-folder/README.md",+ };+ flushSync(() => {+ useAppStore.setState({+ activeSessionId: "drag-a",+ workPanelOpen: true,+ workPanelWidth: 244,+ workPanelTabs: [longFileTab],+ activeWorkPanelTabId: longFileTab.id,+ pluginViews: [],+ });+ root.render(<I18nextProvider i18n={i18n}><WorkPanel containerWidth={1000} sidebarCollapsed /></I18nextProvider>);+ });+ await rendered();+ const strip = element(".work-panel-tab-strip").getBoundingClientRect();+ const close = element(".work-panel-tab-close").getBoundingClientRect();+ assert(close.left >= strip.left && close.right <= strip.right, "active tab close button is clipped from the strip viewport");+ } else if (stage === "overflow-end") {await ready;flushSync(() => {useAppStore.setState({ activeSessionId: "drag-a", workPanelWidth: 360, pluginViews: [] });