Skip to content

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

refactor(web): a button takes the rung of what it stands beside (#699)

Yaowei Zheng406f84ec9bb2
diff --git a/.agents/skills/penguin-harness-frontend/SKILL.md b/.agents/skills/penguin-harness-frontend/SKILL.md
index 9c202af8..84e3bd67 100644
--- a/.agents/skills/penguin-harness-frontend/SKILL.md
+++ b/.agents/skills/penguin-harness-frontend/SKILL.md
@@ -162,18 +162,28 @@ Every control defaults to `sm` so a forgotten prop lands where its neighbours al
surfaces are outside the family entirely: the chat composer is `text-base` because it holds prose,
the file editor `font-mono text-xs` because it holds code.
-**A dialog's fields and its buttons share the small rung.** `Button` defaults to `md`
-(`text-sm px-3 py-1.5`), which is the page rung — a header's "New model", an empty state's action —
-so a `Modal` footer passes `size="sm"` on every button, as `ConfirmModal` always did. `Modal` owns
-the footer's wrapper but not the buttons inside it, so this cannot be set in one place; a Button in
-a dialog *body* takes `sm` too, next to the fields it belongs with.
+**A button takes the rung of whatever it stands beside.** `Button` defaults to `md`
+(`text-sm px-3 py-1.5`), the page rung, and that is for an action standing on its own: an empty
+state's, the login card's submit, a list's "add a custom model". Wherever a button sits next to form
+controls it takes theirs — `sm`:
+
+- a `Modal` footer, on every button, as `ConfirmModal` always did. `Modal` owns the footer's wrapper
+ but not the buttons inside it, so this cannot be set in one place.
+- a dialog *body*, next to the fields it belongs with. The settings dialog's pages are separate
+ modules and nothing in one says it renders inside a Modal, which is how four of them kept the `md`
+ default and stood a rung above their own fields.
+- a page header's toolbar that also holds a search box. The Models and Agents headers pair an
+ `Input size="sm"` with a `size="sm"` action in the same `min-w-0 flex-1 sm:w-56 sm:flex-none`
+ shape; a `md` button beside a `sm` box reads as a mistake rather than as emphasis.
`test/control-size.test.ts` parses the JSX and fails, naming file and line, on a font-size class in
a `className` passed to `Input` / `Textarea` / `Select` / `OptionMenu` / `PasswordInput` /
-`FormPicker`, on a `Modal` footer Button that does not ask for `sm`, and on a font size spelled in
-a control module outside the two records. Its reach is what a parser sees without types: a footer
-handed over as a component or built in a variable, and a Button in a dialog body, follow the same
-rule but are on you.
+`FormPicker`, on a `Modal` footer Button that does not ask for `sm`, on a Button in one of the
+declared dialog-body modules (`DIALOG_BODY_MODULES`, the settings dialog's pages) that does not ask
+for `sm`, and on a font size spelled in a control module outside the two records. Its reach is what
+a parser sees without types: a footer handed over as a component or built in a variable, and a
+dialog body outside those declared modules, follow the same rule but are on you. Adding a module to
+`DIALOG_BODY_MODULES` is how a new settings page joins the check.
## Every user-facing string is bilingual
diff --git a/changelog/unreleased/2026-09-11-control-unification.md b/changelog/unreleased/2026-09-11-control-unification.md
new file mode 100644
index 00000000..8f41de4d
--- /dev/null
+++ b/changelog/unreleased/2026-09-11-control-unification.md
@@ -0,0 +1,42 @@
+# Buttons take the rung of what they stand beside, and the menu search box gets a record
+
+- **Date:** 2026-09-11
+- **Type:** fix
+- **Scope:** `web`
+- **PR:** [#699](https://github.com/Prism-Shadow/penguin-harness/pull/699)
+
+[中文版](2026-09-11-control-unification.zh.md)
+
+A second pass over the form controls, on the rule
+[#689](https://github.com/Prism-Shadow/penguin-harness/pull/689) set: a size comes from one record,
+and the rule is checked rather than remembered.
+
+## Details
+
+- Four buttons in the settings dialog stood a rung above the fields beside them — Account's "change
+ password", Proxy's and Uploads' "save", and the admin Users page's "create". All four are dialog
+ *body* buttons, which #689's rule already put on `sm`; they kept `Button`'s `md` default because
+ nothing checked them. `control-size.test.ts` now names the settings dialog's pages in
+ `DIALOG_BODY_MODULES` and fails on a Button in one of them that does not ask for `sm`.
+- The Agents page header gained a search box — name, id and description, case-insensitive — in the
+ Models page header's shape: the same `flex-wrap` title row, the same
+ `min-w-0 flex-1 sm:w-56 sm:flex-none` box, the same `Input size="sm"`. Its create action drops
+ from `md` to `sm` so it reads at the size of the box beside it. An empty result says so rather
+ than reading as "no agents".
+- The Models page's "sync presets" action appears only while a sync is waiting, in the accent. A
+ sync with nothing to sync is a no-op, and the permanent button spent the header's width on one.
+ The update dot goes with it: it marked this button as the end of the models trail, and on a
+ button that exists only when the trail does, it would be lit every time it was seen.
+- The four raw `<input>` search boxes that do not go through `Input` — the model picker, the Skill
+ picker, the Workspace browser and the machines picker — read `menuSearchClass` or
+ `panelSearchClass` from `components/ui/input.tsx` instead of each spelling its own look. The four
+ copies had drifted apart on radius, padding, focus colour and whether the border transitions at
+ all. Padding stays with the caller, the one thing that legitimately differs.
+- The machines page's install action was the last page-header button still on `md`, beside the
+ machine picker. `CreateButtons` defaulted its `size` to `md` while both call sites passed `sm`,
+ so the default was unreachable — a trap for the next caller; it defaults to `sm` now.
+- The three `<label>`s that a file picker needs, and that had each respelled the Button look by
+ hand — two of them byte-identical — read `labelButtonClass(variant, size)` from `button.tsx`,
+ built from the same two records `Button` itself reads.
+- `.agents/skills/penguin-harness-frontend/SKILL.md` records the button rule as "a button takes the
+ rung of whatever it stands beside", with the three places that means `sm`.
diff --git a/changelog/unreleased/2026-09-11-control-unification.zh.md b/changelog/unreleased/2026-09-11-control-unification.zh.md
new file mode 100644
index 00000000..16b1e0c2
--- /dev/null
+++ b/changelog/unreleased/2026-09-11-control-unification.zh.md
@@ -0,0 +1,36 @@
+# 按钮取用它所挨着的那一档,菜单搜索框有了自己的记录
+
+- **Date:** 2026-09-11
+- **Type:** fix
+- **Scope:** `web`
+- **PR:** [#699](https://github.com/Prism-Shadow/penguin-harness/pull/699)
+
+[English](2026-09-11-control-unification.md)
+
+沿 [#689](https://github.com/Prism-Shadow/penguin-harness/pull/689) 立下的规矩对表单控件做的第二遍:
+尺寸只有一份记录,规则靠检查而不是靠记住。
+
+## 详情
+
+- 设置对话框里有四个按钮比它们旁边的字段高一档——账户的「修改密码」、代理与上传的「保存」、管理
+ 员用户页的「新建」。这四个都是对话框**正文**里的按钮,#689 的规则本就把它们归在 `sm`;它们保留
+ 了 `Button` 的 `md` 缺省,只因为没有任何检查看得见它们。`control-size.test.ts` 现在把设置对话框
+ 的各页列进 `DIALOG_BODY_MODULES`,其中不写 `sm` 的 Button 会让它失败。
+- 智能体页头部加了搜索框——按名称、id 与描述过滤,不分大小写——形状与模型库头部一致:同样的
+ `flex-wrap` 标题行、同样的 `min-w-0 flex-1 sm:w-56 sm:flex-none` 包裹、同样的 `Input size="sm"`。
+ 创建按钮由 `md` 降为 `sm`,与旁边的搜索框读起来同档。搜不到时说的是「没有匹配」,而不是「没有
+ Agent」。
+- 模型库的「同步预置」只在确有待同步时出现,并以重点色呈现。无可同步时点它是空操作,而常驻的按钮
+ 为此占掉了头部的宽度。那颗更新圆点随之撤掉:它的意义是标出模型 trail 终点的那个按钮,而按钮现在
+ 只在 trail 存在时才存在,那颗点等于每次被看见时都亮着。
+- 四个不走 `Input` 的原生 `<input>` 搜索框——模型选择器、Skill 选择器、Workspace 浏览器、机器选择
+ 器——改为读取 `components/ui/input.tsx` 的 `menuSearchClass` 或 `panelSearchClass`,不再各写一份。
+ 这四份副本此前在圆角、内距、聚焦色、边框是否有过渡上已经各不相同。内距仍留给调用方,那是唯一真正
+ 该有差异的地方。
+- 机器页的安装动作是全应用最后一个仍为 `md` 的页面头部按钮,而它旁边就是机器选择器。`CreateButtons`
+ 的 `size` 缺省是 `md`,但两个调用点都显式传了 `sm`,这个缺省已经不可达——对下一个调用者是个陷阱;
+ 现在缺省为 `sm`。
+- 文件选择器必须用 `<label>`,三处各自把 Button 的样子手拼了一遍(其中两份逐字节相同),现在改为取用
+ `button.tsx` 的 `labelButtonClass(variant, size)`,它由 `Button` 自己读的那两份记录拼出。
+- `.agents/skills/penguin-harness-frontend/SKILL.md` 把按钮规则记为「按钮取用它所挨着的那一档」,并
+ 列出三处该取 `sm` 的场合。
diff --git a/packages/web/src/components/ui/button.tsx b/packages/web/src/components/ui/button.tsx
index f670e903..e8b89318 100644
--- a/packages/web/src/components/ui/button.tsx
+++ b/packages/web/src/components/ui/button.tsx
@@ -29,6 +29,10 @@ const sizeClass: Record<Size, string> = {
icon: "p-1.5 rounded-md",
};
+/** Layout and type shared by a real button and the `<label>` that stands in for one. */
+const buttonBase =
+ "inline-flex items-center justify-center gap-1 font-medium transition-colors duration-150";
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
variant?: Variant;
size?: Size;
@@ -38,8 +42,22 @@ export function Button({ variant = "secondary", size = "md", className, ...rest
return (
<button
type="button"
- className={`inline-flex items-center justify-center gap-1 font-medium transition-colors duration-150 disabled:cursor-not-allowed disabled:opacity-60 ${variantClass[variant]} ${sizeClass[size]} ${className ?? ""}`}
+ className={`${buttonBase} disabled:cursor-not-allowed disabled:opacity-60 ${variantClass[variant]} ${sizeClass[size]} ${className ?? ""}`}
{...rest}
/>
);
}
+
+/**
+ * The Button look on an element that cannot be a `<button>` — the `<label>` a file picker needs,
+ * since the hidden `<input type="file">` has to be labelled to be clickable. Built from the same
+ * two records `Button` reads, so a variant or a rung moves in one place; three call sites had each
+ * respelled the strings by hand, and two of them were byte-identical copies of the same one.
+ *
+ * Two deliberate differences from `Button`: the focus ring is `focus-within:`, because the thing
+ * that takes focus is the input inside the label rather than the label itself, and `cursor-pointer`
+ * is spelled out, which a `<button>` gets from the app's base rules and a `<label>` does not.
+ */
+export function labelButtonClass(variant: Variant, size: Exclude<Size, "icon">): string {
+ return `${buttonBase} cursor-pointer focus-within:ring-2 focus-within:ring-gray-400/30 ${variantClass[variant]} ${sizeClass[size]}`;
+}
diff --git a/packages/web/src/components/ui/input.tsx b/packages/web/src/components/ui/input.tsx
index e4186f46..39d7e2b6 100644
--- a/packages/web/src/components/ui/input.tsx
+++ b/packages/web/src/components/ui/input.tsx
@@ -109,6 +109,35 @@ export function autofillProps(autoComplete: string | undefined, secret: boolean)
*/
export const noAutofill = autofillProps(undefined, false);
+/**
+ * The search box a menu or a side panel carries at its top — the one input in the app that does
+ * not go through `Input`, because it is not a form field: it owns the panel's keyboard while the
+ * panel is up, and it sits inside a container that already draws the border it would otherwise
+ * need. Four call sites had each written their own copy, and the copies had drifted apart on
+ * radius, padding, focus colour and whether the border transitions at all.
+ *
+ * Two shapes, because the containers differ:
+ *
+ * - `menuSearchClass` — the box sits directly under its menu's own divider and draws no border of
+ * its own (a second line a pixel below the first reads as a mistake). The model picker and the
+ * Skill picker.
+ * - `panelSearchClass` — the box stands inside a panel with room around it, so it draws its own.
+ * The Workspace browser and the machines picker.
+ *
+ * Both take the `sm` rung, like every other control; padding is left to the caller, which is the
+ * one thing that legitimately differs (the Workspace browser reserves room on the right for its
+ * clear button, the way `Textarea` keeps its own padding over `sizeClass`'s).
+ */
+const searchSharedClass =
+ `w-full bg-transparent ${sizeTextClass.sm} text-gray-700 ` +
+ "placeholder:text-gray-400 focus:outline-none dark:text-gray-200 dark:placeholder:text-gray-500";
+
+export const menuSearchClass = `${searchSharedClass} rounded border border-transparent`;
+
+export const panelSearchClass =
+ `${searchSharedClass} rounded-md border border-gray-200 transition-colors ` +
+ "focus:border-gray-400 dark:border-gray-700 dark:focus:border-gray-500";
+
export function Input({
label,
hint,
diff --git a/packages/web/src/features/admin/admin-users-page.tsx b/packages/web/src/features/admin/admin-users-page.tsx
index abf6a56b..51687f0f 100644
--- a/packages/web/src/features/admin/admin-users-page.tsx
+++ b/packages/web/src/features/admin/admin-users-page.tsx
@@ -49,7 +49,7 @@ export function AdminUsersSection() {
return (
<div>
<div className="mb-4 flex justify-end">
- <Button variant="primary" onClick={() => setCreateOpen(true)}>
+ <Button size="sm" variant="primary" onClick={() => setCreateOpen(true)}>
{S.admin.createUser}
</Button>
</div>
diff --git a/packages/web/src/features/agents/agents-page.tsx b/packages/web/src/features/agents/agents-page.tsx
index 11349d02..bdac7426 100644
--- a/packages/web/src/features/agents/agents-page.tsx
+++ b/packages/web/src/features/agents/agents-page.tsx
@@ -18,7 +18,7 @@
* dropdowns over the shared multi-select panel, with select all / select none. A plain new Agent
* otherwise starts with none.
*/
-import { useEffect, useRef, useState } from "react";
+import { useEffect, useMemo, useRef, useState } from "react";
import type { ChangeEvent } from "react";
import { useLocation, useNavigate } from "react-router";
import type {
@@ -125,6 +125,17 @@ export function AgentsPage() {
const { locale } = useLocale();
const { user } = useAuth();
const { currentProject, agents, agentsLoading, reloadAgents, setCurrentAgentId } = useProject();
+ /** Header search, the Models page's shape: name, id and description, case-insensitive. */
+ const [query, setQuery] = useState("");
+ const shownAgents = useMemo(() => {
+ const needle = query.trim().toLowerCase();
+ if (needle === "") return agents;
+ return agents.filter((a) =>
+ [agentDisplayName(a), a.agentId, a.description ?? ""].some((field) =>
+ field.toLowerCase().includes(needle),
+ ),
+ );
+ }, [agents, query]);
/** The kernel trail's raised badge, or undefined — the notice under the title acts on it or clears it. */
const kernelTodo = useUpdateBadges().todos.agents;
/** The bulk kernel update's confirmation is open. */
@@ -413,11 +424,25 @@ export function AgentsPage() {
(to the list) is the same whether or not the notice is showing — the models page's
header has the same shape. */}
<div className="mb-4">
- <div className="flex items-center justify-between gap-2">
+ <div className="flex flex-wrap items-center justify-between gap-2">
<h1 className="text-xl font-semibold">{S.agent.listTitle}</h1>
- <Button variant="primary" onClick={openCreate}>
- {S.agent.create}
- </Button>
+ {/* Search plus the create action, in the Models page header's shape: on a narrow
+ screen flex-wrap drops the pair onto its own line and the box shrinks with it,
+ fixed width from sm up. Both controls take the form rung, so the button reads at
+ the size of the box beside it rather than a step above it. */}
+ <div className="flex min-w-0 max-w-full grow items-center gap-2 sm:grow-0">
+ <div className="min-w-0 flex-1 sm:w-56 sm:flex-none">
+ <Input
+ size="sm"
+ value={query}
+ onChange={(e) => setQuery(e.target.value)}
+ placeholder={S.agent.searchPlaceholder}
+ />
+ </div>
+ <Button size="sm" variant="primary" onClick={openCreate}>
+ {S.agent.create}
+ </Button>
+ </div>
</div>
{/* Last stop on the kernel trail, in the one shape all four dismissible trails use.
@@ -457,15 +482,15 @@ export function AgentsPage() {
</SkeletonCard>
))}
</div>
- ) : agents.length === 0 ? (
- <EmptyState title={S.common.none} />
+ ) : shownAgents.length === 0 ? (
+ <EmptyState title={query.trim() === "" ? S.common.none : S.agent.searchEmpty} />
) : (
/* GitHub-repo-list-style single column: separate cards with row spacing; each row is
one horizontal band of "info | sparkline | button group", with the info column
compressed to two lines of text (name line + combined description/stats line) to
minimize row height */
<div className="space-y-3">
- {agents.map((a) => {
+ {shownAgents.map((a) => {
const builtin = BUILTIN_AGENT_IDS.has(a.agentId);
return (
<div
diff --git a/packages/web/src/features/agents/memory-tab.tsx b/packages/web/src/features/agents/memory-tab.tsx
index 6f1245bb..83f6ba86 100644
--- a/packages/web/src/features/agents/memory-tab.tsx
+++ b/packages/web/src/features/agents/memory-tab.tsx
@@ -37,7 +37,7 @@ import { toneStrip } from "../../lib/tone";
import { useAuth } from "../../state/auth";
import { useLocale } from "../../state/locale";
import { useProject } from "../../state/project";
-import { Button } from "../../components/ui/button";
+import { Button, labelButtonClass } from "../../components/ui/button";
import { CopiedStatus, CopyCheckGlyph, useCopied } from "../../components/ui/copy-button";
import { GlyphIcon } from "../../components/ui/glyph-icon";
import { InfoPopover } from "../../components/ui/info-popover";
@@ -84,11 +84,7 @@ const PLUS_ICON = "M12 5v14M5 12h14";
* and the import control has to wrap a file input (the Agent State section's transfer label does
* the same for its own size). Mirrors Button's `ghost` variant at `sm`, icon + text.
*/
-const GHOST_LABEL_CLASS =
- "inline-flex cursor-pointer items-center justify-center gap-1 rounded-md border border-transparent " +
- "px-2.5 py-1 text-xs font-medium text-gray-600 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-900 " +
- "focus-within:ring-2 focus-within:ring-gray-400/30 " +
- "dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100";
+const GHOST_LABEL_CLASS = labelButtonClass("ghost", "sm");
/**
* Collapsed scope keys, persisted per user \u00d7 Project \u00d7 Agent (localStorage, same conventions as
diff --git a/packages/web/src/features/agents/skills-tab.tsx b/packages/web/src/features/agents/skills-tab.tsx
index c5f95484..eaf681f1 100644
--- a/packages/web/src/features/agents/skills-tab.tsx
+++ b/packages/web/src/features/agents/skills-tab.tsx
@@ -26,7 +26,7 @@ import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { useLocale } from "../../state/locale";
import { agentDisplayName, useProject } from "../../state/project";
-import { Button } from "../../components/ui/button";
+import { Button, labelButtonClass } from "../../components/ui/button";
import { CopiedStatus, CopyCheckGlyph, useCopied } from "../../components/ui/copy-button";
import { GlyphIcon } from "../../components/ui/glyph-icon";
import { Input, Textarea } from "../../components/ui/input";
@@ -45,12 +45,8 @@ 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; the Hooks tab's upload label borrows it. */
-export const UPLOAD_LABEL_CLASS =
- "inline-flex cursor-pointer items-center justify-center gap-1 rounded-md border border-gray-300 " +
- "bg-white px-2.5 py-1 text-xs font-medium text-gray-800 transition-colors duration-150 " +
- "hover:bg-gray-50 focus-within:ring-2 focus-within:ring-gray-400/30 " +
- "dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800";
+/** The Button look on the upload `<label>`; the Hooks tab's upload label borrows it. */
+export const UPLOAD_LABEL_CLASS = labelButtonClass("secondary", "sm");
/** Delete (trash can) icon path — the same glyph as the agents page card delete; the Hooks tab's row delete borrows it. */
export const TRASH_ICON =
diff --git a/packages/web/src/features/agents/snapshot-file.ts b/packages/web/src/features/agents/snapshot-file.ts
index c67f8645..436a9cb6 100644
--- a/packages/web/src/features/agents/snapshot-file.ts
+++ b/packages/web/src/features/agents/snapshot-file.ts
@@ -1,15 +1,12 @@
/** Picking and reading Agent State snapshot packages (`<agentId>-v<n>.tar.gz`). */
+import { labelButtonClass } from "../../components/ui/button";
/**
- * <a download>/<label> version of the button look (matches Button secondary sm; the Button
- * component only renders <button>): the settings page's transfer actions and the create
- * dialog's snapshot picker.
+ * The button look on the `<a download>` / `<label>` the transfer actions and the snapshot picker
+ * need — the settings page's transfers and the create dialog's picker, neither of which can be a
+ * `<button>`.
*/
-export const SNAPSHOT_BUTTON_CLASS =
- "inline-flex cursor-pointer items-center justify-center gap-1 rounded-md border border-gray-300 " +
- "bg-white px-2.5 py-1 text-xs font-medium text-gray-800 transition-colors duration-150 " +
- "hover:bg-gray-50 focus-within:ring-2 focus-within:ring-gray-400/30 " +
- "dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800";
+export const SNAPSHOT_BUTTON_CLASS = labelButtonClass("secondary", "sm");
/**
* Accept list for the snapshot file pickers.
diff --git a/packages/web/src/features/ai-create/create-buttons.tsx b/packages/web/src/features/ai-create/create-buttons.tsx
index 03dd38b7..d2b6dd61 100644
--- a/packages/web/src/features/ai-create/create-buttons.tsx
+++ b/packages/web/src/features/ai-create/create-buttons.tsx
@@ -25,7 +25,7 @@ export interface CreateButtonsProps {
export function CreateButtons({
onAi,
onManual,
- size = "md",
+ size = "sm",
aiLabel,
manualLabel,
disabled,
diff --git a/packages/web/src/features/chat/model-select.tsx b/packages/web/src/features/chat/model-select.tsx
index 61a3a900..98d29175 100644
--- a/packages/web/src/features/chat/model-select.tsx
+++ b/packages/web/src/features/chat/model-select.tsx
@@ -19,7 +19,7 @@ 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 { menuSearchClass, noAutofill } from "../../components/ui/input";
import { ProviderLogo } from "../../components/ui/provider-logo";
import {
hasConfiguredKey,
@@ -123,7 +123,7 @@ export function PickerList<T>({
placeholder={searchPlaceholder}
aria-label={searchPlaceholder}
{...noAutofill}
- className="w-full rounded border border-transparent bg-transparent px-1 py-0.5 text-xs text-gray-700 placeholder:text-gray-400 focus:outline-none dark:text-gray-200 dark:placeholder:text-gray-500"
+ className={`${menuSearchClass} px-1 py-0.5`}
/>
</div>
<div className="max-h-56 overflow-y-auto">
diff --git a/packages/web/src/features/chat/workspace-browser.tsx b/packages/web/src/features/chat/workspace-browser.tsx
index e38d36a7..804b7c37 100644
--- a/packages/web/src/features/chat/workspace-browser.tsx
+++ b/packages/web/src/features/chat/workspace-browser.tsx
@@ -119,7 +119,7 @@ import {
UPLOAD_ICON,
WRAP_TEXT_ICON,
} from "../../components/ui/icons";
-import { Input, noAutofill } from "../../components/ui/input";
+import { Input, noAutofill, panelSearchClass } from "../../components/ui/input";
import { ZoomableImage } from "../../components/ui/image-zoom";
import { SkeletonList } from "../../components/ui/skeleton";
import { Tooltip } from "../../components/ui/tooltip";
@@ -1769,7 +1769,7 @@ export function WorkspaceBrowser({
placeholder={S.files.searchPlaceholder}
aria-label={S.files.searchPlaceholder}
{...noAutofill}
- className="w-full rounded border border-gray-200 bg-transparent py-1 pl-2 pr-7 text-xs text-gray-700 placeholder:text-gray-400 focus:border-gray-400 focus:outline-none dark:border-gray-700 dark:text-gray-200 dark:placeholder:text-gray-500 dark:focus:border-gray-500"
+ className={`${panelSearchClass} py-1 pl-2 pr-7`}
/>
{query !== "" && (
<button
diff --git a/packages/web/src/features/machines/machines-page.tsx b/packages/web/src/features/machines/machines-page.tsx
index 0ce9f759..55eef8b5 100644
--- a/packages/web/src/features/machines/machines-page.tsx
+++ b/packages/web/src/features/machines/machines-page.tsx
@@ -43,7 +43,7 @@ import { EmptyState } from "../../components/ui/empty-state";
import { InfoPopover } from "../../components/ui/info-popover";
import { Skeleton } from "../../components/ui/skeleton";
import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { noAutofill } from "../../components/ui/input";
+import { noAutofill, panelSearchClass } from "../../components/ui/input";
import { ChevronDown, NAV_ICONS } from "../../components/ui/icons";
import { installButtonState, installedMachines, verdictOf } from "./machines-view";
import type { MachineVerdict } from "./machines-view";
@@ -227,7 +227,7 @@ export function MachinesPage() {
placeholder={S.machines.search}
aria-label={S.machines.search}
{...noAutofill}
- className="w-full rounded-md border border-gray-200 bg-transparent px-2.5 py-1.5 text-xs transition-colors outline-none placeholder:text-gray-400 focus:border-gray-400 dark:border-gray-700 dark:placeholder:text-gray-500 dark:focus:border-gray-500"
+ className={`${panelSearchClass} px-2.5 py-1.5`}
/>
</div>
)}
@@ -280,6 +280,7 @@ export function MachinesPage() {
)}
</Dropdown>
<Button
+ size="sm"
variant="primary"
disabled={button.disabled}
onClick={() => void install()}
diff --git a/packages/web/src/features/models/models-page.tsx b/packages/web/src/features/models/models-page.tsx
index c2d2bc8e..bd029a79 100644
--- a/packages/web/src/features/models/models-page.tsx
+++ b/packages/web/src/features/models/models-page.tsx
@@ -125,7 +125,6 @@ import { useUpdateBadges } from "../../lib/use-update-badges";
import { dismissTodo } from "../../lib/todo-dismissals";
import { noticeCounts } from "../../lib/bulk-update";
import { refreshProjectTodos } from "../../lib/use-project-todos";
-import { UpdateDot } from "../../components/ui/update-dot";
import { TodoNotice } from "../../components/ui/todo-notice";
import { buildImportedRows } from "./group-import";
import { tpsTone, ttftTone } from "./speed-test";
@@ -1040,32 +1039,23 @@ export function ModelsPage() {
placeholder={S.models.searchPlaceholder}
/>
</div>
- {/* The dot stays on the control that ACTS, not on the notice below: it marks the
- button the trail ends at, and a mark that moved off it would point at nothing.
- Owner-only, like the button — the gate never raises this for a member. The dot
- straddles the button's top-right corner (update-dot.tsx's rule for a button)
- and is decorative: the sr-only sentence folds what is waiting into the button's
- accessible name, in the wording the trail carried down. */}
- {isOwner && (
+ {/* The action appears only while a sync is actually waiting, and the accent says so
+ — a preset sync with nothing to sync is a no-op, and a permanent button spent the
+ header's width on one. That is also why the dot is gone: it marked this button as
+ the end of the models trail, and on a button that exists only when the trail does,
+ it would be lit every time it was seen. The sr-only sentence stays, folding what is
+ waiting into the accessible name in the wording the trail carried down.
+ Owner-only — the gate never raises this for a member. */}
+ {isOwner && todo && (
<Button
size="sm"
- className="relative"
+ variant="primary"
onClick={() => void syncPresets()}
disabled={busy || rows === null}
- title={
- todo ? `${S.models.syncCatalogHint} · ${syncNote}` : S.models.syncCatalogHint
- }
+ title={`${S.models.syncCatalogHint} · ${syncNote}`}
>
{S.models.syncCatalog}
- {todo && (
- <>
- <UpdateDot
- size="inline"
- position="right-0.5 top-0.5 -translate-y-1/2 translate-x-1/2"
- />
- <span className="sr-only"> · {syncNote}</span>
- </>
- )}
+ <span className="sr-only"> · {syncNote}</span>
</Button>
)}
</div>
diff --git a/packages/web/src/features/settings/account-section.tsx b/packages/web/src/features/settings/account-section.tsx
index 8642b2c6..3d030870 100644
--- a/packages/web/src/features/settings/account-section.tsx
+++ b/packages/web/src/features/settings/account-section.tsx
@@ -15,7 +15,7 @@ export function AccountSection() {
return (
<div className="divide-y divide-gray-100 dark:divide-gray-800/60">
<PrefRow label={S.account.changePassword} info={S.settings.changePasswordInfo}>
- <Button variant="secondary" onClick={() => setChangePasswordOpen(true)}>
+ <Button size="sm" variant="secondary" onClick={() => setChangePasswordOpen(true)}>
{S.account.changePassword}
</Button>
</PrefRow>
diff --git a/packages/web/src/features/settings/proxy-section.tsx b/packages/web/src/features/settings/proxy-section.tsx
index b63075ef..e4fd323e 100644
--- a/packages/web/src/features/settings/proxy-section.tsx
+++ b/packages/web/src/features/settings/proxy-section.tsx
@@ -187,7 +187,12 @@ export function ProxySection() {
<>
<SectionShell
actions={
- <Button variant="primary" disabled={!hydrated || busy} onClick={() => void save()}>
+ <Button
+ size="sm"
+ variant="primary"
+ disabled={!hydrated || busy}
+ onClick={() => void save()}
+ >
{S.common.save}
</Button>
}
diff --git a/packages/web/src/features/settings/uploads-section.tsx b/packages/web/src/features/settings/uploads-section.tsx
index ea1631e2..a3b51fe5 100644
--- a/packages/web/src/features/settings/uploads-section.tsx
+++ b/packages/web/src/features/settings/uploads-section.tsx
@@ -113,7 +113,12 @@ export function UploadsSection() {
return (
<SectionShell
actions={
- <Button variant="primary" disabled={!hydrated || busy} onClick={() => void save()}>
+ <Button
+ size="sm"
+ variant="primary"
+ disabled={!hydrated || busy}
+ onClick={() => void save()}
+ >
{S.common.save}
</Button>
}
diff --git a/packages/web/src/features/skills/skill-pick-list.tsx b/packages/web/src/features/skills/skill-pick-list.tsx
index df9f4746..eee0e770 100644
--- a/packages/web/src/features/skills/skill-pick-list.tsx
+++ b/packages/web/src/features/skills/skill-pick-list.tsx
@@ -21,7 +21,7 @@ import type { SkillMetadataItem } from "@prismshadow/penguin-server/api";
import { S } from "../../lib/strings";
import { useLocale } from "../../state/locale";
import { ICON_SIZE } from "../../lib/icon-scale";
-import { noAutofill } from "../../components/ui/input";
+import { menuSearchClass, noAutofill } from "../../components/ui/input";
import { filterSkills, localizedShortText } from "../chat/skill-use";
import { SkillIcon } from "./skill-icon-view";
@@ -70,7 +70,7 @@ export function SkillPickList({
placeholder={searchLabel}
aria-label={searchLabel}
{...noAutofill}
- className="w-full rounded border border-transparent bg-transparent px-1 py-0.5 text-xs text-gray-700 placeholder:text-gray-400 focus:outline-none dark:text-gray-200 dark:placeholder:text-gray-500"
+ className={`${menuSearchClass} px-1 py-0.5`}
/>
</div>
{bulk && skills.length > 0 && (
diff --git a/packages/web/src/lib/strings-en.ts b/packages/web/src/lib/strings-en.ts
index 4cc59efd..5cd6c018 100644
--- a/packages/web/src/lib/strings-en.ts
+++ b/packages/web/src/lib/strings-en.ts
@@ -550,6 +550,8 @@ export const en: Strings = {
takesEffectSuffix:
" — new conversations pick it up right away, running ones after their next compaction",
listTitle: "Agents",
+ searchPlaceholder: "Search agents: id / name / description",
+ searchEmpty: "No agent matches that.",
create: "Create agent",
createTitle: "Create agent",
id: "Agent id",
diff --git a/packages/web/src/lib/strings.ts b/packages/web/src/lib/strings.ts
index 9ca3d313..41ab3a35 100644
--- a/packages/web/src/lib/strings.ts
+++ b/packages/web/src/lib/strings.ts
@@ -552,6 +552,8 @@ export const zh = {
/** Appended to an action's own toast (skill install / uninstall) — same timing statement. */
takesEffectSuffix: ";新对话立即生效,进行中的对话在下一次压缩后生效",
listTitle: "Agents",
+ searchPlaceholder: "搜索 Agent:id / 名称 / 描述",
+ searchEmpty: "没有匹配的 Agent",
create: "创建 Agent",
createTitle: "创建 Agent",
id: "Agent id",
diff --git a/packages/web/test/control-size.test.ts b/packages/web/test/control-size.test.ts
index d0bb04d9..452ab843 100644
--- a/packages/web/test/control-size.test.ts
+++ b/packages/web/test/control-size.test.ts
@@ -80,8 +80,9 @@ function literalChunks(node: ts.Node, out: string[] = []): string[] {
* single place to set this and the rule has to be checked instead.
*
* The reach is what a parser can see without types: Buttons written inline in the `footer={…}`
- * attribute. A footer handed over as a component (`footer={<Footer …/>}`) or built in a variable,
- * and a Button in a dialog *body*, are on the same rule but out of this check's sight.
+ * attribute. A footer handed over as a component (`footer={<Footer …/>}`) or built in a variable
+ * is on the same rule but out of this check's sight. A Button in a dialog *body* is covered by
+ * `findLooseDialogBodyButtons` instead, for the modules that are only ever dialog content.
*/
function findLooseFooterButtons(): string[] {
const loose: string[] = [];
@@ -124,6 +125,64 @@ function findLooseFooterButtons(): string[] {
return loose.sort();
}
+/**
+ * Modules that are only ever rendered as a dialog's body. The settings dialog is a `PagedDialog`,
+ * which is a `Modal`, and each of these is one of its pages — so every Button in them belongs with
+ * the fields beside it on the `sm` rung, exactly as a footer button does. A parser cannot infer
+ * that from the file alone (nothing in a section module says it renders in a dialog), so the fact
+ * is declared here. Add a module when it becomes settings-dialog content; drop one when it stops.
+ */
+const DIALOG_BODY_MODULES = new Set([
+ "features/settings/account-section.tsx",
+ "features/settings/appearance-section.tsx",
+ "features/settings/general-section.tsx",
+ "features/settings/proxy-section.tsx",
+ "features/settings/section-shell.tsx",
+ "features/settings/setting-row.tsx",
+ "features/settings/trace-import-row.tsx",
+ "features/settings/uploads-section.tsx",
+ "features/admin/admin-users-page.tsx",
+]);
+
+/**
+ * Buttons in a dialog-body module that do not ask for `sm`, as "relative/path:line rung". `icon`
+ * passes: a square glyph button carries no text and so sits on no font rung.
+ */
+function findLooseDialogBodyButtons(): string[] {
+ const loose: string[] = [];
+ for (const path of tsxFiles()) {
+ const rel = path.slice(SRC.length + 1).replaceAll(sep, "/");
+ if (!DIALOG_BODY_MODULES.has(rel)) continue;
+ 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) === "Button") {
+ const attrs = (node as ts.JsxSelfClosingElement | ts.JsxOpeningElement).attributes
+ .properties;
+ const size = attrs.find(
+ (attr) => ts.isJsxAttribute(attr) && attr.name.getText() === "size",
+ );
+ const rung =
+ size !== undefined && ts.isJsxAttribute(size) && size.initializer !== undefined
+ ? size.initializer.getText()
+ : "<none>";
+ if (rung !== '"sm"' && rung !== '"icon"') {
+ const line = source.getLineAndCharacterOfPosition(node.getStart(source)).line + 1;
+ loose.push(`${rel}:${line} ${rung}`);
+ }
+ }
+ ts.forEachChild(node, visit);
+ };
+ visit(source);
+ }
+ return loose.sort();
+}
+
/** Control call sites whose own `className` spells a font size, as "relative/path:line — class". */
function findSpelledSizes(): string[] {
const strays: string[] = [];
@@ -222,6 +281,18 @@ describe("control font size", () => {
).toEqual([]);
});
+ it("keeps a dialog body's buttons on the fields' rung", () => {
+ // Same rule as the footer, one layer in. The settings dialog's pages are separate modules, so
+ // the drift hides from review twice over: nothing in a section file says it renders inside a
+ // Modal, and the footer check above cannot see this far. Four of them had taken Button's md
+ // default and stood a rung above the fields they sat beside.
+ expect(
+ findLooseDialogBodyButtons(),
+ 'A Button in a dialog body passes size="sm", the rung the fields beside it are on. ' +
+ "If a module in DIALOG_BODY_MODULES has stopped being dialog content, drop it from the set.",
+ ).toEqual([]);
+ });
+
it("spells a font size in the two records and nowhere else in the family", () => {
// The point of the refactor, stated as the only thing a reader has to check: every font-size
// class the control modules contain belongs to one of two records. `select.tsx` and