Skip to content

A local-first multi-agent app development platform, built on PenguinHarness

refactor(web): one status-tone vocabulary, on-demand explanations, one icon family (#378)

Yaowei Zheng9c895051678e
diff --git a/.agents/skills/penguin-harness-frontend/SKILL.md b/.agents/skills/penguin-harness-frontend/SKILL.md
new file mode 100644
index 00000000..78b2eb69
--- /dev/null
+++ b/.agents/skills/penguin-harness-frontend/SKILL.md
@@ -0,0 +1,188 @@
+---
+name: penguin-harness-frontend
+description: Use when changing the PenguinHarness Web App (`packages/web`) — adding or restyling any UI, picking a status colour, adding an icon, laying out a row or a form field, writing user-facing copy, or building a popup. Covers the semantic tone tokens, the icon size/stroke/gap scale, the semantic-versus-formatting rule for explanatory text, the two-dictionary i18n contract, and the portal-panel pattern with its Esc and scroll caveats.
+---
+
+# Web App frontend conventions
+
+`packages/web` is React 19 + Vite + Tailwind CSS 4, with no `cn`/`clsx`, no `tailwind-merge`, and no
+variants library. Classes are composed with template literals, and a component's variants are a
+`Record<Key, string>` next to it (`button.tsx`'s `variantClass`, `input.tsx`'s `sizeClass`). Match
+that shape; do not introduce a styling dependency.
+
+This file records the decisions that already exist so they are not re-litigated per PR. Read
+`penguin-harness-dev` for the repo-wide contract (verification chain, changelog, two-repo layout).
+
+## Status colour: pick a tone, never a palette class
+
+`src/lib/tone.ts` is the only place a status colour is spelled. Five tones, chosen by **meaning**:
+
+| tone | meaning | when |
+| --- | --- | --- |
+| `busy` | executing right now | spinners, live titles, running dots |
+| `attention` | unfinished — waiting on time, a queue, or the user | hourglass glyphs, pending-approval marks, near-limit rings, warning strips |
+| `success` | finished well, connected, healthy | completed badges, connected servers |
+| `danger` | failed, destructive, over a limit | errors, delete affordances |
+| `muted` | settled; the mark should recede | a done row's glyph |
+
+Four maps, by the shape of the thing being coloured: `toneInk` (a glyph or a line of status text),
+`toneSurface` (a tinted pill with its own text — badges), `toneDot` (the 6px state dots),
+`toneStrip` (a bordered notice that owns a row).
+
+Rules:
+
+- **Two states may share a tone.** `busy` and `success` resolve to the same emerald on purpose. A
+ tone says what a mark *means*, not which state it belongs to. Where two states share a tone,
+ separate them by **shape and motion** — that is what the session list's turning hourglass and
+ squeezing compress mark do, and it is legible to a reader who cannot separate hues.
+- **Never make colour the only carrier.** Every status mark also names its state in an accessible
+ name or in adjacent text.
+- **Contrast is measured, not assumed.** The ratios in `tone.ts` are WCAG 2.x against the four
+ surfaces marks actually sit on — white and gray-50 in light, and the values this app *overrides*
+ in `styles.css` for dark (gray-950 is `#000000`, gray-900 is `#0d0d0d`, not Tailwind's stock
+ values). Recompute if you change a tone; a graphical mark needs 3:1, and `muted` is the one tone
+ allowed below it because its meaning is always already in text.
+- **What is out of scope**, and must not be folded in: categorical palettes where colour is an
+ identity rather than a judgement (`category-colors.ts`, `token-colors.ts`, the timeline phase
+ bars, per-skill avatar tints); the terminal's chrome, which resolves light/dark in JS because a
+ subtree cannot opt out of the `dark:` variant (`terminal-appearance.ts` carries its own
+ `success`/`attention`/`danger`); secondary body text, which is typography; a background-only wash
+ on a card section; and hover-only variants, since a tone token is the resting ink.
+
+## Explanatory text: semantics disclose, formatting stays
+
+Two kinds of prose, and the split decides *whether* it is disclosed.
+
+- **Semantics** — what a section is, what a field means, what it affects, when a change takes
+ effect. Read once, then in the way forever. It is disclosed on request.
+- **Formatting** — the shape the value must take: "one `KEY=value` per line", "one argument per
+ line", "leave empty for unlimited", allowed characters, a `k`/`m` suffix. Read *while typing*.
+ It stays on screen, in the field's `hint`. Hiding it turns a glance into a click and raises the
+ error rate.
+
+A string that mixes both is a string that should be split, not a judgement call. When you cannot
+split it, keep it visible — a visible sentence is never a bug, a hidden format rule is.
+
+Already-disclosed text does not move: `title=` tooltips, `OptionMenu` row descriptions, confirm
+dialog bodies (the dialog *is* the disclosure), toasts, and empty states.
+
+### Which disclosure — the "?" or the fold
+
+Two forms, and **a title decides between them, not taste**:
+
+> **The circled "?" may only appear beside a title. It must never stand alone on its own line.
+> Where it would stand alone, use the fold.**
+
+- **A title is present** → `InfoPopover` (`components/ui/info-popover.tsx`). A circled "?"
+ immediately after the section heading, the table column header, or the field label — the last of
+ those via `Field`/`Input`/`Textarea`/`PasswordInput`'s `info` prop. The "?" is an *anchored*
+ mark: it reads as help only because it modifies the title it sits against, and it borrows that
+ title's meaning instead of restating it.
+- **No title on the surface** → `HelpFold` (`components/ui/help-fold.tsx`). A compact row that
+ names itself and expands its explanation inline underneath. This is the Agent settings tabs:
+ their name lives in the tab bar and the panel does not repeat it, so a "?" at the top of the
+ panel would be a mark modifying nothing. A neighbouring `<Button>` does not rescue it — a
+ control is not a title.
+
+The fold is **not** a popover in another shape: it is inline flow, so it takes no portal. Do not
+reach for `usePortalPanel` there for symmetry — that hook exists to keep a *floating* panel clear
+of an ancestor's overflow and to close it on outside click, Esc or scroll, and a fold does none of
+those things. It follows the WAI-ARIA disclosure pattern instead: the panel stays in the DOM and
+is `hidden` while collapsed, so its `aria-controls` always resolves.
+
+Both are collapsed by default, both are real `<button>`s with `aria-expanded` and `aria-controls`,
+and both fold the subject into the accessible name ("More info: Vault") rather than repeating it,
+so a "?" inside a heading does not make that heading announce its own title twice. The fold's
+visible text is a prefix of that name, so "label in name" holds.
+
+`test/disclosure-anchor.test.ts` enforces the rule: it parses the real JSX with the TypeScript
+parser and fails, naming file and line, on any `InfoPopover` with no title among its preceding
+siblings. Extend `TITLE_ELEMENTS` there if you add a component whose job is to be a title.
+
+**The HTML trap this forces.** A `<button>` is a labelable element, and a wrapping `<label>` names
+its first labelable descendant — so a "?" nested inside `Field`'s usual `<label>` would silently
+retarget the field's title from the input to the button. `Field` therefore has two layouts: without
+`info` it wraps in `<label>`; with `info` it splits the title out and associates it by `htmlFor`,
+which is why the control needs an id. `test/info-popover.test.ts` guards this.
+
+## Icons
+
+One renderer: `components/ui/glyph-icon.tsx`. A 24×24 path, `strokeWidth` 1.7, `stroke="currentColor"`,
+`fill="none"` (or `filled` for an "on" state). Do not hand-write an `<svg>` for a line icon — put the
+path in the module that owns it (`lib/stat-icons.ts`, `components/ui/icons.tsx`, `group-list.tsx`,
+`session-row-menu.tsx`) and render it through `GlyphIcon`.
+
+Two marks deliberately live off that grid, because a two-stroke mark aliases when its grid and its
+render size disagree: `ChevronDown` (12×12, stroke 1.5) and `CloseIcon` (14×14, stroke 1.5). Charts,
+sparklines, the topology view, the ring gauges and the login background draw their own geometry and
+are outside the family entirely.
+
+Sizes come from `src/lib/icon-scale.ts`, named by role, not by number — `inlineGlyph` 13,
+`rowLead` 14, `iconButton` / `groupHeaderGlyph` 15, `navRow` / `groupHeaderAction` 16,
+`groupHeaderAvatar` / `sectionMark` 18, `chevron` 14 / `chevronDense` 12, `caret` 12 /
+`caretDense` 10. Pick the rung whose role matches; if none does, the honest move is to add a rung
+with a sentence saying what it is for, not to type a bare number. An avatar sits one rung above a
+line glyph in the same slot, because a tile fills its box and a glyph only draws inside it.
+
+Gaps come from `ICON_GAP` in the same module and track text size: `tight` (`gap-1`) for a glyph
+welded to a number, `row` (`gap-1.5`) for a list row, `menu` (`gap-2`) for menu/nav rows and
+banners, `card` (`gap-3`) for a card row led by an avatar.
+
+`test/icon-scale.test.ts` fails on a stroke weight outside the chosen set and on a second copy of
+the caret, the close cross or the collapse chevron.
+
+## Every user-facing string is bilingual
+
+Two dictionaries: `src/lib/strings.ts` is zh (and defines the `Strings` type), `src/lib/strings-en.ts`
+is en and is typed `const en: Strings`. Adding a key to one and not the other is a **type error**,
+not a runtime surprise — and `test/placeholders-parity.test.ts` checks that both sides interpolate
+the same placeholders. Add both, in the same shape, in the same PR.
+
+`S` is a live binding swapped on locale change, so read it at render time; never hoist `S.x.y` into
+a module-level constant.
+
+Chinese belongs only in the zh dictionary, `titleZh` fields, `*.zh.md` documents, and fixtures that
+exercise CJK behaviour. Comments, test names and every other string are English.
+
+## Popups: portal, do not absolutely position
+
+Anything that overlays — a menu, a picker, an info popover — uses `usePortalPanel`
+(`components/ui/use-portal-panel.ts`) and `createPortal` to `document.body`, positioned `fixed`
+against viewport coordinates. An in-place absolute panel is a DOM descendant of its trigger, so any
+ancestor with `overflow-x-auto` clips it vertically (the CSS spec forces the visible axis to `auto`
+when the other is not visible), and auditing every call site's ancestor chain is not a plan.
+
+Three behaviours there are load-bearing:
+
+- **Esc uses capture and stops propagation.** `Modal` listens during the window bubble phase and
+ registers earlier, so without stopping propagation one Esc would close the panel *and* the dialog.
+- **Scroll uses capture**, because scroll does not bubble; the panel closes the moment its position
+ would go stale rather than floating out of place. Its own internal scroll is exempted.
+- **`z-[60]`**, above the modal overlay's `z-50`: a portaled node sits in the root stacking context
+ and may be opened from inside a dialog.
+
+Modals and `Dropdown` additionally register in the Esc-layer stack (`modal.tsx`'s `pushEscLayer`),
+so Escape only acts on the topmost layer. A portal panel does not need to — capture plus
+`stopPropagation` already gets there first.
+
+## The rest of the house style
+
+- **Stacking contexts**: chrome creates none; dropdown/user menus `z-40`; modal and drawer overlays
+ `z-50`; portaled panels `z-[60]`. `styles.css`'s header states this.
+- **Every scroll container is a containing block** (`styles.css`, `@layer base`). Do not undo it: an
+ absolutely positioned descendant of a `static` scroller escapes to the initial containing block
+ and gives the whole shell a second scrollbar. That bug shipped three times.
+- **Animations are `transform`-only where possible**, so the global `prefers-reduced-motion` rule
+ disables them into a correct resting state instead of hiding the element.
+- **Comments explain constraints, not history**, and never cite a design doc — inline the constraint.
+
+## Verify
+
+```sh
+pnpm --filter @prismshadow/penguin-web typecheck
+pnpm --filter @prismshadow/penguin-web test
+pnpm format && pnpm format:check
+```
+
+Playwright (`packages/web/e2e/`) only when selectors or flows move. On a shared machine, probe with
+`ss -tln` before picking ports, and never point `PENGUIN_HOME` at `~/.penguin`.
diff --git a/changelog/unreleased/2026-08-20-web-design-system.md b/changelog/unreleased/2026-08-20-web-design-system.md
new file mode 100644
index 00000000..603f827e
--- /dev/null
+++ b/changelog/unreleased/2026-08-20-web-design-system.md
@@ -0,0 +1,94 @@
+# Web App: one status-colour vocabulary, on-demand explanations, one icon family
+
+- **Date:** 2026-08-20
+- **Type:** refactor
+- **Scope:** `web`, `tooling`
+- **PR:** [#378](https://github.com/Prism-Shadow/penguin-harness/pull/378)
+
+[中文版](2026-08-20-web-design-system.zh.md)
+
+Three conventions the Web App had been carrying implicitly are now written down and enforced: a
+status colour is picked by meaning from one module, an explanation is disclosed on demand unless a
+user needs it while typing, and a line icon comes from one renderer at one weight in a role-named
+size.
+
+## Status tones
+
+- `src/lib/tone.ts` holds five tones — `busy`, `attention`, `success`, `danger`, `muted` — in four
+ maps by the shape of the mark: ink for a glyph or a line of status text, surface for a tinted
+ badge, dot for the 6px state dots, strip for a bordered notice. Each light/dark class pair is
+ written once.
+- Migrated onto them: the run-state icon, the session activity glyph, the badge palette, the
+ stream's step and goal banners, the reasoning-group header, the subagent and panel pending dots,
+ the context-usage rings, the MCP connect status, the model speed badges, the update dialog, the
+ initial-password banner, the placeholder-missing alerts, and the usage errors panel. Amber had
+ been spelled three ways (`amber-600`/`amber-500`/`yellow-*`) for one meaning and emerald two;
+ the run-state spinner and the failure glyph also moved up a step to clear 3:1 against white.
+- The **session list's running hourglass is now the shared amber** rather than gray. Compaction
+ keeps that same tone and takes a **new mark** — a bar with a chevron closing on it from each
+ side, squeezing on a loop — so the two live states are separated by shape and motion instead of
+ by colour alone.
+- The contrast ratios recorded in the module are measured against the surfaces the marks actually
+ sit on, including the neutral scale this app overrides in `styles.css` for dark mode: gray-950 is
+ `#000000` and gray-900 is `#0d0d0d`, not Tailwind's stock values the previous numbers assumed.
+- The terminal's chrome gained its own `success` / `attention` / `danger`, resolved in JS like the
+ rest of its palette; its status dot had been painting the dark half of each pair on a light
+ terminal.
+- Categorical palettes stay out: chart series, token buckets, timeline phases and per-skill avatar
+ tints are identities, not judgements, and must stay free to add a hue without it reading as a
+ new severity.
+
+## Explanations disclosed on request
+
+Two forms, and a title decides which a surface gets: the circled "?" only ever appears beside a
+title, and where there is no title the explanation names itself in a fold instead.
+
+- New `components/ui/info-popover.tsx`: a circled "?" whose panel is portaled and positioned by the
+ shared `usePortalPanel`, so it is not clipped by an ancestor's overflow and closes on outside
+ click, Esc, scroll or resize. The trigger is a real button with an accessible name and points at
+ the panel it opens; while open the panel is also the trigger's description.
+- New `components/ui/help-fold.tsx`: a compact self-naming row that expands its explanation inline
+ underneath, rotating the app's one collapse chevron. Inline flow, so no portal — it follows the
+ WAI-ARIA disclosure pattern, keeping the panel in the DOM and `hidden` while collapsed so its
+ `aria-controls` always resolves.
+- Section descriptions with a title of their own took the "?": the skill library page, the models
+ page's read-only notice, the MCP servers section, the Agent State transfer section, the tools
+ table's `call_description` column, the four placeholder prompt sections, and the Project dialog's
+ new-chat defaults block.
+- The four Agent settings tabs — Vault, Memory, Schedules, Skills — took the fold. Their name lives
+ in the tab bar and the panel does not repeat it, so there is nothing for a "?" to anchor to.
+- Field hints that explain *semantics* moved to a "?" beside their label — the per-request timeout,
+ the two compaction thresholds, the model-group protocol note, the new-chat default model's
+ provenance, and where the built-in admin's initial password is printed.
+- Hints that describe the *shape* of the value stay on screen: "one `KEY=value` per line", "one
+ argument per line", "leave empty for unlimited", allowed-character rules, the `k`/`m` budget
+ suffix. They are read while typing.
+- `Field`, `Input`, `Textarea` and `PasswordInput` take an `info` prop for this. With it, the field
+ associates its title by `htmlFor` instead of wrapping the control in a `<label>`: a button is a
+ labelable element, so a nested trigger would take the title away from the input.
+- `test/disclosure-anchor.test.ts` enforces the anchoring rule by parsing the JSX with the
+ TypeScript parser: it fails, naming file and line, on any `InfoPopover` with no title among its
+ preceding siblings — a comment or a neighbouring `<Button>` does not count as one.
+
+## One icon family
+
+- `GlyphIcon` is the single line-icon renderer (24×24, stroke 1.7, `currentColor`) and gained a
+ `filled` variant. `group-list.tsx`'s `Icon` — a byte-identical second copy — now wraps it, and 25
+ inline `<svg>` elements were replaced by shared components or paths.
+- Duplicated glyphs collapsed to one home each: the form-control caret, the close cross, the
+ collapse chevron, the folder outline, the external-link mark, the chat page's private copy of
+ three stat paths, and `panels-toolbar`'s re-declared renderer.
+- Stroke weights 1.6 and 1.8 are gone; the family is 1.7, with 1.5 reserved for the two marks drawn
+ on their own smaller grids and 2 / 2.2 for the checkmark, the ring gauges and the collapse
+ chevron.
+- `src/lib/icon-scale.ts` names every size by role rather than by number and does the same for the
+ icon-to-text gap. Applied where equivalent elements disagreed: the collapsible headers' status
+ icon, the group-header action buttons and leading glyphs, the agent-card stat row, the skill card's
+ button group, the composer's trigger pills and menu rows, and the traces page's export button.
+- New tests cover all three: tone coverage and the no-inline-palette rule, the popover's ARIA and
+ the field layout it forces, and the icon family's stroke set and one-copy-per-glyph rule.
+
+## A frontend development skill
+
+`.agents/skills/penguin-harness-frontend/SKILL.md` records these rules plus the two-dictionary i18n
+contract and the portal-panel pattern with its Esc-capture and scroll-capture caveats.
diff --git a/changelog/unreleased/2026-08-20-web-design-system.zh.md b/changelog/unreleased/2026-08-20-web-design-system.zh.md
new file mode 100644
index 00000000..bd241326
--- /dev/null
+++ b/changelog/unreleased/2026-08-20-web-design-system.zh.md
@@ -0,0 +1,44 @@
+# Web App:一套状态色、按需披露的说明、一族图标
+
+- **Date:** 2026-08-20
+- **Type:** refactor
+- **Scope:** `web`, `tooling`
+- **PR:** [#378](https://github.com/Prism-Shadow/penguin-harness/pull/378)
+
+[English](2026-08-20-web-design-system.md)
+
+Web App 此前隐含遵循的三条约定改为写下来并加以约束:状态色按含义从同一个模块取用;说明文字除非用户边输入边要看,否则改为按需披露;线性图标出自同一个渲染器、同一种描边、同一套按角色命名的尺寸。
+
+## 状态色调
+
+- `src/lib/tone.ts` 收录五种色调——`busy`、`attention`、`success`、`danger`、`muted`——按标记的形态分为四张表:字形与状态文字用的墨色、徽标用的底色(含自带文字色)、6px 状态点用的填充、整行提示条用的描边加底色。每一对浅深色类名只写一次。
+- 已迁移到位:运行状态图标、会话活动字形、徽标色板、消息流的步骤条幅与 goal 条幅、推理组组头、子智能体与面板的待办圆点、上下文占用圆环、MCP 连接状态、模型速度徽标、更新弹窗、初始密码横幅、占位符缺失提示条,以及用量页的错误面板。同一个含义此前琥珀有三种写法(`amber-600`/`amber-500`/`yellow-*`)、绿色有两种;运行状态的旋转指示与失败字形也各提高一档,以在白底上达到 3:1。
+- **会话列表的「运行中」沙漏由灰改为全站统一的琥珀**。「压缩中」沿用同一色调,并换用**新的标记**——一条中线,上下各一枚合拢的折角,循环挤压——于是两个进行中的状态改由形状与动效区分,而不再只靠颜色。
+- 模块内记录的对比度按标记实际所处的表面重新测得,其中包含本应用在 `styles.css` 里覆盖过的中性色阶:深色下 gray-950 为 `#000000`、gray-900 为 `#0d0d0d`,而此前的数字是按 Tailwind 原色算的。
+- 终端的外框配色补上自己的 `success` / `attention` / `danger`,与其余色值一样在 JS 内解析;此前它的状态点在浅色终端上取的也是每一对里的深色那一半。
+- 分类色板不并入:图表系列、Token 分桶、时间线阶段与各技能头像底色表达的是身份而非判断,必须保持「新增一种颜色不会被读成新增一档严重程度」。
+
+## 说明改为按需披露
+
+两种形态,由「有没有标题」决定用哪一种:圆圈「?」只出现在标题旁边,没有标题可依附的地方,说明改为自己报出名字的折叠行。
+
+- 新增 `components/ui/info-popover.tsx`:一枚圆圈「?」,其弹层经共用的 `usePortalPanel` 以 portal 挂载并定位,因而不被祖先的 `overflow` 裁剪,并在点击外部、Esc、滚动或改变窗口尺寸时收起。触发器是真正的 `<button>`,带可访问名并指向它所打开的弹层;展开期间该弹层同时作为触发器的描述。
+- 新增 `components/ui/help-fold.tsx`:一行紧凑的、自带名字的触发行,展开后说明就地铺在其下方,旋转的是全站同一枚折叠指示。它属于常规文档流,因而不用 portal——采用 WAI-ARIA 的 disclosure 模式,收起时面板留在 DOM 内并置 `hidden`,因此 `aria-controls` 始终指向真实节点。
+- 自带标题的区块说明取「?」:技能库页、模型库页的只读提示、MCP Server 区块、Agent State 传输区块、工具表的 `call_description` 列、四处占位符 Prompt 区块,以及 Project 弹窗的新对话默认值区块。
+- 密钥保险柜、记忆、定时任务、技能四个 Agent 设置标签页取折叠行:它们的名字在标签栏里、面板内并不重复,「?」在那里没有可依附的标题。
+- 解释**语义**的字段提示移到标签旁的「?」:单次请求超时、两项压缩阈值、模型分组的协议说明、新对话默认模型的来源,以及内置管理员初始密码打印在何处。
+- 描述取值**形状**的提示保持常驻:「每行一条 `KEY=value`」「每行一个参数」「留空即不限」、允许字符规则、预算的 `k`/`m` 后缀。它们是边输入边看的。
+- `Field`、`Input`、`Textarea` 与 `PasswordInput` 为此新增 `info` 参数。带上它时,字段改用 `htmlFor` 关联标题,而不再用 `<label>` 包裹控件:按钮属于可标注元素,嵌进去会把标题从输入框那里抢走。
+- `test/disclosure-anchor.test.ts` 以 TypeScript 解析器解析真实 JSX 来强制这条依附规则:任何前面没有标题兄弟节点的 `InfoPopover` 都会让它失败并报出文件与行号——注释与相邻的 `<Button>` 都不算标题。
+
+## 一族图标
+
+- `GlyphIcon` 成为唯一的线性图标渲染器(24×24、描边 1.7、`currentColor`),并新增 `filled` 变体。`group-list.tsx` 的 `Icon` 此前是它逐字节相同的第二份实现,现改为包装它;另有 25 处内联 `<svg>` 换成了共用组件或共用路径。
+- 重复字形各自收归一处:表单控件的下拉小箭头、关闭叉、折叠指示、文件夹轮廓、外链标记、对话页私有的三条统计路径,以及 `panels-toolbar` 里重新声明的渲染器。
+- 描边 1.6 与 1.8 已清除;该族统一为 1.7,1.5 留给另立画布的两枚双笔画标记,2 与 2.2 留给对勾、圆环仪表与折叠指示。
+- `src/lib/icon-scale.ts` 把每个尺寸按角色而非数字命名,图标与文字的间距同理。已应用到此前互相不一致的同角色元素:折叠卡片组头的状态图标、分组头的动作按钮与行首字形、智能体卡片的统计行、技能卡片的按钮组、输入区的触发胶囊与菜单行,以及轨迹页的导出按钮。
+- 三部分各配新测试:色调覆盖度与「状态文件不得内联色板类名」、弹层的 ARIA 与它所迫使的字段布局、图标族的描边集合与「每个字形只有一份」。
+
+## 前端开发 Skill
+
+`.agents/skills/penguin-harness-frontend/SKILL.md` 记录上述规则,另附双词典 i18n 约定,以及 portal 弹层模式与其 Esc 捕获、滚动捕获两处要点。
diff --git a/packages/web/src/components/account/change-password-dialog.tsx b/packages/web/src/components/account/change-password-dialog.tsx
index 8a5c257f..f384b1db 100644
--- a/packages/web/src/components/account/change-password-dialog.tsx
+++ b/packages/web/src/components/account/change-password-dialog.tsx
@@ -93,7 +93,8 @@ export function ChangePasswordDialog({ open, onClose }: { open: boolean; onClose
}}
error={errors.old}
autoComplete="current-password"
- hint={S.account.oldPasswordHint}
+ info={S.account.oldPasswordHint}
+ infoLabel={S.account.oldPassword}
autoFocus
/>
)}
diff --git a/packages/web/src/components/account/update-dialog.tsx b/packages/web/src/components/account/update-dialog.tsx
index 2d30c14a..21873379 100644
--- a/packages/web/src/components/account/update-dialog.tsx
+++ b/packages/web/src/components/account/update-dialog.tsx
@@ -18,6 +18,7 @@ import { apiErrorText } from "../../lib/api-error";
import { stripAnsi } from "../../lib/strip-ansi";
import { Button } from "../ui/button";
import { Modal } from "../ui/modal";
+import { toneInk } from "../../lib/tone";
type Phase = "confirm" | "running" | "done";
@@ -76,10 +77,10 @@ export function UpdateDialog({
result === null
? null
: result.status === "updated"
- ? { text: S.update.updated, className: "text-green-600 dark:text-green-400" }
+ ? { text: S.update.updated, className: toneInk.success }
: result.status === "unsupported"
- ? { text: S.update.unsupported, className: "text-amber-600 dark:text-amber-400" }
- : { text: S.update.failed, className: "text-red-600 dark:text-red-400" };
+ ? { text: S.update.unsupported, className: toneInk.attention }
+ : { text: S.update.failed, className: toneInk.danger };
return (
<Modal
diff --git a/packages/web/src/components/layout/app-layout.tsx b/packages/web/src/components/layout/app-layout.tsx
index bed4ce0e..ab7b674a 100644
--- a/packages/web/src/components/layout/app-layout.tsx
+++ b/packages/web/src/components/layout/app-layout.tsx
@@ -17,7 +17,7 @@ import { useSessions } from "../../state/sessions";
import { useCompletionNotifications } from "../../state/use-completion-notifications";
import { Drawer } from "../ui/drawer";
import { GlyphIcon } from "../ui/glyph-icon";
-import { NAV_ICONS } from "../ui/icons";
+import { CloseIcon, NAV_ICONS } from "../ui/icons";
import { NEW_CHAT_ICON, Sidebar } from "./sidebar";
import { DRAFT_SESSION_ID } from "../../features/chat/chat-page";
import { parkActiveDraft } from "../../features/chat/draft-sessions";
@@ -38,6 +38,7 @@ import {
visiblePanes,
subscribeTerminalDock,
} from "../../features/terminal/terminal-dock-state";
+import { toneStrip } from "../../lib/tone";
/** "Last conversation" glyph (chat lines + resume arrow), used only by the rail. */
const LAST_CHAT_ICON = "M8 10h8M8 14h5M21 12a9 9 0 1 1-4.2-7.6L21 4v5h-5";
@@ -336,7 +337,9 @@ export function AppLayout() {
Permanently dismissible via the X on the right (per-user ui_prefs); only rendered once
hydrated prefs confirm it was never dismissed, so it does not flash-then-vanish on load. */}
{passwordBannerRelevant && passwordBannerDismissed === false && (
- <div className="relative flex shrink-0 items-center justify-center gap-3 border-b border-amber-200 bg-amber-50 px-8 py-1.5 text-xs text-amber-800 dark:border-amber-900/60 dark:bg-amber-950/40 dark:text-amber-300">
+ <div
+ className={`relative flex shrink-0 items-center justify-center gap-3 border-b px-8 py-1.5 text-xs ${toneStrip.attention}`}
+ >
<span>{S.account.initialPasswordBanner}</span>
<button
type="button"
@@ -358,16 +361,7 @@ export function AppLayout() {
onClick={dismissPasswordBanner}
className="absolute inset-y-0.5 right-1.5 flex items-center rounded-md px-1 text-amber-500 transition-colors duration-150 hover:text-amber-950 dark:text-amber-400/70 dark:hover:text-amber-100"
>
- <svg
- width="12"
- height="12"
- viewBox="0 0 14 14"
- fill="none"
- stroke="currentColor"
- aria-hidden
- >
- <path d="M2 2l10 10M12 2L2 12" strokeWidth="1.5" strokeLinecap="round" />
- </svg>
+ <CloseIcon size={12} />
</button>
</div>
)}
diff --git a/packages/web/src/components/layout/project-dialogs.tsx b/packages/web/src/components/layout/project-dialogs.tsx
index 13855b99..1cf7dee4 100644
--- a/packages/web/src/components/layout/project-dialogs.tsx
+++ b/packages/web/src/components/layout/project-dialogs.tsx
@@ -37,6 +37,7 @@ import { toastError, toastSuccess } from "../ui/toast";
import { Modal } from "../ui/modal";
import { ConfirmModal } from "../ui/confirm-modal";
import { Badge } from "../ui/badge";
+import { InfoPopover } from "../ui/info-popover";
/** Approval modes offered by the new-chat-defaults select, in the composer menu's order. */
const APPROVAL_MODES: readonly ApprovalMode[] = [
@@ -562,8 +563,10 @@ function ChatDefaultsSection({ projectId, isOwner }: { projectId: string; isOwne
return (
<div className="border-t border-gray-100 pt-3 dark:border-gray-800">
- <p className="text-xs font-medium text-gray-500">{S.project.chatDefaultsTitle}</p>
- <p className="mb-2 mt-0.5 text-xs text-gray-400">{S.project.chatDefaultsHint}</p>
+ <p className="mb-2 flex items-center gap-1.5 text-xs font-medium text-gray-500">
+ {S.project.chatDefaultsTitle}
+ <InfoPopover label={S.project.chatDefaultsTitle}>{S.project.chatDefaultsHint}</InfoPopover>
+ </p>
{loadError ? (
<p className="text-xs text-red-600 dark:text-red-400">{loadError}</p>
) : saved === null || models === null ? (
@@ -619,7 +622,10 @@ function ChatDefaultsSection({ projectId, isOwner }: { projectId: string; isOwne
))}
</Select>
<div>
- <FieldLabel>{S.chat.model}</FieldLabel>
+ <span className="mb-1 flex items-center gap-1">
+ <FieldLabel block={false}>{S.chat.model}</FieldLabel>
+ <InfoPopover label={S.chat.model}>{S.project.chatDefaultsModelHint}</InfoPopover>
+ </span>
{models.models.length > 0 ? (
<>
{/* The composer's model dropdown (provider logo + name + searchable grouped
@@ -632,7 +638,6 @@ function ChatDefaultsSection({ projectId, isOwner }: { projectId: string; isOwne
disabled={busy}
variant="form"
/>
- <FieldHint>{S.project.chatDefaultsModelHint}</FieldHint>
</>
) : (
<p className="text-xs text-gray-400">{S.models.empty}</p>
diff --git a/packages/web/src/components/layout/sidebar.tsx b/packages/web/src/components/layout/sidebar.tsx
index 1b80698d..6bf479f9 100644
--- a/packages/web/src/components/layout/sidebar.tsx
+++ b/packages/web/src/components/layout/sidebar.tsx
@@ -148,6 +148,7 @@ import { ProxySettingsDialog } from "../account/proxy-settings-dialog";
import { UploadLimitsDialog } from "../account/upload-limits-dialog";
import { UpdateDialog } from "../account/update-dialog";
import { forceUpdateCheck, updateCheckOutcome, useVersionInfo } from "../../lib/use-version-info";
+import { ICON_SIZE } from "../../lib/icon-scale";
/** New-chat pencil (the pinned "New chat" button and the collapsed rail share it). */
export const NEW_CHAT_ICON = "M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z";
@@ -1523,7 +1524,7 @@ export function Sidebar({
onToggle={() => toggleGroup(DRAFTS_GROUP_KEY)}
icon={
<span className="shrink-0 text-gray-400 dark:text-gray-500">
- <Icon d={NEW_CHAT_ICON} size={14} />
+ <Icon d={NEW_CHAT_ICON} size={ICON_SIZE.groupHeaderGlyph} />
</span>
}
label={S.chat.draftGroup}
@@ -1586,7 +1587,7 @@ export function Sidebar({
onClick={() => newChat(agent.agentId)}
className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200"
>
- <Icon d="M12 5v14M5 12h14" size={18} />
+ <Icon d="M12 5v14M5 12h14" size={ICON_SIZE.groupHeaderAction} />
</button>
<button
type="button"
@@ -1594,7 +1595,7 @@ export function Sidebar({
onClick={() => go(`/agents/${agent.agentId}`)}
className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200"
>
- <Icon d={GEAR_ICON} size={16} />
+ <Icon d={GEAR_ICON} size={ICON_SIZE.groupHeaderAction} />
</button>
</>
}
@@ -1651,7 +1652,10 @@ export function Sidebar({
icon={
/* Folder opens and closes with the group */
<span className="shrink-0 text-gray-400 dark:text-gray-500">
- <Icon d={collapsed ? FOLDER_ICON : FOLDER_OPEN_ICON} size={15} />
+ <Icon
+ d={collapsed ? FOLDER_ICON : FOLDER_OPEN_ICON}
+ size={ICON_SIZE.groupHeaderGlyph}
+ />
</span>
}
label={group.temp ? S.chat.tempWorkspaces : group.label}
@@ -1672,7 +1676,7 @@ export function Sidebar({
onClick={() => newChat(workspaceNewChatAgentId, group.fullPath ?? "")}
className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200"
>
- <Icon d="M12 5v14M5 12h14" size={18} />
+ <Icon d="M12 5v14M5 12h14" size={ICON_SIZE.groupHeaderAction} />
</button>
{/* Manually-added (registry-backed) Workspaces only: rename-alias /
remove-from-sidebar overflow, to the right of the "+" (session-
@@ -2163,7 +2167,7 @@ function GroupPinButton({ pinned, onToggle }: { pinned: boolean; onToggle: () =>
: "text-gray-400 opacity-0 focus-visible:opacity-100 group-hover/header:opacity-100 dark:text-gray-500"
}`}
>
- <Icon d={PIN_ICON} size={15} />
+ <Icon d={PIN_ICON} size={ICON_SIZE.groupHeaderAction} />
</button>
);
}
diff --git a/packages/web/src/components/ui/badge.tsx b/packages/web/src/components/ui/badge.tsx
index 1fa73c9a..562a8d58 100644
--- a/packages/web/src/components/ui/badge.tsx
+++ b/packages/web/src/components/ui/badge.tsx
@@ -2,19 +2,28 @@
* Badge component: a small pill-shaped label for status/type (stop_reason, running status, Trace event type, etc.).
*/
import type { ReactNode } from "react";
+import { toneSurface } from "../../lib/tone";
+/**
+ * Badge tones are named for their colour rather than for a meaning: a badge labels an attribute
+ * ("vision", "fast mode") at least as often as it reports a status, so a semantic name would be
+ * wrong at half the call sites. The class strings themselves still come from the shared status
+ * tones, so a badge that *does* report a status matches every other mark for that state.
+ */
export type BadgeTone = "gray" | "brand" | "green" | "yellow" | "amber" | "red";
const toneClass: Record<BadgeTone, string> = {
- gray: "bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-300",
+ gray: toneSurface.muted,
+ // Neutral emphasis, outside the status vocabulary: a heavier gray for a tag that should read
+ // as prominent without claiming any severity ("default", "origin", "queued").
brand: "bg-gray-200/80 text-gray-700 dark:bg-gray-700/60 dark:text-gray-200",
- green: "bg-emerald-50 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300",
- // Light-yellow: a neutral informational tag (the "Free" model badge). Kept on the yellow
- // palette so it stays visually distinct from the amber tone below, which existing badges
- // use with warning semantics (aborted stop_reason, the proxy-vision badge on the same card).
+ green: toneSurface.success,
+ // Light-yellow, also outside the status vocabulary: a neutral informational tag (the "Free"
+ // model badge). It stays on the yellow palette so it reads as distinct from amber, which
+ // carries warning semantics (aborted stop_reason, the proxy-vision badge on the same card).
yellow: "bg-yellow-50 text-yellow-700 dark:bg-yellow-950 dark:text-yellow-300",
- amber: "bg-amber-50 text-amber-700 dark:bg-amber-950 dark:text-amber-300",
- red: "bg-red-50 text-red-700 dark:bg-red-950 dark:text-red-300",
+ amber: toneSurface.attention,
+ red: toneSurface.danger,
};
export function Badge({ tone = "gray", children }: { tone?: BadgeTone; children: ReactNode }) {
diff --git a/packages/web/src/components/ui/field.tsx b/packages/web/src/components/ui/field.tsx
index d7d9ab08..69fce2af 100644
--- a/packages/web/src/components/ui/field.tsx
+++ b/packages/web/src/components/ui/field.tsx
@@ -6,6 +6,7 @@
* near-identical copies that used to live in each control and call site.
*/
import type { ReactNode } from "react";
+import { InfoPopover } from "./info-popover";
/**
* The control "look" shared by Input, Select and OptionMenu: rounded box, gray
@@ -23,16 +24,40 @@ export const controlBase =
/** Base padding/alignment/transition for a menu row (Select, OptionMenu, and the chat composer menus); callers add flex/block and the hover/selected colors. */
export const menuRowClass = "w-full px-3 py-1.5 text-left transition-colors duration-150";
-export function FieldLabel({ children, required }: { children: ReactNode; required?: boolean }) {
- return (
- <span className="mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400">
+/**
+ * The field's title. Renders as a real `<label htmlFor>` when the caller supplies the control's
+ * id, and as a plain span otherwise — the span form is for the `<label>`-wrapped layout below,
+ * where a second label element would compete for the same control.
+ */
+export function FieldLabel({
+ children,
+ required,
+ htmlFor,
+ block = true,
+}: {
+ children: ReactNode;
+ required?: boolean;
+ htmlFor?: string;
+ /** Own the line (the default). Off when the label shares a flex row with an info trigger. */
+ block?: boolean;
+}) {
+ const className = `text-xs font-semibold text-gray-600 dark:text-gray-400${block ? " mb-1 block" : ""}`;
+ const content = (
+ <>
{children}
{required && (
<span className="ml-0.5 text-red-500 dark:text-red-400" aria-hidden>
*
</span>
)}
- </span>
+ </>
+ );
+ return htmlFor !== undefined ? (
+ <label htmlFor={htmlFor} className={className}>
+ {content}
+ </label>
+ ) : (
+ <span className={className}>{content}</span>
);
}
@@ -59,6 +84,14 @@ export function FieldError({ id, children }: { id?: string; children: ReactNode
* below it a red error if present, otherwise a gray hint. Renders the bare
* control (no wrapper) when there's no label/hint/error, so a caller can drop it
* into a toolbar or table cell unchanged.
+ *
+ * Two layouts, and which one applies is decided by `info`. Without it the whole field is
+ * wrapped in a `<label>`, which associates the title with the control implicitly. With it the
+ * title has to move out of that wrapper: an info trigger is a `<button>`, a `<button>` is a
+ * labelable element, and the first labelable descendant is the one a wrapping `<label>` names —
+ * so nesting the trigger would silently retarget the title from the input to the "?" button.
+ * The info layout therefore drops the wrapper and associates the title by `htmlFor`, which is
+ * why it needs `controlId`.
*/
export function Field({
label,
@@ -66,6 +99,9 @@ export function Field({
error,
errorId,
required,
+ info,
+ infoLabel,
+ controlId,
children,
}: {
label?: ReactNode;
@@ -75,18 +111,44 @@ export function Field({
errorId?: string;
/** Renders a red "*" after the label to mark the field as required. */
required?: boolean;
+ /** Semantic explanation, disclosed by a "?" beside the label. Formatting rules belong in `hint`, which stays visible. */
+ info?: ReactNode;
+ /** Accessible name for that "?" — pass the field's own name when several sit close together. */
+ infoLabel?: string;
+ /** id of the control `info`'s label points at; required for `info` to render. */
+ controlId?: string;
children: ReactNode;
}) {
- if (!label && !hint && !error) return <>{children}</>;
+ if (!label && !hint && !error && !info) return <>{children}</>;
+ const below = error ? (
+ <FieldError id={errorId}>{error}</FieldError>
+ ) : hint ? (
+ <FieldHint>{hint}</FieldHint>
+ ) : null;
+ const hasLabel = label != null && label !== "";
+ if (info != null && controlId !== undefined) {
+ return (
+ <div className="block">
+ <span className="mb-1 flex items-center gap-1">
+ {hasLabel && (
+ <FieldLabel required={required} htmlFor={controlId} block={false}>
+ {label}
+ </FieldLabel>
+ )}
+ <InfoPopover {...(infoLabel !== undefined ? { label: infoLabel } : {})}>
+ {info}
+ </InfoPopover>
+ </span>
+ {children}
+ {below}
+ </div>
+ );
+ }
return (
<label className="block">
- {label != null && label !== "" && <FieldLabel required={required}>{label}</FieldLabel>}
+ {hasLabel && <FieldLabel required={required}>{label}</FieldLabel>}
{children}
- {error ? (
- <FieldError id={errorId}>{error}</FieldError>
- ) : hint ? (
- <FieldHint>{hint}</FieldHint>
- ) : null}
+ {below}
</label>
);
}
diff --git a/packages/web/src/components/ui/glyph-icon.tsx b/packages/web/src/components/ui/glyph-icon.tsx
index e71ae378..1d50cb02 100644
--- a/packages/web/src/components/ui/glyph-icon.tsx
+++ b/packages/web/src/components/ui/glyph-icon.tsx
@@ -1,23 +1,30 @@
/**
- * Unified rendering for stat icons (shared by the chat page's stat row and the Trace page's turn
- * cards): a 24x24 line path with stroke set to currentColor, so the color follows the caller's
- * text color. See lib/stat-icons.ts for the paths.
+ * The app's one line-icon renderer: a 24x24 path stroked at 1.7 in currentColor, so the mark
+ * follows the caller's text colour and every glyph in the app carries the same weight. Icon
+ * paths live in the modules that own them — `lib/stat-icons.ts`, `components/ui/icons.tsx`,
+ * `components/ui/group-list.tsx`, `components/ui/session-row-menu.tsx` — and the size comes from
+ * the role-named scale in `lib/icon-scale.ts`.
*/
+import { ICON_SIZE } from "../../lib/icon-scale";
+
export function GlyphIcon({
d,
- size = 13,
+ size = ICON_SIZE.inlineGlyph,
className = "",
+ filled = false,
}: {
d: string;
size?: number;
className?: string;
+ /** Fill the path in currentColor — for a mark whose "on" state is a solid shape (a pinned tack). */
+ filled?: boolean;
}) {
return (
<svg
width={size}
height={size}
viewBox="0 0 24 24"
- fill="none"
+ fill={filled ? "currentColor" : "none"}
stroke="currentColor"
strokeWidth="1.7"
strokeLinecap="round"
diff --git a/packages/web/src/components/ui/group-list.tsx b/packages/web/src/components/ui/group-list.tsx
index e2b665be..183670d3 100644
--- a/packages/web/src/components/ui/group-list.tsx
+++ b/packages/web/src/components/ui/group-list.tsx
@@ -10,24 +10,12 @@ import type { ReactNode } from "react";
import { S } from "../../lib/strings";
import type { SessionSortMode } from "../../lib/session-order";
import { Chevron } from "./chevron";
+import { GlyphIcon } from "./glyph-icon";
+import { ICON_SIZE } from "../../lib/icon-scale";
-/** Minimal stroke-icon wrapper shared by the grouped lists (moved from sidebar.tsx). */
-export function Icon({ d, size = 16 }: { d: string; size?: number }) {
- return (
- <svg
- width={size}
- height={size}
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="1.7"
- strokeLinecap="round"
- strokeLinejoin="round"
- aria-hidden
- >
- <path d={d} />
- </svg>
- );
+/** The grouped lists' line icon: GlyphIcon at the nav-row rung, which is what these rows are. */
+export function Icon({ d, size = ICON_SIZE.navRow }: { d: string; size?: number }) {
+ return <GlyphIcon d={d} size={size} />;
}
/** Folder outline, closed (same glyph as the draft page's Workspace pill); collapsed workspace groups and the grouping toggle use it. */
diff --git a/packages/web/src/components/ui/help-fold.tsx b/packages/web/src/components/ui/help-fold.tsx
new file mode 100644
index 00000000..78216901
--- /dev/null
+++ b/packages/web/src/components/ui/help-fold.tsx
@@ -0,0 +1,69 @@
+/**
+ * Inline help fold: a compact, self-naming row that expands its explanation underneath it.
+ *
+ * The sibling of InfoPopover, and one rule decides which a site gets. The circled "?" is an
+ * **anchored** mark: it reads as help only because it sits immediately after a title, and it
+ * borrows that title's meaning. Where a surface has no title to anchor to — an Agent settings
+ * tab, whose name lives in the tab bar and is not repeated in the panel — a "?" floating alone
+ * at the top of the panel is a mark modifying nothing. The disclosure then has to name itself,
+ * and this is that form.
+ *
+ * Inline flow, not an overlay, so **no portal**. usePortalPanel earns its keep by keeping a
+ * floating panel clear of an ancestor's overflow and closing it on outside click, Esc or scroll;
+ * a fold pushes the content below it down and stays open until the reader folds it back, so none
+ * of that applies. It is the WAI-ARIA disclosure pattern: the panel stays in the DOM and is
+ * `hidden` while collapsed, which keeps `aria-controls` pointing at something real (the popover
+ * cannot do that — a portaled panel only exists while open).
+ *
+ * The chevron is the app's one collapse indicator, the same glyph every other collapsible
+ * rotates; a help fold that announced itself differently would be a second pattern for no reason.
+ */
+import { useId, useState } from "react";
+import type { ReactNode } from "react";
+import { S } from "../../lib/strings";
+import { Chevron } from "./chevron";
+import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
+
+export function HelpFold({
+ children,
+ label,
+ className = "",
+}: {
+ /** The explanation. Revealed only on request — a description that shows up uninvited is what this replaces. */
+ children: ReactNode;
+ /**
+ * What this explains — the surface's own name. It is folded into the trigger's accessible name
+ * ("More info: Vault") while the visible row stays the short generic label, so a screen-reader
+ * user tabbing past knows what the fold is about without the panel repeating the tab bar.
+ */
+ label?: string;
+ className?: string;
+}) {
+ const [open, setOpen] = useState(false);
+ const panelId = useId();
+ return (
+ <div className={className}>
+ <button
+ type="button"
+ aria-expanded={open}
+ aria-controls={panelId}
+ // The visible text is a prefix of the accessible name, so "label in name" holds and a
+ // voice-control user can still say what they see.
+ {...(label !== undefined ? { "aria-label": S.common.moreInfoAbout(label) } : {})}
+ onClick={() => setOpen((v) => !v)}
+ className={`flex items-center ${ICON_GAP.tight} rounded text-xs text-gray-500 transition-colors duration-150 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200`}
+ >
+ <Chevron open={open} size={ICON_SIZE.chevronDense} />
+ {S.common.moreInfo}
+ </button>
+ {/* pl-4.5 = the chevron's 12px plus the row's gap, so the body lines up under the label. */}
+ <div
+ id={panelId}
+ hidden={!open}
+ className="mt-1.5 pl-4.5 text-xs leading-relaxed text-gray-500 dark:text-gray-400"
+ >
+ {children}
+ </div>
+ </div>
+ );
+}
diff --git a/packages/web/src/components/ui/icons.tsx b/packages/web/src/components/ui/icons.tsx
index 7767c17b..dd17e28e 100644
--- a/packages/web/src/components/ui/icons.tsx
+++ b/packages/web/src/components/ui/icons.tsx
@@ -115,6 +115,26 @@ export function UploadIcon({ size = 13, className = "" }: { size?: number; class
);
}
+/**
+ * The close cross. Drawn on a 14x14 grid at stroke 1.5 rather than the 24x24 icon grid: a
+ * two-stroke mark aliases badly when its grid and its render size disagree.
+ */
+export function CloseIcon({ size = 14, className = "" }: { size?: number; className?: string }) {
+ return (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 14 14"
+ fill="none"
+ stroke="currentColor"
+ aria-hidden
+ className={`block shrink-0 ${className}`}
+ >
+ <path d="M2 2l10 10M12 2L2 12" strokeWidth="1.5" strokeLinecap="round" />
+ </svg>
+ );
+}
+
/**
* The X close button shared by the Modal / Drawer / Sheet headers: same glyph,
* padding and hover treatment. Extra button props (e.g. Sheet's onPointerDown
@@ -136,13 +156,14 @@ export function CloseButton({
className={`rounded-md p-1.5 text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300 ${className}`}
{...rest}
>
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" aria-hidden>
- <path d="M2 2l10 10M12 2L2 12" strokeWidth="1.5" strokeLinecap="round" />
- </svg>
+ <CloseIcon />
</button>
);
}
+/** Info circle: the app's 9-radius status circle with a bar and a dot inside it. */
+export const INFO_ICON = "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 11v5m0-8h.01";
+
/** Standard gear (lucide settings): full tooth outline + center circle, crisp and undistorted at 16px. */
export const GEAR_ICON =
"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2zM15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0z";
diff --git a/packages/web/src/components/ui/image-zoom.tsx b/packages/web/src/components/ui/image-zoom.tsx
index db0922a4..83f92814 100644
--- a/packages/web/src/components/ui/image-zoom.tsx
+++ b/packages/web/src/components/ui/image-zoom.tsx
@@ -10,6 +10,7 @@
import { useEffect, useState } from "react";
import { createPortal } from "react-dom";
import { S } from "../../lib/strings";
+import { CloseIcon } from "./icons";
export function ZoomableImage({
src,
@@ -56,9 +57,7 @@ function Lightbox({ src, alt, onClose }: { src: string; alt: string; onClose: ()
onClick={onClose}
className="absolute right-2 top-2 flex h-7 w-7 items-center justify-center rounded-full bg-black/50 text-white transition-colors duration-150 hover:bg-black/70"
>
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor">
- <path d="M2 2l10 10M12 2L2 12" strokeWidth="1.5" strokeLinecap="round" />
- </svg>
+ <CloseIcon />
</button>
<img
src={src}
diff --git a/packages/web/src/components/ui/info-popover.tsx b/packages/web/src/components/ui/info-popover.tsx
new file mode 100644
index 00000000..8e3ac21c
--- /dev/null
+++ b/packages/web/src/components/ui/info-popover.tsx
@@ -0,0 +1,110 @@
+/**
+ * Circled "?" that discloses an explanation on demand.
+ *
+ * Explanatory prose falls into two kinds, and only one of them belongs here. **Semantics** —
+ * what a section is, what a field means, what it affects, when a change takes effect — is read
+ * once and then never again, so leaving it on screen costs every later visit a paragraph of
+ * scrolling. It goes behind this trigger. **Formatting** — "one KEY=value per line", "leave
+ * empty for unlimited" — is read *while typing*, so hiding it converts a glance into a click
+ * and raises the error rate. That stays visible, in the field's own hint.
+ *
+ * The panel is portaled to document.body and positioned against viewport coordinates by
+ * usePortalPanel, so no ancestor's overflow can clip it (a modal body, a horizontally scrolling
+ * table) and it closes on outside click / Esc / scroll / resize. Esc there is captured and its
+ * propagation stopped, which is what lets one Esc dismiss this popover while an enclosing Modal
+ * stays open. z-[60] for the same reason OptionMenu uses it: a portaled node sits in the root
+ * stacking context and must clear the modal overlay's z-50.
+ */
+import { useId, useState } from "react";
+import type { ReactNode } from "react";
+import { createPortal } from "react-dom";
+import { S } from "../../lib/strings";
+import { ICON_SIZE } from "../../lib/icon-scale";
+import { usePortalPanel } from "./use-portal-panel";
+
+/** Circled question mark: the app's 9-radius status circle, with a mark and a dot inside it. */
+const HELP_ICON =
+ "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM9.6 9.3a2.5 2.5 0 0 1 4.9.8c0 1.7-2.5 2.5-2.5 2.5M12 16.8h.01";
+
+const PANEL_WIDTH = 288; // w-72, the OptionMenu panel width
+
+export function InfoPopover({
+ children,
+ label,
+ size = ICON_SIZE.inlineGlyph,
+ className = "",
+}: {
+ /** The explanation. Plain text in almost every case; nodes are allowed for the rare inline code. */
+ children: ReactNode;
+ /**
+ * What this explains — the section title or the field label it sits beside. It is folded into
+ * the trigger's accessible name ("More info: Vault") rather than used verbatim, so a trigger
+ * inside a heading never makes that heading announce its own title twice. Omit it and the
+ * trigger falls back to a bare "More info".
+ */
+ label?: string;
+ size?: number;
+ className?: string;
+}) {
+ const [open, setOpen] = useState(false);
+ const panelId = useId();
+ const { triggerRef, panelRef, position } = usePortalPanel({
+ open,
+ onClose: () => setOpen(false),
+ // Panel geometry: a fixed 288px column whose height is two to six lines of text.
+ estimatedHeight: 160,
+ panelWidth: PANEL_WIDTH,
+ });
+ const name = label !== undefined ? S.common.moreInfoAbout(label) : S.common.moreInfo;
+ return (
+ <>
+ <button
+ ref={triggerRef}
+ type="button"
+ aria-label={name}
+ title={name}
+ aria-expanded={open}
+ aria-controls={panelId}
+ // While open the panel is also the trigger's description, so a screen reader reads the
+ // explanation on focus rather than only announcing that something expanded.
+ aria-describedby={open ? panelId : undefined}
+ onClick={() => setOpen((v) => !v)}
+ className={`inline-flex shrink-0 items-center justify-center rounded-full text-gray-400 transition-colors duration-150 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 ${className}`}
+ >
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="1.7"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ aria-hidden
+ className="block shrink-0"
+ >
+ <path d={HELP_ICON} />
+ </svg>
+ </button>
+ {open &&
+ position &&
+ createPortal(
+ <div
+ ref={panelRef}
+ id={panelId}
+ role="tooltip"
+ style={{
+ position: "fixed",
+ top: position.topPx,
+ bottom: position.bottomPx,
+ left: position.left,
+ }}
+ className="anim-pop z-[60] max-h-[70vh] w-72 max-w-[calc(100vw-2rem)] overflow-y-auto rounded-md border border-gray-200 bg-white px-3 py-2 text-xs leading-relaxed text-gray-600 shadow-lg dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300"
+ >
+ {children}
+ </div>,
+ document.body,
+ )}
+ </>
+ );
+}
diff --git a/packages/web/src/components/ui/input.tsx b/packages/web/src/components/ui/input.tsx
index 21fa6da3..fbb78d85 100644
--- a/packages/web/src/components/ui/input.tsx
+++ b/packages/web/src/components/ui/input.tsx
@@ -4,7 +4,7 @@
* and the label/hint/error scaffolding with the other form controls via field.tsx.
*/
import { forwardRef, useId } from "react";
-import type { InputHTMLAttributes, TextareaHTMLAttributes } from "react";
+import type { InputHTMLAttributes, ReactNode, TextareaHTMLAttributes } from "react";
import { Field, controlBase } from "./field";
// Adds width, placeholder and disabled styling on top of the shared control look; each of Input/Textarea appends its own font size and padding (see their size).
@@ -24,6 +24,14 @@ export const sizeClass: Record<ControlSize, string> = {
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
label?: string;
hint?: string;
+ /**
+ * Semantic explanation — what the field means, what it affects, when it takes effect —
+ * disclosed by a "?" beside the label. A rule about the *shape* of the input ("one per line",
+ * "leave empty for unlimited") belongs in `hint`, which stays on screen while the user types.
+ */
+ info?: ReactNode;
+ /** Accessible name for that "?" (defaults to the generic "More info"). */
+ infoLabel?: string;
error?: string;
/**
* Marks the field red without rendering error text: use this when the input has a
@@ -84,22 +92,39 @@ export const noAutofill = autofillProps(undefined, false);
export function Input({
label,
hint,
+ info,
+ infoLabel,
error,
invalid,
required,
size = "base",
className,
autoComplete,
+ id,
...rest
}: InputProps) {
const bad = Boolean(error) || Boolean(invalid);
const errorId = useId();
+ // The info layout moves the label out of the wrapping <label> and associates it by htmlFor
+ // (see Field), so an info field needs the control to carry an id.
+ const generatedId = useId();
+ const controlId = id ?? generatedId;
// `required` drives the label's asterisk + aria-required only; the native `required`
// attribute is intentionally not forwarded (the app validates on submit, so browser
// validation bubbles would collide with the inline field errors).
return (
- <Field label={label} hint={hint} error={error} errorId={errorId} required={required}>
+ <Field
+ label={label}
+ hint={hint}
+ error={error}
+ errorId={errorId}
+ required={required}
+ info={info}
+ infoLabel={infoLabel}
+ controlId={controlId}
+ >
<input
+ id={info !== undefined ? controlId : id}
className={`${baseClass} ${sizeClass[size]} ${bad ? errorClass : ""} ${className ?? ""}`}
aria-invalid={bad ? true : undefined}
aria-required={required || undefined}
@@ -116,6 +141,10 @@ export function Input({
export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
label?: string;
hint?: string;
+ /** Semantic explanation behind a "?" beside the label (see InputProps.info). */
+ info?: ReactNode;
+ /** Accessible name for that "?" (defaults to the generic "More info"). */
+ infoLabel?: string;
error?: string;
/** Marks the field red without rendering error text (see Input.invalid). */
invalid?: boolean;
@@ -126,15 +155,41 @@ export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElemen
}
export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(
- { label, hint, error, invalid, required, mono, size = "base", className, autoComplete, ...rest },
+ {
+ label,
+ hint,
+ info,
+ infoLabel,
+ error,
+ invalid,
+ required,
+ mono,
+ size = "base",
+ className,
+ autoComplete,
+ id,
+ ...rest
+ },
ref,
) {
const bad = Boolean(error) || Boolean(invalid);
const errorId = useId();
+ const generatedId = useId();
+ const controlId = id ?? generatedId;
return (
- <Field label={label} hint={hint} error={error} errorId={errorId} required={required}>
+ <Field
+ label={label}
+ hint={hint}
+ error={error}
+ errorId={errorId}
+ required={required}
+ info={info}
+ infoLabel={infoLabel}
+ controlId={controlId}
+ >
<textarea
ref={ref}
+ id={info !== undefined ? controlId : id}
className={`${baseClass} px-3 py-2 ${size === "sm" ? "text-xs leading-relaxed" : "text-base"} ${mono ? "font-mono" : ""} ${bad ? errorClass : ""} ${className ?? ""}`}
aria-invalid={bad ? true : undefined}
aria-required={required || undefined}
diff --git a/packages/web/src/components/ui/password-input.tsx b/packages/web/src/components/ui/password-input.tsx
index dbf43bf9..a64dd2fe 100644
--- a/packages/web/src/components/ui/password-input.tsx
+++ b/packages/web/src/components/ui/password-input.tsx
@@ -20,11 +20,14 @@ const EYE_OFF =
export function PasswordInput({
label,
hint,
+ info,
+ infoLabel,
error,
invalid,
required,
size = "base",
className,
+ id,
...rest
}: Omit<InputProps, "type">) {
const [visible, setVisible] = useState(false);
@@ -33,11 +36,24 @@ export function PasswordInput({
// association is wired here too: the inner Input only gets `invalid` and points its
// aria-describedby at the outer FieldError.
const errorId = useId();
+ // Same reason as Input: an info field's label sits outside the wrapper and needs htmlFor.
+ const generatedId = useId();
+ const controlId = id ?? generatedId;
return (
- <Field label={label} hint={hint} error={error} errorId={errorId} required={required}>
+ <Field
+ label={label}
+ hint={hint}
+ error={error}
+ errorId={errorId}
+ required={required}
+ info={info}
+ infoLabel={infoLabel}
+ controlId={controlId}
+ >
<div className="relative">
<Input
{...rest}
+ id={info !== undefined ? controlId : id}
required={required}
size={size}
type={visible ? "text" : "password"}
diff --git a/packages/web/src/components/ui/session-activity-icon.tsx b/packages/web/src/components/ui/session-activity-icon.tsx
index bb100916..b160b5b2 100644
--- a/packages/web/src/components/ui/session-activity-icon.tsx
+++ b/packages/web/src/components/ui/session-activity-icon.tsx
@@ -1,4 +1,5 @@
import { S } from "../../lib/strings";
+import { toneDot, toneInk } from "../../lib/tone";
import type { SessionActivity } from "../../lib/session-activity";
type Activity = Exclude<SessionActivity, null>;
@@ -6,43 +7,45 @@ type Activity = Exclude<SessionActivity, null>;
/**
* Session-level activity glyphs (sidebar rows + chat header).
*
- * Three states, two shapes:
+ * Three states, three marks — each state is legible from its shape and its motion alone, with
+ * colour carrying only the severity every reader shares:
*
- * - **busy** — an hourglass, turning over on a loop, the motion a real hourglass makes.
- * Compaction is busy work like any other, so it reuses the hourglass rather than owning a
- * third shape; it keeps the amber tone compaction already carries elsewhere in the app (the
- * stream's compaction banner), so the two live states differ by colour alone.
+ * - **running** — an hourglass, turning over on a loop, the motion a real hourglass makes.
+ * - **compacting** — a bar with a chevron closing on it from each side, squeezing on a loop.
+ * Compaction is busy work like any other, so it takes the same `attention` tone as running;
+ * what it does not share is the shape, because two live states that differ only in colour are
+ * two states a reader has to have been told apart in advance.
* - **finished, unread** — a small green dot. It is a notification, not a status: it says
* "there is a reply here you have not seen".
* - **finished, read** — nothing. The dot is removed rather than muted, so the only marks left
* in the list are the ones worth acting on. A Session that has never run renders nothing for
* the same reason (see sessionActivity), which makes the two visually identical by design.
*
- * The colour-only split between the live states is a deliberate exception, not the house style:
- * each glyph names its exact state in its accessible name and tooltip, so nothing here is
+ * Every glyph also names its exact state in its accessible name and tooltip, so nothing here is
* legible only to a sighted user with full colour vision. The read state announces nothing
* because it renders nothing, which is correct — there is no state to report.
+ *
+ * Ink comes from the shared tone tokens (lib/tone.ts), which carry the measured contrast ratios
+ * against the two surfaces these glyphs sit on: the sidebar (gray-50 / gray-900) and the chat
+ * header (white / gray-950).
*/
export const ACTIVITY_GLYPH: Record<"running" | "compacting", string> = {
// Hourglass: frame top and bottom, sand funnelling to the waist.
running: "M6 3h12M6 21h12M8 3v3.5L12 10l4-3.5V3M8 21v-3.5L12 14l4 3.5V21",
- compacting: "M6 3h12M6 21h12M8 3v3.5L12 10l4-3.5V3M8 21v-3.5L12 14l4 3.5V21",
+ // Compress: a centre bar with a chevron bearing down on it from above and up from below.
+ compacting: "M4 12h16M8 7l4 3 4-3M8 17l4-3 4 3",
};
/**
- * Ink for the two busy states, measured against the surfaces they actually sit on — white and
- * gray-950 — as WCAG 2.x ratios:
- *
- * - running gray-500 / gray-400 …… 4.83 : 1 light, 7.93 : 1 dark
- * - compacting amber-600 / amber-400 … 3.19 : 1 light, 12.06 : 1 dark
- *
- * The unread dot takes the emerald the Session status dot has always used — `bg-emerald-500`,
- * one tone in both themes (sidebar.tsx's StatusDot, and its twin in the chat header). It is the
- * same kind of marker in the same place, so it stays the same green.
+ * Ink and motion per live state. Both are `attention` — unfinished work waiting on time — and
+ * each pairs its tone with the animation that reads as its own kind of work: the hourglass turns
+ * over, the compress mark squeezes. The unread dot takes the `success` dot fill, one tone in
+ * both themes, exactly as the Session status dot beside it does (sidebar.tsx's StatusDot and its
+ * twin in the chat header). It is the same kind of marker in the same place.
*/
const APPEARANCE: Record<"running" | "compacting", string> = {
- running: "hourglass-turn text-gray-500 dark:text-gray-400",
- compacting: "hourglass-turn text-amber-600 dark:text-amber-400",
+ running: `hourglass-turn ${toneInk.attention}`,
+ compacting: `compact-squeeze ${toneInk.attention}`,
};
/** Localized status label (read at render time: `S` is a live binding swapped per locale). */
@@ -74,7 +77,7 @@ export function SessionActivityIcon({
style={{ width: size, height: size }}
className="flex shrink-0 items-center justify-center"
>
- <span className="block h-1.5 w-1.5 rounded-full bg-emerald-500" />
+ <span className={`block h-1.5 w-1.5 rounded-full ${toneDot.success}`} />
</span>
);
}
diff --git a/packages/web/src/components/ui/status-icon.tsx b/packages/web/src/components/ui/status-icon.tsx
index 45b1132a..c0287f49 100644
--- a/packages/web/src/components/ui/status-icon.tsx
+++ b/packages/web/src/components/ui/status-icon.tsx
@@ -3,6 +3,8 @@
* cards): a spinning ring while running, a static glyph otherwise — "still
* running" vs. "done" can be told apart at a glance, no need to read the text.
*/
+import { toneInk } from "../../lib/tone";
+
export type RunState = "running" | "waiting" | "done" | "failed";
const GLYPH: Record<Exclude<RunState, "running">, string> = {
@@ -14,11 +16,12 @@ const GLYPH: Record<Exclude<RunState, "running">, string> = {
failed: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM9 9l6 6m0-6-6 6",
};
+/** Shared status tones (lib/tone.ts): a settled row recedes, an unfinished one asks for a look. */
const TONE: Record<RunState, string> = {
- running: "text-emerald-500 dark:text-emerald-400",
- waiting: "text-amber-500 dark:text-amber-400",
- done: "text-gray-400 dark:text-gray-500",
- failed: "text-red-500 dark:text-red-400",
+ running: toneInk.busy,
+ waiting: toneInk.attention,
+ done: toneInk.muted,
+ failed: toneInk.danger,
};
export function StatusIcon({
diff --git a/packages/web/src/components/ui/token-donut.tsx b/packages/web/src/components/ui/token-donut.tsx
index c64ce21e..3c433d56 100644
--- a/packages/web/src/components/ui/token-donut.tsx
+++ b/packages/web/src/components/ui/token-donut.tsx
@@ -18,6 +18,7 @@
import { TOKEN_COLORS } from "../../lib/token-colors";
import { humanizeTokens } from "../../lib/format";
import { S } from "../../lib/strings";
+import { toneInk } from "../../lib/tone";
export function TokenDonut({
cacheRead,
@@ -46,7 +47,11 @@ export function TokenDonut({
const pct = max > 0 ? total / max : 0;
// The base ring's (i.e. "empty ring / remainder") color shifts to amber / red as usage approaches the limit, as a warning.
const ringTone =
- pct > 0.95 ? "text-red-500" : pct > 0.8 ? "text-amber-500" : "text-gray-300 dark:text-gray-700";
+ pct > 0.95
+ ? toneInk.danger
+ : pct > 0.8
+ ? toneInk.attention
+ : "text-gray-300 dark:text-gray-700";
const segs = [
{
key: "cacheRead",
diff --git a/packages/web/src/features/agents/agent-settings-page.tsx b/packages/web/src/features/agents/agent-settings-page.tsx
index 80a674ab..ebb0f86e 100644
--- a/packages/web/src/features/agents/agent-settings-page.tsx
+++ b/packages/web/src/features/agents/agent-settings-page.tsx
@@ -45,6 +45,8 @@ import { VaultTab } from "./vault-tab";
import { SchedulesTab } from "./schedules-tab";
import { McpServersSection } from "./mcp-servers-section";
import { thinkingLevelOptionsFor } from "../chat/thinking-level";
+import { InfoPopover } from "../../components/ui/info-popover";
+import { ICON_SIZE } from "../../lib/icon-scale";
type TabKey =
"overview" | "prompt" | "runtime" | "tools" | "skills" | "memory" | "vault" | "schedules";
@@ -237,20 +239,7 @@ export function AgentSettingsPage() {
onClick={() => navigate("/agents")}
className="-ml-2 mb-3 text-gray-500 dark:text-gray-400"
>
- <svg
- width="14"
- height="14"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="1.8"
- strokeLinecap="round"
- strokeLinejoin="round"
- aria-hidden
- >
- <path d="M15 18l-6-6 6-6" />
- <path d="M9 12h12" />
- </svg>
+ <GlyphIcon d="M15 18l-6-6 6-6M9 12h12" size={ICON_SIZE.rowLead} />
{S.agent.backToList}
</Button>
<h1 className="mb-1 text-xl font-semibold">{data.config.name ?? agentId}</h1>
@@ -441,7 +430,10 @@ function OverviewTab({
text-xs labels over dark font-semibold values. */}
<section className="border-t border-gray-200 pt-4 dark:border-gray-800">
<div className="flex flex-wrap items-center justify-between gap-x-4 gap-y-2">
- <p className="text-sm font-medium">{S.agent.stateTitle}</p>
+ <p className="flex items-center gap-1.5 text-sm font-medium">
+ {S.agent.stateTitle}
+ <InfoPopover label={S.agent.stateTitle}>{S.agent.transferDesc}</InfoPopover>
+ </p>
<div className="flex shrink-0 items-center gap-2">
{projectId && (
<a
@@ -462,7 +454,6 @@ function OverviewTab({
)}
</div>
</div>
- <p className="mt-1 text-xs text-gray-500 dark:text-gray-400">{S.agent.transferDesc}</p>
<div className="mt-3 space-y-2.5">
<div>
<p className="text-xs font-medium text-gray-500 dark:text-gray-400">
@@ -815,7 +806,8 @@ function RuntimeTab({ data, onSave }: { data: AgentConfigResponse; onSave: SaveF
/>
<Input
label={S.agent.timeoutMs}
- hint={S.agent.timeoutMsHint}
+ info={S.agent.timeoutMsHint}
+ infoLabel={S.agent.timeoutMs}
size="sm"
value={timeoutMs}
error={fieldErrors.timeoutMs}
@@ -836,7 +828,8 @@ function RuntimeTab({ data, onSave }: { data: AgentConfigResponse; onSave: SaveF
<div className="grid grid-cols-1 gap-3 md:grid-cols-3">
<Input
label={S.agent.maxContextLength}
- hint={S.agent.maxContextLengthHint}
+ info={S.agent.maxContextLengthHint}
+ infoLabel={S.agent.maxContextLength}
size="sm"
value={maxContextLength}
onChange={(e) => setMaxContextLength(e.target.value)}
@@ -845,7 +838,8 @@ function RuntimeTab({ data, onSave }: { data: AgentConfigResponse; onSave: SaveF
/>
<Input
label={S.agent.maxSessionTurns}
- hint={S.agent.maxSessionTurnsHint}
+ info={S.agent.maxSessionTurnsHint}
+ infoLabel={S.agent.maxSessionTurns}
size="sm"
value={maxSessionTurns}
onChange={(e) => setMaxSessionTurns(e.target.value)}
@@ -1007,7 +1001,14 @@ function ToolsTab({ data, onSave }: { data: AgentConfigResponse; onSave: SaveFn
<th className="px-3 py-2">{S.agent.toolPermission}</th>
<th className="px-3 py-2">{S.agent.toolTimeout}</th>
<th className="px-3 py-2">{S.agent.toolMaxOutput}</th>
- <th className="px-3 py-2">{S.agent.toolCallDescription}</th>
+ <th className="px-3 py-2">
+ <span className="flex items-center gap-1.5">
+ {S.agent.toolCallDescription}
+ <InfoPopover label={S.agent.toolCallDescription}>
+ {S.agent.callDescriptionHint}
+ </InfoPopover>
+ </span>
+ </th>
</tr>
</thead>
<tbody>
@@ -1063,7 +1064,6 @@ function ToolsTab({ data, onSave }: { data: AgentConfigResponse; onSave: SaveFn
</tbody>
</table>
</div>
- <p className="text-xs text-gray-400 dark:text-gray-500">{S.agent.callDescriptionHint}</p>
<Button size="sm" variant="primary" onClick={submit}>
{S.common.save}
diff --git a/packages/web/src/features/agents/agents-page.tsx b/packages/web/src/features/agents/agents-page.tsx
index c4a19474..c6ea681b 100644
--- a/packages/web/src/features/agents/agents-page.tsx
+++ b/packages/web/src/features/agents/agents-page.tsx
@@ -39,6 +39,7 @@ import { STAT_ICONS } from "../../lib/stat-icons";
import { DRAFT_SESSION_ID } from "../chat/chat-page";
import { parkActiveDraft } from "../chat/draft-sessions";
import { ActivitySparkline } from "./activity-sparkline";
+import { ICON_SIZE } from "../../lib/icon-scale";
/** Built-in Agent shipped with every Project (default_agent only; the server also rejects deletion, so no delete entry point is shown here). */
const BUILTIN_AGENT_IDS = new Set(["default_agent"]);
@@ -268,7 +269,7 @@ export function AgentsPage() {
aria-label={S.agent.kernelOutdatedHint}
onClick={() => openSettingsTab(a.agentId, "overview")}
>
- <GlyphIcon d={CARD_ICONS.kernelUpdate} size={12} />
+ <GlyphIcon d={CARD_ICONS.kernelUpdate} size={ICON_SIZE.inlineGlyph} />
</button>
)}
</div>
@@ -288,7 +289,7 @@ export function AgentsPage() {
className="inline-flex shrink-0 items-center gap-1 tabular-nums"
title={S.agent.sessionCount(a.sessionCount)}
>
- <GlyphIcon d={CARD_ICONS.sessions} size={12} />
+ <GlyphIcon d={CARD_ICONS.sessions} size={ICON_SIZE.inlineGlyph} />
{a.sessionCount}
</span>
<button
@@ -298,7 +299,7 @@ export function AgentsPage() {
aria-label={S.agent.toolCount(a.toolCount)}
onClick={() => openSettingsTab(a.agentId, "tools")}
>
- <GlyphIcon d={STAT_ICONS.toolCalls} size={12} />
+ <GlyphIcon d={STAT_ICONS.toolCalls} size={ICON_SIZE.inlineGlyph} />
{a.toolCount}
</button>
<button
@@ -308,7 +309,7 @@ export function AgentsPage() {
aria-label={S.skills.skillCount(a.skillCount)}
onClick={() => openSettingsTab(a.agentId, "skills")}
>
- <GlyphIcon d={CARD_ICONS.skills} size={12} />
+ <GlyphIcon d={CARD_ICONS.skills} size={ICON_SIZE.inlineGlyph} />
{a.skillCount}
</button>
<button
@@ -318,7 +319,7 @@ export function AgentsPage() {
aria-label={S.agent.memoryCount(a.memoryCount)}
onClick={() => openSettingsTab(a.agentId, "memory")}
>
- <GlyphIcon d={CARD_ICONS.memory} size={12} />
+ <GlyphIcon d={CARD_ICONS.memory} size={ICON_SIZE.inlineGlyph} />
{a.memoryCount}
</button>
<button
@@ -328,7 +329,7 @@ export function AgentsPage() {
aria-label={S.agent.vaultKeyCount(a.vaultKeyCount)}
onClick={() => openSettingsTab(a.agentId, "vault")}
>
- <GlyphIcon d={CARD_ICONS.vaultKeys} size={12} />
+ <GlyphIcon d={CARD_ICONS.vaultKeys} size={ICON_SIZE.inlineGlyph} />
{a.vaultKeyCount}
</button>
<button
@@ -338,14 +339,14 @@ export function AgentsPage() {
aria-label={S.agent.scheduleCount(a.scheduleCount)}
onClick={() => openSettingsTab(a.agentId, "schedules")}
>
- <GlyphIcon d={CARD_ICONS.schedules} size={12} />
+ <GlyphIcon d={CARD_ICONS.schedules} size={ICON_SIZE.inlineGlyph} />
{a.scheduleCount}
</button>
<span
className="inline-flex shrink-0 items-center gap-1"
title={`${S.agent.updatedAt} ${a.updatedAt ? formatDateTime(a.updatedAt) : "—"}`}
>
- <GlyphIcon d={STAT_ICONS.elapsed} size={12} />
+ <GlyphIcon d={STAT_ICONS.elapsed} size={ICON_SIZE.inlineGlyph} />
{a.updatedAt ? formatRelativeDays(a.updatedAt, locale) : "—"}
</span>
</div>
diff --git a/packages/web/src/features/agents/mcp-servers-section.tsx b/packages/web/src/features/agents/mcp-servers-section.tsx
index 3ff46ef1..6b11db1c 100644
--- a/packages/web/src/features/agents/mcp-servers-section.tsx
+++ b/packages/web/src/features/agents/mcp-servers-section.tsx
@@ -35,6 +35,8 @@ import {
type McpServerFormState,
type McpTransportKind,
} from "./mcp-servers-form";
+import { toneInk } from "../../lib/tone";
+import { InfoPopover } from "../../components/ui/info-popover";
/** Maps a validation error code to its localized message. */
function errorText(err: McpFormError | undefined): string | undefined {
@@ -77,7 +79,7 @@ function TestBadge({ result }: { result: RowTestResult | undefined }) {
}
if (result.ok) {
return (
- <span className="text-[11px] font-medium whitespace-nowrap text-emerald-600 dark:text-emerald-400">
+ <span className={`text-[11px] font-medium whitespace-nowrap ${toneInk.success}`}>
{S.agent.mcpTestBadge(result.tools?.length ?? 0, result.latencyMs)}
</span>
);
@@ -85,7 +87,7 @@ function TestBadge({ result }: { result: RowTestResult | undefined }) {
return (
<span
title={result.error}
- className="text-[11px] font-medium whitespace-nowrap text-red-600 dark:text-red-400"
+ className={`text-[11px] font-medium whitespace-nowrap ${toneInk.danger}`}
>
{S.agent.mcpTestBadgeFail}
</span>
@@ -264,10 +266,10 @@ export function McpServersSection({
return (
<div className="space-y-4">
- <div>
- <p className="mb-1 text-xs font-medium text-gray-500">{S.agent.mcpServers}</p>
- <p className="text-xs text-gray-500 dark:text-gray-400">{S.agent.mcpDesc}</p>
- </div>
+ <p className="flex items-center gap-1.5 text-xs font-medium text-gray-500">
+ {S.agent.mcpServers}
+ <InfoPopover label={S.agent.mcpServers}>{S.agent.mcpDesc}</InfoPopover>
+ </p>
{servers.length === 0 ? (
<p className="py-2 text-xs text-gray-400 dark:text-gray-500">{S.agent.mcpEmpty}</p>
diff --git a/packages/web/src/features/agents/memory-tab.tsx b/packages/web/src/features/agents/memory-tab.tsx
index d1f26645..1b14ec0d 100644
--- a/packages/web/src/features/agents/memory-tab.tsx
+++ b/packages/web/src/features/agents/memory-tab.tsx
@@ -43,6 +43,9 @@ import { Md } from "../chat/md";
import { DRAFT_SESSION_ID } from "../chat/chat-page";
import { draftKey, loadDraft, saveDraft } from "../chat/draft-cache";
import { buildMemoryAddPrompt, buildMemoryEditPrompt } from "./memory-chat-prompts";
+import { toneStrip } from "../../lib/tone";
+import { InfoPopover } from "../../components/ui/info-popover";
+import { HelpFold } from "../../components/ui/help-fold";
/** The body without its frontmatter block: the drawer's metadata header already shows those fields, so rendering the raw YAML too would only repeat them. */
function bodyWithoutFrontmatter(content: string): string {
@@ -454,7 +457,8 @@ export function MemoryTab({
return (
<div className="space-y-5">
- <p className="text-xs leading-5 text-gray-500 dark:text-gray-400">{S.memory.desc}</p>
+ {/* Tab-level description: no title in the panel to anchor a "?" to (see help-fold.tsx). */}
+ <HelpFold label={S.agent.tabMemory}>{S.memory.desc}</HelpFold>
<div className="flex items-center justify-between gap-4 rounded-lg border border-gray-200 px-4 py-3 dark:border-gray-800">
<p className="text-sm font-medium text-gray-800 dark:text-gray-200">{S.memory.enable}</p>
@@ -462,8 +466,10 @@ export function MemoryTab({
</div>
{!templateHasMemory && (
- <div className="flex items-center justify-between gap-4 rounded-lg border border-amber-300 bg-amber-50 px-4 py-3 dark:border-amber-700 dark:bg-amber-950/40">
- <p className="text-xs text-amber-800 dark:text-amber-300">{S.memory.templateMissing}</p>
+ <div
+ className={`flex items-center justify-between gap-4 rounded-lg border px-4 py-3 ${toneStrip.attention}`}
+ >
+ <p className="text-xs">{S.memory.templateMissing}</p>
<Button size="sm" onClick={() => void insertPlaceholder()}>
{S.memory.insertPlaceholder}
</Button>
@@ -545,14 +551,10 @@ export function MemoryTab({
)}
<section className="space-y-2.5 rounded-lg border border-gray-200 p-3.5 dark:border-gray-800">
- <div>
- <h3 className="text-sm font-semibold text-gray-800 dark:text-gray-200">
- {S.memory.promptSection}
- </h3>
- <p className="mt-0.5 text-xs text-gray-500 dark:text-gray-400">
- {S.memory.promptSectionHint}
- </p>
- </div>
+ <h3 className="flex items-center gap-1.5 text-sm font-semibold text-gray-800 dark:text-gray-200">
+ {S.memory.promptSection}
+ <InfoPopover label={S.memory.promptSection}>{S.memory.promptSectionHint}</InfoPopover>
+ </h3>
<Textarea
ref={mainPromptRef}
label={S.memory.promptLabel}
diff --git a/packages/web/src/features/agents/prompt-injection-controls.tsx b/packages/web/src/features/agents/prompt-injection-controls.tsx
index a48c1924..e42897df 100644
--- a/packages/web/src/features/agents/prompt-injection-controls.tsx
+++ b/packages/web/src/features/agents/prompt-injection-controls.tsx
@@ -32,6 +32,8 @@ import { Textarea } from "../../components/ui/input";
import { Switch } from "../../components/ui/switch";
import { useSaveConfirm } from "../../components/ui/confirm-modal";
import { toastError, toastSuccess } from "../../components/ui/toast";
+import { toneStrip } from "../../lib/tone";
+import { InfoPopover } from "../../components/ui/info-popover";
export type PromptInjectionFeature = "skills" | "vault" | "schedules";
@@ -193,8 +195,10 @@ export function usePromptInjection({
// features that can report legacySectionPresent); everything else gets the plain insert.
const legacy = state?.legacySectionPresent === true;
const alertStrip = state !== null && !state.templateHasPlaceholder && (
- <div className="flex items-center justify-between gap-4 rounded-lg border border-amber-300 bg-amber-50 px-4 py-3 dark:border-amber-700 dark:bg-amber-950/40">
- <p className="text-xs text-amber-800 dark:text-amber-300">
+ <div
+ className={`flex items-center justify-between gap-4 rounded-lg border px-4 py-3 ${toneStrip.attention}`}
+ >
+ <p className="text-xs">
{legacy ? (strings.legacyTemplate ?? strings.templateMissing) : strings.templateMissing}
</p>
{canEdit && (
@@ -207,14 +211,10 @@ export function usePromptInjection({
const promptSection = state !== null && (
<section className="space-y-2.5 rounded-lg border border-gray-200 p-3.5 dark:border-gray-800">
- <div>
- <h3 className="text-sm font-semibold text-gray-800 dark:text-gray-200">
- {strings.promptSection}
- </h3>
- <p className="mt-0.5 text-xs text-gray-500 dark:text-gray-400">
- {strings.promptSectionHint}
- </p>
- </div>
+ <h3 className="flex items-center gap-1.5 text-sm font-semibold text-gray-800 dark:text-gray-200">
+ {strings.promptSection}
+ <InfoPopover label={strings.promptSection}>{strings.promptSectionHint}</InfoPopover>
+ </h3>
<Textarea
ref={promptRef}
label={strings.promptLabel}
diff --git a/packages/web/src/features/agents/schedules-tab.tsx b/packages/web/src/features/agents/schedules-tab.tsx
index ba98e7fb..cf9bdf99 100644
--- a/packages/web/src/features/agents/schedules-tab.tsx
+++ b/packages/web/src/features/agents/schedules-tab.tsx
@@ -47,6 +47,7 @@ import { ModelSelect, PickerList } from "../chat/model-select";
import { WorkspaceSelect } from "../chat/workspace-select";
import { sameModelRef } from "../models/model-grouping";
import { usePromptInjection } from "./prompt-injection-controls";
+import { HelpFold } from "../../components/ui/help-fold";
/** Display status → badge tone. */
const STATUS_TONE: Record<ScheduleStatus, BadgeTone> = {
@@ -432,12 +433,11 @@ export function SchedulesTab({
return (
<div className="space-y-4">
- <div>
- <p className="text-xs text-gray-500 dark:text-gray-400">{S.schedule.desc}</p>
- {!isOwner && (
- <p className="mt-1 text-xs text-gray-500 dark:text-gray-400">{S.schedule.readOnlyHint}</p>
- )}
- </div>
+ {/* Tab-level description: no title in the panel to anchor a "?" to (see help-fold.tsx). */}
+ <HelpFold label={S.agent.tabSchedules}>
+ {S.schedule.desc}
+ {!isOwner && <span className="mt-1.5 block">{S.schedule.readOnlyHint}</span>}
+ </HelpFold>
{toggleCard}
{alertStrip}
diff --git a/packages/web/src/features/agents/skills-tab.tsx b/packages/web/src/features/agents/skills-tab.tsx
index c8edda4a..00638871 100644
--- a/packages/web/src/features/agents/skills-tab.tsx
+++ b/packages/web/src/features/agents/skills-tab.tsx
@@ -45,6 +45,7 @@ import { draftKey, loadDraft, saveDraft } from "../chat/draft-cache";
import { parkActiveDraft } from "../chat/draft-sessions";
import { buildImportPrompt } from "./skill-import-source";
import { usePromptInjection } from "./prompt-injection-controls";
+import { HelpFold } from "../../components/ui/help-fold";
/** <label> version of the button look (matches Button secondary sm; the Button component only renders <button>) — same as the Overview tab's snapshot-import label. */
const UPLOAD_LABEL_CLASS =
@@ -287,8 +288,11 @@ export function SkillsTab({
return (
<div className="space-y-4">
+ {/* The import button is not a title, so the description cannot anchor a "?" to it either. */}
<div className="flex items-start justify-between gap-3">
- <p className="text-xs text-gray-500 dark:text-gray-400">{S.skills.agentTabDesc}</p>
+ <HelpFold label={S.agent.tabSkills} className="min-w-0 flex-1">
+ {S.skills.agentTabDesc}
+ </HelpFold>
<Button
size="sm"
variant="primary"
diff --git a/packages/web/src/features/agents/vault-tab.tsx b/packages/web/src/features/agents/vault-tab.tsx
index dab2f67a..9e5c7d74 100644
--- a/packages/web/src/features/agents/vault-tab.tsx
+++ b/packages/web/src/features/agents/vault-tab.tsx
@@ -27,6 +27,7 @@ import { ConfirmModal } from "../../components/ui/confirm-modal";
import { SkeletonList } from "../../components/ui/skeleton";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { usePromptInjection } from "./prompt-injection-controls";
+import { HelpFold } from "../../components/ui/help-fold";
/** Vault key naming rule (consistent with core/server): shell environment variable name. */
const VAULT_KEY_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
@@ -158,12 +159,13 @@ export function VaultTab({
return (
<div className="space-y-4">
- <div>
- <p className="text-xs text-gray-500 dark:text-gray-400">{S.vault.desc}</p>
- {!isOwner && (
- <p className="mt-1 text-xs text-gray-500 dark:text-gray-400">{S.vault.readOnlyHint}</p>
- )}
- </div>
+ {/* What the vault is and when a value takes effect is read once and then in the way; the
+ table below is what the tab is for. The panel repeats no title — the tab bar carries it —
+ so the disclosure names itself instead of hanging a "?" off nothing. */}
+ <HelpFold label={S.agent.tabVault}>
+ {S.vault.desc}
+ {!isOwner && <span className="mt-1.5 block">{S.vault.readOnlyHint}</span>}
+ </HelpFold>
{toggleCard}
{alertStrip}
diff --git a/packages/web/src/features/chat/chat-input.tsx b/packages/web/src/features/chat/chat-input.tsx
index cd3bdc86..341f83ae 100644
--- a/packages/web/src/features/chat/chat-input.tsx
+++ b/packages/web/src/features/chat/chat-input.tsx
@@ -87,6 +87,8 @@ import { agentDisplayName } from "../../state/project";
import { AgentAvatar } from "../../components/ui/agent-avatar";
import { Dropdown } from "../../components/ui/dropdown";
import { GlyphIcon } from "../../components/ui/glyph-icon";
+import { CheckIcon, ChevronDown } from "../../components/ui/icons";
+import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { noAutofill } from "../../components/ui/input";
import { toastError, toastInfo } from "../../components/ui/toast";
import { SkillIcon } from "../skills/skill-icon-view";
@@ -118,6 +120,7 @@ import { PAPERCLIP_ICON } from "./attached-files-banner";
import { FileDropZone } from "./drop-zone";
import { splitDroppedFiles } from "../../lib/file-drop";
import { splitBySize } from "../../lib/upload-limits";
+import { toneInk } from "../../lib/tone";
const APPROVAL_MODES: ApprovalMode[] = ["always-ask", "read-only", "allow-all", "deny-all"];
@@ -176,40 +179,12 @@ function ApprovalModeSelect({
className="flex h-8 max-w-44 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200"
>
{/* Icon changes with the current mode (allow-all = warning triangle, grayscale, no color-coding) */}
- <svg
- width="13"
- height="13"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="1.7"
- strokeLinecap="round"
- strokeLinejoin="round"
- aria-hidden
- className="shrink-0"
- >
- <path d={APPROVAL_MODE_ICONS[value]} />
- </svg>
+ <GlyphIcon d={APPROVAL_MODE_ICONS[value]} />
{/* Button shows only the description (the mode id is spelled out in the menu); when the card is narrower than @md, only the icon remains (title shows the full name). */}
<span className="hidden min-w-0 truncate @md:block">
{S.chat.approvalModeNames[value] ?? value}
</span>
- <svg
- width="10"
- height="10"
- viewBox="0 0 12 12"
- fill="none"
- stroke="currentColor"
- className="shrink-0"
- aria-hidden
- >
- <path
- d="M3 4.5l3 3 3-3"
- strokeWidth="1.5"
- strokeLinecap="round"
- strokeLinejoin="round"
- />
- </svg>
+ <ChevronDown size={ICON_SIZE.caretDense} />
</button>
}
>
@@ -384,25 +359,10 @@ function ThinkingLevelSelect({
onClick={() => setOpen(!open)}
className="flex h-8 max-w-36 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200"
>
- <GlyphIcon d={SPARK_ICON} size={14} className="shrink-0" />
+ <GlyphIcon d={SPARK_ICON} className="shrink-0" />
{/* When the card is narrower than @md, only the icon remains (title shows the full state). */}
<span className="hidden min-w-0 truncate @md:block">{label}</span>
- <svg
- width="10"
- height="10"
- viewBox="0 0 12 12"
- fill="none"
- stroke="currentColor"
- className="shrink-0"
- aria-hidden
- >
- <path
- d="M3 4.5l3 3 3-3"
- strokeWidth="1.5"
- strokeLinecap="round"
- strokeLinejoin="round"
- />
- </svg>
+ <ChevronDown size={ICON_SIZE.caretDense} />
</button>
}
>
@@ -488,7 +448,7 @@ function SteerModeRow({
);
return (
<div className="flex w-full items-center gap-2 px-3 py-1 text-xs">
- <GlyphIcon d={SLIDERS_ICON} size={14} className="shrink-0 text-gray-400 dark:text-gray-500" />
+ <GlyphIcon d={SLIDERS_ICON} className="shrink-0 text-gray-400 dark:text-gray-500" />
<span className="min-w-0 flex-1 truncate text-gray-600 dark:text-gray-400">
{S.chat.steerModeLabel}
</span>
@@ -552,7 +512,7 @@ function SkillSelect({
}}
className="flex h-8 max-w-44 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200"
>
- <GlyphIcon d={BOOK_ICON} size={14} className="shrink-0" />
+ <GlyphIcon d={BOOK_ICON} className="shrink-0" />
{/* When the card is narrower than @md, only the icon + badge remain (title shows the full name). */}
<span className="hidden min-w-0 truncate @md:block">{S.chat.skillsSelect}</span>
{/* Selected-count badge (the chip row above the input mirrors the selection too). */}
@@ -561,22 +521,7 @@ function SkillSelect({
{selected.length}
</span>
)}
- <svg
- width="10"
- height="10"
- viewBox="0 0 12 12"
- fill="none"
- stroke="currentColor"
- className="shrink-0"
- aria-hidden
- >
- <path
- d="M3 4.5l3 3 3-3"
- strokeWidth="1.5"
- strokeLinecap="round"
- strokeLinejoin="round"
- />
- </svg>
+ <ChevronDown size={ICON_SIZE.caretDense} />
</button>
}
>
@@ -615,7 +560,7 @@ function SkillSelect({
{/* Each skill's custom icon (icon.svg, sanitized and inlined; falls back to the book icon if missing). */}
<SkillIcon
icon={s.icon}
- size={14}
+ size={ICON_SIZE.inlineGlyph}
className="shrink-0 text-gray-400 dark:text-gray-500"
/>
<span className="shrink-0 font-mono">{s.name}</span>
@@ -707,11 +652,7 @@ function PlusMenu({
: "text-gray-600 dark:text-gray-400"
}`}
>
- <GlyphIcon
- d={item.icon}
- size={14}
- className="shrink-0 text-gray-400 dark:text-gray-500"
- />
+ <GlyphIcon d={item.icon} className="shrink-0 text-gray-400 dark:text-gray-500" />
<span className="shrink-0">{item.label}</span>
<span className="min-w-0 flex-1 truncate text-gray-400 dark:text-gray-500">
{item.desc}
@@ -759,8 +700,8 @@ function ContextGauge({
unknown || pct <= 0.8
? "text-gray-400 dark:text-gray-500"
: pct > 0.95
- ? "text-red-500"
- : "text-amber-500";
+ ? toneInk.danger
+ : toneInk.attention;
const R = 5;
const C = 2 * Math.PI * R;
return (
@@ -2214,7 +2155,7 @@ export function ChatInput({
<span
key={i}
title={file.name}
- className="anim-pop flex max-w-56 items-center gap-1.5 rounded-md border border-gray-200 bg-gray-50 py-1 pl-2 pr-1 text-xs text-gray-700 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200"
+ className={`anim-pop flex max-w-56 items-center ${ICON_GAP.tight} rounded-md border border-gray-200 bg-gray-50 py-1 pl-2 pr-1 text-xs text-gray-700 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200`}
>
<GlyphIcon
d={PAPERCLIP_ICON}
@@ -2397,20 +2338,7 @@ export function ChatInput({
className="flex h-5 min-w-0 items-center gap-1 rounded px-1.5 text-xs text-gray-600 transition-colors duration-150 hover:bg-white/80 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white"
>
<span className="truncate">{goalBudgetSummary}</span>
- <svg
- width="9"
- height="9"
- viewBox="0 0 12 12"
- fill="none"
- stroke="currentColor"
- strokeWidth="1.5"
- strokeLinecap="round"
- strokeLinejoin="round"
- className="shrink-0"
- aria-hidden
- >
- <path d="M3 4.5l3 3 3-3" />
- </svg>
+ <ChevronDown size={ICON_SIZE.caretDense} />
</button>
}
>
@@ -2458,7 +2386,7 @@ export function ChatInput({
onClick={saveGoalBudget}
className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-gray-900 text-white transition-colors duration-150 hover:bg-gray-700 disabled:cursor-not-allowed disabled:opacity-35 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-white"
>
- <GlyphIcon d="M5 12l4 4L19 6" size={14} />
+ <CheckIcon size={14} />
</button>
</div>
<p
diff --git a/packages/web/src/features/chat/chat-page.tsx b/packages/web/src/features/chat/chat-page.tsx
index b5a0dc7e..28522d99 100644
--- a/packages/web/src/features/chat/chat-page.tsx
+++ b/packages/web/src/features/chat/chat-page.tsx
@@ -120,21 +120,11 @@ import type { SubagentsPanelState } from "./use-subagents-panel";
import { useSessionDraft } from "./use-session-draft";
import { useSessionStream } from "./use-session-stream";
import { PanelsToolbar } from "./panels-toolbar";
-
-const STAT_ICONS = {
- // Tokens (database / stacked cylinders)
- tokens:
- "M4 6c0-1.7 3.6-3 8-3s8 1.3 8 3-3.6 3-8 3-8-1.3-8-3zm0 0v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3",
- // Cost (circled dollar sign)
- cost: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-15v12m2.6-9.3c-.5-.8-1.5-1.2-2.6-1.2-1.5 0-2.7.8-2.7 2 0 2.7 5.4 1.3 5.4 4 0 1.2-1.2 2-2.7 2-1.2 0-2.2-.5-2.7-1.4",
- // Elapsed time (clock)
- elapsed: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-14v5l3 2",
- // Files (folder)
- folder: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
- // Running services (server rack: two stacked units with an indicator dot each)
- services:
- "M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5zm0 11a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3zM7 6.5h.01M7 17.5h.01",
-} as const;
+import { toneDot, toneInk } from "../../lib/tone";
+import { GlyphIcon } from "../../components/ui/glyph-icon";
+import { STAT_ICONS } from "../../lib/stat-icons";
+import { INFO_ICON } from "../../components/ui/icons";
+import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
/** How often the background-process list refreshes while it can still change (a run may promote a command at any time; a running process can exit on its own). */
const PROCESS_POLL_MS = 15_000;
@@ -151,21 +141,9 @@ function StatChip({ icon, value, label }: { icon: string; value: ReactNode; labe
return (
<span
title={label}
- className="flex shrink-0 items-center gap-1 font-mono text-xs text-gray-500 dark:text-gray-400"
+ className={`flex shrink-0 items-center ${ICON_GAP.tight} font-mono text-xs text-gray-500 dark:text-gray-400`}
>
- <svg
- width="14"
- height="14"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="1.7"
- strokeLinecap="round"
- strokeLinejoin="round"
- aria-hidden
- >
- <path d={icon} />
- </svg>
+ <GlyphIcon d={icon} />
{value}
</span>
);
@@ -1712,41 +1690,16 @@ export function ChatPage() {
{runningProcessCount > 0 && (
<span
title={S.chat.runningServices(runningProcessCount)}
- className="flex shrink-0 items-center gap-1 font-mono text-xs text-emerald-600 dark:text-emerald-400"
+ className={`flex shrink-0 items-center ${ICON_GAP.tight} font-mono text-xs ${toneInk.busy}`}
>
- <svg
- width="14"
- height="14"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="1.7"
- strokeLinecap="round"
- strokeLinejoin="round"
- aria-hidden
- >
- <path d={STAT_ICONS.services} />
- </svg>
+ <GlyphIcon d={STAT_ICONS.services} />
{runningProcessCount}
</span>
)}
</span>
{/* Narrow: the info icon alone (the chips would crowd the title out). */}
<span className="flex h-7 w-7 items-center justify-center text-gray-500 sm:hidden dark:text-gray-400">
- <svg
- width="16"
- height="16"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="1.7"
- strokeLinecap="round"
- strokeLinejoin="round"
- aria-hidden
- >
- <circle cx="12" cy="12" r="9" />
- <path d="M12 11v5m0-8h.01" />
- </svg>
+ <GlyphIcon d={INFO_ICON} size={ICON_SIZE.navRow} />
</span>
</button>
}
@@ -1820,7 +1773,7 @@ export function ChatPage() {
aria-hidden
className={`h-1.5 w-1.5 shrink-0 rounded-full ${
p.running
- ? "animate-pulse bg-emerald-500"
+ ? `animate-pulse ${toneDot.busy}`
: "bg-gray-300 dark:bg-gray-600"
}`}
/>
diff --git a/packages/web/src/features/chat/draft-view.tsx b/packages/web/src/features/chat/draft-view.tsx
index 6e47e914..b292c429 100644
--- a/packages/web/src/features/chat/draft-view.tsx
+++ b/packages/web/src/features/chat/draft-view.tsx
@@ -82,6 +82,7 @@ import {
import { effectiveThinkingLevel } from "./thinking-level";
import { WorkspaceSelect, pillClass } from "./workspace-select";
import { sameModelRef } from "../models/model-grouping";
+import { ICON_GAP } from "../../lib/icon-scale";
/** Coalescing window for writing body text to the cache: keystrokes are frequent, so a short batch accumulates before persisting (option changes are still written immediately). */
const DRAFT_SAVE_DEBOUNCE_MS = 300;
@@ -952,7 +953,7 @@ function AgentSelect({
onSelect(a);
setOpen(false);
}}
- className="flex w-full items-center gap-2.5 px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800"
+ className={`flex w-full items-center ${ICON_GAP.menu} px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800`}
>
<AgentAvatar
id={a.agentId}
diff --git a/packages/web/src/features/chat/files-panel.tsx b/packages/web/src/features/chat/files-panel.tsx
index f80cb32e..52080bcc 100644
--- a/packages/web/src/features/chat/files-panel.tsx
+++ b/packages/web/src/features/chat/files-panel.tsx
@@ -8,17 +8,10 @@
import type { SessionInfo } from "@prismshadow/penguin-server/api";
import { S } from "../../lib/strings";
import { Sheet } from "../../components/ui/sheet";
+import { CloseIcon } from "../../components/ui/icons";
import { WorkspaceBrowser } from "./workspace-browser";
import type { FilesPanelState } from "./use-files-panel";
-function CloseIcon() {
- return (
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" aria-hidden>
- <path d="M2 2l10 10M12 2L2 12" strokeWidth="1.5" strokeLinecap="round" />
- </svg>
- );
-}
-
export function FilesPanel({ session, panel }: { session: SessionInfo; panel: FilesPanelState }) {
if (!panel.isDocked) {
return (
diff --git a/packages/web/src/features/chat/goal-banner.tsx b/packages/web/src/features/chat/goal-banner.tsx
index e2c9bfa7..bf2f0c41 100644
--- a/packages/web/src/features/chat/goal-banner.tsx
+++ b/packages/web/src/features/chat/goal-banner.tsx
@@ -17,6 +17,7 @@ import { GlyphIcon } from "../../components/ui/glyph-icon";
import { ZoomableImage } from "../../components/ui/image-zoom";
import { GOAL_ICON, UNLIMITED_BUDGET } from "./goal-use";
import type { GoalBannerState } from "./goal-use";
+import { toneSurface } from "../../lib/tone";
/** Image glyph (24×24 line path) for the collapsed attachment chip on later goal rounds. */
const ATTACHMENT_ICON = "M3 5h18v14H3zM3 16l5-5 4 4 3-3 6 6M15.5 8.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0";
@@ -118,8 +119,8 @@ export function GoalStatusBanner({ goal }: { goal: GoalBannerState }) {
className={`shrink-0 rounded px-1.5 py-0.5 ${
finished
? goal.status === "complete"
- ? "bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-400"
- : "bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-400"
+ ? toneSurface.success
+ : toneSurface.attention
: "bg-gray-200 text-gray-600 dark:bg-gray-800 dark:text-gray-300"
}`}
>
diff --git a/packages/web/src/features/chat/message-files-card.tsx b/packages/web/src/features/chat/message-files-card.tsx
index 7a2c32e9..d384f619 100644
--- a/packages/web/src/features/chat/message-files-card.tsx
+++ b/packages/web/src/features/chat/message-files-card.tsx
@@ -15,6 +15,12 @@
import { useEffect, useMemo, useState } from "react";
import { S } from "../../lib/strings";
import { isFilePathLike, toWorkspaceRelative } from "../../lib/file-path";
+import { GlyphIcon } from "../../components/ui/glyph-icon";
+import { Chevron } from "../../components/ui/chevron";
+import { ICON_SIZE } from "../../lib/icon-scale";
+
+/** File glyph (a page with a folded corner), the card header's mark and each row's lead. */
+const FILE_ICON = "M6 3h8l4 4v14H6zM14 3v4h4";
const MAX_VISIBLE = 3;
@@ -109,18 +115,7 @@ export function MessageFilesCard({
the rows (Codex-style). No card-level action entry point — each row already has its own
"Preview", adding one to the header would just duplicate the row action. */}
<div className="flex items-center gap-2 border-b border-gray-100 bg-gray-50 px-3 py-2 dark:border-gray-800/60 dark:bg-gray-800/40">
- <svg
- width="14"
- height="14"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="1.7"
- aria-hidden
- className="shrink-0 text-gray-400"
- >
- <path d="M6 3h8l4 4v14H6zM14 3v4h4" />
- </svg>
+ <GlyphIcon d={FILE_ICON} size={ICON_SIZE.rowLead} className="text-gray-400" />
<span className="min-w-0 flex-1 truncate text-sm font-medium">
{S.chat.filesInMessage(paths.length)}
</span>
@@ -135,18 +130,7 @@ export function MessageFilesCard({
onClick={() => onOpenFile(path)}
className="group flex w-full cursor-pointer items-center gap-2 px-3 py-2 text-left transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/50"
>
- <svg
- width="14"
- height="14"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="1.7"
- aria-hidden
- className="shrink-0 text-gray-400"
- >
- <path d="M6 3h8l4 4v14H6zM14 3v4h4" />
- </svg>
+ <GlyphIcon d={FILE_ICON} size={ICON_SIZE.rowLead} className="text-gray-400" />
<PathLabel path={path} />
<span className="min-w-0 flex-1" />
{/* Right-aligned "click to preview" text: makes the row action explicit (a trailing
@@ -168,20 +152,7 @@ export function MessageFilesCard({
className="flex w-full items-center gap-1.5 px-3 py-2 text-left text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-50 dark:text-gray-400 dark:hover:bg-gray-800/50"
>
{expanded ? S.chat.showLess : S.chat.showMoreFiles(hidden)}
- <svg
- width="12"
- height="12"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- aria-hidden
- className={`transition-transform duration-200 ${expanded ? "rotate-180" : ""}`}
- >
- <path d="m6 9 6 6 6-6" />
- </svg>
+ <Chevron open={expanded} size={ICON_SIZE.chevronDense} />
</button>
)}
</div>
diff --git a/packages/web/src/features/chat/message-item.tsx b/packages/web/src/features/chat/message-item.tsx
index 9125e2a2..fd16858a 100644
--- a/packages/web/src/features/chat/message-item.tsx
+++ b/packages/web/src/features/chat/message-item.tsx
@@ -35,6 +35,7 @@ import { parseGoalMessage } from "./goal-use";
import { parseSkillsMessage } from "./skill-use";
import { TaskStatsLine } from "./task-stats-line";
import type { StreamRenderContext } from "./message-stream";
+import { toneInk } from "../../lib/tone";
/** User glyph (24×24 line path) for the mid-run steering chip. */
const USER_STEERING_ICON =
@@ -121,7 +122,9 @@ function ReconnectLine({ item, ctx }: { item: ReconnectItem; ctx: StreamRenderCo
const showControls =
live && ctx.origin.length === 0 && (ctx.onRetryNow !== undefined || ctx.onGiveUp !== undefined);
return (
- <p className="anim-msg my-1 flex flex-wrap items-center gap-x-2 gap-y-1 font-mono text-xs text-amber-600 dark:text-amber-500">
+ <p
+ className={`anim-msg my-1 flex flex-wrap items-center gap-x-2 gap-y-1 font-mono text-xs ${toneInk.attention}`}
+ >
<span>{S.chat.reconnect(item.status, state, item.attempt, seconds)}</span>
{showControls && (
<span className="flex shrink-0 items-center gap-1.5">
diff --git a/packages/web/src/features/chat/model-select.tsx b/packages/web/src/features/chat/model-select.tsx
index 94a2e120..fa586b96 100644
--- a/packages/web/src/features/chat/model-select.tsx
+++ b/packages/web/src/features/chat/model-select.tsx
@@ -17,6 +17,8 @@ import { Badge } from "../../components/ui/badge";
import { Dropdown } from "../../components/ui/dropdown";
import { FormPicker } from "../../components/ui/form-picker";
import { GlyphIcon } from "../../components/ui/glyph-icon";
+import { ChevronDown } from "../../components/ui/icons";
+import { ICON_SIZE } from "../../lib/icon-scale";
import { noAutofill } from "../../components/ui/input";
import { ProviderLogo } from "../../components/ui/provider-logo";
import {
@@ -336,22 +338,7 @@ export function ModelSelect({
{logo}
{/* When the card is narrower than @md, only the provider logo remains (title shows the full name). */}
<span className="hidden min-w-0 truncate @md:block">{label}</span>
- <svg
- width="10"
- height="10"
- viewBox="0 0 12 12"
- fill="none"
- stroke="currentColor"
- className="shrink-0"
- aria-hidden
- >
- <path
- d="M3 4.5l3 3 3-3"
- strokeWidth="1.5"
- strokeLinecap="round"
- strokeLinejoin="round"
- />
- </svg>
+ <ChevronDown size={ICON_SIZE.caretDense} />
</button>
}
>
diff --git a/packages/web/src/features/chat/panels-toolbar.tsx b/packages/web/src/features/chat/panels-toolbar.tsx
index a4a85b18..7c1b697f 100644
--- a/packages/web/src/features/chat/panels-toolbar.tsx
+++ b/packages/web/src/features/chat/panels-toolbar.tsx
@@ -16,6 +16,9 @@ import type { ReactNode } from "react";
import { S } from "../../lib/strings";
import { Dropdown } from "../../components/ui/dropdown";
import { NAV_ICONS } from "../../components/ui/icons";
+import { GlyphIcon } from "../../components/ui/glyph-icon";
+import { FOLDER_ICON } from "../../components/ui/group-list";
+import { ICON_SIZE } from "../../lib/icon-scale";
import {
dockStateVersion,
holdsTerminal,
@@ -25,6 +28,7 @@ import {
} from "../terminal/terminal-dock-state";
import { displayTitle, useTerminalDockOpen } from "../terminal/terminal-dock";
import { liveTerminals, subscribeTerminals, terminalApiSupported } from "../terminal/terminal-list";
+import { toneDot } from "../../lib/tone";
export type PanelKey = "agents" | "terminal" | "workspace";
@@ -33,8 +37,6 @@ const DEFAULT_PINS: readonly PanelKey[] = ["agents", "workspace"];
/** Display order of pinned icons and dropdown rows (the product-specified order). */
const PANEL_ORDER: readonly PanelKey[] = ["agents", "terminal", "workspace"];
-/** Folder glyph, duplicated from the chat stats icons to avoid exporting page internals. */
-const FOLDER_ICON = "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z";
/** Plus: the "create" trigger opening the panels menu. */
const CREATE_ICON = "M12 5v14M5 12h14";
/** Pin (map-pin style tack), shown filled while pinned. */
@@ -53,7 +55,7 @@ function loadPins(): PanelKey[] {
}
/** The subagents spawn-tree glyph is multi-element (circles + edges), so it is a component. */
-function AgentsGlyph({ size = 15 }: { size?: number }) {
+function AgentsGlyph({ size = ICON_SIZE.iconButton }: { size?: number }) {
return (
<svg
width={size}
@@ -62,6 +64,8 @@ function AgentsGlyph({ size = 15 }: { size?: number }) {
fill="none"
stroke="currentColor"
strokeWidth="1.7"
+ strokeLinecap="round"
+ strokeLinejoin="round"
aria-hidden
>
<circle cx="5" cy="12" r="2.5" />
@@ -72,24 +76,6 @@ function AgentsGlyph({ size = 15 }: { size?: number }) {
);
}
-function PathGlyph({ d, size = 15 }: { d: string; size?: number }) {
- return (
- <svg
- width={size}
- height={size}
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="1.7"
- strokeLinecap="round"
- strokeLinejoin="round"
- aria-hidden
- >
- <path d={d} />
- </svg>
- );
-}
-
export interface PanelsToolbarProps {
agentsOpen: boolean;
onToggleAgents: () => void;
@@ -208,10 +194,10 @@ function TerminalListMenu({ onPick }: { onPick: (id: string) => void }) {
data-testid="terminal-menu-item"
data-terminal-id={terminal.id}
onMouseDown={() => onPick(terminal.id)}
- className="mx-1 flex w-[calc(100%-0.5rem)] items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100"
+ className="mx-1 flex w-[calc(100%-0.5rem)] items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100"
>
<span className="shrink-0 text-gray-500 dark:text-gray-400">
- <PathGlyph d={NAV_ICONS.terminal} size={13} />
+ <GlyphIcon d={NAV_ICONS.terminal} />
</span>
<span className="min-w-0 truncate">
{terminal.seq ?? index + 1}: {displayTitle(terminal.title) || terminal.name}
@@ -276,7 +262,7 @@ export function PanelsToolbar(props: PanelsToolbarProps) {
key: "terminal",
label: S.terminal.title,
buttonLabel: S.terminal.title,
- glyph: () => <PathGlyph d={NAV_ICONS.terminal} />,
+ glyph: () => <GlyphIcon d={NAV_ICONS.terminal} size={ICON_SIZE.iconButton} />,
open: terminalOpen,
toggle: toggleTerminalDock,
},
@@ -285,7 +271,7 @@ export function PanelsToolbar(props: PanelsToolbarProps) {
label: S.chat.workspacePanel,
// The established accessible name ("打开工作区") — several flows and tests target it.
buttonLabel: S.chat.openWorkspace,
- glyph: () => <PathGlyph d={FOLDER_ICON} />,
+ glyph: () => <GlyphIcon d={FOLDER_ICON} size={ICON_SIZE.iconButton} />,
open: props.workspaceOpen,
toggle: props.onToggleWorkspace,
},
@@ -317,7 +303,7 @@ export function PanelsToolbar(props: PanelsToolbarProps) {
>
{entry.glyph()}
{entry.pending && (
- <span aria-hidden className="h-1.5 w-1.5 rounded-full bg-amber-500" />
+ <span aria-hidden className={`h-1.5 w-1.5 rounded-full ${toneDot.attention}`} />
)}
{entry.key === "terminal" && <TerminalCountBadge count={terminalCount} />}
</button>
@@ -359,7 +345,7 @@ export function PanelsToolbar(props: PanelsToolbarProps) {
data-testid="panels-all"
className={triggerClass(menuOpen)}
>
- <PathGlyph d={CREATE_ICON} />
+ <GlyphIcon d={CREATE_ICON} size={ICON_SIZE.iconButton} />
{!terminalPinned && <TerminalCountBadge count={terminalCount} />}
</button>
}
@@ -400,7 +386,10 @@ export function PanelsToolbar(props: PanelsToolbarProps) {
)}
<span className="min-w-0 flex-1" />
{entry.pending && (
- <span aria-hidden className="h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500" />
+ <span
+ aria-hidden
+ className={`h-1.5 w-1.5 shrink-0 rounded-full ${toneDot.attention}`}
+ />
)}
</button>
{/* Pin toggle: keeps the menu open so several pins can be adjusted in one go. */}
@@ -417,19 +406,7 @@ export function PanelsToolbar(props: PanelsToolbarProps) {
: "text-gray-300 opacity-0 hover:text-gray-600 group-hover:opacity-100 focus-visible:opacity-100 dark:text-gray-600 dark:hover:text-gray-300"
}`}
>
- <svg
- width="13"
- height="13"
- viewBox="0 0 24 24"
- fill={pinned ? "currentColor" : "none"}
- stroke="currentColor"
- strokeWidth="1.7"
- strokeLinecap="round"
- strokeLinejoin="round"
- aria-hidden
- >
- <path d={PIN_ICON} />
- </svg>
+ <GlyphIcon d={PIN_ICON} filled={pinned} />
</button>
</div>
);
diff --git a/packages/web/src/features/chat/step-banner.tsx b/packages/web/src/features/chat/step-banner.tsx
index 352118ee..32a286ef 100644
--- a/packages/web/src/features/chat/step-banner.tsx
+++ b/packages/web/src/features/chat/step-banner.tsx
@@ -17,6 +17,7 @@ import { Chevron } from "../../components/ui/chevron";
import { StatusIcon } from "../../components/ui/status-icon";
import type { RunState } from "../../components/ui/status-icon";
import { LiveDuration } from "./live-duration";
+import { toneInk } from "../../lib/tone";
export function StepBanner({
state,
@@ -45,9 +46,9 @@ export function StepBanner({
const header = (
<>
- <StatusIcon state={state} size={12} />
+ <StatusIcon state={state} />
<span
- className={`shrink-0 text-[11px] font-semibold tracking-wide uppercase ${running ? "text-emerald-600 dark:text-emerald-400" : "text-gray-500 dark:text-gray-400"}`}
+ className={`shrink-0 text-[11px] font-semibold tracking-wide uppercase ${running ? toneInk.busy : "text-gray-500 dark:text-gray-400"}`}
>
{title}
</span>
diff --git a/packages/web/src/features/chat/subagent-chip.tsx b/packages/web/src/features/chat/subagent-chip.tsx
index dab56eb6..06f4fa9c 100644
--- a/packages/web/src/features/chat/subagent-chip.tsx
+++ b/packages/web/src/features/chat/subagent-chip.tsx
@@ -16,6 +16,7 @@ import { useProject } from "../../state/project";
import { useSessions } from "../../state/sessions";
import { resolveAgentLabel, shortSessionId } from "./agent-topology";
import type { StreamRenderContext } from "./message-stream";
+import { toneDot } from "../../lib/tone";
export function SubagentChip({
sessionId,
@@ -65,7 +66,9 @@ export function SubagentChip({
className="inline-block h-2.5 w-2.5 shrink-0 animate-spin rounded-full border border-gray-400 border-t-transparent"
/>
)}
- {pending && <span aria-hidden className="h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500" />}
+ {pending && (
+ <span aria-hidden className={`h-1.5 w-1.5 shrink-0 rounded-full ${toneDot.attention}`} />
+ )}
<span className="min-w-0 flex-1" />
</button>
);
diff --git a/packages/web/src/features/chat/subagents-panel.tsx b/packages/web/src/features/chat/subagents-panel.tsx
index 11b0369e..1d014b02 100644
--- a/packages/web/src/features/chat/subagents-panel.tsx
+++ b/packages/web/src/features/chat/subagents-panel.tsx
@@ -9,18 +9,11 @@ import type { SessionInfo } from "@prismshadow/penguin-server/api";
import { S } from "../../lib/strings";
import type { StreamModel } from "../../lib/omni/stream-model";
import { Sheet } from "../../components/ui/sheet";
+import { CloseIcon } from "../../components/ui/icons";
import { SubagentsView } from "./subagents-view";
import type { StreamRenderContext } from "./message-stream";
import type { SubagentsPanelState } from "./use-subagents-panel";
-function CloseIcon() {
- return (
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" aria-hidden>
- <path d="M2 2l10 10M12 2L2 12" strokeWidth="1.5" strokeLinecap="round" />
- </svg>
- );
-}
-
export function SubagentsPanel({
session,
panel,
diff --git a/packages/web/src/features/chat/task-stats-line.tsx b/packages/web/src/features/chat/task-stats-line.tsx
index 25c9f2db..1a7c8b77 100644
--- a/packages/web/src/features/chat/task-stats-line.tsx
+++ b/packages/web/src/features/chat/task-stats-line.tsx
@@ -210,7 +210,7 @@ export function TaskStatsLine({
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
- strokeWidth="1.8"
+ strokeWidth="1.7"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden
diff --git a/packages/web/src/features/chat/work-group.tsx b/packages/web/src/features/chat/work-group.tsx
index 733fa61a..0c4b8539 100644
--- a/packages/web/src/features/chat/work-group.tsx
+++ b/packages/web/src/features/chat/work-group.tsx
@@ -28,6 +28,7 @@ import { LiveDuration } from "./live-duration";
import { MessageItem } from "./message-item";
import type { StreamRenderContext } from "./message-stream";
import { summarizeWork } from "./work-summary";
+import { toneDot, toneInk, toneSurface } from "../../lib/tone";
/** Item kinds that belong in the group: thinking and tool calls (subagent cards are nested inside the run_subagent tool card, not listed separately). */
export function isWorkItem(item: ChatItem): boolean {
@@ -131,10 +132,10 @@ export function WorkGroup({
}}
className="sticky -top-4 z-[5] flex w-full items-center gap-2 bg-gray-50 px-3 py-2 text-left transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900 dark:hover:bg-gray-800"
>
- <StatusIcon state={active ? "running" : "done"} size={12} />
+ <StatusIcon state={active ? "running" : "done"} />
{/* The title doubles as status: "Running" while in progress, "Done" when finished. */}
<span
- className={`shrink-0 text-[11px] font-semibold uppercase tracking-wide ${active ? "text-emerald-600 dark:text-emerald-400" : "text-gray-500 dark:text-gray-400"}`}
+ className={`shrink-0 text-[11px] font-semibold uppercase tracking-wide ${active ? toneInk.busy : "text-gray-500 dark:text-gray-400"}`}
>
{active ? S.chat.workRunning : S.chat.workDone}
</span>
@@ -173,14 +174,16 @@ export function WorkGroup({
the text pill would push the header past one line on phones. role="img", not a
live region — same non-live semantics as the text pill, so re-renders don't
chatter at screen readers. */}
- <span className="hidden shrink-0 rounded bg-amber-100 px-1 text-[10px] font-medium text-amber-700 sm:inline dark:bg-amber-950/50 dark:text-amber-300">
+ <span
+ className={`hidden shrink-0 rounded px-1 text-[10px] font-medium sm:inline ${toneSurface.attention}`}
+ >
{S.chat.approvalWaiting}
</span>
<span
role="img"
title={S.chat.approvalWaiting}
aria-label={S.chat.approvalWaiting}
- className="h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500 sm:hidden"
+ className={`h-1.5 w-1.5 shrink-0 rounded-full sm:hidden ${toneDot.attention}`}
/>
</>
)}
diff --git a/packages/web/src/features/chat/workspace-browser.tsx b/packages/web/src/features/chat/workspace-browser.tsx
index d29d0c3d..c112590d 100644
--- a/packages/web/src/features/chat/workspace-browser.tsx
+++ b/packages/web/src/features/chat/workspace-browser.tsx
@@ -32,6 +32,9 @@ import { HiddenFileInput } from "../../components/ui/hidden-file-input";
import { SkeletonList } from "../../components/ui/skeleton";
import { CodeBlock } from "./code-block";
import { languageForExtension } from "./code-languages";
+import { toneInk } from "../../lib/tone";
+import { GlyphIcon } from "../../components/ui/glyph-icon";
+import { ICON_SIZE } from "../../lib/icon-scale";
const TEXT_EXTS = new Set([
"txt",
@@ -436,19 +439,7 @@ export function WorkspaceBrowser({
title={S.files.backToList}
className="flex shrink-0 items-center gap-1 rounded-md px-1.5 py-1 text-sm text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200"
>
- <svg
- width="14"
- height="14"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- aria-hidden
- >
- <path d="M15 18l-6-6 6-6" />
- </svg>
+ <GlyphIcon d="M15 18l-6-6 6-6" size={ICON_SIZE.rowLead} />
{S.files.backToList}
</button>
{/* Shows only the filename (full path goes into the title hover tooltip): the
@@ -498,10 +489,7 @@ export function WorkspaceBrowser({
>
{S.files.openInNewTab}
{!previewIsolated && (
- <span
- aria-label={S.files.previewNotIsolatedHint}
- className="text-amber-600 dark:text-amber-500"
- >
+ <span aria-label={S.files.previewNotIsolatedHint} className={toneInk.attention}>
⚠
</span>
)}
diff --git a/packages/web/src/features/chat/workspace-select.tsx b/packages/web/src/features/chat/workspace-select.tsx
index 45fa169e..1a104018 100644
--- a/packages/web/src/features/chat/workspace-select.tsx
+++ b/packages/web/src/features/chat/workspace-select.tsx
@@ -19,6 +19,9 @@ import { Dropdown } from "../../components/ui/dropdown";
import { FormPicker } from "../../components/ui/form-picker";
import { noAutofill } from "../../components/ui/input";
import { toastError } from "../../components/ui/toast";
+import { GlyphIcon } from "../../components/ui/glyph-icon";
+import { FOLDER_ICON } from "../../components/ui/group-list";
+import { ICON_SIZE } from "../../lib/icon-scale";
/** Shared style for pill trigger buttons (ChatGPT project button style: small rounded pill + icon + short name + collapse arrow). */
export const pillClass =
@@ -178,21 +181,7 @@ export function WorkspaceSelect({
const entries = (dir?.entries ?? []).filter((e) => !e.name.startsWith("."));
/** Folder glyph shared by both triggers. */
const folderIcon = (extraClass: string) => (
- <svg
- width="14"
- height="14"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- className={`shrink-0 text-gray-400 ${extraClass}`}
- aria-hidden
- >
- <path
- d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"
- strokeWidth="1.6"
- strokeLinejoin="round"
- />
- </svg>
+ <GlyphIcon d={FOLDER_ICON} size={ICON_SIZE.rowLead} className={`text-gray-400 ${extraClass}`} />
);
const menu = (
<div className="space-y-1.5 px-2.5 pb-2.5 pt-2">
@@ -255,21 +244,7 @@ export function WorkspaceSelect({
onClick={() => loadDir(entry.path)}
className="flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-xs text-gray-700 transition-colors duration-150 hover:bg-gray-100 disabled:opacity-50 dark:text-gray-300 dark:hover:bg-gray-800"
>
- <svg
- width="13"
- height="13"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- className="shrink-0 text-gray-400"
- aria-hidden
- >
- <path
- d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"
- strokeWidth="1.6"
- strokeLinejoin="round"
- />
- </svg>
+ <GlyphIcon d={FOLDER_ICON} className="text-gray-400" />
<span className="min-w-0 flex-1 truncate" title={entry.name}>
{entry.name}
</span>
diff --git a/packages/web/src/features/models/models-page.tsx b/packages/web/src/features/models/models-page.tsx
index d14b1ef5..c7cf6e8a 100644
--- a/packages/web/src/features/models/models-page.tsx
+++ b/packages/web/src/features/models/models-page.tsx
@@ -99,6 +99,8 @@ import { clearDraftModelRef } from "../chat/draft-cache";
import { syncRowsWithCatalog } from "./catalog-sync";
import { tpsTone, ttftTone } from "./speed-test";
import type { SpeedResult, SpeedTone } from "./speed-test";
+import { toneInk, toneStrip } from "../../lib/tone";
+import { InfoPopover } from "../../components/ui/info-popover";
/** Display currency follows the user setting (pricing is always stored in USD/million tokens; conversion happens only for display and input). */
const CURRENCY_SYMBOL: Record<Currency, string> = { USD: "$", CNY: "¥" };
@@ -154,9 +156,9 @@ const ZAP_ICON = "M13 2 3 14h9l-1 8 10-12h-9l1-8Z";
/** Metric tone -> text color classes for the card speed badges. */
const TONE_CLASS: Record<SpeedTone, string> = {
- green: "text-green-600 dark:text-green-400",
- yellow: "text-amber-600 dark:text-amber-400",
- red: "text-red-600 dark:text-red-400",
+ green: toneInk.success,
+ yellow: toneInk.attention,
+ red: toneInk.danger,
};
/** In-page key for one model's speed result. */
@@ -657,12 +659,10 @@ export function ModelsPage() {
<div className="h-full overflow-y-auto p-4 md:p-6">
<div className="mx-auto max-w-5xl">
<div className="mb-4 flex flex-wrap items-center justify-between gap-2">
- <div>
- <h1 className="text-xl font-semibold">{S.models.title}</h1>
- {!isOwner && (
- <p className="text-xs text-gray-500 dark:text-gray-400">{S.models.readOnlyHint}</p>
- )}
- </div>
+ <h1 className="flex items-center gap-1.5 text-xl font-semibold">
+ {S.models.title}
+ {!isOwner && <InfoPopover label={S.models.title}>{S.models.readOnlyHint}</InfoPopover>}
+ </h1>
{/* The header holds search plus the owner-only "sync presets" action (add-model
entry points live in each group header); on narrow screens (flex-wrap wraps it
to its own line) the search box shrinks flexibly, fixed width at >=sm. */}
@@ -942,10 +942,12 @@ export function ModelsPage() {
</>
}
>
- <label className="block">
+ <div className="block">
<Input
size="sm"
label={S.models.groupNameLabel}
+ info={S.models.addGroupDesc}
+ infoLabel={S.models.groupNameLabel}
required
value={groupName}
invalid={Boolean(groupNameError)}
@@ -961,8 +963,7 @@ export function ModelsPage() {
autoFocus
/>
{groupNameError && <FieldError>{groupNameError}</FieldError>}
- </label>
- <p className="mt-2 text-xs text-gray-500 dark:text-gray-400">{S.models.addGroupDesc}</p>
+ </div>
</Modal>
)}
@@ -1674,7 +1675,7 @@ function ModelDialog({
{autoRouteMiss && (
<div
role="alert"
- className="flex items-center justify-between gap-3 rounded-md border border-amber-200 bg-amber-50 px-2.5 py-2 text-xs text-amber-800 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-300"
+ className={`flex items-center justify-between gap-3 rounded-md border px-2.5 py-2 text-xs ${toneStrip.attention}`}
>
<span>{S.models.autoRouteNone}</span>
<Button
@@ -1838,20 +1839,7 @@ function ModelDialog({
>
{S.models.homepage}
{/* External-link glyph (opens in a new tab) */}
- <svg
- width="12"
- height="12"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- aria-hidden
- className="shrink-0"
- >
- <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14 21 3" />
- </svg>
+ <GlyphIcon d={EXTERNAL_LINK_ICON} />
</a>
)}
</div>
@@ -2295,7 +2283,7 @@ function ModelDialog({
switch is kept visible precisely so it can be turned off, and says why it
should be. */}
{form.fastMode && fastProtocol === undefined && (
- <p className="mt-1 text-xs text-amber-600 dark:text-amber-500">
+ <p className={`mt-1 text-xs ${toneInk.attention}`}>
{S.models.fastModeUnsupported}
</p>
)}
diff --git a/packages/web/src/features/models/protocol-suffix.tsx b/packages/web/src/features/models/protocol-suffix.tsx
index 90a94dab..ad7773fc 100644
--- a/packages/web/src/features/models/protocol-suffix.tsx
+++ b/packages/web/src/features/models/protocol-suffix.tsx
@@ -37,6 +37,7 @@ import { S } from "../../lib/strings";
import { protocolPathForModel } from "./protocol-path";
import { PROTOCOL_CLIENT_TYPES } from "./protocol-types";
import type { ProtocolClientType } from "./protocol-types";
+import { toneInk } from "../../lib/tone";
/** Whether the last detection run left something to warn about (drives the amber trigger). */
export type ProtocolDetectTone = "ok" | "warn" | null;
@@ -86,7 +87,7 @@ export function ProtocolSuffixMenu({
"flex items-center gap-1 rounded px-1 py-0.5 font-mono text-xs transition-colors duration-150 " +
"hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-400/30 dark:hover:bg-gray-800 " +
(tone === "warn"
- ? "text-amber-600 hover:text-amber-700 dark:text-amber-500 dark:hover:text-amber-400"
+ ? `${toneInk.attention} hover:text-amber-700 dark:hover:text-amber-300`
: "text-gray-400 hover:text-gray-700 dark:hover:text-gray-200")
}
>
diff --git a/packages/web/src/features/skills/skills-page.tsx b/packages/web/src/features/skills/skills-page.tsx
index 439de376..2eed27f4 100644
--- a/packages/web/src/features/skills/skills-page.tsx
+++ b/packages/web/src/features/skills/skills-page.tsx
@@ -60,6 +60,8 @@ import { draftKey, loadDraft, saveDraft } from "../chat/draft-cache";
import { parkActiveDraft } from "../chat/draft-sessions";
import { localizedShortText, localizedText } from "../chat/skill-use";
import { SkillIcon, skillTileColor } from "./skill-icon-view";
+import { InfoPopover } from "../../components/ui/info-popover";
+import { ICON_SIZE } from "../../lib/icon-scale";
/** agentId → (installed skill name → installed copy's version); in-page install-state snapshot, rewritten in place by optimistic updates. */
export type InstalledMap = ReadonlyMap<string, ReadonlyMap<string, number>>;
@@ -256,8 +258,10 @@ export function SkillsPage() {
return (
<div className="h-full overflow-y-auto p-4 md:p-6">
<div className="mx-auto max-w-5xl">
- <h1 className="text-xl font-semibold">{S.skills.pageTitle}</h1>
- <p className="mt-1 text-sm text-gray-500 dark:text-gray-400">{S.skills.pageDesc}</p>
+ <h1 className="flex items-center gap-1.5 text-xl font-semibold">
+ {S.skills.pageTitle}
+ <InfoPopover label={S.skills.pageTitle}>{S.skills.pageDesc}</InfoPopover>
+ </h1>
{error ? (
<div className="mt-6 flex items-center gap-3">
@@ -453,7 +457,7 @@ function SkillCard({
title={S.skills.updateOutdated(outdated.length)}
onClick={() => setPendingUpdate(outdated)}
>
- <GlyphIcon d={UPDATE_ICON} size={13} />
+ <GlyphIcon d={UPDATE_ICON} size={ICON_SIZE.iconButton} />
</Button>
)}
<Button
@@ -464,7 +468,7 @@ function SkillCard({
disabled={!canQuickInvoke}
onClick={() => onQuickInvoke(skill.name)}
>
- <GlyphIcon d={SEND_ICON} size={15} />
+ <GlyphIcon d={SEND_ICON} size={ICON_SIZE.iconButton} />
</Button>
<Button
size="sm"
@@ -473,7 +477,7 @@ function SkillCard({
title={S.skills.manageInstall}
onClick={() => setInstallOpen(true)}
>
- <GlyphIcon d={INSTALL_ICON} size={15} />
+ <GlyphIcon d={INSTALL_ICON} size={ICON_SIZE.iconButton} />
</Button>
</div>
{installOpen && (
diff --git a/packages/web/src/features/terminal/terminal-appearance.ts b/packages/web/src/features/terminal/terminal-appearance.ts
index a3890373..50227715 100644
--- a/packages/web/src/features/terminal/terminal-appearance.ts
+++ b/packages/web/src/features/terminal/terminal-appearance.ts
@@ -29,7 +29,11 @@ export interface TerminalChrome {
tabKill: string;
/** Secondary text (a path, an error detail). */
muted: string;
- /** Failure headline. */
+ /** A live/healthy status mark (the header's connection dot). */
+ success: string;
+ /** An in-progress status mark waiting on something. */
+ attention: string;
+ /** Failure headline, and a failed status mark. */
danger: string;
/** Bordered text button (retry, detach on the standalone page). */
outlineButton: string;
@@ -45,6 +49,10 @@ const DARK: TerminalChrome = {
tabIdle: "text-gray-400 hover:bg-gray-800 hover:text-gray-200",
tabKill: "bg-gray-800 hover:bg-gray-700",
muted: "text-gray-400",
+ // The dark halves of the shared status tones (lib/tone.ts); they cannot be written as
+ // `dark:` pairs here for the reason in the file header.
+ success: "text-emerald-400",
+ attention: "text-amber-400",
danger: "text-red-400",
outlineButton: "border-gray-700 text-gray-300 hover:bg-gray-800",
};
@@ -59,6 +67,9 @@ const LIGHT: TerminalChrome = {
tabIdle: "text-gray-500 hover:bg-gray-100 hover:text-gray-800",
tabKill: "bg-gray-100 hover:bg-gray-200",
muted: "text-gray-500",
+ /** The light halves of the shared status tones (lib/tone.ts). */
+ success: "text-emerald-600",
+ attention: "text-amber-600",
danger: "text-red-600",
outlineButton: "border-gray-300 text-gray-600 hover:bg-gray-100",
};
diff --git a/packages/web/src/features/terminal/terminal-dock.tsx b/packages/web/src/features/terminal/terminal-dock.tsx
index 74a80180..d5e38fe6 100644
--- a/packages/web/src/features/terminal/terminal-dock.tsx
+++ b/packages/web/src/features/terminal/terminal-dock.tsx
@@ -56,6 +56,7 @@ import {
terminalViewContainer,
terminalViewState,
} from "./terminal-view-pool";
+import { CloseIcon } from "../../components/ui/icons";
/** The dock always opens new shells in the home directory (project cwd can come later). */
const DOCK_CWD = "~";
@@ -176,16 +177,7 @@ function TerminalTab(props: {
onClick={props.onKill}
className={`absolute right-0.5 top-1/2 -translate-y-1/2 rounded p-0.5 opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-visible:opacity-100 ${chrome.tabKill}`}
>
- <svg
- width="10"
- height="10"
- viewBox="0 0 14 14"
- fill="none"
- stroke="currentColor"
- aria-hidden
- >
- <path d="M2 2l10 10M12 2L2 12" strokeWidth="1.6" strokeLinecap="round" />
- </svg>
+ <CloseIcon size={10} />
</button>
</div>
);
diff --git a/packages/web/src/features/terminal/terminal-page.tsx b/packages/web/src/features/terminal/terminal-page.tsx
index ebbc3292..19e3dbe0 100644
--- a/packages/web/src/features/terminal/terminal-page.tsx
+++ b/packages/web/src/features/terminal/terminal-page.tsx
@@ -149,10 +149,10 @@ export function TerminalPage() {
data-status={status}
className={
status === "ready"
- ? "text-emerald-400"
+ ? chrome.success
: status === "connecting"
- ? "text-amber-400"
- : "text-red-400"
+ ? chrome.attention
+ : chrome.danger
}
>
● {statusText}
diff --git a/packages/web/src/features/traces/traces-page.tsx b/packages/web/src/features/traces/traces-page.tsx
index c0a911e2..70b30fe4 100644
--- a/packages/web/src/features/traces/traces-page.tsx
+++ b/packages/web/src/features/traces/traces-page.tsx
@@ -61,6 +61,7 @@ import {
} from "./trace-sessions";
import type { TraceFileRef, TraceSessionRow } from "./trace-sessions";
import { useTraceTree } from "./use-trace-tree";
+import { ICON_SIZE } from "../../lib/icon-scale";
/**
* Import file size cap, mirroring the server's route-side limit (agent-traces.ts).
@@ -743,7 +744,7 @@ export function TracesPage() {
download
className="inline-flex shrink-0 items-center gap-1 rounded-md border border-gray-200 px-2 py-0.5 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-800 dark:text-gray-400 dark:hover:bg-gray-800/60"
>
- <DownloadIcon size={12} />
+ <DownloadIcon size={ICON_SIZE.rowLead} />
{S.traces.exportFile}
</a>
</div>
diff --git a/packages/web/src/features/usage/errors-panel.tsx b/packages/web/src/features/usage/errors-panel.tsx
index 7e8ab3c2..6d1908ad 100644
--- a/packages/web/src/features/usage/errors-panel.tsx
+++ b/packages/web/src/features/usage/errors-panel.tsx
@@ -17,6 +17,7 @@ import { apiErrorText } from "../../lib/api-error";
import { formatDateTime } from "../../lib/format";
import { Badge } from "../../components/ui/badge";
import { Empty } from "./usage-charts";
+import { toneInk } from "../../lib/tone";
/** The two error categories. */
type ErrorKindKey = "unexpected" | "expected";
@@ -56,7 +57,7 @@ function Stat({
muted?: boolean;
}) {
const tone = alert
- ? "text-rose-600 dark:text-rose-400"
+ ? toneInk.danger
: muted
? "text-gray-500 dark:text-gray-400"
: "text-gray-900 dark:text-gray-100";
diff --git a/packages/web/src/lib/icon-scale.ts b/packages/web/src/lib/icon-scale.ts
new file mode 100644
index 00000000..76b9a68d
--- /dev/null
+++ b/packages/web/src/lib/icon-scale.ts
@@ -0,0 +1,59 @@
+/**
+ * Icon sizes and icon-to-text gaps, named by the role the mark plays rather than by a number.
+ *
+ * Every line icon in the app is drawn on a 24x24 grid at `strokeWidth` 1.7 and rendered through
+ * `components/ui/glyph-icon.tsx`, so the only thing a call site chooses is how big the box is —
+ * and structurally equivalent places must choose the same. Picking a rung by role is what keeps
+ * two list rows, or two menu rows, from drifting a pixel apart.
+ *
+ * The two exceptions to the 24x24 grid are deliberate and stay: `ChevronDown` is drawn on a
+ * 12x12 grid at 1.5, and the close cross on 14x14 at 1.5 — both are two-stroke marks whose
+ * geometry is legible only when the grid matches the render size. Charts, sparklines, the
+ * topology view and the login background draw their own geometry and are outside this scale.
+ */
+
+export const ICON_SIZE = {
+ /** A glyph sitting inline with body or secondary text: stat chips, banner leads, buttons with a label, menu rows. The GlyphIcon default. */
+ inlineGlyph: 13,
+ /** The leading mark of a list row — a session row's agent avatar, a trace row's. */
+ rowLead: 14,
+ /** A glyph alone inside a square icon button, where it has no text to sit against and needs the extra weight. */
+ iconButton: 15,
+ /** A group header's leading glyph (a folder, a new-chat pencil). */
+ groupHeaderGlyph: 15,
+ /** A group header's trailing action buttons, all of which must optically line up with each other. */
+ groupHeaderAction: 16,
+ /** Sidebar navigation rows and the collapsed rail: one rung up from a list row, because a nav entry is the row. */
+ navRow: 16,
+ /**
+ * A group header's leading avatar. One rung above `groupHeaderGlyph` on purpose: an avatar
+ * tile fills its box edge to edge while a line glyph only draws inside it, so matching their
+ * numbers would make the avatar read as the smaller of the two.
+ */
+ groupHeaderAvatar: 18,
+ /** A mark that anchors a whole block rather than a line: the mobile top bar, a confirm dialog's tinted disc. */
+ sectionMark: 18,
+ /** The rotating collapse chevron. */
+ chevron: 14,
+ /** The collapse chevron in a dense row (an 11px folder row, a banner). */
+ chevronDense: 12,
+ /** The downward caret on a form control's trigger. */
+ caret: 12,
+ /** The downward caret on a dense trigger — the composer's 8px-tall pill buttons. */
+ caretDense: 10,
+} as const;
+
+/**
+ * Horizontal gap between an icon and the text it leads. The rungs track text size: a denser row
+ * needs a tighter gap for the pair to read as one unit.
+ */
+export const ICON_GAP = {
+ /** A glyph welded to a number — stat chips, composer chips, mono readouts. */
+ tight: "gap-1",
+ /** A list row: a leading mark, then a title that may truncate. */
+ row: "gap-1.5",
+ /** A menu row, a nav row, a banner: the icon leads, the label is the content. */
+ menu: "gap-2",
+ /** A card row, where the leading mark is an avatar or an illustration rather than a glyph. */
+ card: "gap-3",
+} as const;
diff --git a/packages/web/src/lib/stat-icons.ts b/packages/web/src/lib/stat-icons.ts
index caeaf9d8..9d1ebc7c 100644
--- a/packages/web/src/lib/stat-icons.ts
+++ b/packages/web/src/lib/stat-icons.ts
@@ -25,6 +25,9 @@ export const STAT_ICONS = {
tps: "M5 18a8 8 0 1 1 14 0M12 12l4-3",
/** Elapsed time (clock) */
elapsed: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-14v5l3 2",
+ /** Running background services (server rack: two stacked units, each with an indicator dot) */
+ services:
+ "M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5zm0 11a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3zM7 6.5h.01M7 17.5h.01",
/** Cost (dollar sign in a circle) */
cost: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-15v12m2.6-9.3c-.5-.8-1.5-1.2-2.6-1.2-1.5 0-2.7.8-2.7 2 0 2.7 5.4 1.3 5.4 4 0 1.2-1.2 2-2.7 2-1.2 0-2.2-.5-2.7-1.4",
/** Copy */
diff --git a/packages/web/src/lib/strings-en.ts b/packages/web/src/lib/strings-en.ts
index 5352282a..1aa64827 100644
--- a/packages/web/src/lib/strings-en.ts
+++ b/packages/web/src/lib/strings-en.ts
@@ -168,6 +168,10 @@ export const en: Strings = {
unknownError: "Request failed, please try again later",
requiredField: "This field is required",
copied: "Copied",
+ /** Accessible name of the circled "?" that discloses a section or field explanation. */
+ moreInfo: "More info",
+ /** The same, named for what it explains — so the trigger never repeats the heading it sits in. */
+ moreInfoAbout: (subject: string) => `More info: ${subject}`,
name: "Name",
username: "Username",
role: "Role",
diff --git a/packages/web/src/lib/strings.ts b/packages/web/src/lib/strings.ts
index 73383778..18cd3212 100644
--- a/packages/web/src/lib/strings.ts
+++ b/packages/web/src/lib/strings.ts
@@ -167,6 +167,10 @@ export const zh = {
unknownError: "请求失败,请稍后重试",
requiredField: "此项必填",
copied: "已复制",
+ /** Accessible name of the circled "?" that discloses a section or field explanation. */
+ moreInfo: "说明",
+ /** The same, named for what it explains — so the trigger never repeats the heading it sits in. */
+ moreInfoAbout: (subject: string) => `说明:${subject}`,
name: "名称",
username: "用户名",
role: "角色",
diff --git a/packages/web/src/lib/tone.ts b/packages/web/src/lib/tone.ts
new file mode 100644
index 00000000..7516649c
--- /dev/null
+++ b/packages/web/src/lib/tone.ts
@@ -0,0 +1,108 @@
+/**
+ * Semantic status tones: the one place a status colour is spelled out.
+ *
+ * Every status mark in the app — glyph inks, badge and strip surfaces, the small state dots —
+ * picks a tone by meaning and never writes a palette class of its own. A tone says what the
+ * mark *means*, not which state it belongs to, so two different states legitimately share one
+ * tone and are told apart by shape and motion instead (the chat stream's spinning ring and the
+ * session list's turning hourglass are both live work; one spins, one turns over).
+ *
+ * | tone | meaning |
+ * | ----------- | ----------------------------------------------------------- |
+ * | `busy` | executing right now |
+ * | `attention` | unfinished — waiting on time, on a queue, or on the user |
+ * | `success` | finished well, connected, healthy |
+ * | `danger` | failed, destructive, over a limit |
+ * | `muted` | settled; the mark should recede |
+ *
+ * What does NOT belong here: categorical palettes, where colour is an identity rather than a
+ * judgement — the chart series in `category-colors.ts`, the token buckets in `token-colors.ts`,
+ * the timeline phase bars, the per-skill avatar tints, the terminal theme. Those must stay free
+ * to grow a new hue without it reading as a new severity. Secondary body text
+ * (`text-gray-500 dark:text-gray-400`) is typography, not a status tone, and stays inline too.
+ */
+
+/**
+ * The ink pairs, written once each. `busy` and `success` deliberately resolve to the same
+ * emerald: the app has never distinguished them by colour, and giving them separate hues would
+ * invent a difference the user is not being asked to read.
+ */
+const INK = {
+ emerald: "text-emerald-600 dark:text-emerald-400",
+ amber: "text-amber-600 dark:text-amber-400",
+ red: "text-red-600 dark:text-red-400",
+ gray: "text-gray-400 dark:text-gray-500",
+} as const;
+
+export type Tone = "busy" | "attention" | "success" | "danger" | "muted";
+
+/**
+ * Ink for a glyph or a line of status text. Measured as WCAG 2.x contrast ratios against the
+ * four surfaces these marks actually sit on — white and gray-50 in light (chat surfaces and the
+ * sidebar), and the neutral scale this app overrides in `styles.css` for dark: gray-950 `#000000`
+ * and gray-900 `#0d0d0d`. The lower number of each pair is the sidebar, which is the worse case
+ * in both themes:
+ *
+ * - `busy` / `success` emerald-600 / emerald-400 …… 3.65–3.50 : 1 light, 10.83–10.03 : 1 dark
+ * - `attention` amber-600 / amber-400 ……… 3.20–3.06 : 1 light, 12.19–11.28 : 1 dark
+ * - `danger` red-600 / red-400 …………… 4.77–4.56 : 1 light, 7.27–6.73 : 1 dark
+ * - `muted` gray-400 / gray-500 ……… 2.60–2.49 : 1 light, 4.34–4.02 : 1 dark
+ *
+ * The first three clear the 3:1 that WCAG 1.4.11 asks of a graphical object in both themes.
+ * `muted` does not, and is the one tone that may only mark a state already spelled out in
+ * adjacent text or in the mark's own accessible name — receding is its entire job.
+ */
+export const toneInk: Record<Tone, string> = {
+ busy: INK.emerald,
+ attention: INK.amber,
+ success: INK.emerald,
+ danger: INK.red,
+ muted: INK.gray,
+};
+
+const SURFACE = {
+ emerald: "bg-emerald-50 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300",
+ amber: "bg-amber-50 text-amber-700 dark:bg-amber-950 dark:text-amber-300",
+ red: "bg-red-50 text-red-700 dark:bg-red-950 dark:text-red-300",
+ gray: "bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-300",
+} as const;
+
+/** Tinted background plus its own readable text: badges, pills, and the soft notice strips. */
+export const toneSurface: Record<Tone, string> = {
+ busy: SURFACE.emerald,
+ attention: SURFACE.amber,
+ success: SURFACE.emerald,
+ danger: SURFACE.red,
+ muted: SURFACE.gray,
+};
+
+/**
+ * Fill for the 6px state dots. One value across both themes on purpose: a solid dot this small
+ * has no interior to read, so it needs a mid-scale hue that stays vivid on a white and on a
+ * black surface rather than an ink pair tuned for stroke weight. Each dot is accompanied by a
+ * label or folded into its row's accessible name, so the fill is never the only carrier.
+ */
+export const toneDot: Record<Tone, string> = {
+ busy: "bg-emerald-500",
+ attention: "bg-amber-500",
+ success: "bg-emerald-500",
+ danger: "bg-red-500",
+ muted: "bg-gray-400 dark:bg-gray-600",
+};
+
+/**
+ * Border plus tinted background for the bordered notice strips (the degraded-mode banner, the
+ * missing-placeholder alerts): a heavier treatment than `toneSurface`, for a notice that owns a
+ * whole row rather than sitting inside one.
+ */
+export const toneStrip: Record<Tone, string> = {
+ busy: "border-emerald-300 bg-emerald-50 text-emerald-800 dark:border-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300",
+ attention:
+ "border-amber-300 bg-amber-50 text-amber-800 dark:border-amber-700 dark:bg-amber-950/40 dark:text-amber-300",
+ success:
+ "border-emerald-300 bg-emerald-50 text-emerald-800 dark:border-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300",
+ danger:
+ "border-red-300 bg-red-50 text-red-800 dark:border-red-700 dark:bg-red-950/40 dark:text-red-300",
+ muted:
+ "border-gray-200 bg-gray-50 text-gray-600 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400",
+};
diff --git a/packages/web/src/styles.css b/packages/web/src/styles.css
index 529cb4dd..9e88e103 100644
--- a/packages/web/src/styles.css
+++ b/packages/web/src/styles.css
@@ -338,11 +338,11 @@
animation: title-scroll-reveal var(--title-scroll-ms, 0ms) linear 0.3s forwards;
}
-/* Busy hourglass (session-activity-icon.tsx: the running and compacting glyphs). An hourglass
- does not spin — it gets turned over — so this holds the glyph still, flips it 180 degrees in
- ~360ms, holds again, and flips back. The long dwell is what makes it legible at the 12px the
- sidebar renders it at: a continuous spin at that size reads as a smudge, while two deliberate
- turns per cycle read as "still working" even out of the corner of the eye.
+/* Busy hourglass (session-activity-icon.tsx: the running glyph). An hourglass does not spin —
+ it gets turned over — so this holds the glyph still, flips it 180 degrees in ~360ms, holds
+ again, and flips back. The long dwell is what makes it legible at the 12px the sidebar renders
+ it at: a continuous spin at that size reads as a smudge, while two deliberate turns per cycle
+ read as "still working" even out of the corner of the eye.
`transform` is the only thing the keyframes touch and the at-rest glyph has none, so the
global `animation: none !important` below is a free no-op here: the hourglass simply stands
@@ -364,6 +364,24 @@
animation: hourglass-turn 3s ease-in-out infinite;
}
+/* Compacting squeeze (session-activity-icon.tsx: the compress glyph). Compaction pushes a
+ context down to a summary, so its mark closes on its own centre bar and springs back rather
+ than turning: the two live session states then differ by motion as well as by shape, which is
+ what lets them share one tone. Same reduced-motion property as the hourglass — `transform`
+ only, so disabling animation leaves the mark at full size and fully legible. */
+@keyframes compact-squeeze {
+ 0%,
+ 100% {
+ transform: scaleY(1);
+ }
+ 50% {
+ transform: scaleY(0.62);
+ }
+}
+.compact-squeeze {
+ animation: compact-squeeze 1.8s ease-in-out infinite;
+}
+
/* Login page circuit traces (login-circuit.tsx): pathLength=1 normalization, draw-in -> hold -> fade-out
loop. Base state is fully hidden: the positive animation-delay wait keeps the first paint blank, and
lines only start growing after load; once reduced-motion globally disables animation, the override below
@@ -434,8 +452,9 @@
entirely by the `title-scroll-reveal` keyframes above — including the inline-block
that makes the text transformable at all — so `animation: none` leaves the title
exactly as it renders at rest, ellipsis and `title` tooltip included. */
- /* Nor does the busy hourglass (#291): its keyframes only rotate, so disabling them
- leaves the glyph upright and fully visible — still present, just not turning. */
+ /* Nor do the two busy session glyphs (#291): their keyframes only rotate and scale, so
+ disabling them leaves the hourglass upright and the compress mark at full height — both
+ still present, just not moving. */
}
/* ---------- Minimal typography for Markdown body content (no typography plugin) ---------- */
diff --git a/packages/web/test/disclosure-anchor.test.ts b/packages/web/test/disclosure-anchor.test.ts
new file mode 100644
index 00000000..b6f72e4a
--- /dev/null
+++ b/packages/web/test/disclosure-anchor.test.ts
@@ -0,0 +1,150 @@
+/**
+ * The rule that decides which disclosure a site gets (src/components/ui/info-popover.tsx and
+ * help-fold.tsx): **the circled "?" may only appear beside a title.**
+ *
+ * A "?" is an anchored mark — it reads as help because it modifies the title next to it. Standing
+ * alone at the top of a panel it modifies nothing, and a reader has to click it to find out what
+ * it even refers to. Where there is no title, the disclosure has to name itself, which is what
+ * `HelpFold` is for.
+ *
+ * This is a rule rather than a preference, so it is checked rather than remembered. The check
+ * parses the real JSX with the TypeScript parser instead of matching text: whether a title sits
+ * beside a "?" is a question about sibling nodes, and a regex cannot see siblings.
+ */
+import { describe, expect, it } from "vitest";
+import { readdirSync, readFileSync, statSync } from "node:fs";
+import { join, sep } from "node:path";
+import { fileURLToPath } from "node:url";
+import ts from "typescript";
+
+const SRC = fileURLToPath(new URL("../src", import.meta.url));
+
+/** Components whose whole job is to render a field's or a section's title. */
+const TITLE_ELEMENTS = new Set(["FieldLabel"]);
+
+function tsxFiles(dir = SRC, out: string[] = []): string[] {
+ for (const name of readdirSync(dir)) {
+ const path = join(dir, name);
+ if (statSync(path).isDirectory()) tsxFiles(path, out);
+ else if (name.endsWith(".tsx")) out.push(path);
+ }
+ return out;
+}
+
+const jsxTag = (node: ts.Node): string | null => {
+ if (ts.isJsxSelfClosingElement(node)) return node.tagName.getText();
+ if (ts.isJsxElement(node)) return node.openingElement.tagName.getText();
+ return null;
+};
+
+/**
+ * Does this sibling put a title on screen? Text and an interpolated expression both do. A nested
+ * element does only when it is one of the title components — a `<Button>` beside a "?" is not a
+ * title, it is just another control sharing the row.
+ */
+function rendersTitle(node: ts.Node): boolean {
+ if (ts.isJsxText(node)) return node.text.trim() !== "";
+ // `{/* a comment */}` parses as a JsxExpression with no expression: it renders nothing.
+ if (ts.isJsxExpression(node)) return node.expression !== undefined;
+ const tag = jsxTag(node);
+ return tag !== null && TITLE_ELEMENTS.has(tag);
+}
+
+/**
+ * The JSX child slot this node occupies, and the element holding it. A "?" is often wrapped in a
+ * conditional (`{!isOwner && <InfoPopover …/>}`), so the slot is the outermost node whose own
+ * parent is the enclosing element, not the "?" itself.
+ */
+function slotIn(node: ts.Node): { host: ts.JsxElement | ts.JsxFragment; slot: ts.Node } | null {
+ let slot: ts.Node = node;
+ while (slot.parent !== undefined) {
+ const host = slot.parent;
+ if (ts.isJsxElement(host) || ts.isJsxFragment(host)) return { host, slot };
+ slot = host;
+ }
+ return null;
+}
+
+/** Every `<InfoPopover>` in the tree that has no title among its preceding siblings. */
+function findOrphans(): string[] {
+ const orphans: string[] = [];
+ for (const path of tsxFiles()) {
+ const source = ts.createSourceFile(
+ path,
+ readFileSync(path, "utf8"),
+ ts.ScriptTarget.Latest,
+ /* setParentNodes */ true,
+ ts.ScriptKind.TSX,
+ );
+ const visit = (node: ts.Node): void => {
+ if (jsxTag(node) === "InfoPopover") {
+ const here = slotIn(node);
+ const anchored =
+ here !== null &&
+ here.host.children
+ .slice(0, here.host.children.indexOf(here.slot as never))
+ .some(rendersTitle);
+ if (!anchored) {
+ const line = source.getLineAndCharacterOfPosition(node.getStart(source)).line + 1;
+ orphans.push(`${path.slice(SRC.length + 1).replaceAll(sep, "/")}:${line}`);
+ }
+ }
+ ts.forEachChild(node, visit);
+ };
+ visit(source);
+ }
+ return orphans.sort();
+}
+
+describe("disclosure anchoring", () => {
+ it("never leaves an InfoPopover standing without a title beside it", () => {
+ expect(
+ findOrphans(),
+ 'A circled "?" must sit after a title. Where the surface has no title — an Agent settings ' +
+ "tab, whose name lives in the tab bar — use HelpFold (components/ui/help-fold.tsx) instead.",
+ ).toEqual([]);
+ });
+
+ it("actually looks at siblings — the check itself is exercised on a known-orphan shape", () => {
+ // Guards the guard: if `rendersTitle`/`slotIn` ever stopped seeing structure, the assertion
+ // above would pass on broken code. These are the four shapes that matter.
+ const parse = (jsx: string) =>
+ ts.createSourceFile(
+ "t.tsx",
+ `const x = ${jsx};`,
+ ts.ScriptTarget.Latest,
+ true,
+ ts.ScriptKind.TSX,
+ );
+ const anchoredOf = (jsx: string): boolean => {
+ const source = parse(jsx);
+ let result = false;
+ const visit = (node: ts.Node): void => {
+ if (jsxTag(node) === "InfoPopover") {
+ const here = slotIn(node);
+ result =
+ here !== null &&
+ here.host.children
+ .slice(0, here.host.children.indexOf(here.slot as never))
+ .some(rendersTitle);
+ }
+ ts.forEachChild(node, visit);
+ };
+ visit(source);
+ return result;
+ };
+ // A title beside it, plain and interpolated, and through a conditional wrapper.
+ expect(anchoredOf("<h1>Vault<InfoPopover>d</InfoPopover></h1>")).toBe(true);
+ expect(anchoredOf("<h1>{title}<InfoPopover>d</InfoPopover></h1>")).toBe(true);
+ expect(anchoredOf("<h1>{title}{ok && <InfoPopover>d</InfoPopover>}</h1>")).toBe(true);
+ expect(
+ anchoredOf("<span><FieldLabel>{l}</FieldLabel><InfoPopover>d</InfoPopover></span>"),
+ ).toBe(true);
+ // Alone in a stack; preceded only by a comment; and beside a control that is not a title.
+ expect(anchoredOf('<div className="space-y-4"><InfoPopover>d</InfoPopover></div>')).toBe(false);
+ expect(anchoredOf("<div>{/* why */}<InfoPopover>d</InfoPopover></div>")).toBe(false);
+ expect(anchoredOf("<div><InfoPopover>d</InfoPopover><Button>Import</Button></div>")).toBe(
+ false,
+ );
+ });
+});
diff --git a/packages/web/test/help-fold.test.ts b/packages/web/test/help-fold.test.ts
new file mode 100644
index 00000000..537ad027
--- /dev/null
+++ b/packages/web/test/help-fold.test.ts
@@ -0,0 +1,52 @@
+/**
+ * The inline help fold (src/components/ui/help-fold.tsx): the disclosure a surface uses when it
+ * has no title for a circled "?" to anchor to. `test/disclosure-anchor.test.ts` enforces when to
+ * reach for it; this covers what it renders.
+ */
+import { describe, expect, it } from "vitest";
+import { createElement } from "react";
+import { renderToStaticMarkup } from "react-dom/server";
+import { HelpFold } from "../src/components/ui/help-fold";
+import { S } from "../src/lib/strings";
+
+const DESC = "The vault stores values that commands can read at run time.";
+
+describe("HelpFold", () => {
+ const html = renderToStaticMarkup(createElement(HelpFold, { children: DESC }));
+
+ it("is a real button that starts collapsed and controls its panel", () => {
+ expect(html).toContain("<button");
+ expect(html).toContain('type="button"');
+ expect(html).toContain('aria-expanded="false"');
+ const controls = /aria-controls="([^"]+)"/.exec(html);
+ expect(controls, "the trigger must name the panel it opens").not.toBeNull();
+ // Unlike the portaled popover, the panel is a real node in flow at all times, so the id the
+ // trigger points at always resolves — the WAI-ARIA disclosure pattern.
+ expect(html).toContain(`id="${controls?.[1]}"`);
+ });
+
+ it("hides the explanation until it is asked for", () => {
+ // `hidden` rather than absent: the text must not show up uninvited, and must not be found by
+ // find-in-page while folded, but the panel node itself has to stay for aria-controls.
+ expect(html).toMatch(/<div id="[^"]+" hidden/);
+ expect(html).toContain(DESC);
+ });
+
+ it("names itself, since it has no title beside it to borrow meaning from", () => {
+ expect(html).toContain(S.common.moreInfo);
+ });
+
+ it("rotates the app's one collapse chevron rather than inventing an indicator", () => {
+ // chevron.tsx's glyph and its 90-degree rotation; every other collapsible in the app uses it.
+ expect(html).toContain('d="M9 5l7 7-7 7"');
+ expect(html).not.toContain("rotate-90");
+ });
+
+ it("folds the subject into the accessible name, keeping the visible text a prefix of it", () => {
+ // WCAG "label in name": a voice-control user must be able to say what they can see.
+ const named = renderToStaticMarkup(createElement(HelpFold, { label: "Vault", children: DESC }));
+ const accessible = S.common.moreInfoAbout("Vault");
+ expect(named).toContain(`aria-label="${accessible}"`);
+ expect(accessible.startsWith(S.common.moreInfo)).toBe(true);
+ });
+});
diff --git a/packages/web/test/icon-scale.test.ts b/packages/web/test/icon-scale.test.ts
new file mode 100644
index 00000000..e778945a
--- /dev/null
+++ b/packages/web/test/icon-scale.test.ts
@@ -0,0 +1,79 @@
+/**
+ * The icon family (src/lib/icon-scale.ts and the renderers in components/ui).
+ *
+ * These are source scans rather than render assertions, because the thing that decays is not any
+ * one component's output — it is a new inline `<svg>` re-drawing a glyph the app already owns, at
+ * a stroke weight nobody chose. The three paths asserted below each used to exist in five or six
+ * hand-typed copies.
+ */
+import { describe, expect, it } from "vitest";
+import { readdirSync, readFileSync, statSync } from "node:fs";
+import { join, sep } from "node:path";
+import { fileURLToPath } from "node:url";
+import { ICON_GAP, ICON_SIZE } from "../src/lib/icon-scale";
+
+const SRC = fileURLToPath(new URL("../src", import.meta.url));
+
+function sources(dir = SRC, out: string[] = []): string[] {
+ for (const name of readdirSync(dir)) {
+ const path = join(dir, name);
+ if (statSync(path).isDirectory()) sources(path, out);
+ else if (name.endsWith(".ts") || name.endsWith(".tsx")) out.push(path);
+ }
+ return out;
+}
+
+// Forward slashes whatever the platform separator is, so the expected paths below read the same
+// on Windows as they do everywhere else.
+const FILES = sources().map(
+ (path) => [path.slice(SRC.length + 1).replaceAll(sep, "/"), readFileSync(path, "utf8")] as const,
+);
+
+/** Every occurrence of `needle`, as "relative/path:count". */
+const occurrences = (needle: string) =>
+ FILES.filter(([, src]) => src.includes(needle)).map(([rel]) => rel);
+
+describe("icon scale", () => {
+ it("names every rung with a whole pixel value", () => {
+ for (const [role, size] of Object.entries(ICON_SIZE)) {
+ expect(Number.isInteger(size), `${role} must be a whole pixel`).toBe(true);
+ expect(size).toBeGreaterThan(8);
+ expect(size).toBeLessThan(33);
+ }
+ });
+
+ it("keeps the gap rungs in ascending order, as the text sizes they track are", () => {
+ expect(Object.values(ICON_GAP)).toEqual(["gap-1", "gap-1.5", "gap-2", "gap-3"]);
+ });
+});
+
+describe("one glyph, one home", () => {
+ it("draws the form-control caret in exactly one place", () => {
+ expect(occurrences("M3 4.5l3 3 3-3")).toEqual(["components/ui/icons.tsx"]);
+ });
+
+ it("draws the close cross in exactly one place", () => {
+ expect(occurrences("M2 2l10 10M12 2L2 12")).toEqual(["components/ui/icons.tsx"]);
+ });
+
+ it("draws the collapse chevron in exactly one place", () => {
+ expect(occurrences("M9 5l7 7-7 7")).toEqual(["components/ui/chevron.tsx"]);
+ });
+});
+
+describe("stroke weights", () => {
+ it("uses no weight outside the ones the family actually chose", () => {
+ // 1.7 is the 24x24 line family; 1.5 belongs to the two marks drawn on their own smaller
+ // grids (the caret and the close cross) and to chart rules; 2 is the checkmark, the ring
+ // gauges and the send arrow on a filled button; 2.2 is the collapse chevron alone; 1 is the
+ // login background art. Anything else — a 1.6 or a 1.8 — is a glyph nobody sized on purpose.
+ const allowed = new Set(["1", "1.5", "1.7", "2", "2.2"]);
+ const strays: string[] = [];
+ for (const [rel, src] of FILES) {
+ for (const m of src.matchAll(/strokeWidth="([0-9.]+)"/g)) {
+ if (!allowed.has(m[1] ?? "")) strays.push(`${rel}: ${m[1]}`);
+ }
+ }
+ expect(strays).toEqual([]);
+ });
+});
diff --git a/packages/web/test/info-popover.test.ts b/packages/web/test/info-popover.test.ts
new file mode 100644
index 00000000..bdd9e206
--- /dev/null
+++ b/packages/web/test/info-popover.test.ts
@@ -0,0 +1,85 @@
+/**
+ * The "?" disclosure (src/components/ui/info-popover.tsx) and the field layout it forces.
+ *
+ * The trap these guard is HTML's, not React's: an info trigger is a `<button>`, a `<button>` is
+ * a labelable element, and a wrapping `<label>` names its FIRST labelable descendant. Nesting a
+ * trigger inside `Field`'s usual `<label>` wrapper would therefore retarget the field's title
+ * from the input to the "?" — silently, with no visual symptom.
+ */
+import { describe, expect, it } from "vitest";
+import { createElement } from "react";
+import { renderToStaticMarkup } from "react-dom/server";
+import { InfoPopover } from "../src/components/ui/info-popover";
+import { Field } from "../src/components/ui/field";
+import { Input } from "../src/components/ui/input";
+import { S } from "../src/lib/strings";
+
+describe("InfoPopover", () => {
+ const html = renderToStaticMarkup(
+ createElement(InfoPopover, { children: "Values take effect from the next task." }),
+ );
+
+ it("is a real button carrying an accessible name", () => {
+ expect(html).toContain("<button");
+ expect(html).toContain('type="button"');
+ expect(html).toContain(`aria-label="${S.common.moreInfo}"`);
+ expect(html).toContain(`title="${S.common.moreInfo}"`);
+ });
+
+ it("starts collapsed, and points at the panel it will open", () => {
+ expect(html).toContain('aria-expanded="false"');
+ expect(html).toMatch(/aria-controls="[^"]+"/);
+ // The panel is portaled and only mounted while open, so nothing of the text is in the tree.
+ expect(html).not.toContain("Values take effect");
+ expect(html).not.toContain('role="tooltip"');
+ });
+
+ it("folds the subject into its name rather than repeating it", () => {
+ // A trigger inside a heading would otherwise make that heading announce its own title twice.
+ const named = renderToStaticMarkup(
+ createElement(InfoPopover, { label: "Vault", children: "x" }),
+ );
+ expect(named).toContain(`aria-label="${S.common.moreInfoAbout("Vault")}"`);
+ expect(named).not.toContain('aria-label="Vault"');
+ });
+});
+
+describe("Field with an info popover", () => {
+ const withInfo = renderToStaticMarkup(
+ createElement(Input, {
+ label: "Timeout",
+ info: "Per-request timeout.",
+ hint: "milliseconds",
+ value: "",
+ readOnly: true,
+ }),
+ );
+
+ it("associates the title by htmlFor instead of wrapping the control", () => {
+ const forMatch = /<label for="([^"]+)"/.exec(withInfo);
+ expect(forMatch, "the title must be a <label for=…>").not.toBeNull();
+ expect(withInfo).toContain(`id="${forMatch?.[1]}"`);
+ });
+
+ it("never puts the trigger inside a label element", () => {
+ // Everything between a <label> open tag and its close must be free of <button>.
+ for (const [, inner] of withInfo.matchAll(/<label\b[^>]*>([\s\S]*?)<\/label>/g)) {
+ expect(inner).not.toContain("<button");
+ }
+ });
+
+ it("keeps a formatting hint visible alongside the disclosed semantics", () => {
+ // The split is the whole point: what the field MEANS is disclosed, what shape the value must
+ // take stays on screen while the user types.
+ expect(withInfo).toContain("milliseconds");
+ expect(withInfo).not.toContain("Per-request timeout.");
+ });
+
+ it("keeps the plain wrapping-label layout when there is no info", () => {
+ const plain = renderToStaticMarkup(
+ createElement(Field, { label: "Name", children: createElement("input", {}) }),
+ );
+ expect(plain.startsWith("<label")).toBe(true);
+ expect(plain).not.toContain("<label for=");
+ });
+});
diff --git a/packages/web/test/session-activity.test.ts b/packages/web/test/session-activity.test.ts
index a37a45b2..f0fdb920 100644
--- a/packages/web/test/session-activity.test.ts
+++ b/packages/web/test/session-activity.test.ts
@@ -9,6 +9,7 @@ import {
sessionActivityLabel,
} from "../src/components/ui/session-activity-icon";
import { S } from "../src/lib/strings";
+import { toneInk } from "../src/lib/tone";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
@@ -57,8 +58,10 @@ describe("SessionActivityIcon", () => {
const render = (activity: Activity) =>
renderToStaticMarkup(createElement(SessionActivityIcon, { activity }));
- it("draws one hourglass for both busy states", () => {
- expect(ACTIVITY_GLYPH.compacting).toBe(ACTIVITY_GLYPH.running);
+ it("draws a different shape for each busy state", () => {
+ // Running and compacting share one tone, so the shape is what separates them: with the same
+ // path they would be one glyph in two states nobody can tell apart.
+ expect(ACTIVITY_GLYPH.compacting).not.toBe(ACTIVITY_GLYPH.running);
for (const activity of ["running", "compacting"] as const) {
expect(render(activity)).toContain(`d="${ACTIVITY_GLYPH[activity]}"`);
}
@@ -75,8 +78,8 @@ describe("SessionActivityIcon", () => {
expect(sessionActivityLabel("running")).toBe(S.chat.statusRunning);
expect(sessionActivityLabel("compacting")).toBe(S.chat.statusCompacting);
expect(sessionActivityLabel("completedUnread")).toBe(S.chat.statusCompletedUnread);
- // Three states, three different names: the compacting/running pair differs only in colour
- // on screen, so nothing may be distinguishable by colour alone to a screen reader.
+ // Three states, three different names: the on-screen marks carry no text, so nothing may be
+ // distinguishable by shape or colour alone to a screen reader.
expect(new Set(ACTIVITIES.map(sessionActivityLabel)).size).toBe(ACTIVITIES.length);
for (const activity of ACTIVITIES) {
expect(render(activity)).toContain(`aria-label="${sessionActivityLabel(activity)}"`);
@@ -99,17 +102,21 @@ describe("SessionActivityIcon", () => {
expect(render("completedUnread")).toContain('role="img"');
});
- it("turns the hourglass while busy and leaves the dot still", () => {
+ it("gives each busy state its own motion and leaves the dot still", () => {
expect(render("running")).toContain("hourglass-turn");
- expect(render("compacting")).toContain("hourglass-turn");
- expect(render("completedUnread")).not.toContain("hourglass-turn");
+ expect(render("compacting")).toContain("compact-squeeze");
+ expect(render("compacting")).not.toContain("hourglass-turn");
+ const unread = render("completedUnread");
+ expect(unread).not.toContain("hourglass-turn");
+ expect(unread).not.toContain("compact-squeeze");
});
- it("keeps the two busy states apart by ink, since shape cannot separate them", () => {
- expect(render("running")).toContain("text-gray-500");
- expect(render("running")).toContain("dark:text-gray-400");
- expect(render("compacting")).toContain("text-amber-600");
- expect(render("compacting")).toContain("dark:text-amber-400");
+ it("inks both busy states with the shared attention tone", () => {
+ // Unfinished work waiting on time is one meaning, so it is one colour app-wide; the split
+ // between running and compacting is carried by shape and motion, asserted above.
+ for (const activity of ["running", "compacting"] as const) {
+ expect(render(activity)).toContain(toneInk.attention);
+ }
});
it("draws the dot in the Session status dot's own emerald and geometry", () => {
diff --git a/packages/web/test/tone.test.ts b/packages/web/test/tone.test.ts
new file mode 100644
index 00000000..09ea4589
--- /dev/null
+++ b/packages/web/test/tone.test.ts
@@ -0,0 +1,77 @@
+/**
+ * The semantic status tones (src/lib/tone.ts) and the call sites that must not spell a status
+ * colour themselves. What these assert is the *single spelling* rule: one meaning, one pair of
+ * classes, written in one module — the drift these replaced was amber appearing as `amber-600`
+ * in one file and `amber-500` in the next for the same "waiting" state.
+ */
+import { describe, expect, it } from "vitest";
+import { readFileSync } from "node:fs";
+import { fileURLToPath } from "node:url";
+import { toneDot, toneInk, toneStrip, toneSurface } from "../src/lib/tone";
+import type { Tone } from "../src/lib/tone";
+
+const TONES: Tone[] = ["busy", "attention", "success", "danger", "muted"];
+
+const read = (rel: string) =>
+ readFileSync(fileURLToPath(new URL(`../src/${rel}`, import.meta.url)), "utf8");
+
+describe("tone tokens", () => {
+ it("covers every tone in every map", () => {
+ for (const map of [toneInk, toneSurface, toneDot, toneStrip]) {
+ for (const tone of TONES) expect(map[tone]).toBeTruthy();
+ expect(Object.keys(map).sort()).toEqual([...TONES].sort());
+ }
+ });
+
+ it("gives each ink a light and a dark class", () => {
+ for (const tone of TONES) {
+ const classes = toneInk[tone].split(" ");
+ expect(classes.filter((c) => c.startsWith("text-"))).toHaveLength(1);
+ expect(classes.filter((c) => c.startsWith("dark:text-"))).toHaveLength(1);
+ }
+ });
+
+ it("keeps busy and success on one ink, and every other pair distinct", () => {
+ // Busy and success share a hue because the app has never told them apart by colour; a
+ // separate hue would invent a difference nobody is being asked to read.
+ expect(toneInk.busy).toBe(toneInk.success);
+ expect(new Set([toneInk.attention, toneInk.danger, toneInk.muted, toneInk.busy]).size).toBe(4);
+ });
+
+ it("fills a state dot with one value across both themes", () => {
+ // A 6px dot has no interior to read: one vivid mid-scale hue works on white and on black,
+ // where an ink pair tuned for a stroke does not. Muted is the exception — it must recede.
+ for (const tone of ["busy", "attention", "success", "danger"] as const) {
+ expect(toneDot[tone]).toMatch(/^bg-[a-z]+-500$/);
+ }
+ });
+});
+
+describe("status marks take their colour from the tokens", () => {
+ it("inks the two hourglass states with the same attention tone", () => {
+ // The session list's running glyph and the stream's waiting-for-approval glyph are the same
+ // state to a reader — unfinished, waiting — so they are the same colour.
+ expect(read("components/ui/status-icon.tsx")).toContain("waiting: toneInk.attention");
+ expect(read("components/ui/session-activity-icon.tsx")).toContain("toneInk.attention");
+ });
+
+ it("leaves no status file spelling a palette class of its own", () => {
+ // Categorical palettes (charts, per-skill tints, the terminal's own theme) are deliberately
+ // out of scope and are not listed here.
+ const files = [
+ "components/ui/status-icon.tsx",
+ "components/ui/session-activity-icon.tsx",
+ "components/ui/badge.tsx",
+ "features/chat/step-banner.tsx",
+ "features/chat/goal-banner.tsx",
+ "features/chat/subagent-chip.tsx",
+ ];
+ for (const rel of files) {
+ const src = read(rel);
+ // badge.tsx keeps one deliberate exception, a yellow informational tag that must not read
+ // as a warning; it says so at the definition.
+ const offenders = [...src.matchAll(/\b(?:text|bg|border)-(?:amber|emerald|red|green)-\d+/g)];
+ expect(offenders, `${rel} spells a status colour inline`).toHaveLength(0);
+ }
+ });
+});