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(desktop): bound idle status indicator animations
vastsa968c7b6c80b2
diff --git a/apps/desktop/src/styles/composer.css b/apps/desktop/src/styles/composer.cssindex 0dd202905..d70704854 100644--- a/apps/desktop/src/styles/composer.css+++ b/apps/desktop/src/styles/composer.css@@ -241,7 +241,7 @@.composer-mode-chip[data-planning="true"] svg {color: var(--ds-purple) !important;animation: composer-mode-planning-pulse 1.2s var(--motion-ease-standard)- infinite;+ 2;}@keyframes composer-mode-face-in {@@ -882,6 +882,10 @@}@media (prefers-reduced-motion: reduce) {+ .composer-mode-chip[data-planning="true"] svg {+ animation: none;+ }+.todo-dock-header,.todo-dock-content,.todo-dock-row {diff --git a/apps/desktop/src/styles/overlays.css b/apps/desktop/src/styles/overlays.cssindex 8c15ac09c..74c52e5e0 100644--- a/apps/desktop/src/styles/overlays.css+++ b/apps/desktop/src/styles/overlays.css@@ -650,7 +650,7 @@}.backend-banner.warn .backend-dot {background: var(--ds-warning);- animation: pulse-soft 1.2s ease-in-out infinite;+ animation: pulse-soft 1.2s ease-in-out 2;}.backend-banner.fatal .backend-dot {background: var(--ds-error);@@ -691,6 +691,9 @@.provider-dialog {animation-duration: 0.01ms !important;}+ .backend-banner.warn .backend-dot {+ animation: none;+ }.working-indicator-mark > span,.tool-row-name.running::after,.tool-activity-label.running::after {diff --git a/apps/desktop/src/styles/sessions.css b/apps/desktop/src/styles/sessions.cssindex 7b0f28d18..a5ee63928 100644--- a/apps/desktop/src/styles/sessions.css+++ b/apps/desktop/src/styles/sessions.css@@ -335,7 +335,7 @@background: var(--ds-purple);box-shadow: 0 0 0 3px color-mix(in oklab, var(--ds-purple) 15%, transparent);content: "";- animation: sidebar-status-pulse-purple 1.2s ease-in-out infinite;+ animation: sidebar-status-pulse-purple 1.2s ease-in-out 2;}.thread-item-status.selected::before {diff --git a/apps/desktop/test/idle-status-animations.test.mjs b/apps/desktop/test/idle-status-animations.test.mjsnew file mode 100644index 000000000..23daf3c37--- /dev/null+++ b/apps/desktop/test/idle-status-animations.test.mjs@@ -0,0 +1,94 @@+import assert from "node:assert/strict";+import test from "node:test";+import { loadStylesSync } from "./helpers/styles.mjs";++/**+ * Idle status indicators must not keep submitting frames.+ *+ * Any continuously animating indicator keeps the window surface dirty, and the+ * macOS window is `transparent: true` over the native `sidebar` vibrancy+ * material, so it is re-composited every frame it stays dirty: a 7px dot is+ * enough to drive WindowServer GPU to ~70% on an otherwise idle desktop. See+ * issue #1064 and `04-ux/07-ui-design-system.md` (sidebar status marks).+ */++const styles = loadStylesSync();++function declarationBlock(selector) {+ const start = styles.indexOf(`${selector} {`);+ assert.ok(start >= 0, `missing rule block for ${selector}`);+ const end = styles.indexOf("}", start);+ assert.ok(end > start, `unterminated rule block for ${selector}`);+ return styles.slice(start, end + 1);+}++function containedRule(scope, selector) {+ const start = scope.indexOf(`${selector} {`);+ if (start < 0) return null;+ const end = scope.indexOf("}", start);+ return scope.slice(start, end + 1);+}++/** Every top-level `@media (prefers-reduced-motion: reduce)` block, by brace. */+function reducedMotionBlocks() {+ const marker = "@media (prefers-reduced-motion: reduce) {";+ const blocks = [];+ let from = 0;+ for (;;) {+ const start = styles.indexOf(marker, from);+ if (start < 0) return blocks;+ let depth = 0;+ let index = start + marker.length - 1;+ for (; index < styles.length; index += 1) {+ if (styles[index] === "{") depth += 1;+ else if (styles[index] === "}") {+ depth -= 1;+ if (depth === 0) break;+ }+ }+ blocks.push(styles.slice(start, index + 1));+ from = index + 1;+ }+}++// Running marks were bounded by #1064; the rest stay mounted while nothing is+// running (a session waiting on permission, plan mode left on, a backend+// warning banner), so they kept animating on an idle window.+const IDLE_INDICATORS = [+ ".thread-item-status.running::before",+ ".sidebar-session-hover-card-session-link-status::before",+ ".thread-item-status.permission::before",+ '.composer-mode-chip[data-planning="true"] svg',+ ".backend-banner.warn .backend-dot",+];++test("idle status indicators stop submitting frames", () => {+ for (const selector of IDLE_INDICATORS) {+ const block = declarationBlock(selector);+ assert.doesNotMatch(+ block,+ /infinite/,+ `${selector} must not animate forever while the window is idle`,+ );+ assert.match(+ block,+ /animation:[^;]*\b[12];/,+ `${selector} must keep a finite cycle count`,+ );+ }+});++test("idle status indicators honour reduced motion", () => {+ const blocks = reducedMotionBlocks();+ for (const selector of IDLE_INDICATORS) {+ const rule = blocks+ .map((block) => containedRule(block, selector))+ .find((candidate) => candidate !== null);+ assert.ok(rule, `${selector} needs a prefers-reduced-motion fallback`);+ assert.match(+ rule,+ /animation: none/,+ `${selector} must disable its animation under reduced motion`,+ );+ }+});diff --git a/docs/spec/04-ux/07-ui-design-system.md b/docs/spec/04-ux/07-ui-design-system.mdindex c063b71cb..ca1d3a328 100644--- a/docs/spec/04-ux/07-ui-design-system.md+++ b/docs/spec/04-ux/07-ui-design-system.md@@ -274,6 +274,17 @@ animate for two 1.6-second cycles when mounted or entering the running state,then remain steady until the status changes. They must not continuouslysubmit frames while the rest of the window is idle.+The same bound covers every idle-reachable status indicator, because any+one of them keeps the transparent macOS window dirty and therefore+re-composited even when nothing is happening: the permission dot on a+session waiting for approval, the plan-mode chip in the composer toolbar,+and the warning dot on the backend banner each play two cycles and then+hold a steady state that carries the meaning by itself (purple fill,+planning-tinted icon, warning fill). Only indicators that describe work in+flight — a streaming cursor, a running tool row, a recording microphone —+may animate for as long as that work lasts. Reduced-motion mode disables+all of them.+### 4.6 Tailwind CSS variable stubThe following CSS custom properties stub is the canonical bridge between spec tokens and Tailwind classes. It is **not an app source file** — it documents the intended mapping for implementation.diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 4cb847eb5..fd18f4ad7 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -10330,6 +10330,12 @@ This test plan spec is accepted when:idle native macOS window must show no continuous frames from these markers.Start a new turn and reopen the hover card: the bounded animation can play again.GPU measurements must distinguish app frame submissions from whole-system load.+- Repeat with the three idle-reachable indicators, one per idle window: leave a+ session parked on a tool approval request, turn plan mode on, and raise a+ backend warning banner. After 3.2 seconds none of the permission dot, the+ plan-mode chip, or the warning dot has an active animation, and recording an+ otherwise idle native macOS window shows no continuous frames from them.+ Under reduced motion all three are static from the first painted frame.### US-UI-68 Session-scoped inline permissions and artifacts (D138/D142)- Run two sessions concurrently and keep A visible while B reaches a tooldiff --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 7832703f4..d3b63cacb 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@@ -242,6 +242,12 @@ PI-Desktop 的行为类似于桌面应用程序 shell,因此意外拖动各 1.6 秒的呼吸动画,随后保持常亮,直到状态变化。窗口其余内容空闲时,圆点不得持续提交绘制帧。+同一上限适用于所有可在空闲时挂载的状态指示:等待审批会话的权限圆点、+输入框工具栏的计划模式芯片、后端横幅上的告警圆点。三者同样播放两轮后+转为常亮,并由自身颜色(紫色填充、计划图标着色、告警填充)单独表意。+只有描述进行中工作的指示(流式光标、运行中的工具行、录音中的麦克风)+才可在该工作持续期间保持动画。减少动态效果会禁用以上全部动画。+### 4. 6 Tailwind CSS 变量存根以下 CSS 自定义属性存根是规范标记和 Tailwind 类之间的规范桥梁。它**不是应用程序源文件** - 它记录了用于实现的预期映射。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 2edcd127c..1406ebee6 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@@ -6400,6 +6400,10 @@ eleven-tool-round desktop paths are verified by对其余内容空闲的原生 macOS 窗口录制时,标记不得持续产生绘制帧。开始新一轮任务并重新打开悬浮卡,有限动画可以再次播放。GPU 测量须区分应用提交帧与整机负载。+- 对三处空闲可挂载的指示分别用一个空闲窗口重复:让一个会话停留在工具+ 审批请求上、开启计划模式、显示后端告警横幅。3.2 秒后,权限圆点、计划+ 模式芯片和告警圆点均无活动动画,对其余内容空闲的原生 macOS 窗口录制时+ 不得出现来自它们的持续绘制帧。启用减少动态效果时,三者自首帧起即为静态。### US-UI-68 会话范围的内联权限和工件 (D138/D142)- 同时运行两个会话,并在 B 到达工具时保持 A 可见