Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

feat(composer): refine todo dock disclosure

vastsaf469af3d28d4
diff --git a/apps/desktop/src/components/TodoDock.tsx b/apps/desktop/src/components/TodoDock.tsx
index 905316d36..ef32c2e8d 100644
--- a/apps/desktop/src/components/TodoDock.tsx
+++ b/apps/desktop/src/components/TodoDock.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useState } from "react";
+import { useEffect, useId, useState } from "react";
import { useTranslation } from "react-i18next";
import type { SessionTodo, TodoStatus } from "@pi-desktop/shared";
import { Button } from "./ui";
@@ -9,11 +9,11 @@ import { useAppStore } from "../stores/app-store";
function statusSymbol(status: TodoStatus): string {
switch (status) {
case "in_progress":
- return "◐";
+ return "•";
case "cancelled":
- return "⊘";
+ return "−";
default:
- return "○";
+ return "";
}
}
@@ -21,6 +21,7 @@ export function TodoDock({ sessionId }: { sessionId: string }) {
const { t } = useTranslation();
const snapshot = useAppStore((state) => state.sessionTodos[sessionId]);
const [expanded, setExpanded] = useState(false);
+ const contentId = useId();
useEffect(() => {
setExpanded(false);
@@ -36,13 +37,14 @@ export function TodoDock({ sessionId }: { sessionId: string }) {
const finished = snapshot.todos.every(
(todo) => todo.status === "completed" || todo.status === "cancelled",
);
- const statusLabel = allCancelled
+ const progressLabel = allCancelled
? t("chat.todo.status.cancelled")
: finished
? t("chat.todo.completed", { completed, total: denominator })
- : current
- ? t("chat.todo.current", { completed, total: denominator, content: current.content })
- : t("chat.todo.progress", { completed, total: denominator });
+ : t("chat.todo.progress", { completed, total: denominator });
+ const statusLabel = current
+ ? t("chat.todo.current", { completed, total: denominator, content: current.content })
+ : progressLabel;
return (
<div className={`todo-dock${expanded ? " is-expanded" : ""}`}>
@@ -50,16 +52,23 @@ export function TodoDock({ sessionId }: { sessionId: string }) {
type="button"
variant="ghost"
className="todo-dock-header"
+ aria-label={statusLabel}
+ aria-controls={contentId}
aria-expanded={expanded}
onClick={() => setExpanded((value) => !value)}
>
<span className="todo-dock-header-symbol" aria-hidden>
{allCancelled ? "⊘" : finished ? "✓" : "◐"}
</span>
- <span className="todo-dock-header-text">{statusLabel}</span>
+ <span className="todo-dock-header-text">{progressLabel}</span>
+ {current ? (
+ <span className="todo-dock-header-current" title={current.content}>
+ {current.content}
+ </span>
+ ) : null}
{expanded ? <IconChevronUp size={14} /> : <IconChevronDown size={14} />}
</Button>
- <div className="todo-dock-content" aria-hidden={!expanded}>
+ <div id={contentId} className="todo-dock-content" aria-hidden={!expanded}>
<div className="todo-dock-clip">
{/* The expanded dock lists every row (#1319): the list scrolls
inside its own box instead of truncating to a static "N more"
diff --git a/apps/desktop/src/styles/composer.css b/apps/desktop/src/styles/composer.css
index e08689b03..778f17b79 100644
--- a/apps/desktop/src/styles/composer.css
+++ b/apps/desktop/src/styles/composer.css
@@ -736,10 +736,12 @@
.todo-dock-header {
display: flex;
width: 100%;
+ min-width: 0;
+ min-height: 38px;
align-items: center;
- gap: 8px;
+ gap: 10px;
border: 0;
- padding: 7px 10px;
+ padding: 7px 12px;
background: transparent;
color: var(--ds-text-primary);
text-align: left;
@@ -758,8 +760,11 @@
background: var(--ds-bg-hover);
}
-.todo-dock-header-symbol,
-.todo-dock-row-symbol {
+.todo-dock.is-expanded .todo-dock-header {
+ border-bottom: 1px solid var(--ds-border-subtle);
+}
+
+.todo-dock-header-symbol {
display: grid;
flex: 0 0 auto;
width: 18px;
@@ -770,14 +775,26 @@
}
.todo-dock-header-text {
+ flex: 0 0 auto;
+ font-size: var(--text-sm);
+ white-space: nowrap;
+}
+
+.todo-dock-header-current {
min-width: 0;
flex: 1;
overflow: hidden;
+ color: var(--ds-text-muted);
font-size: var(--text-sm);
text-overflow: ellipsis;
white-space: nowrap;
}
+.todo-dock-header > svg {
+ flex: 0 0 auto;
+ color: var(--ds-text-muted);
+}
+
.todo-dock-content {
display: grid;
grid-template-rows: 0fr;
@@ -806,8 +823,8 @@
.todo-dock-list {
display: grid;
- gap: 6px;
- padding: 0 10px 10px;
+ gap: 0;
+ padding: 2px 12px 8px;
}
/* The expanded dock lists every row and scrolls inside its own box (#1319):
@@ -830,38 +847,54 @@
display: flex;
min-width: 0;
align-items: center;
- gap: 8px;
- min-height: 30px;
- border-radius: var(--radius-sm);
- padding: 4px 8px;
- background: var(--ds-tile-deep);
+ gap: 10px;
+ min-height: 24px;
+ padding: 4px 2px;
color: var(--ds-text-secondary);
+ font-size: var(--text-sm);
+ transition: color var(--motion-duration-fast) var(--motion-ease-out);
+}
+
+.todo-dock-row-symbol {
+ display: grid;
+ flex: 0 0 auto;
+ width: 16px;
+ height: 16px;
+ place-items: center;
+ border: 1px solid var(--ds-border-default);
+ border-radius: var(--radius-3xs);
+ color: var(--ds-text-muted);
font-size: var(--text-xs);
- transition:
- background-color var(--motion-duration-fast) var(--motion-ease-out),
- color var(--motion-duration-fast) var(--motion-ease-out);
+ line-height: var(--leading-none);
}
.todo-dock-row-completed {
- background: color-mix(in oklab, var(--ds-success) 14%, var(--ds-tile-deep));
- color: var(--ds-text-primary);
+ color: var(--ds-text-muted);
}
.todo-dock-row-completed .todo-dock-row-symbol {
- color: var(--ds-success);
+ border-color: var(--ds-text-muted);
}
.todo-dock-row-in_progress {
- background: color-mix(in oklab, var(--ds-accent) 10%, var(--ds-tile-deep));
color: var(--ds-text-primary);
font-weight: var(--font-weight-medium);
}
+.todo-dock-row-in_progress .todo-dock-row-symbol {
+ border-color: var(--ds-accent);
+ color: var(--ds-accent);
+}
+
.todo-dock-row-cancelled {
color: var(--ds-text-muted);
opacity: 0.72;
}
+.todo-dock-row-cancelled .todo-dock-row-symbol {
+ border-color: var(--ds-text-muted);
+}
+
.todo-dock-row-content {
min-width: 0;
overflow: hidden;
diff --git a/apps/desktop/test/todo-dock-rendering.test.mjs b/apps/desktop/test/todo-dock-rendering.test.mjs
index adaae6d55..8f09bca4d 100644
--- a/apps/desktop/test/todo-dock-rendering.test.mjs
+++ b/apps/desktop/test/todo-dock-rendering.test.mjs
@@ -51,6 +51,8 @@ test("TodoDock renders bounded session progress and cancelled state", async () =
});
const html = render();
assert.match(html, /aria-expanded="false"/);
+ assert.match(html, /aria-controls="[^"]+"/);
+ assert.match(html, /class="todo-dock-header-current"[^>]*>second<\/span>/);
assert.match(html, /class="todo-dock-content" aria-hidden="true"/);
assert.match(html, /class="todo-dock-content" aria-hidden="true"><div class="todo-dock-clip">/);
assert.match(html, /extra-0/);
@@ -86,7 +88,11 @@ test("TodoDock uses a quiet disclosure animation and state surfaces", async () =
assert.match(css, /\.todo-dock-header:active:not\(:disabled\)\s*\{[\s\S]*?transform:\s*none;/);
assert.match(css, /\.todo-dock-content\s*\{[\s\S]*?grid-template-rows:\s*0fr;[\s\S]*?opacity:\s*0;/);
assert.match(css, /\.todo-dock\.is-expanded \.todo-dock-content\s*\{[\s\S]*?grid-template-rows:\s*1fr;/);
- assert.match(css, /\.todo-dock-row-completed\s*\{[\s\S]*?var\(--ds-success\)/);
+ assert.match(css, /\.todo-dock-row\s*\{[\s\S]*?min-height:\s*24px;[\s\S]*?font-size:/);
+ assert.match(css, /\.todo-dock-row-symbol\s*\{[\s\S]*?border:\s*1px solid var\(--ds-border-default\)/);
+ assert.match(css, /\.todo-dock-row-completed\s*\{[\s\S]*?color:\s*var\(--ds-text-muted\);/);
+ assert.match(css, /\.todo-dock-row-in_progress\s*\{[\s\S]*?font-weight:/);
+ assert.doesNotMatch(css, /\.todo-dock-row(?:-completed|-in_progress)?\s*\{[^}]*background:/);
// The expanded list is the scrollport (#1319): bounded height, internal
// scroll, no chaining into the transcript, and reachable from the keyboard.
assert.match(
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index 7311437d3..162c13338 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -2927,9 +2927,10 @@ reasoning-level control.
- The Composer stack places TodoDock above Plan/Goal approval surfaces when the
active session has a non-empty host-owned checklist. An empty checklist does
not reserve layout space.
-- The collapsed header shows completed/active progress and the current
- `in_progress` content. A checklist whose items are all cancelled has a clear
- cancelled label instead of a misleading `0/0 completed` count.
+- The collapsed header separates the completed-task count from the current
+ `in_progress` content, truncating only the task title when space is limited.
+ A checklist whose items are all cancelled has a clear cancelled label
+ instead of a misleading `0/0 completed` count.
- The disclosure is keyboard accessible, does not take focus on updates, and
resets closed when the active session changes. The expanded dock lists every
ordered row and scrolls inside its own box (`max-height: min(280px, 30dvh)`,
@@ -2941,9 +2942,10 @@ reasoning-level control.
collapsed content is `aria-hidden` and reduced-motion users receive an
immediate state change. A collapsed dock reserves only its header row: the
list's inset is clipped, never laid out below the header.
- Completed rows use a success-tinted tile with a check icon, in-progress rows
- use the accent tint, and cancelled rows are muted. Each status symbol has a
- localized accessible name, and each row renders plain text.
+ Expanded rows use a compact, flat checklist layout with square status marks.
+ Completed text and cancelled rows are muted; the in-progress row remains
+ primary and medium-weight. Each status symbol has a localized accessible
+ name, and each row renders plain text.
- Renderer snapshots are keyed by session id. A `todos.changed` event with an
older or equal revision is ignored. Session activation and host recovery
re-read the authoritative snapshot, including already cached checklists; a
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 8f29a9c3b..41574e9f6 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -9964,9 +9964,10 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.
- **Expected**: Host SQLite is authoritative; each successful full replacement
advances revision, including clear, and emits one committed `todos.changed`
snapshot. Invalid or unauthorized writes do not mutate or emit. TodoDock
- renders plain text, does not take focus, resets expansion on session changes,
- lists every ordered row with the dock's own list as the scrollport,
- keeps a collapsed dock to its header height,
+ renders plain text, separates collapsed progress from the current item,
+ uses compact square status marks in a flat expanded list, does not take focus,
+ resets expansion on session changes, lists every ordered row with the dock's
+ own list as the scrollport, and keeps a collapsed dock to its header height,
rejects stale events, and skips local recovery for `remote:` sessions because
RACP v1 has no Todo snapshot operation.
- **Specs**: `03-runtime/03-tools-and-permissions.md`,
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index 338be1d8c..9566372dd 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -369,9 +369,9 @@ export const zhCN = {
acHint: "↑↓ 选择 · Enter 确认 · Esc 关闭",
send: "发送",
todo: {
- progress: "已完成 {{completed}}/{{total}}",
+ progress: "已完成 {{completed}} 个任务(共 {{total}} 个)",
current: "{{completed}}/{{total}} · 当前:{{content}}",
- completed: "已完成 {{completed}}/{{total}}",
+ completed: "已完成 {{completed}} 个任务(共 {{total}} 个)",
updated: "清单已更新",
updating: "正在更新清单",
status: { pending: "待办", in_progress: "进行中", completed: "已完成", cancelled: "已取消" },